sentences:
URP cant get Pixel Perfect Camera to work I am currently using URP to add bloom to my particlesystems. The problem im facing is that I cant pixelate the game. I have tried to implement several methods to post pixelate (via shaders and render texture) but none conserve the bloom on the particlesystem. This is the effect im after https://youtu.be/edaf2I-qwBg (using pixel perfect camera and zooming the editor window) but I cant achive this in build mode, any help on how I should pixelate the game so you can still see the character?

This is without 4x zoom:

This is my current settings:

sentences:
How do I get the Oculus Rift's position and rotation? I'm looking for the functions to get the position and rotation data of the rift headset itself in Unity.

I have the Oculus integration SDK installed and want to avoid using any pre-fabs.

sentences:
How to draw a Minecraft-like world with Open GL I recently completed the this Open GL tutorial. The tutorial shows how to set up a window and shaders, and teaches you how to draw a single cube in the middle of the screen, which all makes sense to me (I think).

I'd like to make just a simple flat world made of cubes like Minecraft, but I have no idea how to turn my single giant cube into a bunch of smaller cubes, or how to get the smaller cubes to be arranged in the proper way.

Mostly what doesn't make sense to me is the coordinate system being from 1 to -1 and trying to draw a bunch of cubes in that space. Is there a way to adjust that coordinate space to be more world-like, where each unit of coordinate space is roughly equivalent to a meter or something?

sentences:
Handling exact collisions on character controller and/or other objects in unity? (eg. head shot, chest , leg,etc) Hello all I have been working on games in Unity for a long while (making slow progress as I do it purely on my own , and of course you helpful people here on gamedev.stackexchange!)

I've made lots of capsule characters of my own using Rigidbody and without Rigidbody and on a basic level they work fine.  But i now want to detect exact points of collisions (for example if a bullet hits his head, or hand or knee etc etc)

I've been trying to read as much as I can find about this, but honestly can't find the answer i need. I believe I would achieve it by making several colliders on the character. But I don't know exactly how this would work , also I have seen some guides saying that I should use OverlapSphere but again there wasn't exact instructions and I can't figure out how to do it.

Also, when I add some sphere colliders to my character, they dont stay in the correct position in relation to the model once it is animated (eg. Crouching, or running, the leg spheres pop out of his legs for example).

Could anyone here provide an explanation of how I can do it?

sentences:
Understanding Tetris speed curve I'm attempting to make a Tetris clone and want to be as accurate to the games as I can. I found a chart that explains the speed curve that's supposedly used in games that follow the official Tetris guideline:
https://harddrop.com/wiki/Tetris_Worlds

1G = 1 cell per frame

Level 1: 0.01667G
Level 2: 0.021017G
Level 3: 0.026977G
Level 4: 0.035256G
Level 5: 0.04693G
Level 6: 0.06361G
Level 7: 0.0879G
Level 8: 0.1236G
Level 9: 0.1775G
Level 10: 0.2598G
Level 11: 0.388G
Level 12: 0.59G
Level 13: 0.92G
Level 14: 1.46G
Level 15: 2.36G

Another thing that might be worth noting is, like most Tetris games, my loop is updating at 60fps.

So given all this, there are two things that I'm having problems understanding.

1: The speed curve doesn't always translate to whole numbers.

For example, at level 2: 1 / 0.021017 = 47.5805300471. So every 47.5805300471 frames the game is supposed to drop the piece one row. Am I supposed to round these numbers? I can't process a partial frame so I don't understand why the speed curve comes out as a decimal.

2: Level 14 and 15 drop the piece more than one row per frame

Because it's dropping more than one row per frame, this would make some moves impossible in the game. For example, if I wanted to move a piece horizontally into a one cell space and the game is dropping the piece more than one row at a time, it will skip the row entirely and make the move impossible. Is this correct or am I missing something?

sentences:
Unity: Problem with swipe I rotate a 3D object to left and right with swipe to left and right. Problem is on different devices with different pixel densities, it gets faster and slower. i.e. if you move your finger 1 cmm on one device will not rotate the object same amount that it will on another device, like a Retina and non-Retina one.

Last time I wanted to solve this I could not as IIRC there was no way to get physical pixel density of device or it's dimensions (to get density via division over resolution)

Thanks.

sentences:
New Input System Differs Between Editor and Runtime? I'm sure the problem is me.
Here is a simple look script (from a tutorial, actually).
I'm getting inconsistent results between editor and runtime. I'm guessing its a framerate thing.
Code:
using UnityEngine;
using Mirror;
using Cinemachine;

public class PlayerCameraController : NetworkBehaviour
{
    [Header("Camera")]
    [SerializeField] private Vector2 maxFollowOffset = new Vector2(-1f, 6f);
    [SerializeField] private Vector2 cameraVelocity = new Vector2(4f, 0.25f);

    [SerializeField] private Transform playerTransform = null;
    [SerializeField] private CinemachineVirtualCamera virtualCamera = null;

    private Controls controls;
    private Controls Controls {
        get {
            if (controls != null) { return controls; }
            return controls = new Controls();
        }
    }
    private CinemachineTransposer transposer;

    public override void OnStartAuthority()
    {
        transposer = virtualCamera.GetCinemachineComponent<CinemachineTransposer>();
        virtualCamera.gameObject.SetActive(true);

        Controls.Player.Look.performed += ctx => Look(ctx.ReadValue<Vector2>());

        enabled = true;
    }

    [ClientCallback]
    private void OnEnable() => Controls.Enable();

    [ClientCallback]
    private void OnDisable() => Controls.Disable();

    private void Look(Vector2 lookAxis) {
        float deltaTime = Time.deltaTime;

        float followOffset = Mathf.Clamp(
            transposer.m_FollowOffset.y - (lookAxis.y * cameraVelocity.y * deltaTime),
            maxFollowOffset.x,
            maxFollowOffset.y);

        transposer.m_FollowOffset.y = followOffset;
        playerTransform.Rotate(0f, lookAxis.x * cameraVelocity.x * deltaTime, 0f);
    }
}

The code seems right. Watching the values of Vector2 lookAxis reveals that the numbers are slightly different coming into the function based on environment.
Is there something wrong with this code that would give different results between editor and runtime?

sentences:
How can I resolve component types in a way that supports adding new types relatively easily? I am trying to build an Entity Component System for an interactive application developed using C++ and OpenGL. My question is quite simple. In my GameObject class I have a collection of Components. I can add and retrieve components.

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

};

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

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

or possibly

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

I  could be make a Component Factory like this:

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

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

sentences:
Solidworks (3D model) import help Hey guys, I'm not sure if this is the right place to ask, but I'm also not sure where else to ask.  I have a 3D model in Solidworks that is imported from a STL file.  Solidworks imports the file multiple triangular faces and as either a solid, or a surface.  See pic below:

What I need to do is take the model and have it be hollow but with a thickness, not that big.  Also it would help to have the surface be one smooth surface since I will be imported it to another program, ADINA.  Any ideas or suggestions?

sentences:
Accessing 3D texture data without normalized coordinates directly, but with filtering texelFetch() exists to access texture data with texture coordinates in "image dimensions", but texelFetch skips filtering.

In case of 2D textures, it's possible to use a rectangle texture sampler to access textures without normalized coordinates with filtering, but the same equivalent doesn't seem to exist for 3D textures.

Is this somehow possible with 3D textures?

sentences:
Help with dropping items in a game I am making a game where i have items or blocks stacked on top of each other.

What i would like to do is, when the first item(or the item at the bottom of the stack) is removed, i would like to shift all the blocks above, down into the next position below it and add another block to the top of the stack.

Sort of like in a match 3 game.

Could someone provide instructions for doing this? or some type of psuedocode?

Thanks guys

sentences:
What are the correct steps to add Admob to Unity? The official documentation leaves out really important steps.
Adding 'cocaopods' and 'Google Play Services'
They are just listed as prerequisites without even any links.
Another confusing thing is that, elsewhere I have seen that apparently I don't also need the Unity Google Play Games Services SDK for Admob to work. But in that case then why is 'Google Play Services' listed as a prerequisite on the official docs?

sentences:
Calculating distance using Job System I am trying to find out the distance between game objects and the player position using Job System, But I am getting an error of unsafe pointer race condition. Can anyone tell me how to access transform in job system? to measure distance.
 Following is the code.

struct PositionUpdateJob : IJobParallelForTransform

{

    public TransformAccessArray Object;

    public float DIst;

    public void Execute(int i, TransformAccess transform)

    {

         DIst = (transform.position- Object[0].position ).sqrMagnitude;
        if (DIst < 20)
        {
           // Do Something
        }
    }

}

This is the Main script which measures gameObject position against its children

public Transform Player;
public List<Transform> ChildList = new List<Transform>();
public TransformAccessArray Transformz;
public float Dist;
PositionUpdateJob m_Job;
JobHandle m_PositionJobHandle;
public TransformAccessArray Mey;
void Start ()
{
    Transformz = new TransformAccessArray(0, -1);
    Mey = new TransformAccessArray(0,-1);
    Mey.Add(transform);
    GetChildRecursive(gameObject);
    }
private void GetChildRecursive(GameObject obj)
{
 //To Get All childrens for transform access array
}
void Update()
{
    m_PositionJobHandle.Complete();
    m_Job = new PositionUpdateJob()
    {
        DIst = Dist,
        Object = Mey
};
    m_Job.Schedule(Transformz);
  }
private void LateUpdate()
{
    m_PositionJobHandle.Complete();
    Transformz.Dispose();
}

sentences:
Cocos2D Accelerometer Z axis I am making a 2D scroller game where the player controls an airplane via the accelerometer  I would like to know if it is possible to scale in and to scale out the sprite/airplane using the accelerometer z axis. I would like to know how to do this to create a depth illusion.

Any suggestion, tutorial recommendation, and comments are appreciated.

Thanks.

sentences:
Saving and Loading File to Application.persistentDataPat not working on Android device I am trying to save data and load data on the project i am working on, but i cant seem to get it work in an Android device it works fine on Unity when i play it, not sure what i am missing or done wrong here is the following code i use to save and load data.

using System.Collections;
 using System;
 using System.Runtime.Serialization.Formatters.Binary;
 using System.IO;

public class PlayerInfo : MonoBehaviour {

 public static PlayerInfo playerData;
 public int gameCoins;

 void OnDisable()
 {
     BinaryFormatter bf = new BinaryFormatter ();
     FileStream file = File.Create (Application.persistentDataPath + "playerinfo.dat");

     PlayerData data = new PlayerData ();
     data.gameCoins = gameCoins;

     bf.Serialize (file, data);
     file.Close ();
 }

 void OnEnable()
 {
     BinaryFormatter bf = new BinaryFormatter ();
     FileStream file = File.Open (Application.persistentDataPath + "playerinfo.dat", FileMode.Open);
     PlayerData data = (PlayerData)bf.Deserialize (file);
     file.Close ();

     gameCoins = data.gameCoins;

 }

 }
 [Serializable]
 class PlayerData
 {
     public int gameCoins;
 }

Anyone can give me an idea of what i need to do or look at i will be very much appreciated, and many thanks in advance for taking the time to help.

sentences:
Path following with Asteroids-like movement. Time to complete path I'm currently learning about how to do this, but it's best to post the problem beforehand. (posting on Physics and GameDev, as you guys know your math)

It's quite difficult to explain. This specific problem revolves around a problem of creating a guidance system for rocket powered craft.
Think: 'I want the ship from game "Asteroids" to follow a specific path and compute, how much time will the whole trip take beforehand"

A craft has it's own properties like mass, linear and angular acceleration. It is only able to accelerate in its forwards direction. Also, quite a pain in the... it's maximum traverse velocity is limited.

Hopefully the picture clears some things out:

The problem lays in the very first step. The program is initiated while the craft is already moving with random velocity and faces random direction.
In order to move fully toward the target point, first the craft has to turn to face "U" vector. But while doing so, it still moves, so the vector "U" will change.
From the picture you can see that the direction of turn can change, don't worry, it's not a problem.

So, the problem. I tried using only vector math, but with no success as the variable I'm trying to compute relies on equations involving this variable. I'm too dumb to get only the variable I'm interested in on one side of equation.
I think the solution would involve a function of distance from craft to object over time.

[Edit 1]

For your interest. Here is the part where I get stuck.

From the beginning. We have the craft on initial position "A", travelling with velocity "V1" and the target on initial position "B", with velocity "V2" (better include it just in case)

From that we can compute the burn vector "U", that we need to align ourselves to in order to travel towards the target at the speed of "Vmax"

The bigger the angle between craft's heading "Cf" and vector "U", the longer it will take the craft to turn. Which means, the craft will cover more distance while turning (uppermost picture). Which means the angle will change during turning etc. etc.

On second picture, in red box. at the top we compute dot product, at the bottom we multiply magnitudes of vectors. As the Cf vector is of length 1 all the time, we can spare it.

The primary thing I'm looking for is variable "t", currently I'm out of ideas.

sentences:
How to use Unity3D Social for OSX? I can't seem to find any documentation using the Social APIs with OSX. I can successfully use the iOS Social Libraries, but when I translate it over to OSX, it doesn't do anything. Also please refrain from suggesting Prime31, as I know that option exists, but the functionality for OSX leaderboards/game center is natively built into Social API in Unity 4.1+ yet there is no documentation to be found!?

I want to know how to use Social.ReportScore, and the ShowLeaderboard UI Methods for OSX games. I would also like to know how to report achievement progress.

I've tried using the EXACT methods from the Unity.Social Library that works for my other iOS/iPhone/iPad games.  I've attempted the code in both C# and UnityScript (JScript) to no avail.

Please help.

sentences:
How can I distribute the source code of my project without the imported assets? I have a Unity project that uses some assets that I downloaded for free in the Unity asset store. I would like to make my project open source and distribute its source code in GitHub. But, I do not want to put the assets I downloaded in my GitHub, since they are not mine. Also, these assets take a lot of space in my repository.

Can I arrange my project in such a way that any user who downloads it will be automatically sent to the Unity asset store to download the required assets?

I found that it works well with TextMesh Pro: I can remove the TextMesh Pro folder from my Assets folder, and then when I open the project in Unity, it prompts me to re-import TextMesh Pro, and when the import is done, the game works well. Is it possible to achieve a similar effect with other assets?

sentences:
what should the size of a flash game in Facebook be I'm developing a flash game and i want to put it in Facebook
,My question is the Proper maximum  size for it.
500 KB
1 MB ??

sentences:
Can I create new UI elements and use them from Unity? I created the following class, that should be used to display numeric text in a UI canvas (score, lives, etc.):

public class NumericField: UnityEngine.UI.Text {
    [SerializeField] int value = 0;

    override protected void Start() {
        base.Start();
        text = value.ToString();
    }

    public int Get() {
        return value;
    }

    public void Set(int newValue) {
        value = newValue;
        text = value.ToString();
    }

    public void Add(int toAdd) {
        Set(value + toAdd);
    }
}

Now, I would like to add a NumericField into my Canvas, instead of adding a Text. But, when I right-click the Canvas object, I do not see my NumericField. How can I add it to the menus, so that I can add it to the canvas?

sentences:
Why is my jump arc preview inaccurate? I'm trying to draw an arc out of dots that previews a KinematicBody2D's trajectory after a jump but said preview always falls short of the body's actual jump and I cannot figure out why. Below is an example gif of what I'm talking about.

And this is the code I used in the example.
extends Node2D

var arcPoints = 40
var pointsPerSec = 12
var startYvelocity = -500
var velocity = Vector2(200, startYvelocity)
var gravity = 300

var startPosition = Vector2(96, 544)

func _draw():

    var totalY = startPosition.y
    var velY = startYvelocity
    var calcGravity = gravity/pointsPerSec

    for p in range(arcPoints):
        velY += calcGravity
        totalY += velY/pointsPerSec

        var point = Vector2(startPosition.x+(velocity.x/pointsPerSec)*(p+1), totalY)
        draw_circle(point, 2, 'fafafa')

func _ready():
    pass

func _physics_process(delta):
    velocity.y += gravity*delta
    get_child(0).move_and_slide_with_snap(velocity, Vector2(0.0, 1.0), Vector2(0.0, -1.0))

sentences:
Advantages and disadvantages of libgdx I've been an android developer for a while and am thinking about getting into gaming. While looking for a game dev framework, I thought libgdx provides very friendly documentation and functionality. So I would like to use it if there is no big obstacle.

But when I tried to see how many developers employ this library, I could find not that many. Is there anything wrong with this library? In other words, I would like to know its advantages or disadvantages from any experienced developer.

UPDATE: After reviewing its documentations and trying to build simple games with libgdx, I decided to go with it as its documentations are good enough and its community is very active. What I liked the most is that it provides a bunch of demo games that I can learn a lot from.

sentences:
Invalid GLSL on some machines I'm writing a game engine using OpenGL 4.3 using gcc 5, mainly to teach myself graphics programming.

Initial development was on my Surface Pro 3 using mingw-w64 and worked like a charm.

I've decided to move to my desktop, which is running two GTX 670s, and both Windows and Arch Linux. I've made sure that I have the latest NVIDIA drivers installed on both operating systems, but am having issues with my vertex and fragment shaders. All I know is that neither system compiles the shaders, but the OpenGL Reference Compiler simply issues a warning saying that OpenGL 4.3 might not be fully implemented. I've also tried downgrading all the way to OpenGL 4.0, but this doesn't seem to fix the issue.

Below are the shaders that I'm currently trying out. Hoping someone more experienced than I can lend a hand?

shader.vert:

#version 430

layout (location = 0) in vec3 vertex_position;
layout (location = 1) in vec2 vt;

uniform mat4 cam_view, cam_proj, sprite_matrix;

out vec2 texture_coordinates;

void main()
{
   texture_coordinates = vt;
   gl_Position = cam_proj * cam_view * sprite_matrix * vec4(vertex_position, 1.0);
}

shader.frag:

#version 430

in vec2 texture_coordinates;
layout (binding = 0) uniform sampler2D tex;

out vec4 frag_colour;

void main()
{
   vec4 texel = texture(tex, texture_coordinates);
   frag_colour = texel;
}

Thanks in advance :)

sentences:
Implementing a sine using a bezier curve I'm developing a 2D game using Cocos2d-x.
Is possible to use CCBezierTo to parameterize a sine function?

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:
Single Array Texture, multiple wrap modes I have a array texture of which I would like some of its sub-images have wrap modes of GL_REPEAT and others to be GL_CLAMP_TO_EDGE.
From my research, I haven't found a clear answer. It appears Sampler Objects may be what I'm looking for, however I'm unsure as to how to go about implementing this.
As current I have a sampler class which looks like this:
class TextureSampler {
public:
    unsigned int id;

    TextureSampler();
    TextureSampler(unsigned int wrapS, unsigned int wrapT, unsigned int filterMin, unsigned int filterMag);
    ~TextureSampler();

    void bind(unsigned int textureId);
    void unbind(unsigned int textureId);
};

As you can expect the constructor simply sets all the wrap and filter parameters.
I bind with this glBindSampler(textureId, id);. The textureId being that from glGenTextures() and the id from glGenSamplers().
Now when it comes to my implementation, I've created two samplers, one for repeating wrap mode and another for edge clamping. This is where things are a bit murky. I've got two samplers, one texture array... it doesn't seem possible to bind both samplers at the same time and yet how do I access both types in the fragment shader? Google has not been much help and I've read parts of the ARB_sampler_objects extension to see if it had useful information and it seemed to say ...

Should sampler objects be made visible to the shading language.
This is left for a future extension.

I am using GL 4.3, so this is extension is not built-in, however that quote leaves me wondering if I've approached this all wrong. What is the correct approach to this? Is this possible with a single texture array?

sentences: Collision detection: a bunch of special cases? I'm writing a simple physics engine in 2D.  My first goal is to get collision detection working.  I know that my objects will eventually be made up of primitive shapes, but I was wondering - would a collision detection library be composed of a bunch of special case functions, like "rayAndLine", "rectangleRectangle", "rectangleCircle" etc, or is there a common, underlying framework for collision detection that works regardless of which primitives are used to make the shape?

sentences:
Stored Textures in C++ Projects I have executed the following command in order to store a texture (PNG) file in a C++ header file: xxd -i Texture.png Texture.h.

How would I go about loading this texture into OpenGL?

glEnable(GL_TEXTURE_2D);
GLuint textureId;
glGenTextures(1, &textureId);
glBindTexture(GL_TEXTURE_2D, textureId);
//glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER, GL_NEAREST);
//glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, GL_LINEAR);

I realise that the function glTexImage2D should be used but am very unsure about which parameters to choose.

The specification describes the parameters as shown below.

void glTexImage2D(GLenum target, // GL_TEXTURE_2D
    GLint level, // 0
    GLint internalFormat, // GL_RGBA
    GLsizei width, // 2048
    GLsizei height, // 2048
    GLint border, // 0
    GLenum format, // What's this?
    GLenum type, // What's this?
    const GLvoid * data);

What are the format and type parameters for and what should they be set to in this case?

sentences: Can flixel or a similar engine be used with reddwarf server? I like the sgs/projectdarkstar or now known as reddwarf server for a back end game server.  However I am looking for a good front end, preferably 2D.  I was thinking of something such as flixel.  I know there is an AS3 library available for reddwarf, so I am hoping someone already has connected up flixel or a similar engine?   Or if you have a recommendation for another easy client side engine that will connect to reddwarf?

sentences:
Calculate gravity between two intersecting bodies I've been working on a 2D gravity simulator for some time and I'd like to add some surrealism to it by creating planets that can't collide with other planets (passing right through them).

The problem is, as distance between two bodies approaches zero, gravity goes to infinity - causing planets to slingshot when they're intersecting. Stopping gravity from being applied for a pair of bodies as soon as they touch looks odd as their velocity will suddenly go from accelerating to constant until they get to the other side.

Is there a function that gives me the best of both worlds or should I just leave the planets not being affected by gravity while intersecting other bodies?

sentences:
Draw mesh with multiple bones I currently have an object made up of only one mesh. And this object contains three bones. One for stretching the mesh left, one for stretching the mesh up, and a center bone, which moves the object around. This is how my model and the bones/mesh hierarchy looks like:

Now, the problem is I don't know how to draw this mesh in XNA, I mean I don't know which transform to use.

I am using this code to draw:

Matrix[] transforms = new Matrix[model.Model.Bones.Count];
model.Model.CopyAbsoluteBoneTransformsTo(transforms);

foreach (ModelMesh mesh in model.Model.Meshes)
{
    foreach (BasicEffect effect in mm.Effects)
    {
        effect.View = camera.view;
        effect.Projection = camera.projection;
        effect.World =; //I dont know which to use
        effect.EnableDefaultLighting();
    }
    mesh.Draw();
}

If I debug it, and then look at the code, it comes up with 7 bones in this order (as seen in the picture):

Obj,
CenterArmature,
Center(CenterArmatures bone),
GorArmature,
Zgoraj(GorArmatures bone),
LevoArmature,
Levo(LevoArmatures bone).

sentences:
MVC How To Handle Animations? I am working on a turn based game that utilizes the model, view, controller design pattern to separate logic from input from rendering. I am still a little new to the pattern, but from my understanding I have laid out the following MVC system.

The model(s) comprise a set of pawns with game flow and interaction logic. Pawns/models know how to interact with each other and the model world, but only when signaled to do so via function calls. (i.e. pawn.move(startLocation, endLocation) or pawn.attack(enemyPawn))

The view(s) make up everything that is viewable by the player. This includes menus, visual representations of the pawns/models, and any user interface components like cursors and buttons. The view(s) query the model for data to draw visual representations of pawns. The view(s) also can dispatch user interface events to any observers interested in these events.

The controller(s) handle all transition and input logic. When an interesting user interface or input events occur, the controller decides what the model should do and signals the model to do it. The controller also handles swapping out of views when necessary.

I know there are many ways to implement MVC and I am open to suggestions if something seems off with this design, but the real problem I am having is how to handle animations in the view. Say the user commands a pawn to move 5 spaces North and 1 space West. I want an animation to show this over several seconds. How would I handle something like that?

sentences:
C# XNA Rectangle.Contains returns false? I am creating a simple XNA game. My mainMenu class contains a list of strings for menu options wich I draw on the scren using spriteBatch.DrawString. I've set Vector2 variables to controll the position of the spritefont. Then I created 2 Rectangles (and took the values of the Vector2s) and 2 Colors that will be given a value if the mouse is/isn't currently hovering the drawn string. My mainMenu.cs class contains these variables:

Vector2 playGameButtonPos = new Vector2(303, 300);
Vector2 exitGameButtonPos = new Vector2(303, 350);
List<string> m_ButtonList = new List<string>();
Rectangle m_ButtonArea0 = new Rectangle(303, 300, 50, 30);
Rectangle m_ButtonArea1 = new Rectangle(303, 350, 50,30);
Color optionsColor0;
Color optionsColor1;

mainMenu.LoadContent(ContentManager Content):

Game1.g_MainMenuFont = Content.Load<SpriteFont>(".\\mainMenu\\mainMenuFontTex");

mainMenu.cs's constructor:

m_ButtonList.Add("Play Game");
m_ButtonList.Add("Exit Game");

mainMenu.Draw(SpriteBatch spriteBatch):

var m_MousePosition = new Point(Game1.g_MouseState.X, Game1.g_MouseState.Y);
if (m_ButtonArea0.Contains(m_MousePosition))
{
    optionsColor0 = Color.Yellow;
}
else
{
    optionsColor0 = Color.CornflowerBlue;
}
if (m_ButtonArea1.Contains(m_MousePosition))
{
    optionsColor1 = Color.Yellow;
}
else
{
    optionsColor1 = Color.Red;
}
spriteBatch.DrawString(Game1.g_MainMenuFont, m_ButtonList[0], playGameButtonPos, optionsColor0);
spriteBatch.DrawString(Game1.g_MainMenuFont, m_ButtonList[1], exitGameButtonPos, optionsColor1);

Game1:

public static MouseState g_MouseState = Mouse.GetState();
public static SpriteFont g_MainMenuFont;
mainMenu m_MainMenu;

Game1's Initialize() method:

m_MainMenu = new mainMenu();

Game1's LoadContent() and Draw() methods:

m_MainMenu.LoadContent(Content);

m_MainMenu.Draw(spriteBatch);

But when I hover with my mouse on the position where the Rectangle should be, nothing happens.

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:
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:
Keeping track of moving sprites in 2D grid I'm working on a 2D tower defence game in C++.

The game world consists of a grid of Cells, that are managed by a Map:

Essentially the map is:

[cell][cell][cell][cell][cell]
[cell][cell][cell][cell][cell]
[cell][cell][cell][cell][cell]
[cell][cell][cell][cell][cell]

And mobs are moving across the map.

Map class:

class Map{
     //...
     std::vector<std::vector<Cell>> cells;
     std::unordered_set<Cell*> cellsContainingMobs;
     void addCellContainingMob(Cell* c);
     Cell* getCellFromPos(const glm::vec2& pos);

}

Cell class:

class Cell{
     //...
     std::deque<Mob*> mobsInCell;
     void addMob(Mob* m);
     void clearMobs();
}

Mobs are a moving sprites that "walk" around the map and are managed by another class.

My goal is to at every game loop/frame, I know which cells contains mobs (Map::cellsContainingMobs), and for each of those cells, I know which mobs are in the cell (Cell::mobsInCell).

My current method for keeping track of this, is on each game loop iteration (frame) I do the following:

Clear my containers:

for (Cell* c : cellsContainingMobs){
    c->clearMobs(); //calls clear on the std::deque
 }
 cellsContainingMobs.clear();

Iterate over active mobs in the scene

Find out which cell the mob is in (this is inexpensive, as the truncated coordinates of the Mob's position is the indices of the Cell in Map::cells.
Add the Cell to the Map::cellsContainingMobs. Since this is an std::unordered_set if the same Cell is added multiple times, it will only keep one.
Add the Mob to the Cell it is currently at.

part of code:

for (Mob* m : activeMobs) {
    Cell* c = map->getCellFromPos(m->getPos());
    map->addCellContainingMobs(c);
    c->addMob(m);
}

I use std::unordered_set for Map::cellsContainingMobs to prevent keeping the same items multiple times. For Cell::mobsInCell I could probably use std::vector instead of std::deque, but I think the reason was that I don't need random access.

The reason I want to keep track of which Cells contains Mobs, and which Mobs are in which Cells, is to later make it more efficient to check for collision with Tower that shoots bullets. (I only check for collisions on the Cells that have mobs and are in the range of the tower).

My question is; should I use different type of containers for what I'm doing? Is there a completely different approach for keeping track of where my Mobs are located, that could be more efficient?

sentences:
Accurate sprite rotation with mouse movement I am using the current mouse position to aim the player sprite, but I am not getting the best results.

It will often by off by a noticeable amount, or even a complete ~180 off if I go from one side, through the player, to the other side.

boolean mouseMoved(int screenX, int screenY) {
    mouseX = screenX;mouseY = screenY;
    rot = MathUtils.radiansToDegrees * MathUtils.atan2((float)mouseY - (float)player.y, (float)mouseX - (float)player.x);
    if (rot < 0) rot += 360;
    player.setRot(rot);
}

Update 1:

When I am at 90/270 it seems to pickup the angle fine. But for 0/180, the angle is off depending on how far away my cursor is to a certain point (not the player's point).

Update 2:

Added in semi-fix, but I'm still having the same exact problem

Update 3:

I was mistaken the semi-fix wasn't actually a fix. I fixed it for real, though. The problem was that libgdx has (0,0) at the bottom left, but the InputProcessor has (0,0) at the top left. What I had to do was adjust the mouse position so that it's (0,0) was the bottom left. I did this by

mouseX = screenX;
mouseY = Game.HEIGHT - screen y;

This will give the player coordinates & mouse coordinates the same origin, and then the formula will work.

sentences:
How do I make my character change his ability's when his sprite changes I am making a platformer and am currently trying to have it so that my character will have different powers based on his emotions, and his sprite will change to match those emotions.

I have got it so that his sprite will change but I don't know how to get his powers to change as well. Note that I haven't even made his other powers yet, but even if I did I don't know how to change his ability's with his sprites as I am still very new to this whole coding thing. Can anyone please help me?

Here is my code for changing his sprites, if that would help.

using UnityEngine;
using System.Collections;

public class MoodManager : MonoBehaviour {

  public Sprite sprite1;// happy//
  public Sprite sprite2;// angry//
  public Sprite sprite3;//sad//
  public Sprite sprite4;//default//

  private SpriteRenderer spriteRenderer;

  void Start ()
  {
    spriteRenderer = GetComponent<SpriteRenderer>(); // we are accessing the SpriteRenderer that is attached to the Gameobject
    if (spriteRenderer.sprite == null) // if the sprite on spriteRenderer is null then
      spriteRenderer.sprite = sprite1; // set the sprite to sprite1
  }

  void Update ()
  {
    if (Input.GetKeyDown (KeyCode.Alpha1)) // If the space bar is pushed down
      ChangeMoodHappy (); // call method to change sprite

    if (Input.GetKeyDown (KeyCode.Alpha2)){
      ChangeMoodAngry ();

    if (Input.GetKeyDown (KeyCode.Alpha3)){
      ChangeMoodSad ();
  }

  void ChangeMoodHappy (){
    if (spriteRenderer.sprite == sprite1) // if the spriteRenderer sprite = sprite1 then change to sprite2
      spriteRenderer.sprite = sprite4;
    else
      spriteRenderer.sprite = sprite1; // otherwise change it back to sprite1
  }

  void ChangeMoodAngry (){
    if (spriteRenderer.sprite == sprite2) // if the spriteRenderer sprite = sprite1 then change to sprite2
      spriteRenderer.sprite = sprite4;
    else
      spriteRenderer.sprite = sprite2; // otherwise change it back to sprite1
  }

  void ChangeMoodSad (){
    if (spriteRenderer.sprite == sprite3) // if the spriteRenderer sprite = sprite1 then change to sprite2
      spriteRenderer.sprite = sprite4;
    else
      spriteRenderer.sprite = sprite3; // otherwise change it back to sprite1
    }
  }

}

sentences:
What's the best way to create animations when doing Android development? I'm trying to create my first Android game and I'm currently trying to figure out (with someone that will do the drawings and another programmer) what the best way to create animation is. (Animations such as a character moving, etc.)

At first, the designer said that she could draw objects/characters and animate them with flash so she didn't have to draw every single frame of an action. The other programmer and I don't know Flash too much so I suggested extracting all the images from the Flash animation and making them appear one after the other when the animation is to start.

He said that would end up taking too much resource on the CPU and I tend to agree, but I don't really see how we're supposed to make smooth animations without it being too hard on the hardware and, if possible, not have the designer draw every single frame on Adobe Illustrator.

Can an experienced Android game developper help me balance this out so we can move on to other parts of the game as I have no idea what the best way to create animations is.

sentences: How to make bird to fly using box2d I am new to Box2D, I have set gravity to 10. How to make an object fly in space even though the gravity is 10. What are the properties I need to set to make object fly? Is there any different approach?

sentences:
How to create soft gradient texture I'm currently testing out Unity 3D and one of the things I can not figure out, is how to create textures that are what I would describe as "Soft Gradient".

Here is an image of what I would describe the textures as "Soft Gradient"

If you look at the top of the hexagons (the grass). you can see that its not just one color, its a texture that is a "Soft Gradient".

Currently, this is what I have,

Does anyone have tips or can help my understand how to make my hexagon pillars look similar to the ones in the picture?

sentences:
Texture coordinates for custom geometry in SceneKit ios9 I am trying to texture the a custom plane shape I created in scenekit on iOS9. I need the texture to spread out and stretch over the entire surface. I have a vertex and fragment shader on an SCNprogram. But it seems I am doing something wrong and fiddling with this all day, I have come to the conclusion that somehow the Texture coordinates I specify are not correct.

My question is, when creating a geometry, does SceneKit create the texture coordinates automatically so when I specify CGpoint(0,0) for one corner of the texture, it automatically maps it to the bottom left corner of the geometry? Or do I have to manually specify the texture coordinates/uv for the geometry I create?

This problem is a part of a larger question posted here : https://stackoverflow.com/questions/34104369/custom-shader-scnprogram-ios-9-scenekit/34105050#34105050

Please help, I have spent all day tinkering but no success :(

sentences:
TileMap chunk generation I have a class TileChunk which at it's most basic contains a rectangle that surrounds the chunk,  and four bools isLeftLoaded, isTopLoaded,  etc. Using the rectangle I can determine which chunk the player is in.

What I want to do is create some kind of method which checks the current chunk the player is in, and if nothing is loaded then create new chunks that surround the sides that haven't been loaded.  The problem I'm coming across is that using the four bool variables doesn't seem to work correctly. At initialization, I create 9 chunks to make a 3x3 starting area but some of the bool variables aren't being set correctly.

My question is how should I write a method which determines what chunks have loaded chunks adjacent to them? Every chunk is stored in a List, but other than using the bool variables I'm not sure what is the best way to do this.

sentences:
What is the best method to use to write and handle multiple levels? I have a level class that does all of the updating and drawing and everything pertaining to the level.  My question is, what would be the best approach to creating different levels?  Should I just write them all in this single class which just chooses what to load and do depending on the level, or should I write each level in its own class that inherits from a base level class?

My code handles switching levels through the game's state manager...

void Game::change(GAMESTATE changeTo) {
  state = changeTo;
  load(state);
}

void Game::load(GAMESTATE loadState) {
  while(!currentState.empty()) {
    delete currentState.back();
    currentState.pop_back();
  }
  if(state == TITLE) {
    currentState.push_back(new Title());
  }
  else if(state == LEVEL) {
    currentState.push_back(new Level(&levelNumber));
  }
  else if(state == CUTSCENE) {
    currentState.push_back(new Cutscene());
  }
  else if(state == GAMEOVER) {
    currentState.push_back(new GameOver());
  }
}

[edit] For this question, let's assume I want to hard code the levels and don't want to use external files.

sentences:
Relative Transformations for Bones I'm using Blender to export my armatures in relative coordinates, and I'm trying to get to absolute coordinates in my engine. For the above example, the childBone's tip is an offset of [-1,0,0], which is relative to the forward direction of the rootBone, not the global X axis. I understand how matrix multiplication works, but I can't quite seem to get there. Could someone break down the exact steps needed to calculate the absolute coordinates? Here's my attempt:

Vector3f rootRoot = new Vector3f(1,1,0);
Vector3f rootTip = new Vector3f(2,1,0);
Vector3f rootTipOffset = Vector3f.sub(rootTip, rootRoot);
float rootLength = rootTipOffset.length();
Quaternion rootRotation = new Quaternion(new Matrix4f().initRotation(rootTipOffset, Vector3f.Y_AXIS));
Matrix4f rootBindPose = new Matrix4f().initTranslation(rootRoot).mult(rootRotation.toRotationMatrix());
//Matrix for the root of the root bone

Matrix4f childOffset = new Matrix4f().initTranslation(rootTipOffset).mult(rootBindPose);

Vector3f childRoot = new Vector3f(0,0,0); //2,1,0
Vector3f childTip = new Vector3f(-1,0,0); //2,2,0
Vector3f childTipOffset = Vector3f.sub(childTip, childRoot);
float childLength = childTipOffset.length();
Quaternion childRotation = new Quaternion(new Matrix4f().initRotation(childTipOffset, childOffset.getRotation().getUp()));
Matrix4f childBindPose = childOffset.mult(new Matrix4f().initTranslation(childRoot).mult(childRotation.toRotationMatrix()));
Matrix4f testMatrix = new Matrix4f().initTranslation(new Vector3f(0,0,childLength)).mult(childOffset);
System.out.println(testMatrix.getTranslation()); //Prints [2, 1, 1]

sentences: How to get a Vector2 location of an object? (Unity2D javascript) I need to make an "AI" that makes a ball try to touch the player. But Vector2.MoveTowards()needs a Vector2 variable but how do i get the location of an object?

sentences:
Why my code changes don't take effect in editor UE4? I have a plugin in my project to move around stuff with gizmos(much recommended tool, by the way).
It has quite a few blueprint functions that I use.
I would like to add some functionality to it, though.
So I opened up the related cpp files, namely TransformerPawn.cpp and had a look around, and found a few starting points where I can add GEngine debug messages, to see what is going on...
I chosen a few blueprintcallable functions and went ahead by:

added those debug messages, but they do not take effect at all...
added some other code(move the actor 1000000 units away in tick), but still nothing...
commented out code, but blueprints kept working...

I added the Engine.h header in my cpp. I also tried rebuilding the solution...
And yes I hit compile every time... :D
To test things out I added an empty C++ actor, and added a blueprintcallable function to it to print out debugmessages(GEngine), and it worked as it should be... I can see the debug messages...
EDIT: I use Rama's Victory plugin a lot. I added a custom BP node there, recompiled it, and it didn't work...
But the new plugins available message popped up in the bottom right corner!
So I disabled, and enabled it and it did work. I could see my new BP node. :)
Later on I test it with the above asset and update the post.

sentences:
Strategic AI in turnbased games? I'm interested in how strategic AI engines work, e.g. how to evaluate where to place troops in a turnbased strategy game etc.

I do get how goal based AI works, and I guess that is a good approach to decide what to build or research in a game like Civilization.

But tactical/strategical positioning of troops/units.
What algorithms/strategies are used to evaluate those things? any reference papers/articles?

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 do I detect a line collison in LIBGDX? I am drawing a continuous line using Pixmap. I want to check for a collision / intersection of my line with the already drawn line.

sentences:
2d Tiled Map with images in Javascript I'm trying to create a tile map with simple 2d images (30x30). I restarted the project from my previous post, and instead of using someone else's code, i though I would learn more to start from scratch. It was going well, but I ran into a bump when attempting to use images for tiles. My previous project used to following to create simple cubes. Now I'm trying to use images, and was wondering if there is a way to make the images wihtout having to follow the exact same steps as below:

function renderLevel(){
// clear the canvas
context.clearRect(0, 0, canvas.width, canvas.height);
// walls = red boxes
context.fillStyle = "#ff0000";
for(i=0;i<levelRows;i++){
    for(j=0;j<levelCols;j++){
        if(level[i][j]==1){
            blockrow.push(i);
            blockcol.push(j);
            context.fillRect(j*tileSize,i*tileSize,tileSize,tileSize);
            console.log("add");
            //collision[i] = new Array ([i],[j]);
        }
    }
}
// player = green box
context.fillStyle = "#00ff00";
context.fillRect(playerXPos,playerYPos,tileSize,tileSize);

}

Currently, I'm trying to simply drop the images, and manually declare the sizes when calling them.

    function setmapimages(){
    for (i=0;i<mapArray.length; i++){
        for (k=0; k<mapArray[i].length; k++){
            //image for player
            if (k==positionX && i==positionY){
                ctx.drawImage(img, 30, 30);
            }
            //image for road
            if (mapArray[i][k] == 0){
                ctx.drawImage(img2, 30, 30);
            }
            //image for collision
            if (mapArray[i][k] == 1){
                ctx.drawImage(img3, 30, 30);
            }
            //image for Store
            if (mapArray[i][k] == 2){
                ctx.drawImage(img4, 30, 30);
            }
        }
    }
};

I set the canvas size similarly to the previous project:

var canvas = document.getElementById('canvas');
var ctx = canvas.getContext("2d");
canvas.width =img.width*11;
canvas.height =img.height*9;

Although I set the variables a bit different. Since I'm using images now.

var img = new Image();
img.src= "image.png";
var img2 = new Image();
img.src= "image2.png";
var img3 = new Image();
img.src= "image3.png";
var img4 = new Image();
img.src= "image3.png";

Am I calling the images correctly? I looked up "drawimage" and think I went the wrong way with this, but I'm unsure what could call the images correctly.

sentences:
Drawing particles as a smooth blob I'm new to game/graphics development and I'm playing around with particles (in 2D). I want to draw particles close to each other as a blob, just as liquid/water. I do not want to draw big circles overlapping as the blob won't be smooth (and too big). I don't really know physics but I assume what I want is something looking similar to surface tension.

I haven't been able to find anything on stackexchange or on Google (maybe I do not know the correct keywords?). So far I have found two possible solutions, but I am unable to find any concrete information about algorithms.

One of them is to calculate the concave hull of particles I consider being a blob. I can calculate the blob by creating an equivalence class (on the relation "close to each other"). Strangely enough I haven't been able to find any algorithm explaining how to calculate the concave hull. Many posts (and among stackexchange) links to libraries or commercial products that do this (I need libraries to work in C#), but never any algorithm. Also this solution might have a problem with a circle of particles, which would not detect the empty space in the middle.

While researching concave hull I stumbled upon something called alpha shapes. Which seems to be exactly what I want to do, however just as with concave hull I haven't found any source explaining how they actually work. I have found some presentation materials but not enough to go on. It's like a big secret everyone knows except me :-/

After calculating the concave hull or alpha shape I want to make it a Bézier curve to make it smooth and nice.

Although I do find my approach a bit too complex, maybe I am trying to solve this the wrong way? If you can either suggest any other solution to my problem, or explain the pieces I am missing I would be very happy and grateful :-)

Thanks.

sentences:
Elegant way to simulate large amounts of entities within a game world Assume you have a game in which there are many (many many) entities serving some functions, not all of which are constantly needed or need to be considered in every frame. The concrete problem I am working on in which this issue is present is a detailed simulation of a body including its organs.

In the game each creature has its own body which is separated into smaller parts (torso, legs etc.) and sometimes these parts contain organs, which serve a specific function within the body. Whether or not an organ currently serves a purpose or is active is never actually clear. After all, an animal might have an empty stomach which therefore does not need to digest anything. It would be quite ridiculous to check or simulate every object in each frame and very costly as soon as you have many creatures in the world. So I was thinking about a way to smartly differentiate between objects that need to be updated and those that don't.

What I came up with seems like an at least ok solution. It creates a simple queue/stack (essential is that each element gets removed as soon as it's read; the order is irrelevant) called the "attention stack" where objects that need to be simulated reside. Objects that need attention would simply put themselves onto the stack or are put there by other objects. These objects would probably implement a simple interface with a simulate()-function.

Applied to my previous digestion example this would mean:

The player chooses something to eat (assume it's bread) from the inventory and puts it into the mouth of his character and the mouth is put onto the attention stack. In the next frame the the mouth is taken from the stack and its simulate()-function is called. Since it's a mouth it would be reasonable to simulate chewing here. This could go on for a few frames in which the mouth keeps putting itself onto the stack until it decides the food is ready to be swallowed. In this case the mouth puts the chewed bread into the stomach (I know it doesn't go there directly, but the esophagus is left out for simplification), which is then also put onto the attention-stack. In the next frame the simulation of the digestion-process is started. And so on for the rest of the necessary organs.

A foreseeable problem with this are idling objects. A sleeping animal is a good example of this. It could be done as previously described by keeping the sleeping animal on the stack and checking each time if it needs to wake up, but that seems wasteful since that's the only thing being done. To make idling objects more efficient I was planning to add a sort of schedule which stores jobs to be performed at a specific time. If an animal goes to sleep it would put a job on that schedule which would be scheduled for a certain amount of time after the animal went to sleep. This job would then take care of putting the sleeping animal onto the attention stack again. Now, you could say that a sleeping animal that isn't on the attention stack could miss being attacked by something because its A.I. is not simulated, but this is prevented if the attacking object takes care of putting that animal onto the stack again.

Now, I honestly don't know if this is even close to an elegant solution to this problem due to a lack of experience. Am I close to something usable? How is this usually done or does anybody have any suggestions or better solutions?

sentences:
OpenGL poor performace with instanced drawing I'm just started learning OpenGL and this is my first project besides tutorials. I'm trying to load a huge enginering model:

The data is structured in a way that I thought I could use instancing for very good performance, because many items are simple primitives (cylinder, torus, cones, etc) with different transformation matrices. So I structured my data this way:

Primitive 1
  VAO
    VBO -> vertices
    VBO -> indices

    Instance 1.1
      VBO -> object color
      VBO -> transformation matrix

    Instance 1.2
      VBO -> object color
      VBO -> transformation matrix

    Instance 1.n
      VBO -> object color
      VBO -> transformation matrix

Primitive n
  VAO
    VBO -> vertices
    VBO -> indices

    Instance n.1
      VBO -> object color
      VBO -> transformation matrix

    Instance n.n
      VBO -> object color
      VBO -> transformation matrix

The model has ~50k unique primitives and ~120k instances, so in general each primitive has 2 instances. But in practice, some have 10 and some have only 1. I end up with 50k VAOs and then call dlDrawElementsInstanced for each VAO.

The model is being draw at only 3 fps. I gues it's because of the number of glDraw calls (50k for the triangles and 50k for the outlines). The shaders are very simple, not even lightning is being applied.

To be sure of that I changed the way I organize the buffers: I put everything in a single buffer, but to do that I had to pass the color and transformations matrices as vertex attributes to each vertex. I know this isn't right but I had to test if the problem was the number of glDraw calls. I couldn't even load the model this way because the buffers get way to big and I get out of memory. So I tested this theory on a smaller model that was taking 50ms to render in the instanced way. With a single VAO for everything and only a single glDrawElements call the model is taking less than 1ms to render.

I know that putting everything in a single VAO and passing the trasnformations for every vertex is not the correct way of doing this. Now I also know that instancing isn't the tool for this due the very few intances for each mesh. So the question is, what would be the correct way to setup the buffers to minimize the number of glDraw calls?

I think that it would be perfect to store all in a single VAO (so I could call glDrawElements a single time) but use something like the glVertexAttribDivisor used in instancing to inform the shaders when to use the next shaders. But not exactly because I had to manually inform when to use the next matrix, in way like glPrimitiveRestartIndex works.

I'm using OpenGL 3.3

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:
How do I refer to the object that called a function? I have a large number of buttons instantiated from a prefab using a loop, as follows:

public void LayoutButtons() {

        GameObject newCanvas = Instantiate (canvas) as GameObject;

        for (int i = 0; i < 10; i++) {
            GameObject newButton = Instantiate(button, new Vector2((i * 100.0F)-500, -100), Quaternion.identity) as GameObject;
            newButton.transform.SetParent (newCanvas.transform, false);
        }

    }

I would like the OnClick function to output the clicked button's text. However, I don't know how to reference the clicked button. I tried doing Debug.Log(this.GetComponent<Text>().text) but I get a NullReferenceException: Object reference not set to an instance of an object.

I'm not positive I'm using this correctly but I have limited connectivity at the moment and can't think of what else I'm doing wrong.

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:
Non-existent instance in Game Maker I'm currently trying to make the fire object (created by the fireball) stick to the enemy, by specifying the enemy type and its id. I'm getting the following error:

"Unable to find any instance for object index '-4' name undefined".
Here's my fireball [collision with enemy] code:

var sp=other.speed
var dir=other.direction
var oi=other.id
var on=object_get_name(other)
with (instance_create(other.x-lengthdir_x(new_push_amount, pd),other.y-lengthdir_y(new_push_amount, pd),fire))
{
speed = sp
direction = dir
enemyid = oi
enemyname=on
}

And here is the Create,

enemyname = ""
enemyid = 0

and the Step events of fireball:

speed = instance_find(enemyname,enemyid).speed
direction = instance_find(enemyname,enemyid).direction

Maybe I'm using the wrong functional to get the instance... In any case, help would be really appreciated!

sentences:
Bad performance using VBO with OpenGL ES in Android I'm making an Android app and I need to draw some polygons using OpenGL ES. I'm able to render them but I'm disappointed with performance. I updated the code to use VBO but I didn't notice any improvement. I want to render at 60 frames per second (16 ms per frame).

I have a test project where I render several triangles on the screen. When I render 1000 triangles it takes about 20 ms per frame (depending on the device).

I want to keep the rendering under 10 ms because I need the rest (6 ms) to perform other calculations (e.g. update positions, detect collisions, etc.).

Here is the code where I render a triangle:

public void render(int positionLocation, int colorLocation)
{
    GLES20.glBindBuffer(GLES20.GL_ARRAY_BUFFER, this.bufferIndex);
    GLES20.glVertexAttribPointer(positionLocation, Polygon.POSITION_COMPONENT_COUNT, GLES20.GL_FLOAT, false, Polygon.STRIDE, 0);
    GLES20.glBindBuffer(GLES20.GL_ARRAY_BUFFER, 0);

    GLES20.glUniform4f(colorLocation, this.red, this.green, this.blue, this.alpha);
    GLES20.glDrawArrays(this.mode, 0, this.length);
}

https://github.com/mauriciotogneri/test/blob/master/src/com/testopengl/Polygon.java#L51-66

Here is the code where iterate over the triangles:

private void renderTriangles()
{
    long start = System.nanoTime();

    for (int i = 0; i < COLUMNS; i++)
    {
        for (int j = 0; j < ROWS; j++)
        {
            float x = (i * TRIANGLE_SIZE) + (TRIANGLE_SIZE / 2);
            float y = (j * TRIANGLE_SIZE) + (TRIANGLE_SIZE / 2);

            moveTo(x, y);

            this.triangles[i][j].render(this.positionLocation, this.colorLocation);
        }
    }

    long stop = System.nanoTime();

    this.totalTime += stop - start;
    this.totalFrames++;

    Log.d("TEST", (this.totalTime / this.totalFrames) / 1000000 + " ms");
}

https://github.com/mauriciotogneri/test/blob/master/src/com/testopengl/MapRenderer.java#L117-139

(Change the value of NUMBER_OF_TRIANGLES to display more triangles)

For what I understand, the method GLES20.glDrawArrays(...) takes too much time if I need to call it 1000 times per frame (one per triangle).

Is there another way to render several polygons that doesn't take too much time?

Notes:

In the example all the triangles have a fixed position on the screen but in the real scenario they will move around
In the example I assign a random color to each triangle but in the real scenario each of them will have a fixed color

sentences:
Find Initial Velocity for Parabolic Arc with Fixed Angle that Crosses Target Position In my game I want skeletons to occasionally lob bones at the player. The player can be anywhere in relation to the skeleton (above or below, to the left or right), and I want the skeletons to throw a bone such that it lands on the player (or its parabolic arc intercepts them while rising, if the player is above the skeleton).

Given an arbitrary starting position, an arbitrary target point, and an arbitrary launch angle, how can I calculate the initial velocity of a ballistic projectile (assuming no air resistance) such that its parabolic trajectory intercepts the target point?

I know there are a number of similar questions on this site, but none of them appear to have this particular set of requirements:

Calculating initial velocities given trajectory parabola requires a known/fixed apex height.

Calculating velocity needed to hit target in parabolic arc and Throw object towards predefined place? assume a known/fixed travel time.

I want to have a fixed launch angle, initial position, and final position, and from those determine the initial velocity.

The Wikipedia article Trajectory of a projectile comes close, but I have no idea how to solve that for velocity.

Reference

In computer coordinates, the Y axis is inverted from Cartesian coordinates. The accepted formula operates independently of this, but it's unintuitive to deal with. This means that gravity will be a positive number, while being above the projectile will result in a negative displacement.

This also means that the fixed angle you choose will be the negative of what the habitual version would suggest.

As a final note, I adjusted for the absolute value of Vx by performing this manipulation before calculating Vy:

if sign(x_velocity) != sign(delta_vector.x):
    x_velocity = -1 * x_velocity
var y_velocity = x_velocity * tan(angle)

Full pseudocode reference:

static func get_velocity_of_arc_intercept(initial_position, target_position, angle):
    var delta_vector = target_position - initial_position
    var x_velocity = sqrt((gravity * delta_vector.x * delta_vector.x) / (2 * (delta_vector.y - (tan(angle) * delta_vector.x))))
    # Adjust for lost sign.
    if sign(x_velocity) != sign(delta_vector.x):
        x_velocity = -1 * x_velocity
    var y_velocity = x_velocity * tan(angle)
    return Vector2(x_velocity, y_velocity)

sentences:
Clamping always returns 0 I have a class with three fields:

StartingAngleOnRotationPlane is 180
MinimumRotatedAngleX is 0
MaximumRotatedAngleX is 140

Here is the offending code:

public virtual float ClampRotatedDegreesWithinAllowedRange()
{
    float rotatedAngle = this.transform.GetRotatedAngleOnXPlane();
    Debug.Log("Rotated " + rotatedAngle);

    float clampedRotatedAngle =
        Mathf.Clamp(
            AngleNormaliser.BetweenNegativeAndPositive180(this.StartingAngleOnRotationPlane + rotatedAngle),
            this.MinimumRotatedAngleX,
            this.MaximumRotatedAngleX);

    return clampedRotatedAngle;
}

Here is the debug window:

As you can see, when the breakpoint was hit, rotatedAngle was -178.9446.

To calculate clampedRotatedAngle, rotatedAngle is added to StartingAngleOnRotationPlane, supplied to a method called AngleNormaliser.BetweenNegativeAndPositive180(float input), and then clamped between MinimumRotatedAngleX (0) and MaximumRotatedAngleX (140).

Here is the code for AngleNormaliser.BetweenNegativeAndPositive180(float input):

public static float BetweenNegativeAndPositive180(float angleBetween0And360)
{
    while (angleBetween0And360 > 180)
    {
        angleBetween0And360 -= 360;
    }

    while (angleBetween0And360 < -180)
    {
        angleBetween0And360 += 360;
    }

    return angleBetween0And360;
}

Here is the debug window when AngleNormaliser.BetweenNegativeAndPositive180(float input) was invoked:

By the time the return statement was hit, the result 1.055389 should be returned and assigned to the variable clampedRotatedAngle, since 1.055389 is within the clamping range (0 - 140).

However, that was not the case:

As you can see, clampedRotatedAngle was still zero.

In fact, clampedRotatedAngle is always zero, regardless of what I feed into the Mathf.Clamp function:

How can I fix this?

sentences:
Ray Tracing concers: Efficient Data Structure and Photon Mapping I'm trying to build a simple ray tracer for specific target scenes. An example of such scene can be seen below.

I'm concerned as to what accelerating data structure would be most efficient in this case since all objects are touching but on the other hand, the scene is uniform.

The objects in my ray tracer are stored as a collection of triangles, thus I also have access to individual triangles.

Also, when trying to find the bounding box of the scene, how should infinite planes be handled? Should one instead use the viewing frustum to calculate the bounding box?

A few other questions I have are about photon mapping. I've read the original paper by Jensen and many more material. In the compact data structure for the photon they introduce, they store photon power as 4 chars, which from my understanding is 3 chars for color and 1 for flux. But I don't understand how 1 char is enough to store a flux of the order of 1/n, where n is the number of photons (I'm also a bit confused about flux vs power).

The other question about photon mapping is, if it would be more efficient in my case to store photons per object (or even per Object's triangle) instead of using a balanced kd-tree.

Also, same question about bounding box of the scene but for photon mapping. How should one find a bounding box from the pov of the light when infinite planes are involved?

EDIT: I would like to add one more question. I've seen in some source codes, that are using russian roulette, scaling the photon's power by the material's diffusivity and dividing by the average color. Is this correct? I thought that the point of the russian roulette was to not have to do this and end up with photons with varying and small powers.

sentences:
HTML5 Canvas - Drawing with Floats I'm trying to implement a game where you have car moving along a line in HTML5 Canvas. Using a little bit of trigonometrie I managed to get the right x and y coordinates to add to the coordinates of my image each frame to get to the end of the "line".
Now the problem is, the image I use for the car starts to stutter in the process of rendering. The problem has to be the values I'm adding. (first I thought the problem would be the render loop but when using the render loop from paul irish the same problem occurs)
My question is, how can I use floats in context.drawImage(img,...) smoothly?

What I tried was rounding the values where the image should move to (e.g. context.drawImage(img, Math.round(car.x), Math.round(car.y))) but this doesn't work also.

simple code example to demonstrate the issue: (using a simpler loop, but like I said, the problem isn't the loop)

How it looks:

Here is the whole thing:

var canvas = document.getElementById("canvasID");
var context = canvas.getContext("2d");

var car = new Car(20,10);
var carImg = new Image();

carImg.src = "https://i.stack.imgur.com/L2XQW.png";
function Car(x,y)
{
  this.x = x;
  this.y = y;
}
Car.prototype.advancePosition = function(x,y)
{
   this.x = lerp(car.x, car.x + x, 1);
   this.y = lerp(car.y, car.y + y, 1);
}
 function update()
 {
   car.advancePosition(0.91,0.4);
 }
function lerp (start, end, amt){
  return (1-amt)*start+amt*end
}
function render()
{
  context.beginPath();
  context.clearRect(0,0, canvas.width, canvas.height);
  context.drawImage(carImg, car.x, car.y);
  context.closePath();
}

window.requestAnimFrame = (function(callback) {
        return window.requestAnimationFrame || window.webkitRequestAnimationFrame ||                    window.mozRequestAnimationFrame|| window.oRequestAnimationFrame || window.msRequestAnimationFrame ||
        function(callback) {
          window.setTimeout(callback, 1000 / 100);
        };
      })();

(function mainLoop(){
  requestAnimFrame(mainLoop);
  render();
  update();
})();
#canvasID
{
    z-index: 1;
    background: #eee;
    display: block;
    vertical-align: middle;
    margin: 0 auto;
    z-index: 1;
    -webkit-box-sizing: border-box;
    -moz-box-sizing: border-box;
    box-sizing: border-box;
    position: absolute;
    -webkit-transform:translateZ(1);
}
<html>
  <head>
    <meta charset = "utf-8"/>
    <meta name="viewport" content="width=device-width, initial-scale=1.0, user-scalable=no" />
    <link rel="stylesheet" type="text/css" href="style.css">
    <title>test</title>
  </head>
  <body>
    <div class = "canvas_wrapper">
      <canvas id="canvasID" width="500" height="450">Canvas not supported, please update your browser</canvas>
   </div>
    <script src="main.js"></script>
  </body>

</html>

I would be happy if someone could help me out

Thanks

edit: Tried the suggestions from the comments but nothing worked.

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:
How can I integrate IK into a hierarchical editing environment? I have a situation where I'm trying to push the output of an IK solver back into a user editable joint hierarchy (which stores components as it's primary source), and I'm not sure how to go about it.

My IK solver returns three world space transforms representing the position and orientation of a chain of joints (0,1,2).

A:
I need to turn this into a hierarchy so that transform 2 is local to transform 1, and transform 1 is local to transform 0. Now I have local transforms for each joint.

B:
Further: I need to decompose each joint's new local matrix into source Translation, Rotation and Scale.

Can anyone give me some tips for each step? I have some ideas, but I'm worried that to do B I need to particularly careful with A.

Edit:

For example if I get my world matrices like this:

M4 world_mats[3] = IK_solve( ikparams );

And then convert them to local like this:

M4 local_mats[3] = GenerateLocalChain( world_mats );

And then extract components:

Scale     s[];
Rotation  r[];
Translate t[];

foreach ( matrix in local_mats )
    Decompose( matrix, s, r, t );

How can I implement the Decompose() function to match matrices created inGenerateLocalChain()?

sentences:
LibGDX viewport touch coordinates transformation I've been trying to get LibGDX's viewport and camera unproject() to work and so far none of the tutorials/answers I've found have worked for me.
I have a game window of 840x480 units with FitViewport. If the screen resolution matches the aspect ratio of the viewport, the coordinates are unprojected correctly. If it doesn't and the viewport inserts black bars, the transformation is incorrect (see below):

I'd like for the shape to be drawn where the cursor is, since the current behavior makes touch input on Android absolutely useless...

Furthermore, on Android the viewport doesn't fill the entire screen and just produces a rectangle on the bottom left quarter of my 1920x1080 px display.

Here's the code that produces this:

public class MainScreen extends ApplicationAdapter implements InputProcessor {
OrthographicCamera camera;
Viewport viewport;
Vector3 worldCoordinates = new Vector3();
Shape shape, background;
public ShapeRenderer sr;

@Override
public void create() {
    worldCoordinates = new Vector3();
    camera = new OrthographicCamera(800,480);
    camera.position.set(camera.viewportWidth / 2, camera.viewportHeight / 2, 0);
    viewport = new FitViewport(800, 480, camera);
    viewport.apply();
    sr = new ShapeRenderer();
    shape = new Shape(this, 20, 20, 0, 0);
    background = new Shape(this, 800, 480, 0, 0, Color.WHITE);
    Gdx.input.setInputProcessor(this);
}

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

@Override
public void dispose() {

}

@Override
public void pause() {

}

@Override
public void resume() {

}

@Override
public void render() {
    camera.update();

    Gdx.gl.glClearColor(0, 0.1f, 0.1f, 1);
    Gdx.gl.glClear(GL20.GL_COLOR_BUFFER_BIT);
    background.render();
    sr.setProjectionMatrix(camera.combined);

    shape.posX[0] = (int) worldCoordinates.x - shape.sizeX[0] / 2;
    shape.posY[0] = (int) worldCoordinates.y - shape.sizeY[0] / 2;

    shape.render();
}

@Override
public boolean mouseMoved(int screenX, int screenY) {
    worldCoordinates = camera.unproject(new Vector3(screenX, screenY, 0));
    return true;
}

@Override
public boolean keyDown(int keycode) {
    throw new UnsupportedOperationException("Not supported yet.");
}

@Override
public boolean keyUp(int keycode) {
    throw new UnsupportedOperationException("Not supported yet.");
}

@Override
public boolean keyTyped(char character) {
    throw new UnsupportedOperationException("Not supported yet.");
}

@Override
public boolean touchDown(int screenX, int screenY, int pointer, int button) {
    return true;
}

@Override
public boolean touchUp(int screenX, int screenY, int pointer, int button) {
    return true;
}

@Override
public boolean touchDragged(int screenX, int screenY, int pointer) {
    return false;
}

@Override
public boolean scrolled(int amount) {
    throw new UnsupportedOperationException("Not supported yet.");
}
}

And the Shape class:

public class Shape extends Element {
public Color background;
ShapeRenderer sr;
public Shape( MainScreen ms, int sizeX, int sizeY, int posX, int posY){
    super(sizeX, sizeY, posX, posY);
    sr=ms.sr;
    sr.setAutoShapeType(true);
    background = new Color();
    background.set(1, 0.533f, 0, 1);
}
public Shape(MainScreen ms, int sizeX, int sizeY, int posX, int posY, Color background){
    super(sizeX, sizeY, posX, posY);
    sr=ms.sr;
    sr.setAutoShapeType(true);
    this.background = background;
}

@Override
public void render(){
    sr.begin(ShapeRenderer.ShapeType.Filled);
    sr.setColor(background);
    sr.rect(posX[0],posY[0],sizeX[0],sizeY[0]);
    sr.end();
}
}

I have tried literally every option I could find without any result. Thank you for any help.

sentences:
When and how often does Epic charge me royalties on my game? I want to know about that 5% royalties that Epic charges for the Unreal Engine if I sell games above $3000.

What about if my game just made $300? Do I still need to pay 5% royalties to them? And how many times should I pay? For example, I made a game that was sold for above $3000 so I paid 5% royalties but do I still need to pay it again for the same game?

sentences:
Render 3d object to 2d surface (embedded system) i am working on an embedded system of a sort, and in some free time i would like to test its drawing capabilities.

System in question is ARM Cortex M3 microcontroller attached to EasyMX Stellaris board. And i have a small 320x240 TFT screen :)

Now, i have some free time each day and i want to create rotating cube.
Micro C PRO for ARM doesnt have 3d drawing capabilities, which means it must be done in software.

From the book Introduction to 3D Game Programming with DirectX 10 i know matrix algebra for transformations but that is cool when you have DirectX to set camera right.

I gues i could make 2d object to rotate, but how would i go with 3d one?

Any ideas and examples are welcome. Although i would prefer advices. I'd like to understand this.

sentences:
JBox2D simple example for Android? I'm starting to develop an Android game. I've already installed jBox2D but I can't find complete code to develop a simple application from scratch using this framework.
Thanks in advance!

sentences:
How to measure the refresh rate of a display in OpenGL ES? I am working on OpenGL ES application which is rendering 60 frames per second which is equal to my Monitor refresh rate.

My problem is: if I make Swapinterval 0, I am getting a FPS value above 200. I am able to reduce it to 60, but I have taken this value statically (from the command line, or hard coded).

How to calculate the refresh rate of the monitor programmatically so that I can control FPS?

sentences:
How add a sprite to canvas using JavaScript? I'm very new to sprites and I'm trying to figure out how to use them. I want to use a simple solution. Something like this:

var c = document.getElementById ('canvas)
var ctx = c.getContext ('2d');
    ctx.upload('image/testImage');

I'm very sorry if the solution is an obvious one, I'm not very good at JS. I am using pure JavaScript, I don't really like using engines.

sentences:
LWJGL 3 - problem with flickering when rendering terrain with colors For while now I m trying to built a terrain generator for my game engine and again I'm stuck with problem.

I'm trying to generate a terrain using colors, so no textures. In short my problem is flickering. Hope this pictures will describe better my problem.

The way I'm generating this is using shared vertices. If I'm generating 2*2 terraing, I'm actually only creating 9 points.
Something like this.

For color , I made that every second point will get slightly darker green.

When I add height generation, there is no flickering.

EDIT:
It probably got something to do with using shared points. I now tried using all unique points for each square and no flickering.

EDIT:
I found was the cause. I was generating indices wrong way.

    public void generateSharedIndices(int rowVertices,int columnVertices){
    for(int row = 0; row < rowVertices - 1 ; ++row){
        for(int column = 0; column < columnVertices -1 ; ++column){
            int leftDownPoint = ((row * columnVertices) + column);
            int rightDownPoint = leftDownPoint + 1;
            int rightUpPoint = rightDownPoint + columnVertices;
            int leftUpPoint = rightUpPoint - 1;

            addNewValueToCurrentPointer(leftDownPoint);
            addNewValueToCurrentPointer(rightDownPoint);
            addNewValueToCurrentPointer(rightUpPoint);
            addNewValueToCurrentPointer(rightUpPoint);
            addNewValueToCurrentPointer(leftUpPoint);
            addNewValueToCurrentPointer(leftDownPoint);
        }
    }
}

In the end indices should look like this
( 0  1  5  5  4  0  )
( 1  2  6  6  5  1  )
( 2  3  7  7  6  2  )
( 4  5  9  9  8  4  )
but I made mistake and it was generating them wrong.

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:
Difference in glDrawArrays and glDrawElements While refreshing my mind on OpenGL ES, I came across glDrawArrays and glDrawElements.

I understand how they are used and sort of understand why they are different.

What I do not seem to understand is that, I fail to see how glDrawElements can save draw calls (saving draw calls is a description that is mentioned by most of the books I have read, hence my mentioning of it here).

Imagine a simple scenario in which I tried to draw a square using 2 triangles.

I would need to have a set of 6 vertices using glDrawArrays while using glDrawElements, I would need only 4 in addition to an index array that has 6 elements.

Given the above, here is what I do not understand:

how could glDrawElements save draw calls, if it still needs to use the index array (6 indices, in case of a square) to index into my vertex array that had 4 elements (6 times)? Other words, does it mean glDrawElements would still need to have a total of 6 draw calls just like glDrawArrays?
how would using glDrawElements save space, if one would still need to have 2 arrays, namely, one for the vertices and one for the indices?
In the case of drawing a square from 2 triangles, for simplicity, how many draw calls does glDrawElements (4 items in vertex array and 6 items in index array) and glDrawArrays (6 items only in vertex array) need, individually?

Thanks.

sentences:
Projectile Rotation During Flight (Tank Game) I have a tank firing projectiles into the air.

I want the projectiles to be rotated relative to their position along their flight path.

See the diagram I drew in the image below.

At any given point I know the x and y of the projectile, z represents initial velocity, theta is also known.

sentences: Add Objects in LWJGL without using glTranslationf function It is possible to add an object in LWJGL without using translation function (glTranslatef) ? and if it is possible does this improve somehow performance ?

sentences:
Center a 3D model to cursor's position I am having a hard time understanding how to go about this. I have a 2D game with some 3D models in it. I want to move a 3D model to where the mouse cursor is currently at in every frame (In other words, center a 3D model in a specific Point(x,y)).

This is my drawing code to position the model in the center of the screen:

Matrix[] transforms = new Matrix[Model.Bones.Count];
Model.CopyAbsoluteBoneTransformsTo(transforms);
ModelMesh mesh = Model.Meshes[0];
BasicEffect effect = (BasicEffect)mesh.Effects[0];
Vector3 modelPosition = new Vector3(0, 0, 0);

effect.View = Matrix.CreateLookAt(cameraPosition, Vector3.Zero, Vector3.Up);
effect.Projection = Matrix.CreatePerspectiveFieldOfView(MathHelper.ToRadians(45.0f),
    aspectRatio, 1.0f, 10000.0f);
effect.EnableDefaultLighting();
effect.World = transforms[mesh.ParentBone.Index] *
    Matrix.CreateTranslation(modelPosition);

    mesh.Draw();

I suppose I would need a formula to convert the (camera position,model position, aspect ratio, field of view) into pixels ? Does anyone know how it works ?

sentences: Maya LT extrude tool won't work properly, is it buggy? First several hours with Maya LT and already stuck and frustrated. Trying to extrude faces (let's say future legs) but the position of faces from which I am extruding won't stay on its place, it changes and the extrusion happens from a new place, even from there I try to adjust this position, but the edge loop around the selected faces won't move, I try to delete that edge loop, it won't delete it, (tried 'delete', 'ctrl + Delete', delete Edges/Vertex menu option, deleting by vertices, there are no doubles it just removes the selection when I press delete) I managed only when I deleted the faces around that edge loop, which is quite annoying. Maybe someone had a similar issue and knows the solution or I am doing something wrong here? Any advice is appreciated!

sentences:
How can I load assets dynamically on user's input in LibGDX HTML? I am working with LibGDX and GWT and I am trying to publish my app as a HTML webapp, it has many assets with around hundred of folders, now I want to load them dynamically (user input is sent to JSNI, and security issues set aside), I want to be able to add more assets later without having to recompile the entire thing or creating new assets.txt file.
Here is how the app works. A user select a foldername from an HTML dropdown, this will trigger an javascript function created by JSNI: load(foldername). The app then load the files inside foldername and use it by accessing FileHandle file provided by Gdx.files.internal(file)
My goal is to be able to add more assets later on without recompiling/touching the java source code, and to eliminate load time so as not to preload hundreds of assets
I was unable to find similar problem anywhere on the Internet and I am fairly new to this field.
Workaround can be accepted too. I am using LibGDX 1.9.12 and GWT 2.8.2

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:
Learning C++ for game development I want to learn C++ for game development. Does anyone know a good way to learn this?

It can be with books, tutorials, anything. I would also like to know what is a good engine to start with?

thanks you :)

sentences: Render graphics using Doubles in Graphics2D Currently, I have a JFrame for my game to render in, and I'm using Graphics2D for drawing (The games graphics are fairly simple 2D sprites). However, my delta variable is a double, and all of the Graphics 2D methods (And Grpahics) use int. I tried to type cast the delta to an int, but it just rounds down to 0. So my question is, how can I render graphics using Graphics2D in Java with coordinates that are doubles. Can I convert it to work with Graphics2D if there is no built in way? Or, is there a graphics library that can support doubles for coordinates?

sentences:
Bullet Physics - Casting a ray straight down from a rigid body (first person camera) I've implemented a first person camera using Bullet--it's a rigid body with a capsule shape. I've only been using Bullet for a few days and physics engines are new to me. I use btRigidBody::setLinearVelocity() to move it and it collides perfectly with the world. The only problem is the Y-value moves freely, which I temporarily solved by setting the Y-value of the translation vector to zero before the body is moved. This works for all cases except when falling from a height.

When the body drops off a tall object, you can still glide around since the translate vector's Y-value is being set to zero, until you stop moving and fall to the ground (the velocity is only set when moving). So to solve this I would like to try casting a ray down from the body to determine the Y-value of the world, and checking the difference between that value and the Y-value of the camera body, and disable or slow down movement if the difference is large enough.

I'm a bit stuck on simply casting a ray and determining the Y-value of the world where it struck. I've implemented this callback:

struct AllRayResultCallback : public btCollisionWorld::RayResultCallback{
    AllRayResultCallback(const btVector3& rayFromWorld, const btVector3& rayToWorld)
        : m_rayFromWorld(rayFromWorld), m_rayToWorld(rayToWorld), m_closestHitFraction(1.0){}

    btVector3   m_rayFromWorld;
    btVector3   m_rayToWorld;
    btVector3   m_hitNormalWorld;
    btVector3   m_hitPointWorld;
    float       m_closestHitFraction;

    virtual btScalar addSingleResult(btCollisionWorld::LocalRayResult& rayResult, bool normalInWorldSpace)
    {
        if(rayResult.m_hitFraction < m_closestHitFraction)
            m_closestHitFraction = rayResult.m_hitFraction;

        m_collisionObject = rayResult.m_collisionObject;
        if(normalInWorldSpace){
            m_hitNormalWorld = rayResult.m_hitNormalLocal;
        }
        else{
            m_hitNormalWorld = m_collisionObject->getWorldTransform().getBasis() * rayResult.m_hitNormalLocal;
        }

        m_hitPointWorld.setInterpolate3(m_rayFromWorld, m_rayToWorld, m_closestHitFraction);
        return 1.0f;
    }
};

And in the movement function, I have this code:

btVector3 from(pos.x, pos.y + 1000, pos.z); // pos is the camera's rigid body position
btVector3 to(pos.x, 0, pos.z); // not sure if 0 is correct for Y

AllRayResultCallback callback(from, to);
Base::getSingletonPtr()->m_btWorld->rayTest(from, to, callback);

So I have the callback.m_hitPointWorld vector, which seems to just show the position of the camera each frame. I've searched Google for examples of casting rays, as well as the Bullet documentation, and it's been hard to just find an example. An example is really all I need.

Or perhaps there is some method in Bullet to keep the rigid body on the ground?

I'm using Ogre3D as a rendering engine, and casting a ray down is quite straightforward with that, however I want to keep all the ray casting within Bullet for simplicity.

Could anyone point me in the right direction? Thanks.

sentences:
"Saving..." dialog isn't shown until after the saving is complete I have implemented serialization/de-serialization process in my Unity game where I save/load data from/to XML file.

During the serialization, my game isn't responding until the serialization is finished and this is OK.

What is wrong is that before I call the serialization/de-serialization, I want to show saving/loading panel and show log process, but can't: this panel and all the log information show up only after the serialization/de-serialization is finished.

What I have verified and tried:

The panels hierarchy is correct
During serialization/de-serialization, no error occur
Panels are assigned manually to specified variables
If I comment out the save/load calls and leave only the panel, then the panel is shown
I have also tried to put the thread to sleep but still, nothing happens.

Can anybody can help me? Because I really don't know why this is happening like this.

Here is an snippet of my code:

public void SaveGameClick() {
  SavingPanel.gameObject.SetActive(true); // if I leave only this line and the other line
                                          // commenting the panel shows perfectly
  Debug.Log("Saving..."); // this Saving word shown only when the _savegame.Save() method
                          // finished
  if(_saveGame.Save("save.xml", Seed)) {
    Debug.Log("Saved");
    CyberTeamManagerSubMenu.gameObject.SetActive(false);
    _isShowCyberTeamManagerSubMenu = false;
    SavingPanel.gameObject.SetActive(false);
  } else {
    Debug.Log("Save Error");
    SavingPanel.gameObject.SetActive(false);
  }
}

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 calculate fps in GLFW? Just letting you guys know before anything I'm a beginner at programming. I am just wondering how I should go about calculating the fps using GLFW?

sentences:
Moving inventory items around causes reference problems I'm in the process of implementing an inventory system in my game.

The script which is most important to this question is InventorySlotManager.

public class InventorySlotManager : MonoBehaviour
{
    ItemData itemData;

    const int numSlots = 20;
    Item[] itemsInInventory = new Item[numSlots];
    [SerializeField] GameObject[] slots = new GameObject[numSlots];
    [SerializeField] GameObject itemImagePrefab;
    int[] stackSize = new int[numSlots];

    void Awake()
    {
        itemData = GameObject.Find("Item Manager").GetComponent<ItemData>();
    }

    void Start()
    {
        AddItem(itemData.coin);
        AddItem(itemData.silverRing);
        AddItem(itemData.coin);
    }

    void Update()
    {
        if (Input.GetKey(KeyCode.Alpha1))
        {
            AddItem(itemData.coin);
        }
        if (Input.GetKey(KeyCode.Alpha2))
        {
            AddItem(itemData.silverRing);
        }
    }

    void AddItem(Item item)
    {
        int indexOfDuplicateItem = System.Array.IndexOf(itemsInInventory, item);

        if (indexOfDuplicateItem > -1)
        {
            Text quantityTextOfDuplicateItem = slots[indexOfDuplicateItem].transform.Find("Item Image(Clone)").gameObject.GetComponentInChildren<Text>();
            quantityTextOfDuplicateItem.text = (++stackSize[indexOfDuplicateItem]).ToString();
        }
        else
        {
            for (int i = 0; i < numSlots; i++)
            {
                if (itemsInInventory[i] == null)
                {
                    itemsInInventory[i] = item;
                    GameObject itemImage = Instantiate(itemImagePrefab, slots[i].transform);
                    itemImage.GetComponent<Image>().sprite = item.itemSprite;
                    Text quantityTextOfNewItem = slots[i].GetComponentInChildren<Text>();
                    stackSize[i] = item.itemQuantity;
                    quantityTextOfNewItem.text = stackSize[i].ToString();
                    return;
                }
            }
        }
    }
}

This does what you'd expect. (The bit in Update is just there temporarily for testing.) When an item gets added, the function checks to see if one already exists in the items array. If not, then the for loop is executed and the item is added to the items array, an item image game object is instantiated in the corresponding index of the slots array, etc. So far so good, everything behaves properly until I start dragging items around in my DragHandler script.

So I press play, my inventory has two kinds of objects in it (coin, and silver ring). They each display their correct quantities (stack sizes) as I keep adding items. Then, I move the coin from slot 0 to slot 5 and attempt to add more coins to the inventory. It stops working because the line Text quantityTextOfDuplicateItem = slots[indexOfDuplicateItem].transform.Find("Item Image(Clone)").gameObject.GetComponentInChildren<Text>(); returns null at that point.

What is the best way to fix this such that this reference won't become null if I move the item to a different slot after it gets added to my inventory? I think I either have to map the items array to the slots array or store all of these values, e.g., items, slots, quantitytext, in one array. Is this correct?

sentences:
How to make a game without OOP? I am currenty studying game development and practicing making games.

I use a lot of OOP in my games. For example, each missile that is shot is an instance of a Missile object, and added to a list of Missile objects. Each tank in the game is a Tank object. Etc.

The entire design of the program is based on this. For instance, having a list of Missile objects allows me every frame to move the missiles, draw them, etc. And having an instance of a Tank object for every tank allows me to check for each tank if it collides with something, etc.

It's hard for me to imagine how a game (which is more complex than Pac-Man) could be programmed in a non-OO language. (With no disrespect to non-OO programmers of course). Not only in terms of how long it will take, but mostly in terms of how a game could be designed this way.

I can't imagine designing a game without using object oriented programming, because my entire understanding of how to design a game-program is based on OOP.

I would like ask: Today, are there any games that aren't programmed using OOP, in a similiar fashion to what I described above? Are there any 'professionl' games that don't use OOP as a major factor in the development process?

If so, could you give me an idea of how, for example, collision detection between a tank and N number of missiles could be implemented, without OOP?

sentences:
Quaternion.RotateTowards not working as expected when parent object moves/rotates I have a Tank with a rigidbody. A Turret Base is attached to the Tank via a Hinge Joint. The below TurretController script is attached to the Turret Base in order to rotate it to point towards the direction of the mouse.

The turret rotates flawlessly when the tank is stationary. But once I start moving the rotation behavior becomes very erratic: https://youtu.be/v1VuTbMtcCM

If anyone is able to help/explain this behavior it would be much appreciated!

/// <summary>
/// Rotates a turret towards a point at a fixed angular velocity.
/// </summary>
public class TurretController : MonoBehaviour
{
    public float m_DegreesPerSecond = 40f;

    private Vector3 m_TargetPosition;

    // Received from mouse move event
    public void Rotate(PointInputInfo inputInfo)
    {
        m_TargetPosition = inputInfo.Point;
    }

    private void RotateTurret()
    {
        Vector3 direction = Vector3.Scale(m_TargetPosition - transform.position, new Vector3(1, 0, 1));
        Quaternion targetRotation = Quaternion.LookRotation(direction, Vector3.up);
        Debug.DrawLine(transform.position, m_TargetPosition);

        // Rotate at a fixed angular velocity.
        transform.rotation = Quaternion.RotateTowards(transform.rotation, targetRotation, Time.deltaTime * m_DegreesPerSecond);
    }

    private void FixedUpdate()
    {
        RotateTurret();
    }
}

sentences:
X, Y, Z coordinate standards? I'm pretty new to 3D development of any kind, nonetheless games. As I read through tutorials and examples, I find that the X/Y/Z coordinates seem a bit backwards than my first guess.

I had imagined that if a person were walking around a field, their X/Y position would be changing and if they were to jump or walk up or down a hill, then their Z position would be changing. My assumptions appear to be wrong because walking around a field seems to change X/Z and jumping or going up/down a hill alters the Y.

1) Are my observations correct? 3D is new to me and I may not be thinking about things properly.

2) What's the logic behind horizontal movement being X/Z and vertical movement being Y?

3) Would it be so wrong of me to use X/Y as horizontal movement and Z as vertical movement in the XNA Framework?

sentences:
Special Effects in a 3d game I am creating a 3d game ( a car racing game) using opengl ES.
i know the rendering concept and also using a physics engine for all the physics stuff.
All modeling is done using 3d modeling softwares.

Now my question how to do the special effects within a game.

For example like when a car collides and toggle how to slow down all the environment effects which i saw in other available games.
OR
Nitrogen gas effects in a car race game.

Any suggestions will be of great help.
I guess my question is clear, if not feel free to ask anything.

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:
I need help with Admob in Unity this is my first Unity project and I'm getting desperate for answers.
I've been trying to get Admob to work using the official plugin. It's been giving me a ton of problems as I can't get the banner to show, despite me using nearly verbatim code as tutorials.

Here's my code:

  using System.Collections;
  using System.Collections.Generic;
  using UnityEngine;
  using GoogleMobileAds.Api;

public class AdMobTest : MonoBehaviour {

BannerView banner;
InterstitialAd fullAdmob;

// Use this for initialization
void Start () {
    RequestBanner();
    ShowBanner();
}

void RequestBanner()
{
    string bannerID = "Hiding my banner ID";
    banner = new BannerView(bannerID,AdSize.SmartBanner,AdPosition.Bottom);
    AdRequest adRequest = new AdRequest.Builder().Build();

    banner.LoadAd(adRequest);
}

public void ShowBanner()
{
    banner.Show();

}

public void RequestFull()
{
    string idFull = "hiding my banner ID";
    fullAdmob = new InterstitialAd(idFull);
    AdRequest adRequest = new AdRequest.Builder().Build();

    fullAdmob.LoadAd(adRequest);
}

public void ShowfullAds()
{
    if (fullAdmob.IsLoaded())
    {
        fullAdmob.Show();
        RequestFull();
    }
    else
    {
        RequestFull();
    }
}

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

}

I have a new 2D project setup with an empty scene and an "ad" game object, and a script added to that game object. I'm expecting something to show up on my phone's screen, but nothing is showing up.
I know this may be a stupid question, but I've spent a ton of time on this, and I'm pretty new to this stuff. So please help me out!

sentences:
Should I (and how to) avoid using global classes I have been having fun learning java for years, did a little bit of OOP tutorials and this is the first time I attempt to make a real project. The project is very similar to some top down view tabletop management game with very little graphics. Oddly every thousand line of code I hit my head on a wall and wonder if I need to restructure everything. For example I restructured once to try and adopt some concept of MVC, which I had no knowledge of when I started. I am glad I did.

The wall now : I started reading how we should use global and singleton sparingly when I suddenly could not save my game since I had created a new instance that had static fields (using GSON to save my Game object).

My project structure

App : gameloop, has Engine class, calls Engine.updateUI() and engine.updateGame()
Engine is the main controller that has access to all other controllers, creates the game object and updateUI() and updateGame() methods
Game : contains every object that represent the state of the game so that I can save and load it
MyData class is a global class that just loads a bunch of text files and provides data for the game but does not need to be saved

So lately I created a class called Finances that had static fields such as cash, waterBill, electricityBill... I can only ever need one instance of Finances in my game so I thought it would be neat to be able to do something like Finances.addCash() or if Fiances.getCash() == enough doSomething from anywhere in my code, from any controller, to enable and disable buttons for example.

I have another similar class called Updater that has static booleans as flags to schedule an update on certain part of the UI instead of having every UI elements update and query the model 60 fps.

Some solutions

Add some code to save and load the values of those static fields;
change the fields to non-static and give Game another parameter called finances that will only be created once.

I was going with the second approach for a while but I realized I was just passing Engine engine everywhere to have access to everything like engine.getGame().getFinances().getWaterBill().pay()

I feel like this is just like a global variable but more complicated. Here I am not hoping to code the best code with the best structure and all best practices. I am just looking to improve and learn in a fun way. Most articles I found just end "anyway if you end up with needing many singletons or globals your code probably smells". That did not help me find a solution.

sentences:
Traffic system in isometric game I would like to create a traffic system in my tile-based isometric game and I would like to ask for some good approaches because I don't have a clue how to begin.

Right now I have a tilemap and keep its data in an 2d array. I have...
1. tile objects (with properties like index, tile type etc.)
2. building objects (with properties like origin, size etc.).

I´ve already implemented a A* algorithm which allows me to find the best/shortest path from one tile to another but now I have to realize the movement from start to end tile with features like stackable cars.

I though about setting up a property for my tile object which tells me if a tile contains a car but right now two cars fits on one tile in my game on each lane so this approach might be not the best solution.

Edit: i´ve added an image with lanes drawn on my tilemap. Having lane objects might be a good idea but I need to connect them to the tile objects somehow.

Have anyone implemented a traffic system in a tile-based game or have any ideas how to realize that and would share his/her knowledge with me? Would be great!

Thanks a lot!

sentences:
What is the cause of this lighting artifact on my dynamic terrain mesh? I am generating my own terrain mesh in Unity, using pseudo-random noise to determine the height. I construct the mesh using quads, each quad is composed of two triangles.

All seems to be going well, except the terrain does not look right - the quads are very visible. You can see the outline of them on the surface, but I haven't seen this effect before elsewhere. I feel that something is wrong with either my normals or my UV's. I am using just one white directional light.

Dynamic Terrain http://www.spannerworx.com/images/terrain.png

I thought the issue was with the normals, so I stopped calling RecalculateNormals and manually calculated the normal for every vertex using the averaged normal of the sum of each triangle touching that vertex. This was a lot of effort, but made no effect and ended up looking just the same.

Has anyone else seen this dynamic mesh effect before and maybe make some suggestions as to how I could try resolve this?

Just to clarify, I am already generating the triangles myself, two per quad. I do it like this:

for (int t = 0; t < quadCount; t++)
{
    int x = t / (Samples - 1);
    int z = t % (Samples - 1);

    // Calculate quad corner indexes
    int indexBR = CalculateIndex(x + 1, z);
    int indexBL = CalculateIndex(x, z);
    int indexTL = CalculateIndex(x, z + 1);
    int indexTR = CalculateIndex(x + 1, z + 1);

    // Assign indexes for triangles
    // Triangle 1
    triangles[6 * t + 0] = indexBR;
    triangles[6 * t + 1] = indexBL;
    triangles[6 * t + 2] = indexTL;

    // Triangle 2
    triangles[6 * t + 3] = indexBR;
    triangles[6 * t + 4] = indexTL;
    triangles[6 * t + 5] = indexTR;

    // Normals stuff...

}

sentences:
How to maintain char widths of non-monospace fonts? Having a font via spritesheet (as PNG), the easiest way to render fonts from that is just showing chars as monospace, but as you can imagine, that looks not pretty with chars like l, i, : and so on..

Is there a slick way to maintain the width of every char?

I already thought of storing it into an extra file, telling the width of each char in pixels.

Pro: Fast rendering.
Con: That's one load of work for about 100 chars.

I gave "counting" the pixel-width of each char on rendering it a thought.

Pro: Once that algorithm does it's job there's no work with that afterwards.
Con: As there is pretty much font-rendering going on each frame, this is plain bullshit - performancewise.

I'm open to suggestions and/or known algorithms for this problem.

EDIT: TTF or some other real font is not an option, because they render wayy to pixelated on the small sizes needed.

EDIT: Thanks to lorenzo-gatti, made simple marker-pixels in the spritesheet like so:

Distance between these gets counted on startup of the game and the markers are replaced with transparent pixels. So no heavy additional logic in render which would slow down and startup-time is not really slower than before, thanks!

sentences:
How can I draw gizmos and move the drawn gizmos when moving the transform in the editor in scene view? public void OnDrawGizmos() {
        if(_thisT == null) _thisT = transform;
            if(!Application.isPlaying && _posBuffer != _thisT.position+_startPosOffset){
                _posBuffer = _thisT.position+_startPosOffset;

            }
            if(_positionSphereDepth == -1){
                    _positionSphereDepth = _positionSphere;
                }
                if(_spawnSphereDepth == -1){
                    _spawnSphereDepth = _spawnSphere;
                }
            Gizmos.color = Color.blue;
            Gizmos.DrawWireCube (_posBuffer, new Vector3(_spawnSphere*2, _spawnSphereHeight*2 ,_spawnSphereDepth*2));
            Gizmos.color = Color.cyan;
            Gizmos.DrawWireCube (_thisT.position, new Vector3((_positionSphere*2)+_spawnSphere*2, (_positionSphereHeight*2)+_spawnSphereHeight*2 ,(_positionSphereDepth*2)+_spawnSphereDepth*2));
        }

_posBuffer is Vector3
_spawnSphereDepth is float

The problem is that it's drawing the cube in the center of the scene view window and when I'm changing the transform position the cube Gizmo is not moving.

Is there a way to draw the DrawWireCube so it will be position around the transform and when moving the transform that the gizmos draws will move with it too ?

sentences:
How can I design an effective some sort of sequence system? I am making a story driven game right now, and I want to create a system that will allow me to code sequences easily without creating a mess from the project.
What I mean by sequences is for something like a Scene, for example, since it's story driven, the player begin in a room, which then a character walk in, display a dialogue, then walks away, does a few things, a couple of sounds and effects are played, etc.

I was wondering how I could structure a system like that, that will allow me to have hundreds of this sequences without making a big mess of my project, also, these are going to be must like scripted, is it better to keep most of the scripts in a fewer class files or it's a good idea to spread them more? (to more class files)

I hope you can understand exactly what I meant and thank you in advance.

(I am making this in C# in Unity but I am not looking for specific code, just theory how to construct such system effectively)

sentences:
Finding a moving target in a maze I'm making a game that is a bit of a mix of snake and pacman.

Basically, two players go through the maze and each time they pick up a piece of candy, a cube is added to their tail.  If one player touches the other's tail, he steals that piece for himself and the game is over when one player has all the pieces.

Right now they both move randomly unless there's a piece of candy one space away that is not their tail.

I'm trying to find a method/algorithm (preferably a different method for each player) for both players to target/avoid the other player.
Any advice?

sentences:
Why does using .Lookat() cause the enemy to look left instead of at player, and how can I fix it? I am new to Unity. I have searched but I couldn't find any answers on this. Here is my code:

somethingPosition = new Vector3(player.transform.position.x, transform.position.y, player.transform.position.z);
transform.LookAt(somethingPosition);

The somethingPosition only allows rotation of the Y axis so. Anyways, I have this script on the enemy AI.

The issue is this: the enemy looks at the player but looks to the left of the player. The same issue occurs when I have my follow code happen:

transform.position = Vector3.MoveTowards(transform.position, player.position, speed * Time.deltaTime);

The enemy will continue going to the left of the player but will not hit the player. What are some suggestions you guys can survive? Thanks!

I am aswell using a NavMesh and NavMeshAgent

sentences:
Unity - How to add bones to procedural mesh Basically this is the set up: An N amount of prefabs are bundled together into a new GameObject. This is then merged into a single main mesh composited of M amount of material submeshes.
The shape is standing upwards on the Y axis and is a bunch of arms.
The goal is to move these by adding bones.

I wasn't able to find many examples on how to properly assign bones to a procedural mesh which isn't a simple cube.

The problem is assignment of vertices to the boneweights. I'd like for the transform Y=0 vertices to have no weight and the Y=furthest vertices have full weight. I am not sure how the assignment should be done.. Any pointers? :)

So far the Lower and Upper bone transforms are in the right place, but when moving them the mesh isn't bending as I hoped it would in a nice curve, half of the vertices are simply moved uniformly with a thin mesh line connecting the two halves.

private void _AddBones()
{
    if(m_SkinnedRenderer != null)
    {
        // Make bone weight for vertices
        BoneWeight[] weights = new BoneWeight[m_MainMesh.vertexCount];
        int halfway = (weights.Length / 2);
        for (int i = 0; i < weights.Length; i++)
        {
            if(i < halfway)
            {
                weights[i].boneIndex0 = 0;
                weights[i].weight0 = 1;
            }
            else
            {
                weights[i].boneIndex0 = 1;
                weights[i].weight0 = 1;
            }
        }

        m_MainMesh.boneWeights = weights;

        // Make bones and bind poses
        Transform[] bones = new Transform[2];
        Matrix4x4[] bindPoses = new Matrix4x4[2];
        bones[0] = new GameObject("Lower Bone").transform;
        bones[0].parent = m_MergedRoot.transform;
        bones[0].localRotation = Quaternion.identity;
        bones[0].localPosition = Vector3.zero;
        bindPoses[0] = bones[0].worldToLocalMatrix * m_MergedRoot.transform.localToWorldMatrix;

        bones[1] = new GameObject("Upper Bone").transform;
        bones[1].parent = m_MergedRoot.transform;
        bones[1].localRotation = Quaternion.identity;
        bones[1].localPosition = new Vector3(0, 1.5f, 0);
        bindPoses[1] = bones[1].worldToLocalMatrix * m_MergedRoot.transform.localToWorldMatrix;

        m_MainMesh.bindposes = bindPoses;
        m_SkinnedRenderer.bones = bones;
        m_SkinnedRenderer.sharedMesh = m_MainMesh;
        m_SkinnedRenderer.rootBone = bones[0];
    }
}

sentences: How to track many in-game statistics I am looking to track many in-game events, e.g. the score of each move, how many moves are taken, what types of moves, etc. A lot of stats can simply be tracked with a counter. In some cases I need to aggregate data in order to calculate the value (e.g. most common move). How are you tracking in-game stats for your games? How do you avoid creating a class with tens or hundreds of fields? How do you avoid littering the code with tracking invocations? How do you abstract the aggregate data so as to avoid rewriting it for each scenario?

sentences:
building a game for different resolution phones I am starting some tests for building a game on the Android program.
So far everything is working and seems nice.

However I do not understand how to make sure my game looks correct on all phones as they all will have slightly different screen ratios (and even very different on some odd phones)

What I am doing right now is making a view frustum (could also be ortho) which I set to go from -ratio to +ratio (as I have seen on many examples) however this causes my test shape to be stretched and sometimes cut off by the edge of the screen.

I am tilting my phone to landscape to do my tests (a bit extreme) but it should still render correctly if I have done things right.

Should I be scaling by some ratio before drawing or something?

An example would be greatly appreciated.

PS. I am doing a 2D game .

sentences:
Plugins for creating and styling custom Editor Windows like C#/C++ Form Designer or “Web Inspector”? Unity3d allows to construct window with custom UI. Just need to use EditorGUI/EditorGUILayout classes and their static methods.
Example of custom window:

The problem is that all the components have to be added manually via script. Then need to save, switch to Editor, wait for little compile things, and then we can see the result.

In web-development people use Web Inspector (for example, we can press F12 in chrome, Tab Elements -> Styles). We can add all needed properties to element and can see the result in real-time.

EDIT. another example (better than previous): we know C# winFormApp, C++ MFC e.t.c, which has form designer. We can choose any elements and set their properties:

It would be nice to have similar plugins for Unity

So. Does Unity3d have similar tools, utilities, plugins? Utilities to inspect code and editing styles (position, margin, padding, background, width, height, color  e.t.c.)?

sentences:
Version number not supported by gl2 in andengine I am new to andengine. From various forums, i got to know that my system should support hardware virtulisation. I have installed "Intel X86" and my system didn't throw any problem regarding "HAX" now. But now i am getting error in logcat as follows

09-13 22:20:43.195: E/AndroidRuntime(1509): FATAL EXCEPTION: GLThread 83
09-13 22:20:43.195: E/AndroidRuntime(1509): org.andengine.opengl.shader.exception.ShaderProgramCompileException: Reason: ERROR: 0:1: '' :  Version number not supported by GL2
09-13 22:20:43.195: E/AndroidRuntime(1509): Source:
09-13 22:20:43.195: E/AndroidRuntime(1509): ##########################
09-13 22:20:43.195: E/AndroidRuntime(1509): uniform mat4 u_modelViewProjectionMatrix;
09-13 22:20:43.195: E/AndroidRuntime(1509): attribute vec4 a_position;
09-13 22:20:43.195: E/AndroidRuntime(1509): attribute vec2 a_textureCoordinates;
09-13 22:20:43.195: E/AndroidRuntime(1509): varying vec2 v_textureCoordinates;
09-13 22:20:43.195: E/AndroidRuntime(1509): void main() {
09-13 22:20:43.195: E/AndroidRuntime(1509):     v_textureCoordinates = a_textureCoordinates;
09-13 22:20:43.195: E/AndroidRuntime(1509):     gl_Position = u_modelViewProjectionMatrix * a_position;
09-13 22:20:43.195: E/AndroidRuntime(1509): }
09-13 22:20:43.195: E/AndroidRuntime(1509): ##########################
09-13 22:20:43.195: E/AndroidRuntime(1509):     at org.andengine.opengl.shader.ShaderProgram.compileShader(ShaderProgram.java:187)
09-13 22:20:43.195: E/AndroidRuntime(1509):     at org.andengine.opengl.shader.ShaderProgram.compile(ShaderProgram.java:143)
09-13 22:20:43.195: E/AndroidRuntime(1509):     at org.andengine.opengl.shader.ShaderProgram.bind(ShaderProgram.java:122)
09-13 22:20:43.195: E/AndroidRuntime(1509):     at org.andengine.opengl.shader.PositionTextureCoordinatesShaderProgram.bind(PositionTextureCoordinatesShaderProgram.java:86)
09-13 22:20:43.195: E/AndroidRuntime(1509):     at org.andengine.opengl.vbo.VertexBufferObject.bind(VertexBufferObject.java:162)
09-13 22:20:43.195: E/AndroidRuntime(1509):     at org.andengine.opengl.texture.TextureWarmUpVertexBufferObject.warmup(TextureWarmUpVertexBufferObject.java:97)
09-13 22:20:43.195: E/AndroidRuntime(1509):     at org.andengine.opengl.texture.TextureManager.updateTextures(TextureManager.java:257)
09-13 22:20:43.195: E/AndroidRuntime(1509):     at org.andengine.engine.Engine.onDrawFrame(Engine.java:613)
09-13 22:20:43.195: E/AndroidRuntime(1509):     at org.andengine.opengl.view.EngineRenderer.onDrawFrame(EngineRenderer.java:105)
09-13 22:20:43.195: E/AndroidRuntime(1509):     at android.opengl.GLSurfaceView$GLThread.guardedRun(GLSurfaceView.java:1462)
09-13 22:20:43.195: E/AndroidRuntime(1509):     at android.opengl.GLSurfaceView$GLThread.run(GLSurfaceView.java:1216)
09-13 22:20:43.275: E/OpenGLRenderer(1509): Error while compiling shader: ERROR: 0:1: '' :  Version number not supported by GL2
09-13 22:20:43.304: E/OpenGLRenderer(1509): Error while compiling shader: ERROR: 0:1: '' :  Version number not supported by GL2

I am getting similar kind of error when i tried to execute my program in BlueStacks and my application gets crashed. Pls help me regarding this. Thanks in advance

sentences:
What design pattern should I employ for validating character movement? I'm developing a RPG in Java and have a Map class, which will contain all the MapObjects (the Player, Enemies, Walls, etc.):

Map.java

public class Map {

private int width;
private int height;

private ArrayList<MapObject> MapObjects = new ArrayList<MapObject>();

public Map(int width, int height) {
    this.width = width;
    this.height = height;
}
 }

Hero.java:

public class Hero extends MapObject implements Movable {

private Map map;

public Hero(int x, int y, int direction, Map map) {
    super(x, y, direction);
    this.map = map;
}

public boolean move(int direction) {
    //movement code
}

}

I will have a listener on an external class that will call the hero.move(direction) function.

What is the best approach to validate the movement (making sure that there's an empty space on the map)?

I could pass the Map as an argument, or even use the Command design pattern (the hero being the "remote" and the map being the implementation and executer), but I'm not sure if any of those are the right way to approach this problem.

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:
Hexagonal Game Board Modal? Tile-based games like Chess have a simple modal: an array of arrays, each coordinate with an X and a Y value. This is easy to implement, and it is easy to figure out what is going on.

Chess Board http://www.chesscentral.com/EasyEditor/assets/chess_board_blank.gif

However, when I see games like Civilization 5, I am not sure how hexagonal worlds are implemented. I have a couple ideas, but cannot confirm them.

Each row of hexagons is represented in the modal by an array of tiles. This would be much like the first chess board, but would require more effort to figure out adjacent tiles.
Each tile only know what tiles border it. When the game renders one tile, that tile loads the 6 around it, which repeats until the screen is filled with tiles.

Are either of these guesses correct? If not, how do developers implement these hexagonal maps?

sentences:
Automated testing of games Are there methods of automated testing of games?

Specific experiences are appreciated, with relevant information about the project such as platform and type of game if that helps with clarification.

sentences:
UnityIAP Subscription Purchase Basically I want to setup UnityIAP for implementation of weekly or monthly subscription for apple store game. I completely read following article given by Unity:

Integrating Unity IAP In Your Game

After this I become aware with actual implementation but i have following questions arise:

how we can get information about subscription already purchased by this user?
how we track time for auto renewable subscription purchase?

Please give me some information about this.

sentences:
How should I implement a first-person camera? I'm a beginner programmer and I'm creating a project which allows me to walk around rooms via a first person camera. So far, I have the buildings drawn and  on, but now I'm stuck and don't know how to make a first-person camera to allow me to walk around.

Could anyone point me towards a camera class I could use, or some useful code?

sentences:
Explain the difference between extrapolation and interpolation http://www.unagames.com/blog/daniele/2010/06/fixed-time-step-implementation-box2d here there are two algorithms of smoothing in case of fixed time step physics simulation. I don't understand the formula of interpolation:

state = currentState * alpha + previousState * (1-alpha)

And also I don't understand the comparison figure. Please explaing what is the meaning of multiplying current state with alpha and summing with previous state with 1 - alpha.

sentences:
Game State with sqlite + MySql I am building out my first android game, after some utility app development.

I want to be sure I am not moving into a direction that is not a best practice, so please (constructively) criticize my plan.

My game will have many NPCs that will be added often (>150) in increments of 10-15. Each will have their own stats associated with them and the user will have a unique interaction with each.

Is it possible to put all of the NPC character information into a MySql database and have my app download the new information when it understands that the servers contain new information (via C2DM). Including a link to a file I will host containing the png files for each NPC. This way when there are new NPCs to be added to the game, the user doesn't have to grab an update from the market/Google Play.

Furthermore is sqlite/MySql a preferable method to save the user's game state. I want to be able to save it locally so that it can be loaded without a network connection. And periodically updated on the server to allow the user to play the same game both on a phone and tablet for example.

If I sound like I'm on the right track with my plan, what opensource projects exists from which I can learn/analyse the methods they use to accomplish a similar task? I have been unable to find anything like this as of yet.

EDIT: by >250NPCs I mean that the game will start out with perhaps ten enemies. Each has their own stats (health, strength, magic etc). And since I plan on adding more than 150 types of enemies, I'd like the game to be able to update at run time rather than require an update with Google Play - since many users simply do not update their software on a timely basis, they will be missing out on the added value.

The reason I favor SQL is so that I can easily view my game characters and modify their stats/qualities on the fly should I see the game become unbalanced.

sentences:
How to convert Blender rotation angles to Unity rotation angles? I add news cameras in my game. I have a problem with rotation, the result is not alway  the same as in Blender. I tried lot of ideas but today I do not have anymore.

Cameras 1, 2, 4 : good rotation

Cameras 3, 5 : bad rotation

Cam 1 (Blender):

Cam 1 (Unity): the fov is different

Cam 4 (Blender):

Cam 4 (Unity): the fov is different

Cam 3 (Blender):

Cam 3 (Unity): rotation is very different

Cam 5 (Blender):

Cam 5 (Unity): rotation is very different

This problem appears if camera orientation is "vertical"

Do you have a turn arround, a solution for me?

My code:

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

public class rotation_cams : MonoBehaviour
{
    private Vector3[] cams_loc;
    private Vector3[] cams_rot;
    void Start()
    {
        cams_loc = new Vector3[5];
        cams_rot = new Vector3[5];

        cams_loc[0] = new Vector3(79.7771f, 21.7574f, 109.795f);
        cams_rot[0] = new Vector3(95f, -45f, -200f);

        cams_loc[1] = new Vector3(78.0048f, 21.9854f, 110.314f);
        cams_rot[1] = new Vector3(87.0958f, 1.34464f, -160.515f);

        cams_loc[2] = new Vector3(78.3154f, 18.9402f, 111.654f);
        cams_rot[2] = new Vector3(169f, 59.3947f, -110.242f);

        cams_loc[3] = new Vector3(78.023f, 18.7094f, 111.375f);
        cams_rot[3] = new Vector3(89.4105f, 16.7202f, -128.303f);

        cams_loc[4] = new Vector3(79.5798f, 19.7249f, 111.743f);
        cams_rot[4] = new Vector3(55.0461f, 74.0926f, -220.475f);

        int i = 0;

        foreach (Vector3 vector_loc in cams_loc)
        {
            string camName = "cam" + i.ToString();
            GameObject currentCam = AddCamera(camName);

            currentCam.GetComponent<Transform>().position = new Vector3(cams_loc[i].x, cams_loc[i].z, cams_loc[i].y);

            Vector3 objRotation = new Vector3(cams_rot[i].x * -1, cams_rot[i].z * -1, cams_rot[i].y * -1);
            objRotation.x += 90f;

            currentCam.GetComponent<Transform>().eulerAngles = objRotation;

            i += 1;
        }
    }

    void Update()
    {

    }

    private GameObject AddCamera(string name)
    {
        GameObject gizmoPhoto = GameObject.Instantiate(GameObject.Find("cam"));
        gizmoPhoto.name = name;

        return gizmoPhoto;
    }
}

sentences:
Render angles of a 3D model into 2D images? Is there a tool out there that you can give a 3D model file, and it will output 2D renders of it from various angles? For example if you were making a 2D RPG but you want to make your character look nice, you might make the character in 3D and then just render the character from 8 or more angles into images which then are used by the 2D engine to give a pseudo-3D look.

Does such a tool exist or will it need to be custom-written or done manually?

sentences:
How do i approach these inheritance problem? (Pokemon Gen III) I'm currently making a Pokemon clone on Python just for the heck of it. After fiddling a bit with some GBA ROM editing tools, i've found out that on these games there are, among other things:

Events placed on a map, each with a script that is run when you interact with it (Either by running into them or pressing the A button at them).
Examples of this are Signposts, hidden items, doors, and more importantly...
NPCs, which, aside from having scripts (talking, triggering a pokemon battle, etc) can move and/or look around (at least some of them).
The Player character, which can also move and look around, controlled by the human player or by some outside event that may be manipulating it. But the Player itself is not an event, as it has no associated event scripts on its own. It just triggers everyone else's.

So how should i go about recreating this with Python? By using multiple inheritance, i'd get something like this:

class Event(object):
    def __init__(self, x, y script):
        self.x = x
        self.y = y
        self.script = script

class Moving(object):
    ''' objects that can move '''
    def __init__(self, x, y, direction):
        self.x = x
        self.y = y
        self.direction = direction

    def move_one_space_to(self, direction):
        self.x += direction.x
        self.y += direction.y
        self.turn_to(direction)

    def turn_to(self, direction):
        self.direction = direction

class NPC(Event, Moving):
    def __init__(self, x, y, script, movetype):
        Event.__init__(self, x, y, script)
        Moving.__init__(self, x, y, DOWN)
        self.movetype = movetype

class Player(Moving):
    # many methods that an NPC shouldn't have go here
    pass

However, even though i may be sidestepping any problems that come with it, i'm still reluctant to use multiple inheritances. So...

Should i stick with this approach?
And if not... why not? and can you post a better one?

sentences:
How does one multiply by a constant in a VS1.1 assembly vertex shader? I'd like to multiply a vector by -1

e.g.

mul    r0,    r0,    -1

When I try this, I get this error message:

SimpleShaderA.vsh(20,17): error X2000: syntax error : unexpected integer '1l'

How can I specify -1 in my (first) shader program?

sentences:
Voxel engine/vertexes: how to add more and more different textures during game runtime and change some of the blocks' faces? It's difficult to ask this, but I'll try. The thing is: I asked before somethings about creating ramps and blocks with vertexes. [I'm using C#/XNA.]

Explanation: now I got a chunk that has blocks wherever I want, that automatically change "stairs" into ramps. And I love it and I thank all the people that helped me out! But I don't know how to texture it appropriately.

I could add a Texture Atlas and set the coordinates of each texture (I found the example at a project called "TechCraft Engine"), but I'd like to create separate PNG files for each texture, 'cause I'll use transparency later and I'd like that textures can be loaded during game runtime.

I'm newbie in programming, but I'm searching for solutions. All that I got for now is that I have a custom effect (FX file) created that changes colors for each time of the day. But it only has a slot for one texture file loaded. And I still can't implement it because of that.

I can't add more texture samplers to the effect 'cause it can't be done at game runtime (or can it?)

I'm using the VertexBuffers and IndexBuffers, with TriangleList primitive. For now, I can only draw with colors, without textures.

Later in my game I would like that custom textures could be added and placed on some of the block's faces. A example for this can be found in The Sims 3. There you can add textures to the game and paint the walls and objects with it. It's something like that I'd like to create, but with a loader while playing.

My question is: should I create a VertexBuffer and a IndexBuffer for each texture and separate the vertexes with each texture between them, creating a List of VertexBuffer and IndexBuffer for placing each?... Then I could draw all the vertexes of one texture at a time, change the effect's texture parameter with a different one (call the pass technique again), and set the graphics device again with the next VertexBuffer and IndexBuffer of the list, for drawing it with the TriangleList primitive.

I'd repeat it for each texture loaded. Does it work or is there any other way to do it?

Should I forget about runtime loading for now, for finding a easier solution?

I'm pretty messed with this, do you have any suggestions? Any information will help. Thank you!

sentences:
How to convert applied torque or angular velocity angle to a positive 0 - 360 degree? Objective

To convert body.getAngle() to 4 direction (NSEW), when torque or angularvelocity is used

Because box2d body default angle is zero, I used it as reference to create my character direction. 0 degree means West, 90 degree North, 180 degree East and 270 is south, with a range of 45 degree. When I manually transform the body I get the right direction, but when I use the body.setAngularVelocity() or body.applyTorque() I get a different angle, which is more than 360 degree, assume  body.angle() * RADIAN_TO_DEGREE. I am only expecting 0 to 360 degree without negative.

public static SteerDirection getDirection(float degreeAngle) {
    SteerDirection direction = SteerDirection.NONE;
    if(degreeAngle > 0 && degreeAngle < 22.5 || degreeAngle > 337.5 && degreeAngle < 360){
        direction = SteerDirection.WEST;
    }

    if(degreeAngle > 22.5 && degreeAngle <67.5) {
        direction = SteerDirection.NORTH_WEST;
    }

    if(degreeAngle > 67.5 && degreeAngle < 112.5){
        direction = SteerDirection.NORTH;
    }

    if(degreeAngle > 112.5 && degreeAngle < 157.5){
        direction = SteerDirection.NORTH_EAST;
    }

    if(degreeAngle > 157.5 && degreeAngle < 202.5){
        direction = SteerDirection.EAST;
    }

    if(degreeAngle > 202.5 && degreeAngle < 247.5){
        direction = SteerDirection.SOUTH_EAST;
    }

    if(degreeAngle > 247.5 && degreeAngle < 292.5) {
        direction = SteerDirection.SOUTH;
    }

    if(degreeAngle > 292.5 && degreeAngle < 336.5) {
        direction = SteerDirection.SOUTH_WEST;
    }

    return direction;
}

sentences:
XNA: Skinning sample, keyframes and time I've been using the skinned sample from XNA tutorials to understand and play FBX files animation. While the animation in all my tests runs correctly, I fail to understand the technic to calculate time versus keyframes.

Most of the models I found so far for free and testing purpose on google store all animations into one "take" and split frames into all animations. So, walk would be frame 1 to 14, run 15 to 30, jump 32 to 48, etc. On the other hand, the skinning sample loads all frames and store a calculated time which it will be using to loop the animation.

The part where I'm getting confused is on the keyframe part. For example a model I've been trying to load gives me a 12 seconds timespan with 20160 keyframes. While the timespan seems right, the keyframe count seems to have been altered in some way since in Milkshape and in the Autodesk converter the frame count is at 300. What is it doing?

Here's my setup for model conversion.

I use Milkshape 3D to export a model and its animation to an FBX binary file.
Then, I use the Autodesk file converter to convert the file into an ASCII FBX (so far I tried and tested the FBX2012 and version 6.1, which is the same as the "dude.fbx" given with the skinning sample).
Processing model inside XNA with the SkinnedModelProcessor given with the skinning sample.

What I'm really trying to achieve here is to split animation into smaller clips so I can switch depending on the user action. I'm perfectly fine with counting keyframes, but as you can see, the keyframe count is way too high.

sentences:
How can I improve the performance of handling many objects to draw in XNA? I have a 2D engine that uses XNA 4.0. I have an issue with handling many objects.
In my engine, I only draw visible sprites, and ignore sprites outside of the current viewport. It works, so far. I also use a RenderTarget to minimize the amount of sprite batch being called, to draw the base.

I also need to draw buildable objects, and the worst case is that there is a list with 10,000 - 20,000 objects. I need to iterate through them, to find the visible buildable objects, as well. This really affects my frame rate, especially when the viewport changes.

I could decrease the zoom level, to minimize the amount of base tiles, but the list of objects keeps the same. Using smaller texture sizes could help, but then I´m also losing detail.

How could I improve the performance?

sentences:
Scale one object to be cover multiple other objects I have placed and aligned several objects next to each other. For the sake of understanding, lets just say I placed 10 cubes next to each other. I snapped them all together (Move->V->Click&Drag). The cubes look great so far. Now I want to make a plane in front of the cubes, that has exactly the width of the cubes altogether.

Now, I can place a new plane in front of the, no problem. I can snap a single edge to the cube on the most right, also no problem.

But now, how can I make the size exactly the same as all the cubes together? Sure, I could eyeball it from top view, an kind of make it about the same size, but chances are, it's a little bit too short or too long.

Isn't there a possibility to snap one edge, lock it, and snap another edge making the object scale automatically to the desired width?

sentences: Problems making a smooth character rotation My character has an angle rotation, when the player touches the screen it automatically face to the place that the player touched, using atan2(y,x) and Math.radiansToDegrees methods, but I want it to do that smoothly, is to say, save the required angle in a variable, and the current one in another, and depending of the 2 values, make it to rotate to left(if the required angle is to the right side of the current) or to the right. I've been almost an hour thinking about this, but I  couldn't solve it.

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: How to make a hand-drawn squared texture periodic with as little modification as possible? The obvious part is drawing as periodic as possible, but hand-drawing is impossibly so perfect, so what kind of modifications are possible that do not make the textures loose their hand-drawn character?

sentences:
SpriteSheet in slick2d or lwjgl import java.awt.image.BufferedImage;
import java.io.IOException;

import javax.imageio.ImageIO;

public class SpriteSheet {
    private String path;
    public final int SIZE;
    public int[] pixels;

public static SpriteSheet tiles = new SpriteSheet("/texture/spritesheet.png", 256);

public SpriteSheet(String path, int size) {
    this.path = path;
    this.SIZE = size;
    pixels = new int[SIZE * SIZE];
    load();
}

private void load() {
    try {
        BufferedImage image = ImageIO.read(SpriteSheet.class.getResource(path));
        int w = image.getWidth();
        int h = image.getHeight();
        image.getRGB(0, 0, w, h, pixels, 0, w);
    } catch (IOException e) {
        e.printStackTrace();
    }
}
}

So I'm trying to load a SpriteSheet either using slick2d or lwjgl. Was wondering is this faster, than the method above. Also, how do you actually do a spritesheet class for lwjgl.

I'm just confused how you use Sprites in Slick2d. It looks like I need to create an image class and then have SpriteSheet class extend the image class.

http://slick.cokeandcode.com/javadoc/org/newdawn/slick/Image.html

sentences: GPU friendly bezier storage/evaluation? Let's say that you want to do bezier curve or surface evaluation on the GPU (fragment shader, geometry shader, compute shader, OpenCL, etc).  Does anyone know of any interesting tricks of techniques to do so?  Im looking for GPU specific techniques, but I already know the equations for n degree bezier curves, triangles and tetrahedrons.  Thanks!

sentences: What are some free online game design courses? I have an MComp in Computer Science. I would like to specialize in game programming. What online free video game design courses are there? I as thinking something similar to coursera.org

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:
How does mass work in Box2D I'm making a 2D platformer, shooter type game in LibGDX, and I'm wondering about Box2D's mass system. I'ven't used mass for anything in the game so far, and everything has worked ok. We move the player, enemies, and bullets around by
body.applyLinierImpulse(new Vector2(impulseX, impulseY), body.getWorldCenter)
and even have a variable jump height system, and it all works fine. To change the speed or impact of objects, we just change the impulse. I've tried using aplyForce() but it won't move the body. Everything is usually just a simple polygon, but when I'm creating fixtures there's an option to set the density, and bodies have the option to set the massData, but I don't know what either of these properties does. The gravity of the world is around 11. Can anyone tell me how I should be handling mass with my objects in the game? Thanks.

sentences: Can the unity networkmanager actually load scenes from streaming assets like loading a build-in scene? Can the build in networkmanager load a scene from the streaming assets folder and force all clients to do the same or do i have to load it manually on each client using some remote procedure? I cant find anything about that in the docs or on youtube.

sentences:
Weird windowed resolution - can't seem to change without changing the name My game is windowed, and when I set the resolution in the build settings (960x540 - 16:9 - Windows standalone), and build it, it works as intended, but from then on, I can no longer change the resolution (can change it in the editor, and it also saves, but when I build it, it is still the original res (960x540))unless I change the Product Name as well. When I change the product name, I can change the resolution, build it, and it will change, but then it is stuck as well. When I change back to the first name, the resolution automatically change it the resolution for the first name (960x540) (it doesn't show up in the editor, only when you build it.)

So basically:

Name1
960x540

Name2
1280x720

Name3
1024x576

etc

So you can change the resolution every time you change the name and build it, and that name is stuck with that resolution (no matter what you change it to in the editor later). I am fairly new with unity, so am I missing something very basic here?

Thanks for any help!

sentences:
Attribute ownership in Entity Component systems How do you typically handle data ownership in these systems?

Right now I just have a map that maps type(std::string or hashed int)->void* where outside sources can add attributes via a simple AddAttribute method.

Right now I'm having the problem of where and how to delete some of that data, since some of it is added via outside sources (e.g. reference to another entity) and some of it is legitimate data of the entity that contains it (e.g. health attribute).

The most obvious solution would be to simply use shared pointers, but somehow I'm worried that their overhead will become noticeable when I have a lot of entities (see https://stackoverflow.com/questions/3628081/shared-ptr-horrible-speed).

Another solution that I could come up with was to first use two distinct methods: "AddAttributeExternal" and "AddAttributeInternal" (or something similar, naming is irrelevant) where the attribute would only delete data that was added via the second. But I would like to avoid this since it introduces duplicate code and can probably be error prone when you introduce a lot of changing data.

Are there better/more optimized solutions or do I need to change the way I think about entity data altogether?

sentences:
How to implement the rag doll physics in OpenGL? I'm wondering, having a human model made in blender, how can you make it so that at some point (when the human "dies") the body follows the rag doll physics in OpenGL? I tried looking for some tutorials but I can't found one that fits my requests.
Specifically how do you make rag doll physics in OpenGl (and if needed using Blender)?

sentences:
How do I draw more than just points in 3D? I'm currently working on a 3D rendering engine in JavaScript. I've successfully rendered a cube and can rotate it. My cube is represented by 3D points in an array ([x, y, z]):

var cube = [[-20,-20,5],[20,-20,5],[-20,20,5],[20,20,5],
[-20,-20,-5],[20,-20,-5],[-20,20,-5],[20,20,-5]];

Now that I can render a basic cube I'd like to try rendering something more complicated to make sure my math works well. It's there a standard 3D object file i can import and use or I have to manually specify the 3D positions of every vertex like I did with the cube?

sentences:
Can animation parameters only be changed in scripts? I have a very simple animation parameter in the Animator, a boolean that is "true" when a shooting animation is playing (to stop the game logic from allowing more shooting during a gun recoil animation). I assumed I'd be able to access this in animations, i.e. setting it to true when a shooting animation started, and false when it ended. But I just can't see how to access it in my animations. It's not available under "Add Curve". Am I missing something?

I can do this in other ways, but this just seemed like the cleanest.

sentences:
How to get the physics just right in a physics driven game I'm working on a physics driven game using a java port of Bullet (JBullet).

In our game we have a ball that can have collisions with the other objects, including the objects that define the boundaries of the playing area.

Since we consider collisions between the ball and other objects as a very important aspect of the gameplay we wish to handle those collisions in our own code. This allows us to get non-realistic but very controllable behavior for the ball.

The other gameobjects also collide with each other, but JBullet handles those collisions well and we have no issues there.

The problem is that we have great difficulty triggering the custom behavior in the correct way. In our first set-up called our custom collision handling code every time JBullet reported a collision for the ball. This caused undesired behavior as a single hit could trigger multiple reported collisions. Which caused the ball to be sort of glued to the wall.

Our "fix" for this was to have the ball keep a timer and to ignore subsequent collisions occurring within let say 0.1 second of another. However, this caused ball to bounce through walls in some cases, probably because the first reported collision isn't the one we expect, and the ball-wall collision occurring shortly after is sadly ignored.

So that brings me to my question. How does one sort this out without resorting to all sort of "fixes" that only make the problem more complicated and less predictable?

Would for instance placing the ball at the last known position before the collision and handling the collision from there work? But what if another object has moved to that position in the mean time.

Or maybe calculate future collisions with the ball for non-moving objects and enforcing them if they are missed by the physics?

Any feedback / thoughts / revelations would be greatly appreciated!

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:
Where to put rigidbody on a car model ? I have a GameObject car like this:

MyCar

Body with mesh collider
Wheel Left  with wheel collider
Wheel Right with wheel collider
...   and so on

Where I have to put rigidbody ?

Thanks

sentences:
What's a good data structure solution for a scene manager in XNA? I'm playing with XNA for a game project of myself, I had previous exposure to OpenGL and worked a bit with Ogre, so I'm trying to get the same concepts working on XNA.

Specifically I'm trying to add to XNA a scene manager to handle hierarchical transforms, frustum (maybe even occlusion) culling and transparency object sorting.

My plan was to build a tree scene manager to handle hierarchical transforms and lighting, and then use an Octree for frustum culling and object sorting. The problem is how to do geometry sorting to support transparencies correctly. I know that sorting is very expensive if done on a per-polygon basis, so expensive that it is not even managed by Ogre.
But still images from Ogre look right.

Any ideas on how to do it and which data structures to use and their capabilities? I know people around is using:

Octrees
Kd-trees (someone on GameDev forum said that these are far better than Octrees)
BSP (which should handle per-polygon ordering but are very expensive)
BVH (but just for frustum and occlusion culling)

Thank you

Tunnuz

sentences:
Game engine for turn based wargame I would like to ask for game engine recommendations for turn based wargame development. I would like my engine to support;

hex maps
agents on hex
rule based ai for the agents
terrain on hex
cultural features on hex
los analysis
abstract agent templetes

sentences: Accessing and changing texture data in SlimDX How can I access and change texture data in SlimDX?  I have a Texture2D and a Texture3D and I need to be able to go in and change either a single or group of pixels.

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:
What C++ GUI library can you suggest? I'm building my own game engine in C++ and I'm currently deciding on what user interface I should use.

Should I use a library? Should I make my own?

sentences:
Unity Player Movement Y Axis(Something like Swing Copters) My Player moves on Y AXIS , but sometimes it doesnt go up but stucks in one place, Script is like in swing copters , when you touch it rotates to another side but its on X Axis , i took and made it on Y axis , but it doesnt work properly , player sometimes doesnt turn around and go up or back Please help out , sorry for bad english

void MovePlayerOnYAxis()
    {

        foreach (Touch touch in Input.touches)
        {

            moveL = !moveL;

            if (moveL)
            {

                transform.localScale = new Vector3(1, -1, 1);
            }
            else
            {
                transform.localScale = new Vector3(1, 1, 1);
            }

            huongbay = transform.localScale.x;
        }
        transform.root.Translate(Vector3.up * speed * huongbay * Time.deltaTime);
    }

Pre-Fix From @PompeyPaul
But Player still doesnt go Down , it now goes only up.

void MovePlayerOnYAxis()
    {

        foreach (Touch touch in Input.touches)
        {

            WasTouched = !WasTouched;

            if (WasTouched)
            {
                if (Input.touchCount == 0)
                {
                    WasTouched = false;

                    transform.localScale = new Vector3(1, 1, 1);
                }
            }
            else
            {
                if (Input.touchCount > 0)
                {
                    WasTouched = true;
                    transform.localScale = new Vector3(1,-1, 1);
                }

            }
            huongbay = transform.localScale.y;

        }
        transform.root.Translate(Vector3.up * speed * huongbay * Time.deltaTime);
    }

sentences:
Why are examples of game textures often represented on a sphere model? I have recently started working with Unity and was looking for textures for the background (castle walls and such pieces) on a game that I am thinking about eventually building. I noticed that the textures are often represented as ball shaped, such as for example in this sample image here:

For example, why are the texture patterns not shown as simply flat squares? I guess there is a reason behind this that has to do with mapping to 3d surfaces but I was not sure so I wanted to check here.

Why are textures often represented in spherical shapes in examples and previews?

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

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

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

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

[self addChild:target];

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

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

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

-(void)gameLogic:(ccTime)dt {

[self addTarget];

}

-(id) init
{

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

// Enable touch events
self.isTouchEnabled = YES;

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

CGSize winSize = [[CCDirector sharedDirector] winSize];

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

}
return self;
}

- (void)update:(ccTime)dt {

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

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

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

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

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

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

}

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: Sprites With Vastly Disparate Scales So, I'm developing a 2D game where I'm dealing with sprites with vastly different scales. I'm attempting to represent the scales accurately, where I have a 10-m wingspan fighter and a 1400-m carrier that launches it. The trouble I'm running into, is if I draw the fighter out to be 100px wide, then the carrier needs to be 14,000 px. I believe the XNA game engine I'm running supports only up to 8096x8096 sizes, so I'm a little unsure what to do. Thank for your help, guys!

sentences:
How can I determine which direction a 2D collision is occurring from? The problem is as follows:

Think 2D Zelda (Links Awakening, A Link to the Past) style movement where you can run into walls from any of the four cardinal directions, or basically up, down, left, and right. The difference between my movement and these games is I want to allow for diagonal movement as well. When the player collides with a wall on the left, for example, if he is pushing left and up I want him to stop moving left but continue moving up. The problem I am having is my code currently detects the collision as both an upwards and a left collision so the player simply stops. What is the approach I should take to remedy this?

        bool canCollideLeft = false;
        bool canCollideRight = false;
        bool canCollideUp = false;
        bool canCollideDown = false;

        if (HeroRect.Left > OldHeroRect.Left)
        {
            canCollideLeft = false;
            canCollideRight = true;
        }

        if (HeroRect.Left < OldHeroRect.Left)
        {
            canCollideLeft = true;
            canCollideRight = false;
        }

        if (HeroRect.Bottom > OldHeroRect.Bottom)
        {
            canCollideUp = false;
            canCollideDown = true;
        }

        if (HeroRect.Bottom < OldHeroRect.Bottom)
        {
            canCollideUp = true;
            canCollideDown = false;
        }

        foreach (RectangleItemProperties rectangle in CollisionRectangles)
        {
            Rectangle CollisionRect = new Rectangle((int)rectangle.Position.X, (int)rectangle.Position.Y, (int)Math.Abs(rectangle.Width), (int)Math.Abs(rectangle.Height));

            if (HeroRect.Intersects(CollisionRect))
            {
                if (canCollideDown && HeroRect.Bottom >= CollisionRect.Top && HeroRect.Bottom <= CollisionRect.Bottom)
                {
                    hero.position.Y = OldHeroRect.Location.Y;
                }

                if (canCollideUp && HeroRect.Top >= CollisionRect.Top && HeroRect.Top <= CollisionRect.Bottom)
                {
                    hero.position.Y = OldHeroRect.Location.Y;
                }

                if (canCollideLeft && HeroRect.Left <= CollisionRect.Right && HeroRect.Left >= CollisionRect.Left)
                {
                    hero.position.X = OldHeroRect.Location.X ; ;
                }

                if (canCollideRight && HeroRect.Right >= CollisionRect.Left && HeroRect.Right <= CollisionRect.Right )
                {
                    hero.position.X = OldHeroRect.Location.X;
                }
            }
        }

In summary the code compares the old position with the new position to see which direction we have moved and checks for a potential collision there. So if we move up and to the left, canCollideLeft and canCollideUp will be true. I am pretty sure this is where my problem lies and I need to better check which direction I am colliding from.

Any thoughts or insight?

sentences:
Depth to World Space Position problem I am having a problem with turning depth to world space position.
I am using GLSL.
What could go wrong?
Here is the code:
float x = (uv.x * 2.0) - 1.0;
float y = (uv.y * 2.0) - 1.0;
float z = (depth * 2.0) - 1.0;

vec4 pos_clip = vec4(x, y, z 1.0);

vec4 inverse_pos_view = InvCamProjMatrix * pos_clip;
inverse_pos_view.xyz /= inverse_pos_view.w;

vec4 pos_ws = InvCamViewMatrix * inverse_pos_view;

return pos_ws.xyz;

Thanks.

sentences:
Unity2D: Sprite Mesh Lighting Issue I am trying to make my 2D mesh render sprites with the same brightness as the original file.

On the below picture, the mesh on the left is darker than the UI Image on the right, which is an exact likeness of the original file. How can I make the mesh as bright as the Image?

So far, I've been looking into the following potential culprits:

Shader attached to the Mesh
Global lighting settings
Mesh renderer lighting settings

The above image is with Environment Lighting > Ambient Color at #FFFFFF.

Environment Lighting > Ambient Color > Intensity doesn't help.
Increasing the shader's emissions can offset the darkness but it's not an ideal solution.

All other lighting settings both globally and on the Mesh Renderer are default.

At this point, I'm lost :/
Any help would be much appreciated!

sentences:
In 2d, how do I discern when a character is on top of an object, from when it is on the side? I am building an auto-run platforming game. I have code so that if the character collides with a wall, they are pushed back until they are able to get past the wall. Unfortunately, this means that when the character tries to jump on an object, he just gets pushed backward.

How do I discern when a character is on top of an object, from when it is on the side?

My Current Algorithm (c-ish because i like c-ish syntax):

if(  wall.Top  < (character.Top + character.Height)
 &&  wall.Left < (character.Left + character.Width)
 && (wall.Top  + wall.Height) > character.Top
 && (wall.Left + wall.Width ) > character.Left)
{
  #code here#
}

sentences:
OpenGL ES indices optimization I am using OpenGL ES 1.x/2.x

I have 2 attributes to be passed to the GPU(one is colors, one is vertices, one color per vertex).

I use indices. Both attributes will use the same indices array

This is not a big issue but I was wondering if there is a way to tell the GPU that both attributes use the same indices array so that it is not transfered to the gpu twice, or maybe it does not matter because the GPU uses the RAM?

sentences:
SDL 2.0 setup on code::blocks using gcc(MinGW) on win7 I have recently installed code::blocks on my system running windows 7 home premium 64-bit, and wanted to start learning SDL. The code::blocks executable is the one installed by the "codeblocks-12.11mingw-setup.exe"- setup wizard, which also installs gcc and MinGW as implied by the name. I proceeded to download the precompiled version of SDL 2.0 development files "SDL2-devel-2.0.0-mingw.tar.gz" from the SDL site, created a new empty project, pointed the compiler to the /include directory and the linker to the /lib directory of the 32-bit version of SDL 2.0 using the project specific search directories and set the IDE to treat the project as a GUI application instead of a console application.
However, trying to build the project always results to a build error of the form:

`SDL_main':
undefined reference to `SDL_Init'
undefined reference to `SDL_Quit'
undefined reference to `WinMain@16'
=== Build finished: 3 errors, 0 warnings (0 minutes, 0 seconds) ===

Which is understandable since I have not specified any linker flags, but adding the flags -lmingw32 -lSDLmain -lSDL to "other linker options" in the IDE results in the error:

ld.exe  cannot find -lSDLmain
ld.exe  cannot find -lSDL
=== Build finished: 2 errors, 0 warnings (0 minutes, 0 seconds) ===

Implying it did indeed recognize the flag -lmingw32.
I tried to copy the appropriate SDL dev files directly to MinGW/include and MinGW/lib, and placed the runtime DLL in the project directory to no avail. Do I have the wrong linker options for SDL 2.0, are they in the wrong order, or am I missing something else?

EDIT: checking all the involved files revealed that libSDLmain.a has been replaced by libSDL2main.a etc. in SDL 2.0. After replacing the linker options with -lmingw32 -lSDL2main -lSDL2 the linker stopped complaining about not finding missing statically linked libraries. However it now again fails to find the definition of the various SDL routines called in the program, giving the same output as stated in the first case (undefined reference to X).

EDIT2: Just found out i'm not alone with this problem, there is an old, unanswered question about the exact same problem on stackoverflow: https://stackoverflow.com/questions/17011028/i-can-compile-with-sdl1-2-but-not-with-sdl2-cb

Source code:

#include <SDL2/SDL.h>

int main(int argc, char* argv[])
{
  SDL_Init(SDL_INIT_EVERYTHING);
  SDL_Quit();
  return 0;
}

Build log from building the project after adding the aforementioned linker options and SDL files directly in MinGW's /include and /lib directiories and removing the search directories from the project's options:

-------------- Build: Debug in newProject(compiler: GNU GCC Compiler)---------------

mingw32-g++.exe  -o bin\Debug\newProject.exe obj\Debug\newProject\newProject\main.o   -lmingw32 -lSDLmain -lSDL   -mwindows
c:/program files (x86)/codeblocks/mingw/bin/../lib/gcc/mingw32/4.7.1/../../../../mingw32/bin/ld.exe: cannot find -lSDLmain
c:/program files (x86)/codeblocks/mingw/bin/../lib/gcc/mingw32/4.7.1/../../../../mingw32/bin/ld.exe: cannot find -lSDL
collect2.exe: error: ld returned 1 exit status
Process terminated with status 1 (0 minutes, 0 seconds)
2 errors, 0 warnings (0 minutes, 0 seconds)

sentences:
Software Design or Advanced Computer Graphics for Game Dev Wannabe So, I've been a programmer for 3 years and am finishing up my first graduate semester. I want to get into independent software( mostly mobile ) development with a interest in game development.

The university I go to does research in software development but not computer graphics, but they do offer  courses in computer graphics and advanced computer graphics. I took the first computer graphics class this semester.

We used very little OpenGL. We have had 4 main projects where we have implemented the algorithms behind anti-aliasing, clipping, polygon filling, implementing our own transformations( replacing glRotate/Scale/Translate ), and phong lighting equation. From talking to a friend, he says it sounds like a good course.

I have a choice to make next semester, take software design or advanced computer graphics. I've talked to the professor teaching the advanced computer graphics class and he says we are going to be implementing the algorithms our selfs again, but it is focused on more ray-tracing type algorithms. I'm not sure how this class could help me in the realm of game development.

Now, the software design class I feel I could really use. I only took one class on software engineering in my undergrad and I have the possibility to do research in software engineering if choose to. I have found my self when working on my own iPhone apps in the past of hating some of the code I wrote. I did some design but just to get things going. I know that I need to do better at software design if I'm going to be a successful software developer.

So, I know I need both but I guess what would be more useful taking at a university? Which ever one I don't take I probably will try to teach myself in my own time. I'm kind of leaning towards Software Design just so I can see how it's really suppose to be done. Where as the advanced computer graphics algorithms aren't subjective in any way and just need to be implemented.

FYI: I won't be able to take the other class in the future as both of these classes are only offered once every 2-3 years.

Description on each class

Advanced Graphics:
Realistic, three-dimensional image generation;modeling techniques for complex three-dimensional scences; advanced illumination techniques;fractual surface modeling; modeling and rendering of natural phenomena.

Software Design:
Software design principles, attributes, models, and methodologies; object-oriented designs; real-time system design;user interface design;design verification; reusability issues;tools;current issues.

sentences:
Touch taps only on very short flicks on Win7 with Monogame I have an application on win7 which needs to support touch and mouse input using monogame. But reading touch taps proves to be a very hard thing.

The TouchPanel is initialized like this:

TouchPanel.EnableMouseTouchPoint = true;
TouchPanel.EnabledGestures = GestureType.Tap | GestureType.DoubleTap | GestureType.Hold | GestureType.Pinch |
                             GestureType.FreeDrag | GestureType.DragComplete | GestureType.Flick | GestureType.HorizontalDrag |
                             GestureType.VerticalDrag;
TouchPanel.EnableMouseGestures = true;

Without EnableMouseTouchPoint and EnableMouseGestures there is no reaction from the touchscreen. Enabling both will at least get me touch locations and gestures on drag moves (this already makes me think that there is something essential missing here).

I have the following code to read input which is called on every Update:

private void GetInput(GameTime gameTime)
    {
        var gesture = default(GestureSample);
        MouseState mouseState = Mouse.GetState();

        TouchCollection touchCol = TouchPanel.GetState();
        foreach (var touch in touchCol)
        {
            Console.WriteLine(touch.Position);
        }

        while (TouchPanel.IsGestureAvailable)
        {
            gesture = TouchPanel.ReadGesture();
            Console.WriteLine(gesture.GestureType);
            if (gesture.GestureType == GestureType.Tap)
            {
                DoHitTest(mouseState.X, mouseState.Y);
            }
        }
     }

The touch collection will remain empty until the finger is dragged across the screen. Taps are not showing up. To get an actual tap i have to do a very short flick. In this case, there is a touch in the touch collection.

What am i missing? Am i doing something fundamentally wrong here?

sentences:
Are there games with player programmable vehicle control behaviour? My question

Are there any (space/flying/driving) games where the player can customize the mapping between player controls and the input to the vehicle actuators/engines programmatically? (Yes or no.)

                 ----------------                      ---------------
Player input -> | Control system | --Vehicle input--> | Vehicle model | -+-> Vehicle motion
                 ----------------                      ---------------   |
                        ^                                                |
                        |                                                |
                        +------------Feedback (optionally)---------------+

Basically games where the control system in the diagram above is replaceable by custom code.

Edit:

Just found out that Star Citizen plans to implement this to some extent. But my question is if there are any such games today?  (Yes or no.)

Why I'm asking

I'm curious to see what would happen if a game only imposed physical models of vehicles and let players choose how to adjust controls. I've been thinking about this on and off for some time, but never found it implemented.

For example, in spaceflight games the default could be a mode where say the roll is automatically stabilized, players could then modify this code to instead take full control over the thrusters, or just tune the aggressiveness of the stabilization down a notch. Since all ships have the same capabilities, this would allow a kind of individual modding posing no fairness problems in multiplayer.

I imagine some hardcore players would really like this, and it could be cool if players started sharing/trading settings to tune their ships. Maybe even making it possible to trade control systems as in-game items.

If sufficient signals where exposed through an external interface, it would even be possible to write complete autopilots in your language of choice. I would love to teach automatic control using a game. :)

sentences: What's the difference between mesh and a model? Which one is created first? For example if a team worked on a graphical asset of a car, what would be a model and what would be a mesh of the car?

sentences:
Can i release a game in steam with free assets? I'm making a game with unity, and i'm planing release the game in steam as FREE. I'm using free assets from unity asset store, and also i'm using free assets models from another sites. I always see if the 3d models are free. I'm no using models like Batman, that have rights from DC. But for example i use a model of door or a stair.

My question is, can i publish my game in steam, or another place, without care about someone someone processing me because i use his 3d models, that is free?

sentences:
WoW lua: Getting quest attributes before the QUEST_DETAIL event I'd like to determine the attributes of a quest (i.e.,  information provided by functions such as QuestIsDaily and IsQuestCompletable) before the player clicks on the quest detail.

I'm trying to write an add-on that handles accepting and completing of daily quests with a single click on the NPC, but I'm running into a problem whereby I can't find out anything about a given quest unless the quest text is currently being displayed, defeating the purpose of the add-on. Other add-ons of this nature seem to be getting around this limitation by hard-coding information about quests, an approach I don't much like as it requires constant maintenance.

It seems to me that this information must be available somehow, as the game itself can properly figure out which icon to display over the head of the NPC without player interaction. The only question is, are add-on authors allowed access to this information? If so, how?

EDIT: What I originally left out was that the situations I'm trying to address are when:

An NPC has multiple quests
The quest detail is not the first thing that shows up upon right-click

Otherwise, the situation is much simpler, as I have the information I need provided immediately.

sentences:
FXAA Shader turns image upside-down I'm trying to use an existing FXAA shader for anti-aliasing, which works, but when I try to run it, the filtered image is upside-down (vertically flipped)

[Vertex_Shader]
varying vec4 posPos;
uniform float FXAA_SUBPIX_SHIFT = 1.0/4.0;
uniform float rt_w; // GeeXLab built-in
uniform float rt_h; // GeeXLab built-in

void main(void)
{
  gl_Position = ftransform();
  gl_TexCoord[0] = gl_MultiTexCoord0;
  vec2 rcpFrame = vec2(1.0/rt_w, 1.0/rt_h);
  posPos.xy = gl_MultiTexCoord0.xy;
  posPos.zw = gl_MultiTexCoord0.xy -
                  (rcpFrame * (0.5 + FXAA_SUBPIX_SHIFT));
}

[Pixel_Shader]
#version 120
uniform sampler2D tex0; // 0
uniform float vx_offset;
uniform float rt_w; // GeeXLab built-in
uniform float rt_h; // GeeXLab built-in
uniform float FXAA_SPAN_MAX = 8.0;
uniform float FXAA_REDUCE_MUL = 1.0/8.0;
varying vec4 posPos;

#define FxaaInt2 ivec2
#define FxaaFloat2 vec2
#define FxaaTexLod0(t, p) texture2DLod(t, p, 0.0)
#define FxaaTexOff(t, p, o, r) texture2DLodOffset(t, p, 0.0, o)

vec3 FxaaPixelShader(
  vec4 posPos, // Output of FxaaVertexShader interpolated across screen.
  sampler2D tex, // Input texture.
  vec2 rcpFrame) // Constant {1.0/frameWidth, 1.0/frameHeight}.
{
/*---------------------------------------------------------*/
    #define FXAA_REDUCE_MIN   (1.0/128.0)
    //#define FXAA_REDUCE_MUL   (1.0/8.0)
    //#define FXAA_SPAN_MAX     8.0
/*---------------------------------------------------------*/
    vec3 rgbNW = FxaaTexLod0(tex, posPos.zw).xyz;
    vec3 rgbNE = FxaaTexOff(tex, posPos.zw, FxaaInt2(1,0), rcpFrame.xy).xyz;
    vec3 rgbSW = FxaaTexOff(tex, posPos.zw, FxaaInt2(0,1), rcpFrame.xy).xyz;
    vec3 rgbSE = FxaaTexOff(tex, posPos.zw, FxaaInt2(1,1), rcpFrame.xy).xyz;
    vec3 rgbM  = FxaaTexLod0(tex, posPos.xy).xyz;
/*---------------------------------------------------------*/
    vec3 luma = vec3(0.299, 0.587, 0.114);
    float lumaNW = dot(rgbNW, luma);
    float lumaNE = dot(rgbNE, luma);
    float lumaSW = dot(rgbSW, luma);
    float lumaSE = dot(rgbSE, luma);
    float lumaM  = dot(rgbM,  luma);
/*---------------------------------------------------------*/
    float lumaMin = min(lumaM, min(min(lumaNW, lumaNE), min(lumaSW, lumaSE)));
    float lumaMax = max(lumaM, max(max(lumaNW, lumaNE), max(lumaSW, lumaSE)));
/*---------------------------------------------------------*/
    vec2 dir;
    dir.x = -((lumaNW + lumaNE) - (lumaSW + lumaSE));
    dir.y =  ((lumaNW + lumaSW) - (lumaNE + lumaSE));
/*---------------------------------------------------------*/
    float dirReduce = max(
        (lumaNW + lumaNE + lumaSW + lumaSE) * (0.25 * FXAA_REDUCE_MUL),
        FXAA_REDUCE_MIN);
    float rcpDirMin = 1.0/(min(abs(dir.x), abs(dir.y)) + dirReduce);
    dir = min(FxaaFloat2( FXAA_SPAN_MAX,  FXAA_SPAN_MAX),
          max(FxaaFloat2(-FXAA_SPAN_MAX, -FXAA_SPAN_MAX),
          dir * rcpDirMin)) * rcpFrame.xy;
/*--------------------------------------------------------*/
    vec3 rgbA = (1.0/2.0) * (
        FxaaTexLod0(tex, posPos.xy + dir * (1.0/3.0 - 0.5)).xyz +
        FxaaTexLod0(tex, posPos.xy + dir * (2.0/3.0 - 0.5)).xyz);
    vec3 rgbB = rgbA * (1.0/2.0) + (1.0/4.0) * (
        FxaaTexLod0(tex, posPos.xy + dir * (0.0/3.0 - 0.5)).xyz +
        FxaaTexLod0(tex, posPos.xy + dir * (3.0/3.0 - 0.5)).xyz);
    float lumaB = dot(rgbB, luma);
    if((lumaB < lumaMin) || (lumaB > lumaMax)) return rgbA;
    return rgbB; }

vec4 PostFX(sampler2D tex, vec2 uv, float time)
{
  vec4 c = vec4(0.0);
  vec2 rcpFrame = vec2(1.0/rt_w, 1.0/rt_h);
  c.rgb = FxaaPixelShader(posPos, tex, rcpFrame);
  //c.rgb = 1.0 - texture2D(tex, posPos.xy).rgb;
  c.a = 1.0;
  return c;
}

void main()
{
  vec2 uv = gl_TexCoord[0].st;
  gl_FragColor = PostFX(tex0, uv, 0.0);
}

I'm still new to shaders - how can I modify this shader so the filtered image is displayed the correct way up?

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:
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:
Multiplying matrices in HLSL I have code that calculates a position like this in HLSL:

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

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

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

Yet this doesn't work, why?

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:
Inventory implementation in Java RPG In my game (simple RPG with Java) there will be an abstract class Creature.

Critter, Beast, Vampire... will inherit from Creature. But not ALL classes that inherit from Creature will have an inventory.

Should I

a) make another abstract class such as CreatureWithInventory and inherit from it?

or

b) make an interface such as Inventory and make stuff as (Vampire implements Inventory)?

Is there a reason to prefer one over the other? Any considerable trade-offs?

Should Inventory itself be a class and let some Creatures have a field for it? If so, how would I test if Creature foo has Inventory? Is that even possible?

sentences:
Send info about gun shots via UDP I am writing a small multiplayer game in C++. But I am confused about how to send info about gun shots to achieve best performance. I am thinking of different ways to do that:
Let's say we have a gun that can shoot 10 times per second (when left mouse button is held).

When user presses LMB game sends TCP packet telling that shooting has started.
When user releases LMB game send TCP packet telling that shooting has stopped.
When LMB is held game send UDP packet every (1/10) sec telling about one shot.
When LMB is held game send TCP packet every (1/10) sec telling about one shot.

I think that the last one is the best because it allows to check hits on the server side, not on the client side (cause this way it can be easily hacked). But I am not sure if TCP can handle 10 packets per second. What do you suggest?

sentences: Finding physical gamejams I'm interested in participating in some gamejams and was hoping to be able to attend one in person. Is there a way I could search for gamejams in the general Dallas area?

sentences: Where to start, to develop an online Backgammon game? I would like to develop a backgammon game to play against other players online, as a way of learning more Javascript/jQuery and a little game development. I'm a web developer and most of my experience is in PHP. I have minimal Javascript experience and no game development experience. Where should I start? Are there any particular books, tutorials, libraries, or frameworks that would help give me a jumpstart? As a beginner, am I better of using the DOM or Canvas?

sentences: Character is out of location after animation montage in UE4 so I have my running and idle animation working fine on my character but once I do the attack animation thru an animation montage, my character slowly floats off the ground and as I attack many times it floats more and more and sometimes starts to lean and when I run and Idle it stays on air .. attached link to video — https://www.facebook.com/groups/467991570685914/permalink/940206510131082/

sentences:
Jagged Edges Even With Anti Aliasing 8x Multi Sampling I have an interior scene where I have imported a model for the apartment and many of the interior objects such as lamps, windows, etc. Unfortunately I have a lot of jagged edges on almost all the objects in my scene even on Fantastic Quality settings with Anti Aliasing pushed to its maximum. What else can I do to reduce the jaggies seen here:

Here are my quality settings:

And here are my model import settings:

sentences: How can I record gameplay footage as a video within Unity? I am building a traffic simulator in Unity. I need to record my game as a video, so that I can use the video for machine learning purposes. I used fraps for the same but didn't find it worked for me since it's not within Unity. How can I make a video recording of the gameplay?

sentences:
Gameserver Request handling EDIT: I forgot to mention that in this implementation E stands for Entity which is just an ID, C => Component as data-only types and S for Systems which should implement logic

Currently i'm working on a small hobby project which is a multiplayer card game with a client/server architecture. I'm using a framework for the network part which triggers message events to services objects like this:

class AuthRequestMessage : public fqpnet::IMessage
{
public:
  //methods for serialization

  inline const std::string& getLoginId() const
  { return loginId_; }

  inline const std::string& getPassword() const
  { return loginId_; }

private:
  std::string loginId_;
  std::string password_;
};

//Handles authentication
class GatewayService : public fqpnet::Service
{
public:
  //registers handlers
  GatewayService()

private:
  void onAuthRequestMessage(const AuthRequestMessage* msg, ClientSession* session);
};

and now i'm at the point where i have to create the player entity. My first thought was to create the player entity directly in the message handler. But it feels like this code should be in a system so i created a system and added a method:

class PlayerSystem : public entityx::System<PlayerSystem>
{
public:
//Entity createPlayer(/*info needed...*/);

//update etc
};

But this feels rather bad too as the method is only used once in the handler.
My third attempt was to use the builtin messaging system of the ECS:

struct PlayerAuthRequest
{
//id etc
};

class PlayerSystem : public entityx::System<PlayerSystem>
{
public:
void receive(const PlayerAuthRequest& request);

};

//and now just emit the event in the message handler
void GatewayService::onAuthRequestMessage(const AuthRequestMessage* msg,
ClientSession* session)
{
  //verify, load from db etc.
  eventMgr->emit<PlayerAuthRequest>(/*data*/);
}

Which of these approaches would be the best? Or are there alternative ones? Basicly i just want to do it in the right way to learn. Performance does not really matter to me.

sentences:
How to use a .cube LUT file with Color Lookup? I have used "Image 2 LUT" to create a LUT for Unity from a certain movie.
However, currently "Image 2 LUT" only outputs ".cube" files.
For HDRP, this is great, but for some reason, URP doesn't accept .cube file.
URP expects specially laid out .png LUT file.
Is there any way to convert a .cube LUT file to a PNG that I can put into the slot of Color Lookup-> Lookup Texture with URP?
Unity expect this format:

The tutorial that Google finds and recommends is this.
However, I don't have Photoshop. Also, the tutorial deals with a square LUT that looks like this:

So even if I had Photoshop and I would follow the tutorial, I would still have a square LUT which is not laid out as Unity would expect it, so I did not use that tutorial.
How do I create a LUT png from a .cube file that I can use with URP?
Thank you.

sentences:
Ideal way to instantiate abilities in a class give a dynamic list of abilities to use? I have a PlayerClass class that is used to set my Player's class. For instance, this will make him a warrior:

 PlayerClass warrior = new WarriorClass();

WarriorClass will instantiate abilities like so:

 Ability ability1 = new LeapAbility();

Now my problem is that I will eventually dynamically update my Warrior's abilities (think talent trees or perks).

So say I give warrior a list of abilities to use. How do I do this in code? Right now I need to know the Abilities before hand and hard code their instantiation in.

Put another way, how do I instantiate a dynamic list of objects? I'm open to other solutions too if this doesn't make sense or is impossible.

sentences:
LibGDX Android Textures reload other textures, and transparent images get black backgrounds [Pictures] I have very strange problems with my LibGDX Game in Android - The problem is that sometimes the textures get black backgrounds when they should be transparent, and sometimes when I remove the texture, or press the back button, the textures get replaced with other textures that I have.

To clarify:
I'm using x texture to show the status of health. I'm using three x textures to show how many lives the player got, and when I lose health, and remove one texture, the x texture get replaced with y or z texture, or the remaining x textures get black backgrounds. Sometimes it works flawlessly, and the x texture gets removed, and the backgrounds are still transparent.

I'm loading my textures via an AssetManager, and just load them on create().

In my render I use this:

    Gdx.gl.glClearColor(1, 1, 1, 1);
    Gdx.gl.glClear(GL20.GL_COLOR_BUFFER_BIT);
    Gdx.gl.glBlendFunc(GL20.GL_SRC_ALPHA, GL20.GL_ONE_MINUS_SRC_ALPHA);
    batch.enableBlending();

                  batch.begin();
                   for (Entity life : LifeEntities) {

                        life.render(batch);
                    }
                  batch.end();

I'm also using this in my Launcher Class.

 AndroidApplicationConfiguration cfg = new AndroidApplicationConfiguration();
 cfg.r = cfg.g = cfg.b = cfg.a = 8;

 MainGame myGame = new MainGame(arrayName);
 initialize(myGame, cfg);

I do dispose the textures also. I have looked up on google and on gamedev about this problem, but all the questions are for problems when the transparent always have black background, not when it is something that happens like a bug.

Any suggestions on where the problem could be? Thanks a lot, if you need more code, please let me know.

Pictures of the problem:

sentences:
Why is my Slick2D spritesheet animation cut off when it loops? I am loading a SpriteSheet with Slick2D and using the Animation function in the render method to display it.
The spritesheet loads perfectly, but when the animation loops, it does so moved down a few pixels and cut in half.

It should always look like this:

But instead does this:

Here's my code. It's smalle because it's only a test.

package finalProject;

import org.newdawn.slick.*;
import org.newdawn.slick.state.*;

public class Dialogue extends BasicGameState {

    private SpriteSheet SSTommy;
    private Animation ATommy;
    Music playMusic;

    public void enter(GameContainer gc, StateBasedGame sbg) throws SlickException {
        playMusic = new Music("C:/OOP Resources/Bill Blaster.ogg");
        playMusic.play();
        playMusic.loop();
    }

    public Dialogue(int state) {
    }

    public void init(GameContainer gc, StateBasedGame sbg) throws SlickException {
        SSTommy = new SpriteSheet("C:/Users/Usuario/Documents/Etc/Tommy_SS.png", 41, 87);
        ATommy = new Animation(SSTommy, 150);
        ATommy.setPingPong(true);
    }

    public void render(GameContainer gc, StateBasedGame sbg, Graphics g) throws SlickException {
        g.drawString("This is the Play State", 100, 100);
        ATommy.draw(200, 200);
    }

    public void update(GameContainer gc, StateBasedGame sbg, int delta) throws SlickException {
        ATommy.update(delta);
    }

    public void leave(GameContainer gc, StateBasedGame sbg) {
        playMusic.stop();
    }

    public int getID() {
        return 1;
    }
}

I tried other SpriteSheets but it keeps doing the same. I think this is releated to the render method, but I don't know what's doing it.

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:
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:
How do I get an attribute of a function? function randArray(arrayName) {
    arln = arrayName.length;
    arst = arrayName[Math.floor(Math.random() * arln)];
    return arst;

}

    create: function(){
        //starts physics engine
        game.physics.startSystem(Phaser.Physics.ARCADE);
        player = game.add.sprite(width/2, height/2, 'player');
        randSpawnItem = game.add.sprite(10, 10, randArray(randItem));
        randSpawnItem2 = game.add.sprite(50, 50, randArray(randItem));

So the randArray function works, and there is nothing wrong with the create. I'm using Phaser, and I'm trying to spawn items randomly (kind of like in Binding of Issac.) I forsee a problem in the future, when I'm detecting for collison, I need to know what item spawned to give the right kind of item to the player. How would I get that third attribute of randSpawnItem or randSpawnItem2, or is there another way to go at this completely? Sorry if that's a noobie question! Didn't know how to word it and didn't find it anywhere else. Thanks in advance for your time.

sentences:
Direct3D - ways to retrieve world position from depth buffer without matrix information For an existing game (VBS3) I'd like to write a plugin which exports all the rendered pixels with their world position (basically something like a LIDAR point cloud).

Actually I don't need the position of each pixel, instead I could also use the application's internal collision checking system with equally spaced ray endpoints, but it turned out that this approach is way too slow and coarse.

The game provides a callback which gets called whenever the back buffer has been filled. Then this callback provides references to a depth buffer and a render target, both of type IDirect3DSurface9.

As a first shot I just wanted to do it like Andon M. Coleman described in [1] but my problem is that the IDirect3DDevice9 linked to the surfaces only returns identity matrices when I call GetTransform() on it with types D3DTS_PROJECTION and D3DTS_VIEW.

Therefore I suppose the application does not use those matrices at all and instead does all the matrix / projection stuff internally. Am I right? Is this common? And are there other approaches I could take?

Thanks in advance!

[1] https://stackoverflow.com/questions/32227283/getting-world-position-from-depth-buffer-value

sentences:
Inventory Grid Detection I'm working on creating an inventory system for a game. The inventory system will use cells and 2D images to represent items, like Minecraft, Diablo, or WoW. I've hit a bit of a snag when trying to let the player place items in the bag (click and drag style).

So far, I've successfully created the inventory grid, which is really smoke and mirrors:

public class InventoryMenu {
boolean objectSelected = false;
Item selectedItem;

public final int COLUMNS = 5;
public final int ROWS = 7;

ArrayList<Item> inv = new ArrayList<Item>((ROWS + 1) * COLUMNS);
Sprite slot;

public void render(Graphics g) {

    for (int i = 0; i < 40; i++) {
        int col = i % COLUMNS;
        int row = ROWS - i / COLUMNS;

        slot.draw(g, (Camera.width - slot.getWidth() * COLUMNS) + slot.getWidth()* col, row * slot.getHeight());

        if (inv.get(i) != null) {
            inv.get(i).render(g);
        }
    }
    if (selectedItem != null) {
        selectedItem.render(g);
    }
}

Basically, I have an arraylist that can hold items, and it just draws the "slot" image 40 times and if there's an item in that "slot" it draws the item image too. Cool? Cool. The problem comes if I want to allow the player to select an item in their inventory and move it to a different slot. I have no problem letting them pick it up (I use a pretty primitive brute force, but with any reasonably sized inventory, it works):

private Item grabItem(Point2D mouse) {
    for (Item i : inv) {
        if (i != null) {
            if (i.getPhysicsShape().contains(mouse)) {
                Item pick = i;
                selectedItem = pick;
                objectSelected = true;
                i = null;
                return pick;
            }
        }
    }
    return null;
}

That bit of code lets a player pick up an item, but placing it fails - it rarely gets the right slot, except if its the bottom row (0-4):

setDown(){
    int slotLoc = calcSlot(InputHandler.mouseCoords);
    placeItem(slotLoc);
}

private void placeItem(int loc) {
    if(loc < 0 || loc > ROWS * (COLUMNS + 1))
        return;

    int col = loc % COLUMNS;
    int row = ROWS - loc / COLUMNS;
    selectedItem.pickUp((Camera.width - slot.getWidth() * COLUMNS) + slot.getWidth() * col, row * slot.getHeight());

    inv.set(loc, selectedItem);
    selectedItem = null;
    objectSelected = false;
}

private int calcSlot(Point2D mouse){
    int colPos = (int) (COLUMNS - (Camera.width - mouse.getX()) / slot.getWidth());
    int rowPos = (int) (ROWS+1 - (mouse.getY()) / slot.getHeight());

    if (colPos > COLUMNS || colPos < 0 || rowPos < 0 || rowPos > ROWS + 1) {
        dropItem();
        return -1;
    } else {
        return colPos + 4*rowPos;
    }

}

I'm fairly confident that the problem is in calcSlot, but I can't seem to find where. Any help would be greatly appreciated, I'm sure it's something silly.

Images!!

So, I can pick up an item with no problem, and it automatically places it in the last slot. So far, everything is gold.

I can then click that image and lift it out of the grid, and it follows my mouse (mouse is hidden by PrntScrn, but its at the top left corner of the image:

When I try to place the item by clicking in the middle of slot 33, however, it derps and places it, inexplicably, in slot 27.

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:
Chess Artificial intelligence with python and pygame I created chess game with python and pygame. Now I'm trying to make Artificial intelligence, but what is actually best way to do it? Some tips, tricks, links?
Thanks

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:
Floor is moving faster than ball above it , and it causes ball to fall off the map. UE4 I am creating a game ( following Udemy lesson on Marble run) which is basically a maze and ball and we move ball my rotating floor on x or y axis through obstacles .
Floor movement is linked on Mouse values.
BP

My problem is if I move my mouse too fast ball comes below floor and drops.
I know there could be multiple hacks to solve this . but I am looking for best solution ( professional solution) I am a newbie so please bear with me :)
Below is screenshot of ball below maze

sentences:
Rotating RigidBody2Ds in Godot I am practising programming games with the Godot Engine and I've been having some issues with RigidBody2Ds.

In this case I have a RigidBody2D as a child of a Node2D. The Node2D is rotating and the RigidBody2D with it. However, as soon as I use apply_impulse() it just returns to it's initial rotation point, which is zero.

Does anyone know what's going on here?

sentences: Problems managing collision filtering I have my character fixture and body(is a tank), so when I press the screen it throws a rocket(which also has a body and a fixture) that the player can controlll touching the screen. My game also has coins, which are dropped from boxes, when I destroy them, I don't want the rocket to collide with the tank, because the player can guide it anywhere(even to the tank), and it only get destroyed when touching an enemy. The problem here is that the rocket can touch a coin and move it, but it wouldn not happen. I've read that this can be solved using collision filtering, but I didn't understand very much this concept. I want the tank to collide with the coins, but not with the rocket, which should not collide with the coins.

sentences:
Smoothness texture map in unity I shall submit a 3d asset to the Unity asset store. Their submission guidelines say,"... must include at least an albedo,normal,metallic (or specular) and smoothness texture map."

My query is how do I get the smoothness map and where do I put it ?
There is just one slot by the smoothness slider where I put the metallic map.
Is it really necessary to put a smoothness texture map if I already have a metallic map attached to the material?

It's my first attempt to submit an asset to the asset store.

sentences:
Swapping Y and Z in quaternion I am converting between coordinate systems where Z is the vertical axis in one, and Y in another. I have the rotation values represented as a quaternion.

I see this related issue but it's switching the handedness (DirectX and OpenGL): Switch axes and handedness of a quaternion?

How would I go about swapping these values? I'd prefer not to convert to a vector3, modify and convert back again.

sentences:
Terrain detection on racing game Hi I don't speak English very well so ill try to do my best :P

I'm doing my first top-down racing game for LibGDX, now I need to create tracks, the tracks aren't very large, I prefer doing this with a set of tiles with different types of curves, because I want to do a level editor.
So I need to check whether the car is on the track or not. I thought that these alternatives are good but I need help by choosing the best one

An big array. Doing an array of tiles, saving whether in that position there is a track, looks very memory consupting
A set of polygons. And then checking if the car is inside them. Looks very CPU consupting
An Black-White image of the track. I've seen a recomendation here about that, but looks similar to an array

Do you know another way to do this?

sentences: Export session variables easily and permanently in php I feel like I must be missing something simple, or misunderstanding sessions or cookies. I want to save all session variables and allow players to copy/paste a long string to load the game up from a different computer or give to someone else, much like in Cookie Clicker or Adventure Capitalist etc. There is no need for sql, or for any kind of security; people can "cheat" if they want to.

sentences:
Passing a unique Uniform buffer with each model I have been following "Vulkan Tuturial" on GitHub as a reference on how to get basic objects rendering. In their tutorial, they create the command buffers at the start of the application after they have created a objects vertex and index buffers, then define that they want to draw it. Then one per frame they submit the command. That part I'm fine with.

I have been attempting to make it so I can send draw commands during the rendering loop, rather than just define one object that should be rendered and call that command every frame, the reason is so I can send custom uniform buffers with each command, to draw them in different locations on the screen.

Unfortunately, when I try and pass a diffrent uniform buffer for each draw call, only the last uniform buffer is applied.

Render loop

while (engine.Running())
{
    engine.PreRender();

    engine.BindMesh(mesh);
    engine.UpdateUniformBuffer(0.0f);
    engine.Draw();
    engine.UpdateUniformBuffer(90.0f);
    engine.Draw();

    engine.PostRender();
}

UpdateUniformBuffer

void Engine::UpdateUniformBuffer(float rot)
{
    static auto startTime = std::chrono::high_resolution_clock::now();

    auto currentTime = std::chrono::high_resolution_clock::now();
    float time = std::chrono::duration_cast<std::chrono::milliseconds>(currentTime - startTime).count() / 1000.0f;

    UniformBufferObject ubo = {};
    ubo.model = glm::rotate(glm::mat4(), rot, glm::vec3(0.0f, 0.0f, 1.0f));
    ubo.view = glm::lookAt(glm::vec3(2.0f, 2.0f, 2.0f), glm::vec3(0.0f, 0.0f, 0.0f), glm::vec3(0.0f, 0.0f, 1.0f));
    ubo.proj = glm::perspective(glm::radians(45.0f), window.swap_chain_extent.width / (float)window.swap_chain_extent.height, 0.1f, 10.0f);
    // Since GLM was made for OpenGL we need to flip the frame
    ubo.proj[1][1] *= -1;

    void* data;
    vkMapMemory(vulkan.device, vulkan.uniform_buffer.buffer_memory, 0, sizeof(ubo), 0, &data);
    memcpy(data, &ubo, sizeof(ubo));
    vkUnmapMemory(vulkan.device, vulkan.uniform_buffer.buffer_memory);
}

Draw function

vkCmdDrawIndexed(
        vulkan.command_buffers[i],
        static_cast<uint32_t>(indices.size()),
        1,
        0,
        0,
        0
    );

sentences:
WebGL - send part of texture to GPU I have a matrix of pixels in RAM memory, e.g. 1000x1000 pixels. I send it to GPU using

gl.texImage2D(gl.TEXTURE_2D, 0, gl.RGBA, 1000,1000, 0, gl.RGBA, gl.UNSIGNED_BYTE, pixels);

Which works great. But then I change some pixels, located in rectangle x=50, y=50, width =100, height=100. Sending the whole 1000x1000px picture again takes too much time, I would like to send only changed sub-area to the GPU.

I have tired

gl.texSubImage2D(gl.TEXTURE_2D, 0, 50,50, 100,100, gl.RGBA, gl.UNSIGNED_BYTE, pixels);

but it seems, that parameter "pixels" should be the sub-area of 100x100 pixels. Copying out a sub-area from a large picture also takes too much time. Can I somehow specify a sub-rectangle for source pixels in RAM? Maybe somehow using gl.pixelStorei() ?

UPDATE: I discovered that it is possible in WebGL 2.0 (= OpenGL ES 3.0) using gl.pixelStorei() by changing  PACK_ROW_LENGTH, PACK_SKIP_ROWS, PACK_SKIP_PIXELS  parameters. Too bad WebGL 2.0 is not supported in most of devices now :(

sentences:
Unexpected result when generating world with 2 perlin noises I try to generate a world with a temperature and an humidity noise to generate biome based on the y values of the two. I take the y values and round them on a 33 base for the humidity and 25 for the temperature then add the two to get 12 possibilities of biome. to test it I first tried generating a chunk by assining the sum of humidity and temperature to their y location. I was expecting to get multiple platform at different height (12 possibilities of height) but I instead got this
even if it doesn't look like it, there are random patterns within the bigger layers. i don't understand why I got that result (which looks pretty sick not gonna lie).
here is my script
const int seed = 50;
const int FREQUENCE = 100;
const int AMPLITUDE = 100;
const int size = 100;

int[] BIOME_DATA = { 0, 33, 66, 25, 58, 91, 50, 83, 116, 75, 108, 141 };

int[] temp_VERT = new int[100 * 100];
int[] hum_VERT = new int[100 * 100];
public int[] biome_VALUE = new int[100 * 100];

void Start()
{
    //generate the y values for the humidity vertices
    for (int x = (int)transform.position.x, i = 0 ; x < size+ (int)transform.position.x; x++)
    {
        for (int z = (int)transform.position.z; z < size+(int)transform.position.z; z++)
        {
            float y = Mathf.PerlinNoise((float)x+seed / FREQUENCE, (float)z / FREQUENCE) * AMPLITUDE;
            y = Mathf.Floor(y / 33) * 33;
            hum_VERT[i] = (int)y;
            i++;
        }
    }

    //generate the y values for the temperature vertices
    for (int x = (int)transform.position.x, i = 0; x < size+ (int)transform.position.x; x++)
    {
        for (int z = (int)transform.position.z; z < size+ (int)transform.position.z; z++)
        {
            float y = Mathf.PerlinNoise((float)x-seed / FREQUENCE, (float)z / FREQUENCE) * AMPLITUDE;
            y = Mathf.Floor(y / 25) * 25;
            temp_VERT[i] = (int)y;
            i++;
        }
    }

    //assigne une valeur représentant un biome pour chaque vertex
    for(int i = 0; i < biome_VALUE.Length; i++)
    {
        biome_VALUE[i] = System.Array.IndexOf(BIOME_DATA, (hum_VERT[i] + temp_VERT[i]));
        //biome_VALUE[i] = new Vector2(temp_VERT[i],hum_VERT[i]);
    }

    GenerateChunk(biome_VALUE);
}

void GenerateChunk(int[] Y_VERTICES)
{
    Mesh meshy;
    MeshRenderer meshRenderer = GetComponent<MeshRenderer>();
    meshRenderer.sharedMaterial = new Material(Shader.Find("Standard"));
    MeshFilter meshFilter = gameObject.GetComponent<MeshFilter>();

    Vector3[] VERTICES = new Vector3[Y_VERTICES.Length];
    List<Vector2> UV = new List<Vector2>();
    List<int> TRIANGLES = new List<int>();
    List<Vector3> NORMALS = new List<Vector3>();

    meshy = new Mesh();

    //création des Vecteur
    for (int i = 0, x = 0; x < size; x++)
    {
        for (int z = 0; z < size; z++)
        {
            VERTICES[i] = new Vector3(x+transform.position.x, BIOME_DATA[Y_VERTICES[i]], z+transform.position.z);
            i++;

        }
    }

    //création des normales
    for (int i = 0; i < VERTICES.Length; i++)
    {
        NORMALS.Add(-Vector3.forward);
    }

    //création des triangles
    for (int x = 0; x < size - 1; x++)
    {
        for (int z = 0; z < size - 1; z++)
        {
            int i = size * x + z;
            TRIANGLES.Add(i);
            TRIANGLES.Add(i + 1);
            TRIANGLES.Add(i + size);
            TRIANGLES.Add(i + size + 1);
            TRIANGLES.Add(i + size);
            TRIANGLES.Add(i + 1);
        }
    }

    //création des uv
    for (int i = 0; i < VERTICES.Length; i++)
    {
        UV.Add(new Vector2(VERTICES[i].x, VERTICES[i].z));
    }

    //assignation des valeurs
    meshy.vertices = VERTICES;
    meshy.triangles = TRIANGLES.ToArray();
    meshy.uv = UV.ToArray();
    meshy.normals = NORMALS.ToArray();
    meshFilter.mesh = meshy;
}

}

sentences:
How to handle sprite speed when objects move using Box2d? I have a basic platformer using Box2d that works great. However, I now want to stop using my default square, and implement some running and jumping animations.

How can I ensure that:

When running, the speed of the running sprite is correct with the current player speed, as to prevent the sprite from 'moonwalking'.
When jumping, play the correct frames at the right moments? I imagine I need to check the vertical velocity and if this is zero again while jumping I'm at the highest point, but how do I track where to initiate the landing animation?

sentences: Polygon Collision Detection Android I am starting to try and figure out polygon collision detection in my Android game. I am currently doing pixel level collision detection and it just seems to be too slow (though it works). I was looking at this tool and it seems like it would be really handy to give me a set of vertices for my images. Does anyone have any ideas about how I should go about implementing this? Basically once I have a list of vertices that form a polygon, how can I detect if polygon A intersects polygon B? I can see that these vertices can be used easily with Box2D but I want to try to do this without Box2D first.

sentences: How do fluid dynamics work? How would I go about implementing fluid dynamics in a game, such as can be seen in this video?

sentences:
XNA - Making 2D Hexagons Connect With Each Other I'm working on a top-down 2D strategy game in XNA, and the tiles are hexagons. I can't have a grid because of the game mechanics, so everything has its own location, and every tile object is stored in a list. What I'm trying to do is have it so that if you place a tile close to the side of another tile, they will snap together and become one object. I can't seem to figure out how to get what side it should snap to.

The red represents the different sections I want to check for mouse clicks in (these would of course not be an actual texture in the game). The white represents the area where if you clicked, it wouldn't allow you to place a tile because it would be on top of another. The closest thing I can think of is to have a larger hexagon around the actual tile that's divided into triangles from the center to the edges, but I'm not sure how to do this.

And I'm gonna move it to Windows Phone with Monogame and I don't think the phone is fast enough to make some sort of thing that checks colors for each sector, so I don't think it can be texture based. I feel like there's some kind of relatively simple math to do this but I can't seem to figure it out.

sentences:
Why does RGB order differ between color formats? On the reference page for SurfaceFormat, it indicates that the Bgra4444 format is an unsigned format which is 16-bits long, with 4 bits per color with alpha. Further down the page, it describes the Rgba64 format as being 64-bits long, with 16 bits per color (including alpha).

Why does one format list R-G-B as the color order, while the other lists it as B-G-R? I understand it likely has to do with the underlying hardware, but there certainly needs to be a reason that it wants it in a reversed order for the other format.

sentences:
How to create a Update function in Java I have recently started using Java, but have been programming in javascript, and actionscript 3 for a while.

I am used to the language giving me the ability to simply do something like:

private function Update(){
//stuff
}

or something similar to that.

I am looking for something similar in Java, and I want to make sure I am doing it correctly.

I started following a tutorial, and they said to do something like this:

 long lastTime = System.nanoTime();
        double amountOfTicks = 60.0;
        double ns = 1000000000;
        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;
            }
        }

This seems to be every second calling the tick() function, not the same as every frame though, and while things tend to happen in less time than a second, I would much rather use the same old frame by frame method i was using. (Unless someone can give me a reason not to, always up for an opinion)

So I am wondering, why not just do something like:

while(running){
Update();
}

I believe this would call every frame. Am I doing something completely crazy here? is there a much better method?

Thanks in advance

sentences: Is it possible to store diffuse and normal maps in the same texture area and preserve SRGB/linear space? Usually, one would want to upload texture data to OpenGL with GL_SRGB* for the internalformat of a texture, and GL_RGB* (or some other linear format) for normal data or specular highlight maps. We can minimize context switches by using a texture array, but that forces all textures to have the same internalformat. Is there a way to store all needed textures in a single texture array, but preserve colour spaces? Or should I convert from SRGB to linear space when uploading texture data?

sentences:
Where to show user shot's power on touch screen? I want to show user shot power in standart way
(the more user holds finger on the screen the stronger is shot)

Where is the best place to show this icon on touch screen(when I use mouse it's better to show it at the mouse position):

static at screen side or top
at finger position (how to handle clicking at screen bounds? what offset to use to avoid hiding behind finger?)

Will be glad to see any good examples you liked.

sentences:
LibGDX: Content appears stretched although I'm using a ScreenViewport I just fixed another issue regarding the scaling inside a ScreenViewport. And yet another problem arises:

If I'm understanding the wiki correctly, a ScreenViewport does not scale or stretch the content in any way. In my case it somehow does:

When the game is started, it looks like this:

And after resizing the window (e.g. making it wider) it looks like this (obviously stretched...):

(The code is mostly still the same as in the linked question).

Since I couldn't find a example of using a ScreenViewport with unitScale yet, I have no idea how to make this work... Thanks in advance :)

sentences:
Calculate line intersecting most points, based on random points in a grid I have been struggling with a math issue for a game I've been developing. I am in need to find the best starting and ending point for a straight line so that it intersects most of the circles (the blue one always needs to be intersected).

As you can see in the image below I want to be able to calculate that green line based on the given points, where the blue one is required to be intersected. The rule is that the line has to intersect as many circles as possible and should always intersect the blue circle.

I've tried to apply the best fit algorithm but that doesn't really takes intersection into consideration. Would appreciate if someone could help me out solving the math for this.

There will only ba a maximum of 5 circles while calculating the line.

Note: I am not deeply involved into math, only know the basic symbols for it.

sentences:
Why doesn't my simple HLSL shader work? I'm using Monogame to draw 2D primitives to the screen. To do that, rather than use included structures like VertexPositionColor, I wrote my own vertex class for 2D.

public struct VertexColor : IPositionable, IVertexType
{
    private static readonly VertexDeclaration Declaration = new VertexDeclaration
    (
        new VertexElement(0, VertexElementFormat.Vector2, VertexElementUsage.Position, 0),
        new VertexElement(8, VertexElementFormat.Color, VertexElementUsage.Color, 0)
    );

    public VertexColor(Vector2 position, Color color)
    {
        Position = position;
        Color = color;
    }

    public Vector2 Position { get; set; }
    public Color Color { get; set; }
    public VertexDeclaration VertexDeclaration => Declaration;
}

Here's my associated HLSL shader, meant to simply translate vertices from normalized space to screen space.

#define VShaderModel vs_4_0_level_9_1
#define PShaderModel ps_4_0_level_9_1

matrix Projection;

struct VertexShaderInput
{
    float4 Position : SV_Position0;
    float4 Color : Color0;
};

struct VertexShaderOutput
{
    float4 Position : SV_Position0;
    float4 Color : Color0;
};

VertexShaderOutput VertexShaderFunction(VertexShaderInput input)
{
    VertexShaderOutput output = (VertexShaderOutput)0;

    output.Position = mul(input.Position, Projection);
    output.Color = input.Color;

    return output;
}

float4 PixelShaderFunction(VertexShaderOutput input) : Color
{
    return input.Color;
}

technique Technique0
{
    pass Pass0
    {
        VertexShader = compile VShaderModel VertexShaderFunction();
        PixelShader = compile PShaderModel PixelShaderFunction();
    }
};

Where Projection is an orthographic matrix computed in code and passed to the shader based on current window size. However, when I attempt to draw primitives, I receive the following exception:

An error occurred while preparing to draw. This is probably because the current vertex declaration does not include all the elements required by the current vertex shader. The current vertex declaration includes these elements: SV_Position0, COLOR0.

Now, I'm familiar with this exception and I understand what it means. The exception is telling me that my shader does not include all required elements based on the current vertex declaration. However, as you can see, my shader does include those two elements (SV_Position0 and Color0).

What am I missing here?

sentences:
TF2 plugin signature (Source SDK) I am working on the server plugin for TF2. I need it for getting some stats from game (no hacking and cheating). My problem: I got message "No valid signature found..." while testing my plugin. But I want to make my plugin public in future (maybe).

Please tell me about signing procedure. How can I get valid signature for my plugin? What I must to do (send my plugin to Valve or what else)?

sentences:
How can I make the cursor the right size on a 4k monitor? Since I have a 4k screen,

cursor.loadFromSystem(sf::Cursor::Hand));

gives me a cursor that is way too small.

Is there a simple way to make the cursor automatically be the right size? (I want my program to work for people with any screen size).

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: Is Unreal engine or Unity better for high graphics low file size mobile games? My objective of learning game development is to make a 3d relatively high graphics mobile game but that should be in 150 mb. I don't know should I start with unity or unreal engine. I found that people say unreal engine is better for 3d games and unity is better for mobile game development. As I have no experience, can anyone suggest me an engine with some reasons?

sentences:
Scene - human speed correlation I am writing a really simple game with a scene (horizontal plane) and a human moving to the right of the plane (watching the simulation from the +z axis).

The scene contains some trees, which I am moving towards -x axis in order to create the animation effect (by adding a float to their current position).

The human just walks or runs with increasing/ decreasing the angular velocity of one of his legs.

The question comes down to, how can I combine this two entities in order to correlate the change of the speed of the human with the change of the variable that is responsible for making the animation of the scene?

Should I convert the angular velocity to velocity?

sentences:
How can I color/un color object that don't have renderer and material? I have a simple object:

I want to create a highlight effect.

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

public class Map : MonoBehaviour
{
    public Camera mapCamera;
    public Text objectWasHit;

    private Camera[] cameras;
    private GameObject mouseOvered;

    // Use this for initialization
    void Start()
    {
        cameras = Camera.allCameras;

        GameObject levels = GameObject.Find("_Level");
        foreach (Transform child in levels.transform)
        {
            child.gameObject.AddComponent<Renderer>();
        }
    }

    // Update is called once per frame
    void Update()
    {
        if (Input.GetKeyDown(KeyCode.M))
        {
            if (mapCamera.enabled == false)
            {
                foreach (Camera cam in cameras)
                {
                    cam.enabled = false;
                }
                mapCamera.enabled = true;
            }
            else
            {
                foreach (Camera cam in cameras)
                {
                    cam.enabled = true;
                }
                mapCamera.enabled = false;
            }
        }

        bool rcHit = false;
        Vector3 mouse = Input.mousePosition;
        Ray castPoint = mapCamera.ScreenPointToRay(mouse);
        RaycastHit hit;
        Debug.DrawRay(castPoint.origin, castPoint.direction * 1000, Color.magenta);
        if (Physics.Raycast(castPoint, out hit, 1000))
        {
            rcHit = true;
            if (mouseOvered != hit.collider.gameObject)
            {
                mouseOvered = hit.collider.gameObject;
            }
            objectWasHit.text = mouseOvered.name;
        }

        if (!rcHit && mouseOvered != null)
        {
            //do your thing to undo the material change
            mouseOvered = null;
        }
    }
}

First I'm not sure if white color is the right way for highlighting.
Second there is no startcolor since the object don't have any renderer or material at the first time. Then how can I make the highlight effect ?

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:
Networking and movement in MMORPG's UNITY I'm programming a dedicated server in C# using BeamServer2 DLL's.
At first I wanted to be able to see other players move on our already made Omuni map.
This I did by just sending your position to the server each frame.
This worked out and I was able to play with a few friends but the movement wasn't laggfree.
So I started trying to add movement smoothing and also some security so they can't just send a false position to the server without the server stopping it from reaching the other clients.

What I than did, I made a masterClient that has a movementController on the remotePlayer.
When a client wants to move he moves localy and sends a message to the server with hes direction to move. The server than takes hes speed and sends it to the masterClient.
The masterClient than moves the remotePlayer just like the remotePlayer moves himself.
When he stopes moving he sends a message with hes position in it. The masterclient than checkes if the position that he has come to is as close as the position he has from the client, if it is realistic according to the ping of the client the server puts him on the client's position.

This works, but I still have a lagg problem and I'm not sure how to fix this.
I must make movement smoothing on the client but I found out myself that I can just lerp (x/2,y/2,z/2) to the position and put him on the real position next frame, I failed at that and I will try again soon. Even if that is added I'm not sure if the lagg is fixed.

Any other techniques, suggestions, questions, ... ?
Thanks, Diede.

sentences:
Data structure for logical representatios of maps for a 2D top-down RPG I wish to logically represent a map for a 2D top-down RPG using a a bidimensional list (in python) structure. The map is like a variable size chess board. The first dimension represents the north-south direction of the map and the second represents the west-east direction.

For a square map of i.j cells ,in other words, a list of i lists, of j elements each, each element containing another list of variable representing what is contained in that square cell of the map, like type of terrain, any object, character occupying it, etc, which can be dinamically modified during gameplay.

Is this a good practice that can be easily interpreted by a graphical engine to draw a map?

I have the logical part of the game in python clear in my head, but I know nothing of graphical engines and don't wish to create something that cannot be tranformed easily by a graphical engine in future. Does any one knows a graphical engine that could use this data structure and draw based on it? It does not need to be in python itself, as long as it can be worked with without MUCH programing in other languages.

sentences:
How do you make a bullet ricochet off a vertical wall? First things first. I am using C# with XNA. My game is top-down and the player can shoot bullets. I've managed to get the bullets to ricochet correctly off horizontal walls. Yet, despite using similar methods (e.g. https://stackoverflow.com/questions/3203952/mirroring-an-angle) and reading other answered questions about this subject I have not been able to get the bullets to ricochet off a vertical wall correctly. Any method I've tried has failed and sometimes made ricocheting off a horizontal wall buggy.

Here is the collision code that calls the ricochet method:

//Loop through returned tile rectangles from quad tree to test for wall collision. If a collision occurs perform collision logic.
for (int r = 0; r < returnObjects.Count; r++)
    if (Bullets[i].BoundingRectangle.Intersects(returnObjects[r]))
        Bullets[i].doCollision(returnObjects[r]);

Now here is the code for the doCollision method.

    public void doCollision(Rectangle surface)
    {
        if (Ricochet) doRicochet(surface);
        else Trash = true;
    }

Finally, here is the code for the doRicochet method.

    public void doRicochet(Rectangle surface)
    {
        if (Position.X > surface.Left && Position.X < surface.Right)
        {
            //Mirror the bullet's angle.
            Rotation = -1 * Rotation;
            //Moves the bullet in the direction of its rotation by given amount.
            moveFaceDirection(Sprite.Width * BulletScale.X);
        }
        else if (Position.Y > surface.Top && Position.Y < surface.Bottom)
        {
        }
    }

Since I am only dealing with vertical and horizontal walls at the moment, the if statements simply determine if the object is colliding from the right or left, or from the top or bottom. If the object's X position is within the boundaries of the tile's X boundaries (left and right sides), it must be colliding from the top, and vice verse. As you can see, the else if statement is empty and is where the correct code needs to go.

sentences:
OpenGL ES draw pre-rendered background onto depth buffer I want to create a scene with 2D pre-rendered background and 3D models for characters (like those classic Final fantasy games).
For the background, I have 2 textures:

one to be displayed, with colors, details...
one to be used as depth buffer (depth value presented as grayscale value maybe)

I want to write a shader program to help me discard all the pixels(frags) which have the depth smaller than current depth.
But then, do the background and the models have to use the same shader?
What value to compare with the depth value?
Is this approach even possible?

sentences:
Popular genres in Asian (non-Japanese) markets? From time-to-time I've wondered what kind of games are popular in Asia (India, China, Korea, Singapore, etc...). I hear about developers in the US and UK who outsource work there, but what goes into the games they make for themselves?

Related, you hear these days about how Japanese developers have been marketing their games more for American audiences these days (with mixed success). In what ways could American developers aim their development toward Asian audiences?

sentences:
Reducing APK File Size by using JPG instead of PNG for game background images I've just finished my (openGL ES 2.0 Android) game and it's almost ready for Alpha-testing.

When I export the application to an APK File, the file is taking up 16MB and I would like to reduce this as much as I can.

Here are some points about what the project contains and what I've tried to reduce the size already:

222kb of Ogg Vorbis files used for Sound Effects
1 x MP3 file at 5.59MB (128kbps Bitrate)
4 x sets of PNG files used for textures (XHDPI, HDPI, MDPI & LDPI - I'm not using XXHDPI)
Just over 1MB of code

What I've tried thus far to get where I am:

I've optimised the PNG files using Optiping
I've applied ProGuard to my code before exporting, this didn't really help by much as 99% of my app is resources.

So my question is, is there really much else I can do to reduce the size of the APK?  I was thinking about maybe using JPG format source files for my Background OpenGL textures instead of PNG - anyone have any experience with this?  Does it hurt performance at all?  I can see that it would make quite a difference - my atlas of backgrounds in PNG format for XHDPI is 1.7MB - and a 90% compressed JPG comes in at around 650KB.  I'm just not sure if it's a good idea as everyone always advocates PNG > JPG.

Any pointers from personal experience would be helpful & also if I've overlooked anything other than using JPG's.

sentences:
Pixel Perfect collision detection on rotated bitmaps I have two bitmaps which are being drawn onto a canvas using a matrix

canvas.drawBitmap(bitmap, matrix, paint);

first to work out if I need to check for a collision i am using eucilidean vectors as such

//vector between the bitmaps
float vx = bitmap2.x - bitmap1.x;
float vy = bitmap2.x - bitmap1.x;

//magnitude of the vector between the two bitmaps
float m = Math.sqrt( (vx*vx)+(vy*vy) );

if( m < bitmap1.getDiagonalWidth() + bitmap1.getDiagonalWidth())
{
    //pixel perfect collision detection required
}

Firstly, is this the best way to approach this part of the collision detection?

Secondly once I have found that a collision is possible, do I need to do anything before throwing the bitmaps into a method that runs pixel perfect collision detection? basically, is the issue complicated because of the rotation of the images?

edit* it is possible that the bitmaps will also be scaled by the matrix. i would imagine that this will complicate things further.

sentences:
how to check mouse is not over any object in unity Im working on a way to check mouse is not over any object on scene to put my object in there. i know i can use OnMouseOver function but i have to add it on all objects script. Is there any other way to check my mouse position is not on any object collider?
Its a 2d project.
thank you for helping

sentences:
OpenGL ES Frame Skipping causing visible artifacts I'm using OpenGL ES 3.0 on Android 5.1, and am noticing the following issues. I tried to implement the game loop which does exactly 60 updates and do as many frames as it can. Everything is smooth, but the object is being rendered twice, I think due to interpolation by hardware.

If you zoom the image (click to view in separate tab) you'll see that the green square is being rendered twice. And now if I remove the catch-up code, it works correctly.

As you can see it now renders fine. Now I'll show you my game loop. I'm using GLSurfaceView class, and doing my render in onDrawFrame of the renderer.

double now = TimeUtils.currentTime();

if (previous == -1)
    previous = now;

double delta = now - previous;

if (delta >= SECOND)
    delta = frameTime;

lag += delta;

while (lag >= frameTime)  // This line plays catchup.
                          // If commented, it works otherwise the
                          // artifact occurs
{
    updates++;
    doUpdate(frameTime);

    lag -= frameTime;
}

frames++;
glClear(GL_COLOR_BUFFER_BIT);
doRender(frameTime);

if (now - lastStatsTime >= SECOND)
{
    updatesPerSecond = updates;
    framesPerSecond = frames;

    updates = frames = 0;
    lastStatsTime = now;
}

previous = now;

Is there anything that I'm doing wrong? I'm using a dynamic VBO for rendering, the lines are generated every frame and I use glBufferData to send them to GPU. This happens every frame (This is being done for educational purpose, to learn how VBOs are streamed).

Are there any issues that I'm forgetting?

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:
2D AABBs and resolving multiple collisions Okay, so this is a problem I've been trying to figure out for quite some time. Mine is a 2D platformer game with a world made up of (usually) immobile tiles and mobile sprites, both of which use AABBs to represent their hitboxes. This game is NOT grid-based due to some complications with moving layers of tiles.

I can detect collisions and easily figure out the depth of the collision. I use the "shallowest axis method" to determine which way to resolve a collision between the sprite and the tile. If the sprite is deeper horizontally than vertically, the direction to resolve is either up or down. If the sprite is deeper vertically than horizontally, the direction to resolve is either left or right.

This is simple enough, and it works pretty well. That is, until you have a sprite colliding with more than one tile. As, by their nature, each collision has to be checked separately, different collisions may have different direction to resolve in. For example, if a sprite is trying to walk across a row of tiles, for one frame they will intersect the next tile such that the horizontal depth is shorter than the vertical depth. As the collision says "resolve left", it will be pushed back and will be stuck on the corner.

I've been mulling this problem over, on and off, for quite some time, and several solutions have come to me, but all have flaws. I could mark certain sides as unreachable, but without a grid-based engine, determining "unreachability" is remarkably complex, especially with moving layers of tiles always a possibility.

Another possible method would be to predict collisions before they happen and "work back" the movement to the point of the collision, I suppose, but I'm not sure how the math on that works.

I feel that I'm missing something incredibly obvious, especially since games from the 80s have already solved this problem.

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:
Minecraft modding 1.12 draw image I want to draw an image that I created but the image is too big. Now I want the Gui to scale the image to a reasonable size, but when I change the width and height it doesn't make the image scale down/up but only the texture.

Code where I draw the image on screen:

@Override
    public void drawScreen(int mouseX, int mouseY, float partialTicks)
    {
        this.drawDefaultBackground();
        super.drawScreen(mouseX, mouseY, partialTicks);
        this.renderHoveredToolTip(mouseX, mouseY);
        Slot slot = getSlotAtPosition(mouseX, mouseY);

        if(slot != null) {
            if(slot.getStack().getItem() instanceof MonsterCard) {
                this.mc.getTextureManager().bindTexture(new ResourceLocation(Reference.MODID + ":textures/items/" + ((MonsterCard) slot.getStack().getItem()).getName() + ".png"));
                int i = (this.width - this.xSize) / 4;
                int j = (this.height - this.ySize) / 2;
                this.drawTexturedModalRect(0, 0, 0, 0, 154, 226);
            }
        }
    }

Image I want to draw which is 154px x 226px:

Output:

sentences:
Difficulties with rotation of a sprite Possible Duplicate:
  How do I make a jumping dolphin rotate realistically?

I want to program a dolphin that jumps and rotates like a real dolphin. Jumping is not the problem, but I don't know how to make the rotation. My dolphin always rests in the same angle while it jumps. But I want that it changes the rotation during the jump, like a real dolphin does.
How can I improve the rotation?

public class Game1 : Microsoft.Xna.Framework.Game
{
    GraphicsDeviceManager graphics;
    SpriteBatch spriteBatch;
    Texture2D image, water;
    float Gravity = 5.0F;
    float Acceleration = 20.0F;
    Vector2 Position = new Vector2(1200,720);
    Vector2 Velocity;
    float rotation = 0;
    SpriteEffects flip;
    Vector2 Speed = new Vector2(0, 0);

    public Game1()
    {
        graphics = new GraphicsDeviceManager(this);
        Content.RootDirectory = "Content";
        graphics.PreferredBackBufferWidth = 1280;
        graphics.PreferredBackBufferHeight = 720;
    }

    protected override void Initialize()
    {
        base.Initialize();
    }

    protected override void LoadContent()
    {
        spriteBatch = new SpriteBatch(GraphicsDevice);
        image = Content.Load<Texture2D>("cartoondolphin");
        water = Content.Load<Texture2D>("background");
        flip = SpriteEffects.None;
    }

    protected override void Update(GameTime gameTime)
    {
        float VelocityX = 0f;
        float VelocityY = 0f;

        float time = (float)gameTime.ElapsedGameTime.TotalSeconds;
        KeyboardState kbState = Keyboard.GetState();
        if(kbState.IsKeyDown(Keys.Left))
        {
            rotation = 0;
            flip = SpriteEffects.None;
            VelocityX += -5f;
        }

        if(kbState.IsKeyDown(Keys.Right))
        {
            rotation = 0;
            flip = SpriteEffects.FlipHorizontally;
            VelocityX += 5f;
        }

        // jump if the dolphin is under water
        if(Position.Y >= 670)
        {
            if (kbState.IsKeyDown(Keys.A))
            {
                if (flip == SpriteEffects.None)
                {
                  rotation = 45;
                  VelocityY += 40f;
                }
                else
                {
                  rotation = -45;
                  VelocityY += 40f;
                }
            }
        }
        else
        {
            VelocityY += -10f;
        }

        float deltaY = 0;
        float deltaX = 0;

        deltaY = Gravity * (float)gameTime.ElapsedGameTime.TotalSeconds;

        deltaX += VelocityX * (float)gameTime.ElapsedGameTime.TotalSeconds * Acceleration;
        deltaY += -VelocityY * (float)gameTime.ElapsedGameTime.TotalSeconds * Acceleration;

        Speed = new Vector2(Speed.X + deltaX, Speed.Y + deltaY);

        Position += Speed * (float)gameTime.ElapsedGameTime.TotalSeconds;

        Velocity.X = 0;

        if (Position.Y + image.Height/2 > graphics.PreferredBackBufferHeight)
            Position.Y = graphics.PreferredBackBufferHeight - image.Height/2;

        base.Update(gameTime);
    }

    protected override void Draw(GameTime gameTime)
    {
        GraphicsDevice.Clear(Color.CornflowerBlue);
        spriteBatch.Begin();
        spriteBatch.Draw(water, new Rectangle(0, graphics.PreferredBackBufferHeight -100, graphics.PreferredBackBufferWidth, 100), Color.White);
        spriteBatch.Draw(image, Position, null, Color.White, MathHelper.ToRadians(rotation), new Vector2(image.Width / 2, image.Height / 2), 1, flip, 1);
        spriteBatch.End();

        base.Draw(gameTime);
    }
}

sentences:
No MODS button in Windows Minecraft when selecting Forge profile I have installed a Minecraft launcher in Windows that supports Minecraft 1.14. I have installed Forge 1.14.4-forge-28.0.13. I have created the mods folder and placed a mod jar in it which is Xaeros_Minimap_1.17.4_Forge_1.14.4.

I have selected the Forge profile in the launcher. When running the launcher, I have to remove JVM option -XX:+CMSIncrementalMode in order to run it (also when running the regular profile). I have Java 11 installed.

But after launching, there is no MOD button in the menu. What could be the problem?

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:
Is OpenGL appropriate for 2D games? I have been teaching myself the OpenGL library for a while now, and want to start making a game. However, for an easier introduction, I want to start with something 2D, such as a top down Pokemon-style game.

Is this a good plan, or is OpenGL made specifically for 3D?

sentences: How I can count how many time gameOver scene is loaded? I'm building a game using unity 3d and I want to add an interstitial ads to it, but I want it to appear after the player lost every 3 times. So when the player loses for the first time the ads will appear, and when he loses for the second and third time, nothing appears until he lost for fourth time.

sentences: Changing Spritefont Sizes Without Anti-Aliasing in MonoGame I'm using a custom font for a small game in MonoGame, and it is made on an 8x8 grid, so I have to scale it to make it bigger. Currently I am scaling the scale in the spriteBatch.Begin() method, but this means I have to call the End() and Begin() method for every font size I want, which is very inefficient. I found a solution online to prevent anti-aliasing for the Begin() method, but what I want to know is: is there a way to prevent anti-aliasing when scaling by changing the XML file of the spritefont? Any help would be appreciated! :D

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:
PS3 controller with Unity on Mac I am trying to use my PS3 Controller with Unity but it has been unsuccessful.

I followed this video to do so:
https://www.youtube.com/watch?v=LcettC1QHu4

I have done the same thing as the video but for some reason unity is not getting ANY input from the controller.

I have tested the controller with another commercial game on my Mac and it works perfectly, so my controller is well connect to my computer.

here is a screenshot of the input manager:

joystick button 0 is the X button

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:
How do I implement camera axis aligned billboards? I am trying to make an axis-aligned billboard with Pyglet. I have looked at several tutorials, but they only show me how to get the up, right, and look vectors. So far this is what I have:

target = cam.pos
look = norm(target - billboard.pos)

right = norm(Vector3(0,1,0) * look)
up = look * right

gluLookAt(
  look.x, look.y, look.z,
  self.pos.x, self.pos.y, self.pos.z,
  up.x, up.y, up.z
)

This does nothing for me visibly. Any idea what I'm doing wrong?

sentences:
Why do I see this "ghosting" effect with my sprite in SDL? I'm using SDL to create a 2D side-scrolling platformer, but I'm getting ghosting from the sprite. I'm not used to programming with graphics or SDL so excuse any stupid remarks I make.

Here's the issue:

The tutorial I'm following:
http://gamedevgeek.com/tutorials/moving-sprites-with-sdl/

int main(int argc, char* argv[])
{
    SDL_Surface *screen, *temp, *sprite;
    int colorkey;

    SDL_Init(SDL_INIT_VIDEO); //Initialize SDL

    SDL_WM_SetCaption(WINDOW_TITLE, 0); //Window title

    screen = SDL_SetVideoMode(WINDOW_WIDTH, WINDOW_HEIGHT, 0, 0); //Create window frame

    SDL_EnableKeyRepeat(70, 70); //Keyboard Repeat

    temp   = SDL_LoadBMP("sprite.bmp"); //Load the actual sprite
    sprite = SDL_DisplayFormat(temp);
    SDL_FreeSurface(temp);

    /* setup sprite colorkey and turn on RLE */
    colorkey = SDL_MapRGB(screen->format, 160, 136, 128); //Make this RGB color transparent, so sprite isn't surrounded by a colored box
    SDL_SetColorKey(sprite, SDL_SRCCOLORKEY | SDL_RLEACCEL, colorkey);

    spriteRect.x = 150; //Initial X Position
    spriteRect.y = 150; //Initial Y Position

    /* set animation frame */
    srcRect.x = 0;
    srcRect.y = 0;
    srcRect.w = SPRITE_SIZE;
    srcRect.h = SPRITE_SIZE;

    gameover = 0;

    /* message pump */
    while (!gameover)
    {
        SDL_Event event;

        /* look for an event */
        if (SDL_PollEvent(&event)) {
            HandleEvent(event);
        }

        /* collide with edges of screen */
        if (spriteRect.x <= 0)
            spriteRect.x = 0;
        if (spriteRect.x >= WINDOW_WIDTH - SPRITE_SIZE)
            spriteRect.x = WINDOW_WIDTH - SPRITE_SIZE;

        if (spriteRect.y <= 0)
            spriteRect.y = 0;
        if (spriteRect.y >= WINDOW_HEIGHT - SPRITE_SIZE)
            spriteRect.y = WINDOW_HEIGHT - SPRITE_SIZE;

        SDL_BlitSurface(sprite, &srcRect, screen, &spriteRect);
        SDL_UpdateRect(screen, 0, 0, 0, 0);
    }

    /* clean up */
    SDL_FreeSurface(sprite);
    SDL_Quit();

    return 0;
}

sentences:
Which GameObject should I put the animator on? I have a GameObject.  One of its children is an empty GameObject, whose children are the body parts which need to be animated.

Character (root)
--->Body
--->--->Body Parts

Should I put the animator on the root GameObject ("Character")?  Or on the empty child ("Body")?  Does it matter? What benefits would one way offer over the other?  Or is there another approach I should be taking?

This is for 2D sprites/animations.  I am trying to figure this out before making all of the animations to avoid redoing them.

sentences:
How to avoid entities flying far away when tabbing out and then tabbing back in? I'm developing a game which uses a standard Entity-Component-System.
Every frame, the PhysicsSystem runs, which, among other things, updates the position of entities based on their velocity. Something like this:
execute(delta: number, elapsed: number) {
  for (let entity of this.scene.query(CT.Transform, CT.Physics)) {
    let transform = entity.get(CT.Transform);
    let physics = entity.get(CT.Physics);

    let movementIncrement = physics.direction.multiply(delta * physics.friction * physics.speed);

    physics.velocity = physics.velocity.multiply(1 - delta * physics.friction).add(movementIncrement);
    transform.pos = transform.pos.add(physics.velocity.multiply(delta));
  }
}

This works fine, except there's an issue. When the user switches to another tab, waits some time (let's say 5 seconds), and then tabs back in, sometimes the entities instantly fly away so far that they fly off the map and out of bounds.
I'm not sure why this would happen, as it never happens during normal gameplay. Something to do with the tab becoming inactive for a time, and then active, seems to cause this issue.
I suppose a possible solution is to "pause" the game if the tab loses focus, but I rather the game keep running in the background unless the user manually pauses by hitting escape.
Does anyone know why this is happening? The rest of the game continues functioning normally, it's just the entity positions fly away for some reason.

sentences: Deterministic random number sequence I have an array of lights that I need to sample from randomly, but deterministically so that all the lights are sampled. Currently I use random numbers to pick a light, and then put processed lights into another list, but I'm wondering if there is a way to use something like a hammersly or halton sequence to do this instead. A biased solution would be ok.

sentences:
Loading a Texture2D Array in DirectX11 How does one create a Texture2D Array in DirectX11? The texture I am trying to create is not multisampled, and I want only one mip level. I can't find a working example of a Texture2D Array. I have a buffer of 2D images that I want to use as a Texture2DArray in a shader.

The following code snippet works when sTexDesc.ArraySize=1 (as a Texture2D). With sTexDesc.ArraySize=2 the subsequent call to CreateTexture2D crashes with this Access violation inside DirectX:

  Unhandled exception at 0x000007fef5d6771a in test.exe: 0xC0000005: Access violation reading location 0xffffffffffffffff.

With larger values of ArraySize CreateTexture2D returns E_INVALIDARG. ubImageStorage contains valid data. As a Texture2D I can add multiples of the slice offset to this buffer address when assigning pSysMem and read each slice from a shader. What am I missing? I have tried all combinations of bind and usage flags and various values for MipLevels with no success.

D3D11_TEXTURE2D_DESC sTexDesc;
sTexDesc.Width = 1024;
sTexDesc.Height = 1024;
sTexDesc.MipLevels = 1;
sTexDesc.ArraySize = 2;
sTexDesc.Format = DXGI_FORMAT_R8G8B8A8_UNORM;
sTexDesc.SampleDesc.Count = 1;
sTexDesc.SampleDesc.Quality = 0;
sTexDesc.Usage = D3D11_USAGE_IMMUTABLE;
sTexDesc.BindFlags = D3D11_BIND_SHADER_RESOURCE;
sTexDesc.CPUAccessFlags = 0;
sTexDesc.MiscFlags = 0;

D3D11_SUBRESOURCE_DATA sSubData;
sSubData.pSysMem = ubImageStorage;
sSubData.SysMemPitch = (UINT) (1024 * 4);
sSubData.SysMemSlicePitch = (UINT) (1024 * 1024 * 4);

ID3D11Texture2D* pTexture;

hr = m_pd3dDevice->CreateTexture2D(&sTexDesc,&sSubData,&pTexture);

Here are the relevant pages from MSDN:
ID3D11Device::CreateTexture2D Method
D3D11_TEXTURE2D_DESC Structure

sentences:
how to make a humanoid character bone rotate to face an object in unity? I want to character to be able to move in a direction and be able to aim to object in other direction.
I use code below to control bone of a character:

anim.SetBoneLocalRotation(HumanBodyBones.Spine, Quaternion.Euler(...));

but I don't know what is the right way to rotate chest and spine of a character to make upper body aim to a position.

sentences:
How do I measure the bounds of a string in PyGame? I am trying to position some text on my screen using pygame, and knowing the size of the string would help.

When using C# and XNA I could use SpriteFont.MeasureString("Hello World") to get the size of the rendered string.

Is there any way to do something similar in pygame?

sentences:
How do I get the number of Steam friends online programmatically? How can I get the current number of Steam friends online in order to insert it into a script or program? I'm looking to use this value to do something like changing an LED colour or for providing data for a desktop widget etc.

Is this possible? How do I get access to that number?

P.S. I got my idea from here: Xbox Live Traffic Light Notifies You When Friends are Gaming

sentences:
Does Monogame on Windows Desktop use OpenGL or DirectX by default? if i use monogame 3.0 beta on windows desktop, does it use the directx renderer (sharpdx) or the opengl renderer by default?

if it uses directx is there away to make sharpdx call directly? thanks!

sentences:
How should I implement card effects in a card game? I've been trying to program a video game adaptation of the popular trading card game "Magic: The Gathering". If you've played MTG before, you'll know most cards have an effect, which is activated at a certain time, usually when it's played. But I'm unsure how to implement effects into my game.

I'm thinking of creating a method that assigns a card its effect when it's played based on the card's name, but that doesn't really work when a card's effect isn't supposed to be activated when it's played, like in the case of Deathrattle cards, or when it's a continuous effect. I've thought of creating a thread for each effect which activates it whenever needed, but... that's a LOT of unique threads. I haven't found any similar java programs anywhere, so I wanna ask here. How do you think card effects should be handled?

sentences:
Affine transformation: rotate a plane parallel to another plane I am writing a function that extrudes a 2D shape along a 3D spline, as found in 3D modeling software.

I need a way of translating a set of points P so that they all lie in a new plane L (preserving distances between points).

P is all points where Z = 0;
L is defined by (0,0,0), with the normal vector N.

I am using Processing, it has common matrix and vector functionality (but no quaternions)
A conceptual or pseudo-code answer is OK.

sentences:
Unity3D sprites vs Mesh Quads - Depth, Blending, Shadows I'm new to unity but not new to game development.  In my OpenGL ES 2.0 (mobile) games I create a vertex array of all my "sprites" and stuff it in a VBO.  Then draw them as I need them one at a time, back to front, and turning on and off depth test and blending as I go to build my scene.  Probably not super efficient (as maybe batch drawing) but I get 60fps on modern devices.

This particular scene has a "paper" background, writing ON that paper (same Z depth), then 3d objects over top of that. The 3d objects cast shadows on to the paper.  (I can post a screenshot if necessary.)

To accomplish this I render my shadow map of any object that casts shadows.  Then render my scene with a shadow shader on the paper, not on the stuff that's on the paper, but then back on for the 3d objects floating above or sitting on the paper.

Now I'm switching to Unity3D and porting this working game over.

I'm having 2 problems that I can't figure out.

Being new to unity I brought in my sprite sheets and set them "Advanced" but as sprites and sliced them up with the Sprite Editor.  But the Sprite Renderer doesn't have checkboxes for Casting or Receiving shadows.  Are sprites only for 2d games with no shadows and lighting?  Do I have to switch to all Mesh Quads and use the mesh renderer and manually handle all my "sprites"?
In Unity with the paper and all the stuff that is drawn on the paper at the same Z I'm having depth issues.  In my OpenGL version I do glDisable(GL_DEPTH_TEST); and enable blending, draw the "ink" stuff, and then re-enable depth and draw the rest of the 3d scene.  In Unity I can't figure out how to turn off depth or to get blending to work.  Since the ink has to be drawn ON the paper and thing drawn over that I can't use a different camera.

sentences:
With what structure do you manage the graphics of a game? Im currently trying to program a little game (in Java - Libgdx; if thats necessary).

I currently use a GameWorld and a GameRenderer, the GameRenderer just getting all the info it needs from the GameWorld object and calling a method for every different class there is (for example drawPlayer(), drawWorld() etc.).

Should I let my actors draw themselves or encapsulate the data inside of another class and then pass an object of it to the GameRenderer?

sentences:
Difference between the terms Material & Effect I'm making an effect system right now (I think, because it may be a material system... or both!). The effects system follows the common (e.g. COLLADA, DirectX) effect framework abstraction of Effects have Techniques, Techniques have Passes, Passes have States & Shader Programs.

An effect, according to COLLADA, defines the equations necessary for the visual appearance of geometry and screen-space image processing. Keeping with the abstraction, effects contain techniques.

Each effect can contain one or many techniques (i.e. ways to generate the effect), each of which describes a different method for rendering that effect. The technique could be relate to quality (e.g. high precision, high LOD, etc.), or in-game-situation (e.g. night/day, power-up-mode, etc.). Techniques hold a description of the textures, samplers, shaders, parameters, & passes necessary for rendering this effect using one method.

Some algorithms require several passes to render the effect. Pipeline descriptions are broken into an ordered collection of Pass objects. A pass provides a static declaration of all the render states, shaders, & settings for "one rendering pipeline" (i.e. one pass).

Meshes usually contain a series of materials that define the model. According to the COLLADA spec (again), a material instantiates an effect, fills its parameters with values, & selects a technique. But I see material defined differently in other places, such as just the Lambert, Blinn, Phong "material types/shaded surfaces", or as Metal, Plastic, Wood, etc.

In game dev forums, people often talk about implementing a "material/effect system". Is the material not an instance of an effect? Ergo, if I had effect objects, stored in a collection, & each effect instance object with there own parameter setting, then there is no need for the concept of a material... Or am I interpreting it wrong?

Please help by contributing your interpretations as I want to be clear on a distinction (if any), & don't want to miss out on the concept of a material if it should be implemented to follow the abstraction of the DirectX FX framework & COLLADA definitions closely.

sentences:
How to make changes to array of prefabs in editor to be visible in game window I attached the following script to an empty game object (EnemiesGO) in the editor.

public class EnemiesScript {

[System.Serializable]
public struct EnemyWithType {
    public EnemyScript enemy;
    public EnemyScript.Type enemyType;
}

public EnemyWithType[] enemyPrefabs;
public EnemyScript[] enemies;

void Start ()
{
    enemies = new EnemyScript[enemyPrefabs.Length];

    for (int i = 0; i < enemyPrefabs.Length; i++)
    {
        enemies[i] = Instantiate<EnemyScript>(enemyPrefabs[i].enemy);
        enemies[i].enemyCategory = enemyPrefabs[i].enemyType;
    }
}

}

When I was populating enemyPrefabs (through the editor) I didn't see the prefabs in the popup selection window so I dragged them directly from the Assets window Assets/Resources/Prefabs/EnemyPrefabs. My question is two fold.

If it is possible, how can I get the populated enemyPrefabs array to be displayed in the game window/ scene window before I run the game? In general, I would like to see changes effected from the editor in the game window before I run the game.
How can I access the EnemyPrefabs folder from the popup selection window?

sentences:
How would one go about integrated python into a c++ written game for the use of user-made scripts I'm quite new to game development  (not the site) and I'm currently just trying to educate myself about some certain things before I really begin working and a game.

anyway, I'd like to know what basic algorithm/outline of how a game would be coded effeciently with the implementation of user coded scripts for gameplay and levels that are written in python,

Is this even possible? would all the features of python be avalible? like say "multi-threading"?

sentences:
Unity3D: Disable player input but not character movement? I'm trying to code a dash/air dash for a 2D platformer. In my character controller's FixedUpdate(), I have various if statements that cause certain actions when a button is pressed.

To disable player input while the dash was happening, I tried putting Dash() in an IEnumerator with a simple test code like this:

IEnumerator Dash() {
    if (player.GetAxis("Horizontal") < 0)
        {
            thePlayer.GetComponent<HeroController>().enabled = false;
            yield return new WaitForSeconds(0.5f);
            move = move * 2;
            thePlayer.GetComponent<HeroController>().enabled = true;
    }
}

But since the character's physics are inside the character controller, both the player's input and the character's movements are stopped when the controller is disabled. How can I disable inputs while still allowing the character to dash?

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:
How to port a game from IPad to Iphone I just finished developing a 2D side scroll game for the IPad using Cocos2d and Box2d.
Now we want to make an IPhone 4 version of the game, but I'm still not sure what is the best way to do it.

I was thinking to just create a new target on my project, remove all the current resources from the Build Phases and create a new Resources folder with all the assets of the game scaled to the new resolution.

Of course this approach would take a lot of work, specially from the designer, since there are a lot of images on the game, 30 levels with 3 layers of parallax, and over 100  animations between all the elements, plus the SVG levels that map physics world (we are using level SVG parser).

I would also have to check all the touch functions and the sprites with a hard coded position (mostly Hud and the Menu). I did tried to use the win Size for this, but I'm pretty sure there are sprites with fixed positions.

I know that checking the Menu and Hud position should not take much time, but I'm worried about the time it could take to scale all the images, and specially the SVG files that map the physics of the game.

I would like to know if I'm in the right path regarding the porting of the game or if there if someone have though of a better easy solution.

I tried modifying the gluLookAt eye z parameter, but this didn't work really well. I haven't work with OpenGL since college around 3 years ago, and I don't remember very well   the math behind the low level pipeline of it. Anyway, I don't think that modifying the Cocos2d rendering steps could work for my problem.

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:
Gravity and collision detection interfering with player movement I am attempting to implement collision detection for a 2d sidescroller game and I'm having trouble keeping gravity from interfering with player movement.

Every frame I get and handle input, creating values for a point that represents the players movement vector. I then add gravity to the vector and check for collisions. This is the way AI will be handled as well.

The problem I'm having is when the player is on a floor tile, even if the input says to walk horizontally, after I add gravity to the move vector, collision detection returns a collision so the movement is completely negated.

I know i can test which a is is the problem, negate that and move the player but then if I change the players movement vector inside collision testing, wouldn't I have to cull for collisions again based off the new move vector?

I don't know if this has to do with input handling or collision testing. So how should I go about adding gravity to the players movement?

sentences:
The pros and cons - DX9 moving to DX11 render? We are a "nano" game dev company working on REFUSION.
DX9 renderer is almost done and question is: Should we move it to DX11 or not?
Anyone have experience with this?

Here are some videos from dev progress from the very beginning:

Dev test videos

EDITED: I'm going to ask more fundamental. What about NextNextGen XBOX1080 or PS4?
        When? Resources? Architekture? PC DX11 -12 , next XBOX, next PS relations? Future?

sentences:
How do .HLSL files work together compared to .FX? So I have been slowly reading and working through Frank Luna's D3D11 book which uses the .FX file format which uses effects, techniques and passes which I understand now. However I have read online that the FX framework is no longer supported so I shouldn't use it. How do .HLSL files work? Do techniques, passes and effects still work the same way? Can I still use functions like:

CreateEffectFromMemory();

sentences:
Why do some games need to be rated by game rating boards? I don't know much about why the games are rated in the first place, aside from the fact that it may help customers to filter out the games that aren't appropriate for them due to age or personal preferences.

Are there any other benefits to completing the rating procedure of a game?

I wonder if it is required at all to have your game rated by a local rating board. And what about countries that don't have their own game rating boards?

sentences:
libGDX box2D not setting user data I am working about box2D.
Even if I set userData, when I retrieve it via getUserData(), it returns null. Using debugger, I noticed that object passed to setUserData() is not null, but on the next istruction: fixtureDef.shape.dispose();
Body user data returns being null, such as setUserData() set on a copy of body. I read on other topics that setUserData() must be called before body creation...but it throws an exception
      @Override
public void setPhysic(@Null Shape shape, BodyDef.BodyType bodyType, FixtureDef fixtureDef) {

    if(shape == null) {
        PolygonShape polygonShape = new PolygonShape();
        BoundingBox boundingBox = this.model.calculateBoundingBox(new BoundingBox());
        polygonShape.setAsBox(boundingBox.getWidth(), boundingBox.getHeight());
        fixtureDef.shape = polygonShape;
        fixtureDef.density = 1f;
    }else{
        fixtureDef.shape = shape;
    }

    BodyDef bodyDef = new BodyDef();
    bodyDef.type = bodyType;
    bodyDef.position.set(this.getPosition().x, this.getPosition().y);

    this.body = Game.world.createBody(bodyDef);
    this.body.setUserData(this); //<-- Add this line to fix the problem
    this.body.createFixture(fixtureDef).setUserData(this);

    fixtureDef.shape.dispose();
}

Here I get userData:
  if(body[0].getUserData() instanceof Block){
            if(button == Input.Buttons.RIGHT){
                ((Block)body[0].getUserData()).onBlockClicked(player);
            }else if(button == Input.Buttons.LEFT){
                player.onPlayerBlockDestroying((Block)body[0].getUserData(), mouseCords);
            }
        }

sentences:
Tool to convert Textures to power of two? I'm currently porting a game to a new platform, the problem being that the old platform accepted non power of two textures and this new platform doesn't.

To add to the headache, the new platform has much less memory so we want to use the tools provided by the vendor to compress them; which of course only takes power of two textures.

The current workflow is to convert the non power of tho textures to dds with 'texconv', then use the vendors compression tools in a batch.

So, does anyone know of a tool to convert textures to their nearest 'power of two' counterparts?

Thanks

sentences:
How can I rotate cubemap in shadergraph? I know how to rotate cube map with legacy surface shader

Shader Rotation Matrix:

uniform float4x4 _Rotation;
          o.Emission = texCUBE (_Cube,  mul(_Rotation, float4(IN.worldRefl,0))).rgb;

RotateCubeMap:

using UnityEngine;

public class RotateCubeMap : MonoBehaviour
{
    public float speed = 20;
    private MeshRenderer _meshRenderer;

    private void Awake()
    {
        _meshRenderer = GetComponent<MeshRenderer>();
    }

    public void Update()
    {
        var rot = Quaternion.Euler (0, Time.time*speed, 0);
        var m = new Matrix4x4 ();
        m.SetTRS(Vector3.zero, rot,new Vector3(1,1,1) );
        _meshRenderer.material.SetMatrix ("_Rotation", m);
    }
}

I tried to recreate it by shadergraph

but it didn't work!

I need a result like this:

sentences:
Best practice to store level data in a rhythm based game Setup:

I'm planing to do a rhythm based game, where a level is a music score similar to Frets on Fire, but with real music.

I've two options to store that level data, namely a MIDI file and a MusicML file.

It seems that the defacto standard is MIDI files (see Sintesia, for instance).

I don't need to output that data to the audio system, since is only to build the gameplay, since the player will be the one that will produce the sounds with an external device.

Question:

I wonder, since MusicML is more structured and easy to interact to, if it would be best to store the level data as a MusicML file.

sentences:
Unwanted begincontact callbacks at high velocity I'm having some issues with jump detection due to begincontact. I have a player entity made of 2 bodies, and it looks something like this:

Note how the circle below (a body connected via a revolute joint) is not quite as wide as the rectangle. This means that when the player is up against a wall, there is no contact between the circle and the wall.

However, if the player collides with a wall at high velocity, begincontact registers a contact between the circle and the wall. Is there any way around this?

sentences:
Prefabs property is not overriding when changing from editor script? In unity we can have different instances of a prefab with different properties.
Unity represents the overridden property with bold characters. This works fine when manually change the value of prefab instance. But when I do it using a editor script, it do not turn bold and the property value changes to the source prefab when I play the game.

Here is an example of the code:

using UnityEngine;
using UnityEditor;

[CustomEditor(typeof(testScript))]
public class editor : Editor {
    public override void OnInspectorGUI(){
        DrawDefaultInspector ();
        testScript scrt= (testScript)target;
        if (GUILayout.Button ("button")) {
            scrt.test();
        }
    }
}

.

using UnityEngine;
public class testScript: MonoBehaviour {
   test(){
       gameManager  =GameObject.Find("GameManager");
       gameManager.GetComponent<gameManager>().arr = new GameObject[3];
   }
}

.

using UnityEngine;
public class gameManger:MonoBehaviour{
    public GameObject[] arr;
}

The arr array in gamemanager class is not overridden and it changes to the source prefab value on play.

  EDIT:

actual function called from editor script

    public void assignPortalPass(){
    GameObject gameManagerObj = GameObject.Find ("Game Manager");
    gameManager gameManagerScript = gameManagerObj.GetComponent<gameManager> ();
    Transform passed = GameObject.Find ("passed").transform;
    int noOfChild = passed.childCount;
    if (noOfChild != gameManagerScript.noOfPortals) {
        Debug.LogError ("Check passed objects and noOfPortals (class gameManager) because both values are different");
        return;
    }
    Undo.RecordObject(gameManagerObj, "Made some changes to gameManager");
    //as suggested by the answer

    gameManagerScript.portalPass = new GameObject[noOfChild];
    for (int i = 0; i < noOfChild; i++) {
        gameManagerScript.portalPass [i] = passed.GetChild (i).gameObject;

    }
}

}

sentences:
Move object at angle like a sine wave I currently have this code, which moves an object in a straight line at an angle, where "dir" is the angle.

velX = (float)(Math.cos(Math.toRadians(dir))) * speed;

velY = (float)(Math.sin(Math.toRadians(dir))) * speed;

x += velX;

y += velY;

What I need now is to have the object move like a sine wave, do I have to change the way I calculate velX and velY or is there some way of changing dir that would make it work?

I tried this but it didn't work, my objects would just got bunched up near 0, 0.
Move a sprite in a sine wave along different angles

sentences:
Drawing many quads XNA I asked a similar question to this yesterday and gained some knowhow but
I'm a little confused:

If I have many quads that contain vertices and indices that are positioned to to form a bigger picture, then that bigger picture is positioned using world matrices...

How do I draw them all? From what I've gathered I've got to do in it in one pass for good speed.

I used to draw every quad with its own pass. Now every quad in an object is drawn in one pass.

But if I have a lot of objects it will slow down.

So my question is: how does one go about drawing lots of separate vertices and indices without losing frame rate? I don't need someone to hold my hand just maybe point in the right direction.

sentences:
In Maya how do I convert trans, rot, scale data to a 4 x 4 transformation matrix? I have been given the following Maya camera data:

trans X: 1.542
trans y: 3.319
trans z: -1.821

rot X: 117.882
rot Y: 2.189
rot Z: 154.074

scale X: 1
scale Y: 1
scale Z: 1

What is the formula for converting this to a 4 x 4 transformation matrix?

sentences:
Updating bots/AI behavior after a fixed elapsed timestamp in game loop? I am developing a HTML5 game in javascript. Now I have created a few bots and they should be able to change their orientation after a few seconds/a fixed timestamp in the game loop.

Suppose my game loop is like this:

function loop() {
    bots.updateOrientation();
    bots.render();
    player.update();
    player.render();
    requestAnimationFrame(loop);
}

How can I make that happen in my game loop?

sentences:
Pokemon Artificial Intelligence I'm working on a thesis about programming an AI combat system for Pokemon (To be implemented in Showdown!). However, I would like to include historical information about the existing implementations of Pokemon AI. This information would offer valuable context to my thesis.

I have been scouring the internet for some sort of algorithm that explains how the AI Trainers make their choices, but have found nothing promising. I realize the fan-games have implemented some more interesting AI systems for their trainers, these would be interesting to see as well.

What I am looking for is examples of the methods used for Pokemon Battle AI decision making used in Pokemon videogames, whether from main series by Nintendo or the many fan-games out there. I realize most of these pose no challenge to an experienced player, but I don't mind, I only wish to compile historical information on previous Pokemon AI attempts.

sentences:
Selling merchandise inside game? I am developing my first iOS game on Unity. I spent a lot of time creating beautiful artwork for the game (characters and scenery). I gave testflight access to my friends and advisors, and they loved the game art, and asked me if I have ever thought about selling t-shirts or something.

I did some research, and found three services offering a SDK or plugin that lets me sell merchandise inside the game:

themonetizr.com
merch.amazon.com

First I thought about using Amazon, but then I saw that the monetizer actually lets players buy right inside the game (which is nice, as I would hate users to be directed to their browser) and they a lot more products, like phone cases.

Have you guys used any of these services before? How hard are they to integrate?

Thanks!

sentences:
Is it possible to use unnormalized texture coordinates from a GLES2 GLSL fragment shader? I want to look up a texel from my GLES2 GLSL fragment shader using un-normalized texture coordinates (0-w, 0-h instead of 0-1, 0-1). The reason is that this texture is used as a look up table and I get precision problems with normalized coordinates.

I see that GL_TEXTURE_RECTANGLE is not supported wihtout extensions and neither is texelFetch(), so I have ruled out those options.

Thanks!

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:
If I use vertex shader to do all operations on object, then constant buffer can be empty? The program cycle is

Update();
UpdatePipeline();

In Update() constant buffer for each object, that after transformations, has this object world matrix is copied to GPU upload heap. And in UpdatePipeline(), among other things, installed shaders are called. Because we do all matrix transformation using CPU, vertex shader just returns position, right? If yes - is it true that performance will increase?

Now I want to do all transformations using GPU, i.e. via vertex shader. It means that in Update() I just should call memcpy() with an empty constant buffer as a source?

Learning more, I found that I can put in constant buffer position vector float4 or matrix float4x4 of vertex, and as a root constant choose ProjectionView Matrix. The shader will mul one on other. Keep searching... Or constant buffer is one of the root constants? Confused

I don’t understand how to choose what to send as an argument to shader function, like input here:

VS_OUTPUT main(VS_input input)
{
...
}

As I understand, I can access constant buffer the next way:

cbuffer ConstantBuffer : register(b0)
{
float4x4 mat;
}

There can be ProjectionView matrix, okey got that. But how to send vertex pos to input then?

sentences:
Unity5 UI - How to trigger button click event while preventing menu item deselect event? So I've got a load menu using Unity's new UI system, basically just a list of save games you can select with a mouse click along with a couple of buttons at the bottom to delete or load the selected game file.

I've been disabling the Load Game and Delete Game buttons using the interactable attribute whenever a saved game item in the list is deselected:

deleteButton_LoadPanel.GetComponent<Button>().interactable = false;
loadButton_LoadPanel.GetComponent<Button>().interactable = false;

This disables the buttons fine, but when I click on a saved game and then click a button, the deselect event for each save file is triggered BEFORE the onclick event for each button. This is no good.

If I have no deselection event for each individual save file I can click on each save file and then click the load or delete buttons and every thing works fine, but the buttons never get disabled which is not ideal.

My question is:
How can I disable the buttons when an item is deselected, but still trigger the onclick event when they are selected? Are there any workarounds to this?

sentences:
Has there been any research done on ideal values for loot drop tables? I doubt many people want to grind for an item that has a 0.00001% chance to drop from a boss that takes 30 minutes to kill. I'd imagine there are certain factors that play into how rare an item should be. For example

if an item is part of a set
if the item comes from a boss vs a regular mob
how many stats/magical properties an item has

does anyone know of some research that has already been done or some data on this sort of idea. I can't be the first person to think of this.

sentences:
Game AI Implementation I'm very new to game development, but an experienced software engineer. As an introduction to game dev, I'm making a 2D zombie game in Python, using pygame. The game is almost done, but I still have to write the AI for the other humans and the different zombies in the game.

Should I have a centralized AI module that looks for the position of each character and zombie and determines the best way to move each of them? Or should each instance of a zombie or human be responsible for its own behavior?

In my mind it is more straight forward to make each unit responsible of it's own behavior and I think that it would be easier to give them a more "natural" look implementing it this way. However it's probably a lot more inefficient in memory and processing time that a centralized one. Again, I'm super new to games so any example of how is the AI implemented in some major games would be appreciated.

I understand this is probably a very subjective question, but I'm looking for an answer that covers something like pros vs cons, industry standard or known cases of each one.

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:
Good basemap generator I am currently making a board game and cannot seem to find any vector world map creators where I can select a region of the world to capture and have it download that section. I just want a base map so no city names and preferably no borders.

The map doesn't have to be vector if it is of good enough quality.

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:
Simple 2D Collision Detection Algorithm Library I'm building a simple OpenGL game and I was looking for some simple collision detection library for objects like squares, triangles and circles. Any suggestions?

PS: Preferably a library that is very well documented and provide examples of 2D collision detections.

sentences:
How to know the boundaries of an isometric tile? In a 4x4 square tile, it's easy to know which pixels are inside the tile's boundaries. I know immediately that the 4th vertical pixel is supposed to be drawn but the 5th isn't.

However, on a rhombus' shaped tile, those boundaries aren't that obvious since the picture that contains it is a rectangle. This means that, within that rectangle, there will be pixels that are supposed to be seen and pixels which aren't.

If I'm drawing an isometric tile, how would you suggest I get to know which pixels are within its boundaries and which aren't?

I thought about drawing border lines so that I can draw the texture inside but since the texture should be a power-of-two size, there's no middle pixel on each axis, so it won't be just a matter of connecting 4 dots. So I decided to connect each of the 2 middle pixels in each edge, with the closest pixel on the closest edge (1st picture on top). However, if I draw inside of them, the texture won't reach the edge, which I imagine will create gaps. If this is the case, should I draw the lines one pixel beyond those two middle pixels in each side to get the outside boundaries (2nd image on top)? Are these lines a reliable indicator of which pixels should be seen?

sentences:
Audio slider doesn't change value For some reason, my slider and audio resets back to 0 when I stop and play the game after I changed the value. Here is the code, I can't spot anything wrong with it:

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

public class MainAudio : MonoBehaviour {

public Slider slider;

void Awake()
{
    PlayerPrefs.Save ();
    GetComponent<AudioSource> ().volume = PlayerPrefs.GetFloat ("CurVol");
    if (slider)
    slider.value = GetComponent<AudioSource> ().volume;
}
public void VolumeControl(float volumeControl)
{
    GetComponent<AudioSource> ().volume = volumeControl;
    PlayerPrefs.SetFloat ("CurVol", GetComponent<AudioSource> ().volume);
    PlayerPrefs.Save ();
}
}

sentences:
How do I accept only one directional input per update? I'm coding "Snake" as my first game and I'm facing the logical fail when pressing multiple keys simultaneously eg. { up, right}; {up, left}; {down, right}, etc. Snake is able to go back and forth and eat his own body (that's not supposed to be).

My question is how can I write the keypress condition for only one press per one update is allowed?

Thank in advance.

public void update(GameContainer gc, StateBasedGame sbg, int delta) throws SlickException {
    if (dir == DOWN ) {
        head = new Point(head.getX(), head.getY() + SPEED * delta);
    }
    if (dir == UP) {
        head = new Point(head.getX(), head.getY() - SPEED * delta);
    }
    if (dir == RIGHT) {
        head = new Point(head.getX() + SPEED * delta, head.getY());
    }
    if (dir == LEFT) {
        head = new Point(head.getX() - SPEED * delta, head.getY());
    }

}
public void keyPressed (int key, char c) {
    if ((key == Input.KEY_LEFT) && dir != RIGHT) {
        dir = LEFT;
    }
    if ((key == Input.KEY_RIGHT) && dir != LEFT) {
        dir = RIGHT;
    }
    if ((key == Input.KEY_UP) && dir != DOWN) {
        dir = UP;
    }
    if ((key == Input.KEY_DOWN) && dir != UP) {
        dir = DOWN;
    }

}

sentences:
How to raycast octree for closest leaf node? So I need to raycast a octree for closest leaf node as efficient as possible. I will be doing it on compute shader (hlsl), but I think it doesn't matter because first I need to understand the approach and math behind this process in general.
My struct looks like this:
struct OctreeNode
{
    uint  size; // size of cubic node

    uint posX; // center of node
    uint posY; // center of node
    uint posZ; // center of node

    uint childExists;
    uint isLeaf;
    uint isChild;

    uint parentIndex; //Parent node index in structured buffer
    uint minchildIndex; // Node child min index in structured buffer (+1 is next child, etc)
    uint index; //Index in structured buffer
};

Octree is rather big, so I guess I can't afford to raycast everything and then compare distances. I have been looking into https://stackoverflow.com/questions/6281415/octree-raycasting-raytracing-best-ray-leaf-intersection-without-recursion , but I do not understand the answer (especially HLSL one with hitbox what is unknow thing).
Any hints, code, directions highly appreciated.

sentences:
Procedural Mesh: UV mapping I made a procedural mesh and now I want to apply a texture to it. The problem is, I cannot get it to stick the way I want it to.

The idea is to have the texture painted only once over the whole mesh, so that there is no repeating. How should I map the UV to make that happen?

My mesh is a simple plane consisting of 56 triangles. I'd add pictures to clear things up but I cannot since my reputation is below 10 points.

Any help is appreciated.

EDIT(Kind people gave me up votes, thank you):

Meet my mesh:

And when textured(tried to repeat the texture):

And my texture:

EDIT 2:

bummzack's instructions worked like a charm and the mesh got textured just as I wanted it to. Thank you.

sentences:
Libgdx is Character on Screen Inside an entity class:

public boolean onScreen(Camera camera){
    if(position.x + getWidth() > camera.position.x
            && position.x < camera.position.x + camera.viewportWidth
            && position.y < camera.position.y + camera.viewportHeight
            && position.y + getHeight() > camera.position.y){
        return true;
    } else {
        return false;
    }
}

The function returns false even when the entity is on the screen. What am I doing wrong?

sentences:
Will I have copyright issues making a mobile game based on an anime? I have been wanting to create a mobile game based on some of my favorite anime.

I want to know if using character images and names from those anime (even after giving full copyright credits and disclaimer) infringes any copyrights?

Would this come under "fair use" in the DMCA (I mean there are already so many not-so-legal sites using this "fair use" to continue running).

What are the possible things I can do for making this game? I have seen many online browser games based on anime which use images and elements from that anime, while I have also seen many games advertise themselves based on a anime but just use diffrent names for characters of that anime (sometimes modifying the character images, too).

sentences:
Why does handedness matter at all? I'm really trying to understand this from a mathematical viewpoint. After all, numbers are numbers, the chirality or handedness depends on how one interprets it.

Say I've three basis vectors x (1, 0, 0), y (0, 1, 0) and z (0, 0, 1). The same basis vectors would be seen differently by the two systems but the numbers remain the same.

When we do a cross product of x and y we'd get z in both systems, again the numbers of the result are the same, it's just the interpretation of the observer.

Then why do I see questions about handedness all the time? Is there a place where a game developer needs to differentiate and work in converting between the two really? Eric Haines in a related article uses the term "right-handed data". What does this really mean, aren't they all numbers? Why would they force a coordinate system on the user? Also do APIs like GL or DX force a system at some point? I've read somewhere that, in OpenGL the camera is always at origin looking at -Z direction, while it's the opposite in DirectX.

It'd be great if someone can list out where this convention really makes a difference and why.

EDIT: I think can explain it more explicitly since many seem to misunderstand the question (sorry, I'm not a native speaker of this tongue). Why do people talk about converting an asset for handedness? Say a triangle with coords (0, 0, 0), (0, 1, 0) and (1, 0, 0) would mean the same in both systems mathematically, where is the handedness here?

sentences:
How to apply physics when you have sub frame state changes? I'm currently calculating my physics every 1/100th of a second and using a state machine to manage the current state of the player.
In my main loop I'm checking user input and transitioning the state as needed and then my physics code checks the state to apply the appropriate forces.

Pseudo:

if (fsm.state == walking) {
    velocity += walkVelocity;
}

However, the issue I think I've noticed with this is; what if a full state transition occurs between two physics frames. For example the user taps jump so quickly they transition from jumping to falling happens so quickly that the physics code hasn't got a chance to see that a jump was requested and therefore doesn't apply the change in velocity.

This is a simple example, but I'm feeling that states maybe shouldn't be used this way. Maybe the key presses themselves need to be fed directly into the physics code (so that it can have access to durations and order of events) and then it (the physics code) updates the states accordingly.

Is this the common way of arranging flow? Or am I missing something? I.e. should it be:

  Input -> state change -> physics

Or should it be more like:

  Input -> physics -> state change

I've seen state machines used with event systems before. So state changes are raised as events which subscribers can respond to. However the physics code still needs to run at fixed timesteps so it needs to be able to query for 'things which have occurred'.

sentences:
Unity / How do I change the color of an object based on its depth? The objective here is to change the color of the nearest object.
(the nearer the object, the more "colorful" the object gets rendered; and the farther away, the more "grey" the object gets rendered), so far away objects are completely grey and close objects are in full color.
How I'm thinking about this so far:
You know, every frame, there is this certain float value, which determines if a pixel should be drawn or not. (aka z-buffer)
Can anyone tell me the variable - name of it?
Or how can I access it?
Can I even access it?
Edit:

The GPU is comparing two values: the depth of the new fragment you're
drawing (a) and the depth value of whatever's already been drawn in
that spot of the depth buffer (b).
Typically if b <= a it skips
drawing the fragment because it's behind whatever's already been
rendered previously.

I think I need both (a) and (b) variables - since I always need the nearer one.
Im not sure though...
I think its also fine if I could only access the (b) and check every frame if the previous b was smaller.

sentences:
Rotating a 3rd person camera toward a target I have a 3rd person camera that doesn't look directly at the player but somewhere in front of him.

When the user enter shooting mode, I want the camera to turn around the player to face the target.

In the image above. "O" is the player (Origin), "L" is the lookat, "C" is the camera position and "T" is the target. I want to rotate the lookat line C->L so that it passes by T (C'->L'->T') around the Origin ("O").

Basically I need to find the angle alpha that I put in red in the picture.

I store my camera position in a structure like such :

struct CameraTarget {
     Quaternion absoluteRotation;
     Vec3 absolutePosition;
     Vec3 cameraOffset;
     Vec3 lookatOffset;
     float FOV;
}

So if I could find the angle I'm looking for I could do something like :

cam->absoluteRotation = cam->absoluteRotation * alpha;

To get the player to always look at the target.

If the lookat was passing by the Origin I could simply do

Vec3 origDir = cam->lookAtOffset - cam->absolutePosition;
origDir.normalize();
Vec3 newDir = cam->target - cam->absolutePosition;
newDir.normalize();
Quaternion q(origDir, newDir); // from->to
cam->absoluteRotation = cam->absoluteRotation * q;

However in the diagram above this doesn't quite work since the rotation is offset from the Origin.

sentences:
Where to store OpenGL object id:s When working with OpenGL, you often recieve integer id:s to keep track of OpenGL objects.

For example, representing a simple mesh, you may have a number of references to objects like so:

GLuint arrayBuffer;
GLuint elementArrayBuffer;
GLuint texture;

Having many meshes, the id:s add up quickly. Therefore my problem is, where it is most logical and efficient to store them?

Alternative 1

My first thaught was to hand out the id:s to corresponding game entities. Something along the lines:

class Entity {
public:
    GLuint arrayBuffer;
    GLuint elementArrayBuffer;
    GLuint texture;
    // Other methods...
}

Then having a render class:

// Create the buffers and textures and pass id:s to entity.
renderer.init(entity);
// Render with corresponding buffer/texture id:s stored in entity
renderer.render(projection, view, entity);

Where it then is easy enough, in the implementation of the render method, just picking id:s and render with them.

Some disadvantages is that this is a leaky abstraction, where OpenGL concepts are "leaked" to game entities. Which does not feel quite right. An advantage might be that the method supposedly is efficient. You do not have to find id:s, you know them for each rendering pass.

Alternative 2

Another alternative would be to store the id:s internally in the renderer. For example, an internal data struct:

struct RenderData {
    GLuint arrayBuffer;
    GLuint elementArrayBuffer;
    GLuint texture;
}

Then having an unordered map with references to each entity and corresponding RenderData:

std::unordered_map<unsigned int, RenderData> render_data;

Then in the rendering method, the correct render data is fetched from the map only by a unique id that is stored in each entity.

Advantages of this approach, is that it is less "leaky", where only the entity id is passed to the renderer, to know what data to use. Disadvantages may be slightly less efficiency, because of lookups in the unordered map?

I would greatly appreciate inputs on this, what approach to prefer, or if there are any other approaches out there?

sentences: How can I handle copyrighted music? I have a curious question regarding on musics used in music rhythm game. In Guitar Hero for example, they used all different music albums in one program. Then, each album requires to ask permission to the owner, composer of the music, or the copyright owner of the music. Let's say, if you used 15 albums for the music rhythm game, then you have to contact 15 copyright owners and it might be that, for the game developer, that the profit earned goes to the copyright owner or owner of this music. For the independent game developers, was it okay if either used the copyright music by just mentioning the name of the singer included in the credits and in the music select screen or use the non-popular/old music that about 50 years ago? And, does still earn money for the indie game developers by making free downloadable game?

sentences:
Playtesting Own Game - How To Be Objective? I am currently working on an iPhone game and am having trouble playtesting to find out which parts of the game are fun and which need to be reworked.  As I sit down to play the various iterations, my feeling towards the gameplay and mechanics shift as I work through the same parts of the game over and over... and over.  Some parts that I think are super fun might be tedious to someone new to the game and vice versa.  My goal would be to create a game that maintains good pacing, advancement and skill progression for someone who just picked up the game, but I'm not sure how to test for that.

I try to keep an objective mindset and  I do have one quality assurance technician (my wife), but she is playing the game almost as much as me and thus loses that "newbie" mindset.  I don't have the resources to find and use third party testers (yet) and I would like to have my game be in a more completed state before I have even a closed beta test.

Does anybody have any tips or ideas on how to find out if my game really is fun or if it's just my mind playing tricks on me after the 1000th round?

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:
Loading large bitmaps in Android In a few games in the Android Market/Google Play Store, huge bitmaps are drawn onto the screen.

For example, the game Unicorn Dash:

and Robot Unicorn Attack:

I'm assuming the entire island (which is multiple screens long) is loaded into memory. With probably around 10 different islands, how can something like this be possible? I've attempted to do something similar in one of my games, but I always ran out of memory. The bitmaps are (estimated) at around ~2000px x 500px at the largest which comes out to about 4mb each uncompressed? If you had 10 of them it would require 40mb of memory! So obviously I'm missing something.
Is it plausible to be loading and unloading bitmaps into memory while the game runs? Or is there some other technique that I'm not aware of?

EDIT:

I extracted the images from Robot Unicorn Attack and saw that they were indeed whole images (not split up) of around 2000*500 pixels.

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:
How do I set a touch listener in a child scene in AndEngine? In my game, I want to implement touch listener for my child scene objects. Basically I tried all the possible way to implement this that I have usually done for my normal scenes, but those methods do not work here. Could somebody provide some guidance for setting touch area listener in child scene?

Here is my code:

    menuScene.setTouchAreaBindingEnabled(true);

    menuScene.registerTouchArea(resumeButtonSprite);
    menuScene.registerTouchArea(retryButtonSprite);
    menuScene.registerTouchArea(exitButtonSprite);

    menuScene.setOnAreaTouchListener(new IOnAreaTouchListener() {

        @Override
        public boolean onAreaTouched(TouchEvent pSceneTouchEvent,
                ITouchArea pTouchArea, float pTouchAreaLocalX,
                float pTouchAreaLocalY) {
            System.out.println("Touch");
            return true;
        }
    });

In this code, menuScene was a child scene activity.

Also after research I found that my engine was stopped while the child scene was activated so the touch event is not detected. I want to implement a pause menu in my game so any desirable solution for a pause menu implementation would help.

sentences:
Navigation Mesh, Chunks and Funnel Algorithm I am building a little RTS-like game as a side project and I am currently working on pathfinding. My approach to pathfinding is heavily inspired by things I saw in the Starcraft II map editor, which enables diagonal obstacles. My map consists of tiles that are subdivided into 4 triangles each and each triangle can be passable or not passable. I then build a navigation mesh by generating polygons (with holes) of the passable area and then triangulating them. See the following pictures for an example:

The colored areas are the triangulated polygons that make up the navigation mesh.

As an optimization I thought it would be a good idea to subdivide the map into chunks (i.e. 32x32 grid tiles) to allow for fast updates of the mesh (as soon as a triangle changes from passable/impassable I rebuild the whole chunk and update the navigation mesh accordingly). See the following picture for an example:

The red lines are the chunk borders (which is also why the color of the navigation mesh sometimes changes accross the borders).

The triangulation is a separate constrained delaunay triangulation for each chunk. For the chunk-wise updates to work I had to introduce constraints at the chunk borders for the triangles to line up. Up until now everything seemed to work fine. I then went to implement some pathfinding using A* on edge midpoints and path smoothing using the Simple Stupid Funnel algorithm (see "Efficient Triangulation-Based Pathfinding" by Demyen and Buro or How does the Simple Stupid Funnel Algorithm work?).

The problem is now that some triangles have their vertices at chunk borders that don't correspond to an obstacle. If such a triangle is part of a path found by A* the funnel algorithm uses it if it was a corner point of an obstacle and produces a wrong path. See the folowing picture for an example:

The red area is the passable area and has no obstacles inside. The green path is the path as it is found by e.g. A* and the blue path is the smoothed path using the funnel algorithm. Since there is an extra vertex in the navigation mesh introduced by the the chunk borders (where the 4 chunks meet) the funnel algorithm handles it the same as if it was the corner of an obstacle and thus the path is not a straight line but takes a detour around the corner. Ultimately I wanted to implement something along the lines of "Compromise-free Pathfinding on a Navigation Mesh" by Cui, Harabor and Grastien to find truly optimal paths in a navigation mesh. But all of those methods seem to assume that the navigation mesh contains no extra vertices except for the corners of obstacles (and the outer border of course).

I am looking for a solution for the problem of splitting the map into chunks for efficient updates of the navigation mesh while still being able to find optimal paths in an efficient manner (e.g. i don't want to do real line of sight checks instead of the funnel algorithm). My only other option it seems would be an algorithm for dynamic constrained delaunay triangulations and having a single triangulation for the whole map (since this would not introduce extra obstacles) which for one is pretty complicated and second (and more importantly) doesn't scale.

I know that this is a pretty open question. I hope it comes clear what I am looking for, since it was kind of difficult to phrase the problem :D
If anything needs clarification, please tell me :D

sentences:
How can I position different size creatures in a group automaticly I'm doing a game (in xna) on my free time, as I'm not in the game market, I'm pretty sure I'm missing something that would help me get this right.  Think of Ogre Battle. A group of unit moves, and when they cross enemy, a small automatic Final fantasy battle starts for 2 or 3 round.

I'm struggling on how I should place the creatures in the combat screen. A fight started. (final fantasy rpg battle ) The creatures part of this group needs to be positionned in a 16x16 grid. Some creatures are bigger and use larger than 1x1 square.

I create a class called group to represent groups of creature walking around. So far, I decide to put in an array of 4x4 representing the grid. How do I go around and position all the creatures on that grid and make sure they arent stepping on top of each other ?

some pseudo code I have right now :

 Class Group
  array(4,4) of rectangle
  array(4,4) of creature

  Public sub Update()
    adjustCreaturePosition
  end sub
End class

Class Creature
    CombatValue as List of Enum.Qualities
    PreferedPosition as Enum.Position
    Range as smallint( 1 = melee, 2 = small range, 3 = long range)
End Class

 Public Enum Position
  Front
  Middle
  Back
 End Enum

 Public Enum Qualities
    Melee
    Armored
    Strengh
    Dodge
    Siege
    SmallRange
    DPS
    Nuker
    Controller
    Buffer
    Dex
    Int
    Sick
    Weak
End Enum

In the update of the group class , I need to create a function to set the position of all creatures when the combat starts.

Private Sub AdjustCreaturePosition()
       ' check the "prefered position" of all creep ( front, middle, back).
       ' if there are no more spot left for a creature, I need to check which creature is moved to the middle row based on A. if one of the creature on the front row will be able to attack on middle row ( based on the range ). If no unit can attack from the middle row,  the weaker one is send on the back ( the sum of their combatValue list)
    Next
End Sub

I got no idea how I'll do the AdjustCreaturePosition in a smart way yet. but lets say it works.
Where I'm at a loss is how should I handle large creature who needs a 2x2 grid ?

sentences:
Randomly spawning bitmaps on cnvas I need some ideas in order to finish algorithm. I'm randomly placing objects (bitmaps) on canvas without overlapping. Time needed to finish it is my problem. When I need to spawn for example 80% of canvas it takes to long. So i was thinking : I should make some change when the bitmaps take off 50 % of canvas. I want to tell algorithm that it should generate new locations (x,y) where it is free space.

My question is : How to render new location (x,y) in place where is free space.

In summary:

Things I know :

object location (x,y)
4 corners (x,y) of object
object width, height
canvas width, height

Any suggestions?

Thanks for ideas. Now I've got problem.

OK, thanks for ideas. I've got a problem.

Link to picture: Picture with grid

I'm incrementing number of objects in cell after each adding object to grid. In the picture there are 9 possible locations for object.  Should I check 9 conditions which tells where I should increment number of objects in cell? I assume that if object is on both cells than I increment number of objects in both cells.

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

Here is What i Try TO Achieve :

Default 3DS Max :

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

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

sentences:
Problem with Parameters for polymorphism class This is going to be a bit tricky but it is really bothering me so I hope you will have the patience to follow along :)
Here is my very basic architecture:

So in the framework, I am creating I have Actions these currently have a list of Conditions or Considerations (same thing different name).
While each Condition share some of the same functionality  such as:

Returning a float score
Using an evaluation formula

They implement these in very different ways depending on the situation.
Take a look at the following code:
[CreateAssetMenu(fileName = "Consider my health vs max health",
    menuName = "AnAppGames/AI/Example/Decisions/Health Consideration")]
public class MyHealth : BaseConsideration
{
    private float health;
    public float maxHealth;

    public override float Consider<T>(BaseAiContext context, BaseAction action, T value)
    {
        health = value as float;
        return EvaluateValues(health / maxHealth);
    }

}

What you are looking at is my first attempt at making some sort of "reusable" Consideration.
Now in the continuation of my development, I had to make the following Consideration:
public class DistanceFromMe : BaseConsideration
{
    public float minRange;
    public float maxRange;

    private float ConsiderWithValues(Transform target, Transform caller)
    {
        return EvaluateValues(new FloatData(Vector3.Distance(target.transform.position, caller.position),
            minRange,
            maxRange).GetNormalizedData());
    }

    public override float Consider<T>(BaseAiContext context, BaseAction action, T value)
    {
        Transform target = value as Transform;
        if (target == null)
        {
            return 0;
        }
        return ConsiderWithValues(target.transform, context.transform);
    }

    public override float Consider(float x)
    {
        return EvaluateValues(new FloatData(x,
            minRange,
            maxRange).GetNormalizedData());
    }

}

And now the trouble begins I thought "This is not a scaleable solution" as soon as I need more than 1 generic parameter I am screwed and have to create additional overrides of this Consider function.
So what I need is somehow to add different types of parameters to the Consideration however these parameters will vary a lot.
Another problem I have with this is that when I loop through the list I won't be able to tell what parameters i needed and how to fulfill the needs of the Consideration.
I thought of different ways of dealing with this inside the editor but I have come up empty :(
Can anyone help me out with this architectural mess? :)
It is worth mentioning that at the current point each of these are ScriptableObjects I am not 100 set in the fact that they should be but i am just not sure how to deal with this problem.

sentences:
AI: Learning vs. Strategizing I have a theory on AI that I would like to write a "whitepaper" about. The distinction I want to explore in AI is learning vs. strategizing. My question is, where can I read other material about this subject?

Let me give a chess example. Let's look at a chess AI as a max-tree, where capturing an enemy unit adds that unit's value to the "move score" for that decision (and likewise losing a piece subtracts that value to the score). Capturing a pawn might net 1 point, a knight 4 points, a rook 5 points, etc.

Strategizing would be AI to apply these points and determine the next move; eg. given ten possible moves, pick the best (max score) at the end of three moves.

Learning would be applying statistical observation to determine those values. If you play 100 games, the AI might decide that capturing a pawn is 2 points, and a knight is worth 7 points, while a rook is only worth 3 points (based on 100 gameplays).

Does this distinction already exist in literature, and if so, where can I read about it?

Edit: Does anyone know a Chess game (with source-code preferably) that utilizes this approach? Maybe Chess960@Home?

sentences:
How can I find the right UV coordinates for interpolating a bezier curve? I'll let this picture do the talking. I'm trying to create a mesh from a bezier curve and then add a texture to it. The problem here is that the interpolation points along the curve do not increase linearly, so points farther from the control point (near the endpoints) stretch and those in the bend contract, causing the texture to be uneven across the curve, which can be problematic when using a pattern like stripes on a road. How can I determine how far along the curve the vertices actually are so I can give a proper UV coordinate?

EDIT: Allow me to clarify that I'm not talking about the trapezoidal distortion of the roads. That I know is normal and I'm not concerned about. I've updated the image to show more clearly where my concerns are.

Interpolating over the curve I get 10 segments, but each of these 10 segments is not spaced at an equal point along the curve, so I have to account for this in assigning UV data to vertices or else the road texture will stretch/shrink depending on how far apart vertices are at that particular part of the curve.

sentences:
Return value from coroutine to non monobehaviour I have a class which is not a monobehaviour (lets call it "Generation"), and as such running CoRoutines from within are not an option.

I have a monobehaviour (lets call this "TestScript") which needs to call a function within Generation. One parameter required is a Func>.  It then calls that Func multiple times, expecting a result in the form of a double. The problem, is that it takes time to return, it needs to run across many frames, and so it kicks off some Coroutines (as this is in the monobehaviour). I set it to return a Task so that I could use Threading.SpinWait.SpinUntil and only return after the coroutines have exited, but this just hangs the main Unity thread.

Here is the function I am calling:

        public void AssessGeneration(Func<NeuralNet, Task<double>> assessment)
        {
            foreach (NeuralNet neuralNet in neuralNets)
            {
                neuralNet.Fitness = assessment(neuralNet).Result;
                neuralNet.fitnessAssessed = true;
            }
        }

So, I've tried many other things, such as moving the SpinWait into the Generation class, but still hangs. I've tried calling the function in Generation within a Task on a new thread, but when it attempts to run the coroutines it complains about not being on the main thread.

So - I have a function, in a class not inheriting from MonoBehaviour. It is called from a MonoBehaviour, and must pass in a function which takes a parameter of type NeuralNet, and returns a double. It must return a double after a coroutine has finished, but I can't be blocking the main thread.

sentences:
RenderTexture is not cleared after it was released I want to create some image effect. I've written a script that draws a cube mesh at the render target and then copies the render texture at the screen. I don't want to render anything except Mesh(M) in my RenderTexture(rt):

    void OnRenderImage(RenderTexture src, RenderTexture dest)
    {
        RenderTexture rt = RenderTexture.GetTemporary(Screen.width / 1, Screen.height / 1 );

        Graphics.SetRenderTarget(rt);
        Graphics.DrawMeshNow(M, new Vector3(0.0f, 0.0f, -8.0f), Quaternion.identity);
        Graphics.Blit(rt, dest);

        Graphics.SetRenderTarget(null);
        RenderTexture.ReleaseTemporary(rt);
    }

Where M is GameObject.CreatePrimitive(PrimitiveType.Cube).GetComponent<MeshFilter>().sharedMesh;

When I moved my camera, I see this:

It seems like the RenderTexture didn't cleared itself when released. Or maybe I did something wrong? Please explain why this happened and how can I fix this.

sentences:
OpenGL: What's the best way to convert a screen coordinate to a world coordinate? For example, suppose I'm building a first-person shooter and the player pulls the trigger. I want to convert the screen coordinate (x, y) into a world coordinate (x, y, z) to know what they've hit.

I've seen some people mentioning a lookup using glReadPixels, but I've heard it's slow and those references were years old, so I'm not sure if this is the best way.

I'm working with core OpenGL 3.3, not ES. gluUnProject is not part of the API I'm asking about.

These types of answers would be most helpful:

An explanation of how to retrive a pixel's (x, y, z) value using glReadPixels and how to transform that into world coordinates. I know how to multiply by inverse matrices; I don't know exactly what steps OpenGL takes to arrive at its depth buffer value.
Or, an explantion of how to do something similar, perhaps more efficiently, with a pixel buffer object.
Or some method that I don't even know about that's better than either of the above.

For some context: I have many months' worth of code into a game I'm developing in OpenGL using the core 3.3 profile. I'm using minimal libraries and not the old fixed-function GL pipeline, which is why it does not make sense for me to use gluUnProject. I mention this to highlight why this question is not the duplicate of a currently-linked older question.

Note: I previously mentioned a shader idea that did not add much to the question, so I removed it. I also edited the question to clarify the context and the type of answer I am looking for.

sentences:
How to block the player from moving left and right from two empty game objects? I made the game space shooter in that game my spaceship move left and right but its not stop in right and left corner. When its move to left its go out of the screen. how i stop/block in the left and right screen edges.

using UnityEngine;
using System.Collections;

public class PlayerMovement : MonoBehaviour {
    public float speedMove = 3;
    public float bonusTime;
    private Rigidbody rb;
   private float _limit = 3;

    // 1 for right and -1 for left.
    private float _direction = 1;

    // You can call it as speed
    private float _speed = 0.01f;

    private bool toLeft = false;
    private bool toRight = false;

    public GameObject shield;
    public GUIText bonustimeText;

    private bool counting = true;
    private float counter;

    private Weapon[] addWeapons;

    public Sprite strongShip;
    public Sprite normalSprite;
    public Sprite shieldSprite;

    private SpriteRenderer sRender;
    private Weapon weaponScript;

    void Start () {

        counter = bonusTime;
        rb = GetComponent<Rigidbody>();

        sRender = GetComponent<SpriteRenderer> ();
        addWeapons = GetComponentsInChildren<Weapon> ();
        foreach (Weapon addWeapon in addWeapons) {
            addWeapon.enabled = false;
        }

        weaponScript = GetComponent<Weapon>();
        weaponScript.enabled = true;
    }

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

        transform.position = Vector3.MoveTowards (transform.position,new Vector3 (transform.position.x + _direction, transform.position.y, transform.position.z),_speed);

        if (Input.GetMouseButtonDown (0))
            _direction *= -1;

    }

    void OnCollisionEnter2D(Collision2D coll)
    {
        if (coll.gameObject.tag == "StrongMode") {
            Destroy (coll.gameObject);
            counting = true;
            StrongMode();
            Invoke ("Downgrade", bonusTime);
        }

        if (coll.gameObject.tag == "ShieldMode") {
            Destroy (coll.gameObject);
            counting = true;
            ShieldMode();
            Invoke("Downgrade", bonusTime);
        }

        if (coll.gameObject.tag == "Life") {
            GUIHealth gui = GameObject.Find ("GUI").GetComponent<GUIHealth> ();
            gui.AddHealth();
            SendMessage("AddHp");
            SoundHelper.instanceSound.PickUpSound();
            Destroy(coll.gameObject);
        }

        if (coll.gameObject.tag == "Enemy") {
            SendMessage("Dead");
        }
    }

    void Downgrade()
    {
        SoundHelper.instanceSound.BonusDownSound ();
        counting = false;
        bonustimeText.text = "";
        counter = bonusTime;

        sRender.sprite = normalSprite;
        weaponScript.enabled = true;
        foreach (Weapon addWeapon in addWeapons) {
            addWeapon.enabled = false;
        }
        weaponScript.enabled = true;
        shield.SetActive (false);
    }

    void StrongMode()
    {
        SoundHelper.instanceSound.BonusUpSound ();
        sRender.sprite = strongShip;
        foreach (Weapon addWeapon in addWeapons) {
            addWeapon.enabled = true;
        }
        weaponScript.enabled = false;
    }

    void ShieldMode()
    {
        SoundHelper.instanceSound.BonusUpSound ();
        sRender.sprite = shieldSprite;
        shield.SetActive (true);
    }

//  void OnDestroy()
//  {
//      bonustimeText.text = "";
//  }
}

sentences:
Stopping player from spamming movement keys which causes glitches Unity C# I wrote a script for the player movement in c#. Whenever the player presses A or D, it moves him/her to the left or right by 12 units and when the player presses W or S, it moves him/her up or down by 12 units. My script works fine, but if a person starts to spam all of the keys at once, it glitches out and the player object is not in line with the level anymore. I want to have the script check if there a movement is currently happening before executing the movement on the keypress. Here is my script:

void Update () {

    transform.Translate(Vector3.forward * ForwardSpeed * Time.deltaTime);

    if (Input.GetKeyDown (KeyCode.A) && side > maxSideLeft) {
        MoveObjectTo(this.transform, new Vector3(this.transform.position.x - 12, this.transform.position.y, this.transform.position.z + 10), movementSpeed);
        side -= 1;
    } else if (Input.GetKeyDown (KeyCode.D) && side < maxSideRight) {
        MoveObjectTo(this.transform, new Vector3(this.transform.position.x + 12, this.transform.position.y, this.transform.position.z + 10), movementSpeed);
        side += 1;
    }

    if (Input.GetKeyDown (KeyCode.W) && level < maxLevelHeight) {
        MoveObjectTo(this.transform, new Vector3(this.transform.position.x, this.transform.position.y + 12, this.transform.position.z + 10), movementSpeed);
        level += 1;
    } else if (Input.GetKeyDown (KeyCode.S) && level > minLevelHeight) {
        MoveObjectTo(this.transform, new Vector3(this.transform.position.x, this.transform.position.y - 12, this.transform.position.z + 10), movementSpeed);
        level -= 1;
    }

    if (Input.GetKeyDown (KeyCode.R) || Input.GetKeyDown(KeyCode.Space)) {
        SceneManager.LoadScene ("Scene1");
        Time.timeScale = 1;
    }
}

private void MoveObjectTo(Transform objectToMove, Vector3 targetPosition, float moveSpeed)
{
    StopCoroutine(MoveObject(objectToMove, targetPosition, moveSpeed));
    StartCoroutine(MoveObject(objectToMove, targetPosition, moveSpeed));
}

public static IEnumerator MoveObject(Transform objectToMove, Vector3 targetPosition, float moveSpeed)
{
    float currentProgress = 0;
    Vector3 cashedObjectPosition = objectToMove.transform.position;

    while (currentProgress <= 1)
    {
        currentProgress += moveSpeed * Time.deltaTime;

        objectToMove.position = Vector3.Lerp(cashedObjectPosition, targetPosition, currentProgress);

        yield return null;
    }
}

sentences:
C++ OpenGL / SDL2 VBO -- Depth problem / Transparency I got a problem with my VBO.
When having textures. The far blocks overlay the near ones.

I tried editing the alpha, depth buffer, the VBO byte allocation.
Nothing works for me...

The FAR plane is overlapping the NEAR plane.

    //Alpha
glEnable(GL_BLEND);
glBlendFunc(GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA);

glEnable(GL_DEPTH_TEST);
glDepthFunc(GL_LEQUAL);
glEnable(GL_CULL_FACE);
glDisable(GL_MULTISAMPLE);

glDepthMask(GL_TRUE);

sentences:
The character does not stand still on the moving platform I'm trying to create a simple platforming game. I have an animated platform moving in 2 opposite directions. I use this simple code to make the character move along with the platform while he is standing on it:

public class PlatformMoving : MonoBehaviour
{
    private void OnTriggerEnter(Collider other) => other.transform.parent = transform;

    private void OnTriggerExit(Collider other) => other.transform.parent = null;
}

The character moves with CharacterController.Move(). When he stands still on the platform and movement vector equals to Vector3.zero, he moves in the direction opposite to the platform movement direction and can even fall down from the platform. But if I comment charController.Move(movement) line in a character motion script, everything works properly and the character does not move when he shouldn't do that. How to solve it?

sentences: LibGDX, Box2D , Destroy body into parts I am developing a game using libGDX game engine and box2d physics engine. There are asteroids in my game, I want to destroy their bodies randomly and fill with texture. How can I do it?

sentences:
Remove delay when changing axis input in the Unity Input Manager I had a problem playing with the Input Manager, where for example:

When Horizontal (+) is pressed, it increase its value but, when Horizontal (-) is pressed, the horizontal value stays positive for a little, but keeps decreasing. This causes the character to continue playing "right" animations and still moving to right for a few seconds, instead of instantly playing 'left" animations and moving to left. The problem also makes the character movie a little after the player releases the key.

I have also used Input.GetKey(), but that means the player cannot change the setting from the game launcher, and I don't want to create player setting in-game, for now.

What I am trying to achieve is when Horizontal (+) is pressed, then the player presses Horizontal (-), it should instantly turn left without delay. When the player is not pressing any Horizontal key, it should stop moving horizontally, instantly. This problem also appears along the Vertical axis.

How do I make it so input snaps to -1 or 1, with out slowly moving back and forth?

sentences: Dynamically editing a movieclip at runtime I am trying to make a flash game(actionScript-3 if it matters) to test what I learned so far. And, in the game, I want to make the character(a robot?) customizable. The first solution I found was to edit the character movieclip directy. Is it possible to edit a movieclip at runtime? If yes, how?

sentences:
OpenGL cubemap binding I'm experimenting a strange behaviour of textures inside my shaders.
Basically I need and bind two cubemap textures inside my shader but only one gets actually bound.

I've tried swapping the two textures keeping the samplers untouched and the texture that previouly I could see now I don't see it anymore, so I think the problem is related to the samplers inside my shader.

This is how I bind my two cubemaps to the shader:

int firstTextureLocation = glGetUniformLocation(programID, "ConvolutionSrc");   // returns 5
int secondTextureLocation = glGetUniformLocation(programID, "LastResult");      // returns 9

glActiveTexture(GL_TEXTURE0);
glBindTexture(GL_TEXTURE_CUBE_MAP, _firstTextureID);
glUniform1i(firstTextureLocation, 0);

glActiveTexture(GL_TEXTURE1);
glBindTexture(GL_TEXTURE_CUBE_MAP, _secondTextureID);
glUniform1i(secondTextureLocation, 1);

And this is a portion of my shader (the parts where the cubemaps are used):

uniform samplerCube ConvolutionSrc;
uniform samplerCube LastResult;
...

vec3 Sample(vec3 R)
{
    ...
    vec3 hdrPixel = rescaleHDR(textureLod(ConvolutionSrc, L, lod).rgb);
    ...
}

void main()
{
    ...
    vec3 lastResult = textureLod(LastResult, R, ConvolutionMip).rgb;
    sampledColor.rgb = mix(lastResult.xyz, importanceSampled.xyz, 1.0f / (ConvolutionSamplesOffset));
    ...
}

Basically only the texture at uniform location 5 of my shader gets bound.

sentences:
Handle many lights in a scene (with shaders) I'm curious about how to handle many lights in a scene. Given a very big map in a role playing game, with dungeons (with lights in there) etc. I know about deferred lighting, but that only answers how to render many lights. But my question is more: How to not render many lights. It's obviously desirable to only render the lights effecting the scene, but I don't know a technique/an algorithm to archive this. Nobody wants or is even able to render 500 point lights, just because there somewhere in the map. But one cannot just take a straight line from the light to the player and test if something is in between. The distance also doesn't seem like a good indicator. (Sunlight?)

tl;dr: How can I figure out which lights affect the scene to only render them?

sentences:
Material, Pass, Technique and shaders I'm trying to make a clean and advanced Material class for the rendering of my game, here is my architecture:

class Material
{
    void sendToShader()
    {
        program->sendUniform( nameInShader, valueInMaterialOrOther );
    }

private:

    Blend       blendmode;      ///< Alpha, Add, Multiply, …
    Color       ambient;
    Color       diffuse;
    Color       specular;
    DrawingMode drawingMode;    // Line Triangles, …
    Program*    program;
    std::map<string, TexturePacket> textures;   // List of textures with TexturePacket = { Texture*, vec2 offset, vec2 scale}
};

How can I handle the link between the Shader and the Material? (sendToShader method)
If the user want to send additionals informations to the shader (like time elapsed), how can I allow that? (User can't edit Material class)

Thanks!

sentences: Unity Button Without an Image? I want to create a button whose clickable area is only specified by a BoxCollider with Unity's new UI (similar to how you would do it from within NGUI). I can't get a Unity Button to work without the presence of an Image component (which ultimately represents the clickable area of the button).

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:
Tile Based Sprite Collision With Lots of Sprites I am running into lag when loading many sprites onto the screen. If I have less than 12 on the screen it runs smoothly until I add a couple more and then it bogs down.

I currently have this as my detection code;

public void Collision(Sprite sprite, Rectangle newRectangle, bool passable, bool speedRestricted, int xOffset, int yOffset)
        {// Tile boundaries
            if (sprite.Bounds.Top(newRectangle) && passable == false)
            {
                animation.Position = new Vector2(sprite.Position.X, (newRectangle.Y - sprite.Bounds.Height));
            }
            if (sprite.Bounds.Left(newRectangle) && passable == false)
            {
                animation.Position = new Vector2((newRectangle.X - sprite.Bounds.Width), sprite.Position.Y);
            }
            if (sprite.Bounds.Right(newRectangle) && passable == false)
            {
                animation.Position = new Vector2((newRectangle.X + sprite.Bounds.Width), sprite.Position.Y);
            }
            if (sprite.Bounds.Bottom(newRectangle) && passable == false)
            {
                animation.Position = new Vector2(sprite.Position.X, (newRectangle.Y + sprite.Bounds.Height));
            }
}

It is called in like this;

foreach (var tile in map.CollisionTiles)
        {
            player.Collision(player, tile.Rectangle, tile.Passable, tile.SpeedRestricted, map.Width, map.Height);

            foreach (var sprite in sprites)
            {
                sprite.Collision(sprite, tile.Rectangle, tile.Passable, tile.SpeedRestricted, map.Width, map.Height);
            }
        }

Now collision detection works perfectly so I don't have an issue there it's just when there are lots of sprites in my List<Sprite> sprites does it lag. If I remove the collision detection from the code I can load thousands of sprites onto the map.

Question:
How do I limit the detection area for the sprites so it only compares the tiles around the sprite instead of all the tiles on the map for each sprite.

I have looked through the other questions and found none when it comes to multiple sprite detections for tile maps, just the main player's collision detection.

sentences:
Effect version is unrecognized. This runtime supports fx_5_0 to fx_5_0 I'm reading the "Introduction to 3D game programming with DirectX11" (Frank Luna) and i'm having problems with lighting.
I have this error: Effect version is unrecognized.  This runtime supports fx_5_0 to fx_5_0.
When i use the D3DX11CreateEffectFromMemory function i have that error and an exception (this->mFX was nullptr)
Can you help me? Thanks
EDIT: I have no D3DCompileFromFile

std::ifstream fin("Ligthing.fx", std::ios::binary);
        ///
        fin.seekg(0, std::ios_base::end);
        int size = (int)fin.tellg();
        fin.seekg(0, std::ios_base::beg);
        std::vector<char> compiledShader(size);

        fin.read(&compiledShader[0], size);
        fin.close();
        hr=D3DX11CreateEffectFromMemory(&compiledShader[0], size, //ERROR IS HERE
            0, device, &mFX);

        if (FAILED(hr)) {
            MessageBox(0, L"err", 0, 0);
        }

sentences:
Texture being rendered to main frame buffer? I'm using Ogre 1.10.12 (openglES2 as render system) to create a manual texture like this:

    rtt_texture = Ogre::TextureManager::getSingleton().createManual("RttTex",
                                                                Ogre::ResourceGroupManager::DEFAULT_RESOURCE_GROUP_NAME,
                                                                Ogre::TEX_TYPE_2D,
                                                                m_size.width(),
                                                                m_size.height(),
                                                                0,
                                                                Ogre::PF_A1R5G5B5,
                                                                Ogre::TU_RENDERTARGET);

m_renderTexture = static_cast<Ogre::GLES2FBORenderTexture *>(rtt_texture->getBuffer()->getRenderTarget());

m_renderTexture->addViewport(m_camera);
m_renderTexture->getViewport(0)->setClearEveryFrame(true);
m_renderTexture->getViewport(0)->setBackgroundColour(Ogre::ColourValue::Red);
m_renderTexture->getViewport(0)->setOverlaysEnabled(false);

then, I bind the texture to the FBO and retrieve the FBO's ID like:

Ogre::GLES2FrameBufferObject *ogreFbo = 0;
m_renderTexture->getCustomAttribute("FBO", &ogreFbo);
Ogre::GLES2FBOManager *manager = ogreFbo->getManager();
manager->bind(m_renderTexture);

GLint id;
glGetIntegerv(GL_FRAMEBUFFER_BINDING, &id);

My concern is that id is 0 so I cannot render this texture outside my display, it's getting visible which I don't want it to be.

Shouldn't be ogre creating an unused frame buffer object when creating a manual texture with the TU_RENDERTARGET parameter?

sentences:
Moving a GameObject to a position, waiting, and then moving it again Hello hello :) Ive been attemping to move a platform (a door basically), and it has partually worked. What works so far is i can move an object from A to B and wait, however it will not move it towards C afterwards, here is my code (note that all of the Debug.Logs work). Here is my code.

 public class OpenDoor : MonoBehaviour
{
    public Transform origPos;
    public Transform targetPos;
    public float speed;
    public GameObject button;
    private ButtonScript bs;

    private void Start()
    {
        bs = button.GetComponent<ButtonScript>();

    }

    void Update()
    {
        if (bs.buttonActive) {
            Debug.Log("Button Active 2");
            StartCoroutine(MovePlatform());
            bs.buttonActive = false;
        }
    }

    IEnumerator MovePlatform()
    {
        float step = speed * Time.deltaTime;
        bool arrived = false;
        while (!arrived)
        {
            transform.position = Vector3.MoveTowards(transform.position, targetPos.position, step);
            if (Vector3.Distance(transform.position, targetPos.position) == 0)
            {
                Debug.Log("DISTANCE 0");
                arrived = true;
            }
            yield return null;
        }
        if (arrived) {
            Debug.Log("Arrived");
            yield return new WaitForSeconds(1);
            Debug.Log("Waited");
            transform.position = Vector3.MoveTowards(transform.position, origPos.position, step);
        }

    }
}

Any assisstance would be greatly appreciated :)

sentences: Dynamic Aspect Ratio in Unity (for Anti-Aliasing) I am using HDRP with 1920x1080 resolution. The anti-aliasing works very well if the screen resolution increases and it works really bad if the screen resolution is lower than 1920x1080. Why does this happen? Is there a way to overcome this?

sentences:
What are the maths behind 'Raiden 2' purple laser? The path of the laser is affected by user input and enemies present on the screen.
Here is a video, at 5:00 minutes the laser in question is shown : Raiden II (PS) - 1 Loop Clear - Part 2

UPDATE

Here is a test using Inkscape, ship is at bottom, the first 4 enemies are targeted by the plasma.
There seems to be a sort of pattern. I moved the ship first, then the handle from it to form a 45° angle, then while trying to fit the curve I found a pattern of parallel  handles and continued so until I reached the last enemy.

Update, 5/26/2012 : I started an XNA project using beziers, there is still some work needed, will update the question next week. Stay tuned !

Update : 5/30/2012 : It really seems that they are using Bézier curves, I think I will be able to replicate/imitate a plasma of such grade. There are two new topics I discovered since last time : Arc length, Runge's phenomenon, first one should help in having a linear movement possible over a Bézier curve, second should help in optimizing the number of vertices. Next time I will put a video so you can see the progress 8-)

sentences:
Force Reload VS soution Explorer when adding new c# Script via Unity3d? When I create C# script (Create -> C# Script) via Unity3d  or delete it from Unity3d - Visual Studio shows me the warning window.

it's annoying.

Is there any way to force "ReloadAll" in solution Explorer without the window?

sentences:
ForceMode in AddTorque in Unity game development In UNITY game development platform while programming in C# I came across a method to add torque to component: public void AddTorque(float x, float y, float z, ForceMode mode = ForceMode.Force);
In this Function what is meant by ForceMode?

sentences:
Calling function every n second javascript game I making a game and I want to call a function that runs every random second to spawn something every time. I've seen some posts that said to use the setInterval() function to keep track of the time but I don't know where to implement it because I'm using the requestAnimationFrame() to loop the game. I also tried to implement it in the update function of the classes but it doesn't seem to work.
This is my main with the loop
import Game from '/src/game.js';

let canvas = document.getElementById('main');
let ctx = canvas.getContext('2d');

const WIDTH_SCREEN = 800;
const HEIGTH_SCREEN = 600;

let game = new Game(WIDTH_SCREEN, HEIGTH_SCREEN);
game.start();

function loop() {
    ctx.clearRect(0, 0, WIDTH_SCREEN, HEIGTH_SCREEN);

    game.update(ctx);

    requestAnimationFrame(loop);
}

window.addEventListener("keydown", (event) => game.controller.keyListener(event));
window.addEventListener("keyup", (event) => game.controller.keyListener(event));
requestAnimationFrame(loop);

sentences:
Extending a ScriptableObject to have a get property instead of a field, without losing serialized data I have a ScriptableObject that's already used extensively in my project:
public class SFXClip : ScriptableObject
{
    public AudioClip clip;

    // other properties
}

I want to extend it to a derived version something like this:
public class SFXRandom : SFXClip
{
    [SerializeField] List<AudioClip> audioClips;

    override public AudioClip clip
    {
        get
        {
            return audioClips[Random.Range(0, audioClips.Count)];
        }
    }
}

But of course, I can't do that without making the clip field on the original object into a virtual property. If I do that, I'll lose all the AudioClip references in existing SFXClip instances in my project's Assets.
Is there a way I can implement this change without losing that data?

sentences:
Flickering or jagged movements when sprites move along a curvilinear path I'm making a top-down zoomable 2D game. I can't achieve a perfectly smooth curvilinear movement of the sprites, not even when I have a pixel perfect reproduction. I tried different approaches and I always ended up with either flickering or jagged movements.
I'll use this sprite as an example:

Approach 1
Sprites moving freely in floats. Sampling the texture with a linear filter. MSAA enabled.
When the sprites move at a velocity that's not a multiple of 1 pixel/frame I see them flickering, especially when they have certain pixel patterns (like a thin black outline around).
For example with the above sprite I get the following effect:

That's due to different sampling and approximation of the underlying texture between different frames. For example when a black texel of the sprite lies between two pixels, then the pixel color is the linear interpolation of two near texel and it changes to grey. Then in the next frame the texel again occupies a whole pixel and its color again becomes black.

Moreover when the zoom-out kicks in and the sprite isn't reproduced 1:1 on the screen, the flickering is much worse and other artifacts come out (they are explained here).

The problems are less noticeable at 4K, but a lot more at lower resolutions.
Using a nearest filter to sample the texture makes the movement smoother (but jagged), but it only works when the zoom level is pixel-perfect. Otherwise there are still the problems shown on the gif above.

Approach 2
Rounding the sprite positions to the nearest pixel. Sampling the texture with a linear filter. MSAA enabled.
With this approach I have no flickering, because whatever is the sampling of the texture, then it remains consistent among frames:

How the sprite is sampled:

The upper and right outlines disappears from the screen, but they are absent in any frame, whatever the position. So there's no flickering.
However there is a side-effect. When the sprite moves slowly along a curvilinear path, I see a jagged movement (the gif also has a slower framerate (~30fps), but the movement is somehow jagged also at 60fps):

Moreover if it moves at a velocity that's not a multiple of 1 pixel/frame, the movement is jerky, because in some frames it moves of 3 pixels, in other frames it moves of 2 pixels and so on.
The only situation in which I really see a smooth movement is when the sprite moves vertically, horizontally or diagonally, and its velocity is a multiple of 1 pixel/frame. But when it does a curvilinear movement or also a linear movement on an arbitrary direction (different from the aforementioned ones), then I see some visual imperfections.

None of the above approaches is fully satisfactory. Do I have to live with these problems or is there any other approach I can try to achieve a better smoothness?

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:
Implementing monte-carlo tree search in a tile based game with units I have this simple risk-like game I would like to develop an AI for. Players move their Units on the  map and a simple fight resolution is done. There is a time constraint of 100ms for each round, the AI has complete information and fight resolution is deterministic but units move simultaneously each round.

As far as I understand the monte carlo approach, I need to copy the state of a current round and generate a tree with new game states, play it out randomly or do an evaluation.

Currently my zones keeps a list each unit and they're moved around by storing orders. They're kept in a dictionary for each turn and are applied at the end of the round. Deep copying this takes around 3ms and I guess is too slow to use effectively considering the time constraint. I was wondering if I could use this order-system to generate the tree faster by applying and undoing them, but I can't yet wrap my head around how I would do it.

This is my current class design:

How can I effectively add MCTS for this kind of game?

sentences:
Drawing a deferred decal when the camera clips its bounding geometry I have a building grid effect that I decal onto my terrain using a cube that moves to follow the cursor.

You can see if the camera gets too close to the cube, it gets clipped by the camera's near plane:

See the clipping just starting here:

I'd like to find a solution to this as the camera may be this low to the ground or lower upwards of 50% of the time during gameplay. (the rest of the time you would use the view from above, as illustrated by the clip I provided).
Is there any way to solve this problem?
I'd like to correctly render the cube's shader despite/while clipping with the camera.
is this possible and how?
.
.
.
EDIT & UPDATE :

I'm implementing camera-to-cubemesh clipping detection and already having issues :
public class Grid : MonoBehaviour
{
    #region
    [Header("First point to Camera Controller")]
    [SerializeField]
    public CameraController CameraController;
    MeshRenderer constructionGrid;
    private Camera cam;

    private void Start()
    {
        cam = GameObject.FindGameObjectWithTag("MainCamera").GetComponent<UnityEngine.Camera>();
        constructionGrid = GameObject.FindGameObjectWithTag("GridViewer").GetComponent<MeshRenderer>();
    }

    void Update()
    {
        Plane[] frustumPlanes = GeometryUtility.CalculateFrustumPlanes(cam);
        if (GeometryUtility.TestPlanesAABB(frustumPlanes, constructionGrid.bounds))
        {
            Debug.Log("Clipping");
        }
        else
        {
            Debug.Log("Not");
        }
    }

This always logs "Cliping" whether clipping or not.
If I add a meshCollider to the shadercube the same happens but the shadercube jitters all over the place.
I can't figure out clipping detection.

sentences:
How to record gameplay on WP7? I need to record my wp7 game gameplay like on Hot Apps from channel 9 http://channel9.msdn.com/Shows/Hot-Apps/Hot-Apps-Minesweeper-Cheezia-Interior-Design-Talking-Alien-Zombie-Squish.

My current game is written on Silverlight, but I will have XNA games latter as well, so I need some solution which will work for both technologies. If there any free software? If yes is there any way to record video from real device, not emulator?

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:
How do I convert my matrix from OpenGL to Marmalade? I am using a third party rendering API, Marmalade, on top of OpenGL code and I cannot get my matrices correct. One of the API's authors states this:

  We're right handed by default, and we treat y as up by convention. Since IwGx's coordinate system has (0,0) as the top left, you typically need a 180 degree rotation around Z in your view matrix. I think the viewer does this by default.

In my OpenGL app I have access to the view and projection matrices separately. How can I convert them to fit the criteria used by my third party rendering API?

I don't understand what they mean to rotate 180 degrees around Z, is that in the view matrix itself or something in the camera before making the view matrix. Any code would be helpful, thanks.

sentences:
How to displace a segmented line along a sine wave with Shader Graph? I have a mesh made of three identical cylinders (conceptually just line segments with a non-zero thickness) crossed over each other at 60 degree angles, so the ends describe the points of a regular hexagon.  The cylinders are divided into a lot of segments, which I'd like to displace in a sinewave pattern.  The pivot is in the center of the mesh.
My concept is pretty straightforward:

Subtract object position from vertex position to get vertex position relative to the pivot (VPR).
Normalize VPR and swap the X and Y to get a vector in the XY plane perpendicular to the orientation of the cylinder.
Take the magnitude of VPR, multiply by a V1 parameter (Waviness), then take the sine.
Multiply the sine by the perpendicular orientation vector to get the displacement.
Add the displacement to the vertex position.  Assign result to master node's vertex position.

This really feels like it should work.  Each cylinder should be distorted along a sine wave, with the magnitude of the distortion increasing the further it gets from the center, so I end up with three wavy lines crossed over each other at 60 degree angles.  Increasing Waviness should increase the frequency of the wave, as the base value is multiplied by it before feeding into the sine node.
Instead, things curve just a little bit at a low Waviness, but as I increase it the cylinders get both thicker and longer, neither of which should be happening, and start wrapping themselves around the mesh in weird patterns.  I have no idea what I'm doing wrong!
Here's my graph setup, with the mesh assigned to the preview so you can see what a mess it's making of it:

Any ideas how I can fix this?

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:
Why does the script stop working after respawning? I have a flying enemy that follows the player:
public class MoveTowardsPlayer : MonoBehaviour
{
    public float moveSpeed, sightDistance;
    public Rigidbody2D theRB;
    public Transform target;
    private void Start()
    {
        theRB = GetComponent<Rigidbody2D>();
    }
    private void Update()
    {
        Vector3 targetDir = target.position - transform.position;
        targetDir = targetDir.normalized;
        float dist = Vector3.Distance(target.position, transform.position);
        if (dist < sightDistance)
            theRB.velocity = targetDir * moveSpeed;
    }

}

And here is what happens when the enemy dies, and then respawns:
  public void Die()
    {
        Instantiate(enemyDieEffect, transform.position, transform.rotation);
        gameObject.SetActive(false);
    }

    public void Respawn()
    {
        gameObject.transform.position = initialPosition;
        gameObject.SetActive(true);
        currentHealth = maxHealth;
    }

The enemy respawns if the player dies and goes back to the last checkpoint.
Interestingly, if the player dies before reaching any checkpoint, the MoveTowardsPlayer scripts still works after respawning. It only stops working after any of the checkpoints are reached.
For the sake of completeness, here is the Checkpoint script, which has absolutely nothing to do with the enemies:
public class Checkpoint : MonoBehaviour
{
    private Animator animator;
    public bool isReached;

    // Start is called before the first frame update
    void Start()
    {
        isReached = false;
        animator = GetComponent<Animator>();
    }

    private void OnTriggerEnter2D(Collider2D other)
    {
        if (other.CompareTag("Player"))
        {
            CheckpointController.instance.DeactivateCheckpoints();
            animator.SetBool("isActive", true);
            CheckpointController.instance.SetSpawnPoint(transform.position);
        }
    }

    public void ResetCheckpoint()
    {
        animator.SetBool("isActive", false);
    }
}

sentences:
LWJGL glRotatef() without rotating axes? Okay so, I noticed when you rotate around an axis, say you do this:

glRotatef(90.0f, 1.0f, 0.0f, 0.0f);

That will rotate things 90 degrees around the x-axis. However, it also sort of rotates the y and z axes as well. So now the y-axis is pointing in and out of the screen, instead of up and down. So when I try to do stuff like this:

glRotatef(90.0f, 1.0f, 0.0f, 0.0f);
glRotatef(whatever, 0.0f, 1.0f, 0.0f);
glRotatef(whatever2, 0.0f, 0.0f, 1.0f);

The rotations around the y and z-axes end up not how I want them. I was wondering if there is any way I can sort of rotate just the axes back to their initial position after using glRotatef(), without rotating the object back. Or something like that, just so that when I rotate around the y-axis, it rotates around a vertical axis.

EDIT: After further research, it appears I will have to learn quaternions.
EDIT2: Wait, I don't think that's right. Does anyone know? I saw this thread on another site: http://java-gaming.org/index.php?topic=24177.0 but I don't understand what he did.

sentences:
Unity / How to add a shader to a material via c# script? I found already some things - but those seem not quite what I need. (perhaps outdated functions?)

https://docs.unity3d.com/ScriptReference/Material-shader.html

here, it seems you can add a shader to a renderer:

using UnityEngine;
using System.Collections;

public class ExampleClass : MonoBehaviour {
    public Shader shader1;
    public Shader shader2;
    public Renderer rend;
    void Start() {
        rend = GetComponent<Renderer>();
        shader1 = Shader.Find("Diffuse");
        shader2 = Shader.Find("Transparent/Diffuse");
    }
    void Update() {
        if (Input.GetButtonDown("Jump"))
            if (rend.material.shader == shader1)
                rend.material.shader = shader2;
            else
                rend.material.shader = shader1;

    }
}

well - i dont have a renderer. i only have a material.

and there is no "material.setShader" , only a material.setTexture"

sooo can anyone solve this mystery of how to add a shader to a material via script?

sentences:
How to figure out which tiles are within view, and where to draw them in the grid? I know there are a few questions on here similar to mine, but none of them seem to fit my needs.

I'm using PyGame to implement a tile based game similar to Final Fantasy or Zelda from the early Nintendo and Super Nintendo generation consoles.

The issue I'm running into is that I can't figure out how make a general way to render and position the tiles within view of the player camera. Once the camera starts moving, finding how much of an image is present in the camera view is very difficult, and then positioning it correctly is more complicated.

Any suggestions on how I can figure out a general way to create the grid correctly?

sentences:
Game communicates with MongoDB in the Editor but not in WebGL build I was trying to implement MongoDB in my Unity WebGL game and everything is working fine in the editor: I managed to insert and retrieve documents from my Mongo database with no issues.
Everything seemed perfect until I compiled the project and realized that my WebGL build won't communicate with my database at all!
I took a look at the console and I see this error:

MissingMethodException: Default constructor not found for type MongoDB.Bson.Serialization.BsonClassMap`1[[UserAccount, Assembly-CSharp, Version=0.0.0.0, Culture=neutral, PublicKeyToken=null]]

I have no clue what's happening. I tried compiling the project for Windows/Linux and I got the same error, then I changed API compatibility level to 4.x and it was working fine on the Windows build, but not on WebGL ( API compatibility level=4.x is checked for WebGL build!)
Can someone lend me a hand with that?

sentences:
How can I generate Sudoku puzzles? I'm trying to make a Sudoku puzzle generator. It's a lot harder than I expected and the more I get into it, the harder it gets!

My current approach is to split the problem into 2 steps:

Generate a complete (solved) Sudoku puzzle.
Remove numbers until it's solveable and has only 1 solution.

In step 1, since I'm using a brute force methods, I'm facing some run time issues. Is there an optimal way of filling in a complete Sudoku puzzle?

In step 2, what kind of algorithm should I use to "puzzlize" a solved sudoku?

sentences:
Different revenue models between developers and publishers? I am working at a small game studio developing games for iOS and Android. We do the full journey here, from idea to finished product and we have funding to do so. However, with the smartphone market being a bit of a lottery for small developers we are looking into getting into a publisher deal.

What I am wondering now is what kind of different deals one could look at. From what I have gathered from reading a number of articles a common model it is that the publisher pay for the development cost and once the game is released the developer gets about 20% of the revenue. What I am wondering is if there are any other common models used between developers and publishers?

sentences:
How can I plot a radius of all reachable points with pathfinding for a Mob? I am designing a tactical turn based game.  The maps are 2d, but do have varying level-layers and blocking objects/terrain.  I'm looking for an algorithm for pathfinding which will allow me to show an opaque shape representing all of the possible max-distance pixels that a mob can move to, knowing the mob's max pixel distance.

Any thoughts on this, or do I just need to write a good pathfinding algorithm and use it to find the cutoff points for any direction in which an obstacle exists?

sentences:
Increment grid by rotation I'm currently working on a grid for snapping objects side by side. My current script is working fine, but only for game objects which haven't been rotated.

Here is an example video of the problem:

https://vid.me/jN6D

The cube at the right has a rotation of Vector3.zero, the left one has been rotated on the Y axis.

As you can see snapping works perfectly for the right one, but at 0:15 you can see that the snapping doesn't work well for the rotated cube, that's because I've currently no idea how I can add the rotation in my current script.

Here is a snippet of the most important part of code I'm currently using to calculate the grid:

Vector3 pivotToPoint = hit.point - nearestGameObject.transform.position;

float positionX = nearestGameObject.transform.position.x +
                  Mathf.Round(pivotToPoint.x / nearestGameObject.transform.renderer.bounds.size.x) *
                  nearestGameObject.transform.renderer.bounds.size.x;

float positionZ = nearestGameObject.transform.position.z +
                  Mathf.Round(pivotToPoint.z / nearestGameObject.transform.renderer.bounds.size.z) *
                  nearestGameObject.transform.renderer.bounds.size.z;

Vector3 origin = new Vector3(positionX, 0, positionZ) + Vector3.up * 100;

if (Physics.Raycast(origin, Vector3.down, out hit, Mathf.Infinity, layerMask)) {
    previewGameObject.transform.position = new Vector3(positionX, hit.point.y, positionZ);

    previewGameObject.transform.rotation = nearestGameObject.transform.rotation;
}

Maybe some of you guys have an idea how to solve this, it's driving me crazy.

p.s. Here is some guy with a similar problem, but I'm very lost when in comes to adding the solution into my code.

sentences:
How do you stop OgreBullet Capsule from falling over? I've just started implementing bullet into my Ogre project. I followed the install instructions here: http://www.ogre3d.org/tikiwiki/OgreBullet+Tutorial+1

And the rest if the tutorial here:
http://www.ogre3d.org/tikiwiki/OgreBullet+Tutorial+2

I got that to work fine however now I wanted to extend it to a handle a first person camera. I created a CapsuleShape and a Rigid Body (like the tutorial did for the boxes) however when I run the game the capsule falls over and rolls around on the floor, causing the camera swing wildly around.

I need a way to fix the capsule to always stay upright, but I have no idea how

Below is the code I'm using.

(part of) Header File

OgreBulletDynamics::DynamicsWorld *mWorld;   // OgreBullet World
OgreBulletCollisions::DebugDrawer *debugDrawer;
std::deque<OgreBulletDynamics::RigidBody *>         mBodies;
std::deque<OgreBulletCollisions::CollisionShape *>  mShapes;

OgreBulletCollisions::CollisionShape *character;
OgreBulletDynamics::RigidBody *characterBody;
Ogre::SceneNode *charNode;

Ogre::Camera* mCamera;
Ogre::SceneManager* mSceneMgr;
Ogre::RenderWindow* mWindow;

main file

bool MinimalOgre::go(void)
{
    ...

     mCamera = mSceneMgr->createCamera("PlayerCam");
     mCamera->setPosition(Vector3(0,0,0));
     mCamera->lookAt(Vector3(0,0,300));
     mCamera->setNearClipDistance(5);
     mCameraMan = new OgreBites::SdkCameraMan(mCamera);

    OgreBulletCollisions::CollisionShape *Shape;
    Shape = new OgreBulletCollisions::StaticPlaneCollisionShape(Vector3(0,1,0), 0); // (normal vector, distance)
    OgreBulletDynamics::RigidBody *defaultPlaneBody = new OgreBulletDynamics::RigidBody(
            "BasePlane",
            mWorld);
    defaultPlaneBody->setStaticShape(Shape, 0.1, 0.8); // (shape, restitution, friction)
    // push the created objects to the deques
    mShapes.push_back(Shape);
    mBodies.push_back(defaultPlaneBody);

    character = new OgreBulletCollisions::CapsuleCollisionShape(1.0f, 1.0f, Vector3(0, 1, 0));

    charNode = mSceneMgr->getRootSceneNode()->createChildSceneNode();
    charNode->attachObject(mCamera);
    charNode->setPosition(mCamera->getPosition());

    characterBody = new OgreBulletDynamics::RigidBody("character", mWorld);
    characterBody->setShape(   charNode,
                    character,
                    0.0f,         // dynamic body restitution
                    10.0f,         // dynamic body friction
                    10.0f,          // dynamic bodymass
                    Vector3(0,0,0),
                    Quaternion(0, 0, 1, 0));

    mShapes.push_back(character);
    mBodies.push_back(characterBody);

    ...
}

sentences:
How to use MaterialPropertyBlocks to randomly change the color of multiple materials on an object? I have a character prefab for a civilian with 5 materials. Each one should be a random color but I don't want a new material for every civilian in the game. I asked a question earlier and had a good answer. However I was pointed towards this question with MaterialPropertyBlocks. This is the code I currently have:

void Start () {
    Color newShirtColor = shirtColor[Random.Range(0, shirtColor.Length)];

    MaterialPropertyBlock props = new MaterialPropertyBlock();
    props.AddColor("_Color", newShirtColor);
    GetComponent<SkinnedMeshRenderer>().SetPropertyBlock(props);
}

It works really well but the color is assigned to the whole mesh. How can I do this for each of the 5 materials on the object so that it only changed the color for the assigned parts of the mesh, with only one material for each section?

sentences:
How do I determine wall direction, with information of normal and incoming direction? What is formula and theorys used to determine wall direction, with only knowing the normal of the wall and the direction of the incoming object?

This answer has already stated a formula, but I don't know where it came from, and I am in need of understanding.

sentences:
Unity Raw Image ui not showing when small I have some Images online that I download using WWW class and the use as UI elements.
So far all of them where working perfectly but now the one I added recently is acting up.
First you should know that all of the images are being downloaded by the same script and handled by that so there should be no difference between  their materials and stuff AFAIK (if I'm missing something please tell me).
Second , the problem is that this particular image only shows up when it's taking more than one sixth of the screen, for example if I make it bigger by changing it's size in the inspector, or if I go to scene view and zoom in on it, it starts to fade in the larger it gets on the screen.
Also, I changed the picture to something that was working properly to make sure it's not from the image.

    public IEnumerator AddTools(Tool Tool)
    {
        Texture2D T = new Texture2D(4, 4, TextureFormat.DXT1, true);
        SpriteTool ST = new SpriteTool();
        ST.TheTool = new UnityEngine.Texture();
        ST.ID = Tool.ID;
        ST.ToolName = Tool.Name;
        ST.Type = Tool.Type;
        WWW wWw = new WWW(Tool.Url);
        while (!wWw.isDone)
        {
            yield return wWw.progress;
        }
        wWw.LoadImageIntoTexture(T);
        ST.TheTool = T;
        ST.TheTool.name = Tool.Name;
        SpriteTool PA = ObjectTools.SingleOrDefault(p => p.ID == ST.ID);
    }

The SpriteTool Type is a class I made for storing some of the information needed to build the UI element later.

    private GameObject CreateButton(SpriteTool item = null, float angle = 0)
    {
        Texture2D T2D = (Texture2D)item.TheTool;
        T2D.SetPixels(T2D.GetPixels(0, 0, T2D.width, T2D.height));
        T2D.Apply();
        GameObject Tool = new GameObject();
        Tool.transform.SetParent(GUICanvas.transform);
        //There was some code for positioning the element and resizing it that I
        //did not include but I can see in the scene view that the size and the position
        //are what they supposed to be so that's not the problem
        Tool.AddComponent();//The type is RawImage
        Tool.GetComponent().texture = T2D;//the type is RawImage
     }

sentences:
How to rotate velocity Vector3 to always point the same direction so that it can be applied to 2d blendtree? Given two variables, a Vector3 representing body velocity and a Quaternion representing body's local rotation, how could I normalize the velocity vector so that it's always oriented towards the default Vector3.forward direction?
The context of this problem is that I have a 2D blendtree for character movement animations. I wanted to use the RigidBody.velocity to control the two blendtree axes. This did not work as I initially expected because, depending on body rotation, the velocity also rotates to that direction and this when I'm moving forwards but my body is rotated 90 degrees to the right, my right (x) velocity would be 10 and my forward (z) velocity would be 0. In that case I would like to, using the current body rotation and velocity values, "normalize" the given velocity vector so that it has 10 in forward (z) velocity and 0 in right (x) velocity any time the entity is moving forward, no matter it's orientation.
I've tried playing with Vector3.RotateTowards and Quaternion.LookRotation but I haven't gotten the desired results and I don't really know what to look for.

sentences:
Unity MouseWheel weapon change I am trying to make a simple weapon change in Unity3D. The best way to do this is with the mouse scroll wheel, as far as I can see.

I googled on how to do this and found that I have to use Input.GetAxis("Mouse ScrollWheel"); I use this piece of code and print it. Still, I always get an value of 0.
any ideas? I just need to solve how to get the value first, I'll figure out the rest myself.

Code idea:

function Update () {
    print(WeaponNumber);

    if(Input.GetAxis("Mouse ScrollWheel")){
    WeaponNumber += Input.GetAxis("Mouse ScrollWheel");
    }
}

sentences:
is it possible to make a MMO starting with scalable hosting? I made a really basic 2D RPG. I want to know whether I can turn it into a free to play MMO.

I cannot afford to rent a server with enough capacity to serve a big number of players but I'm wondering whether I could get a hosting plan that starts cheap but scales enough to eventually handle a big numer of users so I have minimum fixed costs and I can cover expenses on the go with ads or whatever.

Is there such a thing? Thanks

sentences:
Does VK_SNAPSHOT not send a WM_KEYDOWN; only WM_KEYUP? On my machine, every key sends a WM_KEYDOWN message except for SysReq/Print Screen key: which only seems to send WM_KEYUP.

Is this actually the case?

sentences:
Lighting large scene with dynamic lights - Unity3D I am working on a game project where most of the action takes place in a large scene that is built to look like a space station. Because it is all technological and enclosed, I can't use a directional light to light the whole scene, and I need to be able to change the color of the lights for an alarm system. I can't bake the lights, because then I can't change their color, and I can't leave them all as dynamic lights, because I have about fifty spot-lights, and they take up a huge amount of memory, so much so that the lights can't even render on mobile devices.

Is there any way to do this without baking?

I am getting about 3000 batches in the Unity Editor Stats on average, in some places it is higher. Even viewing the game in full screen in the editor makes the game run super slow because of the amount of rendering it has to do, and I have a pretty new computer.

Here's a picture of my scene (As you can see, it is fairly large as you are able to see the UI box clearly from the scene editor):

And here's the Stats box:

Here is an example of my scene in play mode:

UPDATE:
I removed the shadow casting, which isn't necessary for my project, and it improved the framerate slightly, and the batches number is smaller, averaging out at about 1500 now, but the performance still is not optimal.

sentences:
C# XNA colliders, physics, inclined plane/terrain/colliders Currently I'm working on a project to learn game programming. But I'm not sure if I have the right approach on several things, and that's what I'm here for.

What I'm trying to create is a small world in 3d and simulate some simple physics. The world can be seen below.

The world is basically a box, note that I've left out the walls in the front and side view, but they will be there. The goal is to drop a ball somewhere in the green area and let physics do its work. Then the simulation will end once the ball falls into the hole. Later, once I got a better understanding of everything I want to create a pinball game out of it, but that's for a later stage.

Currently I'm creating this project in C# XNA/MonoDevelop and want to create everything from scratch. So I got my own physics engine, collider classes, math library, et cetera, which I find quite challenging, especially since I knew/know nothing about all of this, especially the math, but I am learning a lot from it, and I find it a lot of fun!

So what do I have now:

I got a GameObject class, which contains a position, a model, update and draw methods, etc. And a Physics Engine which uses PhysicsObjects and ModelObjects (both inheriting from the GameObject).

The PhysicsObject contains a mass, velocity, gravity, a collider update and draw method and the ModelObject just has a position and a collider and update and draw method.

The PhysicsEngine has a Run(deltatime) method which is being called in the update method and integrates through all the PhysicsObjects in step one, updating it's velocity, applying gravity, and finally position. In the next step the PhysicsEngine handles the collisions. It checks whether a collision was found between PhysicsObjects and PhysicsObjects and PhysicsObjects and ModelObjects and if a collision was detected it will handle the collision response.

So far I only have an Axis-Aligned Bounding Box, BoundingSphere and Plane class. And implemented the Sphere-Sphere collision, and Sphere-Plane collision.

I soon realized the AABB wouldn't be possible since I can't rotate them. So I tried creating planes, since as far as I understand, a Plane exists out of a normal vector to determine the 'up' side and a distance from the center/origin. The problem only is that there isn't a begin or end position so I can't have a hole in the terrain. So this is where I'm stuck, I have no idea on how to approach this and what to use and how most people would solve this problem. I'm not asking for code snippets or anything, but want to know if my general approach to all of this is 'correct' and how I should approach this problem for the terrain. What kind of collider should I use for the terrain to also make it possible to rotate it?

sentences:
maya root motion animation jumps back and forth in Unity I have a custom made model from Maya that is supposed to have root motion.
But when I put the animation into the animator in Unity it keeps jumping back.
I have configured the model in Unity as Root motion. So now I don't know whether it's a problem with the model in Maya or the setup in Unity. I have compared my Unity setup to a Jose Diaz Toon Dinosaur setup which seems to be the same so I am suspecting that there is a problem with the model export from Maya.

sentences:
How can I texture a large terrain mesh in OpenGL? I want to apply a texture to a large terrain mesh in my game. I think that it is just not acceptable to have a gigantic UV map spanning over 4096 x 4096 pixels.

What's a better way to apply a texture to it?

sentences:
How to tell when animation is finished playing without events in Unity I'm using the newest version of Unity. I have a turn based RPG type of game so everything is very sequential. The actor jumps in front of another actor, plays his melee attack animation, then jumps back. Currently I use events on the animation to tell when the attack animation is complete. The 2 side effects of doing it this way are:

I have to go into each animation and make an event at the end of them. It would be ideal to NOT have to do this. It would seem I should be able to just check in code if a certain animation is finished playing.
The control flow of my attack code becomes awkward. My attack method is a coroutine so I can read it very sequentially and it makes sense. Having this event to tell when the animation is complete ruins that flow. I have to basically make a bool variable and inside my finished event set it, and in my attack function do a while loop after I play the animation checking for that bool variable to change and yielding out until it does. Requiring this event ruins the logical flow of attacks. If I have many animations for whatever reason things get messier.

I noticed the Animator component doesn't have an isPlaying() like some other answers suggested. I think those answers were for older version of unity and older just playing animation clips not using the new Animator component.

There must be a better way to do this.

sentences:
Unity AdMob plugin - rewarding the user on the main thread There's a simple guide on the Firebase's website on how to implement the AdMob's rewarded video:
https://firebase.google.com/docs/admob/unity/rewarded-video

Let's take some code:

public void OnVideoAdComplete(object sender, Reward reward){
    SoundMgr.Instance().PlayRewardSound();
    // double coins etc
}

Let's plug it in:

private void LoadVideoAd(){
    videoAd = RewardBasedVideoAd.Instance;

    AdRequest request = new AdRequest.Builder().AddTestDevice("XXXXXXXXXXXXX").Build();
    videoAd.LoadAd(request, androidVideoAdID);

    if(!videoCallbackSet){
        videoCallbackSet = true;
        videoAd.OnAdRewarded += OnVideoAdComplete;
    }
}

And now let's get a ThreadException cause we played a sound on the other thread:

Unity   : Function SoundChannelStopList::~SoundChannelStopList() may only be called from main thread!

Unity   : ExecutionEngineException: SIGILL
Unity   :   at SoundManager.PlaySuccess1Sound () [0x00000] in <filename unknown>:0
Unity   :   at Game.OnVideoAdClose () [0x00000] in <filename unknown>:0
Unity   :   at AdManager.OnVideoAdClose (System.Object sender, System.EventArgs args) [0x00000] in <filename unknown>:0
Unity   :   at GoogleMobileAds.Api.RewardBasedVideoAd.<RewardBasedVideoAd>m__4 (System.Object sender, System.EventArgs args) [0x00000] in <filename unknown>:0
Unity   :   at (wrapper delegate-invoke)
System.EventHandler`1<System.EventArgs>:invoke_void__this___object_EventArgs (object,System.EventArgs)
Unity   :   at GoogleMobileAds.Android.RewardBasedVideoAdClient.onAdClosed () [0x00000] in <filename unknown>:0
Unity   :   at System.Reflection.MonoMethod.Invoke (System.Object obj, BindingFlags invokeAttr, System.Reflection.Binder binder, System.Object[] parameters, System.Globalization.CultureInfo culture) [0x00000] in <filename unknown>:0
Unity   : Rethrow as TargetInvocationException: GoogleMobileAds.Android.RewardBasedVideoAdClient.onAdClosed()
Unity   :   at UnityEngine.AndroidJavaPro

How is this possible that it's year 2017 and the most leading game engine's plugin is runnning it's callbacks without some sort of App.PostRunnableOnMainThread()?

Is there any workaround on this or we need to create an incredible pattern like:

update(){
    if(adFinished)
        //give rewards
    }

I'd be grateful for any tips! :)

sentences:
Getting "Non-invocable member 'items.item' cannot be used like a method." when invoking a class I have my item class (items.cs) not attached to any gameObjects, I want to use items for all items in my game so I can use arrays as inventories.

I have Stone.cs which is attached to a gameObject. On the line inv = items.item(100f, "Stone", "Rock used for building"); I get a compiler error Non-invocable member 'items.item' cannot be used like a method. I am confused by this as I copied it from the Unity class tutorial, just splitting creating the item to another script.

items.cs

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

public class items : MonoBehaviour{
    public class item{
        public float iQuan;
        public string iName;
        public string iDesc;

        public item(float iQ, string iN, string iD){
                iQuan = iQ;
                iName = iN;
                iDesc = iD;
        }

    }
}

Stone.cs

using System.Collections;
using System.Collections.Generic;
using UnityEngine;
public class Stone : MonoBehaviour {
    // Use this for initialization
    public items.item inv;
    public float iMax;
    public float iCur;
    void Start () {
        inv = items.item(100f, "Stone", "Rock used for building");
    }

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

    }
}

sentences:
DirectX 9 Light projection I am trying to see changes of component 'z' from light space. In vertex shader component 'z' divide 'w' is not 0. But after sending float4 with texcoord1 to pixel shader its 0. All matrices are good. Here is the code:

float4x4 MatWorld;
float4x4 MatView;
float4x4 MatProjection;

float4 LightViewMatrix;
float4 LightProjectionMatrix;
float4 LightPosition;

texture tex0;

sampler2D ShadowMap = sampler_state
{
    texture = tex0;
};

struct VertexOut
{
    float4 position : POSITION;
    float2 tex : TEXCOORD0;
    float4 lightViewPosition : TEXCOORD1;
};

struct VertexIn
{
    float4 position : POSITION;
    float2 tex : TEXCOORD0;
};

VertexOut VSLight(VertexIn In)
{
    VertexOut Out;

    In.position.w = 1;
    Out.position = mul(In.position, MatWorld);
    Out.lightViewPosition = Out.position;
    Out.lightViewPosition = mul(Out.lightViewPosition, LightViewMatrix);
    Out.lightViewPosition = mul(Out.lightViewPosition, LightProjectionMatrix);

    Out.position = mul(Out.position, MatView);
    Out.position = mul(Out.position, MatProjection);

    Out.tex = In.tex;
    return Out;
}

float4 PSLight(float4 Color : COLOR, float2 tex : TEXCOORD0, float4 lightViewPosition : TEXCOORD1) : COLOR
{
    float depth = lightViewPosition.z / lightViewPosition.w;
    if (depth == 0)
    {
        return float4(0, 0, 0, 1);
    }
    return float4(depth, 0, 0, 1);
}

technique T1
{
    pass P0
    {
        VertexShader = compile vs_2_0 VSLight();
        PixelShader = compile ps_2_0 PSLight();
    }
};

All objects are black. Sorry my english is slightly poor.

sentences:
Unity's "Stats" window displays bizzare number of triangles and vertices In my Unity scene I have:

7-8 Barrels (with lids) each at about 2-400 triangles.
4 planes, each at at the very most 200 triangles
camera, 3 lights, a FPS controller

When I turn on the "Status" button in the lower left view port, it reports "14.1K triangles and 12.k vertices":

I've double checked everything, there's no way the elemens in the scene can amount to so many triangles. The barrels in both Blender and Unity report having the number of triangles I've specified above:

Here's a Blender screen shot:

And here's one from Unity:

I've also checked the Hierarchy panel to see if I haven't accidentally duplicated stuff which might get to be on top of stuff (such as 100 barrels all in the same position so as to look as if there's just one there), and this is not the case.

So my question is: am I misinterpreting the Unity stats window? Is it a bug in the reported triangles count there? Or am I just completely missing how all this works ?

sentences:
Best approach to depth streaming via existing codec I'm working on a development system (and game) intended for games set mostly in static third-person views.  We produce our scenery by CG and photographic techniques.  Our background art is rendered off-line by a production-grade renderer.

To allow the runtime imagery to properly interact with the background art, I wrote a program to convert from depth output by Mental Ray into a texture, and a pixel shader to draw a quad such that the Z data comes from the texture.

This technique is working out very well, but now we've decided that some of the camera angle changes between scenes should be animated.  The animation itself is straightforward to produce from our CG models.  We intend to encode it to some HD video codec such as H.264.

The problem is that in order to maintain our runtime imagery on the screen, the depth buffer will need to be loaded for each video frame.  Due to the bandwidth, the video's depth data will need to be compressed efficiently.

I've looked into methods for performing temporal compression of depth info and found an interesting research paper here:

http://web4.cs.ucl.ac.uk/staff/j.kautz/publications/depth-streaming.pdf

The method establishes a mapping between 16-bit depth values and YCbCr values.  The mapping is tuned to the properties of existing video codecs in order to maximize precision of the decoded depths after the YCbCr has undergone video compression.  It allows an existing, unmodified video codec to be used on the backend.

I'm looking at how to pull this off with the least possible work.  (This design change was unplanned.)  Our game engine itself is native C++, presently for Win32 and DirectX, although we've worked hard to keep platform dependence segregated because we intend other ports.

We don't have motion video facilities in the engine yet but will ultimately need that anyway for cinematics.  I was planning on using some off-the-shelf motion video solution we can plug into our engine, and haven't chosen one yet.  This new added requirement makes selecting one harder since, among other things, we'll now need to bypass colourspace conversion on one of the streams, and also will need to be playing two streams simultaneously in lockstep, on top of in some cases audio on one of them (for the cinematics).

I'm also wondering if it's possible (or even useful) to do the conversion from YCbCr to depth in a pixel shader, or if it's better to just do it in CPU and separately load the resulting depth values into a locked tex.  The conversion unfortunately does involve branching logic per-pixel.  (There are more naive mappings that don't need branching, but they produce inferior results.)  It could be reduced to a table lookup but the table would be 32MB.

Programming is second-nature to me but I'm not that experienced with pix shaders and have zero knowledge of off-the-shelf video solutions.

I'd therefore be interested in advice from others who may have dealt more with depth streaming, pixel shaders, and/or off-the-shelf codecs, regarding how feasible the proposed application is and what off-the-shelf video systems out there would best get along with this usage case.

sentences:
How do I get the 3d coordinates of my model Instance? [LibGDX] I want to get the 3d coordinates (as a Vector3) from my model Instances.
with the following code I can only get the original coordinates, but in the render method, my model is rotating around the Y-axis (and moving at the same time) and I want to get its coordinates each frame.
I'm using a little class created by @Xoppa :

public static class GameObject extends ModelInstance {
    public Vector3 center = new Vector3();
    public Vector3 dimensions = new Vector3();
    public float radius;

    public BoundingBox bounds = new BoundingBox();

    public GameObject (Model model, String rootNode, boolean mergeTransform) {
        super(model, rootNode, mergeTransform);
        calculateBoundingBox(bounds);
        bounds.getCenter(center);
        bounds.getDimensions(dimensions);
        radius = dimensions.len() / 2f;
    }
}

and here's my code:

public void render(float delta) {
    super.render(delta);
    if (loading && manager.update()) {
        doneLoading();
    }

    Gdx.gl.glViewport(0, 0, Gdx.graphics.getWidth(), Gdx.graphics.getHeight());
    Gdx.gl.glClear(GL20.GL_COLOR_BUFFER_BIT | GL20.GL_DEPTH_BUFFER_BIT);

    batch.begin();
    backgroundSprite.draw(batch);
    batch.end();

    for(GameObject instance : instances){
        instance.transform.rotate(new Vector3(0, 1, 0), 0.5f);
        float x = instance.bounds.getCenterX();
        float y = instance.bounds.getCenterY();
        float z = instance.bounds.getCenterZ();
        System.out.println(x+" "+y+" "+z);
        if(isVisible(cam, instance)){
            modelBatch.begin(cam);
            modelBatch.render(instance, environment);
            modelBatch.end();
        }
    }
}

Please help, there's no function "getPosition" or sth like that, it's all about Matrix4 and I have never had a math course about it. I'm stuck.

sentences:
What is the process for porting my game SFML from Windows to Mac I've recently finished version one of a simple arcade game I've been making in SFML. I've already spent months on the physics engine and game, and I'm wondering how much time it will take to port it to Mac. I've been developing it using Visual Studio on Windows10.  As far as I can see, this is the only way to do it;

Open Visual Studio on my Mac laptop, download all my windows code

try to compile it, fail, fix all the various stuff that wont work, try to compile again.

I can't seem to find any tutorials indicating a better process, or how long I should expect it to take. It can't be trivial, or else there wouldn't be so many triple-A games that don't run on Mac. I would greatly appreciate any tips on the process or time estimates. Thanks

sentences:
Unity WebGL Build: Why it shows only Empty Folder? i'm trying to built my game, made in Unity 2018.3, and i'm trying to built it in WebGL, but the problem is this: built was succeeded, but the Folder is still Empty, and here is the problem occured:

This was never happened to me before. anybody know how to fix it?

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: Runtime resolution changing with GLFW3 I've been trying to figure out the correct method for changing the resolution/fullscreen state of a GLFW window for a while now, but after searching all I found were references of how to do it with older versions of the library such as this. I suspect you'd just destroy the window object and re-create it, but was not sure because of how some functions such as glfwSetKeyCallback take a GLFWwindow* as a parameter, and I don't know if that'd continue to work after it has been re-created. The documentation also does not have any examples on doing such a thing, so any help would be appreciated.

sentences:
Why isnt setting the global_position working? Previously my items were relative to the player by node hierarchy.  But for items like bombs this is not ideal so i tried to add the items to the world scene, but when i try to adjust the position of the item to the players position it doesnt work and i see the sword in the top left corner of the screen the worlds origin.
Entity Script
func use_item(item):
    var newitem = item.instance()
    newitem.own = self
    newitem.global_position = global_position

    #not setting the position of the item correctly

    newitem.add_to_group(str(newitem.get_name(), self))
    get_node("..").add_child(newitem)

    if get_tree().get_nodes_in_group(str(newitem.get_name(),self)).size() > newitem.maxamount:
        newitem.queue_free()

Sword Script
func _ready():
    type = own.type
    $anim.connect("animation_finished",self,"destroy")
    $anim.play(str("swing",own.spritedir))
    if own.has_method("state_swing"):
        own.state = "swing"

func destroy(animation):
    if own.has_method("state_swing"):
        own.state = "default"
    queue_free()

It seems like it should work but with an engine like godot there could be several reasons why a certain thing is not working.
https://github.com/MonkeyToiletLadder/wendingo
could it be that in my animation player i set the sword positions as key frames and thats why its not working?

sentences:
Resuming swapped out RenderTarget2D in XNA Hopefully this will be a simple answer, but as RenderTarget2Ds are Texture2Ds under the hood I was wondering how it handles swapping in and out.

Lets say you create a default one and assign it as the render target at the start of your Game.Render(). Then at a few points during your render process a new RenderTarget is swapped in, rendered to and then kept as a texture for later and the original one is then put back in. Some more rendering occurs and another entity swaps in its own RenderTarget, puts it in another texture and then swaps back to the default RenderTarget, and finally everything is rendered and done.

Now as the RenderTarget2D is a Texture2D without setting preserve mode on the RenderTarget will you be able to swap it out and swap it back in without losing your current contents of the RenderTarget?

I know there are some issues with the Preserve settings for RenderTargets on the Xbox, but if the render targets are being stored as a class member somewhere, are they subject to different rules?

I am sure the answer is, they obey the RenderTargetUsage behaviour, and will be subject to the same rules regardless of how they are stored in the game, but I just wanted to be sure.

sentences: How do games programmatically manipulate 3d models? The title says it all. An artist makes a 3d model of a character. How does a programmer use the model to make the character run around?

sentences:
Should I be returning weak/shared_ptrs or unique_ptr's to my resources? A friend of mine told me instead of normal pointers, I should use unique_ptr, i asked him why unique_ptr's if some resources are going to be shares, like multiple grass tiles, or enemies. I currently use this:

    std::map<ResourceTextures /* this is just a int */,
    std::unique_ptr<sf::Texture>> _textures;

Shouldn't I be using shared_ptr instead? That way I can keep the reference count, and unload resources as they have 0 references?

Also one more question, currently, I am passing my resource manager in every file, is there a way to make it so that all my functions dont require this:

Level(ResourceManager& resMan);
Tiles(ResourceManager& resMan);

A level is an array or tiles, should i just make it inherit tiles, so that i don't have to pass around my resourceManager everywhere?

Thanks for the help guys, after 2 years of doing nothing programming, I'm trying to make a simple game!

sentences:
Action button: only true once per press I'm using SFML2.0 and am trying to make a wrapper class for my controller/joystick.
I read all the input data from my controller and send it off to my controllable object.

I want to have two types of buttons per button press, one that is continues(true false state ) and one that is an action and is set to false after the next frame update.

Here is an example of how I set my button A to true or false with the SFML api.
Whereas data is my struct of buttons, and A holds my true/false state every update.

data.A = sf::Joystick::isButtonPressed(i,st::input::A);

But I've also added "data.actionA" which represents the one time action state.

Basically what I want is for actionA to be set false after the update its been set to true. I'm trying to keep track of the previous state. But I seem to fall into this loop where it toggles between true and false every update.

Anyone an idea?

sentences:
OpenGL + SDL Linking Problem So I'm trying to write a simple application with SDL 1.2 and OpenGL. This a stripped down version of the code containing the one problem I'm having.

//The headers
#include "SDL.h"
#include "SDL_opengl.h"

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

//Event handler
SDL_Event event;

bool initGL()
{
    //Initialize Projection Matrix
    glMatrixMode( GL_PROJECTION );
    glLoadIdentity();

    //Initialize Modelview Matrix
    glMatrixMode( GL_MODELVIEW );
    glLoadIdentity();

    //Initialize clear color
    glClearColor( 0.f, 0.f, 0.f, 1.f );

    //Check for error
    GLenum error = glGetError();
    if( error != GL_NO_ERROR )
    {
        printf( "Error initializing OpenGL! %s\n", gluErrorString( error ) );
        return false;
    }

    return true;
}

bool init()
{
    //Initialize SDL
    if( SDL_Init( SDL_INIT_EVERYTHING ) < 0 )
    {
        return false;
    }

    //Create Window
    if( SDL_SetVideoMode( SCREEN_WIDTH, SCREEN_HEIGHT, SCREEN_BPP, SDL_OPENGL ) == NULL )
    {
        return false;
    }

    //Enable unicode
    SDL_EnableUNICODE( SDL_TRUE );

    //Initialize OpenGL
    if( initGL() == false )
    {
        return false;
    }

    //Set caption
    SDL_WM_SetCaption( "OpenGL Test", NULL );

    return true;
}

void render()
{
    //Clear color buffer
    glClear( GL_COLOR_BUFFER_BIT );

    glBegin( GL_QUADS );
        glVertex2f( -0.5f, -0.5f );
        glVertex2f(  0.5f, -0.5f );
        glVertex2f(  0.5f,  0.5f );
        glVertex2f( -0.5f,  0.5f );
    glEnd();

    //Update screen
    SDL_GL_SwapBuffers();
}

void clean_up()
{
    //Quit SDL
    SDL_Quit();
}

int main( int argc, char *argv[] )
{
    //Quit flag
    bool quit = false;

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

    //Wait for user exit
    while( quit == false )
    {
        //While there are events to handle
        while( SDL_PollEvent( &event ) )
        {
            if( event.type == SDL_QUIT )
            {
                quit = true;
            }
            else if( event.type == SDL_KEYDOWN )
            {
                //Handle keypress with current mouse position
                int x = 0, y = 0;
                SDL_GetMouseState( &x, &y );
            }
        }

        //Render frame
        render();
    }

    //Clean up
    clean_up();

    return 0;
}

Anyway the code has a problem with gluErrorString() and reports:

1>main.obj : error LNK2019: unresolved external symbol _gluErrorString@4 referenced in function "bool __cdecl initGL(void)" (?initGL@@YA_NXZ)

1>C:\...\Debug\sdl1.exe : fatal error LNK1120: 1 unresolved externals

I'm using Visual Studio C++ 2010 Express. I'm using SDL 1.2.15 and freeglut. I've added to the VC++ Directories both the SDL and freeglut library and include directories respectively and in the Linker general dependencies have added SDL.lib, SDLmain.lib, OpenGL32.lib, and freeglut.lib. And SDL.dll and freeglut.dll are included with the executable.

What's really baffling me is I can run SDL code with this same set up as well as OpenGL (if I include gl/glu.h and gl/gl.h manually), but trying to run them together has brought me to a screeching halt. If I comment out the line printf( "Error initializing OpenGL! %s\n", gluErrorString( error ) ); it works fine, but I have no idea why it can't seem to work with a simple thing like gluErrorString(), especially because gluErrorString() works fine in my OpenGL only code.

From what I understand #include "SDL_opengl.h" is supposed to include the opengl headers for me, and it seems to work for all but this one line, which I don't understand. If there's any further pertinent information needed I will provide it. Any help is greatly appreciated.

sentences:
Colliding a player and a maze wall I am making a game very similar to Tank Trouble. I cannot get t the tank to collide with the maze in the map.

Let tx and ty = the tank x and y value.
Let x and y = the walls x and y value.
Let h and w = the walls height and width.

public boolean collidesWith(double tx, double ty)
{
    if ((tx - 55 > x) && (tx + 55 < x + w) && (ty - 55 > y) && (ty + 55 < y + h))
    {
        return true;
    }

    return false;
}

sentences:
In Unity, can I load a local (/Resources folder) website to safari on an ipad In Unity, can I load a local (/Resources folder) website to safari on an ipad?
This works fine on a Mac, opening up a wepage from my Resources folder.

string path = "file://"+(Application.dataPath)+"/Resources/testsite.html";
    void OnGUI(){
        if(GUI.Button(new Rect(20, 20, 100, 100), "site")){
           Application.OpenURL(path);
        }
    }

but when I try to load this on an iPhone or iPad, it doesn't seem to work.
Am I accessing the address incorrectly for iOS using "file://"?
If this is not possible, is there an alternative way I can load a locally stored website on an iOS device?

sentences:
What is an OO way for my input layer to act upon objects? I'm building a top-down RPG specifically to practice Object Oriented thinking and design. I am keeping in mind coupling, single-responsibility, and so forth. One design issue that's been bugging me is how to ultimately have objects talk while maintaining the loosest coupling possible. As an example, I'm designing the input class now, which will be made up of two layers, like so:

The conundrum is that I don't know how to bridge that gap between Input and HeroActor, which is initialized from the PlayState class, which is also where the hero.update() method is called. Let's say Keyboard has just executed

public void keyPressed(KeyEvent e) {
    switch(e.getKeyCode()) {
        //Some cases

        case KeyEvent.VK_UP:
            //Assume InputEvent.INPUT1 is a defined enumeration in InputEvent
            inputHandler.passInput(InputEvent.INPUT1);
            break;

        //Some more cases
    }
}

I've basically landed here:

public class Input {

    public void passInput(InputEvent e) {
        switch(e) {
            //Some cases

            case InputEvent.INPUT1:
                ????????????????????

            //Some more cases
        }
    }

}

My ideas have been:

Pass a reference to the instance of HeroActor to the Input object, then have Input directly call the moveUp() method on the HeroActor instance.

case InputEvent.INPUT1:
    actor.moveUp();

My instinct tells me this is bad OO design as it tightly couples the two classes.
Make the instance of HeroActor global and basically do the same as above. Even worse OO design.
Write a registerInput(Input inputHandler) function in the Actor class, like so:

public class HeroActor extends Actor {

    //Existing fields and methods

    private Input inputHandler;

    public void registerInput(Input inputHandler) {
        this.inputHandler = inputHandler;
    }

Still, then the HeroActor would have to poll the inputHandler every frame to find out if any actions have applied to it.

I'm in the same situation trying to figure out how to write the collision engine without passing it specific references to the player's HeroActor instance or the dozens of EnemyActor instances in the PlayState constructor.

Any help would be greatly appreciated. My request is not for specific code, but rather common techniques for handling the many objects in a game without ending up with a god object. I've seen some material suggesting an Observer pattern being applied for things like the input layer above, but before I go too far, I'd like some feedback from the community since I've got so many different answers among all of my Googling today.

sentences:
How does a BSP tree work for Z sorting? I'm developing a 3D engine in software, and so I must compute Z sorting manually. I'm currently using the painter's algorithm to sort triangles and then drawing them back-to-front. This causes artifacts that I'm trying to correct.

Would using a dynamic BSP-tree ensure "correct Z sorting" of triangles? Why? Because the bounding volumes of triangles would be similar?
Since I would have a single "world" BSP tree, would I have to remove and re-add any moved/scaled/rotated object into the tree?
Is it possible to add triangles into a BSP tree without the expensive cutting process? Why do you need to cut triangles on the axis planes anyway?
Is it faster to traverse a BSP tree from any angle, than to sort all tris each draw like the painters algorithm?

sentences:
Z axis in isometric tilemap I'm experimenting with isometric tile maps in JavaScript and HTML5 Canvas.
I'm storing tile map data in JavaScript 2D array.

// 0 - Grass
// 1 - Dirt
// ...
var mapData = [
    [0, 0, 0, 0, 0],
    [0, 0, 1, 0, 0,
    ...
]

and draw

for(var i = 0; i < mapData.length; i++) {
    for(var j = 0; j < mapData[i].length; j++) {
        var p = iso2screen(i, j, 0); // X, Y, Z
        context.drawImage(tileArray[mapData[i][j]], p.x, p.y);
    }
}

but this function mean's all tile Z axis is equal to zero.

var p = iso2screen(i, j, 0);

Maybe anyone have idea and how to do something like mapData[0][0] Z axis equal to 3 mapData[5][5] Z axis equal to 5?

I have idea: Write function for grass, dirt and store this function to 2D array and draw and later mapData[0][0].setZ(3); But it is good idea to write functions for each tiles?

sentences:
Performance/architectural implications of calling SpriteBatch.Begin/End in many different places? I notice some code samples only call SpriteBatch.Begin and SpriteBatch.End in the game's main draw method and then draw everything within that method through direct SpriteBatch.Draw calls or indirect calls through method calls from other classes that store a reference to the SpriteBatch object and then use its Draw method.

Another approach I see is that in these separate classes they call SpriteBatch.Begin and SpriteBatch.End before their drawing code in each of these classes and don't rely on already being contained within a drawing session (between a begin and end call).

My question is two-fold. Firstly, as the title suggests, what are the performance implications of calling SpriteBatch.Begin/End in all these separate classes so often (once per class per drawing update) versus just calling it the one time each update. Secondly, and this question is a a bit more subjective but, which design is generally preferable?

Thanks.

sentences:
Apple Game Center - Sharing Data between 2 SKUs possible or not? Question: Is it possible to access the same leaderboards and achievements via GC from 2 versions of a game (i.e. 2 different SKUs, one for iPhone/iPod and another for iPad. Where both are actually the same game in terms of game modes and features. For instance to be able to have different pricing)

Or: is this impossible and there is no other way than having 2 separate Leaderboards, Achievements -or- one universal binary.

Thanks in advance

*edit: typo and added remark about universal binary

sentences:
Learning OpenGL: Red and Blue book still relevant? I've recently purchased the Orange book( GLSL ) and am wondering if it is important at all to read through the red and blue books as well?

Any thoughts?

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:
Lag Spike When Creating Model I am creating a game using OpenGl in c++. Whenever I create a new model while the game is running, such as fire a bullet, there is a huge lag spike. The function that creates the model is below.
    std::string jsonString;
    jsonString = file->load(type);
    json jf = json::parse(jsonString); //Might be causing the lag

    indicesSizeTexture = jf["textureIndices"].size();
    verticesSizeTexture = jf["textureVertices"].size();
    indicesSizeCollision = jf["collisionIndices"].size();
    verticesSizeCollision = jf["collisionVertices"].size();
    verticesTexture = new float[verticesSizeTexture * 8];
    verticesCollision = new float[verticesSizeCollision * 8];
    verticesCollisionUpdated = new float[verticesSizeCollision * 8];

    indicesTexture = new int[indicesSizeTexture];
    indicesCollision = new int[indicesSizeCollision];

    for (int i = 0; i < verticesSizeTexture; i++) {  //responsible for just the texture vertices
        verticesTexture[i] = jf["textureVertices"][i];
    }
    for (int i = 0; i < indicesSizeTexture; i++) { // responsible for just the texture indices
        indicesTexture[i] = jf["textureIndices"][i];
    }
    for (int i = 0; i < verticesSizeCollision; i++) {  //responsible for just the collision vertices
        verticesCollision[i] = jf["collisionVertices"][i];
        verticesCollisionUpdated[i] = verticesCollision[i];
    }
    for (int i = 0; i < indicesSizeCollision; i++) { // responsible for just the collision indices
        indicesCollision[i] = jf["collisionIndices"][i];
    }

    //binds id
    glGenBuffers(1, &VBO);
    glGenVertexArrays(1, &VAO);
    glGenBuffers(1, &EBO);
    glGenTextures(1, &texture);

    glBindVertexArray(VAO);
    glBindBuffer(GL_ARRAY_BUFFER, VBO);
    glBufferData(GL_ARRAY_BUFFER, verticesSizeTexture * 8 * sizeof(float), verticesTexture, GL_STATIC_DRAW);
    // position attribute
    glVertexAttribPointer(0, 3, GL_FLOAT, GL_FALSE, 8 * sizeof(float), (void*)0);
    glEnableVertexAttribArray(0);
    //texture
    glBindTexture(GL_TEXTURE_2D, texture);
    glVertexAttribPointer(2, 2, GL_FLOAT, GL_FALSE, 8 * sizeof(float), (void*)(6 * sizeof(float)));
    glEnableVertexAttribArray(2);

    stbi_set_flip_vertically_on_load(true);
    unsigned char* data = stbi_load(texturePathString.c_str(), &width, &height, &nrChannels, 0);
    glTexImage2D(GL_TEXTURE_2D, 0, GL_RGBA, width, height, 0, GL_RGBA, GL_UNSIGNED_BYTE, data);
    glGenerateMipmap(GL_TEXTURE_2D);
    stbi_image_free(data);

    glBindBuffer(GL_ARRAY_BUFFER, 0);
    glBindVertexArray(0);

I stripped out a lot of parts that I am almost certain aren't causing the lag. There is a lot of stuff going on, but it is mostly simple mathematical operations. The only parts that I think could be causing the lag is the json section used for loading the model data. The model data is stored in a variable from file as a string. I need the json section for the data storage though. What could be causing the lag? should I find a different data storage type? What if I created a bullet offscreen on startup, then copied it whenever I needed it? The specific json library I am using is https://github.com/nlohmann/json

sentences:
How much a scene would be done in 3D modelling program before exporting? What I am trying to work out is, when creating a level, or section of a level, how much is created in the modeling package before it is exported, take the scene in the link. Would this whole scene be created in Max first, if so what is the point of a level editor, where does that come into play.

Basically how are levels made, how much of a whole level, or section of a level is created in the modeling software, how can multiple people work on the same level at once, what is the relationship of a level editor to modeling package like 3ds max?

I would be using Unreal 4 and 3ds Max.

sentences:
How can I make a character Blink effect in Unity? I am making a game where I am making a health script where I have made a blueprint of what needs to be done. I'm trying a blinking effect after the character is hurt.

Can someone help me make a blink effect in Unity for JS?

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:
Make models not see through All my models are see through and I can't figure out why. For example:

Here's what it looks like when you are not looking through them:

And when I look through one of them:

Why can I see the black cube through the other Model? It's the same the other way around. I can see the gray object through the black cube. I draw the models like this:

public void Draw(GraphicsDevice graphicsDevice)
{
    foreach (ModelMesh mesh in model.Meshes)
    {
        foreach (BasicEffect effect in mesh.Effects)
        {
            effect.View = camera.View;
            effect.World = worldMatrix;
            effect.Projection = camera.Projection;

            mesh.Draw();

            // Debug: Draw bounding boxes
            modelBox.Draw(effect, camera.View, camera.Projection, effect.World, graphicsDevice);
        }
    }
}

What am I doing wrong?

More screenshots: http://imgur.com/qRA34Ul, http://imgur.com/K4PGWfL

sentences:
Post processing effects not visible on mobile apk build While setting up post processing on a project that I am currently working on, I discovered that post processing effects are not visible on the apk build on mobile.

I setup a new Project with URP on Unity 2019.3.0f5 and increased the post processing bloom effect intensity, it works just fine on the editor/play mode, however, it is not visible when I build to a mobile apk.
Is there a different way of setting up post processing specifically for mobile?

Here are screenshots:

[1]: https://i.stack.imgur.com/uKm5d.jpg - Mobile build screenshot(post processing effects are not visible)

[2]: https://i.stack.imgur.com/ivQrQ.jpg - Unity editor/play mode screenshot(post processing effects are visible)

sentences:
How do I create an empty Prefab with Unity 2018.3? I was using Unity 2018.1.(something), where I could simply create an empty Prefab object, then drag a Game Object to the Prefab from the Hierarchy to fill it. When I updated to Unity 2018.3.0f2, I don't see any more empty Prefab object in the create menu, all I get is Prefab Variant (which is disabled).

I read the Unity Blog talking about new prefab workflows, and I could not find any changes in how Prefabs are created.

sentences:
How to use the chipmunk physics-engine? I am developing a game demo where I want a physics simulation with balls and obstacles.

I know that this is possible with the chipmunk physics-engine but I don't know how to use it. Can anybody give me suggestions how to get started and provide links to the API documentation?

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:
Change in force on objects after collision i am implementing a billiard simulation game and i have a question about collision response.

As integrator, i am using Semi-Implicit Euler,

ball.setVelocity(ball.getVelocity().add(ball.getAcceleration().multiply(dt)));
ball.setPosition(ball.getPosition().add(ball.getVelocity().multiply(dt)));

Before integrating, i am calculating acceleration :

this.setAcceleration(this.getForce().multiply(1 / this.getMass()));

dt is time frame here, and acceleration, velocity, force and position are Vector class. (operations as add, multiply... are standard vector operations).

My question is - when i initially hit ball with cue, i am giving force -k*x (Hooke's law) to ball. But when it collides with other ball, i can only find formulas that calculate new position and new velocity, but my force will stay same. But how to change force here in both balls (it will change velocity and position later in SE Euler).

I appreciate any answer!

sentences: Which game portals support Unity games? I'm considering development of some simple Unity games but am worried about distribution.  Which well known game portals currently support unity?

sentences:
Algorithm for determining random events I'm struggling with coming up with an elegant solution to generating random events in the game that I'm working on.

Say there are 4 classes of events that can happen, with varying events in those classes that may occur.

So something along the lines of

main_events = {"common event", "not so common event", "somewhat rare event", "rare event"}
sub_events[0] = {"common event 1", "common event 2",..}
...

I have a somewhat kludgey solution in place that first just has a random number generated between 0 and 100, and if the number falls within a given range then a main event will be triggered.  Then I'll do another random roll to see which sub event occurs.

Is there a better solution than something along these lines?  Like I mention, it doesn't feel very elegant, and I'd like to make it easily expandable for the addition of future events.

sentences:
Check bounds in 2d platformer level transition I have asked How camera works in 2d platformer in level transitions about camera transitions,
in the process I am stuck somewhere else.
I have a targetRoom that is 32 by 32 tiles:
// [x, y, w, h]
let mb = [0, 0, 32, 32];

// bounds
let targetRoom = {
  minX: mb[0] * bs.pxTileSize,
  maxX: (mb[0] + mb[2]) * bs.pxTileSize,
  minY: mb[1] * bs.pxTileSize,
  maxY: (mb[1] + mb[3]) * bs.pxTileSize
};

I have a player object:
let p = {
    x: 0,
    y: 0,
  onEdgeX: (p, bx) => {
    p.x = bx;
  },
};

I allow the player to move within these bounds:
this.checkEdgeX = (p) => {
  let { minX, maxX } = targetRoom;
  let cbox = absCBox(p);

  if (cbox[0] < minX) {
    p.onEdgeX(p, minX - p.cbox[0]);
  }
  if (cbox[0] + cbox[2] > maxX) {
    p.onEdgeX(p, maxX - p.cbox[0] - p.cbox[2]);
  }
};

p.cbox is players local collision box [x,y,w,h]. eg: [-6, -6, 12, 12];
absCbox returns the collision box in world coordinates:
const absCbox = p => {
  let cbox = p.cbox;
  return [
    p.x + cbox[0],
    p.y + cbox[1],
    cbox[2],
    cbox[3]];
};

In checkEdgeX when the collision box exceeds the limit,
p.onEdgeX is called which puts the player inside the bounds again.
The problem is, when I want player to go beyond the edge to the other level.
How do I check if the player is allowed to pass beyond the edge to the next level?
When player goes to the next level, how do I make sure it is within the bounds again?
Because player might go just a little bit to stand in between two levels, never meeting inside the bounds of either level.
I want the transition to be in the image in my linked question above.

sentences:
Simple mobile multiplayer game. TCP/UDP? I'm tying to dive into multiplayer game programming.

The game is quite simple, it's a 2D scroller mobile game, the player need to touch the screen in order to move 1 step and it could contain up to 4 players at max. 1 of the player could create a room for other players to join.

I was thinking that I would use TCP for this and will only send packets when 1 of the player trigger an event like moving or exiting the game. Is my approach is correct? Since from what I've read, many games are created in UDP instead of TCP.

In case of UDP, what is sent between the clients and the server? The position of each entity in the game at a fix time interval?

I'm really new multiplayer programming. I'd appreciate if someone would share their story.

Thank you.

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: On Android, why would you handle expansion files yourself instead of using Google Play? Why aren't all Android games using Google Play's ability to serve their expansion files? Why some are handling it themselves inside their apps?

sentences:
Assigning values on multiple clients in UE4 I am currently working on a multiplayer game and I am having difficulties on assigning values on variables for each clients. Originally I looped through available clients character from HUD then assigned the calculated the value but I decided to do it inside character blueprint's instead.
I don't know why only first clients gets the calculated values but the other client still having the default value.
This is the initial value that I assigned from inside Character C++
MaxHealth = 500;
Health = MaxHealth;

This is how I assigned the value from the Blueprint.

Set Initial Attributes is where I calculated the Health value based on player's Strength value etc and the reason I'm doing this is because I am planning to retrieve the stats from the datatable in the future. But I don't know why it becomes like this instead.
This is the correct final value that supposedly assigned on both clients.

But only first client gets the correct value, not second client.

I don't want to use loop to search the player characters' inside player character's blueprint and assigned the value because I don't think it's a wise move so I am looking for a better alternative if any. Thanks!

sentences:
Graphics card settings tampering with my Java game I'm working on a simple 2D side scrolling platform game in java.

It is a canvas with a bufferstrategy which is placed inside a jframe, and that jframe is set as the fullscreenwindow on the graphics device.

Now my computer has a decent nvidia card. In the nvidia control panel on my computer, just looking at the basic settings, if I set the the mode to "Emphasize performance," the game runs as it should and renders properly. The game is not vertical synced.

If I set the mode to "Emphasize quality" or "Let the 3D application decide," the game renders lines a slight distance away from where I intended them, collision detection is also slightly off, and things are overly anti-aliased. The game is now vertical synced.

Now on my crappy laptop, the game runs fine because the card is much less sophisticated. (I think?) However, on my friends computer, he plays with his ATI control center a bit (turns every enhancement off) and then the game runs perfect, but by default its a mess just like with my nvidia card.

TLDR: Is there any way to override the settings on the graphics card or force the settings to be set a certain way from inside Java?

sentences:
VSSetConstantBuffers1 does not appear to be working I'm experiencing something very strange here when using VSSetConstantBuffers1.

I have a projection * world matrix that I'm sending to a constant buffer to rotate a triangle on an axis.  When I do this, I follow this pattern:

Frame #1

Set offset to 0, count is always at 64 (4 * float4)
Map Constant Buffer using Discard.
Write matrix to constant buffer
Unmap
Call VSSetConstantBuffers1(0, 1, new []{ cbuffer }, new []{offset }, new []{ count })
Draw

Frame #2

Set offset to 64, count remains same.
Map constant buffer using NoOverwrite
Write matrix.
Unmap
Call VSSetConstantBuffers1(0, 1, new []{ cbuffer }, new []{offset }, new []{ count })
Draw

Etc... When I fill the constant buffer completely, I reset offset to 0, and start again by using discard on my map.

Now here's my problem:  Nothing shows up on the screen.  Well, that's not 100% true, the very first frame, where offset = 0 and count = 64, that shows up perfectly.  The next frame, and subsequent frames do not.

I used the Visual Studio 2017 graphics debugger to confirm that my constant buffer did indeed have data in it.  And it did, and the values were correct.

It's really weird. I should be mapping the constant buffer to the next matrix element with my 2nd call to VSSetConstantBuffers1, but it doesn't actually look like it's going anywhere near that element.

Also, I tried forcing it to just use the 0, and 64 offset/count and only updating that portion of the buffer, and it works just fine.

I've tried my best to dig up info about constant buffer offset/count, but it's pretty sparse out there (my own searches on this site gave me 0 for VSSetConstantBuffers1, same with GameDev.net).  What little I did scrounge up on Nvidia's website, makes it appear as though this pattern should work.

Since my hardware might come into question here, I have a GeForce 1080 GTX running on Windows 10 (latest update), and according to the D3D11.1 options, it does indeed support constant buffer offsets, and my feature level is at max.

Anyone have any ideas? Given the lack of info, I'm guessing the offset/count versions of constant buffers aren't too popular?

sentences:
How much "real life" immersion is good? I've been making a visual novel game where the Player Character can get hungry, thirsty, has energy and also needs to go to the toilet, has sanity,
has cleanliness, has life, has money, has a reputation in the school he visits, has a "Love-Meter" with his relationship partner (for now), strength, intelligence and the list goes on and on.....

But now I think too much of those things would rather "bother" the player than add fun.

But then I also think a lot of survival games have those things and it's a lot of fun to keep those numbers up and survive or get punished.

Now I'm struggling with the balance between making "too much" and "too few".

So maybe one experienced Game Designer here has a good answer for this problem. How much "real life" immersion is good?

sentences: OpenGL Is High Efficiency For Large Number of Vertices Necessarily Highly Efficient For Low Numbers of Vertices To test my program, I rendered hundreds of times more vertices than the program will ever actually have (about 5000 vertices total for the exaggerated version). The exaggerated program lagged when using GL_FLOAT and did not when using GL_SHORT. What I'm wondering is if this optimization (and other optimizations) actually uses less energy than using GL_FLOAT for low numbers of vertices (since I read that some GPUs need to emulate integer functionality and I'm not sure if the increased speed is just because the float version passed some kind of memory limit (which it seems like it did, because lag immediately ended upon removing an exact number of vertices in the float version))). I'm using OpenGL es 1.1 right now, but advice for any version would be greatly appreciated.

sentences:
Using Racing Wheel force feedback with a JavaScript game I have a Thrustmaster T80 Racing Wheel that I am using while developing an online game with ThreeJS.

I have already made it so I can drive the car with the wheel and the game knows when I crash the car. But looking online I couldn't find a way to make the wheel 'rumble' or shake when the car crashes.

The wheel does support this on other (downloaded exe) games but it would be amazing if it was possible to achieve in a JS game, but I couldn't find any mention of doing this online.

sentences:
Unity "Text Mesh Pro UGUI" component rewrites my text! Make it stop? I'm having this terribly annoying problem where my text is being overwritten by Unity. This Happens regardless of whether I am using tags or not.

Here is what I want to appear (more or less, I don't think this example is using the tag):

And here is what happens when I try to include a monospace tag:

Since you might not see it here, the text I inputed is

<mspace=64px>A</mspace>

This works FINE for regular TMP objects, which the other 3 are (and are using). I am trying to implement dropdown (and left, and up, and right) menus.

You can see that Unity overwrites it as "Option A", like it has a clue what I'm doing. What can I do?

sentences:
Day and Night mode according to user's real local time How do I make it so the texture of my plane is a black sky when it's night according to player's local time (say from 10 PM to 5 AM it's going to be black, and from 6 AM to 9 AM it's going to be a blue sky)?

Blue sky texture name is "bluesky"
Black sky texture name is "blacksky"

Thanks.

sentences:
Should enemies still attack if they cannot see the player? This may seem like a silly question, but let me explain this further.

Consider a common stealth situation where the player is hidden from the enemy AI. The AI has vision and hearing and if they either see or hear the player they will move towards the player's last known position. However if the player is behind cover (therefore the enemy cannot see them) and they attack with a silent weapon (therefore the enemy cannot hear them either), how should the enemy react?

Realistically, the enemy should have an idea of the direction from which the attack struck them and therefore start moving in that direction. But I am wondering if this then would be detrimental to taking a stealth as oppose to offensive approach. If the enemy turns around when hit irrespective of whether they were hit with a loud or silent weapon, there is little benefit to using a silent weapon, since the loud ones will have more power anyway. On the other hand, if the enemy simply stands their while being hit several times by a silent pistol, it may make the AI seem a little stupid.

I suppose it comes down to balancing between rewarding stealth gameplay in a stealth game, but not making the AI seem silly at the same time. What should I do to balance this?

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

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: Cocos2d: Using single timer/scheduler for multiple sprites want to know if is it possible to use single timer or scheduler method for multiple sprites ? Like I am now working on a game and there could be any number of sprites and i want to perform some actions on all of that sprites, So do I have to use as many timers or schedulers as sprites ? Or How can the job be done using only a single timer or scheduler ? What is I schedule a method and use it for, Say 10 sprites ? Will it affect the performance..?

sentences:
Unity 2D, do Touch event must happen in the update() function? (Unity 5.1)

My Issue is when attaching a script to a gameObject, all the examples I've found are based with the update() function and it's pretty wierd for me, as a desktop games developer.

Is there anything like "OnMouseDown()" or other functions for a Touch platform game? Or do I must figure it out with Touch.GetInput from the update() function and that's it?

Sorry in advance if my question is a bit cliche, it's just driving me nuts because I can't find anything with the Unity API or code examples, and I just can't believe there is no some "OnTap()" function...

sentences:
What is causing my 3rd person camera to lose rotation on the z axis? I've been working on a 3rd person camera on unity for a couple weeks, but I've pretty much hit a wall, specifically to do with my camera's rotation. When I rotate it on its x and y axis it won't have a problem, but when it gets to the z axis (180 degree's on the x axis), it loses the ability to rotate at all. This is the code I've been using:

void Start()
{
    //controlls camera relevent to player position
    offset = new Vector3(Player.position.x - 3.0f, Player.position.y + 2.0f, 0);
    offset = transform.position - Player.position;
    localtoworldY = transform.TransformPoint(Vector3.left);

}

void Update()
{
    //need to give proper rotation of the camera around the player
    offset = Quaternion.AngleAxis(Input.GetAxis("Mouse X") * turnSpeed, Vector3.up) * offset;
    offset = Quaternion.AngleAxis(Input.GetAxis("Mouse Y") * turnSpeed, localtoworldY) * offset;
    transform.rotation = Quaternion.LookRotation(offset, Vector3.up);

    transform.position = Player.position + offset;
    transform.LookAt(Player.position);

    print(transform.rotation);

    // If the y axis go to 6.4 positive, it should stop but not stop working, same as if the camera hits a mesh or terrain.

    // If the camera changes in any direction regardless of x or y axis,player should be able to move relative to
    // the direction that the player is pressing (IE when the player press left, the Homicida malorum will move left regardless of
    // the angle of the camera).

}

}
Any advice or an explanation as to why this is happening would be much appreciated.

sentences:
Perspective correct interpolation of normal values I'm currently writing a software rasterizer and I'm at the point where I can draw arbitrary triangles with vertex colors and perspective correct texture mapping.
I do point and directional lighting by linearly interpolating the vertex normals and it works fine, only on big triangles you can notice that the lighting is somehow distorted when viewed from a very flat angle.
However, this is only visible when you're particularly looking for it but I was wondering if there is a way to have perspective correction on the normals too.

For the texture coordinates and other stuff this is being done by dividing the value by W or Z. But if you divide a vector by a single number you only change its magnitude, which is useless, as I'm normalizing the vector in the end for the lighting computation.
So, is there a way to do it?

sentences:
Why the plane is not black? I created a new material and changed the material colors to make it black:
R,G,B all value is 0 and A value is 255

The shader on the Plane is: Legacy Shaders/Transparent/Diffuse

But the Plane seems to be transparent.

The main goal is put a plane in front of the camera the FPSCamera and then using a script to fade in/out the alpha color.

sentences:
Divide screen in eight sectors Currently in our game we use a 4 directional movement. Some abilities are triggered on mouse click and "fired" in the direction the player has clicked.
For this, I have split the screen in 4 sectors (like 2 diagonal cuts) to determine in which general direction the player has clicked.

Back then, I found a short helper class for this:

public static class Triangle
{
    private static Vector2 topLeft = new Vector2(0, 0);
    private static Vector2 topRight = new Vector2(Orbs.graphics.PreferredBackBufferWidth, 0);
    private static Vector2 bottomRight = new Vector2(Orbs.graphics.PreferredBackBufferWidth, Orbs.graphics.PreferredBackBufferHeight);
    private static Vector2 bottomLeft = new Vector2(0, Orbs.graphics.PreferredBackBufferHeight);

    //Return true if p1 and p2 are on the same side of BA
    private static bool SameSide(Vector2 p1, Vector2 p2, Vector2 A, Vector2 B)
    {
        // Convert points to Vector3 for use the Cross product, which is Vector3-only
        Vector3 cp1 = Vector3.Cross(new Vector3(B - A, 0), new Vector3(p1 - A, 0));
        Vector3 cp2 = Vector3.Cross(new Vector3(B - A, 0), new Vector3(p2 - A, 0));
        return Vector3.Dot(cp1, cp2) >= 0;
    }

    //Return true if the point p is in the triangle ABC
    private static bool PointInTriangle(Vector2 p, Vector2 A, Vector2 B, Vector2 C)
    {
        return SameSide(p, A, B, C) && SameSide(p, B, A, C) && SameSide(p, C, A, B);
    }

    public static string GetAndSetPlayerOrientationByClickedSector()
    {
        Vector2 playerCenter = new Vector2(//getPlayerCenter);
        Vector2 mouseWindowPos = Microsoft.Xna.Framework.Input.Mouse.GetState().Position.ToVector2();

        if (PointInTriangle(mouseWindowPos, topLeft, playerCenter, topRight))
            return "North";

        if (PointInTriangle(mouseWindowPos, topRight, playerCenter, bottomRight))
            return "East";

        if (PointInTriangle(mouseWindowPos, bottomRight, playerCenter, bottomLeft))
            return "South";

        if (PointInTriangle(mouseWindowPos, topLeft, playerCenter, bottomLeft))
            return "West";

        return "";
    }
}

Now, we are extending our movement in eight directions and therefore I need to extend this helper class to return the diagonal directions (SouthEast and so on) as well.

I am not even sure if this is doable properly with this approach, but I guess I only need to define the points of the additional triangles.
Any suggestions on how to solve this are welcome.

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:
Entity component system design. Should ID of entities be continuous? I am implementing an entity-component system. Below is my current implementation in c++.

using ID = std::uint32_t;

class Entity {
public:
    Entity(ID index): index_{index} {
    }

    ID index() const;

private:
    const ID index_;
};

ID Entity::index() const
{
    return index_;
}

class Entity_factory {
public:
    Entity generate();

    void destory(ID id);
private:
    ID count_ = 0;
    std::unordered_set<ID> idle_IDs_;
};

Entity Entity_factory::generate()
{
    if (!idle_IDs_.empty()) {
        const ID id = *idle_IDs_.begin();
        idle_IDs_.erase(idle_IDs_.begin());
        return Entity {id};
    }

    assert(count_ != std::numeric_limits<ID>::max());
    return Entity {count_++};
}

void Entity_factory::destory(ID id)
{
    assert (id < count_);
    idle_IDs_.insert(id);
}

Note I use a hash table to keep track of all "destroyed" ID so I can use it again. This way, all the entity index will be as continuous as possible, so I can store components in a pool and refer them through index without wasting much memory. Another choice I can think is at component pools create a separated "index" array to keep track of entity and store all entity continuous. Which why do you prefer? Or do you have a better solution to this problem?

sentences:
transform.Rotate needs to change axis of rotation So I'm making a game in Unity. After many failed attemps from either being bored of the idea, or something going wrong and me giving up I think (hope) that will be the good one.

I have made a simple racing game with a track and a car. I am using transform.Translate to move it, but when I use transform.Rotate to turn it goes around the x axis. How do I change the axis it goes around? I cant find anything online.

            if (Input.GetAxisRaw("Horizontal") > 0.5f)
    {
        transform.Rotate(Vector3.right * Time.deltaTime * handling);
    }
    if (Input.GetAxisRaw("Horizontal") < -0.5f)
    {
        transform.Rotate(Vector3.left * Time.deltaTime * handling);
    }
    if (Input.GetAxisRaw("Vertical") > 0.5f || Input.GetAxisRaw("Vertical") < -0.5f)
    {
        transform.Translate(new Vector3(0f, Input.GetAxisRaw("Vertical") * moveSpeed * Time.deltaTime, 0f));
    }

Thanks for any help you can give me.

sentences:
Setting Orientation of Character in Bullet/Ogre I've been suffering from an issue regarding the implementation of orienting characters in a game I'm implementing using Ogre3D and Bullet physics.

What I have: A Direction Vector that the character is moving in, along with its current orientation.

What I need: To set the orientation of the character to face the way it is moving.

I have a snippet of code that sort of does what I want:

btTransform src = body->getCenterOfMassTransform();
btVector3 up = BtOgre::Convert::toBullet(Ogre::Vector3::UNIT_X);
btVector3 normDirection = mDirection.normalized();
btScalar angle = acos(up.dot(normDirection));
btVector3 axis = up.cross(normDirection);
src.setRotation(btQuaternion(axis, angle));
body->setCenterOfMassTransform(src);

Where 'body' is the rigidbody I'm trying to orient.

This snippet has a couple of problems however:

1) When changing direction, it tends to 'jitter' i.e. it rapidly faces one way, then the opposite for a second or so before correcting itself to the orientation it is supposed to be at.

2) Most times that the code is run I get an assertion error from Bullet's btQuaternion on

assert(d != btScalar(0.0));

Can anyone help?

Thanks!

sentences: How to implement in-app-Billing in libgdx? I'm trying to implement in-app-Billing in libgdx game. Does someone have a working example? There is some explanation on developer.android but it's not helpful for libgdx.

sentences:
Website within Skyrim I'm new to the Skyrim Creation kit but I've been through a few tutorials and looked through the documentation but I couldn't see a way to do this. Is it possible to display an HTML page within the game itself? Like a popup screen in-game that displays Google or other site? I've looked for a couple of days but feel I might be chasing something that's not possible.

Thanks

sentences:
Moving spotlight (or object) between 2 coordinates (image included) Given the origin position and direction for a spotlight.
How can I smoothly move a spotlight between two 3D coordinates?
Please use the picture below so I can easily comprehend this. I would like to move the direction of the spotlight from point A to B, for example.
All values/vectors are in 3D.

EDIT:
How should I properly do this, if given only current position and unit direction of spotlight?

sentences:
Vector transform equation explanation I'm trying to understand the maths of moving points in a 3d space by making a game written in C#.

I'm looking at this wolfire blog series which explains some basic 3d maths. I've read the first two parts but am stuck on the 3rd. I know it's all really rudimentary stuff but I find Googling for help with equations really hard.

The one I'm struggling with is:

0*(0.66,0.75) + 2*(-0.75, 0.66) = (-1.5, 1.3)

How can anything multiplied by 0 not be 0?

So my question is how does this look in code:

x(a,b) + y(c,d)

I know it's basic stuff but I just can't see it.

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:
How to find which side of a collider has been hit from hit.normal? In Unity3D, I can get the normal of the surface with which the collider collides using hit.normal, but is there a way to find which side has been hit with what is provided by Unity3D?

One solution is to see the orientation of the normal, and should work well for static objects but what about dynamic and moving objects whose orientation changes?

sentences:
Unity: OnTrigger detection issue with Child of Prefab I'm trying to make a set of tiles on the floor of my 3d world visible only when the Player is nearby them. This will work as single tile prefabs. Just not if I set them within an empty parent gameobject... which is what I really need, ideally, for the sake of game performance.

Once I put them inside the empty parent gameobject, OnTrigger stops working or even registering (debug.log doesn't show anything).

Does anyone know the correct way to access and switch the MeshRenderer on/off via OnTrigger (or OnCollision might be even better... I've tried and same issue) when I have a LevelManager that loads all my game objects at runtime? The Level Manager instantiates a prefab (clone), which has an empty gameobject that's holding the tiles as children?

Code I've tried and that's not working so far:

public class CubeVis : MonoBehaviour
{

    // Use this for initialization
    void Start()
    {

    }

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

    }

    private void OnTriggerEnter(Collider other)
    {
        Debug.Log("hit");
        if (other.gameObject.CompareTag("Cube"))
        {
            Debug.Log("hittt");
            //other.gameObject.GetComponentInParent<MeshRenderer>().enabled = true;
           // other.gameObject.GetComponentInChildren<MeshRenderer>().enabled = true;
            //other.gameObject.GetComponent<MeshRenderer>().enabled = true;

        }
    }

Inspector/Hierarchy info as requested:

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:
Hexagonal tilemap is being distorted So I made a hexagonal tilemap of ocean tiles and then picked a few tiles to be land. When I pick all adjacent tiles to the hexagon it usually works, but for tiles that are on certain columns it does not. Also, on these columns the tops and bottoms of tiles are missing.

It's hard to explain but here's a screenshot that should clear it up:

As you can see, on every other column the top and bottom of hexagons are missing, when all adjacent tiles are filled in to the centre tile it works fine for those columns without a bottom and top on hex, but when it's on the other column one of the adjacent tiles is displaced.

Any suggestions?

Code:

    baseLayer.setCell((int)islands[currentTile].x , (int)islands[currentTile].y, landCell);

    baseLayer.setCell((int)islands[currentTile].x + 1, (int)islands[currentTile].y + 1, landCell);

    baseLayer.setCell((int)islands[currentTile].x + 1, (int)islands[currentTile].y, landCell);

    baseLayer.setCell((int)islands[currentTile].x , (int)islands[currentTile].y - 1, landCell);

    baseLayer.setCell((int)islands[currentTile].x - 1, (int)islands[currentTile].y, landCell);

    baseLayer.setCell((int)islands[currentTile].x , (int)islands[currentTile].y + 1, landCell);

    baseLayer.setCell((int)islands[currentTile].x - 1, (int)islands[currentTile].y + 1, landCell);

sentences:
How to use Steamworks API before our game is on Steam? I'm part of a small team working on a game that we plan on distributing through Steam and integrating features which will utilize Steamworks API. We're not sure what the process is at the moment for how we can utilize Steamworks API without our game already being on Steam. Does anyone know where we need to start? I would imagine we will need an appid to be able to access Steamworks.

Is there a way that we can setup the game on Steam but not have it released until it's complete?

sentences:
Interval timing in XNA? I wonder if there is a simple way to use some kind om interval timing in XNA? For example call a method every 10 seconds?

I'm also wondering if there is a way to hide and unhide a sprite when it's on the screen?

Thanks!

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:
Load all content from folder I want to ask, is there way to load in xna all content from folder ?
For example in my content I have:
Images/hero
Images/car
Images/tree

I want to make something like this

Dictionary<string,Model> models = new ...

foreach(string name in content.getNames("Images"))
{
    models[name] = content.load<Model>("Images\\" + name);
}

sentences:
Server reconciliation for multiplayer games Reading the usual resources on multiplayer games (1, 2, 3); I have started working on my own multiplayer game.

I used a naïve approach that for every input I receive from a client, I immediately run it on the server.

For simple units (soldiers) everything works well, however I have an issue with "always moving" units (such as jet fighters); They require queuing inputs on the server (small delay, less than 100ms) and performing them in delay - and I read elsewhere (1, 2) that you should allow a window to receive inputs longer than said delay, since latency is variable (and could easily reach over 100ms) and reconcile the player's input.

Now I understand how this works for simple input such as movement, but what about using weapons / more advanced input?

What happens if player input comes with a delay, where he wishes to fire his weapon - what do I do? When do I notify other players of the shot? What about it's result? What if my cool-downs are out of sync due to this reconciliation?

Thanks.

sentences:
Object orbiting a 3d sphere I'm developing in libgdx java/android but not using any high-level environment like Unity.

I have a sphere at [0,0,0], with a PerspectiveCamera looking at it. Through the main game loop I have managed to have the camera orbiting the sphere in different directions. However, what I want to do is have a stationary camera and have 3 objects orbiting the sphere on their own accord, and their own orbital plane. Have been looking all day and struggled to get this working.

Eventually, I want to link the camera to always be above one of the orbitting objects, but that's at a later stage.

I also want to be able to have these objects orbitting on their own "forwards" direction, but able to change their direction over time. Say, from their top-down view, they each have a heading 0-359 degrees.

Anyone lend a hand with this? I've tried using 2D X/Y maps transposing onto mercator projections and then converted to spherical coordinates; I've tried Vector3 and setFromSpherical(); I've tried looking at Quaternions, and just got lost.

It's a relatively simple thing I'm trying to do, multiple orbiting objects around a sphere (radius 3, origin [0,0,0]), but just getting my initial approach wrong.

EDIT:

After talking the situation through, I have two options:  I either keep track of the orbiting objects with theta/phi as to their position around the sphere, or just calculate the amount by which to rotate based on the object's direction (0-359). On further talks with DMGregory, the latter option would introduce orbital instability/divergence with roudning errors so I have decided to change my requirement to the following:

Keep track of the object's position based on 2x360 degree values for  azimuth and polar, called theta and phi. The two coordinates are used to locate the object at any point in orbit around the sphere, but I need to be able to still "move" the orbital object "forwards" and thus change theta/phi accordingly, allowing the direction to still be changed.

Many thanks,

sentences:
Ray picking - get direction from pitch and yaw I am attempting to cast a ray from the center of the screen and check for collisions with objects.

When rendering, I use these calls to set up the camera:

GL11.glRotated(mPitch, 1, 0, 0);
GL11.glRotated(mYaw, 0, 1, 0);
GL11.glTranslated(mPositionX, mPositionY, mPositionZ);

I am having trouble creating the ray, however. This is the code I have so far:

ray.origin = new Vector(mPositionX, mPositionY, mPositionZ);
ray.direction = new Vector(?, ?, ?);

My question is: what should I put in the question mark spots? I.e. how can I create the ray direction from the pitch and roll?

Any help would be much appreciated!

sentences:
Is there a difference between using one large mesh with 100k polygons and using 1000 meshes with 100 polygons each? I'm planning on creating a first-person shooter for mobile. Now I know that fps games usually have a lot of meshes in the scene (trees, buildings, terrains, etc.). So I've been looking at a lot of Unity optimization tips. One thing I've noticed is that they always say "If you have a lot of objects in your scene, then each mesh must have low polygon count".

But how exactly does this help? If I have a lot of houses in my scene and I ensure that each house has very few polygons, wouldn't the total number of polygons in my scene be affecting the performance anyways? Or will my scene be rendered differently now that I've broken up the total polygon count into multiple parts?

sentences:
How would I create a save function to my random generated game? I'm making a 2D Tower Defense and currently looking into making a save feature. The problem is that my game is procedural generated (based on the rogue-like tutorial posted by Unity):

At runtime I generate a random amount (approx 7k) tiles of treasures, obstacles and different enemies at random locations. Some tiles will also be destructible and not exist when destroyed.

What should I do to save the position of each tile and values such as "Level" and "Gold"?

This is a list of what I need to be saved:

Player value (position, gold, level, health, inventory)
Building values (Tower/Building positions, health value etc)
Wave values (wave_level)
Board values (all tile positions such as obstacles, treasures etc)

NOTE: Every tile is a GameObject.

sentences:
What is the math to project a 3D object's center onto a 2D plane? What I really need is the x,y of the object when it is outside of the screen:

I'm actually coding a UI in Objective-C, not a game.
In this different kind of UI you navigate a 3D space with objects.
An observer is at (x=0,y=0,z=0) and objects have realCenter and realSize.
realSize is the size of the objects at z=1.
I have calculated the angular center of the objects to be:
angularCenterX = (objectRealCenter.x - observerCenterX) / distanceFromObserver

Objective-C code:
CGPoint angularCenter = CGPointMake((object.realCenter.x - observer.center.x) / distance,
                                    (object.realCenter.y - observer.center.y) / distance);

It works but when the observer passes the objects, the objects warp around. Instead of disappearing like they normally should, they come back.
The slider controls the z of the observer, as it moves and passes an object the objects comes back:
I'm sorry the gif is too slow.

sentences:
Tetris - Smooth piece drop (c++) So I have coded simple tetris games on the past but I have never done one where the pieces drop smoothly, like for instance Super Tetris 3 on the SNES.I am planning to learn SDL and for such I want to code a Tetris on it.

My questions are two, as follow :

Can you give me some hints as to how to code this?
How hard is to code this compared to make the pieces fall in the easy way?

sentences:
OpenGL strange rendering problem when buffers have different sizes I have encountered a very odd error in my program, "odd" in the sense that everything the API says suggests that the error should not occur.

I have a bunch of 2D un-indexed vertex data, and I want to render it as lines. So far, so good. Then, I wanted to make each vertex have its own (RGB) color, so I generate a color for each vertex. For simplicity, I chose red. Works fine, except now only 2/3 of the points are being rendered! The problem arises from the fact that each vertex's position data consists of only 2 numbers, whereas the color data consists of 3 numbers. So, the "position" buffer has 2 elements per vertex while the "color" one has 3 elements per vertex. I thought that using glVertexAttribPointer to tell this information to OpenGL would be enough, but turns out it's not. In fact, if I say that the color data has only 2 elements per vertex, using

glVertexAttribPointer(vertexColorID2,2,GL_DOUBLE,GL_FALSE,0,(void*)0);

(as opposed to 3), it renders all the points - except now I can only specify two numbers for the RGB color, so I can't get the right color. The full code of the issue is below:

    glUseProgram(programID2); //draw the graph
    graph_data = graphData();
    std::vector<double> graphcolordata(graph_data.size()/2*3); for (int i = 0; i < graph_data.size(); i += 3) graphcolordata[i] = 1;
    glEnableVertexAttribArray(vertexPosition_modelspaceID2);
    glBindBuffer(GL_ARRAY_BUFFER, graphbuffer);
    glBufferData(GL_ARRAY_BUFFER, graph_data.size()*sizeof(GLdouble), &graph_data[0], GL_STREAM_DRAW);
    glVertexAttribPointer(vertexPosition_modelspaceID2,2,GL_DOUBLE,GL_FALSE,0,(void*)0);
    glEnableVertexAttribArray(vertexColorID2);
    glBindBuffer(GL_ARRAY_BUFFER, colorbuffer2);
    glBufferData(GL_ARRAY_BUFFER, graphcolordata.size()*sizeof(GLdouble), &graphcolordata[0], GL_STREAM_DRAW);
    glVertexAttribPointer(vertexColorID2,3,GL_DOUBLE,GL_FALSE,0,(void*)0);
    glDrawArrays(GL_LINES, 0, graph_data.size()/2);
    glDisableVertexAttribArray(vertexPosition_modelspaceID2);
    glDisableVertexAttribArray(vertexColorID2);

Note: programID2 is my basic shader program, and the following variable definitions were previously used:

GLuint vertexPosition_modelspaceID2 = glGetAttribLocation(programID2, "vertexPosition_modelspace");
GLuint vertexColorID2 = glGetAttribLocation(programID2, "vertexColor");

Edit: Incredibly stupid error, figured it out immediately after posting when it had previously stumped me for half an hour.

    std::vector<double> graphcolordata(graph_data.size()/2*3); for (int i = 0; i < graph_data.size(); i += 3) graphcolordata[i] = 1;

should be
        std::vector graphcolordata(graph_data.size()/2*3); for (int i = 0; i < graphcolordata.size(); i += 3) graphcolordata[i] = 1;

When this initialization is fixed, it works fine. I would delete this, but I do not see how.

sentences:
libgdx actors and instant actions I'm having trouble with actors and actions. I have a list of actors, they all have either no action, or 1 sequence action

This sequence action has either :

a couple of actions (some are instant, some have duration > 0)
a couple of actions followed by a parallel action.

My problem is the following:

some of the instant actions are used to set the position and the alpha of the actor. So when one of the action is "move to x,y and set alpha to 0" the actor is visible for one frame at position 0,0 , move instantly to x,y for the next frame, and then disappears.

Though this behaviours is to be expected, I want to avoid it. How can I achieve that?

I tried to intercept the actions before I put actors in the stage but I need the stage width/height for some actions. So something like :

Action actionSequence = actor.getActions().get(0);
Array<Action> actions = ((SequenceAction) actionSequence).getActions();
for(Action act : actions){
    if(act.act(0))
        System.out.println("action " + act.toString() + " successfully run");
    else
        System.out.println("action " + act.toString() + " wasn't instant");
}

won't work.

It gets even more complicated when an actor can also have a repeat action in stead of the sequence action (because you have to only run the actions that have duration 0 once without repeat, and then start the repeat).

Any help is appreciated.

sentences:
How can I make my animation switch frames automatically without pressing any keys? So I have been trying to figure out for so long how I can loop the frames on my animation automatically without entering user input to prompt movement of my object.
I have four different frames for a sprite which I would like to loop, but at the moment it only shows the first frame. Here is the relevant code for my Play class (as the entire thing is too long):

package simpleslickgame;

import org.newdawn.slick.*;
import org.newdawn.slick.state.BasicGameState;
import org.newdawn.slick.state.StateBasedGame;

import java.util.Random;

public class PlayScreen extends BasicGameState {

    Image enemy;
    int enemyX = 800;
    int enemyY = 500;

    int RandomX;
    int RandomY;

    Animation blobfish, one, two, three, four;

    public PlayScreen(int state) {
    }

    public void init(GameContainer gc, StateBasedGame sbg) throws SlickException {
        enemy = new Image("C:\\Users\\User\\IdeaProjects\\Slick2D\\src\\main\\resources\\enemy.png");

        Image[] blobfishOne = {new Image("C:\\Users\\User\\IdeaProjects\\Slick2D\\src\\main\\resources\\blob-one.gif"), new Image("C:\\Users\\User\\IdeaProjects\\Slick2D\\src\\main\\resources\\blob-one.gif")};
        Image[] blobfishTwo = {new Image("C:\\Users\\User\\IdeaProjects\\Slick2D\\src\\main\\resources\\blob-two.gif"), new Image("C:\\Users\\User\\IdeaProjects\\Slick2D\\src\\main\\resources\\blob-two.gif")};
        Image[] blobfishThree = {new Image("C:\\Users\\User\\IdeaProjects\\Slick2D\\src\\main\\resources\\blob-three.gif"), new Image("C:\\Users\\User\\IdeaProjects\\Slick2D\\src\\main\\resources\\blob-three.gif")};
        Image[] blobfishFour = {new Image("C:\\Users\\User\\IdeaProjects\\Slick2D\\src\\main\\resources\\blob-four.gif"), new Image("C:\\Users\\User\\IdeaProjects\\Slick2D\\src\\main\\resources\\blob-four.gif")};

        one = new Animation(blobfishOne, 200,true);
        two = new Animation(blobfishTwo, 200, true);
        three = new Animation(blobfishThree, 200, true);
        four = new Animation(blobfishFour, 200, true);
        blobfish = one;

    }

    public void render(GameContainer gc, StateBasedGame sbg, Graphics g) throws SlickException {

        blobfish.draw(RandomX, RandomY);

        Random enemyX = new Random();
        Random enemyY = new Random();
        RandomX = enemyX.nextInt(1500);
        RandomY = enemyY.nextInt(1000);

    }

    public void update(GameContainer gc, StateBasedGame sbg, int delta) {
        Input input = gc.getInput();
        blobfish.start(); //I thought this would have ran the animation.

        isMoving = true;
        keyispressed = true;

        if (keyispressed) {
            isMoving = true;
        }

    }

    public boolean mouseClicked() {
        return true;
    }*/
    }
        public int getID () {
            return 1;
        }
    }

I did think that the 'blobfish.start();' line would have started the animation.
The variable 'blobfish' is the animation and 'enemy' is the image.

I'm a serious noob when it comes to Java game dev so any help as to why the animation is not running would be greatly appreciated.

sentences:
Creating HTML5 Canvas Objects in Javascript I'm currently trying to learn how to make HTML5 Canvas games with JavaScript. I would like to use object oriented JavaScript to manage the elements of the game, but i'm having trouble. I've done a lot of research already, but there seems to be a million ways of doing everything and no one source has been able to provide me with the information I think I need in order to get the result I think I want. More specifically I'm having trouble utilizing object prototypes. I've started out by creating the canvas in my code like so

var body = document.getElementsByTagName("body")[0];
var canvas = document.createElement('canvas');
body.appendChild(canvas);

My thought process has lead me to thinking that I should make an object out of this so I can use this dynamically later on if needed. So i've implemented it like so.

var gamearea = function(){
this.generate = function(){
  var body = document.getElementsByTagName("body")[0];
  var canvas = document.createElement('canvas');
  body.appendChild(canvas);
}

I know that I will probably need multiple contexts of the canvas element going forward, so I'm thinking that I should create a prototype for this like so.

var context = function() {
  return canvas.getContext('2d');
}

My thinking is that I can then ceate the objects for the context I need by instating them with there prototypes like so.

var background = Object.create(context);
var foreground = Object.create(context);

But in order to assign IDs to these objects so I can reference them for drawing on later, I need to assign IDs to them. I found a blog that indicated the proper formatting would mean implementing the following.

var background = Object.create(context, {id: {value: 'background'} });
var foreground = Object.create(context, {id: {value: 'foreground'} });

So my question is this. Is there a way to incorporate more unified formatting to all of this? Id like to establish this prototypes with their id's beforehand like I did with the gamearea object. I want to avoid giving objects properties inline. I am doing this right? Is there a better way? I'm I a complete idiot?

Thank you very much for your time on this guys, I really appreciate it. :)

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 do game developers make their game available for most of the resolutions? I'm developing a game with Java using Slick2D and I want to make a game that could target all the recommended resolutions, as you can see in almost every game you could have an option of changing the resolution. I would like to know how game developers make their game assets once and use different screen resolutions and it still looks good.

My only guess is that when you're in game (playing-moving, jumping) the viewport of the camera is set to some size at the same aspect ratio of the player's monitor.

How do game developers do this? Not just in-game, even when just browsing the menu.

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:
Vector magnitude in orientation First, a quick overview of my problem: I have a game entity which has a quaternion to represent its rotation/orientation. It also has a 3D vector in world space for its linear velocity. From the perspective of the entity there are also 3 virtual axes (the standard z=forward/backword, y=up/down, x=left/right).

With those relevant pieces, I want to find the amount of velocity relative to one of the entity's virtual axes (i.e. how fast is it moving to its right) so that I can display that to the player and/or apply a counteracting force in that direction.

I have a vague idea that I need to transform the unit vector corresponding to the direction I'm querying by the orientation quaternion and then calculate the angle between the result and the velocity vector. Then with that angle figure out how much of the velocity magnitude is in the target direction (maybe using cosine?).

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:
Can I get enough experience to get an industry job just by reading books? I've been recently working with DirectX and getting familiar with game engines, sub-systems and have done game development for the last 5 years. I have a real question for those whom have worked in larger game making companies before. How is it possible to get to into these big game creators such as Ubisoft, Infinity Ward or EA.

I'm not a beginner in my field and I'm going to produce a real nice 2D platform with my team this year, which is the result of 5 years 2D game creation experience. I'm working with prepared engines such as Unity3D or Game Maker software and using .Net with C# to write many tools for our production and proceeding in my way but never had a real engine programming experience 'till now.

I'm now reading good books around this topic but I wanted to know: Is it possible to become an employee in big game company by just reading books? I mean beside having an active mind and new ideas and being a solution solver.

sentences:
ArgumentException: The Object you want to instantiate is null I am trying to copy data over from a binary file but when trying to instantiate a gameobject, it comes out as "null".

static void LoadBuildings(SaveBuilding[] buildings)
    {
        if (buildings.Length == 0)
            return;
        foreach(SaveBuilding b in buildings)
        {
            if(b.type.ToString() == "Farm")
            {
                Farm build = Instantiate(Resources.Load("Farm")) as Farm;
                Debug.Log("Build: " + build);
                build.position.x = b.positionX;
                build.position.y = b.positionY;
                build.level = b.level;
                build.levelText = build.GetComponentInChildren<Text>();
            }
        }
    }

The debug line shows there is no object and when the next line tries to execute I get an error ArgumentException: The Object you want to instantiate is null.

I initially had it as Farm build = Instantiate(build.prefab) as Farm; as I get an error "Use of unassigned local variable".

I tried adding a prorperty above the if statement "GameObject build", I tried doing Farm build = new Farm() above the if statement also but still get the initial error.

I have a folder titled "Resources" and confirmed a prefab labelled "Farm" is there also.

Could it have anything to do with the "static" prefix for the method?

sentences: How to make animation in unity Dots hybrid? I'm working on isometric game in 2D but didn't find any good tutorial in how to handle animation...any help?

sentences:
Alternative for using game object/prefabs for level generator I just finished the Unity Tutorial for creating a simple 2D roguelike Mobile Game. Now I wanted to make my level bigger; finding or creating my own algorithm isn't the problem. My problem is that creating a game object or using a prefab for every single floor or wall tile is a bad idea. (Map 200x200 = 40000 objects). A comment under the tutorial said that and I'm incline to believe it. That much I can understand, but I can't find a alternative. What can I use besides object/prefabs?

Sidenote: I have decent programming skills, but am beginner with Unity.

The tutorial I followed: https://www.youtube.com/playlist?list=PLX2vGYjWbI0SKsNH5Rkpxvxr1dPE0Lw8F
I want to make the maps there bigger, but then everything goes slow motion.

sentences: How can the board fit the screen perfectly in Unity's 2D Roguelike tutorial? I follow the tutorial 2D Roguelike tutorial. I want to understand how happen that 10x10 board of 32x32 sprites covers screen perfectly? Like what does this depend on?

sentences:
How can I convert an html5 web game to an android app? I have already made an html5 game and it is in service.
I want to service this at Android app too.
I know little about Java or Kotlin, so I think the least risky way is to use a webview.
There is already a function to save game data with Oauth authentication.
I thought this part should be replaced with google play Oauth.

However, there is a problem that the app does not run when the player is offline. (Run the app fails to load any html document)

However, if you load a local html file, it will be rejected from the existing firebase SDK because there is no domain.

In fact, I know very little about native app development, so I don't know that what I don't know, what I need.

What should I do in this situation?

Do I need to rebuild my app in Kotlin or Java from scratch?
Do I have to use the same engine as Unity?
Do I have to rebuild with a framework like cordova?

The question may not fit here, but I need help. Please.

sentences:
libgdx Player movment dungeon crawler The player go's throe walls and stops when theres no wall.
Code:

package input;

import com.badlogic.gdx.Gdx;
import com.badlogic.gdx.Input.Keys;
import com.badlogic.gdx.math.GridPoint2;
import com.badlogic.gdx.math.Vector2;

import dungeon.Dungeon;
import player.PlayerCharacter;
import player.Player_state;

public class PlayerInputProcessor {
private PlayerCharacter player;
private Dungeon dungeon;

private final int NORTH = 0, SOUTH = 1, WEST = 2, EAST = 3;

public PlayerInputProcessor(PlayerCharacter player, Dungeon dungeon) {
    this.player = player;
    this.dungeon = dungeon;
}

public void HandleInput() {
    Vector2 pos = player.getVectorPos();

    if(Gdx.input.isKeyPressed(Keys.UP)) {
        if(canmovethere(new GridPoint2( (int) player.getVectorPosX() / player.getWidth(), (int) (player.getVectorPosY() - 3) / player.getHight()), NORTH)) {
            player.setVectorPosY(player.getVectorPosY() + 3);
        }
    }
     if(Gdx.input.isKeyPressed(Keys.DOWN)) {
        if(canmovethere(new GridPoint2( (int) player.getVectorPosX() / player.getWidth(), (int) (player.getVectorPosY() - 3) / player.getHight()), SOUTH)) {
            player.setVectorPosY(player.getVectorPosY() - 3);
            player.setState(Player_state.WALKING_FORWORD);
        }
    }
     if(Gdx.input.isKeyPressed(Keys.RIGHT)) {
         if(canmovethere(new GridPoint2( (int) (player.getVectorPosX() + 3) / player.getWidth(), (int) player.getVectorPosY() / player.getHight()), EAST)) {
            player.setVectorPosX(player.getVectorPosX() + 3);
        }
    }
     if(Gdx.input.isKeyPressed(Keys.LEFT)) {
         if(canmovethere(new GridPoint2( (int) (player.getVectorPosX() - 3) / player.getWidth(), (int) player.getVectorPosY() / player.getHight()), WEST)) {
            player.setVectorPosX(player.getVectorPosX() - 3);
        }
    }

    if(Gdx.input.isKeyJustPressed(Keys.E)) {
        if(player.hasSword()) {
            player.sword = false;
        }
        else player.sword = true;
    }

     player.setGridPos(new GridPoint2((int) player.getVectorPosX() / player.getWidth(),(int) player.getVectorPosY() / player.getHight()));

}
private Boolean canmovethere(GridPoint2 newpos, int die) {
    GridPoint2 nextpos = new GridPoint2();
    GridPoint2 nextpos2 = new GridPoint2();

    if(die == NORTH) {
        nextpos.x = newpos.x;
        nextpos.y = newpos.y + 1;
        nextpos2.x = newpos.x;
        nextpos2.y = newpos.y + 1;
        if(dungeon.getTile(nextpos).isPassable()) {
            return true;
        }
    }
    if(die == SOUTH) {
        nextpos.x = newpos.x;
        nextpos.y = newpos.y;
        nextpos2.x = newpos.x + 1;
        nextpos2.y = newpos.y;
        if(dungeon.getTile(nextpos).isPassable()) {
            return true;
        }
    }
    if(die == EAST) {
        nextpos.x = newpos.x + 1;
        nextpos.y = newpos.y;
        nextpos2.x = newpos.x;
        nextpos2.y = newpos.y + 1;
        if(dungeon.getTile(nextpos).isPassable() && dungeon.getTile(nextpos2).isPassable()) {
            return true;
        }
    }
    if(die == WEST) {
        nextpos.x = newpos.x;
        nextpos.y = newpos.y;
        nextpos2.x = newpos.x;
        nextpos2.y = newpos.y - 1;
        if(dungeon.getTile(nextpos).isPassable()) {
            return true;
        }
    }
    player.setState(Player_state.STANDING);
    return false;
 }
}

sentences:
DirectX Unproject troubles I have an orthographic projection and I try to unproject a point from screen space.

Following are the view and projection matrices:

var w2 = ScreenWidthInPixels/2;
var h2 = ScreenHeightInPixels/2;

view  = Matrix.LookAtLH(new Vector3(0, 0, -1), new Vector3(0, 0, 0),
                        Vector3.UnitY);
proj  = Matrix.OrthoOffCenterLH(-w2, w2, -h2, h2, 0.1f, 10f);

Here is how I unproject a Point p, the point is given in screen pixels:

var m = Vector3.Unproject(p, 0, 0, ScreenWidthInPixels, ScreenHeightInPixels,
                  0.1f, 10f, // znear and zfar
                  view *proj);

My code doesn't work, the matrix m contains only Nan.
When I try to invert view * proj I get back a Matrix with only zeros.

So I suspect my problem has something to do with the orthographic projection matrix.

Here are my questions:

Could the problem be caused by an underflow due to the large values in the OrthoOffCenterLH projection?
What parameters do I have to pass for x,y,width,height in Unproject(...)?
What significance has the minZ and maxZ parameter in Unproject(...)?
Does it matter what I pass for p.Z in Unproject(...)?

sentences:
Bullets moving with the camera, not the world, Java 2D I'm building a simple 2D Top-Down shooter game in Java.
I simply cannot get this to work:
I'm moving the camera and world differently. The world is moving when needed (when not in one edge, so it gives nice effect of not showing outside of the world). When the player moves and edges are not visible, the camera is moved when the player moves.
I implemented bullets right now, but the bullets move with the camera, not the world, like the correct physics should be :D
For moving the world relative to player position and camera, I'm using X and Y offsets.
Now the problem:
I'm creating a new bullet like this in my Player.java class:
new Bullet(handler, angle, x + width / 2 - handler.getCamera().getxOff(), y + height / 2 - handler.getCamera().getyOff(), 2, 4);

Bullet constructor:
public Bullet(Handler handler, double rad, double x, double y, double speed, int r)

I have to add half the width and height of the player, because otherwise it will shoot at the corner of my player sprite. Camera X and Y offsets to the bullet X and Y, because otherwise the bullet will be drawn to the coordinates relative to the world and will not shoot from correct places. But when the bullet is moving it moves with the camera.
Really wouldn't like to change the Camera movement!

sentences:
What's the use of bones in a 2D skeletal animation? I'm trying to implement a renderer using a scene graph and skeletal animation. As far as I know the bones in a skeletal animation just represent a connection between two joints. However, if a Joint knows its parent- and child-Joints what would you even need bones for?

Also, why would you need a separate class, Skeleton to represent a 2D entity (whatsoever) when the Skeleton is just an array of joints? Isn't that just a waste of memory? Am I missing something?

sentences:
SDL2.0.5 - SDL_KEYDOWN shows two identicle presses when only one key is pressed SDL2.0.4 using this code:

SDL_Keycode key = 0;

while(SDL_PollEvent(&(Global->event)) != 0)
{
    if(Global->event.type == SDL_QUIT)
    {
        /* Allow users to exit the game */
        break;
    }
    else if(Global->event.type == SDL_KEYDOWN)
    {
        /* Actual Keypresses */
        key = Global->event.key.keysym.sym;

        if(key == getSDLKValue("p-key"))
        {
            /* ... p key is pressed */
        }
        else if(key == getSDLKValue("q-key"))
        {
            /* ... q key is pressed*/
        }
    }
}

Works fine to get a single p key press when the key is pressed down. However, when manually compiling, and using 2.0.5 logging shows that a single key press has:

Key pressed: 112
Key pressed: 112

It gets pressed twice in the window, when only once in reality.

Is this a bug with SDL2.0.5? Running on Ubuntu 16.04, manually compiled SDL2.0.5.

sentences:
Packaging XNA game studio with project I published an XNA game (for Windows only) using Visual Studio's publish feature which is supposed to handle dependencies and all that.

When I installed it on myself it verified system requirements and installed correctly.

When I tried to install it on a fresh PC, it gave me an error that I was missing the XNA redist. I had to download it separately and then install the game. Is there a way of setting it to download XNA redist automatically as part of the 'one click' installation process? Or will the end user have to stay downloading the redist earlier?

sentences:
What is the proper strategy to manage vertex buffers? I have created a large variety of shaders for my game engine for different use cases. The vertex input for the shaders depend on what I want to do with them. For example, if I want to just render the wireframe of a mesh, I do not need texture coordinates, normals, etc. because I just need basic vertex information. However, when I render animated meshes (I use Skinned Animation), then I need additional information like joint link weights for each vertex.
My question is: What is the best way to manage Vertex Buffers? Do I create a Vertex Buffers for each use case when I create the model and store them for later use, i.e. I select at run-time which of the stored Vertex Buffers to use for rendering? Do I create the Vertex Buffer I need at run-time in each render cycle? What is the best way to do it?
I am using DirectX 11 and C# (using SharpDX as wrapper).

sentences:
When PlayerRemoving event is fired, for loop does not work properly while I was implementing the Backback save feature in my Roblox Game (using game.Players.PlayerRemoving:Connect(), I found that when I used a loop of any form (for, while,etc.), it would not run correctly. Here is a test program which I wrote to observe this issue:

game.Players.PlayerRemoving:Connect(function(player)
    local testList = {"Hello", ",", "world"}
    for i=1,3,1
    do
        print(testList[i])
    end
end)

However, when this code is ran, all I see in the output window is:

Hello

And nothing else.
This issue is causing a lot of issues with the rest of the code, can somebody please help? It would be very useful!

sentences:
Efficient Tile-based collision detection for a lot of squares? currently I am working on my own take of a tile-based game (think Terraria, but less fantastical (I think that's a word? Sorry if it isn't)).

Anyway, I currently have collision detection working (for corner cases even!) which was a big step for me. There is something extremely gratifying about seeing a sprite not run through a block. But then I had the idea to benchmark. Bad idea.

1,000 squares, no problem.
10,000 squares, for 3 characters was kind of laggy.
100,000 squares (really huge map), for 3 characters was unplayable.

I'm having the issue where I don't want to even consider the blocks that are too far from the player, characters, items, etc., but I don't want to load those in-out of memory constantly.

Here's my algorithm so far, feel free to criticize.

foreach (Block in level)
{
    if (distance from block to player > a specified amount)
        ignore this block;
    else
    {
        get the intersection depth between the two bounding boxes
        if (depth of intersection != Zero-vector)
        {
            check y size vs x size
            resolve on smallest axis
        }
    }
}

As you will note, when the level size get's bigger, the Order of this algorithm grows by N blocks. I would like to not even consider blocks that aren't even near the player.

I'm thinking maybe use a (0,0) to (mapWidth,mapHeight) double-array of blocks instead of a list, calculating a danger-zone depending on the person's position e.g., if player's position is at (10, 20) it will look from (0, 10) to (20, 30), or so on.

Any thoughts and considerations are awesome, thank you.

sentences:
Smooth Camera Zoom Factor Change I have game play scene in which user can zoom in and out. For which I used smooth camera in the following manner.

           public static final int CAMERA_WIDTH = 1024;
           public static final int CAMERA_HEIGHT = 600;
           public static final float MAXIMUM_VELOCITY_X = 400f;
           public static final float MAXIMUM_VELOCITY_Y = 400f;
           public static final float ZOOM_FACTOR_CHANGE = 1f;

            mSmoothCamera = new SmoothCamera(0, 0, Constants.CAMERA_WIDTH,
                            Constants.CAMERA_HEIGHT, Constants.MAXIMUM_VELOCITY_X,
                            Constants.MAXIMUM_VELOCITY_Y, Constants.ZOOM_FACTOR_CHANGE);
            mSmoothCamera.setBounds(0f, 0f, Constants.CAMERA_WIDTH,
                            Constants.CAMERA_HEIGHT);

But above thing create problem for me. When user perform zoom in and leave game play scene then other scene behaviour not look good. I already set zoom factor to 1 for this purpose. But now it show camera translation in other scene. Because scene switching time it so much small that player can easily saw translation of camera that I don't want to show. After camera reposition, everything works perfect but how to set camera its proper position.

For example my loading text move from bottom to top or vice versa based on camera movement.

Any more detail you want then I can able to give you.

sentences:
Is using something like MakeHuman frowned upon while developing 3D games? I came across this interesting application called MakeHuman, and I was wondering what developers in the gaming community thought about creating and exporting characters to Unity using this application. I'm not an artist, so a tool like this helps me create characters without having to pay someone else to model them from scratch.

If I were taking a class in game development, would it be permissible to use something like this to create characters rather than create them myself (in Blender or Maya, for example)? What benefits are there to consulting an artist rather than using tools like this?

sentences:
What libraries/engines should I use? I have some pretty decent general programming skills and elementary C/C++ skills. I am a complete noob in game/graphics programming and I would like to start.

I want to gradually learn, starting off by something like Pong, and gradually making more difficult stuff for learning. My ultimate goal is to make some COD:BO zombies clone (I love this game).

So what libraries/engines can you guys recommend, first to even start drawing stuff on the screen, and later more sophisticated stuff for getting a FPS going.

sentences: How to use JBullet in LWJGL? I have got a problem, because I wan't to add collision detection to my 3d game, which I am developing in Java, using the Lightweight Java Game Library (LWJGL). I have googled a bit, and I have found this interesting library, called JBullet, which is a port of Bullet for C/C++. But I can't find any tutorials covering, how to add collision detection to my 3d shapes in LWJGL. Is there any simple way to do it, or please direct me to a tutorial, covering that topic.

sentences:
How to delay a timer when it's run the first time in update method not using a coroutine In the code below I am resetting a timer after a duration maxiTime within the update method.
I want to delay the timer before it begins to run for a certain duration. I believe this could be done with a coroutine, but I am using StopAllCoroutines, so I need to do this within the update method. How can I get the delay only before the first run?

        timeElapsed +=1;
    if(timeElapsed >= maxiTime) {

        timeElapsed = 0;

        Debug.Log ("Thank You!");
    }

sentences:
Android glsl discard problem Whenever I use discard or an if statement in my shaders, I get an error message with the text

<qgl2DrvAPI_glAttachShader:398>: GL_INVALID_VALUE

I think this is a version problem, but I'm really not sure.

sentences:
In Unity, how do you check if a camera is rendering anything? (Unity 2018.3) I'm trying to have a camera automatically disable if it's not rendering anything.

Is there a simple way to check if a camera is blank/empty?

Edit: Alternatively, is there a way to prevent a camera from rendering if there is nothing in it's view?

For example, I do not want MSAA applied to a blank camera. (I'd hope it would attempt AA, but effectively do zero work)

sentences:
Pitch (X-axis) rotation problem Situation:
From a first person perspective (camera position) I want to be able to grab an object and have it fixed to the center center of the screen while looking up-down (pitch) and looking left-right (yaw). The yaw works fine. The pitch only works facing the object head on when camera position z > object z. Turning 180 degrees the pitch rotation is opposite. How do I compensate for this. This is what have:

double yawRadians = Math.toRadians(yaw - oldYaw);
double pitchRadians = Math.toRadians(pitch - oldPitch);

//center position of object, minus camera position
double x = grabbedObject.x0 - position.x;
double y = grabbedObject.y0 - position.y;
double z = grabbedObject.z0 - position.z;

double sinX = Math.sin(pitchRadians);
double cosX = Math.cos(pitchRadians);

double sinY = Math.sin(yawRadians);
double cosY = Math.cos(yawRadians);

double sinXY = sinX * y;
double cosXZ = cosX * z;

double newX = cosY * x + sinY * sinXY - sinY * cosXZ;
double newY = cosX * y + sinX * z;
double newZ = sinY * x + cosY * -sinXY + cosY * cosXZ;

grabbedObject.addTranslation(newX - x, newY - y, newZ - z);

sentences:
How to move empty colliders? I have 2D background in unity on which I would like to add multiple circle, box colliders.
Assets are not separated. I have drawn assets on background.

How to move circle colliders with mouse or keyboard shortcut on the background?
It's not very pleasant to define x,y position wherever needs to go for every collider.

sentences:
How can i rotate the camera around an object, using compass? I want the camera to rotate around an object in Y axis, when you rotate your phone. how can i do this?

i already have the code to do it using mouse, but i need it to turn with compass. here's the code for movement with mouse:

    mouseX = Input.GetAxis("Mouse X");
    offset = (Quaternion.AngleAxis(mouseX * cameraSpeed, Vector3.up) * offset);
    transform.position = point + offset;
    transform.LookAt(point);

i know that setting the mouseX value to change with compass direction is my answer, but how can i do it?

sentences:
Animating from json file in pygame? I have got a json file and I am trying to load the single sprites from that file
but I gives this error after a few loops and also the animation is not smooth(gets stuck)
error:
Traceback (most recent call last):
  File "test.py", line 18, in <module>
    screen.blit(image, (0, 50))
TypeError: argument 1 must be pygame.Surface, not None

This is the json file I am using:
{
  "textureAtlas": {
    "texture": "Run (32x32).png",
    "regionWidth": 32,
    "regionHeight": 32
  },
  "cycles": {
    "animation0": {
      "frames": [0,1,2,3,4,5,6,7,8,9,10,11]
    }
  }
}

The script for the animation:
import json

pygame.init()

clock=pygame.time.Clock()
c=0
def lcAnim(sfile):
    global c
    with open(sfile) as f:
        data=json.load(f)
        img=pygame.image.load(data['textureAtlas']['texture'])

        while c<len(data['cycles']['animation0']['frames']):
            img.set_clip(pygame.Rect(data['cycles']['animation0']['frames'][c-1]*32,0,32,32))  # Locate the sprite you want
            draw_me = img.subsurface(img.get_clip())  # Extract the sprite you want
            c =c+1
            print(c)
            return draw_me
    c=0

and the main script:
import pygame
import lcanim #name of the animation script
(width,height)=(300,200)
clock=pygame.time.Clock()
screen=pygame.display.set_mode((width,height))
pygame.display.flip()
running=True

while running:

    image = lcanim.lcAnim('run.sf') #name of json file
    for event in pygame.event.get():
        if event.type==pygame.QUIT:

            running=False

        screen.blit(image, (0, 50))
        #screen.blit(alimg,(-10,10))
        pygame.display.update()
        screen.fill((255,255,255))
    clock.tick(10)
pygame.quit()

Here's a video showing the problem:
https://youtu.be/8IeaqVCxvms
(sorry other video sharing services were not working)

sentences:
Virtual infinite plane in shadow map I have a WebGL deferred rendering pipeline, where I'm rendering shadow map with VSM technique. The goal is that the scene, or model, is hovering in space, and in addition to casting shadow on itself, it has to cast a shadow on invisible plane below it.

Now my current setup involves a finite plane geometry, but it's rather complicated.

I realized that since I only need the plane's depth, I could model the plane directly in the shadow map fragment shader with signed distance function. The idea seems to work, but I'm having trouble transforming the plane using my view & projection matrices (the renderer doesn't need any model matrix).

float sdPlane(vec3 p, vec4 n) {
    // n must be normalized
    return dot(p,n.xyz) + n.w;
}

void main(){
    vec2 uv = gl_FragCoord.xy/viewport;

    vec4 eye_data = vec4(
        texture2D(eye_normal, uv).rgb,
        unpack16f(texture2D(eye_depth, uv).rg));
    vec4 eye_data_floor = vec4(
        texture2D(eye_normal_floor, uv).rgb,
        unpack16f(texture2D(eye_depth_floor, uv).rg));

    if (eye_data.w == 0.0) {
      // some big enough constant because the depth clearing value can only
      // be in 0-1 range
      eye_data.w = 1000.0;
    }

    vec3 normal = eye_data.xyz;
    float depth = eye_data.w;

    // clipping planes scaling
    float cps = 1.0 / (far - near);

    float floor_depth = sdPlane(
        (inv_eye_proj * vec4(clip, cps, 1.0)).xyz,
        eye_view * vec4(0.0, 1.0, 0.0, 0.0)
    );
    floor_depth = floor_depth / cps;

    depth = min(depth, floor_depth);

    if (depth == floor_depth) {
        normal = vec3(0.0, 1.0, 0.0);
    }

    depth = near + (depth * (far - near));

    vec4 ro = inv_eye_proj * vec4(clip, 1.0, 1.0);
    vec3 rd = normalize(ro.xyz);
    vec3 eye_p = depth * rd;
    vec3 p = (inv_eye_view * vec4(eye_p, 1.0)).xyz;

    float occlusion = OcclusionVSM(p, normal);
    float lambert = clamp((light_rot * normal).z, 0.0, 1.0);
    float intensity = (occlusion*0.8+0.2) * lambert;

    gl_FragColor = vec4(vec3(intensity), occlusion);
}

sentences: Formula to calculate the changes in the fortunes of a stock based on how many shares are bought or sold I am creating a stock market simulator for an event in my college. Supposing I have 20 companies in it all starting with a common base price, I need a formula to calculate the changes in the fortunes of a stock based on how many shares are bought or sold.

sentences:
Can a Switch Dev Kit do everything a normal Switch console can do? Today, news came out that the Nintendo Switch Dev Kit is only 50,000 yen (around $450-500 USD). I had been planning to buy a normal Nintendo Switch for $300, but since I enjoy making little games in Unity and it's only ~50% more expensive to get a Dev Kit, I thought maybe I'd get a Dev Kit instead of a console.

When I brought up the idea with a friend, they asked, "Can the Dev Kit even play normal games?"

It's an excellent question, and I have no idea what the answer is. I'm hoping people here know. More generally, what draw backs are there from getting a Dev Kit instead of a normal console? Does it weigh significantly more? Is it more bulky or less comfortable to carry around? Does the battery not last as long? Is it even portable? Can it play all the normal retail games that the ordinary console can?

sentences:
How to unsmooth polygons in 3dsMax i am creating a game using a "Low Poly Art Style".   Meaning there is an effect of polygons on the model.  Whilst modelling a tree, a portion somehow became smooth and i continued to model not knowing this.  What i am wondering is,  is there a way to unsmooth these polygons to look similar to the rest of the model.  EDIT... The smoothed are is on the tree trunk in the middle.

Below is an image of the model in question.

Thanks is advance guys...

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:
How can you tell if what you're buying is legal? In the past few days I've been browsing 3D asset marketplaces and repositories (I've been doing it for ages, but a lot recently). Many assets are paid for, others are free. In the past few days I've found suspicious activity on these sites, for example something sold on one site and given free on another site. I've recently reported many of these cases to the respective sites. The problem is, that now I look really closely at these models before buying them. I try to compare textures, geometry where I can, and poly count as tools for sniffing out property theft (copyright infringement).

I have bought some real bargains lately, and I know they're the real deal because I have spoken individually with the artists and am 99% I know it's the real deal. However how can I approach a store and have any confidence that what I'm buying isn't some reskinned asset ripped from a commercial game? (These are harder to spot as comparing geometry is harder)? I've tried to stick to reputable and popular sites, but I've already reported a number of people on these for abuse. It's worrying how often sellers aren't discovered by the site's owners or anyone else before I say something. For example there might be multiple thumbs up or 5 star reviews for people buying models that I've found out are actual rip-offs, or have been ripped off by someone else.

How can I know that a model I buy didn't come from some commercial game from 5 or 10 years ago, or from some mod from some point in time? Do I have any protection for example in future I release a commercial game and it's discovered that one of my assets from someone's mod or a commercial game from the past?

A while back I'd bought some products that seemed to be real bargains, and now that I'm a lot more cautious about these issues, I regret buying them.

sentences:
Collision with tile corners/seams in 2D platformer There seems to be a lot of somewhat related questions answered already, but none I read answered my exact problem.

I have a 2D platformer whose world is made entirely out of tiles that are in a regular grid. When there is a collision, I just move the character to the position he was in prior to the collision and it works well enough for me.

The character can fly/slide in the world, so I also want to set the speed towards the collided tile to zero. Here lies my problem.

At the moment the only way to do this I can think of is to check the difference between the character position and the center of the tile. If (the absolute value of the) x-difference is greater, then it is a horizontal collision. If y-difference is greater, then it's a vertical one. However, as the character is sliding horizontally on tiles, from one tile to another, sometimes he stops at the seam of the tiles because momentarily the x-difference becomes a tiny bit greater than the y-difference (due to float inaccuracies I suspect). I don't know if it's possible to change this algorithm to fix this, or if I need a new one. Any algorithm will do, as long as it fulfills the "requirements" stated above.

If at all possible, I want to treat the x- and y-collisions identically, because the movement is not just walking horizontally.

Image illustration: http://i.stack.imgur.com/URkoV.png

sentences:
Ways to represent/store different regions in a non tiled map I am developing a game where agent tribes fight each other for land.The map is a 2D map.Each agent has an instance of group object that represents their family.And each group object contains information about the tribe.

Now the issue is how to store and represent the area each tribe owns.I was thinking of something along the lines of having the land split into own-able tiles of land and then having an ArrayList of Dimensions representing the region (width,height) and also storing positions alongside in order to know where the region starts from..Now the way tribes gather the land owned is as follows:

If the current square that agent is on is free then take the land
If not then if the current square is occupied try to fight it off from the other agent group

Now please note that actual agent movement is not based on tiles therefore I am not sure if my idea of representing the own able land as tiles is good for this.

So I am seeking on advice from anybody who has had a similar problem to deal with or have good ideas that they can share.

Also I am attaching an image to better explain my situation.

NOTE: The rectangles of different colours represent the areas owned by the agents whereas the circles in different colours are the agents themselves.

sentences: What are the most commonly used programming languages? When I took my Java courses a year ago, I was told that Java is used mostly in the overseas gaming companies while C++ is used here in the US. What languages should I focus on learning in-depth?

sentences:
Does distant and large objects use up a lot CPU usage? Okay I'm new to Unity, and I'm making a space sim pc game. You know, space is huge, light years of distance between stars. Even if I set 1 AU (150,000,000 KM) as 1 unit, 1 light year will be 63,000 units, that's far far away from one another. Let say planet Earth's scale is 1, then the Sun will be 110x times the size of the Earth. This is big, because if the player's scale is 1, then we need to rescale the planets, the stars. I don't know whether or not Unity will handle large objects or far objects nicely, what I mean here is if a planet is, for example 10000 units, will the objects stop being processed by cpu? And does large objects use more cpu performance, if it does, how much it use?

What I want to know
1. Does far far away objects use up more cpu usage?
2. Does gigantic objects use up more cpu usage? I know it sure does, but how much? Is it 2x scale = 2x cpu usage on that object?
3. Do you have a way to minimize the usage of cpu, or more efficient way to do with large and distant objects?

I'm just started Unity last month, and get excited about how much could Unity do, but i always concern about how much cpu usage does this task use up. Any ideas?

sentences:
How can i make my soldier to patrol over the space stationin random? I mean i want to bake all the places in the space station and make the soldier to move automatic around the spaceship to random places.

What i did so far is placing the soldier at a start point. Added a camera as child to the soldier. Added a nav mesh agent component to the soldier.

Attached a script to the soldier: It's not my script. I don't want the soldier for now to chase only to walk randomly around the space station.

I didn't change any of the setting on the Nav Mesh Agent component in the inspector and i didn't

Should i change anything in the nav mesh agent component and if so what ?

How do select or set what areas to bake so the character will know to walk to this areas or if i want to select all the areas ?

How do i tell the character when to turn right or left in case there is a wall ?
Could be also random to turn left or right. Depending if there is left and right ways or maybe there is also straight way so that's 3 possible ways to move to.

clicked the Bake button yet.

I didn't write yet the script.

using UnityEngine;
using System.Collections;

public class SoldiersPatrol : MonoBehaviour
{

}

sentences:
Collisions with complex assets from Blender in SceneKit I have a very basic workflow question: I'm prototyping a game with Apple's SceneKit framework. It can automatically create a mesh for collision detection, but it will always be a convex hull. This works okay for simple meshes, but now I want my character wo walk into a house.
The options I could come up with:

Use the same mesh for the physicsShape (could be too complex and a performance bottleneck)
Build the level in SceneKit and only create atomic building blocks in Blender
Create a second low-poly version of the model and use that for collisions (basically twice the work?

As you can see I have zero experience with game development and best practices. What is the typical way to do this?

sentences:
Rigidbody slows down when its going up a slope. What can I do? I am using unity and I am creating a 3d topdown game. There is no jump feature. The input handling supports only x and z axis player movement. Climbing slopes or  falling from gaps is something I want to happen without certain input.

So,
I have a rigidbody which I move by directly setting its velocity. When it goes up a slope it slows down.

I would like it to keep the same speed.

Now I do it like this:

    void Update(){
moveInput = new Vector3(Input.GetAxisRaw("Horizontal"), 0f, Input.GetAxisRaw("Vertical"));
}

void FixedUpdate(){

MyRB.velocity = moveInput.normalized * runSpeed
}

I am using a capsule collider on the rigidbody and a box collider for the slope. The physics materials of the colliders are the default/none (not changed).

sentences:
Engine for 2.5D Voxel Based City Simulation We're looking into making a game where you're part of a city and you're interacting with its economy and people. The world should be an open and procedurally generated sandbox to enable players to the most freedom they can get.

The question we're unable to answer is whether to use a game engine and if yes, which one. We don't have any experience with engines as we're from a web development background.

The style is planned to be similar to Kingdoms and Castles:

low poly
voxel based
more or less 2.5D as in you're looking down on the world

We have been thinking about Unity and Unreal and are wondering whether those engines are "overkill" or whether they are able to compile down to a result where the unnecessary parts aren't in the game anymore. Also we've been thinking about a HTML5 / JavaScript basis. Obviously, it has immense platform benefits, but we're not sure whether performance would be adequate.

tl;dr to not get this lost in discussion: What are the benefits and drawbacks of

the usual 3D game engines like unity and unreal
a web based approach
a completely new engine (would the extra effort be justifiable?)

Thanks for any advice

sentences:
Player Flying after colliding - Unity I have a Player with a capsule collider on him and i have various objects in the scene. Most of the objects have either mesh collider or box collider enabled.
When i move my player and the player collides with any object, my player just starts flying into space, literally.
Any way to fix this?

Thanks in Advance.

The code i have on my player is this:

using UnityEngine;
using System.Collections;

public class Controller : MonoBehaviour {
Animator anim;
Rigidbody rbody;
float inputH;
float inputV;
int Life=20;
bool Dead=false;
public float sensitivity=10f;
void Start () {
    anim = GetComponent<Animator> ();
    rbody = GetComponent<Rigidbody> ();
}
void Update () {
    if (Dead == false) {
        inputH = Input.GetAxis ("Horizontal") * 50f;
        inputV = Input.GetAxis ("Vertical") * 20f;
        anim.SetFloat ("inputH", inputH);
        anim.SetFloat ("inputV", inputV);
        float moveX = inputV  * Time.deltaTime;
        float moveZ = inputH * 0.5f * Time.deltaTime;
        this.transform.position += this.transform.forward * moveX;
        this.transform.position += this.transform.right * moveZ;
        transform.Rotate(0, Input.GetAxis("Mouse X") * sensitivity, 0);
    }
    if (Input.GetKey (KeyCode.Z))
        Life--;
    if (Life == 0)
        Dead = true;
    anim.SetBool("Dead",Dead);
}
}

sentences:
How can I create lit-up areas during night-time in a top-down 2D game? I am trying to implement a super simple day/night cycle. It works fine, at 9pm it gets dark, and at 6am it gets bright.

However, I am "creating" darkness by simply setting the alpha of a black Image that covers the entire screen, ie:

if(NightTime){
    Color tempColor = dayNightImg.color;
    tempColor.a = 0.5f;
    dayNightImg.color = tempColor;
    isDark = true;
}

So, in order to create the Illusion of light, I would have to be able to ignore part of this Dark Image, i.e "Light it up", for example in a circle around my character. Is there some way I can do this? Or Is my approach too simple for this effect?

Here is an example of what I want:

sentences:
Set background color in Phaser I want to set a background color for my game.

I found this solution:

function create() {
  this.cameras.main.setBackgroundColor("#d5d5d5");
}

but I want to be sure that there is not a more standard way to do this, because editing the camera's property means that the background would be different for another camera.

Thank you for your help.

sentences:
How to expand the limit of screen mouse access for FPS side rotation I started coding in Godot and i have a working FPS controller but the problem is that when i move my mouse sideways , it cannot move my sight beyinid that side of my screen , in other words the movement of my charecter is limited by the size of my screen , how to prevent this
Rotation code
func _input(event):
if event is InputEventMouseMotion:
    head.rotate_y(deg2rad(event.relative.x * -mouseSensitivity))
    camera.rotate_x(deg2rad(event.relative.y * -mouseSensitivity))

sentences:
How do I render Hindi text in Libgdx? How do I render Hindi text in Libgdx using any font? For example, I want to render the word "प्रकार".

Here is what I have, so far:

import com.badlogic.gdx.Game;
import com.badlogic.gdx.Gdx;
import com.badlogic.gdx.graphics.GL20;
import com.badlogic.gdx.graphics.OrthographicCamera;
import com.badlogic.gdx.graphics.g2d.BitmapFont;
import com.badlogic.gdx.graphics.g2d.SpriteBatch;
import com.badlogic.gdx.graphics.g2d.freetype.FreeTypeFontGenerator;

public class MyGdxGame extends Game
{
    SpriteBatch spriteBatch;
    BitmapFont font;
    OrthographicCamera camera;
    String text, text1;
    private byte[] myBytes = { (byte) 0xe0, (byte) 0xa4, (byte) 0xa8,
            (byte) 0xe0, (byte) 0xa4, (byte) 0xbf, (byte) 0xe0, (byte) 0xa4,
            (byte) 0xb6, (byte) 0xe0, (byte) 0xa5, (byte) 0x89, (byte) 0xe0,
            (byte) 0xa4, (byte) 0xa4 };
    private String myName = new String(myBytes, Charset.forName("UTF-8"));
    private String hindiStr = "ँंःअआइईउऊऋऎएऐऍऒओऔऑकखगघङचछजझञटठडढणतथदधनऩप"
            + "फबभमयय़रऱलळऴवशषसहािीुूृॆेैॅॊोौॉ़्।०१२३४५६७८९INV";

    @Override
    public void create()
    {
        camera = new OrthographicCamera();
        camera.setToOrtho(false, 400, 640);
        spriteBatch = new SpriteBatch();

        FreeTypeFontGenerator generator
                = new FreeTypeFontGenerator(Gdx.files.internal("font/mangal.ttf"));
        FreeTypeFontGenerator.FreeTypeFontParameter parameter
                = new FreeTypeFontGenerator.FreeTypeFontParameter();

        // +FreeTypeFontGenerator.DEFAULT_CHARS; The characters the font should contain
        parameter.characters = hindiStr;
        parameter.size = 15;

        font = generator.generateFont(parameter);
        font.setColor(1.0f, 0.0f, 0.0f, 1.0f);

        generator.dispose();

        text = "शुभ प्रभात";
        text1 = "आप का स्वागत है";
    }

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

        spriteBatch.setProjectionMatrix(camera.combined);

        spriteBatch.begin();
        font.draw(spriteBatch, "सूक्ष्मजीवों के विभिन्न प्रकार ", 10, 30);
        font.draw(spriteBatch, myName, 10, 100);
        spriteBatch.end();
    }

    @Override
    public void resize(int width, int height)
    {
        camera.setToOrtho(false, width, height);
    }

    @Override
    public void dispose()
    {
        font.dispose();
        spriteBatch.dispose();
    }
}

sentences:
Is information about game assets copyrighted? Let's say I extracted some assets from a closed source game.

Am I allowed to publish information (something like a list of filenames, sizes, duration, dimensions...) about those assets?

sentences:
Why is my render engine only rendering one frame? Just for background, I'm designing a soft engine in C# using the SharpDX DirectX wrapper library. I've gotten around to implementing the render engine, and I can render a texture to a face, except it only renders exactly one frame. It renders a triangle once, but on the next draw call, the screen is cleared. Even though I've made sure the render call is still firing every frame, the rendered item goes away, and does not get re-drawn in the next or any subsequent frame.

I think it has something to do with the way I initialize my resources; to minimize shader switching and boost performance, I have my render engine hold a set of pre-defined shader classes. Then, only when it is necessary will the shader access the device context and set the vertex, constant, index, etc. buffers one time when the method Shader.SetActive() is called. When the shader needs to render something, it can write directly to the buffers that have been created and set in the Shader.SetActive() method, using a method called UpdateShader().

Here's the source for SetActive():

public override void SetActive(D3D11.Device device, D3D11.DeviceContext context)
{
    /*========================== Set Pointers to GPU Buffers ==========================*/
    // write Matrix data first to constant buffer
    matrixBuffer = new D3D11.Buffer(device, matrixBufferDesc);
    vertexBuffer = new D3D11.Buffer(device, vertexBufferDesc);
    indexBuffer = new D3D11.Buffer(device, indexBufferDesc);

    context.InputAssembler.SetVertexBuffers(0, new D3D11.VertexBufferBinding(vertexBuffer,
    Utilities.SizeOf<VertexPositionTexture>(), 0));
    context.InputAssembler.SetIndexBuffer(indexBuffer, Format.R32_UInt, 0);
    context.VertexShader.SetConstantBuffer(matrixBufferPos, matrixBuffer);
    context.PixelShader.SetShaderResource(0, shaderTexture);

    context.InputAssembler.InputLayout = inputLayout;

    /*========================== set context shaders ==========================*/
    context.VertexShader.Set(vertexShader);
    context.PixelShader.Set(pixelShader);
    context.PixelShader.SetSampler(0, samplerState);

    context.InputAssembler.PrimitiveTopology = PrimitiveTopology.TriangleList;
}

Here's the code for UpdateShader():

public void UpdateShader(D3D11.Device device, D3D11.DeviceContext context,
    Matrix worldViewProj, VertexPositionTexture[] vpts, int[] indices)
{
    DataStream mappedResource;

    //write to buffers
    context.MapSubresource(matrixBuffer, D3D11.MapMode.WriteDiscard, D3D11.MapFlags.None,
        out mappedResource);
    mappedResource.Write(worldViewProj);
    context.UnmapSubresource(matrixBuffer, 0);

    context.MapSubresource(vertexBuffer, D3D11.MapMode.WriteDiscard, D3D11.MapFlags.None,
        out mappedResource);
    mappedResource.WriteRange(vpts);
    context.UnmapSubresource(vertexBuffer, 0);

    context.MapSubresource(indexBuffer, D3D11.MapMode.WriteDiscard, D3D11.MapFlags.None,
        out mappedResource);
    mappedResource.WriteRange(indices);
    context.UnmapSubresource(indexBuffer, 0);

    context.DrawIndexed(indices.Length, 0, 0);
}

I think something that happens once in the SetActive() method should need to actually happen multiple times, and should be moved to the UpdateShader() method, but for the life of me I can't figure out what it is, or even if my reasoning is the correct.

Why is my render engine only rendering one frame?

sentences:
How to make space invaders destructible scenery and conform it to a shape? We all like the bases that can be destroyed by chunks being split out,

I originally implemented it by making a rectangle filled with individual squares (2x2 pixel size CANVAS rects) that would collision detect with any bullets (On^2 very inefficient). I am now trying to make the base into a shape instead of a boring rectangle. I also want to perform collections of nearby squares when one is hit so that chunks can be taken of the base, instead of just the part that was hit. (easy to do with a rectangular array)

Is a 2 dimensianal arry still the best way to acheive this? Is there a way to create this array by somehow performing image analysis of a PNG to populate this array? Transparent parts would hold no base item at that [i][j].

sentences: PBR texture conversion Is it possible to convert from specular/glossiness to metallic/roughness textures for UE4?

sentences:
Maintain performance and precision with a large vertex buffer? I have a world with 100s of simple objects on screen at once. Most objects don't have more than 40-50 vertices. The vertex coordinates for these objects are very large (planetary scale), so I use the 'floating origin' method to draw my data (actual coordinates are close to the origin and then you apply a translation out to where you want the object).

Based on the user's position, these objects are dynamically created and destroyed. Other than that, the objects are static. With my previous implementation, I was drawing these objects separately, and the result was significant slow down (I'm targeting mobile devices)... since the total number of triangles on screen is sort of trivial (even though there are many objects), I assume that the slow down is because of the multiple draw calls.

So I tried packing my objects into a single buffer to draw them all with a single call. This works, but I also use a 'floating origin' transform to position the geometry. The final transform matrix is calculated with the CPU to maintain precision and then sent to my vertex shader. The problem is applying the floating origin fix is CPU intensive:

If I use a single floating origin for the vertex buffer:

(good) only need to calculate one transform matrix
(bad) I need to perform an offset subtraction on every vertex in the buffer. The upper limits of scene complexity reaches 50k+ vertices, so this is expensive.

If I use multiple objects:

(sorta good) only need to compute as many matrices as there are objects (this is still really expensive though, since there are a ton of objects)
(bad) I need to pass the shader a large array of matrix uniforms

I feel like I'm stuck. Are there any other ways to maintain precision I could use? Or maybe a better way to use the floating origin method? The problem is basically "how do I draw a ton of simple geometry with really large numerical coordinates with OpenGL ES 2?"... I'd appreciate any advice.

EDIT

Just some clarification on the offset. The vertex should always be a valid float. The maximum distance a vertex can be from the origin is the maximum radius of the earth +/- few thousand meters. Assume 1 unit = 1 meter. The distances are never so large that they can't be represented by floats at all.

The objects themselves are things you find in a map on the surface of the earth: buildings/roads/etc. So relative to the coordinates being used, the objects are very small.

I'm not confident on the floating origin stuff, but here's my take...

When you calculate the MVP on the CPU where your vertex is offset, you're getting something you calculate with double precision that goes from an offset vertex position (say its 10.1,10.2,10.3) to the normalized opengl coordinates (I think thats +/- 1 in xy and 0-1 in z... I don't remember right now). You then pass the shader a vertex thats close to the origin, so no huge loss in precision, and a transform matrix that was calculated with double precision.

That's way better than sending the shader a vertex with much larger values since you lose a bunch of precision right away.

sentences:
AndEngine rotate all connected bodies I have created below hexagon structure in Andengine with box2D physics extension. I want to rotate whole structure with respect to center when other ball collides with the structure using physics.

I tried weld joint and revolute joint with the bodies but it is not performing proper motion as required. All bodies are attached with weld joint and vertices have revolute joint with center body which is static like,

RevoluteJointDef revoluteJointDef1 = new RevoluteJointDef();
revoluteJointDef1.initialize(centerB, movingBody[i], centerB.getWorldCenter());
revoluteJointDef1.enableMotor = true;
revoluteJointDef1.motorSpeed = 0;
revoluteJointDef1.maxMotorTorque = 1f;
this.mPhysicsWorld.createJoint(revoluteJointDef1);

I had refered these links:
box2d manual
and box2d joints tutorial

Is there any other way to perform smooth rotation of whole structure?
Thanks.

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:
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 does an Input Pipeline work? I found this article on implementing an input pipeline for Android, but I don't really understand how it works. I also don't completely understand the programming concept of a pipeline or a pool either. Could someone explain these concepts and how they work as this input pipeline?

sentences:
Why does my ship look like it's going backwards instead of fowards? I'm making an Asteroids-clone based on this tutorial. I'm stuck on the 5th part of the tutorial.

For some reason my ship is going backwards instead of forward or it looks like its going forward, but in the tutorial the ship gos toward the asteroid.
In the debug log, the z axis increments in a positive value. so I assume it is going forward but for some reason the ship it self doesnt go towards the asteroid like it does in the tutorial. The ship itself is an fbx export from Maya 2014.

Here's an annotated screenshot:

Full size version

It's probably something really stupid, but I just can't figure out why this is happening.

sentences:
OpenGL draw functions and multi-threading. How they work together? I want to apply multi-thread in a simple way to control and draw 4000 objects.
I am using SDL and OpenGL.

control : locations, collisions, calculations ... etc

draw : OpenGL draw functions glDrawArrays,glDrawElements etc

For 4000 objects i think like this:

do you think it works ?

sentences:
DX11 swap chain is 1 frame behind when presenting to screen and using multisampling After adding multisampling to a DirectX 11 project, I noticed that the screen was no longer updating when calling IDXGISwapChain ::Present. Further testing showed that it was in fact updating the screen, but it was always 1 frame behind. If I added a line to the scene and presented it, I wouldn’t see that line until I do the next present call. This behavior is specific to the use of multisampling. If I turn multisampling off, the behavior goes away. This behavior is also specific to my Intel display adapter. If I use my Nvida display adapter, the behavior goes away.

The multisampling settings are determined by using ID3D11Device::CheckMultisampleQualityLevels, and the creation of the back buffer and depth stencil work, so I don’t think the settings themselves are incorrect in any way. Also the multisampling does work; the end result is properly multisampled. I have played with various multisampling settings within the available range, and all settings produce the same behavior. Just in case I’m doing something wrong, I tried using the debug layer, but got no warnings or errors.

Through hours of testing, I found two work-arounds:

1 - Call Present twice:

HRESULT result = _swapChain->UnmanagedPointer->Present(0, 0);
if (result != S_OK)
    ExceptionThrower::Throw(result, "Failed to present the swap chain buffer.");

result = _swapChain->UnmanagedPointer->Present(0, 0);
if (result != S_OK)
    ExceptionThrower::Throw(result, "Failed to present the swap chain buffer.");

When I do this, the second Present call puts the correct information on screen.

2 - Call ID3D11DeviceContext::Flush after Present

HRESULT result = _swapChain->UnmanagedPointer->Present(0, 0);
if (result != S_OK)
    ExceptionThrower::Throw(result, "Failed to present the swap chain buffer.");

_d3dDeviceContext->Flush();

After the Flush call, the correct information is on screen.

As I understand it, both of these work arounds incur a significant penalty, so I would rather find a better solution (if on exists).  I especially dislike this work around because it penalizes everyone. There is no way for me to know when this behavior is happening. I have a feeling that I may be dealing with a driver bug since this is only an issue with the Intel adapter. I hate to force all scenarios to add this overhead when for most, it won’t be necessary. Oh and in case someone asks, I have updated the Intel drivers to the most recent, but it’s an old adapter, so these drivers date back to 2012.

Has anyone seen this type of behavior before? Is there a better work around, or perhaps a solution I’m not aware of? If forced to use one of the two work arounds, which of the two would be the best? I’m leaning towards the second (Flush call), but not sure.

In case helpful, here is my swap chain creation code

DXGI_SWAP_CHAIN_DESC desc;
ZeroMemory(desc, sizeof(DXGI_SWAP_CHAIN_DESC));

desc.BufferDesc.Width = width;
desc.BufferDesc.Height = height;
desc.BufferDesc.RefreshRate.Numerator = 60;
desc.BufferDesc.RefreshRate.Denominator = 1;
desc.BufferDesc.Format = DXGI_FORMAT_R8G8B8A8_UNORM;
desc.BufferDesc.ScanlineOrdering = DXGI_MODE_SCANLINE_ORDER_UNSPECIFIED;
desc.BufferDesc.Scaling = DXGI_MODE_SCALING_UNSPECIFIED;

desc.BufferUsage = DXGI_USAGE_RENDER_TARGET_OUTPUT;
desc.BufferCount = 1;
desc.SampleDesc.Count = 1;
desc.SampleDesc.Quality = 0;
desc.OutputWindow = outputWindow;
desc.Windowed = true;
desc.SwapEffect = DXGI_SWAP_EFFECT_DISCARD;
desc.Flags = 0;

if (useMultiSampling)
{
    desc.SampleDesc.Count = _multiSampleCount;
    desc.SampleDesc.Quality =  _multiSampleQuality - 1;
}

sentences:
Twin-stick controls for a cohesive group of agents I'm trying to implement a classic twin-stick controller for a group of physics-based game objects. Here are the rules I'm trying to follow:

Agents always stay close to each other within a certain threshold.
Moving the left stick moves the entire group in that direction.
Moving the group on a collider like a wall will "compress" the group like a ball. Releasing the left stick will make the group recover its "natural" shape.

I tried a few things:

Classic steering with cohesion/follow behaviors: This kinda works, but when moving against a sharp corner, a part of the group will move on and separate from the others. Adjusting the steering weights in this scenario produces unnatural results, and the whole thing just feels too "floaty".
Softbody simulation: This works pretty well when moving on a corner, but you can really feel the springs between each agent. Again, it just feels wrong as a whole.
Box2D joints between each agent: Keeps all the agents tightly packed, but the group feels very rigid.

The solution might be a combination of the previous points, but I'm pretty sure I'm over-thinking this.

sentences:
What engine could I use for a simulation? I have a simple requirement:  I want to put some ships (I have some mesh models) on a body of water, with islands, and play with various collision avoidance and command and control algorithms.  So I need a environment where I can modify object behaviour but where the world and its mechanics are already coded.  I was expecting that this would be trivial to find as this is such an obvious requirement for say, AI experimentation.  But I haven't found anything open source or commercial.  I've looked at Glest, Delta3D, Spring, Unity, ORTS, Strive, and VBS2.  I looked for, but never found, the Homeworld Engine.  I also found Breve, Lagoon (seemed perfect), ECSLent, but these were/are either no longer supported or documentation (if it exists) is confusing enough that it isn't clear what can/can't be done or how to go about it.  Interestingly, it seems like you have to roll your own if you have a need eg. Breve, Lagoon.

So I'm putting the question to you:  is there a virtual environment out there, with physics, that would allow a person to focus just on behaviour creation?  What have I missed?  Thanks for any guidance you can provide.

sentences:
Projectile Aim Prediction with Acceleration I'm trying to solve the classic shoot moving object problem but with acceleration attached to that changes it from a quadratic to quartic formula but my math skills are not this good sadly as i prefer to speak in code and not formulas.

i found this https://wiki.beyondunreal.com/Legacy:Projectile_Aiming. i ported it and it's almost what i'm looking for but missing control over the acceleration as its only made for gravity or no gravity and even this i got working only with tricks and modifying it without knowing what i'm doing is getting me only that far.

I made myself a Prototype Interface for the minimum of what i'm trying to get out of it

public class PredictionResult {
    public bool IsInRange; // can we even hit the target?
    public Vector3[] ShotVelocity; // should be up to 4 possible values
    public float[] ShotImpactTime; // how long each shot takes to arrive at the predicted target
    public Vector3[] ShotImpactLocation; // somewhat redundant yet still useful if available
}
// only really the delta between start and target matter but its up to the function
// same for startVel and targetVel where startVel is the shooters speed that gets added to the bullet
// the bullet and target can have different accelerations (standing on ground => no gravity or bullet is not affect by gravity)
public PredictionResult ShootAtTarget(Vector3 start, Vector3 target, Vector3 startVel, Vector3 targetVel, Vector3 bulletAccel, Vector3 targetAccel, float bulletSpeed);

any help solving this would be great

sentences:
How slow is generating a new Vertex Buffer? I am currently working on a project that does 2D sprite-like graphics on Windows 8 (Metro-style app). For that purpose I am using Direct3D with quads to act as sprites.

My problem is that it get's very slow (30fps at 100 sprites) and profiling led me to believe that the bottleneck is withing the CreateBuffer call. How can I solve that problem in an elegant way? Wouldn't gathering copying vertex data from all elements that share the same texture in a single, bigger, buffer be more cost-prohibitive, as it is all done on the CPU?

sentences:
Inter Quake Model IQM render Directx9 I'm trying to render an Inter Quake Model(http://lee.fov120.com/iqm/) in DirectX9 that I exported from blender.

I want to display animations which IQM supports and my model format does not.

The model is a cylinder.

It loads fine in the iqm sdk opengl viewer but when i try to render it in directx9 using for example(this is just to render the vertices):

IDirect3DDevice9 * device;
HRESULT hr = S_OK;

for(int i = 0; i < nummeshes; i++)
{
    iqmmesh &m = meshes[0];

    hr = device->DrawIndexedPrimitiveUP(D3DPT_TRIANGLELIST, 0,
    3*m.num_triangles, m.num_triangles ,&tris[m.first_triangle] ,D3DFMT_INDEX32
    ,inposition ,sizeof(unsigned int));
}

It renders like this:

Incorrect

The light grey bit that looks like two triangles in the middle is what is rendered(ignore the other stuff).

Whereas it is meant to look like this(using a custom importer which I designed which matches what is displayed in blender):

Correct

Anyone have any suggestions on what might be going wrong?

sentences:
Is component-based design an architectural pattern or design pattern? When using the component-based paradigm in game development with engines like Unity, is component-based design an architectural pattern, or a design pattern?

Can I even say that component-based design is my "main" architectural pattern for my game?

I see architectural patterns as being more high-level than design pattern. The component-based design in game development's context (like with Unity engine) seems to fit as an architectural pattern to me. However, on some sites, I read that component-based design is a behavioural pattern, much like other behavioural design patterns, and not so much like an architectural pattern like MVC.

sentences:
Unity normal maps look wrong (URP, iOS) We're building an AR-enabled app with Vuforia and Unity 2019.3, using the Universal Render Pipeline.
Trouble is, on iOS our models that have normal maps in their materials look totally bad, as you can see.
This is how it's supposed to look: (ignore the differences in the orange background item)

If we remove the normal maps, the models look fine, but since the normal maps add a lot of detail and depth to the scene, we'd rather not ditch them.
We've tried to change the import settings of the normal maps, changing the compression formats and such, but that didn't make a difference.

Here's an image of the material settings:

Is there another solution to fix this?

On Android, there's no problem, by the way.

sentences: Pixmaps, ByteBuffers, and Textures....Oh my My ultimate goal is to take a specific region of the screen, and redraw it somewhere else. For example, take a square from the upper left hand corner of the screen and redraw it on the lower right hand corner, so that it is basically a copy of that screen section; kind of like a minimap, but at the same scale as the original. I have looked in to pixmaps and bytebuffers. Also maybe copying that region from the backbuffer somehow. Wondering the best way to go about this. Any help is appreciated. I am using opengl es and libgdx for what it's worth.

sentences:
How to make game appear to run faster? I believe I read somewhere that there is a technique which will make games appear more smooth than they are. I believe it is some visual trick, but I don't remember which one. (It is be something like "You percieve game to be more fluid if there is good shadows").

I may be wrong and there is no such thing.

sentences:
How to simulate pressure with particles? I'm trying to simulate pressure with a collection of spherical particles in a Unity game I'm building. A couple notes about the problem:

The goal is to fill a constantly changing 2d space/void with small, frictionless spheres. The game is trying to simulate the ever-growing pressure of more objects being shoved into this space.
The level itself is constantly scrolling from left to right, meaning if the space's dimensions are not changed by the user it will automatically get smaller (the leftmost part of the space will continually scroll off-screen).

I'm wondering what some approaches are that I can take to tackling these problems...

Knowing when to detect when there is space to fill and then add spheres to the space.
Removing spheres from the space when it is shrinking.
Strategies to simulate pressure on the spheres such that they "explode outwards" when more space is created.

The current approach I am contemplating is using a constantly moving wall, that is off screen and moves with the screen, as this image illustrates:

.

This moving wall will push and trap the spheres into the space. As for adding new spheres, I was going to have either (1) spheres replicate themselves upon detecting free space, OR (2) spawn them at the left side of the space (where the wall is) - pushing the rest of the spheres to fill the space. I foresee problems with idea #1 because this likely wouldn't really create/simulate pressure; idea #2 seems more promising, but raises the question of how to provide a location for these new sphere particles to spawn (and the ramifications of spawning them when there IS no space).

Thanks so much in advance for your wisdom!

sentences:
How do I make my offline socket.io server go online? I've made a simple multiplayer game using socket.io, and took a lot of help from YouTube and the Internet on how to do it. However, the tutorials only talk about how to run the server locally, and none of the ones that I followed ever talked about running the server online - and I looked through a lot!

I think that I only need to add my server IP to my Javascript file, and match the socket.io inspector property value with it.

How do I make my offline socket.io server go online?

sentences:
What is the differencen between ccTouchesEnded and ccTouchEnded I'm learning cocos2d-x. Following the tutorial I found that ccTouchesEnded works perfectly in linux (and windows) but when I replace by ccTouchEnded the event isn't detected anymore.

What are differences between this two functions? And why one is detected and the other isn't.

Taking the HelloWorld project sample as a base, I add the following lines in init()

this->setTouchEnabled(true);
this->schedule(schedule_selector(HelloWorld::updateGame));

Also, add this method to my code:

void HelloWorld::registerWithTouchDispatcher()
{
    // TouchDispatcher::sharedDispatcher()->addTargetedDelegate(this,0,true);
    Director::getInstance()->getTouchDispatcher()->addStandardDelegate(this,0);
}

Then if I add ccTouchesEnded like this:

void HelloWorld::ccTouchesEnded(Set* touches, Event* event)
{
    // Choose one of the touches to work with
    Touch* touch = static_cast<Touch*>( touches->anyObject() );
    Point location = touch->getLocation();

    log("++++++++after  x:%f, y:%f", location.x, location.y);
}

it works perfectly but if I use ccTouchEnded as:

void HelloWorld::ccTouchEnded(Touch* touch, Event* event)
{
    Point location = touch->getLocation();

    log("++++++++after  x:%f, y:%f", location.x, location.y);
}

The events aren't fired.

Any help is welcome
Thanks!!

sentences:
Resize a texture using the full SpriteBatch.Draw in XNA I'm using the full Spritebatch.Draw function to draw my explosion sprite since I also need rotation. I am using the Scale value to resize my texture, but I can't get it to be accurate.

I want to be able to set the textures Size to a specific pixel size, width/height are exactly the same. Say the texture is 128x128, and I want to resize it to be 23x23.

Heres my current code:

  Vector2 Scale = new Vector2((float)sprite.Area.Width / (float)sprite.Texture.Width, (float)sprite.Area.Height / (float)sprite.Texture.Height);
            spriteBatch.Draw(sprite.Texture, sprite.Position, null, sprite.Color * sprite.Alpha, (float)Math.Atan2(sprite.Angle.Y, sprite.Angle.X), new Vector2(sprite.Area.Width / 2, sprite.Area.Height / 2), Scale, SpriteEffects.None, 0f);

I have the Area set to be the size I want it at, however the Draw function seems to not be drawing it to the exact size.

sentences:
switch between player camera/non-camera positioning Sorry if this sounds ambiguous. But I am writing a traditional top down game.
And normally the player would be centered in the middle while moving the orthographic camera. However, I would like this to be dynamic. Therefore, use player.setPosition(x,y) near screen boundaries but center on player if its far from screen boundary.

This is some sample code:

public void centerCamOnPlayer() {
         camera.position.set(player.getX() + (player.sprite.getOriginX()),
                             player.getY() + (player.sprite.getOriginY()),
                             0);
}

public void update() {
     boolean shouldCenterOnChar = ???;
     if (shouldCenterOnChar) {
         centerCamOnPlayer();
     } else {
         player.setPosition(x,y);
     }
}

Therefore render will call update(). However how do I determine the shouldCenterOnChar?
I tried using frustum.pointInFrustum but its only when the sprite moves completely out of screen. I'm sure there is a better way to switch dynamically. Any one has an idea? Tks!

sentences:
How to use large texture atlases in my shaders on mobile devices This is a frustrating discovery. I have ported my desktop game to mobile and discovered that floating point precision in my shaders is not good.

I have large animations which I store per frame on a texture atlas. I try to keep as many non-unique frames in their own sections and piece them together e.g. a sword that doesn't animate for 4 frames is a node that attaches to the hand piece. This preserves memory.

However the texture atlases are so big that, when I use shaders, it breaks the animation completely.

Here's an example of one of the shaders that wraps the animated backgrounds (scrolling clouds)

precision highp float;
precision highp int;
precision highp sampler2D;

varying vec2 vTexCoord;
varying vec4 vColor;
uniform sampler2D texture;

// this script animates and wraps an animated background from one atlas
uniform float x; // frame start x
uniform float y; // frame start y
uniform float w; // frame width
uniform float h; // frame height
uniform float offsetx; // wrap by x amount
uniform float offsety; // wrap by y amount

void main()
{
    vec2 origin = vec2(x, y);
    vec2 size   = vec2(w, h);

    // Get the texture coordinate
    vec2 texCoord = vTexCoord;

    // Make its lower-left be at (0,0) and it's upper right be at (1,1)
    texCoord = (texCoord - origin) / size;

    // Apply the offest
    texCoord = texCoord + vec2(offsetx,offsety);

    // Apply the wrapping
    texCoord = fract(texCoord);

    // Convert back to texture atlas coordinates
    texCoord = (texCoord * size) + origin;

    gl_FragColor = texture2D(texture, texCoord) * vColor;
}

For most backgrounds, the animations are small and don't cause problems. But some backgrounds are large and their texture atlas is large. The floating point precision breaks down and the animation tears.

I don't have much mobile experience. How can I use large textures atlases for animations without the x/y coordinates breaking due to loss of floating point precision?

sentences:
2D tilemap editor UI--how do I disable editing while save/load dialog is open? I'm working on a basic 2D tilemap editor in C#/XNA. Currently, it displays the map through a picturebox through which XNA's output is being routed, and editing is accomplished through simply checking mouse position (i.e., Is it within the picture box? If so, what tile is it on?).

The problem I'm having is that this results in the map being edited through other windows. For example, when trying to save a map, any clicks in the savefiledialog window will edit the map square beneath it, including the click on "Ok" or "cancel."

I believe this is the offending snippet of code from the Game1 class:

protected override void Update(GameTime gameTime)
    {

        Camera.Position = new Vector2(hscroll.Value, vscroll.Value);

        MouseState ms = Mouse.GetState();

        if ((ms.X > 0) && (ms.Y > 0) &&
            (ms.X < Camera.ViewPortWidth) &&
            (ms.Y < Camera.ViewPortHeight))
        {
            Vector2 mouseLoc = Camera.ScreenToWorld(
                new Vector2(ms.X, ms.Y));

            if (Camera.WorldRectangle.Contains(
                (int)mouseLoc.X, (int)mouseLoc.Y)) //<--right there
            {
                if (ms.LeftButton == ButtonState.Pressed)
                  //....

Two questions.

Is this even a viable way to display the map in the map editor? I'd like to be able to pan, zoom, etc. in the future, as well as select multiple tiles at once and edit their properties.
How do I stop the picturebox from registering clicks while other windows are in focus? I've tried adding && PictureBox.Focused to the if statement up there, but that stops it from accepting input at all, regardless of whether there's another window over it (apparently, "focus" doesn't mean what I thought it meant in this context).

Confession: this is my first attempt at Winform programming. Please excuse my lack of experience.

UPDATE: && pictureBox.Focused didn't work, but && pictureBox.Capture did. Still feels a little sloppy, but it works now. I have no confidence that this solution is correct, so I'm not closing the question just yet--something tells me there's a more correct way, and I'd like to know about it.

UPDATE2: Using Capture has introduced a new bug--right clicks don't register reliably (i.e., only around one in ten clicks) until minimizing and restoring the window, after which they register correctly. Rage.

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 make an object not appear grey regardless of distance? My moon texture is on a plane 500m away and I would like to know if there is a way to keep displaying the texture:

As opposed to it turning grey as pictured here:
regardless of the distance it is from the camera. Any help is greatly appreciated,
Thanks.

sentences:
How can I display Unity games in Flex? We have tried the following methods to upload sample Unity3D build to a desktop application in Flex: HTML Loader, NavigateToURL, iFrame and resolvePath.

But we only see the text content, not the 3D content. What is the solution for that? How can I host a Unity game inside Flex?

sentences:
glDrawElements/Arrays not working Given the following OpenGL call stack.

According to my knowlegde, the calls to glDrawElements/Arrays are ok.(?)

But, they do not draw anything. (There is no triangle)
The calls to glBegin() and glVertex() works fine.

Full source: here

sentences:
Load destructible mesh at runtime Using the tutorial: Components and Collision as a guide, to dynamically load a SphereShape the following is done:

AClass::AClass()
{
    // Create USphereComponent
    USphereComponent *sphere = NULL;
    sphere = CreateDefaultSubobject<USphereComponent>(TEXT("Root"));
    sphere->InitSphereRadius(1.0f);
    sphere->SetCollisionProfileName(TEXT("PhysicsActor"));
    sphere->SetSimulatePhysics(true);
    sphere->WakeRigidBody();

    // Create UStaticMeshComponent
    UStaticMeshComponent *mesh = NULL;
    mesh = CreateDefaultSubobject<UStaticMeshComponent>(TEXT("Mesh"));
    mesh->SetupAttachment(RootComponent);

    // Load asset from filesystem
#define ASSET TEXT("/Game/MobileStarterContent/Shapes/Shape_Sphere.Shape_Sphere")
    static ConstructorHelpers::FObjectFinder<UStaticMesh> asset(ASSET);
#undef ASSET
    if (asset.Succeeded())
        mesh->SetStaticMesh(asset.Object);

    RootComponent = sphere;
}

Now, when I try the same set of steps, but this time for an Actor that has a UDestructibleComponent instead of a USphereComponent:

AClass::AClass()
{
    // Create our UDestructibleComponent
    UDestructibleComponent *destructible = NULL;
    destructible = CreateDefaultSubobject<UDestructibleComponent>(TEXT("Root"));
    destructible->SetCollisionEnabled(ECollisionEnabled::PhysicsOnly);
    destructible->SetSimulatePhysics(true);
    destructible->SetEnableGravity(false);
    destructible->WakeRigidBody(NAME_None);

    // Load asset from filesystem
#define ASSET TEXT("/Game/MobileStarterContent/Shapes/Shape_Cube_DM")
    static ConstructorHelpers::FObjectFinder<UDestructibleMesh> asset(ASSET);
#undef ASSET
    if (asset.Succeeded())
        UE_LOG(LogTemp, Warning, TEXT("It worked!"));

    RootComponent = destructible;
}

I receive the following errors:

ConstructorHelpers.h:105:20: error: cannot initialize a parameter of type 'UObject *' with an lvalue of type 'UDestructibleMesh *'
ValidateObject( Object, PathName, ObjectToFind );
                ^~~~~~

ConstructorHelpers.h:29:19: error: incomplete type 'UDestructibleMesh' named in nested name specifier
UClass* Class = T::StaticClass();
                ^~~

I've also tried adding .Shape_Cube_DM to the end of the string, similar to how the first asset was imported, but no luck. What is the correct way to load a DestructibleMesh from the filesystem and apply it to the UDestructibleComponent?

sentences:
Games development with a game loop that's abstracted away Most game development happens with a main game loop.  Are there any good articles/blog posts/discussions about games without a game loop?  I imagine they'd mostly be web games, but I'd be interested in hearing otherwise.

(As a side note, I think it's really interesting that the concept is almost exclusively used in gaming as far as I'm aware, perhaps that may be another question.)

Edit:
I realize there's probably a redraw loop somewhere.  I guess what I really mean is a loop that is hidden to you.  Frames are something you as the developer are not concerned with as you're working on a higher level of abstraction.  E.g. someLootItem.moveTo(inventory, someAnimatationType) and that will move from the loot box to your inventory using the specified animation type without the game developer having to worry about the implementation details of that animation.

Maybe that's how "real" games end up working, but from reading most tutorials they seem to imply a much more granular level of control is used, but that might just be an artifact of being a tutorial.

Edit2:
I think most people are misunderstanding what I'm trying to ask, likely because I'm having trouble describing exactly what I'm trying to ask.  After some more thinking perhaps what I'm referring to is more along the lines of what I believe is referred to as "scripting" where you're working at a very high level and having some game engine take care of the low level details.

For example, take custom maps in Starcraft II or Warcraft III.  Many of the "maps" have gameplay that deviates enough from the primary game that they could be considered a separate game written on the same engine.  What I'm referring to then is along those lines.  I may be wrong because I only dabbed in the Warcraft III editor, but as far as I remember no where in the map editor do you control the game loop, and yet you can create many different games out of it.  In my mind, these are games in their own right.  If you're playing DotA you don't say you're playing Warcraft III, you say you're playing DotA because that's the actual game you're playing.

Such a system may impose limitations that don't exist if you're creating a game from scratch, but it greatly reduces development time because much of the "hard" work has already been done for you.

Hopefully that clarifies what I'm asking.  Another example of what is I mean, is when you write a web app, of course it communicates through sockets and TCP.  But does the average web developer doesn't explicitly write code for connecting sockets.  They just need to know about receiving a request and sending a response.  There are unique scenarios where you do occasionally need to use raw sockets, but it's generally rare in web development.

In a similar fashion, it's very possible to write a game without directly using the game loop, even though one is used behind the scenes.  Probably not a AAA title, but there must be hundreds of smaller scale games that can and possibly are written this way.  Are there any good resources on writing these "simpler" games?

sentences:
pathFinding performance in Unity3d I am making Sniper game in unity 3d. In this game zombies will come randomly towards the sniper and sniper have to kill them. I am using RAIN(indie) for path finding. It works best when zombies are few . As I increase the Zombies( that is 10) the performance decrease a lot. The fbs drops to 25.

I want to know is there any technique or steps so I can improve fps
Any other technique/algorithm that I can use for pathfinding weith good fps.

PS

I already remove Sensor component from AI.
FPS of game without AI is 61

sentences:
How does this hash function work in this perlin noise implementation? In Perlin's implementation of his noise function, he uses an array to hash the input coordinates and later find the gradient vectors. But in Stefan Gustavson's implementation, a strange "permute" function is used:

vec4 permute(vec4 x)
{
  return mod289(((x*34.0)+1.0)*x);
}

vec4 mod289(vec4 x)
{
  return x - floor(x * (1.0 / 289.0)) * 289.0;
}

Then, it is used like this:

vec4 i = permute(permute(ix) + iy);

vec4 gx = fract(i * (1.0 / 41.0)) * 2.0 - 1.0 ;
vec4 gy = abs(gx) - 0.5 ;
vec4 tx = floor(gx + 0.5);
gx = gx - tx;

I understand that the "*2.0 - 1.0" is for getting gx to the range -1 to +1, but I do not understand the rest of the hashing.
How does this "permute" function work and why does it divided by 41.0?

Thanks.

sentences:
Random Object in Array I am using Unity. I have created eight different types of objects, stored in an array, and I am displaying them on the scene in a grid pattern with random order.

The first four objects in the array are red. The player needs to destroy all four red objects to go to the next level.

The code I've writted so far uses the Random.Range method, which chooses objects completely randomly. Sometimes it generates a grid that doesn't contain four red objects, so my player can't destroy them and proceed to the next level.

How do I randomly generate this grid so that it is guaranteed to have exactly four red objects?

Here is my code.

public int gridWidth = 0;
public int gridHeight = 0;
public GameObject[] facePrefab = new GameObject[8];

void Awake()
{
    gridHeight = Random.Range (3, 5);
    CreateGrid(gridWidth,gridHeight);
}
void CreateGrid(int numX, int numY)
{
    for (int x = 0; x < gridHeight; x++) {
        for (int y = 0; y < gridWidth; y++) {
            GameObject go = Instantiate (facePrefab[Random.Range(0,facePrefab.Length)]) as GameObject;
        }
    }
}

sentences:
How to manage game objects, npcs, items? i'm making a small 2D game, designed the maps with Tiled, and adding "basic" world object/items/npcs/mobs to test it a bit and have fun.
Now i have encountered a relatively huge problem, with further development of the world, as our small team has grown by 3 volunteers we have to cover large amounts of
(note most of this data, other than AI, is JSON)

quests
items
npcs
mobs
skills
armor
weapons

we tried to keep track of the editing with revisions, comments, we also used milestones for patching/fixes/hotfixes, and so on.

Our basic tools:

Spreadsheet, which has served well but we discovered that we can't do much with revisions of on a game item or weapon.
we also tried Redmine, but other than issues, this doesn't serve our needs

Can some suggest and alternative way of managing this, or any opens-source tool? that will just make our development a bit easier, than the pain that its right now.

Or is one of those situations that we need to develop a specific tool for our needs?

sentences:
ScreenToWorldPoint problems in otherwise awesome Unity demo I am using this neat Unity demo I found on Stack Overflow, which demonstrates texture masking via RenderTexture:

Can you erase a texture in real time in Unity

But the mapping from mouse position to world space is wrong. This is the script that does the mapping:

using UnityEngine;
using System.Collections;

public class MaskCamera : MonoBehaviour
{
    public Material EraserMaterial;
    private bool firstFrame;
    private Vector2? newHolePosition;

    private void CutHole(Vector2 imageSize, Vector2 imageLocalPosition)
    {
        Rect textureRect = new Rect(0.0f, 0.0f, 1.0f, 1.0f);
        Rect positionRect = new Rect(
            (imageLocalPosition.x - 0.5f * EraserMaterial.mainTexture.width) / imageSize.x,
            (imageLocalPosition.y - 0.5f * EraserMaterial.mainTexture.height) / imageSize.y,
            EraserMaterial.mainTexture.width / imageSize.x,
            EraserMaterial.mainTexture.height / imageSize.y
        );
        GL.PushMatrix();
        GL.LoadOrtho();
        for (int i = 0; i < EraserMaterial.passCount; i++)
        {
            EraserMaterial.SetPass(i);
            GL.Begin(GL.QUADS);
            GL.Color(Color.white);
            GL.TexCoord2(textureRect.xMin, textureRect.yMax);
            GL.Vertex3(positionRect.xMin, positionRect.yMax, 0.0f);
            GL.TexCoord2(textureRect.xMax, textureRect.yMax);
            GL.Vertex3(positionRect.xMax, positionRect.yMax, 0.0f);
            GL.TexCoord2(textureRect.xMax, textureRect.yMin);
            GL.Vertex3(positionRect.xMax, positionRect.yMin, 0.0f);
            GL.TexCoord2(textureRect.xMin, textureRect.yMin);
            GL.Vertex3(positionRect.xMin, positionRect.yMin, 0.0f);
            GL.End();
        }
        GL.PopMatrix();
    }

    public void Start()
    {
        firstFrame = true;
    }

    public void Update()
    {
        newHolePosition = null;
        if (Input.GetMouseButton(0))
        {
            Vector2 v = camera.ScreenToWorldPoint(Input.mousePosition);
            Rect worldRect = new Rect(-8.0f, -6.0f, 16.0f, 12.0f);
            if (worldRect.Contains(v))
                newHolePosition = new Vector2(1600 * (v.x - worldRect.xMin) / worldRect.width, 1200 * (v.y - worldRect.yMin) / worldRect.height);
        }
    }

    public void OnPostRender()
    {
        if (firstFrame)
        {
            firstFrame = false;
            GL.Clear(false, true, new Color(0.0f, 0.0f, 0.0f, 0.0f));
        }
        if (newHolePosition != null)
            CutHole(new Vector2(1600.0f, 1200.0f), newHolePosition.Value);
    }
}

I fixed line 49 and 50 like so:

Vector2 v = GetComponent<Camera>().ScreenToWorldPoint(Input.mousePosition);
Rect worldRect = new Rect(0.0f, 0.0f, 16.0f, 12.0f);

So the script compiles and the worldRect is in the right place now. Through debugging I found that the world coordinates returned on line 49 are off. I also tried setting the z value of mousePosition to 10, even though the cameras are orthographic, like so:

Vector3 mousePos = Input.mousePosition;
mousePos.z = 10;
Vector2 v = GetComponent<Camera>().ScreenToWorldPoint(mousePos);

The mapping from the mouse to worldspace is still wrong though. Mouse coordinates within a small rectangle near the center are mapping to the full width and height of the image in world space.

sentences:
Sprite animation with "overlapping" animations? I'm trying to implement my own sprite animation system, and so far I've got it working quite nicely. I store each animation as a "take" which basically denotes the row of the animation in the sprite sheet, the starting frame and the number of frame. These takes are created during start-up and played by calling play(takeID) on the animation. The player is split into four sprites: head, torso, arms and legs, and different animations can be played on each of these separately from the other parts.

Now, this works fine for situations where I only need a single animation (walking, idling, running, swinging a sword etc.), but I need a more complex animation system for situations where the player performs multiple things at the same time, for example walking while swinging a sword.

I've tried to break down the requirements of the animation system by using the example above, and I've found these cases:

1. Player swings the sword
    1.1. Play swinging animation
    1.2. When done, play idle animation

2. Player starts walking
    2.1. Play walking animation until player stops
    2.2. Play idle animation when player stops

3. Player walks and swings the sword
    3.1. Play walking animation
    3.2. Replace the animation of the hands by a swinging animation
    3.3. When swinging animation is done, revert back to the "walking hands" animation

4. Player walks, initiates a swing and stops walking during the swing
    4.1. Play walking animation
    4.2. Replace the animation of the hands by a swinging animation
    4.3. (Player stops walking during the swing)
    4.4. Stop walking animation and play idle animation for
         all other body parts except the hands
    4.5. When swinging animation is done, play idle animation for hands

I've tried fiddling around with "overriding" animations where the animation with the higher priority (in this case, the "swinging" animation) would be shown instead of the lower priority animation (the walking animation) while updating still both simultaneously to maintain the correct rhythm of the original animation. However, I have trouble getting it to work properly.

The "reversion to idle animation" is a rather challenging task: if I have just the single walking animation, I can stop it and then play the idle animation (or rather, the "idle frame"), but when the sword swinging is added, it becomes more difficult to know when to swap to the idle animation.

So, to conclude with my question: has anyone faced a similar problem? How should I tackle this issue?

sentences:
Graphics2D.drawImage not working I'm quite new to java.

I'm trying to come up with my own game after watching a few video tutorials. However, I encountered a problem where I cannot draw an external image file that I loaded using the BufferedImage object.

The problem seems to be on the method that I'm using to draw the image on the screen, where I'm using Graphics2D.drawImage() method to draw.

Here is part of my code (I modified and skipped parts that seemed irrelevant to the topic):

Window Class

public class Window extends JPanel{
    public Window(int width, int height) {
        JFrame frame = new JFrame("Zerro's Game");

        frame.setPreferredSize(new Dimension(width, height));

        frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
        frame.setLocationRelativeTo(null);
        frame.setResizable(false);
        frame.setVisible(true);
        frame.pack();
    }
}

Game Class

public class Game extends JFrame implements Runnable {
    // Dimension for Main Frame
    private static final int WIDTH = 640;
    private static final int HEIGHT = 480;

    // Image
    private BufferedImage image;
    private Graphics2D g;

    public void run() {
        this.requestFocus();

        // For rendering purposes
        image = new BufferedImage(WIDTH, HEIGHT, BufferedImage.TYPE_INT_RGB);
        g = (Graphics2D) image.getGraphics();

        //Game Loop
        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 = now - System.nanoTime();
            wait = (OPTIMAL_TIME - updateTime) / 1000000;

            try {
                Thread.sleep(wait);
            } catch (Exception e) {
                e.printStackTrace();
            }
        }
    }

    private void render() {
        if(gameState == STATE.GAME) {
            handler.render(g);
        } else if(gameState == STATE.MENU) {
            menu.render(g);
        }
    }

Menu Class

public class Menu extends KeyAdapter{
    private BufferedImage image;

    public void render(Graphics2D g) {
        try {
            image = ImageIO.read(getClass().getResource("/Pixel_Background.png"));
            g.drawImage(image, 0, 0, null);
        } catch(Exception e) {
            e.printStackTrace();
        }
    }
}

This code results in making empty frame without any content inside. I confirmed that it properly loads an image by using System.out.println(image.getHeight()) which prints out the exact height of an image that I'm using.

I've seen some comments in the internet that I need to use paintComponent() method. However, I'm just wondering if it's not a good idea to use paintComponent() in game development as the video tutorials (3 of them) that I watched didn't use such method to draw images.

Also, I'm wondering about the reason why we pass in the Graphics2D object as parameter in all the render() methods.

sentences:
How to implement a component-based model for menus in Unity? I'm trying to create a "sims-like" context menu when an item / game object is clicked.

This comes as an add-on question from this question:
How to design context menus based on whatever the object is?

Specifically:

  Each object of class Item would have a list of components like
  Equipable, Edible, Sellable, Drinkable, etc. An item can have one or
  none of each component (for example, a helmet made of chocolate would
  be both Equipable and Edible, and when it is not a plot-critical quest
  item also Sellable). The programming logic which is specific to the
  component is implemented in that component. When the user right-clicks
  on an item, the components of the item are iterated and context-menu
  entries are added for each component which exists. When the user
  selects one of these entries, the component which added that entry
  processes the option.

  You could represent this in your XML-file by having a sub-node for
  each component. Example:

 <item>
      <name>Chocolate Helmet</name>
      <sprite>helmet-chocolate.png</sprite>
      <description>Protects you from enemies and from starving</description>
      <edible>
          <taste>sweet</taste>
          <calories>2560</calories>
      </edible>
      <equipable>
          <slot>head</slot>
          <def>20</def>
      </equipable>
      <sellable>
          <value>120</value>
      </sellable>
   </item>

When I read this, it reminds me of an interface in programming. My question is, how do you implement this? Perhaps a better question is "is the answer still valid" but it does seem relevant to me.

What have I tried?
Nothing at this point, because I'm not sure where to start. Given the example above, I'd guess that Item would have a list of... interfaces? that it could implement? This is why I am a bit confused.

I want to add, this isn't just a UI issue. I found a few radial menus in the store, my issue is how to populate the menu depending on what game object is clicked.

sentences:
libGDX Error loading font file - Netbeans I'm trying to load a font in libGDX. But I can't figure out want I do wrong.

Code:

white = new BitmapFont(Gdx.files.internal("fonts/white.font"), false);

Error:

Exception in thread "LWJGL Application" com.badlogic.gdx.utils.GdxRuntimeException: Error loading font file: fonts/white.font
    at com.badlogic.gdx.graphics.g2d.BitmapFont$BitmapFontData.load(BitmapFont.java:657)
    at com.badlogic.gdx.graphics.g2d.BitmapFont$BitmapFontData.<init>(BitmapFont.java:469)
    at com.badlogic.gdx.graphics.g2d.BitmapFont.<init>(BitmapFont.java:115)
    at scenes.GameMode.create(GameMode.java:61)
    at scenes.GameMode.<init>(GameMode.java:45)
    at com.circle.game.Circle.create(Circle.java:17)
    at com.badlogic.gdx.backends.lwjgl.LwjglApplication.mainLoop(LwjglApplication.java:143)
    at com.badlogic.gdx.backends.lwjgl.LwjglApplication$1.run(LwjglApplication.java:120)
Caused by: java.lang.StringIndexOutOfBoundsException: String index out of range: -1
    at java.lang.String.substring(String.java:1931)
    at com.badlogic.gdx.graphics.g2d.BitmapFont$BitmapFontData.load(BitmapFont.java:480)
    ... 7 more
:desktop:run

sentences:
What to do with unused vertices? Imagine yourself a vertex array in OpenGL representing blocks in a platform game.

But some vertices may be not used.

The environment is dynamic, so there always some vertex may suddenly become invisible.

What is the best way to make them not draw? Graphic cards are complicated and it's hard to predict what is best approach.

Few best ways I can think of:

delete and move all vertices after deleted one to fill freed space (sounds extremely inefficient)
set positions to 0
set transparency to maximum

I could of course benchmark, but what on my computer works faster doesn't have to on other.

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: Indexed draw vs draw array Lately I wondered, which draw command is faster, drawArrays or drawElements. I know difference between them, drawArrays just draws every vertex in the same order they were provided, and drawElements draws vertices based on the provided indices. But I'm still curious which command is faster, or when should I use drawArrays instead of drawElements and vice-versa.

sentences:
Cross-platform GLFW build with CMake I know this is probably a popular question and can be very vague, so I'm going to be as specific as possible. I don't really know how to even form this question to be able to search Google, so I came here.

I've been following the tutorials from learnopengl.com and they have been by far the best explanations I've found on modern OpenGL anywhere. After I'm done with the tutorials, I'll be making a game. I have already started working on the game engine and it works just fine on Ubuntu and Mac OS X. Building the project is done with CMake (I've found this to be the easiest). The project uses GLFW and Glad as used in the tutorial. I can post the GitHub repo if you want.

Today I started trying to figure out how to get the project to run on Windows, but don't even know where to start. Hence coming here. I plan on using Visual Studio but haven't used it since college. How do I even start making the project? I've tried building GLFW on the machine and the building the project using CMake, but I get build tool errors that I don't know how to troubleshoot. Where do I begin?

sentences:
How to get Pixel Coordinates of certain colors in a Texture? I have a relatively big Texture, and I try to find a certain color pixels pattern:
eg. White, Black, White, Green .
They are lying next to each other,

If I use Texture2d.Getpixels() on every pixel every frame its possible, but way too slow.

Is there a "real good" way to do this? For example a shader way?

The "big idea" is to make a game which is "remote-playable".
For example through Twitch or of a streamed youtube video.
The user should not be connected to the server in any way, Instead he is sending messages or not.

For this I have to find a health bar. This health bar has the left-upper corner in black-> white -> black -> green pixels lying next to each other.

In the shader I CAN find these colors, but I dont really know the coordinates.
Also I think there "should" be a solution with a  ... compute shader?
I dont really want to render new stuff. Just check pixel colors.
I just want to know where these pixel colors are.

I imagined something like this:

If PixelColorIsWhite(x,y)
{
If PixelColorIsBlack(x+1,y)
{
If PixelColorIsWhite(x+2,y)
{
If PixelColorIsGreen(x+3,y)
{
return x+20,y+100 //because the player is 20 pixels right and 100 pixels below
}}}}

In a shader i guess i can access the current coordinate, but I cant access the other pixels. Its paralell processing... right?
So its impossible to access the "entire thing" in one go , right?

I think it must work somehow with... getting the big "chunk" of texture data, a very long array of pixels, giving it to a compute shader, and letting the CS find it.

I hope I could clarify the problem now :)

_-----------------------------------

Update:

I found out it (at least) should work with a compute shader.

I feel like im so close to the solution, yet im getting errors. :-(

So...

This is my C# Code:

public ComputeShader shader;
public Material thisMat;

public RenderTexture ScreenTex;

public int x;
public int y;

public const string INPUTTEX = "InputTexture";

private void Update()
{
    RunShader();
}

public void RunShader()
{
    RenderTexture tex = new RenderTexture(1024, 786, 24);
    tex.enableRandomWrite = true;
    tex.Create();

    shader.SetTexture(0, INPUTTEX, ScreenTex);
    shader.SetFloat("_ScreenWidth", Camera.main.pixelWidth);
    shader.SetFloat("_ScreenHeight", Camera.main.pixelHeight);

    int[] data = new int[2];
    ComputeBuffer buffer = new ComputeBuffer(data.Length, sizeof(int)*2);
    buffer.SetData(data);
    shader.SetBuffer(0, "readWriteIntBuffer", buffer);

    thisMat.mainTexture = tex;
    int kernelHandle = shader.FindKernel("CSMain");

    shader.SetTexture(kernelHandle, "Result", tex);
    shader.Dispatch(kernelHandle, 1024 / 8, 786 / 8, 1);

    buffer.GetData(data);

    x = data[0];
    y = data[1];
    buffer.Release();}

And this is my ComputeShader Code:

    -------------------
    #pragma kernel CSMain

RWTexture2D<float4> Result;

RWStructuredBuffer<int> readWriteIntBuffer;
Texture2D<float4> InputTexture;
float _ScreenWidth;
float _ScreenHeight;

[numthreads(8, 8, 1)]
void CSMain(uint3 id : SV_DispatchThreadID)
{
    if (id.x >= (uint)(_ScreenWidth*_ScreenHeight))
    {
        return;
    }

    int y = id.x / int(_ScreenWidth);
    int x = id.x % int(_ScreenWidth);
    readWriteIntBuffer[0] = 999; //some debug-testnumbers that show me that there were no colors found
    readWriteIntBuffer[1] = 998;

    if (InputTexture[float2(x,y)].r == 1.0f && InputTexture[float2(x, y)].g == 0.0f && InputTexture[float2(x, y)].b == 0.0f)
{
    float2 coordinates = float2((float)id.x / (float)_ScreenWidth, (float)id.y / (float)_ScreenHeight);

    readWriteIntBuffer[0] = coordinates.x;
    readWriteIntBuffer[1] = coordinates.y;

}
}

This Computeshader checks if a single pixel in a texture is red and writs it in a buffer. The buffer gets read by C# with getdata.
-- it seems we're almost getting there!
But "something" seems to be wrong, since I dont seem to get the colors i want.
But the compute shader seems to work, since i also get the triange-pattern in my material.

sentences:
Stencil mask with AlphaTestEffect I am trying to pull off the following effect in XNA 4.0:

The purple area has 50% opacity. I have gotten pretty close with the following code:

public static DepthStencilState AlwaysStencilState = new DepthStencilState()
        {

            StencilEnable = true,
            StencilFunction = CompareFunction.Always,
            StencilPass = StencilOperation.Replace,
            ReferenceStencil = 1,
            DepthBufferEnable = false,
        };

public static DepthStencilState EqualStencilState = new DepthStencilState()
        {
            StencilEnable = true,
            StencilFunction = CompareFunction.Equal,
            StencilPass = StencilOperation.Keep,
            ReferenceStencil = 1,
            DepthBufferEnable = false,
        };

...

if (_alphaEffect == null)
{
       _alphaEffect = new AlphaTestEffect(_spriteBatch.GraphicsDevice);
       _alphaEffect.AlphaFunction = CompareFunction.LessEqual;
       _alphaEffect.ReferenceAlpha = 129;
       Matrix projection = Matrix.CreateOrthographicOffCenter(0, _spriteBatch.GraphicsDevice.PresentationParameters.BackBufferWidth, _spriteBatch.GraphicsDevice.PresentationParameters.BackBufferHeight, 0, 0, 1);
       _alphaEffect.Projection = world.SystemManager.GetSystem<RenderSystem>().Camera.View * projection;
}

_mask = new RenderTarget2D(_spriteBatch.GraphicsDevice, _spriteBatch.GraphicsDevice.PresentationParameters.BackBufferWidth, _spriteBatch.GraphicsDevice.PresentationParameters.BackBufferHeight, false, SurfaceFormat.Color, DepthFormat.Depth24Stencil8);
_spriteBatch.GraphicsDevice.SetRenderTarget(_mask);
_spriteBatch.GraphicsDevice.Clear(ClearOptions.Target | ClearOptions.Stencil, Color.Transparent, 0, 0);

_spriteBatch.Begin(SpriteSortMode.Immediate, null, null, AlwaysStencilState, null, _alphaEffect);
_spriteBatch.Draw(sprite.Texture, position, sprite.SourceRectangle,Color.White, 0f, sprite.Origin, 1f, SpriteEffects.None, 0);
_spriteBatch.End();

_spriteBatch.Begin(SpriteSortMode.Immediate, null, null, EqualStencilState, null, null);
_spriteBatch.Draw(_maskTex, new Vector2(x * _maskTex.Width, y * _maskTex.Height), null, Color.White, 0f, Vector2.Zero, 1f, SpriteEffects.None, 0);
_spriteBatch.End();

_spriteBatch.GraphicsDevice.SetRenderTarget(null);
_spriteBatch.GraphicsDevice.Clear(Color.Black);

_spriteBatch.Begin();
_spriteBatch.Draw((Texture2D)_mask, Vector2.Zero, null, Color.White, 0f, Vector2.Zero, 1f, SpriteEffects.None, layer/max_layer);
_spriteBatch.End();

My problem is, I can't get the AlphaTestEffect to behave. I can either mask over the semi-transparent purple junk and fill it in with the green design, or I can draw over the completely opaque grassy texture. How can I specify the exact opacity that needs to be replace with the green design?

sentences:
If statements seem to act as though the condition is always true I have other scripts in the same project using boolean if statements that work fine, but I've tried multiple methods of testing if the if statements below are working and none of them worked!

I don't really know what to ask because I don't know whats going on. I've tried placing theae statements in Update and Start, and in both instances the if statement completely ignored the check and just executed the contents of the block as though the check evaluated to true.

void OnTriggerEnter(Collider other) {
    if(other.gameObject.CompareTag("Player")); {
        working = true;
    }

    Extremity = false;
    if(Extremity); {
        Instantiate(Cannon, transform.position, transform.rotation);
        Extremity = !true;
    }
}

The false statement is only in there to show that even when the bool is set to false immediately before the check, it still runs the Instantiate method inside as though it were true.

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:
Enable/Disable an image inside an if statement Basically i have a code that changes the skybox after killing x amount of enemies, and i want to enable and disable four pictures inside the two if statements. I tried making three public images, set them to false and then enable them inside the every if statement but i'm pretty sure that's not how it works. I'm a noob. Here's the code:

public class enemyCount : MonoBehaviour {

    public static int enemiesCount = 15;
    public Material mat1;
    public Material mat2;
    public Material mat3;

    void Start () {
    }

    void  Update (){
        print("Enemy Count is " + enemiesCount);

        if(enemiesCount <= 10)
        {
            Debug.Log("Level 2!!!");
            RenderSettings.skybox = mat2;
            //Heres should display image number 1
        }

        if (enemiesCount <= 5) {
            Debug.Log ("Level 3!!!");
            RenderSettings.skybox = mat3;
            //Here should display image number 2
        }

        if (enemiesCount <= 0) {
            Debug.Log ("YOU WON");
        }
    }
}

sentences:
Dynamic Music Composition in FMOD I would like to dynamically "build" a song in my game by adding/removing instrument layers. This is normally possible exporting each instrument layer as a separate track, but this method is not so efficient for memory (it's like having multiple songs). I've started to use FMOD recently, so I would like to know if there is a method to save a song with multiple instrument tracks, for example, in an internal format, so that I can manipulate which instrument is going to play by code.

EDIT:
An example from my game: I have a character that can transform to different forms. Imagine that the player has an aggressive melee form: I want that the main theme changes accordingly with the current player form. In my example, when the player is in the melee form, I want to add an electric guitar. If I change to a "bird" form, it would be nice to have a marimba instead of the guitar. Note that the rest of the main theme remain exactly the same. I know that I can export different songs, each one tailored for each player form, but I was wondering if it is possible to do something "better".
When you save a song as a project file, you have more information than the actual music. Take FMOD Designer, for example:

Here we have all the information about layers, instruments etc. so that is possible to mute an instrument, for example. What I want to achieve is to make one song, containing all the instruments(guitar,marimba in the example), so that I can mute/un-mute them by code. Is there a way to have such a format loaded by FMOD c++ API?

sentences:
Entity/Component System - Unique Behaviour So, I decided to see what the Entity/Component system of game development was all about. I really liked it. So, I decided to implement my current game with it.

My problem: Unique Behaviour with the system. From what I have seen, the way to implement Unique Behaviour for a entity is to Create a unique Component, and a Unique System that only accepts Entities with that Component. This seems to be a lot of code, for what could be a very small feature.

My Solution: Have entities with "hooks" in them, so that they can define their own unique behaviour in them. They would still have the major things done for them by systems, such as Health, Rendering, and Movement.

e.g.:

public abstract class EntityLiving extends Entity{

    /**
     * Called when a entity is spawned in
     * @param map
     */
    public void onSpawn(Map map) {this.map = map;}

    /**
     * Called when an entity is killed
     * @param map
     */
    public void onDeath(Map map) {}

My Question: Is this bad programming practice? Could this be done in a 'better' way? I realize that this question is extremely subjective, but I would like some professional opinions.

EDIT: By better I mean, in order of priority:

Less Code for this scenario
Code Reusability
Code Efficency

sentences:
Unity2D: Proper way to implement ladder climbing with a raycast controller? I originally posted this on Stack Overflow, but was told I might have more luck here:

I've been slowing grinding out programming features for my character controller, and one of the last things to implement is ladder climbing. The code I've come up with over the past 2 days mostly works, but presents some issues:

Sometimes the character bounces after climbing while holding the up arrow, at the point with which a 1-way platform meets the end of the ladder.
Once the character is all the way up, resting on the 1-way platform, it cannot go back down. This can be remedied with a longer ladder collider, but that makes issue #1 worse.
If the character is on the ground near a ladder and jumps, but presses the up arrow at the very last second, it gets flung considerably far in a certain direction.
If the character is on a rope and jumps off the rope, but holds the up arrow before doing so, it goes slightly higher, but is noticeable. Not holding the up arrow, but rather just pressing the left or right arrow and jumping, yields a regular jump. Perhaps this has something to do with the x or y input axes?

The way my classes work is that I have a Controller2D class which handles most of the raycasting stuff and movement methods, a Player class for input that calls the movement methods, and a parameters class that sets default world parameters, like gravity and jump height, but can be overridden if the character is in a certain volume, such as water or a ladder collider (this allows me to set gravity to 0 while climbing so the character can move properly). Almost all of my ladder code is contained in the OnTriggerEnter/Stay/Exit functions, and I'm just not sure if this is the best way to do it.

I tried making a ClimbUp/ClimbDown method, and shooting a raycast from the center of the player, which would allow him or her to climb up, but this was not overly successful (there were too many issues compared to using OnTriggerStay).

I'm wondering if someone who has successfully implemented ladder climbing in a raycast controller, or anybody who might have advice, would be willing to point me in the right direction for this task.

Here's some of the script:

public void ClimbLadder(float y)
{
    ClimbingOnLadder = true;
    SetVerticalForce(y);
}

public void JumpWhileClimbing(float x)
{
    if (ClimbingOnLadder)
    {
        ClimbingOnLadder = false;
        overrideParameters = null;
        AddForce(new Vector3(x, Parameters.jumpVelocity * .70f, 0));
        JumpAfterClimbing = true;
        print(Parameters.jumpVelocity);
    }
}

private void OnTriggerEnter2D(Collider2D other)
{
    if (other.tag == "Ladder")
    {
        CanClimb = true;
    }
}

private void OnTriggerStay2D(Collider2D other)
{
    if (other.tag == "Ladder")
    {
        if (ClimbingOnLadder)
        {
            var newParameters = other.gameObject.GetComponent<ControllerPhysicsVolume2D>();

            if (newParameters == null)
            {
                return;
            }

            overrideParameters = newParameters.NewParameters;
            Debug.Log("overriding");

            if (ClimbingOnLadder && State.IsCollidingBelow)
            {
                ClimbingOnLadder = false;
                overrideParameters = null;
            }
        }
    }
}

private void OnTriggerExit2D(Collider2D other)
{
    if (other.tag == "Ladder")
    {
        CanClimb = false;
        ClimbingOnLadder = false;
        JumpAfterClimbing = false;
    }

    var newParameters = other.gameObject.GetComponent<ControllerPhysicsVolume2D>();

    if (newParameters == null)
    {
        return;
    }

    overrideParameters = null;
}

sentences:
Texturing edges of a procedurally generated polygon I'm generating a polygon from code to display unit ranges in my game. Here's how it looks so far:

I would love to be able to now use my texture and only apply it to the edges of this polygon (imagine a stroke with no fill). Could someone point me in the right direction with this issue?

sentences:
How to create guides to off-screen objects? I've played Metroid Blast on Wii U, and would like to build one of its features in a three.js game.

The feature is: if an opponent is out of view, a guide is displayed showing the direction of the opponent.

An example of it is here:

(Image source)

Notice the small circles with arrows in the left side.

How could I have a similar feature in my game?

sentences:
x coordinates resets after changing speed? I wanted to change the speed of a soldier when he enters a barbed wire texture.
Since I have multiple soldiers and multiple barbed wires I just iterate with two for-loops through all of them.

for(int j = entityWalkingRightArray.size() - 1; j >= 0; j--) {
  final entity_walking_right entity_walking_right = entityWalkingRightArray.get(j);
  for(int i = barbedWireArray.size() - 1; i >= 0; i--){
    final barbedWire wire = barbedWireArray.get(i);
    //Checks if the entity is inside the barbed wire
    if(  entity_walking_right.getX() >= wire.getX()
      && entity_walking_right.getX() <= wire.getX() + wire.getWidth()
      && entity_walking_right.getY() >= wire.getY()
      && entity_walking_right.getY() <= wire.getY() + wire.getHeight()) {

      entity_walking_right.changeSpeed();
    } else {
      //entity_walking_right.changeSpeed2();
    }
  }
}

In the class of the soldier the speed is set to 500 and the positionX is set to 200 when he is first created. I also have these two functions:

public void changeSpeed(){
    speed = 50;
}

public void changeSpeed2(){
    speed = 500;
}

In the render() function of the soldier's class the position is determined.

runningTime += Gdx.graphics.getDeltaTime();
positionX = speed * runningTime;

When he now enters the barbed wire and the speed is set to 50 then the positionX changes to 200 and he runs with a speed of 50. When I activate entity_walking_right.changeSpeed2(); then he runs with normal speed (500) through the barbed wire and starts blinking rapidly while another version which also blinks rapidly on positionX 200 with a speed of 50. I looked at the positionX value and he just "teleports" again and again between those two positions. When the "500 speed version" of him reaches the end of the barbed wire everything is normal again. I have absolutely no idea why this is happening.

sentences:
Originating direction of shots in an FPS problem Recently I have been asked on the interview about a maybe simple task to solve a problem.

We have a player, that looks in some direction, and a shooter, who already is shooting the player. I must find out whether the shots come from the left or right in the same way Counter Strike does when you get hit: the game shows from which direction and it looks like a red half-circle.

I know the vectors of players and enemies position. I tried different answers f.e. to build a line from the player see's and solve a linear system equation or rotate the player vector and then find out the angle of scalar product, but he says there's a better way to do it. I don't need the answer to this particular question, but a 'way' to find out the answer. F.e. any books related to this problems, some similar problems, etc.

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: Unity - Renderer "raycasts" from top down? I'm trying to have objects in a game be selectable only from a top down orthographic camera view. I think having physics colliders might be overkill for that - especially because this only needs to be in 2D and not 3D. Is there another method that might be better, such as something like a renderer "raycasts", but perhaps even more performant as it is just from the orthographic 2D top down view

sentences:
Max Row and Col for Animating Sprite in Andengine I want to animate a Sprite in Andengine , I have used the following

this.mSnapdragonTextureRegion = BitmapTextureAtlasTextureRegionFactory.createTiledFromAsset(this.mBitmapTextureAtlas, this,"arrow.png", 10, 10);

As show above in code its array is 10x10 that means I have 100 images to be animated, here is the image (I had individual image and joined it online so I created image below):

My issue is if I place this code and image it show black patch instead of animated image, i hv tried with 2x3, 4x2 animated sprite that is > working fine . Is my issue because of 10x10 ? what is the max row and col I can place to animate a Sprite in Above Code

Here is my output :

sentences: SDL deleting an image from the screen? Well, I'm sort of a beginner to SDL, and I was wondering how one would go about deleting an image from the screen and replacing it with another? I attempted to do this, but it didn't seem to change it, how would someone with more experience than me go about doing it?

sentences:
Creating a fragment shader to darken a white texture over time - OpenGL GLSL So as a part of learning OpenGL, I've now decided to try and be a bit more creative with shaders, as part of a practice game I'm making using C/OpenGL.

I'm completely new when it comes to working with shaders, so I'm still trying to get used to the thought process behind creating something with it. To this extend, here's what I want to attempt.

As a part of the gameplay, the entire background of the game consists of a white, plain, 2D texture. The white texture should slowly animate black circles into it over time, until finally the entire texture is completely black.

I've considered some different approaches to the problem, and would like to know which one will be the most practical when it comes to shaders.

Using framebuffers: As I've understood from looking around the internet, you can't really, say, apply certain colors to a specific area of fragments in your fragment shader (like creating a black circle), and then save the state of those fragments for the next frame. Instead, I would have to apply the effect, and render the texture to a framebuffer and then re-use it again the next frame. I could then continuously do this slowly add black circles to the texture. The problem is, is this really too much work to do for something simple as this? Or would it be fast enough? As far as I've seen, framebuffers are usually used to post-process effects for entire scene frames. This would not be for the entire scene, only for the background. The advantage of this approach would be that it's relatively simply to work with as you're only working on one texture.

Creating individual circle objects with own fragment shaders: This was another approach I thought about doing. Basically, instead of having one shader work on the entire background texture, I would simply spawn textured quads that each individually run a fragment shader that just turns their texture black over time using a simple percentage value input as a uniform. The disadvantage of this solution is that you make it a bit more complex by having to handle more objects at runtime, instead of simply working with one texture. More vertices would also have to be handled when rendering.

Of these two approaches, I don't know really what would be a good solution to run with. I would like to use the framebuffers approach but I don't know if I would "abuse" the technique with this kind of problem or not.

Or perhaps there's another way of doing this that I've completely missed because I'm new to shaders, in that case other suggestions would be welcome!

Thank you all for your help :)

sentences:
Sprite UV returning wrong values in script in newer Unity versions I'm recreating in Unity 2019.4 an old project I have done few years ago in Unity 5.4.0. This project consists of a tiled map editor using unity editor scripts which reads baked data files containing all information needed for each tile (like height, texture id and texture rotation) and creates the tiled mesh on the fly for a given map to be edited in unity.
I have a single sprite (mode: multiple) containing all tiles textures that I read when creating the terrain mesh to set the correct UV for each vertex of the mesh depending on the texture id of a given tile.
In my old project using Unity 5.4.0 I can just call a tile sub sprite uv property to set in the mesh uv and it works just fine. The problem is that in Unity 2019.4 the uv property of the exact same asset (the big sprite with multiple sub sprites) returns weird values.
I compared the output of the uv property used in each tile on both projects and the values are slightly different. The difference is just the order how the elements are ordered in the uv array.
Lastly I noticed the sprite is showing additional options in Unity 2019. I have played with the options in Unity 2019 but couldn't notice any difference in the problem. I'll link the images showing the options in both Unity 5 and Unity 2019 bellow (respectively):

Does anyone have any idea or suggestion to understand why this is happening? I tried to search for this topic but couldn't find anyone with a similar problem.
EDIT: the multiple sprite is being generated and imported with the tool TexturePacker.

sentences:
How to limit my scoreboard to 100 top Score then adding the number list? so I want to make 100 top scorers on my leaderboard but I don't know how to make a number list, what I mean is when the user is top 1 so number list 1 and so on
so here the leaderboard script :
 public IEnumerator LoadScoreboardData()
    {
        var DBTask = DBreference.Child("users").OrderByChild("highscore").LimitToLast(100).GetValueAsync();

        yield return new WaitUntil(predicate: () => DBTask.IsCompleted);

        if (DBTask.Exception != null)
        {
            Debug.LogWarning(message: $"Failed to register task with {DBTask.Exception}");
        }
        else
        {
            //Data has been retrieved
            DataSnapshot snapshot = DBTask.Result;

            //Destroy any existing scoreboard elements
            foreach (Transform child in _MainMenuUI.instance.scoreboardContent.transform)
            {
                Destroy(child.gameObject);
            }

            //Loop through every users UID
            foreach (DataSnapshot childSnapshot in snapshot.Children.Reverse<DataSnapshot>())
            {
                string username = childSnapshot.Child("username").Value.ToString();
                int highscore = int.Parse(childSnapshot.Child("highscore").Value.ToString());

                //Instantiate new scoreboard elements
                GameObject scoreboardElement = Instantiate(_MainMenuUI.instance.scoreElement, _MainMenuUI.instance.scoreboardContent);
                scoreboardElement.GetComponent<_ScoreElementContent>().NewScoreElement(username, highscore);
            }

            //Go to scoreboard screen
            _MainMenuUI.instance.leaderboardPanel.SetActive(true);
        }
    }

as you can see there is no number list just order by highest score.

sentences:
How do I create a view matrix that does not contain the camera translation? I'm looking at this tutorial
https://capnramses.github.io/opengl/cubemaps.html
about half way down the webpage, there is a description of a vertex shader

#version 400

in vec3 vp;
uniform mat4 P, V;
out vec3 texcoords;

void main() {
  texcoords = vp;
  gl_Position = P * V * vec4(vp, 1.0);
}

  The P and V matrices are my camera's projection, and view matrices,
  respectively. The view matrix here is a special version of the
  camera's view matrix that does not contain the camera translation.
  Inside my main loop I check if the camera has moved. If so I build a
  very simple view matrix and update its uniform for the cube map
  shader. This camera only can only rotate on the Y-Axis, but you might
  use a quaternion to generate a matrix for a free-look camera. Remember
  that view matrices use negated orientations so that the scene is
  rotated around the camera. Of course if you are using a different
  maths library then you will have different matrix functions here.

I'm having difficulty figuring out how to construct this matrix in my program. How would I construct it from a projection matrix, view matrix, or camera matrix? (These are the matrices already within my program)

sentences:
How to set a static size for an object in GameMaker? I have many sprites with different sizes, and I have an object in which I set those sprites, but this object gets resized by the currently displayed sprite.

How can I set a fixed size for the object so that it can no longer change size?

Thanks for any help.

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:
Procedurally generating non tile based top down 2d game worlds I’ve been fascinated by procedural generation for over two years now. I have played around with many types of noise generation and even wrote some myself. I’ve been looking into water erosion and procedurally generated biomes and during this time I’ve managed to build some nifty little map generators. Something that has always escaped me, however was generating a procedural map that is not “tile based”. So far, all the procedural map generators I have built relied on one axiom - the map is represented as a 2d matrix containing some sort of information about the terrain that is to be found there. This means that I, by definition, can’t build anything that is not tile based.

And this is why I come here asking for your help. I am curious about how one could render a procedurally generated map in a non tile-based fashion. My end result is the image I posted.

The solution that immediately jumped to my mind is drawing each end every pixel individually, thus making the map look essentially non tile based. This, however would require enormous memory and is unfeasible.

So I am turning to the masters - how can I procedurally generate (and more importantly render) such a map? How would I go about representing the sprites to be drawn? Where do I even get started? This feat is so much out of my grasp that I do not even understand where I should be looking

Note - I know about marching squares and wang tiles. These approaches are however not something I’m fond of because of the huge workload that would go into drawing the resources. I am looking for something more in the realm of algorithms

Thank you!

sentences:
Curved movement between two points What is a good technique to enable an object to move between to points in a nice curved motion?

The end position could also be in motion, such as the trajectory of a homing missile.

sentences:
Unusual black squares in transparency effect after wake from sleep I've encountered unusual black squares in semi transparent textures for a while now, usually in processes that were resumed after the computer woke from sleep. For example I've seen the effect in the Battle.net launcher by Blizzard frequently, on different machines.
But now I often encounter the effect in Unity in Play mode if I let the computer go to sleep. Restarting the scene fixes the display problem.

My 2 questions are:

What is that effect?
What do I need to do to prevent the effect from reaching my users?

In this screenshot there are 3 semi transparent particle effects on top of one semi transparent billboard, and at the bottom we see a part of an opaque sphere. The black squares seem to only affect a single one of the particle effects, and disappear if the effect is disabled, and reappear if it's re-enabled.

And here is the same effect in the Blizzard launcher:

sentences: How can we modify all of the human bone items in Skyrim? I have the models, but I am wondering which object_id I need to modify. Is there a single object_id for every skeleton part, or each parts have several variants and several object_id? Is there a list with all of the skeleton parts in the game thereby allowing me to modify all of the vanilla models without having to worry about not having changed all of the skeleton models in the game?

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:
glVertexAttribPointer alters completely different shader program My program contains two shader programs in it. The following code is for preparing one of the shader program's attributes:

int positionHandle2 = glGetAttribLocation(programAColorUTranslate, "vPosition");
glEnableVertexAttribArray(positionHandle2);
glVertexAttribPointer(positionHandle2, 2, GL_FLOAT, GL_TRUE, 2 * sizeof(float), 0);
translateHandleAColorUTranslate = glGetUniformLocation(programAColorUTranslate, "vTranslate");

int aColorHandle = glGetAttribLocation(programAColorUTranslate, "aColor");
glEnableVertexAttribArray(aColorHandle);
/*glVertexAttribPointer(aColorHandle, 3, GL_FLOAT, GL_TRUE, 5 * sizeof(float), 0);*/

At this point, the program works fine, except that the vertices drawn by the above shader program are not colored, since the line above is commented out. However, if I uncomment the line above (and change the stride of position handle to 5 * sizeof(float)) to try to add colors to the above shader program's vertices, random shapes appear in my program. Supposedly, the above line should only alter triangles rendered by one of the shader programs, not both. However, every single vertex in my program is being rendered incorrectly after uncommenting the about line, to the point that the program becomes unrecognizable from before.

sentences:
How can I create a random "world" in a tile engine? I am designing a game that is working on a classic tile engine, but whose world is generated randomly. Are there existing games or algorithms that do this?
The procedural generation algorithms I have found are never using a tile system...
What would be the best way to generate a whole "world" using a tile system? I am not talking about mazes of blocks, but an overall "world map"
thanks

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:
Check if a point is touching a user drawn curve in HTML5 canvas I am having trouble detecting whether a ball is colliding with a red curve. The curve below is an example of what a user may draw on to the canvas. I can't think of any fast ways to detect collision between a green ball and the red line here.

I have thought of checking the color of the pixel every tick at the location of the ball, but this is very slow and the round ball will fill more than just the centre pixel. I have also thought about logging every single X, Z point that the curve drawer has inserted and then checking if the ball is near to the point, but this also seems like a bad method.

From a red curve drawn on to the screen by a user, what is the best way to detect whether a point is colliding with the red line? Shall I store every single point of the red curve or check the color of the pixel at the point to see if it is red or not?

sentences:
Unity: Adjusting 2D physics for different mobile resolutions I created a test project to see how different mobile resolutions affects Unity's 2D Physics.

They way I handled the resolutions was to contain all the objects (including non-UI objects) in a Canvas and use a Canvas Scaler component to adjust for multiple resolutions. Although this approach is probably not one of the ways the Canvas was not meant to be used, it works well when working with a single orientation.

Despite the quick solution to handle the multiple resolutions, there seems to be the issue of the physics acting differently depending on what aspect ratio is being used.

Images can be viewed here: http://imgur.com/a/p5wmf

The green and blue blocks both have the Rigidbody2D and Box Collider 2D components. The floor (big white block) only has a Box Collider 2D component.

As you can see from the images above, the different aspect ratios cause the blocks to collide with the floor at different times. Also, when using rigidbody.addforce in the Y direction, the different aspect ratios cause the blocks to jump at different heights.

Obviously these issues could cause an unfair advantage in a game with support for several resolutions.

So how would I go about adjusting the physics so that the blocks fall and jump at the same rates relative to the different resolutions?

Also if there is a more practical way to adjust for multiple resolutions that doesn't involve a plugin and doesn't break physics, let me know!

sentences:
Why does XMVector4Dot return a vector with the dot product copied to it's components? The documentation for XMVector4Dot lists the return value as a vector. It also states that the dot product is replicated into each component. Given that the dot product is going to be a single value, how does this offer an advantage over just returning float?

The only way I can see to get the value is to do something such as:

        XMVECTOR w = { -XMVectorGetX(XMVector4Dot(x, eye)), -XMVectorGetX(XMVector4Dot(y, eye)), -XMVectorGetX(XMVector4Dot(z, eye)), 1 };

Which seems unnecessary. Is there another reason I'm overlooking?

sentences:
How would I apply force to a bullet in 2D? I wrote the code below in order to try to get a bullet to fire at a specific angle for my top-down shooter. However when I press space the bullet just spawns in front of the game object despite it having a bullet speed. I made sure that my bullet prefab has a rigidbody and I am calling to it in my script.

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

public class FireAway : MonoBehaviour
{
private Vector3 mouse_pos;
private Vector3 object_pos;
private float angle;
private float bulletSpeed = 1;
public GameObject ammo;
private Rigidbody2D rb2D;

void Start()
{
    rb2D = ammo.GetComponent<Rigidbody2D>();
}

// Update is called once per frame
void FixedUpdate()
{
    // Point the cannon at the mouse.
    mouse_pos = Input.mousePosition;
    mouse_pos.z = 0.0f;
    object_pos = Camera.main.WorldToScreenPoint(transform.position);
    mouse_pos.x = mouse_pos.x - object_pos.x;
    mouse_pos.y = mouse_pos.y - object_pos.y;
    angle = Mathf.Atan2(mouse_pos.y, mouse_pos.x) * Mathf.Rad2Deg - 90;
    Vector3 rotationVector = new Vector3(0, 0, angle);
    transform.rotation = Quaternion.Euler(rotationVector);

    if (Input.GetKeyDown("space"))
    {

        GameObject BulletPlayer = (GameObject)Instantiate(ammo,
transform.position, transform.rotation);
        //bullet.transform.LookAt(mouse_pos);
       rb2D.AddForce(BulletPlayer.transform.forward * bulletSpeed);
    }
}
}

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:
Bullet pointer becoming zero I am currently trying to implement the Bullet physics into my game project. However, when i add some rigid bodies to the scene, i occasionally get an error in btDbvtBroadphase.cpp at the line
  if(proxy->stage==STAGECOUNT) (line 294).

If i then inspect the proxy pointer, it points to 0x0. If I go back to the function btCollisionWorld::updateSingleAabb(btCollisionObject * colObj) on the call stack, and inspect the member m_broadphaseHandle, it is non-zero, which is being passed as first parameter to btDbvtBroadphase::setAabb(btBroadphaseProxy* absproxy, const btVector3& aabbMin, const btVector3& aabbMax, btDispatcher* __ formal).
In this method it is being cast into a btDbvtProxy pointer and stored in proxy. What I don't get here is, why proxy becomes 0x0, even though a valid pointer is being passed to the function.

The call stack looks like this:

MyProject.exe!btDbvtBroadphase::setAabb(btBroadphaseProxy * absproxy, const btVector3 & aabbMin, const btVector3 & aabbMax, btDispatcher * __formal) Line 294   C++
MyProject.exe!btCollisionWorld::updateSingleAabb(btCollisionObject * colObj) Line 171   C++
MyProject.exe!btCollisionWorld::updateAabbs() Line 204  C++
MyProject.exe!btCollisionWorld::performDiscreteCollisionDetection() Line 220    C++
MyProject.exe!btDiscreteDynamicsWorld::internalSingleStepSimulation(float timeStep) Line 492    C++
MyProject.exe!btDiscreteDynamicsWorld::stepSimulation(float timeStep, int maxSubSteps, float fixedTimeStep) Line 452    C++

The initialization of bullet looks like this:

broadphase = new btDbvtBroadphase();
collisionConfiguration = new btDefaultCollisionConfiguration();
dispatcher = new btCollisionDispatcher(collisionConfiguration);
solver = new btSequentialImpulseConstraintSolver;

world = new btDiscreteDynamicsWorld(dispatcher, broadphase, solver, collisionConfiguration);
world->setGravity(btVector3(0.0f, -10.0f, 0.0f));

I create RigidBodies procedurally and this is, how I add them:

bp.mesh = new btTriangleMesh(true, false);

for (int i = 0; i < bp.numFaces; ++i)
{
    btVector3 a(vertices[indices[i * 3 + 0]].position.x, vertices[indices[i * 3 + 0]].position.y, vertices[indices[i * 3 + 0]].position.z);
    btVector3 b(vertices[indices[i * 3 + 1]].position.x, vertices[indices[i * 3 + 1]].position.y, vertices[indices[i * 3 + 1]].position.z);
    btVector3 c(vertices[indices[i * 3 + 2]].position.x, vertices[indices[i * 3 + 2]].position.y, vertices[indices[i * 3 + 2]].position.z);
    bp.mesh->addTriangle(a, b, c);
}

btMotionState* ms = new btDefaultMotionState;
btBvhTriangleMeshShape* shape = new btBvhTriangleMeshShape(bp.mesh, true);

sect->rigidBody = new btRigidBody(0.0f, ms, shape);

btWorld->addRigidBody(sect->rigidBody, 64, 128);

My question now is, why proxy occasionally points to 0x0, even though it should be a valid pointer? I downloaded and successfully compiled bullet-2.82-r2704 with VS2012 and changed the project settings from /MT(d) to /MD(d), if this does matter.

Edit: I may also mention that the rigid bodies are added in a different thread, than the thread in which I initialize and simulate the bullet physics. Can this cause any problems?

sentences: How can I change width of sprite Dynamically? I want to change width of sprite dynamically but i can't perform it.!! Here i want to change only my white sprite i want to use these type of facility in my game in using AndEngine I want to display life of player

sentences:
The more appropriate way to find GameObject in the scene Which way is the more appropriate to find GameObject in the scene.
I know that GameObject.FindGameObjectWithTag is faster than GameObject.Find but i wondering whether FindGameObjectWithTag is better solution than this:

public GameObject someObject;

public void SelectObject()
{
    someObject.SetActive(true);
    //or whatever i want
}

sentences: Make objects flip Box2D? I'm working on a shooter, platformer and everything is going okay so far, but I want to make some enemies that fly over top of the player and swoop around him. How can I make them fly? I've seen people suggest to change the world Gravity but that'd mess up the player. What's the best solution?

sentences:
Is this equivalent to D3DXVec3TransformNormal? I was porting some code from DirectX to OpenGL.
I have the following code:

glm::mat4 rotation(1.0f);
rotation = glm::rotate(rotation, degrees, m_up);
m_look  *= rotation;

where rotation is a mat4 and m_look is a vec3. I wanted to know if the last line here,

m_look  *= rotation;

has the same effect as

D3DXVec3TransformNormal( &m_look, &m_look, &rotation );

in DirectX? If not, then what would be the correct alternative?

sentences:
Game speed cubic growth Is it possible, using delta in my update method to increase a game speed variable exponentially on cubic growth (the blue line below)

My maths isn't great so I'm not sure how the formula would be put into practice using a float gameSpeed and delta in an update method -(void) update:(ccTime)delta I think I would also need a value to control the speed of the growth too?

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 share some elements of array with different players on Photon in the same Room? Unity3d I want to assign cards to different players in the room. I've a Class "Cards" that contains an array of 52 cards like this: "2_of_spades","3_of_spades"....... and so on. All i want is to assign random indexes or values to different players on the basis of which I'll instantiate Cards Sprites. How can I do that?
I've heard that there are RPC calls but how do I manage to make a "Middle Man" script that would deal with different players?

sentences:
Update Project Version, or other Project Settings, from command line Is it possible to update UE4 Project Settings from command line?
More specifically I would love to be able to update the following Project Settings attributes from command line using, for instance, RunUAT.bat

Project > Description > Project Version
Platform > Android > Store Version
Platform > Android > Version Display Name
Platform > IOS > Version Info

I have checked the unreal documentation without finding anything, and looked through the documentation for ue4 cli, also without any luck.
I have already tried to read the Config/DefaultEditor.ini file (and other INI files) using various tools, but apparently the INI format used by UE4 is somehow different than what the parsers I have tested accepts. (+-icons for indicating array elements and so on)
Am I missing something obvious? Or is this not normal to do?

Running from Windows, MacOS, or Linux (whichever will work)

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:
IwGame (Marmalade): Does CIwGameSprite support SVG? How? I have a small question about Marmalade IwGame engine.

Does the CIwGameSprite support SVG (I've read that yes it does)

If it does support SVG, how does it handle it,

Does it convert that Vector graphic to Pixel Graphics and cache it as an image then?

If it does not then how about the game performance? How does it handles animation, does it redraw the SVG each time?

How about scaling, if it does Caches images, Can I scale an SVG before scaling it?

Hopefully Someone can help

Thank you in advance

Ahmed

sentences:
How can I use Editline for an in-game console? I'd like to add an in-game console to a C++ game that I am creating.  Although rendering the console and parsing the commands I'm fine with, the text input and editing aspect (e.g. handling left / right keys, backspaces etc...) seems like a lot of effort that I'd rather spend on more interesting things.

I've managed to find a library called Editline that handles the nitty-gritty of console-style text input complete with history and auto-completion, however I'm unsure of how to interface this with my game - in particular all of the examples that I've found use the standard input and output handles and readline() itself is a blocking call.  I need to be able to provide my own input and render the console to my own output, and I also need to make sure that my game loop continues running.

How should I go about doing this?

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:
Is there no UI culling for unity? I don't understand, am I missing something?
I have hundreds of moving images on screen that only need to render and do their logic/physics when they are in the canvas.
Otherwise they can just deactivate to save on performance and there is a very big fps difference when they are deactivated vs activated outside the canvas.
RectMask2D on the canvas does barely anything.
Checking the bounds for hundreds of UI elements seems like madness.
So what are you supposed to do?

sentences:
Build a convex hull from a given mesh in Bullet According to this tutorial, a convex hull is the most accurate shape one can build from a mesh? I have two questions regarding this:

How do I build a convex hull from a given, complex mesh in Bullet?
Should this be done offline? How do most people do this? (that is, create a collision shape from a mesh in games)

sentences:
How can I apply a glow filter in Phaser? I'm trying to get the following effect, but as far as I know, a filter is the only sensible way.

Imagine some objects and background, and a fire ball passing through. The fireball glows. All objects (not the background) become brighter in color where they are under that glow. The glow effect could be described as a glow around a missile's fire.

This should be built-in to Phaser, as pixi.js has it.

sentences:
Rotate player to face direction it's moving in 3D space I'm making a 3D game in XNA4.0. How do I rotate a model to face the direction that the user is pressing. I assume I need to set its look at to the direction being pressed, but can't figure out how to do that.

Cheers.

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: How can I use Jung, GraphStream or JGraphT with LibGDX? All libraries I found (JUNG, JGRAPHT, GraphStream) use Swing when I use libGDX. How you can use them with LibGDX

sentences:
How to set up a game loop for a project targeting iOS? I'm a fellow game programmer who's done many game engines in Game Maker 8.1, Visual Studio XNA and MonoGame with C#, and one in Java Android with Eclipse. I'm very used to C# and love it plus the VS environment.

Now I'm trying to develop games for the App Store for iPhone and iPad (using Xcode 7 with a Macbook running Yosemite 10.10.5). I don't yet have an actual iPhone to test with, but the simulator is working with the blank and example projects I've found.

By way of googling, this is what I've looked at so far:

http://codewithchris.com/xcode-tutorial/

http://www.raywenderlich.com/40293/learn-to-code-ios-apps-2-strings-arrays-objects-and-classes

There was also a Storyboard example which I did not like. My intuition is to not use a wizard for anything, and the Storyboard builder seemed a lot like Windows Forms when I can just use the XNA draw functions.

Neither of those tutorials was very helpful and now I'm paranoid that I'm on the wrong track. Now I'm asking myself questions like should I be using SpriteKit or SceneKit? Should I be using Swift insteada Objective-C?

The thing is, if I can figure out how to draw pictures in a game loop, then I think I'm all set. However, I think I understand that I'm gonna need at least one UIView or Scene. What I want is a master_draw() function that gets called 30 times per second in main.m, and in master_draw() I loop through all objects and call their individual draw functions. Same thing with a master_update() function.

And I also found this open source example:
https://www.cocoacontrols.com/controls/1w-flappy

That example...I thought it would be the most helpful of all. But I couldn't find any game loop in it at all.

Am I on the right track? Does iOS stuff work totally different than a traditional game loop?

Specifically, I have 2 major questions:

What new project type should I chose? Blank, Single-View, or Game?
How to set up a game loop? (if possible)

What I'm thinking is something like this:

void master_update() // typically called 30 or 60 times per second
{
  foreach (GameObj G in ListOfGameObj)
    G.update(); // update all objects in the list of objects
}

and of course...

void master_draw() // typically called 30 or 60 times per second
{
  foreach (GameObj G in ListOfGameObj)
    G.draw(); // draw all objects in the list of objects
}

Where do I add that code and where do I call it? Is something like this possible in iOS or am i gonna hafta use a completely different architecture?

P.S. The kind of game I'm doing is a simple 2D puzzle where you hafta match up blocks. Nothing too fancy.

sentences:
How to convert Triangle/OBB test to OBB/OBB test? I'm using the collision library OZCollide and I want to do OBB vs. OBB collision tests. The problem is, that this function doesn't seem to exist but instead there is a AABB vs. OBB and a Triangle vs. OBB function. I'm not very comfortable with OBB intersections, but I think the necessary code is already there!

Can anyone help me by using this code for OBB/OBB Testing?

The code is here.

This code doesn't belong to me, It's Igor Kravtchenko's!

sentences:
Is there a way to allow for design-time math on a scriptable object in Unity? Sorry for the title, I did not know how else to describe the question.  I am writing a turn-based strategy game and am looking for a way to enable design-time additions of game mechanics where the mechanics each require some different math.
What I'd like to do is to be able to create a ScriptableObject and then modify it with the formula and various descriptions (all through the inspector), then add it to the game.
As an example, my game has cities where each city has several attributes such as population and various technology levels.  I'd like to be able to add various "resource generators" at design-time via the inspector with the formula for how the resource is generated per turn.
Some examples of resource generators:

A "gold" resource generator with the "population * 0.025" formula to indicate that, each turn, the city generates 2.5% of it's population as gold.
A "research" resource generator with "assigned population * 0.5" as the formula to indicate that, each turn, the population assigned to research generates 0.5 pts of research per person.
A "production" resource generator with the "assigned population * production tech level * 0.75" with a max value of "1000 * city level" where excess production gets dumped to gold.

And so on.  These are examples, but the formulas should allow for arbitrary interactions with other values in the game.
Some of the simpler formulas seems pretty easy, i.e. create a scriptable object attached to a primary value (say population) and then a simple modifier.  But I'm stuck on how to do the more complex ones.
Anyone have an idea about how to accomplish something like this?

sentences:
Which university shall I choose in UK? ( game programming ) I'm starting my undergraduate studies soon, but as I'm not from UK, I completly don't have idea what university should I choose.

Do you know any good game programming universities?

Is it good idea to make computer science as undergraduate studies and game-programming as postgraduate one? I'm thankfull for all your replies, as they help me alot.

sentences:
Procedural generation of jagged peaks I would like to generate random cave type backgrounds similar to the one shown below.

I doubt anything I generate will look as good as the image, but something with that feel of sharp, jagged peak should be possible.

I don't have any experience in procedural generation and as such have no idea where to start....

Note: I am using libGdx on Android

sentences:
A two player game with a split screen In the antique game spy vs. spy, two players play on a single computer. The screen is split, with each half showing the viewpoint of one player.

Is it possible to create such an effect in Unity? The main problem is that Camera.main is a global variable, so it is not clear how to have two cameras.

sentences:
Animator.SetBool: am I supposed to call it only when its value changes? I've searched around the web for a while, but didn't manage to find anything about it.

Despite using Animator in several projects so far, I've never been in this exact situation, so I'm unsure what to do.

Does calling Animator.SetBool have any performance issue, so that I'd better call it only when its value has changed, or when its value doesn't change it's so quick that I can call it every frame?

Keep in mind that, due to the nature of this question, I don't care if it's slow when I change its value, I only care if it's slow when it's false and I call it to set it to false again (same thing for true ofc).

sentences:
I started my journey this way, am I on the right track? I started my journey to learn games programming from the scratch (I'm a software developer but not in gaming field), I'm targeting iOS games development.

Currently I'm ready "O'reilly iPhone Game Development", then I'm considering reading "Apress Learn iPhone and iPad Cocos2D Game Development".

Am I on the right track? Should I read and learn OpenGL ES? If yes, when to start?

What is the Math type do I need for games development? Algebra and 2D Geometry?

Books like "Challenges for Game Designers" and "Game Design Workshop, 2nd Edition" are on my list also.

I really appreciate if you know a better path to follow.

sentences:
Want to play 1 of 3 tracks depending on current level I want to play a gameplay music track depending on what the current level is.

E.g.

1 - Play track 1

2 - Play track 1

3 - Play track 2

4 - Play track 2

5 - Play track 3

repeat...

6 - Play track 1

7 - Play track 1

8 - Play track 2

9 - Play track 2

10 - Play track 3

This is what I have, but problem is track 2 will be used at level 6 when it should be track 1.

public static function playGameplayMusic(waveId:Int):Void
{
    var gamePlayTrackId:Int;

    if (waveId % 5 == 0) {
        gamePlayTrackId = 3;
    } else if (waveId % 3 == 0 || waveId % 4 == 0) {
        gamePlayTrackId = 2;
    } else {
        gamePlayTrackId = 1;
    }

    trace('playing gameplay track: ' + gamePlayTrackId);

    SoundPlayer.playMusicByName('gameplay/' + gamePlayTrackId, false);
}

Update:

Went with this. Thanks for all your contributions!

public static function playGameplayMusic(waveId:Int):Void
{
    var gamePlayTrackId:Int = Math.ceil(((waveId - 1) % 5 + 1) / 2);

    SoundPlayer.playMusicByName('gameplay/' + gamePlayTrackId, false);
}

sentences:
Gizmos not being drawn until GameObject selected I have implemented Scene loading in my game and have three scenes: Persistent, Main Menu and Game
By default, the player is loaded into the Persistent scene, which immediately loads the Main Menu, and when the player clicks on Play, Main Menu is unloaded and Game is loaded.
Now, the two active scenes are Persistent and Game.
However, I have a script with OnDrawGizmos on a GameObject in the Game scene. It seems that by default gizmos only begin to be drawn when I click on that GameObject, sort of activating it, and everything works fine. This used to just work before because Game was my only scene and Unity automatically selected that first GameObject. Now, with multiple scenes, no GameObject is selected by default and my gizmos won't draw until I manually click on it.
How can I solve this?

sentences:
Reusing tilemap segments I'm wondering how I can incorporate reusable tilemap segments in my workflow.

For example: I construct a room out of my tile palette, and I want to reuse this room in multiple places.

Is there some way to "prefab" a section of a tilemap? I haven't found such a thing.

Or perhaps I should just prefab the whole tilemap, and use multiple tilemap objects within one grid? Won't that introduce significant overhead?

What if I want to prefab a section of a tilemap with some additional, non-tilemap objects?

sentences:
Make object face another object on a sphere I have a game I'm working on in Unity where there are two objects on a sphere at random locations (and random rotations). I want one of the objects to always rotate so that if it were to fire a bullet (the end goal) that it would fire at the other object along the shortest arc around the sphere.

The problem I'm facing is that I don't know how to create a rotation for an object that is on the surface of a sphere, and have it point towards the other object.

I can also see an issue after this where I would need it to point towards the other object in the shortest distance because there will always be two directions it can point towards.

Has anyone done something like this? Definitely stuck on this one.

sentences:
Creating a simple ripple propagation with variable resolution I am trying to do a simple simulation of a ripple propagating through a medium. I do not have a physics engine at my disposal so setting up a complicated set of spring constraints doesn't seem to be like the way to go.
In the past when I have done this the simulation has been resolution dependent. Which means that because on each step each unit of the simulation only samples things one unit around them that if the resolution is high waves propagate slowly. Similarly if the resolution is low they travel quite quickly.
I need to figure out a sampling method other than just the nearest neighbor that can make it so I can up the resolution of the simulation without majorly changing the sense of propagation speed. Are there any solutions to this kind of situation?

sentences:
Remove HUD from Child Scene For my game, I create game scene for which I set HUD to it.

First my game scene use BoundCamera, so I use hud to set score text, dollar text and setting button.
Now on game scene when I touch on setting button, the child scene (setting scene) come up because I attached it to game scene.

I use child scene because of pause/resume functionality added to the setting scene.

When child scene display on the screen at the same time hud content also displayed on the sceeen. But I don't want that hud content of my child scene (setting scene).

From other post of this forum I found that made hud.setVisible(false).

But this solution does not work for me because the touch area of hud's children remain active even though it were not displayed on the screen. So when player touch on these areas the effect of touch become available even if the hud is not displayed on the screen.

Also I like to mention that my development platform is AndEngine.
I hope someone give me best guidance on this.

sentences:
Realtime inverse kinematics on unity apps for android and iOS Hello I want to understand how much overheads do implementing inverse kinematics in realtime add.

I am looking at an implementation as such demonstrated in the video. https://www.youtube.com/watch?v=Gyakxv34404&feature=youtu.be

Let me explain the exact requirement now.

Assuming a game of mario, where mario is a 3D Character. And there is a coin placed at a height. So when mario comes into area of effect for the coin, we know the initial position of his arms, and we know the expected final position which is the position of the coin.

So we create a trajectory from initial to final position in realtime and the main character moves accordingly in the trajectory.

Now I can understand this would work fine in editor but if we have exported the game and this computations happen realtime for every object, how much CPU intensive would this be? Do all the existing IK assets provided on store

for example in this video of final IK https://www.youtube.com/watch?v=ZuWvGq3yV44 the characters are following the trajectory in real time I suppose. But what if we were to create the trajectory realtime depending on player positions, would that be a CPU intensive task to NOT work on mobile devices?

sentences:
How to store data in a data-driven RPG Possible Duplicate:
  Would it be better to use XML/JSON/Text or a database to store game content?

I'm working on a 2D data-driven RPG. I intend for it to be modabble; my intention is to expose all the major game data (eg. monster stats, item stats, pet stats) through some interface to allow tweaking by end-users with a tool.

First, my basic assumption is that there will be a "lot" of data (perhaps on the order of magnitude of megabytes). I have a few requirements that I'm trying to figure out.

How to efficiently store and load the data. For example, a SQLite DB would be faster than reading text files on startup.
How to make it version-control friendly (text-files wins here).
How to maintain data integrity. If it's just a text-file, you can put invalid values in it.
If possible, I would like to allow users to make their own tools to crunch my data.

Since maintaining version-control friendly data is important, I think having one or more text files with data in it will win. I can probably try to get people to use my tools to edit the data, and put lots of integrity checks in the actual code (eg. if totalHealth < 0, throw).

Are there better approaches to achieve these four goals?

I would also like input on the file format (eg. YAML vs. XML vs. JSON vs. whatever)

sentences: Different kinds of collision detection in Android Are there any other ways to detect collision between two objects besides the bounding rectangle method and downloading another class to put into Android?

sentences:
Why am I not getting stuck in the loop I'm new to Unity. I was learning coroutines and I wrote this.

private void Fire()
{
    if(Input.GetButtonDown("Fire1"))
    {
        StartCoroutine(FireContinuously());
    }
    if(Input.GetButtonUp("Fire1"))
    {
        StopAllCoroutines();
    }
}

IEnumerator FireContinuously()
{
    while(true)
    {
        GameObject laser = Instantiate(LaserPrefab, transform.position, Quaternion.identity) as GameObject;
        laser.GetComponent<Rigidbody2D>().velocity = new Vector2(0, 10f);
        yield return new WaitForSeconds(firetime);
    }
}

When the button is pressed the coroutine is called and it enters the 'while' loop. When I leave the button it stops the coroutine. Shouldn't it get stuck in the 'while' loop as it is an infinite loop ? Why?

sentences:
Calculate the rest length of a box2d distance joint Given the length of a distance joint along with its frequency and the mass of the bodies involved, is it possible to determine the final rest length?
I'm only interested in the vertical axis if that makes the formula simpler.

E.g. Imagine the simple case of a dynamic body of mass=1 sitting vertically atop another similar body and attached via a distance joint with length=1 and frequency=1 and gravity=10.
What would the rest length be? I.e. What would the final distance be between those two bodies?

I'm currently just trial and error fudging the frequency values I need in my game but I really need a formula to compute this as every time I change the masses, I have to re-fudge everything.

Thanks.

sentences:
Difficulty aligning isometric tiles I'm trying to render isometric terrain in javascript. Currently, my tiles are being drawn with small gaps between them:

I want the tiles to line up with no pixel gaps in between:

My rendering function is like this:

var screenX = (x * 60 / 2) + (y * 60 / 2);
var screenY = (y * 30 / 2) - (x * 30 / 2);
console.log(screenX, screenY);
context.drawImage(img, screenX, screenY, 60, 30);

Btw, my image is 30x15.

Can you help me with this problem?

EDIT:

var screenX = (x * 56 / 2) + (y * 56 / 2);
var screenY = (y * 28 / 2) - (x * 28 / 2);
console.log(screenX, screenY);
context.drawImage(img, screenX, screenY, 60, 30);

It works, but I want to find a general solution

sentences:
Am I hurting myself by not knowing C++ for game design? Right now, I feel I am strong in both Java a C#. (Not much of a leap from one to the other really).

While I don't expect a game designer/programmer is an attainable goal early on in my career, This is a goal I will reach later on in my career.

With this in mind, I feel that ignoring C++ and game design tools associated with it are eventually going to hurt me or slow me down in my ability to reach my goal.

Is this the case? Or can I continue to hone my C# skills using XNA and WPF for personal projects that can elevate me into such a career?

sentences:
How do I make a Minecraft recipe that costs XP? I want to program a Minecraft client-mod or server-plugin that adds a recipe for making a Bottle o' Enchanting with the following ingredients:

1 glass bottle + 1 lvl of experience → 1 Bottle o' Enchanting

One possible implementation that I have thought of is to execute the command /xp -1L player, but I am unsure how to invoke that command from my Java code. Is there a better way?

How would you go about adding an experience-requiring recipe to Minecraft?

sentences:
Scaling physics engines beyond single computational server Currently working on a small home project of developing our own game. The game basics are just a straightforward space game, currently without any collision detection/resolution, just movement with position, velocity, and acceleration.
The game is an MMO(RPG), so currently designing & implementing the backend / server / platform side of things.
So the only items we need to store right now for each object is linear and angular 3D vectors. we're doing this for the position, velocity, and acceleration.
So far, so good.
The question now comes to scaling wise: let's say, a single container of the physics engine has the computational power to calculate 10 rooms of 1000 objects each. It continuously calculates the new velocity and positions of all the objects and that's about it.
So what if we want to scale? I want to go to 20 rooms of 1000 objects, theoretically this seems straightforward: spin up another container and room 1-10 on container1, room 11-20 on container2.
However, what if one of those rooms in container1 suddenly goes to 5000 objects, this would mean container1 can no longer feasibly calculate this, so it should be moved (instantly) to container3.
The objects would all be stored on a redis in-memory database for purposes of speedily operations. The goal is to not have any limits to a single room or the amount of rooms, and just scaling the amount of containers based on the amount of total objects that are moving around in the whole game.
Similarly, the scaling down should be handled as well, if 5 containers are each operating at 10% capacity, it should be moved to 1 container.
We were discussing things such as event bus where we insert a repeating event to "tick" on roomX, a container would take this event, look at the total amount of objects in the room, and then determine how much it can handle.
The problem which we have here is that there's no guarantee the container will be done with tick_0 when another container could be working on the same room for tick_1.
Are there any other techniques we should consider doing to try and get this to figure out a scaling solution?
Other relevant things to mention:

the rooms are unrelated to each other
current programming language is Golang
platform can be cloud agnostic (kubernetes with whichever pods are needed)
client side will use an existing physics engine, as the client only has to draw the current room it's in
physics engine is aimed to "tick" in between anywhere from 2-10/second, depending on the results and the computational cost of each item in the room

Looking for any help or pointers to get us underway with this issue! Places to discuss this would also be greatly appreciated.
Best regards

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:
How can I read texel data on a separate thread in D3D11? In D3D10, I load a staging texture onto my GPU memory, then map it in order to access its texel data on the CPU. This is done on a separate thread, not the thread I render with. I just call the device methods, and it works.

In D3D11 I load the staging texture onto my GPU, but to access it (i.e. Map it) I need to use the Context, not the device. Can't use the immediate context, since the immediate context can only be used by a single thread at a time. But I also can't use a deferred context to Read from the texture to the CPU:

"If you call Map on a deferred context, you can only pass D3D11_MAP_WRITE_DISCARD, D3D11_MAP_WRITE_NO_OVERWRITE, or both to the MapType parameter. Other D3D11_MAP-typed values are not supported for a deferred context."

http://msdn.microsoft.com/en-us/library/ff476457.aspx

Ok, so what am I supposed to do now? It is common to use textures to store certain data (heightmaps for instance) and you obviously have to be able to access that data for it to be useful. Is there no way for me to do this in a separate thread with D3D11?

sentences:
Building a unified interface for a swap chain in both DirectX 12 and Vulkan Most objects in DirectX 12 have natural analogues in Vulkan, e.g.

VkInstance = IDXGIFactory
VkPhysicalDevice = IDXGIAdapter
VkDevice = ID3D12Device
VkQueue = ID3D12CommandQueue
VkCommandBuffer = ID3D12CommandList

However, when it comes to the swap chain, it's not clear how the entries in VkSwapchainCreateInfoKHR correspond to entries in DXGI_SWAP_CHAIN_DESC1.
Clearly, there is not always a 1-1 correspondence, but I would really like to know how I can implement a unified interface for both.

sentences:
2D shadow from polar coordinates has hard cut-off at a certain radius I'm trying to cast shadows from a 1D texture that goes from white to back according to the distance given by an occlusion map. That part I think I got it right. The problem lies on the algorithm to check if a given pixel is in shadow.

As you can see, the outer limits are clamped, as if it is in shadow. The result I would expect is that it would slowly fade. I don't know why my shader yields this result.
Here is the shader I use for casting the shadows:
#version 330
#define numTextures 32
#define PI 3.14

in vec2 TexCoords;
in vec4 pass_colors;
in vec4 fragPos;
in vec4 worldFragPos;
in mat4 outWorld;

out vec4 color;
uniform vec4 ambientColor;
uniform sampler2D texture_diffuse;
uniform float radius;
uniform vec2 screenResolution;
uniform int lightCounter;

struct LightData
{
    float radius;
    vec3 position;        //light position, normalized
    vec4 color;      //light RGBA -- alpha is intensity
};

uniform LightData lights[numTextures];
uniform sampler2D shadows;

float n3ddistance(vec3 first_point, vec3 second_point)
{
    float x = first_point.x-second_point.x;
    float y = first_point.y-second_point.y;
    float val = x*x + y*y;
    return sqrt(val);
}

float sample(vec2 coord, float r) {
    return step(r, texture(shadows, coord).r);
}

float GetShadow(int lightIndex)
{
    vec2 dir = fragPos.xy - lights[lightIndex].position.xy;
    dir /= lights[lightIndex].radius / 2;
    //rectangular to polar
    dir.y *= -1;
    vec2 norm = dir.st;// * 2.0 - 1.0;
    float theta = atan(norm.y, norm.x);
    float r = length(norm);
    float coord = (theta + PI) / (2.0*PI);

    //the tex coord to sample our 1D lookup texture
    //always 0.0 on y axis
    vec2 tc = vec2(coord, 0.0);

    return sample(tc, r);
}

vec3 GetColor(int lightIndex)
{
    float dst = n3ddistance(lights[lightIndex].position.xyz, fragPos.xyz);
    float intensity = clamp(1.0 - dst / lights[lightIndex].radius, 0.0, 1.0);
    vec3 color = lights[lightIndex].color.rgb * intensity * GetShadow(lightIndex);
    return color;
}

void main()
{

    vec4 DiffuseColor = vec4(texture(texture_diffuse, TexCoords)) * pass_colors;

    vec3 sum = vec3(0);
    for(int i = 0; i < lightCounter; i++)
        sum += GetColor(i);

    vec3 intensity = ambientColor.xyz + sum;
    vec3 finalColor = DiffuseColor.rgb * intensity;
    color = vec4(finalColor.rgb, DiffuseColor.a);
    if (color.a <= 0.0)
        discard;
}

And here is the shader responsable for writing to that 1D texture
#version 330

#define PI 3.14159265359

in vec2 TexCoords;
in vec4 fragPos;
in vec3 lightPos;

out vec4 color;

uniform float radius;
uniform sampler2D occlusion;

void main()
{
    float distance = 1;

    for (float y=0.0; y < radius; y += 1.0)
    {
        vec2 norm = vec2(TexCoords.s, y / radius) * 2.0 - 1.0;
        float theta = PI * 1.5 + norm.x * PI;
        float r = (1.0 + norm.y) * 0.5;
        vec2 coord = vec2(-r * sin(theta), -r * cos(theta))/2.0 + 0.5;

        vec4 data = texture(occlusion, coord);
        float dst = y/radius;
        float caster = data.r;
        if (caster > 0.75) {
            distance = min(distance, dst);
            break;
        }
    }
  color = vec4(vec3(distance), 1.0);
}

How can I get a smooth fall-off instead of this sudden stop at a particular radius?

sentences:
Button - change texture after click I need to make a button with texture. After button is pressed I want to change texture of button permanently.
For example on/of sound button.
I tried this but it changes image only while I hold button.

Thanks

mSoundButton  = new ButtonSprite(30, 30,
                    ResourceManager.getSoundButtonTR(),
 //tiled texture region with image for sound on and sound off
                    ResourceManager.getEngine().getVertexBufferObjectManager()) {
        @Override
        public boolean onAreaTouched(TouchEvent pTouchEvent,
                                     float pTouchAreaLocalX,
                                     float pTouchAreaLocalY) {
            if(pTouchEvent.isActionDown()) {
                SFXManager.toggleSoundEnabled();
                this.setCurrentTileIndex(1);
            }
            return super.onAreaTouched(pTouchEvent, pTouchAreaLocalX, pTouchAreaLocalY);
        }
    };
    mScene.registerTouchArea(mSoundButton);
    mScene.attachChild(mSoundButton);

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: Find parametric UV derivative? How do I find the parametric UV and du and dv of a primitive on a sphere ? Assuming that is all the information you have on the sphere. I want to find the partial derivatives for a primitive if I the only value I supply is either X,Y,Z ?

sentences:
How to use dynamic resources with SharpDX by detail? I've looked through a lot of archives but still cannot figure out how it works.
Taking this overridden one for example.
public DataBox MapSubresource(Buffer resource, MapMode mode, MapFlags flags, out DataStream stream)

Is this method aiming to change the resource with stream. If it is, why would the stream be marked out as if it is an output value rather than input?
If the above one is true, where can I stream my data into the stream to update the buffer? Has it to be between the Map and Unmap methods? And typically how should I stream it (Take vertex buffer for example, what would the format of streaming be like?)
Is it advisable to call the MapSubresource method whenever GPU access is finished(after every frame), and call the UnmapSubresource next frame to allow GPU access so it may save more time when I am keep updating the data?

Thank you!

sentences: How to use camera in Google VR SDK 1.50 for Unity? I have looked at many tutorials on making an Android app for Google Cardboard in Unity, but all of them were for older versions of the GVR SDK. How do I simply add a stereo camera in version 1.50 (with Unity 5.6)?

sentences: Push Notification to start a scene I was wondering whether I can use APNs in iOS to trigger an event in my game, like start a scene without user clicking the notification. Is it possible to use remote push notifications for events like this?

sentences:
Creating a Roguelike game in C I'm trying to create a simple rogue-like game in ncurses in a C program.

The idea here is that, I'd parse a file like this:

10X10 ds2 de2 dw5
12X12 ds3 de2 dw1
14X14 ds5 de1 dw5
10X10 ds5 de3 dw5
12X12 ds5 de2 dw5
14X14 dw2 de1 ds2

Where the first number is a door size(rows,columns), the second string being a door, where s = south, w = west, etc, so ds2 = door south 2 down (in the y direction).

Effectively, this looks like this when parsed, I have this:

Where (hopefully viewable), the plus signs at the end of each room, are the doors that lead to another room, so in the first room, the east door would lead to the room to the right, etc.

However, this is where I'm not sure how to go about implementing my logic. I need to make it when I step on a plus sign "effectively" a door, I'd teleport the player (the @ sign cursor) to the correct door.

Okay, great I know the locations of each doors, but how would I actually mvoe the cursor to the next room.

I can't simply hard code the distance between two rooms, as that's just ineffective and would take too long.

Just to clarify, what I mean about teleporting:
See this picture:

Where the user "@" symbol would move to the door (in the first room), then get teleported to the second room (12x12 room).  (AS seen in the next picture) (Again where the @ symbol is the user, moving the cursor around (w,a,s,d).

So to clarify: I need a way to move a cursor, between two rooms, without hardcoding the distance between rooms, unless there is an effective way to hard code the distances.

Any ideas?

sentences:
Center Perspective Camera on Coordinates I've got a PerspectiveCamera and set of coordinates (x,y,z).

How could I pan the camera to make these coordinates at the center of the screen?

sentences:
Validating victory report to PHP leaderboards I have decided to begin working on some sort of leaderboard server for my PC game.

For starters, I decided to write some PHP scripts to handle it. The script doesn't actually receive a score - it just receives a player ID. Then the server increases their score. When submitting a "victory", the game performs a connection to the server of this form:

http://www.example.com/doVictory.php?ID=Joe

As you can see, the server just receives the player ID and then it does its own scoring stuff (the score value of a victory changes overtime).

My concern is pretty simple: what if some guy figures this out? They would be able to spam the above address several times and keep increasing their score.

One option:

Don't accept victories from the same player within a short amount of time.

Due to the nature of the game, players can have a victory as fast as within 1 minute. If somebody is having a victory every minute, I would not be able to tell whether they are cheating or just very good.

I have found an answer here: https://gamedev.stackexchange.com/a/4185/4779

  Send a JSON message over plain HTTP (not HTTPS). Include a MD5-hash of all fields plus a magic string.
  On the server, check the integrity of the message with the same operation.

But as far as I'm concerned, this doesn't quite work with my scenario because I am not really sending a score - just reporting a victory.

sentences: How do I implement an AutoParallax Background in AndEngine GLES1? I'm using AndEngine GLES1. In my game, I use AnalogOnScreenControl to move a sprite and when it moves vertically, the background image also moves vertically. I want to do something like this: that is in this link.  I know that AutoParallax Background or BackgroundParallaxScrolling may be used. But how do I use it in my game?

sentences:
Using libGdx and Box2d for game and getting this error- "incorrect checksum for freed object" I am new in game development and I am using libGdx with box2d in my game, whenever I try to switch screen (both screens has box2d bodies with Tiled map), I encounter the following error.

  java(610,0x70000297a000) malloc: * error for object 0x7f8d642fd600:
   incorrect checksum for freed object - object was probably modified after  being freed.
   * set a breakpoint in malloc_error_break to debug

The code which I use to switch screen is in render method

if((mapPixelWidth - 200) <= frog.body.getPosition().x * PPM){
        game.gm.setPrefLevel(0);
        Gdx.app.postRunnable(new Runnable() {
            @Override
            public void run () {
                Array<Body> bodies= new Array<Body>();
                world.getBodies(bodies);
                for (Body b: bodies) {
                    world.destroyBody(b);
                }
            }
        });
        game.manager.unload("maps/World1Level3.tmx");
        game.setScreen(game.levelLoading);
    }

Apart from this error, I want to ask that the way I am using Asset Manager and Box2d bodies are correct or not?

sentences:
Scaling material texture to be 1pixel = 1 unit I have a mesh I use to render a sprite texture I set up in a material. This mesh is planar XY-aligned and stationary. It's vertexes are generated from a PolygonCollider.

The problem is that I'm using 1 PPU in the rest of my sprites, but the sprite rendered in the texture looks extremely small.

How can I make the scale of the texture's material, so the size of a pixel in the material is equal to 1 unit?

I can't just scale it, because I need it to be EXACTLY 1 unit.

sentences:
3D models in 2D world I want to create a simple Flash game. Let's say, it's about soccer hooligans. I would need the characters to walk around the isometric landscape, drink, fight or whatever it is they do.

Now, how do I create those characters? I imagine it could be possible just to draw a separate movie clip for every action for 8 different directions (will 8 be enough?). But this seems like a little bit of work, to say the least.

Some people recommend creating and animating the models in some 3D editor (3DS Max, for instance). This looks better. But, how do I use them? There's no 'native' 3D in Flash (yet). And I don't really feel like being involved with one of the flash 3D engines (some have overly sophisticated APIs, others have bugs, the rest are not maintained anymore).

I could pre-render the animations to frame sequences and then just download them, right? But that makes a HUGE chunk of data.

Any thoughts or advices?

sentences:
Off-Screen Image processing with SharpDX I need help with a image processing task... I'm using SharpDX which I am very new to. I have a device3D, device3DContext... I have a Texture2D for off-screen rendering... I have a RenderTargetView...

Here is what I cannot figure out... I need to create a Quad aligned to the target dimensions... based on a TriangleStrip... I need to load an image onto said Quad... I need to be able to apply a Pixel Shader to it...

Here is my prototype so far...

public event Action OnInitialized;

    public ImageProcessor()
    {

    }

    public void Initialize(System.Drawing.Size size)
    {
        try
        {

            var bestAdapter = DisplayAdapters.GetBestAdapter(SharpDX.Direct3D.FeatureLevel.Level_10_0);

            using (
                var device = new SharpDX.Direct3D11.Device(bestAdapter,
                    SharpDX.Direct3D11.DeviceCreationFlags.BgraSupport, bestAdapter.FeatureLevel()))
            {
                Device = device.QueryInterface<SharpDX.Direct3D11.Device1>();
            }

            using (var dxgiDevice = Device.QueryInterface<SharpDX.DXGI.Device>())
            {
                GPUDescription = dxgiDevice.Adapter.Description.Description;
            }

            DeviceContext = AddDisposable(Device.ImmediateContext.QueryInterface<SharpDX.Direct3D11.DeviceContext1>());

            var colorFormat = SharpDX.DXGI.Format.R8G8B8A8_UNorm;

            var bufferDescription = new SharpDX.Direct3D11.Texture2DDescription()
            {
                ArraySize = 1,
                BindFlags = SharpDX.Direct3D11.BindFlags.RenderTarget | SharpDX.Direct3D11.BindFlags.ShaderResource,
                CpuAccessFlags = SharpDX.Direct3D11.CpuAccessFlags.None,
                Format = colorFormat,
                Height = size.Height,
                Width = size.Width,
                MipLevels = 1,
                OptionFlags = SharpDX.Direct3D11.ResourceOptionFlags.None,
                SampleDescription = new SharpDX.DXGI.SampleDescription(1, 0),
                Usage = SharpDX.Direct3D11.ResourceUsage.Default
            };

            Target = new SharpDX.Direct3D11.Texture2D(Device, bufferDescription);

            RenderTargetView = new SharpDX.Direct3D11.RenderTargetView(Device, Target);

            OnInitialized?.Invoke(this);

        }
        catch (SharpDX.SharpDXException ex)
        {

            var desc = ex.ResultCode;
        }
    }

    public System.Drawing.Image ProcessImage(string filename)
    {

        Device.ImmediateContext.ClearRenderTargetView(RenderTargetView, SharpDX.Color.Gray);

        Target = TextureLoader.CreateTexture2DFromFile(Device, filename);

        Device.ImmediateContext.Flush();

        var memoryStream = new MemoryStream();

        CopyTexture.ToImage(DeviceContext, Target, memoryStream);
        memoryStream?.Flush();

        var processedImage = System.Drawing.Image.FromStream(memoryStream);
        memoryStream?.Dispose();

        return processedImage;
    }

    private SharpDX.Direct3D11.Device1 Device;
    private SharpDX.Direct3D11.DeviceContext1 DeviceContext;

    private SharpDX.Direct3D11.Texture2D Target;
    private SharpDX.Direct3D11.RenderTargetView RenderTargetView;

    public string GPUDescription = string.Empty;

Please explain code in detail...

I've asked a similar question and someone provided a HLSL file which didn't require vertices however, I have no idea how to apply it... So I figured I'd provide the code and ask for more detailed help.

sentences:
Brief pause after keypress After i press and hold the key it goes forward once then pauses for a second or less then goes forward on forever. My problem is the brief pause I cant locate the issue. Thanks for your help.

    while(game){
        while (SDL_PollEvent(&e)){
            mainChar.manageEvents(e);
        }
        background.renderChar();
        mainChar.renderChar();
        SDL_RenderPresent(ren);

    }
void Character::manageEvents(SDL_Event event)
{
    switch(event.type){
        case SDL_KEYDOWN:
            KEYS[event.key.keysym.sym] = true;
            printf("true");
            handleInput();
            break;
        case SDL_KEYUP:
            KEYS[event.key.keysym.sym] = false;
            printf("false");
            break;
        default:
            break;
    }
}
void Character::handleInput()
{
    if(KEYS[SDLK_a]) {
        dst.x--;
    }
    if(KEYS[SDLK_d]) {
        dst.x++;
    }
    if(KEYS[SDLK_w]) {
        dst.y++;
    }
    if(KEYS[SDLK_s]) {
        dst.y--;
    }
}

sentences:
How to render models using a personalized projection matrix? I'm creating a game with a great sprite demand. Out team is considering automatizing the sprite generation using 3D models. The problem is we have a very particular ortographic projection:

We have already set up a good projection matrix. The problem is none of the 3D renderer of nowadays have an option for using custom matrixes.

How is this kind of problem dealt with?

sentences: How do I slice a 3D object at runtime in Unity? I'm specifically looking for some sort of algorithm or way that can "cut" a 3 dimensional mesh with some other game object. How would I implement this?

sentences:
Unity: Running code on the "Create Other" menu? Right now I am trying to create a TextMesh GameObject from code.

The graphics primitives are accessible through PrimitiveTypes, I'm thinking there must be something similar, and if not, I could at least run whatever static function is bound to the menu - if only I knew the name.

The more general question is "how one get at all the other items on the "Create Other" without using the menu itself?"

sentences:
Unity c# bullet randomly changes position i have problem in unity im using this code to shoot bullets and it works but when im shooting bullets are moving left automatically or when i will aim it at right it shoots  straight instead i'm using this code right now:

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

public class shootobj : MonoBehaviour {
    public GameObject prefab;

    void Start () {
     prefab = Resources.Load ("projectile") as GameObject;

    }

    void Update () {
        if (Input.GetMouseButtonDown (0)) {
            GameObject projectile = Instantiate (prefab) as GameObject;
            projectile.transform.position = transform.position + Camera.main.transform.forward * 2;
            Rigidbody2D rb = projectile.GetComponent<Rigidbody2D> ();
            rb.velocity = Camera.main.transform.forward * 40;
        }
    }
}

what could be causing such thing?

sentences:
Use texture array for spritesheets? To save texture bind there is the technique to use a sprite sheet which combines several sprites into one texture. Now if I have more sprites than which will fit into one sprite sheet (limited by GL_MAX_TEXTURE_SIZE), can I just use a texture array with multiple sprite sheets and still use only one texture bind?
Is the limiting factor for the amount of sprites the gpu memory?

sentences:
Need help drawings planets in Java I am looking for help/links/notes/agorithms/URLs/examples on drawing/rendering spheres in pure Java (so that I can hopefully, one day, generate/render planets with various surfaces & atmospheres)

So for the moment, i'd be pretty happy to be able to start off with just drawing a wireframed sphere(s).

ps: I don't want to use external libraries like Java3D, JOGL or aftermarket engines like JMonkeyEngine, Would rather keep it as straight Java.

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:
Unassigned reference exception when proceeding from scene to scene So, I have built a script in unity in c# called parralax. It basically parallaxes two backgrounds and looks like this:-

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

public class Parralax : MonoBehaviour {

    public float startPos;
    public GameObject cam;
    public float parallaxEffect;

    public float length;
    public GameObject player;
    public float playerStartPos;
    public float maxDisplacement;
    void Start () {
        maxDisplacement = 0f;
        playerStartPos = player.transform.position.x;
        startPos = transform.position.x;
        cam = GameObject.Find ("Main Camera");
        length = GetComponent <SpriteRenderer> ().bounds.size.x;
    }

    void Update () {

        float dist = cam.transform.position.x * parallaxEffect;
        transform.position = new Vector2 (startPos + dist, transform.position.y);

    }
}

If I put it in respective background and assign a value to it, it works fine and runs smoothly. But, if I play the game scene-wise i.e. 1st scene to 2nd scene to 3rd scene; it crashes and says:-

Unassigned reference exception:- You need to set variable cam in inspector

Even though, it runs on the same scene, it doesn't run after I play it scene- wise. Please help!

sentences:
Weird squares everywhere So in unity I have some weird squares on surfaces of certain objects, which are buildings represented by planes:

I don't know what causes it, I tried changing some settings in lighting and material, but couldn't fix it. This only occurs with one object which is a few planes representing buildings temporarily. The lighting is baked (one directional light).
 Here's the screenshots of lighting and materials tab:

Does anyone know what could be the problem and how I can fix it?
Ask for more information if needed.
Thanks.

EDIT: The buildings were imported from blender.

sentences:
Help understanding Accidental Noise Gradient function Background:

I am trying to create a set of functions to manipulate noise, similar to Libnoise, Fastnoise and the Accidental Noise Library. The end goal is to produce terrain.

As recommended by this article (http://accidentalnoise.sourceforge.net/minecraftworlds.html) I am starting out with a 'Gradient' function.  Quoting the author:

  The Gradient function is given a line-segment in N-dimensional space
  (ie, in whatever coordinate space we are working in, be it 2D, 3D, or
  higher) and calculates a gradient field aligned along this segment.
  Input coordinates are projected on this line, and their gradient value
  is calculated depending where on the line they lie in relation to the
  endpoints of the defining segment.

Even after repeatedly reading the article and looking at these two other questions I found (2D Terra(ria)in generation - Accidental noise and Accidental noise - Gradient function) I'm still having problems understanding exactly what the function is doing.

Questions:

My test chunk is of size 32x32x32 and ranges from -16 to +16 on the x, y and z axis.  In this case, would the inputs to the function be x/32, y/32, z/32?
Does the function map points between 0 and 1 (as input) to a point between 1 and -1 (as output)? I.e if my x, y and z where -16, -16, -16, would I get 1, 1, 1 back?
Why in the extract below is the line segment (0,1)->(0,0) rather than (0,0)->(0,1)?  Given that the example line segment is defined as x1=0, x2=0, y1=0, y2=1.

  The Gradient function accepts a line segment in the form of (x1,x2,
  y1,y2) for the 2D case, extended to (x1,x2, y1,y2, z1,z2) for the 3D
  case. The point formed by (x1,y1) delineates the start of the line
  segment, which is mapped to 0. The point formed by (x2,y2) is the end
  of the line segment that maps to 1. So here we are mapping the line segment (0,1)->(0,0) to the gradient.

Any help on this would be greatly appreciated, thanks.

sentences:
How do I find two points at an angle on opposite sides of a circle? With reference to my previous question:

I'm using micklh's answer, which works perfectly. However, it calculates the gradient based on two points, a starting point and an ending point. I want to change that such that I can give it a center point, an angle in degrees, and a length.

If you look at the picture from the other question:

You can sort of discern where the center point is, the x,y of starting/ending locations become the dots based on the length of the gradient.

I assume I would have to:

Take the center location
Apply the angle + length
Gives me my ending x,y
Take the center location
Calculate the reverse angle
Apply the reverse angle + length
Gives me my starting x,y
Plug these starting/ending positions to the answer from the other question.

Am I correct? How would I do those steps?

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:
Bullet physics C# script Is imparting force on rigidbody objects I have recently made the simplest gun and bullet script that I could and it works amazingly, except for one problem that I've found. When I attach it to a game object with a rigid body the force of the bullets move the object back with quit a bit of force.

But what I can't seem to figure out is why the bullets are imparting force on the object at all. The bullets do not have a rigid body component. The way my guns work is with two scripts, one which acts as a simple spawning point when a key down event is given and what ever object you give it to spawn.

The second script is applied to the bullet itself which causes the bullet to have motion through transform.Translate with a speed variable. The best example I can give of this is when I attached two guns to the default unity jet and when I fired, it had enough force to move the jet back against its thrust speed.

I really would appreciate any help with this so I can move on with my project. I will provide the code bellow for the two scripts.

Thank you

public class Shoot : MonoBehaviour {
  public GameObject bullet;

  void Update () {
    if (Input.GetKey (KeyCode.Mouse0))
      Instantiate(bullet, transform.position, transform.rotation);
  }
}

public class MoveBullet : MonoBehaviour {

  public float speed = 1f;

  void Update () {
    transform.Translate (0, 0, speed);
  }
}

sentences:
What GPU culling techniques are appropriate for voxel spheres other than octrees? I'm creating a dynamic smooth-voxel based world in the shape of a sphere. Right now my current approach is to spherize a cube, generate voxel terrain on each of the six patches, and then use octrees to cull the data further.

Octree's are best served with cubes. Is there a better system for storing/accessing data in a sphere? I've heard some talk of Octree's not being the best way to store voxel data, even for cube worlds. How can this be? What would be better? A Hash Table?  Surely multidimensional arrays wouldn't be faster? Perhaps it's just more of a design decision than performance? As in, maybe someone didn't like chunks popping in so they would rather load individual rows and columns?

If it matters, I'm probably going to keep relevant geometry in GPU memory and stream in the surrounding area over time as the player gets closer to it from main memory. I bring this up because I'm really not sure if GPU memory benefits from any particular structure. All I really know is that the parallel powers of the GPU are, well, unparalleled (I had to). How can I tap into that?

sentences:
Changing scene while joining room and RPC buffer problem I have a button on my main menu that creates and has the player join a random room. After the client joins this room, I change the scene to the game (main) scene in the OnJoinedRoom method. This works well, until I use the RPC call with buffers.

There are 5 spawn points in the game scene, and every time a player joins the room, they occupy a spawn point, so no-one else can spawn at that point.
So, I have list of spawn points in my code, and every time a player joins, it randomly picks a point from that list and "removes" it from the list. It does this via RPC call, so if a player joins the game late, it removes that point, too.

There is a problem with that RPC's buffer because of the "scene change". After OnJoinedRoom, the RPC buffers are called only when the player joins the room, and before the scene change. Because the scene hasn't changed yet, it has trouble finding the buffered photonview, and it throw outs an error. It doesn't update the list.

Can I delay the buffer calls, is there a better way to change my scene while joining a room?

sentences:
Using shader for cubes I am trying to use a shader to get an effect like this. Notice how

every cube has exactly the same lightning as every other no matter where it is on the screen
if you look closely the lightning is making the front face's top parts darker, and the front face's lower  parts lighter (about 20% difference at most)
also more importantly the edges of the cubes are smoothed ( filleted )  and foggy looking

I am drawing my cubes like this with the default lightning.

        cubeEffect.EnableDefaultLighting();
        for (int i = 0; i < 10; i++)
        {
            for (int j = 0; j < 25; j++)
            {
                // apply the effect and render the cube
                foreach (EffectPass pass in cubeEffect.CurrentTechnique.Passes)
                {
                    cubeEffect.World = Matrix.CreateTranslation(-15.6f + i * 3.05f, 15.5f - j * 1.168f, 0.0f);
                    pass.Apply();
                    //draw
                    RenderToDevice(GraphicsDevice);
                }
            }
        }

This is how my cubes looks like with the default lightning... i am trying to achieve an effect like the first image. I have no experience with lightning effects and how to do something like this so, i'd appreciate any help on how to get started.

I used this http://blogs.msdn.com/b/dawate/archive/2011/01/20/constructing-drawing-and-texturing-a-cube-with-vertices-in-xna-on-windows-phone-7.aspx tutorial's help to draw this

sentences:
How can I get the NodePath that points to the property, rotation, of the parent node? The 2nd arg in interpolate_property takes a NodePath, but str of a path to a prop seems fine too. So I'd expect this to work:

var rotation_node_path = "/root/Main/Boid1/InitialRegion/Bird:rotation"

but I'm getting the error

ERROR: interpolate_property: Condition ' !prop_valid ' is true. returned: false

func lerp_rotation():
    add_child(tween)

    var rotation_node_path = str(parent.get_path()) + ":rotation"
    var current = Math.smallest_equal_angle(parent.rotation)
    var target = Math.smallest_equal_angle(target_rotation)
    var duration = 1
    print(current, ' ', target, ' ', rotation_node_path)

    tween.interpolate_property(parent, rotation_node_path, current, target, 1, Tween.TRANS_LINEAR, Tween.EASE_IN_OUT)
    tween.start()

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 procedurally generate rivers on a tilemap with thickness? I have read numerous articles on the subject but can find none that can explain to me how it is that procedural river generation achieves a certain amount of thickness to the river. I have managed to pice together that I must search for perpendicular vectors to the one I use to construct the river, but am not sure how that is implemented. I am working on a 2D game with tilemaps implemented and don't know how I iterate through the tiles to achieve the intended result.
I am fairly intermediate when it comes to game development and have just started proc-gen games. Please try to answer simply as to how to do this. I know that others have figured it out and want an answer.
How do I set the thickness of procedurally generated rivers?
EDIT
I am able to code simple straight lines and have access to an astar algorithm to connect two points together, but my river is literally one tile thick. I want to increase its size and I am not proficient in other programming languages enough yet to be able to read through source code.
The rivers I want just need thickness to them. I just need whatever technique others might use to produce rivers or roads thicker than a single tile.

sentences: Where to keep game images I am new to gamedev, and I have one question about architecture. Where to locate game images? Should I keep this in the class object or in the main function and draw it depending on object variables?

sentences: What kind of gaming platforms for Linux are available? Which libraries/platforms are available on Linux to start game development?

sentences:
Re-sizing the form without scaling the GUI I am writing a turn based strategy game in C#.  My GUI implementation consists of class that extends Form containing a class that extends Panel.  When I render the GUI I draw to the paint method in the panel.

I am trying to figure out what is the best way for handling form re-size events.  I know I want a minimum window size, but I would prefer to not have a maximum or a set size.

Ideally the GUI would reveal more/less of the map as the user changes the window size.  I would like to avoid scaling the graphics if at all possible.

What is the best way to handle re-size events?

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:
Are there well-known tools for chasing down VRAM & GTT memory leaks? Problem. I have inherited a large C++ 3D graphics codebase (with some shader code). The program runs for about 1-5 minutes before crashing.

Problem Data. Using system tools, one can see a sharp rise in VRAM memory usage after the program launches, which eclipses into a crash. The same is true for GTT memory usage also (although the spike isn't quite as dramatic as with the VRAM).

Questions.

Does this (probably) mean that there is a memory leak in OpenGL shader code somewhere (as opposed to a leak in regular C++ code)?
Are there well-known tools for tracking down vram/gtt memory leaks (similar to the way that valgrind can be used to track down system memory usage)?

sentences:
How do I check for collision between an ellipse and a rectangle? I am working on LibGdx framework for developing a 2D isometric tower defense game.All my sprites are drawn in 2D isometric view.

I have used an array list to store 8 points at boundary in the rectangle.LibGdx has an inbuilt function (returns Boolean) ellipse.contains(x,y),by iterating through array list I can check whether any points are inside ellipse
But the problem is as shown in below picture,it wont detect the enemies in some particular cases

So my question is:
1)Is this a correct approach for solving these kinds of problems
2)If not can you suggest better approach for solving this problem

Thank you.

sentences:
Scale / NonUniformScale is not applied to entity I'm just learning the new Unity ecs and trying to change the size (scale) of an entity.
Everything works fine, I can change the rotation, the position but not the scale.

I'm wondering why.
I did various tutorials, I tried Scale, NonUniformScale, LocalToWorld, CompositScale but nothing works. Maybe some of the methods are deprecated.

Here is what I have tried so far.

I have multiple prefabs (planes) which are spawned correctly and each of them having a transform component.

Now I want to change the scaling of all the planes.
For that I use a JobComponentSystem.
In the following pice of code the rotation works fine, but not the scaling.

I tried LocalToWorld.

public void Execute(ref Rotation rotation, ref LocalToWorld scale) {
            rotation.Value = math.mul(rotation.Value, quaternion.RotateZ(math.radians(0)));
            scale.Value = float4x4.Scale(2, 4, 5);
        }

I tried NonUniformScale

public void Execute(ref Rotation rotation, ref NonUniformScale scale) {
            rotation.Value = math.mul(rotation.Value, quaternion.RotateZ(math.radians(0)));
            scale.Value = new float3(2, 1, 4);
        }

I tried Scale.

public void Execute(ref Rotation rotation, ref Scale scale) {
            rotation.Value = math.mul(rotation.Value, quaternion.RotateZ(math.radians(0)));
            scale.Value = 5;
        }

None of these is working.
What did I wrong (the scale just stays at 10,1,10) or what is the current propper way of doing that?

sentences:
How can I modify how my scene is drawn to make it look like it's taking place at different times of day? My game has a day-time association with the scene, that the morning light will be different from the afternoon and the night. But I don't know how to make this difference.

Here is an example in Pokemon game:

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

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

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:
SFML test app feels slow/clunky Similar to this question https://stackoverflow.com/questions/33904998/sfml-extremly-slow-irregular-framerate, I have created a small program to experiment with SFML
I have a very simple SFML test application on ubuntu 20.04 using SFML 2.5.1.
There are three circles. One under user control and one bouncing left to right.
Problems:

The one moving left to right is not very fast.
Even so the one under user control cannot keep up with it.
I am using a delta of 1 (pixel per frame?). If I increase this motion is jumpy rather than smooth.

Put simply it feels clunky.
So I am assuming I've made a noob error of some kind.
However, this seems to be the same basic SFML game loop commonly used.
How can I make this fast and slick feeling instead?
#include <SFML/Graphics.hpp>

int main()
{
    sf::RenderWindow window(sf::VideoMode(200, 200), "SFML works!");
    const float FPS = 120.0f; //The desired FPS. (The number of updates each second).
    bool redraw = true;      //Do I redraw everything on the screen?
    window.setFramerateLimit(FPS);
    sf::CircleShape shape2(100.f);
    sf::CircleShape shape(10.f);
    sf::Clock clock;
    shape2.setFillColor(sf::Color::Green);
    shape.setFillColor(sf::Color::Red);

    sf::CircleShape alien(10.f);
    alien.setFillColor(sf::Color::Yellow);
    auto alienSpeed = 1.f;

    while (window.isOpen())
    {
        sf::Event event;
        float xDelta = 0;
        float yDelta = 0;
        bool moved = false;
        if (window.pollEvent(event))
        {
           if (event.type == sf::Event::Closed)
           {
              window.close();
           }
           if (sf::Keyboard::isKeyPressed(sf::Keyboard::Left))
            {
               xDelta -= 1.f;
               moved = true;
            }
            else if (sf::Keyboard::isKeyPressed(sf::Keyboard::Right))
            {
               xDelta += 1.f;
               moved = true;
            }
            if (sf::Keyboard::isKeyPressed(sf::Keyboard::Up))
            {
               yDelta -= 1.f;
               moved = true;
            }
            else if (sf::Keyboard::isKeyPressed(sf::Keyboard::Down))
            {
               yDelta += 1.f;
               moved = true;
            }
        }

        if (xDelta !=0 || yDelta != 0)
        {
           shape.move(xDelta,yDelta);
        }

        alien.move(alienSpeed, 0.f);
        if (alien.getPosition().x >= 190)
        {
           alienSpeed = -1.f;
        }
        else if (alien.getPosition().x <= 0)
        {
           alienSpeed = 1.f;
        }

        if(redraw)
        {
           window.clear();
           window.draw(shape2);
           window.draw(shape);
           window.draw(alien);
           window.display();
        }
    }

    return 0;
}

Note: cross posted to https://en.sfml-dev.org/forums/index.php?topic=27617.0

sentences: Can you export lighting models directly from 3D application to a real time renderer? is it possible for example to insert lighting in a 3D Model software like 3DSMAX and export an animated model like md5,..etc. and export the lighting too ?

sentences:
How do fixed-point physics (engines) work? I would think there should be an abundance of excellent articles answering this question, but my searches have come up completely empty.
I am developing an embedded graphics engine on a microcontroller which does not have an FPU or math co-processor.
I read somewhere before during my research that reasonably precise physics can be implemented without floating point math by using fixed point math.
How exactly does this work? What generally would be the programmatic behavior of a physics engine with some time step dt?

sentences:
How to draw realtime 3D amoebas in OpenGL? How would one draw 3D amoebas in real-time in OpenGL? The key components I'm looking for are:

Curved closed surface that changes shape
Generally transparent
Something translucent inside showing the volume is occupied

It has to be in real-time, and be able to handle many (100's) of these moving and animating on screen simultaneously.

What techniques might one use to accomplish this?

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:
Resetting scene state i was wondering what are the best practices for restarting the game, say for example in a platformer game when you die the game restarts and you have to reposition all the characters or reset the traps or what have you.

I thought two ways for doing this:

1) You have some level or scene manager that has a reference to all the things that should react to a game state change ,for example when restarting level, you would tell every character to reposition itself or something like that.

2) You have events. Every character or entity will subscribe to this level manager to an event like "OnLevelRestart" using delegates or function pointers, then when the manager restarts the level, it would trigger the event and all the ones who have subscribed to that event, will be informed and reset their own state.

The first approach seems more flexible because i have a reference to those objects, and i can send other kind of messages to them. so if in the future i want to do something different with those objects i already have the ability to do so.
Now the second approach is...there, seems of course less flexible than the first option, but apart from that i don't have anything against it. The good thing is that the manager doesn't need to know all the objects that need to reset, so i can create new entities and register to those events ( and from this perspective, it seems flexible too).

Im concerned about the scalability and maintainability of those options in the future. Is there a "best practice" for doing this ? or is just "whatever fits yout project" ? Thanks.

My sincere apologies if this question doesn't meet the requirements to be asked on this site.

sentences:
How to change AddForce code to MovePosition or SetVelocity? Vector2 vec = new Vector2(horizontal, vertical);
    vec = Vector2.ClampMagnitude(vec, 1f);

    Vector3 camF = cam.transform.forward;
    Vector3 camR = cam.transform.right;

    camF.y = 0;
    camR.y = 0;
    camF = camF.normalized;
    camR = camR.normalized;

    targetPosition = (camF * vec.y + camR * vec.x) * MoveSpeed;

    Vector2 targetVelocity = (targetPosition - transform.position)/Time.deltaTime;

    rb.AddForce(targetPosition - rb.velocity, ForceMode.VelocityChange);

My problem is my character doesn't affects by the gravity when i changed my code from transform.position to rb.AddForce. I searched online and even asked here how to calculate gravity and add it to my character, nobody knew, so i think if i can change this code to rb.MovePosition or rb.SetVelocity maybe it does affects by the gravity?

sentences:
Prioritizing prefabs in array for procedural generation I am trying to create procedural space background with a bunch of sprites of nebulas and stars. I have made few prefabs with different types of sprites attached to them. I have created an array through which game will loop and randomly place different stars on a background.

The question is. I want for example 90% of white stars in the background and 10% of others. I know I can create few loops for each prefab with a different maximum number, but it doesn't look very efficient. Is there any way to prioritize some array items while looping through an array?

sentences:
How to get distance from point to line with distinction between side of line? I'm making a 2d racing game. I'm taking the nice standard approach of having a set of points defining the center of the track and detecting whether the car is off the track by detecting its distance from the nearest point. The nicest way I've found of doing this is using the formula:

d = |Am + Bn + C| / sqrt(A^2 + B^2)

Unfortunately, to have proper collision resolution, I need to know which side of the line the car is hitting, but I can't do that with this formula because it only returns positive numbers.

So my question is: is there a formula that will give me positive or negative numbers based on which side of the line the point is on? Can I just get rid of the absolute value in the formula or do I need to do something else?

sentences:
Way to Prevent Stacking Pieces I have a chessboard with all the black pieces that move with this code:

I found that when I move the pieces, they will stack on top of each other. How can I prevent this?

I have since changed the code to this:

When I move a piece over another it still picks that piece up, but now it will occasionally completely prevent any stacked pieces from moving. What can I do, and is there a way to do this while still being able to move one piece over top of another?

Also, the pieces origin and collision box ( all similar to the king) look like this:

sentences:
Destroy GameObject as an Array of Transform instantiated destroying the whole array I am trying to destroy a GameObject with the Destroy() method, but when I call it the whole array is destroyed, not just that element.

//Instantiating the prefabs
public Transform[] blue;

foreach (Vector3 vec in xyid)
    {
        //vec.z is used as the object id
        Instantiate(blue[vec.z], new Vector3(vec.x, vec.y), Quaternion.identity);
    }

This is another script, I put this on every prefab

void Update () {

    if (Input.GetMouseButtonDown(0))
    {
        Destroy(gameObject);
    }

}

sentences: Get 2D mouse delta along 2D angle? I'm trying to develop my own transformation gizmo (with x, y & z handles/arrows the user can grab and move, like in game engines), however, I'm not sure how I should calculate the 2D mouse delta along the 2D angle of the grabbed handle axis. I already have converted the base and tip of the handle/arrow to screen-space, and have calculated the screen-space points' angle between the screen-space base and tip. I'm just stuck on taking the X & Y mouse delta and getting the acceleration of the delta along that 2D angle. I've made a little visualization;

sentences: moving box2d bodies in an arc or curved path How can I make a b2Body move in a arc-like or curved path? I have heard about cocos2d Bezier curve function (ccBezier) but this is for moving cocos2d sprites. Or can it be modified to move box2d bodies? Any help is appreciated. Thank you.

sentences:
How can I use custom shaders in Monogame? I wrote a shader in XNA and I want to use it in a Monogame Windows Phone 8 project. I converted my Effect1.fx file to Effect1.mgfxo. But the program doesn't work correctly. The screen of my emulator is always black if I run this code and I get no error message. Why is the code not working? Why is the screen always black if I try to run my shader? Am I loading the shader correctly?

How can I use a custom shader in my Monogame Windows Phone 8 project?

My shader code:

float4x4 World;
float4x4 View;
float4x4 Projection;

sampler finalImage : register(s0);
sampler displacementMap : register(s1);

float4 main(float4 color : COLOR0, float2 texCoord : TEXCOORD0) : COLOR0
{
  float displacement = tex2D(displacementMap, texCoord);
  texCoord += displacement * 0.2;
  return tex2D(finalImage, texCoord);
}

technique Refraction
{
  pass pass_0
  {
    PixelShader = compile ps_4_0_level_9_3 main();
  }
}

Code:

public class Game1 : Game
{
GraphicsDeviceManager graphics;
SpriteBatch spriteBatch;
private Texture2D back;
public Texture2D shockwave;
private RenderTarget2D finalImage;
private RenderTarget2D distortionMap;
private Effect distortionEffect;
private Vector2 Touchpoint;

public Game1()
{
    graphics = new GraphicsDeviceManager(this);
    Content.RootDirectory = "Content";
}

protected override void Initialize()
{
    base.Initialize();
}

protected override void LoadContent()
{
    TouchPanel.EnabledGestures = GestureType.Tap;
    spriteBatch = new SpriteBatch(GraphicsDevice);
    back = Content.Load<Texture2D>("background");
    shockwave = Content.Load<Texture2D>("shockwavesprite");

    finalImage = new RenderTarget2D(GraphicsDevice, GraphicsDevice.Viewport.Width, GraphicsDevice.Viewport.Height);
    distortionMap = new RenderTarget2D(GraphicsDevice, GraphicsDevice.Viewport.Width, GraphicsDevice.Viewport.Height);
    distortionEffect = Content.Load<Effect>("Effect1.mgfxo");
}

sentences:
How could I access game data from a dev machine at runtime from a mobile platform? When working on a game on a mobile platform, having read/write access to game data (assets, configuration files) stored on the dev machine at runtime would enable building of tools to quickly iterate, debug, and analyze the game at runtime.

For iOS & Android, is there any way to have access to these data files from the dev machine while the game is running on the mobile device?

Please do not recommend a tool, or a 3rd party engine that does this.

sentences:
Unity: Best Practise to apply Uniform Acceleration (regardless of direction) I have read a lot of other topics both on here, on the Unity forums and from Google searches that answer thing that are similar but not quite the same as my question.

My question:

I have a Unity project with a sphere, the sphere starts at a certain initial speed and I want the sphere to accelerate uniformly over time to reach its maximum speed, regardless of bounces and interactions.

Obviously an interaction will cause the Velocity to change, but I don't want the Speed to change.

I started off looking for a speed LERP, but come up with the below code.

I have negated and turned off all drag and friction settings on the gameobject.

My current code is thus (C#):

using UnityEngine;
using System.Collections;

public class Ball : MonoBehaviour {
    public float accelerationSpeed = 10f;
    public float maximumSpeed = 25f;
    public float initialSpeed = 10f;
    private Rigidbody rb;
    private bool ballInPlay = false;

    // Use this for initialization
    void Awake () {
        rb = gameObject.GetComponent<Rigidbody>();
    }

    //...other functions that don't relate to this question...

    void FixedUpdate ()
    {
        /***
         * Gradually increase ball speed
         ***/
        if (ballInPlay == true && rb.velocity.magnitude < maximumSpeed)
        {
             rb.AddForce(rb.velocity.normalized * accelerationSpeed, ForceMode.Acceleration);
        }

    }
}

This code takes ~3-4 seconds to accelerate the ball up to the maximum speed, and it seems to adequately bounce the ball off rigidbodies, as I want.

However, I will in time be having more things interacting with the ball including explosions and other actual Force values (such as Wind), so taking this into account; is this code the best way of applying a constant acceleration to a game object, regardless of its other behaviours and influences?

While the above may work I'm also looking for best practise as far as possible (and memory/processor efficiency if that's applicable).

While obviously there are going to be unknowns (as it's excessive to show you my whole project, just for this qustion), some guidance on best methods of approach to solving this as well as improving efficiency would be appreciated.

Many Thanks.

EDIT:
To clarify my exact question:
Is the code above best practise when applying uniform acceleration to the gameobject while dealing with the influence of additional Rigidbody.AddForce functions on the gameobject.

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:
Instantiate prefab button inside of panel I have a Canvas GameObject with a panel inside of it and a button prefab of the default button.

When I drag the button from my resources folder onto the Canvas in the hierarchy, it places itself where I expect it to, into the panel.

However when I instantiate it like below:

GameObject button = Instantiate(Resources.Load("UI/Dialogue/Button"), new Vector3(0, 0, 0), Quaternion.identity, MyCanvas.transform) as GameObject;

it gets placed into the center of the screen because of the second parameter. However, I can't set it as a child of the parent because that doesn't happen until the last parameter. It also doesn't feel right to figure out the exact Vector3 to plug in so that it looks like its on top of the panel.

Is there a way to instantiate the button onto the panel in code as it works when dragging it from the resources folder onto the Canvas in the hierarchy?

sentences:
Collision detection, stop gravity I just started using Gamemaker Studio and so far it seems fairly intuitive.  However, I set a room to "Room is Physics World" and set gravity to 10.  I then enabled physics on my player object and created a block object to match a platform on my background sprite.

I set up a Collision Detection event for the player and the block objects that sets the gravity to 0 (and even sets the vspeed to 0). I also put a notification in the collision event and I don't get that either. I have my key down and key up events working well, moving the player left and right and changing the sprites appropriately, so I think I understand the event system.

I must just be missing something simple with the physics.  I've tried making both and neither of the objects "solid".  Pretty frustrating since it looks so easy.

The player starting point is directly above the block object in the grid and the player does fall through the block.  I even made the block sprite solid red so I could see it (initially it was invisible, obviously).

sentences:
3d complex collision and trigger detection I'm a Unity developer and I use monobehavior functions to dot things like collision detection.
I have read about articles about collision detection. Most of them work with geometrical structures like sphere or boxes.

How are complex collisions with no formal and geometrical structures calculated?

sentences: How to make a simple score system for my game? I'm making a simple game and I can't seem to impliment a simple score system. As the object moves 10 units forward the score should increase by 10. My issue is that when I turn the object around and move backwards the score decreases.

sentences:
Multiplatform GLSL shader validator? Im working on a multiplatform (Pc,Mac,Linux) game that uses shaders quite extensively. Since we do not have any funding, it is pretty hard to test our game on all possible hardware configurations.

While our engine seems to run fine on different platforms, its usually the slight differences in GLSL compiling that gives us headaches. We have things set up such that we can test the shaders on Ati/Nvidia cards, but since the new Macbooks have Intel graphics, I'm really looking for a tool that can simply validate my GLSL shaders for different hardware without the need of yet another system.

Does anyone know such a tool?

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:
How to make particle based fluid simulator like Algodoo? I need to create swim mechanism which is interaction between object actuator and water.
I've play Algodoo and I can make simple swiming mechine. Which priciple to achieve this?
As far as I know it just round particle bouncing and update its momentum with viscositiy.
I just want what I need to know.

sentences:
What is the best PBR real time Fresnel function? I'm working on a physically-based renderer, and I've come to a sort of crossroads regarding the Fresnel factor. I'm having trouble finding the best way to represent it. I know that Schlick's Fresnel approximation is based off IOR, but IORs can go up to 38.6 for a meta-material, and 4.05 for a natural element, which will make representing these in a 0-1 image difficult and confusing. I also noticed that no one really uses IOR maps.

I also read a paper on Unreal's PBR integration, and I discovered that they initially wanted to use a F0 of 0.4, for non-metals. What would be the F0 for metals, in this case, and isn't the static value of 0.4 worth the limitations for that tiny bit of memory? I believe the F0 tends to the base color, as it becomes more metallic, but I'd like confirmation.

Finally, there's reflectivity or specular, as is used in modern PBR equations. Is there a standard for this, in regard to getting an F0? It seems arbitrary; is it a float value up to that directly maps to F0?

I am not sure if there are any real reasons to not combine specular color and base color, as Unreal has done this, before. I can't think of a single real reason, even for more stylized implementations.

What is the best PBR real time Fresnel function?

sentences:
1% idea, 99% execution? I keep reading in the game development community that the idea of a game is 1% and the execution of the game is 99%.

Do you believe that to be true? Not necessary in those percentages..

I always thought that a great idea is invaluable and it makes a game successful even though the execution is simplistic.

sentences:
Function is not showing up in the OnClick editor I'm just a beginner and I am currently having problems with the OnClick editor. I already drag and dropped my script to an empty gameobject and dragged that game object to the OnClick editor but still my function of "Pause" won't show up even if I already have it set to public. Please help

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

public class uiManager : MonoBehaviour {

    // Use this for initialization
    void Start () {

    }

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

    }
    public void Pause() {

        if (Time.timeScale == 1) {
            Time.timeScale == 0;
        }
        else if (Time.timeScale == 0) {
            Time.timeScale == 1;
        }
    }
}

sentences:
Rigidbodies gaining speed when they shouldn't I'm trying to get the effect of a constant magnetic field on a charged particle. A really important aspect of this is that the magnetic field doesn't do any work on the particle, which in this case means that it doesn't make it any faster or slower, just changes its direction.

On paper, this works because the equation for magnetic force on a charged particle is q*VxB, or the cross-product of the velocity of the particle and the magnetic field times the charge of the particle, which makes the force always perpendicular to the velocity. The code I wrote for this is this:

forces += charge * Vector3.Cross(rb.velocity, cons.constantMagneticField);

If the particle is the only thing that exists, and it has some initial velocity, and the magnetic field is perpendicular to that velocity, then the particle should ideally move in a circle of constant radius, because the magnetic force will always be perpendicular to the velocity. With what I have now, my particle moves in a tightish spiral, gaining speed way faster than I'd expect it to, and at a rate that scales with the particle's velocity.

Is there a way to compensate for this? If not, is there a another way to get the behavior I want?

sentences:
OBJ Model not being rendered properly in OpenGL ES 2 android app I have an Android OpenGL ES 2 app that loads an .OBJ model using Assimp and renders the same.

The vertices data is stored in a object declared like this :

class CGameObject
{
public:
struct _Mesh {
    std::string Name;               // Name of Mesh

    std::vector<float> vertices;    // vertices of Mesh

    GLuint m_vbo;
    // TODO: Add TEXTURE and MATERIAL support
};
...
}

Set various Matrices :

cameraX = 3.0f; cameraY = 3.0f; cameraZ = 5.0f;

// Camera/View matrix
View = glm::lookAt(
    glm::vec3(cameraX, cameraY, cameraZ),     // Camera position
    glm::vec3(0, 0, 0),     // Pointing at
    glm::vec3(0, 1, 0)      // Angle
 );

aspect = (float) width / height;

// Projection Matrix
Projection = glm::perspective(45.0f, aspect, 0.1f, 10000.0f);

glm::mat4 Model = glm::translate(mat4(1.0), glm::vec3(0.0f, 0.0f, 0.0f));
MVP = Projection * View * Model;

Rendering function :

void GLEngine::DrawFrame() {
glClear(GL_DEPTH_BUFFER_BIT | GL_COLOR_BUFFER_BIT);
glClearColor(0.0f, 0.0f, 0.0f, 1.0f);

glUseProgram(programObject);
// Draw of VBO ---BEGIN
for (GameObjects::iterator i = gObjects.begin(); i != gObjects.end(); ++i)
{
    CGameObject* pObj = *i;
    /////////////////
    for (int x = 0; x < pObj->Meshes.size(); x++)
    {
        glUniformMatrix4fv(MatrixID, 1, GL_FALSE, &MVP[0][0]);
        // bind VBO you want to draw
        glBindBuffer(GL_ARRAY_BUFFER, pObj->Meshes[x]->m_vbo);

        glEnableVertexAttribArray(gvPositionHandle);
        glVertexAttribPointer(gvPositionHandle, 3, GL_FLOAT, GL_FALSE, 0, 0);

        if (x == 0){
            glVertexAttrib3f(gvColorHandle, 0.0f, 0.0f, 1.0f);
            UcheckGLError("glVertexAttrib3f");

            }
        else {
            glVertexAttrib3f(gvColorHandle, 0.0f, 1.0f, 0.0f);
            UcheckGLError("glVertexAttrib3f");

            }

        //glEnableVertexAttribArray(gvColorHandle); // My app crashes if I uncomment this line . .. any reasons why ?
        //UcheckGLError("glEnableVertexAttribArray");

        glDrawArrays(GL_TRIANGLES, 0, pObj->Meshes[x]->vertices.size());
        // unbind VBO
        glBindBuffer(GL_ARRAY_BUFFER, 0);
    }
    /////////////////
}
// Draw of VBO ---END
// unbind program
glUseProgram(0);
}

source for shaders -

vertex shader :

attribute vec3 in_Position;

uniform mat4 MVP;

attribute vec3 in_Color;
varying vec4 fColor;

void main(void) {
    vec4 v = vec4(in_Position, 1.0);
    gl_Position = MVP * v;
    fColor = vec4(in_Color, 1.0);

}

Fragment shader :

varying vec4 fColor;

void main() {
    //gl_FragColor = vec4(1.0, 0.0, 0.0, 1.0);
    gl_FragColor = fColor;
}

But the results is not what I expect.
Expected :

What I get :

Loading of the Assimp model is provided in this question : https://gamedev.stackexchange.com/questions/85808/problem-rendering-simple-obj-model-using-assimp-in-android-app

sentences:
XNA 4.0 How to change GraphicsDevice Default DepthStencilState Value I want to change one of the deafult values of my GraphicsDevice to that:

GraphicsDevice.DepthStencilState.DepthBufferEnable = true;

But I know only to change it on runtime in the Draw method by putting this code (which means it's changing the value everytime that the compiler is running the draw method!):

DepthStencilState state = new DepthStencilState();
state.DepthBufferEnable = true;
GraphicsDevice.DepthStencilState = state;

Does someone know how to change it once in an officient way?

sentences:
What can I do to make sure that I have the energy to work on my game while working full-time? I work as a software engineer 40+ hours a week and I find that between balancing my personal life and family responsibilities that I have literally no energy to work on game development.

What can I do to make more time for my hobby without burning myself out in front of the computer? I am sure there must be someone here successfully developing a game while working as a programmer on the side.

sentences:
Matrix rotation wrong orientation LibGDX I'm having a problem with matrix rotation in libgdx. I rotate it using the method matrix.rotate(Vector3 axis, float angle) but the rotation happens in the model orientation and I need it happens in the world orientation.

For example:

on create() method:

matrix.rotate(new Vector3(0,0,1), 45);

That is ok, but after:

on render() method:

matrix.rotate(new Vector3(0,1,0), 1);

I need it rotate in world axis.

sentences:
How to implement this XP formula? I found this response but the thread is closed:

https://gamedev.stackexchange.com/a/13639

level = constant * sqrt(XP)

I seem unable to properly get current level, this is how I tried to do it, and everything seems to work except the actual current level for some reason:

xpConstant = 0.05;
currentXp = 80;
-- with those two values, level 1 should require 20 xp:
-- xp = 1^2 / xpConstant;
-- with 80 xp, the player should be level 2, 2^2 / 0.05 = 80

-- this is 0.47 but it should be 2?
currentLevel = xpConstant * math.sqrt( currentXp );

-- and to retrieve xp until next level, this does seem to work:
nextLevel = currentLevel + 1;
XPUntilNextLevel = nextLevel ^2 / xpConstant;
XPUntilNextLevel = XPUntilNextLevel - currentXp;

so for some reason the currentLevel variable doesn't give 2 as expected,

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:
Has "Killer Game Programming in Java" by Andrew Davison been rendered useless? What new tutorial should I follow? Its pathetic how it was created in 2005 not so long ago when the Java 3D 1.31 API was released. Now after downloading the source code off the books website and implementing it onto my work-space it cant run. (The 3D Shooter Ch. 23) I downloaded Java 3D 1.5 API, installed it- went back to my source code and javax.media ect.., and EVERY imported class within the game simply couldn't be resolved... they are all outdated..

Please do not say how its meant for a positive curvature in your game development skills. No ~ I got the book to understand how to code 3D textures/particle systems/games. Without seeing results how can I learn?

If there is still hope for this book please tell me. Otherwise what other books match this one in Game Programming? This one was very well organized, documented and long. I am not looking for a 3D game prog. book on Java. Rather one that has the same reputation as this one but is a bit newer..

sentences:
Network Message Registering message handler Problem I have a confusion about when and where to use NetworkServer.RegisterHandler() and NetworkManager.singleton.client.RegisterHandler()? And also I am getting Unknown message ID 1002 error.

I have a message class

public class NetworkMsgHandler : NetworkBehaviour {

public const short movement_msg = 1002;

public class BulletMovementMsg : MessageBase {

    public string objectName;
    public Vector3 objectPosition;
    public Quaternion objectRotation;
    public float time;
}

}

I have ServerRelay which has ServerOnly authority has Script ServerRelay for registering Message Handler on Server.

public class NetworkServerRelay : NetworkMsgHandler {
private void Start()
{
    if(isServer)
    {
        RegisterNetworkMessages();
    }
}

private void RegisterNetworkMessages()
{
    NetworkServer.RegisterHandler(movement_msg, OnReceivePlayerMovementMessage);
}

private void OnReceivePlayerMovementMessage(NetworkMessage _message)
{

    BulletMovementMsg _msg = _message.ReadMessage<BulletMovementMsg>();
    NetworkServer.SendToAll(movement_msg, _msg);
}

}

Then I have Bullet GameObject it has script Projectile which is sending movement message this class is derived from NetworkMsgHandler.

public class NetworkProjectile : NetworkMsgHandler {

private void Start() {

    if (localPlayerAuthority) {

        canSendNetworkMovement = false;
        RegisterNetworkMsg();
    }
    else {

        isLerpingPosition = false;
        isLerpingRotation = false;

        realPosition = transform.position;
        realRotation = transform.rotation;
    }
}

private void RegisterNetworkMsg() {

    NetworkManager.singleton.client.RegisterHandler(movement_msg, OnReceiveMovementMsg);
}

private void OnReceiveMovementMsg(NetworkMessage networkMessage) {

    Debug.Log("Message received");
    BulletMovementMsg msg = networkMessage.ReadMessage<BulletMovementMsg>();

    if(msg.objectName != transform.name) {

        ProjectileManager.Instance.SpawnedBullets[msg.objectName].GetComponent<NetworkProjectile>().ReceiveMovementMsg(msg.objectPosition, msg.objectRotation, msg.time);
    }
}

public void ReceiveMovementMsg(Vector3 position, Quaternion rotation, float _timeToLerp) {

    //lerping between position
}

private void Update() {

        if(!canSendNetworkMovement) {

            canSendNetworkMovement = true;
            StartCoroutine(StartNetworkSendCoolDown());
        }
}

private IEnumerator StartNetworkSendCoolDown() {

    timeBetweenMovementStart = Time.time;
    yield return new WaitForSeconds((1 / networkSendRate));
    SendNetworkMovement();
}

public void SendNetworkMovement() {

    timeBetweenMovementEnd = Time.time;
    SendMovementMsg(bulletID, transform.position,transform.rotation, (timeBetweenMovementEnd - timeBetweenMovementStart));
    canSendNetworkMovement = false;
}

public void SendMovementMsg(string _bulletID, Vector3 position, Quaternion rotation, float timeToLerp) {

    BulletMovementMsg _msg = new BulletMovementMsg() {

        objectRotation = rotation,
        objectPosition = position,
        objectName = bulletID,
        time = timeToLerp
    };

    NetworkManager.singleton.client.Send(movement_msg, _msg);
}

}

So whenever a bullet spawns it generates an error on client side saying Unknown message ID 1002 connId:1
UnityEngine.Networking.NetworkIdentity:UNetStaticUpdate()

sentences:
Farseer Physics: Ways to create a Body? I want to create something similar to this using farsser and Kinect:
https://vimeo.com/33500649
This is my implementation until now:
http://www.youtube.com/watch?v=GlIvJRhco4U
I have the outline vertices and the triangulation of the user. And following the Texture to Polygonmsample i used this line to create the shape, where farseerObject is a list of vertices of the triangles:
_compound = BodyFactory.CreateCompoundPolygon(World, farseerObject, 1f, BodyType.Dynamic);
But I have to update the body each frame (like 30 fps) and this is very slow. I get just 2 or 3 fps.
There's another (faster) way to create the Body from a list of triangles or the contour vertices?
How do you think they do this on Box2D?
Update:
After some testings i used EdgeShapes for the user contour (without triangulation) and i update the vertices for that edges in the fixtures every frame, now all is faster.
((EdgeShape)(farseerBody.FixtureList[i].Shape)).Vertex1 = new Vector2(farseerVertices[i].X, farseerVertices[i].Y);

But the collisions does not work!
My approach is incorrect?

sentences:
Networking for RTS games with lockstep using UDP Apparently from what I can gather Starcraft 2 moved to UDP in a patch. Now obviously with fps games there is no dispute that UDP is the only way to go. But with RTS games what benefits does UDP give over TCP given that the network model is lockstep?

I suppose another way to phrase this is: what features of TCP make TCP inferior compared to UDP with resend, etc. implemented in the context of rts lockstep networking model?

sentences:
How do I make Windows store recognize multiple resolutions? I'm currently developing a XNA Game for Windows phone 8, it works with every emulator resolution (WXGA, WVGA, 720p). However, when I upload the XAP to the Windows phone store it tells me that only WVGA resolution was detected.

Do I have to add some code to make the app downloadable for WXGA phone owners ?

sentences: Real world terrain import into UE4 I am trying to create a basic game in Unreal Engine 4.8.1 and I wish to have it set in the Dubai, UAE but i cannot find a way that will successfully use terrain data i have obtained (NASA Shuttle RADAR 90m) to create a 1:1 scale map in unreal without creating huge world spikes. Does anyone know a method that can import the data without creating terrain spikes?

sentences:
Why are some of my normals facing away from the camera? I'm trying to use WebGL to render some simple models, and I'm running into issues where pixels near the edge of my model are passing normals to my fragment shader that point away from the camera. This is of course messing with my attempts to use physically-based shading, because BRDFs are only defined in the hemisphere around the normal vector. These normals aren't just slightly pointing away from the screen; if that was the case, I would chalk it up to floating-point error and clamp to acceptable values. But some of my pixels have v-dot-n values of -0.5 or less.
This happens on pretty much any mesh I try to render. I have verified that my vertex normals point away from the mesh. I have backface culling turned on. This happens with both perspective and orthographic projections. I have tested in both Firefox and Chrome. Everything else about my render looks fine.
My vertex shader looks like this:
precision mediump float;

uniform mat4 M;
uniform mat4 V;
uniform mat4 P;

attribute vec3 vertexPos_model;
attribute vec3 vertexNormal_model;

varying vec3 pos_world;
varying vec3 normal_world;

void main() {
    gl_Position = P * V * M * vec4(vertexPos_model, 1.0);
    pos_world = (M * vec4(vertexPos_model, 1.0)).xyz;
    // We can use M here instead of its inverse transpose because it does not scale the model.
    normal_world = mat3(M) * vertexNormal_model;
}

And my fragment shader looks like this:
precision mediump float;

uniform vec3 cameraPos_world;

varying vec3 pos_world;
varying vec3 normal_world;

void main() {
    vec3 n = normalize(normal_world);
    vec3 v = normalize(cameraPos_world - pos_world);
    float vAngleCos = dot(n, v);
    // This will highlight pixels whose view vectors are outside of the hemisphere around n.
    gl_FragColor = vec4(vec3(clamp(-vAngleCos, 0.0, 1.0)), 1.0);
}

Rendering with the fragment shader above gives me results like this:

Apologies if I'm missing something obvious!

sentences:
How are game menus logically structured? I've been struggling with making a game menu system in Unity for some time now. I spent time developing a way to help myself understand how game menus are connected together. Right now, I'm calling it the Screen-Menu relationship.

In this relationship, Screens (e.g. Main-Menu, Game-Over and Inventory screens) hold access to Menus (e.g. Options Menu, Level-Select menu). These Menus are accessed via MenuButtons (e.g. Options menu button via the Pause Screen).

Is this a valid way of thinking about how game menus are structured? How should I be thinking about it?

sentences:
How can I calculate a terrain's normals? Im trying to implement basic lighting in Opengl 3+ (a sun) with this tutorial :

http://www.mbsoftworks.sk/index.php?page=tutorials&series=1&tutorial=11

Im building a basic terrain and its working well. Now im trying to add normals, and I think its not working well :

Terrain in wireframe

As you can see I dont think my normals are good.

This is how I get them :

for(x = 0; x < this.m_size.width - 1 ; x++)
    {
        for(y = 0; y < this.m_size.height - 1 ; y++)
        {
            immutable uint indice1 = y * this.m_size.width + x;
            immutable uint indice2 = y * this.m_size.width + (x + 1);
            immutable uint indice3 = (y + 1) * this.m_size.width + x;
            immutable uint indice4 = (y + 1) * this.m_size.width + x;
            immutable uint indice5 = y * this.m_size.width + (x + 1);
            immutable uint indice6 = (y + 1) * this.m_size.width + (x + 1);

            Vector3 v1 = vertexes[indice3] - vertexes[indice1];
            Vector3 v2 = vertexes[indice2] - vertexes[indice1];
            Vector3 normal = v1.cross(v2);
            normal.normalize();

            normals[indice1] = normal;

            indices ~= [indice1,
                        indice2,
                        indice3,
                        indice4,
                        indice5,
                        indice6];
        }
    }

I use this basic shader : http://ogldev.atspace.co.uk/www/tutorial18/tutorial18.html   or in the link I posted at the top.

Thanks.

sentences: Difference between Material and Shader In games, materials often only influence the visual appearance of objects. The visual appearance is effected by shaders. So regarding to terminology is there a difference between materials and shaders? Should you write one shader for one material?

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:
XNA - Static classes from game libraries executing after content pipeline extensions, how to avoid the problem? Alright, formulated this way I'm sure it sounds obscure, but I'll do my best to describe my problem.

First, let me explain what's wrong with my real source code.

I'm making a platformer, and here are the current components of my game: a Level, which is holding its own grid of tiles and also the tile sheets and a Tile, which just keeps the name of its tile sheet and index within the tile sheet. All these are within a separate XNA game project, named GameLib.

Here is how my levels are formatted in a text file:

x x . . . . .

. . . b g r .

. . . . . . .

X X X X X X X

Where . represents an empty tile, b represents a blue platform, X represents a block with a random color, etc.

Instead of doing all the work of loading a level within the Level class, I decided to take advantage of the content pipeline extension and create a LevelContentPipelineExtension.

As soon as I started, I quickly realized that I didn't want to hard-code 20+ lines of the kind:

if (symbol == 'b')
    return new Tile(/*...*/);

So, in the hope of at least centralizing all the content creation into one class, I made a static class, called LevelContentCreation, which holds the information about which symbol creates what and all this kind of stuff. It also holds a list of all the asset paths of the tile sheets, to load them later on. This class is within my GameLib game library project.

The problem is, I'm using this LevelContentCreation static class in both my Level class (to load the actual tile sheets) and my content pipeline extension (to know which symbol represents what tile)...

And here's how my LevelContentCreation class looks like:

public static class LevelContentCreation
{
    private static Dictionary<char, TileCreationInfo> AvailableTiles =
        CreateAvailableTiles();

    private static List<string> AvailableTileSheets { get; set; }

    /* ... rest of the class */
}

Now, since the LevelContentCreation class is part of the game library, the content pipeline extension tries to use it but the call to CreateAvailableTiles() never happens and I'm unable to load a Level object from the content pipeline.

I know this is because the content pipeline executes before the actual compilation or something like that, but how can I fix the problem?

I can't really move the LevelContentCreation class to the pipeline extension, because then the Level class wouldn't be able to use it... I'm pretty lost and I don't know what to do... I know these are pretty bad design decisions, and I'd like it if somebody could point me in the right direction.

Thank you for your precious time.

If anything is not clear enough or if I should provide more information/code, please leave a comment below.

A little more information about my projects:

Game - XNA Windows game project. Contains references to: Engine, GameLib and GameContent
GameLib - XNA game library project. Contains references to: Engine
GameContent - XNA content project. Contains references to: LevelContentPipelineExtension
Engine - XNA game library project. No references.
LevelContentPipelineExtension - XNA content pipeline extension. Contains references to: Engine and GameLib

I know close to nothing about XNA 4.0 and I'm a little bit lost about how content works now. If you need more information, tell me.

sentences:
Procedual level generation for a platformer game (tilebased) using player physics I have been searching for information about how to build a 2d world generator (tilebased) for a platformer game I am developing. The levels should look like dungeons with a ceiling and a floor and they will have a high probability of being just made of horizontal rooms but sometimes they can have exits to a top/down room.

Here is an example of what I would like to achieve. I'm referring only to the caves part. I know level design won't be that great when generated but I think it is possible to have something good enough for people to enjoy the procedural maps (Note: Super Metroid Spoiler!):

http://www.snesmaps.com/maps/SuperMetroid/SuperMetroidMapNorfair.html

An idea I had to accomplish this was to let the computer play a level and carve the dungeon as the "computer player" plays. But don't know how to handle branches in the way, etc... Using this way of carving I could be confident that at least an exit exists in the map and that it is reachable.

Another idea I had was using a cellular automata with some heuristics to do the carving. A problem arises here: how could I make sure that all zones carved are reachable by the player (that is limited by gravity, etc...) ?. I guess I could use some kind of graph that could follow the different dungeon floors the automata is carving and then somehow I could measure  if some part would be reachable or not by the player and add platforms or new terrain to make it reachable.

sentences:
In Unity - displaying long lists of information to screen? Tables? Hello folks I'm making a little game for fun in unity, Its a boxing management sim. I've got the code done to create boxers and give them many properties such as names, weights, stats, etc.
I've made another screen , lets call it 'office screen' for now. In that I want to open a panel which will show all the boxers in the game (ideally I'd like to be able to make the player be able to filter these results by which company he's signed to etc - but I think that might be out of my skill range so maybe i will just make a separate screen for Owned Boxers)

But I cannot seem to find a way to display all these infos in a table with columns such as Name ; Age ; Company ; etc;

I have had a go just using the UI Text components and panels. But thing is, there will be approx 100 boxers or more and this number will always change also.

Any ideas for this in Unity specifically?

EDIT: I am storing all the data just as variables (i think fields) in a class called Boxer which is assigned as a component of a new GameObject i instantiate at the time each boxer is created. So each boxer has its own gameobject.

EDIT 2 :D i've found this: https://docs.microsoft.com/en-us/aspnet/mvc/overview/older-versions-1/models-data/displaying-a-table-of-database-data-cs
would this be the sort of thing I can add to Unity (assuming I can follow along with the guide)?

Thanks for any help

sentences:
Projecting a moon texture to the background I want to display a 2d moon image to the background. I have a normalized direction for the center location of my moon texture. I also have the normalized view direction from the camera for each pixel. I'm working in HLSL and I need to find the uv for the texture. How can I do this without the texture being distorted. I tried a variety of spherical uv mapping equations but none of them worked.
This post works but only if d is (0,0,1) in a right handed Y up coordinate system:
How can I calculate the U,V texture coordinates on a disk at infinity given only a view vector and a vector pointing to the disk's center?
It seems like you have to rotate the up righting right vectors with moon's location but how?

sentences:
In AGK2 Basic, how would I attach a camera to the player charater? I've started making a game in AppGameKit and I'm using Tier 1/AGK2 Basic. I'm trying to make a sort of endless runner. I've made it so that the player stays still and the rest of the world moves around them to create the illusion that the player is what is running forward. I then use a global variable to control all movement relative to the player.

There must be a better way to do this, though. Like if I were to attach a camera to my player character. How would I do something like that?

sentences:
client-side array in the OpenGL 3.3. core It is possible the topic (not using VBO)?

in the OpenGL 3.0 compatible profile I can to draw this way:

GLint position_index = attrib_location_get("VertexPosition");
gl::EnableVertexAttribArray(position_index);
gl::VertexAttribPointer(position_index, 3, gl::FLOAT, false, 0, pos_Data);
gl::DrawArrays(gl::TRIANGLES, 0, count_of_vertices);

Bat in the OpenGL 3.3 core profile it displays a blank screen. It is right?

sentences:
Creating a glitch effect similar to Watch Dogs I'm currently working on a LibGDX game. When a user does something wrong, I would like all the graphics on the screen to jitter very similar to the glitch/distort effect seen in the game Watch Dogs (See Below).

My question is this: can this effect be achieved in real time by writing a shader? If so are there any references online on how to do this? (I've had a quick Google but all I could find is how to achieve this effect in Photoshop/After Effects).

Thank you for your help.

Screen jitter: https://www.youtube.com/watch?v=EYkqC9uI8Nc

Text glitch effect: https://www.youtube.com/watch?v=Wj26Wp2AH-U

sentences:
Unity Texture2D raw data TextureFormat problem I am trying to load raw image data into a Texture2D in Unity using LoadRawTextureData but I can't get it to work correctly.

First I receive an array of bytes from an unmanaged function that captures a window. I am pretty sure these bytes represent an image in BGRA32 format.

int dataSize = width * height * 4;
byte[] imgData = new byte[dataSize];
bool success = CaptureWindow(windowInfo, imgData, (uint)(dataSize));

Then I try to create a new Texture2D with this data

Texture2D tex = new Texture2D(width, height, TextureFormat.BGRA32, false, true);
tex.LoadRawTextureData(imgData);
tex.Apply();

And finally I create a new plane and assign this texture to its material.

GameObject plane = GameObject.CreatePrimitive(PrimitiveType.Plane);
plane.GetComponent<MeshRenderer>().material.mainTexture = tex;

This doesn't work (Notice how the color channels are mixed up):

However, when I reverse the byte array before loading it into the texture as ARGB32, it does work:

Texture2D tex = new Texture2D(width, height, TextureFormat.ARGB32, false, true);
Array.Reverse(imgData);
tex.LoadRawTextureData(imgData);
tex.Apply();

The problem with this solution is that Array.Reverse is too slow.

Why doesn't loading it as BGRA32 work? Isn't BGRA32 just the reverse of ARGB32?

FYI: I am using Unity 5.1.2f1 on Windows and SystemInfo.SupportsTextureFormat returns true for both BGRA32 and ARGB32.

sentences:
Math: determining a proper procedural vector for sine-movement My Problem
Suppose you have an object moving along the x-axis, wobbling up and down. Movement code might look like this:
x += 1;
y = Sin(x);
Move((x,y) * speed);

When I try to figure out a method to move my object along a sine wave, say diagonally, I run into trouble. I am not sure what kind of Vector math I use to calculate the appropriate Sine movement along a diagonal where both X and Y values must be altered.
The visual result would be the object bobbing up and down and sideways but still moving in its given direction.
How do I enable sine movement along a diagonal?

sentences:
Only render/calculate the chunks in frustum! I have a 2D world in form of a Block[][]-Array that holds all the blocks of the world. Every block has it's own Box2D Body (I want a "minecraft"-like 2D world for this project). Naturally I don't want to calculate all the box2D-bodies at the same time and I don't want to render what's not on screen neither (SpriteBatch).

So I divided my huge world into "Chunks". They are all of the same width and height. Now I'm a bit stunned though.

Each chunk starts at (0,0) which is the lower left corner of the chunk. Now in my player-class I do the following (if the player has moved)

public void calculateChunksToRender()
{
    for(int x = (int) this.getPosition().x - Chunk.chunkWidth * 2 - (Chunk.chunkWidth / 4); x >= 0 && x <= game.getMap().getWidth() - Chunk.chunkWidth && x<= (int) this.getPosition().x + Chunk.chunkWidth; x++)
    {
        if(x % Chunk.chunkWidth == 0)
        {
            Vector2 chunkPosition = new Vector2(x, 128);
            System.out.println(chunkPosition);
            chunksToRender.put(chunkPosition, game.getChunkMap().get(chunkPosition));
        }
    }

As the start point of the x-coordinate in the chunk is on the left side, I go 1 3/4 chunks to left and render it, if still visible. Why 1 3/4? Because that way when I'm 3/4 to the right I don't see the left chunk anymore, so I don't need to render it. For the right chunk I do the same, but only with Chunkwidth... I guess it's pretty self-explanatory though.

Obviously this is just the X-dimension and I'm not sure if there isn't a far better way to do this.
Why? Because, well, right now I have 3 chunks to render, but basically I have a 8-neighbourhood around the one chunk the player is currently on/in. I fear that I will have to render/calculate (the physics for) far too many bodies the way I'm doing it right now. Currently I have 12k bodies in memory at any given time and around 45-60fps. But that's just 3 chunks!

Each block has its sprite attached to it through the box2D body (userData), maybe I should separate them and separate rendering/physics calculation as well? Not sure though, because if a player jumps to another chunk I want him to collide with the blocks there immediately not after a delay (so he is stuck in the middle).

I also tried to calculate the nearest chunk (just go left on the x-axis and down on the y-axis until you find a chunk) and calculate the surrounding ones, but that's much more of a performance hit (logically)

Any ideas/optimizations?

Kindest regards,
Ohuro

sentences:
Texture R8_FLOAT format? I'm working on SAO (http://graphics.cs.williams.edu/papers/SAOHPG12/) and I want to store my ambient obscurance term (a value between 0.0 and 1.0) in a texture.

When I did shadowmapping, I created my depth-texture as DXGI_FORMAT_R32_TYPELESS and the shader resoure view as DXGI_FORMAT_R32_FLOAT, however with this I want a DXGI_FORMAT_R8_TYPELESS format and a FLOAT equivalent, yet there appears to be none according to the docs (http://msdn.microsoft.com/en-us/library/windows/desktop/bb173059(v=vs.85).aspx)

1) What texture/srv/rtv format should I use if I want to store/read/write 8-bit float values?

2) Does the format used really matter? Does directx do any behind-the-scenes alterations to the texture data? Is a DXGI_FORMAT_R8_UNORM treated differently from a DXGI_FORMAT_R8_SNORM for example?

sentences:
Canvas not scaling to screen size So I have a very simple scene set up with just a camera, a game object called TestGrid with a grid script, and then a canvas. I have a TextMeshPro prefab that I instantiate to fill the 10 x 20 grid with cells.
If I build and run the game, I see all the cells on my screen. However, in the editor play view, I can only see as many grid cell as would fit on startup. Making the game view smaller or larger will scale the ones already there, but everything that didn't fit initially is "clipped" out. The "canvas" is in the bottom left corner of the "grid"

I'll share my code as well:
using System;
using System.Collections;
using System.Collections.Generic;
using TMPro;
using UnityEngine;
using UnityEngine.Diagnostics;

public class TestGrid : MonoBehaviour {
  private float _cellSize = 50.0f;

  [SerializeField]
  private float _width = 0.0f;

  [SerializeField]
  private float _height = 0.0f;

  [SerializeField] private TextMeshProUGUI labelPrefab;

  // Start is called before the first frame update
  private void Start() {
    if (labelPrefab == null) {
      Debug.LogError("You must set a label prefab.");
      return;
    }

    GameObject canvas = GameObject.Find("labelCanvas");
    if (canvas == null) {
      Debug.Log("Unable to find canvas");
      return;
    }

    // This is just a 2D array of ints.
    Grid grid = new Grid((int)_width, (int)_height);
    var canvasRect = canvas.GetComponent<RectTransform>().rect;
    _cellSize = Math.Min((canvasRect.width / _width), (canvasRect.height / _height));

    for (int x = 0; x < grid.Data.GetLength(0); ++x) {
      for (int y = 0; y < grid.Data.GetLength(1); ++y) {
        SpawnLabel(new Vector3(x, y, 0), canvas, grid.Data[x, y].ToString());

        // TODO: Replace this with LineRenderer
        Debug.DrawLine(GetWorldPosition(new Vector3(x, y)), GetWorldPosition(new Vector3(x, y + 1)), Color.white, 100f);
        Debug.DrawLine(GetWorldPosition(new Vector3(x, y)), GetWorldPosition(new Vector3(x + 1, y)), Color.white, 100f);
      }
      Debug.DrawLine(GetWorldPosition(new Vector3(0f, _height)), GetWorldPosition(new Vector3(_width, _height)), Color.white, 100f);
      Debug.DrawLine(GetWorldPosition(new Vector3(_width, 0f)), GetWorldPosition(new Vector3(_width, _height)), Color.white, 100f);
    }
  }

  void Update() {
    // NYI
  }

  private void SpawnLabel(Vector3 localPos, GameObject canvas, string text) {
    float x = localPos.x;
    float y = localPos.y;
    var world = GetWorldPosition(new Vector3(x, y, 0)) + new Vector3(_cellSize, _cellSize) * .5f;
    var label = Instantiate(labelPrefab,
      world,
      Quaternion.identity, canvas.transform);
    label.text = text;
    label.fontSize = 100;
    label.autoSizeTextContainer = true;
  }

  private Vector3 GetWorldPosition(Vector3 local) {
    return local * _cellSize;
  }

}

Additional images of environment:

I'm actually not too sure what is going on here, so here is everything I know:

I'm parenting my TextMeshPro prefab transform to the canvas transform, so that it scales properly
My Canvas Scalar is set to reference resolution of 2560 x 1440, with a RPPU of 108
Canvas Scalar is also set to Scale With Screen Size
Canvas Screen Space is set to Overlay

I've also read the following links with no luck:
https://stackoverflow.com/questions/32347009/unity-canvas-does-not-fill-screen
https://answers.unity.com/questions/943190/ui-panel-not-covering-whole-screen.html
https://answers.unity.com/questions/1331722/ui-scaling-issues.html
Expected Results:
No matter what the screen size is, I should see my full 10 x 20 grid of "cells" (in play view they're just 0's).
Question:
If my canvas is supposed to scale with screen size, why is it that when I choose a cell size calculated from the canvas size, that it thinks the canvas is 2560 x 1440 when the screen size is clearly much smaller than that?
Do I need to calculate with a different value? Must I dynamically resize everything I draw within the canvas? What's going on here?

sentences:
Keeping the meshes "thickness" the same when scaling an object I've been bashing my head for the past couple of weeks trying to find a way to help me accomplish, on first look very easy task. So, I got this one object currently made out of 5 cuboids (2 sides, 1 top, 1 bottom, 1 back), this is just for an example, later on there will be whole range of different set ups. Now, the thing is when the user chooses to scale the whole object this is what should happen:

X scale: top and bottom cuboids should get scaled by a scale factor, sides should get moved so they are positioned just like they were before(in this case at both ends of top and bottom cuboids), back should get scaled so it fits like before(if I simply scale it by a scale factor it will leave gaps  on each side).

Y scale: sides should get scaled by a scale factor, top and bottom cuboid should get moved, and back should also get scaled.

Z scale: sides, top and bottom cuboids should get scaled, back should get moved.

Hope you can help,

EDIT
I am asking you, if any of you have any idea on how to accomplish this scaling.

I have tried whole bunch of things, from scaling all of the object by the same scale factor, to subtracting and adding sizes to get the right size. But nothing I tried worked, if one mesh got scaled correctly then others didn't.

Donwload the example object.

sentences:
Lamba expressions: The => Operator. Any plain English help to understand this please? I've been adding Google Play support into my game. For the most part I'm getting on swimmingly, but I'm having a hell of a time understanding exactly how the submission calls to submit score and achievements work.

It's the => operator and surrounding method that confuse me, such as this one that I have in my code. It all works, I just don't know how. I've read up a bit and I think these are called Lambda expressions.

But I want to know why it is this way, and why it isn't made so we can just use the standard typical bool instead of making this strange way to send the result of whether or not our player is logged in.

Hope that makes sense. Here's the code in question:

Social.localUser.Authenticate((bool success) => {
        if (success)
            {
                Debug.Log("score authenticed successfully");
            }
            else
            {
                Debug.Log("score not authenticed, check user is signed in");
            }
     });
    Social.ReportScore(score, GPGSIds.leaderboard_pinball_wizards, (bool success) => {});

Particularly, the bottom line really has me stuck.

sentences:
Compressing language for Game use to save Packets Given ASCII is 8 bits (1 byte), UNICODE is 32 bits (4 bytes).

An idea came to my mind to support multiple language by isolating certain UNICODE Letters to support multiple language for my chat(game) program.

It will be composed of [4 bit (Language trigger)] + [8 bits (255 possible characters) x 16]

Example:

trig|message per character, each 8 bit is character depending on trigger, language changes
0001|00000000|00000000|00000000|00000000|00000000....

Trigger for characters: (example purpose only)

0001 Normal Latin
0010 European Latin
0011 Historic Latin
0100 Japanese
0101 Chinese
etc...

The characters at UNICODE not present at my list will make a special character... I'm thinking a Box (which will be present at the 0001 character list).

My in-built character table will supply the character depending on the trigger. Of course the User can only use one set of trigger and not mixed character using different triggers.

I also want to use this character for my Account Server Creation and Queries. Note that other character format do not support multi-language characters.

Result Comparison: Instead of sending 512 bits (32 bit x 16). I am actual sending 132 bits (4 bit + (8x16)) only.

Is this feasible and currently in use or am I doomed to use UNICODE? I am open for better ideas than the ones above.

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:
Why am I getting white lines in my tiled map when my character moves? I followed the tutorial here -

http://mainroach.blogspot.com/2013/02/fast-html5-canvas-rendering-tiled-maps.html

I can't really figure out why it's happening. At certain times the map looks fine and then when I move my character the map starts to look like this -

sentences:
How to transition a coin to the middle of the screen then up when collecting it? I have a coin sprite that animates spinning in place, like this.
When the player picks up the coin, I want to make a transition while keeping the animation. First moving towards middle, then much faster all the way up until it leaves the screen like this:

My question: Is this done mostly via adjusting the Transform component component via scripting? Or are games implementing something like this in a different way?

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:
Unity solution not compatible with Visual Studio Since updating to the most recent version of Unity 5.4.0f3 Personal Edition, whenever I double click on a script, it launches Visual Studio, but I get an error saying that this version of Visual Studio (Community Studio 2015) is unable to open my project. Please see the screenshots attached for the actual error message. Monodevelop also launches with it's own error message.

I am still able to open the individual script manually using the menu in VS but it's a little frustrating that it doesn't open automatically, and more annoying is that the intellisense/code completion features no longer work. Anyone know how to fix this? I have Visual Studio Tools for Unity installed and have tried running the installer to repair this tool also.

sentences:
Implementing "Fix Your Time Step" So far I have this implementation of "FYTS".

However I am facing several problems.

    final int TICKS_PER_S = 60;
    double accumulator = 0.0;
    //The timestep
    final double dt = 1/(double)TICKS_PER_S;
    long previousTime = System.currentTimeMillis();

    //State previous;
    //State current;
    while(running){

        long currentTime = System.currentTimeMillis();
        double frameTime = (currentTime - previousTime)/1000;

        if(frameTime > 0.25){
            frameTime = 0.25;
        }
        previousTime = currentTime;
        accumulator += frameTime;

        while(accumulator >= dt){

            //previousState = currentState;
            this.gamePanel.update(dt);
            accumulator -= dt;
        }

        //Interpolation
        // final double alpha = currentState * alpha +
        //               previousState * (1.0 - alpha);

        //This is the draw call. Not yet using interpolation
        this.gamePanel.postInvalidate();
    }

Problem 1:

frameTime is always 0 meaning that the game is never updating. It seems obvious: In the beginning it is 0, but that should change, shouldn't it?

Problem 2:

Let's assume that Problem 1 wouldn't exist. I understand that you take an arbitrary frameTime and split it up into discrete timesteps and then update the game. But what's the point of updating in a separate nested loop anyways? Most of the time you are left with a little remainder at the end of finishing the inner update loop. That remainder is how much of the simulation is left to complete until the running loop starts again and takes a new frameTime on which a part of the simulation has to be performed on. But what does the interpolation do that's worth to even consider doing it Isn't the inner update loop just a waste of time?

Problem 3:

The outer loop is running without any limitations at max speed. Isn't that just wasting clock cycles (and draining the battery life on mobile devices)? Is there anything I could do to counteract that?

sentences:
How to implment the database for event conditions and item bonuses for a browser based game? I am currently creating a browser based game, and was wondering what was the standard approach in making diverse conditions and status bonuses database wise. Currently considering two cases.

Event Conditions

Needs min 1000 gold
Needs min Lv 10
Needs certain item.
Needs fulfillment of another event

Status Bonus

Reduces damage by 20%
+100 attack points
Deflects certain type of attack

I wish to be able to continually change these parameters during the process of production and operation, so having them hard-coded isn't the best way.

All I could come up with are the following two methods:

Create a table that contains each conditions with needed attributes

Have a model named conditions with all the attributes it would need to set them:

conditions
  condition_type (level, money_min, money_max item, event_aquired)
  condition_amount
  prerequisite_condition_id
  prerequisite_item_id

Write it in a DSL form that could be interpreted later in the code

Perhaps something like yaml, have a text area in the setting form and have the code interpret it.

condition_foo:
  condition_type :level
    min_level: 10
  condition_type :item
    item_id: 2

Method 2 looks to be more practical and flexible for future changes, trade off being that all the flex must be done on the code side.

Not to sure how this is supposed to be done, is it supposed to be hard coded? separate config file? Any help would be appreciated.

This will be implemented with Ruby on Rails.

sentences:
(2D) Take player speed into account while shooting bullets In my top down 2D game, there is a plane as shown below:

The plane shoots bullets forward. For firing bullets, I use:

obj.GetComponent<Rigidbody2D>().AddForce(transform.up*500);

However, when player presses up arrow or A key, plane speed increases. At this point, bullets are slower than the plane and appear to move backwards when plane moves at maximum speed.

How do I take into account player speed so that force applied takes into account player speed?

sentences:
Opengl Quad Tessellation Control Shader I have the generic tessellation evaluation shader for triangles but I need to make it work for quads.  Is there any chance someone could explain what is happening here and point me in the right direction?

layout(triangles, equal_spacing, cw) in;
in vec3 tcPosition[];
out vec3 tePosition;
out vec3 tePatchDistance;
uniform mat4 Projection;
uniform mat4 Modelview;

void main()
{
    vec3 p0 = gl_TessCoord.x * tcPosition[0];
    vec3 p1 = gl_TessCoord.y * tcPosition[1];
    vec3 p2 = gl_TessCoord.z * tcPosition[2];
    tePatchDistance = gl_TessCoord;
    tePosition = normalize(p0 + p1 + p2);
    gl_Position = Projection * Modelview * vec4(tePosition, 1);
}

I understand that they're multiplying the control points (the original patch vertices) by the components of the new vertex (I guess relative to the patch verts?) and then normalizing the sum of these vectors to get the actual position of the new vertex which conforms to a nice unit sphere when applied to a cube of patches.  I want to extend this to work on quads: layout(quads, ...) in and add the tcPosition[3] vector but I don't really know how to get the same behavior with the fourth vertex.

sentences:
Set texture of a LHSprite that is loaded from LevelHelper How do i set the image/texture of an LHSprite that is loaded into xCode using levelHelper & spriteHelper?

I am using sprite sheets. So i tried to load the image the old fashioned way using CCSpriteFrameCache, but unfortunately it isnt recognizing the .pshs file :( Any Help would be great!

sentences:
Stop 2D platformer character from sliding down slope I'm making a 2D platformer game with the default Unity 2D physics. I am implementing slopes, but my player slips down the slope because of the physics.

Here is the code I use for the player movement:
MoveInput = Input.GetAxisRaw("Horizontal");
rbd2.velocity = new Vector2(MoveInput * speed, rbd2.velocity.y);
//rotacion de personaje
if (MoveInput > 0)
{
    transform.localScale = new Vector3(1f, transform.localScale.y, transform.localScale.z);

}
if (MoveInput < 0)
{
    transform.localScale = new Vector3(-1f, transform.localScale.y, transform.localScale.z);

}

sentences:
How can I make the "Strength" attribute more attractive to Wizard/Caster classes in a RPG game? I have a game where, among many attributes, is Strength and Constitution.
In Ultima Online, Strength was used for hit points. However, I would like to avoid this- as Hit Points are so incredibly important, every class will want to have a lot of them in any game you play. In almost all MMORPG's and in many RPG's, players stack constitution almost as much as their primary attribute.

I have a plethora of ways in which INTELLIGENCE helps a WARRIOR type. It is the problem of the attribute STRENGTH helping a WIZARD type that is giving me so much difficulty.

Strength can more easily be an important statistic for Warrior and Rogue types, as they are both melee damage- and players tend to love stacking high damage. However, Strength is all but useless to a Wizard who casts spells from afar, and relies on Intelligence as their damage attribute.

What can I do to strength, to make it more appealing to wizard types, or any class that does not perform any melee combat?

Correct me if I am wrong, but I do not feel as though Spells/Magic should be more powerful because someone has more physical muscles and capacity to lift more. It makes sense to give Magic more power if the caster had a lot of fortitude or a overall healthy body, but that is already defined as Constitution.

I want to make Strength as attractive as Intelligence, to Wizard types than in stereotypical RPG's.

I was able to find balance between a "Dumb Brute Warrior" vs "Intelligent Warrior".
How can I find a balance between a "Buff Conan Wizard" vs "Intelligent but Frail Wizard" without introducing melee combat?

Adding unique gameplay features or altering the traditional RPG style of play is more than welcome.

sentences: Simple way to shoot bullets from a ship at angles for shoot em up Just like the title says. I'm working on a shoot em up for a personal project, and I can't seem to get this to work. I don't have any code for it, but I do have the code to make my ship shoot, but that's pretty straight forward mumbo jumbo. I have seen people use the Math function for this, but any help would be appreciated.

sentences:
Issues with OpenGL rotation matricies and shaders I am having an issue with my rotations in my opengl shaders. My program works fine before I add in my rotation matrices. Here is an example, at YouTube. After I add rotations to my shaders, there are issues. Here is an example.

Here is my vertex shader:

    #version 130

in vec3 position;
in vec4 color;
in vec2 texcoord;
uniform mat4 view_array;
uniform mat4 end_array;
uniform mat4 projection_matrix;
uniform mat4 trans_matrix;
uniform mat4 x_rotation_matrix;
uniform mat4 y_rotation_matrix;
uniform mat4 z_rotation_matrix;

out vec4 pos;
out vec2 texture_coordinate;
//out vec4 color_value;
void main()
{
     mat4 vw_matrix = mat4(1.0);
     mat4 rotation_matrix = x_rotation_matrix * y_rotation_matrix;
     mat4 model_matrix =  trans_matrix * rotation_matrix;//
     pos = projection_matrix * vw_matrix * model_matrix *  vec4(position, 1.0);
     gl_Position = pos;
     texture_coordinate = texcoord;
     //color_value = color
}

Here are the values for my matrices:

// rotation matrices

x_rotation_matrix[0] = 1;
x_rotation_matrix[1] = 0;
x_rotation_matrix[2] = 0;
x_rotation_matrix[3] = 0;
x_rotation_matrix[4] = (float) cos(-yaw * (PI / 180));
x_rotation_matrix[5] = (float) -sin(-yaw * (PI / 180));
x_rotation_matrix[6] = 0;
x_rotation_matrix[7] = (float) sin(-yaw * (PI / 180));
x_rotation_matrix[8] = (float) cos(-yaw * (PI / 180));
x_rotation_matrix[9] = 0;
x_rotation_matrix[10] = 1;
x_rotation_matrix[11] = 0;
x_rotation_matrix[12] = 0;
x_rotation_matrix[13] = 0;
x_rotation_matrix[14] = 0;
x_rotation_matrix[15] = 1;

y_rotation_matrix[0] = (float) cos(-pitch * (PI / 180));
y_rotation_matrix[1] = 0;
y_rotation_matrix[2] = (float) sin(-pitch * (PI / 180));
y_rotation_matrix[3] = 0;
y_rotation_matrix[4] = 0;
y_rotation_matrix[5] = 1;
y_rotation_matrix[6] = (float) -sin(-pitch * (PI / 180));
y_rotation_matrix[7] = 0;
y_rotation_matrix[8] = (float) cos(-pitch * (PI / 180));
y_rotation_matrix[9] = 0;
y_rotation_matrix[10] = 1;
y_rotation_matrix[11] = 0;
y_rotation_matrix[12] = 0;
y_rotation_matrix[13] = 0;
y_rotation_matrix[14] = 0;
y_rotation_matrix[15] = 1;

z_rotation_matrix[0] = (float) cos(-pitch * (PI / 180));
z_rotation_matrix[1] = (float) -sin(-pitch * (PI / 180));
z_rotation_matrix[2] = 0;
z_rotation_matrix[3] = (float) sin(-pitch * (PI / 180));
z_rotation_matrix[4] = (float) cos(-pitch * (PI / 180));
z_rotation_matrix[5] = 1;
z_rotation_matrix[6] = 0;
z_rotation_matrix[7] = 0;
z_rotation_matrix[8] = 0;
z_rotation_matrix[9] = 0;
z_rotation_matrix[10] = 1;
z_rotation_matrix[11] = 0;
z_rotation_matrix[12] = 0;
z_rotation_matrix[13] = 0;
z_rotation_matrix[14] = 0;
z_rotation_matrix[15] = 1;

GL20.glUniformMatrix4fv(
    GL20.glGetUniformLocation(programID, "x_rotation_matrix"), true, x_rotation_matrix);
GL20.glUniformMatrix4fv(
    GL20.glGetUniformLocation(programID, "y_rotation_matrix"), true, y_rotation_matrix);
GL20.glUniformMatrix4fv(
    GL20.glGetUniformLocation(programID, "z_rotation_matrix"), true, z_rotation_matrix);

Here is my transformation matrix:

trans_matrix[0] = 1;
trans_matrix[5] = 1;
trans_matrix[10] = 1;
trans_matrix[12] = x;
trans_matrix[13] = y;
trans_matrix[14] = z;
trans_matrix[15] = 1;

What am I doing wrong?

sentences:
Mask not applying to gameobjects in UI layer I have a bunch of item slots in my scroll view.

The item slots contain 3d objects, but they are all set to use the UI layer.

My problem is that they are not being masked the same as the 2D elements are.

See this example:

Notice how the 3D items in the scroll view are overflowing, but the 3D item slot panels are not.

Like I said, I put everything in the UI layer. I'm not sure how to fix this. Is there a simple fix for this?

sentences:
Scaling Model in XNA, keep position I am trying to create a little fun 3D game in XNA, but I am having some problems with scaling my models. I use models from random sites, so my battleship is for an example 10 times larger than my planet.

I thought I had found out how to scale my model, but it does not show up when I do, or the coordinates get really messed up. Is there a way to scale my models but still keep the same position system?

Here is my model base class.

public class BaseModel
{
    protected Matrix world = Matrix.Identity;
    protected Matrix RotationMatrix = Matrix.Identity;
    protected Model model;
    protected float scale = 1.0f;
    protected Vector3 direction;

    public Vector3 Position
    {
        get
        {
            return world.Translation;
        }
        set
        {
            world = Matrix.CreateTranslation(value);
        }
    }

    public BaseModel(Model model, Vector3 position, float scale = 1)
        : this(model, position, Vector3.Zero, Matrix.Identity, scale)
    {
    }
    public BaseModel(Model model, Vector3 position, Vector3 direction, float scale = 1)
        : this(model, position, direction, Matrix.Identity, scale)
    {
    }
    public BaseModel(Model model, Vector3 position, Vector3 direction, Matrix rotationMatrix, float scale = 1)
    {
        this.model = model;
        this.Position = position;
        this.direction = direction;
        this.RotationMatrix = rotationMatrix;
        this.scale = scale;
    }

    public virtual void Update(GameTime gameTime)
    {
        world *= Matrix.CreateTranslation(direction);
    }

    public virtual void Draw(GameTime gameTime, Camera camera)
    {
        Matrix[] modelTransforms = new Matrix[model.Bones.Count];
        model.CopyAbsoluteBoneTransformsTo(modelTransforms);
        Matrix wworld = GetWorld();

        foreach (ModelMesh mesh in model.Meshes)
        {
            foreach (BasicEffect effect in mesh.Effects)
            {
                effect.EnableDefaultLighting();
                effect.World = modelTransforms[mesh.ParentBone.Index] * wworld;
                effect.View = camera.view;
                effect.Projection = camera.projection;
            }
            mesh.Draw();
        }
    }

    public virtual Matrix GetWorld()
    {
        return RotationMatrix * world * Matrix.CreateScale(scale);
    }

    public virtual Model GetModel()
    {
        return model;
    }

    public virtual bool CollidesWith(Model otherModel, Matrix otherWorld)
    {
        // Loop through each ModelMesh in both objects and compare
        // all bounding spheres for collisions
        foreach (ModelMesh myModelMeshes in model.Meshes)
        {
            foreach (ModelMesh hisModelMeshes in otherModel.Meshes)
            {
                if (myModelMeshes.BoundingSphere.Transform(
                    GetWorld()).Intersects(
                    hisModelMeshes.BoundingSphere.Transform(otherWorld)))
                    return true;
            }
        }
        return false;
    }
}

sentences:
Sound Effects on Monogame delay I have recently added some Sound Effects to my game, but the problem that I am dealing with now, is that they have for a half of second delay, or more sometimes.

Also, if I press repeatedly on that button, the sound effect does not play each time that I press on the button, and when I finish pressing, it plays at least once (I think from the previous presses).

How can I fix this problem?
Here is my Play function, if it will help with something ...

public void Play(SFX effect)
    {
        if(!Muted)
        {
            switch(effect)
            {
                case SFX.ButtonTap:
                    tapSfx_Instance.Play();
                    break;
                case SFX.Hit:
                    hitSfx_Instance.Play();
                    break;
                case SFX.Die:
                    dieSfx_Instance.Play();
                    break;
            }
        }
    }

Thanks.

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:
Should I use a world matrix? Image reference for the question:

(image from the CG tutorial)

The D3D9 API got us used to world matrices.

However, if you use world matrices, then you have to do an extra matrix multiply in the shader (which ends up being the same for a whole lot of vertices).

Hence the OpenGL convention of concatenating the modelling and viewing matrices into one matrix (the GL_MODELVIEWMATRIX = View*World).

What's better, and why?

sentences:
Object orientated design for RPG character creation This question may not be helpful to some but I'll ask anyway. I've hit a bit of a object orientated design issue. Making a RPG and the user gets to choose their own class i.e warrior/rogue/etc.

Sample:

int main()
{
    CharacterP *cPntr = new CharacterP // creates base pointer
    cPntr->createClass(cPntr, "Warrior"); // creates a new Warrior object which cPntr is now
                                           //pointing to.

    cPntr->printCharacterName();  //will print the warriors print name function

    return 0;
};

class CharacterP
{
    void createClass(CharacterP* &samp, string choice)
    {
        if (choice == "Warrior")
            samp = new Warrior;
         // other classes go here...... i.e Rogue, Mage
    }

    virtual void printCharacterName() //I don't want this function here
                                      //as this function will never be used, however it is
                                      //needed as the type of pointer for cPntr is CharacterP
                                      //which is the base of warrior.
    {
        std:: cout << "i don't want this function here, although it is required;
    }

};

class Warrior : public CharacterP
{
    virtual void printCharacterName()
    {
        std::cout << "you printed warrior";
    }
};

The main problem is the way I've designed this: If I want to use a Warrior function, I also have to define it into the base class CharacterP. When i start branching this out and adding more classes i.e Mage/rogue its going to be a maintenance nightmare as the base class would have a lot of functions that won't be used at all.

Questions:

Why does this happen?

Why does the base class also need to have the same function even though the derived function is virtual?

What is a more efficient way of doing what i am doing? (giving the user
the ability to create any classes they want i.e Warrior,Warrior,Mage/Rogue,Mage,Mage) maybe a way to create a warrior object with its own pointer which can be repeated so 3 warrior objects are created and can be used at runtime.

sentences:
Calculating the winding and normal when programatically adding triangles to a mesh I'm writing a program that takes a 2D planar polygon and extrudes it to a 3D mesh with a given height. I identify triangle edges that are borders of the polygon and now I'm trying to automatically compute the two triangles required for the extrusion of the border. However, I'm stuck at how to compute the correct winding and normals

My start situation is this: I have the two coordinates of the edge (marked in white) and the normal of the original triangle (marked in orange)

Using this information I'm trying to compute two triangles which should result in:

The 4 vertices are easy to compute (just the two vertices of the edge and two more at a different height). The normal should be perpendicular to the original normal but to do that I need a second reference point. It doesn't seem to be as simple as using the centroid of the triangle.

The triangle winding confuses me. I need a counter-clockwise winding and I guess I could determine which vertices to use based on the normal but how is not immediately apparent to me.

sentences: Is it better to load all of the scene at once or load small parts of it as the player moves? I want to create a lot of detail in my game but I don’t want to kill the frame rate tracking all the models and movements (like all the grass). Will loading them in pieces save the frame rate or will constantly loading and unloading models with every step negate any benefits of loading in pieces? I want to only load what the player will see at that moment and nothing else until the player either moves the camera or walks. I also want to know if loading a scene on Unity uses the gpu or the cpu?

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:
Making a DX9 game resolution independent How can I change the resolution and stretch my entire game to the new resolution? I want my game to have a base resolution, and when I change it to stretch to that new resolution. I saw a few similar questions but all the answers suggested that i should change the presentation parameters. If i do that, my screen resolution changes, but all my other objects remain the same size and draw in the wrong position.

I use a LPD3DXSPRITE object to draw the textures to the screen, some DirectX text, and vertices defined as this:

#define D3DFVF_VERTEX (D3DFVF_XYZRHW | D3DFVF_DIFFUSE)

I tried to put D3DXSPRITE_OBJECTSPACE at sprite->Begin() and play with the projection, view and world matrices but without success.

Can someone tell me if this method is possible and how should I do it? I also read about another method that suggested rendering to a surface, and then stretching the surface, but i don't know how to implement that. I am a beginner in DirectX. I googled the second method, but I couldn't find someone explaining it, and I don't think I can draw from a sprite to a surface.

sentences: How to move a Entity without moving its children in AndEngine? I have a Entity in AndEngine and when I move it, all child move together with it. Which is great. But, sometimes, I need to move it without moving its children. Is it even possible? And, if it is, how can I do so?

sentences:
Unity networking, make player disappear for all clients As title says I need to make the player disappear when he gets in car. Right now, it works as a single-player, but since I am new to unet I don't really know how to achieve this, I tried some ways, but they didn't work. Here is script:

 [Client]
 void OnControllerColliderHit(ControllerColliderHit hit)
 {
     //so if we hit car
     if(hit.collider.tag == "Vehicle")
     {
         //if we pressed "E"
         if (Input.GetKeyDown(KeyCode.E))
         {
             //call method to disable some stuff taht should be disabled, like: controller, shoot, weapons etc.
             if (isServer)
                 CmdCall(inVehicle, hit);
             else
                 RpcCall(inVehicle, hit);
         }
     }
 }
 [Command]
 void CmdCall(bool invehicle, ControllerColliderHit hit){

     RpcCall(inVehicle, hit);
     }
 [ClientRpc]
 void RpcCall(bool invehicle, ControllerColliderHit hit)
 {

     disable(inVehicle, hit);
 }

  I can't see any errors in console but I cant enter play mode cause there are some compiler errors, which again i cant see in console. thank you for any tip, comment, downvote, upvote, or hint :)

--Nick.

sentences:
Browser-based MMOs (WebGL, WebSocket) Do you think it is technically possible to write a fully-fledged 3D MMO client with Browser JavaScript - WebGL for graphics, and WebSocket for Networking?

Do you think future MMOs (and games generally) will be written with WebGL?
Does today's JavaScript performance allow this?
Let's say your development team was you as a developer, and another model creator (artist). Would you use a library like SceneJS for the game, or write straight WebGL? If you would use a library, but not SceneJS, please specify which.

UPDATE (September 2012): RuneScape, which is a very popular 3D browser-based MMORPG that used Java Applets so far has announced that it will use HTML5 for their client (source).

Java (left) and HTML5 (right)

UPDATE (June 2013): I have wrriten a prototype of a WebGL/WebSocket based MMO:
https://github.com/alongubkin/xylose

sentences:
Sound isn't playing in Game Maker Studio when interacting with an object I'm making a small game in Game Maker Studio.
I have a piece of code that moves the player to the next room when he touches obj_star: this works.
I have another line that tries to play sound_collect when the star is touched, but the game just moves to the next room without playing the sound.
This code is in the Step event

My code is as follows:

//Get the player's input
key_right = keyboard_check(vk_right);
key_left = -keyboard_check(vk_left);
key_jump = keyboard_check_pressed(vk_space);

//React to inputs
move = key_left + key_right;
hsp = move * movespeed;
if (vsp < 10) vsp += grav;

if (place_meeting(x,y+1,obj_wall))
{
vsp = key_jump * -jumpspeed
}
//Horizontal Collision
if (place_meeting(x+hsp,y,obj_wall))
{
while(!place_meeting(x+sign(hsp),y,obj_wall))
{
    x += sign(hsp);
}
hsp = 0;
}
x += hsp;

//Vertical Collision
if (place_meeting(x,y+vsp,obj_wall))
{
while(!place_meeting(x,y+sign(vsp),obj_wall))
{
    y += sign(vsp);
}
vsp = 0;
}
y += vsp;

//Sounds
if (place_meeting(x+hsp,y,obj_star))
{
sound_play(sound_collect)
};
//Next Level
if (place_meeting(x+hsp,y,obj_star))
{
room_goto_next()
};

sentences:
Portal View/Projection Matrix near plane For RenderToTexture/Camera based portal rendering, the basics seems simple enough.

However, with a free camera, most of the time it is going to be looking at such portals at an angle:

Now a regular near clipping plane will not always work here, it will either intersect with the wall the portal is sitting on, or possibly with objects in front of the wall.

The desired near clipping plane would be aligned like the portal, producing a view volume more like this:

or this in 3D:

So here is my question:

How does one construct or "truncate" a view/projection matrix to achieve such an off-camera-normal (near) clipping plane?

sentences:
Why can't this simple SDL app be closed without task manager or rapid clicking of x button? I wrote a simple app that generates a window, a raster, and redraws the raster once every 16ms. Right now the calculations are empty, it just draws a solid color. I don't know how, but I have created a very resource hungry app that cannot be easily closed. I generally have to close it via the task manager.

Here is my SDL "wrapper" class. Below this class is what will eventually calculate a ray caster. I initially thought my call to SDL_RenderDrawPoint for every pixel in the 600x600 window was causing the issue, but I still cannot close the window easily with that code commented out.

SDLWrapper.cpp

#include <iostream>
#include <SDL2/SDL.h>
#include <vector>
#include "include/SDLWrapper.h"

using namespace std;

#define TICK_INTERVAL 16

static int next_time;

SDLWrapper::SDLWrapper() {
}

int SDLWrapper::setupSDLRenderer(int WINDOW_WIDTH, vector<vector<RGB>> (*generateRaster)()){
    SDL_Event event;
    SDL_Renderer *renderer;
    SDL_Window *window;

SDL_Init(SDL_INIT_VIDEO);
SDL_CreateWindowAndRenderer(WINDOW_WIDTH, WINDOW_WIDTH, 0, &window, &renderer);
next_time = SDL_GetTicks() + TICK_INTERVAL;
while (1) {
    if (SDL_PollEvent(&event) && event.type == SDL_QUIT)
        break;

    SDL_RenderClear(renderer);

    rasterPixels = (*generateRaster)();
    for (int i = 0; i < rasterPixels.size(); ++i)
    {
        for (int j = 0; j < rasterPixels.at(i).size(); ++j)
        {
            SDL_SetRenderDrawColor(renderer,
            rasterPixels.at(i).at(j).R,
            rasterPixels.at(i).at(j).G,
            rasterPixels.at(i).at(j).B, 255);
            SDL_RenderDrawPoint(renderer, i, j);
        }
    }
    SDL_RenderPresent(renderer);

    SDL_Delay(time_left());
    next_time += TICK_INTERVAL;

}
SDL_DestroyRenderer(renderer);
SDL_DestroyWindow(window);
SDL_Quit();
return EXIT_SUCCESS;
}

RGB SDLWrapper::peek(int x, int y){
    return rasterPixels.at(x).at(y);
}

void SDLWrapper::poke(int x, int y, RGB color) {
   rasterPixels[x][y] = ((RGB){color.R, color.G, color.B});
}

int SDLWrapper::time_left(void)
{
Uint32 now;

now = SDL_GetTicks();
if(next_time <= now)
    return 0;
else
    return next_time - now;
}

RayCaster1.cpp

#include "include/SDLWrapper.h"
#include <iostream>
#include <vector>

#define WINDOW_WIDTH 600

#define mapWidth 24
#define mapHeight 24

vector<vector<RGB>> rasterPixels;

vector<vector<RGB>> generateRaster(){
      RGB greenPixel;
      greenPixel.R = 255;
      greenPixel.G = 255;
      greenPixel.B = 255;

      for(int i = 0; i < WINDOW_WIDTH; i++) {
          vector<RGB> column;

          for(int j = 0; j < WINDOW_WIDTH; j++){
              column.push_back(greenPixel);
          }

          rasterPixels.push_back(column);
      }

  return rasterPixels;
}

int main(int /*argc*/, char */*argv*/[])
{
    double posX = 22, posY = 12;  //x and y start position
    double dirX = -1, dirY = 0; //initial direction vector
    double planeX = 0, planeY = 0.66; //the 2d raycaster version of camera plane

    SDLWrapper sdlWrapper;
    sdlWrapper.setupSDLRenderer(WINDOW_WIDTH, generateRaster);
}

sentences:
Is it more efficient to encode rotation in a spritesheet or rotate at runtime? I'm developing a game with JavaScript and HTML5 and I'm wondering about the performance implications of sprite rotations. There are two ways that I know to rotate a sprite:

Rotate the actual sprite based on its rotational speed and velocity, as it travels along it's trajectory.
Pre-compute the rotations and store them as frames within the sprite sheet to give the illusion that it's spinning when it isn't.

On one hand, I can see how rotating some sprites in a spritesheet would be efficient because it's one image that is loaded, split into frames, and re-used.  But on the other hand, I'm not sure the calculations involved for rotating the sprite based on its velocity and rotational speed are really anything for current browsers (on computers and mobile devices) to worry about.

In my game, the canvas area is 800 x 600, and the game is using 32 x 32 sprites for everything. The "map" isn't tile-based. Of the two options above, which would be more efficient for runtime performance?

sentences:
Rendering 2D shadows in shader Update:

I am getting slightly better results by modifying the shader so that it sets a flag on entering a obscured region, and then only sets the fragment to black if the ray casting exits the obscured region. The bordering light is a little less noticeable this way. Additionally objects behind other objects will now be correctly obscured as long as they are not touching.

However as you can see in the image, I have noticed a new problem. The shadow becomes very choppy at the back due to the way I am doing raycasting.

Original:

I am currently trying to render shadows in a 2d game. I use the following shader to do so:

#version 120
varying vec2 vTexCoord;

uniform vec3 u_lightColor;
uniform sampler2D u_texture;

float drawShadow(){
    vec2 loc;
    vec2 norm = normalize(vTexCoord - vec2(.5,.5)); // Pointing from center to point
    vec4 smp;

    float dst = 0.0;

    // For now draw all casters
    if(texture2D(u_texture, vTexCoord - dst * norm).a > 0)
        return 1.0;

    for(int i = 0; i < 256; i++){
        loc = vTexCoord - dst * norm;

        if (length(loc-vec2(.5,.5)) < 1.0/256.0)
            break;

        smp = texture2D(u_texture, loc);

        if(smp.a > 0){
            return 0.0;
        }

        dst += 1.0/256.0;
    }

    return 1.0;
}

void main() {
    float dist = length(vec2(.5,.5) - vTexCoord.xy);

    float shad = drawShadow();

    float intensity = 1-dist*2.0;

    gl_FragColor = vec4(u_lightColor, 1.0)*vec4(shad*vec3(intensity), shad);
}

The light is being rendered at the center of the screen, and the texture being drawn is one where any shadow caster is drawn as a non transparent sprite.

The trouble is because of the way I am sending out the rays I end up with the following:

Where the shadows don't hug the edges of the sprites. Also, I would like to somehow obscure shadow casters if they are in the shadow of another shadow caster, but not if they are the first caster the light hits.

sentences:
What is the best way to turn image voting into a game? I'm trying to come up with a design for an image voting site that turns the (potentially boring) task of voting on thousands of images into a game. The goal is to get the user to vote on as many image pairs as possible without them getting bored.

My first thought was to use to the different ip addresses of uploaded images and turn the voting into a world journey for the user. The site opens on a world map and is presented a series of image "battles" where they have to choose the winning image out of the pair. Each world region will have anywhere from 10-100 image pairs that the user will vote on. As they complete the image pairs for a region, they are "flown" to another part of the world to keep the game going.

The goal of the world map approach is to collect the user's opinion on as many image pairs as possible while giving them the sense of: 1- accomplishment (finishing the image pairs of a region) 2- going around the world

I unfortunately ran into a subtle flaw of this approach: Image pair voting will be restricted to particular region...so you can never have an image pair composed of an image from japan against an image from the US.

I was wondering how I could adapt this approach to fix this flaw - ie allow image pairs to be composed of images from all over the world instead of a particular region only?

Or even if you could come with a different design that accomplishes the same goals (collect as many votes as possible while keeping the user motivated and not bored)

Thanks for your time

sentences:
Is it a bad practice to add helper methods if the class is intended only for data? For example, if I have something like:

class ItemData
{
    public int cost;
    public int level;
    ...
    public List<ItemData> childItems;
}

And I'm aiming to separate data from logic, is it ok if I add methods to ItemData such as:

class ItemData
{
    ...
    public void AddChildItemData(ItemData childItem);
    ...
}

that are helper methods for setting or manipulating the data? Or should these be moved elsewhere to service classes?

sentences:
How do you create dots in a shape of a letter and make them interact-able for a user to connect them? I am making a game where the user is given a letter on screen such as the below image

The user then uses the mouse to draw from one point to another until the shape is drawn.

I wanted to know what is the best way for the program to create these points so that they appear on screen for the user to interact with them?

I have a canvas and the mouse is able to draw on the screen the problem is I don't know how to make the points interact-able with the mouse, so that when the mouse draws on or over the dots that it connects them together to form the letter.

sentences:
Collision Detection Unresponsiveness I'm creating a simple jumper game in Libgdx that makes the player jump over obstacles in order to stay alive.

The only problem is that the collision detection for when the player just touches the ground, it:

1) Looks a little bit like there's a hitch in the repainting (because it tends to go a y axis little too far before being brought back to above 0).

2) Can't jump right away again (a very small, but annoying delay).

Here is the code that checks for collisions:

public void update(float dt) {
    if (location.y < screenBounds.y) {
        location.add(MOVEMENT * dt, 0, 0);
        velocity.y = 0;
        location.y = 0 + dt;
    } else {
        velocity.add(0, GRAVITY, 0);
        velocity.scl(dt);
        location.add(MOVEMENT * dt, velocity.y, 0);
        velocity.scl(1 / dt);
    }

}

I know why, it does this though:

LOCATION BEFORE RESETTING -0.45871875
LOCATION AFTER RESETTING 0.017244088

It takes too long to realize that the location on the y axis is below 0. This creates a hitch as well as a small delay between the times where it lets the player jump again.

I don't know how to fix this problem. I've looked at many posts that discuss collision detection, but none address the same problem I'm having.

For example, these tell me to do what I'm currently doing:

Collision detection
Collision detection in libgdx

But they both don't solve my issue.

Any help would be greatly appreciated.

sentences:
Unity - Emission Material on Top of UI I've already uploaded this question in the Unity forums but only got a response but not an answer or solution. Here's a link to the original post: https://forum.unity.com/threads/emission-material-on-top-of-ui.1032337/?fbclid=IwAR1X3sXn1X8XcEXHXjD3wffiQxuDK6KAjMF57XDv9RUb1FsofklORfDeRm0
In my latest project I tried to do a transition between scenes in the most simple way: Darkening the screen.
The problem is, when the image goes fully opaque (alpha = 1), there are emission materials that are clearly visible "through" the image.
This only happens to the emission type:
I'll leave three screenshots, screen before the image gets opaque, the screen after the image goes opaque and my canvas components.
Edit: Using UniversalRP - HighQuality(UniversalRenderPipelineAsset)

sentences:
Make objects stack in unity? I have two kinematic rigidbody cubes from the standard 3D objects, I have also enabled contact pairs mode to "all contact pairs", how do I make it so that no matter what angle they collide in they perserve the same angle but just get out of each others space making it look like they're in contact e.g. collided?
Here is my attempt at doing that:
using System.Collections;
using System.Collections.Generic;
using UnityEngine;

 public class Physics : MonoBehaviour
{
  private Collider collider1;
  private bool grounded = false; //used to determine if the collider hit something so it doesnt keep going down

// Start is called before the first frame update
void Start()
{
    collider1 = GetComponent <Collider>();
}

// Update is called once per frame
void Update()
{
    if (!grounded) //if the collider hit something, stop going down
    {
        collider1.transform.Translate(0f,-.1f,0f,Space.World);

    }
}

private void OnCollisionEnter(Collision collision)
{
    grounded = true; //the collider hit something
    if(collider1.transform.position.y != collider1.bounds.extents.y) //if this is true, it means it is at the floor so dont move it
    {
        transform.position = new Vector3(collider1.transform.position.x, collision.collider.bounds.size.y + collider1.bounds.extents.y, collider1.transform.position.z); //attempts to put the collider on top of whatever it get

    }

 }

}

This works if the cubes are right on top of each other with no angle:

It also works if one of the cubes collides at a angle to the other cube, when they collide the bottom cube perverse its angle of collision and and the top cube just gets out of the space of the other collider making it look like they have collided:

What doesn't seem to work is if both cubes collide with each other at a angle, although they preserve their angle of collision, and also get out of each others space, they do not remain in contact with each other which if they did would make it look like they have collided.

Instead there is a gap between them, how do I get rid of the gap e.g. make it so that no matter what angle the objects are at they get out of each others space, preserve the angle, and remain in contact with each other to give the illusion that they have collided?

sentences:
Does a successful attempt count as an attempt? I'm writing a video game and I'd like to know if I should include the "successful" attempt in the count of "total attempts".

For instance, in a clay shooting game, if the player needs four shots before they hit the target:

bullet one = miss
bullet two = miss
bullet three = miss
bullet four = hit

Does it equate to three attempts, or four attempts? What text do I need to write at the end of the round?

  You needed three attempts to hit the target!

or

  You needed four attempts to hit the target!

sentences:
Formula to convert zoomed in game space co-ords to UI I need to come up with a formula to convert variable zoomed-in game space co-ords to UI co-ords. The engine I'm using is not traditional so there's no inbuilt function (convertToUISpace etc).
Now I have a feeling this is extremely easy, but I cannot get my brain to work the math...
It's a top down 2D game with 2 layers, game and UI. The screen is 640x360 res, but there is a zoom overlay on the game layer that can take it anywhere up to 400x225. The HUD layer remains the 640x360 res throughout though.
So I need to translate x,y positions on the game layer (at whatever zoom) to correctly position on the HUD. At the moment if I use exact co-ords they don't quite match up, unless the object is exactly in the screen centre.
Could anyone assist or clue me down the right path? I'm guessing I have to work out from the screen centre using the zoom ratio.

sentences:
How can I create a 3D point cloud in WPF? I need to render some 3D points with WPF. How can I do this?

I need an easy and fast solution to just render this point cloud. No lights, no texture, no sound, no physics, just colored 3D points in a space with rotating camera.

How can I do this without having to learn Direct3D/OpenGL/any complex 3D engine?

sentences:
Why does my capsule collider fall without my object (Unity)? I've got a player with a rigidbody/capsule collier (gravity enabled) and a plane with a box collider. When the player is on the plane, everything works as expected, the player can walk across the plane with no issue. However, when the player walks off the plane, I want the player to fall. However, what happens instead is that the capsule collider falls but the player just keeps walking in thin air. Why is this happening?

Problem:

Colliders setup:

Code:

void Update () {
    i = 0.1f;
    transform.position = new Vector3(transform.position.x, transform.position.y, transform.position.z + i);
}

Sorry if I'm doing something stupid, I'm new to game development/Unity, I usually program  other things, not 3D games. Just expiermenting a bit to learn.

sentences:
Creating “Run over by car” effect in unity using spotlights only I'm doing a project where I need to simulate a car running the character over. It's happening in a completely dark space, so I want to create it using spotlights moving towards the camera until the screen gets completely white.

To create this "bright light" effect, I use volametric lighting on 2 spotlights:

But when I start moving the spotlights towards the player, the spotlights start moving away from each other (Which makes sense, and can be fixed somewhat by increasing the SpotAngle/Range by code while the spotlights are moving).

However, when the spotlights get to right in front of the player, they disappear before making the screen completely white. I could use a fade-in complete white screen transition, but this complete method seems extremely clunky. Is there another, better way, or maybe a simpler fix to my spotlight moving closer issue?

sentences:
Flipped model has wrong triangle order I have list of models and transform matrix for each of them. Some of models are flipped along X or Y or Z axis. This meshes will be rendered wrong, back face is rendered instead of front.

I tried to use glFrontFace(GL_CW) and that makes wrong models fixed but previous correct models are wrong.

How can I fix this?
Can I detect from transform matrix which models need glFrontFace switch?

Right cube and sphere are normal and left are flipped

sentences:
How to draw a Bezier line with shaders? I found a shader code to draw a filled Quadratic Bezier in

https://developer.nvidia.com/gpugems/GPUGems3/gpugems3_ch25.html

How can I use something similar to draw a Bezier line that follows the same path?

sentences:
How can I speed up Unity3D Substance texture generation? I'm working on an iOS/Android project in Unity3D. We're seeing some incredibly long times for generating substances between testing runs. We can run the game, but once we shut down the playback, Unity begins to re-import all off the substances built using Substance Designer. As we've got a lot of these in our game, it's starting to lead to 5 minute delays between testing runs just to test a small change.

Any suggestions or parameters we should check that could possibly prevent Unity from needing to regenerate these substances every time? Shouldn't it be caching these things somewhere?

sentences:
Image effect console error I have imported image effects from asset store in my project.
When imported, I've got 5 error messages :

Assets/Standard Assets/Effects/TonemappingColorGrading/Editor/TonemappingColorGradingEditor.cs(370,134): warning CS0618: `UnityEditor.TextureImporterFormat.AutomaticTruecolor' is obsolete: `Use textureCompression property instead'

What to do ?

sentences:
How to render infinite universe? I'm curious what are the best practices in game development industry to render 3d universe?

To be more specific:

The data points are given and static. Each point has position, color and size;
The entire data set is much larger than available memory;
User should be able to "zoom out" to see bigger picture at once;

The most naive approach would be to split universe into cubes and render only what's visible. I'm not sure how in this scenario should I implement the "zoom out". Should I precompute cubes for each possible zoom level? Or maybe there are better approaches?

I'm looking for technology agnostic solution.

sentences:
How do I calculate specular contribution in physically-based rendering? I'm trying to implement physically-based rendering, in a small game engine built for academic and learning purposes. I cannot understand the right way to calculate specular and diffuse contribution, based on the materials metallic and roughness values.

We don't use any third party libraries or engines for rendering; everything is hand written in OpenGL 3.3.

Right now, I ues this:

// Calculate contribution based on metallicity
vec3 diffuseColor  = baseColor - baseColor * metallic;
vec3 specularColor = mix(vec3(0.00), baseColor, metallic);

I'm under the impression that the specular has to be dependant on the roughness, somehow. I was thinking to change it to this:

vec3 specularColor = mix(vec3(0.00), baseColor, roughness);

Again, I'm not sure. What is the right way to do it? Is there even a right way, or should I just use the 'trial and error' method until I get a satisfying result?

Here is the full glsl code:

// Calculates specular intensity according to the Cook - Torrance model
float CalcCookTorSpec(vec3 normal, vec3 lightDir, vec3 viewDir,
    float roughness, float F0)
{
    // Calculate intermediary values
    vec3 halfVector = normalize(lightDir + viewDir);
    float NdotL = max(dot(normal, lightDir), 0.0);
    float NdotH = max(dot(normal, halfVector), 0.0);
    // Note: the following line could also be NdotL, which is the same value
    float NdotV = max(dot(normal, viewDir), 0.0);
    float VdotH = max(dot(viewDir, halfVector), 0.0);

    float specular = 0.0;
    if(NdotL > 0.0)
    {
        float G = GeometricalAttenuation(NdotH, NdotV, VdotH, NdotL);
        float D = BeckmannDistribution(roughness, NdotH);
        float F = Fresnel(F0, VdotH);

        specular = (D * F * G) / (NdotV * NdotL * 4);
    }
    return specular;
}

vec3 CalcLight(vec3 lightColor, vec3 normal, vec3 lightDir, vec3 viewDir,
    Material material, float shadowFactor)
{
    // Helper variables
    vec3  baseColor = material.diffuse;
    vec3  specColor = material.specular;
    vec3  emissive  = material.emissive;
    float roughness = material.roughness;
    float fresnel   = material.fresnel;
    float metallic  = material.metallic;

    // Calculate contribution based on metallicity
    vec3 diffuseColor  = baseColor - baseColor * metallic;
    vec3 specularColor = mix(vec3(0.00), baseColor, metallic);

    // Lambertian reflectance
    float Kd = DiffuseLambert(normal, lightDir);

    // Specular shading (Cook-Torrance model)
    float Ks = CalcCookTorSpec(normal, lightDir, viewDir, roughness, fresnel);

    // Combine results
    vec3 diffuse  = diffuseColor * Kd;
    vec3 specular = specularColor * Ks;
    vec3 result   = lightColor * (emissive + diffuse + specular);
    return result * (1.0 - shadowFactor);
}

sentences:
Animating a background 'pulse' with easing equation I'm trying to find a suitable easing equation (or other method) to animate an object so that it 'pulses' (imagine a 'spike' on a music visualiser, or see the image I drew badly below)

'v' is the value I'm using to scale. 't1' and 't2' mark the end of a single pulse.

The game I'm working on is a puzzler, but I'd like to have objects in the background pulse in time with user-selected music.

I'm sure it's just a case of knowing what to search for, but any advice would be appreciated on how best to achieve this.

sentences:
Lights not displayed on Sprite I have a scene that contains 3 elements:

Main Camera
A 2D Sprite that renders a single white pixel image, scaled to 2000 x 1000
A point light with a yellow color

What should be done so that the light is actually rendered on the sprite?
I have recorded a short video showcasing the issue: https://www.youtube.com/watch?v=g2iZB6BXhPs

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: Display and render only a specific object in wireframe in Unity3D I want to know how to view and render a specific game object (mesh) in wireframe, not the whole scene. I can change the scene to wireframe using GL.wireframe but the problem I want to view and render only a certain object (not the whole scene) in wireframe. Any advice please?

sentences:
ObjectDisposedException when Texture2D isn't disposed I'm making a particle engine so I develop a texture programatically and I want to display it in a Windows Form picture box.  So I create the Texture2D which goes fine.  Then I use this code to convert from a Texture2D to an Image for the picture box.

    public static System.Drawing.Image Texture2Image(Texture2D texture)
    {
        if (texture.IsDisposed)
        {
            return null;
        }

        MemoryStream memoryStream = new MemoryStream();

        texture.SaveAsPng(memoryStream, texture.Width, texture.Height);

        memoryStream.Seek(0, SeekOrigin.Begin);

        System.Drawing.Image image = System.Drawing.Bitmap.FromStream(memoryStream);

        memoryStream.Close();
        return image;
    }

I get the error at the texture.SaveAsPng(...).  It says 'Cannot access a disposed object. Object name: 'Texture2D'.'
But as you can see, I just checked to make sure it wasn't disposed.  I looked at the Locals info which also says the IsDisposed flag is false.  No where in my code to I call texture.Dispose() or anything of the sort.  I have no idea where this error is coming from.  Any help would be greatly appreciated, thanks in advance.

sentences:
Efficient Dynamic Memory Management My world is procedurally generated. As the player moves, chunks behind them are unloaded and chunks in front of them are loaded. Each chunk has a mesh of triangles.

At the moment, I create two VBOs for each chunk (vertices and colours), when the chunk is loaded. Once a mesh is created, it is only edited every few seconds. These buffers are deleted when the chunk is no longer visible.

Am I leaking memory here by constantly creating and destroying buffers?

I've heard somewhere that OpenGL (or WebGL in this case) doesn't do garbage collection until the program quits, due to it being slow. Is this right?

Could I improve this system somehow?

sentences:
LibGDX - how to make sizeToAction relative to other corner than bottom-left? I'm trying to resize a widget inside a Table.
It's a fullscreen widget and when Android Keyboard comes out, the widget is resized so it fits half of the screen from the top.

SizeByAction works from the left-bottom corner so it resizes the widget down, and I have to resize it up.

For now I use a hack with a parallel action and I change it's size and POSITION in the same time so it looks like a want (like it was staying in the left-top corner all the time).

I know there's a originX and originY but they're used to rotation, not resizing elements.

If someone did something like this before without a hack  like mine, I would be grateful for a tip! :)

How does the widget look like? It's a fullscreen widget:

How does it look after resize?

How I want it to look like?
I want it to rezise relative to it's left-up corner

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:
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 can a game engine's renderer be visually compatible with Maya's? Say you create some model in say Maya, you apply all kinds of effect to the model and then export the file. Then the game engine has to load the file and render it, so surely the game engine needs the same renderer as Maya's to reproduce the effects created in Maya?

sentences:
How do I draw multiple irregular polygons with OpenGL ES? In this post I was asking how to program a map of a Risk-like game.
Now that the map is pretty coded, both client and server-side, I'd like to finally draw the map.
I'll try to keep least broad as possible in this question, and also avoid XY problem.
So, my X problem is that I need an interactive map, based on (irregular) polygons.
Now, since this question would be really broad (there is a heavy number of possible solutions and libraries for a skilled programmer), this is how I imagined my Y solution:
Since the polygons have to be 10,  touch-interactive, filled with plain color, I think that OpenGL ES should go fine for me. I'm also attracted by Path and Point classes, but the problem is that

The map should be displayed for lot of different screen sizes, but at the same time it should keep its ratio, instead of appearing more large or more little in the Activity.

The polygons have to be drawn to fit each others.

Every polygon should be touchable and the event should differ from the others. Also their color could change depending of the situation.

I don't know if Path and Point classes would fit for this. My intent is more game-like than generic, so I think I'll stick with OpenGL ES solution.
The problem is that I don't understand

How can I map the polygons vertex and dimension for different screen sizes?

(considering we're talking about 10 polygons, there is a kind of environnment for doing this?)

Should I use triangulation or not? I've done lot of research but this point wasn't clear to me.

I followed Android Open GL tutorial, but it only shows simple polygons and alone, I'd need 10 with lot of vertexes and above all that can fit each others.
How can I do this?
EDIT: I also tried to follow this tutorial. This is an image taken from that one:

(source: xamarin.com)
To me instead, it's more little and near top-left corner. This is another trouble I'd like to avoid (as I said in point 1 above): my polygons should always fit the screen (and this is also why I want to use OpenGL ES).

sentences:
Problem with Animating on local position Unity Currently, I am having a Cube that needs to be animated to roll on its edge. Using unity built-in animation feature, I created 4 animations (RotateUp, RotateDown, RotateLeft, RotateRight). At the end of each animation I would put an Event to call a method on my script. To be able to move the object every time the animation is played, I put the cube with animator attached inside a parent object.
Below is the script attached to my cube.

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

public class RedCubeBehavior : MonoBehaviour
{

    Animator anim;

    bool isMoveTriggered = false;

    void Start()
    {
        anim = gameObject.GetComponent<Animator>();
    }

    void Update()
    {
        if (Input.GetKeyDown(KeyCode.UpArrow))
        {
            MoveUp();
        }
        else if (Input.GetKeyDown(KeyCode.DownArrow))
        {
            MoveDown();
        }
        else if (Input.GetKeyDown(KeyCode.LeftArrow))
        {
            MoveLeft();
        }
        else if (Input.GetKeyDown(KeyCode.RightArrow))
        {
            MoveRight();
        }

        if (isMoveTriggered)
        {
            if (IsBackToIdle())
            {
                transform.parent.position = transform.position;
                transform.localPosition = Vector3.zero;
                isMoveTriggered = false;
            }
        }
    }

    void AnimationFinished()
    {

        anim.Play("IdleState");

    }

    public void MoveUp()
    {
        if (isMoveTriggered)
        {
            return;
        }
        else
        {
            Debug.Log("MoveUp");
            isMoveTriggered = true;
            anim.Play("RotateUp");
        }
    }

    public void MoveDown()
    {
        if (isMoveTriggered)
        {
            return;
        }
        else
        {
            Debug.Log("MoveDown");
            isMoveTriggered = true;
            anim.Play("RotateDown");
        }
    }

    public void MoveLeft()
    {
        if (isMoveTriggered)
        {
            return;
        }
        else
        {
            Debug.Log("MoveLeft");
            isMoveTriggered = true;
            anim.Play("RotateLeft");
        }
    }

    public void MoveRight()
    {
        if (isMoveTriggered)
        {
            return;
        }
        else
        {
            Debug.Log("MoveRight");
            isMoveTriggered = true;
            anim.Play("RotateRight");

        }
    }

    bool IsBackToIdle()
    {
        return anim.GetCurrentAnimatorStateInfo(0).IsName("IdleState");
    }

}

Every time the arrow key is pressed the object would rotate but in the end when AnimationFinished() is called, the cube would just roll back to its starting position (because of playing IdleState). It will only work (the object didn't return to its starting position) if I pressed the arrow twice quickly.

I've tried to not call the IdleState (which is only an empty state), but what happens next is it just won't play another animation again when triggered.

What should I do in order to get it work without having to press the key twice?

sentences: How to apply Image effect only on specific part of objects? I need a way to censore part of characters' bodies like Cyberpunk 2077.this is mean I want to apply Image effect only to specific parts of bodies that you can see in the below Image:

sentences:
What is the cause of these WaitForFPS spikes and dips? In Unity, moving the player causes the camera to jitter. I went to the Profiler, and I saw these spikes:

On further inspection, all the yellow spikes were WaitForFPS(). I've tried every VSync setting in quality options, but none of them seem to fix this issue.

sentences:
How can I play an RTSP video stream in Unity3D? I want to play an RTSP video stream on a Texture2D. The stream is coming from an IP camera and is encoded with  H.264, MJPEG or MPEG4.

I know about VLC's libraries, ffmpeg, direct show, media foundation and such, but how do I connect them to Mono develop?

sentences:
How do I adjust my rigidbody velocity on a local axes? I have an fps rigid body script, code listed here:
using System.Collections;
using System.Collections.Generic;
using UnityEngine;

public class Player : MonoBehaviour
{
    // Start is called before the first frame update

    [SerializeField] Camera cam;
    [SerializeField] float camSpeed;

    float yaw;
    Vector3 direction;

    Rigidbody myrigbody;
    void Start()
    {
        myrigbody = GetComponent<Rigidbody>();
    }

    // Update is called once per frame
    void Update()
    {
        cam.transform.Rotate(new Vector3(-Input.GetAxis("Mouse Y") * camSpeed, 0, 0));

        yaw = (yaw + Input.GetAxis("Mouse X") * camSpeed) % 360f;

        direction = new Vector3(Input.GetAxis("Horizontal"), myrigbody.velocity.y, Input.GetAxis("Vertical"));
    }
    private void FixedUpdate()
    {
        myrigbody.MoveRotation(Quaternion.Euler(0, yaw, 0));
        myrigbody.velocity = direction;

    }
}

The particular part I'm having trouble with is the last line: myrigbody.velocity = direction;This code is moving my character perfectly, except that it doesn't adjust to my rotation in game.  If i rotate 90 degrees to the right in game, and press forward, I will move to the left (from the players perspective), I will move in the same direction when i press forward (or any other direction) no matter how I have rotated.  How do I alter the rigid bodies velocity while taking into account how the player has rotated?

sentences:
How to optimize against wealth loss? The wealth system in d20 Modern always gives me a slight headache at character creation, because I know there's a better way to buy things, but I don't know exactly how, so I'm coming up with an algorithm to automatically buy things in the correct order to minimize losses, sticking it in a program, and just stop thinking about the whole thing. Help if you can, pls.

Algorithm

[Wealth is your Wealth Bonus, and DC is the Purchase DC of the item on the list. > is greater than, < is less than, >= is greater than or equal to, and <= is less than or equal to]

Wealth is a random value generated at the beginning (let's say 1 to 100), and the list of items purchased can contain up to 25 items of equally random purchase DCs. Just in case that's relevant. In the link above, it mentions things like 1d6 and 2d6. In the format xdy, x= number of dice rolled, and y = number of sides each dice have. So 2d6 would generate a number from 2 to 12. 1d6 would generate one from 1 to 6.

-

Run the following through all items in the list first, since if the following conditions are met, the item is free, but might not remain free if you lose wealth:

If DC <15 and (Wealth - DC) > 0
Purchase item

-

Then, determine if there are items on the list that would jump up a tier if you lost 1 wealth (So, if Wealth - DC = -10 or -15) [Don't check for Wealth - DC = 0, because it should have already been bought if it was.]

If there isn't, then purchase an item with DC >=15 and (Wealth - DC) > 0

Repeat that until there are either no more items fitting the conditions, or until you are on the verge of jumping up a tier.

-

(I haven't figured out how to optimize against tier-jumping. I'm inclined to immediately buy anything that might tip over in to -16 territory, and abandon anything that ends up there. If there are none, then prioritize any in the threat of going over a tier, and abandon any that might go in to the -16+ territory.
There's some way to better formulate around these tiers, but it's rather mind-racking, and frustrating that I can't seem to figure it out!.)

-

Repeat the last process (that I actually outlined), but determining if items would jump up a tier if you lost 2 wealth
If there isn't, then purchase an item with DC>=15 and (Wealth - DC) < 0 and (Wealth - DC) > -11
(I have no idea where in the queue I should put this, but I just felt like this would be the lowest priority purchase.)

If an item comes with a restriction of +2 or greater (and you only care about the wealth you have at the end), then, unless the black market adjustment pushes the item over a tier, take the black market because you don't lose as much wealth that way. If it's only +1, then take the license unless you have 9 wealth or less, in which case obey the previous rule on restriction.

sentences:
Advanced copying between textures in OpenGL I have many RGBA textures in my project. I often copy a part of one texture into another texture using copyTexSubImage2D . I am probably able to copy just a specific channel by setting mask (colorMask).

I would like to multiply (and store) the alpha of one texture by an alpha of another texture. Is it possible to do it somehow without creating and calling shaders?  I am working with WebGL 1.0 (OpenGL ES 2.0).

sentences:
How to handle Japanese on Windows and Linux using SDL_ttf and C++? In SDL_ttf, there are a few functions provided that handles non-ASCII string literals, such as:

TTF_RenderUNICODE_Solid
TTF_RenderUTF8_Solid

and etc. I'll be using only the two functions as part of my question.

Currently, I'm fussing over whether to stick to using TTF_RenderUNICODE_Solid or TTF_RenderUTF8_Solid, mainly because I wanted my program to be able to work flawlessly on both Windows and Linux. (No plans for Mac, because of lack of hardware).

I know for a fact, on Windows, they used UTF-16 for handling wide characters. It's pretty straightforward to use Japanese for SDL, by using TTF_RenderUNICODE_Solid and the use the following code, that I'm currently using, to convert from wchar_t string literals to Uint16* type that the SDL_ttf uses:

static inline Uint16* Convert(wchar_t LString[]) {
    return reinterpret_cast<Uint16*>(&(LString[0]));
}

Thus, I can easily do:

SDL_Surface* textSurface = TTF_RenderUNICODE_Solid(font, Convert(L"い"), this->color);

But, given that any string literals, L"" is a wchar_t[] type, it makes things more complicated for me if I were to port this over to Linux. The only way I know of compiling code for Linux is to use GCC, and GCC clearly defines wchar_t to be of 32 bits long.

Of course, I can just straight up use the UTF8 versions:

TTF_RenderUTF8_Solid

And just use string literals, such as u8"あ", or u8"いいえ", and they will all work in most cases. The problem here is, when I store these string literals and then inspect the variables in the debugger, I would not get the values I wanted. The stored data would suffer from integer overflow, like so:

Where at the top, I used u8"あ" and for bottom, I used L"あ". You can see how the value is no longer preserved when using UTF8 strings, but the value is preserved when using wchar_t type strings.

Thus, I really can't use TTF_RenderUTF8_Solid in SDL_ttf to help me with Japanese encoding.

May I ask what is the best way to go about this? And how I should correctly handle Japanese on both Windows and Linux platforms?

Thanks in advance.

sentences:
Character appearance synchronization in open world multiplayer game I am working on a multiplayer open world game where you can equip handhelds and armor pieces. In my architecture, there are clients and an authoritative server. Every equipable item is crafted by a user. They can be different in shape, so it's important that I synchronize shape information. This is expensive data to send (basically an outline plus some more info). Together with this, I also want to synchronize any equipment event that occurs, so when a user meets another user, they can see each other's gear.

The easiest solution I've found is to force-send gear on equipment, but it will use bandwidth even when two players are far away.

This feels like a problem that has been solved a thousand times, so I don't want to reinvent the wheel. Do you know of any best practice/known strategy that suits my situation?

sentences:
How do I determine color resolution of an output in DXGI/D3D? i'm was revising some code i wrote some time ago when working on the window wrapper for my rendering framework. The framework is based off DirectX, but it wasn't really using any D3D-related facility. Instead it was wrapping the EnumDisplaySettings call :

DEVMODE dm;
dm.dmSize = sizeof(dm);
int_32 count{ 0 };
while (EnumDisplaySettings(NULL, count, &dm))
{
    if (dm.dmPelsWidth == _width && dm.dmPelsHeight == _height)
    {
        m_width = dm.dmPelsWidth;
        m_height = dm.dmPelsHeight;
        m_color_resolution = dm.dmBitsPerPel;
        m_display_frequency = dm.dmDisplayFrequency;
        return true;
    }
    ++count;
}

Simple as that, this doesn't take into account the format. It does take the refresh rate in count (DisplayFrequency) that I've supposed being the same thing. I'm using this Win32 call because later whenever someone needs to set the window to fullscreen I apply the DEVMODE through ChangeDisplaySettings().

I could have used the IDXGIAdapter::EnumOutputs call, but this doesn't give me the bits per pixel (or color resolution). I've done some tests and its value is 32 most of the times but I don't want to take it for granted. My question(s) is(are):

Is there any way to get the color resolution through Direct3D ? is it strictly related to the format ?
Is my approach correct at all ? because i'm having some doubts, should i keep using the Win32 calls or use the D3D ones ?

I apologize if this question has already been answered or if it has an obvious answer that I can't get, I bet I'm missing something.

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:
Repairing back-facing triangles without user input My 3D application works with user-imported 3D models.
Frequently, those models have a few vertices facing into the wrong direction. (For example, there is a 3D roof and a few triangles of that roof are facing inside the building). I want to repair those automatically.

We can make several assumptions about these 3D models: they are completely closed without holes, and the camera is always on the outside.

My idea: Shoot 500 rays from every triangle outwards into all directions. From the back side of the triangle, all rays will hit another part of the model. From the front side, at least one ray will hit nothing.

Is there a better algorithm?
Are there any papers about something like this?

sentences:
New Project Basic Structure I had originally asked this on the Cryengine forums but I received no replies. I know stackexchange to be a much better community.

I am just starting out with Cryengine 5 and created my first blank C++ project. However the documentation is just a little lacking currently and I want to know the ins and outs of what has been generated for me. If there are other forum posts or specific pages in the documentation that I should be looking at but must have overlooked I'd appreciate the links.

I can very easily find documentation on the structure of the engine code. Well at least I think that is what this page refers to. But I'm more concerned with the structure for a new game project.

As far as I am aware the default template contains a single level but I don't know much more than this. Here are a list of questions that I have regarding what has been generated when I created a new project:

What is rcjob_all.xml?
What does MakeAssets.bat actually do?
Game.bat, Editor.bat and Code_CPP.bat launch the Game, Editor, and Visual Studio respectively? What else are these scripts doing?
What is the difference between the GameDll and Solutions folder under code? Where should I put my custom code? For example custom flowgraph nodes.
How is the Assets folder structured? What are entities, libs, scripts, textures/cubemaps/example and how are these related to what I see within the editor?
What is game.cfg?
The Assets folder contains Textures.pak. What is the difference between this and the terraintexture.pak within Assets/levels/example?
What am I safe to remove so that I have the bare minimum project possible? I want to remove as much cruft as possible (inc. code)

What I am aiming for here is the most basic project possible without removing common functionality i.e. player movement, game startup and rules, etc... so that I may build upon this a new level and not have unused/unnecessary files floating around.

sentences:
Creating custom collision map for 2D I have a 2D level that I have built in my map editor, and I was wondering the best way to create a collision map for it.

I have a collision map layer in my map editor, which saves each node (for example, a rectangle would be just 0,0 0,50 50,60 0,60)

I was just wondering how I could take my node locations and convert it to a collision map for Unity.

Thanks!
I feel this has to be able to be done, I can think of how I would do it in flash... but I am not sure how to manipulate it in Unity.

EDIT PICTURE: So I have a node at each one of these red dots (surrounding my terrain lets say)  I want to build a collider from those nodes

sentences:
Skipping a loop in foreach? I'm trying to get Unity to filter through a list of nodes, but I am unsure on how to do so. This is what I have derived.

foreach (TileNode z in map.nodes)
        {
            int num = TileNode z;
            if(num%2==0){
                continue;
            }

            z.collider.enabled = true;
        }

However an error prompt states that 'z' is an unexpected symbol. Any advice on the proper syntax to deal with this will be greatly appreciated.

Also, an example of how do peform filtering using LINQ will be helpful.

sentences:
Prevent cheating in html Javascript game I have made a Javascript/html game. Now the problem I have is anyone can edit the client code and cheat in game for example there is a man shooting a enemy.

Man HP:          100
Enemy HP:      50

<div id ="man" hp="100" >
</div>

Now if someone changes the hp attribute to a very high value then he becomes literally immortal making the game easy.  Now how can I prevent this type of thing ?

sentences:
Rect transform stretch of a child object is set to 0 after instantiation I have the following hierarchy of my prefab:
-PopupParent
--Popup
---ScreenDim

They all have Rect Transform set to Stretch. Anchor mins are set to 0 and Anchor maxes to 1. Left, top, right and bottom are set to 0. When I pull this prefab to a Canvas manually, all works as expected.
When I instantiate the prefab the problem I am encountering is, that the PopupParent is stretched as expected, to the full screen, but all its children are not.
PopupParent looks like this:

Children Popup and ScreenDim look like this:

The instantiation I am doing using the Spawn Prefab Node in the Event editor provided by the ORK Framework. I am Mounting the PopupParent to my UICanvas.
It could be, that the issue is caused by some Framework settings, but it might very well be related to how Unity works in general. I am not sure and can't find a way to figure it out.
SOLUTION: I got ORK support to reply and solve the issue for me: http://forum.orkframework.com/discussion/6465/spawning-a-prefab-with-a-stretch-property#latest
TL;DR: Regular mounting and UI mounting works slightly different.

sentences: Snooker/Pool AI Predicting end location of cue ball Unity I’m trying to implement a pool/snooker game. I figured the best way to implement the ball movement/potting mechanics is to use the physics simulation, apply an impulse to strike the cue ball and let the simulation deal with the rest. This seems straight forward enough but I have no idea where to start with the AI. For the AI to be anywhere near convincing it will need to consider the position of where the white ball will end up when planning what shot to play.  Can anyone offer any advice on how I can predict where the white will end up when working with the physics engine? Or does this requirement make using physics a really bad idea?

sentences:
Kinetic sand simulation I want to simulate Kinetic sand's behavior in my game. I could implement operations such as slicing and cutting using simple mesh cutting algorithms but I want to implement complicated operations such as follows:

Ref video link: https://www.youtube.com/watch?v=3clqk2U3T9Y

Squishing (Time frame 1:37 to 1:40 in the ref video)
Scooping (Time frame 8:53 to 8:57 in the ref video)

I have the following questions:

What physics simulation algorithms can be used to implement the above 2 operations?
I want to implement this concept for mobile devices. Will it be computationally heavy to simulate such physics on mobile devices? if yes, are there any workaround solutions for this type of simulations?

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

sentences:
Framerate-independent acceleration Is this the right way, or at least a way that works, for dealing with accelerations in variable time steps evironments?

    // Pseudo-code
    void onUpdate() {
        mySpeed += acceleration * timeElapsed; // More specifically, this part
        myPosition += mySpeed * timeElapsed;
    }

Truth to be said, I'm using a constant timeElapsed defined by (1.0f / FPS_LIMIT), FPS_LIMIT being the value of the framerate at which I want the game to be locked. Speeds and accelerations are defined in the following ways:

    #define FRAME_DURATION (1.0f / FPS_LIMIT)

    #define RUNNING_SPEED 42 * FRAME_DURATION
    #define GRAVITY 42 * FRAME_DURATION

And I have noticed that, the further I increase my FPS_LIMIT, the faster things accelerate. Well, it's obvious (or not) that I'm using flawed logic to define the acceleration constants, but I'd also like to know what then I'm doing wrong and what'd be the right way to calculate these values, because what I'll pretty much be doing through my scripts will be as simple as this:

    void onUpdate() {
        mySpeed += acceleration;
        myPosition += mySpeed;
    }

As if framerate-independence didn't even exist.

If you want to get technical, I'm using simple SFML for the fixed time steps, through a window.setFramerateLimit(FPS_LIMIT) call.

sentences:
Mcreator (Minecraft Mod-making) Compile Error I'm trying to make a tool pack but every time I get the message:
New Dep: net.minecraftforge:forge:1.15.2-31.2.0_mapped_snapshot_20200514-1.15.1
> Task :compileJava FAILED
C:\Users\MCreatorWorkspaces\tree\src\main\java\net\mcreator\tree\item\ObsidianAxeItem.java:43: error: illegal start of expression
                     new ItemStack(, (int)(1))
                                   ^
C:\Users\MCreatorWorkspaces\tree\src\main\java\net\mcreator\tree\item\ObsidianHoeItem.java:43: error: illegal start of expression
                     new ItemStack(, (int)(1))
                                   ^
C:\Users\\MCreatorWorkspaces\tree\src\main\java\net\mcreator\tree\item\ObsidianPickaxeItem.java:43: error: illegal start of expression
                     new ItemStack(, (int)(1))
                                   ^
C:\User\MCreatorWorkspaces\tree\src\main\java\net\mcreator\tree\item\ObsidianShovelItem.java:43: error: illegal start of expression
                     new ItemStack(, (int)(1))
                                   ^
C:\User\MCreatorWorkspaces\tree\src\main\java\net\mcreator\tree\item\ObsidianSwordItem.java:43: error: illegal start of expression
                     new ItemStack(, (int)(1))
                                   ^
5 errors
FAILURE: Build failed with an exception.
* What went wrong:
Execution failed for task ':compileJava'.
> Compilation failed; see the compiler error output for details.
* Try:
Run with --stacktrace option to get the stack trace. Run with --info or --debug option to get more log output. Run with --scan to get full insights.
* Get more help at https://help.gradle.org
Deprecated Gradle features were used in this build, making it incompatible with Gradle 5.0.
Use '--warning-mode all' to show the individual deprecation warnings.
See https://docs.gradle.org/4.10.3/userguide/command_line_interface.html#sec:command_line_warnings
BUILD FAILED in 7s
1 actionable task: 1 executed
BUILD FAILED

sentences:
How do I Rigidbody.AddForce(Vector3) in Unreal Engine? I am coming from the Unity Engine, and trying to get my feet wet with Unreal Engine 4.8.x.  I want to add a one-time force to an object.  To accomplish this in Unity 5, I would use:

void Start(){
    GetComponent<Rigidbody>().AddForce(new Vector3(0, 0, 5));
}

Explanation:

  GetComponent<Rigidbody>() retrieves the Rigidbody Component.  The Rigidbody is
  already attached to the GameObject.
  The AddForce method is called on the Rigidbody, and applies the force of
  a Vector3.  The parameters of the Vector3 indicate the force on each
  axis which is applied.  In the example above, the GameObject would
  move forward on its z-axis.

How would I accomplish this same thing in Unreal Engine 4?  I would appreciate if you can elaborate on what exactly is happening in the code as well.  I currently have an empty AActor script, and I am struggling to find out what to put in my BeginPlay() method.

void AMyActor::BeginPlay()
{
    Super::BeginPlay();
    //What goes here?  Why?
}

As CobaltHex pointed out, UPrimitiveComponent has a UPrimitiveComponent.AddForce(FVector, BoneName) method.  However, I cannot figure out how to use it.  The real objective of this question is as a basic introduction to programming with Unreal Engine.  I chose AddForce, because it is an extremely commonly used method with a visible effect (in Unity).  All of the existing tutorials are either with an older version of unreal (which has different scripting) or are using blueprints (which has no scripting).  That is why I am trying to figure out what the actual code would be and what that code does.

Specifically, I am looking for an answer which tells me what code is missing from my Unreal Engine script, and what that code does, similiarly as is presented with my Unity Engine example.

sentences:
SpriteRenderer not Rendering Sprite Edit: I've slightly edited this question because I've found the symptom for my problem, but not why the actions I've noticed cause the issue.

I have what appears (via the inspector) to be two identical 2D objects containing only a transform and a Sprite Renderer.

One was created by dragging a png from a folder onto the screen, and it displays normally.

The other was created by going to the hierarchy and right click > 2D Object > Sprite, and dragging the desired picture into the object's 'Sprite' Field.

Both objects appear in the development view, but only the first one appears in the game view. Why does the second object not appear?

All other settings for Unity (environment, camera, etc) are the default for a 2D project.

Here are the inspectors for...

The sprite that is displaying:

The sprite that is not displaying:

And my Camera:

sentences:
After changing the mouse cursor texture how can i resize the texture/cursor and how to center it? I want to center it to the middle of screen.

And the size i tried to make both width and height  * 0.02f but it's still too big when running the game.

using System.Collections;
using System.Collections.Generic;
using UnityEngine;
using UnityStandardAssets.Characters.FirstPerson;

public class RotateObject : MonoBehaviour
{
    public Texture2D cursorTexture;
    public CursorMode cursorMode = CursorMode.Auto;
    public bool autoCenterHotSpot = false;
    public Vector2 hotSpotCustom = Vector2.zero;
    private Vector2 hotSpotAuto;

    void Awake()
    {
        Cursor.lockState = CursorLockMode.Locked;

        Vector2 hotSpot;
        if (autoCenterHotSpot)
        {
            hotSpotAuto = new Vector2(cursorTexture.width * 0.02f, cursorTexture.height * 0.02f);
            hotSpot = hotSpotAuto;

        }
        else { hotSpot = hotSpotCustom; }

        Cursor.SetCursor(cursorTexture, hotSpot, CursorMode.ForceSoftware);
    }
}

In the screenshot the mouse cursor is the image on the left in the game view and it's not in the center it's a bit on the right bottom(The ball is the mouse cursor). On the right the inspector of the script. The script is attached to the FPSController.

sentences:
Where to store persistent player data? I'm working on a 2d game, where the player can take damage and die. And upon death, player object gets destroyed.

However, some attributes of player shouldn't be affected by his death, such as lives, ammo, current weapon and so on. I'm wondering where to store these values.

I'm using c++.

sentences:
How can I generate biome borders? I'm looking for ways to generate random biome borders (like what Minecraft has).

One technique involves choosing specific biomes based on (eg) a rainfall map and a temperature map. But that just determines which biome to place, not where the borders between biomes are.

I don't want to use quantized Perlin noise directly; that would generate certain quantized values strictly within other zones, whereas I'd like finer control over which biomes can abut others. For example, in Minecraft one can see mountainous terrain, forests, plains, or deserts right next to the ocean.

Many of the solutions to "the biome problem" propose computing the whole universe in a heuristic manner. I want to generate infinite terrain, and to me that suggests the algorithm be strictly functional: given an X,Y value (and a world seed) the algorithm can easily spit out a biome value.

So, my question: what are some techniques for identifying random, non-trivial-sized, contiguous chunks of terrain to be of a given biome?

sentences:
GL_INVALID_OPERATION in glGenerateMipmap(incomplete cube map) I'm trying to learn OpenGL and i'm using SOIL to load images.

I have the following piece of code:

GLuint texID = 0;

bool loadCubeMap(const char * baseFileName) {

    glActiveTexture(GL_TEXTURE0);

    glGenTextures(1, &texID);
    glBindTexture(GL_TEXTURE_CUBE_MAP, texID);

    const char * suffixes[] = { "posx", "negx", "posy", "negy", "posz", "negz" };
    GLuint targets[] = {
        GL_TEXTURE_CUBE_MAP_POSITIVE_X, GL_TEXTURE_CUBE_MAP_NEGATIVE_X,
        GL_TEXTURE_CUBE_MAP_POSITIVE_Y, GL_TEXTURE_CUBE_MAP_NEGATIVE_Y,
        GL_TEXTURE_CUBE_MAP_POSITIVE_Z, GL_TEXTURE_CUBE_MAP_NEGATIVE_Z
    };

    for (int i = 0; i < 6; i++) {
        int width, height;
        std::string fileName = std::string(baseFileName) + "_" + suffixes[i] + ".png";
        std::cout << "Loading: " << fileName << std::endl;
        unsigned char * image = SOIL_load_image(fileName.c_str(), &width, &height, 0, SOIL_LOAD_RGB);
        if (!image) {
            std::cerr << __FUNCTION__ << " cannot load image " << fileName << " (" << SOIL_last_result() << ")" << std::endl;
            return false;
        }
        glTexImage2D(GL_TEXTURE_2D, 0, GL_RGB, width, height, 0, GL_RGB, GL_UNSIGNED_BYTE, image);
        SOIL_free_image_data(image);
    }

    glTexParameteri(GL_TEXTURE_CUBE_MAP, GL_TEXTURE_MAG_FILTER, GL_LINEAR);
    glTexParameteri(GL_TEXTURE_CUBE_MAP, GL_TEXTURE_MIN_FILTER, GL_LINEAR_MIPMAP_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);
    glGenerateMipmap(GL_TEXTURE_CUBE_MAP);

    glBindTexture(GL_TEXTURE_CUBE_MAP, 0);
    return true;

}

When i call this, the images load successfully, but then i get an error in console:

---- OGL DEBUG ----
message <1>: 'API' reported 'Error' with 'High' severity:
GL_INVALID_OPERATION in glGenerateMipmap(incomplete cube map)
---- BACKTRACE ----

and no cubemap is displaying at all.
Do you see any mistake in this code?

sentences:
Will a polled event system cause lag for a server? I'm using a library called ENet. It is a reliable UDP library.

The way it works is a polled event system like this:

  ENetEvent event;

    /* Wait up to 1000 milliseconds for an event. */
    while (enet_host_service (client, & event, 1000) > 0)
    {
        switch (event.type)
        {
        case ENET_EVENT_TYPE_CONNECT:
            printf ("A new client connected from %x:%u.\n",
                    event.peer -> address.host,
                    event.peer -> address.port);

            /* Store any relevant client information here. */
            event.peer -> data = "Client information";

            break;

        case ENET_EVENT_TYPE_RECEIVE:
            printf ("A packet of length %u containing %s was received from %s on channel %u.\n",
                    event.packet -> dataLength,
                    event.packet -> data,
                    event.peer -> data,
                    event.channelID);

            /* Clean up the packet now that we're done using it. */
            enet_packet_destroy (event.packet);

            break;

        case ENET_EVENT_TYPE_DISCONNECT:
            printf ("%s disconected.\n", event.peer -> data);

            /* Reset the peer's client information. */

            event.peer -> data = NULL;
        }
    }

It waits up to 1000 milliseconds for an event. If I'm hosting say 75 event driven card games and a lobby on the same thread as this code, will it cause any problems.

If my understanding is correct, the process will simply sleep until there is an event, when there is one, it will process the event then come back here where potentially 5 or so events have queued up since so enet_host_services would return right away and not cause lag.

I have been advised not to use multiple threads, will that be alright like this?

Thanks

sentences:
Tile set showing grid with lighting Hi so I have this tile set generated procedurally at the start of the scene. When I activate the point light in the middle of the screen I keep getting this grid in the game view, i tried changing the size of the tiles but no luck if I change them before pressing play in the game view.
But if I do it at run time from the inspector the bug goes away , hiding the square of the tile that I have moved...for that tile in particular even just moving it a bit solves it.
This happens in edit and game mode ,and the grid is made of loads of sprites put together.
The import settings of these sprites is dont generate mip maps, no compression. And each of the tiles have the default shader sprite diffuse.
I deactivated gizmos but no luck either

Any idea what can this be ? anything related with baking the light or something? thank you for your help!

sentences:
How can I check if the text string is not equal and then to do something? using UnityEngine;

public class DrawLines : MonoBehaviour
{
    public LineRenderer lineRenderer;
    public string text;

    private Vector3[] positions;
    private string oldText;

    private void Start()
    {
        if (lineRenderer == null)
        {
            lineRenderer = GetComponent<LineRenderer>();

            lineRenderer.startWidth = 0.3f;
            lineRenderer.endWidth = 0.3f;
        }

        // 0,  0, 0
        // 5,  0, 0
        // 5, -5, 0
        // 0, -5, 0

        positions = new Vector3[5] { new Vector3(0, 0, 0), new Vector3(5, 0, 0),
            new Vector3(5, -5, 0), new Vector3(0, -5, 0), new Vector3(0, 0, 0)};
        DrawLine(positions, Color.red, 0.2f);
    }

    void DrawLine(Vector3[] positions, Color color, float duration = 0.2f)
    {
        GameObject myLine = new GameObject();

        myLine.transform.position = positions[0];
        myLine.AddComponent<LineRenderer>();
        LineRenderer lr = myLine.GetComponent<LineRenderer>();
        lr.positionCount = positions.Length;
        lr.startColor = color;
        lr.endColor = color;
        lr.startWidth = 0.1f;
        lr.endWidth = 0.1f;
        lr.useWorldSpace = false;
        lr.SetPositions(positions);
    }

    void DrawText()
    {
        for (int i = 0; i < positions.Length; i++)
        {
            if (oldText != text)
            {
                var pos = Camera.main.WorldToScreenPoint(positions[i]);
                text = positions[i].ToString();
                var textSize = GUI.skin.label.CalcSize(new GUIContent(text));
                GUI.contentColor = Color.red;
                GUI.Label(new Rect(pos.x, Screen.height - pos.y, textSize.x, textSize.y), text);
                GUI.contentColor = Color.green;
                GUI.Label(new Rect(pos.x, Screen.height - pos.y - 20, textSize.x, textSize.y), i.ToString());
            }
        }
    }

    private void OnGUI()
    {
        if (positions != null)
        {
            if (positions.Length > 0)
            {
                DrawText();
            }
        }
    }
}

I added oldText variable but not sure how use it more then I did so far.
I want that if the text is the same in the loop then don't show this text not in red not in green.
Each time show the text once if it's not equal.

When the square is closed :

sentences:
Why does my Point light turn off if Player walks in any direction in Unity 2D? My 2D Sprite has a material, Sprite diffuse attached to it.

Now when I set up a light, it works but if I play the Game and walk, the light turns off immediately and the Player turns black.

The light is set up, Type as Point and Baking as Realtime, Distance at Z-axis is -25.

The Camera distance is at -30 on the Z-axis.

The Player is at 0 on the Z-axis.

I set the light between Camera and Player, but I also have a Camera Follows Player script, maybe it causes the problem, but I watched the Z-axis while playing and it doesn't move on the Z-axis.

I will also post Camera Script if someone can detect any problem.

{
    private Vector2 velocity;

  public float smoothTimeY;
  public float smoothTimeX;

  public GameObject player;

  // Use this for initialization
  void Start ()
  {
    player = GameObject.FindGameObjectWithTag("Player");
  }

  // Update is called once per frame
  void FixedUpdate ()
  {
    float posX = Mathf.SmoothDamp (transform.position.x, player.transform.position.x, ref velocity.x, smoothTimeX);
    float posY = Mathf.SmoothDamp (transform.position.y, player.transform.position.y, ref velocity.y, smoothTimeX);

    transform.position = new Vector3 (posX, posY + 29, transform.position.z);
  }
}

sentences:
Basic Connections Through Socket Server I'm designing a simple 2 player RTS with Stencyl, a program that uses blocks for coding. The current code updates lists whenever an actor moves (new X and Y), and I'd want the server to update the game state with each change to the list. However, to start off: I don't even know how to set up a socket server. Stencyl has taught me the basics of logic, but I've yet to learn any programming languages.

I've downloaded a Smartfox 2X socket server that I'm intending to use. Right now I'm only looking to make baby steps; I want to do something to this effect: "When someone connects to the server, open insert file here". How can I do this? My intention is to have this file be the game client. Is this "open file when connected" method the best way to go about this? When answering: assume that I know nothing, because really, though I have done research (I know that UDP>TCP for real time), implementation-wise I know nothing.

sentences:
XNA: Retrieve texture file name during runtime I'm trying to retrieve the names of the texture files (or their locations) on a mesh.

I realize that the texture file name information is not preserved when the model is loaded.

I've been doing tons of searching and some experimenting but I've been met with no luck. I've gathered that I need to extended the content pipeline and store the file location in somewhere like ModelMeshPart.Tag.

My problem is, even when I'm trying to make my own custom processor, I still can't figure out where the texture file name is. :(

Any thoughts? Thanks!

UPDATE:

Okay, so I found something kind of promising. NodeContent.Identity.SourceFilename, only that returns the location of my .X model. When I go down the node tree he is always null. Then there's the ContentItem.Name property. It seems to have names of my mesh, but not my actual texture file names. :(

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: GL_GENERATE_MIPMAP vs. GL_MAX_TEXTURE_SIZE If we generate mipmaps for a texture using GL_GENERATE_MIPMAP (or glGenerateMipmap), how big can the original texture be? Is it the size returned by GL_MAX_TEXTURE_SIZE, or half of it?

sentences:
2D Tile Based Collision Detection There are a lot of topics about this and it seems each one addresses a different problem, this topic does the same.

I was looking into tile collision detection and found this where David Gouveia explains a great way to get around the person's problem by separating the two axis. So I implemented the solution and it all worked perfectly from all the testes I through at it. Then I implemented more advanced platforming physics and the collision detection broke down. Unfortunately I have not been able to get it to work again which is where you guys come in :)!

I will present the code first:

    public void Update(GameTime gameTime) {
        if(Input.GetKeyDown(Keys.A)) {
            velocity.X -= moveAcceleration;
        }
        else if(Input.GetKeyDown(Keys.D)) {
            velocity.X += moveAcceleration;
        }

        if(Input.GetKeyDown(Keys.Space)) {
            if((onGround && isPressable) || (!onGround && airTime <= maxAirTime && isPressable)) {
                onGround = false;
                airTime += (float)gameTime.ElapsedGameTime.TotalSeconds;
                velocity.Y = initialJumpVelocity * (1.0f - (float)Math.Pow(airTime / maxAirTime, Math.PI));
            }
        }
        else if(Input.GetKeyReleased(Keys.Space)) {
            isPressable = false;
        }

        if(onGround) {
            velocity.X *= groundDrag;
            velocity.Y = 0.0f;
        }
        else {
            velocity.X *= airDrag;
            velocity.Y += gravityAcceleration;
        }

        velocity.Y = MathHelper.Clamp(velocity.Y, -maxFallSpeed, maxFallSpeed);
        velocity.X = MathHelper.Clamp(velocity.X, -maxMoveSpeed, maxMoveSpeed);

        position += velocity * (float)gameTime.ElapsedGameTime.TotalSeconds;
        position = new Vector2((float)Math.Round(position.X), (float)Math.Round(position.Y));

        if(Math.Round(velocity.X) != 0.0f) {
            HandleCollisions2(Direction.Horizontal);
        }
        if(Math.Round(velocity.Y) != 0.0f) {
            HandleCollisions2(Direction.Vertical);
        }
    }

private void HandleCollisions2(Direction direction) {
    int topTile = (int)Math.Floor((float)Bounds.Top / Tile.PixelTileSize);
    int bottomTile = (int)Math.Ceiling((float)Bounds.Bottom / Tile.PixelTileSize) - 1;
    int leftTile = (int)Math.Floor((float)Bounds.Left / Tile.PixelTileSize);
    int rightTile = (int)Math.Ceiling((float)Bounds.Right / Tile.PixelTileSize) - 1;

    for(int x = leftTile; x <= rightTile; x++) {
        for(int y = topTile; y <= bottomTile; y++) {
            Rectangle tileBounds = new Rectangle(x * Tile.PixelTileSize, y * Tile.PixelTileSize, Tile.PixelTileSize, Tile.PixelTileSize);
            Vector2 depth;

            if(Tile.IsSolid(x, y) && Intersects(tileBounds, direction, out depth)) {
                if(direction == Direction.Horizontal) {
                    position.X += depth.X;
                }
                else {
                    onGround = true;
                    isPressable = true;
                    airTime = 0.0f;
                    position.Y += depth.Y;
                }
            }
        }
    }
}

From the code you can see when velocity.X is not equal to zero the HandleCollisions() Method is called along the horizontal axis and likewise for the vertical axis. When velocity.X is not equal to zero and velocity.Y is equal to zero it works fine. When velocity.Y is not equal to zero and velocity.X is equal to zero everything also works fine. However when both axis are not equal to zero that's when it doesn't work and I don't know why. I basically teleport to the left side of a tile when both axis are not equal to zero and there is a air block next to me.

Hopefully someone can see the problem with this because I sure don't as far as I'm aware nothing has even changed from what I'm doing to what the linked post's solution is doing.

Thanks.

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 calculate the viewing cone radius at a distance in raymarching? I'm "raymarching distance fields" (proper lingo: sphere-tracing) in GLSL. To implement cone-marching atop of it (and also to minimize the number of raymarching steps regardless of whether cone-marching is added or not), I need to estimate the radius of the ray cone at any given distance.

Recall with raymarching distance fields, a "hit" is recorded when the distance to an object is smaller than a threshold value, often in code named nearLimit or epsilon. This threshold can be seen as equivalent to the ray-cone radius if we increase it exponentially with distance traveled -- this way, we don't shoot straight thin ray lines into space but cones expanding in accordance with perspective projection. This more accurately covers catching the "right" distant objects (at this point let's ignore the issue of blending materials and filtering normals of all intersected objects in the viewing cone at distance t for now...).

At step 0, this radius can be approximated by something such as

float fInitialRadius = 1 / min(screenwidth, screenheight);

This can then be increased at each step exponentially by applying the starting radius to the distance:

fNearLimit = fTotalDist * fInitialRadius;  // after each raymarching step

This works OK but still has artifacts. If I use fInitialRadius*fInitialRadius (resulting in a smaller number since initial radius for a 640px framebuffer and a unit-width view-plane is 1/640) I get less artifacts and a more accurate result. But both approaches are inaccurate, the first is too eager (increases radius too much too early), the latter too lazy (increases radius too little too late).

The most accurate factor to increase fNearLimit / the cone radius at a given distance must most likely take into account my current field of view and will vary depending on whether field-of-view is 45° or 60° or 90° or...

TL;DR: I want to know what's the proper calculation or most acceptable approximation of the cone radius at a given distance given the initial pixel radius at step 0 and the field of view angle?

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:
2D Circular View/Background Wrapping SDL for Game In the games such as Defender (1980 arcade) and Defcon, the player can move/scroll in one direction infinitely because the level/terrain simply wraps over and over again(like if it was wrapped around the side of a cylinder).

I am more interested in the wrapping mechanics of Defcon which wrap(on the x-axis) and zoom the entire level. Here is a link to view the game.

To make images(such as a background) wrap is it a per-pixel approach? Is there a function? What methods are there to achieve the circular wrapping of a level?

sentences: Sprite can jump up through platform onto platform, once while it's on platform, but falls through second time Sorry, I'm kind of new to this whole thing and trying to learn both Unity and its use of C#. I have overlapping box colliders set up and a trigger on the lower one to allow me to jump through the lower platform. That works fine, and once on the platform, I can jump through it and land on the top, and I can make a singular jump while I am on the platform, but as soon as I jump a second time, I fall right through. Does anyone have any suggestions as to how to go about fixing this? I originally thought it was that the overlap on the two colliders was too much, or that the radius of my ground points were too large, but fixing both of those didn't do me any good. Thanks for the help!

sentences:
Specify Vertex Quality in OBJ File I've got a program that prints OBJ files in the format

# x y z r g b format opens with MeshLab only (http://meshlab.sourceforge.net/)
v xVal yVal zVal rVal gVal bVal
v xVal yVal zVal rVal gVal bVal
v xVal yVal zVal rVal gVal bVal
v xVal yVal zVal rVal gVal bVal
.....

And I'd like to start including "quality" data as well.  I'm having a hard time finding an example that shows the correct way to format an OBJ file with quality data, does anyone have one they can share with me?

Thank you

sentences: How to accept microtransactions with a desktop application? I want to implement microtransactions into a desktop application I'm working on, but the microtransaction services I know of are all targeted primarilly towards Flash or smartphones. Are there any that explictly support desktop applications?

sentences:
OpenGL - Understanding the relationship between Model, View and World Matrix I am having a bit of trouble understanding how these matrixes work and how to set them up in relation to one another to get a proper system running.

In my understanding the Model Matrix is the matrix of a object, for example a cube or a sphere, there will be many of these in the application/game.

The World Matrix is the matrix which defines the origin of the 3D world. the starting point.

And the View Matrix is the "camera" everything gets translated with this to make sure you have the illusion of an actual camera when in fact everything is moving instead of this matrix?

I am a bit lost here. So I was hoping someone here could help me understand this properly.

Does every modelMatrix get translated/multiplied with the world matrix and the worldMatrix then with the viewMatrix? Or does every modelMatrix get translated/multiplied with the viewMatrix and then that with the worldMatrix?

How do all these matrixes relate and how do you set up a world with multiple objects and a "camera"?

EDIT:

Thanks a lot for the feedback already. I did some googling aswel and I think I do understand it a bit better now, however would it be possible to get some pseudo code advice?

projectionMatrix = Matrix;
makePerspective(45, width, height, 0.1, 1000.0, projectionMatrix);

modelMatrix = Matrix;
identity(modelMatrix);
translate(modelMatrix, [0.0, 0.0, -10.0]);  // move back 10 on z axis

viewMatrix = Matrix;
identity(viewMatrix);
// do some translation based on input with viewMatrix;

Do I multiply or translate the viewMatrix with the modelMatrix or the other way around? and what then? I currently have a draw method up in such a way that it only needs 2 matrixes for arguments to draw.

Here is my draw method:

draw(matrix1 matrix2) {

            bindBuffer(ARRAY_BUFFER, cubeVertexPositionBuffer);
            vertexAttribPointer(shaderProgram.getShaderProgram().vertexPositionAttribute, cubeVertexPositionBuffer.itemSize, FLOAT, false, 0, 0);

            bindBuffer(ARRAY_BUFFER, cubeVertexColorBuffer);
            vertexAttribPointer(shaderProgram.getShaderProgram().vertexColorAttribute, cubeVertexColorBuffer.itemSize, FLOAT, false, 0, 0);

            bindBuffer(ELEMENT_ARRAY_BUFFER, cubeVertexIndexBuffer);

            setMatrixUniforms(shaderProgram, matrix1, matrix2);

            drawElements(TRIANGLES, cubeVertexIndexBuffer.numItems, UNSIGNED_SHORT, 0);

}

What are those matrixes suppose to be?
Thanks a lot in advance again guys.

sentences:
Tools or techniques for UV unwrapping/texturing terrain with features such as roads? I'm trying to create a map similar to Outset island in Loz: Wind Waker. Here is an example of what I'm trying to create:

As you can see, the roads more or less have dedicated tris. However, when I look at the UV data, it looks like a complete mess:

For reference, this is the texture without any overlays:

I have no idea how to go about creating a similar effect in my own game -- are there any tools I can use? What is this technique called?

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:
How would I go about implementing a collision avoidance check, avoiding moving objects from multiple directions? So I'm making a testbed for an AI actor(ship). It's a simple asteroids game using an AI controlled actor.
I'm doing this using VS, monogame.

I have implemented a simple steering behaviour using a tutorial as a guideline, found here. https://gamedevelopment.tutsplus.com/tutorials/understanding-steering-behaviors-collision-avoidance--gamedev-7777
It works somewhat.

The problem occurs when the objects(asteroids) are all moving around(at different speeds), using the guidelines from above, it only checks for collisions for whats infront, at specific points. Which would work if all other objects were static.
My initial thought was to add a check for back,left,right. Then loop it to check all these positions in a 50-150 units radius. But the more I think about it, the more realize there must be a better way. As understand it, that wouldn't really solve it either, and would be performance heavy.

How would I go about implementing a collision avoidance check that 1; takes into account the approaching objects may come from any direction.
2; the differnt velocities of those objects.

Or might it be better to apply the existing check to the objects and passing the data to the actor?

Any references, tips, guide, code snippets or good old wisdom or simple pointer in the right direction, would be enormously appreciated!

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:
Custom shadowmapping in Unity not working properly To experiment with a certain technique, I'm implementing my own shadow mapping in Unity. I'm using a camera for the light "view", which is rendered to a RenderTexture after being post-processed with the following shader:

Shader "Custom/DepthGrayscale" {
  SubShader {
     Tags { "RenderType"="Opaque" }

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

        sampler2D _CameraDepthTexture;

        struct v2f {
           float4 pos : SV_POSITION;
           float4 scrPos:TEXCOORD1;
        };

        //Vertex Shader
        v2f vert (appdata_base v){
           v2f o;
           o.pos = mul (UNITY_MATRIX_MVP, v.vertex);
           o.scrPos=ComputeScreenPos(o.pos);
           //for some reason, the y position of the depth texture comes out inverted
           o.scrPos.y = 1 - o.scrPos.y;
           return o;
        }

        //Fragment Shader
        half4 frag (v2f i) : COLOR{
           float depthValue = tex2Dproj(_CameraDepthTexture, UNITY_PROJ_COORD(i.scrPos)).r;

           return fixed4(depthValue, 0.0, 0.0, 0.0);
        }
        ENDCG
     }
  }
  FallBack "Diffuse"

}

With a width and height of 2048 for the Render Texture and the color format R Float for 32-bit precision.

The objects in the scene then have the following shader that takes the projection * view matrix of the light and "depth" texture as input. (Basic shadow mapping with bias)

Shader "Tutorial/Display Normals" {
    Properties {
        _CameraTex ("Camera texture", 2D) = "white" {}
    }
    SubShader {
        Pass {

            CGPROGRAM

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

            uniform float4x4 lightMatrix;

            struct v2f {
                float4 pos : SV_POSITION;
                float3 worldPos : COLOR0;
                fixed3 color : COLOR1;
            };

            v2f vert (appdata_base v)
            {
                v2f o;
                o.pos = mul (UNITY_MATRIX_MVP, v.vertex);
                o.worldPos = v.vertex.xyz;
                o.color = v.normal * 0.5 + 0.5;
                return o;
            }

            uniform sampler2D _CameraTex;

            fixed4 frag (v2f i) : SV_Target
            {
                fixed4 coords = mul(lightMatrix, fixed4(i.worldPos, 1.0));
                coords /= coords.w;

                coords.x = (coords.x + 1.0) / 2.0;
                coords.y = (coords.y + 1.0) / 2.0;
                coords.z = (coords.z + 1.0) / 2.0;

                //return fixed4(coords.z, 0.0, 0.0, 1);
                float lightDepth = tex2D(_CameraTex, fixed2(coords.x, 1.0 - coords.y)).r;
                float depth = coords.z;

                if (depth < lightDepth + 0.005) {
                    return fixed4(1.0, 1.0, 1.0, 1.0);
                } else {
                    return fixed4(0.1, 0.1, 0.1, 1.0);
                }
            }
            ENDCG

        }
    }
}

The result of this is perfect with a plane and cube:

The red plane displays the shadow map and the camera represents the light.

However, when using a more complex model like Sibenik, the following happens:

When I move it slightly, the shadow on the plane is suddenly correct, but the shadow on the church model itself is still wrong:

What could be the problem?

sentences:
Help figuring out how to build for the iOS Unit3D So currently I'm exporting my game strictly for testing to the iOS (iPad.)

I don't own a Mac, so I'm having my client make a build from his Mac, but that means I need very specific instructions for him as he isn't very tech-savvy. I've looked online and can't find much at all about what all you need to export from Unity and make a file for the iOS, then sync it to your iPad. Could anyone provide a video or and help at all for this?

Thanks,

Tim.

sentences:
how to move the camera behind a model with the same angle? in XNA I'm having difficulty moving my camera behind an object in a 3D world. I'd like to have two view modes:

for fps (first person).
external view behind the character (third person).

I've searched the net for examples but they don't work in my project.

Here is my code used to change the view when F2 is pressed:

 //Camera
        double X1 = this.camera.PositionX;
        double X2 = this.player.Position.X;
        double Z1 = this.camera.PositionZ;
        double Z2 = this.player.Position.Z;

        //Verify that the user must not let the press F2
        if (!this.camera.IsF2TurnedInBoucle)
        {
            // If the view mode is the second person
            if (this.camera.ViewCamera_type == CameraSimples.ChangeView.SecondPerson)
            {
                this.camera.ViewCamera_type = CameraSimples.ChangeView.firstPerson;

                //Calcul position - ?? Here my problem
                double direction = Math.Atan2(X2 - X1, Z2 - Z1) * 180.0 / 3.14159265;
                //Calcul angle - ?? Here my problem

                this.camera.position = ..
                this.camera.rotation = ..

                this.camera.MouseRadian_LeftrightRot = (float)direction;
            }
            //IF mode view is first person
            else
            {
                    //....

sentences:
Tips / pitfalls in selecting and working with publishers? I am thinking about working with a publisher for an iPhone game that I have developed.  I have been independent until now, but want to look into the publishing route because I just don't have the resources to market the game myself, and I would rather not take outside investment.

So, those of you who have gone this route, what should I be looking for in a publisher?  What should I avoid?

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:
Modelling photo-realistic grass in realtime I see a number of tutorials on how to create good looking grasses when creating 3D renders but can't think how to model it for realtime/use in a game's scenery.

Sure simple models with alpha cutouts can be used to create plants and trees in really awesome scenery but what about a lawn?

Are there any good tricks to achieve this effect?
I tried with a simple 4 sided box and a small texture and the number of objects needed for a decent appearance made Max crawl to a halt.

(I am thinking it may be possible with a shader but that is a whole other area so thought I would just ask about anyones experience with modelling it here)

Thanks!

sentences:
Creating proper jump mechanics in LibGDX with Box2D? I'm trying to create a proper jumping system for a 2D platformer with box2D, however, I'm not exactly sure how to make a good jumping system. Right now, I'm just doing

public void jump(float delta) {
    body.applyLinearImpulse(new Vector2(0, 7), body.getWorldCenter(), true);
}

What I want to do, is have a system like Mario's or Sonic's, where the height jumped is determined by how long the player held the jump button. How do I do something like that? Also, what's better, a rectangular box2D fixture, or an oval one? I'm sorry for such a newb question, and thank you for the help!

sentences:
Implementing a basic jump in libgdx I have seen the document for libgdx and managed to move the character and also to implement bounds but the document does not show how to implement jumping.

I have downloaded the superjumper demo code but it is too confusing for me.
Is there anyone here who can guide me?

Say for example we have a spritebatch:

Spritebatch batch;

How can I implement a jump for this spritebatch when the screen is touched?

sentences:
score and high score system for multiple levels I'm trying to create a scoring system for a game with multiple levels. For this I'm using the binary formatter instead of playerprefs (I read online that playerprefs are not that secure). I have created the system but whats happening is that the score is not resetting to 0 when I load a new level. If in one level the score was 10 and I start some other level, the score in this level starts from 10 instead of 0. This is the code I have so far:

public class ScoreIncrease : MonoBehaviour
{
  public Text scoreTxt;
  public int score;

void Start()
{
    LoadScore();
}

void Update()
{
    if (Input.GetKeyDown(KeyCode.Space))
    {
        Save();
    }
}

public void Save()
{
    score++;
    scoreTxt.text = "Score" + score;
    BinaryFormatter bf = new BinaryFormatter();
    FileStream file = File.Open(Application.persistentDataPath + "/scoreContainer.dat", FileMode.Create);

    ScoreContainer scoreContainer = new ScoreContainer();
    scoreContainer.score = score;
    bf.Serialize(file, scoreContainer);
    file.Close();
}

public void LoadScore()
{
    if(File.Exists(Application.persistentDataPath + "/scoreContainer.dat"))
    {
        BinaryFormatter bf = new BinaryFormatter();
        FileStream file = File.Open(Application.persistentDataPath + "/scoreContainer.dat", FileMode.Open);
        ScoreContainer scoreContainer = (ScoreContainer)bf.Deserialize(file);
        file.Close();
        score = scoreContainer.score;
        scoreTxt.text = "Score" + score;
    }
  }
}

[Serializable]
public class ScoreContainer
  {
    public int score;
  }

How can I change this so that each level has a separate highscore and all levels have a start score of 0?

sentences:
2D Sprite batching in OpenGL: How to send transformation data to GPU OpenGL newbie here.

So I'm trying to implement sprite batching to draw ~100 sprites per draw call. I've created a VBO that contains texture coordinates, vertex coordinates, color data (for tinting), and a mat4 matrix for transforms.

So far, so good, right? Well, everything is working but the transform portion of my VBO. My theory is that I could push a mat4 with all of the rotation, scaling, flipping, and world location data applied to it, so that it gets multiplied in with viewports (see glsl code below).

#version 130

//Vertex position attribute
in vec2 vertexPos;

//Texture coordinate attribute
in vec2 texCoordIn;
out vec2 texCoord;

// Vertex color
in vec4 textureColorIn;
out vec4 textureColor;

// Matrix transformations for the sprite
in mat4 transformation;

void main()
{
    //Process texCoord
    texCoord = texCoordIn;

    // Process texture color
    textureColor = textureColorIn;

    //Process vertex
    gl_Position =  gl_ProjectionMatrix * gl_ModelViewMatrix * vec4( vertexPos.x, vertexPos.y, 0.0, 1.0 ) * transformation;
}

So here's my question, if you were to send transform data to the GPU, how would you do it? Sending a mat4 over the wire per vertex seems like overkill.

sentences:
How do I prevent other dynamic bodies from affecting the player's velocity with Box2D? I'm working on my player object for my game.

PhysicsBodyDef def;
def.fixedRotation = true;
def.density = 1.0f;
def.position = Vec2(200.0f, 200.0f);
def.isDynamic = true;
def.size = Vec2(50.0f,200.0f);

m_player.init(def,&m_physicsEngine.getWorld());

This is how he moves:

b2Vec2 vel = getBody()->GetLinearVelocity();
float desiredVel = 0;

if (m_keys[ALLEGRO_KEY_A] || m_keys[ALLEGRO_KEY_LEFT])
{
    desiredVel = -5;
}
else if (m_keys[ALLEGRO_KEY_D] || m_keys[ALLEGRO_KEY_RIGHT])
{
    desiredVel = 5;
}
else
{
    desiredVel = 0;
}

float velChange = desiredVel - vel.x;
float impulse = getBody()->GetMass() * velChange; //disregard time factor
getBody()->ApplyLinearImpulse( b2Vec2(impulse,0), getBody()->GetWorldCenter(),true);

This creates a few problems. First, to move the player at a constant speed he must be given a high velocity. The problem with this is if he just comes in contact with a small box, he makes it move a lot.

Now, I can fix this by lowering his density, but then comes my main issue: I need other objects to be able to run into him, but when they do, he should be like a static wall and not move.

I'm not sure how to do that without high density. I cannot use collision groups since I still need him to be solid toward other dynamic things.

How can this be done? Essentially, how do I prevent other dynamic bodies from affecting the player's velocity?

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:
Channelling an explosion along a narrow passage I am simulating explosions in a 2D maze game.

If an explosion occurs in an open area, it covers a circular region (this is the easy bit.)

However if an explosion occurs in a narrow passage (i.e narrower than the blast range) then it should be "compressed", so that it goes further and also it should go around corners.

Ultimately, unless it is completely boxed-in, then it should cover a constant number of pixels, spreading in whatever direction is necessary to reach this total area.

I have tried using a shortest-path algorithm to pick the nearest N pixels to the origin avoiding walls, but the effect is exaggerated - the blast travels around corners too easily, making U-turns even when there is a clear path in another direction.  I don't know whether this is realistic or not but it is counter-intuitive to players who assume that they can hide around a corner and the blast will take the path of least resistance in a different direction.

Is there a well-known (and fast) algorithm for this?

sentences:
How do I create a HUD that appears to occupy 3D space/can animate? I'm working with a group to try and make a first person space platformer in Unity, and was wondering if there would be anyway to create a HUD that moves and reacts to player actions, specifically looking around - similar to the way the HUD moves in Metroid Prime. I'd also like it appear projected onto the inside of a helmet.

I'm not entirely sure what best-practice would be in this situation. Should we just attach the GUI elements to transparent objects in 3D space, then parent them to the main camera, essentially building our HUD with actual objects; or is there another way that would be more efficient? I'm still very new to game development, but this is something we'd really like to have in our game if at all possible.

sentences:
FormatMessage not working for HRESULTs returned by Direct3D 11 I am using Windows 7 x64 and Visual Studio 17 (v15.9.7).

Say I try to create a swap chain using IDXGIFactory2::CreateSwapChainForHwnd and pass in DXGI_SCALING_NONE. I will get the following message in debug output (if I have enabled Direct3D debugging):

DXGI ERROR: IDXGIFactory::CreateSwapChain: DXGI_SCALING_NONE is only supported on Win8 and beyond. DXGI_SWAP_CHAIN_DESC{ SwapChainType = ..._HWND, BufferDesc = DXGI_MODE_DESC1{Width = 816, Height = 488, RefreshRate = DXGI_RATIONAL{ Numerator = 0, Denominator = 1 }, Format = B8G8R8A8_UNORM, ScanlineOrdering = ..._UNSPECIFIED, Scaling = ..._UNSPECIFIED, Stereo = FALSE }, SampleDesc = DXGI_SAMPLE_DESC{ Count = 1, Quality = 0 }, BufferUsage = 0x20, BufferCount = 2, OutputWindow = 0x0000000000290738, Scaling = ..._NONE, Windowed = TRUE, SwapEffect = ..._FLIP_SEQUENTIAL, AlphaMode = ..._UNSPECIFIED, Flags = 0x0 } [ MISCELLANEOUS ERROR #175: ]

The function returns 0x887a0001 in form of a HRESULT. If I put @err,hr in the watch window, I get a nice error message there:

ERROR_MOD_NOT_FOUND : The specified module could not be found.

However, if I pass this HRESULT to FormatMessage, it just puts NULL in the output and returns 0. @err,hr helpfully informs me that the new error is ERROR_MR_MID_NOT_FOUND : The system cannot find message text for message number 0x%1 in the message file for %2.

My questions are:

Why is FormatMessage not giving me right error string (the one starting with ERROR_MOD_NOT_FOUND...)?
Where is Visual Studio getting these pretty error strings from?
Can I get them too? Who do I pay?

PS. I am using the Windows 10 SDK version of DX11, not the older DirectX SDK version. Thus, I can't really link to dxerr.lib either.

This is the code that is used to print the error message:

LPTSTR error_text = NULL;
FormatMessage(FORMAT_MESSAGE_FROM_SYSTEM |
              FORMAT_MESSAGE_ALLOCATE_BUFFER |
              FORMAT_MESSAGE_IGNORE_INSERTS,
              NULL,
              hr,
              MAKELANGID(LANG_NEUTRAL, SUBLANG_DEFAULT),
              (LPTSTR)&error_text, 0,
              NULL);

sentences:
Unity3D Making timescale freeze and resume So, I'm  trying to make it where when a popup(Ui panel and text) appears, the game's time(timescale) would freeze. Then when the user enters input and clicks enter button, the popup would disappear and time would resume.

How could I make time follow this?

sentences:
How to implement line of sight restriction in actionscript? I have a problem with a game i am programming. I am making some sort of security game and i would like to have some visual line of sight. The problem is that i can't restrict my line of sight so my cops can't see through the walls. Below you find the design, in which they can look through windows, but not walls. Further below you find an illustration of what my problem is exactly.

this is what it looks like now. As you can see, the cops can see through walls.

This is the map i would want to use to restrict the line of sight.

So the way i am programming the line of sight now is just by calculating some points and drawing the sight accordingly, as shown below. Note that i also check for a hittest using bitmapdata to check whether or not my player has been spotted by any of the cops.

private function setSight(e:Event=null):Boolean
{
    g = copCanvas.graphics;
    g.clear();

    for each(var cop:Cop in copCanvas.getChildren())
    {
        var _angle:Number = cop.angle;
        var _radians:Number = (_angle * Math.PI) / 180;
        var _radius:Number = 50;

        var _x1:Number = cop.x + (cop.width/2);
        var _y1:Number = cop.y + (cop.height/2);
        var _baseX:Number = _x1 + (Math.cos(_radians) * _radius);
        var _baseY:Number = _y1 - (Math.sin(_radians) * _radius);

        var _x2:Number = _baseX + (25 * Math.sin(_radians));
        var _y2:Number = _baseY + (25 * Math.cos(_radians));
        var _x3:Number = _baseX - (25 * Math.sin(_radians));
        var _y3:Number = _baseY - (25 * Math.cos(_radians));

        g.beginFill(0xff0000, 0.3);
        g.moveTo(_x1, _y1);
        g.lineTo(_x2, _y2);
        g.lineTo(_x3, _y3);
        g.endFill();
    }

    var _cops:BitmapData = new BitmapData(width, height, true, 0);
    _cops.draw(copCanvas);

    var _bmpd:BitmapData = new BitmapData(10, 10, true, 0);
    _bmpd.draw(me);

    if(_cops.hitTest(new Point(0, 0), 10, _bmpd, new Point(me.x, me.y), 255))
    {
        gameover.alpha = 1;
        setTimeout(function():void{ gameover.alpha = 0; }, 5000);
        stop();

        return true;
    }

    return false;
}

So now my question is: Is there someone who knows how to restrict the view so that the cops can't look through the walls? Thanks a lot in advance.

ps: i have already looked at this tutorial by emanuele feronato, but i can't use the code to restric the visual line of sight.

sentences:
Box2d too much for Circle/Circle collision detection? I'm using cocos2d to program a game and am using box2d for collision detection. Everything in my game is a circle and for some reason I'm having a problem with some times things are not being detected as a collision when they should be.

I'm thinking of rolling up my own collision detection since I don't think it would be too hard.

Questions are:

Would this approach work for collision detection between circles?
      a. get radius of circle A and circle B.
      b. get distance of the center of circle A and circle B
      c. if the distance is greater than or equal to the sum of circle A radius and circle B radius then we have a hit
Should box2d be used for such simple collision detection? There are no physics in this game.

sentences:
Slick2D : translate -> scale -> translate doesn't return to the old position I am trying to implement zoom using Slick2D library.

As I understand, to zoom something on non (0,0) coordinates, we need:

translate so the target point is in (0,0)
apply scale factor
translate the target point back from (0,0)

Code example :

 aGraphics.translate(-width/2, -height/2);
 aGraphics.scale(2,2);
 aGraphics.translate(width/2, height/2);

The issue is, as far I understand, that the scale factor is applied to the translation too. To compensate this, I have use the next code :

 aGraphics.translate(-width/2, -height/2);
 aGraphics.scale(2,2);
 aGraphics.translate(width/4, height/4);

Is this expected behaviour for graphics ? Can I workaround the above effect using push/pop matrix ?

sentences:
Three levels deep composition (player<-character<-spell), with preset character+skill sets So I'm creating a rather generic strategy game similar to Warcraft or League of Legends, which needs to have:

a Player class for representing the users playing the game
a Character class for the character the user is controlling (champions in LoL, heroes in Warcraft)
a Spell class for the spells each character has

Also, each player can own multiple characters, but only one can be active at a time (for now at least...)

So the design issue I'm having is with defining the characters and spells:

I want there to be "presets", similar to how Warcraft and LoL have predefined sets of heroes/champions + spells, i.e. you don't get to choose which spells you want for your character, but you choose a character and it has its own unique spells. And multiple people can pick the same character, in which case they have the same spells too, just on different levels.

First I thought to just create Character and Spell classes, but it's not that simple, since I want it to be easy to define new characters, and defining a character isn't as simple as just creating a new object like this:

char = Character(name='Warrior', spells=[...])

Since I want every player who wants to play "Warrior" to have the same set of spells (every warrior should have FireBall spell while mages have FrostBolt, for example) and same name (Warrior), but different instances.

How should I define something like this? I'm using Python 3.5, but any generic design pattern to solve this is more than welcome.

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:
Projectiles in tile mapped turn-based tactics game? I am planning to make a Laser Squad clone and I think I have most of the aspects covered. But the major headache is the projectiles shot/thrown.

The easy way would be to figure out the probability of hit and just mark miss/hit. But I want to be able to have the projectile to hit something eventually (collateral damage!).

Currently everything is flat 2D tile map and there would be full (wall, door) and half height (desk, chair, window) obstacles.

My idea is to draw an imaginary line from the shooter to the target and add some horizontal&vertical error based on the player skills. Then I would trace the modified path until it hits something. This is basically what the original Laser Squad seems to do.

Can you recommend any algorithms or other approaches for this?

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:
OpenGL Textures not sitting right on model I have been trying to get textures loading properly onto my models but to no avail. I'm using picopng to load my images.

Here is my code.
[Texture code]

std::vector<unsigned char> buffer, image, aaa;

std::ifstream file(location.c_str(), std::ios::in | std::ios::binary | std::ios::ate);
std::streamsize size = 0;
if (file.seekg(0, std::ios::end).good()) size = file.tellg();
if (file.seekg(0, std::ios::beg).good()) size -= file.tellg();
if (size > 0)
{
    buffer.resize((size_t)size);
    file.read((char*)(&buffer[0]), size);
}
else {
    buffer.clear();
}
unsigned long w, h;
int error = decodePNG(image, w, h, buffer.empty() ? 0 : &buffer[0], (unsigned long)buffer.size());

if (error != 0) std::cout << "error: " << error << std::endl;

glEnable(GL_TEXTURE_2D);
GLuint id;
glGenTextures(1, &id);
glBindTexture(GL_TEXTURE_2D, id);

glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_WRAP_S, GL_REPEAT);
glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_WRAP_T, GL_REPEAT);

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

glTexImage2D(GL_TEXTURE_2D, 0, GL_RGBA, w, h, 0, GL_RGBA, GL_UNSIGNED_BYTE, &image[0]);

glBindTexture(GL_TEXTURE_2D, 0);

glGenerateMipmap(GL_TEXTURE_2D);
glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, GL_LINEAR_MIPMAP_LINEAR);
float mipMapingAffectivness = 0.4f;
glTexParameterf(GL_TEXTURE_2D, GL_TEXTURE_LOD_BIAS, mipMapingAffectivness);

Any advice?

[Update]
I have tried flipping the image but to no avail, I have tried all 8 orientation variations and non seem to work.

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:
Architecture to draw many different objects in OpenGL I have some objects that I want to draw. I am not sure how I can create my architecture in a way where I can draw everything as fast as possible.

As example:

class MyObject
{
  float[] vertices;
  float[] colors;
  float[] textures;

  public MyObject()
  {
    //fill every buffer with data
  }

  public void Draw()
  {
    //set shader
    //set shader uniforms etc.

    //foreach buffer
    BindBuffer();
    VertexAttribPointer();

    DrawArrays();
  }
}

In this way, I can draw every object like myObject.Draw after it is constructed. The problem would be, that if I have 5000 objects, I have 5000 draw calls. I need to set the shader every time even if I loop over the 5000 objects because I don't know if they use the same shaders.

Another way:

class MyObject
{
  bool needsToBeChanged;

  public MyObject()
  {
    //set my edge points
    needsToBeChanged = true;
  }

  void ChangeMyObject() //e.g. I changed the height of my object
  {
    needsToBeChanged = true;
  }
}

class GLWindow
{
  float[] vertices;
  float[] colors;
  float[] textures;

  GameLoop()
  {
    foreach(MyObject myObj in allMyObjects)
    {
      if(myObj.needsToBeChanged)
      {
        //get objects points for drawing it and set the global buffers up

        myObj.needsToBeChanged = false;
      }
    }

    DrawArrays(); //draw only once (because every data is in the buffer)
  }
}

Only 1 draw call for everything. I guess this will be faster than first method. The problem on this code is the big buffer that contains everything. Let's imagine we have inherited from MyObject and want to draw objects in different shapes. Now the Loop gets more complicated. You may have to split it because you need another shader for example for text. Now you have 2 arrays... And with other changes the Loop becomes more and more complicated and harder to maintain.

What solutions (beside the both) are available for this kind of problem? Can I use the first way or is there a better way where I can reduce the draw calls? How is it solved in other applications?

sentences:
How to compute the moves amount in a match-3 game? I have a match-3 mobile game, similar to these popular games in the store.
Mechanics are different, but the gameplay stays the same:

NxN board
X moves
Y objectives to complete to win
tons of different levels. When you complete a level, you unlock a new one

When you run out of moves, you have to buy moves or try again, so you have to think on each move.
And the problem is in the moves, I'm trying to calculate the amount of moves required for each level. I want it to be be slightly lower than the average, so it takes 3-4 attempts for an average player to complete.
I discovered that "being stuck" 2 or 3 times on a level makes it a lot more fun, than completing levels each time with a single attempt.
My current solution
I have couple hundred players and with them - some statistics.
With each level attempt (lost or won) I save it on my server to use it for calculations:
ID | Level Number | Used Moves | Lost/Won

Then, each week, I compute a sum of attempts on each level, and I do this for all players. Then, I compute a mean average on each level:
avg_lvl_attempts = sum_level_attempts / player_count

So if 3 people took level 10, all of them with 4 attempts, it would be:
avg = (4 + 4 + 4) / 3 = 4

Which means that it takes the players 4 attempts, on average, to complete level 10. Then, based on that, I increase the amount of moves on level 10 by a small amount, so it's a little bit easier for them (because I want to achieve 3 on average). And I do that for each level.
The problem with that solution is that it can produce strange results, for instance if someone had 130 attempts (it happens sometimes).
The question
Is there any algorithm, or mathematical trick to do these kind of things more accurately, like excluding edge cases etc?

sentences: How would I get the positon of my avatar's head? I'm developing an XNA Game. Basically, I have a first person camera. What I want to do is get the position of an avatar's head. The reason I want to do that is because I want the camera to be on the avatar's head thus, giving it a real life view (you can see the hands and that type of stuff.

sentences:
Missing colors in Collada export from Blender I've noticed something strange in a Collada DAE export from Blender. I've assigned Diffuse BDSF colors to 4 faces of a cube as shown here:

http://www.4shared.com/photo/_hM04zywba/blendcube.html

It renders fine in Blender but after exporting to the following DAE file the diffuse and ambient color's RGB values stay the same for all materials. Shouldn't each material block in DAE have different values? Do I need to do something more in Blender to save the material info?

http://www.4shared.com/file/KdzuIwWGce/matcube.html

sentences: CCD in C++ Console application I am writing a game in a c++ console application. I would like to detect whether or not there is a collision between two objects, and displace them accordingly. All sprites are simply strings drawn on screen (Ex. a sprite with x 5, y 5, width 3, height 3 and the image "XXXXOXXXX" would create a 3-by-3 box of X's with a O in the middle). All objects have a x, y, length, and width which can aid in looking for potential collisions; however I would like to look at the actual string for finer collision detection. I am relatively new to the concept of continuous collision detection and I am having trouble finding the answer via Google. Does anybody know how I would go about doing this? Thanks in advance.

sentences:
CCSprite x and y comparison I have 2 CCSprites and I want to tell if their x and y are equal I tried this:

if(sam.position.x == tom.position.x && sam.position.y == tom.position.y){
NSLog(@"Hooray!");
}

Although I do not think this is the right way to do this. Could anyone help me?

Thanks.

ALSO The CCSprites are named sam and tom.

sentences:
How do you get the world position from the screen position in a URP shader graph used in a ScriptableRenderPass? I'm using a shader graph in the Universal Shader Pipeline (URP) to do some post-processing in a ScriptableRenderPass. How do I get the world coordinates of the screen position?
I have tried using the View Direction node, set to World:

And I have tried the Screen Position node, with either a Transform node or Transformation Matrix node:

Neither seems to be working because the colors change as I move the camera around, but I would expect the color to stay the same since the world position of the GameObject in the view is not changing. Any suggestions?

sentences:
Splitting into files - how much splitting? If I say I have a hierarchal entity framework, rather than a component model. Something like:
(Yes, this is made up)

Weapon->Gun->AutomaticGun->MP44
Or, more of a classical example:
Entity->MovableEntity->Enemy->WalkingEnemy

How far would you split up the source/header files for readability and organization? Is it best to go something like Entity.cpp, MovableEntity.cpp, Enemy.cpp, etc. or would an approach like Entity.cpp [containing Entity and MovableEntity] and Enemy.cpp [containing Enemy and WalkingEnemy] be better?  (Or in a more language agnostic way, an Enemy file and an Entity file vs a file for each class?)
Also, would this affect anything other than readability and organization?

sentences:
Send Messages in Update Function Button UI Unity 5 I've been working on a project where i need to fulfill the following behaviors:

1) when clicking anywhere in the screen the character should do something

2) there are some buttons so except when you click a UI Button (which is the pause button in this case )you should move.

So, the problem is since the character behavior is in the Update Function when the player clicks on the pause button unity executes first the Update function, moves the character and pauses after that.

Is there any way to pause tell Unity to execute first the OnClick function inside the UI Button than the Update function?

What i tried was this but it didn't work:

1)do 2 booleans click1,click2;

2)click1 equals true when we click anywhere in the screen

3)click2 equals true when we click on the UI Button

4)then i do something like this so unity should wait 1 frame before executing the movement when click1 == true && click2 == false, we execute the behavior else that means we hit the UI button.

This is how it looks in actual code

void Update()
{
    if (platform == RuntimePlatform.WindowsEditor || platform == RuntimePlatform.WindowsPlayer)
                {
                    Debug.Log("1");
                    if (v_click1 == true && v_click2 == false)
                    {
                        if (v_inGround)
                            v_changeGravity = ChangeGravity();
                        Debug.Log("2");

                        v_click1 = false;//reset the value
                    }
                    if (Input.GetMouseButtonDown(0))
                    {
                        Debug.Log("3");

                       v_click1 = true;
                    }
                }
}

As you can see i have logged some numbers and Number 4 is not there but it displays when Onclick function sends the message from the UI Button.

The order this is taking is the following:

1

3 we detect a click which is in the button but we dont know that

2 we do the behavior(movement)

4 the function for pause gets called...

So, this is basically the problem is there any way to do this or should i just try not using the UI?

if the question is too confusing i will try to rephrase it haha.

Thanks!!

sentences:
Procedural terrain generation Currently I have a procedurally generated planet using multiple octaves of perlin noise. The thing is, that I don't generate heightmap, but rather get the values of perlin function and apply them directly to vertices.

I'd like to add more surface features. Right now terrain is very rough, there are no flat areas, or rivers.

How can I add those features? Normally there would be some sort of heightmap-filtering, for example voronoi + perlin = good-looking terrain with flat surfaces.

Is it possibile to somehow mix fractal algorithms? If so how, which ones and where can I find more info about it?

sentences:
How to correctly generate tile map with atlas in cocos2d-x (4.0) without TMX file? Good afternoon!
Can someone give me advice, what is the proper way to generate TileMap?
I know about TiledMapTileLayer in LibGdx. With that tool i could set tile map cell by cell, something like this:
TiledMapTileLayer.Cell cell = new TiledMapTileLayer.Cell();
cell.setTile(new StaticTiledMapTile(splitTiles[(int)cellCoordinates.x][(int)cellCoordinates.y]));
cell.setFlipVertically(tileInfList.get(i).isFlipVertical());
cell.setFlipHorizontally(tileInfList.get(i).isFlipHorizontal());

So algorithm was like this:

I parsed my "custom" xml file with map properties (not TMX), such as position of tile in image atlas and position in game world.
I created new TiledMap() and TiledMapTileLayer.
Added cells to a layer. Than render layer.

But can Cocos2d work with tiles in such a way? Or i should create individual sprite for this purpose (like cells in LibGdx)?
What is the best way to positioning and create map if you have an atlas and xml file with map properties?
<TileMap defaultScale="1.0" image="img/love_island_atlas.png" maxScale="2.0" minScale="0.25" tileBorderSize="2" tileHeight="100" tileMapHeight="2700" tileMapWidth="3400" tileWidth="100" tilesPerAtlasColumn="4" tilesPerAtlasRow="4">
  <items>
    <list>
      <Tile flipHorizontal="false" flipVertical="false" height="100" index="1" width="100" x="480" y="-1136"></Tile>
      <Tile flipHorizontal="false" flipVertical="false" height="100" index="10" width="100" x="2080" y="464"></Tile>
      <Tile flipHorizontal="false" flipVertical="false" height="100" index="1" width="100" x="3780" y="-1036"></Tile>
      ....
    </list>
</items>

Thank you guys!

sentences:
Problems implementing a Sign Sprite in Libgdx I am making a tile based game in LibGdx. I am using the TiledMap in .tmx format. I want when my player reaches a tile whose property is set (tileType -> sign), he should see a Sign sprite and on colliding which, he should see the signScreen (small) in the Parent screen game screen.
Here is my code

//calling this method at the beginning ...in create()

    TiledMapTileLayer layer = (TiledMapTileLayer) map.getLayers().get(1);
    //test ="layer selected :-> "+layer;
    TiledMapTile tile;

        for(int y=0; y< mapHeight;y++){
            for(int x=0;x<mapWidth;x++){

        //Step-1: Search within the level map where should we construct a Sign
        //*
                try{
        tile = layer.getCell(x,y).getTile();

        if("sign".equals(tile.getProperties().get("tileType").toString())){
        layer.setCell(x, y, null);

//creating my sign sprite deleting that tile .. at the same position
            signs.add(new Sign(x , y , signCount++));

        }

    }
        catch(NullPointerException e){
            System.out.println("While Searching Tile for Sign ->"+e);
        }
            }
        }
}

But this code is not working. I checked ...things look Ok. But if I am placing this code in the collision detection code, where I am checking collision of player with the Layer of map. It works. But I do not want to put the code there.Because, if I am searching and replacing for the tile there..it outputs as if...........

"when the player reaches there and touchs the sign, then my Sign sprite becomes visible and at the same time, the child screen appears"....But I want all the tiles that I have marked as (tileType -> sign) should be checked at the beginning and replaced with my Sign Sprite.

Please suggest

Is there any problem with the above code or the loop
Is there is any other way to implement such a sprite that can communicate to player through a small screen .. i.e. illusion of telling something.

sentences:
Cocos-2D asteroids style movement (iOS) So I have a CCSprite subclass, well call this Spaceship. Spaceship needs to move on a loop, until I say othersise by calling a method. The method should look something like

- (void)moveForeverAtVelocity
{
  // method logic
}

The class Spaceship has two relevant iVars, resetPosition and targetPosition, the target is where we are headed, the reset is where we set to when we've hit our target. If they are both off-screen this creates a permanent looping effect.

So for the logic, I have tried several things, such as

CCMoveTo *move = [CCMoveTo actionWithDuration:2 position:ccp(100, 100)];
CCCallBlockN *repeat = [CCCallBlockN
  actionWithBlock: ^(CCNode *node) {
    [self moveForeverAtVelocity];
}];

[self runAction:[CCSequence actions: move, repeat, nil]];
self.position = self.resetPosition;

recursively calling the moveForeverAtVelocity method.

This is psuedo-code, so its not perfect. I have hard-coded some of the values for the sake of simplicity.

Enough garble: The problem I am having, how can I make a method that loops forever, but can be called and reset at will. I'm running into issues with creating multiple instances of this method. If you can offer any assistance with creating this effect, that would be appreciated.

sentences:
Python: I have a python statement which should work but it doesn't The error in the picture is highlighted in red.

So, I have used this code on another computer and it worked, why wont it work now? I may have made a really small and stupid error and if I have I'm sorry for wasting your time but, it should work. By the way, this is only made to run in the python shell and it is not supposed to have an graphics except for the text.

For a bit of context, this is being used at the beginning of a game I am creating and it is used to determine the difficulty level.

If this isn't supposed to work at all but there is an alternative, I would appreciate the help.

All help, comments and answers are appreciated.

sentences:
FPS using mouse to move rather than keys Hi I am developing a First person game but would like to use the mouse to move on a click to move as opposed to the keys. I also need to disable Y movement and restrict the x movement to 180. What ever values I enter into the input manager, it seems to be ignoring them as I still have both x and y when I run the game.

I dabbled with the standard unity FPS but is seems very jagged on movement and from what I can see being a new user, their doesn't seem to be a way to restrict y movement. Can someone help with this or suggest a good tutorial on this type of movement. Thanks

sentences: Solitaire Game: Transferring Cards Design in C++ So, I'm working on a Solitaire game. I already created a the classes: Card, Pile, Stock. Each work as expected on it's own. My question is: What possible design for managing moving card(s) between the 7 piles, the stock (the waste) and the foundations? I want a possible design that is suitable for managing these game objects so they can work together smoothly. Any help is greatly appreciated.

sentences:
Differences between storyboarding for game design vs. web design I'm looking to UX and storyboard out a web adventure game. The goal being to have an area to show what the UI/UX would look like (mockups), and ability to add dialog/blurbs to describe the screen.

I was thinking InVision, but that seems strictly for web development mockups. I could also simply draw them in Photoshop or on paper, but was looking more for something game design specific.

Are there significant differences between storyboarding for game design as opposed to web design? If so, how do UX or storyboarding tools cater to those differences?

sentences: What is an expected conversion rate in a free to play game? I understand that there's a lot of factors at play that decide how much free users will become paid users. What can be expected from different marketing strategies such as selling non-gameplay impacting items, selling gameplay impacting items, selling subscriptions, etc? An ideal answer would have statistics showing numbers from different games?

sentences:
Rendering Problems(Artifacts, Flickering) with the Mirage Solo VR Headset Im getting some strange flickering artifacts when testing on device (Mirage solo), this problem occurs on Unity 2018.3.2 and Unity 2019.1.2. Its not happening on other devices such as the OculusGo, Google Pixel, Samsung s7,s9. It seems to be only occuring on devices that use Qualcomm Adreno 540 GPU. Has anyone else encountered anything like this if so, did you fix it and how? The Environment is using a custom shader, the robot character is simply using a unity standard shader and there is a hologram at the side(right) which is using a custom shader.

Hardware: Snapdragon 835 SoC Qualcomm Adreno 540 GPU

Video: https://streamable.com/

Screenshots:

Bad:

Good:

sentences:
Water simulation in Isometric game I'm creating a game in Flash AS3 in which the player needs to modify land in order to direct the water in the right direction.

However, water simulation is a new topic for me and I'm kinda stuck. It doesn't have to be like realistic water, with ripples and stuff, but it has to flow, and if there's enough water, it needs to rise.

I've thought up two different types of water:

A Spring: Infinite source of water. Used for simulating seas and stuff.
Water block: Just one unit of water.

My current implementation shows how I'd like the water to spread, but it doesn't rise, and doesn't allow for finite water. Also, the spreading isn't accounting for any amount of water, it just duplicates instead of actually moving units of water.

I'm curious to how you guys would solve this problem. Any examples/pseudo-code is always appreciated.

Current version: http://dl.dropbox.com/u/319897/ProjectWater.swf
You can manipulate the land by pressing left mouse. And can simulate one step of water at a time by pressing A.

Source of the water part: http://pastebin.com/Js2kYt4y

sentences:
Each level is one scene? I'm planning to get into Unity 2D tools - so in order to start off I decided to create a little breakout clone. However, I'm not sure how to manage levels. When I wrote Breakout using MonoGame, I just had one class Level which read a XML-file for the level itself (kind of a simple tilemap).

Now that Unity has a graphical interface I could probably just create one scene for each level and put all the blocks in there. Is this a normal approach to handle levels in Unity - or would it be more appropriate to have one scene that also loads objects by using something like a XML file?

Thanks!

sentences:
Unity Manual Instance Example Shader contains errors The Unity Manual has a page on GPU instancing. One of the examples, titled "Adding instancing to vertex and fragment Shaders", causes the following errors to printed to the console when saved in a Shader file:

... unrecognized identifier 'UNITY_INSTANCING_BUFFER_START' at line ... (on d3d11)
... not enough actual parameters for macro 'UNITY_ACCESS_INSTANCED_PROP' at line ... (on d3d11)

This error message does not make any sense. The identifier is supposed to be created in the UnityInstancing.cginc file, if the render target is supported. This thing is, d3d11 is supported:

Line 211: #ifdef UNITY_INSTANCING_AOS
    #define UNITY_INSTANCING_BUFFER_START(buf)
    ...
    #define UNITY_INSTANCING_BUFFER_END(arr)
    ...
#endif

Line 41: #if defined(SHADER_API_D3D11) || ...
    #define UNITY_INSTANCING_AOS
#endif

My question:

Why does Unity say that these operations are not supported on this platform?

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:
SDL text or additional images not loading I've got a basic side scroller that allows the user to run and jump around. I've used various tutorials to get this far, but I can't seem to get any text to render, no matter what method. I also can't get any images to render outside of my draw() function which is rendered at run time, which I think is my problem. (Is it possible to recall the function again to load another image?)

I can't just give a line of code to show the issue since the whole program is interwoven together:

http://pastebin.com/d1CNiVf5

I'm not asking for someone to go through the code and fix everything, just if you could point me in the right direction, or at least know what is causing the problem that would be great!

(Sorry about having all the code in one file, I'm bad a modularising it and kept on getting errors early on in the project because of it. So for learning purposes it's going to be in one file for now).

Edit: At the moment the priority is to get projectiles working. I've tried SDL_UpdateRect and similar but nothing has helped so far.

Edit #2:
SO I've created a new function and have called it on top of the map, like it should do. But now I get a strange output:
http://youtu.be/8piWyjfDgbI

sentences: GLSL ES 2.0 alternative for dFdxFine I'm trying to generate normal map on the fly in fragment shader. The implementation I've found is using dFdxFine function, which can't be used in WebGL, is there any alternative for dFdxFine in GLSL ES 2.0?

sentences:
How do I upscale my scene to a larger viewport? I want to:

Render my scene to a small viewport (some divisor of the full screen size).
Stretch the rendered image to cover the full screen size.

For example I want to render a complex, very slow scene at 960x520 and then stretch the resulting image over a full 1920x1040 screen.

Texture2D.LoadTextureFromTexture() can achieve that result, but is incredibly slow (far, far too slow for gaming). Similarly, Device.CopySubresourceRegion() or Device.CopyResource() copies the pixels exactly based on the size of the image, so they don't stretch at all and a 960x520 image will simply take up a corner of the full screen.

I could render the texture onto a quad, but I wanted to know if there was a way to do this programmatically before writing a shader just to stretch an image.

sentences: HTML5 tags on my website? I'm not here to ask about the merits of HTML 5, CSS 3, Javascript, etc. as game development tools.  Lord knows how many people have asked about that already.  No, what I'm curious about is what kind of browsers different types of gamers tend to have.  I'm starting a game development studio, and I want to use some HTML 5 and CSS 3 features on my website.  I know where to look for browser compatibility, but I'd like to know how old a browser I should cater to.  My target audience is primarily teenagers through young adults.  Is there any risk of alienating potential players with fancy HTML 5 features, or is it safe to assume their browsers are reasonably up to date?

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: Line-Line intersection vs. DDA Recently, I have wanted to make a game using raycasting techniques, and I saw this video where a guy used an algorithm called "Line-line intersection" . I have normally used the DDA algorithm for raycasting, and that is what I see most raycasters use, is there a reason why that is? Is DDA faster for raycasting? Is there any case to use one over the other?

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:
Ray Intersecting Plane Formula in C++/DirectX I'm developing a picking system that will use rays that intersect volumes and I'm having trouble with ray intersection versus a plane. I was able to figure out spheres fairly easily, but planes are giving me trouble. I've tried to understand various sources and get hung up on some of the variables used within their explanations.

Here is a snippet of my code:

   bool Picking()
 {
  D3DXVECTOR3 vec;
  D3DXVECTOR3 vRayDir;
  D3DXVECTOR3 vRayOrig;
  D3DXVECTOR3 vROO, vROD; // vect ray obj orig, vec ray obj dir
  D3DXMATRIX m;
  D3DXMATRIX mInverse;
  D3DXMATRIX worldMat;

                // Obtain project matrix
  D3DXMATRIX pMatProj =   CDirectXRenderer::GetInstance()->Director()->Proj();
                // Obtain mouse position
  D3DXVECTOR3 pos = CGUIManager::GetInstance()->GUIObjectList.front().pos;

                // Get window width & height
  float w = CDirectXRenderer::GetInstance()->GetWidth();
  float h = CDirectXRenderer::GetInstance()->GetHeight();

                // Transform vector from screen to 3D space
  vec.x =  (((2.0f * pos.x) / w) - 1.0f) / pMatProj._11;
  vec.y = -(((2.0f * pos.y) / h) - 1.0f) / pMatProj._22;
  vec.z = 1.0f;

                // Create a view inverse matrix
  D3DXMatrixInverse(&m, NULL, &CDirectXRenderer::GetInstance()->Director()->View());

                // Determine our ray's direction
  vRayDir.x = vec.x * m._11 + vec.y * m._21 + vec.z * m._31;
  vRayDir.y = vec.x * m._12 + vec.y * m._22 + vec.z * m._32;
  vRayDir.z = vec.x * m._13 + vec.y * m._23 + vec.z * m._33;

                // Determine our ray's origin
  vRayOrig.x = m._41;
  vRayOrig.y = m._42;
  vRayOrig.z = m._43;

  D3DXMatrixIdentity(&worldMat);
  //worldMat = aliveActors[0]->GetTrans();
  D3DXMatrixInverse(&mInverse, NULL, &worldMat);

  D3DXVec3TransformCoord(&vROO, &vRayOrig, &mInverse);
  D3DXVec3TransformNormal(&vROD, &vRayDir, &mInverse);
  D3DXVec3Normalize(&vROD, &vROD);

When using this code I'm able to detect a ray intersection via a sphere, but I have questions when determining an intersection via a plane. First off should I be using my vRayOrig & vRayDir variables for the plane intersection tests or should I be using the new vectors that are created for use in object space?

When looking at a site like this for example: http://www.tar.hu/gamealgorithms/ch22lev1sec2.html

I'm curious as to what D is in the equation AX + BY + CZ + D = 0 and how does it factor in to determining a plane intersection?

Any help will be appreciated, thanks.

sentences:
Implementing AI to hide behind obstacles I am developing an AI simulation of predator and prey. I would like to simulate the AI hiding behind obstacles, if it is being chased. But I am still trying to figure out the best way to implement this.

I was thinking along the lines of checking on which side of the obstacle the predator is on and trying to go on the opposite side. Maybe using the A* path finding algorithm to ensure that it gets there using the shortest path.

Now the main reason I am writing is in case somebody is able to point me in the right direction of implementing this (maybe somebody has done this before) or have any other good ideas how to implement it. I have never done anything like this before in terms of programming AI or making any game.

All the obstacles are either horizontal or vertical squares/rectangles.

Additional Info: The map is based on x,y positions with each agent moving at a set velocity.So the map is not entirely tile based, also for that reason I am unsure if A* would actually work in this situation for me.

Here is an image of the situation:

Please also note that the red circle is the predator while the green circle is the prey being chased by the predator.

sentences:
Screen effects and antialiasing I have been working on a game for a while using glut for basic window creation.
I was rendering to an offscreen buffer so that I could implement various effects like screen bulging, motion blur, refraction, etc. I also used the screen texture with antialiasing (fxaa).

Now I have changed from glut to sfml. I switched on the in-built antialiasing and it looked much better than my version, but now I don't have the screen in a texture so I can't use the screen effects.

So my question is, how to people normally deal with this issue? Can I take advantage of sfml's antialiasing functionality and retain my effects? I thought about using glReadPixels, but that seems way too slow. Does sfml do offscreen rendering behind the scenes and can I access that texture?

This is not specific to sfml. How do AAA games do it? Do they always implement their own antialiasing techniques?

sentences:
How should I plan the inheritance structure for my game? I am trying to write a platform shooter in C++ with a really good class structure for robustness. The game itself is secondary; it is the learning process of writing it that is primary.

I am implementing an inheritance tree for all of the objects in my game, but I find myself unsure on some decisions.

One specific issue that it bugging me is this:

I have an Actor that is simply defined as anything in the game world. Under Actor is Character. Both of these classes are abstract.

Under Character is the Philosopher, who is the main character that the user commands. Also under Character is NPC, which uses an AI module with stock routines for friendly, enemy and (maybe) neutral alignments.

So under NPC I want to have three subclasses: FriendlyNPC, EnemyNPC and NeutralNPC. These classes are not abstract, and will often be subclassed in order to make different types of NPC's, like Engineer, Scientist and the most evil Programmer.

Still, if I want to implement a generic NPC named Kevin, it would nice to be able to put him in without making a new class for him. I could just instantiate a FriendlyNPC and pass some values for the AI machine and for the dialogue; that would be ideal.

But what if Kevin is the one benevolent Programmer in the whole world? Now we must make a class for him (but what should it be called?). Now we have a character that should inherit from Programmer (as Kevin has all the same abilities but just uses  the friendly AI functions) but also should inherit from FriendlyNPC.

Programmer and FriendlyNPC branched away from each other on the inheritance tree, so inheriting from both of them would have conflicts, because some of the same functions have been implemented in different ways on the two of them.

1) Is there a better way to order these classes to avoid these conflicts? Having three subclasses; Friendly, Enemy and Neutral; from each type of NPC; Engineer, Scientist, and Programmer; would amount to a huge number of classes.

I would share specific implementation details, but I am writing the game slowly, piece by piece, and so I haven't implemented past Character yet.

2) Is there a place where I can learn these programming paradigms? I am already trying to take advantage of some good design patterns, like MVC architecture and Mediator objects. The whole point of this project is to write something in good style.

It is difficult to tell what should become a subclass and what should become a state (i.e. Friendly boolean v. Friendly class). Having many states slows down code with if statements and makes classes long and unwieldy. On the other hand, having a class for everything isn't practical. 3) Are there good rules of thumb or resources to learn more about this?

4) Finally, where does templating come in to this? How should I coordinate templates into my class structure? I have never actually taken advantage of templating honestly, but I hear that it increases modularity, which means good code.

sentences:
Fast 2D collision detection in an unbounded space I'm trying to do collision detection on a large number of entities of greatly varying size in an unbounded space.  The entities are circles, so it's relatively easy to check if two are colliding.  However, with a large number of entities the simulations slows down a lot when I code it to check every entity against every other (for n entities, I believe it is n*(n-1)/2 checks, way too many!)  Here's my though process so far:

First, I considered using a grid of some sort, like described in steps 1-2 of the answer here: Fast, accurate 2d collision

There are, however, a few problems with this:

1) It is an unbounded space.  Where do I start and end the grid?  How do I determine the size of each square in the grid in a world where some objects are literally tens of millions times larger the other objects?

2) Even if I somehow manage to adjust the size of the grid every frame without using too much processing power, so that it adjust to fit the most distant objects, (unlikely that I could do this efficiently) this is still not a solution.  If tons of objects are clustered in a 10,000x10,000 space, and one object goes shooting off into space 100 billion units of distance away, the grid would "zoom out", leaving all of the objects in the smaller 10,000x10,000 space in one square, which would defeat the purpose of making a grid in the first place.

For these reasons, I'm thinking that a simple grid is not the best idea...

I looked at BSP's, and I admit that I don't fully understand the concept, but it seems like it does not apply well to my situation (especially since I am using circles and BSP seems better suited to a more complicated polygonal world).

Quad trees seem promising (something like this perhaps: http://www.youtube.com/watch?v=qJJnzSLrC1E) but I foresee at least two potential issues:

1) I can calculate the "farthest away objects" each frame to give calculate GreatestXValue, LeastXValue, GreatestYValue, and LeastYValue, for each frame. From that I have a rectangle to work with that contains all entities.  However, I will have to redo this each frame, which means that I have recreate the the entire quadtree each frame: no shortcuts on calculations done in previous frames.  Is this a problem or do most game/simulation programmers have to completely recreate the quadtree each frame anyway?

2) (Probably the bigger problem) How do I handle a massive object in the vincinity of many small objects? Think about many circles with radius 5 being very close to, resting against, or colliding with a circle with radius 100,000. That massive object will be in many, many grid squares, and it seems to me that the situation would force the creation of a tree that is far too broad and deep.

Am I on the right track with my thought process? Where do I go from here?  Thank you very much for your time and help!!

sentences:
Dynamically creating astar node map by triangular polygonal map My game's map format uses a bunch of triangles to make up the platforms and terrain in 2d. Right now I can set up a 2d array of nodes for the A* (A star) algorithm that basically is a bunch of rectangles across the maps x and y that can be set to "wall" if the A* algorithm should try to go around it.

However I want a function in the map loader to create the node overlay if the nodes are not specified. I was thinking if more than n percent of the A* rectangle overlaid on map was filled by polygons I could mark that entry in the array as "wall". However I'm stuck on how to do this (or even start) where/when the triangles can be overlapping and also of variable size.

sentences: What colors to choose for colorblind people? I'm creating a game. Color coding is its main gameplay feature. What colors should I choose so the game will be colorblind-friendly? (I need 4 colors)

sentences:
Texturing a PyOpenGL 3D Cube with PySDL2 So, I've just started learning OpenGL with PySDL2, and I've created a class that will create a cube to the window that I've created with PySDL2. What I'd like to do now, is to figure out a way to texture the cube. I don't believe that the actual texturing part is the problem, but actually loading the image. I've tried to do this with PySDL's image loader, but this causes an error from the OpenGL texture creator. Here is my code to load an texture and bind it to OpenGL:

def LoadTexture(self, filename):
    """Loads a texture for the cube"""
    surface = SDL_LoadBMP(filename)
    #Checks if the loading succeeded
    if surface:
        #Translate the LP_SDL_Surface-pointer got from SDL_LoadBMP() to a real SDL_Surface
        texture_surface = surface.contents
        texture_format = GL.GL_RGBA
        GL_TEXTURE_ID = GL.glGenTextures(1)
        GL.glBindTexture(GL.GL_TEXTURE_2D, GL_TEXTURE_ID)
        GL.glPixelStorei(GL.GL_UNPACK_ALIGNMENT, 1)
        GL.glTexImage2D(GL.GL_TEXTURE_2D, 0, 3, texture_surface.w, texture_surface.h, 0, texture_format, GL.GL_UNSIGNED_BYTE, texture_surface)
        return GL_TEXTURE_ID
    return None

And the error that gives looks like this:

TypeError: ("No array-type handler for type <class 'sdl2.surface.SDL_Surface'> (value: <sdl2.surface.SDL_Surface object at 0x030762B0>) registered", <OpenGL.GL.images.ImageInputConverter object at 0x02EC49F0>)

I'm using Python 3 so using something like PIL won't work for me. Any ideas how to get the texture loaded, preferably with PySDL2?

sentences:
Rotating 2D positions without rotating graphics I am working on a basic 2D game from an overhead/fake isometric perspective. Arrow keys move the camera left/right/up/down. The trouble occurs when I tried to add rotation.

I want the player to be able to rotate the camera (or map?) around the camera's center. The sprite positions should move during the rotation, but the sprite graphics should not rotate. For example, the sprites will always point "up" even as their position rotates around the screen.

I thought this was would be easy. Just keep track of the X, Y, and rotation of the camera. However, I am having some issues. Here is a snippet of my code (Go with the Pixel 2d library):

if win.Pressed(pixelgl.Key1) {
    camRot += camRotSpeed * dt
}
if win.Pressed(pixelgl.KeyLeft) {
    camX += camSpeed * dt
}
// similar for other key presses...

// Draw objects
for i, entity := range entities {
    sin := math.Sin(camRot)
    cos := math.Cos(camRot)
    adjustedCamX := camX*cos - camY*sin
    adjustedCamY := camX*sin + camY*cos
    adjustedMatrix := matrices[i].Moved(pixel.V(camX, camY)).Moved(pixel.V(adjustedCamX, adjustedCamY))
    entity.Draw(win, adjustedMatrix)
}

There are two issues: (1) after rotating, using the arrow keys now moves the camera at an angle instead of up/down/left/right and (2) I do not know how to rotate around the screen's center rather than whatever the current orientation is (0,0 in the bottom left?).

Note: The Pixel library makes use of transformation matrices rather than pure coordinates. At first I thought this was good (I can just do a rotation on the entire screen!) but then the graphics rotate as well. As such, I just try to emulate using pure coordinates and ignore the matrix (see the line with adjustedMatrix, the matrices[i] is just that entities' X Y position).

An example of what I am trying to achieve can be seen in the first few seconds of this video

sentences:
How to access variables of uninitialized class? So I've gone with a somewhat singleton approach to my game class:

#include "myGame.h"

int main () {
    myGame game;
    return game.Execute();
}

But now I need to define a class that accesses variables in the instance of myGame.

class MotionState {
    public:
    virtual void setWorldTransform (...) {
        VariableFromMyGameClass++;            //<-- !?
        ...}
};

I'm trying to integrate this class into my project from an example that just uses globals.  How can I access variables of myGame class in the definition of new classes?  Should I give up on my singleton approach?

sentences:
Implementing Valve's checkerboard rendering technique I've been trying to implement Valve's VR checkerboard rendering technique (original document) and was wondering which way would be the best to proceed.

The thing is that I need to "abort" the execution of 2x2 blocks of fragments in a checkerboard pattern considering how GPUs work in blocks of pixels.

I've thought of several approaches which are the following :

Discard fragments in the fragment shader using a condition like this one :

float mod2 = gl_FragCoord.x + gl_FragCoord.y;
float res = mod(mod2, 2.0f);
if (res == 0.0f)
   discard;

Use the stencil buffer and write a checkerboard pattern on it using an image or such.
Use some kind of clipping method where I have several quads in front of the camera forming a checkerboard pattern.

The first approach seems to be the worse because I have to branch and after, discard fragments. And considering the fact that GPUs work in blocks of 2x2 pixels, I need to find a way to abort block by block so that I don't get the fragment shader processed anyway (even with a discard). And I'm not even sure this would force a block to abort and skip the fragment shader.

The second method seems OK, but I'm not sure if there's a better way to do it. Would the fragment shader be processed anyway ?

The third seems to need to process more polygons which is not really a good idea I guess even though it does not require a lot of processing considering they would be simple quads.

What would be the most efficient method (listed here or not) for skipping these blocks ?

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:
Simple Line Formation I'm working on the first formation for my game's troops. These should simply stand on land, facing the same direction.

To achieve this, I tried to create offsets towards a pivot-unit, that is approximately the unit in the center of the formation.
The units are (temporary) elements of a squad list withing the Squad class.
I divide the List by 2 and get the closest integer, that should be the pivot point of the formation. Now I generate offsets for all units on the left side (Unit 1 to pivot-1) and right (pivot+1 to last unit) based on the distance/gaps.

This is the code for the line formation. Sadly, the units are only forming a very stange line with no visually detectable system:

int count = (int)(squadMembers.Count / 2);
pivot = squadMembers[count];
center = pivot.transform.position;
switch (type) {
    case FormationType.Line:
        int space = 5;
        for (int i = 0; i < squadMembers.Count; i++) {
            Unit tmp = squadMembers[i];
            int dist = 0;
            if (i > count) {
                dist = (count + 1) * space;
                center.x -= dist;
            }
            if (i < count) {
                dist = (count - 1) * space;
                center.x += dist;
            }
            tmp.StartMove(center);
        }
        break;
}

It also appears that this only works along the x axis, any idea how i can realize this with the walking/facing direction ov the pivot?

Is there any (obvious) error? How can I improve this script?

PS: Any idea, how I can transform this into a double line (2 Lines behind with half spacing)

sentences:
How can a web game store points online without giving the user the possibility to do the same call but with more points? Imagine I have an HTML5 web game where the user can get points by doing certain activities. The game can be played offline, so there's not necessarily a live internet connection (note: this makes this question other than existing questions). Game state will then be synchronized at a later moment.

How can the frontend tell the server that the user has indeed gained those points without giving the user the ability to cheat? E.g. by doing a REST call with a multitude of his points? How can the server tell the difference between a real call and a fake call?

What I can think of is to send not the points, but e.g. all the moves of the game, and then the server recomputes the game and calculates the gained points? But that is quite hard, and the game must be deterministic in order to give the client and server the exact same result from the moves.

Does anybody know how existing games implement this? Or how it could theoretically be done?

sentences:
Unity 2D Current object force I'm working on a game with an entity firing a shot. This shot could destroy other entities as well as the entity who generated the shot.
My first step was to apply a force to the rigidbody2D of the shot, but when my entity is too fast the shot destroy it (the speed does not match).

I tried adding the speed to the force but the values mismatch by far (the force is a vector of like 150 magnitude, whereas the speed as a magnitude of 1).

I wonder how one can achieve this, to add the current speed of the entity to the shot fired, and i wonder if there's any litterature concerning the way physics is actually handled in Unity, i find very little documentation on the Physics.

Thanks.

sentences:
States, actions logic am I doing it right? Currently I have the follow states:

Need To Run
Run
Need To Walk
Walk
Need To Fight
Fight

Am I misunderstanding it and mixig possible actions with states ?

I mean, to me Need To Run would either return true of false telling wether I should procced to the Run action or not and same goes for the other needs.

While I am fighitng should I have second FSM to threat what skills it should be using for example if it needs to heal or not ?

For instance inside the fight I would have the another FSM for

Need To Heal
Heal
Back To Fight
Use Skill

sentences:
What is the logic behind these design decisions regarding difficulty levels? In some games you are unable to play on the harder difficulties before complete it on a lower difficulty. Why?
Achievements are popular. In some games you do not get an achievement for completing the game on the hardest difficulty (e.g. Bethesda RPG's) but for just about everything else, Why?

sentences: why are my 2d game objects passing through each other? So I've been looking around for a while and can't seem to find an answer for this. I am trying to make a game where you stack shapes as high as possible. I have an OnMouseDrag script so I can grab a shape and put it on top of another. but for some reason when I'm dragging a shape, the shapes will just pass right through each other and glitch and start spinning excessively and also passes through other colliders such as the box colliders 2d on both sides of the screen. If anyone could help me I would very much appreciate it. Thank you.

sentences:
Cheap ways to do scaling ops in shader? I've got an extensive world terrain that uses vec3 for the vertex position attribute. That's good, because the terrain has endless gradations due to the use of floating point. But I'm thinking about how to reduce the amount of data uploaded to the GPU. For my terrain, which uses discrete / grid-based vertex positions in x and z, it's pretty clear that I can replace my vec3s (floats, really) with shorts, halving the per-vertex position attribute cost from 12 bytes each to 6 bytes. Considering I've got little enough other vertex data, and an enormous amount of terrain data to push into the world, it's a major gain.

Currently in my code, one unit in GLSL shaders is equal to 1m in the world. I like that scale. If I move over to using shorts, though, I won't be able to use the same scale, as I would then have a very blocky world where every step in height is an entire metre.

So I see these potential solutions to scale the positional data correctly once it arrives at the vertex shader stage:

Use 10:1 scaling, i.e. 1 short unit = 1 decimetre in CPU-side code. Do a division by 10 in the vertex shader to scale incoming decimetre values back to metres. Arbirary (non-PoT) divisions tend to be slow, however.
Use (some-power-of-two):1 scaling (eg. 8:1), which enables the use of a  bitshift (eg. val >> 3) to do the division... not sure how performant this is in shaders, though. Not as intuitive to read values, but possibly quite a bit faster than div by a non-PoT value.
Use a texture as lookup table to convert the value from decimetres to metres. I've heard that this is really fast.

Or whatever solutions others can offer to achieve the same results -- minimal vertex data with sensible scaling.

sentences: Sharp DX Identity Matrix, Matrix.Forward vector pointing at negative Z I'm trying to take a steady grip on Sharp DX. Already done some work like translating, scaling and rotating objects. Now i have to calculate the rotation matrix using only direction vector and arbitrary UP vector which is Unit Y vector (0,1,0). And this is where everything I know about Direct X graphics falls apart: I filled the Matrix.Forward with the normalized DIRECTION vector, and then crossed it with arbitrary UP (exactly this: DIR cross UP, not the other way), the resulting vector put in Matrix.Right property. Now if I put (0,1,0) in the Matrix.Up property, my model is facing the exact opposite direction to the expected direction (it faces backwards). Further investigation brought me to the fact that the Matrix.Identity matrix faces the NEGATIVE Z direction, which is weird to me as I thought that Identity would face positive X,Y,Z axes. Now I can overcome my problems by flipping any of the axes, but this clearly is not comforting to me, as there is something i must have missed in the meantime. So the ultimate question is: Why my Identity matrix points positive Y axis (good), positive X axis (nice, i expect this) and NEGATIVE Z (help!)

sentences: Continous collision happening in Unity2d I am working on Unity2d. I have a game object called gameobject1 on screen. It holds an image (named "state"). When I drag a tree on a gameobject1 collision is happening continuosly in the same layer instead of once. I already added Physics2Ds component Rigidbody2D on to tree object. Is there any solution for this issue?

sentences: Animate moving object I have a sphere shot out of a cannon which i need to get lined up with another sphere when and if the two spheres collide. Considering that both spheres are moving (one in X and the other is shot at the first one) how would i animate the cannon sphere to line up if the collision occurs? I can use a bool to check if collision but how do i animate the projectile in the animation tab so that the projectile takes into consideration the always changing position of the X moving sphere ?

sentences:
Why doesn't MoveBy work in this example? I'd like to run an action on a sprite using the MoveBy action. After lots of attempts, I can't achieve the goal... I have issues with the MoveBy in 2 different projects, so maybe I'm missing something in the setup... But I can't figure what!

The instruction is like this:

this.platform1Sprite.runAction(cc.MoveBy.create(1, cc.p(200, 0)));

I don't get any error, simply it doesn't work. platform1Sprite is a Sprite. But even with a LabelTTF it doesn't work:

var MoveToAction = cc.MoveTo.create(2.5, cc.p(size.width / 2, size.height / 2));
this.creditLabel.runAction(MoveToAction);

For this last snippet, you can view my complete code here: http://pastebin.com/fGbW4LLH.

The code I linked is somehow similar to the helloHTML5World official example, line 112 has the runAction method applied to a LabelTTF. The official example works, mine doesn't... I can't understand what's the difference!

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:
Movement & Physics in an entity-component system I'm currently playing around with entity-components systems and got started on the movement/collision/physics parts and would like to have some pointers!

It's a basic 2D sidescrolling game, with the goal being something in the style of Terraria. My first goal was to have a character that could run left/right & jump on blocks/tiles and when clicking tiles they'd disappear.

At the moment, each tile/block on the screen is an entity with a Transform(Position) component, a "Renderable component and a Collision component (boundaries)

My player has a Player component(tagging class), a Transform, Renderable, and Physics (velocity, acceleration, mass) and Collision component.

Currently a bit stuck on how to fit in the physics and movement. I read the threads I could find about it here on Stack but left with some questions:

What would be a good approach to let my character move? Should I have a player system that updates the Player's position or velocity? Or should I let it set a state & let another system update the movements of entities based on their velocities and their current state? Leaving the option open that I could move a character by clicking somewhere?
If I were to add gravity, should these affect your acceleration/velocity? I have problems with figuring out how to implement acceleration & which systems could/should be responsible for that..

And unrelated to the questions above, when I was starting on the collision I ran into the issue that it would try to check every single tile against the player & since on a large resolution already 1000ish entities fill the screen it quickly sent performance down the drain. I implemented a quad tree to select the entities only around the player, which seems to work. (Based on http://www.mikechambers.com/blog/2011/03/21/javascript-quadtree-implementation/ but made it from scratch in Python).

But since it takes the current window size as dimensions once the player would move off screen,  the entities wouldn't add correctly anymore. Should I let the Quad Tree grow/shrink in certain directions? (If anyone has experience with using this?)

Thanks in advance!

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:
IDE & Debugging of Official SDK for wii and ps3? I remember hearing that wii and the ds uses CodeWarrior as their IDE. I know xbox uses visual studios but i have no idea what ps3 uses.

What IDE do ps3 developers use and how do they debug? How do wii programmers debug? I always heard they use GDB but is that built into CodeWarrior or is that a separate application?

sentences:
Version control with game development - When should I branch? I recently started using Version Control with my projects (even though I'm working alone on them). I find that it gives a nice way to keep history of the whole development process (with issue tracking) and allows me to keep backups for my projects along the way.

As I slowly discover the features and advantages of using version control, I am stuck around the idea of branching. When should I do it?

Should it be every single time I go and develop a new feature, or only once in a while when I reach a certain milestone?

Obviously, branching is pretty useless when working alone, but I'd rather pick up good habits now and get used to it.

As I was reading the book Game Coding Complete by Mike McShaffry (which is a great book by the way), I got totally lost when the author recommended keeping three branches, something along the lines of:

Main: Main development branch where regular changes are made.
Gold: Gold branch where the last milestone reached is kept.
Research: Branch for testing stuff that could badly impact the Main branch (modifying important components of the game engine, etc.).

Is that how it is supposed to be? How does it really work in the world of game development with big teams of developers?

Basically: When does one usually branch (and merge) in game development?

sentences:
How would I make my Python game Moddable? before you mark it as duplicate, I want to say I have read this: I want to make a moddable game. How does this affect my programming language choice?

And it did not help me. Just for proof of concept, what would I add to

# main.py
import turtle as t
screen = t.Screen()
turt = t.Turtle()
for i in range(8):
    t.forward(100)
    t.right(45)
    t.backward(75)
screen.exitonclick()

to make it so that in another file, you could add something like

import main
main.t.color("red")

to make the turtle a different color.

Basically, what would I add to main.py to make it run the mod settings?

sentences:
How can I process extra mouse buttons using Monogame? I use Monogame for game development. For processing mouse input, I can use the Mouse class to query basic information like left click state, right click state, and screen position. That works fine for a generic three-button mouse (left, right, and scroll wheel), but falls short for more complex gaming mice with side buttons. My question is, how can I query those extra side buttons?

Since Mouse doesn't include that functionality, are there additional C# libraries I can use? How do I account for the fact that mice can have any number of extra buttons and wheels? Is there some standard for representing those additional buttons programatically?

Edit: This question originally also asked about complex keyboards with extra buttons or wheels. Now, I'm asking only about processing extra mouse buttons (ideally any number of extra buttons).

sentences:
Unreal editor warns that Xcode is not installed on MacOS 10.14 I'm running MacOS 10.14.6. When I launch Unreal v4.25.0, I get the following warning:

Xcode was not detected on this Mac.
Metal shader compilation will fall back to runtime compiled text shaders, which are slower. Please install latest version of Xcode for best performance, and make sure it's set as default using xcode-select tool.

When I try to install XCode, I'm told I need to upgrade to MacOS 10.15.
I can't do this due to other software dependencies.
Is there a way to compile Metal shaders from the previous version of XCode somehow? If I can't install Metal, does it matter?

sentences:
Java LWJGL - Monster follow script not working properly I have written a script to be set off whenever a player is within a distance of the monster. The script checks if the x position is greater than or less than the players x, and same for the z. (y is automatically set to terrain) The checkWalkX and checkWalkZ functions work with my monsters walk function, which specifies a new position on a timer and walks to that position. But when I use the same kind of idea for the following, it doesnt work correctly.

public int checkWalkX(Vector3f position) {
    if (Math.floor(this.getX()) != Math.floor(position.x)) {
        if(this.getX() > position.x) return 1; //Greater
        if(this.getX() < position.x) return 2; //Less
    }
    return 0;
}
public int checkWalkZ(Vector3f position) {
    if (Math.floor(this.getZ()) != Math.floor(position.z)) {
        if(this.getZ() > position.z) return 1; //Greater
        if(this.getZ() < position.z) return 2; //Less
    }
    return 0;
}

public void follow(Player player) {
    walking = false;
    following = true;

    if(checkWalkX(player.getPosition()) == 1) this.setX(this.getX() - mobSpeed);
    else if(checkWalkX(player.getPosition()) == 2) this.setX(this.getX() + mobSpeed);

    if(checkWalkZ(player.getPosition()) == 1) this.setZ(this.getZ() - mobSpeed);
    else if(checkWalkZ(player.getPosition()) == 2) this.setZ(this.getZ() + mobSpeed);

    if(Math.floor(checkWalkX(walkToPosition)) == 0 && Math.floor(checkWalkZ(walkToPosition)) == 0) following = false;
}

For some reason when I run this script, the monster will only move within a distance of 2ish. He moves the right ways kinda, but he doesnt follow me. Would anyone know why this is?

sentences:
Box2D collision between dynamic body I'm implementing Box2D for my 2d top down LIBGDX game and i have some struggle with two dynamic body.
Currently, my two bodies are created that way :

    BodyDef bodyDef = new BodyDef();
    bodyDef.type = BodyType.DynamicBody;
    bodyDef.position.set(this.x, this.y);
    this.body = world.createBody(bodyDef);
    PolygonShape collider = new PolygonShape();
    collider.setAsBox(16, 16);
    FixtureDef fDef = new FixtureDef();
    fDef.density = 0f;
    fDef.friction = 0f;
    fDef.restitution = 0f;
    fDef.shape = collider;
    body.createFixture(fDef);
    body.setUserData(this);
    collider.dispose();

So basicly, no rotation, no friction and no restitution. Also, my world have a gravity of 0 (since it's a 2d top down game, i don't that want them to fall). When player 1 collide with player 2, player 2 is moved backward like it was push but i don't want that. I want it to stay where he is, blocking the path to player 1 but he can also move.

Is there a way to do that ?
I have looked for some tips like catching collision with the contact listener but i don't know what to do in the preSolve method.

I'd like some help, thanks !

sentences:
Splitting Graph into distinct polygons in O(E) complexity If you have seen my last question:
trapped inside a Graph : Find paths along edges that do not cross any edges

How do you split an entire graph into distinct shapes 'trapped' inside the graph(like the ones described in my last question) with good complexity?

Please note each vertex has a fixed x,y position.

What I am doing now is iterating over all edges and then starting to traverse while always taking the rightmost turn. This does split the graph into distinct shapes. Then I eliminate all the excess shapes (that are repeats of previous shapes) and return the result.

The complexity of this algorithm is O(E2). I am wondering if I could do it in O(E) by removing edges I already traversed previously. My current implementation of that returns unexpected results.

sentences:
Layer depth problem in XNA puzzle game I am working on puzzle game where tiles are needed to be dragged to their correct place, but at the time of dragging one of the textures goes behind the other texture. How can I bring the texture to the top?

       private void OnDraw(object sender, GameTimerEventArgs e)
       {
                         SharedGraphicsDeviceManager.Current.GraphicsDevice.Clear(Color.CornflowerBlue);

         // TODO: Add your drawing code here
        Color transp = Color.White;
     //   transp.A = 200;
        spriteBatch.Begin();

                   spriteBatch.Draw(Texture.piece[1],Texture.piecerect[1],null, transp,0,Vector2.Zero,SpriteEffects.None,1);

        spriteBatch.End();
    }

sentences:
Obtain rectangle indicating 2D world space camera can see I have a 2D tile based game in XNA, with a moveable camera that can scroll around and zoom.

I'm trying to obtain a rectangle which indicates the area, in world space, that my camera is looking at, so I can render anything this rectangle intersects with (currently, everything is rendered).

So, I'm drawing the world like this:

  _SpriteBatch.Begin(
                SpriteSortMode.FrontToBack,
                null,
                SamplerState.PointClamp,        // Don't smooth
                null, null, null,
                _Camera.GetTransformation());

The GetTransformation() method on my Camera object does this:

    public Matrix GetTransformation()
    {
        _transform =
           Matrix.CreateTranslation(new Vector3(-_pos.X, -_pos.Y, 0)) *
           Matrix.CreateRotationZ(Rotation) *
           Matrix.CreateScale(new Vector3(Zoom, Zoom, 1)) *
           Matrix.CreateTranslation(new Vector3(_viewportWidth * 0.5f,
               _viewportHeight * 0.5f, 0));
        return _transform;
    }

The camera properties in the method above should be self explanatory.

How can I get a rectangle indicating what the camera is looking at in world space?

sentences:
How to add a animation to myPlayer I'm currently making a shoot em up in monogame.

I want to add just one animation to my object. No commands or transitions between animations for different actions: just an object swapping between different images all the time.

For example, my player will have 4 different images for it and I'd want it to always swap trough these images.

Animation guides I've reviewed seem way too complicated for my needs. Unlike the examples they cover, I don't want different animations for different commands.

How can I make this type of simple, always-looping frame animation?

Edit

I managed to make a constantly looping animation to a sprite and but I don't know how to insert into myPlayer.

Game1:
        Texture2D myPlayerAnim;
        Rectangle myDestRect;
        Rectangle mySourceRect;
        Texture2D myEnemyAnim;
        Rectangle myEnemyDestRect;
        Rectangle myEnemySourceRect;
        float myElapsed;
        float myDelay = 100f;
        int myFrames = 0;

Initialize:
            myDestRect = new Rectangle(0, 0, 512, 512);
            myEnemyDestRect = new Rectangle(0, 0, 808, 608);

LoadContent:

            myPlayerAnim = Content.Load<Texture2D>("SpriteSheetPlayerAnim");
            myEnemyAnim = Content.Load<Texture2D>("SpriteSheetEnemyAnim");

Update:
            myElapsed += (float)aGameTime.ElapsedGameTime.TotalMilliseconds;

            if (myElapsed >= myDelay)
            {
                if (myFrames >= 3)
                {
                    myFrames = 0;
                }
                else
                {
                    myFrames++;
                }
                myElapsed = 0;
            }

            mySourceRect = new Rectangle(512 * myFrames, 0, 512, 512);
            myEnemySourceRect = new Rectangle(808 * myFrames, 0, 808, 608);

Draw:

            mySpriteBatch.Draw(myPlayerAnim, myDestRect , mySourceRect,
            Color.White);
            mySpriteBatch.Draw(myEnemyAnim, myEnemyDestRect, myEnemySourceRect,
            Color.White);´

Draw just draws the animations out but I don't know how to insert it into myPlayer. For myPlayer I currently have this but I couldn't figure out how to do it with my animations.

Draw:
myPlayer = new Player(TextureLibrary.GetTexture("player"), myPlayerPos, 200, new Vector2(.3f, .3f), 0, Color.White, 1000, 1);

sentences: How can I make a gameObject jump quick at first then start slowing down after a while? How can I make a gameObject jump quick at first then start slowing down after a while? It definitely has something to do with deltaTime.

sentences:
How to stream OpenGL Framebuffer? I have been trying to find a fairly cross-compatible way to stream a framebuffer from my game to a single client. The client will be on the local network and I want to have the stream be as low latency as possible. I was thinking some form of h264 and UDP but I am not finding a good solution.

Anyone have good advice on creating a stream server as part of my game?

sentences:
How to rotate camera centered around the camera's position? Currently I am using gluLook at like so:

gluLookAt(position.x, position.y, position.z,
          viewPoint.x, viewPoint.y, viewPoint.z,
          upVector.x, upVector.y, upVector.z);

with the above, don't know if you need more information, how could I change it so that the camera acts like its rotating around itself, instead rotating around its viewpoint. You can see the current code at https://github.com/dchhetri/OpenGL-City/blob/master/opengl_camera.cpp, that class was adapted from codecolony.com.

sentences:
Sanity checks vs file sizes In your game assets do you make room for explicit sanity checks, or do you have some generally expected bounds which you assert?

I've been thinking about how we compress data and thought that it's much better to have the former, and less of the latter. If your data can exceed your normal valid ranges, but if it does it's an error, then surely that implies you're not compressing the data well enough?

What do you do to find out if your data is compressed as far as it can be, and what do you use to ensure your data isn't corrupted and ensure it's an official release?

EDIT

I'm not interested in sanity checking the file size, but instead, how you manage your sanity checks and whether you arrange the excess size caused by the opportunity to do sanity checks by using explicit extra data, or through allowing the data enough file space (data member size) to be out of valid range and thus able to be checked merely by looking at the asset in memory after loading.

EDIT

QUOTE:
"runtime performance is valued very highly while maximal compression is merely a nice thing to have"

yes, but we're still having issues with our media being slower than decompression algorithms, especially with situations where programmers and data desginers have not considered the footprint of their data layouts and are unnecessarily creating assets that have redundant storage capacity.

I must assume that there are very few people who consider the importance of bandwidth outside of those working on platforms that are strictly bound by their data throughput rate or storage capacity.

sentences:
Development with multiple libraries I'm almost fresh to the game development and I have one question about libraries.

If I choose one library, such as SFML, to develop the menu of my game, is it possible to merge with, for example, Direct X to handle the graphics(load maps and etc)?

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:
Unity2D jumping inconsistancy I'm tinkering with a unity2D sidescroller, and am trying to make a player controller to jump. However, when I tell my character to jump, it sometimes jumps twice the distance, and I don't know why. Below is my controller script:

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

public class PlayerMovement : MonoBehaviour
{

    public float playerSpeed = 10;
    public float jumpForce = 20;
    private bool ableToJump = false;
    public GameObject groundCheck;  // place an empty object slightly below the character where it will collide with any ground

    // Update is called once per frame
    void Update()
    {
        if (Input.GetKey("space") && ableToJump)
        {
            ableToJump = !ableToJump;
            GetComponent<Rigidbody2D>().AddForce(new Vector3(0,1,0) * jumpForce);
        }
        if (Input.GetKey("a"))
        {
            transform.Translate(-playerSpeed * Time.deltaTime, 0, 0);
        }
        if (Input.GetKey("d"))
        {
            transform.Translate(playerSpeed * Time.deltaTime, 0, 0);
        }

        // The player is grounded if a linecast to the groundcheck position hits anything on the ground layer.
        ableToJump = Physics2D.Linecast(transform.position, groundCheck.transform.position, 1 << LayerMask.NameToLayer("Wall"));
    }
}

Here is the glitch as it appears when I am previewing the game (watch how the third jump seems to be twice as high). There is no consistency to when it occurs, but it has occurred any time between two in a row and 10-12 between times it happens. I have tried long versus short presses of the jump key (space bar), moving versus standing still, and jumping on different locations. I have also tried disabling animations and waiting between presses versus pressing and holding space, versus pressing space rapidly. The only consistent thing is that sometimes I jump about three blocks (200 x 200px each) high, and sometimes I jump about six blocks high. Any tips are appreciated. Thanks!

sentences:
Adding collisions to a 3D mmorpg game I'm creating a mmorpg game with a little team, and we want to add a player-objets collisions system. We want players to be able to walk on a heightmap ground, and walk/be blocked by objects.

I found the bullet physics library (I already used his Java wrapper), but I don't know how to make it enough efficient for a VERY huge map, and a lot of players on it.

In this game, there will be a very huge world (loaded by a chunk system), with all players on the same world. So how can I made an efficient way to make player(AABB)-objects(shapes with triangles) collision system in a very big map?

sentences:
Displaying Trajectory Path How can I display trajectory path exactly as in this image?

I have used void OnDrawGizmos, but that only displays trajectory in the editor and without any arrows like shown below.

Trajectory with void OnDrawGizmos

Script:

public Transform someObject; //object that moves along parabola.
float objectT = 0; //timer for that object

public Transform Ta, Tb; //transforms that mark the start and end
public float h; //desired parabola height

Vector3 a, b; //Vector positions for start and end

void Update () {
    if ( Ta &&  Tb ) {
        a = Ta.position; //Get vectors from the transforms
        b = Tb.position;

        if ( someObject ) {
            //Shows how to animate something following a parabola
            objectT = Time.time % 1; //completes the parabola trip in one second
            someObject.position = SampleParabola( a, b, h, objectT );
        }
    }
}

void OnDrawGizmos () {

    //Draw the parabola by sample a few times
    Gizmos.color = Color.red;
    Gizmos.DrawLine( a, b );
    float count = 20;
    Vector3 lastP = a;
    for ( float i = 0; i < count + 1; i++ ) {
        Vector3 p = SampleParabola( a, b, h, i / count );
        Gizmos.color = i % 2 == 0 ? Color.blue : Color.green;
        Gizmos.DrawLine( lastP, p );
        lastP = p;
    }
}

#region Parabola sampling function
/// <summary>
/// Get position from a parabola defined by start and end, height, and time
/// </summary>
/// <param name='start'>
/// The start point of the parabola
/// </param>
/// <param name='end'>
/// The end point of the parabola
/// </param>
/// <param name='height'>
/// The height of the parabola at its maximum
/// </param>
/// <param name='t'>
/// Normalized time (0->1)
/// </param>S
Vector3 SampleParabola ( Vector3 start, Vector3 end, float height, float t ) {
    float parabolicT = t * 2 - 1;
    if ( Mathf.Abs( start.y - end.y ) < 0.1f ) {
        //start and end are roughly level, pretend they are - simpler solution with less steps
        Vector3 travelDirection = end - start;
        Vector3 result = start + t * travelDirection;
        result.y += ( -parabolicT * parabolicT + 1 ) * height;
        return result;
    } else {
        //start and end are not level, gets more complicated
        Vector3 travelDirection = end - start;
        Vector3 levelDirecteion = end - new Vector3( start.x, end.y, start.z );
        Vector3 right = Vector3.Cross( travelDirection, levelDirecteion );
        Vector3 up = Vector3.Cross( right, travelDirection );
        if ( end.y > start.y ) up = -up;
        Vector3 result = start + t * travelDirection;
        result += ( ( -parabolicT * parabolicT + 1 ) * height ) * up.normalized;
        return result;
    }
}

sentences:
What is the proper name for a 2D voxel? I know pixel might be right, but pixel means something different, especially if a "2D voxel" isn't exactly one pixel (it isn't, in my game).

I've also heard "texel," but that seems to refer to a repeating texture, which this isn't. I guess I'm just getting hung up on words, but is there a proper term for this?

(For an example of the thing I'm referring to, look at Terraria.)

sentences:
DirectSound only allows to capture and output from/to primary devices I wanted to allow my users to choose the devices that they want to capture from and output to.
For this, I used DirectSound device and capture device enumeration functions, obtained GUIDs of all available devices, and arrived at the following lists (DirectSound's grammar preserved):
Primary Sound Driver
Speakers (Realtek High Definition Audio)

Primary Sound Capture Driver
Mic in at front panel (black) (

However when I proceed to create sound capture and output devices, they only work if I supply the GUID of the primary drivers. If I supply Speakers or Mic, the result is always
No sound driver is available for use, or the given GUID is not a valid DirectSound device ID.

My thinking was that since the list of devices is returned to me by DirectSound system, then each GUID should be valid for capture or output, respectively. What am I missing?

sentences:
Passing an OpenGL texture ID loaded in NDK back to java Is it possible to load a texture using the NDK, but pass the result back to use in java.

I have used the code in the link above and it appears to load the png correctly and generates a texture ID without an error (the id is 0 before the loading function is called and non-zero afterwards).

Is it not allowed to mix opengl operations between C++ and java?

Thanks for your help
All the best,
Ash

sentences:
How to implement an event system Im trying to implement an Event System for a game, where there are classes that can fire or handle an event wheter or not they implement these interfaces:

public interface IGameEvent<T> where T : EventArgs
{
     event EventHandler<T> OnEvent;
}

public interface IGameHandler<T> where T : EventArgs
{
    void OnEvent(object sender, T e);
}

everything looked great until i realized that no class can implement more than 1 IGameEvent because it would cause duplicate declaration,

Here is an example:

public class Event
{
    public KeyPressEvent OnKeyPress;
    public UpdateEvent OnUpdate;

    public void AddHadler<T>(IGameEvent<T> eEvent , IGameHandler<T> eHandler) where  T : EventArgs
    {
        eEvent.OnEvent += eHandler.OnEvent;
    }

    public void RemoveHandler<T>(IGameEvent<T> eEvent, IGameHandler<T> eHandler) where T : EventArgs
    {
        eEvent.OnEvent -= eHandler.OnEvent;
    }
}

KeyPressEvent:

public class KeyPressEvent : IGameEvent<KeyPressEvent.KeyPressedEventArgs>
{
    public class KeyPressedEventArgs : EventArgs
    {
        public KeyPressedEventArgs(Keys key)
        {
            Key = key;
        }

        public Keys Key { get; private set; }
    }

    public event EventHandler<KeyPressedEventArgs> OnEvent;

    private void OnCheckForKeyPressed()  //Example
    {
        if (OnEvent != null)
            OnEvent(this, new KeyPressedEventArgs(Keys.Space));
    }
}

Would be better to manually store the suscribers in a list in the EventSystem ?

How slower or faster than this approach that would be?

Thanks!

sentences: How can I create a curved line composed of images? I have 50 little images. All are connected each other, as in a line, sort of like a cord. I want to move one of the node images and have the rest follow along like a cord, so they become a curve.

sentences:
Unity Failed to create decoder for ScreenSelector.png My game works fine in the editor, but when I build and run the build the view is zoomed in, my tilemap is missing, and the camera follows a gameobject it should not.

How it should look and how it looks

I checked the logs and this is the error I am served:

  Failed to create decoder for 'C:/Users/Hamuel The First/Documents/Jetplatformer/Builds/Builds_Data/ScreenSelector.png': 0x80070002

Further Investigation shows that ScreenSelector.png is absent from the path stated in the error. I cannot find anything that says what ScreenSelector.png is, or does. I am using the post processing stack by unity.

Any help would be much appreciated!

sentences:
rpg 3d open world map & entity loading-streaming Hello I'm a web developer and recently I started reading about game development.
I followed some tutorials regarding c++ and openGL (whatever I could find online because as you know not many up to date openGL tutorials exist.)

I keep wondering in a case of a rpg game with a huge real world(map) and entities(enemies what so ever) how could it be implemented. Meaning you cant load a huge map and the entities all at once obviously... I was thinking of subdividing the map into blocks and each block to even smaller ones so that each block contains (5x5) 25 sub-blocks.

A map could be consisted of many blocks such as the following one which has 25 sub-blocks:

P = Players current sub-block
O = sarounding sub-blocks
X = sub-blocks not yet loaded

Entities will be loaded only for the players current sub-block. Keep in mind that P is not just the player is a mesh a piece of map not very big and not as small as the player is.

X X X X X
X O O O X
X O P O X
X O O O X
X X X X X

And I'm wondering is this a good approach?
I suppose each sub-block has to be a different mesh apparently and then stitch them up together?

CASE 2:

What if I stored the map into 1 big height map or a set of height maps and generate the mesh from that. According to the player's position copy the required image height and width where player is always at the center of it and rearrange the data in the vbo?

I'm sorry if this is a silly question but I simply don't now how to approach this and I can't find any references.Also keep in mind that on such a map animations will also happen.

I would really appreciate it if someone could give some references or explain the architecture for a game such as this.

sentences:
Why does the Texture placement of my CCSprite slightly shift when changing it's location? So I've been seeing this issue for a while now. When using a delta method to change the location of a CCSprite, the placement of texture of my sprite slightly moves into the direction where I'm headed, while the physicsbody stays the same. This is really noticeable, since I'm using CCActionFollow to center this sprite in the view at all times. The code is displayed below. Is this normal behaviour, or am I perhaps overlooking something really obvious? Thanks!

- (void) move:(CCTime)delta toPosition:(CGPoint)point
{
OverworldScene * parentScene = (OverworldScene *)self.parent.parent.parent; //Go over physics node
OverworldLayer * parentLayer = (OverworldLayer *)self.parent.parent; //Go over physics node

//meewind of tegenwind?
float angleWind = parentScene.compass.rotation;
float angleShip = self.rotation;
float difference;
float windFactor;

if (angleWind > angleShip)
{difference = angleWind - angleShip;}
else{difference = angleShip - angleWind;}

if (difference > 180)
{difference = 360 - difference;}

//Incorporate wind power...
if (difference > 90)
{   //Tegenwind
    windFactor = 1-((((90- (180 - difference))/90))*(parentLayer.windPower/12));
}
else
{   //Meewind
    windFactor = 1+((((90-difference)/90))*(parentLayer.windPower/12));
}

if (windFactor < 0.4){windFactor = 0.4;}

//point is the current position of the user's sprite
//a, b and c are the right triangle sides lengths formed by the caser sprite and the user's sprite positions
float a = ABS(self.position.y - point.y);
float b = ABS(self.position.x - point.x);
float c = sqrt(pow(a, 2) + pow(b, 2));

//angle of the hypotenuse
float beta_rad = asin(b/c);

//velocity in pixels per second (used to be 60)
c = 60 * self.velocityFactor * windFactor;    //Now accounts for windfactor!
parentScene.speedLabel.string = [NSString stringWithFormat:@"Speed %.1f knots", self.velocityFactor * (60*windFactor)/8];

//x-axis velocity component
float x = c * sin(beta_rad);
//y-axis velocity component
float y = c * cos(beta_rad);

//adjustments based on position of the this (chaser) sprite and the user's sprite, if chaser is on the right or below the user's sprite it is needed to reverse the velocity vector component x and y
if (self.position.x > point.x) x *= -1;
if (self.position.y > point.y) y *= -1;

//final velocity vector
CGPoint velocityVector = CGPointMake(x, y);
CGPoint newPosition = ccpAdd(self.position, ccpMult(velocityVector, delta));

//NSLog(@"Updating position: %@", NSStringFromCGPoint(newPosition));

//Only update in case new position is in bounds
if (newPosition.x < 0 || newPosition.x > parentLayer.contentSize.width)
{
    newPosition = CGPointMake(self.position.x, newPosition.y);
}

if (newPosition.y < 0 || newPosition.y > parentLayer.contentSize.height)
{
    newPosition = CGPointMake(newPosition.x, self.position.y);
}

self.position = newPosition;

}

sentences:
Mouse Interaction in 3D space (ray) I use this code

    public static Ray CalculateRay(Vector2 mouseLocation, Matrix view, Matrix projection, Viewport viewport)
    {
        Vector3 nearPoint = viewport.Unproject(new Vector3(mouseLocation.X,
                mouseLocation.Y, 0.0f),
                projection,
                view,
                Matrix.Identity);

        Vector3 farPoint = viewport.Unproject(new Vector3(mouseLocation.X,
                mouseLocation.Y, 1.0f),
                projection,
                view,
                Matrix.Identity);

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

        return new Ray(nearPoint, direction);
    }

to calculate a ray for mouse position x;y.
But the result is everytime again NaN..
If I try it with .99f it works but the collision detection is not exact..
How can I determine whether the cursor hits and model in 3d space?

sentences:
How to put OpenGL in a state for drawing blended, colored, nontextured polys? Using OpenGL1.1 (sadly) I'm trying to draw a cube, which is colored and alpha blended. It is instead showing up as opaque black. Even without including alpha in the color it still shows up as opaque black so I don't believe blending is the problem.

    @Override
public void doRender(Entity entity, double d0, double d1, double d2,
        float f, float f1) {
    assert(entity instanceof EntityExplosion);
    EntityExplosion explosion= (EntityExplosion) entity;

    glPushMatrix();
    glPushAttrib(GL_BLEND);
    glPushAttrib(GL_COLOR_MATERIAL);

    //glDepthMask(false);

    glColorMaterial (GL_FRONT_AND_BACK, GL_AMBIENT_AND_DIFFUSE);//TODO fix

    glEnable(GL_COLOR_MATERIAL);//i dunno if this even does anything

    glBlendFunc(GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA);

    glColor3b((byte)0, (byte)255, (byte)255);//TODO fix

    glTranslated(d0, d1, d2);//trans whole thing

    for(NukeParticle p : explosion.particles){
        glPushMatrix();
        glTranslated(p.x, p.y, p.z);
        glCallList(callCube);
        glPopMatrix();
    }

    glPopAttrib();
    glPopAttrib();
    glPopMatrix();
}

This is being done during a Minecraft Entity Renderer, meaning that the current state of GL  is for drawing shaded, textured polys. What attribs or whatever do I change so that I can draw the way I want to?

sentences:
In general, are programmers or artists paid better? I'm in a private game programming school where there also are 3D art classes; sadly, there seems to be a lot more students in those latter classes, something like 50% or 100% more.

So I was wondering: in the real video game industry, which of the artist/modeler or the programmer is more likely to be wanted in a company, so who will be paid more ?

I'm sure there are artists which are obviously paid better than other programmers and I'm sure there are other sorts of jobs in the game industry (sound, management, testers), but I wanted to know if there is a general tendency for one or the other. And sometime I wonder even if an artist can happen to write scripts...

sentences:
How can I quickly determine whether objects are onscreen in 2D? Currently, I have this in each object's renderer's update method:

        float a = transform.position.x * Main.scale;
        float b = transform.position.y * Main.scale;
        float c = Camera.main.transform.position.x * Main.scale;
        float d = Camera.main.transform.position.y * Main.scale;
        onscreen = a + width - c > 0 &&
                a - c < GameView.width &&
                b + height - d > 0 &&
                b - d < GameView.height;

transform.position is a 2D vector containing the game engine's definition of where the object is. This is then multiplied by Main.scale to translate that coordinate into actual screen space.

Similarly, Camera.main.transform.position is the in-engine representation of where the main camera is, and this is also multiplied by Main.scale.

The problem is, as my game is tile-based, thousands of these updates get called every frame, just to determine whether or not each object should be drawn. How can I do this more efficiently, please?

sentences:
Why might a Projectile hitting a KActor only call HitWall, and not ProcessTouch? I have a Projectile subclass that seems to work fine. It travels, does Explode(), etc. But when it hits one of our KActors, I get a HitWall event but not a ProcessTouch event.

So my question is, why would a colliding actor trigger HitWall, but not ProcessTouch?

sentences:
How can I calculate the U,V texture coordinates on a disk at infinity given only a view vector and a vector pointing to the disk's center? I'm using an approach similar to Bruneton's paper on atmospheric scattering for rendering my sky and am trying to extend it to add a textured moon.

Long story short, the paper works by essentially inverting a screen pixel to a world-space vector, then effectively raytracing the sky. To draw the sun, the paper checks the dot product between the sun-vector and pixel view-vector, and gives a "yes hit" or "no not hit" 1 or 0 based on a step function and the angular size of the sun. All of these vectors are unit.

Similarly, I'm doing the same thing to determine if there's a hit on the moon, however unlike the sun, I also now need to determine a texture coordinate. At first I simply subtracted the view vector from the moon vector, normalized the result, then scaled it by the angle between the view and moon vectors. This gives me the correct world-space point, but I'm having a hard time converting this 3-D world space point to a U,V texture coordinate on the intersected moon-disk.

A graphic to illustrate my problem:

My question is this:
Given two unit vectors, how can I calculate a texture coordinate of a point formed by the angle between them?

sentences:
What is the memory impact of having a pointer to the containing class type as a member of that class? If I have a class called Something, what will the consequences for memory be if I include, in that class, a pointer to another object of the same class? So if the objects ThingOne and ThingTwo are both Something objects, ThingOne's contained pointer could point to ThingTwo (and vice versa, I assume)? I am trying to create a very simple alternative to both typical arrays (I need something more dynamic) and classic vectors (they keep gumming up my work. Please do not misinterpret this question as asking for help on vectors, though).

Needless to say, the pointers would be empty in the class, only to be set when an instance of the object has already been created.

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:
How do I mask a height based fog? I've been trying to implement a 3D (with the Y axis being utilized) fog of war system similar to what XCOM uses.

There is only one hint that really seems to nail it, but I can't read the actual function that was in place.

http://etiennecarrier.com/zombie-tycoon-2-fog-of-war-shader/

The key difference here is that I'm also trying to apply this to a multi leveled building.

So the question is... How do you go about implementing a height based fog shader, with a masking texture to prevent it from drawing in certain world spaces.

sentences:
Inventory View Screen Looking to create an inventory screen in Unity, and trying to think of the best way to do it.

My current line of thinking is having a few rows of squares for inventory items that are drag and droppable onto a paperdoll, a la Diablo.  When dragging and dropping on the items, it would update a 3D model of your current playable object with the items.

The menu itself would be easy enough to do with a simple square and a hierarchy of game objects for the items, each responding to mouse hovering over.

The problem I am trying to figure out is being able to render the 3D model on the side.  Granted, this is a nice to have, and not necessarily a need, but browsing the documentation, the only way I can think of accomplishing this is using a render to texture which requires Unity Pro with a separate camera completely out of bounds of the current space.

Anyone have suggestions on how to accomplish this?

sentences:
LWJGL Thin Matrix tutorials GUI I have a question about the GUI implemented by Thinmatrix. For positions we have to use values between [-1, 1]. This is probably because the origin of the screen is the center and then we have a 1 by 1 grid.
Is there a possibility to change this up, and reposition the origin to for example the top left corner, and make the screen a lot bigger to use absolute coordinates instead of values between [-1, 1]

Thanks,

sentences:
How do I pick tiles from an isometric map with slopes? I'm looking for a way to convert mouse/screen coordinates to isometric map coordinates, with the addition that the world has slopes and cliffs, and I have to be able to tell which quadrant of the tile is being pointed at by the mouse. The textures are handled by OpenGL, so I can't (easily) pick directly based on the tile sprite.

I've found several similar solutions, (e.g. Isometric Tiles Math, XNA Resources & Mouse Maps for Isometric Height Maps with the latter looking most promising) but none of them seem to quite fit my requirements.

My tiles look like this:

What algorithm or technique could I use here?

sentences:
Why game loop should be running on a separate thread? I am struggling to fully understand the responsiveness argument suggesting to run the game loop on a separate thread other than main thread.

When OS sends a user event (touch, mouse move, etc.) it will be handled within the main thread. Then you would have to forward this event into a game loop thread where this event usually is placed into a queue. The OS may think that event was processed instantly, but user will still have to wait until event is actually processed.

In this case there is an inevitable latency before the event gets processed.

It is exactly the same latency when event is processed in the main thread, but in this case OS can detect the latency.

Is it this latency that separate thread game loop is trying to avoid, or is there anything else?

sentences:
Xna - How do you use large animations for a menu In the main menu of my game I have several animations that pause in specific frames.

I made the sprite sheets for the different layers, but then I found out that the sprite sheet has to be smaller than 2048 pixels. My sprite sheet is 14400 pixels with 18 frames...

How can I play these large animations? I tried video playback but I couldn't find a way to do this...

sentences:
3.3x OpenGL Camera - how to do 3d rotation? I'm trying my hardest to understand what this code is doing so far I think the sin(theta) and cos(theta) of the code is representing a point with an angle.

This point with an angle sin(theta) and cos(theta) will allow the xmouse/16 value and ymouse/16 value to rotate or translate on this point with an angle because of their layout representation in the GLM::LookAt() function (view/camera matrix).

The result of doing this is that the view matrix rotates on the x axis left and right when I move the mouse left and right and the y axis up and down when I move the mouse up and down.

Is this correct? It took a lot work to understand this and if I am correct does anyone know how to move the mouse left, right, up and down from the centre of the screen (as in the mouse cursor at centre of the screen when moved to the left, right, up and down will move the camera respectively) rather then from a small region of the top left hand corner thanks!.

N.B.: I'm using Model Matrix and Perspective Projection Matrix with this in the middle so  Model * View * Perspective

C++ OpenGL 3.3x  GLSL 3.30 CORE Windows 10

Code:

GLuint OpenGL_Engine::SetupViewCamera(GLFWwindow *RenderWindow, glm::vec3 eyepos, glm::vec3 originpos, glm::vec3 viewrotationpos, GLuint program, GLfloat RotAng)
{
    double xmouse = 0.0f, ymouse = 0.0f;
    glfwGetCursorPos(RenderWindow, &xmouse, &ymouse);

    double theta = glm::radians(RotAng);

    glm::vec3 camera(cos(theta), 0.0f, sin(theta));
    camera *= 5;
    glm::mat4 ViewMatrix = glm::lookAt(
    camera,
    glm::vec3(xmouse/16, ymouse/16, 0.0),
    glm::vec3(0.0, 1.0, 0));

    glm::mat4 IViewMatrix = glm::inverse(ViewMatrix);

    GLint Viewmatrixloc = glGetUniformLocation(program, "VM");
    glUniformMatrix4fv(Viewmatrixloc, 1, GL_FALSE, &IViewMatrix[0][0]);

    return 80;
}

sentences:
Recognize that user has traced a path of vector points with mouse How can I check if a player has traced a closed vector shape from an arbitrary starting point all the way around to the beginning?

Setup

Given are the vector points A through E, which form a closed path. The created shape can be convex or concave and even have sharp elongated corners. P1 is the point where the player decides to start tracing. The point can be anywhere on the path and will be set as soon as the mouse or touch is first close to the path.

Requirements

The player starts moving along a visual representation and traces the entire shape until he reaches P1 again. If his mouse path differs too greatly, misses a point or goes outside of a given margin, I want to start over. The player may either have to trace around in the direction from which he first starts without backtracking or just have to fill the entire path even if going back and forth on the path.

How can I approach this problem? Ideally, I would like to implement a vector-math solution. I don't have any pixel data to sample from and it would be rather cumbersome in my real world implementation to generate a suitable image and map world space coordinates to it.

My Attempt

Consider each corner a waypoint with a collision area.
Track each entered collider and when all were hit, solve.
While valid colliders are pending, project mouse position onto the closest point on the path.
If the distance between projected point and mouse is too great, abort.

This approach however doesn't give me perfect results. Firstly, it's not entirely what I want, since in my ideal case the user "draws" or traces the path with the mouse, not just hits the corners. Also, when moving around a sharp corner, the project point will snap from one line segment to the next, giving me ugly visuals, when showing progress.

Possibly Better Solution

As soon as player comes close to path start sampling points from mouse.
Build up a user drawn vector path every time step or distance step.
Check if the draw vectors are similar to the given path.
Problem: user drawn path needs some sort of processing or more complex algorithm until it is comparable to given path.

Thank you for any suggestions! I will post some of my own code as soon as my implementation gives me good results.

sentences:
Calculating normal map from height map using Sobel operator So I'm trying to generate a normal map from a greyscale height map. Unfortunately the result I'm getting doesn't seem quite right.

Here is the height map I'm using to generate the normal map:

Here is my generated normal map:

For reference, here is the normal map that gets generated from http://cpetry.github.io/NormalMap-Online/:

One thing I notice in my normal map is that there seems to be edges. I'm not really sure why I am getting these edges - does anyone know why?

Here's the code that I'm using to generate the normal map:

// Source:
// https://stackoverflow.com/questions/2368728/can-normal-maps-be-generated-from-a-texture
// and
// http://www.catalinzima.com/2008/01/converting-displacement-maps-into-normal-maps/
float32 height(const std::vector<char>& data, const int width, const int height, uint32 x, uint32 z)
{
    if (x >= width)  x %= width;
    while (x < 0)    x += width;
    if (z >= height) z %= height;
    while (z < 0)    z += height;

    return static_cast<float32>(data[z*width*4 + x*4 + 3]) / 255.0f;
}

uint8 textureCoordinateToRgb(const float32 value)
{
    return (value + 1.0) * (255.0 / 2.0);
}

glm::vec3 calculateNormal(const std::vector<char>& data, const int width, const int height, uint32 x, uint32 z)
{
    const float32 strength = 8.0f;

    // surrounding pixels
    float32 tl = height(data, width, height, x-1, z-1); // top left
    float32  l = height(data, width, height, x-1, z);   // left
    float32 bl = height(data, width, height, x-1, z+1); // bottom left
    float32  t = height(data, width, height, x, z-1);   // top
    float32  b = height(data, width, height, x, z+1);   // bottom
    float32 tr = height(data, width, height, x+1, z-1); // top right
    float32  r = height(data, width, height, x+1, z);   // right
    float32 br = height(data, width, height, x+1, z+1); // bottom right

    // sobel filter
    const float32 dX = (tr + 2.0 * r + br) - (tl + 2.0 * l + bl);
    const float32 dY = (bl + 2.0 * b + br) - (tl + 2.0 * t + tr);
    const float32 dZ = 1.0 / strength;

    glm::vec3 n(dX, dY, dZ);
    n = glm::normalize(n);

    return n;
}

void calculateNormals(std::vector<char>& data, const int width, const int height)
{
    for (int i = 0; i < width; ++i)
    {
        for (int j = 0; j < height; ++j)
        {
           const glm::vec3 n = calculateNormal(data, width, height, i, j);

            // convert to rgb
            data[j*width*4 + i*4 + 0] = textureCoordinateToRgb(n.x);
            data[j*width*4 + i*4 + 1] = textureCoordinateToRgb(n.y);
            data[j*width*4 + i*4 + 2] = textureCoordinateToRgb(n.z);
        }
    }
}

std::unique_ptr<Image> generateFormattedHeightmap(const Image& image)
{
    std::vector<char> data;
    int width = image.width();
    int height = image.height();

    data.resize(width*height*4);

    if (image.format() == Image::Format::FORMAT_RGB)
    {
        int j=0;
        for (int i=0; i < data.size(); i+=4)
        {
            data[i] = image.data()[j];
            data[i+1] = image.data()[j+1];
            data[i+2] = image.data()[j+2];
            data[i+3] = (image.data()[j] + image.data()[j+1] + image.data()[j+2]) / 3;

            j+=3;
        }
    }
    else if (image.format() == Image::Format::FORMAT_RGBA)
    {
        for (int i=0; i < image.data().size(); i+=4)
        {
            data[i] = image.data()[i];
            data[i+1] = image.data()[i+1];
            data[i+2] = image.data()[i+2];
            data[i+3] = (image.data()[i] + image.data()[i+1] + image.data()[i+2]) / 3;
        }
    }

    calculateNormals(data, width, height);

    return std::make_unique<Image>(data, width, height, Image::Format::FORMAT_RGBA);
}

Does anyone have any ideas?

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:
Do higher-level 'Pure AI' concepts (such as Neural-Nets or Genetic Algos) ever get implemented successfully in commercial games? Although graphics is my main area of focus, I've been dabbling with Game AI concepts for quite some time now; from simple A* path-finding to intricate Perceptrons..

My question is this; Does anyone have any examples of successful (or perhaps more interestingly, failed) implementations of some higher-level AI concepts in large-scale commercial titles?

By higher-level, I mean methods of simulating intelligence that are usually found in Pure AI.. For example..

Neural Networks
Genetic Algorithms
Decision Theory

I understand that as well as a financial budget, developers also have a budget of memory usage (with AI often taking a back seat). Many of these methods are costly to implement and provide limited returns.. I am just intrigued to find out if anyone knows where or when any of these (or any other high-level concepts that I've forgot to mention) have been deployed in any well-known games :)

I also know that in this industry, trade-secrets are a fact of life ;) Aside from the AAA titles, if you have any of your own success-stories (or disasters) it would be nice to hear them! :D

sentences:
Weird issue in collision resolution of non-static bodies I'm a bit of a beginner in engine development, so I decided to write my own engine from scratch so I could learn more about what happens under everything.

I've been progressing fairly well, except the physics engine side of things have been giving me a bit of a headache.

Here's a gif of what I mean:

Essentially, the engine works just fine as long as the player is not colliding with another non-static body from either above, or from right to left.

Here's my collision resolution code written in go:

package resources

import (
  "game/pidgeot-socket/ecs"

  "github.com/bxcodec/saint"
)

type PhysicsSystem struct {
  Hub *Hub
}

func (system PhysicsSystem) Loop() {
  entities, err := system.Hub.World.AllEntitiesWithComponent(ecs.CollisionComponent)
  if err != nil { return }

  for e, _ := range entities {
    // apply impulse
    c_p, _ := system.Hub.World.GetComponent(e, ecs.CollisionComponent)
    c := (*c_p).(*ecs.Collision)

    p_p, _ := system.Hub.World.GetComponent(e, ecs.PositionComponent)
    p := (*p_p).(*ecs.Position)

    if c.WithGravity {
      // Add gravity
      c.ImpulseY = saint.Min(c.ImpulseY + 1, c.MaxSpeedY)
    }

    // apply impulse
    p.NextY = p.Y + c.ImpulseY
    p.NextX = p.X + c.ImpulseX
  }

  // resolving collisions
  for e1, _ := range entities {
    c1_p, _ := system.Hub.World.GetComponent(e1, ecs.CollisionComponent)
    c1 := (*c1_p).(*ecs.Collision)

    if c1.IsStatic { continue }

    for e2, _ := range entities {
      if e1 == e2 { continue }

      system.ResolveCollision(entities, e1, e2)
    }
  }

  // moving entities
  for e, _ := range entities {
    p_p, _ := system.Hub.World.GetComponent(e, ecs.PositionComponent)
    p := (*p_p).(*ecs.Position)

    if (p.X != p.NextX || p.Y != p.NextY) {
      p.X = p.NextX
      p.Y = p.NextY

      system.Hub.broadcast <- system.Hub.World.GetComponentMessage(e, p_p)
    }
  }
}

func (system PhysicsSystem) ResolveCollision(entities map[ecs.EID]*ecs.Component, e1 ecs.EID, e2 ecs.EID) {
  c1_p, _ := system.Hub.World.GetComponent(e1, ecs.CollisionComponent)
  p1_p, _ := system.Hub.World.GetComponent(e1, ecs.PositionComponent)
  c1 := (*c1_p).(*ecs.Collision)
  p1 := (*p1_p).(*ecs.Position)

  c2_p, _ := system.Hub.World.GetComponent(e2, ecs.CollisionComponent)
  p2_p, _ := system.Hub.World.GetComponent(e2, ecs.PositionComponent)
  c2 := (*c2_p).(*ecs.Collision)
  p2 := (*p2_p).(*ecs.Position)

  // resolve y-axis
  collidingX := IsOverlapping(p1.X, p1.X + c1.W, p2.X, p2.X + c2.W)
  collidingY := IsOverlapping(p1.NextY, p1.NextY + c1.H, p2.NextY, p2.NextY + c2.H)
  colliding := collidingX && collidingY

  if colliding {
    direction := func (impulse int) int {if impulse < 0 { return 1 } else { return -1 }}(c1.ImpulseY)
    overlap := CalculateOverlap(p1.NextY, p1.NextY + c1.H, p2.NextY, p2.NextY + c2.H)

    p1.NextY += (direction * overlap)
    c1.ImpulseY = 0
    c1.IsJumping = false
  }

  // resolve x-axis
  collidingX = IsOverlapping(p1.NextX, p1.NextX + c1.W, p2.NextX, p2.NextX + c2.W)
  collidingY = IsOverlapping(p1.Y, p1.Y + c1.H, p2.Y, p2.Y + c2.H)
  colliding = collidingX && collidingY

  if colliding {
    direction := func (impulse int) int {if impulse < 0 { return 1 } else { return -1 }}(c1.ImpulseX)
    overlap := CalculateOverlap(p1.NextX, p1.NextX + c1.W, p2.NextX, p2.NextX + c2.W)

    p1.NextX += (direction * overlap)
  }

  for e3, _ := range entities {
    if e1 == e3 { continue }

    c3_p, _ := system.Hub.World.GetComponent(e3, ecs.CollisionComponent)
    p3_p, _ := system.Hub.World.GetComponent(e3, ecs.PositionComponent)
    c3 := (*c3_p).(*ecs.Collision)
    p3 := (*p3_p).(*ecs.Position)

    collidingX = IsOverlapping(p1.NextX, p1.NextX + c1.W, p3.NextX, p3.NextX + c3.W)
    collidingY = IsOverlapping(p1.NextY, p1.NextY + c1.H, p3.NextY, p3.NextY + c3.H)
    colliding = collidingX && collidingY

    if colliding { system.ResolveCollision(entities, e1, e3) }
  }
}

Anything I could do to solve that issue?

sentences:
FOSS games using original assets, is it legal? Can I make a game that uses the assets of another game on the users' computer, without legal issues? For example, I make a game that requires the user have game X installed, and I use the assets of game X in my game. The assets of game X would not be distributed with my game.

I realize it will be hard for companies to check, but can you use the assets for other purposes than originally intended (playing the original game)?

As a more concrete example, is playing a game like OpenXcom really legal, when you own the original game?

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:
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:
How are the positions of skinned mesh vertices with multiple weighted parents stored? I'm trying to wrap my head around the basics of skinning and skeletal animation.  I understand not every skeletal animation implementation works exactly the same, but I'm just trying to understand the generally accepted practice.

I'm not sure if I used the correct terminology for my question, but my issue is this - if I have a vertex with a single bone as a parent, I can just store the local coordinates to the parent.

So if my parent bone is at any random location and the vertex is located exactly where the parent bone is, I would store it's x,y location as 0,0.  If it were to move the vertex down the length of the bone parallel to it, regardless of the parent bone's angle and location, the local x value for the vertex would increase and the y would stay the same.  This makes sense, and the math to get from any arbitrary point in world space to that local position to it's parent is also very straightforward.  This position local to the parent also seems like the ideal way to store the vertex information for any given vertex with a single parent bone.

My question is if the vertex has multiple weighted parents, what xy location is stored?  Would I need to store the relative coordinates to each parent for each vertex, or is there some way to store a single coordinate that represents it's weighted position relative to all parents?  And if the math isn't simple enough to be explained here, what is the math required to get this multi-weighted relative coordinate called so I can go find more information?

sentences:
SDL2 LogInfo not outputting with different category? So this is probably really simple but I just cannot see it.

I've made my own log class using the SDL_Log functions to output to the console. Only thing is, is that it only outputs using one category type only.

For example. I use this:

Log::getInstance()->info(Log::getInstance()->CAT_APPLICATION, "This outputs fine.");
Log::getInstance()->info(Log::getInstance()->CAT_INPUT, "This doesn't get outputted");

which, in the log class, that uses the following code:

void Log::info(int category, const char* message, ...) { SDL_LogInfo(category, message); }

and:

int CAT_APPLICATION = SDL_LOG_CATEGORY_APPLICATION;
int CAT_INPUT = SDL_LOG_CATEGORY_INPUT;

I've also tried the normal method:

SDL_LogInfo(SDL_LOG_CATEGORY_INPUT, "but this doesn't get outputted either if the app cat is outputted first");

Any ideas on why it's not outputting "CAT_INPUT" but is outputting "CAT_APPLICATION"? And how I could get it outputting all of them?

sentences:
Rotate an image and get back to its original position - opengles glkit I need to rotate an image in opengles GLkit and get it back to its original position in GLkit.

rotation += 5;
_modelViewMatrix = GLKMatrix4Rotate( _modelViewMatrix, GLKMathDegreesToRadians(5), 1, 0, 0);
_modelViewMatrix = GLKMatrix4Rotate( _modelViewMatrix, GLKMathDegreesToRadians(rotation), 1,0,0);

I need to move it in x axis for certain amount and getting back to its original position from where it started. How should i do it?

sentences:
How do i get a list of all joysticks connected to my pc in usb using sharpdx with c# ? Getting errors The code:

using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.Windows.Forms;
using System.Runtime.InteropServices;
using SharpDX;
using SharpDX.DirectInput;

namespace Ps4_Controller
{
    public partial class Form1 : Form
    {
        DirectInput input = new DirectInput();
        Joystick stick;

        public Form1()
        {
            InitializeComponent();

            List<Joystick> sticks = new List<Joystick>();

            foreach (DeviceInstance device in input.GetDevices
                (DeviceClass.GameControl,DeviceEnumerationFlags.AttachedOnly))
            {
                stick = new Joystick(input, device.InstanceGuid);
                stick.Acquire();

                  foreach (DeviceObjectInstance deviceObject in stick.GetObjects())
                    {
                        if ((deviceObject.ObjectType & ObjectDeviceType.Axis) != 0)
                        {
                            stick.GetObjectPropertiesById(deviceObject.ObjectType).SetRange(-100, 100);
                        }
                    }
                    sticks.Add(stick);
            }
        }

        private void Form1_Load(object sender, EventArgs e)
        {

        }
}

I'm getting error on the line:

if ((deviceObject.ObjectType & ObjectDeviceType.Axis) != 0)

Severity    Code    Description Project File    Line    Suppression State
Error   CS0103  The name 'ObjectDeviceType' does not exist in the current

And on the line:

stick.GetObjectPropertiesById(deviceObject.ObjectType).SetRange(-100, 100);

Severity    Code    Description Project File    Line    Suppression State
Error   CS1503  Argument 1: cannot convert from 'System.Guid' to 'SharpDX.DirectInput.DeviceObjectId'

sentences: Should I use delta time (elapsed time between frames)? Unfortunately I cannot recall where but I definitely read it somewhere, that the use of delta time should be avoided for some reason. Is there really a scenario where controlling animation or other in-game events using delta time is bad or it was just a wierd dream of mine?

sentences:
LibGDX touchDown event continues I'm using libGdx to create a simple platformer.

I used a set of images as an onScreen controller for Android, and use this code to fire a shot ->

        @Override
        public boolean touchDown(InputEvent event, float x, float y, int pointer, int button) {
            downPressed = true;
            return true;
            //return super.touchDown(event, x, y, pointer, button);
        }

        @Override
        public void touchUp(InputEvent event, float x, float y, int pointer, int button) {
            downPressed = false;
            //super.touchUp(event, x, y, pointer, button);
        }

But when I keep the button pressed, the player continues to shoot which I don't want, I want the player to tap-to-shoot.

What am I doing wrong?

sentences:
FBX Import Errors: "Multiple roots are found in the bone hierarchy" I followed these steps:

I exported my character from Blender as an fbx file

I went to Unreal Engine and make a new folder

I paste the fbx file in that folder

I put and tried to put it with a skeleton

I get the following errors:

❕ No smoothing group information was found in this FBX scene.
❕ Could not find the bind pose. It will use time 0 as bind pose.
 Multiple roots are found in the bone hierarchy. We only support single root bone.
❕ Get Import Data has failed.

I think it is an issue with Blender. Specifically, I think it is a problem with the spine names. The character has a skeleton I on it in Blender.
[

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:
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:
Difference between 2 quaternions I need to patch an animation during LateUpdate.

I'm rotating the "chest" bone according to the mouse delta. This is to mimic aiming a pistol.

During this aiming, the "neck" bone should stay relatively still.
As changing the chest bone's location rotation yaw automatically changes the "neck" bone's local yaw rotation, I store the chest bone's rotation BEFORE I apply a new rotation to it. Then I calculate the difference between the old and the new rotation.
Then I apply this rotation yaw difference to the neck bone.

The inspector gives me nice values to work with.
When I inspect the rotation values by script, I get reprensations that I can not easily work with.

Here is an example:

While the Inspector shows "15.4", the localEulerAngle shows "344.6".

If I use "344.6", the neck rotation goes Berzerk of course.

How should this be solved?

For completeness, here is the entire void:

private void pHandle_LateUpdate_Aim()
{
    Vector3 nOldChestRotation = Chest.localRotation.eulerAngles;

    // Fade old input before capturing new, so we don't dull the freshest data.
    float yawBlend = Mathf.Pow(1.0f - Aim_yawInputFalloff, referenceFramerate * Time.deltaTime);
    // A Lerp toward zero is just the same as a multiplication by the blend factor.
    Chest_yawRate *= yawBlend;
    // Accelerate by mouse movement over the past frame.
    // (May need adjustment for display resolution).
    Chest_yawRate += Input.GetAxis("Mouse X");

    float yawDelta = Chest_yawSpeed * Chest_yawRate * Time.deltaTime;
    float offCenterYaw = Chest_currentYaw - Chest_yawCenter;

    float fDesiredChestYaw = Chest_currentYaw + yawDelta;
    float fHeroRotation = 0f;

    if (fDesiredChestYaw > Chest_rotateRange)
    {
        fHeroRotation = fDesiredChestYaw - Chest_rotateRange;
        //we don't rotate the chest beyond the allowed "Chest_rotateRange", so simply act like the user didn't move the mouse
        Chest_yawRate = 0;
        yawDelta = Chest_yawSpeed * Chest_yawRate * Time.deltaTime;
    }
    else if (fDesiredChestYaw < -Chest_rotateRange)
    {
        fHeroRotation = (Chest_rotateRange + fDesiredChestYaw);
        Chest_yawRate = 0;
        yawDelta = Chest_yawSpeed * Chest_yawRate * Time.deltaTime;
    }

    // If we're moving away from the center, slow down as we approach the edge.
    if (yawDelta * offCenterYaw > 0)
    {
        float extremityYaw = offCenterYaw / Aim_yawMaxRange;
        yawDelta *= 1.0f - extremityYaw * extremityYaw;
    }

    this.transform.Rotate(0, fHeroRotation, 0);

    // Ensure we never overshoot the allowed range.
    Chest_currentYaw = Mathf.Clamp(Chest_currentYaw + yawDelta,
                              Chest_yawCenter - Aim_yawMaxRange,
                              Chest_yawCenter + Aim_yawMaxRange);

    Vector3 nNewChestRotation = new Vector3(Chest.localEulerAngles.x, Chest_currentYaw, Chest.localEulerAngles.z);
    Chest.localRotation = Quaternion.Euler(nNewChestRotation);

    float fChestRotationDifference = nNewChestRotation.y - nOldChestRotation.y;

    //the neck should not rotate with the chest. So I first counter-rotate it against the new chest rotation, then rotate it a little towards the chest rotation
    Neck.transform.localRotation = Quaternion.Euler(0, Aim_NeckYaw - fChestRotationDifference + (fChestRotationDifference * 0.5f), 0);

}

sentences:
Smoothly extend eased animation to new target value I am implementing animated double property from scratch, currently with SmoothStep easing, however when new target value is set, there is visible "jump" in animation speed (probably due to applied easing). I would like setTarget to smoothly extend currently ongoing animation.
I have tried to calculate originalValue_ and remaining_ based on current t (offsetting those correctly, I think, will solve the problem), but haven't managed to find the correct formula.
How do I smoothly extend ongoing smoothstep animation to new target value?

void setTargetValue(double value, double duration = 1.0)
{
   originalValue_ = currentValue();
   targetValue_ = value;
   remaining_ = duration;
   duration_ = duration;
   t = 0.0;
}

double currentValue() const {
   return SmoothStep(originalValue_, targetValue_, t); //x*x*(3 - 2*x)
}

void update(double deltaT) {
   remaining_ = fmax(0.0, remaining_ - deltaT);
   t = clamp(0.0, 1.0, 1.0 - remaining_ / duration_)
}

sentences:
Split a 2D scene in layers or have a z coordinate I am in the process of writing a 2D game engine, and a dilemma emerged. Let me explain the situation...

I have a Scene class, to which various objects can be added (Drawable, ParticleEmitter, Light2D, etc), and as this is a 2D scene, things will obviously be drawn over each other.

My first thought was that I could have basic add and remove methods, but I soon realized that then there would be no way for the programmer to control the order in which things were drawn.

So I can up with two options, each with its pros and cons.

A) Would be to split the scene in layers. By that I mean instead of having the scene be a container of objects, have it be a container of layers, which are in turn the containers of objects.

B) Would require to have some kind of z-coordinate, and then have the scene sorted so objects with lower z get drawn first.

Option A is pretty solid, but the problem is with the lights. In what layer do I add it? Does it work cross-layer? On all bottom layers? And I still need the Z coordinate to calculate the shadow!

Option B would require me to change all my code from having Vector2D positions, to some kind of class that inherits from Vector2D and adds a z coordinate to it (I don't want it to be a Vector3D because I still need all the same methods the 2D kind has, just with .z clamped on).

Am I missing something? Is there an alternative to these methods?

I'm working in Javascript, if that makes a difference.

Edit: it was hard to decide with which option should I go, but I chose option B, adding the z coordinate. Some other design choices that might help others reading this question:

The actual map is a 2D space, and therefor, all positions should be Vector2D instances. But, as I also need a third coordinate, I made a new class, called ScenePosition, which inherits from Vector2D and just adds a z option. What was crucial was to keep the methods thinking that they are still operating on a Vector2D instance.
There is no way that sorting the scene by the z axis on every frame would be efficient, so watch out when adding things to the scene. For example: you would add a 4 at the end of this list, not the beginning: [1, 2, 3].
I chose to have a changedOrder property on the Scene, which you set to true when you change the z coordinate of some object. Then, the array is sorted before rendering, and changedOrder is set to true.

sentences:
How do I dynamically grow a voxel world in all directions with chunks? I've organized a Voxel world already but the problem is that it can only "grow" outwards. As a result, there is a single corner where it grows from, then outwards from there on. I want to be able to grow the world from all directions.

I figured this would be best done by maintaining a list of chunks with their world position, but that would require iterating through each chunk just to find the one I'm looking for and checking which chunks need to be created (or just to do anything involving that chunk) and it would be a mess to figure out which ones are loaded and which ones aren't.

How do existing Voxel games (such as Minecraft) deal with this issue?

sentences:
Presenting game center leaderboard I have the following code:

-(void)showLeaderboard {

GKLeaderboardViewController *leaderboardController = [[GKLeaderboardViewController alloc] init];
if (leaderboardController != NULL)
{
    leaderboardController.timeScope = GKLeaderboardTimeScopeAllTime;
    leaderboardController.leaderboardDelegate = self;
    [self presentModalViewController: leaderboardController animated: YES];
}

[leaderboardController release];

}

Which I am trying to use to make my leader-board pop up. The issue is cocos2d will not allow me to use the line:

        [self presentModalViewController: leaderboardController animated: YES];

How do I fix this?

Thanks

PS I am using cocos2d

sentences:
AndeEngine Parallax / Sprite Depth? What I'm attempting to do is create a game in which a space ship explores a large area of space.  I'm randomly generating placement of planets, space stations etc.  I want to use the ParallaxBackground (I actually had to find a custom implementation which supports both x and y parallax values).

When a planet is generated I create a sprite, and add a new parallax entity to the background.

My issue is that when I place the sprite, it is not being placed properly (due to the parallax calculation I'm assuming).  As the player navigates further away from the origin (0,0 in world space), the offset from the position the object is supposed to appear in the background and the position in which it actually appears gets larger and larger.

Here is the code for the custom drawing of the ParallaxEntity2D:

public void onDraw(final GLState pGLState, final Camera pCamera, final float pParallaxValueX, final float pParallaxValueY) {
            pGLState.pushModelViewGLMatrix();
            {
                final float cameraWidth = pCamera.getWidth();
                final float cameraHeight = pCamera.getHeight();
                final float shapeWidthScaled = this.mAreaShape.getWidthScaled();
                final float shapeHeightScaled = this.mAreaShape.getHeightScaled();

                //reposition
                float baseOffsetX = (pParallaxValueX * this.mParallaxFactor);
                if (this.mRepeatX) {
                    baseOffsetX = baseOffsetX % shapeWidthScaled;
                    while(baseOffsetX > 0) {
                        baseOffsetX -= shapeWidthScaled;
                    }
                }

                float baseOffsetY = (pParallaxValueY * this.mParallaxFactor);

                if (this.mRepeatY) {
                    baseOffsetY = baseOffsetY % shapeHeightScaled;
                    while(baseOffsetY > 0) {
                        baseOffsetY -= shapeHeightScaled;
                    }
                }

                //draw
                pGLState.translateModelViewGLMatrixf(baseOffsetX, baseOffsetY, 0);

                float currentMaxX = baseOffsetX;
                float currentMaxY = baseOffsetY;

                do {
                    this.mAreaShape.onDraw(pGLState, pCamera);

                    if (this.mRepeatY) {
                        currentMaxY = baseOffsetY;
                        do {
                            pGLState.translateModelViewGLMatrixf(0, shapeHeightScaled, 0);
                            currentMaxY += shapeHeightScaled;
                            this.mAreaShape.onDraw(pGLState, pCamera);
                        } while(currentMaxY < cameraHeight);
                        pGLState.translateModelViewGLMatrixf(0, -currentMaxY + baseOffsetY, 0);
                    }
                    pGLState.translateModelViewGLMatrixf(shapeWidthScaled, 0, 0);
                    currentMaxX += shapeWidthScaled;
                } while (this.mRepeatX && currentMaxX < cameraWidth);
            }
            pGLState.popModelViewGLMatrix();
        }

This is far beyond my ability to understand in terms of the calculation required to figure out where in screen space the sprite needs to be placed for it to show up in the background properly.  I've gotten close by hacking together some simple math, but I want this to be perfect.

I guess first I need to understand what the above onDraw code is doing exactly.  Maybe there is another approach that would work better for this instance?  I explored being able to use the z component on a sprite, but I couldn't get this to work with GLES2 (the example for GLES1 is here).

sentences:
Multiple render targets and gamma correctness in Direct3D9 Let's say in a deferred renderer when building your G-Buffer you're going to render texture color, normals, depth and whatever else to your multiple render targets at once.

Now if you want to have a gamma-correct rendering pipeline and you use regular sRGB textures as well as rendertargets, you'll need to apply some conversions along the way, because your filtering, sampling and calculations should happen in linear space, not sRGB space. Of course, you could store linear color in your textures and rendertargets, but this might very well introduce bad precision and banding issues.

Reading from sRGB textures is easy: just set SRGBTexture = true; in your texture sampler in your HLSL effect code and the hardware does the conversion sRGB->linear for you.

Writing to an sRGB rendertarget is theoretically easy, too: just set SRGBWriteEnable = true; in your effect pass in HLSL and your linear colors will be converted to sRGB space automatically.

But how does this work with multiple rendertargets?
I only want to do these corrections to the color textures and rendertarget, not to the normals, depth, specularity or whatever else I'll be rendering to my G-Buffer. Ok, so I just don't apply SRGBTexture = true; to my non-color textures, but when using SRGBWriteEnable = true; I'll do a gamma correction to all the values I write out to my rendertargets, no matter what I actually store there.

I found some info on gamma over at Microsoft:
http://msdn.microsoft.com/en-us/library/windows/desktop/bb173460%28v=vs.85%29.aspx

  For hardware that supports Multiple Render Targets (Direct3D 9) or Multiple-element Textures (Direct3D 9), only the first render target or element is written.

If I understand correctly, SRGBWriteEnable should only be applied to the first rendertarget, but according to my tests it doesn't and is used for all rendertargets instead.

Now the only alternative seems to be to handle these corrections manually in my shader and only correct the actual color output, but I'm not totally sure, that this'll not have any negative impact on color correctness. E.g. if the GPU does any blending or filtering or multisampling after the Linear->sRGB conversion...

Do I even need gamma correction in this case, if I'm just writing texture color without lighting to my rendertarget? As far as I know, I DO need it because of the texture filtering and mip sampling happening in sRGB space instead, if I don't correct for it.

Anyway, it'd be interesting to hear other people's solutions or thoughts about this.

sentences:
Is it a good idea to use per pixel collision detection in an isometric game? I've completed the per-pixel collision detection for a small side-scroller game, for learning purposes using a Lazyfoo.net tutorial, and I am wondering if it is a good method for detecting collision in an isometric game consisting of a pure 2D world.

My plan is described in this picture:

As you can see, I want to start with bounding boxes, and if I collide with it I start iterating through the tiles rectangles (19, in this case) for better precision. Is it a good way to handle collisions in this type of game? If not, what would be a suitable alternative?

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:
Physics not synchronizing correctly over the network when using Bullet I'm trying to implement a client/server physics system using Bullet however I'm having problems getting things to sync up.

I've implemented a custom motion state which reads and writes the transform from my game objects and it works locally but I've tried two different approaches for networked games:

Dynamic objects on the client that are also on the server (eg not random debris and other unimportant stuff) are made kinematic. This works correctly but the objects don't move very smoothly
Objects are dynamic on both but after each message from the server that the object has moved I set the linear and angular velocity to the values from the server and call btRigidBody::proceedToTransform with the transform on the server. I also call btCollisionObject::activate(true); to force the object to update.

My intent with method 2 was to basically do method 1 but hijacking Bullet to do a poor-man's prediction instead of doing my own to smooth out method 1, but this doesn't seem to work (for reasons that are not 100% clear to me even stepping through Bullet) and the objects sometimes end up in different places.

Am I heading in the right direction? Bullet seems to have it's own interpolation code built-in. Can that help me make method 1 work better? Or is my method 2 code not working because I am accidentally stomping that?

EDIT: Another problem with method 1 I just noticed is that the collision response will be way off for collisions against non-synchronized objects. Kinetic bodies kind of shoot stuff to infinity sometimes since they can't be knocked back.

sentences:
Pygame 2D Scrolling Map I have currently a pygame program that stores tiles in a 2d list like

[[1,1,1]
 [1,1,1]
 [1,1,1]]

where the 1 is a tile object. I have the character centered in the middle of the screen, and I am trying to find the best way to make it so the 'camera' scrolls along with the character. I suppose I could have it so that it only draws the tiles that are in the current window range, but I feel like this will cause problems later. My goal is to have the an entire map, say 100x100 tiles that are drawn but only a small section is shown. So the enemies I generate would still be walking around the map, and things would be going normally except I can only see a small part of it. Is there a way I can take advantage of surfaces in pygame to do this more effectively?

Some relevant code.

def drawMap(self, screen):
    for y in range(self.height):
        for x in range(self.width):
            self._mapData[y][x].draw(screen, x*48,y*48)

This is in the TileMap class and each index is a Tile object, which has a draw method. My initial idea was to change both the range() calls to draw only the area of the map I want to but then I don't know how to account for enemies off the screen because they are defined by their x and y location relative to the TileMap I create.

I am thinking there is maybe something I can do with a larger pygame surface object that I do not realize so I figured I would ask this here.

sentences:
Getting a 2D "pixel" cloud to follow a mouse I'm working on a 2D game trying to get a "cloud" of a few hundred tiny cubes or discs to follow my mouse cursor without overlapping each other.

However, using the physics engine introduces performance sluggishness as the number of discs grows and the collision detection is generally wonky.

Is there an easy way to optimise the engine for this kind of thing? If not, would I be better off just switching the engine off and writing something of my own? (Clutching at straws here, but:) Are there any good resources or examples on how to do this?

sentences:
Improving Rigidbody collision between real-time movable object and other Rigidbodies I have a cube that has been scaled to be rectangular (controlled by a remote Raspberry Pi gyro/accelerometer/magnetometer) and am translating its orientation into Unity via calls to transform.localEulerAngles = new Vector3(...). This works wonderfully (the cube object modeled to be a Pi rotates perfectly), however now I'm running into issues with the actual physics.

GIF of successful roll

Initially the ball will land on and roll around the Pi object, however when I start to increase the speed of my movements the ball will sometimes fall through the Pi.

The cube has a Rigidbody (no gravity, is kinematic) and Box collider (not triggered), and the sphere has a Rigidbody (has gravity, not kinematic) and Sphere collider (not triggered) attached.  I've tried varying the collision detection from discrete to continuous on both objects and have noticed similar behaviors.

The intent is to turn this into a marble maze type game, and the issue that I have is similar.  If I roll the ball into the joint between a wall and the floor (both stretched cubes), rotate it down, and then rotate it up, the ball will fall through the joint.  I have the same movement code attached to the GameArea object below.  Again, same issue with various types of collision detection applied.

My assumption is that this is a quickness of movement thing, as the cubes overlap each other (there's not a space for the ball to sneak through).

For reference, in the physics colliders section of the project preferences, all relevant layers are supposed to collide with each other.  I don't mind getting into code-based collision detection, but this seemed fairly trivial for Unity to take care of so I was wondering if I was missing something obvious.

sentences: Move an object towards a point relative to its position I am attempting to move an object a set distance in a direction relative to the objects current position. In other words I want the object to move to whatever point is 144 pixels below the object, and then stop moving. How can I do this?

sentences:
Update android game with new levels without replacing database So I've published a game for android users containing 400 levels and 2k users have completed or are playing it since. Now I'm going to update the game with 600 levels, but I don't want current users to lose their info in database. I just want to add more levels to the database if it exists in their phone.

I'm using this code not to let database get replaced if it exists.

public DataService()
{

        const string databaseName = Constants.DbName;

#if UNITY_EDITOR
        var dbPath = string.Format(@"Assets/StreamingAssets/{0}", databaseName);
#else
        // check if file exists in Application.persistentDataPath
        var filepath = string.Format("{0}/{1}", Application.persistentDataPath, databaseName);

        if (!File.Exists(filepath))
        {
            Debug.Log("Database not in Persistent path");
            // if it doesn't ->
            // open StreamingAssets directory and load the db ->

#if UNITY_ANDROID
            var loadDb = new WWW("jar:file://" + Application.dataPath + "!/assets/" + databaseName);  // this is the path to your StreamingAssets in android
            while (!loadDb.isDone) { }  // CAREFUL here, for safety reasons you shouldn't let this while loop unattended, place a timer and error check
            // then save to Application.persistentDataPath
            File.WriteAllBytes(filepath, loadDb.bytes);
#elif UNITY_IOS
                 var loadDb = Application.dataPath + "/Raw/" + databaseName;  // this is the path to your StreamingAssets in iOS
                // then save to Application.persistentDataPath
                File.Copy(loadDb, filepath);
#elif UNITY_WP8
                var loadDb = Application.dataPath + "/StreamingAssets/" + databaseName;  // this is the path to your StreamingAssets in iOS
                // then save to Application.persistentDataPath
                File.Copy(loadDb, filepath);

#elif UNITY_WINRT
        var loadDb = Application.dataPath + "/StreamingAssets/" + databaseName;  // this is the path to your StreamingAssets in iOS
        // then save to Application.persistentDataPath
        File.Copy(loadDb, filepath);
#else
    var loadDb = Application.dataPath + "/StreamingAssets/" + databaseName;  // this is the path to your StreamingAssets in iOS
    // then save to Application.persistentDataPath
    File.Copy(loadDb, filepath);

#endif

            Debug.Log("Database written");
        }

        var dbPath = filepath;
#endif
        _connection = new SQLiteConnection(dbPath, SQLiteOpenFlags.ReadWrite | SQLiteOpenFlags.Create);
       // Debug.Log("Final PATH: " + dbPath);

}

Also I've created a filed in database keeping database version to check what version the user has (like the version with 400 levels, the one with 600 levels or maybe more).

What I don't know is what is the best solution to add more records to an existing database.
Has anyone got a solution?

sentences:
Torch fire always up regardless of handle direction I have a prefab from some asset pulled into our project.  It is a simple torch.. handle and a particle system for the fire.  Works perfect if mounted on a wall and torch angle adjusted no problem.

Now the problem.  I attach the torch to the hand of a walking person, so the arm is not "fixed" and is in a more fluent movement environment.  How can I adjust this (C# scripts possible to attach too) so that the fire element is always in an upright burning position even if the arm/hand are in a somewhat swinging position.

I'm still a little early on in my gaming exposure, but 3+yrs in C#.net and OOP experience.

sentences:
Are there many games involving the manipulation of water? I'm in the very, very early brainstorming stages of a game which centers around the manipulation of water and the terrain around it. (i.e., changing the water's state between solid, liquid, gas; building up or tearing down hills to control its flow; and so forth.)  I'm not yet sure if it should be a puzzle game, a platformer, or what.

Usually, when brainstorming a game, I try to find games with similar mechanics to see what is done well, poorly, etc.  But this time, I'm having trouble thinking of any games that use the flow of water as a primary mechanic.  (Pipe Dream is about all that comes to mind.)

So, I'm asking around...  does anyone know of any games where controlling water is a major aspect?  Is there much reference material (of any kind) on the subject of water as a gameplay mechanic?  Or any ideas where to look?

Thanks

sentences:
Object movement in Unreal using BPs and input touch and ARCore So I am trying to move an object in Unreal through input touch using ARCore. The problem is that I can't use the simple Screen to world position because it just returns a world position wherever the camera is at the time that you touch. I'm trying to convert the X and Y positions to actual space but, I am having a difficult time with it. Here's what I have so far:

This works okay, but the movement isn't equal if that makes sense. Obviously it's because I am just pulling the raw coordinates but, I honestly have no idea what I need to do to them in order to get it to move smoothly.

If you're still not following, basically, the closer I get to the left, top edge the slower the object moves and the closer I get to the right bottom edge the faster the movement. This happens because the X and Y coordinates get smaller/larger

What can I do to compensate for this disparity between coordinates?

Is there a way to get like a percentage from the edge of the screen?

sentences:
Advanced Animation for 2d Isometric Game? I need help with workflow suggestions for a flash game. (although the concepts would apply to other game engines, too).

In a game like: Hero Academy

There are several different character models each with a multiplicity of animations (walking, standing, getting hurt, attacking, etc.). I am certain that each of these could be manually animated and a sprite sheet generated and used, but when you add up how many animations and core drawings would be needed...that would be near insanity to complete.

So, in research I found that some are creating character models in Blender, Maya, a 3d engine of some kind - setting the camera angle to 45deg, etc. animating and exporting that sprite.

In each of these examples however, the character models were 3d looking i.e.: 3d to 2d

When I look at Hero Academy, they still look like a 2d drawing.

If I am looking to re-create a similar art style to Hero Academy and need several animations per model what is the most efficient/correct workflow to creating the animation? Manually creating each animation sprite in Flash? Or utilizing 3d and texturing it to look 2d?(if that is even possible)?

EDIT:
Thank you to all those who have posted great answers. To add information to the concept, one 'issue' I am contending with is the modeling/view of our desired game. To further clarify, if you look at Hero Academy's grid system (a la chess board) if you wanted an entity to be able to move vertically or diagonally this would need it's own sprites. However, is this still a simple 2d side scrolling game since the camera is fixed? And they have simply designed the background map to have the EFFECT of perspective?

If that is the case, then using Nuoji's comments, a 2d skeleton would then again be possible.

The base question is: if we are looking at close to 100 different character entities all with their own movement animation, long and close range attack animations, taunts, etc. what is the most expeditious method of doing this?

Note that I have experience in programming but no design/modeling experience. Whether we went the flash animation route or 3d modeling route I would be learning from scratch so any previous skill or preference is nullified.

sentences:
How do I solve my resolution problems? I am developing a game with XNA, and I am having trouble with resolutions. For now, I have only implemented the main menu, but I want to make a game that is independent of the resolution. As I am a beginner, I haven't taken into account the resolution, so far. When I changed the resolution, it gave me a real headache. The background image that I use has a 1920x1080 resolution, so it has an aspect ratio of 16:9. The initial resolution was 800x600, so the background image looks stretched. The same happens with resolutions with aspect ratio 4:3 (e.g. 640x480, 1024x768, etc.).

Before posting this question, I searched for information on the Internet. I found "XNA 2D Independent Resolution Rendering", and other similar solutions. The solution offered seems perfect for me, at first, because I wasn't thinking of using two resolutions; one internal, for drawing, and one that corresponds to the size of the window. However, I have been observing some problems.

When I enable fullscreen mode, and its resolution is lower than the desktop resolution, the game doesn't stretch the resolution to fill the entire screen. This makes the game draw at the center of the screen, but with a black border on both sides of the screen.

The aspect ratio of my background image is 16:9, however, the resolutions that I am trying have an aspect ratio of 4:3. With the page solution, I have the same problem; the background image seems to be stretched. I researched the code, to find a solution, and changed the RecreateScaleMatrix() function  to this:

private static void RecreateScaleMatrix()
{
    _dirtyMatrix = false;
    float aspect = 16.0f / 9.0f;
    _scaleMatrix =
        Matrix.CreateScale((float)_device.GraphicsDevice.Viewport.Width / _virtualWidth,
        (float)_device.GraphicsDevice.Viewport.Height / _virtualHeight, 1f) *
        Matrix.CreateScale(1, EngineManager.GameGraphicsDevice.Viewport.AspectRatio /
        aspect, 1) * Matrix.CreateTranslation(0, (_device.GraphicsDevice.Viewport.Height -
        (_device.GraphicsDevice.Viewport.Height / aspect)) / 4.0f, 0);
}

This seems to have solved the problem, but only on certain resolutions ,and further reducing the rectangle which show the final result.

I have been thinking about these problems all day, and I realized that without knowing the exact resolution of the image to draw, in advance (independent of aspect ratio), is almost impossible to draw an image clearly.

How do I solve my resolution problems?

sentences:
Why does my terrain texture fail to load? (OpenGL) I'm currently using a vertex shader and a fragment shader for loading my texture onto the terrain I made.

Here is my vertex shader

#version 330 core
layout (location = 0) in vec3 aPos;
layout (location = 1) in vec3 aNormal;

uniform mat4 model;
uniform mat4 view;
uniform mat4 projection;

float scale = 0.5;

out vec2 TexX;
out vec2 TexY;
out vec2 TexZ;
out vec3 blend_weights;

void main()
{
    vec3 blend_weights = abs(aNormal.xyz);
    blend_weights = (blend_weights - 0.2) * 0.7;
    blend_weights = max(blend_weights, 0);
    blend_weights /= (blend_weights.x + blend_weights.y + blend_weights.z);

    TexX = aPos.yz * scale;
    TexY = aPos.zx * scale;
    TexZ = aPos.xy * scale;

    gl_Position = projection * view * model * vec4(aPos, 1.0);
}

And here is my fragment shader.

#version 330 core
out vec4 FragColor;

uniform sampler2D terrainTexture;

in vec2 TexX;
in vec2 TexY;
in vec2 TexZ;

in vec3 blend_weights;

void main()
{
    FragColor = texture(terrainTexture, TexX)*blend_weights.x + texture(terrainTexture, TexY)*blend_weights.y + texture(terrainTexture, TexZ)*blend_weights.z;
}

I was trying to implement 3D texture planar projections, based on section 1.5 of this link
https://developer.nvidia.com/gpugems/GPUGems3/gpugems3_ch01.html

If I just try to implement the texture in a very simple way, it works (which looks terribly stretched on the mountanous terrains, of course). But if I implement it this way, the texture does not load. What could be the possible reason?

Just in case anyone is wondering, the following is my VAO, VBO, EBO configuration

// VAO, VBO configuration
    unsigned int VAO, VBO, EBO;
    glGenVertexArrays(1, &VAO);
    glGenBuffers(1, &VBO);
    glGenBuffers(1, &EBO);

    glBindVertexArray(VAO);
    glBindBuffer(GL_ARRAY_BUFFER, VBO);
    glBufferData(GL_ARRAY_BUFFER, positions.size()*sizeof(glm::vec3) + normals.size() * sizeof(glm::vec3) , NULL, GL_STATIC_DRAW);
    glBufferSubData(GL_ARRAY_BUFFER, 0, positions.size() * sizeof(glm::vec3), &positions[0]);
    glBufferSubData(GL_ARRAY_BUFFER, positions.size() * sizeof(glm::vec3), normals.size() * sizeof(glm::vec3), &normals[0]);
    glBindBuffer(GL_ELEMENT_ARRAY_BUFFER, EBO);
    glBufferData(GL_ELEMENT_ARRAY_BUFFER, indices.size() * sizeof(int), &indices[0], GL_STATIC_DRAW);
    glEnableVertexAttribArray(0);
    glVertexAttribPointer(0, 3, GL_FLOAT, GL_FALSE, 3 * sizeof(float), 0);
    glEnableVertexAttribArray(1);
    glVertexAttribPointer(1, 3, GL_FLOAT, GL_FALSE, 3 * sizeof(float), (void*)(positions.size() * sizeof(glm::vec3)));

This is my draw function

// Inside the render loop
void drawScene(Shader &shader, unsigned int VAO, unsigned int numIndices, unsigned int texture1)    //draw the scene with the parameter data.
{
    glm::mat4 model;
    model = glm::translate(model, glm::vec3(-(int)(gridXNum)/2, 0.0f, -(int)(gridZNum)/2));
    glm::mat4 view = camera.GetViewMatrix();
    glm::mat4 projection = glm::perspective(glm::radians(camera.Zoom), (float)SCR_WIDTH / (float)SCR_HEIGHT, 0.1f, 100.0f);

    shader.use();
    shader.setMat4("model", model);
    shader.setMat4("view", view);
    shader.setMat4("projection", projection);
    shader.setFloat("TERRAIN_WIDTH",gridXNum);

    glActiveTexture(GL_TEXTURE0);
    glBindTexture(GL_TEXTURE_2D, texture1);

    glBindVertexArray(VAO);
    glDrawElements(GL_TRIANGLE_STRIP, numIndices, GL_UNSIGNED_INT, 0);
    glBindVertexArray(0);
}

However, I really don't think this is the problem because as I said, if I change the shader codes into a really basic one, the texture successfully loads. There is definitely something wrong with my shader program. Any help would be appreciated. Thanks in advance!

sentences:
How can I make sure my OpenCL code works correctly on different graphic cards? I'm testing on adding some OpenCL code in my game, but I only have a single Nvidia card & I'm not sure the code will run normally on other platforms.

Is there any way to make sure my code runs as expected on different graphic cards without having direct access to the hardware myself?

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:
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:
How is money made from Steam Trading Card Farming Generators? in this SidAlpha Video, SidAlpha talks about how Valve may be doing something that could stop or interrupt Steam Trading Card Farming Generators by preventing them from generating keys.

This got me thinking. from my understanding you get Trading Cards either playing the game which gets you only so many, the rest you then need to create booster packs with Gems or buy them from the marketplace with your own funds. but what i don't get is

1) the name for this practice implies using Steam Trading Cards to make money, however i can't see how "developers" can make money as,

you have to originally own the card you're selling on the market place
when it's brought it goes to your wallet which you can't transfer Steam wallet fund off Steam

and i wouldn't think Valve would allow "developers" to create any number of trading cards for their games at will then sell them because this is obviously very easily abused

2) in the video SidAlpha mentions that reducing/blocking Key generation may have an impact to those who use Steam Trading Card Farming Generators, noting that a certain user base is actually worried it. but i'm not sure how key generation fits in to the scam.

So my question is how is money made from Steam Trading Card Farming Generators? and how do Steam Keys fit in to this?

sentences:
How to calculate final force vector for the SKSpriteNode I am creating space game which has an effect similar to black hole's gravitational effect. Wherever the spaceship is going, the black hole will attract it, summing up all the vectors together.

I know SKFieldNode has a method customFieldWithEvaluationBlock: that allows to calculate everything myself, but might it be another way to do that?

I have tried almost every type in SKFieldNode, but nothing helped.

There are some side effects that don't suit me (i.e. If I use an electric or magnetic field, the object repels from the black hole)
Moreover, moving with SKAction (i.e. for the spaceship) doesn't allow me to sum all movement vectors together (I cant do
- (void)moveTo:duration: actions simultaneously, even with grouping the actions)

What can you advice me? !

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:
libGDX: Linking 3D scene from 2D screen Using libGDX I have created a few 2D screens, such as a splash screen and a main menu, and also created a 3D scene which I want to be able to load when clicking a button on the main menu.
I know how to add a listener but I don't know what command to use to show the 3D scene on the screen. If I use setScreen(new World3D) (or other similar extended methods) it gives me:
 World3D cannot be cast to com.badlogic.gdx.Screen

What I want to know is how to get from the 2D screen to the 3D scene. Do I wrap the 3D scene inside the screen or am I doing it right but my World3D class is not set up properly?
Here is a pastebin of my World3D class in case that is the problem.

NOTE: The classes are in separate sub-packages but the proper imports have been added in the required classes.

sentences:
How can I load a script once in LuaJit/Lua and use it across multiple VMs in different threads? So, I came across an interesting problem. I'm implementing some threaded game logic, and one of the things I decided to do was to use Multiple Lua VMs, with each worker thread containing its own VM.

I don't intend for the scripts themselves to actually handle any data across threads. For the most part, the VMs will very rarely use the heap - as most things will be handled on the stack. The VMs are basically workhorses that drives the logic of the game, while the C++ end handles all of the data.

One of the things I noticed very quickly, is that as I get more scripts, I'm basically increasing my memory usage by a multiple of however many worker threads I am creating. This is because each State needs to load a copy of a script.

Is there a way, and how can I handle this without flooding my memory with 4+ copies of the same script? As in, one state loads in all of the scripts at the start, and puts them in memory. Then all other VMs are able to access those scripts?

sentences:
My player died and if i clicked play in the main it will go to the last scene and say gameover I am trying to make a gameover scene where in if the player is game over The game will go back to the main or start up then when I press play it will start new game however if i am game over and go back to main and pressed play it will only show me Game over and wont continue my code is.....
Gameover code..

#pragma strict
import UnityEngine.UI;
private var StopGame: boolean=false;
private var showGUI: boolean=false;
var GUIstop: GameObject;
var StopMenu;
var respawn : Transform;

private var canvas : Canvas;

function Start()
{
canvas = GetComponent.<Canvas>();
canvas.enabled = false;
}

function Update () {

if(HealthControl.LOVES==0){
Pause();

  Application.LoadLevel (0);

}

}
public function Pause()
{
canvas.enabled = !canvas.enabled;
Time.timeScale = Time.timeScale == 0 ? 1 : 0;
}

public function Quit()
{
#if UNITY_EDITOR
EditorApplication.isPlaying = false;
#else
Application.Quit();
#endif
}

sentences:
Follow Camera to Two objects at different time I am developing simple 2D game in unity. I am locked with the camera movement for last two days. I've camera script that is working as follows:

Follow the player to X and Y direction
If player stops moving, Camera must find the nearest enemy and should move to that direction

Both of the above function works fine, but separately.

Camera finds and follows the enemy, when there is no input from player for last 10 seconds.

But after few seconds (When stops following enemy), Camera retains the player's position. That creates unlikely effect in the scene. I want the camera to have a last position and started following player from there.

For your reference I'm writing my Camera Script.

public class MultipleTargetCamera : MonoBehaviour {   public List<Transform> targets;
[ReadOnly]
public GameObject closestEnemy = null;

public EnemyController closestEnemyController = null;

public Vector3 offset;
public float smoothTime = 0.5f;

private Vector3 velocity;

Vector3 camPosition;

// Update is called once per frame
void LateUpdate()
{
    /* if (targets.Count == 0)
         return;*/
    if (!TheGlobals.instance.movingTowardsEnemy)
    {
        MoveCamera();
    }
    else
    {
        MoveAsEnemy();
    }
}

void MoveAsEnemy()
{
    camPosition = new Vector3(transform.position.x + closestEnemyController.xDiff,
            transform.position.x + closestEnemyController.yDiff,
            transform.position.z);
    transform.position = Vector3.SmoothDamp(transform.position, camPosition, ref velocity, smoothTime);
}

void MoveCamera()
{
    Vector3 centerPoint = GetCenterPoint();

    Vector3 newPosition = centerPoint + offset;

    transform.position = Vector3.SmoothDamp(transform.position, newPosition, ref velocity, smoothTime);
}

Vector3 GetCenterPoint()
{
    Vector3 targetPos= new Vector3(targets[0].position.x,
        targets[0].position.y,
        transform.position.z);

    if(targets.Count==1)
    {
        return targetPos;
    }

    var bounds = new Bounds(new Vector3(targets[0].position.x,
        targets[0].position.y,
        transform.position.z), Vector3.zero);

    for(int i=0;i<targets.Count;i++)
    {
        bounds.Encapsulate(new Vector3(targets[i].position.x,
        targets[i].position.y,
        transform.position.z));
    }

    return bounds.center;
}

public void FindNearestEnemy()
{
    GameObject[] gos;
    gos = GameObject.FindGameObjectsWithTag("Enemy");

    float distance = Mathf.Infinity;
    Vector3 position = transform.position;
    foreach (GameObject go in gos)
    {
        Vector3 diff = go.transform.position - position;
        float curDistance = diff.sqrMagnitude;
        if (curDistance < distance)
        {
            closestEnemy = go;
            distance = curDistance;
        }
    }
    closestEnemyController = closestEnemy.GetComponent<EnemyController>();
    targets[0].parent = this.transform;
    StartCoroutine(StopMovingTowardsEnemy());
}

IEnumerator StopMovingTowardsEnemy()
{
    yield return new WaitForSeconds(0.01f);
    TheGlobals.instance.movingTowardsEnemy = false;
}

}

I hope I did explain well. Looking for the answer. Thank you in advance!

sentences:
How to Call a function from another script? I just learned in a C# tutorial that we can declare var name = new ClassNameOfOtherScript(); to create a new class object, then use the object to call the function in that class, but it doesn't seem to be working in Unity.
Am I understanding it wrong or does it work differently in Unity?
I have a class Cube1 this is attached to an object with SpriteRenderer enabled. Then I have another script ClockController which is not attach to any object. When I run it, the color of cube does not change to red?
public class Cube1 : MonoBehaviour
{

    public void Rectangle()
    {
        GetComponent<SpriteRenderer>().color = Color.red;
    }

}

public class ClockController : MonoBehaviour
{

    void Start()
    {
        var cube1 = new Cube1();
        cube1.Rectangle();
    }
}

sentences:
How to get an OnClick Event in Unity to action? I am new to Game Dev and I am following a Tutorial.  Within this tutorial, we create a quest system, that allows you to accept or decline a quest. This tutorial is based on Unity 5 and I am using 2020.1 so there could be version differences that could be causing the issue.
I have a script called:
Quest001Buttons.cs
public class Quest001Buttons : MonoBehaviour {
    public GameObject ThePlayer;
    public GameObject NoticeCam;
    public GameObject UIQuest;
    public GameObject ActiveQuestBox;
    public GameObject Objective01;
    public GameObject Objective02;
    public GameObject Objective03;

    public void AcceptQuest() {
        Debug.Log("Accept Registered");
        ThePlayer.SetActive(true);
        NoticeCam.SetActive(false);
        UIQuest.SetActive(false);
        StartCoroutine(SetQuestUi());
    }

    IEnumerator SetQuestUi() {

        ActiveQuestBox.GetComponent<Text>().text = "My First Weapon";
        Objective01.GetComponent<Text>().text = "Reach the Clearing";
        Objective02.GetComponent<Text>().text = "Open Chest";
        Objective03.GetComponent<Text>().text = "Get Weapon";
        QuestManager.ActiveQuestNumber = 1;
        yield return new WaitForSeconds(0.5f);
        ActiveQuestBox.SetActive(true);
        yield return new WaitForSeconds(1);
        Objective01.SetActive(true);
        yield return new WaitForSeconds(0.5f);
        Objective02.SetActive(true);
        yield return new WaitForSeconds(0.5f);
        Objective03.SetActive(true);
        yield return new WaitForSeconds(9);
        ActiveQuestBox.SetActive(false);
        Objective01.SetActive(false);
        Objective02.SetActive(false);
        Objective03.SetActive(false);

    }
}

I have an Empty GameObject called "QuestButtonManager" which I have assigned the above script to.
I also have a UI GamObject called "Accept" and I have attached the QuestButtonManager GameObject to the OnClick() Event within that component.  I have selected:
"Runtime Only" and the function of "Quest001Buttons.AcceptQuest".
When I run the game and press the Accept Button...the game seems to not function after that and is stuck on that screen, with the button highlighted...not even the Debug.Log text is printed in the console.
Any help is greatly appreciated before I give it up and look for a more updated version to learn on.

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

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

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

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:
How to make player seem bigger / world smaller, without changing world coordinates I am making a voxel game with OpenGl, I've got the major parts working, except the camera seems small compared to the the blocks.
How do I make the camera bigger?
Do I do a scaling on the model matrix for each chunk? Or do I do something with the view matrix of the camera? When i tried these things, it messed up the coordinate system of my game, the blocks were not where they really were. I just want the player to be visually 2x bigger.
// the view matrix
glm::mat4 Camera::GetViewMatrix()
{
    glm::mat4 view = glm::lookAt(position, position + target, up);
    return view;
}

    // Where i do the chunk rendering
void WorldRenderer::RenderChunck(Chunk *c)
{
    glActiveTexture(GL_TEXTURE0);
    worldTexture->BindTexture();
    worldShader->Bind();
    worldVertexBuffer->BindVertexArrayBuffer();
    worldVertexBuffer->PutVertexData(c->meshData.verts, c->meshData.indices, c->meshData.textureCoords);

    glm::mat4 model = glm::mat4(1.0f); // model = local space to world space
    model = glm::translate(model, vec3(c->pos.x * Chunk::CHUNCK_SIZE, c->pos.y * Chunk::CHUNCK_SIZE, c->pos.z * Chunk::CHUNCK_SIZE));

    worldShader->setMat4f("model", model);
    glDrawElements(GL_TRIANGLES, c->meshData.indices.size(), GL_UNSIGNED_INT, 0);
}
void WorldRenderer::Render(glm::mat4 projectionMatrix, glm::mat4 viewMatrix)
{
    worldShader->setMat4f("view", viewMatrix);
    worldShader->setMat4f("projection", projectionMatrix);

    for (Chunk *c : renderedChunks)
    {
        this->RenderChunck(c);
    }
}

sentences:
Can inflation exist in a fixed price Mmorpg world? Assumptions:

Crafting materials are infinite. Limit is player boredom.
Players can only trade through the auction house. All prices are fixed. Players cannot decide arbitrary prices.
Goods in auction house stay stored for infinite duration and cannot be withdrawn by auction creator (except if he pays 100% item price + 10% auction fee).
Sell algorithm is FIFO (First item placed by any player is first item sold).
Crafting and gathering professions have a cool-down of 10 craft points per day.

Questions / Points to talk about:

All players will be happy, fair 100% prices, scam free, no need to play stock exchange market to make a profit through crafting. New Players would have the same experience even if they arrive too late to the game.
Money never loses its value, you could store money in a bank, arrive after 10 years to the game and buy everything at the same price. In contrast in WOW, a simple copper ore was worth 10 silver at the game start and now has ended as 200 silver. That's 2000% inflation.
By having fixed prices, you guarantee that even if all players in the universe have 99999999999g in their pocket, the goods are worth the same. So that's guaranteed 0% inflation. Hackers may cry all they want, but goods prices will never change.
Why didn't WOW / Diablo III used this model? They would have become billionaires with the 10% money grab technique.

Btw: my previous question on economy overflow was never answered, probably that site is dead. https://economics.stackexchange.com/questions/14609/understanding-inflation-in-a-video-game

sentences:
Need help starting with a game in Flash/AS3 I am kinda new to flash/AS3. I have written some stuff and now I now the basics of AS. I want to develop a game in which my character moves. exactly like the way Super Mario moves(the background changes and new obstacles come in the way like and animation with which you can interact by climbing and shooting etc.) There is one big thing that I don't understand is that how to make my  background moving and introduce new obstacles when my character moves forward. Currently my scene is static which means the background is the same and obstacles are also stationary. Can some point me to a tutorial or give me an answer that solves my confusion?
thanks

sentences:
How do I design my classes so that my Player.cs code can use class-specific abilities from another script? Right now, I have a Player.cs class that handles button pushes, movement speed, damage, Update() etc. At the moment, all of the logic for button presses triggering an ability, and the logic surrounding that ability lives in my player.class. I'd like to take that logic and put it into an Abilities.cs class. All I want in my player at most would be:

public override void Update()
{
    if (button.pushed == "berserkKey")
    {
       ability.berserk();
    }
}

... where for example berserk is a stacking buff but none of that logic is in my player class anymore.

For additional context, I plan to implement a Classes.cs class which will hold the info on classes (warrior/archer/etc) which will know exactly what the class and therefor player can use. The code above will likely abstract out even more when that is the case.

The problem is that my Player class already inherits from another class. How do I go about designing my Classes and Abilities classes in a way that my player can use them in the example above?

I'm also open to a completely different way if my initial thought here isn't ideal.

sentences:
"Overloading" GameObject? I would like to show weapons and health items in an inventory grid.

The item can be rotated in the grid, and it occupies a certain region in the grid.

Currently I store this information (where the item is located, if it is rotated, etc.) in an additional array. However, this is not elegant and error prone.

I would therefore like to ask if it is possible to somehow store this additional information directly in the weapon or health GameObject.

Ideally I would like to be able to do something like this:

Pistol.GridProps.Rotation = 90
Pistol.GridProps.Row = 5
Pistol.GridProps.Col = 3

Is it possible to add something like "GridProps" to all my game objects?

Thank you!

sentences: Unity - Custom aspect ratio in build I have made a game that was supposed to be for mobile but now I need to build it for PC. I want the aspect-ratio to be 2:3 but as you can see on the image that doesn't exist. How do I add a custom aspect-ratio for the build?

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:
How can a one-man team create game audio? I am basically a 14 years game programmer.
I am using Unreal Engine 4.

I can't make a game without 3D models.
So , I started to learn how to draw (for reference images) and how to make some 3D models.
I am using Corel Painter and Blender.

I can't make a game without audio.
This is a much larger problem than the models' one.
There aren't high quality (or even low quality) tutorials that can teach you "How to make music for your game" or "How to make sound effects for your game"

I made a topic on Unity forums and they suggested to me to hire someone who can create the audio for me but I really want to make everything myself as the game I'm working on will not be published, it's just a 'showcase' for my programming 'skills'.

So, I need a program and maybe a MIDI controller that is user friendly like Ableton Push, for example, that I can use to create sound effects for my game like explosions, fire, engines' sound, ... etc. The Music isn't a much of a problem as I can use something like MAGIX Music Maker as it has user friendly interface and can create some really good music.

Thanks in Advance

sentences:
score aggregation service Before i write my own asp.net app, i wanted to see if there is an existing service already.
What i am looking for is send # of zombies the player killed at the end of game to the service. The service than shows sum of all zombies killed that day in the world by other players.
It will also show top 3 players by their summed score today, not their best score in one game.
Is there such service available or do i have to roll out my own?
thanks

Moderator marked this as duplicate of this but the service mentioned in the topic is no longer in service.

sentences:
Box2d -- get free space I am developing a little Game with something like particles, where every particle is represented by a box2d Body.

To insert new particles I need to find a place in the b2World where no bodies reside. How can I obtain this?

greeting...

sentences:
getting a black screen instead of the background image Was creating a my first game in AndEngine and am only getting a black screen instead of getting the background image and play button..
Here the code
MainActivity

public class MainActivity extends BaseGameActivity {

private BoundCamera camera;
private float WIDTH = 800;
private float HEIGHT = 480;

@Override
public Engine onCreateEngine(EngineOptions engineOptions){
    return new LimitedFPSEngine(engineOptions,60);
}

@Override
public EngineOptions onCreateEngineOptions() {

    camera = new BoundCamera(0,0,WIDTH,HEIGHT);
    EngineOptions engineOptions = new
            EngineOptions(true, ScreenOrientation.LANDSCAPE_FIXED, new FillResolutionPolicy(),camera);
    engineOptions.getAudioOptions().setNeedsMusic(true).setNeedsSound(true);
    return engineOptions;
}

@Override
public void onCreateResources(OnCreateResourcesCallback pOnCreateResourcesCallback) throws IOException {

}

@Override
public void onCreateScene(OnCreateSceneCallback pOnCreateSceneCallback) throws IOException {

}

@Override
public void onPopulateScene(Scene pScene, OnPopulateSceneCallback pOnPopulateSceneCallback) throws IOException {

}
}

BaseScene.java

public abstract class BaseScene extends Scene {

protected Engine engine;
protected Activity activity;
protected ResourceManager resourceManager;
protected VertexBufferObjectManager vbom;
protected Camera camera;

public BaseScene(){
    this.resourceManager = ResourceManager.getInstance();

    this.activity = resourceManager.activity;
    this.engine = resourceManager.engine;
    this.vbom = resourceManager.vbom;
    this.camera = resourceManager.camera;

    createScene();
}

public abstract void createScene();
public abstract void onBackKeyPressed();
public abstract SceneManager.SceneType getSceneType();
public abstract void disposeScene();
}

SceneManager.java

public class SceneManager {

private BaseScene mainMenu;
private BaseScene gameScene;

private BaseScene currentScene;

private static final SceneManager INSTANCE = new SceneManager();

private SceneType currentSceneType = SceneType.SCENE_MENU;

private Engine engine = ResourceManager.getInstance().engine;

public enum SceneType
{
    SCENE_MENU,
    SCENE_GAME
}

public void setScene(BaseScene scene){

    engine.setScene(scene);

    currentScene = scene;

    currentSceneType = scene.getSceneType();

}

public static SceneManager getInstance(){
    return INSTANCE;
}

public SceneType getSceneType(){
    return currentSceneType;
}
}

I have 2 more classes MainMenu and ResourceManager
What is the problem here?

sentences:
400 bad request UnityWebRequest hey everyone any ideas why im getting a 400 error? im trying to post a json to a subscription list. doing that through postman works just fine!
using System;
using System.Collections;
using System.Collections.Generic;
using System.IO;
using System.Text;
using UnityEngine;
using UnityEngine.Networking;
using UnityEngine.UI;

public class testing : MonoBehaviour
{
    //public InputField field;
    [SerializeField]
    private Email _email = new Email();
    private string URL = "https://a.klaviyo.com/api/v2/list/YeXzKp/members?api_key=pk_ec448e1bdab7504c143466ca5eeabc5e95&profiles=[]";
    IEnumerator SaveIntoJson()
    {
        string data = JsonUtility.ToJson(_email);
        System.IO.File.WriteAllText(Application.persistentDataPath + "Data.json", data);

        //UnityWebRequest www = UnityWebRequest.Post("URL", data);
        //www.SetRequestHeader("Content-type", "application/json");
        UnityWebRequest request = UnityWebRequest.Put(URL, data);
        request.SetRequestHeader("Content-Type", "application/json");
        yield return request.SendWebRequest();
        //yield return www.SendWebRequest();

        if (request.isNetworkError || request.isHttpError)
        {
            Debug.Log(request.error);
        }
        else
        {
            Debug.Log("Form upload complete!");
        }
        Debug.Log(data);
    }

    public void SaveData()
    {
        StartCoroutine(SaveIntoJson());
    }
}
[System.Serializable]
public class Email
{
    public List<Profiles> profiles = new List<Profiles>();
}

[System.Serializable]
public class Profiles
{
    public string email;
}

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:
How to render animated models via instanced rendering? I have an animated model with a maximum of 60 bones. That means i have an array of 60 matrices when i want to render the model. Previously i would just create a uniform with the fixed size (mat4[60]), but now i want to render the model via instanced rendering, which means i need to write 60 matrices per instance into the VAO of the model.

This would mean i have to create 240 vertex attributes each containing 4 floats because thats the maximum number of floats an attribute can have. This is obviously a ridiculous solution, besides the fact that i think it exceeds the maximum number of attributes a VAO can have.

So how do i render animated models via instance rendering?

sentences:
Camera - View matrix in Android + openGLES 2 I am trying to use the touch screen on the tablet to control my camera movements and generate the view matrix accordingly.

I get the x and y coordinates of the screen and after doing some sanity checks on it I use them. My problem is I get the image and based on the movement it moves - but the object is always at a offset from the touch/pointer position. And I am not able to understand why. ( Kind of new at it)

Here is the camera logic -  Where pX and pY are coordinates of the device screen.

pitch = pY * 0.05;
yaw =   pX * 0.05;

LOGD(">>pitch %f", pY);

pitch = min(pitch,90.0f);
pitch = max(pitch,-90.0f);

LOGD(">>pitch(alter) %f", pitch);

if(yaw < 0) {
    yaw += 360.0f;
}
if(yaw > 360.0f) {
    yaw -= 360.0f;
}

I am not sure whether I am going about it in the right direction. Any suggestions will be appreciated.

sentences:
Is this a good way to "get rid of the sprite shakes" for my sprites that "target" other sprites? (XNA) I'm relatively new to XNA, but very proficient with C#. I want to know if this is the best way to solve the sprite shaking problem. I had a sprite class that can target a place/other sprite on the map and follow it.

Here's my update method:

public override void Update(GameTime gameTime)
    {
        //move this rectangle closer to the target
        float EntitySpeed = 100f; //this is actually a property
        Vector2 velocity = new Vector2();
        if (_target.GetX() < this.GetX())
            velocity += new Vector2(-1, 0) * EntitySpeed;
        if (_target.GetX() > this.GetX())
            velocity += new Vector2(1, 0) * EntitySpeed;
        if (_target.GetY() < this.GetY())
            velocity += new Vector2(0, -1) * EntitySpeed;
        if (_target.GetY() > this.GetY())
            velocity += new Vector2(0, 1) * EntitySpeed;

        //a guy on pluralsight said it's best to update velocity taking a time into consideration to account for faster/slower computer speeds
        var movement = (velocity * (float)gameTime.ElapsedGameTime.TotalSeconds);
        _position += movement; //position is a Vector2

        //is the code below a good solution to get the sprite to stop shaking?
        //if we're "close" to the target sprite, then set the position exactly
        Vector2 vectorDiff = this._position - new Vector2(_target.GetX(), _target.GetY());

        bool xReached = Math.Abs(vectorDiff.X) <= Math.Abs(movement.X);
        bool yReached = Math.Abs(vectorDiff.Y) <= Math.Abs(movement.Y);

        if (xReached)
            _position.X = _target.GetX();
        if (yReached)
            _position.Y = _target.GetY();

    }

sentences:
Converting A 3D Rotational Vector Into A 3D Forward Heading Vector I need to do a raycast which accepts a Vector3D StartPos and a Vector3D EndPos.

I have available to me the characters position and the cameras rotation in 3D vectors.

I need to somehow compute a 'forward heading' from the cameras rotation and apply it to the players position and multiply by some large number to get my EndPos vector however I can't figure out the math behind it, I know I can use sin() and cos() here which is the approach i'd like to take.

irr::core::vector3df CamRotation = GetOwner()->GetRotation();
irr::core::vector3df StartPos(GetOwner()->GetPosition().x(), GetOwner()->GetPosition().y(), GetOwner()->GetPosition().z());
irr::core::vector3df EndPos(0, 0, 0);

I've experimented around with using sin() and cos() in different combinations throwing in negative signs into places but quite frankly I don't know how to properly use those functions.

sentences:
Which code is faster to convert -1 to 0 and 1 to 1? I'm writing a shader for rendering the sides of triangles with different colors. I have a value mediump float back = dot(V, N) which is positive if the normal faces away from the camera and negative if towards the camera.

To correctly select which diffuse color to shade a particular fragment, I need something like this:

lowp vec4 color = max(0.0, sign(-back)) * frontdiffuse + max(0.0, sign(back)) * back diffuse;

It's more or less an "unrolled conditional"...

Which code produces faster instructions?

x * 0.5 + 0.5, or
max(0.0, x) ?

The former may be better mathematically behaved than the latter, but maybe min/max/clamping is super efficient in hardware

sentences:
Game programming basics under Windows I've been trying to learn some Windows programming using the Win32 API. Now, i'm used to working with the OS layer being abstracted away, mostly thanks to libraries like SFML or Allegro. Could you guys help me out and tell me if i'm thinking right here.

The place for my gameloop is where i'm reading the messages?

while (TRUE)
{
     if (PeekMessage (&msg, NULL, 0, 0, PM_REMOVE))
     {
          if (msg.message == WM_QUIT)
               break ;

          TranslateMessage (&msg) ;
          DispatchMessage (&msg) ;
     }
     else
     {
          //my game loop goes here
     }
}

Now the slightly bigger issue, that is, drawing. Do i run my drawing where i normaly do it, inside the game loop after the game logic? Or do i do it when WM_PAIN is being called and just call InvalidateRect (hwnd, NULL, TRUE); when i want to draw? This does feel weird, the WM_PAINT is a queued message, so i don't know for sure when it'll be called. So if i wanted to avoid this, do i just get the device handle inside the game loop and only ValidateRect (hwnd, NULL); in the WM_PAINT case (beside the ValidateRect (hwnd, NULL); called after drawing in the game loop)? Actually, now that i think about it, do i even need WM_PAINT in this situation or can i skip it and let DefWindowProc handle it (does it validate the screen if WM_PAINT isn't processed)?

If this is any important, i'm setting up my code for OpenGL.

sentences:
Unity: how to change runtime code for different platforms? In Unity, how can I programmatically control what source code is compiled?

I have a script with various BuildPipeline.BuildPlayer calls, allowing me to build all versions of my game. However, I'm using the AVPro Video asset to play video, and it doesn't support 32bit Mac. As such, I need to fall back other video playing code on 32bit Mac. There's no preprocessor directive to differentiate 32bit OSX (like you can do for other platforms https://docs.unity3d.com/Manual/PlatformDependentCompilation.html ).

However, since I'm building each version in sequence, it seems like I should be able to set some state so that during compilation, the right code is used. I tried this:

VersionHandler.onMac32 = true;
BuildPipeline.BuildPlayer(levels, path, BuildTarget.StandaloneOSXIntel, BuildOptions.None);
VersionHandler.onMac32 = false;

And then checking that static variable in game. However, that static is "never set", presumably because the the state of the variable during compilation doesn't affect the value at runtime. Is there any other way I can "get at" the compiled code and set a flag for certain builds?

As a fallback, I can manually swap code in every time I build for OSX 32-bit, but I'd prefer not to do that.

sentences:
Spin camera around origin/focus in Unity editor I have used Blender a bit, and like the way the camera in the editor orbits around the focus/origin when dragging with middle click.

I've recently been using Unity a little and despise the camera controls; right-dragging sort of moves the camera's view a little and middle-dragging moves the camera along a plane. Not very good to get to different angles I'd like to see from.

Is there a way to set the Unity 3D editor's camera to work like Blender's?

sentences:
Augmented reality on Mobile platform - iOS Is there a way that we can control the iOS device camera to an extent what colors it sees, what shapes it sees ? etc

I'm speaking about the ability to read information before the image is captured.

Consider my question as: Possibility of making an augmented reality game on iOS phones.

I dont find relevant help for my query in internet/iOS developer site. Hence posting here.

sentences:
How to detect syntax error in unity shader scripting Hi. I'm following shader scripting tutorial and I often make syntax mistakes.
like other languages, can you have visual studio automatically underline with red color?

sentences:
Linear color workflow with render to texture - Banding in alpha channel? In OpenGL, I am using GL_SRGB8_ALPHA8 for the OpenGL internal texture format for my textures and render targets. This eliminated some banding I was seeing in dark opaque areas. However, in the following screenshot, you can see there is still some banding in the nearly-opaque black pixels on the left side. The render target is transparent in the areas where you see the checkerboard pattern.

Semitransparent pixels in SRGB formatted textures and render target textures appear too transparent when rendered to the screen, and pixels that are very nearly opaque (254, 253, 252 alpha) show noticeable banding as you can see in the sample image.

I've seen the issue with both SRGB formatted render target textures and ordinary textures with SRGB format.

The banding appears to go away if I don't call glEnable(GL_FRAMEBUFFER_SRGB).

I'm using premultiplied alpha, but I'm pretty sure I've eliminated that as a cause of the issue. I'm not doing anything to the sampled color in the pixel shader.

My blend functions:

// Non-premultipled alpha textures
glBlendFuncSeparate( GL_SRC_ALPHA,  GL_ONE_MINUS_SRC_ALPHA,
                     GL_ONE,        GL_ONE_MINUS_SRC_ALPHA);

// Premultiplied alpha textures
glBlendFuncSeparate( GL_ONE,        GL_ONE_MINUS_SRC_ALPHA,
                     GL_ONE,        GL_ONE_MINUS_SRC_ALPHA);

I tried exporting my render target to a PNG, and the true alpha values stored in the render target are increasing by 1 at each band. The texture appears much more opaque in image editors than it does in my app.

Any advice as to what could cause this kind of alpha banding?

sentences:
How can I find the largest sphere that fits inside a frustum? How do you find the largest sphere that you can draw in perspective?

Viewed from the top, it'd be this:

Added: on the frustum on the right, I've marked four points I think we know something about.  We can unproject all eight corners of the frusum, and the centres of the near and far ends.  So we know point 1, 3 and 4.  We also know that point 2 is the same distance from 3 as 4 is from 3.  So then we can compute the nearest point on the line 1 to 4 to point 2 in order to get the centre?  But the actual math and code escapes me.

I want to draw models (which are approximately spherical and which I have a miniball bounding sphere for) as large as possible.

Update: I've tried to implement the incircle-on-two-planes approach as suggested by
bobobobo and Nathan Reed :

function getFrustumsInsphere(viewport,invMvpMatrix) {
    var midX = viewport[0]+viewport[2]/2,
        midY = viewport[1]+viewport[3]/2,
        centre = unproject(midX,midY,null,null,viewport,invMvpMatrix),
        incircle = function(a,b) {
            var c = ray_ray_closest_point_3(a,b);
            a = a[1]; // far clip plane
            b = b[1]; // far clip plane
            c = c[1]; // camera
            var A = vec3_length(vec3_sub(b,c)),
                B = vec3_length(vec3_sub(a,c)),
                C = vec3_length(vec3_sub(a,b)),
                P = 1/(A+B+C),
                x = ((A*a[0])+(B*a[1])+(C*a[2]))*P,
                y = ((A*b[0])+(B*b[1])+(C*b[2]))*P,
                z = ((A*c[0])+(B*c[1])+(C*c[2]))*P;
            c = [x,y,z]; // now the centre of the incircle
            c.push(vec3_length(vec3_sub(centre[1],c))); // add its radius
            return c;
        },
        left = unproject(viewport[0],midY,null,null,viewport,invMvpMatrix),
        right = unproject(viewport[2],midY,null,null,viewport,invMvpMatrix),
        horiz = incircle(left,right),
        top = unproject(midX,viewport[1],null,null,viewport,invMvpMatrix),
        bottom = unproject(midX,viewport[3],null,null,viewport,invMvpMatrix),
        vert = incircle(top,bottom);
    return horiz[3]<vert[3]? horiz: vert;
}

I admit I'm winging it; I'm trying to adapt 2D code by extending it into 3 dimensions.  It doesn't compute the insphere correctly; the centre-point of the sphere seems to be on the line between the camera and the top-left each time, and its too big (or too close).  Is there any obvious mistakes in my code?  Does the approach, if fixed, work?

sentences:
nvidia SSAO visible errors I am trying to add ssao effect to a visualization application but there are errors in resulting image. I am using code from https://github.com/nvpro-samples/gl_ssao .
Errors occur in rapidly changing lighting near the edges of screen.

Only change to code was to remove basic shading and passing only white from scene.frag shader so the error could be seen more pronounced. I also added obj input to import sponza scene but the error is visible with the included sample scene as well if camera is moved close to object.
As is this implementation only enables viewing objects in relative distance. Moving closer to objects brings up this errors.

What causes this error and is there fix.

sentences:
Copyright and patents on game design and names? We all know that each game has elements from another game but when does one cross the line of copyright? I have a view particular questions about this since this "line" is very vague.

While looking for a name and Googling it usually return some kind of old or unknown game already with the exact same name. Can i use this name? And what about a name like Diablo, since Diablo is the commonly used name for the devil there cannot be a patent on this afaik. So would a different kind of game named Diablo be allowed?
Let's say i want to make a game of mechs like in Mechwarrior. Obviously the mech designs have copyright, the name as well since i suppose. But am i crossing any rights if i make a top down tactical squad game that include mechs of different designs/names and call it Clash of Steel?

I understand there are not much lawyers here, but how could anyone create a game these days that does not cross the lines of copyright. Like the Mechwarrior example, there are plenty of games nowadays even movies that use this concept. For what it matters Mechwarrior could have ripped the idea from the Gundam anime series. With so many titles coming out each week including the indies it is next to impossible not to infringe into someone copyright.

sentences:
RTS Attack Formation If i select a group of units and send them somewhere i form them like the following;

If i select them and order an attack, i want three things to happen:

High range units should keep the distance while attacking.
Each unit should attack if possible.
Attack formation should not look too unnatural.

Now i can handle the first two by forming the units as a circle by considering the range and unit count etc. But it looks very unnatural.

It's acceptable if some of the units are being idle for some reason, but i want most of the units join attack and they don't look so artificial.

Any ideas on that? Thanks.

sentences:
Game built uses a lot of GPU processing, in the editor uses very little I am building my project in Unity 2018.2.21f1 for Windows in architecture x86_64, with:

Copy PDB files | false
Create Visual Studio Solution | false
Develoment Build | false
Autoconnector Profile | false
Scrit Debuggin | false
Scritps Only Build | false

Mainly I built them and run because added several assets of the store and I wanted to see that there was no problem.

If at first glance everything worked fine. But I had the Task Manager open and I saw that the GPU had a lot of use 70% to 80% (I have a GTX 1080) and the game is 2D. My demo only has 22 sprites, without UI which I found very strange, so I opened the FireStorm (a Zotac GPU Manager) All the values of the graphics were extremely high (even started to sound a lot the fan) GPU core clock extreme high, GPU Temperature Very High, GPU Utilization Very High too.

But when I run the game inside the Unity editor, it's very normal values for a game with 22 sprites.

I continued making tests note that when the game is running the option of Graphic Quality in Fastest is selected by default, here the use of the GPU increases considerably 70% probe the rest and I have the following

Fastest 70% GPU use
Fast 70% GPU use
Simple 70%-75% GPU use
Good 6-20% GPU use
Beautiful 22-23% GPU use
Fantstic 22-23% GPU use

So the problem apparently is in the quality configuration.
What concept can be the one that generates this problem? Everything is by default in Unity until now

EDIT

I have 5 scenes, only in 1 there is the problem. The scene has sprites that use Shader Weaver. I removed them and did the tests again. What I notice is that in the new build, when I run in fantastic I have the problem of high GPU consumption and in "beautiful" it increases to 40

Also in imported Tower Defense 2D of GOODDAY that modifies the project configuration. And a couple of days ago import 2D Shooter Bullet and Weapon System which also modifies the configuration.

In Quality Settings actualy have this

I understand that vSyncCount limit the update rate

Because the levels with the worst performance have the "Dont sync" option set, meanwhile Good and Beatifull is in Every V Blank

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:
Stop animation from playing while waiting to destroy object I'm working on functionality in Unity where if a game object's health is zero, it does and the object is destroyed.  This works fine as is, I reduce the health to zero, the die animation plays and the game object is destroyed.  I want to have the script wait a certain amount of time and then run the destroy method.  I thought using WaitForSeconds() would do the trick, and technically, it does, but the death animation continues to play until the object is destroyed.  My question is, how do I get the animation to stop playing as the script waits to destroy the object?

C#

void Die(){
    GetComponent<Animation>().CrossFade(die.name);
    //If the current animation time is greater than 90% of the entire animation length, destroy the object.
    if(GetComponent<Animation>()[die.name].time > GetComponent<Animation>()[die.name].length * 0.9){
        StartCoroutine(RemoveBody());
    }
}

IEnumerator RemoveBody(){
    yield return new WaitForSeconds(5);
    Destroy(gameObject);
}

sentences:
How can I manually construct a right-handed orthographic projection matrix? I need the formula to create a orthographic projection matrix. I am using GLM math libary and DirectX11. The reason I cannot use GLM to create it is because the NDC spaces are different between DX11 and OpenGL, thus I need to manually create one.

I am however using right-handed coordinate system and column-major matrices, just like GLM.

This is my attempt, but I get wrongly images when rendering with it, so it is probably wrong. I am using it for cascading shadow maps, and from the graphics debugger, I probably need to mirror it, but it is just a guess. Any ideas?

Mat4 OrthographicMatrix(const float left, const float right, const float top, const float bottom, const float zNear, const float zFar)
{
    Mat4 ret(1.0f);

    ret[0][0] = 2.0f / (right - left);
    ret[1][1] = 2.0f / (top - bottom);
    ret[2][2] = 1.0f / (zNear - zFar);
    ret[3][0] = (left + right) / (left - right);
    ret[3][1] = (top + bottom) / (bottom - top);
    ret[3][2] = (zNear) / (zNear - zFar);

    return ret;
}

sentences:
Unity3d change texture on terrain at specific vector3 at runtime I need the terrain texture to change at certain positions depending on where trees etc. are randomly positioned at runtime. I'm struggling to find any solid information about how to take a particular vector3 and tell the terrain to paint a different texture of size x at that location. So far I have found a lot of information about how to change textures based on height map information. As my map is flat, that information doesn't seem very relevant.
EDIT: using the following code when each tree was randomly instantiated:
    public void ChangeTextureAtTreeLocation(Vector3 treePosition)
    {

        int mapX = (int)(((treePosition.x - terrainPos.x) / terrainData.size.x) * terrainData.alphamapWidth);
        int mapZ = (int)(((treePosition.z - terrainPos.z) / terrainData.size.z) * terrainData.alphamapHeight);
        float[,,] splatmapData = terrainData.GetAlphamaps(1, 1, 4, 4);
        terrainData.SetAlphamaps( mapX, mapZ, splatmapData);
        terrain.Flush();
    }

got me this result:

As you can tell, the results aren't great. There are two main deficiencies:

I don't know how to access the terrain texture array directly so I paint a portion of the map first (see the bottom left of the image), sample that portion, and then set that sample at the location of the trees. This is not ideal as I cannot change the shape, size, or opacity of the added terrain texture. There is also no blending between textures, which gives the texture a rabbit burrow look.
you cannot see it in the image, but the textures do not appear under the trees but are directly north east of them. Not sure why that is. I'm assuming it has something to do with how textures are drawn relative to their origin.

sentences:
OpenGL UseProgram() fails I have a rather strange exception on my application using OpenTK on Linux (ArchLinux with Mono 3.2.8) with GL.UseProgram(). I wrote a class to combine multiple files to one program:

public sealed class Shader : IContent
{
    public string Name
    {
        get { return name; }
    }

    readonly string name;
    readonly ShaderElement[] elements;
    int programId;

    public Shader(string name, params ShaderElement[] elements)
    {
        this.name = name;
        this.elements = elements;
        this.programId = -1;
    }

    public void Compile()
    {
        programId = GL.CreateProgram();
        for (int i = 0; i < elements.Length; i++)
        {
            var info = new FileInfo(elements[i].File);
            if (info.Exists)
            {
                int shaderId = GL.CreateShader(elements[i].Type);
                using (var reader = info.OpenText())
                    GL.ShaderSource(shaderId, reader.ReadToEnd());
                GL.AttachShader(programId, shaderId);
            }
            else
                throw new FileNotFoundException("Shader file not found.", info.Name);
        }
        GL.LinkProgram(programId);
    }

    public void Apply()
    {
        if (programId == -1)
            throw new InvalidOperationException("Compile() has to be called before Apply()");
        GL.UseProgram(programId);
    }
    public void Unapply()
    {
        GL.UseProgram(0);
    }

    public void Dispose()
    {
        GL.DeleteProgram(programId);
    }
}

My sample shader is very short because I try to understand how OpenGL works:
Vertex:

precision highp float;

void main()
{
    gl_FrontColor = gl_Color;
    gl_Position = ftransform();
}

Fragment:

precision highp float;

void main()
{
    gl_FragColor = gl_Color * (1-clamp(gl_FragCoord.z - 0.05, 0, 1));
    gl_FragColor.w = 1;
}

A sample call for Apply():

public override void Draw(double interpolation)
{
    GL.MatrixMode(MatrixMode.Modelview);
    GL.LoadMatrix(ref translate);
    GL.MatrixMode(MatrixMode.Projection);
    GL.LoadMatrix(ref projection);
    GL.Color3(Color.Red);
    simpleShader.Apply();
    sphere.Draw();
    simpleShader.Unapply();
}

Running the application under Windows does not generate any exception.
The following is crashing running under Linux:

First call of Draw()
 -> First call of Shader.Apply()
 -> Draws geometry for first frame
 -> First call of Shader.Unapply()
Second call of Draw()
 -> Second call of Shader.Apply()
    -> GL throws InvalidOperation Error.

Any ideas why Windows behaves different to Linux and how this can be resolved?

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:
How can I avoid repeatedly setting up SDL in VS 2013? Do I have to set up SDL 2.0.3 every time I make a new project?

I tried putting sdl.dll in system32 so that I don't have to include it in my project folders, but that didn't work.

sentences:
Is this way of making an XNA game window borderless safe to use for various Windows PCs? I have found a way to simply make an XNA 4.0 game's window borderless. Here is the code from the article:

IntPtr hWnd = this.Window.Handle;
var control = System.Windows.Forms.Control.FromHandle( hWnd );
var form = control.FindForm();
form.FormBorderStyle = System.Windows.Forms.FormBorderStyle.None;
form.WindowState = System.Windows.Forms.FormWindowState.Maximized;

You add it to the Game's constructor and it works perfectly. I tested it on several Windows PCs and it's great: the game runs seemingly in full screen, even if you set the game's resolution lower/higher than your desktop one. The only issue I had with it is the fact that you need to provide positions for XNA's SpriteBatch methods (Draw and DrawString) in desktop resolution, not in game's resolution, while retrieving width/height from GraphicsDevice gives you the latter.

At the same time, DOTA 2 has borderless window option, but the game scales the window down, if your requested in-game resolution is lower than your desktop one. I wonder if they have a good reason for doing this?

I wanted to ask if this approach is safe to use on PC or can it be buggy occasionally? I would especially like to know if it will work with Windows XP as I don't have a pc with this system to test it.

sentences:
Is there a plugin example for SKSE Special Edition? I'm having trouble creating a skse plugin for skyrim special edition.
For the old version there is a example plugin: https://github.com/xanderdunn/skaar/releases/tag/plugin3

I've tried to do it by

Opening the skse64.sln file.
Adding a new project for the plugin example
Copied the sources from the old plugin example.
Added references to the other projects ("skse_common" and "common_vc14").
Corrected includes for the new version.

Everything compiles except for this line:

registry->RegisterFunction(
                      new NativeFunction0 <StaticFunctionTag, float>("MyTest", "MyPluginScript", PluginExample::MyTest, registry));

MyTest (for completeness):

float MyTest(StaticFunctionTag *base) {
   _MESSAGE("MyTest() will return %f", 3.3);
   return 3.3;
}

This is the exact code from the example from skse for oldrim, but I get the following compile errors from this line:

4>PluginExample.obj : error LNK2019: unresolved external symbol "void * __cdecl Heap_Allocate(unsigned __int64)" (?Heap_Allocate@@YAPEAX_K@Z) referenced in function "public: static void * __cdecl NativeFunctionBase::operator new(unsigned __int64)" (??2NativeFunctionBase@@SAPEAX_K@Z)
4>PluginExample.obj : error LNK2019: unresolved external symbol "void __cdecl Heap_Free(void *)" (?Heap_Free@@YAXPEAX@Z) referenced in function "public: static void __cdecl NativeFunctionBase::operator delete(void *)" (??3NativeFunctionBase@@SAXPEAX@Z)
4>PluginExample.obj : error LNK2019: unresolved external symbol "public: __cdecl StringCache::Ref::Ref(void)" (??0Ref@StringCache@@QEAA@XZ) referenced in function "public: __cdecl NativeFunctionBase::NativeFunctionBase(void)" (??0NativeFunctionBase@@QEAA@XZ)
4>PluginExample.obj : error LNK2019: unresolved external symbol "void __cdecl PackValue<float>(class VMValue *,float *,class VMClassRegistry *)" (??$PackValue@M@@YAXPEAVVMValue@@PEAMPEAVVMClassRegistry@@@Z) referenced in function "public: virtual bool __cdecl NativeFunction0<struct StaticFunctionTag,float>::Run(class VMValue *,class VMClassRegistry *,unsigned long,class VMValue *,class VMState *)" (?Run@?$NativeFunction0@UStaticFunctionTag@@M@@UEAA_NPEAVVMValue@@PEAVVMClassRegistry@@K0PEAVVMState@@@Z)
4>PluginExample.obj : error LNK2019: unresolved external symbol "void * __cdecl UnpackHandle(class VMValue *,unsigned long)" (?UnpackHandle@@YAPEAXPEAVVMValue@@K@Z) referenced in function "void __cdecl UnpackValue<struct StaticFunctionTag>(struct StaticFunctionTag * *,class VMValue *)" (??$UnpackValue@UStaticFunctionTag@@@@YAXPEAPEAUStaticFunctionTag@@PEAVVMValue@@@Z)
4>PluginExample.obj : error LNK2019: unresolved external symbol "unsigned __int64 __cdecl GetTypeID<float>(class VMClassRegistry *)" (??$GetTypeID@M@@YA_KPEAVVMClassRegistry@@@Z) referenced in function "public: void __cdecl NativeFunction0<struct StaticFunctionTag,float>::InitParams(class VMClassRegistry *)" (?InitParams@?$NativeFunction0@UStaticFunctionTag@@M@@QEAAXPEAVVMClassRegistry@@@Z)
4>PluginExample.obj : error LNK2019: unresolved external symbol "public: void __cdecl NativeFunction::DebugRunHook(class VMValue *,class VMClassRegistry *,unsigned long,class VMValue *,class VMState *)" (?DebugRunHook@NativeFunction@@QEAAXPEAVVMValue@@PEAVVMClassRegistry@@K0PEAVVMState@@@Z) referenced in function "public: virtual bool __cdecl NativeFunction0<struct StaticFunctionTag,float>::Run(class VMValue *,class VMClassRegistry *,unsigned long,class VMValue *,class VMState *)" (?Run@?$NativeFunction0@UStaticFunctionTag@@M@@UEAA_NPEAVVMValue@@PEAVVMClassRegistry@@K0PEAVVMState@@@Z)
4><MyPath...>\src\skse64\x64\Debug\example_plugin.dll : fatal error LNK1120: 7 unresolved externals

Questions:
Can someone provide a simple VS solution, which does what the plugin example for skse oldrim did or explain what I'm doing wrong?

sentences:
Forward Shading with multiple shadow-casting lights I am currently thinking about how to organize shadowing and lighting.
We use forward rendering and currently, our algorithm looks like this:

collect all items that are visible in the view
for each item, collect a list of lights where the item is in the attenuation radius (each item keeps a list of lights)
determine the shadow light by the distance of the main character (only one light can currently cast shadow)
render the scene by using a constant buffer of the currently processed item to shade it (each item is rendered with a constant buffer which contains light properties. the number of lights per item is predefined so we have a Light[16] and numLights in the constant buffer)

How would I do multiple shadow-casting lights in an organisatory way?
We do not want to go the deferred way, since we dont want to limit us to GBuffers.

sentences: Reverse Movie in Unity 5 guys! Is it possible to reverse video or apply a rewind in Unity 5? I searched in the web but could not find the solution.

sentences:
Better way to find all sprites that would overlap with other sprite first question on this site :-)

I'm not really sure that the title is very clear so feel free to edit/suggest a better one.

I have a piece of Game Maker code which works, but feels like a bit of a hack and also causes some side affects else where so I wanted to know if there is a better way.

I'm building a Tetris clone and this snippet occurs in the Step event of the falling tile parent object.  The idea is that when the falling object collides with something it should be replaced by 'brick' objects so that I can destroy them independently.

So what I want to do is test whether a brick would overlap with the falling object and if so then create a brick there.  I'm using an instance of brick (called trialBrick and created globally) to do the testing.

I could just try creating a brick and then destroy it if it doesn't overlap with the falling object but I'm not sure whether this is efficient or not.

Thoughts?

// just move the brick downward if we can by one pixel.
var obstacle = instance_place(x, y + 1, all);
if (obstacle != noone)
{
    isFalling = false;

    // loop through each row of the object.
    var row;
    var column ;
    for (row = y - 4 * brickSize; row < y + 4 * brickSize; row += brickSize)
    {
        for (column = x - 4 * brickSize; column < x + 4 * brickSize; column += brickSize)
        {
            // need to check whether the current row and column intersects with this falling object.
            trialBrick.x = column;
            trialBrick.y = row;

            with (trialBrick)
            {
                if (place_meeting(x, y, objFallingParent))
                {
                    instance_create(x, y, objBrick);
                }
            }
        }
    }
    trialBrick.x = 0;
    trialBrick.y = 0;

    // remove ourselves from the game.
    instance_destroy();
}

Edit:
The 'problem' is when I test whether the bricks are outside the play area (indicating game end) I have to remember to exclude the trialBrick.  It would be nicer if I didn't have the trialBrick at all.

sentences:
How does one disable the right-click context menu in Flash? I happened to play around with habbo.com social game portal.

It clearly uses Adobe Flash as platform (if you look into the source code of the HTML page). But when you do right mouse click you don't get the Flash right-click menu popping up!

Does anybody have an idea how this is done?

sentences:
How can I achieve a 3D-like effect with spritebatch's rotation and scale parameters I'm working on a 2d game with a top-down perspective similar to Secret of Mana and the 2D Final Fantasy games, with one big difference being that it's an action rpg using a 3-dimensional physics engine.

I'm trying to draw an aimer graphic (basically an arrow) at my characters' feet when they're aiming a ranged weapon.  At first I just converted the character's aim vector to radians and passed that into spritebatch, but there was a problem.  The position of every object in my world is scaled for perspective when it's drawn to the screen.  So if the physics engine coordinates are (1, 0, 1), the screen coords are actually (1, .707) -- the Y and Z axis are scaled by a perspective factor of .707 and then added together to get the screen coordinates.

This meant that the direction the aimer graphic pointed (thanks to its rotation value passed into spritebatch) didn't match up with the direction the projectile actually traveled over time.  Things looked fine when the characters fired left, right, up, or down, but if you fired on a diagonal the perspective of the physics engine didn't match with the simplistic way I was converting the character's aim direction to a screen rotation.

Ok, fast forward to now:  I've got the aimer's rotation matched up with the path the projectile will actually take, which I'm doing by decomposing a transform matrix which I build from two rotation matrices (one to represent the aimer's rotation, and one to represent the camera's 45 degree rotation on the x axis).  My question is, is there a way to get not just rotation from a series of matrix transformations, but to also get a Vector2 scale which would give the aimer the appearance of being a 3d object, being warped by perspective?  Orthographic perspective is what I'm going for, I think.  So, the aimer arrow would get longer when facing sideways, and shorter when facing north and south because of the perspective.  At the same time, it would get wider when facing north and south, and less wide when facing right or left.

I'd like to avoid actually drawing the aimer texture in 3d because I'm still using spritebatch's layerdepth parameter at this point in my project, and I don't want to have to figure out how to draw a 3d object within the depth sorting system I already have.

I can provide code and more details if this is too vague as a question...  This is my first post on stack exchange.  Thanks a lot for reading!

Note: (I think) I realize it can't be a technically correct 3D perspective, because the spritebatch's vector2 scaling argument doesn't allow for an object to be skewed the way it actually should be.  What I'm really interested in is, is there a good way to fake the effect,
or should I just drop it and not scale at all?

Edit to clarify without the help of a picture (apparently I can't post them yet):

I want the aimer arrow to look like it has been painted on the ground at the character's feet, so it should appear to be drawn on the ground plane (in my case the XZ plane) which should be tilted at a 45 degree angle (around the X axis) from the viewing perspective.

Alex

sentences:
Designing a trade / market system I'm working on an idea for a trading game. Players would be traders buying in place A and selling in place B, hopefully for a profit.

I want prices to be dynamic, based on demand and supply. So if place A produces less food than it consumes, prices for food would he high and getting higher the closer they get to running out, while in place B, which has much more production than supply, prices would be near the production cost (minimum price). But if someone buys up a lot of the supply in B, prices would rise, and if someone sells a lot in place A, prices would drop.

Obviously, there are many ways to game such a system if it's not well-designed. The most easy is to empty the market, wait for the price to adjust, then sell everything back.

How could I design this system? I mean the actual math and functions, not philosophical musings. I searched a lot and haven't found anything specific.

I found this question but it and its answers are a lot more specific to the specific formula the guy uses in his game. I'm looking for a more generic approach (I want different price elasticity for different goods, maybe non-linear price curves, etc.)

sentences:
Multiplayer game sdk for ios and android I am working on a multiplayer game supporting Android and IOS.

For IOS Game-Center seems promising. But its IOS only.

OpenFeint could be a option, but now GREE has stopped supporting it.

Is there any other multi-platform SDK which I can use for both IOS and Android?

---------EDIT------

I could not find any good service which provides their own server and SDK for both IOS and android. So finally I chose to go with my own server on AWS-EC2 + python tornado + Websocket. If anyone want to know more plz contact...

sentences:
LibGdx Input data in a textfield I have a textfield using scene2d but don't know how to save user input. this is what i have and it just draws the textfield.

     txtUsername = new TextField("", mSkin);
     txtUsername.setMessageText("test");
     txtUsername.setPosition(30, 30);
     mStage.addActor(txtUsername);

sentences: How do I determine if one polygon completely contains another? I have 2 polygons.  I know the vertex coordinates of both polygons.  What's the best way to check if one is completely inside the other?  For example, the algorithm should only recognize the black trapezoid below as being contained:

sentences:
Collision detection - make sure the player touches the object exactly I know this is really something I should be able to figure out on my own, but a solution is evading me.

Okay, here are a few relevant parts of my code.

bool Game::Col(int x1,int y1,int w1,int h1, int x2, int y2,int w2,int h2)
{
    if(x1 > x2 + w2 || y1 > y2 + h2 || x2 > x1 + w1 || y2 > y1 + h1)
    {
        return false;
    }
    return true;
}

That's my collision detecting algorithm. Simple, for rectangles only.

        int bX = (player.getX() - 64) / 32;
        int bY = (player.getY() - 64) / 32;
        int tX = (player.getX() + 64) / 32;
        int tY = (player.getY() + 64) / 32;

        for(int a=bX;a<tX;a++)
        {
            for(int b=bY;b<tY;b++)
            {
                if(Col(player.getX(), player.getY(), 32, 32, a * 32, b * 32, 32, 32) && blocks[a][b] == 1)
                {
                    player.setX(oldX);
                    player.setY(oldY);
                    goto loopExit;
                }
            }
        }

        loopExit:

Here is my collision detection. This is performed right after the player x/y is manipulated(5 pixels in whatever direction every 1/60th of a second). Blocks is just a 2d array for my tile map. I know the way I have collision detection right now is not too optimized, but it took a few seconds to implement and is reasonably fast.

But the player can only get within 5 pixels of an object now. How do I solve that?

sentences:
Can I embed a game in a PDF document? I was thinking that it could be cool to have an interactive game in a digital resume. For the sake of this question, and scope of this site, let's ignore whether or not this is a good idea.

Is it possible to embed a game or some sort of interactive window inside of a PDF document? This could be using any sort of language or framework. For example, having a small area of the PDF with a CAPTCHA in it.

sentences:
Splitting logic into threads in Java tower defence game I'm making a tower defence game in Java!
It's my first game development.
I want to know how many threads Do I need to create in a game, to split logic..
I've made this one:

Main App thread  (adds component thread - add(screen))

1.1.1 Thread (graphic updates)
1.1.2 Bullets physic
1.1.3 Mobs physic
1.1.4 Towers physic

Is it normal to split this logic?

sentences:
Unity3D How to write to the back buffer AFTER the final pass of deferred rendering? I've been using this script and shader from the wiki, and they work wonders; my only problem is using them in deferred rendering.

Now, the way this shader works is by writing to the depth buffer to hide anything behind an object with this shader applied, but for some reason this wasn't working when I tried to use deferred rendering for shadows and better lighting. The problem is addressed by Kuba in the final post of this topic.

The final pass of prepass rendering (the part that renders geometry the second time and applies the result of the lighting pass to it) is rendered in to a texture, then blit-copied into the back buffer, which overrides everything that was rendered there before.

My question is if there is any way to render after that final pass, so I can still use my depth mask to hide objects behind it. If there is no way to directly write after the final pass, is there another solution I can try? Perhaps blending the two cameras on my own and some how blitting that on to the screen?

sentences:
Android canvas.drawColor throws a null object reference I have two nearly identical methods, the first to draw a splash screen while assets are loading, and the second to draw all of the assets to the screen.  The first throws a NullPointerException on this line:

canvas.drawColor(Color.argb(255, 0, 0, 0));

Here is my error:

  Caused by: java.lang.NullPointerException: Attempt to invoke virtual method 'void android.graphics.Canvas.drawColor(int)' on a null object reference
  10-19 21:54:56.042 18973-18973/? E/AndroidRuntime:     at com.xyz.123.GameView.drawSplash(GameView.java:76)

Here is my code in full:

package com.xyz.123;

import android.content.Context;
import android.graphics.Canvas;
import android.graphics.Color;
import android.graphics.Paint;
import android.view.MotionEvent;
import android.view.SurfaceHolder;
import android.view.SurfaceView;

public class GameView extends SurfaceView implements Runnable {
    volatile boolean playing;
    Thread gameThread = null;
    private Paint paint;
    private Canvas canvas;
    private SurfaceHolder holder;
    private int screenWidth;
    private int screenHeight;
    private Background1ResourceList background1ResourceList;
    private Background background1;
    private Background background2;
    private Background background3;
    private Context context;
    private SplashScreen splashScreen;

    public GameView(Context context, int screenWidth, int screenHeight) {

        super(context);

        this.context = context;

        this.screenWidth = screenWidth;
        this.screenHeight = screenHeight;

        // Initialize our drawing objects
        holder = getHolder();
        paint = new Paint();

        splashScreen = new SplashScreen(context, screenWidth, screenHeight);
        drawSplash();

        background1ResourceList = new Background1ResourceList();

        background1 = new Background(context,         background1ResourceList.getBackgroundResources(), screenWidth, screenHeight, 0.00f, 0.50f);
        background2 = new Background(context, background1ResourceList.getBackgroundResources(), screenWidth, screenHeight, 0.33f, 0.80f);
        background3 = new Background(context, background1ResourceList.getBackgroundResources(), screenWidth, screenHeight, 0.66f, 1.00f);
    }

    @Override
    public void run() {
        while (playing) {
            update();
            draw();
            control();
        }
    }

    private void update() {
        background1.update();
        background2.update();
        background3.update();
    }

    private synchronized void drawSplash() {
        if (holder.getSurface().isValid()) {
        //First we lock the area of memory we will be drawing to
        holder.getSurface();
        canvas = holder.lockCanvas();
        // rub out the last frame
        canvas.drawColor(Color.argb(255, 0, 0, 0));
        // draw the backgrounds
        splashScreen.draw(canvas, paint);
        // unlock and draw the scene
        holder.unlockCanvasAndPost(canvas);
        } else {
            System.out.println("surface not valid");
        }
    }

    private synchronized void draw() {
        if (holder.getSurface().isValid()) {
            //First we lock the area of memory we will be drawing to
            canvas = holder.lockCanvas();
            // rub out the last frame
            canvas.drawColor(Color.argb(255, 0, 0, 0));
            // draw the backgrounds
            background1.draw(canvas, paint);
            background2.draw(canvas, paint);
            background3.draw(canvas, paint);
            holder.unlockCanvasAndPost(canvas);
        }
    }

    public void pause() {
        playing = false;
        try {
            gameThread.join();
        } catch (InterruptedException e) {

        }
    }

    public void resume() {
        playing = true;
        gameThread = new Thread(this);
        gameThread.start();
    }
}

sentences:
How do I best solve multiple component modifications via a single event? I'm trying to solve multiple component modifications via a single event. Is there a better way of handling this?

I have an a label entity that cares about when a shield entity's hitpoints component is modified (damage, regeneration, etc).

The label will need to change

its text to display the current % of shield remaining.
its text color to display the severity of shield remaining.

When my ShieldSystem resolves the hitPoints component, the below code runs. For eah type of modification I plan to listen for, I need to add a new if-statement to the for-loop. This means I have a bunch of duplicated code between systems if more than one wants to modify any listening text component, sprite component, etc.

for(int i =0; i < listeners.size(); i++)
{
    if(listeners.count(MessageType::CHANGE_TEXT) == 1)
    {
        std::vector<Entity*> entities =  listeners[MessageType::CHANGE_TEXT];
        for(int j; j < entities.size(); j++)
        {
            Entity* e = entities[j];
            MessageInfo* messageInfo = new MessageInfo(MessageType::CHANGE_TEXT, e, "Some Text");
            MessageCenter::Dispatch(messageInfo);
        }
    }

    // Add an If(listeners.count(MessageType::CHANGE_TEXT_COLOR)...

    // Add an If(listeners.count(MessageType::CHANGE_SPRITE_RECT)...

    // etc

}

sentences:
XNA C# Platformer - physics engine or tile based? I would like to get some opinions on whether I should develop my game using a physics engine (Farseer Physics seems to be the best option) or follow the traditional tile-based method.
Quick background:

It's a college project, my first game, but have 4 years academic programming experience
I just want a basic platformer with a few levels, nothing fancy
I want a shooting mechanic, run and gun, just like contra or metal slug for example
Possibly some simple puzzles

I have made a basic prototype with Farseer, the level is hardcoded with collisions and not really tiled, more like big full-screen sized tiles, with collision bodies drawn manually along the ground and walls etc. My main problem is I want a simple retro feel to the jumping and physics, but because it's a physics simulation engine, it's going to be realistic, whereas typical in air controllable physics for platformers aren't realistic. I have to make a box with wheel body fixture under it to have this effect, and it's glitchy and doesn't feel right.
I chose to use a physics engine because I tried the tile method initially and found it very hard to understand. The engine took care of a lot things to save me time. Being able to do slopes easily was nice, as was the freedom to draw collision bounds wherever I liked, rather then be restricted to a grid. This also gave me more freedom for art design.
In conclusion, I don't know which method to pick. I want to implement this in the most straightforward way, so it won't give me a headache later on. Preferably, a method which has an abundance of tutorials and resources so I don't get "stuck" doing something which has been done a million times before!

sentences: Seamless transition between planet and space I have been curious about how this kind of seamless transition from space to planet can be implemented. It would be nice if someone could explain this as I can't really wrap my head around the solution.

sentences:
Adding Color to button after cloning public GameObject button;

public void Start()
{
       GameObject button1 = Instantiate(button) as GameObject;
       button1.transform.SetParent(canvas.transform, false);
       button1.transform.position = new Vector3(7, 0, 2);
}

I have cloned the button game object now want to add color to that game object how can i do it ?

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 can I put multiple actors on a Button? I like to have an Button with a Text and some Pictures in it.

Is there something out of the box to that ?

I mean I would like to add a Table into a button, so I could add anything I need to the table.

sentences:
How do I find the shape of Tiled's circles or ellipses in libGDX? I created a level in the 'Tiled Map Editor' and loaded it into my libGDX game.
I can easily transform almost all objects into Box2D objects (although this problem is not Box2D specific), but I have trouble with ellipses.

Tiled seems to only create ellipse objects, without a special case for circles. I'd be happy with just circles if they existed in Tiled.

However, even the EllipseMapObject I load in libGDX only has an x,y position. I don't see any information about area or vertices. Did I miss something? How can I create circle or ellipse objects in Tiled and load them into libGDX with right dimensions?

Tiled version 0.10.1, libGDX version 1.4.1

sentences: How to apply fast & slow camera transition I know there is a lerp function there that smoothens the camera but I wanted it to work the other way around. Lets say starting position of the player is at the left side of the camera/screen and when the players goes around the right edge (or as long as more than half width) screen travelled I want to camera to snap to the player but with smooth transition and this is the hard part I wanted to make the camera move fast as long as it is less than half of the players distance travelled and apply a slow speed as the camera travels more than half the distance of player.

sentences:
Fast pixelshader 2D raytracing I'd like to do a simple 2D shadow calculation algorithm by rendering my environment into a texture, and then use raytracing to determine what pixels of the texture are not visible to the point light (simply handed to the shader as a vec2 position) .

A simple brute force algorithm per pixel would looks like this:

line_segment = line segment between current pixel of texture and light source

For each pixel in the texture:
{
  if pixel is not just empty space && pixel is on line_segment
       output = black
  else
       output = normal color of the pixel

}

This is, of course, probably not the fastest way to do it. Question is: What are faster ways to do it or what are some optimizations that can be applied to this technique?

sentences:
Add picture in the Hierarchy view in Unity How can I add a picture in the Hierarchy view in Unity? For example, Dragon bones does it automatically. Here it is :

As you can see there is a picture on the right of the gameObject name.

sentences:
Send id from ios to unity I'm writing a plugin for unity, I need to send a texture from ios to unity.
There is a UnitySendMessage function which takes char* as parameter, but I didn't find a way to convert id<MTLTexture> to char*.

How can I send id<MTLTexture> from ios and receive it in unity?

My current code :

//ios side ...
_texture = CVMetalTextureGetTexture(texture);
UnitySendMessage(CALLBACK_OBJECT, CALLBACK_TEXTURE_READY,_texture);//error
//...

//unity side
private void OnTextureReady(string texture_str)
{
   IntPtr texture = new IntPtr(Int32.Parse(texture_str));
   int width = 256;
   int height = 256;
   rawImage.texture = Texture2D.CreateExternalTexture(width, height,
   TextureFormat.ARGB32, false, false, texture);
}

sentences:
What are some good learning resources for OpenGL? I have been using the OpenGL ES on the iPhone for a while now and basically I feel pretty lost outside to the small set of commands I've seen in examples and adopted as my own. I would love to use OpenGL on other platforms and have a good understanding of it.

Every time I search for a book I find this HUGE bibles that seem uninteresting and very hard for a beginner. If I had a couple of weekends to spend on learning OpenGL what would be the best way to spend my time (and money)?

sentences:
Combine textures with coordinates Is it possible to add one texture to another texture, at specific coordinates?
Like if I want to add a small texture(16x16) to big texture (1368 x 768) with coordinates ( 100, 100) so the small texture goes to specific coordinates (100, 100 ).

sentences:
Calculate position on Isometric grid I created the following tile grid in unity3d:
The blue dot is the  absolute center point (0,0) of both scene space and tile map.

Now I am trying to calculate the X/Y position of points on the tile map ( the black coordinates). The red coordinates are positions in the scene space. Every calculation I make just gives me a wrong result. Is the tile map roatated the wrong way? Any help really apreciated!

sentences:
Detect if square in grid is within a diamond shape So I have a game in which basically everything is a square inside a big grid. It's easy to check if a square is inside a box whose center is another square:

*** x
*o*      --> x is not in o's square
***

**x
*o*      --> x IS in o's square
***

This can be done by simply subtracting the coordinates of o and x, then taking the largest coordinate of that and comparing it with the half side length.

Now I want to do the same thing but check if x is in o's diamond, like so:

  *
 **x
**o**    --> x IS in o's diamond
 ***
  *

What would be the best way to check if a square is in another square's surrounding diamond-shaped area, given the diamond's half width/height?

sentences:
Good practice in implementing multi sprite (as skins) in 2d unity game so, I want to make such functionality in my 2d game with unity :

  Multi skin character, with similar control and functionality, and with
  possible different gimmicks (such as crossy road's characters, which
  some modify game environment and / or have unique death animation, yet THEY
  CAN ONLY JUMP AROUND a.k.a only cosmetic).

Here's so far what I did :

  Make each character into separate gameobjects and prefabs, and then if
  I need to find a particular script in current active char, I use
  Gameobject.Find(). The problem is, if I need to apply a script, I need to > manually attach it 1 by 1 to each char gameobjects, which I find will  create problems if the character number grows.

Is that a good practice? Or there's any more good / best practice on this problem?

P.S.

I once read Gameobject.Find() is slow, so if possible, I want to avoid that.
I use bone-based sprite animation, so, I think, changing just the Sprite in SpriteRenderer component won't work.

Thank you.

sentences:
Ray casting problem using JOGL I'm trying to port an old perfectly functioning ray casting implementation from my lwjgl project (FF pipeline) to a new project using JOGL and shaders.  My problem is that my ray no longer intersects the model at the mouse location although the ray always passes through the mouse location (see image).  Further to this, as soon as I apply any transformation to the model - rotation, movement along x,y or z - the ray is completely off and doesn't pass through the mouse location in any case.  Would anyone know why this would be happening?  As far as I can tell the code is doing exactly what the old project did.  I am currently using FloatUtil.mapWinToRay() although I have also tried FloatUtil.mapWinToObjCoords() with the same results.

Function that creates the testing ray:
I use nearVector and farVector to draw the ray.

public Ray getPickingRay(float[] modelMatrix,
                                float[] projMatrix,
                                int[] viewport,
                                float winx,
                                float winy
                            ) {

    // first the near vector
    float[] mat4Tmp1 = new float[16];
    float[] mat4Tmp2 = new float[16];
    float[] vec4Tmp2 = new float[4];
    Ray ray = new Ray();
    FloatUtil.mapWinToRay(winx, winy, 0, 1,
            modelMatrix, 0,
            projMatrix, 0,
            viewport, 0,
            ray,
            mat4Tmp1, mat4Tmp2, vec4Tmp2);

    nearVector[0] = ray.orig[0];
    nearVector[1] = ray.orig[1];
    nearVector[2] = ray.orig[2];
    farVector[0] = ray.dir[0] * 100;
    farVector[1] = ray.dir[1] * 100;
    farVector[2] = ray.dir[2] * 100;

    return ray;
}

Function that updates the ray position:

private void updateLineData(GL4 gl) throws Exception{

   //container for two ray vertices
   float[] all = {0,0,0,0,0,0};

  //apply same translation to ray as is applied to entire model.
  view3 = translate(view2, transX, transY, transZ);
  //pass the matrix to the line shader
  shaderLine.setUniform(iMVPLine, multiply(projection,  view3),
         Shade.MatDataType.MAT4);

  if (updatePos == true){
    updatePos = false;

    int[] viewport = {0,0,screenWidth,screenHeight};
    float[] dest = new float[3];

     Ray ray = pick.getPickingRay(view3,
            projection,
             viewport,
            mx, my);

    float[] front = pick.nearVector;
    float[] back = pick.farVector;

    all[0] = front[0];
    all[1] = -front[1];
    all[2] = -front[2];
    all[3] = back[0];
    all[4] = -back[1];
    all[5] = -back[2];
    whole.updateLine(gl, all);
  }

}

Update the line data buffer:

  public void updateLine(GL4 gl, float[] pos)
  {

      for (int i=0;i<pos.length; i++){
          vertLineBuffer[i] = pos[i];
      }
      //populate the color buffer
      FloatBuffer fbData = Buffers.newDirectFloatBuffer(vertLineBuffer);

      gl.glBindBuffer(GL4.GL_ARRAY_BUFFER, vboLineHandles[VERTICES_LINE_IDX]);
      gl.glBufferSubData(GL4.GL_ARRAY_BUFFER, 0, fbData.capacity() * 4, fbData);
      fbData.clear(); //don't need this anymore

  }

A final note/clue is that as I click closer to the centre of the screen the intersection point between the ray and the model gets closer to the mousepointer.  It is almost as if the ray always wants to point to 0,0,0.  My expectation would be that I wouldn't be able to see the ray when it is drawn as it would be following my line of sight thru the model.  Then when I translate the view I would be able to see it as I would be looking at a slight angle to the new ray.  Currently when the ray draws I can see it right away as it draws between near the centre of the screen and out in the direction of the mousepointer.  Any help/hints or tips would be greatly appreciated.

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:
Visual artifacts on long distance on plane I'm making a voxel game in XNA, and have filthy visual artifacts on long distances.

I use 2048*2048 atlases.

I'm already using mipmaps and 16x anisotropic filtering.

I've read this blog post, but I'm not quite sure that this is the problem.

This is how it looks like:

UPD:

The atlas I'm using looks like this:

The topmost left square is used on the screenshots. I'm using XNA Content Processor mipmap compiler to generate mipmaps.

Every cube on the screen is separate, there is no gigantic cubes.

Does anybody have a clue what might it be?

sentences:
How common are game engine bugs, and can I claim damages for them? Are game engine bugs (in popular ones like Unreal and Unity, not some unknown ones) common? I know engines like Unreal, Source and Unity3D are well tested and maintained, but, for example, is there any threat like: I create a game, the engine programming is fine, so is everything I do, but I get a bug in the game because of a bug in the engine?

And as most of you guys here are game developers, has any one had such an experience? Also, can I take legal action on the creators of that engine incase I am under loss because of their bug?

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:
importing animations in Blender, weird rotations/locations This is for the Blender 2.6 API.

There are two problems:

1. When I import a single animation frame from my animation file to Blender, all bones look fine.
But when I import multiple (all of the frames), just the first one looks right, seems like newer frames are affected by older ones, so you get slightly off positions/rotations.

This is true when both assigning PoseBone.matrix and PoseBone.matrix_basis.

bone_index = 0

# for each frame:
for frame_index in range(frame_count):
    # for each pose bone: add a key
    for bone_name in bone_names: # "bone_names" - a list of bone names I got earlier
        pose.bones[bone_name].matrix = animation_matrices[frame_index][bone_index] # "animation_matrices" - a nested list of matrices generated from reading a file

        # create the 'keys' for the Action from the poses
        pose.bones[bone_name].keyframe_insert('location', frame = frame_index+1)
        pose.bones[bone_name].keyframe_insert('rotation_euler', frame = frame_index+1)
        pose.bones[bone_name].keyframe_insert('scale', frame = frame_index+1)

        bone_index += 1

    bone_index = 0

Again, it seems like previous frames are affecting latter ones, because if I import a single frame from the middle of the animation, it looks fine.

2. I can't assign armature-space animation matrices read from a file to a skeleton with hierarchy (parenting).

In Blender 2.4 you could just assign them to PoseBone.poseMatrix and bones would deform perfectly whether the bones had a hierarchy or none at all.

In Blender 2.6, there's PoseBone.matrix_basis and PoseBone.matrix. While matrix_basis is relative to parent bone, matrix isn't, the API says it's in object space. So it should have worked, but doesn't. So I guess we need to calculate a local space matrix from our armature-space animation matrices from the files.
So I tried multiplying it ( PoseBone.matrix ) with PoseBone.parent.matrix.inverted() in both possible orders with no luck, still weird deformations.

sentences:
Kinect for Xbox One (+ adapter) and Windows 10 Can I use Kinect Xbox One (with adapter like Kinect for Windows V2 device), SDK 2.0, to build applications on Windows 10? I've read the requirements for Kinect and it lists only Win 8.0 and Win 8.1.

I'd like to use Kinect Xbox One device with Unity 3D and Hololens. Before I buy the device I'd appreciate if anyone can share some experiance or at least to confirm that would be possible to develop apps with Kinect for Xbox One on Win10?

Many thanks.

sentences:
reuse texture between quad objects This question is specific to unity:

I want to spawn multiple blocks, each representing a letter. There will be more than one copy of an alphabet.

I have a big texture which contains all the letters in it. I use a prefab to Instance all the Blocks(quads) during Awake(). At runtime, I'd like to assign a texture to these quads (identifying the letter). My code looks like this:

    void Update () {
            // if there is no active block, spawn it
            if (activeBlock == null) {
                this.getNextBlock (ref this.activeBlock);
    }
    protected Block getNextBlock(ref Block block){
            block = this.deQueueBlock ();
            char letter = LetterMgr.Instance.getNextLetter();
            // based on the letter, index into texture
            // and assign the texture + indices to this block ?
    }

How can I reuse this one big texture and index into each letter amidst all these blocks (quads) ? I will be rendering this on a mobile, so will need to squeeze all the performance I can.
Details:

256 x 256 per letter
8 columns x 4 rows
Total Texture Size: 2048 x 2048
Total number of blocks: ~100

PS: Each of the letters will be moving and will eventually come to rest. So I will have some (around 6-7) actively moving blocks and others will be stationary.

sentences:
How to use XML files as content files in XNA? I have an XML file representing different car manufactures that will be available in my game. The file looks like this:

<?xml version="1.0" encoding="utf-8" ?>
<XnaContent>
  <Asset Type="List[string]">
    <car>Audi</car>
    <car>BMW</car>
    <car>Nissan</car>
    <car>Volvo</car>
  </Asset>
</XnaContent>

When adding it into my content folder, the compiler return this error:

There was an error while deserializing intermediate XML. Cannot find type "List`1"

How can I create a list of strings, put it into XML and read it from XNA?

sentences:
How to manage in-game factions, alliances, federations, etc So this question is code or engine agnostic but, I’m looking for ideas on how a game can keep track of a pre-determined number of factions or alliances. For example, say I made a space game that has 2 major and 3 minor federations of planets. A planet may join or leave a federation, but the federation itself may have an alliance or be at war with another (actually, to keep it simpler, I think all these changes will solely be reliant on the player’s actions).
However, I would also like to keep track of such diplomatic endeavours on the ‘individual’ level as well. Say the player has joined one federation that is at war with another. If the player should encounter another ship of the opposing federation, that ship becomes hostile. On the other side, two ships have an alliance, they might help one another.
What is the best way to keep track of all this?
One way I was thinking was creating a manager that holds all the Federation classes (which hold the status it holds with all other federations — say less than 0 and the federations are at war; more than x-amount, there’s an alliance). Meanwhile, each player/ship holds similar data in its class, along with its current alliance to whatever federation. Is my thinking logical in this or are there better ways of managing such things? Many thanks.

sentences:
How do I simulate a crowd in the stadium stands? I'm working on a mobile sports game with Unity. I'm wondering how I could create an efficient effect of an audience in the stadium.

I know that with more than 15 characters in my games (with 1800 faces and 20 bones) the game slows down, so I guess that even with a small number of bones, using 3D characters for even the first row of seats isn't feasible... Would you have some tips on how to do this another way?

I have also tried to "paint" them, and add a blur effect, but the result is not very good...

sentences:
Outlining external edges on a complex shape made of cubes? A gallery of my problem can be found here. I had to do it this way as it won't let me post more than 2 links due to my reputation.

I'm trying to use 3D cubes to generate an isometric cube world.

I got that working great and I merge only the visible vertices/indices into a buffer and draw from that.

Only problem is, as with any isometric game, it becomes difficult to differentiate between heights. For example in the first image: this archways top merges with the cubes below.

I ended up finding this shader and got it working by using it against a rendered normal map (second image) of the cubes.

You may be able to guess my problem from that image. The final result looks like the third image. The back edges are not draw with an outline, which are the most important. Which based on the normal map also means that diagonals also have the same problem on their sides (fourth image).

Is there any solution I can do for this? Either in the shader itself or perhaps when calculating the normals? I almost need to add something to the normal to distinguish their depth/height so faces on similar planes don't merge on edge detection. Or maybe there's a totally different option I could use.

Ideally I was aiming more for only edges to the air to be outlined so the archways bottom edges would not be outlined like they are now =/

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:
Multi texture obj files? Im downloading some free 3d models off the internet to test things in my game. When I download the package, it gives me a bunch of texture files and the obj model. What I dont understand is what I do with those textures? Are they used as source image files within the object? If so how can I export the uv map of the model with all these textures on it? Ive been trying to get a working example of this and havent been able to. Can someone guide me in the right direction? I edit my files with blender, and realize this question is a little bit off topic, but im lost!

EDIT:

Example of the textures I am using now:

sentences:
When should you roll your own game engine? I've been a software developer for 5 years, now, and I am wanting to get into iOS game development. I've played around with the iOS SDK for about 2 years, attending cocoaheads meetings, and I feel I have a good grasp on objective-c, cocoa and even c and c++.

I have a game idea, and know that I will use Box2D, but I'm wondering if I should use cocos2D or not. The main reasons are:

I may want to do things, graphics wise, that aren't available in cocos2d.
If I roll my own game engine, I'll have more control.

Of course, the main reason for using an already-existing game engine is the time it saves, and it makes the hard stuff easier; but for someone who has the technical chops to roll his own, does it make sense?

sentences:
How to make procedurally generated terrain look realistic I generated a terrain using a technique from this blog post, everything worked well and I got the wanted result.
This is what my generated island looks like:

As you can see the terrain have a polygon structure.
Here is the graph that generated this mesh:

This is the code used to generate this mesh from the graph:

    void DrawPolygons(){
    List<Vector3> vertices = new List<Vector3>();
    List<int> triangles=new List<int>();
    List<Color32> colors = new List<Color32>();

    foreach(Center c in centers){
        float zp = zScale*c.elevation;
        vertices.Add(new Vector3(((Vector2)c.point).x,zp,((Vector2)c.point).y));
        Color c0 = getColor(c);
        colors.Add(c0);
        int centerIndex=vertices.Count-1;
        var edges = c.borders;
        int lastIndex = 0;
        int firstIndex = 0;

        for(int i =0;i<c.borders.Count;i++){
            if(edges[i].v0 == null && edges[i].v1 == null)
                break;

            //get voronoi edge
            Corner corner0 = edges[i].v0;
            Corner corner1 = edges[i].v1;

            //get vertices height
            float z0 = zScale*corner0.elevation;
            float z1 = zScale*corner1.elevation;

            //add color
            if(edges[i].river>0){
                c0 = Color.cyan;
            }else{
                c0 = getColor(c);
            }

            colors.Add(c0);
            colors.Add(c0);

            //creat voronoi edge points
            Vector3 v0 = new Vector3(((Vector2)corner0.point).x,z0,((Vector2)corner0.point).y);
            Vector3 v1 = new Vector3(((Vector2)corner1.point).x,z1,((Vector2)corner1.point).y);

            //add points to vertices
            vertices.Add(v0);
            var i2 = vertices.Count - 1;
            vertices.Add(v1);
            var i3 = vertices.Count - 1;

            //add triangles calculating surface normals so i can always add triangles clockwise correctly
            var surfaceNormal = Vector3.Cross (v0-(new Vector3(((Vector2)c.point).x,zp,((Vector2)c.point).y)), v1-(new Vector3(((Vector2)c.point).x,zp,((Vector2)c.point).y)));
            if(surfaceNormal.y>0)
                AddTriangle(triangles, centerIndex, i2, i3);
            else
                AddTriangle(triangles, centerIndex, i3, i2);

            firstIndex = i2;
            lastIndex = i3;
        }
    }

    //calculating uv's
    Vector2[] uvs = new Vector2[vertices.Count];
    for (int i = 0; i < uvs.Length; i++)
    {
        uvs[i] = new Vector2(vertices[i].x / SIZE, vertices[i].z / SIZE);
    }

    mesh.Clear();
    mesh.vertices = vertices.ToArray();
    mesh.triangles = triangles.ToArray();
    mesh.uv = uvs;
    mesh.colors32 = colors.ToArray();
    mesh.RecalculateNormals();
    mesh.RecalculateBounds();
    meshFilter.sharedMesh = mesh;
    meshCollider.sharedMesh = mesh;

}

I would like to know if it's possible to have a noisy/realistic looking terrain from this. How would I implement such a thing?

Basically I want something with no hard edges, terrain that looks smooth but not too smooth, something like this video shows:

sentences:
Are there any serious advantages for C++ compared to C? so I know a little bit about C (read like a few university level textbooks on it, I am not an experienced programmer or anything) and now I would like to learn the ropes of the Unreal engine to fidle with it an make my first 3D game :P (I know it's a huge step easier said than done but I just want to go with it)
My question is about how wise would it be to stuck with what I already know and built upon it?
Will I hit soon some nasty walls while trying to make things work using C should I instead use C++ or will I be fine? In other words does C++ will make my life easier or can do things I wouldn't be able to do with C or that I needed serious puzzlesovling skills and much bigger hardware level knowledge in order to overcome them while using C?
Long story short should I invest more time expanding what I know in C or should I start learning C++ instead which would save me time and bring me the most comfort?

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: Rendering artifacts at a large scale I'm a new to OpenGL or graphics in general. Trying to write a game with realistic scale. I had a perfectly fine rendering of earth at a small scale, but when I try to scale it up to 1:1 I get this artifact. Any ideas what this could be? I suspect it's because I am using floats, but I would rather avoid using doubles in the shader for performance reasons.

sentences:
Rotate spritesheet graphics in flixel I am using the flash flixel engine, and have a sprite sheet of a spaceship from top-down view. The sprite sheet includes a bunch of different states and animation frames. Problem is that I have drawn them all facing upwards (north), and my maths is all done assuming the sprites face to the right (east).

In flixel v2.5 is there a way to rotate the sprite graphics without affecting the "angle" property of the FlxSprite that is using the graphics? I was thinking along the lines of a pre-process, as I initialise everything. I don't really want to fix all the graphics, or hack into my maths at this point. This also might come in handy later.

sentences:
Why Unity Navmesh codes should be executed first? I'm trying to calculate path using NavMesh.CalculatePath and use rigidbody alongside with it,
how ever if character does not stick to navmesh baked area the calculatePath codes will not work.
I also found that if my path finding codes does not run first the path finding will not work either.
for example:
void Update {   //path finding in this script will work
  PathFinding();
  GetDistance();

}

void Update {   //path finding in this script will NOT work
  GetDistance();
  PathFinding();

}

any help regarding to solving the problem or understanding how Unity navmesh system works will appreciated.

sentences: Basic developing in python? I have basic experience in Python, and I want to know which is the best library to use in development. I was looking originally at Pygame but found it a bit lacking in tutorials. Are there any good ones for Pygame? And if not, is there any nice alternative to the Pygame library, or Python itself?

sentences:
Unity3D: How to just center a mesh inside a character controller! Hi I have a simple character mesh and it's parented to my character controller-invisible-capsule object and all the moving code is applied to the parent (if that's relevant), but the point Is I'm trying to line up the mesh to be exactly inside the capsule to make it look like the player is walking ABOVE the ground (pretty normal ...?) So by default the character controller is origined in the center so I move it up by half of it's height to try to get it to line up with the character mesh, which has it's origin below it's feet a little, and this is the result:

as you can clearly see, his feet slightly go into the ground, I have no idea why this is happen, then should be just above the ground like any other normal feet! Here's the code for setting the capsule up half of it's width, since it starts by lining up the mesh in it's CENTER for some reason:

Vector3 tempPos = player.transform.position;

        tempPos.y += (capsuleSize.y / 2);// + chassidSize.y / 12;
        chassid.transform.position = player.transform.position;
        player.transform.localPosition = tempPos;
        chassid.transform.parent = player.transform;

and here's a picture of the mesh (which is just a blender file, easier for import):

As you can see, in the blender file, the origin is slightly below the characters feet, IN THE CENTER, so I don't know why it's not working as planned.

Also, you can see in the first picture that he's slightly moved to the center of the controller on the z(?) axis, but I want him to be completely centered in, any idea how to fix this?

sentences:
Raymarching on a Hi-Z buffer in GLSL So I'm trying to implement Screen Space Reflections using a Hierarchical z-Buffer in GLSL. I'm following the approach from GPU Gems 5 and the Frostbite presentation linked here ("Stochastic Screen-Space Reflections", Slide 36+).

I believe I have a fundamental misunderstanding how the algorithm works, however there are not many information about this algorithm, besides of the resources I linked.

My current GLSL code looks like this:

vec3 trace_ray(vec3 ray_start, vec3 ray_dir)
{

    ray_dir = normalize(ray_dir);
    ivec2 work_size = SCREEN_SIZE_INT;
    const int loop_max = 250;
    int mipmap = 0;
    int max_iter = loop_max;
    vec3 pos = ray_start;

    // Move pos by a small bias to avoid self-intersection
    pos += ray_dir * 0.004;
    float hit_bias = 0.002;

    while (mipmap > -1 && max_iter --> 0)
    {

        // Check if we are out of screen bounds, if so, return
        if (pos.x < 0.0 || pos.y < 0.0 || pos.x > 1.0 || pos.y > 1.0 || pos.z < 0.0 || pos.z > 1.0)
        {
            return vec3(0,0,0);
        }

        // Compute the fractional part of the coordinate (scaled by the working size)
        // so the values will be between 0.0 and 1.0
        vec2 fract_coord = mod(pos.xy * work_size, 1.0);

        // Modify fract coord based on which direction we are stepping in.
        // Fract coord now contains the percentage how far we moved already in
        // the current cell in each direction.
        fract_coord.x = ray_dir.x > 0.0 ? fract_coord.x : 1.0 - fract_coord.x;
        fract_coord.y = ray_dir.y > 0.0 ? fract_coord.y : 1.0 - fract_coord.y;

        // Compute maximum k for which the ray would still be inside of the cell.
        float max_k_x = (1.0 / ray_dir.x) / work_size.x;
        float max_k_y = (1.0 / ray_dir.y) / work_size.y;

        // Scale the maximum k by the percentage we already processed in the current cell,
        // since e.g. if we already moved 50%, we can only move another 50%.
        max_k_x *= 1.0 - fract_coord.x;
        max_k_y *= 1.0 - fract_coord.y;

        // The maximum k is the minimum of the both sub-k's since if once maximum
        // is reached, the ray is out of the cell
        float max_k = min(abs(max_k_x), abs(max_k_y) );

        // Fetch the current minimum cell plane height
        float cell_z = textureLod(DownscaledDepth, pos.xy, mipmap).x;

        // Check if the ray intersects with the cell plane. We have the following
        // equation:
        // pos.z + k * ray_dir.z = cell.z
        // So k is:
        float k = (cell_z - pos.z) / ray_dir.z;

        // Check if we intersected the cell
        if (k > 0.0 && k < max_k + hit_bias )
        {
            // Move to point of intersection
            pos += k * ray_dir;

            // In case we are at mipmap level 0, we found a match
            if (mipmap == 0) {
                return pos;
            }

            // If we hit anything at a higher mipmap, step up to a higher detailed
            // mipmap:
            mipmap -= 2;
            work_size *= 4;
        }

        // If we hit nothing, move to the next cell, with a small bias
        pos += max_k * ray_dir * 1.02;

        mipmap += 1;
        work_size /= 2;

    }
    return vec3(0);
}

And the result is:

So I'm doing something wrong, its probably not much since the result is not completely off, however, I cannot figure out what I'm doing wrong.

TL;DR: Am I either misunderstanding how the Algorithm works, or if not, what am I missing or doing wrong in my code?

sentences:
Sprite wrong position on screen I want to render one sprite on top of another one. I create both sprites using same coordinates and while debuging I can see that they have same position but still one is being rendered beneath another and slightly to the left. Could somebody tell me what am I doing wrong? here is my code where I create sprites:

Sprite sprite1 = new Sprite(new Texture("1.png"));
sprite1.setScale(1/PPM);
Sprite sprite2 = new Sprite(new TextureRegion(...));
sprite2.setScale(1/PPM);
sprite1.setPosition(x,y);
sprite2.setPosition(x,y);

Could it have something to do with scaling? Or maybe the fact that second sprite is created from TextureRegion?

sentences:
Why does AudioSource not initializes itself? Why does AudioSource not initializes itself?

Here is my code:

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

public class CameraConfig : MonoBehaviour
{
    public GameObject objToFollow;

    public bool followRabbit;

    // Use this for initialization
    void Start()
    {
        followRabbit = true;
        LevelController.current.cameraWhichLooksForRabbit = this;

        setMusicSource();
        setSoundSources();
    }

    public AudioClip music, rabbitWalksSound, rabbitDiesSound, rabbitFallsSound, enemyAttacksSound;
    private AudioSource musicSrc, rabbitWalksSrc, rabbitDiesSrc, rabbitFallsSrc, enemyAttacksSrc;

    private void setMusicSource()
    {setClipForSrc(musicSrc, music, true);}

    private void setSoundSources()
    {
        setClipForSrc(rabbitWalksSrc, rabbitWalksSound, false);
        setClipForSrc(rabbitDiesSrc, rabbitDiesSound, false);
        setClipForSrc(rabbitFallsSrc, rabbitFallsSound, false);
        setClipForSrc(enemyAttacksSrc, enemyAttacksSound, false);
    }

    private void setClipForSrc(AudioSource src, AudioClip clip, bool loop)
    {
        src = gameObject.AddComponent<AudioSource>();
        src.clip = clip;
        src.loop = loop;
    }

    void Update()
    {
        checkMusicAndStopOrStartIfNecessary();

        if (!followRabbit)
        { return; }

        Transform rabit_transform = objToFollow.transform;
        Transform camera_transform = this.transform;

        Vector3 rabit_position = rabit_transform.position;
        Vector3 camera_position = camera_transform.position;

        camera_position.x = rabit_position.x;
        camera_position.y = rabit_position.y;

        camera_transform.position = camera_position;
    }

    public void playSoundRabbitWalks()
    {
        if (!rabbitWalksSrc.isPlaying)
        { rabbitWalksSrc.Play(); }
    }

    public void playSoundRabbitDies()
    { rabbitDiesSrc.Play(); }

    public void playSoundRabbitFalls()
    { rabbitFallsSrc.Play(); }

    public void playSoundEnemyAttacks()
    { enemyAttacksSrc.Play(); }

    public void stopSoundRabbitWalks()
    {
        if (rabbitWalksSrc.isPlaying)
        { rabbitWalksSrc.Stop(); }
    }

    public void stopSoundRabbitDies()
    { rabbitDiesSrc.Stop(); }

    public void stopSoundRabbitFalls()
    {rabbitFallsSrc.Stop();}

    public void stopSoundEnemyAttacks()
    {
        enemyAttacksSrc.Stop();
    }

    private void checkMusicAndStopOrStartIfNecessary()
    {
        if (SoundManager.Instance.isMusicOn() && !musicSrc.isPlaying)
        { musicSrc.Play(); }
        else if(!SoundManager.Instance.isMusicOn() && musicSrc.isPlaying)
        { musicSrc.Stop(); }
    }
}

Here are screenshot of the exceptions in console and inspector view:

sentences:
Unity - X axis back to front I'm using Unity 2018 and its really confusing me. I generate a plane mesh in code and when it comes to positioning (transform.position.x) it on the X axis I can't understand why moving it further to the right the X value decreases (into the negatives) and the X value increases to the left??

The Y axis works as expected, up increases the value (positive), down decreases (negative).
The Z axis, away from camera = negative and towards = positive.

(Just creating a basic 3D cube game object using the Unity Create tool, the same issue applies.)

I need to figure if this is how Unity is set up now? Or I'm doing something wrong.. But I'm stuck on this!!

//create mesh code:

Mesh CreateMesh(float width, float height)
    {
        Mesh m = new Mesh();
        m.name = "ScriptedMesh";
        m.vertices = new Vector3[] {
         new Vector3(0, 0, 0.01f),
         new Vector3(width, 0, 0.01f),
         new Vector3(width, height, 0.01f),
         new Vector3(0, height, 0.01f)
     };
        m.uv = new Vector2[] {
         new Vector2 (0, 0),
         new Vector2 (0, 1),
         new Vector2(1, 1),
         new Vector2 (1, 0)
     };
        m.triangles = new int[] { 0, 1, 2, 0, 2, 3 };
        m.RecalculateNormals();

        return m;
    }

//build our first wall mesh obj

                    var wallObj = new GameObject("Wall-" + wallc.WallLengthCM + " (" + wallIndex + ")");
                    var _wallMesh = (MeshFilter)wallObj.AddComponent(typeof(MeshFilter));
                    _wallMesh.mesh = CreateMesh((float)wallc.WallLengthCM, (float)wallc.WallHeightCM);
                    MeshRenderer wallRenderer = wallObj.AddComponent(typeof(MeshRenderer)) as MeshRenderer;
                    wallRenderer.material = ShedWallMat;
var wallMesh = Instantiate(_wallMesh,
                new Vector3 { x = 0, y = ((float)wallc.WallHeightCM * 2 * wallIndex) + vertSpace, z = 0 },
                new Quaternion { w = 0, x = 0, y = 0, z = 0 });

sentences:
GLM Velocity Vectors - Basic Maths to Simulate Steering UPDATE - Code updated below but still need help adjusting my math.

I have a cube rendered on the screen which represents a car (or similar).

Using Projection/Model matrices and Glm I am able to move it back and fourth along the axes and rotate it left or right.

I'm having trouble with the vector mathematics to make the cube move forwards no matter which direction it's current orientation is. (ie. if I would like, if it's rotated right 30degrees, when it's move forwards, it travels along the 30degree angle on a new axes).

I hope I've explained that correctly.

This is what I've managed to do so far in terms of using glm to move the cube:

glm::vec3 vel; //velocity vector

void renderMovingCube(){

    glUseProgram(movingCubeShader.handle());
    GLuint matrixLoc4MovingCube = glGetUniformLocation(movingCubeShader.handle(), "ProjectionMatrix");
    glUniformMatrix4fv(matrixLoc4MovingCube, 1, GL_FALSE, &ProjectionMatrix[0][0]);

        glm::mat4 viewMatrixMovingCube;
        viewMatrixMovingCube = glm::lookAt(camOrigin, camLookingAt, camNormalXYZ);

        vel.x = cos(rotX); vel.y=sin(rotX);
        vel*=moveCube;

        //move cube
        ModelViewMatrix = glm::translate(viewMatrixMovingCube,globalPos*vel);

        //bring ground and cube to bottom of screen
        ModelViewMatrix = glm::translate(ModelViewMatrix,  glm::vec3(0,-48,0));
        ModelViewMatrix = glm::rotate(ModelViewMatrix, rotX, glm::vec3(0,1,0));     //manually turn

        glUniformMatrix4fv(glGetUniformLocation(movingCubeShader.handle(), "ModelViewMatrix"), 1, GL_FALSE, &ModelViewMatrix[0][0]); //pass matrix to shader
    movingCube.render();        //draw
    glUseProgram(0);
}

keyboard input:

void keyboard()
{
    char BACKWARD  = keys['S']; char FORWARD   = keys['W'];
    char ROT_LEFT  = keys['A']; char ROT_RIGHT = keys['D'];

    if (FORWARD) //W - move forwards
    {
        globalPos += vel;
        //globalPos.z -= moveCube;
        BACKWARD = false;
    }
    if (BACKWARD)//S - move backwards
    {
        globalPos.z += moveCube;
        FORWARD = false;
    }
    if (ROT_LEFT)//A - turn left
    {
        rotX +=0.01f;
        ROT_LEFT = false;
    }
    if (ROT_RIGHT)//D - turn right
    {
        rotX -=0.01f;
        ROT_RIGHT = false;
    }

Where am I going wrong with my vectors? I would like change the direction of the cube (which it does) but then move forwards in that direction.

sentences:
LWJGL - OpenGL - Texture shading I want to use LWJGL to create a shader that all it does is change the color of the given texture. For example I tell it to draw the letter A using a sprite sheet then I can tell the shader to draw the letter in a certain color. How would you do something like this without needed to create different colored letter sprite sheets?

Task for the shader: Simply change all pixels to a certain color in the texture.
Input: Color , texture.
Output: it draws onto the screen the new colored texture.

How do i accomplish such a thing?

sentences:
How To Set Constants Using ID3DShaderReflection I got to the point where I am tired of hardcoding shaders and decided that it was now time to look into using ID3D11ShaderReflection to get data from the shader and set my shader's constant buffer using that data.  I have a simple system that loads up shaders and gets it's data.  Now that I have the data, I would like to know how the correct way to upload the data to the constant buffer.  I've searched on Google and couldn't find too much information on this.  Any help? Thanks!

Here's some code: http://www.gamedev.net/topic/654950-setting-constants-using-id3d11shaderreflection/

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:
How to avoid game starting before start button is clicked? I've made a game with a Title Screen (Canvas), and a Start Button attached to the Title Screen. Points, GameOver, Restart, and even the Start Button sort of works, but it's possible to play the game before the user presses start.

Is there a way to make the GameObjects only appear after the button is clicked? I've tried to move and change the "public void StartGame()", but I can't get it right.

This is my first game ever, so hope the code provided is relevant.

Enemy.cs

 void Start()
{
        enemyRb = GetComponent<Rigidbody>();
        gameManager = GameObject.Find("GameManager").GetComponent<GameManager>();
        player = GameObject.Find("Player");
}

GameManager.cs

 public void StartGame()
{
    powerup.transform.rotation);
    score = 0;
    UpdateScore(0);
    isGameActive = true;
    titleScreen.gameObject.SetActive(false);
}

void Update()
{
    enemyCount = FindObjectsOfType<Enemy>().Length;

    if (enemyCount == 0)
    {
        roundNumber++;
        SpawnEnemyIntruders(roundNumber);
        Instantiate(powerup, GenerateSpawnPosition(), powerup.transform.rotation);
    }
}

void SpawnEnemyIntruders(int enemiesToSpawn)

{
  for (int i = 0; i < enemiesToSpawn; i++)
  {
      int enemyIndex = Random.Range(0, enemies.Length);
      Instantiate(enemies[enemyIndex], GenerateSpawnPosition(), enemies[enemyIndex].gameObject.transform.rotation);
  }
}
public void GameOver()
{
    restartButton.gameObject.SetActive(true);
    gameOverText.gameObject.SetActive(true);
    isGameActive = false;
}

PlayerController.cs

    void Start()
{
    playerRb = GetComponent<Rigidbody>();
    playerAudio = GetComponent<AudioSource>();
}

StartButton.cs

    void Start()
{
    button = GetComponent<Button>();
    gameManager = GameObject.Find("GameManager").GetComponent<GameManager>();
    button.onClick.AddListener(StartThis);
}

sentences:
Why isn't my cbuffer updating? I am really frustrated because my cbufer isn't updating.
This is my VS:

cbuffer MatrixBuffer: register(b0)
{
float4x4 worldViewProj;

};

struct VertexIn
{
float4 Pos : POSITION;
float4 Color: COLOR;
};

struct PixelIn
{
float4 PosH : SV_POSITION;
float4 Color: COLOR;
};

PixelIn VS (VertexIn vin)
{
PixelIn vout;

vin.Pos.w = 1.0f;

vout.PosH = mul(vin.Pos, worldViewProj);

vout.Color = vin.Color;

return vout;
}

PixelIn VS1(VertexIn vin)
{
PixelIn vout;

vin.Pos.w = 1.0f;
vout.PosH = vin.Pos;

vout.Color = vin.Color;

return vout;
}

When using VS1 it draws correctly, but when using VS it doesn't draw anything?

Here is my CBUFFER update code

bool Game::UpdateShaders()
{
    HRESULT result;
    D3D11_MAPPED_SUBRESOURCE mappedResource;
    MatrixBufferType* dataPtr;

    worldViewProjM = worldM * viewM * projM;
    worldViewProjM = XMMatrixTranspose(worldViewProjM);
    result = md3dDeviceContext->Map(mMatrixBuffer, 0, D3D11_MAP_WRITE_DISCARD, 0, &mappedResource);
    if (FAILED(result))
    {
        MessageBoxW(mMainWnd, L"FAOE:", 0, 0);
        return false;
    }

    dataPtr = (MatrixBufferType*)mappedResource.pData;

    dataPtr->worldViewProj = worldViewProjM;

    md3dDeviceContext->Unmap(mMatrixBuffer, 0);

    int NBuffers = 0;

    md3dDeviceContext->VSSetConstantBuffers(0, 1, &mMatrixBuffer);
    //md3dDeviceContext->PSSetConstantBuffers(0, 1, &mMatrixBuffer);

    return true;
}

Here is my MATRIXBUFFERTYPE struct:

struct MatrixBufferType
{
        XMMATRIX worldViewProj;
};

This is called after I clear my depth stencil view and render target view.
Does somebody know why my CBUFFER isn't updating?

Thanks in advance.

sentences:
Isometric coordinate maths not quite right I have written two functions, screenToCoords and coordsToScreen.

Screen being the coordinates on screen.

Coords being isometric coordinates.

So here are my functions:

Screen to isometric:

Vector2 TileMap::screenToCoords(Vector2 coords){
    coords.x -= offset.x;
    coords.y -= offset.y;
    Vector2 newCoords;
    newCoords.x = (coords.x / (TILE_WIDTH/2) + coords.y / (TILE_HEIGHT/2)) /2;
    newCoords.y = (coords.y / (TILE_HEIGHT/2) - (coords.x / (TILE_WIDTH/2))) /2;
    return newCoords;
}

Isometric to screen:

Vector2 TileMap::coordsToScreen(Vector2 coords){
    Vector2 newCoords;
    newCoords.x = (coords.x - coords.y) * (TILE_WIDTH/2) + offset.x;
    newCoords.y = (coords.x + coords.y) * (TILE_HEIGHT/2) + offset.y;
    return newCoords;
}

And these seem to work totally fine, except when dealing with mouse coordinates, as you can see here:

I can't figure out what the issue is.

Basically what's happening in this image is that I'm converting mouse coordinates into isometric coordinates, then back into screen coordinates so that I can render that highlight box.

sentences: ue4editor.exe GPU selection Even though I set ue4editor.exe to use integrated graphics on my laptop, it somehow ends up using the discrete nvidia gpu; is there a way to set the preferred gpu with the unreal suite?

sentences:
How do I build a 2D physics engine? The most advanced games I've made are a 8-ball pool game made with the physics engine Box2dFlashAS3 and a platform game with levels.

When I did platform games, I've always wished to know how to make an engine, so that I could re-use it. When I see games that have slopes, curved slopes, perfect gravity and real-life physics, I've always wished I knew how to code the engine.

Please suggest techniques and articles for whatever relevant knowledge-base is necessary.

sentences:
How to form a concave shape out of convex shapes? I'm trying to get around the rule of only being able to form convex shapes in the SFML C++ library.

  To do this I'm planning on testing given vertices, and if concave,
  splitting the vertices into groups, testing each groups' concaveness,
  and repeating until a full set of convex shapes results that look
  just like the original shape when put together

What I would like to know is...

What the equation for testing a shapes concaveness is: what is it and how does it work?
How would I split up the vertices of the concave shape so in the end the shape is formed out of as few convex shapes as possible?
Whats the best practice for achieving my goal?

Thanks!

sentences:
Unexpected white pixels when using terrain painting brush I have two texture layers in my terrain. When I paint the second layer on the base layer the results around some of the the joining areas will be like:

I can remove it by carefully painting over it but in some cases it just grows further and consumes a lot of time and energy. I'm using Unity 2018.4.0f1 and have never seen such thing in older versions and 2019. However I have not used terrains very much. Tell me if you need any information in the comments.
I have tried the following approaches:

Disabling Alpha Channel in texture import settings
Testing both color spaces (Linear and Gamma)
Using the same texture for both layers (The white line still exists)
Using custom Diffuse Material

The problem seems to be the generated SplatAlpha texture:

As you can see four layers are generated: Red, Green and Black. But you can see the pixels I marked with blue and I don't know where are they coming from.
Why is that and how to solve it?

sentences:
Linking error at tessellation shaders in GLSL I'm testing the triangle tessellation from the link http://prideout.net/blog/?p=48#shaders . All the shader are compiled correctly, but when I try to link the program using the command:

glLinkProgram(programID);

I got the following error:

Tessellation control info
(0): error C6029: No input primitive type
----------------------------------------
Tessellation evaluation info
(0): error c7005: No tessellation primitive mode specified
-----------------------------------------------------------
Geometry info
(0): error C6022: No input primitive type
(0): error C6029: No ouput primitive type
----------------------------------------
Not valid

It's so strange I declare output for TC Shader using command:

layout(vertices = 3) out;

And input layout for TE shader using command:

layout(triangles, equal_spacing, cw) in;

Why I still got this error?
I hope to see you answer about it.

I put my shaders in below:

Vertex shader:

#version 410 core

in vec4 Position;
out vec3 vPosition;

void main()
{
    vPosition = Position.xyz;
}

TC shader:

#version 410 core

layout(vertices = 3) out;
in vec3 vPosition[];
out vec3 tcPosition[];

#define ID gl_InvocationID

void main()
{
    float TessLevelInner = 3;
    float TessLevelOuter = 2;
    tcPosition[ID] = vPosition[ID];
    if (ID == 0) {
        gl_TessLevelInner[0] = TessLevelInner;
        gl_TessLevelOuter[0] = TessLevelOuter;
        gl_TessLevelOuter[1] = TessLevelOuter;
        gl_TessLevelOuter[2] = TessLevelOuter;
    }
}

TE Shader:

#version 410 core
//TessEval

layout(triangles, equal_spacing, cw) in;
in vec3 tcPosition[];
out vec3 tePosition;
out vec3 tePatchDistance;
uniform mat4 Projection;
uniform mat4 Modelview;

void main()
{
    vec3 p0 = gl_TessCoord.x * tcPosition[0];
    vec3 p1 = gl_TessCoord.y * tcPosition[1];
    vec3 p2 = gl_TessCoord.z * tcPosition[2];
    tePatchDistance = gl_TessCoord;
    tePosition = normalize(p0 + p1 + p2);
    gl_Position = Projection * Modelview * vec4(tePosition, 1);
}

Geometry shader:

#version 410 core
//geometry shader
layout(triangles) in;
layout(triangle_strip, max_vertices = 3) out;
in vec3 tePosition[3];
in vec3 tePatchDistance[3];
out vec3 gFacetNormal;
out vec3 gPatchDistance;
out vec3 gTriDistance;
uniform mat4 Modelview;
uniform mat3 NormalMatrix;

void main()
{
    vec3 A = tePosition[2] - tePosition[0];
    vec3 B = tePosition[1] - tePosition[0];
    gFacetNormal = NormalMatrix * normalize(cross(A, B));

    gPatchDistance = tePatchDistance[0];
    gTriDistance = vec3(1, 0, 0);
    gl_Position = gl_in[0].gl_Position; EmitVertex();

    gPatchDistance = tePatchDistance[1];
    gTriDistance = vec3(0, 1, 0);
    gl_Position = gl_in[1].gl_Position; EmitVertex();

    gPatchDistance = tePatchDistance[2];
    gTriDistance = vec3(0, 0, 1);
    gl_Position = gl_in[2].gl_Position; EmitVertex();

    EndPrimitive();
}

Fragment Shader:

#version 410 core
//fragment shader
out vec4 FragColor;
in vec3 gFacetNormal;
in vec3 gTriDistance;
in vec3 gPatchDistance;
in float gPrimitive;
uniform vec3 LightPosition;

float amplify(float d, float scale, float offset)
{
    d = scale * d + offset;
    d = clamp(d, 0, 1);
    d = 1 - exp2(-2*d*d);
    return d;
}

void main()
{
    vec3 AmbientMaterial = vec3(0.04f, 0.04f, 0.04f);
    vec3 DiffuseMaterial = vec3(0, 0.75, 0.75);
vec3 LightPosition = vec3(0.25, 0.25, 1);
    vec3 N = normalize(gFacetNormal);
    vec3 L = LightPosition;
    float df = abs(dot(N, L));
    vec3 color = AmbientMaterial + df * DiffuseMaterial;

    float d1 = min(min(gTriDistance.x, gTriDistance.y), gTriDistance.z);
    float d2 = min(min(gPatchDistance.x, gPatchDistance.y), gPatchDistance.z);
    color = amplify(d1, 40, -0.5) * amplify(d2, 60, -0.5) * color;

    FragColor = vec4(color, 1.0);
}

sentences:
How to map square texture to triangle? I want to find the texture coordinates for point P. I have the vertices of the triangle and their corresponding uv coordinates.

The numbers in the little squares in the texture represent color values.

What are the steps of computing the uv coordinates of P?

sentences:
Why I get inconsistent occlusion query results? My system: Catalyst 15.12, mesa 11.2.1, Archlinux, kernel 4.5.1

Depending on camera position I get inconsistent occlusion query results. Following scene contains wall, objects behind wall and objects on sides. Objects behind wall are always invisible(correct). Objects on sides should be always visible but sometimes marked as invisible. Why? On screenshots green means visible, red boundary means occluded:

This is the code that I use:

void gems_render_objects(Scene *scene) {
    int i = 0, j = 0, res;
    AssetInstance *inst;

    if(!s_queryIds) {
        s_queryIds = (GLuint*)malloc(sizeof(GLuint)*(scene->numInstances));
        glGenQueries(scene->numInstances, s_queryIds);
    }

    //draw everything
    for(i = 0; i < scene->numInstances; i++) {
        glc_draw_inst(scene, scene->instances+i, &s_curProgramId, &s_curVaoId);
    }

    //query everything
    glDepthMask(GL_FALSE);
    glColorMask(GL_FALSE, GL_FALSE, GL_FALSE, GL_FALSE);
    for(i = 0; i < scene->numInstances; i++) {
        inst = scene->instances+i;

        glBeginQuery(GL_SAMPLES_PASSED, s_queryIds[i]);
        glc_draw_inst(scene, inst->bbInst, &s_curProgramId, &s_curVaoId);
        glEndQuery(GL_SAMPLES_PASSED);
    }
    glDepthMask(GL_TRUE);
    glColorMask(GL_TRUE, GL_TRUE, GL_TRUE, GL_TRUE);

    //draw bounding boxes of invisible
    glDepthMask(GL_FALSE);
    glDisable(GL_DEPTH_TEST);
    for(i = 0; i < scene->numInstances; i++) {
        inst = scene->instances+i;

        res = 0;
        glGetQueryObjectiv(s_queryIds[i], GL_QUERY_RESULT, &res);

        if(res == 0) {
            GLenum prevDrawType = inst->bbInst->asset->drawType;
            inst->bbInst->asset->drawType = GL_LINE_STRIP;
            glc_draw_inst(scene, inst->bbInst, &s_curProgramId, &s_curVaoId);
            inst->bbInst->asset->drawType = prevDrawType;
        }
    }
    glEnable(GL_DEPTH_TEST);
    glDepthMask(GL_TRUE);
}

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:
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:
Should "games played this week" be computed from a fixed or running time span? I'd like to create a leaderboard that shows how many games each player has played. This works fine for the "all time" section in Game Center, since I can just submit the total number. But what I really want to display is the number of games each player has played in a week, not for all time.

As I understand it, I would have to calculate the weekly numbers myself (if I submitted the all-time totals, the weekly tab in Game Center would still just show the total all time numbers from that week, not the weekly totals).

What would be the best way to do this? Count a user's tasks beginning on Monday, and reset them on Sunday? Or have everyone on their own unique 7 day timer?

sentences:
Getting into the details of game engine programming I am interested in learning game programming, but I really have an interest in the lower level engineering in games. I have OpenGL experience, and I am really interested in learning more about implementing AI, Physics, etc. I have a computer science degree, so I really like getting into technical stuff.

Many times when I ask about this sort of thing, I get a lot of "Use an engine", "Use Unity3d", "Why waste your time writing code that already exists", etc, etc. My idea was to use simpler libraries such as SFML or XNA so that I could learn how to implement the more complex systems.

The thing is, although I do want to write games, I want to learn things that using something like Unity simply doesn't teach you. My goal is not to make a current generation quality 3D game to sell, I just want to make some cool smaller games and learn all I can about the programming side of game development.

Is this something that people just do not do anymore?

It seems like everywhere I turn people are using Unity or UDK or GameMaker. I fully understand why you would use a tool like these, but I cant see how they would suit my purposes.

So where does someone like myself turn? Am I trying to learn something that people just do not bother doing anymore? Is the innovation in this area gone and just all about gameplay now?

I'm sorry if this question seems silly, but I am genuinely interested in knowing more about this and meeting more people who are interested in this sort of thing.

sentences:
Unity: Trying to add a simple light to a prefab A bit of a unity beginner here. I have a windmill prefab and I would just like to add a simple point or directional light to my prefab. I added the component for a light to the prefab and started the game, but it seems like no matter what I try, the light would not appear. I tried to move the component to the top in the Inspector window (thinking another component would overwrite the light properties).

Any ideas? Or things Im doing wrong?

sentences:
Missing references in built bundles The following is a copy of our post in Unity Forum (https://forum.unity.com/threads/missing-references-in-built-bundles.1103689/)
Hello,
We have a bundle for our scenes and another one to store our prefabs (actually we have around 10 bundles but let's keep it simple). In every scene we have unpacked prefab instances. We have no problem in playmode using the AssetDatabase but once we use built addressables some unpacked prefab instances in our scenes are broken. Sprites and / or scripts are missing in a inconsistent way; in some scenes those objects are fine and sometime they are not. This comes along multiple warning messages "The referenced script (Unknown) on this Behaviour is missing! ".
Note that the issue also happens when we fully deploy our player.
Unity version : 20193.3.13
Addressables version : 1.16.1

Solution 1 : We tried to remove addressable prefabs (A,B,C in the diagram) from their bundle since we don't really have to instantiate them at runtime for now and it worked.
Solution 2 : We also tried to put scenes and prefabs into the same bundle and it worked too.
Solution 3 : Switch to 1.18.2 and 1.15.1 version of addressable package and it didn't work.
Solution 4 : Finally we tried to use the Duplicate Bundles Dependencies analyzer multiple times in order to have no more issues of this type and it didn't work.
Questions 1: As far as we understand, when addressable groups are built, Unity computes all dependencies and build them inside the bundle along the orignal assets (in my diagram "Scenes" bundles is packed with D'). What we don't understand is why having our prefabs in a separated bundle break references link in the scenes. Our guess is that Unity doesn't know which version of those dependencies to use (the one in the scene bundle or the one in the prefab bundle) and somehow fails to load them properly.
Question 2 : Is splitting our content is a good approach, we did it mostly for visibility but it appears to be more a problem in the long term, what are your guidelines regarding this matter ?
Question 3 : Why Duplicate Bundle Dependency rule has to be processed multiple times to properly fix every issue ? We think that running this rule creates duplication issues itself but we can't really tell..
Thanks.

sentences:
How can I refactor "attack cooldown" into "attack speed"? I'm building a game where the player's character can attack bad guys and vice versa. I built this with the concept of an "attack cooldown" because I don't want units to be able to attack each other every single frame.  I want there to be some delay between attacks.  Here's roughly how it works:

if unit.ticksUntilAttack <= 0
  unit.attack(target)
  unit.ticksUntilAttack = unit.attackCooldown
unit.ticksUntilAttack = unit.ticksUntilAttack - 1

I also have a page where I show the character's stats and list this as "Attack Cooldown".  I was showing my friend and he said, "Why don't you rename that to 'Attack Speed'"?  I explained that it's not really the speed at which you attack because "smaller is better".  We both agreed that "attack speed" is a more standard way to show this concept and that I should change things the way he suggests.

The problem for me is that "attack cooldown" is a much more intuitive way for me to program the solution.  I'm wondering if there's some "trick" to refactoring the current code I've got.  I'm thinking something like this:

if unit.attackSpeedAccumulator >= SUM_NEEDED_TO_ATTACK //a constant that's the same for every unit
  unit.attack(target)
  unit.attackSpeedAccumulator = 0
unit.attackSpeedAccumulator = unit.attackSpeedAccumulator + unit.attackSpeed

Is there a smarter way to do this?

sentences:
Serialize ScriptableObject without creating an asset out of it? Is it possible to do something like this?

public class SomeScriptable : ScriptableObject
{
    public MyScriptable myScriptable;

    public void OnValidate()
    {
        if (myScriptable == null)
        {
             myScriptable = ScriptableObject.CreateInstance<MyScriptable>();
         }
    }
}

public class MyScriptable : ScriptableObject
{

    public int MyVar1;
    public string MyVar2;

}

I tried this but am getting a "Type Mismatch" error in Unity.

sentences:
How can I determine which Trigger is hit? I have a GameObject. It has 3 BoxCollider2Ds:

Body Collider - Not a trigger - Determines if body is hit
Weapon Collider - Trigger - Determines if weapon is hit
Vision Collider - Trigger - Determines what the GameObject sees

I can tell the Body Collider apart from the other colliders, because it has a different method (OnCollisionEnter2D).  However, I cannot tell the Weapon Collider and Vision Collider apart.  They both access the same method (OnTriggerEnter2D), and pass in the collider they are hitting.  I cannot determine which one is hit.

I could put each trigger on a separate child GameObject, and send a message to the parent, but this is very slow and feels messy to me.  What is the best way I can determine which trigger I am hitting?

From the Unity Docs for reference:

using UnityEngine;
using System.Collections;

public class ExampleClass : MonoBehaviour {
    public bool characterInQuicksand;
    void OnTriggerEnter2D(Collider2D other) {
        characterInQuicksand = true;
    }
}

sentences: Calculate the slope of a 3D triangle? I have lots of triangles in 3D space. How do I determine the slope/angle of these triangles with respect to a fixed ground plane? I need pseudo code examples at the very least.

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:
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:
Libgdx and ParticleEffect with scene2d not showing the same way as in the Particle Editor I am developing a new game with libgdx and trying to implement ParticleEffect in scene2d (using actor). I am creating a ParticleEffect with Particle Editor in which I would like to
add to a stage.

From some reason, the effect appears horizontally only (objects appear from left to right but not up and down) and is not appearing the same as in the Particle Editor (X and Y axis).
Does anyone have an idea what could be the reason for that?

Snapshot of the horizontal effects (desktop run):

Particle Editor effect:

sentences:
Bringing islands close together programmatically I generate island/continent maps and I want to make a grand archipelago of sorts where all these islands are located. The problem is that I don't know a smart way to place the islands programmatically so that the keep a minimum distance from each other. Sure, I can create a quadtree but then how do I place it? Placing it on top of another island and move it away in a random direction? I'm attaching a photo of what I want to do, easily done in Paint .NET from 6 individual maps.

The scale I'm talking about would be placing about 3-10 continents, each with a resolution of 4Kx4K upwards. (I'll only allow reflections and translations in placement, to preserve some 4-/8- connectivity pixel work that I've done for the maps)

What I'm NOT looking for:
 - a global minimum solution ( all islands as close together as possible)
 - using a heavyweight physics/maths library or tons of code
 - a super-simplistic solution either (e.g. calculate OBBs and use those to resolve collisions)

sentences:
How would I determine whether or not to render the player over or behind a tree in a 2d top down game? In games like Factorio, you might notice that when the player is at a certain coordinate relative to the tree, it renders in front of the player, thereby giving the effect that the player is behind the tree. My question is, how is this accomplished?

Here are some examples:
Behind a telephone pole:

In front of one:

sentences:
Unity3d wheelcollider falling through terrain I have created simple project with 3D car and terrain. I have added 4 Wheel Colliders on model wheels. But when I run project wheels falling through terrain.

Before run:

After run:

I am sure that at start wheel colliders above the terrain and not intersect it. Configuration is:

In what problem is? I have tried a lot of different things but I can't find a solution.

sentences:
How to get Google Play to suggest my app? I uploaded a game to Play and obviously it isn't the very first suggestion on the list. I uploaded it 3 days ago.

As somehow new games do get played, I assume people start to know about them.

I would like to ask that how does Play start suggesting an app? Is it by download count/download frequency? Or does it show new apps by itself?

sentences:
How to change the virtual joystick Input direction depending on camera rotation so the player moves to its current forward direction? I have a scene set up where the player moves and rotates with Virtual Joystick Input. I have button which rotates the camera to the back of my player at that point I want to change the joystick input direction so it moves my player to towards its current forward direction.

  The joystick Scripts:

1) script to handle events:

public class joystickEvents extends EventSystems.EventTrigger{
  var position:Vector2=Vector2.zero;

  public var joyStickHolder:Transform;
  private var pointerUp:boolean=false;

  function Update(){
    if(position!=Vector3.zero && pointerUp){
       position=Vector3.Lerp(position,Vector3.zero,5*Time.deltaTime);

    }
  }
   public function OnDrag(data:EventSystems.PointerEventData){
      position=data.position-joyStickHolder.position;
   }
   public function OnPointerUp(data:EventSystems.PointerEventData){

     pointerUp=true;

    }
  public function OnPointerDown(data:EventSystems.PointerEventData){
     pointerUp=false;
  }

}

2) script for joystick movement:

   public class joystick extends MonoBehaviour{
    var joystickEvents:joystickEvents;
    var joystickHolder:RectTransform;
          var dir:Vector3;
    private var maxDist:float;
    private var direction:Vector3;
    private var magnitude:float;

     function Start(){
        maxDist = joystickHolder.sizeDelta.x;
        maxDist=maxDist/2.5;
     }

     function OnGUI () {

        if(joystickEvents.position.magnitude>(maxDist))
              magnitude=maxDist;

        else{
          magnitude=joystickEvents.position.magnitude;

        }
        direction=joystickEvents.position.normalized;

      transform.localPosition=direction*magnitude;
        dir=direction*(magnitude/maxDist);
    }
  }

The player controller script takes the variable dir to move around the world. I think this value must changed somehow to so that move the player moves towards its current forward based on joystick input when camera is rotated.

  Here some part of playerController responsible for player movement:

public class charcterController extends MonoBehaviour{
 private var controller  : CharacterController;
 private var moveDirection : Vector3 = Vector3.zero;
 var speed : float = 6.0;
 var joystick:joystick; //reference to the joystick script
  function Start(){
       controller = GetComponent.<CharacterController>();
    }
  function Update() {
        var joyInput:Vector3=joystick.dir; //the dir in joystick script
        dir=Vector3(joyInput.x,0,joyInput.y);
        if (controller.isGrounded) {
        moveDirection = dir;

        moveDirection *= speed;
        controller.Move(moveDirection * Time.deltaTime);
         rotate();
      }
  function rotate(){
      if(dir!=Vector3.zero)
          transform.rotation = Quaternion.LookRotation(dir);
      }
 }

sentences:
Getting OpenGL hardware acceleration with SDL on Linux I'm trying to use SDL + OpenGL but I don't believe hardware acceleration is working because the framerate for around 18000 polys is about 24fps on a quad core machine but is a hopeless 1-2fps on an Intel Atom. Even the quad core starts to struggle when the poly count rises above this.

I've checked my code over but I'm clearly missing something obvious. I've changed my SDL initialisation code to use the same code as in the SDL OpenGL test. It reports that SDL_GL_ACCELERATED_VISUAL is 1 but that hw_available in SDL_VideoInfo is 0

Also the vendor is reported correctly as Nvidia on both machines and accelerated apps such as Compiz and glxgears work fine.

Any ideas of what to try?

Thanks

sentences:
Using a MTLTexture as the environment map of a SCNScene I want to set a MTLTexture object as the environment map of a scene, as it seems to be possible according to the documentation. I can set the environment map to be a UIImage with the following code:

let roomImage = UIImage(named: "room")
scene.lightingEnvironment.contents = roomImage

This works and I see the reflection of the image on my metallic objects. I tried converting the image to a MTLTexture and setting it as the environment map with the following code:

let roomImage = UIImage(named: "room")
let loader = MTKTextureLoader(device: MTLCreateSystemDefaultDevice()!)
let envMap = try? loader.newTexture(cgImage: (roomImage?.cgImage)!, options: nil)
scene.lightingEnvironment.contents = envMap

However this does not work and I end up with a blank environment map with no reflection on my objects.

Also, instead of setting the options as nil, I tried setting the MTKTextureLoader.Option.textureUsage key with every possible value it can get, but that didn't work either.

You can have a look at the example project in this repo and use it to reproduce this use case.

sentences:
A* for non grid network For my specific case, I am trying to find a path finding implementation similar to what described here.

I could see reference implementation for A* and HPA*, but I wonder how to extend A* to simple roadmaps (say 20 nodes). I am not sure how to extend A* to use non-grid network. Any examples would be useful.

Thanks.

sentences: Inverse of perspective matrix, for what? I dont understand for what i need the inverse of the perspective Matrix in Computer Graphics and how do i calculate it?Maybe someone has an explanation for me.

sentences:
DirectX 12 Questions about the command queue and command list? I have been wondering this question for a while. Would this command

ThrowIfFailed(m_command_list->Reset(m_command_allocator.Get(), nullptr));
m_command_list->ResourceBarrier(1, &CD3DX12_RESOURCE_BARRIER::Transition(m_depth_stencil.Get(), D3D12_RESOURCE_STATE_COMMON, D3D12_RESOURCE_STATE_DEPTH_WRITE));
ThrowIfFailed(m_command_list->Close());

get sent to the command queue and not be executed?

Also how would I set the command list back into a recording state?

sentences: What is the rule with number of levels? I have been making my first game, I have a number of levels I was thinking of making, around 20-30 but I'm not sure if this is too many. Is there a hard and fast rule for number of levels to include in a game?

sentences:
Why cap game loop delta-time? I was reading some game's source code on Github and saw this game loop implementation for the first time:

var lastTime = 0;
var maxTime = 1/30;

/**
 * @param {DOMHighResTimeStamp} curTime requestAnimationFrame provides this value automatically
 */
this.loop = function(curTime) {
    requestAnimationFrame(Game.loop);

    // Same as division by 1000
    var dt = (curTime - lastTime) * 0.001;

    if(dt > maxTime) {
        dt = maxTime;
    }

    for(var i = 0, len = boards.length; i < len; i++) {
        if(boards[i]) {
           boards[i].step(dt);
           boards[i].draw(Game.ctx);
        }
    }

    lastTime = curTime;
};

The key thing: The game updates and draws at every step, but the delta time is capped at the desired maximum delta. That way, if a frame takes too long, the next frame steps with a constant delta.

What are the pros and cons of this approach? I imagine it's useful for preventing huge entity movements caused by a long timestep, but can it cause problems?

Edit

Use curTime as provided by window.requestAnimationFrame in order to simplify stuff and avoid comments that don't deal with my main question.

sentences: Integration of LibRocket and Android I am using OpenGL ES 2.0 to create a 2D game for Android 2.2 and was planning on using LibRocket for the GUI.  Does anyone have any links or knowledge they would share on how to integrate LibRocket with the android platform?  I know that it is a c++ library that would need to go through the NDK, however I rather not change my OpenGL rendering code to the NDK unless I have to.

sentences:
Can I use physics in Isometric map based games? I am trying to use physics in my game which is an isometric map based strategy game that the player deals with a city full of buildings, roads and people in it. I am writing the game with Swift and SpriteKit technology.

(the following picture shows a snapshot of my game)

MY GAME

I like to use Spritekit's physics library so I would be able to simulate car accidents and preventing them to go throw the buildings and other kind of stuff that physics could provide.

I am familiar with Physics and I have enough experience with Bullet and I can write a 3D game using OpenGL ES and physics, but I haven't really used physics in 2D isometric map games.

I have also wrote a 2d physic game that was really 2d (an endless runner) which was actually a sample of a book but as you can see in the following picture the gravity vector is the Y axis and every thing is pretty easy.

Here is the gravity vector that is used to create the game at the following picture.

self.physicsWorld.gravity = CGVectorMake(0, -9.8)

Someone Elses Game, Book Sample

Book Name : iOS 7 Game Development

Author : Dmitry Volevodz

You may find the book Here

However, in an isometric map game you can't just set and assign the Y axis as a gravity vector. since the method which sets the gravity vector accepts two arguments it is a big hope that I can use physics in my isometric map games. For example something like this

  I Say!!! :

As I am still using a cartesian coordinate system (perpendicular axis) X and Y axis make a 90 degree angle and if I need to project the gravity quantity over the X and Y axis it would be gCos(45),gSin(45) I haven't tested it yet.

self.physicsWorld.gravity = CGVectorMake(-9.8*0.707, -9.8*0.707)

May you please help me on setting the gravity vector and how should I define the moving objects like cars and humans and the static ones like buildings any other tips on modelling physics in isometric map are also welcome and appreciated.

The main question is: is it really possible to use physics in an isometric map based games?

sentences:
Weird shader compiler error I am trying to draw a full screen quad without a vertex buffer.
SV_VertexID should do the trick, although I get a weird error in my shader on the following line:

PS_IN VS(uint VertexID : SV_VertexID)// << this is the line that causes trouble
{
    PS_IN output = (PS_IN)0;

    float4 pos = float4( (VertexID << 1) & 2, VertexID & 2 ,0,1);
    output.pos = mul(pos, wvp );

    float4 t = mul(pos, texTransform);
    output.tex = float2(t.x,t.y);

    return output;
}

The error message:

invalid type used for 'SV_VertexID' input semantics, must be integral

This is how I compile the shader:

fxc.exe /Tvs_4_0_level_9_3 /EVS /Fo Texture_VS.fxo Texture.fx

I dont understand why, as the type is integral. Why do I get this compiler error?

sentences:
HLSL float4 addition returning all 0.0f vector, unexpected result Edit: Added images at the bottom to show the current issue.

I have the following few lines in my hlsl pixel shader where color and specular are both float4.

color = color * textureColor;

// Add specular component and clamp
color = saturate(color + specular);

Running VS2013 graphics debugger and debugging into the pixel shader I see specular coming through as (0.0f, 0.0f, 0.0f, 0.0f) which I expect for the pixel I'm checking since it's not within the specular portion of the viewDirection, but the float4 addition is making the final color as zero after the addition.

Am I completely missing something here? I would assume the following math:

   color (0.65f, 0.0f, 0.0f, 1.0f)
 + specular (0.0f, 0.0f, 0.0f, 0.0f)

   result = (0.65f, 0.0f, 0.0f, 1.0f)

Any thoughts would be greatly appreciated. I have a feeling, I'm missing something really simple here.

EDIT:

 // If I remove the specular and return color after multi by tex Sample,
 // I get the following expected result
 color = color * textureColor;

// As soon as I add the specular component back in
color = saturate(color + specular);

sentences:
What strategies can I use to update the visuals of my game to be more modern? I'm  making a browser strategy game.

Now my problem is that I have a feeling that my design is dated.
For now I have only used background colors and borders to make things look nice, but I have planed to add some pictures later.

Here is what it looks like now:

(Click for larger)

You will see that the game has a top and bottom bar and has the main section in the middle.  My main concern is that this may not be best idea, because not full width and height of the window is used.

What strategies can I use to update the visuals of the site to a more modern look?

sentences:
Place an UI Image between two 2D sprites in Unity I am developing a 2D game with Unity.

I have two sprite objects rendered using SpriteRenderer.

With the new UI system, I want to use it to display an image between my two sprites. That is, my first sprite has a sorting order of 100, then my UI Image has a sorting order of 200 and then my second sprite has a sorting order of 300.

Is that possible?

I tried using sorting layers, but no matter what, the UI image seems to always overlay my two sprites.

sentences:
My game has messed up layouts! Earlier, I asked this question:
Landscape mode for game?

Where I had a directory for each and every layout, but the layout in the layout-land directory wasn't showing up when positioning my layout in landscape orientation.

So, someone suggested to me that it maybe that the

Layout-normal directories are overriding my regular layout-land directories. Is this true?
If so, will any other of my layout folders get overriding?** What is the purpose of layout-normal in the first place then anyway?

sentences:
Manage VBO/VAO in a graphic engine I'm trying to make a 2D Graphic engine for training me. I've actually made it with immediate draw and I've made the renderer outside (so I can switch between OpenGL and DirectX).

How can I manage Vertex Buffer Object and Vertex Array Object? I've made a geometry object, and I don't think VBO and VAO need to be here.

It is the work of my renderer to manage the scene? (Group object in a large VBO, hide object out of screen, Order object by transparency, …)

More explications on my architecture:

Spacial : Spacial element containing spacial elements (like a node).
Mesh : Object with a geometry and a material
Scene : Manage spacial element (like mesh) and lights.
Renderer : Draw the given scene (mesh and lights)

Where I should manage buffers (Index buffer, Vertex Object Buffer and Vertex Array Buffer)? In first, I started to put them in the Geometry class, but it seem obvious because a buffer can stock multiple Geometry object.

So, I'm thinking to put buffers in a buffer manager (in the scene object) -> Scene can manage meshes (order + static/dynamic to regroup them in buffers).

What do you think about that?

Thanks!

sentences:
box2d resize bodies arround point I have a compound object, consisting of a b2Body, vector-graphics and a list polygons which describe the b2body's shapes. This object has its own transformation matrix to centralize the storage of transformations. So far everything is working quiet fine, even scaling works, but not if i scale around a point.

In the initialization phase of the object it is scaled around a point. This happens in this order:

transform the main matrix
transform the vector graphics and the polygons
recreate the b2Body

After this function ran, the shapes and all the graphics are exactly where they should be, BUT:
after the first steps of the b2World the graphical stuff moves away from the body.
When I ran the debugger I found out that the position of the body is 0/0

the red dot shows the center of scaling. the first image shows the basic setup and the second the final position of the graphics. This distance stays constant for the rest of the simulation.

If I set the position via

myBody.SetPosition( sx, sy );

the whole scenario just plays a bit more distant for the origin. Any Idea how to fix this?

EDIT::

I came deeper down to the problem and it lies in the fact that i must not scale the transform matrix for the b2body shapes around the center, but set the b2body's position back to the point after scaling. But how can I calculate that point?

EDIT 2 ::

I came ever deeper down to it, even solved it, but this is a slow solution and i hope that there is somebody who understands what formula I need.

assuming to have a set polygons relative to an origin as basis shapes for a b2body:

scaling the whole object around a certain point is done in the following steps:

i scale everything around the center except the polygons
i create a clone of the polygons matrix
i scale this clone around the point
i calculate dx, dy as difference of clone.tx - original.tx and clone.ty - original.ty
i scale the original polygon matrix NOT around the point
i recreate the body
i create the fixture
i set the position of the body to dx and dy

done!

So what i an interested in is a formula for dx and dy without cloning matrices, scaling the clone around a point, getting dx and dy and finally scale the vertex matrix.

sentences:
How to detect what portion of a rectangle a point is in? Say I have a rectangle and a point inside the rectangle. If the rectangle was split up diagonally, how could I tell which portion the point is in?

Here is a cute little mspaint diagram, where the portions are labeled with letters, and the point is shown with the red circle:

Also, if it helps, I am working in c++

sentences:
DIY hologram experiments split screen I am currently experimenting with the DIY holograms. Does anyone know to split my windows into 4 perpendicular identical displays like this but for Windows?
I am using Unreal Engine & I want it to make something like this but the user should be able to rotate the camera.

sentences:
Problem with monogame reference in monodevelop MAC I've downloaded monogame, monotouch (test version) and monodevelop for MAC and I created a monotouch IOS project, I included the Lidgren and Monogame csproject inside my monodevelop project and I added the monogame reference in my project. But when I try to build it, my Main class doesn't find the Game class and Game.run();

My Main is the same code that I got monogame site:

using MonoTouch.Foundation;
using MonoTouch.UIKit;
using Microsoft.Xna;
using Microsoft.Xna.Samples;
using Microsoft.Xna.Samples.Draw2D;

namespace Microsoft.Xna.Samples.Draw2D
{
    [Register ("AppDelegate")]
    class Program : UIApplicationDelegate
    {
        private Game1 game; //doesn't find

        public override void FinishedLaunching (UIApplication app)
        {
            // Fun begins..
            game = new Game1();
            game.Run();
        }

        static void Main (string [] args)
        {
            UIApplication.Main (args,null,"AppDelegate");
        }
    }
}

and My appDelegate:

using System;
using System.Collections.Generic;
using System.Linq;

using MonoTouch.Foundation;
using MonoTouch.UIKit;

namespace testeios
{
    // The UIApplicationDelegate for the application. This class is responsible for launching the
    // User Interface of the application, as well as listening (and optionally responding) to
    // application events from iOS.
    [Register ("AppDelegate")]
    public partial class AppDelegate : UIApplicationDelegate
    {
        // class-level declarations
        UIWindow window;

        //
        // This method is invoked when the application has loaded and is ready to run. In this
        // method you should instantiate the window, load the UI into it and then make the window
        // visible.
        //
        // You have 17 seconds to return from this method, or iOS will terminate your application.
        //
        public override bool FinishedLaunching (UIApplication app, NSDictionary options)
        {
            // create a new window instance based on the screen size
            window = new UIWindow (UIScreen.MainScreen.Bounds);

            // If you have defined a view, add it here:
            // window.AddSubview (navigationController.View);

            // make the window visible
            window.MakeKeyAndVisible ();

            return true;
        }
    }
}

I don't know what's happening, I follow every step to install it. has Someone the same problem?

sentences: How can I make my main character move in a parabolic arc when jumping? I'm entering Android game development, and I already have a computer version of a game I want to publish. The thing is, I want to make this as good as it can be. With that said, I need a physics engine, really to only do one thing: make a parabolic movement of my main character as he's jumping in the air. Currently, my computer version simply makes the guy move up at a 45 degree angle, and as soon as it hits the ceiling, down at a 45 degree angle. I need a physics engine/library that would accomplish that, it has to be in java since that's my best language, it has to be 2D, and it has to be able to work on Android. Which physics engine/library could accomplish all of that?

sentences:
How to finish a sprite animation before going back to default animation? I want to run a animation until it has gone through all the frames, even when the activation key is no longer held. After the animation is completely finished, it goes back to walking state. I also want to force the animation to finish first before the player can trigger the new animation.

     if (mCurrentState == State.Walking)
        {
            action = "stand";
            Update_Stand(gameTime);

            if (aCurrentKeyboardState.IsKeyDown(Keys.Left) == true)
            {
                action = "run";
                feetPosition.X += MOVE_LEFT;
                effect = SpriteEffects.None;

                Update_Run(gameTime);

            }
            else if (aCurrentKeyboardState.IsKeyDown(Keys.Right) == true)
            {
                action = "run";
                feetPosition.X += MOVE_RIGHT;
                effect = SpriteEffects.FlipHorizontally;

                Update_Run(gameTime);
            }

            if (aCurrentKeyboardState.IsKeyDown(Keys.Z) == true)
            {
                mCurrentState = State.Hitting;
            }
        }

        if (mCurrentState == State.Hitting)
        {
            action = "hit";

            Update_Hit(gameTime);

            mCurrentState = State.Walking;
        }

My Update_Hit(GameTime gameTime) method is something like that.

// Amount of time between frames
TimeSpan frameInterval_Hit;
// Time passed since last frame
TimeSpan nextFrame_Hit;

 public void Update_Hit(GameTime gameTime)
    {
        // Check if it is a time to progress to the next frame
        if (nextFrame_Hit >= frameInterval_Hit)
        {
            // Progress to the next frame in the row
            currentFrame_Hit.X++;

            // If reached end of the row advance to the next row, reset to the first frame
            if (currentFrame_Hit.X >= sheetSize_Hit.X)
            {
                currentFrame_Hit.X = 0;
                currentFrame_Hit.Y++;
            }

            // If reached last row in the frame sheet, jump to the first row again
            if (currentFrame_Hit.Y >= sheetSize_Hit.Y)
                currentFrame_Hit.Y = 0;

            // Reset time interval for next frame
            nextFrame_Hit = TimeSpan.Zero;
        }
        else
        {
            // Wait for the next frame
            nextFrame_Hit += gameTime.ElapsedGameTime;
        }
    }

sentences:
HTML Multiplayer and Hiding Information I'm in the process of conceiving a multiplayer web-based game of sorts and was looking into different ways of achieving this. Instead of using PHP/MySQL/AJAX like I'm used to, a lot of sites are recommending the use of WebSockets of some kind.

My big question is, how do WebSocket games hide their information from potential hackers? It seems like anyone could hit "view source" on a page and find out everything they need to know due to it being written in Javascript, which to my knowledge is sent with the page. Is it possible to make a server desktop application that isn't hosted along with the website? If so, what languages have support for it?

sentences:
Should ammo limitations be controlled by the game class or the weapon class? I have a simple shooter game with a GameLevel class and a Shooter class. The shooter has a set amount of ammo, and every time the shoot() function is called, the ammo variable in the shooter decreases.
My question is about when the shooter runs out of ammo. Should the shoot() function be keeping track of ammo and simply stop shooting when ammo is 0, or should the GameLevel class call some sort of canShoot() function and have complete control over whether the weapon shoots or not?
This also applies to for example movement limitations i.e. if (in a simple 2D game) the shooter hits a wall, should the shooter itself prevent any movement or should the GameLevel class check for this first?

sentences:
How do you fix wobbling shadow edges? I've implemented an omni-directional shadow map and I've noticed a rather unwanted behaviour on the shadows. It seems like when the angle between the occluded points and the light source is really steap, then the egde of the shadow starts to wobble. It's almost looks like it's pulsating.

Could it have something to do with when the light source moves further away from the occluded polygons, the pixels next to each other are further away from each other than the corresponding texels on the shadow map face that I sample from which result in some sort of magnification side-effect when performing aliasing? This is just a really wild guess!

Is anyone familiar with this type of behaviour and/or have any solution to it?

Thank you!

sentences: High quality graphics but low apk size - How? So I have been playing this app that has so many high quality graphics with some 3d models and tons of levels and it is only 70mb in size.My app that has only 2 pictures is about 20 mb in size lol..Why?

sentences:
Problem with .hdr/.pic format So, everything was clear from the specification point of view, but when I moved to reading through some of the original implementations and reimplementations, I ran into this:

f = ldexp(1.0,rgbe[3]-(int)(128+8));

This piece calculates the signed exponent (<128 are, by specification, defined to be negative) and applies it to 2.0f. Why does he add 8 after the fact? And why doesn't he just write 136? That's biasing the encoded exponent information in favor of the smaller values, right? But why? All the values I load with this seem to be in a really cramped floating point space [I'm not even sure anything uses the space above 1.0f]. I understand the ratios remain consistent, but I kind of prefer to rely on original measured radiances.

http://www.graphics.cornell.edu/~bjw/rgbe.html — The code here states that is the standard way to decode "real pixels", which has no basis in the specification and no rationale offered.

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:
Unity ads displaying only unity products i just implemented unity ads on my project and now its only showing a single unity product each times. Can anyone suggest why? Thanks..

Here is some screenshot of the ad
1:
(https://i.stack.imgur.com/oG9vm.jpg)
2:
(https://i.stack.imgur.com/ZrS7x.jpg)

Can anyone tell me if this is even a real ad or just for testing?

sentences:
For my first 3D engine, should I go for one that is already made, or minimalistic? I've been meaning to transition from 2D games to 3D games for some time, now. I have the most experience with RTS games, so I will be doing that.

On one hand, there's a lightweight renderer; Irrlicht. However, considering it's a renderer and not a game engine (only basic collision, etc..) , I would have to write most of the things, myself.

On the other hand, there's a full blown engine like CryEngine 3, for example. Although it is mostly complete, I would first need to understand the various parts of the engine and it's implementation enough to be able to try and transform it into an RTS engine.

My question is, which would be easier for me to transition to?

sentences:
Clearing an SFML scene with a partially transparent color Is there way to clear a scene with a transparency (alpha) value, in pure SFML?

I'm trying to clear with rgba(0,0,0,128) so the previous frame still partially shows through, which would create a motion blur effect.

I tried window->clear(Color(0,0,0,128)); but with no result

sentences:
Design patterns for live coding/script reloading I would like to make C++/Lua combo and write scripts for a game with live script reloading. What design patterns should I be aware of so not to cause me unnecessary pain?

For example if I have a simple MUD game with enemies and maps, I can bind a Lua function which would remove all the enemies and recreate them based on the data(which I would modify with Lua script).

That sounds easy, but haven't done so I think there may be some deadends without proper planning.

What are the best design patterns and solutions for live script reloading?

sentences:
How to sample from six cubemap images for a skybox in Shader Graph? I'm trying to update a skybox shader to URP and reimplement it in Shader Graph.  The shader code itself is pretty straightforward, but I don't know enough about Shader Graph yet to set up the basic skybox.

It's a standard cubemap skybox made up of six textures for +x, -x, +y, -y, +z, and +z.

Trying to Google different variants of "unity shader graph cubemap skybox" turns up tons of noise and nothing actually useful that I can see.

Does anyone know what the basic node setup is I would need to input six images and output a skybox?

sentences:
Why the main menu is not working on the second time when pressing on escape key to back to the main menu? I have two scenes. Main Menu and the main scene.
The game start when only the main menu is loading.

When I click on the New Game button it's loading the main scene and removing the main menu scene.

If I click now on the Escape key it will remove the main scene and load back the main menu scene but this time I can't click on any of the buttons in the main menu.

I'm not sure if this is the right way to switch between the scenes but it's not working good.

On the Newgame button I created and attached a new script. And then in the OnClick event of the button I'm calling the method LoadByIndex:

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

public class LoadSceneOnClick : MonoBehaviour
{
    public void LoadByIndex(int sceneIndex)
    {
        SceneManager.LoadScene(sceneIndex);
    }
}

On the main scene I added a empty gameobject and attached to it another script:

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

public class BackToMainMenu : MonoBehaviour
{
    public int sceneIndex;

    // Update is called once per frame
    void Update ()
    {
        if (Input.GetKeyDown(KeyCode.Escape))
        {
            UnityEngine.SceneManagement.SceneManager.LoadScene(sceneIndex);
        }
    }
}

When the game start in the main menu when clicking on New Game button it's loading index 1 the main scene and removing the main menu.

When clicking on escape key it's loading index 0 and removing the main scene.
But then the main menu is not working.

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 do I communicate with an IronPython component in a C#/XNA game? My XNA game is component-oriented, and has various components for position, physics representation, rendering, etc, all of which extend a base Component class. The player and enemies also have controllers which are currently defined in C#. I'd like to turn them into Python scripts via IronPython (a .NET implementation of Python). My problem is that I'm not sure how to interact with those scripts.

The examples in Embedding IronPython in a C# Application suggest I'd have to create something like a Script component which compiles a Python script and calls the controller's Update method via Python - essentially, it'd be a wrapper class for C# to interface with Python.

I feel that I'm missing something in my research. There must be a way to load up a script, instantiate a Python object (either in the Python script or in C#) and then then have a direct reference to that Python object in my C# code.

Is there a way to work with an IronPython object directly, or is a wrapper required?

sentences:
How does the Unity coordinate system map to screen pixels? If I have a GameObject, say at x = 0, y = 0, and I want to move
it for a 40 pixel to x how can I make that?

In don't understand which is the unit of measurement in Unity.

If I make something like this where mov is 40 the sprite goes out of screen!

void Start()
{
    transform.Translate(new Vector3(mov, 0, 0));
}

it seems like the correct values must be very low, say 0.6, 1, 3, etc.

But why?

sentences:
How to track position on a map vs position on screen with XNA 4.0? I'm working on my first XNA 2D game (overhead view), and I'm pondering how to manage the difference in position on screen vs. the position of a sprite on a global map.

The solution I'm currently thinking about is having the map keep track of everything on it, the player, other sprites, etc. The sprites will know where they are on the map, and when .Draw() is called on the map it will delegate drawing items to the items themselves, but pass a position to draw on the screen. For instance, something akin to the following:

class Map {
    Vector2D ScreenCenter;
    List<DrawableItem> Content;

    void Draw(GameTime gameTime) {
        foreach (var i in Content) {
            i.Draw(spriteBatch, i.Position - ScreenCenter);
        }
    }
}

class DrawableItem {
    Vector2D Position;

    void Draw(SpriteBatch spriteBatch, Vector2D screenPosition) {
        // Draw ourselves at screenPosition
    }
}

Is there some better way of doing this? Or am I on the right sort of track here?

sentences:
How do I render an object's position trail of a constant length? I want to show a trail of the last points that the object has been in, but I want that trail to always be a certain length, regardless of the object's speed. How can I do that?

At the moment, I have an array of 100 points. When it gets full, I overwrite the oldest one.

However, if the object is staying still (or moves slowly), the old points are overwritten and the trail becomes shorter. I want the the trail to always be 100 pixels total length.

sentences:
Calculate Orbit Path/Ellipse given mass, velocity, and distance (2body) Calculate and draw the path of an orbit in a 2 body problem given the mass, current velocity, and distance of both bodies?

We're working in Unity and will be using the default rigidbody.mass to start while we craft a deterministic and event driven gravitational orbit calculation system.

We've got a lot of this done but need to know if anyone here speaking from experience can suggest the most optimal and the most accurate route for going about this.

Okay, so here's the intended system.

Objects have a collider-trigger sphere which represents their sphere of gravitational influence. When objects enter an SOI, they begin to be effected by that object's gravity. This represents an "encounter" event and this is where we grab initial values to determine the trajectory the object will take with those initial parameters. It will take this path as long as nothing changes. We only worry about "significant bodies" such as planets and large asteroids. We're not giving every ship an SOI but we do give them mass values so we can properly perform consistent calculations.
When a "path change event" occurs, the system will recalculate when the event is over and new velocities are established. This prevents the system from constantly calculating the force on objects every physics step and greatly reduces the overhead of the system.
The system has a way to "snapshot" everything for saves. positions, velocities, and paths. Basically from what I understand, we'd be getting arrays of velocities that we lerp between based on an array of position vectors. I was talking about how the system would to the motion, there.

So, instead of using Unity's built-in physics and forces, we bypass that for a much more efficient and customizable system. Instead of applying constant force to effect the positions of objects, we calculate the path ahead of time and assume the object will follow that path until something changes.

sentences:
Chess engine stock fish process for mobile I am making the chess interface I designed for a game. I am using the process to get answers from a stock fish binary:

stockfish = new Process {
                StartInfo = new ProcessStartInfo {
                    FileName = System.IO.Directory.GetCurrentDirectory () + "\\Assets\\Scripts\\Stockfish\\stockfish.exe",
                    Arguments = "",
                    UseShellExecute = false,
                    RedirectStandardOutput = true,
                    RedirectStandardInput = true,
                    RedirectStandardError = true,
                    CreateNoWindow = true
                }

            };

The problem I face is it worked for my Windows build but for mobile package build it won't work with the executable. Is there a way around it?

sentences:
Problems when randomizing x and y position of a picturebox So, I'm making a simple game. It's like snake but the picturebox doesn't grow. In the game, you have to get fruits and other objects.
Look at berry's code:

public class Berry : PictureBox
{
    public bool ON_SCREEN;
    public Berry()
    {
        this.BackColor = Color.White;
        this.Size = new Size(20, 20);
    }
}

And then I randomize it on a form. Like this:

public void Generator_Berry()
    {
        Berry b = new Berry();
        Random randomY = new Random();
        int rY = randomY.Next(10, 270);
        Random randomX = new Random();
        int rX = randomX.Next(10, 270);
        this.Controls.Add(b);
        b.BringToFront();
        b.Location = new Point(rX, rY);
        b.ON_SCREEN = true;
    }

So the problem is that Berry's X position is the same as Y or vice-versa. I've never got a problem like this.(It look very simple, but I can't get the solution) What is wrong?!
Am I that very stupid?!

sentences:
2D graphics - why use spritesheets? I have seen many examples of how to render sprites from a spritesheet but I havent grasped why it is the most common way of dealing with sprites in 2d games.

I have started out with 2d sprite rendering in the few demo applications I've made by dealing with each animation frame for any given sprite type as its own texture - and this collection of textures is stored in a dictionary. This seems to work for me, and suits my workflow pretty well, as I tend to make my animations as gif/mng files and then extract the frames to individual pngs.

Is there a noticeable performance advantage to rendering from a single sheet rather than from individual textures? With modern hardware that is capable of drawing millions of polygons to the screen a hundred times a second, does it even matter for my 2d games which just deal with a few dozen 50x100px rectangles?

The implementation details of loading a texture into graphics memory and displaying it in XNA seems pretty abstracted. All I know is that textures are bound to the graphics device when they are loaded, then during the game loop, the textures get rendered in batches. So it's not clear to me whether my choice affects performance.

I suspect that there are some very good reasons most 2d game developers seem to be using them, I just don't understand why.

sentences:
Unity 5 - Input Field - How to confirm password entry with ENTER only and not a click/loss of focus I have an input field password box, currently the password is 'submitted' either by clicking Enter or by clicking elsewhere on the screen.
This seems to be the designed way, as it states this in the documentation (https://docs.unity3d.com/Manual/script-InputField.html) -

"A UnityEvent that is invoked when the user finishes editing the text content either by submitting or by clicking somewhere that removes the focus from the Input Field."

As I have other buttons on the same screen that users can click on, I would like it so mouse clicks are not counted as an invoke.

Is this possible?

Many thanks in advance

sentences:
Diversified Game Object List Recently I started creating a game in java to hone my rusty java (I work primarily with cpp) and because I thought it to be a neat idea. To better illustrate the problem, let me explain a part of the game. The details aside, the game is in essence a dungeon builder and the problem pertains to the blocks you place down to create the maze adventurers have to travel through. Each block is a corridor and on each wall/floor/ceiling of a block you can place objects such as traps etc. However, while finishing up the game engine I realized I still lacked a list for blocks/objects that are special. Blocks or items that need a special animation (some extend spikes, some shoot fire, some contain a chest with inventory, etc). They're hard to bring together in one class and as we all know they can't be together in one list with different classes unless we want code-bloating. So my question is, what is the most efficient way to make collection of diversified game objects and how do other games do it?

Presently I have the following methods thought out.

I reduce all objects to instances of one class. They all fit in one list. However, to induce special methods I need a long list of methods that each do something else. Frankly, this method is inefficient, unpleasant and unpractical to work with.
I reduce all object to instances of one class. They all fit in one list. However, they each have an ID of a special action. If the need arises the ID gets compared with another list that's much shorter in length and uses generics or reflection to store the different effect. If it needs a special action it simply activates the effect (such as fire plume) on the given vector. The problem with this is that it does not allow for direct manipulation of the object such as a block that moves out to squash adventurers. Or if it could, it would be messy code, unnecessary throughput of code etc. I'd rather avoid it.
I make a list of the base class/interface and add the different child classes to it. Each child class can thus have a different implementation. However, to access it, I need to know to use reflection and for that I need to know the initial class, which, in many cases, I don't since I want a dynamic system. The result is that I need to store the child class name in the 'block' parent class and then when the need arises, use that name to reflect the new class. Once again, it is inefficient and far too slow.
I create a list of the block class and access it every time a generic block needs to be checked. However, if a creature/person walks over a tile it checks if the child class name in the block class is empty. If not, convert it to that class and execute the special function. This seems the best option as it gives the least code-bloating, is the most efficient, etc. However, it still needs to reflect and convert every time a creature goes onto a special block.
I create an event driven list in which each block instance has his own special event that links to a certain animation. This is very tedious, very inefficient and because it is so detached it is once again difficult to animate the basic block.
I use generics. Sadly, this causes far too much code-bloating and the accessing of the classes themselves gets difficult and messy.
I create a huge switch method and each block instance has a number. The number corresponds with the correct animation in the switch it needs to execute. I don't think I need to say why I don't want to do this.

And there are a few more, but each of them is still as inefficient as the next. Furthermore, every time I look around this site or another people say "use a base interface/class in a list" however they never say what the most efficient way is to get the class out of the list again. Am I missing something obvious? How should I tackle this?

sentences: Best mobile games resolution ratio What is the best landscape and portrait resolution ratios that will fit the most of the devices out there and the black bars size will be minimum?

sentences:
Discrete line inside a 3D matrix First of all a little premise: I'm following this tutorial on YouTube for procedural 2d cave generation in unity using cellular automata and I'm extending it in order to make caves in all three dimensions. With this approach, caves are based on a 3d matrix where if a cell value is 1 it is a wall and if 0 it is an empty space.
The "rooms" created, after being logically connected, need to be "physically" connected by making a path of zeros in the 3d matrix and the tutorial explains how to do this in 2d.

Can you, please, suggest me the approach on how to draw a discrete line (of zeros in this case), in a 3d matrix, that goes from point A to point B?

I'll attach a screen of a map example where rooms are drawn with cubes and red lines are the logical connections.

sentences:
CreateShaderResourceView fails because of plane slice I'm trying to write a wrapper for the CreateShaderResourceView method inside my Texture class, which shouldn't be any problem at all since everything was working fine outside the class. But the debug layer reports an error when assertion is called at the creation of the pipeline state:

D3D12 ERROR: ID3D12Device::CreateShaderResourceView: The PlaneSlice -858993460 is invalid when the resource format is B8G8R8A8_UNORM and the view format is B8G8R8A8_UNORM.  Only Plane Slice 0 is valid when creating a view on a non-planar format. [ STATE_CREATION ERROR #344: CREATEUNORDEREDACCESSVIEW_INVALIDPLANESLICE]
D3D12 ERROR: ID3D12Device::CreateShaderResourceView: The Dimensions of the View are invalid due to at least one of the following conditions. MostDetailedMip (value = -858993460) must be between 0 and MipLevels-1 of the Texture Resource, 0, inclusively. With the current MostDetailedMip, MipLevels (value = 1) must be between 1 and 0, inclusively, or -1 to default to all mips from MostDetailedMip, in order that the View fit on the Texture. [ STATE_CREATION ERROR #31: CREATESHADERRESOURCEVIEW_INVALIDDIMENSIONS]
D3D12: Removing Device.

The wrapper function is simple and operates on a map:

void Texture::CreateSRVFromTexture(const Textures::ID & id, CD3DX12_CPU_DESCRIPTOR_HANDLE & cpuHandle)
{
    auto found = m_textures.find(id);

    //Create SRV with the CPU handle
    D3D12_SHADER_RESOURCE_VIEW_DESC srvDesc;
    srvDesc.Shader4ComponentMapping = D3D12_DEFAULT_SHADER_4_COMPONENT_MAPPING;
    srvDesc.Format = found->second.textureDesc.Format;
    srvDesc.ViewDimension = D3D12_SRV_DIMENSION_TEXTURE2D;
    srvDesc.Texture2D.MipLevels = 1;
    m_device->CreateShaderResourceView(found->second.textureBuffer, &srvDesc, cpuHandle);
}

And calling this function looks like this:

CD3DX12_CPU_DESCRIPTOR_HANDLE srvHandle1(m_textureDescriptorHeap->GetCPUDescriptorHandleForHeapStart(), 0,
        m_device->GetDescriptorHandleIncrementSize(D3D12_DESCRIPTOR_HEAP_TYPE_CBV_SRV_UAV));
m_texture->CreateSRVFromTexture(Textures::ID::Fatboy, srvHandle1);

Now I don't understand why it worked perfectly fine before (no errors reported) when I didn't have the wrapper method and simply accessed the texture with a Get method. What could be the cause of this, since the error message is a bit vague and doesn't help very much?

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:
Unintended window opening when pressing Unity's "Submit" button I've been working on a top down 2D game for a while now, and yesterday I found a strange bug that I just can't explain to myself whatsoever. I have a loot window for looting enemies, as well as a character panel to equip gear/see stats. I realized that after I open and close a loot window, if I press the space button (used for attacking, not for opening any windows) while holding A/LeftArrow or W/UpArrow it opens the character panel. Once this happens, I can press space to open/close the character panel.

Went to the character panels OpenClose() function (all it does is set the canvas group alpha to 0 and block raycast to false and vice versa) which is being called unintentionally, put a debug.log inside to verify if it really was being called, and yes, it is. I look up all references to see where I used it, but I only use it in a single place in the project that is behind an if-statement looking for they keycode C (NOT space). I added a debug.log for the Input.inputstring to see if somehow a magic C button press is ending up in that function, but no. If I press C to open the window, the debug log pops up, if I press space, the inputstring appears to be empty, so the if statement to get to the only place in the code referencing that function cannot be met. Removed the space button from my Player entirely, the behaviour still persists.

Added another debug.log with stackTrace.GetFrame(1).GetMethod().Name to show who is actually running this function, but it turns out that if I run it and press C, it says it's being opened by the update function in the UIManager (as expected). If I run it the strange, unintended way, it says it is being run by the EventSystems Invoke function. Coupled with the fact that the behaviour persists despite the space button being removed from the player, I realized that it's Unity's built in "Submit" button being pressed.

Strange behaviour:

It appears to call the submit function on the OpenClose button for the character panel, but only under the circumstance that I closed a loot window and haven't clicked the mouse anywhere yet afterwards. If I deactivate the button that holds the character panels OpenClose function, the behaviour stops. The button shouldn't be pressed though, because it is on a canvas group with alpha 0/block raycast=false, just like all the other buttons with the identical function that work fine. The loot window has no idea about the character panel either, and all the windows are properly wired to their own OpenClose function.
Upon further inspection, the window only starts showing up if, after closing a loot window, i press A/LeftArrow+Space or W/UpArrow+Space. This is getting more and more confusing for me.

So basically my issue is; how do I figure out why this function is being called? It feels as if closing the loot window somehow "caches" the OpenClose button for the character panel onto the submit button, but only until I click elsewhere on the screen. Did you guys have any experience with a similar situation? Could you share some pointers on how to debug this? What is the "submit" button usually used for, and what would make it only work in combination with the left/top directional buttons?  I've spent about 4 hours on this now and don't know how to get any further.

sentences:
Would this 2D Lighting and Shadows implementation work? I'm writing a top-down 2D tile-based game and I'm trying to decide on how to implement lighting and shadows. The game will have a large number of light sources, some static and some moving around the game world. However each light will only have a radius of a few tiles so I don't expect a large number of lights to affect the same pixel. Also, ideally, I'd like to be using normal-mapped sprites combined with the direction of lighting to give some depth to the lighting in the game.

My current plan is to render the whole screen to an off-screen buffer without lighting applied (diffuse) and at the same time rendering the UV normal maps to a similar offscreen buffer, much like in this excellent post from Wholehog Games.

At the same time, I plan to calculate and store the geometry of areas that are to be lit by each light as a triangle-fan mesh, similar to this truly excellent post on 2D shadows by Amit Patel (Red Blob Games).

Given this set of light geometry and the diffuse and normal maps to work from, I believe I should then be able to draw the final scene to the screen, first just as the diffuse drawn with low ambient lighting, then blended with each light source using its geometry of which areas to affect and shaded using UV/bump mapping for that light source. This will end up rendering the light's geometry for each visible light to only the area it affects.

Does this seem like a valid approach to 2D lighting that's going to be performant enough with a lot of lights on screen? As a relatively inexperienced graphics programmer, I don't want to set off down this route without at least sanity-checking it with the community :)

Although I'm trying to keep this question platform-agnostic, I'm using Java/LibGDX/OpenGL on modern desktops only (so I'm not accounting for less powerful tablets and mobiles).

sentences:
Projecting texture from an arbitrary position I'm trying to write a surface shader (not a projector) to project a texture to a surface in a very similar way of what projectors do.

Currently I can easily obtain a shader that uses screenspace as UV:

        float2 screenUV = IN.screenPos.xy / IN.screenPos.w;

What I'm trying to achieve is to have an arbitrary plane to project the texture over the mesh that uses the shader.

I'm checking some resource online like https://en.wikibooks.org/wiki/Cg_Programming/Unity/Cookies but this is strongly related to light space.

My main doubt is how can I generate the UV coordinates from another plane? should I define somehow plane sizes or is it enough to define its position?

sentences:
Why are my sprite outlines partially rendering in the wrong place? I've been trying to draw an outline around a sprite using the code from this answer.

Details

My sprite is called Ship2Sprite.

This is how I create the rectangle:

 rectangle = New Rectangle(backgroundPos.X + NPCAI.enemyPosistion.X,
                           backgroundPos.Y + NPCAI.enemyPosistion.Y,
                           Ship2Sprite.Width, Ship2Sprite.Height)

This is how it looks without any rectangle drawn:

If I use this line of code

hudSpriteBatch.Draw(t, rectangle, New Rectangle(0, 0, 0, 0), Color.Red,
                    NPCAI.enemyAngle, New Vector2(0, 0), SpriteEffects.None, 0)

the following is the result in game

hudSpriteBatch.Draw(t, New Rectangle(rectangle.Left, rectangle.Top, 2, rectangle.Height), New Rectangle(0, 0, 0, 0), Color.White, NPCAI.enemyAngle, New Vector2(0, 0), SpriteEffects.None, 0)
hudSpriteBatch.Draw(t, New Rectangle(rectangle.Right, rectangle.Top, 2, rectangle.Width), New Rectangle(0, 0, 0, 0), Color.White, NPCAI.enemyAngle, New Vector2(0, 0), SpriteEffects.None, 0)
hudSpriteBatch.Draw(t, New Rectangle(rectangle.Left, rectangle.Top, rectangle.Width, 2), New Rectangle(0, 0, 0, 0), Color.White, NPCAI.enemyAngle, New Vector2(0, 0), SpriteEffects.None, 0)
hudSpriteBatch.Draw(t, New Rectangle(rectangle.Left, rectangle.Bottom, rectangle.Width, 2), New Rectangle(0, 0, 0, 0), Color.White, NPCAI.enemyAngle, New Vector2(0, 0), SpriteEffects.None, 0)

However, when trying to use the code from the linked answer, this is the result:

The first and third lines produce the correct lines, however the other 2 are in the correct orientation but not the correct position

Am I missing something somewhere?

EDIT

Based on Blau's answer, I have updated my code to this:

 Public Shared Sub DrawOutline(ByVal t As Texture2D, ByVal sprite As Texture2D, ByVal pos As Vector2, ByVal graphics As GraphicsDevice)

    Dim spriteBatch1 As New SpriteBatch(graphics)
    Dim rectangle As New Rectangle(Game.backgroundPos.X + pos.X, Game.backgroundPos.Y + pos.Y, sprite.Width, sprite.Height)
    Dim w = rectangle.Width
    Dim h = rectangle.Height
    Dim x = rectangle.X + w / 2
    Dim y = rectangle.Y + h / 2
    Dim transform As Matrix = Matrix.CreateRotationZ(NPCAI.enemyAngle) * Matrix.CreateTranslation(x, y, 0)

    spriteBatch1.Begin(SpriteSortMode.Deferred, BlendState.NonPremultiplied, Nothing, Nothing, Nothing, Nothing, transform)
    x = -w / 2
    y = -h / 2

    spriteBatch1.Draw(t, New Rectangle(x, y, w, 2), Nothing, Color.White)
    spriteBatch1.Draw(t, New Rectangle(x, y + h - 2, w, 2), Nothing, Color.White)
    spriteBatch1.Draw(t, New Rectangle(x, y, 2, h), Nothing, Color.White)
    spriteBatch1.Draw(t, New Rectangle(x + w - 2, y, 2, h), Nothing, Color.White)
    spriteBatch1.End()

End Sub

However the rectangle is rendering in the wrong position, which is slightly ahead of the sprite. Like this

EDIT 2, with the following code

 Public Shared Sub DrawOutline(ByVal t As Texture2D, ByVal sprite As Texture2D, ByVal pos As Vector2, ByVal graphics As GraphicsDevice, ByVal angle As Single)

    Dim spriteBatch1 = New SpriteBatch(graphics)
    Dim rectangle As New Rectangle(Game.backgroundPos.X + pos.X, Game.backgroundPos.Y + pos.Y, sprite.Width, sprite.Height)
    Dim w = rectangle.Width
    Dim h = rectangle.Height
    Dim x = rectangle.X + w / 128
    Dim y = rectangle.Y + h / 128

    Dim transform As Matrix = Matrix.CreateRotationZ(angle) * Matrix.CreateTranslation(x, y, 0)

    spriteBatch1.Begin(SpriteSortMode.Deferred, BlendState.NonPremultiplied, Nothing, Nothing, Nothing, Nothing, transform)
    x = -w / 128
    y = -h / 128
    ' spriteBatch1.Draw(t, rectangle, Color.Red)
    spriteBatch1.Draw(t, New Rectangle(x, y, w, 2), Nothing, Color.White)
    spriteBatch1.Draw(t, New Rectangle(x, y + h - 2, w, 2), Nothing, Color.White)
    spriteBatch1.Draw(t, New Rectangle(x, y, 2, h), Nothing, Color.White)
    spriteBatch1.Draw(t, New Rectangle(x + w - 2, y, 2, h), Nothing, Color.White)
    spriteBatch1.End()

End Sub

sentences:
How do I fix this unintentional chromatic aberration on a lightmap? Some strange rainbow halos (front and left) appear after computation of a lightmap for direct light. The formula is
dot * dot2 / ( dist * dist ) * dl->intensity

with gamma correction, lightmap is computed as vec3_t and ultimately cropped to 3 bytes. However, brightness of the region in question fit into 255 nicely, and even calculating in byte instead of float beforehand - result in just a subtle "oil painting" effect and does not produce such artifact across entire image.
My best guess is how this artifact appear from base change in a floating point math, but I don't know for sure nor do I understand what exactly is happening.

sentences:
Generating a grid (Array) of Tetris Pieces What I want to do is quite self explanatory. Just like the title states. I want to code something that will generate a grid which contains is filled of Tetris pieces.
However some conditions must be met :

Having no empty holes for the final grid (all sections of the grid filled)
Having no blocks sticking out (e.g. a long tetris block sticking out of the square grid)

I have tried to approach the problem using my way since the methods used online are too complicated for me.
The first idea I had was to use a 2D array which each row will be gone through to have some generation algorithm. The next row will depend on the previous row. Such as making a 2x2 block. It will check if the current row position is empty, if it is then it will check if the previous row is empty. If it is then it will make keep note that this point is being used. But if the previous block is already been used. It will check what kind of block it is and depending on what information is on that position. It will either be a connecting piece of just a blank piece.

The second idea i have in mind is similar to the first idea.
That is, it will also go through each row but this way is dependent on maths.
Lets say we have a 10x10 grid. We can say each row is made of 10 blocks. And from that we can say each tetris shape is made of miniblocks. E.g the 2x2 block is made of 2x2 small blocks.
So from this we can, go through the first row and for the first 2 blocks of the 10 keep note in the array that we want to generate the a 2x2 tetris block. And we can go to the next row and we know that the previous row there was a 2x2 tetris block that is need to be finished creating in the second row. And so we repeat this to try and get a filled grid of tetris blocks.

Sorry I am not good at explaining/implementating/reading code. Sorry for the inconvenience.
I have been suggested by some people to look at Tetris AI. And maybe use the AI to solve my problem. But I'm not good with reading other people's code. Plus it isn't in the language i understand. And i dont have anyone to go through the code with me.
 So i prefer to use my own idea since i know what is going on. But i don't know how to implement the code.

If there is anyone who could help me in any way it would be my honor.
Thank you in advance.

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:
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 do games such as aa Game have high levels in the structure of their code How do games such as aa Game have high levels in the structure of their code? I mean if we want create a game with high levels, should we create and use a class for each level? I do not want code from you. only I want know for creating a game with high levels in android, What we should do in coding? Is it good if we create and use a class for each level?

sentences:
Questions related to rendering to texture and rendering to buffer (OpenGL) I am experimenting with off-screen rendering. I understand there is two solutions to this:

rendering to texture (you attach a texture to one of the FBO's attachment point which can be a color, depth, etc.)
use a render buffer.

Question 1

I first experimented with using render-buffers. I have a FBO and 2 RBOs, one for color (attached to COLOR0) and one for depth (attached to DEPTH). When I want to visualise the content of what I rendered to the render buffer, I use the glBlitFramebuffer function to copy the content from the FBO to the Window frame buffer (index 0).

glBindFramebuffer(GL_READ_FRAMEBUFFER, fboId);
glBindFramebuffer(GL_DRAW_FRAMEBUFFER, 0);
glBlitFramebuffer(0, 0, width, height, 0, 0, width, height, GL_COLOR_BUFFER_BIT, GL_LINEAR);

First I would like to know if this the best way? (of passing the image from the a render buffer back to the window buffer).

Question 2

My second question. The method I described above works but I can only see the "color" buffer of the FBO, not the depth buffer (I would also like to visualise the depth buffer). So I was wondering how/if this was possible using this approach? I tried to use the index of the depth render buffer in place of the fboIdx in glBindFramebuffer but it didn't change anything. Can I make it work without using render-to-texture approach?

Question 3

My end goal is to render two images using an off-screen approach and blend them together. The result of the mix between the two rendered images is what I want to display to the screen. To keep things fast, I understand this can be done in hardware. What's the best way for doing this? Can it be done using the render-buffer approach or do I need to go the render-to-texture approach (aka render to two textures and then blend these textures using a fragment shader when I do my final pass in which I render a quad stretched over the surface of the screen?

sentences:
How can I structure in-game menus? I'm working on a multiplayer RPG using only C++ and SDL2. I've already made the main menu and a map editor, and I'm preparing to make the actual game. The main menu and map editor were easy to structure, because they had repetitive visuals and concepts -- map-editing tools can be represented as an enumerated list, just like saved-games and settings -- and so I was able to store them in structured vectors, and then when I went to render everything and check for user actions I could just iterate through the lists and hit every visible menu item. My code for those sections is small and neat; I'm proud of it.

Now, in the game, I'm realizing that my HUD is composed of a rather random assortment of types of things that the player can click on. There's a quick-access area for items, another one for spells, another one for the map, another for NPC-buddy commands, etc, and each of those have totally unique popup menus associated with them. Then there's a menu for crafting, a menu for NPC dialog, and several of the items have their own independent menus for interacting with them.

I'm trying to think of the right way to structure all these lists. Storing them in vectors like I did with the menu and stuff seems like it will land me with an unwieldy and asymmetrical set of nested vectors, and it might be complicated to iterate through it. How do good programmers handle this kind of thing? Should I just make an independent section in code for each in-game menu?

sentences:
Problems Animating Texture in OpenGL I'm trying to animate a texture to scroll a static screen for a television, however I'm having some issues.

Just translating within the texture matrix animates all textures in the scene which is obviously a problem. However when trying to push and pop the matrix the texture matrix seems to keep getting reset. So rather than a scrolling texture, the texture just stays at the same translation.

Here's the code snippet.

glMatrixMode(GL_TEXTURE);

glPushMatrix();

glTranslatef(0, 0.03 * dt, 0);

glBindTexture(GL_TEXTURE_2D, staticTexture);

RepeatTexture();

glBegin(GL_QUADS);
glTexCoord2f(0, 0);
glNormal3f(0, 0, 1);
glVertex3f(0.49, 0.205, 0.461);
glTexCoord2f(0, 1);
glNormal3f(0, 0, 1);
glVertex3f(0.49, 1.204, 0.461);
glTexCoord2f(1, 1);
glNormal3f(0, 0, 1);
glVertex3f(-.80, 1.204, 0.461);
glTexCoord2f(1, 0);
glNormal3f(0, 0, 1);
glVertex3f(-.80, 0.205, 0.461);
glEnd();

glPopMatrix();

glMatrixMode(GL_MODELVIEW);

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:
How can I ensure free graphics are suitable for use in a game? We want to program a small minigame where we need a lot of icons for all kind of things (like in "Alchemy"). We looked through some free vector graphics pages, like http://www.freepik.com/, but they all state some vague instructions where and where-not to use the images.

For example this site writes

For both personal and commercial projects and to modify it.

but on the other hand:

Include FreePik Contents in an online or offline database or file.

Which sounds contradictionary, you need to store it in a file to modify it.

How can we get sure, that images that we use from such sites are really free to use on attribution and we don't get any problems later?

How should the licences look like, so we can be sure to get no problems later,if we use free icons from there?

sentences:
Unity Script and game not syncing after player respawn I have a health system for my player that looks like this:

public int fallBoundary = -10;
public int Health;
public int numOfHearts;

public Image[] hearts;
public Sprite fullHeart;
public Sprite emptyHeart;

void Update() {
    if(Health > numOfHearts) //Health script works, why does heart display not?
    {
        Health = numOfHearts;
    }

    for (int i = 0; i < hearts.Length; i++) {
        if (i < Health) {
            hearts[i].sprite = fullHeart;
        } else {
            hearts[i].sprite = emptyHeart;
        }

        if (i < numOfHearts) {
            hearts[i].enabled = true;
        } else {
            hearts[i].enabled = false;
        }
    }
}

Unfortunately, after respawn, the hearts do not sync anymore. My debugging showed, that the elements of hearts still did their job, resetted and got replaced correctly. However, in my game, nothing changes after the respawn (should reset to full health and change if player gets damaged). For the respawn, I am loading my prefab, which I also checked (everything is there). To avoid confusion: my hearts never reset to 0, but stay at 1.

Player Prefab that loads during respawn

Hearts after respawn

sentences:
How can I send matrix data to shaders without the Effects11 framework? I'm making a Direct3D engine but I'm stuck with this one little problem.

I want to not use effect files but instead use shader files. What can I use to send matrix variables to shaders if I don't use ID3D11XEffectMatrixVariable?

sentences:
Why are my scene's depth values not being written to my DepthStencilView? I'm rendering to a depth map in order to use it as a shader resource view, but when I sample the depth map in my shader, the red component has a value of 1 while all other channels have a value of 0.

The Texture2D I use to create the DepthStencilView is bound with the D3D11_BIND_DEPTH_STENCIL | D3D11_BIND_SHADER_RESOURCE flags, the DepthStencilView has the DXGI_FORMAT_D32_FLOAT format, and the ShaderResourceView's format is D3D11_SRV_DIMENSION_TEXTURE2D.

I'm setting the depth map render target, then i'm drawing my scene, and once that is done, I'm the back buffer render target and depth stencil are set on the output merger, and I'm using the depth map shader resource view as a texture in my shader, but the depth value in the red channel is constantly 1.
I'm not getting any runtime errors from D3D, and no compile time warning or anything.

I'm not sure what I'm missing here at all. I have the impression the depth value is always being set to 1.

I have not set any depth/stencil states, and AFAICT depth writing is enabled by default. The geometry is being rendered correctly so I'm pretty sure depth writing is enabled.

The device is created with the appropriate debug flags;

#if defined(DEBUG) || defined(_DEBUG)
    deviceFlags |= D3D11_CREATE_DEVICE_DEBUG | D3D11_RLDO_DETAIL;
#endif

This is how I create my depth map. I've omitted error checking for the sake of brevity

D3D11_TEXTURE2D_DESC td;

td.Width     = width;
td.Height    = height;
td.MipLevels = 1;
td.ArraySize = 1;
td.Format    = DXGI_FORMAT_R32_TYPELESS;
td.SampleDesc.Count   = 1;
td.SampleDesc.Quality = 0;
td.Usage          = D3D11_USAGE_DEFAULT;
td.BindFlags      = D3D11_BIND_DEPTH_STENCIL | D3D11_BIND_SHADER_RESOURCE;
td.CPUAccessFlags = 0;
td.MiscFlags      = 0;
_device->CreateTexture2D(&texDesc, 0, &this->_depthMap);

D3D11_DEPTH_STENCIL_VIEW_DESC dsvd;
ZeroMemory(&dsvd, sizeof(dsvd));
dsvd.Format = DXGI_FORMAT_D32_FLOAT;
dsvd.ViewDimension = D3D11_DSV_DIMENSION_TEXTURE2D;
dsvd.Texture2D.MipSlice = 0;
_device->CreateDepthStencilView(this->_depthMap, &dsvd, &this->_dmapDSV);

D3D11_SHADER_RESOURCE_VIEW_DESC srvd;
srvd.Format = DXGI_FORMAT_R32_FLOAT;
srvd.ViewDimension = D3D11_SRV_DIMENSION_TEXTURE2D;
srvd.Texture2D.MipLevels = texDesc.MipLevels;
srvd.Texture2D.MostDetailedMip = 0;
_device->CreateShaderResourceView(this->_depthMap, &srvd, &this->_dmapSRV);

sentences:
Using 2D std::vector for map and collision Hello to anyone reading this. I am having trouble on how to use std::vector. From what I know, std::vector is a flexible version of an array and iterator is used to go through each individual element within a vector.

std::vector<std::vector<int>> row;
std::vector<int> column;
//This is equivalent to... (?)
int array[i][j];

So what if I wanted to use a 2D std::vector for a tilemap?

std::vector<std::vector<int>> row;
std::vector<int> column;

for (int i = 0; i < row.size(); ++i) {
    for (int j = 0; j < row[i].size(); ++j) {
    //something with map
    }
}

for (itr = row.begin; != row.end(); ++itr) {
    //something with each block of the map?
}

Sorry if the code is incomplete or wrong. I can't seem to understand the standard format of std::vector and using an iterator.

Thank you to those willing to help.

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:
Converting designs from photoshop/flash/after effects into code I work as part of a two person team, I am the developer and my partner is the designer. We are currently having great difficulty working out the best way to convert his work into the actual app. We prototype all our animation in either Flash or After Effects and then I implement it into the actual application.

The implementation is not a problem, but converting the information is what we are struggling to do efficiently. We have tried making large story boards that show the change in position/scale/rotation and the time for each of these tweens but they are time consuming to make. Currently I am running an After Effects trial and just dissecting the info straight from his design but my trial will run out soon.

Just wondering if anyone can shed some light on how they do it or what is the standard practice in the industry?

Thanks

sentences:
unity2D Top-Dow Mobile rigibody2D im using this code for my 2D TopDown mobile player movement.but when i move player With UI Image buttons player keep moving.it didnt stop.and also player starting of move he is very slow. the he accelerate his speed.how can i fix this.

i add BoxCollider 2D and Rigibody2D my sprite.the set Gravity to 0.

this is my code.

    public class PlayerScript : MonoBehaviour {
public float speed = 150f;
float hInput ;
void FixedUpdate()
{
    Move (hInput);

}

public void Move(float horizontalInput){
    if (horizontalInput.Equals(1)) {
                    rigidbody2D.AddForce (Vector2.right);

    }if (horizontalInput.Equals(2)) {
        rigidbody2D.AddForce (-Vector2.right);
    }if(horizontalInput.Equals(3)) {
        rigidbody2D.AddForce (Vector2.up);
    }
    if(horizontalInput.Equals(4)) {
        rigidbody2D.AddForce (-Vector2.up);
    }
    }

    public void StartMoving(float horizontalInput){
    hInput = horizontalInput;
    }
    }

sentences:
How many and which axes to use for 3D OBB collision with SAT I've been implementing the SAT based on:

Dynamic Collision Detection using Oriented Bounding Boxes [PDF]

On page 7, in the table, it refers the 15 axis to test so we can find a collision, but with just Ax, Ay and Az, I'm already getting collisions.

Why do i need to test all the other cases? Is there any situation where just Ax, Ay and Az are not enough?

sentences:
How should I implement basic spaceship physics? I am new to 2D game development.

I've made several games, but they've made almost no use of physics. Now I want to try making a game that uses some basic physics to look more realistic.

The game involves spaceships battling in space. I'm ignoring gravity. Each spaceship can move up, down, left, right or any of the 4 diagonals.

I want each spaceship to accelerate when moved (up to some threshold speed) and gradually slow to a stop otherwise.

I'm planning to give each spaceship a velocity and acceleration attribute.

The acceleration is set to some constant value. For example, 5.

When the spaceship starts moving, the velocity is set to some initial value. Then every period of time as long as it should be moving (for example every 30 milliseconds), the acceleration value is added to it.

When the user stops moving the ship, the reverse process happens: the acceleration value is decreased from velocity until velocity equals 0.

I have two questions regarding this:

Is this general type of physics realistic and/or common in games? Is this the right direction? Am I forgetting some factor or anything to be considered?
Regarding the specific implementation I'm planning: Is the right way to accelerate is add a constant value to the speed of the object? Or do I need to gradually increase the value added to the speed, thus increasing the acceleration?

sentences:
Model turning 2d when it's parented I'm importing arms from blender for my first person controller but when I make the player the Arms' parent it turns 2d. I have no idea why this is happening so if anyone could help it would be very appreciated.

I'm very confused lol

sentences: Libgdx--how to store every single point drawn using touchdragged? Basically i am trying to detect line collision. The problem is when intersection occurs quickly(touch dragged is done quickly like fling), the collision is not detected. It seems as if 'touch dragged' doesn't store all points.

sentences:
How to place a sprite in the center of the world in Phaser I am very new to Phaser. Here is what I did:

  <!DOCTYPE html>
  <html>
    <body>
    <script src="phaser.js"></script>
    <script>
        var game = new Phaser.Game(500, 500, Phaser.AUTO, '', {
            preload : preload,
            create : create,
            update : update
        });

        function preload() {
            game.load.image('dog', 'assets/dog.png');
        }

        function create() {
            game.stage.backgroundColor = "#1BDCFF";
            game.physics.startSystem(Phaser.Physics.ARCADE);
            game.physics.startSystem(Phaser.Physics.ARCADE);
            dog = game.add.sprite(game.world.centerX, game.world.centerY, 'dog');
            game.physics.arcade.enable(dog);
        }

        function update() {

        }

    </script>
</body>

Shouldn't the dog appear in the center of the "world"?
Here is how it looks like :

I then tried something like this :

var dogImage = game.cache.getImage('dog');
dog = game.add.sprite(game.world.centerX-dogImage.width/2, game.world.centerY-  dogImage.height/2, 'dog');

And now that I edited in this way the create function it does place the dog in the center. Is this the way of doing it or there's a more elegant way ?

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:
Establish a person's genuine interest in game programming I teach on a 3rd level, 4 year games programming degree (B.Sc. in Computer Games Development). We find that new and prospective students often conflate interests and abilities in game-playing, game-design and game-programming. (I know the title could be a a lot more specific or descriptive, but there are internal reason why we can't change it). We do have an open day when prospective students can come and talk to faculty and current students.

This results in a lot of students signing up for our programme who find themselves with interests and/or abilities mis-aligned with their chosen degree. We have options for them to change major, but the are almost just as programming intensive. We don't have any options for students who really wanted to to game related art or design. So some students just stick at it for 4 difficult/unhappy years, as it is the closest degree available to them in gaming.

We outline the content of the programme in our prospectus, but most incoming students have little programming experience, so topics titles like data-structures, software engineering or 3D Graphics don't really mean much to them.

  "I didn't expect so much math in 3D Graphics, I assumed it would be,
  like, drawing..."

Is there any way to help establish a person's genuine interest in game programming, so that they can make a more informed decision about their education?

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:
C# Game Setting message Takes away first character So If you set it to like

  abcdefg

it will come out like

  bcdefg

Here's changing the message

Here's the result

Here's the code

//Set Welcome msg
else if (Type == 6)
{
    if (Character.Network.Stall.isOpened) return;
    short length = Reader.Int16();
    Character.Network.Stall.WelcomeMsg = Reader.Text3();
    Character.Network.Stall.Send(Packet.StallWelcome(Character.Network.Stall.WelcomeMsg));
}

Any help?

sentences:
drawing a horizon / sky in OpenGL ES 2.0 I want to render a sky: My camera is at the origin, and I want there to be a white background for all world coordinates with z < 0 (would normally be considered y > 0, but I have a different coordinate system via glLookAt()).

I thought I may be able to do this in the fragment shader by multiplying the inverse MVP matrix with the corresponding clip space (?) coordinate (I compute that matrix on the CPU each frame by calling Matrix.invertM()). To get my vertices into the fragment shader, I use a varying variable (I wasn't sure if I could access gl_Position in the fragment shader) and passed the position right through; not sure if my syntax is right (see below):

Vertex Shader:

attribute vec4 position;
varying vec4 vp;
void main() {
  gl_Position = position;
  vp = position;
}

Fragment Shader:

precision mediump float;
uniform mat4 inverseMatrix;
varying vec4 vp;
void main() {
  vec4 inversePosition = inverseMatrix * vp;
  if (inversePosition.z > 0.0) {
    gl_FragColor = vec4(0,0,0,1);
  } else {
    gl_FragColor = vec4(1,1,1,1);
  }
}

Question:

Does this approach seem sane? Should I use some other approach that doesn't involve multiplying each fragment coordinate with the inverse MVP matrix?

sentences:
Image splitting / tiling software for Mac I have been programming for a bit and for 2D games and other applications I frequently make large images for the levels / the maps. Before I place these into the games I split the large images down into smaller equally sized squares, but I do this manually in 'the Gimp' and it takes ages sometimes! Is there some software which can do this much quicker for me, where I can select how I want  the image split down etc? And for Mac as well?

Thanks

sentences:
Why is clicking too fast giving me a missingReferenceException in Unity? I made a small method that will quickly give the player a "flashlike" display when a sheep is killed. However clicking too fast will trigger a missingReferenceException. Because it registers the raycast a second time. Is this due to the delay on the DestroyObject() or something else?

private IEnumerator startFlashing(GameObject sheep)
{
    sheep.gameObject.GetComponent<Rigidbody>().freezeRotation = true;
    sheep.gameObject.GetComponent<Rigidbody>().velocity = Vector3.zero;
    sheep.SetActive(false);
    yield return new WaitForSeconds(theTimeBetweenFlashes);
    sheep.SetActive(true);
    DestroyObject(sheep.gameObject, 0.1f);
}

sentences:
What are do's and don'ts on published APK for alpha and beta testing and how to manage it in Google Play for developers? Before the official public release or publishing the first prototype game, I learned about alpha and beta testing in order to gain feedback and fixes needed to improve or correct the game's system. I have some several questions regarding this feature on development feature on Google Play where game developers can publish games:

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

sentences:
Character permanently disappears when camera zooms in I am using ThirdPersonController and FreeLookCameraRig, both from the standard assets package. The camera generally follows the player fine but there is an issue when I move the camera very close to the player. When I do this, the character disappears, though it still behaves as though it is in the scene. For example, the xyz coords still show it as being in the scene and when it jumps, the camera still follows it.

Here's a visual explanation. Notice how the character disappears after about 5-10 seconds and doesn't come back.

(Note: the gif is too large to display here, so please see it on imgur. http://i.imgur.com/PbMDlXD.gifv).

The ThirdPersonController has Transform, Animator, CapsuleCollider, Third Person User Controller, and Third Person Character

The FreeLookCameraRig has Transform, Free Look Cam, and Protect Camera From Wall.

I have tried messing with many of these settings, but nothing has worked.

By the way, some of the course was created in Sketchup.

sentences:
Can an iOS application have an explicit quit button? I've heard a rumor that you cannot have an explicit quit button on your app when it goes to the Apple App Store, can anyone verify this? It seems that most applications do not have one, and there is no explicit quit. How to developers handle quitting in general on iOS applications?

Note: I am using Unity, C#, and Xcode to develop my game for the iPad.

sentences:
Collision for mobile game I'm writing a little game in as3 using Starling, and I need to check collision between 2 boats that can rotate. I don't need the pixel perfect collision, but bounds collision is not enough too. The boat look more or less like this:

I was thinking about create one square on the back of the boat and a triangle on the front, than for each boat, check if the square collide with the other boat square or triangle, and the same for the triangle.

I just don't know how to do that, I don't know if it's possible with the Shape.hitTest, or if it's the best way to do that.

What can I do?

sentences:
Is it possible to tile box colliders without causing "false" collisions in Unity3D? This is in regards to something like a sidescroller where you have a tiled map where each tile uses a 2d box collider.

If you use a 2d circular collider as an example for your character, as it rolls across a series of tiled 2d box colliders, it will occasionally collide with the seams between tiles rather than rolling smoothly across them.

In my scenario here, the tiles are 1x1 units snapped directly adjacent to each other. When rolling a 2d circular collider across a row of tiles, it goes mostly smooth but the more force applied, the greater chance of the circle flying up into the air rather than it's y staying the same as it rolls across them.

The obvious conclusion I had was to use edge colliders instead which works fine, but I'm hoping to find a way to completely eliminate this problem even with just 2d box colliders.

Thanks,
Tim

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:
Blueprint For Switching Between Cameras In The Unreal Engine So basically I have a scene in the Unreal Engine which has multiple cameras within it, the cameras are intentionally static as the application should behave more like a viewing gallery than a game. As the application is intended for mobile devices, the idea is that when a person touches the screen of their device, the rendering switches from the present camera to another one to show a different image. I have attempted to implement this action in the level blueprint with the following blueprint design:

Closer up:

Obviously in the scene there are three camera actors which must be switched between with the first camera viewed through being the 1st CameraActor hence the connection of the EventBeginPlay variable to the Set View Target With Blend variable that the 1st camera actor is connected to. When the Play button is pressed, the scene viewed from the first camera is rendered to the screen as desired however when the left mouse button is clicked equating to touch input on mobile devices, the scene does not switch to the second camera and the question is why?

sentences:
What units is Box2d-AndEngine's velocity measured in? I'm developing a game on AndEngine (with Box2d) and on iOS Sprite Kit simultaneously. I want the game's physics to be identical on both platforms. Sprite Kit uses Box2d internally for physics simulation and I'm using Box2d-AndEngine to use it in AndEngine.

In Sprite Kit, I use physicsBody.velocity.
In AndEngine's Box2d, I use body.SetLinearVelocity(x,y).

In Sprite Kit, a physics body's velocity vector is measured in meters per second.

What is the corresponding unit of SetLinearVelocity in Box2d-AndEngine?

sentences:
Multiplayer network architecture - why do we need to verify local movements? I'm messing around with a 2D game using UDP. I've read some books and articles on the logic of a dedicated server to clients multiplayer game and I can't wrap my head around one thing:

What I've read:
When Client 1 moves, it sends it's input to the SERVER, the SERVER calculates the position, and then sends the new position back to all connected Clients, including Client 1 where the Client 1 player is drawn in the new position. Wouldn't this create a big amount of latency between the local player of Client 1 and their movements?

How I think it should work:
My question is, why not just move the local player based on the movement, and send the new position to the SERVER every time it moves? That what we you press a movement key, it's instant, instead of having to be calculated by the server and sent back and THEN moved.

NOTE: I'm not worried about anti-cheating verification

sentences:
Enemy fire every few seconds Hi I'm trying to get my enemy to fire once every few seconds, I tried using a Coroutine but due to me essentially calling the Coroutine through the update method, the Coroutine is repeating every frame update and spamming the shoot key. What is a solution for this?

void Update () {
        Shoot ();
}

public void Shoot(){

        StartCoroutine ("ShootContinuous");

}

public IEnumerator ShootContinuous() {
    yield return new WaitForSeconds (1);
    anim.SetTrigger("Shoot");
    Instantiate (Bullet, firePoint.position, firePoint.rotation);
    isShooting = true;
    yield return new WaitForSeconds (1);
    anim.SetTrigger("NoShoot");
    isShooting = false;

}

sentences:
How to add multiple floors to a map in a text-based game? I decided to learn how to make games during this quarantine. I am reading Mission Python, a book that teaches how to make games using python and pygame. I'm halfway through it, but the game only has one map.

I'm trying to challenge myself by adding a basement and an upstairs room, but the book doesn't have anything on making multiple floors.

Current code for my map:

###############
##    MAP    ##
###############

MAP_WIDTH = 5
MAP_HEIGHT = 10
MAP_SIZE = MAP_WIDTH * MAP_HEIGHT

GAME_MAP = [ ["Room 0 - where unused objects are kept", 0, 0, False, False] ]

outdoor_rooms = range(1, 26)
for planetsectors in range(1, 26): #rooms 1 to 25 are generated here
    GAME_MAP.append( ["The dusty planet surface", 13, 13, True, True] )

GAME_MAP  += [
        #["Room name", height, width, Top exit?, Right exit?]
        ["The airlock", 13, 5, True, False], # room 26
        ["The engineering lab", 13, 13, False, False], # room 27
        ["Poodle Mission Control", 9, 13, False, True], # room 28
        ["The viewing gallery", 9, 15, False, False], # room 29
        ["The crew's bathroom", 5, 5, False, False], # room 30
        ["The airlock entry bay", 7, 11, True, True], # room 31
        ["Left elbow room", 9, 7, True, False], # room 32
        ["Right elbow room", 7, 13, True, True], # room 33
        ["The science lab", 13, 13, False, True], # room 34
        ["The greenhouse", 13, 13, True, False], # room 35
        [PLAYER_NAME + "'s sleeping quarters", 9, 11, False, False], # room 36
        ["West corridor", 15, 5, True, True], # room 37
        ["The briefing room", 7, 13, False, True], # room 38
        ["The crew's community room", 11, 13, True, False], # room 39
        ["Main Mission Control", 14, 14, False, False], # room 40
        ["The sick bay", 12, 7, True, False], # room 41
        ["West corridor", 9, 7, True, False], # room 42
        ["Utilities control room", 9, 9, False, True], # room 43
        ["Systems engineering bay", 9, 11, False, False], # room 44
        ["Security portal to Mission Control", 7, 7, True, False], # room 45
        [FRIEND1_NAME + "'s sleeping quarters", 9, 11, True, True], # room 46
        [FRIEND2_NAME + "'s sleeping quarters", 9, 11, True, True], # room 47
        ["The pipeworks", 13, 11, True, False], # room 48
        ["The chief scientist's office", 9, 7, True, True], # room 49
        ["The robot workshop", 9, 11, True, False] # room 50
        ]

#simple sanity check on map above to check data entry
assert len(GAME_MAP)-1 == MAP_SIZE, "Map size and GAME_MAP don't match"

sentences:
Applying textures to 3D models I want to apply textures to a 3D Model in XNA 4.

Whatever I saw on the internet was to apply the textures in the modeling tool and then load the model (*.fbx) into XNA.
Is it possible to load the Model into XNA game first and then apply the Texture into its Meshes somehow?

sentences:
Top-Down Octree Generation of Procedural Terrain I'm trying to implement a voxel-based terrain generation  system in Unity3d (C#). I have successfully implemented a uniform 3d grid system, and have extracted the isosurface out using Marching Cubes and Surface Nets algorithms.

I quickly bumped up against the inherent issues in representing all space with a 3d grid. Much of this space was either above or below the surface, and I turned to space partitioning with octrees, as it didn't seem too difficult. One of the great things about octrees is that octree nodes that that don't have edges intersected by the surface don't need to be split again.

I researched, and found a couple resources to construct my code. One is Volume GFX, and another is the original Dual Contouring paper by Ju et al. My edge-checking is done by the Marching Cube's checking from Paul Bourke's code. If the "cubeindex" is either 0 or 255, then no edge is intersected, and the octree node does not need to be split.

My Octree generation code works for something like a quarter-sphere, where the surface features are extremely normal:

As seen in the picture, only octree nodes containing the surface are subdivided. Working great.

Now, however, when we move to something more complex, like Unity3d's PerlinNoise function:

GASP! What's that hole doing in the mesh at the lower-right corner? Upon closer inspection, we see the octree didn't subdivide properly (red lines highlighting the offending node's dimensions):

This turns out to be the same issue Jules Bloomenthal highlights in her paper on polygonization, page 10, Figure 10. Traditional methods at generating top-down octrees ("Adaptive Subdivision"), are sensitive to fine surface features relative to the size of the octree node.

The gist:

X-------X
|       |
|       |  <- Node
X--/\---X     X's - tested values, all outside of the surface!
  /  \  <- surface

The surface breaks the surface, but comes back down before it goes over a vertex. Because we calculate edge intersections by looking at the signs at the two vertices, this does not flag the edge as crossed.

Is there any method to determine if these anomalies exist? Preferably, the solution would work for more than just the Unity3d noise function, but for any 3d noise function (for cliffs/overhangs/floating islands, etc).

UPDATE

Thanks to Jason's awesome answer, I was able to answer my own questions I asked (in the comments under his answer). The issue I had was that I didn't understand how I could create a bounding function for trigonometric functions (sine,cosine,etc) due to their periodic nature.

For these guys, the periodicity is the key to bounds functions. We know that sin/cos reach their extrema values at a set interval, specifically every π/2. So, if the interval we are checking contains any multiple (cos) or half-multiple (sin) than 1/-1 is the certain extrema. If it doesnt contain a multiple (i.e. the interval [0.1,0.2]), then the range is simply the values of the function evaluated at its endpoints.

UPDATE 2:

If the above doesn't make sense, check Jason's answer to my comments.

sentences:
Unity 5.1 audio issues (no sound in back channels) I've trying to bring in surround sound audio into my project. I've set my computer up to run in 5.1 and when I play a 6 channel audio through windows media player (it's a test audio that does left speaker, right speaker etc) it works fine.

However, when I run it through Unity, all I get is the front 3 channels. I've set it in the Edit -> project settings -> audio to be 5.1 in there. I even set it in code with following:

void Start()
{
 AudioSettings.speakerMode = AudioSpeakerMode.Mode5point1;
}
How ever, when I run a debug line of:

print ( AudioSettings.driverCaps);
It tells me that Unity is only playing in stereo. Is there something I'm still not doing?

I should also add I've ran 10 different tests using the 3D audio pan and spread options. I've set both to either being fully off, half way on and full. Still the same results.

sentences:
Null Reference Exception while getting Components I'm trying to access my enemy and spawning values from two different classes into a class that is trying to change them both. Although when I do this I keep getting a Null Reference Exception error. The error is where spawnManager first gets called.

This is the code that is trying to get the two values. (And just to note I am trying to access these two values from my Welcome scene and these two values are in my Game scene but I do not know if this is affecting anything):

private EnemyAI enemy;
private SpawnManager spawnManager;

void Start() {
    spawnManager = GetComponent<SpawnManager>();
    enemy = GetComponent<EnemyAI>();
}

public void onEasy() {
    spawnManager.enemyShipWait = Random.Range(1f, 3f); <-- This line has the error
    spawnManager.randomPowerupWait = Random.Range(7f, 12f);
    enemy.speed = 2.75f;
}

These are the two pictures of my scenes:
Game Scene:

Welcome Scene:

sentences:
Output pixel to different position from pixel shader? Is it possible to output a pixel processed by my pixel shader to a different position?

For example if SV_POSITION of the pixel is 14,26, can I change it to 14,27?

I see there are only two possible output semantics, COLOR and DEPTH, so I am guessing the answer is not directly.

But are there alternative techniques, workarounds for achieving this?

sentences:
How do I slowly decrease a float from 0.5 to 0? I have a 2D racing game with a track, and the track is repeated with vector2. When I die, I want to slowly stop moving the track, but I do not know how.

Here is my code:.

using UnityEngine;
using System.Collections;

public class trackMove : MonoBehaviour
{
    public static trackMove Instance { get; private set; }

    public float speed;
    Vector2 offset;

    // Use this for initialization
    void Start ()
    {
        Instance = this;
    }

    // Update is called once per frame
    void Update ()
    {
        offset = new Vector2(0, Time.time * speed);
        GetComponent<Renderer> ().material.mainTextureOffset = offset;
    }
}

Here is my current Inspector view:

sentences: What should "own" the battle state in combat between the player and NPCs? I have a Map, a Tile, NPCs and the Player. When a player enters a tile in the map, a moveTo event is fired, which calls for any NPCs associated with that tile to be "activated". Those NPCs may be antagonists, and wish to start a battle. The battle state (rounds, initiative, alive/dead, add and removing combatants) seems like it should all belong to the Tile, but that seems too tightly coupled... maybe it should belong to the Map? Thoughts on that?

sentences:
Can't interact with anything in UI canvas, although it was working previously I'm working on a menu with several buttons and input fields. For a while everything was working fine, but suddenly every button and input field is not reacting to being clicked on, as if everything's been disabled.

This problem is only occurring in one of my scenes. My canvas has a graphic raycaster and my buttons have methods attached to them.

sentences:
Unity3D-2D: Setting Time.timeScale to 0 for a certain public prefab until positioned? So I have a button in my game which spawns a "tower" at a given location. The tower, when spawned, acts normally and I can drag it around using my drag script.

I wonder how can I set the Time.timeScale to 0 when I first spawn the tower (only for that prefab) UNTILL I click again to set it's position.

sentences:
LibGDX transparent textures look weird for a brief moment during skeleton animation So I have a stage with some characters (Spine2D Skeletons). Each character has a health bar/stamina bar texture above them. The textures are simple PNGs with some gradient on them and transparency too.

Sometimes, when I set an animation on one of the skeletons in the stage, some of the health/stamina bars textures look like they're color burned or the transparency doesn't work on them while the animation lasts.

I tried setting PremultiplyAlpha to true and to false on the skeleton renderer but it didn't help.

Do you have any idea why this could be?

Edit: Sample before and after images:

sentences:
How to texture voxel terrain without triplanar texturing? How can a voxel terrain (marching cubes) be textured without triplanar mapping ?

The goal being to have more artistic freedom.

I think, I could unwrap the mesh while extracting the isosurface then use projective painting. But I do not know how to handle terrain modifications without breaking the texture. I also guess that virtual texturing could help here.

Links for these matters would be appreciated.

sentences:
Are there any comprehensive resources for learning Google's PlayN framework? How do I learn to use the PlayN framework?

The Getting Started page is not enough. I have been searching for some resources to learn PlayN but am unable to find any.

(P.S.: Does PlayN require GWT?)

sentences:
Unity 5/C#/Scripting Switching Cameras How can I switch cameras from First Person to Third person or from thrid person to first person. Like at GTA V you can switch the cameras. How to do this?

Tnx for your time.

sentences:
Unity3D: Lightmap bleeding in standalone build I'm running into an issue about some lightmap glitches made of black seams lines occuring only in the standalone build of our game, and it does only affect certain scenes.
below is attached a screenshot of both editor and .exe build of the same scene.

I'm also attaching below the current Lighting settings for that current scene, but before, our second UV Channel is not generated inside Unity3D but authored in 3DSMAX :

Now, even if the generated lightmaps are 4096, their texture inspector shows a max size of 2048 and no compression (tried a build with a max size of 4k with no change), i also discovered that Mip Maps are enabled by default (might be the problem ?).

Above all, my build settings are Windows standalone x86, although the game is VR Only wouldn't be better to make it x86_64 only and would it solve this issue ?

Current Unity Version and infos:
 - Unity 5.6.0f3
 - Oculus Utilities 1.14
 - Build settings for windows: Auto graphics API - Static/Dynamic Batching - GPU Skinning - VR supported (Oculus + OpenVR) - MultiPass Stereo Rendering - Optimize Mesh Data enabled.

Mesh import infos:

Mesh compression off - Read/Write enabled - Optimize Mesh Enabled - Normals: Import

i would also state that we had a previous gearVR build (with 2048 resolution lightmaps) and this issue was never encountered

Thank you.

sentences:
where have the shape drawing functions gone in DirectX10? such as the CreateTeapot function - http://msdn.microsoft.com/en-us/library/windows/desktop/bb172798(v=vs.85).aspx

Is there an equivalent in DX10? If so, how do I use it?

In DX9 you..

Declared:

LPD3DXMESH meshTeapot;

Initialised:

D3DXCreateTeapot(device, &meshTeapot, NULL);

Drew:

meshTeapot->DrawSubset(0);

Released:

meshTeapot->Release();

Is there an equivalent set of methods for drawing primitives? (to be honest the sphere is of more interest to me than the teapot!)

sentences:
Reimplemented steering seek behavior from PyGame to LÖVE is much slower than original I'm learning about steering behaviors and watched this nice explanation tutorial - https://www.youtube.com/watch?v=g1jo_qsO5c4&feature=youtu.be with the source code available at https://github.com/kidscancode/gamedev/blob/master/tutorials/examples/steering/part01.py. The example app is written in python and PyGame and behaves like:

The main code parts of it are:

MAX_SPEED = 5
MAX_FORCE = 0.1

def seek(self, target):
    self.desired = (target - self.pos).normalize() * MAX_SPEED
    steer = (self.desired - self.vel)
    if steer.length() > MAX_FORCE:
        steer.scale_to_length(MAX_FORCE)
    return steer

def update(self):
    self.acc = self.seek(pg.mouse.get_pos())
    self.vel += self.acc
    if self.vel.length() > MAX_SPEED:
        self.vel.scale_to_length(MAX_SPEED)
    self.pos += self.vel
    # ...

I tried to reimplement this example in lua with Love2d framework and HUMP vector utility, source code is available at - https://github.com/voronianski-on-games/sandbox/blob/master/src/steering/seek_love2d/main.lua.

The code is pretty similar with the same constant values of MAX_FORCE and MAX_SPEED:

function Mob:new ()
  -- ...
  self.maxVelocity = 5 -- a.k.a MAX_SPEED
  self.maxSeekForce = 0.1 -- a.k.a MAX_FORCE
  -- ...
end

function Mob:seek (target)
  self.desired = (target - self.pos)
  self.desired:normalizeInplace()
  self.desired = self.desired * self.maxVelocity

  local steer = (self.desired - self.vel)

  if steer:len() > self.maxSeekForce then
    steer = steer:trimmed(self.maxSeekForce)
  end

  return steer
end

function Mob:update (dt)
  self.acc = self:seek(vector(love.mouse.getPosition()))
  self.vel = self.vel + self.acc * dt

  if self.vel:len() > self.maxVelocity then
    self.vel = self.vel:trimmed(self.maxVelocity)
  end

  self.pos = self.pos + self.vel * dt
  -- ...
end

But behavior is different. Square is much more slower in lua implementation though the values are the same:

What could be a problem? Or what is the difference that I couldn't notice?

sentences:
How do I change a sprite's color? In my rhythm game, I have a note object which can be of a different color depending on the note chart. I could use a sprite sheet with all the different color variations I use, but I would prefer to parametrize this.
(Each note sprite is made of different shades of a hue. For example a red note has only red, light red and dark red.)

How can I colourise a sprite anew?

I'm working with OpenGL, but any algorithm or math explanation will do. :)

sentences:
Why do I get this warning when using a null conditional operator? In the OnTriggerEnter2D function of my Bullet script, I have the following code:

private void OnTriggerEnter2D(Collider2D other)
{
     if (other.CompareTag("Enemy"))
     {
         var enemy = other.GetComponent<Enemy>();
         enemy?.Death();
     }
}

The reason for the null conditional operator (the question mark) in enemy?.Death() is because the Death function actually destroys the Enemy component script,
so it suppresses an error when the bullet hits the enemy again. It's supposed to be shorthand for:

if (enemy != null)
    enemy.Death();

The code works; the error is suppressed. However, the IDE that I'm using, Jetbeans Rider, gives the following warning:

  '?.' on a type deriving from 'UnityEngine.Object' bypasses the
  lifetime check on the underlying Unity object.

What does that mean exactly? Should I continue using the null conditional operator?

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:
I'm making a networked game for mobile. Should I worry about cheating? I'm in the process of making a racing game for Android/iOS. I'm thinking of implementing a server/client model, should I worry about cheating and make all players communicate with a server of mine, or will I be good by letting one of the players host the game?

I'm not sure how much memory editing or packet editing is possible in Android/iOS, and that's the main reason why I'm asking this.

sentences:
How to always land a square box in 90 degree How can i Always Land a box in 90 degree

Here What i want

Here what i don't want

{
public Rigidbody2D boxRb;
public float jumpSpeed;
 public Vector3 rotation;
public float rotationSpeed;
public bool rotationEnabled;
public float gravityMultiplier;
void FixedUpdate()
{
    if (Input.GetMouseButtonDown(0))
    {
        boxRb.velocity = jumpSpeed * Vector2.up;
    }
    if (rotationEnabled = true)
    {
        transform.Rotate(rotation * rotationSpeed * Time.deltaTime);
    }
    if (Input.GetMouseButtonDown(1))
    {
        boxRb.velocity += Vector2.up * Physics2D.gravity.y * (gravityMultiplier - 1) * Time.deltaTime;
    }

}
void OnCollisionEnter2D(Collision2D collision)
{
    rotationEnabled = false;
    Debug.Log("Collided");
    rotationSpeed = 0f;
    boxRb.constraints = RigidbodyConstraints2D.FreezePositionX;
    transform.Rotate(0, 0, 90f);

}
void OnCollisionStay2D(Collision2D collision)
{
    rotationEnabled = false;
    Debug.Log("In collison");
    rotationSpeed = 0f;
    boxRb.constraints = RigidbodyConstraints2D.FreezePositionX;
}
void OnCollisionExit2D(Collision2D collision)
{
    rotationEnabled = true;
    Debug.Log("Free");
    rotationSpeed = 10f;
}

}

sentences:
How do I create a multiplayer server also suitable for local single-player? I've created a voxel game in C++, OpenGL and SFML, and I want to make it multiplayer.

I'd like to make it similar to Minecraft's client-server model: The single-player is just a client to the hidden server underneath; but can be configured to connect to multiplayer as well so that the single player and multiplayer code are one and the same.

Spitball-ideas:

Use a separate thread for the server logic and then share the data between a synchronized point in the code for the client.
Just send packets to local host from the server thread and collect them from the client thread.

How should I do this?

sentences:
Real-Time Speech & Verbal Communication with a Mecanim Character What would be the simplest method of integrating real-time verbal communication within a mecanim character that is already being used in a Unity app/project? Something like an SDK or toolkit?

I have such a character that is animated by a motion-capture device, so the user puts on the suit and the Unity character is driven by receiving live motion data. This is the non-verbal part for research in Social Sciences & Psychology.

I tried integrating the Virtual Human Toolkit into my Unity app to use its real-time speech & lip sync & facial gestures, but their character is set up in a complicated way, so I still cannot animate it by using my motion-capture device.

So, now I am thinking what is the next best thing to do with a Unity mecanim character to make it say something, etc...?

sentences:
Sprite Body can not stop Hey i have issue regarding jump sprite body. In my code i am using moveLeft and moveRight Button and when i am press moveRight Button using following code

if (moveRight.active==YES)
    {
            b2Vec2 force=b2Vec2(4,0);
            ballBody->SetLinearVelocity(force);
    }

Its move perfectly and When i release this Button than sprite body stop using following code

else
{
      b2Vec2 force=b2Vec2(0,0);
      ballBody->SetLinearVelocity(force);
}

But when i put this else part then jump can not done. My jump code is following

if (jumpSprite.active==YES)
                {
                    NSLog(@"Jump Sprite");
                    b2Vec2 locationWorld;
                    locationWorld=b2Vec2(0.0f,4.0f);
                    double force=ballBody->GetMass();
                    ballBody->ApplyLinearImpulse(force*locationWorld, ballBody->GetWorldCenter());
                }

If i remove else part then jump will perform complete but sprite body can not stop after release button.

So what to do??

Thanks in advance

sentences:
My runtime mesh is not being created where it's vertices are located, need help I'm trying to create a quad at runtime and I'm encountering an issue where the mesh does not show up in the scene where it's vertices where set. In the following picture you can see the ship, and to the far right the mesh.

The 4 white dots around the ship where drawn after the mesh was made using the 4 vertices of the mesh.

My Code:

//Handles the method calls for the mesh creation
private void BoundingMeshCreation()
{
    Quaternion currentRotation = ResetPosition(new Quaternion(0, 0, 0, 0));
    BoundingPointsType boundingPoints = DetermineBounds();
    Mesh boundingMesh = CreateBoundingMesh(boundingPoints);
    AssignMesh(boundingMesh);
    ResetPosition(currentRotation);
}

//Creates the mesh filter and assigns the mesh
private void AssignMesh(Mesh boundingMesh)
{
    MeshFilter newMeshFilter = gameObject.AddComponent<MeshFilter>();
    newMeshFilter.mesh = boundingMesh;

    VectorLine testPoint = new VectorPoints("testPoint", boundingMesh.vertices, null, 5);
    testPoint.Draw3D();
}

//Creates a bounding mesh for the unit
private Mesh CreateBoundingMesh(BoundingPointsType boundingPoints)
{

    Mesh boundingMesh = new Mesh();
    boundingMesh.name = "Bounding Quad";

    Vector3[] vertices = new Vector3[4]
    {
        boundingPoints.LowerLeftPoint,
        boundingPoints.LowerRightPoint,
        boundingPoints.UpperRightPoint,
        boundingPoints.UpperLeftPoint
    };

    int[] triangles = new int[6]
    {
        0,
        2,
        1,

        0,
        3,
        2
    };

    boundingMesh.vertices = vertices;
    boundingMesh.triangles = triangles;

    return boundingMesh;
}

//Resets the units rotation to the specific quaternion and returns the quaterion from before the reset. Bit of a hack for now to make sure that the original box is the proper size.
private Quaternion ResetPosition(Quaternion toResetTo)
{
    Quaternion currentRotation = transformV.rotation;
    transformV.rotation = toResetTo;
    return currentRotation;
}

//Determines and returns the bounding box points
private BoundingPointsType DetermineBounds()
{
    Vector3 maxBounds = childSprite.GetComponent<Renderer>().bounds.max;
    Vector3 minBounds = childSprite.GetComponent<Renderer>().bounds.min;

    BoundingPointsType boundingPoints = new BoundingPointsType(new Vector3(maxBounds.x, 1, maxBounds.z),
                                                               new Vector3(minBounds.x, 1, maxBounds.z),
                                                               new Vector3(maxBounds.x, 1, minBounds.z),
                                                               new Vector3(minBounds.x, 1, minBounds.z));
    return boundingPoints;
}

I've even tried manually setting the vertices like the following:

    Vector3 UpRight = transformV.position;
    Vector3 UpLeft = transformV.position;
    Vector3 LowRight = transformV.position;
    Vector3 LowLeft = transformV.position;

    UpRight.z += 1;
    UpRight.x += 1;

    UpLeft.z += 1;
    UpLeft.x -= 1;

    LowRight.z -= 1;
    LowRight.x += 1;

    LowLeft.z -= 1;
    LowLeft.x -= 1;

    Vector3[] vertices = new Vector3[4]
    {
        LowLeft,
        LowRight,
        UpRight,
        UpLeft
        //boundingPoints.LowerLeftPoint,
        //boundingPoints.LowerRightPoint,
        //boundingPoints.UpperRightPoint,
        //boundingPoints.UpperLeftPoint
    };

I'm at a loss, and have no idea what I'm doing wrong. My dynamic meshes seem to work perfectly fine for everything else in the game.

Thanks.

sentences:
Why can't I use the operator '>=' with Vector3s? I am trying to get a rectangle to move between two positions which I refer to as _positionA and _positionB. Both are of type Vector3. The rectangle moves just fine. However, when it reaches _positionB it does not move in the opposite direction, like it should.

I went back into the code to take a look. I came to the conclusion that as the object moved, the if statements in the code missed the frame in which the rects position was equal to _positionB. I decided to modify the code to reverse direction if the rects position is greater than or equal to _positionB. My code is not too long, so I will display it below:

using UnityEngine;
using System.Collections;

public class Rectangle : MonoBehaviour
{
    private Vector3 _positionA = new Vector3(-0.97f, -4.28f); //Start position
    private Vector3 _positionB = new Vector3(11.87f, -4.28f); //End position
    private Transform _rect_tfm;
    private bool _atPosA = false, _atPosB = false;

    public Vector2 speed = new Vector2(1f, 0f);

    private void Start()
    {
        _rect_tfm = gameObject.GetComponent<Transform>();
        _rect_tfm.position = _positionA;
        _atPosA = true;
    }

    private void Update()
    {
        /*NOTE: Infinite loops can cause Unity to crash*/
        Move();
    }

    private void Move()
    {
        if (_atPosA)
        {
            _rect_tfm.Translate(speed * Time.deltaTime);

            if (_rect_tfm.position == _positionB)
            {
                _atPosA = false;
                _atPosB = true;
            }
        }

        if (_atPosB)
        {
            _rect_tfm.Translate(-speed * Time.deltaTime);

            if (_rect_tfm.position == _positionA)
            {
                _atPosA = true;
                _atPosB = false;
            }
        }
    }
}

When I changed it, however, it warned me of the following error message:

  Operator >= cannot be applied to operands of type Vector3 and Vector3.

This confuses me for two reasons; first, both values are of the same data type. Second, using the comparison operator(==) on the two values works without error. Why can't I use the operator >= with Vector3s?

sentences:
Fair monetization of a MMO with a simulated economy I am in the design phase of a MMO game based around flying age-of-sail airships.  Players will be able to captain their own ship (owned by their  in-game nation or faction or themselves if they become sufficiently wealthy), or play as a crewmember on their own or another ship in battle , or as ground defence personnel when their own ship becomes too boring.

The players might also design or redesign the flying sailing ships (and later, as technology progresses, flying steam or diesel ships), and test new ship design, or plan ground defences.

All of this would be based around a simulated economy, where resources are produced, shipped and either consumed or lost to make value-added foods, commodities, communities or vessels.  In a war, commerce raiding should - eventually - have an impact as much as direct military action against enemy troops and vessels.

Players could be merchants, pirates, smugglers, privateers, naval captains, or just another member of a ship's crew.  Players could also design airships and ground defences, and contribute to the governance of their province.

So, for all of this, how can I monetize this game?  I need to consider startup capital, but more importantly, it needs to make a profit.

However... I don't want to fall into the ways of many games with micro-transactions.   That means no pay-to-win - a paying player must have only their own skills and equipment to help them win against a free-to-play player... if I go with that method.

The economy is simulated, and I would like the method of monetization to have a minimal impact on that, but not necessarily no impact. Players must know exactly what they are spending their in-game currency upon, an must be able to sell for in-game or possibly even real currency any 'physical' game object - with a cut to the broker (i.e. the developer).

I have considered an up-front cost, but that alone does not guarantee an income stream as the player base becomes saturated.  I have considered instant IAP of objects that would otherwise take time to produce - the player buys them from the developer's nation.  I have considered allowing a certain amount of free screen time per month, extendable by a purchase.

What methods would guarantee continual income for a number of years at least, without unduly upsetting players who may be wary of traps such as loot chests or pay-to-win?  Can a game such as this be funded prior to the commencement of development?

sentences:
Sprite sheets, Clamp or Wrap? I'm using a combination of sprite sheets for well, sprites and individual textures for infinite tiling.

For the tiling textures I'm obviously using Wrap to draw the entire surface in one call but up until now I've been making a seperate batch using Clamp for drawing sprites from the sprite sheets. The sprite sheets include a border (repeating the edge pixels of each sprite) and my code uses the correct source coordinates for sprites.

But since I'm never giving coordinates outside of the texture when drawing sprites (and indeed the border exists to prevent bleed over when filtering) it's struck me that I'd be better off just using Wrap so that I can combine everything into one batch.

I just want to be sure that I haven't overlooked something obvious. Is there any reason that Wrap would be harmful when used with a sprite sheet?

sentences:
Java, spawn algorithm that gets harder each level I am currently in the process of making my 3rd Java game (everything I have learned is from YouTube videos, so I may be doing some things wrong) named "Blocked". But I have run into a problem: how do I make an algorithm that gets progressively harder each "level". but first let me briefly explain the game, so you are a small human and blocks are falling from the sky, and you try to avoid them, there are 5 types of blocks: Basic, fast, shop, killer, safe. So I want my game to start with very few (basic only) tiles to fall, while the game is going (infinitely) I want it to get harder but not just unlocking new blocks, but also changing the frequency the more difficult blocks spawn (up to a certain threshold of course).

P.s. pseudo code is fine by me.
P.s. (2) if you need any clarifications ask me!

sentences:
How to address a function inside an if condition using C# in unity 3D I am new to game development and have very limited idea of C# syntax. I was watching unity 3D tutorials of UI and thought of using ModalPanel.cs and TestModalWindow.cs
In a quiz game where 3 choices are there of a question and total 5 questions are there

Now suppose in

public void TestNYCI ()
{
   modalPanel.Choice(
         " string? ",
         icon,
         TestYesFunction,
         TestNoFunction,
         TestCancelFunction);

   // Here I want to use an if loop
   // if ( condition)
   // where condition means choosing of a function among
   // TestYesFunction, TestNoFunction, TestCancelFunction

   //Statements

   // If suppose TestYesFunction is true I want
   // to increment the count and write it as score
}

And will repeat the process in rest of the 5 functions.

Can someone please provide a suitable syntax to address the problem.

sentences:
render sprites with a transparent background (XNA) For my game I want to make a map of the world. Per country I made a file with the border of the country and the rest of background is transparent. This way all my files have the same width and height. My problem is that XNA only renders the first image and it does it in an alphabetical order. For example: if I change the name of the first sprite so it isn't first in alphabetical order, it just renders the first sprite.

The sprites are loaded in a sortedlist and each key is the name of the continent + the name of the country. And I loop through this list to render each sprite.

Code to load the files:

protected override void LoadContent()
    {
        DirectoryInfo objDirectory = new DirectoryInfo(Game.Content.RootDirectory + "/Regions");
        FileInfo[] objFiles = objDirectory.GetFiles("*.*");

        objSpritebatch = new SpriteBatch(Game.GraphicsDevice);

        foreach (FileInfo File in objFiles)
        {
            string[] FileName = File.Name.Split("_".ToCharArray());
            string strContinent = FileName[1] + "/" + FileName[2].Substring(0, FileName[2].Length - 4);
            lstBorders.Add(strContinent, Game.Content.Load<Texture2D>("Regions\\" + Path.GetFileNameWithoutExtension(objFiles[0].Name)));
        }

        base.LoadContent();
    }

Code to render the files:

public override void Draw(GameTime gameTime)
    {
        objSpritebatch.Begin(SpriteSortMode.Texture, BlendState.AlphaBlend);

        foreach(KeyValuePair<string, Texture2D> Border in lstBorders)
        {
            objSpritebatch.Draw(Border.Value, new Rectangle(0, 0, 800, 400), Color.White);
        }

        objSpritebatch.End();

        base.Draw(gameTime);
    }

I allready did some research and hoped it would be fixed by using those parameters in the begin command but it didn't help. I hope I gave you all the code you need.

sentences:
Nape physics - Moving a body Hey I'm currently getting started with physics engines and I set up a body (box shaped) which represents my character.
Question: Which methods can I use to move a Nape.Body aka my char?

I tried so far to manipulate the velocity, addLocalForce / Impulse but I don't know which method is the best for moving a character.

sentences:
Should Vector3 inherit from Vector2? I'm creating a couple of classes Vector2 (X & Y) and Vector3 (X, Y & Z), but I don't know whether to make Vector3 inherit from Vector2, or whether to re-implement the member variables m_x and m_y again? What are the pros and cons of each side (inheritance vs redefinition).

Edit: I'm using C++ (VS2010).

sentences:
Symbol not found Error in Unity3d - IOS Buid in Xcode I new to IOS build , when  i try to build following error showing

I using Unity 5.2.1f1  and Xcode 7.0.1(7A1001)  . Previous   unity version was 5.0.1  , in that version , same error was found thats why  i updated unity , even though same error is existing

When i taking build Xcode showing  "Buid Succeeded" , when running on simulator , following error is showing .

Warning: Error creating LLDB target at path '/Users/UserName/Library/Developer/Xcode/DerivedData/Unity-iPhone-dzxhzbvzarcxwncwpymwfynqdipi/Build/Products/Release-iphonesimulator/GameName.app'- using an empty LLDB target which can cause slow memory reads from remote devices.

_dyld: Symbol not found: _assignIdentifiersAndCallbackGameObject
  Referenced from: /Users/UserName/Library/Developer/CoreSimulator/Devices/400B12B2-B711-453C-B0E3-7DDF12A770F0/data/Containers/Bundle/Application/E62986EE-618C-4530-B5F8-A09D43162DBD/GameName.app/GameName
  Expected in: flat namespace
 in /Users/UserName/Library/Developer/CoreSimulator/Devices/400B12B2-B711-453C-B0E3-7DDF12A770F0/data/Containers/Bundle/Application/E62986EE-618C-4530-B5F8-A09D43162DBD/GameName.app/GameName
(lldb)

please help me , how to solve this problem

sentences:
Creating and Destroying OpenGl objects dynamically I was trying to build a game like this

and i want to create and destroy these ships at runtime ,
I have used GL_QUADS and used an image to plot over the QUAD,
how can I dynamically create multiple Quads,paste (ship) image over them and destroy them when they collide with the canon ball, thanks

here is a chunk of code

ship = SOIL_load_OGL_texture(
        "ship2.png",
        SOIL_LOAD_RGBA,
        SOIL_CREATE_NEW_ID,
        SOIL_FLAG_INVERT_Y
        );
    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);
    glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_WRAP_T, GL_CLAMP);

    glEnable(GL_BLEND);
    glBlendFunc(GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA);

    glColor3f(1, 1, 1);
    glBindTexture(GL_TEXTURE_2D, ship);
    glBegin(GL_QUADS);
    glTexCoord2d(0, 0);
    glVertex2d(450 - x, 0);
    glTexCoord2d(1, 0);
    glVertex2d(500 - x, 0);
    glTexCoord2d(1, 1);
    glVertex2d(500 - x, 100);
    glTexCoord2d(0, 1);
    glVertex2d(450 - x, 100);
    glEnd();

sentences:
How can I synchronize ocean waves over the network? I've been performing a little bit of research in my spare time on ways to increase the interactivity of environments in a networked game or simulation.

One of my areas of research is fluid-dynamics and whether it would be possible to synchronize it over the network. I believe the short answer to that is - Yes of course you can. But there will obviously be trade-offs as there are with any network synchronization problem.

I was recently playing Battlefield 4 and a number of their maps have playable ocean areas with fully functional waves large enough to obscure entire boats during gameplay. It seems to work quite well as well.

My assumption here is that the ocean simulation is completely offline and each client performs synchronization with the server during initialization. This would allow all clients to run the exact same ocean simulation that appears to be dynamic but is in fact the same offline simulation every time.

Interaction with the ocean simulation appears to be only superficial with local splash/wave depression. I assume that is entirely local to the client and not synchronized.

My question here is:

Would the above be an appropriate way to synchronize fluid simulation over a networked game? If not, what would you suggest?

sentences:
Quaternion Rotation Help So I'm making a little engine with DirectX 11 and C++. (Some other help from other API's as well) DirectX has this function XMMatrixRotationQuaternion(XMVECTOR quaternion). I know nothing about this so excuse my cluelessness. I have a few questions about them that maybe someone could help me with.

Do I use XMMatrixRotationQuaternion(XMVECTOR quaternion) and multiply the resultant Matrix with my scaling matrix and translation matrix to get my transformation matrix?
How can I convert an angle (let's say in radians) to a quaternion. I've tried to look at this and what I got was something like this(I have a feeling this isn't anywhere close to correct)...
Lastly, do I need to normalize that XMFLOAT3 axis?

static XMVECTOR XMConvertToQuaternion(XMFLOAT3 axis, float radian)
{
   return XMVectorSet(cos(radian/2), sin(radian/2)*cos(axis.x), sin(radian/2)*cos(axis.y), sin(radian/2)*cos(axis.z));
}

sentences:
How do I rotate and flip 2D sprites stored in a 1D array of pixels? I am using a 1D array of pixels for rendering in 2D in java. I am interested in rotation (in radians) and mirroring across the x and y axes. The desired result looks something like this:

Public void render(Sprite sprite, int x, int y, double rotation, boolean xFlip, boolean yFlip) {}

I am not using any libraries for the current project. The information that I have gleaned is that I must somehow multiply the points of my pixels with a transformation matrix. I am familiar with matrices (outside of a programming context) and am ok with rigorous mathematics.

How do I rotate and flip 2D sprites with a 1D array of pixels?

EDIT
The sprite class is almost exclusively a wrapped array of pixel data.
In my Screen class:

image = new BufferedImage(width, height, BufferedImage.TYPE_INT_RGB);
int[] pixels  = ((DataBufferInt) image.getRaster().getDataBuffer()).getData();

and then

g.drawImage(image, 0, 0, getWidth(), getHeight(), null);

sentences:
Query regarding a quad tree implementation for spherical terrain I am having some difficulty conceptualising how a quadtree would be used to implement a spherical terrain system.

I currently have a spherical terrain system working, without any form of optimisation, I just have a vertex buffer full of every vertex in the terrain. Obviously, this can only be rendered at very low resolutions without lagging.

I intend to use a Chunked Level of Detail system to speed things up, however, despite my research, I am still somewhat unsure as to how to proceed.

From what I understand:
I need to generate several levels of detail (by essentially creating several distinct terrain files, each with a lower resolution than the last).

I then load the quad tree with the data by setting each level of the quad tree to be a "level of detail", so level 1 would be the root node, encompassing everything, level 2 would contain very low resolution terrain data (in the form of a low-resolution list of terrain vertices), and so on until level n, where the highest resolution data would be stored (in the form of a high resolution list of terrain vertices).

This is the part I have the most trouble with, is this correct? Generating several terrain files at different resolutions, and loading each one to a separate level of the quad tree?
Or should the tree be populated with vertices in a different way?

I then populate the main vertex buffer by searching the quadtree's nodes, and I use the players position to decide which nodes to return. So, the nodes far away from the player will be all high level (level 1) nodes with low detail, and as the distance to the player gets closer, the search will drill deeper and deeper into the quad tree, so eventually the nodes returned will be the highest detail level possible.

Is this in any way correct? My thinking on this is still quite hazy, even though I have done extensive research.

Thanks for any help or advice!

sentences:
How can I change the parents rotation so the childs rotation is looking at a specific direction I have a child object which is always having different positions and rotations (thats my VR Headsets Eye-Gameobject)
I cannot modify the position and rotation of that.

I want to set my view to a certain "startposition" and "startrotation" so the player always has the same view at the start of the game.

The childs local position is always set to some values.
So I cannot unparent it.
If I unparent it, I change his position.

now..

It works with the position.

Parent.transform.position =  2 * ParentStartPostion - Eye.localPosition;

^
This line of code here sets my parent object so that my Gameobject: "eye-camera" is where i want it to be.

For the rotation part, i would do following:

Eye.parent = null; //unparent the eye to the world
Parent.transform.position = Eye.position; //set my Parent to the same position as Eye
Eye.parent = transform; //parent it back. Local Eye should be 0.0.0 now.
Parent.transform.rotation = Quaternion.LookRotation(StartForward, StartUp); // i can rotate the at the direction I want it.

But after I unparent my Eye the position of the local(which is also global) is set to a different value.
And after I parent it back, its set to the old value again.

Eye.parent = null; //unparent my eye to the world - Eye moves anyway because its movend by SteamVR
Parent.transform.position = Eye.position; //set my Parent to the same position as Eye (works)
Eye.parent = transform; //parent it back. Local Eye moves back where it was and there is a distance between parent and eye again.
Parent.transform.rotation = Quaternion.LookRotation(StartForward, StartUp); // the rotation changing my eyes position because its parented. Also the rotation is wrong.

And now i dont know anymore how to solve this problem.

so... i painted my problem in paint for better understanding:

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:
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: Minimax for Bomberman I am developing clone of Bomberman game and I am experimenting with different types of AI. First I used searching through state space with A* and now i want to try different approach with Minimax algorithm. My problem is that every minimax article i found assumed players alternates. But in Bomberman, every player make some action at the same time. I think i could generate all possible states for one game tick, but with four players and 5 basic actions (4 moves and bomb place) it gives 5^4 states at first level of the game tree. That value will raise exponentially with every next level. Am I missing something? Are there any ways to implement it or should i use totally different algorithm? Thanks for any suggestions

sentences:
Why doesn't Unity's OnCollisionEnter give me surface normals, and what's the most reliable way to get them? Unity's on collision event gives you a Collision object that gives you some information about the collision that happened (including a list of ContactPoints with hit normals).

But what you don't get is surface normals for the collider that you hit. Here's a screenshot to illustrate. The red line is from ContactPoint.normal and the blue line is from RaycastHit.normal.

Is this an instance of Unity hiding information to provide a simplified API? Or do standard 3D realtime collision detection techniques just not collect this information?

And for the second part of the question, what's a surefire and relatively efficient way to get a surface normal for a collision?

I know that raycasting gives you surface normals, but it seems I need to do several raycasts to accomplish this for all scenarios (maybe a contact point/normal combination misses the collider on the first cast, or maybe you need to do some average of all the contact points' normals to get the best result).

My current method:

Back up the Collision.contacts[0].point along its hit normal
Raycast down the negated hit normal for float.MaxValue, on Collision.collider
If that fails, repeat steps 1 and 2 with the non-negated normal
If that fails, try steps 1 to 3 with Collision.contacts[1]
Repeat 4 until successful or until all contact points exhausted.
Give up, return Vector3.zero.

This seems to catch everything, but all those raycasts make me queasy, and I'm not sure how to test that this works for enough cases. Is there a better way?

EDIT
If this really is just the way things are with 3D collision, an overview of why in the general case would be just as welcome as something specific to Unity.

sentences:
libGDX map transition via try & catch exeption I have a simple question.  Some explination first, however:

I am using libGDX and making a Legend of Zelda-type top-down game and I'm having an issue with map transitions.  When I made the tilemap and added the (currently crappy) collision detection to it, I noticed that the IDE threw an error when the character walks off the map (where there are no tiles to test the collision possibility against).  I thought, cool, I can use that.

Knowing that the program would throw an exception when the player left the screen, I caught that exception and used it to decide to which map the player was trying to transition and switch accordingly.  I played a little transition from the scene2d actions and to the next map we went.

BUT, I got to thinking that while catching that exception is a great thing, I probably shouldn't rely on it for map transitions.  I'm betting you all will agree: handle the exception just in case, but don't rely on it.

SO, this means that I need to handle a transition before the user gets off the map.  I tried using transition tiles from within the collision detection:

If the tile had the transition property, figure out where the user is attempting to transfer and then play the transition effect and on to the next map.  The only problem with this system is that it doesn't look right.  The user transitions just as collision is made while there is still room left in the tile to transverse.

My question to you all, then, is this:  Is there a middle ground between the two?  Is there a way to tell end of map or last tile, allow the user to transverse the tile just prior to transitioning?  Or are my two ways the only ones?

sentences:
Unity - Save/load in a sandbox game, how to instantiate saved objects I have a game where a player can place GameObjects.

I can  save/load this GameObjects data with using JSON, for example its position, but I cannot think of a good way to tell my save-file (and my load) what Prefab it needs to instantiate at position X.

How I could this be done in a clever way?

sentences:
How do I stop the player from rotating when they collide with a tile? I use Touch movement and if I jump and hit a corner with the feet of my player, my player rotates but I don't want this. Can anyone help me jumping without rotating if I hit anything ?

here is my Script:

using UnityEngine;
using System.Collections;

public class PlayerController : MonoBehaviour {

    public float speed = 10, jumpVelocity =  10;
    public LayerMask playerMask;
    public bool canMoveInAir = true;
    Transform myTrans, tagGround;
    Rigidbody2D myBody;
    bool isGrounded = false;

    private Animator anim;

    // Use this for initialization
    void Start ()
    {
        myBody = this.GetComponent<Rigidbody2D>();
        myTrans = this.transform;
        tagGround = GameObject.Find (this.name + "/tag_ground").transform;

        anim = GetComponent<Animator> ();
    }

    // Update is called once per frame
    void FixedUpdate ()
    {
        isGrounded = Physics2D.Linecast (myTrans.position, tagGround.position, playerMask);

        #if UNITY_ANDROID && !UNITY_IPHONE && !UNITY_BLACKBERRY && !UNITY_WINRT
        Move(Input.GetAxisRaw("Horizontal"));
        if(Input.GetButtonDown("Jump"))
           Jump();
        #endif
    }

    public void Move(float horizontalInput)

    {
            //Er klebt nicht mehr an den Waenden
        if (!canMoveInAir && !isGrounded)
            return;

        Vector2 moveVel = myBody.velocity;
        moveVel.x = horizontalInput * speed;
        myBody.velocity = moveVel;

        anim.SetFloat ("speed", Mathf.Abs (GetComponent<Rigidbody2D> ().velocity.x));

        if (horizontalInput < 0)
        {
            transform.localScale = new Vector2 (25, 25);
        }
        if (horizontalInput > 0)
        {
            transform.localScale = new Vector2 (-25, 25);
        }
    }

    public void Jump()
    {
        if (isGrounded)
            myBody.velocity += jumpVelocity * Vector2.up;
    }
}

sentences:
Identifying Entity 'Types' in an Entity-Component System If an Entity has no explicit 'type' (e.g. player) and is simply a collection of components, how do I identify the entities that my systems should and should not be working on? For example, in a game of Pong the paddle and ball both collide with the window boundaries. However, the collision handling systems for each will be different, therefore a system should not handle entities of the wrong type.

void PlayerCollisionSystem::update(std::vector<Entity *> entities) {
  typedef std::vector<Entity *>::iterator EIter;
  for (EIter i = entities.begin(); i != entities.end(); ++i) {
    Entity *player = *i; // How do I verify that the entity is a player?

    // Get relevant components.
    PositionComponent *position = player->getComponent<PositionComponent>();
    VelocityComponent *velocity = player->getComponent<VelocityComponent>();
    SpriteComponent *sprite = player->getComponent<SpriteComponent>();

    // Detect and handle player collisions using the components.
  }
}

Both the player and the ball share the same relevant component types for collision handling yet their system implementations will be different.

If I have a container of all game entities, how do I identify specific types of entity without inheriting Entity or including a member variable such as std::string type, in which case an entity is no longer simply a collection of components?

sentences:
Assigning function to button in foreach loop causes all buttons to have the same argument value I have a script that generates buttons based on a list of assets. Each button is intended to to add the asset's resource path to a variable called SpawnGlobals.CurrentSelection. When printing the asset resource name of all button within the loop, the different resoruce paths are shown. When printing the value in the select function, the value is always the last item in the asset_register list.

I do not understand why this is happening. Am I using the foreach loop or lambda incorrectly?

void Start () {

    //Add Foundry Assets Here:
    SpawnGlobals.asset_register.Add (new FoundryAsset ("Test Sphere", "sphere_obj"));
    SpawnGlobals.asset_register.Add (new FoundryAsset ("Building Block 10x10x10 01", "BuildingBlock10x10x10_01"));
    SpawnGlobals.asset_register.Add (new FoundryAsset ("Building Block 10x10x10 02", "BuildingBlock10x10x10_02"));
    SpawnGlobals.asset_register.Add (new FoundryAsset ("Building Block 10x10x10 03", "BuildingBlock10x10x10_03"));
    foreach (FoundryAsset asset in SpawnGlobals.asset_register) {
        SpawnGlobals.buttons.Add(Instantiate(button_prefab));
        GameObject current_button = SpawnGlobals.buttons.Last ();
        current_button.transform.SetParent(master.transform, false);

        current_button.GetComponentInChildren<Text>().text = asset.AssetName;

        print (asset.AssetName);
        current_button.GetComponentInChildren<Button>().onClick.AddListener (delegate {
            select(asset.ResourcePath);
        });

    }

}
public void select(string selected)
{
    print (selected);
    SpawnGlobals.CurrentSelection = selected;
}

sentences:
Java Libgdx - Fire bullets This is my project structure!
I am using Java Libgdx

I want to make my Man class shoot the bullets from my bullet class. To make it more clear for example the spaceship game that you shoot asteroids the bullets come from the spaceship while you move it I want the same thing.
   package com.kovach.gameobjects;

  import java.awt.*;

  import com.badlogic.gdx.Gdx;
  import com.badlogic.gdx.graphics.Texture;
  import com.badlogic.gdx.graphics.Texture.TextureFilter;
  import com.badlogic.gdx.graphics.g2d.TextureRegion;

public class Bullet {

int x,y;
public static TextureRegion bullet;

public static Texture texture;

public Bullet(int startX, int startY){

    x = startX;
    y = startY;
    texture = new Texture(Gdx.files.internal("data/texture.png"));
    texture.setFilter(TextureFilter.Nearest, TextureFilter.Nearest);
    bullet = new TextureRegion(texture, 238, 5, 6, 13);
}

public void move(){

    x = x + 2;
    if (x > 700)
        visible =false;

   }

}

Fire method in Man class

   public void fire() {

    Bullet z = new Bullet((left + width), (y + height/2 ));
    bullets.add(z);

}

GameRenderer draw method

    private void drawBullets(){
    ArrayList bullets = Man.getBullets();
    for (int w = 0; w < bullets.size(); w++){
        Bullet m = (Bullet) bullets.get(w);

    }
}

sentences:
XNA Multisampling only for 3D I am working on a game which consists of 3D elements and a 2D GUI. I have it working properly, but I want to enable multisampling for only the 3D parts, and not the 2D Textures. Otherwise, the GUI icons become blurred.

Here is the code for my Draw method

    protected override void Draw(GameTime gameTime)
    {
        graphics.PreferMultiSampling = true;
        graphics.ApplyChanges();

        GraphicsDevice.Clear(Color.Black);

        GraphicsDevice.SamplerStates[0] = SamplerState.PointWrap;
        GraphicsDevice.DepthStencilState = DepthStencilState.Default;

        foreach (Element e in Elements)// 3D part
        {
            e.Draw(GraphicsDevice, camera);
        }

        graphics.PreferMultiSampling = false;
        graphics.ApplyChanges();

        spriteBatch.Begin();
        UIM.Draw(GraphicsDevice, spriteBatch);
        spriteBatch.End();//

        base.Draw(gameTime);
    }

Using this code, I get an exception because all of my Texture2Ds dispose for some reason.

Is there a way to change the MultiSampling in the middle of the Draw method?

sentences:
General Sequence of Events for a 2D shooter I'm having some trouble understanding ways to sequence events in my game. Assume the game is data driven, what is the best way to control the events?

Do I have some sort of EventSequencer that loads all the possible events for a level and the enemies? If so, would it be a list of events that I 'fire' off one at a time into the game engine and when the event is completed or finished, remove the event and fire the next one?

My thoughts were similar to the above questions: Build an event sequencer that manages what event is running and loads the proper event (enemy wave, boss battle, etc)...

I'm just not sure if this is a good idea.

sentences:
NavMesh - LoS and "Containing" For a gameserver/backend, I have a navmesh for "walkable" areas in form of points/triangles.

Now I want to check every gametick if the client is still in a legit place and if he shots/casts a spell, if his target is in line of sight.

I found several possibilities, but I am not sure what is performance-wise ideal.

To check if the player is still in the allowed area (and not wallhacking) I would check if his position is in one of the triangles with a algorithm using barycentric coordinates like this:
https://github.com/SebLague/Gamedev-Maths/blob/master/PointInTriangle.cs
But this would mean that every gametick I have to check soooo much triangles.

To check if its LoS I could either check if the line from the player to its target crosses one of the "border" lines of the mesh (which have no other triangle next to it). Those border lines could be computed at bake time and are just a static list for each level. But still it would be a lot lines per check.
Second option I found would be to start a Simple Stupid Funnel Algorithm (http://digestingduck.blogspot.com/2010/03/simple-stupid-funnel-algorithm.html) until LoS is broken.

The questions now are:
How does a good gameserver handle this/can it be optimised?
What way to check is the best/fastest?
Is it common to only check if the position is legit every now and then or every gametick?

The Levels are fairly simple (~300 mesh-triangles, ~200 border lines, 10 players, 10 npcs maybe)

sentences:
How can I determine a budget for RAM used (LRU involving VRAM, in particular) After some profiling, I've determined that one of my most expensive functions involves drawing text. As a solution, I'd like to implement a LRU type of cache that will "remember" the vertices, tex coords (etc) for a given string. This is particularly complicated because some of the resources involved reside in VRAM (most do, actually; I take a given string and convert it into a long sequence of vertices / tex coords / indices), while some reside in plain RAM.

If I knew what my limits were (in both respects) I could write a decent LRU cache system and probably buy myself a substantial performance gain. The primary target for this app is the Android platform, and as I understand it, most such devices share RAM with the GPU.

I'd appreciate any answers to this, whether they directly answer my question or not.

sentences:
How can I import a model from a Source Engine game into Unreal Engine 4? I am currently developing a game in Unreal Engine 4. This project is for personal use, and will not be exhibited or sold.

Because I have no talent, I need to snatch some models from some Source Engine games.

Does anyone happen to know how I would port these models into UE4?

I have Blender and Crowbar already installed.

sentences:
OnInspectorGUI Custom properties are not displayed in the right order I basically made a lot of research and wasn´t able to find any solution.
So my problem: I´ve made some variables disappear/appear depending on an enum with a custom editor script. But if they appear they do not appear at the position where the normal editor variables would appear

override public void OnInspectorGUI()
{
    base.OnInspectorGUI();
    GunCard myScript = target as GunCard;

    EditorGUI.indentLevel++;

    switch (myScript.aimingControlType)
    {
        case AimingControlType.Manual:
            myScript.hasAimAssistance = EditorGUILayout.Toggle("Has aim assistance", myScript.hasAimAssistance);
            break;
        case AimingControlType.AutoTargeting:
            myScript.targetPreference = (TargetTypes)EditorGUILayout.EnumPopup("Target preference", myScript.targetPreference);
            myScript.requiresLineOfSight = EditorGUILayout.Toggle("Requires line of sight", myScript.requiresLineOfSight);
            myScript.requiresPossibleTargetOnScreen = EditorGUILayout.Toggle("requires possible target on screen", myScript.requiresPossibleTargetOnScreen);
            break;
    }
    EditorGUI.indentLevel--;
}

Here is where they appear:

That are the raw variables in the scriptable object

[Header("Aiming Controls")]
public AimingControlType aimingControlType;

[HideInInspector] public bool hasAimAssistance;
[HideInInspector] public bool requiresLineOfSight;                //TODO: implement -> requires 180
[HideInInspector] public bool requiresPossibleTargetOnScreen;     //TODO: implement -> requires 180
[HideInInspector] public TargetTypes targetPreference;
[HideInInspector] public bool isAutoShootWhenAimOnTarget;

I know I´m basically adding new variables to the inspector in my editor Script but it would be really useful to order them. Is there a way to do that?

P.S sorry for the funny typo in the picture :)

sentences:
Significance of Bresenhams Line of Sight algorithm What is the significance of Bresenhams Line of Sight algorithm in chasing and evading in games?

As far as i know and implemented this algorithm calulates the straight line between two given points. However while implementing it in game development i stored the points calculated using this algorithm in an array.Then im traversing this array for chasing and evading purpose. This looks to be working good with some angles only.In an pixel based environment/tile based.

What if there are some obstacles added in the paths of the two points? then this algorithm will not work right?

How well can we use the Bresenhams Line algorithm in game development?

sentences:
How can I render a wave effect like the one used in California Games' surfing mini-game? Well, I'm trying to study XNA, and I'm trying to make a California Games-inspired surfing game.

I got the surfer guy done, and it's working very well but I don't have any idea on how I should draw the wave coming and animate it. If you don't remember what the game looks like, here it is. The wave I'm talking about is the one which is coming from the left at around the 00:40 mark:

sentences:
How can I ensure GLFW callback events only happen once in the main loop? The problem is that the mouse and keyboard events can be triggered before the main loop(in which the program starts to render and update content) takes place. In the program if the moues button is pressed, there will be a sound effect. And the code looks like this

void main()
{
// Here I initialize everything including parsing model files,
// so when the window appears it's initially plain white(loading files and not
// drawing stuff). I set up the callback functions with glfwSetKeyCallBack()
// and glfwSetMouseButtonCallBack().
// The next line is the main loop

 while (!glfwWindowShouldClose(window))
 {
 // Here I draw all the content and this is supposed to be only the place that the events
 // can be triggered
 }

glfwDestroyWindow(window);
glfwTerminate();
exit(EXIT_SUCCESS);
}

When I debug the program, the window will appear and if then I click the mouse, the sound effect will appear when the program starts drawing stuff on the window. But I want the callback
functions to process events only when window enters the main loop. It should not receive or process events during the initialization part. Is there a way to prevent the callback functions to receive or process events before the main loop?

sentences:
Unity 5 Animator controls - What are their Unity 4 correspondent? I am following a tutorial that is made with Unity 5, but claims to be compatible with Unity 4.6

I am working with the Animator panel, and I was wondering where could I find certain controls on the Unity 4 version. I highlighted them in a red square.

Basically stuff that has to do with duration of transitions and checking the transition as not having an exit time.

sentences:
Games Dev Work Experience for Teenager I have a teenage son that wants to work in games development and design when he is older. We've been to several conferences that explain the importance of experience when looking for a job. Also being a IT developer myself that often interviews new hires, I know how critical experience is. So we've been looking to try and find him some work at Games Dev companies in London for several weeks over the Summer holidays but haven't got anywhere.

My son is very smart and is expected to get 8+ GCSEs of a high grade (7+ or A/Bs in old marks), he plans go on to get A levels and then study Computer Science at University. He has some programming experience in Python. All he wants is some work experience, if he ends up just running errands and making coffee that would be fine as long as he also gets involved in some way with the games development process. He also doesn't really expect to get paid (although that would be a bonus).

I've approached several companies with details and a CV but haven't had a single response back from them. This seems strange to me as apart from a little of their time these companies don't seem to have anything to lose here.

So my question is, is there something stopping games companies hiring teens in this kind of situation? Any other pertinent advice would be welcome.

sentences: Irradiance cubemap to spherical harmonics conversion What are advantages of using spherical harmonics instead of irradiance cubemap? Are there any common used methods for conversion?

sentences:
Protecting game assets through archiving I'm writing a game in C++ (with OpenGL) and am getting quite far into development. Currently I'm loading the data directly from different directories.

(E.G. I load textures from a /Data/Textures/...png)

This is fine, but not preferable. Ideally I would like to protect these assets without too much of a performance hit.
I looked at other games that I own, both Indie and AAA and found that the majority of them archive the data.
However, I am unable to access these archives with programs like Winrar Archiver which implies that they have some level of protection.

I'm not particularly knowledgeable in the field of encryption and data storage, so I may be overlooking something obvious but I would like to know how exactly I could achieve something similar.

(I am aware that competent individuals are able to use the GPU to gain access to the data but that's not preventable)

sentences:
Quaternion Translation I am writing a small game and I need some help with my quaternions.

If I have an object at rotation A (quaternion)

And I need it to be at rotation B (quaternion) in 10 steps how would I work out the step change?

For normal vectors I would do C = (B - A) / 10
And then each step simply add C to my position to move from A to B in 10 steps.
I don't believe this would work for quaternions so how do I do this?

Also there would be an infinite number of routes that could be taken to get from A to B, so I would like to calculate this for the shortest route.

I did find this http://wasted.nz/posts.php?topic=82629
But if this is correct then how do you apply the difference to the current rotation? and could this difference be divided by 10 to get the step difference?

If it helps I am using C++, DirectX 11 and Bullet Physics

sentences:
How do I pause an XNA game? I'm trying to implement pausing by following this tutorial. The tutorial recommends essentially this as the implementation:

if (!paused) {
    Simulate(gameTime);
}

How does this work? What does Simulate mean here?

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:
Update Camera manually after Camera's target updates, bypassing the game loop. Is this a good or bad practice? This question may be suited better for codereview.stackexchange.com?

I've been experimenting with a camera implementation / matrix SpriteBatch transformations and have run in to a bit of a snag.

The camera's .Update() method updates the transformation matrix and the camera's positioning.

My Player class depends upon the camera in order to work out where the mouse is in relation to the game world for a rotation calculation. This leads to the camera's information being one frame out of date when I need to be. This isn't noticeable when the player isn't moving as the camera's information is correct; even at low speeds I didn't personally notice the problem. However the speed was in excess of ~1000 pixels/sec (a few pixels per frame), it started to introduce a jittery-ness to the player's transformed position. Above and beyond these speeds resulted in very ugly drawing.

My thought process was "So I should update my camera immediately after the player's position has changed instead. Won't that introduce an unnecessary dependency? What happens if my camera isn't following the player or a player doesn't exist?"

My solution:

// in Camera2D.cs

public void ManualUpdate(GameTime gt)
{
    Update(gt);
    _hasAlreadyUpdated = true;
}

public void Update(GameTime gt)
{
    if (!_hasAlreadyUpdated)
    {
        DoUpdate(gt);
    }
    else
    {
        _hasAlreadyUpdated = false;
    }
}

private void DoUpdate(GameTime gt)
{
    ...
}

I can now manually call the camera's .Update() method early if I want to and it won't lead to multiple calls per frame. The jitter has been completely eliminated.

Would you consider this an adequate solution? Can you think of something more elegant?

sentences:
How can I make a "random" generator that is biased by prior events? I am looking to implement a chance based system which is biased by prior event.

Background:
Some years back, I remember an update for World of Warcraft announcing that they implemented a new chance calculator that would counteract spiky chains of events. (e.g. making critical strikes or dodging several times in a row). The idea was that in the event that you would dodge a hit, the chance that you would dodge the next hit would be diminished, but it would work both ways. Not dodging a hit would equally increase the chance of dodging the next hit. The major trick here, was that over several trials the dodge chance would still correspond to the percentage given to the player in his or hers stat-sheet.

This kind of system very much intrigued me at the time, and now I am in the situation of needing such a solution.

Here are my troubles:

I am guessing that I would be able to find online resources on implementing such a system, but I may just be lacking the relevant buzz words for finding it.
Also I need this approach to fit a system that is not binomial (i.e. two outcomes), but instead contains 4 mutually exclusive events.

My current approach is similar to that of a raffle ticket system. When an event occurs I change the weights in favor of all other events. This could work if the four event were meant to be equally likely, but in my case, on needs to be much more prevalent. But as the prevalent event happens more often, it shifts the weights of the other a lot higher than intended and I cannot seem to find the numbers for the weight shifts that are needed to keep the average ticket count around the initial values that the event were given.

A few direction pointers or a clear cut example would be much appreciated.

sentences:
How to delete a score after collecting all collectibles I'm making a small game for my English class, and in the beginning, you have to collect rocks. I already have the code for counting how many rocks have been picked up, and the GUI to display while the game runs. After the player collects all 9 rocks I would like for the GUI to disappear or delete itself since it won't be used anymore throughout the game, and for new text to appear at the top of the screen saying "Go To The Lottery"

I'm still very new to Unity so posting the code, and then following up with a brief explanation as to what does what would be majorly appreciated (but not at all demanded)

Both codes are in JavaScript

#pragma strict

static var currentScore : int = 0;
var offsetY : float = 40;
var sizeX : float = 100;
var SizeY :float = 40;

function OnGUI () {
GUI.Box (new Rect (Screen.width/2-sizeX, offsetY, sizeX, SizeY), "Rocks Collected: " + currentScore);

}

^^ This is my GameMaster script, which is in a empty game object galled "_GM" ^^

#pragma strict

function OnTriggerEnter (info : Collider)
{
    if (info.name == "Player")
    {
    GameMaster.currentScore += 1;
    Debug.Log ("Picked stone up");
    Destroy (gameObject);
    }
}

^^ This is my RockCollection script and it's what actually tells the GameMaster script to add 1 to the score and then delete the rock so you can't continuously pick it up

sentences:
Collision in PyGame for spinning rectangular object.touching circles I'm creating a variation of Pong. One of the differences is that I use a rectangular structure as the object which is being bounced around, and I use circles as paddles. So far, all the collision handling I've worked with was using simple math (I wasn't using the collision "feature" in PyGame). The game is contained within a 2-dimensional continuous space.

The idea is that the rectangular structure will spin at different speed depending on how far from the center you touch it with the circle. Also, any extremity of the rectangular structure should be able to touch any extremity of the circle. So I need to keep track of where it has been touched on both the circle and the rectangle to figure out the direction it will be bounced to.

I intend to have basically 8 possible directions (Up, down, left, right and the half points between each one of those). I can work out the calculation of how the objected will be dislocated once I get the direction it will be dislocated to based on where it has been touch. I also need to keep track of where it has been touched to decide if the rectangular structure will spin clockwise or counter-clockwise after it collided.

Before I started coding, I read the resources available at the PyGame website on the collision class they have (And its respective functions). I tried to work out the logic of what I was trying to achieve based on those resources and how the game will function. The only thing I could figure out that I could do was to make each one of these objects as a group of rectangular objects, and depending on which rectangle was touched the other would behave accordingly and give the illusion it is a single object. However, not only I don't know if this will work, but I also don't know if it is gonna look convincing based on how PyGame redraws the objects.

Is there a way I can use PyGame to handle these collision detections by still having a single object? Can I figure out the point of collision on both objects using functions within PyGame precisely enough to achieve what I'm looking for?

P.s: I hope the question was specific and clear enough. I apologize if there were any grammar mistakes, English is not my native language.

sentences:
How to round points to an arbitrary grid on the surface of a cube? I'm making a PCG game where I have points scattered or projected onto the surface of a cube, which is centered on origin with a "radius" of 1.

That surface is a grid and I want to associate each point to the center of each proper cell's grid.

After detecting which face the point is by taking max(x,y,z) I used that formula:

halfTileSize * floor (3dpositions * gridDivision)/gridDivision;

[EDIT: everything above work, everything below is useless, the problem was outside influence from obsolete code]

But it doesn't round the point to the correct grid cell on the surface. There is a problem where front and back don't return the same result, or it skips a row with some condition, and it also rounds to the wrong nearby cells.

I tried to replace the floor with:

3dpositions.xyz < 0 ? ceil(3dpositions * gridDivision) : floor(3dpositions * gridDivision)

That didn't work either. It seems to work fine on a 2d planes, which I used to conceptualize the formula, but in 3D I'm at loss as to why it wouldn't work, since I basically reduce the problem to 2D anyway...

Any help to create a formula that would round the points properly into the right cell?

sentences:
is it possible to use dynamic types in c# generic methods? for example i need something like this:

 SQLITE._instance.ds.GetItems<armour>();

armour is a class. but i need to get type of object to send to it in order to avoid rewriting this function.

for example it need:

SQLITE._instance.ds.GetItems<"classType">();

or

 SQLITE._instance.ds.GetItems<obj.getType()>();

to send the type to generic function. but i always receive that you send a variable not a type to generic function.

what should i really do?

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 flatten out terrain and make better caves with Perlin noise I'm currently using Perlin noise to generate a terrain. This is my actual attempt to create caves. I do get some sort of cave structures but they are small and are always close to the edges of the terrain. Also my terrain looks very irregular I'd like to have a more flat terrain. I've been playing with the values I pass to the Perlin noise function but I can't seem to get something good.

Do you have any pointers or suggestions to my actual approach in order to get something more regular within the Minecraft standards?

sentences:
Need help solving EventHandler issue I have an issue with my EventHandler for Key events in my game.

The specifics are in this forum thread: http://www.java-gaming.org/topics/problems-with-key-event-handling/37998/view.html

Basically, the issue is that a KeyReleasedEvent is fired in a very inconvenient way. I recently switched from polling to interrupting to take key input, so I'm hoping somebody has had this problem before and knows an elegant way to solve it.

I can provide more code and details if needed. Thank you for any help!

sentences:
how can i fix my code in order to get rid of the error that says that the object I want to instantiate is null? using System.Collections;
using System.Collections.Generic;
using UnityEngine;
using UnityEngine.UI;

public class replicate : MonoBehaviour
{

    public void replicateCube(InputField T)
    {
        int H = int.Parse(T.text);

        for (int i = 0; i < H; i++)
        {

            GameObject prefab = Resources.Load("Cube") as GameObject;
            GameObject go = Instantiate(prefab) as GameObject;
            go.transform.position = new Vector3(0, i*5, 0);

        }
    }
}

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:
How do i store blocks information in my Voxel game? I am trying to make a voxel game.

Voxel games made by blocks and each block has it's own information such as durability, step sounds, strength, ...

How do i store these information inside of blocks? or is it true to save their information inside of themselves.

Do i store them on all blocks instances or static properties?

public class Block
{

    public virtual float durability
    {
        get
        {
            return 1f;
        }
    }

    public virtual float strength
    {
        get
        {
            return 1f;
        }
    }

    public virtual StepSound stepSound
    {
        get
        {
            return new StepSound ( "stone.ogg" );
        }
    }

}

Then create a class by inheriting Block class:

public class BlockDirt : Block
{

    public override float durability
    {
        get
        {
            return 0.5f;
        }
    }

    public override float strength
    {
        get
        {
            return 0.5f;
        }
    }

    public override StepSound stepSound
    {
        get
        {
            return new StepSound ( "dirt.ogg" );
        }
    }

}

Now i have all the above properties inside of any BlockDirt instances.

But it takes to much memory. just think i have 100 BlockDirt.

Or Do i create a base class:

public class Block
{

}

Then inherit it for creating blocks:

public class BlockDirt : Block
{

    public static StepSound stepSound = new StepSound ( "dirt.ogg" );
    public static float durability = 0.5f;
    public static float strength = 0.5f;

}

And use the BlockDirt static properties for all BlockDirt instances?

I don't know how to get static properties from class instance, but i know i can do it using Reflection but it takes more CPU and memory than instance based data.

What should i do?

Any help is appreciated.

sentences:
SFML Segmentation Fault when using VBOs? I'm trying to follow along with the gltut tutorials and for some reason when I call GLDrawArrays my program segmentation faults. I've been looking at the state of my application with the Mac OpenGL Profiler and Googling and I can't seem to figure out why it isn't working. I may have missed setting some OpenGL state somewhere.

My code is here, it segfaults on line 32. If I don't call glEnableClientState(GL_VERTEX_ARRAY); and the respective glDisableClientState(GL_VERTEX_ARRAY); it compiles and runs, but I get no rendering, which is what I would expect given my limited OpenGL knowledge.

sentences:
Will using one class per inventory item create issue on the long term? I finally managed to plug my menu to my inventory system, display current items, use them etc. But the way I did it... makes me feel dirty.

To cut short, my items are described this way:

using System;

public abstract class Item {
    public abstract string Name { get; }
    public abstract string Description { get; }
    public virtual bool IsUsable { get { return false; } }
    public virtual bool IsEquippable { get { return false; } }
    public virtual bool NeedTarget { get { return false; } }
    public virtual void OnUse() { }
}

public class Potion : Item {
    public override string Name { get { return "Potion"; } }
    public override string Description { get { return "Restores 100HP to one character"; } }
    public override bool IsUsable { get { return true; } }
    public override bool NeedTarget { get { return true; } }

    public void OnUse(PlayerCharacter target) {
        Effects.HealTarget(target, 100);
    }

    public override void OnUse() {
        OnUse(GameData.getFirstPc());
    }
}

public class Poison : Item {
    public override string Name { get { return "Poison"; } }
    public override string Description { get { return "Deals 100HP damage to one character"; } }
    public override bool IsUsable { get { return true; } }
    public override bool NeedTarget { get { return true; } }

    public void OnUse(PlayerCharacter target) {
        Effects.DamageTarget(target, 50);
    }

    public override void OnUse() {
        OnUse(GameData.getFirstPc());
    }
}

My Inventory is declared like this:

public class Inventory {
    private static Dictionary<string, Item> ItemDB = new Dictionary<string, Item>() {
        { "00001", new Potion()},
        { "00002", new Poison()},
        { "00003", new HiPotion()},
        { "00004", new FangOfDestroyer()},
        { "00005", new Elixir()}
    };

    public static Dictionary<string, int> CarriedInventory = new Dictionary<string, int>();
}

When I want to add items to CarriedInventory I basically call CarriedInventory[itemID] = newAmount

Everything only uses the ID, and when I want to get an item's name I call ItemDB[itemID].Name, when I want to use an item I call ItemDB[itemID].OnUse() , etc

My reasons for doing this were:

I can be as specific as I want on item uses as I want, I can have unique item effects without having to worry about extending it to all other items
I can use the effects in the Effects class for general effects (heal, damage, etc)
if later on I realize I need a new property for an item, I can just add a virtual property as default to the Item class (e.g. I realize I want an item to not be droppable, I add a public virtual bool IsDroppable with a value of true, and non-droppable items can override this
I avoid inheritance hell

And... it works, it works, but it feels wrong.

Is it wrong? How wrong?

Is there a better way to do it?

sentences:
My Ambient lighting is not working correctly I'm having a problem when using ambient lights in my opengl game.

When I first started with my program, i had a positioned light, and the code was this:

GLfloat AmbientColor[] = {1.0f,1.0f,1.0f,1.0f};
    glLightModelfv(GL_LIGHT_MODEL_AMBIENT,AmbientColor);
    ////////POSITIONED LIGHT
    GLfloat LightColor0[] = {0.9f,0.9f,0.7f,1.0f};
    GLfloat LightPos0[] = {0.0f,900.0f,1000.0f,1.0f};
    glLightfv(GL_LIGHT0,GL_DIFFUSE,LightColor0);
    glLightfv(GL_LIGHT0,GL_POSITION,LightPos0);

When doing this, I had a well lit area with no problem.

Once I changed my matrix to GL_MODELVIEW, I noticed that my lights were not equal on each face.

I changed my code to look like this:

GLfloat AmbientColor[] = {1.0f,1.0f,1.0f,1.0f};
    glLightModelfv(GL_LIGHT_MODEL_AMBIENT,AmbientColor);
    ////////POSITIONED LIGHT
    GLfloat LightColor0[] = {0.9f,0.9f,0.7f,1.0f};
    glLightfv(GL_LIGHT0,GL_AMBIENT,AmbientColor);

Once I used this code, only the mountains in my terrain were lit up, and anything perfectly flat was not lit at all(completely black...)

So my question is - How would I use my ambient light correctly?

Example code would be nice, thanks.

sentences:
Disable free look camera movement when touch detected on mobile joystick I'm using free joystick pack form asset store and in scene have two cameras (first person and third person). Switching cameras with toggle.
Game starts with first person camera. Moving with fixed joystick and rotating camera with swiping on right side of screen. Everything is ok for this step.
For third person camera I'm using cinemachine free look camera. Cinemachine camera is reacting to joystick touch inputs. I need to disable camera movement when interacting with joystick. Tested on Android device
Cinemachine settings:

Third Person movement script:
void Update()
{
        if (Application.platform == RuntimePlatform.Android || Application.platform == RuntimePlatform.IPhonePlayer)
        {
            x = joystick.Horizontal;
            z = joystick.Vertical;
        }
        else
        {
            x = Input.GetAxis("Horizontal");
            z = Input.GetAxis("Vertical");
        }

        Vector3 direction = new Vector3(x, 0, z).normalized;

        if (direction.magnitude >= 0.1f)
        {
            float targetAngle = Mathf.Atan2(direction.x, direction.z) * Mathf.Rad2Deg + camTps.transform.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;
            characterController.Move(moveDirection.normalized * speedTps * Time.deltaTime);
        }
 }

Any ideas and suggestions is appreciated

sentences:
Collision resolution moving Point to AABB with raycasting This is probably trivial, but I'm having trouble making it work.

I have a 3-coordinate world of particles simulated with Verlet Velocity. I only care for collision between their centers and a few static AABBs.

Essentially, I can't get a clean way of resolving a collision.

For example, say I have a box with coordinates:

min = (0, -1, -384)
max = (512, 1, 0)

Any particle colliding with it should stop moving in the relevant direction, but continue moving in the others - not bounce off.

I have one particle at pos that in a single timestep wants to go to newpos (it's being pushed both downward and eastward):

pos = (-0.068037, 0.000000, -58.516845)
newpos = (0.014446, 0.000000, -58.555490)

Clearly, on the X axis there is a collision. My ray collider detects it and pops back the point where the ray intersects the AABB:

intersection = (0.000000, 0.000000, -58.548722)

Now, if I just set the position to that point, at the next time step there will be a collision because the position will be exactly on the border of the AABB.

This makes every particle "stick" to whatever box they collide with. In the previous example, I'd like to have the particle slide down the AABB wall according to its current velocity.

How can I do that?

sentences:
Why doesn't glBindVertexArray work in this case? From my understanding of what glBindVertexArray does and how it works, the following code should work fine:

First init:

    glGenVertexArraysOES(1, &_vertexArray);
    glBindVertexArrayOES(_vertexArray);

    glGenBuffers(1, &_buffer);
    glBindBuffer(GL_ARRAY_BUFFER, _buffer);
    glBufferData(GL_ARRAY_BUFFER, kMaxDrawingVerticesCount*sizeof(GLKVector3), NULL, GL_DYNAMIC_DRAW);

    glGenBuffers(1, &_indexBuffer);
    glBindBuffer(GL_ELEMENT_ARRAY_BUFFER, _indexBuffer);
    glBufferData(GL_ELEMENT_ARRAY_BUFFER, kMaxDrawingVerticesCount*1.5*sizeof(GLuint), NULL, GL_DYNAMIC_DRAW);

    glEnableVertexAttribArray(GLKVertexAttribPosition);
    glVertexAttribPointer(GLKVertexAttribPosition, 3, GL_FLOAT, GL_FALSE, sizeof(GLKVector3), BUFFER_OFFSET(0));

    glBindVertexArrayOES(0);

And later add new geometry:

glBindVertexArrayOES(_vertexArray);
glBufferSubData(GL_ARRAY_BUFFER, 0, (GLintptr)_data.vertices.length, _data.vertices.bytes);
glBufferSubData(GL_ELEMENT_ARRAY_BUFFER, 0, (GLintptr)_data.indices.length, _data.indices.bytes);
glBindVertexArrayOES(0);

However, it doesn't work (there is screen output, but it looks like the buffers were changed between each other). Binding the vertex array is not enough for the vertex/indices buffer to get bound? Because, if I do this:

glBindVertexArrayOES(_vertexArray);
glBindBuffer(GL_ARRAY_BUFFER, _buffer); <-- note this line
glBindBuffer(GL_ELEMENT_ARRAY_BUFFER, _indexBuffer); <-- note this line

glBufferSubData(GL_ARRAY_BUFFER, 0, (GLintptr)_data.vertices.length, _data.vertices.bytes);
glBufferSubData(GL_ELEMENT_ARRAY_BUFFER, 0, (GLintptr)_data.indices.length, _data.indices.bytes);
glBindVertexArrayOES(0);

Everything works/looks as expected. I find it strange, since the vertex array should have taken care of the buffer binding. Otherwise, what's the purpose to have a vertex array if you still have to bind all the buffers?

sentences:
Double touch joysticks I am developing a mobile game where I need to control main character in any direction using touch analog joystick (https://pineight.com/mw/images/6/6f/Ipoc_dpad.png). It's ok but I also want my character to fire in any direction. Thus I am looking for best solution of control.

There are some variants, but no one is ok:

Target and fire by pointing finger to exact point of the screen (not comfortable, because player will need to hold device by one hand and use second hand to move over the whole device).
Fire to direction where the character moves. This case will limit characters' freedom on move and target. Not good.
Use second touch joystick (under opposite hand) to select fire direction - this variant looks better than previous two, however I still not sure how comfortable it will be. I've tried by myself and it looks a bit complex for me to follow both controls at the same time.

Did you saw any games achieving the same goal? What you can recommend?

sentences:
Simplified aerodynamics for 3D airplane I'm looking how to implement simple movement for an airplane in 3D in godot, i couldn't find any tutorial or any hints on how to do this, mostly theoric information on a more real flight movement.
Any ideas on how to implement this?
I'm not looking for realistic physics, just a more arcade type of movement

sentences:
How can I get accurate collision resolution on the corners of rectangles? I have a working collision system implemented, and it's based on minimum translation vectors. This works fine in most cases except when the minimum translation vector is not actually in the direction of the collision.

For example:

When a rectangle is on the far edge on any side of another rectangle, a force can be applied, in this example down, the pushes one rectangle into the other, particularly a static object like a wall or a floor. As in the picture, the collision is coming from above, but because it's on the very edge, it translates to the left instead of back up. I've searched for a while to find an approach but everything I can find deals with general corner collisions where my problem is only in this one limited case.

Any suggestions?

sentences: How do I create good looking plasma explosion effects? Is this just a billboard quad with a bloom shader?

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:
AndEngine Box2d game I'm developing a 2d survival shooter using Box2d extension and I've got some questions:

I have two AnalogOnScreenControls. Their listeners modify both
sprites and bodies. I receive TouchEventPool was exhausted and as
their number grows the game crashes accidently. I've tried to put
the modification of the bodies and sprites on the UpdateThread but
that does not solve the problem. What could be the cause?
I have a class that at the beginnig of the game loads all the
textures. After I relaunch the game activity several times I receive
Unable to find Phys Addr for and "green color" interface. But that
doesn't happen if I clear the memory manually through the Task
Manager before relaunch What could be the cause? I unload my atlas
at the end of the game.
The game sometimes crashes at start with NullPointerException in
onResumeGame. The solution suggested is to set
android:configChanges="orientation|screenSize" but my device is API
10 so it doesn't have screenSize property and orientation only does
not seem to help, because the game starts in portrait mode at times
(though landscape is set in the code)

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:
Collision shape and Model problem I used BEPUphysics for my XNA 4.0 game , the problem is that I load my model.fbx from into the game then add it to the space of physics engine , but when I change the scaling matrix of my Model then collision did not work , if I keep model scale the same then my model response to collision and every thing look good !

some says to me that your collision shape (it's often box ) that bound your model have to be changed also if the Model changed ? is this true ? (If yes !!! what is this ????)

sentences:
3D Ray Casting / Picking I am not sure if I should post this link, but I feel this falls into game development just as much as it does math. I have a ray cast's far and near values and I am trying to calculate the end point of the ray so that I can either draw a line to show the ray, or render an object at the end of 3d mouse position.

Here is my post on the stack overflow math site, if there is a problem with me doing this just close the thread. Thank you.
https://math.stackexchange.com/questions/15918/help-with-matrix-mathematica

sentences: Output from vertex shader in D3D9 I've been looking at creating some 2D rendering systems in D3D9, basically because I don't like ID3DXSprite. For the output of the vertex shader, what co-ordinate system does the run-time expect vertex co-ordinates in, like homogenous device co-ordinates? And secondly, does the depth of the resulting vertices have any effect except on the culling/depth buffering? I wanted to "reserve" a section of depth for use in 2D drawing, and then have a section for 3D geometry, to ensure that 3D geometry is always behind 2D.

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:
AABB Collision Detection Confusion I am trying to understand and implement AABB collision to learn simple 2D game physics. I'm following a tutorial and its method is a bit different to other websites. It uses the center of the object and its "half-size" to determine collision. This is its code:

public bool Overlaps(AABB other)
{
    if ( Mathf.Abs(center.x - other.center.x) > halfSize.x + other.halfSize.x ) return false;
    if ( Mathf.Abs(center.y - other.center.y) > halfSize.y + other.halfSize.y ) return false;
    return true;
}

And this is the seemingly more popular option:

if (rect1.x < rect2.x + rect2.width &&
   rect1.x + rect1.width > rect2.x &&
   rect1.y < rect2.y + rect2.height &&
   rect1.y + rect1.height > rect2.y) {
    // collision detected!
}

Which one is more efficient? And for the first option, would I define the center and half-size like this:

AABB = new AABB(new Vector2(Width / 2, Height / 2), new Vector2(Width / 2, Height / 2));

Center and half-size method source: https://gamedevelopment.tutsplus.com/tutorials/basic-2d-platformer-physics-part-1--cms-25799

Position and width/height source: https://developer.mozilla.org/en-US/docs/Games/Techniques/2D_collision_detection

sentences: 3rd person camera rotate around player with mouse I'm trying to make a 3rd person camera for a game with THREE.js and Physijs (if that's important), and so far I have set it up so that the camera follows behind the player using cos and sin etc. but I want to make it so that the user can rotate the camera in any direction around the player (and zoom in and out of course), and then when the player starts moving slowly lerp/reset the camera position to behind the player, but I'm not sure how to do this in THREE.js, I don't think OrbitControls let's it reset the position (or does it)?

sentences:
Updating RigidBody rotation and velocity only updates it's rotation I'm currently making spaceship controller script. Control is simple, W/S to move forward/backward, A/D/ to rotate ship by Y Axis(yaw).

Spaceship is RigidBody node and has CollisionShape as children.

Here's the code for move forward/backward:

export var speed = 1
export var max_speed = 10
var current_speed = 0

export var key_acceleration = KEY_W
export var key_deceleration = KEY_S

func process_movement(delta):
    if Input.is_key_pressed(key_acceleration):
        current_speed -= speed * delta
    elif Input.is_key_pressed(key_deceleration):
        current_speed += speed * delta

    current_speed = clamp(current_speed, -max_speed, max_speed)

    linear_velocity = Vector3(0, 0, current_speed)

I need to limit it's maximum speed, so I updated velocity directly, not using something like add_force.

Next is rotating code:

export var yawing_speed = 0.01
export var max_yawing_speed = 0.02
export var yaw_stop_threshold = 0.001
var current_yaw = 0

func process_yaw(delta):
    if Input.is_key_pressed(key_yaw_left):
        current_yaw += yawing_speed * delta
    elif Input.is_key_pressed(key_yaw_right):
        current_yaw += -yawing_speed * delta
    else:
        if current_yaw > 0:
            current_yaw -= yawing_speed * delta

            if current_yaw < yaw_stop_threshold:
                current_yaw = 0
        elif current_yaw < 0:
            current_yaw += yawing_speed * delta

            if current_yaw > yaw_stop_threshold:
                current_yaw = 0

    current_yaw = clamp(current_yaw, -max_yawing_speed, max_yawing_speed)
    rotation.y += current_yaw

In this code, I updated rotation.y directly. Each of this function works if run separately, however run these together, it only changed rotation, not velocity.

func _physics_process(delta):
    process_movement(delta)
    process_yaw(delta)

Change order of process_movement and process_yaw doesn't change anything. If I just run one of process_movement and process_yaw, it works perfectly.

Why my rigidbody ignored velocity and only rotated? Any advice will very appreciate it.

sentences:
Does client side prediction sync with the server in the past? I've spent some time now messing around and just trying to learn dead reckoning and client side prediction for the fun of it.  Most of what I do doesn't need it, so i've never had a need to go down the path.

I get how to predict the client and i've got a completely deterministic setup with a lockstep of 60fps for the physics on client and server.  Both client and server use the same movement code, and i'm using constant velocity to reduce complexity.  I also understand how to interpolate for corrections.  I also have the server and client ticking at nearly the same time (as close as one can really get it).

The problem i'm having, that doesn't seem clear to me in anything I've read (i'll put links at the end to a few things), is what does the client message sync against on the server? So, for example, the client is at 0, 0, 0, with a heading of 0, 0, 1 at tick 0.  At tick 5 the client presses the button to start moving forward at 40u/s and sends the message to the server.  We'll say that the trip to the server takes 50ms and 50ms back.  So the server gets the message at tick 8 (roughly), and here is where I am slightly lost.

The client sent the tick they pressed the button along with the position and new velocity.  Does the server do:

A. Look back at tick 5 and say "you're good b/c you were where you
should be at that tick"
B. Check against tick 8 and say "well you where at 0, 0, 0 at tick 8,
so you didn't start moving until then".

It would seem with B, which is what i'm currently doing, that the server is always sending back a correction.  B also has a bad side affect that when I stop, I'm almost never where the server is and the interpolation of this feels impossible to get right.

While with A, it would seem I have to redo all collisions for that object from tick 5 thru 8 on the server, but this sends less corrections and would give a smoother feel.  I understand that A is used for lag compensation when firing a weapon or taking some action that would affect other entities, but is that also used for motion?

Things I've read:
http://gafferongames.com/
http://www.gabrielgambetta.com/fpm1.html
Various articles out of books and other websites that seem to skip past this detail

Thanks in advance for any help.

sentences: How to colorize certain parts of a model - like RTS games have those team colors? I am in a need of implementing something we see in RTS games: team colors. Basically, I am looking for a way to colorize certain parts of a model. How would I achieve this? I have no idea where to even begin. Do I need to make some adjustments to the 3d model first?

sentences:
Setting up OpenGL camera with off-center perspective I'm using OpenGL ES (in iOS) and am struggling with setting up a viewport with an off-center distance point.

Consider a game where you have a character in the left hand side of the screen, and some controls alpha'd over the left-hand side.  The "main" part of the screen is on the right, but you still want to show whats in the view on the left.  However when the character moves "forward" you want the character to appear to be going "straight", or "up" on the device, and not heading on an angle to the point that is geographically at the mid-x position in the screen.

Here's the jist of how i set my viewport up where it is centered in the middle:

// setup the camera
    //

    glMatrixMode(GL_PROJECTION);
    glLoadIdentity();

    const GLfloat zNear = 0.1;
    const GLfloat zFar = 1000.0;
    const GLfloat fieldOfView = 90.0; // can definitely adjust this to see more/less of the scene

    GLfloat size = zNear * tanf(DEGREES_TO_RADIANS(fieldOfView) / 2.0);
    CGRect rect;
    rect.origin = CGPointMake(0.0, 0.0);
    rect.size = CGSizeMake(backingWidth, backingHeight);
    glFrustumf(-size, size, -size / (rect.size.width / rect.size.height), size / (rect.size.width / rect.size.height), zNear, zFar);

    glMatrixMode(GL_MODELVIEW);

    // rotate the whole scene by the tilt to face down on the dude
    const float tilt = 0.3f;
    const float yscale = 0.8f;
    const float zscale = -4.0f;
    glTranslatef(0.0, yscale, zscale);
    const int rotationMinDegree = 0;
    const int rotationMaxDegree = 180;

        glRotatef(tilt * (rotationMaxDegree - rotationMinDegree) / 2, 1.0f, 0.0f, 0.0f);

    glTranslatef(0, -yscale, -zscale);

    static float b = -25; //0;
    static float c = 0;

    // rotate by to face in the direction of the dude
    float a = RADIANS_TO_DEGREES(-atan2f(-gCamera.orientation.x, -gCamera.orientation.z));
    glRotatef(a, 0.0, 1.0, 0.0);

    // and move to where it is
    glTranslatef(-gCamera.pos.x, -gCamera.pos.y, -gCamera.pos.z);

    // draw the rest of the scene
    ...

I've tried a variety of things to make it appear as though "the dude" is off to the right:
- do a translate after the frustum to the x direction
- do a rotation after the frustum about the up/y-axis
- move the camera with a biased lean to the left of the dude

Nothing i do seems to produce good results, the dude will either look like he's stuck on an angle, or the whole scene will appear tilted.  I'm no OpenGL expert, so i'm hoping someone can suggest some ideas or tricks on how to "off-center" these model views in OpenGL.  Thanks!

sentences:
How to get more than one window in Java LWJGL I'm trying to write a game in Java LWJGL. And I need more than one (multiple) display window. By default I've got one display window where I can draw everything. But I'd like to split some data to other window. Any one know a way or tutorial to achieve this?

Regards.

sentences:
Extract derived 3D scaling from a 3D Sprite to set to a 2D billboard I am trying to get the derived position and scaling of a 3D Sprite and set them to a 2D Sprite.

I have managed to do the first part like this:

        var p:Point = sprite3d.local3DToGlobal(new Vector3D(0,0,0));
        billboard.x = p.x;
        billboard.y = p.y;

But I can't get the scaling part correctly. I am trying this:

        var mat:Matrix3D = sprite3d.transform.getRelativeMatrix3D(stage); // get derived matrix(?)
        var scaleV:Vector3D = mat.decompose()[2]; // get scaling vector from derived matrix
        var scale:Number = scaleV.length;
        billboard.scaleX = scale;
        billboard.scaleY = scale;

...but the result is apparently wrong.

PS. One might ask what I am trying to achieve. I am trying to create "billboard" 3D sprites, i.e. sprites which are affected by all 3D transformations except rotations, thus they always face the "camera".

sentences:
Pathfinding in 3d voxel: waypoints? I have an application where I have a 3d collision voxel space (passable or non-passable at each point) and I want to plot a short unobstructed path between two points.  There are no gravity constraints, so the shortest unobstructed path is a straight line between two points.

I know that A* can be generalized to 3-space, but this is a bit slow for my purposes.  In my particular application, the collision space changes infrequently and there is a finite number of permutations, so what I'd like to do is automatically pre-process the voxel and generate a set of 'waypoints' with the following properties:

Each waypoint has a set of connected waypoints; the straight line path between any two connected waypoints is unobstructed.
For every passable point in space, there is an unobstructed straight line path to at least one waypoint.  I'll probably store a lookup table to make this easy to find.
Ideally, the waypoints are generated so that the paths are still reasonably close to optimal, but I don't need to find the absolute optimal path.

If it's relevant, my collision space mainly consists of a few large contiguous 'blobs'; all empty spaces should be accessible, but the 'blobs' do have concave areas and holes allowing passage.  Also, since I'm precomputing this, I can live with relatively long running times (though I'd prefer an upper bound of minutes, rather than hours or days.)

Is there a well-known algorithm for doing this?  My first thought is some sort of repeated A* for random point pairs and looking for 'choke points' (regions through which a lot of paths go), but I'm guessing this is a problem that has already been studied.

sentences:
Segmentation Fault using Allegro_Tiled, function al_open_map(); I have consistently segfaulted trying to load a TMX file into a *map.

int main(int argc, char *argv[])
{
    ALLEGRO_DISPLAY *display = NULL;
    ALLEGRO_EVENT_QUEUE *event_queue = NULL;
    ALLEGRO_TIMER *timer = NULL;
    ALLEGRO_KEYBOARD_STATE keyboard_state;
    ALLEGRO_MAP *map = al_open_map("data/maps", "TestMap.tmx");
...

Active debugger config: GDB/CDB debugger:Default
Building to ensure sources are up-to-date
Selecting target:
Debug
Adding source dir: /home/X/Desktop/Programming/C/AllegroRoboticsTest/
Adding source dir: /home/X/Desktop/Programming/C/AllegroRoboticsTest/
Adding file: /home/X/Desktop/Programming/C/AllegroRoboticsTest/bin/Debug/AllegroRoboticsTest
Changing directory to: /home/X/Desktop/Programming/C/AllegroRoboticsTest/.
Set variable: LD_LIBRARY_PATH=.:/usr/local/lib:/opt/opencascade/lib
Starting debugger: /usr/bin/gdb -nx -fullname -quiet  -args /home/X/Desktop/Programming/C/AllegroRoboticsTest/bin/Debug/AllegroRoboticsTest
done
Setting breakpoints
Debugger name and version: GNU gdb (GDB) 8.1
Program received signal SIGSEGV, Segmentation fault.
In al_get_standard_path () (/usr/lib/liballegro.so.5.2)
#2  0x00005555555563ba in main (argc=1, argv=0x7fffffffe3a8) at /home/X/Desktop/Programming/C/AllegroRoboticsTest/main.c:45

At first I thought, maybe I just didn't build the library right, so I rebuilt it 2 more times, once as a static and another as a shared library.

The interesting thing is that it builds just fine when using the cmake files that came in the example.

I cannot recreate it though.

This is the callback after I moved the open map command into it's usual place, directly from the example that comes with allegro_tiled.

// If MAP_FOLDER is relative to the working directory and not the running
// executable, then add a call to `al_find_resources_as(RELATIVE_TO_CWD);`
// before calling `al_open_map()`.
//al_find_resources_as(RELATIVE_TO_CWD);
map = al_open_map("data/maps", "TestMap.tmx");
int map_total_width = al_get_map_width(map) * al_get_tile_width(map);
int map_total_height = al_get_map_height(map) * al_get_tile_height(map);

// Draw the map
al_clear_to_color(al_map_rgb(0, 0, 0));
al_draw_map_region(map, map_x, map_y, screen_width, screen_height, 0, 0, 0);
al_flip_display();

   ...
   Setting breakpoints
   Debugger name and version: GNU gdb (GDB) 8.1
   Child process PID: 25749
   In ____strtoll_l_internal () (/usr/lib/libc.so.6)
   #3  0x0000555555556615 in main (argc=1, argv=0x7fffffffe3a8) at /home/X/Desktop/Programming/C/AllegroRoboticsTest/main.c:114

sentences:
std::map for storing static const Objects I am making a game similar to Minecraft, and I am trying to fine a way to keep a map of Block objects sorted by their id. This is almost identical to the way that Minecraft does it, in that they declare a bunch of static final Block objects and initialize them, and then the constructor of each block puts a reference of that block into whatever the Java equivalent of a std::map is, so there is a central place to get ids and the Blocks with those ids.

The problem is, that I am making my game in C++, and trying to do the exact same thing. In Block.h, I am declaring the Blocks like so:

//Block.h
public:
    static const Block Vacuum;
    static const Block Test;

And in Block.cpp I am initializing them like so:

//Block.cpp
const Block Block::Vacuum = Block("Vacuum", 0, 0);
const Block Block::Test = Block("Test", 1, 0);

The block constructor looks like this:

Block::Block(std::string name, uint16 id, uint8 tex)
{
//Check for repeat ids
if (IdInUse(id))
{
    fprintf(stderr, "Block id %u is already in use!", (uint32)id);
    throw std::runtime_error("You cannot reuse block ids!");
}
_id = id;
//Check for repeat names
if (NameInUse(name))
{
    fprintf(stderr, "Block name %s is already in use!", name);
    throw std::runtime_error("You cannot reuse block names!");
}
_name = name;

_tex = tex;
//fprintf(stdout, "Using texture %u\n", _tex);

_transparent = false;
_solidity = 1.0f;

idMap[id] = this;
nameMap[name] = this;
}

And finally, the maps that I'm using to store references of Blocks in relation to their names and ids are declared as such:

std::map<uint16, Block*> Block::idMap = std::map<uint16, Block*>(); //The map of block ids
std::map<std::string, Block*> Block::nameMap = std::map<std::string, Block*>(); //The map of block names

The problem comes when I try to get the Blocks in the maps using a method called const Block* GetBlock(uint16 id), where the last line is return idMap.at(id);. This line returns a Block with completely random values like _visibility = 0xcccc and such like that, found out through debugging.

So my question is, is there something wrong with the blocks being declared as const obejcts, and then stored at pointers and accessed later on? The reason I cant store them as Block& is because that makes a copy of the Block when it is entered, so the block wouldn't have any of the attributes that could be set afterwards in the constructor of any child class, so I think I need to store them as a pointer.

Any help is greatly appreciated, as I don't fully understand pointers yet. Just ask if you need to see any other parts of the code.

sentences:
Pause Tiled animation during game in LibGDX I’m using Tiled with LibGDX and I have some animated tiles. When the game is paused I would like their animation to be paused as well. Is this possible?

The map is drawn with mapRenderer.render() and if I'm not mistake, this is the class responsible for getting the corresponding animation. There doesn't seem to be a way to freeze time. Any help appreciated, I've been searching for a couple of hours and cannot find anything.

sentences:
Android Game Development. Type Usage for Entity Positions I've recently started developing on Android and have made some basic apps. I now wish to start development on a game project. I have intermediate skill in Java and will be developing with that language in mind. I also have made a couple games for PC in java before. I will be using Native Android Studio for development and not an Engine/Framework.

My question is what is the preffered way to store object positions in Android for a 2D GAME.
The options I have right now are listed below:

Int (Very basic, not precise)
Float
Double
Custom Vector ADT
Other native Android Type.

sentences:
Transitioning Heightmaps Using Voronoi Cells I'm partitioning a procedurally generated world into regions using voronoi noise. The goal is to create individual regions in a world each unique from each other. Each region has a distinct set of properties, one of which is having a procedurally generated heightmap.
The issue I am having is transitioning from one region's heightmap to another. Each region's heightmap  is composed of multiple 'layers' of simplex fractal noise. Because the regions are using voronoi cells, and each region has its own distinct heightmap, they do not smoothly transition into each other.
Any guidance on how to solve this issue would be greatly appreciated!

sentences:
Repeating a background texture forever in libgdx My "game" works with a pretty large playing field, so I need a repeating background. I've implemented this the following way:

Loading:

assetManager.get("texture_bg.png", Texture.class).setWrap(Repeat, Repeat);
bgRegion = new TextureRegion(assetManager.get("texture_bg.png", Texture.class));
bgRegion.setRegion(0, 0, 16384, 16384);

Drawing:

batch.draw(bgRegion, 0, 0);

This does as expected: Creates a background of 16384 by 16384 pixels from a 512x512px texture. But now that I'm getting further in the testing, I foresee running out of space quickly almost no matter what I set the region to.

Is there a way I can have it simply repeat forever and not specifying a finite number?

sentences:
Interrupt on behaviour tree I'm using a custom Behaviour Tree library (not UDK or any other engine) so I'm wondering on the best way to cause an interrupt to a currently running node. I don't have decorators or parallel nodes in this library so looking for a different way to do it. I don't care about the specific reasons as to why the interrupt is needed. In general it just needs to tell the currently running node to stop running so the tree can be transversed again and that would find out the reason as the main "threats" would be checked.

I'm trying to think of a clean way to cause such interrupts in the tree. Generally the conditions that are already in the tree would be the reason for the interrupt (IsEnemyInRange,  IsThirsty, IsHungry, etc) but if a node is running over multiple frames these don't get checked.

Any ideas given the above limitations I listed?

sentences:
What OpenGL version(s) to learn and/or use? So, I'm new to OpenGL... I have general knowledge of game programming but little practical experience.

I've been looking into various articles and books and trying to dive into OpenGL, but I've found the various versions and old vs new way of doing things confusing.

I guess my first questions is does anyone know some figures about percentages of gamers that can run each version of OpenGL. What's the market share like? 2.x, 3.x, 4.x...

I looked into the requirements for Half Life 2 since I know Valve updated it with OpenGL to run on Mac and I know they usually try to hit a very wide user-base, and they say a minimum of GeForce 8 Series. I looked at the 8800 GT on Nvidia's website and it listed support for OpenGL 2.1. Which, maybe I'm wrong, sounds ancient to me since there's already 4.x. I looked up a driver for 8800GT and it says it supports 4.2! A bit of a discrepancy there, lol.

I've also read things like XP only supports up to a certain version, or OS X only supports 3.2, or all kinds of other things. Overall, I'm just confused as to how much support there is for various versions and what version to learn/use.

I'm also looking for learning resources. My search results thus far have pointed me to the OpenGL SuperBible. The 4th edition has great reviews on Amazon, but it teaches 2.1. The 5th edition teaches 3.3 and there are a couple things in the reviews that mention the 4th edition is better and that the 5th edition doesn't properly teach the new features or something? Basically, even within learning material I'm seeing discrepancies and I just don't even know where to start.

From what I understand, 3.x started a whole new way of doing things and I've read from various articles and reviews that you want to "stay away from deprecated features like glBegin(), glEnd()" yet a lot of books and tutorials I've seen use that method. I've seen people saying that, basically, the new way of doing stuff is more complicated yet the old way is bad   >.>

Just a side note, personally, I know I still have a lot to learn beforehand, but I'm interested in tessellation; so I guess that factors into it as well, because, as far as I understand that's only in 4.x?

[just btw, my desktop supports 4.2]

sentences:
Using Canvas instead of Scaleform in UDK I'm working with Unreal Script, and I need to use Canvas instead of Scaleform to create a HUD.  I've extended the game type from UTGame, and used bUseClassicHUD in the Default Properties section, but the default Scaleform HUD continues to appear.  I know for certain that I have everything configured properly to load and run the scripts, but this one line just doesn't seem to have any effect.

DefaultProperties{

// Disable the scaleform (flash) HUD in the UTGame
bUseClassicHUD = true

// Initial score value
nScore = 0

// Initial time value
m_gameTimer = 30.0

}

Is there something else I need to include?  I've done a reinstall (I'm using the July 2013 build), but to no avail.

sentences:
How to create Button/Switch-Like Tile where you can step on it and change its value? If the player steps on a Button-Tile when its true, it becomes false. If the player steps on a Button-Tile when it is false, it becomes true.

The problem is, when the player stands on (intersects) the Button-Tile, it will keep updating the condition. So, from true, it becomes false. Because its false and the player intersects it, it becomes true again. True-false-true-false and so on.

I use ElapsedGameTime to make the updating process slower, and the player can have a chance to change the Button to true or false.

However, it's not the solution I was looking for. Is there any other way to make it keep in False/True condition while the Player is standing on the Button tile?

sentences:
How to include a new file js in a project cocos2d js? I'm trying to include a new js file containing a new scene on a cocos2d js project, but every time try occurs the following error:

  Uncaught ReferenceError: GameScene is not defined.

I included my file in jsList and in appList:

"jsList"        : ["src/game_scene.js"],
    "appFiles"      : ["src/game_scene.js"]

The code of my scene looks normal:

var GameScene = cc.Scene.extend({
    onEnter:function(){
        this._super();

        var gameLayer = new GameLayer();
        this.addChild(gameLayer);
    }
});

The code on app.js to call my scene looks good too:

var gameScene = new GameScene();
cc.Director.runScene(gameScene);

What should I do?

sentences:
Java 2d game cross-platform compatability I need to make a few small, simple 2d educational games primarily to help kids improve their reading. Drag & drop/matching words with pictures, spelling out words as well as maybe a scrolling shooter and some other things too. I also need these to run on multiple platforms (namely windows, osx, ipads and android).

If I do this with java (which I don’t currently know), is it possible to use the same code to create versions compatible with the above-mentioned platforms?

sentences:
Problem with FPS camera in Software Renderer I am currently creating a software renderer (I know they aren't particularly useful anymore, it is purely from a knowledge and learning standpoint). I am using GLM and following OpenGL rules(as GLM is designed for OpenGL).

It's currently pretty basic, just a cube being rendered as either a pixel for each vertex or as a wireframe. Everything was going fine with it till I implemented camera controls. The camera works fine until there is a model directly behind it in the world space. The model behind the camera will be rendered, but flipped (hard to tell which axis it has been flipped on due to it being wireframe). The controls for moving forward and back become inverted. If I put one object in front of the camera and one behind, they are both visible but when the camera moves forward one model moves closer while the other moves further away.

I am not sure if this is a bug or a limitation of the mathematics involved. From what I can tell it is a problem with the perspective division (which is being handled by GLM). It seems that when the camera crosses the Z of an object, it gets flipped. If I spin the camera around the object everything is fine, this only happens when the object is behind the camera. Is this likely to be a bug in my code, or is this normal and anything not in the camera's field of view needs to be culled to stop this happening? (I know things will need to be culled at some point for performance anyway).

The code is a mess at the moment so I am just cleaning it up so it is readable, in case this is likely a bug in my code.

sentences: Depth Stencil buffer mandatory? If I disable depth and stencil buffering, do I have to create and set the depth stencil buffer?

sentences:
Unity prefab functionality without files? Task

Display a UI list

Assumptions

Most UI parts only get their data during runtime
UI parts need to be styled in the editor (= before runtime)
UI editing should be done with real time preview in the editor
The items in UI list should look the same

Current solution

Save a list item prototype as a prefab (drag&drop in the editor)
Set that prefab as the reference in the script managing the list
During runtime, instantiate the referenced prefab as needed

However, this needs a prefab file, which seems like an unnecessary additional point of failure. Just one annoying example: More often than not I forget to click "Apply" after editing such a prototype - which only becomes apparent at runtime.

Suggested solution

In the script managing the list, set the list item prototype as a reference
On Awake(), create a prefab and store it in a class field
During runtime, instantiate the prefab from the class field

Question

I got the suggested solution working withPrefabUtility.CreatePrefab(). The only issue with that is that it still saves a prefab file. I currently just save those to a temp directory, but that is a workaround.
Is it possible to have a prefab which does not exist as a file, but still allows copying with Instantiate()?

sentences:
Rigging Skinning of human skeleton skin mesh scanned by MRI I have successfully developed a system in Qt/C++ for human musculoskeletal mocap simulations. I can run asf, amc, bvh motion capture files and can visualize the joint transformations. I even simulated the static rigid bones of MRI scanned meshes.

31 mesh bones were extracted from MRI data and each bone is assigned to *.asf skeleton bone id/name and parent and child relationship is created. I have absolute and relative transformations of each bone and the bone mesh vertices positions are also known.

Now there is a skin mesh over the skeleton bones. I want to do rigging/skinning of that skin mesh with the bone transformation. If a bone transforms, its skin mesh should be transforming too. Literature study tells us that, assign each vertex of its bone and assign some weight to each vertex, sum up all and multiple with the bone's transformation matrix, etc. etc. and find the new position of a vertex.

I have pretty much experience to play with meshes and transformations, I can do that. But here I do not get the concept, first of all, how can we assign vertex to its specific bone? because human skin is a continues with Only One Shell, do we assign by computing the offset/minimum distance from bone to skin? Second question is how do we compute weight for each vertex? Because this mesh is not exported from MAYA or some 3D softwares, where each vertex is assigned with a weight value, but this is a static rigid mesh with no precomputed information. Third question comes to mind that how can we know that this specific vertex should be transforming with the transformation of Foot for example? How do we know that this vertex is a Foot vertex?

I want to have some concepts about the methodology, please guide me.

Thanks.

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:
Poor image quality on Android through Unity Remote I have started to work on the company's latest project using Unity3D and the workflow is just awesome.

The problem is when running the game on a real Android device (using Unity Remote) the image quality is very poor in comparison to how it looks in the editor:

(Click for a full view. Look at those sprite edges.)

Is this...

caused by the phone's limited graphics capabilities
or have I configured the project improperly
or is it Unity Remote and actually building it for Android will fix the quality? (Based on Unity Answers site, Unity Remote is the cause : http://answers.unity3d.com/questions/408896/android-image-quality-is-poor-compared-to-the-qual.html#comment-408945)

sentences:
Algorithm to produce a 2D 'flying through space' effect like the old Windows screen saver I am old. My high school maths is a long way in my past and I am struggling to devise an algorithm that will produce a 2D 'flying through space' effect like the old Windows screen saver.  It has—

stars generated close to the screen centre, which move outwards at increasing speed, and
on a key press, a hyperspace effect is generated with the stars turning to lines stretching to the edge of the screen.

I've figured out that I can use arctan and x,y offsets from screen centre to identify a direction, but given that the trig functions work in a 90 degree field. My old brain is struggling to pull it all together.

How can I create this effect?

sentences:
Unity crashes when opening a project Why does this happen?

I'm new to Unity development. I have installed Unity yesterday (2015-09-06). This is the error that I get:

sentences:
How to correct shooting in touch-screen shooting games? Assume a shooting game for iPhone that the character shoot toward where player has touched.

But as we know, There may be fault in touching screen by player and it conclude to bad game play and low fun.

So, How can I correct shooting method ?

sentences:
Efficient update of instance data for instance rendering I started implementing instanced rendering in my 3D engine, but I quickly stumbled upon some issues that I'm not sure whats the best practice to work around.

When I setup my scene, I capture the amount of instances for every mesh and I write the transformation matrices first into a dynamic list and finally into an "instance buffer" (UBO) which is sent to the shaders and indexed by gl_InstanceID to fetch the correct transform. This is working perfectly.

So when I apply frustum culling per instance, what I do now is that once I found out that an instance should be culled, I remove this transformation matrix from the dynamic list and therefore I keep the transformation matrices of just the active instances which end up getting drawn from the glDrawElementsInstanced.

Obviously inserting and removing elements from this dynamic list is expensive and I want to get rid of it. So I was thinking that I'll implement a fixed length list this time consisting of per-instance structs to hold instance data something like this:

struct InstanceData {
    float worldMatrix[16];
    bool isOccluded;
    /* and more */
};

However this leads to another problem. In this case, since the draw call will render a fixed amount of instances all the time, regardless if they are visible or not, I'll have to discard the vertices in the shader, and I don't think that this is optimal either.

I've thought of other ways as well, such as sorting the instances based on their occlusion status on every frame, but then I'll have to pay the price for the sorting.

Is there any common practice to deal with instanced data? I fear that I should experiment with all the options and find what suits me best x.x

Thanks in advance

sentences:
Shooting projectiles towards mouse position in Unity 2D I'm currently creating a scrip that handles the projectile movement and it's almost where I want it to be. Currently the script correctly instantiates the projectiles, moves the projectiles towards the mouse and deletes them off screen, but the speed of the projectile is not constant (faster or slower depending on how close the mouse is to the player) and after the projectile is fired, it follows the position of the mouse until it flies off screen.

public class LetterController : MonoBehaviour {
    private List<GameObject> letters = new List<GameObject>();
    public GameObject letterPrefab;
    public float letterVelocity;
    Vector3 direction;
    void Update()
    {
        direction = Input.mousePosition;
        direction.z = 0.0f;
        direction = Camera.main.ScreenToWorldPoint(direction);
        direction = direction - transform.position;
        if (Input.GetMouseButtonDown(0))
        {
            GameObject letter = (GameObject)Instantiate(letterPrefab, transform.position,Quaternion.identity);
            letters.Add(letter);
        }
        for (int i = 0; i < letters.Count; i++)
        {
            GameObject goLetter = letters[i];
            if (goLetter != null)
            {
                goLetter.transform.Translate(direction * Time.deltaTime * letterVelocity);
                Vector3 letterScreenPosition = Camera.main.WorldToScreenPoint(goLetter.transform.position);
                if (letterScreenPosition.y >= Screen.height || letterScreenPosition.y <= 0 || letterScreenPosition.x >= Screen.width - 20 || letterScreenPosition.x <= -20)
                {
                    DestroyObject(goLetter);
                    letters.Remove(goLetter);
                }
             }
          }
       }
   }

I tried moving everything from Update() into a separate function called Shoot() and called that from Update(). I tried putting Vector3 direction in its own Vector3 function and calling it in goLetter.transform.Translate. I also tried using LateUpdate(). Nothing I've tired has made any significant changes to how the projectile interacts in Unity. I'd like to have the projectiles move at a constant speed and not follow the cursor but rather travel in a straight line anyone got any clues?

sentences:
XNA Games running on Windows 8 Will Games developed on XNA work under a Windows 8 environment?

I know the XNA project was killed off, and you can't develop it on Windows 8 (apparently), but will they still work under windows 8? I don't care about metro integration or whatever, even if they run in desktop mode that's fine.

I've been looking around and finding a bunch of contradictory answers - so maybe I can get a clear one from here.

sentences: What game engine should I use to mock around? I'm a software engineer student (about to start my 2nd year) and I did really enjoy last years object-oriented programming and working with Java (greenfoot and later eclipse) to make simple games. I would really like to delve deeper in to software development and can't wait for 2nd year of college to start ,so I mocked a bit in eclipse and boy writing all of the game engine is hard and takes a lot of time, so maybe anyone knows an easy game engine just to mock around and explore game development for fun ?

sentences: What are the tools required to learn in order to create atari 2600 Games I am a beginner in C++ and i would like to learn how to  create a clone of an Atari 2600 game and using an emulator allow it to run on my current PC. my question is what programming language do i need to know in order to get started, i am aware assembly maybe required but i do not have any background in assembly. so if someone could give me a briefing on the process or point me to the starting point i would appreciate it greatly. i apologize upfront if the question is not constructive.

sentences:
Particle effect in sprite I want to create a particle effect when my player sprite collide with my star sprite. How can I add a particleSystem in the sprite and not in a image?
Also, I wish if it could wait for the animation for some miliseconds, and then remove the star sprite.

This is my code:

- (BOOL)ccPhysicsCollisionBegin:(CCPhysicsCollisionPair *)pair starCollision:
    (CCNode *)star playerCollision:(CCNode *)_player {
    NSLog(@"----------Colisao---------");

    //update score
    score += 1;
    [scorelabel setString: [NSString stringWithFormat:@"score: %d",score]];
    NSLog(@"score %d", score);

    CCParticleSystem *particleSystem = [[CCParticleSpiral alloc] initWithTotalParticles:1000];

    [self addChild:particleSystem];
    //[particleSystem release];
    //[particleSystem setTexture:[[CCTextureCache  sharedTextureCache] addImage:@"star.png"];

    //remove stars
    [star removeFromParent];
    return YES;
}

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:
Is there any difference between the reading of sensors in Unity5 and Android/Java? I'm an Android/Java developer, and I'm new to unity5. I have a program written in Android/Java that uses the readings of three sensors( Accelerometer, Magnetometer and LinearAccelertion ).

I'm now developing my first game in unity5, and I want to use the algorithm that uses the three sensors readings in my game.

In Android/Java, sensors readings are normally row data, which means that I must make some calculations on these data to be able to use them in my program.

Do I also have to make these calculations in unity5? Are the reading of sensors in Android/Java and unity5 the same or different?

If they are different, how can I use them?

sentences:
Why do XNA/Monogame models create new BasicEffect instances? My question is fairly straightforward, I think. Using Monogame, when I load a model using contentManager.Load<Model>("Model"), the model's mesh has a BasicEffect attached. That means that if I load multiple models, I'll have multiple BasicEffect instances created, which seems wasteful. Based on other questions I've seen here (and based on instinct), I shouldn't need multiple effects for rendering simple models, but those effects are created by the content pipeline when the model is imported.

How do I resolve this problem? Is there a way to tell Monogame to not create effects on load, or do I have to override the effects created by the models manually? Is there something I'm missing in my logic?

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:
Did old games like Golden Axe or Street or Rage use tilemaps? I am wondering if old games like Golden Axe (genesis) or street of Rage (genesis) used tilemaps or background bitmaps for the levels.

I could not find any resource that explain this and searching around in the web I can find background images, but I never found any tilemap for the levels. This off course, does not answer the question, but it looks like they used background bitmaps for the entire level.

But I am not sure if it was practical for those old consoles to store such "big" images and render those.

Does anyone knows a bit of programming on those old systems and knows how those "perspective" levels were built?

sentences:
Do Apple and Google ask for a share if custom payment is done in a free app? I have a multiplatform game (web/iOS/Android) in the making. In the free version the core game is still fully playable but people who choose to pay will get more social features (and no ads, of course).

I was thinking that rather than having a free and a paid version for all the platforms I may release the apps just for free and if the users want more, they have to register and pay a one-time fee (through a payment gateway or PayPal). The extra content would then be available in all the clients they have access to. Theoretically, this means a better value for the players and less maintenance and headache for me (obviously I have to handle all the payment troubles myself).

Does it fit into the business model of Apple/Google? Or will they still claim their share of the registration fee?

sentences: How to check if two normals/directions "look at" each other? I need to flip polygons in my application. How do I determine if two vectors face each other, like in the second image below? Note that the origin of the vectors is also important, in addition to the direction.

sentences: Future of Julia in game development industry I read in many posts that Julia is faster than many languages especially C++, What's the future of Julia in game development industry ? Will it replace all legacy C++ ?

sentences:
Is it possible to prevent the collider 2D outline from hiding in Unity? Is it possible to prevent the collider 2D outline from hiding in Unity?
I am creating some animations in Unity. To create animations I select different parts of a hero and move them frame by frame. Now I am working on the run animation and would like to see the bottom collider during parts movement for the animation creation.
In my case the collider outline is red:

I don't want the red bottom line (which is the collider outline) to disappear while I am creating animations. Should I research the Unity extensions and maybe write my own which would prevent the collider from hiding or is it possible to achieve what I want out of the box somehow?

sentences:
UnrealScript access variable in one class from another? So there are some similar questions out there but the responses often say that you should use 'new' or 'spawn', but I'm working with the playercontroller don't want to make a new playercontroller.  Maybe this isn't the right way to be doing this but I want to view the state of a variable in the playercontroller that will change fairly often from my HUD.  Is there a way to do this?

playercontroller class

var bool bYeaNo;

exec function change() {
  bYeaNo= !bYeaNo;
}

defaultproperties
{
  bYeaNo = false
}

HUD class

event PostRender() {
  Super.PostRender();
}

function DrawHUD() {
  Super.DrawHUD();
  Canvas.SetDrawColor(0, 0, 0);
  Canvas.SetPos(25, 25);

  if (bYeaNo) { //this is wrong so what would make this work?
    Canvas.DrawText("Yea");
  } else {
    Canvas.DrawText("No");
  }
}

sentences:
clamp a 2D coordinate to fit within an ellipse I need to clamp a 2D coordinate to fit within an ellipse.

Call of Duty: Modern Warfare 2 does something similar where capture points are translated from a 3D vector in the world to a 2D screen coordinate and then the 2D coordinates are clamped within an ellipse.

When the capture points are in view they're within the bounds of the ellipse.

When they're behind you they are clamped to be within the bounds of the ellipse.

Given a 2D coordinate that could be off screen, etc, what is the math behind clamping it within an ellipse?

sentences:
Rotation based on x coordinate and x velocity? -(void) accelerometer:(UIAccelerometer *)accelerometer didAccelerate:(UIAcceleration *)acceleration
{

float deceleration = 0.3f, sensitivity = 8.0f, maxVelocity = 150;

// adjust velocity based on current accelerometer acceleration
playerVelocity.x = playerVelocity.x * deceleration + acceleration.x * sensitivity;

// we must limit the maximum velocity of the player sprite, in both directions (positive & negative values)
playerVelocity.x = fmaxf(fminf(playerVelocity.x, maxVelocity), -maxVelocity);

}

Hi, I want to rotate my sprite based on the velocity and accelerometer input. My sprite can move along the X axis like so:

<--------- sprite ----------->

But it always faces forwards, if it is moving left I want it to point slightly to the left, the degree of how far it is pointing to be judged from the velocity. This should also work for the right.

I tried using atan but as the y velocity and position is always the same the function returns 0, which doesn't rotate it at all.

Any ideas?

Regards,

Lewis.

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:
Vertex shader in OpenGL/GLSL - transformation of the interior of a textured quad I have a LWJGL project and ran into a problem with a vertex shader I wrote.
In my scene I am rendering a map whose ground consists of rectangular tiles.
On top of that there are other objects (I used tiny white balls here).
Here is a screenshot of my scene:

screenshot of my scene http://110.imagebam.com/download/0-Ktu6XjdWSMpKytTr3Trg/34736/347358711/scene_static.jpg

You can also click here to see the image.

Each of the four larger rectangles at the bottom is one huge quad drawn in one piece.
Every one of them contains four coordinates (the corners: top-left, top-right, bottom-right, bottom-left).
Their interior is filled with a texture.

The small white balls on top are single game objects each drawn by itself.
Note that I aligned them with the vertical edges of the underlying rectangles.

I used the following vertex shader to render the scene:

/* default shader */
#version 120

void main()
{
    gl_TexCoord[0] = gl_MultiTexCoord0;
    gl_Position = gl_ModelViewProjectionMatrix * gl_Vertex;
}

Now imagine the scene getting covered with water.
I modified the shader adding a little water effect:

/* water shader */
#version 120

uniform float amplitude;
uniform float phase;

void main()
{
    gl_TexCoord[0] = gl_MultiTexCoord0;

    // transform x
    vec4 a_position = gl_Vertex;
    a_position.x = a_position.x + amplitude * sin(phase + a_position.x);

    gl_Position = gl_ModelViewProjectionMatrix * a_position;
}

An animated image of my scene can be found here or here.

You can see that the borders of the rectangles keep aligned with the white balls on top of them. However, vertices inside the rectangles (I marked the most distinct areas red) suffer a displacement relative to the white balls. In the last rectangle you can even see the balls cross the white line in the middle.

I need the interior of my textured rectangles to be transformed exactly like the white balls on top and move uniformly when being animated by my shader.
Please let me know if my problem is clear and if any other information is needed.

Thank you very much for your help.
Greetings Xoric

sentences:
Get color array with alpha for an image in java I can get the pixel array like this:

int[] pixels = image.getRGB(0, 0, width, height, null, 0, width);

But it ignores the alpha channel, I only get the rgb (I'm reading a PNG image). How can I get the alpha channel too?

sentences:
How can I implement persistent state for objects defined in a level? I am developing a 2D Metroidvania which consists of a series of interconnected levels that can be revisited.

Each level is represented by a Tiled TMX file in which I have specified where various objects of different sprite classes spawn (for example, enemies, pickups, levers, etc.). When starting a new game, loading a saved game, or changing a level, my game loop runs through the appropriate TMX file and generates all the objects in that level.

I handle level changes in the following way: If the Player object intersects a Portal object, a change_map() method is called which loads a new map (the one associated with the intersected portal) and positions the player at the appropriate position on the new map.

Some of my objects have states which I would like to be persistent through level changes and saving and quitting the game. For example, if a player unlocks a door and the state attribute of the door is set to "open," I would like the door to be open when the player returns. I want something similar for levers, which can be set to left or right, and various other objects. Further, the player will sometimes have collected items which I do not want to respawn when the player revisits the area.

My question is thus how can I handle this kind of persistence?

I am working in Python, although I think you can abstract away from that.

sentences:
XNA Float values don't work as parameter With the Microsoft XNA Framework I can change the color of a tinted texture by changing it's integer values like so:

Int x = 255;
if(true) { x--; tint = new Color(x, 255, 255); }
Draw(texture, Vector2.Zero, tint);

If x were a float however the appearance of the sprite wouldn't change until the value x became zero. With integer the texture fades over time with the event change.

Why is this? :S

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:
What are "distance fields" and how are they applicable to collision detection? I was looking at some efficient methods for collision detection in a scene with both static and dynamic objects when I came across "distance fields."

I tried to search and understand this concept, but I could only find papers written in very complex language. Can someone explain in easy words what distance fields are and how can they be used for collision detection?

sentences:
Bullet Physics - Collision not working when moving btBvhTriangleMeshShape I have a robot (btTriangleMeshShape for each component) and a chain of boxes used as a cable, which is anchored on two components of the robot. I want to rotate a robot component and when this happens, I want to twist/ roll the cable on that component. The problem is - when i rotate a robot component, collision does not work anymore with that component.

I cannot use btHullShape because of the lack of accuracy, neither btGimpact because of the complexity of computations (which gives a really unsatisfying performance). I couldn't improve enough any of these two shapes, so that is why I use btTriangleMeshShape and rotate it by code.

Also, I have replaced the btTriangleMeshShape of the rotating component with a simple static box and rotate the box. Using the box shape, collision is working with that box.

So the problem of collision not working is only when trying to rotate a (static) btTriangleMeshShape.

Here is the code I use to rotate the static body, although I don't think it's necessary (it works for box shape, not for triangle mesh shape):

   btTransform tr = m_dynamicsWorld->getCollisionObjectArray()[7]->getWorldTransform();
   static float angle = 0.f;
   angle += 0.1f;
   tr.setRotation(btQuaternion(btVector3(1, 0, 0), -angle));
   m_dynamicsWorld->getCollisionObjectArray()[7]->setWorldTransform(tr);

   m_dynamicsWorld->updateAabbs();
   m_dynamicsWorld->computeOverlappingPairs();

I have to mention that I've searched the web before and couldn't find any solution and also I'm a newbie on Bullet Physics and any graphic libraries.

Any help would by really apreciated,

sentences:
Instances in the Unity Profiler Timeline What do Instances mean when you click on an operation in the Timeline section of Unity Profiler?

In this example:

  Total: 11.90 ms (10 Instances)

sentences:
Best physics engine for OpenGL ES (different implementations)? Can you recommend a good physics engine which is easily portable between WebGL and other OpenGL ES implementations like in Android and iPhone?

I don't want a game engine. Only the physics part.

sentences:
Is there a generic name for the "layered" dictionary typically used in mod-capable games? I'm asking here rather than on SO/SE/CS because I'll probably have less to explain what I'm talking about...

I hope a lot of the users here are familiar with how many games implement modding (or sometimes even their own add-ons, levels etc.) Conceptually, what I've seen most often is a data structure that acts like a layered dictionary. With no mods, there's lookup in the base dictionary layer; whenever a mod is added/enabled, it comes with its own dictionary layer from which lookups are served first, with fallback to the underlying layers if a key is not found. (Note that I'm not talking about a nested dictionary.)

So, my question is simply if there's a generic name for this data structure. (Googling for "layered dictionary", which is how I dubbed it, doesn't turn up anything useful...) In the world of file systems, the closest thing that probably resembles it is a union mount. Alas "union dictionary" doesn't get any useful results either... (Also the word "union" is rather misleading in this context because there's an order in the layers of a "union mount".)

Added: By the way, I'm not asing how to implement it, as that's rather obvious from the description. Perhaps that's why no name have been devised for it... Also most game engines I've seen implement multi-layer (not just two) and some allow the (top) layers to be removed at any time so you can do (game) "levels" that way; others require an engine restart so it's only usable for "global mods", i.e. they optimize lookup time by "flattening" the layers down to one as they are added, which is basically why they need an "engine restart" to remove a layer.

Also, it seems the R (statistical) programming language basically has this its get functions:

  These functions look to see if each of the name(s) x have a value bound to it in the specified environment. If inherits is TRUE and a value is not found for x in the specified environment, the enclosing frames of the environment are searched until the name x is encountered.

So I guess something like "environments and their enclosures" is one term...

sentences:
How to prevent weapon clipping WITHOUT camera stacking? This is a FAQ, and answers involve camera stacking. I am not using a SRP. I do not want camera stacking as various post-processing instructions (e.g. FXAA, MSAA, etc) are all done on the active camera, and redoing all these instructions on multiple camera would be costly

Is there any way to prevent weapon clipping through walls without using camera stacking or a SRP?

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:
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:
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:
How to calculate directional light frustum from camera frustum I'm playing around with OpenGL for a few weeks now.

For the following screenshot I picked the glm::ortho values for my lightsource by trial and error. There are two directional light sources with shadows.

I would like to calculate the values for glm::ortho by creating a bounding box around the camera frustum.

I have the corners of the camera frustum in world space ... what is the next step?
I think I should move the camera frustum into light space, calculate the bound box and put the dimensions of that bounding box into glm::ortho. But ... how? :)

The block below is a simplified version of my code with only one light source.

// Camera
mat4 cameraViewMatrix = lookAt(
    vec3(1.2f, 1.2f, 1.2f),
    vec3(0.0f, 0.0f, 0.0f),
    vec3(0.0f, 0.0f, 1.0f)
);

mat4 cameraProjectionMatrix = perspective(45.0f, 800.0f / 600.0f, 0.5f, 10.0f);

// Light
mat4 lightViewMatrix = lookAt(
    vec3(3.0f, -2.0f, 2.0f),
    vec3(0.0f, 0.0f, 0.0f),
    vec3(0.0f, 0.0f, 1.0f)
);

// Camera Frustum
vector<vec4> cubeNDC;
cubeNDC.push_back(vec4(-1.0f, -1.0f, -1.0f, 1.0f));
cubeNDC.push_back(vec4(1.0f, -1.0f, -1.0f, 1.0f));
cubeNDC.push_back(vec4(1.0f, -1.0f, 1.0f, 1.0f));
cubeNDC.push_back(vec4(-1.0f, -1.0f, 1.0f, 1.0f));
cubeNDC.push_back(vec4(-1.0f, 1.0f, -1.0f, 1.0f));
cubeNDC.push_back(vec4(1.0f, 1.0f, -1.0f, 1.0f));
cubeNDC.push_back(vec4(1.0f, 1.0f, 1.0f, 1.0f));
cubeNDC.push_back(vec4(-1.0f, 1.0f, 1.0f, 1.0f));

mat4 viewProjectionMatrixInverse = inverse(matProj * matView);

vector <vec4> cameraFrustum;
for(vec4 vertex: cubeNDC) {
    vec4 vertexTransformed = viewProjectionMatrixInverse * vertex;
    vertexTransformed /= vertexTransformed.w;
    cameraFrustum.push_back(vertexTransformed);
}

// Magic

mat4 lightProjectionMatrix = ortho(...);

Thanx for your help. :)

sentences:
Nested input in an event-driven system I am using an event-based input handling system with events and delegates. An example:

InputHander.AddEvent(Keys.LeftArrow, player.MoveLeft); //Very simplified code

However, I started wondering about how to deal with 'nested' input. For example in Half-Life 2 (or any Source game, really), you can pick up items with E. When you've picked up an item, you cannot fire with Left Mouse, but instead you throw the object. You can still jump with Space.

(I am saying nested input is where you press a certain key, and the actions you can do change. Not a menu.)

The three cases are:

Being able to do the same action as before (like jumping)
Not being able to do the same action (like firing)
Doing a different action entirely (like in NetHack, where pressing the open door key means you do not move, but select a direction to open the door in)

My original idea was to just change it after the input had been received:

Register input 'A' to function 'Activate Secret Cloak Mode'

In 'Secret Cloak Mode' function:
Unregister input 'Fire'
Unregister input 'Sprint'
...
Register input 'Uncloak'
...

This suffers from large amounts of coupling, repetitive code, and other bad design signs.

I guess the other option is to maintain some kind of input state system - perhaps another delegate on the register function to refactor out those numerous register/deregister into a cleaner place (with some kind of stack on the input system) or maybe arrays of what to keep and what not to.

I'm sure someone here must've encountered this problem. How have you solved it?

tl;dr How can I deal with specific input received after another specific input in an event system?

sentences:
Optimizing Draw calls in MonoGame Android platformer I am working on a 2D platformer that is in the final stages of optimization. I have a few different devices for testing, and I am trying to get the best possible framerate on the weaker ones.

On a Nexus 5 I get a constant 60fps, with an occasional hiccup.
On a Galaxy S4 I also get a good 55-60fps
On an original Galaxy S (Vibrant) The frames drop to about 20-25

My question is, given the tile system described below, what can I do to increase the FPS on low-end devices?
And granted the Galaxy S came out years ago, should I even worry about it?

My background consists of 3 scrolling parallax layers.

The world I am drawing in a viewport of 25x15 tiles, at a size of 32x32px per tile, with 3 layers each (32x32x3px).  The camera already culls tiles that are out of view. All tiles are found in one texture, and this is done in a single SpriteBatch call that locates the correct texture location for the tile layer. Code is below:

public void Draw(SpriteBatch spriteBatch, bool upsideDown)
{
    int startX = GetCellAtPixelX( (int)Camera.Position.X );
    int startY = GetCellAtPixelY( (int)Camera.Position.Y );

    int endX = GetCellAtPixelX( (int)Camera.Position.X +
        Camera.ViewportWidth );
    int endY = GetCellAtPixelY( (int)Camera.Position.Y +
        Camera.ViewportHeight );

    for (int x = startX; x <= endX; x++)
    {
        for (int y = startY; y <= endY; y++)
        {
            for (int z = 0; z < MapLayers; z++)
            {
                if ((x >= 0) && (y >= 0) &&
                    (x < MapWidth) && (y < MapHeight))
                {
                    // ...

                    /// The very last parameter in this draw call is
                    /// the draw depth. This draw format will arrange
                    /// layers from front to back (0 = front, 1 = back)
                    /// so we subtract 1 from the z-index as a decimal
                    /// to get the appropriate location:
                    ///     Background      -> 0.7
                    ///     Middleground    -> 0.6
                    ///     Foreground      -> 0.5
                    spriteBatch.Draw(
                        tileSheet,
                        CellScreenRectangle(x, y),
                        TileSourceRectangle(mapCells[x,y].
                            GetLayerIndex((TileLayers)z)),
                        Color.White,
                        0.0f,
                        Vector2.Zero,
                        effect,
                        0.7f - ((float)z * 0.1f)
                    );
                }
            }
        } /// End y loop
    } /// End x loop
}

As you can see, it's not very complex code.  I have checked if my Update calls are slowing the game down, but it's very clearly in the Draw function. When I leave out my call to world.Draw(), fps shoot up to about 50 on the Galaxy S. Also, if I draw only a single layer, I get better performance around 42-45 fps.

I can discard one layer if necessary, but I need at least 2 tile layers. How else can I speed up the draw calls?

I am using MonoGame for Android (XNA)

sentences:
How to eliminate screen jitter in Flash game? We made a flash game with a big screen size(1000x600), and the terrain graphic will jitter while the screen scrolling(that's, camera moving with player) continuously.

What's the root cause? Or if you know how to eliminate this problem, please tell me. Any help is appreciated.

UPDATE:

The map's size is more bigger than screen, e.g 6000x1200. And the map has more than one layer, generally it has 3 layers. Terrain is composed by tiles. And FPS is 24.

If the FPS is set to 60, things will be better. But any way, it should work well at 24 FPS. I'm not sure if it is a natural problem of flash player, because some times a terrain object(e.g a house) look like a little bit distorted.

sentences:
My 3D Shader wont render light direction correctly opengl/c++/glsl This is what I'm doing:

vertex shader:

#version 400
layout ( location = 0 ) in vec3 vertex_position;
layout ( location = 1 ) in vec3 vertex_normal;

uniform mat4 ModelViewMatrix; //model
uniform mat3 NormalMatrix; //transpose(inverse(model)))
uniform mat4 priv_mat; //projection*view*model

out vec3 normal;
out vec3 position;

void main()
{
  normal=normalize(NormalMatrix*vertex_normal);
  position=vec3(ModelViewMatrix*vec4(vertex_position,1.0));
  gl_Position=priv_mat*vec4(vertex_position,1.0);
}

fragment shader:

#version 400
in vec3 normal;
in vec3 position;

uniform vec4 LightPosition; // light position: vec4(0,0,0,1);
uniform vec3 LightIntensity;

uniform vec3 Kd;            // Diffuse reflectivity
uniform vec3 Ka;            // Ambient reflectivity
uniform vec3 Ks;            // Specular reflectivity
uniform float Shininess;    // Shininess

vec3 ads( ){
    vec3 n = normal;
    vec3 s = normalize( vec3(LightPosition) - position );
    vec3 v = normalize( vec3(-position));
    vec3 r = reflect( -s, n );
return
    LightIntensity *
    ( Ka +
    Kd * max( dot(s, n), 0.0 ) +
    Ks * pow( max( dot(r,v), 0.0 ), Shininess ) );
}

void main()
{
     gl_FragColor = vec4(ads(), 1.0);
}

But when I run it, I get this:

Where the light doesnt just come from the wrong spot, but it also doesnt change when I move the planet around, like so

The diffuse value somehow gets the wrong direction? According to the example given (page 90), the diffuse is calculated by getting the dot(s,n), where s is lightposition-position, and position is (viewmodelvertex_position). But like you can see, the result doesnt shade the direction correctly.

Solution: The answer was matrix confusion all along. The problem was the ModelViewMatrix, and that It didnt have to be multiplied with view before being sent to the shader. The rest is just correct. Basically I was putting the "position" in the wrong space. Not multiplying with view before sending to the shader fixes it.

sentences:
Execute a function for ten seconds and disable it for two seconds I have a particular function which I am calling in Update function.
For the first ten seconds, the function should get called in Update function, then it should get disabled for next two seconds, then again enable it for next ten seconds. This cycle should keep repeating? How can I execute it?

sentences:
What is the best way to display a cut scene? How do we show cutscene in the game? Currently I am using images and animation upon them to show cutscenes or story. I heard from my friend that showing a video might be one of the option too.
Is it a good option or is there any other option except those two? I'd also like to know pros and cons of each option if you can provide.

sentences:
Implementing camera for 2d side scroller game? I'm implementing a 2D side scroller for iOS (using C/C++ with OpenGL) (beat'em up style like double dragon/final fight ).

My scenes are composed of one cyclical background image ( the end of the image connects perfectly with the beginning ). This is to produce a cyclical scroll effect.

I was wondering how could I implement a camera that follows my player movement ?

( Resources / Links are greatly appreciated with explanations :) )

sentences:
How can I wait for all lines and instances to finish moving and then to destroy them? void Update()
    {
        if (animateLines)
        {
            counter++;
            for (int i = 0; i < allLines.Length; i++)
            {
                endPos = allLines[i].GetComponent<EndHolder>().EndVector;
                Vector3 startPos = allLines[i].GetComponent<LineRenderer>().GetPosition(0);
                Vector3 tempPos = Vector3.Lerp(startPos, endPos, counter / 500f * speed);

                allLines[i].GetComponent<LineRenderer>().SetPosition(1, tempPos);

                instancesToMove[i].transform.position =
                    Vector3.MoveTowards(startPos, endPos, counter / 25f * speed);
            }

            for (int i = 0; i < allLines.Length; i++)
            {
                if (instancesToMove[i].transform.position == endPos)
                {
                    DestroyImmediate(instancesToMove[i]);
                    DestroyImmediate(allLines[i]);
                }
            }
        }
        else
        {
            counter = 0;
            foreach (GameObject thisline in allLines)
            {
                thisline.GetComponent<LineRenderer>().SetPosition(1, thisline.GetComponent<LineRenderer>().GetPosition(0));
            }
        }
    }

When doing:

for (int i = 0; i < allLines.Length; i++)
                {
                    if (instancesToMove[i].transform.position == endPos)
                    {
                        DestroyImmediate(instancesToMove[i]);
                        DestroyImmediate(allLines[i]);
                    }
                }

It's destroying only some of the lines and instancestomove and then give the exception:

MissingReferenceException: The object of type 'GameObject' has been destroyed but you are still trying to access it.
Your script should either check if it is null or you should not destroy the object.

sentences:
How can a BabylonJS FreeCamera be rotated from code? Say I have a FreeCamera in a BabylonJS 3D world. How could I rotate that camera from program code? Or, more specifically, how might I bind camera rotation (not movement, which I know how to bind to WASD) to the arrow keys so that gamers without a mouse would not find it too troublesome to use? Is this even possible?

Thanks in advance!

sentences:
Snake AI - Is a Hamiltonian approach valid for all grid sizes? So, as has been done many times before, I am designing an AI that can play Snake as effectively as possible. It didn't take me long to find this extremely useful thread here: How to find a safe path for an AI snake?
 where the top answer first and foremost recommends forming a Hamiltonian circuit for the grid and begin by just having the Snake follow this route.

However, after attempting this, I realised it didn't work with my initial grid size (23x23), at least I don't think it does. My understanding may be incorrect, but from what I gather, with m rows and n columns, if mn is odd, then there is no Hamiltonian circuit possible. If this is the case, then should I abandon this method? Or is there any way of implementing it in some case?

sentences:
Set Non-Looping Animation Time to Seconds I have an animation that does not loop.  It plays for the default duration (n seconds), then stops on the last frame.  This is exactly what I want to have happen, but I want it to play for m seconds, not n seconds.  I do not know how long n seconds is.

I have to get it exactly to m seconds, because it is a changing variable.  So estimating will not work.  I need it to match up exactly with another animation.  How can I stretch an animation to last an exact number of seconds?

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:
ConcurrentDictionary as a main container for game objects? I wonder if it is wise to use ConcurrentDictionary as a main container in a game? That is it will be used to:

update every object inside it in a parallel.Foreach loop;
add (but not remove) objects inside it in a parallel.Foreach loop (sometimes while updating);
retreive data from the dictionary with a Linq query/ simply by index in sometimes a parallel loop, but mostly in the main thread;
remove data from it in a parallel loop (but NOT when updating objects) <- this step can be done in the main thread.

What could be the disadvantages of this list compared to HashSet (we are using the latter now, but we are only reading from it in parallel - when updating models). What lists are used in big engines?

sentences:
XNA Entity Component Design: Lost on how to include Sprite Animation I've been reading about Entity Component design and thought it's pretty neat.
I've been trying to write a quick 2D engine in XNA.

I think I've laid the proper groundwork for registering and updating entities, since I've created some "PositionComponents" that seem to work with my Camera Entity (an Entity that simply owns ZoomableComponent, PositionComponent, MouseInputComponent).

All the tutorials seem to however seem to end at this stage of design.
I'm pretty lose now on how I would like to design my animation/sprite components.

I know I want some sort of 'RenderableComponent' which you assign it a Texture
I need some sort of FSM (Finite State Machine) to hold Entity States
I need some sort of Animation Manager.

Does anyone have any tips?

sentences:
How to build a turn-based multiplayer "real time" server I want to build a TCG for mobile devices that is multiplayer over the web (not local wifi or bluetooth).  As a player plays cards I want the second player to see what is being played in "real time" (within a few seconds).  Only one player can play at a time.

Server requirements:
1) Continuously listens for input from Player 1
2) As it receives input from Player 1, sends the message to Player 2

I know some PHP, but it seems like unless I had a loop that continued until I broke it (seems like a bad idea) the script would just receive one input and quit.

On the mobile side I know I can open sockets using various frameworks, but what language allows a "stream-like" behavior that continuously listens/sends messages on the server?

Or if I'm missing something, what would be the best practice here?

EDIT: I might have not made it clear before, but the mobile apps are native not web-based.

I guess I'm asking for specific suggestions on what some of the best tools or platforms for this scenario could be used i.e., PHP sockets, etc.

sentences:
Add singleton to an existing gameobject in Unity via script I did notice that if I assign scripts that generate singleton classes (for my managers), to an empty game object, everything works fine.

Now I would like to start the scene with the empty game object, attach the main game manager singleton, and in the game manager singleton I would like to attach to it the other manager singleton classes.

Although I am not sure how you actually do so. Do you run addComponent to the main game manager, and they will be attached to the existing gameobject?

The gameobject that I use for the main gamemanager is set to not be destroyed on load; the doubt is if I should run addComponent on the scripts, or create a reference from the gamemanager script and instantiate it from there.

I did look for examples on the subject, but the only thing that I found is the reference to add a script to a game object; and I am not sure if that's actually what is supposed to be done.

sentences:
A view and projection matrix oddity? I have a bit of a dilemma ...
So i setup my scene how I want it with some bits in it and now I want to move all my camera related code in to a camera class however doing so is proving to be a pain in my ass.

So in my game code (my main game class) I have ...

    protected override void Initialize()
    {
        model = new TerrainModel();
        base.Initialize();

        // Load known core components
        camera = new Camera(this, cameraPosition, new Vector3(10, 10, 10));
    }

Then in update ...

    protected override void Update(GameTime gameTime)
    {
        // Allows the game to exit
        if (GamePad.GetState(PlayerIndex.One).Buttons.Back == ButtonState.Pressed || Keyboard.GetState().IsKeyDown(Keys.Escape))
            this.Exit();

        camera.Update();

        base.Update(gameTime);
    }

Then in draw ...

    protected override void Draw(GameTime gameTime)
    {
        cubeEffect.View = Matrix.CreateLookAt(cameraPosition, new Vector3(10, 10, 10), Vector3.Up);
        cubeEffect.View = camera.View;

        cubeEffect.Projection = Matrix.CreatePerspectiveFieldOfView(MathHelper.PiOver4, aspectRatio, 1.0f, 1000.0f);
        cubeEffect.Projection = camera.Projection;
    }

It's these draw lines that have me confused.
If i use the first pair (the lines that create the matrices there and then) it all works.

If I use the second pair (pulling the same thing from my camera class) it doesn't and i get a blank screen.

I'm only rendering a single model so there's a chance it could be pointing in the wrong direction but it seems to have done what i expect when i put breakpoints in and look at the variables.

So what have i done wrong?

Here's my camera class ...

public class Camera
{
    #region fields

    Matrix viewMatrix;
    Matrix projectionMatrix;
    Viewport viewPort;
    BoundingFrustum cameraViewableBounds;
    Vector3 currentTarget;
    Vector3 cameraPosition;

    #endregion

    #region Properties

    public Matrix Projection { get { return projectionMatrix; } }
    public Matrix View { get { return viewMatrix; } }
    public Viewport ViewPort { get { return viewPort; } }

    public Vector3 Position
    {
        get { return cameraPosition; }
        set
        {
            cameraPosition = value;
            Update();
        }
    }

    public Vector3 TargetPosition { get { return currentTarget; } }

    public bool CanSee(BoundingBox ObjectBounds)
    {
        if (cameraViewableBounds.Contains(ObjectBounds) != ContainmentType.Disjoint)
            return true;

        return false;
    }

    #endregion

    public Camera(Game game, Vector3 startingPosition, Vector3 startingTarget)
    {
        cameraPosition = startingPosition;

        // creates a new view matrix
        LookAt(startingTarget);

        viewPort = game.GraphicsDevice.Viewport;

        // Set the Projection matrix which defines how we see the scene (Field of view)
        projectionMatrix = Matrix.CreatePerspectiveFieldOfView(MathHelper.PiOver4, 0, 1, 10000);
    }

    #region Camera state updating

    public void Update()
    {
        viewMatrix = Matrix.CreateLookAt(cameraPosition, TargetPosition, Vector3.Up);
        cameraViewableBounds = new BoundingFrustum(viewMatrix * projectionMatrix);
    }

    public void LookAt(Vector3 target)
    {
        currentTarget = target;
        viewMatrix = Matrix.CreateLookAt(Position, TargetPosition, Vector3.Up);
    }

    #endregion
}

}

I'm sure this is something crazy simple that i've missed ... i just can't see it.

NOTE:
I have omitted a lot of code here to try and simplify my question but I'm pretty sure the rest of my code is fine because it works unless I use this new camera class, however I can provide more if its needed.

sentences:
Fill all unallocated space with texture I have a system of bunkers underground, and I need to fill all the free space where there are no buildings - with earth. Yes, I can manually add a ground texture to the plane, but I have procedural level generation.
I thought there might be some kind of filter on the camera that I don't know about. Or maybe there are some other solutions?

sentences:
What happened to sprite::setSize in SFML2? I'm porting one of my old projects to sfml 2.0, and I had a background that I scaled using

sprite.setSize(windowWidth, windowHeight)

Now, it seems like setSize has ben removed in 2.0, and I'm wondering what the intended replacement is.

I know there is a setScale function, and that I could do something like:

auto size = sprite.getTexture()->getSize();
sprite.setScale(float(windowWidth)/size.x, float(windowHeight)/size.y);

but I think this is really ugly and clunky, is there another way to do it?

sentences:
What is the difference between Character Modeling and Level Design? I'm  thinking of either focusing on character modeling or level design, but I'm not sure what the differences are. Do companies consider them as separate jobs because I don't know that either.

My background: Currently I'm in an associates program for Game Programming, but over the last semester due to my work schedule there was no programming class available for me to take so instead I decided to take 3D Modeling. But as I'm reaching the end of the class I noticed I'm enjoying the 3D Modeling a lot more than programming, so I decided to stick with the art side. However, due to unforeseen circumstances, I'm going to have to move soon and transfer to a new university. Now this new university that I'm going to be attending how the program is set up so that you're required to pick a particular area to focus on. But I'm not sure what to do.

sentences: Migrate from NGUI to Unity UI I used NGUI 2 and NGUI 3 for our UI. Now want to upgrade to Unity 4.6 and migrate all NGUI to Unity UI. Is there any tools? What's the best practice?

sentences:
creating levelup stats based on curves I'm creating a simple level-up system and I'm looking to base the stats gain on curves so I can tweak them easier, I know it's a math function, but I have no idea what to search for.

I need to create this curve and get the value every x increment.

the engine I'm using is Ren'py and the language python. if you can tell me the terms to search for, I might be able to find something on the topic.

sentences:
Gerstner/Sinusoidal wave directional rotation (flow) in regards to ocean currents/trade winds I'm trying to create an ocean simulation using Gerstner waves based on the GPU Gems: Effective Water Simulation from Physical Models. So far I've completed the directional wave functionality and currently want to expand it with an ocean current/trade wind system to drive the global wave direction. I'm having trouble understanding how to create flow of a single directional wave based on a sampled flow field.
Current wind is generated by deriving a flow field from Perlin noise:
float2 dir=float2(cos(2Pi * noise(x,y),sin(2Pi * noise(x,y));
When I input this vector into wave direction(D), the wave breaks at time 0 and direction of the wave doesn't match the flow field vector direction at location (x,y).
I'm using Perlin noise for a flow field as a quick and easy testing tool to get wave rotation in place. How the flow field will be generated for end project purposes is irrelevant right now.
The Gerstner function I'm using:
$$P(x,y,t)=\begin{pmatrix}
x+\sum(Q_iA_i*D_i.x*cos(w_iD_i\cdot(x,y)+\varphi_it) )
\\y+\sum(Q_iA_i*D_i.y*cos(w_iD_i\cdot(x,y)+\varphi_it) )
\\\sum(A_isin(w_iD_i\cdot(x,y)+\varphi_it)))
\end{pmatrix}$$
Would I be missing some variable like wave phase offset or some wave rotation rate? How is wave rotation calculated in regards of changing direction vector based on world position?

sentences: How to make old cards still usable to players in CCG games? In CCG games, as the player progresses further and unlocks stronger cards alot of the old cards are ignored and not used anymore. Like for example a CCG with 1000 cards, 100 of them are very strong cards and the others not so much. All players will just use those 100 cards and ignore the rest 900 cards! What can be done in such case to make old cards still usable to players?

sentences:
How to move Objects smoothly like swimming arround I have a Box2D project that is about to create a view where the user looks from the Sky onto Water. Or perhaps on a bathtub filled with water or something like this. The Object which holds the fluid actually does not matter, what matters is the movement of the bodies, because they should move like drops of grease on a soup, or wood on water, I can even imagine the the fluid is mercurial, extreme heavy and "lazy".

How can I manipulate the bodies (every frame or time by time) to make them move like this?

I started with randomly manipulation their linear velocity, but I turned out that this not very smooth and looks quite hard.

Is it a better idea to check their velocity and apply impulses? Is there any example?

Greetings philipp

sentences:
Texture object and texture unit in GL As I understand texture usage consist of two parts

How to store this discrete data about texture internally. How much dimensions, channels, etc.
How to fetch/sample/filter

The question relative to OpenGL are:

q1: What parameters are stored in texture object (glGenTexture) and what parameters are store in texture unit (glActiveTexture) ?

q2: Does glTexParameter perform setup per texture object or per texture unit?

sentences:
Parsing Sprites from Spritesheet How can I parse a spritesheet consisting of scattered sprites with different sizes, like this example and return the (x, y) and (width, height) values of each sprite?
It is trivial when the spritesheet is split on equal widths and heights, which for this thing I envy Unity for.
After spending some time researching, the best I could find is http://www.spritecow.com/, which is Javascript based and you have to manually click on your sprites to parse a single sprite, moreover it is really slow.

sentences:
How to change something inside an switch statement? So my question is how would you draw a list of strings, and then if a case of the enum is a certain way, then draw them a different way? Here is an example of what I mean:

enum CurrentState
{
    Menu1,
    SubMenu1,
    SubMenu2
}
private CurrentState _currentState = CurrentState.Menu1;
public void Draw(SpriteBatch spriteBatch, GameTime gameTime)
{
    //Draw list here so it is always displayed in all cases
    switch (_currentState)
    {
        case CurrentState.Menu1:
        {
            //How would you erase the previous list and draw it in a different way here?
        } break;
        case CurrentState.SubMenu1:
        {
            //How would you erase the previous list and draw it in a different way here?
        } break;
        case CurrentState.SubMenu2:
        {
            //How would you erase the previous list and draw it in a different way here?
        } break;
    }
}

sentences:
Player position on second player connection I'm having some trouble trying to run my game for the multiplayer part. I'm creating a 2D game.
I have followed this tutorial : http://www.paladinstudios.com/2013/07/10/how-to-create-an-online-multiplayer-game-with-unity/ and I've implemented it. As the tutorial says, I have a network view pointing to a script, containing my OnSerializingNetworkView and his interpolation and predilection stuff. It's working very fine, the movement is fluid and it's very good.
The problem is when a second player join the game and my first player have already moved, since I'm instantiating the player using Network.Instantiate(prefab, Vector2.zero, ...) the player spawn in the middle of the map and then slowly move to his normal position. I've tried other things such as not using a script but putting the transform in the network view, when the second player spawn, the first one is at the correct position but the mouvements aren't the same and aren't that fluid.

Anyone have any idea on how to deal with this problem ?

Thanks!

sentences:
unity : How to change the default behaviour of the touchpad/trackpad in laptop? I'm using unity on my laptop. Normally, i can customize my touchpad in most of 3d app but in unity i can't find a way to do it ? is it possible to customize it at user level without hard coding it ?
I just want the touchpad to behave like most app : 2 fingers pinch to zoom, 2 fingers drag to rotate view etc.

sentences: What 2D engine can I use to port my flash game to iOS and Android? I would like to port my 2D flash game to Android and iOS. Is there any cross platform engine you could recommend? Corona is the only promising one I have found so far.

sentences: Making a cube follow my finger in Unity2d? I would like to make a cube follow my finger when i touch an iphone screen and drag in unity 2d.

sentences:
UnrealEngine4 "backwards compatilibility": Can I view a site that uses Unreal Engine4 on a very old laptop and still see in high definition? Backwards compatible?

The project:

I want to render a high definition model on my personal website such that it'll be rendered in the highest definition possible on any device, from a 20-year-old Gateway PC running Windows 95 to an iPhoneX. It's particularly important that it's real pretty on mobile (whatever Android and iPhone models are big these days)

The question:

I was thinking I'd buy an expensive desktop with GPUs to make sure I can make the app really fancy for users on a high-end desktop with nice monitors. But I'm not going to do that if the high-definition I get on my new expensive screen doesn't make it out to the app my employer is building. How does this work? Does OpenGL display the highest-definition render it can on the mobile device?

sentences:
A* pathfinding takes too long, shortcuts needed So I have a game where the player can move on a grid 108 X 192 large. It uses a simple A* path-finding algorithm to move. Unfortunately, After 0.03 seconds, it would have only looked at about 300 nodes, meaning that if the end node is blocked from passage, it would take about 2 seconds for it to realize this (A* without optimizations returns failed when the open list is empty, when it has inspected every path and realized there was no solution). And I want at least 20 fps!

I have not used any optimizations, and each point in the grid is a boolean blocked or unblocked. Any ways to speed it up?

For example, in Dota 2 (a popular MOBA), the map is full of trees and cliffs, and is 15,000 game units by 15,000 game units big, but the character starts moving as soon as you click where you want it to go. How do they do that, and is it a simple thing I am missing?

sentences:
Everything turning black when pitching down Just a quick questions about something that's occurring in my world. Every time I pitch my camera downward, everything starts turning black, and if I pitch upward, everything sort of intensifies.

I'm multiplying my normals by the normal matrix in the shader, and I'm multiplying my lights direction by the model view matrix.

If I leave the normal and light dir in world space everything ends up fine.

I thought putting them both in view space would not cause those weird things to happen?

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:
rotate sphere horizontally around another sphere I currently have an earth and a moon. What I'm trying to achieve is to have the moon physically rotate around the earth horizontally along the equator along a circular path.

    moonAngle = (moonAngle + 0.5f) % 360f;
    xPath = (float) Math.sin(Math.toRadians(moonAngle)) * distance;
    yPath = (float) Math.cos(Math.toRadians(moonAngle)) * distance;

    gl.glTranslatef(xPath, yPath, -30f);

The above works fine, except the moon is rotating around the earth vertically around the Prime Meridian like a wall clock. How do I adjust the angle of rotation? I've tried modifying the glTranslatef, but with no success.

sentences:
Draw a Texture to fit a rectangle I would like to draw a texture in a rectangle that is smaller than the texture, normally the texture will be scaled to fill the rectangle, which results in a squished image. I want to draw it to fit.
For example, if the green stuff is the Texture, I would like to draw only the stuff in the red rectangle.

I already tried to get the color data from the base texture and create a new one, filled with the part from the base.
Color[] colorData = new Color[progressRectangle.Width * progressRectangle.Height];
Color[] sourceColorData = new Color[t2dBack.Width * t2dBack.Height];
t2dBack.GetData(sourceColorData);
for (int x = 0; x < progressRectangle.Width; x++)
{
    for (int y = 0; y < progressRectangle.Height; y++)
    {
        colorData[x + progressRectangle.Width * y] = sourceColorData[x + t2dBack.Width * y];
    }
}

t2dBackDraw.SetData(colorData);

but that just results in gibberish.
Is there an easy way to accomplish this?

kind regards

sentences:
How to scale-to-fit OGL viewport to GLFW window? Say my window is 1280x720. I want to render my stuff to lower resolution and then stretch it to window. I've tried this:

glViewport(0, 0, 1280 / 2, 720 / 2);

When I call glViewport and pass lesser width and height than window, I get all my OpenGL rendering in left bottom 1/4 of window. I need to scale it (linear filtering preferably) back to window size so I would get a pixelated effect.

I wonder if there is such possibility within glad/glfw API.

sentences:
AABB - AABB Collision, which face do I hit? To allow my objects to slide when they collide, I need to :

Know which face of the AABB they collide with.
Calculate the normal to that face.
Return the normal and calculate the impulse that to apply to the player's velocity.

Question

How can I calculate which face of the AABB I collided with, knowing that I have two AABB's colliding? One is the player and the other is a world object.

Here's what that looks like (problem collision circled in white):

Thank you for your help.

sentences:
Problem when texturing triangles using glVertexPointer() I'm having a problem for displaying a single quad, here is how i do :

//note: this code is only for 2 triangles, while on picture there is 4 triangles
float tex_coord[] =
{
   0.0, 0.0, //3
   0.0, 1.0, //2
   1.0, 1.0, //0
   1.0, 1.0, //0
   1.0, 0.0, //1
   0.0, 0.0  //3
};

int indexes[] =
{
    3, 2, 0, 0, 1, 3
}

 glEnableClientState(GL_TEXTURE_COORD_ARRAY);
 glEnableClientState(GL_VERTEX_ARRAY);
   glVertexPointer(3, GL_FLOAT, 0, vertexes);
   glTexCoordPointer(2, GL_FLOAT, 0, tex_coord);
   glDrawElements(GL_TRIANGLES, 2, GL_UNSIGNED_INT, indices);
 glDisableClientState(GL_VERTEX_ARRAY);
 glDisableClientState(GL_TEXTURE_COORD_ARRAY);

The result :

sentences:
What's wrong with my HLSL depth shader? I'm trying to render depth texture in XNA 4.0. I'm read few different tutorials several times and realy cannot understand what I'm doing wrong.

Depth shader:

float4x4 WVPMatrix;

struct VertexShaderOutput
{
    float4 Position : position0;
    float Depth : texcoord0;
};

VertexShaderOutput VertexShader1(float4 pPosition : position0)
{
    VertexShaderOutput output;
    output.Position = mul(pPosition, WVPMatrix);
    output.Depth.x = 1 - (output.Position.z / output.Position.w);
    return output;
}

float4 PixelShader1(VertexShaderOutput pOutput) : color0
{
    return float4(pOutput.Depth.x, 0, 0, 1);
}

technique Technique1
{
    pass Pass1
    {
        AlphaBlendEnable = false;
        ZEnable = true;
        ZWriteEnable = true;

        VertexShader = compile vs_2_0 VertexShader1();
        PixelShader = compile ps_2_0 PixelShader1();
    }
}

Drawing:

this.depthRenderTarget = new RenderTarget2D(
    this.graphicsDevice,
    this.graphicsDevice.PresentationParameters.BackBufferWidth,
    this.graphicsDevice.PresentationParameters.BackBufferHeight);

...

public void Draw(GameTime pGameTime, Camera pCamera, Effect pDepthEffect, Effect pOpaqueEffect, Effect pNotOpaqueEffect)
{
    this.graphicsDevice.SetRenderTarget(this.depthRenderTarget);
    this.graphicsDevice.Clear(Color.CornflowerBlue);
    this.DrawChunksDepth(pGameTime, pCamera, pDepthEffect);

    this.graphicsDevice.SetRenderTarget(null);
    this.spriteBatch.Begin(SpriteSortMode.Immediate, BlendState.Opaque, SamplerState.PointClamp, null, null);
    this.spriteBatch.Draw(this.depthRenderTarget, Vector2.Zero, Color.White);
    this.spriteBatch.End();
}

private void DrawChunksDepth(GameTime pGameTime, Camera pCamera, Effect pDepthEffect)
{
    // ...

    this.graphicsDevice.RasterizerState = RasterizerState.CullClockwise;
    this.graphicsDevice.DepthStencilState = DepthStencilState.Default;

    // draw mesh with pDepthEffect
}

Result:

As I see output.Position.z always equals output.Position.w, but why?

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:
OpenGL - Disable Anti Alias I can't find anything on how to hint to the driver to disable any antialias.
I'm using a very minimal passthrough setup yet I notice my driver is still doing what looks like MSAA.
I want to disable this, or at least give a strong hint to disable it, so to save performance. As I will be doing deferred rendering with my own SSAA.

sentences: Object detection in bitmap JavaScript canvas I want to detect clicks on canvas elements which are drawn using paths. So far I have stored element paths in a JavaScript data structure and then check the coordinates of hits which match the element's coordinates. Rendering each element path and checking the hits would be inefficient when there are a lot of elements. I believe there must be an algorithm for this kind of coordinate search, can anyone help me with this?

sentences:
How can I implement a more realistic momentum system in Unity 4.5? I'm just starting out with Unity and am making a simple environment where there is a sphere and a ramp.  When the sphere approaches the ramp everything is fine.  As soon as the sphere hits the ramp is where I'm having trouble; the velocity is instantly reduced and when it goes off the end of the ramp, instantly returns to the velocity as though it were on the ground.

I'm not sure if this can be changed by some settings in Unity or I would have to write some code.

Here's the physics code I have so far (in C#):

public class PlayerController : MonoBehaviour {
    public float speed;

    void FixedUpdate(){
        float moveHorizontal = Input.GetAxis("Horizontal");
        float moveVertical = Input.GetAxis("Vertical");

        Vector3 movement = new Vector3(moveHorizontal, 0.0f, moveVertical);

        rigidbody.AddForce(movement * speed * Time.deltaTime);
    }
}

sentences:
Messaging/Event System in Generic Game Engine? Yay or nay? Should I develop a basic messaging/event system for a generic game engine or should I leave it up to the individual case-by-case basis of the end-users to create systems specific to the game being developed?

This question raises some valid points: (I am currently using the per-frame function call system mentioned)

Per-frame-function-calls-versus-event-driven-messaging-in-game-design

sentences:
How can I handle the difficulty level between co-op and single player? I'm working on an action-adventure game, and I was considering adding a co-op option. What I'm trying to decide is if when another player joins the game, if the game should get harder. On the one hand, I don't want the game to just get easier. On the other hand, I don't want to break continuity by making enemies suddenly stronger, eg I was able to take this down it two hits before, why does it take four all of the sudden.

I do not want there to be an "AI co-op" that comes with you in single player, I think that would make the game worse since it would detract from player agency.

How can I handle this? How can I keep the game challenging when a second player joins in?

sentences:
How does Unity Static batch handle submeshes I have the following 2 meshes:

Mesh 1
    Submesh 1 - Mat 1
    Submesh 2 - Mat 2

Mesh 2
    Submesh 3 - Mat 1 (same as mat1 from submesh 1)

Since submesh 1 and 3 have the same material and they are all static, I'd like to render submesh 1 and 3 in a single drawcall. However, Unity is failing to batch those submeshes together.

Is there a way to achieve this?

sentences:
OnTriggerExit() called when game object with collider component gets re-parented I have an object Hand, with a rigid body attached to it. In every Update() call, the user's hand controller rotation and position are tracked.

In my scene, there is an object Pin, with a mesh collider attached to it.

In OnTriggerEnter() (inside the Hand class), Pin becomes re-parented to Hand. (Pin's original parent is something else.)

My scene also contains other objects with colliders. However, these other objects do not get re-parented -- only Pin does.

Once this re-parenting takes place, OnTriggerExit() (in the Hand class) is called immediately. This is surprising to me -- I had expected OnTriggerStay() (in the Hand class) to be invoked instead, since Hand is still in contact with Pin.

Is such behaviour by design? Is there an elegant way of working around such behaviour?

UPDATE:

In response to this comment:

  Does the pin object have a parent before it becomes a part of the
  hand?

Yes. As mentioned in my post, Pin's original parent is something else.

  Or is it placed inside another collider? And does the pin leave any of
  these collider areas when the parenting takes place?

As mentioned in my post, Pin itself has a mesh collider component attached to it. Perhaps I am not understanding the question correctly...

  You can prevent the hand's script from getting this OnTriggerExit by
  adding a seperate rigidbody to the pin.

I added a separate rigid body to the pin (setting isKinematic to true), but OnTriggerExit() inside the Hand class is still called immediately after Pin gets re-parented.

MORE INFORMATION:

Pin's original parent (before it gets re-parented to Hand) does not itself have a collider component.
When OnTriggerExit(Collider collider) gets called immediately after the re-parenting takes place, the collider argument passed to the method is the Pin itself.

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:
Moving a character depending on the direction he is facing (C#/Unity3D) Right now I have a small soldier on the screen that moves with W, A, S, D and rotates / changes direction with the arrow keys. What I want to happen is when the player's direction changes (by using the arrow keys), pushing W will send him in that direction instead of up the screen.

Also (for example), if you are holding D and the right arrow key at the same time he should move in a circle about a point on the ground (instead of spinning in a circle while moving in a straight line to the right).

Here is my current code:

public class MovePlayer : MonoBehaviour {
  void Update() {
    // Rotate left
    if (Input.GetKey (KeyCode.LeftArrow)) {
      transform.Rotate(0, 0, 1.3f);
    }
    // Rotate right
    if (Input.GetKey(KeyCode.RightArrow)) {
      transform.Rotate(0, 0, -1.3f);
    }
    // Strafe left
    if (Input.GetKey (KeyCode.A)) {
  Vector3 position = this.transform.position;
      position.x -= 0.055f;
      this.transform.position = position;
    }
    // Move up
    if (Input.GetKey (KeyCode.W)) {
      Vector3 position = this.transform.position;
        position.y += 0.043f;
        this.transform.position = position;
    }
    // Move down
    if (Input.GetKey (KeyCode.S)) {
      Vector3 position = this.transform.position;
      position.y -= 0.043f;
      this.transform.position = position;
      isMoving = true;
    }
    // Strafe right
    if (Input.GetKey (KeyCode.D)) {
      Vector3 position = this.transform.position;
      position.x += 0.055f;
      this.transform.position = position;
    }
}

}

Any ideas? Wasn't sure what to search exactly.

sentences:
Structure GameObject - States - Visual representation Question: What is the best data structure for GameObjects that have different states and thus different visuals?

The situation is:

I'm creating a game for mobiles (written in Kotlin, no Engine used).

My simplified object structure looks like this:

I have 2 GameObjects (e.g. Person and Obstacle)

Each GameObject might have two different states (IDLE and MOVE)

But each state might also have different graphics. For instance depending on the movement direction, the MOVE state might show Bitmap-Left or Bitmap-Right.

  Person -> WALK-State -> Visualisation (WALK, PERSON) -> draw(bitmap_walk_left_person)

My problem is, that I'm really not sure about that structure. Should I make subclasses for each State or a composition? One Visual object for each State (e.g. MOVE, IDLE, TALK) containing all Bitmaps for Person and Obstacle and always showing the right one depending on the parent?

Currently it looks like this:

I have the GameObject. The object has a state that is called in the update() method (e.g. moving a bit to the left).
Every State has a "Visual" object that knows its parent State (State = WALK). It draws itself related to its states type (e.g. WALK) and considers (if needed) the orientation (left or right).

This felt like it keeps structures as abstract as possible but I'm not sure sure thats a good solution because all objects have to keep references to their "parents". So the visuals need a reference to the state (WALK) and to the GameObject (Person) in order to draw the visual for a walking person.
Would it be better to create subclases for each State?
So I have a class "VISUAL_MOVE_PERSON", "VISUAL_IDLE_PERSON", "VISUAL_IDLE_TREE" ... That seems a lot of redundant code and classes.

Is there a common structure for Actions / States and their Visual Representation? Especially since I will have many more objects with at least a few different states (IDLE, MOVE, TALK, ...)

Should the visuals be part of each state? Or are they independent to each other (e.g. GameObjects have a State and a Visuals object) instead of the "chain of references" shown above?

sentences:
Unity - Copy another object's Y location? I'm creating a Pong clone inside of Unity and was trying to figure how to copy another object (In this case being the Y co-od of the Ball Object) How would i go about doing this? I'm using vectors as my method of paddle movement and I want to create a public int AISpeed so that the AI paddle is a little slower in comparison

In my mind I assumed it was along the lines of:
rightPaddle.location.y = pongBall.location.y

How would I create this?

sentences:
ray polygon intersection I am looking for an elegant way to do ray and polygon intersections in 2d. I don't care about languages.

Now what I'm doing is taking a line that lies on the ray (with a screen length) and testing line-to-line intersections between this derived-ray and all lines formed by each consecutive vertices in the polygon.

This, for now, is good even if I don't know which parts of the ray are inside or outside the polygon (in cases it is concave one). But for now I don't need this information, even if a general approach could maybe give it.

I don't care about self-intersection polygons.

Any advice? Maybe triangulating the polygons could be an idea?

sentences:
Converting 3 axis vectors to a rotation matrix I am trying to get a rotation matrix (in 3dsmax) from 3 vectors that form an axis (all 3 vectors are aligned by 90 degrees each other)

Somewhere I read that I could build a rotation matrix just by inserting in every row one vector at a time (source: http://renderdan.blogspot.cz/2006/05/rotation-matrix-from-axis-vectors.html)

So, I built a matrix with these example vectors

x-axis : [-0.194624,-0.23715,-0.951778]

y-axis : [-0.773012,0.634392,0]

z-axis : [-0.6038,-0.735735,0.306788]

But for some reason, if I try to convert this matrix to eulerangles, I receive this rotation: (eulerAngles 47.7284 6.12831 36.8263) ... which is totally wrong, and doesn't align to my 3 vectors at all.

I know that rotation is quite difficult to understand, may someone shed some light? :)

sentences:
Resource not found: testdata/alphamap.png I started a tutorial for java's slick 2d library, called SlickBlocks which is essentally a tetris clone. The problem is I have followed and typed in the code examples to the dot, yet when I run it I get the exception: Exception in thread "main" java.lang.RuntimeException: Resource not found: testdata/alphamap.png. I just started the tutorial and am up to "Making a cool effect with Image scale".

Any ideas?

Edit:

The error has occured at:

at org.newdawn.slick.util.ResourceLoader.getResourceAsStream(ResourceLoader.java:69)
at org.newdawn.slick.opengl.InternalTextureLoader.getTexture(InternalTextureLoader.java:169)
at org.newdawn.slick.Image.<init>(Image.java:196)
at org.newdawn.slick.Image.<init>(Image.java:170)
at org.newdawn.slick.Image.<init>(Image.java:158)
at org.newdawn.slick.Image.<init>(Image.java:136)
at org.newdawn.slick.tests.AlphaMapTest.init(AlphaMapTest.java:33)
at org.newdawn.slick.AppGameContainer.setup(AppGameContainer.java:390)
at org.newdawn.slick.AppGameContainer.start(AppGameContainer.java:314)
at org.newdawn.slick.tests.AlphaMapTest.main(AlphaMapTest.java:79)

Also not that I am not using "alphamap.png"  anywhere in the game, I think It is just referenced by the library itself.

sentences:
How do I have an arrow follow different height parabolas depending on how long the player holds down a key? i'm trying to throw an arrow in my game, but i'm having a hard time trying to realize how to make a good parabola.

What I need:
The more you hold "enter" stronger the arrow goes.
The arrow angle will be always the same, 45 degrees.

This is what I have already have:

    private float velocityHeld = 1f;
    protected override void Update(GameTime gameTime)
    {
 private void GetKeyboardEvent()
        {
            if (Keyboard.GetState().IsKeyDown(Keys.Enter) && !released)
            {
                timeHeld += velocityHeld;
                holding = true;
            }
            else
            {
                if (holding)
                {
                    released = true;
                    holding = false;
                    lastTimeHeld = timeHeld;
                }
            }
        }

        if (released && timeHeld > 0)
        {
        float alpha = MathHelper.ToRadians(45f);
        double vy = timeHeld * Math.Sin(alpha);
        double vx = timeHeld * Math.Cos(alpha);

        ShadowPosition.Y -= (int)vy;
        ShadowPosition.X += (int)vx;
        timeHeld -= velocityHeld;
        }
        else
        {
            released = false;

        }
       }

My question is, what do I need to do to make the arrow to go bottom as it loses velocity (timeHeld) to make a perfect parabola?

sentences:
Color Based Collision Javascript (Cocos2d-js) I'm looking to make an isometric game so my partner designed the isometric map (jpg image) along with the map objects (png) on Adobe Illustrator. The thing is I would like to set the player path based on color, for example if the terrain is white the player can go through, if it's black then the player is not allowed to pass. Is this a viable method to do this or are there better methods? Also I'm using Cocos2D-js so my coding is JavaScript

I would appreciate any suggestions.

sentences:
How do I implement Breakout's "multiball" powerup? I'm just starting out and making a breakout clone as my first game. I'm implementing all kinds of powerups, but I'm stuck on multiball. The powerup adds additional bouncing balls to the game.

So far, I've implemented powerups by just adding them to the Ball class as states. This is easy for increasing speed, making the ball sticky, changing sprites and such. When the ball is in one state it behaves in only one way.

Now, how do multiple balls fit into this? I suppose having more balls is more of a function of the game itself than the Ball, so it seems logical to make it a game state instead of a ball state. How would I do this?

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:
Having trouble defining a FindMyTag I'm not a coder, im an artist, so this stuff doesn't make a ton of sense to me. I know enough to know I don't know enough, and i'm old enough to know my brain doesn't 'get' code... that said for context of what level of help I need :) ...

I'm trying to get an AI path based on an object tag. When I instantiate the object this script is on, it should look for 'mytag' on another object in the scene, and set that as 'target'

    public class pickAItarget : VersionedMonoBehaviour
    {
        /// <summary>The object that the AI should move to</summary>
        private Transform target;
        public string mytag;
        IAstarAI ai;

        void Start()
        {
            Debug.Log(GameObject.FindWithTag("mytag"));
            GetComponent<pickAItarget>().target = GameObject.FindWithTag("mytag").transform;
        }

The script compiles fine and im able to put in the tag I want to find in the inspector but when the object instantiates I get

UnityEngine.GameObject.FindWithTag (System.String tag) (at C:/buildslave/unity/build/Runtime/Export/Scripting/GameObject.bindings.cs:195)
Pathfinding.pickAItarget.Start () (at Assets/Scripts/pickAItarget.cs:26)

I feel like I HAVE defined mytag, but obviously I don't understand something.

sentences: Why do games suggest you take a break? A lot of games will suggest you take breaks from them every 30 minutes or so, I think this is especially common in Nintendo games, but they aren't the only ones to do it. What is the advantage to this? Does this somehow help get you to play it more or does it help sell more copies?

sentences:
Minecraft-style player-gound collision detection The title pretty much says it all... (Minecraft is a game consisting of evenly-spaced cubes for terrain, like voxels)
Note: I am using C# XNA.

I am pretty sure AABB is the way to go, yet I don't know how to implement it. I admit, I'm almost looking for code, but theories/ideas are very welcome.

Important capabilities of my code: I have a function that can get a block anywhere in the world, and get a BoundingBox for that cube. Hence, I have created a BoundingBox for the player to collide with those cubes. My idea was to get the blocks around the player (maybe 4x6x4) and test against those.

The problems I have been having: Say the world is a flat plane. If I use the method of go the shortest distance out, then if the player is slightly clipped into the ground (from gravity), but even slighter into the next block over, then the player will be pushed sideways (and so cannot walk along ground). Of course, this is assuming I react to every block intersected. Another problem is knowing which direction to go (aka negative x or positive). That takes me to my final problem- Getting the amount of intersection, in the correct direction (+ or -) has been tough for me.

I hope I haven't been too hard to understand, I'm not too good at explaining things... And if this question has already been asked, I'm sorry, I looked for it... for 3 days straight.
One last thing, if someone knows exactly how minecraft does it, or has source (I know MC modders have the source, how else would they mod), please point me to it.

sentences:
How to make physics of motion on an inclined surface There is the following platform:

And a coin above it:

And the following code using arcade physics:

gravity: { y: 100, x: 10 }, - in config

function preload ()
{
this.load.image('platform', 'assets/platform.png');
this.load.image('star', 'assets/star.png');
}

function create ()
{
platforms = this.physics.add.staticGroup();

platforms.create(400, 568, 'platform');

player = this.physics.add.sprite(100, 450, 'star');

player.setCollideWorldBounds(true);
}

The code is approximate, a coin above the platform, sprites in png format. But the coin falls and does not roll, but moves horizontally, after which it falls again. How to make it "roll"?

UPD: Will it help me? https://github.com/photonstorm/phaser-examples/blob/master/examples/arcade%20physics/circle%20body.js
And how to be with the platform?

sentences:
Character Jump (AddForce) unusual behavior near objects in unity 2D My character object has a single jump mechanics and I just noticed the whenever I press the jump button many times quickly in which the character is near a "Platforms like staircase, boxes or even sometime near the edge of a platform (while also being up in the air and pressing jump many times when colliding)" it starts to fly off beyond my jump force. Can anyone help me to fix the physics? Thanks!
My Jump system code sample:
Rigidbody2D mybody;
public float jumpforce;
public bool isGrounded = false;
public Transform feet;
public LayerMask groundlayers;
public float groundradius = 1f;
bool Jumprequest;

void Start () {
    mybody = GetComponent<Rigidbidy2D>();
}

void Update () {
    JumpRequest();
}

void FixedUpdate() {
    Jump();
    JumpOptimization();
    isGrounded = Physics2D.OverlapCircle(feet.position, groundradius, groundlayers);
}

public void JumpRequest() {
    if (CrossPlatformInputManager.GetButtonDown("Jump") && isGrounded) {
        isGrounded = false;
        Jumprequest = true;
    }
}

void Jump() {
    if (Jumprequest) {
        mybody.AddForce(new Vector2(0, jumpforce) , ForceMode2D.Impulse);
    }

    Jumprequest = false;
}

void JumpOptimization() {
    if (mybody.velocity.y < 0) {
        mybody.gravityScale = Fallmultiplier;
    }
    else {
        mybody.gravityScale = 1;
    }
}

Here is a sample picture that might help:
The red line shows when character collided with an object while addforce is added upwards and pressing
Jump button repeatedly at the same time, the character flies off beyond my jump force.

sentences:
Render Texture shows opposite view of camera when rendered? I am using render texture (cube) to render what camera sees into it. However, the render texture shows me opposite side of cameras view (flipped) instead of what camera sees. Any solution for this?

    void Update()
    {
         renderTexture.isPowerOfTwo = true;
         //Graphics.SetRenderTarget(renderTexture, 0, CubemapFace.PositiveZ);
         renderTexture.dimension = TextureDimension.Cube;
         camera.RenderToCubemap(renderTexture, 63);
    }

What camera sees:

What Render Texture shows:

What happens when I rotate Render Texture manually by hand 180 degrees:

So, instead of rotating per hand, what I want is for the render texture to be rotated via code so that what is in camera view is shown exactly the same in render texture view.

sentences:
How to use the latest MongoDB C# driver with Unity? I recently updated my Unity 2018 to the 2020 version then I created a new project to connect my game to a MongoDB database.
My main goal is to be able to store not only common data in my collection but also files and images by using GridFS.
I use Visual Studio 2019 Community so for my project. I installed the MongoDB drivers directly from NuGet. In Visual Studio everything is OK, I added a using for all required libraries and I have no errors but when I switch to Unity 2020 it seems that I can't start my project because my MongoDB driver is not correctly loaded there.
I found some tutorials like this one where they had the same problem and fixing it by adding the DLLs directly in the Unity folders. That works for me, but only with the DLLs shared in the tutorial (you can access the working DLLs in the video description).
What is a bit disturbing is that the DLLs' versions seem to be outdated, since the connections process is a bit different from the one in the MongoDB documentation.
I cloned the latest MongoDB C# driver repository from GitHub and tried to reproduce the same process with the latest DLLs, but once again it only works in VS 2019 but not in Unity, even though I have added the DLLs in the Unity folder.
Is there is some kind of compatibility problem between Unity and the latest MongoDB? How can I fix this to work with the latest version?

sentences:
Computer Games Technolgy or Software Engineering? I'm in the last year of my college and going to university next year. Could you tell me what the difference between Software Engineering and Computer Games Technology is?

I know a bit of both but don't know the actual difference. I'm kind off in a dilemma between these two. I want to be a programmer, I'd love to go into gaming but I heard getting a job within a computer games company is really hard.

sentences:
Masking cameras for Voronoi splitscreen I would like to mask a camera to only render to a certain (non-square) region of the screen, to be used as an overlay, for splitscreen, or any other application.
The goal is obviously to prevent any unnecessary rendering from that camera, so I specified performance, but I'm also happy to hear the easiest to implement option as well.
What I'm considering so far:

Stencil shader on a mesh in front of the camera - but my understanding is that doing so would require modifying all shaders on world objects, which isn't ideal. Is there an easier way I'm missing?
Transparent mesh with a cutout - I could cut out a hole in a mesh and the solid part would block rendering of objects behind it, but I'm not sure how to make that part be transparent so other things can render

I'm using Unity 2019 LTS and the built-in render pipeline
I feel like there must be a simple answer I'm missing but maybe I'm wrong?

sentences:
Can Neural Network play tic tac toe? Is this have any common sense? I'm thinking about theoretical possibility of playing tic tac toe by neural net. Is this have any common sense? Let's consider tic tac toe which contains 3 rows and 3 cols (it's 9 cells). Ok, then the input vector is contains of all our cells: [0..8], where 0 - is: "O", 1 - is: "X" and 2 - is empty cell.

But what we have for the target vector? On every NN's step we need to know some target and make our distance to target shorter. But the target of this game is only win (or maybe draw), I don't understand how we can make shorter our distance to win. Is any suggestions?

My goal is to learn more about neural networks in games that's why I consider such easy game. Maybe it's not the best choice for the NN and I need to consider some other game? :)

sentences:
How to rotate (YAW) aircraft in XNA? I'm developing a flight simulator based on Riemer's Blog tutorial (XNA C#). To control the aircraft, I use the following code:

Quaternion additionalRotation = Quaternion.Identity;
additionalRotation *= Quaternion.CreateFromAxisAngle(Vector3.Forward, roll);
additionalRotation *= Quaternion.CreateFromAxisAngle(Vector3.Right, pitch);
model_ROTATION *= additionalRotation;

This only executes pitch and roll. I wanted to add code so that if the aircraft is rolling, then it should rotate to right or left (yaw) so I changed the code to the following:

Quaternion additionalRotation = Quaternion.Identity;
additionalRotation *= Quaternion.CreateFromAxisAngle(Vector3.Forward,roll);
additionalRotation *= Quaternion.CreateFromAxisAngle(Vector3.Up, yaw);
additionalRotation *= Quaternion.CreateFromAxisAngle(Vector3.Right, pitch);
model_ROTATION *= additionalRotation;

This behaviour is not so realistic; when I roll the aircraft rotates to right/left (yaws), but at the same time it loses altitude and I must pitch up (pull handle) to avoid crashing.

Is there any solution to make slew rotation (yaw) without losing altitude.

sentences:
Getting world coordinates from mouse position I am drawing a 2D mesh imported from CAD. The mesh vertex coordinates are in feet from some arbitrary origin and Z is always 0. I am supplying the coordinates to my shader program and using projection matrix, view matrix and model matrix to display everything. I am also using the view matrix and the model matrix to pan and zoom my 2D scene. I am trying to get the coordinates in feet from my mouse cursor coordinates. Should be a straightforward solution. A matrix multiplied by it's inverse will give you an identity matrix but something is very wrong. Here is my code (don't lough at the vb, I took over an old project):

Private Sub openGLControl1_MouseMove(sender As Object, e As MouseEventArgs) Handles openGLControl1.MouseMove
    Dim UnprojectMat As mat4 = glm.inverse(scene.projectionMatrix * scene.viewMatrix * scene.modelMatrix)
    Dim wCoordsVec As vec4 = UnprojectMat * New vec4(2 * e.X / openGLControl1.Width - 1, -(2 * e.Y / openGLControl1.Height - 1), 0, 1)
    wCoordsVec = wCoordsVec / wCoordsVec.w
    wCoordsLabel.Text = wCoordsVec.x.ToString + ", " + wCoordsVec.y.ToString
End Sub

And this is my vertex shader:

#version 150

in vec3 in_Position;

uniform mat4 projectionMatrix;
uniform mat4 viewMatrix;
uniform mat4 modelMatrix;

void main(void) {
    gl_Position = projectionMatrix * viewMatrix * modelMatrix * vec4(in_Position, 1.0);
//pass_Color = in_Color;

}

The in_Position vector is what I'm trying to get.
As you see, I normalized the mouse coordinates for the -1, 1 coordinate system. I don't have a viewport. I'm just using the entire gl control window. Please help me pinpoint what I'm doing wrong.

sentences:
Calculating Directional Shadow Map using Camera Frustum I'm trying to calculate the 8 corners of the view frustum so that I can use them to calculate the ortho projection and view matrix needed to calculate shadows based on the camera's position. Currently, I'm not sure how to convert the frustum corners from local space into world space. Currently, I have calculated the frustum corners in local space as follows (correct me if I'm wrong):

float tan = 2.0 * std::tan(m_Camera->FOV * 0.5);
float nearHeight = tan * m_Camera->Near;
float nearWidth = nearHeight * m_Camera->Aspect;
float farHeight = tan * m_Camera->Far;
float farWidth = farHeight * m_Camera->Aspect;

Vec3 nearCenter = m_Camera->Position + m_Camera->Forward * m_Camera->Near;
Vec3 farCenter = m_Camera->Position + m_Camera->Forward * m_Camera->Far;

Vec3 frustumCorners[8] = {
    nearCenter - m_Camera->Up * nearHeight - m_Camera->Right * nearWidth, // Near bottom left
    nearCenter + m_Camera->Up * nearHeight - m_Camera->Right * nearWidth, // Near top left
    nearCenter + m_Camera->Up * nearHeight + m_Camera->Right * nearWidth, // Near top right
    nearCenter - m_Camera->Up * nearHeight + m_Camera->Right * nearWidth, // Near bottom right

    farCenter - m_Camera->Up * farHeight - m_Camera->Right * nearWidth, // Far bottom left
    farCenter + m_Camera->Up * farHeight - m_Camera->Right * nearWidth, // Far top left
    farCenter + m_Camera->Up * farHeight + m_Camera->Right * nearWidth, // Far top right
    farCenter - m_Camera->Up * farHeight + m_Camera->Right * nearWidth, // Far bottom right
};

How do I move these corners into world space?

Update:

I'm still not sure if what I'm doing is right. I've also attempted to build the ortho projection by looping through the frustum corners and getting the min and max x,y,z coordinates. Then simply setting the values of the projection as:

left = minX
right = maxX
top = maxY
botton = minY
near = - maxZ
far = -minZ

I've searched on the internet but all the tutorials use hard coded values so the shadow maps aren't applicable to an open world but a restricted portion of the scene. Any help? Pseudocode is preferred as my linear algebra skills (and reading skills) aren't that great

sentences:
Map file format for Real-time strategy game I am planing to create a 2D RTS game on iPhone using cocos2d, besides the tile map, any other suggestion for storing the map details for the game?

Would be nice if a GUI editor is also provided.

sentences:
What are some good (retro) symbols for magic/mana/energy? Much like a heart is used a lot for health and lives in old retro games...

...what would be a good icon to use for Energy, Mana and/or Magic points?

sentences:
Performance in pathfinding/road calculation I have a question about the most effective way to detect road connection in a tile based world. Some time ago I already asked for "How to improve performance for expensive functions in 2d city builder" which was about building radius. Those hints were quite useful and worked great.
But now in this case I don't see I could use the same way as mentioned in that post. Let's start with my problem by a first image:

You can see 5 buildings on this little map. One on the left/the beginning of the map and four at the end of the long road on the right. All road tiles (separated in the black squares) are connected with each other.

Since I have to check if a building is still connected to the building on the left (which is the city entrance) it's needed to do regular road checks. To avoid doing expensive pathfinding stuff for each building I store the connection information in each road tile to have faster access. In the next image you can see those information. All road tiles have the same information since they are all connected to each other):

That works quite fast in smaller maps but if the map gets bigger, it's getting more expensive. My proceeding is the following: if a building is placed on a map it looks for surrounding roads. For these roads (could be up to 4 - for each direction) I check on and on if the next tile also has surrounding roads and so on. So finally I get an array of road tiles and update the road object information in all of them (whether building has been placed or removed). Do you know any optimization for this procedure already?

Since in a larger map I get an even bigger problem with the following situation:

Now I have a lot of objects on the right part of the map (this can be much, much bigger of course with hundreds of roads and buildings). If the player now disconnects the long road next to the building on the left, a lot of roads need to be updated.

Do you have any idea how I could improve handling this situation?

sentences:
Pygame set_colorkey transparency issues I'm having a strange issue that I cannot seem to remedy.  I am doing some prototyping with Pygame on a desktop running windows and a laptop running OS X.  Both are running python v2.7.3 (installed via homebrew for the Macbook) and pygame v1.9.1.

For transparency, I have been using set_colorkey with a transparency color of (255, 0, 255).  Here is the applicable code:

transColor = pygame.Color(255, 0, 255)
image = pygame.image.load(playerPath + "idle.png").convert()
image.set_colorkey(transColor)

This works flawlessly on my windows machine.  On my laptop, it does not work.  It just shows the hideous magenta color.  Here's the strange part.  If I change the transColor to (0, 0, 0), all black pixels in my images are transparent.  Has anyone run into this issue before?

sentences:
How do I manage textures in memory in OpenGL? I'm writing a game engine which is going very fine. However, I'm now posed with handling textures.

My Engine is in 2D, for simplicity reasons mostly to get a good idea of how to work with OpenGL. I do this in C++, and I have a hierarchical set-up when it comes to classes. There's a base class and some other classes derive from that.

So now I'm onto the part where I want to load up some textures and apply them to polygons. The way my engine works in drawing things is like this:

Load up a tile map file and parse it. The tile map contains all the information like events, lights, passability. All very interesting, not. Except the part where it loads a tileset, as defined by the map.
The parser realises the map uses a tileset, which is stored in resources/tilesets/dungeon_interior_cave1.xml, which contains all the information on what textures are used.
It loads the textures as said by the tileset-XML-file, it gives them an ID and then the SceneManager-class knows how to lay out the tiles and what texture to slap onto each of them. Once this is done, it tosses the instance of the SceneManager to the OpenGL renderer.

This might not be the best explanation of how my engine works, but simply put:

SceneManager loads the file resources/maps/dungeon3Interor.msf (msf being a custom map format (MSF stands for M age S cene F ile ). The MSF file refers to a tilset.
SceneManager loads the tile set at resources/tilesets/dungeon_interior_cave1.mts.
SceneManager loads up all the textures from resources/textures/< path_to_textures >
SceneManager tosses itself to the OpenGL render, and OpenGL renders the whole thing.

I think that's the best I can do at explaining. Know that the SceneManager itself contains no OpenGL code, just paths and information that OpenGL needs to know to render the scene.

What I'm interested in, what is the best practice to handle this, and how to handle OpenGL texture storage. I understand OpenGL keeps the textures in it's texture memory, and that I have to use glGenTextures to allocate a texture and that I then swap betwe--.. I actually have no clue.

What's a good way to keep track of all the textures you loaded into the memory and switch between them in C++, preferably using a class or a set of classes to accomplish this.

sentences:
Unity - How to move a user controlled animated gameobject programmatically? I have a player controlled gameObject with an attached script and animator with it's related animations. It all works great.

However the gameObject is on screen immediately on level startup.

I want to have the gameObject start off-screen so that story dialog can be displayed first and once completed the player gameObject will move onto the screen and then come under the players control.

I have been able to create a separate animator state for the "off-screen to on-screen" animation and it can be triggered separately in code. But I can't work out the logic needed to get the gameObject to do what I want.

In the enclosed image the PaddleIdle state keeps the paddle off screen.
The PaddleStartup state moves the gameObjects position onto the screen.
Once on-screen, the PaddleNormal state is supposed to start the gameObjects normal animations and allow player control.

I have tried a default transition from PaddleStartup to PaddleNormal but it performs one "PaddleStartup" sequence and then there is nothing.

I know I am missing something either I am not configuring a transition correctly or I am not scripting this correctly, can someone advise me on things I might try?

Thank you so much for your help

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:
Unity download image from Firebase database I am currently trying to download an image using Google Firebase.

The database stores a URL to an image on Firebase storage, Unity pulls the URL from the DB and uses Unity WWW to download it. However the texture shows up as a red question mark texture.

If I use a http URL from another website however it works, is Unity able to download from https addresses?

This downloads the URL from Firebase and stores it in the data_url variable:

void DownloadViaURL()
{
    Debug.Log("Called DownloadViaURL");
    FirebaseDatabase.DefaultInstance
   .GetReference("test_image")
   .GetValueAsync().ContinueWith(task => {
       Debug.Log("Default Instance entered");
       if (task.IsFaulted)
       {
           Debug.Log("Error retrieving data from server");
       }
       else if (task.IsCompleted)
       {
           DataSnapshot snapshot = task.Result;

           string data_URL = snapshot.GetValue(true).ToString();

           //Start coroutine to download image
           StartCoroutine(AccessURL(data_URL));
       }
   });
}

This uses Unity WWW to download from the URL:

IEnumerator AccessURL(string url)
{

    //Debug.Log("Accessing texture URL in database");
    using (WWW www = new WWW(url))
    {
        yield return www;
        Renderer r = GetComponent<Renderer>();
        r.material.mainTexture = www.texture;
        Debug.Log("Texture URL: " + www.url);
    }
}

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:
WaitForSeconds error I'm new to c# and coding, sorry if I sound like a noob... I don't know how to fix the waitforseconds error, and I don't know what's wrong.

public float restartDelay = 2f;

public TextMesh failText;
public TextMesh failTextGame;

private void Start()
{
    failTextGame.text = "";
}

System.Collections.Generic.IEnumerable<bool> OnTriggerEnter(Collider other)

{
    if (other.gameObject.CompareTag("Wall"))

    {

        failText.text = "Game Over!";
        failTextGame.text = "Try Again";
        yield return new WaitForSeconds(restartDelay);
        SceneManager.LoadScene(SceneManager.GetActiveScene().name);
    }
}

}

sentences:
How do I go about implementing different behaviors on items? How do I go about implementing different items with different behaviors?

I plan on having an inventory where those items are stored, but I can't figure out how do I go about implementing different functionality for each item.
Can somebody help me figure out where to look or how to go about this problem?

(This is not a question about inventory implementation, or specific item implementation, but how to implement functionalities of each usable item.)

sentences:
Tactics for moving the render logic out of the GameObject class When making games you often create the following game object from which all entities inherit:

public class GameObject{
    abstract void Update(...);
    abstract void Draw(...);
}

So in you update loop you iterate over all the game objects and give them a chance to change state, then in the next draw loop you iterate again over all the game objects and give them a chance to draw themselves.

Although this works fairly well in a simple game with a simple forward renderer it often leads to a few gigantic game objects that need to store their models, multiple textures and worst of all a fat draw method that creates a tight coupling between the game object, the current render strategy and any rendering related classes.

If I were to change the render strategy from forward to deferred I would have to update a lot of game objects. And the game objects I make are not as reusable as they could be. Of course inheritance and/or composition can help me fight code duplication and make it a bit easier to change implementation but it still feels lacking.

A better way, perhaps, would be to remove the Draw method from the GameObject class altogether and create a Renderer class. The GameObject would still need to contain some data about it's visuals, like what model to represent it with and what textures should be painted on the model, but how this is done would be left to the renderer. However there are often a lot of border cases in rendering so although this would remove the tight-coupling from the GameObject to the Renderer, the Renderer would still have to be all knowing about all the game objects which would make it fat, all knowing and tightly-coupled. This would violate quite a few good practices. Maybe Data-Oriented-Design could do the trick. Game objects would certainly be data, but how would the renderer be driven by this? I'm not sure.

So I'm at a loss and can't think of a good solution. I've tried to use the principles of MVC and in the past I had some ideas about how to use that in games, but recently it doesn't seem as applicable as I thought. I would love to know how you all tackle this problem.

Anyway let's recap, I'm interested in how the following design goals can be achieved.

No rendering logic in the game object
Loose coupling between game objects and render engine
No all knowing renderer
Preferably runtime switching between render engines

The ideal project setup would be a separate 'game logic' and render logic project that don't need to reference each other.

This thought train all started when I heard John Carmack say on twitter that he has a system so flexible he can swap out render engines at run time and can even tell his system to use both renderers (a software renderer and a hardware-accelerated renderer) at the same time so he can inspect differences. The systems I've programmed so far aren't even near that flexible

sentences:
Stencil buffer VS conditional discard in fragment shader I have a continuous height-mapped mesh to represent landscape. I also have 1 to let's say 10 wells on this landscape represented by additional models. What I want to achieve is to create an illusion of an actual hole in landscape at the place where the well sits.

I see the solution in two ways:

Draw holes to stencil buffer an then use it in fragment shader to discard landscape fragments.
Send an array of uniforms (vec2) and then conditionally discard fragments if they are near those hole-points.

The question is what way should I prefer if I'm good with rectangular holes and want to get best performance?

sentences:
Pointy top hexagonal A* pathfinding I'm trying to create a game with a hex based map with the points at the top. I have most of it working, however the path finding is being a little awkward. The heuristic I'm using is called Euclidean I believe and is like so:

var dx:Number = destinationNode.c - node.c;
var dy:Number = destinationNode.r - node.r;

return Math.sqrt((dx * dx) + (dy * dy));

Node is the node the unit is currently on, c is the node's column number and r is its row number. I'm using these as a simpler x and y coords. I'm trying to limit the unit to 3 hex moves in one round, so initially I thought it'd be as simple as IF returned heuristic < 3 unit can move to that hex, however it's not working out quite like that.

As you can see in the pic above, the bottom right selected hex with the "1 + 9 = 3.162277" is moveable to in 3 moves, however the hex with "9 + 1 = 3.162277" on the far right would need 4 moves to reach it. Can anyone offer any advice on how to make this work?

EDIT: My problem was being caused because I was using a Cartesian coordinate system and was just staggering every other Y coord. Fixed this by making the Y axis go down at a 60 degree angle. Thanks to amitp for the links that showed me what I was doing wrong.

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 obtain contrail visual effect? I have objects moving in OpenGL ES1 application. I want some of them to leave behind contrail – like if they would emit some radiation or something.

EDIT: the kind of contrail is:

light contrail – not smoke contrail,
the same effect occurs on LCD monitors with long pixel-switch time (it is called response time AFAIK).

HERE IS THE EXAMPLE IMAGE:
http://i.imgur.com/Fcb24.jpg

sentences:
How do I calculate the bounding box for an ortho matrix for Cascaded shadow mapping? I've been trying to get a cascaded shadow mapping system implemented on my engine, though it appears to be that the bounding boxes for the cascades aren't correct.
The part I'm interested in can be found here, under the function name "CalcOrthoProjs".
I've been trying to understand the matrix multiplications with this answer, and the ogldev variable and function names are kind of confusing me.
This is how I modified ogldev's function to work with my variables:
void Scene::calcOrthoProjections(Camera &camera, glm::mat4 LightView, std::vector<glm::mat4> &orthoContainer, std::vector<GLfloat> &cascadeEnd) {
GLfloat FOV, nearPlane, farPlane, ratio;
camera.getPerspectiveInfo(FOV, nearPlane, farPlane);
ratio = static_cast<GLfloat>(RE::config.height) / static_cast<GLfloat>(RE::config.width);

GLfloat tanHalfHFov = glm::tan(glm::radians(FOV / 2.0f));
GLfloat tanHalfVFov = glm::tan(glm::radians((FOV*ratio) / 2.0));

for (GLuint i = 0; i < NR_CASCADES; i++) {
    GLfloat xn = cascadeEnd[i]     * tanHalfHFov;
    GLfloat xf = cascadeEnd[i + 1] * tanHalfHFov;
    GLfloat yn = cascadeEnd[i]     * tanHalfVFov;
    GLfloat yf = cascadeEnd[i + 1] * tanHalfVFov;

    //The frustum Corners on View(Camera) space
    glm::vec4 frustumCorners[8]{
        //Near Face
        glm::vec4( xn,  yn, cascadeEnd[i], 1.0),
        glm::vec4(-xn,  yn, cascadeEnd[i], 1.0),
        glm::vec4( xn, -yn, cascadeEnd[i], 1.0),
        glm::vec4(-xn, -yn, cascadeEnd[i], 1.0),
        //Far face
        glm::vec4( xf,  yf, cascadeEnd[i + 1], 1.0),
        glm::vec4(-xf,  yf, cascadeEnd[i + 1], 1.0),
        glm::vec4( xf, -yf, cascadeEnd[i + 1], 1.0),
        glm::vec4(-xf, -yf, cascadeEnd[i + 1], 1.0),

    };

    //The frustum Corners in LightSpace
    glm::vec4 frustumCornersL[8];

    GLfloat minX, maxX, minY, maxY, minZ, maxZ;
    minX = minY = minZ = std::numeric_limits<GLfloat>::max();
    maxX = maxY = maxZ = std::numeric_limits<GLfloat>::min();

    glm::mat4 cam = (camera.getProjection() * camera.getView());
    glm::mat4 camInverse = glm::inverse(cam);

    for (GLuint j = 0; j < 8; j++) {
        //View(Camera) space to world space
        glm::vec4 vW = camInverse * frustumCorners[j];
        //world space to light space
        frustumCornersL[j] = LightView * vW;

        minX = min(minX, frustumCornersL[j].x);
        maxX = max(maxX, frustumCornersL[j].x);
        minY = min(minY, frustumCornersL[j].y);
        maxY = max(maxY, frustumCornersL[j].y);
        minZ = min(minZ, frustumCornersL[j].z);
        maxZ = max(maxZ, frustumCornersL[j].z);
    }
    orthoContainer[i] = glm::ortho(minX, maxX, minY, maxY, minZ, maxZ) * LightView;
 }
}

LightView represents a matrix created with:
glm::LookAt(-glm::normalize(light.direction), glm::vec3(0.0), glm::vec3(0.0, 1.0, 0.0))

camera.getProjection() returns the perspective matrix of the main camera
camera.getView() returns a LookAt at the objective the camera is looking at
The orthoContainer values are then fed into the depth rendering unaltered afterwards (by anything other than the model matrix of each model)
I wrote some comments on how I think the math is done, trying to understand what's wrong.
The result is a frustum too wide, resulting on low res shadows(even for the closest shadow map):

and this is the depth map of the closest shadow map:

any insight as to why this isn't working, or any other best practice advice, is welcome.

sentences:
How to make my sprite jump in pygame? I wonder how to make a sprite jump in pygame! Can anybody explain if possible?
Thank you!

sentences:
How to only detect Actor and not background I'm making a game where I have buttons on a stage, but the background also acts as a "button". But when I press on one of the existing actors on the stage, it also registers a click in the background in addition to the click on the button. How can I fix this?

Inside constructor

button = new ImageButton(getDrawable(new Texture("PlayUp.jpg"))); //only using one image atm
button.setSize(150, 134);
button.setPosition(camera.position.x, camera.position.y);
stage = new Stage(viewport);
        Gdx.input.setInputProcessor(stage);
        stage.addListener(new ClickListener(){
            @Override
            public void clicked(InputEvent event, float x, float y) {
                System.out.println("Background touched");

            }
        });
        button.addListener(new InputListener() {
            @Override
            public boolean touchDown(InputEvent event, float x, float y, int pointer, int button) {
                return true;
            }

            @Override
            public void touchUp(InputEvent event, float x, float y, int pointer, int button) {
                System.out.println("Button touched");
            }
        });
        stage.addActor(button);

part of render() method

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

    tapCatch.batch.setProjectionMatrix(camera.combined);
    tapCatch.batch.begin();

    stage.act(delta);
    stage.draw();

    tapCatch.batch.end();

}

sentences:
Mesh contents get flipped I am using below shader with my mesh object that is showing a webpage. It is showing fine but the problem is the web page has flipped:
 Shader "UI/Default_OverlayNoZTest"
 {
     Properties
     {
         [PerRendererData] _MainTex ("Sprite Texture", 2D) = "white" {}
         _Color ("Tint", Color) = (1,1,1,1)

         _StencilComp ("Stencil Comparison", Float) = 8
         _Stencil ("Stencil ID", Float) = 0
         _StencilOp ("Stencil Operation", Float) = 0
         _StencilWriteMask ("Stencil Write Mask", Float) = 255
         _StencilReadMask ("Stencil Read Mask", Float) = 255

         _ColorMask ("Color Mask", Float) = 15
     }

     SubShader
     {
         Tags
         {
             "Queue"="Overlay"
             "IgnoreProjector"="True"
             "RenderType"="Transparent"
             "PreviewType"="Plane"
             "CanUseSpriteAtlas"="True"
         }

         Stencil
         {
             Ref [_Stencil]
             Comp [_StencilComp]
             Pass [_StencilOp]
             ReadMask [_StencilReadMask]
             WriteMask [_StencilWriteMask]
         }

         Cull Off
         Lighting Off
         ZWrite Off
         ZTest Off
         Blend SrcAlpha OneMinusSrcAlpha
         ColorMask [_ColorMask]

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

             struct appdata_t
             {
                 float4 vertex   : POSITION;
                 float4 color    : COLOR;
                 float2 texcoord : TEXCOORD0;
             };

             struct v2f
             {
                 float4 vertex   : SV_POSITION;
                 fixed4 color    : COLOR;
                 half2 texcoord  : TEXCOORD0;
             };

             fixed4 _Color;

             v2f vert(appdata_t IN)
             {
                 v2f OUT;
                 OUT.vertex = mul(UNITY_MATRIX_MVP, IN.vertex);
                 OUT.texcoord = IN.texcoord;
 #ifdef UNITY_HALF_TEXEL_OFFSET
                 OUT.vertex.xy += (_ScreenParams.zw-1.0)*float2(-1,1);
 #endif
                 OUT.color = IN.color * _Color;
                 return OUT;
             }

             sampler2D _MainTex;

             fixed4 frag(v2f IN) : SV_Target
             {
                 half4 color = tex2D(_MainTex, IN.texcoord) * IN.color;
                 clip (color.a - 0.01);
                 return color;
             }
         ENDCG
         }
     }
 }

I am using above shader so that the mesh should be shown on top of everyting.

sentences:
2D destructable terrain with collisions in MMO Task

What I want is to create destructable terrain (like in Worms) and collisions with this terrain (with calculated normals) that will be fast enough to work on server machine.

Basically lets say that I want to make Worms Online (I don't really) using model CLIENT-SERVER, not peer2peer.

Approaches I read about

People in other threads were suggesting using bitmaps and perpixel collisions, but is it fast enough to handle i.e. 100 games simultaneously?
Another approach is using vectors to track outline of terrain, but it seems also really CPU heavy and I didn't find any good example of that.

So guys what is your proposal?

sentences:
Goalkeeper Jumping Algorithm? This may be a "best way to" question, so may be susceptible to opinion-based answers (which is ok for me). But I would also like if there are any tutorials , research papers , etc.

I'm trying to make a 3D free kick game, and I want to decide on the Goalkeeper algorithm.

Usually (and in my game) the shot is a function of direction , power and swerve. Maybe wind can be a factor too. So the shots trajectory is pre-deterministic, i.e., the point that intersects the goal (or out) plane is determined as soon as the shot fires.

So what could be a good approach for the goalkeeper to jump (or walk) ?

I have two approaches in mind :

1- determine the point, and jump to there.
2- when the ball is closer than a threshold distance, estimate the point by the ball's velocity vector, and jump to there.

The problem with the first approach is, goalkeeper will always save the shot, which I want to prevent. So there should be some kind of randomness, or the goalkeeper's ability to jump and walk will be restricted.

The problem with the second approach is, when there is a high amount of swerve, the goalkeeper will always fail to save the shot.

So how could these approaches be better?

Thanks for any help !

Edit:

if you want to play the game, click here

sentences:
How can I avoid player see through the avatar? I'm creating a SteamVR/HTC Vive game with Unity3D. I have a rigged avatar performing animations. Currently, if the player goes forward, it will see the moving eye balls and others inside the head. Since it's a small space, I can't allow him to step back to avoid the see-through caused by the collision.

What are other options to avoid it?

I'm thinking about setting up two colliders, one on the animated model and the other on the head of the player, so it can trigger a 360 dark screen to warn the player. How should I create the dark screen for the warning?

sentences:
How to measure time interval (different languages) What is the recommended way to measure time intervals for a game loop?

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

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

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

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

This is a community wiki.

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:
Bullet - objects falling through I have problem with bullet collisions. You can see problem on this video (around 0:18):

http://goo.gl/DiVP8l

Objects are "embeded" inside vertical bars - that is not correct - they should be bouncing like at the beggining of the video. I am using sphere and box as bullet bodies. I have also enabled CCD, that improves stability a little, but problem is still there.

Pulsing bars are controlled with this code:

dist = distance I need the bar to change its position in a single frame
float g = (2 * dist) / (times.dTime); //dTime = 1/60
bars[i]->GetBulletBody()->setLinearVelocity(btVector3(0, 0, 0));
bars[i]->GetBulletBody()->setGravity(btVector3(0, speedUpFactor * g, 0));

I have constant update rate of physics and world, set to be 1/60 s.

sentences:
Can custom maps in Starcraft 2 automatically enable certain unit upgrades? If I create a custom map with the Starcraft 2 map editor, how can I specify that some unit upgrades are already researched?

For example, if I want all the units to already have the weapons upgrade 1 at the beginning of the game, can I specify this in the editor?

I've looked through the menus but didn't find anything that looked like it would relate to unit upgrades.

sentences:
How do MMO servers communicate with players who are behind a NAT? I'm now planning to develop a real-time mmo in the future using udp as the transmission protocol since it has lesser overheads than tcp... I understand that between the client and the server, they have to do 2 basic things, the client needs to send server updates such as character positions..movements..hitting a monster..etc, and the server needs to update all the clients connected to render the changes on their screen...

For the client updating the server, I'll most probably do it by sending fast UDP packets to the server, but however for the server to update client, the server will send UDP packets to client containing the updates, however what if a client is behind a NAT? How do the server "push" udp packets to clients connected to a NAT-based network?

I plan to write the server in Java, I've also read about NAT hole-punching with various techniques like STUN..TURN..ICE.. however I can't seem to find a good framework/solution for it..

I also wonder how MMOs today like Maple Story..WOW..League of Legends implemented it..

sentences:
What defines a minigame? A "minigame" (sometimes mini-game) is a rather common term used in game design and the general game industry. Therefore it has a definable scope, that is not opinion based, but rather established and tangible. However, I'm at a loss to define its scope. The wikipedia page says:

  "A minigame (also spelled mini-game or mini game and sometimes called
  a subgame) is a short video game often contained within another video
  game and sometimes in application software or on a display of any form
  of hardware. A minigame is always smaller or more simplistic than the
  game in which it is contained. Minigames are sometimes also offered
  separately for free to promote the main game. For instance, the
  Pokémon Stadium minigames involve merely pressing a few buttons at
  specific intervals, with little complexity."

When asked to define it, I guess loosely I'd consider a minigame any game that:

could easily be a self-contained game within another one
that usually shows all the information on the screen
could have been produced in the "dawning of gaming" (At least its mechanics)
that the average (perhaps even non-gamer) can sit down and instantly
understand nearly all the game rules without having to "learn" them via
play.

Some things to think about:

Is Game_B that has been included in another game, Game_A, still
a minigame if it is later played or released independently from
Game_A?
What if Game_B was originally independent, but Game_B (or
clones) are now almost exclusively found as minigames within other
games? Will Game_B always be a minigame after that?
Is pong a minigame - it most certainly has been a minigame?
Likewise, is chess a minigame (it matches my personal definition
despite being incredibly complex logically)?

(I don't know if I can link pictures here, otherwise I would add some examples.)

Answers should please be constructive and professional. Good answers should also give reasoning and cite sources when possible.

sentences:
Using an Entity System Architecture with Task Based Parallelism Background

I have been working on creating a multithreaded game engine in my spare time and I currently trying to decide the best way to work an entity sytem into what I have already created. So far, I have used this article from Intel for a starting point for my engine. Thus far I have implemented the normal game loop using tasks, and I am now moving on to getting some of the systems and/or entity-systems incorporated. I have used something similar to Artemis in the past, but the parallelism is throwing me off.

The article from Intel seems to advocate having multiple copies of entity data, and a having changes made to each entity internally being distributed at the end of a complete update. This means that rendering will always be one frame behind, but that seems like an acceptable compromise given the performance benefits that should be gained. When it comes to an entity system like Artemis, though, having each entity being duplicated for each system means that each component will also need to be duplicated. This is doable but to me it seems like it would use up a lot of memory. The portions of the Intel document that discus this are 2.2 and 3.2.2 mainly. I have done some searching to see if I could find any good references for integrating the architectures I am going for, but I have not yet been able to turn up anything useful.

Note: I am using C++11 for this project, but I imagine most of what I am asking should be pretty language agnostic.

Possible Solution

Have a global EntityManager that is used for creating and managing Entities and EntityAttributes. Allow read access to them only during the update phase, and store all changes in a queue per thread. Once all tasks are completed the queues are combined and the changes in each are applied. This would possibly have problems with multiple writes to the same fields but I am sure there could be a priority system or timestamp to sort that out. This seems like a good approach to me because systems can be notified of changes to entities pretty naturally during the change distribution stage.

Question

I am looking for some feedback on my solution to see if it even makes sense. I won't lie and claim to be an expert on multithreading, and I am doing this largely for practice. I can forsee some complicated messes rising from my solution where multiple systems are reading/writing multiple values. The change queue I mentioned could also be hard to format in a way that any possible change could easily be communicated when I am not working with POD.

Any feedback/advice would be much appreciated! Thanks!

Links

http://software.intel.com/en-us/articles/designing-the-framework-of-a-parallel-game-engine
http://gamadu.com/artemis/
http://www.gamedev.net/topic/560083-rendering-in-a-task-based-multithreaded-environment/ (not mentioned in post this post but similar solution mentioned)

sentences:
Handling movement using an Entity Component-based System Architecture I have seen various descriptions of how to handle movement in a component-based entity framework.  The most common I've stumbled across is the idea of using components called Controller, Physics, Transform, Velocity, and Collider.

The idea here is that the Controller influences the Velocity component when movement keystrokes are detected.  The Velocity component in turn influences Physics.  Once the simulation has been stepped, the Collider is either affected if a collision occured or is not if no collision happened.  In the end, the Transform is updated with the new position from the physics simulation step and thusly the Renderable needs to be adjusted so it is drawn in the proper location.

I have often read that one needs to consider both physics-driven and non-physics-driven entities.  As outlined in the above paragraph, manipulating physics-driven entities seems like a piece of cake.  The difference with non-physics-driven entities is that the Velocity component values need to simply be applied to the the Transform based on delta-time.  This would allow moving the entity without being concerned with physics nor collision detection.

For physics-driven entities, one simply iterates entities with both Velocity and Physics components.  But for non-physics-driven entities, simply iterating over entities with a Velocity component isn't sufficient as it would include the above subset as well.

So there must be some factor that clearly separates these two cases.  So with these two cases in mind, how would movement actions that influence the values of Velocity be carried out in such a system to manipulate both types of entities whether physics plays a roll in their movement or not??

And lastly, considering that there may be times where the transform for an entity needs to be manipulated directly, such as player clicking on a portal to be teleported to another x/y/z position, how would one properly propagate this change to adjust both the physics step simultation and the renderable's draw location?

EDIT:
@bobenko
Your explanations provide insight to the most common case where objects are simulated via physics but I'm somewhat lost on the Kinematic aspect regarding updating an entities position via a velocity value?  Are you simply implying that some code of my own will apply movement to the entity via velocity, thus being Kinematic? I still am interested in your explanation on how to avoid cyclic notifications effectively when aspects of these components involved change.

For all who answered, I'm still not clear how would you handle teleporting an entity from one position to another?  Would this involve turning off physics, teleporting the player, then turning physics on after teleport finished?  Turning physics on/off can be as simply as setting the entity as Kinematic YES/NO, right?

sentences:
Collision detection via adjacent tiles - sprite too big I have managed to create a collision detection system for my tile-based jump'n'run game (written in C++/SFML), where I check on each update what values the surrounding tiles of the player contain and then I let the player move accordingly (i. e. move left when there is an obstacle on the right side).

This works fine when the player sprite is not too big: Given a tile size of 5x5 pixels, my solution worked quite fine with a spritesize of 3x4 and 5x5 pixels.

My problem is that I actually need the player to be quite gigantic (34x70 pixels given the same tilesize). When I try this, there seems to be an invisible, notably smaller boundingbox where the player collides with obstacles, the player also seems to shake strongly. Here some images to explain what I mean:

Works:
Doesn't work:
Another example of non-functioning:   (the player isn't falling, he stays there in the corner)

My code for getting the surrounding tiles looks like this (I removed some parts to make it better readable):

std::vector<std::map<std::string, int> > Game::getSurroundingTiles(sf::Vector2f position)
{
    // converting the pixel coordinates to tilemap coordinates
    sf::Vector2u pPos(static_cast<int>(position.x/tileSize.x), static_cast<int>(position.y/tileSize.y));
    std::vector<std::map<std::string, int> > surroundingTiles;

    for(int i = 0; i < 9; ++i)
    {
        // calculating the relative position of the surrounding tile(s)
        int c = i % 3;
        int r = static_cast<int>(i/3);
        // we subtract 1 to place the player in the middle of the 3x3 grid
        sf::Vector2u tilePos(pPos.x + (c - 1), pPos.y + (r - 1));

        // this tells us what kind of block this tile is
        int tGid = levelMap[tilePos.y][tilePos.x];

        // converts the coords from tile to world coords
        sf::Vector2u tileRect(tilePos.x*5, tilePos.y*5);

        // storing all the information
        std::map<std::string, int> tileDict;
        tileDict.insert(std::make_pair("gid", tGid));
        tileDict.insert(std::make_pair("x", tileRect.x));
        tileDict.insert(std::make_pair("y", tileRect.y));

        // adding the stored information to our vector
        surroundingTiles.push_back(tileDict);
    }

    // I organise the map so that it is arranged like the following:
    /*
     * 4 | 1 | 5
     * --  -- --
     * 2 | / | 3
     * --  -- --
     * 6 | 0 | 7
     *
     */
    return surroundingTiles;
}

I then check in a loop through the surrounding tiles, if there is a 1 as gid (indicates obstacle) and then check for intersections with that adjacent tile.

The problem I just can't overcome is that I think that I need to store the values of all the adjacent tiles and then check for them. How? And may there be a better solution?
Any help is appreciated.

P.S.: My implementation derives from this blog entry, I mostly just translated it from Objective-C/Cocos2d.

sentences:
"Painting" elements in html5 canvas I'm making a game in coffeescript (although for the sake of this problem that's probably not all that relevant) and html5's canvas. It's a game that involves a paint cannon, that fires circular particles of paint that can paint elements of the level and the player. The problem is I'm not sure how to accomplish the painting. The diagram below illustrates what I'm trying to accomplish:

Using canvas, the particles are drawn using context.arc(), the players using drawRect.arc() and the floor can be an arbitrary polygon with drawing code as follows:

    @drawingContext.beginPath();

    tV = b2Math.AddVV(pos, b2Math.MulMV(body.GetTransform().R, @vertices[0]))
    @drawingContext.moveTo(tV.x, tV.y)
    for i in [1..@vertices.length - 1]
        v = b2Math.AddVV(pos, b2Math.MulMV(body.GetTransform().R, @vertices[i]))

        @drawingContext.lineTo(v.x, v.y)
    @drawingContext.lineTo(tV.x, tV.y)

    @drawingContext.closePath()
    @drawingContext.stroke()
    @drawingContext.fill()

It would be too intensive to keep track of all the circles that should be painted on to objects and would soon bog down, with potentially 60 clipped circles per second being added to be drawn on top of objects.

The original thought was to stack two canvases on top of each other, so then we could draw the levels once and then when ever necessary just draw the paint splat over them once and forget about it (changing the composition mode to source-atop to get appropriate clipping), and since we're not redrawing it would stay there. However, this won't work on moving objects (like players) (that can also rotate and change size relative to the camera). I'm not sure how to do it, since all objects are made up of solid colour to start with there's no texture data or anything we can modify.

sentences:
Should I update VAO when I update a VBO? My VAO/VBO/IBO work fine on iPad and other devices on Android excepted two (A Samsung galaxy S4 and a Sony Xperia S).

A problem is present when I start my application on this devices, every elements move everywhere and start to blink on each frame, the problem is present on every element updated during the simulation.

I have a SpriteRenderer who share a VBO, so I need to update this VBO on each frame for each sprite (change color, uvs, …).

The visual glitch is not present on static element (like text).

So my question his:

Did I have to do something with my VAO on each frame?

Here is what I've got:

Init part:

 - bind vao
     -> Bind vbo
     -> Bind ibo
 - unbind vao

Rendering part:

for( sprites )
{
     // Update (Need to bind VAO here?)
     bind vbo (lock)
     update vbo data
     unbind vbo (unlock + bind)

     // Draw.
     bind vao
     drawElement
     unbind vao
}

Thanks!

sentences:
does glBindAttribLocation silently ignore names not found in a shader? Does glBindAttribLocation silently ignore names that are not found? For example, in a shader:

// Some vertex shader
in vec3 position;
in vec3 normal;
// ...

And in some set up code:

// While setting up shader
GLuint program = glCreateProgram();
glBindAttribLocation(program, 0, "position");
glBindAttribLocation(program, 1, "normal");
glBindAttribLocation(program, 2, "color"); // What about this one?
glLinkProgram(program);

sentences:
What is the difference between "stealth" and "social stealth?" I was recently researching the stealth mechanics of several games and I stumbled across the distinction of "stealth" (eg. Splinter Cell series) vs "social stealth" (eg. Assassin's Creed series).

What exactly is the difference between these two terms?

sentences:
Which 3D file format should my engine use if I don't want to have to change it later? Is there a de facto format for exporting a 3D model from modeling software to a game engine?

I know it varies by engine and situation, but what is the general idea that comes to a skilled game developers mind when this question comes up?

In my mind obj format comes up, but it doesn't support animation.

So, what could be the best format which supports/covers more or less every feature that an modern engine can cover? FBX? Collada?

Some professional insight would help.

sentences:
Why does exporting to FBX in 3dmax loses simulated animation I made a cloth simulation (wind blowing a cloth). When I export it to FXB and the animation box is ticked on export menu it seems ok (no error in longs). When I reload it to Unity. or 3DMAX again. The wind animation is lost. How can I fix that?

Thanks

sentences:
Game Mechanics Suitable for a Game about Issues of Immigrations So, I'm working on a video game design concept, dealing with the problems of an immigrant family and how they will try to blend in the society. The universe is a fictional universe.

I was wondering what game systems/mechanics/genres are suitable for such a concept? How can I use the mechanics in a sense that will be coherent with the narrative that I'm trying to tell?

sentences: How to put an invisible marker on a model and refer to it in the game? I am using XNA/C# to load up 3ds Max models exported in FBX format. Is there some way to mark a specific point in the model like the pipe of a gun so I can just refer to it and place a bullet in there directly to make shooting look good?

sentences:
How does Unity's Entity-Component System Work In Practice? On the surface Entity-Component seems like a good way to program games. Everything is a game object and those game objects are made up of components. The attraction is components are very flexible, just requiring you to "add" them to a game object to inherit it's functionality.

So, obviously a good example might be a platform the character has to jump on. Maybe this thing has a collider, a moving component, maybe a rotating component, or maybe even a rigid "RotatingAndMovingPlatformComponent". Okay, that sounds great, just add all these components to the game object and that's it, you have this extra functionality. However, I find that this level of complexity is where it's usefulness ends.

Try this with menus, complex character movement with multiple states, abstract ideas like game modes or game state, and your flexibility and modularity are destroyed. Menus involve a lot of specifics, complex character movement often involves many states meaning either communication between these components is needed or there must be a controlling component made just for this type of character. On top of this, some components will need to rely on game state in some way.

I see very little benefit to programming this way over ordinary inheritance. The lack of object structures at compile time makes doing a lot of things very difficult and unreliable.

I feel the best and easiest way of going about things would be using larger components with more dependencies. I don't see this as a problem ( more like unreal 4's architecture ), but then I wonder what's the point in the Entity-Component architecture.

sentences:
What is the universal "Distance Point" for human vision? I'm not sure if this is the technical term, but I'm asking: At what rate do things scale bigger and smaller as they move toward and away from the human eye?

I know the equation for the linear perspective grids below are,

(size changed by this %) = 5/((distance to object) + 5) for the grid on the left
and
(size changed by this %) = 3/((distance to object) + 3) for the grid on the right

The '3's and the '5's come from the distance from the distance point to the vanishing point.
On the grid on the right the objects smaller at a bigger rate as they move back than they do on the grid on the rate that has a distance point of 5.

for example: a circle with a 1' diameter at (distance to object) = 0
will be 0.5' at 5' away because...
0.5 = 5(5 + 5) = 5/10 = 1/2

I know one point perspective is not nearly the most accurate model, but I'm only interested is calculating the size of objects depending on their size, or vice versa. Maybe you have a better equations that scales objects the same way the eye perceives.

Right now I only know what it isn't. It's not depth of field because that has to do with what's in focus.
It's not the range of vision in terms of degree or depth perspective because the eye(s) can see things shrink at the same rate with one eye looking at things going straight away from me.

In both of my grids the hieght from the horizon is 5' but things scale bigger and smaller at the same rates away from you whether you're on the ground or in a hot air balloon.

I suppose whatever the different setting there is between a fish eye and my eye is what I'm asking.

So, please. What is the distance point for the human eye?

sentences:
Total Texture memory size iOS / OpenGL ES My team is running into an issue where the amount of texture memory allocated via the glTexImage2D is high enough that it crashes the app ( at about 400 MB for iPhone 5). We're taking steps to minimize the texture allocation ( via compression, using fewer bits/channel and doing procedural shaders for VFX etc).

Since the app crashed on glTexImage2D, I felt like, it's running out of texture memory (as against virtual memory). Is there any documentation/guideline on the recommended texture memory usage by an app (not just optimize your texture memory) .

AFAIK on iOS devices ( and many Android devices) there's no dedicated VRAM and our app process is still well within the virtual memory limit. Is this some how related to the size of physical RAM ? My searches so far has resulted only in info on max texture size and tricks for optimizing texture usage and such. Any information is appreciated.

sentences:
3D 3-axes rotation into 3D 2-axes rotation Hello everyone and thanks in advance to anyone who'll help me through this !

I am currently working on the Kinect V2 (for XBox One) to interact with an avatar.
I'd like to use the rotation quaternion that the SDK 2.0 give for each joint of the Skeleton. My avatar (virtual avatar of NAO robot) communicates through nautical angles, yaw, ptich and roll. There's no problem to convert quaternions into nautical angles, but here's my problem :

Let's take the shoulder as an example of joint; Where the Kinect express the rotation of my shoulder as a 3-axes rotation, I need to convert it into a 2-axes rotation.

So for my shoulder I have a [Yaw, Pitch, Roll] from the Kinect, which I want to convert into a [Pitch, Roll] for NAO's avatar

At the beginning, I didn't see the problem; I just ignored the Yaw angle. But I rapidly noticed that the movement was not the same than in the Kinect (and it makes sense).

Can someone help me ? How can I convert a 3D 3-axes rotation into a 3D 2-axes rotation ?

sentences:
How does Hierarchical Pathfinding deal with obstructions in the same chunk? Aigamedev.com provides this visualization of HPA*:

All the nodes within the same chunk connect to each other. What if there was an obstruction between nodes in the same chunk? For example:

What would the resulting visualization look like with an obstruction in the center bottom left chunk? How would this be detected?

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: Reason for white lines in tile-based game My game is tile-based. I am getting this lines between two tiles. They don't look nice. How can i resolve this issue?

sentences:
How to address players struggling with simple controls? I have an HTML game I built with Phaser 3, and I can't decide what to do with the controls. I've changed them several times, and now I feel like I've hit a sweet spot between usability and fun. However, I still see people struggle.

The game involves a boy with a slingshot that can be pulled back and fired to knock the enemy's head off. There are two virtual buttons on both side of the screen that are tapped to turn the character. I'm considering having the character turn automatically, so that the slingshot is the only mechanic involved and the game can be picked up and played without instructions. However, I feel like this will destroy the whole point of being fast to turn and shoot the enemy.

Should a simple game like mine require instructions, or is usability more important?

sentences:
How can the player select his weapon among many? I'm working on the prototype of my game, I want one of the options to have a very large amount of weapons. I have searched for tutorials, but I have only found weapons changes where the weapons have already been loaded in the scene from the inspector, like this https://youtu.be/Dn_BUIVdAPg where they are only activated and deactivated.
But I want a game like dofus where there are hundreds of weapons, I think I have a data file of the weapons and so, I can load the correct model of the weapon.
How can I get the model loaded?

I have read other tutorials regarding the AssetBundle, but I think that is when you need to download the models from a server for example, but I just want to load them from the same project.

sorry for the bad english

sentences:
Admob is load failing by No Fill error I’m using official admin plugin for Unity implementing Reward video.

But it’s only working for test unit id, when I replacing it to my own unit id, it just failing load by error “No Fill”.

Even when I add test device, still happening the issue.

How can I fix this?

sentences:
What is the most efficient way to determine collision path I am trying to create a game in which I need to know if two objects will collide in the future, and when. I have both object's position, radius (they are circles) and velocity.

A specific example of where this could be used is in a game with an asteroid field. The asteroids position, radius and a constant linear velocity. I want to determine if on their current trajectory, will they crash. If yes, in how much time.

I have tried to set up the position of the objects as a function of time:
P(t) = o + v(t)

Where P(t) is the new position, o is the original position v is the velocity and t is time.

Using this for both objects and attempting to solve for t, I get a very messy and long equation.

sentences:
Is there a way to duplicate the windows desktop zooming in SDL to make low res pixels look like stylyzed cartoon art? When you hit the Win key and numpad plus key at the same time it opens the desktop magnifying glass and the effect of this on low res pixel art is to make it look like super cool stylized cartoon art. I want the game to look like this all the time. Is there a way to do this permanent i SDL or DirectX or OpenGL?

How I have achieved this image is to run the game in a small windows and have the windows 10 magnifying glass hoover over it and I hit print screen. And I want the game to look like this all the time in full screen.

Ps. This is the Gradius 3 ship that I use for place holder graphics for question asking purposes.

sentences:
Libgdx: how to pick a random texture? I'm trying to pick a random texture from a fodler placed in assets and use it but it's giving me errors. I'm doing so in the main game screen class

    final  File dir = new File("img");
    Random rand = new Random();
    File[] files = dir.listFiles();
    File file = files[rand.nextInt(files.length)];
    Image = new Texture(Gdx.files.internal(file.getPath()));

The error is

java.lang.NullPointerException: Attempt to get length of null array

to my knowledge this error should only be there if File[] files = dir.listFiles(); is null, and it isn't, currently two pictures are there. So what's happening?

I tried supplying the full path in the first line to img folder but to no avail. Plus I don't want to supply the full path anyway, it will change  from device to another.

sentences:
A* pathfinding question I'm trying to get a grasp on the A* pathfinding algorithm. Using the image I attached.

If the green square represents the start, and red represents the end. wouldn't the algorithm bring me up towards the top of the grid, and then circle me back around, because of the wall?

It would seem the algorithm would never start by moving downward first because the F cost would initially appear more expensive?

Is this a problem with the basic manhattan heuristic? Or am I just missing something?

sentences:
Moving at constant speed and angle The picture illustrates

I cannot figure out the math on this. The "arrows" should move at the same speed in both examples.

sentences:
How to circle an uneven object with Camera at a fixed distance? Unity3d. I am trying to move an object with Camera around a fixed terrain (Mountain), while staying an set distance from its edge.  I have the camera set to lookAt the mountain, and I want to circle the mountain.  I was thinking about sine wave for circular motion but its not an exact circle as I need to move in or out to maintain the fixed distance from the mountains edges.

It looks like I might need transform.RotateAround(..), but what about the adjusting to maintain a fixed distance from the edge of the uneven surface while maintaining the circular motion.

    transform.RotateAround (Vector3.zero, Vector3.up, 20 * Time.deltaTime);

Update:  Here is my current script for circling around mountain as first person object:

function Update () {
   var mountain : GameObject;
   mountain = GameObject.Find("QuantumCold_B");
   transform.RotateAround(mountain.transform.position, Vector3.up,20 * Time.deltaTime);

}

Unfortunately there are two problems:

1) The first person object appears to be falling or maybe its the main camera, but in any even there is a game screen looks like its falling below the mountain.
2) it is the mountain that seems to be rotating. Do I need to switch the main camera to be the first person camera. Why does the mountain appear to be rotating?

sentences:
StopCoroutine is not stopping my coroutine in Unity I'm getting some attacking to work with my units and I noticed that the coroutines seem to start adding up even after the StopCoroutine(IEnumerator) as need called.

I dug around on ways to perform an attack loop, most of the time I found "Use InvokeRepeating" and "Don't use InvokeRepeating". Since invoke uses reflection it's performance heavy anyways, so I'd rather not go down that road.

How do I get my coroutine to stop? Is it because it's in a while loop inside the coroutine? If so, how do I fashion an attack loop without using invoke?

//Recieves call when a new enemy is added to the list
public void NewEnemyDetected()
{
    if(currentlyAttacking == null)
    {
        SelectEnemyToAttack();
    }
}

//Recieves call when an enemy leaves the collider area
public void EnemyGone()
{
    SelectEnemyToAttack();
}

//Will select an enemy from the array to attack
private void SelectEnemyToAttack()
{
    if(enemyObjects.Count > 0)
    {
        StopCoroutine(AttackEnemy());
        currentlyAttacking = enemyObjects.ElementAt(0);
        isAttacking = true;
        StartCoroutine(AttackEnemy());
    }
    else
    {
        currentlyAttacking = null;
        isAttacking = false;
    }
}

//Partially hacked together attacking loop
private IEnumerator AttackEnemy()
{
    while(isAttacking)
    {
        Vector3 angle = currentlyAttacking.DetectedGameObject.transform.position - transformV.position;
        angle = angle.normalized;
        GameObject projectile = (GameObject)Instantiate(AttackType, transformV.position, transformV.rotation);
        BlasterAttack projectileAttack = projectile.GetComponent<BlasterAttack>();
        projectileAttack.OnCreation(10, player);
        projectile.GetComponent<Rigidbody>().AddForce(angle * 100);
        yield return new WaitForSeconds(1);
    }
    yield return false;
}

Thanks!

sentences:
How do I create the playing field for my game? I want to create a game with playfield as shown in the video in OpenGL

www.youtube.com/user/stanfordcs248

I have fair knowledge of OpenGL and I know this playfield can be rendered using several different cubes but that takes a lot of effort. Also it takes away the power of easily modifying the field. One idea that was suggested to me to solve this problem was to use an XML file describing almost every component of the game. Like the floor, walls , moving floors, moving obstacles etc. That way i can easily change the playfield when I want. But this approach also seems tedious. Also I couldn't figure out the structure of the XML that would make my life quite easy. So is there any better way to create or store information about the playfield than suggested above?

Note : Blender is also an option. But please provide a tutorial if you are suggesting the Blender way.

sentences:
Intelligently move aircraft using curves I am trying to code a script to move an aircraft entity from point A to point B and at some point in the middle of moving have the aircraft forward vector face Point C (to fire a missile at an enemy entity at C).

I implemented a bezier curve script that takes as input a list of waypoint and tangent handle Vector3 (Tangent handle is angle at point + weight which is represented by the length of the handle) which I plan to use to move the aircraft alone but I have not figured out a good algorithm to determine where to move to and the tangents at those points.

The control points in the img above are the same as my tangent handles.

The conditions are:

Aircraft must start at A, waypoint 0 is therefore at A
Tangent 0 angle must match Aircraft starting forward vector direction
Waypoint N (last waypoint) must be at point B (finishing location).
At some Waypoint (1 - N) the tangent must be facing the enemy position C
The last tangent must be level with the y = 0 plane (aircraft must be parallel with the ground)

Constraints

A,B,B are on the y=10 plane. This does not mean that waypoints in the middle of the movement need

The aim is to get smooth and somewhat natural looking movement, overly sharp changes of direction are undesirable.

My initial implementation was as follows:

waypointSequence.addPoint(position, tangentHandlePosition)

Vector3 middleWaypointPosition =
    new Vector3((aircraftTransform.position.x + movementLocation.x + enemyTransform.position.x) / 3f,
    (aircraftTransform.position.y + movementLocation.y + enemyTransform.position.y) / 3f,
    (aircraftTransform.position.z + movementLocation.z + enemyTransform.position.z) / 3f);
Vector3 finishTangent = middleWaypointPosition + (enemyTransform.position - middleWaypointPosition) / 2;
finishTangent.y = 10;
// Add first point - A position, A forward tangent
waypointSequence.addPoint(aircraftTransform.position, aircraftTransform.position + aircraftTransform.forward * 10);
// Second point - Centroid of A, B, C. Tangent is pointing at C
waypointSequence.addPoint(middleWaypointPosition, finishTangent);
// Last point - position is at B
waypointSequence.addPoint(movementLocation, movementLocation +
    (movementLocation - attackUnit.transform.position).normalized * 10);

It works somewhat well in most cases but there are a number of edge cases, for instance A and B being at the same position makes the craft move towards the target then suddenly turn back with a 180 degrees turn towards B. There are a number of cases where I observed strange behavior.

Does anyone have any suggestions on how to design this algorithm?

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:
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:
How to program 3D translate widget like in blender? Im struggling to achieve the translation widget in my own render engine. Funny enough I thought that widgets are easy, but boy was I wrong...

What I want to implement:

Where I am having problems:

When my object's transform is nested (child) and I want to implement a local translation widget the mouseinput coordinates might become inverted, depending on the current orientation of the object. Example: rotate parent 180° (facing back to camera) and dragging the x axis in left mouse direction results in right motion. Expected: dragging the x axis in right mouse direction results in right motion no matter how the object is rotated.

The motion becomes slow when I approach near perpendicular angles with the selected axis.

My implementation is based on: https://www.codeproject.com/Articles/35139/Interactive-Techniques-in-Three-dimensional-Scenes

I somehow think that I should use something else instead of the virtual planes at initial hitpoint of the raycast.

What's the best approach to implement a translation widget with local coordinates and mouse inputs for drag? I am using pure sharpdx for rendering and bulletsharp for the mouse picking / raytesting.

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:
Accelerometer to move player left and right Please take a look on my code and help me to find problem.

I used this tutorial: COCOS2D_ACCELEROMETER_MOVEMENT
This works only sometime….some time not move..How can I resolve this problem?
Here is my sample: DOWNLOAD
Thanks for reading this…what's wrong with my code ? Is there any other way?

Here is my code:

#define kHeroMovementAction 1
#define kPlayerSpeed 500
- (void) accelerometer:(UIAccelerometer *)accelerometer didAccelerate:(UIAcceleration *)acceleration {
    // use the running scene to grab the appropriate game layer by it's tag

    // grab the player sprite from that layer using it's tag
    CCSprite *playerSprite = mPlayer;
    float destX, destY;
    BOOL shouldMove = NO;

    float currentX = playerSprite.position.x;
    float currentY = playerSprite.position.y;

    if(acceleration.x > 0.25) {  // tilting the device upwards
        destX = currentX - (acceleration.y * kPlayerSpeed);
        destY = currentY + (acceleration.x * kPlayerSpeed);
        shouldMove = YES;
    } else if (acceleration.x < -0.25) {  // tilting the device downwards
        destX = currentX - (acceleration.y * kPlayerSpeed);
        destY = currentY + (acceleration.x * kPlayerSpeed);
        shouldMove = YES;
    } else

        if(acceleration.y < -0.25) {  // tilting the device to the right
        destX = currentX - (acceleration.y * kPlayerSpeed);
        destY = currentY + (acceleration.x * kPlayerSpeed);
        shouldMove = YES;
    } else if (acceleration.y > 0.25) {  // tilting the device to the left
        destX = currentX - (acceleration.y * kPlayerSpeed);
        destY = currentY + (acceleration.x * kPlayerSpeed);
        shouldMove = YES;
    } else {
        destX = currentX;
        destY = currentY;
    }

    if(shouldMove)
    {
        CGSize wins = [[CCDirector sharedDirector] winSize];
        // ensure we aren't moving out of bounds
        if(destX < 30 || destX > wins.width - 30 || destY < 30 || destY > wins.height - 100) {
            // do nothing
        } else {
            CCAction *action = [CCMoveTo actionWithDuration:0.5f position: CGPointMake(destX, playerSprite.position.y)];
            [playerSprite stopActionByTag:kHeroMovementAction];
            [action setTag:kHeroMovementAction];
            [playerSprite runAction:action];
        }
    } else {
        // should stop
        [playerSprite stopActionByTag:kHeroMovementAction];
    }

}

sentences:
Engine programming, is it supposed to be enjoyable? Now this might sound like a silly question and I apologize if this sort of question is not suited for stackexchange. But I am genuinely wondering this, and I feel like I get alot more proffesional awnsers on here.

I'm getting into game development and have only worked solo since my study is not primairly about games.
I'm only interested at 2D games atm, so am not really in need of any external engines for physics and rendering and such. So usually write the engines myself.

I absolutely hate writing things as quadtree's and pathfinding algorithims, most of the time I wish I could just skip those parts and move on to programming the actual gameplay elements. Things that happen in the background don't really interest me at all. But at the same time, I can't stand it I don't know whats/how everything is happening in the background.

My dislike might be explained by my weak mathematical skills. My motivation gets me through, but it can take alot of time before I grasp the technical solution behind a problem.

Now is it normal to have such a dislike towards engine programming? Or do you (people who also work solo) enjoy programming the engine?

sentences:
What would be the most efficient mechanism to implement branching choices? I am developing a Windows game engine that will let you create games styled like "Phoenix Wright: Ace Attorney". I have finished developing the data entry parts (evidence, profiles, animations, etc.), and now I am going to create the scene editor. With this editor, you can create courtroom scenes.

I am having a particular game-flow design problem with "choice branches", where the player can select an option from many, and something will happen depending on the choice. How should I design such thing? I have no problems creating a linear flow (action, action, action, etc.), but I am confused by things like cross-examination or chatting involve branching choices (action; if did something, do this; if did something else, do that; etc.).

What would be the most efficient mechanism to organize such branches for my design, in the simplest way for the user to understand? I don't want to make it too complex for the user to make a game with the engine.

sentences:
Unity3D - How to tessellate 2D sprites? I use dynamic vertex lighting on 2D sprites. On larger sprites the lighting is uglier than on smaller ones. This is because every sprite is just a quad of two triangles. Not enough vertices there for lighting on larger areas.

Is there a way to use more triangles on a sprite? Maybe even depending on how much screen space they cover?

sentences:
What is the MTV (Minimum Translation Vector) in SAT (Seperation of axis)? What is the MTV (Minimum Translation Vector) in SAT (Seperation of axis)? and how can i use it?

Im trying to create my first game, where a ball can hit a a static brick (rectangle). Now if a ball collides with a brick, then i need to figure out which side the ball collided with so i can tell the ball which direction it should bounce off to.

For example, if a ball is heading nortwest and hitting the brick on its right side, then it should bounce in a northeast direction.

however if the ball hit's the bottom side of the brick, then the ball should be heading southwest.

So can the MTV be used in this situation? can MTV tell me which side of a rectangle the ball has impacted?

Please note i have implemented SAT in my game, and the collision detection works fine, my question now is, can i use MTV to actually handle a collision response?

Any help is appreciated.

sentences:
Formatting Unity data for communication with a REST API I am pretty new to unity but I am not new to programming. I am building a Hololens application in Unity 2017.2 and it communicates with a REST api that I built. I am using Unity as a front end more or less and it manages my state. Coming from the web developement world, I have my server converting my models into JSON and I am sending that as a response. For the most part, it works well but since Unity works on an older version of C#, I am having issues working with the JSON data, mainly if the data type is not a string, int, float, or double. For example, if my model contains a date data type I am having issues converting it back into a c# model or even arrays are proving to be a pain. I don’t want to rely on unity packages too much as most I have tried don’t do what I need but I am open to any good ones if you know of any.

My question is, what is the best way to send data from my API to Unity? Should I send xml or a csv instead? Or even a more C# native approach? (If that makes sense)

sentences:
Where to hire 2D sprite artists? I'm looking for high quality original 2D sprite collections which are animated where appropriate.  (IE not simply collections I can buy, we want original work).

I've had a look online but am struggling to find out where I can hire such people!

Where do I find such people?
How much should I expect to pay?

sentences:
Planar mapping/projecting UV coordinates from normal I've got set of vertices, and would like to calculate their UV coordinates by projecting them by a given normal. Similar to what "planar mapping" does in 3ds max.

Another way of looking at it is that I want to flatten the vertex positions from a given normal direction, so that I can simply use their X & Y (or X & Z depending on your preference) coordinates as UV coordinates.

I'm thinking it's a simple matter of a mathematical Vector function, basically rotating vertex positions along the normal, but I can't figure out the math behind it. I'm using C# and XNA, so I've got Vector3, Matrix and Quaternions. Preferably as cheap as possible.

Any help?

sentences:
Get algorithm (Chance-to-Hit) from Input and Output I am currently working on a chance-to-hit formula for an rpg. It consists of the following parts:

AttackSkill: The used Attribute of the Attacker (Range: 1-10)
AttackBonus: A Modifier from Skillbonuses (Range 0.5 - 3)
DefenseSkill: The used Attribute of the Defender (Range: 1-10)
DefenseFitness: How suitable is this defense against the attack? (Range: 0.1 - 5)
DefenseBonus: A Modifier from Skillbonuses (Range 0.5 - 3)

This is the Input. I am looking for a way to map this to the following Output:

Difficulty: How hard it is for the Attacker to hit (Range 0-10 float, later round to int)

What could I do to get the algorithm out of the value pairs? If possible, the output should be biased in direction of Difficulty 6 (like a normal distribution).

sentences:
It is possible to process data on relay servers? I have a small game engine done in Java, and re-creating it on C++. While re-creating it i've decided on adding basic p2p online multiplayer. However, after reading more about networking, there are multiple models, and the Client-server host with relay model seems attractive, since it overcomes most of NAT issues of port fowarding and does not expose players public IP.
My point is - can a relay server be used to do some minimal data processing? The goal is not to use a dedicated, full featured server application, but just do minimal calculations on the data to detect some basic cheats.
For example: Preventing internal speed hacks by sending the system timestamp every 60 cycles, and then the relay would store the previous time stamp and compare the next one, if the time difference is less than 1000ms, disconnect the player.

sentences:
Character Animation Library I am looking for character animation library which can be included in my game engine.

I prefer FOSS but, paid is good if it's price is reasonable.

So, far what Ive found is Cal3d.

Can anyone tell, what are the other options?

I am also interested in Havok Animation which comes in the free bundle of Havok. Any thoughts about this one?

sentences:
Deferred rendering order? There are some effects for which I must do multi-pass rendering. I've got the basics set up (FBO rendering etc.), but I'm trying to get my head around the most suitable setup. Here's what I'm thinking...

The framebuffer objects:

FBO 1 has a color attachment and a depth attachment.
FBO 2 has a color attachment.

The render passes:

Render g-buffer: normals and depth (used by outline & DoF blur shaders); output to FBO no. 1.
Render solid geometry, bold outlines (as in toon shader), and fog; output to FBO no. 2. (can all render via a single fragment shader -- I think.)
(optional) DoF blur the scene; output to the default frame buffer OR ELSE render FBO2 directly to default frame buffer.
(optional) Mesh wireframes; composite over what's already in the default framebuffer.

Does this order seem viable? Any obvious mistakes?

sentences:
Timer in turn based game I'm writing a small turn-based game using libgdx.
How to make a timer on the player turn to make it work even when the game loses focus??

Or maybe there are some other ways to do it???

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:
Iterating through all animator layers in Unity Mecanim I'm aware of how SetAnimatorLayerWeight works, I'm looking for a way to iterate through all layers of my controller at runtime.

I've four layers and expect more, and need to update them at once, in essence, what I'm trying to do is something like this.

To clarify: The code below is boilerplate of what I'm trying to do.

    void SetCurrentWeaponLayerWeight(int index)
    {
        _animator.SetLayerWeight(index, 1);

        foreach(AnimatorLayer l in Animator.Layers)
        {
            if (l.index != index)
                _animator.SetLayerWeight(l.index, 0);
        }
    }

sentences:
Bridge made out of blocks at an angle I want the player to select 2 points (vectors). With these 2 points a floor should be created. When these points are parallel to the x-axis it's easy, just calculate the amount of blocks needed by a simple division, loop through that amount (in x and y) and keep increasing the coordinate by the size of that block.

The trouble starts when the 2 vectors aren't parallel to an axis, for example at an angle of 45 degrees. The 2 red dots would be the player selected locations. (The blocks indeed aren't square.) .

How do I handle the math behind this?

sentences:
How to design simple turn based combat system with multiple difficulties? I am developing a small, turn-based game with spaceships.
The user-controlled spaceship has two modes, let's call them offense and defense mode. The user can freely switch between modes.
There are three types of enemy-ships.
Whenever the user's ship meets one or more enemy-ships, a fight calculation should take place, which can have exactly two outcomes: either the user's ship wins (and does not carry away any damage), or the game is over.
Encounters are kinda, but not completely random so one can expect a certain enemy and change the mode accordingly.

For reference, multiple enemy encouters at once might happen, and as a rough idea, the userShip usually is expected to lose if it has to fight 2-5 enemies.
Like 2 are too much, if the active fight mode is disadvantageous, whereas the userShip can win against up to four ships, if the mode is advantageous.
For encounters with multiple enemy types, the numbers shall be somewhere in between.

My requirements for the combat system are:

completely deterministic
one mode must not be clearly superior to the other mode. Ideally, one mode is advantageous against a certain enemy type, while the other mode is advantageous against another enemy type (not sure what to do about the third enemy type though)
must be somehow scaleable, i.e. there should be three difficulty settings which shall be taken into account.
ships have three attributes: Attack, Defense, Speed (however, this isn't set in stone and could be changed at will)

My best idea so far:

assign each ship type base stats (Attack/Defense/Speed, floating point numbers):

userShip:  (10/10/10)
 enemy 1:   (5/10/15)
 enemy 2:   (15/5/10)
 enemy 3:   (10/15/5)

create a modifier-table that multiplicates the userShip baseStats with a multiplicator depending on a) userShip-mode and b) enemyShip-type.
have the combat system compare each of the three stats (if multiple enemies involved, their combined strength), and depending on the difficulty setting, the userShip wins if the difference of at least 2 of the 3 attributes is smaller than . That way, I would have the scalability.

However... I was unable to design the modifier table in a way that the modifiers actually make a noticeable difference AND the user has an incentive to switch between modes when he expects a certain enemy in the next turn.

The biggest problem is the nature of the binary combat outcome. This makes it that the floating point multiplicators neglegible most of the time.

Also, I feel like I have way too many parameters (fight mode, attack, defense, speed, difficulty-setting, modifier) for such a simple calculation, but I cannot really remove any other than the modifier, and they all should be at least a little bit relevant for the combat outcome.

Also, I'm not sure how to deal with the third ship type, as there only are two modes. If the mode does not matter at all, that's poor design I think. I could add a third mode for the userShip, however that would introduce even more parameters for the combat. Unsure about that.

Any ideas how to design a combat system under these conditions?

sentences:
Using python as a controller in Blender Game Engine I'm trying to learn how to use BGE, and one of the things I'd like to do is programatically move the cube using a python script. I added a controller but no luck. See screenshot. I'm trying to run the python script at the top of the page, all it's supposed to do is move the cube a little. It works if I click "Run Script" but I want it to happen automatically when BGE is running. What am I missing?

http://i.imgur.com/7KsoiAd.png

sentences: How do you turn off all scene lighting in the game view like you would with the scene view button? In the scene view, there's a control bar with a 'lighting' button that lets you toggle scene view lighting. This turns off all shadows and all light sources, i.e. makes it so that all objects are seen as fully bright on all sides.  How do I do the same for the game view?

sentences:
Trouble creating fog and lighting in unity I am trying to create a model in unity that looks like this picture by Escher

I can create the lattice, however, I can not create the fog and background/lighting effect. When I adjust the fog in Lighting the cubes just get more of the supposed fog color. Also I don't know how to eliminate the sky and make the lighting more like it is in the picture. Does anybody know how to great the fog and lighting effect I am looking for Thanks
I previously posted this on unity Q and A and got no answer

I can not post my other image with no fog because i do not have enough reputations. It is basically the image I posted just with more shadow and gray cubes.

sentences:
Pathfinding in non tile-based 2d map (maybe potential field) I am developing a top-down 2d zombie shooter in AS3.
I have implemented collisions against segments (line from point a to point b), polygons (array of points, convex) and round obstacles (center and radius)
Player and enemies are basically moving round obstacles, with different radii.

Now, I'm having trouble with zombie AI's pathfinding.
I have read about potential fields, and I found it fascinating, but I can't figure out how to adapt it to a non tile-based map.
I can calculate the distance from a point to the closest obstacle, and get the obstacle repulsive potential in that point.
I don't know how to get the player's attracting potential in that point though. In tile-based maps you use the A* algorithm, considering every walkable tile as a node. This is my first problem.

Once I have calculated the player's attracting potential in a point, what I get is a Number. In tile-based maps, I would test this number against the potential of the 8 adjacent tiles, and move the enemy to the tile with the lowest potential. In my non-tile based map instead I do not have a fixed set of tiles to test, so I can't understand how to get the moviment vector to apply to the enemy. This is my second problem.

If I, say, set a waypoint every x*y pixels, I could use it as the centre of a tile, but that sounds very unelegant, mainly because enemies would be forced to move along the 8 directions of adjacent nodes.

Should I forget PFs and try a different approach?

sentences:
Make character following another What's a solid way to have a character stuck to another one?

I have a moving character (say followed) and I want a second one (say follower) to follow the first without chance of getting stuck into obstacles.

I thought that I could save every delta velocity vector of the followed and having the follower consuming one each frame after it reached its target's starting position.

More to say, dynamic obstacles could be an issue.

Since this sounds to me like a common topic (despite the fact that I'm having difficulties in finding answers), is there anyone who could enlighten me on a proper way of facing the issue?

Edit:

Since I'd like to describe something more like to an edge case of a pathfinding algorithm, consider the following:

follower should always be at a fixed position related to followed
follower must not necessarily interact with the environment the way followed does

sentences:
Saving data in games? I'm soon going to make a game for the iPhone as a school project.

My idea was to make a TLOZ remake, with Tiled Maps.

However, I'm not quite sure how save the data.
In TLOZ you have a lot of sub-quests, treasures, items, and much more.
I want the user to only be able to open a treasure once.

Therefore I have to save this information somehow.
However, I'm not sure how to assign the data to that certain object, for example that treasure that Link has opened.

I thought about making id's for every object, but I'll have multiple maps, and it doesn't seem like the right solution.

Are there any standards for this?

Or does anyone have another idea?

sentences:
Correct way to export from blender to ogre format? When I export from blender to ogre using the blender2ogre add-on, I'm not getting anything besides a scene most of the time and when I get a mesh I never get a material. Is there something wrong with my export procedure or what else could I be doing wrong?

Update

I can export the basic cube from blender to ogre but when I download a model and try to export it I don't get the meshes.

Update 2

I tried again and selecting the model in Blender does the difference like the answer here says. I can export an alien and get the mesh and material:

I rename the files:

$ ls workspace/DungeonWorld2/assets/objects/creatures/alien/
Cube.001.mesh          Material.002.material  Material.005.material
Cube.001.mesh.xml      Material.003.material
Cube.001.skeleton.xml  Material.004.material
dev@dev-OptiPlex-745:~$ ls workspace/DungeonWorld2/assets/objects/creatures/alien/
alien.mesh          Material.002.material  Material.005.material
alien.mesh.xml      Material.003.material
alien.skeleton.xml  Material.004.material
dev@dev-OptiPlex-745:~$

But how do I actually load the material since the alien now turns up in the game with no material but it does render the mesh:

    Spatial model3 = assetManager
            .loadModel("objects/creatures/alien/alien.mesh.xml");
    model3.scale(0.3f, 0.3f, 0.3f);
    model3.setLocalTranslation(-40.0f, 3.5f, -20.0f);
    rootNode.attachChild(model3);

sentences:
Can I use the HD Graphics 3000's quad list primitive type via D3D? I was studying some technical documentation on the Intel HD Graphics 3000 GPU, which I'm using as a lower-end reference for my 2D game engine. I noticed the hardware supports a nice "Quad List" topology, where every 4 vertices in a vert buffer are interpreted as an independent quad. My engine draws nothing but sprite quads, so that would be a nice optimization in my case, to eliminate the need for copying / caching / processing an accompanying index buffer with 12 bytes per quad of trivial triangle edge definitions (I'm using indexed TriangleList primitives at the moment).

From what I can tell though, DirectX 9 doesn't expose quad list, and after some cursory peeking around in DX10/11 (which I don't plan to support at this point) it seems they don't expose this feature either.

Does anyone know if there's a way to use Quad Lists in DirectX? I'd be curious about OpenGL also, if anyone has experience on that side.

sentences:
How can I make billiard without using Rigidbody? Unity's physics engine isn't deterministic (ie. the results aren't always the same on all computers) so I haven't Idea that how billiard games Implemented.Is there a way to Implementing fake and deterministic
physic in unity?
I mean I want to make billiard without using Rigidbody

http://www.bezzmedia.com/swfspot/tutorials/flash8/8_Ball_Pool

I found this open source project that didn't use physic! this is what I need but unfortunately it's full c++ and I haven't enough time to convert it to c#

http://downloads.sourceforge.net/foobillard/foobillard-3.0-win32-2-bin.zip

sentences:
Graphic optimization for iPhone Basically, I am creating a large iPhone game (with an overwhelming amount of 2d graphics).

I am concerned about the game file size.

Since the iPhone game will accept Retina and Normal display, we need 2 versions of each image (one HD and on normal). Therefore, it is necessary to resize our image files (it is not a good idea to resize the images in-game, an iPhone 3GS would have memory usage problems).

So my team is thinking about using Adobe Fireworks for the image creation, since it has that nice vector-resizing behavior without losing image quality (not-blurry on resize).

And it works alright.

But then I created an image that is pretty much the same in Adobe Photoshop, and it happened to be about 3x smaller in memory.

So naturally, there's something wrong with our Fireworks' files. How can I save my .png Firework file with the smallest memory size possible?

Note: the images require transparency.

sentences:
Unity - Mesh importing as child of armature I'm following along with this tutorial by Sebastian Lague: https://www.youtube.com/watch?v=yhPRkihs-Yg&list=PLFt_AvWsXl0f4c56CbvYi038zmCmoZ4CQ&index=14
However, when I import my character from Blender into Unity, the sword and shield mesh are children of the armature instead of siblings like the shirt/pants/shoes/etc. I'm fairly certain this is because the sword and shield are parented directly to bones on the hands, I'm just not sure why they import as children of the mesh unlike in the video.

sentences:
Camera.unproject(Vector3) method is not working in libGdx I know the touch postioning in libGdx uses OpenGL, making 0,0 the bottom left corner while the camera uses the top left corner as 0,0. I did some searching and found this SO question that specifies that I need to use the Camera.unoroject(Vector3) method. This is the relevant code:

package com.mycompany.mygame;

import com.badlogic.gdx.*;
import com.badlogic.gdx.graphics.*;
import com.badlogic.gdx.graphics.g2d.*;
import com.badlogic.gdx.math.*;

public class MyGdxGame implements ApplicationListener
{
    public float x;
    public float y;
    public float w = 50;
    public float h = 50;

    Texture texture;
    SpriteBatch batch;
    OrthographicCamera cam;

    @Override
    public void create()
    {
        texture = new Texture(Gdx.files.internal("android.jpg"));
        batch = new SpriteBatch();
        cam = new OrthographicCamera();

        //x = 50;
        //y = 50;
    }

    @Override
    public void render()
    {
        Gdx.gl.glClearColor(1, 1, 1, 1);
        Gdx.gl.glClear(GL20.GL_COLOR_BUFFER_BIT);
        batch.begin();

        if(Gdx.input.isTouched()){
            Vector3 touchPos = new Vector3(Gdx.input.getX(), Gdx.input.getY(), 0);
            cam.unproject(touchPos);
            batch.draw(texture, touchPos.x, touchPos.y, w, h);
        }
        batch.end();
    }

    @Override
    public void dispose()
    {
    }

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

    @Override
    public void pause()
    {
    }

    @Override
    public void resume()
    {
    }
}

The problem is the game is not drawing correctly. It should draw the character at the touchPos.x and touchPos.y coordinates, but it is not. It is drawing in the bottom left corner. See the pictures below:

sentences:
Concerns about Google Play Games security I want to develop a Android game using LibGDX. Let's take a classic example ; some player can battle another one in turn based matches. The outcome of match defines the reward in some ingame currency. There will be premium currency with in-app purchases, and both can be used to purchase some upgrades.

I am discovering both Android and GPG at this point. GPG allows some P2P turn battles, matchmaking and cloud saves, making it looks like quite the thing I need.

However, I have concerns regarding its security. The currencies needs, for obvious reasons here, to be fully secure, non corruptable by altering saves on the device. In the same way, it is my understanding that the turn based (and real time) matches are P2P, between devices.

My question is, what GPGS does to enforce security on both (cloud) saves and P2P matches ? Will I need to use some backend server for this case ? And if yes, how can I authenticate a player logged in GPG on this backend server ?

Thanks for any clues about that.

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:
Generate cave like Terrain in 2D I want to create 2D Terrain randomly. It should look like a connected Cave (Shown below). What is the best method or Algorithm to get similar results?

The important part is the open area(green) and that it is fully surrounded by walls(brown).

4 Examples:

sentences:
Calculate initial velocity of a 3d vector-based projectile Okay, so I got a Projectile with 2 Vectors, position and velocity.
I now want to calculate the initial velocity for it in order to reach a specific point on the map.

Or actually, how high has the start z-velocity to be (because x and y are probably defined by a speed variable) in order for the projectile to hit the marked position.

The projectile is influenced by a constant gravity vector.

All calculations are done 32 times per second.

I want this, because I don't want to use a parabola function, so the projectile can still be influenced by other sources, simply adding some velocity.

I didn't really find anything referring to that topic and would be glad for every helping answer, Thanks.

sentences:
Why is this MeshRenderer null? The following line fails in my class:

MeshRenderer nRenderer = _Sphere.AddComponent<MeshRenderer>();

This is the entire class. All works except the mentioned line.

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

public class SphereMaker : MonoBehaviour
{
    private GameObject _Sphere;

    void Start()
    {
        _Sphere = GameObject.CreatePrimitive(PrimitiveType.Sphere);
        _Sphere.AddComponent<MeshFilter>();

        MeshRenderer nRenderer = _Sphere.AddComponent<MeshRenderer>();
        Material nMat = new Material(Shader.Find("Universal Render Pipeline/Lit"));//I'm using the URP

        if (nMat == null)
        {
            Debug.LogError("no mat!!\n");
        }
        nMat.color = Color.red;

        nRenderer.material = nMat;

        float fSize = 0.4f;

        _Sphere.transform.localScale = new Vector3(fSize, fSize, fSize);
        _Sphere.transform.position = new Vector3(0, 0, 0);

    }
}

Does anybody see what I'm doing wrong?

Thank you!

sentences:
Voxel terrain collision detection with AABBs I'm working on implementing collision detection on voxel terrain (Like Minecraft) with AABBS.

Right now, I have it so I can tell if a point is within a voxel or not, I do this by having a 2D byte array of active voxels. If a byte at any index is 0, the voxel is air. If its 1, its solid. Right now I'm just testing to see if the voxel at the player's position vector is solid or not.

My problem is, I now wish to implement AABBs to get more precise detection, but I have no idea how to do it without checking if all the voxels within the AABB are solid. That might now be a problem for games like Minecraft, where there would only have to be about 1 extra voxel check, but the voxels in my game are much smaller (The player's dimensions are about 4x10x4), so I would have to check a lot of voxels.

Ive seen one or two other people having a issue similar, but I didn't find the answers they got clear enough, and so I come here asking for your help.

Thanks.

sentences:
How to Subscribe to Events from Unity's VRInput Script I am new to Unity and trying to modify the Unity tutorial Interactive 360 Sample. I want to be able to call a function when a user swipes using an Oculus Go Controller. I noticed that the VRInput script is included in the project, which seems to be able to detect swipe gestures.  But where do I attach that script, and how do I subscribe to the OnSwipe event.

I am currently trying by making an empty game object, and attaching the InputVR script as well as my own script called "GestureHandler" (I'm not sure whether InputVR is already attached to something else in the sample project, or whether I need to attach it at all). In my GestureHandler script I currently have the following:

using System.Collections;
using System.Collections.Generic;
using Interactive360.Utils;
using UnityEngine;

public class GestureHandler : MonoBehaviour {

    void onEnable(){
        VRInput.OnSwipe += HandleSwipe;
    }

    void onDisable(){
        VRInput.OnSwipe -= HandleSwipe;
    }

    void HandleSwipe(){
        Debug.Log("swipe");
    }
}

and currently have the following errors:

An object reference is required for the non-static field, method, or property 'VRInput.OnSwipe' [Assembly-CSharp]

No overload for 'HandleSwipe' matches delegate 'Action<VRInput.SwipeDirection>' [Assembly-CSharp]

An object reference is required for the non-static field, method, or property 'VRInput.OnSwipe' [Assembly-CSharp]

No overload for 'HandleSwipe' matches delegate 'Action<VRInput.SwipeDirection>' [Assembly-CSharp]

sentences:
Unity RTS Single Selection Problem I am trying to build an RTS game and I have managed to form a way to select a unit using Raycast and the tag system. I made it so that if the object the ray falls onto is of tag "TankUnit" Make so and so variable true and allow it to move to another place. However, Units of the same tag even when not selected also move. How do I fix this problem? The script is bound to each unit.

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

public class UnitController: MonoBehaviour { bool clicked = false; //public float speed = 10f; //public float rotationSpeed = 10f;

 public LayerMask groundLayer;
 public NavMeshAgent playerAgent;
 // Update is called once per frame
 void Update()
 {
     if (Input.GetMouseButton(0))
     {
         Debug.Log("Clicked");
         FindClickPos();
     }
     if (Input.GetMouseButton(1) && clicked == true)
     {
         Debug.Log("I clicked right mouse");
         Ray ray = Camera.main.ScreenPointToRay(Input.mousePosition);
         RaycastHit hit;
         if (Physics.Raycast(ray, out hit))
         {
             MoveTo(hit);
         }
     }
 }
 private void FindClickPos()
 {
     RaycastHit hitInfo = new RaycastHit();
     bool hit = Physics.Raycast(Camera.main.ScreenPointToRay(Input.mousePosition), out hitInfo);
     if (hit == true)
     {
         Debug.Log("I hit " + hitInfo.collider.name);
         if (hitInfo.collider.tag == "TankUnit")
         {
             Debug.Log("I hit" + hitInfo.collider.tag + "!");
             clicked = true;
         }
         else
         {
             Debug.Log("I didnt hit a unit :/");
             clicked = false;
         }
     }
     else
     {
         Debug.Log("I didnt hit anything...");
         clicked = false;
     }
 }
 void MoveTo(RaycastHit hit)
 {
     Debug.Log("Position: " + hit.point);
     playerAgent.SetDestination(hit.point);
 }

}

sentences:
Creating stable tentacle structures I am using verlet integration to simulate some tentacles. So far it works great and I am satisfied with how it looks in general. Here is how a tentacle is built:

The very stiff sticks are colored red, in addition I added angular constraints of 180° in order to keep everything together.

But still, sometimes this happens:

When forces are too big at the peak, it flips around and gets stuck in a very ugly state.

Of course I could increase the number of iterations for satisfying the constraints, but then the tentacles get too stiff and the performance suffers.

What can I do about this? Some ideas:

add more points at the peak
more constraints overall
limit possible forces
maybe rethink my tentacle design completely?
detect flip over and undo it

sentences:
Question about BoundingSpheres and Ray intersections I'm working on a XNA project (not really a game) and I'm having some trouble with picking algorithm. I have a few types of 3D models that I draw to the screen, and one of them is a switch. So I'm trying to make a picking algorithm that would enable the user to click on the switch and that would trigger some other function. The problem is that the BoundingSphere.Intersect() method always returns null as result. This is the code I'm using:

In the declaration section:
`

//Basic matrices
private Matrix world = Matrix.CreateTranslation(new Vector3(0, 0, 0));
private Matrix view = Matrix.CreateLookAt(new Vector3(10, 10, 10), new Vector3(0, 0, 0), Vector3.UnitY);
private Matrix projection = Matrix.CreatePerspectiveFieldOfView(MathHelper.ToRadians(45), 800f / 600f, 0.01f, 100f);

//Collision detection variables
Viewport mainViewport;
List<BoundingSphere> spheres = new List<BoundingSphere>();
Ray ControlRay;
Vector3 nearPoint, farPoint, nearPlane, farPlane, direction;

`

And then in the Update method:
`

nearPlane = new Vector3((float)Mouse.GetState().X, (float)Mouse.GetState().Y, 0.0f);
farPlane = new Vector3((float)Mouse.GetState().X, (float)Mouse.GetState().Y, 10.0f);

nearPoint = GraphicsDevice.Viewport.Unproject(nearPlane, projection, view, world);
farPoint = GraphicsDevice.Viewport.Unproject(farPlane, projection, view, world);

direction = farPoint - nearPoint;
            direction.Normalize();
            ControlRay = new Ray(nearPoint, direction);
            if (spheres.Count != 0)
            {
                for (int i = 0; i < spheres.Count; i++)
                {
                    if (spheres[i].Intersects(ControlRay) != null)
                    {
                        Window.Title = spheres[i].Center.ToString();
                    }
                    else
                    {
                        Window.Title = "Empty";
                    }
                }

`

The "spheres" list gets filled when the 3D object data gets loaded (I read it from a .txt file). For every object marked as switch (I use simple numbers to determine which object is to be drawn), a BoundingSphere is created (center is on the coordinates of the 3D object, and the diameter is always the same), and added to the list. The objects are drawn normally (and spheres.Count is not 0), I can see them on the screen, but the Window title always says "Empty" (of course this is just for testing purposes, I will add the real function when I get positive results) meaning that there is no intersection between the ControlRay and any of the bounding spheres. I think that my basic matrices (world, view and projection) are making some problems, but I cant figure out what. Please help.

sentences:
Get fragment from mouse position I have a painting app for texture artists that I am working on. I am able to paint to a flat canvas that updates the texture of a 3d object in an object viewer. Now I want to be able to paint directly to the 3d model.

One way I can think of is to get the uv coordinate from the mouse position, and use that as the position to paint onto my 2d canvas, which updates the 3d models texture.

Oh and only one object at a time is active, so that should make things a little simpler.

Is this the right approach? If it is then how should I start. Or is there a simpler/better way of painting directly to a 3d model? How does zbrush do it?

sentences:
Modularization in a project I'm writing a C# game in Mono, and I want the game to be as modular as possible.
I've started by writing the whole Item (inventory) System of the game in a seperate .dll library
But I've hit a problem. I want Items to have effects, so I've written a base Interface for this:

interface IBehavior
{
    bool ApplyBehavior(Player destinationPlayer);
}

I'm following guidelines from the answer on this post regarding the (Unit, Effect, Behavior, Ability [Lets call it UEBA]) structure. Problem is that Player is a class from like the main module in the game so I assume this breaks modularity in the code.
What would be the best solution to fix this conflict?
I'm considering writing another, separate module, of UBEA, that will use Player and then the Item System module will use that module instead of the main module, and then the UBEA module will break modularity.
Should I also move Player to another module?
Am I even able to create full modularity if this is the model of things I want to create?

Thanks for the answers!

sentences:
When to use a blend tree vs state machine for animation Im an experienced game dev hobbiest making my first game with 3d animated characters (in Unity) and am struggling to figure out when to use blend trees vs animation state machines. I understand both conceptually but have seen both blend trees and animation state machines used for character animation in a bunch of tutorials both from Unity and from other sources. I am not sure when / why one is better than the other am hoping someone can point me in the right direction.

My game is a 3rd person action rpg a'la WoW or KOTOR or Mass Effect (different systems I know but the perspectives and combat styles are kinda close at a high level). I have tons and tons of animations for attacks, blocks, feigns, deaths, walking, running, jumping, shooting etc but I am unclear on how to sequence them together naturally.

I have seen blend trees used for locomotion which makes sense to me when trying to keep character motion fluid, but I dont understand how to go from that blend tree to an attack state and nothing I have seen so far has gone past locomotion (no attacks etc). Do I need to make blend trees from my motion states to attack / death / dodge states? Do I have more control using just state machines? Im a little cautious of state machines because of the transition bloat that is so common with them and because I suspect there is greater potential for janky animation sequencing without blending.

I am planning to use the Unity character controller and write my own logic scripts to drive it. For the AI I will be using the built in nav mesh agents. Are character controller animations handled differently than the AI ones?

Any insights would be more than welcome!

Thanks

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:
Positioning entities in adjacent maps Say I have a 2D tile based game engine (I don't, but I will soon). I was wondering how I would manage drawing adjacent maps. That is, imagine we have a map that is 50 by 50 tiles wide. Then next to that, we have another map which of the same size - but they are loaded via separate files. So they are visibly next to each other.

Let's call the first map (the one we are on) A, and the second map B. How would I:

Draw the two maps next to each other at the combining point (provided that I have already saved data about what maps are next to each other, and at what point), so they join seamlessly, without the need for a loading screen / "teleport".
Manage entity positions. Positions, currently, are managed relatively. That is, each map has it's own (0, 0) tile. How would I manage this when drawing an entity? I was thinking about storing a pointer to the map the entity, and if it happens to change map, the pointer is updated, and we - somehow - find the tile the entity would move on to.

I should mention that only the player will ever need the use for this movement.

Any ideas? Sorry if I wasn't very clear.

sentences:
how to script a match 3 game without waiting for matches to finish I have developed a full match 3 game without the ability of making another move until all cascading is finished.

I was stuck trying to figure out how to do it with the ability of making moves even if the previous moves have not finished yet. I can't figure out the programing logic behind it, I tried different approaches with no luck so far, the results came up messy.

Can any one help.

Thanks in advance.

sentences:
Make object follow mouse angle? what I'm trying to do is make the paddle follow the mouse position(red dot).
I know how to rotate the paddle relatively to the center of the screen, but I'm not sure how to determinate the coordinates.

thanks.

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:
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:
How can I rotate the camera for a player walking around the surface of a sphere? I'm making a 3D game where the player can walk across the surface of a planet.

I am having a problem correctly rotating the camera's frame of reference, so that the camera is oriented correctly anywhere on the planet.

My strategy so far has been to create a quaternion that represents the rotation from an "up" vector (i.e. north pole) to the current position vector of the camera:

var up = new THREE.Vector3(0, 1, 0);
camera.quaternion.setFromUnitVectors(up, camera.position.clone().normalize());

To get the final rotation of the camera, I apply the rotation of where the player is looking:

camera.quaternion.multiply(sensor.getState().orientation);

This means that wherever the player is, if they look down they will look towards the center of the planet.

I then apply that rotation to the up vector to get the direction the player is looking:

var direction = up.clone().applyQuaternion(camera.quaternion);

Assuming the player is looking directly forward, if the player travels in that direction, I would expect them to walk around the planet in a straight line.

This works correctly near the north pole, however as I approach the south pole, the camera seems to rotate laterally (from the perspective of the player), finally as I reach the south pole the camera rapidly rotates 360 degrees around the pole.

What is causing this and how can I avoid it?

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 start the game at the same time across two phones? I am trying to synchronize two devices so that they can start the game at the same time.

The mechanism that I've thought about is that I would use the phones' time and set the intervals at, for example, ten seconds each. Then, when the start button is clicked, it will start the game on the beginning of the next interval. So, as long as the start buttons on both devices are clicked in a short time frame of each other, the game should start at the same time.

For the game, near perfect synchronization is important.

Will this work? I am assuming that every phone receives a timestamp from a single source, so that internal clocks are at the same time.

If that doesn't work, what is an alternative/better solution to offline multi-device synchronization?

sentences:
Where can I find info on grid based algorithms for stateless AI? There seems to be an overwhelming amount of info out there on AI of all kinds, and it's kind hard to digest at once.

For my testing purposes, I'm creating a "typical stateless AI", as described in this article, and now I need to implement the following functions for a 2D square based game board:

-(void)runAway;
-(void)attackPlayer;
-(void)moveTowardsPlayer;
-(void)tacticalMoveAwayFromPlayer;
-(void)waitOrStationaryAction;

For example, I can run my own run away function like this:

-(void)runAway
{
    DLog(@"runAway");
    [self debugMessage];

    int bestTileIndex = 0;
    int largestDistance = 0;
    int distance = 0;
    if(validMoves.count>0)
    {

        for(NSNumber* tileNumber in validMoves)
        {
            distance = [self distanceToTargetFromTile:tileNumber.intValue];
            if(distance >largestDistance)
            {
                largestDistance = distance;
                bestTileIndex = tileNumber.intValue;
            }
        }
    }
    //move to best tile

}

but this method only checks the distance from 1 target, which may not be the best if there are multiple enemies on the game board.

Where can I find good/efficient implementations of algorithms for searching a 2D grid for these functions? For example finding a point that is furthest away from multiple opponents and is accessible within a certain number of moves.

Other functions that come to mind is picking the best/weakest target, moving towards a specific target while accounting for variable terrain cost, etc

I'm certain someone has already done this before.

sentences:
How should I account for the GC when building games with Unity? *As far as I know, Unity3D for iOS is based on the Mono runtime and Mono has only generational mark & sweep GC.

This GC system can't avoid GC time which stops game system. Instance pooling can reduce this but not completely, because we can't control instantiation happens in the CLR's base class library. Those hidden small and frequent instances will raise un-deterministic GC time eventually. Forcing complete GC periodically will degrade performance greatly (can Mono force complete GC, actually?)

So, how can I avoid this GC time when using Unity3D without huge performance degrade?

sentences:
2d Collision detection libgdx The Logic

The player which is a cube (32 by 32 pixels) checks if their is a cell next to it that has the name Wall. (This is done using a tileset).

To do this collision check I made four checks in this order:

Is their a wall under the player.
Is their a wall to the left of the player.
Is their a wall to the right of the player.
Is their a wall above the player.

If the player for example touches the wall to the left of him The x coordinates of the player are set to the tile right of the wall(cell) that was collided with.

The Problem

If for example I move the player left, the loop will first check for a collision under the player however this makes the player move up if their is a wall to the left of the player which he is touching. (Note: it doesn't always do this only if the player moved enough pixels to the left). The player should have just stopped moving to the left. Moving up was not desired.

Experiments

I tried adding the left and right check for collision first. This way the bottom check should not see the cell. This made the player teleport to the left and right of the cell the player was currently on because gravity has time now to drag the player down enough pixels. (The player is always affected by gravity and I rather not change this for it wouldn't make sense for an entity like the player to not be affected by it).

Making the movement speed of the player smaller. This did have an affect which was more desired but the players movement speed should not be effected at all as a fix.

The Code

Collision detection code

    // Floor collision
    if (map.isWall(xCoordinates, yCoordinates - 1) || map.isWall(xCoordinates + 31, yCoordinates - 1))
        yCoordinates = ((int)(yCoordinates / 32) * 32) + 32;

    // Left collision
    if (map.isWall(xCoordinates - 1, yCoordinates) || map.isWall(xCoordinates - 1, yCoordinates + 32)) {
        xCoordinates = ((int)((xCoordinates - 1) / 32) * 32) + 32;
        canMoveLeft = false;
    } else
        canMoveLeft = true;

    // Right collision
    if (map.isWall(xCoordinates + 32, yCoordinates) || map.isWall(xCoordinates + 32, yCoordinates + 32)) {
        xCoordinates = ((int)(xCoordinates / 32) * 32);
        canMoveRight = false;
    } else
        canMoveRight = true;

    // Roof collision
    if (map.isWall(xCoordinates, yCoordinates + 32) || map.isWall(xCoordinates + 31, yCoordinates + 32)) {
        canGoUp = false;
    }

The isWall function

public Cell getCellByPixel(float cellPositionX, float cellPositionY) {

    if (cellPositionX >= 0 && cellPositionY >= 0)
        if (tileid.getCell((int)cellPositionX / 32, (int)cellPositionY / 32) != null)
            return tileid.getCell((int)cellPositionX / 32, (int)cellPositionY / 32 );

    return null;
}

private TiledMapTile getTileByPixel(float cellPositionX, float cellPositionY) {
    if (getCellByPixel(cellPositionX, cellPositionY) != null)
        if (getCellByPixel(cellPositionX, cellPositionY).getTile() != null)
            return getCellByPixel(cellPositionX, cellPositionY).getTile();

    return null;
}

// Check if the cell has a tile with the property of Wall. We can see this in the tsx file.
public boolean isWall(float cellPositionX, float cellPositionY) {
    if (getTileByPixel(cellPositionX, cellPositionY) != null)
        if (getTileByPixel(cellPositionX, cellPositionY).getProperties().get("Wall") != null)
            return true;

    return false;
}

Player movement

private void Movement() {
    if (canMoveLeft)
        if (Gdx.input.isKeyPressed(Keys.A) || Gdx.input.isKeyPressed(Keys.LEFT))
            xCoordinates -= (playerMovementSpeed * Gdx.graphics.getDeltaTime());

    if (canMoveRight)
        if (Gdx.input.isKeyPressed(Keys.D) || Gdx.input.isKeyPressed(Keys.RIGHT))
            xCoordinates += (playerMovementSpeed * Gdx.graphics.getDeltaTime());
}

sentences: Why value 1 in OrthographicCamera viewPort width? So, I read that camera = new OrthographicCamera(1, h/w); creates a camera  with an appropriate width and height for the field view.. However, I can't understand that value 1 for the viewport width, does a value 1 means full width?

sentences:
admob ads problem in uity In unity 2019.1.3f I want to implement google admob ads in that game but after importing GoogleMobileAds-v3.18.0.unitypackage in to my project I got a porblem.

when I hit play button

this window poped up.

Please help me regarding the problem

Thank you

sentences:
What are my options for building a centralized server architecture for a Unity game? I have made in the past multiple offline game, and would like to make my first online game. I have very basic knowledge of server structure.

The game is a multiplayer RTS game, with ONE server (If possible in c#), where player can build base, attack other player and move around a world. it is in real time, but slow paced, so not many actions, and every time a user make movement it take let's say an hour to move. The game is planned for Android/iOS and (maybe) but not at all for the moment, web.

The game itself is easy, but the server I don't know where to start and I have been struggling in the last 3 days to find a informations and answer to my question. Most of the example I found are P2P/client-hosted server, this do not apply to my case, I want a single server that runs outside of Unity and that I can run on a computer as stand-alone. My question problems are.

1) for a mobile game, I have seen in some post that UDP TCP/Socket are not available in 3g? is this true ? If so, what should I Use ? I was thinking of websocket since MAYBE i make a web version, but I don't know if it's a good idea, and apparently it is not built in in Unity.

2) Related to my 2) is there any c# library that work in Unity and would fit my game needs? a user would probably load a map, and interact around 20 times with the server during the gameplay. I believe a simple server that get and send message only is largely enough, but I don't know what to use. Start from scratch? then what should I use, TCP ? Socket? WebSocket ?

3) Should I use photon ? I've seen is free to test until 20CCU, and since for probably the next 6month I will be alone on it it's OK, then at release let's say I have 100 player, is not that expensive. Is it a viable solution? I found it a bit overkill for my needs, but it looks documented and easy to start. Will I still learn stuff if I "cheat" like this?

Thank you for your time

sentences:
Pix for visual studio express 2012 (Desktop) (Originally asked on stackoverflow)

Using visual c++ express 2010 for direct3d you have to download the directX sdk and there is a tool called pix for debugging shaders, looking at 3d resources etc.

With visual studio 2012 express the directx sdk is included in the windows sdk that comes with it but this does not seem to include the winpix.exe tool. Is this very useful tool still available? I guess I can still use the one from the previous sdk but it seems wrong to install the entire sdk just for that tool.

Is there a version for VS2012 express that I'm missing?

sentences:
How do I add a PIXI container into a Phaser Game? How do I add a PIXI container into a Phaser Game?

I have a game made ONLY with PIXI. but now i would like to port it to a Phaser.

All my game content happens inside a pixi container "screenContainer".  I tried to add a pixi container like this.

var created = function() {
       screenContainer = new PIXI.DisplayObjectContainer();
       var sprite = m.game.add.existing(screenContainer);
}

var.game = new Phaser.Game(gameWidth, gameHeight, Phaser.AUTO, "divId", { create: created });

but it stops here

"phaser.js" line 33067
/**
* The core update - as called by World.
* @method Phaser.Group#update
* @protected
*/
Phaser.Group.prototype.update = function () {
var i = this.children.length;

while (i--)
{
    this.children[i].update(); // UPDATE IS UNDEFINED
}

};

because Pixi.Container, does not have "update" method.

Is there any other way to add a pixi container inside a phaser game?

sentences:
How to implement deceleration and stopping over a certain distance So I have a a character, say a spaceship. It needs to move distance R, and in direction T (Theta). So say if The object is at (0,0), and it needs to get to (4,3), it has R = 5 and T = about 36 degrees.

Essentially I know where the endpoint is, and the distance away. I want my spaceship to start decelerating when R becomes 8, and the object come to a halt when it reaches the location.

How can I do this. (Kinematics in answers is welcome)

sentences:
ASSIMP skeletal animation with some FBX files has issues - weird node added Hi I'm trying to work load fbx files to my OpenGL Renderer using ASSIMP.

However, weird nodes that are not in the original fbx file are added whenever I load the file with the ASSIMP importer.

For example, this is part of the node hierarchy printed while loading the nodes in a DFS matter.

mixamorig:LeftForeArm_$AssimpFbx$_Translation
ㄴmixamorig:LeftForeArm_$AssimpFbx$_PreRotation
 ㄴmixamorig:LeftForeArm_$AssimpFbx$_Rotation
  ㄴmixamorig:LeftForeArm_$AssimpFbx$_Scaling
   ㄴmixamorig:LeftForeArm

However, according to the original file, there should only be mixamorig:LeftForeArm.

This fbx file might be weird since usually in the case of other fbx files, I can get the node's translation, rotation, scaling keyframes directly from aiNodeAnim using the node's name. I never saw a case where the keyframe itself become a node.

Is there a way to resolve this issue?

sentences:
What is the speed difference between cross platform HTML5 games and native mobile games? Microsoft is advertising and promoting cross platform HTML5 game development. I am thinking of creating a simple 2D side scroller game and I am trying to decide what engine should I use for creating it. I am trying to understand if there is a big difference between developping once in Unity and exporting to different platforms or simply develop it once in HTML5 in Visual Studio and publish it everywhere.
What are the drawbacks and benefits for each? Is there any speed/lag difference?
any tips are useful

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:
ARMv7 vs FAT in Unity Android Build Settings (release multiple valid APKs) If I select ARMv7 instead of FAT (ARMv7+x86) in the Android Build Settings of Unity5-Free, the APK binary drops to half size.

FAT => ~20MB
ARM => ~10MB

(Tested with an empty scene, no assets, nothing, just the core libraries).

I've seen the "official stats" of the CPU usage are here:

http://hwstats.unity3d.com/mobile/cpu.html

So not a lot of business to loose as for the date of publishing this question. But x86 seems to be an increasing trend.

Questions:

Is there any way to publish a binary to the ARM users and another version to the x86 users but with the same product-id so if they change the mobile phone, the software gets properly downloaded (but still each one gets a small footprint)?
Does this CPU correlate with WinPhone? Or is an othogonal measure? In other words: Are all Androids ARM? Or there are ARM and x86 Androids?

Thanks!

sentences:
C# Minesweeper - When cells with no mines nearby gets clicked I'm currently making a Minesweeper in C#. I've already done the basics (generating minefield, rules and ui) but I don't know how I should implement when the user clicks a cell and the cell has no mines nearby and clicks nearby cells with also no mines nearby, like this:

And after click

This is my current code on this:

if (MineField(x,y) == false) // If the clicked cell isn't a mine
{
    if (GetNeighbours(x,y) == 0) // GetNeighbours returns the amount of mines in the closest 8 cells
    {
        // To be honest, no idea...
    }
}

sentences:
Unity Light Baking for Best Balance between Performance and Visuals I'm trying to optimize my Unity game.

I have static objects, dynamic objects and (only) static lights. I wish to fully pre-compute lighting and shadows for the static objects while still maintaining realtime lighting and shadows for dynamic objects, and making them work together seamlessly.

From the documentation:

Realtime: "Unity calculates and updates the lighting of Realtime Lights every frame during run time. No Realtime Lights are precomputed." So, If I set it to realtime, I'm not really optimizing anything, am I?
Mixed: "Unity can calculate some properties of Mixed Lights during run time, but only within strong limitations. Some Mixed Lights are precomputed." It's unclear what "some properties" are and what would the consequences be.
Baked: "Unity pre-calculates the illumination from Baked Lights before run time, and does not include them in any run-time lighting calculations. All Baked Lights are precomputed." This will work for static objects. However, dynamic objects will look as if there are no lights in the scene.

From what I see, Mixed would be what I need, but I would still have to adjust its sub-modes in the Lighting window which is non-trivial for me:

Subtractive: Its description suggests it would solve all my problems and still be a nice optimization. However, static objects don't seem to receive dynamic objects' shadows or the other way around either.
Baked Indirect, or Shadowmask: Does not seem to pre-compute direct lighting for static objects, throwing away performance gains.

The final question is: what method will lead me to the best performance in Unity with these requirements:

There are static and dynamic objects that both need to be lit by direct lighting
Both static and dynamic objects should be able to cast and receive shadows from each other
All lights are static
Indirect lighting is not important in this case

sentences:
Finding if 2 polygons intersect using clipper library After realising my code was pretty inefficient at checking for polygon overlaps, I've turned to a mentioned library Clipper but finding it difficult to know hot to use it for this operation.

I am using unity Vector2[] for my shape descriptions:

//Square
Vector2[] square = new Vector2[] {
    new Vector2(0,0),
    new Vector2(1,0),
    new Vector2(1,1),
    new Vector2(0,1)
};

I want to be able to do the above boolean comparison of 2 shapes. If anyone knows Clipper well, what methods can I use to do this check?

I've recently tried the following but the result is always true even when the test shapes are completely separate from each other:

public bool CheckForOverLaps(Vector2[] shape1, Vector2[] shape2) {

    List<IntPoint> shape1IntPoints = Vector2ArrayToListIntPoint (shape1);
    List<IntPoint> shape2IntPoints = Vector2ArrayToListIntPoint (shape2);

    List<List<IntPoint>> solution = new List<List<IntPoint>> ();

    c.AddPath (shape1IntPoints, PolyType.ptSubject, true);
    c.AddPath (shape2IntPoints, PolyType.ptClip, true);
    c.Execute (ClipType.ctIntersection, solution, PolyFillType.pftNonZero, PolyFillType.pftNonZero);
    return solution.Count != 0;

}

private List<IntPoint> Vector2ArrayToListIntPoint (Vector2[] shape) {

    List<IntPoint> list = new List<IntPoint> ();

    foreach (Vector2 v in shape) {

        list.Add (new IntPoint (v.x, v.y));

    }

    return list;

}

And the tests:

    //Square
    Vector2[] square = new Vector2[] {
        new Vector2(0,0),
        new Vector2(2,0),
        new Vector2(2,2),
        new Vector2(0,2)
    };

    //Square
    Vector2[] square2 = new Vector2[] {
        new Vector2 (1, 1),
        new Vector2 (3, 1),
        new Vector2 (3, 3),
        new Vector2 (1, 3)
    };

    //Square
    Vector2[] square3 = new Vector2[] {
        new Vector2 (2, 0),
        new Vector2 (4, 0),
        new Vector2 (4, 2),
        new Vector2 (2, 2)
    };

    //Square
    Vector2[] square4 = new Vector2[] {
        new Vector2 (4, 0),
        new Vector2 (6, 0),
        new Vector2 (6, 2),
        new Vector2 (4, 2)
    };

    Assert.IsTrue(tc.CheckForOverLaps(square,square2));
    Assert.IsFalse(tc.CheckForOverLaps(square,square3));
    Assert.IsFalse(tc.CheckForOverLaps(square,square4));

Many thanks.

sentences:
How can I make my LibGDX game persist on android even if it's not the active activity I want my android game using LibGDX to continue keeping track of events in the game, even while it's not the active window.

For example, I have a stat that reduces over time even, if the game is not the active activity. When the stat gets to a certain percentage, I want to push a notification to the android platform.

I found some information to push android notifications. However, I could not find one on how to make a stat persist in the game when a different app or activity is on the main screen.

sentences: How can I minimize the chances of my game getting pirated? I am planning to make a small game in the near future. How can I minimize the chances of it being pirated?

sentences:
Repelling a rigidbody in the direction an object is rotating Working in Unity, I have a game object which I rotate each frame, like so:

void Update()
{
    transform.Rotate(new Vector3(0, 1, 0) * speed * Time.deltaTime);
}

However, I'm running into problems when it comes to applying a force to rigidbodies that collide with this game objects sphere collider. The effect I'm hoping to achieve is that objects which touch the collider are thrown in roughly the same direction as the object is rotating. To do this, I've tried the following:

Vector3 force = ((transform.localRotation * Vector3.forward) * 2000) * Time.deltaTime;
collision.gameObject.rigidbody.AddForce(force, ForceMode.Impulse);

Unfortunately this doesn't always match the rotation of the object. To debug the issue, I wrote a simple OnDrawGizmos script, which (strangely) appears to draw the line correctly oriented to the rotation.

void OnDrawGizmos()
{
    Vector3 pos = transform.position + ((transform.localRotation * Vector3.forward) * 2);
    Debug.DrawLine(transform.position, pos, Color.red);
}

You can see the result of the OnDrawGizmos function below:

What am I doing wrong?

sentences:
Game (Physics) work in Unity Editor/Remote but won't on Android? I have a script attached to a car game object that allows the player to tap the screen and then accelerate, the game object has a RB2D and collider set to it , it works fine in Unity Remote , but when I download the APK , as soon as I tap the screen , collisions go completely bezerk and the car just starts ignoring collisions , what's going on? As I need this to work to complete my game , as the player can move side to side with the accelerometer but I also want them to move forward when they touch the screen. Also , my game is 2D. Plus , since then , when the car ( my object) collides with anything else in the scene , it ignores it ( the obstacles just have Box Colliders on them). I had to freeze rotation so it could stop spinning out when it hit soemthing , now it just won't recognize collision at all. What's going on?
The code I think is causing the error starts at line 32. I have obstacles the player has to dodge and they all have box colliders and an appropiate script attached to them as well ( so when they collide with my player , it destroys it)

I've figured it out , Collision works when I first start the game , but when the player dies and I press "Replay" , it goes crazy. Here's the script that controls the enemy cars spawning , what the hell do I do to fix this?

 Code (CSharp):
using System.Collections;
using System.Collections.Generic;
using UnityEngine;
public class EnemyCar : MonoBehaviour {
public float speed ;
public float acceleration = 0.5f;
// Use this for initialization
void Start () {
}
// Update is called once per frame
void Update () {
    speed += Time.deltaTime * acceleration;
    transform.Translate(new Vector3(0, 1, 0) * speed * Time.deltaTime);

}
void OnCollisionEnter2D(Collision2D col)
{
    if (col.gameObject.tag == "Coin")
    {
        Destroy(col.gameObject);
    }
}
}

I've done everything in the book trying to solve this , re-install unity , add different colliders etc. What's weirder is that it is FLAWLESS in Unity Remote and the Editor , these issues only arise when I test out the apk.

Here's how my game usually looks when the collisions work.

Now when it collides with a car ( on android) , it just ignores it and is slightly pushed back.

Help me!

Here is my script attached to enemy cars ( the cars that should destroy the player on Collision)

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

public class EnemyCar : MonoBehaviour {
    public float speed ;
    public float acceleration = 0.5f;
 // Use this for initialization
 void Start () {

    }

    // Update is called once per frame
    void Update () {
        speed += Time.deltaTime * acceleration;

        transform.Translate(new Vector3(0, 1, 0) * speed * Time.deltaTime);

 }
    void OnCollisionEnter2D(Collision2D col)
    {
        if (col.gameObject.tag == "Coin")
        {
            Destroy(col.gameObject);
        }
    }
}

Also here is the inspector view of my Player Car

Here is the inspector view of an enemy car ( they all have the same things)

sentences:
What platform is best for Android and iPhone development? I've been developing non-mobile apps for linux; mainly stuff like interpreters, compilers, database engines and business apps.

I've been told that if I wanted to learn how to develop iPhone/iPad applications, I should buy a Mac since Apple has all it's development tools for iPhone/iPad on Mac.

Now, what about Android phones / tablets?  Are the development tools better on Mac or PC?

I need to buy a new laptop, and I would like to factor in mobile development in my choice of PC or Mac.

sentences:
How to Use Text in Unity3d How Can i Create Text in Unity3D?
I Use "3D Text" But Its Always on Top Of Everything!
Can You Suggest Anything?
I creating a 2D Game So its not Necessarily a 3D Text..

Edit: Because I Building a 2D Game My Scene is Full of Planes in Front of Camera And I want My Text to be Over One of the Planes and when plane is moving My Text appears behind it.
But When I Use "3D Text" Its Always In Front of Everything.

Sorry for My Bad English...

sentences:
Camera type for puzzle game like tetris I can't find what is the name of the camera type.

Sided camera view seems logical but not correct thought

sentences:
ECS and life management of entities I am done with my game's framework and I am trying to implement a
life-management system. My framework so far has:

Systems that hold pointers to the Entities they are interested in.
An Engine class that owns the different systems.
An EntityManager that owns the Entities.

Now every time you add/remove a Component to/from an Entity, the Entity notifies the engine class to run a(n) (un)registration routine that passes the Entity to the Systems which in turn decide whether they want to (un)register the Entity or not.

Say that I have a DestroyerSystem that remembers all Entities with a HealthComponent and is responsible for deleting the ones with no life:

void DestroyerSystem::update(float dt = 0)
{
        for (auto& entity : registered_entities)
        {
                if (entity.getComponent<HealthComponent>().hp == 0)
                {
                        EntityManager.destroy(entity);
                }
        }

}

The problem is that the Systems are supposed to keep valid pointers to the Entities and I am not sure how I can achieve that cleanly.

The only solution that I have so far is to make the Systems have an unregister() function that takes the pointer to the deleted element and erases it from the registered_entities container. The Engine class would also have an unregister() function that would call the unregister() functions of the Systems. This works good for the other systems but creates problems when applied to the DestroyerSystem because it breaks iteration. To tackle this I copy the container and iterate on that one instead:

void DestroyerSystem::update(float dt = 0)
{
        auto entities = registered_entities;
        for (auto& entity : entities)
        {
                if (entity.getComponent<HealthComponent>().hp == 0)
                {
                        entityManager.destroy(entity);
                        engine.unregister(entity);
                }
        }

}

Does anyone have any better proposals for this?

sentences:
JavaScript character direction delay I am developing a top down game and I'm having trouble with a delay in switching from one character walk direction to another, particularly if the previous direction key is still being pressed by the user.

Take the following user interaction:

User presses up arrow;
User presses right arrow (up arrow is still pressed);
User releases up arrow (right arrow is still pressed).

The problem I am experiencing is that there is a delay in the character switching from the "walk up" movement to the "walk right" movement.

requestId: 0,
settimeoutID: 0,
counter: 0,

move: function(keyCode) {
  var _this = this;
  // Frame per seconds
  var fps = 60;

  if (this.requestId === 0) {
    (function animationLoop() {
      // Control the timing of an animation with requestAnimationFrame
      _this.settimeoutID = setTimeout(function() {
        _this.render();
        _this.requestId = requestAnimationFrame(animationLoop, _this.move);
      }, 1000 / fps);
    })();
  }
},

changeAnim: function() {
  if (this.counter % 10 === 0) {
    if (this.currentFrame > 1) {
      this.currentFrame = 0;
    } else {
      this.currentFrame++;
    }
  }
},

render: function() {
  // Add some drawing
  this.counter++;

  if (keyCode === config.PLAYER_DOWN) {
    this.action = 'Front';
    this.newPos.y += 1;
  } else if (keyCode === config.PLAYER_UP) {
    this.action = 'Back';
    this.newPos.y -= 1;
  }

  if (keyCode === config.PLAYER_RIGHT) {
    this.action = 'Right';
    this.newPos.x += 1;
  } else if (keyCode === config.PLAYER_LEFT) {
    this.action = 'Left';
    this.newPos.x -= 1;
  }
  this.changeAnim();
  // Draw player logic
  this.drawPlayer.reDraw(this.playerSprite[1].Walk[this.action][this.currentFrame], this.newPos);
},

onKeyUp: function() {
  // Cancel the animation request
  if (this.requestId) {
    clearTimeout(this.settimeoutID);
    cancelAnimationFrame(this.requestId);
  }
  // Allow a new request to be called
  this.requestId    = 0;
  this.counter      = 0;
  this.currentFrame = 0;
  this.drawPlayer.reDraw(this.playerSprite[1].Walk[this.action][this.currentFrame], this.newPos);
}

Note: The function move gets called every time a new key is being pressed.

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:
XNA: How does threading work? I would like to implement threading in my XNA game but I'm not sure how things work when compiling for the XBOX 360. Could someone elaborate on this?

For example, how many threads does XBOX support? I realize that XNA uses a special version of the Compact Framework. How does this affect the code during development? Do I implement things differently when developing for XBOX than Windows?

Thank you.

sentences:
How can I spawn monsters at random locations? I made a little 2D shooter game for my iPhone. I want monsters to spawn at random locations.
But I don't have any clue where to start to make them spawn.

I already made the monster image and everything and everything works, but there's only one monster at the start of the game and when it dies he will not spawn again.

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: What is the point in using API such as Open GL or DirectX when there are game engines? I was wondering why  today programmers place so much emphasis on API like DirectX, and even OpenGl. As far as I know, you'd need thousands of lines of code to make a simple 3D game using one of the aforementioned. But with game engines like Unity, the process is simplified and you can pretty much drag around shapes to create the graphics in lieu of programming it. So what I wanted to know: why is knowing APIs DirectX more preferable than being knowledgeable in Unity, other than the fact that with an API you can code it to be portable on other systems. To me it's like choosing Assembly over a high level language like C. Sure, with assembly I'll really understand what's happening at machine level, but it's take a lot longer to write programs using it and it would be a lot harder to debug.

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

sentences:
Reflections based on distance from plane Let's consider, for example, a surface like the volleyball court, we can see that legs and shoes of the players are reflected, with a blur effect, but body and stadium don't (as each object not near to the court).

I've already made a reflection effect, but it works as a specular reflection, and I need to achieve an effect like the photo above. So, I would like to make a reflection that is based on the distance between the object and the plane, in this manner a close object would reflect more than an object that is positioned far away from the plane.

What is the best way to achieve this effect? My first idea was to use the depth value (taken from the reflected camera), and use that value to blend between reflection and court. But I don't know if it's a correct way.

Edit: as rendering engine I use Ogre that already provides a reflections system: reflecting the camera through a plane (obviously I can select the models to draw from the reflected camera). After a render to texture pass I can blend the reflected texture with the original plane. So, if possible, I'm looking for a way that best suits my system.

sentences:
Getting isometric grid coordinates from standard X,Y coordinates I'm currently trying to add sprites to an isometric Tiled TMX map using Objects in cocos2d. The problem is the X and Y metadata from TMX object are in standard 2d format (pixels x, pixels y),  instead of isometric grid X and Y format. Usually you would just divide them by the tile size, but isometric needs some sort of transform.

For example on a 64x32 isometric tilemap of size 40 tiles by 40 tiles an object at (20,21)'s coordinates come out as (640,584)

So the question really is what formula gets (20,21) from (640,584)?

sentences:
UI Button sprite not changing on click I'm trying to make the sprite of my button change on click, and i used this script to achieve it:
public Button botonPlayMaster; //i assign the button on the inspector
Image imagenBoton;
public Sprite botonPlay; // same with the sprites, i send them on the inspector
public Sprite botonStop;

    // Start is called before the first frame update
    void Start()
    {
        imagenBoton = botonPlayMaster.GetComponent<Image>(); // i get the component from the button

    }

public void cambiaSprite (){
        if (imagenBoton.sprite == botonPlay) {
            imagenBoton.sprite = botonStop;
        }
        else
            {
                imagenBoton.sprite = botonPlay;
            }
    }

This script is attached to a GameManager GameObject. I assign the sprites and the GameObject Button on the inspector, and then send the GameManager object to the OnClick() function on the button's inspector and select the cambiaSprite() function. But when i click, nothing happens. Any help would be appreciated. Thanks!

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:
Representing a high-resolution deformable solid in 3D I am currently working on a design that will incorporate an object that can change size and shape.

For an example, I'll use a brick of clay. It starts out with normal dimensions of 1"x3"x6", but that can be changed because it is a soft material that can be molded.

I'm looking for a way to represent the size and shape of that object, no matter what changes have been made to it. For example, if you push your thumb down into the clay causing a hole, how could I keep track of that (from a programmatic point of view).

I thought about going all the way down to a semi-molecular level, where each "molecule" (I'm not talking actual molecules, but units that are small enough that they can always be considered the same size regardless of the shape of the object -- the resolution if you will) is represented, but the amount of data that could generate for a decent-sized object seems to be staggering. Even if the units were always the same size, the location of every unit would constantly need updating, along with algorithms to determine where each unit would go in the case of a force. The problem seems to get out of hand at this point, which is why I'm looking for any suggestions.

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:
Loading Screen And Coroutines Unity When I want to load another scene and show my loading screen to the user - my loading screen is a game object holding a canvas, I use coroutines, but when I type something like this: LoadingScreen.Show ();
        Application.LoadLevel ("PlayerMenu");

Loading screen is shown less than a second, so I wanted to use coroutines, I typed this:

IEnumerator LoadLevel(string levelName) {
    LoadingScreen.Show ();
    yield return new WaitForSeconds (2f);
    Application.LoadLevel (levelName);
}

The problem when calling the coroutine is that my LoadingScreen.Show() code is not executed, so basically I'm just waiting 2 seconds looking at the background of my current scene and then it goes to another scene, I'm confused here as to what is going on, shouldn't my LoadingScreen.Show() code be executed and then I would see the loading screen and wait 2 seconds and the next scene will appear. Anyone has an idea?

sentences:
android game-logic for shooter Im creating a 2d game for android.

I'll just get right to it. I have a sprite controlled by a joystick that needs to shoot, sofar Ive managed to get direction and movement on my bullet, but then I get stuck.

First of I need a delay for my bullet, cus right now its shooting like 10 bullets/sec, and you prolly know how that looks, like a beam of bullets.

Second there is a problem with the way I update the location for my bullet, my bullet position gets updated every time my sprite-position gets updated. This means that every time I move my character the previous bullets I've fired stop moving, so to be clear, the direction and speed of my bullet is fine, but the way it spawns and updates the old bullets when I move my sprite ( dragging gets set to true ) is really buggy. Maybe every element in my arraylist need a boolean for when its created?

Ill post some relevant code here:

Code for sprite/bullet positon, direction and speed:

    if (dragging) {

        // get the pos
        touchingPoint.x = (int) event.getX();
        touchingPoint.y = (int) event.getY();

        angle = Math.atan2(touchingPoint.y - inity,
                touchingPoint.x - initx) / (Math.PI / 180);
        spriteAngle = Math.atan2(touchingPoint.y - inity,
                touchingPoint.x - initx) / (Math.PI / 2) + 2;

        pointerPosition.y += Math.sin(angle * (Math.PI / 180))
                * (touchingPoint.y / 90);
        pointerPosition.x += Math.cos(angle * (Math.PI / 180))
                * (touchingPoint.y / 90);
        bulletPos.y = pointerPosition.y; //this is what messes up my bullet-position, if I move sprite, the existing bullets stop, so I cant move and shoot
        bulletPos.x = pointerPosition.x;

    if (event.getAction() == MotionEvent.ACTION_DOWN && (int) event.getX() > 650 && (int) event.getX() < 750
            && (int) event.getY() > 300 && (int) event.getY() < 400 ){
        shooting = true;

    }

    if(shooting){
        bulletPos.y += Math.sin(angle * (Math.PI / 180)) //!!!What I removed: * 5;
        bulletPos.x += Math.cos(angle * (Math.PI / 180)) //!!! here to: * 5;
    }

Code for drawing my bullet:

    private void shootingControl(Canvas canvas){ //is called in drawing-method
    if(controls.getShooting() == true){
         bullets.add(new Bullets(bullet, controls.bulletPos.x, controls.bulletPos.y));
         }

    for(int i = 0; i < bullets.size(); i++){
     bullets.get(i).update(); //!!!!added this
        bullets.get(i).draw(canvas);
    }

}

Code for bullet-class:

    public Bullets(Bitmap bitmap, int x, int y) {
    this.bitmap=bitmap;
    this.X=x;
    this.Y=y;
}

    //!!!What I tried adding!!!
    public void update(){
    X *=5;
    Y *=5;

public void draw(Canvas canvas){
    canvas.drawBitmap(bitmap, X, Y, null);
}

I've gotten some help from here alrdy regarding some of this, and I kinda feel bad for asking again, but I cant find anything anywhere and I cant figure it out on my own, really tired of being stuck here.

Ive seen some people using gametime in their bullet-positions and alot of people use vectors.
Or if you can redirect me to a good tutorial. I just want to get past this stage of my game!

Thank you!

sentences: Changing the object material without clicking on it How can I change the object material automatically without clicking on it?  The object material should change based on a timer.

sentences:
Having trouble initializing jagged array ('Object reference not set to an instance of an object' error) As per https://docs.microsoft.com/en-us/dotnet/csharp/programming-guide/arrays/jagged-arrays
I have initialized my jagged array as follows:

private float[][] bulletBehaviour;

void Start()
{
    float[][] bulletBehaviour = new float[1][]
    {
        new float[4] {12.0f, 0.3f, 0.5f, 0.5f} // [typeSelected][speed, size, lifeTime, fireRate, damage]
    };
}

Then any time I try to use bulletBehaviour elsewhere it gives the error in the title.
Note: There will be more arrays eventually (if I can get them working)

Thanks!

sentences:
Data structures for territories in a 2D map I am diving into game development with a 2D game. The game will display a territorial map (borders, capitals, etc.).

What is a common data structure to use for storing and manipulating the data in such a game? I'm considering using a graph (as in Graph Theory, not graphing).

Also, what are common file formats for storing the "polygon data" for each territory? Are there any standard or semi-standard formats?

sentences:
Translate position from 3D camera to 2D camera Currently I have 2 cameras, one for viewing the 3D objects (Perspective), and the other camera to view 2D objects (Orthographic).
(Also, the view of the camera never intercepts each other.)

I am trying to display a 2D object based on the position of a 3D object, like so:

What I have is the respective 2D and 3D Camera, as well as the Vector3 position of the 3D GameObject.

What I have tried:

public Vector2 Convert3DPositionTo2DPosition(Camera camera3D, Vector3 position3D, Camera camera2D) {
    var tempPos = camera3D.WorldToViewportPoint(position3D);

    return camera2D.ViewportToWorldPoint(tempPos);
}

The only problem is that the returned position is not completely aligned with the 3D position.
Which results in this kind of results:

Also, I have made sure that both the 3D and 2D object have their pivot point are set correctly in the center, but it still does not work as intended.

(I am currently using Unity 2019.1.14f1)

sentences:
Why is the sprite flickering in full screen mode in SFML? I have been trying to make a simple platformer game with SFML. Here is my main method where draw and update functions call the draw and update functions of all my entities which in turn update the variables and draw updates the position of the sprite which is to be rendered.

int main() {
sf::RenderWindow window(sf::VideoMode(0, 0), "My First SFML Game", sf::Style::Fullscreen);
int frames = 0;

if(!init()) {
    std::cout << "Could not initialize\n";
    return 1;
}

sf::Clock clock, frameClock;

while(window.isOpen()) {
    sf::Event event;
    while(window.pollEvent(event)) {
        switch(event.type) {
        case sf::Event::Closed:
            window.close();
            break;
        case sf::Event::KeyPressed:
            if(event.key.code == sf::Keyboard::Escape)
                window.close();
            break;
        }
    }

    //keyboard handler
    if(sf::Keyboard::isKeyPressed(sf::Keyboard::Left)) {
        if(player->velX > -7) player->velX--;
    }
    else if(sf::Keyboard::isKeyPressed(sf::Keyboard::Right)) {
        if(player->velX < 7) player->velX++;
    }

    if(frameClock.getElapsedTime().asSeconds() >= 1/FPS) {
        update();
        draw(window);
        window.display();
        window.clear();

        frames++;
        frameClock.restart();
    }

    if(clock.getElapsedTime().asSeconds() >= 1) {
        std::cout << frames << " frames per second\n";
        clock.restart();
        frames = 0;
    }
}
}

There is a strange flicker when I press left or right arrow keys (actually, almost every second). However, it did not happen when I repeatedly pressed prt sc. It also does not happen when with that much intensity (but it still happens a little bit) when I switch out of the full screen mode.

sentences:
Extracting individual components of a vector in the Source Shader Editor I'm using the Source Shader editor and would like to mask a vector output to one or two values, yet there is no existing mask node, as far as I can see.

What HLSL code should I use to output what I need? The input would be in the format "x y z". Any help would be greatly appreciated

sentences:
How do I create a 3rd person camera? I currently have a camera class set up and have my model/player loaded but I can't get my camera in the correct position by changing the x,y,z coordinates.

I have set up my "game" with a separate class for the model/player and a class for the camera. I am fairly new to XNA and most of what I have already got is from a tutorial from my lecturer.

Here is my player/model class:

public class Player
{
    public Model model;
    public Matrix world = Matrix.Identity;
    public Vector3 position;
    public Vector3 direction;
    public Quaternion rotation = Quaternion.Identity;
    public BoundingSphere collision;
    public float speed = 2f;
    public float moveForwards;
    public float moveLeft;
    public float forward;
    Matrix[] transform;

    public Player(Model m, Vector3 iPos)
    {
        model = m;
        position = iPos;
        direction = new Vector3(0, 0, 1);
        transform = new Matrix[m.Bones.Count];
        m.CopyAbsoluteBoneTransformsTo(transform);

        foreach (ModelMesh mesh in m.Meshes)
        {
            collision = BoundingSphere.CreateMerged(collision, mesh.BoundingSphere);
        }
    }

    public Player()
    {

    }

    public BoundingSphere getSphere()
    {
        return collision.Transform(world);
    }

    public void sampleInputMovement(GamePadState player)
    {
        moveForwards = (player.ThumbSticks.Left.Y / 5);
        moveLeft = (player.ThumbSticks.Left.X / 32) * -1;
    }

    public void update()
    {
        rotation *= Quaternion.CreateFromAxisAngle(new Vector3(0, 0, -1), moveLeft) * Quaternion.CreateFromAxisAngle(new Vector3(1, 0, 0), moveForwards);

        Vector3 motion = Vector3.Transform(direction, rotation);
        position += motion * forward;
        world = Matrix.CreateFromQuaternion(rotation) * Matrix.CreateTranslation(position);
    }

    public void Draw(Matrix projection, Matrix view)
    {
        Matrix[] transforms = new Matrix[model.Bones.Count];
        model.CopyAbsoluteBoneTransformsTo(transforms);

        foreach (ModelMesh mesh in model.Meshes)
        {
            foreach (BasicEffect effect in mesh.Effects)
            {
                effect.EnableDefaultLighting();
                effect.Projection = projection;
                effect.View = view;
                effect.World = transforms[mesh.ParentBone.Index] * world;
            }
            mesh.Draw();
        }
    }
}

And here is my camera class:

 public class Camera
{
    Vector3 position;
    Vector3 newposition;
    Quaternion cameraRotation;
    Vector3 targetOffset = new Vector3(0, 1f, -6f);

    public Matrix view = Matrix.Identity;
    public Matrix projection = Matrix.Identity;

    public Camera(Game game, Vector3 xPostion)
    {
        position = xPostion;

        projection = Matrix.CreatePerspectiveFieldOfView(MathHelper.PiOver4, game.GraphicsDevice.Viewport.AspectRatio, 1.0f, 1000000f);
    }

    public void update(Matrix targetWorld)
    {
        Quaternion rotation;
        Vector3 target;
        Vector3 scale;

        targetWorld.Decompose(out scale, out rotation, out target);
        cameraRotation = Quaternion.Lerp(cameraRotation, rotation, 0.15f);
        newposition = Vector3.Transform(targetOffset, targetWorld);
        position = Vector3.SmoothStep(position, newposition, 0.8f);

        Vector3 cameraup = Vector3.Transform(new Vector3(0, 1, 0), Matrix.CreateFromQuaternion(cameraRotation));
        view = Matrix.CreateLookAt(position, target, cameraup);
    }
}

Could someone help me get my camera in the correct position?

sentences:
UI Dropdown - Is it possible to have a custom value type instead of an index? I'm using the UI Dropdown component which lets you set the text of an option (OptionData) only.  The value of an option is the index position in the options list, so there is no way to set this.

My problem is that I have a dictionary<string, tile> that I use to populate the dropdown options, but I would like the value of the option to be the id of the tile class, not the index position.

Edit:

I know I can access elements from the list by using the value (index).

list[dropdown.value].id

But I wanted to see about extending the dropdown with this small change, as I have some other changes I would like to make, but wanted to start with something simple first just to get an idea of what is possile.

I do not want someone to post a full code solution.  Am mostly after some pointers.  Looking at the dropdown class, I don't see how I can extend it to modify some things (value in this case), it looks like I would have to implement by own version?

Some code will make this a little clearer I think:

// All tiles into list.
List<Tile> list = new List<Tile>(mydictionary.Values);

// Sort all tiles based on the tile name.
list.Sort((x,y) => x.name.CompareTo(y.name));

// Current way to add list to dropdown.
for(int i=0; i<list.Count; i++){
    dropdown.options.Add(new Dropdown.OptionData(){
        text = list[i].name // Tile name (string).
    });
});

// What I want to do.
for(int i=0; i<list.Count; i++){
    dropdown.options.Add(new Dropdown.OptionData(){
        text = list[i].name, // Tile name (string).
        value = list[i].id // Unqiue tile id (string).
    });
});

// Getting changed value
dropdown.onValueChanged.AddListener(delegate {
    Debug.Log(dropdown.value); // Instead of the index selected, I want the tile id
});

Or if the value is needed internally for some reason, then maybe an extra property that can be set and retrieved.

for(int i=0; i<list.Count; i++){
    dropdown.options.Add(new Dropdown.OptionData(){
        text = list[i].name, // Tile name (string).
        tile_id = list[i].id // Unqiue tile id (string).
    });
});

dropdown.onValueChanged.AddListener(delegate {
    Debug.Log(dropdown.tile_id);
});

I took a look at the DropDown class to see if I could extend it and add the "tile_id" option in, but I got completely lost on what to do, as I am still quite new to C#.

https://bitbucket.org/Unity-Technologies/ui/src/a3f89d5f7d145e4b6fa11cf9f2de768fea2c500f/UnityEngine.UI/UI/Core/Dropdown.cs

https://docs.unity3d.com/ScriptReference/UI.Dropdown.html

sentences:
Should I code game logic separately from game engine scripts I'm developing a game in Unity3d, economic strategy.
I wonder if I should code logic inside unity scripts, or write it as an external module/library?

By game logic I mean game model, which describe game entities, they relation with each other, their methods. And this logic has nothing to do with and doesn't need to know anything about networking, rendering, representation etc.

If I do it inside unity scripts, then logic is tied to unity engine and I don't see a way to implement multiplayer(client-server) without rewriting whole logic for server-side, where unity cannot be used.

I would like to define logic outside of scripts, and later, reference it inside some "main" unity script. This way I could implement multiplayer easily.

Is this a common practice, or should I avoid it, or maybe there is some alternative patterns?

sentences:
Unity 2D Cinemachine weird behavior for non rectangular confiner I have been trying to emulate a sort of Megaman X4 way of following the player around platforming levels, where the camera is confined to certain boundaries of such levels.

However, all the tutorials and guides out there only show rectangular or square-shaped confiners for the virtual cameras, and not odd shapes like an L shaped confiner, when using a weirdly shaped confiner the camera just tends to snap from one position to another and the game ends up feeling bad when that happens.

I have tried solving this problem by using dolly tracks, which work nicely... But I end up having tons of virtual cameras to change to on sections that are weirdly shaped since the camera ends up also suddenly snapping on to weird positions on sharp turns and it also tends to get way off track, even when the settings of the virtual camera are configured to have very little damping and if there's no damping the camera just stutters all the time.

Is there a way to have this kind of behavior to confine a virtual camera to oddly shaped level boundaries?

sentences:
How long does the collision take? I want to simulate a simple force-acceleration (rather than impulse-velocity) physical world made up entirely of disks and I'm having an irritating problem with my physics.

When two disks collide, I can calculate the changes in velocities quite easily using conservation of momentum and conservation of energy. Since this is going to be a force-based simulation, I need to calculate the forces to apply. I thought I'd use the momentum-impulse equality:

mΔv = FΔt

Sounds simple, except I don't know what to do with time(Δt). So I guess the question boils down to this: how long does the collision take? Or rather, do the two objects stick together for a period of time (Δt)?

sentences:
Is WaitForSecondsRealtime() dependent on machine lag? I was reading the documentation and I'm trying to get some timing down for a few animations.
My question is, is the WaitForSecondsRealtime dependent on machine lag or anything? A friend of mine said that WaitForSecondsRealtime was invoked at the kernel level and thus it would be as accurate as possible.
Like I said I've read the documentation, but they don't really go into the specifics about how that works. Anyone have any insight?

sentences:
How much memory usage is too much in a Flash game? I'm developing a Flash game, and I can appreciate that the memory usage is a little high for a Flash game (I think). Let's say 100+ MB.

So how much is too much when talking about memory usage in Flash games?

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:
Indie devs working with publishers I'm an independent game developer considering working with a publisher.  This question is very informative however I have more questions.  Please give feedback on the following issues... I think this can be helpful to many indie devs in the same situation.

Source code: is it common for developers to give the publisher the source code?
Code quality:  does this matter when working with a publisher any more so than when just working on your own (or in a small team)?  Just wondering if developers working for the publisher might scoff at the code quality and perhaps influence the relationship between developer and publisher.
Unique game concepts: are publishers generally biased towards new/novel game concepts?
Intellectual property: if I send a playable demo to a publisher what's to stop them from just reproducing the new/novel game mechanic?  I think the answer is basically nothing... but I'm wondering if this is a realistic concern.
Revenue sharing: how does it work? what's a common ratio?  70/30?  30/70?
Flaky publishers: how common is it for a publisher to "string along" developers for a while then just drop them?  Can this be reconciled with a contract of some kind?

And any other issues you've encountered or heard of.

sentences:
How do I calculate how an object will move from one point to another? Here's the problem: A player starts the game in the 0 coordinate (x=0,y=0).
When the user clicks on the screen, it returns the coordinates of the destination.
Now the player has to move from its current position A(0.0) to B(x,y).
Take into account that B is in the first Quadrant so x>0 and y>0.

How will the player move?
I know that I will have to use this:
atan2(positionY-destinationY, positionX-destinationX)
to get the angle.

Now what? How will the player move with a fixed velocity (which by the way will be a variable, so a player may move faster while using some "items")?

Whose answer is better? What is more accurate? Trigonometry or Linear Algebra?

sentences:
Which of these two codes are 'better'? Making a local variable or a class variable? Im making more games and asking more stupid questions.

Hopefully this one is very brief. I'm making a very basic class which just moves a Player object by applying force to a rigidbody, but it got me wondering, should I be making a class reference to the rb or just a local variable inside Update every frame? (bearing in mind it already exists in the Monobehaviour.GameObject unity parent class).

I'm wondering if doing many local variables would slow down the loop as a whole(by local I mean inside the function itself and not at the top of the class - hope im using the correct term) .

Here is what I mean, the two ways I was thinking of doing it:

public class Player : MonoBehaviour {

private void FixedUpdate()
{
    Rigidbody rb = GetComponent<Rigidbody>();

    float v = Input.GetAxis("Vertical");

    rb.AddForce(v * rb.transform.forward * Const.walkForce);
}
}

or...

public class Player : MonoBehaviour {
Rigidbody rb;

private void Awake()
{
    rb = GetComponent<Rigidbody>();
}

private void FixedUpdate()
{
    float v = Input.GetAxis("Vertical");

    rb.AddForce(v * rb.transform.forward * Const.walkForce);
}
}

sentences:
Vertical vs horizontal hex grids, pros and cons With hex grids, you can choose to arrange the tiles with the pointy sides up, so that you can move along the west-east axis, or you can arrange them with an edge up, so that you can move along the north-south axis.

Horizontal or pointy-side-up hex grid:

Vertical or flat-side-up hex grid:

According to this page, the vertical alignment is "by far the most popular" in pen-and-paper RPGs, but it doesn't explain why. This blog post also mentions both varieties, but again gives no reason to use one or the other.

And if you look at some PC games using hexes, it seems both have their adherents:

Horizontal: Heroes of Might and Magic series (except V), Civilization V...
Vertical: Panzer General and many similar wargames, Battle for Wesnoth...

But what are the main reasons for choosing a vertical or a horizontal layout of hex grids?

I'm looking for objective advantages and disadvantages in terms of data structures, graphics, gameplay, etc, not personal preferences. Or is it really inconsequential which orientation you choose?

sentences:
Unity "scrape away" effect I am trying to create a effect similar to what is described here How can I let players "scrape away" one texture to reveal another?
I have tried working through this but am confused and hoping someone could provide more info or if there is another way of doing it. Essentially I need to use a laser effect to "burn" or scrape paint from a door to reveal a layer below. Or any object.
I have a object which I have applied the shader to, I can then apply my "rust" and "clean" texture. When I add the splatmap the "rust" texture shows, when I run the scene.. a mouse click then does nothing.

sentences:
Normals vs Normal maps I am using Assimp asset importer (http://assimp.sourceforge.net/lib_html/index.html) to parse 3d models.

So far, I've simply pulled out the normal vectors which are defined for each vertex in my meshes. Yet I have also found various tutorials on normal maps...

As I understand it for normal maps, the normal vectors are stored in each texel of a normal map, and you pull these out of the normal texture in the shader.

Why is there two ways to get the normals, which one is considered best-practice and why?

sentences:
Animation-based Collision Boxes Background

I'm currently working on a top-down 2D game, roughly similar to something like Zelda for the SNES.

Certain game entities such as the player or a typical enemy will consist of multiple collision boxes. For example:

The main collision box which determines collisions with the map (i.e. walls). It also determines where the entity can be hurt.
The attack collision box which, if overlapping a main collision box, causes the owner of that collision box to take damage.

The attack collision box should only be active when the entity is actually attacking.

One Solution

The first potential solution that comes to mind is the one used in fighting games where every frame of animation has its own set of collision boxes. This can obviously work, but it feels like it may be too over-engineered for what I need.

The Actual Question

Other than the solution above, is there a standard or common approach for attack collision boxes? Or is having collision boxes tied to animation the standard way of doing things?

I would like to emphasize the term "standard". It would be great to know how games like The Legend of Zelda, Secret of Mana, and Castlevania handle it.

sentences:
What do you do with "Player Start" and "Pawn" objects when setting up the default VR game in Unreal? I followed the setup tutorial provided by Unreal from here but after setting up the pawn and the VR_GameMode you don't do anything with them. They are never added to the scene or anything and the default game comes with a "Player Start."

Is the "Player Start" object supposed to be removed? If you remove that then running the VR Preview shows the game from wherever your camera is in the viewport and there is no game location. Adding the pawn to the scene doesn't seem to do anything. The final image they show doesn't have the "Player Start" object in the scene at all and they never mention it so I'm unclear about how to complete this process.

Adding the pawn to the scene seems to have no noticeable affect on how the game is run in VR Preview. What's the proper last step?

After following the instructions exactly as-is the floor is way below the current start point and modifying the Z values as instructed has no affect on the floor. Moving the "Player Start" does, but this could have been done from the very beginning without doing any of the setup with the pawn or the GameMode.

sentences:
The rightmost part of the game screen is truncated in HTML I created a game that, when I play it in Unity, looks like this:

But when I build it in WebGL, the rightmost part of the screen (with the red player character in it) is truncated:

Play it in-browser on itch.io to confirm. It looks the same when I open the HTML file locally, so the problem is with the WebGL version and not with itch.

Only when I click the "full screen" button, the rightmost part is shown.

What am I doing wrong?

sentences:
Is there a way to optimize this 2D lighting effect shader? I'm doing a little 2D game in C++ with Direct3D 11.

In the game I want to render a sort of shadow that covers part of the screen:

To do this I am using this pixel shader:

float4 PS_Main( PS_Input frag) : SV_TARGET
{
    float4 color = {0, 0, 0, 1};
    for (int cont=0; cont<lights; cont++)
    {
        int dist = pow(frag.pos[0] - singleLight[cont][0], 2) + pow(frag.pos[1] - singleLight[cont][2], 2);

        if (dist < singleLight[cont][3] * singleLight[cont][4])
        {
            color[3] -= 1 - (dist / (singleLight[cont][5] * singleLight[cont][6]));
        }
    }

    return color;
};

The constant buffer I pass to the shader is:

cbuffer PSbuffer : register( b0 )
{
    int lights;
    float4 singleLight[15];
};

I also pass an array to the shader, each element of which contains the position and radius of a light.

The code works with more than one light, but if I try to use more than ten lights the FPS drops down to 40 or 50. How can I optimize this effect?

Thank to all!!
I try to optimize the pixel shader code but i earn 4-5 fps so i decide to to a "light map" in this way;
I create a second Render Target View i will use to render the lights(sprite i draw).
The light will be alpha-channel inverted in order to have to clear the render target view with color{0,0,0,0}; draw the light on the second target view like this:
and then create a texture with this render target view and render it on the first with a shader that invert the alpha channel (color.a=1-color.a);
but, since i am new in directx i dont now how to do it and i cant find a good tutorial.Can you help me??

sentences:
Why does glGetString returns a NULL string I am trying my hands at GLFW library. I have written a basic program to get OpenGL renderer and vendor string. Here is the code

 #include <GL/glew.h>
#include <GL/glfw.h>
#include <cstdio>
#include <cstdlib>
#include <string>

using namespace std;

void shutDown(int returnCode) {
    printf("There was an error in running the code with error %d\n",returnCode);
    GLenum res = glGetError();
    const GLubyte *errString = gluErrorString(res);
    printf("Error is %s\n", errString);
    glfwTerminate();
    exit(returnCode);
}

int main() {
    // start GL context and O/S window using GLFW helper library
    if (glfwInit() != GL_TRUE)
        shutDown(1);
    if (glfwOpenWindow(0, 0, 0, 0, 0, 0, 0, 0, GLFW_WINDOW) != GL_TRUE)
        shutDown(2);
    // start GLEW extension handler
    glewInit();

    // get version info
    const GLubyte* renderer = glGetString (GL_RENDERER); // get renderer string
    const GLubyte* version = glGetString (GL_VERSION); // version as a string
    printf("Renderer: %s\n", renderer);
    printf("OpenGL version supported %s\n", version);

    // close GL context and any other GLFW resources
    glfwTerminate();
    return 0;
}

I googled this error and found out that we have to initialize the OpenGL context before calling glGetString(). Although I have initialized OpenGL context using glfwInit() but still the function returns a NULL string. Any ideas?

Edit
I have updated the code with error checking mechanisms. This code on running outputs the following

There was an error in running the code with error 2
Error is no error

sentences:
Dynamic Terrain Triangulation Is there someone who know/have an algorithm which can perform terrain triangulation like on the example image right under (there is a secondary image as well).

The reason I say "Dynamic" is because I want it to support Dynamic changes to the terrain, like if one was to dig into the ground or into the side of a mountain, then it should be capable of triangulating the new changes without destroying the old terrain which doesn't need changes.

Ignore the things like the trees, etc. This is only about the style of the terrain itself.

Click here for fullscreen picture
Secondary Image

I've tried using the Marching Cubes Algorithm, though it didn't give me that triangle'ish feeling, like in the image(s) above (While ignoring the normal rendering in my example).

Bottom Line

Does anybody know/have an algorithm, or any idea of how to...

Triangulate terrain so it have that style like in the above example image(s).
Support dynamic changes like Marching Cubes does, but with this triangle'ish style.

Note: All the "points" would be in an unsorted list, where the "points" of course is all the vertices, which should be used to generate all the triangles from.

  Disclaimer: I usually answer and sometimes ask question on Stack Overflow, so if anything is wrong with my question here I apologize, though comment and I will fix whatever is wrong.

sentences:
Slow uniform array in shader causing FPS drop I'm trying to use an uniform array of matrices in my compute shader. However, it's really slow. I've narrowed it down to this lines of code:

uniform mat4 someMatrixArray[64];
...
vec4 result = vec4(0);
for (int i = 0; i < 2048; i++) {
    result += someMatrixArray[i%64][0] * 0.01;
}

When not accessing someMatrixArray I get 700+ fps. When accessing it, I have 10 fps. Anybody has an idea what could cause this? Could it be a driver issue?

I already tried to unroll the loops (via #pragma optionNV (unroll all)) but that didn't help. I'm using a GTX670 with the latest drivers on windows 7.

Edit:

The generated assembly for the inner loop is:

MAD.F R0.xyz, c[196], {0.0099999998, 0, 0, 0}.x, R0;

sentences:
When is an intro too long for game logos? After doing some searching and finding no answers, I decided it would be okay to ask here.

In indie or big company games, when they show their logo or have an animation for that company logo, what is the average display time for it and how often do they have themes or sounds with that splash screen?

sentences:
How to create an Editor class for a generic class For all my MonoBehaviour scripts, instead of them inheriting from MonoBehaviour they inherit from a generic class like so:

public abstract class MonoBase<T> : MonoBehaviour where T : MonoBase<T> { }

public class Example : MonoBase<Example> { }

Now, I would like to make an editor script for all those MonoBase classes, and the closest I have gotten to a solution that will compile is :

[CustomEditor(typeof(MonoBase<>))]
public class MonoBaseEditor<T> : Editor where T : MonoBase<T>
{
    public override void OnInspectorGUI() {
        this.DrawDefaultInspector();

        MonoBase<T> myScript = (MonoBase<T>)this.target;
        if (GUILayout.Button("Build Object")) {
        }
    }
}

But of course it doesn't really work.

Am I missing something or is there really no way to make a generic editor class like it's mentioned in an answer here.

sentences:
Component messaging system - using integers vs message objects I'm currently working on a component based system for my game, and I've decided to use a messaging system to communicate between components. I've read some on the subject and it seems that most people are using message objects that extend on a base message object like so;

MySpecificMessage extends Message

or possibly they just have a single Message object which takes in a string variable that determines what it does, like so;

new Message("positionX:10"); //Plus other variables you might need

But I've also seen some implementations of this using statically defined integers as messages like so;

public static final int MySpecificMessage = 1; //Different numbers for different messages

Basically I'd like to know what the pros and cons are between them, and possibly when you'd use one over the other. Also, if you have any other type of messaging system please do share.

sentences:
Getting a sampler of the default rendertarget (null) I've been working on a mod for "Duck Game" that adds dark levels like in Spelunky.

I read this guide on how to make shaders, but in my case I don't have access to the draw method and since the game isnt drawn in a rendertarget first I can't do the same blending as he did.

I wrote my own shader that sets the alpha based on the average color value, looks like this:

float4 PixelShaderFunction(float2 coords: TEXCOORD0) : COLOR0
{
    // TODO: add your pixel shader code here.
    float4 color = tex2D(s0,coords);
    color.a = 1-((color.r + color.b + color.g)/3);
    return color;
}

And it looks like this in game:

I personally isn't satisfied with how this looks but to make it like in the tutorial (which is way better) I would need to get the sampler of the main draw (with current rendercontext set to null).

Is there a way to get the pixels on screen so that I can use it like in the tutorial?
I'll also accept answers with better ways of doing it.

sentences:
Is there a way to read unity console outside of unity? my unity  project keeps crashing and it does not let me read the exception error, I am wondering if there is a way to read the unity console externally outside of unity. Any pointers will be highly appreciated.
Thanks

sentences:
Crop a texture procedurally Is there a way to crop a texture having a list of triangles which represent the part to be kept?
For instance, I have a rectangular texture and I want to obtain a texture shaped by the triangle list I have.

sentences:
Camera will not move between given points, stuck at first given point [EDIT: Working code added]

[Original question]

I'm putting together a "raid cam" or "overview cam" for a given map in my shooter for an observing player to use to fly down a given preset path (to prevent griefing and cheating, this may change in my final build)

Unfortunately though I can get the program to invoke the given method, iterate through each of my points, and display this to the debug console, my player camera does not move from the very first start point. I'm attempting to use the Vector3.MoveTowards function at the moment but if there is a better way to move the camera between the points I am open to that.

[/Original question]

The code is as follows, and heavily commented for clarity on my thought process:

// Invoked from external function, takes precoded path and translates player between the given points
public void FlyThroughPath(List<Vector3> path){

    // If the flightpath is not empty
    if(path.Count > 0){
        // If we haven't already enabled fly through mode
        if (!enabled){
            Debug.Log ("enabling fly through mode");
            // Enable fly mode
            enabled = true;
            // Assign our starting point
            CurrentIndex = 0;
            StartPoint = path[0];
            // Move us to the start point
            transform.position = StartPoint;
        }else if (enabled && CurrentIndex < path.Count){
            Debug.Log ("Already enabled, moving to next point");
            // If the distance between the points is too far we keep moving towards that point
            if(Vector3.Distance(transform.position, path[CurrentIndex]) > 5.5f){
                Debug.Log("Too far keep moving");
                FlyToNextPoint(transform.position, path[CurrentIndex]);
            }else if (Vector3.Distance(transform.position, path[CurrentIndex]) <= 5.5f){
                Debug.Log ("Point reached move to next one");
                CurrentIndex++;
            }else{
                Debug.Log ("Ifs were too specific, whoops");
            }
        }else if(enabled && CurrentIndex >= path.Count){ // If enabled and we don't have another point in our path
            Debug.Log ("no more points let's disable the flythrough");
            // We have arrived at our last point so let's disable the flythrough;
            enabled = false;
        }
    }
}

// Takes two points and transforms the player camera between them at a preset speed
public void FlyToNextPoint(Vector3 start, Vector3 end){
    // Grab the time for movement speed and duration
    // Snag the player's last chosen speed for consistency
    m_speed = flyMotor.m_actualSpeed;
    // put together the time we want to use between the two points
    float t = m_speed * Time.deltaTime;
    // Move the player between the given points at the given speed
    Debug.Log ("Flying to " + end.ToString() + " from position " + start.ToString());
    // Move the player camera towards the next point from the given start point
    transform.position = Vector3.MoveTowards(start,end, t);
}

EDIT: For clarity the function is evoked here:

// Update is called once per frame
void Update () {
   [...]
   else if(cInput.GetKeyUp("Fly Mode Start")){
        Debug.Log ("Flythrough initiated in FlyMotor");
        // Instantiate and start the flight path functions
        AutoFlyThrough = GetComponent<FlyThrough>();
        AutoFlyThrough.FlyThroughPath(FlightPath);
    }

    if(AutoFlyThrough != null){
        if (AutoFlyThrough.enabled){
            // Check the position and continue to move the player
            AutoFlyThrough.FlyThroughPath(FlightPath);
        }
    }
}

sentences:
Moving a top-down camera while keeping its height constant I'm currently writing the script for the player to explore the plane below. The camera view is set to be slightly rotated as to look down. And I have set the code to make the camera move.

This is the code, and everything is set in the update method.

        if (Input.GetKey("w"))
        {
            transform.Translate(Vector3.forward * panSpeed * Time.deltaTime);   // , Space.World if want to avoid camera going down
        }
        if (Input.GetKey("s"))
        {
            transform.Translate(Vector3.back * panSpeed * Time.deltaTime);
        }
        if (Input.GetKey("d"))
        {
            transform.Translate(Vector3.right * panSpeed * Time.deltaTime);
        }
        if (Input.GetKey("a"))
        {
            transform.Translate(Vector3.left * panSpeed * Time.deltaTime);
        }

The problem is that everytime that the camera goes forward, it goes straight down. And I don't want it to do that. I want to keep the "height" from the plane below to be the same as in the picture below. I want the camera to move along the red axis.

I know of the existence of Space.World in order to achieve this, but the problem is that if I do that, whenever I rotate, now the controllers are all screwed up, because if I rotate to the right for example. Now Forward (W) moves the camera to the left, Right (D), moves the camera forward, etc etc.

So basically what I need is 1: to make the camera keep the distance to the plane below while moving (not going down). and 2. To make it possible that even with rotations, the controllers are kept, and not having this weird behavior, when forward is not longer forward.

Any ideas how to achieve this?

sentences:
Bullet spread changes depending on the camera direction I'm working on an FPS game. I want to make a little bit of difference in shooting direction, only on the horizontal axis.

To do this, I wrote this code:

Temp_Shake_Horizontal.x = Random.Range(-0.1f, 0.1f);

if (Physics.Raycast(the_camera.position, the_camera.forward + Temp_Shake_Horizontal, out BulletDecal_Hit, Mathf.Infinity))
{
     Quaternion HitRot = Quaternion.FromToRotation(Vector3.forward, BulletDecal_Hit.normal);
     decals_Objs[decal_Index].transform.position = BulletDecal_Hit.point;
     decals_Objs[decal_Index].transform.rotation = HitRot;
}

But I don't know why, when I rotate the camera, the result is changing!

Here is what it looks like when I face in one direction (this is the intended result):

But when I rotate the camera about 90 degrees to the left or right, the result is no horizontal variation: the bullets all line up in a vertical column.

Why does this happen, and how can I solve this issue? I want the result to always be like the first picture, with random variation side-to-side.

sentences:
Minimizing amount of comparisons for collisions? In my 'Terraria' based game I am having lag issues. The cause of the lag is as follows:

Every update loop through all the tiles in the world:
If the rectangle that was passed as an arg intersects with the current tiles rectangle return true. If not go to the next tile.
If the rectangle that was passed as an arg doesn't intersect with any of the tiles rectangles then return false.

My solution is to only check collisions for the tiles that are on the screen.
At the moment my code renders all of the tiles regardless of the position. I know that this is a very lag-filled approach and I have no idea at all what the maths is to only get the tiles the player can see. If it helps the world is stored in a hash map that is initialised like this:

public Map<Integer, Tile> world = new HashMap<Integer, Tile>();
// numeric id = key , tile = value

I have tried looping through the tiles in 2 ways:

public boolean checkCollision(Rectangle argRect)
{
    for(int i = 0; i < world.size(); i++){
        Tile tile = world.get(i);
        Rectangle tileRect = new Rectangle(tile.rect);

        if(tileRect.intersects(argRect)){
            return true;}
    }
    return false;
}

And:

public boolean checkCollision(Rectangle argRect)
{
    for (Entry<Integer, Tile> entry : world.entrySet()) {
          Object key = entry.getKey();
          Tile tile =  world.get(key);
          Rectangle tileRect = new Rectangle(tile.rect);
          if(tileRect.intersects(argRect)){return true;}
    }
    return false;
}

Could I pass the players position to this method and have it only loop through tiles in the area? Would this approach have to loop through the tiles to see which ones are in the area?

sentences:
Optimizing isometric drawing function I need help optimizing my Draw(); function to draw only what is visible in the viewport. Currently I'm drawing the whole Map array in a diamond shape. How can I make my function store only what is visible?

Here is an image explaining it better:

Black tiles are X axis, White tiles Y axis. Green tiles are what I would like the function to store, and the Orange rectangle is the viewport.

I'll include the relevant part of my code aswell:

for(i=0;i<Map.length;i++) {
for (j=0;j<Map[i].length;j++) {
tileX = (i - j) * (tile.width / 2);
tileX += (canvas.width /* 2*/) - (tile.width / 2);
tileY = (i + j) * (tile.height / 2);
tileY -= (canvas.height /* 2*/);

    c.drawImage(tile, tileX, tileY);
}
}

I've been trying to figure out how to solve this, but since I'm no genius I can't. Help appreciated.

sentences:
Rotating, moving and scaling a mask in a shader I want to rotate, move or scale a mask in a shader. But I have no clue to how perform these actions.

My code:

@Override
public void create() {
batch = new SpriteBatch();

background = new Texture(Gdx.files.internal("images/background.png"));
spritebackgournd = new Sprite(background,Gdx.graphics.getWidth(),Gdx.graphics.getHeight());

foreground = new Texture(Gdx.files.internal("images/foreground.png"));
mask = new Texture(Gdx.files.internal("images/mask.png"));

 spriteforegournd = new Sprite(foreground,Gdx.graphics.getWidth(),Gdx.graphics.getHeight());

shader = new ShaderProgram(Gdx.files.internal("shaders/shader1.vert"), Gdx.files.internal("shaders/shader1.frag"));
}

@Override
public void render() {

batch.begin();
spritebackgournd.draw(batch);
 batch.setShader(shader);
    Gdx.graphics.getGL20().glActiveTexture(GL20.GL_TEXTURE0);
    spriteforegournd.getTexture().bind(0);
    //texture.bind(0);
    shader.setUniformi("u_texture", 0);
    Gdx.graphics.getGL20().glActiveTexture(GL20.GL_TEXTURE1);
    //spritemask.getTexture().bind(1);
    mask.bind(1);
    shader.setUniformi("u_mask", 1);
    Gdx.graphics.getGL20().glActiveTexture(GL20.GL_TEXTURE0);
    spriteforegournd.draw(batch);
    batch.end();
    batch.setShader(null);
   }

The vertex shader:

attribute vec4 a_position;
attribute vec4 a_color;
attribute vec2 a_texCoord0;

uniform mat4 u_projTrans;

varying vec2 v_texCoords;

void main() {
v_texCoords = a_texCoord0;
gl_Position = u_projTrans * a_position;
}

The fragment shader:

varying vec2 v_texCoords;
uniform sampler2D u_texture;
uniform sampler2D u_mask;
uniform mat4 u_projTrans;

void main() {
vec4 texColor = texture2D(u_texture, v_texCoords);
vec4 maskColor = texture2D(u_mask, v_texCoords);

gl_FragColor = texColor * maskColor.a;
}

What I would like to be able to is to scale, rotate and move the mask in the shader. How can I do this?

sentences:
Regeneration using Time.deltaTime I'm trying to regenerate stamina at a rate of 1 per second using Time.deltaTime, however this doesn't do anything (My 'current stamina' doesn't change at all). I've done some looking around and I have tried Time.fixedDeltaTime. Also tried Time.time, but that just regenerated all my stamina in under a second.

Here is my code:

var max_stamina : int = 100;
var cur_stamina : int;
var staminaRegenRate : int = 1;

function Update(){
    //regen
    if(cur_stamina < max_stamina){
        cur_stamina += staminaRegenRate * Time.deltaTime;
        Debug.Log("Second has passed");
    }
}

What am I doing wrong?

sentences:
Modifying GLFW callbacks I'm currently using Imgui for the GUI part of my OpenGL/C++ engine with the GLFW binding. The problem is though that this binding has encapsulated the input callbacks in a global .cpp file which makes it impossible to access for other classes. Now I could always use the regular routine to handle input without the callbacks like:

if(glfwGetKey(m_window, GLFW_KEY_A) == GLFW_PRESS)
   ...

but yet this won't give me the one-to-one mapping like the key callback provides as the conditional code is processed more than once. I have tried using static booleans without success to see if I could overcome the problem by setting the boolean to true when the key is pressed in the callback and then handling the outcome elsewhere. I also know that you can override callbacks with different ones but that would not make any sence in this case.

Does anyone know how to solve this problem?

sentences:
How to build multiplayer games for android? I'd like to know how to build android multiplayer games but I'm struggling to find a step-by-step or good resources on this topic. My main questions is which engine and api to use? I'd like to achieve this with the technologies I already know such as Firebase and Libgdx on android studio.

All my researches point to things like Unity, Godot and unreal. Is this the only/better way to go since I want to build simple games such as pool ?

What I want to build is a multiplayer game on where the users should be able to invite friend from their social media to play against, provide rankings and sharing results on social media. ONLY for Android, using Java and free resources (APIs, db's, engines).

A good example would be Trivia Crack how is this game (probably) made? which technologies?

sentences:
Why is the pixel so popular as the metric unit of a game? I keep seeing everywhere people using pixels for resolving collisions, angles, distances. I wonder if using the pixel as the metric unit for a game is a good solution, first because you're tying your game logic with implementation, in this case squares in your monitor, second handling more elaborated effects like zoom, rotation becomes more difficult, etc. Isn't adopting integer numbers as your smallest metric unit more flexible and letting the renderer do the pixel operations?

Why the pixel unit is so much popular than integer units?
Which are the benefits and drawbacks for each strategy?

sentences: What programming language were PS1 games written in? Is there any common language that is used to create Play Station 1 Games? Or how can I find out what programming language is used for one of those games?

sentences:
Get width of a 2D GameObject in Unity I'm trying to get the width and height of a 2D GameObject.
My GameObject is simply a prefab created using sprite.

I have tried solutions from other posts but they don't work for me:

Vector2 size = myGameObject.GetComponent<CircleCollider2D>().bounds.size;
float width = size.x;
float height = size.y;

and

Vector2 size = myGameObject.GetComponent<Collider2D>().bounds.size;
float width = size.x;
float height = size.y;

My prefab has a Circle Collider 2D but x and y always returns 0

I'm using Unity 5.5.0f3, not sure if previous solutions apply to this version.

sentences:
How can I calculate respective 2D world/mouse position through different resolutions? I have been at this game of trial-and-error for days now. I cannot find a consistent method to calculate the respective mouse position in my game world after the calculations are done to stretch the game's render view to the current resolution. I've seen other, similar questions and answers on this site, but after looking at them long and hard, I can't translate the answers to my project.

I'm using XNA. First, I render everything to a RenderTarget2D at a resolution of 800x600. Then I render said RenderTarget to the screen by calculating it's size and location through a method that returns a Rectangle:

public Rectangle CalculateRenderTargetPosition()
    {
        Rectangle rec;
        Single preferredAspect = Globals.RenderSize.Width / (Single)Globals.RenderSize.Height;
        Single outputAspect = Globals.WindowSize.Width / (Single)Globals.WindowSize.Height;
        if (outputAspect <= preferredAspect)
        {
            // output is taller than it is wider, bars on top/bottom
            Int32 presentHeight = (Int32)((Globals.WindowSize.Width / preferredAspect) + 0.5f);
            Int32 barHeight = (Globals.WindowSize.Height - presentHeight) / 2;
            rec = new Rectangle(0, barHeight, Globals.WindowSize.Width, presentHeight);
        }
        else
        {
            // output is wider than it is tall, bars left/right
            Int32 presentWidth = (Int32)((Globals.WindowSize.Height * preferredAspect) + 0.5f);
            Int32 barWidth = (Globals.WindowSize.Width - presentWidth) / 2;
            rec = new Rectangle(barWidth, 0, presentWidth, Globals.WindowSize.Height);
        }
        return rec;
    }

The Camera's position is rendered during rendering to the RenderTarget2D through a Matrix in the SpriteBatch.Draw method, so there's nothing weird going on there. The Camera itself works fine at any resolution.

After days of guesswork, this is the closest method I've got:

Rectangle r = Globals.Draw.CalculateRenderTargetPosition();
MouseState ms = Mouse.GetState();

Single aspect = Globals.WindowSize.Width / (Single)Globals.WindowSize.Height;
Single pmx = (ms.X - r.X);
Single pmy = (ms.Y - r.Y);
Single mx = (pmx == 0 ? pmx : pmx / aspect);
Single my = (pmy == 0 ? pmy : pmy / aspect);
Vector2 pos = Vector2.Transform(new Vector2(mx, my),
    Matrix.Invert(Globals.Camera.GetViewMatrix()));
Globals.RelativeMousePosition = new Vector2(pos.X, pos.Y);

Even if this is almost close enough, it's still off. I don't know if there's some magical Matrix method I don't know about or if I just suck at math.

sentences:
How do I prevent getting an access denied loading a file in XNA, when I have the application running in the program files directory (in Windows 7)? I'm creating an app in XNA.

I'm trying to load a custom save file. I named the file with my own custom extension. It's an XML file serialized with the DataContractSerializer.

I've tried several things to load the file. And they all work when I'm running in my development environment, or when the game is running from most folders, but if the game has been placed in the program files folder (or any other protected by Windows 7), the game won't load my custom files, but it will load images and other items that the content importer handles naturally.

Things I have tried:

Directly loading the file using the DirectoryInfo.CurrentDirectory() then scanning for files, and loading them.
Using the StorageContainer.TitleLocation
Creating a custom importer, and loading them into the content pipeline

In all cases, it works fine running in my IDE (C# Express 2008), but when the app is running from Program Files, I get the following error:

Access to the path 'C:\Program Files\MyFolder\MyAppName\Content\CustomFolder\Blah.CustomExtension' is denied.

I am running as administrator (though obviously, I eventually don't want the end user to need this right).

Any suggestions?

sentences:
Why aren't my 2D primitives visible using a custom effect? I'm working with Monogame and rendering a triangle using the following code.

vertices = new []
{
    new VertexPositionColor(new Vector3(100, 200, 0), Color.White),
    new VertexPositionColor(new Vector3(200, 100, 0), Color.White),
    new VertexPositionColor(new Vector3(300, 200, 0), Color.White),
};

graphicsDevice.DrawUserPrimitives(PrimitiveType.TriangleList, vertices, 0, 1);

Ordinarily I'd apply a BasicEffect before the draw call, but this time I'm using a custom effect. For testing, I wrote the following shader code to return solid green for each pixel within the triangle.

struct VertexShaderInput
{
    float4 Position : POSITION;
    float4 Color : COLOR;
};

struct VertexShaderOutput
{
    float4 Position : POSITION;
    float4 Color : COLOR;
};

VertexShaderOutput VertexShaderFunction(VertexShaderInput input)
{
    VertexShaderOutput output;
    output.Color = input.Color;
    output.Position = input.Position;

    return output;
}

float4 PixelShaderFunction(VertexShaderOutput input) : COLOR
{
    return float4(0, 1, 0, 1);
}

technique Technique0
{
    pass Pass0
    {
        VertexShader = compile vs_4_0_level_9_1 VertexShaderFunction();
        PixelShader = compile ps_4_0_level_9_1 PixelShaderFunction();
    }
};

The problem is that, although the shader compiles successfully, nothing shows up.

Why is my triangle invisible using this shader?

Based on my understanding of vertex and pixel shaders, the above HLSL code should work correctly. In the vertex shader, since (for the moment) I'm working in strictly 2D without a camera, no transformations need to be done on the vertices (i.e. they're already in screen space). From there, the pixel shader simply returns solid green for each pixel. I've also ruled out potential backface culling issues by swapping the order of vertices, and I've tried using different semantics on my HLSL structure variables. No luck.

Shaders still feel uncomfortable to me, but I feel my logic is correct based on what I've read. If that's the case, there must be some weird quirk I'm not aware of in having these HLSL shaders work at all, apart from the logic. What am I missing? Is there a better way to debug these problems short of changing random variables and hoping for the best?

sentences:
Should I store ads in the background or recreate them every time I need them? I am developing an XNA game for Windows Phone 7 and 8. The game is level-based. After finishing each level a screen comes up with a bit of stats summary. I wish to embed an ad in this screen, on which I expect users to only spend a few seconds on after each level.

The ads I am using are Microsoft's pubCenter ads and AdDuplex as a backup.

Should persist instances of these ads throughout the game's operation and only make them visible on level completion? Or should I create new instances every time they are needed and destroy them once I don't want them anymore for each level?

My worry is that starting up an ad on a screen which is intermediate and lasts for a short while might not be enough time for an ad to download. On the other hand, having one or more ads running continuously in the background might not be a good thing for battery or performance.

sentences:
"Hold to jump higher" suddenly outputs a much higher jump I'm programming my first game in Unity and I'd like to make a very controllable jump.

The idea is to apply an upward force while the player is still pressing the jump button, and then after some time ignore jump input. Kinda like how Mario and Mega Man jump.

Problem is, somehow, my character occasionaly jumps much higher than it normally does.

I set three variables on the inspector:

jumpImpulse: the initial speed after pressing the jump button;
riseAcc: the acceleration applied to the character while holding the jump button;
maxJumpHoldTime: the longest possible time one might hold the button while still rising.

if ((onGround || onPlatform) && Input.GetButtonDown("Jump")){ //GetButtonDown prevents holding jump and keeping jumping

    rb.AddForce(Vector2(0,(jumpImpulse/rb.mass)), ForceMode2D.Impulse); //force that starts the jump itself.
                                //  /rb.mass makes F=ma into F=ma/m ==> F = a, so "Force" is actually acceleration.
                                //  This is to better control mass and jump mechanics.
    jumping = true;

    //DEBUG
    debugJumped = true;
}

if (jumping && Input.GetButton("Jump")){

    rb.AddForce(Vector2(0,(riseAcc/rb.mass)), ForceMode2D.Force); //first acceleration

    jumpHoldTime += Time.deltaTime;

    if (jumpHoldTime >= maxJumpHoldTime) {
        jumping = false;
    }

} else {

    jumping = false;
    jumpHoldTime = 0;

}

//Made this so I know how high the character jumps.
if (debugJumped && (!onGround) && rb.velocity.y <= 0){
    Debug.Log ("Jump height is: " + transform.position.y);
    debugJumped = false;
}

In the console, the jump height is listed normally as 2.376213, but sometimes it appears as 5.008272. It appeared once as 2.377432. Also, this variation seems to appear more frequently when I'm also moving the character left or right.

And I'm not sure if this is related, but there are many times when I press the jump button and the character simply doesn't jump.

Also, I put everything here under the FixedUpdate function.

sentences:
Ray Sphere Interesection Distances WRONG The discriminant is not working. This code produces incorrect distances from ray to sphere, but it can tell whether or not the ray does strike the sphere.

HOW HARD IS THIS I'VE BEEN TRYING TO DO THIS FOR 2 DAYS

float raySphereIntersect2(glm::vec3 ray, glm::vec3 origin, glm::vec3 sphere_origin, float sphere_radius, float drawdistance){
    //A sphere is given by its center
    float cx = sphere_origin.x;
    float cy = sphere_origin.y;
    float cz = sphere_origin.z;
    //its radius R
    float R = sphere_radius;
    //and its color
        //Ignored
    //A line segment (ray) is given by its endpoints:
    //P0
    float x0 = origin.x;
    float y0 = origin.y;
    float z0 = origin.z;
    //and P1
    float x1 = origin.x+(ray * drawdistance).x;
    float y1 = origin.y+(ray * drawdistance).y;
    float z1 = origin.z+(ray * drawdistance).z;
    //set
        float dx = x1 - x0;
        float dy = y1 - y0;
        float dz = z1 - z0;

        float a = dx*dx + dy*dy + dz*dz;
        float b = 2*dx*(x0-cx) + 2*dy*(y0-cy) + 2*dz*(z0-cz);
        float c = cx*cx + cy*cy + cz*cz + x0*x0 + y0*y0 + z0*z0 + -2*(cx*x0 + cy*y0 + cz*z0) - R*R;

        float discriminant = (b * b) - (4 * a * c);
        if (discriminant < 0)
            return -1;
        // OK so there is a solution, compute the distance
        float t = (-b - sqrtf(discriminant))/(2*a);
        return t;
}

sentences:
How to test a 3D rendering engine? Me and some friends developing simple 3D rendering engine as practice for the university.
We used Ogre 3d as prototype and now we are developing it from base

The engine is wrapped up in simple game that asks the user to select shape (circle, triangle, square...), color and dimensions and renders the image to the screen. It also enables to move and rotate the shape on screen using mouse.

We would like to test automate the view rendering.
I could not find any test framework for this issue and I would like to know how 3D test is done in non manual matter

sentences:
Heuristics used for determining device performance Often times PC games offer an elaborate settings page which lets you turn 20 different knobs. Users can modify these settings at will in the pursuit of performance, or conversely, visual quality.

But, the first time you launch the game, how does it know what settings to apply? I'm guessing there is something smarter going on than just using the 'MEDIUM' configuration for everything, and then letting the user figure out the right configuration...

In fact, I'd further guess that settings are chosen on first launch in the interest of performance, i.e. the game will choose the correct settings for this particular machine so it can run at 60 FPS and not crash from out of memory... So, if there is indeed a runtime algorithm employed that selects the appropriate settings, what kind of heuristics are used to choose those settings?

Is there a database of devices, or hardware components, that can be used to determine the correct performance of a device? (I assume not.)
Is there a scoring system based on the various specs of system components: system memory size, D3D feature level, GPU memory, etc... This seems more believable, but I'd like to know if there are examples of this being done.

And, there are other strategies that I'm not interested in, e.g. doing a mini profiling run and then determining the correct settings based on framerate of that run. Or, dynamically tuning the performance on the fly, e.g. detect the framerate is dropping, and then somehow degrade the quality to improve.

Both of those approaches aren't what I'm after. I'm looking for some heuristics to employ when the game launches, and I'd like those heuristics to be able to spit out some sort of performance criteria for the device so I can know what settings to run my game at.

If I get it wrong, the user can always go back and turn the knobs in the settings page, but I'd like to do most of the work for them!

sentences:
Receiving keyboard events on a canvas in Javascript I need to receive keyboard events in a canvas element. Click events are received but key presses aren't.

Here is my code which doesn't handle key events:

var canvasElm = $('canvas');
Event.observe('canvas', 'keypress', function(e) {
    console.log('Key event is received!!');
    console.log(e);
});

How can I make it handle those key events?

sentences:
Do sprite animations usually run at the same framerate as the game itself? Just getting into game development and wondering about fps. For example, Binding of Isaac can run at 60 fps, but looking at its sprite sheet, the walk animation is only 12 frames. The game animation definitely doesn't look like its running at 60 fps, but I think the collision, movement, etc. systems are?

I'm working on a game I plan on running at 60 fps, is this a good frame rate for a first game, and how do you fit sprite frames into a higher frame rate? I assume if you have a 12 frame/second animation, you can run each sprite frame for 5 in game frames.

I've seen people talk about issues in running a 12 frame cycle in a 30 fps game, because the ratio isn't a whole number, so it doesn't scale. Will this be a problem if someone wants to run the game at a lower frame rate? Or is the frame rate locked and the game slows down if a computer can't run it?

Sorry if I'm asking some obvious questions, I'm pretty new to this.

sentences:
Getting mousemovement despite mouselock - unity I have lockcursor so the cursor doesn't leave the screen, but now i have to rotate an object based on mouse movement (think garrys mod item rotation) but the mouse cursor is obviusly locked to the center, is there anyway of getting the input from the mouse?

 public void GetRotated()
{
    Debug.Log(Input.GetAxis("Mouse X").ToString() + ", " + Input.GetAxis("Mouse Y").ToString());
    gameObject.transform.localRotation = new Quaternion(Input.GetAxis("Mouse X") * RotationSpeed * Time.deltaTime, Input.GetAxis("Mouse Y") * RotationSpeed * Time.deltaTime, 0, 0);
}

sentences:
How to display full website in Unity WebGL? I want to display the complete website within the WebGL in Unity. I have tried Awesomium plugin but it doesn't work in WebGL. Please tell me is there any way to display the webpage.

Thank you.

sentences:
Generating a mesh from a set of generatively produced co-ordinates Using Unity I've been producing sculptural forms that look like this. It's made of patterns of cubes that twist around each other using a flocking algorithm. I'm trying to get it into a 3D printable format.

From unity I export a PLY that is a list of the co-ords of each cube that looks like:
ply
format ascii 1.0
element vertex 17500
property float x
property float y
property float z
end_header
35 2.521441 0
34.72401 -2.06799 4.386663
33.90041 3.202552 8.704146
...

Then I've imported that into meshlab and run Filters > Remeshing, Simplification and Reconstruction > Surface Reconstruction: Ball Pivoting with the default parameters.

This is the result (different iteration so doesn't match top image but similar) which is ok, but obviously not 3d printable.
Is there a better way of doing this in Unity to create a single mesh? I'd be happy with either a single mesh with individual lines or a mesh that makes a single shape as if it were shrink wrapped.

sentences:
TArrray to Texture2D in Unreal I have a TArray of type FColor (I got it from the viewport) and I want to change that to a Texture2D object I can't find anything in the API's and I'm new to Unreal.

Thanks

sentences:
Money in different platforms So first of all, let me start off by saying that I am not in this to make money as of right now. I'm a novice - however I would like (in the frture) to be able to earn some extra cash on the side with my games.

I have several ideas for what my first game could be and then I started considering the platform on which my game should run.

So I started thinking

iOS & Android mobile devices already have a built-in store that everyone uses. This means that even if my game doesn't get a lot of attention (and doesn't reach the highest position on the market) everyone would still be able to find my game on the same platform.

How is this possible with games made for web or even desktop?

Are the chances of making money of web and desktop as big as on the mobile market?

sentences:
Undefined reference error when trying to access a component using ECS I'm trying to access the x and y values from PositionComponent in my MovementComponent but I get this error and I just can't figure out why I get this.

in my Entity class I've got a function GetComponent() that looks like this:

template<typename ComponentType>
ComponentType* Entity::GetComponent() {
    for(unsigned int i = 0; i < m_components.size(); i++) {
        if(ComponentType* cmp = dynamic_cast<ComponentType*>(m_components[i])) {
            return cmp;
        }
    }
    return NULL;
}

m_components is a vector of Component* that looks like this:

std::vector<Component*> m_components;

My MovementComponent looks like this, and I get an error for some reason here:

void MovementComponent::MoveRight() {
    m_ContainingEntity->GetComponent<PositionComponent>()->x++; //I get the error at this line.
}

Error:
undefined reference to `PositionComponent* Entity::GetComponent()'

What did I do wrong? I've got a feeling that the solution is really simple and that I just didn't pay much attention.

Entity.h:

#ifndef __ENTITY_H__
#define __ENTITY_H__

#include <vector>
#include <cstddef>

class Component;
class ECSManager;

class Entity {
public:
    void AddComponent(Component* cmp);

    template <typename ComponentType>
    ComponentType* GetComponent();

private:
    friend class ECSManager;
    std::vector<Component*> m_components;
};

#endif // __ENTITY_H__

Entity.cpp:

#include "Entity.h"
#include "Component.h"

void Entity::AddComponent(Component* cmp) {
    m_components.push_back(cmp);
    cmp->m_ContainingEntity = this;
}

template<typename ComponentType>
ComponentType* Entity::GetComponent() {
    for(unsigned int i = 0; i < m_components.size(); i++) {
        if(ComponentType* cmp = dynamic_cast<ComponentType*>(m_components[i])) {
            return cmp;
        }
    }
    return NULL;
}

MovementComponent.h:

#ifndef __MOVEMENTCOMPONENT_H__
#define __MOVEMENTCOMPONENT_H__

#include "Component.h"

class MovementComponent: public Component {
public:
    void MoveRight();
    void MoveLeft();
private:
};

#endif // __MOVEMENTCOMPONENT_H__

MovementComponent.cpp:

#include "MovementComponent.h"
#include "Entity.h"
#include "PositionComponent.h"

void MovementComponent::MoveRight() {
    m_ContainingEntity->GetComponent<PositionComponent>()->x++;
}

void MovementComponent::MoveLeft() {

}

sentences:
Why does my A* implementation overflow the stack? I'm fairly new to game dev and working on my first ever attempt at 2D pathfinding. I'm using the A* algorithm as detailed here.

For the most part, it seems to be working correctly and as intended. However upon attempting to wrap my path around a building in the map, a stack overflow is caused in ClosedList (the list storing coordinates of the path). It appears that at some point in the path, the algorithm is switching back and forth between two tiles, but I cannot work out why.

The code probably isn't the best way to do things but this is my first attempt. Apologies if it offends anyone. :P

void CheckSquare(Vector2 Start, Vector2 End)
{
    //Check for Invalid Start/End Points
    if (Start == End ||
        grid.PTileArray[(int)Start.x, (int)Start.y].CurrentType.Passable == 0 ||
        grid.PTileArray[(int)End.x, (int)End.y].CurrentType.Passable == 0)
    {
        return;
    }

    //Check which adjacent tiles are passable
    if (grid.PTileArray[(int)Start.x - 1, (int)Start.y].CurrentType.Passable == 1)
    {
        OpenList.Add(new Vector2(Start.x - 1, Start.y)); //LEFT
        gValues.Add(10);
    }
    if (grid.PTileArray[(int)Start.x - 1, (int)Start.y + 1].CurrentType.Passable == 1)
    {
        OpenList.Add(new Vector2(Start.x - 1, Start.y + 1)); //TOP LEFT
        gValues.Add(14);
    }
    if (grid.PTileArray[(int)Start.x, (int)Start.y + 1].CurrentType.Passable == 1)
    {
        OpenList.Add(new Vector2(Start.x, Start.y + 1)); //TOP
        gValues.Add(10);
    }
    if (grid.PTileArray[(int)Start.x + 1, (int)Start.y + 1].CurrentType.Passable == 1)
    {
        OpenList.Add(new Vector2(Start.x + 1, Start.y + 1)); //TOP RIGHT
        gValues.Add(14);
    }
    if (grid.PTileArray[(int)Start.x + 1, (int)Start.y].CurrentType.Passable == 1)
    {
        OpenList.Add(new Vector2(Start.x + 1, Start.y)); //RIGHT
        gValues.Add(10);
    }
    if (grid.PTileArray[(int)Start.x + 1, (int)Start.y - 1].CurrentType.Passable == 1)
    {
        OpenList.Add(new Vector2(Start.x + 1, Start.y - 1)); //BOTTOM RIGHT
        gValues.Add(14);
    }
    if (grid.PTileArray[(int)Start.x, (int)Start.y - 1].CurrentType.Passable == 1)
    {
        OpenList.Add(new Vector2(Start.x, Start.y - 1)); //BOTTOM
        gValues.Add(10);
    }
    if (grid.PTileArray[(int)Start.x - 1, (int)Start.y - 1].CurrentType.Passable == 1)
    {
        OpenList.Add(new Vector2(Start.x - 1, Start.y - 1)); //BOTTOM LEFT
        gValues.Add(14);
    }

    //Remove the parent from the Possible choices
    for (int n = 0; n < OpenList.Count; n++)
    {
        if (OpenList[n] == ClosedList[ClosedList.Count - 1])
        {
            OpenList.RemoveAt(n);
        }
    }

        //Calculate H Values
        for (int n = 0; n < OpenList.Count; n++)
        {
            float x = Mathf.Abs(End.x - OpenList[n].x);
            float y = Mathf.Abs(End.y - OpenList[n].y);
            float final = 10 * (x + y);
            hValues.Add((int)final);
        }

    //Calculate F Values
    int lowest = 10000;
    int reference = 0;
    for (int n = 0; n < OpenList.Count; n++)
    {
        int g = gValues[n];
        int h = hValues[n];
        int final = g + h;
        fValues.Add(final);
        if (fValues[n] < lowest)
        {
            lowest = fValues[n];
            reference = n;
        }
    }

    //Add the square with the lowest F Value to the closed list as part of the path
    ClosedList.Add(OpenList[reference]);

    //Clear Lists
    OpenList.Clear();
    gValues.Clear();
    hValues.Clear();
    fValues.Clear();

    //If the final Location in ClosedList is not the end then continue
    if (ClosedList[ClosedList.Count - 1] != End)
        CheckSquare(ClosedList[ClosedList.Count - 1], End);
}

Help or nudges in the right direction would be greatly appreciated.

sentences:
What is the most appropriate way to achieve synchronous Addressable asset loading? I am transitioning my project from Resources to Addressables. Some parts of my game just aren't worth doing asynchronously, and would just cause more problems - but I still want to use Addressables for its other benefits.

Anyway, it doesn't offer any synchronous methods in their API. Unity has an official repository with an example for "synchronous addressables" right here: https://github.com/Unity-Technologies/Addressables-Sample/blob/master/Advanced/Sync%20Addressables/Assets/SyncAddressables/SyncAddressables.cs

Although the code does appear to work in the few tests I've done The code below won't always work, and it doesn't make sense to me anyway. This is the relevant method:

    public static TObject LoadAsset<TObject>(object key)
    {
        if(!s_Initialized)
            throw new Exception("Whoa there friend!  We haven't init'd yet!");

        var op = Addressables.LoadAssetAsync<TObject>(key);

        if(!op.IsDone)
            throw new Exception("Sync LoadAsset failed to load in a sync way! " + key);

        if (op.Result == null)
        {
            var message = "Sync LoadAsset has null result " + key;
            if (op.OperationException != null)
                message += " Exception: " + op.OperationException;

            throw new Exception(message);
        }

        return op.Result;
    }

It will throw an exception if the asset didn't manage to load instantly (the !op.isDone part). Sure, that's technically synchronous, but it seems to ignore the elephant in the room: if the asset is large I would expect it to need a bit more time (i.e. freeze the game), which is fine for my current needs - but instead, the game will just end up crashing because it couldn't load immediately.

What is the most appropriate way to achieve synchronous Addressable asset loading?

sentences:
Can I use unlicensed art to develop and raise money for my game? I've been developing a prototype for a game that has been made with art that I have neither paid for or asked for permission to use. Naturally once I move towards selling or distributing my ad-supported game, I'll need to replace the art with its licensed equivalent, or pay for my own.

This is generally how game engines work, with you using an unlicensed copy until you release and start to make money off of it, so I thought maybe it would be the same in the game art world.

Can I legally develop and say, start a kickstarter, using a game with unlicensed art?

sentences:
Difference between "texture" vs "texture2d" in OpenGL ES? I see many example in shadertoy use texture, but in the cocos2d-x, only texture2d.

Does texture use normalized coordinate and texture2d doesn't?
Because when I use texture2d, it returns wrong result.

sentences:
how to stop camera at the end of world map when zoomed in Im building a tile-based game, and Im trying to implement zooming in on the center of the screen.
My problem is, when I get to the edge of the map and im zoomed in, Im noticing that my camera doesn't scroll all the way to the very last tile when zoomed in. If my zoom scale value is 1(not zoomed in), the camera moves to the last edge of the tile map just fine.

I have a feeling my matrix math is wrong, and I should be setting the position of the camera differently. It could also be that my tile map edge checking is incorrect. I currently limit the user to zoom in by a factor of 2 at maximum

Heres my code:

public class CameraPositionComponent : PositionComponent
{
    private Vector2 mOrigin;
    private Viewport mViewport;
    private Matrix mMatrix;
    private float mZoom;

    public CameraPositionComponent(int x, int y, Viewport viewport, Entity owner) :   base(x, y, owner)
    {
        mZoom = 1.0f;
        mViewport = viewport;
        mPosition = new Vector2(viewport.Width / 2, viewport.Height / 2);
        mOrigin = new Vector2(viewport.Width / 2, viewport.Height / 2);
        mMatrix = Matrix.CreateTranslation(1, 1, 1);
    }

    public Matrix Matrix
    {
        get { return mMatrix; }
        set { mMatrix = value; }
    }

    public float Zoom
    {
        get { return mZoom; }
        set { mZoom = value; }
    }

    public Vector2 Origin
    {
        get { return mOrigin; }
        set { mOrigin = value; }
    }

    public Viewport Viewport
    {
        get { return mViewport; }
    }
}

public class CameraTouchComponent : TouchComponent
{

    public CameraTouchComponent(Entity owner) : base(owner)
    {

    }

    public override void Update()
    {
        GameTime gameTime = ServiceLocator.GetService<GameTime>();
        Camera camera = mOwner as Camera;
        CameraPositionComponent positionComponent = camera.PositionComponent;

       /////input handling here
      ////zoom/drag etc..

        if (positionComponent.Position.X < positionComponent.Viewport.Width / 2)
            positionComponent.Position = new Vector2((positionComponent.Viewport.Width / 2), positionComponent.Position.Y);
        if (positionComponent.Position.Y < positionComponent.Viewport.Height / 2)
            positionComponent.Position = new Vector2(positionComponent.Position.X, positionComponent.Viewport.Height / 2);
        if (positionComponent.Position.X + positionComponent.Viewport.Width/2 > TileMap.Width)
            positionComponent.Position = new Vector2(TileMap.Width - positionComponent.Viewport.Width/2,
                positionComponent.Position.Y);
        if (positionComponent.Position.Y + positionComponent.Viewport.Height / 2 > TileMap.Height)
            positionComponent.Position = new Vector2(positionComponent.Position.X,  TileMap.Height - positionComponent.Viewport.Height / 2);
        //positionComponent.Origin = new Vector2((positionComponent.Viewport.Width / 2) / positionComponent.Zoom, (positionComponent.Viewport.Height / 2) / positionComponent.Zoom);

        Layer layer = LayerManager.GetLayerOfEntity(mOwner);
        layer.Matrix =  Matrix.CreateTranslation(new Vector3(-positionComponent.Position, 0)) *
                  Matrix.CreateScale(positionComponent.Zoom, positionComponent.Zoom, 1) *
                   Matrix.CreateTranslation(positionComponent.Origin.X, positionComponent.Origin.Y, 0); ;

    }
}

All the bounds checking stuff seems wrong to me as well.

sentences:
Unity - Set quad to angle of floor mesh I have a cursor object (simple quad) that I'm moving around above a floor mesh. The floor mesh has varying heights (hills and such).
How can I set my quad to sit at the same angle as the mesh floor?
I'm using a raycast to cast down on the position of the cursor and get the angle of the floor mesh using hit.normal, then reflect.
RaycastHit hit;
var rayStart = new Vector3(transform.position.x, transform.position.y + 5f, transform.position.z);
if (Physics.Raycast(rayStart, Vector3.down, out hit, 10f)) {
    if (hit.collider.tag == "Floor") {
        Vector3 incomingVec = hit.point - rayStart;
        Vector3 reflectVec = Vector3.Reflect(incomingVec, hit.normal);
        cursorSprite.transform.eulerAngles = reflectVec;
        }
    }

(I've left out the position code, that works, its just the angle code that doesnt)
I've tried a bunch of variations, altering the reflectVec angle x, y and z but I can't figure out how to get it correct :/

sentences:
Libgdx inputlistener scrolled is not working I am currently using libgdx. Below codes are added to a stage.

this.addListener(new InputListener() {
        public boolean touchDown (InputEvent event, float x, float y, int pointer, int button) {
            System.out.println("down");
            return true;
        }

        public void touchUp (InputEvent event, float x, float y, int pointer, int button) {
            System.out.println("up");
        }
        public void touchDragged(InputEvent event, float x, float y , int pointer) {
            System.out.println("dragged");
            zoom(0.01f);
        }
        public boolean scrolled(InputEvent event,
                    float x,
                    float y,
                    int amount) {
            System.out.println("scrolled");
            zoom(0.01f);
            return true;
        }

everything is working just fine (touchUp touchDragged Touchdown) except scrolled. Can someone tell me what is the reason?

-edited for reply comment and answer-
On screen class outside stage, I think I already added like screen.set input processor(stage). So touch dragged is working properly and print message 'dragged' and zoom is working. But when I scroll, message 'scrolled' is not printed and zoom function is not called I think. Thank you for comment and answer

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:
How to test for BoxCollider2D intersection in Unity? I have a Player object with a BoxCollider2D component and a Ladder object also with a BoxCollider2D component. Each object has a script, and in each script, I set up references to the box colliders in the normal way.

public BoxCollider2D box_collider;

void Start ()
{
    box_collider = GetComponent<BoxCollider2D>();
}

My player script is called "PlayerController", so that's the class defined in the script.

In my Ladder's script I have the following:

void Update ()
{
    GameObject player = GameObject.Find("Player");
    PlayerController player_controller = player.GetComponent<PlayerController>();
    if (player_controller.box_collider.bounds.Intersects (box_collider.bounds))
        Debug.Log ("collision");
    else
        Debug.Log ("no collision");

}

This script invariably returns "no collision" and I'm not sure why.

Any ideas?

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:
Why are .anims so big? I am in the process of recording dialogue via FaceCapX and an animation recorder script that checks for changes between frames and if there is one it saves the value of 52 blend shapes, as well as head transform rotation and position.
To my limited understanding, the file should be containing something like (int) frame + (double) blend shape value per frame.? Which would lead to something like:
in byte:
4 + (8 * 52 blend shapes) * 60 frames per second * 60 seconds = 1,497 MB per minute.
Anyway, I end up with 18 MB for roughly 15 seconds of recording.
What is missing in my calculation?
Is there a bug in unity .anims?

sentences:
Playerbody is turning, but not moving in direction turned So, I have a simple WASD script, and I've added a part so when Mouse X is moved, the playerBody (character) rotates in that direction, so, when W is pressed (to go forward) the player does not move in the direction turned, but it moves in the same direction. Although the playerBody has turned, the player still moves in the same direction.... why?
using UnityEngine;
using System.Collections;

// This script moves the character controller forward
// and sideways based on the arrow keys.
// It also jumps when pressing space.
// Make sure to attach a character controller to the same game object.
// It is recommended that you make only one call to Move or SimpleMove per frame.

public class Move : MonoBehaviour
{
    CharacterController characterController;

    public float speed = 6.0f;
    public float jumpSpeed = 8.0f;
    public float gravity = 20.0f;
    public Transform charBody;
    private Vector3 moveDirection = Vector3.zero;

    void Start()
    {
        characterController = GetComponent<CharacterController>();
    }

    void Update()
    {
        if (characterController.isGrounded)
        {
            // We are grounded, so recalculate
            // move direction directly from axes

            moveDirection = new Vector3(Input.GetAxis("Horizontal"), 0.0f, Input.GetAxis("Vertical"));
            moveDirection *= speed;

            if (Input.GetButton("Jump"))
            {
                moveDirection.y = jumpSpeed;
            }
        }

        // Apply gravity. Gravity is multiplied by deltaTime twice (once here, and once below
        // when the moveDirection is multiplied by deltaTime). This is because gravity should be applied
        // as an acceleration (ms^-2)
        moveDirection.y -= gravity * Time.deltaTime;

        // Move the controller
        characterController.Move(moveDirection * Time.deltaTime);

        float MOUSEY = Input.GetAxis("Mouse Y") * speed * Time.deltaTime;
        float MOUSEX = Input.GetAxis("Mouse X") * speed * Time.deltaTime;

        charBody.Rotate(Vector3.up * MOUSEX);

    }
}

Thanks

sentences:
How do I keep an MMO synchronized? I'm making a 2D, top down MMO game. ATM I can connect a player to a server and they get the map data from a DB. They can move around and hit some stuff and if they move near a viewport edge, the server sends new data etc.

Even a few players can do this, but since I don't have an, lets call it, "update manager" which tells the players where they are and the DB that the map has been altered. It's just a read only game at the moment.

My idea is, to tell the server where a player is and how big his viewport is. Then if any other player is in this viewport, the server will distribute the updates to each other player.

So I wouldn't have to tell the whole world what's going on.

The problem, however, is the ping.

If I have a ping of ~300ms, every other player would probably "jump" over the map, and not move smoothly. I could keep this synchronized with vector clocks, but it would still lag.

Also, how to keep the players from cheating? All ideas I got, don't really work. The only "safe" thing seems to be to calculate the game on the server and client, then throw away all data when the calculations are wrong. But this seems rather excessive to me.

--- Edit ---

Ok, I had some ideas after I read the comments.

I will send an absolute state to the server for ever game entity I have. This state object will consist  of the position, orientation, speed and an "action", which can be anything someone can do.
I'm gonna keep the clients seperated in "small" arrays, each representing a area of the map. So I can calculate which client is near or in my viewport and needs to get my information.
I have to find out if it's possible to get a timestamp of the request, to use it for sanity checking, so no player can send me actions from an invalid time-range to get his actions evaluated before the other players.
Only only updates from other clients and errors from the server get sent to the client, if everything is ok the server just takes the informations.

sentences:
What types of matrices are needed for game and graphics programming? I am writing a 3D math library for general game development and want to know what type of matrix classes I should include. Is just a 4x4 matrix enough, or must I provide 3x4 and dedicated rotational matrices?

According to this

  In order to use the vector registers of modern CPUs (SSE, Altivec, SPUs) you have to pass 4x 32 bit floats anyway (its a 128 bit register), plus you have to take care of the alignment, usually 16 bytes. So you don't have the chance to safe the space for the 4th component anyway.

and from Game Engine Architecture

  The rightmost column of an aﬃ ne 4 × 4 matrix always contains the
  vector  [ 0 0 0 1 ]T . As such, game programmers oft en omit the
  fourth column to  save memory. You’ll encounter 4 × 3 aﬃne matrices
  frequently in game math  libraries.

Since 4x3 matrices are just created for convenience and since you need 128 bits to use the vector register, would it be best to just have a single 4x4 matrix class handle all needed matrix operations?

sentences:
Per pixel normal mapping resulting in static on normals starting on Z axis For the past week I've been trying to implement bump mapping in DirectX 11 using the Frank Luna's '3D Game Programming with DirectX 11' book. I got it working until I tried to add a flat 2D plane facing in the -Z axis and the texture appeared distorted. After a while I found out it was the bumped normals that were causing it.

I've used Terathon to calculate tangents after generating a mesh.

My code is as follows:

void AddTangentToVertexArray(const UINT vertexCount, const UINT indexCount, PackedVertex* vertices, const WORD* indices)
    {
        const UINT triangleCount = indexCount/ 3;

        XMVECTOR* tan1 = new XMVECTOR[indexCount* 2];
        XMVECTOR* tan2 = tan1 + indexCount;
        ZeroMemory(tan1, indexCount* sizeof(XMVECTOR) * 2);

        for (UINT a = 0; a < indexCount; a++)
        {
            WORD i1 = indices[(a * 3)];
            WORD i2 = indices[(a * 3)+1];
            WORD i3 = indices[(a * 3)+2];

            const XMFLOAT3& v1 = vertices[i1].vertex;
            const XMFLOAT3& v2 = vertices[i2].vertex;
            const XMFLOAT3& v3 = vertices[i3].vertex;

            const XMFLOAT2& w1 = vertices[i1].uv;
            const XMFLOAT2& w2 = vertices[i2].uv;
            const XMFLOAT2& w3 = vertices[i3].uv;

            FLOAT x1 = v2.x - v1.x;
            FLOAT x2 = v3.x - v1.x;
            FLOAT y1 = v2.y - v1.y;
            FLOAT y2 = v3.y - v1.y;
            FLOAT z1 = v2.z - v1.z;
            FLOAT z2 = v3.z - v1.z;

            FLOAT s1 = w2.x - w1.x;
            FLOAT s2 = w3.x - w1.x;
            FLOAT t1 = w2.y - w1.y;
            FLOAT t2 = w3.y - w1.y;

            FLOAT r = 1.0f / (s1 * t2 - s2 * t1);
            XMVECTOR sdir{ (t2 * x1 - t1 * x2) * r, (t2 * y1 - t1 * y2) * r,
                (t2 * z1 - t1 * z2) * r };
            XMVECTOR tdir{ (s1 * x2 - s2 * x1) * r, (s1 * y2 - s2 * y1) *r,
                (s1 * z2 - s2 * z1) * r };

            tan1[i1] += sdir;
            tan1[i2] += sdir;
            tan1[i3] += sdir;

            tan2[i1] += tdir;
            tan2[i2] += tdir;
            tan2[i3] += tdir;
        }

        for (UINT a = 0; a < vertexCount; a++)
        {
            const XMVECTOR& n = XMLoadFloat3(&vertices[a].normal);
            const XMVECTOR& t = tan1[a];

            XMStoreFloat4(&vertices[a].tangent, XMVector3Normalize((t - n * XMVector3Dot(n, t))));

            vertices[a].tangent.w = (XMVector3Less(XMVector3Dot(XMVector3Cross(n, t), tan2[a]), XMVECTOR{ 0.0f, 0.0f, 0.0f, 0.0f })) ? -1.0f : 1.0f;
        }

        delete[] tan1;
    }

And I used Frank Luna's implementation to use those tangents to calculate the bitangent but in the the newer version of directX 11

float3 NormalSampleToWorldSpace(float3 normalMapSample, float3 NormalW, float4 TangentW)
{
    float3 NormalT = 2.0f*normalMapSample - 1.0f;
    float3 N = normalize(NormalW);
    float3 T = normalize(TangentW - dot(TangentW, N)*N);
    float3 B = cross(N, T) *TangentW.w;

    float3x3 TBN = float3x3(T, B, N);

    float3 bumpedNormalW = mul(NormalT, TBN);

    return normalize(bumpedNormalW);
}

EDIT: After a couple hours of debugging I've found that changing the T calculation to float3 T = normalize(TangentW - dot(TangentW, N));// *N); seems to have stopped any distortions. If someone can confirm that this isn't going to cause later issues I'm willing to say it's solved.

All surfaces are using the same normal map in the following gifs.

A visual example of what happens to normals facing down and up the Z axis

Here is the same plane but rotated 90 degrees

A visual example of a sphere that isn't affected by the distortion due to what i can only assume is having no normals along the Z axis

My guess is that something is wrong within the tangent calculator as the error persists when the plane is rotated, but I cannot seem to find anything different to the version on Terathon.

If there's anything else that you need to tackle the problem just let me know and I can supply it.

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

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

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

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

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

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

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

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

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

Thanks!

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:
Gameobject-Component model with many background tiles - long iteration time So I'm making a game engine for a game I'm making - the game is a 2D tile-based game

I've implemented a gameobject-component style for the engine, for decoupling reasons

However, every frame, the engine iterates through every gameobject, and calls the update method of every component on that gameobject - as it's a tile-based game, every tile is a gameobject, which means that that update loop could go through several thousand gameobjects every frame. Add into that the fact that each gameobject could have multiple components (transform component containing location/rotation info, renderer component, collider component etc), and a hell of a lot of time is spent in that loop. This is only magnified by the fact that the game is a mobile game, and as such the processing power isn't as great as on a desktop

Any ideas on algorithms/programming styles/design styles that would help to minimise this performance sinkhole please?

sentences:
Simulate camera movement in two dimensions (OpenGL) I've been told by the folks over at Stack Overflow that there's no way to move the camera in OpenGL. I'm developing a 2D RPG with LWJGL and need to know the proper way to simulate camera movement as though it is "following" my player. Remember, this game is in two dimensions, so rotation of the world is not a problem here.

And another, related question: If camera movement simulation involves moving the world and not the player, how would it be possible to ever implement multiplayer? I'm a bit of a noob at OpenGL, but I see it used in a handful of popular multiplayer Java games, and can't get my head around the concept of being unable to move the perspective (and thus being forced to move the world) and not having players interfere with each other's movement.

sentences:
Unity built app crashes when using particle system I have scenes with some basic flame effect. Its max particle count is 20 and there are not more than 4-5 instances active on the screen at once. I even checked the profiler but the memory usage was around 150 MB maximum.

Given these, all runs fine in the editor but once the particles become visible, the game crashes every time. I tested this on a virtual Nexus tablet.
I'm using Unity 2017.1.0p4. If anyone has encountered an issue like this, I'd appreciate any help to get around this.

EDIT: the built game crashes on PC as well (made a final build for PC, using the same PC).

EDIT2:

So I was able to trace the issue back to the few following lines:

var mf = transform.parent.gameObject.GetComponentFromParentRecursive<MeshFilter>();

if (mf != null && mf.mesh != null)
{
    var sh2 = system.shape;
    sh2.mesh = mf.mesh;
    return;
}

public static class GetComponentRecursive
{
    /// <summary>
    /// Returns the first Component (T) found on the parent or its children
    /// = the gameobjects on the same level as this is called on.
    /// </summary>
    /// <typeparam name="T"></typeparam>
    /// <param name="g"></param>
    /// <returns></returns>
    public static T GetComponentFromParentRecursive<T>(this GameObject g)
        where T : Component
    {
        if(g.transform.parent.GetComponent<T>() != null)
        {
            return g.transform.parent.GetComponent<T>();
        }
        else
        {
            foreach (Transform c in g.transform.parent.transform)
            {
                if(c.GetComponent<T>() != null)
                {
                    return c.GetComponent<T>();
                }
            }
        }
        return null;
    }
}

Please bear in mind that GetComponentFromParentRecursive works, can use it for sprites, no harm done. When I comment out the first few lines, it doesn't crash(just lost functionality).

Any ideas why this might cause a crash? And only in built game?

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:
What should the Z coordinate be after transformed by the projection matrix? I'm working on an OpenGL 1.x implementation for the Sega Dreamcast. Because the Dreamcast didn't have any hardware T&L the entire vertex transformation pipeline has to be done in software.

What also has to be done in software is clipping to the near-Z plane as failure to clip results in the polygon being dropped entirely from rendering by the hardware.

I'm having some trouble getting the transform -> clip -> perspective divide process working correctly and basically I can sum up the problem as follows:

I transform polygon vertices by the modelview and projection matrices
I clip each polygon against the W = 0.000001 plane
This results in new vertices on the near plane with a W of 0.000001, but a Z which is twice the near plane distance
At perspective divide vertex.z /= vertex.w results in an extreme value because we're dividing a Z value (e.g. 0.2) by 0.000001

Something seems very wrong here. The projection matrix is being generated in the same way as described in the glFrustum docs.

So my question is, if I have a coordinate on the near plane, should its Z value be zero after transform by the projection matrix or should it be the near-z distance, or something else?

After clipping polygons to the W = 0.000001 plane, should the generated Z coordinates be -0.000001?

Update:

Here is the projection matrix as calculated by: gluPerspective(45.0f, 640.0f / 480.0f, 0.44f, 100.0f);

1.810660 0.000000 0.000000 0.000000
0.000000 2.414213 0.000000 0.000000
0.000000 0.000000 -1.008839 -0.883889
0.000000 0.000000 -1.000000 0.000000

Does this look correct? It's the value in the right-hand column I'm not sure about...

sentences:
2D Animation based on Time.deltaTime has problems when the game performs long operations I animate my 2D sprite using the Update() method:

float timer = 0.0f;
float delayPerFrame = 0.04f;

void Update() {
    timer += Time.deltaTime;
    if (timer >= delayPerFrame) {
        timer = 0;
        // Logic to display the next frame
    }
}

As you can see, it is pretty simple: every 0.04 seconds the next frame will be set.

But sometimes, my game needs to do some exhausting processing (like loading large scenes and whatnot), which causes a tiny little lag in the game. When this happens, my sprite begins with a wild, fast animation. Then eventually it resumes at a normal pace.

I imagine this is because the lag caused the Time.deltaTime value to skyrocket for a period of time. I am also under the impression that Update() is called too often during such period (although that shouldn't matter).

I don't want to use existing animation features of Unity. My game is already built under this particular piece of logic, so I'd like to fix it.

Using FixedUpdate() doesn't help. I can also confirm that Time.deltaTime does indeed peak at the beginning.

Note that this occurs only after doing an exhaustive operation. If you spawn a sprite of these in the middle of the game, everything will go smoothly. But if you spawn them immediately after doing something like loading a large scene, then they will have some sort of boost at the beginning.

sentences:
OpenGL Texture Zig-Zag Artifacts Over Time I'm working on a deferred shading renderer in OpenGL, where I write all geometry output to Colour, Normal and Depth textures and then apply lighting effects later.

Everything seems fine except once every few weeks, constant zigzag-like patterns appear past a certain depth (below the player's knees in the screenshot below). These zigzag patterns are at the same screen coordinates regardless of my pitch and yaw in the game:

I'm not sure what information to provide to resolve this issue, as it seems to me like a GPU error. Each zigzag square is 16x16 pixels, which could be the warp size on my NVIDIA GTX 960. Restarting the program resolves the problem and it doesn't happen again for a few weeks.

My guess is that sections of the fragment shader are failing to write to multiple render targets as I see the same pattern on the Colour, Normal and Depth textures.

The blue colour you can see on the left side of the zigzag pattern is the water at the bottom of the map, which is rendered after the post-processing stage and does not have these artifacts.

Any help with this would be greatly appreciated.

sentences:
How can I edit multiple sprites in Sprite Editor at once? I have 100 sprites in one atlas. I want to edit some of them with same values.

For example, I want to edit sprite's position no 1 ~ 30. Do I have to edit them one by one?

Is there any function like Shift + drag for selecting several sprites?

sentences:
Should widgets be part of a scene in a 2D game? I'm in the middle of separating logic and drawing of a 2D game, i.e. I'm moving from scenes/entities that draw themselves to scenes/entities that merely store and update data, getting drawn by a renderer.

This works pretty well for scenes and entities, but I can't figure out how the UI fits in. Right now, I draw widgets in the draw routines of some scenes. Scenes can currently also handle input, so it's relatively close to how UI toolkits do things. There are even scenes with nothing but UI, e.g. the main menu. But with the new approach where scenes don't draw themselves anymore, I need a new approach.

How could I do this? Are widgets even supposed to live in scenes, alongside entities? Or should they be in their own kind of scene, e.g. windows or dialogs?

sentences:
How could I improve this random map? following my previous post on random world map generation, I used several algorithms and obtained results similar to this: http://i.imgur.com/CKL2R.png (the height values are quantisied for viewing but they go from 1 to 500 before quantisation).
Now I am trying to improve the "lakes", as you can see, the water bodies that are inside the map are always at 0 altitude, which means that every lake would be at the ocean level.
I am willing to keep these "ocean-level lakes" (or remove them), but I would like suggestion on how to create from this heightmap real lakes that would be possibly at any height, while keeping most of the altitude structure (ie mountains positions, etc)

thanks

sentences:
How to avoid a boring late game in strategy games while still keeping victories satisfying? A common thing I've noticed in strategy games (of all types, 4X, RTS, MOBA, etc.) is that most games eventually get to a point where it is fairly clear who is going to win, and the rest of the game just becomes playing out the motions, and if the winning player/team doesn't make a major misstep, they will win.

This is just kind of the nature of strategy games. They inherently have a "snowball" effect. The gameplay is all about setting yourself up for success over your opponents in the future, and whoever does this better in the earlier stages of the game should win in the later stages. This happens in every strategy game to some extent, even the most classic. In Chess, it becomes increasingly harder to win if your opponent takes more and more of your pieces and forces your remaining pieces into tough situations.

As I said, this is just a fundamental part of the genre, so I'd hesitate to call it a problem. However, on occasion, in these types of games, you have matches where no player/team gains a significant advantage early, and the game comes down to the last turn. In my opinion, these are the most exciting and interesting matches you can have. Furthermore, when this doesn't happen, the late stages of the game can feel very boring for everyone involved, where the winning player is just awaiting their inevitable victory, and the losing player their inevitable demise (this can be especially unfun for the losing player, as they probably have very few options, and it is just really unlikely that they are having a good time).

So it would be cool if we could design a strategy game that avoids consistently falling into this state, right? Well, I have seen a handful of games like this, where a losing player consistently has avenues to victory, no matter how far behind they are. The issue with this is that if an upset happens (say one player was dominating the whole game, and then a losing player makes one good play at the end of the game to win), that victory can feel very unsatisfying for the winning player, as they may feel they didn't deserve it. Similar, the player who was winning most of the game may be very unhappy, as they may feel like victory was robbed from them, and they didn't deserve to lose. So essentially, no one is happy with the result. This approach may also make the early game less fun, as players may feel like it just doesn't matter.

So is it possible to design a strategy game that avoids both of these issues? A game where we don't consistently fall into a boring lategame with a forgone conclusion, and yet also keep victories feeling satisfying and deserved? Or are these issues far too fundamental to strategy gameplay to overcome?

If this question is too vague on its own, then we can focus on 4X strategy games, as those are the games I have experience with, and that I am interested in designing.

sentences:
Matrix in constant buffer on the GPU contains NaNs but not on the CPU I've got a shader with the following constant buffer:

cbuffer ShaderParameters
{
    matrix inverseViewProjectionMatrix;
    float4 cameraPosition;
};

When using Visual Studio 2012's graphic debugger I see that the last column of this matrix contains only NaNs, the other values are correct. So somehow my program is passing wrong values to the GPU.

However when I debugged my C++ code I see no NaNs in the matrix that I upload to the GPU. So what is going on? Below are the relevant parts of code

Struct for the constant buffer on the CPU:

struct ShaderParameters
{
    XMMATRIX inverseViewProjectionMatrix;
    XMFLOAT4 cameraPosition;
};

Buffer creation:

D3D11_BUFFER_DESC shaderParametersDesc;
shaderParametersDesc.BindFlags = D3D11_BIND_CONSTANT_BUFFER;
shaderParametersDesc.ByteWidth = sizeof(ShaderParameters);
shaderParametersDesc.CPUAccessFlags = D3D11_CPU_ACCESS_WRITE;
shaderParametersDesc.MiscFlags = 0;
shaderParametersDesc.StructureByteStride = 0;
device->CreateBuffer(&shaderParametersDesc, NULL, &m_shaderParameters);

Buffer setting (every frame)

D3D11_MAPPED_SUBRESOURCE mappedResource;
ShaderParameters* shaderParameters;
deviceContext->Map(m_shaderParameters, 0, D3D11_MAP_WRITE_DISCARD, 0, &mappedResource);
shaderParameters = (ShaderParameters*)mappedResource.pData;

XMMATRIX view = camera->GetViewMatrix();
XMMATRIX proj = camera->GetProjectionMatrix();
XMMATRIX mult = XMMatrixMultiply(view, proj);
XMMATRIX invp = XMMatrixInverse(nullptr, mult);

if(XMMatrixIsNaN(invp))
    throw std::exception("invp is NAN");

shaderParameters->inverseViewProjectionMatrix = XMMatrixTranspose(invp);
shaderParameters->cameraPosition = camera->GetPosition();

deviceContext->Unmap(m_shaderParameters, 0);
deviceContext->VSSetConstantBuffers(0, 1, &m_shaderParameters);

Note that the exception is never thrown and if I inspect the matrix manually there are sane values in there (see image)

EDIT: some asked (via twitter) to include some more shader source code as unused values might be seen by the debugger as NaN. So here is the complete vertex shader:

cbuffer ShaderParameters
{
    matrix inverseViewProjectionMatrix;
    float4 cameraPosition;
};

struct VertexInputType
{
    float4 position : POSITION;
    float4 uv       : TEXCOORD0;
};

struct PixelInputType
{
    float4 position         : SV_POSITION;
    float4 direction        : TEXCOORD0;
    float4 cameraPosition   : TEXCOORD1;
};

PixelInputType main(VertexInputType input)
{
        PixelInputType output;

        input.position.w = 1.0f;
        output.position = input.position;

        output.direction = mul(input.position, inverseViewProjectionMatrix) - cameraPosition;
        output.direction.xyz = normalize(output.direction.xyz);

        output.direction.w = 1.0f;

        output.cameraPosition = cameraPosition;

        return output;
}

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:
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:
How do I pause Andengine, but still get input? In my game when I pause the game, I'd like to display three options (Resume, Restart and Menu) so I did this after calling mEngine.stop():

Sprite resume = new Sprite(CAMERA_WIDTH/2, CAMERA_HEIGHT/2, RM.resume, vertex){
            @Override
            public boolean onAreaTouched(TouchEvent event, float pTouchAreaLocalX, float pTouchAreaLocalY) {
                if(event.isActionDown()){
                    this.setScale(1.1f);
                    Log.i("Click","Click");

                }

                return super.onAreaTouched(event, pTouchAreaLocalX, pTouchAreaLocalY);
            }
        };

But the Log "Click" never display. So I tried to do this with the Engine active and the Log displays correctly.

How can I stop my game (Modifier, Physics, Score) without using the mEngine.stop() method ?

sentences:
unity animation not starting I have written the following code:

public class TargetAnimation : MonoBehaviour {
    Animation anim;
    public AnimationClip Open;
    // Use this for initialization
    void Start () {
        anim = GetComponent<Animation>();
        anim.AddClip (Open, "Open");
        anim.Play ("Open");

    }
}

I have the following script and animation settings:

I have put the animation type in legacy and the generation as store in root (Depricated)
as suggested elsewhere, this did not work.
The animation works in the import/annimations view.
The origenal comes from blender. And all f this is in unity 5.

sentences:
How to interop between DirectX11 in C++ with XAML&C# or should I turn to SharpXD I'm writing a UWP program and I want to write the general UI in C#. But there would be some graphic demonstrations using DirectX on some SwapChainPanels in the app. I have found less than enough documents of how I can interop between these two parts in two languages. And problem occurs such as how I should instance a C++ class from another project from C#.
I might need a frequent calling between the two part for the demonstration(It's actually a scatter plot). And some suggested that this could cause a great performance damage.
So should I turn to SharpXD? And what should I do if I don't.
Thank you.

sentences:
Java or Flash for MMO Game? I hope this question hasn't been asked before.

I'm thinking of creating an MMO game, perhaps for Facebook. I've investigated the options of using Java or Flash/Flex. But I'm still not sure which to go with. Does anyone have any advice on which language to use?

Which language has more open source or free tools/libraries? Which one has better performance for a database transaction-heavy game?

A few notes:
I'm intending it to be a 2D, isometric game with cartoony graphics. Nothing necessarily intense on the graphics front. I've heard of JMonkeyEngine, but that's 3D. The only other thing I've found that's good for 2D is LWJGL. One thing I don't like about Flash/Flex is that it can't create a direct connection to the database. Is that also true for a Java-based game?

Essentially, I would like to know how to approach the development of an MMO. What tools/libraries should I use? I'm hoping that there are open source/free options.

Thank you for your time.

sentences:
Elegantly transition from 4-grid to 6-grid and back I find in general map creation that I prefer hex grids for natural environments, but square grids for interior and urban/constructed environments.
Is there a smooth or elegant way to transition between these that doesn't require a scene break? Most importantly, is there an intuitive way?
As long as they don't differ too vastly, the ratio of sizes between the two cell types is largely irrelevant to me. I'd also happily use several rows of transitional tiles if their borders can be procedurally determined. I also have no inherent preference for up-point or side-point hexes...
I'd show some things I've already tried, but they are genuinely all varieties of the same eldritch mess...

sentences:
JavaFX AnimationTimer VS Swing Game Loop After looking at some code sources out there I noticed Java Swing Games usually create a class implementing Runnable, create a new Thread and set up the game loop in the run() call.

But JavaFX games seem to simply extend from Application and run the game loop in a  new AnimationTimer() { ... public void handle() ... }

What gives?

sentences:
Objects are stumbling in place continuously. How to fix that? I have a nasty problem with my physics engine. Objects sometimes just jump in place, or roll left and right.

Main game loop works in that manner:

Every living object is updated (it changes velocity, the logic is different for each object)
Engine computes collisions using objects' positions and velocities and resolves them.

Imagine that we have a grenade positioned at one pixel above ground, with zero speed, and the gravity is 1 px/tick^2. Normal bounce coefficient is 0.5, so an object will bounce with half speed.

According to the algorithm:

Object's controller adds gravity to its velocity, so now v = -1.
Engine moves object to y = 0, no collisions happen.
Velocity is changed to -2 by the controller.
Engine tries to move the object, the collision happens immediately, v is set to 1, and object moves to y = 1.
Velocity is changed to 0 by the controller.
The object remains in place.

Initial conditions has reproduced. The object will bounce forever with a period of 3 ticks. These situations vary, but they all are caused by discrete nature of the engine described above.

This bug was in every version of my game. Objects may vary in shape and size, and the terrain is destructible Worms-like. I use my own engine that uses swept collision detection customized to work with small and fast objects, never letting them go through impassable object unless they were spawned inside, and the only acceptable option for me is to modify it.

One thing that I have in mind that I can detect if object had very low speed for some time, make it "immobile" and call different controller functions depending on "immobile" flag. It's an ugly solution though, because the complexity of my logic will increase. Also, when a round object stands on two points and we remove one, it will not fall. So this approach is wrong at all I guess.

What is the right approach to fix that?

sentences:
Keeping track of focused widget in GUI tree I'm designing a GUI framework based on trees of widgets.  Widgets are general control and container structures that are everything from panels to buttons to file dialogs.  Widgets have an array of child widgets; a button contains a label and maybe an icon.  Widgets are fed input events where the widget first does its own logic with the event then passes it on to its children.  The application feeds input events to a single root widget, which can be anything from a single button in the middle of the screen to a full control window.

I need a way to handle which widget(s) receives keyboard events.  I've decided that one of the widgets in a given widget tree would be the focused widget.  Widgets would have a gainFocus method and a loseFocus method, which would be used in response to mouse click events or manually by the application.  It's unlikely I'll implement tabbing.  When one widget gains focus, any existing focused widget would naturally lose focus.

I still want each ancestor of the focused widget to see a given keyboard event in turn before it's given to the focused widget itself.  So if I have a panel with a text box in it, the panel would see the event before the text box does.  Therefore I really need to keep track of the chain of widgets from the root widget to the focused widget.  I also need to maintain data integrity when I change focus so that all widgets in a tree can correctly tell whether or not they're the focused widget or an ancestor of the focused widget.

I've so far come up with giving widgets a hasFocus boolean and a focusedChildIndex integer.  hasFocus would be set to true when the widget has focus.  focusedChildIndex would be set to the index of the focused child in its child array, which could be the focused widget itself or the next widget in the chain leading to the focused widget, or -1 to indicate that there's no focused child.  Setting these variables when one widget in the tree gets its gainFocus or loseFocus method invoked is something I'm stumped on though.

Edit

So we're clear, this is what I think my widget class will be like:

class Widget
    private Widget parent
    private Array<Widget> children

    // Methods for getters, adding widgets to widget trees, etc.
    ...

    public void mouseClick(int x, int y)
        doMouseClickEvent(x, y)
        for c in children
            c.mouseClick(int x, int y)

As you can see in mouseClick the widget sees the event before its children does.  I want keyboard inputs to work the same way, except this time I want to only have a single chain from the root to the focused widget to see the event.  Plus I need to make sure that when one widget gains focus the currently focused widget in the tree loses focus.

sentences:
How to implement a simple bullet trajectory I searched and searched and although it's a fair simple question, I don't find the proper answer but general ideas (which I already have).

I have a top-down game and I want to implement a gun which shoots bullets that follow a simple path (no physics nor change of trajectory, just go from A to B thing).

a: vector of the position of the gun/player.
b: vector of the mouse position (cross-hair).
w: the vector of the bullet's trajectory.

So, w=b-a. And the position of the bullet = [x=x0+speedtimenormalized w.x , y=y0+speed*time * normalized w.y].

I have the constructor:

public Shot(int shipX, int shipY, int mouseX, int mouseY) {
//I get mouse with Gdx.input.getX()/getY()
...

  this.shotTime = TimeUtils.millis();

  this.posX = shipX;
  this.posY = shipY;

  //I used aVector = aVector.nor() here before but for some reason didn't work
  float tmp = (float) (Math.pow(mouseX-shipX, 2) + Math.pow(mouseY-shipY, 2));
  tmp = (float) Math.sqrt(Math.abs(tmp));

  this.vecX = (mouseX-shipX)/tmp;
  this.vecY = (mouseY-shipY)/tmp;
}

And here I update the position and draw the shot:

public void drawShot(SpriteBatch batch) {
  this.lifeTime = TimeUtils.millis() - this.shotTime;

  //position = positionBefore + v*t
  this.posX = this.posX + this.vecX*this.lifeTime*speed*Gdx.graphics.getDeltaTime();
  this.posY = this.posY + this.vecY*this.lifeTime*speed*Gdx.graphics.getDeltaTime();
...
}

Now, the behavior of the bullet seems very awkward, not going exactly where my mouse is (it's like the mouse is 30px off) and with a random speed. I know I probably need to open the old algebra book from college but I'd like somebody says if I'm in the right direction (or points me to it); if it's a calculation problem, a code problem or both.
Also, is it possible that Gdx.input.getX() gives me non-precise position? Because when I draw the cross-hair it also draws off the cursor position.

Sorry for the long post and sorry if it's a very basic question. Thanks!

sentences:
Generate a HexMap where each tile has a different tile on each edge I’m trying to generate a 7*13 hexmap, with 9 different types of tiles, numbered 0 through 8. I need the map to be randomly generated on each run and it has to be so that each tile has a different numbered tile on each edge.

I’m having trouble with this algorithm. I can generate my map just fine, but there will always be many tiles where they’ll have the same number on multiple sides.

Any tips would be appreciated. Currently, I’m think I’ll have to iterate through the 2d grid, picking my first tile, let’s say 1. And then make sure there is no other 1 spawn in a two block distance. Any better ideas I can use?

Thanks

sentences: Implementing an efficient method of server-side checking I'm making a web-based action RPG game. I don't want players to cheat, but I also don't want the game to constantly pause to wait for the server to respond. I made it so the game is played on the client-side (for responsiveness) and the server does routine checking to validate the game state. But the system is very cumbersome. The server has to calculate every single frame and compare the entire game state to the game state sent from the client. If anything in the game states are different form each other, the server kicks the player off. However, this means the game has to send 30 requests a second, and the server must calculate it all in time. If many people are playing the game, I don't think my one free Heroku dyno can handle that. How do I implement an efficient and elegant way of validating players' moves on the server side?

sentences:
How to increase drag sensitivity while dragging distance is less than a certain value I built a inventory hotbar wheel for mobile controls. The wheel can be accessed if I put my finger on a specific "hitbox" on the right side of the screen and drag left. The result looks like this.

I haven't added in item icons and such, but the black stain things are going to be the outlines of the items, and there will be item icons in the middle of them. As you can see, the larger, darker outline is the active item (the one that will be used/equipped from the inventory). I have coded the script for the inventory so that the active item will be 3 slots away from the right side of the screen.
This is the script
public class Quick_Acces_Slider : MonoBehaviour, IDragHandler, IPointerUpHandler, IPointerDownHandler
{
public Image quickAccessSlider;
public Canvas canvas;

public float slotDistance;
public float[] slotPosition;
public float trueOffset;
public float offset;

public float canvasWidth;

public Vector2 originalPosition;
public Vector2 position;

public float slideDistance;
public float slideCap;

public float scrollSpeed;

// Start is called before the first frame update
void Start()
{
    canvasWidth = canvas.GetComponent<RectTransform>().rect.width;
}

public void OnPointerDown(PointerEventData drag)
{
    originalPosition = drag.position;

    slotPosition = new float[quickAccessSlider.transform.childCount];
    slotDistance = 1f / (slotPosition.Length);

    offset = trueOffset * slotDistance;

    for (int i = 0; i < slotPosition.Length; i++)
    {
        slotPosition[i] = ((i * slotDistance) + (slotDistance/2)) + offset;

        if (quickAccessSlider.transform.GetChild(i).gameObject.activeInHierarchy)
        {
            slideCap = slotPosition[i];
        }
    }

    OnDrag(drag);
}

public void OnDrag(PointerEventData drag)
{
    position = originalPosition - drag.position;

    slideDistance = Mathf.Clamp(((position.x / canvasWidth) * 2f), 0f, slideCap);

    for (int i = 0; i < slotPosition.Length; i++)
    {
         //Scale active objects, change color, etc
    }

    quickAccessSlider.rectTransform.anchoredPosition = new Vector2(slideDistance * -quickAccessSlider.rectTransform.rect.width, quickAccessSlider.rectTransform.anchoredPosition.y);
    }
}

public void OnPointerUp(PointerEventData release)
{
    Array.Clear(slotPosition, 0, slotPosition.Length);
    originalPosition = Vector2.zero;
    position = Vector2.zero;
    slideDistance = 0;
}

}
The inventory slider is set up so that there is a rectangular panel, with the item slots as its children, and the pivot point of the panel is the right side of the screen, as such:

Essentially, right now, because I have the offset value which makes the active object the one that is 3 slots from the right side, I actually have to swipe a certain amount before I can get to the first active item.
I want to make it so that the slider is more sensitive to drag while the slide distance is less than the offset value, so that I don't have to drag as mush to get to the active item. I also want the effect to work in the reverse scenario, where I am trying to stow the slider (dragging toward the right of the screen).
I've tried a few methods such as where I tweak the slideDistance while it is less than the offset, or where I try to Lerp the slideDistance value to the offset value, but none of them seem to work due to a few reasons.
The main reasons my solutions didn't work was because the slideDistance value needs to be equal to the offset value once I'm done tweaking the value/it is not longer less than the offset value to prevent jittery movement, and because I need the increased sensitivity to work both ways, when dragging left and also dragging right.

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: How to properly copy/paste object between folder? I'm new to unity and found some simple task can't be done here. For example in projects tab, i want to copy/paste a script from script folder to other folder. I should be able to simply select the script, press ctrl C , go to target folder , press ctrl V to paste but nothing happen. So for now , i have to duplicate it then move it to new folder then rename it. But why can't i do simply copy and paste ?

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:
Unity C# - Modifying eulerAngles with slider issues I'm using a slider to rotate an object on the z axis. The slider has a value of 1-360 (Whole Numbers); when the slider is moved, I use that value for the eulerAngles z axis value. (NOTE: The object is part of a child/parent 'string' of instantiated objects and it should only ever rotate on the local z axis). This method is working for some objects in the 'string', but not others. When it's not working, the object I'm trying to rotate spins wildly on the z axis because the objects z value is not a reflection of the slider value (I tested this in the inspector). I can't figure where these 'random' slider values are coming from.

Here is the rotation function I'm using for the sliders On Value Change event:

 public void SliderRotate () {
     Target.transform.eulerAngles = new Vector3(
         Target.transform.eulerAngles.x,
         Target.transform.eulerAngles.y,
         mySlider.GetComponent<Slider> ().value);
 }

BTW - If I change the x and y values to zero, the problem goes away. However, the objects then loose their correct orientation to their parent (I need the x and y to stay where they are).

Thanks in advance for any insight you can offer into this issue.

Windows - Unity 5.3.5f1

Here is an image that might help clarify:

sentences:
Why do my LWJGL fonts have dots and lines around them? When we render fonts there are weird dots and lines around the text. I have no idea why this would happen. Here is an image of what it looks like:

Our font class looks like this:

package me.NJ.ComputerTycoon.Font;

import me.NJ.ComputerTycoon.BaseObjects.UDim2;

import org.lwjgl.opengl.Display;
import org.newdawn.slick.Color;
import org.newdawn.slick.TrueTypeFont;

public class Font {

    public TrueTypeFont font;
    private int fontSize = 18;
    private String fontName = "Calibri";
    private int fontStyle = java.awt.Font.BOLD;

    public Font(String fontName, int fontStyle, int fontSize) {
        font = new TrueTypeFont(new java.awt.Font(fontName, fontStyle, fontSize), true);
        //font.
    }

    public Font(int fontStyle, int fontSize) {
        font = new TrueTypeFont(new java.awt.Font(fontName, fontStyle, fontSize), true);
    }

    public Font(int fontSize) {
        font = new TrueTypeFont(new java.awt.Font(fontName, fontStyle, fontSize), true);
    }

    public Font() {
        font = new TrueTypeFont(new java.awt.Font(fontName, fontStyle, fontSize), true);
    }

    public void drawString(int x, int y, String s, Color color){
        this.font.drawString(x, y, s, color);
    }

    public void drawString(int x, int y, String s){
        this.font.drawString(x, y, s);
    }

    public void drawString(float x, float y, String s,  Color color){
        this.font.drawString(x, y, s, color);
    }

    public void drawString(float x, float y, String s){
        this.font.drawString(x, y, s);
    }

    public void drawString(UDim2 udim, String s){
        this.font.drawString((Display.getWidth() * udim.getX().getScale()) + udim.getX().getOffset(), (Display.getHeight() * udim.getY().getScale()) + udim.getY().getOffset(), s);
    }

    public String getFontName(){
        return this.fontName;
    }

    public int getFontSize(){
        return this.fontSize;
    }

    public TrueTypeFont getFont(){
        return this.font;
    }
}

What could be causing this?

sentences:
How can I implement framerate-independant updates? Edit:
I fixed the problem by making jumpvelocity the one that is modified and added onto, and yvelocity just equal jumpvelocity * t. This is what I have right now:

if (GUI->Space && grounded){
    jumpvelocity = -185.f * 2  / gravity;
    grounded = false;

}

if(!grounded ){
    if(jumpvelocity < terminaly){
        jumpvelocity += 185.f * t * 4  / gravity;
        yvelocity = jumpvelocity * t;
    }
    else{
        jumpvelocity = terminaly;
        yvelocity = jumpvelocity * t / gravity;
    }
}
else{
    yvelocity = 0.f;
    jumpvelocity = 0.f;
}

Thanks for the help.

I am trying to get my gravity to work. The code I have so far is

if (jumpvelocity < 0){
   yvelocity = jumpvelocity * t *2/gravity;
    jumpvelocity += 185.f*t * 2 / gravity;
}

else if(!grounded ){
    if(yvelocity < terminaly)
        yvelocity += t / gravity;
    else
        yvelocity = terminaly;
}

Gravity scales upwards, the higher making falling and jumping slower. It's default value is 1. Jumpvelocity is set to 185 when the player wishes to jump. My problem is that you fall slower at a slower framerate, but you jump at the same speed as if it was a higher framerate. How would I make it frame independent? T is delta time.

sentences:
Should particles check if they are in a region, or regions if particles are in them? I have around 100 to 200 particles in my game. Then I have 5 to 20 regions (circle-shape) which should count the particles which enter them and add some force to them, so they change their direction.

My idea was now to keep a list of all particles and every region should check the whole list every frame, whether a particle is inside it. For this I calculate the distance between the particle and the central point of the region and check weather its <= the radius of the region.

Is this the most efficient way to do it? Or should every particle have a list of all regions and check whether they are in one of it? Or a totally different approach?

I would like this application to be able to run also on older mobile devices like an iPhone 4S.

sentences:
C# UDP Multiplayer Networking - issue with choppiness and consistency I know I've done this incorrectly, but I don't know what the right way is.

Right now I have two clients that connect to a server. Each tick the players send a packet of information containing their X,Y to the server. The server takes those packets and sends them to the other clients. So it's like this:

EXAMPLE:
Player1: 1:x,y or 1:100,125
Player2 receives that information, and then moves that instance of a NetPlayer based on the ID (1)

When the NetPlayer receives a new position packet from the server, it calls MovePlayerTo(Vector2 _newPosition);

public void MovePlayerTo(Vector2 _newPosition) {
            this.newPosition = _newPosition;
            //OldPacketPosition = newPosition;
            //newPosition = _newPosition
            //LerpFromOldToNew(OldPacketPosition, newPosition);
}

Then, in the NetPlayer.Draw method (called 60 times a second), the Position is set like so:

 Position.X = MathHelper.Lerp(newPosition.X, Position.X, lerpValue);
 Position.Y = MathHelper.Lerp(newPosition.Y, Position.Y, lerpValue);

This has smoothed the player out pretty well, but it still appears as if it's not being drawn as smooth as a local player, even with interpolation. It seems like it's being drawn at 45FPS. If I lower my client tick delay to 200ms, it lerps very quickly between those positions in short bursts. It doesn't actually make the entire movement smooth.

I've tried changing the MovePlayerTo() to set an OldPacketPosition, and NewPacketPosition, and then lerp between the last packet.position and the new one, and it becomes even choppier, no matter what I set my  (float) lerpValue to.

Also I noticed if I jump up and down a bunch, it doesn't show the NetPlayer hitting the ground. He moves smoothly and kinda bounces before he even hits the ground and shoots back up in the jump animation.

I know I'm doing this improperly. I've seen other people set their tick rate to be really low, and the positions aren't super accurate but the movement is still smooth between packets.

EDIT: Changes:

public void SetPreviousPosition()
        {
            PreviousPos = LastNetPosition;
        }

        public void MovePlayer()
        {
            //Next = packetPosition
            //Previous = player's position when it received the packet
            //Lerp(previous, next);
            Position.X = MathHelper.Lerp(PreviousPos.X, NextPos.X, lerpValue);
            Position.Y = MathHelper.Lerp(PreviousPos.Y, NextPos.Y, lerpValue);

        }

So every packet received by the net player, the handler is calling the MovePlayer() with the new packet position, after setting it's last position to it's current position when the packet is received. It looks smooth, but not nearly smooth enough. The local player still is super smooth by comparison.

Do I need to lerp to the new position over a specific duration? Because right now it's just calling the method every time it receives a positional update from the server.

EDIT: 5/21/20

I just tried using my lerp function in a different program and it moves perfectly. I added a list of random X,Y packets and then had it lerp over it's update call so I'm assuming that's why it's smooth. In the multiplayer game, it can't have a list, because it needs to lerp between currentPos and packetPos. So I don't understand why it immediately stops working.

sentences:
How to create reel/slider with mobile controls How can I create a reel/slider with mobile game controls so that it looks something like this?

The slider is normally non visible, and can be accessed if I slide my finger from the right side of the screen to the left. The slider allows me to switch my current weapon and use items in my inventory.
This is my current setup in Unity.

I can figure out the inventory portion of the slider, as there are many tutorials out there on an inventory system, and how to make the slider move based on touch, using something similar to a mobile joystick script, but I can't figure out how to make the slider so that it:

Can "jump" from icon to icon (not have the slider be completely fluid/prevent it from stopping in-between item icons)

Detect what item/slot the slider is currently on (in the case of the example, the item that will be used is the icon in the center of the screen.

Make the icons more transparent the further away it is from the icon in use (I'm guessing that I would have to set the alpha channel value in the color settings of the item to a lower value, but I'm not sure how to detect the icon in use and count how many icons away the other icons are from the one in use.

sentences:
Old tv effect in shader graph I am trying to use Unity's shader graph to create this old tv effect:

I thought about using a noise node, and somehow randomize the noise's seed.

Can anyone help me?

sentences:
Bad Viewports Using Unity with Google Cardboard VR on iOS I'm using unity 2017.3.1f1, building for an iPhone SE.

I'm able to build the google HelloVR scene, available from the Google Cardboard VR unity package. However, in the end result, the cameras are giving the wrong display. They aren't lined up to create stereoscopic vision at all, and the image appears distorted.

Here is an example of the output: https://i.imgur.com/Y4pqdiy.jpg

Is there a default setting in the Google Cardboard VR package that can be changed to fix this?

sentences:
Nested reference problem I have an array of objects tied to a global array in GMS2
When I try to reference the variable used to position the object I get errors saying the variable hasn't been declared.
The error also says the object and variable that cause the error are unknown.
I feel like I'm using the nested reference to point to the current target of the for loop incorrectly.

//Place is a local variable used as a index for the array
 Global.hand[place] = noone;
 //The array global.hand is elsewhere set as a 1d array that's 8 items tall
 For(i = place + 1; i < 8; i++)
 {
     Global.hand[i] = global.hand[i + 1];
     Global.hand[i].place -= 1;
 }
 Place = instance_count(card);

The snippet is supposed to take an item in the array and move it to the end

The line that's causing the error is Global.hand[i].place -= 1;

sentences:
Soccer Game only with National Team names (country names) what about player names? Ok...this question hasn't been asked before, its very similar to some, but here's the difference:

I am making a soccer/football simulator game, that only has national teams (with no official logos) just the country names and flags.
Now, my doubt is the following...can I use real player names (that play or played on that national team?)

From what I understand if I use a player name linked to a club like Barcelona FC (not a national team) I need the right from the club and the association that club is linked to, right?
But If I am only linking the name just to a country...I might just need the permission of the actual player (that I am using his name) and not any other associations, correct?

Thanks a lot in advance!
Cheers,
Diego.

sentences:
Where to place cards drawn from a deck of cards to a tableau I've never written card games before and am currently coding up a simple card game, I have a deck of cards and they need to be shuffled (done) and then draw from the top deck into a tableau (centre of table) from which the user(s) can pick from.

The only issue is I'm not sure how I can figure out where the cards drawn from the top deck go to.

Let's say the draw deck is drawn at 100,100.

Let's say the tableau starts at 200,200 and can have 6 cards in them.

How do I know where the cards are going to appear on screen within the tableau?

My current thoughts are that we fill the tableau "empty" card objects at set X/Y co-ordinates so that I know without having to do too much programming where the cards should go to.

But I'm not sure if this is the best way to do it because of screen sizes, etc.

ie: Tableau. A card width is 50, and the distance between them is 20

> Card slot #1 = 200,200 (State: Empty)
> Card slot #2 = 270,200 (State: Empty)
> Card slot #3 = 340,200 (State: Empty)

So the first card drawn would animate from 100,100 to 200,200 and change it's state to Filled
The second to 270,200, changing its state
The third to 340,200, changing its state
And so on..

But I'm still unsure if using hard number co-ordinates is really the best way forward, especially if the screen sizes change; or even if there's a better way to animate cards from a draw pile to a tableau.

My question therefore is -- how do I make the computer know where to put cards drawn from a deck of cards to a tableau?

Many thanks

sentences:
Keeping Players in Groups tl;dr How can one enforce that groups of players stay together in units in Minecraft?

I'm developing a plugin for a Minecraft server. It's based off feudalistic societies, like Ancient Europe or Japan. I understand that many ancient societies had advanced battle tactics (like this and this, for example). I think this is very interesting, and would add some more interest to a server.

However, Minecraft isn't particularly well suited for this kind of play. Generally, in battles, all the players just run willy-nilly and charge the enemy. There are no units of players, much less the units combining in a smart way to defeat the enemy. How can one enforce players staying together in one unit or group? Keeping each player in a certain position no matter what is not an option, since the players cannot PvP. Once players are grouped into units, I assume they will take up certain battle strategies and use them in a smart way.

sentences:
Tangents face the same direction on opposite sides of mesh I have noticed that the tangent vectors that I am calculating are not always facing the correct direction. The tangents on the left and right of the mesh both face the same direction. Here is a screenshot showing this:

I've mapped the XYZ value of the tangent vectors to RGB values in the fragment shader. +Z is towards the camera. As you can see, both sides of the teapot have tangents facing towards the camera instead of only the left as I'd excepted.

Also, the UVs for the mesh are correct and increase smoothly across the surface (I used blender's default sphere mapping to generate the UV coordinates):

The tangents are correct even over the seams.

I am using the following piece of code to compute my tangents:

for (size_t i = 0; i < mesh.face_list.size(); ++i)
{
    const Face& face = mesh.face_list[i];

    const size_t& i1 = face.vertex_indices[0];
    const size_t& i2 = face.vertex_indices[1];
    const size_t& i3 = face.vertex_indices[2];

    const Vec3& p1 = mesh.vertex_list[i1-1];
    const Vec3& p2 = mesh.vertex_list[i2-1];
    const Vec3& p3 = mesh.vertex_list[i3-1];

    // Compute edges.
    Vec3 e1 = p2 - p1;
    Vec3 e2 = p3 - p1;

    const size_t& txi1 = face.texcoord_indices[0];
    const size_t& txi2 = face.texcoord_indices[1];
    const size_t& txi3 = face.texcoord_indices[2];

    Vec2 texcoordDelta1 = mesh.texcoord_list[txi2-1] - mesh.texcoord_list[txi1-1];
    Vec2 texcoordDelta2 = mesh.texcoord_list[txi3-1] - mesh.texcoord_list[txi1-1];

    float coefficient = 1.0f / (texcoordDelta1.x * texcoordDelta2.y - texcoordDelta2.x * texcoordDelta1.y);
    Vec3 faceTangent = coefficient * (texcoordDelta2.y * e1 - texcoordDelta1.y * e2);

    const size_t& ti1 = face.normal_indices[0];
    const size_t& ti2 = face.normal_indices[1];
    const size_t& ti3 = face.normal_indices[2];

    // Add tangent to all vertices making up the face.
    mesh.tangent_list[ti1-1] += faceTangent;
    mesh.tangent_list[ti2-1] += faceTangent;
    mesh.tangent_list[ti3-1] += faceTangent;
}

// Normalise and orthogonalise all tangents.
for (size_t i = 0; i < mesh.tangent_list.size(); ++i)
{
    mesh.tangent_list[i] = normalise(mesh.tangent_list[i] - (mesh.normal_list[i] * dot(mesh.normal_list[i], mesh.tangent_list[i])));
}

As far as I can tell, the main part of the calculation seems correct compared to things I've found online:

float coefficient = 1.0f / (texcoordDelta1.x * texcoordDelta2.y - texcoordDelta2.x * texcoordDelta1.y);
Vec3 faceTangent = coefficient * (texcoordDelta2.y * e1 - texcoordDelta1.y * e2);

Generally, normal mapping works great, but there are subtle lighting errors on parts of the mesh after the incorrect tangent space transformation. Hopefully this is all of the information needed to get to the bottom of this.

sentences:
How can I determine where objects can be seen from a given perspective? I'm wrapping my head around OpenGL ES 2.0 and I think I'm trying to do something very simple, but I think the math may be eluding me.

I created a simple, flat-ish cylinder in Blender that is 2 units in diameter.  I want to create an arbitrary grid of these edge to edge (think of a checker board).

I'm using a 3D perspective with GLKit:

    CGSize size = [[self view] bounds].size;
    _projectionMatrix = GLKMatrix4MakePerspective(GLKMathDegreesToRadians(45.0f), size.width/size.height, 0.1f, 100.0f);

So, I managed to manually get all of these cylinders drawn on the screen just fine.  However, I would like to understand how I can programmatically "fit" all of these cylinders on the screen at the same time given the camera location, screen size, cylinder diameter, and the number of rows/columns.

So the net effect is that for small grids (i.e., 5x5) the objects are closer to the camera, but for large grids (i.e., 30x30) the objects are farther away.  In either case, all of the cylinders are visible.

sentences:
CubeRealm OpenGL rotation problems, need help. :\ I'm totally new to OpenGL and I'm working on a Sandbox game called CubeRealm. My problem you see is rotation. I've got it in my head that to rotate the 'camera' I just rotate all the scene by the negative value of the camera's rotational values. However so far it seems to not be working.

Here's the code snippets:

glPushMatrix();

lighting();
/*
 (640^2)/(64^2)=amount of cubes on one 640x640 plane(409,600,4,096)
 */
//TODO: fix z axis problem for translating
glRotatef(-player.camera.rotation.x,1.0,0.0,0.0);
glRotatef(-player.camera.rotation.y,0.0,1.0,0.0);
glRotatef(-player.camera.rotation.z,0.0,0.0,1.0);
renderGrid();

glPopMatrix();

glutSwapBuffers();

//SNIPPET2...

case LOOK_UP:
    if(player.camera.rotation.y!=-90.0){ //if they are not looking up
        //make them look up
        player.camera.rotation.y-=90.0;
        //TODO: set direction the camera is facing in
    }
    break;
case ROTATE_LEFT:
    if(player.camera.rotation.x!=0.0){
        player.camera.rotation.x-=90.0;
        //TODO: set direction the camera is facing in
    }else{
        player.camera.rotation.x=360.0;
        player.camera.rotation.x-=90.0;
        //TODO: set direction the camera is facing in
    }
    break;
case LOOK_DOWN:
    if(player.camera.rotation.y!=90.0){ //if they are not looking down
        //make them look down
        player.camera.rotation.y+=90.0;
        //TODO: set direction the camera is facing in
    }
    break;
case ROTATE_RIGHT:
    if(player.camera.rotation.x!=360.0){
        player.camera.rotation.x+=90.0;
        //TODO: set direction the camera is facing in
    }else{
        player.camera.rotation.x=0;
        player.camera.rotation.x+=90.0;
        //TODO: set direction the camera is facing in
    }
    break;

When I press the right arrow key(rotate to the right) it doesn't rotate also when I rotate up(up arrow) it goes weird instead of allowing me to see the top of the skybox it still shows me my test cubes.

So guys how do I fix the rotation, what am I doing wrong?

Note the 'TODO: set direction' stuff is for my local axis system. Those TODOs are irrelevant to the question.

sentences:
How would one construct a realistic "infrared vision" effect? How would you go about constructing a realistic infrared vision effect with shaders? By realistic I mean one that looks realistic, like this example.

I have an idea about making a texture to determine how much heat a material emits and then determine by using the dot product of normal and view vector how much of that heat reaches the viewer but I'm not even sure that this is how thermal vision even works so I wanted to check if there's a better approach before starting to implement something that might be entirely wrong.

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:
Problem with boundary collision The problem:
When the player hits the left boundary he stops (this is exactly what I want), when he hits the right boundary. He continues until his rectangle's left boundary meets with the right boundary.

Outcome:
https://www.youtube.com/watch?v=yuJfIWZ_LL0&feature=youtu.be

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) {
    Rectangle gameBoundry = Game.getWalkableBounds();
    if(x >= gameBoundry.getMinX() && x <= gameBoundry.getMaxX()){
        this.x = x;
    }

}

public void setY(float y) { //IGNORE THE SetY please.
            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;
}

}

What I've tried:
- Using a method that checks if the game boundary contains player boundary rectangle. This gave me the same result as what the check statement in my setX did.

sentences:
How to use SDL_RWops and SDL_RWseek to read text files, line by line? I'm right now looking for alternative ways to read text files on a line-by-line basis, for cross-platform compatibility (Windows / Linux).

My current solution is to go look for (or seek out) the newline (line break) in a text file using SDL2.

To demonstrate, I have a simple text file, with just 2 lines of gibberish text:

Hello world,
This is a new line with a line break.

On some text editors, you are able to display newlines or line breaks, and the above text would look somewhat like this:

Hello world,↵
This is a new line with a line break.

I want to use SDL_RWops, and if possible, use SDL_RWseek, or (SDL_RWops*)->seek(SDL_RWops*), to find the newline (line break), denoted by ↵ in the above example. That way, I can write a shorthanded version of SDL_RWreadToLine or some method that allows me to fetch text, line by line.

I believed the current method is very inefficient to check to see if I reached a newline, using psuedo-code:

//File reading/writing (We're only going to read)
//edict2 is a gigantic UTF-8 Japanese <-> English dictionary text file.
//That text file is useful for text operations (read/write) testing purposes.

SDL_RWops* edict2 = SDL_RWFromFile("edict2u", "r");         //The "u" stands for UTF-8 compatible.
if (edict2) {
    Sint64 currentBytePointer = 0;              //Holds the current pointer.
    Sint64 currentReadPointer = 0;              //Holds the current read pointer.
    Sint64 fileSize = edict2->size(edict2);     //Grabs the file size of the file.
    char* buffer = new char[256];               //Some buffer to capture the read text characters.
    while (currentBytePointer < fileSize && currentReadPointer != 0) {
        Sint64 length = edict2->seek(edict2, 1, RW_SEEK_CUR);       //Reads 1 byte from current read position.
        Sint64 temp = edict2->read(edict2, buffer, length, length); //Implicit C conversion from void* to char*.
        if (buffer[0] != '\0' && buffer[0] == '\n') {
            //Found, do something about it
        }
    }
    delete buffer;
}
else {
    //File doesn't exist, do nothing.
}

I'm sure there are bugs that I may have missed out on, considering that I'm reading from a text file that may contain multiple bytes.

And that's why I wanted to look for SDL2 alternatives.

Does anyone know of a better way to read text line by line using SDL2?

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:
Why does my character move diagonally? So i've been trying to make the player face towards the direction i pressed. That part works just fine but when I try to move the player it moves diagonally instead of left/right. Any clues?

 if (Input.GetKey(KeyCode.RightArrow))
             {
                 //moves the player
                 rb2d.velocity = new Vector3(2.5f, 0, 0);
                 transform.Translate(rb2d.velocity * Time.deltaTime);

                 //flips the player right
                 if (human.flipY == true)
                 {
                     human.transform.rotation = Quaternion.Euler(0, 0, 270);
                 }
                 else
                 {
                     transform.rotation = Quaternion.Euler(0, 0, -270);
                 }

sentences:
Why is SCNNode.rotation property a four dimensional vector? I don't understand why SCNNode's rotation property is a SCNVector4 instead of a SCNVector3. The documentation states that:

  The four-component rotation vector specifies the direction of the rotation axis in the first three components and the angle of rotation (in radians) in the fourth. The default rotation is the zero vector, specifying no rotation. Rotation is applied relative to the node’s pivot property.

What's the fourth axis? I tried adding a light (SCNLight) and if I don't specify the value of the 4th float in the vector the light has no effect (the scene is dark). Why? shouldn't a 3-dimensional vector (x,y,z) be enough?

sentences:
Unity: "Find" can only be called from the main thread, but moving variables to the Start() function causes other errors #pragma strict

 var collided = false;
 var thrust: float;
 var pizza = GameObject.Find("pizza-small").GetComponent.<Rigidbody2D>();

     function Start() {

     }

     //hand + pizza collision detection
     function OnCollisionStay2D(coll: Collision2D) {
         if (coll.gameObject.tag == "Pizza") {
             collided = true;
             Debug.Log("Hand+Pizza");
         }
     }

     function Update() {

     //Input
     if (Input.GetKey(KeyCode.W)) {
         Debug.Log("Up");
         transform.position.y+= 0.2;

         if (collided === true) {
         //Adding force to the pizza
         pizza.velocity = Vector3(0,15,0);
         }
     }
     else if (Input.GetKey(KeyCode.A) || Input.GetKey("left")) {
         Debug.Log("Left");
         transform.position.x-= 0.1;
     }
     else if (Input.GetKey(KeyCode.D) || Input.GetKey("right")) {
         Debug.Log("Right");
         transform.position.x+= 0.1;
     }
     else if (Input.GetKey(KeyCode.S) || Input.GetKey("down")) {
         Debug.Log("Down");
         transform.position.y-= 0.1;
     }
     else if (transform.position.y > -3.5) {
         transform.position.y-= 0.25;
     }
     else {
         collided = false;
     }

 }

Moving the 3 initial variable declarations into Start() removes the "Find can only be called from the main thread" error, but then they cannot be used in the Update() function due to variable scope.

If I declare them initially and then set their values inside of the start function, new errors arise.

 var pizza;

 function Start() {

 pizza = GameObject.Find("pizza-small").GetComponent.<Rigidbody2D>();

 }

If I do that, then when I use:

pizza.velocity = Vector3(0,15,0);

It states that velocity is not a member of "object".

I have no idea how to fix this, as the program works with no changes to my initial code, but does still give the error. This could be causing problems, as the rigidbody2D of the "pizza-small" is pulled toward any non-preexisting colliders that I add.

sentences:
For 2D games, is there any reason NOT to use a 3D API like Direct3D or OpenGL? I've been out of hobby Game Development for quite a while now.  Back when I did it, most people used Direct Draw to create 2D games.  By the time I stopped people were saying OpenGL or Direct3D with an orthogonal projection is just the way to go.

I'm thinking about getting back into creating 2D games, in particular on mobile phone but maybe on the XNA platform as well.  To make something using OpenGL I'd have a (hopefullly) small learning curve to acclimate myself to 3D development.

Is there any reason to skip that and instead work with a 2D framework where I just have a Width x Height frame buffer I need to fill with pixels?

sentences:
Grid collision - finding the location of an entity in each box I am trying to implement grid-based collision in a 2d game with moving circles. The canvas is 400x400 pixels. Below you can see the code for my Grid class. What I want it to do is check inside which box the entities are located and then run a collision check if there are 2 or more entities in the same box.

Right now I do not know how to find the position of an entity in a specific box. I know there are many tutorials online, but I haven't been able to find an answer to my question, because they are either written in C/C++ or use the 2d array approach.

Code snippets and other help is greatly appreciated. Thanks.

public class Grid {

ArrayList<ArrayList<Entity>> boxes = new ArrayList<>();
double boxSize = 40;
double boxesAmount = 10;
...
...
public void checkBoxLocation(ArrayList<Entity> entities) {

      for (int i = 0; i < entities.size(); i++) {
// Get top left coordinates of each entity
            double entityLeft = entities.get(i).getLayoutX() - entities.get(i).getRadius();
            double entityTop = entities.get(i).getLayoutY() + entities.get(i).getRadius();

// Divide coordinate by box size to find the approximate location of the entity
            for (int j = 0; j < boxesAmount; j++) {   //Select each box
                if ((entityLeft / boxSize <= j + 0.7) && (entityLeft / boxSize >= j)) {
                    if ((entityTop / boxSize <= j + 0.7) && (entityTop / boxSize >= j)) {
                        holdingBoxes.get(j).add(entities.get(i));
                        System.out.println("Entity " + entities.get(i) + " added to box " + j);
                    }
                }
            }
        }
    }
}

sentences:
Trees swaying in the wind using Tilemap I am working on a top-down, tile-based game (think 2D RPG). However, I would like to have trees that sway in the wind and shake a little if the player bumps into them!
How should I approach this? Is it achievable with trees that are composed of tiles and part of a tilemap?
Or should I exclude my trees from the tilemap and turn them into game objects instead?
If I were to turn them into separate game objects, would I then manually tweak their rotation/position to achieve the sway and shake, or is there some form of shader I can use?

sentences:
Rotate coordinates back after rotating game context (geometry) To achieve something similar to the image below using HTML5 canvas one can simply write the following:

var TO_RADIANS = 0.0174532925;
context.translate(30, 20);
context.rotate(30 * TO_RADIANS);
context.drawImage(img, 0, 0);

My problem comes when I want to convert the coordinates from inside the translated/rotated context back to the main context. For example, if a missile were shot from 0,0 inside the translated/rotated context along the X axis, what formula would you use to then convert its position to the outer context?

sentences:
Gravity well shader for Unity2D I'm trying to find or create a gravity well distortion shader for Unity. I've been looking around and all I can find are "lenses" which bend space around a black hole.

I'd rather have a distortion that "pulls" or "bends" the image behind into a small hole. Essentially, what this would look like if viewed from above (ignoring the sphere):

I can't seem to find any examples or a common terminology for it.

sentences:
How to create offsetting lines that draw across the screen in Monogame? I'm trying to create an effect on the screen like the gif below. Basically lines that are offset by 1 pixel draw across the screen from either side which then eventually creates a solid color.

I'm using Monogame for this and I'd prefer a shader doing it. The only resolution I'd need to support is 240x160.

I've delved a bit into a scanline shader to see if I could adapt it, but so far it doesn't look like it's going to work.

sentences: Pleasing isometric hexagons What angles and long-side/short-side ratios give the most aesthetically pleasing and graphically regular isometric (squashed and flat side up) hexes, that additionally resolve to whole pixel sizes for several sizes when rendered?

sentences:
Data structure for objects in a galaxy of star systems I'm having some difficulty coming up with the appropriate data structure to use for a game.
I'm aiming for a galaxy view with tens of thousands of visitable star systems.

Structure
Hierarchically, each star system can contain one or more of the following:

Planets [and their moons]
Asteroid Belts
Megastructures [and their moons/sub-structures]

All of the above can have "points of interest" [POI] eg a station in low orbit, a surface resource node, a docking bay.
Usage
I don't particularly care about physical location within a system beyond knowing its order in the hierarchy (I'll be showing a list of locations, rather than trying to render them in 3D space). So I can treat all objects within a system as located at the star for the pursposes of calculation.
I do, however, need a way to specify routes from any Planet/AsteroidBelt/Moon/Megastructure/POI to any other. I also need to be able to search for other locations meeting certain criteria [both to offer as destinations in the UI and to handle rendering].
Each type of location will have some unique properties (Asteroid belts have resource distributions, for example whereas planets ave atmospheres) but they also have lots of common properties (inventory, owner, comms network node id, etc).
Ideas so far
Obviously, with the numbers I'm considering I need to take a sparse/lazy generated approach. Currently the galaxy is built entirely in the GPU and stars are only presented to the CPU when the user first clicks on them.
That lends itself nicely to a hierarchical data structure with a load-on-first-access approach. Click on a star and it's added to the list, so the name is saved. Scan/visit it and I'll generate the system contents.
Unfortunately, I also need to be able to search across all generated locations efficiently (given an ID, find the star system coordinates, find planets with an atmosphere like X, find any location with X in its inventory) in a potentially huge search space.
That doesn't align with recursively walking up/down trees.
I considered using a heirarchy and manually maintaining a number of separate indices to speed up searching. It's doable but a pain and error-prone. It also feels like one of those solutions where I'm going to keep finding one more type of query I need to support and before long I'm trying to implement a minimal database.
Speaking of which I also need to persist this data at some point. Currently I'm serializing to a densely packed binary blob.
So... I took a step back and wondered whether I should actually use a database. I can see the benefits of using something like SQLite which I could bundle with the game and would handle persistence, indices, and the rest.
Db?
After spending a couple of days implementing the basics, I can see this is going to be quite a long and involved process.
None of the friendly tooling works well in Unity, so I can't take advantage of entity framework w/ code first, nor nice Linq-To-Sqlite predicate handling. Even worse, most of the libraries to work with EF are tightly coupled to windows. EF Core seems like an option but I haven't been able to get it working in Unity (I need to do some assembly version mapping but as Unity overwrites the project file regularly and doesn't seem to support this itself, I think it's a losing battle).
So I've headed down the route of implementing a data layer that generates SQL as needed.
I can do that, but it opens up a huge can of worms in terms of manually maintaining the DB schema. I'm going to have to start tracking a DB version and bundling migration scripts with any update/patch. It's a whole new maintenance burden.
Question
So... What am I missing? What's the elegant way to store a sparse hierarchy of data whilst still supporting flexible search across disparate object types that just happen to have a lot of common properties?

sentences:
Can ARToolKit be used for color detection? I'm trying to make an app that will show an object from different sides, but the target will be too small for any real marker detection.

Think of a cube with one or two centimeter sides. The camera distance is not a problem but it has to be at least ten centimeters out or what I'm trying to do won't work.

I was wondering whether it was possible to color one side of the cube differently than others and make ARToolKit recognize the color to know which side it's looking at. Is this possible or just not in the range of things ARToolKit can do? If so, is there any kind of AR that can do this.

sentences:
How should bots be recognised in a game? I'm interested in how bots are usually written.

Here's my situation:

I plan to make an online 2D mecha game in HTML5, and the server-side will be done with node. It is intended to be multiplayer, but I also want to make bots in case there aren't enough players.

How does my game logic see them, as players or as bots? Is there a standard by which I should make them? Also, any general tips and hints will be OK.

sentences:
When animating sprites, why subtract frametime when switching between sprites instead of resetting elapsed time to zero? I am currently on chapter 3 of the book "Learning XNA 4.0". At the end of this chapter is a section on changing the animation speed of sprites.

timeSinceLastFrame += gameTime.ElapsedGameTime.Milliseconds;
   if (timeSinceLastFrame > millisecondsperFrame)
   {
       timeSinceLastFrame -= millisecondsperFrame;
       //code for cycling through sprite sheet here.

This code is in the Update method. It iterates timeSinceLastFrame until it's greater than millisecondsperFrame (which I have specified as 20), and then it resets by subtracting millisecondsperFrame from timeSinceLastFrame.

If I instead reset it by writing timeSinceLastFrame = 0, the animation is noticeably slower. From what I can tell, this is due to the fact that XNA updates at 60 frames per second, so timeSinceLastFrame iterates by several milliseconds each time, and likely won't have the same value as millisecondsperFrame once the if statement compares the two.

Despite this, is there anything particularly bad about writing timeSinceLastFrame = 0? Or is timeSinceLastFrame -= millisecondsperFrame safer?

sentences:
Box2D Check If Point Intersects a Body Is there a way to check if a point is intersecting a body?

For example, lets say there's a body in the world at a position of (100,100).

Is there a way to check if a point at (100,100) intersects that body?

Another example is related to a game called "PHUN". In PHUN you can click and drag bodies around. How would you check if a mouse point is intersecting a body?

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: Can both High poly model go with a low poly scene? I'm in the process of developing a game, and I've found a model that would go perfectly for the character. However, the scentre I already have is low poly and I can't find a good enough high poly to go with it. So tell me whether or not I should I should carry on with the art I have or find a low poly model.

sentences:
Spawning entities in groups on a 2d tile-based map I have a 2d game that generates an "infinite" map of tiles based on a "noise" height map. Each time a new "chunk" of 16x16 tiles is loaded, I have code that randomly chooses a "creature" to spawn into the game. Whether or not a creature will spawn on the tile is random, and which creature type is weighted/random.

However, I'd like to take this to the next level and design a creature that can spawn in groups.

I have a few choices:

Spawn additional entities in a random set of surrounding tiles. Multi-chunk groups are impossible unless I write code to base spawns off of what already exists next to it.
Create a new noise/height-map value that I then use to spawn entities with.

There are pros/cons to each, but I'm hoping someone with more experience can suggest which is better, or a third choice.

sentences:
Scrolling backgrounds without tiles I'm writing a paper on game backgrounds and need to look at how they are implemented in different games, but I'm a bit stuck on scrolling backgrounds.

While it's easy to recognize a scrolling background, everywhere I look I also see tiles.

Are there any popular published games that use scrolling backgrounds, but that don't use tiles?

All of the classics, like Commander Keen, Mario, etc. use both scrolling and tiles.

Any suggestions? Google is not helping me on this one.

sentences:
How to get position of next object that closest to player,when player is move forward to nearest every time? I have a scene that looks like the following picture:

The Player has a RigidBody2D and all the steps have a BoxCollider2D. All steps are tagged with a 'step' tag.

I would like to let the player move to the next step, every time the user presses a key. In this case, I'll need to get the position of the next step that is the closest to the player, every time the player moves to the next position.

I have tried the following so far:

using UnityEngine;
using System.Linq;

public class Box : MonoBehaviour
{
    //the rigidbody of the box
    private Rigidbody2D player2D;

    // Start is called before the first frame update
    void Start()
    {
        player2D = GetComponent<Rigidbody2D>();
    }

    void Update()
    {
        if (Input.GetKeyDown(KeyCode.Space))
        {
            Vector2 targetPosition = GetNextTargetTransform(player2D.position );

            //here set trajectory to move from current position to target position
            Vector2 trajectory = SetTrajectory(player2D, targetPosition);
            player2D.AddForce(trajectory, ForceMode2D.Impulse);

            //after reach the position update player position to current position
            //player2D.position = targetPosition;
        }
    }

    public Vector2 GetNextTargetTransform(Vector2 player2Dposition)
    {
        GameObject[] step = GameObject.FindGameObjectsWithTag("step");

        //here is the code to get the nearest object using LinQ
        var nearest = step.OrderBy(t => Vector2.Distance(player2Dposition, t.transform.position)).FirstOrDefault();

        Transform nearestPosition = nearest.transform;
        Vector2 targetPosition = new Vector2(nearestPosition.position.x, nearestPosition.position.y);

        return targetPosition;
    }
}

I am able to get the position of the first step when a button is pressed, but when I press the key again, I am unable to get the position of the next step (and thus remain on the first position).

I've added player2D.position = targetPosition; after AddForce(...) and the player will directly appear on the first step and move to the next one, which is not the result I want.

Question

How do I get the position of the nearest step, every time the player moves to a new step?

sentences:
How to display Render Target live to HUD widget in UE4 I'm making a security camera system in Unreal Engine 4. It allows the player to 'activate' the monitor, which should display the Render Target texture or the material made from it on the HUD. However, that just doesn't work. There's just no image when I try to play it. Nothing appears on the screen. I'm using blueprints btw, not C++. And yes, I did check and make sure that it's not the part that displays the HUD that's going wrong, it's the displaying of the render target to the UI widget. To display it, i've tried using the image component in the UI widget.

Can anyone 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: In LibGDX, how might I make an object orbit around a position? I need an object, which would be a circle, made with ShaderRender, to orbit around a specified point. In LibGDX is there a method or something that would allow me to accomplish this? If not, could you please provide a code example?

sentences:
How should I interpret these DirectX Caps Viewer values? Briefly asking - what do the nodes mean and what the difference is between them in DirectX Caps Viewer?

DXGI Devices
Direct3D9 Devices
DirectDraw Devices

The most interesting for me is 1 vs 2. In the Direct3D9 Devices under HAL node I can see that my GeForce 8800GT supports PixelShaderVersion 3.0. However, under DXGI Devices I have DX 10, DX 10.1 and DX 11 having Shader model 4.0 (actually why DX 11? My card is not compatible with DX 11).

I am implementing a DX 11 application (including d3d11.h) with shaders compiled in 4.0 version, so I can clearly see that 4.0 is supported.

What is the difference between 1 and 2? Could you give me some theory behind the nodes?

sentences:
How to call an event of level blueprint from NPC blueprint? I have the following situation:

1 NPC that follows a path containing 3 parts. Target Point 1, Tower and Target Point 2.

It turns out that the first NPC that passes through the tower destroys it.

This destruction is not instantaneous. The tower has 100 hit points and while in contact with the NPC, it loses 10 life points every second.

With this, the next NPCs will only have to go to Target Point 1 and finally to Target Point 2.

I created a boolean variable for target control (varTowerDestroyed). So if it is false, the second target becomes the tower, otherwise it becomes the target point 2.

Blueprint showing the variable (varTowerDestroyed) being set to true, right after the tower's destruction:

Display of the control in the target definition:

It turns out that each NPC has its own variables, so there's no use in defining the value of the variable of just one of them. I would need a variable that would control all at the same time.

I thought of doing the verification based on a variable of the own tower, but as the tower will be destroyed, I imagine the variable will disappear. Impossible to verify:

At the Level Bueprint I created an event that will be called soon after the tower's destruction. This event will set the Boolean variable to true, setting all Boolean variables of the NPCs that are created and still generated to be true:

I would calmly call an event if the event was in the blueprint of the tower, but being on the blueprint level I was unsuccessful.

I thought about using the sleep function. I also thought about creating an actor who was sort of an actor manager (I still want to, but only when I start using HUD). I also thought about doing a check of the existence of tower actors, but this I do not know how to do.

Links from places I searched:

https://answers.unrealengine.com/questions/78622/how-can-i-call-an-event-in-my-level-blueprint-from.html

https://answers.unrealengine.com/questions/702964/how-can-i-call-a-event-from-actor-blueprint-in-lev.html

EDIT 1 (Attempt made based on 2 videos I've seen)

Link of videos:

https://www.youtube.com/watch?v=k-MAALv3P-Y

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

I tried to use the Event Dispatcher.

I created an Event Dispatcher called Disp, in the NPC blueprint.

Soon after I set it on the Level Blueprint.

Level Blueprint:

Nothing happens, nor the impression.

sentences: What Javascript game engines are out there, other than Impact? Does anybody know of a decent (meaning preferably free ;)) alternative to Impact? Any suggestions are very much appreciated!

sentences:
Why use sprite tile maps on the GPU in WebGL? I'm trying to figure out the best way of rendering my layered tiled maps with WebGL, and have come across this tutorial several times: https://blog.tojicode.com/2012/07/sprite-tile-maps-on-gpu.html
Someone even created a library for it here: https://github.com/englercj/gl-tiled
The gist of this "GPU abuse" seems to be generate a texture where each pixel as a lookup table into the tileset spritesheet. That is, the red component refers to the x coordinate and the green component refers to the y coordinate. Additionally, in the library, the blue component refers to the corresponding tileset to use.
This seems to accomplish exactly what I am attempting to do, but I am confused on two parts.
For one, the author describes this is a neat little trick and "GPU abuse". I feel as if the implication there is, "this is a fun little exercise, but don't actually use this for your game or any serious code."
Is this the case, or is this actually a potentially serious technique that I could use to power my map rendering?
Secondly, I'm somewhat confused why this is even necessary. I am still learning WebGL, so I might mess up a few terms here, but couldn't this same exact thing be accomplished in a more straight-forward manner? Why go through all these steps of creating a custom generated texture of your map, when you can just create a (static?) Vertex Buffer Object, load it with all your tiles, and then just render them?
I'm not really understanding what exactly this technique buys as that can't be accomplished in the same way by just creating a large buffer that just contains all our tile data, and then just rendering it like that. Isn't that conceptually simpler, arguably easier to implement, more straight-forward, and doesn't have weird restrictions like maximum tile count or width?
Basically, I'm having trouble understanding what advantages this has over traditional rendering where you just load up a buffer with tiles. If there are some advantages, should this technique be seriously used in a game?

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 does a minecraft biome finder generates map How does chunkbase biome finder generates map base on seed?
I was curious if chunkbase knows the secret formula for generating the map? Or it uses other math formulas such as scaling, mapping etc...

Here's my main point:
If I generate a map in minecraft and grab that minecraft seed. If I place that minecraft seed in biome finder, It also generates the same world that minecraft generated. If I place the coords in that biome finder, it also shows me the correct position in minecraft world.

How can you possibly generate a world similarly to minecraft without knowing the secret formula? Is this possible?

Here is the site https://chunkbase.com/apps/biome-finder

This is my first question and I'm not a real game dev(I just want you to know). If you want me to remove this question, just tell me.

sentences:
Texture flipping behaviour I was having this problem with OpenGL where I'd have all my textures being rendered upside down. I did the most logical thing I could think of and tried reversing the order of the mapping and that fixed the issue. But why? I know that OpenGL's coordinate system is cartesian and that it works by mapping each uv to a specific vertex. I had something like [0,0], [0,1], [1,1], [1,0] which would theoretically as far as I understand it go from:
top-left -> bottom-left -> bottom-right -> top-right.
I changed this to: [1,1], [1,0], [0,0], [0,1] which would represent:
bottom-right -> top-right -> top-left -> bottom left.
In my understanding it should be quite the opposite. Making a pretty quick sketch on paper it shows me that the initial order would theoretically render my texture correctly and not upside down. Am I correct and theres something else messing with my rendering? Like my perspective matrix?
This is my orthographic matrix:
        Matrix4f ortho = new Matrix4f();
        ortho.setIdentity();

        float zNear = 0.01f;
        float zFar = 100f;

        ortho.m00 = 2 / (float) RenderManager.getWindowWidth();
        ortho.m11 = 2 / -(float) RenderManager.getWindowHeight();
        ortho.m22 = -2 / (zFar - zNear);

        return ortho;

I can't really say I understand it though, I had quite a hard time with it. And looking through youtube tutorials and articles you can see most people don't really understand it either, they just use it. I do have a good linear algebra background but still can't wrap my head around how is this matrix normalizing my coordinates (screen coords to OpenGL coords (-1,1)). Anyway, I digress, any help is appreciated.

sentences:
Sprite disappears after adding a material to it I have background which is FirsLayer, order in layer 0 and platform over it which is FirstLayer, order in layer 1.

Once I add a material to the platform, the layer doesn't seem to change but it gets rendered behind the background.

The material that I add:

1)Why do I get such results?

2) How can I add the material to the platform and still keep it above the background?

P.S. For further clarification if somebody didn't understand, I expected the sprite to stay on its original position(i.e. not to go behind the background when a material is being added to it)

sentences:
Design pattern for AI cooperation I'd like to implement an AI for my game, which has agents that should be able to take care of themselves.

The Sims use a system of smart objects that advertise their services, a design pattern that seems very nice since all the logic is hidden away in the object to be used, and it seems simple enough to get started.

I am currently stumped though how to extend it to interactions between multiple people, and to people using objects together, especially when it doesn't make much sense to use an object together. (I don't want a character to set up a boardgame and wait, no one comes and he leaves again)

sentences:
Why does flipping 1 texture region cause an identical texture region to also be flipped? (libGDX) Sorry for the bad title. I didn't know how else to explain it.

The following is a portion of my code:

public class AssetLoader {

    public static TextureAtlas spriteSheet;

    public static TextureRegion hill, hillTop, hillBottom, rabbitJumped, background1, background2, water, spikes, playButtonDown, playButtonUp, dust;

    public static void load() {
        spriteSheet = new TextureAtlas(Gdx.files.internal("data/SpriteSheet.txt"));

        background1 = spriteSheet.findRegion("background");
        background2 = spriteSheet.findRegion("background");

        TextureRegion[] runFrames = {spriteSheet.findRegion("Frame01"), spriteSheet.findRegion("Frame02"), spriteSheet.findRegion("Frame03"),
                spriteSheet.findRegion("Frame04"), spriteSheet.findRegion("Frame05"), spriteSheet.findRegion("Frame06"),
                spriteSheet.findRegion("Frame07"), spriteSheet.findRegion("Frame08"), spriteSheet.findRegion("Frame09"),  };

        runningAnimation = new Animation(.03f, runFrames);
        runningAnimation.setPlayMode(Animation.PlayMode.LOOP);

        background2.flip(true, false);

    }
}

For some reason, the texture Region background1 is also flipped. Any help would be appreciated.

Some irrelevant code was ommitted.

sentences:
Unity 2019 depth-only camera now overwrites everything We have a pretty traditional camera stacking set up: UI camera on top of a everything-else camera.

The UI camera is set to only clear depth, and only draws the UI layer.  The everything-else camera is set to clear via skybox and all layers but UI.  Only the everything-else camera contains a post-processing layer component; disabling it does seem to make everything work the way it used to.

The UI camera has a higher depth than the everything-else camera, in case someone suggests otherwise.

In 2018 this exact arrangement worked as intended.  In 2019, the UI camera's view is the only thing visible.

I've found several forum posts on Unity by Unity Technologies about the light-weight pipeline breaking this functionality, but we're not using any of the new pipelines.  We simply upgraded, and I can't find any indication that we are using the new pipelines.  Supposedly everything works normally as long as you don't use the new pipelines, but this is proving false so far.

Since this camera arrangement is very common, I can't imagine I am alone!

sentences:
Game Map Implementation I want to know how I can create a virtual town or city (like skyrim towns or gta4 liberty city)

Should I create something on paper and copy coordinates? (Building1 floor corner coordinates are these, ceiling coordinates are these, 2nd floor coordinates are these etc, and then road1 coordinates are these...) And then apply texture on these things? Start with just 1 building and extend it in time?

But this seems like a ton of work. For simplicity if we assume that there are 5 buildings on a road, this is like 90 vertices. And if I decide to make a house wider, then many things will be affected and I have to find new coordinates for every house corners. How did the developers of GTA 4 do it for example?

I would like to know an appropiate method to create a static virtual map where the player can move into houses and interacts with objects in it. Please note that these buildings are not cosmetic only. I should be able to place objects in houses such as tables and the player should be able to jump on it etc.

Thank you, I will vote when I have the reputation.

sentences:
Why the transform.localPosition never equal to the begin position of the transform? using System.Collections;
using System.Collections.Generic;
using UnityEngine;

public class MoveScrollView : MonoBehaviour
{
    float seconds;
    Vector3 begin;
    Vector3 end;
    Vector3 difference;

    public static bool go = false;
    public static bool goBack = false;
    public static bool atOriginPos = false;

    void Start()
    {
        seconds = 0.5f;

        begin = transform.localPosition;
        end = new Vector3(0, -1, 0);
        difference = end - begin;
    }

    void Update()
    {
        if (go)
        {
            if (transform.localPosition.x < end.x)
            {
                var mx = transform.localPosition.x;
                transform.localPosition = new Vector3(mx += seconds * Time.unscaledTime, -1, 0);
                difference = end + transform.localPosition;
            }
        }

        if(goBack)
        {
            if (transform.localPosition.x > begin.x)
            {
                var mx = transform.localPosition.x;
                transform.localPosition = new Vector3(mx -= seconds * Time.unscaledTime, -1, 0);
                difference = end - transform.localPosition;
            }
        }

        if(transform.localPosition == begin && goBack)
        {
            atOriginPos = true;
        }
    }
}

At the Start the begin position is (-540.0, -1.0, 0.0) also the transform.localPosition is at the same position.
Then at this line 39 :
if (transform.localPosition.x > begin.x)

The value of the x of the transform.localPosition is 3.039021 and the x of the begin is -540
So it's getting inside and move the transform.
Then when the transform has finished moving I see on this line :
if (transform.localPosition.x > begin.x)

The transform.localPosition x value is -540.7267 and the x value of the begin is still -540
So now it will not get inside and will not move the transform anymore.
But two wrong things happened :

The transform stopped moving but it didn't move to it's original position only close to it.

Because it didn't move to it's exact original position then the localPosition x and the begin x are never equal so the this will never be true :
if(transform.localPosition == begin && goBack)

And the flag atOriginPos is never true.
I want the transform to move back to it's original position and then when it's reached the original position set the flag atOriginPos to true.

sentences:
if touching line renderer (do something) I have this laser script for a ship and I am trying to make it kill an enemy when it is hit with the line rendered laser. How can I achieve this. All things I found online I just could not get to work. An outline of the code would be (this isnt real code).

public gameobject linerenderer;

void update()
{
   if (touching gameobject.linerenderer)
   {
       die
   {
}

 private LineRenderer lr;
    void Start()
    {

        lr = GetComponent<LineRenderer>();
    }

    void Update() // consider void FixedUpdate()
    {

        lr.SetPosition(0, transform.position);
        RaycastHit hit;
        if (Physics.Raycast(transform.position, transform.forward, out hit))
        {
            if (hit.collider)
            {
                lr.SetPosition(1, hit.point);
            }
        }
        else lr.SetPosition(1, transform.forward * 5000);

    }

However there is an anoying bug with this code...
Before:

After you play the game for about 30 secs:

Settings:

sentences:
Camera math: How to calculate the horizontal and vertical angle from the look at vector I'm using the PerspectiveCamera class in C#/WPF to implement an FPS style camera.

For that, I would need to offset the camera's horizontal and vertical angles every time the mouse is moved. The problem is that PerspectiveCamera doesn't store those angles and only provides a lookat vector.

So, is there a way to calculate those angles from the lookat vector ?

sentences: How can I separate gameview from UI most efficiently in Unity? Let me provide an image to illustrate what I mean. It is from a game called Runescape.

sentences:
Is it a good idea to render many textures into one texture? I'm making a 2D game with OpenGL. In order to avoid changing the state machine and binding at runtime, I want to make consolidate my textures into bigger textures,

for example, taking 4 128x128 textures and making 1 big 512x512. I could then just render part of the texture rather than binding a new one.

Is this a good idea? Could my newly created texture get lost, or are there major faults in doing  this?

Thanks

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:
How can I get a reference to a object in the world in UE4? I'm coding a simple maze game in UE4 and I have everything I wanted to implement done except having an obstacle in the scene. What I have is a simple Obstacle class which is a child of an Actor class.

Now in the scene I have a Blueprint which is a child of the Obstacle class and this Blueprint is placed in the maze. What I'm trying to achieve is when the player collects so many objects (let's say 10) then the Obstacle will be destroyed but I don't know how to get a reference to that Obstacle object in my code.

AObstacle* Obstacle /////// This is where I don't know how to initialize the object
if (MyCharacter->collectedPickUps >= requiredAmountOfPickups)
{
    Obstacle->Destroy();
    Obstacle->isActive = false;
}

sentences:
How can I handle the subject of an action disconnecting before the action executes? Let's assume I have a CEntity class that describes every entity within the game.

Each entity class has it's own std::vector of CActions. Each CAction is just an action that the entities can perform, for example CActionFight would have the logic for fighting.

To command my player (or any other entity) to fight all I do is:

CActionFight *pActionFight = new CActionFight();
pActionFight->SetTarget(pTargetEntity);
pPlayer->AddAction(pActionFight);

Before this action is started, all other actions queued earlier have to be finished. Imagine player starting to execute the CActionFight over pTargetEntity and suddenly, pTargetEntity disconnects. pTargetEntity is invalid and here's my question.

How do you normally handle that in actions?

If a disconnection event of an entity is received on the server side, do you iterate through the actions of all entity in the map and remove these which are related to an entity that has just dropped connection?

EDIT
Liked Josh's approach and implemented the solution, sounds very sensible and worked like a charm.

// Example of an action, checking wether Entity is still valid.
void CActionFight::Execute()
{
    m_iCycles--;

    if(m_iCycles>0)
    {
        if(m_pTarget->IsValid() == false)
        {
            m_pTarget = NULL;
            m_bValid = false;
        }
        else
        {
            printf("Attacking.%s\n", m_pTarget->GetName().data());
        }
    }
    else m_bValid = false;
}

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:
I want to drop a platform after I land on it I want to disable z-axis translation lock 2 seconds after my player hits the object in question. I am using Unreal 4. Been slamming my head against it for a week and a half, please save this newb.

I just noticed this is the iteration where I enabled gravity instead of disabling z lock... the intended result is be the same for both of these

UPDATE

now the thing drops but it doesnt wait for the timer

UPDATE! I DID IT!

sentences: What should be created first in a video game? When starting developing a video game, should one focus on creating the environment (buildings, trees, mountains etc) first or the A.I. (Playable character, NPCs etc)?

sentences:
Different Behaviour between ++ and += 1 void AddItem(Item item)
{
    int indexOfDuplicateItem = System.Array.IndexOf(itemsInInventory, item);

    if (indexOfDuplicateItem > -1)
    {
        quantityText.text = (stackSize[indexOfDuplicateItem] += 1).ToString(); // Problem occurs here
    }
    else
    {
        for (int i = 0; i < numSlots; i++)
        {
            if (itemsInInventory[i] == null)
            {
                itemsInInventory[i] = item;
                GameObject itemImage = Instantiate(itemImagePrefab, slots[i].transform);
                itemImage.GetComponent<Image>().sprite = item.itemSprite;
                quantityText = slots[i].GetComponentInChildren<Text>();
                stackSize[i] = item.itemQuantity;
                quantityText.text = stackSize[i].ToString();
                return;
            }
        }
    }

The indicated line behaves differently if I write quantityText.text = (stackSize[indexOfDuplicateItem]++).ToString();

I'm a relative beginner to both C# and Unity. Can someone explain why the behaviour of (stackSize[indexOfDuplicateItem]++).ToString() is different from (stackSize[indexOfDuplicateItem] += 1).ToString()?

using += 1 to increment behaves correctly, but ++ ends up being the correct answer - 1.

sentences:
A star algorithm implementation problems I’m having some trouble implementing the A* algorithm in a 2D tile based game.

The problem is basically that the algorithm gets stuck when something gets in its direct way (e.g. walls)
Note that it only allows Horizontal and Vertical movement.

Here's a picture as it works fine across the map without something in its direct way: (Green tile = destination, Blue = In closed list, Green = in open list)

This is what happens if I try to walk 'around' a wall:

EDIT

Thanks DeadMG, I rewrote the algorithm last week and got it somewhat working.

But the heuristics are still some faulty.

As you can see here it prefers a uneven path on an straight way:

The heuristics function:

float c_astar::GetH(cTILEext TILEX)
{
    short a = 0; short b = 0;
    if(TILEX.Tile.Position.x > Destination.x) a = TILEX.Tile.Position.x - Destination.x;
    else a = Destination.x - TILEX.Tile.Position.x;
    if(TILEX.Tile.Position.y > Destination.y) b = TILEX.Tile.Position.y - Destination.y;
    else b = Destination.y - TILEX.Tile.Position.y;

    float h = a+b;

    //Tie-Breaker
    float dx1,dy1,dx2,dy2;
    dx1=dy1=dx2=dy2 = 0;

    if(TILEX.Tile.Position.x > Destination.x) dx1 = TILEX.Tile.Position.x - Destination.x;
    else dx1 = Destination.x - TILEX.Tile.Position.x;

    if(TILEX.Tile.Position.y > Destination.y) dy1 = TILEX.Tile.Position.y - Destination.y;
    else dy1 = Destination.y - TILEX.Tile.Position.y;

    if(Start.x > Destination.x) dx2 = Start.x - Destination.x;
    else dx2 = Destination.x - Start.x;

    if(Start.y > Destination.y) dy2 = Start.y - Destination.y;
    else dy2 = Destination.y - Start.y;
    float cross = abs(dx1*dy2 - dx2*dy1);

    h += cross*0.001;

    return h;
}

I used the Tie-Breaker as described here. What am I doing wrong?

Regards,
bryan226

sentences:
An object reference is required to access non-static member UnityEngine.Material.GetTextureOffset(string) I am watching a tutorial where it seem to work. But in my case, I am getting this error. I get it that non-static members have to have an object. But, I don't know much about how to fix this error.

using UnityEngine;
using System.Collections;

public class AnimatedTexture : MonoBehaviour {

    public Vector2 speed = Vector2.zero;

    private Vector2 offset = Vector2.zero;
    private Material material;

    void Start(){
        material = GetComponent<Renderer> ().material;

        offset = Material.GetTextureOffset ("_MainTex");
    }

    void Update(){
        offset += speed * Time.deltaTime;

        material.SetTextureOffset ("_MainTex", offset);
    }
}

sentences: Do I need licensing to use real city names in my game? I want to allow people to go to real places (Seattle Washington, Portland, Maine, etc.) in my game. Will I need licensing to make those places and use their names?

sentences:
Modern way of getting points within a distance? I'm making a game engine, and some components may want to interact with others based on distance. Currently, the component registers an update listener which runs on a loop, then it checks the distance for each object. This is obviously wrong.

I thought about creating a system just for spacial relations, where the component would ask every frame if there are objects within a radius to that system, and it would have something like an octree inside to accelerate the calculations. I can also just register a listener for when objects are closer than a radius, and it would update only when an object changed from one node to the other on the tree.

Is the octree appropriate or is it just better for static objects like terrain? What do physics engines use?

sentences: How can I spawn objects in a volume without intersection? I am generating a 3D scene that involves spawning lots of 3D objects in a finite volume. I need to avoid intersection of objects.

sentences:
My mesh has holes in it. How do I make those invisible faces show? I have a mesh. A perfectly normal mesh, without any artefacts at all.

However, when I import it into Unity, there are holes in it.

After going through my UV mapping and normals, they are all mapped, have no faces with the normals going the wrong way (facing inwards) and have non-transparent textures over each mapped UV face.

Oddly enough, this mesh hasn't been split, despite its poly count and is one whole object, but yet - It has missing polygons. Is there any way to get Unity to recognise these faces?

Also, it is worth noting that these holes happen to be all the tris faces on this model, and are all (mostly) along the UV seames.

Question

How do I make the invisible faces show? What's going on?

sentences:
Convert a modified Transform.forward to world space I am trying to make an electricity system, where it is given the start and end points, and it works out a random sequence of points in the rough direction of the end point. These points are set as vertices on a line renderer, and it should end up joining up as a bolt of electricity. My problem is that it needs to move 'forward' from start to end. The easy solution is that the electricity comes from a game object, which is set to LookAt the end point. Then, every time it sets a 'nextPoint', it adds to the transform.forward.

nextPoint = new Vector3 ((startingPoint.forward.x + divergence.x),
        (startingPoint.forward.y + divergence.y), distance);

divergence is a Vector3 containing a random increase on the x and y axis, and 1 on the z axis.

This works, in a way. The problem is that it then assumes these are world-space coordinates. So the line will go from starting point, to (eg. 0.3, 0.75, 1), and then back to the end point. I can't find a localToWorld conversion for a vector though, so I am not sure how to get the transform.forward + whatever, converted from local to world space.

sentences:
Gesture Recognition Strategies Working with the Wii I often find it necessary to recognize simple gestures, so far I've been able to mainly look at magnitude of acceleration in order to recognize the gestures called out for in our game design documents, but I'd like to create a more robust system that allows "recording" of example gestures and recognition of complex gestures.

What strategies have you used in the past? Why did they work? Why didn't they work? What would you do differently?

sentences: Override close button How can I override the close button near minimize/maximize in such a way that the application doesn't automatically close. I want it to show an exit screen or something like this, so I would like to be able to delay the close and display something on the screen when I press the red close button. At first I thought that I should override the OnExiting() method, but I couldn't get it working. This is my first attempt at creating a fully functional game, so I have no previous experience in game development nor with XNA.

sentences:
Recreating Common "Glowing Pillar" Effect in UE4 I've noticed a common "glowing pillar beacon" effect in a few games lately (Overwatch, Fortnite, etc). The effect provides a translucent glowing beam pointing upwards that tapers off towards the top and fades out.

I'm attempting to recreate the effect and was wondering if this is some form of particle emitter and what is involved in the effect?

Thanks!

Examples:

sentences:
Finding cells within range on a hexagonal grid I'm looking for a way to get the cells based on a N range. But no luck.

I'm converting Row Column offset to Cube Coordinate system QR -> XYZ

$range = 1;
for ($dx = -$range; $dx <= $range; $dx++)
{
    for ($dy = max(-$range, -$dx - $range); $dy <= min($range, -$dx + $range); $dy++)
    {
        $dz = -$dx-$dy;
        $points = $hexagon->cube_to_oddq(array($dx,$dy,$dz));
        $x = $hexagon->ver + $points[0] * $hexagon->size * 1.5;
        $y = $hexagon->height + $points[1] * $hexagon->height + ( ($points[0]%2) * ( $hexagon->height / 2 ) );
        $points = $hexagon->drawHex($x,$y, true);
        $pointss = array();
        foreach($points as $p) {
            $pointss[] = $p[0];
            $pointss[] = $p[1];
        }
        imagefilledpolygon ( $png_image , $pointss , 6 , $black );
    }
}

Result:
Inside every hex cell
(First line is QR coordinate)
(Second line is XYZ converted coordinate)

Any advice what I'm doing wrong?

Update:

As requested, the Oddq (Q,R) to Cube conversion XYZ

    $i = $hex[0] = ROW
    $j = $hex[2] = COLUMN
    public function oddq_to_cube($hex){
        $hex[2] = $hex[1];
        $x = $hex[2];
        $z = $hex[0] - ($hex[2] - ($hex[2]&1)) / 2;
        $y = -$x-$z;
        return array($x, $y, $z);
    }
    $curr_cube = $hexagon->oddq_to_cube(array($i,$j));

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

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

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

sentences: File caching on the PC Is it a good move to disable windows' file-caching capabilities (via I/O completion ports) for resource loading in a game environment? Most games will do their own resource management and caching anyways, so the OS will probably cache it a second time. Of course, you don't get the caching across the process' lifetime, but that's usually not a big downside. On the other hand, it probably makes file loading times more predictable - so you can actually give accurate load-time predictions.

sentences:
Why does this simple if-statement that checks my main characters state never get called (Java/LibGDX)? Been working on this for a while - basically I want my player to perform a front flip when he jumps (screen tap -> player jumps). I wrote the animation class Animator (extends Player implements ApplicationListener and my plan is to initialise it in Player (main character class) whenever his state becomes JUMPING. I did a few tests using System.print and found that when the screen is tapped (i.e. whenever touchDown() is called) the Player's state IS modified (using stateModifier("jumping").

However, the code inside if(state == playerState.JUMPING) in update() for some reason is never called. I know this is the case because the System.print I wrote never gets outputted. I'll throw my code in here since you will probably need to see the big picture:

public class Player extends GameObject implements InputProcessor {
private Animator jumpAnimation; // the class where the animation takes place
private playerState state; // enum of player states
private float gravity;
private boolean allowJump;
private float accelerationJump;
private Texture img;
private Sprite sprite;

public Player(float xPos, float yPos) {
    super(xPos, yPos);
    img = new Texture(Gdx.files.internal("JUMP1.png"));
    sprite = new Sprite(img);
    setxPos(xPos);
    setyPos(yPos);
    setxSpeed(4.6f);
    setySpeed(0);
    sprite.setX(getxPos());
    sprite.setY(getyPos());
    setType("player");
    gravity = 0.34f;
    accelerationX = 0.02f;
    accelerationJump = 14f;
    allowJump = true;
    Gdx.input.setInputProcessor(this);
    state = playerState.NORMAL;
}

// change the player state
public void stateModifier(String modify) {
    if (modify.equalsIgnoreCase("jetpack")) {
        state = playerState.JETPACK_MODE;
    } else if(modify.equalsIgnoreCase("normal")) {
        state = playerState.NORMAL;
    } else if(modify.equalsIgnoreCase("jumping")) {
        state = playerState.JUMPING;
        System.out.println(state);
}
}

public void update() {

    // Player's speed in the y plane is affected by gravity
    setySpeed(getySpeed() - gravity);
    // Player constantly moving
    moveBy(getxSpeed(), getySpeed());
    // Don't allow Player to fall below the ground due to gravity
    if (belowGround()) {
        moveTo(getxPos(), groundY);
    }
    // If Player is on the ground then he can jump, so set allowJump to true
    if (onGround()) {
        allowJump = true;
        setySpeed(0);
    }
    // if the player is in a jumping state, run the jump animation
    if (state == playerState.JUMPING) {
        // this print statement should get called when a player jumps but never does
        System.out.println("should animate right now");
        jumpAnimation = new Animator(getxPos(), getyPos());
    }
}

public void jump() {
    setySpeed(getySpeed() + accelerationJump);
}

@Override
public boolean touchDown(int screenX, int screenY, int pointer, int button) {
    // if the player is in a normal state (i.e. not jumping) and he is allowed to jump
    if (state == playerState.NORMAL && allowJump) {
        // set player state to playerState.JUMPING
        stateModifier("jumping");
        jump();
                    // set player state to playerState.NORMAL after the jump
        stateModifier("normal");
        allowJump = false;
    }
    return true;
}

}

Any help is highly appreciated, thank you very much.

tl;dr when screen is tapped, touchDown() is called, which changes the Player's state to JUMPING. however when i write an if statement in update() to check for this, it never gets executed. why is this the case?

sentences:
Psychology of pixelated lighting The situation
The game I'm working on has a 16-bit inspired art theme. It's consistency is relatively relaxed. (i.e. pixels don't have to line up.)
Since it has a slightly dark theme, I decided to light up only the surrounding area of the player. Though I'm town because I'm not sure which of the three methods are most appealing.
Method 1: Smooth lighting
I.e. a smooth gradient between the player and the surrounding area.

I fear it's smooth nature might feel off compared to the rest of the game's art,
Method 2: Pixelated lighting (without pixel alignment)
I.e. a pixelated gradient that doesn't necessarily have to line up with background tiles.

This is more in tune with the game's art, but it's lack of alignment is noticeable.

yellow lines are tile borders while teal lines are lighting borders
Method 3: Pixelated lighting (with pixel alignment)
Essentially the same as the previous method, except without the lack of alignment. This fits the game's art style well, but almost too well. I mean that in a way that the lighting is almost too pixelated.
Conclusion
Perhaps a combination of these methods is the most psycologically pleasing or maybe something completely differn't will fit the bill.
What are your guys' thoughts? / What have other games done in this situation?

sentences:
Add inertia to Pawn movement I've just started to learn Unreal Engine 4.26.2 while developing an Atari Pong clone.
This is how I have implemented the Paddle's movement (but this implementation doesn't accelerate or has inertia):
// Called to bind functionality to input
void APaddle::SetupPlayerInputComponent(UInputComponent* PlayerInputComponent)
{
    Super::SetupPlayerInputComponent(PlayerInputComponent);

    // Respond every frame to the values of our movement.
    InputComponent->BindAxis(TEXT("MovePaddle"), this, &APaddle::Move_ZAxis);
}

void APaddle::Move_ZAxis(float AxisValue)
{
    CurrentVelocity.Z = FMath::Clamp(AxisValue, -1.0f, 1.0f) * 100.0f;
}

But I want to do two things:

While the user is pressing the key the paddle movement will accelerate.

When the user release the key the Paddle won't stop immediately; instead, it will slowing down until it stops.

Is there anything done with Physics that I can use here or do I have to implement it by myself?
By the way, I'm not English and I don't know if inertia is the right word here.

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:
Unable to remove class information in serialized json file using libgdx I am encountering a problem in serializing an array of objects to json file. Please let me know where I'm making the mistake.

Object to be serialized :

package components;

public class UserGameInfo {
private int level;
private boolean isLocked;

public UserGameInfo() {

}

public UserGameInfo(final int level, final boolean isLocked) {
    this.level = level;
    this.isLocked = isLocked;
}
public int getLevel() {
    return level;
}
public void setLevel(int level) {
    this.level = level;
}
public boolean isLocked() {
    return isLocked;
}
public void setLocked(boolean isLocked) {
    this.isLocked = isLocked;
}
}

Object definitions:

  public class LevelsInfoFileReader {
  private Json fileJson;
  private Logger logger;
  private Array<LevelObjects> levelObjectsList;
  private Array<UserGameInfo> userGameObjectsList;
  ....
  }

Code for serializing the object :

    //write to the file
    try {
        FileHandle newFile = Gdx.files.local(userInfoFilePath);
        fileJson.toJson(userGameObjectsList, Array.class, UserGameInfo.class, newFile);
        System.out.println(fileJson.prettyPrint(userGameObjectsList));
    } catch (final Exception e) {
        logger.error("Could not save user data to the filepath", e);
    }

1st approach :

File contents after serialization :
[{level:1},{level:2},{level:3,isLocked:true},{level:4,isLocked:true},{level:5,isLocked:true},{level:6,isLocked:true},{level:7,isLocked:true},{level:8,isLocked:true},{level:9,isLocked:true},{level:10,isLocked:true}]

The problem here is that, though no class information is displayed, the boolean variable is not shown for level1 and level2 in the serialized json file. However, I put a debug point and checked the array object before serialization. It does contain the list properly as shown int the attached snapshot
2nd approach
The second approach I tried was with pretty print. However, the class information of the array elements is also displayed in the .json file :

Following is the .json file content :

[
{
class: components.UserGameInfo
level: 1
}
{
class: components.UserGameInfo
level: 2
}
{
class: components.UserGameInfo
level: 3
isLocked: true
}
]

My final expected output is :

[
{
"level": 1,
isLocked : false
}
{
"level": 2.
isLocked : false
}
{
"level": 3,
isLocked: true
}
]

sentences: How can non-CG shader code in Unity be included? In Unity shaders, #include, #define, and other preprocessor commands seem to not be able to be used outside the CGPROGRAM section of the shader. Since these are required for compiling multiple shader variants, and a large portion of the shader is non CG, this would be incredibly useful to reduce shader duplication. Do these commands exist outside CG?

sentences:
How does one escape the GPL? DISCLAIMER I don't pretend to know anything about licensing. In fact, everything I say below may be completely false!

Backstory:

  Recently, I've been looking for a decent game engine, and I think I've
  found one that I really like, Cafu Engine.

  However, they have a dual licensing plan, where everything you make
  with the engine is forced under GPL, unless you pay for a commercial
  license. I'm not saying that it's a bad engine, they even say that
  they are very relaxed about the licensing fees. However, the fact that
  it even involves the GPL scares me.

So my question is basicly, how does one escape the GPL.

Here's an example: The id Tech engine, also known as the Quake engine, or the Doom engine, was the base for the popular Source engine. However, the id Tech engine has been released under the GPL, and the Source engine is proprietary. Did Valve get a different license? Or did they do something to escape the GPL? Is there a way to escape the GPL? Or, if you use GPL'd source code as a base for another project, are you forced to use the GPL, and make your source code available to the world. Could some random person take the id Tech engine, modify it past the point of recognition, then use it as a proprietary engine for commercial products? Or are they required to make it open source.

One last thing, I generally have no problem what-so-ever with open source. However I feel that open source has it's place, but that is not in the bushiness world.

sentences:
glOrtho setting view I am duplicating this thread from stackoverflow, please remove it if that is not allowed.

I'm completely new in OpenGL. I have this problem: I have quite a complicated scene, and I am looking at it from the front (default camera position). The way I have seen to move the camera is using the gluLookAt() function to set the point you want to look at, and glTranslate3f() to move the camera position. I need to move the camera with different data - my data is not the point I want to look at - rather, I have the data of the projection plane - determined with a viewing vector and a point in the plane. Is there a way to set the camera using this data rather than a "look at" point?

I am using an ortographic projection (glOrtho()), so everything is projected onto the projection plane.

UPDATE: To be more precise: the point I have is a point in the plane, to which I want to project to. I have in fact not only the plane, but the square to which I need to project, defined. So I have a scene somewhere a space, and a square somewhere away from that scene. I want to project the scene to that square and show that projection on screen. I hope that made it a bit clearer what I need to achieve ... While gluLookAt defines a point in the scene at which to look at, and the position of the eye. While eye is one point in space and projection offers perspective, with ortographic projection, you do not have one point, you have a whole square on which to project to, so how can I define that?

For easier understanding what I am trying to achieve. Here is the image of what glOrtho normally does:

Here is an image of what I am trying to achieve:

sentences:
What is an example of a binary 3d file format? I'm new to GD so if this is too broad I apologize. I'm looking for some quick information.

What binary file format supports the basic game rendering information?

raw position vertices
Texture/UV
(or) Color
Normals
Animation keyframes

I'm aware that .obj and .dae have all of the above, however these files are in ascii. What file type supports these and is in binary?

And is it common to make custom 3d model format for one's game engine?

sentences:
How to avoid gimbal lock in Unreal Engine (c++)? I created an orbit camera (sometimes called turntable camera; similar to the one with the "use UE3 orbit controls" setting in a static mesh view).

I attached the camera to a USpringArmComponent with a TargetArmLength set to 400.
In the tick function, I rotate the arm with this simple method:

        // Simple, clamped version
        FRotator Rotation = CameraSpringArm->GetComponentRotation();
        Rotation.Yaw += CameraInput.X * CameraRotationSpeed;
        Rotation.Pitch = FMath::Clamp(Rotation.Pitch + CameraInput.Y * CameraRotationSpeed, -85.0f, 85.0f);
        CameraSpringArm->SetRelativeRotation(Rotation);

I had to clamp the pitch to hide the gimbal lock problem. But this prevent users to rotate completely around objects.
I don't understand why the Z rotation (the yaw) occurs on the world z axis ( FVector::UpVector which is (0, 0, 1)) and not on the local z axis. It turns out that this is exactly what I want.

I tried to solve this gimbal lock problem with this other method:

        // Taken from https://answers.unrealengine.com/questions/232923/how-can-i-avoid-gimbal-lock-in-code.html
        FRotator RotationDelta(CameraInput.Y * CameraRotationSpeed, CameraInput.X * CameraRotationSpeed, 0.f);
        FTransform NewTransform = CameraSpringArm->GetComponentTransform();
        NewTransform.ConcatenateRotation(RotationDelta.Quaternion());
        NewTransform.NormalizeRotation();
        CameraSpringArm->SetWorldTransform(NewTransform);

It works, but this time, the Z rotation (yaw) occurs on the local Z axis. How can I change it to rotate around the world Z axis, and the local Y axis, without gimbal lock?

I tried this hybrid solution, but the gimbal lock is still there:

        // Hybrid
        FRotator RotationDelta(CameraInput.Y * CameraRotationSpeed, 0.f, 0.f);
        FTransform Transform = CameraSpringArm->GetComponentTransform();
        FRotator Rotation = CameraSpringArm->GetComponentRotation();
        Rotation.Yaw += CameraInput.X * CameraRotationSpeed;
        Transform.SetRotation(Rotation.Quaternion());
        Transform.ConcatenateRotation(RotationDelta.Quaternion());
        Transform.NormalizeRotation();
        CameraSpringArm->SetWorldTransform(Transform);

I did solve this problem (a long time ago) in OpenGL using quaternions, so I tried this version:

        // Quaternion
        FRotator Rotator = CameraSpringArm->GetComponentRotation();
        FQuat Quaternion = Rotator.Quaternion();
        // Rotate around the world Z axis:
        Quaternion *= FQuat(FVector::UpVector, FMath::DegreesToRadians(CameraInput.X * CameraRotationSpeed));
        // Rotate around the local Y axis:
        Quaternion *= FQuat(Rotation.RotateVector(FVector::RightVector), FMath::DegreesToRadians(CameraInput.Y * CameraRotationSpeed));
        CameraSpringArm->SetRelativeTransform(Quaternion);

But this does not work. I also tried this:

        // Quaternion + transform
        FTransform Transform = CameraSpringArm->GetComponentTransform();
        Transform.ConcatenateRotation(FQuat(FVector::UpVector, FMath::DegreesToRadians(CameraInput.X * CameraRotationSpeed)));
        Transform.ConcatenateRotation(FQuat(Rotation.RotateVector(FVector::RightVector), FMath::DegreesToRadians(CameraInput.Y * CameraRotationSpeed)));
        Transform.NormalizeRotation();
        CameraSpringArm->SetWorldTransform(Transform);

without success.

sentences:
Authentication between client, central server, and player ran server I am developing an open source game that uses a client-server scheme similar to Minecraft. We will control the central authentication server that verifies an account is valid, while players will run their own servers.

Authenticating the client is simple, but how can the server know that the user is valid, without having any access to is credentials or session token?

For example:

Client > Auth Server: Sends user credentials.
Auth Server > Client: Responds with a session ID if valid login.

Then, the client can connect to the server, but the server has no way of verifying is the client is who it says. These servers are ran by players, which make it easy for them to modify the server and collect the user data. (Only the central auth server can be trusted)

The authentication server could accept TCP connections, but I wonder if HTTPS would be easier in this case, as getting a response is easier than establishing a listener on each side, especially for only a few requests.

sentences:
RPG Game Graphics Help/Review I've been working on an simple RPG game and I'm having troubles figuring out how my graphics should look.

I'm wondering if any of you could give some advice on how they are/could be more pleasing to the eye.

Here is a couple of screen shots of the game itself:

Any suggetions/comments!

Thanks!

Sorry, I'm unable to post more pictures, because of my repution :(

Edit:
 After some working on the look of the game here is where I got to...

sentences:
Model gets distorted when rotating the camera I'm currently developing my own 3d graphics engine and I'm having a hard time figuring out why my 3D models gets distorted when rotating the camera around.

This is my projection matrix. I'm following the OpenGL's Model.

def get_projection_mat(aspect_ratio, camera):
    fov = camera.fov
    z_near = camera.z_near
    z_far = camera.z_far
    top = math.tan(fov * 0.5) * z_near
    bottom = -top
    right = top * aspect_ratio
    left = -right
    projection_mat = np.identity(4, dtype=float)
    projection_mat[0, 0] = 2 * z_near / (right - left)
    projection_mat[0, 2] = (right + left) / (right - left)
    projection_mat[1, 1] = 2 * z_near / (top - bottom)
    projection_mat[1, 2] = (top + bottom) / (top - bottom)
    projection_mat[2, 2] = -(z_far + z_near) / (z_far - z_near)
    projection_mat[2, 3] = -2 * z_far * z_near / (z_far - z_near)
    projection_mat[3, 2] = -1
    projection_mat[3, 3] = 0

    return projection_mat

This is my view matrix:

def camera_matrix(self):
    camera_matrix = np.identity(4, dtype=float)
    camera_matrix[:3, 0] = self.left[:]
    camera_matrix[:3, 1] = self.up[:]
    camera_matrix[:3, 2] = self.forward[:]
    camera_matrix[:3, 3] = self.pos[:]

    return camera_matrix

This is how I get the ViewProjection matrix:

    projection_mat = get_projection_mat(self.aspect_ratio, self.camera)
    view_mat = self.camera.camera_matrix()
    view_mat = np.linalg.inv(view_mat)
    self.view_projection_mat = np.dot(projection_mat, view_mat)

And, finally, this is the ViewProjectionModel matrix:

    view_projection_model_mat = np.dot(model.transform_mat.T, self.view_projection_mat)

This is the method that I use to rotate the camera:

def rotate(self, yaw, pitch, degress=True):
    rotation_mat_y = helper.rotate_matrix_y(yaw, degrees)
    rotation_mat_x = helper.rotate_matrix_x(pitch, degrees)
    rotation_mat = np.dot(rotation_mat_y, rotation_mat_x)
    self.forward = np.dot(np.insert(self.forward, 3, 1), rotation_mat)
    self.forward = helper.normalized((self.forward / self.forward[3])[:3])
    self.up = np.dot(np.insert(self.up, 3, 1), rotation_mat)
    self.up = helper.normalized((self.up / self.up[3])[:3])
    self.left = np.dot(np.insert(self.left, 3, 1), rotation_mat)
    self.left = helper.normalized((self.left / self.left[3])[:3])

A video demo, showing the problem

To summarize, the order of multiplication is ProjectionMat X ViewMat x ModelMat x ModelFaces.
If it isn't clear by now, I'm using Python for this project.
Any help would be greatly appreciated.

With best regards,
João Pedro

EDIT: Like this?

    directions, r = np.linalg.qr(np.array([self.forward, self.up, self.left]))
    self.forward = directions[0]
    self.up = directions[1]
    self.left = directions[2]

sentences:
Steer a flock towards a target? Like in pikmin? Can a flock be steered towards a target ?

I've seen that flocking behavior has the alignement behavior, but can it be directed and steered toward a goal ?

http://www.youtube.com/watch?feature=player_detailpage&v=BKJyv4uqsWI#t=305

sentences:
How should I structure the implementation of turn-based board game rules? I'm trying to create a turn-based strategy game on a tilemap.

I'm using design by component so far, but I can't find a nice way to fit components into the part I want to ask.

I'm struggling with the "game rules" logic. That is, the code that displays the menu, allows the player to select units, and command them, then tells the unit game objects what to do given the player input. The best way I could thing of handling this was using a big state machine, so everything that could be done in a "turn" is handled by this state machine, and the update code of this state machine does different things depending on the state.

However, this approach leads to a large amount of code (anything not model-related) going into a big class. Of course I can subdivide this big class into more classes, but it doesn't feel modular and upgradable enough. I'd like to know of better systems to handle this in order to be able to upgrade the game with new rules without having a monstruous if/else chain (or switch / case, for that matter).

Any ideas? What specific design pattern other than MVC should I be using?

sentences:
Random Vector within a cone I'm looking to create a random vector within a cone given the radius (base).

It feels like I've been traversing through many pages on the internet and still I'm no further forward to getting an answer.

I was thinking I could get a point within the base of the cone and have it point towards the apex (then just use the inverse of that for my animation) but this seems like an incredibly long winded approach.

sentences:
How to make healthbar size relative to hp Like in most games with healthbars, the units in my game have a hp_bar object which is a frame, with a slightly smaller rectangle inside which should get smaller (and change color) as a unit loses hp, but I'm unsure how to work the math which will make the rectangle size an integer which represents an percentage rather than the actual hp.

Say the hp bar is 40 pixels in width, and hp is some arbitrary integer amount, what is the python magic to convert the hp to hp bar width?

sentences:
Problem using glm::lookAt and glm::perspective I'm trying to change the code from the 22th tutorial at http://ogldev.atspace.co.uk/, using the GLM library, but the result seems wrong.
The problem is shown in the below picture:

While it should be:

This program displays a model onto the screen. The model is loaded using a library and I ensure that all of its vertices, normals, and texuture coordinates are loaded correctly. The problem seems to be at creating the Projection - model - view matrix. I searched for the use of GLM and use the below code to calcualate that matrix:

    glm::vec3 Pos(3.0f, 7.0f, -10.0f);
    glm::vec3 Target(0.0f, -0.2f, 1.0f);
    glm::vec3 Up(0.0, 1.0f, 0.0f);

    glm::mat4 viewMat = glm::lookAt(Pos, Target, Up);
    glm::mat4 perMat = glm::perspective(60.0f, (float)WINDOW_WIDTH/WINDOW_HEIGHT, 1.0f, 100.0f);

    glm::mat4 modelMat = glm::scale(glm::mat4(1.0f),glm::vec3(0.1f, 0.1f, 0.1f));
    modelMat = glm::rotate(modelMat, m_scale, glm::vec3(0.0f, 1.0f, 0.0f));
    modelMat = glm::translate(modelMat, glm::vec3(0.0f, 0.0f, 10.0f));

    //FINAL MATRIX
    glm::mat4 PVMMat = perMat * viewMat * modelMat;

After that, I supplied the matrix to the shader like this:

glUniformMatrix4fv(m_WVPLocation, 1, GL_TRUE, &PVMMat[0][0]);

Finally, in the shader, I calculate the gl_Position as below:

//vertex shader
void main()
{
    gl_Position = gWVP * vec4(Position, 1.0);
    TexCoord0   = TexCoord;
    Normal0     = (gWorld * vec4(Normal, 0.0)).xyz;
    WorldPos0   = (gWorld * vec4(Position, 1.0)).xyz;
}";
//Fragment shader
void main()
{
    FragColor = texture2D(gSampler, TexCoord0.xy);
}";

I tried my best for a few days and I can't see any error in the way I use glm::lookAt and  gml::perspective. This is exactly as in the manual on the GLM website. Could you suggest some reason for the problems I'm seeing, or some way for me to further investigate the error? Thanks so much. I hope to see your answer.

sentences:
Path Planning in a chaotic, ever-changing environment I've implemented Path Planning a few times, using A* on nav meshes, and also Continuum Crowds but now I am trying to plan paths in very chaotic environments.

In this environment, new routes and new blockages are created constantly, and chaotically. This is because the environment is fully destructible, and the debris can create new obstacles.

In such an environment, nothing can be pre-computed. What would be a good way to sense the traversability in such a world? There is no concept of a grid in my world, b.t.w, but I wonder if I should introduce an artificial one for the purpose of planning.

But if navigation could be achieved without a grid, that would be much better of course.

Note that the navigation is not merely dynamic in the sense that certain transitions get opened/closed, but actually chaotic. This stops me from a simple approach of enabling/disabling certain edges on the navigation mesh. That approach would be usable if, e.g. a gate gets locked/unlocked. But in my case, in a blink of an eye, the routes could be drastically changed where simple mutations of a pre-computed mesh are not doable.

sentences:
Implementing score relative to total game time How would one create score dependent on total time in game? I would like the score to count by 1000+ each second the game is running for. Later I am going to add some coins which will give my total score +1000 also.

How would one create this functionality? This is all I have right now:

  let scoreDisplay = UILabel()
    scoreDisplay.text = "Score: \(self.score)"
    scoreDisplay.textColor = UIColor.red
    scoreDisplay.frame = CGRect(x: mainWidth / 2 - 200, y: mainHeight - 400, width: 247, height: 100)
    self.view.addSubview(scoreDisplay)

    let delay = SKAction.wait(forDuration: 0.25)
    let incrementScore = SKAction.run ({
        self.score = self.score + 1
        self.scoreDisplay.text = "\(self.score)"
    })

I'm pretty new to Swift, so sorry for my basic question!

sentences:
How to play more than one background song in XNA? The current tutorial I am using to play background songs only allows me to play one song throughout the entire game.

Link to tutorial --> http://rbwhitaker.wikidot.com/playing-background-music

I want to have multiple songs where after one song is finished playing another random song will be selected and played.

How would I do that?

Also I would not liked to get involved in XACT.

sentences:
How to make "Shaky mouse cursor" Before shoot the target Like in a Dart Game? I develop a shooting game. To make it harder I want to make the reticle shaky/move randomly.

I use Robot class to move random as suggest here.

But I modified it by adding an infinity loop and by surrounding it in a new Thread.

The shaky mouse cursor is running well, but I can't shoot the target because the infinity loop holds mouseClicked(MouseEvent e) to make a response. I'm confused because I've already tried to make a special thread for the random displacement of the mouse cursor but it still makes no response for my mouseClicked(MouseEvent e).

Any idea/solution please?

UPDATED POST :
i include the code here :

In GPanel.java :

1. For handle input from mouse hardware (from user when clicked the mouse)

@Override
public void mouseClicked(MouseEvent e) {
     int x = e.getX();
     int y = e.getY();
     System.out.println(ter.getInnerX()+"---------------"+ter.getInnerY());
    System.out.println(x+"=========================="+y);

   if(x>=ter.getInnerX()&&x<=ter.getInnerX()+54)
   {
       System.out.println("masuk");
       if(y>=ter.getInnerY()&&(y<=ter.getInnerY()+95))
       {
           System.out.println("kena");
       }
   }
}

2. Robot class Implemented :

@Override
public void run(){

while (true){
    try {
        updateCar();
        checkCollision();
        keylistener();
        Thread.sleep(20);
Robot robot = new Robot();
Random random = new Random();
boolean masuk=true;
int SECONDS=40;
while (true) {
    if(masuk)
    {
        robot.mouseMove(MouseInfo.getPointerInfo().getLocation().x+1, MouseInfo.getPointerInfo().getLocation().y);
        Thread.sleep(SECONDS);
        robot.mouseMove(MouseInfo.getPointerInfo().getLocation().x+1, MouseInfo.getPointerInfo().getLocation().y+1);
        Thread.sleep(SECONDS);
        robot.mouseMove(MouseInfo.getPointerInfo().getLocation().x, MouseInfo.getPointerInfo().getLocation().y+1);
        Thread.sleep(SECONDS);
        robot.mouseMove(MouseInfo.getPointerInfo().getLocation().x-1, MouseInfo.getPointerInfo().getLocation().y+1);
        Thread.sleep(SECONDS);
        robot.mouseMove(MouseInfo.getPointerInfo().getLocation().x-1, MouseInfo.getPointerInfo().getLocation().y);
        Thread.sleep(SECONDS);
        robot.mouseMove(MouseInfo.getPointerInfo().getLocation().x, MouseInfo.getPointerInfo().getLocation().y-1);
        masuk=false;
    }
else
    {
        robot.mouseMove(MouseInfo.getPointerInfo().getLocation().x-1, MouseInfo.getPointerInfo().getLocation().y);
        Thread.sleep(SECONDS);
        robot.mouseMove(MouseInfo.getPointerInfo().getLocation().x-1, MouseInfo.getPointerInfo().getLocation().y-1);
        Thread.sleep(SECONDS);
        robot.mouseMove(MouseInfo.getPointerInfo().getLocation().x, MouseInfo.getPointerInfo().getLocation().y-1);
        Thread.sleep(SECONDS);
        robot.mouseMove(MouseInfo.getPointerInfo().getLocation().x+1, MouseInfo.getPointerInfo().getLocation().y-1);
        Thread.sleep(SECONDS);
        robot.mouseMove(MouseInfo.getPointerInfo().getLocation().x+1, MouseInfo.getPointerInfo().getLocation().y);
        Thread.sleep(SECONDS);
        robot.mouseMove(MouseInfo.getPointerInfo().getLocation().x, MouseInfo.getPointerInfo().getLocation().y+1);
        masuk=true;
    }

}
    } catch (Exception e) {
        e.printStackTrace();
    }
    repaint();
}}

Number 1 for detect user's input by click the mouse.

Number 2 for implemented Robot.class to make shaky mouse cursor.

Both of number 1 and 2 are in GPanel.java

sentences:
Does swf provide better compress rate than zlib for png image? Somebody told me that when a png image is stored in swf, it's separated to several layer, hence the alpha channel can be compressed better. Is it true? Or, once png image is imported into a swf, it's format is changed, e.g converted into bitmap data, and than compressed by swf's compress algorithm. That's, it is not in png format anymore.
I don't know how swf packing its resource, please tell me if you know.

sentences:
The importance of WebGL in the future of game development I've recently stumbled upon some pretty impressive Babylon.js and PlayCanvas demos.

Babylon.js example
PlayCanvas example

As a reminder: these frameworks allow 3D rendering in any (up to date) web browser, using the WebGL library.

Along with node.js and Socket.io, those 3D engines make it possible to release real-time multiplayer 3D games.

For sure, such games will never compare to AAA titles running in more native environnments.
But a part of today's video game industry is leaning towards more simple, accessible games. Think about strategy games or (MMO)RPGs for example (or anything that doesn't require very low latency and high reactivity, like FPS do). Those Javascript libraries could do a pretty good job at it.

In addition, they make it easy to create multiplatform games, since any modern device with a web browser can run your game.

Another advantage is the "one click" accessibility (i.e. someone sends you an url -> you click on it -> you're playing the game), which can be a crucial advantage to spread your game.

I've seen some Unity games which could have been made in WebGL with only little drop in performances and visual quality (though I may be wrong here). And they could have benefited a lot from being playable in web browsers.

I'm actually surprised that we haven't already heard of some massively played 3D Web game. Why is it so? Do you think it will change in the future?

Even if one wants to argue that web-games aren't mature enough for 3D, then what about 2D? So many people are using engines such as Unity or Unreal 4 for relatively "simple" 2D games, while they could have made something totally similar with today's javascript, and potentially reached a wider audience.

sentences:
Slope scaled depth bias with normal maps I'm using a slope scaled depth bias to reduce shadow acne with shadow maps. However, it's causing artifacts when used with normal mapped surfaces because the bias varies over the surface, where it should really take the normal of the underlying geometry as a bias for all texels instead.

The bias is calculated like this:

float bias = 0.005 * tan(acos(dot(normal,-lightDirection)));

How can I get around this problem, when I don't have geometry information available while applying the shadow map (e.g. during lighting pass of deferred shader)?

sentences:
Tetris Glitchy Movement Fix Usual tetris game has 2D arrays for arena/piece and collision check with matrix comparison. To add smooth movement and auto alignment of pieces:

x and y are pixels on the screen

xMatrix [the cell that piece in it related to the x value]
yMatrix [the cell that piece in it related to the y value]
xCheck [(x +- amount) cell equivalent for collision check]
yCheck [(y +- amount) cell equivalent for collision check]
xOffset [x mod cell size]
yOffset [y mod cell size]

With These Updates New Game Loop:

if not collide(down)
    piece.y += amount
else
    merge

if left
    if not collide(left)
        piece.x -= amount
    else
        align

else if right
    if not collide(right)
        piece.x += amount
    else
        align

if key_release
    calculate_offset

if offset
    piece.x +- amount

is playable. But causes glitches on corner movements and out-of-bound errors for repetitive key presses sometimes. What can be the improvements on this code or what changes needed to be done?

sentences: OpenGL - must I always preserve data that is uploaded to a VBO? If I load my vertex data from a file into a buffer in RAM, and then upload this to the GPU (say, to a static VBO so no need to modify the data), do I need to keep that buffer around? If not, how do I know that the upload is complete?

sentences:
Trying to increase the size of a sprite when it touches a pellet in Unity with C# This is my first game, and I'm trying to keep it simple, so just a simple platformer that works around the size of the player's character, and the character increases in size whenever they consume a pellet. I have the character's basic movement down, but I'm coming across some errors that I'm not so sure how to fix.

The way I have it set up is that I have a script attached to an empty object called 'LevelManager' that will execute actions once it's called upon (Like 'Respawn Player' and 'Grow Player'), there is a 'Pellet' script attached to the pellet that basically calls upon the 'Grow Player' function when the player touches the pellet's collision box.

LevelManager.cs

public class LevelManager : MonoBehaviour {
    public GameObject currentCheckpoint;
    private PlayerController player;

    // Use this for initialization
    void Start () {
        player = FindObjectOfType<PlayerController> ();
    }

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

    }
    public void RespawnPlayer()
    {
        Debug.Log ("Player Has Respawned");
    }
    public void GrowPlayer()
    {
        Debug.Log ("Player Has Grown");
        player.transform.localScale += new Vector2(0.5, 0.5);
    }
}

Pellet.cs

public class Pellet : MonoBehaviour {
    public LevelManager levelManager;

    // Use this for initialization
    void Start () {
        levelManager = FindObjectOfType<LevelManager>();
    }

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

    }
    void OnTiggerEnter2D(Collider2D other)
    {
        if (other.name == "Player")
        {
            levelManager.GrowPlayer();
        }
    }
}

Also, I'm sorry I don't have the exact errors with me, something funky happened with the editor and I'm unable to locate the window for the compile errors anymore, and when the bug report I sent get's responded to, I'll add that in to make this an easier problem to tackle.

sentences:
Help on my glow shader! I'm trying to create a glow shader for a neon style game but I'm having a little trouble with rendertargets. Right now all I want is something VERY simple where I change the rendertarget, draw to it and then pass it into the shader. A lot of the examples I've looked at do the first part but don't include how to pass it all through a shader. Right now I'm not really concerned about the glow part, I just want to get it passing through a shader so I can work on the glow part.

edit - new code:

graphicsDevice.SetRenderTarget(renderTarget);

..
..
..

graphicsDevice.SetRenderTarget(null);

renderTargetTexture = (Texture2D)renderTarget;
loader.GlowShader.Parameters["glowTexture"].SetValue(renderTargetTexture);

for (int l = 0; l < loader.GlowShader.CurrentTechnique.Passes.Count; l++)
{
    loader.GlowShader.CurrentTechnique.Passes[l].Apply();
}

renderQuad.Draw();

And the glow shader (this is probaly really messy but I'm not really fuzzed about that right now, I just want the basic thing to work):

float4x4 World;
float4x4 View;
float4x4 Projection;

Texture glowTexture;

sampler glowSampler = sampler_state
{
texture = <glowTexture>;
magfilter = LINEAR;
minfilter = LINEAR;
mipfilter = LINEAR;
AddressU = clamp;
AddressV = clamp;
};

struct VertexShaderInput
{
float4 Position : POSITION0;
};

struct VertexShaderOutput
{
float4 Position : POSITION0;
};

VertexShaderOutput VSOutline(VertexShaderInput input)
{
VertexShaderOutput output;

float4 worldPosition = mul(input.Position, World);
float4 viewPosition = mul(worldPosition, View);

output.Position = mul(viewPosition, Projection);

return output;
}

float4 PSOutline(VertexShaderOutput input, float2 pixel:VPOS) : COLOR0
{
float2 uvPixel = (pixel + 0.5) * float2(1.0 / 1600, 1.0 / 900);
    return tex2D(glowSampler, uvPixel);
}

technique Outline
{
pass Pass1
{
    AlphaBlendEnable = TRUE;
    DestBlend = INVSRCALPHA;
    SrcBlend = SRCALPHA;

    VertexShader = compile vs_3_0 VSOutline();
    PixelShader = compile ps_3_0 PSOutline();
}
}

On a side note, if I try running this and drawing it using sprite batches it works so I think up until "rendertargetTexture = (Texture2D)renderTarget" everything is correct. It's just when I try to use the quads that nothing appears still.

        graphicsDevice.Clear(ClearOptions.Target | ClearOptions.DepthBuffer, Color.DarkSlateBlue, 1.0f, 0);
        using (SpriteBatch sprite = new SpriteBatch(graphicsDevice))
        {
            sprite.Begin();
            sprite.Draw(renderTargetTexture, new Vector2(0, 0), null, Color.White, 0, new Vector2(0, 0), 1, SpriteEffects.None, 1);
            sprite.End();
        }

sentences:
Render a 3D scene in multiple windows - extended panoramic view Is there any resource location on how to view a 3D scene from an application or a game on multiple windows or monitors? Each window should continue drawing from where the neighbouring one left off (in the end, the result should be a mosaic of the scene).

My idea is to use a camera for each window and have a reference position and orientation for a meta-camera object that is used to correctly offset the other cameras (e.g. like in the above figure where the render targets of the two cameras reproduce the star when stitched together). Since there are quite some elements to consider (window specs, viewport properties, position-orientation of each render camera), what is the correct way to update the individual cameras considering the position and orientation of the central, meta-camera? I currently cannot make the cameras present the scene contiguously (and I am reluctant in working out the transformations without checking whether this is the actual way of doing things).

sentences:
When should one use LibGDX's FrameBuffer and when SpriteCache? In my game I have some graphics that I want to draw once and only redraw whenever something is changed by the player. Now, I'm wondering, whether I should use the FrameBuffer or the SpriteCache class.
I know that a framebuffer is much more general concept and also works for 3D, while a SpriteCache is only for 2D. However it seems to me that they would both make sense in my use case, so I'm wondering..

What are the differences, drawbacks and advantages of using one over the other?

sentences: How to test a turn-based ios Game Center game with 2 devices? This might well be a very dumb question, but here goes anyway, I'm planning my turn-based ios game center game, obviously I know I'll need 2 iDevices to test it on, but how would I test the online turn-based play between the devices? As I'm to understand it, if the 2 devices are local (i'e close to each other) they automatically revert to a local communication method? is it possible to force them to communicate online so I can test that part of the project?

sentences:
How can I solve this SAT direct corner intersection edge case? I have a working SAT implementation, but I am running into a problem where direct collisions at a corner do not work for tiled surfaces. That is, it clips on the surface when going in a certain direction because it gets hung up on one of the tiles, and so, for example, if I walk across a floor while holding both down and left, the player will stop when meeting the next shape because the player will be colliding with the right side rather than with the top of the floor tile.

This illustration shows what I mean:

The top block will translate right first and then up.

I have checked here and here which are helpful, but this does not address what I should do in a situation where I don't have a tile-based world. My usage of the term "tile" before isn't really accurate since what I'm doing here is manually placing square obstacles next to each other, not assigning them spots on a grid.

What can I do to fix this?

sentences:
Do I need a database to support a sign-in system to associate a player with their save/highscore data? I am making a 2d game with Unity, and in my game I want to add a username and a password for each player, so that when the player signs in, they will get all the data about what they played until the moment they signed in (like their highscore and so on)

So my question is: do I need to use a database like sqlite, or could this be done with Unity without needing an external database?

sentences:
Numerical differentiation to calculate size of circular buffer I'm using Allegro 5 to create a software-generated "motion blur" effect for my 2D sprites. I basically just have a boost::circular_buffer of some length which holds "snapshots" of the sprite going back in time. Each render cycle a new "snapshot" of the main sprite is pushed onto the front of the buffer, and the last is popped off the back. The "snapshots" are then rendered with alpha values scaled by how old/far back in the buffer they are.

To save on CPU power I'd like to have the circular buffer dynamically resized so that the length of the trail is proportional to the object's velocity, i.e. don't store and push back lots of snapshots for trail sprites that won't be needed anyway because the object is moving too slowly.

The inputs I have to the data structure that holds the main sprite and its associated effect buffer are just the dx and dy values of how much its position vector changed since the last update cycle of the game logic. So I'm looking for a suggestion for an algorithm that can use that to increment/decrement some kind of unsigned counter that can be used to resize the buffer proportional to velocity.

sentences:
Is good practice to optimize FPS even when it's above the lower limit to give illusion of movement? I started over 50 FPS on the iPhone, but now I'm bellow 30 PFS, I've seen most iPhone games clamped to either 60 or 30 FPS, even when 24 or less would give the illusion of movement.

I've concidered my limit to be a little bit over 15 FPS, in fact my physics simulation is updated at that rate (15.84 steps/s) as that is the lowest that still give fluid movement, a bit lower gives jerky motion.

Is there a practical reason why to clamp FPS way above the lower limit?

Update:

The following image could help to clarify

I can independently set the physic simulation step, frame rate, and simulation interval update.

My concern is why should I clamp any of those to values greater than the minimum?

For instance to conserve battery life I could just to choose the lower limits, but it seems that 60 or 30 FPS are the most used values.

sentences:
Multiplayer Testing with Steam Accounts I'm build a multiplayer first person shooter, that supports 32 players.

What is the best way to test large quantities of players?

I'll need 32 steam accounts, with 32 machines to run on. Less, if I can switch to virtual machines.

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:
GLSL Fragment Shader compiles fine on certain computers I got this piece of code in a fragment shader:

if (color.a < 0.01f)
    discard;

It runs fine on an older graphic card but can't even compile on my newer (maybe not new, but..) GTX 770. I got the most recent drivers and everything. The versions is correct. OpenGL 4.4. The shader compiles like normal if I remove the discard statement.

I've been searching around and I'm finding nothing about this. Does the discard just not work on certain graphic cards or what?

sentences:
What are the consequences of adding a progress stat to a live Steam achievement? Say I have an achievement in my game, "Collect your first thingamajig", and I publish this to the live version of the game without a progress stat. Later on I decide I want to add some new achievements in an update, including one based on the previous achievement: "Collect 10 thingamajigs".

I create a progress stat for this one which is updated in code, but I also edit the original achievement so that it's unlocked through the progress stat rather than an AwardFirstThingamajigAchievement() function in code.

What are the consequences of this? Will a player that already had this unlocked find the achievement has been relocked because the achievement has been edited, technically making it a new one? Will it remain unlocked, but still cause a little popup for the first achievement on the next Thingamajig collected? Or will Steam simply not touch already unlocked achievements?

sentences:
Splitting game into multiple standalone parts I'm digging into Starling's CitrusEngine game engine. I try to understand the idea of structuring the game.

If you take a look at chrome.angrybirds.com or puddingmonsters.com you see that games load states (StarlingState's assets) dynamically which is smart. When the game starts a splash-screen displays, then you get a pre-loader which loads the main state (home, settings and choose-level view) and when you select a level a pre-loader displays again which loads the level state. This looks like they've constructed multiple parts for the game and then connect them together where the pre-loader is displayed when switching from one part to other.

How should we do that in Starling/CitrusEngine? What's the logic here? Flash games usually load all assets at the beginning which is not smart on mobile devices. Is it wise to have multiple StarlingCitrusEngine classes or you should handle the whole game in a single StarlingCitrusEngine class? Please explain in details.

Many thanks for answers.

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: Having unity game saved to SD card can't run on certain devices but after it's moved to phone memory it works.. why? A game I made ends up not being able to run (it shows the loading screen but after that it gets stuck), happens on nexus 5, sony experia z3 and I found this happening because the game was downloaded into the sd card memory. After moving it to the phone the game runs. I'm not sure why this is happening. Please help?

sentences:
Quat.AngleAxis broken on one axis I have a scene in my game where you create your own designs by placing static meshes and manipulating their scales, positions, and rotations.

For the rotations I'm using Quaterion.AngleAxis as so:

        if (toolMode == PositioningTool.Rotate)
        {
            switch (grabbedCollider.transform.name)
            {
                case "X":
                    focus.localRotation *= Quaternion.AngleAxis(delta.x * 90 * Time.deltaTime, transform.right);
                    break;
                case "Y":
                    focus.localRotation *= Quaternion.AngleAxis(delta.x * 90 * Time.deltaTime, transform.up);
                    break;
                case "Z":
                    focus.localRotation *= Quaternion.AngleAxis(delta.x * 90 * Time.deltaTime, transform.forward);
                    break;
            }
        }

where delta is the mouse movement for that frame, focus is the object I am manipulating, and transform is the transform component of the ToolArm that the player interacts with. toolarm.position is set to focus.position every frame

my problem arises when I try to do a rotation on my x axis. my other axis will spin 360 and beyond, spinning in circles endlessly. when x axis is used, it only rotates from -90 to 90 (as seen in the unity editor). What am I doing wrong?

sentences:
Isometric 2D game without tiles. Is there a solution? Is it possible to create an isometric view of the game without the use of tiles?

I've already searched in stackoverflow.com and gamedev.stackexchange.com, but I could not find a simple solution for isometric maps using Corona SDK.

My goal is to create something like this picture:
KRu.jpg

Do you think the game is made with tiles or not? Is using tiles the only solution for this kind of game?

Problems that I do not understand:
– Overlapping objects that are farther
– Change overlapping sprite when it moves around the map. When an object moves, some of its facilities will be closed, others are not. What is the logic of such a task?
– The logic of the movement of objects along a path with no tiles

I do not want to reinvent itself what must have already decided.

If the tiles can not be avoided, I ask once again to leave links to materials that will solve the problem of isometry in the Corona SDK.

sentences:
swipe effect problem using only mesh and array - libgdx I tried to combine matdesl's and libgdx's draw lines algo ang code. but i can only create a line.

problem is i want to make a fruit ninja swipe effect but only knows this... problem is i want to make a fruit ninja swipe effect but only knows this... anyone try to help me on improving just a line to have a swipe effect like fruit ninja?

    public class GameTouch {

private static final int MAX_LINES = 1000;
private OrthographicCamera camera;
private Mesh lineMesh;
private Vector3 unprojectedVertex = new Vector3();
private FixedList<Vector2> list;

public GameTouch(){
    this.camera = new OrthographicCamera(Gdx.graphics.getWidth(), Gdx.graphics.getHeight());
    lineMesh = new Mesh(false, MAX_LINES , 0, new VertexAttribute(Usage.Position, 2, "a_pos"));
    list = new FixedList<Vector2>();
}

public void update(float delta){

    camera.update();
    camera.apply(Gdx.gl10);

    if(Gdx.input.isTouched()){
        unprojectedVertex.set(Gdx.input.getX(), Gdx.input.getY(), 0);
        camera.unproject(unprojectedVertex);
        Vector2 input = new Vector2();
        input.x = unprojectedVertex.x;
        input.y = unprojectedVertex.y;

        if(list.size > 0){

            Vector2 temp = new Vector2();
            float sqlen = temp.set(input).sub(list.get(0)).len2();
            Array<Vector2> tempA = new FixedList<Vector2>();
            if(sqlen >= 3){
                list.insert(input);

            }

            lineMesh.setVertices(getVertices(list), 0, list.size * 2);

        }else{
            list.insert(input);
        }
    }else{

         if(list.size > 0){
            list.removeIndex(list.size - 1);
         }
    }
    if(list.size > 2){
        //lineMesh
        lineMesh.render(GL10.GL_TRIANGLE_STRIP);
        Gdx.gl10.glColor4f(0f, 0f, 1, 0.5f);
    }
}

private float[] getVertices(Array<Vector2> list){
    float[] vertices = new float[list.size * 2];
    int counter = 0;
    for(Vector2 vertex : list){
        vertices[counter++] = vertex.x;
        vertices[counter++] = vertex.y;
    }

    return vertices;
}

private class FixedList<T> extends Array<T>{

        public FixedList(){
            super(Vector2.class);
        }

        public FixedList(int capacity , Class<T> type){
            super(false, capacity , type);
        }

        public void insert(T t){
            T[] items = this.items;

            size = Math.min(size + 1 , items.length);

            for(int i = size - 1 ; i > 0 ; i--){
                items[i] = items[i - 1];
            }

            items[0] = t;
        }
    }
}

sentences:
Divert gameobject around mesh surface I am trying to find a way to divert a vector3 position around the surface of a mesh which doesn't have a collider. I have a function (found online) that calculates the closest position on the surface of the mesh but it only works if the position is outside the mesh.

In the diagram below, the red arrow represents whats currently happening. It works great when it's outside the mesh and will give a position on the surface of the mesh, but once it moves forward and enters the mesh, it just keeps walking straight. The green line shows what i would like to happen.

sentences:
iPhone point-and-click adventure game port structure I am porting an AGS game to iPhone, and was wondering what the best approach to the port would be?

How best would you structure your code and assets?

More specifically, how would you deal with say 100+ scenes. My initial approach is to create a scene superclass with things common between all scenes, like backgrounds, music, doors, windows, characters. Then for each scene an inherited version of that superclass with more particular things like checks, dependencies etc. Upon entering the scene, you'd check for dependencies and go from there. This is all off the top of my head mind you, so probably forgetting quite a bit.

sentences: Any Open Source Games That Can Be Ported to Android? I'm looking for some other open source games out there that I can port (easily or not) to Android.  I know that it's possible to port Wolfenstein and Doom and was wondering if there are any others out there.  I was thinking of Civilization (I remember a linux port some time back) and a few others.  It can be in C/C++ or Java.  Thanks in advance.

sentences:
Is Table the only layout that I can use in libgdx? I'm looking for the common way to handle the layout in libgdx.
I searched google and found only table layout.
Meanwhile I don't use any layout and just insert coordination into each visual object but I think that this is not the proper way to do it...
Is their any other layout that I can use?

p.s
The game layout should split into two parts, left is smaller that the right and contains things like score time and info about stuff in the game. The right part will display the game-play itself

sentences:
How to read a custom binary file made with Adobe air into Unity 3D & C# I have a custom data file from a project that was authored in actionscript some years ago by another developer.  I am porting parts of the project over to Unity 3D.  I don't have any documentation for the original project (I hope to speak to the original developers at some point but I cannot wait for that).

The file is a special bitmap that represents the positions of objects on a grid.  The custom file is created using an editor created in Adobe air.  I believe (not knowing any better) that the source code I have for the file decoder is the same source from the editor.  I don't have the editor source code.

Where I am getting into trouble is the binary file. From what I can tell at the moment, the file is a compressed byte array on the Adobe air side of things.  I don't believe I can just load the compressed file with Unity3D as a resource object. I would like to decompress the file and use it as an asset in Unity.

I am trying to figure how to decompress the binary file.  I have tried viewing the file contents in a hex editor to establish what the compression format is with no joy; I have not done anything specifically like this before .  I have tried to use gzip and a few other apps to decompress the file.

Form what I have read in the action script documentation that the default compression should be zlib.

Here is some edited code from the original project for decoding the bitmap:

import flash.utils.ByteArray;

public function decode(byteArray:ByteArray):Boolean
    {
        var i:uint;
        var j:uint;

        if(colourMap!=null)
        {
            colourMap.dispose();
            depthMap.dispose();
        }

        byteArray.uncompress();
        byteArray.position=0;

        var fileVersion:String=byteArray.readUTFBytes(FILE_VERSION.length);

        if(fileVersion==FILE_VERSION)
        {
            numWidth=byteArray.readUnsignedInt();
            numHeight=byteArray.readUnsignedInt();

            if(numWidth==0)
            {
                numWidth=30;
                trace("WARNING FOR SOME REASON WIDTH WAS 0 FROM FILE");
            }

            if(numHeight==0)
            {
                numHeight=30;
                trace("WARNING FOR SOME REASON HEIGHT WAS 0 FROM FILE");
            }

Here is a hex dump of the initial part of the binary data file:

78 da ec bd 55 cf 6c 5d 76 a5 79 7c 53 2a ff 8c

sentences: Top view physics engine For my first game i want to create a topview game in c++ where you can drive a car (like in gta2). As far as i know i dont need any gravity. While doing a bit of research about games they often advice a physics engine. What are the benefits of a physics engine on a topview game?

sentences:
How to combine depth and stencil tests? I have a continuous height-mapped mesh to represent landscape. I use the stencil test to create holes in the mesh. I draw holes to the stencil buffer and then use it to discard mesh fragments. Everything works fine except that my holes are visible through the mesh even if they are occluded by higher ground.

Is there any way to apply depth testing to a hole, keeping my mesh drawn in a single call to glDrawElements?

sentences:
OpenGL: Precompute a texture rotation I'm trying to speed up particles, and one way to do that is by precomputing the texture rotations. What I want to do is load the texture, rotate it and save it to a handle.

How would I go about doing this?

Thanks in advance.

sentences:
Determining axis to rotate around I'm trying to implement a free-look third person camera (using glm). I know that the general transformation is

newCameraPosition = translate(lookatPoint) * rotation(angle,axis) * translate(-lookatPoint);

So I need to find the axis to rotate around, with the constraint that I give the algorithm an axis in camera space to rotate around. Sounds confusing.

For example, let's take a camera that points up (0,1,0), is positioned in the XY plane at (-1,0,0) and is looking at the origin (0,0,0). So it is looking "along the x-axis".

Now I want to rotate the camera around the "camera-space-x-axis" (1,0,0). In words: The axis that "points to the right" when looking through the camera. Simply rotating around (1,0,0) doesn't work, since it will rotate the camera around the world-space x-axis. From the point of the camera however, the x-axis is in fact the z-axis in world space (0,0,1);

How do I go from the given camera-space axis to the world-space axis? I've tried just applying the inverse transform of the current camera transform to the given camera-space axis using

glm::vec3 rotateAxis = swizzle<X,Y,Z>(glm::inverse(GetCameraTransform()) * cameraSpaceAxis);

where cameraSpaceAxis.w = 0;

but that produces wrong results, e.g. if I give the algorithm the axis (1,0,0) to rotate around, continuously rotation around it in 1 degree steps just creates a wobbly circular motion around y and x axis;

sentences:
Simple scripting language for "one-liner"-type scripts? Can you recommend a scripting language which allows me to easily parse "one-liner" types of scripts (they're just commands, really)?

For example, a C/C++ function which simply sets the value of a 2-dimensional vector (position, for example):

void SetVector(Vector2 &vector, float x, float y)
{
    vector.x = x;
    vector.y = y;
}

And in the scripting language, the entire script should be able to just be one line long. For example, this would be a script to set the components of vector "a" to 123.0f and 456.0f (x and y) (syntax of the language doesn't really matter, just as an example):

set_vector a 123,456

I'd use these short scripts to do simple things like change the position of objects during runtime (for debugging or other purposes), create simple config files for all kinds of entities which would go like:

bomb.script:

set_damage 1000
set_range 250
set_texture Data/Sprites/bomb.png

etc.

From a superficial glance, Lua, AngelScript etc. seem to be a little bit bloated for my simple needs (Although I must admit I haven't put tons of time into those two). Can you recommend something better?

sentences:
For deferred rendering and SSAO, what coordinate system are the normals actually in? So, I'm following the very helpful LearnOpenGL online tutorials, and I'm working on implementing SSAO. I don't have a deferred rendering pipeline, but I need to collect normals during my depth pass so that I can sample them for the SSAO effect.  I'm following this tutorial: https://learnopengl.com/Advanced-Lighting/SSAO, and referencing this one when needed: https://learnopengl.com/Advanced-Lighting/Deferred-Shading.
However, neither of these tutorials really explain what's going on with the normals. What is the normalMatrix being used in the shader?
mat3 normalMatrix = transpose(inverse(mat3(view * model)));
Normal = normalMatrix * (invertedNormals ? -aNormal : aNormal);

I'm not worried about the invertexNormals conditional, that's probably just something weird the author added for handling different conventions, but what the heck is going on with that normalMatrix? Why would we invert the view * model matrix? If we're starting with aNormal in object space (whether it's coming directly from a vertex buffer or from a normal map TBN calculation), I can't for the life of me figure out what coordinate system that resulting normal is going to end up in!
So, long story short, what coordinate frame should my normals be in if I'm to use them for SSAO? World space? View Space? Clip space? None of the above? If it's some weird coordinate system, can somebody help me get there? I'm probably more confused than I should be.

sentences:
Question about segment of code in XNA Basically when the code says

public static Camera Instance
{
// Code and something with get statement
}

Is it declaring a method? I don't think it is a method because there is no parenthesis to indicate the area to put in parameters.
Here is the full class:

using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using Microsoft.Xna.Framework;

namespace ScrollingTest
{
    public class Camera
    {
    private static Camera instance;
    public static Camera Instance
    {
        get
        {
            if (instance == null)
                instance = new Camera();
            return instance;

        }

    }
}
}

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:
Calculating Minimum Translation Vector in Separating Axis Theorem based algorithm In the 2D SAT collision determination algorithm, you project the convex polygons onto each potential separating axis. Supposing the polygons intersect, from what I understand, the axis for which the overlap of the projections is the smallest determines the minimum translation vector. The MTV direction is parallel to the separating axis and the magnitude is the length of the overlap.

When calculating the overlap, however, I'm wondering if it is necessary to account for different overlap scenarios.

We have projection intervals (for some axis) (a, b) and (c, d). (a, b) comes from the polygon who normals we're currently testing as separating axes.

Case 1:

Case 2:

Intuitively, the overlap in the first case is b - c, and the overlap in the second case is d - a. And if this turns out the be the axis of minimum overlap, you might want to flip the MTV direction in one of the above cases, depending on what you are doing.

However, I'm wondering if it is actually necessary to consider the d - a interval. I.e., is there a proof of something to the effect that, when d - a is less than b - c, that the axis cannot possibly be the axis of minimum overlap (or, if it is, that we could have used another edge's normal, such that its projections' b - c interval was the minimum overlap)? In the second case, it is true -- d - a is less than b - c, and there is a smaller axis of overlap (e.g. b - c when the axis is the red polygon's upper edge normal).

But does this hold in general? Is there a simple counter example?

sentences:
Can't figure out what's making the player teleport back to spawn I've been working on a multiplayer game that uses pathfinding and I'm really confused over this one weird bug.  On your screen, the other player glitches between the spawn point and his current location.  It seems like there's a problem with the interpolation as it doesn't do this when I comment out:

transform.position = Vector3.Lerp(transform.position, bestGuessPosition, Time.deltaTime * latencySmoothingFactor);

Does this have anything to do with the way I'm moving the player?

using UnityEngine;
using UnityEngine.AI;
using UnityEngine.Networking;

public class MinionController : NetworkBehaviour {

    public Camera cam;

    public NavMeshAgent agent;

    Vector3 velocity;
    Vector3 bestGuessPosition;

    float ourLatency;
    float latencySmoothingFactor = 10;

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

        if (hasAuthority == false)
        {
            bestGuessPosition = bestGuessPosition + (velocity * Time.deltaTime);
            transform.position = Vector3.Lerp(transform.position, bestGuessPosition, Time.deltaTime * latencySmoothingFactor);
            return;
        }

        if (Input.GetMouseButtonDown(0))
        {
            Ray ray = cam.ScreenPointToRay(Input.mousePosition);
            RaycastHit hit;

            if (Physics.Raycast(ray, out hit))
            {
                agent.SetDestination(hit.point);
            }
        }
    }

    [Command]
    void CmdUpdateVelocity(Vector3 v, Vector3 p)
    {
        transform.position = p;
        velocity = v;

        RpcUpdateVelocity(velocity, transform.position);
    }

    [ClientRpc]
    void RpcUpdateVelocity(Vector3 v, Vector3 p)
    {

        if (hasAuthority)
        {
            return;
        }

        velocity = v;
        bestGuessPosition = p + (velocity * (ourLatency));
    }
}

sentences:
Only 1 side is rendered I'm trying to get my .blend object into Unity but for some reason I see it differently in Unity than in Blender.

I was trying to solve the problem and someone said that I have to go to the edit mode, then mesh, then change the normals but that is not working for me.

Here is what I mean:

sentences:
2D Camera doesn't work when I have split my code into DrawableComponents I have the following camera written:

public class Camera
{
    public Vector2 Position;

    Viewport Viewport;

    public Matrix Transformation
    {
        get
        {
            return Matrix.CreateTranslation(new Vector3(-this.Position.X, -this.Position.Y, 0)) *

            Matrix.CreateRotationZ(0f) *
            Matrix.CreateScale(new Vector3(1f, 1f, 1)) *
            Matrix.CreateTranslation(new Vector3(Viewport.Width * 0.5f, Viewport.Height * 0.5f, 0));
        }
    }

    public Camera(GraphicsDevice device)
    {
        this.Position = Vector2.Zero;

        this.Viewport = device.Viewport;
    }
}

Now while this does work in tutorials where you have all your drawing in the Game.Draw like this:

protected override void Draw(GameTime gameTime)
        {
            this.GraphicsDevice.Clear(Color.SkyBlue);

            this.SpriteBatch.Begin(SpriteSortMode.BackToFront, BlendState.AlphaBlend, null, null, null, null, cam.Transformation);

            this.Player.Draw(this.SpriteBatch);
            this.World.Draw(this.SpriteBatch);
            this.Enemies.Draw(this.SpriteBatch);

            this.SpriteBatch.End();

            base.Draw(gameTime);
        }

It fails when you have your code organized in DrawableGameComponents (which I have).
Now, technically speaking I could add the Camera as a service in the game, retrieve it in the constructor of my DrawableGameComponents, add it as a field within the Component and then edit the spriteBatch.Begin() within the Draw of each component like it is shown above. So actually that it WOULD look like this:

public class TestComponent : DrawableGameComponent
    {
        Camera Camera;

        SpriteBatch Batch;

        public TestComponent(Game game)
            : base(game)
        {
            this.Camera = (Camera)this.Game.Services.GetService(typeof(Camera));
            this.Batch = (SpriteBatch)this.Game.Services.GetService(typeof(SpriteBatch));
        }

        public override void Draw(GameTime gameTime)
        {
            this.Batch.Begin(SpriteSortMode.BackToFront, BlendState.AlphaBlend, null, null, null, null, this.Camera.Transformation);

            // draw the component

            this.Batch.End();

            base.Draw(gameTime);
        }
    }

But as you might already have guessed this is a bad idea because it's basically redundant.

Is there a way I can maintain this at a central location?

sentences:
Should I be sharing data between graphics and physics engine in the game? I'm writing the game engine that consists of few modules. Two of them are the graphics engine and the physics engine.

I wonder if it's a good solution to share data between them?

Two ways (sharing or not) looks like that:

Without sharing data

GraphicsModel{
    //some common for graphics and physics data like position

    //some only graphic data
    //like textures and detailed model's verticles that physics doesn't need
};

PhysicsModel{
    //some common for graphics and physics data like position

    //some only physics data
    //usually my physics data contains A LOT more informations than graphics data
}

engine3D->createModel3D(...);
physicsEngine->createModel3D(...);

//connect graphics and physics data
//e.g. update graphics model's position when physics model's position will change

I see two main problems:

A lot of redundant data (like two positions for both physics and graphics data)
Problem with updating data (I have to manually update graphics data when physics data changes)

With sharing data

Model{
     //some common for graphics and physics data like position
};

GraphicModel : public Model{
    //some only graphics data
    //like textures and detailed model's verticles that physics doesn't need
};

PhysicsModel : public Model{
     //some only physics data
    //usually my physics data contains A LOT more informations than graphics data
}

model = engine3D->createModel3D(...);
physicsEngine->assingModel3D(&model); //will cast to
//PhysicsModel for it's purposes??

//when physics changes anything (like position) in model
//(which it treats like PhysicsModel), the position for graphics data
//will change as well (because it's the same model)

Problems here:

physicsEngine cannot create new objects, just "assing" existing ones from engine3D (somehow it looks more anti-independent for me)
Casting data in assingModel3D function
physicsEngine and graphicsEngine must be careful - they cannot delete data when they don't need them (because second one may need it). But it's rare situation. Moreover, they can just delete the pointer, not the object. Or we can assume that graphicsEngine will delete objects, physicsEngine just pointers to them.

Which way is better?

Which will produce more problems in the future?

I like the second solution more, but I wonder why most graphics and physics engines prefer the first one (maybe because they normally make only graphics or only physics engine and somebody else connect them in the game?).

Have they any more hidden pros & contras?

sentences:
what does AngleVectors method in quake 3 source code does I just downloaded quake 3 for learning purposes.
I know some of some linear algebra(basic vector math ie: dot,cross product).
However I can't decipher what below method does, I know what is yaw,pitch and roll.
But I can't connect these with vector.
Worse, I'm not sure this fall under what math 'category', so I don't really know how to google.
Hence the question here.
Anyone?

void AngleVectors( const vec3_t angles, vec3_t forward, vec3_t right, vec3_t up) {
float       angle;
static float        sr, sp, sy, cr, cp, cy;
// static to help MS compiler fp bugs

angle = angles[YAW] * (M_PI*2 / 360);
sy = sin(angle);
cy = cos(angle);
angle = angles[PITCH] * (M_PI*2 / 360);
sp = sin(angle);
cp = cos(angle);
angle = angles[ROLL] * (M_PI*2 / 360);
sr = sin(angle);
cr = cos(angle);

if (forward)
{
    forward[0] = cp*cy;
    forward[1] = cp*sy;
    forward[2] = -sp;
}
if (right)
{
    right[0] = (-1*sr*sp*cy+-1*cr*-sy);
    right[1] = (-1*sr*sp*sy+-1*cr*cy);
    right[2] = -1*sr*cp;
}
if (up)
{
    up[0] = (cr*sp*cy+-sr*-sy);
    up[1] = (cr*sp*sy+-sr*cy);
    up[2] = cr*cp;
}
}

ddddd

sentences:
How to detect when a character is walking on an item in Java? To detect if a character is on an item on the floor, I can check every item on the map and do a collision check, and repeat the process every iteration.

Is there another way to do it, without checking every item?

I'm using Java, maybe the language offers a smart way to do this.

sentences:
tilting image for mode7 game in HTML5 I'm making a mode7 game like mario-kart and I need to tilt the image before I draw it, I have tried using a buffer canvas to tilt the image then draw it on the games canvas but this makes it laggy (because the image of map is 1280 x 2556.)

So my question is:

How can I rotate my image before i draw it

sentences:
Browser Game - Model or not Model I'm planing on making a browser game just for fun and to improve my skills, but I have an issue regarding the Software Architecture of the game:

I will be using an ORM to communicate with my database. Let's just talk about a browser game like Ogame or Tribal Wars. What is a model an what not?
Would I make a Model for each Unit Type and each Building Type? Or will I just save the information (for example: which level a certain building is at) in one table and a dataset would look like this:

Village

building1: 10
building2: 5
unit1: 89
...

Which is the approach I should use and how can I determine what feature is a model and which not?

Thank you!

Edit:

I see three approaches in general:

1) Each type has an own model (Main Building, Mine, Barracks). When a structure is built or upgraded the instance is modified (in it's own table). This instance is linked to a village.

2) There is a model for structures. There is an instance for each type. When a structure is built or upgraded a many to many relation is created or updated (with the level as a pivot)

3) I have a property for each building type on my village model.

Notice how this implementation use different amounts of rows in the DB.

Even more interesting: How to handle the units? I guess it's not that efficient if I'd have an instance for each unit, when I'm having 10,000 units per village.

I hope you get what problem I mean

sentences:
Simple physics for modelling ship/submarine movement for a first iteration of my sim, I need a very basic physics model for ship/submarine movement. I'd guess it might be a good approach to use vectors here (ship heading but also considering sea states etc.). Basic acceleration and that stuff should be taken into account

I do not need any 3D stuff...the 'client' for that 'ship movement' physics is only the 2D rendering of a navigation map.

I've found some papers on the net but they are far too complex for my needs.

Anybody does know some 'simplified' vector algorithms etc. for that?

Thanks a lot.

EDIT: To be clear: I do not want to simulate ship movement/ocean physics in detail, because this is not the focus of my (naval) simulation. It 'just' must be somewhat believable in that sense that if you have different sea states(wind/waves/currents) that the vessel is somewhat believable influenced (on the navigation map) by those forces.

The main issue for me is how I model/calculate those forces (wind etc.) by simple vectors and (eg. for a given wind velocity like 50kn) in an easy way withouth studying physics ;).

sentences:
Actions abstraction in Goal Oriented AI I am back with another question about Goal Oriented AIs.

To explain my problem, I will use a specific example.

In my game, population nodes are spawned on a world map, and important characters called "Migration leaders" can spawn, take in migrants, lead them to a good spot, and then establish a new population node there and finally despawn as they have served their one-time purpose.

What I want to achieve is having only one action called "MoveToTarget" which has no pre-conditions apart from having a target location, and has the effect of setting the fact "Reached target location" to true, which itself is the precondition for other actions. Not sure this is the right way to structure that in the GOAP but that's not exactly my problem, at least I do not think so.

My problem is that, since you can't work with actions that take in an argument, I have little notion of how the AI should determine the location which it will move to when the "MoveToTarget" action triggers, for the following reasons :

Depending on the character type and generally what is happening, each character will think differently about where they're interested in going. Furthermore, what happens when I have to interrupt the AI's "plan" for some reason ? The original target location for, say, transporting migrants is lost !
I do not which to make different actions like "MoveToMigrationTarget" because then I'll have to make many MANY more actions, like "MoveToCombatTarget" or "MoveToRessources" and I do not think that will work as that will make me have to keep a "Migration target", a "Combat target".. in memory even for characters that have nothing to do with either of those.

So my question exactly is, where is the AI supposed to do the "practical thinking" in a GOAP ? The Actions themselves must be abstract, and can't take in any argument so I have to somehow have target location(s) in memory and have the GOAP planner know which target corresponds to which action.

I could also extend that question to basically any action that need a specific target / object to work.

sentences:
Android Density Independent Pixel Drawables Resource Folder I'm trying to get to grips with DIP in Android (using Eclipse). I'm writing a little game with OpenGL ES 2.0. Could I get some guidance and tips on what I'm not understanding/doing right.

From what I understand I need to make different sizes of the same image so that they appear correctly on different devices. This is because each device has a different aspect ratio and a 1cm by 1cm sprite on one screen might not be 1cm by cm on another screen.

I read here that I need to place my sprite images in the res/drawables folders. I did this, but when I try to reference the resource using:

    mySpriteTexture = new Texture(context, R.mysprite);

the R class fails to find the .png. I have tried cleaning, rebuilding etc., and tried variations like R.res.mysprite. Although I don't see the point in trying R.res.drawables-XXX as according to the article Android is meant to pick the correct images on running...

I think it must be something to do with the XML manifest? But I have no clue. Any help would be welcome.

sentences:
Facebook Canvas (web) Game for Desktop & Mobile Browsers as the title suggests - I am about to develop a game for FB canvas.
Will the game support mobile and desktop or do I have to create two different project/game setups for this?

thanks

sentences:
cron jobs for MMO browser game I have to implement cron jobs in to my MMO browser game.
Its like in Travian game - you build something, and wait few minutes or hours..
But the problem is, that cron job shedulers made to be sheduled every second/minute/day etc..
But in my game i need to shedule thousands of the same jobs, which must run separately and after some unique time to be released.
So far i am unlucky with that idea. I am using Node.js and I just tried so many node shedulers, they seem are not supposed to have thousands of jobs.. I can run few unique only.
I trough maybe then i can make like - cron job, which runs every 1 second and checks the Redis DB for any finished proccess. But that sounds crazy.. if i have few jobs only and they are in 24 hous only, my server checks that every 1 second.. Any ideas what should i do?

So far, the best option would be to remove cron jobs.
I was doing some my processes without cron jobs.  But other processes were really hard to calculate, and it was much easier with cron jobs. But i trough deeper and i think it is possible to calculate eveyrthing and simulate everything without cron jobs.

For example, the user has ressources inside Stats model. And i have hourly ressource income there. If the user wants to build anything, for example, traps, i have to recalculate the user ressources and save new value, set the new updatedAt.
This is how i am updating my user ressources (inside Stats model), when some user wants to build a trap.

Stats.findOne({user_id: user_id}).exec(function (err, newstats){
  var time_in_ms = (new Date()).getTime() - new Date(newstats.updatedAt).getTime();
  var ressources_per_second = (newstats.base_income + newstats.field_income) / 60 / 60;
  var current_ressources = newstats.resources + parseInt(time_in_ms / 1000 * ressources_per_second) - traps_price;
  if(current_ressources < traps_price) return res.ok();
  Stats.update(newstats.id, {resources: current_ressources});
});

sentences:
Is there an accepted architecture for these classes? I am coding a game in python and so far so good, but I feel like my classes are not very modular. This is a simplification of what I've done:

class Game:
def __init__(self):
    self.characters = []
    self.walls = []
    self.background = None
    self.canvas = None
    self.keyInputs = None

def update(self, inputs):
    self.keyInputs = inputs
    for character in self.characters:
        if character.died:
            self.characters.remove(character)
        else:
            character.update()

def draw(self):
    self.background.draw()
    for wall in self.walls:
        wall.draw()
    for character in self.characters:
        character.draw()

class Character:
    def __init__(self):
        self.horizontalPosition = 0
        self.verticalPosition = 0
        self.game = None
        self.died = False
        self.sprite = None
        ...

    def draw(self):
        self.game.canvas.draw(self.sprite, self.horizontalPosition, self.verticalPosition)

    def interactWith(self, character):
        ...

    def detectCollition(self, wall):
        ...

    def handleInputs(self):
        inputs = self.game.keyInputs
        ...

    def update(self):
        self.handleInputs()
        for character in self.game.characters:
            if character != self:
                self.interactWith(character)
        for wall in self.game.walls:
            self.detectCollition(wall)

This way Characters and Walls need to have a variable for which Game they are in, and a Game needs to have a variable for each Character or Wall that is in it.

Is there a better way to define these classes? Are there design patterns for this?

sentences:
Get Skeletal Mesh Vertex Position in Niagara I have a custom HLSL node in a simulation stage in Niagara. One of the input variables to this node is of type Skeletal Mesh and I want to get the position and normal of a given vertex on that skeletal mesh by the index of the vertex.
In other words, I want to do the equivalent of the GetSkinnedVertexDataWS node, but in HLSL. Is this possible?
I couldn't find any documentation on it. I tried this code
bool myBool;
float3 VertexPosition;
ParticleMesh.GetSkinnedVertexDataWS<Attribute="Position">(i, myBool, VertexPosition);
float3 VertexNormal;
ParticleMesh.GetSkinnedVertexDataWS<Attribute="Normal">(i, myBool, VertexNormal);

where 'i' is the index of the vertex I want (from a loop), but I get the error:

"'GetSkinnedVertexDataWS_SystemParticleMesh_AttributePosition': cannot convert output parameter from 'float3' to 'bool' SPH_Emitter, Particle GPU Compute Script".

I also tried a few variations to no avail.
How can I solve this?
Edit:
Picking through the USH files in "\UE_4.26\Engine\Plugins\FX\Niagara\Shaders\Private", and looking in "NiagaraDataInterfaceSkeletalMesh.ush" in particular, it would seem that the call should be GetSkinnedVertexWS not GetSkinnedVertexDataWS.
However, when I make this change the error I get now is

/Engine/Generated/NiagaraEmitterInstance.ush(1563,3-14):  Err0r X3004: undeclared identifier 'ParticleMesh' SPH_Emitter, Particle GPU Compute Script,

This makes no sense to me. ParticleMesh is most definitely declared - as I say, it's an input to the custom HLSL node.
I don't know what the error refers to when it mentions "NiagaraEmitterInstance.ush" either. There's a "NiagaraEmitterInstanceShader.usf" but no USH file.
This has been an entire weekend wasted with zero progress. It doesn't help that there's next to no documentation. Nor does it help that I have to click an arbitrary parameter on the emitter on and off to reveal the error in the Niagara Log for 0.2s, whack the print screen key and paste the screenshot into Photoshop just to examine the error log, every single time I make a change.

sentences:
What is the best way to exploit multicores when making multithread games? Many people suggest to write a program, and then start optimizing it. But I think that when it's coming to multithreading with multicore, a little think ahead is required.
I've read about using threads, and experienced it myself during some courses at the university (still a student).

The big question is simple, but a bit abstract:

  What thread related steps in game design do I need to take, before implementation?

Now trying to be more specific. Let's say, as an example, that I'm making a small board game  (like Monopoly) that I want to be multithreaded.
My goal Is that this multithreaded game will exploit the best of the multicore system, lets say 4-6 cores (like in i7 processors).

My answer to this question at the moment is, one thread for each of these four basic components:

GUI
User Input / Output
AI (computer rival)
Other game related calculations (like shortest path from A to B, or level up status change)

I'm not an expert (yet!), and I'm sure there are better answers out there.
Any suggestion, answer, different approach will be helpful.

Some thoughts:
Maybe splitting the main database is a good way.. (or total disaster.. )

sentences:
How do I display same “proportional” text size on different resolutions? I draw some text on screen using ID3DXFont::DrawText. This text should be displayed the same regardless of screen resolution.

For example, if screen resolution is low, text wrapped and when it is higher text is not wrapped. How can I avoid such situation? I want text size to be connected to screen resolution so if resolution is lower I want the text to be relatively smaller so that no wrapping happens. Is there any way?

Thanks in advance

sentences:
Game Institute Math Courses I'm 21 years old and I suck at math, I mean really bad. I don't have the necessary logic to apply it towards programming. I would like to learn the math and logic of applying it. I found Game Institute (http://www.gameinstitute.com) awhile back and heard a lot of praise about them. Are there Math courses any good?

Thank you.

Edit: My high school was terrible and did not prepare me for any math. I am fairly decent at programming, I just don't have the logic to apply any mathematics to programming, as an example I don't understand the algorithm of finding the size of a user's screen.

Yes I have heard of KhanAcademy (http://www.khanacademy.org/) and I have completed a lot of maths on his website but I still don't have the logic to apply any of it to programming.

sentences:
Collision detection and response in an Entity System More fun with an ES...

Currently, I have a few systems:

Renderer (Renderable attribute, Transform attribute)
Motion (Movable attribute, Transform attribute, Renderable attribute [for bounding boxes, etc])
Input (InputReceiver attribute)
etc.

I'm adding collision detection. My first thought was to add a new system that performs collision. It makes sense to me to keep this isolated from the Motion system since not all things that move or are animated necessarily participate in collision detection - cameras, fog, etc. - but it seems that Collision and Motion are interdependent.

When Motion moves an entity, the transformation needs to be validated with Collision, and the movement either cancelled, or adjusted (bouncing, stopping at a wall, etc.).

An alternative would be to create a Collidable attribute that maintains a reference to a collision object - kd-tree, octree, etc. that is shared among entities that can collide with one another. The Motion system would then check for that attribute, and use it to check or adjust movement.

From a code perspective, that's an acceptable solution. However, from an ECS architecture point of view, it seems that it's pushing logic into the Motion system that doesn't apply to all of the entities that have a Movable attribute.

I could also store a motion vector in the Movable attribute, and have the Collider system adjust Transform as needed, but that'll involve duplicating functionality between Motion and Collider, or a callback from Collider to Motion with some data about the collision location and surface data for bounce/reflection, etc.

This may fall under the heading of "special case hack" but I'd like to get some input from those that have handled this before without creating a ton of edge case code.

The Question
What's a good way to avoid tight coupling between motion and collision systems when it seems that they require knowledge of each other?

sentences:
Improving performance of perlin/simplex noise calculations I'm using perlin noise to calculate different values for 3d block-world terrain. I calc roughly six (at most) noise values for various terrain features for every 4 blocks in a chunk. The missing values are then filled in by a linear interpolation method. I've built most of this from looking at how existing games like minecraft, terasology, etc do it.

The terrain I've finally wound up with is exactly where I want it - it looks great. However, the game FPS drops heavily any time a new set of chunks are loaded as the player walks.

Each chunk is 16x16x128 blocks. At max settings, the player may have 10 chunks in every direction visible, so if you walk sixteen blocks forward, roughly 10 new chunks are loaded and ten unloaded.

Even with calculating noise for only 1/4 the blocks in a chunk, the performance hit is too much. I've run some profiling and it's the noise calculation method that's the culprit.

Obviously, I need to address this. I just need some advice.

Are there any specific perlin/simplex implementations that are known to be tuned for performance?
Would it be possible/advisable for me to run all of the noise calculations asynchronously and then pass those back to the main thread for actual block-fill and rendering?

sentences:
How to integrate Firebase to Libgdx? I have an android game built with libgdx and what I'd like to do is to add some kind of authentication so I can connect the game with user data to firebase database.
I have some experience with firebase using it in native android apps, but I have no idea on how to connect "native code" with libgdx.
Researching I found these third party libs https://github.com/mk-5/gdx-fireapp/tree/master/gdx-fireapp-core and https://github.com/TomGrill/gdx-firebase
But as it does not provide any example it didn't help me much.
So what's the best way to "mix" native android code and libgdx? I want to be able to achieve things like storing data on db, implementing in-app-purchases, authenticating users. If I'm looking the wrong way please let me know too.

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:
Running and Jumping using Box2d and libgdx .this is my first trial on making a 2d game and currently struglling how to run and jump smoothly. My problem is when the player keep pressing on left or right botton then jump. the player won't jump, also when keep on holding left or right. the speed gets faster

if (KeyInput.isPressed(KeyInput.Button.JUMP)) {
    body.applyForceToCenter(0, playerJumpForce, true);
}

if (KeyInput.isDown(KeyInput.Button.LEFT)) {
    body.setLinearVelocity(new Vector2((body.getLinearVelocity().x - (playerSpeed * delta)), 0));
}

if (KeyInput.isDown(KeyInput.Button.RIGHT)) {
    body.setLinearVelocity(new Vector2((body.getLinearVelocity().x + (playerSpeed * delta)), 0));
}

sentences:
How do you animate/collide against a tessellated mesh? Now that I have a implemented tessellation for my mesh, I am trying to understand how I can leverage the generated primitives.

Example:

I have the following track mesh generated procedurally, it consists of quads, in the first picture you can see one of them I am highlighting using the mouse.

In the following picture, the shader applies some tessellation, you can see that now a quad has generated 16 quads.

Question (two-folded):

Now that I have more control points for each of my quad, suppose I want to deform one of them, for instance, to look like the following:

How is one supposed to apply such transformation ?

basically, what in terms of code-behind / shader code infrastructure is required to achieve such thing.

How can collisions be checked for against that deformed mesh ?

from what I've understood, a mesh collider would be unpractical since it's a heavy operation that just forbids real-time updates

sentences:
How do I record scripted rotation changes in animation file? I can create an animation file by clicking "Animation", then selecting a gameobject, then press record and then change bone rotations in the Inspector.
The animation window will be notified about the bone rotation changes and add this to the animation file like this:

This works fine as long as the Inspector is used to change the bone rotations.
Bone rotations done by a script are not recorded.
Is there a trick to record these bone rotations via script anyways?
For example using something like (pseudo-code) this? ->
rShoulder.rotation.dirty = true;

For your interest, I have attached the script that I use to rotate the bones and which are not recorded. This script works perfectly fine, but it doesn't trigger animation changes:
using System;
using System.Collections;
using System.Collections.Generic;
using UnityEngine;

public class MyPlayer : MonoBehaviour
{
    public Transform Target;

    private void OnGUI()
    {
        if (GUI.Button(new Rect(0, 70, 50, 30), "Transfer rotations to other model with same rig"))
        {
            List<Transform> nTheseTransforms = new List<Transform>();
            Helpers.GetAllChildren(this.transform, ref nTheseTransforms);

            List<Transform> nTargetTransforms = new List<Transform>();
            Helpers.GetAllChildren(Target, ref nTargetTransforms);

            foreach (Transform nThisTransform in nTheseTransforms)
            {
                foreach (Transform nTargetTransform in nTargetTransforms)
                {
                    if (nThisTransform.name == nTargetTransform.name)
                    {
                        nTargetTransform.localRotation = nThisTransform.localRotation;
                        break;
                    }
                }
            }
        }
    }
    public static void GetAllChildren(Transform parent, ref List<Transform> transforms)
    {
        foreach (Transform t in parent)
        {
            transforms.Add(t);
            GetAllChildren(t, ref transforms);
        }
    }

}

sentences:
Existing Chat-Text Systems with Autocomplete? We're building a multiplayer (dyads) puzzle game where players need to collaborate to be successful. We'd like to use a text chat system that has two must have features: a) autocompletes a player's statements/questions and b) allows only a limited number of predefined messages to be sent.

Any advice on where to go looking for existing text/chat systems with at least the autocomplete feature?

sentences:
What are the advantages of tangent space shading/lighting, and what about attenuation? In several topics here it was suggested by people that doing lighting in tangent space is better than doing it in world space. Right now I am doing it in camera space, but it's really similar to world space.
My question is, why would tangent space be a better choice for this (I am using normal maps if it matters)?
Secondly, when going from model space to world space and vice-versa, a scale is applied. This produces a problem when it comes to attenuated light, because the distances are quite different than in world space, which is where my light positions are. How would I deal with this?
Thanks in advance

EDIT:
Attenuation problem illustrated

sentences:
How to make gravity in Blitz3D? I am making a game in Blitz3d and I made simple gravity, however once the object falls on the ground, it goes through it very slowly. The ground is a plane and I have collision on it.

This is a pretty old engine, and not a lot of people are using it but I decided to use it because it's easier than Unity3D for me and it's very basic and customizable.

Here's my code:

AppTitle "FPS"
Graphics3D 800,600,32,2
SetBuffer BackBuffer()
SeedRnd MilliSecs()
HidePointer

;Objects
Global player = CreatePivot()
Global camera = CreateCamera(player)
Global cube = CreateCube()
Global light = CreateLight()
Global plane = CreatePlane()
Global cube2 = CreateCube(player)
col_plane = 1
col_player = 2
col_cube = 3

;Vars
gravity# = -.00001
plx# = 0
ply# = 0
plz# = 0
pldx# = 0
pldy# = 0
pldz# = 0

;Textures
CameraClsColor camera,135,206,250
box = LoadTexture("models\box.png")
dirt = LoadTexture("models\dirt.jpg")

;Object Details
EntityType cube,col_cube
EntityType player,col_player
EntityType plane,col_plane
EntityRadius player,1.2
EntityRadius plane,1

PositionEntity player,0,10,5
PositionEntity cube,0,1,5
PositionEntity light,0,2,0
PositionEntity plane,0,0,0
EntityTexture cube,box
EntityTexture plane,dirt
ScaleTexture dirt,5,5
CameraRange camera,0.25,200

;Called Functions
While Not KeyHit(1)
    Cls
    ;Collisions
    Collisions col_player,col_plane,2,2
    Collisions col_player,col_cube,2,2

    If ply < -2 Then
        ply = 0
        pldy = -pldy*.39
    EndIf
    If ply < -1.8 Then
        pldx = .6*pldx
        pldz = .6*pldz
        If KeyDown(57) Then pldy = 2
    EndIf
    pldy = pldy + gravity
    plx = plx + pldx
    ply = ply + pldy
    plz = plz + pldz
    PositionEntity player,EntityX(player)+plx,EntityY(player)+ply,EntityZ(player)+plz

    control()
    RenderWorld()
    UpdateWorld()
    MoveMouse GraphicsWidth()/2, GraphicsHeight()/2
    Flip
Wend

End

;Functions
Function control()
    If KeyDown(42) ;Shift (for running)
        If KeyDown(17) And KeyDown(30) ;W and A
            MoveEntity player,-0.15,0,0.15
        ElseIf KeyDown(17) And KeyDown(32) ;W and D
            MoveEntity player,0.15,0,0.15
        ElseIf KeyDown(17) And KeyDown(30) ;S and A
            MoveEntity player,-0.15,0,-0.15
        ElseIf KeyDown(17) And KeyDown(32) ;S and D
            MoveEntity player,0.15,0,-0.15
        ElseIf KeyDown(17) ;W
            MoveEntity player,0,0,0.15
        ElseIf KeyDown(31) ;S
            MoveEntity player,0,0,-0.15
        ElseIf KeyDown(30) ;A
            MoveEntity player,-0.15,0,0
        ElseIf KeyDown(32) ;D
            MoveEntity player,0.15,0,0
        End If
    Else ;Walking
        If KeyDown(17) And KeyDown(30) ;W and A
            MoveEntity player,-0.1,0,0.1
        ElseIf KeyDown(17) And KeyDown(32) ;W and D
            MoveEntity player,0.1,0,0.1
        ElseIf KeyDown(17) And KeyDown(30) ;S and A
            MoveEntity player,-0.1,0,-0.1
        ElseIf KeyDown(17) And KeyDown(32) ;S and D
            MoveEntity player,0.1,0,-0.1
        ElseIf KeyDown(17) ;W
            MoveEntity player,0,0,0.1
        ElseIf KeyDown(31) ;S
            MoveEntity player,0,0,-0.1
        ElseIf KeyDown(30) ;A
            MoveEntity player,-0.1,0,0
        ElseIf KeyDown(32) ;D
            MoveEntity player,0.1,0,0
        End If
    End If

    While KeyDown(16) ;Q
        RotateEntity camera,MouseXSpeed(),10,10
    Wend
    While KeyDown(18) ;E
        RotateEntity camera,0,-10,-10
    Wend

    TurnEntity player, 0, -MouseXSpeed()/6.0, 0
    TurnEntity camera, MouseYSpeed()/6.0, 0, 0
    If EntityPitch(camera) < -70
        RotateEntity camera, -70, EntityYaw(camera), EntityRoll(camera)
    ElseIf EntityPitch(camera) > 70
        RotateEntity camera, 70, EntityYaw(camera), EntityRoll(camera)
    EndIf
End Function

If there's some one who can actually help me with this, I would appreciate it.

sentences:
Enemy shake/vibrate when following character I am using the arongranberg A* path finding project to create way points for one enemy to follow the player. However, the enemy vibrates back and forward by about 0.1 - 0.2 unit distance when moving. I have done a lot of research regarding this problem in the past few days but to no avail I could not find a solution that solves it. This is link to a gif to show what I mean.

I have tried,

changing    Application.targetFrameRate = 30;

changing fixed update to update and vice versa;

using rigidbody2d and turn interpolate on plus using velocity to move;

turning iskinematic on and off;

using translate to move.

none of the above solution works. Below is the script I have for my enemy. Any advice would be appreciated.

    using UnityEngine;
    using System.Collections;
    //Note this line, if it is left out, the script won't know that the class 'Path' exists and it will throw compiler errors
    //This line should always be present at the top of scripts which use pathfinding
    using Pathfinding;

public class AstarAI : MonoBehaviour
{
    //The point to move to
    public Transform target;

    private Seeker seeker;

    //The calculated path
    public Path path;

    //The AI's speed per second
    public float speed = 200;

    //The max distance from the AI to a waypoint for it to continue to the next waypoint
    public float nextWaypointDistance = 0.02f;

    //The waypoint we are currently moving towards
    private int currentWaypoint = 0;

    Rigidbody2D rb;

    public void Start ()
    {
        rb = this.GetComponent<Rigidbody2D> ();
        seeker = GetComponent<Seeker>();

        //Start a new path to the targetPosition, return the result to the OnPathComplete function
        seeker.StartPath( transform.position, target.position, OnPathComplete );
    }

    public void GoToNewTarget(Transform newTarget) {
        //path = null;
        currentWaypoint = 0;
        nextWaypointDistance = 0.02f;
        target = newTarget;
        seeker = GetComponent<Seeker>();
        seeker.StartPath( transform.position, target.position, OnPathComplete );
    }

    public void OnPathComplete ( Path p )
    {
        Debug.Log( "Yay, we got a path back. Did it have an error? " + p.error );
        if (!p.error)
        {
            path = p;
            //Reset the waypoint counter
            currentWaypoint = 0;
        }
    }

    public void Update ()
    {
        if (path == null)
        {
            //We have no path to move after yet
            return;
        }

        if (currentWaypoint >= path.vectorPath.Count)
        {
            Debug.Log( "End Of Path Reached" );
            return;
        }

        //this.GetComponent<Rigidbody2D> ().MovePosition (path.vectorPath[currentWaypoint]);
        //Debug.Log (path.vectorPath[currentWaypoint]);
        //Direction to the next waypoint
        Vector3 dir = ( path.vectorPath[ currentWaypoint ] - transform.position ).normalized;
        //GetComponent<Rigidbody2D> ().velocity = new Vector2 (dir.x * 3, dir.y * 3);
        //Vector3.MoveTowards(transform.position, path.vectorPath[ currentWaypoint ], 2*Time.fixedDeltaTime);
        dir *= speed* Time.deltaTime;
        rb.velocity = dir;
        //this.gameObject.transform.Translate( dir );

        //Check if we are close enough to the next waypoint
        //If we are, proceed to follow the next waypoint
        if (Vector3.Distance (transform.position, path.vectorPath [currentWaypoint]) < nextWaypointDistance) {
            currentWaypoint++;
            return;
        }
    }
}

sentences:
Deep copying or cloning in actionscript 3 I would like to make a mirror reflection of an entity in Flashpunk. So I would like to copy a spritemap from one Entity to another (reflectionEntity). If i use something like this

reflectionEntity.sprite = otherEntity.sprite;

reflectionEntity.sprite.scaleY=-1; // to reflect

then the graphic of the original entity is also scaled.

Is there a simple way out of this? I have been searching for the solution for more than an hour and have not found a suitable one.

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:
Adjusting view matrix when glViewPort & resizing I have an issue when my window resizes.

I have a simple MVP shader like this

gl_Position = projection * view * model * vec4(in_Position, 1.0);

to render a map in my game scene. The map is extremely simple that it simply offers a lane's vertex. And what I need to do is drawing it inside the window.

So I set up my MVP matrix individually, the "view" and "model" matrix remains the same because all I want to do is drawing a static map. "perspective" is the only matrix need to change since I want to have a zoom feature that I can zoom in/out by changing fovy. "perspective" is updated by calling

glm::perspective(glm::radians(fovy), (float)width/height, near, far)

and my view matrix is calculated by

glm::lookAt(camera_pos, camera_pos + camera_front, camera_up)

However, when I resize the viewport, I find everything changed. I mean by default, the resolution gonna drop when my window goes larger if I didn't do anything(like updating the glViewPort()). But the behavior I wanna achieve is like

"I could see more part of the map when I made my window size larger".

Therefore I believe that I should keep my viewport resolution same (glViewPort(0, 0, screen_width, screen_height)). And updating perspective matrix by changing the ratio when new window's width and height comes in. Then the final step is to update the camera's position to update view matrix. However I stuck here for a while coz I don't know how to adjust it. I believe this is a common issue but I cannot even find a source talking about it.

Do I think it the wrong way? Do I need to change Camera's position to update my view matrix to achieve the resize behavior?

Platform: Ubuntu 16.04, OpenGL3.3 , C++14

sentences:
Agent trying to reach same position as other agents, instead start spinning in place I create units in my game and have a rally point where they should walk to when created, like Age of Empires.

My problem is that since they compete for this position after a while, sometimes they end up doing this:

https://gfycat.com/decentquestionableandeancondor

https://gfycat.com/densehonoredgalapagosalbatross

As you can see one of the guys cant reach the rally point, so he starts rotating.

I realize this has to do with stopping distance, but no matter how high I set the stopping distance this eventually becomes a problem when there are many enough units. And if I set it too high they dont walk to the rally point at all, since its not THAT far from the building they spawn from.

Is there any way to manage this scenario? i.e just making him go as close as he can, and then stop?

My AI Script:

using UnityEngine;
using UnityEngine.AI;

[RequireComponent(typeof(NavMeshAgent))]
public class BaseAi : MonoBehaviour
{
    [HideInInspector]
    public NavMeshAgent agent;

    [HideInInspector]
    public NavMeshObstacle obstacle;

    float sampleDistance = 50;

    Transform mTransform;

    private void Awake()
    {
        agent = GetComponent<NavMeshAgent>();
        obstacle = GetComponent<NavMeshObstacle>();
        mTransform = transform;
    }

    private void Start()
    {
        agent.avoidancePriority = Random.Range(agent.avoidancePriority - 10, agent.avoidancePriority + 10);
    }

    void LateUpdate()
    {
        if (agent.isActiveAndEnabled && agent.hasPath)
        {
            var projected = agent.velocity;
            projected.y = 0f;

            if (!Mathf.Approximately(projected.sqrMagnitude, 0f))
                mTransform.rotation = Quaternion.LookRotation(projected);
        }
    }

    /// <summary>
    /// Returns true if the position is a valid pathfinding position.
    /// </summary>
    /// <param name="position">The position to sample.</param>
    public bool SamplePosition(Vector3 point)
    {
        NavMeshHit hit;
        return NavMesh.SamplePosition(point, out hit, sampleDistance, NavMesh.AllAreas);
    }

    public bool SetDestination(Vector3 point)
    {
        if (SamplePosition(point))
        {
            agent.SetDestination(point);
            return true;
        }

        return false;
    }

    public void Teleport(Vector3 point)
    {
        agent.Warp(point);
    }

    /// <summary>
    /// Return true if agent reached its destination
    /// </summary>
    public bool ReachedDestination()
    {
        if (agent.isActiveAndEnabled && !agent.pathPending)
        {
            if (agent.remainingDistance <= agent.stoppingDistance)
            {
                if (!agent.hasPath || agent.velocity.sqrMagnitude == 0f)
                {
                    return true;
                }
            }
        }

        return false;
    }

    public void ToggleObstacle(bool toggleOn)
    {
        agent.enabled = !toggleOn;
        obstacle.enabled = toggleOn;
    }

    void OnDrawGizmos()
    {
        if (agent == null) { return; }
        if (agent.path == null) { return; }

        Color lGUIColor = Gizmos.color;

        Gizmos.color = Color.red;
        for (int i = 1; i < agent.path.corners.Length; i++)
        {
            Gizmos.DrawLine(agent.path.corners[i - 1], agent.path.corners[i]);
        }
    }
}

sentences:
Building a visual scripting component (like Kismet) I'd like to know how can one get started building a visual scripting component (or what is the more accurate term for this type of component?) such as UDK's and Unreal Engine's Kismet.

For those who are not familiar, the system allows connecting various pieces of logic visually, creating a possibly complex component out of smaller building blocks.

While the underlying data model may be (perhaps) something i can figure out for myself, it is the visual part that i am not sure of how to work out.

Are there any libraries that facilitate writing something like this? Where can i get started on thsi ?

sentences:
How to rotate a character according to the body alignment of the ragdoll to fit the 'getting up' animations? I'm trying to make a character rotate in the right direction so that when the character gets up from a ragdoll state, the animation would closely match the initial lay down position of the ragdoll.
The character has a third person controller and when I move it around, it rotates according to the directions from the joystick. So when it falls it usually gets up in the right direction but sometimes, when the character falls from a cliff, the animation doesnt match the ragdoll orientation.
I'm using this method to calculate whether the hips are pointing upward or downward so I can trigger the right animation.
        wasRootBoneFacingUpward = Vector3.Dot(bones[0].forward, Vector3.down) < 0;

How can I rotate my character so that it fits the body alignment of the ragdoll ?

sentences:
Where is better to do shaders, vfx, uv-mapping and coloring? Well i understand that 3DS-Max is mainly for modeling and Unity is mainly for programming and logic, but where is it better to do shaders, vfx, uv-mapping/painting and coloring?

for example i worked a little bit in Blender and it has modifiers, but also Unity has materials and similar stuff.

What let's say "imade a model in 3ds max, now where should i do the art and texturing, should i continue with 3ds or should i do it in blender? OR it doesn't matter where?"

sentences:
Fastest way to neutralize scale in the transform matrix? Let's assume we have 4x4 3D transformation matrix, that is the result of scale, rotation, and translation transforms. How to set its scale to (1,1,1) in the fastest way? Assume also that the matrix is represented by float[16] array.

By fastest way I mean, the most performance accurate way, that will be low CPU cost.

sentences:
Unexpected behavior of bodies affected by gravity in 2D I have a simple code that calculates the acceleration of a body every update of my simulation using the Newton's law of universal gravitation and the second law of motion.

def move_bodies():
    def get_dist(b1, b2):
        return math.hypot(b2['x'] - b1['x'], b2['y'] - b1['y'])

    for body in bodies:
        acceleration = 0
        angle = 0

        for other_body in bodies:
            dist = get_dist(body, other_body)

            if body != other_body:
                angle = math.atan2(other_body['y'] - body['y'], other_body['x'] - body['x'])
                acceleration = (GRAVITY_CONSTANT * body['m'] * other_body['m'] / dist ** 2) / body['m']

            body['x'] += math.cos(angle) * body['vx']
            body['vx'] += acceleration

            body['y'] += math.sin(angle) * body['vy']
            body['vy'] += acceleration

when these bodies interact, something unexpected happens when their x/y values are approaching one another -- the bodies move at extremely high speeds and seemingly disappear off the screen.

For example, if we have a body at (200, 100) and another at (200, 300), they do not gravitate towards one another as they would do in a situation where they have unique (x, y) values such as (200, 100) and (300, 400).

Looking at the code, as the y-values of body and other_body approach one another, values get exceedingly large(?)

I can't quite pin down the issue as I'm a beginner. Any suggestions/criticism?

sentences:
Unity: Simple “pass through” geometry shader I would like to implement a geometry shader that does nothing, just for the purpose of learning and to go ahead with that and do something useful with it.

I currently have:

A compute shader creating "particles".
A vertex shader doing the transformation
A fragment shader...

This is the shader file:

StructuredBuffer<float3> particles;

struct fsInput {
    float4 pos : SV_POSITION;
};

fsInput vert(uint id : SV_VertexID)
{
    fsInput fsIn;
    float3 worldPos = particles[id];
    fsIn.pos = mul(UNITY_MATRIX_VP, float4(worldPos, 1.0f));
    return fsIn;
}

//[maxvertexcount(1)]
//void geom(point fsInput p[1], inout TriangleStream<fsInput> output)
//{
//  fsInput fsOut = (fsInput) 0;
//  fsOut.pos = p[0].pos;
//  output.Append(fsOut);
//}

float4 frag(fsInput fsIn) : COLOR
{
    return float4(1.0, 0.2, 0.2, 1);
}

I'm drawing my particles with this call:

Graphics.DrawProcedural(MeshTopology.Points, NUM_PARTICLES);

In my understanding, which is quite limited due to the perfect documentation of geometry shaders, my geometry shader should do nothing. Just forward the points to the fragment shader. However, if I use that shader (comment in those lines), I wont see my particles anymore. Without the geometry shader, I can see every particle.

So the first question is, where is the error? The second question is: Can I, starting with points and using the geometry shader, go from points to a, for example, cube? Or should I do it in the compute shaders? But if so, which MeshTopology should I use to draw the data from the compute shader as Cube, Sphere, etc...?

Thank you for help!

sentences:
Where in code to for collision? In object class? Mainline code? Making a simple game in Love 2D framework where if I click on an object then it disappears.

Do I check to see if I've clicked the enemy inside a function in the enemy object? Or just in my main.lua? Currently I have this code in my main.lua:

function love.mousepressed(x, y, button)
   if button == "l" then
      for i,b in ipairs(bugs) do
         if b:isClicked(x, y) then
            table.remove(bugs, i)
         end
      end
   end
end

Is there a standard design pattern on where this code should belong?

sentences:
Checking whether moving object has reached target position So I have a fast-moving object in my game, let's say a bullet. At each iteration of the main loop I update the object's position based on the delta time value dt and draw it at the new position.

I also check whether the object's new position is close to a target position. In that case the object will be removed:

S....|...|....|....|......|...|....|....|...|..T..|X

The object starts from location S, moving towards target position T. Each dot . represents one ms time. The vertical bars | represent a game loop iteration, in which I check whether the object has reached its target destination. At X the object will be removed.

Since these checks (ie. game loop iterations) might take place before or after the 100% exact target position (even if only a few pixels off), I perform this check with a distance between a line segment from the last position to the current position, and whether the target position is on that line. This approach works well.

There is one issue though: Since the check in which I recognize that the target has been reached happens after the real position of the target, the object moves a little bit further than desired. That's becoming more severe when the object is moving very fast.

Now my question: Is there kind of a "best practice" how to deal with this issue? I assume this is a common problem in game development.

PS: The only solution I could think of is to re-position the object to the real target position as soon as the check succeeds. However, that can look a bit like a "jump" back, which does not look great.

sentences: In Unity - Move a GameObject at Animator State I want to move one of my GameObject to a different vector 3 position, when animator transit to a new state. How do I do it? Also there shouldn't be any delay.

sentences:
OnMouse Events stop working when multiple cameras are active I'm working on 2019.4.9f1 on a 2D project using Universal Rendering Pipeline. The camera settings changed so I'm stating it.
I wrote a OnMouseEnter and OnMouseExit in a script to manage whenever my mouse cursor is on top of a SpriteRenderer with a collider located at 0,0,0. I have a main camera located at 0,0,-10. I've tested the script that manages the OnMouse events. It works fine.
Problem: But the moment I add a new camera (UI Camera set to Overlay located at 0,0,-10) in and it is enabled, OnMouse events aren't getting called. Disabling the UI camera makes the OnMouse events work normally.
Solutions that have failed:

I've tried setting the tag of the UI Camera to MainCamera and set
Main Camera's tag to Default.
https://answers.unity.com/questions/241334/onmousedown-w-multiple-cameras-doesnt-work-right.html
I tried making the UI Camera a bit closer to the sprites.
https://answers.unity.com/questions/425478/onmousedown-not-firing.html

I intend to avoid Raycasting and get the OnMouse Events to work because I want to fix the problem and not work around it.
Question: Any possible reason why my OnMouse events aren't called?

sentences:
Detecting keys presses between keyboard layouts, operating systems and javascript I've recently encountered a few headaches when I tried to detect key presses for a custom game engine to supports Windows, MacOS, Linux, and WebGL.

Naive approach:

At first I naively thought that using GLFW's keycodes instead of scancodes will be the best solution to cover as many operating systems as possible. I later found out that if the player has a different keyboard layout, the keys will be bound all over the place instead of having the WASD keys (regardless of what character they represent) sit together.

Problem #1

So then I moved over to using scancodes. So this works great (other than having a different set of scancodes for each operating system) but it also introduces my first issue. Since scancodes are position based and defined as integers, how will I display to the player what character, for their unique keyboard layout, is currently bound in the game's "Keyboard Settings" dialog. I don't imagine detecting a keyboard layout is plausible (might even be impossible with Javascript since I don't have access to OS calls).

Problem #2

My second issue is when the game is deployed with WebGL. In Javascript the keyCode value is just fed to the browser from the underlying operating system. What this means is I have to check the OS at runtime and remap all the keybinds based on the operating system. This is a nightmare because, if the user has customised keybinds (stored to his cloud profile) that was created on MacOS but then later opened up on Windows, then the code will have to do three remaps in order to, get the OS when keys where customised, then get the current OS, and then the conversion between the two prior to taking into consideration the customised remaps... Is there not a better way?! This would also mean I will have to send all the keycode constants for everything possible operating system to each user. Resulting in a lot of unnecessary boat in the Javascript file.

Just assume?

It seems like the big game engines out there have this issue solved and I am curious how they got around these issues. Do they just assume all players use QWERTY keyboards at the risk possibly frustrating a certain audience until they remap the keys ingame? And do they assume all browser based games are played on Windows, MacOS, and Linux to keep the javascript OS detection to a minimal? (effectively losing mobile players)

sentences:
How to balance a non-symmetric "extension" based game? Most strategy games have fixed units and possible behaviours.

However, think of a game like Magic The Gathering : each card is a set of rules.
Regularly, new sets of card types are created.

I remember that the firsts editions of the game have been said to be prohibited in official tournaments because the cards were often too powerful.
Later extensions of the game provided more subtle effects/rules in cards and they managed to balance the game apparently effectively, even if there is thousands of different cards possible.

I'm working on a strategy game that is a bit in the same position : every units are provided by extensions and the game is thought to be extended for some years, at least. The effects variety of the units are very large even with some basic design limitations set to be sure it's manageable.

Each player choose a set of units to play with (defining their global strategy) before playing (like chooseing a themed deck of Magic cards).
As it's a strategy game (you can think of Magic as a strategy game too in some POV), it's essentially skirmish based so the game have to be fair, even if the players don't choose the same units before starting to play.

So, how do you proceed to balance this type of non-symmetric (strategy) game when you know it will always be extended?

For the moment, I'm trying to apply those rules but I'm not sure it's right because I don't have enough design experience to know :

each unit would provide one unique effect;
each unit should have an opposite unit that have an opposite effect that would cancel each others;
some limitations based on the gameplay;
try to get a lot of beta tests before each extension release?

Looks like I'm in the most complex case?

sentences:
How to create a depth-recording shader for shadow mapping? I am attempting to implement shadow maps.

I am first going to implement spotlights over directional lights (I am aware this is harder).

Since I was already rendering the geometry, my attempt was to recycle my old shaders and modify them to make shaders to create the depth maps.

This created the following vertex shader:

#version 450

layout(location = 0) in vec3 position; //(x,y,z) coordinates of a vertex

layout(std430, binding = 3) buffer data_buffer
{
    vec4 cubes_info[];//first 3 values are position of object
};

uniform mat4 view = mat4(1); //Camera orientation and position
uniform mat4 proj = mat4(1); //The projection parameters (FOV, viewport dimensions)

void main()
{
    gl_Position = proj*view*(vec4(position, 1.0) + vec4(vec3(cubes_info[gl_InstanceID]),0));
}

And fragment shader:

#version 450

layout(location = 0) out float fragmentdepth;

void main()
{
    fragmentdepth = gl_FragCoord.z;
}

As you can see, both shaders are pretty basic, they are a little more complex than they would otherwise be since they are using instancing, but overall they are simple.

However the output of these shaders is:

Where the original image is:

As you can see, the depth is being lost.

I think this is because my perspective, projection and model matrices are identical for both shaders.

In other words, I think that the camera I use for rendering the second image does not store the depth information. I wanted to know how can you generate a similar projection matrix to store the depth?

sentences:
How to detect when the current animation is finished in code in Unity's Animator? I have a model with an animation controller. I set the states and parameters for transitions between them. Now I need to make the model play its animations in the order I want.

I can use:

GetComponent.<Animator>().SetBool("someparameter",true);

to uncheck currently checked parameter and check another parameter after current animation finished.

Please help me to find a way to make a condition "when the current animation finished".

The examples I'm finding are related to animation component (not animator), or they are too complicated for me, while I need a simple way I can understand and use quickly.

Thank you so much in advance!

sentences:
Why would somebody want to turn off v-sync? From this recent article about technical limitations of UWP, I've found inability to turn off v-sync listed as a negative point.

I understand lowering graphics settings like texture quality, various effects and changing resolution, which very noticeably affect framerate and resource consumption, but vertical synchronization doesn't seem to do any harm.

From what I know, it only removes image tearing, and as a side-effect may result in displayed framerate change from 60 to 59 (or max_fps-1) in some games due to faulty framerate counting algorithm, which some users may see as literally unplayable. From my experience, in game streams with low framerate, disabled v-sync shows as a lot of tearing frames and disgruntled viewers.

Are there any advantages to disabling v-sync? Does it cost anything performance-wise to worry about?

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:
Why do restitution values less than one still cause infinite bouncing in Box2D? I'm currently trying to implement basketball bouncing into my game using Box2d (jBox2d technically), but I'm a bit confused about restitution.

While trying to create the ball in the testbed first, I've run into infinite bouncing, as described in this question, however obviously not using my own implementation.

The Box2d manual describes restitution as follows:

  Restitution is used to make objects bounce. The restitution value is usually set to be between 0 and 1.
  Consider dropping a ball on a table. A value of zero means the ball won't bounce. This is called an
  inelastic collision. A value of one means the ball's velocity will be exactly reflected. This is called a
  perfectly elastic collision.

My confusion lies in that I am still getting infinite bouncing with restitution values at 0.75/0.8. The same behavior can be seen in the testbed under Collision Watching -> Varying Restitution, on the 6th and 7th balls. I believe the last one has restitution of 1, which makes sense, but I don't understand why the second to last ball bounces infinitely (as is happening with my working basketball I've created).

I am looking to understand the restitution concept more fully, as well as look for a solution to infinite bouncing with the Box2d framework. My instinct was to sleep objects that appeared to be moving in very small increments, but this seems like a misuse of the engine. Should I just work with lower restitution values altogether?

sentences:
Rendering Tilemap Tile Layer Side by Side for Infinite/Endless Runner Game I was strugeling this for days how to implement tilemap into libgdx and box2d with infinite/endless scheme. I can load a single map and display everything on screen. But placing 2 or more tilemap side by side got me headache. I know currently not possible to offset/add x value position of tilemap. What I do right now is use setview for camera of it's render method. This is my map helper and currently I works with 3 renderer for 3 tilemap as a test...

public class MapHelper {
private Array<OrthogonalTiledMapRenderer> renderer = new Array<OrthogonalTiledMapRenderer>();
private int number;
private float oldDistance, currentDistance;
private String layer = "world";

public MapHelper(Callback callback) {
    this.callback = callback;
    number = 0;
    item = new ItemMap[3];
}

public void render(CamHandler cam) {
    for(int r = 0; r < renderer.size; r++) {
        if(item[r] != null) {
            renderer.get(r).setView(cam.getCam().combined, item[r].distance, 0, item[r].getWidth(), item[r].getHeight());
            renderer.get(r).render();
        }
    }
}

public void updateMap(CamHandler cam) {
    if(mapOut(cam)) {
        number++;
        if(number > 2)
            number = 0;
        loadMap(number);
    }
}

/**
 * Check if camera reach the current distance, then build new map
 * @param cam
 * @return
 */
private boolean mapOut(CamHandler cam) {
    float x = cam.getCam().position.x + cam.getCam().viewportWidth / 2;
    Utils.log("pos cam x "+x+" current distance "+currentDistance);
    return x >= currentDistance;
}

private void loadMap(int map) {
    AssetsManager.loadMap(map);
    if(item[map] != null) {
        renderer.set(map, new OrthogonalTiledMapRenderer(AssetsManager.map));
        item[map].set(TileHelper.getMapWidth(AssetsManager.map, layer), TileHelper.getMapHeight(AssetsManager.map, layer), currentDistance);
    } else {
        renderer.add(new OrthogonalTiledMapRenderer(AssetsManager.map));
        item[map] = new ItemMap(TileHelper.getMapWidth(AssetsManager.map, layer), TileHelper.getMapHeight(AssetsManager.map, layer), currentDistance);
    }

    oldDistance = currentDistance;
    currentDistance += TileHelper.getMapWidth(AssetsManager.map, layer);
    callback.onLoad();
    Utils.log("load new map "+map+" distance "+currentDistance);
}

public Array<OrthogonalTiledMapRenderer> getRenderer() {
    return renderer;
}

public Array<Body> getBodies(World world) {
    return new MapBodyBuilder().buildShapes(AssetsManager.map, world, oldDistance);
}

private ItemMap[] item;

private class ItemMap {
    private float distance, mapWidth, mapHeight;

    ItemMap(float w, float h, float distance) {
        mapWidth = w;
        mapHeight = h;
        this.distance = distance;
    }

    private void set(float mapWidth, float mapHeight, float distance) {
        this.mapWidth = mapWidth;
        this.mapHeight = mapHeight;
        this.distance = distance;
    }

    private float getWidth() {
        return mapWidth * Constants.WORLD_TO_SCREEN;
    }

    private float getHeight() {
        return mapHeight * Constants.WORLD_TO_SCREEN;
    }
}

private Callback callback;

public interface Callback {
    void onLoad();
}

public void startOver() {
    clear();
    currentDistance = number = 0;
    loadMap(number);
}

private void clear() {
    for (OrthogonalTiledMapRenderer render : renderer) {
        render.dispose();
    }
}

}

With above class, I can display and load new map on screen when camera reaching the map end. But the tile layer texture keeps wrong position. Please give me an advice.

sentences:
Smoothing long paths with splines What is the best way to smooth a long path with splines?
I first implemented a Bezier curve but then realised that I would have to join a lot of them.

I used A* on a weighted grid so I can't use Theta or other any angle algorithms stuff.

I basically would like to achieve the light blue path on the following picture (credit to Amit), but on much longer paths:

How do game programmers do?

sentences:
What behaviors should go into making a "non-perfect" AI combatant? When making an npc combatant, it's easy obvious what to do to get a robot deathmachine by optimizing combat tactics, timing and attack types, but harder (and more interesting in a fight) to get an idiosyncratic, inpredictable enemy.  What behaviors (algorithms?) are useful for creating a more organic, unconventional enemy?

Edit: My specific use case is with MMO-like enemies, e.g. World of Warcraft, although with less graphics involved.  Note that that means both human and inhuman enemies (animals, monsters, etc)

sentences:
How do I render using VBOs? I'm trying to render a hemisphere in OpenGL, the problem that the hemisphere isn't rendered at all, only part of it. I initialize it, then at each frame I draw it using the following code. I'm trying to use a VBO for drawing it.

void Jellyfish::Init_HemiSphere(const float radius, const int segments )
{

    m_iSegements = segments;
    m_fVerts= new float[(segments+1)*2*3];
    m_fNormals= new float[(segments+1)*2*3];
    m_fTexCoords = new float[(segments+1)*2*2];

    for( int j = 0; j < segments / 2; j++ )
    {
        float theta1 = j * 2 * 3.14159f / segments - ( 3.14159f );
        float theta2 = (j + 1) * 2 * 3.14159f / segments - ( 3.14159f );

        for( int i = 0; i <= segments; i++ )
        {
            Vec3f e, p;
            float theta3 = i * 2 * 3.14159f / segments;

            e.x = math<float>::cos( theta1 ) * math<float>::cos( theta3 );
            e.y = math<float>::sin( theta1 );
            e.z = math<float>::cos( theta1 ) * math<float>::sin( theta3 );
            p = e * radius;
            m_fNormals[i*3*2+0] = e.x; m_fNormals[i*3*2+1] = e.y; m_fNormals[i*3*2+2] = e.z;
            m_fTexCoords[i*2*2+0] = 0.999f - i / (float)segments; m_fTexCoords[i*2*2+1] = 0.999f - 2 * j / (float)segments;
            m_fVerts[i*3*2+0] = p.x; m_fVerts[i*3*2+1] = p.y; m_fVerts[i*3*2+2] = p.z;

            e.x = math<float>::cos( theta2 ) * math<float>::cos( theta3 );
            e.y = math<float>::sin( theta2 );
            e.z = math<float>::cos( theta2 ) * math<float>::sin( theta3 );
            p = e * radius;
            m_fNormals[i*3*2+3] = e.x; m_fNormals[i*3*2+4] = e.y; m_fNormals[i*3*2+5] = e.z;
            m_fTexCoords[i*2*2+2] = 0.999f - i / (float)segments; m_fTexCoords[i*2*2+3] = 0.999f - 2 * ( j + 1 ) / (float)segments;
            m_fVerts[i*3*2+3] = p.x; m_fVerts[i*3*2+4] = p.y; m_fVerts[i*3*2+5] = p.z;
        }

    }

    glGenBuffers(3,&SVboId[0]);
    //Vertex
    glBindBuffer(GL_ARRAY_BUFFER,SVboId[0]);
    glBufferData(GL_ARRAY_BUFFER,sizeof(*m_fVerts)*(m_iSegements+1)*2*3,
        m_fVerts,GL_DYNAMIC_DRAW);
    // Normals
    glBindBuffer(GL_ARRAY_BUFFER,SVboId[1]);
    glBufferData(GL_ARRAY_BUFFER,sizeof(*m_fNormals)*(m_iSegements+1)*2*3,
        m_fNormals,GL_DYNAMIC_DRAW);

}

void Jellyfish::drawHemiSphere( )
{

    /*glEnableClientState( GL_VERTEX_ARRAY );
    glVertexPointer( 3, GL_FLOAT, sizeof(*m_fVerts)*(m_iSegements+1)*2*3, m_fVerts );*/

    glEnableClientState( GL_VERTEX_ARRAY );
    glBindBuffer(GL_ARRAY_BUFFER,SVboId[0]);
    glVertexPointer( 3, GL_FLOAT, 0, 0 );

    glEnableClientState( GL_NORMAL_ARRAY );
    glBindBuffer(GL_NORMAL_ARRAY,SVboId[1]);
    glNormalPointer( GL_FLOAT, 0,0 );

    /*glEnableClientState( GL_TEXTURE_COORD_ARRAY );
    glTexCoordPointer( 2, GL_FLOAT,  sizeof(*m_fTexCoords)*(m_iSegements+1)*2*3, m_fTexCoords );
    glEnableClientState( GL_NORMAL_ARRAY );
    glNormalPointer( GL_FLOAT, sizeof(*m_fNormals)*(m_iSegements+1)*2*2, m_fNormals );*/
    for( int j = 0; j < m_iSegements / 2; j++ ) {

        for( int i = 0; i <= m_iSegements; i++ )
        {

        }

        glDrawArrays( GL_TRIANGLES, 0,   (m_iSegements + 1)*2   );
    }

    glDisableClientState( GL_VERTEX_ARRAY );
    glDisableClientState( GL_TEXTURE_COORD_ARRAY );
    glDisableClientState( GL_NORMAL_ARRAY );

}

sentences:
Methods of procedural terrain generation that can work using DirectX 9 (SM2.0)? I'm working on a simple game / fun project that I want to be largely procedurally generated. At first I started by using boxels (Similar to Minecraft, but not textured) for the terrain and it came out looking decent but I realized something.

I don't need, or really want, destructible terrain. Sure it'd be a nice little bonus, but no part of my game design calls for it, and using boxels requires a fair amount of data to be sent to the GPU, so I'm looking for alternatives and that's where I'm stuck...

What are some alternatives to boxels that can be used to generate terrain quickly, that looks good (Smooth terrain or otherwise), and can be rendered with XNA (Shader Model 2.0)? At first I thought that marching cubes could work, however apparently since XNA still uses DX9 - most of the work is done on the CPU. Then I looked into dual contouring, but I can't find much data on it and I'm afraid it suffers the same issues.

Right now height maps are looking halfway decent, however I don't want to abandon the idea of overhangs and whatnot completely, so... What else is there? I'd love to keep using voxels since they make procedural generation easy (And fun), but, and correct me if I'm wrong, XNA doesn't handle non-boxel rendering of them very well.

(Even if I'm wrong re: marching cubes, I'd still be interested in seeing worth-while alternatives that can run on low end machines using SM2)

Note: My highlighting of words is to help anyone who, like me, finds this after searching for methods of procedural terrain generation, and wants a quick list of what's available.

Edit: Still looking for an answer regarding different methods.

sentences:
How do I pixelate a scene with SceneKit and Metal, in Swift? I managed to get pixelation working by using the OpenGLES2 rendering API, and a CIFilter. But it was way too slow, so I want to use the Metal API and just have a very simple filter that pixelates everything in the scene.

Would really appreciate some help, maybe just explaining how to set up SceneKit to use a Metal shader. Is there something I can just drop in with a few lines?

sentences:
Triangle accuracy picking for animated models in XNA I can do picking with triangle-accuracy for non-animated models, but I also have animated models in my game. How do I do picking on animated models?

I use code based on this project for animation.

My first idea for doing it is:

Calculate ray
For each model
    If model bounding sphere collides with ray
         For each meshPart
              Make animation transformation
              Calculate transformed triangles in meshPart
         Test collisions of ray with resulting triangles

Have you ever considered how to make something like this?

sentences:
When creating quick prototypes, is it better to use the language you are going to use in the end? I have been working with SFML(C++) and Flash(AS3) and usually creating prototypes for some ideas I have.

Is it better to use the language you are going to use in the end (C++ usually) or use something simple and quick (AS3, Python, etc) to get it working and then start from scratch when you start on the main product?

sentences:
How do you handle entity parent-child relationship in Ashley ECS? In the below code example, is a parent-child relationship of an entities. Now every child should follow its parent position, and the child could be re-positioned anywhere.

Entity character; // character is a parent
Entity weapon; // weapon is a child of character

Entity gun; // gun is a parent
Entity bullet; // bullet is a parent
Entity bulletShadow; // shadow is a child of bullet

My own solution is to have an OwnershipComponent which has a Entity owner attribute, but there's a doubt in my mind that the components should only have a data. An Entity is a collection of data, if I  pass this data to components this could lead to over-killing of iteration. So I've changed my mind to use its attribute int flags, this could now be use as an id to reference to child-parent relationship.

public class OwnershipComponent implements {
    public int ownerId;
}

// Entity Manager class

public void create() {
    Entity character = createCharacter();
    createWeapon(0, 0, character.flags);
}

public void createWeapon(float x, float y, int ownerId) {
    Entity weapon = engine.createEntity();
    weapon.flags = // generated unique ID from the weapon category

    OwnershipComponent ownership = engine.createComponent(OwnershipComponent);
    ownership.ownerId = ownerId;

    weapon.add(ownership);
}

public Entity getEntityById(int id) {
    return ...
}

I could access now the parent entity by id and transform its child position relatively.

// Ownership System

public void processEntity(Entity entity, float deltaTime) {
    OwnershipComponent ownership = Mapper.ownership.get(entity);
    Entity parent = EntityManager.getEntityById(ownership.ownerId);
}

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: How can I divide a grid map into clusters for path finding algorithm? I am trying to implement HPA algorithm for finding the shortest path between two point. I came across the paper Near Optimal Path Finding Algorithm (by Botea, Müller & Schaeffer) but I am stuck at the clustering part. I have a 2 dimensional array and each index in the array is a node. Could anyone help me clustering my 2 dimensional array into clusters?

sentences:
combining multiple materials into one material (Unity) I am confused with how should I texture my character.

I am using blender for modelling. And while my model is too complex I dont want to use uv map techniuqe. I can get what I need with using seperate materials. Therefore I assign different materials to different meshes in Blender then import it to Unity. Therefore I have lots of different material in one model and I think it increases draw call. What can I do to combine these material into just one.

I thought baking would be sollution but while my character is dynamic I can not get a good result.

sentences:
How to instantiate a gameobject multiple times in unity during runtime? After destroying a gameobject in unity, how to instantiate it and make it do the exact same thing what the gameobject before getting destroyed was doing? My gameobject is a car which follows a path made out of nodes. After it is destroyed at a particular node, I want to instantiate it at a particular point which is the spawnSpot in my code, then I want it to follow the same path again and then get destroyed again and get instantiated again and follow the same path again and so on.
Right now, I am able to make my car follow a certain path and then destroy it at a certain node and and instantiate it and make it follow the same path again. Then my car is destroyed again and instantiated again but this time it does not follow the path and stays right at the spawnPoint.
I am using the destroy and instantiate functions in fixed update. Here's the relevant part of my code:

private void Destroy()
{
    if(currentNode == nodes.Count - 1)
    {
        Destroy(this.gameObject);
    }
}

private void Instantiate()
{
    if(currentNode == nodes.Count - 1)
    {
        Instantiate(prefab, spawnspot, Quaternion.identity);
    }
}

P.S. prefab is the gameObject.

sentences:
Overview/showcase of shader techniques/uses for games I am looking for resources that can provide me with a better understanding of what kind of things shaders are used for in games, what they can do, and maybe even more importantly, what they cannot. I understand how the graphics pipeline works and all that, and I have made some very basic shaders in GLSL (mostly just to replace the fixed-function pipeline functionality), but I don't yet fully understand which things are only possible with custom shaders, which things can be done more efficiently, etc. I have been able to find some examples of certain techniques, most notably lighting, but I am looking for a more higher-level overview of their usage.

Links to and explanations of certain interesting techniques, as opposed to an overview, are also appreciated (but less than an overview ;) ), preferrably in GLSL or pseudocode.

sentences:
How to develop a concept to receive funding? I have a game concept which I wish to develop but don't have the funding to begin it.

What should I do?

sentences: Changing texture offset in unity by script I am trying to change texture offset in a material by a script to create a parallax effect, but it doesn't move a bit no matter what I am trying. Any tips for this case? Or am I missing something?

sentences:
Visual Studio 2012 and Game Development Alright, I think it's a simple question, but I got difficulties to find some answers around.

I already read that XNA wouldn't be in Visual Studio 2012.  I recently learned to use XNA, but since I would like to work on games, I'd like to know if there's a way to develop games using C# on Visual Studio 2012, or if I should learn everything again using C++ and Direct3D?

C# is a language I like a lot, so if there's no way to do it in C# but something quite easy to use Java for game development, I'd also be interested.

Thanks a lot!

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:
Why might a body suddenly stop while moving on continue platform? I have a 32x32 sprite and I make some to be platform like this

for (int i = 0; i < 15; i++) {
    attachChild(new Ground(32 * i, 200, regPlatform, vertexBufferObjectManager, physicsWorld));
}

And I have another sprite (32x32 also) moving over those platforms (A player object)

attachChild(new Player(10, 10, regPlayer, vertexBufferObjectManager, physicsWorld));

And the physicsWorld connects the player like this (Where move=1 when user click right button, and move=2 when user click left button)

physicsWorld.registerPhysicsConnector(new PhysicsConnector(this, body, true, false) {
    if (move == 1) {
        body.setLinearVelocity(new Vector2(8, body.getLinearVelocity().y));
    } else if (move == 2) {
        body.setLinearVelocity(new Vector2(-8, body.getLinearVelocity().y));
    }
}

The Player moves smoothly form left to right and reverse. But sometimes, it is blocked.
If the player move back a bit, and back again where it is blocked, it isn't blocked any more at the same place.

Anyone has any idea to fix this? Maybe it is a bug of andengine and box2d and I need some trick here? Please help me. (The two sprites above are just normal png with 32x32px)

Player image:

Platform image:

sentences:
Eliminate isolated cave in procedural cave generation I've got an algorithm that generates a cave procedurally, the map is modeled in the data as a 2d array of 0s (empty space) and 1s (wall). The algorithm works just fine, but I've got quite some isolated small caves on the scene, which I would like to avoid.

That's how the map looks that gets generated. Is there some efficient algorithm to remove the black holes in the white wall sections? I was thinking of something like:

For every closed cave, check if there is a bigger cave and if so, close it.

But that seems insanely inefficient since I'd have to loop over the map a lot in order to do this for all small caves.

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:
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:
Where did I lose vertex binding? I make OpenGL render framework for my bachelor graduate work.
I created simple Model and Shader classes. But when I tried to render some vertices, they do not render. I saw with an OpenGL profiler, that I haven't vertex data, but in code I bind it.
There's my main class:

GLfloat vertex_positions[] = {
        0.0f, 0.5f, 1.0f, 0.0f, 0.0f,
        0.5f, -0.5f, 0.0f, 1.0f, 0.0f,
        -0.5f, -0.5f, 0.0f, 0.0f, 1.0f
};
GLchar *vertexShader = (GLchar *)
                "#version 150\n"
                "\n"
                "in vec2 position;\n"
                "\n"
                "void main()\n"
                "{\n"
                "    gl_Position = vec4(position, 0.0, 1.0);\n"
                "}";
GLchar *fragmentShader = (GLchar *)
        "#version 400 core\n"
        "\n"
        "out vec4 fColor;\n"
        "\n"
        "void main()\n"
        "{\n"
        "    fColor = vec4(0.5, 0.4, 0.8, 1.0);\n"
        "}";
static const GLfloat vertex_colors[] =
        {
                1.0f, 1.0f, 1.0f, 1.0f,
                1.0f, 1.0f, 0.0f, 1.0f,
                1.0f, 0.0f, 1.0f, 1.0f,
                0.0f, 1.0f, 1.0f, 1.0f
        };
Shader shader;
shader.CompileShader(Shader::ShaderType::Fragment, fragmentShader);
shader.CompileShader(Shader::ShaderType::Vertex, vertexShader);
glBindFragDataLocation(*shader.GetProgram(), 0, "fColor");
shader.Link();
Texture texture((GLfloat *) vertex_colors, 16);
Model model (vertex_positions, &shader, &texture);
while (!glfwWindowShouldClose(window))
{
    static const float black[] = { 0.2f, 0.3f, 1.0f, 1.0f };
    glClearBufferfv(GL_COLOR, 0, black);
    shader.Bind();
    model.Draw();
    glfwPollEvents();
    glfwSwapBuffers(window);
}

And my model class:

void Model::Draw() {
glBindVertexArray(_vao);
glBindBuffer(GL_ARRAY_BUFFER, _vbo);
glDrawArrays(GL_TRIANGLES, 0, 3);
}

Model::Model(GLfloat meshVert[], int m_size, GLuint vertexInd[], int
v_size, Shader *material, Texture *texture) {
glGenVertexArrays(1, &_vao);
glBindVertexArray(_vao);

glGenBuffers(1, &_vbo);
glBindBuffer(GL_ARRAY_BUFFER, _vbo);
glBufferData(GL_ARRAY_BUFFER, sizeof(GLfloat)*m_size, meshVert,
   GL_STATIC_DRAW);

GLint posAttrib = glGetAttribLocation(*material->GetProgram(), "position");
glEnableVertexAttribArray((GLuint) posAttrib);
glVertexAttribPointer((GLuint) posAttrib, 2, GL_FLOAT, GL_FALSE, 5 * sizeof(GLfloat), 0);

GLint colAttrib = glGetAttribLocation(*material->GetProgram(), "color");
glEnableVertexAttribArray((GLuint) colAttrib);
glVertexAttribPointer((GLuint) colAttrib, 3, GL_FLOAT, GL_FALSE, 5 * sizeof(GLfloat), (void*)(2 * sizeof(GLfloat)));

}

P.S.: OpenGL profiler breaks on command glDrawArrays, but when I saw data info, it was empty. That's why I think I lost some data bind.
P.S.S: System: macOS Sierra, Intel HD 6000.

sentences:
Fitting Gameobjects within camera view I am trying to fit a grid of gameobject into the orthographic view but I have a problem whenever I change the amount of grids to display it would overlap the view.

What cαn I do to fit a series of gameobjects, having always the same margin as the amount of grid changes?

private void Start() {
    for(int i = 0; i < wordSearch.Gridsize; i++) {
        for(int j = 0; j < wordSearch.Gridsize; j++) {
            cell = Instantiate(gridCell, new Vector3(j * 1 * gridCell.transform.position.x * cellSpacing, i * 1 * gridCell.transform.position.y * cellSpacing, 0), Quaternion.identity);
            cell.name = "cell-Y: " + i.ToString() + " cell-X: " + j.ToString();
            GameObject textObject = cell.transform.GetChild(0).gameObject;
            textObject.GetComponent<TextMeshPro>().text = wordSearch.matrix[i, j].ToString();
            textObject.name = textObject.GetComponent<TextMeshPro>().text;
        }
    }
    CenterPoint();
   // FitToScreen();
}

private void CenterPoint() {
    Vector3 offset = new Vector3(0, -1, -10);
    cellGameobject = GameObject.FindGameObjectsWithTag("cell");
    transformCell = new Transform[cellGameobject.Length];
    for(int i = 0; i < cellGameobject.Length; i++) {
        transformCell[i] = cellGameobject[i].transform;
    }
    for(int a = 0; a < transformCell.Length; a++) {
        cellVectors += transformCell[a].position;
    }
    centercell = cellVectors / transformCell.Length;
    GetComponent<Camera>().transform.position = centercell + offset;
}

private void FitToScreen() {
    Camera.main.orthographicSize = /* Insert Comment */
}

sentences:
How to determine this kind of vector? Take a look at the picture.

I've got a camera(brown) and its ray(red). As I know ray has a direction and unlimited length(if you don't set it yourself). But now I need to determine ray's vector that starts at camera point and ends when it crosses a floor. How can I do that?

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:
Electronic circuit simulator four-way flood-filling issues I've made an electronic circuit board simulator which has simply 3 types of tiles: wires, power sources, and inverters. Wires connect to anything they touch, other than the sides of inverters; inverters have one input side and one output side; and finally power tiles connect in a similar manner as wires. In the case of an infinite loop, caused by the output of the inverter feeding into its input, I want inverters to oscillate (quickly turn on/off).

I've attempted to implement a FloodFill algorithm to spread the power throughout the grid, but seem to have gotten something wrong, as only the tiles above the power source get powered (as seen below)

I've attempted to debug the program, but have had no luck thus far. My code concerning the updating of power can be seen here.

sentences:
How can I get width and height of grouped objects in Unity3D Is it possible to get height and width of grouped objects like this?

I tried boxcollider2d.bounds and renderer.bounds. Each shapes in the group has collider component.

Is it possible?

sentences:
Vector2.Distance on different resolutions firstTouchPos = Camera.main.ScreenToWorldPoint(Input.GetTouch(0).position);

endTouchPos = Camera.main.ScreenToWorldPoint(Input.GetTouch(0).position);

                        //the height of the background(previously scaled to fit the screen) / 10
minSlidedDistance = (int)(SpriteRend.bounds.size.y / 10);

if (Vector2.Distance(firstTouchPos, endTouchPos) > minSlidedDistance)
{
  //do smth
}

This way I check if the player has slided into any direction with a slided distance longer than minSlidedDistance. It works perfectly for different size devices.

Is unity going to make the calculations itself if I simply write minSlidedDistance = 100? I.e. is it still going to work same way on all devices?

P.S. this is not the full code, there are many other IF checks, like the ones for assigning the value to firstTouchPos & endTouchPos

sentences:
How should I start playing with 3D? One of my hobbies (aside programming, of course) is 3d modeling (completely amateur, using 3ds MAX) and I'd like to mix programming with 3d modeling (what a marriage!). So I've read a little about it and figured I'd have to have good notions on geometry, math, point spacial position (which I do, from my 3d modeling experience), but I don't know how to use API's for it, so I've 'simulated' simple 3d with some simple programs I've made (first a spinning cube, then a more complex Labyrinth (or maze, if you will)).

NOTE: I have no intentions on harming anyone's computers. If you don't trust it, use a VM or something.
Once you run it, I'd appreciate if you commented here stating that the EXE's are safe. Thank you.

Here are some questions:
1) What would be a nice 3d development tool for a .NET programmer like me?
2) Is there a way of using 3d models made in 3DS Max ? (I intend on modeling characters)
3) What knowledge should I have in order to render it, and move it around ?
4) Which API should I use ?

The development environment would be nice if it:

Had the possibility to import existing 3D models exported by 3DS MAX (not a must, but a plus)
Had the ability to create 3d models programmatically (a must)
Possibly has a tool for materials and textures (that would be a huge plus)
Is Well known (high availability of tutorials, questions in S.O., forums..)

And it would be really nice if I could use C# all the way :)

EDIT
For the ones that asked if I want to do something more UI-guided, just to mess around with some models, and not learn about how to create a game-engine, I say no, that's not the case.

If you download my Labyrinth little game, you'll notice that I've basically MADE a simple renderer from scratch using DrawPolygon on bitmaps created via code. So that's a clue that what I want is to learn, and that I somehow like the idea of mixing images and codes together, along with some user interaction.

Imagine that I have a model, say the weighted companion cube, and I want to make a full-screen, or windowed lil' program that spins it (much like the crappy spinning cube I've made a while before the other one), setting the position, the position and angle of the camera, velocity, a simple ambient (say a simple monocolor box (which would be a room) drawn maybe through code (not an imported model)) and editing it with simple user interaction (say pressing left or right on the keyboard changes direction, or pressing '+' would make it faster), all that without using a wizard or something, but coding.

Now for those that didn't quite get my intentions in here, I hope this example makes it clearer of how powerful and customizable I hope it should be. If there are any more questions, let me know!

EDIT
I'm going to start with UNITY, and I've noticed there's a pro version, is the free version enough to do what I want ? (not counting on the 1 month free pro account)
As for XNA, does the same scenario apply as well ?
Please leave a comment!

sentences:
How to construct a propeller clock in Unity? I am considering the possibility of using Unity to construct a propeller clock https://www.youtube.com/watch?v=-6JnAxTXApw .
It's an array of LEDs on a PCB board connected to motor that spins at a high RPM. The LEDS flash on and off such that it generates the appearance of a clock face.
So far, I've tried turning a red pointer in a circular path with high RPM in Unity, but I don't get an image of a circular red disc. Instead I see a pointer showing random discrete movement in a circular path.
Is there any suggestion to rectify this issue?

sentences:
FPS drop on rendering I am trying to create my own game in java  (without OpenGL, LWJGL etc) and I am having a problem with the rendering.
My map is pretty big and the game redering the entire map at once which cause a result of 2 fps.
Does anyone know how I can make my game to render only what the player see and not the entire map?
map loading code:
private void loadMap(BufferedImage image) {
    int w = image.getWidth();
    int h = image.getHeight();

    for(int i = 0; i<w; i++) {
        for(int j = 0; j<h; j++) {
            int pixel = image.getRGB(i, j);
            int red = (pixel >> 16) & 0xff;
            int green = (pixel >> 8) & 0xff;
            int blue = (pixel) & 0xff;

            if(red >=250)
                handler.addObject(new Wall(i*32, j*32, ID.Wall));

            if(green==255)
                handler.addObject(new Floor(i*32, j*32, ID.Floor));
        }
    }
}

camera code:
public void tick(GameObject object) {

    x += ((object.getX()-x)-Game.WIDTH/2)*0.05f;
    y += ((object.getY()-y)-Game.WIDTH/2)*0.05f;

}

    g2d.translate(-camera.getX(), -camera.getY());
    handler.render(g);
    maps.render(g);
    g2d.translate(camera.getX(), camera.getY());

more codes for MCVE:
public synchronized void start() {
    thread = new Thread(this);
    thread.start();
    running = true;
}

public synchronized void stop() {
    try {
        thread.join();
    } catch (InterruptedException e) {
                e.printStackTrace();
    }
}

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();
}

public void tick(){
    for(int i = 0; i<handler.objects.size(); i++) {
        if(handler.objects.get(i).getId() ==ID.Player) {
            camera.tick(handler.objects.get(i));
            hud.tick();
        }
    }
}

public class Window extends Canvas{

    private static final long serialVersionUID = -6357664197674207224L;

    public Window(int width, int height, String title, Game game) {
        JFrame frame = new JFrame(title);

        frame.setPreferredSize(new Dimension(width, height));
        frame.setMinimumSize(new Dimension(width, height));
        frame.setMaximumSize(new Dimension(width, height));

        frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
        frame.setResizable(false);
        frame.setLocationRelativeTo(null);
        frame.add(game);
        frame.setVisible(true);
        game.start();
    }
}

public static void main(String[]args) {
    new Game();
}

public void render() {
    BufferStrategy bs = this.getBufferStrategy();
    if(bs == null) {
        this.createBufferStrategy(3);
        return;
    }
    Graphics g = bs.getDrawGraphics();
    Graphics2D g2d = (Graphics2D) g;
    g.setColor(Color.black);
    g.fillRect(0, 0, WIDTH, HEIGHT);
    //GameState

    //////////////////////////////////////////
    if(GameState == STATE.game) {
    g2d.translate(-camera.getX(), -camera.getY());
    handler.render(g);
    g2d.translate(camera.getX(), camera.getY());
    hud.render(g);
    }

sentences:
How to create a fog effect in XNA with PixelShaderFunction? I developped a small XNA games in 3D.
I would like to add a "fog of war" on my models instantiated with an effect in my (.fx) file.
The problem is, I do not know how to change the function
"PixelShaderFunction".

File [.fx]

Here is the declaration of my variables in my effect file (.fx):

// InstancedModel.fx
//
// Microsoft XNA Community Game Platform
// Copyright (C) Microsoft Corporation. All rights reserved.
//-----------------------------------------------------------------------------

// Camera settings.
float4x4 World;
float4x4 View;
float4x4 Projection;

//Fog settings
float FogNear;
float FogFar;
float4 FogColor;

And my function "PixelShaderFunction" in my effect file (.fx):

// Both techniques share this same pixel shader.
float4 PixelShaderFunction(VertexShaderOutput input) : COLOR0
{
    return tex2D(Sampler, input.TextureCoordinate) * input.Color;
}

sentences:
Using PlayerPrefs to save audio volume throughout scenes in Unity I have game that plays music. I have a mute toggle button that will mute my game music when you press on it, it will also un-mute it when you press it again. I'm having problems with saving the audio volume when a scene is loaded. (I tried using DontDestoryOnLoad but my mute script is attach to my main menu canvas so its saving the canvas as well, which I do not want. I find using playerprefs a lot easier). For example, when I click on my mute button, it mutes my game, I play the game, die, restart the game and the volume is being restarted as well. Even though I used playerprefs to try and solve the problem it didn't work, it still did the same thing. Anyway this is my script:

public bool mute;
public static Vector3 target;

void Start ()
{
    PlayerPrefs.GetFloat("mute");
}

void  Update()
{
    PlayerPrefs.GetFloat("mute");
}

private void Muted ()
{
    mute = !mute;
    if (mute) {
        gameObject.GetComponent<AudioSource> ().volume = 0;
        PlayerPrefs.SetFloat("mute", 0);
    }
    else
    {
        gameObject.GetComponent<AudioSource> ().volume = 1;
        PlayerPrefs.SetFloat("mute", 1);
    }
}

sentences:
Sprite outline based on light position in UE4 I have simple sprite (for example black box) and I like to add to it outline (red line on example image) but based on light direction. I know UE4 use deffered renderer, so I cant access to lights, but I can pass informations as params to material (angle, distance, intensity...). But still Im not sure how to compute visible corner which is lit by light.

Can you please point me how to achieve this effect?
Thank you.

sentences:
How can "Box Collider is trigger" apply to the Player, not the enemies (make them collide, not pass through)? So, in my game, the Powerup (capsule) has a RigidBody and a Box Collider.  I’ve set the Box Collider to «is trigger». When the player hits the powerup, it disappears - just as it’s supposed to.

Is it possible to let the enemies collide with the powerup (bump into it) instead of just passing through it? From the Enemy script:

    void Start()
{

        enemyRb = GetComponent<Rigidbody>();
        gameManager = GameObject.Find("GameManager").GetComponent<GameManager>();
        player = GameObject.Find("Player");

}

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

    if (player != null && gameManager.isGameActive)
    {
        enemyRb.AddForce((player.transform.position - transform.position).normalized * speed);
    }

    if (transform.position.y < -4)
    {
        Destroy(gameObject);
        gameManager.UpdateScore(pointValue);
    }
}

From the PlayerController script:

private void OnTriggerEnter(Collider other)
{
        if (other.CompareTag("Powerup"))
        {
            hasPowerup = true;
            Destroy(other.gameObject);
        }
}

sentences:
How do I get an xbox 360 controller to rumble? I am interfacing with the controller using the windows HID API. It seems that its output report length, as provided by the HID driver, is 0, which means I can't send it anything (e.g. make the rumble work). I've also noticed that the input report doesn't include the state of the big "X" button. Am I wrong about this? Is there a workaround, a better API, a workable filter driver that doesn't involve making .infs, etc...?

As I need to support an arbitrary number of controllers (keyboards, mice, and anything for that matter), xinput isn't an option. Installing drivers is also not an option, unless it can be done silently without breaking the device for every other application.

sentences:
DirectCompute information I've been trying to make use of the GPU as part of a project of mine. I've looked into both CUDA and OpenCL, but the lack of information showing you how to introduce these into a project is shocking. Even their dedicated forum groups are dead. So now, I'm looking into DirectCompute.

From what I can tell, it's simply a new type of shader file that makes use of HLSL. My question is this, does my program (aside from being DirectX 10 / 11 ) need its structure changed?

I mean, is it simply a case of creating the CS file, setting in the project like I would any other shader, and watch the magic happen?

Any information on this would be appreciated.

sentences:
Cocos2dx+Chipmunk: Fully elastic collision between moving bodies I'm using Cocos2dx and the built in Chipmunk physics engine, and currently I've got my PhysicsBodys' materials set up with:

Density=0
Restitution=1
Friction=0

in order to get fully elastic collision, and keep moving bodies moving at a constant speed. This works great if they collide against a static element, like a wall, not so much if they collide with other moving objects.

I'm moving these bodies by applying an initial force:

Vec2 velocity = moveDirection.getNormalized()*moveSpeed - myPhysicsBody->getVelocity();
Vec2 newForce = myPhysicsBody->getMass()*velocity / deltaTime;
myPhysicsBody->applyForce(newForce);

So I'm guessing that even though their materials would result in fully elastic collisions, the moving objects both carry an impact force, this modifies the resulting force into one with different magnitude? All these moving bodies have the same mass.

Currently I'm manually catching the impact start and manually generating the resulting force in the right directing, and using the object's speed to apply it with the same previous magnitude, effectively overriding Chipmunk's collision resolution.

Is this the best way to do this, or can I configure my bodies in a way that allows Chipmunk collision resolution to achieve the same effect? I'm a bit rusty on my physics.. heh..

sentences:
How can I implement smooth rotation from one direction to another? I'm having a problem with animating rotations with 1Matrix.CreateRotationY() with my basic 3D game. Based on where you click the mouse, I want the 3D object to rotate to that direction and then move.

I am using this to determine the target direction:

float rot = (float)(Math.Atan2(X, Z));

It gives me the correct value, but I am not sure how to handle the rotation animation from current direction to new direction. I've tried a few things, but to no avail.

Do you guys know of any good ways of solving this issue?

sentences:
XNA, SpriteBatch: Slow when rendering lots of sprites? I've just now tested rendering a lot of sprites using XNA's SpriteBatch class. What I basically do is this:

Somewhere in the code, I have a list which contains all sprites that have to be rendered. I prefilled this list with 2500 Sprites, all of which have the same rotational angle, texture, position etc.

I then draw them like this:

    spriteBatch.Begin();
    foreach (Sprite spr in sprites)
        spriteBatch.Draw(spr.Texture, spr.Position+spr.Center, spr.SourceRect, spr.Color,MathHelper.ToRadians( spr.Rotation ), spr.Center, spr.Scale, SpriteEffects.None, spr.Depth);

    spriteBatch.End();

and I'm getting really poor performance. I only average about 15FPS with my Radeon HD 6850 graphics card and i5 2500k CPU.

This is very surprising to me, since I average about 70 FPS doing exactly the same thing with my own custom OpenGL engine, which uses old OpenGL rendering (meaning one draw call for every single sprite). I actually expected XNAs rendering to be a ton faster, since it draws everything in one draw call.

Am I rendering this the wrong way? Playing around with SpriteSortMode settings has made almost no difference, some of them just make it a tiny bit slower (depth sorting etc.).

sentences:
Turning a board game idea into a browser based, slow paced gameplay Suppose I want to create a strategy game with global mutable state shared between all players (think game board). But unlike a board game, I don't want it to be real time action and/or turn-based. Instead, players should be able to log in at any time of the day and spend a fixed number of action points per day as they wish. As opposed to a few hours, game sessions would run over a few weeks.

This is meant to reward good strategy rather than time spent playing (as an alternative, hardcore players could always play multiple games in parallel instead) as well as all kind of issues related to live playing like disconnections and synchronization. The game should remain addictive still have a low time investment footprint for casual players.

So far so good, but this still leaves open the question of when to solve actions and when they should be visible. I want to avoid "ninja play" like doing all your moves just a few minutes before daily point reset to take other players by surprise, or people spamming F5 to place a well-timed action which would defeat the whole point of a non real-time game.

I thought of a couple of approaches to that :

Resolve all events in a single scheduled process running once a day. This basically means a "blind" gameplay where players can take actions but don't see their results immediately. The thing is, I played a similar browser game a few years ago and didn't like the fact that you feel disconnected and powerless until there's that deus ex machina telling you what really happened during all that time. You see the world evolve in large increments of one day, which often doesn't seem like seeing it evolve at all.
For actions that have an big impact on the game or on other players (attacks, big achievements), make them visible to everyone immediately but delay their effect by something like 24 hours. Opposing players could be notified when such an event happens, so that they can react to it.

Do you have any other ideas how I could go about solving this ? Are there any known approaches in similar existing games ?

sentences:
NPOT texture and video memory usage I read in this QA that NPOT will take memory as much as next POT sized texture. It means it doesn't give any benefit than POT texture with proper management. (maybe even worse because NPOT should be slower!)

Is this true? Does NPOT texture take and waste same memory like POT texture? I am considering NPOT texture for post-processing, so if it doesn't give memory space benefit, using of NPOT texture is meaningless to me.

Maybe answer can be different for each platforms. I am targeting mobile devices. Such as iPhone or Androids. Does NPOT texture takes same amount of memory on mobile GPUs?

sentences:
Proper vertex buffer use How're you supposed to use vertex buffers?

Say you have 500 distinct deformable shapes/models in the world (ie you want to be able to change/delete vertices from the models somewhat arbitraily as the game progresses).  The requires you refresh the vertex buffers in the frames the model has become dirty, at least.

So how should you handle your vertex buffer, assuming D3D11 interfaces (so vertex buffers are your only option to draw anything):

Store model vertices in CPU RAM.  Create one vertex buffer at program start. For each model, copy the vertices into the single vertex buffer, render
Create 500 vertex buffers, update each when necessary, render.

sentences:
Unity - Syncing/Downloading/overwriting files to a local folder accessed by the game when offline? I currently have a game/application (PC/Standalone only) made in Unity which features a multitude of buttons which all link to external webpages which open up in the user's browser window.
Recently my client expressed an interest in having an offline version, where all the online content is available locally offline, as their users regularly go offsite to areas without an internet connection and the buttons are then useless.
I have done a new version which has all the webpages, PDFs and videos saved off as local files and placed in a folder within the build folder, the buttons now use the following script to read the files from there instead -

public class URLOpener_OFFLINE : MonoBehaviour {

    public void relativeURL(string url)
    {
        Application.OpenURL(url);
    }
}

This works perfectly on a basic level.
However my client has expressed an interest in being able to update the offline content without having to make a new build each time or manually go and update the folder content.

So basically what I need is to be able to store all the offline files somewhere online, which can be overwritten as and when is needed.
Then I need some way of syncing the game with this online location (when the user is online), to pull down the latest files into the offline folder and overwrite the files in there, so the latest offline files are included when they go offsite to an area without internet.

Is this possible at all?  I am more than happy to pay for a plugin or service that would provide this sort of feature.

I already have a plugin for translated languages which essentially does this (https://www.assetstore.unity3d.com/en/#!/content/14884) - changes to the online spreadsheet containing all the text is pulled down when the game syncs.  But this is obviously a bit different to downloading actual files and placing them in a specific folder.

Any help or advice would be appreciated.

Many thanks in advance

sentences:
unity: read from text file to instantiate objects I'm trying to use the following code to read a text file stored in the Resources folder or in a file on my computer, and instantiate objects in a Unity 3D scene accordingly. I'm having trouble getting it to work. I've tried attaching the script to either the main camera or an empty gameobject. Neither work so far...

I either end up with an error saying the path does not exist (when I put the text file into the project folder on my desktop), or a null exception, or that the path contains invalid characters.

Where am I going wrong?

I'm trying to use a jagged array because I'll need users to eventually be able to change the text file on-the-go to create a level.

The text file contains the following data:
 S 0 0 0 1
 0 0 1 0 2
 2 0 0 2 1

My script currently reads:

using System.Collections;
using System.Collections.Generic;
using System.Text.RegularExpressions;
using UnityEngine;
using System.Linq;
using System.IO;
using UnityEngine.UI;

public class GenerateLevel : MonoBehaviour {

    public Transform player;
    public Transform ground;
   // public Transform floor_valid;
    public Transform floor_obstacle;
    //public Transform floor_checkpoint;

    //public const string sfloor_valid = "0";
    public const string sfloor_obstacle = "0";
   // public const string sfloor_checkpoint = "2";
    public const string sstart = "S";

    public string textFile = "maze";
     string textContents;

    // Use this for initialization
    void Start () {
        Instantiate(ground);

        TextAsset textAssets = (TextAsset)Resources.Load(textFile);
        textContents = textAssets.text;

        //string[] lines = System.IO.File.ReadAllLines("//maze.txt");

        //string textFile;
        //textFile = Resources.Load("assets/resources/maze").ToString();

        string[][] jagged = ReadFile(textContents);

        for (int y = 0; y < jagged.Length; y++)
        {
            for (int x = 0; x < jagged[0].Length; x++)
            {
                switch (jagged[y][x])
                {
                    case sstart:
                        //Instantiate(floor_valid, new Vector3(x, 0, -y), Quaternion.identity);
                        Instantiate(player, new Vector3(0, 0.5f, 0), Quaternion.identity);
                        break;
                    //case sfloor_valid:
                      //  Instantiate(floor_valid, new Vector3(x, 0, -y), Quaternion.identity);
                        //break;
                    case sfloor_obstacle:
                        Instantiate(floor_obstacle, new Vector3(x, 0, -y), Quaternion.identity);
                        break;
                    //case sfloor_checkpoint:
                      //  Instantiate(floor_checkpoint, new Vector3(x, 0, -y), Quaternion.identity);
                        //break;
                }
            }
        }
    }

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

    }

    string[][] ReadFile(string file)
    {
        string text = System.IO.File.ReadAllText(file);
        string[] lines = Regex.Split(text, "\r\n");
        int rows = lines.Length;

        string[][] levelBase = new string[rows][];
        for (int i = 0; i < lines.Length; i++)
        {
            string[] stringsOfLine = Regex.Split(lines[i], " ");
            levelBase[i] = stringsOfLine;
        }
        return levelBase;
    }
}

sentences:
c++ opengl unproject not working first of all, sorry for the bad english.

I need to convert my mouse coordinates to world coordinates,
I'm trying to use the glm unproject method.
1280x720 is the size of the window, It's hard coded just for the test.
The View and Projection are my matrices, they're fine and are not related to the problem (or so I guess).

EDIT: Success. The solution is:

int x,y;
glfwGetMousePos(&x, &y);

GLint viewport[4];
glGetIntegerv(GL_VIEWPORT, viewport);

y = viewport[3] - y;
float depth;
glReadPixels(x, y, 1, 1, GL_DEPTH_COMPONENT, GL_FLOAT, &depth);

mousePos = glm::unProject(vec3(x, y, depth), View, Projection, vec4(viewport[0], viewport[1], viewport[2], viewport[3]));

This method seem to have worked.

sentences:
Using an interpolated game loop (such as Gaffer's final game loop), will the frame be rendered out of sync? A highly recommended game loop is one from an article called Fix Your Timestep. It presents a method to update using a semi-fixed time step with interpolated rendering.

The problem with this is that, by interpolating the rendering, you are effectively averaging two states in the game - the current and the previous. If the previous frame is averaged with the current frame, the player will be shown the game slightly delayed.

If the player is stationary in one update, then teleports in the next, the interpolation will show a state where the player is mid-way between a teleport very briefly.

For time-critical games, is my thinking correct that the player may see a different/slightly lagged state on screen (the interpolated state) than what is actually stored in memory?

The only fix I can think of is to interpolate the current state + the next, not yet calculated, state. This gives the correct image on screen instead of a slightly delayed previous image... but then we are stuck in a paradox of calculating the next future update.

Or perhaps the time difference is so minimal that it doesn't matter?

I am referring to the following line, the current state is where we are at this moment in time and not fully displayed:

State state = currentState * alpha + previousState * ( 1.0 - alpha );

sentences: Managing a complex game storyline or quests system What kind of methods are best used managing complex story lines in a game? A simple story is basically linear line with stops, so that would not be that difficult, but a more complex one is basically an elaborate directed graph, with certain requirements to move between nodes. So how does one effectively store and maintain a complex game storyline that has multitude of paths and goals?

sentences:
Coroutine stops when Time.timeScale = 0 I have a coroutine that smoothly changes a variable in my UI, but when I pause the game, the coroutine pauses too. How can I fix that?

Code:

using UnityEngine;
using System.Collections;

public class HUDController : MonoBehaviour {
    public void PauseGame() {
        FreezeTime();
        StartCoroutine(ShowPauseMenu());
    }

    private void FreezeTime() {
        Time.timeScale = 0;
    }

    private IEnumerator ShowPauseMenu() {
        var pauseMenuCanvasGroup = GameObject.FindWithTag("PauseMenu").GetComponent<CanvasGroup>();
        var alphaValue = 1f;
        var velocity = 0f;
        var time = 0.15f;

        while (!Mathf.Approximately(pauseMenuCanvasGroup.alpha, alphaValue)) {
            pauseMenuCanvasGroup.alpha = Mathf.SmoothDamp(pauseMenuCanvasGroup.alpha, alphaValue, ref velocity, time);
            yield return null;
        }

        pauseMenuCanvasGroup.alpha = 1; // Since float is not accurate, manually set the alpha to 1
        pauseMenuCanvasGroup.interactable = true;
    }
}

sentences:
Drawing Lines on android with matrix Can a matrix be used when drawing lines and paths on android?

the DrawBitmap mathod takes a matrix as argument, I cannot find anything similar
when drawing lines.

sentences:
Making a GUI shader in GLSL c++/opengl/freeglut How do you make a shader that will draw ontop of everything else? Im using an approach where I draw square faces in 3d space to simulate a 2d box, but when I make a 3d object, it will clip over the 2d boxes as I move around.

How do you go about making 2d boxes that are drawn directly onto screen, but without clipping thru stuff in 3d space.

Im using openGL and glsl, swapping between shaders as I call objects draw call.

sentences: why is my mesh black in blender even though the color is set to white I set my mesh black then wanted to set it back to white but can't. How do i do it ?

sentences:
SmileBASIC sample programs source SmileBASIC (for Nintendo 3DS) comes with some sample programs.

I assume these are stored somewhere on the Micro SD card, but I cannot find them.  Where are they?  I would like to view the source on a PC.

sentences:
No more OpenGLES 2 UWP template in Visual Studio 2017? In Visual Studio 2015, a convenient cross-platform C++ project template was available named "OpenGLES 2 Application (Android, iOS, Windows Universal)."  I cannot find this template in Visual Studio 2017; only the Android + iOS template is present.

A response to this post on the VS dev community site suggests the template was removed by design.  If so, are there any alternatives I might consider to give a similarly streamlined workflow?

sentences: How can I take a screenshot of a certain part of the screen in PyGame? I need to for my pixel art tool that I'm making to help myself make games.

sentences:
Opengl ES 2.0: Is there a way to use less resources to draw in-game background texture 1.Should my in-game background be drawn with my game loop renderer, or if

2.I don't want to draw my background image every frame in my main renderer since it could possibly be a heavy job while the game loop is running. Do I need to use a separate thread or some other method to achieve this?

FYI, the background should be able to scale and translate with zooming function, it should be flexible.

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: Selecting a color that will be readable overlapped upon another? I've got random circles from random colors of RBG (assume they can be any combination of values). I have some text I want to write on top of them but I want the color to be readable on it no matter the color of the bubble. How can I pick a complimentary color?

sentences:
Spritesheet filesize gets huge after compiling I have a 14x2 spritesheet which has 125 Kb in raw .png.
But as soon as I compile that to .xnb, it mutates to 4 MB.

So my question is: Why is that? And how can I fix that?

sentences:
Variable Visibility Class Interaction I have a very general question about how game classes interact with eachother in a growing RPG game project I'm working on. (Writing it in java/Slick2D, not that is matters because the question is about the concepts)

I have a lot of classes, to name a few, a game class that stores the main game loop that updates all the objects and other classes like player, enemy, HUD, etc. Some variables (mostly ones from Player) are needed in other classes. For example, I need to get the player name, level, xp many times in other classes; my HUD needs the player info to display, I have a class to execute ingame cheat commands such as giving player xp, and my Inventory HUD needs to get the players inventory items to show, etc.

To summarize, what are some general pointers when it comes to getting variables from other classes. Lets say playerXP: my World class declares and holds a Player class, but there are so many other classes, unrelated to the player but still need to get player information. I don't want to make the playerXP public because then some class might accidentally change it. I just need to be able to access player info from many other classes.

sentences:
Target Lower API Level than Package or Plug-In Requirements I am working on a project that I want to use local mobile notifications for Android using Unity as game engine. I want to reach as much as users I can, so I want to target API level 16 for the lowest Android API level. As expected, when targeting Android API level 16 for a build, build fails with that error:

  Execution failed for task ':processReleaseManifest'.   Manifest merger failed : uses-sdk:minSdkVersion 16 cannot be smaller than version 19 declared in library [:androidnotifications-release:] C:\Users\Tumay Varel.gradle\caches\transforms-2\files-2.1\71d39d4badfde5815e850866bcf079c9\AndroidManifest.xml as the library might be using APIs not available in 16
       Suggestion: use a compatible library with a minSdk of at most 16,
           or increase this project's minSdk version to at least 19,
           or use tools:overrideLibrary="com.unity.androidnotifications" to force usage (may lead to runtime failures)

In documentation , it is explicitly saying that the package supports Android 4.4 (API 19) and higher API levels. I can handle this problem by targeting lowest API level 19, however I want to ask: Is there a way to use this package or any other package or any plug-in  for required and higher API levels while not using for lower API levels than requirement at the same project?

sentences:
How can I add an IsTrigger propriety from code? Unity I made an gameobject in my script and i made it a rigidbody, and added it a boxcollider, but I dont know how to tell the program to make it a trigger. Here's my code until now:

multi = new GameObject();
                multi.AddComponent<Transform>();
                multi.transform.position = new Vector2(1f, 1f);
                multi.AddComponent<Rigidbody2D>();
                multi.AddComponent<BoxCollider2D>();

sentences:
Procedural Dungeon Generation Connect Rooms With Passageways I've been working on a simple procedural generation class which currently places rooms on a x, y grid and selects a starting room. Each room needs to be connected with passageways so the player will be able to access them. The part that I am having issues with is how to actually connect the rooms.

There's a number of algorithms I've seen online, but I am unsure how to implement most of them.

As for my implementation of placing the rooms, the code tries placing them randomly on the grid until I get the desired density of rooms. After each room is placed, it is added to a list which stores the dimensions of the room. A room is them randomly selected to be the starting room.

Edit

Here's an example of the generated dungeons (the room with the "S" is the starting room):

Preferably, the rooms should be connected with their nearest neighbor. I'm not sure what the best way to go about this is.

sentences:
Choosing random array indexes in Unity C# I want to change a string by randomly choosing an index in an array, using the random.range command in unity. Bare in mind that I'm using strings here, not floats or integers. Here is a code example(not the real thing. I'm just coming up with this by example, but it still has the same meaning. I may make a few typo errors as a result):

public string ChangingString = ("");
public string[]ExampleArray = new string [2];

void Start () {
    ExampleArray[0] = ("String1");
    ExampleArray[1] = ("String2");
}
void OnGUI () {
    if(GUI.Button(new Rect(10,10,100,24), "Randomize text")){
        ChangingString = (code to choose random string using the ExampleArray);
    }
    GUI.Label(new Rect(10,30,100,20), ChangingString);
}

EXTRA NOTE: I'M NEW TO USING ARRAYS.

sentences:
Problems when rendering code on Nvidia GPU I am following OpenGL GLSL cookbook 4.0, I have rendered a tesselated quad, as you see in the screenshot below, and i am moving Y coordinate of every vertex using a time based sin function as given in the code in the book.

This program, as you see on the text in the image, runs perfectly on built in Intel HD graphics of my processor, but i have Nvidia GT 555m graphics in my laptop, (which by the way has switchable graphics) when I run the program on the graphic card, the OpenGL shader compilation fails.

It fails on following instruction..

pos.y = sin.waveAmp * sin(u);

giving error>>
Error C1105 : Cannot call a non-function

I know this error is coming on the sin(u) function which you see in the instruction.
I am not able to understand why?
When i removed sin(u) from the code, the program ran fine on Nvidia card.
Its running with sin(u) fine on Intel HD 3000 graphics.

Also, if you notice the program is almost unusable with intel HD 3000 graphics, I am getting only 9FPS, which is not enough. Its too much load for intel HD 3000.

So, sin(X) function is not defined in the OpenGL specification given by Nvidia drivers or something else??

sentences:
How can I use IntelliJ to make Minecraft mods? I'm starting out creating Minecraft mods with my son.

I've seen one YouTube tutorial which sets up project with Eclipse.

Since I don't like Eclipse much, I ask: how would I setup IntelliJ or Android Studio(if feasible) to develop Minecraft mods?

My son specifically want to create roller coaster mods.

sentences:
How to make a sprite jump up and then return to original position android java I am just starting out in game development and I am trying to make a simple android game using GDXLib. I want to make my sprite "ball" jump straight up in the air and then return to where it originally was. How would I do this? I have looked at multiple other answers from similar questions but none seem to work with my code. This is my code so far:

@Override
public void create () {
    batch = new SpriteBatch();
    background = new Texture("gamebackground.png");

    ball = new Texture("ball2.png");
    ball.setFilter(Texture.TextureFilter.Nearest, Texture.TextureFilter.Nearest);

    spike1 = new Texture("spike1.png");
    spike1.setFilter(Texture.TextureFilter.Nearest, Texture.TextureFilter.Nearest);
    spike2 = new Texture("spike2.png");

}

@Override
public void render () {

    batch.begin();
    float scaleFactor = 2.0f;
    batch.draw(background, 0, 0, Gdx.graphics.getWidth(), Gdx.graphics.getHeight());
    batch.draw(ball, 80, 145, ball.getWidth() * scaleFactor, ball.getHeight() * scaleFactor);
    batch.end();

Gdx.input.setInputProcessor(new InputAdapter () {
        @Override
           public boolean keyDown (int keycode) {
            if(keycode==Keys.UP)
            {
               ball.setHeight(ball.getHeight()+50);
            }
            return true;

    }

@Override
public void dispose () {

}

}

sentences:
More efficient in range checking I am going to use a specific example in my question, but overall it is pretty general. I use java and libgdx.

I have a ship that moves through space. In space there is debris that the ship can tractor beam in and and harvest. Debris is stored in a list, and the object contains it own x and y values. So currently there is no way to to find the debris's location without first looking at the debris object. Now at any given time there can be a huge (1000+) amount of debris in space, and I figure that calculating the distance between the ship and every single piece of debris and comparing it to maximum tractor beam length is rather inefficient.

I have thought of dividing space into sectors, and have each sector contain a list of every object in it. This way I could only check nearby sectors. However this essentially doubles memory for the list. (I would reference the same object so it wouldn't double overall. I am not CS major, but I doubt this would be hugely significant.) This also means anytime an object moves it has to calculate which sector it is in, again not a huge problem.

I also don't know if I can use some sort of 2D MAP that uses x and y values as keys. But since I am using float locations this sounds more trouble than its worth.

I am kind of new to programming games, and I imagined there would be some eloquent solution to this issue.

sentences:
How do Axis-Aligned Bounding Boxes update with rotations? I have a bounding box class with a min (x,y,z) and max point (x,y,z). The object that is being rotated has a rotation matrix (3x3 matrix), but I don't know how to update the bounding box with rotations.

I'm also a little confused if I should be using Oriented Bounding Boxes instead. For example, if the 3D object is a cube then the bounding box would rotate with it so they share the same 8 vertices at whatever rotation the cube is in.

What's the best way to represent the bounding box for rotations and test for collisions?

sentences:
FBO blit depth buffer to screen? I have an FBO in a deferred 4.3 OpenGL renderer, in which I setup the depth buffer of that FBO like this:

GLCALL(glGenRenderbuffers(1, &mDepthbuffer));
GLCALL(glBindRenderbuffer(GL_RENDERBUFFER, mDepthbuffer));
GLCALL(glRenderbufferStorageMultisample(GL_RENDERBUFFER, 0, GL_DEPTH32F_STENCIL8, windowWidth, windowHeight));
GLCALL(glFramebufferRenderbuffer(GL_FRAMEBUFFER, GL_DEPTH_STENCIL_ATTACHMENT, GL_RENDERBUFFER, mDepthbuffer));
GLCALL(glBindRenderbuffer(GL_RENDERBUFFER, 0));

Normally when I debug I can output the color attachments to screen easily, like this for normals:

GLCALL(glReadBuffer(GBuffer::GBUFFER_COLOR_ATTACHMENT_NORMAL));
GLCALL(glBlitFramebuffer(0, 0, mWindowWidth, mWindowHeight, 0, 0, mWindowWidth, mWindowHeight, GL_COLOR_BUFFER_BIT, GL_LINEAR));

But how can I do the same for the depth buffer contents, as it is not a color buffer?

sentences:
Realistic 2D air friction in unity I want to make an evolution games similar to this old games that was generating cars.
Except I want it to be more realistic.

So I want air friction to impact the speed of my cars, but how do I do that? wind will always be blowing at the same speed and in the same direction.

But my car chassis are random and their angle of attack can change due to the terrain shape (which is also random)

So I cannot apply a drag value, because this drag value change for the angle of attack. instead I must compute a new drag value for each frame.

Using real world physics might be to much to let the game run smoothly (10-20 cars running at the same time) How would you do it?

Thanks.

sentences:
Texture Wrapping isn't being applied properly I've debugged my application with codeXL and can verify that my texture is getting these attributes applied:

GL_TEXTURE_MIN_FILTER: GL_LINEAR
GL_TEXTURE_MAG_FILTER: GL_LINEAR
GL_TEXTURE_WRAP_S: GL_CLAMP_TO_EDGE
GL_TEXTURE_WRAP_T: GL_CLAMP_TO_EDGE
GL_TEXTURE_WRAP_R: GL_CLAMP_TO_EDGE

With the following UV data:

0, 0,
1, 0,
1, 1,
1, 1,
0, 1,
0, 0,
0, 0,
1, 0,
1, 1,
1, 1,
0, 1,
0, 0,
0, 1,
0, 1,
0, 0,
0, 0,
0, 0,
0, 1,
1, 1,
1, 1,
1, 0,
1, 0,
1, 0,
1, 1,
0, 0,
1, 0,
1, 0,
1, 0,
0, 0,
0, 0,
0, 1,
1, 1,
1, 1,
1, 1,
0, 1,
0, 1

Yet my cube still looks like this:
http://imgur.com/Dj2hCkp

The Front and Back are being mapped fine, but the sides and top/bot are all stretched. I've tried with GL_REPEAT, GL_CLAMP_TO_EDGE/BORDER, GL_MIRRORED_REPEAT, it's all the same result. I've tried only doing it with S and T. At this point I'm not sure what the problem is.

Vertex Shader + fragment + Buffers: (It's not that long)

https://ideone.com/5U39M3

I'm not really sure what it could be at this point. I thought my texture wasn't getting it's attributes applied correctly, but it is. Then i thought it was just my wrapping method, but all methods lead to the same result.

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:
Is there a way to use the facebook sdk with libgdx? I have tried to use the facebook sdk in libgdx with callbacks, but it never enters the authetication listeners, so the user never is logged in, it permits the authorization for the facebook app but it never implements the authentication interfaces :(

Is there a way to use it?

public MyFbClass()
{
    facebook = new Facebook(APPID);
    mAsyncRunner = new AsyncFacebookRunner(facebook);
    SessionStore.restore(facebook, this);

    FB.init(this, 0, facebook, this.permissions);
}

///Method for init the permissions and my listener for authetication
public void init(final Activity activity, final Facebook fb,final String[] permissions)
    {
        mActivity = activity;
            this.fb = fb;
        mPermissions = permissions;
        mHandler = new Handler();
        async = new AsyncFacebookRunner(mFb);

        params = new Bundle();

        SessionEvents.addAuthListener(auth);

    }

///I call the authetication process, I call it with a callback from libgdx
public void facebookAction()
    {
        // TODO Auto-generated method stub
        fb.authenticate();
    }

///It only allow the app permission, it doesnt register the events
public void authenticate()
    {
        if (mFb.isSessionValid())
        {
            SessionEvents.onLogoutBegin();
            AsyncFacebookRunner asyncRunner = new AsyncFacebookRunner(mFb);
            asyncRunner.logout(getContext(), new LogoutRequestListener());
            //SessionStore.save(this.mFb, getContext());
        }
        else
        {
            mFb.authorize(mActivity, mPermissions,0 , new DialogListener());

        }
    }

public class SessionListener implements AuthListener, LogoutListener
    {

        @Override
        public void onAuthSucceed()
        {
            SessionStore.save(mFb, getContext());
        }

        @Override
        public void onAuthFail(String error) {
        }

        @Override
        public void onLogoutBegin() {
        }

        @Override
        public void onLogoutFinish() {
            SessionStore.clear(getContext());
        }
    }

DialogListener() {

            @Override
            public void onComplete(Bundle values)
            {
                SessionEvents.onLoginSuccess();
            }

            @Override
            public void onFacebookError(FacebookError error)
            {
                SessionEvents.onLoginError(error.getMessage());
            }

            @Override
            public void onError(DialogError error)
            {
                SessionEvents.onLoginError(error.getMessage());
            }

            @Override
            public void onCancel()
            {
                SessionEvents.onLoginError("Action Canceled");
            }
}

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

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

sentences:
Performance problem when multiple enemies are grouped up I have enemy with simple behavior: Reach the player's current position. In game are increasing waves, which are increasing the number of enemies. But when are more enemies (like 14), and they got too close to each other, there is big physics spike in profiler.

There are significant drop of performance... And as Profiler says, it's because of Physics...

Now I am little lost, I tried turn of the ignore collision on layer (which was turned on), so they don't overlap, but there is still little touch of course, when they group up, so still so much to process...
What is the best solution here?
I build it around rigidbodies for the use of Velocity, and detection of collisions with walls (edge collider), so when the object reaches there, it is easily stopped... But for this cases it seems now like not the best solution.

sentences: Render TIny.x bones in Direcx 9 I would like to render the bones of the Tiny.x animated mesh.  I know there are 35 bones, and I know their names, but I'm having trouble with each bone's matrix.  Do I need to convert the matrix with d3dxvec3transformcoord function, or can I use the .m41,.m42,.m43 on the vertex buffer ?

sentences: What size window should i use for making an Xbox 360 game in XNA I have a basic understanding of XNA 4.0 and i want to create an xbox game. What size window should i use? should i use the 16:9 aspect ratio then put it in full screen?

sentences:
How to differentiate between colliding objects in Box2D? I need to differentiate between different points of contact in my racing game.

I currently have staticSensors which determine if the car is on the track or not, but I have created a second sensor to act as the 'finish line' but I am not sure how to differentiate the contact between the 'checkeredFlag' and all of the other sensors?

Any help would be appreciated! Here is my code:

include "contactListener.h"

void ContactListener::BeginContact(b2Contact* contact)
{
    b2Body* bodyA = contact->GetFixtureA()->GetBody();
    b2Body* bodyB = contact->GetFixtureB()->GetBody();

bool isSensorA = contact->GetFixtureA()->IsSensor();
bool isSensorB = contact->GetFixtureB()->IsSensor();

Wheel * wheel = (Wheel*)bodyA->GetUserData();
CheckeredFlag * flag = (CheckeredFlag*)bodyB->GetUserData();

if (isSensorA)
{
    StaticSensor * sensor = static_cast<StaticSensor *>(bodyA->GetUserData());
    sensor->action();
    Wheel * wheel = static_cast<Wheel *>(bodyB->GetUserData());
    wheel->offRoad();
    return;
}

if (isSensorB)
{
    StaticSensor * sensor = static_cast<StaticSensor *>(bodyB->GetUserData());
    sensor->action();
    Wheel * wheel = static_cast<Wheel *>(bodyA->GetUserData());
    wheel->offRoad();
    return;
}

if (typeid(CheckeredFlag).name() == typeid(bodyA).name())
{
    if (typeid(Wheel).name() == typeid(bodyB).name())
        {
        flag->action();
        return;
        }
}

sentences:
Better quality texture when zooming Is there any way to have better quality textures ?

I thought that creating huge textures will improve their quality in game, that's why I draw textures with 0.25f or 0.5f scale.

I understand that computer can't display 4 pixels in 1 screen pixel, but how people do to have beautiful sprites while zooming ? even on smartphones...

Hope you can help me.

sentences:
Clicking on a canvas getting polygon I'm using Canvas to create polygons like this:

http://bl.ocks.org/mbostock/6675193

I want each of those polygons to represent a clickable province. How do I know which province is clicked when the user clicks on something? I have a list of vertices (thousands) but I feel like each time looking for the closest vertex is too slow (I think I might be wrong). What's a fast way to do it? Thanks.

sentences:
3ds max "thread stiching" plugin for cloths or furniture i`m trying to find a plugin or way to add 3D thread stiching to a mesh.

It would be perfect if you could creat thread stiches along edges in "editpoly" mode.
I know that you can somehow do this in Z-Brush with customized alpha brushes but in my opinion its a bit complicated. I could also imagine alining a editable spline along a mesh edge.
Important for me would be that this "unknown tool" would also add the displacement on the canvas and the stiches so i can use "render to texture" to give seems realistic look. Thisway you could always creat perfect stiches with realistic looking displacement like in the picture below without to much affort.

http://www.esunroof.com/contrast_stitch.jpg

http://t1.gstatic.com/images?q=tbn:ANd9GcQplgCvhur-ynthz15Qdaqpv1QRwkG4K6sjhVjDqzzxm6OaY9Bt

would be awesome if you know a way to do this, Thanks a lot lot :)

sentences:
What is a good alternative to Unified Shader for Shadows? Most shadow systems I have seen use a unified shader system for shadowing techniques, resulting in an uber shader for the projects.

What alternatives do you find work well or is the unified shader the best approach?

sentences:
State machine interpreters I wrote my own state machine tool in C and at this point I'm faced with two choices for specifying state machines.

Crafting a little language and writing a interpreter.
Writing a compiler for that language.

I know the advantages/disadvantages of each. I'd like to know what choices game programmers have made for their games. If you've used a state machine in your game in any form, I'd be interested in knowing how you did it.

sentences: Mixing Bump mapping and Detail mapping I wonder if I create bump mapping for my terrain is it good to add detail mapping too? Does such mix improve realism or make it even worse (because there is "too much" of it)? If this improve realism, is it even worth doing that? Maybe it takes a lot of resources for small improvement?

sentences:
What external 2d animation formats can I use in android? For an artist who won't be dealing directly with the code, what formats for 2d animation could they use that would be portable into an android game?

In my particular case there are no collision requirements or anything, just need to be able to place the animation on screen at a specific point.

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:
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:
How does one save a procedural world? I have recently read about how to create procedural worlds... but how do I save one?

In games like Terraria or Minecraft users can freely modify the landscape, but that world can't be recreated from the start seed. What techniques are used to save procedural but modifiable worlds?

sentences:
What AI scheme is appropriate for a 4 player, Tic-Tac-Toe style game? I am about to release an android game that is like tic tac toe, but on a bigger board, and 4 player. Instead of winning when you get 3 in a row, you get points for chains, and the most points at the end wins.

I'm going to have a later release that will include AI, but I'm quite new to this. Would minimax be a good choice, but does it work in 4 player? I'm worried that because there are around 90 possible moves for each turn then this would get slow too slow for large enough searches.

Any suggestions?

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:
What tools/software are used to make the environments/levels/maps in games? This question has probably been answered before but I've not been able to find the answer, since I'm not able to frame the question with brevity.

So the whole question is :- The worlds/levels that you see in games like Crysis, Assassin's Creed, etc, what do the designers and developers use to create them? Do they use the tools present inside the engine (whether proprietary or in-house) or a separate software that exports these worlds as an importable object for the game engine to use to load models into it, etc?

I know this is a very general question but I have been curious regarding this for some time. I have used Unity in the past and it had a terrain toolkit that could be used to make the terrain, and I'm pretty sure it had completely to do with my lack of skill but I wasn't even close to making an environment that looked like the ones you see these days.

sentences:
Texture antialiasing? In my Minecraft-clone style game, blocks are textured with a border that is lighter then the block color. See picture below:

To achieve this effect without the textures being blurry I use this code:

glTexParameterf(GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER, GL_NEAREST);

Without setting the MAG_FILTER to GL_NEAREST, it looks like this:

This is ugly and blurry. The upper picture (with GL_NEAREST enabled) is obviously superior. My issue is that the edges in the upper picture are aliased (it is more obvious if you view the photo full-size.)

Is there any way to anti-alias textures? It does not look very good if the borders are aliased like this. Alternatively, is there any way to get rid of the aliasing on the borders?

Thank you for any help!

sentences:
Normal mapping for Android and iOS I'm making a mobile game for Android and iOS on Unity. At the moment I am researching and designing the technical aspects of the game. Since it is not plausible to use highly detailed models for mobile platforms, should normal mapped models be used instead?

Thus I have couple of questions about normal mapping. Are normal mapped models much more costly to make, in other words, do they take a lot longer to create? And are they much more expensive to render? At least there are no additional draw calls, but of course the shader is more complex.

sentences:
How to automatically scroll vertical text? I've a GUI, and a panel with a Text control.

I simply want to do an automatic vertical scroll effect (circular).

Problems I've to solve:
- How to identify if text on my textbox is "too much" and overflow vertical

How to move Text and not textbox transform Y

Can you help me find the correct solution ?

Thanks

sentences:
How to make prefabs UI work on any canvas scaller? I want to make my UI prefab working on all size of canvas reference resolution scaler because I already make one which is not prefab UI its work to all reference resolution but when I make it prefab and instantiate it it's fit only specific resolution.
like this, I have reference resolution 2560x1440 which normally all UI will be set on that resolution and working fine on 720p or 1080p screen but make it prefab, it's working only on the 2960x1440 screen.

here the script for instantiating that object
public static MM_PilihAyat instance;
    private void Awake()
    {
        instance = this;
    }

    public List<_PlayerInventory> playerInventories;

    public GameObject pilihAyatPrefab;
    public Transform contentHolderPilihAyat;

    public GameObject bacaPanel;
    public Transform bacaContent;

    private void Start()
    {
        for (int i = 0; i < playerInventories.Count; i++)
        {
            GameObject go = Instantiate(pilihAyatPrefab, transform.position, transform.rotation);
            go.transform.SetParent(contentHolderPilihAyat.transform);
            MM_PilihAyatItem.instance.inventory = playerInventories[i];
        }
    }

    public void BackToBaca()
    {
        MM_PilihAyatItem.instance.BackToBaca();
        MM_BacaPanel.instance.inventory = null;
    }
```

sentences: G-rated word lists in various languages for programming children's games I'm programming a word guessing game that uses large lists of words (no definitions, just words). Word length is configurable. Parents could set the word length to be very short and let small children play the game. I'd like to make sure there are no obviously obscene words in the list. For American English, the closest I've found was a Scrabble-like dictionary file that uniformly labelled questionable words with "obscene" so I can easily filter them out. Does anyone know of a better list in English, and/or any lists in other languages?

sentences:
data structure fails to instantiate GMS2 Error message:
Data structure with index does not exist.
 at gml_Object_enemy_actor_Step_0 (line 10) -           hand[i] = ds_stack_push(deck);

Code snippit that is referenced in the error message:

if global.phase == 0
{
    //fill inital hand of cards
    if global.turn == 0 && hand[0] = noone
    {
        for (i=0; i<4; i++)
        {
            hand[i] = ds_stack_push(deck);
        }
    }
}

The code that creates the ds_stack

/// @description hold the enemy player's outfit

scale = 0.25;

image_xscale = scale;
image_yscale = scale;

outfit = ds_stack_create();
hand = array_create(8,noone);
//hand[0] = noone;
draw = false;

//create a deck and fill it
deck = ds_stack_create();
fill_deck(deck);

The fill_deck() function just adds usable numbers to the ds_stack

//argument0 is the deck being passed to fill

var temp = ds_stack_create();

for (i=0; i<20; i++)
{
    var index = round(irandom(46));
    ds_stack_push(temp, index);
}

ds_stack_copy(argument0,temp);

sentences:
Checking if object passed between two other objects I have a three objects (strikers), lets say red, green and blue.

When I apply force to the green object I want to check if it has passed between red and blue or not. See the image below for an illustration.

Is there any line collider or something for that?

sentences:
How do I restart an animation that is already playing using SetTrigger? I have set up a relatively simple example scene with one enemy.

This enemy is controlled with an animation controller.
In this animation controller, I have set up a trigger named "Hit".

The enemy plays an idle animation, and when my hero character shoots him, I set the trigger "Hit" via script like this:

_animator.SetTrigger("Hit");

This causes the animation controller to react to it, and it transitions from "Idle Animation" to "Hit Animation":

The hit animation is 3 seconds long. After it has completed, the animation controller will automatically transition back to the "Idle Animation".

I would like make it so that the hero character can shoot the enemy even though he is already playing the hit animation. Let's imagine you use a machine gun to shoot him repeatedly quickly.

However, when I call

_animator.SetTrigger("Hit");

while the hit animation is already being played, nothing happens.

As I currently understand it, this makes perfect sense as the Trigger triggers the transition from animation A to animation B, and if we're already at animation B, then there can be no transition.

The transition will only kick in if the animation controller is currently playing the "Idle Animation" as it can then transition to the "Hit animation"

What could I do to "restart" the hit animation?

Thank you.

sentences: Setting up 3d Collision for Primitive shapes Im having some trouble understanding how to set up collision detection between my first person camera and my primitive shapes which are made using the vertex buffer. Do i give my camera a boundingBox and all my objects a boundingbox then add them to a list and check the list for collsions or is there a better more understanding way to do this. My game is literally a maze game so all i really need is my camera to accept collisions against the primitive objects. Thanks in advance.

sentences:
Can I use fictional city/country names from public domain/fiction etc. in a potentially monetized browser game? I'm currently developing a browser game with a focus on economy, trading and industry. For that I'm building a fictional world with countries and cities. To avoid political drama within the games player interactions, I'd like to avoid using real countries that currently exist/are recognized. I tried to come up with several fictional country names, but I'm reaching the limitations of my creativity where they are still OK-sounding...
My questions are now...

Can I use fictional countries e.g. from movies/comics etc (e.g. Sokovia from the Marvel universe)? Maybe with slight adjustments?
Can I use older country or empire names (e.g. Babylonia)? Maybe also with slight adjustments.
Can I use city names from the real world? I need a lot of them, so coming up with thousands brings me to my limit and there may probably be overlaps without me knowing. Based on the following question that should be fine, also since they have nothing to do with the real-life equivalents. Do I need licensing to use real city names in my game?
What about using planet or galaxy names which are public domain (or how are they protected, if at all)?

I found some generators in the internet which are helpful to a certain degree, but I'd rather write my own to be honest.
Since the game might be monetized, are there any licensing issues involved? I'm pretty new to this from a legal perspective.

Another thing are the fictional company names the users can choose. I guess I can set certain restrictions there to exclude real world companies and provide a "report" button for real companies to request the removal/change to be on the safe side.

Thanks in advance

PS: Since I also needed flags, I already found a nice generator, in case someone is interested:
https://www.reddit.com/r/vexillology/comments/4ha19q/flagmaker_20/?st=jb6e4qyk&sh=c1544079

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:
What makes a game a game vs something else like a puzzle or a toy? Famously the Sims and similar games have been described by some designers as Toys and not "really" games.

I'm curious if there is a good answer to what makes something a game.

For example many companies sell Sudoku games - EA has an iPhone one, IronSudoku offers a great web based one, and there are countless others on most platforms.

Many newspapers publish Sudoku puzzles in their print editions and often online.

What differentiates a game from a puzzle? (or are all Sudoku "games" misnamed?)

I'm not convinced there is a simple or easy answer - but I'd love to be proven wrong. I've seen some definitions and emphasize "rules" as core to something being a game (vs. "real life") but puzzles have rules as well - as do many other things.

I'm open to answers that either focus only on computer games (on any platform) or which expand to include games and gameplay across many platforms. Here to I'm not fully convinced the lines are clear - is a "game" of D&D played over a virtual tabletop with computer dice rollers, video & audio chat a computer game or something else? (I'd lean towards something else - but where do you draw that line?)

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:
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:
How can I prevent a component from handling collision events? In Unity, I can set the enabled flag of a component to false, and this prevents Unity from running the Update method of the component.
However, Unity still runs other methods of the component, such as OnTriggerEnter2D.
Is there a way to completely disable a component (without removing it), such that it does not get any events at all?

Of course I can manually add a flag to my component, and check this flag from within the event handlers, but I would like to know if there is a built-in solution.

sentences:
Google play services error DEBUG: Application is pausing, which disconnects the RTMP client I am having this issue from past day with Google Play Services & Unity.

What happens is, when I install app directly ot device via Unity, the Google Play Services work fine but when I upload it as beta to play store console and install it via that then it starts to give " DEBUG: Application is pausing, which disconnects the RTMP client" error.

I have a proper SHA1 key.

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 to create public Arrays of game objects so that they can be assigned through inspector I am making a unity2D game. I need to declare public array of gameobjects so that I can assign them colliders, textures through inspector by drag n drop.
Is there any way to do this? I am using c#.

I found but not able to figure this out.Here is one link that is not useful for me please tell why???

sentences:
Change the alpha blending color of scaled textures It looks like semitransparent pixels are blended with while color when textures are drawn scaled. It is very noticeable and looks ugly when textures are drawn on dark background.

public class SomeScreen implements Screen {
    private TextureRegion textureRegion;

    @Override
    public void show() {
        // Loading texture
        Texture texture = new Texture(Gdx.files.internal("texture.png"), true);
        // Setting filter to "linear"
        texture.setFilter(Texture.TextureFilter.Linear, Texture.TextureFilter.Linear);
        // Getting the region
        textureRegion = new TextureRegion(texture, 0, 0, 64, 64);
    }

    @Override
    public void render(float delta) {
        // Clearing screen
        Gdx.gl.glClearColor(0.09f, 0.09f, 0.09f, 1f);
        Gdx.gl.glClear(GL20.GL_COLOR_BUFFER_BIT);

        // Drawing textureRegion
        Game.instance.batch.begin();
        Game.instance.batch.draw(textureRegion, 100f, 100f, 256f, 256f); // Actual texture region size is 64x64px
        Game.instance.batch.end();
    }
}

I need to get rid of that white noise around the shape, bud don't know how.

Source image:

Draw results:

sentences:
Cubic bezier for easing? I would like to find out what Y is if X is a certain number from a cubic bezier curve to make a custom easing function, like it's done on this site: http://cubic-bezier.com/
Does anyone know a formula or a function to find Y if X is something of a cubic-bezier? (Coding in C#/XNA)

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:
Unity using raw mocap data without actually moving the character I play around with animations and unitys raw motion capture data asset pack. My problem is as followed:

I have an idle, walkforward and a runforward animation and play them based on the keyboard input. But i realized when i move my character backwards (using a movement script) but still playing the walkforward animation the character basically moves backward and forward at the same time.

So how can i play the animation but without actually effecting the position of the character?

Thank you

sentences:
How do I add a gameobject to a prefab's script's public gameobject field in Unity? Okay, I have a prefab with a script. It has the public field gameobject, and I see that in the inspector. When I try to drag an object from the scene into that slot, I'm simply unable to. No error or anything, just acts like it's any other part of the screen.

Is there a type mismatch here? How do I drag something from the hierarchy?

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: Camera not following ragdoll in unity I have made a ragdoll and attached (as child object) the main camera to it, but the camera doesn't follow the ragdoll. Why is this happening? And how do I fix this?

sentences: How to create particle system by script I have created a gameObject called "Sphere". After 5 secs the gameobject starts rotating. Along with the rotation I need to emit partical from the object. How can I do this?

sentences:
Change AI steering behavior's direction to 8 directions I am making a 2d soccer game, all players move in 8 directions, so I need to convert AI steering behavior(like arrive and pursuit) into 8 directions.
Here are three example situations:

Player(now is at point A) set target To point B, we could not directly move in direction(B - A), player need to first move to point C in horizontal or vertical, then move in 45 degree to reach target point.
 Consider in my game there is no steering behavior accumulation, which means, at any time , only have one function to affect player movement(arrive or pursuit), so I first make convert code in arrive function, because pursuit actually call arrive either.
Here is pseudo-code:

void RSAIController::Init()
{
   ...
    m_vDirectionArray[0] = CCPoint(1.f, 0.f);
    m_vDirectionArray[1] = CCPoint(0.7071f, 0.7071f);
    m_vDirectionArray[2] = CCPoint(0.f, 1.f);
    m_vDirectionArray[3] = CCPoint(-0.7071f, 0.7071f);
    m_vDirectionArray[4] = CCPoint(-1.f, 0.f);
    m_vDirectionArray[5] = CCPoint(-0.7071f, -0.7071f);
    m_vDirectionArray[6] = CCPoint(0.f, -1.f);
    m_vDirectionArray[7] = CCPoint(0.7071f, -0.7071f);
}
//called in arrive method, then use m_vMoveDirection as speed direction
void RSAIController::ConvertTo8Directional()
{
    int idx = -1;
    float maxValue = -MaxFloat;
    CCPoint direction = m_vTarget - m_pPlayer->Pos();
    //do this because in cocos2d normalize zero vector will return (1, 0)
    //which is not the expected result,so I avoid it manually
    if(!VIsZero(direction))
        direction = direction.normalize();

    for(int i = 0; i < 8; ++i)
    {
        float dotValue = m_vDirectionArray[i].dot(direction);
        if(dotValue > maxValue)
        {
            maxValue = dotValue;
            idx = i;
        }
    }
    m_vMoveDirection = m_vDirectionArray[idx];
}

Then I am thinking 8-directional AI movement is pretty common in old nes game, like "Nintendo World Cup". Does anyone used to meet this problem or have any articles related to this?

UPDATE: I have update the code in @Json advice, but still got the errors I met before.
1.Actually player will change direction in 22.5 degree not 45 degree. I need player move on the diagonals when the degree is just reach 45.
2.When player move on the diagonals, the player will keep shaking. For example, in situation 1, when player start to move from C to B in first frame, player decide to move in perfect 45 degree, but player can not reach precise point C because "distance from A to C" has small error to "player speed(constant) * move time from A to C" , this will cause next frame player probably run in horizontal direction, again and again..
  Do I need to check when the last frame that arrive at C, then just make player at the precise point C manually to avoid this error, or there has any other trick to fix this?

sentences:
Why does Intersector.overlaps return false? I am trying my hand at creating a simple game using libGDX.

The idea is: We have a hero who jumps and world consist of dynamically created moving platforms in an auto side-scrolling manner. In order to progress our hero need to jump on these platforms and avoid falling. I have figured out how to do this using the built-in libGDX collision detection mechanism.

Code is:

    public boolean collides(Hero hero){
    if (position.y < hero.getY() + hero.getHeight()) {
        return Intersector.overlaps(hero.getBoundingRect(),boundingRect);
    }
    return false;
    }

But, our hero need to die when hits side of a platform. Following code should do the trick but even though bounding rectangle of hero surely overlaps(see below image) the bounding rectangle of platform Intersector.overlaps returns false no matter what.

My code for this task:

    public boolean   collidesSide(Hero hero){
    float heroYH = hero.getY() + hero.getHeight();
    float heroXW = hero.getX() + hero.getWidth();
    if (heroYH > position.y && heroXW>position.x){ // Platforms position
        Gdx.app.log("Platform","hero.bound:" + hero.getBoundingRect().toString() + " plat.bound:" +boundingRect.toString());
        Gdx.app.log("Platform","Intersect: " + Intersector.overlaps(hero.getBoundingRect(),boundingRect));
        if (Intersector.overlaps(hero.getBoundingRect(),boundingRect)){
            Gdx.app.log("Platform","CollidesSide: True");
            return true;
        }
        return false;
    }

    return false;
    }

It seems that I have missed some logic or doing something wrong.

How should I handle this issue?

Also this is the output log

Platform: Intersect: false
Platform: hero.bound:20.0,64.65544,25.0,32.0   plat.bound:-3.0893557,96.0,19.0,5.0
Platform: Intersect: false
Platform: hero.bound:20.0,65.13417,25.0,32.0 plat.bound:-4.4350085,96.0,19.0,5.0
Platform: Intersect: false
Platform: hero.bound:20.0,65.74593,25.0,32.0 plat.bound:-5.779882,96.0,19.0,5.0
Platform: Intersect: false
Platform: hero.bound:20.0,66.43762,25.0,32.0 plat.bound:-7.042242,96.0,19.0,5.0
Platform: Intersect: false
Platform: hero.bound:20.0,67.29663,25.0,32.0 plat.bound:-8.372085,96.0,19.0,5.0
Platform: Intersect: false

UPDATE:

The Red and Cyan rectangles seen in images are rendered output of Bounding Rectangle(hit boxes) of each object, not actual sprite.

sentences:
How to fix odd artifacts at the edges of textures in DirectX 11? In my DirectX 11 project, when I have textures they have odd artifacts at the edges. I've seen it before and searched online, but I can't find any DirectX examples that I can get to work.

You can see it on the skybox too. I'm assuming this is caused because the texture is too small and it's being expanded. I'm using the sampler state filter D3D11_FILTER_MIN_MAG_MIP_LINEAR. How can I fix this?

sentences:
Should our group try to make a game? I am a second year, learning C/C++ and Java.

In our first year of university we did basic C++, no classes. This year we have been introduced to classes and inheritance. We have not yet done pointers, virtual functions, abstract classes, operator overloading, exception handling, linked lists, stacks, queues, binary trees, graphs, etc.

I am very curious, so I like to teach myself some things that we haven't yet done. I enjoy the technical side of things a lot, my friends think I am weird to want to learn more than I have to..

But heres my problem:

Our C++ lecturer has decided to take a different approach this term to learning. He said, form a group, think of a project you would like to do and implement it over the year.

Let me give you a break down of our group:

Theres five of us in the group. Myself and another member are much more experienced than the other three and we like the technical side of things, and are quite motivated to do something with an interesting challenge. Then we have a group member who has been extremely hard to motivate, and he was very unsure why he wanted to be a programmer. He did some thinking and decided he wanted to work towards becoming a game programmer. The next member of ours is not the most reliable and has let us down a few times. Finally we have a new member that is keen to learn, but his programming needs work, as do the previous two members.

We are all friends, of course -- which probably isn't the ideal solution to a good group.

The project idea:

Our lecturer gave us an initial idea for a project: a timetable scheduler. Of course this is no trivial task, but most of our members were not really interested in the project at all. So, then I thought -- one member wants to be a game programmer (the hardest member to motivate), most of us would probably enjoy the experience of doing a game, as it would be a big challenge, so why not give it a go?

So what is my question?
Do you think that we should take on the task of making a game, or aim for something else?

Initially we thought of a 2D, top-down, ARPG. Then it became a 3D ARPG.

Obviously 3D would be harder, but as we have time to learn, it wouldn't be such a bad idea would it?

Personally I think that the learning will be the most fun part of this project, even if we don't end up with a great game, we should have learned  a lot (including being forced to learn and implement new C++ topics).

sentences:
Algo for narrowing cavern I'm in a bit of crunch time and I find myself spending way too much time tinkering with an algo, so I would like some help.

In the game I am working on, there are some old-style, pixelated minigames. One of the minigame is a spaceship in a cavern. The caverns curves and narrows down over time until the ship crashes in a wall. I want them to be generated at random during runtime.

I'm having a problem creating the walls of the cavern and narrowing them while keeping a smooth curve on them.

For the narrowing, I keep track of it with a variable that decreases over time, but how about the curving and how to keep it natural? I've though of a keeping a target point that goes up and down randomly and have the wall try to reach for it, therefore smoothing the randomized number but it is not working great.

Any ideas/algo?

sentences:
Are there any advantages of Vulkan using traditional methods? I keep hearing that Vulkan meant for direct low level operations with the GPU and hence it's targeted toward expert and experienced graphics programmers.

What would be some other advantages of Vulkan that are usable for a more traditional graphics programmer, rather than a full blown AAA expert?

One advantage I keep hearing about is multi-threading support. It's buzzing in media to annoying levels, yet still never explained what and how it's different from OpenGL's level of multi-threading.

sentences:
How to move Vector2 along angle? These are my Vector2's that I am using for this function.

public Vector2 position = new Vector2();
public Vector2 velocity = new Vector2();
public Vector2 movement = new Vector2();
public Vector2 direction = new Vector2();

Here is the function that I use to move the position vector along an angle. setLocation() just sets the new location of the image.

public void move(float delta, float degrees) {
    position.set(image.getX() + image.getWidth() / 2, image.getY() + image.getHeight() / 2);
    direction.set((float) Math.cos(degrees), (float) Math.sin(degrees)).nor();
    velocity.set(direction).scl(speed);
    movement.set(velocity).scl(delta);
    position.add(movement);
    setLocation(position.x, position.y); // Sets location of image
}

I get a lot of different angles with this, just not the correct angles. How should I change this function to move a Vector2 along an angle using the Vector2 class from com.badlogic.gdx.math.Vector2 within the LibGDX library?

I found this answer, but not sure how to implement it.

Update: I figured out part of the issue. Should convert degrees to radians. However, the angle of 0 degrees is towards the right. Is there any way to fix this? As I shouldn't have to add 90 to degrees in order to have correct heading. New code is below

public void move(float delta, float degrees) {
    degrees += 90; // Set degrees to correct heading, shouldn't have to do this
    position.set(image.getX() + image.getWidth() / 2, image.getY() + image.getHeight() / 2);
    direction.set(MathUtils.cos(degrees * MathUtils.degreesToRadians), MathUtils.sin(degrees * MathUtils.degreesToRadians)).nor();
    velocity.set(direction).scl(speed);
    movement.set(velocity).scl(delta);
    position.add(movement);
    setLocation(position.x, position.y);
}

sentences: Physics engine for Billiard game I need to write a simple 3D billiard game using OpenGL. Which physics engine is simple and best to use in this case? Or it's better to write physics by myself?

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: Could I make my own pokemon game without running into a copyright issue? I've always wanted to make a video game that criticises pokemon. I want to know if I could use pokemon as the characters in the game without running into copy right laws. The game itself will have nothing to do with the normal purpose of pokemon but at one point also mimics pokemon mystery dungeon a little. that point in the game would be similar to the rescuing of other pokemon and will also have some of the same characters in pokemon mystery dungeon. so, could I possably make this game? or not. If I couldn't, what would it take to have permission. If your wondering how the game criticises pokemon, it does so cause it's supposed to be a gory hard core M game. What if I was to not include any of the titles from pokemon like pikachu for example and just simply give the characters real life names as well as give minor changes in designs and abilities? Could that help avoid copyright problems?

sentences:
Why do loot drops contain (mostly) useless items? I was thinking about this and couldn't figure this out.  In Diablo you kill enemies and they drop random things.  But usually the drops are worthless to you relative to what you already have equipped.  Why bother building a drop system that gives you crappy drops?  Maybe I'm not communicating my question well so I'll provide an alternative implementation:

Instead of frequently dropping crappy items and rarely dropping good items, why not only rarely drop good items?

I guess that crappy items adds to the addictive-ness somehow, but I don't understand why.  Why is dropping crappy items part of the design?  What does that add?

Edit: FWIW, I have been referring to Diablo 2 as my reference, not D3.  But it's still interesting to see answers explaining why D2 was more addictive.

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:
How can I implement a command system for a point-and-click style adventure game? I'm making a point and click adventure game, and I'm currently trying to figure out the best way to implement a command system.

Assume a Monkey Island or Maniac Mansion style interface, with a palette of verbs, and objects in the scene and in the inventory. Clicking on these, you build up a sentence to execute.

for example, you might click look at and then a tree to get "look at tree" or click on an apple, and then give, and then a girl, to get "give apple to girl".

There are three possible forms of a sentence:

verb, for example "save"
verb noun, for example "pick up apple", "look at octopus"
verb noun noun, for example "give pickle to rabid dog", "use crowbar with pickle jar"

In different situations, I'll want the action to be carried out to be defined by different objects.

For example, for the give verb, there might be a default action defined that makes the character say something like "I'd prefer to hang on to that", or the rabid dog might define an action where it eats anything you attempt to give it.

If the interface is to work like Maniac Mansion, then you build the sentence, and then tell it to execute (in Maniac Mansion, by either clicking the sentence, or clicking again on the last thing you clicked on).

If it's to work like Monkey Island, the sentence executes as soon as it's complete, which poses a problem for verbs like use which might sometimes take one noun, and other times two.

So how would you implement a system that handles this?

sentences:
Password-less player identification I'm working on the server side part of my game (develop your village/farm) and trying to build user identification system. I'd like to have a password-less mechanism: user downloads my app from the store, run it and that's all. He doesn't have to type any login or password. The game connects with the server requesting new player creation so he can start playing as soon as he opens the app.

I assume that this process is connected with GameCenter/GooglePlayGames. A game retrieves player ID from those services and then use it for future requests (saving user progress, game specific data - like village/farm facilities' positions, other information on my server). Is it a valid and safe assumption? If not can ask you to describe how it works/should be done?

I have some doubts regarding security? Single PlayerID seems to be quite weak solution, isn't it?

Edit:

I didn't mention it but I would like to move my progress from one device to another also without creation of any account with login and password.

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:
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:
Question about save games format my question is about save-games format.

Look at this screenshot:

On the left I made a "simple" fake savegame (Ini format) and on the right there is a "complex" TR2 save game.

I'm wondering how does the complex one work, and why.

I thought that it was made this way to prevent from cheating-editing values, and the format was just a "simple" save encrypted with a key (like aes does).

I'm sceptic though, I don't think every game has implemented an encryption algorithm to save some data. Maybe I miss something, or maybe it's done this way.

Do you have some informations about this ? Have you ever asked yourselves how does this works ?
Thanks, have a good day !

sentences:
What is next to interpolate camera position with smooth speed changes? I am working on a path camera to be used in demo playback. (3d game) The spline math used is catmull rom. I am on my second attempt to get constant position speed :( (someone else is doing rotation). The path cam keyframes are position@time.

I have a step now when the path is recalculated, it also generates the arc distance/time lookup table which I have normalized. I have the duration of each segment(k through k+1)as well as each segments linear velocity calculated from that data.

I am not very good at reading anything except basic equations. I could use an explanation or psuedo code of what is needed next in order to get the camera to smoothly accelerate or decelerate depending on the velocity of the next segment. Right now it's instant changes and no good. I tried googling for hours and was going in circles.

sentences:
How can I use an unsigned int as a GLSL attribute for OpenGL ES 2 I'm having trouble finding conclusive information on this, but it seems like I can't pass integer attributes to GLSL for OpenGL ES or that if I do they'll be converted to float. I need a value between the range [0-65535] for each vertex. If I pass it as a float and then convert it back, I'm concerned that the value will have changed (if the precision is low enough and can't suitably represent values at the higher magnitudes).

Its also confusing trying to figure out what precision for floats the OpenGL ES 2 standard requires. It seems like the minimum requirement is 16-bit (ie some implementations will use 16-bit floats for highp variables). In this case, it would seem like the floating point number wouldn't be able to store enough information for 0-65535 since that's what a 16-bit unsigned int holds.

So, formally, how can I specify a vertex attribute that will let me precisely represent the values 0-65535 in OpenGL ES 2.

sentences:
TBS Shooter targeting AI I have some experience in developing all sorts of (small) games using Unity3D, I have a few personal game projects and I also work for a small game studio. The only subject in game development that I've avoided at all costs was AI, up until now. My other projects required just basic NPC algorithms, so i can't call that AI.
On to my problem: I have 2 or more player opponents that have to shoot at each other, taking turns (think of a Worms game). They fire using a ballistic arc, adjusting firing power and gun elevation. The problem is making the CPU player to behave like a human player would, without using firing at random. I have, from other games, and algorithm that computes the angle and projectile velocity required to hit dead-on the target, but that would kill the opponent in the first few seconds. So i need a smarter, human like approach: fire a trial shot, smartly adjust to improve aim. Also account for wind direction and speed that affect the projectile.

After some AI research, I was thinking of using genetic algorithms, but i do not need a perfect solution to my problem (to hit the target in the first round) but rather a constant improving one. Also if the algorithm could be tuned for easy/medium/hard difficulty would be great. I do not necessarily need a complete solution, but a direction to dig to.

sentences:
OpenGL ES Faces appear to be transparent when alpha is 1.0? I am working on an object (OBJ File) loader for my app on iOS, currently I have successfully read the vertices and the faces of the object, and I am now just adding colours to the imported models.

I am coming across a major problem now. Out of a cube with six faces, all coloured red apart from two opposite faces which are coloured blue. This cube is set to rotate so I can see all sides, but the colours do not appear correctly as shown in the video below:

http://youtu.be/0L2AIFkd2Qk

The blue faces only shows when the two blue sections overlap, I cannot figure out why - I am used to OpenGL for PC, is there something I am missing which is causing this strange colouring?

The colouring is achieved by sending a large float array of the format RGBA RGBA RGBA etc for each vertex;

// colours is the name of the array of floats
glColorPointer(colorStride, GL_FLOAT, 0, colors);
glEnableClientState(GL_COLOR_ARRAY);
glDrawArrays(renderStyle, 0, vertexCount);

Any help you can offer would be great,

[EDIT]

Even if you don't know the problem, but have seen this before and know what it may be that would help as I have no idea where to even start looking as it is!

Many thanks

sentences:
Child object free movement on Parent object Just to be straightforward, I am completely new to many aspects of coding and am searching for different specs and guidelines to aid me on my journey to crafting a wonderful game in Epic Games' Unreal Engine 4.

Okay, I know upon viewing this, some may have little to no clue what I mean, so I'll put it like this to explain what I mean :

Imagine a third person game with a simple model of a character. Now, say I have an object as a torso of a character in a game. Now Say I have an object as a head of the character. How could I keep the head as a child of the torso, but at the same time, allow it to move with the camera angle.

sentences:
Libgdx Tiled | Using setTile results in a NullPointerException So, I'm attempting to change the texture of a block when the player comes in contact with it by using cell.setTile(tileSet.getTile(926). I've already looked at similar questions and I guess the layer in Tiled is coming up as null, but I have no clue how to fix it.

I'm sorry it's a long post.

Here's the World Creator

public class B2DWorldCreator {

public B2DWorldCreator(PlayScreen screen) {
    World world = screen.getWorld();
    TiledMap map = screen.getMap();

    BodyDef bdef = new BodyDef();
    FixtureDef fdef = new FixtureDef();
    PolygonShape shape = new PolygonShape();
    Body body;

    //create static bodies for every wall in the game
    for (RectangleMapObject object : map.getLayers().get(2).getObjects().getByType(RectangleMapObject.class)){
        new Wall(screen, object);

    }

}
}

Here's the Tile class

public class Tile {
protected World world;
protected TiledMap map;
protected Rectangle bounds;
protected Body body;
protected PlayScreen screen;
protected MapObject object;
protected Fixture fixture;

public Tile(PlayScreen screen, MapObject object) {
    this.screen = screen;
    this.map = screen.getMap();
    this.world = screen.getWorld();
    this.object = object;
    bounds = ((RectangleMapObject) object).getRectangle();

    BodyDef bdef = new BodyDef();
    FixtureDef fdef = new FixtureDef();
    PolygonShape shape = new PolygonShape();

    bdef.type = BodyDef.BodyType.StaticBody;
    bdef.position.set(bounds.getX() + bounds.getWidth() / 2, bounds.getY() + bounds.getHeight() / 2);

    shape.setAsBox(bounds.getWidth() / 2, bounds.getHeight() / 2);
    fdef.shape = shape;

    body = world.createBody(bdef);
    fixture = body.createFixture(fdef);
}

public void setCategoryFilter(short filterBit) {
    Filter filter = new Filter();
    filter.categoryBits = filterBit;
    fixture.setFilterData(filter);

}
}

Here's the wall class where I call the problematic line at 31.

public class Wall extends Tile {
private TiledMapTileSet tileSet;
private TiledMapTileLayer layer;
private TiledMapTileLayer.Cell cell;

public Wall(PlayScreen screen, MapObject object){
    super(screen, object);
    fixture.setUserData(this);
    setCategoryFilter(AdventureCompany.WALL_BIT);
    tileSet = map.getTileSets().getTileSet("PlaceHoldernoTree.tsx");

}

public void onContact(){
    cell = new TiledMapTileLayer.Cell();
    if(object.getProperties().containsKey("Door")){
        layer = (TiledMapTileLayer) map.getLayers().get(1);
        cell = layer.getCell((int) body.getPosition().x / 16, ((int) body.getPosition().y / 16));
        System.out.println(cell.getTile());
        cell.setTile(tileSet.getTile(926));
    }

}
}

My Contact Listener

public class WorldContactListener implements ContactListener {
private AssetManager manager;

public WorldContactListener(AssetManager manager) {
    this.manager = manager;
}

@Override
public void beginContact(Contact contact) {
    //these are what came in contact
    Fixture fixA = contact.getFixtureA();
    Fixture fixB = contact.getFixtureB();

    int cDef = fixA.getFilterData().categoryBits | fixB.getFilterData().categoryBits; // this will be used to activate specific collision results
    Gdx.app.log("Contact", "ya boi");
    switch(cDef) {
        case AdventureCompany.EXPLORER_BIT | AdventureCompany.WALL_BIT:
            if(fixA.getFilterData().categoryBits == AdventureCompany.WALL_BIT)
                ((Wall) fixA.getUserData()).onContact();
            else
                ((Wall) fixB.getUserData()).onContact();

            break;
    }

}

And finally, the Tmx file header

    <?xml version="1.0" encoding="UTF-8"?>
<map version="1.0" tiledversion="1.1.5" orientation="orthogonal" renderorder="right-down" width="64" height="64" tilewidth="16" tileheight="16" infinite="0" nextobjectid="135">
 <tileset firstgid="1" source="test6.tsx"/>
 <tileset firstgid="925" source="PlaceHoldernoTree.tsx"/>
 <layer name="Background" width="64" height="64">
  <data encoding="base64">

sentences:
I get GL_INVALID_VALUE after calling glTexSubImage2D I am trying to figure out why my texture allocation does not work.  Here is the code:

glTexStorage2D(GL_TEXTURE_2D, 2, GL_RGBA8, 2048, 2048);
glTexSubImage2D(GL_TEXTURE_2D, 0, 0, 0, 2048, 2048, GL_RGB,
                GL_UNSIGNED_SHORT_5_6_5_REV, &BitMap[0]);

glTexSubImage2D returns GL_INVALID_VALUE but the maximum texture allowed is 16384x16384 on my card.

The source of the image is 16bit (Red 5, Green 6, Blue 5).

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:
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:
Time based movement Vs Frame rate based movement? I'm new to Game programmming and SDL, and I have been following Lazyfoo's SDL tutorials. My question is related to time based motion and frame rate based motion, basically which is better or appropriate depending on situations?. Could you give me an example where each of these methods are used?.

Another question I have is that, in lazyfoo's two Motion tutorials (FPS based and time based) The time based method showed a much smoother animation while the Frame rate based one was a little hiccupy, meaning you could clearly see the gap between the previous location of the dot and its current position when you compare the two programs.

As beginner which method should I stick to?(all I want is smooth animations).

sentences:
How to handle assets in Unity? Here's what I have in our little Unity game:

If an asset (mostly a prefab or a texture) has to be accessed (e.g. to instantiate a game object), it is often passed as [SerializeField] to the script component. Scripts that are not components get their assets through the constructor so the assets are passed down until the class where they are needed. It's ugly.
If a lot of assets are needed (like textures of an animation), they are moved into a folder called "Resources" and accessed through the Resources class. The documentation explicitly says "don't use it".

What I want:

To access assets through a name or path to create objects at run-time.

What I found:

The AssetDataBase class looked promising until I couldn't locate it and found out it is deprecated (and the documentation does not tell how to replace it).
Nothing on Google but a lot of outdated things
Asset bundles look promising too, but they are quite complicated and there are no really good migration tutorials and I don't know how to use them.

Any suggestions? How do small/mid sized/bigger Unity games handle their resources?

sentences:
Where should the collision response/resolution code go? I've got a collision response/resolution function that does the same for any pair of two entities. It's is in the World class right now.

But right before that function is invoked, I have some entity-specific logic:

A specific pair of entities should never have their collisions resolved (this is literally to keep the player from hitting itself with a carried object)
When two specific entities collide, an event should be triggered

Because of this, I'm starting to wonder if I should move the collision resolution function as a method into Entity, that'd allow me to use polymorphism. However, this sound very messy to me: If both entities involved in a collision can resolve it, how can I figure out which one should do it?

Is there another way to move these special cases out of World?

sentences:
Mesh/Path reduction to simulate traveled path to target I generate that kind of mesh during runtime to display the path to follow to a target (think at something like the path your GPS shows you when you are travelling):

I need to reduce the displayed path going from one end to the other to simulate the travel the player did. What can I do to achieve such effect?

I can think about vertex modifications at runtime directly from a Monobehaviour class, or a shader(?). Are there any other (smarter?) moves to do here? Is Vertex modification the wiser choice for that kind of case?

Thanks.

sentences:
What makes MMOs with real-money economies legal? I beieve most MMOs with an in-game currency tied to a real-world currency (e.g. Guild Wars 2's gems or Eve's PLEX) do not allow in-game items to be traded back into real cash for a bunch of reasons—partly because they may be subject to changes to the game's "normal" economy but generally because this would open up a bunch of legal issues with money laundering, gaming/gambling laws and so on.

However, Entropia Universe (wikipedia link) has an in-game economy which is tied directly to US dollars, allowing players to "cash out" of the game and back into real money. They have even gone so far as to produce bank cards which withdraw from the game and have now formed an actual bank to regulate trades.

Why are there not more games which take this approach of a game economy tied directly to real money?

I understand that the economy needs to be carefully designed and balanced to avoid in-game over-inflation or other exploits leading to in-game currency being "created" from nothing, but the bigger concern seems to me to be the legal issues this would create. Given the amount of random chance involved in the game, is this not effectively gambling? If so, how does Entropia Universe allow worldwide users without kicking up a storm of trouble from different regional authorities and governments? Surely this is exactly the kind of thing which is banned in certain US states or other countries. Is it because the game is based in Sweden and their more permissive laws allow it?

sentences:
Camera field of view for far objects Dears,
I am building a flight simulator game with third person camera. I facing a problem that when I go high with the plane, objects, land and farms didn't look very far.
I tried to change the field of view for the camera, but I face a stretching in the drawn objects.
My questions is:

Am I right to change the FOV for the camera? If yes, how to change the FOV without stretching.
If the previous question is no, How to give the feel for the land, terrains and farms that they look very far when I go up in the sky?

Any idea, tutorial or documentation is highly appreciated.
Thanks.

sentences:
How do I create logic that mirrors the visual state of the game without tying the logic to the animation? I'm implementing a type of action that depends on the completion of an animation; specifically, a character throwing a grenade should, at the end of the animation, spawn a grenade.  This seems to imply that I should be creating code that reacts to the completion of the animation, code that depends on the framerate: when the last frame is displayed, or immediately after, the processes that spawn a grenade should run.

I've been reading around and it seems that the consensus is that tying physics to the animation is bad practice.  I can code some workarounds that decouples the animation from the logic.  I am thinking that I can add an observer to the mix that pings all interested pieces of code that "the animation finished", or the like, so the animation doesn't know anything about the logic, and vice versa.

I can code workarounds, but they're that, workarounds.  They're code that's trying to detach logic from the event that triggers it, but they're inherently bound together; a grenade should spawn after a character throws it.  If animation and logic are to run separately, how should I implement a grenade spawning system that doesn't take the character animation frames into account?

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:
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:
spritekit sidescroller how to move hero through the level I am trying to learn spritekit by working my way through developing a simple side scrolling game, but I cannot find a clear answer on how to move the hero through the level.

The width of my ground far exceeds the width of the view and I have always thought it was best to move the ground not the hero, but my enemies (who pace back and forth) tend to move much more quickly as the hero moves and to the wrong spot. I am guessing this is because the ground is moving and changing their destination during the move action.

Is moving the ground (not the hero) the best way to create a sidescroller without a repeating landscape. If so, how do I create enemies that move in a restricted area like mario?

Here is a portion of my code:

let enemy = SKSpriteNode(imageNamed: "enemyWalk1.png")

override func didMoveToView(view: SKView) {

    enemy.physicsBody = SKPhysicsBody(texture: SKTexture(imageNamed: "enemyWalk1.png"), size: enemy.size)
    enemy.physicsBody = SKPhysicsBody(rectangleOfSize: enemy.size)
    enemy.physicsBody!.affectedByGravity = true
    enemy.physicsBody!.allowsRotation = false
    enemy.physicsBody!.dynamic = true

    enemy.position = CGPoint(x:CGRectGetMinX(self.frame) + enemy.size.width + 800, y:CGRectGetMinY(self.frame) + ground!.frame.size.height + enemy.size.height)
    self.addChild(enemy)

    var enemyGoTo1 = enemy.position.x + 100
    var enemyGoTo2 = enemy.position.x - 100

    var enemyXScale1 = SKAction.scaleXBy(1, y: 1, duration: 0.0)
    var enemyXScale2 = SKAction.scaleXBy(-1, y: 1, duration: 0.0)

 enemy.runAction(SKAction.repeatActionForever(SKAction.animateWithTextures(enemyTextureArray, timePerFrame: 0.15)), withKey: "enemyWalk")
    enemy.runAction(SKAction.repeatActionForever(SKAction.sequence([enemyXScale1, SKAction.moveToX(enemy.position.x + 100,duration: 1.5), enemyXScale2, SKAction.moveToX(enemy.position.x - 100,duration: 1.5), enemyXScale1, enemyXScale2])))

}

override func touchesBegan(touches: Set<NSObject>, withEvent event: UIEvent) {
    for touch in (touches as! Set<UITouch>) {
        let location = touch.locationInNode(self)

        if nodeAtPoint(location) == rightArrow {
                rightTouched = true

            }
        }
}

override func update(currentTime: CFTimeInterval) {
        if rightTouched == true {
            childNodeWithName("ground")!.position.x = childNodeWithName("ground")!.position.x - 8
        }
}

sentences:
How to publish a mod on Steam for a game without Steam Workshop? I'd like to publish a mod for a game that doesn't have Workshop or any community modding options.
I could go to Steamworks and publish it as a standalone game... but I don't see any option to "require" the user to have access to the base game to install it -- which is a requirement for the mod to work.(So it will appear on Steam with its own "store" page but doesn't allow to be downloaded unless the account holder also owns the base game)
I've spent days Googling this, but the only documentation I can find is how to add mods to Steam using Source, which I am not using. The mod is free if that matters at all.
Would like to use Steam because it's much easier to push updates to the mod than using NexusMods or ModDB. Thanks!

sentences:
Can Cloud Functions be used for a multiplayer game server? I'm building a turn-based online multiplayer game with Unity for both desktop and mobile.

Traditionally, I would build a Java socket server, host it in Google Compute Engine or similar, and have players connect to it. Since this works with sockets I can easily notify players of relevant events, such as matchmaking, chat, enemy turn, etc.

I've been curious about Serverless Functions for a while, such as Google Cloud or Amazon Lambda.

However, at first glance it doesn't seem to me like that would work for my game: because there ins't a constant connection (with sockets), I can't notify players of relevant events in realtime - or can I?

For mobile I realize I could probably use something akin to push notifications (so the serverless code may push messages to the relevant player's phone). But that doesn't seem as simple for desktop games.

Well, what if the players poll for messages? Like every second, call a Cloud function and ask them if there's anything for them.

I'd image that would work, but that seems rather overkill - with as little as a couple thousand players, calling the same function every second for prolonged times (the game's matches are long) sounds like it would easily increase expenses.

Is there something I am missing? A coding practice that would make serverless code feasible for a cross-platform online multiplayer game? I want to make it work, but it would seem like a socket server is still my only option.

sentences:
2D Grid-based Pathfinding with Elevation I'm creating an isometric game which currently uses A* Pathfinding on a basic grid representation of the map.
Having elevations and allowing the Players to traverse up-and-down is an integral part of the game - however I'm stuck on exactly how to implement that, whether it be with A* or something else.
For example,
---------------------------------
| 0 | 0 | 0 | X | 0 | 4 | 4 | 4 |
---------------------------------
| 0 | 0 | 0 | 0 | 0 | 4 | 4 | 4 |
---------------------------------
| 0 | 0 | 1 | 2 | 3 | 4 | 4 | 4 |
---------------------------------

Assuming X is the Player, the numbers are tile elevations, and that the Player can only traverse tiles +/- 1 elevation to the tile they're currently on, is there an accepted/known way of doing this pathfinding?

sentences:
When input listener set in resize(), input doubles I created a button and assigned an input listener in the resize() method of the screen.

For simplicity's sake, whenever I press the button, 1000 adds to a total amount. The weird part is, it adds 2000 when I press the button. Then I moved the button's input listener addition to the constructor - now it works perfectly adding 1000.

For some odd reason, if I set the input handler in the resize method it somehow does everything it is supposed to twice. The game works when I transfer that piece of code to the constructor, but why on earth did it do the assigned thing twice?

This is the code I use for attaching the input listener:

button.addListener(new InputListener() {
        public boolean touchDown (InputEvent event, float x, float y, int   pointer, int button) {
                return true;
        }

        public void touchUp (InputEvent event, float x, float y, int pointer, int button) {
                count += increment;
                countLabel.setText(String.valueOf(count));
        }
    });

sentences: "Acrobatic" and "fluid" combat system (i.e. Spider-Man 2018) Like it says in the title, I like the way that Spider-Man Has a dynamic and fluid feeling combat system. I can't exactly put my finger on a few key aspects, though, and I don't have any way I can think of to recreate it in a game engine. Why does it feel good to play, and how could I apply that to my game?

sentences: Manual per-glyph rendering with SDL_TTF I'm trying to create a font atlas with SDL_TTF. My idea was to create an SDL_Surface for every character using TTF_RenderGlyph_Blended() and use TTF_GlyphMetrics() to get glyph metrics so that I can position the surface relative to a baseline. I'm struggling with a correct positioning of a glyph. It looks like SDL_TTF creates a surface with height which is at least the height of the font and width which is at least advance of a glyph, so the surface is bigger than just the glyph. How do I extract glyph's rectangle from the created surface? How do I position the glyph correctly relative to the base line on the screen? I thought y position of the glyph it should be baselineY - maxy (where maxy is from TTF_GlyphMetrics), but that places glyph too high above the base line.

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:
Resources of realistic water simulation? I want to study water simulation, with a  a demo with source code which using physically-based methods(Eulerian approaches or Lagrangian approaches).

How can I get some examples?

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:
Making a wrapping wire (like the Worms Ninja Rope) work correctly with moving geometry I have implemented a 2D wire like the one described in this question which is made up of straight line segments between wrapping points. However, while the algorithms described in this answer work just fine for colliding with static geometry, it does not behave correctly when interacting with moving geometry. The method described in this answer does work correctly in some cases, but not when the rope does not move, since the collision detection method does not account for the movement of points.

How would you make the wire behave correctly when interacting with moving geometry?

sentences:
How to Get VR Controller's Velocity in Unity with SteamVR? Back when I used Unity 2017 and controller bindings weren't a thing, I simply attached a rigidbody to my Vive controller and read out the velocity of the rigidbody to know how fast the player was swinging the controller. Now, I've updated to Unity 2021.2.0a14, I went through all the effort of modifying my code to work with bindings, and it doesn't seem like I can get velocity anymore. The rigidbody always reports zero velocity. I can see the World Center of Mass vector changing so I know it registers motion, but it's just not reporting the velocity anymore. Is there a new setting in Unity I need to turn on to measure things that it doesn't personally control? Or do the new bindings options have a way to get velocity as an input? Am I forced to calculate it myself now? Thanks!
Edit: Base assumption was wrong, I did not get velocity from the rigidbody attached to the hand controller like I thought I did. I got it directly from SteamVR_Controller. So Unity is probably acting like it ever did.

sentences:
Is non-indexed, non-instanced rendering useful anymore? I'm adding batched rendering to my game engine and I'm wondering: Should I support non-indexed, non-instanced batches or just indexed and/or instanced?

It's my understanding that the concept of indexed rendering was invented after pure "vertex only" drawing. That said, is supporting vertex-only rendering useful anymore? Is there a modern use-case for it?

sentences:
How to unify vertices in 3ds max? I want two vertices of editable spline become one. Neither fuse, nor weld helps: vertices remain separate.

Here is a video: http://youtu.be/bp3OJPeKapc

sentences:
Where to hire a scenario writer for a small interactive story game? I need a scenario for a small dialog-based game / interactive story. The game would be used as an example to be shipped with a middleware tool we're developing.

I would like to buy an existing story (it should be dynamic of course — with branching dialogs etc.), or hire someone to write a new one.

Please advise, where to go to find such person / service? We're based in Russia, so getting a talented enough native English writer locally is a bit of a problem.

Update: To be extra clear: We must get all necessary rights to reuse the story and make a derived work (i.e. the game we're talking about) from it. This is a commercial product. Borrowing someone else's work at random and using it just not going to work.

WARNING: Please do not post "I can do it" answers here. This is not a job board! You will get downvoted and your answer will be deleted. If you really want to contact me, look into my profile.

sentences: The best option to multi-platform 2d mobile development we are in the process of porting a game from iphone(made with cocos2s) to android(using the andEngine), and it has been a pain to do. So for our next project (a 2d game) we are thinking about using some multiplatform engine/framework. For now we are thinking about testing both unity, marmaled(former airplay sdk) and cocos2d-x. Do you have any opinion about this? Does someon have experience developing 2d games using Unity?

sentences:
XNA Required information to represent 2D Sprite graphically I was thinking about dividing my game engine into 2 threads: render thread and update thread (I can't come up on how to divide update thread from physic thread at the moment).

That said, I have to duplicate all Sprite informations, what do I really need to represents a 2D Sprite graphically?

Here are my ideas (I'll mark with ? things that I'm not sure):

Vector2 Position
float Rotation ?
Vector2 Pivot ?
Rectangle TextureRectangle
Texture2D Texture
Vector2 ImageOrigin ? (is it tracked somewhere else?)

If you have any suggestion about using different types for datas, it's appreciated

Last part of the question: isn't this a lot of data to copy in a buffer?what should I really copy in the buffer?I'm following this tutorial:

http://www.sgtconker.com/2009/11/article-multi-threading-your-xna/3/

Thanks

UPDATE 1:

Newer values at the moment:

Vector2 Position
float Rotation
Vector2 Pivot
Rectangle TextureRectangle
Texture2D Texture
Color Color
byte Facing (can be left or right, I'll do it with an enum)

I re-read the tutorial, what I was doing wrong is not that I need to pass all those values, I need to pass only changed values as messages.

UPDATE 2:

Vector2 Position
float Rotation
Vector2 Pivot
Rectangle TextureRectangle
Texture2D Texture
Color Color
bool Flip
uint DrawOrder
Vector2 Scale
bool Visible ?

Mhhh, should Visibile be included?

sentences:
Creating Rope Physics for Unity I want to create a bungee jumping-like game in Unity and therefore I need a rope physics. I especially need elastic ropes with capability to pull objects with velocity after a little extension. Do you know any place to start? Because I have no idea how to start such scripting.

I looked at Asset Store. There are some rope physic simulators, but I have to do it on my own, plus they are really expensive.

EDIT: I already tried using Spring and/or Configurable Joints in Unity, but they did not give what I want.

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:
How to deal with variable size font in XNA 4.0 After searching for a while, I found no way to draw vector/scalable fonts in XNA 4.0 (which would be perfect...) and I am currently in a bind about how to render fonts for my game.
In the game I use fonts of variable size, ranging from very small to quite large, and I have no idea how to efficiently deal with this.

The only way I can currently accomplish what I want is to load a large number of SpriteFonts different sizes, manually pick the font closest to the size I want, and then fine-tune the size with a scale close to 1. (A scale too large or too small will make the font look horrible.)
I've also started using the Nuclex font processor which makes the fonts looks somewhat better, but it's obviously not the answer to my problem.

Is there really no other way to deal with this?
It seems very strange to me that something as elaborate and well done as XNA 4.0 has such a profound lack of tools to deal with font rendering.

This is quite a big problem for me currently, so any help and ideas on possible ways to deal with this or even to ease the pain are very welcome.

sentences: If fixed timesteps are unreliable across web platforms, what can I use in my game loop? As I have found out in my previous question, window.setInterval is not the best choice for a cross-platform game loop. What is my alternative for a game loop in Javascript that will (attempt to) run at the same speed on all devices?

sentences:
How to handle focus on a custom actor in Unreal Engine? I created a custom actor, placed it on my scene and selected it.

When I press "F" to focus on it, the camera zoom back very far from the scene, probably because I didn't implement the method supposed to return the bounding box of my actor.

How can I do that?

Update

I implemented a custom component which delegates all drawing functions to an internal ULineBatchComponent member. I unregistered this ULineBatchComponent member. The custom component is not even attached to the actor root component.

But its bounding box is still taken into account when focusing on the actor.

UPBLineBatchComponent.h

UCLASS()
class UPBLineBatchComponent : public UObject
{
    GENERATED_UCLASS_BODY()
public:
    virtual FBoxSphereBounds CalcBounds(const FTransform& LocalToWorld) const;
    void SetTransform(const FTransform &Transform);
    virtual void DrawLine(...);
    virtual void DrawPoint(...);
    void Flush();
    ULineBatchComponent* LineBatchComponent;
    FBox LocalBounds;
};

UPBLineBatchComponent.cpp

UPBLineBatchComponent::UPBLineBatchComponent( const FObjectInitializer& ObjectInitializer )
        : Super( ObjectInitializer )
{
    LineBatchComponent = CreateDefaultSubobject<ULineBatchComponent>(TEXT("LineBatcher"));
    LineBatchComponent->UnregisterComponent();
    LocalBounds = FBox(0);
    LineBatchComponent->Bounds = FBoxSphereBounds(EForceInit::ForceInitToZero);
}

FBoxSphereBounds UPBLineBatchComponent::CalcBounds(const FTransform& LocalToWorld) const
{
    LineBatchComponent->Bounds = FBoxSphereBounds(LocalBounds.TransformBy(LocalToWorld));
    return FBoxSphereBounds(LocalBounds.TransformBy(LocalToWorld));
}

void UPBLineBatchComponent::SetTransform(const FTransform& Transform)
{
    LocalBounds = LocalBounds.TransformBy(Transform);
    LineBatchComponent->Bounds = FBoxSphereBounds(LocalBounds);

    bool bDirty = false;
    for (FBatchedLine& Line : LineBatchComponent->BatchedLines)
    {
        Line.Start = Transform.TransformPosition(Line.Start);
        Line.End = Transform.TransformPosition(Line.End);
        bDirty = true;
    }

    for (FBatchedPoint& Point : LineBatchComponent->BatchedPoints)
    {
        Point.Position = Transform.TransformPosition(Point.Position);
        bDirty = true;
    }

    for (FBatchedMesh& Mesh : LineBatchComponent->BatchedMeshes)
    {
        for (FVector& Vert : Mesh.MeshVerts)
        {
            Vert = Transform.TransformPosition(Vert);
            bDirty = true;
        }
    }

    if (bDirty)
    {
        LineBatchComponent->MarkRenderStateDirty();
    }
}

void UPBLineBatchComponent::DrawLine(const FVector &Start, const FVector &End, const FLinearColor &Color, uint8 DepthPriority, float Thickness, float LifeTime)
{
    LineBatchComponent->DrawLine(Start, End, Color, DepthPriority, Thickness, LifeTime);
    LocalBounds += Start;
    LocalBounds += End;
    LineBatchComponent->Bounds = FBoxSphereBounds(LocalBounds);
}

void UPBLineBatchComponent::DrawPoint(const FVector &Position, const FLinearColor &Color, float PointSize, uint8 DepthPriority, float LifeTime)
{
    LineBatchComponent->DrawPoint(Position, Color, PointSize, DepthPriority, LifeTime);
    LocalBounds += Position;
    LineBatchComponent->Bounds = FBoxSphereBounds(LocalBounds);
}

void UPBLineBatchComponent::Flush()
{
    LineBatchComponent->Flush();
    LocalBounds = FBox(0);
    LineBatchComponent->Bounds = FBoxSphereBounds(EForceInit::ForceInitToZero);
}

Update 2

If I use

LineBatchComponent = NewObject<ULineBatchComponent>();

instead of

LineBatchComponent = CreateDefaultSubobject<ULineBatchComponent>(TEXT("LineBatcher"));

I can focus properly on the actor, but I can't see the lines anymore.

sentences:
How to desing an RPG system with regard to PVP When you design a RPG system focused on PVE, one usually goes "mob of level X has Y hp and Z damage". How about when we do PVP with multiple classes?

Lets say we go Diablo, so we have STR/DEX/INT/VIT, how do you balance those between classes? Do I say:

I want a fight to last 10 rounds on average (lets assume its turn based)
barb starts with 300 hp, demon hunter 250 hp, wizard 200 hp

And now try to manipulate DPS / health using stats/skills so it matches the "10 round on average" by giving mage a mana shield an a lil bit more damage per fireball than barbarians melee attack? How would You approach this?

sentences:
Why does my AI Enemy slide towards its target when it is supposed to be idle? So using Unity standard assets to get a stage rolling, Ive built a simple terrain and used FPSController as the player and AI ThirdPersonController (Ethan) as the enamy.

Ive built the navmesh and everything was working in its default state, but then I changed the AI script slightly as I wanted Ethan to follow me only if I come within a certain range, so I changed it to the following:

public float dangerRadius = 5f;

        private void Start()
        {
            // get the components on the object we need ( should not be null due to require component so no need to check )
            agent = GetComponentInChildren<UnityEngine.AI.NavMeshAgent>();
            character = GetComponent<ThirdPersonCharacter>();

            agent.updateRotation = false;
            agent.updatePosition = true;
        }

        private void Update()
        {
            if (target != null)
                agent.SetDestination(target.position);

            if (agent.remainingDistance < dangerRadius)
                character.Move(agent.desiredVelocity, false, false);

            else
                character.Move(Vector3.zero, false, false);
        }

        public void SetTarget(Transform target)
        {
            this.target = target;
        }

But the problem is that when the remainingDistance is greater than dangerRadius or when I am out of range, Ethan just slides slowly towards the target in idle state and as the distance becomes lower than the threshold he starts running as expected.

Ive tried adding friction materials to the terrain and the collider on Ethan but he still slides.

Help thanks

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:
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:
How do dialog trees work? That is, what is connected to what and how to move between lines of speech when a sub-conversation ends?

If you have any examples of a basic dialog tree in C#, please post them.

sentences:
How to get independent from GLEW dll file I'm literally an absolute noob in GL. I just wrote my first GLEW piece of code yesterday:

#include <stdio.h>
#include <stdlib.h>
#include <GL/glew.h>
#include <GL/glfw.h>

int main(void)
{
    glfwInit();
    glfwOpenWindowHint(GLFW_FSAA_SAMPLES, 4);
    glfwOpenWindowHint(GLFW_OPENGL_VERSION_MAJOR, 3);
    glfwOpenWindowHint(GLFW_OPENGL_VERSION_MINOR, 3);
    glfwOpenWindowHint(GLFW_OPENGL_PROFILE, GLFW_OPENGL_CORE_PROFILE);
    glfwOpenWindow(640, 480, 8, 8, 8, 0, 24, 0, GLFW_WINDOW);

    glewInit();

    glfwSetWindowTitle("OpenGL Rules!");
    glfwEnable( GLFW_STICKY_KEYS );

    do{
    glfwSwapBuffers();
    }while( glfwGetKey( GLFW_KEY_ESC ) != GLFW_PRESS && glfwGetWindowParam( GLFW_OPENED ) );
}

This compiles just fine with (using mingw on win8 x64):

gcc opengl.c -lglfw -lglew32 -lopengl32

However, in order to run the output, I have to copy the glew32.dll to the same directory from which I'm running the program. Is there a way to get independent from the dll? Like, compiling once and using without having to carry the dll around?

sentences: Where can I find some good 3D character artists? I am searching for 3D artists for a 3D iPad game. Is there a good place in the net, where I could find one? He or she should have created game models before.

sentences:
What is the difference between Serializable, and System.Serializable? What is the difference between Serializable, and System.Serializable?
I'm guessing SerializeField is only for attributes of a class. What is the difference between the above two, then?

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:
How can I create a .ico file with all the various resolution sizes within one container? I was looking at this GOG.ico in ffmeg, and was surprised to see all the streams for it...indicating it was holding multiple images in the .ico container or .ico has some kind of self-creation function where it generates the resolutions from a singular image based on condition? Or Maybe I'm overthinking it and its just a container with 7 different image variants stored inside?
Regardless I was curious on what the method of creation was for this many .ico in one hybrid, and how to replicate it. I'm already familiar with how to create a singular .ico image using gimp and/or ffmpeg....gimp is probably using ffmpeg itself. If its 7 images, those can be mapped to various streams of the .ico container using a tool like ffmpeg.
What's a more automated workflow people use to create these kinds of elaborate .iso though?

sentences:
Entity-Component-System design I read a lot about ECS (strategy) pattern and have a few questions. Consider simple space game.

We have stars there. Obviously star is an entity. What if I want to make a galaxy? It looks reasonable to make galaxy an entity. On the other hand galaxy is just a set of stars. In usual OOP design I would just made it a class which holds a list/vector of stars. Is it legial to make an entity which is just a container for other entities? Wouldn't it brake at some point?
Now consider planetary system. It looks like planet is an entity too. But it would be wise to link a planet to its parent star. May one entity refer to another (having pointer, or something like that)? How would you compose that?

Thanks in advance.

sentences:
GLSL Shaders-> How to manage? As your game get's bigger and bigger, you will use more and more different shader effects.
Let's take an easy example:

I have clouds in my voxel-based world, and I want to give it a blue-ish tint with a shader. Do I create a new shader, disable the default shader, enable the cloud-shader, draw the cloud, disable the cloud shader and enable the default one again?

If your game starts to get huge, how on earth can you use 300 shader effects enabled for 1 voxel and disabled for the other?

I know the question may sound strange, but it really makes me think.

I now have a Vertex- and Fragmentshader, for the matrix calculations, and basic lighting. If I want to add a shading-effect for for example water blocks, what to do?

I hope someone can help me with this mystery.

sentences:
Image-Button coordinates are busted I have an image-button and I set its position in create in this way:

imageButton.setPosition(orthographicCamera.position.x+150,150);

The problem is that the position always changes, despite I set it in create.
Also if I change device, I notice that the coordinates are busted, wrong, instead other views are right.

If I write setPositionin render, the image-button is faster than the camera, it gets away from the screen, but for other views, this doesn't happen because they follow the camera. Why?

sentences:
What is the difference between cudaExternalMemoryHandleTypeD3D12Resource and cudaExternalMemoryHandleTypeD3D12Heap? When we import a D3D12 memory object into cuda we do something like this:

cudaExternalMemoryHandleDesc cuExtmemHandleDesc{};
cuExtmemHandleDesc.type = cudaExternalMemoryHandleTypeD3D12Resource; //here
//...
CheckCudaErrors(cudaImportExternalMemory(&m_externalMemory, &cuExtmemHandleDesc));

What is the difference between cudaExternalMemoryHandleTypeD3D12Resource and cudaExternalMemoryHandleTypeD3D12Heap? When should I use one or the other when importing memory object?

sentences:
Are there game engines like Unity but for 2D? I really like the convenience of unity3d.  The ability to edit the level and see my results in real time are great.  My problem is the idea I want to implement is 2d and uses 2d sprites.  Scaling sprites appears to be a problem for me and all advice I receive says to purchase 150 dollars addons for unity. I love the physics components and the rapid prototyping but I figured that maybe unity is not the tool for the job for this 2d game.

Is there any 2d game engine like unity but for 2d games that would work on the PC and Android?  Or is this something most people code themselves and make?  To me the most important features of Unity3d were its ease to see what was edited and then have it apply instantly.

Thank you. Most searches seemed to give me frameworks and not a large engine suite.

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: 2D Magnet-like repelling behavior If somebody wanted to develop a system between two intersecting rectangles so that the rectangles would, in a gradual process, push eachother away from one another until no longer intersecting, with the repelling force being stronger depending upon how deep the intersection is... what would the math look like?

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:
Is it possible to reverse perspective projection with simple scale and translate? Basically I'm asking this question (which seems to have gone un-answered): How to do perspective projection “parallax” but without changing the scale or offset of objects?

I'm using perspective projection and would like to scale up certain objects in the background (z < 0) such that they would render unscaled and in the same relative position. In other words, I want to reverse the perspective foreshortening for bg objects.

I've figured out how to unscale accurately: basically I project the top left and bottom right corners of the image to z = 0, then do the same at the current z value. I then compare the change in distance between the points in order to derive the scale factor.

The problem I have though is once I unscale the object, its position is incorrect. I've tried scaling around different anchor points, with no luck. I can't seem to derive a generic formula to position the images in the correct places after scaling.

Any ideas how to do this? Is this even mathematically possible?

sentences:
How can I generate a view or projection matrix for OpenGL 3.+ I'm transitioning from OpenGL 2 to OpenGL 3.+ and to GLSL 1.5. I'm trying to avoid using the deprecated features.

My question how do we now generate the view or projection matrix. I was using the matrix stack to calculate the projection matrix for me;

GLfloat ptr[16];
gluPerspective(...);
glGetFloatv(GL_MODELVIEW_MATRIX, ptr);
//then pass ptr via a uniform to the shader

But obviously the matrix stack is deprecated. So this approach is not the best an option going forward.

I have the 'Red Book', 7th ed, which covers 3.0 & 3.1 and it still uses the deprecated matrix functions in it's examples.

I could write some utility-code myself to generate the matrices. But I don't want to re-invent this particular wheel, especially when this functionality is required for every 3D graphics program.

What is the accepted way to generate world,view & projection matrices for OpenGL? Is there an emerging 'standard' library for this? Or is there some other hidden (to me) functionality in OpenGL/GLSL which I have overlooked?

sentences:
Play a sound on button click before loading the load scene in Unity3D I am trying to play the sound of the button click before loading the scene in unity. However, the sound is never played. Below is my code, help would be appreciated.

public void RestartGame()
{
    audioManager.PlaySound(forwardSound);
    StartCoroutine(DelaySceneLoad("Gameplay"));
}

IEnumerator DelaySceneLoad(string scene)
{
    yield return new WaitForSeconds(forwardSound.length);
    GameTracker.SetGameOver(false);
    SceneManager.LoadScene(scene);
}

sentences:
What is the best way to store Vertex Buffer Object data? Until now, I have been using a vertexData structure to store data for a Vertex Buffer Object (VBO); vertexData holds a static array of 6 vertices (2 triangles). I then save them to a vector of the vertexData type, before finally using this vertexData in the buffering method:

struct vertexData {

    Vertex vertices[6]; // position, color, UVs
};

std::vector<vertexData> _DATA;

void SpriteBatch::createVBO() {

    glBindBuffer(GL_ARRAY_BUFFER,_VBO);

    glBufferData(GL_ARRAY_BUFFER,_DATA.size()*sizeof(vertexData),nullptr,GL_DYNAMIC_DRAW);
    glBufferSubData(GL_ARRAY_BUFFER,0,_DATA.size()*sizeof(vertexData),_DATA.data());

    glBindBuffer(GL_ARRAY_BUFFER,0);
}

This works good, as everything in my vector is contiguous. However, I want to work with other vertex sizes, for different shapes. I tried a vector of vector types, in oder to  work with dynamically allocated arrays, but it did not work, as it was not contiguous.

At first, I thought about using a polymorphic class to be stored as a vector, where every child would have a different array size; but then I recognized that this vertex buffer does not work with pointers

The second idea was to create a generic SpriteBatch. For example, a batch for 6 vertices, and then a batch for 2 vertices, etc. etc.

What is the best way to store Vertex Buffer Object data?

sentences:
Basic equation for pure metallic reflectance I'm working on a live wallpaper that shows a pure metallic object. Since it's a live wallpaper, I can make a ton of approximations...this isn't a full blown scene in a game world. My shader only has to support this one material. People won't expect extreme detail, etc. So, for example, I don't even bother with diffuse since a pure conductive material barely has any.

So I'm trying to implement a reflective conductive surface that pulls the reflection from a cubemap representing the lighting environment. On a very basic level it looks like this:

vec3 fresnelSchlick (vec3 f0, float cosTheta)
{
    return mix(f0, vec3(1.0), pow(1.0 - cosTheta, 5.0));
}

//...
float NdV = dot(normal, viewDir);
vec2 brdf = texture2D(u_brdf, vec2(u_roughness, NdV)).rg; // from a LUT

vec3 reflection = textureCube(u_cubemap, reflect(viewDir, normal));
gl_FragColor = reflection * (fresnelSchlick(materialColor, NdV) * brdf.x + brdf.y);

The problem with my simple math here is that the range of possible final pixel colors does not produce a proper-looking range of hues. Suppose my material color is #0050ff and the environment is monochrome white. Then all of the possible colors that could be seen are:

This doesn't allow for bright looking reflections at the light sources in the envmap. I found this example material render for comparison. The cubemap in the example here is close to monochrome white. But at the bright areas of the reflection, there is a lot of red component in the color.

With my limited range of colors, my object looks dull and lifeless. Can anyone point out what I'm missing in my equation?

sentences:
How to load models with possibility to change textures in Three.js I'm working on a game in Three.js where I have a few variations of the same model in blender.

What I want to achieve is that I'll load the model once with all the material settings, but then I'll just change the texture dynamically. Is there a way to do that? and in what format should I export it from blender in order to do this effeciently (json, obj)?

Thank you so much in advance.

sentences:
How do I correctly shift arrays on a Tetris line clear? I'm writing a Tetris clone in C++ and I am at the last stage, I need to delete a row when it is full. Once a piece falls it is stored in a boolean array grid[20][10]. For example I check which row is full (or true), if so I call a method deleteRow, where n is a number of row:

void Grid::deleteRow(int n)
{
  for (j = 0; j < WIDTH; j++)
   {
     grid[n][j] = false;
   }
}

Once the row is deleted I call moveRowDown:

void Grid::moveRowDown()
{
  for (i = 0; i < HEIGHT; i++)
   {
    for (j = 0; j < WIDTH; j++)
     {
       grid[i+1][j]=grid[i][j];
     }
  }
}

This does not work, and all of the pieces disappear. What logic am I missing?

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: How can I read the color of a specific pixel in XNA? I want a way to find out if, for example, the pixel at Vector2(2, 5) on the game window is color Color.Red, or some other color or set of coordinates. How can I do this?

sentences:
How do I pause a single bone with spine? I'm using spine along with SFML. I have a character that is always animated. When he shots, I set  an animation that affects only his arm. The arm goes up, but I need to stop this animation in the last frame while he keeps shooting.

I use this to make him walk

AnimationState_setAnimationByName(drawable->state, 0, "walk", true);

And this to make him shot

AnimationState_setAnimationByName(drawable->state, 1, "rshot", false);

I can't find a way in Spine c runtime to make this.

I could resolve this if I find a way to update manually tracks 0 and 1, instead of the full animation.

sentences:
How to draw a sprite at a floating point xy coordinate with interlaced drawing? I have a 2D game made in MonoGame (XNA 4.0 framework). Here's what I want to do:

draw a 2d image at a floating point xy coordinate such as 125.5, 300.12 (and do NOT round them to an int).
the image is automatically "interlaced", which means the picture is shaded correctly around the borders so that it looks like it's actually a fraction of the way across pixels, and not aligned exactly on pixels.

How do I do this? Is there a standard library for this?

P.S. the game I'm working on eventually needs to work on Mac and Linux as well, so please don't give me any dead-end solutions.

sentences:
How do I make three attack systems so that there is a rock-paper-scissors distribution, but equal average? In the game, there are three attack systems: Strength-based, Magic-based, and Psionic-based.

The damage each type deals will be multiplied by their own modifier. The one for strength I have come up with is ((3 d6 rolls)*10+Luck)/100.

How can I make similar calculations (willing to not use the one I came up with, but would like to do something similar) so that the Strength one beats the Magic one more often than not, the Magic one beats the Psionic one more often than not, and the Psionic one beats the strength one more often than not, by roughly the same amount on average.

I know that this sort of thing is possible.

If you take four spinners with six numbers, (5,4,3,5,4,3) loses 2 out of 3 to (6,6,0,0,6,6), which loses two out of three to (7,1,7,1,7,1), which loses 2 out of 3 to (2,2,8,8,2,2), which loses 2 out of 3 to (5,4,3,5,4,3).

sentences:
How can I refer to Android assets in other directories? My project was initially not meant for Android, and its assets are organised along the following directory structure (I hope the ASCII art renders reasonably well):

/
+- engine/
 |    +- src/
 |     |      enginefile1.cpp
 |     |      ...
 |     `- textures/
 |            texture1.tex
 |            ...
+- game/
 |    +- src/
 |     |      gamefile1.cpp
 |     |      ...
 |    +- textures/
 |     |      gametexture1.tex
 |     |      ...
 |    +- ios/
 |     |      [various iOS-specific files]
 |     `- android/
 |           | build.xml
 |           | AndroidManifest.xml
 |           +- jni/
 |           |     Android.mk
 |           +- assets/
 |             [other Android-specific files]
 `- othergame/

My game/android/jni directory is almost empty because Android.mk points to the relative paths of the source files in engine/src and game/src. Actually, it even includes the proper Makefiles so that I never have to modify Android.mk when I add or remove a source file to the project.

Both engine and game provide assets that need to be shipped with the Android build. I would like build.xml to refer to these assets without having to manually copy them. A rule that copies the assets at build time then deletes them would be acceptable, but of course I would prefer a zero copy solution. Does this make sense? How did others solve this cross-platform build problem?

sentences: Failed to initialise the LWJGL display I added the fix of adding this line "Dorg.lwjgl.opengl.Display.allowSoftwareOpenGL=true" to vm arguments, updated my drivers but nothing is working......my error message still remain same has shown in the image

sentences: Essential knowledge for making HTML/JavaScript-based games I was wondering if any experts out there could share the knowledge and resources of what is necessary to start making games with the latest HTML standards and JavaScript (or what some like to call HTML 5). Are there JavaScript libraries that are essential to the process? Aside from the <canvas> tag, what other pieces of HTML do we need to be aware of?

sentences: Distance to a sphere, in Screen Space Is it possible to find the distance of a pixel to a rendered sphere, in screen space? All my naive solutions for just using the 2D screen distances are failing because of the warping that occurs during projection.

sentences:
Field of view determination with partially opaque cells I'm currently implementing the field of view of a player in a 2D-grid based game. I've chosen a standard ray tracing algorithm because he really fits the features needed in my game.
However, the cells aren't just opaques or transparents. They can be "partially opaques", which means that they decrease the length of the line of the sight more than the others (we don't see as far in water than in the air!). Concretely, the player has a given "vision potential", and each cell has a "vision cost". For each cell crosses by the ray during the ray tracing, I decrease the vision. When it hits zero, I stop the ray.
Things are OK here. But this algorithm leads to some artefacts, as described in the last part of this document:

Ok, we have thrown rays all aroung our @, flagging each cell as visible. When we move aroung the dungeon, we notice some artifacts appearing on some walls, especially when the @ is near the wall.
Since we stop the ray as soon as it reaches a wall, when the ray is almost parallel to the wall, there may be some missing wall cells in the resulting potential visible set. [...] The issue is due to the fact that the ray should keep going until it reaches the other side of the wall and not stop on the first cell. But this is not possible since we have only a boolean 'lightThrough' information  and not the wall orientation.
Fortunately, there is a trivial trick which will allow us to remove those artifacts without adding more information on the cell. It is based on a simple observation : if the player sees a ground cell, he sees the wall behind it. [...]
Thus, our post-processing algorithm consist of :

loop through all cells of the visible map.

if the current cell is a hidden wall and is directly behind a visible ground cell (depending on the region the current cell is in), we can flag it as visible.

The result : on the left, the PVS [potential visible set] without the post-processing step. The yellow arrows show the missing cells. On the right, the PVS with the post-processing step.

The document suggests a post-process treatment, but it obviously doesn't work in my situation. What can I do instead?

sentences:
Corona SDK, display.contentWidth and height does not get the expected values I'm drawing a simple rectangle to fill the entire screen.
local bg=display.newRect(0,0,display.contentWidth,display.contentHeight)

Instead of drawing a full screen rectangle, all i get is this:

How do i rectify this?

sentences: When to use LOD and when not to? I have a simple question: are there any cases where game LOD models don't need to be created? Obviously you need LODs for landscapes, large props, characters, vehicles etc. But what about small indoor props which are unlikely to be seen from large distances? I understand that it depends on genre and other factors like the distance to the camera, but still, is there any common standard regarding when LODs need to be made?

sentences:
Is there a turn-based strategy game that allows building AI from scratch? I'm very interested in programming Artificial Intelligence for a turn-based game as a project. However, I'm looking for a (somewhat modern) game and can't really find one i'm interested in.

Particularly, i'm looking at the Civilization francise. I'd love to be able to program the AI of Civilization V for instance. However, as of now, you can only slightly modify the settings of the AI: http://forums.civfanatics.com/threads/artificial-unintelligence.536193/.

Is there any game, which has been released at least in the  last 10 years, that allows programming of the AI to (nearly) ground level?

sentences:
pixi.js - PIXI undefined I am using pixi.js to learn about HTML5 game development. When using this line of code

var bunny = new PIXI

I get an undefined error saying that PIXI isn't defined.

Here is my HTML

<!doctype html>
<head>
    <title>PixiJS</title>
    <meta charset="UTF-8">
</head>

<body>

<script src="https://cdnjs.cloudflare.com/ajax/libs/pixi.js/4.2.2/pixi.min.js"></script>
<script src="index.js"></script>
</body>

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:
Top Down 2D Collision C# I know this has been asked before, but I don't understand why my code isn't working.

I'm doing top-down collision with no gravity.

Here is my code :

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

public class TankBodyControls : MonoBehaviour {

public KeyCode Foward = KeyCode.W;
public KeyCode Backward = KeyCode.S;
public KeyCode TurnLeft = KeyCode.A;
public KeyCode TurnRight = KeyCode.D;

public const float MaxSpeed = 6.0f;
public const float RotSpeed = 4.0f;

private Rigidbody2D TankBody;

void Start () {
    TankBody = GetComponent<Rigidbody2D>();
}

void OnCollisionEnter2D(Collision2D coll)
{
    print("called");
    if(coll.collider.CompareTag("wall"))
    {
        print("collided!");
        var P = transform.position;
        P.x -= TankBody.velocity.x;
        P.y -= TankBody.velocity.y;

        transform.Translate(P);
    }
}

private void MoveTank()
{
    var Vel = TankBody.velocity;

    if(Input.GetKey(Foward)||Input.GetKey(Backward))
    {
        float VelMag = (Input.GetKey(Foward) ? MaxSpeed : -1.0f * MaxSpeed/2.0f);
        float VelAngle = transform.eulerAngles.z * ((float)Math.PI / 180f);
        Vel = new Vector2((float)Math.Cos(VelAngle), (float)Math.Sin(VelAngle));
        Vel *= VelMag;

        var rot = TankBody.rotation;

        if (Input.GetKey(TurnRight))
        {
            rot -= RotSpeed;
        }

        if(Input.GetKey(TurnLeft))
        {
            rot += RotSpeed;
        }

        TankBody.rotation = rot;
    }
    else
    {
        Vel = Vector2.zero;
    }

    TankBody.velocity = Vel;
}

void Update ()
{
    MoveTank();
}
}

The idea was : if I detect a collision, shift the player out of the wall, the distance (velocity) they intersected it. My problem right now is, the OnCollisionEnter2D function doesn't even get called when they intersect (hence not console prints). Any idea what I'm doing incorrectly?

sentences:
Why occlusion culling isn't working? I've bought a 3d model from a 3d marketplace.

It is a big interior scene.

I've imported the single FBX into Unity, added some collider, changed materials (6-7 materials) etc. There are hundreds of child object/mesh:

Despite what my camera is looking, i noticed Unity is rendering 3-400K tris.

Why Occlusion Culling isn't working ? Maybe importing a single huge Fbx isn't the right practice ?

Thanks

This image is my player looking at a black wall... 360K tris rendered !!!!

sentences: How can I create a mesh with Blender which changes mid game? Take a situation where on the first half the player fights an enemy and after a cutscene, the player cuts off the hand of the enemy. How can I show him without his hand after this moment (when modeling it with the hands in Blender in a single skeletal mesh)? Do I have to make another skeletal mesh but without the hand? Similar to how in Assassin's Creed Origins where at the end of the snake quest after the cutscene Bayek losses his ring finger and remains without it all game. But in my case, the entire hand is removed.

sentences:
How should I collect user behavior data in an MMO? In an MMO, and I'm trying to collect data about user behaviors for the purpose of tweaking the game rules to achieve maximum user satisfaction.

Clearly one way to do it is to hand-roll specific things into an application, much like one might use Console.WriteLine() to view the contents of a variable, or the StopWatch() class to see how long something takes to execute.  But you can use a profiler in lieu of StopWatch, and you can use a debugger in lieu of WriteLine.

How should I collect my data? Are there generalized techniques for instrumenting an application to observe user behavior, or some form of code instrumentation technique?

Also, I'm only interested in collection techniques; you can assume that I already know how to transmit, store and analyze said data.

sentences:
What is wrong with my Dot Product? I am trying to make a pong game but I wanted to use dot products to do the collisions with the paddles, however whenever I make a dot product objects it never changes much from .9 this is my code to make vectors

vector = {
    make:function(object){
        return [object.x + object.width/2,object.y + object.height/2]
    },
    normalize:function(v){
        var length = Math.sqrt(v[0] * v[0] + v[1] * v[1])
        v[0] = v[0]/length
        v[1] = v[1]/length
        return v
    },
    dot:function(v1,v2){
        return v1[0] * v2[0] + v1[1] * v2[1]
    }
}

and this is where I am calculating the dot in my code

vector1 = vector.normalize(vector.make(ball))
vector2 = vector.normalize(vector.make(object))
dot = vector.dot(vector1,vector2)

Here is a JsFiddle of my code currently the paddles don't move.

Any help would be greatly appreciated

sentences: How do "game maker" tools like Blitz3D create .exe files? There are several applications like Blitz3D or other kinds of game construction tools that compile scripts or other game data to a single executable file. How do they do that?

sentences:
Java looking in wrong directory for XML I found this suggestion on a Stack Exchange site to print out what the current directory is:

File file = new File(".");
for(String fileNames : file.list())
    System.out.println(fileNames);

Basically, when I run a game in Eclipse, I get this:

But when I compile the game and run it, it prints out this (it prints out the stuff that is in the same directory as the JAR file is). Images, and sound are working fine. It's just the XML file that is causing this.

How do I make Java read XML files from res folder like it does for images and sound in Eclipse?

My particular code that loads the XML is at http://pastebin.com/59Nt7Dtd.

Slick2D documentation is at http://www.slick2d.org/javadoc/.

sentences:
How can I store a set of concrete components and implement "GetComponent()?" I would like an abstract class, AbstractComponentAggregate, which has many AbstractComponents.  Users of my framework will create their components by extending AbstractComponent and appending the component to this AbstractComponentAggregate.

I would like to know if there is an elegant way to have AbstractComponentAggregate to store a dictionary of the concrete classes that extend AbstractComponents.  Note, that I want to store many concrete classes, each of which is an AbstractComponent.  This is different than storing a list of AbstractComponents.

Thus, you can invoke a method on AbstractComponentAggregate, such as:

AbstractComponentAggregate.GetComponent(), which returns type T.  T is the concrete class, and we ensure T is of type AbstractComponent.

Something similar to this is done in Unity3d, and I would like to emulate this.

sentences:
A Sensor’s ContactList Keeps Old / Ignores New Contacts, When That Contact Is still Okay this is a hard one to explain so I’ll try my best.

Basically every time my enemy class updates, it runs a SightCone Sensor Contact List test, so this is every single frame it checks for all the possible contacts in it’s sensor.

What I’m finding is that if I’m moving my player character around, the contact list updates perfectly, when the player is in the enemy’s sight, it’s true, when it is out of sight its false,

However if I keep my player still, The contact list always ignores it.

Here is a video showing the behaviour. (the true and false flag is in the top left.)

Here is the code I have. Basically in the Enemy’s update method I run the check (the sightcone is a supplemental body within the enemy class that follows the position and rotation of the enemy body every frame.)

List<Body> coneClip = GetBodiesInContactWithBody(SightCone.Body);

private List<Body> GetBodiesInContactWithBody(Body body)
        {
            var bodiesInContact = new List<Body>();
            var c = body.ContactList;
            while (c != null && c.Next != null)
            {
                if (c.Contact.IsTouching)
                {
                    bodiesInContact.Add(c.Other);
                }
                c = c.Next;
            }
            return bodiesInContact;
        }

I am not sure why this is happening. I don’t know why the contact list isn’t seeing the player, even though the body is still, it still exists, has a shape and position, and 100% exists in the physics world.

Truly hope you can help.

sentences:
Need help transforming DirectX 9 skybox hlsl shader to DirectX 11 I am in the middle of implementing a skybox to my game. I have been following this tutorial http://rbwhitaker.wikidot.com/skyboxes-2. I am using MonoGame as a framework and in order to support both Windows and Windows 8 metro I need to compile the shader with pixel and vertex shader 4.

compile vs_4_0_level_9_1
compile ps_4_0_level_9_1

However some of the hlsl syntax has been updated with DX10 and DX11.

I need to update this hlsl code:

float4x4 World;
float4x4 View;
float4x4 Projection;

float3 CameraPosition;

Texture SkyBoxTexture;
samplerCUBE SkyBoxSampler = sampler_state
{
   texture = <SkyBoxTexture>;
   magfilter = LINEAR;
   minfilter = LINEAR;
   mipfilter = LINEAR;
   AddressU = Mirror;
   AddressV = Mirror;
};

struct VertexShaderInput
{
    float4 Position : POSITION0;
};

struct VertexShaderOutput
{
    float4 Position : POSITION0;
    float3 TextureCoordinate : TEXCOORD0;
};

VertexShaderOutput VertexShaderFunction(VertexShaderInput input)
{
    VertexShaderOutput output;

    float4 worldPosition = mul(input.Position, World);
    float4 viewPosition = mul(worldPosition, View);
    output.Position = mul(viewPosition, Projection);

    float4 VertexPosition = mul(input.Position, World);
    output.TextureCoordinate = VertexPosition - CameraPosition;

    return output;
}

float4 PixelShaderFunction(VertexShaderOutput input) : COLOR0
{
    return texCUBE(SkyBoxSampler, normalize(input.TextureCoordinate));
}

technique Skybox
{
    pass Pass1
    {
        VertexShader = compile vs_2_0 VertexShaderFunction();
        PixelShader = compile ps_2_0 PixelShaderFunction();
    }
}

I quess I need to change Texture into TextureCube, change sampler, swap texCUBE() with TextureCube.Sample() and change PixelShader return semantic to SV_Target0.

I'm very new in shader languages and any help is appreciated!

sentences:
C++ OpenGL loading models fast I'm looking for a faster solution that will allow me to load objects faster with
OpenGL and currently when trying to load, parse and pass the data on my main thread it takes a while... Would multi-threading be a reasonable solution to this and if so, how would I go about it?

Would I make a second thread with the same context and save the data once it has loaded or...

Would I create a second thread to load and parse the data, then pass it back to the first thread to save to the GPU?

This is the limit of my knowledge of this subject at the minute, if anyone has any better solutions please drop me a comment.

sentences:
Relative Position/Rotation calculation I have 2 objects each with a 3x3 Matrix (Orientation) and a Vector3 (Translation). Both are relative to world coordinates.

How do I calculate the position and orientation of object B in relation to object A?

I'm using the JVector, JMatrix that are a part of the Jitter3D physics library. (http://code.google.com/p/jitterphysics/)

Any help would be greatly appreciated!

sentences:
How to develop VR PC games without a Head-Mounted Display of my own? I am an intermediate student of Unity 3D, and I am not able to purchase heavy and expensive equipment like Oculus Rift, HTC Vive, or other models that are not available in Pakistan.

So I'm wondering how I can develop VR games without these peripherals.

sentences:
How can I add intermittent voice chat to a Unity multiplayer game? I'm looking to make a multiplayer horror game with one of the main mechanics being the game's internal voice chat.

Currently I plan on making it cut in and out so that the players (being on opposite ends of the map from each other) will lose verbal contact with each other.

I planned on using Unity. Do you know how I could go about making this work?

sentences:
C++ unmanaged inside winform First: I am using C# and C++ on windows 7.

I have created a basic rendering engine in c++ with directx 10. It works good as a stand alone application. But, when I sending the Form.Handle of a WinForm I want to render inside to the engine it crashes during D3D10CreateDeviceAndSwapChain with the following error:

HRESULT: 0x887a0001 (2289696769)
Name: DXGI_ERROR_INVALID_CALL

I get the handle from the winform during loading of the form.

unsafe {
  void *ptr=m_view.Handle.ToPointer();
  uint v = (uint)ptr;
  lhandle = v.ToString();
};

sentences:
TexturePacker ignores extensions I'm using TexturePacker in one of my games, though when packing a bunch of textures their extension is kept in the data file. So when I want to find a texture I need to search for "image.png" instead of just "image". Is there an option to let texture packer ignore the extensions of my source images in the data file?

Solved:

So if anyone else wants this, here's the exported I made: https://www.box.com/s/bf12q1i1yc9jr2c5yehd Just extract it into "C:\Program Files (x86)\CodeAndWeb\TexturePacker\bin\exporters\UIToolkit No Extensions" (or something similar) and it should show op as an exporter.

sentences:
What is better? Lots of small TCP packets, or one long one? I am sending quite a bit of data to and from a server, for a game I'm making.

I currently send location data like this:

sendToClient((("UID:" + cl.uid +";x:" + cl.x)));
sendToClient((("UID:" + cl.uid +";y:" + cl.y)));
sendToClient((("UID:" + cl.uid +";z:" + cl.z)));

Obviously it is sending the respective X, Y, and Z values.

Would it be more efficient to send data like this?

sendToClient((("UID:" + cl.uid +"|" + cl.x + "|" + cl.y + "|" + cl.z)));

sentences: When does "frustum culling" actually happen? So I am a little bit confused, and hopefully not too far off, about when frustum culling actually occurs. Let's suppose that I already have my objects in camera space, and then I have applied the perspective matrix onto it which puts everything into a cube AKA the canonical volume. From there, do I immediately do the "culling" and then simply drop the "z" axis of each point to draw it on 2D image plane? How exactly do I do the culling in the canonical cube volume?

sentences:
Perspective Matrix doesn't work OpenGL 4 I tried to implement my own perspective matrix and it doesn't work. I don't understand why. With just with my view matrix (without Perspective Matrix) I can see my mesh.

Here my view matrix :

Vec3f position(0.0,0.0,-5.0);
Vec3f target(0.0,0.0,0.0);

Mat4f Camera::LookAt(Vec3f target, Vec3f position)
{
 //ce dont j'ai besoin pour calculer les parametre de ma camera...
 Vec3f up_world = Vec3f(0.0,1.0,0.0);
 Vec3f forward = (position - target).normalize();
 Vec3f right = up_world.cross(forward).normalize();
 Vec3f up = forward.cross(right).normalize();

 Mat3f R;
 R.setCol(2,forward);
 R.setCol(0,right);
 R.setCol(1,up);

 R.transpose();

 Mat4f R4(R);

 Vec3f mp = position * -1.0f;
 Mat4f P4;
 P4.setCol(3,mp);

 _LookAt = R4 *P4;
 return  _LookAt;
}

And my Perspective Matrix :

Mat4f Camera::perspective(float fovy, float aspect, float zNear, float zFar)
{

  float theta = fovy * 0.5f * (180.f / M_PI);
  float range = zFar - zNear;
  float invtan = 1.f/tanf(theta);

  Mat4f projMat(invtan / aspect,  0.0f,    0.0f,                       0.0f,
                           0.0f,  invtan,  0.0f,                       0.0f,
                           0.0f,  0.0f,    -(zFar + zNear) / range,  -2 * zNear * zFar / range,
                           0.0f,  0.0f,    -1.0f,                      0.0f);

    _perspectiveCam = projMat;
    std::cout << _perspectiveCam << std::endl;
    return _perspectiveCam;
}

  Mat4f perspective(float fovy = M_PI/2, float aspect = (1280.f/720.f)*1.f, float zNear = 0.1f, float zFar = 100.f);

My shader is very simple so it can't be the problem..

#version 410 core

layout(location = 0) in vec3 V_position;
layout(location = 1) in vec3 V_color;
layout(location = 2) in vec3 V_normal;

uniform mat4 view_matrix;
uniform mat4 proj_matrix;

out vec3 color;
void main()
{
    color = V_color;
    gl_Position = proj_matrix * view_matrix * vec4(V_position, 1.);
}

when I initialise _perspectiveCam with the unit matrix 4x4 it displays my triangle..
but when I implement _perspectiveCam like in the function it does not display my triangle

Here my Set col function :

template <typename TYPE>
void Mat4<TYPE>::setCol(int i, Vec4<TYPE>& vec4)
{
  for (size_t k = 0; k < 4; k++)
  {
    setElement(k,i, vec4.getElement(k));
  }

}

void setElement(int i,int j, TYPE var){element[i*4 + j] = var;}
TYPE getElement(int i, int j) const {return element[i*4 + j];}

sentences:
How Do I Do Alpha Transparency Properly In XNA 4.0? Okay, I've read several articles, tutorials, and questions regarding this.  Most point to the same technique which doesn't solve my problem.  I need the ability to create semi-transparent sprites (texture2D's really) and have them overlay another sprite.

I can achieve that somewhat with the code samples I've found but I'm not satisfied with the results and I know there is a way to do this.  In mobile programming (BREW) we did it old school and actually checked each pixel for transparency before rendering.

In this case it seems to render the sprite below it blended with the alpha above it.  This may be an artifact of how I'm rendering the texture but, as I said before, all examples point to this one technique.  Before I go any further I'll go ahead and paste my example code.

    public void Draw(SpriteBatch batch, Camera camera, float alpha)
    {
        int tileMapWidth = Width;
        int tileMapHeight = Height;

        batch.Begin(SpriteSortMode.Texture,
            BlendState.AlphaBlend,
            SamplerState.PointWrap,
            DepthStencilState.Default,
            RasterizerState.CullNone,
            null, camera.TransformMatrix);

        for (int x = 0; x < tileMapWidth; x++)
        {
            for (int y = 0; y < tileMapHeight; y++)
            {
                int tileIndex = _map[y, x];

                if (tileIndex != -1)
                {
                    Texture2D texture = _tileTextures[tileIndex];

                    batch.Draw(
                        texture,
                        new Rectangle(
                            (x * Engine.TileWidth),
                            (y * Engine.TileHeight),
                            Engine.TileWidth,
                            Engine.TileHeight),
                        new Color(new Vector4(1f, 1f, 1f, alpha )));
                }
            }
        }

        batch.End();

    }

As you can see, in this code I'm using the overloaded SpriteBatch.Begin method which takes, among other things, a blend state.  I'm almost positive that's my problem.  I don't want to BLEND the sprites, I want them to be transparent when alpha is 0.  In this example I can set alpha to 0 but it still renders both tiles, with the lower z ordered sprite showing through, discolored because of the blending.  This is not a desired effect, I want the higher z-ordered sprite to fade out and not effect the color beneath it in such a manner.

I might be way off here as I'm fairly new to XNA development so feel free to steer me in the correct direction in the event I'm going down the wrong rabbit hole.

TIA

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:
Spell design and comunication with Player Im trying to design Spell class that can modify almost anything, Player, Units, other spells, etc. I figured out two ways of doing it, but none of this seems proper for me. Thats mainly because of Player class that got a lot of parameters and setting spell is a bit troublesome.

First is:

Spell interface that Im adding to each class of spell, which have method: execute.

Pros:

dont have to pass a lot of parameters, just call proper function of target class of a spell
To use spell just pick spell Player.GetSpell("Fireball").Execute(targets)
Big flexibility

Cons:

A LOT OF CLASSES, like 30 or more. One for each spell type
Each spell need to be wrote manually

Creating spell

class Fireball : SpellBase, ISpell
{
    public void Execute(Player caster, List<Object> target)
    {
        caster.Mana -= ManaCost;

        foreach (var o in target)
        {
            if (o.GetType() == typeof(Player))
            {
                var p = (Player)o;
                p.Health -= 10;
                Console.WriteLine("Player: {0} recieved 10 dmg, now has {1}",
                    p.Name, p.Health);
            }
            else if (o.GetType() == typeof(Spell))
            {
                var s = (Spell)o;
                s.Cooldown += 1;
                Console.WriteLine("Unit: {0} recieved 10 dmg, now has {1}",
                    s.Name, s.Health);
            }
        }
    }
}

Construction

spells.Add(new Fireball());

Executing

spells.First().Execute(caster, enemy);

Second approach:

Write one or few classes that can have different functionality depending on parameters set in constructor.

Pros:

few classes
loading parameters from file or data base

Cons:

setting a lot of parameters for different classes(spells and player really dont have much common fields)
One gigantic method, to handle spell execution

Creating spell

class Spell:SpellBase
    {
        public SpellData Data { get; set; }

        public Spell(SpellData param)
        {
            Data = param;
        }
    }

Construction

 spells.Add(new Frostball(params));
                {
                    HealthMod = -10
                });

Executing

public void CastSpell(Player caster, List<Object> enemy)
        {
            Caster.Mana -= ManaCost;

            foreach (var o in enemy)
            {
                if (o.GetType() == typeof(Player))
                {
                    var p = (Player)o;
                    p.Health += spell.Data.HealthMod;
                    //p.Defence += spell.Data.DefenceMod;
                    //and a lot of atributes and dependencies
                    //.
                    //.
                    //..........
                }
                else if (o.GetType() == typeof(Spell))
                {
                    var s = (Unit)o;
                    s.Cooldown += spell.Data.CooldownMod;
                    //s.Defence += spell.Data.DefenceMod;
                    //and a lot of atributes
                    //.
                    //.
                    //..........
                }
            }
        }

So... I need flexibility a lot. Im not saying its not possible to make it with second way but it will make one big Method with a lot of ifs, which I want to avoid, and i know that with time complexity of this will overwhelm me. Also setting parameters of all spells easily from DB would be nice.

Which one approach do you suggest? Maybe change sth or even you have ideas for whole different way of doing this? Please help me :)

Designin's hard...
Sorry for english.

sentences:
Reading and writing an anti-aliased texture in Direct3D9 I'm slightly confused about textures versus surfaces in Direct3D9. Now, it seems fairly simple that you can only read from a texture and only write to a surface, and when you create a texture then you can get surfaces to set as render targets from it.

What I don't quite get is the CreateTexture function. It's CreateRenderTarget equivalent for a surface which is only rendered to and never read has the options of anti-aliasing parameters, whereas CreateTexture doesn't, even though you can explicitly use it to create render targets.

Does that mean that it is impossible to create an intermediate texture for e.g. shadow mapping which has anti-aliasing?

sentences:
What is the difference between sprites and tiles? I'm making a game, where it came to adding a tile class, but i already have a sprite one, which does the same at first glance.
Can you explain the difference with a couple of examples?

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:
How do I do 3d collisions in isometric game? I've wondered how to get basic collision detection working in an isometric game. I'm using panda3d which has very comfortable support for bullet, ode and a small builtin physics framework. The problem is that these naturally don't work with flat images. I'm using dynamically generated quads as canvases in the 3d coordinate system. Every image or texture is mapped on one of these. The idea is to create tiles with images and place them in 3 dimensions to let panda3d do the rendering.

In order to place a tree on the screen I would generate one of the dynamic flat quads and map a texture with an image of the tree on it. Then I would move the quad to the desired position and everything's fine. Panda3d manages the correct rendering order.

Up to now the player object simply walks through the environment. I need to implement basic collision detection in order to solidify the trees. Browsing through previous questions I've found this one How do I handle Isometric collision detection? Unfortunately the question only targeted collisions to prevent the player from falling through the ground and allowing him to jump on platforms. This can be done comfortably with panda3d's builtin physics.

Here's a picture to show you what I want:

The ground itself is composed of a 10x10 grid of tiles. I've used the same texture for all of them. The tree is not a sprite that's rendered in 2d. It's actually a flat rectangle with a partially transparent tree texture. The white rectangle is my player object. With the standard 3d physics I could prevent the player from walking through the quad but the tree would still be perfectly flat. I thought about adding a "dummy mesh" to have 3d collisions but that would surely come pricey in terms of performance and would spoil the neat implementation of my 3d canvases.

Is there a canonical way to get 3d collisions in an isometric game ?

How would you do this ? Please answer this second question on behalf of panda3d.

I know that this is probably rather complicated. A link to a good article would be perfect. If you want to have a look at my code, you might want to read this question: How do I use setFilmSize in panda3d to achieve the correct view?

UPDATE:

Here's another picture that might depict the problem better

sentences: How to add slowmotion effect in libgdx> I want to add slow motion effect with a collision as a trigger. So I want to have an effective way to trigger a slowmotion effect on bodies as well as sprites that can be caled in the update method. Can anyone please help me with this or provide a link as to where I can find the answer?

sentences:
Shifting from XNA/C# to C++? For a while now, I've been working with XNA for game design and development (although only for personal use ATM.) Overall, I'm a major fan of XNA itself, and it's overall "feel." However, due to the fact that:

XNA seems to have a lack of support (no Metro support, no updates since 2010, etc.)
I plan to try and get a job in the game development industry, and due to C++'s dominance, being more familiar with it would be very useful
XNA only supports Windows (non-Metro) and Xbox 360, while I am interested in Mac and (to a lesser extent) Linux support.

I've been trying to shift over to C++ as my main language. However, I do not want to focus on learning raw DirectX/C++ at this time, so I've been looking for a higher level C++ API (something about the same level as XNA, although something a bit more low-level would be fine) with a feel similar  to XNA. So, for someone switching from C#/XNA to C++, what would my best choice(s) be for API's similar to XNA, although unmanaged and running on C++?

sentences:
How can I check If sublicensing a game to someone is not subject to cheating? Basically I have a game, but here In Italy I need to subscribe to Commercial Chamber just to start selling (3000€/year). So my idea was to let a friend sell the game on the AppStore/PlayStore/Windows store using his accounts. He will instead pay me after keeping a royalty on the revenue. Or at least this seems to become the contract (if you are actually italian and can give me hints on this topic it would greatly appreciated)

Is there any tool available to various stores so I can check the income of my apps even if sold by third parties (the idea is to be sure he takes only the royalty we previously agreed on). In example: enable my account to become developer account so I can test In-App purchases with my account, and then sell the apps with the account of my friend.

One idea was to use analytics tools, but that's unviable:

If the app get cracked analytics tools will not show correct results (and hackers can easily remove analytics too so).
If my friend has to access source code/ Unity project file he could remove any tracking code (he need to have that access, because he have to setup license Keys on each build anyway).

Thanks.

sentences: Clickable Text Render Actor So I couldn't find anything online for this, but I want to make my text render actor clickable for my main menu. For example, when "New Game" is clicked it starts a new game. If you have any answers, please leave them for me! Tysm! :>

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: Make a callback to android methods from libgdx How can I make a callback from libgdx to an Android method? I want to use the method to overwrite a file in the internal memory.

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:
How can I destroy particles on collision with specific a GameObject? I wrote a script to manage my Particle System emission. The starting lifespan is set to infinite so that the particle never dies until it reaches a specific collider. I didn't find any method to destroy a specific particle in the Unity Manual.
How can I do this?
Here's the code (updated to show the partial fix)
using UnityEngine;
using System.Collections.Generic;

public class PlayerDamage : MonoBehaviour
{
    private ParticleSystem ps;
    public List<ParticleCollisionEvent> collisionEvents;
    public int attackValue = 1;

    //
    [Range(0.0f, 100f)]
    public int maxParticles;
    public float particleLife;
    public bool neverDies;
    public float particleSpeed = 8.0F;

    void Start()
    {
        ps = GetComponent<ParticleSystem>();
        collisionEvents = new List<ParticleCollisionEvent>();
        //
        var collision = ps.collision;
        collision.enabled = true;
        collision.type = ParticleSystemCollisionType.World;
        collision.mode = ParticleSystemCollisionMode.Collision3D;
    }

    void OnParticleCollision(GameObject other)
    {
        int numCollisionEvents = ps.GetCollisionEvents(other, collisionEvents);

        Rigidbody rb = other.GetComponent<Rigidbody>();
        int i = 0;

        while (i < numCollisionEvents)
        {
            if (rb.CompareTag("Enemy"))
            {
                BaseHealth baseHealth = other.GetComponent<BaseHealth>();

                if (baseHealth != null)
                {
                    Vector3 pos = collisionEvents[i].intersection;
                    Vector3 force = collisionEvents[i].velocity;// * 10;
                    rb.AddForce(force);
                    baseHealth.TakeDamage(attackValue);
                }
            }
            i++;
        }
    }

    void Update()
    {
        var collision = ps.collision;
        collision.maxKillSpeed = particleSpeed;

        Debug.Log("Particles Alive Count: " + GetAliveParticles());

        ps.Emit(maxParticles);
        var main = ps.main;
        main.maxParticles = Mathf.RoundToInt(maxParticles);
        main.startLifetime = particleLife;

        if (neverDies)
        {
            particleLife = float.PositiveInfinity;
        }
        else
        {
            particleLife = 5f;
        }
    }

    int GetAliveParticles()
    {
        ParticleSystem.Particle[] particles = new ParticleSystem.Particle[ps.particleCount];
        return ps.GetParticles(particles);
    }
}

sentences:
How to impale and stack targets correctly according to the collider and its coordinate? I'm making another simple game, a catch game, where a spawning target game object must be captured using a skewer to impale it. Here how:

At the start, the falling object (in red) will fall in a vertical direction (in blue)

When aimed properly, the target will fall down along the line of the skewer. (in blue) Then, another target is spawned and will fall vertically. (in red)

When aimed successfully again in a streak, the second target will fall along the skewer and stacked. Same process over and over when another target is spawned.

However, when I test run it on the scene tab in Unity, when impaled several targets, instead of a smooth flow and stacking it ended up overlaying it instead of stacking it up like a pancake. Here's what it look like:

As I noticed when reaching the half-way of my progress, I tried to figure out how to deal with collider bodies without sticking each other so that it will actually stack like in the example of the image at no. 3. Here's the script code I added in the target game object:

using UnityEngine;
using System.Collections;

public class ImpaleStateTest : MonoBehaviour {

    public GameObject target;
    public GameObject skewer;

    public bool drag = false;

    private float stack;
    private float impaleCount;

    void Start () {
        stack = 0;
        impaleCount = 0;
    }

    void Update () {
        if(drag) {
            target.transform.position = new Vector3 (DragTest.dir.transform.position.x, DragTest.dir.transform.position.y - 0.35f, 0);
            target.transform.rotation = DragTest.degrees;
            target.rigidbody2D.fixedAngle = true;
            target.rigidbody2D.isKinematic = true;
            target.rigidbody2D.gravityScale = 0;

            if(Input.GetMouseButton(0)) {
                Debug.Log ("Skewer: " + DragTest.dir.transform.position.x);
                Debug.Log ("Target: " + target.transform.position.x);
            }
        }
    }

    void OnTriggerEnter2D(Collider2D collider) {
        impaleCount++;
        Debug.Log ("Impaled " + impaleCount + " time(s)!");
        drag = true;
        audio.Play ();
    }

}

Aside from that, I'm not sure if it's right but, the only way to stick the impaled targets while dragging the skewer left or right is to get the X coordinates from the skewer only. Is there something else to recommend it in order to improve this behavior as realistic as possible? Please help.

sentences:
UENUM definition in header file I am trying to define a simple enumeration in a header file as per the example published here. My header file consists of the following:

#pragma once

#include "CoreMinimal.h"

UENUM()
enum class MyEnum : int32
{
    MyField1,
    MyField2,
    MyField3
};

If I remove UENUM(), the compiler doesn't complain; however, when I add it, I get multiple errors.

expected a ';'
expected a '{'
identifier "MyField1" is undefined
identifier "MyField2" is undefined
identifier "MyField3" is undefined

This all seems odd considering I'm doing exactly what the article says to do and other websites suggest doing the same thing.

Here's what it looks like in my editor:

What I've tried

Changing enum class to simply enum.
Not explicitly specifying an underlying type.
Defining the enum elsewhere (for instance, in one of my classes; but when you add UENUM() there, it tells you you can't define it there).

I am new to both C++ and UE4 so it could be silly or trivial. Either way, I'm having a hard time understanding why something so simple won't compile.

sentences: Vulkan Drawing lines I want to be able to draw single lines inside Vulkan but the only way I have managed to achieve this so far is by drawing a triangle with two of its points that ocupuy the same point in space. Is there a way to draw lines inside Vulkan and also change their width? I know I can change line width when I set the polygon mode in the rasterizer to VK_POLYGON_MODE_LINE and then set the lineWidth option, but I need to be able to do it whilst rendering all other 3D objects with VK_POLYGON_MODE_FILL enabled.

sentences: Changing motion clips via script in Unity is there a way in Unity to access the Motion clip of an Animator State and change it at runtime via script? I am trying to do a character shop in my 2D game. My idea is, when i click a GUI button it would just select different motion clips but the states would stay the same. It's just a simple Jump and Idle state, parameters dont change. I just want to feed in different animation clips for different characters.

sentences:
Why is there a white border around my app icon? EDIT:  This is because Unity did not support Android's adaptive icons.  As of Unity 2018, it is supported natively.

For Unity 2018+, see this question.
For Unity 2017-, see Jimmy's answer.

I am developing an Android app in Unity.  I have two versions of the app on my phone, both with identical icons. The white border is only on the newer version of the app. I am using a Google Pixel.

Why is this there, and how do I get rid of it?

Is this tied to my phone or my app? If it is tied to my phone, why is it on one icon, but not the other (they are same icon)? I don't want other users to have this pointless border around the app, as my icon already has a border.

sentences:
Pixel Shader, YUV-RGB Conversion failing I am tasked with playing back a video hthat comes in in a YUV format as an overlay in a larger game. I am not a specialist in Direct3d, so I am struggling. I managed to get a shader working and am rendering 3 textures (Y, V, U). Sadly I am totally unable to get anything like a decent image. Documentation is also failing me. I am currently loading the different data planes (Y,V,U) in three different textures:

m_Textures = new Texture[3];
// Y Plane
m_Textures[0] = new Texture(m_Device, w, h, 1, Usage.None, Format.L8, Pool.Managed);
// V Plane
m_Textures[1] = new Texture(m_Device, w2, h2, 1, Usage.None, Format.L8, Pool.Managed);
// U Plane
m_Textures[2] = new Texture(m_Device, w2, h2, 1, Usage.None, Format.L8, Pool.Managed);

When I am rendering them as R, G and B respectively with the following code:

float4 Pixel(float2 texCoord: TEXCOORD0) : COLOR0
{
    float y = tex2D (ytexture, texCoord);
    float v = tex2D (vtexture, texCoord);
    float u = tex2D (utexture, texCoord);

    //R = Y + 1.140 (V -128)
    //G = Y - 0.395 (U-128) - 0.581 (V-128)
    //B = Y + 2.028 (U-128)

    float r = y; //y + 1.140 * v;
    float g = v; //y - 0.395 * u - 0.581 * v;
    float b = u; //y + 2.028 * u;

    float4 result;
    result.a = 255;
    result.r = r; //clamp (r, 0, 255);
    result.g = g; //clamp (g, 0, 255);
    result.b = b; //clamp (b, 0, 255);

    return result;
}

Then the resulting image is - quite funny. I can see the image, but colors are totally distorted, as it should be.

The formula I should apply shows up in the comment of the pixel shader, but when I do it, the resulting image is pretty brutally magenta only. This gets me to the question - when I read out an L8 texture into a float, with

float y = tex2D (ytexture, texCoord);

what is the range of values? The "origin" values are 1 byte, 0 to 255, and the forum I have assumes this. Naturally I am totally off when the values returned are somehow normalized. My Clamp operation at the end also will fail if for example colors in a pixel shader are normalized 0 to 1. Anyone an idea how that works? Please point me also to documentation - I have not found anything in this regard.

sentences: Can Google App Engine communicate with a stand alone program? If I create a client program using say C#, or develop something for the Android or Iphone, can I use Google App Engine for the server and communicate with the client application mentioned above?

sentences:
Game Opens then Stops Responding Python Sorry for the bad title, if you think of a better one please tell me.

So I was asked to make a button that says a line from a video game. I attempted to have the while loop add 1 to a variable every time it looped through, then display the variable in the caption of the window. I did this so that I could see if it was looping, and really, what was going on. It showed a rapidly increasing number, then froze the computer (I had to restart the computer). I tried putting a short wait in the loop, still would not respond. I am also having this exact same problem in a much longer and more complex program that I'm working on, so if I figure it out, it will solve both issues. Don't just give me code, please tell me why I need to use it or what it does. Here's the program:

from pygame import *
import pygame
pygame.init()

pygame.display.set_caption('Potato')
screen = pygame.display.set_mode((224, 224))
button = pygame.image.load("C:/Python34/redbutton.jpg")
screen.blit(button,(0,0))
pygame.display.flip()

potato = pygame.mixer.Sound("C:/Python34/potato.wav")

test = 0
pressed = False

while pressed == False:
    if pygame.mouse.get_pressed()[1]:
        pressed = True

    if pygame.mouse.get_pressed()[0]:
        potato.play()

sys.exit()

sentences:
Is it possible to generate Events and Hooks in Lua for any game without built-in support? Does a game have to have built-in functions to accept and run lua scripts, or can I design Events and Hooks using Lua on any game I please, akin to the days where C code could be used to hook into the WinAPI using dlls?

The reason I ask is, I am trying to create a background application that will perform events and hooks on a particular game that does not currently support lua in-game.

Brief examples:

Events:
- An action executed by the PLAYER is detected. For instance, hitting the Q key will normally make my character use an ability, but with my Lua script running in the background, will cause a sound to play on my computer (or something).

Hooks:
- An action within the GAME is detected. For instance, the game spawns an enemy every minute. When an enemy spawns, the script will detect this and perform an action, for instance playing a sound locally on the computer.

I would like to do both, but I know for games like Garry's Mod, the game already has built-in support for running lua scripts.

Is there a way to do either events OR hooks using lua similarly to how C/C++ can connect to a game using WinAPI dlls?

sentences:
How can I resize the Unity Facebook SDK's login dialog to fit my vertical phone screen? I have a Facebook-login button for my iOS game, but Facebook's login panel is entirely too big:

The panel is cut off on both sides. It allows for input, but I cannot see most of it. My aspect ratio is 2:3; for vertical phone screens.

I tried to use FB.Canvas.SetResolution and .SetAspectRatio both did nothing. I have not attempted to view this on an iPhone yet, only in my Unity debug view.

I have never worked with Facebook SDK before, and can't find this issue discussed elsewhere, so help would be appreciated!

sentences:
Best cross-platform solution for building 3D toolsets? I am looking to develop an in-browser game in Unity3D, but I would like to write my builder tools for my project on a more powerful platform.

The assets I am building for the game are not traditional 3D models, so I'll probably be creating my own format. I was thinking about writing something in Blender or Maya, but that is a lot of overhead for what I want to do.

A Unity3D desktop app was also a possibility, but at the end of the day I decided I wanted to build it outside of the game engine.

Since the Unity3D app is going to be cross platform, I would like the tool to be as well.

Saying that, does anyone know of a 3D library/platform that will run well on Windows and OS X?

sentences:
How do I support animation with frames of different sizes? I'm trying to create a simple top-view 2D rpg, in the style of Zelda and Secret of Mana, using PyGame. I've managed to make the beginnings of a game, with an animated character walking around. However, when I start animating attacks, I'm running into problems because the sprite with the sword slash is bigger than the walking sprite. This makes the character appear to be jumping around when attacking.

I managed to handle the problem by defining a center of gravity, so to speak, for each image, and apply a suitable offset at each frame in the animation to make the center of the character stay at the same place throughout the animation. I defined a dictionary of lists of images (instances of pygame.Surface), where I pick out the correct list by the state of the character, so for example there is one list for walking left, and then I loop over the list to get the animation. To handle the offset, I similarly created a dictionary of lists of offsets, looping over those in the same way.

However, I'm not entirely pleased with this implementation, so I'm looking for a more elegant solution.

I tried to add an attribute called offset to each instance of the pygame.Surface class, to hold the offset for each image, but the Surface class doesn't allow new attributes to be set. I then thought about subclassing pygame.Surface, which would allow me to set any attribute I wanted, but then I couldn't load my images with pygame.image.load without a lot of extra code.

I imagine everyone who makes a game with animations where the size of the sprite changes between frames would have to deal with this problem, so if anyone could suggest an elegant implementation, that would be great. If example code with PyGame is available, that would be even greater.

sentences:
How do I draw a context menu next to my object? I want to show a menu next to an item in an inventory. This is what I try to rebuild:

I do this by placing a canvas in 3D world space next to the inventory:

As I don't want the menu to be rotated, I rotated the menu the opposite X value as the camera. The camera has an X rotation of -11, so I rotate the menu by 11 to make it look straight:

Since I don't want the menu to get stuck in the case, I move it closer to the camera:

One can see that the menu is now offset to the left and to the top because of the camera perspective.

How could I offset the menu in such a way that it still aligns with the right top corner of the item?

Thank you!

sentences:
Clamp view direction vector to nearest axis In JMonkeyEngine, given any view direction Vector3f instance, I'd like to get a new vector facing the nearest x or z axis (positive or negative), with y set to 0.

For example

[-0.99915564, -0.036672898, -0.018518358]
// -> should return [-1, 0, 0]

[-0.01313778, 0.042407744, 0.99901414]
// -> should return [0, 0, 1]

Is there a nifty math trick for this or do I need to manually check x and z and then set y to 0?

Thanks.

Update

So far, what I do is this

dir.x = dir.x >= 0 ? Math.floor(dir.x + 0.5) : Math.ceil(dir.x - 0.5);
dir.y = 0;
dir.z = dir.z >= 0 ? Math.floor(dir.z + 0.5) : Math.ceil(dir.z - 0.5);

Which produce the desired output. I was wondering if this can be done in a more elegant fashion (i.e. through some nifty matrix operation).

sentences:
Changes to one Unity trail renderer causes all of them to flicker I'm using Unity. So I have a prefab, and this prefab has a trail renderer component attached to it.

However, for some of the game objects I want to stop the trailer renderer at certain points in time. But doing so seems to make all of the trail renderers blink; flash off and on. I've tried changing time, disabling the component, and using Clear() while hiding the trail renderer behind the background before needing to be used. All of these makes all trail renderers flicker on the frame the change happens.

I believe providing the code won't be helpful, it's just if(x) disable-action, if(y) enable_action. What can I do?

sentences:
Multiple Sprite animation layers overlayed in Unity Animator I have an animator with two layers, an axe layer and a body layer.

I would like to animate the two in sync with each other. They are both 64x64 sprite animations, frame-by-frame bitmaps.

The problem I'm having is I can't figure out how to alpha blend the layers. The axe either plays and the player body becomes invisible, or the axe isn't visible.

I have a bunch of states like this which each return to an idle state.
And link to an animation. I'd post a screenshot but I'm not allowed.

The axe layer is set to sync so the state machine looks the same, and I set the motion to the axe animations rather than the character body animations.

sentences:
Collision detection: Swinging bat/racket and ball I am programming a side-view tennis game, inspired by an old arcade game,
using Javscript and HTML5 canvas elements. The player can move left and right and holds a racket at arms length which can be rotated 360 degrees around the shoulder joint.

I am quite happy with the collision detection and resulting deflection angle between the racket and the ball in the case where the player stands still and the racket does not move. I use a ray-casting approach for this collision detection between the vector that represents the racket and the trajectory vector for the ball as proposed here.

However, I am having trouble implementing the collision detection between the rotating racket and the ball. When the racket is swung, the area in which a collision would apply has a shape similar to a circular segment , but the racket rotates rotates to fast and the collision detection does not pick it up in most cases.
The image bellow illustrates the problem, the red arrow indicates the direction of the swinging racket.

The following code snippet from the player entity's update function shows how the racket is updated. arcmx and armcy is the location of the shoulder joint, rstart_ and rend_ are the beginning and end of the racket.

  if(KEY_STATUS.rleft || KEY_STATUS.rright) {
    if(KEY_STATUS.rright) {
      this.rangle += this.rspeed;
    } else if (KEY_STATUS.rleft) {
      this.rangle -= this.rspeed;
    }
  }

  this.armcx = this.x + this.width/2;
  this.armcy = this.y + 46;
  this.rstartx = this.armcx + Math.cos(this.rangle)*40;
  this.rstarty = this.armcy + Math.sin(this.rangle)*40;

  this.rendx = this.armcx + Math.cos(this.rangle)*71;
  this.rendy = this.armcy + Math.sin(this.rangle)*71;

I am pretty lost on this problem and appreciate any hints on how to approach it.

sentences:
Alpha Blending older Images I am working on re-writing an old game, and have faced some issues with the older images that were used, the first thing we done was convert all the old images and set the alpha channel on black pixels so they are transparent, and then built our image libraries. However, the animated images have had some conversion issues it appears the edges of the images were not all set to true black so the conversion never set the transparency on these pixels. The value on the edges varies between R0 G0 B1-16 we have seen but we can't be sure as there is 1000s of images.

If we use additive blending it allows us to blend without showing the noisy outline but the additive blending does not display the images exactly how they should be to reproduce the old style of the game of course.

Question is, what options are available to either fix the image, or render it properly at run time using a HLSL.

I am hesitant to run a conversion on the known black ranges as we might miss a lot out and extending the range might set stuff we should set wrongly. Has anyone faced this before and how did you solve it?

sentences:
Change item rotation axis in inventory item visualization I'm learning unity and i'm trying now make an inventory, i made a simple interface, and now i'm trying to make a item visualization. I look for some codes from web and i found this one:

using UnityEngine;

public class TurnObject : MonoBehaviour
{
    protected Vector3 posLastFame;
    public Camera UICam;

    // Update is called once per frame
    void Update()
    {
        if(Input.GetMouseButtonDown(0)) {
            posLastFame = Input.mousePosition;
        }

        if (Input.GetMouseButton(0)) {
            var delta = Input.mousePosition - posLastFame;
            posLastFame = Input.mousePosition;

            var axis = Quaternion.AngleAxis(-90f, Vector3.forward) * delta;
            transform.rotation = Quaternion.AngleAxis(delta.magnitude * 0.1f, axis) * transform.rotation;
        }
    }
}

I know some code, but I'm not good with geometrics. In this code when I move my mouse horizontal way, my object turn in the Y axis. And that's good. But when I move my mouse vertical the object move in the X axis instead of Z axis.

Is there a way in this code for change this? I really have difficulty to understanding geometrics in Unity.

sentences:
Unity settings overlapping other settings error In my unity game, I am using the amazing unity asset aura volumetric lighting and when I add its script into my camera this happens:

Yeah... I can't see anyone else who got these settings overlapping each other on the stack exchange or anywhere else. Not only does it overlap but I can actually change its settings and the camera settings if I click in the right areas! I restarted unity but it still doesn't fix anything. Please help. Thanks in advance!

sentences:
Bullet Physics ignore collision from bottom I'm currently using BulletSharp a wrapper for Bullet physics.
I'm using Bullet Physics for a 2D project.

Many platform games allow the player to pass through a platform as they jump upwards, and then have it magically become solid so they can stand on it from above.

Can this be done in Bullet Physics? In pre solve or something?

sentences:
LookAt only in Z axis I'm fairly new to game development, like many of us asking questions here

Currently, I'm trying my luck working on a simple space shooter.

I'm trying to add some enemy ships with movement, they will only move forwards, but, at all time, will be facing the player ship´

I have that figured out, after playing with many options, LookAt was my saviour, but now, I'm having an issue, they do rate to face the player, but they also rotate on the Y axis

This is how they are in the editor looking

This is the position setting

Their properties

Their code

using UnityEngine;

public class AlienMovement : MonoBehaviour {

    public GameObject PlayerShip;
    public float speed;

    // Use this for initialization
    void Start () {
        GetComponent<Rigidbody> ().velocity = transform.up * speed * -1;
    }

    // Update is called once per frame
    void Update () {
        transform.LookAt (PlayerShip.transform, Vector3.up);
    }
}

And how they look once the game is running (frame still)

Transform properties for the one on the right

Any idea what I'm doing wrong?

sentences:
How do I center the view around specific coordinates in SFML I want to use sf::View in SFML in order to change the position of the view, such that the player sprite is always in the center of the screen. Thus I want to write a function which allows me to input a set of coordinates and thus center the screen around those coordinates. In addition I want to be able to set a limit to this, such that when the player reaches the side of the map, that axis of the camera stops following the player, as it has reached a "limit". How do I achieve this?

Thank you in advance.

sentences:
How do I seperate my game and game engine into seprate projects? I am trying to separate my game from the game engine, both written in Java. Currently, they are in two separate packages, but I would like to separate them into different projects.

A main method in "Project B" starts a game loop in "Project A". This loop needs to call back to methods in "Project B". What is the best method to achieve this, without "Project A" being aware of the specific implementation of "Project B"?

"Project A" (Engine - Library):

public class Engine {

    public static void start() {
        init();
        // Call Game.getInstance().init() from Project B.

        while (true) {
            input();
            // Call Game.getInstance().input() from Project B.

            update();
            // Call Game.getInstance().update() from Project B.

            render();
            // Call Game.getInstance().render() from Project B.
        }

        cleanUp();
    }

}

"Project B" (Game - Executable)

public class Main {

    public static void main(String[] args) {
        Engine.start();
    }

}

public class Game {

    private static Game instance = new Game();

    private Game() {}

    public static Game getInstance()
        return instance;

    public void init()
        // Do Stuff

    public void input()
        // Do Stuff

    public void update()
        // Do Stuff

    public void render()
        // Do Stuff

}

sentences:
Libgdx Do a fixed rotation for orthographic camera I'm trying to rotate my OrthographicCamera in the render loop to a fixed angle, but I can only make the camera spin. This is the code that I have:

in create():

OrthographicCamera camera = new OrthographicCamera();
camera.setToOrtho(true, 100, 100);
camera.position.set(50, 50, 0);
camera.update();

in the render loop:

camera.rotate(30);
camera.update();

The camera keeps spinning each frame. But I'd like the camera to stay at 30 degrees.

I have already seen this answer:

https://stackoverflow.com/questions/16509244/set-camera-rotation-in-libgdx

But I don't like it because this code is too drastic.
I wonder if there is a more "common" way to do this.

sentences:
Implementing smooth object rotation I declared two variables on class level. One is the angle the object is rotated by. The second is a stopwatch.

float yRot = 0.0f;
static CStopWatch rotTimer;

I rotate the cube using the SpecialKeys function.

void SpecialKeys(int key,int x,int y)
{

    if(key == GLUT_KEY_RIGHT)
    {
        yRot = rotTimer.GetElapsedSeconds() * 10.0f;
    }

    if(key == GLUT_KEY_LEFT)
    {
        yRot = rotTimer.GetElapsedSeconds() * -10.0f;
    }

    glutPostRedisplay();
}

Finally the rotation matrix is calculated using the rotation variable, in the RenderScene function.

// Create a rotation matrix based on the current value of yRot
m3dRotationMatrix44(mRotate, m3dDegToRad(yRot), 0.0f, 1.0f, 0.0f);

It actually works. My problem is that when I hold the key the animation looks fine. But if I press it the animation looks a little jumpy, like the angle is bigger then when I hold it. I suppose this hangs together with the stopwatch. How to solve this issue?

sentences: Mentality for the hard initial stage of game development I feel like there is a lot of excitement involving the initial steps towards developing games.  Kids (myself younger self included) get very excited about making games and talk for hours about the games in their imaginations.  Then comes the initial game making experience.  A lot can happen there.  It feels like a no-man's land where many enthusiasts fall away.  It seems to me that there are a lot of good, talented people out there who end up stuck in the mud.  Is that just the nature of competition and a necessary hurtle to greatness or should something be done to avoid it?  I feel that experienced game designers with a history of success could offer a lot of help, but then again, sometimes people are punished for our kindness.  However, I feel that having the right mentality would both help a person get through the hard times and make it easer to approach professionals.  Could I get some tips on crafting a positive and effective mentality regarding these issues during the early staged of a game design career?

sentences:
Unity Mirror client scene.local player.connection to client.client owned object not working in client U hmm I'm new to mirror networking I just wanna find objects that the local player has authority, but it doesn't work on client, is there a solution to this? Well I could make an object tracking script but that will complicate things.
This question might look like I haven't research anything, truth is I've searched everywhere there is just no documentation for this

sentences:
Swift - How do I detect the exact point at which two "SKPhysicsBody(edgeFromPoint:" type physics bodies intersect in sprite kit I have two physics bodies attached to two separate sprite nodes using Sprit Kit.  One is a vertical line and one is a horizontal line:

//sprite with horizontal physics body
spriteMatrix[i][j].physicsBody = SKPhysicsBody(edgeFromPoint: CGPointMake(0, tileSegmentHeight), toPoint: CGPointMake(tileSegmentWidth, tileSegmentHeight))
spriteMatrix[i][j].physicsBody!.categoryBitMask = self.surfaceCatagory
spriteMatrix[i][j].physicsBody!.contactTestBitMask = heroCatagory

//sprite with vertical physics body
self.hero.physicsBody = SKPhysicsBody(edgeFromPoint: CGPointMake(self.hero.frame.width / 2, self.hero.frame.height / 2), toPoint: CGPointMake(self.hero.frame.width / 2, -20))
self.hero.physicsBody!.categoryBitMask = heroCatagory
self.hero.physicsBody!.contactTestBitMask = surfaceCatagory

What I'm want to do is test if they are intersecting on every frame, and if they are, return the x and y position of where they are intersecting.  Is this even possible?

sentences:
Unity - how to check if object is fully covered by another objects (2d) I am creating an educational game for kids , and in one of the levels player must to paint animals , like in color book, so I created scene where 2 object , already colorful lion and white lion (white is above) and script, which is instantiating circle sprite masks in players touch position , how can I check if white lion is fully covered by masks and not visiable .

P. S. If you have better idea for painting (like painting with brush) and checking , please say.

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:
Getting started to OpenGL - little question Im starting to learn opengl, and after 2 days, searching and trying hard, i finally installed all the libraries i need (lol).
So, I'm following this tutorial, and it says to use glfwOpenWindowHint this way:
glfwOpenWindowHint(GLFW_FSAA_SAMPLES, 4); // 4x antialiasing
glfwOpenWindowHint(GLFW_OPENGL_VERSION_MAJOR, 3); // We want OpenGL 3.3
glfwOpenWindowHint(GLFW_OPENGL_VERSION_MINOR, 3);
glfwOpenWindowHint(GLFW_OPENGL_PROFILE, GLFW_OPENGL_CORE_PROFILE); //We don't want the old OpenGL

But glfwOpenWindow didn't work with this Hint. So I made a little research, and changed the PROFILE parameter to this:
glfwOpenWindowHint(GLFW_OPENGL_PROFILE, 0);

Ok, fine, now works.
My question is if it is a big deal to change the opengl profile, or this will make no difference. And why I can't use GLFW_OPENGL_CORE_PROFILE instead.

sentences:
how to move a 2d shape in opengl 4.6 (glfw) Class Button
So  from my understanding in order to move a 2d shape you need manipulate the vertices and then update????
If i do need to update the buffer how i would go by doing that?
float xpos = 150 //Cords relative to the window application so let say the window size 480 by 260
float ypos = 60 Where would I plug in position in the vertices array?
  float vertices[] = {
 -.5f,-.5f,0,
.5f,-.5f,0,
-.5f,.5f,0,
.5f,.5f,0
 };

shader.setup("Resources/Shaders/shape.vertex", "Resources/Shaders/shape.frag");

glGenVertexArrays(1, &VAO);
glGenBuffers(1, &VBO);
// bind the Vertex Array Object first, then bind and set vertex buffer(s), and then configure vertex attributes(s).
glBindVertexArray(VAO);

glBindBuffer(GL_ARRAY_BUFFER, VBO);
glBufferData(GL_ARRAY_BUFFER, sizeof(vertices), vertices, GL_DYNAMIC_DRAW);

glVertexAttribPointer(0, 3, GL_FLOAT, GL_FALSE, 3 * sizeof(float), (void*)0);
glEnableVertexAttribArray(0);

// note that this is allowed, the call to glVertexAttribPointer registered VBO as the vertex attribute's bound vertex buffer object so afterwards we can safely unbind
glBindBuffer(GL_ARRAY_BUFFER, 0);

// You can unbind the VAO afterwards so other VAO calls won't accidentally modify this VAO, but this rarely happens. Modifying other
// VAOs requires a call to glBindVertexArray anyways so we generally don't unbind VAOs (nor VBOs) when it's not directly necessary.
glBindVertexArray(0);

sentences:
(Unity) Spawning AI cars - weighted to ahead of camera? I'm working on a little project where I drive around a small city with a top-down but slightly angled camera view (like GTA Chinatown Wars). Cars are instantiated from spawners that aren't in camera view, then destroy if they drive too far from the player.
To spawn a new car, I loop through all my spawner gameobjects and if they are within a certain distance to the player (and not in view of the camera), then they get added to a 'spawner' list, of which I pick a random.
The loop is something like this;
float dist = Vector3.Distance(player.transform.position, spawner.transform.position);
Vector3 screenPos = Camera.main.WorldToViewportPoint(spawner.transform.position);
bool inView = screenPos.z > 0 && screenPos.x > 0 && screenPos.x < 1 && screenPos.y > 0 && screenPos.y < 1;
if (!inView && dist < 15) { list.Add(spawner); }

This works, but I find that when I'm driving around barely any traffic spawns on roads ahead of me, maybe because the camera angle is removing a chunk of the possibility area.
Is there anyway to 'weight' it so spawners in the direction the camera (or beyond) have more chance of being picked, rather than ones behind me? In games like GTA Chinatown Wars you will be driving through rows of traffic, and I'm trying to get more density.

sentences:
Run XNA game without graphics Wondering if there is anyway to run an XNA game with out displaying anything.

I have a working game that runs in a client server setup where one player is the host and other people can connect to his game.

I now want to be able to run the game as a host on a decicated server with no graphics card, basically I dont want to run any Draw() logic at all.

Do i really need to go through the entire game and remove all references to XNA?

How have people done this?

EDIT: The reason I want to do this is because I have a working client server setup in the game and I dont want to make a separate "headless" server program.

sentences: Does SDL_SetThreadPriority work with std::thread I'm trying to set the priority of my threads so that my UI thread can be given priority over background calculations. I noticed that SDL has a SDL_SetThreadPriority method, however I still prefer the standard std::thread syntax rather than SDL_CreateThread. Does SDL_SetThreadPriority work with threads created with std::thread, or do I need to update everything to use SDL_Thread?

sentences: Region selection in OpenGL If I have a mesh of triangles and going to make a selection on it using a region (and not rectangle using   Glu.gluPickMatrix(...);), how can I implement it?

sentences:
How can I generate isometric sprite sheets from 3D animations? I want to generate sprite-sheets for an isometric projection of various 3d assets purchased from the Unity3D asset store. I'd preferably also render the normal maps. I am a programmer, but new to 3D modeling software (Blender, etc.)

I found two tools for this; SpriteForge and SpriteWorks, but neither supports enough formats to be worth their cost.

There must be an efficient way of isometrically rendering various animations of a 3d assets in Blender—but I don't know how. How can I do this?

sentences:
Game Engine Renderer Architecture I'm currently building a game engine renderer but I got stuck when I had to separate engine and client code.

I had been following OpenGL tutorials to learn about buffer creation, etc so all my code for rendering was in a single place and was tied to that specific example.

I created a VBO, a IBO/EBO, a VAO and a shader, then set the VertexAttribPointers for that VAO (and VBO layout) and rendered it. Everything worked fine.

Then I created C++ abstractions for all of those "objects" and recreated the example; that also worked.

So what I wanted to do know is to have each of my game objects create a VBO and an IBO, create a global VAO in my renderer (since all my objects share the same layout) submit them to the renderer and have them rendered. But I discovered I could not setup vertex attribute pointers without having a VBO bound (I have none bound since they get created after the renderer starts up).

So my question is:

How should I set up the VAOs and VBOs for the renderer to work?

I read in some places that what I have to do is to set up few VBOs (so as to have little binding calls and draw calls) and then store every object inside
that one giant buffer. (Of course while still creating different buffers for objects with different vertex layouts and different shaders). I also know that to do that you have to allocate a big buffer and then call buffer sub data to store the new data inside that one buffer, but what I don't know is how to store that data if it must be offset (because of its position in the world and how to update its position)

So if that's the case my next question is:

How do I create one giant buffer and then store different objects inside that one giant buffer and then render those stored objects with their respective positions? (For both static and dynamic objects).

sentences:
Why does my camera break mouse position targeting? I made a short video of this.

Basically, when the screen scrolls with the camera, the character begins firing at the incorrect mouse position. You can see where I am clicking the whole time. As we move towards the right edge (the more we scroll), you'll notice the distance away from the correct position increases. The shooting mechanic worked just fine before I added the camera.

I'm using a translation matrix to implement my camera.

What could be causing this?

sentences:
How to create a wavy beam? I want to implement a wavy laser beam similar to the Proton Backpack in Enter the Gungeon.

https://youtu.be/wl-o6gbMqFM?t=58

It's easy enough to draw a line from one point to another, but how to get the undulating curviness and the lighting effects?

I am working in Godot, but I could easily adapt techniques from Unity, if you know them, since Godot has similar resources.

I asked a version of this question in a Godot forum, but am also asking it here

sentences:
How to split a 2D sprite tile set into individual sprites? I see a lot of sprite catalogs for games provided as single PNG image, like the one below.

I'm interested if I have to manually create tiles from that, or if there's some program that can split it into various tile combinations for me? For example, given the tile combination below, I will have to create a flat grass surface, and 8 other combinations with various edges. Is there something that can automate this task?

sentences:
Are abilities in online games better crafted in the main game backend language or a scripting language? Scourge Healing: Hex Spell. (30 seconds.) Whenever target foe is healed, the healer takes 15...67...80 holy damage.

The above is one of Guild Wars 1's monk class skills.

My question is about what would be a good way of implementing abilities like this. In a realtime game, should I be implementing them in my game's backend language(golang) directly, interpreting them from a scripting language at runtime, or something else? How do most RPGs(online or otherwise) do this?

sentences:
Graphics Pipeline, how exactly it works and how graphics card interprets it? I've looked at this Wikipedia's link, http://en.wikipedia.org/wiki/Graphics_pipeline, but the article lacks in-depth explanation.

The only thing, I suppose, I understand and can expand upon, is, Texture part:

Apply bump map
Apply specular map
Apply displacement map
Apply texture map
In between apply any other maps(?)

What interests me in the answer, is, what happens with the model on every frame rendered, like:

Application launched, requests a 3d model (OpenGL/D3D)
OpenGL/D3D calls hardware for help
Polygons get loaded into graphics card memory,
Something gets done, blah, blah
The Texture part comes in (the upper list), loading every texture in memory card memory texture that needs to be applied to the mesh.
Maybe something more?
Display to monitor or send out to operating systems display interface?

In short: OS -> Application -> OS -> Hardware -> OS -> Display device.

My examples are just what I understand/can make out of all this. But I'm looking for an answer that goes well in depth on graphics pipeline.

Would like to know how AAA tools like CryEngine, UDK does graphics rendering, where we have all the dynamic lightning and stuff like that.

I'd be more than thankful with answer that contains an example of, for instance, what does the character model (CryEngine/UDK) has to go through to get rendered in full fashion, with approximate included memory consumption/hardware instruction called, like:

Load polygons [OpenGL issues command, hardware instruction, memory used, possibly GPU usage?]
Next function [OGL, HW, Memory, GPU]

And, what are the best practices for graphics pipeline?

P.S. Please correct me if that's not Graphics Pipeline I'm referring to.

Thanks in advance!

sentences:
Why is my diffuse lighting changing with camera position? I am trying to do lighting in view space, but I am afraid I have an issue. I calculate the normals as:

N = norm_mat * vec4(vert_norm,0.0)

where norm_mat is the transpose(inverse(model_view_mat)).

Then in the lighting shader (for a directional light) perform the following:

N = normalize(N.xyz);
vec4 view_L_pos =  vec4(lightPosition.xyz, 0.0) * view_mat;
vec3 L = normalize(view_L_pos.xyz);
out_col = vec3(dot(N,L))

However, moving the camera changes the floor's lighting:

What am I doing wrong?

sentences:
Z-Value of clip-space position is always 1.0 I render a lot of quads on the screen into z direction (20 x 2000). I want to get the depth value in a final render target. But it looks like z is always 1.0f. I checked the result with the OpenGL debugger. Any advice?

Vertex shader:

#version 410

layout(row_major) uniform UView
{
    mat4 m_View;
    mat4 m_Projection;
};

layout(row_major) uniform UModelMatrix
{
    mat4 m_ModelMatrix;
};

layout(location=0) in vec2 VertexPosition;

out vec3 PSVSPosition;

void main(void)
{
    vec4 VSPosition = m_View * m_ModelMatrix * vec4(VertexPosition.xy, 0.0f, 1.0f);

    PSVSPosition = VSPosition.xyz;

    gl_Position = m_Projection * VSPosition;
}

Fragment shader:

#version 410

layout(row_major) uniform USettings
{
   mat4  m_ProjectionMatrix;
};

layout(location = 0) out vec4 PSColor;

in vec3 PSVSPosition;

void main(void)
{
    // Calculate depth
    vec4 CSPosition = m_ProjectionMatrix * vec4(PSVSPosition, 1.0f);

    CSPosition.xyz /= CSPosition.w;

    PSColor = vec4(vec3(CSPosition.z * 0.5f + 0.5f), 1.0f);
}

Result:

Closer result:

view-space position result:

clip-space position result:

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:
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:
Problem with sensor in box2d I have two bodies: one green static sensor (spikes) and one orange dynamic body (brick).

I have bullet and it's a dynamic body too, but with bullet flag set.

My problem is that when the bullet is moving left to right, it sometimes hits the orange brick instead of the spikes and it flies away. There is code to remove the bullet when it hits spikes. How can I make sure it hits the spikes first?

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:
AR Foundation video player in Unity without Vuforia I am trying to follow this mini tutorial and I can detect an image and replace it with my 3D object. The object is an AR Session Origin tracked image prefab, but when I try to add a Video Player instead, nothing happens.
I was using Unity 2019.2 and got an error when trying to put the video player on the object, then searched about it and Unity fixed that issue on 2019.3.
I am now using 2019.3 and don't get the error anymore, but there is also nothing on the screen when the image is detected.

sentences:
Following a set of points? Lets assume that i have a set of path that an entity should follow :

const int Paths = 2
Vector2D<float> Path[Paths] = { Vector2D(100,0),Vector2D(100,50)   };

Now i define my entity's position in a 2D vector as follows :

Vector2D<float> FollowerPosition(0,0);

And now i would like to move the "follower" to the path at index 1 :

int PathPosition = 0; //Start with path 1

Currently i do this :

Vector2D<float>& Target = Path[PathPosition];
bool Changed = false;

if (FollowerPosition.X < Target.X) FollowerPosition.X += Vel,Changed = true;
if (FollowerPosition.X > Target.X) FollowerPosition.X -= Vel,Changed = true;
if (FollowerPosition.Y < Target.Y) FollowerPosition.Y += Vel;,Changed = true;
if (FollowerPosition.Y > Target.Y) FollowerPosition.Y -= Vel,Changed = true;

if (!Changed)
{
    PathPosition = PathPosition + 1;
    if (PathPosition > Paths) PathPosition = 0;
}

Which works except for one little detail : The movement is not smooth!! ...So i would like to ask if anyone sees anything wrong with my code.

Thanks and sorry for my english.

sentences:
Unity AddForce causing twitch Since this wasn't clear enough, I've removed even more code. It kind of defeats the purpose I was aiming for, but I guess getting any answer relevant to the problem is better than none.

What I want: A cube to leave the ground with N velocity in the negative x direction, then gravity pulls it back down.

THE SETUP:

void Start () {
    rb = GetComponent<Rigidbody>();
}

void Update() {

    //Jump
    if (Input.GetKeyDown("space"))
    {
        jump = true;
    }
}

TEST 1 (I really thought this should work as it was the solution I saw in so many google results)

void FixedUpdate()
{
    if (jump)
    {
        rb.AddForce(new Vector3(0, 0, -5000f));
        jump = false;
    }
}

TEST 2 (Added ForceMode.VelocityChange)

void FixedUpdate()
{
    if (jump)
    {
        rb.AddForce(new Vector3(0, 0, -5000f), ForceMode.VelocityChange);
        jump = false;
    }
}

TEST 3 (Tried other ForceModes)

void FixedUpdate()
{
    if (jump)
    {
        rb.AddForce(new Vector3(0, 0, -5000f), ForceMode./*INSERT OTHER ForceModes*/);
        jump = false;
    }
}

TEST 4 ( I know, changing velocity directly is a bad thing, but seeing as what I want is the cube to move upwards at a certain speed, it made sense to try it )

void FixedUpdate()
{
    if (jump)
    {
        var vel = rb.velocity;
        vel.z += -5000f;
        rb.velocity = vel;
        jump = false;
    }
}

It's been a long day, I'm sure I left some other attempts out.

Can someone explain to me why the cube is teleporting from Z=0 to Z= -2 (or some other value depending on the magnitude of the force)?

I can understand if it was something having to do with impact force not having enough time to change the velocity, but then why did the position change so drastically? And why didn't changing the velocity work, even though I know that is a bad way to go about it?

sentences:
Formula to generate random enemies In my endless game i need to generate random enemies for each "level".

For each level i need to generate the total number of enemies that have to be spawn, and spawn them a few at a time. When they are finished, go to next level and repeat calculation.

So, from the current level (that i know, it's a number, 1,2,3..), i need to generate:

1) A random number indicating the TOTAL number of enemies for this level

2) A random number indicating how many enemies "in this very moment" i have to spawn (extract from the total list) from the total

3) Since i need spawn enemies a little at a time, i need to generate a random number indicating this time

All of these values should increase the difficulty according to the current level.

This is my approach, but if you have other solutions it's ok.

Actually i don't know which formulas i could use.

This is my code (not random):

// if there are no enemies to be spawn...
    if(enemiesToSpawn.size == 0) {
        gameManager.incrementLevel();
        // generate the enemies according to the current level --> put them into enemiesToSpawn
        generateEnemies();
        // reset timeAccumulator
        timeAccumulator = 0f;
        // initialize target time
        targetTime = 2;
    }
    // there are enemies to be spawn...
    else if(enemiesToSpawn.size != 0){
        // increment accumulator
        timeAccumulator += delta;

        // extract enemies and add them to the stage
        if(timeAccumulator >= targetTime) {
            int amount = 1; // should be random
            Array<BaseEnemy> enemies = extractEnemies(amount); // extract enemies from enemiesToSpawn
            for(BaseEnemy enemy: enemies) {
                EntityManager.addEnemy(enemy, gameTable); // add enemies to the stage
            }

            // reset accumulator
            timeAccumulator = 0f;
            // reset target time (should be random)
            targetTime = 10;
        }
    }

sentences:
Combine skin material to two elements without a visible seam Software used: 3ds max 2015 and Photoshop CC 2014.

I have two elements of the head, the "FaceHead" and "UpperHead". I used unwrap UVW for both elements and used Photoshop to add a skin color (eye and lips for "FaceHead") and the same skin color for "UpperHead". I created an image for both elements in Photoshop and added the image to the elements using the Material Editor (with Bitmap option). The problem is, that there is a visible seam between the 2 elements, although I used the same color for both. Is there a solution to solve this?

What I tried:

Used of MaterialByElement
Used of different color
Extend to 2 pixel from the border using Photoshop when applying Paint.

sentences:
SDL mouse wheel not picking up Running Ubuntu 11.04, SDL 1.2 trying to pickup mouse wheel up/down movement with this (stripped down) code:

int main( int argc, char **argv )
{
    SDL_MouseButtonEvent *mousebutton = NULL;

    while ( !done )
    {
        if(mousebutton != NULL && mousebutton->button == SDL_BUTTON_LEFT)
            yrot += 0.75f;
        else if(mousebutton != NULL && mousebutton->button == SDL_BUTTON_RIGHT)
            yrot -= 0.75f;
        else if(mousebutton != NULL && mousebutton->button == SDL_BUTTON_WHEELUP){
            xrot += 0.75f;
        }else if(mousebutton != NULL && mousebutton->button == SDL_BUTTON_WHEELDOWN){
            xrot -= 0.75f;
        }

        while ( SDL_PollEvent( &event ) )
        {
            switch( event.type )
            {
                case SDL_MOUSEBUTTONDOWN:
                    mousebutton = &event.button;
                    break;
                case SDL_MOUSEBUTTONUP:
                    mousebutton = NULL;
                    break;
                default:
                    break;
             }
        }
    }
    return 0;
}

strange thing is, scrolling with the mouse button does nothing, but if I hold down a mouse button or two and then move the mouse it hits the SDL_BUTTON_WHEEL code occasionally.  This honestly reeks of a pointer issue, which would make sense since I've been spoiled with C# for the past couple years, but I am just not seeing it.

How do i correctly find mouse scroll events in SDL?

sentences: Finding islands from array Say I have an two dimensional array with values 0 or 1. How would I construct an algorithm (preferably in C#) to work out which ones are separated or islands. The algorithm would transform the left 2d array to look something more like the right array?

sentences:
Auto-tiling with Yoshi's Island style tiles I'm creating a 2D platformer and I'd like to implement an auto-tiling system.  Normally, this wouldn't be particularly difficult.  However, I'd like to have tiles like in Yoshi's Island, where the graphics extend past the actual collidable tile's boundaries.

Consider this image:

Although the eggs and the Piranha Plant are clearly resting on the ground, the flower tiles continue behind them, out of the collidable tile.

I know that it would be simple to do by hand, but extremely time consuming.  Using an auto-tiling algorithm would save me a lot of time and boredom, but I'm not sure where to start.

sentences:
How to create a walkable crate box? I have a 2D platformer with each platform having a PlatformEffector2D component. I want to create a crate that can be pushed.

When I jump into the edge of the crate, my player gets stuck, so I added PlatformEffector2D to the crate. But when the crate has a PlatformEffector2D component it falls below the platform.

I can remove the component and add a Physics2D Material with zero friction to prevent the player from getting stuck in the crate's edge, but I can't walk above the crate (because the zero friction). The images below illustrate it.

Player getting stuck in the edge of the crate that don't have PlatformEffector2D.

If it has a PlatformEffector2D it will fall below the platform.

My objects have the following components (when the player gets stuck at the edge of a crate):

Player (BoxCollider2D, Rigidbody2D)
Crate (BoxCollider2D, Rigidbody2D)
Platform (EdgeCollider2D, PlatformEffector2D)

What should I do so my player can push the crate and walk above the crate? Would anyone happen to have a sample script?

FYI: I use Physics2D.OverlapCircle to detect the ground. (Unity 5.4.0)

sentences:
Unity3D Strafing Left & Right I am trying to set my character up to strafe left and right and have 2 different animations, on for left and one for right, so far what i have written allows me to strafe left or right but it only ever plays the right strafe animation. What am i doing wrong?

private void Strafe() {
    if (Mathf.Abs (Input.GetAxis ("Strafe")) > 0) {
        animation.CrossFade ("strafeRight");
        _controller.SimpleMove(_myTransform.TransformDirection(Vector3.right) * Input.GetAxis ("Strafe") * strafeSpeed);
    } else if (Mathf.Abs (Input.GetAxis ("Strafe")) < 0) {
        animation.CrossFade ("strafeLeft");
        _controller.SimpleMove(_myTransform.TransformDirection(Vector3.right) * Input.GetAxis ("Strafe") * strafeSpeed);
    }
}

sentences:
Box2D pixel to meter conversion I have a game that was written in pixels and now I want to change it to meters like(box2D do). How I need to do that. I have wached a lot of tutorials and all they have some SCALING FACTOR but when I implement it my game don't work as I aspected. How I need to do that? For example I have a Coin and I want to make position of that coin random. I also want that coin sprite have a CircleShape (Box2D). Here are my code where I update my coin coordinates at specific time

if(time > 1.5f && !goToWallet && setUpCoin){
                coin.setCoinPosition(-100, -100); // do not show coin on the screen
                coin.update(coin.getCoinX(), coin.getCoinY());
                cam.update();
                if(showTime > MathUtils.random(5, 20) && !goToWallet){
                    coin.setCoinPosition(MathUtils.random(50, Gdx.graphics.getWidth() - 50)/100f, MathUtils.random(50, Gdx.graphics.getHeight() - 50)/100f); // random position of the screen IN PIXELS!!!
                    coin.update(coin.getCoinX(), coin.getCoinY());
                    cam.update();
                    time = showTime = 0.0f;
                }
            }

The problem is that is very easy to do in pixels, but How I need to do that in meters?

Here's my Coin class

public class Coin {
    /*
    A lot of variables
    */

    private final float radius;
    private BodyDef body;
    private FixtureDef bodyPhysics;
    private static Box2DDebugRenderer rend;
    private static World world;
    private static CircleShape coin;

    public Coin(World world, Box2DDebugRenderer rend){
        this.rend = rend;
        this.world = world;

        body = new BodyDef();
        bodyPhysics = new FixtureDef();
        coin = new CircleShape();
        coin.setRadius(.05f);
        body.type = BodyType.StaticBody;
        bodyPhysics.shape = coin;
        world.createBody(body).createFixture(bodyPhysics);
}
public void setCoinPosition(float x, float y){
    this.x = x;
    this.y = y;
    coin.setPosition(new Vector2(x, y));
}

}

sentences:
Handling metallic roughness maps colour channels I'm trying to use a metalness/roughness workflow and I'm not sure how to translate the colour channels into the different metalness and roughness attributes. I'm not sure if there's a standard on how to encode that information and I can't find any online resources on how to treat the colour channels so I'm guessing that there is no standard.

I have had materials which have used only the R and B channels and having the B channel set as 0 and I have had materials that somehow use all the RGB channels and I'm confused as to why they would need a third channel to determine metallness and roughness.

My question is, how should I determine the format that the map is in and which channel corresponds to which attribute?

Update:
I've already come to terms that I'll probably have to compile new shaders for different materials but I'm trying to figure out a way of identifying the format that a map is in. It would appear that for one of the models I'm using, it stores its bump map in the R channel. I didn't even know that was an option

Update 2:
I imagine I'll have to just delegate this to the asset pipeline and have the user select which channels to sample from. That or have a hardcoded format and make sure that any PBR materials imported follow that format

sentences:
Finding rotation quaternion from orthonormal basis? Given three 3D unit vectors \$a\$, \$b\$, \$c\$ such that:

\$a \times b = c\$

\$b \times c = a\$

\$c \times a = b\$

(ie \$a, b, c\$ form an orthonormal basis)

How do we calculate a unit quarternion \$q\$ such that the sandwidch product (ie rotation) of \$q\$ on (1,0,0) is \$a\$, (0,1,0) is \$b\$ and (0,0,1) is \$c\$ ?

sentences:
How do I get the InputManager to recognize a certain axis/Vector2D with a Vive motion controller? Right. So basically I want to map the Vive motion controller touchpads (certain locations) to the certain inputs in Unity's InputManager. How do I do this? Like I want a certain area on the touchpad to equate to forwards/backwards in the InputManager. How would I do this? I am not seeing a way to do it natively.

Long story short I'm wondering if I can use the Vive with the InputManager or not.

sentences:
How to reproduce the 3ds Max Gradient Ramp effect? The material definition of a mesh is composed of these three components: Self-Illumunation, Refletcion and Refraction. Each of these components has a Gradient Ramp as a map and the mapping mode is set to spherical environment.
I'm searching for a way to reproduce these effects in a shader (the shader language doesn't matter). Is it possible?

My first idea was to save the Gradient Ramp as a texture: you can see the result in the image below (reflection component):

and using them in the shader through environment spherical mapping, but the result is wrong.

In this image you can see the original rendering (3ds Max, reflection component):

and in this image you can see my rendering:

The underlying idea seems to be correct, in fact there's a correlation between the two images but something goes wrong.

Thanks for any suggestion.

sentences:
A deterministic game loop I want to make a game loop that is deterministic sort of like a physics engine but it's for game update and rendering.

I've done a lot of reading and I still was a bit confused.

I've read these articles:

http://gameprogrammingpatterns.com/game-loop.html
http://www.koonsolo.com/news/dewitters-gameloop/
http://gafferongames.com/game-physics/fix-your-timestep/
http://www.bulletphysics.org/mediawiki-1.5.8/index.php?title=Canonical_Game_Loop
http://gamesfromwithin.com/back-to-the-future-part-1
http://gamesfromwithin.com/back-to-the-future-part-2
http://www.learn-cocos2d.com/2013/10/game-engine-multiply-delta-time-or-not/

The one that made the most sense was the final article about multiply delta time or not.

I want to have fixed time step so I will design my games to fit in either 30 or 60 fps. So if I target 60fps all logic needs to be done in 0.166ms on a pc but if I am making an app that runs on mobile 0.33ms.

With those ideas in mind how would I setup the game loop that's deterministic but also frees the renderer but I am unsure how to go about doing the rendering loop? Would I interpolate the position before rendering?

sentences:
Early Z culling - Ogre For Ogre experienced people, but also experts in the field:
Early Z culling is sometimes quite desirable, and that's what I tried to do in Ogre by using a two pass material. The first one is writing to the Z Buffer, but not to the frame buffer. This is how it looks like:

 pass EarlyZ
    {
        texture_unit TU0
        {
            //ambient diffuse texture
            texture $TU0_TEXTURE
            tex_coord_set 0
            filtering trilinear
        }
        //cull_software none
        //cull_hardware none
        lighting off
        colour_write off
        shading flat
        //scene_blend alpha_blend
        alpha_rejection  greater_equal 200
        depth_bias  -5 -5 // ugly hack - without it, objects tend to flicker
    }

The biggest problem I get is with alpha objects and shadows. For example, now I can't get  tree impostors to cast correct shadows instead of blocks. Although they are rendered correctly, the PSSM isn't working correctly, so the shadows tend to look like stencil shadows. Any ideas on how to fix it? As many people said: is it possible to perform early Z culling and still have transparent objects in the scene? If yes, some hints to do it in Ogre? Here are some screenshots:

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 can I model a "weapon overheating" mechanic? I want to create a weapon overheating system very similar to the plasma rifle in Halo. You can watch a video of the plasma rifle firing.

What I want to do is to create a flexible logic that can be used for multiple weapons for different in-game feelings.  Here is my proposed system

Create a bar that is split from 0 - 100.
Each bullet has a heat value as an integer.
Every bullet adds this value to the bar.
The bar has a cooldown set as some value per second.
If the bar goes over 100 with any bullet fire the bullet still shoots but then the weapon is deactivated for a period defined as it's "cooldown."

Now this system is very simple but visually it will be very linear, with a simple growth and decay. I wanted to try to create a more exponential system that would mean the bar would jump quickly to the middle then remain and hover near the top / hot bit of the bar for a long period to create a sense of anticipation just before it overheats.

What would be a good formula to achieve that result?

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:
One Giant Shader VS Many Small Shaders I am building forward rendering engine combined with atlas shadow map technique.

My goal is to build an engine that is capable of rendering similar scenes from games such as..
Doom

Overwatch

So I wonder, do I need to write one giant shader that does all? or do I have many different shaders for each different materials?

sentences:
Finding relative x and y value on a sprite [Gamemaker] I'm having a little conundrum that may just result from a lack of knowledge of Gamemaker's functionality. I've attached two images to aid explanation.

I have a sprite of a turret (with a gun barrel), attached to a turret object, and at certain points in gameplay this object will spawn another object on top of it (let's call it the 'bullet object').

I would like the bullet object to spawn at the x and y coordinates at the end of the gun barrel. This would be easy to find as a pair of coordinates if the sprite was always stationary, in this configuration. Alas, it is not. It rotates like billy-oh. This means that the x and y coordinates at the end of the gun barrel are constantly different.

How do I find this constantly changing x and y coordinate? I imagine (though am most likely wrong) that there the initial x and y coordinates of the sprite are saved and can be found even if rotated; is there a function that does this? Or do I need to write a script and then call it every time I want to spawn the bullet object?

Thanks for your help.

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:
Performance of static const variable in shader I am using static const variables based on uniform variables. For example:

uniform uint uSampleCount;

static const float invSampleCount = 1.0 / float(uSampleCount);

Is this static recalculated for every vertex and fragment, or are shader frameworks smart enough to initialize this once before the shader starts processing? Does using or not using static and/or const make a difference?

sentences:
Polygon count target range for MMO being released in 2 years What would a realistic poly count target range be for NPC and player models in a 3D MMO that will be released in 2 years? What about poly count target range for the entire camera view (environment, NPC and player meshes)?

I read in some places that one should not aim too low if the game will come out in a couple years because technology is always advancing. If you can give some mesh poly stats on what other current MMOs / MMORPGs are running and future projections, that would be great.

Thank you.

sentences:
Making a box character in UE4, not a capsule I want to make a character for a Breakout game that is a kind of cube.

From the instructions from Unreal it appears I need to create a 'Character' blueprint. But when i do this, it comes with CapsuleComponent (Inherited) and I can't change the shape/mesh.

I could perhaps turn off collision on the capsule, but is that really the way it has to be. The capsule is annoying and not needed in this case. I just want a block that I can move left to right with A and D key.

Am I approaching this wrong completely? Do I need a 'Character' blueprint in order to make such a controllable Paddle for Breakout game?

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:
Tile map creation, problem with position of tiles I am trying to create a basic tile map script to learn Unity and I am unable to understand why my tiles are spaced far apart and I can't seem to control their spacing.

Moreover, there seems to be a difference between tile map size and Unity sizes, how do I convert tile map size to Unity size?

My understanding of tile maps are limited but here is what I want to do. I want to be able to set tile size, amount of tiles displayed and the spacing between each tiles.

Image: http://puu.sh/in6XW/416f8971bc.png

 public static int TILE_WIDTH = 32;
 public static int TILE_HEIGHT = 32;

 public float tileSize = 0.1f;
 private Transform[,] tiles;

 void Start () {
     var w = 18; // width
     var h = 15;  // height
     tilePrefab.gameObject.GetComponent<SpriteRenderer>();
     tiles = new Transform[w,h];

     for (int y = 0; y < h; y++)
     {
         for (int x = 0; x < w; x++)
         {
             Transform tile = Instantiate(tilePrefab, new Vector3(x* tileSize,y * tileSize,0),Quaternion.identity)as Transform;
             tile.parent = transform;
             tiles[x,y] = tile;
         }
     }

sentences:
Can I use different Tile/Sprite Sizes on the same Tilemap? My partner and I are creating a 2D RPG with D&D elements with Unity.

I am very new to Unity and making games in general, apart from 2 games which I created with Java and the rougelike tutorial which I did with Unity. For this university project we have 4 months and my partner has the job creating tiles, sprites, sound and music. I will program the game.

My question is:

Can we create 32x32 tiles and 64x64 sprites in the same tilemap or does everything need to be the same size?

If we can combine them, will a 64x64 sprite on a 32x32 tilemap take 4 tiles, or can we scale it down to one tile?

sentences:
Calculating a RPG character's wages based off their attributes? I am programming a Mafia RPG where you can hire people with attributes. The attributes are the same for everyone, and are ranked from 1 to 10 (although this might change to 1 to 20)
I want to keep the attributes simple, no more than 6 skills.
The attributes could be anything, but lets say there are examples.

Driving: 1/10
Stealth: 1/10
Robbery: 1/10
Brains: 1/10
Toughness: 1/10
Greed: 1/10

Greed is meant to be a modifier, the higher the number the more greedier they are.  I'd like to use this for wages
The problem I have is, I am not sure how I should calculate a goons wages.
I don't just want to randomly pick a number; its needs to be reflective of the person's attributes.
At first I thought if they all go up to 10 or 20, I could use an average, with greed being a multiplier.  But this does not feel right.
The other idea I have is bands; so that if each attribute score is between X and Y the goon could get Z wages (which are then totalled up) with greed being a modifier; but this feels very dry.
Ideally, I would like the wages to be reflective of their attribute, and most importantly reflect how greedy they are but at the same time not make the wages unrealistic or spiral into very high figures.
I'm thinking the wages should be from $100 /wk up to $5,000 or $10,000 /wk but would welcome suggestions.
What would be the best way to calculate a RPG character's wages based off their attributes?
Many thanks

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:
Is UI anti-aliasing broken in Unity 5.6? I have a project that was started in Unity 5.5. When I open it in 5.6, most 2D graphics look like they're not anti-aliased: left is 5.6, right is 5.5

What you see there are UI Images in a Canvas. The weird thing is that the red cross image looks OK, but the card with the red outline doesn't.

I've tried setting mipmaps to true, and Anti-aliasing set to 8x or 4x, with no difference. I hoped this was only in the editor, but a build shows the same jaggies.

Has some setting changed in 5.6 that I can edit so my graphics look anti-aliased again, or is this a bug?

sentences:
Hide original video file in XNA game I want to play some videos in my XNA game. I have looked at this tutorial. I have tried it. It creates XNB file but also copies original WMV file into output content directory.

Is there some simple solution, how can I pack/hide original WMV file? I don't want user get it.

Thanks for any help.

sentences:
Dijkstra's algorithm null hypothesis pathfinding without navmesh I am having trouble understanding how to implement dijkstra's algorithm for a path finding assignment, here's what the layout looks like:

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

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

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

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:
VAO and VBO connection and granularity with multiple objects How general should vertex array objects be?

I'd like to plan ahead and avoid a major revision down the road. I'm having a hard time wrapping my head around a few (possibly conflicting) pieces of wisdom scattered around the internet.

This answer on VAO best practices: for each batch: generate VAOs and bind buffers
Another describes one should share VAOs with multiple objects
Khronos OpenGL Vertex specification just providing general useful information

This is what I could gather from a half a year of slowly reading specs and docs, building and abstracting away a somewhat structured piece of a game engine.

The more state changes the slower the execution (self evident)
VAO holds state for draw calls (for a simple bind -> draw)
VBOs are bound to a VAO using the attribute location from a shader program (glGetAttribLocation -> glVertexAttribPointer)
These arrays are enabled by location using glEnableVertexAttribArray

So for a single VAO, how many or what kinds of objects should it take care of? Should a single VBO contain many objects' e.g. normals and the program use offsets when drawing, or is having separate VBOs for each a viable option?

Also, since we enable the attribute array by location inside the shader program, are the VAO and the shader in some way connected?

Any pointers would be greatly appreciated!

sentences:
Drawing a one pixel wide line in 3D space I'd like to draw a line in 3D space that is always exactly one pixel wide on screen, no matter how far away from the camera it is. (And the same for single points too).

Any hints on how I could do that?

sentences:
How to decide how much to charge for development? So two other friends and I are a very small game dev studio. So far we haven't released a game but we have 2 games almost ready to launch. A bigger studio saw our work and now they want to work with us; they need people to develop mobile games for them (iOS, Android).

They want us to set the price for the projects (can't tell the specifics we signed a NDA). They will give us all the assets (graphics/sound) so we only have to code. And because they only work with Unity3D we have to learn it.

How do we decide how much to charge for the projects?

sentences:
Unity - Touch Input help needed I'm just starting to learn Unity and I must admit at the moment im struggling linking my code scripts together. Im used to having a main class to work from.

I have been trying to implement virtual touch joysticks. I have the following code and it does control the player, but it is just moving a rigidbody.

What I want is to make this virtual joystick give out a relevant X,Y vector2 so that I can access it in another class, specifically for this case I am trying to use it with the prefab Car from the Standard Assets pack. All I am trying to do for now is if up is held, accelerate the car.

The car prefab code is not altered so far. And therefore it works if I use keyboard, but if I build for Android the touch joysticks respond to touch but I cant get the car to move.

Here is the joystick code im using:

using UnityEngine;
using System.Collections;

[RequireComponent(typeof(Rigidbody))]

public class PlayerMoveController : MonoBehaviour {

// PUBLIC
public SimpleTouchController leftController;
public SimpleTouchController rightController;
public float speedMovements = 5f;
public float speedContinuousLook = 100f;
public float speedProgressiveLook = 3000f;
public bool continuousRightController = true;

// PRIVATE
private Rigidbody _rigidbody;
private Vector3 localEulRot;
private Vector2 prevRightTouchPos;

void Awake()
{
    _rigidbody = GetComponent<Rigidbody>();
    rightController.TouchEvent += RightController_TouchEvent;
    rightController.TouchStateEvent += RightController_TouchStateEvent;
}

public bool ContinuousRightController
{
    set{continuousRightController = value;}
}

void RightController_TouchStateEvent (bool touchPresent)
{
    if(!continuousRightController)
    {
        prevRightTouchPos = Vector2.zero;
    }
}

void RightController_TouchEvent (Vector2 value)
{
    if(!continuousRightController)
    {
        Vector2 deltaValues = value - prevRightTouchPos;
        prevRightTouchPos = value;

        transform.localEulerAngles = new Vector3(transform.localEulerAngles.x - deltaValues.y * Time.deltaTime * speedProgressiveLook,
            transform.localEulerAngles.y + deltaValues.x * Time.deltaTime * speedProgressiveLook,
            0f);
    }
}

void Update()
{
    // move
    _rigidbody.MovePosition(transform.position + (transform.forward * leftController.GetTouchPosition.y * Time.deltaTime * speedMovements) +
        (transform.right * leftController.GetTouchPosition.x * Time.deltaTime * speedMovements) );

    if(continuousRightController)
    {
        transform.localEulerAngles = new Vector3(transform.localEulerAngles.x - rightController.GetTouchPosition.y * Time.deltaTime * speedContinuousLook,
            transform.localEulerAngles.y + rightController.GetTouchPosition.x * Time.deltaTime * speedContinuousLook,
            0f);
    }
}

void OnDestroy()
{
    rightController.TouchEvent -= RightController_TouchEvent;
    rightController.TouchStateEvent -= RightController_TouchStateEvent;
}

}

Again, the question is how do I get a public variable Vector2 of the X and Y movement of the joystick, instead of directly moving the rigid body from inside this code.

Thanks for any help.

EDIT: The rigidbody is just in a primitive sphere for my testing purpose, it has nothing to do with the car prefab. I want to change the sphere for a car prefab and using the XY Vector I was talking about above alter the car controller code to take those values and accelerate, brake etc.

sentences:
Game testing solutions? I have a unity web browser game. Since I'm working on a small company with limited machines which are all of either 2GB RAM or 4 GB RAM with decent processors. I'd like to know if there are any web based or software 'solutions' to test the game with low configuration both hardware and network bandwidth.

And, I have tried cross-browser testing solutions, But I didn't see any solution with the option of testing a browser game made for the unity web player .

sentences:
Bilinear filter in repeating texture, HLSL I have a repeating texture that I'm using as a scroll surface.  The idea is that as I pan the surface I adjust the texture coordinates, filling in what gets wrapped on the right as it disappears from the left.  This is all working quite well.

When bilinear filtering is switched on (D3DTEXF_LINEAR) I think the repeat filters the edge of the texture with the corresponding pixels on the other side given the wrap.  This is wrong of course.

I've had a look around for bilinear filtering shaders that ignore edge texels but can't seem to find anything.  Does anyone have an ideas about how to do this?  Is there a way of configuring a sampler to ignore edge texels when filtering?  Is there a bilinear filtering shader knocking around I can use as a reference?

sentences:
How to check Early Z efficiency on AMD GPU with Windows 7 I have a game using DirectX 9, and a development station using Win 7 x64. I am still able to get access to another station with Vista x64 / dual booted with WinXP x86.

I wanted to check early Z efficiency in the game and to my sadness all tools I have tried seem to be unable to perform this task:

AMD PerfStudio

AMD GPUPerfStudio 2 does not support DirectX 9 at all
AMD GPUPerfStudio 1.2 does not install correctly on Windows 7. When I have tweaked the MSI package (a simple OS version check adjustment was needed), it complained the drivers I have do not provide needed instrumentation. The drivers old enough to support the GPUPerfStudio would most likely not be able to operate with my Radeon 5750 card (though this is something I am not 100 % sure, I did not attempt to try any older drivers, not knowing which I should look for)

PIX

PIX does not seem to contain any counters like this. It offers some ATI specific counters, but when I try to activate them, the PIX reports "PIX encountered a problem while attaching to the target program."

I do not want to upgrade to DX 10/11 just to be able to profile the game, but it seems without the step I am somewhat locked with a toolset which is no longer supported.

I see only one obvious options which would probably work, and that is using WinXP (or with a little bit of luck even Vista) station, perhaps with some older AMD card, to make sure GPUPerfStudio 1.2 works.

Other than that, can anyone recommend other options how to check GPU HW counters (HiZ / EarlyZ in particular, but if others would be enabled as well, it would be a nice bonus) for a DirectX 9 game on Windows 7, preferably on AMD GPU? (If that is not possible, I would definitely prefer switching GPU to switching the OS, but before I do so I would like to know if I will not hit the same problem with nVidia again)

sentences:
Unreal Engine 4.25.4 - CreateDefaultSubobject inside a child component attached to an actor loses values in blueprint editor I have the following actor:
UCLASS()
class X_API AMoveableRigidBodyActor : public AActor
{
    GENERATED_BODY()

public:

    // Sets default values for this actor's properties
    AMoveableRigidBodyActor();

public:

    UPROPERTY(BlueprintReadOnly, EditAnywhere, Category = "Custom")
        USceneComponent* SceneComponent;

    UPROPERTY(BlueprintReadOnly, EditAnywhere, Category = "Custom")
        UMoveableRigidBodyComponent* MoveableRigidBodyComponent;

};

This Actor makes a reference to a UMoveableRigidBodyComponent and a USceneComponent which I run CreateDefaultSubobject on and attach in the following fashion in the constructor:
AMoveableRigidBodyActor::AMoveableRigidBodyActor()
{

    SceneComponent = CreateDefaultSubobject<USceneComponent>(FName("AMoveableRigidBodyActor_SceneComponent"));
    SetRootComponent(SceneComponent);

    MoveableRigidBodyComponent = CreateDefaultSubobject<UMoveableRigidBodyComponent>(FName("AMoveableRigidBodyActor_MoveableRigidBodyComponent"));
    MoveableRigidBodyComponent->SetupAttachment(SceneComponent);

}

So far, so good.
Now inside my UMoveableRigidBodyComponent I instantiate a few components that are relevant to that component. I expect these components to be visible and manageable from within my blueprint:
UCLASS()
class X_API UMoveableRigidBodyComponent : public USceneComponent
{
    GENERATED_BODY()

public:

    // Sets default values for this component's properties
    UMoveableRigidBodyComponent();

override;

    UPROPERTY(BlueprintReadOnly, EditAnywhere, Category = "Custom")
        USceneComponent* SceneComponent;

    UPROPERTY(BlueprintReadWrite, EditAnywhere, Category = "Custom")
        UStaticMeshComponent* StaticMeshComponent;

};

Here I use CreateDefaultsuboject to attach everything to this component:
UMoveableRigidBodyComponent::UMoveableRigidBodyComponent()
{
    SceneComponent = CreateDefaultSubobject<USceneComponent>(FName("UMoveableRigidBodyComponent_SceneComponent"));
    SceneComponent->SetupAttachment(this);

    StaticMeshComponent = CreateDefaultSubobject<UStaticMeshComponent>(FName("UMoveableRigidBodyComponent_StaticMeshComponent"));
    StaticMeshComponent->SetupAttachment(SceneComponent);
}

So, all of this feels pretty normal so far. So I go into my editor, create a blueprint that's based off of the AMoveableRigidBodyActor and I assign a static mesh to my component:

Still good. But then I hit the compile button:

The selected static mesh has now vanished from the editor but still seems to be filling the value correctly.
Furthermore, if I put this into the game world you can see that the static mesh sure enough isn't there in the instance:

What am I misunderstanding here?

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:
What's the best practice to use the pbo to upload multi textures? I have a basic model to upload textures as shown in the following picture.

I design this for several reasons:

Only the primary thread owns the OpenGL context, so I choose to create buffers, map buffers and unmap buffers in the primary thread.
I have many pictures to load and I don't want them to block the primary thread, so I use the subthread to load images and copy the memory.

Here are my questions:

Is my model correct?
Is my model the best practice?
Should I create a PBO for each picture or create two PBO for all pictures and use them in turn?
Should I use a shared context?

Thank you for helping me out

sentences:
Applying Transformation Matrices to VBOs in OpenGL So I've recently tried to add Vertex Buffer Object Matrix transformation to an OpenGL engine I'm working on. I could go about this by applying the matrix to a copy of each vertex individually, but this would take a lot of CPU resources, so I am trying to implement transformation natively using OpenGL. This code works:

    /// <summary>
    /// Sets up the required OpenGL settings so as to create the necessary environment for the models to work (must be called on a thread on which an OpenGL context is set up, preferably on the thread on which the model was loaded).
    /// </summary>
    public static void Setup(Size viewPort, ref Matrix4 camera) {
        GL.MatrixMode(MatrixMode.Projection);
        GL.PushMatrix();
        if (!(viewPort.Width == 0 || viewPort.Height == 0)) {
            Matrix4 matrix;
            Matrix4.CreatePerspectiveFieldOfView(MathHelper.PiOver3F, (float) viewPort.Width / viewPort.Height, 0.01F, long.MaxValue, out matrix);
            GL.LoadMatrix(ref matrix);
        }
        GL.MatrixMode(MatrixMode.Modelview);
        GL.PushMatrix();
        Camera = camera;
        GL.LoadMatrix(ref Camera);
        GL.Enable(EnableCap.DepthTest);
        GL.Enable(EnableCap.Lighting);
    }

    /// <summary>
    /// Renders the model (must be called on a thread on which an OpenGL context is set up, preferably on the thread on which the model was loaded).
    /// </summary>
    public override void Render() {
        if (IsVisible) {
            /*Matrix4 matrix = Matrix4.CreateTranslation(location);
            GL.MultMatrix(ref matrix);*/
            if (Cull)
                GL.Enable(EnableCap.CullFace);
            else
                GL.Disable(EnableCap.CullFace);
            texture.Bind();
            if (DataBuffer == 0) {
                GL.GenBuffers(1, out DataBuffer);
                GL.BindBuffer(BufferTarget.ArrayBuffer, DataBuffer);
                GL.BufferData<Vertex>(BufferTarget.ArrayBuffer, BufferSize, BufferData, Optimization);
            } else {
                GL.BindBuffer(BufferTarget.ArrayBuffer, DataBuffer);
                if (UpdateFrame) {
                    GL.BufferData<Vertex>(BufferTarget.ArrayBuffer, BufferSize, BufferData, Optimization);
                    UpdateFrame = false;
                }
            }
            IndexBuffer.Bind();
            GL.VertexPointer(3, VertexPointerType.Float, Vertex.SizeOfVertex, IntPtr.Zero);
            GL.TexCoordPointer(2, TexCoordPointerType.Float, Vertex.SizeOfVertex, TexturePointer);
            GL.NormalPointer(NormalPointerType.Float, Vertex.SizeOfVertex, NormalPointer);
            GL.DrawElements(BeginMode.Triangles, IndexBuffer.Count, IndexBuffer.Format, IntPtr.Zero);
            GL.Disable(EnableCap.CullFace);
            //GL.LoadMatrix(ref Camera);
        }
    }

    /// <summary>
    /// Resets the OpenGL settings set by calling Setup().
    /// </summary>
    public static void Reset() {
        GL.PopMatrix();
        GL.MatrixMode(MatrixMode.Projection);
        GL.PopMatrix();
    }

First Setup() is called to set up the projection matrix, then several meshes are rendered using the Render() method, then Reset() is called at the end to restore the matrices before I swap the buffers to the window.

However, when I comment out the commented lines in order to apply a simple translation matrix, I only get flickers all over the window. I tried using GL.Push() and GL.Pop() at the beginning and end of the Render() method, but to no avail. I also tried using GL.LoadIdentity() first and GL.MatrixMode(MatrixMode.Projection), but still no success.

Can anyone be kind enough to point out the mistake in my code please?

sentences:
How do I remove control points from imported curve in Maya? When I create a path from an Illustrator file, it adds extra control points for bezier handles for each point in the AI file, even though I don't drag out the handles in Illustrator.  All my points in the AI file are hard edges.

I can clean this up by using the merge vertex tool, but that takes a long time on each model.  Is there a way I can:

Select all the control points at once and delete the extra curve handle points
OR
Import without the extra handle points and have only a flat polygon.

I'm importing the path as curves, because when I import as bevel it adds lots of extra geometry.  I'm new to Maya, but have taken several lessons, so please be gentle.

sentences:
How can I get OnMouseEnter to trigger on a 3D Text in Unity3D? I've just started to learn Unity3D.

I want to create a simple 3D menu with just two 3D Text instances.
I've created and named them, then dropped this script:

function Awake(){
    print("MenuItem "+gameObject.name+" init!");
}
function OnMouseEnter(){
    print("OnMouseEnter " + gameObject.name);
}
function OnMouseDown(){
    print("OnMouseDown " + gameObject.name);
}

I only see the init/awake message printed in the console.

What am I missing ?

EDIT:

Sorry, I forgot to add the BoxCollider(Physics>Box Collider) to my object, so no events were triggered.

sentences:
How to clear the content of a Rendertexture? I want to clear the content of a RenderTexture in runtime.

Basically I have this script:

   void OnRenderImage(RenderTexture source, RenderTexture destination)
    {
        RenderTexture TempRT = new RenderTexture(cam.pixelWidth, cam.pixelHeight, 24);
        RenderTexture whiteRT = new RenderTexture(TempRT.width, TempRT.height, TempRT.depth);

        Graphics.Blit(source, whiteRT, WhiteColorisation);
        if (Gauss)
        {
            Graphics.Blit(whiteRT, TempRT, PostOutline);
            Graphics.Blit(TempRT, destination, GaussianBlur);
        }
        else
        {
            Graphics.Blit(whiteRT, destination, PostOutline);
        }
    }

the problem here is: The 2 newly created Rendertextures' Memory is not released anymore.

So I changed it like:

void OnRenderImage(RenderTexture source, RenderTexture destination)
{
    RenderTexture _tempRT = RenderTexture.GetTemporary(cam.pixelWidth, cam.pixelHeight);
    RenderTexture _whiteRT = RenderTexture.GetTemporary(cam.pixelWidth, cam.pixelHeight);

    Graphics.Blit(source, _whiteRT, WhiteColorisation);
    if (Gauss)
    {
        Graphics.Blit(_whiteRT, _tempRT, PostOutline);
        Graphics.Blit(_tempRT, destination, GaussianBlur);
    }
    else
    {
        Graphics.Blit(_whiteRT, destination, PostOutline);
    }

    RenderTexture.ReleaseTemporary(_whiteRT);
    RenderTexture.ReleaseTemporary(_tempRT);
}

Now I dont get "new" Rendertextures anymore, but used ones.
It just draws something over a existing Texture, instead over a new "white" page.

The only thing i want is... that "_whiteRT" and "_tempRT" to be "new" ones, and the memory free.

The Obvious solution does not work:

void OnRenderImage(RenderTexture source, RenderTexture destination)
{
    RenderTexture tempRT = new RenderTexture(cam.pixelWidth, cam.pixelHeight, 16);
    RenderTexture whiteRT = new RenderTexture(cam.pixelWidth, cam.pixelHeight, 16);

    Graphics.Blit(source, whiteRT, WhiteColorisation);
    if (Gauss)
    {
        Graphics.Blit(whiteRT, tempRT, PostOutline);
        Graphics.Blit(tempRT, destination, GaussianBlur);
    }
    else
    {
        Graphics.Blit(whiteRT, destination, PostOutline);
    }
    tempRT.Release();
    whiteRT.Release();
}

If I use the code above, in the profiler my object count rises and rises (until i get a crash)

How can I solve this problem?

sentences:
unity & c# - File.ReadAllLines() vs TextAsset Split('\n') I switched from one approach to the other in my code and I noticed that File.ReadAllLines() has a string length of equal to the alpha-numeric chars in the string, with exception of the last line of the file. I assume that is eol. String.Split('\n') however will result in that extra char for every string in the array, and so only matches ReadAllLines() on the final string. Am I write in assuming its an end of line character that's introduced on every string in the split version? How can I trim these? I don't know of any eol in the special chars. I tried to trim \n and \r but it didn't change the line lengths

--- further clarification as to why I put it here instead of stackoverflow

I am not familiar enough with the workings to be sure. I thought perhaps the results might be due to unity. The File.ReadAllLines() version works on the path to the txt file, the string.Split() version works on the TextAsset.text and the TextAsset is passed through the inspector as reference.

Sorry if I made the wrong decision in posting here!

sentences:
Unity3d webplayer failed to download data file When testing my game web builds on localhost, I get the error "Failed to download data file". The game data file is correctly placed, and the page loads fine, it just wont download the plugin, or prompt me to do so.

I tried the following things:
Add MIME Types to IIS 7.5:

Open IIS Manager
Double click "MIME Types" in the IIS section.
Click Add on the right side "Actions" menu.
File name extension: = .unity3d
MIME type: application/unity3d
click ok
Restart the server (right side "Actions" menu)

That didn't work for me specifically because it turned out I was using IIS Express, so I did the following:

If Windows 7, browse to 'C:\Users\\Documents\IISExpress\config\' and open the file: ApplicationHost.config.

Search for 'staticContent' and add the following before the closing tag:

However, again, it didn't work..

sentences:
Viewing one of multiple worlds in a component entity system? I've been working on a space simulation game.  The player can control a ship and fly through wormholes to get from one solar system to another.  I would like the player to be able to switch the camera view between the different solar systems they own something in (world, factories, defenses, etc).

If am using just one component entity world then how do I tell the rendering system that looks for sprite components to only draw the sprite components of one solar system?

I could add a "solar system id" field to each sprite component and have the rendering system check each component before rendering to make sure it's in the "active" solar system.  It doesn't seem like a good idea though.  Mostly because I'd be adding another if case before processing every single sprite, at the very least (other components may need similar checks).

I could have the rendering system maintain an internal map of which solar system contains which entities, but then I have to write entity systems that keep track of all the entities, which is my entity system framework's job (Artemis for Java).

Currently I am planning on making all of the solar systems separate from each other.  They wouldn't exist in the same coordinate system.  I suppose I could instead put everything on the same coordinate system and just move the camera around based on which solar system the player wanted to view at that time.  The problem with that would be that my sprite rendering system would still be looping through all the sprites in the game, instead of just the ones at the active solar system.

So, for lack of better options, I'm leaning toward using multiple component entity worlds.  So each solar system would get its own set of systems (including the rendering system), and I'd set which one was active to enable the rendering systems for that solar system.

I didn't want to take this approach for two reasons.  First, it adds another layer of complexity on top of everything.  Second, it seems like it might lessen some of the performance benefits (caching) of looping through all the same types of components and running the same entity system algorithm.  Instead of doing a breadth-first loop through all the components it would be more of a depth-first loop through all the systems' components.

So what is the best way to handle this?

sentences:
How to determine what hexes are in an area bounded by 3 hexes I've been searching for hex grid algorithms for a while now, but I'm not having much luck.

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

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

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

Thanks

sentences:
Emulate border color texture address mode efficiently In WinRT the border color texture address mode is not supported.

The best I came up with in emulating the border address mode, is doing this in my pixel shader:

float4 tcol = tex.Sample(texSampler, texCoord);

if(texCoord.x < 0 || texCoord.y < 0 || texCoord.x > 1 || texCoord.y > 1)
  tcol = borderColor;

But as only ps_4_0_level_9_1 is supported as minimum requirement in WinRT, this conditional in the pixel shader is quite inefficient.

How would I emulate border texture addressing mode efficiently?

sentences: How can I implement a global high score ladder? Are there any existing frameworks I can build on?  Should I build my own?  How can I prevent fake scores from being posted to it?

sentences:
What algorithm should I use to laid out pre-made rooms into a level? I want to have a semi-procedural level, where rooms are pre-made but the way they're connected are proc-gen. The connections need to really exist - you can walk between rooms in hallways - not just teleported between rooms like in old games.

Each map will have a set number of rooms. Rooms should be laid into a grid(not necessary fill it) - all rooms and hallways will have the same size. Every room must lead to the exit(no dead end), except for 0 to 2 "secret room"

There can be 1 to 3 paths from start to finish; these paths may intersect. They should be relatively straight(no 180 turn or more).

There can a few rare "secret room" that are dead-end, but can only be one room depth:

              +-----+                                +-----+
              |     |                                |     |
              | End |                                | End |
              +-----+                                +-----+
                | |                                    | |
   +------+   +-----+          +------+   +------+   +-----+
   |      +---+     |          |      +---+      +---+     |
   | This +---+     |          | Not  +---+ This +---+     |
   +------+   +-----+          +------+   +------+   +-----+
                | |                                    | |
              +-----+                                +-----+
              |     |                                |     |
              |Start|                                |Start|
              +-----+                                +-----+

Is there a popular algorithm can I use to accomplish this?

One that was recommended by some people here is BSP Tree. It doesn't fit my requirement since the path it creates is too spiral, and depend on the number of corridors, it either creates too much path or too many dead-end.

The only thing I can come up with is to just add rooms one after another in random directions. There are 2 problems I can see and don't know how to solve:

How to create multiple natural paths(not just an L shape or straight line) that end up at the same location.
How to make sure the path doesn't become a spiral and block it self from advance further

Edit: I found this that that kinda resembles the structure I need, but with diagonal hallway.

sentences:
Detecting which side of the collider is hit We are trying to determine which side of the collider is hit in order to let the colliding object pass through or land on the other object.

Our previous failed attempts included detecting object velocity and changes on Y axis in our 3D game with locked Z axis (simulated 2D).

Currently, the detection is working by calculating the velocity - when the "Object in motion" hits the top of the black cube ("trigger collider") by the  certain level of velocity (determined by gravity) the "collider" is activated. Otherwise, when the velocity is higher - the "object in motion" passes through. This, of course introduced a lot of issues and the solution itself is not elegant.

In the other scenario, we have tried adding trigger colliders around the "static object". This also complicates the process when "object in motion" has an arc when landing. Likewise, this solution is hard to maintain and prone to bugs.

On top of that, we implemented Raycasting. But we are not getting consistant "Top" and "Bottom" trigger indications when using it. Here is the gist of that code.

 void OnCollisionEnter(Collision collision)
 {
     if (collision.gameObject.tag.Equals("my_cube"))
     {
         var hit = HitDirection();
         Debug.Log(hit);
     }
 }

 bool IsRightOrLeftHit()
 {
     RaycastHit hit;

     Ray rayUp = new Ray(transform.position, Vector3.up);
     Ray rayDown = new Ray(transform.position, Vector3.down);

     Physics.Raycast(rayUp, out hit);
     Physics.Raycast(rayDown, out hit);

     return hit;
 }

We would appreciate any hint or help, and please ask me any questions if the explanations are not clear enough.

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

sentences:
Android black screen with Unity app in subview I've exported an Unity app/game I have made to Android Studio. In Android Studio I made a layout and within it I have a framelayout. However, when I run the app the framelayout is completely black, why?

Here is my Java code:

public class UnityPlayerActivity extends Activity {
    protected UnityPlayer mUnityPlayer; // don't change the name of this variable; referenced from native code

    FrameLayout fl_forUnity;

    Button bt_groen, bt_gul, bt_sort;

    @Override
    protected void onCreate(Bundle savedInstanceState) {
        requestWindowFeature(Window.FEATURE_NO_TITLE);
        super.onCreate(savedInstanceState);

        getWindow().setFormat(PixelFormat.RGBX_8888);

        mUnityPlayer = new UnityPlayer(this);
        if (mUnityPlayer.getSettings().getBoolean("hide_status_bar", true)) {
            setTheme(android.R.style.Theme_NoTitleBar_Fullscreen);
            getWindow().setFlags(WindowManager.LayoutParams.FLAG_FULLSCREEN,
                    WindowManager.LayoutParams.FLAG_FULLSCREEN);
        }

        setContentView(R.layout.main);

        this.fl_forUnity = (FrameLayout) findViewById(R.id.fl_forUnity);

        this.fl_forUnity.addView(mUnityPlayer.getView(),
                FrameLayout.LayoutParams.MATCH_PARENT, FrameLayout.LayoutParams.MATCH_PARENT);

        this.bt_groen = (Button) findViewById(R.id.bt_groen);
        this.bt_gul = (Button) findViewById(R.id.bt_gul);
        this.bt_sort = (Button) findViewById(R.id.bt_sort);

        this.bt_groen.setOnClickListener(new View.OnClickListener() {
            @Override
            public void onClick(View v) {
                UnityPlayer.UnitySendMessage("Main Camera", "ReceiveRotDir", "G");
            }
        });

        this.bt_gul.setOnClickListener(new View.OnClickListener() {
            @Override
            public void onClick(View v) {
                UnityPlayer.UnitySendMessage("Main Camera", "ReceiveRotDir", "Y");
            }
        });

        this.bt_sort.setOnClickListener(new View.OnClickListener() {
            @Override
            public void onClick(View v) {
                UnityPlayer.UnitySendMessage("Main Camera", "ReceiveRotDir", "B");
            }
        });

        mUnityPlayer.requestFocus();
    }
}

Here is my XML:

<?xml version="1.0" encoding="utf-8"?>
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
                android:layout_width="match_parent" android:layout_height="match_parent"
                android:rowCount="3"
                android:columnCount="10">

    <FrameLayout
        android:layout_width="match_parent"
        android:layout_height="400dip"
        android:id="@+id/fl_forUnity"
        android:background="#00FFFF"
        android:layout_centerHorizontal="true">

    </FrameLayout>

    <Button
        android:layout_width="wrap_content"
        android:layout_height="wrap_content"
        android:text="Grøn"
        android:id="@+id/bt_groen"
        android:layout_column="4"
        android:layout_row="2"
        android:layout_alignTop="@+id/bt_sort"
        android:layout_toRightOf="@+id/bt_sort"
        android:layout_toEndOf="@+id/bt_sort"
        android:layout_marginLeft="30dp" />

    <Button
        android:layout_width="wrap_content"
        android:layout_height="wrap_content"
        android:text="Gul"
        android:id="@+id/bt_gul"
        android:layout_column="9"
        android:layout_row="2"
        android:layout_alignTop="@+id/bt_sort"
        android:layout_toLeftOf="@+id/bt_sort"
        android:layout_toStartOf="@+id/bt_sort"
        android:layout_marginRight="30dp" />

    <Button
        android:layout_width="wrap_content"
        android:layout_height="wrap_content"
        android:text="Sort"
        android:id="@+id/bt_sort"
        android:layout_below="@+id/fl_forUnity"
        android:layout_centerHorizontal="true"
        android:layout_margin="10dip" />

</RelativeLayout>

sentences:
XNA - Offscreen Vertices Optimization Okay, I have a set of vertices that is around 10,000,000 (it's a long story, but it seems that it is needed), however only a few thousand of those will be onscreen at a time. It's currently setup as one vertex buffer (and it's one shape anyway) so the normal view frustum culling solution would not seem to be applicable here.

Is there any way of making it only drawing those few thousand verticies needed onscreen at one time?

Thank you!

sentences:
Has the Geometry Shader been abandonded? Advice says to either limit use or not to use it at all.

Friday Facts #251 - A Fistful of Frames | Factorio:

We tried it, and it worked great. We got some speedup due CPU needing to prepare less data, but when doing research how different APIs work with geometry shaders, we found out that Metal (and therefore MoltenVK) on macOS doesn’t support geometry shaders at all. After more digging, we found an article called Why Geometry Shaders Are Slow. So we tested using the geometry shader on a range of PCs in the office, and found that while it was faster on PCs with new graphics cards, the older machines took a noticeable performance hit. Due to the lack of support on macOS and the possible slowdown on slower machines, we decided to drop the idea.

Geometry Shader Debugger · Issue #2110 · baldurk/renderdoc · GitHub:

Geometry shaders are inefficient especially when expansion is used like that and that's the case that GPU vendors explicitly recommend against.

I just wanted to let you know that geometry shaders have been virtually abandoned, since with them still being in the API not everyone is aware of that.

GPU Programming Guide - GeForce 8 and 9 Series (Chapter 4):

But in general, the potential for wasted work and performance penalties for using a GS makes it an often unused feature of Shader model 4.

OpenGL - geometry shaders

Can someone give me a list of geometry shader usages? : gamedev

Geometry shaders can be used for Level-of-Detail subdivision of geometry, and people did expect to be able to use them for that. But AFAIK it turned out that their performance in that scenario is horrible, which is why we now have tesselation shaders for that purpose.

sentences:
Subdived objects in different shapes Currently I'm working on an Android OpenGL 3D game and now I want to implement a collision detection. For this I want to use oriented bounding boxes but here is my problem. For a normal oriented bounding box I have to store the middle and then the length into every dimension. Now let's say I have a tree and of course my character can walk under the treetop but not into the tree trunk. I tried to sketch up the different bounding boxes here:

Tree as two rectangels                         Normal bounding box

-----------------------                   ------------------------------
|                     |                   |                            |
-----------------------                   |                            |
        |     |                           |                            |
        |     |                           |                            |
        |     |                           |                            |
        |     |                           |             x              |
        |     |                           |                            |
        |     |                           |                            |
        |     |                           |                            |
        |     |                           |                            |
        |     |                           |                            |
        -------                           ------------------------------

If you think about the collision detection in the first sketch you can walk under the treetop because the border of the tree is subdivided into different shapes and the outline of a tree is still visible. In the second picture you can't tell something about the outline of the object because you only have one big box around the whole object so you can't walk under the treetop. You see the first method is much better then the second method for my plan.

Now my question: Do you have any ideas how I can subdivide my objects into different shapes? Maybe even in triangles, circles and so on. Is there an algorithm  for this or do I have to do it by myself?

sentences: Help to understand positive rotation direction on left/right handed cord spaces I began to study 3D math and noticed about left/right handed cord spaces and clockwise/counterclockwise rules. I understand that left-handed use clockwise positive rotation and right-handed counterclockwise. But what i don't understand is way this rules exists, on what technical problem this decision is based or this is just an agreement and nothing more?

sentences:
Narrow-phase collision detection algorithms There are three phases of collision detection.

Broadphase: It loops between all objecs that can interact, false positives are allowed, if it would speed up the loop.
Narrowphase: Determines whether they collide, and sometimes, how, no false positives
Resolution: Resolves the collision.

The question I'm asking is about the narrowphase. There are multiple algorithms, differing in complexity and accuracy.

Hitbox intersection: This is an a-posteriori algorithm, that has the lowest complexity, but also isn't too accurate,
Color intersection: Hitbox intersection for each pixel, a-posteriori, pixel-perfect, not accuratee in regards to time, higher complexity
Separating axis theorem: This is used more often, accurate for triangles, however, a-posteriori, as it can't find the edge, when taking last frame in account, it's more stable
Linear raycasting: A-priori algorithm, useful for semi-realistic-looking physics, finds the intersection point, even more accurate than SAT, but with more complexity
Spline interpolation: A-priori, even more accurate than linear rays, even more coplexity.

There are probably many more that I've forgot about. The question is, in when is it better to use SAT, when rays, when splines, and whether there is anything better.

sentences:
Creating your own vertex element in XNA I needed to create my own VertexElement with the follow - Position, Color & Normal. I found a tutorial explaining how to do this here (http://www.riemers.net/eng/Tutorials/XNA/Csharp/Series1/Terrain_lighting.php).

I created a struct similar to the tutorial and then replaced all the declarations with the new one, but I get this error:

  There is no boxing conversion from 'VertexPositionColorNormal' to
  'Microsoft.Xna.Framework.Graphics.IVertexType'.

and I get it under the rendering line here:

graphicsDevice.DrawUserIndexedPrimitives<VertexPositionColorNormal>
(PrimitiveType.LineList, currentPlayer.LLObject.Vertices, 0,
    currentPlayer.LLObject.TotalVertices, currentPlayer.LLObject.LinelistIndexes, 0,
    currentPlayer.LLObject.TotalLinelistIndexes / 2);

I had a look on Google to see if there was any obvious answers but it's hard to search for. Could someone spread some light on what is going wrong?

sentences:
Why there is no isGrounded and Move properties for the CharacterController? using System.Collections;
using System.Collections.Generic;
using UnityEngine;

[RequireComponent(typeof(CharacterController))]

public class SC_FPSController : MonoBehaviour
{
    public float walkingSpeed = 7.5f;
    public float runningSpeed = 11.5f;
    public float jumpSpeed = 8.0f;
    public float gravity = 20.0f;
    public Camera playerCamera;
    public float lookSpeed = 2.0f;
    public float lookXLimit = 45.0f;

    CharacterController characterController;
    Vector3 moveDirection = Vector3.zero;
    float rotationX = 0;

    [HideInInspector]
    public bool canMove = true;

    void Start()
    {
        characterController = GetComponent<CharacterController>();

        // Lock cursor
        Cursor.lockState = CursorLockMode.Locked;
        Cursor.visible = false;
    }

    void Update()
    {
        // We are grounded, so recalculate move direction based on axes
        Vector3 forward = transform.TransformDirection(Vector3.forward);
        Vector3 right = transform.TransformDirection(Vector3.right);
        // Press Left Shift to run
        bool isRunning = Input.GetKey(KeyCode.LeftShift);
        float curSpeedX = canMove ? (isRunning ? runningSpeed : walkingSpeed) * Input.GetAxis("Vertical") : 0;
        float curSpeedY = canMove ? (isRunning ? runningSpeed : walkingSpeed) * Input.GetAxis("Horizontal") : 0;
        float movementDirectionY = moveDirection.y;
        moveDirection = (forward * curSpeedX) + (right * curSpeedY);

        if (Input.GetButton("Jump") && canMove && characterController.isGrounded)
        {
            moveDirection.y = jumpSpeed;
        }
        else
        {
            moveDirection.y = movementDirectionY;
        }

        // Apply gravity. Gravity is multiplied by deltaTime twice (once here, and once below
        // when the moveDirection is multiplied by deltaTime). This is because gravity should be applied
        // as an acceleration (ms^-2)
        if (!characterController.isGrounded)
        {
            moveDirection.y -= gravity * Time.deltaTime;
        }

        // Move the controller
        characterController.Move(moveDirection * Time.deltaTime);

        // Player and Camera rotation
        if (canMove)
        {
            rotationX += -Input.GetAxis("Mouse Y") * lookSpeed;
            rotationX = Mathf.Clamp(rotationX, -lookXLimit, lookXLimit);
            playerCamera.transform.localRotation = Quaternion.Euler(rotationX, 0, 0);
            transform.rotation *= Quaternion.Euler(0, Input.GetAxis("Mouse X") * lookSpeed, 0);
        }
    }
}

On both I'm getting the same error :'CharacterController' does not contain a definition for 'isGrounded' and no accessible extension method 'isGrounded' accepting a first argument of type 'CharacterController' could be found (are you missing a using directive or an assembly reference?)

sentences:
How do I correctly implement Java animations? Here's what I have so far.

//Inside the Animations class
public void update() {
    timer +=System.currentTimeMillis() - lastTime;
    lastTime = System.currentTimeMillis();

    if(timer>speed) {
        Playing=true;
        index++;

        timer=0;
        if(index>=frames.length) {
            index = 0;
            Playing=false;
        }
    }

}//Getters and setters down

In the main state

    @Override
public void update() {
    Ability.update();
        if(AttackP.isPlaying()) {
            AttackP.update();

        }

    //gets
    HealthCheck();
    getMousePosition();
}

...

    if(turn==true) {//Only run when it's the players turn
        if(MousePressed&&!AttackP.isPlaying()&&!AttackingP) {
//if left clicked when animations are not playing and when AttackingP is false
            buttonCheck(g);//next
        }else if(!MousePressed) {//set Attacking to false when mouse not pressed
            AttackingP=false;
        }

...

private void buttonCheck(Graphics g) {
    if(MouseX<501&&MouseX>420&&MouseY<531&&MouseY>500){//if the mouse is in this button

        AttackingP=true;
        StartAnimation(g);

        }

...

    private void StartAnimation(Graphics g) {

    g.drawImage(getCurrentAnimationFrame(),175,0,512/2,512/2, null);//play animation
    BossHealth-=5;
    turn=false;

}

public BufferedImage getCurrentAnimationFrame(){
    return AttackP.getCurrentFrame();
    }

The problem is, when I press the button, the animation only renders 1 frame, not the others in the BufferedImage array.

Help appreciated, I've been stuck on this part for 2 days now.

sentences:
"Normal" Blend Mode with OpenGL Trouble I've been having a lot of trouble trying to get a OpenGL blend function to work as I'd expect it to with like what I'd expect (or from any sensible image editing program). As an example, I'll use these two images to blend (bit difficult to see on white backgrounds so the colors are labeled):

Images to be blended

This is what I expect to happen (and what happens in paint.net):

Expected Result

Obviously opengl's default blend function makes it look like this (very wrong):

glBlendFunc(GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA)

After a ton of testing, this is the closest I could get to creating a "good" blend function:

glBlendFuncSeparate(GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA, GL_ONE, GL_ONE_MINUS_SRC_ALPHA)

Looking back at the original expected result though, you'll notice that some of the colors are a bit dimmer than they should be (the middle left part). Specifically, they are premultiplied to half their color value (because of the .5 alpha), and I can't seem to make a function that does not do this (without causing odd blending issues with the barely visible red transparent part).

Does anyone know a solution to this issue? One that I had was to use premultiplied alpha in the sources (while I dont want to do this because it requires extra work to convert every color I use in my game to premultiplied or just write some stuff in each shader) and do it like that:

glBlendFuncSeparate(GL_ONE, GL_ONE_MINUS_SRC_ALPHA, GL_ONE, GL_ONE_MINUS_SRC_ALPHA) (No premultiplication)

Obviously thats wrong too, but this is actually the only correct result I've gotten so far:

glBlendFuncSeparate(GL_ONE, GL_ONE_MINUS_SRC_ALPHA, GL_ONE, GL_ONE_MINUS_SRC_ALPHA) (Premultiplied inputs)

Only problem is, how would I get rid of the premultiplication to display it on the screen? It would probably require an additional render cycle for each thing I blend and that seems way too complex for this issue, so I'm still looking for an answer (its interesting that I cant find anything on this, because OpenGL is so widely used that I'd image someone else ran into this problem).

Sources:

Online blend function testing - http://www.andersriggelsen.dk/glblendfunc.php
Bottom Layer Image - http://i.stack.imgur.com/XjLNW.png
Top Layer Image - http://i.stack.imgur.com/9CN6w.png

sentences: Why my Edit Collider in Unity2D has no point to adjust size? Why when I clicked to Edit Collider of Box Collider 2D component, is not showing points for me resize the collide box?

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:
UDK - problem packaging/publishing the game I have set up all the config files to my game classes and am able to launch the game to test everything.

Although when I package the game, it still runs the UT deathmatch game?

What other lines in the config files should be changed to make it default to my game and default map once published/packaged?

sentences:
SFML RectangleShape won't render I have a sf::RectangleShape in my code which is defined like this :

sf::RectangleShape shape_1;

And it's values are set like this :

shape_1.setFillColor(sf::Color::White);
shape_1.setPosition(10, 10);

But when I render it like this :

    window.draw(shape_1);

It wont display in my window.

My rendering part of the code looks like this :

    window.clear();

    window.draw(*box.getSfShape());
    window.draw(*box_static.getSfShape());
    window.draw(shape_1);

    window.display();

Not sure what I'm doing wrong. Have been going on for days thinking it was a position problem with a body but since this won't render either it can't be. :P

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:
Change from Bullet/OgreAnim to Havok? I have been working on a game in Ogre for the last 6 months or so. It started as a learning project, and after a few rewrites it actually turned into a real game project. Physics scared me, and using Bullet with its lack of documentation was a nightmare, but I was able to atleast get some basics added and learned a lot. So as of now I am using Ogre with its default animation system (fairly basic) and Bullet Physics.

I had always wanted to use Havok when I started out, but due to lack of integration information on the Ogre forums, and lack of tutorials on the net, I decided against it. Now that I am actually at the point where Bullet is just too much of a headache to proceed with (staring at forum threads praying someone answers) and the Ogre animation system is so basic, I am considering switching to Havok for Physics and Animation.

The Physics system looks extremely polished and easy to use. The animation system looks incredible with the retargeting/blending/etc. The documentation is incredibly detailed as well (I guess when you come from Bullet, any documentation looks amazing)

So my question is, as I am still somewhat of a 'newbie' to game development, should I just stick with what I am using now or should I make the switch over to Havok? The physics looks like I could get my project back to where it is now with minimal effort, and be able to expand much faster. The animation aspect looks extremely daunting as far as integrating it with Ogre.

sentences: Did they remove Sprite sorting layers from Unity? I can't figure out how to set it. I thought it was a setting on the sprite renderer but it doesn't seem to be there? Google isn't turning up any results.

sentences:
Skill vs. Luck, the ratio and its measurement Gamer buddies, is there a term to describe the level of variance in a game, in comparison to luck. The card game war would have 0 skill and 1.0 luck because the player cannot affect the game. I can't think of something that has 1.0 skill. At first I thought Spelling Bee, but the words chosen for each contestant is randomly chosen suggesting some luck involved... What ratios do different games have, and how can those ratios be accurately measured? What metrics could be used to accurately measure such a ratio? I'd also like to hear of any 1.0 skill games if anyone can think of one.

To reiterate the question clearly:  does there exist such a measurement and if so what is it? Furthermore is there a term for the target of this measurement, so we can have a discussion using a noun.

EDIT: the term luck is used to describe the level of effect that chance, i.e. random events, have in affecting who the winner is. I appreciate everyone's responses.

sentences:
How can I use StringTokenizer instead of array? I'm currently redeveloping an OBJ & MTL importer for my game engine. At the moment, I'm focusing on increasing how quickly I can parse large OBJ files.

For now, I can parse about 1.2M vertices, uvs and normals in around 4-6 seconds. Which is awesome, considering the file that I'm parsing, couldn't be parsed originally.

Anyways, on with my question; I want to be able to make the following method use a StringTokenizer instead of String array. The reason is because using String.split is slow and I want to parse the file relatively fast.

private OBJIndex parseIndex(String token)
{
    String[] tokens = token.split("/");

    OBJIndex result = new OBJIndex();
    result.setVertexIndex(Integer.parseInt(tokens[0]) - 1);

    if(tokens.length > 1)
    {
        if(!tokens[1].isEmpty())
        {
            hasUVs = true;
            result.setUvIndex(Integer.parseInt(tokens[1]) - 1);
        }

        if(tokens.length > 2)
        {
            hasNormals = true;
            result.setNormalIndex(Integer.parseInt(tokens[2]) - 1);
        }
    }

    return result;
}

How would I go about doing this?

sentences:
Moving players into same square simultaneously? Consider a 2 x 2 grid of squares. A player can move onto a square if:

  no other player wants to move into the square next turn
  no other player has waited and is still occupying the square this turn

I have included the image above to describe my problem.

Players move simultaneously.

If 2 (or more) players try to move into the same square, neither move.

sentences:
How to rotate the transform only on the Y? private Update()
{
    // Here the transform player should rotate facing the opposite direction.
    // Determine which direction to rotate towards
    Vector3 targetDirection = targetToRotateTo.position - transform.position;

    // The step size is equal to speed times frame time.
    float singleStep = rotationSpeed * Time.deltaTime;

    // Rotate the forward vector towards the target direction by one step
    Vector3 newDirection = Vector3.RotateTowards(transform.forward, targetDirection, singleStep, 0.0f);

    // Draw a ray pointing at our target in
    Debug.DrawRay(transform.position, newDirection, Color.red);

    // Calculate a rotation a step closer to the target and applies rotation to this object
    transform.rotation = Quaternion.LookRotation(newDirection);
}

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:
Unity3D 3.5 pro - Moving the camera vs setting draw distance I move the camera mostly via right-click + WASD, sometimes with [shift] if I want it to move faster. Occasionally, instead of moving my camera, it alters the draw distance / FOV / some visual aspect of the editing scene that causes trees and other object to disappear when I scroll enough, and eventually even the terrain starts disappearing. It is not m "zooming out". My camera does not move, the width and height of the FOV stays the same (one might say the depth is being altered though). What key am I hitting to cause this to happen, and is it possible to disable it?

side note: "keybinds" is probably the most spot-on tag for this question but it doesn't exist (surprisingly) and I lack the rep to create it.

sentences:
2D RPG - Character sprite size bigger than tile size Ok so I'm trying to make a nice little RPG game in Java & Slick2D engine, the tiles are 16x16, so the collision array is also 16x16, how ever my character sprite is 16x20

What would be the best method of moving the character in relation to a 16x16 grid, also checking for collision?

sentences:
A list of game mechanics I'm trying to compile a list of game mechanics, by which I mean high-level/meta game mechanics like Cooperation, Resource Management, Chance and Time Manipulation rather than low level mechanics like running, jumping climbing ladders, etc

Does any one have any suggestions or can point me to good existing lists? My WIP list is already proving to be quite useful to me in the way I think about games.

sentences:
Marching cubes leaving holes in the mesh Hi I'm trying to reproduce GPU Gems 3 chapter 1 (Generating Complex Procedural Terrains Using the GPU) and so far I managed the basics... Now I'm betting some strange output.

I started with the suggested -ws.y to generate a plane. Then when I moved to the noise I noticed some holes in the mesh. But unlike this previous question.

The noise mesh:

So I decided to try something more simple, 3 tubes:
x^2+y^2-2

x^2+z^2-2

y^2+z^2-2

I would assume there is some problem with the z axis. But I can seem to figure out what.
My function to get the triangles vertex positions also seems ok...

Vector3 vertexAlongEdge(int edge, Voxel v){
    Vector3 result=new Vector3(0,0,0);

    Vector3 p1=v.vertexes[edges [edge, 0]];
    Vector3 p2=v.vertexes[edges [edge, 1]];
    float v1 = density (p1);
    float v2 = density (p2);
    if (Mathf.Abs (isoLevel - v1) < 0.00001)
        return p1;
    if (Mathf.Abs (isoLevel - v2) < 0.00001)
        return p2;
    if (Mathf.Abs (v1 - v2) < 0.00001)
        return p1;

    float m = Mathf.Abs((isoLevel - v1) / (v1 - v2));
    result.x = p1.x + m * (p2.x - p1.x);
    result.y = p1.y + m * (p2.y - p1.y);
    result.z = p1.z + m * (p2.z - p1.z);

    return result;
}

The only thing I can think of right now is an error in my table with the edges for each case.
Please help.

sentences:
SpriteRenderer.flipY not functioning The problem I'm having is that my script, which has access to the spriterenderer on my gameobject, won't flip the sprite when I directly type "sprite.flipY = true;" at the end of my FixedUpdate() function.
        if (transform.position.x < player.transform.position.x)
        {
            facingright = false;
        }
        if (transform.position.x > player.transform.position.x)
        {
            facingright = true;
        }
        sprite.flipY = !wasfacingright;

Heres all of the code if you need it
using System.Collections;
using System.Collections.Generic;
using UnityEngine;

public class GunController : MonoBehaviour
{
    public Transform player;
    public CharacterController2D playercontroller;
    public float smoothness = 0.125f;
    public float winglength = 2;
    private Vector2 difference;
    private bool facingright = true;
    bool wasfacingright = true;

    public GameObject bullet;
    public int maxammo;
    public int ammo;
    public Transform rightNozzle;
    public Transform leftNozzle;

    public SpriteRenderer sprite;
    public Sprite normalGun;
    public Sprite emptyGun;
    public GameObject emptyBottle;
    public Animator reloadAnim;
    // Start is called before the first frame update
    void Start()
    {
        player = transform.parent.transform;
        sprite.sprite = emptyGun;
    }

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

    }
    private void FixedUpdate()
    {
        doMovement();
        tryShooting();
        tryReloading();
    }
    private void tryReloading()
    {
        if (Input.GetKey(KeyCode.R) & ammo <= 0)
        {
            Instantiate(emptyBottle, transform.position, Quaternion.identity);
            StartCoroutine(reload());
            ammo = maxammo;
        }
    }
    private void tryShooting()
    {
        if (Input.GetMouseButton(0) & ammo > 0 )
        {
            ammo -= 1;
            if (facingright)
            {
                Instantiate(bullet, rightNozzle.position, transform.rotation);
            }
            else
            {
                Instantiate(bullet, leftNozzle.position, transform.rotation);

            }

        }
    }
    private void doMovement()
    {
        wasfacingright = facingright;
        if (transform.position.x < player.transform.position.x)
        {
            facingright = false;
        }
        if (transform.position.x > player.transform.position.x)
        {
            facingright = true;
        }
        sprite.flipY = !wasfacingright;
        if (wasfacingright != facingright) { playercontroller.Flip(); }
        difference = Camera.main.ScreenToWorldPoint(Input.mousePosition) - transform.position;
        float rot = Mathf.Atan2(difference.y, difference.x) * Mathf.Rad2Deg;

        Vector3 pos = Camera.main.ScreenToWorldPoint(Input.mousePosition) - player.position;
        pos.z = 0;
        Vector3 desiredpos = player.position + (winglength * pos.normalized);
        Vector3 smoothpos = Vector3.Lerp(transform.position, desiredpos, smoothness);
        transform.position = smoothpos;
        transform.rotation = Quaternion.Euler(0, 0, rot);
    }
    IEnumerator reload()
    {
        sprite.sprite = emptyGun;
        reloadAnim.Play("Reload", 0, 0);
        yield return new WaitForSecondsRealtime(0.5f);
        sprite.sprite = normalGun;
    }
    public void die()
    {
        gameObject.SetActive(false);
    }
}

sentences:
Looking for a peer reviewed article that details the benefits of a physics simulation within interactive media I'm hoping this is the correct place to ask this question as it is video game related and can be seen as a key ingredient in modern game development.

Does anyone know of a peer reviewed article that details the benefits of incorporating a physics simulation into interactive media (such as video games)?

I can find books with a few remarks in their introduction (no more than a couple of sentences) but nothing substantial.

sentences:
Offset direction stops working when I get too close I have a script trying to get the gun aim at the target instead of the origin:

It's partially working.

but when I get too close with the mouse the player starts spinning

I would appreciate a help regarding why it happens and how to fix it.

sentences:
How do 3d engines create frames? I wanted to start on a little project of making a simple 3d engine, but I can't seem to find anywhere how 3d engines actually make frames. (I don't mean the math behind the 3d projection). Do they use bitmaps and edit the pixels, or do they use the GPU in some way? Also is editing the pixels in a bitmap using CPU or GPU?
EDIT:

I only mean after they do the math and find each pixel value for the frame how do they display the frame? Do they change the pixels in a bitmap while rendering a scene, or do they have an array that has all the pixels color values then use the GPU do display the pixels?

sentences:
Need to separate textures for Unity prefabs I'm a beginner at Unity and so I apologise if I'm asking a really stupid/simple question.

I have a number of 3d objects that were exported from a Blender project an then imported into Unity.

I grabbed the texture out of Blender and reapplied it in Unity.

Now I want to apply separate textures to each of the Prefab objects, but when I do, the texture change applies to all the prefabs. Likewise, if I try to duplicate one of the prefabs and apply a different texture, it applies to all of the prefabs.

Can I separate the prefabs so that I can apply individual textures to each?

Do I have to reimport the objects individually?

sentences:
Information on seamless MMO server architecture I'm looking for any material on seamless MMO servers! I do have a few articles in the "Massively Multiplayer Game Development" books and "Game Programming Gems 5." Has anyone experience on that topic or knows articles about that?

I'm interested in "high-level views" as well as implementations. This might become the topic of my master thesis and I would like to find out how hard it is to write such a system, before I actually start the thesis. Right now I haven't decided which language to use, I'm thinking about Java or Scala. Erlang could be a choice, but I've never worked with that.

Note: Basic requirement would be movement. Any other gamesystems are optional and give "bonus credit."

Now for what I mean with "seamless server": I want so set up a server cluster where every node controls some part of the game world, with static boundaries. Players can now move from one end of the world to the other without switching an instance or hitting some "teleporter". I think WoW does that. In my back-end however the player transitions from one server to the next.

sentences:
LibGDX--constant high score in top corner I'm currently programming a game using LibGDX and box2D. I have a sprite (player) that moves up the screen, kind of like doodle jump.

I'd like to have my camera to be centered around the player at all times--the sprite will be in the center of my screen as they move up, or as they fall down.

I'd also like to have a high score panel that is always at the top left corner of the screen.

As of now, I have this done, to an extent. As long as the player doesn't move to far up the screen at a time, it will remain centered, and the high score will generally be in the top. Sometimes it'll move off the screen, but it will come back as the player falls down.

Most of my confusion lies from the LibGDX coordinate system, so if you could explain that, that would enhance my understanding of the problem.

Here is the code I have:

//Access the world's reference to Player, and update the position of it's sprite with respect to the body
  world.getPlayer().updatePosition();
  world.getBlock().updatePosition();

  //Have the camera follow the player, but only in the y position
  batch.setProjectionMatrix(camera.combined);
  camera.position.set(camera.position.x, world.getPlayerSprite().getY() - 75, 0);
  camera.update();

  //Begin batching sprites here. This will include blocks and the player
  batch.begin();

  debugMatrix = batch.getProjectionMatrix().cpy().scale(100f,
        100f, 0);

  //Render the Player sprite here
  batch.draw(world.getPlayerSprite(), world.getPlayerSprite().getX(), world.getPlayerSprite().getY(),world.getPlayerSprite().getOriginX(),
        world.getPlayerSprite().getOriginY(),
        world.getPlayerSprite().getWidth(),world.getPlayerSprite().getHeight(),world.getPlayerSprite().getScaleX(),world.getPlayerSprite().
                getScaleY(),world.getPlayerSprite().getRotation());
  batch.draw(world.getPlatformSprite(), world.getPlatformSprite().getX(),
          world.getPlatformSprite().getY(),world.getPlatformSprite().getOriginX(),
          world.getPlatformSprite().getOriginY(),world.getPlatformSprite().getWidth(),
          world.getPlatformSprite().getHeight(),world.getPlatformSprite().getScaleX(),
          world.getPlatformSprite().getScaleY(),world.getPlatformSprite().getRotation());
  batch.draw(world.getBlockSprite(), world.getBlockSprite().getX(),
          world.getBlockSprite().getY(),world.getBlockSprite().getOriginX(),
          world.getBlockSprite().getOriginY(),world.getBlockSprite().getWidth(),
          world.getBlockSprite().getHeight(),world.getPlatformSprite().getScaleX(),
          world.getBlockSprite().getScaleY(),world.getBlockSprite().getRotation());

  Gdx.app.log("Position", "" + camera.position.y + " " + world.getPlayerSprite().getY() + " " + (camera.position.y - 275));
  font.draw(batch, "Score:" + (int)Math.ceil(22-world.getPlayerBody().getPosition().y), 0, camera.position.y - 275);

  batch.end();

sentences:
"Solve" a game algorithmically -- creating bots (and making them smart) EDIT :  at first I gave a lot of context for this question, explaining why I wanted to create a bot. I'm sorry it distracted people from my "actual" question.

My question is pretty simple : how does one create a bot for a game ? (Especially... on a mac, if it's possible -- though I can use a Linux virtual machine if needed).

Is it interfaced with the application, or just "watching" the screen and extracting information from it (as if it was taking pictures and analyzing them to get informations such as your HP, your position, etc.) ?
Could I use python to code it, or are there specific languages ?

The forementioned context :

Since I started programming, I've wanted to try to create algorithms that would be able to "play" (or even "beat") video games. Many games require only logical choices, more and more complex as the difficulty grows, which seems perfect for algorithms.

I currently enjoy the game "Pixel Dungeon" a lot (see here), but it's not always nice to you (and you die. A lot.). A few researches on the internet show that a lot can be achieved just by following simple guidelines.

So I figured maybe this would be a good game to try and create bots to play it. In the long term, I would like to let bots play, extract data out of it, and modify my algorithms according to these data.
I am really enthusiast about this, but also really novice.

(maybe this belongs more to https://stackoverflow.com/ ?)

sentences:
How to detect direction of rotation? I have a character with a camera behind him. The head of the character rotates with the LookAt function on the character's head rig.
The LookAt is done towards targets that may be to the right or left of the entire body of the transform character.
So I want to detect when the head rotates clockwise with respect to the controller body and when it rotates counterclockwise. How can I do this?

sentences:
Revolve FlxSprites Around a Central FlxSprite in Flash Game made with Flixel I have been working on a Flash game made in Flash Builder using the Flixel library. I have been trying to dynamically create a group of FlxSprites , and revolve them around a player controlled class that extends FlxSprite when the player uses a power up.

My thought on how to approach this, was to create a circle, use points on that circle to instantiate the sprites, and then somehow update those sprites to points along that circle during the game's update step. But I am not sure what would be the best way to hold information about a circle, or circular path's in ActionScript 3. I assumed that As3Math  provided some of the means to do this, and I tried to add one sprite to a circle like this:

package
{
    import As3Math.*;
    import As3Math.geo2d.amBoundCircle2d;
    import org.flixel.FlxGroup;
    import org.flixel.FlxState;

    public class ButterflyRing extends FlxGroup
    {
        [Embed(source="../Content/Images/spritesheet_butterfly_32x8.png")] var butterflySprite:Class;
        public function ButterflyRing(playState:FlxState,X:Number,Y:Number)
        {
            //add to super class
            super();

            //create a circle motion path at coordinates x:150, y:150 with a radius of 100
            var butterflyCircle:Math.amBoundCircle2d = new Math.amBoundCircle2d(150,50);

            var circDiameter:Number = butterflyCircle.radius/2;
            var pX:Number = butterflyCircle.center.x + circDiameter
            var pY:Number = butterflyCircle.center.y;

            var butterfly:SpriteButterfly = new SpriteButterfly(pX,pY);
            add(butterfly);

        }

        override public function update():void
        {
            super.update();
        }
    }
}

I realize now this is not the correct way to use As3Math, that it is accessible by default and you call it like Math.pi. My question is, Does ActionsScript 3 have the means to do this in its code base, or do you have to define your own classes to hold information for a circle, or do you use Math.pi to build circles from scratch? What is a good approach for this? Or does Flixel provide something good for this?

sentences:
Unity WebPlayer : WWW GET Requests fail in webplayer only, not in editor My question is about my game requesting data from my server-side cloud-based storage (I have the option of free public Dropbox or Amazon S3) via GET and the WWW class, and it not working only in the WebPlayer (works fine in the Editor).  By not working, I mean that the request is sent successfully, authorized and responded to by the cloud-service, but that WWW shows an error in the logs.  In the case of using Amazon S3, the Web Player even crashes, otherwise it just fails gracefully and the user is unable to move forward.

The Error log left by the webplayer says the following:

  WWW Error: Error when creating request. GET request with custom
  headers is not supported. for URL:
  https://my-storage.s3.amazonaws.com/myDir/myFile.json

Here's when I use a similar request to a public directory on Dropbox.  There is no crash, but the request also fails.

  WWW Error: Failed downloading
  dl.dropboxusercontent.com/u/7782207/spare-change/weapons/0.json for
  URL: dl.dropboxusercontent.com/u/7782207/spare-change/weapons/0.json

Try it for yourself: http://webroleplay.appspot.com   (currently using Dropbox, so not crashing the player)

username: test1

password: t

sentences:
FBX model for 2d sprite charachter I was following along the unity platformer tutorial. https://www.youtube.com/watch?v=9WhZ1svdC3Q It is great. After looking the animation I found that there was a fbx model for 2d sprite character. I just want to ask can you use 3d animation like motion capture animation once you rig a character using bone for 2d(fbx model). I search but unable to find any good tutorial of how to create fbx model for 2d character and creating maps for these 2d character.

I am really confused. Thank you so much for helping.

sentences:
What are some ways of making a game engine centered around the idea of drawing vector lines and polygons only? I've always loved the look of games that just use simple lines and polygons for graphics. Rez is one of my favorite games, visually. I'm a programmer and designer first and foremost, and I'm horrible at creating Actual Art, and the idea of making a game like Rez, using mostly line and polygon drawing, really appeals to me. Sort of like how a lot of programmers like to make roguelikes with minimal or ASCII art, I really like the idea of making a game just using trigonometry to draw lines in cool ways.

I've been making a game for a school project using my school's proprietary game engine. Instead of using its 3D model drawing capabilities and 2D sprite drawing capabilities, I've instead opted to make it using only the engine's "debug draw" functionality. I went so far as to create a library of functions that allow me to create "VecSprites", or collections of lines that act in the same way as sprites, both in 2D and 3D contexts. (For 3D, I do my own matrix math to calculate perspective and stuff, forgoing the engine's own 3D rendering capabilities entirely). Here is a video of my current project in action.

Going forward though, I want to set out to create my own game engine that will allow me to make these sorts of games on my own, without using someone else's game engine. I have plenty of experience with game engine architecture, but I don't know too much about actually drawing stuff to the screen. (Whenever I made a from-scratch game project for school, someone else was in charge of the DirectX or OpenGL side of things.) I have, however, done research into the different methods of rasterizing lines and curves and such to the screen.

What I'm wondering is, if I want to set out to make my own game engine specifically for drawing only primitive lines and circles (and then extend it with classes and such to allow for functionality such as grouping lines together into shapes), where is my best bet for getting started?

In the past, I've fooled around with Cairo, only to be disappointed by the fact that, currently, it is not really meant for rendering graphics in real-time on the GPU. Two years ago I made a simple game project using it, and it worked great until I ran it at 1080p, and, as it turns out, pushing 1920x1080x4 bytes to the GPU sixty times a second isn't exactly what modern computers were meant to do.

So where do I begin? I want to draw primitive lines and polygons on PCs, specifically Windows and possibly Linux, as fast as possible. I wouldn't mind having to go through the effort of creating my own systems for drawing anti-aliased lines, filled polygons, and so forth; I just want to know what my options are for doing such things.

Do I draw lines and polygons using low-level OpenGL calls, and go from there? Is it possible to pass a bunch of data containing the shapes I want do draw to a shader, and then have the shader do it? (I'm only minimally familiar with how shaders work.)

I know this question is kind of broad, but I really want to set out on this adventure to try and make this thing, and I just don't really know where to begin, at least as far as the drawing side of things is concerned.

sentences:
Walking over walls - Game maker studio I am having an issue with the walls in my game. I have set them as objects and used the script:

depth = -y;

inside their create event.

However, when I walk my character in front of them, the correct depth is only kept until the character kindof goes half in front of the wall.

Like this:

These are the collision shapes

And this shows how I inherit from one door parent and add the depth = -y; script to the create event of the wall child.

My character also has depth = -y; but on its step event.

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:
How to set a specific face's texture color in Unity? First off, let me describe my situation...
So I'm building a voxel engine based on this tutorial. I'm using my own texture tilesheet. Most of the tiles have their own color except grass, leaves, and a few others. These specific ones are meant to be colored based on the temperature and humidity of the location.

AlexStv (the author of the tutorial linked above) said the mesh colors array could be set, but I tried that and nothing happened. I probably did it wrong though, not sure. But he also said "you may need a shader that render vertex colors, not sure if the standard shader does that anymore" so that could also be the issue.

So... Do I need a custom shader? If not how do set the face's colors?

EDIT, Note: I just tried a custom shader called UnityVC, it still didn't work so I guess I must be doing the color thing he suggested wrong.

sentences:
Are there methods faster than Strings for sending a sprite's state over UDP? I'm programming a 2.5D networked game in Java. The networking works like this right now:

Create new networked sprite object at the client. Send it to the server. Server distributes and saves it. (TCP-ObjectStreams are used)
The Sprite's state is represented by a String that contains its id (Player's name+Index) and values. You can request the state with the method getState():

return getID()+"|x"+getX()+"y"+getY()+"#";
//Example: "Grimey2|x402y123#"

These states are collected multiple times a second by adding them to a single big String:

zState += spriteArray[x].getState();
//Example: "Grimey1|x752y133#Grimey2|x410y31#Grimey3|x202y13#"

All sprites' states are then saved in a HashMap at the client, sent to the server (Java DatagramSocket) and saved there too.

Is there a more performant way to handle sprite-updating than with Strings?

sentences:
Unet how to control child gameobject? I'm currently getting into the Unity networking system called unet. I have a child of the local player authority, the weapon. The weapon (PlasmaCannon_left and right) have a script handling firing, because weapons can be replaced, and have different firing intervals, this seemed to me to be the easier way. However, they won't fire.

Hierarchy:

(simplified) Weapon Code:

public void Start() {
    Debug.Log("Weapon Spawned.");
    if (isLocalPlayer) {
        Debug.Log("Weapon set as local player");
    }
}

public void Update() {
    if (isLocalPlayer) {
        if (firingTimer <= firingInterval){
            firingTimer += Time.deltaTime;
        }
        if (firingTimer >= firingInterval) {
            if (Input.GetButton("Fire1") && firingMode == FiringMode.Primary) {
                CmdFire();
            }
            if (Input.GetButton("Fire2") && firingMode == FiringMode.Secondary) {
                CmdFire();
            }
        }
    }
}

[Command]
public void CmdFire() {
    Debug.Log("Firing Bullet.");
}

I am getting the "Weapon Spawned." log message, but nothing inside isLocalPlayer conditions is happening even though I have added a networkidentity component and set Local Player Authority to true.

Like I said, I'm still learning so I have no clue what's going wrong here.

sentences:
How to add a collision function to a game Ive tried a few things but i cant get a working function  if player collides with object set speed to 0( stop moving)

ive tried to use the function under  "game over " and change the things to make speedx=0 and speedy=0 but i couldnt format it correctly.

https://www.w3schools.com/graphics/game_obstacles.asp

my  code:

<meta name="viewport" content="width=device-width, initial-scale=1.0"/>

use the arrow keys on you keyboard to move the red square.

https://jsfiddle.net/tmanrocks999/e6w9br2s/178/

I expect when the player hits the obstacle for them to stop moving. but at the moment they go through it/ i have 1 && that prevents it from going past the x location of obstacle but that doesn't work right

sentences:
Is it possible to use animated .gif images in lbgdx? Is it possible to use animated .gif  images in lbgdx? If not how whats the alternative? We need to include animated buttons.

When I use an animated gif, the animation won't play. This question (and many others) states that Libgdx doesn't support it, I'm wondering if something has changed over the years

sentences:
Keeping track of onscreen objects in opengl es on Android In a small game Im working on I was able to implement ray picking with an opensource 3d engine called min3d but I cant figure how to keep track of what object is onscreen. I will some times have upwards of 120 objects to render within my scene and the raypicking is off occasionally. What id like to do is keep track of how many screen objects are within the camera and being rendered onscreen and set a boolean value based on that to add or remove objects from my arraylist I iterate through when the screen touch is registered and the ray picking method goes off.

So how can I check for which objects are onscreen and offscreen in opengl es on android.

sentences:
Midpoint Displacement Algorithm This question has come mainly out of sheer desperation, after spending several hours trying to figure out the problem.

If you cast your eyes to the picture above, you should see that my midpoint displacement algorithm algorithm is working (somewhat) successfully; in producing a somewhat coherent noise pattern.

However, it is leaving behind a black dotted grid on the image, and I have no idea why. I can foresee this being an issue in the math, but I just cannot see it; nor was this pointed out in any online resources as a possible issue; so any help will be appreciated as to hunting down this bug.

unsigned char** mdp(unsigned char** base, unsigned base_n, unsigned char r) {
    size_t n = (2 * base_n) - 1;

    unsigned char** map = new unsigned char*[n];
    for (unsigned i = 0; i < n; ++i) map[i] = new unsigned char[n];

    // Resize
    // 1 0 1
    // 0 0 0
    // 1 0 1
    for (size_t i = 0; i < n; i += 2) {
        for (size_t j = !(i % 2 == 0); j < n; j += 2) {
            map[i][j] = base[i / 2][j / 2];
        }
    }

    // Diamond algorithm
    // 0 0 0
    // 0 X 0
    // 0 0 0
    for (size_t i = 1; i < n; i += 2) {
        for (size_t j = 1; j < n; j += 2) {
            unsigned char& map_ij = map[i][j];

            unsigned char a = map[i - 1][j - 1];
            unsigned char b = map[i - 1][j + 1];
            unsigned char c = map[i + 1][j - 1];
            unsigned char d = map[i + 1][j + 1];
            map_ij = (a + b + c + d) / 4;

            unsigned char rv = std::rand() % r;
            if (map_ij + r < 255) map_ij += rv; // EDIT: <-- thanks! the bug! `map_ij + rv`, not `r`
            else map_ij = 255;
        }
    }

    // Square algorithm
    // 0 1 0
    // 1 0 1
    // 0 1 0
    for (size_t i = 0; i < n; ++i) {
        for (size_t j = (i % 2 == 0); j < n; j += 2) {
            unsigned char& map_ij = map[i][j];

            // get surrounding values
            unsigned char a = 0, b = a, c = a, d = a;
            if (i != 0) a = map[i - 1][j];
            if (j != 0) b = map[i][j - 1];
            if (j + 1 != n) c = map[i][j + 1];
            if (i + 1 != n) d = map[i + 1][j];

            // average calculation
            if (i == 0) map_ij = (b + c + d) / 3;
            else if (j == 0) map_ij = (a + c + d) / 3;
            else if (j + 1 == n) map_ij = (a + b + d) / 3;
            else if (i + 1 == n) map_ij = (a + b + c) / 3;
            else map_ij = (a + b + c + d) / 4;

            unsigned char rv = std::rand() % r;
            if (map_ij + r < 255) map_ij += rv;
            else map_ij = 255;
        }

    }

    return map;
}

If you have any tips or resources other than http://www.gameprogrammer.com/fractal.html and http://www.lighthouse3d.com/opengl/terrain/index.php?mpd2 for fractal based terrain generation, I would appreciate them as comments also.

Edit:

This is the new image, as per Fabians suggestion (ty), however it still has some strange quirks, which you should be able to see straight away (small 'dimples' everywhere).

What could be causing this strange behavior? Updated source code: http://www.pastie.org/1924223

Edit:

Many thanks to Fabian in finding the bounds check error, for those interested, here is the current solution as 512x512 png. And current source code (modified by Fabian).

Edit (years later):
Python version https://gist.github.com/dcousens/5573724#file-mdp-py

sentences:
Cross-platform ad-hoc local mobile multiplayer I want to implement ad-hoc cross-platform (iOS, Android, and PC) device discovery for local multiplayer, like this scenario: http://www.youtube.com/watch?v=csXYZf2vGdE  Multiple players, each with different devices (iOS, Android, PC). One player starts a game. The others can search and automatically discover his game and enter into a local multiplayer match. This would all be done P2P, without any dedicated game servers.

Is this possible with current technology?

sentences:
Monogame/SharpDX - Shader parameters missing I am currently working on a simple game that I am building in Windows 8 using MonoGame (develop3d). I am using some shader code from a tutorial (made by Charles Humphrey) and having an issue populating a 'texture' parameter as it appears to be missing.

Edit I have also tried 'Texture2D' and using it with a register(t0), still no luck

I'm not well versed writing shaders, so this might be caused by a more obvious problem.

I have debugged through MonoGame's Content processor to see how this shader is being parsed, all the non 'texture' parameters are there and look to be loading correctly.

Edit This seems to go back to D3D compiler.

Shader code below:

#include "PPVertexShader.fxh"

float2 lightScreenPosition;

float4x4 matVP;

float2 halfPixel;

float SunSize;

texture flare;

sampler2D Scene: register(s0){
    AddressU = Clamp;
    AddressV = Clamp;
};

sampler Flare = sampler_state
{
    Texture = (flare);
    AddressU = CLAMP;
    AddressV = CLAMP;
};

float4 LightSourceMaskPS(float2 texCoord : TEXCOORD0 ) : COLOR0
{
    texCoord -= halfPixel;

    // Get the scene
    float4 col = 0;

    // Find the suns position in the world and map it to the screen space.
        float2 coord;

        float size = SunSize / 1;

        float2 center = lightScreenPosition;

        coord = .5 - (texCoord - center) / size * .5;
        col += (pow(tex2D(Flare,coord),2) * 1) * 2;

    return col * tex2D(Scene,texCoord);
}

technique LightSourceMask
{
    pass p0
    {
        VertexShader = compile vs_4_0 VertexShaderFunction();
        PixelShader = compile ps_4_0 LightSourceMaskPS();
    }
}

I've removed default values as they are currently not support in MonoGame and also changed ps and vs to v4 instead of 2. Could this be causing the issue?

As I debug through 'DXConstantBufferData' constructor (from within the MonoGameContentProcessing project) I find that the 'flare' parameter does not exist. All others seem to be getting created fine.

Any help would be appreciated.

Update 1
I have discovered that SharpDX D3D compiler is what seems to be ignoring this parameter (perhaps by design?). The ConstantBufferDescription.VariableCount seems to be not counting the texture variable.

Update 2
SharpDX function 'GetConstantBuffer(int index)' returns the parameters (minus textures) which is making is impossible to set values to these variables within the shader. Any one know if this is normal for DX11 / Shader Model 4.0? Or am I missing something else?

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:
C# OpenTK Text rendering I've been looking everywhere for a solution on how to render/draw text for my 2D OpenTK-based game.

Been trying quite a few QuickFont ones without success (either a AccessViolation exception or text just not rendering), which is why I finally decided to ask here.

So my question is;
How do I render/draw text in OpenTK for my 2D game?

Thanks!

EDIT

I have tried the following example from QuickFont.Desktop GitHub

QFont _myFont;
QFont _myFont2;
QFontDrawing _drawing;

_myFont  = new QFont("Fonts/HappySans.ttf", 72, new QFontBuilderConfiguration(true));
_myFont2 = new QFont("basics.qfont", new QFontBuilderConfiguration(true));
_drawing = new QFontDrawing();  //This line throws exception "Exception thrown: 'System.AccessViolationException' in QuickFont.dll"

As I get an error here, It's hard to tell if the rest is wrong or not. It's all in the link above for anyone interested.

What I am looking for is basically a complete "working" guide for the latest OpenTK build with .NET Framework 4.5.2

sentences:
Unity - OnRenderImage hides UI I have a component which renders a few different cameras and the images. However, this obscures my UI when in Screen Space - Overlay mode.

I can put the canvas in WorldSpace mode, which works, but then the UI is affected by the image effect I've built and is, of course, not locked to the camera.

Suggestions?

Update - additional details

At design time, the OVR camera rig contains a single camera centered between the "eyes." This component is attached to the camera rig's centerEyeAnchor.

At run time, the rig creates two additional cameras - one for each eye. These aren't supposed to be modified by user code. (Among other things, their projection matrices are pretty weird.)

I need to modify the image per eye.

I created a new component which create two additional cameras per eye. One renders a low-res version of the entire scene, the other renders a high-res image of a portion of the screen, each to a dedicated RenderTexture.

Pseudocode:

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

/// called twice per frame - once per eye
void OnPreRender()
{
}

/// called twice per frame - once per eye
void OnRenderImage(RenderTexture source, RenderTexture destination)
{
  /// low-res render of entire scene
  var camOuter = m_cameras[...];
  /// hi-res render of part of the scene - 10-20% of original image area
  var camInner = m_cameras[...];

  /// update cameras to match current eye camera
  camOuter.copyFrom(Camera.current);
  camOuter.targetTexture = m_outerTexture;

  /// render scene to low-res texture
  camOuter.Render();

  camInner.copyFrom(Camera.current);
  camInner.targetTexture = m_innerTexture;

  /// target texture that the Oculus wants to render to
  var ovrTexture = Camera.current.targetTexture;

  /// save projection matrix
  var originalProjectionMatrix = camInner.projectionMatrix;

  var scale = new Vector3(m_innerTexture.width * 1.0f / ovrTexture.width, m_innerTexture.height * 1.0f / ovrTexture.height);

  /// zoom/pan matrix to clip to part of the scene
  var gazeMatrix = Matrix4x4.Scale(scale);

  /// offset projection
  gazeMatrix.m03 += (1 - 2 * gaze.x) * scale.x;
  gazeMatrix.m13 += (1 - 2 * gaze.y) * scale.y;

  camOuter.projectionMatrix = gazeMatrix & originalPRojectionMatrix;

  /// render hi-res portion of the scene centered at gaze pixel
  camOuter.Render();

  /// restore projection matrix
  cam.projectionMatrix = originalProjectionMatrix;

  /// composite images
  m_material.SetTexture("InnerTexture", m_innerTexture);
  m_material.SetTexture("OuterTexture", m_outerTexture);
  Graphics.Blit(null, destination, m_material);

}

(I'm also worried that there may be additional scene renders happening in the background.)

The problem is that the UI does not render if set to Screenspace - Overlay or Screenspace - Camera. I can get it to render in Worldspace, which may be the only way to do this, but then it seems I'd need to create yet another hi-res texture matching the viewport dimensions and render the UI layer to that, and keep it locked to the current eye's camera position. Alternatively, I could re-use one of the current cameras, I guess, and just tweak its settings.

Is there a better way to do this?

Ideally, I'd like to have the engine just render the UI as it does in other applications without having to jump through hoops. However, at this point, I'll take anything I can get that works and looks good.

Update the 2nd

Okay, it looks like the UI is rendered perfectly if I use a regular camera instead of the OVR rig. :( Having the rig in the scene, though, prevents it from drawing at all.

sentences:
Use ramp and steps meshes as actual ramp in unreal engine 4.26 Is it possible to use a ramp mesh as an actual ramp in UE4? It seems that the system create a rectangle box around the ramp o the character does not climb the ramp, it is over it like on a box.
I know that we can use landscape ramp's generator, but it's one more step that could be avoid.
thanks guys!

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:
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:
Costs for developing an Iphone physics game? I recently made a game demo inspired by a wooden board game where you drop the ball trying to make a score, is fully playable so take a look (Works best on firefox):
https://dl.dropbox.com/u/62131673/LuckyBall-Chrome/index.html

I want to build this game for the Iphone's App Store, add accelerometer features, menus, unlockable levels, best scores, etc. I'm a graphic designer so I prefer to keep working on the presentation (graphics, assets, sound, music) and leave the rest to the programmer.

I want to know how much this game would cost for a programmer to be developed, so I can make a video at kickstarter.com and sell the idea, with luck this game will see the light.

I don't want to open a debate on the subject, I just need advice on the costs so I can hire someone.

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:
Reset Polygon Collider Runtime (Unity) I've created an animation by using different frames. Then applied polygon collider on that object. Problem is that when frame changes in animation, it does not reset collider. I've searched for resetting polygon collider as sprite gets change. One solution I've found is like following :
Destroying existing collider & Adding new collider to the object.
http://answers.unity3d.com/answers/723811/view.html
I've applied this on the object. But it hangs the game. Is there any another way to reset polygon collider from c#.

sentences:
What engine/technology should I work with to accomplish my unique design goal? I'm looking to begin a procedurally generated open-ended sandbox game and would like some educated opinions on a good starting point. (Take a look at the "Engine Specifications" if you don't want to read the whole post) I do not expect there to be an engine/set of libraries that meets all my requirements, but instead meet some essential ones (like rendering/collisions). I realize I will be building many engine components from scratch and appreciate any extra advice you want to include in your answer.
A little background
I am a fairly experienced programmer with intimate knowledge of modern design practices and know most popular programming languages like C++ and C#.
I've dealt with other 3D engines before like the Source Engine (C++) and UDK (UnrealScript) for some personal projects. I'd like to think most of my knowledge is of FPS game design and what the standard components are of FPS oriented game engines.
My design goal
In a nuteshell: I plan for my game to be a procedurally generated open-ended sandbox game that consists of large blocks as the basic geometry. The player will play in the first person.
These uniformly sized blocks will be large enough so that it can act as a segment to a hallway that the player could walk through. A block could also act as a wall to a building, be completely solid, or be completely empty. These blocks are changeable, removable, and placable.
By now this should sound familiar but its important to understand some critical and defining aspects of the game:
Engine Specifications

Blocks themselves contain collisions meshes within themselves; a wall can be placed on any of the 4 sides of the cube and a ceiling/floor on the remaining top and bottom faces.

Example of block collision configurations:

Blocks contain (unless they are empty or fully solid) independent visual meshes on each of their sides that contain collision meshes. They will be relatively simplistic and contain generally low resolution textures (the right resolution would come from benchmarking tests).

No complex shaders, effects, or lighting will be implemented. Only very basic implementations for performance.

Blocks contain basic navigation information and when connected to eachother, form a navigation network of nodes. The blocks themselves act as nodes and their connectivity to other nodes are determined by wall placement and so on.

Basic node based pathfinding will be implemented for AI.

The most challenging aspect will be multiplayer I presume.

Ray tracing

Simple particle engine

Physics simulation not likely, just basic fps movement physics

I realize I have a sizable workload in front of me as most engines are not geared for this type of game and so common design paradigms will be sparse. However, I believe there is an engine out there that I can work with to speed things up.
Game engines I have knowledge of

Gamestudio (clight)
Source Engine (C++)
UDK (UnrealScript)
Panda3D (C++/Python)
Torque3D (C++/TorqueScript)
Unity (C#)

I don't really prefer to use any of the ones I've listed for different reasons (mostly because they're FPS engines), but if you think one of them would be a good choice let me know.
Do you know of a game engine or technology bundle that would best help me implement my specifications? Apologies for the lengthy post.
Note: I wouldn't mind investing a few thousand dollars if it justifies itself.

sentences:
What is the difference between "offline" and "real time" rendering? I have a rough idea: real-time is approximated with little or no global illumination.
But how would you otherwise explain why offline rending takes so much longer? You hear things like "number of passes," et cetera...

Can you explain the difference in simple terms?

sentences:
Load a second app in background and launch behind a loading screen there is a way to preload an application in android from Unity? I mean.. I'm developing a launcher and every click in icon, should be launch a different game.. so, the time between show a loading animation and open the second app, in android, It's posible to make..  when the loading's animation is fadeout and behind the loading screen, the second app is loaded?

P/D: I have to said that, the launcher is a different application from the game that should be launch.

sentences:
Need 3D RPG development library/framework recommendations I’m currently planning to develop an RPG. It will be a project I do in my free time. No pres-sure behind it. I’ll probably be doing it together with a friend and it’s just supposed to be a fun project, something we just work on, if we like to. Although it is a private fun project, I will make arrangements for this project, like project management and detailed documentation etc. I will also have a look at this thread and gather more information before starting.

An important choice I have to make is what libraries or framework I want to develop the game with. I know that there isn’t a BEST library, but maybe someone with some experience can recommend a fitting library. Maybe I just write down what my “requirements” are.

C++
Offline RPG
Running on Windows will suffice
Therefore I tend do Direct3D, contradictions? Proposals? OpenGL?
Well documented API

If you need some more specific information, just tell me.

If you can recommend libraries, how is multithreading done in those? Are new threads created implicitly? I’d just like to know as much as possible about what is coming to me, before starting.

Thanks in advance!

sentences:
How to deal with raw values and percentages? What is the standard practice for dealing with attribute modifiers in games where units have attributes, such as RTSs, MOBAs and RPGs? Specifically, in which order are "buffs" given to the unit?

Suppose the case where unit X has 10 blah-points (BP). It obtains two modifiers that add +10% blah-points, and another one that adds 30 blah-points. Finally, a enemy unit applies a -40% blah-points modifier. What is the usual way of processing this, for player familiarity's sake?

Aggregate by grouped type

  (10+30)*(1.0+0.1-0.4) = 28

Obtention order

  (10*(1.1)+30)*(0.6) = 24.6

Aggregate iteratively by type

  (10+30)*1.1*0.6 = 26.4

Some other way?

sentences:
Composition and passing pointers to parent, or work inside namespaces My application right now has a Game class, which contains other classes that receive a Game pointer. Also these classes passes the Game* pointer to their subclasses. I do this to keep communication between objects. Is this a bad way to keep all communicated? This looks like a "god object" antipattern.

The only alternative I've found to avoid this is simply instanciate my objects globally, inside namespaces, like they did int his project https://github.com/thelaui/M.A.R.S. . But this also looks as an antipattern, where almost everything is global.

What is then the correct way to design a program where the objects keep communicated?

Or the objects shouldn't keep communicated? Which looks hard to make a game.

sentences:
libgdx- tilemap rendering problem I don't really know how to describe my tilemap rendering problem with words, so I think the best way is to show the pictures.
This is how my map looks like when it rendered correctly:

but when I move the player little bit (the camera follows the player) I get this weird result:

Notice how the tiles which generating the floor got this strange shape, like they are not align correctly.
I do have a padding in my tileset, so I'm not sure this is the problem.
I also tried to round the camera position to integers, but it's result was always rendered like the second picture (the unwanted way), instead of sometimes correctly and sometimes not.

What else can be the issue?

EDIT: I noticed now that this problem happened only when the camera reach to the edges points of the tilemap, and also right at the beginning of the program running (when the player is at his first position, before any movement was made).

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:
Move Sprite in direction of rotation I have the following code.

void Update () {

        if (Input.GetAxis("Vertical")!=0)
        {
            GetComponent<Rigidbody2D>().AddForce(-transform.right);
        }

        if(Input.GetAxis("Horizontal")>0)
        {
            GetComponent<Rigidbody2D>().transform.Rotate(Vector3.forward * rotationSpeed);
        }

        if (Input.GetAxis("Horizontal") < 0)
        {
            GetComponent<Rigidbody2D>().transform.Rotate(Vector3.forward * rotationSpeed*-1);
        }
    }

This obviously moves my sprite in an asteroids fashion. What I really want is the sprite to track the direction it is facing (ie like a car) so as you rotate the sprite it continues its movement in the direction it is facing rather than the initial direction the force was applied.

sentences:
LWJGL/Java - Implementing a writeable text box? I would like to create a writeable text box where a user can input text into it. A nice "send" button that the person could click to send the text to the server would also be nice.

I currently haven no idea how to do this and I do not see any tutorials on how to do this.

I am using LWJGL and Java, and also I am using the Slick2D library.

Thanks!

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: Publishing a game on Steam without going throught Greenlight Is there any possible way to publish a game on Steam without going through Steam Greenlight?

sentences: Disable spaces in InputField This is straight forward. I have an input field and I want to restrict the user of inputting any spaces. I was thinking to make a script that checks if the user typed in a space and then remove it, but is there a simpler way of doing this?

sentences:
Shaders and Performance I'm coding my first Shader in my little game engine, and I have some questions about it's performance and common approaches.

Is the Shader code processed by the video card instead of the PC processor? Just so I know if it's possible to share some calculations to save some processor power.
Generally, should I do the math calculations in my code or the Shader? I could calculate them all (lightning for example) and just send the final values to be multiplied/used to the Shader, but what's the best approach?
Shaders as far as I could understand are the main party responsible for visual effects, so for example, if I want to add a "blur" effect to only one object on screen, should I use an if/switch statement in the Shader or should I have different Shader/ProgramIDs and I just switch the call glUseProgram(programID)?

Sorry if some questions seems stupid, and thanks for your time!

sentences:
Store metadata for tile in Tiled Map Editor In my tilemap-based game, I need to associate lights with light switches, buttons with doors etc. I am using the Tiled map editor (mapeditor.org), but I have yet to find a way to store these associaltion. My idea is to store a number with each tile, so I can have groups of tiles that interact with each other.

Is there a way to store custom data with each tile in the Tiled map editor? Just to be clear: I don't want to store custom data with each tile type, but with individual instances of one tile type.

sentences:
Formula to calculate Level and Current Experience from Total Xp So I'm building a mobile game where I have simple XP progression system that goes like this:
Level1: 0-399 Total XP
Level2: 400-1199 Total XP
Level3: 1200-2399 Total XP
So basically for the first level the player needs 400 XP to level up. Once it reaches that the exp bar goes to zero and then needs 800 XP to level up, the XP bar goes to 0 and needs 1200 and so on.
I was wondering if there is a formula in order to calculate the current level of the player and the current experience (i.e. 400/800 when it has 800 total XP) from the Total XP.
EDIT:
So I found the formula Level = Floor(1/20 (10 + sqrt(2) sqrt(50 + TOTAL XP)))
but I still can't figure out the formula to find the Current XP
Thank you

sentences:
Normal map causing certain faces to get shaded I added a normal map to a MR arch & design material in Max 2012. I have a specular in the reflection color slot and a diffuse in the diffuse slot. As i increase the intensity of the normal map i certain faces get darker and they get really "obvious". Last time i was fiddling with this the exact same thing happened which made me quit normal maps and all. Some UV's are overlapping and the normal map is made with the Nvidia photoshop plugin. My scene just has a daylight system with a MR sun and MR sky.

Does anyone have an idea what is causing this?

As you can see the face gets shadowed as a whole. The face next to it has the same problem on the opposite corner you see the same effect but much less hard.

sentences:
How do I make complex AI manageable? In the past, I've used simple systems like finite state machines (FSMs) and hierarchical FSMs to control AI behavior.  This pattern falls apart very quickly or any complex system.

I've heard about behavior trees. They seem like the next obvious step, but I haven't seen a working implementation or really tried it yet.

What other patterns can make complex AI behaviors manageable?

sentences:
Calculating vertex normals to be able to have both sharp edges and smooth gradients I'm computing area-weighted vertex normals, but lighting looks bad on meshes containing sharp edges and corners (e.g. cubes look 'blobby' as the light leaks onto the dark sides).

Is there a way of calculating/using vertex normals to preserve sharp edges and still have smooth regions? Ideally, without the need to create extra geometry (e.g. splitting faces adjacent to a sharp edge and creating new vertices).

Most sources talk about having different 'smoothing groups' which influence geometry generation.

Could someone explain what are "per-corner" normals?
From Libigl tutorial:
"Storing normals per-corner is an efficient and convenient way of supporting both smooth and sharp (e.g. creases and corners) rendering."

sentences:
multiple contacts for SAT collision detection I have implemented SAT algorithm for obb-obb intersection and I am able to generate a contact for this collision type. My problem is that SAT only generate ONE contact and in many situation I need more than one contact. For example, If I have a big cube and above it I have a small cube I need two contact (two contacts in 2D and 4 contacts in 3D) one for each bottom vertex of small cube.

My question is how can I generate more than one contacts with SAT?

Thanks.

sentences:
RGB to xyY color space conversion and luminance The luminance calculated by following GLSL functions (fragment shaders - tonemap) has different value:

float GetLuminance (vec3 rgb)
{
     return (0.2126 * rgb.x) + (0.7152 * rgb.y) + (0.0722 * rgb.z);
}

vec3 RGB2xyY (vec3 rgb)
{
     const mat3 RGB2XYZ = mat3(0.4124, 0.3576, 0.1805,
                               0.2126, 0.7152, 0.0722,
                               0.0193, 0.1192, 0.9505);
    vec3 XYZ = RGB2XYZ * rgb;

    return vec3(XYZ.x / (XYZ.x + XYZ.y + XYZ.z),
                XYZ.y / (XYZ.x + XYZ.y + XYZ.z),
                XYZ.y);
}

I used a glm library to calculate an example result. For glm::vec3(2.0f, 3.0f, 8.0f) GetLuminance returns 3.1484. RGB2xyY returns glm::vec3 which z component is equal 3.8144. What is wrong ?

sentences:
Unity: Instantiate an object respecting the prefab's default rotation Simple question, I hope.

I've built a variety of prefabs for an isometric shooter game (hazards, enemies, health indicator bars, popup texts, shots, explosions).  All of these prefabs were constructed with default rotations appropriate for the gameplay.

My problem is that Instantiate() will overwrite the default rotation of the prefab with whatever is specified as the rotation parameter.  So I'm left with hard-coded rotations in my Instantiate() calls to get things oriented correctly in the X-Z plane. (0,180,0) and (90,0,0) are common ones.  I'd much prefer to Instantiate prefab gameObjects consistently with "no change to their default rotation," but I'm not sure how to accomplish this.

Thanks for the help,
Mike.

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:
How to make a 2D neon-like trail effect in Unity Recently I've been toying around with neon-ish effects for a game I'm making and wanted to share my results with you.

If you guys have any other methods of achieving this result, please be sure to share.

sentences:
Unity) What should i do if i want to change sprite animation in same action? My character has Idle-Walk-Jump-Attack state in animator.
and it can change its appearance when it gets an item.
for example, it can equip sword or armor. and i need to change whole sprite. the sword and armor are not separate with body.

which is best way to handle it?

before get item) Idle-Walk-Jump-Attack with sprite set 1.

after get item) Idle-Walk-Jump-Attack with sprite set 2.

how can i change animation state after get item? do i make every animation state in Base Layer?

sentences:
Randomly generated story I'm developing a game at the moment and I had an idea where the game's story line would randomly generate as the player progressed and their actions would affect the story.

Would this be a bad idea in terms of gameplay or would a storyline that has multiple endings be the best idea?

sentences:
How do I convert an image into a tile map? I am working on a game in Pygame/Python, and I'd like to turn an image into a map.

The idea is simple: Pixels in the image are colored by tile type. When the program loads the image, I want the color (e.g. #ff13ae) to be matched to a certain grass tile, and the color (e.g. #ff13bd) to a different tile.

I know that I may have to convert from hexcodes to RGB, but that is trivial. I just want to know the way I to go about loading an image file, mainly because all my other games don't do anything of this sort.

sentences:
How to get a difference of angles in one mathematical expression? I need to do this for AI and also range calculation over a curved surface.

I have two angles, a1 and a2, which can be in the range from 0 to 359. I need to calculate the difference between them, and it has to be the inside angle (smallest angle), not the "reflexive" outside angle. And it has to preserve the direction from a1 to a2, which will be positive if going counterclockwise and negative if going clockwise.

Examples of what the function should yield:

scr_ang_diff(30, 50) == 20

scr_ang_diff(80, 310) == -130 // NOT 230 !!!

scr_ang_diff(130, 130) == 0

Now I could do this with test cases, but it seems there should be a way to do this in one mathematical expression. I can no longer use the simple min of abs of the two differences (without test cases) because that doesn't preserve direction.

EDIT: in order to differentiate between this post and this, I've decided to make it mandatory to preserve direction between a1 and a2.

Super bonus points if a1 and a2 can have range -359 to +359.

NOTE: yes efficiency matters. That doesn't mean you can't use trig functions, it just means I'll pick the least complex solution.

sentences:
How do I implement delta-only data packet updates in UDP? Edit: My current system is going to be to send constant player updates every 1/20th of a second, each containing the player's status and position. I will also send another packet (or as many needed) every 1/20th of a second with the information of all the bullets, using this format to save space (the number representing the space in a packet):

1: Owner's ID
1: Type
1: Amount of bullets (so I don't have to include this info each time)

3: X coord
3: Y coord

I am currently writing a co op game to play at LANs, and have run into the issue of dealing with many entities and game updates. I only have implemented player movement, and the packets sent include the player's position for 3 ticks (as packets are sent and received every 3 ticks).

I have also implemented a system to keep track of the delay between client and server (sending the tick the server/client is at and comparing it to with the receiver's local tick).

This has worked thus far, however I have run into trouble with sending bullet information. It would be unfeasible to send the position of the bullet every update, as I would only have room for ~160 bullets + players per packet.

I thought of just sending the information that a bullet has been created and enough information for the client to simulate the bullet flying, such as velocity, angle, lifetime, and owner, and sending information when the bullet has been destroyed (via impact, lifetime, or otherwise). This got me thinking if it is possible to only send the keystates of a client to other clients via the server, to reduce the space required for co-ordinates and to increase smoothness of movement(floats will be used in this case instead of the current ints, as I have found difficulty transmitting floats).

This raises the concern of packet loss, and that with it the game could easily go out of sync. I have read of sending acks, however I am unsure if this will give me the wanted result. I have also read about sending a full game state ever so often, and this seems to me to be the best solution. What should I do to fix the issue of space and to reduce the space required for transmitting movement? And if it's the full game state solution, how often should I resync the clients? 5 seconds? 10 seconds? How do other games do it? I have read that the steam engine almost never does this, however it has many systems set in place to prevent packet loss and resending lost packets and I feel that I am unable to code all that.

sentences:
Is it legal to use car manufacturers' names in a game? Is it legal to use car manufacturers' names in a game?

For example:

to describe Audi's quattro drive system?
to display a rendering of an Audi?
to include a photo (to which I have rights) of an Audi?

sentences:
How to produce a texture to represent a vector field I would like to be able to produce a texture that essentially represents a 2D vector field (eg red represents vector {1, 0}.

What I would like is to draw a path and the vector at the point on the path should be tangential to the path. Ideally, I would like the path to be thick (i.e. the points on the path are the tangent colour and then all points within r perpendicular to the path at that point are a smaller version of that vector). All other points would have the zero vector.

So for example, if I had a circle path, the vectors would push a particle around the circle.

How would I easily produce this texture? I am currently considering writing a tool that parses a SVG file and produces a bitmap that can be used but I'm wondering if there are existing tools that do this already.

NB: I tried to tag this with "vector-fields" as I believe this could be a common theme (since UE4  supports using them with particles), but don't have enough rep to create the tag.

sentences:
Find the coordinates between two points based on third You can see two points in this picture. Points are surrounded by collider which is set to trigger. Points can either be Vector3 or Vector2, shouldn't make any difference.

I need to get the coords on gray line if mouse enters the trigger, at the exact point where mouse and gray line form 90 degree angle. Gray line is just an straight line between 2 points.

All the data:

left point coords
right point coords
mouse coords

Is it possible with the data I have and how?

sentences:
How to prevent collisions between instantiated prefabs I'm creating a virtual creature evolution system like here.
This type of project requires to define creatures, which are made of some 3d boxes and simulate them over and over again, making little changes along the way, until the point where they are good enough at a certain task. Basically, I'm using Genetic algorithms. I'm going to be doing a lot of simulation (a few hundred creatures each generation, times X generations, where X could be in the thousands).
In order to save time, I want to simulate multiple creatures at once, so I must run collision checks efficiently. Each creature exists on its own and therefore should not be bothered by other colliders except himself and the ground.

I have a prefab of a creature. Each creature is made of multiple 3d boxes with colliders. The nodes in the same creature should collide with themselves but should not collide with nodes that are in other creatures (because it should learn to perform based on the environment as it is). What is the most efficient way I could do this?

I thought about checking the root of the collision object but that just prevents the collision and doesn't eliminate the useless checks that are being made. I've also looked at solutions involving the "Layer Collision Matrix" but still could not find a way to make it work.

Thanks in advance.

sentences: (love2d)How would I go about drawing the same image multiple times? Obviously I could just copy and paste a love.image.draw() function multiple times for how many times I want the item to be drawn, but lets say I wanted to draw an image wherever the mouse is clicked at. How would I go about making it so it draw said item every time I clicked. If I only clicked twice it would draw two objects, and if I clicked it 500 times it would draw 500 items, without having to have 500 different draw functions?

sentences:
Calculating required force for pushing a body to a desired position at once in Unity In a 3D world I simulate that a coin is being pushed over a plane (applying a force in his rigidbody where y-axis = 0) using a top-down view.

Some time ago but using Box2D, I was able to calculate the amount of force required to stop the coin in a desired position with just one push.

Box2d-js

var fps=60;
var groundFriction = 0.01;
var force= new Box2D.Common.Math.b2Vec2(distance.x * coin.box2dBody.GetMass() * fps * (groundFriction * fps),
      distance.y * coin.box2dBody.GetMass()* fps *(groundFriction * fps));
coin.box2dBody.ApplyForce( force, coin.box2dBody.GetWorldCenter(), true );

In order to simulate the friction, during the update, I substracted the groundFriction(0.01) to the linearvelocity of the objects in movement in every frame.

Now using Unity with a more complex physics engine I cant replicate the same.

Unity3d

Vector3 posFinal = transform.position + direction * distFinal;
Vector3 distanceVecFinal = posFinal - transform.position;
float fps= 1/Time.fixedDeltaTime //50 fps
Vector3 force = new Vector3(distanceVecFinal.x  * myBody.mass * fps, 0,
     distanceVecFinal.z  *    myBody.mass * fps);
myBody.AddForce(force);

I think that in the final formula I should add the friction of the objects, but I am not sure how to do it. Maybe this is not the only thing that I should change.

I need help pls!

tl&dr Calculate the required force for making move an object to a desired position in a plane with just one push.

sentences:
I need to keep music playing but still be able to mute it between games, how? I have a game built in Unity.  The game plays music continuously, which can be muted on button press on the scene.  This works fine using the below code:

MuteButton.cs

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

public class MuteButton : MonoBehaviour {
    public GameObject audioObject;
    private AudioSource audioSource;

    void Start()
    {
        Button b = gameObject.GetComponent<Button>();
        b.onClick.AddListener(Pause);
    }

    void Pause() {
        Debug.Log("mute toggle");

        audioSource = audioObject.GetComponent<AudioSource>();
        if(!audioSource.isPlaying) {
            audioSource.Play();
        } else {
            audioSource.Pause();
        }
    }
}

However, when the player loses the game restarts by reloading the scene, using this code:

public void Restart()
{
    SceneManager.LoadScene(SceneManager.GetActiveScene().buildIndex);
}

In order to keep the music running I have attached the following script to my music game object:

using UnityEngine;
using System.Collections;

public class Music : MonoBehaviour {
    static Music instance;
    void Start() {
        if(instance == null)
        {
            instance = this;
            DontDestroyOnLoad(gameObject);
        }
        else if (instance != this)
        {
            Destroy(gameObject);
        }
    }
}

All working fine up until now.  Once the scene is reloaded when the user tries to mute the music I get the following:

MissingReferenceException: The object of type 'GameObject' has been destroyed but you are still trying to access it.
Your script should either check if it is null or you should not destroy the object.

I understand that the error is that I'm trying to mute a now non-existent game object, but how can I pause the music if this is the case?

sentences: How do I make something visible only when I'm looking at it? So I'm making a basic 2D game in C# XNA. I want it so wherever my character is facing there is a cone of light and only that part of the level is visible while the right of the screen is dark. Please excuse my ignorance, I haven't been working with C# too long.

sentences:
Is it a good idea to simplify a character-driven game engine to the point where it's unnecessary to learn scripting/programming? I remember, and I still think, that one cannot even make a prototyped 3D game to test just simple behaviors without using gigantic tools like unity or knowing extensive C++ programming, design patterns, a decent or basic 3D engine, etc.

Now I'm wondering, since I know programming, whether I'm even more lucky than the ones who need to learn programming before knowing how to make something. Even scripted engines such as Unity are not for kids, and to my sense they tend to dictate their ways of doing things. This is not the case with engine like Ogre or Irrlicht.

Now I'm thinking that character-driven games occupy a big part of the game market. Do you think it is a good idea to make a character-control oriented game engine which only allows building AI to the exclusion of anything else?

When I say prototype, I also mean "generic" in the sense that one can quickly choose from a set of gameplay parameters such as the scene manager, the camera POV of the player, the controls, some very basic collisions/physics, and integration of basic steering (OpenSteer for example). The main idea is to make an AI sandbox but in 3D, so it can be demonstrated without the 2D constraints (and also make it more fit to prototype in 3D for a 3D project instead of 2D).

sentences:
How to connect two Iphone/ipod/ipads for gameplay over local wifi network? I would like to add the option to play against another person over my wifi network in my pong game. How do I make this happen?

Also, I would like to know how to be able to have 4 players at the same time like I would if I make a monopoly type game or something similar.

I'm a newbee so please point me in the right direction or show me some code I can use for this and study.
Thanks guys
David

sentences:
Entity Component System, weapon I'm new to game programming and currently trying to understand Entity Component System design by implementing simple 2d game. By ECS I mean design, described here for example

In my game I have different kind of weapons: automatic, gun, grenade, etc...
Each type of weapon has it's own affect area (gun shots along the straight line and grenade explodes and covers some spherical area) , damage impact, visual effect and bullet amount, delay between shots. So I don't completely understand how to implement weapons. Should weapon be an Entity or it should be a component? And how the player should pick up a weapon, switch between different types of weapons and etc.

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:
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:
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: 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: Rushing water in Unity How would I go about creating a river with rushing water?  I can do the texture around it but I'm stuck on the actual water part.  This is in Unity3D.

sentences:
Unity 5.5 and Parse 1.7.0 on iOS 64-bit We are using Unity 5.5 and Parse 1.7.0 (and Firebase for notifications) which doesn't have "Parse.Unity.dll" and while on Editor everything is working fine but when we build using "IL2CPP" on iOS; while running on device the game produces an error of "MissingMethodException: No constructor found for Parse.Common.Internal.FlexibleListWrapper`2".

I think it's because of stripping, I've tried to include "Parse.Core" and "Parse.Common" in "link.xml" but still same error while I was looking for solutions I found that there's a file "Parse.Unity.dll" that should have been in the project from the start but when I try to include it in our project another error but this time in Unity Editor that says "System.Threading.Tasks.Task is defined multiple times" and that's because -I think- the new Parse.Unity.dll and Unity.Task.dll from Firebase, if I try to delete that firebase Dll another error appears....

Please any help is appreciated :(

We have to build with il2cpp to upload on the App store, Android version works fine.

sentences:
Touch goes through UI objects on mobile I know this question has been asked a lot of times, and I have tried the solutions that were provided and I still have no valuable result, so I thought...maybe a new set of eyes could help.

I have a game in which the player can navigate around the scene environment using a virtual joystick and look around the scene by scrolling through the screen(like it is seen in most mobile fps games).

The problem that I am having now is that my "look around" script allows touch inputs to pass through UI elements on mobile, but everything works fine on the editor.

Useful tips:

1) I am using Unity 2019.3.0f5

2) I setup the script to work with Cinemachine Free Look, and my script(seen below) is attached to it.

Here is my code:

using UnityEngine.EventSystems;
using UnityEngine;
using Cinemachine;

public class CinemachineCoreInputTouchAxis : MonoBehaviour
{
private readonly float TouchSensitivity_x = 10f;
private readonly float TouchSensitivity_y = 10f;

[SerializeField] private bool UseTouchControls = true;

private static int Index = 0;

void Start()
{
    if(UseTouchControls)
        CinemachineCore.GetInputAxis = HandleAxisInputDelegate;
}

private float HandleAxisInputDelegate(string axisName)
{
    switch (axisName)
    {
        case "Mouse X":
            if (Input.touchCount > 0 && !IsPointerOverUIObject())
                return Input.touches[Index].deltaPosition.x / TouchSensitivity_x;
            else
                return Input.GetAxis(axisName);
        case "Mouse Y":
            if (Input.touchCount > 0 && !IsPointerOverUIObject())
                return Input.touches[Index].deltaPosition.y / TouchSensitivity_y;
            else
                return Input.GetAxis(axisName);
        default:
            Debug.LogError("Input <" + axisName + "> not recognized.", this);
            break;
    }
    return 0f;
}

public static bool IsPointerOverUIObject()      //Called to check if the pointer is over a ui object
{
    bool value = false;
    for (int i = 0; i < Input.touches.Length; i++)
    {
        Index = i;
        value = EventSystem.current.IsPointerOverGameObject(Input.GetTouch(Index).fingerId);
        if (value)
            break;
    }
    return value;
}
}

Can anyone please let me know what I am failing to see and how to fix it?

sentences:
most flexible way to implement a buff /debuff system for a RPG game I'm making an RGP board game where I have different heros, each one of them belongs to some types

for example ("Aatrox" is a Dragon and a Ninja hence he belong to these two types),and each player has a

list of champion with fixed attirubtes like basicAttackDamage,criticalstrike/chance/ability..etc

and i have what are called as buffs, a buff gets activated to player when his some of his heros

belong to certain types

eg: if a player gets two Dragons or more , then every hero whose type is Dragon gets double Damage

Attack, TrueDamage(Ignore magic resist and armor), Attack..etc

so i was wondering what would be the most flexible way to implement these sort of buffs considering the

fact that each champion could only use his attack/ability once in each round and there are buffs that

gets added with a certain chance "this buffs gives the hero 40% chance to stun the enemy with basic

attack, and buffs which add health to heros ("this buffs give the hero 250 extra health") etc..

my current approach is to add tags on buffs and apply these buffs when attacking or defending an attack

so this would look something like

enum BuffsType{
OnHit,OnAttack
}

but this approach kinda fails at complex buffs like "a chance to hit extra

attack/extra enemy/". I have seen some discussions about this but none of the answers seemed to be REALLY flexible, most of them failed at complex buffs

design-patterns software-design

sentences:
how can I transform a skewed line to a vertical line? So, I have a line:

And I skewed it with x += y * cos(angle)

and got something like:

My question is, if I have another line segment with that same skew, how can I transform it so that it is pointing up again like:

I tried just applying a rotation (reverse of the skew angle) to the line's x,y coordinates, but that did not seem to give me the effect I am going for.

How can I do this?

EDIT

So, if I start with a rectangular like:

and I apply:

x1 = x1 + (y2 - y1) * cos(angle);
x2 = x2 + (y2 - y1) * cos(angle);

I get:

I am not quite clear why my x1 is wrong? (as you can see, it extends outside of the rectangle)..

But, regardless of that, this still is not the direction I am trying to skew by... What I really want is something that looks like this:

sentences:
How to resolve multiple simultaneous ball collisions in a pool game? I'm trying to simulate a break shot in billiards (1 ball hits a pyramid of 15 balls).
The formula for 2D ball collision works correctly in my game. But when it is applied to the break-shot, the result doesn't look realistic. (Only the 2 balls in the corners of the pyramid move, but the rest stays in place).

The problem is that because 15 balls are touching each other, there is an "infinite" number of simultaneous collisions following the first one.

What algorithm or formula can be used to resolve that?

sentences:
How to add a fluorescent effect on an image in Unity I have recently been attempting to create a true on-screen representation of a fluorescent orange colour on an image. Whereby, I believe post-processing with unity will deliver the best results.

Thus, I was wondering if someone could kindly guide me through the steps to add a fluorescent effect to my image?

As a reference I would like to try match pantone 804c on screen.

Image in question:

I have tried to follow tutorials like this, but unfortunately they all are working on 3D scenes. I have a pre-existing jpg image that I want to modify.

sentences: How to adjust GUI to screen resolution ? I've created a GUI for my XNA game and now I'm stuck with a problem. My GUI element positions are designed for a max resolution of 1920x1080, and if I try changing it to 640x480 they disappear from the screen. What I can change to keep them there?

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:
How do I balance skill/luck in a forum game? I am trying make a forum game where members of the forum can play daily, with role-playing elements, and tactical decisions. I've hosted werewolf games before, but I want this to be a little more involved. Mt new venture is a U-Boat game, where 10 members of the forum can sign up.  The game takes places in several phases, such as Patrol, Intercept, Attack, Evasion, Re-engage/Escape. In each phase the forum spits out some situations based on random numbers generated by the forum. The players make decisions and the results of their decisions advance the game to the next phase (or not).

For example: in the Patrol phase, the players basically roleplay, chat, and BS...entertain themselves. Each day the random number generator cranks out a number for contact. Let's say the RNG spits out a 90, which means enemy convoy spotted. (89 and less, no contact; 90 and up = contact).

The game moves to the Intercept phase, and the RNG spits out a number that tells the player the course of the convoy. In simple terms, the convoy can be moving away from the U-boat, parallel, towards, etc.

Here's where I need help: the players should make some kind of decision, such as "flank speed toward the convoy", "flank speed 45 degrees port" to intercept a convoy on a parallel course, etc. Now, how do I grade the decision?

How do I construct it so that the smarter/safer his choice, the better the results? Obviously, I cannot use the RNG for the outcome, there has to be some way to balance his skill in making a good decision.

Anyone have any ideas? I apologize if this is not the right place to ask this type of question.
thanks!
Neal

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:
Why does OpenGL seem to ignore my glBindTexture call? I'm having problems making a simple sprite rendering. I load 2 different textures. Then, I bind these textures and draw 2 squares, one with each texture. But only the texture of the first rendered object is drawn in both squares. Its like if I'd only use a texture or as if glBindTexture don't work properly. I know that GL is a state machine, but I think that you only need to change active texture with glBindTexture.

I load texture with this method:

 bool CTexture::generate( utils::CImageBuff* img )
 {
  assert(img);
  m_image = img;
  CHECKGL(glGenTextures(1,&m_textureID));

  CHECKGL(glBindTexture(GL_TEXTURE_2D,m_textureID));
  CHECKGL(glTexParameteri(GL_TEXTURE_2D,GL_TEXTURE_MIN_FILTER,GL_LINEAR));
  CHECKGL(glTexParameteri(GL_TEXTURE_2D,GL_TEXTURE_MAG_FILTER,GL_LINEAR));
  //CHECKGL(glTexImage2D(GL_TEXTURE_2D,0,img->getBpp(),img->getWitdh(),img->getHeight(),0,img->getFormat(),GL_UNSIGNED_BYTE,img->getImgData()));
  CHECKGL(glTexImage2D(GL_TEXTURE_2D, 0, GL_RGBA, img->getWitdh(), img->getHeight(),
   0, GL_RGBA, GL_UNSIGNED_BYTE, img->getImgData()));

  return true;
 }

And I bind textures with this function:

void CTexture::bind()
 {
  CHECKGL(glBindTexture(GL_TEXTURE_2D,m_textureID));
 }

Also, I draw sprites with this method

void CSprite2D::render()
 {
  CHECKGL(glLoadIdentity());
  CHECKGL(glEnable(GL_TEXTURE_2D));
  CHECKGL(glEnable(GL_BLEND));

  CHECKGL(glBlendFunc(GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA));
  m_texture->bind();

  CHECKGL(glPushMatrix());

  CHECKGL(glBegin(GL_QUADS));
  CHECKGL(glTexCoord2f(m_textureAreaStart.s,m_textureAreaStart.t)); // 0,0 by default
  CHECKGL(glVertex3i(m_position.x,m_position.y,0));

  CHECKGL(glTexCoord2f(m_textureAreaEnd.s,m_textureAreaStart.t)); // 1,0 by default
  CHECKGL(glVertex3i( m_position.x + m_dimensions.x, m_position.y, 0));

  CHECKGL(glTexCoord2f(m_textureAreaEnd.s, m_textureAreaEnd.t)); // 1,1 by default
  CHECKGL(glVertex3i( m_position.x + m_dimensions.x, m_position.y + m_dimensions.y, 0));

  CHECKGL(glTexCoord2f(m_textureAreaStart.s, m_textureAreaEnd.t));  // 0,1 by default
  CHECKGL(glVertex3i( m_position.x, m_position.y + m_dimensions.y,0));

  CHECKGL(glPopMatrix());

  CHECKGL(glDisable(GL_BLEND));
 }

Edit:
I bring also the check error code:

int CheckGLError(const char *GLcall, const char *file, int line)
{
    GLenum errCode;

    //avoids infinite loop
    int errorCount = 0;
    while ( (errCode=glGetError()) != GL_NO_ERROR && ++errorCount < 3000)
    {
        utils::globalLogPtr log = utils::CGLogFactory::getLogInstance();
        const GLubyte *errString;
        errString = gluErrorString(errCode);
        std::stringstream ss;
        ss << "In "<< __FILE__<<"("<< __LINE__<<") "<<"GL error with code: " << errCode<<" at file " << file << ", line " << line << " with message: " << errString << "\n";
        log->addMessage(ss.str(),ZEL_APPENDER_GL,utils::LOGLEVEL_ERROR);
    }
    return 0;
}

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:
Instancing with the SharpDX toolkit I am starting on the graphical portion of my project and before I begin I need to get Instancing working.  I can do instancing with SharpDX, but not with the Toolkit Models. The main reason I want to use the Tookkit is for loading models, textures, fonts, etc...

The most helpful thing for me would be a link to an example that instances a SharpDX.Toolkit.Graphics.Model -- but anything the shows the Model working with a custom effect should be fine... I can make instancing work from there right?

I have searched and searched for that though so I am not too hopeful - so if this is not something easily done alternative solutions would be great. As I said, I can use SharpDX without the toolkit just fine - but I want the benefits that come with loading models and fonts mostly.

sentences:
Vuforia AR/VR sample with Google Cardboard SDK: I cannot switch from augmented reality to virtual reality I have followed the Integrating Cardboard to the AR/VR Sample latest tutorial. I have configured the provided scene sample according to that tutorial. I have compiled it to Android without any problem.

The game load an AR scene with a yellow pointer in the center. If I understood well, if a glaze at the ImageTargetStones GameObject, it will switch to VR. Unfortunately I cannot find that GameObject anywhere. I only see the AR scene with nothing than the yellow pointer.

I don't find what I'm missing. Why is not that ImageTargetStones GameObject in the AR scene?

UPDATE 1

I think I want to use Vuforia for an uncommon use. I think that's a reason of a possible misunderstanding.

I don't want to use its image recognition possibilities. I want to switch between AR to VR when glazing to a button.

I have tried to duplicate the VRButton to move it to an independent place of the scene with no parent. I have checked its IsTrigger checkbox. I have added a PointerEnter EventTrigger that set Focused to true. I have added a PhysicsRaycaster to both AR Camera and MainCamera (child of CardboardMain-Head).

Nothing happens when I gaze at the button. I have to compile everytime I want to try it by the way. I did not manage to make it work in the editor.

UPDATE 2

I haven't been able to do it with vuforia yet. I have done it with WebCamTexture. Specifically, I have used the scripts of this answer: http://answers.unity3d.com/answers/687987/view.html . The result is not nice because the image from camera seems closer than it actually is (with Vuforia, there is not that problem)

sentences:
Approximating Subdivision Surfaces with Gregory Patches for Hardware Tessellation I'm trying to implement the approach (http://research.microsoft.com/en-us/um/people/cloop/sga09.pdf).
Unfortunately I'm not quite clear regarding the formulas in chapter 3, I am hoping to get some answers.

I am unclear on the following points, did you figure them out?

what kind of value do I get, when I calculate T(u,v,w) (a point?) and
what do I do with the result?
do I recieve the values u,v,w from the domain shader SV_DomainLocation or are they calculated?
are the corner points in chapter 3.2 barycentric too?
does v get replaced by p0 in figure 5?
In chapter 3.3 Edge Points there is a formula for e0+, but none for e0-? For which edge is e0+ in figure 5? and how can I calculate e0+ for the other edges? It seems for me (figure 5) there are 5 edges, but just one e0+ is calculated, shouldn't there be 5 e0+?
Do you maybe have a diagram of the controlpoints in relation to the control mesh? I am having problems seeing the big picture...
In chapter 3.4: face points,  you mention different transversal vectors r, r0+ and r0- but there is only one formula for r0+.  Are r = r0+ = r0-?  If not, how do I calculate r and r0-?

I am hoping someone could point me in the right direction, thank you in advance!

sentences:
How can I completely hide and protect strings from the player in Unity? I have been using Unity to create a 2D game which will be completely offline (which is the problem), the game-play needs you to enter certain strings at certain levels and Unity compiles to DLLs, which can be easily reverse engineered, so is there a way to protect those strings (the game is offline so I can't retrieve from other source)?

The game relies heavily on those strings, and yes I'm aware of Obfuscation but I want something more robust. And I know that the easy way out would be doing everything online from a data-source but I was wondering if it's possible.

It can be decompiled like this:

sentences:
Use large image individually, or in TextureAtlas? Does it make any sense to include a large image (with dimensions of say 1920x1080) in a TextureAtlas and then use it with libgdx for example?

Or should I rather use it individually and include the .png file into the assets folder as it is?

Thank you.

sentences:
GLSL Shader - Change Hue/Saturation/Brightness I'm trying to change the hue of an image using a GLSL fragment shader. I want to achieve something similar to Photoshop's Hue/Saturation Adjustment layer.

In the following image you can see what I've got so far. I want to change the hue of the green square so it looks like the red square on the right, but with this shader I get a half red half pink square (the square in the middle).

What I'm doing in the fragment shader is converting the texture's color to HSV, then I add the HSV color that I get from the vertex shader to it and I convert the color back to RGB.
What am I doing wrong?

Fragment shader:

precision mediump float;
varying vec2 vTextureCoord;
varying vec3 vHSV;
uniform sampler2D sTexture;

vec3 convertRGBtoHSV(vec3 rgbColor) {
    float r = rgbColor[0];
    float g = rgbColor[1];
    float b = rgbColor[2];
    float colorMax = max(max(r,g), b);
    float colorMin = min(min(r,g), b);
    float delta = colorMax - colorMin;
    float h = 0.0;
    float s = 0.0;
    float v = colorMax;
    vec3 hsv = vec3(0.0);
    if (colorMax != 0.0) {
      s = (colorMax - colorMin ) / colorMax;
    }
    if (delta != 0.0) {
        if (r == colorMax) {
            h = (g - b) / delta;
        } else if (g == colorMax) {
            h = 2.0 + (b - r) / delta;
        } else {
            h = 4.0 + (r - g) / delta;
        }
        h *= 60.0;
        if (h < 0.0) {
            h += 360.0;
        }
    }
    hsv[0] = h;
    hsv[1] = s;
    hsv[2] = v;
    return hsv;
}
vec3 convertHSVtoRGB(vec3 hsvColor) {
    float h = hsvColor.x;
    float s = hsvColor.y;
    float v = hsvColor.z;
    if (s == 0.0) {
        return vec3(v, v, v);
    }
    if (h == 360.0) {
        h = 0.0;
    }
    int hi = int(h);
    float f = h - float(hi);
    float p = v * (1.0 - s);
    float q = v * (1.0 - (s * f));
    float t = v * (1.0 - (s * (1.0 - f)));
    vec3 rgb;
    if (hi == 0) {
        rgb = vec3(v, t, p);
    } else if (hi == 1) {
        rgb = vec3(q, v, p);
    } else if (hi == 2) {
        rgb = vec3(p, v, t);
    } if(hi == 3) {
        rgb = vec3(p, q, v);
    } else if (hi == 4) {
        rgb = vec3(t, p, v);
    } else {
        rgb = vec3(v, p, q);
    }
    return rgb;
}
void main() {
    vec4 textureColor = texture2D(sTexture, vTextureCoord);
    vec3 fragRGB = textureColor.rgb;
    vec3 fragHSV = convertRGBtoHSV(fragRGB);
    fragHSV += vHSV;
    fragHSV.x = mod(fragHSV.x, 360.0);
    fragHSV.y = mod(fragHSV.y, 1.0);
    fragHSV.z = mod(fragHSV.z, 1.0);
    fragRGB = convertHSVtoRGB(fragHSV);
    gl_FragColor = vec4(convertHSVtoRGB(fragHSV), textureColor.w);
}

EDIT:
Using the functions Sam Hocevar provided in his answer, the problem with pink bands is solved, but I can only reach half of the color spectrum. I can change the hue from red to green, but I can't change it to blue or pink.

In the fragment shader, I'm doing this now:

void main() {
    vec4 textureColor = texture2D(sTexture, vTextureCoord);
    vec3 fragRGB = textureColor.rgb;
    vec3 fragHSV = rgb2hsv(fragRGB);
    float h = vHSV.x / 360.0;
    fragHSV.x *= h;
    fragHSV.yz *= vHSV.yz;
    fragHSV.x = mod(fragHSV.x, 1.0);
    fragHSV.y = mod(fragHSV.y, 1.0);
    fragHSV.z = mod(fragHSV.z, 1.0);
    fragRGB = hsv2rgb(fragHSV);
    gl_FragColor = vec4(hsv2rgb(fragHSV), textureColor.w);
}

sentences:
Fair spawning of players on a 2D grid As new players enter a game, they are given a location on a large grid. The first player is given the location in the center.

Now, how should the second player be placed? Then, the third and so on?

New players should be placed reasonably near some other players, but not so close as to cause bunching.

My current thinking is to trace a clockwise spiral around the first player, gradually moving further and further out from that initial point. But I keep thinking this must have been done before and that a general solution must exist.

This is for a strategy resource game (similar to CoC or Throne Wars etc).

How do I do this?

sentences: XNA project won't target .NET 4.0 I am trying to reference the System.Threading.Task assembly. If I am not mistaken, it should be part of mscorlib. But no matter what I do, my project always defaults to the .net 2.0 runtime. Even if I create a brand new XNA 4.0 Windows Phone project, it wants to use the .net 2.0 runtime. Any ideas what I could be missing?

sentences:
I want to blit a standing man on pygame I was making a game with pygame and python and I wanted to blit an image of a standing man and when a right key is pressed I want the man to run and when the right key is released I want the man to stand again... I tried to make it like that but couldn't work... here's the code I tried

import pygame
from pygame.locals import *
from sys import exit

pygame.init()

screen = pygame.display.set_mode((600,600))
pygame.display.set_caption('running man')

image_1 = pygame.image.load('standing-man.jpg')
image_2 = pygame.image.load('running-man-1.jpg')
image_3 = pygame.image.load('running-man-2.jpg')

move_x = 0
x = 0

clock = pygame.time.Clock()

while True:
    running_man = [0]
    #creates a loop and make the image look like its running by swithching the two man images
    for man in running_man:
        screen.fill((255,255,255))
        x += move_x
        #first i want a standing man to be seen on the screen and when a right key is pressed i want the other two images to blit on the screen
        if man == 0:
            screen.blit(image_1,(x,100))
        if man == 1:
            screen.blit(image_2,(x,100))
        if man == 2:
            screen.blit(image_3,(x,100))
        pygame.display.update()
        clock.tick(7)

        for event in pygame.event.get():
            if event.type == QUIT:
                exit()
            if event.type == KEYDOWN:
                if event.key == K_RIGHT:
                    move_x = +1
                    #here i want the variable running_man to be 1,2 so to blit the otherr images and remove the standing man image
                    running_man = [1,2]
            if event.type == KEYUP:
                if event.key == K_RIGHT:
                    move_x = +0
                    #when the right key is released i want the value of the variable running_man to be 0 again so to blit the standing man image again
                    running_man = [0]
        pygame.display.update()

sentences:
Soft body plasticity using Bullet Physics I made this post on the Bullet forum(link), but the forum is slow so I'm just copying the text from there.

Hello,

I'm currently working on a game and I want to make certain surfaces of the game world deformable by the user. I've already implemented soft bodies and mouse picking but I cant get the surfaces to stop returning to their original shape.

I should note that I use joints to keep the soft bodies stationary.

Does anyone know which settings I need to play with to get the desired effect? I'm very new to soft bodies so I don't understand a lot of the terms in the source code.

If bullet does not have the capabilities I need, does anyone know where I can read up on the topic and soft bodies in general?

sentences:
Task vs Thread with execution queue My game server will have to respond to requests very often, so I consider threading a good option.

But should I use Task class from .NET or have several threads that would execute requests which I would store in a queue (linked list). Which way would be faster?

sentences:
Slerping rotation mirrors I rotate my game character to watch at the target using the following code:

        transform.rotation = Quaternion.Slerp(startQuaternion, lookQuaternion, turningNormalizer*turningSpeed/10f)

startQuaternion is the character's current rotation when a new target is given.

lookQuaternion is the direction the character should look at and it's set like this:

    destinationVector = currentWaypoint.transform.position - transform.position;
    lookQuaternion = Quaternion.LookRotation(destinationVector, Vector3.up);

turningNormalizer is just Time.deltaTime incremented and turningSpeed is a static value given in the editor.

The problem is that while the character turns as it should most of the time, it has problems when it has to do close to 180 degrees. Then it at times jitters and mirrors the rotation:

In this poorly drawn image the character(on the right) starts to turn towards the circle on the left. Instead of just turning either through left or right it starts this "mirror dance":

It starts to rotate towards the new facing
Then it suddenly snaps to the same angle but on other side and keeps rotating

It does this "mirroring" so long until it looks at the target. Is this a thing with quaternions, slerping/lerping or something else?

EDIT1:
Apparently the issue does not arise from the rotating itself. The more likely issue is that the character moves toward the facing while it rotates. As limiting the angle, between facing and target, when the character is allowed to move reduces and at times eliminates the jittering/mirroring rotation.

This of course raises more questions, why cannot the character move and rotate at the same time without issues? Code used for the movement:

transform.Translate(Vector3.forward * runningSpeed/10f * Time.deltaTime);

sentences:
3D Vector "End Point" Calculation for procedural Vector Graphics Alright, So I need some help with some Vector Math.

I've developing some game Engines that have Procedural Fractal Generation for Some Graphics, such as using Lindenmayer Systems for generating Trees and Plants. L-Systems, are drawn by using Turtle Graphics, which is a form of Vector graphics.

I first created a system to draw in 2D Graphics, which works perfectly fine. But now I want to make a 3D equivalent, and I’ve run into an issue.

For my 2D Version, I created a Method for quickly determining the “End Point” of a Vector-like movement. Given a starting point (X, Y), a direction (between 0 and 360 degrees), and a distance, the end point is calculated by these formulas:

newX = startX + distance * Sin((PI * direction) / 180)

newY = startY + distance * Cos((PI * direction) / 180)

Now I need something Similarly Equivalent for performing this Calculation in 3D, But I haven’t been able to Google anything that could show me how to do this.

I'm flexible enough to get whatever required information is needed for this method calculation, in any reasonable form (Vector3, Quaternion, ect).

To summarize: Given a starting point/vector position in 3D space (X, Y, Z), a Direction in 3D space (Vector3, Quaternion, ect), and a Distance, I need to find the “End Point” in 3D Space.

Thank you for your time and help.

sentences:
Calculate angle between player and end point I have such question:

how to calculate angle between player and end point?

Things, which i have:

Player. I have X, Y, Z position of player and his Z-angle (0-360)
Endpoint. I have only X, Y, Z position of end point.

Task:

Rotated player Z-angle to end point.

How i can did this?

Please, help :3

sentences:
raylib - isometric camera, rotating to four corners of isometric map in 3d I am exploring raylib and am trying to create a 3d isometric map of cubes. Normally this is done by setting the camera to isometric with an angle x of 30 and angle y of 45 (sometimes it is angle x of -30 and angle y of 45).
I am not sure how to set the angle of the camera, I see there is an up vector, but its values seem to be limited to smaller values than 30 or 45. With this camera setup It appears to be isometric, though I'm not sure why.
Camera camera = {0};
camera.position = (Vector3){10.0f, 7.5f, 10.0f}; // Camera position
camera.target = (Vector3){0.0f, 0.0f, 0.0f};     // Camera looking at point
camera.up = (Vector3){0.0f, 1.0f, 0.0f};         // Camera up vector (rotation towards target)
camera.fovy = 10.0f;                             // Camera field-of-view Y
camera.type = CAMERA_ORTHOGRAPHIC;               // Camera mode type

This has the cube at position 0, 0, 0 at the top of the screen. This picture illustrates what I am seeing approximately:

If I change the position of the camera to:
camera.position = (Vector3){-10.0f, 7.5f, -10.0f}; // Camera position

Then I appromxiately see this:

Although it appears much higher on the screen. How do I go about rotating the camera from the first picture to the second picture? Also, how do I rotate the block at 0, 0, 0 to any other corner if the map has an even number of rows, columns?
I should add that simply tweening from 10, 7.5, 10 to -10, 7.5, -10 eventually does get to the second picture, but it inverts the map first (looks very strange), I want a circular rotation towards the second picture. The Orbital camera mode almost does what I want, but it seems move the map as well.

sentences:
Character controller falling with positive speed I'm having very weird problems with my player's vertical movement. I'm using a Character Controller component with a capsule collider and no rigidbody. For testing purposes, I've ended reducing my jump script to just this line:
    owner.CharacterController.Move(new Vector3(0, 0.01f, 0));

When executing this script, the player should just fly upwards at a constant speed, right? Well, what ends up happening is that the player starts jumping in place repeatedly. The jumps are smooth, as if the movement was being affected by gravity. I thought that the standard Character Controller doesn't handle gravity automatically and you have to do it yourself, so I can't understand what's going on here. There is no other code affecting the player, if I comment that line it just rests in place. If I try a different direction (like (0.01f, 0, 0)) the player moves in a straight line in the provided direction as expected. But when moving vertically, weird stuff happens :S

sentences:
Re scaling an object from its current scale to a scale of 0 I want to have an animation which starts at a starting scale of whatever the current gameObject's scale (i.e 1, 1, 1 or 2, 3, 2) is which then end at a scale of 0, 0, 0.

The problem is that Unity's animator has fixed values and so, I cannot make one animation that would easily apply to every object.

I'm fine with using C# code to do this but I haven't been able to find anything that works yet. Thanks for your help!

sentences:
What rotation needs to be applied to align mesh with expected axis of target? I'm using LWJGL and JOML to create a 3D view of hexagons whose positions lie on a torus.
I have a number (NxM) hexagons, whose centres and normals I have calculated to be placed on the torus to completely cover the torus surface, but in the "game" engine I'm using I need to convert each item being rendered to a position and 3 rotation angles. I'm struggling to go from the 3 normals of the item to the 3 angles.
EDIT: Subsequent to posting this I have got some way in creating a matrix with the angles and converting to Euler angles, everything is now turned according to those angles, but they aren't facing directions I expect.
The background
I'm trying to create a visualisation of a Conway Game of Life using hexagons but instead of a simple plane, mapping each hexagon onto a Torus.
I've done the maths to calculate the centres of every hexagon, and the 3 direction unit vectors that they need to point to, when in their places around the torus.
For illustrative purposes, here's a view of the torus and 2 hexagons that would lie on it (not real, this is just me mocking it up in Blender)

What I'm struggling to understand is how to rotate the single mesh for a hexagon to its calculated normals at the position I want to place it.
i.e. How do I rotate some "unit" hexagon mesh (loaded from an OBJ file exported from Blender) to point in the direction of the 3 normals I've calculated they should be for each hexagon around the torus.
I have read a similar question here, but I'm struggling to get from the idea of the 4d rotation matrix to how I convert that to a Vector3f for rotations. I have the 3 vector normals, could create the 4d matrix, but I need a Vector3f (the rotations about x/y/z) to the mesh is drawn correctly.
My code is here. I'm following this guide for using LWJGL to create GameItems (my hexagons) and position/rotate them from a loaded obj file mesh, but as I say, I'm struggling to calculate the rotation Vector3f needed to point in the same direction I've calculated.
Here's the code section relevant to the problem at hand:
    val mesh = loadMesh("/conwayhex/models/simple-hexagon.obj")

    hexGrid.hexAxes().forEach { (location, axis) ->
        // axis is a Matrix3f with my 3 normals at the centre of the hexagon, e.g
        // cX  cY  cZ
        //  0  -1   0
        //  0   0  -1
        //  1   0   0

        val gameItem = GameItem(mesh)
        gameItem.position = location
        gameItem.scale = 0.2f // TODO: calculate this according to the torus size

        // what rotation do I give this?
        // How do I calculate it from the given axis for the current item?
        gameItem.rotation = Vector3f(30f, 30f, 30f)

        gameItems += gameItem
    }

The output of the application given the above static 30 degree rotation is:

Can anyone help me unserstand how I apply the rotation to my items so they align to what I've calculated they should be?

sentences:
Why is my CameraCrop script blurring the screen slightly in Unity? I've been trying to enforce a 4:3 aspect ratio in my Unity game, in order to give a nostalgia feeling to it. But whenever I add this script to my camera and compile my game, it blurs slightly. I am using a 4:3 aspect ratio in the game view and have Fullscreen Window chosen in my Window Option and in Supported Resolutions I have only 4:3 ticked. Also, I am used Pixel Perfect Camera with Pixel Snapping enabled.
Here's what my game looks like without the CameraCrop script added:

And here is what it looks like when the script is added:

Here's the script I add to my camera:
using UnityEngine;
using System.Collections;
using System.Collections.Generic;

// Requires that the camera component is on the GameObject
[RequireComponent(typeof(Camera))]
public class CameraCrop : MonoBehaviour
{

    // Sets the aspect ratio to whatever you want
    public Vector2 targetAspect = new Vector2(4, 3);
    Camera _camera;

    void Start()
    {
        _camera = GetComponent<Camera>();
        UpdateCrop();
    }

    // Call this method if your window size or target aspect change.
    public void UpdateCrop()
    {
        // Determine ratios of screen/window & target, respectively.
        float screenRatio = Screen.width / (float)Screen.height;
        float targetRatio = targetAspect.x / targetAspect.y;

        if (Mathf.Approximately(screenRatio, targetRatio))
        {
            // Screen or window is the target aspect ratio: use the whole area.
            _camera.rect = new Rect(0, 0, 1, 1);
        }
        else if (screenRatio > targetRatio)
        {
            // Screen or window is wider than the target: pillarbox.
            float normalizedWidth = targetRatio / screenRatio;
            float barThickness = (1f - normalizedWidth) / 2f;
            _camera.rect = new Rect(barThickness, 0, normalizedWidth, 1);
        }
        else
        {
            // Screen or window is narrower than the target: letterbox.
            float normalizedHeight = screenRatio / targetRatio;
            float barThickness = (1f - normalizedHeight) / 2f;
            _camera.rect = new Rect(0, barThickness, 1, normalizedHeight);
        }
    }
}

I am using Unity 2019.4.17f LTS and using Windows 10.

sentences:
MouseLook Script "Pops" back to the last value when the script is enabled after being disabled or destroyed I am trying to get a problem with a MouseLook script that controls my camera and a LookatGameObject script that also controls my camera when I want to force the player to look in a certain direction under control, but still no luck. I have identified where the issue is - Line 43, transform.localEulerAngles = new Vector3(-rotationY, rotationX, 0); is the the method that sets the X Axis, makes it "POP" back to the last value when the script is enabled (I have even destroyed the component and then added the component when needed but the same result) can anyone see a solution for this?

The MouseLook Script:

 using UnityEngine;
 using System.Collections;

 [AddComponentMenu("Camera-Control/Mouse Look")]
 public class MouseLook : MonoBehaviour
 {

     public enum RotationAxes { MouseXAndY = 0, MouseX = 1, MouseY = 2 }
     public RotationAxes axes = RotationAxes.MouseXAndY;
     public float sensitivityX = 15F;
     public float sensitivityY = 15F;

     public float minimumX = -360F;
     public float maximumX = 360F;

     public float minimumY = -60F;
     public float maximumY = 60F;

     float rotationY = 0F;

     void Update()
     {
         if (axes == RotationAxes.MouseXAndY)
         {
             float rotationX = transform.localEulerAngles.y + Input.GetAxis("Mouse X") * sensitivityX;

             rotationY += Input.GetAxis("Mouse Y") * sensitivityY;
             rotationY = Mathf.Clamp(rotationY, minimumY, maximumY);

             transform.localEulerAngles = new Vector3(-rotationY, rotationX, 0);
         }
         else if (axes == RotationAxes.MouseX)
         {
             transform.Rotate(0, Input.GetAxis("Mouse X") * sensitivityX, 0);
         }
         else
         {
             rotationY += Input.GetAxis("Mouse Y") * sensitivityY;
             rotationY = Mathf.Clamp(rotationY, minimumY, maximumY);

             transform.localEulerAngles = new Vector3(-rotationY, transform.localEulerAngles.y, 0);
         }
     }
  }

Here is my LookAtGameObjectScript:

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

 public class LookAtGameObject : MonoBehaviour
 {
     public Transform target;
     public float speed = 5f;

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

         Vector3 direction = target.position - transform.position;
         Quaternion rotation = Quaternion.LookRotation(direction);
         transform.rotation = Quaternion.Lerp(transform.rotation, rotation, speed * Time.deltaTime);
     }
     }

And And my method for turning off MouseLook and Turning on LookAtGameObject:

private IEnumerator LookAtGameObject()
     {

         GameObject.FindWithTag("MainCamera").GetComponent<MouseLook>().enabled = false;
         GameObject.FindWithTag("MainCamera").GetComponent<LookAtGameObject>().enabled = true;

         yield return new WaitForSeconds(8f);

         GameObject.FindWithTag("MainCamera").GetComponent<LookAtGameObject>().enabled = false;
         GameObject.FindWithTag("MainCamera").GetComponent<MouseLook>().enabled = true;

         yield return null;
     }

sentences:
How can I encourage population balance between two factions? I'm making a game in which players must choose between two factions after reaching a certain level.

PvP and PvE are not influenced by this choice as it's mostly for role play and the sense of belonging to a community (and perhaps seasonal events).

The two factions can communicate. Preferably, guild members must be in the same faction and it should be impossible or not easy to change factions.

I fear that if a faction starts to have the majority of players, new players will want to join it to play with their friends or have more guild choices.

How could I mitigate or prevent that? Are there alternatives?

sentences:
Turning to face mouse Given three points on the same Y plane;

A ship
A point along the ships heading
A mouse cursor

How can I find which direction and angle the mouse cursor is from the ships heading?

I have a limited turn speed on the ship - so I can not simply point the ship at the mouse, but tell it to steer left or right until it faces in the same direction of the mouse.

sentences:
Best way to store game-wide variables I have an options screen for things like difficulty, resolution, full-screen, etc., but I'm struggling to find the "best" way to store/obtain these variables at run-time.

Currently, I've implemented a Constants class which contains all the GameOption enums, but how do I choose a default for all of these options? Also, how do I get the currently selected enum?

Regarding the resolution, specifically, I've decided to store the values, but I'm unsure of how to get the default, or currently stored, values. Any direction would be great; thanks! :)

namespace V1.test.RPG
{
  public class GameOptions
  {
    public enum Difficulty { EASY, MEDIUM, HARD }
    public enum Sound { ON, QUIET, OFF }
    public enum Music { ON, QUIET, OFF }
    public enum ResolutionWidth
    {
        SMALL      = 1280,
        MEDIUM     = 1366,
        LARGE      = 1920,
        WIDESCREEN = 2560
    }
    public enum ResolutionHeight
    {
        SMALL      = 800,
        MEDIUM     = 768,
        LARGE      = 1080,
        WIDESCREEN = 1080
    }
    public Boolean fullScreen = false;
  }
}

NB: I asked over at SO and they pointed me to this place. There is a comment there but I'd like to hear different ways of doing it / the most used ways.

sentences:
Lighting changes when loading scene I have a script that changes the levels using

Application.LoadLevel (sceneNameToChangeTo);

Once a level is loaded using that code when testing with the editor, the lighting changes dramatically. I've checked if something changes in the light or lighting settings, but it doesn't.

This is a screen of how the scene looks when I simply press RUN in the scene in the editor:

Notice the blue tints from the sky etc. This is clearly PBS lighting.

Now after I use my code to change the scene to another one and then back to this one, the scene looks like this:

What am I doing wrong? I am using Unity 5.0.1. This effect does not happen on mobile devices.

sentences:
How can I track two fingers? Im trying to make make game which is intended to be played with the phone in landscape mode, and the player uses their thumbs to control the movement. The game controls look like this:

On the left there is a simple button to accelerate, and on the right a wheel to adjust the direction. Both work perfectly when used individually but they won't work both at the same time.

I would need to implement multitouch and accelerate/rotate depending on which side of the screen the finger is on, but I can't figure out how to do that detection.

Below is the onTouchEvent, how can i modify it to do what i want?

@Override
    public boolean onTouchEvent(MotionEvent event){

        switch (event.getAction()) {
            case MotionEvent.ACTION_DOWN:
                if (event.getX() < 300 && event.getY() > 250) {
                    btnPress = true;
                }
                break;
            case MotionEvent.ACTION_MOVE:
                x = (int) event.getX(); //this is used by the direction wheel
                y = (int) event.getY();
                break;
            case MotionEvent.ACTION_UP:
                btnPress = false;
                break;

        }
        return true;
    }

sentences: How to add melee weapons in UDK? I am very new to game design and programming in Unrealscript for UDK. I have created a weapon mesh and imported it alongside it's animation set and created a start and end socket on it. I was wondering if anyone could help me create a weapon class for it and allow it to be used in the game?

sentences:
Rotating and Translating a Node in Horde3D with Matrices and Quaternions I have been trying to learn how to use the Horde3D rendering engine for the past couple of days,
and so far I have managed to learn a decent amount and integrate Bullet Physics with it as well.

My problem is in my maths for rotating and translating a node in Horde3D to keep it in sync with Bullet Physics.

I have a terrain and a sphere, both of which are in the Bullet Physics dynamics world.
The sphere drops from the sky and hits the terrain and everything works fine and collides/moves around as it is supposed to.

The problem is that I can successfully translate the 3D model in Horde3D to stay in sync with the position of the sphere shape in Bullet Physics,
but as soon as I try to introduce rotation things start to go wrong.

It's a bit difficult to describe so I have uploaded a video of the problem to YouTube (below).
Basically, the green wireframe is the Bullet Physics sphere shape, and the brown sphere is the sphere at the Horde3D node.

Everything is fine while the sphere is falling, because there is no rotation, but as soon as it hits the terrain and rotation
is supposed to take place the Horde3D node moves in a completely different direction to the Bullet Physics wireframe.

You can see what I mean by watching the video here: http://www.youtube.com/watch?v=Yi_DJIWpxOo&feature=youtu.be

I assume this is probably a quaternion/multiplication/matrix/order of multiplication error of some kind, but I can't figure it out myself.

Horde3D provides two ways that I know of to set a node's position.

They are:

h3dSetNodeTransform (http://www.horde3d.org/docs/html/_api.html#h3dSetNodeTransform)
h3dSetNodeTransMat (http://www.horde3d.org/docs/html/_api.html#h3dSetNodeTransMat)

I could use h3dSetNodeTransform and set all of the Euler angles, but Bullet Physics provides a quaternion,
so I would rather try and use translation and rotation matrices instead of converting the quaternion to Euler angles etc.

For calculations I am using GLM, if that makes any difference, although I don't think it should do.

The code that handles the updating of the Horde3D node is as follows:

btTransform trans;

sphere_body->getMotionState()->getWorldTransform(trans);

// getOrigin() returns the absolute coordinates, so I am keeping
// track of them to make sure I translate the correct amount
glm::vec3 sphere_cur_pos = glm::vec3(
    trans.getOrigin().getX(),
    trans.getOrigin().getY(),
    trans.getOrigin().getZ()
);

glm::mat4 sphere_node_matrix, matrix_t, matrix_r;

const float *matrix_floats;
h3dGetNodeTransMats(sphere_node, 0, &matrix_floats);

sphere_node_matrix = glm::make_mat4(matrix_floats);

matrix_t = glm::translate(
    sphere_node_matrix,
    sphere_cur_pos - sphere_last_pos
);

// sphere_last_pos is declared earlier in the code
sphere_last_pos = sphere_cur_pos;

btQuaternion quat = trans.getRotation();

matrix_r = glm::rotate(
    matrix_t,
    quat.getAngle(),
    glm::vec3(quat.getAxis().getX(), quat.getAxis().getY(), quat.getAxis().getZ())
);

h3dSetNodeTransMat(sphere_node, glm::value_ptr(matrix_r));

The above code produces the behaviour you can see in the YouTube video.

If I remove the rotation matrix and just use:

h3dSetNodeTransMat(sphere_node, glm::value_ptr(matrix_t));

then everything works fine and the sphere node stays in sync with the Bullet Physics wireframe, but there is of course then, there is no rotation.

Can somebody point out what I am doing wrong?

If any more information is needed just let me know and I will update the question.

sentences:
How can I remove the view and projection matrix from ray position to get only the ray model? I've got a little problem with my picking module and I need your help.

I have a method to project a ray from the camera to a fixed point when I click somewhere. The computed ray looks good, it go to the asked direction and passes through the pointed box, so I'm thinking everything is OK here.

When I'm trying to pick an object a little further from the origin, there is no intersection found.

I'm sure that the ray is correctly projected and computed to the screen (I draw it) but coordinates are bad during intersection test.

Currently, I compute the ray with this code :

const glm::vec3 position    = glm::vec3( mouse.x, mouse.y, 0.f );
const glm::mat4& view       = camera.getViewMatrix();
const glm::mat4& projection = camera.getProjectionMatrix();
const glm::vec4& viewPort   = camera.getViewport();

ray.origin =  glm::unProject( glm::vec3(mouse.x, mouse.y, 0.f ),
                                        modelView,
                                        projection,
                                        viewPort );

ray.direction =  glm::unProject( glm::vec3( mouse.x, mouse.y, 0.f ),
                                            modelView,
                                            projection,
                                            viewPort );

So, I think the ray origin and direction are computed to world position (with camera matrix: projection and view).

When I test intersection, I use object model (without camera transformation), so I'm thinking error is here.

The question:
How can I remove view and projection matrix from ray position to get the ray model only ?

Thanks a lot!

PS: To test intersection, I create a bounding box from my object's model matrix and I test intersection with the ray computed previously.

EDIT:

Code to compute ray positions in world space :

////////////////////////////////////////////////////////////
bool computeRayPositions( Ray* ray )
{
    glm::vec3 start = ray->getOrigin();
    glm::vec3 end   = ray->getDirection();

    glm::mat4 startMatrix   = glm::translate( glm::mat4(1.f), start);
    glm::mat4 endMatrix = glm::translate( glm::mat4(1.f), end);

    const glm::mat4& viewMatrix       = camera->getViewMatrix();
    const glm::mat4& projectionMatrix = camera->getProjectionMatrix();

    glm::mat4 startWorldMatrix  = startMatrix * glm::inverse(viewMatrix * projectionMatrix) ;
    glm::mat4 endWorldMatrix    = endMatrix * glm::inverse(viewMatrix * projectionMatrix);

    ray->setOrigin( glm::vec3 (startMatrixFinal[3][0], startMatrixFinal[3][1], startMatrixFinal[3][2] ) );
    ray->setDirection( glm::vec3 (endMatrixFinal[3][0], endMatrixFinal[3][1], endMatrixFinal[3][2] ) );

}

sentences:
Incorrect results for frustum cull Previously, I had a problem with my frustum culling producing too optimistic results- that is, including many objects that were not in the view volume. Now I have refactored that code and produced a cull that should be accurate to the actual frustum, instead of an axis-aligned box approximation. The problem is that now it never returns anything to be in the view volume.

As the mathematical support library I'm using does not provide plane support functions, I had to code much of this functionality myself, and I'm not really the mathematical type, so it's likely that I've made some silly error somewhere. As follows is the relevant code:

class Plane {
public:
    Plane() {
        r0 = Math::Vector(0,0,0);
        normal = Math::Vector(0,1,0);
    }
    Plane(Math::Vector p1, Math::Vector p2, Math::Vector p3) {
        r0 = p1;
        normal = Math::Normalize(Math::Cross((p2 - p1), (p3 - p1)));
    }
    Math::Vector r0;
    Math::Vector normal;
};

This class represents one plane as a point and a normal vector.

class Frustum {
public:
    Frustum(
        const std::array<Math::Vector, 8>& points
        )
    {
        planes[0] = Plane(points[0], points[1], points[2]);
        planes[1] = Plane(points[4], points[5], points[6]);
        planes[2] = Plane(points[0], points[1], points[4]);
        planes[3] = Plane(points[2], points[3], points[6]);
        planes[4] = Plane(points[0], points[2], points[4]);
        planes[5] = Plane(points[1], points[3], points[5]);
    }
    Plane planes[6];
};

The points are passed in order where (the inverse of) each bit of the index of each point indicates whether it's the left, top, and back of the frustum, respectively. As such, I just picked any three points where they all shared one bit in common to define the planes.

My intersection test is as follows (based on this):

bool Intersects(Math::AABB lhs, const Frustum& rhs) const {
    for(int i = 0; i < 6; i++) {
        Math::Vector pvertex = lhs.TopRightFurthest;
        Math::Vector nvertex = lhs.BottomLeftClosest;
        if (rhs.planes[i].normal.x <= -0.0f) {
            std::swap(pvertex.x, nvertex.x);
        }
        if (rhs.planes[i].normal.y <= -0.0f) {
            std::swap(pvertex.y, nvertex.y);
        }
        if (rhs.planes[i].normal.z <= -0.0f) {
            std::swap(pvertex.z, nvertex.z);
        }
        if (Math::Dot(nvertex - rhs.planes[i].r0, planes[i].normal) < 0.0f) {
            return false;
        }
    }
    return true;
}

Also of note is that because I'm using a left-handed co-ordinate system, I wrote my Cross function to return the negative of the formula given on Wikipedia.

Any suggestions as to where I've made a mistake?

Edit: I changed my intersection test somewhat. No change, though.

sentences: Why do games use tick rates in their networking and servers instead of an event system? Why do most games limit themselves with a tick rate in their networking? Isn't it better to make something like an even system where for example client A does something then the client sends related info to the server, and same for the server when something happens on it it sends a packet to the client, instead of using a tick rate and sending information only at some specific frequency. Is it cheaper/faster to send more data in a single packet or? And the same question goes for server tick rates, some servers limit themselves on specific tick rate frequencies, why do they do that? Why not just make a loop and run each tick after each other instead of having a gap between them or risking one tick to take longer than it should and causing bugs? What's the benefit of the tick rate approach for servers and for networking?

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:
Store and retrieve different objects on a tile (I hope the title is clear enough, if not feel free to suggest a better one)

I'm trying to make a simple tile-based map for a college project in Java. But I'm stuck on how to literally place things on my map. On the programming side of things, I still haven't got into graphics on this. As of now I have:

A "Robot" class, which implements an "Attackable" and "Spawnable" interface, the robot can attack and moved

A "Obstacle" class, the obstacle too can be attacked, so it implements Attackable, Spawnable, but it also can be pushed by a robot (methods by the class itself).

A "Station", which is nor attacable nor can be pushed, so it only implements Spawnable and other specific methods.

A "GameWorld" class which hold the map (a 2D array of Tiles) and various methods.
A "Tile" class (which is arrayed to create the map). It has a boolean "Occupied" (which doubles as a collision too). Previously it stored just a single Attackable variable, because both Obstacles and Robot can be attacked, so I just tought it would be easy to just store them as such on the map for when I need to attack something, and then use some other reference to Robot instances when I need to move the robots and have a reference to the station in GameWorld in order to use that. But then I remembered that the Obstacles need to be moved too, so it wouldn't really work.

Now I'm thinking about having two maps, basically, an AttackableMap[][] for the attackable object (which would store both robots and the obstacles) and a ObstaclesMap[][] for the obstacles alone (with tiles occupied by robots set as occupied). Which would obviously mean having two tile classes, one to hold each kind of object.

But it feels cheap, I think. It uses a lot of memory and I think it might be hard to render at a later time. But having only one map would mean having to check what kind of object I'm getting and I'd have to do loads of casts and I want to avoid that.

So, I think, there must be a better way to do this. How do other people do it then? So basically my question is... How can I store different "things" on a tilemap in a better way? Is there some technique widely used?

What I've come up with feels rigid, if I wanted to add another kind of object that can be placed on the map (like a mine) I would need to create another map entirely, another tile, write new methods... There must be some flexible (and not too complex) way to have some freedom in this aspect.

sentences:
How do I create a 3D model based on 2D drawings? I'm a programmer. I have a great draftsman, but I don't know how to take his drawings to 3D.

My gut feeling is to have him draw different view angles, then work based on those, adding each dimension to the model turn. But really I'm just guessing here.

How do I do this methodically and correctly?

sentences:
Error in DRAW GUI event on android. (GameMaker) Image of the game on a mobile phone:

As you can see the maze (draw event) has been resized correctly.

But the yellow post-it (draw GUI event) has not been scaled or displayed in the correct location (center of the screen). Same thing with GUI layout (draw GUI event).

Because this is a small stage/room (size) I do not use the artifice of views, I thought that could be because of that the problem, but I enabled the views and did not get any different result.

Picture of the game on a computer (like it should be on the phone):

OBS - One information that can help you to help me solve the problem, is that to draw the post- it I use the following code: draw GUI event draw_sprite(spr_Post,0,640,360);.

640 is the half screen width of the game and also the room, 360 is half the height of the game screen and also the room.

It seems that somehow the room on the cell phone is different size than 1280x720.

I do not put the following code: draw GUI event draw_sprite(spr_Post,0,room_width/2,room_height/2), because there are much larger phases that need views, so the post-it needs to be in the center of the screen of the player, and with this code it ends up being in the center of the phase.

I tested the game on Bluestacks and it did not happen the same as on the phone.

sentences:
Collision Filtering in Box2D I have four bodies in my Box2D World.  Each are polygon shape, with some physics parameters.

Now when the game start, I need one of the bodies from the World (BodyA) to not be allowed to collide with another (BodyB).  It should be allowed to collide with others.

To clarify, BodyA and BodyB cannot collide with each other, but can collide with rest of the bodies in the Box2D world.

How could make this kind of mechanism in Box2d ?

Please help me about this query.
Thanks & Regards,

sentences:
Unity Runtime Surface Snapping (Like Shift+Cntrl in Editor) I am trying to allow the user of my VR game to move objects around using a pointer, then when holding down a button, snap to a grid and align to the highest surface, essentially replicating the Editor behavior or holding down shift+control and moving around a transform gizmo. (Try it, it's fun!)
I have the grid part down, but can't wrap my head around how to do the surface snapping.
Here is the code I have so far. I would appreciate any and all help!

// offsetPos is where the VR pointer is.
Vector3 offsetPos = pointer.objectControlPoint.transform.position + cursorOffset;
Vector3 newPos;

if (isSnapping) // Snap to ground code.
{
// I read previously to do this up then down thing, but It's not working as expected
    RaycastHit groundHit = new RaycastHit();
    if (Physics.Raycast(selectedObject.transform.position, Vector3.down, out groundHit))
    {
         RaycastHit objectHit = new RaycastHit();
         if (Physics.Raycast(groundHit.point, Vector3.up, out objectHit))
         {
                Vector3 snapDiff = groundHit.point - objectHit.point;
                snapYPos = snapDiff.y + (selectedObject.collider.bounds.extents.y);
          }
    }
      // worldGrid is a monoBehavior on another object, and gridCellSize is just a float
      float gridPosX = Mathf.Floor(offsetPos.x / worldGrid.gridCellSize) * worldGrid.gridCellSize;
      float gridPosZ = Mathf.Floor(offsetPos.z / worldGrid.gridCellSize) * worldGrid.gridCellSize;
      newPos = new Vector3(gridPosX, snapYPos, gridPosZ); // Sets the target position to the nearest grid cell, with a Y of the snap position.
}
else // If not in snap mode, set target position to just the VR cursor.
{
       newPos = new Vector3(offsetPos.x, offsetPos.y, offsetPos.z);
}

// I know lerp might not be the most efficient, but I like the smooth effect, and it looks good when snapping to the grid...
selectedObject.transform.position = Vector3.Lerp(selectedObject.transform.position, newPos, movementLerpSpeed * Time.deltaTime);

The objects I need to be snapping all are different sizes and have their origins in different places, but all do have appropriate box colliders.
Thanks so much!

sentences:
pivot of a 3d model outside its mesh after importing into Unity3d as you can see, the pivot is outside my mesh. I want to use the pivot for rotating around, for that I need to set the pivot to the real "rotating point". I know that there's the SetPivot script, but it only works with pivots inside meshes.
This mesh is part of an object which contains several meshes, I created it with Wings3d. The problem appears with .obj  and .3ds as file extension.

1.How can I fix this?
2.Is there a possibility to define a second pivot which can be used in scripts to "rotate around"(maybe a vector3 which can be set in "Designer")?

sentences:
How to Capture Vive's USB-Audio Data from Playback Devices I am developing a music visualizer software for Vive so I am trying to get FFT data from music that users listen to. However, I couldn't take any data from USB audio devices versus my soundcard.

What I have done is

Using FMOD, I could access recording devices but there is no usb-audio device in the recording device list so I can only access the speaker(What U Hear)

  system->recordStart(0, sound, true); // only I can capture data from recording devices
  system->playSound(FMOD_CHANNEL_FREE,
  sound, false, &channel);

Using WASAPI in Windows SDK, I tried to get the data although It also takes only data from the speaker not USB-Audio.
I am not sure I did correct here but the SDK's example, WASAPICaptureSharedTimerDriven, doesn't seem to work for USB-AUDIO but it works fine with data from my soundcard (What U Hear)

If anyone has captured any audio data through USB-audio, please tell me the approach.

sentences:
How would I move an object using its velocity on a closed curve? I want that an object follows a path, in Peggle game there are some pegs that have
movement in a closed path. How can i get the same result? I guess that I can use parametric curve but I need use the velocity and not the position (x, y).

I use NAPE and I have this in my gameloop:

//circunference
angle = angle + 1*(Math.PI / 180);
movableBall.position.x = radius * Math.cos(angle)+ h;
movableBall.position.y = radius * Math.sin(angle)+ k;

It works but I can not control the velocity, each movableBall must have its own velocity.
Besides, from docs of NAPE:

  "Setting the position of a body is equivalent to simply teleporting
  the body; for instance moving a kinematic body by position is not the
  way to go about things.."

I want to use:

movableBall.velocity.x =??
movableBall.velocity.y = ??

The final idea is to follow others paths like the Lemniscate of Bernoulli.

sentences:
HLSL grayscale pixel shader: How to get the original colors of the model? The following code gives me a completely black colored model, while it should be a model shaded in greyscale:

float4 SimplePixelShader(VertexShaderOutput input) : COLOR0
{
    //some lambertian shading done in the code I left out here

    return color;
}

sampler TextureSampler = sampler_state
{
    Texture = <ScreenTexture>;
};

float4 GrayscalePixelShader(float2 TextureCoordinate : TEXCOORD0) : COLOR0
{
    // Get the color.
    float4 color = tex2D(TextureSampler, TextureCoordinate);

    // Turn pixel to grayscale.
    float grayscale = dot(color.rgb, float3(0.3, 0.59, 0.11));
    color.r = grayscale;
    color.g = grayscale;
    color.b = grayscale;
    color.a = 1.0f;

    // Return the result.
    return color;
}

technique Simple
{

    pass Pass0
    {
        VertexShader = compile vs_2_0 SimpleVertexShader();
        PixelShader  = compile ps_2_0 SimplePixelShader();
    }

    pass Pass1
    {
        PixelShader  = compile ps_2_0 GrayscalePixelShader();
    }
}

As far as I could find out the problem lies here:

// Get the color.
float4 color = tex2D(TextureSampler, TextureCoordinate);

The whole lambertian coloring works, the grayscale seems to work properly by itself after some testing, but what doesnt seem to work is getting the red lambertian shaded model colors. Anybody any clue what I'm doing wrong?

Edit: Thanks to a lot of help in the chat from LuisW I now have a working greyscale shader, I didnt have to change anything about my GreyscalePixelShader but I did have to remove the second pass of the simple techique and put it into a seperate technique, as such:

technique Greyscale
{
    pass Pass0
    {
        PixelShader = compile ps_2_0 GrayscalePixelShader();
    }
}

I also had to update my XNA/C# Draw method to create a fullscreen quad that I rendered my scene with the first technique to so I could use my greyscale technique on that quad as an input. Mind you, the method Im using, with spritebatch, is known to be slow (for me that didnt matter, but if you need fast, then drawing the quad directly is supposably faster) My updated draw method:

protected override void Draw(GameTime gameTime)
{
    this.device.Clear(ClearOptions.Target | ClearOptions.DepthBuffer, Color.DeepSkyBlue, 1.0f, 0);

    PresentationParameters pp = this.device.PresentationParameters;
    RenderTarget2D renderTarget;
    renderTarget = new RenderTarget2D(this.device, pp.BackBufferWidth, pp.BackBufferHeight, true, pp.BackBufferFormat, pp.DepthStencilFormat);
    this.device.SetRenderTarget(renderTarget);
    this.device.Clear(ClearOptions.Target | ClearOptions.DepthBuffer, Color.DeepSkyBlue, 1.0f, 0);
    Rectangle screenRectangle = new Rectangle(0, 0, screenWidth, screenHeight);

    // Get the model's only mesh
    ModelMesh mesh = this.model.Meshes[0];
    Effect effect = mesh.Effects[0];

    effect.CurrentTechnique = effect.Techniques["Simple"];

    //<left out some noninteresting worldmatrix calculations here not relevent for this question/answer>

    device.DepthStencilState = DepthStencilState.Default;
    device.BlendState = BlendState.Opaque;

    mesh.Draw();

    this.device.SetRenderTarget(null);

    effect.CurrentTechnique = effect.Techniques["Greyscale"];

    spriteBatch.Begin(0, BlendState.Opaque, null, null, null, effect);
    spriteBatch.Draw((Texture2D)renderTarget, screenRectangle, Color.White);
    spriteBatch.End();

    base.Draw(gameTime);
}

sentences:
Const returning C++ method can't be bound with LuaBridge I have a method with this signature:

const std::string GameObject::GetName()

And then I try to bind it with this line:

...
.addFunction("getName", &GameObject::GetName)
...

When I try to compile, this error comes up:

Error C2440 '=': cannot convert from
'const std::basic_string<char,std::char_traits<char>,std::allocator<char>> *'
to
'void *'

The error comes from here:

\include\luabridge\detail\Userdata.h, line: 354

Here is a snippet from the Userdata.h

  inline T* getObject ()
  {
    // If this fails to compile it means you forgot to provide
    // a Container specialization for your container!
    //
    return reinterpret_cast <T*> (&m_storage [0]);
  }

private:
  /**
    Used for placement construction.
  */
  UserdataValue ()
  {
    m_p = getObject(); //Line 354
  }

I can use const, and const & std::string as parameters, in those cases there are no errors.

Why does this error occur? How could I fix this?

Thanks in advance!

sentences:
Godot - How to set the AudioStreamPlayer to switch between tracks Conditional Music Playback

What's important here is that I know how to switch the track that's being played back to another if some condition is met in the scene. If possible I also want to know where to store the other tracks.

I looked into the documentation and have yet to find a solution that allows me to for example:

set the new track's file path and play it or...
store the track names in maybe an array and set them for playback in the script. (still requires something to change the currently playing track)

How do I switch the tracks based on any condition?

sentences:
How do i manage skill collision target in Unity? I wanted to make a skill that can be used by both Player & Enemy.

How do I make it such that the skill will not be colliding with the owner/caster or colliding with both?

One stupid way I have is to create empty gameObjects as the Skill's child and set their tag as "targetPlayer","targetEnemy" or "targetAll" whenever my player/enemy cast the skills.

And when the skill collided with Player/Enemy, i will check the skill's children and see if there's matching tag and proceed if so.

Is there better way to do what i wanted??

sentences:
GameObject scope over RPC call Debugging my code I faced some unexpected behavior.

I called an RPC using uLink.NetworkView on the server passing some parameter including a GameObject tagged as Player.

Inside that RPC I make a call to GameObject.FindObjectsWithTag("Player")

What I refer to by saying "unexpected" is that that function returns all the gameobjects in hierarchy INCLUDING the gameobject passed as parameter to the RPC call.

I noticed that inside the editor it appears in hierarchy the gameobject passed to the RPC but without all the components BUT the transform.

My question is to know exactly how the scope is working, I seem to understand that the scope of the FindObjectsWithTags seems to include RPC parameters but without the most informations.

Any clue about this?

sentences:
What is Minecraft's database? I was wondering, what kind of database does Minecraft use? Is it a relational database, maybe something common like MySQL? Do we even know what he's using?

And maybe even a better question, SHOULD he be doing it that way? What type of database should be used?

sentences:
How do I get an object to rotate in world space via RigidBody.AddTorque? I'm getting really discouraged because I can't seem to figure how how to rotate my object via Rigidbody.AddTorque like it is on a figurative global turn table rather than a local turn table. Another way of describing it is that I want to c calculate a torque vector that will rotate the object's yaw and keep it upright regardless of its pitch without rolling it around. This is a problem for me because I want my player to remain upright without ending upside down because they were pitched and decided to turn.

Someone else had posted about the same problem on a different forum but he didn't receive much in the line of help, however he did provide this really helpful image describing the problem:

Notice how the left object is tilted and then rotating with respect to its own local coordinates but the one on the right is rotating with respect to the global coordinates instead of rolling around like the one on the left.

How can I achieve this? Is there something obvious I am overlooking or forgetting? Am I explaining it right?

EDIT:

In the following image the top half illustrates what I want while the bottom half is showing what is actually happening.
What I want is to be able to tilt the player's pitch and have them be able to rotate almost like a turret. I was able to accomplish this for demonstration purposes by first rotating the player and then pitching. Instead what I am getting is if the player tilts their pitch and then turns they start to bank, or in other words they start to roll.

My code looks something like this:

        _rigidBody.AddTorque(Vector3.up * _horizontal *
            RotateImpulse * Time.fixedDeltaTime, ForceMode.Impulse);

        _rigidBody.AddTorque(Vector3.right * _vertical *
            RotateImpulse * Time.fixedDeltaTime, ForceMode.Impulse);

I sincerely  appreciate you all offering to help me with  this.

sentences:
how to add water effect to an image This is what I am trying to achieve: A given image would occupy say 3/4th height of the screen. The remaining 1/4th area would be a reflection of it with some waves (water effect) on it.

I'm not sure how to do this. But here's my approach:

render the given texture to another texture called mirror texture (maybe FBOs can help me?)
invert mirror texture (scale it by -1 along Y)
render mirror texture at height = 3/4 of the screen
add some sense of noise to it OR using pixel shader and time, put pixel.z = sin(time) to make it wavy

(Tech: C++/OpenGL/glsl)

Is my approach correct ? Is there a better way to do this ? Also, can someone please recommend me if using FrameBuffer Objects would be the right thing here ?

Thanks

sentences:
How can I remove a sprite from the screen using pygame? I am having trouble with removing sprites on my screen using pygame.

I am killing my sprite with sword.kill which is removing it from an all_sprites group, so it should disappear right?

Here is where i blit my images:

def draw(self):
        for sprite in self.all_sprites:
            self.screen.blit(sprite.image, self.camera.apply(sprite))
        pg.display.update()

Here is my sword class:

class Sword(pg.sprite.Sprite):
    def __init__(self, game, x, y, entity):
        self.groups = game.all_sprites
        pg.sprite.Sprite.__init__(self, self.groups)
        self.game = game
        self.image = self.game.sword
        #self.image = pg.transform.scale(self.image, (TILESIZE, TILESIZE))
        self.image.set_colorkey(WHITE)
        self.rect = self.image.get_rect()
        self.x = x
        self.y = y
        self.rect.x = x
        self.rect.y = y
        if entity.direction == 'down':
            self.image = pg.transform.rotate(self.image, -90)

        def update(self):
            self.kill()

And here is where I create my sword object:

def get_keys(self):
        self.vx, self.vy = 0, 0
        keys = pg.key.get_pressed()
        if keys[pg.K_LEFT] or keys[pg.K_a]:
            self.game.walk_sound.play(-1)
            now = pg.time.get_ticks()
            self.vx = -200
            self.direction = 'left'
            if now - self.last_update > self.frame_rate:
               self.last_update = now
               try:
                    self.game.player_img = self.game.walkleft[self.frame]
                    self.frame += 1
               except IndexError:
                    self.frame = 0
            self.swing = False
        elif keys[pg.K_RIGHT] or keys[pg.K_d]:
            self.game.walk_sound.play(-1)
            now = pg.time.get_ticks()
            self.vx = 200
            self.direction = 'right'
            if now - self.last_update > self.frame_rate:
               self.last_update = now
               try:
                    self.game.player_img = self.game.walkright[self.frame]
                    self.frame += 1
               except IndexError:
                    self.frame = 0
            self.swing = False
        elif keys[pg.K_UP] or keys[pg.K_w]:
            self.game.walk_sound.play(-1)
            now = pg.time.get_ticks()
            self.vy = -200
            self.direction = 'up'
            if now - self.last_update > self.frame_rate:
               self.last_update = now
               try:
                    self.game.player_img = self.game.walkup[self.frame]
                    self.frame += 1
               except IndexError:
                    self.frame = 0
            self.swing = False
        elif keys[pg.K_DOWN] or keys[pg.K_s]:

            self.game.walk_sound.play(-1)
            now = pg.time.get_ticks()
            self.direction = 'down'
            self.vy = 200
            if now - self.last_update > self.frame_rate:
               self.last_update = now
               try:
                    self.game.player_img = self.game.walkdown[self.frame]
                    self.frame += 1
               except IndexError:
                    self.frame = 0
            self.swing = False
        elif keys[pg.K_SPACE]:
            self.attack = True
            if self.direction == 'down':
                print(self.rect.centery)
                self.sword = Sword(self.game, self.rect.centerx-7, self.rect.bottom, self)
        elif self.vx != 0 and self.vy != 0:
            self.vx *= 0.7071
            self.vy *= 0.7071
            self.swing = False
        elif keys[pg.K_t]:
            self.x = 1 * TILESIZE
            self.y = 1 * TILESIZE
            self.swing = False
        elif self.attack and not keys[pg.K_SPACE]:
            self.sword.update()
            self.attack = False

Any help would be appreciated. Thanks!

sentences:
write to depth buffer while using multiple render targets Presently my engine is set up to use deferred shading. My pixel shader output struct is as follows:

struct GBuffer
{
float4 Depth : DEPTH0;      //depth render target
float4 Normal : COLOR0;     //normal render target
float4 Diffuse : COLOR1;    //diffuse render target
float4 Specular : COLOR2;   //specular render target
};

This works fine for flat surfaces, but I'm trying to implement relief mapping which requires me to manually write to the depth buffer to get correct silhouettes. MSDN suggests doing what I'm already doing to output to my depth render target - however, this has no impact on z culling. I think it might be because XNA uses a different depth buffer for every RenderTarget2D. How can I address these depth buffers from the pixel shader?

sentences:
Detect collision from a particular side I'm making a platform sidescrolling game. All I want to do is to detect if my character is on the floor:

function OnCollisionStay (col : Collision){
    if(col.gameObject.tag == "Floor"){
        onFloor = true;
    } else {onFloor = false;}
}
function OnCollisionExit (col : Collision){
    onFloor = false;
}

But I know this isn't the accurate way. If I hit a cube with a "floor" tag, in the air (no matter if with the character's feet or head) I would be able to jump.

Is there a way to use the same box collision to detect if I'm touching something from a specific side?

sentences:
Making player movement direction follow players facing direction 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);

This works. I can manover my player in any direction.

With the awsd keys i can create 8 directions. I would like player to rotate towards the direction of the keys pressed. This is a top down game. So W+D would take you diagonally right/up. S+D would take you diagonally right/down.

I want the player to rotate into that direction, but also move the direction it is facing. Like a car. So if it is facing a complete different direction then it would actually move not in the target direction for a while until it has the target direction. Am i making sense?

      if (moveDirection != Vector3.zero)
    {
transform.rotation = Quaternion.LookRotation (moveDirection);
                        }

sentences:
Camera angle for dimetric projection I have a simple 3D engine and I want to make a isometric(dimetric) game, but where tiles are not real 3D planes, but 2D images like this one:

As I understand this tile is drawn in dimetric 1:2 projection
But I can't get right camera angles in order to have view, where all given tiles would fit perfectly by pixel.
After reading this page
I've tried rotating camera relatively to itself by x=26.565deg y=45deg but that gave me bad result.

It's clearly visible, that tiles don't fit together nicely.
I've tried different value, by just handpicking them, and the closes one was x:30deg y:45deg angles.

But there is a problem with gaps between tiles. It maybe somehow related to problem, that I don't know how to calculate length of one tile edge in world space, currently when I put tiles in scene I space them by 45units, which also is a handpicked value.

You would ask, "Why do I try to do this in 3D engine?". I want to mix 2D tile and object sprites with simple 3D objects in one game. I've already did isometric terrain with 2D engine, where everything can be simply calculated and doesn't need to position a camera.

sentences:
OpenGL object movement is not smooth and vibrating In my android NDK OpenGL C++ project, I have a render method which executes every frame on draw event so this is the algorithm:

void Engine::render() {
    deltaTime = GetCurrentTime() - lastFrame;
    glClear(GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT);
    update();
    renderDepthMaps();
    renderMeshes();
    if (skybox != nullptr)
        shaders.drawSkyBox(skybox, camera, width, height);
    lastFrame = GetCurrentTime();
}

first I calculate the delta time between the last frame and the current frame, then I update all transformation and view matrices from input then render the scene so the game loop depends on the android draw frames, I have an object which moves over a terrain and a third person camera moves with it and rotates around it, so after the object moves for some distance it begins to flicker forward and backward, the update function for the object is:

double& delta = engine.getDeltaTime();
GLfloat velocity = delta * movementSpeed;
glm::vec3 t(glm::vec3(0, 0, 1) * velocity * 3.0f);
matrix = glm::translate(matrix, t);
glm::vec3 f(matrix[2][0], matrix[2][1], matrix[2][2]);
f = -glm::normalize(f) * velocity * 3.0f;
camera->translate(f);

If it is an interpolation issue I don't know how to make interpolation with using translate matrix to its forward vector.

sentences:
Unity Tilemap one way collisions How can we get one way collisions using Tilemaps in Unity?

There doesn't seem to be much online regarding this topic yet.

From this link: https://answers.unity.com/questions/1471156/how-to-make-one-way-platforms-using-a-tilemap.html, I got that we should use a Tilemap Collider 2D for collisions and not use a Composite Collider 2D. Finally, we need a Platform Effector 2D with One-Way enabled.

However, the resulting tiles all behave like normal tiles in that collisions occur along all edges.

Here's what the inspector looks like for the tile map in question.

The scene setup looks like this:

It looks like the tiles in the scene all have collision edges all the way around.

What needs to be done to allow for one way platforms? Thanks!

EDIT

Here is the setup of the character:

Here is a view of what it looks like in game:
When jumping, the character unfortunately collides with the block above and is unable to pass through.

sentences:
How can I easily create/edit a level for a scrolling shooter game? I've been asking this question over the years many a time, but I still haven't found an answer when i search for one. Now I have slightly more knowledge of how programming is done and want to start making some full games.

I want to start with a side scrolling shooter (space style like R-Type/Gradius). I have many ideas in my head for good levels, and i even have some basic 3d skills in Maya/Blender to make the assets, but I do not know how best to formulate the levels. Lets say the space shooter has 30 levels. Each level might have about 10-15 enemy types and a boss on some levels. How best to store the location of all the enemies? (Same scenario for all the background objects,obstacles, powerup locations etc.)

Is there a better way than manually building the whole level in a Unity Scene editor view? Another way I have tried is to set spawn positions for every single object as a Vector2 or similar in XML or JSON, but how i did it that seemed even harder to make the levels than just inside the editor (not even accounting for having to write the functionality to get the data from the textfile).

sentences:
Cant load model from Content in latest Monogame version Using MonoGame 3.4, I'm trying to display a simple textured basketball.

Within the Game1 class, I've created Model mModel. My Initialize function contains all the proper Matrix information. When I run the program, I get an error stating ContentLoadException was unhandled and Could not load basketball02 asset as a non-content file!

protected override void LoadContent()
{
    mModel = Content.Load<Model>("basketball02");
}

I used the MonoGame Pipeline application to build the required xnb files for the Content folder, but for some reason this error keeps popping up and mModel returns null. I've even changed the model's Build Action to Content and Output Directory to Copy if newer like other sites and forums suggested, but still got the same results. (VS2015)

sentences:
(XNA) What's a Good Database Program for a Turn-Based RPG? I'll begin by saying that I feel my level of expertise matters here, and so I have about a year worth of experience as a programmer in the C# language and most of the .NET framework as a whole, but have scarcely worked with databases at all throughout my career so far. Can't exactly say why. Either way, I'm a bit of a beginner, although SQL/LINQ I am capable of working with once I have this question resolved. Moving on...

At home, I am developing a single-player (so only one person needs to access it) turn-based RPG in XNA. I have a lot of the logic done and the time has come for me to begin building a database for it.

THE REQUIREMENTS: There will be both dynamically written data not included with the program (such as the location in the world at which a player saved his game, that he may load in the same place) and read data that needs to be capable of being distributed easily with the program (such as a table containing stats of every monster).

THE DESIRED BUT OPTIONAL PERKS: Beyond these absolute requirements, ease of use is a second priority I want to focus on. My amatuer nature doesn't want me digging around on ground I am too unfamiliar with.

MY ATTEMPTS AT RESEARCH: I understand Access to be a simple-to-use (though oft frowned upon) choice that could work based on needing only one user to access the database at a time. SQL Server could also work, but I understand it to be more difficult to use based on my needs. And in both cases, I am not sure if there are complications associated with the distrubution of pre-loaded data with the programs. In this case, I think I should use an XML file to hold the data I want the game to come with, but I am not sure. Amidst all of this, I have also considered creating the .dbml right there in Visual Studio because it seems the simplest, but same issue: I don't know the limitations of capability and distribution.

I have tried to outline what I know and what I need to accomplish, as well as some of the options I have attempted to research, but ultimately, my knowledge has holes in it I can't find the answers to and I can't form a conclusive answer. Thus, I ask you kind people, based on the above, what is my best option for how to start building my game's database?

sentences:
Isn't it redundant to implement both lights and shadows? Most games come up with their lighting implementation and their shadow implementation. Due to deferred shading, we are able to simulate lights independent from the scene geometry. But realistic shadows are still a big challenge in game development. They would have to overlap with each other, have soft edges and are calculated in real time to support dynamic scenes.

There is a presentation where the author, Chun-Fu Chao, mentions this about lights and shadows in game development.

  1000 lights without shadow is easy, but 100 lights with shadow is impossible, now.

I wonder where is the problem, at all? I understand that shadow maps and shadow volumes have their problems, though they are very popular. From my understanding, shadows are just the absence of light. So if we use a very dark ambient color, and use deferred shading for handling all light source with easy, wouldn't that result in shadows for free?

sentences:
How do you make specific collisions in Unity? So I have created a "game" where you are automatically running across platforms and you can jump and land on the top of them.
 I want to set it where if you collide with the the left and right side of the platform a death function executes.
How can I implement a collision mechanic to achieve this?What I want the collision to be like

sentences:
this.BoundingBox.Intersects(Wall[0].BoundingBox) not working properly I seem to be having this problem a lot, I'm still learning XNA / C# and well, trying to make a classic paddle and ball game. The problem I run into (and after debugging have no answer) is that everytime I run my game and press either of the movement keys, the Paddle won't move. Debugging shows that it never gets to the movement part, but I can't understand why not?

Here's my code:

    // This is the If statement for checking Left movement.
    if (keyboardState.IsKeyDown(Keys.Left) || keyboardState.IsKeyDown(Keys.A))
        {
            if (!CheckCollision(walls[0]))
            {
                Location.X -= Velocity;
            }
        }

    //This is the CheckCollision(Wall wall) boolean
    public bool CheckCollision(Wall wall)
    {
        if (this.BoundingBox.Intersects(wall.BoundingBox))
        {
            return true;
        }
        return false;
    }

As far as I can tell there should be absolutely no problem with this, I initialize the bounding box in the constructor whenever a new instance of Walls and Paddle is created.

   this.BoundingBox = new Rectangle(0, 0, Sprite.Width, Sprite.Height);

Any idea as to why this isn't working?

I have previously succeeded with using the whole Location.X < Wall.Location.X + Wall.Texture.Width code... But to me that seems like too much coding if a simple boolean check could be done.

sentences:
Objects spawned on clients only appear locally I'm trying out the new Unity 5.1 networking for a Bomberman style game and i can't seem to get the bombs to instantiate on both the client and all those connected, what am i missing?

The code below instantiates a prefab at the players current position, that prefab has a Network Identity and a Network Transform same as the players, i thought if the object is spawned using "NetworkServer.Spawned(Object)" then that would be instantiated on both clients?

    // Update is called once per frame
void Update()
{
    if (isLocalPlayer)
    {
        this.transform.Translate(new Vector3(Input.GetAxis("Horizontal") * speed * Time.deltaTime, Input.GetAxis("Vertical") * speed * Time.deltaTime, 0.0f));

        if (Input.GetKeyDown(KeyCode.Space))
        {
            GameObject item = Instantiate(prefab, this.transform.position, Quaternion.identity) as GameObject;
            NetworkServer.Spawn(item);
        }
    }
}

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:
Unity: Import a mesh that only has vertex and edge data but no faces I am working on a game that requires meshes that only have edges and vertices but no faces.
In blender, you can make a mesh with only edges and vertices, but if you export it to FBX or OBJ, once it is imported into Unity, the resulting prefab has no mesh data linked to it. The prefab has no MeshFilter. It's as if I imported an mesh with absolutely no mesh data.

For example, if I create a plane in Blender and then delete the face but leave the edges and vertices, and then export as OBJ, I can open the OBJ in a file editor.
This is a square with no faces:

# Blender v2.78 (sub 0) OBJ File: ''
# www.blender.org
mtllib egdes.mtl
o Plane
v -1.000000 0.000000 1.000000
v 1.000000 0.000000 1.000000
v -1.000000 0.000000 -1.000000
v 1.000000 0.000000 -1.000000
l 3 1
l 1 2
l 2 4
l 4 3

So it appears that OBJ actually does export with the correct mesh data, however, it seems that Unity does not know how to import an OBJ if there are no faces.

Does anyone know if anyone has come up with a solution to this problem yet?
If not, I guess I'll just have to write my own parser. If that's the case, does anyone know if there is a way to extend or override Unity's built-in OBJ parser?

sentences:
Decomposing a collision grid into a set of boxes I'm looking for a decent algorithm to decompose a collision grid (e.g. bool[w,h])...

...into a non-overlapping set of boxes (e.g. List<Rectangle>).

The solution does not have to be the best all the time, as long as it is simplified enough (otherwise I would just create one box per tile).

sentences:
Improving performance on older Androids I'm learning to build html5 games for mobile. I'm worried about the FPS animation on older model Android... as I use a lot of setTimeouts to update certain aspects and would like some suggestions on other approaches I could adopt.

Any advice on making this run a bit smoother?

sentences:
Collision detection of cicle and rectangle How to find the collision detection of a moving rectangle on circular object?
Here i have tried to junp rectangular object but the collision detection of a small rectangular object while jumping doesnt have smooth collision detection? Can anyone please help me ?

sentences:
Unity - Problems with scene object orientation and rotation after updating my project from 5.0.0 to 5.2.2 Last year I made a large project on Unity 5.0.0, today I re-opened it on 5.2.2 to do some work on it. I was given the message that the project needed to be updated, I allowed it to do the update. Now when I open up my scenes, many of my scene objects are misplaced, the rotation is completely wrong and positioned in the wrong place. My scenes are of a refinery and the most commonly broken object is the pipework, something that would take hours to correct manually.

My pipework is created this way...

All pipes are made in blender and each scene's pipes are saved as a single blender model (with each pipe make from a bezier curve and left as a separate object).
Once imported into Unity (as a single .blend file), I've then dragged and dropped coloured materials onto all the individual pipes, so they are all coloured correctly.

This has all been fine until updating the project to 5.2.2 - now some of the pipes are in the right place, but many are rotated in completely the wrong direction, leaving it looking a mess. If I delete the pipes from Unity and reimport the pipe model back in, this would solve the problem, but then all the materials/colours will be gone. Due to the sheer amount of pipes throughout the whole project, to re-colour them all again would be an extremely problematic task, especially as it's critical that the pipes are the right colour.

I am confused how some of the pipes within the same pipe model are fine and the others are wrong, it would be so much easier to sort if they had all changed rotation together, then I could just switch them all back in 1 go. I have a total of 13 scenes and so far all of them have suffered the same problem.

Nothing whatsoever has been changed on any of the scenes, assets or indeed anything in the project folder. In fact I haven't touched a single file within the project since October last year, so it is certainly to do with updating to 5.2.2. Is there anything I can do to fix the problem without having to re-import the models back in or manually rotate everything back?

I have attached some screenshots to show the issue - See how in the blender image, all the pipework is placed correctly and then in the Unity image, half the pipes have flipped and are facing the wrong way. I have removed the ground so this can be seen clearer. Any help would be much appreciated.

Many thanks

sentences:
How to tune the collision handling to respond differently depending on the collided objects? I'm making a collision handler for a Java game engine. I made an interface called Collidable. I have a method called onCollision which takes the parameter of my Engine Game Object.

public void onCollision(engine.objects.Object obj) {

}

I want to know how I can redo this so that I can give individual instructions for each Collidable object's onCollision method for how to collide with a Wall object or an Enemy object without having to write another method that has the parameters Wall and Enemy so that my engine is flexible.

How can I do this?

sentences:
Creating a game on Linux with SDL and distributing it TL, DR: Will I be able to get a single .exe file which will work smooth in a PC which does not have SDL or so installed ever. If not, how close will be the closest approach?
Yes, now, I want to start game development using C/C++ and I am on a Linux machine.
From the resources on the web, I saw that SDL2 is a common API to use. However, I could not get satisfying answers about the following:
For me, it is important to be able to distrubite my games to my friends(let's say) with little amount of file. So, I wonder how this process works with SDL2. Will it be easy(or even possible, maybe?) to distribute a .exe file to my friends who are using Windows OS and don't have SDL2 installed? If it is so, a short description of the process would be very nice.
To make my point more clear, while I was using pygame module of python to develop a game(which includes sounds, images etc.), I was able to run pyinstaller with --onefile option on a Windows machine to get a single executable (.exe) and my friends who does not have even python installed was able to run the game without any problem. So my question is simply asking that whether it will be similar to this or not with SDL2 case.
Thanks in advance.
p.s: Using a Windows machine to build the game is something I can do.

sentences:
How to prevent automation-type cheating? Lets say I'm making an incremental game, (e.g. cookie-clicker-like). The premise of the game is simple: players send inputs that advance their game state. Players convert their own real-life time into progress in the game.

Obviously, players can cheat on the client-side, so to prevent this - the entire game logic happens on the server, and the client's only role is to render an interface that lets the players send their inputs to the server over the network. Thus, players can't take any actions that aren't allowed by the game's rules, because each action is validated on the server.

However, this still brings up a problem: what about this type of cheating:

Instead of playing the game manually, a player just writes a script that plays the game for them. They leave their PC running 24/7, and make progress in the game, all within the game's rules, but without using their own real-life time to play.

Obviously, this gives an edge over "legit" players that only play using the game's intended interface for committing actions.

Is there anything I can do to prevent this type of cheating, or is this a lost cause with no solution?

For the sake of this discussion, assume that the player that wants to cheat is able to easily reverse engineer the clientside code. For example lets say it's an HTML5 game with JS code, and that the cheater is smart enough to read minified code (which is not a far stretch at all). This means they can basically copy the code to their own machine, set up a server (with the JS example, setting up a Node.js server takes about 2 minutes), add a bit of their own code for the automation, and make their server send requests to my server with spoofed headers in a way that it pretends to be a regular user agent.

[Edit] in response to questions in the answers:
The game has no player interaction, but there's an online scoreboard, and higher-ranking players get rewards; in other words, cheating is not isolated to the cheater's local machine, and cheating can ruin the experience for other players.

sentences:
Casting in UE4 to derived class I’m stuck in understanding of usable actors from survivable c++ example.
I have return Cast<AUsableItem>(Hit.GetActor());.
I have class AUsableItem. And I have another class AUsableWeapon inherited from AUsableItem.

I have function Use() in both classes, so basically in the end it looks like Cast<AUsableItem>(Hit.GetActor())->Use(). Hit.GetActor() returns instance of AUsableWeapon. And when i do that ->Use() call, it goes into AUsableWeapon even though it was casted to AUsableItem. Problem is - I cant understand how exactly after casting to AUsableWeapon I get Use() called from AUsableWeapon.

sentences:
ImGui, how to get value that the mouse is pointing at in a VSliderFloat widget I am using ImGui::VSliderFloat to create a vertical slider in the GUI of my application. To do this I just copied the imgui demo code (imgui_demo.cpp), which reads something like

ImGui::VSliderFloat("##v", ImVec2(18,160), &values[i], 0.0f, 1.0f, "");
                if (ImGui::IsItemActive() || ImGui::IsItemHovered())
                    ImGui::SetTooltip("%.3f", values[i]);

In the demo they have stored some values in the array values[7]. My question is about the tooltip. When you point your mouse at the VSlider, the tooltip you get is the current value in values[i]. Is there some way I that I could ask ImGui for the value of the slider that the mouse is pointing at?

sentences:
Single Switch Script vs Multiple Scripts Would it be better to have one script that switches or have multiple scripts with each with their own function?

In example, Lets say I am making a powerup script.

Option 1: Create a single powerup script that switches the effects

switch (/*Enum of effects*/)
{
    case Effect.IncreaseHealth:
        health += amount;
}

Option 2: Create multiple scripts that each does its individual function

Class IncreaseHealthPowerup
{
    protected void Start()
    {
        health += amount
    }
}

This is different from the question of Multiple Script versus Single Script as it is already in component form. The question is whether to further segregate down to the types of component.

I would also like to ask the Pros and Cons of each option with regards to potential development issues, or lack of, as well as the overhead caused in either cases.

sentences:
Multiplayer Synchronization I am developing multiplayer game in unity. For multiplayer i am using photon networking library. I created room and join client successfully.

But Problem is I am doing gameobject movent by this code:

public GameObject player;
IEnumerator Moving (String temp)
{

    for (int i = 0; i < 3; i++) {

        player.transform.DOMove (CurrentPositionHolder, 0.5f).SetEase
           (Ease.Linear);
        yield return new WaitForSeconds (0.5f);
    }
}

DoMoveis library here.

Problem is player movement is not synchronized.

For Synchronization I add photonview component to player gameobject.

And i call coroutine though RPC like this.

player.GetComponent<PhotonView>().RPC ("Moving", PhotonTargets.All, "temp");

Accordingly i changed coroutine like this:

[PunRPC]
IEnumerator Moving (String temp)
{

    for (int i = 0; i < 3; i++) {

        player.transform.DOMove (CurrentPositionHolder, 0.5f).SetEase
           (Ease.Linear);
        yield return new WaitForSeconds (0.5f);
    }
}

I got this error

Illegal view ID:0 method: Moving GO:player
UnityEngine.Debug:LogError(Object)

sentences:
How to merge VRPN and Unity I'm new to virtual environments, having worked mostly with Arduino and other physical applications. I'm trying to set up VRPN server on one of the computers in my lab to pass some triggers from a Unity game to a VR environment and there is little to no documentation that a novice can at least hack through to explain how VRPN even works.

Can anyone shed a little light on it and explain how to set up a VRPN server using c#?

sentences:
How can I prevent resizing of an Ogre3D object once imported into jMonkeyEngine? I created an object in Blender:

Then I exported it as a mesh.xml file and attached it to the game scene:
[Note: The gray color is the ground.]

In the game I end up with have a smaller, horizontal tower. Any suggestions?

Note: I exported the file with "Force Camera", "Force Lamps" and "Export Scene" unchecked and "Swap Axis: x,y,z".

sentences:
How can I make a 2D Sprite bleed/glow colors at a particular spot? I am trying to make a gauge glow over the color it is at.  For example, in the image below, when the needle is pointing at the red, the red is glowing.  When it is pointing at the green, then the green is glowing.  I want to replicate this:

My gauge will be on a gradient, so I cannot just color a particular segment.  (There are no segments.)  I am working with 2D sprites.  I have looked into the Bloom asset as suggested here, but I have been met with nothing but failures.  (Probably because that guide is for 3D.)

How can I take the color at a particular position and make it bleed/glow like in the images above?

sentences:
Problem switching Scenes in AndEngine I am Developing a game in AndEngine Gles2. I have splash scene, loading scene, menu scene and Level1 scene. I am using a Screen Manager to manage all scenes so  I can easily switch between splash, loading and menu scenes.

The level1 scene is also loaded from menu perfectly but a problem occurs when I go back to menu scene on the completion of level. The screen turns black and nothing is shown after that, but the music keeps playing and logcat logs continue. I think the problem is with unloading the resources of Level1 because the switching between other scenes is perfect. I can't give complete code, as it's too long.

I am using bitmapTexture region, Sprites, bodies, physics Word, hud and fixtures etc. Here is my unload method:

unload(){
    setChildrenIgnorUpdate();
    clearChildScene();
    clearEntityModifier();
    clearTouchAreas();
    clearUpdateHandler();
    BitmapTextureManager.getInstance().destroyInstance();
    destroyPhysics();
}

sentences:
Drawing cube in SharpDX, wrong perspective I want to draw a cube. This is what i currently have:

As you can see, the perspective is VERY wrong. The the size in the z-direction is too small and the difference between the front and back size is wrong.

My code:

worldprojMatrix = Matrix.Identity;
worldprojMatrix *= Matrix.Translation(0, 0, 10);
//float ratio = ScreenWidth/ScreenHeight;
worldprojMatrix *= Matrix.PerspectiveFovLH(1f, ratio, 1f, 100f);
//worldprojMatrix *= Matrix.RotationY(1.3f);

worldprojMatrix.Transpose();

//update the matrix with a constant buffer
DeviceContext.UpdateSubresource(ref worldprojMatrix, worldprojBuffer);

Vertex Shader:

struct VOut
{
  float4 position : SV_POSITION;
  float4 color    : COLOR;
};

cbuffer meshBuffer  :  register(b1)
{
  float4x4 worldprojMatrix;
}

VOut VShader(float4 position : POSITION, float4 color : COLOR)
{
  VOut output;

  output.position = mul(position, worldprojMatrix);
  output.color = color;

  return output;
}

I tried an ortho perspective, but there is the same problem: the z dimension is too small.

How can i fix that?

sentences:
Is it feasible to stream your game when the screen is small? My game consists of a very small screen (256x256). Behind that screen, though, there is a lot of very, very expensive ray tracing going on, which requires a very powerful GPU. Moreover, all clients see a variation of the same scene, so, a single GPU could render the whole scene for everyone.

Given that scenario, I had the idea of just rendering the screen on the server and streaming it to the clients. This way, one could run my game even on very weak machines. But I guess the bandwidth use could make it unpractical; is it possible to stream a 256x256 screen at 30 fps without delay and in a lossless format?

sentences:
In Unity3D, how can I improve image clarity? The same images that appear clearly in Adobe Flash appear blurry in Unity.

My game uses quads, cubes and sprites. I've tried the game on Android, iPhone, Mac  and PC, but the image appears poor-quality on all of them.

A sample screenshot:

What can I do about this?

sentences:
How can I make permanent death in a MUD seem acceptable and fair to players? I have considered writing a MUD for years, and I have a lot of ideas my friends think are really cool (and that's how I'd hope to get anywhere -- word of mouth).

Thing is, there's one thing I have always wanted, that my friends and strangers hated: permanent death. Now, the emotional response I get to this is visceral revulsion, every time. I'm pretty sure I am the only person that wants this, or if I'm not, I'm a tiny minority.

Now, the reason I want it is because I want the actions of the players to matter. Unlike a lot of other MUDs, which have a set of static city-states and social institutions etc, I want the things my players do, should I get any, to actually change the situation. And that includes killing people.

If you kill someone, you didn't send them to time out, you killed them. What happens when you kill people? They go away. They don't come back in half an hour to smack talk you some more. They're gone. Forever.

By making death non-permanent, you make death not matter. It would be similar if a climax to a character's arc is getting a speeding ticket. It cheapens it. Non-permanent death cheapens death.

How can I:
1) Convince my players (and random people!) that this is actually a good idea?, or

2) Find some other way to make death and violence matter as much as it does in real life (except within the game, of course) sans character deletion? What alternatives are there out there?

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:
Correctly implement of an object rotation How can I correctly implement 360 degree rotation of some object, every time when some condition is meet?

I have two class, one with definition of function and second with setInterval() function. The problem is that the 360 degree rotation is performed only once, even if later also occurs this condition.

First class (A):

function rotObject()
{
if(rot < 360)
{
 _root.myObject._rotation = _root.myObject._rotation + 10;
}
else
{
clearInterval();
}
rot = rot + 10;
}
var rot = 0;

Second class (B):

class B extends MovieClip {
if (<something>) {
setInterval(A.rotObject, 10);
}
}

sentences:
What kind of system can I use to balance an RPG? I'm developing a 2D RPG game, like Zelda. I've developed a first version, for studies.
Now, I'd like rewrite it in better way

The character has strength, agility, willpower, constitution, dexterity and concentration and has to fight monsters. Typical.

But I'm a noob, and I would like advice for creating the game system that the characteristics for damages, level-up, resistance, and so on. The one I used in the first version was not balanced.

So, what kind of system can I use ?

sentences:
What should the data structure of a flexible ability system look like? Hi guys I am currently working on a turn-based RPG that will require me to create numerous abilities with little overlap. I've been looking to other games to see how their ability and combat system is design and has run into issues regarding the data structure.

For the purpose of this question let's look at Pokemon RED & BLUE's ability system. Here are a few things that abilities can do:

Target User or Target Enemy or Both (i.e. Self Destruct)
Has an Accuracy Value
Has 1-2 Element value
Has PP Value
Is either a Special or Normal attack type (determines which stat is used to calculate the damage value.)
Increase / Decrease a primary Stat for the battle (ATK, DEF, SATK, SDEF, SPD, LUK)
Increase / Decrease overall Accuracy of the target by X% for Y turns (or the entire combat.)
Increase / Decrease overall Evasion of the target by X% for Y turns (or the entire combat.)
Deal Damage to Target for X amount (Where X can be based on calculated from the ability's base damage value, or using the damage taken that turn i.e. Counter)
Heal the Target for X amount (Where X can be based on calculated from the ability's base power OR based on damage dealt by the ability, i.e. Absorb)
Skips X Turn (i.e. Dig)
Critical chance * X for this attack.
Has X% chance to apply Status Effect Y (Y being: Burn, Confuse, Sleep, Poison, etc)
1 Hit KO Target
Cannot be hit for X turn (i.e. Dig)
Hits X times (Taking the ability's Accuracy value into account each time.)
Forces the attack to happen first
Forces the attack to happen last

I believe there may be many more. Now, Pokemon abilities can manifest a combination of any number of the above properties, usually no more than 3-4. For example:
- Counter = Skip 1 turn and deals damage to the enemy equal to 2x the damage received that turn as long as it's a Normal or Fighting move.
- Dig = Skip 1 turn, cannot be attacked that turn, deal damage next turn.
- Absorb = Deals damage, at the same time heal the user for 1/2 the damage dealt.
- Self Destruct = Kills self and deal huge damage to the enemy.
- Comet Punch = Hits the enemy 2-5 times (each time the hit chance is 85%)

As you can see, this gets quite complex. The examples cited above are just a few of the abilities that the game have and with those capabilities, it's possible to create quite a varied set of abilities that do not overlap.

The problem I am facing is 2 folds:

How would I design the data structure that would allow me to keep adding new abilities like this into the Database after the system has already been written?
How would the combat system actually handle the data once it's pulled out?

I assume that it will have to involve some form of scripting... and unstructured data structure like NoSQL so some abilities can have some things and some do not (like skipping turns.) However, how is this normally done? Do I store each ability as a blob somehow and handle them differently in code? That also means that the code MUST be able to handle ALL possible combinations (which will make the combat system extremely complex and time consuming to build?) Or did Pokemon just hard coded all the abilities (which seems quite impractical?)

Here's what we currently have for our ability data structure: (in JSON)

{
    "name"     : "Ability Name",
    "accuracy" : 0.85,
    "base"     : 50,
    "type"     : 0,              // (0 = normal, 1 = special)
    "target"   : 0,              // (0 = self, 1 = enemy, 2 = both)
    "PP"       : 30,
    "element1" : 1,              // (0 - 16, for each element)
    "element2" : 2,
    "blob"     : { ... }
}

This will allow for something like the above, but the code would still have to handle all the possible combination of the blob. Would my understanding be correct here?

Any insight would be extremely appreciated.

P.S. - If this question need to be reworded somehow to make it clearer, please let me know... it's an extremely complex problem so I did as best I could, but would appreciate feedback. Thanks!

sentences:
Unity3D : Creating & Sharing light-baked levels without updating the game I want to give myself freedom to add more levels after releasing the game. For creating levels I broke down structure and created a tilemap like a structure. here's an example :

I will add them up to create a level and send it to server from where I can download the JSON in game and read it at run time to place things around. The problem is I want to also use Global Illumination. What I can do is send lightmap data with created level to server and download and use it for lighting after generating level. But what If my map is huge?? I don't want to have lightmap size. The other thing I can do is create light baked prefabs, suggested by this article, https://unity3d.com/how-to/light-baked-prefabs-on-mobile. But every single object has to be attached to a surface and baked because of shadows. Is there a better approach?

Thank you.

sentences:
Why does my Unity/Android game get a small amount of lag when not being touched for some time? I have made a 3d version of space invaders. I made all the assets myself in Blender. I feel that it's a very basic game and my Galaxy Note 3 test device should handle it no problem. (Although it's a few years old now so perhaps some kind of shader issue or something that my phone not updated enough for ?)

There are 55 enemies all with one mesh each. There's the flying saucer model and the player model.

Then there's a plane for a background, and 4 defensive meshes (although I've tested without these and the result is the same).

Basically, it all runs superbly (I have turned down much of the lighting and graphics quality etc, but have left basic shadows in). However I notice that if the player just lets the phone sit there in game without touching it, there is very slight (but noticeable) frame lag.

All the enemies have a very short animation which moves its arms a small amount.

I could post the code but its massively unorganized and really quite an embarrassment (HAHA!). Also I'm not sure what parts are relevant so it would be a huge post.

Is there any known issues that can cause the lag only when not being touched? As I feel like some of my old projects might have had this happening too but they've been deleted now unfortunately so I can't really dabble with it.

It works smooth as silk in the Unity Editor Android 'emulator' and as I say, if I actually play the game on my phone it's smooth too.

sentences:
How can I draw multiple lines connected via "nodes" with SlimDX? I currently read out XML data with the following scheme: Position x,y,z

I try to add one new Vertex for each position node and add it to a Vertex array.

Then I try to render this list of vertices so I get all those lines connected to represent a "path" through space.
(Space is 3D)

What I tried so far:

    [STAThread]
    static void Main()
    {
        var form = new RenderForm("SlimDX - MiniTri Direct3D9 Sample");
        var device = new Device(new Direct3D(), 0, DeviceType.Hardware, form.Handle, CreateFlags.HardwareVertexProcessing, new PresentParameters()
        {
            BackBufferWidth = form.ClientSize.Width,
            BackBufferHeight = form.ClientSize.Height

        });
        form.Height = 900;
        form.Width = 900;

        LineVertex[] waypoints = new LineVertex[1024];

        XmlDocument paths = new XmlDocument();
        paths.Load("data.xml");
        XmlNode rootNode = paths.DocumentElement;

        int index = 0;
        foreach (XmlNode waypoint in rootNode)
        {
            foreach (XmlNode position in waypoint)
            {
                Console.WriteLine(position.ChildNodes[0].InnerText);
                float b = 1000.0f;
                float x, y, z;

                x = (float.Parse(position.ChildNodes[0].InnerText) / (b * b));
                y = (float.Parse(position.ChildNodes[1].InnerText) / (b * b);
                z = (float.Parse(position.ChildNodes[2].InnerText) / (b * b));

                Console.WriteLine(x.ToString() + " / " + y.ToString() + " / " + z.ToString());

                if (index % 2 > 0)
                    waypoints[index].Color = Color.Yellow.ToArgb();
                else
                    waypoints[index].Color = Color.Red.ToArgb();
                waypoints[index].Position = new Vector3(x, y, 0.0f);
            }
        }

        MessagePump.Run(form, () =>
        {
            device.Clear(ClearFlags.Target | ClearFlags.ZBuffer, Color.CornflowerBlue.ToArgb(), 0f, 1);
            // Since we don't have any lights in our scene, our lines won't receive
            // any light and will therefore be black...
            // ...but we want them golden as an asinus aureus, so let's disable lighting.
            device.SetRenderState(RenderState.Lighting, true);
            device.BeginScene();

            // Our struct was meant to describe a position and a color,
            // let's tell the device about it.
            device.VertexFormat = VertexFormat.Position | VertexFormat.Diffuse;

            // In this particular case SlimDX does not need the
            // vertex stride, it will be automatically calculated.
            device.DrawUserPrimitives(PrimitiveType.LineList, 0, waypoints.Length / 2, waypoints);

            device.EndScene();
            device.Present();

        });

        foreach (var item in ObjectTable.Objects)
            item.Dispose();
    }
}

But this does not work, and I am sure it is the complete wrong approach!

EDIT: So far one solution worked out, but not very well.
And I also need the Vertices to be changeable at runtime, so I locked at the documentation and samples, they always use VertexBuffer() to make it possible to dynamically change the Vertices by using a DataStream as Input for the VertexBuffer.

A question still open to me is, since I am used to "Update(Time time)" formats the procedural still of DX/OpenGL oftens confuses me.
So I assume that MessagePump.Run() represents the drawing call that's repeated each frame.
So if some values before the drawing call change like a Vertex, that's put into the datastream, I can instantly see the updated result on the screen.
Is that assumption right?

sentences:
Transform inputs don't work I'm writing a C# player script for a class and when I run, the sound inputs work fine, but the movement inputs don't respond, and I don't know how to fix it.

Code:

Rigidbody rigidbody;
AudioSource audioSource;

void Start(){
    rigidbody = GetComponent<Rigidbody>();
    audioSource = GetComponent<AudioSource>();
}

void Update(){
    ProcessInputs();
}
private void ProcessInputs()
{

    if (Input.GetKey(KeyCode.Space))
    {
        rigidbody.AddRelativeForce(Vector3.up);
        if (!audioSource.isPlaying)
        {
            audioSource.Play();
        }
    }
    else
    {
        audioSource.Stop();
    }
    if (Input.GetKey(KeyCode.A))
    {
        transform.Rotate(Vector3.forward);
    }
    if (Input.GetKey(KeyCode.D))
    {
        transform.Rotate(-Vector3.forward);
    }
}

sentences:
How do I become a game publisher? I wonder how I can become a game publisher locally. For example, I know a Japanese game that I want to publish in India, where I live.

How do I acquire a license to do this? I tried emailing the Japanese game company, but they didn't reply. I also asked if they need to know my company size or credits in India before proceeding with a contract, but they also keep silent.

sentences:
Order array of points in counter clockwise I happened to see an answer to "Sort array of points in clockwise", could you please elaborate the 4th point of that answer:

sort points relative to their a value, using qsort for instance.

How do I do the above step?

I'm looking for an algorithm to sort list of points in counter-clockwise.

sentences:
Visualize quaternion euler angles without gimbal lock I fusion ACC and GYRO data with Mahony algorithm, and then I want to show a line chart representing roll pitch and yaw to the user, so they can understand the degrees. As you can imagine, gimbal lock comes in at 90 degrees.

I also have an activity where the user can see a cube rotating correctly, having quaternions as input.

Is there a way to visualize the angles in degrees without gimbal lock? I can only manage to show an OpenGL shape rotating correctly, but my goal is to show the degrees.

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:
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:
How can you effectively filter your community feedback? I am not asking for myself, I am asking for someone else who will likely not read this question because he is too busy reading his email, but I am sure that this question will be of a lot of value to others.

The poor guy has the problem that his development project got quite a bit more attention during development than he liked. Now he gets bombarded with emails full of bad suggestions and useless bug reports. Reading through all these emails takes him several hours of development time each day. However, not reading it is not an option either as it would mean that he could miss some emails which are actually important, like mails from potential project members, useful bug reports or press and business contacts.

He recently called it the biggest problem for the development of his project in a 20 minute video (you don't need to watch this rant entirely. The blog post linked in the first sentence of this question summarizes it very well)

How can a game developer canalize and filter their feedback stream to improve the signal-to-noise ratio?

sentences:
Sprite brighter than texture I have imported a new texture into UE, and have created a new sprite. I have setup the material of the sprite as follows:

I have also set my texture as texture-parameter. But my sprite renders brighter than its texture:

Why? What am I doing wrong?

Thank you in advance.

sentences:
Networking - How does server fixed-timestep work? I'm making a server/client model for a top-down 2d shooter. Because I need to calculate collisions with walls & other players using a small delta, I want to use the fixed-timestep model like in this example: https://gafferongames.com/post/fix_your_timestep/. Apparently this is a common approach for network games.

Right now my model looks something like this:

Client connects and is synced to the current server tick (let's say
tick is 50)
Client sends its first input + the time pressed (local tick 50) to the server
Server receives the message at tick 55. Because the message was for tick 50 which has passed, this request is ignored.

As I understand it, the client and server run at the same rate, but because of latency the client sends messages too late and all get ignored. Am I supposed to let the server run a few ticks behind the client somehow? How do I resolve this?

EDIT: No, this is not a duplicate of that question. What OP is asking in his topic is how to account for lag visually from other players. The answer is mostly you can't, but you can smooth it out with entity interpolation.

My dilemma is that I can't figure out how to process inputs at all server-side using a fixed-timestep model. I assume the client sends timestamps which are processed when the server reaches that same frame, but if client+server are always frame synced, that means all messages are from the past and are ignored. If I allowed the server to accept a past input anyway it would have to implement it immediately instead of the original frame it was meant for, which would result in inaccuracy.

I'll make it real clear: If a client sends an input at tick 4 but it reaches the server at tick 7, how does the server go back and process an input meant for tick 4?

sentences:
Where/how do I store configuration files in Unity development? I am transitioning from working with cocos2d-iphone to Unity.

One particular thing I loved were the .plist files: you could easily put any sort of configuration data you wanted: for game levels, stats, etc.

Now, with Unity, I am not entirely sure if I am supposed to be using such files. I suppose I can, but I'd rather adapt myself to whatever Unity developers use. What is the equivalent to property-list files in Unity development? Plain text files?

sentences:
Show the GUI button when mouse hover to the object i already have this player on my screen. And i want, whenever the mouse hover at the object, the GUI button show itself (like tooltip). I tried below code, but the button is not showed up when i hover at the object. Here is my code:
void OnMouseEnter()

    {

        Rect buttonRect = new Rect(250, Screen.height - buttonHeight, textInfoPlayerButtonWidth, textInfoPlayerButtonHeight);

        if (GameManager.instance.currentPlayerIndex == 0) (the object)

        {

            if (GUI.Button(buttonRect, "This is player 1"))

            {

            }

        }

    }

I want to be like this:

But i want it to be show that GUI hovering button on that character, not when the character selected.
Thank you

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:
Making objects larger than 1 tile in a pixel art tile map I'm working on a pixel game, and started creating a little town to test some stuff.

My question is whether there is a way to create bigger objects without having to split them into several parts.

My grass tiles and similar are 16 pixels wide, but how do I build a house for example, I want to stay at 16 pixels with all objects but the house would be far too small this way.

I know I can build it by creating the parts separately, but is there an easier way?

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:
blurry image rendered I'm using Direct2D to render a PNG image using a ID2D1BitmapRenderTarget and then caling it's GetBitmap() function and rendering the image using ID2D1HwndRenderTarget::DrawBitmap().

Some of the images rendered this way are clear but others appear blurry. I did some research and followed a tutorial to make my application "DPI Aware" but it didn't help.

(sample with a blurry image on the left)

What could cause the rendered image to appear blurry? Has anyone experienced this issue before? What can I do about this?

sentences:
Unity - What changes to a game object trigger baked lights to need a rebake? I've noticed that sometimes when I make changes to game objects in scenes that have baked lights that the baked shadows will no longer be in effect and dynamic lights will instead be showing.

Destroying and recreating the object seems to trigger this reliably, but what other changes to games objects in a scene can cause a rebake to be needed?

sentences:
finding the angle to launch a projectile at a 3d coordinates I have a game where the user can shoot a bullet and the bullet flies through 3 dimensional space and eventually hits the ground somewhere. My question is how can I calculate the pitch of the angle to make the bullet hit a specific coordinates with possibly different elevations.

My known factors are:

The gravity force
The initial projectile velocity
The shooting position
The target position

In my case I do not need to factor for target movement, I am trying to make something similar to an artillery weapon that fires into the sky and have the bullet land somewhere else at a target. Because I am trying to make an 'artillery-like' weapon I need the weapon to aim up at the sky, not directly at the target.

sentences:
User extendable content with Contentmanager I developed a towerdefense game that uses xml-Files for almost everything, (creeps, levels, towers, upgrades). Those Xml-files define properties like textures, sounds and values like hitpoints.

My goal is to give the user the power to add and modify those things, which will be some kind of editor in the future probably.
For now it shall be notepad...

So this makes using the ContentManager impossible i guess, since it needs to compile the data into those xnb Files.

I dont have a problem to use XmlSerializer, but how does it work for textures or sounds? Do i need to write my own code for loading the texture into vram etc?

Do i need to reinvent the wheel here and write my own ContentManger or can I make use of an existing feature?

I found a few "similiar" questions but none really gave me an answer.

sentences:
The underlying mechanism in 'yield return www' of Unity3D Game Engine In the Unity3D game engine, a common code sequence for getting remote data is this:

WWW www = new WWW("http://remote.com/data/location/with/texture.png");
yield return www;

What is the underlying mechanism here?

I know we use the yield mechanism in order to allow the next frame to be processed, while the download is being completed. But what is going on under the hood when we do the yield return www ?

What method is being called (if any, on the WWW class)?
Is Unity using threads?
Is the "upper" Unity layer getting hold of www instance and doing something?

EDIT:

This question is specifically about Unity3D internals. I'm not interested in explanations of how yield statement works in C#. Instead, I'm looking for an inside view of how Unity deals with these constructions, to allow, for example, to WWW to download a piece of data in a distributed manner across several frames.

sentences:
One AI object for each npc Let's think for a moment a game where you'll have around 1k npcs, each one has to take its own decisions. Should each one has an object that decides what to do, or maybe exist one to process every unit?

Also, let's think about a complex ai, not just check if npc can see the player nor decides if npc will attack or not. Something like Dwarf Fortress does.

sentences:
iOS - pass UIImage to shader as texture I am trying to pass UIImage to GLSL shader. The fragment shader is:

varying highp vec2 textureCoordinate;

uniform sampler2D inputImageTexture;
uniform sampler2D inputImageTexture2;

void main()
{
  highp vec4 color = texture2D(inputImageTexture, textureCoordinate);
  highp vec4 color2 = texture2D(inputImageTexture2, textureCoordinate);

  gl_FragColor = color * color2;

}

What I want to do is send images from camera and do multiply blend with texture. When I just send data from camera, everything is fine. So problem should be with sending another texture to shader. I am doing it this way:

- (void)setTexture:(UIImage*)image forUniform:(NSString*)uniform {

  CGSize sizeOfImage = [image size];
  CGFloat scaleOfImage = [image scale];
  CGSize pixelSizeOfImage = CGSizeMake(scaleOfImage * sizeOfImage.width, scaleOfImage * sizeOfImage.height);

  //create context
  GLubyte * spriteData = (GLubyte *)malloc(pixelSizeOfImage.width * pixelSizeOfImage.height * 4 * sizeof(GLubyte));
  CGContextRef spriteContext = CGBitmapContextCreate(spriteData, pixelSizeOfImage.width, pixelSizeOfImage.height, 8, pixelSizeOfImage.width * 4, CGImageGetColorSpace(image.CGImage), kCGImageAlphaPremultipliedLast);

  //draw image into context
  CGContextDrawImage(spriteContext, CGRectMake(0.0, 0.0, pixelSizeOfImage.width, pixelSizeOfImage.height), image.CGImage);

  //get uniform of texture
  GLuint uniformIndex = glGetUniformLocation(__programPointer, [uniform UTF8String]);

  //generate texture
  GLuint textureIndex;
  glGenTextures(1, &textureIndex);
  glBindTexture(GL_TEXTURE_2D, textureIndex);
  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);

  //create texture
  glTexImage2D(GL_TEXTURE_2D, 0, GL_RGBA, pixelSizeOfImage.width, pixelSizeOfImage.height, 0, GL_RGBA, GL_UNSIGNED_BYTE, spriteData);

  glActiveTexture(GL_TEXTURE1);
  glBindTexture(GL_TEXTURE_2D, textureIndex);
  //"send" to shader
  glUniform1i(uniformIndex, 1);

  free(spriteData);
  CGContextRelease(spriteContext);
}

Uniform for texture is fine, glGetUniformLocation function do not returns -1. The texture is PNG file of resolution 2000x2000 pixels.

PROBLEM: When the texture is passed to shader, I have got "black screen". Maybe problem are parameters of the CGContext or parameters of the function glTexImage2D

Thank you

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:
Unity2D: Frost Effect Time scale I downloaded this package ("Frost Effect by Steven Craeynest") on Unity Asset Store and altered it into making the effect happen once I click on a button (button 1), I first disabled the frost button (button 1) in my inspector before playing the game and created another button (button 2) to activate the frost button(button1). However I'm having issues with the frost effect. You see when I click on button 2 to activate the frost button (button 1) frost effect works for a bit but then stops at delayBeforeUnfreeze like time.timescale is equaled to 0 and the only way of making time.timescale is equaled to 1 is by pressing my pause button and clicking the resume button. Anyway this is my script:

private FrostEffect frost;
float duration = 0.2f;
float delayBeforeUnfreeze = 0.34f;
private float previousTimeScale;
public GameObject frostbutton;
public int buttonCount = 0;
int timesActivated =  0;

public void Check() {
    buttonCount ++;
}

// Use this for initialization

void Start () {
    previousTimeScale = Time.timeScale;
}

public void Activate ()
{
    frostbutton.SetActive (true);
}
public void CreateFrost ()
{
    if(timesActivated < buttonCount)
    {
        timesActivated++;

        GameObject.Find ("Main Camera").GetComponent<FrostEffect> ().enabled = true;
        //Slow timescale
        Time.timeScale = 0.06f;
        //Freeze time effect
        DOTween.To (x => FrostEffect.FrostAmount = x, 0.0f, 0.34f, duration)
    .OnComplete (() => {
            //Unfreeze tween effect
            DOTween.To (x => FrostEffect.FrostAmount = x, 0.34f, 0f, duration)
                .SetDelay (delayBeforeUnfreeze);

            //Set timescale back to previous.
            Time.timeScale = previousTimeScale;
        });
    }
}

}
Thank you. :)

Second Edit

This is my panel animation script:

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

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

This Youtube link will show you what my panel animation looks like: 31:47.
Thank you. :)

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:
GLSL: Noise via texture I am trying to access a texture in a fragment shader to overlay this texture over a certain area.

varying vec4 v_color;
varying vec2 v_texCoord0;

uniform sampler2D u_sampler2D;
uniform vec4 u_oldcolor;
uniform vec4 u_newcolor;
uniform vec3 u_noise;

void main(){

    vec4 color = texture2D( u_sampler2D , v_texCoord0 ) ;
    float threshold = 0.005f;
    if(color.r <= (u_oldcolor.r + threshold) && color.g <= (u_oldcolor.g + threshold) && color.b <= (u_oldcolor.b + threshold)
    && color.r >= (u_oldcolor.r - threshold) && color.g >= (u_oldcolor.g - threshold) && color.b >= (u_oldcolor.b - threshold)){
        color.rgb = u_newcolor.rgb + vec3(v_texCoord0, 0.1);
    }

    gl_FragColor = color ;

}

For every pixel the shader checks for a certain color and replaces it with a new color+v_texCoord0.

Now I am want to bring in a third component: a noise texture to make it look like this:

I searched the web for a solution but I could not find anything helpful.

My questions:
1.Is this even possible to accomplish via a shader?
2.How to access the texture ?

I hope that my questions are clear and proper for this forum :) .

sentences:
How can I render a texture to a polygon in SDL2? A fake 3D problem I am working on a fake 3D game recently.  The game is based on the perspective principle and using angular perspective.  Here is a screen shot:

But the problem is that the walls and floor displayed are polygons, not exact rectangles.  I draw them preline.  Now I want to put some imgs on them.  How can I render a texture to a polygon?  How do I make texture exactly fill the area?  How do I give the plane a more 3D-like feel?

sentences:
Random lines away from images in java2d opengl game Working on a java game that uses some pngs images for icons/textures. A few images ( fewer than 5, out of dozens ) are showing some odd parallel "artifact" lines. They move with the image, are certainly not in the PNG itself.

I can't figure out what's causing it. Using slick2d, lwjgl. I've tried slcik2d and opengl methods of clamping textures but that didn't help.

This black line is showing off the right-hand side of an icon (maybe 50% of the actual image width away). It should not be there.

sentences:
Rotate from Current Rotation to Another using Angular Velocity I am attempting to calculate an angular velocity that will get me from the current gameObject.transform.rotation to a given Quaternion rotation using angular velocity.  I've tried several methods but all of them seem to cause oscillation (maybe due to the gimbal nature of Vector3 for angular velocity).

Here are the pieces of code that I have tried:

Quaternion rotationDelta = Quaternion.Inverse(gameObject.transform.rotation) * remoteRotation;
return (rotationDelta.eulerAngles / PlayerMovement.BROADCAST_INTERVAL);

Another attempt using toAngleAxis:

rotationDelta.ToAngleAxis(out angleInDegrees, out rotationAxis);
Vector3 angularDisplacement = rotationAxis * angleInDegrees * Mathf.Deg2Rad;
return angularDisplacement / PlayerMovement.BROADCAST_INTERVAL;

Using Eulers:

 Vector3 difference = new Vector3(Mathf.DeltaAngle(gameObject.transform.rotation.eulerAngles.x, remoteRotation.eulerAngles.x),
                                  Mathf.DeltaAngle(gameObject.transform.rotation.eulerAngles.y, remoteRotation.eulerAngles.y),
                                  Mathf.DeltaAngle(gameObject.transform.rotation.eulerAngles.z, remoteRotation.eulerAngles.z));

 Vector3 differenceInRadians = new Vector3(difference.x * Mathf.Deg2Rad,
                                           difference.y * Mathf.Deg2Rad,
                                           difference.z * Mathf.Deg2Rad);

 return differenceInRadians / PlayerMovement.BROADCAST_INTERVAL;

sentences:
using per pixel collision for an elastic response I realize this might be open ended ended but curious if I just did some over kill...

I had this

http://xbox.create.msdn.com/en-US/education/catalog/tutorial/collision_2d_perpixel

and i reworked it to work with my animation code in XNA and what not.  It works well, but now I want to use this to decide if there was a collision and to have the items (characters) bounce off eachother elastically.  Was the per pixel too much and I could of just used a bounding box ? (in fact would that of been preferred for what needs to be calculated in the response for an elastic collision?)

Looking for guidance really.

sentences:
How to make high quality gifs of Unity game play I've seen several Unity game play gifs, mostly on twitter. Are there any tools for making high quality gifs in Unity that are quite flexible? For example, I video recording tool that captures the game window and allows users to make gifs of portions, possible specifying the desired quality. Generally, I am looking for a tool that is quite flexible (has a lot of options for capturing gifs) and possibly game window video.

UPDATE

Some examples are here and here. Generally, several of the gifs that are hash-tagged madewithunity a really high quality.

sentences:
How can I place prefabs into a world in Unity? I've looked around for a bit and can't seem to find any way to get a prefab with "Resource.Load" and then to place that object into the world. I'm making a roguelike so when the player enters a room, all rooms around load in. The room to the top would load a random prefab from a list of rooms, check if there's already a room where it wants to go and then PlacePrefab(transform.position, transform.position + 10units); So it would place the prefab 10 units above where the current room is (All code for the rooms will run from a centre object and the prefab would be placed on the centre.)

Thanks in advance for any help :)

sentences:
How to rotate actors around the actor like a satellite around the earth? I'm not a pro in LibGDX and physics but I know basics, vectors, actor's actions and so.

I'm trying to achieve a movement like on the gif below:

For now, let's say that I have a stage and a central actor that the moon and comet will rotate around.

The problem is here that I have no idea if this is achievable with 2D. Should I implement some sort of 3D in LibGDX?

Also, is there a way so these objects move in a 'random' path, not the straight line like the comet below? (Moon is a little bit randomized)

I know that this question is too broad, but I really didn't know where to ask about this. I'm here to learn cause I always wanted to build a thing like this. I personally think that this is achievable with LibGDX's actions cause I saw something similiar somewhere.

If someone could point me the way I would be grateful :) Thanks!

sentences:
How to combine image with a gradient? Or make it more featured in a different way I generate an abstract 128x128 image, that is in general two-color (it uses values scaled between "blue" and "white", or other similar color pair). I need to make the image more "featured".

Currently, I am blending a four color gradient (prepared in a separate 128x128 buffer) via techniques based on equations from gimp docs. The effects are not good – the gradient dominates over the source image.

How to add some "features" to an abstract image, in procedural way? Maybe you have some tested techniques?

EDIT: here is the image – based on Perlin Noise:

sentences:
How can I identify loaded models so I can efficiently avoid loading them twice? I'm making a fairly basic OpenGL 3D engine, at the moment. In this engine, when you load an object, you would write

manager->LoadObjFile("cube.obj");
manager->AddParent("uvmap.bmp", "cube.obj", "cube", glm::vec3(10.0f, 1.0f, 0.0f));

"uvmap.bmp" being the texture, "cube.obj" is the .obj file path, "cube" being the ID for the object.

My question is, at the moment, when it loads an object, it stores the object in a struct with all of the buffer data and an ID, the ID being the path of the obj file, so when I load an .obj, it runs through all of the already loaded files and compared the ID of each using strcmp, which obviously when there's thousands of items, is going to start to get a bit slow.... it does the same for AddParent, and most of my other methods (different vector of data than where the obj data is stored).

What would be best in terms of identifying items, an integer? I really don't know, I want this to be as high level, user friendly as possible, but want to keep it as optimized and as efficient as possible.

sentences:
How to calculate falling speed in spritekit? Is there a way to calculate falling speed based on physics body settings, instead of waiting it to fall and getting velocity?

I would like to find what time it takes for object to fall from defined point and hit the ground. Usually using this formula time = distance / speed, but this time speed is a problem.

sentences:
GameObject LookAt not aligning properly I have a celestial sphere with a plane in the centre and spheres (stars) aligned around the centre with a fixed radius.

In order to show the stars visible from a certain latitude and longitude from Earth, I need to rotate the plane accordingly.
To rotate the plane properly, I converted the latitude and longitude into 3D vectors, then utilised the LookAt() method to point the plane at this vector.
The following is the code which calculated the vectors from the coordinates, and utilises the LookAt() Method:
public void positionLand(double latitude, double longitude)
{
    double latitude_rad = (math.PI / 180) * latitude;
    double longitude_rad = (math.PI / 180) * longitude;

    Vector3 markerPositioning = new Vector3();
    markerPositioning.x = (float)-((math.cos(latitude_rad)) * (math.cos(longitude_rad)));
    markerPositioning.y = (float)((math.cos(latitude_rad)) * (math.sin(longitude_rad)));
    markerPositioning.z = (float)((math.sin(latitude_rad)));

    groundPlane.transform.LookAt(markerPositioning);
}

To test if this would work, I used the coordinates of London, UK, latitude: 51.509865 and longitude: -0.118092. And this was the result:

With the LookAt() method changed to the following: groundPlane.transform.LookAt(markerPositioning, Vector3.forward);
This is the result:

Replacing groundPlane.transform.LookAt(markerPositioning); with groundPlane.transform.up = markerPositioning; results in the following:

As you can see, the plane is not properly rotating. Initially, I thought maybe the LookAt() method is using the incorrect forward vector of the plane gameobject, but this isn't the case as there is no connection between the way the plane rotated and the coordinates of London as the plane is near vertical at 89 degrees.
What am I doing wrong and how can I fix this?

sentences:
How to make player stay on a moving object I've made an obstacle course with various moving parts to test out movement of a player. In the obstacle course there is a section where there are multiple cubes moves from side to side, and you have to jump from one to the other. But regardless of their speed, I can't seem to get the player to stay on top of any of the moving cubes. I have no clue how to fix this my only guess would be to use materials, but I can't apply any to the character controller. I appreciate any suggestion that you can give. Also the movement is done as an animation that I created in unity in the animation window.

Thanks, Nova

sentences:
Advice for a table top rpg with rpg systems English isn't my first language so sorry in advanced for odd wording.

Idk if this is the right type of form but,I would like to make a game much Like D&D.
With that said basic attacks seem to work out just fine no matter lvl or stats I think that the numbers come out a fair.

mag= (100 + buffs + gear) = sum
res= (100 + res + buffs + gear) = sum
magic damage =(A.mag*mag.sum)/(res.sum)

This pushes out fairly low numbers that are then ran into a set of code that does the damage by number of its.

*1 for attacks that are 5 to 10 hits
*2 for 2 to 4 hits
*4 for single hit skills and spells. (had a problem that made single hits to weak for a time.)
*.5 for skills/spells that hit 11 to 15 times.

So here is where the problem comes in this is a Ip i made over years of thinking and putting things together. Spells are ranked from 1 to 5 however 5 is a insta win at the cost of the users life.

I do want to note as Dm I use my pc to run the above code. I would love to hear any form of tips or advice that might make things run a little better in the long run.

If we plug the numbers from the race above at level 1 those numbers being 40 magic and give the attacker a weapon buff of 20 and a attack buff of 10 it should come out to 130. Note that the magic attack will not be used in getting the sum of these buffs. Now lets make the defends gear a gear buff of 10 and a res buff of 15. the res stat is used in the code as shown below leading us to our sum of .155

attacker (100 + 20 + 10) =130
defender (100 + 30 + 10 + 15) = 155

These numbers would give us our sum. this is then plugged into another set of code as seen below

(Mag*attacker sum)/(defender sum)

so if we plug in the numbers it should look like this.

(40*130)/(155)= 33.54

This is then taken automatically by the system and * by the following numbers 2,4,.5 this displays the outcomes of the above number as the first hit in the combo.

(40*130)/(155)= 33.54 <this is then * by the number of hits a 5-10 hit>
(40*130)/(155)= 33.54*2 = 67 <*2-4>
(40*130)/(155)= 33.54*4 = 134 <single hit spells>
(40*130)/(155)= 33.54*.5 = 16 <*10 to 15>

So to explain the above numbers lets say I use a spell that cast 15 chances to hit in damage that spell would use the formula of 10 to 15 or .5 making each hit deal 16 damage if they all land that would be 240 damage taken. if unlucky however only 3 of those 15 could hit and you would still use the 16 as your base damage for said attack.

In theory this should be fine (i think) this makes some AoE's broken as a AoE without a chance to miss would deal massive damage every time. So maybe in the long run my question might really is their a way to make this more fair for pvp?

In case asked

Yes I am likely tying harder than I need to.

I can also Show what a a good player sheet and a broken player sheet look like if someone thinks it would help. I do hope that this is more clear than before or at most gives a better idea of what i'm tying to ask.

I have never made a game I have less than a year of html,c# and,c++ under my belt so i hope it kinda looks like it should work.

Thank you for all replies

sentences:
Level editing using a 2D map for a 3D game We're trying to make a level editor for a 3D game that involves walking around outdoor environments. In many ways a heightmap satisfies the game's needs, but it also falls short in several ways, so we're considering various enhancements to the heightmap concept, but it's proving difficult to find a simple solution to this problem.

For a start, a heightmap has great difficulty with sharp edges. As long as everything is smooth a heightmap looks wonderful, but it becomes jagged around vertical cliffs, along the edges of roads, and anywhere the resolution of the heightmap becomes relevant. The obvious solution to these issues is to add a layer of vector drawing on top of the heightmap, so we can preciously define the curves of vertical cliffs and roads, and use this to insert specialized polygons into the terrain's mesh. A vertical cliff can even be a simple gap in the terrain mesh that can be filled by another mesh which allows us to render the cliff face however we like, bypassing the limitations that heighmaps usually have.

Another issue with heightmaps is the difficulty of drawing smooth slopes by hand. For the purposes of the game, terrain should either by a gentle slope or a vertical cliff, so there is no ambiguity over whether the player can traverse through it. We could scan the heightmap to detect overly steep slopes and show an error message, but what we really want to do is give the user drawing tools that will only draw acceptable slopes. But how can this be done?

Perhaps the traditional raster heightmap is causing more problems than it is solving, so an entirely different kind of heightmap is called for. Perhaps instead of adding a vector drawing layer, the whole heightmap was done as a vector image and represented as a set of polygons with each polygon having a certain elevation. This way we get smooth curves automatically, and creating meshes for vertical cliffs and flat land is trivial, but representing slopes in the editor and rendering them becomes a challenge.

We've considered a blending tool that would draw polygons on a second layer, and wherever these blend-polygons appear the underlying terrain polygons would smoothly merge together. Polygons that have shared edges would from a slope perpendicular to those edges at an angle that makes the slope walkable. Unfortunately working out the geometry of the resulting mesh is difficult, and it means that cliffs are the default for every change in elevation.

Since it seems more natural for the user to draw lines to block the player's passage rather than drawing the places where the player can traverse, another approach is to have the user draw the cliff lines in another layer just as with the raster heightmap, but now those cliff lines would act to stop the terrain from smoothing itself into pure rolling hills. Imagine each polygon of the heightmap as a pillar of sand with vertical sides, and when a mesh is formed from the map the sand flows out of its pillars, forming smooth slopes in every direction except where it encounters a cliff line and is forced to flow around. Everywhere except the cliffs need to be a gentle enough slope to walk up, so when there is a gap in a cliff the sand needs to flow through and spread out on the other side. We have some ideas about how this might be done, but it's still a major challenge to implement.

Finally, we could just use a grid with sloped blocks to represent slopes. Editing would be easy, generating the mesh would be easy, all the problems would be solved, but being confined to a grid would surely sacrifice the freedom we'd hoped to have. We don't want to be constrained to being axis aligned unless no other solution is practical.

Ultimately the question is: are there practical ways to implement any of the approaches we're considering, or are we coming at this from entirely the wrong direction?

sentences:
How do you use SoundManager for multiple player games over the network? I have created a basic sound manager according to this unity tutorial (https://unity3d.com/learn/tutorials/projects/2d-roguelike/audio). However, I need it to work for multiple players over the network, and it doesn't make sense for them all to be playing the same sounds. E.g. If a player loses, it should play the gameover sound, but the other player(s) should remain in the game and continue playing the game sound. But the current behavior is that once a player loses, everyone gets the gameover sound.

By the tutorial, I currently use a single instance within the SoundManager class. I think I need multiple SoundManager instances, each associated with a client. What's the best thing to attach the SoundManagers too? Or is there a different best practice for managing sounds for multi-player games?

Here's the code for my sound manager:

using UnityEngine;
using System.Collections;

public class SoundManager : MonoBehaviour {

    public static SoundManager instance = null;

    public AudioSource effects;
    public AudioSource music;

    void Awake ()
    {
        if (instance == null)
            instance = this;
        else if (instance != this)
            Destroy (gameObject);
        DontDestroyOnLoad (gameObject);
    }

    public void playSoundEffect(AudioClip clip) {
        effects.PlayOneShot (clip, 1f);
    }

    public void setBackgroundMusic(AudioClip clip) {
        music.clip = clip;
        music.Play ();
    }
}

sentences: How can I apply steering behaviors to a car controlled with turning and acceleration? I feel like I've got my head around steering behaviors,  but I've having trouble applying them to a car. The steering behaviors return forces that one could apply to an object that can move in any direction, but a car can essentially only move forward and turn. I'm having trouble determining how hard the car should turn or how much it should accelerate forward based on the steering force. How can I translate a steering force into the car's input?

sentences:
Cocos2d-x CCFollow Zooming issue Hi I am currently building a cocos2d-x game which incorporates pinch zoom using CCLayerPanZoom class which can be found here

The problem is basically when using CCFollow and zooming and out, it does'nt zoom on the actually followed node, so the camera appears to zoom towards the bottom left corner of the screen, when I would rather it zoom centrally on the followed node.

If I could resolve this I would pretty darn happy. I converted a fix from the cocos2d objective C version in the CCfollow class to cocos2d-x which improved the issue,but if you look at the post in latter link you will see the guy is having the exact same problem, he gave up on fixing it sadly.

I think its close but I don't really know what going on, hopefully someone out there has already faced and fixed this problem.

My converted code is below.

    CCPoint p1 = ccpMult(m_obHalfScreenSize, m_pTarget->getScale() );
    CCPoint p2 = ccpMult(m_pobFollowedNode->getPosition(), m_pTarget->getScale()  );
    CCPoint offect = ccpMult(ccpSub(p1, m_obHalfScreenSize), 0.5f);
    CCPoint tempPos = ccpAdd(ccpSub(p1, p2), offect);
    m_pTarget->setPosition(ccp(clampf(tempPos.x,m_fLeftBoundary,m_fRightBoundary),
                               clampf(tempPos.y,m_fBottomBoundary,m_fTopBoundary)));

I have attached before and after to hopefully make things more clear.

sentences:
Looking for a tournament system for the group of semi-anonymous players some of which may ignore specific matches. How can I do that? I need to implement a tournament system for a one-time tournaments between a finite sets of anonymous players.

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

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

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

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

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

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

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

sentences:
ContentSerializerRuntimeType required in content pipeline? I have a problem at the moment loading in a texture for a larger model in the content pipeline. Now it seems that I need to make a proxy object, which is fine, however looking at the SpriteSheet example provided by Microsoft they seem to use the ContentSerializerRuntimeType attribute to bind the proxy class to the real class for use at runtime.

The problem is they sprinkle serialization attributes all over the runtime class, so I was wondering if you HAVE to do it this way or if it is just a recommendation, and is there any other way of getting your proxy class to the real instance?

Ideally I dont want to have to put attributes all over my classes and would be more than happy to write the serialization code myself if there was a way to, but it seems to be an unknown as far as the documentation goes for this area...

So anyone know a way round this, or is this just the only way to do it?

sentences:
Rotate directly towards a target at a constant speed I've written a program (see on JS Fiddle) that rotates my player towards the mouse cursor at a constant speed. I've computed the angle to the point using the Math.atan2 function, but when incrementing or decrementing the player's rotation towards that value, it does not always take the shortest path.

This image describes the logic I intend to evaluate:

The problem appears when you cross a specific angle, the player rotates the long way around to reach the cursor, instead of taking the shortest path. How can I always take the shortest path at a constant speed?

Many thanks.

sentences:
libgdx automove Actor does not work I am trying to make my sprite start moving from the moment it is created and do its animation. It draws on the screen right and animates but doesn't move. It should start moving towards the direction it is facin this means right and if collision detected to stop the animation do whatever and continue the animation.
Here is my code:

public class grt extends ApplicationAdapter {
 Misheva mshv;

@Override
public void create () {
    mshv = new Misheva();
    mshv.init();

}

@Override
public void render () {
    mshv.drawIt();
    mshv.act(Gdx.graphics.getDeltaTime());

}

@Override
public void dispose() {
    mshv.disposer();

     }

 }

Misheva.java

public class Misheva extends Actor {
int state;
TextureAtlas atl;
TextureRegion [] walk;
SpriteBatch batch;
Animation anim;
float stateTime;
float elapsed = 0;
int horizontalspeed = 10;

public void reset (){
    state = 0;
    stateTime = 0;
}

@Override
public void act(float delta) {
    super.act(delta);
    stateTime += delta;
    switch(state){
    case 0: setX(getX()-horizontalspeed*delta);

    }
}

public void drawIt(){
    Gdx.gl.glClearColor(1, 1, 1, 1);
    Gdx.gl.glClear(GL20.GL_COLOR_BUFFER_BIT);
    batch.begin();
    elapsed += Gdx.graphics.getDeltaTime();
    batch.draw(anim.getKeyFrame(elapsed,true), 0, 0);
    batch.end();

}

public void init (){
    atl = new TextureAtlas(Gdx.files.internal("data/tomaton.atlas"));
    batch = new SpriteBatch();
    walk = new TextureRegion[3];
    walk[0]=atl.findRegion("tomato");
    walk[1]=atl.findRegion("t_walk2");
    walk[2]=atl.findRegion("t_walk1");
    anim = new Animation(1/10f,walk);
}

protected void disposer(){
    batch.dispose();
    atl.dispose();
    }

 }

sentences:
How do I determine if a triangle is visible in my view frustum? I need a fast way to determine if a triangle is visible from a perspective projection view frustum. I am not looking to use an approximation with AABBs or bounding spheres, but need to accurately check an actual triangle against the frustum.

What do I need to do to test whether or not a triangle is completely outside the view frustum volume?

Edit: The nature of my question changed after discussing the actual problem I was trying to solve. I'm not too sure what to do here; do I accept answers based on the original question, or ones that address the actual problem? I'm also writing the original problem here for reference:

I'm trying to put together a 3d scene where I can get the visible longitude and latitude extents given an Earth sphere (centered at 0,0,0 in ECEF coordinates) and a normal perspective projection camera frustum. I then plan to load assets based on the lon/lat extents returned.

I couldn't figure out how to get extents given a view frustum analytically, so I tried to create a mesh based representation of the Earth at various LODs. I wanted to cull the triangles from this mesh against the view frustum which would leave a bunch of quads I could derive lon/lat extents from. Culling using vertices or bounding boxes wasn't appropriate at lower LODs where the mesh faces were much larger, which is why I needed to test the triangles themselves.

Seth's answer below seems like a better solution than generating meshes and culling them.

sentences:
Increasing resources overtime for a browser-based game I've been interested in developing a browser game ala OGame or Ikariam etc. Basically, a menu is displayed with your resources and, overtime, they increase depending on how advanced are you in the game.

Now then, the "resources" information for all players is stored in a MySQL database.

I've considered two methods to keep track of a player's resources:

Update database every second

Every second, something like

UPDATE `Players` SET `Gold` = `Gold` + `GoldProduction`

This is one option. However, performing a query every second for a potentially large table of players is not exactly appealing - but I might be underestimating my server. Am I?

Calculate it when needed

Since you get gold every second, technically the amount of gold any player has should be

(currentTime - creationTime) * goldProduction

What if the player spends gold? Well, gold spending should affect a variable goldModifications:

goldModifications + ((currentTime - creationTime) * goldProduction)

So if you spend 100 gold, goldModifications would be -100.

But wait. Players can upgrade their gold production. Hence, goldProduction isn't constant and this formula is flawed...

... Maybe when you upgrade your gold production, goldModifications will be modified by your current amount of gold (so if you had 1500, we would do goldModifications += 1500), then creationTime will be overwritten to the current time.

So I have two methods. One is incredibly simple (just update the database), but I am unsure if it is too much overhead or not. The other is very complex as there could be any number of factors affecting gold production, but certainly requires less processing power.

What should I do? What do those popular games actually do?

sentences:
best structure to handle entities in an entity component based game engine I am trying to develop a 2D entity component based game with multiple layers as tilemaps (front or back from the scene).

I currently handle the tilemap layers in a 3 dimension array[z][y][x]. Each tile from the map is an entity and have a positionComponent which define x, y and z. The array structure is very convenient to update and render only visibles entities (in the viewport).

I have also added an 1 dimension array to handle the ennemies and items. The problem is that I want to fusion the tilemap and ennemy array in one single structure (I want to update and render entities within a single strcture).

As the entities already have a positionComponent defining x, y and z, is there a good way to get rid of the 3 dimensions array without loosing performance?

Ideal will be to be able to do something like entities.get(z, y, x).

sentences: AI engine for iOS game development? I'm looking for an AI engine for iOS game development (machine learning, path finding).

sentences:
Am I allowed to push my Unity based game's source code to github? I got the Personal version of Unity 5.5 to play around with it1. Let's say I own the rights on all the assets I use in my project, or they are licensed in a way that allows me to use, modify and republish them. That includes all the scripts, models, images, sounds and whatnot. But what about the fact that it's built with a commercial game engine?

Do the Unity terms allow me to host my project's source folder (including the assets) on github? Do I need to include a certain license for that?

Note that I don't care about releasing the game, I'm just talking about sources of stuff I am making to learn the technology.

1) no pun intended

sentences:
How to show a float with no decimals I want to show the current health and stamina of the player using GUI.Label. All is working fine however it shows the values with decimals to the millionth (example: http://gfycat.com/SkeletalSinfulKouprey). How would I go about showing only the whole number?

My code:

 var cur_stamina : float;
    var cur_health : float;

    var staminaRegenRate : float = 5;
    var healthRegenRate : float = 1;

    //regen
    if(cur_stamina < max_stamina){
        cur_stamina += staminaRegenRate * Time.deltaTime;
    }
    if(cur_health < max_health){
        cur_health += healthRegenRate * Time.deltaTime;
    }

    function OnGUI(){
        GUI.Label(Rect(1,1,100,20), "Health: " +cur_health);
        GUI.Label(Rect(1,15,1000,20), "Stamina: " +cur_stamina);
        GUI.Label(Rect(1,30,100,20), "Ammo: " +cur_ammo);
    }

sentences:
Deal with mini states in game Hi :)
I want to ask what is the best way to deal with "mini-states" in game? For example I making game like Simcity, i can build buildings, roads, rails, or I can change something in economy.
I am making something like:

enum
{
  ROAD_CONSTRUCT,
  BUILDING_CONSTRUCT
  VIEW_MAP
  etc..
}

and in the game loop big switch. But the code is getting big. Is there some solution for all popular languages? I am asking because I am writing in C++, AS3 and sometimes in C.

sentences:
How to extract the texture from an image onto a mesh? (preamble: I think this fits either here or SO with computer vision tag, I chose gamedev because I think you guys are probably really good with textures and meshes, but tell me if my decision was wrong.)

I want to accomplish the following: Given an image with an object, a 3D mesh very similar to that object, and rendering parameters that render that mesh to the exact location of this object. I want to "extract" the original texture from the image onto the mesh. (So in a later step, I could re-render the mesh from another viewpoint (of course some of the texture would be invisible/black)). My mesh has uv-coordinates for each triangle so I guess I could either "store the texture on the mesh" somehow, or directly backmap it to a 2D texture map.

So I guess what I want to do is kind of texture backmapping/remapping, kind of the inverse of what is done in game-dev when texturing objects. I was having a lot of trouble finding any useful information on Google about what I want to do, so I thought I'd ask here. Maybe I haven't found the right word for it yet. I think there's probably quite a lot of "stuff" involved because pixel in the original image won't exactly correspond to a location on the mesh.

sentences:
Is it bad practice to add GameComponents and DrawableGameComponents outside of the main initialization method? I'm working on a snake game that has multiple game objects (snakes, apples, obstacles), and game modes (classic, adventure), that are DrawableGameComponents. Is it OK that I'm adding them as needed instead of in the main initialization method?

If not, how should I go about drawing and updates components of my game that need to be added in other methods?

If yes, is there any way to get the initialization or load overridden methods to run? Or is making my own load method and calling it right after adding the component how it should be done?

Thanks!

sentences: How can I randomly generate objects inside of a Complex Area? In my game, I want to generate randomize enemies inside of this green area that I made with a custom editor tool.

sentences:
timeScale=0 doesnt stop all prefabs in unity As expected timeScale=0 can be used for stopping the game or pausing but when i make timeScale equal to 0 some prefabs still move and they can shoot bullets but addforce doesnt effect to bullets and they stop there. I know i can fix the problem on handling code of my prefabs but they are a lot. is there a good way to do the trick in my game?
thank you for helping

sentences:
My texture blends into one single color (DirectX11) First thread on gamedev stackexchange. I am currently creating a cube with a single texture on each side. I got my cube up and running. But when I apply my texture, I get this:

It blends the texture into a single color and apply it. I have various of examples that look near identical but do not have the same problem. Anyone know what can be the cause of this issue?

3D programming in general contains quite a bit of code. I wont copy paste all of it. If you want to see anything specific, you can request it. But here are some of the functions. Thanks in advance.

HRESULT Cubes::Render(ID3D11DeviceContext* _deviceContext, Camera _camera)
{
    HRESULT hr = S_OK;

    unsigned int stride = sizeof(Vertex);
    unsigned int offset = 0;

    _deviceContext->IASetVertexBuffers(0, 1, &this->mVertexBuffer, &stride, &offset);
    _deviceContext->IASetIndexBuffer(this->mIndexBuffer, DXGI_FORMAT_R32_UINT, 0);
    _deviceContext->IASetPrimitiveTopology(D3D11_PRIMITIVE_TOPOLOGY_TRIANGLELIST);

    D3D11_MAPPED_SUBRESOURCE ms;
    hr = _deviceContext->Map(this->mMatrixBuffer, NULL, D3D11_MAP_WRITE_DISCARD, NULL, &ms );
    if(FAILED(hr))
    {
        OutputDebugString("Failed to map matrixbuffer in Cubes.\n");
        return hr;
    }

    WVPBuffer* dataPtr;
    dataPtr = (WVPBuffer*)ms.pData;
    dataPtr->worldMatrix        = DirectX::XMMatrixTranspose( this->mWorld);
    dataPtr->viewMatrix         = DirectX::XMMatrixTranspose( _camera.GetView());
    dataPtr->projectionMatrix   = DirectX::XMMatrixTranspose( _camera.GetProj());

    _deviceContext->Unmap(this->mMatrixBuffer, NULL );

    // Set the position of the constant buffer in the vertex shader.
    int bufferNumber = 0;
    _deviceContext->VSSetConstantBuffers( 0, 1, &this->mMatrixBuffer );

    // Set the vertex input layout.
    _deviceContext->IASetInputLayout(this->mInputLayout);

    // Set the vertex and pixel shaders that will be used to render this triangle.
    _deviceContext->VSSetShader(this->mVertexShader, NULL, 0);
    _deviceContext->PSSetShader(this->mPixelShader, NULL, 0);
    _deviceContext->RSSetState(this->mRasterState);

    // Set shader texture resource in the pixel shader.
    _deviceContext->PSSetShaderResources(0, 1, &this->mTexture);
    _deviceContext->PSSetSamplers(0, 1, &this->mSamplerState);

    // Render the triangle.
    _deviceContext->DrawIndexed(this->mNoIndex, 0, 0);

    return hr;
}

HRESULT Cubes::LoadTexture(ID3D11Device* _device)
{
    HRESULT hr = S_OK;

    hr = D3DX11CreateShaderResourceViewFromFile(_device, "../Pictures/cube.png", nullptr, nullptr, &this->mTexture, nullptr);
    if(FAILED(hr))
    {
        OutputDebugString("Failed to create Cubes texture.\n");
        return hr;
    }

    return hr;
}

Pixelshader:

Texture2D shaderTexture;
SamplerState Sampler;

struct PSIn
{
    float4 Position : SV_POSITION;
    float2 Tex : TEX;
};

float4 PS_Cubes(PSIn _input) : SV_TARGET
{
    float4 textureColor;

    // Sample the pixel color from the texture using the sampler at this texture coordinate location.
    textureColor = shaderTexture.Sample(Sampler, _input.Tex);

    return textureColor;
}

sentences:
How can I do ambient occlusion for simple meshes with few vertices? I want to do ambient occlusion for some simple buildings.

Since simple buildings have very few vertexes, how can I get good results? Is it possible with a per-vertex AO implementation?

sentences: Changing speed of an object Is there a way of changing speed of an object at certain time? I want to change my speed to my initial speed after colliding with any object. I have already added bounce Physics to my colliding objects and player object with Friction set to 0. Please help.

sentences:
Handling Different Aspect Ratios for a Multiplayer Game I'm currently designing a competitive 2D, side-scrolling multiplayer game and I want support full screen play at any aspect ratio (e.g., 4:3, 5:4, 16:10, 16:9). Doing that is not so much a problem, my concern is that the viewable area of the game for a player with a 4:3 monitor will differ from that of a player with a 16:9 monitor quite a bit. In a competitive multiplayer game where being able to see more of the game world gives a player a significant advantage over players who cannot this is a serious problem.

So far I've come up with two possible solutions for this:

Just support different aspect ratios and don't worry about it.
Pick a specific aspect ratio (say 16:9) and do a best fit on all other aspects (i.e., letterbox or pillarbox)

Option 1 doesn't suit me because it's a lazy cop out. Option 2 is much better but then a portion of the screen will be unused for some players. Certainly not the end of the world but not incredibly desirable either. This could be mitigated by rearranging the UI based on the aspect ratio and filling the letter/pillarbox with UI elements instead of simple black bars making better use of available screen real estate.

How is this sort of thing handled in games like Quake, CoD, StarCraft and Battlefield?

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:
Getting a sphere to roll down a .FBX object Unity3D/C# I'm working on a little ramp and ball game in Unity, I modeled the ramp outside Unity and exported it to a .FBX file, then I imported the ramp in to Unity. I set up the ball and ramp, both have Rigidbodies, Ramp is set to isKinematic = true, yet when I play the game the ball just falls right through the ramp and hits the floor below it fine. So it's something wrong with the ramp.

Am I doing something wrong? Are .FBX files unable to apply physics?

Thanks,

Tim.

sentences: DPad style movement for AI without using A* What is the easiest way to implement DPad style movement (No diagonal) for AI without using and A* algorithm? I thought about having the enemy catch up to the player in the Y axis first then the X axis (or vice versa) but then it would be too easy to evade the enemy. If it matters I'm doing this in Objective-C using Cocos2d. Any input would be appreciated.

sentences:
How do I continue a smooth stroke around a corner in zBrush? I have been trying to create a series of smooth lines down the outside of a bell shape, around the lip, and then back up the inside. The problem is that I can't seem to accomplish this in a single brush stroke, and every time I've tried to join up multiple strokes, the join always looks really obvious.

Is there any way to "pause" a stroke so that you can rotate your view, and then resume it smoothly? Or is there any other way in general to go about something like this?

sentences:
Date Time math (A little Detail Missing) Ok, so I have this method, where I'm trying to subtract one date from the other, and then divide it by an integer number:

public void BonoDatos () {

    //public InputField StartTimeBono;
    //public InputField FinishBono;
    //DateTime BonoStart Datetime BonoFinish
    //public InputField NumeroDeBonos;
    //int NumDeBonos;

    NumDeBonos = int.Parse (NumeroDeBonos.text);
    BonoStart = DateTime.ParseExact (StartTimeBono.text, "MM/dd/yyyy HH:mm:ss", null);
    BonoFinish = DateTime.ParseExact (FinishBono.text, "MM/dd/yyyy HH:mm:ss", null);

    Start2 = DateTime.Now;

    BonoPeriodo = (int)((BonoFinish.Subtract(BonoStart).TotalSeconds) / NumDeBonos);

    print (BonoPeriodo);
    print ("funciona");

    if (MaquinasGanadoras.text.Length > 0) {

        NumGanador.text = Maquina.text;
        CancelInvoke ("NumerAzarBono");
        print (NumGanador.text);

    } else if (MaquinasGanadoras.text.Length == 0) {

        Invoke ("NumerAzarBono", 0.1f);
        print ("Numero al Azar");
    }
}

Now, this code is supposed to take the difference of time between the two dates, and then divide it by the integer, in this case "NumdeBonos" so that the code I have in the update repeats the amount of times I put NumDeBonos to be. For example if I divide the difference between 5, in that amount of time, I need my update to happen 5 times. Problem is, My update isn't working. This is the code:

    if(DateTime.Now.Equals(Start2.AddSeconds(BonoPeriodo))) {
    //if(DateTime.Now.Equals(DateTime.Now, Start2.AddSeconds(BonoPeriodo))) {

        print ("PERIOD FUNCIONA");

        PagPrincipal.SetActive(false);

        Bonos.SetActive(true);

        Invoke ("apagaBonos",5f);

        Start2 = DateTime.Now;

    }

Now, it doesn't show any mistakes, it just doesn't do anything. What little detail am I missing?

sentences:
Unity procedural smooth normals I have a Unity project, which heavily relies on the marching cubes algorithm. Because this algorithm doesn't return the triangles in order, I can only index them in the order they are present in the vertices array.

For example:

vertices: {Vector3(0, 0, 0), Vector3(1, 0, 1), Vector3(1, 1, 0)...}
triangles: {0, 1, 2, 3...}

Because of this, Unity's RecalculateNormals method doesn't work properly and it gives me the following result:

Is there anyway I can make the normals smoother? Keep in mind, that I need to possibly recalculate these vertices everytime the values change, so I can't rely on very heavy methods.

sentences:
What is happening during queue_free() process? From time to time, I encounter a hard-to-reproduce bug with a similar line of code:
## File: Level.gd

func _on_player_invisible() -> void:
    player.queue_free()

which sometimes crashes with: Attempt to call queue_free in base null instance on a null instance

I have added this null check condition, but the crash can still be observed:
## File: Level.gd

func _on_player_invisible() -> void:
    if player: player.queue_free()

sentences:
2D Platformer Multiple Body Collision Response I've been stuck for the past few days on implementing multiple body collision response, and I can't seem to find any good resource to help me advance.
Colliding between two objects is simple enough. What I have so far is this:
    public static void ResolveCollision(ref Vector3 aVelocity, float aMass,
                                        ref Vector3 bVelocity, float bMass)
    {
        var totalMass = aMass + bMass;
        var temp = (aMass / totalMass * aVelocity) + (bMass / totalMass * bVelocity);
        bVelocity = (bMass / totalMass * bVelocity) + (aMass / totalMass * aVelocity);
        aVelocity = temp;
    }

This works fine in resolving collisions individually between objects. The issue that I need to resolve is when two or more bodies are involved in the calculation. For example, pushing an object against a wall or pushing two objects next to each other in the same direction. The component missing in my code is summing up the masses of the objects involved so that the final displacement is believable.
I am hesitant to implement a solution that once resolving the collision between A and B, that B will go and test its movement and resolve collisions between B and C, and return a response back to A to adjust itself to account for any findings, because that could become messy and recursive.
I have also considered an "island" approach, where connecting bodies form an "island" that has a total mass which would  be used when resolving collisions. However, this does not solve for the case of pushing an object against a wall, as I would omit walls and floors from being part of islands as their infinite mass would affect calculations of pushing objects vertially or horizontally respectively, if they are contributing their mass to the island.
Are either of my suggestions close to the mark, or what kind of pattern could I use to efficiently resolve collisions between multiple bodies?

sentences:
The right way to start out in game development/design I'm a 19 year old student looking for some help in the field of game development.

This question may or may not seem a bit overused, but the fact is that game development has been my life long dream, and after several hours of search I've realized that I've been going in circles for the past three or four months whilst doing such research on how to really get down and dirty with game development, therefor I decided to ask you guys if you could help me out at all.

Let me start off with some information about me and things i've already learned about GameDev which might help you out on helping me out (wordplay!):

I'm not an expert programmer, but I do have knowledge on how to program in several languages including C and Java (Currently learning Java in my degree in Computer Engineering), but my methodology might not be most correct in terms of syntax (hence my difficulty in starting out, i'm afraid that the starting point might not be the most correct, and it would deploy a wrongful development methodology that would be to corrected later on, in terms of game development or other projects).
I have yet to work in a project as large as a game, never in my learning curve of programming I've done a project to the scale of a video game, only very small software (PHP Front-ends and Back-ends, with some basic JQuery and CSS knowledge).
I'm not the biggest mathematician or physicist, but I already know that is not a problem, because there are several game engines already available for use and integration with home-made projects (Box2D, etc).
I've also learned about some libraries that could be included in said projects, to ease out some process in game development, like SDL for example.
I do not know how sprites, states, particles or any specific game-related techniques work.

With that being said, you can see that I have some ideas on game development, but I have absolutely no clue on how to design and produce a game, or even how game-like mechanics work. It does not have to be a complex game just to start out, I'd rather learn the basic of game design (Like 2D drawing, tiling, object collision) and test that out in a language that I feel comfortable in which could be later on migrated to other platforms, as long that what I've learned is the correct way to do things, and not just something that I've learned from some guy on Youtube by replicating that code on the video.

I'm sorry if my question is not in the best format possible, but I've got so many questions on my mind that are still un-answered that I don't know were to start!

Thank you for reading.

sentences:
Creating a WARP device in managed DirectX I have a very old graphic card that only supports shader model 2, but I need shader model 3 or up for the app I am developing. I tried to use a reference device but it seems to run very slowly, then I found some samples in C++ that allows me to change to a WARP device and the performance is good. I am using C# and I don't know how to create such type of device.
So the question is: how do I create a WARP device in C#?
Thanks in advance.

sentences:
How to make an event appear after one event has been activated on RPG MAKER VX ACE? I am trying to create my first RPG, and I having some difficulty to make an event appear after an event had been activated, and then disappear later, only to reappear after the player activated an event (to cut off an area during certain times).

How would I do this in RPG Maker?

sentences:
Making particle bounce off a line with friction So I'm making a game and I need a particle to bounce off a line. I've got this so far:

public static Vector2f Reflect(this Vector2f vec, Vector2f axis) //vec is velocity
    {
        Vector2f result = vec - 2f * axis * axis.Dot(vec);
        return result;
    }

Which works fine, but then I decided I wanted to be able to change the bounciness and friction of the bounce. I got bounciness down...

public static Vector2f Reflect(this Vector2f vec, Vector2f axis, float bounciness) //Bounciness goes from 0 to 1, 0 being not bouncy and 1 being perfectly bouncy
    {
        var reflect = (1 + bounciness); //2f

        Vector2f result = vec - reflect * axis * axis.Dot(vec);
        return result;
    }

But when I tried to add friction, everything went to hell and back...

public static Vector2f Reflect(this Vector2f vec, Vector2f axis, float bounciness, float friction) //Does not work at all!
    {
        var reflect = (1 + bounciness); //2f

        Vector2f subtract = reflect * axis * axis.Dot(vec);
        Vector2f subtract2 = axis * axis.Dot(vec);
        Vector2f result = vec - subtract;
        result -= axis.PerpendicularLeft() * subtract2.Length() * friction;
        return result;
    }

Any physics guys willing to help me out with this?

(if you're not sure what I mean with the friction of a bounce see this: http://www.metanetsoftware.com/technique/diagrams/A-1_particle_collision.swf)

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:
trouble getting correct transforms for multiple meshes from assimp importer I have had excellent success in extracting almost everything i need from a collada file that i imported with assimp, however I am struggling to get the correct transforms for each mesh in the file. Each individual mesh has correct vertex data but is not transformed relative to the others.

At first I thought my issue was that I simply wasn't applying the hierarchy of transforms for the meshes, and i read http://www.assimp.org/lib_html/data.html based on an answer from another thread and implemented the void CopyNodesWithMeshes function that is given in pseudo-code there.  However I have found that this didn't help as each mesh is a child of the root node and has only the identity matrix transform for the root and each of the mesh nodes (thus the combined transform for each mesh is identity also).  The hierarchy in the scene appears as follows :

           sceneRoot (identity)
               |
-------------------------------------------------
|               |                  |            |
Mesh0           Mesh1           Mesh2           Skeleton
(identity)      (identity)      (identity)      |
                                                ------------
                                                |    |   (etc)....
                                                (not identity)

There is no reference in the Skeleton to any of the mesh nodes as far as  i can tell.  I have also extracted the skeleton and bones for animation and they work but each mesh is simply at my origin since i cannot extract their transforms.

So i tried to load the model directly with assimp viewer and the 3 meshes load correctly from the model file and are in their correct relative positions.  I even tried to step through the loader code of assimp viewer and as far as i could tell it was getting identity matrix transforms just as i was for the 3 meshes from the sceneNode hierarchy.  But somehow assimp manages to render the 3 meshes correctly.

I am stumped at this point - does anyone know what i might be missing here?

Thanks

I am calling the following from assimp

const aiScene* scene = aiImportFile (fullpath, aiProcess_Triangulate
    | aiProcess_FlipWindingOrder);

And using the following code that i wrote to extract the combined transform for each mesh (though it doesnt do me any good since i get the identity transform for each):

//based on pseudocode of assimp http://www.assimp.org/lib_html/data.html
void CopyNodesWithMeshes(const aiScene* scene, aiNode* node, Matrix& accTransform)
{
    Matrix transform;
    Matrix nodeTrans;
    convertAssimpMatrix(nodeTrans, node->mTransformation);
    //transform = node.mTransformation * accTransform;
    multiplyMatrix(transform, nodeTrans, accTransform);

    // if node has meshes, create a new scene object for it
    if( node->mNumMeshes > 0)
    {
        //new SceneObject
        SceneObj& so = s_sceneObjs[s_numSceneObjs];
        so.numMeshes = node->mNumMeshes;
        for (int i=0; i < node->mNumMeshes; ++i)
        {
            so.mesh[i] = scene->mMeshes[node->mMeshes[i]];
        }
        s_numSceneObjs++;
        assert(s_numSceneObjs < eMaxSceneObjs);
        memcpy(&so.transform, &transform, sizeof(so.transform));

    }

    // continue for all child nodes

    for (int i=0; i < node->mNumChildren; ++i)
    {
        CopyNodesWithMeshes(scene, node->mChildren[i], transform);
    }
}

sentences:
Collectible card game, cards and effects Based on Design of a turn-based game where actions have side-effects

I am building a card-game where cards can have side-effects be triggered under different circumstances.

I was given a good idea on how to handle different phases by having hooks (events) that different cards can be triggered to do something, like when a card is played, draw an additional card, etc.

I am not sure how I should compose all these things to work together, I have a GameState object which handles the state of the game (who's turn, player objects, timers) checking if a move is legal etc.

I am having a Card class that currently just has a type and a name getter/setters and properties. I believe the best way to store cards would be to use .JSON files, because that would let you simply write a new card.

To achieve side-effects I am thinking of having "components" that is configured through a cards JSON-file.

{
    "name": "Ocean Humans",
    "type": "Creature",
    "components": {
    }
}

However, I am not sure how I should compose these JSON-files to some actually working object. How do I call these components when I invoke a hook_event (draw a card, phase begin). And make sure right components are run?

sentences:
Most efficient way to calculate angle between two line-segments that do not necessarily touch each other Although I found answers on calculating angles from vectors, I didn't find a specific way to calculate angles between line-segments that do not necessarily touch each other (I say "not necessarily because I will apply to different cases).

See the figure below:

Consider that I know the 2D position of all 4 red points. I am using C# here. What would be the cheapest way of calculating the angles formed by line-segments that do not touch each other, such like the ones above?

sentences:
How to render multiple objects as a single object for fluid simulation? I'm trying to do fluid simulation using particles in 2d game. I have larger particles, which interactive each other physically, those particles collide with environment (e.g wall,obstacles) to simulate fluid.

However drawing things doesn't go well. I'm trying to figure out how to render the circles without the gaps in between. I've tried blurring the circles like so:

But the gaps remain. Also, blurring the particles causes the particles dimension to change visually every frame. Meaning the physics shape and the visual shape don't match up.

How can I render these objects as one?

finally, i got some effect like this, even artefacts exists:

here is my solution, steps as following:
1.draw water or fluid with SPH.
2. blur all of it.
3. does metaball with it.

sentences:
How can I tell a fragment shader to not write a particular pixel? In a WebGL I'd like to send a screen space quad through that gets processed by a fragment shader, but have the fragment shader only write out a pixel under certain conditions (say... that it was within a circle, or that the pixel belonged to the positive side of a halfspace defined by a curve equation or something).

Is it possible within a fragment shader to say "don't write a pixel"?

I know this could be accomplished using various other methods like alpha blending, rendering this first and having it put the background color where it doesn't want to draw a pixel, or maybe doing some trick with the depth or stencil buffers.  I also know i could create a bunch of geometry to match what it is that I want to render.

Is there a way though to make the fragment shader choose not to write a pixel at all?

sentences:
High poly vs Low Poly when creating model I am new in game development, but I have some knowledge in Maya and 3ds Max, I want to create pirate ship for game. So I spoke with many 3d artists and there are different opinions about low polygons and high polygons modelling. I am an iOS developer too so I know that it's hard for computer to process many polygons, so we should reduce amount of faces as much as we can. But my question is much more connected to 3D.

Do I need to create low polygons model at start and then smooth it to increase amount of faces or do I need to create high polygons model and then reduce amount of edges, faces and etc?

sentences:
Libgdx - Transparent color over texture I am attempting to tint a texture a color but I want the texture to show under the tint. For example, I have a picture of a person but I want to tint them a light green and not change the transparency of the actual person itself.

So far I have attempted to use the SpriteBatch method setColor which takes rgba values. When I set the alpha value to .5 it will render the tinting and the texture with that alpha value. Is there any way to separate the alpha values of the tint and the texture?

I know I could draw another texture on top of it but I don't want to have two draw passes for the one texture because it will be inefficient. If there's anyway to do it in raw OpenGL that'd be great too.

sentences:
Issues glVertexAttribPointer last 2 parameters? Introduction

Hello I will start out by explaining my setup, showing samples as I go along explaining the situation.

I'm using these tools:

OpenGL 3.3
GLSL 330
C++

Problem

The problem is when I render the wavefront obj 3d model it gives a very weird visual glitch the model was supposed to be a square but instead its a triangluated mess with parts of the vertexes pointing in a stretched direction in massive amounts towards the bottom left side of the frustum....

Explanation:

I'm using std::vectors to store my wavefront .obj model data using sscanf to get the floating point values into the structure members x,y,z and store them into the Points structure variable p;

int index = IndexAssigner(1, 1);
ifstream file (list[index].c_str() );
points.push_back(Point());
Point p;
int face[4];

while (!file.eof() ) {
    char  modelbuffer[10000];
    file.getline(modelbuffer, 10000);
    switch(modelbuffer[0]) {
        case 'v' :
        sscanf(modelbuffer, "v %f %f %f",  &p.x, &p.y, &p.z);
        points.push_back(p);
        break;
        case 'f':
        sscanf(modelbuffer, "f %d %d %d %d", face, face+1, face+2,  face+3 );
        faces.push_back(face[0]);
        faces.push_back(face[1]);
        faces.push_back(face[2]);
        faces.push_back(face[3]);
    }
    //Turn on FileReader aka "RENDER CODE"
    FileReader = true;
}

then I render the Points vector using the .data() member of std::vectors to the frustum.

Other declarations:

int numfloats = 4;
float* point=reinterpret_cast<float*>(&points[0]);
int num_bytes=numfloats*sizeof(float);

Vector declarations:

struct Point {float x,  y , z; };
std::vector<int>faces;
std::vector<Point>points;

Render code:

glGenBuffers(1, &vertexbuffer);
glGenTextures(1, &ModelTexture);
glBindBuffer(GL_ARRAY_BUFFER, vertexbuffer);
glBindTexture(GL_TEXTURE_3D, ModelTexture);
glTexImage2D(GL_TEXTURE_2D, 0,GL_RGBA,  ModelSurface->w, ModelSurface->h, 0, GL_BGR, GL_UNSIGNED_BYTE, ModelSurface->pixels);
glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, GL_NEAREST);
glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER, GL_NEAREST);
glBufferData(GL_ARRAY_BUFFER, sizeof(points), points.data(), GL_STATIC_DRAW);
glVertexAttribPointer(3, 3, GL_FLOAT, GL_FALSE,num_bytes ,points.data());
glEnableVertexAttribArray(3);

//Translation Process
GLfloat TranslationMatrix[] = {
        1.0, 0.0, 0.0, 0.0,
        0.0, 1.0, 0.0, 0.0,
        0.0, 0.0, 1.0, 1.0,
        0.0, 0.0, 0.0, 1.0
      };

//Send Translation Matrix up to the vertex shader
glUniformMatrix4fv(translation, 1, TRUE, TranslationMatrix);

glDrawElements( GL_QUADS, faces.size(), GL_UNSIGNED_INT,  faces.data());

I tried looking at what was causing this and went through every function every parameter ,etc looked at the man pages.

Then found out that it could be my glVertexAttribPointer.

Here are the man pages for glVertexAttribPointer

http://www.opengl.org/sdk/docs/man/xhtml/glVertexAttribPointer.xml

The last 2 parameters is my problem

How do I write those 2 last parameters do I try putting the data from Points into it?.

glVertexAttribPointer(3, 3, GL_FLOAT, GL_FALSE,num_bytes ,points.data());

How does it work with vectors?

Is it fast?*

if you can not be bothered too look at the man pages here is the scripts coming from the man pages directly.

Stride

Specifies the byte offset between consecutive generic vertex attributes. If stride is 0, the generic vertex attributes are understood to be tightly packed in the array. The initial value is 0.

Pointer

Specifies a pointer to the first component of the first generic vertex attribute in the array. The initial value is 0.

If you want my full source -> http://ideone.com/fPfkg

Thanks Again if you do read this.

sentences:
2D Physics Engine to Handle Shapes Composed of Multiple Densities XNA The game I'm working on involves shapes that might be composed of multiple materials in a variety of ways. Let's just take for example a wooden rod with and sizable tip of iron or say a block composed of a couple triangles of stone and aluminum and small nugget of gold. The shapes and compositions will change from time to time, so I was wondering what engine I should use and how I might implement this feature?

I've looked at Farseer 3, but I'm still trying to decipher the library by reading the source and the samples and wasn't sure if I was barking up the wrong tree.

Thanks!

sentences:
Given the size of far and near plane, find other parameters of a frustum I am trying to find the correct parameters for setting up my perspective camera. But I don't know the mathematics involved in that. Can somebody point me to the right direction?

My near plane should have width 1920 and height 1080 while my far plane should have width 3840 and height 2160. Aspect ratio is 1.7

Now how do I get the appropriate fovy, near plane distance and the far plane distance so that I get the desired frustum?

Edit: The world size is 3840 x 2160, and the entire world is divided into four quadrants. The size of a quadrant is 1920 x 1080. The user can zoom out and look at all four quadrants (Eagle eye view) or zoom in and look at one quadrant at a time. The important thing is, the world size should always be twice the size of a quadrant (and the area should be four times the area of a quadrant). When the game is actually being played, I just modify the Z position of the camera to zoom-in/zoom-out. Decrease the Z position to zoom in, increase the Z position to zoom out.

sentences: What screen resolution do I make an android game in? Is it safe to assume that most mobile phones and tablets today have moved to 1280x720 resolution and above and make the games in that resolution, scale down for smaller screens or is a smaller resolution like the often used 800x480 still the recommended way to do it and scale it up for larger devices?

sentences:
Unity C# - My parameter 'campfireNew' does not exist (SetTrigger) I'm trying to set a SetTrigger parameter to call a different sprite animation on a campfire. I tried this also with a boolean, yet again the same error. parameter 'campfireNew' does not exist. Anyone familiar with this issue?

using UnityEngine;
using System.Collections;

public class WoodBehaviour : MonoBehaviour {

    bool campfire = false;
    private int count;
    public GUIText countText;
    public int startingValue = 100; // The amount of value the fire starts the
                                    // game with.
    public int currentValue;        // The current value the fire has.
    //public Slider valueSlider;    // Reference to the UI's health bar.
    bool inTrigger = false;
    public int increaseValue = 25;  // The amount of health taken away per attack.

    Animator anim;                  // Reference to the Animator component.

    // Use this for initialization
    void Start () {

        count = 0;
        setCountText ();
        currentValue = startingValue;
        anim = GetComponent <Animator> ();
    }

    void Update () {

        if (inTrigger){

            if (Input.GetKeyDown(KeyCode.E) && count > 0){

                count -= 1;                                 // Minus one log
                currentValue += increaseValue;              // adds value
                anim.SetBool ("campfireNew", campfire);
                //  delay("200");
                setCountText ();                            // Updates HUD

                SendMessage ("PressedKey");

            }
        }
    }

    // OnTriggerEnter 2D
    void OnTriggerEnter2D(Collider2D other) {

        // If gameObject comes in contact with player
        if (other.gameObject.tag == "WoodStumps") {
            other.gameObject.SetActive (false);
            count += 1;
            setCountText ();
        }

        // If player comes in contact with gameObject
        if (other.gameObject.tag == "CampFire") {
            inTrigger = true;
        }

    }

    void OnTriggerExit2D(Collider2D other) {
        inTrigger = false;
    }

    void setCountText() {
        countText.text = "Count: " + count.ToString();
    }
}

sentences:
Is using camera and viewport in Libgdx always necessary? I understand that camera and viewport are important to keep virtual measurement units and handle different aspect ratios and resolutions when building games with worlds bigger than the screen (e.g. side-scrollers / map based games).

I am not sure whether it is the proper way to go for a simple game that fits on the screen entirely - like a puzzle or card game for example.

Is it still better to use camera and viewport in this case, or is it more simple, effective (and hence better) to use directly screen absolute coordinates for these types of games?

Or to put it in other way - what are the advantages to use camera and viewport for games that fit on the screen entirely?

sentences:
Unity scene performance - better to use one scene and toggle what is active? Unity scene performance questions

In Unity, were one to have a scene that is basically identical in all but a few ways, would it be better to keep them as separate scenes, or to have them be one scene and have a script run during init to make all the modifications? Such as change the ground material from green to white to make it snowy, and such?

If you went the separate scene route, would that drastically bloat the project? would all things be stored twice?

sentences:
In Unity, is there a difference between Vector3.down and -Vector3.up? I've noticed numerous tutorials and examples using something like "transform.up * -1" or "-Vector3.up" instead of simply saying "transform.down" and "Vector3.down".

Is there a good reason for this, or is it simply a style difference?

I'm specifically thinking about downward raycasts, if that matters at all.

sentences:
What is the difference between engine approach and language approach in terms of saving game data? I was asked to find a way to somehow save gamedata for a game we (my friends and I) are making and i found that there is something called engine and language approach. I have found something i would call language approach because it relies mostly on System libs but cannot find anything on the engine approach. Are scriptable objects the way of saving data by engine approach ? if so how do i combine them in one savefile ?
Game engine we are using is Unity and we're writing code in C#.

sentences:
Deactivate VS warning "Macro in skipped region" Since the UE4 API relies heavily on macros outside of function bodies, the IntelliSense function (not the compiler!) of Visual Studio 2017 throws a lot of warnings with update 15.7, also visible in the scroll area.

Is there a possibility in the Visual Studio settings to deactivate such kind of warnings?

The option to deactivate IntelliSense

Tools -> Options -> Text Editor -> C/C++ -> Advanced -> Disable IntelliSense

will disable those warnings. However I don't want to renounce IntelliSense completely. Maybe Visual Studio offers more fine grain control over IntelliSense via its GUI or some settings file to disable only those macro warnings?

EDIT: The Visual Studio team recommends using a .hint file to register macros as workaround. However maintaining a separate macro list is not the way to go. You can also vote there that the VS Team works on that.

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

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

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

TLDR; How do node transformations work in Assimp

sentences:
3d Water Simulation formula questions I have created a Grid:

At each point along the grid, is a vertex (Intersection Points):

Each of these points has an x,y,z position. Vector3f(x,y,z). In an attempt to animate the grid into a group of ocean waves, I used this formula to adjust the y position of each “Vertex”:

This is my attempt at implementing the formula into java:

private float sineY(int x, int y, float time) {
Vector2f position = new Vector2f(x, y);
float yPos = (float) ( (2 * amplitude) *Math.pow((Math.sin((wavenumber.dot(position))  + temporal_angular_freq * time +  initiatory_phase) + 1)/2, k));
    return yPos;
}

This function is running from inside a for loop that is updated every ms:

Time ++;
for (int y = 0; y < sizeY; y++) {
        for (int x = 0; x < sizeX; x++) {
            float xPos = x;
            float yPos = 0;
            float zPos = y;
            xPos += 0;
            yPos += sineY(x,y,time);
            zPos += 0;
            waterVertexPos.set(xPos, yPos, zPos);
            vertBufArray[index++] = waterVertexPos.getX();
            vertBufArray[index++] = waterVertexPos.getY();
            vertBufArray[index++] = waterVertexPos.getZ();
        }
    }

As you can see, for each vertex, along the grid, the yPosition of the vertex is set to whatever value the sineY method returns, which is whatever the above formula returns.
Running this code reults in this:

WHEN K = 1.0:

WHEN K = 1.5

As you can see, they both do not follow in accordance with this image here:

All the formulas and graphs have been retrieved from this pdf file. The aim of this program is to simulate water using the presented equations. The pdf is really interesting have a read if you like :)

Source:
http://http.developer.nvidia.com/GPUGems/gpugems_ch01.html

Thank you VERY MUCH for all of your time :)

EDIT:

After implementing the fix suggested by msell. It fixed this previous issue, however a new issue arose when the waves peaks still do not look as they did in the above graph:

WHEN K = 2.0:

The pdf specifies:

A common complaint about waves generated by summing sine waves directly is that they have too much "roll," that real waves have sharper peaks and wider troughs. As it turns out, there is a simple variant of the sine function that quite controllably gives this effect. We offset our sine function to be nonnegative and raise it to an exponent k. The function and its partial derivative with respect to x are.

And then refers to the formula mentioned above, and another formula:

Is there something wrong with my implementation?

And again. I cannot thank you enough for your time :)

Sidney de Vries

sentences:
2D XNA C#: Texture2D Wrapping Issue Working in C#/XNA for a Windows game: I'm using Texture2D to draw sprites. All of my sprites are 16 x 32. The sprites move around the screen as you would expect, by changing the top X/Y position of them when they're being drawn by the spritebatch.

Most of the time when I run the game, the sprites appear like this:

and when moved, they move as I expect, as one element.

Infrequently they appear like this:

and when moved it's like there are two sprites with a gap in between them - it's hard to describe.

It only seems to happen sometimes - is there something I'm missing? I'd really like to know why this is happening.

[Edit:] Adding Draw code as requested:

This is the main draw routine - it first draws the sprite to a RenderTarget then blows it up by a scale of 4:

protected override void Draw(GameTime gameTime)
{
    // Draw to render target
    GraphicsDevice.SetRenderTarget(renderTarget);
    GraphicsDevice.Clear(Color.CornflowerBlue);
    Texture2D imSprite = null;

    spriteBatch.Begin(SpriteSortMode.FrontToBack, null, SamplerState.PointWrap, null, null);
    ManSprite.Draw(spriteBatch);
    base.Draw(gameTime);
    spriteBatch.End();

    // Draw render target to screen
    GraphicsDevice.SetRenderTarget(null);

    imageFrame = (Texture2D)renderTarget;

    GraphicsDevice.Clear(ClearOptions.Target | ClearOptions.DepthBuffer, Color.DarkSlateBlue, 1.0f, 0);
    spriteBatch.Begin(SpriteSortMode.FrontToBack, null, SamplerState.PointClamp, null, null);
    spriteBatch.Draw(imageFrame, new Vector2(0, 0), null, Color.White, 0, new Vector2(0, 0), IM_SCALE, SpriteEffects.None, 0);
    spriteBatch.End();

}

This is the draw routine for the Sprite class:

public virtual void Draw(SpriteBatch spriteBatch)
{
    spriteBatch.Draw(Texture, new Vector2(PositionX, PositionY), null, Color.White, 0.0f, Vector2.Zero, Scale, SpriteEffects.None, 0.3f);
}

sentences:
Google Play exclude devices I have a game that I'm developing in Unity.
The game will be released for Android, so I'm working with the Google Play Console.
The thing here is that I don't know how to block (Made not available) some devices with certain properties.
For example, I need to made my game NOT available for tablets and for devices that don't have at least 1 GB of RAM.
Does anyone know how can I do this?

sentences:
What was the game project that felt like "YOUR" game? This question might seem a bit vague but it is hard to formulate properly. I will try as best as I can. So here goes...

For many years I have been trying to create games but I haven't managed to finish even a single one. The main reason, among others, was that the game creation process lacked focus. There never was a concrete vision of what I was trying to create.

Now I realize that I would usually want to create a game that was similar to some other that I recently played and liked. It seems like there are many games I would like to make but there is none that I would see as THE game I want to make (or one of THE games).

I really want to create something that I (and hopefully, others too) like and can be proud of. But I'm having a hard time discovering what it is. It doesn't have to be big, graphically awesome or anything like that. It should simply be something I really enjoy and am motivated to create.

So, has anyone else here had the same or similar problem? Have you found a way to overcome it? Have you discovered "YOUR" game?

If so, what was different about it from other games you tried creating?

EDIT:

Thanks for all your answers. Just want to clarify some things a bit...

Before asking this question I already read through various older questions about things like prototyping, having deadlines, to-do lists, participating in competitions with short deadlines, etc.

What I wanted to know more by asking this question was not how to create a game in general but how to discover a project that feels like what you really want to do.

For example, I play racing games very rarely, but sometimes I might play some game that is quite fun for a while and get an idea about creating some racing game of my own. But that idea won't stay for long and I will soon get bored with it because in general I am not the kind of guy who is really "into" racing games.

It would be nice if someone here could tell how they discovered what their game was. And I would appreciate if you could tell your story with more details, especially about the things that made the difference between "it would be nice to make this game for myself" and "I want to make this game really badly".

sentences:
Why does GameMaker Studio not open from a removable drive? I downloaded GameMaker Studio 1.4 onto a jump drive so I could use it between two different computers. I downloaded it in a Windows 7 computer, but when I try to use it on a Windows 8 computer, it flashes the updating box, then nothing happens.

I have tried running it in Windows 7 compatibility mode, and I have tried running it as an administrator. Neither works.

sentences:
How can I find the center position of two or more objects? using System.Collections;
using System.Collections.Generic;
using UnityEngine;

public class MoveCameraBehind : MonoBehaviour
{
    public GameObject camera;
    public List<GameObject> targets = new List<GameObject>();
    public float cameraDistance = 10.0f;
    public bool behindMultipleTargets = false;
    public string cameraWarningMsgs = "";
    public string targetsWarningMsgs = "";

    // Use this for initialization
    void Start()
    {
        if (camera == null)
        {
            var cam = GetComponent<Camera>();
            if (cam != null)
            {
                cameraWarningMsgs = "Gettig camera component.";

                camera = transform.gameObject;
            }
            else
            {
                cameraWarningMsgs = "Creating a new camera component.";

                GameObject NewCam = Instantiate(new GameObject(), transform);
                NewCam.name = "New Camera";
                NewCam.AddComponent<Camera>();
                camera = NewCam;
            }
        }

        if(targets.Count == 0)
        {
            targetsWarningMsgs = "No targets found.";
        }
    }

    void FixedUpdate()
    {
        if (targets.Count > 0)
        {
            MoveCameraToPosition();
        }
    }

    public void MoveCameraToPosition()
    {
        if (targets.Count > 1 && behindMultipleTargets == true)
        {
            var center = CalculateCenter();
            transform.position = new Vector3(center.x, center.y + 2, center.z + cameraDistance);
        }

        if (behindMultipleTargets == false)
        {
            Vector3 center = targets[0].transform.position - targets[0].transform.forward * cameraDistance;
            transform.position = new Vector3(center.x, center.y + 2, center.z);
        }
    }

    private Vector3 CalculateCenter()
    {
        Vector3 center = new Vector3();

        var totalX = 0f;
        var totalY = 0f;
        foreach (var target in targets)
        {
            totalX += target.transform.position.x;
            totalY += target.transform.position.y;
        }
        var centerX = totalX / targets.Count;
        var centerY = totalY / targets.Count;

        center = new Vector3(centerX, centerY);

        return center;
    }
}

The CalculateCenter function make the targets(objects) to change positions and vanish away far away.
Even if there is only one single target.

What I want to do is if there is one object for example one 3d cube position the camera behind the cube.
And if there are more cubes for example two or ten and the camera is somewhere else calculate the middle position behind the targets and position the camera in the middle behind them.

To show what I mean in this example the view(like a camera) is behind the two soldiers in the middle position between them from behind.

But what if there are 5 soldiers how can I find the middle position and then position the camera behind them like this example in the screenshot ?

sentences:
Communication between objects in games? I want to make a simple game where I have some characters fighting on a plane (level). I find the trickiest part as figuring out who should do what here.

I want my terrain to have friction (so you could play on ice).

I also want fairly customizable characters.

At first I was thinking of a mediator pattern where the game gathers information about the current player state and modifies them based on that, but I do not think this offers enough flexibility.

I was thinking more along the lines of each player / character does have some logic.

The Input from the game gives it the command the player pressed, then the character would load the correct animation for this.

As for friction and whatnot, I was thinking that the world would somehow need to multiply the player's velocity vector by its coefficient of friction. Because I don't think the player needs to know about the level (and preferably the level does not know about characters)

It's in these little design aspects that I get a bit confused.

Is this a good design? What could be improved / changed / added given what I want to do?

Thanks

sentences: How do you incorporate cocos2d with regular iPhone UI widgets? I want to build a sprite based game using cocos2d. I will be mostly drawing everything in code. I also want to incorporate iPhone UI widgets such as buttons and such. Can these be created to appear on top of the cocos2d canvas? Will this affect the performance of what is drawn/animated?

sentences:
Inconsistent jump height I am doing some physics for a platformer game in MonoGame. The jump height changes based on FPS even though I'm using delta time. When the FPS decreases and gravity is added before movement, the jump height is shorter than usual. How do I keep a consistent jump height at all frame rates?

Here's the pseudo-code executed each frame:

velocity.Y += gravity * dt;
Move(velocity * dt);

sentences:
Recommended way to handle sprite assets for different screen densities (Android) I am currently working on a 2D game for Android. All of the images that I render were created as SVG's and then exported to PNG's which I have placed in my assets directory. These images are also all sprites that I render using a sprite batcher.

My question is around using different versions of the sprites for devices with different densities. I know that when developing a traditional android app you could place separate directories for separate density levels inside of res and then place the correctly sized versions of the images in question in these sub-directories of res.

What is a good approach when dealing with sprite images in the asset directory? Should I just have one copy of the sprites at a really high density / resolution that I use for everything and I just render them on a coordinate system that is independent of screen size or should I resize the image based on screen density before I process it to create all my texture regions? Or is there another solution entirely?

Currently I have one high resolution set of sprites that I use for everything, it just seems wasteful and inefficient for the lower density devices.

sentences:
Getting the correct texture from an Atlas I'm writing an OpenGL ES (2.0) app and have a custom Quad class which draws a textured quad for my sprites.

Currently, I put the textures of any sprites of the same size into a single file or atlas, then, when drawing, I can simply specify the frame I want. It will the render the correct frame based on how many textures in the atlas and how many total frames etc. Something like so:

mySprite.x = 0;
mySprite.y = 0;
mySprite frame = 1;
drawSprite(mySprite);

The texture Atlas would look something like this: (Simplified for the purpose of this question, in the real project, there are over 200 textures arranged in neat rows/columns, but the important thing is there is order, every texture is the same size as this is necessary for the calculations).

So, in the example above, I can say, there are 2 columns, 1 row and a total of 2 textures.

So, if I specify 1 as my texture (2nd texture), my sprite class can work out (using the columns, rows, total textures etc..) which texture I want and how to get it.  As I said this is simplified, the calculations are a little but more involved when there are multiple rows.  But it makes doing animations nice and simple as I can simply increment or decrement the current frame.

However, I keep seeing sprite sheets where there is no order.  There are different sized textures seemingly thrown into an atlas like so:

I really would like to go down this route as it means I wouldn't have to separate my sprite sheets by object size, and therefore, vastly reduce the number of separate sheets I have to use.

I can't however work out how one would write a calculation to get the correct texture just by specifying the texture number to render.

So how does this work?  Do I need to manually work out the texel coordinates of each and every object (and indeed frame), manually (and maybe store this value in an array and associate it to a frame number?) or am I missing a trick here somewhere?

sentences:
Trace with 2D terrain I currently have some 2D terrain in my game defined by 2D coordinates with lines drawn in between them (linear interpolation too keep it simple).

Now I want to cast a ray from anywhere above the terrain and see if it collides with the terrain for drawing bullet tracers.

Here is a quickly drawn example:

sentences:
What does this shader error in Löve2D mean? What could I've done wrong to get the following error message when trying to create a GLSL shader in Löve2D?

I'm sincerely clueless of what the mistake could be, though I suspect the error being a compile-time error because it's happening during love.load, in which I require the shader from another file (and not during love.draw).

The full code can be found here.

sentences:
Box2D: How can I speed up a physics simulation with many, many overlapping box bodies? I'm new to physics libraries and am trying to use Box2D to help implement the procedure described in this article: http://www.gamasutra.com/blogs/AAdonaac/20150903/252889/Procedural_Dungeon_Generation_Algorithm.php

(Edit for clarification:) The algorithm involves rectangular bodies of random dimensions being created in a random point in a circle. They are meant to intersect initially and have those intersections resolved by the simulation, so as to evenly distribute the bodies.

I've managed to get the algorithm working but it runs extremely slowly. Even with only sixty bodies to distribute, it takes over thirty seconds for all intersections to be solved and the bodies to return to sleep. For 120 bodies, it takes well over three minutes, which is horrendously slow.

The simulation progresses quickly when many bodies are overlapping, but slows down dramatically as the area becomes increasingly crowded with bodies. I suppose each body must have more work to do, in an abstract sense, to push an increasingly large number of bodies and interlocking rows of bodies out of the way.

I've tried making each body 0.00001f units in density (therefore lowering mass?), I've tried increasing the restitution value of each body and lowering the friction and linear damping values, but the simulation runs at about the same speed. Even multiplying the number of time steps, position iterations, and velocity iterations by ten doesn't seem to do anything.

So my question is, how can I tweak the simulation or each body's parameters as to greatly increase the speed at which every intersection will be solved? Accuracy of the simulation is no issue; I am subverting it anyway by rounding the coordinates to the nearest 32 px in the end.

Description of my physics bodies and fixtures:

b2BodyDef roomGenBody;
b2PolygonShape roomGenPolygonShape;
b2FixtureDef roomGenFixture;

roomGenBody.type = b2_dynamicBody;
roomGenBody.fixedRotation = true;
roomGenBody.linearDamping = 0.001f; // Seems to have no effect.
roomGenBody.allowSleep = true;

roomGenFixture.density = 0.00001;
roomGenFixture.restitution = 60.0f; // As far as I understand, more bouncy objects repel each other with greater force?
roomGenFixture.friction = 0.0f;

Concerning the world and running the simulation:

b2Vec2 physicsGravity(0.0f, 0.0f); // No gravity and at no angle.

float32 timeStep = 1.0f / 60.0f;  // Increasing timestep doesn't seem to have a very noticible effect.
int32 velocityIterations = 10;
int32 positionIterations = 8;

physics->Step(timeStep, velocityIterations, positionIterations);

Attached is an image describing my problem- Orange lines are the boundaries of my boxes, labelled 1-160:

Please let me know if any necessary information is missing. Thanks!

sentences:
How To Fix Strange White Edges With DOF and Fog in Unity? I'm using global fog and the standard assets Depth Of Field script but it has a strange effect on the edges of far away objects.

How can I make the white edges along the trees blend smoothly into the fog?

sentences:
How do I implement a physics gun? I'm currently trying to implement a physics gun for my game. What I want is for the entity to stay in the same position on the screen no matter how I wiggle the camera about, what is the correct way to achieve this?

I threw together a basic physics gun in 5 minutes (just to handle grabbing and moving the object) but it doesn't work as intended. The problem is obviously that I only handle changes in toolDirection (rotation) but largely ignore changes in toolPosition (translation). For reference, here is my current script (wrtten in Lua):

local toolPosition; --This always holds the position of the tool
local toolDirection; --This always holds a normalized vector indicating the direction the tool is pointing
local grabLocation; --This is the position in world space where the ray from the tool intersected the body of the entity

function UpdateTargetPosition()
    local relativeGrabDirection = (grabLocation - toolPosition).Normalize();                 --direction from tool to target grab point

    local axis = relativeGrabDirection.Cross(toolDirection);
    local angle = math.acos(relativeGrabDirection.Dot(toolDirection));
    local rotation = Quaternion.CreateFromAxisAngle(axis, angle);

    local transform = Matrix4x4.CreateTranslation(-toolPosition) * Matrix4x4.CreateFromQuaternion(rotation) * Matrix4x4.CreateTranslation(toolPosition);
    target.SetWorldTransform(target.GetWorldTransform() * transform);
    grabLocation = grabLocation.TransformByMatrix4x4(transform);
end

sentences: How can I my homing missile avoid walls (2D)? Okay, I have the homing missile implemented. It will follow the player, but I want it to avoid the walls. I tried out A* but I want to make my own. I need some help plzz.

sentences:
Friction using delta time returns inconsistent result Slowing down a character using the following formula returns different results depending on the frame rate:

this.y += this.yVel * delta;
this.yVel *= Math.pow(0.99, delta);

Is there a better way to decelerate a player using delta time to allow for consistent movement across several framerates?

sentences:
How do I use Android's adaptive icons in Unity? As of API 26, Android uses something called adaptive icons.

When targeting API 25 and lower, my app's icon looks fine:

But when targeting API 26+, it shows up in a white circle like so:

How can I target API 26+ while utilizing Android's adaptive icons?
What if I want to target API 26+, but not use Android's adaptive
icons?

sentences:
Baked vs realtime global illumination in unity I use unity. So far I know that the baked GI is less GPU processing when the game is played so if possible, I need to use baked GI.

Newbie question: I'm using unity and just curious in the light setting, is there any situation or in what condition that we can turn on both realtime and baked GI at the same time?  Or is it only practical to turn on one of them?

sentences:
Libgdx InputListenner not working I've added an InputListener to my libgdx actor and I've added the actor to the stage. The stage (and all of its actors) gets drawn just fine.

The problem is my actor doesn't seem to be receiving keyboard inputs as nothing happens when I press keys.

@Override
public void show() {
 stage = new Stage();
 player = new Player();
 player.setPosition(600, 600);
 stage.setKeyboardFocus(player);
 player.addListener(new InputListener(){
   @Override
   public boolean keyDown(InputEvent event, int keyCode) {
    System.out.println("Key Down");
    return true;
   }
 });
 stage.addActor(player);
}

sentences:
How to make a static Material reference? I have a class Edge which may change to multiple colors - materials in this case. I need to switch a Material on MeshRenderer.

In order to do this, I'd need to make multiple prefabs public variables like

class Edge : Mono{

    public Material red, blue, green;

    public void SwitchColor(SomeColorEnum param){
        switch(param)
           // change
           // this.renderer.mat = something;
    }

}

This is a bad solution for this, cause I'd need at least 3 material references in each Edge object. Is there any way to make a material static, assign it from a prefab and then access it statically?

sentences:
Why the spotlight is working only in scene view window but not in game view? What i did is disabled in the Hierarchy the Directional Light.
The Spotlight is child of the character so it will move with it.

Then in Window > Lighting > Settings

In the Spotlight i just changed the range and rotation a bit.
It's strange since it's showing the light in the scene view but not in the game view not even when running the game.

And this is the Spotlight config:

sentences:
How do I add a 3D sprite over a TMX background using Cocos2d-x? We have been working on sample game, in which we want to show a 3D sprite on a background loaded from a .tmx file. But the 3D sprite is never showing up, though we tried setting tileMap->setGlobalZOrder(-1).

This is a sample of our code:

CCTMXTiledMap tileMap = new CCTMXTiledMap();
tileMap->initWithTMXFile("map.tmx");
tileMap->setGlobalZOrder(-1);
//tileMap->setGlobalZOrder(-1000);
this->addChild(tileMap, 0);

//Sprite3D player = Sprite3D::create("player.c3b");
auto player = Sprite3D::create("player.c3b");
player->setScale(10.0f);
player->setPosition3D(Vec3(200, 500, 0));
this->addChild(player, 1);

But the 3D sprite is never showing up.

We have also raised an issue on GitHub here.

sentences:
How can I use a Texture2D larger than 2048 x 2048? I'm having issues working with a large image.  I've read other threads on using images larger than a Texture2D supports, but found nothing that addresses my problem specifically with implementation hints.

My screen resolution is 1920 x 1080.  I'm working in C# XNA.  The game in question is pretty much a board game.

I have an 3840 x 3840 image I planned to use for the terrain map.  The idea was to make each new game look a little different from the last by having the program randomly select a 1920 x 1080 segment of that large image to display.  My code to randomly select and display a part of the image is working.

Unfortunately, I can't even get the initial 3840 x 3840 image to load.  Just picking "Add Existing Item" and adding the image to the content window on the right causes my program to error that a Texture2D can only be 2048 x 2048 maximum.

How do I best handle this?  I may later need to scale or rotate the map.

Suggestions I've seen around:

Cut it up into sections.
Use a smaller image that is made "seamless" or "tile-able", then choose a random starting X,Y point in it and fill the screen with that.

Are these good ways to go about it? How would I actually do this? Would I still be able to scale and rotate the map?

sentences:
An invisible object that deletes anything behind it? I am using augmented reality to put a 3D object on top of a "camera detected" object.

The 3D object can be though of as leaves that go above the real world object but also fall in front / behind / on the sides of it.

The leaves are not uniform so they appear as arcs which let more of the "camera detected" object be seen in some parts and less in others.

Because of this I want to only show the leaves that would normally be seen if there was a real 3D object (instead of the camera detected one) in that place. But since the camera detected one is just a background image part of the leaves on the side or behind are seen when the object is rotated.

I was thinking it might be possible to use an "invisible" object that moves and rotates the same way as the "camera detected" one so it behaves as a placeholder for depth testing but is not actually rendered.

Is this possible? May I have some pointers on how to achieve this?

Thank you

sentences:
Renaming Texture 2D nodes in Unity's shader graph? I am new here so thanks for having me. I have a query regarding renaming the Texture 2D nodes I have created in my first Shader graph.
I have setup a shader graph with a normal map, base colour, smoothness and ao. These are showing up as exposed parameters which is just what I wanted so I can drag and drop new texture maps for the other materials easily (please see screen shot attached).
I would love to be able to name each of those Texture 2D maps accordingly so it is clear where each map from the assets folder needs to be dragged.
E.g The Texture node that contains the normal map is simply called 'Normal' instead of 'Texture 2D', the base colour map named 'base colour' etc.
Atm I have 4 exposed parameters all called Texture 2D.
Not the most serious of issues I would agree, but I feel like I must be missing something. No sign of a 'rename' option for those nodes.
Any help very much appreciated.
Cheers
Nick

sentences: Is there a way to start UI animation transition with code in unity? I have made an animation for a button in unity's UI prefab, but i want it to start only at certain times, when i command it with code. How can i do this?

sentences:
Gravity and Jumping in Clickteam Fusion 2.5 So I'm currently building a bare-bones functioning game that involves simple platforming. Quite literally a box moving left and right and jumping.
I'm using Clickteam Fusion 2.5, and I know there's an option to assign platforming movement to an active object, but I honestly do not enjoy implementing that feature one bit.

So instead I'm opting for simply adding or subtracting from the X and Y coordinates of the player object while the left and right arrow keys are held down for side-scrolling movement.

However, I have yet to figure out how to use this same method for jumping and gravity. I know being able to jump would be running an event that occurs after hitting a certain key, which takes in the current Y-coordinate of the player and runs it through a parabolic formula. And then gravity would simply be constantly subtracting from (or I guess in Fusion's case, adding to) the current Y-value of the player object while the frame is running.
So the question simply is where and how do I implement these things in order to create jumping and gravity. I figure there's a correct syntax for a parabolic formula when creating an event after "jump" is pressed, but for the life of me I can't figure it out. As for gravity, I'm completely lost. I have managed to get down stopping movement when colliding when another object so that is not an issue.

Thanks and appreciation in advance.

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:
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:
Why is ScreenToWorldPoint always giving same coordinates with mouse position? Whenever I use ScreenToWorldPoint(Input.mousePosition) and display the output in console this always gives me the same coordinates.
MyCode:
Vector3 screenToWorld;

void Update()
{
    screenToWorld = Camera.main.ScreenToWorldPoint(Input.mousePosition);
    Debug.Log(screenToWorld);
}

sentences: What's the best for doing ground check? What's the best for ground check? I have a capsule player and I'm using the raycast technique but it's not accurate when it comes to slopes. So what's better? Overlapping, Raycasting, CheckCapsule, or CapsuleCasting?

sentences:
Storing object position and rotation I only superficially understand the idea and I can't find any thorough explanation (partially because I can't find very good keywords to Google - English is not my first language):

Although I partially understand some things (next paragraph), my question is what data structure would you use to store a body's position and rotation and how does everything come together? I want to be able to translate that object to a (x, y) position, rotate it about the origin or about its centre (then fetch these things and draw a sprite using that position and rotation). Very similar to Unity's Transform object.

From my understanding I will need (at least) a 2/3-dimensional vector and a quaternion and then I should be able to generate a model matrix from them. How? Multiply what to what and in what order? I certainly have no idea how to get a 4 x 4 matrix from a 2/3-dimensional vector and a quaternion. Then if I change the position, I should probably update the model matrix again.

I'm using OpenGL ES 2 on Android, but I wouldn't mind an agnostic answer.

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: 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:
Automating the process of creating a steam lobby (for dota) and inviting users to it I'm working on a Ruby on Rails web-application and I want to create lobbies and send invitations to users to join these lobbies. Simply, I want to achieve ISteamMatchmaking Interface functionality of Steam SDK but the problem is that sdk in written in C/C++ and I would have to write wrapper to integrate sdk in my application.

My question is that is there some easy and less time consuming approach to achieve ISteamMatchmaking Interface functionality in web-application?

I'm using RoR but I'm open to use other technologies too.

sentences:
How does sound effects being in tune affect the game? Many sound effects have a dominant frequency, especially for artificial sounds (UI, "powerups") and short effects that get repeated (machine guns). Whether by design or accident, these sound effects could be in tune with each other, or with the music.
My questions are, does this matter at all (in games), and if it does, what effects does this produce? When would one purposefully create harmonies, disonnances, or avoid such effects altogether?
In music theory, the effects of consonance/dissonance is well known, one of which is that notes in tune with each other are pleasant, and those that are not are unpleasant. But what about in games, does it matter that, for example, the laser gun you are shooting is in tune with the music?
At least a few well known games have harmonic sound effects, and although it may be deliberate, I'm not sure if it's a purely subjective/artistic choice, or whether it was designed to evoke specific feelings from the player. One notable example is Candy Crush Saga, whose match effects are all part of the same major key as the music: https://youtu.be/8TIeNDnJiN8?t=6m57s
Another example is Super Mario Bros, in particular the 1-up sound effect: https://youtu.be/w2NjUDfOp2o?t=22s although other powerup effects like the coin sound are not in the same key, for whatever reason.
At least one sound designer seems to think this is important:

Aaron Marks: I think I’m pretty much always in the ‘musical’ mindset when doing sound design, whether it’s recording, mixing and mastering or on a creative level. Music is definitely in my blood and I think, subconsciously at least, it’s always there when I’m doing any audio work. I definitely have some techniques where I ‘tune’ sound elements to be either pleasant or something a little more harsh. I also tend to pay attention to the music that is accompanying a scene or game level and often tune the sound effect to a note which blends well or I’ll go the opposite direction and detune it, especially for evil characters and their weapons, for example. You definitely want the audience to ‘feel’ the evilness and this is a great way to do it without being in their face about it.
In games especially, part of the goal is for all of the sound effects to feel natural to the game and not bring any undue attention to themselves. By doing this, the ones you want to really stand out will definitely be noticeable and have more impact. I’m always very careful for sounds like tractor beams, engines, humming machinery or ambience to tune them so they all work together and with the music.

Although this is just one opinion; I'd like to hear from those who have experience with professional game sound design to weigh in, is it something that sound designers generally worry about, and if so, when would one want to have sounds that are in tune, out of tune, and what the effects are.

sentences:
Unity frame-rate drops / stall I have an issue where my game suddenly stops for a second and then continues. And I think it has something to do with my performance so I took at look at the profiler:

I tried to take a screenshot as soon as the crack happened:

However, since I am a bit new to optimization could anyone give me a helping hand on what might be the problem here?

sentences:
LWJGL 3.0.0 glMapBuffer I am currently working on a project and usually in C++ I use the function.
ByteBuffer glMapBuffer(int target, int access)

usage:

FloatBuffer buffer = glMapBuffer(GL_ARRAY_BUFFER, GL_WRITE_ONLY).order(
    ByteOrder.nativeOrder()).asFloatBuffer();

But in java (lwjgl 3.0.0) this function returns null, because of this reason it throws a NullPointerException.

Anyone any idea how to use this function in java?

There are several functions:

glMapBuffer(int target, int access)
glMapBuffer(int target, int access, ByteBuffer old_buffer)
glMapBuffer(int target, int access, long length, ByteBuffer old_buffer)

I hope this is specific enough, thank you for your help :D

sentences:
Change game from portrait to landscape dynamically I have multiple classes that implement Screen.

I want to, say, have the Main Menu screen portrait, then the Play Screen landscape. Is there anyway of changing the orientation dynamically?

I thought I could just start another Activity and have the Play Screen extend Game. And the new Activity would intialize the Play Screen. But it appears that you can't call startActivity or the like, obviously, as LibGDX is platform independent.

I use Gdx.graphics.getWidth() and Gdx.graphics.getHeight() to align Sprites and Actors so it looks "right" on different devices.

I've also tried swapping the Gdx.graphics.getWidth() and Gdx.graphics.getHeight(), respectively, but can't seem to get the position of sprites and actors correct.

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:
Allowing one sprite to move through another in Quintus I have a Bumper class extended from Sprite:

Q.Sprite.extend("Bumper", {

    init: function(p) {
        this._super(p, {gravity: 0});
        this.add("2d, ... //etc.
}

I have an Enemy class that should trigger a function when the center of the Bumper and of the Enemy collide.

I was thinking about doing something like this in my Enemy class :

this.on("bump.top, bump.bottom, bump.left, bump.right", function(collision) {
    if(collision.obj.isA("Bumper")) {
        if (this.p.x == collision.obj.p.x && this.p.y == collision.obj.p.y) {
        //Do something
        }
    }
});

But for that I need the two sprites to move through one another. Is there a way to do that while still checking for collision ?

sentences:
How To Upload JavaScript Games To Steam So I've been making this game called The Necromancer and (quick note, I am still working on the game. Also, I know this sounds similar to this question, but my question is for the general process) I wanted to publish on the Steam Store. However, I don't know what the process is, as in what you do to get your game posted on Steam. Also, how would I get a few files, and somehow put it in a virtual package that I can give to Steam. I just feel rather confused on the subject.

Thank you for your time

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:
Using collision.contacts to determine if on a floor I'm trying to make my own first-person character (because I get lost in the sea that is Unity's FP character script), and am trying to make it so it detects when it is standing on a floor. I tried using a playerController, but I've found rigidbody is just more malleable.

Anyways, so I think how you'd do it is finding the direction of the contact, and if it isn't straight down, then to keep onGround as false. I'm just not entirely sure the scripting behind this, and several searches have turned up nothing.

Several offered using mutliple colliders, but I would prefer to keep the number of objects, colliders or otherwise, at a minimum, considering there will be a large number of them in the scene as is. I also want something that's easily manipulable so that I can add extra features like climbing up a wall or the like, and I think that measuring the angle to the center is about as simple and easily manipulated as it gets.

sentences:
When will the computational powers be strong enough to let play big games like Battlefield, COD from cloud? Is there any current service similar to Steam but without having to download any games?  In other words, buy digital rights to play and play from the cloud?

How much bandwidth would be necessary to play it purely online, and how fast must the network be?

Do you think it will become a reality in near future (for example, in the next 10 years)?

sentences:
Resource Managers - Are they any good? I've seen many a time in source code, things like this [well, this is more of a pseudo C++ idea of mine]

typedef shared_ptr<Resource> ResourcePtr;// for ease
ResourcePtr sound1 = resourceManager.Get<SoundResource>("boom.ogg");
sound1->Play();
ResourcePtr sprite = resourceManager.Get<Image>("sprite.png");

I was just wondering how useful a class like this was, something that:

Loaded media files
Stored them in memory
Did this at the start of a level - loading screen.
Cleaned up

Rather than having a system of:

Resources are held by entities only, or loose.
Responsible for own load into memory.

The first is a 'manager' as such; something I feel indicates it's wrong to use. However, it allows for something like a vector of resource names to be passed, rather than having to scramble around finding everything that needs to be loaded.

sentences: Ogre3D how to use many images in a particle system In the example I found, it usually uses one images for a particle system. Is it possible to use multiple images in a system?

sentences:
How to create a separate bin folder? I am now creating a 64 bit and 32 bit executable of my game.

How could I achieve so that the executable and dlls lie in a separate folder without changing all the path variables in the game?

To clarify I want to have a folder structure like this:

Game

Bin

exe
dll, so, etc.

Data

textures and everything else.

My current is:

Game

exes
dlls
data

So my path variables use something like: ./data/ ....

How could I move my exes so they would find all dlls and data, so I wouldn't need to replicate the data folder for each version and have them nicely separated?

I am mainly looking for answers for Windows, but I am also interested in Unix solutions.

sentences:
Move component to: where to with child components? I have a simple static mesh attached to a scene in a blueprint. I want to move the component back to (0,0,0). If a component is not attached to any other component other than the default scene root, I just type in (0,0,0) as the Target Relative Location.

To be precise, I don't want it to go to (0,0,0) but head there and stop, so I just give it the world location and then multiply X, Y and Z by 0.67 (could be any value).

But now I have a few child components attached to an extra scene. This scene is moved (-2460, 3070, 2600). Now to make matters worse, it's ALSO rotated (0°, 0°, 90°) and every component I try to move is ALSO rotated by (0°, 90°, -90°). The numbers themselves aren't hard to crunch but I have no idea what "Target Relative Component" should be now.

I tried adding vectors, subtracting vectors (both relative and world from both the parent and every child component I want to move), inverting transforms, transform directions, rotating the  resulting vectors, unrotating the resulting vectors, nothing seemed to work, at least not the combinations I tried.

How do I get the correct Target Relative Location?

sentences:
How to disable gravity for a RigidBody moving on a slope? I created a script that handles movement for my player (moving around, going down and up slopes). However, since I'm using a RigidBody not a CharacterController when I go up slope and stop on the middle of it the gravity pulls me backward, which is fine, but the problem is when I move forward, the gravity force pulls me backward when I'm trying to go forward. This problem wouldn't have appeared if my character wasn't a sphere but my character is a sphere so it always roll down when gravity is applied to it.

What I want is to somehow stop the gravity for a second or reset it to zero when I move my character, and when I'm going up a slope so it won't hold me back. I tried:

if(grounded) rb.velocity = Vector3.zero;

but I don't think it's the right approach.

sentences:
Armature's bone can't be rotated in Unity when I'm trying to rotate its chest toward its looking direction? I want to rotate my character's chest, so its looking direction will be visualised correctly.

But I think that the animation controller doesn't let me.

I logged its rotation before and after I set it, and after setting, it's correct, but next frame before I would set it, it's always snapped back.

How could I make my character's animation transformed, based on its looking direction?

This is the code:

Debug.Log(Chest.localRotation.eulerAngles);
Chest.localRotation = Quaternion.Euler(90, 90, 0);
Debug.Log(Chest.localRotation.eulerAngles);

sentences:
Libgdx Sprite is not drawn when generated inside another class I´ve built a gameloop where I generate new items depending on the elapsed time and want to place them somewhere on the screen. I use some randomness for the color and coordinates. For better design I want the sprites of these items to be generated by classes that contain additional information on these items. But I figured out that when doing so my sprites won´t be drawn. Sprites that are generated explictly inside my loop are perfectly drawn.

This is my current gameloop

public void loopGame(float delta) {

    Gdx.gl.glClearColor(255, 255, 255, 1);
    Gdx.gl.glClear(GL20.GL_COLOR_BUFFER_BIT);

    timer.addDelta(delta);

    Gdx.app.debug("Bubbles", "Time: " + String.valueOf(this.timer.getCurrentTime()));

    batch.begin();

    Sprite freeBubble = new Sprite(new Texture(Gdx.files.internal("data/img/bubble_black.png")));
    freeBubble.setPosition(200, 200);
    freeBubble.draw(batch);

    Bubble newBubble = this.bubbleFlask.createNewBubble(timer.getCurrentTime());
    if (newBubble != null) {
        bubbles.add(newBubble);
        Gdx.app.debug("Bubbles", "Created new bubble!");
        Gdx.app.debug("Bubbles", "Attributes: " + newBubble);
    }

    // draw all bubbles
    for (Bubble bubble : bubbles) {
        Gdx.app.debug("Bubbles", "Drawing bubble");
        Sprite bubbleSprite = bubble.buildSprite();
        bubbleSprite.draw(batch);
    }

    batch.end();

}

The freebubble is perfectly drawn. this.bubbleFlask generates bubbles the way it is supposed to but those bubbles are not drawn inside the for loop. Debugging messages show me that the loop works as it should.

So you might guess that bubble.buildSprite() is broken. Here is this method:

public Sprite buildSprite() {
    Sprite sprite = new Sprite();
    sprite.setTexture(new Texture(Gdx.files.internal("data/img/bubble_black.png")));
    sprite.setPosition(300f, 300f);
    return sprite;
}

For the sake of demonstration I placed the same texture file here.

What am I missing here?

sentences:
Missing faces in Quake 3 BSP I'm attempting to write a level viewer for Quake 3 levels (repo here). I've got some of the way towards it, but for every level I try to view with it I get lots of missing faces.

(image from Dustbowl)

In the above image, I have disabled backface culling in order to show where faces are missing a little better.

My question is, has anyone else run into this problem? I know Quake/Quake 3 level rendering is a well-trodden path, so I'm luckier than most in this situation. I so far only render meshes and polygons, not models, but most of the missing faces seem to be where one would expect static faces.

I'm not really asking for a code review, as much of the implementation details I would not expect to be common (I transform the BSP tree into a proper tree structure and discard the index-based structure entirely), but if anyone has seen this before I'd love to know what the issue was.

sentences:
Unity3d and Windows 8 run game in frame How do I set Unity3D to run my game on Windows 8 in a fixed size frame (with a border around it) and not in fullscreen?

I tried setting this in the Unity script and in the final C# project, but nothings seems to work.

I have set the players resolution to 1366x786 (the desired size) and while this works fine with the webplayer the windows 8 solution seems really unimpressed by it. I also tinkered with the 'Default Is Full Screen' option

sentences:
Circles within circle (PUBG safe zone) I'm attempting to do something that resembles the safe zone in PUBG (PLAYERUNKNOWN'S BATTLEGROUNDS), a circular area on the map that shrinks over time.

On map screen:

draw circle at rand X Y, 300 pixels wide

After say 5 minutes, I want to edit the X, Y and WIDTH of the circle so the new, smaller circle sits at a random position inside the old one.

sentences:
Unity - Manually sync location of players from server to client I am new to Unity networking. I've set up my scene with NetworkManager and the Player prefab having NetworkIdentity. I originally had my players set up to sync with a NetworkTransform. This worked, but the objects were very choppy whenever they were children of a moving object.

In order to fix this issue, I've replaced NetworkTransform with a class extending NetworkBehavior, using UnityEngine.Networking, and containing the following code to sync localPosition:

void Update () {
    CmdSyncPos (transform.localPosition, transform.localRotation);
}

[Command]
protected void CmdSyncPos (Vector3 localPos, Quaternion localRotation) {
    transform.localPosition = localPos;
    transform.localRotation = localRotation;
}

This works really well! The only problem is that this is one-way, the server now has the updated position of all clients but the clients only have the updated  versions of themselves.

How can I do this in reverse: Manually sync the location of non-local players from server to client?

sentences: Anyone know of an online resource with spritesheets from classic games? I'm looking for spritesheets for classic retro games, and old home computer games (c64, amiga etc.) Does anyone know of a source online?

sentences:
Does iOS support BC4 compressed texture? I've been designing a new OpenGL image algorithm using BC4 textures at its core.
It works well accross Windows and Mac, my main targets up to now.

But today, the customer added a new requirement : it should work on iOS too !
I'm starting to worry : is BC4 texture (named GL_COMPRESSED_RED_RGTC1 in OpenGL) supported on iOS devices (tablets & iphones alike) ?

I've read that iOS is OpenGL ES 2.0 capable. But i'm unable to know which textures are supported under this API (except PowerVR ones, which are not compatible with PC & Macs...)

sentences: How can I render a model on top of another model regardless of their relative Z positions? I was wondering if there's any way to render models over other 3D models regardless of their relative positions? Kind of like how it works in 2D graphics, you set a render order and it renders them based on that instead of taking the depth and figuring out which is in front of which.

sentences: When using MVC, what is the proper way to handle a view refresh when the model isn't ready? I'm about to start building a game and am having trouble understanding the proper course of action when it's time to refresh the screen, but the model hasn't finished its calculations. I assume this isn't a huge problem for my little 2d platformer, but with many complex games there must be some hefty calculations that don't render in 1/30th of a second - I see these games stutter, but what's going on? Is the view just skipping this cycle? Is it an observer that's waiting for the model and will hang until the model is ready? Or will it display the models current state without regard to the computations ongoing? What's the correct way to handle this situation?

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:
How to implement pixel level collision detection? I'm developing a simple game engine for practise purpose, and I used codes like this to do collision detection (fake code):

bool PhysicalObject.isCollideWith(rect: PhysicalObject) =>
  x + width >= rect.x && rect.y <= y + height &&
    x <= rect.x + rect.width &&
    y <= rect.y + rect.height

But this treats all objects as a rectangle.
What I want is to detect collision when two objects are overlapping on pixel level (I used java.awt.Graphics to draw my game objects).

What's the best way of doing that? Can I create a two-dimension array that represent each pixel and store the pointer to the game object that the corresponding pixel belongs to?

sentences:
Using State Pattern with Unity I am new to Game Development and Unity. I have written a component for Jumping and Running, CharacterJumpAbility.cs and CharacterRunAbility.cs.

I would like the Character to be able to Jump only if the Character is not moving. I came across a State Pattern but I can't understand how to apply it. For example if I want to Jump, first I must check if the Character is Running, but I have to do this in the CharacterJumpAbility.cs or in the CharacterController.cs (the component who handles inputs)?

If I define a state for example:

public enum CharacterState {
    Run,
    Jump
}

For example if the player is pressing the space bar, I have to set the Jump state, the code that sets state = CharacterState.Jump should be written in the CharacterJumpAbility.cs or in the component that handles inputs?

And if I want to set a new state for example Jump, while I am running, this is clearly not possible, how to handle situations like these?

sentences:
Tilemap collision in component based entity system I am trying to set up a collision system for a tilemap in my component based entity system, but having trouble with figuring out how to do so.

Currently I have the following approach:
My tilemap consists of a Tilemap_Component, which just holds the array, a Tilemap_Render_Component, which holds the Tileset image, and a Tilemap_Collision_Component, which holds the information which tile value is handled as a wall.

To make an entity collideable with the tilemap it needs currently the following components:
Movement_Component, which holds the X/Y Velocity, Position_Component, which holds X/Y Position and Tilemap_Collider_Component, which holds the information if the object only collides with walls or as well with some other objects in the tilemap.

Now my problem is the following:
It is very hard to determine what to do with an object which collides with the tilemap. If I set velocity to zero, it is possible to glitch through walls because Movement and Input are handled in other systems than the collisions.
If I just change the Position of the object, there occur two problems: One is, that the object starts to flicker because it has moved a bit. The other is, that I would have to know how big the object is which is colliding with the wall.
Now I could just say that a Render_Component is required for objects which can collide with the tilemap and then use the image information in the Render_Component of the object and the Tilemap_Render_Component of the tilemap to calculate collision, but I think this is a bit against the intention of component based system.

What would be your suggestions? How could I handle this problem?
Or, as well: Was anyone of you faced to such a problem? How did you solve it?

sentences:
How to stop SDL from freezing the rendering while resizing the window? I have a simple SDL application with a re-sizeable window. If I minimize it and then maximize the window the rendering freezes. I've included a simple code example below which makes the screen flash through varying shades of grey. Try minimizing and then maximizing the window, and you can see that the rendering halts while the window is resizing. How do I stop the rendering freezing when going from minimized to maximized?

//FLASHING SCREEN CODE
//Demonstrates screen freeze when you minimise then maximise the screen....

#include "SDL.h"

using namespace std;

int main( int argc, char* args[] )
{
    //Initialise SDL2, declare Window + Renderer
    SDL_Init( SDL_INIT_VIDEO | SDL_INIT_AUDIO ); //Initialize SDL for video and audio
    SDL_Window* pWindow = NULL;
    SDL_Renderer* pRenderer = NULL;
    pWindow = SDL_CreateWindow("Minimise Maximise Test", 50, 50, 1200, 600, SDL_WINDOW_RESIZABLE | SDL_WINDOW_MAXIMIZED);
    pRenderer = SDL_CreateRenderer(pWindow, -1, SDL_RENDERER_TARGETTEXTURE);

    //The Screen colour which is going to flash through different shades of grey
    SDL_Color screenColour = {0, 0, 0};

    //SDL event for detecting X-out (quit)
    SDL_Event event;
    bool quit = false;

    //Loop
    while( quit == false )   //While SDL has not been X'ed out
    {
        //Handle quit
        if (SDL_PollEvent(&event) != 0)
        {
            if(event.type == SDL_QUIT) quit = true; //Press X-out to quit (but not visible on fullscreen)
        }

        //Make screen flash by changing its colour through shades of grey
        screenColour.r++;
        screenColour.g++;
        screenColour.b++;

        //Render the screen
        SDL_SetRenderDrawColor(pRenderer, screenColour.r, screenColour.g, screenColour.b, 255);
        SDL_RenderFillRect(pRenderer, NULL);
        SDL_RenderPresent(pRenderer); //like SDL_flip
    }

    //Shutdown
    SDL_DestroyRenderer(pRenderer);
    SDL_DestroyWindow(pWindow);
    SDL_Quit();

    return 0;
}

I'm currently running SDL2.0 v 2.0.3 on Windows 10 machine (experienced the same problem running on previous Windows 7 machine).

sentences:
How can I write a D3D12 texture in cuda? One point about such pipeline is that everything happens in GPU and bypass the CPU.

The texture is created as such:

ThrowIfFailed(m_device->CreateCommittedResource(&CD3DX12_HEAP_PROPERTIES(D3D12_HEAP_TYPE_DEFAULT), D3D12_HEAP_FLAG_SHARED,
            &texDesc, D3D12_RESOURCE_STATE_PIXEL_SHADER_RESOURCE, nullptr, IID_PPV_ARGS(&TextureArray)));
// texture pixel format: DXGI_FORMAT_R32G32B32A32_FLOAT

How can I access in read+write to TextureArray (ComPtr<ID3D12Resource> TextureArray;) in cuda ?

sentences:
Video Encoding library for C++ game I'm looking for a video encoding library in C++ that I can use to record game footage.

It can not be an external application like Fraps, it must be a library.

Ideally the encoding can be done in real time without affecting game performance too much, although this is not a must have requirement.

Another preference is that the video file being saved from the game is already compressed and ready to be used by most video players without any further processing. I realize that this might not be possible especially for real time encoding, so I would accept a trade off of having to process the file later for better compression and/or better file format.

I'd like to hear about your experience integrating the library into a game if possible and any interesting trade offs you had to make.

Some libraries support more that one file format or codec, so advice on the file format would also be appreciated.

sentences:
I can add event animation but I can't add keyframe? I am trying to add animation to my UI panel but the problem is I can't add a keyframe to my animation (the button is grayed out). But I can add event animation (the button is not grayed out).

Here is the video of what's happening.
Anyone know how I can resolve my problem?

sentences:
Roguelike movement system I'm trying to implement a roguelike movement system for my game. I'm using the ECS architecture.
The requirements are:

entities will have a mass, on which should slow down the entity
movement accordingly. fatty ones move slower
there will have different terrains, that should apply different
friction types, eg: ice will decelerate the entity slower; a
quicksand will almost stop the entity immediately and so on.

[optionally]

there will have different weathers that should also impact on the
entity movement, eg: sandstorm would push the entity to it's
direction; rains will diminish the friction coefficient a little bit
etc...

If the two first requirements are solved, the third will probably be as well, I think.
How would you do this?

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: Optimization for Normal maps with lots of wasted space? I'm working on level/character assets where I'm finding that I use only very little amounts of normal mapping on them, resulting in 2048x2048 textures that are mostly blue/purple. Is there any method to better optimize this, perhaps use one normal map for several assets?

sentences:
Unity3D : Unload a loaded and inactive scene I am using the following coroutine to attempt to unload asynchronously a loaded but inactive scene in Unity :

private IEnumerator sceneUnloader(string s)
{

    AsyncOperation asyncUnload = SceneManager.UnloadSceneAsync(s);

     while (!asyncUnload.isDone)
     {
        Debug.Log("[SCENE UNLOAD] " + asyncUnload.progress);
        yield return null;
     }
    }

The scene name input is valid, as it's the same variable used to preload the same earlier, and the scene is being preloaded correctly.
There is an active scene when this coroutine is being called, as the attempt is to unload a partially preloaded scene while another one is still active.

The AsyncOperation is apparently null, is there a way to get around this issue and unload from memory an inactive scene?

I'm currently hacking around this issue by waiting for the scene to be fully loaded and activated, and then unloading it.

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:
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: Rules to start and naming a game studio I would like to know if there is any copyright related rules to name a game studio specially for android appstore. I searched at the U.S. Copyright Office website and found many matches for same names. None of them are game studios though. Is it legal to choose one of those names if none of them are game studios? Also, what are the rules I need to know for starting a new indi game studio?

sentences:
How do I change the level of my game by changing the file loaded? I am making this 2d canvas game in JavaScript and I want to switch to file level2/level2.html when the boss of level 1 (level1/level1.html) is dead. This way I can have my stuff organized better.

This is the condition statement where I want to put the file change.

if(e.bosshealth <= 0){
  enemies = [];
  alert("LEVEL 1 COMPLETED");
  // I want the file switch to be here if possible.
}

sentences:
Conversion of a number from Single precision floating point representation to a Half precision floating point Hope it is relevant here.

I have a code where I have to work on Half precision floating point representation
numbers. To achieve that I have created my own C++ class fp16 with all operators(arithmetic logical, relational) related to this type overloaded with my custom functions, while using a Single precision floating point number with a Half precision floating point number.

Half precision floating point = 1 Sign bit , 5 exponent bits , 10 significand bits = 16 bit

Single precision floating point = 1 Sign bit, 8 exponent bits, 23 significand bits = 32 bits

So what I do to convert from a Single precision floating point number to a Half precision floating point number:-

For significand bits - I use truncation i.e. loose 13 bits from the 32 bits to get 10 bits significand for half precision float.

What should I do to handle the exponent bits. How do I go from 8 exponent bits to 5 exponent bits?

Any good reading material would help.

sentences:
2D Circle detection algorithm partially working Hello GameDev stack exchange!

I'm adapting a rectangle to circle collision detection algorithm from the second (not the accepted) answer from here: https://stackoverflow.com/questions/401847/circle-rectangle-collision-detection-intersection. This is C++ code. Here is my adaptation:

bool Collision::checkCircleToRectCollision(sf::CircleShape circle, float rectX, float rectY, float width, float height)
{
    sf::Vector2f circleDistance;

    circleDistance.x = std::abs((circle.getPosition().x - rectX) + circle.getRadius());
    circleDistance.y = std::abs((circle.getPosition().y - rectY) + circle.getRadius());

    if (circleDistance.x > (width / 2 + circle.getRadius())) {
        return false;
    }

    if (circleDistance.y > (height / 2 + circle.getRadius())) {
        return false;
    }

    if (circleDistance.x <= (width / 2)) {
        return true;
    }

    if (circleDistance.y <= (height / 2)) {
        return true;
    }

    float cornerDistance = ((circleDistance.x - width / 2) * (circleDistance.x - width / 2)) +
                          ((circleDistance.y - height / 2) * (circleDistance.y - height / 2));

    return cornerDistance <= (circle.getRadius() * circle.getRadius());
}

The problem is the collision detects only the lower right section of the circle. Without the + circle.getRadius() inside of circleDistance.x = std::abs((circle.getPosition().x - rectX) the algorithm detects even less area. Here is a a picture to visualize. I want the algorithm to detect the entire blue area. It currently only detects the red area. This is a an approximate, but very accurate from what I can tell. The white box is my players hitbox.

I've spent a few days googling and this is the closest I've gotten, but now I'm stuck. How can I make the algorithm detect the entire blue circle? Thanks in advance! :)

sentences:
Hemispherical Projection I'm trying to implement a radiosity processor. I'm aware of many places online to find information about radiosity. I found a great source on NVidia's website is  GPU Gems - Chapter 39 . On this page they talk about Hemispherical projection. I've implemented a projector that will place mesh 'vertices' on a unit hemisphere...the problem is that the rasterizer only linearly interpolates between vertices along an edge...

...is there a way to adjust the method of interpolation?

Here is shader code for hemispherical projection...it does place the objects correctly, however, the edges between the vertices are straight...when true hemispherical projection would create rounded edges...

float4x4 mW;
float4x4 mV;
float4x4 mP;
float4x4 mOrtho;
float2 vNearFar;
static const float PI = 3.14159265f;

texture g_TextureDiffuse;
sampler g_SamplerDiffuse = sampler_state
{
    Texture = <g_TextureDiffuse>;
    MinFilter = Point;
    MagFilter = Linear;
    MipFilter = Linear;
    AddressU = Clamp;
    AddressV = Clamp;
};

struct VS_IN
{
    float4 Position : POSITION0;
    float3 Normal : NORMAL0;
    float2 UV : TEXCOORD0;
};

struct PS_IN
{
        float4 Position : POSITION0;
    float3 Normal : TEXCOORD0;
    float2 UV : TEXCOORD1;
    float4 Pos2 : TEXCOORD2;
};

PS_IN VS( VS_IN input )
{
    PS_IN output = ( PS_IN )0;

    float4x4 mWV = mul( mW, mV );
    float4x4 mWVP = mul( mWV, mP );
        half4 vPos = mul( input.Position, mWV );

    half3 vHemi = normalize( vPos.xyz );

    half3 fNearFar = vNearFar.y - vNearFar.x;

    output.Position.xy = vHemi.xy * fNearFar;
    output.Position.z = ( vPos.z / ( vNearFar.y - vNearFar.x ) );
    output.Position.w = fNearFar;
    output.Pos2 = output.Position;
    output.Normal = mul( input.Normal, mWV );
    output.UV = input.UV;
    return output;
}

float4 PS( PS_IN input ) : COLOR0
{
    //float2 uv = input.UV - 0.5;
    //float z = sqrt( 1.0 - input.Pos2.x * input.Pos2.x - input.Pos2.y * input.Pos2.y );
        //float a = ( z * tan( ( PI / 2 ) * 0.5 ) );
        //return tex2D( g_SamplerDiffuse, ( uv * a ) + 0.5 );

    float4 diffuse = tex2D( g_SamplerDiffuse, input.UV );
    return diffuse;
}

technique Render
{
    pass Pass0
    {
        VertexShader = compile vs_2_0 VS();
            PixelShader = compile ps_2_0 PS();
    }
}

Here is screenshot:

It may be difficult to tell, but the cube has two faces( triangles ) per side( 6 sides, 12 faces ). From the picture you may be able to see the problem with flat edges...this problem is well documented...I'm trying to avaoid having to render 5 different images( hemicube ) to approximate a hemisphere...I'm mostly interested in hearing about methods of implementing a hemisphere...I also tried( to no avail ) to write a pixel shader that would warp the final( post scene render ) image. I didn't get great results...

...it also just came to me that I don't necessarily need a render result for computing the form factor...just the area that the projected object consumes within the area of the hemisphere base...

...any thoughts are appreciated!

... here is a screenshot of the cube subdivided...much better...still not accurate

sentences: Artificial intelligence for targeting 3D flying objects I'm working on a 3D game in Xna in which there is my jet which I am controlling. I want to add other jets as enemies. For that I need their AI so that I could have them able to target my jet. I've searched Google but couldn't find good resources. I hope professionals here can help me with my project.

sentences: How can I make an movieclip move in a circular path with GTween? How can I make an movieclip move in a circular path with GTween? it's straightforward to have something move with various easing effects in a line or a curve, but I would need a complete circular path.

sentences:
(Gamemaker Studio) How to draw a vector? Let's say I want to start from the center pixel of a screen of indeterminate size, and I want to be able to draw an arrow from this center pixel to any other pixel.

The only way I know how to do that is to assign entirely new sprites for each and every possible direction and magnitude of the vector...which might work (even if it's tedious) for around 10 or even 20 possible combinations, but much more and it would really chug a system with the switch statement alone to find which sprite to use.

So, the obvious, much better, way of doing this is just to dynamically draw from one point to another...I don't know how to though.

sentences:
How do I stop my first person character going through walls? As per my code:

using System.Collections;
using System.Collections.Generic;
using UnityEngine;
using UnityEngine.UIElements;
using Cursor = UnityEngine.Cursor;

public class FirstPersonController : MonoBehaviour
{
    public float speed = 5;
    public float jumpPower = 4;

    Rigidbody rb;
    CapsuleCollider col;

    private GameObject player;
    private float minClamp = -45;
    private float maxClamp = 45;
    [HideInInspector]
    public Vector2 rotation;
    private Vector2 currentLookRot;
    private Vector2 rotationV = new Vector2(0,0);
    public float lookSensitivity = 2;
    public float lookSmoothDamp = 0.1f;
    public Camera cam;
    public GameObject crossHair;
    bool isActive;

    // Start is called before the first frame update
    void Start()
    {
        Cursor.visible = false;
        Cursor.lockState = CursorLockMode.Locked;

        rb = GetComponent<Rigidbody>();
        col = GetComponent<CapsuleCollider>();
        player = transform.gameObject;
        crossHair = GameObject.FindWithTag("CrossHair");

    }

    // Update is called once per frame
        void Update()
    {
        float Horizontal = Input.GetAxis("Horizontal") * speed;
        float Vertical = Input.GetAxis("Vertical") * speed;
        Horizontal *= Time.fixedDeltaTime;
        Vertical *= Time.fixedDeltaTime;
        transform.Translate(Horizontal, 0, Vertical);

        if (isGrounded() && Input.GetButtonDown("Jump"))

        {
            rb.AddForce(Vector3.up * jumpPower, ForceMode.Impulse);
        }

        if (Input.GetKeyDown("escape"))
        {
            Cursor.lockState = CursorLockMode.None;
        }

        if (Input.GetButtonDown("Sprint"))
        {
            speed = 15;
            //Debug.Log("Sprint Button Held Down");
        }

        if (Input.GetButtonUp("Sprint"))
        {
            speed = 5;
            //Debug.Log("Sprint Button Let Go");
        }

        if (Input.GetKeyDown(KeyCode.H))
        {
            isActive = !isActive;
        }

        if (isActive)
        {
            crossHair.SetActive(true);
        }
        else
        {
            crossHair.SetActive(false);
        }

        rotation.y += Input.GetAxis("Mouse Y") * lookSensitivity;
        rotation.y = Mathf.Clamp(rotation.y, minClamp, maxClamp);
        player.transform.RotateAround(transform.position, Vector3.up, Input.GetAxis("Mouse X") * lookSensitivity);
        currentLookRot.y = Mathf.SmoothDamp(currentLookRot.y, rotation.y, ref rotationV.y, lookSmoothDamp);
        cam.transform.localEulerAngles = new Vector3(-currentLookRot.y, 0, 0);
    }

    private bool isGrounded()
    {
        return Physics.Raycast(transform.position, Vector3.down, col.bounds.extents.y + 0.1f);
    }

}

I can't figure out what I am doing wrong in my code, I tried to write a first person controller from scratch.

The full project can be downloaded from: https://github.com/Some-T/FirstPersonController-CSharp

My player goes through any wall or object easily despite it having colliders on the objects and a rigidbody and collider on the player.

I have gone through my code line by line and I cannot work out what is wrong? If someone could please advise me what to change or add to my code to fix this, or / and explain the concept, presumably physics related, as to why this is going wrong please?

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:
How can I optimize a parallax effect consisting of multiple transparent layers? I have a parallax effect in MonoGame consisting of multiple semi-transparent layers of textures. The effect is simple, but rendering multiple transparent layers on top of each other is rather slow. This effect doesn't need to be "accurate". How can I optimize this effect or fake it with shaders to make it more efficient?

The main premise is multiple full screen size semi-transparent layers drawn on top of each other from back to front. There are currently 3 layers + the actual game layer that also has some transparency.

I used a stencil buffer to render the game layer, already eliminating some of the parallax layers' pixels from rendering, but it's still inefficient.

sentences:
Spell classes and inheritance I'm currently developing a small game, that includes spell casting.
My class structure looks like this:

AbstractSpell

AbstractDamageSpell

AbstractClickableSpell

AbstractClickableDamageSpell

"Clickable" means that the user has to hit a key followed by a mouse click. Some spells don't need that extra mouse click (like Windwalk). As you can see, AbstractDamageSpell and AbstractClickableDamageSpell have the same properties and methods.
Is there a better way of extending these classes? Any hints in general?

sentences:
OpenGL back/front end threading and Doom 3 BFG engine Introduction

I have been reading through the source code of id Software's Doom 3 BFG engine. The whole codebase is on GitHub at id-Software/DOOM-3-BFG. The architecture is both clean and elegant. The whole code base is of exceptional code quality. (It makes for a great code read.)

Fabian Sanglard has an easy to follow code review of the engine. In particular, I am interested in id Software's implementation of the renderer, which is explained here: http://fabiensanglard.net/doom3_bfg/renderer.php.

Architecture of renderer

Fabian's site offers this architectural diagram of the renderer.

From the source code, and from the review, you can see that the renderer consists of a frontend and a backend. The engine is multithreaded in two ways, first there is a job pool whose task items are consumed by worker threads without relying on mutexes (this is awesome). In addition to the job pool, the renderer front end and back also each have their own thread.

My implementation of something similar

I played around with trying to build something similar in my own game engine. I will probably make the repo public and link to it here at some point, in the future.

The renderer front end lives on the same thread as the program entry point main(), where my Service Provider and Subsystem Singletons also live. Upon startup it launches the backend on a separate thread. The front end talks to the back end via a non-blocking command buffer. I implemented it using this awesome single-producer / single-consumer non-locking queue on GitHub at cameron314/readerwriterqueue.

The backend consumes commands of the command buffer queue, and turns them into OpenGL calls. The backend creates and manages the OpenGL context lifecycle. (At the moment this is an obstacle, because I am using SDL2, and I don't want SDL API related functionality, like input, running on the renderer backend thread.

Is it worth it?

Aren't OpenGL calls suppose to occur asynchronously, given that we are somewhat successful at minimizing GPU / CPU synchronization? Is all the added architectural complexity worth it from a performance perspective? With more modern rendering techniques like vertex buffer streaming, it seems as if more and more work is done to transfer load from the CPU to the GPU, and to make drawing asynchronous.

Adding the command buffer queue also adds a relatively heavy layer of abstraction between the originating draw service call and the underlying driver call. This complexity certainly must impact cache coherence and branch prediction.

Newer, closer to the silicon graphics APIs like METAL, only further exaggerate my point. I guess moving away from the CPU is the obvious future path of progression for graphics performance.

Is it relevant?

As elegant as the Doom 3 BFG engine is, the architecture is probably a bit dated, and probably misses out on some new innovations. Did the engine originally rely on a fixed pipeline? This might explain this design choice.

Do any modern game engines use something like this?

Apology

Sorry for the long-winded and multi-faceted question. I hope the community will forgive me. I also realize, profiling would be able to answer my question. Unfortunately, neither my implementation of the technique I described, nor the method without it, is mature enough, to do any meaningful profiling. Not to mention, there are a whole lot of other variables as well.

I'd rather not build a complete rendering pipeline around a flawed and outdated idea, only to discover that it is over engineered and slow.

In the meantime, I will continue to develop my job schedular approach, but this could be a feature design improvement.

Any insights or discussion would be greatly appreciated. Thanks!

sentences:
How to get the directional vector (for IrrKlang) from pitch and yaw? Currently my game engine allows the player/camera to pitch and yaw, so there's no roll.

The pitch angle starts at 0°, which means the camera is facing straight ahead. From here it can go up to +85° (looking almost straight up) or down to -85° (looking almost straight down).

The yaw angle starts at 0°, which means the camera is facing east. The rotation is clockwise so 90° is south, 180° is west and 270° north. What would be 360° is 0° again obviously.

How do I get from this to the direction vector (lookdir) IrrKlang's SetListenerPosition requires to get directional audio working?

PS: x and z are my horizontal axis, y is the vertical one.

sentences:
How can I move a sprite in the direction it is facing? I'm using Java/Slick 2D. I'm trying to use the mouse to rotate the sprite and the arrow keys to move the sprite. I can get the sprite to rotate no problem, but I cannot get it to move in the direction it is supposed to. When I hit "forwards", the sprite doesn't necessarily move towards the mouse. Actually, it will only move towards the left of the screen really. I'm sure there has to be some standard code for this since many games use this style of motion. Can anyone help me out with what the trig is supposed to be? Thanks

EDIT: Here is the rotation code (which does something else weird: https://stackoverflow.com/questions/12610320/why-is-my-image-rotating-off-center)

int mX = Mouse.getX();
        int mY = HEIGHT - Mouse.getY();
        int pX = sprite.x;
        int pY = sprite.y;
        int tempY, tempX;
        double mAng, pAng = sprite.angle;
        double angRotate=0;

        if(mX!=pX){
            mAng = Math.toDegrees(Math.atan2(mY - pY, mX - pX));
            if(mAng==0 && mX<=pX)
                mAng=180;
        }
        else{
            if(mY>pY)
                mAng=90;
            else
                mAng=270;
        }

        sprite.angle = mAng;
        sprite.image.setRotation((float) mAng);

And the movement code. I can only move towards the left of the screen...

double ang = sprite.angle;
            Input input = gc.getInput();

            if(input.isKeyDown(sprite.up)){
                sprite.x += Math.cos(ang)*sprite.moveSpeed;
                sprite.y += Math.sin(ang)*sprite.moveSpeed;
            }if (input.isKeyDown(sprite.down)){
                sprite.x += -1*Math.cos(ang*Math.PI/180)*sprite.moveSpeed;
                sprite.y += -1*Math.sin(ang*Math.PI/180)*sprite.moveSpeed;
            }if (input.isKeyDown(sprite.left)){
                sprite.x -= Math.cos(ang*Math.PI/180)*sprite.moveSpeed;
                sprite.y += Math.sin(ang*Math.PI/180)*sprite.moveSpeed;
            }if (input.isKeyDown(sprite.right)){
                sprite.x += Math.cos(ang*Math.PI/180)*sprite.moveSpeed;
                sprite.y -= Math.sin(ang*Math.PI/180)*sprite.moveSpeed;
            }

sentences:
How to draw text on a 3d sphere? I am facing a problem in mapping 3d co-ordinate to screen co-ord . I require it because i want to draw text on the model . model is drawn at the 3d-cordinate, so if i know the position of that co-ord on the screen i can draw text at that position.

my view is on z axis
test position is on x axis

In the follwing code I did what i said above but the transformation is not happening the way it should i.e, text should appear on the model

float aspectRatio = graphics.GraphicsDevice.Viewport.AspectRatio;
Vector2 screenOrigin = new Vector2(GraphicsDevice.Viewport.Width / 2, GraphicsDevice.Viewport.Height / 2);
Vector3 testPosition = new Vector(10,0,0);
Vector3 cameraPosition = new vector(0,0,50),

Matrix world = Matrix.Identity;
Matrix view = Matrix.CreateLookAt(cameraPosition,Vector3.Zero, Vector3.Up);
Matrix projection = Matrix.CreatePerspectiveFieldOfView(MathHelper.ToRadians(45.0f), aspectRatio, 1.0f, 10000.0f);

Matrix totalEffect = world * view * projection;

Vector2 spritePos = getXYPosition(vecAndMatMultiplication(testPosition, totalEffect))+screenOrigin;

Where vecAndMatMultiplication() multiplies vector with the matrix and getXYpostion() should be fairly obvious.

sentences:
What design pattern should be used when there are a lot of different possible jobs? Some background information on what I am trying to accomplish. I am creating the game in Unity using C#. Basically, I am trying to create an RPG type of game where it really harps on the idea of a lot of different possible classes/jobs(I will call them jobs so not to confuse anyone). Basically, every job will have its own unique set of skills and can only do certain tasks, not dissimilar to a lot of games out there. However, the way I see most of the advice given down this path is simple inheritance, mostly because the user is only trying to implement 2 or 3 unique jobs. I feel as though this is just the easy answer that ends up causing a lot more headaches in the long run when you have lots of different jobs to implement.

So my main question is, what design patterns would someone use when there are a lot of different jobs that the programmer needs to implement?

sentences:
Switch Vector 3 x,y,z Components Based on Rotation I have a cube that moves by rotating on its edge. I want my code to also work for cuboids. The following code is what I'm using to rotate my cube:

turnPoint = transform.position + new Vector3(0.5f * direction * x, -0.5f, 0.5f * direction * z); // Location of edge (resets every 90 degrees)
transform.RotateAround(turnPoint, axis, rotateSpeed * direction); // Turn around the edge

It works fine, however I want to get this to work when the cube is scaled to be a cuboid. I tried multiplying the new Vector3's x, y and z components by the objects respective x, y and z scale. This works, but only for the first rotation.

Is there a way this could work for all future rotations without using if/else for all 4 rotations?

sentences:
XNA: Check if the sound is playing Quick question:

I have a SoundEffect instance, and I would like to know if it is playing at the moment or not. But there's neither a method, nor a property that would allow to check it...

So, is there a way to know it?

sentences:
What is the best way to close dialogs in a platform game controlled by keyboard only I'm developing a flash puzzle platform game in my free time and I got stuck on deciding how to implement a feature. The game will be controlled by keyboard only, no mouse available.

My game will have Dialog boxes, used for story telling, announcing events, tutorial hints etc. I'd really prefer not to dedicate a large portion of the screen allowing the player to play while the dialog is displayed.

So my approach is to pop up the dialog and pause the game until the player closes the dialog. That's because the game has a small resolution (640 x 320) and some of the dialogs are pretty large (up to 5 lines text, talker's thumbnail etc).

EDIT : Another major reason I want to pause the game, is that I want to be 100% sure the player will not miss a dialog. Also, I want her to read it in a certain level area, before visiting another area of the level, or doing something that will advance the plot.

The thing Is that I can't find a way to make this work right. After testing the game with a few friends, I'm not satisfied from the feedback I get.

If I force them to close the dialog with one specific key (ACTION), I see people keep hitting keys randomly (e.g FIRE or JUMP key), while they know that it's closed with ACTION, like they did that 2 minutes before. They eventually get to close the dialog, but I can see they get a bit frustrated. I don't think they adopt the control as fast as I'd expect.

If I let them close the dialog with ANY key, they find themselves closing the dialog by mistake. Some of the dialogs are popping out while they're not expecting it.

So I'm starting to think that the 'Pause for dialog - close it to Resume' might be a bad idea in the first place. Do you think it is ? Or is it OK to have the dialog pause, but I just have to find the way to do it right ? Maybe the problem is not the controls, but something else, like say, I should not pop out the dialogs unexpectedly ?

Do you have any example of some game doing that right ?

sentences:
Fresh new MonoDevelopment install "assembly not found for framework .NET Framework 4.5" I'm using Ubuntu 18.04.4 LTS and I went through the instructions on this page: https://www.monodevelop.com/download/ very specifically, (yes, I made sure to use the steps for the correct operating system, and I did all of the steps at the bottom, I have all certificates and performed all fo the updates).
I then opened monodevelop and went into tools and downloaded the monogame extension.
Then I was able to create a new solution of type MonoGame... the options are: Cross Platform, iPhone/iPad, Android, Windows, Mac, and tvOS.  Apparently there isn't even support for Android at all so I don't know why that's even an option.  I then tried Cross Platform, and am now trying Windows Application... And when a make a solution for either of these files and just try to build the initial boiler plate code that they give me, I get the following error as demonstrated in the image below.  Does anyone know how to get these assemblies?  And why are all of these files missing?  I deleted Monodevelop from my machine and reinstalled it from scratch and tried again using a new solution and it's all the same.  Is game development for MonoGame using MonoDevelop on a Linux machine even possible?

sentences:
SceneKit-Convert a rotation vector into rotation matrix I'm very new and I'm studying this ARKit code from RPasecky/CubesInSpace on github where he/she convert the point of view 's rotation vector into a rotation matrix

https://raw.githubusercontent.com/RPasecky/CubesInSpace/master/CubesInSpace/MainViewController.swift

func calculateCameraDirection(cameraNode: SCNVector4) -> SCNVector3 {
    let x = -cameraNode.x
    let y = -cameraNode.y
    let z = -cameraNode.z
    let w = cameraNode.w
    let cameraRotationMatrix = GLKMatrix3Make(cos(w) + pow(x, 2) * (1 - cos(w)),
                                              x * y * (1 - cos(w)) - z * sin(w),
                                              x * z * (1 - cos(w)) + y*sin(w),

                                              y*x*(1-cos(w)) + z*sin(w),
                                              cos(w) + pow(y, 2) * (1 - cos(w)),
                                              y*z*(1-cos(w)) - x*sin(w),

                                              z*x*(1 - cos(w)) - y*sin(w),
                                              z*y*(1 - cos(w)) + x*sin(w),
                                              cos(w) + pow(z, 2) * ( 1 - cos(w)))

It was called from here

    let rotation = self.sceneView.pointOfView!.rotation //else { return (SCNVector3Zero) }
    let direction = calculateCameraDirection(cameraNode: rotation)

I understand the rotation of pointOfView that is passed in has x, y, z as the coordinate of the axis and w is the rotation angle. But how do I arrive at the code in the function? Which concepts should I learn about here?

I read about homogeneous vector, find rotation matrix between 2 vectors, and transformation matrix but this doesn't look like it

Thanks,

sentences:
Custom FPS Controller in Unity 5.6.6f2 not letting me look up or down Due to the FPS Controller seeming to be broken in Unity now, I started using a custom one by kinifi on GitHub. For some reason though I can't look up or down. I removed the Main Camera so it should of fixed it but no. Is there anything I can change in this script to allow me to look up and down.

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

[RequireComponent(typeof(Rigidbody))]
public class FPS : MonoBehaviour
{

    private float speed = 5.0f;
    private float m_MovX;
    private float m_MovY;
    private Vector3 m_moveHorizontal;
    private Vector3 m_movVertical;
    private Vector3 m_velocity;
    private Rigidbody m_Rigid;
    private float m_yRot;
    private float m_xRot;
    private Vector3 m_rotation;
    private Vector3 m_cameraRotation;
    private float m_lookSensitivity = 3.0f;
    private bool m_cursorIsLocked = true;

    [Header("The Camera the player looks through")]
    public Camera m_Camera;

    // Use this for initialization
    private void Start()
    {
        m_Rigid = GetComponent<Rigidbody>();
    }

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

        m_MovX = Input.GetAxis("Horizontal");
        m_MovY = Input.GetAxis("Vertical");

        m_moveHorizontal = transform.right * m_MovX;
        m_movVertical = transform.forward * m_MovY;

        m_velocity = (m_moveHorizontal + m_movVertical).normalized * speed;

        //mouse movement
        m_yRot = Input.GetAxisRaw("Mouse X");
        m_rotation = new Vector3(0, m_yRot, 0) * m_lookSensitivity;

        m_xRot = Input.GetAxisRaw("Mouse Y");
        m_cameraRotation = new Vector3(m_xRot, 0, 0) * m_lookSensitivity;

        //apply camera rotation

        //move the actual player here
        if (m_velocity != Vector3.zero)
        {
            m_Rigid.MovePosition(m_Rigid.position + m_velocity * Time.fixedDeltaTime);
        }

        if (m_rotation != Vector3.zero)
        {
            //rotate the camera of the player
            m_Rigid.MoveRotation(m_Rigid.rotation * Quaternion.Euler(m_rotation));
        }

        if (m_Camera != null)
        {
            //negate this value so it rotates like a FPS not like a plane
            m_Camera.transform.Rotate(-m_cameraRotation);
        }

        InternalLockUpdate();

    }

    //controls the locking and unlocking of the mouse
    private void InternalLockUpdate()
    {
        if (Input.GetKeyUp(KeyCode.Escape))
        {
            m_cursorIsLocked = false;
        }
        else if (Input.GetMouseButtonUp(0))
        {
            m_cursorIsLocked = true;
        }

        if (m_cursorIsLocked)
        {
            UnlockCursor();
        }
        else if (!m_cursorIsLocked)
        {
            LockCursor();
        }
    }

    private void UnlockCursor()
    {
        Cursor.lockState = CursorLockMode.Locked;
        Cursor.visible = false;
    }

    private void LockCursor()
    {
        Cursor.lockState = CursorLockMode.None;
        Cursor.visible = true;
    }

}

sentences:
How can I insert and remove blocks quickly in a Minecraft-style world? I currently have volume data for the world stored as an array of booleans.  I then check each empty block and if it has non-empty neighbors the faces get drawn.  This prevents me from sending a bunch of faces to the graphics card using OpenGL.

I'm now working on inserting and removing blocks but I'm not sure how to do this quickly.  It is simple enough to change the volume data but I don't want to recompute all the vertices from the volume data each time someone inserts or removes a block.  It occurred to me just to add the block to the vertex buffer at the end of the existing vertex data but then I don't have a good way of destroying it as I have no way to correlate between the volume and vertex buffer data.

Any thoughts on how I can fix the mess I'm in?

sentences:
Can I reuse the name of an old arcade game? I've done an indie remake of an old arcade game from 1980.

Can I use its name? I thought copyright expired after 25 years but I could be wrong, hence this question.

sentences:
CS 1.6 server's request cartography Is there a way to request a CS 1.6, CS:Sourse or CS:GO servers to get the location coordinates of the recent deaths of players on the game map?

PS I'm using C# for my project

sentences:
Set box collider size in meters instead of percents TL;DR: Can I set the size of a collider in meters instead of fractions of the size of the object it's in?

I'm implementing a classic NES game, and my scale is 1 meter = 16 pixels. I have an 8x1x1m prism with a rigidbody, and I need its box collider to be smaller than it by one pixel on every side- to have the dimensions (8 - 1/16 - 1/16) x (1 - 1/16 - 1/16) x (1 - 1/16 - 1/16). (I'm subtracting the width of two pixels from each dimension because each dimension corresponds to two sides.)

When I set the size of the collider to (0.5, 1, 1), though, it interprets those numbers as fractions of the size of the prism instead of as meters. This results in a 4x1x1m collider instead of a 0.5x1x1m collider. Is there a way I can set the size in meters instead of percents? I'll save me a little bit of math, and, more importantly, it could prevent some floating point errors, especially if I switch to a scale with more pixels per meter.

sentences:
Draw Primitives with Unity 2D I would like to be able to draw primitives in unity 2d to define my game objects. I have tried the following example:

using UnityEngine;
using System.Collections;

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

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

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

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

sentences:
How do I create my own GPU accelerated graphics API in C#? I am creating 2D game engine in C# and I need some graphic API, so that user can draw sprites or convex vector shapes. I tried to use GDI+ for it. But I discovered that GDI+ is not GPU accelerated and it is too slow. XNA (a toolset for game developers form Microsoft) and it is GPU accelerated.

So I made a performance comparison between XNA and GDI+. XNA draws 2048x2048 px sprite in ~0.05 ms in GDI+ it takes about 400-500 ms. How to start? How to make my own graphic API (like DirectX/OpenGL).

sentences:
How can I resize my Blender models when importing to Unity? I made a 3D model in Blender, but when put it in my Unity project and add an FPS-camera the camera is bigger then my model. I used the measurements of Blender (that one cube is 1 meter in Unity).

How can I fix this?

sentences: How can I draw textures with JOGL? I have begun to learn OpenGl and using JOGL. There's something I haven't found any actual or easy guide to though: how can I draw textures? For example, what kind of code would I need to draw a texture at (X, Y, Z) position? I want to use glDrawArrays() or glDrawElements().

sentences:
How might I script the creation of CLR objects? I am looking for a method to script the creation of entities (arrays of components) for delivery through my entity factory, i.e scripted creation of .net objects.

I have looked into Lua but it seems dynamically creating CLR objects is a somewhat impractical.

Is there another method I could use to achieve this?
Is there a general pattern / approach to take towards scriptiing out functionality in this context?

My factory provides an abstracted EntityComponent[] per request, so the scripting platform would need to be aware of and be able to construct the component types defined within the c# namespace.

I want to be able to define the components of an entity and the components relevant properties in some declarative form within a script. To give some background information, I was let onto this when I found deserializing entity definitions from XML was going to be very awkward. Reflection within C# is an option but if it is not my only option I would very much seek to avoid it.

EDIT:
Turns out I was very wrong about Lua! It is unbelievably easy to achieve what I was describing once you get the LuaInterface DLL up and running, importing types from your C# application into Lua is simple and effective.

sentences:
How to use an array of y values to render a 2D top-down Java game? I'm fairly new to the world of coding, and there's probably a simple solution here. I made this array (the actual one is more complex since it includes everything I have so far) for the y values of every object that needs to be rendered, but I don't know how to use it to keep track of which y values correspond to which object in order to draw them from lowest y value to highest y value.

int [] yValues = {deer.getY(), sprite.getY(), tree.getY()+150};
    Arrays.sort(yValues);

The deer just randomly walks around, and the player (sprite) is controlled by arrow keys. I added to the y value of the trees so that characters that walk around would stay behind them.

Right now I've hard-coded the layering, depending on when the sprite is in front of or behind the tree (hair and skin y positions are dependent on the y position of the sprite, which is why I didn't include them in the yValues array).

//Printing order
    if (sprite.getY() < tree1.getY()+150) { //if the player is behind the tree

        g2d.drawImage(deer.getImage(), deer.getX(), deer.getY(), this);

        g2d.drawImage(sprite.getImage(), sprite.getX(),
            sprite.getY(), this);
        g2d.drawImage(skin.getImage(), sprite.getX(),
                sprite.getY(), this);
        g2d.drawImage(hair.getImage(), sprite.getX(),
                sprite.getY(), this);

        //the tree is drawn after everything else
        g2d.drawImage(tree.getImage(), tree.getX(), tree.getY(), this);
    }

    if (sprite.getY() >= tree1.getY()+150) { //if the player is in front of the tree

        //the tree is drawn before everything else
        g2d.drawImage(tree.getImage(), tree.getX(), tree.getY(), this);

        g2d.drawImage(deer.getImage(), deer.getX(), deer.getY(), this);

        g2d.drawImage(sprite.getImage(), sprite.getX(),
            sprite.getY(), this);
        g2d.drawImage(skin.getImage(), sprite.getX(),
                sprite.getY(), this);
        g2d.drawImage(hair.getImage(), sprite.getX(),
                sprite.getY(), this);
    }

From here, how would I use the yValues array to order the drawing?

[I found this post helpful to what I'm trying to do] (Java Slick2d image depth/layering).

sentences:
render() can't seem to reference my sprite properly This is driving me a little crazy. We use libGDX, working on making a simple side scroller for fun. I've got it switching from screens alright, loading from my main menu into my level one class, which implements screen.

public class levelOne implements Screen

Don't know if that effects this. When I try to initialize my sprite, my editor (AIDE) highlights it. Gives me an error saying that there is no access to the variable, as it does when you declare something but don't use it.

Texture faceTexture = new Texture(Gdx.files.internal("faceSprite.png"));
faceGuy = new TextureRegion(faceTexture, 50, 50, 95, 95);
Sprite player = new Sprite(faceGuy);

I do actually call up the sprite in render() though,

batch.begin();

// Background
batch.draw(backGround,0,0,2900,800);

// Player
player.draw(batch);

// Enemies
batch.draw(faceGuy, baddieOnePosition.x, baddieOnePosition.y, 150, 150);

batch.end();

It doesn't generate an error there, but trying to run it generates a crash. I can do a batch.draw of the texture, but every attempt at doing it as a sprite fails. I have it being initialized in show(), thought maybe making a new method to do so would help, but had the same result. The only way I've managed to make it work was to initialize it in render(), but that not only resets the sprites position multiple times a second, but I expect is also a memory hog. Help!

sentences:
In Unity, Change which mouse button is used to scroll in ScrollRect I've created a new ScrollView in Unity. How do I change which mouse button is used to scroll in ScrollRect (through script or in the editor).

By default it's the left mouse button. I'd like to be able to change this to another mouse button.

I'd also like to be able to use a keyboard key and disable it altogether (via script without also disabling the scrollbars), but mainly I at least want to change it from the left mouse button.

sentences:
Multiplayer netcode where all units, including server, are untrusted - possible, feasible, etc.? Most professional video games use either a peer-to-peer architecture or a client-server architecture. In the former, clients often trust each other, and instead employ anti-cheat techniques to ensure that all clients are using the same version of the game. In a client-server architecture, the company-owned server manages the game, and each client only needs to trust the server without trusting any other client.

My question is: how might I write a game network architecture such that the server is not necessarily trusted either (e.g. it is another client, or is buggy, or has been compromised), and do so in a way that does not take too much processing power away from the game?

I know that the blockchain algorithm (as infamously used by Bitcoin and other cryptocurrencies) does provide this as long as at least half of the computing power is owned by trusted machines. While this may work for long-term actions (such as match verdicts), it doesn't work as well for the frame-by-frame actions of action games and can also be too slow for turn-based games, to say nothing of the computing power it requires of the clients or of any dedicated servers.

sentences:
Is there anything like XNA for c++? I love the features of XNA but I want to get into c++ game dev. The problem is that I now have to worry about everything from loading a png file to opening a window. This is a little bit annoying.

I would really like a c++ version of XNA to solve these issues for me.

sentences: Why use compression such as zlib? Compression and encryption are different things AFAIK, so why even use compression if you have to still decompress anyway, is this just to reduce distribution size or is there some other reason?

sentences:
GLSL: Issue replacing ternary operator with mix I was expecting these two code snippets to do the same thing:

return  vec3(  1.0-b.r>=a.r ? 0.0 : 1.0-((1.0-b.r)/a.r),
               1.0-b.g>=a.g ? 0.0 : 1.0-((1.0-b.g)/a.g),
               1.0-b.b>=a.b ? 0.0 : 1.0-((1.0-b.b)/a.b)  );

and

return mix( ONE3 - ((ONE3-b)/a), ZERO3, vec3(greaterThanEqual(ONE3-b, a)) );
       // ONE3=vec3(1.0,1.0,1.0); ZERO3=vec3(0.0,0.0,0.0);

For some reason, they have different outputs. Do you know why? (a can have zeros sometimes)

sentences:
2d games unity vs Flash do people find unity better than flash for 2d games while unity is 3d engine , or Flash still better because it's made for 2d games and flash can get the job done faster ,and now flash is better for ios/android 2d games .
so what platform is the best for 2d games?

sentences:
LibGDX, vertical group not displaying I'm having trouble showing a simple custom VerticalGroup.

Here's my SideBar class:

public class SideBar extends VerticalGroup {
    final GameManager gameManager = GameManager.instance;
    final Image nextBackground;
    final Image nextImage;
    final Image powerImage;
    final Image powerUp1Background;
    final Image powerUp2Background;
    final Image powerUp3Background;

    public SideBar() {
        super();
        nextBackground = new Image(gameManager.getTexture("bar.next.png"));
        addActor(nextBackground);
        nextImage = new Image(gameManager.getTexture("label.next.png"));
        addActor(nextImage);
        powerImage = new Image(gameManager.getTexture("label.power.png"));
        addActor(powerImage);
        powerUp1Background = new Image(gameManager.getTexture("powerup.bg.png"));
        addActor(powerUp1Background);
        powerUp2Background = new Image(gameManager.getTexture("powerup.bg.png"));
        addActor(powerUp2Background);
        powerUp3Background = new Image(gameManager.getTexture("powerup.bg.png"));
        addActor(powerUp3Background);
    }
}

And here's where I add it to my main Stage:

    TopBar topBar = new TopBar();
    topBar.setY(DonutsGame.WORLD_HEIGHT - topBar.getHeight());
    stage.addActor(topBar);

    SideBar sideBar = new SideBar();
    Gdx.app.log(TAG, "side bar - x,y: " + sideBar.getX() + "," + sideBar.getY() + ", w,h: " + sideBar.getWidth() + "," + sideBar.getHeight());
    stage.addActor(sideBar);

My TopBar class extends Group and is displaying correctly, so I'm not sure what I'm doing wrong with SideBar that's causing it to not show.

The log output shows that the position, and width/height are all 0, which seems incorrect to me according to the vertical group's documentation. Which states that the width/height should be based on the pref. width/height of the children (height based on sum).

I've tried calling validate and layout with no success.

sentences:
Unity Deactivating Keyboard Input Interpolation I'm working on a game in Unity, and it is a little jarring to use with keyboard controls. I'm using the built in Input Manager, where I have a set of axes mapped to the left and right keys. When the player is using the keyboard instead of a joystick, I'd like it to simply be -1 when hitting left, 1 when hitting right, and 0 otherwise, but this isn't the case. I've found that for the first few frames of the button being held, Unity automatically builds up to the value-- for example, if I'm holding right, the value wouldn't go straight from 0 to 1, but rather from 0, to 0.25, to 0.5 and so on, continuously up to 1. Can I deactivate this? If so, how?
Thanks in advance.

sentences:
How to map changing stances (southpaw/orthodox) to gamepad controls? I am developing a third person hack n slash style game which features a variety of melee and projectile weapons as well as unarmed combat. The player will be able to dual wield any combination of the above weapons eg. a sword and a pistol, or a knife and a bare fist. I'm trying to work out the gamepad controls based on the game mechanics, but I've come to a dilemma regarding the movesets.

Originally I had the left and right triggers mapped as the left and right hand attacks. However, some of the attack moves that I have planned involve the player taking a step forward. Meaning they may have started in orthodox stance (left foot forward) but will end up in southpaw (right foot forward). For some weapons like firearms the stance makes no difference, since the attacks will be the same from either. But for some melee weapons and especially for unarmed combat this is a significant difference. For example, from orthodox stance the left trigger should logically do a jab attack from the front hand, while the right trigger should do a straight punch attack from the back hand. If the player now does a lunging attack in which they take a step forward, they end up with their other foot infront, meaning that now the left trigger cannot do a jab but must perform a straight punch since the left hand is no longer in front.

So the question is how to resolve this without having a controls system that confuses the player. There are a few options I have considered after studying other games, but I am looking to see if a better alternatives exists.

1) Seen in Elder Scrolls, Dark Souls, Tekken:

Use 2 attack buttons but have the player always stay in a single stance. This way they the left and right limbs will always perform the same move. The downside of this is that attacks which would normally leave the player in another stance have to either be avoided or the animation has to include the player returning to their original stance. While this solves the problem it can look unrealistic.

2) Seen in DOA, VF:

Use only 1 attack button, instead of one for each limb. This will mean that the stance of the player is irrelevant since a single button will play the correct attack animation of either the left limb or right limb depending on the stance. While this is more realistic it makes it difficult to have dual wielding weapons with only one button controlling both. For example, consider if a pistol and sword are being dual wielded, the left trigger may swing the sword while the right trigger may fire the pistol; but if both weapons are mapped to only the right trigger what attack should happen? The sword, the pistol, both? Here lies the problem.

3) Seen in MK:

Use 2 attack buttons which refer to the front or back limb, not the left or right limb. This method allows for the player to switch stances, since for example the left trigger may refer to the front hand irrespective of which stance the player is in. In a side scrolling game this may not be a problem, but in a third person game where the camera is behind the player, I am concerned that this type of controls will be confusing. Especially since the convention (correct me if I'm wrong) for dual wielding seems to be that the left and right triggers control the left and right weapons/limbs.

So are these the only options, or is there a better way of mapping the controls for this use case?

sentences:
iOS: OpenGL ES 2.0 render texture with glScissor performance I have drawn image with OpenGL and will redraw tile of its texture (non filled area).

Which case will work faster?

Set glViewport with full texture's rect, draw full texture and use glScissor with updated area's rect.
Set glViewport with updated area's rect and draw tile of texture with calculating its texture coordinates.

I've found in Apple's documentation, that scissor test is called after fragment shader. Does this mean, that fragment shader will work with pixels of full texture? How slower will it be rendered than case 2?

SOLVED:
I've viewed pipeline scheme of OpenGL ES 2.0 here. Scissor test is done before fragment shading and allow to optimise rendering.

sentences:
Is it legal to publish a game that uses a youtube tutorials code? I am working on my noughts and crosses game, and I am following a youtube tutorial,
It is helping me write the Java code.
I am wondering I could to publish it to the website itch.io legally.
The game would be free.
Thankyou.

sentences:
Elastic Collisions in Unity 2D I am trying to create elastic collisions in 2d game in unity. I have a ball surrounded with a polygon collider and im calculating the reflected vector using the ball velocity and the normal at the contact point. The whole thing works find but I have a slight issue where the ball gets stuck when sometimes.As you can see below the ball does bounce but later on it comes to a stop

Here are some details on the implementation.

The ball is a circle collider and ive drawn the object using a line renderer and ive added a polygon collider to it by using the width of the line. The polygon collider consists of about 130 points.

The ball has its collision detection mode set to continuous but using discreet mode doesn't work either.

The speed of the ball is not the problem because I face the same issue even if I move the ball at lower speeds. I'm using Vector3.AddForce to move the ball. The force mode is ForceMode.Impulse.

Any help will bee greatly appreciated. Thank you for your time.

Below you can find the code.

    void Start()
    {
    rb = Transfrom.GetComponent<RigidBody2D>();
    velocity = rb.velocity;
    }

        private void OnCollisionEnter2D(Collision2D collision)
    {
        if (collision.gameObject.tag == "Wall")
        {

            float speed = velocity.magnitude;
            Vector3 direction = Vector3.Reflect(velocity.normalized, collision.contacts[0].normal);
            rb.velocity = direction * speed;
        }
    }

    void Update()
    {
    velocity = rb.velocity;
    }

sentences:
Clamp UVs checkbox disappeared? I've run into the following problem. I'm following some tutorials for shading to the exact letter.
It all works except my meshes have really bad shadowing in/on them.

I see the difference with the tutorial: the Clamp UVs checkbox in the SceneTexture nodes has disappeared from the material editor GUI.. How should I replace this function? I already have some clamps in my blueprint but they are also part of the tutorial so they aren't there to replace the checkbox that disappeared under "Scene Texture Id".

Many thanks!

sentences:
interpolating frames in a vertex shader My models are stored as a set of meshes, each with a vertex list and normal list per key-frame, and indices for GL_TRIANGLES which is shared for all frames.  Each frame I lerp between two adjacent key-frames to generate the vertices for that frame on the CPU and then draw it.

How can I move this into a GLSL vertex shader?  Can a shader interpolate between two sets of vertices, and how can I store those vertices on the GPU?

sentences:
How do I add a "pointer" to my UI menu? I'm sure there has to be a simple answer to this, but frankly I cannot find anything about it anywhere on the internet, so I'm asking here. How do I add a pointer like this hand to the side of the currently selected UI button in my game?

I tried using Unity's built in UI system to do this, using the "sprite swap" feature that changes sprites based on whether or not the button is currently selected. I made an image for my "Play" button, and then an image for when the play button was selected that included a pointer as part of the image, but the image would either resize when the button was selected, or the image was moved to the right to accommodate Unity's centering mechanic on the UI. Perhaps this wasn't so wrong, and I'm just not using the UI system correctly.

Does a feature like this have to be hard coded into the UI design?

sentences:
Point plotting with a line graph Please see attached screenshot.

Here's how it works.

A is a slider that goes up and down, and the red line uses the centre point of the A slider to draw its start point.

B is another slider, but this goes left and right (stops in the middle as shown below).

The current issue is, the red line should always rest on top of B like a see-saw. Currently the line's end point has a fixed x position so it is always in line with the green crosses below to the right. But I need to position the end Y point of the line correctly so that the line as a whole is resting on top of B at all times. Whether the user slides A or B.

My guess is I need to work out some form of distance calculation with angles. I have something along the lines of:

Called 60fps:

this.startPoint.x = this.verticalSliderModel.xPos;
this.startPoint.y = this.verticalSliderModel.yPos;
this.endPoint.x = 653;
this.endPoint.y = this.horizontalSliderModel.yPos;

var angle = Phaser.Math.angleBetween(this.startPoint.x, this.startPoint.y, this.endPoint.x, this.endPoint.y);

this.seeSawController.updateModel(this.startPoint, this.endPoint, angle, width);
this.seeSawController.updateView();

I then use html canvas to draw the line:

update(start:Point, end:Point, angle:number, width:number) {

    this.bmd.clear();
    this.bmd.ctx.beginPath();
    this.bmd.ctx.moveTo(start.x, start.y);
    this.bmd.ctx.lineTo(end.x, end.y);
    this.bmd.ctx.lineWidth = 4;
    this.bmd.ctx.stroke();
    this.bmd.ctx.closePath();
    this.bmd.render();
}

So yeah I want to calculate the green cross plot points moving forward.

sentences:
Should fields in components in an ECS use polymorphism? I've just started to try and learn how to use ECS (Entity component systems), but I'm having trouble understanding the concepts behind components.

Should adding more types of components, or trying to make a component reusable through its fields be favored? For example, if I'm trying to give all entities a shape for collision detection, should I have a different component for every shape (RectangleComponent, CircleComponent, PolygonComponent), or should I have one ShapeComponent, and in there have a field which is of type Shape, with class Shape having subclasses Rectangle, Circle, and Polygon.

I'm unsure because using a Shape seems to be much more flexible and easier to implement systems, but it also feels like I'm violating the ECS rule of not having any functionality in components.

sentences:
How to make a background fill the screen on different-resolution phones? I am developing my first Android OpenGL game. It's a 2D game and I would like the background to always fill the screen. I've managed to achieve this by stretching the texture to fit the size of the screen based on the aspect ratio, but the texture becomes quite pixelated when stretched.

What is the correct way to achieve this?

sentences:
Digital Speedometer wrong update - Unity Hi I am making a digital speedometer and I want it to change like a normal meter like: if speed is 10 on meter and the new speed is 50 it does not just show 50 on text instead gradually increase it.

here is what I have done:

    int speed;
    int textSpeed;
    int speedfinal;

    public Text text;

    // Update is called once per frame
    void Update()
    {
        speed = GameObject.Find("gamePlayManager").GetComponent<gamePlayManagerScript>().userSpeed;
        textSpeed = int.Parse(text.text);

        speedfinal = (int)Mathf.Lerp(textSpeed, speed, 0.1f);

        text.text = speedfinal.ToString();
    }

I am not sure if lerp is a good choice here to change text but that is what I know but it is adding 9 less then the orignal speed. Any idea how to do this. thanks.

sentences:
How to override the NetworkManager in Unet properly? I need some customization on the NetworkManager Class for my game I'm working on. I've read, that it's pretty common to override stuff from the NetworkManager. So I've implemented the NetworkManager as CustomNetworkManager class like this :

using UnityEngine.Networking;

public class CustomNetworkManager : NetworkManager
{

}

I hope I'm right, that I don't have to implement a method to get all the functionality from the base class?

I duplicated my NetworkManager Object, which basically was just the NetworkManager with another CustomNetworking Script. Then I replaced the old NetworkManager with my new CustomNetworkManager and changed the references in the other script accordingly.

So my old GameObject looks like this :

And this is my new GameObject :

The old GameObject works (I just have to change the NetworkManager type in my CustomNetworking class)

But the new GameObject with the custom implementation is getting the following error :

NullReferenceException: Object reference not set to an instance of an object
CustomNetworking.EnableMatchmaker () (at Assets/CustomNetworking.cs:27)

The CustomNetworking class with the error looks like this :

using System.Collections;
using System.Collections.Generic;
using UnityEngine;
using UnityEngine.Networking;
using UnityEngine.Networking.Match;
using UnityEngine.Networking.Types;

public class CustomNetworking : MonoBehaviour
{
    public CustomNetworkManager manager;
    public MatchInfo currentMatch;

    // Use this for initialization
    void Start()
    {
        manager = GetComponent<CustomNetworkManager>();
    }

    public void EnableMatchmaker()
    {
        manager.StartMatchMaker(); //This is the first call which is made and where the error occurs
    }

    public void CreateMatchmakerMatch()
    {
        manager.StartMatchMaker();
        manager.matchMaker.CreateMatch(
            manager.matchName,
            manager.matchSize,
            true, "", "", "", 0, 0,
            manager.OnMatchCreate);

    }

    public void FindMatchmakerMatch()
    {
        manager.matchMaker.ListMatches(0, 20, "", false, 0, 0, manager.OnMatchList);

        if (manager.matches != null)
        {
            for (int i = 0; i < manager.matches.Count; i++)
            {
                var match = manager.matches[i];
                manager.matchName = match.name;
                manager.matchMaker.JoinMatch(match.networkId, "", "", "", 0, 0, manager.OnMatchJoined);
            }
        }
    }

    public void DestroyMatchmakerMatch()
    {
        manager.client.Disconnect();
        manager.matchMaker.DropConnection(manager.matchInfo.networkId, manager.matchInfo.nodeId, 0, manager.OnDropConnection);
        manager.matchMaker.DestroyMatch(manager.matchInfo.networkId, 0, manager.OnDestroyMatch);
        manager.StopMatchMaker();
    }

    public void StartMatchmakerMatch()
    {
        //manager.StartClient()
      manager.ServerChangeScene("MainScene");
    }
}

I think I did some failure with implementing the overwritten NetworkManager, hopefully someone can help me with this issue.

sentences:
First person camera: problem I have created a simple camera class, moved it from my C# (XNA) source to C++ for d3d.

Commonly it is okay, but something is wrong with rotation.
If i increase its pitch/yaw values, according to received player's mouse delta (cursor move), it rotates incorrect. It rotates 'around' 'world center', not position. 'world center' is changed if i change camera position.

After i move mouse left, camera is rotated like around 0;0;0 instead of own position.

XMVECTOR m_vecPosition; // x,y,z camera pos
float m_fYaw, m_fPitch;// rotation

view matrix update function:

#define VectorForward       XMVectorSet(0,0,1,0)

XMMATRIX mtxRot = XMMatrixRotationRollPitchYaw(m_fPitch, m_fYaw, 0);
XMVECTOR vecPos = XMVector3Transform(m_vecPosition, mtxRot);
XMVECTOR vecLookAt = XMVector3Transform(VectorForward, mtxRot);//'forward' transformed
vecLookAt += vecPos;
XMVECTOR vecUp = XMVector3Transform(VectorUp, mtxRot);
m_mtxView = XMMatrixLookAtLH(vecPos, vecLookAt, vecUp);

In XNA project my camera worked fine, like in FPS games, but it is impossible to move it to C++, this code definitely not correct.

And another question about camera if some one could help me:) Do i need to limit(lock) picth,yaw abs to PI*2 ? Or i what i need to do with always increasing yaw, for example ?

My camera rotates around 0;0;0, not around its position. Rotation camera makes always its look-at in center of the world. If i move camera position, i can offset its 'relative world center'. I need to make my camera properly first person, or properly third person..

sentences:
Render imgui on top of existing Java framework I have never done this before, but we need to build game editor, on top of our existing java game SDK.

We want to use java version of imgui. I can easily create imgui window and put UI into it, but how can I also put there our game?

Or run our game and render imgui on top of it?
Basically have scene view like in UI / Unity, but editor and windows on top.

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 "smoothen" my path-finding on a map with big tiles? I've just implemented A* in my "game", but as I finished it this came to my mind:

This is fine for a turn based game, but it would be really annoying for a real-time one.

For example look at the picture below.

In an action rpg the character would move to its goal in a straight line, but this is impossible here because the tiles are too big to make a that straight line.

So my question is:

How do they solve this in action games?
(I don't think that they have miniature tiles because that's too inefficient. But maybe I'm wrong.)

Edit:

Or should I remove those tiles from path, which aren't necessary?

So there will be a only a few points left, which are connected by straight lines?

Like this: go through the path from the Start.

When I find a X. tile which can't be accessed with a straight line from start:
Remove every tile from the path between Start and (X - 1). tile.
Repeat this from the X. tile, till I find the End.
Interpolate through straight lines between the remaining points.

sentences: When to apply AA as post? I'm working with a deferred shading technique. I have diffuse, normal and depth buffers, which I combine for the final scene composition. Where and when exactly do I apply an anti-aliasing pass (such as FXAA)? Just on the color buffer before lighting or any processing? Or as a separate pass on the final scene? Or something in-between?

sentences:
How would joints work in an impulse-based physics engine? I want to learn about physics engines, especially impulse-based ones. So I've followed along this tutorial to create some simple rigid-body physics:
http://gamedevelopment.tutsplus.com/tutorials/how-to-create-a-custom-2d-physics-engine-the-basics-and-impulse-resolution--gamedev-6331

I've got this working and it seems pretty solid to me. So I wanted to add revolute (fixed) joints. I've started off with a simple structure:

struct Joint
{
    RigidBody* A;       // One body
    Vec2 AnchorPointA;  // A's anchor point's offset (0,0 if center)
    RigidBody* B;       // The other body
    Vec2 AnchorPointB;  // B's anchor point's offset (0,0 if center)
};

I'm guessing this would do the job. Now... I'm not too good with physics (hence I started to code this) so I started out what I thought would work:

RigidBody* A = joint->A;
RigidBody* B = joint->B;

// Rotate the anchor points based on the body's rotation
Vec2 ancha = A->BodyShape->Transform * joint->AnchorPointA;
Vec2 anchb = B->BodyShape->Transform * joint->AnchorPointB;

// The relative positions of the 2 points
Vec2 relativeVel = (B->Position + B->Velocity + anchb) - (A->Position + A->Velocity + ancha);

// Apply a force towards eachother, pulling at the anchor points
B->ApplyImpulse(-relativeVel, anchb);
A->ApplyImpulse(relativeVel, ancha);

This approach simply pulls the bodies together. And it works... Kind of. After the bodies slide together as the joints are set up, it looks ok, but when the bodies fall they tend to spin away from eachother or start to freak out (keep rotating).
After messing around with the code (which was getting worse and worse as I was changing it) I've tried to look up solutions on the internet or at least some hints. I've found this:
How can I implement revolute (hinge) joints in a 2d physics system?

But this approach does not apply impulses, it fixes position. Wouldn't be an impulse-based system better? How can I fix it? I don't even know how big forces should I apply (I guess it should be based of the distance or something like that and also for the masses of the bodies). Thanks for any help!

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:
Why the update function only call once I asked about this question How to efficiently implement a 7-segment display? in previous post. Now I just add an update function to the last part of the code to display the time(I don't bother the exact time at the moment just want to make sure the number change regularly). However,I'm not sure why the update only run once, I checked the answer in this website, mentioned the root cause is gameobject deactivated(Update function only running once) but this is not my case. I tried with void OnMouseDown(){Display(DateTime.Now.Second)}, the number does change according to my mouse button so I'm not sure what wrong with Update function. In addition, I assigned all the variable but it still pop out message unassigned reference exception, not sure where the problem.
using System;
using UnityEngine;

public class ClockDigit : MonoBehaviour
{
//  Assuming you number your segments as follows:
//   -- 0 --
//  |       |
//  5       1
//  |       |
//   -- 6 --
//  |       |
//  4       2
//  |       |
//   -- 3 --
// Store a lookup table for which segments
// should be active when displaying each digit.
static readonly bool[,] SEGMENT_IS_ACTIVE = new bool[,] {

    {true,  true,  true,  true,  true,  true,  false}, // 0
    {false, true,  true,  false, false, false, false}, // 1
    {true,  true,  false, true,  true,  false, true }, // 2
    {true,  true,  true,  true,  false, false, true }, // 3
    {false, true,  true,  false, false, true,  true }, // 4
    {true,  false, true,  true,  false, true,  true }, // 5
    {true,  false, true,  true,  true,  true,  true }, // 6
    {true,  true,  true,  false, false, false, false}, // 7
    {true,  true,  true,  true,  true,  true,  true }, // 8
    {true,  true,  true,  true,  false, true,  true }  // 9
};

public Color32 activeColour = Color.red;
public Color32 inactiveColour = Color.black;
public SpriteRenderer[] segments = new SpriteRenderer[7];

public void Display(int number)
{
    var digit = number % 10;
    if (digit < 0) digit *= -1;
    for (int i = 0; i < 7; i++)
    {
        if (SEGMENT_IS_ACTIVE[digit, i])
        {
            segments[i].color = activeColour;
        }
        else
        {
            segments[i].color = inactiveColour;
        }
    }
}

public void Update()
{
    Display(DateTime.Now.Second);

}
}

I tried this command also, the infinite loop freeze the Unity and FixedUpdate() command also update the frame only one time.
void Update()
    {while(true)
      Display(DateTime.Now.Second);
    }

sentences:
Game Maker Studio 2: Why is my variable not being properly changed? Ok, so in my game you have a party of four characters that you control one at a time, each of which can lose health and die independently of each other. All of the player character objects use essentially the exact same code controlling their "deaths", (just with their own object variables and flags that get set and triggered etc.), but for whatever reason identical code does not produce identical results for all of the characters.

In particular, one of the character classes, the Alchemist, absolutely refuses to either set their "dead" flag to True properly, or at the very least the sections of code that are dependent upon "dead" being true do not appear to be acknowledging that it is. I've gone over all its events several times and monitored its behaviors in-game very closely, and everything about its malfunctioning behavior can be traced to the fact that it's completely ignoring the "dead = true;" line in one of its events while still executing the remaining code that follows it. Absolutely nothing else in any of its events sets or modifies this variable outside of its initialization in the Create event; it's just this one line of code that works perfectly for every other character object refuses to do its one job for this object in particular, and everything is falling apart because of it.

Does anyone know why this might be happening? Is there some quirk of proper GML practice that I'm not using?

If it helps, here's the code that gets triggered when a character is made "dead"

else if(wounded and position == 0 and !dead)
{
    dead = true;
    instance_create_layer(x,y,layer,obj_alchemist_corpse);
    death_sort();
}

Everything else is just a series of If statements that are triggered by 'dead' being true, but again, it would appear that one object in particular is executing the code in the above statement without actually setting 'dead' to true, and I would like to know why or why not.

EDIT: Forget what I said about an alchemist; further testing indicates it's just the second character in your party line of four that isn't getting their flag properly set.

sentences:
How to isolate a child object from parent's movement? (Unity) I currently have a very basic scene that includes a platform (ground), a capsule (player), and a camera rotator (main camera is mounted on it). The object hierarchy is the following.

This hierarchy reflects the objective of having a main camera that rotates about the player when correct command is entered.

A problem arises when the player moves. In this case, the capsule rotates about its vertical axis which causes the main camera to rotate because the camera rotator is mounted on the player. How could I isolate the camera rotator so that it remains mounted while ignoring the capsule's rotation. Thanks for considering my question.

sentences:
How does a game like Minecraft generate new chunks in realtime? I imagine looping through all 65,536 blocks with a noise function to set their type would be very slow. And Minecraft usually generates a ton of chunks at once. I read in one source online that Minecraft creates a column of 16x16x16 chunks, although I can't find any more information on that subject, and that doesn't really change how many blocks there are in one chunk "column". I assume there are optimizations made to make it work, although I can't find much about this subject online.

Edit: The way I am generating chunks in my own (2D) game is by looping through a 16x16 array using a Perlin Noise function for every chunk. With 16x16 chunks it runs fine in realtime. I want the chunks to be 3600 tiles high, and changing the size to be 16x3600 runs very slowly.

sentences:
How do I add collision between two player controlled turtles How do I add collision between two player controlled turtles. I asked the question before but misunderstood my own groundings on the plan. I cannot figure out how to make two player controlled turtles in the game to hit each other and end the game. This is what I have so far:
import turtle
import pygame
import math
import string

wn = turtle.Screen()
wn.bgcolor("black")

Write Tron

text=turtle.Pen()
text.pencolor("aqua")
text.hideturtle()
text.penup()
text.setposition(150, 300)
text.write("TRON", font=("system", 30))

Draw border

mypen = turtle.Turtle()
mypen.penup()
mypen.pencolor('white')
mypen.setposition(-300,-300)
mypen.pendown()
mypen.pensize(3)
for side in range (4):
    mypen.forward(600)
    mypen.left(90)
mypen.hideturtle()

pygame.display.update

Create player 1

player = turtle.Turtle()
player.setposition(240,240)
player.setheading(180)
player.color("red")
player.shape("triangle")

player.speed(0)

Create player 2

player2 = turtle.Turtle()
player2.setposition(-240,-240)
player2.color("aqua")
player2.shape("triangle")
player2.position()
player2.speed(0)

Set speed variable

speed = 3

Define functions

def turnleft():
    player.left(30)

def turnright():
    player.right(30)

def increasespeed():
    global speed
    speed += 3

Set keyboard bindings for p1ayer 1

turtle.listen()
turtle.onkey(turnleft,"Left")
turtle.onkey(turnright,"Right")

Define player 2 functions

def turnleft():
    player2.left(30)

def turnright():
    player2.right(30)

def increasespeed():
    global speed
    speed += 3

Set keyboard bindings for player 2

turtle.listen()
turtle.onkey(turnleft,"a")
turtle.onkey(turnright,"d")
turtle.onkey(turnleft,"A")
turtle.onkey(turnright,"D")

turtle.onkey(increasespeed,"Up")

while True:
    player.forward(speed)
    player2.forward(speed)

#Bouandary
if player.xcor() > 300 or player.xcor() < -300:
    print("GAME OVER")
    quit()
#Boundary
if player.ycor() > 300 or player.ycor() < -300:
    print("GAME OVER")
    quit()
#Bouandary2
if player2.xcor() > 300 or player2.xcor() < -300:
    print("GAME OVER")
    quit()
#Boundary2
if player2.ycor() > 300 or player2.ycor() < -300:
    print("GAME OVER")
    quit()

#Collision

while True:
  if player.setposition(player.ycor()+10, player.xcor()+10) and player2.setposition(player2.xcor()+10, player2.ycor()+10):
      quit

sentences:
MonoGame, sprite to rectangle I'm working with MonoGame in VB2015 - please don't give answers that involve using C#.

Anyway, I found a snippet which I converted to VB for pixel collision. The function below accepts two rectangles, then runs a pixel check on the intersection between the two.

What I can't work out is how to send my two sprites (textures) to the function as rectangles. Or if anyone has a alternative, please let me know.

  Private Shared Function IntersectPixels(rectangleA As Rectangle, dataA As Color(), rectangleB As Rectangle, dataB As Color()) As Boolean
    ' Find the bounds of the rectangle intersection
    Dim top As Integer = Math.Max(rectangleA.Top, rectangleB.Top)
    Dim bottom As Integer = Math.Min(rectangleA.Bottom, rectangleB.Bottom)
    Dim left As Integer = Math.Max(rectangleA.Left, rectangleB.Left)
    Dim right As Integer = Math.Min(rectangleA.Right, rectangleB.Right)

(No, this isn't the whole routine...)

sentences:
Making quick time events in my text adventure more noticable I'm making a post-apocalyptic text adventure in Unity. One of the gameplay features I've added is a quick time events on certain parts. Whether a part is a quick time event is defined inside the story json data like this:

  "PartName": {
    "text": "",
    "choices": {
    },
    "timer": { // if this key exists, the timer event will be triggered..
      "time": "10",
      "nextPart": "" //what part it goes to when the timer ends.
    },
    "background": "" //background of part
  },

When the timer runs out, you'll be forced into a part where the player dies or a unfavorable decision is made that will effect you later on in the game.

Here's a screenshot of a part that contains a quick time event:

Notice anything? The timer is the circle(radial timer) in the right hand corner. My main problem is trying to make sure players know there's a quick time event happening. These will be rare occurrences since I don't want to over-do them(ex: a quick time event every couple of parts) so I feel like the average player will not know that there's a quick time event.

One way I've thought of addressing this issue is by stating what a quick time event looks like in the how-to-play section of my menu, but since that's "locked" away by a button (you have to click a button to get to the section), people may just skip it entirely since text adventures aren't really known for the most complex controls in gaming.

Other ways I've thought of addressing it:

Music cues

pros: I have complete control over what music I can put there
cons: Since some parts have a defined background music, it might not be noticed by the player

Background tints (changing color of background)

pros: Easily noticeable change and will be unique only to timed parts.
cons: Might look ugly or players may not notice the significance of why the background suddenly changed color

Large timer in the middle of the screen

pros: Easily noticeable and players will notice it's a timer
cons: May be obscured by a text and or look ugly.

So I need help either deciding which the best course of action will be to address the issue from the list above over

sentences:
How to manage different speed of actions in RogueLike games? How to manage different speed of actions in RogueLike games?

What I mean is that turn based games may have actors acting at different "speed", depending on the action and some other characteristics. The actors then effectively do more actions/turns than others if they have greater speed, or not.

How to determine when an actor should be able to act (turn scheduling?)?

It looks like there is different ways to do it?
Can you explain some with algorithms?

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:
Why does Mathf.Log(x) return infinity in this case? I'm facing an unexpected behavior due to computational limits, I guess.

I have a function Log(x) which, for some high value in the Fibonacci series n 187 = 5.38·10^38 returns Infinity.

Is there a way I could follow to avoid this and always have computed numbers?

sentences:
How do I detect collisions between a point and a sloped line? The character in my game constantly falls due to gravity, so i have to detect the collision between the bottom point of the character and the tile slope line on the same x coordinate.

The character must stop just on the slope floor. for that i also need to define where is the slope by storing x, y of both ends of the slope.

In the image bellow, you see a 32x32 tile map, origin of each image is top left.

playerPointX = 420;
leftSlopeX = 13*tileSize;
leftSlopeY = 11*tileSize;
rightSlopeX = leftSlopeX+tileSize;
rightSlopeY = leftSlopeY+tileSize;

so regarding the awnser i should write this ?

float run = playerPointX - leftSlopeX;
float rise = 1 * run;
float collisionHeight = leftSlopeY + rise;

and how i can detect the collision against collisionHeight ?

if (playerX<collisionHeight) // collision detected

or

if (playerY>collisionHeight) // collision detected

Finally when the collision will be detected should i use y=mx+b for playerY displacement ?

sentences:
Existing game to virtual reality game? What kind of existing game can be taken as a good source for a 'virtual reality' game, specifically, the one you can play with any 3D VR glasses?

Why do you think this particular game or these games can be adjusted well in the new realm?

Thank you for your thoughts.

sentences:
How to create a path-finding compatible road map from user input? I'm currently working on an agent simulation (inspired by the recent SimCity release). Now, basically I understood how agents work but I do not understand how to put them into context. Agents travel along roads on a map and pursue their own goals.

As in SimCity, I want the player to be able to create his own roads. If I used grids, I would run into a problem caused by user input: Imperfect grids will be created where two roads would need to share one "box". This would be even worse with bevels.

(Grey = Street, Orange = Agent road, Dots = Immobile Agents)

Is there another, more clever way of building a road map that would support this kind of map and is compatible with path-finding?

Thanks a lot!

Paul

sentences:
Raycast not hitting a collider I have the following simple raycast from a capsule on a cube:

bool hit = Physics.Raycast
(transform.position, Vector3.down,
jumpSettings.groundJumpDistanceCheck,
jumpSettings.layerMask);

print(hit);

When my layerMask is 8 (terrain), I have set my layer on my cube and my groundJumpDistanceCheck is 2. Then my hit is false.

When my groundJumpDistanceCheck is set to Infinity. Then my hit is still false.

However when I remove the distance parameter:

bool hit = Physics.Raycast
(transform.position, Vector3.down,
/* jumpSettings.groundJumpDistanceCheck, */
jumpSettings.layerMask);

print(hit);

Then hit returns true. This is odd for me, as far as I know when you exclude the distance parameter it's supposed to be Infinity by default. But when I explicitly give Infinity as the distance, it returns false.

I have also used the following code in an attempt to debug my issue, using the desired distance 2f

Debug.DrawRay(transform.position,
Vector3.down * jumpSettings.groundJumpDistanceCheck, Color.red, 60f);

As you can see, the ray does intercept the cube.

I need the reycast to return true with a distance of 2f.

sentences:
Java .dae file loader problem I am making a COLLADA parser in Java, and I have made a loader that reads a .dae file, and saves it's content in a string. But, when I load a specific file, it doesn't get read correctly. Specifically a line of 3s between two  nodes is getting read wrong. Instead of reading in 3s the program reads in spaces. How do I know it is a line of 3s? Well, when I open the file with Notepad++ or Sublime Text 2 it opens fine, but when I open it from Eclpise's Text Editor or load it from my program it reads it wrong. Any reasons why that happens and how to can fix it?

This is my code for loading the file:

BufferedReader reader = new  BufferedReader(new FileReader("src/MAIN/ScondTest.dae"));
StringBuilder builder = new StringBuilder();
String line = reader.readLine();//Ignore the first line: <?xml...
while((line = reader.readLine()) != null) builder.append(line).append(" ");
line = builder.toString().trim().replaceAll("   ", "").replaceAll("  ", "");

This is a link to my file (the line of 3s is at line 228):

https://drive.google.com/open?id=0B_QCd3U4JeWLbmYwSnlzY2ttdEE

This is a small part of the line of 3s(to big to put it all): 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3

sentences:
Unity - how to switch between ratios in a Scene View? I'm complately new to Unity, but I know what's going on, I've made some games with LibGDX earlier.

In GDX, to handle all resolutions perfectly I always create 5 different sets of backgrounds (cause they have to be perfectly sized) and I place UI widgets on percentage for each ratio independantly (hardcoded values). I was just checking what's the ratio on runtime.

As we know, there are only 5 possible aspect ratios for mobile devices (I target mobile only).

Now, when I started using Unity, the first thing I looked up was how devs handle ratios. I found some scripts in the web, which add pillarboxes which in my case is unacceptable.

So I thought - ok, let's do it my way, and make it for all aspect ratios.

And my question is:

Is there any option in Unity, which will allow me to 'switch' in the Unity Editor between ratios and the 'Scene View' will understand this and resize?

What I want to do is to create a 16:9 with the editor, then switch to 5:3, adjust elements for it, and remaining ratios too.

To be clear, I don't mean the 'preview', when you check the desired device and it shows how the game will look like.

Any help and tips are appreciated! :)

sentences:
Does Java support OpenGL by itself? Note: This is long but I explaining everything that you need to know. Don't read half way through it and say "What's the question?". It's simple but long and I need help as soon as possible.

So I asked a question not long ago that was similar but it wasn't my best work. What I'm trying to do is make a small jar with no other files but the jar (maybe natives if needed) that handles a window and graphics for games. I'm making this for some people I know who don't want to get into advanced graphics and stuff to make games, plus I figure it would be easier to stick everything they need into one jar that they know how to use. Anyway I found JOGL but after like the past 3 hours or so all I got with JOGL was the memory to never use it because it's a pain to install (at least for me) and everyone says a different way to install it and I need like 100 files along with my jar to get it to work. So since I'm not dealing with JOGL i figured that it's best to try and find something else. So does anyway know any way to get OpenGL into java without libraries that add more files and if so just like 1 file? I'm trying to get it so it's just that jar and nothing else. I just want this done but I'm very confused. I would also like it to be able to run on Windows, Linux and Mac. I only have a Windows machine although I can get Linux to test it on and I know someone who has a Mac but keep in mind I'm building it on a Windows machine. So my question really is how would I be able to stick OpenGL (I would like OpenAL and maybe OpenCL too) in a single jar and nothing else? I have a few exceptions such as I'm kinda ok if I need a few natives but I don't want 10 jars and 50 natives and I need it to work on all kind of machines, and also I would like to be able to use swing to handle the window.

sentences:
Split tile based map file into multiple files I have a gigantic map file (1440x1080) that I wish to split into smaller files (45x45) for faster client reading.  I plan to split offline (when running DEV server) so I am not too worried about speed.  Picture the below as my source file:

5, 5, 5, 4, 5, 6, 5... 5
...
5, 6, 2, 44, 5, 66, 5... 5

I am getting the file to be slightly off towards the end - having trouble doing the math I suppose.  I am totally open to changing the code, but here is what I had so far:

int filesAcross = mapWidth / 45;
int acrossCount = 0;
int filesDown = mapHeight / 45;
int downCount = 0;
int totalFileCount = filesAcross * filesDown;

//create a bunch of stringbuilder holders to split the large file into
StringBuilder[] sbGroundLayerHolders = new StringBuilder[totalFileCount];
for (int kk = 0; kk < totalFileCount; kk++) {
    sbGroundLayerHolders[kk] = new StringBuilder();
}

int countt = 0;
while(scanner.hasNext()){
    int fileCounter = (acrossCount / 45) + ((downCount / 45) * filesAcross);
    //  LOGGER.info("fileCounter: " + fileCounter + "   acrossCount: " + acrossCount +
    //"   downCount: " + downCount + "   countt: " + countt);
    try {
        sbGroundLayerHolders[fileCounter].append(scanner.nextShort());
        sbGroundLayerHolders[fileCounter].append(",");
        acrossCount++;

        countt++;
    } catch (InputMismatchException e){
        scanner.nextLine();
        downCount++;
        acrossCount = 0;

        countt++;
    } catch (ArrayIndexOutOfBoundsException e){
        LOGGER.fatal("Array Out of Bounds on ground Layer - count:" + countt, e);
        System.exit(1);
    }
}

//write array contents into files
for (int kk = 0; kk < totalFileCount; kk++) {
    String s = sbGroundLayerHolders[kk].toString();
    s = s.substring(0, s.length() - 1);
    String[] sSplit = s.split(",");

    StringBuilder q = new StringBuilder();
    for (int jj = 0; jj < sSplit.length; jj++) {
        q.append(sSplit[jj]);

        if (((jj+1) % 45) == 0 && jj != 0) {
            q.append(System.lineSeparator());
        } else {
            q.append(",");
        }
    }

    LOGGER.info("map string(" + kk + "): " + q);
    //createFileLocally(folderPath, filename, text);
}

Here is a sample image of what I want to do (smaller scale).  Start with the big grid 6x6 and split into files 2x2.

sentences:
Show Sprites on Overlap (Shader Graph) [2D] I have a character sprite mesh and mesh renderer (The black wavy box). I am hoping to be able to overlay the black box onto the character covering the sprites but I am not sure how to do that.

I looked at this question : Unity: How do I only show parts of objects that overlap [2D]

But this works more as a cover that you can see through. I am hoping to have the variable black mask the sprites of the character but I cant seem to layer these correctly. Is there a way to do this using the LWRP and shader graph?

The over arching idea is to use this as a damage marker. Moving the black box up or down depending on the health lost.

sentences:
Rotate & Translate a MatrixTRS Hello I have a question about translation & rotation of a MatrixTRS...
So basicly I have a given MatrixTRS A in space, define by a positionA, rotationA and scaleA.
(DISCLAIMER: I am using Unity, but I do not use Transform, therefore I have a Matrix4x4, created like that:
Matrix4x4 A = Matrix4x4.TRS(position, rotation, scale);
Ok, Now I have a Point in space, with a given rotation, named PositionB, and RotationB.
I would like to translate & Rotate my TRS matrix to that positionB, and rotationB.
I know I have to do something like b.transform.TransformPoint() and Quaternion.Inverse(b.transform.rotation)*a.transform.rotation, but i didn't manage to make it right yet.
Thanks!

sentences:
How can I store in-game money so that nobody can manipulate the amount? People get coins for completed tasks(for example completing a level) in my game. In addition, they can purchase coins(they need to pay for that with real money) in the app store. With these coins, people can purchase different items in the game.

Is it easy for somebody to manipulate the amount of coins when I store it as an integer variable in a text file on the device(iOS and Android phones and tablets)?

What is the best way in MonoGame/Xamarin to store the amount of coins so that nobody can manipulate it afterwards?

sentences: How do I get the number of online players in a Minecraft server from outside the client? I know that the Minecraft client can query the server for number of players and maximum players, even when the server properties has enable-query set to false, but how do I do this outside of the client? I am trying to implement this as part of a mobile (Android) app.

sentences:
How to resize an image loaded using ContentManager in XNA I am new to XNA programming and I loaded the background image using ContentManager as a Texture2D object.

The background image which I have is of size 480*320. I have kept the minimum game window size as 640*480. My question is how would i resize the background image to the size of the game window.

Thanks in advance!

sentences:
Apply a grain effect to all the elements of a level I'm currently experimenting a little bit on level design. Let's say that I've a room composed of walls and a floor tiles. I'd like to apply to all these elements a sort of "grain" effect, similar to concrete.  I wonder which is the better way to go... the only think I can immagine is working with texture directly, so for each element create the texture that already contains the "grain" effect.

I've also tried to apply a generic screen shader but the result is not good because the grain is fixed to the screen, I wanted it to be fixed to walls/floor. Obviously creating all the textures is a long process and I have to keep UV absolutelly proportional for each element.

I'm ok with that solution actually but I wonder if there is anyother way to apply this effect all in once in a simpler and "safer" way, soemthing like a decal that maybe adds also some imperfections.

sentences:
Play two different audio sources depended on code behind How can I play two different audio clips in Unity depended on the code behind? Into my object I've added two audio sources namely 'Player GunShot' and 'outOfAmmo'.

Into the same object I've also added a C# script whit this code:

public currentBullets = 1;

private AudioSource gunAudio;
private AudioSource outOfAmmo;

void Awake()
{
    gunAudio = GetComponent<AudioSource>();
    outOfAmmo = GetComponent<AudioSource>();
}

void Update()
{
    if (currentBullets == 0)
    {
        outOfAmmo.Play();
    }
    else
    {
        gunAudio.Play();
    }
}

Can this code give any problems because in the Awake methode? I've not defined with audio source the variable must be. So which source go he take to play?

sentences:
Rent-a-Coder style site for artists My Google-fu is failing me: is there a site in the same vein as Rent a Coder, but for hiring artists?  In particular, I'm looking for a site which fits the following criteria:

Allows me to specify the style and scope of the work I'm looking for beforehand
Allows artists to "bid" on the project, including time and cost estimates
Showcases the work of the bidding artists so that I can see what kind of quality I can expect from each bidder
Is designed specifically for smaller, short-term projects or one-off graphics

It seems that the original incarnation of Rent a Coder is dead (the above seems to be some sort of knockoff), and that it was probably killed by an unsustainable market full of unrealistically low bids for large projects by unskilled and unqualified "coders."  That being the case, such a site might be poorly suited to art as well.

The reason I'd like such a site, though, is that as a "bedroom programmer" with a small budget and little experience in this sort of thing, I have no idea where I should be looking for art or how much I should reasonably expect to pay.  Thus, a site with good competition where market prices are somewhat transparent would be ideal.

Any other suggestions about how best to acquire custom artwork as an indie developer are also appreciated.

sentences:
Does "Personal Use" mean I can earn from it? I'm almost done with my personal game. One of the reasons I started this is because of monetization. I plan to monetize it using Google Admob. However, I need some icons - essential part of my game.

And these icons are free, released by a certain company, and they say in their download page:

  These icons are free for personal use or commercial testing purposes.
  Otherwise, you'll need a Premium or Enterprise license. :)

Question is, does "Personal Use" mean I can earn from it?

Also, this "personal game" is actually "under" a group named, say "XXX".
The group "XXX" is merely a group name, not a company, not legal/registered, just literally a group name on Github. And this group is composed of 3 people and that includes me. Does this kind of setup go under the "personal use"?

sentences:
XNA: Runtime differences in ClickOnce install versus development version I have a game written in XNA, and I use ClickOnce installers to distribute the game to testers.  I keep once computer as a test machine which does NOT have development environments installed, so that I can test the installed version.

We've found a reproducible bug in our game, but the bug ONLY occurs on the non-development machines that use the ClickOnce installer.

The bug is related to some of our code for moving around 3D objects and is not tied to Networking or GamerServices.

Are there known differences in the ClickOnce runtime and the version on dev?  Are there any best-practices for debugging something like this?

sentences:
GeForce FPS Counter is not displaying and G-SYNC is not working on games developed using Unity I have developed a small game for learning purpose and here is src of that, when I play the game GeForce FPS Counter is not displaying.

I thought there might be some kind of bug in my src. So, I installed two popular games developed using Unity.

"Life is Strange: Before the Storm" - FPS not displaying.
"INSIDE" - FPS displaying.

Can anyone tell me what is happening. And also I noticed that when playing "Life is Strange: Before the Storm" my CPU and GPU temperature goes hotter than playing "Rise of the Tomb Raider".

Note: I have played all the game in full screen mode and all settings to highest.

UPDATE:

Firewatch and INSIDE both shows FPS Counter. but,
when Enable G-SYNC for full screen mode is selected, G-SYNC is not working in all the games developed using Unity even when launched in full screen mode. But when I enable Enable G-SYNC for windowed and full screen mode then the G-SYNC is working. But when it comes to Life is Strange: Before the Storm is not showing FPS Counter but shows G-SYNC indicator on the screen.

Is Unity games not actually runs in Full Screen mode?

sentences:
How to do Colored Lights in CIE XYZ/LUV-like Space? I've a 2d background, some sprites, blitted onto it. And over all that in the final pass I draw colored lights, to make projectiles look cooler. Basically I apply a classic lightmap, which is colored in the process of blitting.

With RGB I used simple, but incorrect code:

//dr,dg,db - source before highlight
//e = light energy
//lr,lg,lb - color filter applied to the light energy
ResultColor = RGB(lighten(dr,e*lr),lighten(dg,e*lg),lighten(db,e*lb));

//light energy divisor (0x100*4*32)
#define EDIV 15
uint8_t lighten(int t, int e) {
  return clamp_byte(t + ((t*e)>>EDIV));
}

Now in CIE-style spaces, instead of RGB, we have luminance coordinate (L in LUV, or Y in XYZ), and two chroma coords, picking the chroma inside the color triangle.

Calculating light in CIE appears to be simple, it is just:

result_light = dst_light*incoming_light

But what about XZ or UV? I tried doing simple averaging:

result_x = 0.5*dx + 0.5*lx;
result_z = 0.5*dz + 0.5*lz;

but it gave too bland of a result, compared to the original RGB color-filter:

Maybe instead of taking 0.5, these weights should depend on the light component somehow? If so, what is the proper matrix? I'm sure it can exist, because the transform from CIE XYZ to RGB is linear.

sentences:
Accessibility in Games We're currently developing a 2D Platformer and we decided to take some time to implement Accessibility Features. But we couldn't find good information about Accessibility Features, muss less how to implenent them. With Accessibility Features we mean things like to reduce risk of seizure (Photosensitive Epilepsy). There will be a Accessibility Menu to manually activate these.

So does anybody have some Ideas what Features we could implement and some helpful tips about how to implement them?

sentences:
How can I modify the UV co-ordinates on a texture so they converge to a point? I'm building a roof visualiser app, where someone can take a picture of their roof, define its outline, then visualise a new roof texture on it.

I'm generating a 3D plane that matches the roof outline points, but I'd like the 3D planes material's UV's to match the perspective of the existing roof (i.e the lines converge into the distance as they move away from the user.

Is this possible?

The alternative solution is to figure out how to rotate the generated 3D plane to match the roof outline points, while matching the perspective too, but I'm thinking this may be more complicated.

Step 1 - Define roof oultine with points

Step 2 - Texture 3D plane with UV's mapped to maintain roof perspective based on slant defined in the 4 points

Any tips on how to solve this?

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 I generate coins in a pattern? In my game you collect coins (surprise!). At the moment I generate them like this:

Find a random position given a rectangle (eg. the screen size) and generate a coin
Possible positions are left and right of this coin for our next coin

If both are available, choose at random
If a coin exists in one position, use the other
If neither are available skip this step

Do the same for up and down positions of the new coin
Repeat this sequence for all available coins

This works fine but I would like to create custom shapes with my coins like arrows, stars etc. This got me thinking into how I could achieve this. One way I thought of was to use a small texture where each coloured pixel represented the position of a coin. So that a picture like this:

Can be used to generate an array of coin position coordinates in any framework supporting textures. I'm pretty sure this can be done, but was wondering if anyone has tried this or something totally different for generating coins or any other objects in a game. Ideally the game would involve several different textures and choose them at random, and combine this with the random scattering textures from simple algorithms such as the one I have above.

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:
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:
Unity Collider2D - Know the collider type ob the object collider with the other object I have my GameObject which represents a soldier in my game. It has the following colliders:

1st BoxCollider2D in child named "sword". Is Trigger checked. Tag = Sword. This collider is enable when player attacks and disabled otherwise.
2nd BoxCollider2D in parent GameObject. Is Trigger unchecked, since it's the body. Always enabled.

When the sword (1st) collider collides with the the body (2nd) collider, damage happens. Until now everything works fine. Here is the OnTriggerEnter2D function I have:

void OnTriggerEnter2D(Collider2D collision)
{
    if (collision is BoxCollider2D)
    {
        Debug.Log($"{this.name} collided with {collision.name}");

        if (collision == null || collision.tag == Constants.TAG_WEAPONS
            || collision.tag == Constants.TAG_SIGHT)
        {
            return;
        }

        if (collision.GetComponent<LivingObjects>().AreEnemies(this))
        {
            Debug.Log($"{this.name} attacked with {collision.name}");

            Attack(collision.GetComponent<LivingObjects>());
        }
        else
        {
            return;
        }
    }
}

Now I want my unit to search for enemies within a said range. I added a new collider:

3rd CircleCollider2D in child named "sight". Is Trigger checked. Tag = Sight. Always enabled.

Now, when the sight (3rd) collider collides with the body collider, damage is trigger into the unit colliding with the sight collider. That is because I block damage one way around with the condition if (collision is BoxCollider2D) but not the other collision happening at the same moment.

If i can discrimate collision from CircleCollider2D into BoxCollider2D, I can remove the attack function. However, I cannot see how to do it.
My question is how do I know what Collider2D type is my object colliding with the other ?

I'm open to other suggestion if this is impossible.

sentences:
SFML: Generate a background image I want to generate a background, which is used in the game, on every instance of the game based on certain conditions. To do so, I'm using a sf::RenderTexture and a sf::Texture like this:

sf::RenderTexture image;
std::vector<sf::Texture> textures;
sf::Texture texture;
// instantiating the vector of textures and the image not shown here
for (int i = 0; i < certainSize; ++i)
{
    if(certainContition)
    {
        texture.setTexture("file");
        texture.setPosition(pos1, pos2);
    } else
    {
        ...
    }
image.draw(texture);
}

The point here is that I draw single textures on a sf::RenderTexture, but because textures always are on the graphic cards memory, I can't exceed a certain map size which I have to.
I also considered using an sf::Image, but I can't find a way to draw an image (i.e. a texture) to it.
The third way I found was using an sf::VertexArray, but this seems to be a bit too low-level for my rather simple purposes.
So is there a common way to dynamically generate a background image based on other existing images?

sentences:
What are the networking possibilities with XNA and Xbox 360? I know that XNA for Xbox 360 has limited access to networking, rumored to only allow communication via a propitiatory Microsoft protocol to other Xbox 360 units.

What are the networking possibilities XNA offers? How many Xbox 360 units can be connected to the same subnet? 16 maximum? Can any Xbox send data to any other Xbox on the subnet like Peer-to-peer communication? Can an Xbox communicate with XNA on Windows PC's as well? Are there any other devices you can communicate with?

And what about game servers? Can you setup your own multiplayer game server and have Xbox's connect to it and communicate freely? What platform would you write the game server code in? C++ on Unix? How many Xbox units can connect to a server at a time? If you cannot setup your own game server are there unofficial 'hacks' that enable indie developers to develop and run a game server?

Since I'm no Xbox developer (ie. I don't own a $10000 devkit) I cannot use C++ libraries like Zoidcom.

sentences:
RayCast node always return null I'm using RayCast node to check the object is grounded. Here's the setting:

RayCast node is placed near by ground and the length enough to collide with ground. Also RayCast node is enabled.

RayCast node is child node of FPSController node, and here's the code of FPSController that processing grounded logic:

onready var ground_check_raycast: RayCast = $GroundCheckRayCast

func _physics_process(delta):
    process_grounded(delta)

func process_grounded(delta):
    var hit_collider = ground_check_raycast.get_collider()
    print(hit_collider)

When I run the game, first few times it return floor, and then immediately return false and never return floor back.

** Debug Process Started **
OpenGL ES 3.0 Renderer: GeForce GTX 1070/PCIe/SSE2
[StaticBody:1140]
[StaticBody:1140]
[StaticBody:1140]
[Object:null]
[Object:null]
[Object:null]
[Object:null]
...

I have no idea why this won't work. Is there a something that I missed?

P.S. Floor object has static body and CollisionShape.
P.P.S. Using Godot 3.1.1

sentences:
Organizing movement, collision detection, and collision resolution There's many articles on the internet focusing on how to implement movement, collision detection, or collision resolution. What I'm wondering is how to put them together, specifically in what order to perform them.

Should one iterate through all physics objects and do movement, collision detection and resolution for each (approach A), or perform movement for all objects, then detect all collisions, and finally resolve all collisions (approach B), or some combination thereof? Is there an approach that is universally superior? If not, what are the pros and cons for each approach (including ones I haven't listed)?

Approach A:

for (all objects)
    object.move
    object.detect_collisions
    object.resolve_collisions

Approach B:

for (all objects)
    object.move

for (all objects)
    object.detect_collisions

for (all objects)
    object.resolve_collisions

sentences:
Could the delta frame time be negative? I'm following a tutorial about the time management and, the tutorial shows this function:

double GetFrameTime()
{
    LARGE_INTEGER currentTime;
    __int64 tickCount;
    QueryPerformanceCounter(&currentTime);

    tickCount = currentTime.QuadPart-frameTimeOld;
    frameTimeOld = currentTime.QuadPart;

    if(tickCount < 0.0f)
        tickCount = 0.0f;

    return float(tickCount)/countsPerSecond;
}

The tutorial explains that, this function basically gets the time that one frame takes, but, I don't understand how the variable tickCount can be negative, if the currentTime is
increasing all the time (calling this function every frame, obviously), so, is that if really necessary?

sentences:
Find extreme points of a rotated ellipse function on a given axis How to find the points where it is most extreme on the X and Y axis?

For example lets say I have an equation that describes an ellipse that is rotated:

(x * RadiusX * Rx + y * RadiusX * Ux)^2 +
(x * RadiusY * Ry + y * RadiusY * Uy)^2 = RadiusY^2

How can I find the points where it will be most extreme on each axis

Please keep in mind the values for variables RadiusX, RadiusY, Rx, Ry, Ux, Uy are known.

An example with values:

((x * 1 * 0.70711) + (y * 1 * -0.70711))^2 +
((x * 1.414213 * -0.70711) + (y * 1.414213* -0.70711))^2 = 1.414213 * 1.414213

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:
Best pathfinding algorithm for a tower-defense game? What do you suggest would be the best algorithm for a tower-defense game? It's a 2D based tile game, where there is walls and towers blocking the way, between spawnpoints and their destination points.

Constantly, as the player places a new tower to block the way, or to help shoot spawning units before they reach their destination, a new path for the affected spawnpoint's path will have to be recalculated, and the units must be re-routed to that new path.

Therefore, I need performance.

I tried the A* algorithm, but everytime the player places a new tower, and path has to be recalculated, the existing units who haven't gone past the tower yet, get lost, and stand still, since they were a part of the old path that has now lost its pathing information.

sentences:
Enlarge screen space Texture by set pixel amount I have a texture shown over the screen using screen space UV's. The Texture is 495x,596x, Screen size is 888,500, but can change. The Texture has a Tile of (3.469775f,1.392644f) to correct for distortion from being stretched to the Screen's size, and has repeat set to Clamped. So basically, I'm showing a Texture of an arbitrary size on screen and using Tile and Offset in the shader to correct for distortion and keep the texture at its original aspect ratio.

Now my problem is I want to Zoom in and out by a set pixel amount in Screen space.
So lets say: I need the texture to increase in width by 10 pixels in screen space.
What is a formula I can use to recalculate the Tile and Offset so that the texture stays at the same aspect it was but increases by the amount I want it zoomed?

I've been trying things like: 1 Pixel = (1f / Camera.main.pixelWidth).
So to zoom by 10 pixels I would go something like Tile.x += (10f * (1f / Camera.main.pixelWidth));
But this doesn't seem quite right, I'm not seeing it increase the Texture by the right number of pixels...

My current function is something like this, but for Zoom = 5f, it's only enlarging by about 2px. AspectRatio = Tiling in the Material and WidthOffset/HeightOffset is just the Offset.

public void ZoomOverlay(float ZoomAmount)
{
    AspectRatio.x -= ZoomAmount * (AspectRatio.x / (float)Camera.main.pixelWidth);
    AspectRatio.y -= (ZoomAmount * (AspectRatio.x / (float)Camera.main.pixelHeight)) / 2f;

    WidthOffset += ((ZoomAmount / 2f) * (AspectRatio.x / (float)Camera.main.pixelWidth));
    HeightOffset += ((ZoomAmount * (AspectRatio.x / (float)Camera.main.pixelWidth)) / 2f) / AspectRatio.x;
}

sentences: Best 3rd Party DRM Solutions What are the best 3rd party DRM solutions available from a user experience, development integration, and security perspective?

sentences:
How to compute the forward, up and right vectors from a single quaternion? Given a quaternion

float x, y, z, w;

How does one the forward, up and right vector from a single quaternion?

vec3 up;
vec3 forward;
vec3 right;

quat_get_all_axis(&quat, &up, &forward, &right);

This seems useful to accomplish things like move forward/back, strafe and jump.

sentences:
Coming up with manageable game ideas as a hobbyist game developer I'm trying to come up with ideas for games to develop - as per the advice on this question I've started jotting down and brainstorming my ideas as I get them, and it has worked relatively well - I now have a growing collection of ideas that I think are relatively original.

The trouble is that I'm a solo hobbyist developer so my time is limited (and I have short attention span!)  I've decided to set myself a limit of 1 working week (i.e. 35-40 hours) to develop / prototype my game, but all of the ideas that really spark my imagination are far too complex to be achievable in that sort of time (e.g. RTS or RPG style gameplay), and none of my simpler ideas really strike me as being that good (and whenever I get a flash of inspiration I invariably end up making things more complicated!)

Am I being too picky - should I just take one of my simpler ideas and have a go?

sentences:
How to handle multiple effect files in XNA So I'm using ModelMesh and it's built in Effects parameter to draw a mesh with some shaders I'm playing with. I have a simple GUI that lets me change these parameters to my heart's desire. My question is, how do I handle shaders that have unique parameters? For example, I want a 'shiny' parameter that affects shaders with Phong-type specular components, but for an environment mapping shader such a parameter doesn't make a lot of sense. How I have it right now is that every time I call the ModelMesh's Draw() function, I set all the Effect parameters as so

foreach (ModelMesh m in model.Meshes)
        {

            if (isDrawBunny == true)//Slightly change the way the world matrix is calculated if using the bunny object, since it is not quite centered in object space
            {
                world = boneTransforms[m.ParentBone.Index] * Matrix.CreateScale(scale) * rotation * Matrix.CreateTranslation(position + bunnyPositionTransform);
            }
            else //If not rendering the bunny, draw normally
            {
                world = boneTransforms[m.ParentBone.Index] * Matrix.CreateScale(scale) * rotation * Matrix.CreateTranslation(position);
            }

            foreach (Effect e in m.Effects)
            {
                Matrix ViewProjection = camera.ViewMatrix * camera.ProjectionMatrix;
                e.Parameters["ViewProjection"].SetValue(ViewProjection);
                e.Parameters["World"].SetValue(world);
                e.Parameters["diffuseLightPosition"].SetValue(lightPositionW);
                e.Parameters["CameraPosition"].SetValue(camera.Position);
                e.Parameters["LightColor"].SetValue(lightColor);
                e.Parameters["MaterialColor"].SetValue(materialColor);
                e.Parameters["shininess"].SetValue(shininess);

                //e.Parameters
                //e.Parameters["normal"]

            }
            m.Draw();

Note the prescience of the example! The solutions I've thought of involve preloading all the shaders, and updating the unique parameters as needed. So my question is, is there a best practice I'm missing here? Is there a way to pull the parameters a given Effect needs from that Effect?

Thank you all for your time!

sentences:
I can’t get a teleport to work c# these are the pics of the inspect panel on the parts of the 3D pacman that you asked for.

(I just added these photos because I couldn’t while i was away and because even though the advice given so far was amazing, it didn’t resolve my problem, so please help if you can)

I’ve been trying to make a teleport for a while and it works only part of the time. the collisions work because i put a debug.log in it but the teleporting part doesn’t work. there are no errors in the collision, it just doesn’t teleport the pieces of pacman. here is the script (it's not the most improved but i was trying to make it work)

public GameObject pacman;
public GameObject Camera;
public GameObject pointLight;
public GameObject body;
public Vector3 pacmantele;
public Vector3 cameratele;
public Vector3 pointlighttele;
public Vector3 bodytele;

void OnTriggerEnter(Collider other)
{
    Debug.Log("works");
    pacman.transform.position = pacmantele;
    Camera.transform.position = cameratele;
    pointLight.transform.position = pointlighttele;
    body.transform.position = bodytele;
}

here is a photo of the inspection panel on the non-working teleporter

sentences:
How do I apply collision to a turtle I cannot figure out how to apply collision to a turtle. I am in need of help for collision with pen lines and turtles. I want the two to hit and restart the game but I can't get collision on either.

import turtle
import pygame

wn = turtle.Screen()
wn.bgcolor("black")

#Draw border
mypen = turtle.Turtle()
mypen.penup()
mypen.pencolor('white')
mypen.setposition(-300,-300)
mypen.pendown()
mypen.pensize(3)
for side in range (4):
    mypen.forward(600)
    mypen.left(90)
mypen.hideturtle()

#Create player 1
player = turtle.Turtle()
player.setposition(240,240)
player.setheading(180)
player.color("red")
player.shape("classic")

player.speed(0)

#Create player 2
player2 = turtle.Turtle()
player2.setposition(-240,-240)
player2.color("aqua")
player2.shape("triangle")

player2.speed(0)

#Set speed variable
speed = 3

#Define functions
def turnleft():
    player.left(30)

def turnright():
    player.right(30)

def increasespeed():
    global speed
    speed += 3

#Set keyboard bindings for p1ayer 1

turtle.listen()
turtle.onkey(turnleft,"Left")
turtle.onkey(turnright,"Right")

#Define player 2 functions

def turnleft():
    player2.left(30)

def turnright():
    player2.right(30)

def increasespeed():
    global speed
    speed += 3

#Set keyboard bindings for player 2
turtle.listen()
turtle.onkey(turnleft,"a")
turtle.onkey(turnright,"d")

#turtle.onkey(increasespeed,"Up")

while True:
    player.forward(speed)
    player2.forward(speed)

    #Bouandary
    if player.xcor() > 300 or player.xcor() < -300:
        player.right(100)
    #Boundary
    if player.ycor() > 300 or player.ycor() < -300:
        player.right(100)
    #Bouandary2
    if player2.xcor() > 300 or player2.xcor() < -300:
        player2.right(100)
    #Boundary2
    if player2.ycor() > 300 or player2.ycor() < -300:
        player2.right(100)

sentences:
How can I create a stun gun in Unreal? I am fairly new to the programming world. I am currently at college and one of the tasks I need to do is create a "stun gun" or "freeze gun."

Basically, when you shoot a target (another player) I want it to stop them for five or so seconds. The gun will do no damage to the player, just simply freezes them. The player can be refrozen and/or continuously shot to remain frozen until the shooter's ammo runs out.

If anyone can give me some help on what to call in certain classes, or even provide me with the basic code the will freeze the player for several seconds, I'll be very thankful.

I know how to make a new weapon, and change fire-rates, etc... I am just stuck with what it is I have to do to freeze a player using the projectile class, or pawn class?

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 do you create an input layout for passing a uint4 to a vertex shader in D3D10? I am trying to pass in a uint4 into the shader but my input layout keeps failing when trying to load the shader.

shader.fx

uint4  values : UINT4_0;  // VertexInput

Input layout

{ "UINT4", 0, DXGI_FORMAT_R32G32B32A32_UINT, 0, 0, D3D10_INPUT_PER_VERTEX_DATA, 0 }

Does that seem right?

I am a bit confused why there is an error here.

sentences:
What do you call the logic gates visual programming of PS4 Dreams? The PlayStation 4's Dreams app has a visual programming framework made up of sensors (detect touch, a person etc.), logic gates (AND, NOT, splitters etc.), wires, and action outputs (move somewhere, execute keyframe, teleport etc.). Through these flows energy which is usually a value between (presumably) 0.0 to 1.0. This in turn is used to create full games logic, movies and more.

Is there a name for this type of programming UI? I can think of a general "logic gates" programming or so, but maybe there's something more specific. Thanks!

sentences:
Loading images using their bytes in Unity If you import an image into the Unity inspector, the image will be encoded in Unity's own format. Usually the resulting image is much bigger than the original (from 100kb to 1MB). Of course, you can do stuff like compress and change the texture max size to reduce the image's size, but at the end it will almost always be bigger.

I noticed that you can create a Texture2D if you got the necessary bytes. As an experiment, I took my 100kb image and imported it to Unity as a .bytes file. Then I read the bytes and created my Texture2D:

    Texture2D texture = new Texture2D(100, 100);
    texture.LoadImage(myTextAsset.bytes);
    Sprite sprite = Sprite.Create(texture, new Rect(0,0,350, 288));

And it works. And it is smaller (100kb).

So my question is: what's the difference between Unity's builtin way of handling images and my way of loading them using their bytes? Because I'm saving tons of memory with this method. I imagine that it is a bit slower. But if that's the only difference, I can live with that.

sentences:
Unity3D: Mathf Lerp too fast when timescale increases I have an image with a fill amount component controlled by a Mathf Lerp. The problem is, the time for completion of the Mathf Lerp function decreases more than expected when the timescale increases.

When the timescale is equal to 2 the function should take half the time to complete but it takes less than that. Any idea why?

public static float demolishTime = 6.0f

public void OnClickDemolish()
{
    InvokeRepeating("demolishProgress", 0f, 0.1f);
}

void demolishProgress()
{
    progress += (Time.deltaTime / demolishTime);
    demolishProgressBar[DemolishManager.demolishState].fillAmount = (float)Mathf.Lerp(0, 1, progress);
    if (progress >= 1) demolishCompleted();
}

sentences:
Instantiate objects in a List and use it Why does the following code not work?

I want to instantiate prefabs in a list and then use  it as a GameObject like that :

public GameObject prefab;

void Start()
{

 ArrayList players = new ArrayList();

  for(int i=0; i<5; i++)
  {
        players.Add( (GameObject)Instantiate(prefab));
  }

  players[2].transform.position = new Vector3(1, 1, 1);

}

there is an error message

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:
How to apply effects that occur (or change) over time to characters in a game? So assume that I have a system that applies Effects to Characters like so:

public class Character {
    private Collection<Effect> _effects;

    public void AddEffect (Effect e) {
        e.ApplyTo(this);
        _effects.Add(e);
    }
    public void RemoveEffect (Effect e) {
        e.RemoveFrom(this);
        _effects.Remove(e);
    }
}

public interface Effect {
    public void ApplyTo (Character character);
    public void RemoveFrom (Character character);
}

Example Effect: Armor Buff for 5 seconds.

void someFunction() {
    // Do Stuff ...
    Timer armorTimer = new Timer(5 seconds);
    ArmorBuff armorbuff = new ArmorBuff();
    character.AddEffect(armorBuff);
    armorTimer.Start();
    // Do more stuff ...
}

// Some where else in code
public void ArmorTimer_Complete() {
    character.RemoveEffect(armorBuff);
}

public class ArmorBuff implements Effect {
    public void applyTo(Character character) { character.changeArmor(20); }
    public void removeFrom(Character character) { character.changeArmor(-20); }
}

Ok, so this example would buff the Characters armor for 5 seconds.  Easy to get working.  But what about effects that change over the duration of the effect being applied.  Two examples come to mind:

Damage Over Time: 200 damage every second for 3 seconds.  I could mimic this by applying an Effect that lasts for 1 second and has a counter set to 3, then when it is removed it could deal 200 damage, clone itself, decrement the counter of the clone, and apply the clone to the character.  If it repeats this until the counter is 0, then you got a damage over time ability.

I'm not a huge fan of this approach, but it does describe the behavior exactly.

Degenerating Speed Boost: Gain a speed boost that degrades over 3 seconds until you return to your normal speed.  This is a bit harder.  I can basically do the same thing as above except having timers set to some portion of a second, such that they occur fast enough to give the appearance of degenerating smoothly over time (even though they are really just stepping down incrementally).

I feel like you could get away with only 12 steps over a second (maybe less, I would have to test it and see), but this doesn't seem very elegant to me.  The only other way to implement this effect would be to change the system so that the Character checks the _effects collection for effects that alter any of the properties any time that they are being used.  I could handle this in functions like getCurrentSpeed() and getCurrentArmor(), but you can imagine how much of a hassle it would be to have that kind of overhead every time you want to do a calculation with movement speed (which would be every time you move your character).

Is there a better way to deal with these kinds of effects or events?

sentences:
Deactivate keyboard input on collision I'm creating an online-canvas-game with a tank as player object.

Now I have several structures in my canvas, that shouldn't be able to be overdriven by the tank...
My solution is to detect the collision like that:

if(hero.x > reactor[i]['x'] - 32 && hero.x <= reactor[i]['x'] + 32
   && hero.y > reactor[i]['y'] - 32 && hero.y <= reactor[i]['y']){
    collidetop = true;
}

if(hero.x > reactor[i]['x'] - 32 && hero.x <= reactor[i]['x'] + 32
   && hero.y >= reactor[i]['y'] && hero.y < reactor[i]['y'] + 32){
    collidebottom = true;
}

if(hero.x > reactor[i]['x'] - 32 && hero.x <= reactor[i]['x']
   && hero.y > reactor[i]['y'] - 32 && hero.y <= reactor[i]['y'] + 32){
    collideleft = true;
}

if(hero.x > reactor[i]['x'] && hero.x <= reactor[i]['x'] + 32
   && hero.y > reactor[i]['y'] - 32 && hero.y <= reactor[i]['y'] + 32){
    collideright = true;
}

The hero object is the tank, hero.x the x-coordinate, and so on...
Now I'd like to deactivate the keyboard input for the direction key, if the objects collide...
For this reason I have the variables wok, aok, sok and dok - they all contain booleans.
If wok = false, then the key "w" is deactivated...
I've connected the collide variables to the keyboard inputs:

if(collidetop == true){
    sok = false;
}
if(collidetop == false){
    sok = true;
}
if(collidebottom == true){
    wok = false;
}
if(collidebottom == false){
    wok = true;
}
if(collideright == true){
    aok = false;
}
if(collideright == false){
    aok = true;
}
if(collideleft == true){
    dok = false;
}
if(collideleft == false){
    dok = true;
}

My problem is: if the tank doesn't collide the other object any more, the keys stay blocked... Could you help me with that?

sentences:
Overriding component behavior I was thinking of how to implement overriding of behaviors in a component based entity system.  A concrete example, an entity has a heath component that can be damaged, healed, killed etc.  The entity also has an armor component that limits the amount of damage a character receives.

Has anyone implemented behaviors like this in a component based system before?
How did you do it?

If no one has ever done this before why do you think that is.  Is there anything particularly wrong headed about overriding component behaviors?

Below is rough sketch up of how I imagine it would work.  Components in an entity are ordered.  Those at the front get a chance to service an interface first.  I don't detail how that is done, just assume it uses evil dynamic_casts (it doesn't but the end effect is the same without the need for RTTI).

class IHealth
{
public:
   float get_health( void ) const = 0;
   void do_damage( float amount ) = 0;
};

class Health : public Component, public IHealth
{
public:
   void do_damage( float amount )
   {
      m_damage -= amount;
   }
private:
   float m_health;
};

class Armor : public Component, public IHealth
{
public:
   float get_health( void ) const
   {
      return next<IHealth>().get_health();
   }

   void do_damage( float amount )
   {
      next<IHealth>().do_damage( amount / 2 );
  }
};

entity.add( new Health( 100 ) );
entity.add( new Armor() );
assert( entity.get<IHealth>().get_health() == 100 );
entity.get<IHealth>().do_damage( 10 );
assert( entity.get<IHealth>().get_health() == 95 );

Is there anything particularly naive about the way I'm proposing to do this?

sentences:
fading from one scene to another not working I am using the following code to fade from one scene to another, but it doesn't fade. It just loads the next scene without fading. I suspect there's something wrong with the image I'm using. I used a black .png image with dimensions 425×344 that I downloaded from Google. How can I solve this issue?

Fading.cs (I added this to an empty game object)

public Texture2D fadeOutTexture;
public float fadeSpeed = 0.8f;

private int drawDepth = -1000;
private float alpha = 1.0f;
private int fadeDir = -1;

void onGUI () {

    alpha += fadeDir * fadeSpeed * Time.deltaTime;
    alpha = Mathf.Clamp01(alpha);
    GUI.color = new Color (GUI.color.g, GUI.color.b, alpha);
    GUI.depth = drawDepth;
    GUI.DrawTexture (new Rect (0, 0, Screen.width, Screen.height), fadeOutTexture); }

public float BeginFade (int direction) {
    fadeDir = direction;
    return (fadeSpeed); }

void onLevelWasLoaded() {
    BeginFade (-1);

}

In the script of the trigger object:

IEnumerator gameScene2() {
    float fadeTime = GameObject.Find ("FadeObject").GetComponent<Fading>().BeginFade(1);
    yield return new WaitForSeconds(fadeTime);
    Application.LoadLevel("Scene2");
}

These are the image settings for the black .png image

sentences:
Do I need a server if I only want to upload data to a DB? I'm currently creating a game where people get some kind of reports for their game performance on a website. Let's say, you log-in, play the game, the system gathers your performance data and this is being sent to a database so that it can be read and interpreted by an external website later. For this, I'm using a firebase real-time database and it's working fine by now.

I'm pretty noob with unity and I have read and watch tutorials on the internet where people actually create a server to achieve this but do I really need a server when the only thing I need to do is to post data to a database based on users?
This isn't really a multiplayer game, but there is some kind of information which is shared for example sometimes I need to get those data in order to get high scores and that kind of small information, but that's it.

I'm using unity webgl and firebase for the moment, and everything is working fine, but then why people always create a server for this?

PS: sorry for my bad english

sentences:
Cocos2D V3 Blur effect performance test without iOS device I am testing the blur effect (CCEffectBlur) in Cocos 2D V3 and I found that when I add an effect to an EffectNode it takes up to 5 seconds to appear in the IOS Simulator screen. (I know that the IOS Simulator is not to test performance)

When I run the same code in my device (iPhone 6), it appears almost instant.

My problem is to test the performance in old devices like iPhone 4S or iPhone 5 but, unfortunately, I don't have those devices to do some tests.

Is there any way to check my game's performance on those devices without the devices?

This is what I am testing.

I have a hierarchy with an EffectNode as a root node.
I am using a code like the following to add the effect
effectNode.effect = [CCEffectBlur effectWithBlurRadius:10];

sentences:
Java 2d topdown collision Im making a game and Im working on the collision.
First Ill tell you what I want (Ill put in pictures), then Ill leave the code.

What I want: I want the player to stop exactly before its collision box (a rectangle) intersects with a wall collision box. Right now this only happens sometimes, sometimes it doesnt go all the way to the wall, that is probably because the velocity is too big I guess. Here are the pictures:

Left: it works good, it goes all the way to the wall (btw the red square is the collision box).

Right: The player only goes down that much and leaves a gap inbetween it and the wall (the circle shows the gap) and you can not go down to go all the way to the wall.

The movment code:

if(canMove){
    move(xVol, yVol);
    xVol = yVol = 0f; // resets the velotcity
}

public void move(float xv, float yv){
    if(!collisionv(yv)){
        y += yv; // moves the player on its y
        for(Entity e : PlayState.e){
            if(e.getID() == ID.Player){
                e.getCollisionRect().setY(y); // moves the collision box
            }
        }
    }

    if(!collisionh(xv)){
        x += xv; // moves the player on its x
        for(Entity e : PlayState.e){
            if(e.getID() == ID.Player){
                e.getCollisionRect().setX(x); // moves the collision box
            }
        }
    }

}

public boolean collisionv(float yv){
// Vertical collision checking
    boolean ret = false;
// makes a rectangle that represends the players collision rect after it moved to check if it will be colliding with anything
    Rectangle p = new Rectangle(x, y + yv, getCollisionRect().getWidth(), getCollisionRect().getHeight());

    for(Entity e:PlayState.e){

        if(e.getID() != ID.Player && c.trueCollision(p, e.getCollisionRect())){
    // This true collision method just returns if the rectangles are intersecting
            ret = true;
        }
    }
    return ret;
}

public boolean collisionh(float xv){
// Horizontal collision checking
    boolean ret = false;
    // makes a rectangle that represends the players collision rect after it moved to check if it will be colliding with anything
    Rectangle p = new Rectangle(x + xv, y, getCollisionRect().getWidth(), getCollisionRect().getHeight());

    for(Entity e:PlayState.e){
        if(e.getID() != ID.Player && c.trueCollision(p, e.getCollisionRect())){
            ret = true;
        }
    }
    return ret;
}

My question: How do I make it move all the way to the wall, never leaving a gap inbetween the player and the wall?

sentences:
How do I detect and handle collisions using a tile property with Slick2D? I am trying to set up collision detection in Slick2D based on a tilemap. I currently have two layers on the maps I'm using, a background layer, and a collision layer. The collision layer has a tile with a 'blocked' property, painted over the areas the player can't walk on. I have looked through the Slick documentation, but do not understand how to read a tile property and use it as a flag for collision detection.

My method of 'moving' the player is somewhat different, and might affect how collisions are handled. Instead of updating the player's location on the window, the player always stays in the same spot, updating the x and y the map is rendered at. I am working on collisions with objects by restricting the player's movement when its hitbox intersects an object's hitbox. The code for the player hitting the right side of an object, for example, would look like this:

if(Player.bounds.intersects(object.bounds)&&(Player.x<=(object.x+object.width+0.5))&&Player.isMovingLeft){
        isInCollision=true;
        level.moveMapRight();
    }
    else if(Player.bounds.intersects(object.bounds)&&(Player.x<=(object.x+object.width+0.5))&&Player.isMovingRight){
        isInCollision=true;
        level.moveMapRight();
    }
    else if(Player.bounds.intersects(object.bounds)&&(Player.x<=(object.x+object.width+0.5))&&Player.isMovingUp){
        isInCollision=true;
        level.moveMapRight();
    }
    else if(Player.bounds.intersects(object.bounds)&&(Player.x<=(object.x+object.width+0.5))&&Player.isMovingDown){
        isInCollision=true;
        level.moveMapRight();
    }

and in the level's update code:

if(!Player.isInCollision)
        Player.manageMovementInput(map, i);

However, this method still has some errors. For example, when hitting the object from the right, the player will move up and to the left, clipping through the object and becoming stuck inside its hitbox. If there is a more effective way of handling this, any advice would be greatly appreciated.

sentences:
WHY !! CountDown not Working inside the IF Condition? i need a way to make the countdown decreasing inside the if statement i am stacking in  this problem for more than 3 days .. Don't suggest to me Coroutine cause it will not working in my case cause i am using clones (initiated prefabs)

i know that the countdown will work only one frame if it's inside an IF Statement ... Any Ideas to make it working ...Ty

The game is about cars ... and every instantiated car has a random countdown timer

void Update()
{
    if(carNumber < cars)
    {
        SpawnCars();
    }
}

and this is the spawn  function

void SpawnCars()
{
    randomSpawnPoint = Random.Range(0, spawnPoints.Length);

    randomSpawnCars = Random.Range(0, Cars.Length);

    GameObject obj = Instantiate(Cars[randomSpawnCars],spawnPoints[randomSpawnPoint].position, Quaternion.Euler(-90, 180, 0)) as GameObject;

    carNumber++;

    obj.gameObject.tag = "select";// + k;

    rcf = obj.GetComponent<RayCastForward>();
    TextMesh txt = FindObjectOfType<TextMesh>();

    time = Random.Range(4, 20);

    txt.text = (time - Time.deltaTime).ToString("0");
    print(time);
    print(carNumber);
}

EDIT: time is the timer

sentences: How to make the bounced light brighter in unity? I'm using indirect lighting to lit a room. The light is coming through the window, but still the inside is too dark compared to the real light . if i bring up the environment or light intensity, it will look the exterior is burnt out ( too bright)... it's already on the limit. How to just make the bounced light (indirect light) brighter ?

sentences:
Is there a tool to import a sprite sheet into Flash as a frame-based animation? I'm looking for a tool that can help create a Flash-based animation given a spritesheet -- basically the reverse of Spriteloq.

I'd like to take a sheet like the one below, import it into Flash, and then use Spriteloq (or a similar tool) to re-export as an optimized sheet that is compatible with the game engine I'd like to use -- instead of creating software that can read the specific sheet.

sentences: Which data structure to use to render a large isometric game world? I'm starting development of a 2d isometric (tiled, roguelike) game and I'm brainstorming which kind of data structure I would use to store runtime data like tiles and entities, but I don't want to use a 2D array (as the world will be huge). How could I handle the rendering in such a case?

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:
Making an enemy shoot every few seconds so I am making a 2d canvas game in Javascript and I want the enemy mobs to shoot a bullet every let's say 3 seconds. I'm almost done with the code , i made everything i just don't know how to make the function repeat.

//this is the enemy object
 function Enemy(x, y){
 this.sprite = enemySprite;
 this.x = x;
 this.y = y;
 this.shooting = function(){
    while(enemyBullets <= bulletsPerTick){
        var enemybullet = new enemyBullet(this.x , this.y);
        enemyBullets.push(enemybullet);//i'm adding the bullet object to an array .
    }
    for(var i = 0; i<enemyBullets.length;i++){
        enemyBullets[i].show();
        enemyBullets[i].move();//if there is an element in the array , draw and update the bullet.
    }
}// i left only the important elements of the object needed to answer my question
    //this is the enemy bullet object
    function enemyBullet(x, y) {
    this.x1 = x;
    this.y1 = y;
   this.r = 5;
    this.show = function ()
    ctx.beginPath();
    ctx.arc(this.x1, this.y1, this.r, 0, Math.PI * 2);
    ctx.fillStyle = "black";
    ctx.fill();
    ctx.closePath()//drawing the bullet
}
this.move = function () {
    this.x1 = this.x1 - 5;//updating the bullet
}

In my main file , i have a function draw() which is in requestAnimationFrame(draw):

for (var j = 0; j < enemies.length; j++) {
            enemies[j].show();//here i spawn the enemy sprite
            enemies[j].shooting();//this is the function which adds the bullets to the array , draws them and updates them.
        }

Basically , when i press the start the program now , only one bullet flies and disappears and i want that process to continue over and over again every few seconds , let's say 3 seconds for example , i tried to add enemies[j].shooting() in an interval and timeout but they are in draw, which is in requestAnimationFrame and it doesn't seem to work , if anyone have any clue how to help me I want every advice possible. Also if you need more information about the problem , let me know.

sentences:
Slick2D Simple StateBasedGame not working I recently started trying to work with outside Java libraries like Slick2D. This is my first time doing so, so I basically have no clue what I am doing.

I tried making a simple StateBasedGame that only displays a menu bar showing three options. The problem is that in my 'Game' class, the initStatesList() method isn't being called and I don't know why not. Here's the code:

Game class

import org.newdawn.slick.GameContainer;
import org.newdawn.slick.SlickException;
import org.newdawn.slick.state.StateBasedGame;

public class Game extends StateBasedGame {
    public Game(String title) {
        super(title);
    }

    public static void main(String[] args) {
        Game game = new Game("Text Based");
    }

    @Override
    public void initStatesList(GameContainer arg0) throws SlickException {
        System.out.println("InitStates");
        addState(new Menu());
    }
}

Menu class:

import org.newdawn.slick.Color;
import org.newdawn.slick.GameContainer;
import org.newdawn.slick.Graphics;
import org.newdawn.slick.SlickException;
import org.newdawn.slick.state.BasicGameState;
import org.newdawn.slick.state.StateBasedGame;

public class Menu extends BasicGameState {

    private int ID = 1;

    @Override
    public void init(GameContainer arg0, StateBasedGame arg1) throws SlickException {
    }

    @Override
    public void render(GameContainer container, StateBasedGame game, Graphics g) throws SlickException {
        g.setColor(Color.white);
        g.drawString("Higher or Lower", 50, 10);

        g.drawString("1. Play Game", 50, 100);
        g.drawString("2. High Scores", 50, 120);
        g.drawString("3. Quit", 50, 140);

    }

    @Override
    public void update(GameContainer arg0, StateBasedGame arg1, int arg2) throws SlickException {

    }

    @Override
    public int getID() {
        return ID;
    }

}

I have no clue why it doesn't work...

sentences:
Wait for AudioClip finish before destroy Object If I Play the gun sound on my "bullet" object, how can I prevent the end of Audio sound if the bullet hit something so it destroy.
To clarify:

Bullet prefab -> Audio Source -> Audio Clip = MachineGun.mp3
PlayOnAwake = true

When I instantiate bullet, MachineGun AudioClip is played.
But the bullet is fast and hit something before the clip is end.
This Kill the machine audio effect making it irrealistic.

How can I tell Unity "Play the sound to the end, despite the object is destroyed".

I've tried

Destroy(gameObject, AudioClip.length)

But it seems not works

sentences:
How do I fix a "missing mcp.cfg" error? I am trying to use mod coder pack (MCP) to create mods of my own. I have downloaded MCP 9.4 version from www.modcoderpack.com. The error that I have encountered is that when I try to run a file called decompile.sh in the mac terminal, the terminal responds with an error: ERROR:root:!! Missing mcp.cfg. I have checked my MCP folder and made sure that it contained the file mcp.cfg. The file is in my folder.

I am currently running on a Macbook Pro with MacOS Mojave Version 10.14.4.

sentences:
How to Instantiate enemies (triangles) in the shape of an n sided polygon I am trying to instantiate a cluster of triangles (enemies) in the shape of a polygon and am unsure how to angle them correctly to all be facing away from the center. Thanks to another question, I got the positions roughly right:

for (int i = 0; i < formation.Count; i++)
{
    Vector3 pos = new Vector3(Mathf.Sin((float)i / formation.Count * 2 * Mathf.PI), Mathf.Cos((float)i / formation.Count * 2 * Mathf.PI));
    GameObject tri = Instantiate(gameObj, pos, /*Quaternion.Euler(0, 0, z)*/, parent) as GameObject;
}

Now I just need to get the angles such that all triangles face away from the center.

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: 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:
How are really big maps made? I'm interested in how huge games like The Witcher 3 and Skyrim create and save the open worlds. In my own game I used a system where I stored the map data in a file seperated by commas. For example 'stone' would code for a stone tile, and I just typed in codes for how I wanted my map to appear in the game.

I feel like this was a really innefficient and incorrect way of doing things. But, I couldn't think of a different way to get past the problem.

The creators of skyrim obviously used a level editor, but how did they actually save a map as big as skyrim's world? How is the data stored? Because with something as intricate as an amazing, 3D world, you can't store it like I did by just having codewords for different tiles that are all the same height and width.

How is it done in 2D games as well? For example Ori and the Blind Forest, which does not use a tile-based system. Or, in fact, do they not have files that hold data for the level layouts at all?

Thanks :)

sentences:
Unity Editor Scene View does not match built executable I'm trying to make my game resolution independent. I'm using Unity's 4.6 UI, and I've got custom resolutions defined at 1280 x 720, 1600 x 900, and 1920 x 1080. In-editor, if I swap between any of these resolutions, the observed scene doesn't change. It looks like this:

I then build an executable (set to only allow 16x9 resolutions), and run this scene. On 1280 x 720 (as selected from the resolution dialog), I get this:

While on 1920 x 1080 (as selected from the resolution dialog), I get this:

Which matches the editor view. (Ignore the character sprites; those are in worldspace on a separate camera and aren't relevant to this question).

What is it about the executable that causes lower resolutions to be "zoomed in" like this, even if that lower resolution is the Reference Resolution for the Canvas Scaler?

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 can I check on a large number of points to see if they're inside the camera's frustum? I have a locally stored database on my Android project, it is a database of approx 100,000 Point3D(double,double,double). I need to check if each of these points are inside of the camera's frustum in unity. Will I most likely be running into performance issues querying the database and feeding all live Point3D's to unity per frame? What would be the best way to go about this if I am approaching this from the wrong direction?

sentences:
Java game engine for android and desktop I want implement 2d game as desktop application. And after development move it to android platform.

Engine should be have input and network managers.

Help me choose.

sentences:
Unity - resizing particles dont mantain collisions properly I am trying to make particles for blood on death. This is what I got so far:

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

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

How could I solve this?

sentences:
Are there any dedicated rules/scoring libraries/frameworks/engines? Note that this is not about graphics/physics/2D/3D/etc.! Rather I'd like to know whether there are dedicated solutions available for implementing custom rules/scoring on top of an existing framework, ideally addressing most common concepts already, for example players, matches, rule variations, game selection, preferences, high scores and the like?

Or is this functionality usually included in all those graphics oriented libraries/frameworks/engines? If so, are there any that stand out in this regard and do allow reusing the rules/scoring components easily without using the graphics part of the engine for example?

Alternatively, would you consider this topic to be better addressed by a standard Business rules engine instead, as suggested in Java Rule Engine for Game AI?

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:
Designing a game - Where to start? A friend of mine and I are planning a game together to work on in our free time. It's not an extensive game, but it's not a simple one either.

He's working on the story behind the game while I'm working on the graphics and code.

I don't really know where to start with the game. We know what the basic type of game it's going to be and how it would be played, but I'm having a hard time of actually knowing where to begin.

I have Xcode open but I don't really even know what I should be designing first.

What is some advice for this writer's block? Where is a good place to start with a game?
Should I design all the graphics and layout before even touching Xcode? Should I program the things I know I'll have difficulty with first before getting to the easy stuff?

sentences:
Calculate path of laser beam? Lets say we have a laser beam emitter that has a position and an angle (in a 2D world to simplify things). The laser emitted from that emitter will start at that position, and continue heading in the direction of the angle until it intersects with an object (some arbitrary polygon). If that object is reflective, the laser should bounce off the surface that it first intersects. This continues until the laser hits a non-reflective surface.

I guess the problem here can be divided into two problems: finding the first intersection and calculating the new angle from that intersection. I'm not exactly sure how to solve the first problem, but I figure the second one can be solved by finding the angle between the laser and the normal vector (i think that's what it's called) and calculating the new angle using that.

sentences:
How to create a two-way teleport system? I'm trying to create a two-way teleport system in which players can move into a teleport gameobject, and is then teleported to another linked teleport gameobject.

How I was planning to have it work was very simple. On the teleport gameobject's script, it would have a public property to the other teleport's transform in which to teleport the player to. In OnTriggerEnter, I simply set the entering's collider position to that of the linked teleport.

void OnTriggerEnter(Collider other) {
    other.transform.position = DestinationPoint.position;
}

However, when the player's position is changed, it triggers the OnTriggerEnter of the destination teleport, and thus the player gets stuck bouncing back and forth between the two points.

What's a good way to prevent this? Some less than ideal solutions I came up with is to offset the position that player teleports too slightly so that he doesn't cause OnTriggerEnter to be called at the destination portal, but I'd like to avoid that.

sentences:
Raycaster calculation question I am following this tutorial https://lodev.org/cgtutor/raycasting.html

  When deriving deltaDistX geometrically you get, with Pythagoras, the formula "sqrt(1 + (rayDirY * rayDirY) / (rayDirX * rayDirX))", but this can be simplified to abs(1 / rayDirX). [thanks to Artem for spotting this simplification]
  Similarly, deltaDistY is "sqrt(1 + (rayDirX * rayDirX) / (rayDirY * rayDirY))" which can be simplified to abs(1 / rayDirY).
  The variable perpWallDist will be used later to calculate the length of the ray.

In the calculation that involves Pythagoras, why is a "+1" involved? I thought the equation was a^2+b^2=c^2? I feel dense... Also, I do not understand how the simplification to abs(1/rayDirX) works.

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:
Which algorithm for controlling cars on a race track? I think A* is a good place to start, but since cars cannot move in all directions (they move like cars do, trying to move forward and steer), I was wondering if someone could point me at other approaches they've used.

Also, I was wondering about the "Racing Line". Should one just precompute the optimal paths, and then use the A* to select the path that isn't blocked by other cars ?

EDIT: My question is different from Driver AI in racing game because that question is about approaches.

I am interested in learning about specific tried and trusted algorithms like A*.

sentences:
How is custom-written music generally licensed for a small game? I am relaunching my career as a game musician; previously I have done a little bit of licensed work and writing music for game jam-type games, after having written music as a secondary job duty for my full-time job at various game studios. As I am entering into the world of freelance game music composition, however, I am not sure what sort of license terms are common.

In particular, one developer I was in contact with wanted me to do the music entirely as a work-for-hire; I would retain the ability to showcase the music I do for him on my portfolio and the like, but I would not be allowed to, say, release a soundtrack album that contains the work, and he would retain the rights to re-license the music as he sees fit (including to other developers or for entirely different purposes). This doesn't seem to be in keeping with how I've seen other game music work, legally-speaking; if I do agree to these terms I would of course charge more than I would for music that is licensed, rather than sold.

I would, on the other hand, be totally fine with providing an exclusive game license for the music – that is, he would be the only one allowed to use my music within a game, but I would retain the rights for publication in other media. This seems to be how most indie game music is licensed, judging by how the original artists release their OSTs on Bandcamp and iTunes and the like.

Are there any standard contracts for game music licensing in various circumstances, or at least an explanation of the standard practices involved?

sentences:
Simulating elastic ball collisions quickly escalates to disaster I'm trying to learn HTML canvas and was working on a basic physical simulation, where a number of balls are drawn and set in motion, and the program simulates them colliding and bouncing off the walls and each other.

Here's the simulation.

Each ball is initially given a random position, direction, and a constant starting velocity. For simplicity, a ball's mass is simply equal to its radius. The velocity vectors are stored as (x,y) instead of polar coordinates to make the calculations simpler and the simulation faster, but this apparently has unintended consequences.

In the simulation linked above, I'm starting with ten balls, and each ball has an initial velocity magnitude of 3, so the total initial "speed" of the system should be 30 (= 10 * 3).  On each frame, I calculate the total speed of all the balls and read it out in a form field, and with uniform balls of size 10, the total speed seems to stay a few units under 30. The same is true of the min and max radius are decreased so all the balls are size 5, or increased to 20: the total speed stays relatively uniform.

However, interesting things happen when the balls vary in size. If the minRadius is changed to 5 and maxRadius to 15, for example, you'll notice that the total speed of the system starts climbing over time. The bigger the difference, the faster the speed grows out of control.

SO my first guess is that I screwed up the physics, but I can't figure out how. My other guess is that this is caused by accumulating floating point error, but it's interesting that it only grows upwards, and never towards zero. Also, it does seem to have a limit; while it constantly fluctuates, it seems to be capped at some value related to the delta between the minimum and maximum ball size.

My question is really to understand why this is happening?  Did I just screw up something simple, or is something more sinister going on?

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:
RPG combat and gold/exp reward equations I have a game that I'm creating, but I'm running across issues in keeping the ratios between high and low level players similar in the battle and reward equations. Obviously a higher level player should receive less experience, but have the upper-hand in battle when fighting lower level players and monsters. Here is how I'm calculating things currently:

Battle starts If player.dex > enemy.dex Accuracy = ((player.dex - enemy.dex)/2)*20

If player.dex < enemy.dex Accuracy = ((enemy.dex*player.dex)-enemy.dex)/player.dex

Accuracy is a percentage tested against a roll of a 100 sided die.

If accuracy > roll Hit success

If accuracy < roll Hit fails

If hit success All of the attacker's damaging items (spiked helms and shields, weapons, etc.) are added together and applied as such: Damage = (player.str + item.damage)-(enemy.dex + enemy.armor)

If the player is fighting a monster, I have a base amount of gold and experience which is modified according to the player: Gold gained = (enemy.gold*rand(1,10))/player.level Exp gained = (enemy.exp*rand(1,3))/player.level

If the player is fighting another player, then there will have to be a different equation for the rewards, but I'm not sure how to go about creating that one.

As this is my first attempt at creating (though I'm an avid RPGer), I'm not sure if there is kind of an "industry standard" form of calculating these things or not. I'm also afraid that these equations won't hold up once the player reaches higher levels (say level 50+).

sentences:
Storing wins and losses locally in Unity I am writing here as I have made a game in Unity where I want to store how many wins/losses a player has. The way I am thinking to do it is by putting 2 counters; One for every time a player wins, and one for every time a player loses. What I do when a player wins or loses is that he can shoot something and restart the game; I load scene 0 here. I know that the counters will reset once the player closes the application, but that doesn't matter.

Anyway, is there a better way to do it?

The other thing I am thinking about is storing how many times a player has played the game in total, and this has to be stores locally too and must not get reset when the player closes the application. How is this done?

sentences: The reasons behind Unity3D engine design (game object/transform component) I'm trying to understand the reasoning behind Unity3D engine design and this is something I can't get my head around yet: why is transform data stored in a separate component, instead of being a part of GameObject, like name, layer masks and tags? It cannot be removed like all of the other components anyway, there are no alternatives and thus no need for it to be removed.

sentences:
What is the proper, legal way to make a derivative video game? I want to make a game derived from an existing game. That game is owned by a live company.

How do I go about contacting the rights owners correctly and negotiating for the rights to the content?

sentences:
Player rotation issues (Player returns to default forward rotation after releasing keys) So basically what is happening is that my player rotates and faces the direction that he is currently being steered toward (which is wonderful). But after I release, let's say the A key, meaning he is currently facing and moving to the left, he goes back to facing forward after the key is released.

Here is my code:

public class PlayerMovement : MonoBehaviour {
public bool isGrounded;
private float distToGround;
private Vector3 v;
private Vector3 h;
public float speed;

Rigidbody rb;
Collider col;

void Start() {
    rb = GetComponent<Rigidbody>();
    col = GetComponent<Collider>();
    distToGround = col.bounds.extents.y;
}

void Update() {
    if (Physics.Raycast (transform.position, -Vector3.up, distToGround + 0.1f)) isGrounded = true; else isGrounded = false;
    if (isGrounded) {
        v = new Vector3(0, 0, Input.GetAxis("Vertical")) * speed;
        h = new Vector3(Input.GetAxis("Horizontal"), 0, 0) * speed;
        rb.MovePosition(rb.position + v * Time.deltaTime);
        rb.MovePosition(rb.position + h * Time.deltaTime);

//This deals with all the rotation
        Vector3 direction = new Vector3( Input.GetAxis ("Horizontal"), 0, Input.GetAxis ("Vertical") );
        Quaternion rotation = Quaternion.LookRotation(direction, Vector3.up);
        transform.rotation = rotation;
    }
  }
}

I obviously know that the reason this is happening is because the rotation is being set to the axis currently being pressed, so when I release any key, the rotation goes back to the original position. I just can't quite figure out how to fix it...

sentences:
Odd Jumping Behavior? While testing my player's jumpinig algorithm, I've come across two odd problems.

1) My player's hard-coded jump height is always much greater (roughly 1.5 times) than the in-game result, making me enter completely abstract numbers for the hard-coded value.

2) My player's jump height increases with lower FPS. At 60 FPS, the jump height was found to be 237, and at 30 FPS it was 269.

This has me completely bumfuzzled. I've been using this article pretty heavily while implementing my jumping function which can be seen below.

Player::Player(param1, param2, int init_jumpheight, double init_jumptime, param3..)
{
  jumpheight = init_jumpheight;
  jumptime = init_jumptime;

  m_gravity = -(2 * jumpheight) / (jumptime*jumptime);
  // other stuff
}

void Player::handleJump()
{
   if(animState != JUMPRISE && animState != JUMPFALL)
   {
      animState = JUMPRISE;
      jumpspeed = 2*jumpheight/jumptime;
      jumpTimer.start();
   }
   else if(animState == JUMPRISE || animState == JUMPFALL)
   {
      jumpspeed += m_gravity*jumpTimer.get_ticks()/1000;
      int yshift = jumpspeed*jumpTimer.get_ticks()/1000;

      if(DEBUGMODE) printf("%0.2f\t%d\t%d\t%d\n",jumpspeed,yshift,jumpTimer.get_ticks(),m_coords.y);

      shifty(-yshift);
      jumpTimer.start();
      if(yshift < 0 && animState != JUMPFALL) animState = JUMPFALL;
   }
}

And here's my console log (the bit that records the details of the jump):

1258.40 20      16      1520
1219.40 18      15      1502
1180.40 17      15      1486
1146.60 14      13      1471
1107.60 16      15      1459
1068.60 16      15      1445
1034.80 13      13      1431
1001.00 13      13      1420
962.00  14      15      1409
923.00  13      15      1397
886.60  12      14      1386
852.80  11      13      1376
816.40  11      14      1367
777.40  11      15      1358
738.40  11      15      1349
704.60  9       13      1340
668.20  9       14      1333
631.80  8       14      1326
598.00  7       13      1320
559.00  8       15      1315
520.00  7       15      1309
483.60  6       14      1304
449.80  5       13      1300
410.80  6       15      1297
371.80  5       15      1293
332.80  4       15      1290
293.80  4       15      1288
257.40  3       14      1286
228.80  2       11      1285
189.80  2       15      1285
153.40  2       14      1285
117.00  1       14      1285
80.60   1       14      1286
39.00   0       16      1287
0.00    0       15      1289
-36.40  0       14      1291
-65.00  0       11      1293
-104.00 -1      15      1295
-143.00 -2      15      1298
-182.00 -2      15      1302
-218.40 -3      14      1306
-252.20 -3      13      1311
-288.60 -4      14      1316
-325.00 -4      14      1322
-361.40 -5      14      1328
-403.00 -6      16      1335
-442.00 -6      15      1343
-478.40 -6      14      1351
-517.40 -7      15      1359
-551.20 -7      13      1368
-590.20 -8      15      1377
-629.20 -9      15      1387
-665.60 -9      14      1398
-694.20 -7      11      1409
-746.20 -14     20      1418
-782.60 -10     14      1434
-821.60 -12     15      1446
-860.60 -12     15      1460
-899.60 -13     15      1474
-938.60 -14     15      1489
-980.20 -15     16      1505

sentences:
How do I apply 2 rotations about different points to a single primitive using OpenGL I'm working on a 2D top-down shooter game that has a rotation feature like Realm Of The Mad God such that if you press e the camera rotates around the character in a clockwise direction and q rotates the camera around the character in a counterclockwise direction.  I have this working with my floors and walls by translating to the character, doing the screen rotation, and drawing everything with the character as the origin.  The problem arises when I shoot projectiles which need to both rotate around the character and rotate around themselves (shooting uses the mouse cursor so I can shoot at any angle).  For example, if the screen is not rotated and I'm shooting rectangular projectiles, I want them to face in the direction I'm shooting (rotation around themselves).  However if I only do this rotation, when I then rotate the screen the projectiles will always shoot at the same position because my cursor position does not change.  Therefore I need to also either rotate the projectiles around the character or rotate the mouse cursor position to get the correct position (which would then totally screw up all of the collision detection).  Likewise if I only do the screen rotation on projectiles, the rectangles will always be facing the same way and they would only look correct if I were shooting straight up or straight down.

So my question is, how can I perform 2 rotations on a primitive around 2 different points?  The only way I can think of is to translate to the character and do the screen rotation, then somehow calculate the translation required to move back to the middle of the projectile (seeing as how my axes are now rotated) and do its rotation.  Or am I thinking about this in the wrong way and there is a different solution to accomplishing this effect?

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:
Meaning of knots when drawing a NURBS curve? I'm using gluNurbsCurve to draw some curves with some control points. I've got the basic setup as described in the red book working correctly and I'm trying to expand on it.
This sample looks like this:

float knots[8] = {0,0,0,0,1,1,1,1};
float pnts[4][3] = { {...},{...},{...},{...} };
GLUnurbsObj *m = gluNewNurbsRenderer();
gluBeginCurve(n);
gluNurbsCurve(n, 8, knots, 3, pnts, 4, GL_MAP1_VERTEX_3)
gluEndCurve(n);

One thing I was wondering about is the meaning of the knots data. How does it affect the result? What other options can I experiment there?
For some reason I could not find any tutorial which properly explains this.

sentences:
GraphicsAdapter.Adapters on openGL won`t return secondary monitor I have been searching for this everywhere and never found the answer.

I am developing a feature to allow the user to select which monitor to run the game.

I have two monitors, primary and secondary. I tried to use "GraphicsAdapter.Adapters" but it always retrieves only 1 monitor (the one I am running the Visual Studio which is the default one).

Is this a bug?
How can I retrieve all the monitors available?

Thanks

MONOGAME 3.6 OPENGL (cross platform)
Visual Studio 2015
Windows 10 Pro 64bits

sentences:
How to continue firing when button is touched? How to continuos firing when user touch (and keep press) a button in Android/iOs?

Using onClick, i can fire only one shot.

Is there an event like "keep-touch" ?

Thanks

sentences:
Pygame Particle Emitter Problems so I've been trying to create a basic particle system in pygame which I can later expand upon but I've run into a spot of bother creating the particle emitter. Obviously what's supposed to happen is it's supposed to create a new particle every frame (or a set of particles) but instead it just alters the particle that's created first time round. I understand why this is happening, as far as the game is concerned, every frame I add the same object to the particle list so when I call the update function it calculates the positional and velocity sums multiple times, what I'm having trouble with is fixing it. How would I go about making a new particle every time?

My existing classes for this are as follows:

class Particle():
    def __init__(self, pos, vel, accel, image):
        self.pos = pos
        self.vel = vel
        self.accel = accel
        self.life = 255
        self.lifecount = 1
        self.image = image

    def update(self):
        self.vel.add(self.accel)
        self.pos.add(self.vel)
        self.life -= self.lifecount

    def is_dead(self):
        if self.life <= 0:
            return True
        else:
            return False

class Emitter():
    def __init__(self, pos):
        self.pos = PVector(pos[0], pos[1])
        self.particles = []
        self.part_list = [Particle(self.pos, PVector(0,2), PVector(0,0), pygame.image.load("resources/particles/fireball.png"))]

    def update(self):
        self.particles.extend(self.part_list)
        for p in self.particles[:]:
            p.update()
            if p.is_dead():
                self.particles.remove(p)

    def draw(self, surface):
        for p in self.particles:
            x = p.pos.x
            y = p.pos.y
            temp = pygame.Surface((p.image.get_width(), p.image.get_height())).convert()
            temp.blit(surface, (-x, -y))
            temp.blit(p.image, (0, 0))
            temp.set_alpha(p.life)
            surface.blit(temp, (x, y))

The positions, velocities and accelerations are all part of a vector class with vector math functions.

sentences: My Camera (In Unity) Is Tilting When My Character Moves (2D) I'm trying to use Cinemachine to follow my player and whenever the player moves left or right everything shifts. I'm not sure whats causing this. I have tried giving the camera a Rigidbody2D and locking the Z. This did not work. I have attached what I think may be the appropriate settings. If you know whats causing this please leave me a comment.

sentences: Entity Interpolation (Lost Packets?) I'm working on a networked game for a while. I'm aware of client-side prediction and lag compensation (shooting) but I'm not sure about entity interpolation client-side. I'm sending update/sync packets at 10fps from server and client interpolates from current position to newly received position. Interpolation takes 100ms (because of 10fps) to reach target position but what if new position arrives late or 2-3 packets drop? There will be no target position and sync'd (client-side) entity will be idle until new position packet but entity continuously moving forward server-side. Basically, I don't know what to do in this situation.

sentences: Game only runs at 60fps in windowed mode with a 120hz monitor? In fullscreen the game will run at 120fps fine, the correct refresh rate for the monitor, but in windowed mode it only runs at 60fps.  If I disable VSync then it runs at thounsands of fps so it's not a case of a lack of performance.  I've correctly set the refresh rate in the ModeDescription.

sentences:
Changing transform of ParticleSystem makes it not play? Unity 2018.2.9f1, only 1 script, there is no other code. The scene is very simple (I just started).

I'm working on a mobile game and I'm trying to play a particle effect at the tap location.

I managed to get the particle effect to play, but when I attempt to change transform.position the particle no longer displays at all. I see the TapEffect's GameObject X and Y coordinates being updated in the Editor, but the actual animation is not playing.

This is the script I have attached to my player, the particle is the only child of Player at the moment.

public class Player : MonoBehaviour {

    private ParticleSystem tapEffectParticle;
    private Vector2 touchPos;

    void Start () {
        this.tapEffectParticle = transform.GetChild(0).GetComponent<ParticleSystem>();
    }

    void Update () {
        if(Input.touchCount > 0) {
            Touch touch = Input.GetTouch(0);
            if(touch.phase == TouchPhase.Began) {
                touchPos = touch.position;
                tapEffectParticle.transform.position = touchPos;
                tapEffectParticle.Play();
            }
        }
    }
}

Here is a screenshot of the TapEffect Particle, default particle.

This is a view of the Player GameObject selected.

sentences:
Why does my terrain turn white when I get close to it? When I zoom in on my terrain it goes white:

The further in I zoom, the greater the whiteness becomes. Is this normal? Is this to speed up rendering or something? Can I turn it off?

I'm also getting these error messages in the console over and over again:

  rc.right != m_GfxWindow->GetWidth() || rc.bottom != m_GfxWindow->GetHeight()

and

  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.

Does this bear any correlation on the issue?

Update I create virtual desktops to flit between using the program Deskpot. Turning this program off and restarting has stopped the above errors appearing in the console. However, I still get white terrain when I zoom in. Not a single error message.

I've restarted my computer to no avail.

I have an Asus NVidia GeForce GTX 760 2GB DDR5 Direct CU II OC Edition Graphics Card. Any known issues?

Update I don't think it's fog...

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:
Defining lines from a heightmap To a pixel shader of a 2D game, I'm passing a 1-row heightmap that holds the height in UV coordinates of evenly distributed points throughout the texture I'm drawing, but as for n points there will obviously be n-1 lines connecting consecutive ones, I can't make these lines as wide as they should be.
For example, filling the pixels below the lines of a heightmap that holds 3 values ({0f, 1f, .5f}) should result in something like:

but instead, it looks like this:

It is visible that the correct result lies on the first 2/3 of the second one, and the last 1/3 comes from clamping the heightmap.

Here is a simpler version of the pixel shader code.

float4 PixelShaderFunction(float4 texCoords:TEXCOORD0):COLOR0
{
    float verticesCount = 3;
    float verticesFrequency = 1/verticesCount;

    float lastHeight = tex2D(heightMapSampler, float2(texCoords.x, 0));
    float nextHeight = tex2D(heightMapSampler, float2(texCoords.x + verticesFrequency, 0));

    float delta = (texCoords.x % verticesFrequency)/verticesFrequency;
    float height = lerp(lastHeight, nextHeight, delta);
    if(texCoords.y > height)
        return float4(1, 0, 0, 1);
    return float4(0, 0, 0, 1);
}

I tried multiplying the texture coordinates by (verticesCount-1)/verticesCount but that didn't seem to do the job. Thank you!

sentences:
Animation imported from Maya has interpolation issues I have imported animation from Maya (.fbx) and the curves for the animation in Unity are very different than in Maya. I can clearly notice a flicker for few seconds when I am scaling the object (0 to 1) in loop. The curve for scaling is shown below.
The rest in the animation work fine except for the scale. The problem is that Unity adds interpolation automatically to these curves which is why it creates an issue. I have selected the keys in the curves for the scale attribute and "Both Tangets -> Constant", but it did not have any effect.
How can I fix this?

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:
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:
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:
How do I know if a perspective matrix is right or left handed coordinate system? For example, if I define my perspective matrix as the following:

m[0]  = 1.f / ( aspect * focalLength );
m[5]  = 1.f / focalLength;
m[10] = -zFar / (zFar - zNear);
m[11] = -1;
m[14] = -(zFar*zNear)/(zFar - zNear);

How can I tell if my perspective matrix is right or left handed coordinate system?

sentences:
Server/Client architecture I have high experience In Java and Networking. Our team have built a effective server that can create thread-pools managing many players. But we have hit a brick-wall. The way our server works is that our clients directly all just connect to the server. The client sends information to the server. For example, Client 004 pressed W. And the server calculates and responds. But here's the problem. What exactly do we send over the data stream? Do we send strings and decode them on the client/server side, or serialize objects? Sadly that question is very opinion based. So let me re-phrase it. What data do we send over the stream? For example, you can use W,A,S,D To move around. Im guessing it should look like this.

User Pressed W > Client sends string saying w to server > Server calculates movement > Server sends string saying player position to player > User updates players position.

But then we have to render other players. So we thought about this

User MPressed W > Client sends string saying W to server > Server calculates movement > Server checks if any others players are in the area > Server saves data of all players and yourself into a string and adds positions and sends to client.

Fair enough. But imagine if the server had to send over information, like the other players clothing, their health, mana, position, current animated frame.

The string might look like this:

"Bob, 12, 321, 391.34, 2914.2, Left, 0, False, null, null, sword, null, null"

Just for one player! To be sent over. The string concept is becoming long and tedious.

I have re-wrote this several times. And I still do find it confusing to understand the question myself.

But to shorten it down. How do I create a system where its a mmo really.

We've created the server, client art. We've payed for a large server with ddos protection. But we don't know what to send over the sockets.

sentences:
Why does my player walk animation take so long to begin? I'm new to Unity and after doing some tutorials and reading documentation from Unity, I've started a test project. The game is a 2.5D platformer and I wrote the PlayerController; it looks like this:

using UnityEngine;
using System.Collections;

public class PlayerMovement : MonoBehaviour {

    public float turnSmoothing = 15f;
    public float speedDampTime = 0.1f;

    private Animator anim;
    private Rigidbody rb;
    // Use this for initialization
    void Start () {
        anim = GetComponent<Animator>();
        anim.SetLayerWeight(1, 1f);

        rb = GetComponent<Rigidbody>();
    }

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

    }

    void FixedUpdate()
    {
        float h = Input.GetAxis("Horizontal");
        MovementManagement(h);
    }

    void MovementManagement (float horizontal)
    {
        if (horizontal != 0.0f)
        {
            anim.SetBool("Move", true);
            anim.SetFloat("Speed", 5.5f, speedDampTime, Time.deltaTime);
            Rotating(horizontal);

        }
        else
        {
            anim.SetFloat("Speed", 0.0f);
            anim.SetBool("Move", false);
        }
    }

    void Rotating (float horizontal)
    {
        Vector3 targetDirection = new Vector3(horizontal, 0.0f, 0.0f);
        Quaternion targetRotation = Quaternion.LookRotation(targetDirection, Vector3.up);
        Quaternion newRotation = Quaternion.Lerp(rb.rotation, targetRotation, turnSmoothing * Time.deltaTime);
        rb.MoveRotation(newRotation);
    }
}

My AnimatorController has a BlendTree called Locomotion and looks like this:

When I run the game and use the keyboard or the controller the player starts walking, but it takes a long time (I can see the Speed parameter from the blend Tree that has to reach "5" to start walking)

I think I'm not understanding something but I don't know what it is.

sentences:
XNA hlsl tex2D() only reads 3 channels from normal maps and specular maps Our engine uses deferred rendering and at the main draw phase gathers plenty of data from the objects it draws.

In order to save on tex2D calls, we packed our objects' specular maps with all sorts of data, so three out of four channels are already taken. To make it clear: I am talking about the assets that come with the models and are stored in their material's Specular Level channel, not about the RenderTarget. So now I need another information to be stored in the alpha channel, but I cannot make the shader to read it properly! Nomatter what I write into alpha it ends up being 1 (255)! I tried:

saving the textures in PNG/TGA formats.
turning off pre-computed alpha in model's properties.

Out of every texture available to me (we use Diffuse map, Normal Map and Specular Map) I was only able to read alpha successfully from the Diffuse Map!

Here is how I add specular and normal maps to my model's material in the content processor:

if (geometry.Material.Textures.ContainsKey(normalMapKey))
{
    ExternalReference<TextureContent> texRef = geometry.Material.Textures[normalMapKey];
    geometry.Material.Textures.Remove("NormalMap");
    geometry.Material.Textures.Add("NormalMap", texRef);
}

...

foreach (KeyValuePair<String, ExternalReference<TextureContent>> texture
in material.Textures)
{
    if ((texture.Key == "Texture") ||
        (texture.Key == "NormalMap") ||
        (texture.Key == "SpecularMap"))
        mat.Textures.Add(texture.Key, texture.Value);
}

In the shader I obviously use:

float4 data = tex2D(specularMapSampler, TexCoords);

so data.a is always 1 in my case, could you suggest a reason?

sentences:
Sorting layer issue with multiple sprites and a Tilemap in Unity I have a particle system that draws a blood splat. I have a Tilemap that represents terrain. However, the blood splats, which are on a sorting layer in front of the terrain, are somehow rendered both in front of and behind the terrain.

I have encountered similar problems before where the particles had some different Z value than the terrain, but that is not the case this time (3D view):

Here are the Inspector panels for these objects.
First terrain:

The renderer for the upper (in Y) blood particle system:

And for the lower (in Y) system:

And finally my sorting layers, where Base is behind Foreground:

What might cause this behavior and how can I fix it?
Edit: Here is the entire BloodSplat prefab:

sentences:
Issues using real names in a soccer player game Is illegal to use the real player and team names in a game? When I say game could be and desktop, mobile or fantasy game.

If is illegal, is ok to change a little bit names? Instead of using Messi could I use Messsi (or something similar)?

All gambling and statistics soccer websites have permissions to use those names?

Thanks!

sentences:
Unity - Mecanim & Rigidbody on Third Person Controller - Gravity bug? I'm working on a third person controller which uses physX to interact with the other objects (using the Rigidbody component) and Mecanim to animate the character.

All the animations used are baked to Y, and the movement on this axis is controlled by the gravity applied by the rigidbody component.

The configuration of the falling animation:

And the character components configuration:

Since the falling animation doesn't have root motion on XZ, I move the character on XZ by code. Like this:

    // On the Ground
    if (IsGrounded())
    {
        GroundedMovementMgm();

        // Stores the velocity
        velocityPreFalling = rigidbody.velocity;
    }
    // Mid-Air
    else
    {
        // Continue the pre falling velocity
        rigidbody.velocity = new Vector3(velocityPreFalling.x, rigidbody.velocity.y, velocityPreFalling.z);
    }

The problem is that when the chracter starts falling and hit against a wall in mid air, it gets stuck to the wall. Here are some pics which explains the problems:

Hope someone can help me. Thanks and sory for my bad english!

PD.: I was asked for the IsGrounded() function, so I'm adding it:

    void OnCollisionEnter(Collision collision)
    {
        if (!grounded)
            TrackGrounded(collision);
    }

    void OnCollisionStay(Collision collision)
    {
        TrackGrounded(collision);
    }

    void OnCollisionExit()
    {
        grounded = false;
    }

    public bool IsGrounded()
    {
        return grounded;
    }

    private void TrackGrounded(Collision collision)
    {
        var maxHeight = capCollider.bounds.min.y + capCollider.radius * .9f;
        foreach (var contact in collision.contacts)
        {
            if (contact.point.y < maxHeight && Vector3.Angle(contact.normal, Vector3.up) < maxSlopeAngle)
            {
                grounded = true;
                break;
            }
        }
    }

I'll also add a LINK to download the project if someone wants it.

sentences:
Ray-box intersection problem I try to implement ray-box intersection algorithm given by the following code. However, I'm not really understand for two cases as shown in the following figures. Firstly, when the box is located in front of the ray, why the code give intersection even though the end point of the ray doesn't intersect with the box. A similar observation can be seen from the second case when the ray origin is located inside the box. Is this nature of the algorithm? How can solve this problem?

// r.dir is unit direction vector of ray
dirfrac.x = 1.0f / r.dir.x;
dirfrac.y = 1.0f / r.dir.y;

// lb is the corner of AABB with minimal coordinates - left bottom, rt is maximal corner
// r.org is origin of ray
float t1 = (lb.x - r.org.x)*dirfrac.x;
float t2 = (rt.x - r.org.x)*dirfrac.x;
float t3 = (lb.y - r.org.y)*dirfrac.y;
float t4 = (rt.y - r.org.y)*dirfrac.y;

float tmin = max(max(min(t1, t2), min(t3, t4)));
float tmax = min(min(max(t1, t2), max(t3, t4)));

// if tmax < 0, ray (line) is intersecting AABB, but the whole AABB is behind us
if (tmax < 0)
{
    t = tmax;
    return false;
}

// if tmin > tmax, ray doesn't intersect AABB
if (tmin > tmax)
{
    t = tmax;
    return false;
}

// if tmin < 0 then the ray origin is inside of the AABB and tmin is behind the start of the ray so tmax is the first intersection
if(tmin < 0) {
  t = tmax;
} else {
  t = tmin;
}
return true;

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:
XNA move from start position to target position exactly in 3D If I have a list of positions that map out a path a character should follow. What would be the best way to move at a constant speed to each position making sure the character lands exactly at each position before moving onto the next?

For example the character is at position A, we then queue up position B and position C. The character cannot move towards position C until it reaches position B exactly.

It would be great if the solution worked at slower frame rates/update speeds as well.

sentences:
XNA 4.0 Post-Processing Libraries? Are there any free XNA 4.0 post-processing libraries that are easy to hook into projects? I am looking specifically for a glow effect (although anything is great), and I should also mention that I'm using the Reach profile.

EDIT: I should add that I'm not concerned about the Windows phone, because it can't support custom shaders.

sentences:
Game Object will NOT stretch across entire content area I'm loading prefabs into a content area using a content size fitter and vertical layout group. I've tried multiple things to get the loaded prefabs to stretch across the entire content size (including the Unity Manual for this issue), but I'm at an impass. I'll post a screenshot below to show what I'm working with:

Here's how I'm loading in the prefabs in case this is where i'm screwing up:

void CreateRaceSelect() {

 for (int i = 0; i < races.races.Count; i++) {
     raceButton = (GameObject)Instantiate(raceButtonPrefab);
     raceText = raceButton.transform.FindChild("Text").GetComponent<Text>();

     raceButton.name = i.ToString();
     raceButton.transform.SetParent(content.transform);
     raceButton.GetComponent<RectTransform>().localPosition = new Vector3(xPos, yPos, 0);
     raceText.text = races.races[i].ToString();
     yPos -= (int)raceButton.GetComponent<RectTransform>().rect.height;
    }
 }

I'm sure this is a minor screw up but at this point I have no other ideas.

sentences: How should I store the objects to render? From what I understand, in order to show all elements of a 2D game in the proper way, I need to render them in order, from the further away from the camera to the closest. So I should sort them by depth before displaying them. Since sorting a list 60 times per second seems kinda clunky, would it be a better idea to store the objects to render in a binary search tree? Is there an ideal way to do store these objects? Or did I get something wrong? about this?

sentences:
How can I properly access the components in my C++ Entity-Component-Systems? (What I'm describing is based on this design: What is an entity system framework?, scroll down and you'll find it)

I'm having some problems creating an entity-component system in C++.  I have my Component class:

class Component { /* ... */ };

Which is actually an interface, for other components to be created.  So, to create a custom component, I just implement the interface and add the data that will be used in-game:

class SampleComponent : public Component { int foo, float bar ... };

These components are stored inside an Entity class, which gives each instance of Entity a unique ID:

class Entity {
     int ID;
     std::unordered_map<string, Component*> components;
     string getName();
     /* ... */
};

Components are added to the entity by hashing the component's name (this probably isn't such a great idea).  When I add a custom component, it is stored as a Component type (base class).

Now, on the other hand, I have a System interface, which uses a Node interface inside.  The Node class is used to store some of a single entity's components (as the System isn't interested in using all of the entity's components).  When the System has to update(), it only need to iterate through the Nodes it stored created from different entities.  So:

/* System and Node implementations: (not the interfaces!) */

class SampleSystem : public System {
        std::list<SampleNode> nodes; //uses SampleNode, not Node
        void update();
        /* ... */
};

class SampleNode : public Node {
        /* Here I define which components SampleNode (and SampleSystem) "needs" */
        SampleComponent* sc;
        PhysicsComponent* pc;
        /* ... more components could go here */
};

Now the problem: let's say I build the SampleNodes by passing an entity to the SampleSystem.  The SampleNode then "checks" if the entity has the required components to be used by the SampleSystem.  The problem appears when I need access the desired component inside the Entity: the component is stored in a Component (base class) collection, so I can't access the component and copy it over to the new node.  I've temporarily solved the problem by casting the Component down to a derived type, but I wanted to know if there is a better way of doing this.  I understand if this would mean re-designing what I already have.  Thanks.

sentences:
XNA 4.0 - Normal mapping shader - strange texture artifacts I recently started using custom shader. Shader can do diffuse and specular lighting and normal mapping. But normal mapping is causing really ugly artifacts (some sort of pixeling noise) for textures in greater distance.

It looks like this:

This is HLSL code:

// Matrix
float4x4 World : World;
float4x4 View : View;
float4x4 Projection : Projection;

//Textury
texture2D ColorMap;
sampler2D ColorMapSampler = sampler_state
{
    Texture = <ColorMap>;
    MinFilter = Anisotropic;
    MagFilter = Linear;
    MipFilter = Linear;
    MaxAnisotropy = 16;
};

texture2D NormalMap;
sampler2D NormalMapSampler = sampler_state
{
    Texture = <NormalMap>;
    MinFilter = Anisotropic;
    MagFilter = Linear;
    MipFilter = Linear;
    MaxAnisotropy = 16;
};

// Light
float4 AmbientColor : Color;
float AmbientIntensity;

float3 DiffuseDirection : LightPosition;
float4 DiffuseColor : Color;
float DiffuseIntensity;

float4 SpecularColor : Color;
float3 CameraPosition : CameraPosition;
float Shininess;

// The input for the VertexShader
struct VertexShaderInput
{
    float4 Position : POSITION0;
    float2 TexCoord : TEXCOORD0;
    float3 Normal : NORMAL0;
    float3 Binormal : BINORMAL0;
    float3 Tangent : TANGENT0;
};

// The output from the vertex shader, used for later processing
struct VertexShaderOutput
{
    float4 Position : POSITION0;
    float2 TexCoord : TEXCOORD0;
    float3 View : TEXCOORD1;
    float3x3 WorldToTangentSpace : TEXCOORD2;
};

// The VertexShader.
VertexShaderOutput VertexShaderFunction(VertexShaderInput input, float3 Normal : NORMAL)
{
    VertexShaderOutput output;

    float4 worldPosition = mul(input.Position, World);
    float4 viewPosition = mul(worldPosition, View);
    output.Position = mul(viewPosition, Projection);

    output.TexCoord = input.TexCoord;

    output.WorldToTangentSpace[0] = mul(normalize(input.Tangent), World);
    output.WorldToTangentSpace[1] = mul(normalize(input.Binormal), World);
    output.WorldToTangentSpace[2] = mul(normalize(input.Normal), World);

    output.View = normalize(float4(CameraPosition,1.0) - worldPosition);
    return output;
}
// The Pixel Shader
float4 PixelShaderFunction(VertexShaderOutput input) : COLOR0
{
    float4 color = tex2D(ColorMapSampler, input.TexCoord);

    float3 normalMap = 2.0 *(tex2D(NormalMapSampler, input.TexCoord)) - 1.0;
    normalMap = normalize(mul(normalMap, input.WorldToTangentSpace));
    float4 normal = float4(normalMap,1.0);

    float4 diffuse = saturate(dot(-DiffuseDirection,normal));
    float4 reflect = normalize(2*diffuse*normal-float4(DiffuseDirection,1.0));
    float4 specular = pow(saturate(dot(reflect,input.View)), Shininess);

    return  color * AmbientColor * AmbientIntensity +
            color * DiffuseIntensity * DiffuseColor * diffuse +
            color * SpecularColor * specular;
}

// Techniques
technique Lighting
{
    pass Pass1
    {
        VertexShader = compile vs_2_0 VertexShaderFunction();
        PixelShader = compile ps_2_0 PixelShaderFunction();
    }
}

Any advice? Thanks!

sentences:
Adding some recoil to the Camera so that the crosshair is pushing to the sky (FPS game) I just want to add some recoil to the camera, but I can't find a working script. It's an fps, so I take my mouse axis to rotate the camera. And now I want a pushback to the top, so that the camera looks into the sky after shooting a whole clip. It should be pretty easy, just add some amount to the axis, but it isn't working for me.

I've got something like this from another post, but it just does nothing for me... I got a feeling that my axis is locked in some way, I'm using the "MouseLook" from the standart assets.

transform.Rotate( recoil * Time.deltaTime, 0, 0 ) ;

Update:

This Script is working partially, but I think I reactivate the MouseLook too fast after the Rotate, so that the Mouse just jumps back to the starting position.

 mouseLook.enabled = false;
 transform.Rotate (-5, 0, 0);
 mouseLook.enabled = true;

sentences:
Calling a function from Super is getting an error I am following GameDev.tv's unreal C++ course, but I am getting an error that is causing my compiler to fail.  I'm coding a player controller, and I think I followed all the steps right but when I call the GameHasEnded() function from Super in the playercontroller.cpp, It gets an error saying: anything followed by '::' must be followed by a class or namespace.
Here is my .h file which has no known compiler errors.
    #pragma once

#include "CoreMinimal.h"
#include "GameFramework/PlayerController.h"
#include "ShooterPlayerController.generated.h"

/**
 *
 */
UCLASS()
class SIMPLESHOOTER_API AShooterPlayerController : public APlayerController
{
    GENERATED_BODY()
public:
    virtual void GameHasEnded(class AActor *EndGameFocus = nullptr, bool bIsWinner = false) override;
};

Here is my .cpp file with the problem.
// Fill out your copyright notice in the Description page of Project Settings.

#include "ShooterPlayerController.h"

void GameHasEnded(class AActor *EndGameFocus, bool bIsWinner)
{
    //this is the problem super
    Super::GameHasEnded(EndGameFocus, bIsWinner);
}

I have a lot of other scripts, but I don't think they're related to the problem.  I'm using Unreal 4.26, and Visual Studio 2019. I have no idea why this is getting an error, the code is exactly the same as the instructor’s code.

sentences:
reflecting objects by rendering them to the cubemap I have 2 sphere objects and it isn't reflecting the other one. The picture is when it simply reflects the cube map but when I try to render to the cube map the spheres turn out black.
In camera class:
    void switchToFace(int faceIndex) // For Cube Map camera
    {
        switch (faceIndex)
        {
        case 0:
            m_pitch = 0;
            m_yaw = 90;
            break;
        case 1:
            m_pitch = 0;
            m_yaw = -90;
            break;
        case 2:
            m_pitch = -90;
            m_yaw = 180;
            break;
        case 3:
            m_pitch = 90;
            m_yaw = 180;
            break;
        case 4:
            m_pitch = 0;
            m_yaw = 180;
            break;
        case 5:
            m_pitch = 0;
            m_yaw = 0;
            break;
        default:
            break;
        }
    }

In main
static GLuint createEmptyCubeMap(int width, int height)
{
    GLuint textureID;
    glGenTextures(1, &textureID);

    glBindTexture(GL_TEXTURE_CUBE_MAP, textureID);
    for (GLuint i{ 0 }; i < 6; ++i)
    {
        glTexImage2D(GL_TEXTURE_CUBE_MAP_POSITIVE_X + i, 0, GL_RGB, width, height, 0, GL_RGB, GL_UNSIGNED_BYTE, nullptr);
    }
    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);
    glBindTexture(GL_TEXTURE_CUBE_MAP, 0);

    return textureID;
}
main()
{
// stuff
    glm::vec3 spherePositions[] = {
    glm::vec3(0.0f, 0.0f, 0.0f),
    glm::vec3(-1.5f, -2.2f, -2.5f),
    };
    // new cubemap
    Camera reflectionCamera(glm::vec3(0.0f, 0.0f, 0.0f));  // Camera position. Should be on ball

    GLint imageWidth, imageHeight;
    SOIL_load_image(faces[1], &imageWidth, &imageHeight, 0, SOIL_LOAD_RGB);
    GLuint newEnvironment = createEmptyCubeMap(imageWidth, imageHeight);

    GLuint FBO{}, DBO{};

    glGenFramebuffers(1, &FBO);
    glBindFramebuffer(GL_FRAMEBUFFER, FBO);
    glDrawBuffer(GL_COLOR_ATTACHMENT0);

    glGenRenderbuffers(1, &DBO);
    glBindRenderbuffer(GL_RENDERBUFFER, DBO);
    glRenderbufferStorage(GL_RENDERBUFFER, GL_DEPTH_COMPONENT24, imageWidth, imageHeight);
    glFramebufferRenderbuffer(GL_FRAMEBUFFER, GL_DEPTH_ATTACHMENT, GL_RENDERBUFFER, DBO);

    glViewport(0, 0, imageWidth, imageHeight);

    for (GLuint i{ 0 }; i < 6; ++i)
    {
        glFramebufferTexture2D(GL_FRAMEBUFFER, GL_COLOR_ATTACHMENT0, GL_TEXTURE_CUBE_MAP_POSITIVE_X + i, newEnvironment, 0);

        reflectionCamera.switchToFace(i);
    }

    glBindFramebuffer(GL_FRAMEBUFFER, 0);

    glViewport(0, 0, WIDTH, HEIGHT);

    while(window.isOpen() // SFML)
    {
        glBindVertexArray(sphereVAO);
        for (GLuint i{ 0 }; i < 2; ++i)
        {
            model = glm::mat4();
            model = glm::translate(model, spherePositions[i]);
            glUniformMatrix4fv(modelLoc, 1, GL_FALSE, glm::value_ptr(model)); // modelLoc is location of uniform model
            glActiveTexture(GL_TEXTURE0);
            glBindTexture(GL_TEXTURE_CUBE_MAP, newEnvironment);
            glDrawElements(GL_TRIANGLES, numberOfIndexes, GL_UNSIGNED_INT, 0);
        }
    }
}

The sphereVAO is simply the Vertex Array Object for the sphere and here we bind the texture to the newEnvironment which is supposed to reflect the other object in spherePositions[i]
The picture above is the sphere Position at (0, 0, 0).
But the code results in this:

sentences:
Hardware Fragment Sorting? I'm writing a rendering engine in OpenGL.

I Want to do order independent transparency.

I had heard somewhere that some GPUs have support for actually sorting the fragments of all the objects in the scene based on depth and then drawing them.

I then realized that this feature is likely very important to many people.

Does OpenGL have a built-in fragment sorting algorithm, or access to this hardware?

sentences:
Access buttons individually made by a for loop (old Unity GUI, Unity Editor script) I've got a problem and I am struggling with this for a couple of days now.

I am making an Editor script and I want to access buttons individually when
created by a for loop. There is a public class ButtonNode which stores some variables
of the button like name and size.

public class ButtonNode
{
    public bool button;
    public string name = "O";
    public float sizeW = 25f;

    public void AlterButton()
    {
        name = "P";
    }
}

Then there is my Editor script in which I create the buttons. This is where I get stuck,
how do I access these buttons individually? For example, I want to change the name of the button
when that button is clicked. How do I do that? Because they are booleans (I don't
really know why, this is the legacy GUI) I can't access the transform.name components etc).

public static ButtonNode[] bn = new ButtonNode[10];

void OnGUI()
{
    GUILayout.BeginHorizontal();

    for (int i = 0; i < bn.length; i++)
    {
        bn[i] = new ButtonNode();
        if (bn[i].button = GUILayout.Button(bn[i].name + i, GUILayout.Width(bn[i].sizeW)))
        {
            bn[i].AlterButton();
        }
    }

    GUILayout.EndHorizontal();
}

sentences: Alternative to entity system in a game engine? I have been developing a game engine. I was wondering what I should use for a component system. I've read up on entity component systems, but what other alternatives are there? The idea of searching through a "master list" of all entities in the entire game world seems inefficient and slow. I need the most efficient one possible (3D and 2D, if that matters). Using object oriented programming (C++)

sentences:
Moving pac-man in maze game using objective c I am trying to develop maze game using objective-c, I want to allow moving the pac-man using swipe method, the user can swipe his fingers on the iPhone to indicate where he want PAC-MAN to go but I'm stuck on moving pac_man.
I used UIPanGesture but it can't indicate the collision of ghosts?

Please see the bellow code:

- (IBAction)pacmanmovement:(UIPanGestureRecognizer *)sender {
    CGPoint netTranslation;
    CGPoint translatedPoint = [(UIPanGestureRecognizer*)sender translationInView:self.pacman];

    sender.view.transform = CGAffineTransformMakeTranslation(
        netTranslation.x +  translatedPoint.x,
        netTranslation.y += translatedPoint.y);

    if ([(UIPanGestureRecognizer*)sender state] == UIGestureRecognizerStateEnded) {
        netTranslation.x += translatedPoint.x;
        netTranslation.y += translatedPoint.y;
    }

    [self collisionWithGhosts];
}

- (void)collisionWithGhosts {

    CALayer *ghostLayer1 = [self.ghost1.layer presentationLayer];
    CALayer *ghostLayer2 = [self.ghost2.layer presentationLayer];
    CALayer *ghostLayer3 = [self.ghost3.layer presentationLayer];
    CALayer *ghostLayer4 = [self.ghost4.layer presentationLayer];

    if (CGRectIntersectsRect(self.pacman.frame, ghostLayer1.frame)
        || CGRectIntersectsRect(self.pacman.frame, ghostLayer2.frame)
        || CGRectIntersectsRect(self.pacman.frame, ghostLayer3.frame)
        || CGRectIntersectsRect(self.pacman.frame, ghostLayer4.frame) ) {

        self.currentPoint  = CGPointMake(0, 144);
    }

Any help?

sentences: Get Tile Location On Screen (Java Slick and Tiled2D) I want to create a rectangle around each tile that's blocked value = true. How can I find the X and Y (on screen) coords of the each individual Tile?

sentences:
Moving a Sprite using Mouse in SFML (setOrigin logic needed) I trying to make a card game using SFML. I want to move the card relative to the position the player selects on the card. I managed to check if the card is pressed. However, when I click and drag, the top-left (the origin) of the card is immediately moved to where the mouse is. I tried to set the origin, in the process_events function, to 'event.mouseButton' (both x and y) each time the card is pressed but it moves to the top-left corner of the screen. I spent a lot of time on this. I hope you guys will help me out.

const int card_width = 79;
const int card_height = 123;

Game::Game()
: window(sf::VideoMode(1024, 800), "SFML")
, frame_rate(sf::seconds(1.f / 60.f))
, card(card_sheet, sf::IntRect(0, 0, card_width, card_height))
// 'card' is an sf::Sprite object pointing to an sf::Texture object that holds the sprite sheet.
, selected(false)
{
    card.setPosition(500.f, 400.f);
    card.setOrigin(card_width / 2, card_height / 2);
    // I tried to set the origin to the center of the card.
    // Still doesn't look nice.
}

void Game::process_events()
{
    sf::Event event;
    while (window.pollEvent(event))
    {
        switch (event.type)
        {
            case sf::Event::Closed:
                window.close();
            break;
            case sf::Event::MouseButtonPressed:
                if (event.mouseButton.button == sf::Mouse::Left)
                    if (card.getGlobalBounds().
                                   contains(sf::Mouse::getPosition(window).x,
                                            sf::Mouse::getPosition(window).y))
                    {
                        // the problem is here
                        card.setOrigin(event.mouseButton.x, event.mouseButton.y);
                        selected = true;
                    }

            break;
            case sf::Event::MouseMoved:

                if (selected)
                {
                    // stuff might need to be added here too
                    card.setPosition(sf::Mouse::getPosition(window).x, sf::Mouse::getPosition(window).y);
                }
            break;
            case sf::Event::MouseButtonReleased:
                selected = false;
            break;
            default: break;
        }
    }
}

void Game::update(sf::Time dt)
{
}

void Game::render()
{
    window.clear();
    window.draw(card);
    window.display();
}

void Game::run()
{
    sf::Clock clock;
    while(window.isOpen())
    {
        sf::Time dt = clock.restart();
        process_events();
        update(dt);
        render();
    }
}

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 pass an object location into a vertex shader? I am using Blender Game Engine. I want to create a large flat plane, and deform it locally near a moving object.

So far (despite being a beginner at shaders) I've written a vertex shader for the plane which moves the vertices to their correct positions (constant positions, for now).

I cannot find a way to swap that constant location with an object's location updated every frame, while the shader is running. I am not even sure if it's possible. I only want to access a specific object's center from the shader.

sentences:
How to save Unity assests to another drive? My C:\ volume has almost no space left.
Therefore I want to transfer all my assets to the volume E:/. And save my new assets automatically on the E:/ volume. I have searched very long in unity for save options of unity assets but nowhere found a setting option for this.

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:
Unity Texture Problem http://www.gfycat.com/FlawedLimpingGrizzlybear
http://www.gfycat.com/UnawareQuerulousHawk

Every texture and shader has the same problem. It seems like the problem has nothing to do with either.

Tried all the things my friends suggested I should, reimported everything, restarted my machine, nothing seems to work.

sentences:
Copying a texture's colors to a new texture to create a new sprite Let mySprite be some .PNG sprite:

Texture2D tex = mySprite.texture;
Sprite sprite = Sprite.Create(tex, new Rect(0,0,tex.width,tex.height),new Vector2(0.0f,0.0f),1.0f);

The resulting sprite can be used by a SpriteRenderer just fine. Now, let's do something a bit more redundant:

Texture2D tex = mySprite.texture;
Texture2D tex2 = new Texture2D(tex.width,tex.height);
Color[] colors = tex.GetPixels(0,0,tex.width,tex.height);
tex2.SetPixels(colors);
Sprite sprite = Sprite.Create(tex2, new Rect(0,0,tex.width,tex.height),new Vector2(0.0f,0.0f),1.0f);

All I am doing is create a new texture, copy the original texture's colors, and then used this new texture to create my sprite. However, when I use this sprite with a SpriteRenderer, all I get is a grayish rectangle.

What is wrong with this code?

sentences:
Determine if AI can traverse a given spline I have some AI Agents that I want to navigate along a spline. The agents have a speed and a maximum turning radius. For some splines the curvature is too tight for the AI agents to navigate around and they end up shooting of the spline and then turning, which looks weird. How can I take a given spline and find the segments that are too tightly curved for a given agent to traverse without shooting off?

I thought about just taking the angle between control points, but that alone won't account for the speed limitations that I want to impose as well. Can someone point me in the right direction?

I am using Curvy for my spline implementation but using my own agent movement system to walk along the splines. http://www.fluffyunderware.com/pages/unity-plugins/curvy.php

sentences:
In a shader how to map UV coordinates of texture to the UV coordinates of a tile in a tile set? I am writing a fragment shader for a tile set. In the shader I have the UV coordinates of the whole texture, however, I am interested in the UV coordinates of the current tile that is being rendered. In other words: in my shader I am interested to know where the current pixel is within the current tile, not within the whole texture.
So given the overall texture size and the rectangle that defines the tile to render within that texture, and given the UV coordinates of the current pixel corresponding to the whole texture, how can I convert these UV coordinates to the "inner" UV coordinates of the current tile, but also in the range of [0.0,1.0]?

sentences:
Android 2D terrain scrolling I want to make infinite 2D terrain based on my algorithm.Then I want to move it along Y axis (to the left)
This is how I did it :

public class Terrain {
Queue<Integer> _bottom;

Paint _paint;

Bitmap _texture;

Point _screen;

int _numberOfColumns = 100;
int _columnWidth = 20;

public Terrain(int screenWidth, int screenHeight, Bitmap texture)
{
    _bottom = new LinkedList<Integer>();

    _screen = new Point(screenWidth, screenHeight);

    _numberOfColumns = screenWidth / 6;
    _columnWidth = screenWidth / _numberOfColumns;

    for(int i=0;i<=_numberOfColumns;i++)
    {
        // Generate terrain point and put it into _bottom queue
    }

    _paint = new Paint();
    _paint.setStyle(Paint.Style.FILL);
    _paint.setShader(new BitmapShader(texture, Shader.TileMode.REPEAT, Shader.TileMode.REPEAT));
}

public void update()
{
    _bottom.remove();
    // Algorithm calculates next point
    _bottom.add(nextPoint);
}

public void draw(Canvas canvas)
{
    Iterator<Integer> i = _bottom.iterator();
    int counter = 0;
    Path path = new Path();
    path.moveTo(0, _screen.y);
    while (i.hasNext())
    {
        path.lineTo(counter, _screen.y-i.next());
        counter += _columnWidth;
    }
    path.lineTo(_screen.x, _screen.y);
    path.lineTo(0, _screen.y);
    canvas.drawPath(path2, _paint);
}

}

The problem is that the game is too 'fast', so I tried with pausing thread
with

Thread.sleep(50);

in run() method of my game thread but then it looks too torn.

Well, is there any way to slow down drawing of my terrain ?

sentences:
Any way to track speed of hand movements below iPhone 3.2? I have used the pan gesture for tracking the Pixel-Per-Second (or speed of the movement of the hand) but the real trouble is that the PanGesture library doesn't support any deployment target less than 3.2.

So how would I track the speed of hand movements below a deployment target of 3.2?

sentences: How should the physics be on an halfpipe like in a skate game in Unity? I am making a inline skating game. My player is skating based on the normals of the surface of the ground. But when I skate up a halfpipe it flies in the Air but doesnt comes down like it should be, it changes position in the Air and my player falls horizontally on the ground I cant get up anymore like this when he is lying on the Ground. I want it to be physically jump up and come down again the player should align on the ramp again not just fly in the air and drop down on the ground? What infos should you need to answer this question properly I will edit the question then?

sentences:
Rotate Sprite towards another sprite I have a Sprite class like this:

class Sprite
{
  double rotation ; // in degrees 0-360
  double x;
  double y;
}

I'd like to have one sprite to rotate to another point with a constant rotation rate, the sprite should not rotate directly but mor like "rotate more left, rotate more right"

The reason for this is that I want to implement a homing lethargic missile.

Someone knows the math behind this? :)

sentences: Exporting Fbx from maya to Unity makes the model deformed So I have a female avatar model and I have attached cloth model to it by binding it to skeleton rig. After that copying weights from avatar to the cloth model. Now when i export it as an fbx and open it in unity, it converts the whole model into a deformed shape. I have removed the errors related to scale compensation as well by running the (ScaleCompenstationOff ) mel script in Maya but still no success. Kindly let me know if you guys know of any solution to this problem !!!

sentences:
Unity Random.Range not repeat same position I have this code that generates blocks in random position and it works but some times it generates blocks at the same position ,how can I fix it?

 var dupeobject : GameObject;

 function Start(){
     yield WaitForSeconds(0);
     var position : Vector3 = Vector3(Random.Range(-50,10),Random.Range(-10,5),Random.Range(-100,20));
     Instantiate(dupeobject,position,Quaternion.identity);
     yield WaitForSeconds(0);
     //Destroy(gameObject);
 }

sentences:
How can zoom into my object when that object is being clicked? Suppose that I have the three game(cube,Quard,sphere) object. When I click on a particular game object suppose think I have clicked on the cube,the cube object should get zoomed in on the screen.

how can I do that?

How do I center and zoom into my cube game object after selecting the  cube? I think it has something to do with the camera but how do I center the view with the camera?

I have used the below code for zooming the object.For one object its working.But when I place different object and apply this code then when i click on one object all the three object is getting zoomed.

Can anyone help me out in solving this issue

Here is the code

  function OnMouseDown()
{
 OrthoZoom(1.5);
}
function OrthoZoom(size : float) {
 var cam = Camera.main;

 while (cam.orthographicSize != size) {
     cam.orthographicSize = Mathf.MoveTowards(cam.orthographicSize, size, speed * Time.deltaTime);
     yield;
 }

}

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:
Would it be possible to edit character models of a PS1 game, to be played on an emulator? There are some abandoned PS1 oldies out there that I would love to see revamped with improved assets. I have some skills with some some modelling programs, so I was wondering if it would be possible to rip some models with or without their textures so that I could try to update them, and experience them on an emulator. Is this possible?

Even if the edited copies cannot be reinserted into the game, would it still be possible to rip the models out so that I could edit them?

sentences:
Unity GameView Differrent with CameraView - Dont have 3D environments Now on my existing project, if i create new scene, automatically i got my gameview like below :

above game does not have 3d environments outlook, i'm expecting like below (my old existing scene) :

Any Idea to solve this ?

thanks

sentences:
No project in visual studio using unity created As I have sometimes problems with intellisense in visual studio using unity, I searched for some answers. It was almost everytime pretty much the same: Reloading the project. But in my solution explorer, there is not even a project shown that i could reload.
Are you able to manually create the project or are there some reasons for that behaviour?

ps: I just updated unity from version 2017.3.0f3 to 2018.1.0f2, may that be the problem? (I'm using visual studio 2017 (i'm updating in the moment on version 15.7.1) community)

edit:
What I've tried so far:

Simply re-launching Visual Studio by double-clicking on the script file inside unity (-> DMGregory)
reloading the project
reimport all in the asset-explorer inside unity (S. Tarik Cetin)
deleting the .sln file to force Unity to regenerate them from scratch (-> Ed Marty) + opening the solution from inside Visual Studio

Doing the last point created - as intended - a new solution, but there is still no project created, as you can see in the following picture (Projektmappe = solution). That's how the solution looks like.
While opening the script from Unity, it shows the message in the following picture. Translation: "The following files were stated in the command line: [source path (name censored)] These files were not found and are not loaded."

When trying opening a script from a different (new) Project, it showed the same message, which leads to a new problem: Even in new unity projects, the solution cannot be opened, and the scripts are all assigned to a certain solution ("solution1"), which is the one that was generated. (Even scripts from different projects end up in the same solution!)

So in the moment, I have no idea what else to do. Is there something simple I'm just missing? Or should I reinstall one of the 2 programs?
Or might the update of unity be the problem? (exact versions mentioned above)

If there's any extra information needed, please just mention it in the comments. (I'm not so sure what might be helpful and what isn't)

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:
Character progression through leveling, skills or items? I'm working on a design for an RPG game, and I'm having some doubts about the skill and level system. I'm going for a more casual, explorative gaming experience and so thought about lowering the game complexity by simplifying character progression. But I'm having trouble deciding between the following:

Progression through leveling, no complex skill progression, leveling increases base stats.
Progression through skills, no leveling or base stat changes, skills progress through usage.
Progression through items, more focus on stat-changing items, items confer skills, no leveling.

However, I'm uncertain what the effects on gameplay might be in the end. So, my question is this:

What would be the effects of choosing one of the above alternatives over the others?
(Particularly with regards to the style and feel of the gameplay)

My take on it is that the first sacrifices more frequent rewards and customization in favor of a simpler gameplay; the second sacrifices explicit customization and player control in favor of more frequent rewards and a somewhat simpler gameplay; while the third sacrifices  inventory simplicity and a player metric in favor of player control, customization and progression simplicity.

Addendum: I'm not really limiting myself to the above three, they are just the ones I liked most and am primarily interested in.

sentences:
Drawing Text on a scene I am not sure if I am missing something but I was thinking about how text entities are drawn on a scene, are they drawn with an offset depending on the length of the text? I notice that when I add a new Text element at say new Text(10, 20,..... and the actual text content is 50 words long the text is drawn far over to the right and when I use the same instance with a smaller text content that text is drawn closer to the actual coordinates I need. Should I always recalculate X and Y vectors with respect to the current portion of the scene being shown on the camera?

Words:
      String words = "Hello, I see that your new here. " +
        "Hello, I see that your new here. " +
        "Hello, I see that your new here. " +
        "Hello, I see that your new here. " +
        "Hello, I see that your new here. " +
        "Hello, I see that your new here. " +
        "Hello, I see that your new here. " +
        "Hello, I see that your new here.";

 //method call
 createSpeech( BodyA.getPosition().x, BodyA.getPosition().y, words );

 //method definition
 private void createSpeech(float xVal, float yVal, String ptext) {

    xVal = xVal * GameConstants.PIXEL_TO_METER_RATIO_DEFAULT;
    yVal = yVal * GameConstants.PIXEL_TO_METER_RATIO_DEFAULT;

    speech = new TickerText( 0, 0, ResourceManager.getInstance().font,
            words, new TickerText.TickerTextOptions( 10 ), ResourceManager.getInstance().vertexManager );

    speech.registerEntityModifier( new AlphaModifier( 5, 0.0f, 1.0f ) );
    speech.setBlendFunction( GLES20.GL_SRC_ALPHA, GLES20.GL_ONE_MINUS_SRC_ALPHA );
    speech.setScale( 0.5f );
    speech.setHorizontalAlign( HorizontalAlign.CENTER );
    speech.setAutoWrapWidth( 500f );
    speech.setAutoWrap( AutoWrap.WORDS );

    speech.setPosition( xVal, yVal );

Screenshots:
The Red and orange lines indicate where the text is shown currently, the blue region is where I want the text to be shown. The calculations I used to set the text position and the text itself is shown above

I think the text object itself might have something to do with the offset positioning because when i use a smaller string value the position of the text changes as well

sentences:
How to create a grid based on random shapes? How to create a "grid" using actionscript like the image below?

Basically you have an area of 1100x615 which should be filled with shapes that could be rotated and scaled...

Collision detection perhaps or something less cpu intensive for flash (as3) to manage?

sentences:
Show Camera field of view in minimap but without y axis rotation Here is the function to draw a triangle that represents the camera field of view in a minimap. The problem with this code snippet is that when I rotate up and down (Change the pitch of camera) the viewport triangle also rotates up/down.
void makeViewPortCube()
{
    if (player.GetComponent<Camera>() == null)
    {
        // Debug.LogError("Please assing a Main Camera to Follow");
        return;
    }

    if (viewPortMesh == null)
    {
        viewPortGameobject = new GameObject();
        viewPortGameobject.AddComponent<MeshFilter>().mesh = makeStartingMeshForViewPort(2.0f, 2.0f);
        viewPortGameobject.AddComponent<MeshRenderer>().material = materiaForViewPortGameobject();
        viewPortGameobject.name = "View Port Object";
        viewPortMesh = viewPortGameobject.GetComponent<MeshFilter>().mesh;
        viewPortGameobject.layer = LayerMask.NameToLayer("MiniMap");
        viewPortGameobject.transform.position = new Vector3(viewPortGameobject.transform.position.x, /*transform.position.y-*/100, viewPortGameobject.transform.position.z);
    }

    // change vertices of the viewport
    Vector3[] aVertexList = viewPortMesh.vertices;

    if (stopRotation == false)
    {
        //Orignial
        aVertexList[1] = player.GetComponent<Camera>().ScreenToWorldPoint(new Vector3(Screen.width, 0, 10f));
        aVertexList[2] = player.GetComponent<Camera>().ScreenToWorldPoint(new Vector3(Screen.width, 0, player.GetComponent<Camera>().nearClipPlane));
        aVertexList[3] = player.GetComponent<Camera>().ScreenToWorldPoint(new Vector3(0, Screen.height / 4, player.GetComponent<Camera>().nearClipPlane));

        aVertexList[0] = player.GetComponent<Camera>().ScreenToWorldPoint(new Vector3(0, Screen.height / 4, 10f));

        for (int i = 0; i < 4; i++)
        {
            aVertexList[i].y = 3;
        }
    }

    viewPortMesh.vertices = aVertexList;
    viewPortMesh.RecalculateBounds();
}

sentences:
Can a character interact well with surroundings in-game? I don't have any experience in game programming, but I am currently on programming-related degree, although on a different branch to game design.

I thought about how an environment can come more alive with player movement. For example, currently in many games once you hit a wall you would continue walking into that wall in one spot. I wanted to know, if there is a possibility to make interaction instead, etc. program a certain way to push towards the wall and listen, or lean against the wall, depending on joystick feedback. I wanted to push this even further to how player interacts with an object. For example, walking into a chair wouldn't just make the character be stuck on walking into the chair, but also make certain interactions like a strong fall if player runs into it and make the body of the player respond to what's happening as well. A further example would be placing something heavy on a chair for example, like a rock, and then if a player tries to push it requires more force which builds up, makes the chair make heavier sounds, and have the rock slightly rocking with the force.

Is this at all feasible in gaming and doable for a project? I have no experience in games, so it is hard to say what can be realised with today's tools like Unity or Unreal Engine.

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: 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:
Body's initial velocity is too fast when created after minimax algo I don't know if my question is right but I cannot address the real problem.
I am dropping connect 4 game chips under gravity but when I apply minimax with a depth of 3, it starts with great velocity.
My code for render loop is:

private List<List<Chip>> chips;

public void render(float delta){
    world.step(1/60f, 6, 2);
    Gdx.gl.glClearColor(0, 0, 0, 1);
    Gdx.gl.glClear(GL20.GL_COLOR_BUFFER_BIT);
    game.batch.begin();

    for(List<Chip> chipList: chips){
        for(Chip chip: chipList) {
            chip.setPosition(chip.getBody().getPosition().x-chip.getRadius(), chip.getBody().getPosition().y-chip.getRadius());
            chip.draw(game.batch);
        }
    }

    if(chipready){
        chip.createBody();
        chips.get(yellowIndex).add(chip);
        chip.draw(game.batch);
        chipready = false;
    }

    game.batch.end();
}

Here Chip is a subclass of Sprite.

Code for my contact listener:

    world.setContactListener(listener = new ContactListener() {
        @Override
        public void beginContact(Contact contact) {
            Fixture fixA = contact.getFixtureA();
            Fixture fixB = contact.getFixtureB();
            if (fixA.getUserData() == "chip" && fixB.getUserData() == "floor" || (fixA.getUserData() == "floor" && fixB.getUserData() == "chip"){
                yellowIndex = BestMove.minimaxutil( board, AI_PIECE);
                chip = new Chip(world, x, y, radius);
                chipready = true;
            }
        }
    }

sentences:
How to handle re-rendering a scene in my custom game engine? I have a very simple game engine. A GameObjectManager stores a collection of all the GameObjects. When I want to render, I just call GameObjectManager.render() from the rendering context.

This works well for rendering most objects, but now I am looking to add a water shader to the scene where it takes in reflection and refraction textures. The reflection and refraction textures will be computed each frame by re-rendering the scene from a new perspective. Unfortunately, my design choice of having a single GameObjectManager to store all GameObjects just won't work for this - it wouldn't make sense to store a GameObject for the water in the GameObjectManager.

What is a good game engine design pattern to handle re-rendering the scene for an effect such as a reflection?

sentences:
Root Animation unusual position and non root animation snaps back Im trying to do a stop animation . when i release the W key then from Run it will do this animation then goto IDLE . But somehow this is not working right. as you see in those videos below. So how do i achieve this ?

Im using animation from mixamo.

After Root Motion http://i.imgur.com/JwY98P2.gifv

Before Root Motion  https://fat.gfycat.com/ReflectingMealyCrane.mp4

sentences:
Programming with Python in a recent version of Minecraft I've been teaching Python programming to a friend's son using the book Adventures in Minecraft. This book comes with a starter kit that contains a pre-configured Bukkit (v.1.6.4) server, and targets Minecraft 1.6.4.

My friend's son would like to use a more recent version of Minecraft, unfortunately Bukkit is no longer maintained.

Is there another way to use Python with Minecraft? I've googled a bit but without success. I'm not a player of Minecraft myself so there is a lot of Minecraft terminology that I don't understand.

Thanks

sentences:
How'd they do it: sphere effects in Osmos I'm curious how the sphere effects were done in Osmos from Hemisphere Games.  Any ideas how the resolution independent zoom in was achieved?

Edit, more specifics on questions:

How do you render the spheres so they look good at full zoom out, and full zoom in?
How would one make the nice particle effects in 100's of spheres all at once?
How to construct your scene/spheres so the big spheres look round even at full zoom?

Gameplay video

Hemisphere Games

sentences:
Sharpdx 2D Camera not moving I am trying to move a camera to the right, but it isn't moving.

i use this code to move:

Camera.Position.X = gameobject.transform.Position.X;

This is the camera code that i use to create Matrix3x2

        public Vector2 Position = new Vector2();

    float Rotation = 0;

    public float Zoom = 1;

    public Vector2 ViewportCenter { get { return new Vector2(ViewportWidth * 0.5f, ViewportHeight * 0.5f); } }

    public Matrix3x2 GetTransform3x2()
    {
        return Translation;
    }

    private Matrix3x2 Translation
    {
        get
        {
            return Matrix3x2.Translation(Position) *
                   Matrix3x2.Rotation(Rotation) *
                   Matrix3x2.Scaling(Zoom, Zoom) *
                   Matrix3x2.Translation(ViewportCenter);
        }
    }

This is the code that i use to render

        public void DrawGameobjects(Gameobject[] gameObjects)
    {
        RawMatrix3x2 CameraPosition = new RawMatrix3x2();

        foreach (Gameobject Gameobject in gameObjects)
        {
            if (Gameobject.Enabeld == true)
            {
                foreach (object Component in Gameobject.Components)
                {
                    //render 2D
                    if (Component is Sprite)
                    {
                        RawMatrix3x2 CurrentTransform = renderTarget.Transform;
                        Sprite NewSprite = Component as Sprite;
                            Bitmap Texture = Game.bitmapManager.GetTexture(NewSprite.texture.TexturePath);
                            RawRectangleF PositionRectangle = new Rectangle(new Point(0, 0), new Size(NewSprite.texture.TextureSize * Zoom)).ToRawRectangleF();
                            float Transparency = NewSprite.Transparency;
                            RawRectangleF ImageRectangle = new Rectangle(new Point(0, 0), new Size(NewSprite.texture.TextureSize * Zoom)).ToRawRectangleF();
                            Vector2 NewScale = (Vector2)Gameobject.transform.Scale;
                            Matrix3x2 Translation = Matrix3x2.Translation((Vector2)Gameobject.transform.Position);
                            Matrix3x2 Rotation = Matrix3x2.Rotation(Gameobject.transform.Rotation.X);
                            Matrix3x2 Scale = Matrix3x2.Scaling((Vector2)Gameobject.transform.Scale);
                            renderTarget.Transform = (Translation * Rotation * Scale).ToRawMatrix3x2();
                            renderTarget.DrawBitmap(Texture, PositionRectangle, Transparency, BitmapInterpolationMode.NearestNeighbor, ImageRectangle);
                            //renderTarget.Transform = CurrentTransform;

                    }

                    if (Component is Camera2D)
                    {
                        CameraPosition = (Component as Camera2D).GetTransform3x2().ToRawMatrix3x2();
                    }
                }
            }
        }

        renderTarget.Transform = CameraPosition;

    }

Everything moves except the camera

sentences:
Unity UI glitches while loading I have the following scene canvas elements:

 left panel
     character game object
 right panel
     option panel - vertical layout group, content size fitter
         slider panel - vertical layout group, content size fitter
             input panel - horizontal layout group, content size fitter
                 text
                 slider
             input panel - horizontal layout group, content size fitter
                 text
                 slider
         button

After I hit play, the button's Y position is wrong but corrects itself after a brief second. Why is this happening and how do I fix it?

Here is a gif:

sentences:
What should i use as a board for my game? I'm a beginning programmer and i need to make a game. The rough idea revolves around fleets fighting in turn based battles while you control your factions resources and manpower.

The original concept was to make a set of routes which the fleet could follow. A graph of location nodes connected by route edges that looks a bit like this:

I don't know how to make a map and make set locations on it.

On that note, i'm making this is html/javascript/css. This is a school assignment.

sentences:
How to get the source code for a game? I read here a spectacular story of someone (scrappily) fixing some things in a game's source code, making it load 4 times faster!
How did the developer get the source code in the first place? Is there a common pattern to getting game source code?
Link to the GitHub repository talked about in the article: https://github.com/tostercx/GTAO_Booster_PoC

sentences:
How can I find the minimal texture size so the texture requires no pixel interpolation when transformed by a given matrix? Given a rectangle with width x and height y, and a transformation matrix T: How can I estimate the minimal resolution of the texture (that is, its width and height) such the interpolation of additional pixels won't be needed?

Simple example: If x = 200px, y = 150px and T is a 2× scale matrix, then the required resolution is 400×300.

How can I do this for more complex cases, such as perspective projection?

sentences:
Why Does unity_LightPosition[0] Seem to Depend on Camera Position? I'm trying to write a fairly basic shader but I keep running into lighting issues with Unity.  My first problem was trying to figure out which variable stored the light's position in world space.  (I'm only working with one light, at least at the moment).

I finally found something that responds to movement of my light source: unity_LightPosition[0].  However the shader still didn't do what I wanted it to do, so I did some debugging:

I have a basic vertex and fragment shader and what I'm currently doing in the fragment shader is:

float4 c = float4(0, 0, 0, 1);
float3 lp = normalize(unity_LightPosition[0]);
c.rgb = lp;
return c;

This should just set the color of my object to the normalized position of the light source, correct?  What I see in my scene is my object changes colors when I move my camera around it (I'm not moving the light source at all, it is a separate entity).  The color also seems to increase in strength as I zoom in.

To me, it seems as if unity_LightPosition[0] is related to my camera's position, as well as orientation and zoom level, yet the documentation I've found says it should represent the position of the light in world space.

I tried switching to using the following:

float3 lp = float4(
    unity_4LightPosX0[0],
    unity_4LightPosY0[0],
    unity_4LightPosZ0[0],
    1.0
);

...but that only colors my object red regardless of the light's actual position.

Additionally, I've set the LightMode tag to Vertex.

It seems like simply getting the world position of the light source shouldn't be this difficult.  What am I not doing correctly?

EDIT:
I've been playing around with the camera and light position and I think that unity_LightPosition[0] actually puts out position in the projection space.  If I place the light source in the lower-left corner of the screen, the object is black.  Upper-left the object is green (0, 1), upper-right is orange (1, 1), and lower-right is red (1, 0).  When I place it in the lower-left (0, 0) and move the camera in front of it, it becomes blue.  This is consistent with the depth value behavior.  (0, 0, >0) would appear as blue.

Now, how to get it from projection back to world?...or should I use a different variable?

sentences:
Libgdx - accelerating string displaying My renderBoard is slow and it's because of font.draw function. I read that I should use stringBuilder instead of string, but it didn't help at all. I suppose I'm using it wrong. Could you guide me to the right way?

public void renderBoard(SpriteBatch sb, BitmapFont font) {
    int L = 0;
    String string;
    ...
    // "size" is a private variable of the class, the same goes for "stringBuilder"
    for(int k = - size + 1; k <= size - 1; k++) {
        for (int j = 1; j <= size - Math.abs(k); j++) {
            string = L + "";
            for(int g = 0; g < string.length(); g++) {
                stringBuilder.setCharAt(g, string.charAt(g));
            }
            sb.draw(
                    this.getTexturesArray().get(L),
                    x_j_k_position,
                    y_j_k_position
            );
            font.setColor(Color.WHITE);
            font.draw(
                    sb,
                    stringBuilder,
                    x_j_k_position,
                    y_j_k_position
            );
            L++;
        }
    }
}

If I comment out the font.draw line, the game accelerates, so I guess here lies the problem.

sentences:
Text-based hold 'em game in C using TCP So I'm trying to create a simple text input Texas Hold 'Em game that can be played in a Terminal between multiple computer. (Disturbing lack of hold 'em games that don't require Facebook integration or a million ads or micro transactions :c )

With my current knowledge I can create the TCP Server and Connect some clients, but I'm not sure how to proceed from here. How can I communicate between the clients and server turn by turn using text input effectively?
My vague idea of what to do is

Accept clients, store FD in Array
Loop through Id's sending them 2 cards each
Create thread with a game info struct, that reads users text input
Wait for thread to finish and return value will be the players move
Update game info, and move repeat step 3-4 for all Clients
Break whenever only 1 player is left, or all bettings phases are over then repeat

This outline makes sense in the server, but I'm not sure how to construct the client to not do anything until it gets prompted by the thread creation in the main server while loop. If anyone has any advice or links to helpful articles or example code I would really appreciate it thanks so much!!

sentences:
How to check a value from the last frame, while using events in Unity What I am trying to do is check if a value has changed from the last frame, while using events. Typically I could use threading to my advantage and have a check at the bottom of Update() to see if a value that is typically changed higher up in Update() was changed or not.

However, I am programming with Events, and I don't rely on Update() in several classes to change data. When an event is published, it makes method calls to all methods subscribing to that event. CameraUpButton() is called by the event manager, not by Update(). ClearUp() is called from Update().

I want to see how long an event has been constantly published for, essentially seeing how long the up button has been held. Checking how long it has been held is the easy part, clearing it once the button is no longer held is the hard part since I do not know how to see when an event stopped publishing (I don't know if that is even possible?). So I'm resorting to making some logic to figure it out for me.

In this case:

 private int up;
 private void CameraUpButton()
 {
     up++;
     Vector3 cameraPos = Camera.main.transform.position;
     cameraPos.y += 0.01f;
     Camera.main.transform.position = cameraPos;
 }

 private void ClearUp()
 {
     some logic to determine
     if up has changed since the last frame
 }

Edit: I can make a Input.GetButtonUp("") event, however I want to see if this can be solved without relying on an event triggered by the button coming up. I would prefer if it can be solved without that reliance.

sentences:
Handle floating point precision errors in collision detection and resolution I am experimenting with a continuous collision detection and response of points on a tile map.
This are my results for now:

I did this by shooting a ray (red line) from the current position (red circle) to the target position (green circle) and check all tiles which are on it using this algorithm.
If the ray hits a solid tile I calculate the exact postion of the collision (yellow circle) and a new target positition depending whether the ray hit the solid tile vertically or horizontally in the other case I can simply set the current position to the target position and be finished because no collision occurred.
Now I am shooting a second ray (blue line) to this new target position and check again for solid tiles on it.
If a collision occurerd I set the current position to the ray hit position (cyan circle) and be finished.
In the other case I only set the the current position to the new target position (cyan circle) because no collision occurred this time.

Here the most important source code:

void update(float start_x, float start_y, float target_x, float target_y, float *corrected_x, float *corrected_y)
{
    float hit0_x;
    float hit0_y;
    LineTraceResult res0 = line_trace(start_x, start_y, target_x, target_y, &hit0_x, &hit0_y);

    switch (res0)
    {
        case LINE_TRACE_NONE:
        {
            // No collision occurred so the target position is valid and we can move to it.
            *corrected_x = target_x;
            *corrected_y = target_y;
        }
        break;

        case LINE_TRACE_VERT:
        {
            // We hit a solid tile on the vertical edge.
            *corrected_x = hit0_x;
            *corrected_y = target_y;

            float hit1_x;
            float hit1_y;
            LineTraceResult res1 = line_trace(hit0_x, hit0_y, *corrected_x, *corrected_y, &hit1_x, &hit1_y);

            if (res1 != LINE_TRACE_NONE)
            {
                // There was a second collision on the corrected position so we need to adjust it.
                // Because the x axis did not changed we don't need to change it.
                *corrected_y = hit1_y;
            }
        }
        break;

        case LINE_TRACE_HORI:
        {
            // We hit a solid tile on the horizontal edge.
            *corrected_x = target_x;
            *corrected_y = hit0_y;

            float hit1_x;
            float hit1_y;
            LineTraceResult res1 = line_trace(hit0_x, hit0_y, *corrected_x, *corrected_y, &hit1_x, &hit1_y);

            if (res1 != LINE_TRACE_NONE)
            {
                // There was a second collision on the corrected position so we need to adjust it.
                // Because the y axis did not changed we don't need to change it.
                *corrected_x = hit1_x;
            }
        }
        break;
    }

So in theory this all works great but in practice there are a lot of problems caused by the limited precision of floats.

For example in this two cases:

One approach to "solve" this problem is to add some kind of padding often named Epsilon every time a collision occurs but this method seems to me not very accurate and dirty.

So I am wondering how all the professional game developers are solving this kind of problem?

EDIT:
This problems occurre because the hit position calculated by the ray can not be 100% exact so it could be for example that the y coordinate gets rounded from 6.9999 to 7.0001 and 6.9999 means tile 6 and 7.0001 means tile 7 so its a huge difference.

sentences:
How can I set up a 2D circular boundary in Unity? I wanted to create a virtual analogue stick on Unity.

I figured a very simple, 2 part method setting up a tether to the middle of a doughnut-container and a boundary would work. While the tether was quickly solved just by using Vector2.MoveTowards, the boundaries would be much harder to solve.
I initially tried to create a 2D circle collider around the doughnut-container but I didn't know how to reverse its collisions to keep the cursor inside. Later, I tried to set up a square shaped boundary by setting up the limits of the x and y coordinates the cursor cannot exceed (these limits were also made according to the doughnut-container). Thus was done with multiple if statements:
 if (currentPoint.y >= 2.7f){currentPoint.y = 2.7f;}
 if (currentPoint.x >= 2.5f){currentPoint.x = 2.5f;}
 if (currentPoint.y <= -2.7f){currentPoint.y = -2.7f;}
 if (currentPoint.x <= -2.5f){currentPoint.x = -2.5f;}

However, when testing the code out, the cursor still exceeded the boundaries given:

Minimum reproducible code for the cursor:
public class menuScript : MonoBehaviour
{
    public float speed;
    public Vector2 originPoint;
    private Vector2 currentPoint;
    // Start is called before the first frame update
    void Start()
    {
        Vector2 originPoint = transform.position;
    }

    // Update is called once per frame
    void Update()
    {
        currentPoint = transform.position;
        float step = 50 * Time.deltaTime;
        float vertical = Input.GetAxis("Vertical") * Time.deltaTime * speed;
        float horizontal = Input.GetAxis("Horizontal") * Time.deltaTime * speed;

        if (horizontal != 0 || vertical != 0)
        {
            transform.Translate(horizontal, vertical, 0);
            if (currentPoint.y >= 2.7f){currentPoint.y = 2.7f;}
            if (currentPoint.x >= 2.5f){currentPoint.x = 2.5f;}
            if (currentPoint.y <= -2.7f){currentPoint.y = -2.7f;}
            if (currentPoint.x <= -2.5f){currentPoint.x = -2.5f;}
        }
        else
        {
            transform.position = Vector2.MoveTowards(transform.position, originPoint, step);
        }
    }
}

sentences:
How to use the Vulkan graphics backend in the Stride game engine? What do I have to do in order to run my Stride game on the Vulkan graphics platform?

The documentation section seems to be outdated, the drop-down doesn't exist anymore:
https://doc.stride3d.net/latest/en/manual/platforms/index.html#set-the-graphics-platform

sentences:
What are good puzzle game interface design principles? I'm building a prototype puzzle game at the moment. I'm just curious as to the principles behind building graphic interfaces within games.
At the minute I'm looking at designing the graphics for an interface in something like Illustrator. I'm looking at one graphic (650 x 650 px) that incorporates the play area (400 x 550 px) as a blank square, with a nice border on the right hand side (vertically down the screen) and a border along the bottom too. I'm leaving a "blank" rectangle on the vertical border to incorporate a timer into it, and three "blank" squares along the bottom to incorporate icons to represent lives or power-ups or something, which I'll design later and animate later.
Is this an acceptable/sensible approach?

sentences:
Flipped camera with Google VR I just imported latest Google VR SDK into Unity and made a simple scene that has only Main Camera, plane, and single zombie just standing there with T-Pose.

In Main Camera, I added GvrPointerPhysicsRayer component, and it has GvrReticlePointer as child object.

Running in Unity Editor seems fine but when I build and run, whole world is just flipped.

I can't find any related issues about this anywhere, and struggle with this almost a day.

Why camera flipped and how do I fix it? What am I missing?

Using Unity 2019.1.0f2 and gvr-unity-sdk@1.200. Any advice will very appreciate it.

P.S. I saw the warning message in project settings - default orientation:

  Virtual Reality Support is enabled. Upon entering VR mode, landscape left orientation will be the default orientation unless only landscape right is available.

This message never disappear whatever default orientation selected.

sentences:
Setting a uniform float in a fragment shader results in strange values, is this a type conversion? How can it be fixed? First, some details:

I'm learning OpenGL from the tutorials on https://open.gl
My computer is running Linux Mint 18.1 Xfce 64-bit
My graphics card is a GeForce GTX 960M
OpenGL Version: 4.5.0 NVIDIA 375.66
GLSL Version: 4.50 NVIDIA
Graphics Card Driver: nvidia-375 Version: 375.66-0ubuntu0.16.04.1
CPU: Intel Core i7 6700HQ
The code I'm working on can be found here: https://github.com/Faison/sdl2-learning/blob/8a61032d20edf91cfa60f665e1bb4d72e58f634b/phase-01-initial-setup/main.c (Makefile is located in the same directory)

In a fragment shader, I'm trying to make an image do a sort of "flipping mirroring" animation (lines 44-57):

#version 450 core
in vec3 Color
in vec2 Texcoord;
out vec4 outColor;
uniform sampler2D tex;
uniform float factor;
void main() {
 if (Texcoord.y < factor) {
    outColor = texture(tex, Texcoord) * vec4(Color, 1.0);
  } else {
    outColor = texture(tex, vec2(Texcoord.x, 1.0 - Texcoord.y));
  }
}

When factor is 1, the image should be right-side up and has some color on it.
When factor is 0, the image should be upside down and has no color added to it.
When factor is 0.5, the top half should be right-side up and the bottom half should be upside down.

Currently, that is only the case if I replace factor with the number.

When I set the uniform factor with glUniform1f(), I'm getting very strange results. To illistrate, I added some debug code to lines 188-197 that sets the uniform with one number, retrieves the number from the uniform, and outputs both values to try and see what's going on.

Here's the code:

GLfloat factorToSet = 1.0f;
GLfloat setFactor = 0.0f;
GLint uniFactor = glGetUniformLocation(shader_program, "factor");

while (factorToSet > -0.1f) {
  glUniform1f(uniFactor, factorToSet);
  glGetUniformfv(shader_program, uniFactor, &setFactor);
  printf("Factor of %.1f becomes %f\n", factorToSet, setFactor);
  factorToSet -= 0.1;
}

And here are the results:

Factor of 1.0 becomes 0.000000
Factor of 0.9 becomes -2.000000
Factor of 0.8 becomes -0.000000
Factor of 0.7 becomes 2.000000
Factor of 0.6 becomes 0.000000
Factor of 0.5 becomes -0.000000
Factor of 0.4 becomes 2.000000
Factor of 0.3 becomes -36893488147419103232.000000
Factor of 0.2 becomes 0.000000
Factor of 0.1 becomes 36893488147419103232.000000
Factor of -0.0 becomes -0.000000

So with what little I understand about OpenGL and the way scalar types are stored in binary, I'm thinking that this issue is caused my GLfloat getting converted into something else on the way to the shader's uniform float. But I'm grasping at straws.

What could be causing this strange conversion between the number I send to the uniform float and the value that the uniform float becomes? What could I do to fix it if it's possible to fix?

Thanks in advanced for any help and leads, I really appreciate it :)

An additional note after receiving a working answer

George Hanna provided a link to a post where someone had a similar issue. I read over the comments and someone said to use -DGL_GLEXT_PROTOTYPES as a CFLAG. So I rolled back my local code to use glUniform1f() again, added -DGL_GLEXT_PROTOTYPES to the Makefile, and everything worked! Even crazier, all the compiler warnings I had for implicit declarations of OpenGL functions were gone!

So in addition to the answer below, if you have this issue, try adding -DGL_GLEXT_PROTOTYPES to your CFLAGS.

(You can also get this affect by adding #define GL_GLEXT_PROTOTYPES before any OpenGL #includes)

sentences:
MonoGame sprites not consistently drawing Please don't mark this as a duplicate of my previous question which was asked anonymously. this is a reattempt because i cannot edit the first attempt.

What I have so far is:
- randomly generated tile set with items on SOME tiles
- one creature spawner that spawns up to 5 creatures which can be controlled by the player
- the ability for creatures to pick up items and bring them back to the spawn and store them for later use

What I am noticing is when i launch the game, it doesnt always show all the sprites. Sometimes the spawner is missing, or the creatures, or the GUI. ANd when things DO appear, if i tell the creatures to pick up anything, other items on the ground randomly appear and disappear. even the spawn sometimes disappears! what I do notice is that when i have multiple creatures, some will disappear when crossing invisible lines but not all of them. i forced two creatures to go east at the same speed and time, and one vanished and the other didnt.

If you have any ideas as to what might be causing this, please let me know. if you have any questions, i'll try to edit to appease you.

thanks for reading!

I have my draw method like this:

GraphicsDevice.Clear(Color.CornflowerBlue);

// TODO: Add your drawing code here

spriteBatch.Begin(SpriteSortMode.BackToFront,
          null, null, null, null, null,
          camera.GetTransformation());

worldEntity.Draw(spriteBatch);

guiManager.DrawGUI(spriteBatch);

spriteBatch.End();

base.Draw(gameTime);

for the world entity...
its draw method systematically goes through each tile in the world and calls its draw method.
the tile draws itself using

Vector2 topLeftOfSprite = new Vector2(this.X, this.Y);
Color tintColor = Color.White;
spriteBatch.Draw(tileTexture, topLeftOfSprite, tintColor);

and then proceeds to call the draw method of any items on it.

creatures and items have very similar draw methods.

the gui also draws itself in a similar fashion.

what i DO notice is that ive NEVER seen ground tiles vanish, only the items on them or creatures in the world. Could it be their Z isn't set appropriately?

sentences:
Help needed, following Unity multiplayer Health-Bar tutorial. Only working on Server Host instance of the game was really hoping someone can be good enough to look over my code, I've been trying to fix it for several days. I followed the Unity tutorial which is fairly basic but the bit that confuses me (and potentially where the problem lies) is the:

 if (!server){return;}

part at the top of my TakeDamage() function.

The problem im seeing is that once I get to that part of the tutorial, the bullet fired by the Host is registered against the other player and I can see his health has gone down (great so far!) , but when I load the instance in the editor (i did running another standalone on my laptop and connect to internet matchmaking but the same thing occurs) his bullets are not registered (even though my debug log tells me the Ray did hit the player.

The tutorial tells me to make it return if not server, it then uses [SyncVar] and a hook that is supposed to call the method "OnChangeHealth" whenever currentHealth is changed.
This DOES NOT appear to be happening, and the TakeDamage code is only happening on the Server-Client-Host instance.

I was trying to adapt the tutorial to my own game, so there are some slight differences in the function and class names, but to me it looks to be exactly the same functionality-wise. I will have to just post my full code here as I don't know which part is causing the issue:

(MANY THANKS FOR READING  AND/OR HELPING):

the Player class:

public class Player : NetworkBehaviour {
private GameObject startScreen;
public const int maxHealth = 100;

[SyncVar(hook = "OnChangeHealth")]
public int currentHealth = maxHealth;

private float playerHeight;
private AudioSource audioSource;
public AudioClip painBodySound;
public AudioClip painHeadSound;
public AudioClip painHeadSound2;
public RectTransform healthBar;

void Start () {
    startScreen = GameObject.FindGameObjectWithTag("StartScreen");
    if (startScreen != null)
    {
        startScreen.SetActive(false);
    }
    playerHeight = GetComponent<Collider>().bounds.size.y;
    currentHealth = maxHealth;
    audioSource = GetComponent<AudioSource>();
}

void Update () {

    if (!isLocalPlayer)
    {
        return;
    }
    if (Input.GetKey(KeyCode.LeftControl))
    {
        transform.localScale = new Vector3(1, 0.5f, 1);
    }
    else
    {
        transform.localScale = new Vector3(1, 1f, 1);
    }
}

public void TakeDamage(Vector3 hitPoint, int bulletDamage)
{
    // check that its Server so that damage only gets applied on the server
    if (!isServer)
    {
        return;
    }
    currentHealth -= bulletDamage;
    audioSource.PlayOneShot(painBodySound);
    if (currentHealth <= 0)
    {
        currentHealth = 0;
        Debug.Log("Dead!");
    }
}
private void OnChangeHealth(int health)
{
    healthBar.sizeDelta = new Vector2(health, healthBar.sizeDelta.y);
}

}

Inside the bullet class is this function:

private void CastBulletRay()
{
    ray = new Ray(bulletSpawnPos, bulletSpawnDirection);
    if (Physics.Raycast(ray, out hit, bulletRayDistance))
    {
        if (hit.collider.tag == "Baddie")
        {
            Debug.Log("ray has hit a baddie");
            Destroy(gameObject);
        }
        if (hit.collider.tag == "Player")
        {
            Debug.Log("ray has hit a player");
            hit.collider.gameObject.GetComponent<Player>().TakeDamage(hit.point, bulletDamage);
            Destroy(gameObject);
        }

    }
}

and inside The Unity RigidBodyController class I'm using, I added:

    [Command]
    void CmdFireBullets()
    {
        muzzleFlashObject.SetActive(true);
        audioSource.PlayOneShot(gunFireSound, 0.2f);
        //Create a new bullet
        GameObject newBullet = Instantiate(bulletPrefab, bulletSpawnPoint.transform.position, bulletSpawnPoint.transform.rotation) as GameObject;

        //Spawn the bullet on the clients:
        NetworkServer.Spawn(newBullet);
    }
}

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:
Java clicking on tiles detection I am making small isometric game, where I want to do something when user clicks a tile. I can simple do it by mouse location, but I want to be able for zooming and moving camera. It will be 2D game using Java awt. I will be printing grid with the diamond style. Can I make that I will make object of the tile map and locate the mouse whatever the camera is?

Thanks for any help, Maratonec.

sentences:
Design pattern for animation sequence in LibGDX What design pattern to use for sequence of animation that involve different actor in libGDX. For example I am making a game to choose a wolf from a group of sheeps. The first animation played when the game begin is the wolf enter the field that is filled with two sheeps.Then the wolf disguise as a sheep and goes to the center of the screen. Then the game will shuffle the sheeps. After it finished it will ask the player where is the wolf. The game wait for player input. After that the game will show animation to show the player whether their answer is right or wrong.

I am currently using State design pattern. There are four states wolfEnterState,DisguiseState,ShuffleState,UserInputState, and answerAnimationState. I feel that my code is messy. I use addAction with action sequence and action completion(new Runnable()) a lot. I feel that the action sequence is getting long. Is there a better solution for this kind of problem

sentences:
Give a message box where yes no question should be answered Message boxes, had some time put in creating some for my program, now it all were informative message boxes where an OK button was available and then it closed.

I worked with a canvas that would be enabled when needed and gets disabled on clicking OK.

But now I'm in need of a messagebox that gives an output.
I've tried to do the same and test some stuff with public variables, but my code kept going and didn't wait for the response of the "dialogue box" which results in the changes going through and an unused canvas that opened behind my active screen. (Another canvas is loaded when running the code while the current canvas gets disabled).

Code example:

 cnvCleanup.enabled = true;
 //Here it should wait till i have "answered" on cnvCleanup
 if (CleanUpDone == true)
 {
 usages = 0;
 }
 else
 {
 usages++;

The cnvCleanup will get disabled on the script I wrote for clicking on the OK button.
In case the Not OK button is clicked the bool CleanUpDone should remain false so there the cnv gets disabled.

EDIT: More code.
The CleanUpDoneis public bool CleanUpDone; that gets changed in the cnvCleanup.

int usages;
usages = System.Int32.Parse(AssetList[2]);
if (usages < 10)
 {
 usages++;
 AssetList[2] = usages.ToString();
 }
 else
 {
 cnvCleanup.enabled = true;
 //Here it should wait till i have "answered" on the cnvCleanup
  if (CleanUpDone == true)
  {
  usages = 0;
  AssetList[2] = usages.ToString();
  }
  else
  {
  usages++;
  }
}

sentences: Algorithm for generating a 2d maze What algorithm have you used in the past to generate a simple 2d maze?

sentences:
android game change background image at every level? I want to be able to have a different background image at each level of my game. Presently I have only one. There is no layout folder shown in Android Studio and all info I have searched shows how to do it with the layout xml.

I have found this code in GameLayer.java of my game. Actually I am reskinning the game so everything is already there, I just need to know how to have different bg images now. Code:

// background
CCSprite bg = new CCSprite("game/game_bg.png");
bg.setPosition(G.displayCenter());
addChild(bg);

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: Separate classes communication Lets say I have a key and door. My third class (player) needs to pick up a key and open the doors. How should those objects communicate without making too much dependencies between them?

sentences:
C# (Mono)/Java 3D Game Engine recommendation Can you recommend a good C# game engine for cross platform (Win/Mac/Linux, I don't care about consoles) development?

I've got some experience with raw OpenGL and I played around with Java bindings and the JMonkeyEngine. However I'm somewhat disappointed those solutions and I tried Ogre3D which seemed really promising but I would rather not have to develop with the PITA that is C++.

I've had a look at this list but it is pretty overwhelming. I'm not looking for a all-in-one solution, i.e. I don't really require support for networking, audio and all that jazz but it wouldn't hurt if it's supported.

Maybe there's also an awesome Java solution out there that I don't know about?

sentences:
Sounds make Andengine Scene junky I have a GameScene which has a character (animated sprite), AutoParallaxBackground background with quite large textures and no more than 3 other items attached to the scene at a time, previous 3 items are dispose()-ed accordingly, background music and item sounds. Background music is instantiated with MusicFactory, Sounds are played on SoundPool. In between switching these scene we are loading resources asynchronously, reading the streams and instantiation is done in AsyncTask and the loading textures to the hardware is done on UpdateThread/GLThread. If I turn off the background music, this starts to happen totally random.

I'm experiencing scene junking on at first flow: MenuScene -> 1st Stage (GameScene). After a while lag does not happen, rather than occasionally or random. Junk is happening when aforementioned 3 items are attached on the Scene and a sound is played along, note that background music is playing at the same time.

Detaching previous 3 items is "optimized" to reduce GC calling almost perfectly. When the lag occurs GC_EXPLICIT is showed in the logcat.

What I have tried:

Playing the sounds and music on different thread, IntentService, dedicated Service.
Reduced calls to mScene.detachChild(child) and other scene methods to avoid iterations over children of the scene.
Detaching IEntitys with matcher to avoid iteration.
Inspected sound files' integrity with ffmpeg for possible errors

Could .dispose(), unloading the textures from hardware or detachChild() causing this junk?

Could be marked object for GC from the async tasks be causing this?

What else could be contributing to this issue?

sentences:
Aiming with a crosshair with a lot of polygons/triangles I'm working on a 3d kindof game where I'll eventually be able to modify the shapes present in the environment by pulling their faces with a crosshair. The thing is that I don't know how to achieve ray-quads or ray-triangle collision. I did it once with a teacher at school, but he didn't have much time and it was not well constructed (+I lost this code). I was also wondering how I could check for theses collisions with thousands of shapes? Because I know this is quite resource-demanding and doing this for 1000 spheres/cube/freeform shapes is not easy. If anyone could help me push my knowledge a bit further, it'd be very much appreciated!

I also work in Java using LWJGL, so OpenGl.

sentences:
UV mapping doesn't work without duplicating vertices, but duplicating will reduce performance, right? Is there another solution? Situation: I've been trying to gradually get a lower and lower level of understanding of how games work, and lately I've been following Rastertek's DirectX 11 tutorials. Of course, I started branching off on my own and experimenting, like a good little programmer.

I noticed that the tutorial had a set of 3 vertices for each triangle, even if that meant duplicating vertices that were there anyway. So a cube would have 12 triangles * 3 vertices/triangle = 36 vertices, when it only needed 8. This seems like it could reduce performance by quite a bit in more complicated models.

However, when I tried setting the indices to reuse vertices, I ran into problems because the normal and UV coords are assigned to each vertex. I averaged the normal vectors, which resulted in smoothing the lighting where it probably shouldn't have been smooth, and UV coords...well...right now they overwrite each other as they're importing, which results in crazy things, like so: http://i.stack.imgur.com/Rr6aB.jpg

My thoughts: Right now, I see one reasonable solution. When UV mapping in Blender, I had to create "seams", which the model was unwrapped around and blah blah, I'm sure you know what that is. Anyway, I could duplicate the vertices on these seams only, which would solve both performance and texturing quite nicely.

This wouldn't require much change in the code I currently have, but Blender's exporting algorithms don't seem to cooperate with this approach. At least not with the .obj format. Getting this approach to work correctly looks entirely possible, but also annoyingly difficult.

Finally, the question: So now I'm here, typing to you people. Am I on the right track? Or is there an entirely different approach I haven't thought of yet? What is the normal way of doing this?

Of course the other question is, will duplicating vertices like that really have a significant impact on performance? My very premise could be mistaken.

sentences:
AddRelativeForce not working correctly I am stuck on the code for couple of days but couldn't figure it out. Therefore I turned out to look the answer here but couldn't find any that match the requirement Hope some One might help

here is the code

/*  Part1
 *Step Horizontal Movement
 * Use to get left and right movement
 */
if(Input.GetKey ("right")||Input.GetKey ("left")){
    moveDir.x = Input.GetAxis("Horizontal"); // get result of AD keys in X
}
rigidbody.velocity = moveDir * speed;

/*Part2
 *Continuse Forward Movement
 */
if (Input.GetKey(KeyCode.UpArrow) || Input.GetKey(KeyCode.W))
{
    moveDir.z = Input.GetAxis("Vertical");
    rigidbody.AddRelativeForce(moveDir*50);
}

I have a Cube with added rigidBody Component. When pressed left or right key the cube should move in that direction and when key is released it should stop Part one when run commenting part2 code runs correctly

the other movement that I am trying to achieve is the cube should move continuously.But the thing is when pressed up key it should increase the magnitude and when released it should maintain the magnitude and move constantly.This is also achieved successfull with the part2 code by commenting part1 code But when but run without commenting any of them part1 results are correct but part2 does not provide correct result which was obtained by commenting part1 code

Is there any other way to obtain the same reult

sentences:
OpenGL - Index buffers problem I have a custom file format that has all the needed information for a 3D mesh (exported from 3ds Max). I've extracted the data for vertices, vertex indices and normals.

I pass to OpenGL the vertex data, vertex indices and normals data and I render the mesh with a call to glDrawElements(GL_TRIANGLES,...)

Everything looks right but the normals. The problem is that the normals have different indices. And because OpenGL can use only one index buffer, it uses that index buffer for both the vertices and the normals.

I would be really grateful if you could suggest me how to go about that problem.

Important thing to note is that the vertex/normal data is not "sorted" and therefore I am unable to use the functionality of glDrawArrays(GL_TRIANGLES,...) - the mesh doesn't render correctly.

Is there a way/algorithm that I can use to sort the data so the mesh can be drawn correctly with glDrawArrays(GL_TRIANGLES,..) ? But even if there is an algorithm, there is one more problem - I will have to duplicate some vertices (because my vertex buffer consists of unique vertices - for example if you have cube my buffer will only have 8 vertices) and I am not sure how to do that.

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:
How to see which mouse button was pressed (Unity Input System) I have switched my game to use the new Unity Input System, and I want to know which mouse button was pressed when an action is called.
Here's how it's set up:

Whenever one of these three mouse buttons are pressed, the MouseButtonClicked action will fire. I want to somehow know which one of these buttons was pressed from this single action, rather than making 3 seperate actions for 3 seperate mouse buttons.
I have tried reading the values from InputAction.CallbackContext context but I can't seem to get a proper value from the mouse button which was pressed.
How can I do this?

sentences:
How can I fix my velocity damping to work with any delta/frame time? I am decreasing my velocity by 50% every second using a guide I found online. I am using the code here and it gives the right result but only for very small values for dt:

float dt, velocity, position;

dt = 0.002f;
velocity = 1.0f;
position = 0.0f;

for (float t = 0.0f; t <= 1.0f; t += dt) {
    position += velocity * dt;
    velocity = lerp(velocity, 0.0f, 1.0f - std::pow(0.5f, dt));
}

printf("dt = %f, p = %f, v = %f\n", dt, position, velocity);

dt = 0.09f;
velocity = 1.0f;
position = 0.0f;

for (float t = 0.0f; t <= 1.0f; t += dt) {
    position += velocity * dt;
    velocity = lerp(velocity, 0.0f, 1.0f - std::pow(0.5f, dt));
}

printf("dt = %f, p = %f, v = %f\n", dt, position, velocity);

return 0;

But I am getting roughly the right velocity BUT two different final positions back when I use two different delta times (not due to floating point issues):

dt = 0.002000, p = 0.722848, v = 0.499308
dt = 0.090000, p = 0.784219, v = 0.473029

How can I fix this difference inside of my update loop?

How do I account for the extra acceleration between timesteps?

sentences:
How to obtain the currently bound texture ID in an openGL ES 2.0 project In my game, I have:

GLES20.glBindTexture(GLES20.GL_TEXTURE_2D, texID);

Where texID is an integer returned by my setTexture() method.  Let's say, in this instance it's 1.

When I bind my textures during rendering calls, I don't want to bind this texture every single call.  Because I use different atlases of various textures and it's pretty wasteful to keep re-binding a texture when it's not required.

So, I would like to do something like this (Pseudo code)

if (texID != *currentTexture*){
    GLES20.glBindTexture(GLES20.GL_TEXTURE_2D, texID);
}

Therefore, if the texture I want to use is the same as the one already bound, the call to re-bind it will be ignored.

I can't work out how to get the ID of the texture that is currently bound.

I've tried

GLES20.glActiveTexture();

But this doesn't return the textureID, it returns the texture Units

Help appreciated

Edit

I've tried the suggestion below but I'm getting the folowing errors:

When hovering over the underline, this is the error:

I had searched this site and the wider web for a couple of hours before posting here but couldn't find a proper usage example, just this out of context snippet.

sentences:
Skeletal animation: unexpected quarternion values I'm following ThinMatrix's skeletal animation tutorial and his custom written Collada parser is deriving a different rotation quaternion from each keyframe matrix than the Assimp importer library does. They are close, except the values are signed inversely and unpredicatbly.

I dug around his importer code but it's a mess. I assume he is manually performing an additional axis calculation somewhere, any ideas what it could be and why?

Original Matrix

1 0 0 0
0 -0.06466547 -0.997907 0
0 0.997907 -0.06466556 3.810999
0 0 0 1

Assimp rotation quaternion : (0.7296115 , 0 , 0 , 0.683862)

ThinMatrix's rotation quaternion : -0.72961134 , 0, 0 , 0.68386203)

And for reference, the position vec3: (0, 0, 3.810999)

Update:

With an identity matrix both Assimp and the ThinMatrix code produce (0, 0, 0, 1)

sentences:
What should I do to get my Blender models into my iOS game? I am working on a 3D OpenGL|ES game for iPad. All the models are created in Blender. How should I go about getting my models into my game?

I have the following requirements of my models:

One texture map
Material
Skeletal animation data
Attachables / Socket Points

sentences:
Perfect fit for isometric tiles in AS3 with BitmapData I'm creating a game which uses 320x160 sized isometric tiles. I've got an editor that allows me to take loaded in tiles and plot them. The map size is 8x8, and instead of placing down 64 movieclips, and then moving them around, I thought I'd use the bitmapData.draw function to plot these mc's directly to a bitmap (as I'm not doing anything with them after they are put down anyway).

That works fine apart from there's a small line appearing between the tiles, along the edges. I think this has something to do with anti-aliasing, because when I export the tile as a .png with no smooth, and use that tile in my editor, there's no faint line between the tiles, but that also makes the tile overall look pixely, so I'm at a bit of a loss.

I want the edges to fit perfectly together so need to be pixel perfect, but I want the interior of the tiles to be smoothed, any ideas? unless there's a way to solve this with the bitmapData approach in itself? The only thing I can think of right now is to make the tiles slightly bigger than they need to be so they overlap slightly, but that's a bit of a fudge, which I want to avoid if possible.

sentences:
FindObjectsOfType returns null array I am making the game in this tutorial: https://www.youtube.com/watch?v=OR0e-1UBEOU

and at 2:53:23 he is coding a LevelController script. I noticed that mine wasn't working the way his was and so I went to try and debug the error. I found that the error was in the function FindObjectsOfType(); You can find my code below.

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

public class LevelController : MonoBehaviour
{
    private Enemy[] _enemies;

    private void onEnable()
    {
      _enemies = FindObjectsOfType<Enemy>();
    }

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

When I run this my debug log returns null values which is confusing because I have 3 objects (Monster, Monster (1) and Monster (2)) which have the Enemy script assigned to them.

What could be going wrong?

sentences: What are the document grid settings in inkscape for making an isometric tilemap for tiled? I am using inkscape to create a isometric tilemap.  What settings do I need on the grid in document properties in inkscape to make it match up to a 64 x 32 grid in tiled?

sentences:
Is it worthwhile to use particle pools in managed languages? I was going to implement an object pool for my particle system in Java, then I found this on Wikipedia. To rephrase, it says that object pools aren't worth using in managed languages like Java and C#, because allocations take just tens of operations as compared to hundreds in unmanaged languages like C++.

But as we all know, every instruction may hurt game performance. For example, a pool of clients in an MMO: the clients won't enter and exit the pool too fast. But particles may get renewed tens of times in a second.

The question is: is it worth it to use an object pool for particles (specifically, those that die and get recreated fast) in a managed language?

sentences:
How do I make an infinitely scrolling background? I am trying to make a game where a torpedos keep coming from random directions and the player has to maneuver a submarine to escape them.

I am currently offsetting the background to give it an illusion that the submarine is moving i.e. if the submarine moves forward, I move the background (quad) backwards. This is primarily being done as I want it to be an infinite space. The position of the submarine does not change, the player just controls the rotation of the submarine and the background moves in the opposite direction. The background is set to repeat to give it an infinite space illusion.

The torpedo gets spawned at a random distance and moves towards the submarine. Since, the position of the submarine does not change, the torpedo will always hit the submarine. How do I structure this game, specifically the background repeat so that I can actually move the submarine in absolute dimensions and still maintain the infinite space illusion?

sentences:
Passing array to uniform in glsl error Here is my attemps to pass array to uniform array:

struct Vector{ float x,y,z; }

float threshold[2] = { 0.5, 0.25 };
Vector *kernel = new Vector[_kernel_size]; // _kernel_size==16
// fill kernel

glUniform1fv(glGetUniformLocation(_program, "t"), 2, threshold);
glUniform3fv(glGetUniformLocation(_program, "kernel"), _kernel_size, (const GLfloat*)kernel); // because Vector contains only 3 float fields this kind of casting should be ok

shader:

uniform float t[2];
uniform vec3 kernel[16];

And the results are weird. Only first float or first vector are filled with proper values. For example:

t = {0.5, 7.1830559e-042}

Even when I try change only one value (name = "t[1]") it doesn't work. I checked this on AMD CodeXL.

My graphics card is Radeon HD 5770 and I have the newest drivers. I'm using OpenGL 3.3 and GLSL 330.

What am I doing wrong?

sentences:
Play/Stop All Animations in a Project I see that there's a way to get each animation clip like the following, but is there a way to get all of the animations in a given project and play/stop them at the same time?

public class Anim: MonoBehaviour {

protected Animation anim;

// Use this for initialization
void Start () {

    anim = GetComponent<Animation>();

}

void PlayAnimation
{
    if ()//some sort of condition
    {
        anim.Play ("Roll Dice");
    }
    else {
        anim.Stop();
    }
}

sentences:
Add vertices to "middle" of VBO I've been playing around with VBOs as of late (mostly because my game necessitates it), and I've found the need to add new vertices to a VBO, but not necessarily at the end. The game in question is a Terraria port, and when a player updates the world, the VBO needs to be updated. Up until now, I've been using glBufferData() to update the array, but it's time I switch to glBufferSubdata() or glMapBuffer() I'd like to be able to update a certain "chunk" of the world when a block in it is modified, but this could potentially result in adding more or less vertices than are already in the appropriate memory section. If a player places a "block," more memory would need to be allocated, resulting in any proceeding vertices being shifted over x indices. My only thought would be to allocate enough memory for each chunk to be completely filled with blocks, but I haven't yet found a way to do that. Would anyone be able to point me in the right direction?

EDIT: To clarify, pushing new VBO data to the graphics card (which is what causes the lag spike) takes 11-12ms the first couple of times, and 1-4 every time after. This also raises the question: why does the graphics card seemingly need to be "broken in?" In other words, why is there such a huge delay at first?

sentences:
Breakout Collision: Detecting the side of collision I am writing a breakout clone (my first game) and am totally stuck as to how I figure out which side of the brick was hit.

I have a collision detection method that looks like this:

DetectCollision(Object a, Object b)

   x = distance(a.x, b.x);
   y = distance(a.y, b.y);

   if (x is smaller than the combined width &  y is smaller is than combined height {
       return true;
   }
return false;

This works totally fine, but I need to know the side of the collision, and location relative to the center in order to respond properly.

I've spent the past few days snooping around but am lost.

sentences:
Incorrect click event when resize on libGdx I want to use scene2D, in libGDX, to detect click on object.

I have this simple Game sample :

Stage stage;

@Override
public void create()
{
    this.stage = new Stage(1280, 720, true);
    MyActor actor = new MyActor();

    Gdx.input.setInputProcessor(stage);

    actor.setTexture(new TextureRegion(new Texture(Gdx.files.internal("plateau.jpg"))));
    actor.setScale(0.1f);

    stage.addActor(actor);

    actor.addListener(new InputListener()
    {
        @Override
        public boolean touchDown(InputEvent event, float x, float y, int pointer, int button)
        {
            System.out.println("down"+Math.random());
            return true;
        }
    });
}

@Override
public void render()
{
    stage.act();
    stage.draw();
}

MyActor is a simple class extending Actor with a rendertexture.
The Event is working fine at start.
But when resizing the frame, while the Actor is streched as wanted, the coordinates of the click are not updated and thus misplaced.

How to make the stage using the new size of the items as base to the event ?

Thanks.

sentences:
Spawn chance, modulated by probability weighted by progress I've been struggling with this for over a day now. What seemed a simple task, has just wrecked me. I hope someone here can help me figure out what I'm missing. Please, please help me :)

The functionality I need:

Think of my game as Guitar Hero, but instead of pre-placed nodes, I place the nodes randomly as the game progresses, at certain valid points in time. Now, instead of relying on randomness alone, I've made phases of difficulty, where I set a certain number of nodes to be spawned throughout the phase, and I'd like to have those evenly distributed within the phase. Since it's an arcade/highscore game, it needs to be roughly the same number of nodes placed every time you play the game, but the nodes should be placed differently each time. Until recently, I simply had something like this code, called for each valid point in time:

if(Random.Range(0f, 1f) < 0.25)
    // Spawn node

The problem:

Now I want to balance the number of nodes per phase. To do this, I have these variables:

TotalNodesToPut
NodesPut
NodesLeftToPut
PhaseProgress (0.0-1.0 normalized percentage of progress)

My plan was, to have the base chance of spawning a node to be 50%. I would then like to modulate that down to 0% and up to 100% depending on how many nodes still need to be put down, and how far we have progressed through the phase. It should be so that the percentage of nodes put down follows the progress percentage. If we have spawned 5 of 20 nodes (25%) but have progressed 75% of the phase, the chance to spawn a node should be really high. If we have spawned 15 of 20 nodes (75%) but have only progressed 25% of the phase, the chance to spawn a node should be really low.

It seems like a simple task, but I just can't get it to work :( I've tried dozens of things, started over again and again, and it's just never right, which is why I'm hesitant to show any code. I wouldn't want to start people off on the wrong foot. I have tried searching on the web, but haven't found anything about this particular problem. Any help is much appreciated!

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 to playlay multiple Particle Systems when colliding with multiple obstacles using object pooling? I have two types of particle, one for each player:

Player 1 (Red Particle)
Player 2 (Blue Particle)

When player 1 collides with an obstacle then I want to play the red particle system, and when player 2 collides with an obstacle then I want to play the blue particle system.

Code:

TouchControll.cs

 public GameObject PlayersPartical;

  void OnTriggerEnter2D(Collider2D other)  //here my player collided with obstacle
    {
        foreach (Transform child in transform)
        {
            if (child.tag == "point")
            {

                //GameObject partical = Instantiate(twopartical[Random.Range(0,1)], transform.position, transform.rotation);
                //ParticleSystem heal = partical.GetComponent<ParticleSystem>();
                //heal.Play();
                GameObject partical = Instantiate(PlayersPartical, transform.position, transform.rotation);
                ParticleSystem heal = partical.GetComponent<ParticleSystem>();
                heal.Play();

                ObjectPooler.Instance.SpawnFromPool("redandbluepartical", transform.position, Quaternion.identity);
            }
        }
     }

ObjectPooler.cs

    public static ObjectPooler Instance;

    public void Awake()
    {
        Instance = this;
    }

    [System.Serializable]
    public class Pool
    {
        public string tag;
        public GameObject prefab1;
        public GameObject prefab2;
        public int size;
    }

    public List<Pool> pools;

    public Dictionary<string, Queue<GameObject>> pooldictionary;//which gameobject you should be pool

    void Start () {

        pooldictionary = new Dictionary<string, Queue<GameObject>>();

        foreach(Pool pool in pools) //add a pool in list
        {
            Queue<GameObject> objectpool = new Queue<GameObject>();

            for(int i=0;i<pool.size;i++)
            {
                GameObject obj =  Instantiate(pool.prefab1);
                GameObject obj1 = Instantiate(pool.prefab2);
                obj.SetActive(false);
                obj1.SetActive(false);

                //objectpool.Enqueue(obj);
            }

            pooldictionary.Add(pool.tag, objectpool);
        }
    }

   public GameObject SpawnFromPool(string tag,Vector3 position,Quaternion rotation)  //two tag red and blue partical
    {
        if(!pooldictionary.ContainsKey(tag))
        {
            Debug.Log("doesnot exist" + tag);
            return null;
        }

        GameObject objecttospawn =  pooldictionary[tag].Dequeue();

        //here how to call my trigger

        objecttospawn.SetActive(true);
        objecttospawn.transform.position = position; //pos
        objecttospawn.transform.rotation = rotation; //rotation

        pooldictionary[tag].Enqueue(objecttospawn);
        return objecttospawn;
    }

Image1:

Image2:

How do I call these particles?

sentences:
Unity C# - Raycasts, How to Ignore Triggers? Let's say I have a Raycast, but I don't want it to collide with any triggers. I don't want to change the Project settings since that's a little inflexible.

How can I have a Raycast ignore any triggers?

sentences:
Does StreamPeerTCP guarantee received packet is same from server? I'm making simple Godot project that works with Node.js server. To receive and send packet to Node.js server, I used StreamPeerTCP.

First seems works, but after 2nd transmission from server, extract data from packet were broken and mess all other logics.

This wasn't happened when same logic tested with Unity C#:
https://github.com/rico345100/unity-multiplayer-with-nodejs/blob/master/Assets/Scripts/Network/NetworkManager.cs

Here's the repo I'm currently developing:
https://github.com/rico345100/godot-multiplayer-with-nodejs
https://github.com/rico345100/nodejs-tcp-server-for-godot

Used Godot 3.1.2 but also works with 3.2.rc6. Tested with Godot 3.1.2 and macOS 10.13.6.

sentences:
Limiting interaction between certain RigidBodies I'm developing a 2D game in Unity and have been tasked with building a particular feature I'm not sure how to accomplish with Unity's physics engine. To simplify, a bunch of objects of type X and O are filled into a pit:

XXXXXXXXXXXX
XXXXXXXXXXXX
XXXXXXXXXXXX
XXoXXXoXXXoX

Both objects have Rigidbody2Ds and colliders. Objects of type X have normal gravity and should settle into place. Objects of type O have inverse gravity and should float.

However, O should not be able to push X, and X should not be able to push O. Another way of looking at it is that O should only be able to move upward, and X should only be able to move downward. If we remove some of the Xs directly above an O, the O should float upwards as the Xs fall downwards until the Xs settle on top of the O and everything stops moving:

XXXXXXXXXXXX        XX XXXXXXXXX
XX XXXXXXXXX   -->  XXXXXXXXXXXX
XX XXXXXXXXX   -->  XXoXXXXXXXXX
XXoXXXoXXXoX        XX XXXoXXXoX

(In the actual game Xs and Os can be different sizes; their movement is continuous and they are not constrained into rows or columns).

The Os should be able to support the weight of any arbitrary number of Xs without sinking.

XXXXXXXXXXXX
XXXXXXXXXXXX
XooooooooooX
X          X

Lastly, the Os should be able to float diagonally if there is a space available:

XXXX XXXXXXX      XXX       XX
XXXXX     XX  --> XXXXX   XXXX
XXXX    XXXX  --> XXXXoXXXXXXX
XXXo XXXXXXX      XXXX XXXXXXX

I can't solve this problem simply by adjusting the mass of the Xs or Os since the number of Xs on top of an O may vary. I can't use the built-in RigidBody constraints since they don't allow you to disable only one direction along an axis (e.g. saying an object can move upward but not downward).

What's the proper way to handle this? I could do something like this:

void FixedUpdate() {
    if (movementDirection == Direction.UP) {
        if (transform.position.y < lastYCoordinate) {
            Vector3 position = transform.position;
            position.y = lastYCoordinate;
            transform.position = position;
        }
    }
    lastYCoordinate = transform.position.y;
}

but that feels hacky to me and I suspect it will keep the objects from sleeping. Are there better solutions here?

sentences:
PHP Browser Game Private Messages? First off, I'm asking this question here because gaming and messaging are intimately connected.  Why win if you can't gloat?  Nevertheless, I won't be offended if this needs to be moved to overflow.

I need a PM system for my browser game, which already has a user and authentication system (To clarify: the game already has a user system).  Specifically, I'm wondering if a PHP library already exists that I can use to save some time.  Better yet, if anyone knows of a nice Codeigniter library for messaging, that would be perfect.

I already have a good idea on how I would approach this if I have to write my own, but it seems like something that would already exist in a robust form (despite my failed Google searches).

Requirements:

Messages can be sent to individuals,  multiple users, and guild mates (which is essentially just multiple users with server-side selecting who to target).
Users can reply to individual or all recipients
Messages appear in sender's outbox and receiver's inbox.
Utilizes some 2-table design to handle marking read / deleting messages on a user-by-user basis
Messages are semi-threaded.  I.e. I won't necessarily have them appear in the GUI as threaded, but previous messages should be included at the bottom of a reply.  Maybe better to say, previous messages are identifiable and accessible.  (This, I'm not yet 100% sure how I would design if I write my own.  I.E. whether to include the text of the previous message into the new message or somehow remember the previous message's database ID to link later)

Technology in Use: PHP, Codeigniter, Javascript, JQuery, Ajax, Sqlite

Note:
I have seen that there are some similar questions on overflow, but they were very little help in the answer department. Otherwise, people were looking for either chat boxes or more umm.. like social media site threads, which I find a bit different than something you would find in a game.

sentences:
How do I make a sprite appear to sway with the wind? I'm trying to find a method to simulate the effects of wind on various sprites in a side-view 2D scene. What relatively simple technique could I use for this?

What I have in mind is to give these sprites a "spring" effect that I could hand a force that rotates them in a specific direction and eventually degrade the force and bring the sprite back to its "resting" rotation over time with a little bit of rebound/wobble/sway... I don't understand how I can mathematically create the elastic/spring effect using rotation, taking into account things like mass, resistance, or stiffness. How would I go about doing this in code?  It doesn't have to be super realistic.

I'm hoping to set up a global wind variable that gets applied to sprites starting on one side of the screen and making its way to the other to look like a gust of wind passed through. I should be able to accomplish this once I have a method for applying a wind force to a single sprite.

How can I do this?

sentences:
Swiping with rigidbody My character moves continuously forward with

rigidbody.velocity = v3Force * strength;

My Swipe script is based on a youtube tutorial from https://www.youtube.com/watch?v=9ZIHx09GevI

I just changed the end result with

rigidbody.AddForce(v2Force * strength1);

For Right Swipe and below for Left Swipe

rigidbody.AddForce(v1Force * strength1);

Here are the vForce variables :

var v1Force : Vector3 = -transform.right;
var v2Force : Vector3 = transform.right;
var v3Force : Vector3 = transform.forward;

The swipe works fine, but the result isn't what I'm aiming for because when I swipe left/right my character seems to be moving only one frame left/right. And then continues moving forward. When I disable the forward movement, the swipe works great and makes my character move right/left for a period of time, after I swipe.

My question is how do I reach this result(moving sideways more than just a frame) with my continuous forward movement enabled?

sentences:
Unity 2D C# Enemy Attackng Ai issue Ok to be specific, both of my enemies will continuously play their attack animation even when it is false. I don't understand what I am doing wrong here :(

void OnTriggerEnter2D(Collider2D other){
    //If attack collider is player and we're not attacking
    if (other.name == "Player" && !attacking) {
        attacking = true;
        attackTimer = attackCD;
    }
    if (attacking)
    {
        if (attackTimer > 0)
        {
            Debug.Log ("Decreasing");
            attackTimer -= Time.deltaTime;
        }else if (attackTimer == 0)
          {
            attacking = false;
            Debug.Log ("Done attacking!");
            //attackTimer = attackCD;
          }
    }
}

anim.SetBool ("Attack", attacking);//This sets the animation but it is in my Update function not my OnTriggerEnter2D function

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:
Amount of Data Calculated in a Game So... I am theorizing the development of a 2d living persistent fullsized world with simulated ecossystem, etc..., and many, many objects, but how can I handle the giant amount of data that will be calculated per instance.
I mean, as the ecossystem is simulated and alive, animals would roam, plants would grow the climate would change etc... I already planned on how to implement the simulated ecossystem, but I wanted them to happen all at once, not in separated instances like World of Warcraft's dungeons or different maps. Just one entire and fullsized chunck with all the things happening on it.

Is it possible, even for an extreme low graphical game? I know of games that do something like it. Eg.: Dwarf Fortress, but what I am aiming for is way bigger than that.

EDIT:
For the "AI", I was planning on do behavioral intelligent organization or BIO, something I am planning and theorizating. It would be like a giant The Sims, every object(animal, plant, etc...) would have it's needs, characteristics, possibilities and impossibilities, they need to eat so they interact with the enviroment and with other objects on their own with modified version of A* lead by his senses(vision, audition, ect...). I know it is complicated and not polished, its because I am still studying everything and I'm more like a amateur programmer.

sentences:
DirectX Quaternion SLERP Wrong Answer? I have some code that looks like this:

DirectX::XMVECTOR a, b, c;
a = DirectX::XMQuaternionIdentity();
b = DirectX::XMQuaternionRotationAxis(DirectX::XMVectorSet(0.0f, 1.0f, 0.0f, 0.0f), 3.1415f);
c = DirectX::XMQuaternionRotationAxis(DirectX::XMVectorSet(0.0f, 0.0f, 1.0f, 0.0f), (3.1415f * 3.0f) / 2.0f);

DirectX::XMVECTOR slerpAB = DirectX::XMQuaternionSlerp(a, b, 0.4f);
DirectX::XMVECTOR slerpBC = DirectX::XMQuaternionSlerp(b, c, 0.85f);
DirectX::XMVECTOR slerpCA = DirectX::XMQuaternionSlerp(c, a, 1.0f);

The thing is, I'm sure that slerpBC is wrong. Here's what I'm getting:

If I understand it right, slerpBC should be 85% of the way towards a 3-quater turn around the Z axis. But when I plug that value in to Wolfram Alpha, it looks totally wrong.

Furthermore, when I run the code through my own Slerp code I get a totally different answer that looks more correct, to me.

So... What am I doing wrong?

sentences:
How to share matrix in HLSL? I am trying to share this across multiple effect files:

matrix worldMatrix : register(vs_4_0, b0);

If I set this from one effect file, will it effect every effect file which has the same type of variable assigned to that specific register?
What is the difference between this and the cbuffer struct?

sentences:
Java 2D Game looks like 3D i have fair experience with java game programming,
i already made a simple mario game (side-Scrolling)
i'm wondering how can i make a "Java" Game like that

http://www.youtube.com/watch?v=utwtXEYW1L0
or that
http://www.youtube.com/watch?v=uqz4dunlhX4
the main problem is that i don't know how to make a 2D game looks like 3D
i just need a tutorial or the idea behind such things.
Thanks in Advance :)

sentences:
XNA- Scale only parent I was wondering, is it possible to Scale(Vector3) a ModelBone without scaling its children. Lets say I got a Bone A at position 1,0,3. And one of its children Bone B is at position 1,0,5 (he is touching Bone A). Could I scale Bone A along Z axis without scaling Bone B, but keep Bone B position and rotation so that he is still touching Bone A.

Thanks in advance

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:
Are very long floating point numbers a problem? Very simple question, but important: I was using a floating point number ('float') in C++ to handle movement speed, and it suddenly ran crazy. It turns out the speed increased very fast to 259614846795304004193338175520768.0. That's 33 digits, on a typical (non-double) floating point number. How is that even possible, and can it cause the rest of my program to derail? Or will this number simply be cut down to the 23 bits of significant digits that floating point numbers usually have?

(edit: This is not a bug hunt. I am simply trying to understand how a float can hold such a large number with perfect precision (it's not an exponent, because that would just leave a trail of zeroes after a few significant digits). I am not looking for flaws in my code, just a better understanding of how floating point numbers work, and how this can happen)

EDIT: The solution seems to be a mix of bits from several answers, so I don't know whom to assign as the correct answer. Floating point values are apparently assigned by exponent, which means that some numbers can be amazingly huge without losing precision, as long as they are precise exponents of 2 somehow. Mine was. I thought the size was limited to 23 bits, flat out. As soon as I started using variations of the number that were NOT precise exponents of 2, everything went crazy. Sorry for the radio silence, I had to figure this whole thing out experimentally, once I learned that about floating point numbers from various answers.

I seem unable to close the question. Could someone with proper clearance close it down? And thanks to everyone for the help, I am now far more enlightened regarding floating point numbers!

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:
Color grading, shaders and 3d textures I'm trying to implement color correction with the 3d lookup table. The lookup table is actually just a 2d texture 256x16 and consists of 16 squares which one is 16x16.

When it comes to rendering, I pass 2 textures to shader: first one is whatever I rendered on the screen and the second is a lookup table. Shader takes RGB components of the rendered image, and uses it to find a replacement in a lookup table.

And there is two problems: first, I can't use filter to smooth colors (16 for each dimension is not enough) because it also smoothes the line between two contiguous 16x16 squares and that's inappropriate; second problem is no interpolation for a B-component.

Using a volume texture could solve both problems, but, unfortunately I'm short on time and there are not so many information about using 3d-textures in shaders. So, here's my questions.

Is it possible to pass a 3d-texture to shader (HLSL)?
If it is possible, could the filter be applied to the 3d dimension?
Maybe there is a better way to implement color-grading that I don't know?

sentences: Populating Static Mesh Array I'm trying to populate a Array of Static Meshes from the On Begin Play event with all the static meshes that are children of the primary object but can't seem to access them as static meshes, any suggestions?

sentences:
How can I reflect a point with respect to the plane? How can I reflect a point with respect to a plane?

Example:

I have three points (0,0,2), (4,0,0) and (0,8,0). And I have a point (x,y,z). From these, I want derive a composite transformation matrix. How can I do that?

sentences:
Is using XNA title storage for level/config files a Bad Idea? I've reached the point in development where my Game Engine can actually do stuff, and it's time to start thinking about how to store / load the various bits and pieces where they need to be.

I've decided to go with file storage (rather than a database), which means I'm probably going to be using .xml, .json, or .csv files. The only remaining question is how to actually store them within the game's binaries (so that any players won't be able to edit levels willy nilly).

XNA's Title Storage, being read-only, seemed as good a starting place as any, but when I loaded up the MSDN page, there's this warning on the top:

  This topic describes how to add files to title storage that the game will access through stream I/O. This is the exceptional case, and is not recommended for most XNA Game Studio games. Instead, consider using the Content Pipeline to manage your game data most efficiently.

Emphasis mine.

So is it a bad idea to use Title Storage for level/config files, or is that warning intended to stop people from using it to store things like Texture2Ds and SpriteFonts ?

sentences:
Add points to a prefab in Unity I have a prefab that looks like this:

I have created a couple of 'points' in the Hierarchy using 'Create Element' and I would like to attach them to the prefab, however drag and drop over doesn't work. Why is that?

sentences:
Displaying sprites in a 2.5D raycasting engine I'm developing a raycasting engine like the one used in DOOM, Wolfenstein 3D, etc.

My engine is capable of correctly displaying walls and textures on walls, but I'm stuck at sprites rendering.

Given that my engine is based on lines and angles only (just trigonometry), is there a way to render sprites without going for matrices? And if so, which technique should I use?

sentences:
Creating charging particles using Shuriken I've been trying to create a charging effect using the Shuriken Particle system for the longest time, and I've had little to no luck with it. I've tried setting different curves for the Force over Time and Color over Time, but I always come up empty. However, I've seen examples all over the place for charging particles. The most recent example of charging particles I've seen is from the Space Cowboy game jam entry LOS CUERVOS.

The game has a ship with a laser that requires the player to hold a button down before it fires. It looks like this when charging and firing. I'm specifically talking about the particles surrounding the ball of light that's slowly growing in size over time.

I was wondering if anyone here knew what I may be doing wrong when going about setting up the particle system. Any suggestions relative to the question would be much appreciative.

sentences:
Why i'm not getting the FPSController Rotation values? using System.Collections;
using System.Collections.Generic;
using UnityEngine;
using UnityStandardAssets.Characters.FirstPerson;

public class RotateObject : MonoBehaviour
{
    public UnityStandardAssets.ImageEffects.Blur blur;
    public UnityStandardAssets.ImageEffects.BlurOptimized blurOptimized;
    public FadeScript fadescript;
    [SerializeField] Quaternion targetRotation;    /// Rotation you want to achieve.
    [SerializeField] private float s;       /// Rotation duration.
    private Quaternion initialRotation;     /// Your GameObject's initial rotation.
    private float t;                        /// Your 't' reference.
    private FirstPersonController fpcscript;

    void Awake()
    {
        fpcscript.enabled = false;
        fpcscript = transform.GetComponent<FirstPersonController>();
        initialRotation = transform.localRotation;
    }

    void Update()
    {
        if (fadescript.alphaZero == true)
        {
            if (t < 1.0f)
            {
                transform.rotation = Quaternion.Lerp(initialRotation, targetRotation, t);
                t += (Time.deltaTime / s); /// Each 60 frames [optimally] t reaches 1, divided by your duration, it will reach 1 on 'x' seconds.
            }
            else /// Your rotation ends here:
            { /// reset 't' [if you please], and reset 'initialRotation'
                initialRotation = transform.rotation;

                blur.enabled = false;
                blurOptimized.enabled = false;
                fpcscript.enabled = true;
            }
        }
    }
}

The script is attached to FPSController.
In the Inspector the Rotation of the FPSController is: X = 7 Y = 112 Z = -31

But when i'm using a break point on the line in the Awake:

initialRotation = transform.localRotation;

I see that initialRotation values are: (-0.2, 0.8, -0.2, 0.5)

What i want to do is to rotate the transofrm from X = 7 Y = 112 Z = -31 to rotation 0,0,0
That is why i also didn't set any values to targetRotation since i want it to rotate to 0,0,0

sentences:
How to handle keyboard controls in Arkanoid game I'm making simple Arkanoid clone in Unity with both keyboard and mouse controls available. When I gave it to my colleagues to test one complain was that keyboard controls are not precise enough,. The problem is that I don't really know how to find a balance between two factors:

If I make paddle speed too high then it lacks precision to position it just right to make ball go to the last few blocks.
If I make paddle speed too slow then it's going to be difficult to reach ball in time.

I thought about it and I don't recall any version of arkanoid that solved that problem. Currently I have 3 ideas:

Make two (or more) keys to go in each direction. One will go faster and another slower.
Instead of making multiple buttons lets allow player to change speed of paddle during the game. Probably by entering number from 0-9 on keyboard.
Just leave it like it is now. Other control schemes are not intuitive enough.

Does anyone have any experience with this? Which approach is the most reasonable?

Edit:
Code I'm using:

    Vector3 pz = transform.position;
    pz.y = y;
    pz.z = 0;
    if (Input.GetKey(KeyCode.LeftArrow)) {
        pz.x -= Time.deltaTime * KEYBOARD_SPEED_MULTIP;
    }
    if (Input.GetKey(KeyCode.RightArrow)) {
        pz.x += Time.deltaTime * KEYBOARD_SPEED_MULTIP;
    }
    pz.x = Mathf.Clamp(pz.x, -60, 60);
    rb.MovePosition(pz);

I simply move paddle by constant speed which includes timedelta. And then I clamp position to screen.

sentences:
How to manage complex mesh importing in to a game engine A bit of context: I'm developing a 3D rendering engine and can't really make much more progress until I get some more interesting and complex meshes loaded in to the scene. So far I have been using built-in simple meshes like cubes and planes. I have written a Mesh class to take a MeshData struct which contains Position, Normal, Tangent, Bitangent, Colour, Texture Coordinate, and optional Face data. The Mesh class takes this data and depending on a few things it will generate a VBO with all of the available data interleaved, an EBO, and a VAO which has both the VBO and EBO (if one exists) bound to it. I've been pretty happy with this so far and it works fine with a simple .OBJ which contains a relatively straight-forward mesh.

Currently I have an asset management system which allows me to load in assets like this:

Mesh * teapot = AssetManager::loadGlobalAsset<Mesh>("res/meshes/teapot.obj");

If the returned pointer == nullptr then the assets doesn't exist. If it isn't nullptr then one of three things just happened: (1) the asset was just newly created and successfully loaded in to the asset manager's pool of assets, (2) the asset was found to already exist in the pool of assets and its pointer returned, (3) the asset was found to already exist in the pool of assets, but was unloaded, so it was loaded and its pointer returned.

As I said this works great for simple meshes but I'm a bit stuck on what to do and what changes I now need to make to load meshes which have multiple sub-meshes which might have individual materials.

For example the Sponza mesh has many sub-meshes which make use of a set of materials.

I could just load the mesh right in to my scene and have the mesh spread across multiple scene nodes all with a common ancestor node, but then this would defeat the purpose of an asset manager and I would have to worry about cleaning up and unloading the mesh outside of the asset manager. I could also just load the mesh as one big combined mesh, but of course then I can't assign individual materials to the sub-meshes without a lot of trouble.

I currently can't load the mesh using my asset manager as assets are identified by the hash of their filepaths, and here we have a situation where many individual meshes technically have the same filepath. If I just create new assets and give them to the asset manager with an ID to later fetch the asset (which isn't necessarily a bad idea for built in assets (I think)), then I feel I have the following issues:

Easy to add multiple assets with same ID
Breaks the connection between the meshes contained in a single mesh file
No way of actually knowing the ID of a mesh which was loaded in via a mesh file
Would have to manually recreate the whole mesh from its loaded sub meshes if I wanted to simply display the mesh as-is.

There is also the issue of where to store the materials that are included in the material library that a mesh file might reference. Do I create new material assets from this library, add them to the manager, and then have the mesh somehow reference these materials? But then how would I reference these materials manually? It's a similar issue to last point from the above list. Also, meshes don't currently have any knowledge of its material, that's the scene node's job.

Thanks for any thoughts or comments on this issue. I'd be very interested to hear what you guys think.

sentences:
In 2D, how do I efficiently find the nearest object to a point? I have a sizable game engine and I'd like a feature for finding the nearest of a list of points.

I could simply use the Pythagorean theorem to find each distance and choose the minimum one, but that requires iterating through all of them.

I also have a collision system, where essentially I turn objects into smaller objects on a smaller grid (kind of like a minimap) and only if objects exist in the same gridspace do I check for collisions. I could do that, only make the grid spacing larger to check for closeness. (Rather than checking every single object.) However, that would take additional setup in my base class and clutter up the already cluttered object. Is it worth it?

Is there something efficient and accurate I could use to detect which object is closest, based on a list of points and sizes?

sentences:
XNA Scale and Render Targets I'm working on a top down Strategy/RPG/Tower Defense XNA Game for Windows, and I'm running into an issue while scaling.

My display mode is 1680 X 1050, and that is what I'm setting the PreferredBackBuffer width and height to.

What I'm finding is that when I use my camera object to zoom in and out (changing the scale on a matrix that is passed to the SpriteBatch.Begin method, it changes the scale of my sprites... but I'm still confined to the BackBuffer (0,0,1680,1050)...

Can I use something like a RenderTarget to extend the actual area that is accessible when zooming/panning across the "map"?

I'm looking at making it something like 5000 X 3125...

Any thoughts/examples of how I should approach this?

I've added a video of what I'm experiencing... http://www.youtube.com/watch?v=jIiAeXbAnec

For the record I have also posted this question on Stack Exchange - Stack Overflow

sentences:
How can I represent rooms and associated actions and inventory in a text-based adventure game? I am just getting started learning to make games. I have created a simple text-based game where the user can walk around between rooms and interact with the objects in each room. However, I feel like my approach has led to a pile of bad spaghetti code. I'm not sure what a good way to structure a game like this would be.

My approach was to have one class with a method for each room and all the objects and interactions that could be done in that room. For example, this is the method for the study:

public static void Study()
{
    bool studyexited = false;

    while (!studyexited) {
        string usercommand = Console.ReadLine ();
        usercommand.ToLower ();

        switch (usercommand) {
        case "turn left":
            GameEventText.StudyLeft ();
            break;
        case "turn right":
            GameEventText.StudyRight ();
            break;
        case "go forward":
            Notes firstsetofclues = new Notes ("First Note");
            GameEventText.StudyFront ();
            string firststudycommand = Console.ReadLine ();
            firststudycommand.ToLower ();

            if (firststudycommand == "read note") {
                firstsetofclues.Firstnotereading ();
            }

            Console.WriteLine ("Picking up this note would prove valuable");
            string secondstudycommand = Console.ReadLine ();
            secondstudycommand.ToLower ();

            if (secondstudycommand == "pick up note") {
                if (MainClass.PlayerInventory.AddItem (firstsetofclues))
                {
                    Console.WriteLine ("The note has been added to your inventory");
                } else {
                    Console.WriteLine ("Your inventory is full");
                }

                MainClass.PlayerInventory.Inventorydisplay ();
            }
        }
    }
}

I don't feel like this is an approach that will scale; that is, I can't really write functions like this for every room. I believe that using files in some way would be a good strategy to avoid the "hard coding" that I'm currently doing. But I am not sure how I can achieve that?

sentences:
How do I cheaply place a watermark over what's rendered in OpenGL 3.0+? I would like some insight about how to place an image with an alpha, and a certain amount of opacity, on the top of everything that is rendered. What's the cheapest way to do that?

I use C++ with a programmable OpenGL pipeline.

sentences:
Tracking how many people play my Unity game in which language? In my game the user can change the language of the game and I'd like to know how many people play it in English, German, etc.
I'm using Unity, so possibly I would like to implement in Unity Analytics.
I was thinking about adding segments for the languages, but in that case if a user tries all languages, the user will appear in all languages' segments. So it won't really provide that much info.
A possible solution:

When the user changes language, we signal a database to decrease the old language's counter and increase the new language's counter.

But there must be an easier, built-in solution than this.

sentences:
Unity3d Transform.position float range I thought floating point has a very large range, for example up to 3.4*10^38.
However today I tried to set my player's Transform.position.x to 1000000 in the GUI and it gave me a warning:

  "Due to floating-point precision limitations, it is recommended to bring the world coordinates of the GameObject within a smaller range."

Does that mean that my single scene has to be smaller than 1000000*1000000*1000000. Is this considered big enough? I will need multiple scenes if I want a larger world? When a new scene gets loaded, will my player's position be reseted? How do I manage the position data so that it doesn't go out of range?

I'm using Unity3D Pro.

sentences:
How should I send packets to multiple clients on UDP? I'm developing a 2D action side-scroller shoot-em-up game and I recently implemented the multiplayer aspect.

When the server sends packets containing the game state (which are about 500-700 bytes) to a single client, the ping is around 32ms and it works smoothly, but the moment another client connects, both clients start to lag and the ping increases to 200ms and I am assuming that the problem lies with network congestion

So my question is, should the server automatically send data to all clients simultaneously OR should the client ask the server for an update on the game world OR is there another method I do not know about?

BTW I am using UDP protocol as I found TCP to be pretty slow after a certain amount of time in-game.

sentences: Which c/c++ model animation library for OpenGL I'm fairly new to game development, played around with xna before and just learning OpenGL & c now and I'm interested to know which c/c++ based model animation libraries are out there and which you would recommend? I don't have any particular model format in mind yet but probably a format that is supported by a free modelling tool like Blender.

sentences:
How can I "capture" the section of my sprite sheet that I want to draw in Java? I'm working on a puzzle game, I've implemented a sprite class that uses an array of images and cycle through the array to draw each frame as required.
This works fine!

Here's the original code:

    String number;
    Image sprite;
    ArrayList <ImageIcon> spriteAnimation = new ArrayList();
    int _imageCount = 0;
    int _animationStart = 0;

   public Sprite(String spriteType, int totalFrames){

        for(int x =1; x <= totalFrames; x++){
          spriteAnimation.add(new ImageIcon("Images/" + spriteType + "/" + spriteType + x + ".png"));
          System.out.println("Added " + spriteType + x + ".png to the ArrayList");

        }

    }

    public void updateSprite(){

        sprite = spriteAnimation.get(_imageCount).getImage();

        System.out.println("image count is " + _imageCount);

        if(_imageCount < spriteAnimation.size()-1){

           _imageCount += 1;

       }else{

           _imageCount = _animationStart;

       }

    }

    public Image getSprite(){

      return sprite;

      }
}

However, after researching the difference between using the method above and using a single sprite sheet (there must be a good reason to use a sprite sheet I thought, and I was right) I've decided to use a single sprite sheet to represent all sprites in my game.

While I fully understand the principle of using the sprite sheet, I cannot get my head around actually drawing the selected part of the sprite sheet.
I thought there might be a constructor in the ImageIcon or Image classes that would allow me to do something like pass in the size of the image to be drawn, the x and y co-ordinates to start at and the original sprite sheet as arguments - but apparently not.
I'm obviously looking in the wrong place.

I would be very grateful if someone could advise me on how to do this in Java.

sentences:
How to handle a different kinds of weapon in a single component and system in entity system? A weapon can be used as melee or range weapon, it can be thrown, toss, fired, shoot, cast (a projectile) or use to slash, bash, stab . How do I apply these to entity-system? my first approach is to create an enum class of WeaponType, a melee or range.

public enum WeaponType {
    MELEE,
    RANGE
}

public interface Weapon {
    void use();
}

Then I've create a weapon component and add weapon type data, to determine its type. For melee a weapon, it needs to have a method that handles different kind of "attack motion" like slash, bash, stab. For range weapon, it needs to have a container, factory and a method that handles different kinds of "projectile motion" like shoot, fire, throw, toss etc.. Now the problem is how could I create a method for different kinds of projectile motion, remember I am specifically using Ashley ECS framework

public class WeaponComponent implements Component {
    public Weapon weapon;
    public WeaponType type;
    // if weapon type is melee, use the below data
    public Container container // holds the created projectile
    public Factory factory // creates a different kinds of projectile object
}

// or create seperately???

public class MeleeWeaponComponent implements Component {
    ... different kinds of method also like slash, bash, stab
}

public class RangeWeaponComponent implements Component {
    ... Factory and Container
    ... different kinds of projectile motion?
}

In this idea, I can use abstract or interface but I think abstraction or is not recommended.

[Combined data suggestion] by @Ryanwhite and me

Blue line is area of effect angle covered
Green line is distance covered
Red point is the target point

public class WeaponComponent implements Component {
    public Ray ray // to handle collisions
    public float aoe; // 0.5 for melee, more than 0.5 for other weapon
    public float aoeAngleCovered;
    public float aoeAngle
    public Ammo[] // 0 for melee, 1 or more for other weapon
}

sentences: What is the value range from a dot-product between two normalized vectors? I've recently learned about the existence of dot product and I was wanted to know how to determine the value range between two normalized vectors.

sentences:
Is it possible to map mouse coordinates to isometric tiles with this coordinate system? I'm trying to implement mouse interaction in a 2D isometric game, but I'm not sure if it's possible given the coordinate system used for tile maps in the game.

I've read some helpful things like this. However, this game's coordinate system is "jagged" (for lack of a better word), and looks like this:

Is it even possible to map mouse coordinates to this successfully, since the y-axis can't be drawn on this tile-map as a straight line?

I've thought about doing odd-y-value translations and even-y-value translations with two different matrices, but that only makes sense going from tile to screen.

sentences:
Will lots of haptic feedback kill motors? My game centers around joystick oddities, sort of, to make it more interesting.

I've got a cheap $6 joystick that is like a usb PS3 controller. Surprisingly, I find it of great quality, with excellent feedback.

I don't care about it so much, because of the price but I don't want to kill motors in a users expensive joystick.

Basically, it will be running for minutes at a time every once in a while.(Well, not constantly, but almost constantly)

Are these motors really good, and hard to wear down or will I quickly kill them?

Thanks for your time.

sentences:
Libgdx/Box2D PolygonShape has no position... well, what now? As my prototype works perfectly fine I want to advance to more fun areas of the project and add a more complex player-character body.

So for Box2D I figured I'd need multiple fixtures, like one for the legs, one for the torso and one for the head.

Each of these fixtures will get a different sprite/texture that should be swappable dynamically if the player puts on some armour or changes cloths etc.

Until now the player-character consisted of a Box2D Body with just one single fixture.
I added the sprite like this:

   body.setUserData(this.sprite);

I rendered it like this:

 // Draw-method
  if(body.getUserData() != null && body.getUserData() instanceof Sprite) {
      Sprite sprite = (Sprite) body.getUserData();
      sprite.setPosition(body.getPosition().x - sprite.getWidth() / 2, body.getPosition().y - sprite.getHeight() / 2);
      sprite.setRotation(body.getAngle() * MathUtils.radiansToDegrees);
      sprite.draw(spriteBatch);
  }

Now that I want to have multiple sprites for different "regions" of the body I figured it's better to add them to the fixture itself. For now I just wanted to reproduce what I already had, so just the one sprite I have to the one fixture I have right now instead of the body.

I do this like that:

Fixture fixture = body.createFixture(fixtureDef);

My problem arises when trying to render this.

for(Fixture fixture : body.getFixtureList())
{
    if(fixture.getUserData() != null && fixture.getUserData() instanceof Sprite)
    {
        Sprite sprite = (Sprite) fixture.getUserData();
        //sprite.setPosition(fixture.getShape().getPosition() ... // Not gonna work, because PolygonShape has no position! :(
        sprite.draw(spriteBatch);
    }
}

As you can read in the comment, the fixture for now has a rectangular shape which is made like:

shape = new PolygonShape();
shape.setAsBox(widthInMeters / 2, heightInMeters / 2);

The problem is, that a PolygonShape has not position :/ Now when I render this, the sprite is not being drawn at the fixtures position and currently I really have no idea how to fix that.

I'd highly appreciate any help you can give me! Thanks in advance and have a wonderful day! :)

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: Slow motion of a spherical object on an blunt slant obstacle In cocos2d environment and box2D when an spherical object falls on a blunt slant obstacle, it moves really slowly, that's nauseating, if you have coded to not to have any interaction with world while object is in motion. Is there any way to get rid of this slow motion of object?

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:
Faces on 3D model not rendering in the correct I seem to be having trouble with rendering models in monogame. I'm trying to draw several cubes, in a minecraft style world. It's a simple .obj file, nothing special. But... for whatever reason, both the top and the bottom are rendering over the sides, as can be seen here in these four cubes.

My code is simple as can be, so I can't imagine the problem is directly the fault of this:

public static void DrawModel(Model model, Matrix modelspace, Texture2D texture)
    {

        foreach (ModelMesh mesh in model.Meshes)
        {
            foreach (BasicEffect effect in mesh.Effects)
            {

                //effect.EnableDefaultLighting();
                effect.TextureEnabled = true;
                effect.Texture = texture;
                effect.World = modelspace;
                effect.View = Cameraworks.ActiveCamera.View;
                effect.Projection = Cameraworks.ActiveCamera.Projection;
            }

            mesh.Draw();
        }

    }

How do I fix this?

sentences:
Unexpected results with D3D9 depth bias I've run in to some problems with the D3DRS_DEPTHBIAS render state after converting an older game's D3D8 renderer to D3D9.

D3D9 replaced the old (and poorly supported) D3DRS_ZBIAS with D3DRS_DEPTHBIAS, but it doesn't seem possible to get it to work the same way that ZBIAS did. This game renders shadows and other "decals" onto the ground as flat textures, and to avoid the obvious z-fighting issues that would result would set D3DRS_ZBIAS to 2 when rendering decals in the D3D8 renderer (which I did not write).

The best approximation of the old D3D8 behavior that I've been able to come up with is setting D3DRS_DEPTHBIAS to -0.00003 when rendering shadows. This works fine for shadows on flat terrain that are relatively close to the camera, but when the camera is far above a shadowed object, the shadow will draw on top of the object itself. This can also happen even on near objects if they are on uneven terrain.

It doesn't seem possible to solve this by manipulating the DEPTHBIAS value alone, as no change fixes it entirely without causing other problems.

Is there any way to solve this? Failing that, is there a more modern technique for rendering decals that could be used? I would much rather avoid lots of rewriting as I'm not very familiar with D3D and didn't write any of the original code, but if that is the only option...

sentences:
Warcraft III, SharpCraft C# plugin: Usage of native "TimerStart"? about:

Blizzard Warcraft III [furthermore abbreviated as WC3]
related version: WC3: The Frozen Throne 1.26.0.6401 (german Patch 1.26a)
MindWorX Sharpcraft [furthermore abbreviated as SC]
related version: 1.2.4.0

issue:

I'm trying to use the native "TimerStart" from the WC3 "common.j" package inside a SC plugin written in C#. what gives me problems is the last argument from the native ("code handlerFunc"). as there is no native for creating functions, I dont know how to use it properly, can you give an example? for reference of the "code"-argument (it isnt even declared in the "common.j") i used Vexorians thread on wc3c.net, part: "I. The code type". here is the native like declared in "common.j":

native TimerStart           takes timer whichTimer, real timeout, boolean periodic, code handlerFunc returns nothing

in the SC plugin I initialized the native like this:

private delegate void TimerStartPrototype(JassTimer whichTimer, JassRealArg timeout, JassBoolean periodic, JassCode handlerFunc);
private static TimerStartPrototype TimerStart = WarcraftIII.Jass.GetNative("TimerStart").ToDelegate<TimerStartPrototype>();
//native TimerStart           takes timer whichTimer, real timeout, boolean periodic, code handlerFunc returns nothing

additionally in SC plugin, I created a void to pass to the last argument of the native: (note that "StopCamera" is another native from "common.j" i also initialized in the SC plugin but not showing here, because it is done in the same way "TimerStart" was.)

private delegate void StopCameraFuncPrototype();
private void StopCameraFunc() {
    StopCamera();
}

usage of the native "TimerStart" in SC plugin: (note that the variable "jTim_mouseWheel" is a "JassTimer" created somewhere else in the SC plugin.)

TimerStart(jTim_mouseWheel, (JassRealArg)0.01, false, (JassCode)StopCameraFunc());

when im trying to run WC3 with SC, the SC console window prints that it couldnt compile the appropriate plugin *.cs-file due to not being able to convert void to JassCode. by simply renaming "void" into "JassCode" I get the error, that not all code paths return a value...

sentences: How to fix cutting corner problem in A-star pathfinding So this is a problem when doing diagonal jumps (checking diagonal neighbor nodes). In 2d it can be prevented by doing some checks, like if up and right is blocked, don't take up-right neighbor for calculations. But in 3d thous check become a bit to much and to tedious.. so if I still want diagonal paths, what could be a good solution?

sentences:
Determine the bullet / particle reflection off of a circle in node js using SAT lib functions I can see how the calculation should occur from other examples such as: How to bounce a 2d point particle off of a circular edge.

But I could use some help with the specifics for my inputs given during a game loop that is progressing / moving the bullet each game loop tick, and then detecting and handling collisions.

I've tried to mock up an example nodejs script using the SAT lib
http://requirebin.com/?gist=4a5c208dc39d3c3be262abb05fa791a3
.. with the console logs tracing a few variables, including the output target vector.

My question essentially lies in understanding how I can use the SAT vector functions like dot() or reflect() to produce the reflection?

https://github.com/jriecken/sat-js#classes

Even pseudo code would help me understand what exactly the operation needed to determine the reflection point (not just the angle, but the bullets new target vector) given my inputs of a bullet x,y position colliding with and a circular wall.

sentences: Drawing in a static location when using a camara transform I'm using a matrix transform to move a 2d camera in Monogame, and I was wondering: How, if I initiated my spritebatch with a matrix transform, can I draw something in a static (non-moving) position? For example, I want to put debugging variables in the corner of the window.

sentences: Checking bounds of a quad I want to know how would I tell if a quad touches another quad in my game built in Slick2D. I have a class that I named "Bounds" which has 4 "Point" objects which just store an X and a Y value and a "Bounds" object stores 4 "Point"s. Simply it has 4 2D vectors, one stores the top left, another stores the top right, another stores the bottom right and the other stores the bottom left. I need to be able to check if two quads based of those 4 coordinates are inside each other. Does anyone have an idea of what I should do?

sentences:
How to wrap ECS components to OOP in libgdx ashley? Currently I am using builder-pattern to create my Entities

PooledEngine engine = new PooledEngine();

...

CharacterComponent character = engine.createComponent(CharacterComponent.class);
TextureComponent texture = engine.createComponent(TextureComponent.class);
SizeComponent size = engine.createComponent(SizeComponent.class);
TransformComponent transform = engine.createComponent(TransformComponent.class);
PhysicsComponent physics = engine.createComponent(PhysicsComponent.class);

Entity entity = engine.createEntity();
entity.flag = Constants.CHARACTER;

entity.add(character);
entity.add(texture);
entity.add(size);
entity.add(transform);
entity.add(physics);

engine.addEntity(entity);

Because PooledEngine class didnt support the creation of casting an Entity to another class that extends Entity. Example engine.createEntity(Character.class);, I am having hard thinking how do I wrap these components into single class.

Objectives

class interface ICharacter {
    void attack();
}

class interface IMoveable {
    void move();
}

class Character extends Entity implements ICharacter, IMoveable {

    private Body body;
    private Vector2 position;

    public Character() {
        PhysicsComponent physics = Mappers.physics.get(this);
        TransformComponent transform = Mappers.transform.get(this);

        body = physics.body;
        position = transform.position;
    }

    @Override
    public void attack() {

    }

    @Override
    public void move() {
        ...
        position.add(x, y);
    }

}

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:
Create random level platforms on screen I'm trying to create random level platforms like this:

 public Level(int platfromsInLevel, Texture2D sprite, int screenWidth)
    {
        rnd = new Random();
        this.screenWidth = screenWidth;

        for (int i = 0; i < platfromsInLevel; i++)
        {
            if (i == 0)
            {
                Platform platform = new Platform((new Vector2(0, 0)), (new Vector2(0, 0)), sprite);
                Platformlist.Add(platform);
            }
            else
            {
                int CurrentX = (int)Platformlist[i - 1].getPos().X + Platformlist[i - 1].getTex().Width;
                int CurrentY = (int)Platformlist[i - 1].getPos().Y + Platformlist[i - 1].getTex().Height;

                int xRand = rnd.Next(CurrentX + 100,(CurrentX + 100) + 150);
                int yRand = rnd.Next(CurrentY + 200, (CurrentY + 200) + 200);

                if (xRand <= screenWidth || xRand >= 0)
                {
                    Platform platform = new Platform((new Vector2(0, 0)), (new Vector2(xRand, yRand)), sprite);
                    Platformlist.Add(platform);
                }
            }
        }
    }

Can anyone help with the random logic? I only want them to appear on the screen that is visible on the X axis, but the y axis is infinite it can go as high as needed. The width of the screen is stored in screenWidth. I also don't think my random logic is taking into account the whole screen width, it only adds positive values. Finally I've tried to add some logic that says a platform can only be a certain height and distance away from another one whilst taking into account the previous platforms position, but its not really working.

Anyone got any ideas to tidy this up a little bit?

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:
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:
In a top down game, once I have detected collision, how do I prevent it? I'm making a top-down game in Java. I watched some videos, and this is the code I currently use when the player is colliding with an object:
x += -velX
y += -velY

When I apply force to a wall, the player dips into it, and can't move along the wall.
Does anyone have a better method?

sentences:
How can I write an additive mesh shader that splits the RGB channels while accounting for depth? I'm trying to create a sort of "hologram" effect. So far, what I have is an additive, three-pass shader that uses ColorMask for each pass to separate the RGB channels. The problem is that doing so requires ZWrite to be off (first image) so that each pass doesn't intersect the others (second image). However, doing so means that the model geometry overlaps itself, which I don't want.

I've tried the various methods of taking depth into consideration with transparency (This, for example) but they all cause problems when trying to separate the RGB channels. Is there some way to have each pass take depth into consideration within itself, but not with the other passes?

sentences:
How to move a Line Renderer as its game object moves I created an empty game object and added a Line Renderer component to it through a script. I thought that once I adjust the position of the game object, it would do likewise for the line rendeder, but that is not the case.

I tried useWorldSpace = false but it totally changed the positions making the following points a straight line, though I was able to move the game object to to the line.

public Vector3 beginPos = new Vector3 (-1.0f, -1.0f, 0);
public Vector3 endPos = new Vector3 (1.0f, 1.0f, 0);

Is there a way I can convert points to input what I am more familiar with (so that points like the above points don't create a straight line) or should I be approaching the problem in a different way? I am open to a different approach.

UPDATE

I think I left an import detail. I'll be using lines made with line renderer to create shapes. So I need to be able to be able to move the lines around to move the shapes so I don't have to always recalculate the start and end points for the lines.

sentences:
Rotate Sprite towards mouse cursor SDL I have trouble to make my sprite(Arrow) to point at the position of my mouse cursor but i don't get the Right results. I've tried this:

SDL_Point Center{ 40,40 };
int Delta_x; int Delta_y;
int mouse_x, mouse_y;
double Result;
SDL_GetMouseState(&mouse_x, &mouse_y);
Delta_x = xPos - mouse_x;
Delta_y = yPos - mouse_y;

Result = (atan2(Delta_x, Delta_y) * 180.0000)/ 3.14159265;
m_Sprite->Render(Result, Center);

RendercopyEx:

SDL_RenderCopyEx(m_Renderer, m_Texture, NULL, &m_Rect, Angle , &Center, SDL_FLIP_NONE);

This is the result I get (in the original picture, the arrow is pointing up):

sentences:
Get the position of a GUI.Button and instantiate in its position I am trying to instantiate a GUI.Box in the position of my GUI.Button when it is clicked but I just cant seem to get the position of the button. The button does change position.

Here is the code of my button in my Editor script:

void OnGUI () {
     GUI.Button(new Rect (5,95, 300, 100), "Hello");
}

sentences:
Libgdx - How to change GestureListener pan finger sensibility? I implemented GestureListener in my Overlap2dStage to pan the camera when the player drags its finger over the screen. But I also have some actors that extend InputAdapter to detect when the user touches on them. Then I mix them with a InputMultiplexer.

So far it's working fine on my computer, but when I get into Android and tap an object it trigers  both: pan() from stage and touchDown() from the actor.

I remember I read something about a pan box to decrease the sensibility, since in a touch screen you are touching several pixels, it detectes a pan. It's worst in smaller screens.

sentences: Directx9, FBX sdk and indices problem So I've set up my program, know how to get everything going except for one thing: indices. I've been stumped as to how I retrieve that set of data. Does anyone know what I function I need to get them? Thanks in advance!

sentences:
is editing images violating copyrights Lets say I want to build iOS quiz with guessing images, and want to guess pokemons. If I edit image like :

is it violating copyrights?

sentences:
How to use multiple animations? convert an animated model:
3dsMax(CAT) -> Export FBX -> fbx-conv -> model.g3dj
my code:
...
val model = modelLoader.loadModel(Gdx.files.getFileHandle("model.g3dj", Files.FileType.Internal))
val modelInstance = ModelInstance(model)
val controller = AnimationController(modelInstance)
controller.setAnimation("Take 001", -1, 0.5f, null)
...

docs:

setAnimation(java.lang.String animationId)
Set the active animation, replacing any current animation.

How to set animationId in the source file (FBX) ?
my research:
model.g3dj
{..., animation: { id: 'Take 001', ... } }
format: https://github.com/libgdx/fbx-conv/wiki/Version-0.2-%28draft%29
model.fbx
AnimationStack 'Take 001'
format: http://docs.autodesk.com/FBX/2014/ENU/FBX-SDK-Documentation/index.html?url=files/GUID-E5C89F5F-09D1-4C32-BA83-28F63D0B2A6C.htm,topicNumber=d30e11661
my question: How to set AnimationStack.name in 3dsMax?
https://knowledge.autodesk.com/support/3ds-max/learn-explore/caas/CloudHelp/cloudhelp/2017/ENU/3DSMax/files/GUID-26323F8D-3CC2-4918-A60D-C9D6C558584E-htm.html

sentences:
How does Texture Mapping work? I read the answers from What exactly is UV and UVW Mapping? and How does UVW texture mapping work?, which are quite nice, but am still not 100% sure, if I understand correctly.

Lets start with a 2D example. So, say I have a triangle (obviously described by 3 vertices). Now my question is, how do I convert a (x,y)-coordinate to the (u,v)-coordinate of my texture? Since {x,y} could be any value between [0,n] with n being all real numbers, considering that it is in object space. But my texture coordinates are between [0,1]. How do I know how to map lets say (3,4) to (u,v)? If I know how to map the object coordinates to the texture coordinate it is easy to interpolate the values, I assume (either using bilinear interpolation or barycentric interpolation).

And then how would this work for 3D? Lets say in this case we would have a pyramide with 5 vertices (4 bottom, 1 tip). I guess the procedure would be similar, with the exception that I know have an additional depth value. But how does the mapping of a 2D texture work on a 3D object, when I don't have nice flat surfaces like on a pyramide, but instead have a circular surface, like a tea pot?

I hope I'm clear in my questions. I'm still little confused myself. I just don't quite get the mathematical background of texture mapping.

It would be enough, if you could point me to some website with good explanation, maybe with clear graphics and step by step description.

Thanks for your time!

sentences:
How to store a Transform[,] grid in an ArrayList? I am new to Unity game dev and trying to expand my knowledge of data structs. I'm building a match-3 game, and I currently have a multi-dimensional ArrayList holding transform coordinates on a grid of x width and y height. I have game objects tied to these coordinates in world space, with the grid syncing the data back in game space. I am attempting to push these coordinates into the nested list (familyList) to be deleted pending 3 or more units being added to familyArrayList (seen below).

Here's the abridged code:

private static Transform[,] grid = new Transform[width, height];
public static ArrayList familyArrayList = new ArrayList();

// Go through game grid line by line and add game objects from game space into family ArrayList
for (int y = height - 1; y >= 0; y--)
        {
            for (int x = 0; x < width; x++)
            {
                if (grid[x, y] != null)
                {
                    // Add grid[x, y] to familyArrayList
                    familyArrayList.Add(grid[x, y]);
                    Debug.Log(familyArrayList[0]);

Output:

Green Unit(Clone) (UnityEngine.Transform)

How can I get familyArrayList to properly story the grid coordinates and not the game object the grid coordinates are referencing?
i.e. familyArrayList[0] == '3,4'
Should I instead use a nested list? At a later point in the code, I want to clear the game object from the board in world space as well as set the grid[x,y] to null:

// Loop through all family array and destroy game objects
foreach (var x in familyArrayList)
{
    Destroy(familyArrayList(x).gameObject);
}
// Loop through all family array and set their values to null in grid as well
foreach (var x in familyArrayList)
{
    familyArrayList(x) = null;
}

But I get errors like "Argument 1: cannot convert from 'object' to 'int'" and "Non-invocable member 'Piece.familyArrayList' cannot be used like a method" which I can imagine are explained by my above problem of not storing the grid coordinates properly and instead storing the referenced game object. I'm truly stumped on this problem and thank anybody in advance who can point me in the right direction to solving this.

sentences:
Write alpha channel into SurfaceFormat.Single rendertarget in XNA/HLSL I need to initialize a rendertarget ('SurfaceFormat.Single' format) drawing sprites into it.
I would like the alpha channel of the sprite to be written into the rendertarget, so that regardless of the sprite texture, i end up with sprites silhouettes in the rendertarget. But XNA doesn't support alpha blending when using SurfaceFormat.Single, and from the pixel shader in which i handle the rendertarget for further calculations, i have all 0 readings.
I find documentation of this features to be sparse and partial, so, could anyone suggest some source where i can check the sanity of my code?

sentences:
How do I determine the look-at vector of a free-look camera? I'm trying to create a free-look camera with DirectX 10.

I've figured out how to get the directions for forward and back and left to right. However, I don't know how to rotate the look-at vector of my view matrix around the camera position so as to rotate in-place. How can I do this?

sentences:
How to drag-and-drop objects in libGDX? I am drawing blocks of various amino acids (array of aminoacid objects), where one line of amino acids represents one sequence.

aminoacid class:

public void renderShape() {
    shaperenderer.setProjectionMatrix(cam.combined);
    shaperenderer.begin(ShapeType.Filled);
    shaperenderer.setColor(cc.getR(), cc.getG(), cc.getB(), 0);
    shaperenderer.rect(xpos, ypos, aawidth, aaheight);
    shaperenderer.end();
}

public void renderBatch() {
    batch.setProjectionMatrix(cam.combined);
    batch.begin();
    font.setColor(Color.BLACK);
    font.draw(batch, name, xpos+Game.AAFONTOFFSETX, ypos+Game.AAFONTOFFSETY);
    batch.end();
}

Now I need a way to drag and drop feature to move the individual blocks. How can I do this? Can I use the DragAndDrop class of libGDX? If so, how should I do it??

As a side note, I found a way to do it without libGDX:

public class AminoAcidDragAndDrop extends JFrame {
  private String brr_A = "EAQITAPFELSAFTGRPEWI";
  private JTable table;
  private DefaultTableModel tableModel;

  private DefaultTableModel getDefaultTableModel() {

    String[] cols = new String[brr_A.length()];
    for (int i = 0; i < brr_A.length(); i++) {
      String currentAminoAcid = String.valueOf(brr_A.charAt(i));
      cols[i] = currentAminoAcid;
    }

    return new DefaultTableModel(null, cols);
  }

  public AminoAcidDragAndDrop() {
    super("Amino Acid Drag and Drop Demo");

    tableModel = getDefaultTableModel();
    table = new JTable(tableModel);

    JScrollPane sp = new JScrollPane(table, JScrollPane.VERTICAL_SCROLLBAR_ALWAYS,
        JScrollPane.HORIZONTAL_SCROLLBAR_ALWAYS);
    getContentPane().add(sp, BorderLayout.CENTER);
    getContentPane().setPreferredSize(new Dimension(1024, 768));
  }

  private static void createAndShowGUI() {
    // Create and set up the window.
    AminoAcidDragAndDrop test = new AminoAcidDragAndDrop();
    test.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);

    // Display the window.
    test.pack();
    test.setVisible(true);
  }

  public static void main(String[] args) {
    SwingUtilities.invokeLater(new Runnable() {
      @Override
      public void run() {
        // Turn off metal's use of bold fonts
//              UIManager.put("swing.boldMetal", Boolean.FALSE);
        createAndShowGUI();
      }
    });
  }
}

Can I convert it for libGDX? If so, how?

I also tried it with Actors but how can I use an Actor array? Would an ArrayList<> work?

Now I can move the first aminoacid, but DragAnDrop needs a final int. How can I solve this for all aminoacids?

public void drop (Source source, Payload payload, float x, float y, int pointer) {
    aminoacidlist.get(aaiddnd).setBounds(aminoacidlist.get(aaiddnd).getXpos()+Game.AAWIDTH, aminoacidlist.get(aaiddnd).getYpos(), Game.AAWIDTH, Game.AAHEIGHT);
    minoacidlist.get(aaiddnd+1).setBounds(aminoacidlist.get(aaiddnd+1).getXpos()-Game.AAWIDTH, aminoacidlist.get(aaiddnd+1).getYpos(), Game.AAWIDTH, Game.AAHEIGHT);
}

The compiler tells me:

  aaiddnd cannot refer to a non-final local variable.

sentences:
Can I create custom framebuffer and render to it in cocos2dx? I want to do post processing effects so I was thinking If I could just make custom framebuffer in cocos2dx like OpenGL and render the ALL SCENES objects in it. I want a single frame buffer for all scenes. Is there any
 way? Thanks.

sentences: How to hide fbx files for commercial release I see that all commercial games I've played never expose their fbx files - usually, they archive the fbx files into PAK file or BIN file. For example, Torchlight 2 use  OGRE3D for their Graphic Engine, and at the loading screen, they un-pack the PAK file. How do they do that?

sentences:
Wheels not facing right direction when car faces different directions I am creating a real time multiplayer driving game in Unity. I am using google play's real time multiplayer service. I am having an issue where the wheels of the cars that are over the network are not facing the right direction. What I am currently trying to do is just add the calculated steering angle to the current rotation of that particular player's car, but for some reason the wheels face the wrong way and rotate incorrectly if the car is facing certain directions. Logically I thought what I have is correct. Basically for each wheel I use this code:

car.transform.rotation = Quaternion.Euler(0, car.transform.rotation.y + steerAngle, 0);

So I find the rotation of that car and then I add the steer angle to it. Why wouldn't this work?

sentences:
Precision issue bouding sphere I tried to make two spheres with bounding sphere to detect collision so they stop when they collide. But it seems that im having a precision issue. They stey stuck together because of small decimal keeping it stuck. Is there a way around this? Since they are in a 3d space, adding or subtracting a little off seems impossible and expensive. How can I solve these precision issues?

 oldleftright = leftright, oldupdown = updown;

if(GetAsyncKeyState(VK_RIGHT))
    leftright += 0.0001;
if(GetAsyncKeyState(VK_LEFT))
    leftright -= 0.0001;
if(GetAsyncKeyState(VK_DOWN))
    updown -= 0.0001;
if(GetAsyncKeyState(VK_UP))
    updown += 0.0001;

collide = test.Intersect(test2);
if (collide)
{
    leftright = oldleftright;
    updown = oldupdown;
}
collide = false;

sentences:
Why is shadow mapping the standard? Though I am a programmer by trade, I have barely touched game development at all. I've had this question for some time, and now that I'm looking into game development I thought it would be a good time get ask.

Why does shadow mapping seem to be the exclusive way games use to make shadows?
To be blunt, it looks terrible. Even modern games with shadow settings maxed have jagged block-y shadows that are very distracting.

Doom 3, made 11 years ago used shadow volumes that looked much better than any shadow map implementation I have ever seen, that includes AAA games released the same week this question is being posted. Third party mods for Doom 3 even softened the edges of the shadows, making them even more visually impressive.

Is there some kind of technical problems or limitations with implementing things like shadow volumes? Are shadow maps just so easy to implement that devs don't even consider anything else?

The only information I've been able to find on the subject is that the polygons that make up the the volumes can be quite large, becoming more demanding. Perhaps shadow volumes have much higher system requirements, but if that is the case how did they get away with using them in 2004?

This question isn't specific to shadow mapping vs shadow volumes, They are simply the only 2 I've seen used in full products and I just haven't been able to find much information on any other techniques.

sentences:
What does EventSystem.currentSelectedGameObject consider the current object to be? I've been working with UI in my project as of late and I can't figure out what Unity's event system is supposed to return for currentSelectedGameObject.

if (EventSystem.current.currentSelectedGameObject != null)
{
    Debug.Log(EventSystem.current.currentSelectedGameObject.name);
}

With the code above I figured that it should return something when I'm moving the mouse across the various UI elements. Unity's documentation appears to be poor on this function stating:

  The GameObject currently considered active by the EventSystem.

maybe I'm just being stupid but does anyone know what triggers currentSelectedGameObject?

sentences:
How can I create a copy of an object in Unity? I'm new to unity.

How can I make some copies of my GameObject in Unity by scripting?

I have tried this by the way:

public GameObject stone_3;

void Start ()
{
  for (int i = 0; i < 10; i++)
    Instantiate(stone_3, new Vector3(i * 2.0f, 0, 0), Quaternion.identity);
}

I can't really understand why it's not working.

sentences:
How to avoid recursive and or infinity loop monogame return function This piece of code is returning on a infinite base how to fix?

public GuiElement MoveElement(int x, int y)
{
    GUIRect = new Rectangle(GUIRect.X += x,GUIRect.Y += y,GUIRect.Width,GUIRect.Height);
    return MoveElement(x,y);
}

this is where i set the values i have in my Other class

        gm.Add(new GuiElement("BackGround"));

        gm.Add(new GuiElement("Play_Button").MoveElement(150, 50));

        gm.Add(new GuiElement("HighScore_Button"));

        gm.Add(new GuiElement("Quit_Button"));

basicly i want a to be able to move some elements using that MoveElement

it creates a infinite loop

An unhandled exception of type 'System.StackOverflowException' occurred in giftman.exe

sentences:
Why is Unity MouseLook very shaky and jittery? I'm working on a first person shooter game.

My problem is that my Mouselook script is shaky and jittery when I looking around.

Here is my code:

Transform MyTransform;

const string vert_input = "Mouse Y";
const string horz_input = "Mouse X";

public float mouseSensitivity = 100.0f;
public float clampAngle = 80.0f;

void Update()
    {
        the_time = Time.deltaTime;

        ROTX_ROTY.y += (Input.GetAxis(horz_input) * mouseSensitivity * current_speed_offset * the_time);
        ROTX_ROTY.x += (Input.GetAxis(vert_input) * mouseSensitivity * current_speed_offset_vertical * the_time);

        ROTX_ROTY.x = Mathf.Clamp(ROTX_ROTY.x, -clampAngle, clampAngle);

        MyTransform.rotation = Quaternion.AngleAxis(ROTX_ROTY.y, Vector3.up);
        x_rot_transform.localRotation = Quaternion.AngleAxis(ROTX_ROTY.x, Vector3.left);
    }

And this is my input settings for Mouse X and Mouse Y:

For more explanation: I put my camera inside one of my controller children and if I put it out of controller the issue is still there.

I tried Lerp, Slerp, smoothdamp , euler but does not make any difference.

I tried this script for Android and I used a touch instead of a mouse and the result was same.

I tried it on FixedUpdate and the result was same.

Is there any way to fix this problem?

Here is a video about my problem.

sentences:
Build displays black screen with static Something really odd happens when I'm trying to load a scene.

It is supposed to look like this (it also has to show the next scene after loading):

What is going on?

sentences:
DX11 Handle Device removed I get the DXGI_ERROR_DEVICE_REMOVED error on some machines. According to this (https://msdn.microsoft.com/en-us/windows/uwp/gaming/handling-device-lost-scenarios) MSDN article this can happen and it should be handled by your application.

I've managed to recreate the device but I'm unsure how to handle all content. It seems I have to create all vertex buffers and textures again, which essentially means I have to reload almost the entire scene. Is this really the correct way?

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:
How can I make this easing function less jumpy? I have this function that acts as an ease-in:

protected static function easeIn(ratio:Number):Number {
  return ratio * ratio * ratio;
}

Ratio is a value between 0 and 1.

The function works okay, but I'd like to make it a bit less "jumpy." I mean, it accelerates too fast and abruptly slows down.

However I'm not sure what values should I play around to achieve what I want, does anyone know?

sentences:
Difference between shader input element classification between D3D12 and Vulkan I'm confused about the difference between the shader input element classifications in D3D12 and Vulkan. For example, in Vulkan I could have the following declarations:
struct vertex
{
    glm::vec3 pos;
    glm::vec3 col;
};

VkVertexInputBindingDescription input_binding_description
{
    .binding = 0,
    .stride = sizeof(vertex),
    .inputRate = VK_VERTEX_INPUT_RATE_VERTEX
};

std::array<VkVertexInputAttributeDescription, 2> input_attribute_descriptions {
    VkVertexInputAttributeDescription{
        .location = 0,
        .format = VK_FORMAT_R32G32B32_SFLOAT,
        .offset = offsetof(vertex, pos)
    },
        VkVertexInputAttributeDescription{
        .location = 1,
        .format = VK_FORMAT_R32G32B32_SFLOAT,
        .offset = offsetof(vertex, col)
    }
};

Here the input rate is specified per vertex and not per attribute. On the other hand, in D3D12, we would have
struct Vertex
{
    XMFLOAT3 pos;
    XMFLOAT3 col;
};

std::array<D3D12_INPUT_ELEMENT_DESC, 2> input_element_descs =
{
    { "POSITION", 0, DXGI_FORMAT_R32G32B32_FLOAT, 0, 0,
    D3D12_INPUT_CLASSIFICATION_PER_VERTEX_DATA, 0 },
    { "COLOR", 0, DXGI_FORMAT_R32G32B32_FLOAT, 0, 12,
    D3D12_INPUT_CLASSIFICATION_PER_VERTEX_DATA, 0 }
};

And as you can see, the input rate is specified per attribute. Why is that? Is there a difference between the meaning of the input classification in D3d12 and Vulkan that I'm missing? I'm not familiar with D3D12, but at first glance, it doesn't make sense to me to have different input classifications for the attributes of a vertex.

sentences:
Checking if a vector is contained inside a viewing frustum I have a three dimensional pyramid given by four vectors a, b, c, d and want to test if a given vector x is inside that region or not. Here is an image:

A related question can be found here: 2D problem.

How can I test to see if the vector is contained by the others?

sentences:
How to render top-down perspective in a tile-based RPG? My question is specifically about the type of perspective that GBA Pokemon games like Fire Red/Leaf Green have:

I'm not sure of the correct terms for what I'm trying to achieve.

I am using SDL2 and can render a tilemap and sprites on top of it, with basic collision detection, but since everything is constrained inside a tile, it looks like the player collides with a wall when their head touches it, rather than the feet.

The above screenshot has a tiny bit of perspective (is that considered 2.5d?), so the head of the player hides a portion of the tile above.

There are definitely ways to make this work, e.g. being a bit more lenient on collision (i.e. not the whole bounding box of the player but the middle of it collides with a wall), but my question is mostly about efficient rendering.

Is rendering from the bottom up the best thing to do so that I respect the perspective? If it is then I guess I need to know at which tile to render the player, so I need to compare every coordinate with the player coordinates to see if it's time to render the player?

sentences:
Other procedural material generators for Unity? In the new version of Unity 3.4, unity announced that they would now support procedural materials (which is awesome, by the way). While I was researching it, I found this in the manual:

  Allegorithmic's Substance Designer can be used to create Procedural Materials, but there are other applications (3D modeling apps, for example) that incorporate the Substance technology and work just as well with Unity.

I don't have Allegorithmic's substance designer and don't plan on buying it soon. What other applications or 3D modeling apps can make procedural materials that work in Unity?

Edit: I found that Allegorithmic has a program called Player. But it is on Windows only. I'm on mac.

sentences:
rendering an image within c# & sharpdx dirext3d9 [game overlay] I'm following this guide and the related blog post to implement a basic game overlay for DirectX 9 games using SharpDX.

So the tutorial already have an example for text rendering but I need to be also able to render a provided image to the overlay.

Any ideas, guides?

sentences: How can I transmit move information from player to player in a web application? I am trying to create an online chess game using ActionScript and Flex.  It works well when I have two players on the same PC, but I want to publish it as a web app.  How can I transmit a move or action from one user to another, such that the other user sees what the first one did?

sentences:
Isometric tile picking algorithm not working Starting to gamedev again and Trying an isometric game. However, all I try, I can't seem to figure out tile picking properly.. Using SFML

Here's how I'm detecting the clicks and moving around a sf::View. Sprites are 64*32

#include "GameWorld.h"
#include <math.h>
GameWorld::GameWorld()
{
    this->camX = 0;
    this->camY = 0;
    this->factories.push_back(new Factory("Factory 1"));
}

void GameWorld::draw(sf::RenderWindow * win, ContentManager* contentManager) {
this->factories.at(this->activeFactory)->render(win,contentManager, this->camX, this->camY);
}

void GameWorld::update(float delta, sf::RenderWindow* win) {
    float speed= 128;
    sf::View view = win->getView();

if (sf::Keyboard::isKeyPressed(sf::Keyboard::W))
{
    this->camY -= speed*delta;

}
if (sf::Keyboard::isKeyPressed(sf::Keyboard::A))
{
    this->camX -= speed*delta;

}
if (sf::Keyboard::isKeyPressed(sf::Keyboard::S))
{
    this->camY += speed*delta;

}
if (sf::Keyboard::isKeyPressed(sf::Keyboard::D))
{
    this->camX += speed*delta;
}
view.setCenter(this->camX,this->camY);

win->setView(view);

if (sf::Mouse::isButtonPressed(sf::Mouse::Left)) {

sf::Vector2i selectedTile;
int x = sf::Mouse::getPosition(*win).x - this->camX;
int y = sf::Mouse::getPosition(*win).y - this->camY;
selectedTile.x = (y + x/2)/32;
selectedTile.y = (y - x/2)/32;

        printf("%d %d %d %d\n",sf::Mouse::getPosition(*win).x,sf::Mouse::getPosition(*win).y, selectedTile.x,selectedTile.y);
   }

}

The map is a 2d vector, which gets drawn like so

float screenX = (indexX - indexY) * this->sprite->getGlobalBounds().width/2;
float screenY = (indexX + indexY) * this->sprite->getGlobalBounds().height/2;

this->sprite->setPosition(sf::Vector2f(screenX,screenY));

win->draw(*this->sprite);

Here's what this currently prints out: When the game is loaded initially - clicking the first tile rendered (0,0) outputs 21 0 as the computed coords. As you can see, the X value is completely off, and the Y value goes off aswell as soon as I move the view in any direction. How could I get this picker to work properly?

sentences:
working in external actionscript file does not show anything on the screen? I'm writing this code in Flash builder and I tested the file in flash, but nothing appears in the swf file. (no text in the screen show , i don't know why) Is there any missing property in the code? Also, when I create text or movie clip with flash tools on the stage and give it an instance name, flash builder doesn't seem to recognize it in the action script code.

package
{
    import flash.display.MovieClip;
    import flash.text.TextField;

    public class mark extends MovieClip
    {

        public function mark()
        {

            super();
            public var d:TextField=new TextField();

            d.text="Hello world";
            d.x=250;
            d.y=300;
            addChild(d);

        }
    }

sentences:
Tile slopes and jittery movement I'm trying to handle slopes in a tiles based world. I'm using basic linear interpolation to find the Y coordinate of the character based on his X position. But i have a problem, when the character move up or down the slopes the sprite is all jittery, it doesn't move smoothly and i can't figure out why.

I don't use a "true physics engine" all the engine does is AABB collision and tell when a collision occurs and let you handle the reaction. When the character is on a slope no "gravity" (Y velocity) is applied the Y position is adjusted by hand using the linear interpolation result.

Here is the linear interpolation function that i use :

float InterpolateY(Vector2 point1, Vector2 point2, float x)
{
    float x1 = point1.X;
    float y1 = point1.Y;

    float x2 = point2.X;
    float y2 = point2.Y;

    float y = y1 + (x - x1) * (y2 - y1) / (x2 - x1);

    return y;
}

I've made a webm to show you the problem (ignore the fact that the sprite sink into other tile it doesn't matter for the moment)

Link to the webm : https://webmshare.com/play/vPXLD

sentences:
Overlap2d + LibGdx load large map I've been wondering if it's possible to load a large map made with Overlap2d before I get started with my project.

A large map for me is something equivalent to a map from recent open-world RPGs like The Wichter 3, but in 2d.

The map is drawn in advanced (it's not procedurally generated), and the game will be for Android devices so I thought a large map should be loaded in chunks.

Is it possible to load a large map mad with Overlap2d in LibGDX?

sentences:
Can steam features be used in a game bought on an alternate distribution platform? We're in the process of game development where we need to integrate with the Steamworks API for multiplayer matchmaking, achievements, player stats, etc. We also have a rudimentary implementation integrating with the Steam Workshop in order to distribute player-authored content.

However, I have a remit that the game should be publishable on other distribution platforms such as GOG.

If we were to distribute on an alternative platform such as GOG, is it acceptable to rely
on steam features? I presume this would mean the player
purchasing on GOG and being forced to install steam and set up a
steam account before playing. (I'm also aware that GOG are very much
anti-DRM which might entail a separate build version too, if even possible).
If not acceptable, what's the alternative? Are developers expected to employ platform-specific or a proprietary network system for multiplayer matchmaking for instance? How is this achieved in other games?

sentences:
How can I support multiple player inputs in Pygame? I'm trying to develop a team-based Asteroids game. It's going well except for the "multiple user inputs to a single machine" part. Can anyone recommend a method for getting and updating 6 players using a single computer? Is it even possible? At the moment I'm working with a couple of old XBox controllers and a keyboard and it's almost working...

Is it possible to add additional keyboards? And would you arrange the code into one big get events function or is there a better way to check for user inputs at this scale?

sentences:
How to prevent sending semantically wrong messages in event based architecture? I have created the following architecture in C++:

ReceiveMessage has two important parameters:

Scope, which defines the scope, like game object, scene or core. This determines how far the message will be forwarded. For example, core messages will be processed by Core, and game object messages will processed by GameObject.
Event, which defnes the name of the event, as an enum. This might include FIND_GAMEOBJECT_IN_RANGE, PLAY_SOUND, etc.

If I accidentally send an event that can only be handled by Core with the game object scope, instead of core, it is only checked at runtime. Currently, it is possible to send a message like ReceiveMessage(GAMEOBJECTS, PLAY_SOUND, ...);. This would be forwarded to every game object, and won't be handled, because the PLAY_SOUND event is only properly handled by Core.

How do I redesign my messaging system so that the compiler will give an error or warning when I try to send a message with an invalid scope-event pair?

sentences: Does Unity store temporary autosaves for scripts? If not, how do I avoid data corruption My PC lost power in the midst of a save(twice in a row) and I've lost my scene setup as well as a script(its contents actually). I would like to know if there are any fail-safes for saving files. If not, how would I prevent future data loss/corruption.

sentences:
GLSL shader compilation When i'm compiling a shader does it have to be complete? Can i use glCompileShader on a shader without a main() function? The OpenGL reference documentation has a nice writeup on program linking errors, but i can't find one for shader linking, so i have to ask here.

I want to have the ability to have each part of a shader in a different file. So f.e. i'll have a material calculating function and i'll have a "main" shader with the main function that'll only reference the material calculating function. Right now i have my shaderes as arrays of strings that they can read from a file, then i put together an array of string pointeres and compile that into a single shader (vertex, fragment, geometry). But if i could compile each invidividual shaders (parts of vertex shaders, instead of the whole vertex shader put together in an array of strings) and put them together when i'm linking the program, that would make the code much clearer and i could move the shader compilation code from the program managing code to the shader object itself (the one that load the string from file and exposes it).

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: is it possible to use c# GUI toolbox in an XNA app? I need both reach GUI features of c# toolboxes and fast rendering features of XNA, is there any way to merge these two into one app? or is there any other way? for example some equivalent to c# toolbox in xna?

sentences:
Addressable Asset Loading with Queue And Coroutine I have around 17000 addressable assets (prefab) tiles that I am loading near the position of the camera.
Here is my algorithm

Get all Reference of the 17000 tiles in the array
Loop through the array and get the tiles that are within the proximity of my Player and queue It.
Based on the first enqueue item, start downloading the tiles with Addreessabl.Instantiate. Load one by one and wait for the first item download to finish.

here is the main loop that is doing the work:
 public IEnumerator StartDownloading()
    {
             isDownloadStarted = true;
        while (singleAbLoader.Count > 0)
        {
            SingleADLoader singleAbLoaderCurrent = singleAdLoader.Dequeue();
            if (abLoaderUnloaderManager.GetTilesWithinPlayerRange(singleAbLoaderCurrent) == true){

                Debug.Log("Starting to call " + singleAbLoaderCurrent.gameObject.name);
                yield return singleAbLoaderCurrent.DownloadAB();
                Debug.Log("Finsihed to call " + singleAbLoaderCurrent.gameObject.name);
                loadingSlider.value = sliderIncrementValue;
            }else
            {
                Debug.Log("escaping the download" + singleAbLoaderCurrent.name);
                yield return null;
            }
        }

        isDownloadStarted = false;
    }

whereas the DownloadAD()
public IEnumerator DownloadAD()
{
    AsyncOperationHandle<GameObject> handle = Addressables.InstantiateAsync(prefabToLoad);
    yield return handle;
}

The tiles are loading fine but the problem is they are way too slow. I mean it takes much time to load tile.

sentences:
Box2D recommended step, velocity and position iterations Here in this article there is a nice explanation that velocity iterations and position iterations settings affect the way bodies will react when they collide, and step affects on speed and how gravity acts. So the precision is hidden behind position and velocity iterations, whereas you need to have the world step to advance the time in physics world. I also know that step should be constant to be able to have consistent and debug-able game physics. Hence I do this (where dt is FPS delta time):

if (m_world.GetBodyCount() > 0)
{
    static const double step = 1.0 / 70.0;
    static double accumulator = 0.0;

    // max frame time to avoid spiral of death
    if ( dt > 0.25 )
        dt = 0.25;

    accumulator += dt;

    while (accumulator >= step)
    {
        m_world.Step(step, VELOCITY_ITERATIONS, POSITION_ITERATIONS);
        accumulator -= step;
    }
}

So I guess the step should not be less then FPS minimum value to avoid discrete simulation (cutting effects). Usually FPS is 1/60.0 hence I have chosen 1/70 as a step to have the best performance. And as Velocity and Position iterations I use 6 and 2 respectively which turned to be enough for collisions till today. Is my logic correct or I miss something? Is there a way to optimize more? What are the recommended values for this parameters for mobile games (considering that the game should work on week devices too). Should I use non-constant velocity iterations and position iterations reducing them when FPS drops?

sentences:
MMO Client / Server Architecture (NoSQL) The main aim is to keep the games variables server-side for obvious security reasons.
I believe having server-side code to check before updating the games database values will protect me from classic game hacking methods.

To avoid clients sending direct updates to the database, the server first validates the clients requested actions.

The database keeps track of every Mobile & Item

The Server has all the game-logic

The clients simply render and work as controllers that send the server actions that wont occur unless validated by the servers logic.

Clients should only send the server "Action Request"

Server then checks the "Action Request" with two possible outcomes :

Valid Request : Update DB and Re-send updated data to Clients for post-processing.
Invalid Request : Notify the client that the Request was invalid.

I need to know if im thinking in the right tracks.
Thanks.

sentences:
Manager game questions (Sorry about the bad title, it's the best I could come up with)

I've been planning a gladiator manager game for a while now. Something similar to Blood Bowl (or Football Manager, only with fighting rather than kicking a ball), only with a much larger focus on the actual managerial aspects of running a team. I'm still fairly new to game development, and have only created games with a very narrow focus (i.e. simple first person shooters), so taking on a project with a larger scope is very interesting, but also problematic since I really don't have a grip on how exactly to make the damn thing work.

Basically my two major hurdles are the interface and database. Obviously the interface is incredibly important since the player will spend most of his/her time doing managerial tasks. The game will be team-based, with various leagues in which those teams fight in, so it all relies on a database. I have never done any real work with databases, so this in particular has me stumped.

At this point, my idea is to use XNA in a WPF application, with an XML database. This just seems like a combination that would work well together, and as I have a C#/XNA background, I wouldn't need to learn a new language or graphics framework to work in.

Does that seem like a sensible combination, and if not, why? I have never done anything with WPF, so all of my information on it's uses comes from Google, and that may or may not be a good thing. Would XML be a smart choice? There will likely be a fairly low (think 20-30) number of teams, all of which will have a dozen or so fighters, so it's not a monstrously large set of data.

Thanks in advance, I know I didn't write the most intelligent post ever, but I had to get my ramblings out somehow. ;)

sentences:
Getting position of a coordinate on the surface of a sphere So I want to create a object B close to another object A, but I'm trying to avoid that A covers B:

I have thinking how to achieve that. Take a look of the following drawing:

I have been thinking in a solution in a math - geometry way before searching for some Unity3D function to solve the problem. I have realise A and B would be on the same surface if the camera is within a sphere with radius c-A. So I guess the solution can be related to get a point at a B at a distance A-B from A on the surface of the sphere with radius c-A. Does it has sense? Any other idea? How to do it with maths and Unity?

sentences:
"Model Driven" Game Prototyping Are there any known libs / frameworks / systems allowing to prototype a game based on a defined "model" of the game mechanics?

Think all those match 3 games, i'm looking for "something" allowing to try out new rule sets in rapid prototypes where dealing with the grafix/updating the screen based on the state and input/output is only secondary and having something running and interactive is most important to validate an idea...

Do such tools exist? What would be your take on this when asked to skip as much coding as possible?

To clarify: nope I am NOT looking for any magic. What I am looking for are tools allowing to concentrate more on the "logic" of a game (atleast for simple games ala match 3) and not having to code all the screen/input/ui stuff, thus the "model driven" naming...

sentences:
cocos2d: syncing CCAnimation frames with Box2d Shape manipulations my cocos2d game currently has a ccsprite attached to a box2d body.
during the game i apply different CCAnimations on my sprite, i would like to perform certain manipulations to the box2d body according to the frame currently displayed by the sprite (change rotation of the body, etc.) my current idea on implementing this is to subclass ccsprite and change the setDisplayFrame implementation but i thought somebody here probably did the same and already has a solution, so any suggestions on how to implement this?

thanks!

sentences:
A class for all levels or for each level an own class? My Game become more complex with each new Level or Map that I design.
The game is an basic rpg game like Pokemon.

For now I have one class that organize all Maps but different maps have special features and different Monsters.

Better use for each Map an own Class and have duplicated code
or is there a specific pattern for this?

Edit:
My Problem: I can load the new map and play but all maps have different monsters and different events. I can't put all of them in the Game class and check all the time everything.

my class diagram in simple:

sentences:
What are the steps to instantiate a button in Unity? Given a Canvas test_canvas containing a Button test_button and an empty GameObject that manages instantiation and scripts and the like called test_manager, what are the steps to instantiate this button through code as opposed to having it already there?

I've tried making the button a prefab and instantiating it as I would any other object but that didn't work. I tried making the canvas a prefab and then trying the button but nothing. I've searched around for quite some time and there's mention of RectTransform and SetParent but steps or specific details would clear up my confusion

sentences:
What is the difference between Vector2.Transform and this method? I've been working on some steering behaviors and ran into trouble with my logic for converting points in world space into points in local space. I had this (it's not optimized for multiple points yet, but that is not the point of my question):

public Vector2 WorldPointToLocal(Vector2 point)
{
    var tx = -Vector2.Dot(this.Location, this.Heading);
    var ty = -Vector2.Dot(this.Location, this.HeadingPerpendicular);
    var rotationMatrix = new Matrix
    {
        M11 = this.Heading.X,
        M12 = this.HeadingPerpendicular.X,
        M21 = this.Heading.Y,
        M22 = this.HeadingPerpendicular.Y,
        M31 = tx,
        M32 = ty
    };

    return Vector2.Transform(point, rotationMatrix);
}

This did not work. The returned point was always well outside the expected range. I had collated most of the mathematics from various sources and began to suspect that Vector2.Transform wasn't doing what I thought it was supposed to do. I found an alternative implementation in C and translated it into C#:

private Vector2 VectorTransform(Vector2 vector, Matrix matrix)
{
    var tempX = (matrix.M11 * vector.X) + (matrix.M21 * vector.Y) + matrix.M31;
    var tempY = (matrix.M12 * vector.X) + (matrix.M22 * vector.Y) + matrix.M32;

    return new Vector2(tempX, tempY);
}

When I used this implementation instead of Vector2.Transform, everything worked perfectly.

However, I don't want to leave it at that. I'd like to understand why Vector2.Transform does not do the same thing, and whether there's anything I can do to leverage it instead of writing my own. The API documentation doesn't help at all and I'm a bit clueless when it comes to matrix mathematics.

sentences:
How do I apply domain warping to my marching cubes voxel terrain in Unity? So, in GPU Gems 3 there is a cool warped terrain that I seek to replicate.
Currently, I'm generating the terrain fine, but I want to add that warp effect.

// Do this before using 'ws' to sample the nine octaves!
float3 warp = noiseVol2.Sample( TrilinearRepeat, ws*0.004 ).xyz;
ws += warp * 8;

Im wondering how to replicate the above code in C#. What does the above code do? What type of variable is noiseVol2.Sample(x,y).xyz?

I want to warp my own terrain, currently I have a system that creates octaves of perlin noise with certain frequencies and amplitudes.

It looks something like this:

var perlin0 = new Perlin3(0,baseFreq  * 4.03f, 0.25f);
var perlin1 = new Perlin3(1, baseFreq * 1.96f, 0.50f);
var perlin2 = new Perlin3(2, baseFreq * 1.01f, 1.00f);
var perlin3 = new Perlin3(3, baseFreq * 0.49f, 2.00f);
var perlin4 = new Perlin3(4, baseFreq * 0.24f, 4.00f);

return new Density(ws => {

        // start with plane
        float density = plane.Evaluate(ws);

        // add perlin noise to get density values at each ws co-ord.
        //3 octaves currently (3 perlin noise +=)
        density += perlin0.Evaluate(ws);
        density += perlin1.Evaluate(ws);
        density += perlin2.Evaluate(ws);
        density += perlin3.Evaluate(ws);
        density += perlin4.Evaluate(ws);
        return density;
    });

I've tried replicating it like so:

var q = new Vector3(perlin0.Evaluate(new Vector3(0,0,0)), perlin0.Evaluate(new Vector3(5.2f, 1.3f, 1.3f)));
var q1 = new Vector3(perlin1.Evaluate(new Vector3(0, 0, 0)), perlin1.Evaluate(new Vector3(5.2f, 1.3f, 1.3f)));
var q2 = new Vector3(perlin2.Evaluate(new Vector3(0, 0, 0)), perlin2.Evaluate(new Vector3(5.2f, 1.3f, 1.3f)));
density += perlin0.Evaluate(p + 4.0f*q);
density += perlin1.Evaluate(p + 4.0f * q1);
density += perlin2.Evaluate(p + 4.0f * q2);

I've read the article that Íñigo Quílez created, and implemented it like above. Am I doing something wrong? It looks the same without that, just using

density += perlin0.Evaluate(p);
density += perlin1.Evaluate(p);
density += perlin2.Evaluate(p);

I want to know what I'm doing wrong, what I misunderstood and how to implement it correctly.

This is all based off this lumpn's proceedural-generation on github
(I would link it, but I can't)

Thanks.

I would also want to know if there are any examples (I learn best from codebases) with this implementation using shaders. (Maybe it will run faster because it uses the GPU instead of the CPU?)

This is still unanswered on how to do it on the CPU
(and I'm still confused on how to do it on the GPU, do you have to do some vertex stuff? how do you pass in a noise texture through the shader?)

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:
Is there a cross-platform special directory I can use for game save files? I'm developing with LWJGL and Java on a Windows 7 laptop. I've successfully set up saving to the %appdata%\gamename\saves\ or long form c:\users\user\appdata\roaming\gamename\saves\ folder by using File dir = new File(System.getenv("APPDATA") + "\\gamename\\saves\\");.

I have hobbyist level experience with Linux, and zero experience with OSX. My game will be fully cross platform.

Is System.getenv("APPDATA"); cross platform? If so, where does it point to on Linux or OSX? Is there a best practices alternative that I should use?

sentences: custom SetInterval function in javascript i am trying to make an custom set interval function for my game but everytime i tried, i end up with a infinite loop. I can't use the default javascript's set interval because it can not take the random number. any idea?

sentences:
Game Programming Junior Demo Design Consider the following demo:

http://www.ashereinhorn.com/post/11140243390/short-capture-from-the-last-xna-version-direct3d

(It has now almost been converted to C++ and DirecX10, and so the code is not important here, it's the substance I'm interested in)

Basically the little agents move around killing each other, their states are displayed in a corner and you can select one so as to see the items it can see, it's field of view and the things it is holding in memory.

I showed it to someone that works in the industry and they said I should focus on tracking a single agent and make what's going on more clear - so maybe animate each state with simple animations or model swapping to make it more obvious when they are searching / in combat / running away. The other thing they said I should change was the fact that the agents simply disappear when killed, and reappear when spawned because again, it's not clear what's happeneing. As a result I'm going to implement a simple particle system so that agents 'shatter' when killed and possibly reassemble when spawned.

My question is, are there any really obvious changes that I should make to this demo with a view to getting my first game programming job? If you work or know about the industry, is there anything that jumps out at you that should be included? Or is bad? or good for that matter?

Are there any things that would particularly impress or grab your attention in a game demo?

Thank you very much for any help you can give!

EDIT - The walls are actually solid in the C++ version

sentences:
Tools for level (wireframe) design We are currently working on a 2D platform game, all lot of the game elements have been created and designed. But now it is time to design all the levels.

What I am wondering is: Are there any tools which simplify level design, we prefer designing in basic wireframes, so no actual graphics yet. It would also be neat if the tool would allow layering specific groups;

Background
Platforms
Enemies

I have thought of tools like Visio or Omnigraffle but these aren't specifically meant for game design.

sentences:
How to test a Unity game with different graphics APIs? If I don't have a device with Metal, is there a way to test the application with it anyway?
And if my device supports both DirectX and OpenGL, how can I tell the application, for example on Windows, which one should it use?

sentences:
Stopping an object after applying an impulse or force? I'm having a small issue where after applying an impulse or force it is impossible to actually get an object to stop, i.e. a velocity of zero.

This code is run every 1 / 60 of a second:

void RigidBody::Update(double deltaTime) {

    double mass = GetMass();
    //If static body, do nothing.
    if(Math::IsEqual(mass, 0.0)) return;

    Vector2D F;
    Vector2D total_forces = std::accumulate(_curState._forces.begin(), _curState._forces.end(), Vector2D());
    Vector2D total_impulses = std::accumulate(_curState._impulses.begin(), _curState._impulses.end(), Vector2D());
    F = _curState._gravity + total_forces + total_impulses;
    _curState.ClearImpulses();
    SetAcceleration(F / mass);
    SetVelocity(GetVelocity() + GetAcceleration() * deltaTime);
    SetPosition(GetPosition() + GetVelocity() * deltaTime);

}

RigidBody::SetAcceleration(const Vector2D& acceleration) {
    _prevState.SetAcceleration(_curState._acceleration);
    _curState.SetAcceleration(acceleration);
}
//Similar for RigidBody::SetVelocity and RigidBody::SetPosition...

If I apply an impulse, say (-1.0, 0.0), the object's acceleration changes by -0.012 or -0.011 instantaneously and only once then reverts to (0.0, 0.0), which then changes the velocity to (-0.012/-0.011, 0.0). Equal and opposite changes in acceleration causes rounding errors to accumulate to the point where the velocity will never be zero and the object will never stop.

Similarly, if I apply a force, (-1.0, 0.0), the object's acceleration changes to (-1.0, 0.0), equal and opposite forces applied so the acceleration changes to (0.0, 0.0) works but the velocity changes so minutely that again, the object will never stop. (The closest I've ever gotten it was (0.009, 0.0) )

sentences:
'CoreMinimal.h' file not found when building on Unreal Engine on Mac I'm trying out C++ on Unreal Engine 4.25 on Mac. If relevant, my Xcode version is 12. When I try to compile, there's an error: 'CoreMinimal.h' file not found.
I've looked around and some solutions mention a workaround, which is to add the path to CoreMinimal.h into the .vscode/c_cpp_properties.json file. I did that:
...
    "includePath": [
        "${workspaceFolder}/**",
        "/Users/Shared/Epic Games/UE_4.25/Engine/**" // This is the filepath to CoreMinimal.h
    ],
...

I still get the same error. I couldn't find any other solution. Has someone found a solution to this?
Thanks.

sentences:
My array loads in the wrong order I have a load all chapters script which loads up all the Chapter items in an array and instantiates the buttons in the Viewport so you can select which chapter you would like to play. The problem is the chapters load up in the wrong order, they load up as Chapter 4, Chapter 0, Chapter 1, Chapter 2, Chapter 3. Below is the code I am using.

void Start()
{
    menuManager = GetComponentInParent<MainMenuManager>();
    levelManager = GetComponentInParent<LevelManager>();

    chapterArray = Resources.LoadAll<GameObject>("Chapters").OrderBy(go => go.name).ToArray();

    txtStatus.text = "";
    if (chapterArray == null)
    {
        txtStatus.text = "Could not find Chapters";
        return;
    }
    else
    {
        txtStatus.text = "Loading...";
        FillChapterList();
    }
    txtStatus.enabled = false;
}
void FillChapterList()
{
    foreach (GameObject chapter in chapterArray)
    {
        GameObject listChapter = Instantiate(chapterListItemPrefab);
        listChapter.transform.SetParent(chapterListParent, false);

        ChapterListItem _chapterListItem = chapterListItemPrefab.GetComponent<ChapterListItem>();
        chapDetails = chapter.GetComponentInChildren<ChapterDetails>();

        _chapterListItem.Setup(chapDetails.chapterNumber,chapDetails.chapterName);
    }
}

This is not only happening with the Chapter Select, it has been happening with all the arrays I load up in this fashion. Below is the visual side of the problem where you can see it loads the last object First.

I have been struggling with this for a while and I think its stopping me from progressing forward. Thank you for reading this and taking the time out of your day to help.

sentences: Animation Texture spread out when animation on 3dsMax I have a 3d model of a human biped, i did the skeleton and attached it to my 3d model with a skin modifier. But when i move his arms a part of the trunk is comming too . Is it possible to fix this ?

sentences:
Unity 3D C# - Shifting beetween worlds? Let's say I want to replicate Planeshifting from Legacy of Kain: Soul Reaver in Unity.

There are 2 realms: Spectral realm and Material realm.

The Spectral realm is based on the Material realm, only has the geometry distorted and certain objects fade out/become non-interactive.

In Soul Reaver, it is used as means to go to areas where you normally wouldn't be able to in Material (distorting geometry), to use other powers (such as going through grates).

My question is: Is it even possible at all to implement this in Unity 3D? (I would need the Scene(level) or the objects to have 2 states somehow that I could switch beetween/distort to real-time.)

sentences:
Unity: Spin wheels to move vehicle I am just getting started with Unity and I'd like to ask a question. If I have a "Vehicle" object that has two children: "FrontWheel" and "BackWheel" (both 'wheels' are cylinders), how should I set everything up such that I can move the entire vehicle by turning its wheels?

When I apply a torque to "FrontWheel", the vehicle starts to move, but instead of the whole thing the moving together, the chassis is rolling on the cylinders and eventually falls off.

How can I prevent it from doing that?

sentences:
Roguelike game: detect intent of other actors by observing their moves In grid turn-based roguelike game, how can I detect the following scenarios:

other actor is following observing actor
other actor is intentionally moving to block its path

Path blocking can happen if for example player intentionally stops right in front of actor and then when actor moves to avoid player, player moves in front and that keeps repeating as long as player does it. I managed to detect that situation in hackish way and I would like to know if there is a better method for solving things like this.

sentences:
glutPostRedisplay() is not redrawing after updating model view matrix I am trying to change the rotation of my object with keyboards, when I move the object in the direction of x, y or z it is okay, it is responding correctly. But when I try to change rotation, it does nothing at all.

void keypress(unsigned char key, int x, int y) {
Matrix R;
HomVector a;
switch(key) {
case 'x':
    cam.position.x -= 0.2f;
    break;
case 'X':
    cam.position.x += 0.2f;
    break;
case 'y':
    cam.position.y -= 0.2f;
    break;
case 'Y':
    cam.position.y += 0.2f;
case 'z':
    cam.position.z -= 0.2f;
    break;
case 'Z':
    cam.position.z += 0.2f;
    break;
case 'i':
    cam.rotation.x -=90.0f;
    R = RotationMatrix(-90, X);
    V = MatMatMul(V, R);
    PV = MatMatMul(P, V);
    break;
case 'I':
    cam.rotation.x += 90.0f;
    R = RotationMatrix(90, X);
    V = MatMatMul(V, R);
    PV = MatMatMul(P, V);
    break;
case 'j':
    cam.rotation.y -= 90.0f;
    R = RotationMatrix(-90, Y);
    V = MatMatMul(V, R);
    PV = MatMatMul(P, V);
    break;
case 'J':
    cam.rotation.y += 90.0f;
    R = RotationMatrix(90, Y);
    V = MatMatMul(V, R);
    PV = MatMatMul(P, V);
    break;
case 'k':
    cam.rotation.z -= 90.0f;
    R = RotationMatrix(-90, Z);
    V = MatMatMul(V, R);
    PV = MatMatMul(P, V);
    break;
case 'K':
    cam.rotation.z += 90.0f;
    R = RotationMatrix(90, Z);
    V = MatMatMul(V, R);
    PV = MatMatMul(P, V);
    break;
//case 'Q':
case 'q':
    exit(0);
    break;
}
glutPostRedisplay();

}

This is the code, my matrix is changing after multiplication, but does not respond to glutPostRedisplay() function. If there is a problem, I cannot see it, if anyone can help, that would be great!

sentences:
How to make progress bar adapt to various aspect ratios in Unity3d Can anyone help me with this problem:
I want to make a time progress bar in my game. I have two textures: progressBarFrame and progressBar. Currently I'm doing the following:

void OnGui() {
    GUI.DrawTexture ( Rect(x,y,width,height), progressBar );
}

It works, but it doesn't adapt to different screen sizes.

I also tried this: Create GUITexture in the hierarchy and add a texture to it, after adjusting  its size and location as I need, progress bar stretches/squishes with different aspect ratios and keeps its position relative to other GameObjects (that's what I want). But I don't know how to animate it properly because the figure of the textures is not a simple line.

sentences: How, if possible, do you add loop cuts to models in real time? I am working on a prototype for a very low poly game. I can't figure out a way for a player to cut or break objects in real time without predefined fractures. For example, if a player cuts a tree, it will separate at the cut point rather than at a predetermine fracture. So how can you create a vertex loop and separate the halves in real time?

sentences:
How to create a normal map for my dice texture? I have this simple dice texture and would like to create a normal map for it where the black dots are are dents and the edges are trimmed(like on a actual dice)
I'm using unity5. I need a explanation on how to create the normal map in PhotoShop CS5 or a code solution. Thanks in advance.

Here is the dice texture I'm using.

sentences:
MoCap data files applied to avatars using Mecanim I am applying some animations (e.g. running) from this free MoCap package that I got off the Unity Assets Store, and as far as I can see from running the animation previews, they seem fine (i.e. playing smoothly) but once I apply them to my avatar (generated through the free AutoDeskCharacterGenerator) and I run the animation, the avatar seems to rise on the floor...

Please see the attached images that illustrate the character (with its collider, etc...) initially being perfectly aligned (touching the ground) but then a few seconds into running, it has been lifted off the ground.

At first, I thought this must be due to the recorded motion data files, but (1) it has happened in every animation I have tried from the package so far, and (2) these motion data files were recorded off real people, so I find it unlikely that all the performers happened to be moving around on very uneven surfaces and slopes.

Has anybody come across this problem before?

sentences:
How to move a sprite automatically using a physicsHandler in Andengine? I use a DigitalOnScreenControl (knob with a four-directional arrow control) to move the entity and the entity which is bound to a physicsHandler.

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

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

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

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

sentences:
How can I emulate point sprites in D3D11? I have points which I pass to a vertex shader and then to a geometry shader, but now I want to get from the geometry shader a "bigger" point. So the point should get a "dadius" like it was possible in Direct3D 9.

Can anyone help me what I have to write in my geometry shader? I actually have the following code, which only passes the point to the pixel shader.

void LightGeometryShader( point GeometryInputType input[1], inout PointStream<GeometryInputType> TriStream)
{
    GeometryInputType output;

    for( int i=0; i<1; i++ )
    {
        output.position = input[i].position;
        output.color = input[i].color;
        output.tex = input[i].tex;
        output.viewDirection = input[i].viewDirection;
        TriStream.Append( output );
    }
}

sentences:
How to "swing" bounding box and update collision for sprite swinging a weapon? I have a simple question about sprite swinging weapons. I am making an RPG and would like something other than stabby-swords, so why not swinging swords?

I have a bounding rectangle for them, and the player equips them. Great, but I cannot grasp around my head how to swing both the sprite AND the bounding box (in XNA).

The sprite is easy, I specify it's origin and rotate by a specified amount over a certain amount of time (the swing time), but the bounding rectangle poses another issue for me.

Edit: A bit of clarity on my swinging animation. It's basically the player holding out their arm and the weapon swings in a curve from about +45 degree angle to a -45 degree angle.

sentences:
Transfer Codes between OS I'm making a mobile game and had the idea of using transfer codes for taking one account to another device.

Lately, I've seen this function being used in a lot of mobile games, you go to the game settings, issue a transfer code, input it in the new device and the game account is transferred. However it's not clear for me as to how this works? since many games I have seen with this function can't transfer premium currency between different OS, for example. Or some of them, after transferring the game disable the old device from transferring back the same account before certain time has passed.

I have been looking for some information about this system but haven't been able to find out anything. So I was hoping if anyone could point me into the right direction, specially in the point about currency transfer between different OS.

Edit: I'll try to be a little more clear about the issue. I want to have a feature where the user cas generate a code to transfer his account or progress to another device, that's it.

The other question I had was because this kind of systems do exist actually. Mostly on games developed in Asia. They allow you to transfer your progress this way to any other device BUT if you do this from one OS to another normally you can keep your progress intact but not the in-game currency. So I was wondering why

sentences:
Giving points to users - how can I make it interesting? I have a website where users can choose the winner of a sporting event. If they guess correctly they get 1 point, otherwise they receive zero points. At the end all users are ranked based on their score, which is computed like this:

score = points * (number_of_guesses / number_of_misses)

It's a rudimentary system but it works alright. However I am looking for a points system that's more interesting to the user, that makes the game more engaging. For example giving more points for picking the underdog in an event might make the game a bit more interesting.

Can you offer me some suggestions?

sentences:
Beginning RTS game student project I have experience with XNA and Unity3D. I have also built my own engine with Tao and C#. I am in last year of college and I want to make a small RTS game demo, nothing fancy I won't bother much with the art part. I will leave objects untextured, just drop some light.

It is a big decision, which one to choose XNA or Unity3D or maybe else? I definitely won't build my own engine since I will waste lot of time that way. I am looking for an engine/framework that will allow me to concentrate on higher level stuff like AI algorithms rather than do my own texture loading and stuff.

I will try to copy stuff from Starcraft2. My models and environment won't be textured though. I won't bother with sounds either, just some simple explosion and shooting sounds. The player will play against AI. I will go for the Starcraft2 mechanics/logic, not the skin. By skin I mean art stuff. At the end I would make small videos of gameplay showing the AI decision making process by printing text, so that a potential employee can see what is actually going on.

sentences:
Calculating the geometry of a thick 3-way miter joint Following a very helpful post on another forum I've found a simple algorithm that takes an array of 2D vectors and creates a triangle strip.
I've modified the source code for my purposes. I haven't tested it yet, but it should do the trick.

public static void PolyLineToTriangleStrip(Vector2[] pts, bool closed, float thickness, List<Vector2> vertices, List<int> indices)
    {
        var numPts = pts.Length;
        vertices.Clear();
        indices.Clear();
        for (int i = 0; i < numPts; ++i) {
            int a = ((i - 1) < 0) ? 0 : (i - 1);
            int b = i;
            int c = ((i + 1) >= numPts) ? numPts - 1 : (i + 1);
            int d = ((i + 2) >= numPts) ? numPts - 1 : (i + 2);
            var p0 = pts[a];
            var p1 = pts[b];
            var p2 = pts[c];
            var p3 = pts[d];

            if (p1 == p2)
                continue;

            // 1) define the line between the two points
            var line = (p2 - p1).normalized;

            // 2) find the normal vector of this line
            var normal = new Vector2(-line.y, line.x).normalized;

            // 3) find the tangent vector at both the end points:
            //      -if there are no segments before or after this one, use the line itself
            //      -otherwise, add the two normalized lines and average them by normalizing again
            var tangent1 = (p0 == p1) ? line : ((p1 - p0).normalized + line).normalized;
            var tangent2 = (p2 == p3) ? line : ((p3 - p2).normalized + line).normalized;

            // 4) find the miter line, which is the normal of the tangent
            var miter1 = new Vector2(-tangent1.y, tangent1.x);
            var miter2 = new Vector2(-tangent2.y, tangent2.x);

            // find length of miter by projecting the miter onto the normal,
            // take the length of the projection, invert it and multiply it by the thickness:
            //      length = thickness * ( 1 / |normal|.|miter| )
            float length1 = thickness / Vector2.Dot(normal, miter1);
            float length2 = thickness / Vector2.Dot(normal, miter2);

            if (i == 0 && !closed) {
                vertices.Add(p1 - length1 * miter1);
                vertices.Add(p1 + length1 * miter1);
            }

            vertices.Add(p2 - length2 * miter2);
            vertices.Add(p2 + length2 * miter2);

            if (closed && i == numPts-1) {
                indices.Add(i * 2);
                indices.Add(i * 2 + 1);
                indices.Add(0);
                indices.Add(i * 2);
                indices.Add(0);
                indices.Add(1);
            } else {
                indices.Add(i * 2);
                indices.Add(i * 2 + 1);
                indices.Add(i * 2 + 2);
                indices.Add(i * 2);
                indices.Add(i * 2 + 2);
                indices.Add(i * 2 + 3);
            }
        }
    }

Feeding it a sequence of vectors would produce something a bit like this:

However, I want to complicate matters by introducing another problem - 3 way joints (or rather n-way).

It must be possible to do this by building on the algorithm, but I'm not sure how I would modify the above algorithm to draw an n-way miter joint with perfect angle distribution like so:

The highlighted lines represent the source lines that would be fattened up by the algorithm.

I calculated and drew these in blender, unfortunately I'm at a bit of a loss to do it programmatically.

Obviously this cannot be achieved with simple line sequences, but that's beside the problem. All that' needed is a central point and n-ammount of points that represent the ends of outcropping lines, and then an algorithm to calculate the outer edges of the required shape.

sentences:
Rotating game object without using localEulerAngles I'm building a player controller.

While aiming, the player can rotate the chest bone. This looks as if the character aims in different directions.

The chest bone should only be allowed to rotate within a certain range.
If this range is exceeded (either to the left or to the right), the chest bone should stay at its current rotation, and the player should be rotated instead.

I'm having problems applying the desired rotation to the parent game object instead.

I'm trying to work with the localEulerAngles in order to applying an additional Y rotation to the gameobject, but the Y rotation value tells me for example "359.9" while I expected to work with a value of ~0.

private void pHandle_LateUpdate_Aim()
{
    Quaternion oldNeckRotation = Neck.transform.rotation;

    // Fade old input before capturing new, so we don't dull the freshest data.
    float yawBlend = Mathf.Pow(1.0f - Aim_yawInputFalloff, referenceFramerate * Time.deltaTime);
    // A Lerp toward zero is just the same as a multiplication by the blend factor.
    Chest_yawRate *= yawBlend;
    // Accelerate by mouse movement over the past frame.
    // (May need adjustment for display resolution).
    Chest_yawRate += Input.GetAxis("Mouse X");

    float yawDelta = Chest_yawSpeed * Chest_yawRate * Time.deltaTime;
    float offCenterYaw = Chest_currentYaw - Chest_yawCenter;

    float fDesiredChestYaw = Chest_currentYaw + yawDelta;
    float fHeroRotation = 0f;

    if (fDesiredChestYaw > Chest_rotateRange) // the allowed chest rotate range would be exceeded. Instead, move the gameobject / the parent.
    {
        fHeroRotation = (fDesiredChestYaw - Chest_rotateRange);
        fHeroRotation += this.transform.localEulerAngles.y;
        this.transform.Rotate(0, fHeroRotation, 0);
        return;
    }
    else if (fDesiredChestYaw < -Chest_rotateRange)
    {
        fHeroRotation = (Chest_rotateRange + fDesiredChestYaw);
        fHeroRotation += this.transform.localEulerAngles.y;
        this.transform.Rotate(0, fHeroRotation, 0);
        return;
    }
    else
    {
        // If we're moving away from the center, slow down as we approach the edge.
        if (yawDelta * offCenterYaw > 0)
        {
            float extremityYaw = offCenterYaw / Aim_yawMaxRange;
            yawDelta *= 1.0f - extremityYaw * extremityYaw;
            fHeroRotation = yawDelta;
        }
    }

    // Ensure we never overshoot the allowed range.
    Chest_currentYaw = Mathf.Clamp(Chest_currentYaw + yawDelta,
                              Chest_yawCenter - Aim_yawMaxRange,
                              Chest_yawCenter + Aim_yawMaxRange);

    Vector3 nNewChestRotation = new Vector3(Chest.localEulerAngles.x, Chest_currentYaw, Chest.localEulerAngles.z);
    Chest.localRotation = Quaternion.Euler(nNewChestRotation);

    Quaternion newNeckRotation = Neck.transform.rotation;

    //the neck should not rotate with the chest. So I first counter-rotate it against the new chest rotation, then rotate it a little towards the chest rotation
    Neck.transform.rotation = Quaternion.Lerp(oldNeckRotation, newNeckRotation, neckFollowChest);
}

sentences:
How can we generate 3D architecture in a racing game's background procedurally with respect/similar to the real world? In the last few days, I jumped into searching is there a conventional/convenient way to build 3D architecture quickly, most likely by some accessory software like CityEngine, BIGEMAP, or google maps' Maps SDK for Unity.
However, I couldn't figure out the most suitable solution that typically suits the requirement of "generate 3D architecture models by the racing road which is referencing the real world map", or just simply "build a massive amount of 3D architecture models",  efficiently and handily.
I want to achieve buildings similar to those seen in Need For Speed and Asphalt. Their buildings in the scene are quite outstanding to me.

How can I generate buildings similar to this?

sentences:
Casting a directional line of which an object is coming from I want to create a directional line ( curve / linear ) depending where the direction is coming from.

In some games, similar to Angry Birds, a dotted guideline is shown to provide where the gameObject is going.

I want to create something like that. But not from the starting point.
When i mean starting point, it simply means a dotted guideline from where the gameObject is released.

What i want is a dotted guideline from the end point. However, this end point is fixed.
How i imagine this is, i have a gameObject. When this gameObject is near to land around this end point, it will show the dotted guideline.

Am i asking too much ? Sorry if i am, a structural guideline of how to write this code would be great.

Thanks.

Edit

So this how i want it visual.
In Diagram ( A ) it shows a dotted line through the whole course of the path.

However what i want is shown in Diagram ( B ). It is split into two parts, a orange and red path. I only want the red path. But for a clear understand i included the red path. I only want the object to land or around that spot of Diagram ( B ).

What i dont want is from Diagram ( C ). Because it is not landing in the spot of Diagram ( B ). I dont want it to show anything. I only want the red dotted line from Diagram to appear when it is near or going to land in that spot of Diagram ( B ).

Thanks

sentences:
Affect movieclip scale from a .as doc to another I've been working on a game following a tutorial on the internet, the game is an avoider where you have the Avatar, that has to avoid the objects that fall.

The way it is made is: I have a DocumentClass which addChild's the screen you should be seeing and removeChild's the screen that you were.

For example: first it loads the menuScreen, then when you press play unloads menu and loads playscreen. When you die it loads the gameoverScreen and loads the playscreen.

And from the gameOverScreen you can press the SHOP button to go to the shop.
From here on I'm on my own and not following any tutorials.

The shop has a button that is supposed to alter the Avatar's X and Y scale to 0.5, but the problem is: how do I make that work?

I tried creating a sharedObject.data.avatarSize, on the store's size button the code would be something like:

sharedObject.data.avatarSize *= 0.5;

And on the AvoiderGame.as, which is the most of the actual game, on the part where the avatar is created I tried putting this after it's creation:

scaleX.avatar = sharedObject.data.avatarSize;
scaleY.avatar = sharedObject.data.avatarSize;

This did not work since it gives me the error 1009 saying can't access something that is null. I tried this before "using" the sharedObject:

if( sharedObject.data.avatarSize == null )
{
    sharedObject.data.avatarSize = 1;
}

But it did not work...

So now I'm not sure on what to do. I know we should reduce global variables as much as we can but how do I do it?

--EDIT--

Also, if it helps, I'm using Flash CS5 and working with AS3.0 and if you don't know about flash, you can also tell me how you would do it on any other language and I would try to convert it to flash.

sentences:
Box2d Javascript Disable Contact Between 2 Objects I want two objects, when collided, to not effect each other in velocity or force.

I have looked up guides and they say to change the PreSolve so that b2Contact.SetEnabled is false... which in code is

b2Contact.SetEnabled(false);

However, SetEnabled is a prototypal method for b2Contact, which means I have to instantiate a new b2Contact each time in order to call SetEnabled.

This does not make any sense to me and the code is wrong as right now all the objects in my world still collide with each other, even though I set that every single object will not collide with every other object:

This is my modified PreSolve method:

 B2.b2ContactListener.prototype.PreSolve = function (contact) {
        var a = contact.GetFixtureA().GetUserData();
        var b = contact.GetFixtureB().GetUserData();

        if (a instanceof Entity.Rock && b instanceof Entity.Player) {
            new B2.b2Contact.SetEnabled(false);
        }

        if (a instanceof Entity.Rock) {
            new B2.b2Contact.SetEnabled(false);
        }

    }.bind(this);

Any tips on how to use this API would be much appreciated!

sentences:
Issue with interpolation on a burn shader (lerp and smoothstep) I'm trying to create a simple burn shader. See here for more info on the method I'm using. However, I don't get why replacing the smoothstep with a lerp results in completely different results. Am I missing something from my knowledge of maths? As far as I know they should return similar values given the same parameters.

// clips materials, using an image as guidance.
// use clouds or random noise as the slice guide for best results.
Shader "Custom/Dissolving" {
Properties {
  _MainTex ("Texture (RGB)", 2D) = "white" {}
  _BorderTex ("Border Texture (RGBA)", 2D) = "white" {}

  _EdgeColor ("Edge Color", Color) = (1,0,0)
  _EdgeSize ("Edge Size", float) = 0.1

  _SliceGuide ("Slice Guide (RGB)", 2D) = "white" {}
  _SliceAmount ("Slice Amount", Range(0.0, 1)) = 0.2

  [MaterialToggle] UseClipInstruction ("Use Clip Instruction", Float) = 0
}
SubShader {
  Tags {"Queue"="Transparent" "IgnoreProjector"="True" "RenderType"="Transparent"}
  //Cull Off
  Blend SrcAlpha OneMinusSrcAlpha

  CGPROGRAM
  //if you're not planning on using shadows, remove "addshadow" for better performance
  #pragma surface surf Lambert alpha addshadow

  struct Input {
      float2 uv_MainTex : TEXCOORD0;
      float2 uv_SliceGuide : TEXCOORD1;
      float _SliceAmount;
  };

  sampler2D _MainTex;
  sampler2D _BorderTex;
  sampler2D _SliceGuide;
  half _SliceAmount;
  half _EdgeSize;
  half3 _EdgeColor;

  void surf (Input IN, inout SurfaceOutput o) {
    o.Alpha=1;

    //Green is a good color for estimating grayscale values
    half fragSliceValue = tex2D(_SliceGuide, IN.uv_SliceGuide).g;

    #ifdef UseClipInstruction
    clip(fragSliceValue - _SliceAmount);
    #else
    //TODO: look for an alternative to this
    if (fragSliceValue - _SliceAmount<0)
        o.Alpha=0;
    #endif

    half rampX = smoothstep(_SliceAmount,_SliceAmount + _EdgeSize, fragSliceValue);
    half3 ramp = tex2D(_BorderTex,half2( rampX,0) ) * _EdgeColor.rgb;
    o.Emission = ramp * (1-rampX);

    o.Albedo = tex2D(_MainTex,IN.uv_MainTex);
  }
  ENDCG
}
Fallback "Diffuse"
}

Left is the result of smoothstep (the provided code), right is what happens when I replace smooth with lerp.

sentences:
How can I set up a pixel-perfect camera using OpenGL and orthographic projection? I am creating a 2D game using OpenGL and orthographic projection. For sprites, I use textured quads (actually two triangles).

I want the pixel art textures for the sprites to be displayed in a multiple of the original size to avoid blurry textures.

How can I set up a pixel-perfect camera using OpenGL and orthographic projection?
After doing so, how do I size the qauds?

sentences:
Is 50KBs of bandwidth practical for players? For my client-server lockstep 16-player RTS game, I've calculated the maximum bandwidth usage per second to be 50KBs for hosting a game (though this value is closer to 20KBs practically). ~90% of this bandwidth usage is due to sending out packets and the rest, incoming packets.

To cut down on costs, I'd like to have players host games and official servers function in the background as backups (in case the player host drops). Is it reasonable to expect 1 in every 16 players is able to handle this bandwidth demand?

Note: The game will be on PC.

sentences:
What are valid ranges of space dimensions used in OpenGL? I want to know what the valid ranges of all the spaces in OpenGL are.

Specifically:
Maximum and Minimum Clip space X, Y, and Z (gl_Position)
Maximum and Minimum gl_FragCoord X, Y, and Z
Maximum and Minimum gl_FragDepth value

sentences:
Project 2d click/touch onto 3d plane I have a 3d scene that contains an infinite plane that is NOT parallel to the camera (so every screen coordinate corresponds to a point on this plane- in other words, there are no possible invalid clicks/touches).

I have all the information you'd expect to work with: camera pos, dir, fov, aspect ratio, the 3d points defining the plane (either as a triangle, or as a normal + distance), the view/projection matrices that project it onto the screen, etc...

I haven't found anything online that answers this in a straightforward way. Please no "use this or that library". Also, if you're going to say "invert the matrix", please give a way to go about doing that (I don't think the matrix is easily/possibly invertable, as the "project to 2d" process involves the divide-by-w step, rendering the final translation between 3d to 2d non-affine).

sentences:
Naming a weapon during game development: is using the actual model name in real life against copyright? I was planning to name each weapon at the weapon shop and I was wondering if it is safe to use the real name of each weapon and model as well before publishing it via Google Play Store for my created game app? I'm using a freemodel method with ad banner on menu on it, user friendly. I'm making a concept third-person shooter zombie survival game.

I'm checking some other sample of the games, (other than from mobile app) one from the gamer console's classic in PlayStation 1 game Syphon Filter; and the other one from the PC, a popular online FPS game created by Korea called CrossFire. Let's take a comparison's similar of the gun (both gun model name and the model itself) used between these two:

In Syphon Filter, the name of this assault rifle is PK-102. (See gameplay video here) It was based either a model from AK-47, AK-74, or AK-102 assault rifle in metalic like body.
In CrossFire, the name of this assault rifle retained the original name AK-47 along with the model itself. (See video gameplay here.) It assumed they take for a permission to use the original name before using it.

I want to know more further if it is safe to use the model name only but not mentioning the corporation name who created the AK-47. Naming a gun could be striking, same thing naming the actor of the game. If not, probably if it is also okay to name close to the original but at least it's not against the copyright standards.

sentences:
Amazon FreeTime Unlimited Monetization So I've recently noticed how great FreeTime Unlimited is for my daughter. There's no ads, no in-app purchases, etc. She can just play the games/apps and I don't have to worry about it.

As a develop I thinking it could an interesting avenue to go down, but there's a few things that I for the life of me can't get Amazon support/forums to answer in any logical manner.

So the idea according to their information is that the apps are highly scrutinized to verify they are child friendly content, which is excellent. Also, you can't use webviews, ads, or in-app purchases.

My question is: How do devs monetize these applications? Clearly they're not just giving away their work for free? The only logical answer I can guess at, is that it uses the Amazon Underground scheme of earning $$ based on the amount of time the user spends in the app/game??

Does anyone have and actual experience or information on this? As I said, I've reached out to multiple people at Amazon, and keep getting the runaround with all of them pointing me to the same useless link.

sentences: What should a main game loop do? Generally, what are the core things that one should do in the game loop, and what are some things that one shouldn't do in the game loop?

sentences:
AI system recommendations for a Hive mind system Im currently starting to work on a game project where a player will be faced against an enemy which has a hive mind. I was wondering if anyone could recommend an A.I system which I could use as at the moment I am thinking about using Finite State Machines(FSM) and I think that if I use FSM's that it will get messy.

Just to clear up what will be part of the "Hive Mind" if anyone was wondering will be:

Hive Leader
Soldiers
Workers

Under each of these categories there will be roughly 2-3 different sub-categories which will have to have slightly modified FSM's dependent on their abilities.

Thanks for any response

sentences:
What graphics library should I use for line rendering for a raycasting renderer? I want to develop simple RPG with ray casting rendering. I chose SDL for graphics and input. The problem is there is no native line drawing in it, which I need to start prototyping a ray casting engine.

I know about SDL_gfx, which can do this, but I am asking if there is any alternative to SDL with primitives drawing functions for C++, which is easy to learn, and is also used by indie game developers?

sentences:
Designing a weather system for biomes in a roguelike I'm making a roguelike game similar to dwarf fortress. So far, I have an average temperature map and average yearly precipitation map generated with simplex noise. Now, I'm trying to implement a weather system that seems realistic, as in it rains more often in biomes with higher precipitation rates, but still seems coherent.

Some of my thoughts on designing this system would be to have a weather object for each individual biome, and every time it rains (and the startup) it picks the next time it will rain based on the biomes precipitation rate.

One problem with this approach is that it would always rain within the exact edges of a biome, and I don't think it would look very realistic.

Another option could be to have cloud objects move around the map, and have them pick up water while in biomes with high precipitation rates, and when reaching the max, they rain.

This seems like a good approach to me that could be very realistic, I would just have no idea how to program the movement for the clouds.

Any thoughts on a better approach or how to implement either of these to make them work?

sentences:
Ray tracing - glossy reflection Here I am again with my ray tracer for ipad. Now I'm trying to add glossy reflection to an object. How do i implement it?
I read some documentation online like these:

http://www.cs.cmu.edu/afs/cs/academic/class/15462-s09/www/lec/13/lec13.pdf
http://www.cs.cornell.edu/courses/cs4620/2012fa/lectures/37raytracing.pdf

If I understood correctly instead of trace a single ray as for standard reflection I have to trace n ray in a random direction. How do I get this random direction for each ray? How do i generate these samples?

sentences:
How do I know when a player has crossed a point threshold? I’m needing help figuring out logic when adding a time bonus to my game.

I only want to reward the player with extra time if they level up.

Currently when the player’s score is less than 100 no bonus is given. If the player’s score reaches 200 I want to reward the player with some bonus time.

My issue is if the score is 190 and then jumps to 210, the 200 level mark is passed and the player isn't rewarded.

If I turn on the logic to say if the score is between 190 and 210, it could reward the player at the 190, 200, 210 mark or skip from 180 to 220, bypassing the reward altogether. I have tinkered with the idea of setting a bool BonusFlag, but the same issue arises, when I set the flag.

Can anyone help provide some logic on how to overcome this obstacle?

sentences:
Unity HDRP draw order doesn't change when asset is set to higher priority? I don't like the way that light got baked into part of my mesh.
It might make sense for me to try to blacken that area of the lightmap in Photoshop, but first I tried to just hide it with a probuilder object that uses an unlit black material:

I changed the priority of this object from 0 to 1, higher than any object in this scene, or at least the floor object, but it does not draw over the floor in Game View. I tried using a higher number and setting it beneath the floor instead of intersecting it, but it is just being rendered the usual way. Also note that I have a UI Canvas component being drawn in ScreenSpace, in case that has anything to do with it.
How can I get this object to render in front of the floor while it is intersecting the two front faces, like in the picture?

sentences:
How do I apply A* to a complex and dynamic 3D environment? I've looked a bit at Breadth-First and Depth-First search algorithms and I think I've got a pretty good idea of how they work.

Now I am here : http://www.policyalmanac.org/games/aStarTutorial.htm

The problem is I don't see how a 2D grid can help with a 3D game. I suppose that wouldn't be a problem if the 3D game didn't have the AI explore multiple levels of a building, but since that is most often what occurs, I am not sure how I would "simplify" my static level geometry and my physics-dynamic changing scene into a structure that can be easily be traversed to determine a path to a goal node.

sentences: how to attach a body to a rope and making it swing to another rope I've set some ropes (using cocos2d and box2d) and would like to attach a body to one rope in such a way that it can swing to another rope. I am not sure how to go about this. I read  making and object swing from one rope to another but it didn't seem to be of any help.

sentences: Why do engines need to be optimized for new processors of the same architecture? When a new processor generation is released, most websites report that game engines and programs need to be optimized for the new hardware. I do not quite understand why. A processor usually has an architecture that defines what kind of instruction set it uses. The one we all use nowadays is amd_x86_64 . Why would any program or compiler need to be updated if all processors use this same architecture? Surely there are features WITHIN the pipeline of the new processor that optimizes the execution of machine code, but why would the machine code itself need to be changed if the architecture did not?

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:
Centering GLViewport position within physical screen I'm developing my app on one device and want it to display at the same ratio on all other devices.

Currently what I have is 'image 1' in my image below - the game fits perfectly onto my development device's screen.

If I keep the viewport at the same ratio then I get the results seen in 'image 2'.

This is great, but now I need to center the viewport , and I'm not sure how to do that.

What I'm aiming for is what is in 'image 3' - just not sure how to get there.

This is how I'm keeping the viewport at the same ratio:

the ratio is width / height (this is 1.702127659574468 and we will use this explicitly)

//Set viewport size based on screen dimensions
GLES20.glViewport(XVal, YVal, (int) (height * 1.702127659574468), height);

At the moment, XVal and YVal are both 0 - I need to change XVal to move the image along.

How do I work out the amount to move the viewport along by? (I know it will be equal to half of the space to the right of the viewport ('image 2') - just not sure how to work this out.......)

sentences:
Pixelation shader explanation? I was looking for a pixelation shader for my postprocessing and came across this shader snippet - Works pretty well! - Not a whole lot of explanations on how it works except for "Pixelation is process when pixel at [x, y] is duplicated into [x + dx, y + dy] rectangle"

I re-wrote/formatted the shader a bit:

out vec4 FinalColor;
in vec2 FragUV;
uniform sampler2D Texture;

void main()
{
        float Pixels = 512.0;
        float dx = 15.0 * (1.0 / Pixels);
        float dy = 10.0 * (1.0 / Pixels);
        vec2 Coord = vec2(dx * floor(FragUV.x / dx),
                          dy * floor(FragUV.y / dy));
        FinalColor = texture(Texture, Coord);
}

My understanding: Messing with the 'Pixels' I found that the higher this number the more pixels there on the screen/the smaller the size pixels get thus a less pixelated effect. Then he's calculating some x and y offset values based on that number and using those offsets to get new texture coordinates to sample from.

My question: I have no idea how that's actually happening. I mean how does all that achieve "duplicating a pixel at [x, y] is into [x + dx, y + dy] rectangle"? What does 15 and 10 represent? (how much to offset on x and y?) - What happens when we actually multiply dx/dy with the result of the floor function and divide the texture coordinate by them? and why 'floor' in particular?

Any help or explanation is appreciated, thanks!

sentences:
Best way to load texture2d tiles in xna? I am making a test xna game as a learning exercise and I have a small question about using 2d textures. Basically the game is a grid of different 'tiles' which are taken from a text map file. I basically just parse through the file when initializing a level and create a matrix of the different tile types. The level is essentially a tub of wall tiles and spikes. So essentially, there are lots of wall tiles and multiple spike tiles and then lots of empty tiles. However, there are four types of wall tile and spike textures to cover different directions.

My question is what is the best way to load the textures for each of the tile? Do I load individual textures for each tile? i.e when I create a tile, pass it a texture2d which I can draw and load the texture at the same time. This seems like a good way, but then I have to load each tiles texture individually and this seems wasteful.

The other option I can think of is to use a static texture in the tile struct an then simple load this texture as a tile atlas with the different walls and spikes. This way I am only loading a single texture, and then when drawing I just move a rectangle to the area of the appropriate tile within the sprite.

I am not sure which of these ways would be optimal from a performance perspective, or if there is an alternative approach?

Thanks in advanmce

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:
How to simulate car drivetrain (in Unity)? One of my hobby projects involves cars. Up until now I had a quick and dirty "one class" implementation of engine+gearbox+wheels, but I thought that this is ugly, and I want to go a bit more realistic. Sadly I couldn't find much on Google (either wrong search terms or there really isn't anything that is what I want). It seems like

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

Things that I want in the system:

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

First thing I tried:

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

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

Fail number 2:

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

And fail 3:

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

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

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

If I forgot to mention something, please ask.

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:
Accessing libgdx classes within Android classes Currently what I'm able to do is to access android APIs within libgdx with an  interface in core and defining all the methods and then implementing it in every project (desktop, android, etc). What I want to do is I want to create a way so that I can call a method from some android class (say AndroidLauncher) and it calls a method of a libgdx core project class (like modifying some stage element). How do go about that?

Any help would be really appreciated.

Note: As a 'hack' right now, I'm just waiting for any update from android class in the render method using those same interface methods, but I don't think that's the best possible way.

sentences:
Multiple mains in vertex shader, GLSL I have a renderer where you can define passes where you pick the shader, and a signal, each object can register a listener to that signal in order to draw himself, the problem comes when some objects are normal meshes, others are sprites, some have skeletal animations, some don't. I was wondering if I could pack within the same vertex shader many different optional main functions, and pick the correct one for each object.

If there is no way, I would have to compile a different shader for each of the types and bind it from zero for all objects, even though all fragment shaders are the same.

sentences:
Mapping polar coordinates to cube I am trying map polar coordinates to points on a cube. I was able to map the front, back, left and right faces of the cube, but I am struggling with the top and bottom. Here is what I have:

/// <summary>
/// Converts polar coordinates to uv coordinates on a cube.
/// </summary>
/// <param name="p">The polar coordinate; p.x = longitude, p.y = latitude.</param>
/// <param name="face">The face of the cube that p maps to.</param>
/// <returns>The xy coordinate on the cube face.</returns>
private Vector2 PolarToCubeFace(Vector2 p, out CubemapFace face)
{
    face = CubemapFace.Unknown;
    Vector2 result = Vector2.zero;

    float lng = p.x; // East-to-West.
    float lat = p.y; // North-to-South.

    if (lat >= 45 && lat <= 135){ // Front, back, left, or right face.
        face = (lng > 0 && lng <= 90) ? CubemapFace.PositiveZ :
            (lng > 90 && lng <= 180) ? CubemapFace.PositiveX :
            (lng <= -90 && lng > -180) ? CubemapFace.NegativeZ :
            CubemapFace.NegativeX;

        result.y = (lat - 45) / 90f;
        result.x = mod(lng, 90) / 90f;
    }
    else{ // Top or bottom face.
        // Need help here.
    }
    return result;
}

sentences:
How to correctly specify the offset in a call to glVertexAttribPointer()? I'm trying to draw a simple triangle using the following vertices:

std::vector<VertexFormat> vertices;
vertices.push_back(VertexFormat(glm::vec3(0.25, -0.25, 0.0),
    glm::vec4(1, 0, 0, 1)));
vertices.push_back(VertexFormat(glm::vec3(-0.25, -0.25, 0.0),
    glm::vec4(0, 1, 0, 1)));
vertices.push_back(VertexFormat(glm::vec3(0.25, 0.25, 0.0),
    glm::vec4(0, 0, 1, 1)));

The corresponding Vertex format is given by the following struct:

struct VertexFormat
{
    glm::vec3 position;
    glm::vec4 color;

    VertexFormat(const glm::vec3 &iPos, const glm::vec4 &iColor)
    {
        position = iPos;
        color = iColor;
    }
};

The first call to glVertexAttribPointer() is easy since the position vector appears first in the struct, the call is as follows:

glVertexAttribPointer(0, 3, GL_FLOAT, GL_FALSE, sizeof(VertexFormat), (void*)0)

The second call to glVertexAttribPointer() should be made specifying a suitable offset for the color attribute of a vertex. Since the color vector appears after the position, then such offset should be given by sizeof(glm::vec3). The corresponding call is:

glVertexAttribPointer(1, 4, GL_FLOAT, GL_FALSE, sizeof(VertexFormat), (void*)(sizeof(glm::vec3)))

The output of the program using these parameters is:

This output is wrong. There are only two colors (green and blue) and the colors are in the wrong position, note that the bottom-left vertex is blue, but according to the code the vertex should be green.

If the offset is changed to sizeof(glm::vec4) the call is:

glVertexAttribPointer(1, 4, GL_FLOAT, GL_FALSE, sizeof(VertexFormat), (void*)(sizeof(glm::vec4)));

And the triangle is rendered correctly

So, Is my understanding of the offset parameter wrong? Why using an offset with the size of a vec4 gives the right output?

Any help would be appreciated.

P.S. Sorry for the bad english.

Edit: After reading the answer of Fibbles, and the comments of Fuzz Logic, I checked the size of the VertexFormat struct. A sizeof() gives a size of 32 bytes for a 32 bit executable. So padding is indeed the problem here. Using the macro suggested by Fibbles solves the problem. Thanks for everything guys!

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:
Designing mouse-aimed aircraft controls I am attempting to design mouse-aimed turning to control an aircraft in a 3D environment. To cut it short, you aim where you want to go, and the aircraft turns to face that direction (similar to War Thunder).

When turning an aircraft, it makes sense to use your elevator instead of your rudder (especially in long turns). If you need to turn 90 degrees left, it makes sense to roll 90 degrees left first, then use the elevator to turn, finally leveling out the aircraft once the target heading is reached.

Now, I want the user to be able to control the roll, but I also want the game to do it automatically when the player is not controlling it. My problem is conceptualizing what operations I need to do to get the target roll angle.

I managed to figure out that to align myself correctly, I need to align the plane that bisects the aircraft (the V plane) with the direction I want to move to (the D vector). The R angle is how much I would need to turn (in local angles) to achieve the derired orientation.

So, if I the player looks at the blue circle, the plane will roll right and hold that roll until it's almost aligned with the desired direction. At that point, it will unroll and level out.

Just figuring out the roll I need would be a big help. Preferably I'd like to get it done with dot and cross products, as these operations are already established and I have easy access to the up, right and forward vectors of the plane, as well as the direction vector.

sentences:
When when pressing on the G key one of parts is scaling slower then the other? Each Prefab is built with canvas and two panels childs of the canvas.
I'm scaling the two panels. The automatic mode part is working fine.

The problem is with the G key. When I press once on G it's scaling both panels up to maxSize then when pressing on G once again it's scaling the panels back down to minSize.

But when I press on G quick in the middle while it's scaling them it should turn the scaling side in the middle. For example if I press G and both panels start scaling to maxSize if in the middle I press on G again it should scale them both to minSize without getting first to the maxSize. But in this case one of panels is keep scaling to maxSize a bit and then move back to minSize.

But they both should turn side in the middle at once. It seems like one of them have a lag he turn sides a bit after the first one.

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

public class Scaling : MonoBehaviour
{
    public GameObject Prefab;
    public int numberOf = 1;
    public float duration = 1f;
    public Vector3 minSize;
    public Vector3 maxSize;
    public bool scaleUp = false;
    public Coroutine scaleCoroutine;
    public bool automatic = false;
    public bool coroutineIsRunning = false;

    private List<GameObject> parts = new List<GameObject>();

    private void Start()
    {
        for (int i = 0; i < numberOf; i++)
        {
            GameObject objecttest = Instantiate(Prefab);
            foreach (Transform child in objecttest.transform)
            {
                parts.Add(child.gameObject);
            }
        }
    }

    private void Update()
    {
        if (automatic)
        {
            if (!coroutineIsRunning)
            {
                Scale();
            }
        }
        else
        {
            if (Input.GetKeyDown(KeyCode.G))
            {
                Scale();
            }
        }
    }

    private void Scale()
    {
        scaleUp = !scaleUp;

        if (scaleCoroutine != null)
            StopCoroutine(scaleCoroutine);

        for (int i = 0; i < parts.Count; i++)
        {
            if (scaleUp)
            {
                scaleCoroutine = StartCoroutine(ScaleOverTime(parts[i], maxSize, duration));
            }
            else
            {
                scaleCoroutine = StartCoroutine(ScaleOverTime(parts[i], minSize, duration));
            }
        }
    }

    private IEnumerator ScaleOverTime(GameObject targetObj, Vector3 toScale, float duration)
    {
        float counter = 0;
        Vector3 startScaleSize = targetObj.transform.localScale;

        coroutineIsRunning = true;

        while (counter < duration)
        {
            counter += Time.deltaTime;
            targetObj.transform.localScale = Vector3.Lerp(startScaleSize, toScale, counter / duration);

            if (counter > duration)
                coroutineIsRunning = false;

            yield return null;
        }
    }
}

sentences:
Calling CCRepeaForever on CCLabelTTF Makes Label Not Show Up I have a CCLabelTTF in the top right hand corner of the view.

-(void)scrollScoreLabelAndMonkey{
scoreLabel = [CCLabelTTF labelWithString:@"0000" fontName:@"Marker Felt"
fontSize:30 ];
scoreLabel.position=ccp(420,300);
scoreLabel.color = ccGREEN;
[self addChild:scoreLabel];
}

I simply add this code to the bottom of the above method. However as soon as i add this line, the label doesnt show up at all.

id moveScore = [CCMoveBy actionWithDuration:.7 position:ccp(scoreLabel.position.x + 10, 0)];
CCRepeatForever *scrollScoreLabel = [CCRepeatForever actionWithAction:moveScore];
[scoreLabel runAction:scrollScoreLabel];

Any help is greatly appreciated!

sentences:
What is the correct way to make an Installed Build? I am trying to use the Automation tool, following the documentation.

To create an Installed Build:
Run the Installed Build Script by invoking the AutomationTool with the
following command line, replacing [PLATFORM] with either Win64 or Mac.
BuildGraph -target="Make Installed Build [PLATFORM]"
-script=Engine/Build/InstalledEngineBuild.xml -clean

However, I am getting this error.

ERROR: Target 'Make Installed Build [Win64]' is not in graph

I am not sure what I should put as the platform.
I searched the config file, but don't see any specified platforms.

sentences: Is there a SDK for 2D games that will deploy to PC, Flash and Android? Is there such thing as an SDK or toolset that can produce Windows, Flash, and Android executables from the same source? Something like "write once, run in all three platforms?"

sentences:
If I want to become a professional game developer, is learning Win32 API a must? If I want to become a game developer, is learning Win32 API a must?

Does X-BOX or PS based game developers need to know Win32 API?

Is it possible for a professional game developer to develop games by only scripting game engines and not using Win32 API?

sentences:
Update single entry in GLSL array I have an array in my vertex shader like this:

uniform mat4 MeshTransforms[20];

At the moment I'm just updating the entire array of matrices like so:

int meshTransforms = ARBShaderObjects.glGetUniformLocationARB(shader, "MeshTransforms");
ARBShaderObjects.glUniformMatrix4ARB(meshTransforms, false, UnitTransformMatrices);

Where UnitTransformMatrices is a float buffer containing the transform matrices of some units.

I'd like to just update a single matrix in the array (just update one unit transform matrix). So how can I overwrite a single matrix in the middle of the matrix array?

This is using the LWJGL, so I'm limited to the functionality it provides.

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:
Draw a line along one continuous edge of a curved mesh I have a rectangular mesh, but the mesh is curved:

I want to draw a line along one side of this curvy mesh.

Currently I can easily draw line along a side of a flat rectangular mesh by getting the mesh's min and max bounds. But what should I do to draw a curved line along the border of mesh from one of its side edges.?

sentences:
How can I avoid applying textures to a fragment in a shader when the surface normal is (0, 1, 0)? I have a small GLSL shader with a vertex shader and a fragment shader. I want to avoid applying textures to faces that have a normal equal to (0, 1, 0). Is this possible? These are my shaders:

Vertex:

#version 120

varying vec2 UV;
varying vec3 normal;

void main()
{
  UV = gl_MultiTexCoord0;
  gl_Position = gl_ModelViewProjectionMatrix * gl_Vertex;
  normal = gl_Normal;
}

Fragment:

#version 120

varying vec2 UV;
uniform sampler2D diffuseMap;

void main(void)
{
  gl_FragColor = texture(diffuseMap, UV);
}

sentences:
Heightmap Physics Optimization/Improvement I'm working on implementing the physics surrounding a player walking on a heightmap. A heightmap is a grid of points which are evenly spaced on the x and z axes, with varying heights. The physical representation of my player (what is exposed to my physics engine/manager) is simply a point-mass where his feet are, rather than complicating the problem by treating him as a sphere or a box.

This image should help further explain heightmaps and show how triangles are generated from the points. This picture would be looking straight down on a heightmap, and each intersection would be a vertex that has some height.

Feel free to move this over to math, physics, or stack overflow, but I'm pretty sure this is where it belongs as it is a programming question related to games.

Here's my current algorithm:

Calculate the player's velocity from input/gravity/previous velocity/etc
Move the player's position (nextPos = prevPos + velocity * timeSinceLastFrame)
Figure out which triangle (all graphics is done in triangles!) of my heightmap the player's new position is vertically aligned with
Use the three vertices of that triangle to calculate the equation for the plane which that triangle lies in
Plug in the player's x and z coordinates into the plane's equation to get the y coordinate for the player's position on that plane
Set the y coordinate of the player's position to this (if newPos.y < y)

This is all fine and dandy, but I'm wondering if there's anything that I can optimize. For example, my first thought is to store the plane's equation with the triangle's vertex information. This way all I have to do is plug in the x and z values to the equation to get the y. However, this would require adding 4 floats to every vertex of the heightmap which is a little ridiculous memory wise. Also, my heightmaps are dynamic (meaning the heights will change at runtime), which would mean changing the plane equations every time a vertex's height changes.

Is there a faster way to calculate that point than digging up the plane's equation and then plugging in x and z? Should I store the plane equations and update them on vertex height change or should I just regenerate the plane equations for every triangle every time the player moves on that triangle? Is there a better way to do heightmap physics that maintains this simplicity? (this seems very simple to me as far as physics engines go)

sentences:
How do I make the turning of my character smooth? I'm pretty sure I need to use the Quaternion.Lerp although I don't know how, my character already rotates but it's instantly, which is pretty unrealistic and not smooth. I'm extremely new with Unity (I just started 2 days ago), so I think asking here is a good idea since I will get help from people with experience:

private Rigidbody rb;

void Start()
{
    rb = GetComponent<Rigidbody>();
}

void Update()
{
    //Character Rotation
    {
        if (Input.GetKey(KeyCode.D))
            rb.transform.rotation = Quaternion.Euler(0, 90, 0);

        if (Input.GetKey(KeyCode.A))
            rb.transform.rotation = Quaternion.Euler(0, -90, 0);

        if (Input.GetKey(KeyCode.W))
            rb.transform.rotation = Quaternion.Euler(0, 0, 0);

        if (Input.GetKey(KeyCode.S))
            rb.transform.rotation = Quaternion.Euler(0, 180, 0);
    }
}

sentences:
Discoordinated Chromatic Aberration Effect The game Teleglitch heavily utilizes the CA effect with screen distortion.

I am trying to achieve this effect.

Issue 1. How to not apply the effect onto the floor? (solved)

They render the screen then apply the CA effect.  However, the floor is not rendered with the post processing effect.

Issue 2. How to have discoordinated position for each rendered CA effect?

Currently I have three offsets for each channel: red, green, and blue.  However, I cannot assign different offsets for the channels for certain areas only.  What would be a way to have discoordinated positions?

sentences:
Unity SOAP wsdl problem i'm trying to using a SOAP service from my game but the problem is that after using wsdl.exe for generete the connector Unity inform me that System.Web namespace doesn't exist.

How can I use the wsdl?
There is some workaround without writing a lot of code?

Many thanks

sentences:
How do I handle user input with good class structure/architecture for an Android game? How do I handle user input having "good" class structure and following normal game architecture*?(see below). At first I didn't think this question was Android specific, although, after seeing a great response in C++ I would appreciate some insight on this question using Android architecture.

Current way I handle input for my Android Game:

Created controller class that takes X,Y screen events and X,Y
character position and returns an int that represents a direction the
character should move.

Call the controller method in the game's
update.

Send that direction value to my character update.

Character's update calls move (which is also passed this value).

Basic switch statement determines the direction my character moves.

Getters and setters for the position of the character.(should
I have them for this direction also)

Is there a better way of handling input? This doesn't feel like the best way. Where does input fit in with class structure and game architecture?
I'm going to accept the C++ answer but I would really like to see a Java answer for Android in the future. :D

sentences:
Game ideas for a platformer I have created a platformer which currently has the features listed below. I would greatly appreciate any further ideas which I could implement! (I don't play a lot of games which is why I require help)

Walking/jumping/movement
player can shoot lasers
enemies also walk, fly, and shoot lasers
water (you can swim in this)
mud (slows you down on contact, and stops you from jumping)
ladders
damage when falling from a large height, unless falling into water
moving platforms
springboards (jumping on them shoot you into the air)
growing platforms (allow you to reach new places)
key and door system
gem and coin collection system
teleporting
turrets

sentences: How do I make a 2D sprite flash green when tapped? I have a sprite that is based on an image of a gray circle. When the user touches the sprite, I want the sprite to flash green, as in I want the circle to appear to turn green for 0.2 seconds. I tried setting the color of the sprite via SpriteRenderer's function SetColor, and it blended the color with the initial gray color of the sprite, so I got a very dark green even though I'm really sure I didn't mess up the values when I created the color. Now I'm trying to get my flashing effect by using separate images. I have the images I need, and I have a message getting logged when I tap the circle, I just need to setup a non-looping animation and trigger that animation in my code.

sentences:
Determining value to add / subtract scaling I have a menu panel.
It appears if the user presses the Enter key, and it disappears if he presses the Enter key again.

When the menu is still hidden, its X scale is set to 0.
In its normal / expanded state is 0.00175f.
When the menu is shown or hidden, I want to smoothly scale from 0 to 0.00175f or from 0.00175f to 0.

To do that, I have written a coroutine:

private IEnumerator pShrinkExpandMenu(bool uShrink)
{
    if (!uShrink)
    {
        Menu.SetActive(true);//the menu should be expanded / enlarged, so we need to make sure it's visible
    }

    float fWidthIfExpanded = 0.00175f;
    float TimeInSecondsToSwitch = 0.3f;

    _TimeElapsedOnShrinkingExpanding += Time.deltaTime;

    while (_TimeElapsedOnShrinkingExpanding < TimeInSecondsToSwitch)
    {
        float fValue;

        if (uShrink)
        {
            fValue = ...
        }
        else
        {
            fValue = ...
        }

        Menu.localScale.X = fValue;

        yield return 0;
    }
    if (uShrink)//if we shrink, and it's completely shrunken, hide it
    {
        Menu.SetActive(false);
    }
}

I hope that my coroutine is fine.
One thing that I just don't know is how to determine the value that the X scaling should be changed during one loop.

I have no idea how to calculate fValue.

Could anybody explain that to me, please?

sentences:
Setting up a camera to make the world look large I am attempting to configure my camera to give the impression of a normal sized player in a giant room. Since units are arbitrary, I figured this should be possible (despite the fact that the room is technically 24x24m big and I want it to feel more like a hangar).

I have tried tweaking down the FOV (to about 40 degrees) which has helped some, but I can't shake the feeling that I am a tiny person in a normal sized room rather than a normal sized person in a giant room.

What about the way the scene is being rendered is giving away this to my eye. Or is it just a lack of reference points?

I am using Unreal Engine if that affects the answer.

sentences:
How to change the default UDK game folder? How can I change the default UDK game folder, the folder where it takes config files from?
Looking at the engine configuration files, it is taking it from %GAME%Game/, and when that's UDK, it loads from UDKGame, but how do I change the %GAME%?

sentences:
Enabling / disabling Static objects in Unity The Unity docs clearly explain that game objects marked static should not be moved for performance reasons but I can't find any info regarding enabling / disabling.

Almost everything in my games levels is destructible so I only use real-time GI. When the player damages a game object enough it's either removed or replaced with a damaged version of the model, usually via an object pool.

What effect does enabling or disabling a static game object have on performance?

sentences:
How would one determine the length of a path? I have a game that requires each player to move along one specified path. I draw the path using Bézier curves. How can I determine the total real (not linear) length of the path and the distance that each player had made? (The distance between the start point and a specified point on the path.)

UPDATE:

The path is represented in a Cartesian plane (2D).

sentences:
Textures not displaying. Problem with fragment and vertex shaders Hi i have newbe question. I am sending to gpu textures unit and they dont display.
This is simple version of my fragment and vertexshader. (More complicated version also dont work with other textures than DDS but maybe simpler version will tell you what newbe mistake i made)

for (unsigned int i = 0; i < textures.size(); i++){
    glActiveTexture(GL_TEXTURE0+i);
    glBindTexture(GL_TEXTURE_2D, Textures[i]);
    // Set our "myTextureSampler" sampler to user Texture Unit 0
    glUniform1i(TextureID, i);
}

This is my simple fragmentshader

#version 330 core

// Interpolated values from the vertex shaders
in vec2 UV;

// Ouput data
out vec3 color;

// Values that stay constant for the whole mesh.
uniform sampler2D myTextureSampler;

void main(){

    // Output color = color of the texture at the specified UV
    color = texture2D( myTextureSampler, UV ).rgb;
}

This is my simple vertexshader

#version 330 core

// Input vertex data, different for all executions of this shader.
layout(location = 0) in vec3 vertexPosition_modelspace;
layout(location = 1) in vec2 vertexUV;

// Output data ; will be interpolated for each fragment.
out vec2 UV;

// Values that stay constant for the whole mesh.
uniform mat4 MVP;

void main(){

    // Output position of the vertex, in clip space : MVP * position
    gl_Position =  MVP * vec4(vertexPosition_modelspace,1);

    // UV of the vertex. No special space for this one.
    UV = vertexUV;
}

EDIT this corrected version but still something dont work. If i had DDS everything was working OK but jpg textures all time i have problems.

EDIT i have correct number of textures but they looks diffrent than original

sentences:
Show the progression of a loop in GameMaker Studio I'm using a loop to destroy some objects in my code.

for (var i = 0; i < instance_number(obj_item); i++)
{
    var inst = instance_find(obj_item, i);
    with (inst)
        instance_destroy();
}

I would like to make them disappear one at a time on screen (i.e., the first one disappears, one second after that the second one disappears, etc.).

However, it seems that the screen is updated only when the loop has finished: all objects disappear at once.

In Unity, I would use coroutines for such a situation. How do I do that in Gamemaker?

sentences: Characters With Interchangeable Skills I am using unity and I would like to create characters that have interchangeable spells. As an example it would be something like Pokemon that can attain different skills as they level up and the user can change out skills for new ones. Would this be a good place for inheritance? Should I make a parent class that inherited by all of the other characters? Would this be the best approach?

sentences:
Is there a limit to Gametime.TotalMilliseconds? Gametime should always be increasing, and totalmilliseconds is going to be the largest value. So if the game is hypothetically run for 1 day, this value should 86 400 000.

This probably isn't a problem for most games, but I'm curious if there's some sort of fail safe mechanism if it does get too large, or if a limit even exists.

sentences:
XNA / Monogame Camera flickering on collision I have my camera follow my player and it works perfectly, I had some issues with collision and managed to get it working, but now my camera follows my player when it gets pushed back so the camera just flickers when holding down the button towards a collision since it's following the player! I tried to stop the camera from following the player on an axis when colliding with something but it still makes the character look weirdly bouncing from walls. This is my code:

Camera Updating

if (player.CameraFollow)
{
    Camera.IsFollowingObject = true;
    if (Camera.IsFollowingObject)
    {
        Vector2 relativePlayerpos = -player.CurrentPos;
        relativePlayerpos.X += Camera.Viewport.Height;
        relativePlayerpos.Y += Camera.Viewport.Width/2 - player.Sprite.SourceRect.Height/2;
        Camera.Pos = relativePlayerpos;
    }
}

Collision Handler

public void CollisionHandler(ref Player player, Rectangle tileRect)
{
    //push left
    int left = Math.Abs(tileRect.Left - player.CollisionBox.Right);
    //push top
    int top = Math.Abs(tileRect.Top - player.CollisionBox.Bottom);
    //push right
    int right = Math.Abs(tileRect.Right - player.CollisionBox.Left);
    //push bottom
    int bottom = Math.Abs(tileRect.Bottom - player.CollisionBox.Top);

    if (left < top && left < right && left < bottom)
    {
        player.Velocity.X = 0;
        player.Sprite.Position.X -= left;
    }
    else if (right < top && right < left && right < bottom)
    {
        player.Velocity.X = 0;
        player.Sprite.Position.X += right;
    }
    else if (top < left && top < right && top < bottom)
    {
        player.Velocity.Y = 0;
        player.Sprite.Position.Y -= top;
    }
    else if (bottom < left && bottom < right && bottom < top)
    {
        player.Velocity.Y = 0;
        player.Sprite.Position.Y += bottom;
    }
}

This is what the collision basically does:

Any help is appreciated, thank you!

sentences:
How to check strings from multiple lines in one input field? I need help with input fields. I already set the line type to 'Multi_Line NewLine' in inspector, but I have problem with submitting the string. Here's the code:

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

public class GameController : MonoBehaviour {
    public string code;
    public string code1;
    [SerializeField]
    public InputField input;

    public void Check(string guess)
    {
        if (string.Equals (guess,code)) {
            Debug.Log ("correct");
        } else
            Debug.Log ("wrong");
    }
    public void GetInput(string guess)
    {
        Check (guess);
        input.text = "";

    }
}

I want to have both 'code' and 'code1' strings to be inserted in different lines inside the same input field but I don't know how to check both 'code' and 'code1' string value inside the Check(). Any help would be appreciated.

sentences:
How do I go from a general idea to a specific draft of a design? Before starting planing your code, the data structures, the class hierarchy, you need to have a clear idea of what you want for your game.
I came across with an idea for a game, but it is too general.

I think every game starts with a general idea, but how did they take that general idea and then the came up with games like Imperium Civitas... I'm refering to the actions you can or can't do, the events, in-game materials etc.

I wonder how you should engage a blank paper. Where you should start? Is there a chain of steps that you have to follow?
Thanks.

(My idea is much more simpler than Imperium Civitas)

sentences:
Game Editor plugin architecture I'm creating 3D Game Editor for my own use. As rendering i took Ogre3D and MFC as UI.

I faced with architecture problem.

I am using Document/View architecture and for each Doc. i create new SceneManager and for each View i create own viewport, camera, my own local Input manager which send input data to local camera. Also it's sending input data and pointer to SceneManager to global ToolManager which contains some base tools like Move, Select etc. and the pointer to active tool, if it's NULL he is sending input to SelectTool by default.

I'm only at start but i'm thinking of the future.
I think that this strategy of passing some data to the global manager is not so good how it looks now. Can you give me some design advices or articles and share with me your experience.

Thank you for your time.

Edit:

I think that plugin architecture would give a lot flexibility and it`s like all editors do. But i never before faced with that. So i will try to tell u what i think about it.
Host App contain

PLuginManager:

load/unload plugins
base interface to add frame/window and other UI
base interface to communicate with other plugins

EventListener

collect all events and EventListeners
send specific events to it listener

It's all what host app contains.
But, how to implement it? I mean all communication. How to load and save files. Edit object with different plugins. I'm thinking to use QT, is it better than MFC or wxWigets.

Can you give me some advices please.

sentences:
What are reasons for input polling vs. input events? I noticed people use both - but is there any empirical evidence when it's better to use one over the other?

This is related but not quite a 'why use either' or even 'why use both': Polling vs event driven input

sentences:
Cull mode back faces When i draw a cube using indices, the faces of the cube are skewed but only when CullMode is set to cull back. When i switch it to cull none, it draws the cube perfect. Unfortunately i cant post any code at the time because I'm using my phone, but what are some possible explanations for why the faces of my cube are skewed wjile culling the back? I was thinking the order of my indices may be the problem.

http://i.imgur.com/S1PfxCr.png

VertexType* vertices;
unsigned long* indices;
D3D10_BUFFER_DESC vertexBufferDesc, indexBufferDesc;
D3D10_SUBRESOURCE_DATA vertexData, indexData;
HRESULT result;

m_vertexCount = 8;
m_indexCount = 36;

vertices = new VertexType[m_vertexCount];
if(!vertices)
{
    return false;
}

// Create the index array.
indices = new unsigned long[m_indexCount];
if(!indices)
{
    return false;
}

vertices[0].position = D3DXVECTOR3(-1, 1, -1);
vertices[0].color = D3DXVECTOR4(1, 0, 0, 1);

vertices[1].position = D3DXVECTOR3(1, 1, -1);
vertices[1].color = D3DXVECTOR4(1, 1, 0, 1);

vertices[2].position = D3DXVECTOR3(-1, -1, -1);
vertices[2].color = D3DXVECTOR4(1, 1, 1, 1);

vertices[3].position = D3DXVECTOR3(1, -1, -1);
vertices[3].color = D3DXVECTOR4(0, 1, 0, 1);

vertices[4].position = D3DXVECTOR3(-1, 1, 1);
vertices[4].color = D3DXVECTOR4(0, 1, 1, 1);

vertices[5].position = D3DXVECTOR3(1, 1, 1);
vertices[5].color = D3DXVECTOR4(0, 0, 1, 1);

vertices[6].position = D3DXVECTOR3(-1, -1, 1);
vertices[6].color = D3DXVECTOR4(1, 0, 0, 1);

vertices[7].position = D3DXVECTOR3(1, -1, 1);
vertices[7].color = D3DXVECTOR4(1, 0, 0, 1);

//indices = { 2, 0, 3, 3, 1, 0, 3, 1, 7, 7, 5, 1, 6, 4, 2, 2, 0, 4, 7, 5, 6, 6, 4, 5, 0, 4, 1, 1, 5, 4, 6, 2, 7, 7, 3, 2 };

indices[0] = 2;
indices[1] = 0;
indices[2] = 3;
indices[3] = 3;
indices[4] = 1;
indices[5] = 0;
indices[6] = 3;
indices[7] = 1;
indices[8] = 7;
indices[9] = 7;
indices[10] = 5;
indices[11] = 1;
indices[12] = 6;
indices[13] = 4;
indices[14] = 2;
indices[15] = 2;
indices[16] = 0;
indices[17] = 4;
indices[18] = 7;
indices[19] = 5;
indices[20] = 6;
indices[21] = 6;
indices[22] = 4;
indices[23] = 5;
indices[24] = 0;
indices[25] = 4;
indices[26] = 1;
indices[27] = 1;
indices[28] = 5;
indices[29] = 4;
indices[30] = 6;
indices[31] = 2;
indices[32] = 7;
indices[33] = 7;
indices[34] = 3;
indices[35] = 2;

vertexBufferDesc.Usage = D3D10_USAGE_DEFAULT;
vertexBufferDesc.ByteWidth = sizeof(VertexType) *m_vertexCount;
vertexBufferDesc.BindFlags = D3D10_BIND_VERTEX_BUFFER;
vertexBufferDesc.CPUAccessFlags = 0;
vertexBufferDesc.MiscFlags = 0;

vertexData.pSysMem = vertices;

result = device->CreateBuffer(&vertexBufferDesc, &vertexData, &m_vertexBuffer);
if(FAILED(result))
{
    return false;
}

indexBufferDesc.Usage = D3D10_USAGE_DEFAULT;
indexBufferDesc.ByteWidth = sizeof(unsigned long) *m_indexCount;
indexBufferDesc.BindFlags = D3D10_BIND_INDEX_BUFFER;
indexBufferDesc.CPUAccessFlags = 0;
indexBufferDesc.MiscFlags = 0;

indexData.pSysMem = indices;

result = device->CreateBuffer(&indexBufferDesc, &indexData, &m_indexBuffer);

return true;
}

void CubeClass::RenderBuffers(ID3D10Device* device)
{
unsigned int stride;
unsigned int offset;

stride = sizeof(VertexType);
offset = 0;

device->IASetVertexBuffers(0, 1, &m_vertexBuffer, &stride, &offset);

device->IASetIndexBuffer(m_indexBuffer, DXGI_FORMAT_R32_UINT, 0);

device->IASetPrimitiveTopology(D3D10_PRIMITIVE_TOPOLOGY_TRIANGLELIST);

device->DrawIndexed(36, 0, 0);

}

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:
Way to check overlaps of a collider2d that's not set to "is trigger" in Unity I have a system where physics2d objects are spawned and I need to know when they spawn outside of a region defined by a box collider set to "is Trigger".
Using onTriggerEnter and onTriggerExit to know if an object exits / re-enters the bounds (with some other conditions determining whether to kill the object when it exits the bounds). That stuff works fine.
However I can't detect when an object spawns outside of the collider (which I want to allow, but just know when it happens).
I tried the following in the Start method of the spawned object:
List<Collider2D> results = new List<Collider2D>();
_boundsCollider.OverlapCollider(new ContactFilter2D(), results);
bool spawned_outside = !results.Contains(_thisCollider);

However at the time that method runs, the booundsCollider doesn't register it. Subsequent frames it will, but that's too late.
OverlapCollder can't be run on the collider for the spawned object since it isn't set as a trigger.
Is there any way I can query the spawned object's own collider to determine if it is in contact with the bounds collider?
Thanks!
PS I can't trivially just reference the coords of the object and check if they're out of bounds because the bounds collider will move, and I want to know with precision wether just a corner is overlapping or whatever so I'd need something that amounts to my own simple collision system

sentences:
Unity: Make a moving rigidbody stop exactly at a given distance I have an object that only moves along Z-axis, its rigidbody has a mass of 1 and a drag of 0.2.

That object accelerates till MaxVelocity and then moves at that constant velocity in the Z-axis.

When the user pushes the brakes I want to add a force on that rigidbody to make it stop completely at a given distance (lets say 10 meters from where it pushed the button).

I've tried using: .

Which is what you get when solve for t in the first and replace in the second:

Where v is final velocity and in my case I want it to be zero.

The code

I call this method every FixedUpdate since user pushed brakes:

private float CalculateBrakeAccel(float targetPos)
{
    // targetPos has the position in the z axis the object should stop
    // i.e.: velocity is 0.0f
    float remainingDistance = (targetPos - rigidbody.position.z);
    // formula: a = 0.5 * v0^2 / (e0 - e)
    float brake = 0.5f * rigidbody.velocity.sqrMagnitude / remainingDistance;
    return brake;
}

That alone always results in a braking distance less than the expected (passing 10m as Braking distance and the object brakes at ~8.4m).
I thought it could be drag. So I tried to compensate my braking accel with the drag (for the drag calculation I used the formula found here):

public float Accel = 8f;
private float maxVelocity = 19.44f; // in m/s, approx. 70km/h
[...]
void FixedUpdate ()
{
    Vector3 forwardForce;
    if (playerController.PowerInput < 0.0f)  // if user braking, PowerInput = -1
    {
        float brakeAccel = CalculateBrakeAccel(playerController.BrakeTarget); // BrakeTarget is the transform.position.z where the user pushed the brakes + 10 meters
        forwardForce = new Vector3(0.0f, 0.0f, brakeAccel * playerController.PowerInput);
        Vector3 drag = rigidbody.velocity * Mathf.Clamp01(1f - rigidbody.drag * Time.fixedDeltaTime);
        if (drag.z > 0.0f)
            forwardForce += drag;
        else
        {
            forwardForce -= drag;
        }
        rigidbody.AddForce(myTransform.TransformDirection(forwardForce));
    }
    if (!CapAtMaxSpeed())    // if max. vel not reached, accel force can be applied:
    {
        forwardForce = new Vector3(0.0f, 0.0f, playerController.PowerInput * Accel);
        rigidbody.AddForce(myTransform.TransformDirection(forwardForce));
    }
}

bool CapAtMaxSpeed()
{
    // velocityMagnitude == rigidbody.velocity.magnitude but without sqrt() operation.
    velocityMagnitude = Vector3.Dot(rigidbody.velocity, myTransform.forward);
    if (velocityMagnitude > maxVelocity)
    {
        rigidbody.velocity = rigidbody.velocity.normalized * maxVelocity;
        return true;
    }
    return false;
}

That code gave the best results till now for any given distance (but with that specific Accel and maxVelocity). For example, it returns something in between 9.93-9.97 meters for a given distance of 10 meters (which I would accept as valid enough and a precision issue with floating operations).

The problem is if I encrease the Accel or the maxVelocity, the distance the object reaches full stop is progressively less and less than the one I'm passing to the script.

Also, if I push brake while not at maxVelocity and still accelerating (i.e., applying positive force along Z-axis), the braking distance is way shorter. Common sense suggests it should be larger in any case. And CalculateBrakeAccel() is using the current velocity at any given moment so the correct accel should be a calculated.

sentences:
How do I flatten terrain under a game object? I've got a script that makes a terrain object and paints it with textures, but I'm having an issue.  When I attempt to place game objects (such as the simple water object that unity provides), I use a Raycast to determine the correct height to place the game object, but that just ensures that it is correctly placed at that particular point.

How would I go about flattening the terrain under the game object so that it doesn't go into the terrain or hang out into thin air in the case of hills?

sentences:
How to customize player script with different abilities in each scene? I'm making a game with Unity. I wanted the player script to not have some features in some scenes but couldn't remove them from the script because I needed them for other scenes.
So far, I just unpacked those player prefabs, created new scripts for each of them and removed the lines that I didn't want to have. I know this was not the best idea but I don't know any other way. One of its problems is that it makes managing the scripts hard and confusing.
Is there a way that I can change them without creating new ones? Since I'm going to switch to the new Input system, I want to avoid the possible problems and headaches around these scripts. I also did this (creating a new script) for pause menu script as well. I provided two examples below to make the situation more clear.
Example A) The player can use a shotgun in one of the scenes and I chose to not let him to use the knife in there. So I created a new script for that player and copied and pasted the original script (which had the melee attack ability) and then removed those lines from the new script.
Example B) Pause menu can disable the health bar game object whenever the escape button is pressed. But for one of the levels, I don't want to use the health bar, so I pasted the code in a new pause menu script and removed the line that disables the bar.

sentences:
Flipped Normals On Back Faces I'm trying to create grass quads and have therefore disabled backface culling when rendering these quads. With each vertex normal set upwards ( 0.f, 1.f, 0.f ), all front faces are lit correctly, but backfaces are black. If I change the the Y normal to -1.f the backfaces light up and the front faces go black.

D3D11_RASTERIZER_DESC desc {};

desc.AntialiasedLineEnable  = false;
desc.CullMode               = D3D11_CULL_NONE;
desc.DepthBias              = 0;
desc.DepthBiasClamp         = 0.f;
desc.DepthClipEnable        = true;
desc.FillMode               = D3D11_FILL_SOLID;
desc.FrontCounterClockwise  = false;
desc.MultisampleEnable      = false;
desc.ScissorEnable          = false;
desc.SlopeScaledDepthBias   = 0.f;

I'm not so sure there's a problem here. Any ideas?

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:
Very less vertical transformation Im using pretty basic code here

charcter.transform.Translate(Vector2.up * speed * Time.deltaTime);

Im using rigidbody 2d and I'm creating a platformer. When i press the button the character transforms very little in y axis.

sentences:
How to access an animation properties from the animator? I'd like to change the property speed of an animation from the animator. For example, I'd like the player to be able to reload faster with upgrades. So I have a basic reload animation on the gun animator, and I would like to change its speed depending on the reload speed level the player has. But I can't find how to change this property in C#.

Here is what I have so far :

void Start() {
    gunAnim = gun.GetComponent<Animator> ();
}

void Update() {
    if (Input.GetKeyDown (KeyCode.R)) {
        gunAnim.Play("reload");
        reloadSound.Play();
    }
}

sentences:
Where is the "Scripts Window" menu in Blender 2.59? I'm trying to import a script into Blender, and I have the script in my directory and I pushed F8 to reload scripts, but the instructions for running this script say:

  In the "Scripts Window" run "Scripts → Export → OGRE Meshes".

I've seen other similar instructions for other scripts. But the toolbar only contains "File/Add/Render/Help." Changing the "screen layout" to Scripting doesn't reveal any additional options, either.

I'm sure I'm just missing something obvious. Please help!

sentences:
XNA 3d model mesh.draw() throws TextureCoordinate0 is missing error I've downloaded a bunch of 3d models from turbosquid.com. The majority of the one's I've downloaded are simply .fbx files. When I load the model into my game and run it, the following error is thrown in mesh.draw():

An unhandled exception of type 'System.InvalidOperationException' occurred in Microsoft.Xna.Framework.Graphics.dll

Additional information: The current vertex declaration does not include all the elements required by the current vertex shader. TextureCoordinate0 is missing.

All the answers I've found online seem to tell people to reexport the model, or change something in the shader. I don't have access to these, just the fbx file. What can I do?

sentences:
Code structure in Android 2D game Well I've finnaly decided to start Android game dev, and my first project will be simple 2d canvas based game.
I have some experience in game developing with C# and XNA, and I'm a bit confused now.
Back in XNA we have Game class with Initialize, Update and Draw methods.

In Android I have to extend SurfaceView class, run draw and update in their own thread, and receive touch input from user.

I'm looking for a proper way to structure my code.

Some of my questions are :

How to deal with Activities (Should I run everything in one activity, or split whole game in 2 or more) ?
Where should I run game loop ?
Where to put Draw and Update methods ?
How to respond to touch events ?

Hope I came to the right place for answers...

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: So, I need to create varied animal textures for my game. How would I go about doing that? For example, one of the creatures planned is an isopod like animal. Would I need to get pictures of real animals and adjust them to my needs?

sentences:
At what stage of game development is it a good time to ask for feedback? I'm making a 2D top-down fantasy "Nuclear Throne"-like game. I'm at the point where a player can walk around, pick up weapons and kill some enemies. I'm not an artist, so it looks pretty rough and its clearly unfinished as you can't even progress to newer levels. I want to know if its too soon to ask my friends/family/coworkers and the sort to give the game a test run to see how they like the base combat mechanics. Or even post some screenshots and start getting social media coverage up and running. If now isn't the time, when will I know it is?

I do plan on marketing the game commercially, I am the sole developer at the moment, and its my first commercial game.

sentences:
Best way to store map? I am trying to make a simple game that simulates ants inside a colony, in the Java language. They can move around the paths randomly, go outside to eat leaves, etc. The game is meant to be more of an exercise in programming logic, than an actual game, so I want to try to stay away from graphics, if at all possible. The idea I currently have is to use a 2D array, perhaps like:

public class Map {
    int mapArray[][] = new int[5][5];

    public static void main(String[] args) {
        Map m = new Map();
    }

    public map() {
        //Create the map
        for(int x = 0; x < 5; x++) {
            for(int y = 0; y < 5; y++) {
                mapArray[y][x] = 0;
            }
        }

        //Print the map
        for(int x = 0; x < 5; x++) {
            for(int y = 0; y < 5; y++) {
                System.out.print(mapArray[x][y]);
            }
            System.out.println();
        }
    }
}

I would then do my logic based on the values at different positions in the array.

Is this the best way, or is there a different method that would work better than this one?

sentences:
Select display adapter in D3D9 I have a notebook that has 2 graphics card one Intel and one nvidia graphics cards.
When I want to start my game I right click on the exe file and select run with graphics processor->Nvidia but my engine stills run with my Intel graphics card on d3d9.
Is there any way to choose the graphics card with code?

sentences:
Keeping rotation between two objects In my XNA game I have two objects that collide. When the first object collides with the other it is able to latch on to it and move it about the world. I am having a problem with the math here (Math isn't my strong point). I currently have the second object latch on to the first and move around with it, but I cannot get it to keep it's original direction. So, if the object is facing up it should keep this direction relative to how it is being rotated with the original item.

Any tips on how I could best to achieve this?

sentences:
OpenGL ES object rotation around z axis I have an object on my screen which is presented rotated and panned,
But i have 2 problems regarding the z axis rotations. It's a bit tricky to explain so i uploaded 2 videos to describe each problem.

1) Reverse rotation : After rotating the object around the x axis, the z rotations are being reversed and not as it should be.

2) Wrong Z axis rotation : Again, After rotating the object around the x axis, i'm trying to rotate the object around the z axis and the rotation results in a different axis rotations.

I do believe the video's describe the problems well.

EDIT: Second attempt

As kindly explained by the user @Fault, i understood the problems i was facing with.
So i tried to solve those by just rotating the projection matrix around the z axis, which seemed to be working, but it doesn't.

Since i am rotating the model's axis, I get this problem (video). the issue appears in the 23'd seconds, while i'm demonstrating how it works.
As can been seen, when the z rotation causes a wrong x and y rotations.

I do understand that i must likely have to move these rotations to world view and not model view, the thing is i'm not really sure how to do that.

Here is the relevant code:

Render function:

{
...

    CC3GLMatrix *projection = [CC3GLMatrix matrix];
    float h = 4.0f * self.frame.size.height / self.frame.size.width;
    [projection populateFromFrustumLeft:-2 andRight:2 andBottom:-h/2 andTop:h/2 andNear:4 andFar:100];
    [projection rotateByZ:zRotationEnd];
    glUniformMatrix4fv(_projectionUniform, 1, 0, projection.glMatrix);

    [modelView populateFromTranslation:_currentPan];
    [modelView rotateBy:_currentRotation];

    glUniformMatrix4fv(_modelViewUniform, 1, 0, modelView.glMatrix);
...
}

X and Y rotations:

- (void) rotateAroundX:(float) x andY:(float) y newRotate:(BOOL) isNewRotate
{
    if (isNewRotate) {
        rotationStart = CC3VectorMake(0.0, 0.0, 0.0);
    }

    int rotationDirection = ceil(zRotationEnd/90);
    if (rotationDirection % 4 == 2 || rotationDirection % 4 == 3) {
        rotationEnd.x = rotationEnd.x - (x-rotationStart.x);
        rotationEnd.y = rotationEnd.y - (y-rotationStart.y);
    } else {
        rotationEnd.x = rotationEnd.x + (x-rotationStart.x);
        rotationEnd.y = rotationEnd.y + (y-rotationStart.y);
    }

    rotationStart.x = x;
    rotationStart.y = y;
    _currentRotation = CC3VectorMake(rotationEnd.y, rotationEnd.x, 0);
    NSLog(@"Current x is: %f y is: %f z is: %f",_currentRotation.x,_currentRotation.y,zRotationEnd);

}

Z rotations:

- (void) rotateAroundZ:(float) z newRotate:(BOOL) isNewRotate
{
    if (isNewRotate) {
        zRotationStart = 0;
    }
    zRotationEnd = zRotationEnd - (z - zRotationStart);
    zRotationStart = z;
}

And the vertex shader:

attribute vec4 Position;
attribute vec4 SourceColor;

varying vec4 DestinationColor;

uniform mat4 Projection;
uniform mat4 Modelview;

attribute vec2 TexCoordIn;
varying vec2 TexCoordOut;

void main(void) {
    DestinationColor = SourceColor;
    gl_Position = Projection * Modelview * Position;
    TexCoordOut = TexCoordIn;
}

I would really like to get this right, so any help will be appreciated.

Cheers!

sentences:
How can I design loot to be enjoyable to acquire and neither a chore nor frustrating? I am currently working on an ARPG and I am trying to figure out which elements of the game influence each other and one example is that endgame activities inherently influence loot drops/handling and the other way round. The more classical loot systems we usually get in touch with are following:

Classic MMORPG loot where enemy bodies have to be clicked which open up a window which displays the loot that can be clicked one item at a time. Sometimes it is possible to enable auto-loot in order to skip the clicking of each item.
ARPG loot where slain enemies die in a explosion of loot which can occasionally get extreme up to a point where loot filters are necessary otherwise the screen will be cluttered. In this case players usually pick up uncapped currency like gold automatically while everything else from gear to crafting parts has to be looted manually if the player so desires. Diablo, Path of Exile and the likes to handle it with cliackable labels on-screen while Borderlands for example spreads the loot all around the place and has visual light beams indicating rarities that allows players to filter quickly and go grab the items they might be interested in.
"Loot chests" is what I call the system of Destiny. During a strike or adventure players do participate in combat and are not distracted by random loot on the ground which would require consideration as to whether picking it up is a good choice. After the event has ended, typically after defeating the final boss a chest appears that contains loot.
"Vacuum loot" which was used for Guild Wars 2 and Wildstar where the loot physically drops on the ground and players can loot everything from currencies to gear with one click of a button. In an ARPG this would never work out since inventory space is even more restricted than anything else.

My naive first thoughts are based on how the endgame of Diablo 3 is designed. In classic endgame rifts players can slay enemies and are usually busy picking up materials and some "useless" items that may be used to disassemble them for even more materials. Furthermore they are looking for chests and hoping for some random drops. In contrast to that game mode there are greater rifts which, similiar to Destiny, drop no loot at all except when you kill the final boss that appears after progressing far enough.

In greater rifts there are no distractions just the challenge to finish those at higher difficulties and farming them with specific speed builds while on the other hand the classic rift slow down gameplay when you have to stop every few meters just to click and pick up those items.

I have reached an impasse since I understand players might want to blaze through content and I don't want to make them slow down constantly (with a system like classic rifts in Diablo or Path of Exile in general) but when I stick to "loot chests" at the end of an activity it might happen that less loot drops in general and that there is less gratification when collecting things since the is nothing on the way. Take a long dungeon for example, a "loot chest" system might incentivize just skipping all enemies and do the bare minimum to tackle the final boss. In such a scenario I basically invalidated almost the entire content I am presenting!

Comparing this to (current) legendary items in WoW: if one legendary drops I might be relieved to finally get one (and be angry about it since it's a shitty one...) but I missed the reward stimulus up to the drop itself. Applied to my scenario, the player sees a dungeon as an annoying chore to finally get the chance of acquiring something. If the drops are not satisfying it could possibly be more demotivating thinking that that only chance to get something after such a chore was a waste of time.

So my question is the following: Even though loot explosions may be enojoyable at first they can degenerate into an annoyance (e.g. clicking a bazillion items on the floor). When thinking about making them less boring I end up with something that can be as frustrating in the end. How can I balance this?

sentences:
Unity3d CarController character positioning issue I use the unity standard asset components CharacterController and Car and put an empty gameobject onto the car where the camera should be placed when i am inside the car. The empty gameobject is called "Driver". The character controller has an empty called "Head" where its head is.

When i get in the car i perform the following operation

GameObject car = GameObject.Find("Car");
transform.position = car.transform.Find("Driver").transform.position + Vector3.up*1;
transform.parent = car.transform.Find("Driver").transform;
Camera.main.transform.position = car.transform.Find("Driver").transform.position;
Camera.main.transform.rotation = car.transform.Find("Driver").transform.rotation;

and to get out of it, i use the following

GameObject car = GameObject.Find("Car");
transform.position = car.transform.position;
transform.parent = null;
transform.rotation = Quaternion.identity;
Camera.main.transform.position = transform.Find("Head").transform.position;

My problem is when i get into the car and out again, the character is positioned at the position where i have entered the car, so it doesnt seems to update its position with the car movement.

What am i doing wrong?

Thanks in advance

sentences:
How do I recognize squares, rectangles ... (like in TwoDots)? I currently working on a small mobile game. Not a clone of TwoDots(!) but I need to recognize patterns like they do and I use the game as an example. How the game works? Players have to connect dots. Players can only connect a dot to its direct neighbor in the grid. So the next dot has to be left, right, above or below. Dots can only be added once to a sequence. Connecting a dot to one that is already part of the sequence closes the sequence.

See here http://youtu.be/8RDm6wQ9QbM?t=1m41s (just the next 20 seconds)

What I want to know is when a player connects dots, are there any enclosed dots?

My idea was to store the players touch directions (next to the dots and their position in the grid). For the blue square this would mean {1,2,3,4} if you start from the bottom left and connect counterclockwise. Then I could simply check the number of directions in the array (=4). From my grid I know that the start-dot is [3|3] and the end-dot is also [3|3]. This means it has to be a square and there is nothing enclosed because it is the smallest possible rectangle/square.

The problem starts with bigger squares e.g. the purple one. Starting from the bottom left and connect counterclockwise again there would be the following sequence {1,1,1,2,2,2,3,3,3,4,4,4}. How do I know that this is a square/rectangle or some strange stuff and furthermore how do I know if there are any dots inside?

I can count all directions (3x1, 3x2, 3x3, 3x4) and see that all directions appear 3 times. It has 12 directions. 12 is divisible by 4 so it could be a square. But sadly 12 directions doesn't have to be a square nor a rectangle because [1,2,1,2,1,2,3,3,3,4,4,4] would also close the pattern with the the same amount for each direction.

Well... the green one really makes my brain hurt. Green is definitely not a rectangle nor a square. I know that there might be any dots enclosed because there are more than 4 directions stored in the array and the start- and end-dot are the same but how do I get the three question marks? Same goes for the blue dots which are enclosed by the purple square.

I am totally lost here and I think... or better I hope I am overthinking/missing something here.

Thanks for your help!
proudcastle

Some Possible Squares:
4x OO |8x OOO |12x OOOO |16x OOOOO |20x... 24x... etc.
   OO |   O?O |    O??O |    O???O |
      |   OOO |    O??O |    O???O |
      |       |    OOOO |    O???O |
                        |    OOOOO |

Some Non-Square Rectangles:
6x OOO OO |8x OOO OOOO OO |10x OOOO OOOOO OO |12x OOOOO OOOOOO OO etc.
   OOO OO |   O?O OOOO OO |    O??O OOOOO OO |    O???O OOOOOO OO
       OO |   OOO      OO |    OOOO       OO |    OOOOO        OO
          |            OO |               OO |                 OO
                          |               OO |                 OO
                                             |                 OO

Some Strange Stuff
10x OOOOO   OOO  OOOO  OO   OOOO |12x  OOOOO  OOOO   ...
      O?O  OO?O  O?OO  OO   OOOO |     O??OO  O??OO
      OOO  OOOO  OOO   OOO   OO  |     OOOO   OOOOO
                       OOO       |

sentences:
Is it possible to run other doom3 engine based games using the open sourced version of the engine? Other than the doom3 mods, is it possible for example to run Quake 4 or Prey using the game data?

Let's say that I purchase Quake 4 or Prey (or any other idTech 4 game) can I just point to the game data path and run it with the source code? Is there any modification needed? If so, what is it?

sentences: AAA Games and OpenGL? What modern AAA games on the top of the market used OpenGL? If applicable, what engine did they use?

sentences:
LibGDX sound playing problem I'm making a game and I want to play sounds in it.
I have AssetManager which loads the sounds and I made a class which has playSound(String sound) method. This method calls the get() method of the assets manager with the string, creates Sound type file and calls it's play() method.
The code:

public void playSound(String sound) {
    Sound file = gameRenderer.assetsManager.get("sfx/sounds/" + sound + ".wav");
    file.play();
}

It works fine.
But then I noticed there is a log that occurs every time the sound is played:

AUDIO_OUTPUT_FLAG_FAST denied by client

I also noticed a small "tick" sound in the end of the sound every time it's played in the game.
I read about it and from what I've learned it has something to so with sample rate. I tried many types of sounds (44KHz, 48KHz, and lower values too) but it doesn't stop printing that log.
I couldn't find a solution anywhere.

If it really has something to do with sample rate, does it mean I need to have different types of file of the same sound (With every sample rate)?
If it does, my game would be heavy...
I'm using Nexus 5.
Thanks!

sentences:
SDL pixel access very slow I'm using SDL and need to plot pixels one by one on the screen. When I do this, it's extremely slow. I followed the tutorial here:

http://www.programmersranch.com/2014/02/sdl2-pixel-drawing.html

Which basically said to call:

SDL_RenderClear();

SDL_RenderCopy();

SDL_RenderPresent();

SDL_UpdateTexture();

Right after I update my pixel array.

I ran a loop (which calls the above functions) to demonstrate the issue:

for (unsigned int i = 0; i < 128; i++)
    for (unsigned int j = 0; j < 128; j++)
        plot_pixel(j, i, 0xff); // x, y, ARGB val

But it runs painfully slow. Is there a better way to plot pixels with extreme speed? The whole idea of my program is to plot pixels as fast as possible, and it takes several seconds to run through that loop and plot 128*128 pixels.

Here is the code for plot_pixel:

void plot_pixel(int x, int y, int argb)
{
    pixels[y*width+x] = argb;
    SDL_UpdateTexture(texture, NULL, pixels, width * 4);
    SDL_RenderClear(renderer);
    SDL_RenderCopy(renderer, texture, NULL, NULL);
    SDL_RenderPresent(renderer);
}

The code works exactly like I want it to (it plots a pixel) but its painfully slow.

sentences:
Align UI element to gameObject in 2D I have a 2d game where I want to display UI element perfectly aligned to specific gameObjects.

I have an ortographic camera and I used to Camera.main.WorldToScreenPoint() function giving it the gameobject position modified, for instance, by +1 on X component to get the UI element on its perfect right.

My problem is that the element is not on the gameObject's perfect right, but sensibly above. See this schema:

Expectation:

G -> UI element

Reality:

---> UI element
G

I tried also to use the WorldToViewportPoint() but it's not giving the desired result.
So, I think this is the right way to go but I can't guess what I'm missing.
Any clue?

EDIT:
After a little bit more observations it seemed that the UI element alignment depends somehow on it's distance from the center of the screen (of the camera viewport I guess), so that if the gameObject is below half height the UI element y position won't be on the perfect right but slightly below it and if above half heigth will be slightly above the perfect right. Same for x coordinate. Is there a way I could control this?

sentences:
Prefabs scaling change also the original prefab I want to work with a prefab as local and global variable? something like that.
So my question is how to change a prefab scale without affecting the original prefab.

sentences:
How to calculate the post Rigidbody2D velocity vector before applying a specific force in Unity? I am trying to implement a space rocket in 2D. Whenever the player presses a button, a constant force (Both vertical and horizontal) is being added to that rocket. What I want to add is a maximum speed, the rocket cant exceed as the rocket will continue accelerating to infinity. The player can also choose not to accelerate, which can lead to the rocket starting to fall down due to gravity. Thus, I cant just Clamp the rigidbody.velocity of the rocket whenever the magnitude of it exceeds max speed as it will also limit the fall velocity which is not as limited. Thus, I am trying to predict whether the player will exceed the maximum velocity when trying to accelerate, in order not to add the force.

So far, I have tried doing this but the velocity vector does not seem to change immediately, so vel is equal to postVel:

Vector2 vel = rigidbody.velocity;
rigidbody.AddRelativeForce(Force); // Add force
Vector2 postVel = rigidbody.velocity;
rigidbody.AddRelativeForce(-Force); // Undo force

sentences:
How to properly handle errors in a D3D11 framework? I'm writing a D3D11 framework and I'm trying to clean it up a little, and I'm unsure how to handle errors and return codes in my classes/code.

What is the "best" and cleanest way to implement error handling ?

Should I just use the HRESULT and other D3D types as return values for errors and such, or should I create my own types, or should I go with native c/c++ types ?

sentences:
Sampled texture renders dark I'm taking a texture from a shared texture handle and rendering it on the screen. I do this by creating a simple mesh that covers screen space, and then sampling the texture like so

float4 main(PixelInput pixelInput) : SV_TARGET
{
    return sourceTexture.Sample(textureSamplerState, pixelInput.uv);
}

However, the texture on the screen appears significantly darker than the source texture. I suspect this is because the type of the texture from which I am sampling is DXGI_FORMAT_R8G8B8A8_UNORM_SRGB but my back buffer is DXGI_FORMAT_B8G8R8A8_UNORM. For technical reasons, I am unable to change the format of either.

I tried the following conversion to linear color space

    float4 sRGBA = sourceTexture.Sample(textureSamplerState, pixelInput.uv);
    float3 sRGB = float3(sRGBA.x, sRGBA.y, sRGBA.z);
    float3 RGB = sRGB * (sRGB * (sRGB * 0.305306011 + 0.682171111) + 0.012522878);
    return float4(RGB, sRGBA.w);

But this seemed to make no difference at all (which I found surprising in and of itself).

There are no other shader effects or interesting pieces being applied.

What here might cause the effect of the darker rendering?

Thanks in advanced, let me know if there is any additional interesting information!

sentences:
How to stop a decelarating object? I am programming a 2D game. When a ball is launched it should decelerate and eventually come to a stop. I have implemented the deceleration part but when the ball nearly stops it starts accelerating. I understand that I should implement some kind of condition for when it should stop (when velocity is 0), however all of my attempts have failed.
These are my variables:
v, v0 - velocity
acc - acceleration
dt - delta time
Here is a code sample of how the velocity gets updated on every game tick:
v.setX(v0.getX() + acc.getX()*dt);
v.setY(v0.getY() + acc.getY()*dt);

sentences:
Most efficient way to draw vertex with OpenGL I am writing an OpenGL 3D game.  There will be tons of triangles for terrain and objects in use.

I am studying from the OpenGL official guide and the first presented method is to call a function glVertex after the glBegin for each vertex you want to draw.

However this method sounds quite antique and inefficient when you have to draw thousands of triangles. I guess there are methods to store in the graphic card memory the information that does not change at every frame so that when you render each frame that information is already there. While for more "unstable" information probably you have to send new vertex data every frame and so a different tecnique might be more efficient.

Coming to my question: I would like a clear explanation of the most modern and efficient OpenGL functions and tecniques used to send vertex information to the hardware and to give instruction to render.

What are the best ways and OpenGL tools to send the order to render vertex data that seldom changes during the frames (i think of terrain and objects) and what it the best way to send vertex data that changes a lot during frames?

sentences:
Preferred way to render text in OpenGL I'm about to pick up computer graphics once again for an university project. For a previous project I used a library called FTGL that didn't leave me quite satisfied as it felt kind of heavy (I tried lots of rendering techniques, text rendering didn't scale very well).

My question is, is there a good and efficient library for this? If not, what would be the way to implement fast but nice looking text? Some intended uses are:

Floating object/character labels
Dialogues
Menus
HUD

EDIT: Preferably it could also load fonts

sentences:
How to load a separate map from a text file? I have a text file that I am using for my map for the tiles to be allocated. This works fine, but I am running into issues figuring out how I would go about loading in a different part of the map.

For example, say I wanted the character to go into a cave or building, what would be a good way to go about loading this new area?

Right now I have my handler class setting the world in my game state class, and I have tried messing around in the game state class to try and accomplish what I want but have not had much success. In that game state class I have a tick and render method, and in the constructor I have it being set.

The methods that I have tried have resulted in a new map to be loaded in, but the other map is still loaded in under this, and I know this because the character has collisions set up. This also goes along with this issue, but what would be a good way to trigger this loading of the new section of the map?

Below is the code in my GameState class. (changeWorld is based off of the X coordinate when in game, and once you reach a certain point it switches maps; this was just done for testing because it is not an accurate way of doing it).

// Constructor...
    World1 = new Worlds(handler,"resources/Worlds/world1.txt");

    SpawnWorld = new Worlds(handler,"resources/Worlds/world2");

    if(Worlds.changeWorld() == false)
        handler.setWorld(World1);
    }
    else if(Worlds.changeWorld() == true) {
        World1=SpawnWorld;
        handler.setWorld(World1);
        entityManager.setPlayer(new Player (handler, 0,0));
    }
}//end contructor

public void tick() {
    if(Worlds.changeWorld() == false)  {
        World1.tick();
    }
    else if(Worlds.changeWorld() == true){
        World1=SpawnWorld;
        handler.setWorld(World1);
        SpawnWorld.tick();
    }
}//end tick

public void render(Graphics g) {
    if(Worlds.changeWorld() == false) {
        World1.render(g);
    }//end if
    else if(Worlds.changeWorld() == true) {
            World1=SpawnWorld;
            handler.setWorld(World1);
            World1.render(g);
    }
}//end graphics

sentences:
Why is clip-space 3 dimensional? A vertex shader is basically a transformation function that converts a vertex in your world space to a space that can be rendered on screen.

Since the screen is a 2 dimensional surface whats the purpose of the intermediate clip space? Why not have the vertex shader directly transform a 3d vertex to a 2d point on the raster surface?

sentences:
Monogame - How do I make a moving game such as terraria or stardew valley? Alright so after some long hours and a lot of work I finally understand the basics of Monogame and am able to create a simple game with menu, sounds, the whole lot. But now I want to create a map game, like for example in stardew valley you're able to walk around and the camera will move with your character to a different location. Another example is terraria where you can keep going left for ages and the game will keep on going.

Currently for me I'm limited to the window box of my screen.

sentences:
OpenGL: Is it efficient ok to glPushMatrix, plMultMatrix, plPopMatrix for every object in my scene? I'm very new to opengl, and I might not fully understand the openGL matrix projection stack thing.

So, I have about 300 'objects' in my scene, each with their own position/rotation, and I want to draw them all (ignore culling and overdrawing for now). Would it be efficient enough to:

for each object {
    glPushMatrix();
    glMultMatrix(object pose);

    // do object drawing

    glPopMatrix();
}

or is there a better way to draw each object?

sentences:
Accelerometer problems When I hit an object, my Fighter is supposed to fall to the Ground but because of the Accelerometer, I can still move it up and down even though it died. The Scroller on the x-Axis though stops.
Question: (FIXED) How can I make the Accelerometer stop, after I've been hit, and make the Fighter accelerate to the ground (in absence of the accelerometer, all by itself)?
When I move the Fighter up and down, the transition from "moving up" to "moving down" isn't smooth. It seems like it lags.
Question: How can I Increase the Sensitivity of my Accelerometer?
Also, when I tilt the phone further, the velocity stays the same.
Question: How can I increase the velocity, in relation to the tilt degree?

The code is below:

Accelerometer Code:

float accelY = Gdx.input.getAccelerometerY();

if (Gdx.input.getAccelerometerY() < 5){
   velocity.y = -40;
}

if (Gdx.input.getAccelerometerY() > 5){
   velocity.y = 40;
}

When Fighter hits an Object and dies:

public void die() {
    isAlive = false;
    velocity.y = 0;
    acceleration.y = 460;
}

sentences:
Are SDL games trivially portable from Linux to Windows? I have a small game made with SDL2 and I want to port it to Windows. Would I hav eto write a lot of #ifdefs to port it or will the very same code work on Windows and Linux? Or is it more complicated?

Sorry if these are silly questions. I couldn't find existing resources on porting SDL games between desktop systems and I've never done this before!

sentences:
Rendering smooth ground I'm attempting to render terrain made out of a triangle mesh. The problem is that whenever I have a northwest -> southeast ramp in the terrain, I get this diamond pattern:

The issue is that at the top and bottom of the ramp, the terrain is more flat than at the middle, so if the ramp is aligned with the triangles, each triangle will have two light vertices (at the top and bottom), and one dark vertex (at the middle).
How can I fix this effect? Subdividing the mesh helps, but doesn't fix it completely.
Vertex shader:
uniform mat4 projection;
attribute vec3 position;
attribute vec3 normal;
attribute vec4 color;

varying vec3 f_position;
varying vec3 f_normal;
varying vec4 f_color;

void main(void) {
    gl_Position = projection * position;
    f_color = color;
    f_normal = normal;
    f_position = position;
}

Fragment shader:
varying vec3 f_position;
varying vec3 f_normal;
varying vec4 f_color;

uniform vec3 light_position;

void main(void) {
    float light = 0.5 + 0.5 * abs(dot(normalize(f_normal), normalize(light_position - f_position)));
    gl_FragColor = vec4(light, light, light, 1) * f_color;
}

sentences:
Save-security with MD5 hash I'm working on a flash game that saves your progress locally. These saves can easily be hacked. My solution is to add an md5 hash of all the variables saved into the save file itself. When loading the save, the game would check if the hash is valid.
Is this a good solution? Are there better solutions?

sentences:
Assigning sprite to a sorting layer through scripting I have few prefabs with sprites which I want to assign to different sorting layers. How can I do it?
 I am also wondering if sorting layers matter if I use a perspective camera. Do they?

sentences:
Camera scrolling and game boundaries I am making a platformer game in JBox2D and LWJGL that has a scrolling camera, but I have hit a wall with the boundaries of the camera.

Essentially what I have right now is a Box2D world that is being draw on the screen, a viewport being moved by gluLookAt and several boundaries specified by Box2D edges that also help keep the player from moving out of bounds. It looks a bit like this:

What I'd like to do is "push" the camera when ever it comes in contact with the edge, but otherwise be centered on the player.

I've tried a couple of methods for this, such as finding the min and max width and height, and simply doing an easy box hit test, and moving the screen accordingly, but that has it's limitations, such as if the world is not in a rectangular shape e.g.

Another method I've tried is doing something where I raytrace from one vertex to another of each edge, and if it comes into contact with the screen, I "push" the screen out of the way, but that hasn't quite worked either

    Fixture fixture = boundary.getFixtureList();
    Vec2 point = null;
    boolean hit = false;
    fixtureLoop:
    for(int i = 0; i < boundary.m_fixtureCount; i++)
    {
        EdgeShape edge = (EdgeShape)fixture.getShape();
        Vec2 origin = new Vec2(edge.m_vertex1.x*Main.OPENGL_SCALE, edge.m_vertex1.y*Main.OPENGL_SCALE);
        Vec2 direction = new Vec2(edge.m_vertex2.x*Main.OPENGL_SCALE, edge.m_vertex2.y*Main.OPENGL_SCALE).sub(origin);
        for(float t = 0; t < 1.0f; t += 0.001f) //Raytrace loop
        {
            point = origin.add(direction.mul(t));
            //See if point is within screen bounds
            if(point.x > screenX-Main.WIDTH/2 && point.x < screenX+Main.WIDTH/2 && point.y > screenY-Main.HEIGHT/2 && point.y < screenY+Main.HEIGHT/2)
            {
                hit = true;
            }
        }
            //If hit, find closest vertex
        if(hit)
        {
            float shortestDistance = Float.MAX_VALUE;
            Vec2 vertex = new Vec2();
            for(int v = 0; v < screenVertices.length; v++)
            {
                float distance = point.sub(screenVertices[i]).length();
                if(distance < shortestDistance)
                {
                    shortestDistance = distance;
                    vertex = screenVertices[v];
                }
            }
            Vec2 displacement = point.add(vertex.sub(new Vec2(screenX, screenY)));
            screenX = displacement.x;
            screenY = displacement.y;
            break fixtureLoop;
        }
        fixture = fixture.getNext();
    }

What I have here is my attempt that I have played around with WAAAY too much. Essentially what I'm trying to do is detect if and edges are hitting the screen, find the point where they hit, find the closest screen vertex, subtract them to find the displacement between them, and apply it to the screen so that they're no longer in contact: (The screenVertices array is essentially 4 vertices that look like Vec2(screenX+WIDTH/2, screenY+HEIGHT/2), etc)

I was wondering if anyone could help me out, I'm not sure if I'm having logic problems, code problems, or both. Absolutely any help would be appreciated, thanks!

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:
Export rig from one Maya project to another We are a team creating 3D characters for a game. Each of us is doing a separate character in a separate project. But we need all the characters to have exactly the same rig, and the rigging will be done by a different person. There is a need to speed up the process so we are thinking of doing the rig only once.
Is there a way to export a rig from one Maya project and import it on a character in another?

sentences:
How do I build a matrix to translate one set of points to another? I've got 3 points in space that define a triangle. I've also got a vertex buffer made up of three vertices, that also represent a triangle that I will refer to as a "model".

How can I can I find the matrix M that will transform vertex in my buffer to those 3 points in space ?

For example, let's say my three points A, B, C are at locations:

A.x = 10, A.y = 16, A.z = 8
B.x = 12, B.y = 11, B.z = 1
C.x = 19, C.y = 12, C.z = 3

given these coordinates how can I build a matrix that will translate and rotate my model such that both triangles have the exact same world space ? That is, I want the first vertex in my triangle model to have the same coordinates as A, the second to have the same coordinates as B, and same goes for C.

nb: I'm using instanced rendering so I can't just give each vertex the same position as my 3 points. I have a set of three points defining a triangle, and only three vertices in my vertex buffer.

sentences:
How to implement armor? I am a newbie in Python, I am very bad at math too and I need some help. Also close/move this post if you feel this isn't the right place for it.

Hero1 = 5000   # His HP is 5k.
Hero1dmg = 200 # damage output

How can I subtract some value (let's say 20%) from Hero1's damage output?

sentences:
Managing Background Sprites I tried asking in Chat and no one answered, so the question goes here.

Anyone have advice for loading background Sprite maps? I'm trying to do it as efficiently as possible for a grid of 25 locations. So, I'm thinking only have 5 sprite backgrounds loaded at a time, when applicable, for clean transition from location to location. (Like The original Zelda.) So, should I load up all 25 at once, or only keep the minimum up? (I just want to avoid confusion sprite variables are up.)

sentences:
OpenGL Blending GUI Textures I'm currently creating a menu for my project and I'm trying to get the textures to blend so I'm only left with the actual Image on the texture and not the background. The problem is the whole texture is somewhat transparent, it's not just removing the background.

My RGBA texture looks like

And the black background needs to be removed from the image.

I was using GL_SRC_ALPHA, GL_ONE_MINUS_SRC, ALPHA for my blend function but it wasn't blending anything. I changed to GL_ONE, GL_ONE and now I'm at where I am now.

You can see the text is there but its also transparent, but the background has been removed which is good.

This is how i'm drawing my button. The world behind it is drawn after (i've tried switching order didnt change anything) and it's drawn using VBO's whereas the Buttons are drawn in immediate mode.

glEnable(GL_BLEND);
glBlendFunc(GL_ONE, GL_ONE);[/left]
// get button pos
Point3<float> pos = button->getPos();
// get button dimensions
int width = button->getWidth();
int height = button->getHeight();
// bind button texture and draw quad
glActiveTexture(GL_TEXTURE0);
glBindTexture(GL_TEXTURE_2D, button->getState() ? button->getDownTex()-
>getTextureID() : button->getUpTex()->getTextureID());
glBegin(GL_QUADS);
glTexCoord2i(0, 1); glVertex3f(pos.x, pos.y, 0.0f);
glTexCoord2i(1, 1); glVertex3f(pos.x + width, pos.y, 0.0f);
glTexCoord2i(1, 0); glVertex3f(pos.x + width, pos.y + height, 0.0f);
glTexCoord2i(0, 0); glVertex3f(pos.x, pos.y + height, 0.0f);
glEnd();

I'm using sdl to load the texture

SDL_Surface* image = IMG_Load(textureName);
data.m_w = image->w;
data.m_h = image->h;
data.m_bitsPerPixel = image->format->BitsPerPixel;
data.m_alpha = image->format->alpha;
int colourMode = image->format->BytesPerPixel;
if (colourMode == 4)
   internalFormat = GL_RGBA;
if (colourMode == 3)
   internalFormat = GL_RGB;
if (colourMode == 1)
   internalFormat = GL_LUMINANCE;
if (SDL_BYTEORDER == SDL_LIL_ENDIAN)
{
if (colourMode == 4)
  format = GL_BGRA;
else
  format = GL_BGR;
}
else
{
if (colourMode == 4)
  format = GL_RGBA;
else
  format = GL_RGB;
}
GLuint texture = -1; // create texture handle
glGenTextures(1, &texture);    // gen texture
bindTexture(GL_TEXTURE_2D, texture);
glTexParameterf( GL_TEXTURE_2D, GL_TEXTURE_WRAP_S, GL_REPEAT);
glTexParameterf( GL_TEXTURE_2D, GL_TEXTURE_WRAP_T, GL_REPEAT);
glTexParameterf( GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, GL_LINEAR );
glTexParameterf( GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER, GL_LINEAR );
glTexImage2D(GL_TEXTURE_2D, 0, internalFormat, image->w, image->h, 0, format,
GL_UNSIGNED_BYTE, image->pixels); // normal texture

sentences: Game Design Education I am very interested in a career as a video game designer. to clarify i mean one of the people to figure out how the mechanics, story,  levels and art all work together. To any designers on the website what post-secondary education should I look for? I know that typically they have knowledge of all different parts of game development but is there anything specific I should be looking for that would helpful as a base?

sentences:
How can I create a dice toss that results in a specific value? I am trying to create a 3D dice for a game. Normal dice has been created by setting cube for dice with Rigidbody and apply force to throw a dice.

Now the problem is, the user wants to give a value 1 - 6 in the text box then they will press the roll button. The dice have to rotate and need to show the dice value as the user enters in the text field once it stops rolling.

For example:

In the Input box the value entered as 5,
Now the dice want to roll on the table and show the value as 5.

Anyone, please help me to solve this

Thanks in Advance

sentences:
Handling creation of enemy sprites in a level I am trying to build an RPG tile-map based game. Currently I am going to set enemy sprites that will be repeating their motion in fixed path. Suppose that I have a level map, which has got width 3 times greater than actual applet visible to user.

Now my question is that how should I handle creation of enemy sprites? I have got two options in my mind:

1) Create all enemies at a time on level load (I don't want to follow this approach as it will take up extra memory).

2) Create enemies till the level map is visible to user. Load new enemies as user goes further. I want to follow this one but I don't have any idea.

Can someone give me hints to follow this step and tell me approach usually followed by game developers?

sentences:
How can I calculate the penetration depth between two colliding 3D AABBs? I'm currently working on implementing a very basic collision system in my game at the moment that only uses 3D AABBs. My AABB struct currently looks like this at the moment.

/// <summary>
/// This struct represents a 3-dimensional bounding box that is aligned
/// to the three world axes.
/// </summary>
public struct AxisAlignedBB
{
    public Vector3 Position { get; set; }
    public Vector3 HalfScale { get; set; }

    /// <summary>
    /// Constructor for the AxisAlignedBB struct.
    /// </summary>
    /// <param name="position">The position of the AABB.</param>
    /// <param name="halfScale">The half scale of the AABB.</param>
    public AxisAlignedBB(Vector3 position, Vector3 halfScale)
    {
        this.Position = position;
        this.HalfScale = halfScale;
    }
}

I'm stuck on how the penetration depth between two different colliding AABBs with the AABB format I've laid out in the struct above is calculated. I've spent hours trying to come up with and look for a solution to this but I just can't seem to find anything.

sentences:
How do we generate overhangs with simplex noise 3d? Now I use a simplex noise 2d function with x( voxel's x location ) and y(voxel's y location) to generate heightmap. How do we use simplex noise 3d to generate overhangs? What should the x y z inputs be?
Pseudo code would help a lot.

sentences:
Unity3D - different object with the same mesh imported from Blender I would like to instantiate different objects (i.e. poker chips with different values) that actually share the same mesh imported from blender. To this end I have copied the assets and changed the texture but all the assets automatically switch to the last texture I choose as they are actually the same entity.
What am i doing wrong?

sentences:
My GameObject keeps spawning when it shouldn't I'm trying to instantiate a new gameObject when the current gameObject gets to a select point. The problem comes when the program gets to the second if() statement. It sets the floorsSpawned to 1 and when it does, the game object instantiates a bunch of times. Shouldn't the floorSpawned be set to 2 in the first if() statement and only instantiated once?

public class FloorMovement : MonoBehaviour
{

    public GameObject floor;
    [SerializeField] int speed = 10;
    public int floorsSpawned = 1;
    // Start is called before the first frame update
    void Start()
    {

    }

    // Update is called once per frame
    void Update()
    {
        transform.Translate(Vector2.left * Time.deltaTime * speed);

        if (transform.position.x <= -18.0 && floorsSpawned == 1)
        {
            floorsSpawned = 2;
            Instantiate(floor, new Vector2(11.5f, -2.0f), Quaternion.identity);
        }

        if (transform.position.x <= -40.25 && floorsSpawned == 2)
        {
            floorsSpawned = 1;
            Destroy(floor, 3);
        }
    }
}

sentences:
Odd Behaviour XNA Game Component Inside of my main class file I am initializing a number of game components which are used to represent game scenes i.e. main menu and game. I am initilizing each component inside of XNAs LoadContent method without issue and set the default scene as the main menu. I then switch to the game scene.

My issue then occurs when I switch back to the main menu scene and then try to start a new game by switch from the menu to the game scene. When I switch from the game to the menu I dispose of the game scene using the GameComponent.Dispose() method provided by the XNA framework.

private void UnloadScene(GameScene scene)
{
     scene.Dispose();
}

As I have disposed of the game scene I attempt to re-initialize the game scene component with the following method.

private void LoadScene(GameScene scene)
{
     scene = new GameScene(this, graphics.GraphicsDevice);
     Components.Add(scene);
}

I then switch from the menu scene to the game scene using the following method. This method is called in my Update method after the user has selected new game on the main menu.

public void SwitchScene(SceneManager manager)
{
     sceneManager.HideScene();
     sceneManager = manager;
     manager.ShowScene();
}

This time when the game scene loads I am met with a cornflower blue background and no assets on screen. I have placed a breakpoint within the above method and seen that the game scene is given all of the required data yet nothing is being drawn.

However if I explicitly place the following code above the SwitchScene() method after the player has selected new game then the scene is drawn without issue.

scene = new GameScene(this, graphics.GraphicsDevice);
Components.Add(scene);

Below is what the code looks like with the second approach mentioned.

if (InputHandler.IsHoldingButton(0, Buttons.A, out throwAway))
{
     switch (menuScene.Index)
     {
          case 0:
              gameScene = new GameScene(this, graphics.GraphicsDevice);
              Components.Add(gameScene);

              SwitchScene(gameScene);
              break;

          case 1:
              this.Exit();
              break;
     }
}

Is this behaviour intentional, if so how would I attempt to produce the first approach correctly?

Below is a screenshot of the graphics device after the second attempt to load the game scene. Note the data in this image is identical to the graphics device when loading the game scene for the first time.

Below is the code for the SceneManager class.

public class SceneManager : DrawableGameComponent
{
    private readonly List<GameComponent> components;

    public List<GameComponent> Components
    {
        get { return components; }
    }

    public SceneManager(Game game)
        : base(game)
    {
        components = new List<GameComponent>();

        // Indicates whether draw should be called
        Visible = false;

        // Indicates whether GameComponent.Update should be called
        // when Game.Update is called
        Enabled = false;
    }

    public virtual void ShowScene()
    {
        Visible = true;
        Enabled = true;
    }

    public virtual void HideScene()
    {
        Visible = false;
        Enabled = false;
    }

    public override void Update(GameTime gameTime)
    {
        for (int i = 0; i < components.Count; i++)
        {
            if (components[i].Enabled)
                components[i].Update(gameTime);
        }

        base.Update(gameTime);
    }

    public override void Draw(GameTime gameTime)
    {
        for (int i = 0; i < components.Count; i++)
        {
            GameComponent component = Components[i];

            if ((component is DrawableGameComponent) &&
                ((DrawableGameComponent)component).Visible)
            {
                ((DrawableGameComponent)component).Draw(gameTime);
            }
        }

        base.Draw(gameTime);
    }
}

sentences:
Lighting doesn't work properly in WebGL build only at one place So I have a 2d game where a player walks around the level (top view) with a flashlight in front of him. Everything works fine in the editor, however whenever I build it for WebGL and test it in my browser, one room only one, has a problem with lighting, and as I walk in different parts of the room lighting changes in a weird way, and the floor is blinking in the first half of the room, as well as the flashlight is barely visible (if at all).

Here's how it looks in the editor and is supposed to look like:

And here's a few screenshots from the web build:

P.S. Everything works fine in a standalone build.

Also there seems to be no problem when I disable the 4 lights (the whole room works fine), these are the lights (the ones that look like from a window):

sentences:
How to specify colour in a single 32 bit value I'm writing my first game using OpenGL 2 ES (for Android), and I've currently got a particle engine and some player sprites running successfully.  I'm using 4 floats for the colour of each particle which seems like total overkill.  It makes sense that I should be able to use a single 32 bit int (or perhaps a single float) to hold the colours (perhaps in RGBA format) which would presumably save a lot of unnecessary loading/copying/processing,  but I'm struggling to understand how I could do this.

I guess that I would need to change the shaders to take the relevant format, and also i'd need to change the way I load the color shader attribute.  My fragment shader has:

varying vec4 v_Color;
gl_FragColor = v_Color * texture2D(u_TextureUnit, gl_PointCoord);

and the attribute (passed into the fragment shader from the vertex shader) is set up with:

glVertexAttribPointer(aColourLocation, COLOUR_COMPONENT_COUNT, GL_FLOAT, false, BYTES_PER_VERTEX, floatBuffer);

I've searched the documentation for what I should change vec4 and GL_FLOAT to, and what/how I'd multiply the colour with the texture, and have tried a few things but with no success.

sentences:
How animated block in voxel engine? In my voxel engine (XNA 4.0) I'm use a vertex buffer for the entire chunk and update it after the set block, changing block metadata or light level. This is not too frequent operation compared with the time of mesh rebuild. But now I want animate some blocks, for example, make door opening or lever switching smooth.

If I remember right, in Minecraft all draw on the fly using OpenGL (correct if wrong), but in my case this is not an option.

I'm know what is a bone animation and how it works, and I think that I can make something like this for animatable block X:

rebuild chunk mesh without animated part of block X;
create entity looking like removed animated part and animate it;
remove entity and rebuild chunk mesh with that part in another static position.

I'm not shure this is a correct way. Any better ideas?

Also, how to make a block with animated textures? Do I need to use for this purpose a separate shader or I can somehow a correct texture coordinates of vertices in existed meshe?

Thanks.

sentences:
Scaling Uma Character Unity 3d My room is bigger than my UMA character so on spawn my character looks tiny. I have found this link: http://answers.unity3d.com/questions/988134/uma-how-to-increase-npc-avatar-scale.html

but everywhere I put my code, it does not change my avatars features. Here is my code:

using UnityEngine;
using System.Collections;
using UMA;

public class UMACreator1 : MonoBehaviour {
    public UMAGeneratorBase generator;
    public SlotLibrary slotLibrary;
    public OverlayLibrary overlayLibrary;
    public RaceLibrary raceLibrary;
    public RuntimeAnimatorController animator;

    [Range(0.0f, 1.0f)]
    public float bodyMass = 0.5f;

    private UMADynamicAvatar umaDynamicAvatar;
    private UMAData umaData;
    private UMADnaHumanoid umaDnaHuman;
    private UMADnaTutorial umaDnaTutor;

    private int numberOfSlots = 20;

    void GenerateUMA()
    {

        GameObject go = new GameObject("MyUMA");
        umaDynamicAvatar = go.AddComponent<UMADynamicAvatar>();

        umaDynamicAvatar.Initialize();
        umaData = umaDynamicAvatar.umaData;

        umaDynamicAvatar.umaGenerator = generator;
        umaData.umaGenerator = generator;

        umaData.umaRecipe.slotDataList = new SlotData[numberOfSlots];

        umaDnaHuman = new UMADnaHumanoid();
        umaDnaTutor = new UMADnaTutorial();
        umaData.umaRecipe.AddDna(umaDnaHuman);
        umaData.umaRecipe.AddDna(umaDnaTutor);

        CreateMale();

        umaDynamicAvatar.animationController = animator;

        umaDynamicAvatar.UpdateNewRace();

        go.transform.parent = this.gameObject.transform;

        go.transform.localPosition = Vector3.zero;
        go.transform.localRotation = Quaternion.identity;

     }

     void CreateMale()
     {
        var umaRecipe = umaDynamicAvatar.umaData.umaRecipe;
        umaRecipe.SetRace(raceLibrary.GetRace("HumanMale"));

        umaData.umaRecipe.slotDataList[0] = slotLibrary.InstantiateSlot("MaleFace");
        umaData.umaRecipe.slotDataList[0].AddOverlay(overlayLibrary.InstantiateOverlay("MaleHead02"));

    umaData.umaRecipe.slotDataList[1] = slotLibrary.InstantiateSlot("MaleEyes");
    umaData.umaRecipe.slotDataList[1].AddOverlay(overlayLibrary.InstantiateOverlay("EyeOverlay"));

    umaData.umaRecipe.slotDataList[2] = slotLibrary.InstantiateSlot("MaleInnerMouth");
    umaData.umaRecipe.slotDataList[2].AddOverlay(overlayLibrary.InstantiateOverlay("InnerMouth"));

    umaData.umaRecipe.slotDataList[3] = slotLibrary.InstantiateSlot("MaleTorso");
    umaData.umaRecipe.slotDataList[3].AddOverlay(overlayLibrary.InstantiateOverlay("MaleBody02"));

    umaData.umaRecipe.slotDataList[4] = slotLibrary.InstantiateSlot("MaleHands");
    umaData.umaRecipe.slotDataList[4].SetOverlayList(umaData.umaRecipe.slotDataList[3].GetOverlayList());

    umaData.umaRecipe.slotDataList[5] = slotLibrary.InstantiateSlot("MaleLegs");
    umaData.umaRecipe.slotDataList[5].SetOverlayList(umaData.umaRecipe.slotDataList[3].GetOverlayList());

    umaData.umaRecipe.slotDataList[6] = slotLibrary.InstantiateSlot("MaleFeet");
    umaData.umaRecipe.slotDataList[6].SetOverlayList(umaData.umaRecipe.slotDataList[3].GetOverlayList());

    umaData.umaRecipe.slotDataList[3].AddOverlay(overlayLibrary.InstantiateOverlay("MaleUnderwear01"));
    umaData.umaRecipe.slotDataList[5].AddOverlay(overlayLibrary.InstantiateOverlay("MaleUnderwear01"));

    umaData.umaRecipe.slotDataList[0].AddOverlay(overlayLibrary.InstantiateOverlay("MaleEyebrow01",Color.black));

}

// Use this for initialization
void Start () {
    GenerateUMA();
}

// Update is called once per frame
void Update () {
    if(bodyMass!=umaDnaHuman.upperMuscle)
    {
        SetBodyMass(bodyMass);
        umaData.isShapeDirty = true;
        umaData.Dirty();
    }
}

void SetBodyMass(float mass)
{
    umaDnaHuman.upperMuscle = mass;
    umaDnaHuman.upperWeight = mass;
    umaDnaHuman.lowerMuscle = mass;
    umaDnaHuman.lowerWeight = mass;
    umaDnaHuman.armWidth = mass;
    umaDnaHuman.forearmWidth = mass;
}
}

And here's the image. I want him to be as big as the chair

sentences:
How to implement the interaction between engine parts? I want to ask a question about how the information exchange between game engine parts should be implemented.

The engine is separated in four parts: logic, data, UI, graphics.
In the beginning I made this exchange through the flags. For example if the new object is added in the data, the flag isNew in a object's class will be set as true. And after that the graphics part of the engine will check this flag, and will add the object into the game world.

Though, with this approach I was to write much code to process every flag of each kind of object.

I thought of using some event system, but I don't have enough experience to know whether this would be the right solution.

Is the event system the only appropriate approach, or should I use something else?

I’m using Ogre as the graphics engine, if that matters.

sentences:
best way to implement movement after A* pathfinding? tile-based movement vs pixel-based? I was able to implement the A* pathfinding algorithm to calculate a path from the enemy to player.

After trying to do movement well, I realized I ran into all sorts of problems. I was able to add clearance to the pathfinding, so I'm now going to have sprites of variable size, which leads to even more issues.

I am currently doing movement like -
path[0] is first Tile in path and it is removed when you get to it:

            if (path.Count > 0) {
                if (path[0].isTouching(this))
                    path.RemoveAt(0);
                }
            }

                            if (path [0].getCenterX() > this.getCenterX()) {
                                speedX = speed;
                                speedY = 0;
                                System.Console.WriteLine("moving right");
                            }
                            else if (path [0].getCenterX() < this.getCenterX()) {
                                speedX = -speed;
                                speedY = 0;
                                System.Console.WriteLine("moving left");
                            }

                            if (path [0].getCenterY() > this.getCenterY()) {
                                speedX = 0;
                                speedY = speed;
                                System.Console.WriteLine("moving down");

                            }
                            else if (path [0].getCenterY() < this.getCenterY()) {
                                speedX = 0;
                                speedY = -speed;
                                System.Console.WriteLine("moving up");
                            }

                            this.move(speedX, speedY);

This doesn't work very well for a variety of reasons.

I am certain the pathfinding I implemented calculates the proper path of Tiles. Now I think I have to move from a pixel to pixel movement -> tile to tile in order to have this working better. This would probably help, right? How is movement usually done to work with A*? If the tile-based movement would aid, any tips on implementing this?

sentences:
multiply matrix4x4 with vec4 I'm developing a game and
I'd like to make model * pos4 calc (that's usual in glsl vertex shader) in cpu instead of doing it in gpu. I'm using LWJGL and for the math impl I use JOML. Anyone know how to multiply a vec4 with a matrix 4x4? It would be nice showing me the JOML code but also the way to mul the mat values with the vec4 values is fine!

sentences:
Basic DirectX app creates whistle noise I'm in the process of learning DirectX and in the book examples they have a very basic application which sets up DirectX and displays a blank screen. When I run this app however my computer starts making a whistling noise and I'm really curious as to why it does this.

If I maximize the screen the noise stops and this is the only time the noise happens. When I play normal games, run apps in XNA or do anything that doesn't involve directly using DirectX it doesn't happen.

The FPS is going up to 3000-4000 when the app is running and drops down to 1000 when the window is made to stretch the screen (and the noise stops). I'm taking a guess and saying it's something to do with that?

Anyway, does anyone have any ideas on what is creating this noise?

Thanks

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:
LeanTween : How to check if gameObject is destroyed? I am trying to animate a gameObject using LeanTween which has got destroyed already.
The MissingReferenceException occurs in LeanTween.setOnUpdate();
The null check doesn't work either: (gameObject != null)
I have used LeanTween.cancel(gameObject,false); but it still throws an exception.

sentences:
How long should a user's input be delayed? For browsing the web, the UX site has a great answer.

My question is about games, not forms.

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

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

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

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

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

sentences:
Is this feature copyright infringment? Say there is a card game and they have a feature that allows setting join requirement when hosting a game. These are:  Only people I like, No one I Dislike, Invite Only, Everyone.

If I created a card game and had a similar join requirement feature with similar features: eg: Only Buddies, No Enemies, Invitation, Everyone, is this copyright infringement or is it just an idea and not an expression of one?

Thanks

sentences:
Practice openGL or learn a specific engine? Possible Duplicate:
  Should I use Game Engines to learn to make 3D games?

I am a university student.
I want to work in the game industry.
Now I am thinking about either practicing my openGL skills or learn a complete new game engine during my time in school.
I will do this by developing a smartphone game.
I am debating over using just openGL or using a game engine.
If I learn a game engine, then if the company I want to work for does not use that game engine, then wouldn't it be a waste of time to learn that game engine now instead of solidifying my openGL skills?
So, openGL or game engine?
Thanks.

sentences:
Any significant performance cost to using BlendState.Premultiplied? Normally I guess you'd use BlendState.AlphaBlend because normally when you load your textures through the pipeline they're already premultiplied. However, if you're loading textures at runtime from PNGs or some such, you have to loop through the pixels and premultiply them, which can take a long time if you've got a lot of textures to load.

So it looks (haven't tried it) like using BlendState.NonPremultiplied instead of BlendState.AlphaBlend should handle non-premultiplied textures and produce the same visual result, without all the startup costs. I have to wonder if there's a non-obvious cost to doing this, like a huge drop in performance or something. Anyone know?

sentences:
How many active shaders at one frame in the game should I typically use? 5 or more like 100? How many shaders are usually active, at the same time in one scene, in modern games? I know that multiple shaders are being used, with the games switching between them in each frame, and it's common to draw objects via the shader:

Draw all objects with shader one
Change from shader one to shader two
Draw all objects with shader two

Still, I know it's not as simple, especially with effects like a glow effect for whole scene, render to texture, etc., but I guess we can assume it works that way most of the time, right? The "group by shader" approach is good, because switching shaders is an expensive operation.

From one side, you cannot have too many shaders, because you want to render the scene fast. On the other hand, you need many different shaders (or uber-shader with branches - quite similar) for skin, metal, water etc.

How many (and which) different shaders would the theoretical, modern, third person, 3D detective game for PC (DirectX 11, if it matters) use? It would be 5, 20 or more like 100 active shaders, counting only active, at some "frame X"? I know it's not one number, but I wonder what scale and factors are important, in consideration for a PC game.

In my sample game, I would use about 9-11 per frame (count it as different, small shaders or one uber-shader - doesn't matter now):

Skin shader
Eye shader (not too much? but they are different)
Metal shader
Ground shader
Snow/rain shader (if required)
Water shader (if the water exists in scene)
Glow shader (only when some special effects are involved)
Light emiter shader (street lamps etc.)
Standard shader (for all other, just standard shading)
Standard shader with normal maps
2D shader (for GUI etc.)

Is it "much" or "not many"? Did I forget about some important shaders that I would need?

sentences:
Inertia in flight simulation using box2d I'm trying to simulate flight using box2d and libgdx.

The main problem I am currently experiencing is with inertia: since there is no air, the plane looks like it were drifting.

I wasn't able how to turn off inertia.

I have two ideas:

Imitate air resistance by applying force
Imitate flight using linear velocity without using any box2d physics

Are any of these two ways correct? Or maybe there is way to turn off inertia?

sentences:
How can I skew my XNA sprites? I would like to make a 2D tile based game, but, to make it look a bit prettier, I would need to skew textures so that it would look more like a 2.5D game.
So I thought maybe I should skew textures to something like this:

So far I only found one topic about it - http://forums.create.msdn.com/forums/p/37143/215098.aspx#215098

But I don't really understand it. Maybe some of you do, can tell me how to skew my sprites?

sentences:
How to update void show? getMusicPlaying is set to false whenever someone touches the button, but libgdx runs show method only once, at the start of the game, hence the music will keep playing forever.

I tried to use the render and batch.begin instead of show() same result.

private boolean musicPlaying = true;

button.addListener(new InputListener() {
public boolean touchDown(InputEvent event, float x, float y, int pointer, int button) {
 return true;
}

public void touchUp(InputEvent event, float x, float y, int pointer, int button) {
 setMusicplaying(!musicplaying);
}
});

}
});
}

public void show() {
 if (getMusicPlaying ==true)
  music.play();
}

sentences:
How to rotate a 2d line? Its a very simple question.
How can i rotate a line by one of its endpoints by the angle rad?

Heres my current code ( I couldnt find a different solution )

void displayPlayer() {
    float rad;
    putpixel(x, y, 10);
    if (view > 360)
        view = 0;
    nx = (int)round(x*cos(view) - y*sin(view));
    ny = (int)round(x*sin(view) + y*cos(view));
    rad = (double)view / 180.0 * M_PI;
    line(x, y,nx,ny);
    putpixel(cos(rad)*(x + 10) - sin(rad)*(y + 10), sin(rad)*(x + 10) + cos(rad)*(y + 10), 10);

}

Heres a litte visualisation of my result:

The line is supposed to be 10 px long and keep rotating 360°. Ive indicated its origin with a green line.

What am I doing wrong?

sentences:
create terrain with some vertical cliffs, natural arcades, caves using octree I am about to start creating the first terrain. I would like to create a terrain with vertical cliffs, natural arcades and caves.

For instance in one point the terrain might look like this.

I want to discuss about how to store this information about the terrain.

I think quadtree will not do the trick. From my understainding with quadtree perfectly vertical terrain is bound to be low quality in the vertical part, as you cannot subdivide it.

So I thounght that octree should be the right tool. But I have a conceptual problem with octree. I cannot understand how to store the triangle data in a octree structure.

Understanding how to store data in a quadtree is easy: you subdivide the region in a lot of squares and you give a coordinate value to each vertex of the squares, then you just connect all the verticies with triangles.

But what can you do when it comes to octtree? Which information should you store conceptually in the octree tree?

I cannot guess the logic and the algorithm that lays behind a octtree terrain.

Thank you

sentences:
Event manager/system for an open world adventure game in Unity I'm making an adventure game set in a school (think Bully, but much less scope as I am one person) and I'm starting to program the last important systems like a sound manager and an event system and I'm a bit confused about the event system.

Basically, I want to be able to track stuff like missions completed that may cause some stuff to happen like changing dialogue of a character. One other example is that talking to one character before another will cause you to interact with them differently. I don't want to handle this kind of stuff for each indivdual NPC, especially since each NPC has one script that holds stuff like their current dialogue and other important data.

Another thing in my game is that the time is based on periods rather than a real-time system. Every time you complete a mission or some other event, it will change (the periods are Morning, Afternoon, Evening, and Midnight), which also changes the position of NPCs and may also change their dialogue.

How would I design such a system?

sentences:
SharpDX/D3D: How to implement and draw fonts/text I am playing with SharpDX (Direct3D for .NET) without using "Toolkit", already finished with basic rendering 3D models.
But now i am wondering how to program/create fonts for game (2D), or how to simple draw variable text to output with Direct3D? (it is not as SharpDX question as common Direct3D question, how to start with game GUIs?
And what should i do to program simple GUI's like menu for a game (generally i understand that it's shaders).

sentences: Unity Method count exceed the limit of 64K I just got an issue related to a 64k method in Unity so that's why I'm unable to build my project. It shows method limitation exceed the limit of 64k method count. So can anyone here help me out to resolve this issue?

sentences:
iOS UDK Kismet Compare Vectors? I have created a control scheme identical to the UDK Jazz Jackrabbit tutorial.

Everything works as it should except I would like the Left Stick to control the character rotation when the Right Stick is not being pressed.

I'm terribly stumped here as don't know whether I should be comparing the vector output or the active/inactive input... nor do I honestly know how do this in Kismet :)

Any help would be greatly appreciated!

EDIT:
I want the left stick to do both the movement and rotation... until the right stick is pressed. In Kismet, how do I override the left stick's input with the right stick when it is pressed? (for the rotation that is)

sentences: Create random polygon shapes I want to make a random shape made out of points. I want the points to create a polygon shape. Is there a clever way to create a random shape like this? Im thinking going throug X points and giving them random positions but the problem is that they shoudl never intersect and the last point should connect to the first, which they always can do but the points should be somewhat evenly spread out. Im betting there are already good algorithms for this but i lack the words to know what to look for.

sentences:
Efficient way to draw multiple separated quads Let's assume I want to draw several separated (possibly textured) quads in Direct3D 9, each consisting of two triangles:

How should I draw these for maximum performance, i.e. which of the following ways is better in terms of speed?

Describe each quad by 4 vertices, use D3DPT_TRIANGLESTRIP and call IDirect3DDevice9::DrawPrimitive for each individual quad, since they are not connected.
Describe each quad by 6 vertices, use D3DPT_TRIANGLELIST and call IDirect3DDevice9::DrawPrimitive just once.

The first method uses less memory, while the second one requires only one draw call.

However, the second way seems to be feasible only if all the quads have the same texture, since otherwise a switch would be required.

sentences:
When and Why to use Console Logging Why and in which way should I incorporate console logging into my small sized games? I use Java and C++.

With console logging I mean things like this:

sentences:
Unknown error XNA cannot detect importer for "program.cs" I am not too sure what I have done to cause this, but even after undoing all my edits, this error still appears

  Error 1   Cannot autodetect which importer to use for "Program.cs".
  There are no importers which handle this file type. Specify the importer that handles this file type in your project.
  (filepath)\Advanced Pong\AdvancedPongContent\Program.cs   Advanced Pong

After receiving this error, everything between #if and #endif in the program.cs fades grey

using System;

namespace Advanced_Pong
{
#if WINDOWS || XBOX
static class Program
 {
    /// <summary>
    /// The main entry point for the application.
    /// </summary>
    static void Main(string[] args)
    {
        using (Game1 game = new Game1())
        {
            game.Run();
        }
    }
 }
#endif
}

I have searched this and could not find a solution anywhere. Any help is appreciated.

sentences:
I have problem understand instantiating new objects in Unity at runtime , help please :) Hi again you fine folks.

So I'm making a driving game and there is going to be some cows in the road you have to dodge.

Currently I've laid 3 spawnpoints in the form of flat cubes, with the following script attached to each of them. (The reason I am manually laying the spawn points out myself is that the road is very windy, and has steep hills etc , and I was struggling to find a way to prodecurally place them on the road exactly at correct height etc.

Here is the code im using for these spawn points. For some reason I am getting all 3 cows spawn on the first spawn point, instead of just one. I haven't driven the car thru to the other 2 spawn points, id guess there'd be 3 cows at each of them. (I have to actually build to my phone to get that far due to the controls being for mobile not PC):

public class CowSpawn : MonoBehaviour {
public GameObject bullPrefab;
public float spawnChance;
bool willSpawn = false;

private GameObject bull;

// Use this for initialization
void Start()
{
    if (Random.value < spawnChance)
    {
        willSpawn = true;
    }

    bull = (GameObject)Instantiate(bullPrefab);
    bull.transform.position = GetComponent<GameObject>().transform.position;

}

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

}

}

sentences:
Best Practices for class usage and game architecture I'm making a 2D game similar to mario in Java.

I have some questions about class organization and proper method usage.

I have the following classes:

Main: runs the game in a JFrame
GamePanel: JPanel with boundary rules, timer, paintComponent, scoring, keyboard input, collision check
Player: only knows about its own attributes... has getter and setter methods for x, y location, height, width, weight etc...
Item: Same thing as Item class... this class will be used for items in the game, like bullets, cars, etc...
Physics: I was going to use this class to contain all actions for all items in the game (items class, player class, etc)... Like the rules for jumping, or running, etc...

Am I using the classes appropriately? I'm not sure whether each class should contain its own unique methods...

For example, only Player class objects will be able to jump and run... So should Player class have jump() and run() methods? Or should it just have setX(), setY() methods which alter its location based on run() from another class like Physics()?

And for a gun, I have shoot() which creates a new Item

 bullet = new Item(this, player.getX(), player.getY()+40, 25, 10, 10, bulletVelX, 0);

But as you can see below, I'm actually moving the bullet via the timer() class by calling the Item class's autoMove() method to change the bullet Item's location.

I'm also confused on the correct usage of timer():

I'm using it to run methods at a certain interval if a given boolean is set true...

public void timer() {
    timer.scheduleAtFixedRate(new TimerTask() {
        public void run() {
            collisionCheck();
            if (jump) {
                player.jump(velocityX, -velocityY);
                velocityY--;
                checkPlayerBounds(player);
                repaint();
            }
            if (shoot) {
                if (!bulletMag.isEmpty()) {
                    for (Item bullet : bulletMag) {
                        bullet.autoMove(bullet.getVelocityX(), bullet.getVelocityY());
                    }
                    if (bulletMag.size() > 30) {
                        bulletMag.clear();
                    }
                    repaint();
                }
            }
        }
    }, 0, 100);
}

Is is okay to put all that logic inside the timer class? Or should the timer class be kept as clean and empty as possible? Is that where my main Game loop is?

Lastly, paintComponent():

I put a paintComponent in each class (Player, Item, and  GamePanel so far), and paint them by calling them from within the GamePanel's paintComponent. Is that right?

public void paintComponent(Graphics g) {
    g.setColor(Color.white);
    g.fillRect(0, 0, width, height);
    player.paintComponent(g);
    for (Item bullets : bulletMag) {
        bullets.paintComponent(g);
    }
}

So, in summary is my usage of classes, timer, and paintComponent correct?

sentences:
How to await player input using Coroutines How can I accept player input using Coroutines, pausing execution of Unity while the player has not yet provided input? It seems like a simple problem, but I can't seem to figure it out. Here is my latest attempt. In this program I want to do some logic and pause in the middle, continuing only when the player has inputted some data. Someone please tell me I'm on the right track :O

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

public class InputTester : MonoBehaviour
{
    int choice = -1; // valid choices for this example are 0 and 1

    void Start()
    {
        StartCoroutine(DoSomeLogic());
    }

    IEnumerator DoSomeLogic()
    {
        print("Starting...");
        print("Awaiting your choice - 0 or 1. :: ");
        // yield return StartCoroutine(WaitForKeyDown(KeyCode.Alpha0) || WaitForKeyDown(KeyCode.Alpha1));
        // how to combine these two into a single method that gives the player a choice?
        print("Continuing...");
        switch (choice)
        {
            // logic based on the choice
        }
    }

    IEnumerator WaitForKeyDown(KeyCode k)
    {
        while (!Input.GetKeyDown(k))
            yield return null;
        SetChoiceTo(k);
    }

    private void SetChoiceTo(KeyCode keyCode)
    {
        switch (keyCode)
        {
            case (KeyCode.Alpha0):
                choice = 0;
                break;
            case (KeyCode.Alpha1):
                choice = 1;
                break;
        }
        //StopAllCoroutines(); // how do I stop all the coroutines that accept player input?
        print(choice);
    }
}

sentences:
What is a lobe, in reference to lighting and graphics I sometimes see references to lobes when talking about lighting, especially with specular lighting, but also with spherical harmonics which doesn't do specular.

Can anyone explain what exactly a lobe is?

sentences:
Intermediate AI for Java games I want to know how to create good AI for a Java game,  I'm still learning the language and I'm not an expert.
I can do static AI but wanna know about  writing an AI that follows the player and considers how to reach him via pathfinding.

sentences:
How to associate multiple arrays of vertex data and uv data with an attribute? OpenGL ES I create the buffers to to put on them the vertex data and uv data:

    ByteBuffer bb = ByteBuffer.allocateDirect(coord.getVertices().length * 4);
    ...
    vertexBuffer.position(0);

    ByteBuffer dlb = ByteBuffer.allocateDirect(coord.getIndices().length * 2);
    ...
    drawListBuffer.position(0);

    ByteBuffer uv = ByteBuffer.allocateDirect(uv.getUv().length * 4);
    ...
    uvBuffer.position(0);

Then I pass this vertex data using these buffer to shader with:

glGetAttribLocation(Shader.program_Image, Shader.V_POSITION);
...
glVertexAttribPointer(v_Location, 3, GL_FLOAT, false, 0, vertexBuffer);

and the uv data with:

glVertexAttribPointer(a_Location, 2, GL_FLOAT, false, 0, uvBuffer);

This allows me to render multiple shapes using ONE array, and I also can use a texture atlas and load a special of "multiple-texture", and at this point my app run correctly without any error, but I want to do now is have different arrays and send them to shader, to be able to transform only some arrays, I don't know if this is possible, for the moment I have tried without success, and I was thinking if there is a way to add all the arrays to the same buffer and how to do it.

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:
Strategy game tile and unit storage I've recently started working on a turn based strategy game much like games from the Fire Emblem or Final Fantasy Tactics series. However, I'm running into a few problems concerning the storage of the tile data and unit data. For example, just like in Fire Emblem I want to show all possible movement when you click on one of the units. Here is an image showing what I mean.

In this image the possible fields to move to have been indicated with a blue color. Fields that are in range for an attack have been indicated with the red color. Normally the tile the enemy unit is on would be in range to move to, however since there is someone standing on the tile the game has recognized that you can't move there.

I understand the need for an algorithm like Breadth-First Traversal to find out all possible fields to move to, but I'm unsure how to exclude fields occupied by an enemy. In order to avoid circular dependencies between fields and units I only store a reference to field in the unit class and not the other way around. So when I work my way through the fields to check all possible moves, how do I best find out if that field is actually valid?

I could of course just loop through the list of all enemies for each field that I process to see if it's occupied. Another way to potentially solve it would be to loop through the list of possible fields and removing fields occupied by enemies from that list, but I think that wouldn't work properly because occupied fields can also have the effect that empty fields around them are no longer reachable (due to the enemy blocking access to them). The easiest way to solve it would be to also store a reference to the unit within the field class. This would of course introduce a circular dependency.

I feel like there should be a much better solution than the ones I can think of, but I just can't figure it out.

Thanks in advance!

sentences:
Adding class to Game I work on a little project, and in the past, I used SpriteManager : DrawableGameComponent as my SpriteManager class.

I have been told that DrawableGameComponent is not so recommended to use, so I decided to make my own custom methods in a new class called SpriteManagerGeneral. Now I try to acces that class via Game. In the past I used this in Game:

spriteManager = new SpriteManager(this);
Components.Add(spriteManager);

But now I can't do this with SpriteManagerGeneral because it's not a GameComponent.

Do I just change my class (and edit my methods) to SpriteManagerGeneral : GameComponent or is there another way (that is better than GameComponent) to do this?

NOTE: I'm a beginner in programming.

NOTE2: Yes I know why DrawableGameComponent is not so recommended.

sentences:
Sound activated particlesystem I am trying to make a particle system that is activated by sound. Like emitting on the beat resizing on the beat and such things.  I found some nice tutorials on how to make things like Windowsmediaplayer visualsynths but they dont really help me to convert it to a particle system.

Anysuggestions how i could do this ?

sentences:
Is using an anonymous inner class to determine game item behavior the right way? I'm developing a little game that has a bunch of different items. I categorize the items in separate classes (consumables, armor, weapons) that all extend Item.class. Then I use one main Items class where I basically initialize all items and give them their values and spritefile. I also want to give some items different behavior. For example a potion that teleports you or a potion that makes you stronger. I don't want to make separate classes for every item with different behavior so that's why I'm now thinking of using an anonymous inner class. The class will only be instantiated once.

This is what my simple Items class looks like:

public class Items implements Iterable<Item>{
    private static ArrayList<Item> items = new ArrayList<Item>();

    @Override
    public Iterator<Item> iterator() {
        return items.iterator();
    }

    public static Item getItem(int id) {
        return items.get(id).clone();
    }

    public static void initialize() {
        addItem(new Armor(0, 1, "Leather Helmet", "Leather_Helmet.png", 30));
        addItem(new Consumable(1, 16, "Apple", "Apple.png", 30));
        addItem(new Consumable(2, 1, "Strength Potion", "Strength_Potion.png", 0) {
            @Override
            public void consume(Player player) {
                // Do potion stuff
            }
        });
    }

    public static void addItem(Item item) {
        items.add(item.getId(), item);
    }
}

The initialize() method is basically where I load in all the different items to the game. The third item is where I use an anonymous inner class. Is this the "right" way of handling things? Let me know how I could handle this differently.

sentences:
How to find the ideal path done inside a given shape in LibGDX? I'm trying to make an android/libgdx game in which for every level you have a different shape as a png, and you have to drag your finger inside the shape and try to be as close as the ideal path created after the shape. At the end of the level the game will show you in a percentage how close you were from the ideal path.

My question is how can I find the ideal way that the player has to follow? Is there any function that i can use to find out the array of points created after the shape?

My problem is that the shape width is different along the way, so I can't use the pixels path. I already have an algorithm which gives me the array of points from the path of the player so I have to compare it with the ideal one.

If you have any ideas of any algorithm or functions that can help please let me know. Any answer will be helpful.

sentences:
JOGL hardware based shadow mapping - computing the texture matrix I am implementing hardware shadow mapping as described here.

I've rendered the scene successfully from the light POV, and loaded the depth buffer of the scene into a texture. This texture has correctly been loaded - I check this by rendering a small thumbnail, as you can see in the screenshot below, upper left corner. The depth of the scene appears to be correct - objects further away are darker, and that are closer to the light are lighter.

However, I run into trouble while rendering the scene from the camera's point of view using the depth texture - the texture on the polygons in the scene is rendered in a weird, nondeterministic fashion, as shown in the screenshot.
I believe I am making an error while computing the texture transformation matrix, but I am unsure where exactly.

Since I have no matrix utilities in JOGL other then the gl[Load|Mult]Matrix procedures, I multiply the matrices using them, like this:

void calcTextureMatrix() {
  glPushMatrix();

  glLoadIdentity();
  glLoadMatrixf(biasmatrix, 0);
  glMultMatrixf(lightprojmatrix, 0);
  glMultMatrixf(lightviewmatrix, 0);
  glGetFloatv(GL_MODELVIEW_MATRIX, shadowtexmatrix, 0);

  glPopMatrix();
}

I obtained these matrices by using the glOrtho and gluLookAt procedures:

  glLoadIdentity()
  val wdt = width / 45
  val hgt = height / 45
  glOrtho(wdt, -wdt, -hgt, hgt, -45.0, 45.0)
  glGetFloatv(GL_MODELVIEW_MATRIX, lightprojmatrix, 0)

  glLoadIdentity()
  glu.gluLookAt(
    xlook + lightpos._1, ylook + lightpos._2, lightpos._3,
    xlook, ylook, 0.0f,
    0.f, 0.f, 1.0f)
  glGetFloatv(GL_MODELVIEW_MATRIX, lightviewmatrix, 0)

My bias matrix is:

float[] biasmatrix = new float[16] {
  0.5f, 0.f, 0.f, 0.f,
  0.f, 0.5f, 0.f, 0.f,
  0.f, 0.f, 0.5f, 0.f,
  0.5f, 0.5f, 0.5f, 1.f
}

After applying the camera projection and view matrices, I do:

glTexGeni(GL_S, GL_TEXTURE_GEN_MODE, GL_EYE_LINEAR)
glTexGenfv(GL_S, GL_EYE_PLANE, shadowtexmatrix, 0)
glEnable(GL_TEXTURE_GEN_S)

for each component.

Does anybody know why the texture is not being rendered correctly?

Thank you.

sentences:
List of Anti-Cheat Packages for MMOs? i would like to start this topic for programs to counter-attack link text.

I am not aware of a big list but with everyone's help i hope to make this a fine topic.

Posting format:

NAME: nProtect GameGuard

GAME TYPE: any type of game

Website: http://global.nprotect.com/product/gg.php

FEATURES?

Protect the users' PC from fast
evolving hacking technologies and
viruses.
Real-time protection, diagnose
various patterns latest hacking tools
that can harm games, but also memory
debugging prevention technology will
be applied, completely blocking
hacking tools through real-time
hacking tool monitoring and blocking
function.
Blocks hacking attacks through memory
scan
Blocks online outflow of personal
information

sentences:
How to use rigid bodies for characters? First off, I am making a game similar to SSB, which relies heavily on physics, even though it is a sidescroller. I am currently using Unity.
In Unity there are "character controllers" which are used for characters that move, but they don't interact with other physics objects. There are also rigid bodies, which are completely realistic physics components. I can't figure out how to use rigid bodies for human/humanoid characters. Here's some questions I have:

How should I move the character? Applying forces is not the way to do it, right? Would you set velocities or pixel-by-pixel movement, perhaps?

What kind of collider should I use? I've been using a capsule collider. But is that the best way?

How do you make him not fall down!? After some experimenting, I discovered that the character falls over (from applying force/velocity and from the capsule collider tipping it over). Would you constrain the rotation in the Z-axis?

What do you do when he gets hit? If you've ever played SSBB you'll be familiar with this topic. I'm thinking that applying a force would be best in this condition? If you did constrain the rotation, would you un-constrain it?

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:
Monogame movement Handling I was curious if anyone could explain how I would be able to create simple movement handling in monogame. So far I have a red block which I tried to move by using a loop but that didn't take any effect.

protected override void Initialize()
        {
            // TODO: Add your initialization logic here
            position = new Vector2(0, 0);
            texture = new Texture2D(this.GraphicsDevice, 100, 100);
            Color[] colorData = new Color[150 * 150];
            for(int i = 0; i < 10000; i++)
                colorData[i] = Color.Red;
            texture.SetData<Color>(colorData);
            base.Initialize();
        }

I also have created this handler but I don't exactly know what I have to do next.

/*protected override void HandleInput(KeyboardState keyState)
        {
            if (keyState.IsKeyDown(Keys.W))
            {
                // Look Up
            }
            if (keyState.IsKeyDown(Keys.S))
            {
                // Look Down
            }
            if (keyState.IsKeyDown(Keys.A))
            {
                // Move Left
            }
            if (keyState.IsKeyDown(Keys.D))
            {
                // Move Right
            }
        }*/

sentences:
Is There an Easy Way to Convert Python/Pygame code into C#? I am working on a game, sort of like this and I want to convert it to C#, as it is currently written in Python. The reason of this is because I can add features more easily and with less writing in C#, and I do NOT want to write it all again, with all of the glitches and testing having to be redone. Is there any program of internet service that can do so, for free? I don't have extra money to spend on this, which is just for fun. Thanks for all feedback, edits, and suggestions!

Edit: I use Wing IDE 4.1 for my Python coding and the Unity Version of MonoDevelop for C#.

sentences:
Will making players pay a virtual currency before entering a match discourage them from playing? I'm making a multiplayer match-making game, and by my current design, people will need to pay a small fee before joining a match. At the end of the match, the team that won will get the money. That will be a virtual currency, but still, will it discourage people to enter matches? I introduced it to make the matches matter more, because there's always a fear that you will loose your investments.

I'm not talking about anything big here, but even a small amount might have a similar psychological effect as a bigger one.

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:
In Eclipse using libgdx, what does "project description file is missing" mean? In a sudden case of nostalgia, I switched my eclipse workplace from my working libgdx projects to an older one. After looking through my old stuff I had some problems switching it back, since I didn't import it right. After I got that working, I cant run my libgdx desktop projects anymore. It says it couldn't load the Spritesheet anymore: After googling a little, I was told to make sure the Android asset folder is linked to the desktop project, which it is.

I then noticed that one of the project folders is closed (I've got Project-android,Project-core,Project-desktop and just Project) The folder project was closed and when trying to open it, it gave me the following error:

  The project description file (.project) for 'Projekt Stella' is missing. This file contains important information about the project. The project will not function properly until this file is restored.

The thing is I made sure that this file is still in the folder which it is... so now I have no idea how to get this working. Any ideas?

Edit: The project works fine in Android studio. Its just not working in Eclipse.

sentences:
2D HUD over 3D scene I'm trying to create a 2D Heads up Display for my players in a 3D OpenTK environment. How I'm doing it is by drawing my 3D elements and then running this code.

GL.MatrixMode(MatrixMode.Projection);
GL.Ortho(-0.5, 0.5, -0.5, 0.5, 1, 100);
GL.LoadIdentity();
GL.MatrixMode(MatrixMode.Modelview);
GL.LoadIdentity();
//Disable all depth stuff
GL.DepthMask(false);
GL.Disable(EnableCap.DepthTest);
GL.Disable(EnableCap.CullFace);
//Pass texture to shaders
GL.ActiveTexture(TextureUnit.Texture0);
GL.BindTexture(TextureTarget.Texture2D, TextureImg.Handle);
GL.Uniform1(GL.GetUniformLocation(Game.pgmID, "texUnit"), 0.0);
GL.Uniform1(GL.GetUniformLocation(Game.pgmID, "texture"), 1.0);
//Enable vertex attributes
GL.EnableVertexAttribArray(Game.attribute_vpos);
GL.EnableVertexAttribArray(GL.GetAttribLocation(Game.pgmID, "texcoord"));
GL.EnableClientState(ArrayCap.VertexArray);
GL.EnableClientState(ArrayCap.TextureCoordArray);
//MVP matrix is only translation of HUD position
Matrix4 c = Matrix4.CreateTranslation(new Vector3(Position.X, Position.Y, 0)) * Matrix4.CreateScale(0.1f);
GL.UniformMatrix4(Game.uniform_mview, false, ref c);
//Send vertices and uvs to shader
GL.BindBuffer(BufferTarget.ArrayBuffer, vbo);
GL.BufferData(BufferTarget.ArrayBuffer, (IntPtr)(verts.Length * Vector2.SizeInBytes), verts, BufferUsageHint.StaticDraw);
GL.VertexAttribPointer(Game.attribute_vpos, 2, VertexAttribPointerType.Float, false, 0, 0);

Vector2[] uvs = new Vector2[]
{
    new Vector2(0,0),
    new Vector2(1,0),
    new Vector2(1,1),
    new Vector2(0,1)
};

GL.BindBuffer(BufferTarget.ArrayBuffer, vbo);
GL.BufferData(BufferTarget.ArrayBuffer, (IntPtr)(uvs.Length * Vector2.SizeInBytes), uvs, BufferUsageHint.StaticDraw);
GL.VertexAttribPointer(GL.GetAttribLocation(Game.pgmID, "texcoord"), 2, VertexAttribPointerType.Float, false, 0, 0);
//Draw
GL.DrawArrays(PrimitiveType.Quads, 0, 4);
GL.UseProgram(Game.pgmID);
//Make sure I can render 3D again
GL.BindBuffer(BufferTarget.ArrayBuffer, 0);
GL.DepthMask(true);
GL.Enable(EnableCap.DepthTest);

It works exactly how it's supposed to, except the quad that I draw to the screen is slightly stretched out. It's annoying the absolute heck out of me, and I have no idea what I'm doing wrong.

Edit: Picture

sentences:
Steering behaviours: collision avoidance with rectangles I'm trying to implement collision avoidance steering behaviour using rectangles. Most of the tutorials I've found are with circles, and there's a substantial difference. For example, I've been reading this:http://gamedevelopment.tutsplus.com/tutorials/understanding-steering-behaviors-collision-avoidance--gamedev-7777

My current approach: first, detect the nearest rectangle as done in the article. I create a point called ahead in front of my entity and then check if that point is inside the rectangle.
After calculating the nearest object, I decompose my rectangle in a set of points, equally spaced in the rectangle walls. My entity will flee those points.

EDIT: I've also proven to convert my rectangle in an electromagnetic repulsive rectangle with 4 bars of homogeneus charged. It didn't worked.
I also tried the "containment" section described in Craig Reynolds' website and it also didn't worked properly.

That works reasonably well: my entities try to avoid the rectangle. However, they sometimes get a bit into it, and when they're near the rectangle they start flipping to left and right quickly. That is not a very natural behaviour, so I think I want to prove another thing.

I've read this in gamedev SO: Wall avoidance steering I think that this could be what I need, approximately. However, I need some guidance on this.

First, the answer speakes about a dot product of the wall-boid vectors (let's call them WBi). Which is the another vector I have to multiply with? In the code sample is noted as partsList but I don't know what it is.
So, first question: what is this second vector?
In my opinion, this algorithm as a very important flow. If the force is exerted in the direction of normal of the wall, and by chance my entity goes with velocity normal to the wall, it will stop. This, I think, could be a rare event because more steering forces are involved...
Second question: there is a way to avoid this? Is this effect important enough to take care of it even if I have more forces?
In fact, I need an algorithm capable of detecting and avoding rectangles with steering behaviors -or, at less, a way to move my entities in a space with obstacles using something compatible with steering behaviors, because I use them for coordinate movement.

Take in account that some combinations of rectangles could create convex shapes.

EDITS:

The rectangles aren't rotated.

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:
Rendering mountains around a tile layer When making a 2D Pokémon game, I just faked elevation by putting mountain tiles underneath the land. Now my tiles are 3D models, so I'm using layer properties to define their elevation. What I don't know though is how to generate a 'mountain' around them.

The tilemap is kinda' like this:

Layer 1: Layer 2: Layer 3:
....     \\\\     \\\\
....     \..\     \\.\
....     \..\     \\\\
....     \\\\     \\\\

Layer 2 has y-offset set to 1, and Layer 3 has y-offset set to 2. All they do right now is float in the air. What I'm trying to do is render a mountain around them.

sentences:
How does layer based collision affect performance In Unity3D, and others, there are Layer Based Collision System which makes collisions only happen between specified Layers.

It defaults to all layers colliding with all others.

Does making use of these setting decrease performance, or increase performance?

I could imagine it decreases it if every potential collision had to be checked for it's layer.
Or are those collisions completely bypassed?

sentences:
Can't add inspector variables to script? So I just added this script to my project : https://www.assetstore.unity3d.com/en/#!/content/11278 Since this script only draws the lines on gizmos, I wanted to add a LineRenderer, so that I can draw the lines also in GameView. So I simply wrote :

public LineRenderer lr;

But this variable never appears in my inspector, can anybody explain me why this happens and how I could fix it?

sentences:
Interpolation using cubic Bezier curves I am trying to create an interpolate function for an animation library to achieve a tweening effect between frames.

I want this to work with Bezier curves. I have created a jsFiddle (here) of my progress so far.

I am trying to create a linear tween using this bezier definition:

{
    p0: new Vector(0,0), //Start point
    p1: new Vector(0,0), //Control point 1
    p2: new Vector(1,1), //Control point 2
    p3: new Vector(1,1)  //End point
}

I have implemented the interpolation function from this tutorial.

var u = 1 - t;
var tt = t*t;
var uu = u*u;
var uuu = uu * u;
var ttt = tt * t;

var p = p0.multiply(uuu);
p = p.add(p1.multiply(3 * uu * t));
p = p.add(p2.multiply(3 * u * tt));
p = p.add(p3.multiply(ttt));

The problem I am having is that when I run the function, the animation does not appear to be linear, but rather like 'ease-in-out'.

Ideally I would like the linear animation to work the same as this CSS transition.

Can anybody see why it is not animating in a linear fashion?

sentences:
Dealing with AI in a simple strategy game Hi I am currently working on a small real-time strategy game.

The game consists in discovering and exploring planets to get knowledge and resource points. Every Unit of Time (UoT) in the game those points are adjusted based on a various factors. Basically the more planets you have explored the more points are generated, yet the more planets you get the greater the expenses per UoT, so it is a balance. There are a variety of planet types, some which allow to discover planets in a greater area, but produce little points, whilst others produce a lot of points. The longer the players lasts before running out of resource points and the more planets they explore the higher their score is.

I kind of got a decent game at the moment, but I wanted to add an AI to have other explorers competing against the player. I don't really know how to handle it.

So far my thoughts are to add weights to various parameters (like the number of points provided by each planet, the cost in points to explore it, the fact that it has been already explored, etc...). Those weights would be adjusted based on a variety of conditions, say if the player resource points drop below x then the weight attributed to the number of resource points provided would be greater than that of knowledge points.

I was wondering if anyone had any thoughts on this, is it likely that I'm going to get myself tangled in all of it if I do it this way.

Also one important thing to note is that the game space is randomly generated, i.e every time a UoT passes or an explorer explores a planet there is a chance that 2 new planets are being randomly generated. Which means I can't really use methods which are based on calculating a few turns ahead to make the best decision.

Finally, the game is relatively peaceful, I don't have a combat system, and the only risk of exploring a planet already explored by another explorer would be that, if that explorer is nearby, he might just re-explore it as soon as you have left meaning you have spent valuable resource points for no benefits, since all the point generation will go to the most recent explorer.

sentences:
How can i collide two bodies without filtering(collision filtering)? I have two bodies with fixtures. One is platform or ground and other is the player itself.I want to collide the player to the platform without bit filtering.How can i do that?I can see the rectangular ghost layer(like a rectangular box) and the box2d falling through it.I want the box2d to collide.

create player

sentences:
Object automatic create new with old every time when load / save game.? My problem with this DontDestroyOnLoad(cube.gameObject); When I load my player position its create new object with default and saved position respectively. I have a screen shot for better understand.

First scene without save

Second scene with save game.

Here is my code.

using UnityEngine;
using System.Collections;
using UnityEngine.UI;
using System;
using System.IO;
using System.Runtime.Serialization.Formatters.Binary;
using UnityEngine.SceneManagement;
using System.Collections.Generic;

public class Player : MonoBehaviour {

public static float speed;
//public static Player control;
public float moveSpeed = 10f;
public float turnSpeed = 50f;
public Transform cube;
public float x, y, z,x1 ,y1, z1;
public int s;

//public static List<Game> savedGames = new List<Game>();
public static Player Instance;
// Use this for initialization

// Update is called once per frame

void OnTriggerEnter(Collider other) {

    if(other.tag == "Player1"){
        DontDestroyOnLoad(cube.gameObject);
        //DontDestroyOnLoad (other.gameObject);
    }
}

void Awake ()
{

    if (Instance == null) {
        DontDestroyOnLoad (this.gameObject);

    } else {
        DestroyObject(gameObject);
    }
}

public void Start () {
    speed = 50f;
}

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

    if(Input.GetKey(KeyCode.W))
        transform.Translate(Vector3.forward * moveSpeed * Time.deltaTime);

    if(Input.GetKey(KeyCode.S))
        transform.Translate(-Vector3.forward * moveSpeed * Time.deltaTime);

    if(Input.GetKey(KeyCode.A))
        transform.Rotate(Vector3.up, -turnSpeed * Time.deltaTime);

    if(Input.GetKey(KeyCode.D))
        transform.Rotate(Vector3.up, turnSpeed * Time.deltaTime);

    }

public  void Save(){

    //Player.savedGames.Add ();
    BinaryFormatter bf = new BinaryFormatter ();
    FileStream fs = File.Create ("D:/playerinfo3.txt");

    playerData pd = new playerData ();
    PlayerPrefs.SetInt ("currentscenesave",SceneManager.GetActiveScene().buildIndex);

    PlayerPrefs.SetFloat ("cubeposx",cube.position.x);
    PlayerPrefs.SetFloat ("cubeposy",cube.position.y);
    PlayerPrefs.SetFloat ("cubeposz",cube.position.z);
    PlayerPrefs.SetFloat ("cuberotx",cube.eulerAngles.x);
    PlayerPrefs.SetFloat ("cuberoty",cube.eulerAngles.y);
    PlayerPrefs.SetFloat ("cuberotz",cube.eulerAngles.z);

    pd.x = PlayerPrefs.GetFloat ("cubeposx");
    pd.y = PlayerPrefs.GetFloat ("cubeposy");
    pd.z = PlayerPrefs.GetFloat ("cubeposz");
    pd.x1 = PlayerPrefs.GetFloat ("cuberotx");
    pd.y1 = PlayerPrefs.GetFloat ("cuberoty");
    pd.z1 = PlayerPrefs.GetFloat ("cuberotz");
    pd.s = PlayerPrefs.GetInt ("currentscenesave");

    SceneManager.LoadScene (pd.s);
    bf.Serialize (fs,pd);
    fs.Close ();

}

  public void Load(){
    //transform.position = new Vector3 (PlayerPrefs.GetFloat ("cubeposx"), PlayerPrefs.GetFloat ("cubeposy"), PlayerPrefs.GetFloat ("cubeposz"));
    if(File.Exists("D:/playerinfo3.txt"))
    {

        BinaryFormatter bf = new BinaryFormatter ();
        FileStream fs = File.Open ("D:/playerinfo3.txt",FileMode.Open);
        playerData pd = (playerData)bf.Deserialize (fs);
        pd.x  = PlayerPrefs.GetFloat ("cubeposx");
        pd.y = PlayerPrefs.GetFloat ("cubeposy");
        pd.z = PlayerPrefs.GetFloat ("cubeposz");
        pd.x1 = PlayerPrefs.GetFloat ("cuberotx");
        pd.y1 = PlayerPrefs.GetFloat ("cuberoty");
        pd.z1 = PlayerPrefs.GetFloat ("cuberotz");
        fs.Close ();
        SceneManager.LoadScene (PlayerPrefs.GetInt ("currentscenesave"));
        cube.position = new Vector3 (pd.x,pd.y,pd.z);
        cube.rotation = Quaternion.Euler (pd.x1,pd.y1,pd.z1);

        Debug.Log ("currentscenesave"+ " "+ pd.s);
        Debug.Log ("currentscenesave"+ " "+ pd.x);
        Debug.Log ("currentscenesave"+ " "+ pd.y);
        Debug.Log ("currentscenesave"+ " "+ pd.z);
    }

  }

  [Serializable]
  class playerData{

    public float x, y, z;
    public float x1, y1, z1;
    public int s;

 }

}

sentences:
Social Network Gaming on Windows, Linux and OS X I'm working on mobile platforms as Android, IOS... Many users of Moblox ask us a windows and an OS X version.
There is no difficulties to provide these versions, because we are developing on OS X C++ code but we miss global scores and social network part (facebook, twitter). Is there any library to implement these functions on Desktops plaforms ?

On mobile platforms, we have many SDK to provide theses functions as OpenFeint, ScoreLoop, Plus+. We have used cocoslive and uploaded scores with libcurl but it's very limited.

sentences:
What is going on in this SAT/vector projection code? I'm looking at the example XNA SAT collision code presented here:

http://www.xnadevelopment.com/tutorials/rotatedrectanglecollisions/rotatedrectanglecollisions.shtml

See the following code:

private int GenerateScalar(Vector2 theRectangleCorner, Vector2 theAxis)
{
    //Using the formula for Vector projection. Take the corner being passed in
    //and project it onto the given Axis
    float aNumerator = (theRectangleCorner.X * theAxis.X) + (theRectangleCorner.Y * theAxis.Y);
    float aDenominator = (theAxis.X * theAxis.X) + (theAxis.Y * theAxis.Y);
    float aDivisionResult = aNumerator / aDenominator;
    Vector2 aCornerProjected = new Vector2(aDivisionResult * theAxis.X, aDivisionResult * theAxis.Y);

    //Now that we have our projected Vector, calculate a scalar of that projection
    //that can be used to more easily do comparisons
    float aScalar = (theAxis.X * aCornerProjected.X) + (theAxis.Y * aCornerProjected.Y);
    return (int)aScalar;
}

I think the problems I'm having with this come mostly from translating physics concepts into data structures. For example, earlier in the code there is a calculation of the axes to be used, and these are stored as Vector2, and they are found by subtracting one point from another, however these points are also stored as Vector2s. So are the axes being stored as slopes in a single Vector2?

Next, what exactly does the Vector2 produced by the vector projection code represent? That is, I know it represents the projected vector, but as it pertains to a Vector2, what does this represent? A point on a line?

Finally, what does the scalar at the end actually represent? It's fine to tell me that you're getting a scalar value of the projected vector, but none of the information I can find online seems to tell me about a scalar of a vector as it's used in this context. I don't see angles or magnitudes with these vectors so I'm a little disoriented when it comes to thinking in terms of physics. If this final scalar calculation is just a dot product, how is that directly applicable to SAT from here on? Is this what I use to calculate maximum/minimum values for overlap? I guess I'm just having trouble figuring out exactly what the dot product is representing in this particular context.

Clearly I'm not quite up to date on my elementary physics, but any explanations would be greatly appreciated.

sentences:
Strange Light Angles in Unity I'm quite sure that I'm missing something very simple here, but I'm a complete Unity noob and I absolutely can't figure out what I'm seeing.

I'm trying to light a sphere from both sides, perpendicular to the camera angle, to create an effect where each side of the sphere is illuminated but there's a strip of darkness down the center. Instead, I'm getting really weird angles from the two lights.

My setup (I've quintuple checked all numbers)...

A single sphere (textured like Mars) at position (0, 0, 0).
An orthographic camera pointed at it from position (0, 0, -20) and rotation (0, 0, 0).
Two Point lights at (-5, 0, 0) and (5, 0, 0), with the same intensity and all other light settings.

By my understanding, that should position each light equidistant from the sphere, exactly on either side from the camera's POV. Sort of like a capital " T " configuration. In theory their shine on the sphere should be mirrored on each side, complimentary angles toward the sphere from exactly horizontal. Instead, I'm getting this:

Left Light...

Right Light...

So, instead of being horizontal and mirrored, it appears as though the Right Light is significantly closer to the camera than the Left Light along the Z axis, and they both seem to be somewhat below the vertical center of the sphere (despite all elements having a Y value of zero).

Even weirder, viewing it in the Scene panel from above, there's a spiral pattern of darkness when both lights are on, rather than a single dark band between them...

Can someone help me out here? Does Unity handle perspective in a way I'm not getting, or have I messed up my arrangement of elements? And aside from eyeballing it, what positions should I use to create the effect I'm going for?

sentences:
Do open world games need less backstory? I've played a few open-world games and really enjoyed them, though the ones I've really enjoyed have generally received complaints about how little story there is to them.

The Saboteur is one example of this. Fully open-world, good enough story (for me, anyway), engaging gameplay, and still has received complaints in reviews about not having enough story.

Do open-world games actually need a full, all-encompassing story? Or can fun and engaging gameplay fill in the gap and let the designer get away with a slightly less complete story?

sentences:
How do engines like Unreal relate to OpenGL or DirectX? I'm completely new to computer graphics, and even more so, to game development. I am searching for information to learn the basics, quickly. I have one question in my head; how do engines like the Crytek Engine or the Unreal Engine relate to OpenGL or DirectX?

I'm very interested in game physics, but I can't figure out how the physics, graphics, and engine come together; there are gaps I can not fill.

sentences:
How to select coordinate position within uv texture in a shader - Unity first of all I'm sorry for asking noob-ish question. This is my fifth day trying to make a shader in Unity.

I'm trying to select an area within my UV image as shown below

and here's how it looks like on the mesh

Basically I'm only selecting the red from the UV and apply it to the mesh. I encountered no problem when trying to select from the RGB, but when i try to use the XYZ for the coordinate position, it turns out that the value of x and r is the same, so is y and g, and z and b.

My question is, how to select by the coordinate position in the UV texture?

Thanks.

here's my code :

    Shader "Custom/ASK RGB" {
    Properties {
        _tex ("Tex", 2D) = "white" {}
    }
    SubShader {
        Tags { "RenderType"="Opaque" }
        LOD 200

        CGPROGRAM
        #pragma surface surf Lambert

        sampler2D _tex;

        struct Input {
            float2 uv2_tex : TEXCOORD1;
            float4 pos : TEXCOORD1;
        };

        void surf (Input IN, inout SurfaceOutput o) {
            // my variable used to store the UV texture mentioned
            half4 tex = tex2D (_tex, IN.uv2_tex.xy);

            // my attempt to use position which doesn't work
            half4 texPos = half4(IN.pos);

            half4 tryUV = tex2D(_tex, IN.uv2_tex.xy);

            tex.a = 1 - tex.b - tex.r - tex.g;

            tryUV.a = tex.r;

            o.Albedo = tryUV.rgb * tryUV.a;
        }
        ENDCG
    }
    FallBack "Diffuse"
}

sentences:
Finding equivalent axial coordinates for a wrapping hexagonal map of radius n I'm creating a wrap around hexagonal map that will potentially render infinatly.

With the method I'm using, I have an x-y coordinate I use to find it's equivalent axial coordinate with the equations:
Q = (sqrt(3)/3 * x - 1./3 * y) / hexSize;
R = (2./3 * y) / hexSize;
the problem is, my map is of radius n and it's possible for the Q R coordinate to be far outside that radius. How can I find the equivalent Q-R coordinate within the radius n? I know methods for a single radius outside, but I'm talking the potential of having a radius of 15 but a Q-R something like (9999999,99999999). What would that coordinate be in relation to the center of the 15 radius hex region it'd be in?

sentences:
Actors with multiple Textures - class Hierarchy? In my 2D side-scroller game I have a bunch of actors being drawn, each of which has a single, non-animated Texture (a png image). These actors all inherit from a base GameActor class.

I want to add some more NPC's (e.g. tanks or cannons) that have one texture that doesn't move (the base) and another that rotates to shoot at things (the gun / barrel). How should I structure my Actor class hierarchy so as to allow for this? Should I refactor my base Actor class to allow for N textures? Or should I create a brand new sort of Actor for things that need > 1 texture (and then have to manage these actors separately from 'regular' actors)? Or is there a better approach I can't see?

Thus far I've been opting to keep things as simple as possible (KISS, right?), but am not sure how to proceed.

Any pointers greatly appreciated.

sentences:
Greenfoot java.lang.IndexOutOfBoundsException: Index: 0, Size: 0 When an enemy comes into contact with the hero the hero class is supposed to remove the enemy class with the same X and Y. It works the first time but throws an error immediately after that:

  java.lang.IndexOutOfBoundsException: Index: 0, Size: 0
          at java.util.ArrayList.rangeCheck(ArrayList.java:653)
          at java.util.ArrayList.get(ArrayList.java:429)
          at Hero.checkCollision(Hero.java:39)
          at Hero.act(Hero.java:23)

public void act()
{
    ...
    checkCollision();
    ...
}
private void checkCollision()
{
    Actor 2 = (Actor)getWorld().getObjects(2.class).get(0);
    if(2.getX() == getX() & 2.getY() == getY()) {
        getWorld().removeObject(2);
    }
    Actor 1 = (Actor)getWorld().getObjects(1.class).get(0);
    if(1.getX() == getX() & 1.getY() == getY()) {
        getWorld().removeObject(1);
    }
    Actor 3 = (Actor)getWorld().getObjects(3.class).get(0);
    if(3.getX() == getX() & 3.getY() == getY()) {
        getWorld().removeObject(3);
    }
      if (Room.totalPeeps == 0) {
          setLocation(250,250);
          GreenfootImage img = getImage();
          img.setFont(img.getFont().deriveFont(30f));
          setImage(new GreenfootImage("YOU WIN!!" , 75, Color.WHITE, Color.BLACK));
          Greenfoot.stop();
    }
}

sentences: World border in World composition A question. In World Composition there is such a border of the world. As I understand it, everything that goes beyond its limits is destroyed, but is there an option to evade it?

sentences: An error comes up in console when trying to enter play mode in unity Hay folks, i pray for everyone's wellbeing. I want to ask a question that whenever i enter playmode in unity, error message is displayed even though there is nothing in the console. This doesn't get fixed even after restarting unity. Any help would be great.

sentences:
Do realtime reflection probes and precomputed GI work on iOS in Unity 5? Seems they don't from my tests but just to double check.
My setup is made up of a few objects marked as static, all sharing a standard shader material with some emissive color,  GI set only to precompute and a realtime reflection probe (set to render on every frame) attached to the player, which is the object that moves and passes near the emissive objects. The player has a metallic material, also standard shader-based.

In the editor, this generates reflections on the player as it passes near an emissive object, as you'd expect.

On iOS, the player looks dull, very dark, and no reflections appear on its surface.

I also tried setting instead the probe to Custom and tell it to render from within a script, since I can't just pre-bake the probes, because the static objects are brought in at runtime. This doesn't seem to work either: the probe doesn't seem to render anything.

Any ideas?

sentences: Is it legal to publish a Noughts and crosses (tic-tac-toe) game? Is it be legal to publish a Noughts and crosses game?

sentences:
How can cooperation be encouraged in and after a game jam? The trouble is that with game jams sometimes loads of people participate, but at the end they say "Right! Bye!" and you never hear from them again. If a cooperative element was introduced, the reward from the jam would not only be a game, but a new friend to create games with.

How do you go around implementing such a design without causing lots of people to drop out?

sentences:
Box selecting (checking if rect contains selectable objects) I'm trying to get a simple RTS-style box or drag select to work. Right now, the drawing of the rectangle works properly. I'm using OnGUI, and understand why one should generally avoid it, but I'll change it at some point. Currently, I'm interested in how to test to see if there are any selectable objects "contained" in the drawn rectangle using rect.Contains.

I have a simple script that transforms positions from world space to screen space.

public Vector2 screenCoordinates;

void Awake()
{
    screenCoordinates = Camera.main.WorldToScreenPoint(transform.position);
}

Then, here is the script which I want to attach to a Game Manager object.

public class BoxSelection : MonoBehaviour
{
    Vector2 boxStartPos;
    Vector2 boxEndPos;
    Rect selectionArea;
    public Texture texture;

    List<GameObject> selectableObjects;

    void Awake()
    {
        selectableObjects = new List<GameObject>();
    }

    void Update()
    {
        // if left mouse button is being clicked or held down
        if (Input.GetMouseButton(0))
        {
            // called on the first update in which the left mouse button is clicked
            if (Input.GetMouseButtonDown(0))
            {
                boxStartPos = Input.mousePosition;
            }
            // called on all other updates in which the left mouse button is held down
            else
            {
                boxEndPos = Input.mousePosition;
            }

            selectionArea = new Rect(boxStartPos.x, Screen.height - boxStartPos.y,
                                     boxEndPos.x - boxStartPos.x, -1 * ((Screen.height - boxStartPos.y) - (Screen.height - boxEndPos.y)));
        }
        // if left mouse button is neither being clicked nor held down
        else
        {
            // handle unit selection

            //if (selectionArea.Contains(*the screenpoint of selectable object*, true))
            //{
            //  add it to a list, activate that object's selection indicator... etc
            //}

            // Reset box positions
            boxStartPos = Vector2.zero;
            boxEndPos = Vector2.zero;
        }
    }

    void OnGUI()
    {
        // if box positions are not zero
        if (boxStartPos != Vector2.zero && boxEndPos != Vector2.zero)
        {
            Color textureColor = GUI.color;
            textureColor.a = 0.25f;
            GUI.color = textureColor;

            GUI.DrawTexture(selectionArea, texture);
        }
    }
}

The part under which I've commented "handle unit selection" is what I'm struggling with. I've written it in pseudocode I guess, but I'm not sure what the actual code should look like. Each object knows it's screen position since the simple screen point script is attached to them. But, the BoxSelection script doesn't have the references for which objects to test. Should I be doing this on a script attached to the selectable objects?

Thanks

sentences: Should I render with mipmaps? The game I'm working on is very simple. It's a top down scroller. The camera never moves in any way, and all of the objects are in the same location on the Z axis. Since it's a bullet hell game, there are a lot of models on the screen at any given time. That being said, when I call RenderTarget2D, should I set mipmaps to true or false? I haven't noticed any difference at all so far either way.

sentences:
Saving a high score and updating it as score increases I'm following Brackeys "Dodge the Blocks" tutorial. In the video, he covered everything accept the score/high score system.

I have a working score system, which gives you 1 point every time you collect a coin.

In the scene where you play the game, I have a text UI that says "Score:", and another one for the score number, another that says "Best:", and one more for the best number.

I want to make it so that your high score gets saved, and updates in real-time with your score every time you pass the score.

Here are some of the scripts:

UI Manager (Where I want to put the high score code):

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

public class UIManager : MonoBehaviour {

    public Text scoreText;
    int score;

    public static int coinAmount;
    void OnTriggerEnter2D(Collider2D col)
    {
    CoinTextScript.coinAmount += 1;
        Destroy (gameObject);
    }

    public void scoreUpdate()
    {
        score++;
    }
}

Coin Text Script:

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

public class CoinTextScript : MonoBehaviour {

    Text text;
    Text bestScoreText;
    public static int coinAmount;
    public int score;

    void Start()
    {
        text = GetComponent<Text> ();
    }

    void Update()
    {
        text.text = coinAmount.ToString();
    }
}

sentences:
Setting Camera's Viewing parameters manually I am working on Context-aware camera in Unity. in this project i have to set parameters of the camera each frame manually depending on what camera sees on the screen. New View (v) direction is given and Up (u) and Right (r) vectors should be such that they minimize torsion with previous frame's u and r. I have deployed the following code to accomplish the given task:

 Vector3 viewNew = -m_Normal;
 Vector3upNew=Vector3.Cross(viewNew,m_CameraPrevTransform.right).normalized;
 Vector3 rightNew = Vector3.Cross(viewNew, upNew).normalized;
         ...
 transform.forward = viewNew;
 transform.up = upNew;
 transform.right = rightNew;

The problem is: it seems like Unity tries to automatically adjust parameters when one of the directions (up, forward, right ) are set. Is there a workaround ? is it possible to get more control of the camera?

sentences:
How can AI compute movement in 2D games I know how to create a basic AI for a game, where the AI simple creates units that only march forward. The AI only decides when to create a new unit, taking into account a number of considerations.

But now, I'm working on a game where the user controls a spaceship that can move in any of 8 directions (up, down, left, right, and any of the 4 diagonals).

The user is battling another spaceship that moves in the same way. The spaceships can shoot missiles. The missiles fly in the direction the shooting-spaceship is facing.

I need to program the AI, but have no idea how to make such an AI. Could you give me some general direction on how to make an AI that computes it's movements on the screen?

I have some very general idea, I would also like to know if this is somehow a decent direction:

The AI ship always tries to get inside a specific radius from the user's ship. Once it does, it moves up, down, left, or right to a point where it will be able to hit it's opponent. Then it shoots a missile in the direction of the user's ship.

Is this a decent direction? Any ideas or places where I can get started learning these things? My main concern is how the AI will compute it's movements.\

EDIT: Both the enemy ship and the player's ship can face any direction.

Thanks

sentences:
Computer animation in C++ and if it can be integrated in web designes I have a PhD in Mathematics with some experience in C++ programming. I am very interested in computer animation, and would like to try to teach myself in C++.

My humble resources at the moment are: Borland Builder 6 and a Toshiba laptop with 1.49 GG of ram and a maths co-processor. Please give me as generous advise as you can, detailing what resources are essential, and if at all possible give me some idea of cost.

Finally, is it possible to integrate animation created in C++ in web design?

Thank you in advance for your help.

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:
Writing a Master's Thesis on evaluating visual scripting systems I am thinking to write my Master's thesis around theorizing, and then implementing a PlayMaker or Kismet-like (building game logic by visually arranging FSMs) tool in Unity. The only thing I am still concerned about is the actual research question that I should pose.

I was kinda hoping that the more experienced game designers out there might know.

Update:
What about reducing the use of visual programming to graphically designing FSM-Action-Transition flows, which can then be attached to game entities (very much like http://playmaker.com does it)?

Update 2:
Regarding the evaluation of the approach: I was thinking that it would not be so practical to try to quantitatively prove that my tool is better than the competition. This is in fact not the essence of the thesis. The problem that I see myself trying to solve is more of the type of "how do we prove that the approach is easy to pickup and learn from people without specific programming knowledge"
I could build a "test sandbox" - an unfinished puzzle level that each of the test subjects is supposed to complete by following a number of certain tasks. The taks will vary from simply  adding a missing transition between two states, through correcting intentional mistakes in the logic, to designing entire state machines on one'e own. The evaluation will then be done based on the completion of the tasks.

sentences:
2d ParticleSystem batching problem I have multiple ParticleSystems with TextureSheetAnimation pointing to the same texture, using different offsets/rows to choose different textures.

They seem to batch with each other, but they're also being split by Unity into multiple batches in a strange manner.

Here's a Frame Debugger view:

These 4 Draw Dynamic are on the same atlas, using Mobile/ParticlesAdditive shader.

The reason of breaking batching is:

  Objects have different batching keys. This is usually caused by using
  different vertex streams on ParticleSystems or by mixing Lines and
  Trails, or by mixing lit and unlit geometry.

All of the ParticleSystems have a simple setup, some Color Over Lifetime, some Velocity Over Lifetime etc.

The strange thing is that Unity breaks batching like it makes one batch, puts half of the stars and half of the smokes into that, and then, makes another batch from these two.

So they do batch, and the don't o.O

I couldn't find and help on the web about this issue.
I'd be glad for help.

sentences:
Which Pathfinding Algorithm is Best For My Case? I'm creating a top-down space shooter game where there is no real "map" per say since there is no real terrain, but there are obstacles in the form of asteroids, other ships and a few circular structures, but nothing like a maze where an AI would need to find a path to get out of -more like things an AI doesn't want to collide with.

I want my AI to navigate around these objects. However, as you may have guessed, asteroids and ships aren't static, they have a scale and a velocity and can be destroyed. What's the best algorithm/method to use for navigating around moving obstacles in open space?

For context, my AI ships have a waypoint at all times that determines where they want to move to. Basically what I'm asking for is a way to ensure that if an asteroid or other ship were to fly in front of my ships as they fly toward their waypoint that the ship would make some effort to avoid it. Currently they just keep ramming into them and dying :(

sentences:
Unity particles rendering on top of camera space UI I'm using LWRP in Unity 2019.1.12f1. The UI is in Screen Space - Camera. The shader used for the particles is Lightweight Render Pipeline/Particles/Unlit (Transparent, Premultiply).

Any ideas?

sentences:
Android developer/publisher royalty sharing I am creating and Android game, and will need to partner with a publisher. I am curious about how this is typically implemented. Probably publishers are going to have a difficult time trusting some developer that they don't know to pay them, assuming the develop puts the game up on Google Play. So will the publisher want the apk file so that they can put it up on Google Play themselves?
Or does Google Play have a mechanism where the royalties can be automatically split between two parties from sales/IAP?
I know that all contracts will be different and it will depend, but I'm just looking to get a general idea of what is usual/typical.

sentences:
Fixed-Function vs Shaders: Which for beginner? I'm currently going to college for computer science. Although I do plan on utilizing an existing engine at some point to create a small game, my aim right now is towards learning the fundamentals: namely, 3D programming. I've already done some research regarding the choice between DirectX and OpenGL, and the general sentiment that came out of that was that whether you choose OpenGL or DirectX as your training-wheels platform, a lot of the knowledge is transferrable to the other platform. Therefore, since OpenGL is supported by more systems (probably a silly reason to choose what to learn), I decided that I'm going to learn OpenGL first.

After I made this decision to learn OpenGL, I did some more research and found out about a dichotomy that I was somehow unaware of all this time: fixed-function OpenGL vs. modern programmable shader-based OpenGL. At first, I thought it was an obvious choice that I should choose to learn shader-based OpenGL since that's what's most commonly used in the industry today. However, I then stumbled upon the very popular Learning Modern 3D Graphics Programming by Jason L. McKesson, located here: http://www.arcsynthesis.org/gltut/

I read through the introductory bits, and in the "About This Book" section, the author states:

  "First, much of what is learned with this approach must be inevitably
  abandoned when the user encounters a graphics problem that must be
  solved with programmability. Programmability wipes out almost all of
  the fixed function pipeline, so the knowledge does not easily
  transfer."

yet at the same time also makes the case that fixed-functionality provides an easier, more immediate learning curve for beginners by stating:

  "It is generally considered easiest to teach neophyte graphics
  programmers using the fixed function pipeline."

Naturally, you can see why I might be conflicted about which paradigm to learn: Do I spend a lot of time learning (and then later unlearning) the ways of fixed-functionality, or do I choose to start out with shaders? My primary concern is that modern programmable shaders somehow require the programmer to already understand the fixed-function pipeline, but I doubt that's the case.

TL;DR = As an aspiring game graphics programmer, is it in my best interest to learn 3D programming through fixed-functionality or modern shader-based programming?

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:
Trouble referencing a bone transform in Unity. (Using MakeHuman armature / configured in Avatar ok / Anim mocaps working ok)) I've seen that the bones are Transforms. And i've tried copying many examples. The armature is the standard MakeHuman one and is unchanged. It imported to Unity fine and the mocap animations work perfectly. What I need to do is make the hand a parent of my gun .

Here is what I have currently (I have tried many similar permutations):

    Transform handR;
public GameObject gunPrefab;
GameObject gun;

private void Start()
{
    rb = GetComponent<Rigidbody>();
    playerAnims = GetComponentInChildren<PlayerAnimations>();
    absoluteGround = rb.transform.position.y;
    distToGround = GetComponent<Collider>().bounds.extents.y;
    handR = transform.Find("hand_r");
    Debug.Log("handR really is: " + handR);

    gun = GameObject.Instantiate(gunPrefab);
    gun.transform.SetParent(handR);
    //gun.transform.position = handR.position;
    gun.transform.rotation = Quaternion.identity;
}

The end result of this: The gun will spawn but isnt parented to anything. And if I try to set its position using handR.position then i get null exception. Pic above shows the image where I see its called "hand_r"

One more thing of note: The bones shown in the image above , do NOT appear in the hierarchy. I have on occasion imported models with the bones included whose bone names all appear in the hierarchy - could this be the reason Unity is finding "hand_r"??? and if so whats the best way to fix that (Please done say remove the armature and make my own in Blender !! :O )

PS: I have since tried it with a new model, made in Blender with a Rigify rig. The code part "handR = transform.Find("hand_R"); -yes the rigify rig names it with capital "R". Still doesnt work, BUT THERE IS A WORKAROUND I FOUND... if I make the Transform handR public and drag it into the Inspector it all works fine! (And yes the Rigify skeleton also shows up in hierarchy!) (So if you are reading this and struggling too, DONT use the MakeHuman skeleton, use one from Blender Rigify.)

But I'm still very confused why the "Find" command doesnt find the bone

sentences:
Problem with SAT collision detection overlap checking code I'm trying to implement a script that detects whether two rotated rectangles collide for my game, using SAT (Separating Axis Theorem). I used the method explained in the following article for my implementation in Google Dart.

2D Rotated Rectangle Collision

I tried to implement this code into my game. Basically from what I understood was that I have two rectangles, these two rectangles can produce four axis (two per rectangle) by subtracting adjacent corner coordinates.

Then all the corners from both rectangles need to be projected onto each axis, then multiplying the coordinates of the projection by the axis coordinates (point.x*axis.x+point.y*axis.y) to make a scalar value and checking whether the range of both the rectangle's projections overlap. When all the axis have overlapping projections, there's a collision.

First of all, I'm wondering whether my comprehension about this algorithm is correct. If so I'd like to get some pointers in where my implementation (written in Dart, which is very readable for people comfortable with C-syntax) goes wrong.

Thanks!

EDIT:
The question has been solved. For those interested in the working implementation: Click here

sentences:
Unity Event Register / Deregister and Scene Unload From what I understand in C#, normally when you register an event, it maintains a reference to the object of the containing method, so in order for garbage collection to pick up an object, you need to first deregister it.
My question:  In unity when one scene is loaded and another is unloaded, do I need to first clean up and deregister any registered events, or does the scene unload process destroy objects and remaining references?

sentences:
Mental Image of the engine behind an RTS like SimCity/Settlers, what is it? Disclaimer: I'm first a programmer and then an RTS gamer. This means I'm a complete and utter newb in terms of patterns, best practices and glossary of technical terms on the game dev world.

Since I was a kid that most of my electric/electronic toys were always taken apart to learn how they were made and most of the pieces were stored for future use.
This gave me a VERY curious mind in terms of: How does it work?

I've started planning/scribbling for more RTS games than the market has dished out, but never got around to implement any of them due to the lack of basic knowledge about Game Devel.

So what I'm asking is that someone could point me in the direction of the engine schematics of an RTS game like SimCity/Civ/Settlers. Something that will assume a bit of programming background but will introduce the terms used for programming a RTS base game.

How do they do the Unit Manager? Is it called this way?
Is creating a complex multi threading system wise?
Should I use multi-threading just for groups of units?

Well, I think you get the picture of how newb I am ;)

Many thanks in advance.

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:
Copyrights and Usage of 3rd Party Intellectual Property I develop a game for a mobile platform. I would like to implement a movie figure/creature/character/vehicle into the game.

I wish to ask about Copyrights:

Is it acceptable, if I implement famous movie-like creatures (ex: Alien, Predator, Star Ship vehicle) into my game? Occasionally, I see games based on movies: "Star Trek, Star Wars, James Bond, etc..". If I wish to create a game based on successful movie, do I have to obtain approval?

What about songs? If I legaly purchase a CD in the store, can I use the song into my game?

Are there any conditions, under which I can use movie-like characters in my game? For example, if the game is going to be shareware/freeware, if the reneues does not exceed certain amount, or if some percentage of the original character look is modified?

sentences: OpenGL/GLSL/LWJGL return value from shader I'm trying to do some bone animation. I don't want the whole skeleton to be loaded to the GLSL shader every time, even tough it's not needed, because one vertex is parented to one bone, not more. My question is simple: (How) can i return some value from the vertex shader back to my code? I'm using LWJGL/Java

sentences:
Recognize hand drawn shape I want to ask player to replicate a simple shape (triangle, square, star, anything that can be done in single stroke) with mouse or on a touchscreen.

Orientation matters, size does not.
Example:

Can anyone give me directions to what techniques can be used?

sentences:
How could I get composite rigid body into unity I am developing a game, in unity, that has accurate destruction physics and from my understanding unity uses plain old rigid body physics. I was wondering if there was a way to bring composite rigid body physics into unity through a plug in or library or some other way?

Thanks, nova

edit: So composite rigid body physics is almost exact like normal rigid body physics. But the main difference is that in composite rigid body physics all of the assets will not be considered physics based objects until an outside force hits them. For example a building and all of that parts it is made out of will not be processed as physics based objects until say a rocket hits it.     This method of composite rigid body physics uses much less memory because it is only processing what is being affect and not everything else.

sentences:
How can I create a "cracked glass" material? I'm trying to figure out how the cracked and chipped glass effect in a Bioshock Infinite Burial at Sea Episode 2 works.

My current guess is that it is essentially a transparent shader with gloss. It would have a map defining the direction of reflections from the environment, with the cracks being significantly different from the mesh's normals. It would also include some kind of model of the angular dependence of the amount of refraction/transmission to reflection so that it can roughly approximate Fesnel's equations.

It doesn't appear to be a full refractive model, so I'm wondering how exactly this is implemented? Am I right with what I have said above?

sentences: Collision and response between sprites? What is an easy way to have sprites collide and react to the collision? E.g. if I'm writing a game in XNA or with Canvas 2D and need to write the code myself very simply.

sentences:
How can I compensate for camera rotation changing PCSS penumbras? I am implementing PCSS and I am using a directional light. The directional light volume is clamped to the camera frustum (as is typical with directional lights). So when the camera rotates, the directional light volume can find a tighter bound on the camera frustum in some cases, and then all of the depth values can increase/decrease.

This causes the blocker search to find different blocker distances from the light source, and so the penumbra sizes change based on the camera rotation.

Has anyone dealt with this problem before? How can I compensate for changes to the light depth map (aka shadow map) when the camera rotates?

Here are some images demonstrating two camera views, visualizing the penumbra values (brighter indicates where a larger penumbra should go) and the corresponding light depth maps (shadow maps):

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: Are completely dumb client multiplayer games feasible? Is it possible to make a networked game, where each client displays a pixel array sent to it by the server, and sends inputs back to the server? This would be much simpler to implement than using client-side prediction, but I would imagine it would be too slow. Would it be possible?

sentences:
DirectX 11, support for Font drawing I have recently started to work with DirectX 11 and 12, I am using Microsoft Visual Studio Community Edition. I am under a 64-bit machine. I am currently rendering a frame with background and a window using Windows C++ API and DirectX 11.1.
I was thinking about drawing text, but I thought about using custom Fonts, so I will have original Font file, not some graphic file e.g. *bmp or some other format. I have read about: SpriteBatch[1] and SpriteFont[2], which can be used via DirectX Tool Kit (https://github.com/microsoft/DirectXTK).
I tried:
std::unique_ptr< SpriteFont> font(new SpriteFont(device, L"text.spritefont"));
std::unique_ptr<SpriteBatch> spriteBatch(new SpriteBatch(context));
spriteBatch->Begin();
font->DrawString(spriteBatch.get(), L"Hello, ", XMFLOAT2(200,200));
spriteBatch->End();

But, I am running into some issues with the Begin() function, that seems to have mandatory parameters. I did try: Begin(SpriteSortMode:: SpriteSortMode_Deferred, nullptr, nullptr, nullptr); But, I keep experiencing the same errors in Visual Studio regarding overloading and params.
I know that DirectX 9 had D3DXFont, https://drunkenhyena.com/cgi-bin/view_cpp_article.pl?chapter=3;article=17 , I also found this: http://download.nvidia.com/developer/GPU_Gems/CD_Image/Natural_Effects/Water_Simulation/d3dfont.cpp
I also found the DXUT for Direct3D 11, https://github.com/walbourn/directx-sdk-samples/tree/master/DXUT -- but seems this is no longer active.
[1] https://github.com/microsoft/DirectXTK/wiki/SpriteBatch
[2] https://github.com/microsoft/DirectXTK/wiki/SpriteFont
EDIT #1:
With DirectX 9, I can do the following:
 HRESULT hr=D3DXCreateFont(
                     device,           //D3D Device
                     22,               //Font height
                     0,                //Font width
                     FW_NORMAL,        //Font Weight
                     1,                //MipLevels
                     false,            //Italic
                     DEFAULT_CHARSET,  //CharSet
                     OUT_DEFAULT_PRECIS, //OutputPrecision
                     ANTIALIASED_QUALITY, //Quality
                     DEFAULT_PITCH|FF_DONTCARE,//PitchAndFamily
                     "Arial",          //pFacename,
                     &font);           //ppFont

But, unfortunately this does not exist in DirectX 10, 11, or 12.

Questions:

Is using these new recommendations (SpriteBatch, SpriteFont & DirectXDTK) by Microsoft, in any way, linking the stuff I build with XNA?
Is it possible to use Font file, custom one? Or, do I have to create graphic font? (What is more recommended generally speaking)?

A book recommended writing your own Font drawer class, it uses:

ID3D11VertexShader
ID3D11PixelShader
ID3D11InputLayout
ID3D11Buffer
ID3D11ShaderResourceView
ID3DX11CreateShaderResourceViewFromFile
ID3D11SamplerState
D311_MAPPED_SUBRESOURCE
D311_MAP_WRITE_DISCARD

EDIT #2: WHY DO I HAVE TO CAST,
Microsoft::WRL::ComPtr

sentences:
How to load large arrays to gpu and render with OpenGL? I am trying to make a volumetric rendering of a cloud. I have been defining the cloud density functions on the glsl shaders and performing ray-marching methods successfully. But now I would like to render a 3D grid (100x100x100) representing the density of a cloud that I calculated using the cpu. The idea that I was trying was to make use of the storage buffer objects, but when I access the array to get the density value and render it, it doesn't work.

This is at the beginning of the glsl fragment:

#version 440 core
layout(std430, binding = 3) buffer layoutName
{
    float data_SSBO[100*100*100];
};

And the density function definition is:

float density(vec3 position, float t){
    const float dx = 1./100., dy = 1./100., dz = 1./100.;
    int i, j, k;
    if( (position.x >= 0.)&&(position.y >= 0.)&&(position.z >= 0.)&&(position.x <= 1.)&&(position.y <= 1.)&&(position.z <= 1.)){
        i = int(position.x/dx);
        j = int(position.y/dy);
        k = int(position.z/dz);

        return data_SSBO[i*100*100 + j*100 + k];
    }
    else
        return 0.;
}

And in the c code there are the buffer creation, bindings, etc:

    glGenBuffers(1, &ssbo);
    glBindBuffer(GL_SHADER_STORAGE_BUFFER, ssbo);
    glBufferData(GL_SHADER_STORAGE_BUFFER, 100*100*100*sizeof(float), grid, GL_STATIC_DRAW);
    glBufferSubData(GL_ARRAY_BUFFER, 0, 100*100*100*sizeof(float), grid);

and in the rendering function there is:

    glClearColor(1.f, 1.f, 0.f, 1.0f);

    glClear(GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT);

    glBindBuffer(GL_ARRAY_BUFFER, VBO);

    glBindBuffer(GL_SHADER_STORAGE_BUFFER, ssbo);

    glBindBufferBase(GL_SHADER_STORAGE_BUFFER, 3, ssbo);

//  glBufferSubData(GL_ARRAY_BUFFER, 0, 3*2*2*sizeof(float), buffer);

    glVertexAttribPointer(0, 2, GL_FLOAT, GL_FALSE, 2* sizeof(float), (void*)0);      // coordenadas

    glEnableVertexAttribArray(0);

    glUseProgram(shaderProgram);

I believe the problem has to do with the binding, I have been trying different combinations, like binding after and before glUseProgram, etc.
I literally have no idea what is wrong, I see this is really confusing.

sentences:
Factors to consider when building an algorithm for gun recoil What would be a good algorithm for calculating the recoil of a shooting guns cross-hairs?

What I've got now, is something like this:

Define min/max recoil based on weapon size
Generate random number of "delta" movement
Apply random value to X, Y, or both of cross-hairs (only "up" on the Y axis)
Multiply new delta based on time from the previous shot (more recoil for full-auto)

What I'm worried about is that this feels rather predicable, what other factors should one take into account when building recoil? While I'd like it to be somewhat predictable, I'd also like to keep players on their toes. I'm thinking about increasing the min/max recoil values by a large amount (relatively) and adding a weighting, so large recoils will be more rare -- it seems like a lot of effort to go into something I felt would be simple.

Maybe this is just something that needs to be fine-tuned with additional playtesting, and more playtesters? I think that it's important to note, that the recoil will be a large part of the game, and is a key factor in the game being fun/challenging or not.

sentences:
Calculate vertex coordinates Newbie here!

I need to know the effective coordinates of a triangle after applying transformations (rotations & translations) to the current (MODELVIEW) matrix.

That is, given a vertex P, I want to calculate, for instance, the new coordinates of P after a rotation of 90º on the x-axis.

How can I do that? Is it also possible to use only OpenGL matrix operations to do this?

Thanks in advance for any tips.

Edit:
The easy one is translation. I implemented it as

#define T(x, v) (x+v)

where I apply T to every coordinate of every vertex.

But what about rotation over a specific axis. Can you please give me some hint?

sentences:
Rotating Sprite around Y-Axis (2D) I'm going to be creating a game soon, and part of it involves spinning sprites. The sprites will be spinning around the Y-Axis (imagine a spinning plate on top of a stick, where the stick stands up vertically.

The main way I've thought of is to have a series of sprites for various rotation values that I blur between as the 'plate' rotates (the sprite is more complex than a plate, though).

The game will be for iPhone, but I'm open to using any 2D gave development library for it.

sentences:
Why does my 2d collision and movement not work properly? I'm trying to write(in c++ using sdl) a mario like game as in a tile based world with by pixel movement for the character and I've run into some problems I cannot seem to find the source of:

1.The player won't collide with the walls.

2.when moving through open space the player sometimes stops moving and then becomes unmovable in either direction.

I'm not sure where the problem is and I would love your help finding these issues and any advice in general is appreciated. thanks!

Here is all the code:

http://pastebin.com/FGxW2x3T
//sorry I can only post two links cause I don't have 10 rep.

Here is the collision detection function and player input/movement functions. http://pastebin.com/jWaZPDBm

sentences:
A pattern for a contextual InputState in a Game State Management architecture Context of the question :

When developing a game using Game State Management I came across a problematic when it came to handling user input : I want my game to retrieve user input a single way, but to handle it in a completely different way, depending on the context.

For example, the [Up] key will always mean "Menu Up" when you're in a menu, but if you're in the game, it might do different things, depending on the key bindings. Another difference would be, for example, that in a menu, a .5sec KeyDown on a key should be interpreted as a single command, but when you're in game, a .5sec KeyDown should often be seen as a .5sec movement / burst / charge shot / etc...

Then way I though about to achieve this result is the following :

Have an InputState class that keeps the current and previous Keyboard/Gamepad input states, just like the usual InputState class. Have this InputState class implement all the methods I would need in all the different contexts.
Create an Interface per context. For example, IMenuInputState, IGameInputState, ICutsceneInputState, etc. These interfaces would only contain the method definitions related to the context.
Have the InputState implement all the I[...]InputState interfaces. If two or more context need the same method, the same implementation would be used.
In the ScreenManager's Update method, the InputState would be Updated, but depending on which screen must handle the InputState, a different I[...]InputState would be sent. Even though the screen could access the other methods by casting the interface, only the contextual methods would directly be usable.

My question is the following : Is my idea a proper / common way of handling this issue?

If it is, could you tell me the name of that "pattern" or direct me to some online resources so I can read on that and avoid the known pitfalls. If it's not, how would you suggest I handle the problem?

Note: I know this question is borderline since the answer is partially subjective but I'd appreciate some help on this issue since I think it's a critical decision in my project.

sentences:
Pathfinding assistance Here's a quick image:

I've generated a navmesh for my game that shows how an AI can get to each of its possible neighboring tiles in a map. (I followed some gamasutra article as reference, I'll paste a link if I can find it again). You can see that it calculates all possible jump, fall, and walking connections between points.

Now that I have this, I've been researching how to actually use it. I understand that A* is generally the algorithm that people use but I haven't been able to find a resource for adapting it to a non-grid based dataset. Any articles that you know of or pseudocode would be awesome :)

sentences:
RenderTarget2D moves with scene I encountered a strange RenderTarget issue, in XNA/Monogame.

I am currently updating my render target at every frame, just to test to see what is happening.  When I move the camera around, the positioning of the drawing inside of my rendertarget moves as well.

Notice in the example, how the image moves inside of my render target:

Here is the code for the Render Target draw:

GraphicsDevice.SetRenderTarget(Render);
RoundLineManager.Draw(Branches.GetAllObjects(), new Color(102, 50, 18), Matrix.Identity * Camera.View * Camera.Projection, RoundLineManager.TechniqueNames[0]);
SpriteBatch.Begin(SpriteSortMode.BackToFront, null, null, null, null, null, Camera.View);

foreach (Pool<Leaf>.Node l in Leaves.ActiveNodes)
    if (l.Item.Visible)
        l.Item.Draw();

SpriteBatch.End();
GraphicsDevice.SetRenderTarget(null);

Here is the related Camera properties:

public Matrix View
{
    get
    {
        return Matrix.CreateTranslation(new Vector3(-_pos.X, -_pos.Y, 0)) *
                Matrix.CreateRotationZ(Rotation) *
                Matrix.CreateScale(new Vector3(Zoom, Zoom, 1)) *
                Matrix.CreateTranslation(new Vector3(ViewportWidth * 0.5f + shakeOffset.X, ViewportHeight * 0.5f + shakeOffset.Y, 0));
    }
}

public Matrix Projection
{
    get
    {
        return Matrix.CreateOrthographicOffCenter(0, Infinidrill.GraphicsDevice.Viewport.Width, Infinidrill.GraphicsDevice.Viewport.Height, 0, 0, 1);
    }
}

sentences:
Help implementing virtual d-pad Short Version:

I am trying to move a player around on a tilemap, keeping it centered on its tile, while smoothly controlling it with SneakyInput virtual Joystick. My movement is jumpy and hard to control. What's a good way to implement this?

Long Version:

I'm trying to get a tilemap based RPG "layer" working on top of cocos2d-iphone. I'm using SneakyInput as the input right now, but I've run into a bit of a snag.

Initially, I followed Steffen Itterheim's book and Ray Wenderlich's tutorial, and I got jumpy movement working. My player now moves from tile to tile, without any animation whatsoever.

So, I took it a step further. I changed my player.position to a CCMoveTo action. Combined with CCfollow, my player moves pretty smoothly. Here's the problem, though: Between each CCMoveTo, the movement stops, so there's a bit of a jumpiness introduced between movements.

To deal with that, I changed my CCmoveTo into a CCMoveBy, and instead of running it once, I decided to have it CCRepeatForever. My plan was to stop the repeating action whenever the player changed directions or released the d-pad.

However, when the movement stops, the player is not necessarily centered along the tiles, as it should be. To correctly position the player, I use a CCMoveTo and get the closest position that would put the player back into the proper position. This reintroduces an earlier problem of jumpiness between actions.

What is the correct way to implement a smooth joystick while smoothly animating the player and keeping it on the "grid" of tiles?

Edit:

It turns out that this was caused by a "Bug Fix" in the cocos2d engine.

sentences:
www.texture and www.LoadImageIntoTexture both just show red question mark I'm trying to use this code I found in the Unity docs to display a remote image on a plane.  However, no matter what URL I try, it only displays a red question mark.

using UnityEngine;
using System.Collections;

public class KnowledgeWall_WeatherMap : MonoBehaviour {

    // The source image
    //public string url = "https://radar.weather.gov/Conus/Loop/northrockies_loop.gif";

    public string url = "http://www.gstatic.com/webp/gallery/1.jpg";

    IEnumerator Start()
    {
        Texture2D tex;
        tex = new Texture2D(4, 4, TextureFormat.DXT1, false);
        using (WWW www = new WWW(url))
        {
            yield return www;
            www.LoadImageIntoTexture(tex);
            GetComponent<Renderer>().material.mainTexture = tex;
        }
    }
}

I also tried the code here, which is slightly different. It gave the same result.
Unfortunately this project is Unity 5.3.6.  How can I fix this so Unity 5 displays the remote image?

sentences:
Libgdx Get Font Height with a Wrap is possible to get the 'Height' of a font drawed with the drawWrapped methods (with a wrapWidth) ?

getMultiLineBounds only works when \n is used, but when drawing with drawWrapped it doesn't give the right Height.

Text

String text = "hello this is very lonnnnng text without new line";
float wrapWidth = 100;

Display code :

 font.drawWrapped(batch, text, x, y, wrapWidth, alignment);

My 'get the displayed height code' :

 font.getMultiLineBounds(text).height;

Output :

 hello this is very
 lonnnnng text without
 new line

Problem :

How to have the total height of the displayed text by the methods : DrawWrapped

Can you help me please ? thanks you

sentences:
How can I draw the inside of a box as well as the outside? I have a 3D box in which I have some holes. The thing is that when I look through the holes, I can't see the wall of the box that should appear as the inner wall.

How can I draw this as well?

sentences:
sharing preferences between two apps on android with libgdx I am making an android game with both a demo version and a paid version. I want users who decide to buy the paid version to continue from where they left off, with all their old data and settings.

I've set a shared user id between both applications, and now I'm wondering if it's possible to use libgdx preferences across both versions.

I am also open to other ideas on how to implement this.

sentences: How can I enable CCD in Bullet Physics? How can I enable Continuous Collision Detection (CCD) in Bullet Physics?

sentences: Are binary storage methods more efficient than text based ones? I'm working on a game which could potentially generate rather large save files, and so I'd like to find the smallest (most efficient, if you will) method of saving the game's data. I would need to save block types along with entity positions. Would a binary approach generate a smaller file than a text-based one? If so, how do I store the binary data?

sentences:
Farseer physics engine: The name 'ConvertUnits' does not exist in the current context http://digitalerr0r.wordpress.com/2012/03/11/farseer-physics-in-xna-4-0-for-windows-phone-1/

I tried this Farseer tutorial but I always get that error message in the following lines:

spriteBatch.Draw(rectangleSprite, ConvertUnits.ToDisplayUnits(rectangle.Position),
                                        null,
                                        Color.White, rectangle.Rotation, new Vector2(rectangleSprite.Width / 2.0f, rectangleSprite.Height / 2.0f), 1f,
                                        SpriteEffects.None, 0f);

        spriteBatch.Draw(rectangleSprite, ConvertUnits.ToDisplayUnits(rectangle2.Position),
                                        null,
                                        Color.White, rectangle2.Rotation, new Vector2(rectangleSprite.Width / 2.0f, rectangleSprite.Height / 2.0f), 1f,
                                        SpriteEffects.None, 0f);

        spriteBatch.Draw(rectangleSprite, ConvertUnits.ToDisplayUnits(rectangle3.Position),
                                        null,
                                        Color.White, rectangle3.Rotation, new Vector2(rectangleSprite.Width / 2.0f, rectangleSprite.Height / 2.0f), 1f,
                                        SpriteEffects.None, 0f);

What is wrong? I added the two usings to my code but I always get this error message:
The name 'ConvertUnits' does not exist in the current context

sentences:
How to select a vertex by mouse clicking in OpenGL? I'm programming a simple graph game and so far I'm still doing a few tests in OpenGL. Right now, let's say I defined a GL_POINT with the glVertex2f(20.0f, 0.0f). I have this function to calculate the coordinates from the mouse input to world coordinates:

void converterCoords(GLfloat winX, GLfloat winY){

GLint viewport[4];
GLdouble modelview[16];
GLdouble projection[16];
GLfloat winZ = 0;

glGetDoublev( GL_MODELVIEW_MATRIX, modelview );
glGetDoublev( GL_PROJECTION_MATRIX, projection );
glGetIntegerv( GL_VIEWPORT, viewport );

winX = (float)winX;
winY = (float)viewport[3] - (float)winY;
winZ = 0;

gluUnProject( winX, winY, winZ, modelview, projection, viewport, &worldX,
        &worldY, &worldZ);

}

After this I have a function to check if the mouse click coordinates are the same as one of the GL_POINTS I defined:

int determinaPosicao(double x, double y){

int i;
for(i = 0; i < nPontos; i++){
    if(pontos[i].vX == x || pontos[i].vY == y){
        pontos[i].seleccionado = 1;
    }
}

glutSetWindow(window);
glutPostRedisplay();
return 0;

}

I can check just fine if the mouse click is the same as the if condition with the "||" function, however, if I have two points with the same x or y value, then it will declare the mouse has hit both points. However, if I use the "&&" function it never seems to go into the if condition and never declares any point as having been hit.

This certainly isn't the best way to achieve my goal and I would really like to ask for some opinions on how to do this.

Solution I found with help from user concept3d:

int determinaPosicao(double x, double y){

const double maxDist = (1e0);
int i;

printf("%f\n", x);

//Escala no rato após conversão: ~5510

x = (x*xMaxRef)/10000;
y = (y*yMaxRef)/10000;

for(i = 0; i < nPontos; i++){
    if(pow((pontos[i].vX - x), 2) <= maxDist  && pow((pontos[i].vY - y), 2) <= maxDist){
        pontos[i].seleccionado = 1;
    }
}

glutSetWindow(window);
glutPostRedisplay();
return 0;

}

The operations I used in x = (x*xMaxRef)/10000 is a simple rule to scale the mouse coordinates (that range from 0 to approx 5510) from the max ortho referencial scale which is x and y = {-100, 100}

sentences:
Checking if Body is surrounded by other Bodies I'm trying to make a game like Rampart as practice. I have gotten to the point where I want to check if the castle is surrounded by walls and decide whether to fill in the area and continue the game, but I have no idea how to do this. I have thought about ray-casting from the castle but it wouldn't work if there was a bend in the walls.

So any help or suggestions would be great!

sentences:
Collisions on complex map 2D I'm currently thinking about collision and map system that I want to use in my next game and I'm kind of puzzled. Maps are going to be somewhat complex with lots of irregularities and thus tiling is out of question.

I thought about an editor where you'd draw rectangles on the map that would represent areas that are collidable with and then saving such "collision map" with only black/white gfx. Or maybe should I save exact rectangles data with their x/y/width/height into some text file and go from there?

What would you recommend? Thanks.

sentences:
Finding a specific point in a graphic model in code I'm not really sure what I'm asking, so sorry for the bad title. I'm still new to game programming and especially the "game specific parts" like models and graphics.

Let's say I have a model of a space ship. On this model there's are a couple of locations where I want to place thrusters and there's another spot for a large main thruster. I think I have most of the physics figured out. I can place thrusters at positions relative to the center of mass and the ship behaves appropriately when they're fired. Now, back to the model - how do I place my engines (in the simulation), how to get the relative X, Y and Z values from the model?

Obviously, the naive solution would be to open up the model in a modelling program and find the coordinate where I want the engines to be placed and then put those values in my database. That would mean that every time I change the model or create a new ship I'd need to redo this procedure and handle a lot of values. Surely this can't be how it's done? Is there a way to "mark" a point in a model and find that point from code? Am I missing something obvious?

I'm using C# and XNA, by the way.

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

Another example:

sentences:
Unity C# Changing Button Color? void OnMouseDown ()
{
    foreach (Button thisButton in buttonArray)
    {
        thisButton.GetComponent<SpriteRenderer>().color = Color.black;
    }

    GetComponent<SpriteRenderer>().color = Color.white;
}

This code results in whichever button I select changing color to white while the rest are black. However, I am not understanding how this works. How does it know to specifically change ONLY the selected button to white while the rest are black. Seems contradictory to me...

sentences:
Where to install game from my game launcher I've created a game launcher that I'm pretty proud of :). I use nw.js and so the interface uses html/javascript/css. It makes ajax api calls to my web service that I've written in C# to do things like register/login/news. I'm now looking at having my game launcher do the initial install of the actual game and updates.

My question is, where should the game be installed by default. I will allow them to change the location but what should the default game location be? This will be on Windows only at this time. My concern is that I've heard (and I don't know because I'm always admin on my PC) that you can run into issues if your game is in program files because of permissions.

Does anyone who has made a game launcher have experience around the downloading/copying/unzipping of game files in a game launcher?

sentences:
Possible legal pitfalls in font licensing for mobile games? As I start to look into finding a the right font for a new mobile game I'm developing, I'm noticing that license agreements for fonts are pretty varied.  Looking on advice for what pitfalls to avoid in choosing a distinctive font for a mobile game that will initially be free, but which we eventually plan to monetize.

My main concern is with a license that may not cover our intended uses, and lead to penalties.

We're willing to spend a little money in order to COA ("cover our butts")

sentences:
GPU Spatial Clustering I have a around 100k points on the screen (that might update). 2D points.

The goal is to cluster them into groups, by a constant distance. Meaning, finding groups of points that the distance between them is less than this distance. Instead of drawing those points, a big point will be drawn there with a number on it.

The problem is the calculation time.
Tried many algorithms on CPU, but didn't get the performances i wished for.

I'm trying to find an algorithm to solve this problem in the GPU using WebGL-GLSL, when texture contains all my locations.

Can be single draw phase or multiple.. as long as i achieve better calculation time than i get with the CPU.

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:
How to set blur on mouse over and remove on mouse out in AS3? How can I do it? I want to active glow when the mouse is over a Sprite and remove it when the mouse is out. Is it possible?

I have the following code:

var myGlow:GlowFilter = new GlowFilter();
myGlow.color = 0xFFFFFF;
myGlow.blurX = glowMobilha.blurY = 20;
var miniatura:MovieClip = _scene.d1[link];
miniatura.addEventListener(MouseEvent.CLICK,
                           function(e:Event):void {
                               MainSoundManager._sm.stopAllSounds();
                               GameManager.loadSection(link, false);
                           });
miniatura.addEventListener(MouseEvent.MOUSE_OVER,
                           function(e:Event):void {
                               miniatura.filters = [myGlow];
                               miniatura.gotoAndStop(2);
                               _control.visible = true;
                               _controle.gotoAndPlay(2);
                           });
miniatura.addEventListener(MouseEvent.MOUSE_OUT,
                           function(e:Event):void {
                               miniatura.gotoAndStop(1);
                               _control.visible = false;
                               _control.gotoAndStop(1);
                           });
miniatura.buttonMode = true;

I set the blur at:

miniatura.addEventListener(MouseEvent.MOUSE_OVER,
                           function(e:Event):void {
                               miniatura.filters = [myGlow];
                               miniatura.gotoAndStop(2);
                               _control.visible = true;
                               _controle.gotoAndPlay(2);
                           });

How can I "hide" the blur at:

miniatura.addEventListener(MouseEvent.MOUSE_OUT,
                           function(e:Event):void {
                               miniatura.gotoAndStop(1);
                               _control.visible = false;
                               _control.gotoAndStop(1);
                           });

UPDATE
I think I found the solution in the following code:

miniatura.addEventListener(MouseEvent.MOUSE_OVER,
                           function(e:Event):void {
                           glowMobilha.alpha = 1;
                           miniatura.filters = [glowMobilha];
                           _controle.visible = true;
                           _controle.gotoAndPlay(2);
                           });
miniatura.addEventListener(MouseEvent.MOUSE_OUT,
                             function(e:Event):void {
                             glowMobilha.alpha = 0;
                             miniatura.filters = [glowMobilha];
                             _controle.visible = false;
                             _controle.gotoAndStop(1);
                           });

is it the best solution?

sentences:
How to stop a signal from being sent Currently i have three buttons that can be toggled with only one being active at once. When one button is selected by the player it sends a signal to the other two buttons to toggle off. Before the recent Godot update this set up worked fine, but now when the player toggeles a button on, the button thats being turned off now sends its toggeled signal thus turning off the very button the player clicked.

So im looking for a way to block a signal in code to prevent this loop.

Code for reference:

Player button:

func _on_Ally1_Button_toggled(button_pressed,check):
    print("on ally1 toggeled P")
    self.set_pressed(false)

func _on_Ally2_Button_toggled(button_pressed,check):
    print("on ally2 toggeled P")
    self.set_pressed(false)

Ally1 Button:

 func _on_Player_Button_toggled(button_pressed,check):
    print("on player toggeled A1")
    self.set_pressed(false)

 func _on_Ally2_Button_toggled(button_pressed,check):
    print("on ally2 toggeled A1")
    self.set_pressed(false)

Ally2 Button:

 func _on_Player_Button_toggled(button_pressed,check):
    print("on player toggeled A2")
    self.set_pressed(false)

func _on_Ally1_Button_toggled(button_pressed,check):
    print("on ally1 toggeled A2")
    print(check)
    self.set_pressed(false)

The check varible being passed in is how i plan stop the loop i just need a way stop signal.

Thank you in advance for the help.

sentences:
Re-create 2D side-on wave effect from Worms game I'm trying to recreate the waves/water effect from Worms ( see here http://youtu.be/S6lrRqst9Z4?t=31s ) From what I understand its not actually a sprite, its procedurally generated by something like a sin wave.

Has anyone created something like this before? or any idea how I would go about it?

sentences:
Approaches to 2D Parallax In a 2D scrolling platformer, what is the most efficient way or knowing which things with parallax depth should be drawn?

The approach below describes trying to know which things are nearby so they can be udpated/drawn. The problem with working out which parallax items are nearby is that you don't know where any of them are until you calculate where they are!

Original Post

I have a 2D array Set<Thing>[][] that I use to store Things that appear on each screen in a scrolling 2D platformer. I use this to look up only Things that a near the current location being rendered, so that I don't bother updating irrelevant objects.

I translate the world coordinates, divide them by the screen size (rounding down), and can then look up all the items on that screen. For instance if screens are 320x240px, and I look up world coordinates 400,50 then 400/320 = 1 and 50/240 = 0, so I look up things[1][0] and update all the things in that entry. If any object can move, they store themselves in the right slot after moving.

Is there any way to use this same system when Things have parallax depth? IE, something with a parallax depth of 1 is infinitely far away (and so always appears at the same location in screen coordinates) and something with parallax depth of 0 is pinned to the foreground.

I'm guessing this isn't possible, as something further away than the foreground will be in more than one screen.

What other approaches are there? I've seen an experienced game developer use a 'scroll rate' instead of a parallax depth, and he moved scenery by the inverse of the distance the camera moved multiplied by this rate. In this model I could treat scenery as per any other moving item and have it store itself in adjacent entries in the 2D array when it moves, but how does it get into the 'right' array slot in the first place? IE, if it's very distant, it could be approach from either the left or the right, and I'm not to know that in advance.

I'm very confused!

sentences:
Compiling Ogre3d application using the OgreAppWizard I have created an ogre application using the ogreappwizard. When I try to compile the solution I get an error saying that Parameter "basePath" cannot be a relative path..

I followed all of the instructions, and have tried reinstalling both the Ogre SDK and the appwizard.

I am losing my head here. What is going on?

sentences:
How to implement input-texture limited alphablending of 2 textures with HLSL? I try to implement a HLSL shader the does the normal Alphablend with premultiplied colors (just as XNA4 does) but depending on some existing colors. One can think of adding a glow to a 2D terrain where the glow should only be applied to the not fully transparent parts of the terrain.

My current code is:

sampler TextureSampler1 : register(s1); // Addition (Terrain-only particles)
sampler TextureSampler2 : register(s2); // Existing (Terrain)

float4 main(float4 color : COLOR0, float2 texCoord : TEXCOORD0) : COLOR0
{
    // Look up color from partly transparent existing texture (premultipied colors)
    float4 existing = tex2D(TextureSampler2, texCoord);

    // For transparent pixels -> Color stays the same
    if ((existing.r + existing.g + existing.b + existing.a) == 0) return existing;

    // Look up color from partly transparent addition-texture (e.g. glow) (using premultipied colors) that should be added to existing color
    float4 addition = tex2D(TextureSampler1, texCoord);

    // Rescale light that is added by existing alpha
    addition.rgb *= existing.a;

    // Use this color to blend
    existing.rgb *= (1 - addition.a) + addition.rgb;

    return existing;
}

However, there still seems to be a problem with the alpha channel. Any ideas?

sentences:
Handling data logic on libgdx ai state machine or in ashley system? In this below example, I've combined libgdx ashley and AI state machine. Do you think it's a good idea to handle the logic in state machine or stick on handling the data logic on System?

public enum TrollState implements State<Entity> {
     MOVE_AWAY() {
         @Override
         public void enter(Entity entity) {

         }

         @Override
         public void update(Entity entity) {
              PositionComponent position = Mappers.position.get(entity);
              ...
         }

         @Override
         public void exit(Entity entity) {

        }

        @Override
        public boolean onMessage(Entity entity, Telegram telegram) {
             if (telegram.message == 0) {
                 Gdx.app.log("Slime", "Waaaah, goo away, big daddy! yummmmmmy");
                 return true;
            }
            return false;
        }
     }
}

sentences:
Efficient way of detecting a touched object in a game? Imagine a Sims-like 2D game for a touch based mobile phone where one can interact with virtually any object in the scene.

How can I efficiently detect which object is being touched by the player?

In my short experience, looping through all the visible objects in the scene and checking if they're touched has so far done the job, but when there may be many many moving objects in the screen that sounds kind of inefficient isn't it? Keeping the visible moving objects list can consume time in itself as one may have to loop through all of them each frame.

Other solutions I've thought are:

Spatial hashing. Divide the screen as a grid and place the visible objects in the corresponding bucket. Detection of the clicked object is fast but there's additional overhead for placing the objects in the correct bucket each frame.

Maintaining a quad-tree. Moving objects have to be rearranged all the time, the previous solution looks better.

What is usually done in this case?

sentences:
Can I include PCM audio data in a commercial application? For certain reasons, I need raw audio data in my application. I would convert certain sounds to a PCM format (at development time), and store & load these PCM files in my game.

PCM stands for Pulse Code Modulation, and as far as I can see, it is a representation of signal, and thus cannot be patented by anyone. Only formats can be patented I suppose (e.g. WAV, which relies on PCM), but PCM sequence of bits cannot be.

So if I include PCM data in my application package, I don't violate any patent, do I?

I'm developing for Android, by the way.

sentences: Help with modifying a geometry grass shader to allow removing areas? So I have this geometry grass shader from a roystan tutorial I followed but it applies the grass effect to the entire mesh at once. I need to find a way to only apply grass to set areas much like how the unity painting vegetation tools work. I had an idea of using a "guiding" texture that the shader would follow which would only apply grass onto set areas on the texture e.g areas that are green but I'm not sure how to implement it. I would appreciate any advice!

sentences:
How do I Animate a character in Unity3D (Animator)? first of all, I am new to Programming and Unity, but I want to create a simple game with Unity3D. I am using the StandardAssets (character) where all animations are included, but I dont get how to change animation state.

In the beginning I used this simple c# script to move the player:

    //move the player
    //A/D / LEFT /RIGHT
    transform.Translate (Vector3.right * Input.GetAxis("Horizontal") * speed * Time.deltaTime);
    //FORWARD/BACKWARDS
    transform.Translate (Vector3.forward * Input.GetAxis ("Vertical") * speed * Time.deltaTime);

But then I was only able to move the player around without any animations.

In the "Animator I am using the standard Controller "ThirdPersonAnimatorController".
But how can I interact with the Controller/Animator? The Condition to change from Idle to Walk is CharStateMove = 1.
But How can I change this value? I thought of something like "CharStateMove++;"

Or is there a more easier way to animate a character? Because I dont want to spent the whole time on animate the character. A very simple Animation would be enaught for me...

sentences:
Alternatives to multiple sprite batches for achieving 2D particle system depth In my 2D XNA game, I render all my sprites with a single sprite batch using SpriteSortMode.BackToFront and BlendState.AlphaBlend.

I'm adding a particle system based on the App Hub particles sample. Since this uses
SpriteSortMode.Deferred and BlendState.Additive, I will need to have two SpriteBatch.Begin / SpriteBatch.End pairs: one for 'regular' sprites, and one for particles.

In my top-down shooter, If I want to have explosions appear under planes, but above the ground, then I believe I will have to have three Begin/End pairs, first to draw everything under the explosions, then to draw the explosions, then to draw everything above the explosions. If I want to have particle effects at multiple different depths, then I'm going to need even more Begin/Endpairs.

This is all easy to code, but I'm wondering if there is an alternative way to handle this?

sentences:
Question regarding simplification of world creation and collision (VISUAL BASIC) In my computer programming class we are creating our own top down adventure games in Visual Basic. Currently I have been able to have the player appear on screen and collide with a block on the screen.

My question comes from the collision code which is here:

Public Sub checkCollide()
        'If player's top is in range of the block above it...
        If yPos = Form1.block1Y + 49 And (xPos >= Form1.block1X And xPos <= Form1.block1X + 49 Or xPos + 49 <= Form1.block1X + 49 And xPos + 49 >= Form1.block1X) Then
            'Disable upward movement
            canMoveUp = False

        Else
            canMoveUp = True
        End If

        'If player's left is in range of the block to its left...
        If xPos = Form1.block1X + 49 And (yPos >= Form1.block1Y And yPos <= Form1.block1Y + 49 Or yPos + 49 <= Form1.block1Y + 49 And yPos + 49 >= Form1.block1Y) Then
            'Disable left movement
            canMoveLeft = False

        Else
            canMoveLeft = True
        End If

        'If the player's underside is in range of the block below it...
        If yPos + 24 = Form1.block1Y And (xPos >= Form1.block1X And xPos <= Form1.block1X + 49 Or xPos + 49 <= Form1.block1X + 49 And xPos + 49 >= Form1.block1X) Then
            'Disable downward movement
            canMoveDown = False

        Else
            canMoveDown = True
        End If

        'If the player's right is in range of the block to the right of it...
        If xPos + 24 = Form1.block1X And (yPos >= Form1.block1Y And yPos <= Form1.block1Y + 49 Or yPos + 49 <= Form1.block1Y + 49 And yPos + 49 >= Form1.block1Y) Then
            canMoveRight = False

        Else
            canMoveRight = True
        End If
End Sub

I was wondering if there was a way to create a struct or class of some sort that allowed for a much simpler way to do this. Each block is a picture box. When creating a new block I need to repeat these steps for each one created, resulting in a huge list that is probably unnecessary.
Thanks.

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 are the units when reading depth using glReadPixels()? Suppose I use glReadPixels() to read the depth of a pixel from the depth buffer. What are the units of this? Is it the distance from the camera? Or the distance from the near clip plane? And is the distance normalized to clip space, or in real units?

sentences:
How should I implement an Observer patter in the following example I am wondering how I implement an observer pattern in the following example. I am mostly wondering what should be in charge of subscribing.

The Example

A factory produces cars (Observable), they drive from A to B. Once at B the car has finished.  The scoreboard increases by +1 (Observer).

The Solution?

Option A.) The factory spawns a car, it then calls a method to subscribe the car to the scoreboard

observableCar.FinishedEvent += observerScoreboard.HandleEvent;

Option B.) Should the cars on being created register / tell the the scoreboard to subscribe itself to it the cars finishedEvent()

this.FinishedEvent += observerScoreboard.HandleEvent;

Option C.) The scoreboard is subscribed to a 'carSpawned' event on the factory. On recieving this event it then subscribes itself to the cars finishedEvent(). It then unsubscribes.

Option D.) I am missing something fundamental about the observer pattern, do more homework

I'm thinking its something more akin to option C? I'm not sure.

Thanks very much

Jim

sentences:
World Canvas InputField cursor precision/control from RenderTexture output in Overlay UI How do you have a world canvas input field cursor be controllable from the input being mapped from a UI overlay with its raw image supplied from render texture from a render camera?
Described another way:
World Canvas Input Field -> Render Camera creates renderTexture for -> Screen Overlay UI Raw Texture -> Main Camera
How do you have the cursor position be mapped from the Screen Overlay UI Raw Texture?

sentences:
How to know if these profiler values are good or bad? I'm making a 2D game for Android Mobile using LibGDX and Java in Android Studio. My game mostly runs alright with 60FPS, but for some time to time it lowers to 50FPS. I'm trying to find out what causes it. I came across this profiler and implemented it and here are the values in a very "messy" frame with lots of objects going around and messing around:

06-19 15:14:21.088 9999-10033/com.gadarts.parashoot.android I/GL Report - Calls: 498
06-19 15:14:21.088 9999-10033/com.gadarts.parashoot.android I/GL Report - Draw Calls: 37
06-19 15:14:21.088 9999-10033/com.gadarts.parashoot.android I/GL Report - Shader Switches: 8
06-19 15:14:21.088 9999-10033/com.gadarts.parashoot.android I/GL Report - Bindings: 36
06-19 15:14:21.088 9999-10033/com.gadarts.parashoot.android I/GL Report - Vertex Count: 31.945946

My question is how am I supposed to know if these are considered to be high values or low? I read the LibGDX documentation but it doesn't give any direction or indication about the values effect. Yes, it might be an opinion-based question, but at least someone can give relevant direction using these values?

Thanks in advance

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:
Developing interesting game mechanics when not an avid gamer I've realized that though I like playing videogames, I find it much more entertaining to actually make them. This makes me wonder, if I'm planning to develop an [X]* game, do I need to be an avid [X] gamer? How can I develop interesting mechanics if I play that genre sparingly?

In order to get empirical answers, I'm more interested in listening to the opinion of those who have worked/are working in the game industry.  Are you and your co-workers avid gameplayers or "casual" gamers?  What about the Schafers, Carmacks, McGees and Gilberts of the industry (should anyone know any of them :) )?

*being [X] any game genre: Platformer, RPG, RTS, FPS, etc.

PS: I'm trying to make this question as subjective-less as possible, so feel free to point any improvements.

sentences: Calculating minimum velocity of the projectile needed to hit target in parabolic arc If I have a point which I want to hit at the end or during a parabolic arc, how would I calculate the needed x and y velocity?

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:
Touchscript: multiple overlapping colliders Im building a tower defense game on unity and would like to allow the player to pan the camera on a large map. I am using touchscript to handle the touches.

I made a testing project with the following hierarchy
Main Camera
Panning object
Sprite

I am using the pan gesture to move the panning object which then sets the main camera's position to negative of the panning object's corrds.

So far, the things that should work worked properly. There is however the issue that the sprite object is higher up the layer and thus take priority. This means that if the viewport is filled with the sprite object, you are no longer able to pan as you cant touch the panning object behind the sprite object.

So the question is,
1. How does touchscript handle layering?
2. How can one achieve a passthrough effect where the sprite would handle tap gestures and the panning object handles pan gestures?
3. Can anyone suggest a better touch system for what im trying to do other than touchscript?

Thanks

sentences:
Is it possible in Unity to Flip a 2D Sprite Without Flipping the Object it is Assigned to? I 'built' (followed a tutorial) on a collision detection system, and when I flip the object to go left and right the collision messes up. So I have three options; find a way to modify the collision detection, have sprites for all animations for left and right or to flip the sprite but no the object.

if anyone has used RaycastHit2D, and has figured out a way to do it correctly, that would also be great.

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:
Instantiating a GameObject at my desired position not working I'm sure I am misunderstanding something about Unity vectors or something here. I am brand, brand new to Unity so this is part of the problem.

I am trying to make a simple atomic model and I am trying to model valence electrons.

I've got a game object with two children - the symbol (which is working perfectly), and a child electron.

If an atom has more than 1 valence electrons, I add those as additional child objects.

All of this is working just fine - except for one part. I have a default position for the original child valence electron, but when I try to add additional children and set their positions, they're not anywhere near where they should be.

For example:

My Model:

My base electron:

My additional electrons look like this:

And here is my output - obviously not right:

So here's my function to add additional electrons:

  void addElectrons(Rigidbody2D atom)
  {
    AtomData.AtomData atomData = atom.GetComponent<Atom>().atomData;

    if (atomData.ValElec > 1)
    {
      for (int i = 1; i < atomData.ValElec; i++)
      {
        GameObject electron = Instantiate(electron_obj, new Vector2(0.2f, 0), Quaternion.identity) as GameObject;
        electron.name = "Electron " + (i + 1).ToString();
        //electron.transform.localPosition = new Vector3(.02f, 0, 0);
        electron.transform.localScale = new Vector3(.05f, .05f, 0);
        electron.transform.parent = atom.transform;
      }
    }
  }

I've tried Vector2 (currently shown above), a new Vector3 in transform.localPosition (shown and commented out), as well as in transform.position (not shown, but similar to localPosition).

What exactly am I doing wrong here? I am strongly guessing that I am misunderstanding the vector math or something here.

sentences: What affects the size of APK files? The size of the .apk file built by Unity is larger than I expected. Is it image resolution, number of scenes, or something else?

sentences:
Viewport not matching Window size when fullscreen I am using:

GraphicsDevice.Viewport.Bounds

to determine the size of the canvas / stage for my window. This works well if I am in Windowed mode, but if I launched into fullscreen, it does not update to the new fullscreen size.

public HelloWorld()
{
    graphics = new GraphicsDeviceManager(this);

    int height = GraphicsAdapter.DefaultAdapter.CurrentDisplayMode.Height;
    int width = GraphicsAdapter.DefaultAdapter.CurrentDisplayMode.Width;
    graphics.PreferredBackBufferHeight = height;
    graphics.PreferredBackBufferWidth = width;

    graphics.IsFullScreen = true;
    graphics.ApplyChanges();

    Content.RootDirectory = "Content";
}

Basically, I am setting the window to fullscreen in the constructor, but the Viewport does not get set to the new size (I also tried just setting to fullscreen without explicitly setting PreferredBackBuffer settings). I have tried manually setting the viewport size, but it appears to be null in the constructor.

So, is there a way to get the stage / screen bounds that I can draw to in a way that is consistent in both Windowed mode and fullscreen mode?

When I run, here is what I get:

(i.e. the viewport doesnt match the entire screensize).

Debugging this a bit more and the issue isnt that the viewport isnt being updated to the correct size (it is), but that it seems to render in a smaller space (see attached image). If I print out with the width / height of the viewport, it matches the full screen window, but when I draw at 0,0, it doesnt place it at the top left of the window).

Note, if I just set the window size to the dimensions of the screen, and DONT set it to fullscreen, then things work (i.e. the balls fill the screen)(see image below).

I can get it to work if I move the fullscreen call from the Constructor, and to Initialize. This works, but I am trying to figure out why it doesnt work when I call full screen in the constructor (and if that is the right place for me to make that call).

sentences:
Is attribution sufficient for CC BY-SA 3.0-licenced music in a commercial mobile game? I am in the process of developing a mobile game that I intend to sell on Google Play. I want to include a music licensed as:

  Attribution-ShareAlike 3.0 Unported (CC BY-SA 3.0)

If I attribute the author/contributor of the music, am I allowed to sell my game without the same license?

I would like to get opinions from people who have had experience in this situation.

sentences:
How do I calculate UV space from world space in the fragment shader? In my vertex shader I have calculated the world space

o.worldSpacePosition = mul(unity_ObjectToWorld, vertIn.vertex);

How do I convert that world space into uv space coordinates in my fragment shader?

        float4 frag(VertexShaderOutput i) : COLOR //SV_Target0
        {
            // float2 uv = i.worldSpacePosition ???

        }

I have tried

float4 mvp = UNITY_MATRIX_MVP[3];
float2 uv = mvp.xy /= p.w;

but that does not appear to work as the uv is always (0, 0)

EDIT:

I am drawing a mesh on the screen in world space coordinates which needs to lookup into a screen space texture:

The way I am currently solving this is by calculating the uvs for each vertex of the mesh using the following calculation:

camera.WorldToViewportPoint(vertices[i]);

Unity uses normalised coordinates for the viewport [0,1] rather than [-1,1].

This works fine but I wasn't sure of the behaviour if part of the polygon is off the screen.  I presume I should clamp the uv?

Screen space might not be the correct term for the uv coordinates.  Perhaps texture space is a more appropriate term?

sentences:
Convert Minimap render texture to 3d space position I am using Render Texture to make a Mini Map it is working fine. Now I want world space position from render texture click point.
Is there any way available that I get the world space position from the render texture's specific click point?
If I click somewhere in render texture then, how can I get that point in 3D world space?
For example, I click a car object on render texture How can I highlight or get it in 3D world space.?
Update: Actual Scenario is:

One Main Camera Rendering the Scene.
NGUI Camera Rendering the GUI.
That GUI contains the Render Texture(minimap) which rendering the
scene on texture using GUI Camera.

Now how can I get 3D position from 2D render texture!

sentences:
Composing Game Metrics So I'm running into a bit of a roadblock with the way I'm currently keeping track of game metrics. By "metrics", I mean little bits of information that I can compose together to get useful information about my game. My primary application for this being so that I can detect certain events in the game and disperse achievements.

The way my current system works, I have metrics represented as a long value, where each bit represents a certain metric... for example, there's a flag for enemies, a flag for the player, a flag for a kill, a flag for each weapon, a flag for when a wave starts, etc, etc. I can then compose these into a single value to tell me things like "an enemy of this type was just killed by this weapon". My achievements controller looks at each metric posted in the last update and I have state machines that transition to the next state based on what metrics are posted.

The problem with this method is... I'm quickly running out of bits to use for my long value. I have plenty more weapons I want to add, so this hard limitation on the number of bits I can use as flags means it's probably time to find a better way to keep track of these.

Does anyone have a recommendation? Preferably one that would require the least amount of effort to refactor my current metrics and achievement systems to integrate?

EDIT: Is there a better term than "metric" to use? I haven't been able to find articles on this topic of game engine design because whenever I use the word "metric", all I find are articles about revenue-related analytical metrics.

sentences:
How do I output a webcam stream to a 2D canvas with SharpDX in C#? I'm writing an application for the Oculus Rift using the SharpOVR library to access HMD position data. I decided it is reasonable to use SharpDX to also output webcamera streams.

Unfortunately, all SharpDX documentation is basically a copy paste from C++ documention and I only know basic C++. C# uses a different style, class names, etc.
The MediaFoundation samples are also C++-only.

I'm trying to write a pretty simple part that renders 2 videos from 2 webcams.
I've managed to get webcameras list with this code, but I'm failing to init one— it currently fails at source.Start(descriptor, null, time);

According to the exception, I need to bind all Stream events first. Or I am missing something I need to init?

Can one help with further actions from camera start till outputting to monitor? I know the code shouldn't be too hard, problem is adapting it to C#.

sentences:
How do I increase object movement speed after some time? I'm new to Unity, and am making a game where an object goes up, falls down and is destroyed. This object has been instantiated. I want to increase the object movement speed by 1 after 10 seconds, but not by more than 12, because the object moves off screen.

How do I do that? This is what I have, so far:

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

public class DestroyScript : MonoBehaviour
{
    public Rigidbody2D rb;
    private float destroyTime = 2.0f;
    private int speed = 8;

    void Start()
    {
        rb = GetComponent<Rigidbody2D>();
        Destroy(gameObject, destroyTime);
    }

    void FixedUpdate()
    {
        transform.Translate(Vector2.up * speed  * Time.deltaTime, Space.World);
        transform.Rotate(0, 0, 1);
    }
}

Thank you for your answer and sorry for my incomplete question actually object are spawned. here is the spawned script

public class SpawnItems : MonoBehaviour {

    public Transform[] SpawnPoints;

    public GameObject[] Coins;

    float createRate = 1.5f, createRateTimer;
    float rateIncrease = 0.1f, intialCreateDelay = 1.0f;
    int callCounter = 0, callBeforeRateIncrease = 15;

    // Use this for initialization
    void Start () {
        createRateTimer = createRate + intialCreateDelay;
    }

    private void Update()
    {
        createRateTimer -= Time.deltaTime;
        if(createRateTimer <= 0)
        {
            CustomInvoke();
        }
    }

    void CustomInvoke()
    {
        int spawnIndex = Random.Range(0, SpawnPoints.Length);
        int objectIndex = Random.Range(0, Coins.Length);
        Instantiate(Coins[objectIndex], SpawnPoints[spawnIndex].position, SpawnPoints[spawnIndex].rotation);
        callCounter++;
        if(callCounter >= callBeforeRateIncrease)
        {
            createRate -= rateIncrease;
            callCounter = 0;
        }
        createRateTimer = createRate;
    }
}

sentences:
Creating a basic character skeleton from code I'd like to have a procedural system that uses a string of data to create a 3d creature. The way I've thought to do this is to use the code to generate a simple creature skeleton (I'll get to the skin generation when I have time) so I can test different source data's effect on the structure produced.

How can i use a set of data to generate the simple 3d skeleton?

The code would have information used to show what type of bone it was(hierarchy), the bone length, and how the bone was positioned and use this to make the model. (At least in planning, I don't know how to implement it)

Edit: The goal is to create creatures of different forms and skeletons. The creation will be mirrored down the spine so both sides are the same.

I'd like it to be highly adaptable but I'd like to specify a max of 4 legs and 4 arms (8 limb max only 4 on ground for walking). Being able to create a basic structure for humanoids, quadrupeds, and mixes (like a centaur or biped with no arms) is the goal.

I've looked for how to create a model off of the code procedurally, looking at stuff like FRep isosurfaces and metaballs, but I'm stumped on how to make it happen. I decided any progress is better that none, so I'd like to get a generator for something like an animators skeleton example to make sure I can get working structures (and later have something to work with to begin working on the animation algorithm).

Sorry for the lack of information at first, I was trying to keep the question simple. If you have an idea for the creation of the structure(skeleton) or maybe even the form itself I'd appreciate the help. Thanks

sentences:
Moving from DirectX 10 to DirectX 11 I've done a reasonable number of small hobby projects using DirectX 9 but it's time to move to DirectX 11 now.

I have Frank Luna'a book on 3D programming using DirectX 10 but nothing on DirectX 11. I believe they are pretty similar, but was wondering if anyone could enumerate the main differences at a code level that I'll need to be aware of (or point to an existing source).

sentences:
Strange lighting bug in my game I've been experiencing this lighting bug in my game.

As you can see there is a box around the player on the back wall and underneath it. the platform and back wall are 3D objects and the player is a 2D sprite. i believe i have found an option in the past but i am unable to find where it is now. I really appreciate you help and thank you all in advance

sentences:
Not able to upload to Oculus Store I am building for Quest and signing the package with V2. I am also creating store-based Android Manifest file. Unfortunately the upload stops at 2nd step where I receive the error -
"The APK was signed with the V1 signature system, previously marked with V2 and signed again with V1. Such APKs are considered corrupted and cannot be installed."
Here is my Android Manifest file:
<manifest xmlns:android="http://schemas.android.com/apk/res/android" package="com.VR.VRCube"
android:versionCode="1" android:versionName="1.0" android:installLocation="auto">
<application>
<meta-data android:name="com.samsung.android.vr.application.mode" android:value="vr_only"/>
<meta-data android:name="com.oculus.supportedDevices" android:value="quest|quest2"/>
<activity android:screenOrientation="landscape"
     android:theme="@android:style/Theme.Black.NoTitleBar.Fullscreen"
     android:configChanges="density|keyboard|keyboardHidden|navigation|orientation|screenLayout|screenSize|uiMode"
     android:launchMode="singleTask"
     android:resizeableActivity="false">
</activity>
</application>
<uses-sdk android:minSdkVersion="21"/>
<uses-feature android:glEsVersion="0x00030001" />
<uses-feature android:name="android.hardware.vr.headtracking" android:required="true" android:version="1" />
</manifest>

sentences:
3D Illusion of a 2D Planet Texture Several years ago I overheard a technique that gives the user the illusion of a rotating planet by using a 2D texture. Given that the user isn't able to change its position or viewport.

What's the name of this technique?

sentences:
NPC Melee fighting movement issue So i have been struggling with this for ages and I have now decided to reach out for help.

The Problem:

The game has two NPCs for reference we will call them "Ally" and "Enemy"

Ally and Enemy each have their own weapon:

Ally has a sword with a reach 0.1 - 2 meters
Enemy has a long sword that has a reach of 0.5 - 3 meters.

Now these two NPC's wish to fight each other. They need to make sure that they stay within the reach of their weapons while also making sure that they don't bump into each other.

For this I attempted the following algorithm:

bool shouldMove = false;
Vector3 lToTarget = Target.transform.position - transform.position;
lToTarget.y = 0f;

Vector3 lToTargetDirection = lToTarget.normalized;
float lToTargetDistance = lToTarget.magnitude;
float lRange = MinMeleeReach + MaxRange;
if (!shouldMove && lToTargetDistance > lRange + 1f)
{
    shouldMove = true;
}

if (shouldMove && lToTargetDistance <= Mathf.Max(lRange))
{
    shouldMove = false;
}

if (shouldMove)
{
    float lSpeed = Mathf.Min(MovementSpeed * Time.deltaTime, lToTargetDistance);
    transform.position = transform.position + (lToTargetDirection * lSpeed);
}

Now if they should not move then they would attack their target.

However as you might have guessed this has an issue:

The agent tries to keep his distance to the max of his range!

This sadly causes the agents to bug out in a way where they are never close enough to attack each other resulting in something that looks like this:

So i thought to my self how can i change this behavior.

I came up with another idea which sadly had the same problem this time using navmesh agent:

Vector3 direction =
    (transform.position - Target.position).normalized;
Vector3 finalPosition = Target.position + direction * maxRange;
navMeshAgent.SetDestination(finalPosition);

Again sort of same behavior, however, this time they just kept their distance and if the other agent came to close they would start moving backward. Which basically meant that they would move back to the end of the world.

So this is where I am at right now. I have attempted to google this issue however without much luck.

So i am really praying that you guys have an answer for me :)

if you need more information please do not hesitate to comment!

sentences: When and how to apply affine translations to vertices of a mesh with LWJGL So, I have a rigid body class, containing a list of vertices and a 4x4 transformation matrix. At the moment, I'm applying the transformation matrix to each vertex individually, and am unable to revert the translation after rendering(multiplying the vertices by the inverse causes massive model distortion), so it just keeps stacking up, and eventually the model just violently wobbles back and forth. I understand mathematically how to accomplish the transformation, I'm just not sure where to actually DO the transformation without distorting the model. I'm using Java and LWJGL, and porting the Cyclone physics engine to Java.

sentences:
Is it possible now to make something for android in Unity3d without buying any licenses? I was just talking to a game dev who said its possible, that it involves downloading the android sdk and few other things. If this is possible can someone tell me how?

Also is it possible to build a .apk file and install on your device? Is it possible to release something developed this way on the play store?

sentences:
smooth loading of the heavy scene in unity3d I have a very very big/huge scene to load, I can't load it at once. So what I know I have applied but it still loading takes  some time I want to make it smooth. How it possible?

What i have tried so far is I divided the scene into multiple scenes and loading 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.

How do i load smoothly a big scene? what will be the strategy? Is this right strategy which I am doing or there any else solution.

sentences:
How well do functional languages perform on Android? This is a special case of this question that I feel is particularly pertinent.

I'm working on a game for Android, and I'm planning on using Scala with libgdx.  I'm planning on making a performant game, but not necessarily hyper-performant game.  I saw libgdx's documentation on Garbage Collection, and this makes me think:

Functional programming implies lots of immutable objects.
Therefore, mutating an object requires making a new object.
Thus, lots of objects get garbage collected, which degrades performance.

Is this an insurmountable problem?  Are there any other significant problems with functional style on Android?

sentences:
Convert a direction vector (normalized) to rotation? Say i have something like this:

pos += glm::normalize(target - pos) //PLEASE NOTE: pos is a glm::vec3 and so is target

This makes "pos" translate towards "target", but what if i want to make my object to face "target"?

sentences: Why are Mac versions of games larger in filesize than Windows versions? I have browsed many games mainly on itch.io and many developers offer a Mac version of their game along with the Windows version. The Mac version of all those games is significantly larger in file size than the Windows version. Why is that?

sentences:
Is the viewport meant to be an absolute representation of where the underlying device is drawing? I know this may sound like an odd question but I just wanted to confirm which way it is.

Currently I am using XNA within Windows Forms (MDI) and I am just wondering about the viewport, as I have multiple forms with their own graphics device to draw with.

Now originally I just assumed the viewport was meant to be a basically a wrapper for the screen size (i.e., width and height), however I noticed it contains an X and Y. So then I was unsure if it was meant to directly represent the drawing region of the device.

Take for example the below scenario:

I have a forms with a panel which is docked within a group box, its relative position in the form is { X: 100, Y: 100, Width: 320, Height: 280 } however its absolute position on the screen would be lets say { X: 400, Y: 320, Width: 320, Height: 280 }. Then if I were to use it like I was originally assuming the panel itself which hosts the underlying handle for Xna to draw to it would be { X: 0, Y: 0, Width: 320, Height: 280 }.

So if you imagine I then start dragging the window around a bit, the relative positions do not change, but obviously the absolute one would, as you could technically drag the panel off screen.

So basically the question is, do I need to use absolute positions for my viewport and update them every time the graphics device is about to be drawn, or do I use relative positions and only update when the area is resizing? and if so is it relative to the form, or is it always going to be 0,0 for the x/y in this scenario?

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:
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:
Keyboard input system handling Note: I have to poll, rather than do callbacks because of API limitations (SFML). I also apologize for the lack of a 'decent' title.

I think I have two questions here; how to register the input I'm receiving, and what to do with it.

Handling Input

I'm talking about after the fact you've registered that the 'A' key has been pressed, for example, and how to do it from there.

I've seen an array of the whole keyboard, something like:

 bool keyboard[256];  //And each input loop check the state of every key on the keyboard

But this seems inefficient. Not only are you coupling the key 'A' to 'player moving left', for example, but it checks every key, 30-60 times a second.

I then tried another system which just looked for keys it wanted.

std::map< unsigned char, Key> keyMap; //Key stores the keycode, and whether it's been pressed. Then, I declare a load of const unsigned char called 'Quit' or 'PlayerLeft'.
input->BindKey(Keys::PlayerLeft, KeyCode::A);  //so now you can check if PlayerLeft, rather than if A.

However, the problem with this is I cannot now type a name, for example, without having to bind every single key.

Then, I have the second problem, which I cannot really think of a good solution for:

Sending Input

I now know that the A key has been pressed or that playerLeft is true. But how do I go from here?

I thought about just checking
 if(input->IsKeyDown(Key::PlayerLeft) { player.MoveLeft(); }
This couples the input greatly to the entities, and I find it rather messy. I'd prefer the player to handle its own movement when it gets updated. I thought some kind of event system could work, but I do not know how to go with it. (I heard signals and slots was good for this kind of work, but it's apparently very slow and I cannot see how it'd fit).

Thanks.

sentences:
What are the performance and size tradeoffs of Eigen::Transform versus Eigen::Matrix4f? We finished migrating from DirectXMath to the Eigen math libraries for our 3D-Game Engine last week for portability reasons. After implementing transformations with matrices as we know them, we found out about Eigen::Transform, which seemed like a really cool idea at the time.

Now, after a lot of fiddling things still don't quite work and we don't seem to have as much control over the way that Transformations are made. With Eigen::Matrix4f, you're making the multiplications directly and can change in which order they are made. Eigen::Transform appears to be way less transparent and flexible.

So we thought about reverting to our commits from last week, and head on to work with matrices again. But there are a few things we are concerned about:

Saving things like translation in a 4x4 Matrix takes up more space than using Eigen::Translation
Generating a new Matrix4f for the complete transformation every tick seems like a tedious process

So I wanted to know how Transform compares to regular Matrix4f in terms of speed and if my impression that  Transform is not as flexible is actually true or not.

sentences:
Panel gets transparent when accessing the offsetMin of RectTransform I need to place 3 panels side by side in my application. It was working fine with Render mode Screen space - Overlay. Now due to some other requirement, I had to change the Render mode to Screen space - Camera. Now when I access the offsetMin of RectTransform of the panels so that it shifts to the right, the panel gets transparent.
I commented the code where I'm accessing and the Panel doesnt get transparent then.
I'm not sure why it is happening.
The requirement is place a 3D model in canvas, so I had to change the Render mode. If there is a way to place 3D model in canvas with Screen space - Overlay. That would be great as well.

sentences:
Get speed from vector using box2d and javascript I need to find the speed of an object in a game. The game is made in HTML5 with jquery and jquery.box2d.
For this I can use these methods:

 GetLinearVelocity().x;
 GetLinearVelocity().y;

I'm then trying to calculate the speed from this piece of code, but get some values that doesn't make sense when I console.log it. This is my code:

 var heroVelX = game.currentHero.GetLinearVelocity().x;
 var heroVelY = game.currentHero.GetLinearVelocity().y;

 var speed = Math.sqrt(heroVelX^2 + heroVelY^2);
 console.log(speed);

Some of the values in console.log are numbers, but most of them are NaN (Not-A-Number), which confuses me? Can someone help me solve this?

The goal I want to achieve, is to see when the speed(of object .currenHero) drop below a certain value, so I can excute a new state in the game.

sentences: What alternatives to GLUT exist? I am trying to learn OpenGL, and I just found out that GLUT is obsolete. I already know SDL, and it seems it is a good alternative. Should I use SDL to develop games with OpenGL, or are there any better alternatives. I am new to game development, so I don't know much about the state of the art.

sentences:
Client Server Multiplayer Project I have reviewed the relevant WinForms/XNA samples here and here.

However, my requirements are slightly different.

Given the following:

I am developing a multiplayer (Client - Server) game
There will be three projects in the solution, one for Client and Server respectively, plus an additional one containing the core game/engine
The instances will share common code from this engine project (core Game Engine functionality)
I require the Server instance to also allow management of the server (e.g. connection list etc.) via a Windows Form
Finally, and importantly, I am proposing to use the Dependency Injection pattern on initialisation of the client/server instances to inject the relevant network management class as required - similar to the approach here

What is the best way to achieve this? Specifically, are there any flaws with organising the projects in the solution the way I have proposed above? For the Server project, do I start it as an XNA project and then call the Winform, or vice versa?

Thank you for any advice you can spare.

Edit - a brief example of the "dependency injection" style pattern I plan to use. Forgive me if this is not an example of "pure" / full / traditional DI!

// Create the server
using (var game = new ExampleGame(new ServerNetworkManager()))
{
    game.Run();
}

// Create the client
using (var game = new ExampleGame(new ClientNetworkManager()))
{
    game.Run();
}

sentences:
Having trouble creating multiple sprites from one class So I am trying to make more than one sprite using a single class but I cannot seem to get the sprites to be drawn at all or drawn in different places (they are all just on top of one another).

In my Game1 I have:

    Flag flag;
    List<Flag> GameFlags = new List<Flag>();

then in LoadContent:

flag = new Flag();
tempTexture = Content.Load<Texture2D>("FlagTexture");
tempRectangle = new Rectangle(50, 500,tempTexture.Width / 3, tempTexture.Height / 3);
flag.SetSprite(tempTexture);
flag.SetRectangle(tempRectangle);

for (int i = 0; i < 2; i++)
        {
            GameFlags.Add(flag);
            flag.spriteRectangle.X += 100;
        }

Then in Draw:

 foreach (Flag flag in GameFlags)
        {
            spriteBatch.Begin();
            flag.Draw(spriteBatch);
            spriteBatch.End();
        }

The effect I am after is having 2 sprites spaced out by a specified amount of space. Image if the underscores were spacing and the zeros were sprites in the following:

0____________________________0

Any help and advice is appreciated.

Thanks in advance,

TeaBelliedTitch.

sentences:
Drawing Sprites in Android OpenGL efficiently? I want to basically give myself some sprite drawing functions (making use of openGL) such as;

draw(Texture,x,y)

I want to do this using OpenGL-ES 2.0 on Android. Since the textures can be varying sizes, I was thinking I would save the vertices along with the textures and pass them to the shaders every draw call using "glVertexAttribPointer". Is there a better(performance) way of doing this?

I would also make use of a model matrix to translate/rotate the sprites. Is this a normal thing to do for 2d rendering?

sentences: Knowing when an ad was clicked Is there a way in Unity to know when an ad was clicked? Some plugins for different advertising networks have events that fire when the ad was clicked, but if there is no such event - how do I know when an ad was clicked?

sentences: Flash: Memory usage is low but framerate keeps dropping So I'm working on a puzzle game in flash. For all intents and purposes it's like Tetris. I spawn blocks, they move around the screen, then they get destroyed and disappear. I was having some trouble with the memory usage being too high over time so I read up on memory management and I think I have that figured out now. It's definitely climbing slower than it was before, but the framerate is still taking a huge dive after playing for a while. If it's not a memory leak what else could be causing this? Thanks in advance.

sentences:
Circle Collider Vibrates on Edge Collider I am making a game (kind of bricks) and using edge collider objects as world bounds collider. I am increasing count of balls on each iteration, after 5 balls, balls start to vibrate when they contact with edge colliders. Vibrating means, they do not bounce directly when they contact with edge collider, they vibrate on x axis for some period while they are moving upwards on y axis.

Ball physics: (friction is 0, bounciness is 1)

Wall physics: (friction is 0, bounciness is 0)

I am not updating transform of ball object, directly set a velocity to balls.

Also i've recorded a video for this behavior: https://www.youtube.com/watch?v=K-bjkXZjXjs&feature=emb_logo

Which point i am missing on this setup? Can you help me to solve this problem?

Best,

Edit:

I have a input listener class, that updates BallThrowHandler.thrown variable, when you put your finger to screen, move and release.

Code that adds velocity to balls (which is running on another object):

using UnityEngine;
using System.Collections;

public class BallContainerBehaviour : MonoBehaviour
{
/// <summary>
/// total speed of the balls
/// </summary>
public float totalSpeed = 5f;

public float timeBetweenBalls = 0.2f;

WaitForSeconds wait;

public float degrees = 0f;

Rigidbody2D childBody;
Vector3 speedVector;

float cosinus;
float sinus;

void Start()
{
    wait = new WaitForSeconds(timeBetweenBalls);
}

void Update()
{
    if(BallThrowHandler.thrown)
    {
        //start throw animation

        startBallMovement();
    }
}

// start ball movement if they thrown
private void startBallMovement()
{
    calculateDegrees();

    //speedUpBalls();

    if(BallThrowHandler.thrown)
    {
        StartCoroutine("speedUpBalls");
    }

    CollectBallHandler.CollectingBallsStarted = false;
    BallThrowHandler.BricksMovedDown = false;
}

private void calculateDegrees()
{
    degrees = Vector3.Angle(Vector3.right, BallThrowHandler.ThrowVector) * Mathf.Deg2Rad;
}

private IEnumerator speedUpBalls()
{
    cosinus = Mathf.Cos(degrees);
    sinus = Mathf.Sin(degrees);

    speedVector = new Vector3(totalSpeed * cosinus, totalSpeed * sinus, 0f);

    foreach (Transform go in transform)
    {
        childBody = go.gameObject.GetComponent<Rigidbody2D>();
        childBody.velocity = speedVector;
        yield return wait;
    }
    BallThrowHandler.thrown = false;
}}

And here is whole code for a ball object: (only bottom collider is trigger, left right and top is not)

using UnityEngine;
using System.Collections;

public class BallEndTurnBehaviour : MonoBehaviour
{
Rigidbody2D body;

public float ballMinY;

public GameObject bricksContainer;

private BrickSpawner brickSpawner;
private BrickTurnOverMover brickTurnOverMover;

private const float EPSILON = 0.01f;

private void Awake()
{
    body = GetComponent<Rigidbody2D>();
}

void Start()
{
    brickSpawner = bricksContainer.GetComponent<BrickSpawner>();
    brickTurnOverMover = bricksContainer.GetComponent<BrickTurnOverMover>();
}

private void Update()
{
    if(System.Math.Abs(body.velocity.x) < EPSILON && System.Math.Abs(body.velocity.y) < EPSILON && CollectBallHandler.CollectingBallsStarted)
    {
        transform.position = Vector3.Lerp(transform.position, CollectBallHandler.CollectingBallsPoint, 0.1f);
    }
}

private void OnTriggerEnter2D(Collider2D collision)
{
    if (!CollectBallHandler.CollectingBallsStarted)
    {
        CollectBallHandler.CollectingBallsStarted = true;
        CollectBallHandler.CollectingBallsPoint = transform.position;
        CollectBallHandler.CollectingBallsPoint.y = ballMinY;
    }
    body.velocity = new Vector3(0, 0, 0);

    Vector3.Lerp(transform.position, CollectBallHandler.CollectingBallsPoint, 1f);

    if(!BallThrowHandler.BricksMovedDown)
    {
        brickTurnOverMover.moveBricks();
        BallThrowHandler.BricksMovedDown = true;
        brickSpawner.spawn();
    }
}
}

sentences:
Trying to extract file icons and use as a sprite texture I'm trying to extract file icons from the files inside a folder (eg: Program Files), and have them set as my Sprite's texture. I extracted the file icons, converted them to Bitmaps and then to byte array, and call the LoadImage(byte[] byte) function in my Sprite object. But when I test, the textures become the image belows. Any idea how to fix this? I just want to set my sprites texture as the extracted file icon, I'm creating something similar to a file explorer.

this is the result that i get

this is what I should get if I navigate to the notepad++ folder (eg : "C:\Program Files(x86)\Notepad++\")

this is my settings for the texture (supposedly, later being replaced with the extracted icons)

Here's my code

public UnityEngine.UI.Image targetImg;
public void Load(string directory)
{
    Icon icon = System.Drawing.Icon.ExtractAssociatedIcon(directory);
    Bitmap bmp = icon.ToBitmap();
    targetImg.sprite.texture.LoadImage(ImageToByte(bmp));
}

public static byte[] ImageToByte(Bitmap img)
{
    ImageConverter converter = new ImageConverter();
    return (byte[])converter.ConvertTo(img, typeof(byte[]));
}

sentences:
What's a good alternative to buying a console devkit? I don't have the cash to stump up for a PS3 or 360 devkit, but the G3, G4 and G5 macs are running with PowerPC chips, which I believe is virtually the same architecture as the 360, and only missing the SPUs from the PS3, so I would like to know which Macs would be good for profiling code with.

I'm after a machine that would give me equivalent timings (not actual timings, but scale the same given difference code) so I'm looking for ones that have about the same cache size and memory bandwidth ratios as the consoles. Are there any specific Macs that have these traits?

The reason I need one is that I'm developing a new programming language for games development that specifically targets the current and potential future of console hardware. One aspect of this is the in-order microcode expanding risc chips at the core of both the 360 and the PS3, and probably the next generation too, which is why I want a PPC based mac, as I'd heard that places like where I work used to use Macs as pretend 360 devkits until the hardware design was in a fit state to send out prototype 360s.

At a later date, I'll want to get my hands on an FPGA (as that's the only other route I can see consoles heading any time soon), and a cluster (as they are good practice for ensuring your task scheduling and separation are up to scratch), but for now I just need to know if there is a sweetspot machine that had very similar specs to the current consoles' CPU and memory bandwidth.

sentences:
Cant jump from ground collision I have a character that starts in the air and applying gravity to it to collide with platforms in my level. At the start, the character gradually gains speed descending until it collides with a platform. After colliding, I display text letting me know if collision is detected (character touching the ground is true). But when I push the 'W' key, the character doesn't jump. It's worth noting that there is no dedicated ground zero as the level has platforms at different heights.

void Player::update(const std::vector<std::string>& layerData, float deltaTime)
{
    // check if player touches ground
    mOnGround = collideWithLevel(layerData);

    if (mInputManager->isKeyDown(SDLK_w)) // press W to jump
    {
        jump(deltaTime);
    }

    land(deltaTime);
}

void Player::jump(float deltaTime) // problem
{
    if (mOnGround)
    {
        mVelocity.y = mJumpPower * deltaTime;
        mOnGround = false;
    }
}

void Player::land(float deltaTime)
{
    if (!mOnGround)
    {
        mVelocity.y += mGravity * deltaTime;
        mPosition.y += mVelocity.y;
    }

    if (mOnGround)
        std::cout << "On ground" << std::endl; // fires
}

sentences:
OpenGL: Draw an arrow I'd like to know how to draw an arrow to represent a vector position, length and direction.

The issue is that I can't quite find an easy way to know the location and rotation of the triangle representing the arrow head.

If it can help, I'm using OpenGL/OpenTK(wrapper for C#).

sentences:
How to make an animation play when a button is pressed once? I have added an idle and jump animation to a character in unity. I can make the animation happen when the button is pressed. If the button is up middle at the animation the character goes to the idle position. But I want the whole animation happen in one press to the button and then go back to the idle position. My current script and Animator views are:

if (Input.GetKeyDown(KeyCode.Space))
    {
        Anim.SetBool("is_jumping", true);
        ApplyInput(moveAxis, turnAxis);
    }
    else if (Input.GetKeyUp(KeyCode.Space))
    {
        Anim.SetBool("is_jumping", false);
    }

sentences:
How to make animals Playable in Skyrim I have some experience with the Skyrim Creation Kit, and have made some small mods. I am really interested in creating new races, and have already made a mod that allows the player to create an old person, a child or a dremora. To accomplish this, I simply found their IDs in the editor and checked the "playable" box (and unchecked "child"). When I attempt this with some of the non-human races, such as wolf, horse or dragon, the game crashes as soon as I select that race in the character creation screen.

My question is this: Why does the game crash instantly, and is there a way to make animal/monster races playable fairly easily (I don't have much knowledge with scripting or creating meshes). Thanks.

sentences:
Waiting for object's Awake() after loading a new scene synchronously I have a GameScene with an initially active GameObject in it, which has a singleton component:

public static ObjectiveManager Instance;

public void Awake()
{
    if (Instance != null && Instance != this)
    {
        Log.Info(this.GetType(), "Instance of this class already exists! CRITICAL");
    }

    ObjectiveManager.Instance = this;
}

Now, when I call:

private void StartGameScene(){
    SceneManager.LoadScene("GameScene");
    ObjectiveManager.Instance.SomeFunction(); // << singleton not initialized
}

I get an error, because ObjectiveManager is not set to an instance of an object.

As LoadScene is a synchronous operation so my guess was that Awake() is called immediately, synchronously. As I can see now, it's not.

Is there any way to determine that all of the objects on the scene have their Awake() already called, without checking each of them with some custom IsReady?

sentences:
How can I scale the number and challenge of enemies in an attack wave as the game progresses? I'm currently making a defense game where enemies will spawn and attack the player's army. It's similar to a Tower Defense game, except there is only one level. The enemies will keep spawning until eventually the user dies or he amasses a large enough army that they wipe out any enemy that spawns instantly (hopefully it'll be challenging enough that this won't happen).

What I'm struggling with at the moment is how to make this game get progressively harder and the probability of an enemy spawning basically eventually reach 100%.

So far I've got something similar to the following

if(Math.random() < 1 - (1/elapsed_time) && spawnTimer <= 0 ){
    spawnEnemy()
    spawnTimer = rand(); // random number between 1 and 3
}

But it seems too uniform to begin with. At the moment I'm only spawning one type of enemy, the idea being that tougher enemies are spawned as time progresses as well.

I also think I need to randomise my spawnTimer at bit more and make that get quicker as time progresses, but I just can't seen to get my head around what my logic should really look like for this whole section. Is anyone able to help with a rough idea of this kind of formula?

I'm currently using javascript to write the game, but obviously it's more about the concept.

sentences:
Game engine design: Multiplayer and listen servers My game engine right now consists of a working singleplayer part. I'm now starting to think about how to do the multiplayer part.

I have found out that many games actually don't have a real singleplayer mode, but when playing alone you are actually hosting a local server as well, and almost everything runs as if you were in multiplayer (except that the data packets can be passed over an alternate route for better performance)

My engine would need major refactoring to adapt to this model. There would be three possible modes: Dedicated client, Dedicated server and Client-Server (listen mode)

How often is the listen-server model used in the gaming industry?
What are the (dis)advantages of it?
What other options do I have?

sentences:
Nested Coroutine Movement is slugish So I have a few AIs walking between waypoints. What I want to accomplish here is to have my AI move to the waypoint, when he reaches it, he must stop, wait for a few seconds (Not walk just stand still), then move to the new waypoint. Lets pretend he was observing while at this point.

Issue right now - He moves to the waypoint with a twitchy behavior where he would usually avoid objects, sometimes gets stuck while moving to objects or its like the AI cant decide what to do, move or stand still. Without the Waitforseconds method the AI avoids objects perfectly.

Please note I want to use Coroutines for this even if you wouldn't use / recommend it for this. If you have a suggestion for using Unity's Random to decide when he stands still after reaching a point or not, that would be a bonus for me.

We define all fields and call the FSM() Coroutine with a default patrol state in the Start Method, from Here, This is my Code:

Update - Implemented A Boolean IsMoving variable - This works to some extent. The AI now moves perfectly to the waypoint. The Twitching however continues once the AI reaches the waypoint vicinity until he leaves the waypoint radius - The movement then continues to a normal state.

IEnumerator FSM()
{
        while (alive)
        {
            switch (state)
            {
            case State.PATROL:
                StartCoroutine(Patrol());
                break;
            case State.CHASE:
                Chase ();
                break;
            default:
                break;
            }
            yield return null;
        }
    }

    /// <summary>
    /// Patrol will move to a waypoint if too far, otherwise move to a next waypoint if one is reached.
    /// </summary>
    IEnumerator Patrol()
    {

            //Sets a common speed for the agent to move in.
            agent.speed = patrolSpeed;

            //Now we want to check the position the character is at vs the waypoint location - If i am too far, move closer
            //                        My Position           Waypoint Indexes - We Set Multiple
            if (Vector3.Distance (this.transform.position, waypoints [wayPointIndex].transform.position) >= 2)
            {
                //Telling the navmesh agent where to go.
                agent.SetDestination (waypoints [wayPointIndex].transform.position);

                //                                  false, false - Specifies if we are jumping or crouching
                character.Move (agent.desiredVelocity, false, false);

            }
            //Now we want to check the position the character is at vs the waypoint location - If i am at a waypoint, move to a new index
            else if (Vector3.Distance (this.transform.position, waypoints [wayPointIndex].transform.position) <= 2)
            {
                character.Move (Vector3.zero, false, false);
                yield return new WaitForSecondsRealtime (6.0f);

                wayPointIndex += 1; //Move towards a new waypoint in the waypoint indexes flags

                //Move to a random waypoint
                wayPointIndex = UnityEngine.Random.Range (0, waypoints.Length);

            }
            else
            {
                //Doesn't move, plays the idle movement - We know this point wont be reached but if so...
                character.Move (Vector3.zero, false, false);
                yield return null;
            }
        }

sentences:
Geometry shader wireframe not rendering correctly GLSL/OpenGL/C++ Im trying to make a tool for skinning 3D models, and as part of that, I need to show faces wireframed, making use of the geometry shader stage.

Im following the approach suggested here and here. My problem however, is that it ends up looking like this:

Where some of the lines get thicker when the faces are oriented in a specific way. This is my geometry shader: (The vertex shader just passes vertices, so theres no need to show it)

#version 400

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

noperspective out vec3 gDist;

void main()
{
//800,600=window size(make uniform later)
vec2 p0 = vec2(800,600) * gl_in[0].gl_Position.xy/gl_in[0].gl_Position.w;
vec2 p1 = vec2(800,600) * gl_in[1].gl_Position.xy/gl_in[0].gl_Position.w;
vec2 p2 = vec2(800,600) * gl_in[2].gl_Position.xy/gl_in[0].gl_Position.w;

vec2 v0=p2-p1;
vec2 v1=p2-p0;
vec2 v2=p1-p2;
float area = abs(v1.x*v2.y - v1.y * v2.x);

gDist = vec3(area/length(v0),0,0);
gl_Position = gl_in[0].gl_Position;
EmitVertex();

gDist = vec3(0,area/length(v1),0);
gl_Position = gl_in[1].gl_Position;
EmitVertex();

gDist = vec3(0,0,area/length(v2));
gl_Position = gl_in[2].gl_Position;
EmitVertex();

EndPrimitive();
}

and frag shader:

#version 400

noperspective in vec3 gDist;

const vec4 wire_color = vec4(0.0,0.5,0.0,1);
const vec4 fill_color = vec4(1,1,1,0);

void main()
{
float d = min(gDist[0],min(gDist[1],gDist[2]));
float i = exp2(-2*d*d);

gl_FragColor = i * wire_color + (1.0 - i) * fill_color;
}

So what am I doing wrong here? I feel like im missing something. Is anyone familiar with this?

sentences:
Simple Car Animation Acceleration Too Slow I am trying to make a very simple car animation where using the arrow keys, I can make a car move around. I am using wheel colliders and some code that goes like this:
using System.Collections;
using System.Collections.Generic;
using UnityEngine;

public class Car_My : MonoBehaviour
{

    public float Motorforce, Steerforce, Brakeforce;
    public WheelCollider FR_L_Wheel, FR_R_Wheel, RE_L_Wheel, RE_R_Wheel;

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

    }

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

        float v = Input.GetAxis("Vertical") * Motorforce;
        float h = Input.GetAxis("Horizontal") * Steerforce;
        print(Input.GetAxis("Horizontal"));

        RE_L_Wheel.motorTorque = v;
        RE_R_Wheel.motorTorque = v;

        FR_L_Wheel.steerAngle = h;
        FR_R_Wheel.steerAngle = h;

        if(Input.GetKey(KeyCode.Space))
        {
            RE_L_Wheel.brakeTorque = Brakeforce;
            RE_R_Wheel.brakeTorque = Brakeforce;
        }

        if(Input.GetKeyUp(KeyCode.Space))
        {
            RE_R_Wheel.brakeTorque = 0;
            RE_L_Wheel.brakeTorque = 0;
        }

        if(Input.GetAxis("Vertical") == 0)
        {
            RE_L_Wheel.brakeTorque = Brakeforce;
            RE_R_Wheel.brakeTorque = Brakeforce;
        }
        else
        {
            RE_R_Wheel.brakeTorque = 0;
            RE_L_Wheel.brakeTorque = 0;
        }

    }
}

When I do this, the car moves but it accelerates too slowly. I changed all the values but I cannot get it to start at a faster speed. Any help is highly appreciated.

sentences:
A way to store potentially infinite 2D map data? I have a 2D platformer that currently can handle chunks with 100 by 100 tiles, with the chunk coordinates are stored as longs, so this is the only limit of maps (maxlong*maxlong).
All entity positions etc etc are chunk relevant and so there is no limit there.

The problem I'm having is how to store and access these chunks without having thousands of files. Any ideas for a preferably quick & low HD cost archive format that doesn't need to open everything at once?

sentences:
How should I define interaction modes in a strategic game? I am creating a typical strategic game that gamer can select, deploy and move the game characters (Human mostly) and move or create buildings on its isometric map.

These all are going to be done by gamers gestures obviously, So each time I am handling a tap, pan, swipe or pinch, it is important to know what was the gamer at the middle of or was doing so the new gesture can be handled.

Doing this, I created a global enumerated type including Idle,Select,PanMap and Place and defined a variable with name gameMode to control what the gamer is about to do. for example when the game starts it is valued "Idle" and when gamer touches a building or a character it will be selected only if the gameMode  is Idle and if so gameMode will be changed to Select so the handlePan() method can manage the new gesture and sees if the user is moving the map or a selected building for instant.

When the gamer selects a building and does a pan afterward, the game logic should update the gameMode. When the first touch point of the pan gesture is recieved by handlePan() function, the function will check it against the selected building(currentSelection) to see if the gamer is tended to move the building or it is just a simple map panning, by changing the gameMode to "Place" or "PanMap" and check which gameMode is the case while processing the rest of the touches so they can be handled correctly.

  As I have mentioned above, I have four game modes including idle, select, panmap(while something is selected), place (when gamer is moving something on the map)

Can anyone with strategic experience tell me is this kind of handling user interaction is the best way?

if yes do you think these modes are enough?

Can you tell me what was your modes in case you used this method?

I am using SpriteKit with xcode.

sentences:
Animation via AnimatorController created in script does not play in Unity I have created an empty GameObject and assigned it a script: Main.cs.

public class Main
{
    [MenuItem("Custom workflow/Initialize")]
    static void Initialize()
    {
        // Place a text mesh on the scene
        var obj = new GameObject("Sample");
        obj.transform.position = new Vector3(0, 0, 0);
        var text = obj.AddComponent<TextMesh>();
        text.text = "Hello world";

        AnimationClip clip1 = CreateAnimationClip();
        AnimatorController sm = CreateSimpleAnimatorController(clip1);

        var animator = obj.AddComponent<Animator>();
        animator.runtimeAnimatorController = sm;
        animator.applyRootMotion = true;
    }

    private static AnimationClip CreateAnimationClip()
    {
        var translateX = AnimationCurve.Linear(0.0f, 0.0f, 2.0f, 25.0f);
        var animationClip = new AnimationClip();
        animationClip.SetCurve("", typeof(Transform), "position.x", translateX);

        AssetDatabase.CreateAsset(animationClip, "Assets/procanim.anim");

        return animationClip;
    }

    private static AnimatorController CreateSimpleAnimatorController(
      Motion motion1 = null, Motion motion2 = null)
    {
        // Creates the controller
        var controller = AnimatorController.CreateAnimatorControllerAtPath(
          "Assets/SimpleStateMachineTransitions.controller");

        // Add parameters
        controller.AddParameter("GoToB", AnimatorControllerParameterType.Bool);
        controller.AddParameter("GoToA", AnimatorControllerParameterType.Bool);

        // Add StateMachines
        var rootStateMachine = controller.layers[0].stateMachine;

        // Add States
        var stateA1 = rootStateMachine.AddState("stateA1");
        stateA1.motion = motion1;
        var stateB1 = rootStateMachine.AddState("stateB1");
        stateB1.motion = motion2;

        // Add Transitions
        var transitionAB = stateA1.AddTransition(stateB1);
        transitionAB.AddCondition(AnimatorConditionMode.If, 0, "GoToB");
        transitionAB.duration = 0;

        var transitionBA = stateB1.AddTransition(stateA1);
        transitionBA.AddCondition(AnimatorConditionMode.If, 0, "GoToA");
        transitionBA.duration = 0;

        return controller;
    }
}

The problem

As I invoke the menu item, I get all assets in place. When I hit play, nothing happens. I can see state stateA1 is on, but the animation does not run. If I click on the text object in the scene...

...this is what I see in the animation window:

I think the problem might be here:

animationClip.SetCurve("", typeof(Transform), "position.x", translateX);

Because, when I remove the code generate Transform.position property from the animation timeline and manually add one via UI, it works once I hit play again.

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:
What is a good free "game development organisation" site? I'm searching for a site that will help me to design a game. I don't have a development team in the same location. They are all located somewhere over the world. I am searching for a kind of site that allows people to post ideas and suggestions, but moreover to have control over who has the control over what. For example, one makes the graphics and has several people "under" him that can get a certain task to make a certrain graphic. This has to be easily found on this site.

Does anyone know a good site like this? I prefer it to be free.

sentences:
Libgdx Scene2d and Box2d light Currently I am using scene2d and I want to implement shadows using Box2d light.
I want shadows under characters but when I draw something after render() , it draws nothing.
 For example, in draw() method of an actor,

    public void draw(Batch batch, float delta){
        super.draw(batch,delta);
        ray_handler.render();
        batch.draw(Something......)
    }

But when draw before render, it shows no problem.

    public void draw(Batch batch, float delta){
        super.draw(batch,delta);
        batch.draw(Something......)
        ray_handler.render();
    }

How can I solve this problem?

sentences:
Framebuffer incomplete attachment I am creating a framebuffer in LWJGL using:
        framebuffer = glGenFramebuffers();
        texture = glGenTextures();
        glBindFramebuffer(GL_FRAMEBUFFER, framebuffer);
        glBindTexture(GL_TEXTURE_2D, texture);
        glTexImage2D(GL_TEXTURE_2D, 0, GL_RGB, width, height, 0, GL_RGB, GL_UNSIGNED_BYTE, 0);
        glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER, GL_NEAREST);
        glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, GL_NEAREST);
        glFramebufferTexture(GL_FRAMEBUFFER, GL_COLOR_ATTACHMENT0, texture, 0);
        glDrawBuffers(GL_COLOR_ATTACHMENT0);

But glCheckFramebufferStatus tells me that the attachment is incomplete. What am I doing wrong? I checked several websites and I don't seem to be missing anything...?

sentences:
Instantiating GameObjects in Custom Game Engine So,i'm having a bit of an issue with instantiating my gameobjects into to universe(My Scene object).
I can create an empty object from scratch and populate it from there with ease,my problem starts when i try to clone the gameobject which i just created.
My steps are

I create an empty gameobject (GAMEOBJECT A)
I add an component to it (COMPONENT A)
Now i create a gameobject B from A
GameObject B created,and the component A is in the component list of the gameobject B
I try to get the component using inheritance but nullptr returns

It seems when i try to clone components,it returns only the base class pointer.There i try to recreate the derived class and add it to new gameobject's component list but obviously i fail.

If i cant solve this with inheritance how can i solve it ?
is there better way to implement such a desing ?
or i just fail to use inheritance in c++.If it's, can you guys point out what am i doing wrong here

This is my GameObject AKA RGameElement
class RGameElement
{
protected:
    vector<RElementComponent*> Elements;
public:
    template <class T>
    T* GetComponent() {

        int elementSize = Elements.size();

        for (int i = 0;i < elementSize;i++)
        {
            T* pr = dynamic_cast<T*>(Elements[i]);
            if (pr != nullptr)
                return pr;
        }
        return nullptr;
    }
    template <class T>
    T* AddComponent() {

        T* newElementComp = new T();
        Elements.push_back(newElementComp);
        return newElementComp;
    }
    void AddComponent(RElementComponent* targetComponent)
    {
        RElementComponent* newElement = new RElementComponent();

        *newElement = *targetElement;

        Elements.push_back(newElement);
    }

    /*void AddComponent(RElementComponent* targetComponent);*/
    vector<RElementComponent*> GetComponent() const;
}

This is my Component AKA RElementComponent
class RGameElement;

class RElementComponent
{
public:
    RGameElement* RootGameElement;
    virtual RElementComponent GetReference() { return RElementComponent(); };
    virtual void Setup() {};
    virtual void StartLogic() {};
    virtual void UpdateLogic() {};

}

and this my Instantiate via gameobject ref function
RGameElement* RUniverse::Instantiate(RGameElement* targetGameElement)
{
    RGameElement* newElement = new RGameElement();

    vector<RElementComponent*> components = targetGameElement->GetComponents();
    int componentSize = components.size();

    for (int i = 0;i < componentSize;i++)
    {
        newElement->AddComponent(components[i]);
    }

    Elements.push_back(newElement);
    return newElement;
}

sentences:
Checking if bullet collides with enemy when I know the start X & Y, the angle, the speed and dist traveled of the bullets This is the bullet I create when a player clicks to attack

var angInRadians = Math.atan2(data.y - playerArr[i].y, data.x - playerArr[i].x);//data.y & data.x is mouseY and mouseX
var temp = angInRadians * (180/Math.PI);
        function newBullet() {
          this.attack = temp;
          this.playerX = playerArr[i].x;
          this.playerY = playerArr[i].y;
          this.speed = 10;
          this.traveled = 0;
        }

Then in my game loop I do this

for(var j = 0;j<playerArr[i].bullets.length;j++)
    {
      playerArr[i].bullets[j].traveled += playerArr[i].bullets[j].speed;
    }

Then to draw the bullet I am doing this

ctx.translate(playerArr[i].bullets[j].playerX, playerArr[i].bullets[j].playerY);
        ctx.rotate(playerArr[i].bullets[j].attack * (Math.PI/180));
        ctx.fillStyle = 'black';
        ctx.fillRect(playerArr[i].bullets[j].traveled, 0, 4, 1);

Then for the players I just have a usual player X and Y and I can't figure out how to check if the bullet is within the area of the player, if you need any more code just ask/If you want to see how the game is working here.

sentences:
Drawing an arrow cursor on user dragging in XNA/MonoGame I am writing a touch enabled game in MonoGame (XNA-like API) and would like to display a an arrow 'cursor' as user is making a drag gesture from point A to point B.
I am not sure on how to correctly approach this problem. It seems that its best to just draw a sprite from A to B and scale it as required. This would however mean it gets stretched as user continues dragging gesture in one direction.
Or maybe its better to dynamically render the arrow so it looks better?

sentences:
How to free up TEXCOORD slots for Unity's Universal Render Pipeline? I am writing custom a custom shader for Unity's Universal Render Pipeline (Version 7.3.1). The meshes are built using three separate UVMaps for different portions of the mesh. The reason I actually need all three to be separate is because two of them are scaled & offset independently by a C# script, kind of like texture atlas. I need the front and back of a sphere to be independently textured using this.
I followed this tutorial from CyanGameDev to get an understanding of the new syntax for URP as I had previously done this with the Built-In RP. The older version still used the Vertex & Fragment functions to draw it, but it was unlit so I was free to use as many TEXCOORDs as I needed.
Now as I followed this tutorial, I found that I needed all 8 available TEXCOORDs immediately just to get it functioning:
struct Varyings // AKA v2f, or OUTPUT from Vertex function to Fragment function
        {

            float4 positionCS                    : SV_POSITION; // Position in ClipSpace AKA screen space
            float4 color                         : COLOR;

            float2 uv                               : TEXCOORD0;
            DECLARE_LIGHTMAP_OR_SH(lightmapUV, vertexSH, 1); // the 3rd argument is the TEXCOORD index

        #ifdef REQUIRES_WORLD_SPACE_POS_INTERPOLATOR
                float3 positionWS               : TEXCOORD2;
        #endif
                float3 normalWS                 : TEXCOORD3; // Normal in WorldSpace as defined in Vert function
        #ifdef _NORMALMAP
                float4 tangentWS                : TEXCOORD4; // Tangent in WorldSpace as defined in Vert Function
        #endif
                float3 viewDirWS                : TEXCOORD5;

                // Convert to half3 for just vertex lighting, free up a TEXCOORD?
                half4 fogFactorAndVertexLight   : TEXCOORD6; // x: fogFactor, yzw: vertex light

        #ifdef REQUIRES_VERTEX_SHADOW_COORD_INTERPOLATOR
                float4 shadowCoord              : TEXCOORD7;
        #endif
        };

Is there anyway I can remove some of these and still get PBR-ish result? For instance, I don't necessarily need the fog on this object. As well, I do not really want to perform this in Shader Graph if I can avoid it.
One thought I am having is to declare the uv as a float4 and just swizzle the texcoord like uv.xy for UV1 and uv.zw for UV2 but my understanding is the texturing and offset is stored within the Z & W vectors which is why you used to define a _MainTex_ST float4.
EDIT:
The specific effect is this:
The background is one texture (not a solid color, or i'd do this differently)

And the Foreground is another texture (Alpha channel symbols)

Through the script, you control which background section or foreground symbol you want by changing the tiling of the texture. The idea is that you can have many different combinations of the two textures. The back of the sphere will always have just the background color. The script is such that the amount of tiles on a texture does not have to be square, and the foreground and background textures do not need the same amount of tiles (its calculated at start). At any given time, only one of the tiles is shown on the sphere, mapped to both sides.
The final look is explained in a previous question of mine
The final look is explained in a previous question of mine

sentences:
How to fix Monogame WP8 Touch Position bug? Normally below code will result in X:Infinity, Y:Infinity

TouchCollection touchState = TouchPanel.GetState();

foreach (TouchLocation t in touchState)
{
    if (t.State == TouchLocationState.Pressed)
    {
        vb.ButtonTouched((int)t.Position.X, (int)t.Position.Y);
    }
}

Then, I followed this https://github.com/mono/MonoGame/issues/1046 and added below code at the first line in update method. (I still don't know how it's worked, but it fixed the problem)

if (_firstUpdate)
{
    typeof(Microsoft.Xna.Framework.Input.Touch.TouchPanel).GetField("_touchScale",System.Reflection.BindingFlags.NonPublic | System.Reflection.BindingFlags.Static).SetValue(null, Vector2.One);
    _firstUpdate = false;
}

And then, when I randomly testing something, there are several area that won't read the user touch.

The tile with the purple dude is the area which won't receive user input (It don't even detect "Pressed", the TouchCollection.Count = 0)

Any idea how to fix this?

UPDATE 1 : The second attempt in recompiling

The difference is weird. Dunno why the consistent clickable area is just 2/3 area to the left

UPDATE 2 :
After trying to rotate to landscape and back to portrait to randomly testing, then the outcome become :

sentences:
Finding the normals of an oriented bounding box? Here is my problem.

I'm working on the physics for my 2D game.

All objects are oriented bounding boxes (OBB) based on the separate axis theorem.

In order to do collision resolution, I need to be able to get an object out out of the object it is penetrating.

To do this I need to find the normal of the face(s) that the other OBB is touching.

Example:

The small red OBB is a car lets say, and the big OBB is a static building. I need to determine the unit vector that is the normal of the building edge(s) the car is penetrating to get the car out of there.

Here are my questions:

How do I determine which edges the car is penetrating.
I know how to determine the normal of an edge, but how do I know if I need  (-dy, dx) or (dy, -dx)?
In the case I'm demonstrating the car is penetrating 2 edges, which edge(s) do I use to get it out?

Answers or help with any or all of these is greatly appreciated.

Thank you

sentences:
Changing DisplayMode seems not to update Input&Graphic Dimension I'm writing a small game using Slick and Nifty-GUI.
At the program startup I set the DisplayMode using the following lines:

AppGameContainer app = new ...
app.setDisplayMode( 800, 600, false );
app.start();

I wrote a Nifty-ScreenController for my settings dialog in which the user can select the desired DisplayMode. When I try to set the new DisplayMode within this controller class the game window gets resized correctly but the Graphics and Input objects aren't updated accordingly. Therefore my rendering code just uses a part of the new window.

I tried to set different DisplayModes in the main method to test if it's generally possible to invoke this method multiple times. It seems that changing the DisplayMode only works before I call app.start().

Furthermore I tried to update the Graphics & Input object manually but the init and setDimensions methods are package private. :(

Does someone know what I'm doing wrong and how to change the DisplayMode correctly?

sentences:
Good example of a multi-pass effect? In XNA (and Direct3D in general AFAIK), rather than creating individual vertex and fragment shaders, you bundle potentially many related shaders into 'Effects'. When you come to use an effect you select a 'technique' (or iterate through all of them) and then each 'technique' has a number of 'passes'. You loop through the each pass it selects the relevant vertex and fragment shader and you draw the geometry.

What I'm curious about though is what you would need multiple passes for? I understand in the early days of 3d you only had one texture unit and then you had 2 and that often still wasn't enough if you also wanted to do environment mapping. But on modern devices, even in the mobile class, you can sample 8 or more textures and do as many lighting calculations as you'd want to in a single shader.

Can the more experienced here offer practical examples of where multi-pass rendering is still needed, or is this just over-engineering on the part of XNA/Direct3d?

sentences:
Unity Input System On-Screen Button doesn't work with touchscreen 2019.3.2f1 I am trying to make my player jump whenever the space button is pressed (if a keyboard is present), and I'm adding a on-screen button for players on mobile. The on-screen button works fine in the editor but when I try the game in a device the on-screen button doesn't work.

Here's how things are set up:

Change the Active Input Handling to Input System Package (New) on
the player settings.
Create the Jump action for the Player action map.
Bind <Keyboard>/space to my Jump action.
Add a PlayerInput component to my player object, pass my actions
file to it, and set up the events to call for each action.
Change the StandaloneInputModule to an InputSystemUIInputModule in my
event system object.
In my canvas I add an image and add OnScreenButton component to it (I
do NOT add a Button component).
Set the control path to <Keyboard>/space.

When I try the game on the device the rest of the UI buttons work fine except the on-screen button. On the editor though (using mouse input), the on-screen button works fine.
This is my first time using the Input System, I had actually found it somewhat nice to work with, however this does seem really strange. It is either a really strange bug (unlikely), or I messed up some setting (the setup process feels really convoluted actually).

sentences:
Twin stick shooting with keyboard In a top down shooting game, what alternatives are there for input if I want the direction of movement to be independent from the direction I'm shooting at? I'd like to avoid shooting with the mouse as it's much too precise, but alternatives that make it harder to aim could also work.

Alternatives I've already considered are:

Arrows for movement and WASD for shooting. The Binding of Isaac does this and it has two problems. It only allows for shooting in four directions, where I'd prefer at least eight; and most keyboards start ignoring some key presses if you press more than 2 keys at one, making it impossible to move in a diagonal while shooting.
Arrows or WASD for movement, shooting direction becomes fixed  in the direction you are facing when you start shooting. I don't remember where I saw this. This allows for shooting on any direction, but you have to stay still for a moment to change shooting direction, and it just doesn't feel very dynamic.

sentences:
changing camera's reference point position by a keyboard event I would like to change the camera's reference point position using gluLookAt. I would like that it changes when I press for exemle 'a'. I tried with:

void VueOpenGL::Paint(wxPaintEvent&){
SetCurrent();

glMatrixMode(GL_PROJECTION);
glLoadIdentity();
gluPerspective(65.0, 4.0/3.0, 1.0, 1000.0);

glMatrixMode(GL_MODELVIEW);
glLoadIdentity();
gluLookAt(100, 0.0, 0.0,
           X,   Y,  0.0,
           0.0, 0.0, 1.0 );

}

void VueOpenGL::OnKeyChar(wxKeyEvent& event)
{
   switch (event.GetKeyCode() ){
       case 97:
             X=coordinatesX_obj;
             Y=coordinatesY_obj;
         break;
    }
 }

Everything is ok with the constructor of the class VueOpenGL. Despate that nothing happend when I press 'a'. Do I make something wrong?

sentences:
Gamma Space and Linear Space with Shader I am using Unity and I can choose between two color space mode in the settings: Gamma or Linear Space.

I am trying to build a Custom Lighting Surface shader but I am facing some problems with those Color Space. Because the render is not the same depending of the Color Space.

If I render the lightDir, Normal or viewDir I can see that they are different depending of the Color Space I use.

I made some test and the result I have in Linear Space is great but how can I obtain the same result in Gamma Space ?
Are there some transformations ? On what component should I apply those transformations ?

Thank you very much !

sentences:
Enemy clones don't target player In a small game that I'm making enemies multiply when you kill them, however when clones are instantiated they don't chase the player like the original prefabs do (example: http://gfycat.com/VastActualElver)

Here is relevant part of my code:

 #pragma strict
    var moveSpeed : int = 3;

    var player : Transform;
    var MaxDist = 10;
    var MinDist = 1;

    function Update () {
        if(curhealth <= 0){
            Dead();
        }
        transform.LookAt(player);
        if(Vector3.Distance(transform.position, player.position) >= MinDist){
            transform.position += transform.forward * moveSpeed * Time.deltaTime;
        }
    }

function Dead () {
    Destroy(gameObject);
    var posx = Random.Range(-10, 10);
    var posz = Random.Range(-10, 10);
    Instantiate(enemys, Vector3(posx, 0.5, posz), transform.rotation);
}

What am I missing?

sentences:
Unity - adding camera constraint to prevent the player from seeing beyond the scene Like the title says, I'm after some kind of constraint for the camera to prevent the player from seeing beyond the scene and seeing the Skybox. I came across the code to add a Mathf.Clamp, but I can't get it to work.
I'm currently trying to make a 2.5D platformer in which the camera follows the player (ahead), which leads to seeing beyond the scene to the far left and right. I already have an invisible wall in place to prevent the player from falling off, but I would love to also clamp the camera from going any further.

This is the script I have at the moment:

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

public class CameraController : MonoBehaviour
{
    [SerializeField] GameObject player = null;
    [SerializeField] [Range(0.1f, 2f)] float followAhead = 2f;
    [SerializeField] [Range(0.1f, 2f)] float smoothing = 1f;

    //public PlayerController playerController;

    private float minPosition = -9.37f;
    private float maxPosition = 4.68f;
    private Vector3 cameraClamp;

    const float m_minY = 2f;
    Vector3 targetPosition;
    Vector3 cameraOffset;

    void Start()
    {
        cameraOffset = transform.position - player.transform.position;
    }

    void Update()
    {
        targetPosition = (player.transform.position + (player.transform.forward * followAhead)) + cameraOffset;
        //smoothedForward = Vector3.MoveTowards(smoothedForward, playerController.GetTravelDirection(), 0.5f * Time.deltaTime);
        //targetPosition = (player.transform.position + (smoothedForward * followAhead));
        //transform.position = player.transform.position + cameraOffset;
        targetPosition.y = Mathf.Min(targetPosition.y, m_minY);
        transform.position = Vector3.Lerp(transform.position, targetPosition, smoothing * Time.deltaTime);
        cameraClamp.x = Mathf.Clamp(transform.position.x, -9.37f, 4.68f);
    }
}
```

sentences:
2D engine that uses Flash Platform classes? I want to develop a 2D game for Android, but, I want to use Flash Platform's framework APIs, ex: Sprite, Shape, Graphics, Bitmap .. etc as I have already wrote my game in AS3 ..

Is there a 2D engine for Android that uses Flash Platform's framework APIs?

If not, does Unity use Flash Platform's framework APIs?

I know that I can Adobe AIR to port the game to android, but, I want it a native code based to avoid Adobe AIR player as a requirement ..

Any guidance?

sentences:
Is there an in memory data store that is feasible for real time, non-networked games? I would like to know if anyone has recommendations or experience with using an in memory data store for a real time, non-networked game. This is not necessarily for loading levels or saving data, but to be accessed within the game loop as the game is running. Pretty much everything I look at w.r.t. data stores in games refers to networked games like MMOs.

As I am working on my game I find myself building a lot of ad hoc structures to hold various bits of game data and I was thinking it would make more sense to leverage work in this area that would provide a more consistent (and hopefully efficient) retrieval/storage method.

Does anyone have any experience or recommendations on in memory databases or key value stores or document stores that would be reasonable?

For my own purposes, my game is being written in Scala but the answers don't need to be Scala/Java specific.

EDIT

To be more specific I am primarily talking about entity data and lists of entities not necessarily things like 3D meshes.

sentences:
MonoGame - Scale Texture2D from 16x16 to 64x64 I need to scale a Texture2D (let's say it's 16x16) to 64x64.

I tried scaling it in the SpriteBatch#Draw method, but it doesn't look like pixel art as soon as it's drawn, more like a lot of anti-aliasing happened.

I chose 64x64 because 16x16 is pretty small, and I thought I could just scale every pixel by 4 (1x1 pixel in 16x16 could be 4x4 pixels in 64x64), basically I don't want MonoGame to anti-alias when I draw the scaled Texture.

Thank you!

sentences:
What's the fastest way checking if two moving AABBs intersect? I have two AABBs that are moving, what's the fastest way to check if they will intersect under a frame?

By moving I mean not just to check with the usual rectangle intersection method, I mean some kind of simple easy swept test that only returns a boolean, no hit time or anything else.

What I think is to simply do it like this:

But that Hexagon is quite complex and I don't know how to calculate an AABB - Polygon intersection, is there maybe an easier way?

Any programming language that you like the most, I can easily port it.

Thanks.

sentences:
Why does the code in Unity affect objects differently? There are 2 objects made in a blender and imported into Unity.

Eye of the Cyclops.blend

Flask.blend:

The problem is that after using the code, which should create an object in the hand-body area (I'm still working on it), one object is created far from the character.

Example:

Everything is OK.

It's not ok.

Code:
PlayerInteraction:

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

public class PlayerInteraction : MonoBehaviour
{

    public GameObject target = null;

    public KeyCode interactKey;

    public GameObject itemHolder;

    private void Update()
    {
        if (Input.GetKeyDown(interactKey))
        {
            if (target == null)
            {
                return;
            }

            FoodBox food = target.GetComponent<FoodBox>();
            if (food != null && itemHolder == null)
            {
                food.Interact(this);
            }

            TableBox table = target.GetComponent<TableBox>();
            if (table != null)
            {
                table.Interact(itemHolder, this);
            }

        }
    }

    public void SetItem(GameObject c)
    {
        if (c != null)
        {
            Debug.Log("Взяли предмет!");
            itemHolder = Instantiate(c, transform.position + new Vector3(0f, 2.15f, -0.65f), Quaternion.Euler(-90f, 0f, 180f), transform);
        }
        else
        {
            Destroy(itemHolder);
        }
    }

    private void OnTriggerEnter(Collider col)
    {
        if (target != col.gameObject && target != null)
        {
            return;
        }
        else {
            target = col.gameObject;
            Debug.Log("Мы дошли сюда до " + target.name);
        }

    }

    private void OnTriggerExit(Collider col)
    {
        if (col.gameObject == target)
        {
            target = null;
        }
    }
}

TableBox:

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

public class TableBox : MonoBehaviour
{

    public GameObject itemHolder;

    private void Start()
    {
        if (itemHolder != null)
        {
            itemHolder = Instantiate(itemHolder, transform.position + new Vector3(0f, 1.9f, 0f), Quaternion.Euler(-90f, 45f, 0f),transform);
            Debug.Log("Мы создались!!");
        }
    }

    public void Interact(GameObject i, PlayerInteraction player)
    {
        if ((i == null || itemHolder == null))
        {
            player.SetItem(this.itemHolder);
            Destroy(this.itemHolder);
            //Debug.Log(itemHolder);
            this.itemHolder = i;

            if (this.itemHolder != null)
            {
                this.itemHolder = Instantiate(this.itemHolder, transform.position + new Vector3(0f, 1.9f, 0f), Quaternion.Euler(-90f, 0f, -135f),transform);
                Debug.Log("Мы ингридиенты из ТейблБокса!");
            }
        }
        else
        {
            return;
        }
    }
}

FoodBox:

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

public class FoodBox : MonoBehaviour
{

    public GameObject ingredient;
    private Animator anim;

    // Use this for initialization
    void Start()
    {
        anim = GetComponent<Animator>();
        anim.SetBool("openFoodBox",false);
    }
    public void Interact(PlayerInteraction player)
    {
        anim.SetBool("openFoodBox", true);

        if (anim.GetBool("openFoodBox")) {
            anim.Play("Opening");
            player.SetItem(ingredient);
            Debug.Log("Мы ингридиенты из ФудБокса!");
        }

        anim.SetBool("openFoodBox",false);
    }
}

There is also an assumption that this is due to the initial position of the models. Because for me, some models are stored normally vertically, and some lie horizontally.

I also add the prefab inspector:

Eye of the Cyclops:

Flask:

sentences:
Basic post-processing shader problem I'm trying to create a basic post-processing shader, like I did many times before but somehow today it's just not working, I guess it's something basic that I missed.

Anyway my setup:

I have 3 render targets rts[0], rts1, and rts[2], I draw a simple model in each one of them. I then draw the render targets to the screen using the following code:

GraphicsDevice.SetRenderTarget(null);
GraphicsDevice.Clear(Color.CornflowerBlue);
spriteBatch.Begin(SpriteSortMode.Immediate, BlendState.AlphaBlend, null, null, null);

spriteBatch.Draw(rts[0], new Rectangle(0, 0, GraphicsDevice.Viewport.Width / 2, GraphicsDevice.Viewport.Height / 2), Color.White);
spriteBatch.Draw(rts[1], new Rectangle(GraphicsDevice.Viewport.Width / 2, 0, GraphicsDevice.Viewport.Width / 2, GraphicsDevice.Viewport.Height / 2), Color.White);
spriteBatch.Draw(rts[2], new Rectangle(0, GraphicsDevice.Viewport.Height / 2, GraphicsDevice.Viewport.Width / 2, GraphicsDevice.Viewport.Height / 2), Color.White);

spriteBatch.End();

This gives me the following picture:

Which is exactly what I expect it to be :)

Now I feed these 3 render targets as textures to my shader like this: (shaderTexture is a black 1x1 texture)

cutAwayEffect.Parameters["lowTexture"].SetValue(rts[0]);
cutAwayEffect.Parameters["highTexture"].SetValue(rts[1]);
cutAwayEffect.Parameters["cutTexture"].SetValue(rts[2]);

spriteBatch.Begin(SpriteSortMode.Immediate, BlendState.Opaque, null, null, null, cutAwayEffect);

spriteBatch.Draw(shaderTexture, new Rectangle(GraphicsDevice.Viewport.Width / 2, GraphicsDevice.Viewport.Height / 2, GraphicsDevice.Viewport.Width / 2, GraphicsDevice.Viewport.Height / 2), Color.White);

spriteBatch.End();

And the shader:

texture lowTexture;
sampler lowSampler = sampler_state
{
    Texture = (lowTexture);
};

texture highTexture;
sampler highSampler = sampler_state
{
    Texture = (highTexture);
};

texture cutTexture;
sampler cutSampler = sampler_state
{
    Texture = (cutTexture);
};

float4 PixelShaderFunction(float2 texCoord: TEXCOORD0) : COLOR0
{
    float4 baseColour = tex2D(lowSampler, texCoord).rgba;
    float4 highColour = tex2D(highSampler, texCoord).rgba;
    float4 cutColour = tex2D(cutSampler, texCoord).rgba;
    float4 finalColour = baseColour + highColour * cutColour;

    return finalColour;
}

technique CutAway
{
    pass Pass1
    {
        PixelShader = compile ps_2_0 PixelShaderFunction();
    }
}

Now I would expect to see a combination of all 3 render targets in the bottom right corner, however I don't see any data from baseColour. When I change finalColour to just baseColour I only see black, same goes for just highColour and just cutColour. Even finalColour = highColourcutColour only gives me black while finalColour = baseColour + highColourcutColour; does give me something.

The shader does seem to be working, changing final Colour to float4(1,0,1,1) gives me the expected pink square. There seems to be a problem reading the data from the textures, but I've got no clue why.

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

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

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

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

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

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

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

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

}

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

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

    return container;
}

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

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

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

    return foundItem;
}

// container abstracted method of adding an item

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

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

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

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

sentences:
How do I make this block go back to the left with another click? This is the script I've written so far which makes the block move from the left of the screen to the right on a mouse click. What I want to achieve is for the block to move back to the left when I click the mouse again. So I can have a back and forth movement with each mouse click. Thank you for any help it's much appreciated.

public class PlayerControls1 : MonoBehaviour  {

private bool hasBeenTapped = false;
private bool control = false;
public float speed = 20f;

void Update () {
    if (Input.GetMouseButtonDown (0)) {
        hasBeenTapped = true;
            }

    if (hasBeenTapped && transform.position.x < 4 && control == false){
        transform.Translate (Vector2.right * speed * Time.deltaTime);
    }

    if(transform.position.x > 4.0f) {

        control = true;

        hasBeenTapped = false;
    }

    if(hasBeenTapped && transform.position.x == 4 || transform.position.x < 4 && control == true) {
        transform.Translate (-Vector2.right * speed * Time.deltaTime);

    if(transform.position.x < -4){

            control = false;

            hasBeenTapped = false;
        }
    }
  }
}

sentences:
most compact way to represent dice face translations rolling in cardinal directions I'm making a 2-D dice rolling game in BASIC (think mechanics similar to Devil Dice on the Playstation, but top-down 2D graphics). I'm trying to accurately represent the transitions of a die when rolling it from one face to another along the cardinal directions. I can look up the current value of a die at a given position but I'm not maintaining actual object representations corresponding to a physical die, so modeling the 3D dice in game is out.

I can think of two ways to do this, but can't quite implement either correctly.

Make a lookup table given a die face, orientation, and direction of roll that returns the new correctly oriented die face.
Something about bitwise arithmetic I don't understand from answer #3 on this page. Seems like it could be harder to implement but possibly smaller, more elegant code. I don't, however, need anything to do with spinning or edges or animation, just fetching the next face up.

I'm trying not to prematurely optimize, but eventually the code should be able to be made as compact as possible. BASIC, so I'm not using any complicated 3D libraries or game engines, I want to keep this close to the bare metal as far as logical physics simulation goes.

sentences:
d3d11 black texture when manually creating from image (Rust) I am trying to create a ID3D11Texture2D from a RgbaImage loaded from a .jpg. The below code produces no errors. However, the texture is black when it is actually rendered. I know the standard way to load textures is through the DirectXTex library, but I was having issues linking with it and can't find any premade Rust bindings.

Should the below code/settings work to create a working ID3D11Texture2D?
Is there a way to view the contents of a ID3D11Texture2D in order to debug?
Are there DirectXTex bindings for Rust?

fn load_resource_from_file(device: &Device, path: &Path) -> error::Result<Texture> {
    unsafe {
        let image = Reader::open(path)?.decode()?.to_rgba();

        let mut sample_desc = dxgitype::DXGI_SAMPLE_DESC::default();
        sample_desc.Count = 1;
        sample_desc.Quality = 0;

        let mut desc = d3d11::D3D11_TEXTURE2D_DESC::default();
        desc.Width = image.width();
        desc.Height = image.height();
        desc.MipLevels = 1;
        desc.ArraySize = 1;
        desc.Format = dxgiformat::DXGI_FORMAT_R8G8B8A8_UINT;
        desc.Usage = d3d11::D3D11_USAGE_DEFAULT;
        desc.SampleDesc = sample_desc;
        desc.BindFlags = d3d11::D3D11_BIND_SHADER_RESOURCE;
        desc.CPUAccessFlags = 0;
        desc.MiscFlags = 0;

        let mut data = d3d11::D3D11_SUBRESOURCE_DATA::default();
        data.SysMemPitch = (image.sample_layout().width_stride * mem::size_of::<Rgba<u8>>()) as u32;
        let buffer: Vec<u8> = image.into_raw();
        data.pSysMem = buffer.as_ptr() as *const _;
        data.SysMemSlicePitch = buffer.len() as u32;

        let mut texture = ptr::null_mut();
        device.as_ref().CreateTexture2D(
            &desc,
            &data,
            &mut texture,
        ).result()?;
        let texture = NonNull::new(texture).ok_or(null_ptr_err!())?;

        drop(buffer);

        let mut resource_view = ptr::null_mut();
        device.as_ref().CreateShaderResourceView(
            &**texture.as_ref() as *const d3d11::ID3D11Resource as *mut _,
            ptr::null(),
            &mut resource_view,
        ).result()?;
        let resource_view = NonNull::new(resource_view).ok_or(null_ptr_err!())?;

        Ok( Texture(Arc::new(TextureInner {
            texture,
            resource_view,
        })))
    }
}

sentences: Gamepad support for OSX What is the most common method for providing gamepad support in an OS X game? I've been using an IOHIDLIB wrapper named DDHIDLib https://github.com/Daij-Djan/DDHidLib and it seems to be working but I find it odd that there isn't something more recent.

sentences:
Passing a list of existing entities to a new client when using a component system? My game server uses entities containing components to represent everything in the game world. This has worked great so far but I've run into a problem now that I'm allowing clients to connect to the server.

Basically the server needs to tell the connecting client about all the existing entities in the game, Since the player, the monsters, the trees etc. are all instantiated from the same Entity class I currently have no way of telling the client what each entity actually is.

What would be the best way of sending the entities to the client so that the client knows what components to add to each? The only thing I can think of is having a string "name" on the entity and then sending packets like this to the client...

{

     'action': 'create-entity',
     'data': {
         'entity-type': 'dragon',
         'x': 300,
         'y': 40,
     }
}

So now the client would know to call the "createDragonEntity" function to create the correct entity.

Any better suggestions?

sentences: How to script enable VR in Unity 5.1 Unity 5.1 has integrated VR, its in the Build Player Settings as a checkbox. I want a startup scene that is not VR, then when the user starts it enables the VR camera. Can I do that?

sentences: Get position of point on circumference of circle, given an angle? I would like to know how to get a specific point on the circumference of a circle, given an angle. The diameter of the circle is 1, and the center point of the circle is { X: 0.5, Y: 0.5 }.

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: How do I fix the players model rotation in a NetworkManager to spawn properly? How do I fix the players model rotation in a NetworkManager to spawn properly?

I created a game with the NetworkManager code.
Player Model is a cone I made and imported.

all works fine but when the NetworkManager spawns the player model it is sideways.
I have tried turning it in 3ds but the player remains sideways when it is spawned by NetworkManager on run, Ohterwise the model is fine in unity, and no matter how I rotate it, in or out of unity , The NetworkManager Rotates it.
All other objects attached to the main object remain with proper orientation all, All other objects including instantiated ones appear properly.

sentences:
Aggregation of value in GLSL loop results in 0 I'm banging my head against a wall trying to understand why this code is giving me some reasonable results with some visible colors on parts of the screen...

#version 130

in vec2 vTex; // must match name in vertex shader
flat in int iLayer; // must match name in fragment shader

out vec4 fragColor; // first out variable is automatically written to the screen

uniform sampler2DArray tex;
uniform sampler2DArray norm;

#define MAX_LIGHTS 4

struct Light {
    vec3 position;
    vec4 color;
    vec3 falloff;
    vec3 aim;
    float aperture;
    float aperturehardness;
};

uniform Light lights[MAX_LIGHTS];

void main()
{
    vec4 DiffuseColor = texture(tex, vec3(vTex.x, vTex.y, iLayer));
    if (DiffuseColor.a == 0)
        discard;
    vec3 NormalMap = texture(norm, vec3(vTex.x, vTex.y, iLayer)).rgb;
    NormalMap.g = 1.0 - NormalMap.g;
    vec3 FinalColor = vec3(0,0,0);

    for (int i=0; i<MAX_LIGHTS; i++)
    {
        vec3 LightDir = vec3((lights[i].position.xy - gl_FragCoord.xy) / vec2(320.0, 200.0).xy, lights[i].position.z);
        float D = length(LightDir);
        vec3 N = normalize(NormalMap * 2.0 - 1.0);
        vec3 L = normalize(LightDir);
        vec3 Diffuse = (lights[i].color.rgb * lights[i].color.a) * max(dot(N, L), 0.0);
        vec3 sd = normalize(vec3(gl_FragCoord.xy, -1.0) - lights[i].position);
        float Attenuation = smoothstep(lights[i].aperture * lights[i].aperturehardness, lights[i].aperture, dot(sd,lights[i].aim))
            / (lights[i].falloff.x + (lights[i].falloff.y*D) + (lights[i].falloff.z*D*D) ) ;
        vec3 Intensity = Diffuse * Attenuation;
        FinalColor = max(FinalColor, DiffuseColor.rgb * Intensity);
    }
    fragColor = vec4(FinalColor, DiffuseColor.a);
}

... but when I change FinalColor = max(FinalColor, DiffuseColor.rgb * Intensity); to FinalColor = clamp(FinalColor + DiffuseColor.rgb * Intensity, vec3(0,0,0), vec3(1,1,1)); everything goes black. Is there something I don't understand about aggregation of variables in loops in GLSL, or about the + operator operating on vectors? By my logic, the changed code should return more brightness than the original code because the changed code would be adding all the values whereas the old code would just be taking the highest one.

sentences:
OpenGL Positional 2D Texture Masking I have a simple 2D java game engine running using LWJGL. I have my own vertex and fragment shaders, and I'm able to render quads with textures.

I want to be able to mask one quad using the texture from another quad.
Example:
I have two quads with two different textures mapped to them.
Quad A has a red circle texture.
Quad B has a blue square texture.
I want to use Quad A's red circle texture as a mask such that Quad B will only be visible if it is within Quad A's red circle texture.

Here's an image showing what I want to do:

The problem is that I am always seeing the 'full overlap' no matter the position of the quads. I can never get that partial masking that I'm looking for.

My shader logic is close to this:

#version 150 core
uniform sampler2D texture;
uniform sampler2D maskTexture;

in vec2 pass_TextureCoord;
in vec2 pass_MaskTextureCoord;

out vec4 out_Color;

void main(void) {
     //***other logic here to determine out_Color***

     if(pass_MaskTextureCoord.x != -1 && pass_MaskTextureCoord.y != -1) { //if we have valid mask texture coordinates, we are masking
          vec4 maskColor = texture(maskTexture, pass_MaskTextureCoord); //get the rgba values of the mask texture
          if(maskColor.a == 0) { //if mask texture has no alpha, discard
               discard;
          }
     }
}

Do I need to pass location data of the masking quad into the shader? If so, how do I do that?

EDIT: ilmale's method using the stencil buffer worked for me! All I needed to add was a uniform boolean value to tell the shader if I was drawing a mask or not.

Here's the relevant shader code:

if(isMask) { //if this is a mask, discard where texture alpha is 0
    if(texColor.a == 0) {
        discard;
    } else {
        out_Color = vec4(0, 0, 0, 0); //make the rest transparent, so we don't see the mask texture
    }
}

sentences:
Unity3d Android - Fixed Resolution How can i set a fixed 720p resolution on any devices using unity3d android?

  unity3d version: 2018.4.5f1

sentences:
Unity - Camera Moving Vertical So I want to make a smooth transition with the camera from point A to point B while keeping direction and rotation.
My current approach is using Vector3.Lerp :
using UnityEngine;

public class CameraMoveVertical : MonoBehaviour
{
    public float cameraSpeed = 0.125f;

    public void moveCamera()
    {
        Vector3 lerpPosition = Vector3.Lerp(transform.position, new Vector3(transform.position.x, transform.position.y+50, transform.position.z), cameraSpeed);
        transform.position = lerpPosition;
    }
}

The camera does move but the movement is instant. Any way to make it a smooth transition?

sentences:
System.Net.Http.dll and Unity 2018.2.1, 2.2, 2.3 are conflicting, assembly reference keeps being deleted in VS 2017, any suggestions? I'm looking for some suggestions on how to fix a strange bug i've been getting with System.net.http.dll.

For the record, builds work fine as i have the mcs.rsp file in the /Assets/ folder with "-r:System.Net.Http.dll" inside. The problem lies with Visual Studio and it's relation to Unity. I can add the reference to the dll by selecting "Analyzers" then hitting "Project" and Adding the dll found in:

C:\Program Files\Unity\Hub\Editor\2018.2.2f1\Editor\Data\MonoBleedingEdge\lib\mono\4.7.1-api\System.Net.Http.dll

But VS changes the reference instantly to:

C:\Program Files (x86)\Reference Assemblies\Microsoft\Framework.NETFramework\v4.7.1\System.Net.Http.dll

Then after a short amount of time, the reference i made just gets automatically deleted.

I've tried clearing the VS Cache inside of AppData/Local/ as well as clearing everything but the Asset Folder in my unity project (including obj, library, .CSPROJ, .sln files etc.)
But to no success.

Im using .NET 4.x in the project and it builds fine, its just that the VS reference keeps being deleted. so when it comes to "Attaching to Unity" i can't execute until i re-assign the "temporary" assembly reference.

I've tried updating VS, Reinstalling it as well as unity 2018.2.1 and Unity2018.2.2 to no success.

I'm all ears.

UPDATE: Problem has been fixed in 2018.3

sentences:
Avoiding orbiting in pursuit steering behavior I have a missile that does pursuit behavior to track (and try and impact) its (stationary) target.

It works fine as long as you are not strafing when you launch the missile.  If you are strafing, the missile tends to orbit its target.

I fixed this by accelerating tangentially to the target first, killing the tangential component of the velocity first, then beelining for the target.

So I accelerate in -vT until vT is nearly 0.  Then accelerate in the direction of vN.

While that works, I'm looking for a more elegant solution where the missile is able to impact the target without explicitly killing the tangential component first.

sentences:
Multiplayer turn based Android/iOS We're developing a mobile endless runner game, on Unity3d where you can challenge your Facebook friends. The only interaction between the players is the challenge - one player challenges the other, then each player plays when he wants, and after both players finish (when their character dies), their scores are compared to determine the winner.
What system would you recommend that would allow us to implement this functionality, considering scalability, cost and ease of use?
Thanks in advance!

sentences:
What are the steps to get sound from reality into a game? As we all know, the game is not only about gameplay, sound effects add a lot to the production value. The more unique, the better the result.

What are the steps to get a decent quality sound from reality into a game environment?

And some tips probably, as whether I should cover multiple cases of the "sound": normal, echo and other. Or this can/should be done within the engine itself, or post-processed after normal sound?

sentences:
How can I imitate interaction and movement in Diablo II? I'm prototyping a simple browser-based game. It's played from a top down perspective on a 2d canvas.

You left-click on a point on the map, and your character will begin walking to it. If you click on a different point on the map, then your character will begin walking to the new point.

It's similar to Diablo II. (a demonstration video)

How can I best imitate this movement system for a player? Ideas...

Track current coords and target coords
If target coords are exactly up, left, right, or down, then increment appropriate direction until you get there
Implied else: target coords are in a quadrant. To make this movement look natural, character will have to move diagonally. For example, pretend the target is to the northeast. For each game frame, alternate incrementing current coordinates in the north and then east directions.

sentences:
How can I unpack a sprite sheet into multiple images? I need to take a sprite sheet and convert it into multiple images, one for each frame of the sprite sheet.

How should I go about this? I would prefer an offline method or a tool to do so -- I found Alferd SpriteSheet Unpacker, but it is really slow on Windows 7 and does not seem to respond well at all.

sentences:
how can I rotate a tetrahedron's vertices so that it's pointing straight up? I am trying to render an Equilateral triangle in 3D, and I came across this answer:
https://math.stackexchange.com/a/562895/15497
So based off of that, I made my vertex points:
(1, 1, 1),
(1, -1, -1),
(-1, -1, 1),
(-1, 1, -1),

This looks great when I draw lines across these points, however the triangle is not pointing straight up as I would like it to.  I am trying to understand how to calculate the right amount to rotate the X, and Z axis so that it is pointing upwards?

I messed around with rotating the X by PI / 5 and Z by -PI / 5 and got something close:

But that is not right...

sentences:
What is a viable way of finding the minimum swaps to sort numbers in pyramid? I have made a game that consists of a pyramid of hexagons with numbers from 00 to 99 randomly positioned in groups of 6, 10 or 15 elements. Now, I'm working to create an auto-solver but for the last 2 weeks, I have got nothing really worth produced, and would like your help.
My objective is to determine the minimum swaps need to turn the left pyramid into the right pyramid:

Obviously, there's a catch: every cell can be exchanged only with it's neighbors cells, as below:

I've tried a lot of approaches with binary heap, BST and others, but I can't seems to find a proper answer. What would be the best algorithm choice to determine the minimum swaps needed to sort this hive?

Thanks in advance for any help,

Marcelo

sentences:
How do I fix this access violation when I exit my custom OpenGL game engine? I'm writing an game engine, where the engine is written in a project and exports a .dll file. In another project, in the same solution as the engine, there is a sandbox project which uses the engine. However, there is a bug.

I run the sandbox project in debug mode with the engine dll. When I spam my mouse and keyboard for a few seconds, and close the program via the exit button, the program crashes with an error:

  Exception thrown at 0x00000043 in phantom-sandbox.exe: 0xC0000005: Access violation executing location 0x00000043.If there is a handler for this exception, the program may be safely continued.

I found the source of the bug. Since I'm currently writing the engine for OpenGL, I have to initialize GLEW, and I need to create a HGLRC. If I don't initialize this HGLRC, everything works.

This is not the ideal solution, since I need to use OpenGL for my engine. I went forth without exporting the .dll from the engine, making the engine an application, instead. I made a main.cpp, and wrote it to use the engine, enabling OpenGL rendering. I tried to recreate the bug, but everything works!

I thought it might OpenGL, but then now I'm thinking it might be my engine. How do I fix this?

Here is my code, where it errors:

    int const main_result = invoke_main()

    __telemetry_main_return_trigger(nullptr);

    if(!__scrt_is_managed_app())
        exit(main_result)l

    if(!has_actor) // < this is the line being sent to the call stack
        _cexit();

    __scrt_unititialize_crt(true, false);
    return main_result;
}

__except (_seh_filter_exe(GetExceptionCode(), GetExceptionInformation()))
{
    int const main_result = GetExceptionCode();

    if(!__scrt_is_managed_app())
        _exit(main_result);

Here is the call stack:

sentences:
Ensure packet owner from connection is the authentic user In a multiplayer game, how can you be sure that the IP from a packet is the real IP? By spoofing I could send, for example, a "suicide packet" which tells the server that the owner of said packet wants to destroy its avatar when in reality I faked it.

Do games just give up on this aspect?

sentences:
1D Terrain Generation in Java Not able to implement Perlin Noise for 1D Random Terrain Generation. I've tried everywhere and I cannot find anything useful, sure I sort of understand Perlin Noise but everytime I try it nothing works. I'm using LibGDX in Java if that helps, thanks.

Here is the code for P.N.

static float Noise(int x) {
    x = (x << 13) ^ x;
    return (float) (1.0 - ((x * (x * x * 15731 + 789221) + 1376312589) & Integer.MAX_VALUE) / 1073741824f);

}

public static float PerlinNoise1D(float x, float persistence, int octaves) {
    float total = 0;
    float p = persistence;
    int n = octaves - 1;

    for (int i = 0; i <= n; i++) {

        float frequency = (float) Math.pow(2, i);
        double amplitude = Math.pow(p, i);
        total += InterpolatedNoise(x * frequency) * amplitude;
    }

    return (int) total;

}

private static float InterpolatedNoise(float x) {
    int integer_X = (int) x;
    float fractional_X = x - integer_X;

    float v1 = SmoothNoise1D(integer_X);
    float v2 = SmoothNoise1D(integer_X + 1);

    return CosineInterpolate(v1, v2, fractional_X);

}

public static float CosineInterpolate(float a, float b, float x) {
    float ft = (float) (x * Math.PI);
    float f = (float) ((1 - Math.cos(ft)) * 0.5);

    return a * (1 - f) + b * f;
}

public static float SmoothNoise1D(int x) {
    return Noise(x) / 2 + Noise(x - 1) / 4 + Noise(x + 1) / 4;
}

and here is the code for the for loop used to render the tiles (assuming my tiles are 32px x 32px)

for (int i = 0; i < Gdx.graphics.getWidth(); i++) {
    float y = PerlinNoise1D(i, 5f, 3);
    for (int j = (int) (y); j < Gdx.graphics.getHeight(); j++) {
        hudBatch.begin();
        hudBatch.draw(hp, i, j);
        hudBatch.end();
        j+=31;
    }
    i+=31;
}

P.S I'm sort of trying to create a terraria-like game.

sentences:
"Blinking" graphical bug when rotating shadow matrix So, we have implemented Krypton shadows into our code for our 2D game, and it's working beautifully. Only issue is that we're running into a bizarre graphical bug when rotating the shadows with the world on the Z axis.

As of right now, the shadows are perfect, until we get to a 45 + 90n degree (45, 135, 225, ... etc, all the "diagonal" angles). At this diagonal angle, the shadow's collapse on the X or Y axis, causing a "blink" effect. We are unsure if this is something inherent with rotating matrices (which Krypton uses) that needs to be worked around, or if this is a bug related to Krypton (and whether or not it can be worked around).

Video Example Of Bug on Youtube

You can find our draw code below. The bool "useFakeFPSPerspective" is used to display this rotating perspective, which has the graphical bug. Our normal perspective does not come across this issue, as it has a fixed angle.

protected override void Draw(GameTime gameTime) {
        //Create a world view projection matrix to use with krypton.
        var world = Matrix.Identity;
        var viewVector = new Vector3(graphics.PreferredBackBufferWidth / 2, -graphics.PreferredBackBufferHeight / 2, 0f) * -1f;
        viewVector.X = -player.LevelPosition.X;
        viewVector.Y = player.LevelPosition.Y;
        var view = Matrix.CreateTranslation(viewVector);

        Matrix? rotateZ = null, shift = null;
        if (useFakeFPSPerspective) {
            var pos = player.Size / 2f;
            viewVector.X -= pos.X;
            viewVector.Y += pos.Y;
            view = Matrix.CreateTranslation(viewVector);

            viewVector.X = pos.X;
            viewVector.Y = -pos.Y;
            shift = Matrix.CreateTranslation(viewVector);

            var mouseState = Mouse.GetState();
            rotateZ = Matrix.CreateRotationZ((float) mouseState.X / -90); //rotates on Z axis (which points "outward", instead of up/down or left/right)
        }

        var projection = Matrix.CreateOrthographic(graphics.PreferredBackBufferWidth, graphics.PreferredBackBufferHeight, 0f, 1f);

        //Assign the matrix and pre-render the lightmap.
        //Make sure not to change the position of any lights or shadow hulls after this call, as it won't take effect till the next frame!

        var shadowMatrix = view;
        if (useFakeFPSPerspective) shadowMatrix *= (Matrix) rotateZ * (Matrix) shift;
        Krypton.Matrix = shadowMatrix * world * projection;
        Krypton.Bluriness = 3;
        Krypton.LightMapPrepare();

        GraphicsDevice.Clear(ClearColor);

        SpriteBatch.Begin();

        level.draw();

sentences:
Starcraft II Galaxy Editor - Eventdefinition I can create an Action with parameters using an Actiondefintion.

But how can I create an Eventdefinition ? I'd like to make an Event that is 'called' when a Unit, that is saved in a variable, dies. Like an Event called 'My unit dies'.

The  desired behavior is the following:

Called when a unit defined in a variable dies
the deceased unit should be returned by 'Triggering Unit()'
the owning player of the deceased unit should be returned by 'Triggering Player()'

I hope you get my point,
Thanks

sentences:
XNA - Error while rendering a texture to a 2D render target via SpriteBatch I've got this simple code that uses SpriteBatch to draw a texture onto a RenderTarget2D:

private void drawScene(GameTime g)
{
    GraphicsDevice.Clear(skyColor);
    GraphicsDevice.SetRenderTarget(targetScene);
    drawSunAndMoon();
    effect.Fog = true;
    GraphicsDevice.SetVertexBuffer(line);
    effect.MainEffect.CurrentTechnique.Passes[0].Apply();
    GraphicsDevice.DrawPrimitives(PrimitiveType.TriangleStrip, 0, 2);
    GraphicsDevice.SetRenderTarget(null);
    SceneTexture = targetScene;
}

private void drawPostProcessing(GameTime g)
{
    effect.SceneTexture = SceneTexture;
    GraphicsDevice.SetRenderTarget(targetBloom);
    spriteBatch.Begin(SpriteSortMode.Immediate, BlendState.Opaque, null, null, null);
    {
        if (Bloom) effect.BlurEffect.CurrentTechnique.Passes[0].Apply();
        spriteBatch.Draw(
            targetScene,
            new Rectangle(0, 0, Window.ClientBounds.Width, Window.ClientBounds.Height),
            Color.White);
    }
    spriteBatch.End();
    BloomTexture = targetBloom;
    GraphicsDevice.SetRenderTarget(null);
}

Both methods are called from my Draw(GameTime gameTime) function. First drawScene is called, then drawPostProcessing is called.

The thing is, when I run this code I get an error on the spriteBatch.Draw call:

  The render target must not be set on the device when it is used as a texture.

I already found the solution, which is to draw the actual render target (targetScene) to the texture so it doesn't create a reference to the loaded render target.

However, to my knowledge, the only way of doing this is to write:

GraphicsDevice.SetRenderTarget(outputTarget)
SpriteBatch.Draw(inputTarget, ...)
GraphicsDevice.SetRenderTarget(null)

Which encounters the same exact problem I'm having right now.

So, the question I'm asking is: how would I render inputTarget to outputTarget without reference issues?

sentences:
Can I use a genetic algorithm for balancing character builds? I'm starting to build a online PVP (duel like, one-on-one) game, where there is leveling, skill points, special attacks and all the common stuff. Since I have never done anything like this, I'm still thinking about the math behind the levels/skills/specials balance.

So I thought a good way of testing the best builds/combos, would be to implement a Genetic Algorithm. It'd be like this:

Generate a big group of random characters
Make them fight, level them up accordingly to their victories(more XP)/losses(less XP)
Mate the winners, crossing their builds, to try and make even better characters
Add some more random chars, emulating new players
Repeat the process for some time, or util I find some chars who can beat everyone's butt

I could then play with the math and try to find better balances to make sure that the top x% of chars would be a mix of various build types.

So, is it a good idea, or is there some other, easier method to do the balancing?

Edit: Interesting thoughts in all those answers, still waiting to mark just one as resolved. I can see the problem with the AI implementation, but in my specific case, the AI is pretty straightforward. It'll be based directly on the opponent build and chosen parameters for the duel. (The human player will not have access to those info, so can not foresee the enemy stats and strategy). I've read a topic about testing, and I think I'll starting with simple automated tests and in the future evolve it to a genetic algorithm.

sentences:
get the value of lerp at the mouse position? I want to get the value t (value of lerp ()) between two lines
and the position of the mouse and draw a gray line that goes from line a to line b.
what is the value of lerp at the mouse position?

sentences: How to have 3d multiple planet gravity in unity c#? Im using unity and I want to make a game where you can walk around small planets and the further away you get, the weaker the gravity, so you can go to other planets. All the tutorials so far only work with one planet, how do I code this? Is there anything I can download that does it for me?

sentences:
texture won't move OpenGL ES 2.0 I want be able to move my texture in GLSL I have set my texture to wrap S and wrap T but not sure why it wont move

my fragment shader looks like this at the moment

uniform sampler2D  n_mapTex;
uniform sampler2D  n_mapTex2;

varying mediump vec2  TexCoord;
varying mediump vec2  TexCoord2;

//This gets updated within the main code
uniform mediump float vTime;

void main()
{

    gl_FragColor =  texture2D(n_mapTex, vec2(TexCoord.x + vTime, TexCoord.y + vTime));
}

within my code I have a made a function to calculate FPS and I use the delta time of that function to pass into the fragment shader

void OGLESIntroducingPVRTools::timer(){
/*This method records to the time to start rendering a frame and hold that value
in another variable we then start to count again.  To get delta time we subtact
the current time from the previous time this will give us in milliseconds how
long it took for a frame to render.  We then divide this by 1000 this converts
it from ms per frame to FPS*/

FrameCount++;

p_Time = c_Time;
c_Time = PVRShellGetTime();

elapsed = c_Time / 1000.0f;
DT = ((float)(c_Time - p_Time)) / 1000.0f;

fCount += DT;

if(fCount >= 1.0f) //if time is over 1 second reset counters and recount
{
    FPS = FrameCount;
    FrameCount = 0;
    fCount = 0;
}

}

and in my renderscene method which updates I have this code to pass the value to the uniform within the fragment shader

glUniform1i(glGetUniformLocation(m_ShaderProgram.uiId, "vTime"), DT);

sentences:
How can I develop in MonoGame without relying on .xnb files? I'm new to game development, and MonoGame seems like a beginner-friendly framework, so thought I'd start with that. However, as I started reading tutorials on it, I noticed a common theme: That at its current state, MonoGame needs XNA's content compiler since it doesn't have one of its own. The only problem I have with this is because I'm unable to install XNA (followed instructions on the web, even installed the Game Marketplace). I'm on Windows 8.1, by the way.

Long story short, I gave up on trying to install XNA. However, I have played around a bit with MonoGame and found that you can use raw images (.png in my case) instead of those converted to .xnb. I haven't tried sound, so I don't know if it'll work. Or any other assets for the matter.

My question is, is it possible to develop in MonoGame without using .xnb files? Or, is it possible to develop without XNA's content compiler? If yes, then how?

sentences:
Java Slick2d - How to translate mouse coordinates to world coordinates I am translating in my main class render. How do I get the mouse position where my mouse actually is after I scroll the screen

public void render(GameContainer gc, Graphics g) throws SlickException
{
    float centerX = 800/2;
    float centerY = 600/2;
    g.translate(centerX, centerY);
    g.translate(-player.playerX, -player.playerY);
    gen.render(g);
    player.render(g);
}

playerX = 800 /2 - sprite.getWidth();
playerY = 600 /2 - sprite.getHeight();

Image to help with explanation

I tried implementing a camera but it seems no matter what I can't get the mouse position.
I was told to do this worldX = mouseX + camX; but it didn't work the mouse was still off.

Here is my Camera class if that helps:

public class Camera {
public float camX;
public float camY;

Player player;

public void init() {
    player = new Player();
}

public void update(GameContainer gc, int delta) {
    Input input = gc.getInput();

    if(input.isKeyDown(Input.KEY_W)) {
        camY -= player.speed * delta;
    }
    if(input.isKeyDown(Input.KEY_S)) {
        camY += player.speed * delta;
    }
    if(input.isKeyDown(Input.KEY_A)) {
        camX -= player.speed * delta;
    }
    if(input.isKeyDown(Input.KEY_D)) {
        camX += player.speed * delta;
    }
}

Code used to convert mouse

worldX = (int) (mouseX + cam.camX);
worldY = (int) (mouseY + cam.camY);

Tile class

public class TileGen {
Block block;
public Block[] tiles = new Block[2];
public int width, height;
public int[][] index;
int mouseX, mouseY;
int worldX, worldY;
boolean selected;

Image dirt, grass, selection;
SpriteSheet tileSheet;

int startX, startY, stopX, stopY;

Camera cam;
Player player;

public void init() throws SlickException {
    tileSheet = new SpriteSheet("assets/tiles/tileSheet.png", 64, 64);

    grass = tileSheet.getSprite(0,0);
    dirt = tileSheet.getSprite(1,0);
    selection = tileSheet.getSprite(2,0);

    tiles[0] = new Block(BlockType.Grass, new Vector2f(0,0), grass, true);
    tiles[1] = new Block(BlockType.Dirt, new Vector2f(0,0), dirt, true);

    width = 50;
    height = 50;

    index = new int[width][height];

    cam = new Camera();
    player = new Player();

    Random rand = new Random();
    for (int x = 0; x < width; x++) {
        for (int y = 0; y < height; y++) {
            index[x][y] = rand.nextInt(2);
        }
    }
}

public void update(GameContainer gc) {
    Input input = gc.getInput();
    mouseX = input.getMouseX();
    mouseY = input.getMouseY();

    worldX = (int) (mouseX - player.playerX);
    worldY = (int) (mouseY - player.playerY);

    if(input.isMousePressed(Input.MOUSE_LEFT_BUTTON)) {
        selected = true;
    } else {selected = false;}

    for (int x = 0; x < width; x++)
    {
        for (int y = 0; y < height; y++)
        {
            if(IsMouseInsideTile(x, y) && selected) {
                if(tiles[index[x][y]]== tiles[0])
                    index[x][y] = 1;
            }
        }
    }

    startX = (int) (cam.camX/64);
    startY = (int) (cam.camY/64);

    stopX = startX + (gc.getWidth()/64)  + 2;
    stopY = startY + (gc.getHeight()/64) + 2;
    System.out.println(worldX);
}

public void render(Graphics g, GameContainer container) {
    for (int x = startX; x < stopX; x++) {
        for (int y = startY; y < stopY; y++) {
            tiles[index[x][y]].texture.draw(x * 64, y *64);
            if(IsMouseInsideTile(x, y)) {
                selection.draw(x * 64, y * 64);
            }
        }
    }
}

public boolean IsMouseInsideTile(int x, int y)
{
    return (worldX >= x * 64 && worldX <= (x + 1) * 64 &&
            worldY >= y * 64 && worldY <= (y + 1) * 64);
}

}

sentences:
Mathematical equation for CHOMP AI? Players take turns in taking a rectangular bite out of the bottom right corner of the bar, by shading a square, tighter with all the squares below and/ or to the right it. The top left-hand square is poisoned, and the player forced to eat the square loses.

How do I determine who is currently winning while the game is being played?
(Creating the game in Unity using c#)

sentences:
Switch scenes and continue to receive bluetooth stream from Update I have a scene where I'm connected to a BLE device and receive data in bytes. I want to switch scenes from the current Update and continue to receive the data without disconnecting. How should I do this. Here is my current code in Update:

            case States.Subscribe:
                HM10_Status.text = "Subscribing to HM10";

                BluetoothLEHardwareInterface.SubscribeCharacteristicWithDeviceAddress (_hm10, ServiceUUID, Characteristic, null, (address, characteristicUUID, bytes) => {

                    float floatprint = EnterDataQueue(bytes);
                    Debug.Log("floatprint" + floatprint.ToString());
                    HM10_Status.text = "Received Serial: " + floatprint.ToString();
                    //HM10_Status.text = "Received Serial: " + Encoding.UTF8.GetString (bytes);
                });

And the method outside:

static float EnterDataQueue(byte[] bytes)
    {
        ArduinoHM10Test aTest = new ArduinoHM10Test();
        //always load the data byte array in full
        for (int i = 0; i < bytes.Length; i++)
        {
            aTest.myQueue.Enqueue(bytes[i]);
        }

        //Dequeue the queue and check if 4 bytes have been dequeued
        if (aTest.myQueue.Count >= 4)
        {

            byte[] byteArray = new byte[4];
            for (int i = 0; i < byteArray.Length; i++)
            {
                byteArray[i] = aTest.myQueue.Dequeue();
                if (i == 3)
                {
                    break;
                }
            }

            aTest.floatnum = BitConverter.ToSingle(byteArray, 0);
        }

        Debug.Log("floatnum: " + aTest.floatnum.ToString());
        return aTest.floatnum;
        //throw new NotImplementedException();
    }

sentences:
Sprite Kit - containsPoint for SKPhysicsBody? I have a ball bouncing around the screen. I can pick it up and drag it onto a "bucket".

When my touches finish, I use the containsPoint function to check and see if I have dropped the ball onto the bucket.

This works fine, however, I actually want to check whether the ball is dropped onto the bucket node's physics body because my "bucket" is actually just an oval, and so I've applied a physics body which is the same shape as the oval, so that the white space around the oval isn't included in the physics simulation.

I can't seem to find a "containsPoint" function for physics bodies. Can anyone advise on how I'd check for this?

To summarise, I want to drop a node, onto a specific part of another node (or its physics body) and trigger an event.

Thanks in advance.

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:
How do I stop overlapping shapes when collision detected in AndEngine? I am making a very simple demo in AndEngine in which I have three rectangles: rect1, rect2 and rect3 in an ArrayList.

I register onAreaTouch as follows:

 @Override
public boolean onAreaTouched(final TouchEvent pSceneTouchEvent, final float pTouchAreaLocalX,
        final float pTouchAreaLocalY) {

    switch (pSceneTouchEvent.getAction()) {

    case TouchEvent.ACTION_DOWN:
        // this.setScale(1.0f);
        this.mGrabbed = true;
        break;
    case TouchEvent.ACTION_MOVE:
        if (this.mGrabbed) {
            for (int i = 0; i < rectangles.size(); i++) {

                int index = rectangles.indexOf(this);

                if (i != index) {

                    if (this.collidesWith(rectangles.get(i))) {
                        // should not overlap
                    } else {
                        this.setPosition(pSceneTouchEvent.getX() - 90, pSceneTouchEvent.getY() - 90);
                    }
                }
            }
        }
        break;
    case TouchEvent.ACTION_UP:
        if (this.mGrabbed) {
            this.mGrabbed = false;
        }
        break;
    }
    return true;
}

Rectangles are now overlapping with one another. I don't want this behavior, instead I'd like it if rect1 collides with rect2 then rect1 should not move further, but can move in any other direction.

[Cross-Posted here]

sentences:
Bitmap Font Displays in Center Always Without Coding it Manually (Fix Coordinate Problem onText) Is there a way on how to stay the texts in center without manually coding it or something, especially when making an update? I'm making a display for the highest score. Let's say that the score is 9. However, if the score is 9,999,999, the text displays still only at the fixed X and Y coordinate. Is there really a way to stay the text in center especially when there is changes when a player beats the new world record?

Here's my code inside Sprite Batch:

        font.setScale(1.5f);
        font.draw(batch, "HIGHEST SCORE:", (900/10)*1 + 60, (1280/16)*10);
        font.draw(batch, "" + 9999999 + "", (900/10)*4, (1280/16)*8);

        batch.draw(grid_guide, 0, 0, 900, 1280); // --> For testing purpose only.

        // Where 9999999 is a new record score for example.

Here's the image shown as example. I add it some red grid so that I could check if the display of score when updated will always display on center no matter how many digits takes place in. However, it is fixed, so I have to figure it out how to display it automatically on center regardless of the number of digits while updating for the new highscore. I have used the LibGDX preferences very well though to save and load records for the highscore.

sentences:
Why do most game devs prefer OGL for OS X and D3D for Windows? Today I decided to check what Diablo 3 developers used to do graphics: OpenGL or Direct3D? My mind was completely blown: For Windows, they've used D3D and for OS X they've used OGL.

I did some research and found that most game developers prefer the same method. This choice doesn't make sense to me. Writing one game engine with OpenGL for OS X and then rewriting same for Windows with D3D seems a lot of unnecessary work. Wouldn't it be easier to just take OpenGL and make a game engine that works on both operating systems?

sentences:
Heightmap, how can i prevent bad odd numbers I am building my world-editor for my game. I've noticed, that, no matter how i implement the heightmap, i'll end up with dumb odd numbers in calculations.

For example, lets take a HeightMap of 4x4 which covers a area of 2x2 OpenGL-Units. Thats a small image which shows the problem. The black lines and numbers represent units in OpenGL, the red lines and numbers repesent pixel/values on my heightmap.

You can easily see, that in the top image, every number is really odd and i actually need a lot of additional code to calculate everything correctly (OpenGL-position -> heightmap-pixel and heightmap-pixel -> OpenGL-position).

In the bottom image however, i am missing height-values for the right and the bottom row of vertices.

I thought i could just use +1 pixel for every heightmap, this would solve this problem but i am sure it will introduce problems at other ends.

How would you guys handle this?

As stated in the comments, the real problem here is, that i need to calculate OpenGL-position -> heightmap-position and OpenGL-range -> heightmap-range fairly often to draw on the heightmap and the math gets really hard to handle with the mapping as seen in the top-image.

sentences:
How should I cycle my game to be more scalable? I'm trying to improve my game emulator so it can handle more users. I currently have one separate thread and execute all processing there.

The cycles processes players and rooms, rooms are individual maps that users can belong to, with other users where they can walk, talk and interact with each other

Currently my game server starts having issues where there are more than 2,000 users online, or when a single room has more than 60 users inside it.

Here is the main game cycle

private Task _gameCycle;
private int _cycleSleepTime = 25;

public Game()
{
    _cycleActive = true;

    _gameCycle = new Task(GameCycle);
    _gameCycle.Start();
}

private void GameCycle()
{
    while (_cycleActive)
    {
        Root.GetGame().GetRoomManager().OnCycle();
        Root.GetGame().GetPlayerManager().OnCycle();

        Thread.Sleep(_cycleSleepTime);
    }
}

RoomManager's OnCycle:

var sinceLastTime = DateTime.Now - _cycleLastExecution;

if (sinceLastTime.TotalMilliseconds >= 500)
{
    _cycleLastExecution = DateTime.Now;

    foreach (var room in _rooms.Values.ToList())
    {
        if (room.isCrashed)
        {
            continue;
        }

        if (room.ProcessTask == null || room.ProcessTask.IsCompleted)
        {
            room.ProcessTask = new Task(room.ProcessRoom);
            room.ProcessTask.Start();
            room.IsLagging = 0;
        }
        else
        {
            room.IsLagging++;

            if (room.IsLagging >= 30)
            {
                room.isCrashed = true;
                UnloadRoom(room.Id);
            }
        }
    }
}

PlayerManager's OnCycle:

if (_clientPingStopwatch.ElapsedMilliseconds >= 30000)
{
    _clientPingStopwatch.Restart();

    var toPing = new List<IGameClient>();

    foreach (var client in _clients.Values.ToList())
    {
        if (client.GetConnection().PingCount < 6)
        {
            client.GetConnection().PingCount++;

            toPing.Add(client);
        }
        else
        {
            lock (_timedOutConnections.SyncRoot)
            {
                _timedOutConnections.Enqueue(client);
            }
        }
    }

    var start = DateTime.Now;

    foreach (var client in toPing.ToList())
    {
        try
        {
            client.SendPacket(new PongComposer());
        }
        catch
        {
            lock (_timedOutConnections.SyncRoot)
            {
                _timedOutConnections.Enqueue(client);
            }
        }
    }
}

if (_timedOutConnections.Count < 1)
{
    return;
}

lock (_timedOutConnections.SyncRoot)
{
    while (_timedOutConnections.Count > 0)
    {
        IGameClient client = null;

        client = (IGameClient)_timedOutConnections.Dequeue();

        if (client != null)
        {
            client.Disconnect();
        }
    }
}

Each room has its own task (thread). It processes a lot, user movement, chat messages, items, status updates. I figured rather than waiting for each room to process in RoomManager's OnCycle, use a new thread and try to process multiple at the same time, after all the server is multi-core.

Room's ProcessRoom

public void ProcessRoom()
{
    if (isCrashed || mDisposed)
    {
        return;
    }

    try
    {
        if (GetRoomUserManager().GetRoomUsers().Count == 0)
        {
            IdleTime++;
        }
        else if (IdleTime > 0)
        {
            IdleTime = 0;
        }

        if (Promotion != null && Promotion.HasExpired)
        {
            EndPromotion();
        }

        if (IdleTime >= 60 && Promotion == null)
        {
            Root.GetGame().GetRoomManager().UnloadRoom(Id);
            return;
        }

        GetRoomItemHandler().OnCycle();
        GetRoomUserManager().OnCycle();
        GetRoomUserManager().SerializeStatusUpdates();
        GetWired().OnCycle();
    }
    catch (Exception e)
    {
        _logger.Exception(e);
        OnRoomCrash(e);
    }
}

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:
Why is everything lit by default? I am following the unity tutorial here and when i drag my environment into the Hierarchy everything i already lit up on my Game view, i noticed this was also the case in the Space Shooter tutorial that i followed before this but i ignored it. Does Unity5 automatically light up things for you if you don't have any lights? I tried setting the ambient Intensity to zero but it literally changes nothing. When i drag in the lighting prefab it also doesn't seem to do much because the scene was already lit up somewhat.

It is still dark but it isn't pitch black like it should be in the Game view.

sentences:
Java Slick2d particles error When i run the game particles crash the game, im not sure what am i doing wrong because the program doesnt tell me. But i know particles are causing this , if i remove the code in update code at bottom, the runnable jar works fine.

Particle class : http://pastebin.com/ATLN6qzR

Particle manager : http://pastebin.com/vAk1nwmi

Slick 2d docmentation : http://www.slick2d.org/javadoc/

It says error is here where the for starts

public void update(int delta){

    for (Particle o: particleList) {
        if(o.emitter.completed() == true){
            particleList.remove(o);
        }
        else{
            o.system.update(delta);
        }

    }
}

sentences:
Keeping a object(world space canvas) always in the cameras viewport So I have the following problem: I have a world space canvas following a arrow that moves around the screen. The canvas itself is just a child of the arrow. The problem is that sometimes when the arrow is pointing to something on the edge of the screen parts of the canvas go off screen. I want to write some code that keeps the entire canvas inside the viewport at all times. I found a solution online but this keeps the pivot point of the object inside the camera bounds and not the whole object. I simply cant figure out how to keep the whole object inside the camera bounds. Here is the code I have :

void LateUpdate()
{
  transform.rotation = rotation;// This simply keeps the objects original rotation independant from the parent
  Vector3 pos = Camera.main.WorldToViewportPoint(transform.position);
  pos.x = Mathf.Clamp01(pos.x);
  pos.y = Mathf.Clamp01(pos.y);
  transform.position = Camera.main.ViewportToWorldPoint(pos);
}

Edit: this is how it looks with the first answer:
The gif is too large to upload so here is a link to it.

sentences:
Unity get component throwing NullReferenceException only in standalone build I'm having a very frustrating issue with GetComponent().

private void Show()
{
    var transition = GetComponent<TransitionAnimation>();

    Debug.Log($"Transition: {transition}");
    transition?.FadeIn();
}

In the editor, this works just fine. transition is not null and FadeIn() is called. In the standalone build, GetComponent() returns null, throws a NullReferenceException, and execution stops before it can even print transition to the console.

This is the output from the log file.

Uploading Crash Report
NullReferenceException
  at (wrapper managed-to-native) UnityEngine.Component.get_gameObject(UnityEngine.Component)
  at UnityEngine.Component.GetComponentInChildren (System.Type t, System.Boolean includeInactive) [0x00001] in <e314adc5a7494b5f8760be75461a94d4>:0
  at UnityEngine.Component.GetComponentInChildren[T] (System.Boolean includeInactive) [0x00001] in <e314adc5a7494b5f8760be75461a94d4>:0
  at Winglett.RR.UI.Gradient.Show () [0x00001] in /Users/redacted/Documents/repos/radical-relocation/Assets/_Core/Scripts/UI/Gradient.cs:63
  at (wrapper delegate-invoke) <Module>.invoke_void()
  at Winglett.RR.Gameplay.GameState.SetPause () [0x00001] in /Users/redacted/Documents/repos/radical-relocation/Assets/_Core/Scripts/Gameplay/GameState.cs:46
  at Winglett.RR.Gameplay.GameState.SetPause_STATIC () [0x00000] in /Users/redacted/Documents/repos/radical- relocation/Assets/_Core/Scripts/Gameplay/GameState.cs:70
  at Winglett.RR.UI.Wrapper.SetGameStatePause () [0x00000] in /Users/redacted/Documents/repos/radical-relocation/Assets/_Core/Playground/ui/Wrapper.cs:27
  at UnityEngine.Events.InvokableCall.Invoke () [0x00011] in <e314adc5a7494b5f8760be75461a94d4>:0
  at UnityEngine.Events.UnityEvent.Invoke () [0x00023] in <e314adc5a7494b5f8760be75461a94d4>:0
  at Winglett.RR.Utils.ESCButton.Update () [0x00026] in /Users/redacted/Documents/repos/radical-relocation/Assets/_Core/Scripts/Utilities/Other/ESCButton.cs:21

I wondered if the issue might be because the gameobject is disabled. So I tried GetComponentInChildren<TransitionAnimation>(true); where true is an overload for inactive gameobjects. This didn't change anything.

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:
Can you sync screen update on vertical retrace with OpenGL? In OpenGL, is there a way to ensure I get exactly, no more nor less, 60 (or whatever rate my monitor is set for) frames per second?

Of course given that the new frame can be calculated in less than 1/60 second.
I was thinking Windows more than Linux or Mac OSX, even though it is interesting to keep an eye on portability.

sentences:
Wall jumping collision detection anomaly I'm creating a game where the player ascends a tower by wall jumping his way to the top. When the player has collided with the right wall they can only jump left and vice versa. Here is my current implementation:

    if(wallCollision() == "left"){
        player.setPosX(0);
        player.setVelX(0);
        ignoreCollisions = true;
        player.setCanJump(true);
        player.setFacingLeft(false);
    } else if (wallCollision() == "right"){
        player.setPosX(screenWidth-playerWidth*2);
        player.setVelX(0);
        ignoreCollisions = true;
        player.setCanJump(true);
        player.setFacingLeft(true);
    } else{
        player.setVelY(player.getVelY() + gravity);
    }

and

private String wallCollision(){
    if(player.getPosX() < playerWidth && !ignoreCollisions)
        return "left";
    else if(player.getPosX() > screenWidth - playerWidth*2 && !ignoreCollisions)
        return "right";
    else{
        timeToJump += Gdx.graphics.getDeltaTime();
        if(timeToJump > 0.50f){
            timeToJump = 0;
            ignoreCollisions = false;
        }
        return "jumping";
    }
}

If the player is colliding with the left wall it will switch between the states left and jumping repeatedly due to the varible ignoreCollisions being switched repeatedly in collision checks. This will give a chance to either jump as intended or simply ascend vertically instead of diagonally.

I can't figure out an implementation that will reliably make sure the player jumps as intended. Does anyone have any pointers?

sentences:
What direction does directional audio come from for a 2D view? In a 3D game, it makes sense that stereo balance is based on the angle between your camera direction and the directionto the audio source.

Is 2D audio just "fudge the left-right balance until it sounds good"? Are there games where the audio balance was still character-oriented rather than view oriented (so a character facing south causes stereo balance to be backwards)?

I'd be interested in answers supported by examples where a notable game was played by blind players using audio cues. The only one that comes to mind is Brood War

sentences:
How to add a falloff (transparency) to projector shader in Unity? I am new to Unity shaders and I was wondering if it was possible to add a falloff variable to control the transparency of the projected color. Here is the shader code :
Shader "Projector/Tattoo" {
    Properties {
        _Color ("Tint Color", Color) = (1,1,1,1)
        _Attenuation ("Falloff", Range(0.0, 1.0)) = 1.0
        _ShadowTex("Cookie", 2D) = "white" {}
    }

    Subshader {
        Tags {
            "RenderType" = "Transparent"
            "Queue" = "Transparent+100"
        }
        Pass {
            ZWrite Off
            Offset -1, -1

            Fog{ Mode Off }

            ColorMask RGB
            Blend OneMinusSrcAlpha SrcAlpha

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

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

            sampler2D _ShadowTex;
            float4x4 unity_Projector;
            float4 _Color;
            float _Attenuation;

            v2f vert(appdata_tan v)
            {
                v2f o;
                o.pos = UnityObjectToClipPos(v.vertex);
                o.uv = mul(unity_Projector, v.vertex);
                return o;
            }

            half4 frag(v2f i) : COLOR
            {
                half4 tex = tex2Dproj(_ShadowTex, i.uv);
                tex.a = 1 - tex.a;
                if (i.uv.w < 0)
                {
                    tex = float4(0,0,0,1);
                }
                tex = _Color * tex;
                return tex;
            }
            ENDCG
        }
    }
}

sentences:
Is there still a market for 2D games? Do 2D games still sell well? Assume it has nice visuals and good game-play.

I want to make games and want to start with 2D, but I am a bit hesitant, I have more than 8 years experience with 3D applications like Maya and other software, but not games. I'd like to know if it's worth the time investment to make 2D games.

sentences:
2D Map Chunks - Individual Files? I have a 2D map of 500 x 500 tiles, split into chunks of 256 x 256.

I'm saving each chunk as a separate file, and I have them loading in as the player moves around. This means however there's over 1024 chunk files currently- and more to come when I increase the map.

Is this normal practice? I have no stutters when the game streams map loads or anything.

sentences: How would a sprite spawn more sprites under themself every second? I am making a snake game and am having trouble to make the snake go longer, at the moment when I run the program, I just have the snake head eating apples. But I want the snake head(30x30) to spawn body parts(20x20) under himself every second. After I can do that, the snake head has to draw 4 body parts and the computer must "delete" the oldest body part before a new one spawns. It is a 2d game, and the snake can curve instead of 90 degree turns. I hope you will all understand.

sentences:
Move a 2D square on y-axis on Android GLES2 I am trying to create a simple game for Android. To start, I am trying to make the square move down the y-axis, but the way I am doing it, it doesn't move the square at all and I can't find any tutorials for GLES20.

The onDrawFrame function in the render class updates the user's position based on acceleration due to gravity, gets the transform matrix from the user class which is used to move the square down, then the program draws it.

All that happens is that the square is drawn; no motion happens:

public void onDrawFrame(GL10 gl)
{
    user.update(0.0, phy.AccelerationDewToGravity);
    GLES20.glClear(GLES20.GL_COLOR_BUFFER_BIT | GLES20.GL_DEPTH_BUFFER_BIT); // Re draws black background

    GLES20.glVertexAttribPointer(maPositionHandle, 3, GLES20.GL_FLOAT, false, 12, user.SquareVB);//triangleVB);
    GLES20.glEnableVertexAttribArray(maPositionHandle);
    GLES20.glUniformMatrix4fv(maPositionHandle, 1, false, user.getTransformMatrix(), 0);

    GLES20.glDrawArrays(GLES20.GL_TRIANGLE_STRIP, 0, 4);

}

The update function in the player class is

public void update(double vh, double vv)
{
    Vh += vh; // Increase horrzontal Velosity
    Vv += vv; // Increase vertical velosity

    //Matrix.translateM(mMMatrix, 0, (int)Vh, (int)Vv, 0);
    Matrix.translateM(mMMatrix, 0, mMMatrix, 0, (float)Vh, (float)Vv, 0);
}

sentences:
Player being covered by glClearColor? Here is a video of the problem: https://www.youtube.com/watch?v=6vnDOB1Vk4o (this is the game I've been making for fun/practice).

You notice, in the beginning of the video, I walk off the map and into the black. When I do so the black covers the player.

I draw the player last in my code:

 // Draw the player & the world
public void draw(Graphics g, Graphics graphics, GameStateManager gsm) {
    glClearColor(0, 0, 0, 0);
    System.out.println(player.getPlayerX() + " - " + player.getPlayerY());
    glViewport(-(int)player.getPlayerX() + 350, -(int)player.getPlayerY() + 300, Display.getWidth(), Display.getHeight());
    worldGen.worldGenerator();
    // Draw the player to the screen (60, 60)
    player.draw();

}

sentences:
Can this script be edited to create a "shotgun" type spread when firing? [Top down shooter] I have this code and I'd like to add a shotgun to the game by slightly modifying the code. I've looked online for any example but everything I find is for FPS not a TDS.

void Shoot ()
{
    timer = 0f;

    gunAudio.Play ();

    gunLight.enabled = true;

    gunParticles.Stop ();
    gunParticles.Play ();

    gunLine.enabled = true;
    gunLine.SetPosition (0, transform.position);

    shootRay.origin = transform.position;
    shootRay.direction = transform.forward;

    if (Physics.Raycast (shootRay, out shootHit, range, shootableMask))
    {
        EnemyHealth enemyHealth = shootHit.collider.GetComponent <EnemyHealth> ();
        if(enemyHealth != null)
        {
            enemyHealth.TakeDamage (damagePerShot, shootHit.point);
        }
        gunLine.SetPosition (1, shootHit.point);
    }
    else
    {
        gunLine.SetPosition (1, shootRay.origin + shootRay.direction * range);
    }
}

I have a basic understanding of most of this code. I don't quite understand how shootRay.direction understands transform.forward means always the front of player. As DMGregory stated adding a variable of some sort that runs through a for loop firing multiple different angles (or simply different coordinates if making angle rays is over my head) is the route I first thought of but I cannot find a way to implement it. I'm having issues with understanding how to manipulate ray coordinates because they cannot be changed by floats which is the extent of my current knowledge of problem solving.

sentences:
Syntax error in multi-pass Surface Shader I'm trying to make a Surface Shader that uses multiple passes, with two different blending functions for each one, but I get the following error I don't understand:

  Parse error: syntax error, unexpected TOK_PASS, expecting TOK_SETTEXTURE or '}' at line 28

SubShader
{
    ZWrite Off
    Tags { "QUEUE"="Transparent" "IGNOREPROJECTOR"="true" "RenderType"="Transparent" "PreviewType"="Plane" }
    Pass
    {
        //transparency
        Blend SrcAlpha One
        CGPROGRAM
            #pragma surface surf Lambert
            #pragma target 3.0
            struct Input
            {
                //
            };
            sampler2D //;
            void surf (Input IN, inout SurfaceOutput o)
            {
                //
            }
        }
     ENDCG
    }
    Pass
    {
         //alphabend
        Blend SrcAlpha OneMinusSrcAlpha
        CGPROGRAM
        #pragma surface surf Lambert
        #pragma target 3.0

         sampler2D//;
         fixed4 //;

         struct Input
         {
          //;
         };
         void surf(Input IN, inout SurfaceOutput o)
         {
         //
         }
        ENDCG
    }
}

sentences:
ArrayList of Entites Random Movement I have an arraylist of entites that I want to move randomly. No matter what I do, they won't move. Here is my female class:

import java.awt.Graphics2D;
import java.awt.Image;
import java.awt.Rectangle;
import java.util.Random;

import javax.swing.ImageIcon;

public class Female extends Entity {
static int femaleX = 0;
static int femaleY = 0;
double walkSpeed = .1f;
Random rand = new Random();
int random;
int dir;

Player player;

public Female(int posX, int posY) {
    super(posX, posY);

}

public void update() {
    posX += femaleX;
    posY += femaleY;

}

public void draw(Graphics2D g2d) {
    g2d.drawImage(getFemaleImg(), posX, posY, null);
    if (Player.showBounds == true) {
        g2d.draw(getBounds());
    }
}

public Image getFemaleImg() {
    ImageIcon ic = new ImageIcon("res/female.png");
    return ic.getImage();
}

public Rectangle getBounds() {
    return new Rectangle(posX, posY, getFemaleImg().getHeight(null),
            getFemaleImg().getWidth(null));
}

public void moveFemale() {
    random = rand.nextInt(3);
    System.out.println(random);

    if (random == 0) {
        dir = 0;
        posX -= (int) walkSpeed;
    }
}

}

And here is how I update the female class in the main class:

public void actionPerformed(ActionEvent ae) {
    player.update();

    for(int i = 0; i < females.size(); i++){
        Female tempFemale = females.get(i);
        tempFemale.update();
    }
    repaint();
}

If I do something like this(in the female update method):

public void update() {
    posX += femaleX;
    posY += femaleY;

    posX -= walkSpeed;

}

The characters move with no problem. Why is this?

sentences:
How can I handle delayed function calls? I have objects, and each object has a function pointer that will be assigned a function. When the object is clicked, the assigned function will be called.
I want to have a function do things with delay, meaning it would look something like this:

void function() {
    doSomething();
    wait(1000);     // either 1000 frames, or 1000 miliseconds
    doSomethingElse();
}

I heard threading shouldn't be abused, and main script should all be put in the same thread. There are lots of game engines out there that can handle such functions with a delay in time. My idea was to call the function in a new thread every time.

Is this a bad idea? If it is, how else would I manage to achieve this functionality?

Edit: the website asked to confirm it's not a duplicate question and I think it's not because it's a bit more complicated of an issue, even though it may use a similar solution.

sentences:
How can I make the terrain infinte? I am making a game in Unity 5 in C# and I need to make the terrain infinite. I have tried to make it infinite but it just keeps spawning the terrain too much times and then the game crashes. Does someone know how I can make the terrain infinite? Here is my
code.

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

public class TerrainScript : MonoBehaviour
{
    public Transform PlayerTransform;
    private float SpawnZ = 4139f;
    public GameObject[] prefabs;
    private float RoadLength = 2.2f;
    private int amountRoads = 6;
    private List<GameObject> roadList;

    public void Start()
    {
        roadList = new List<GameObject>();
    }
    public void Update()
    {
        if(PlayerTransform.position.z > (SpawnZ - amountRoads * RoadLength))
        {
            spawnTile(0);
        }
    }

    public void spawnTile(int index)
    {
        GameObject go;
        go = Instantiate(prefabs[index]) as GameObject;
        go.transform.SetParent(transform);
        go.transform.position = Vector3.forward * SpawnZ;
        SpawnZ += RoadLength;
    }
}

sentences:
Version 320 is not supported, SDL C++ I have the following four lines before I create the window.

SDL_Init(SDL_INIT_VIDEO);
SDL_GL_SetAttribute(SDL_GL_CONTEXT_PROFILE_MASK, SDL_GL_CONTEXT_PROFILE_CORE);
SDL_GL_SetAttribute(SDL_GL_CONTEXT_MAJOR_VERSION, 3);
SDL_GL_SetAttribute(SDL_GL_CONTEXT_MINOR_VERSION, 2);

My shaders are of #version 320 core but I get these errors, the first from the vertex shader and the second from the fragment shader.

  ERROR: 0:1: '' :  version '320' is not supported
  ERROR: 0:1: '' : syntax error: #version
  ERROR: 0:2: '' :  #version required and missing.
  ERROR: 0:4: '0' : syntax error: integers in layouts require GLSL 140 or later

  ERROR: 0:1: '' :  version '320' is not supported
  ERROR: 0:1: '' : syntax error: #version
  ERROR: 0:2: '' :  #version required and missing.

I am on OS X El Capitan but this setup worked before with Java.

sentences: Is it possible to use true Blinn-Phong lighting on Unity Android/IOS? I've noticed that the Unity's Legacy Shaders/Specular shader does not work on mobiles due to the lighting model being incompatible. I then tried using the Mobile/Bumped Specular shader, but this shader does not support non-directional lights. So I tweaked the mobile specular shader to remove the noforwardadd argument, but I noticed that specular highlights are improperly positioned for non-directional lights, even after removing the halfasview/interpolateview argument. Does Unity even support non-directional specular highlights on mobile devices?

sentences:
Has google increased apk limit from 50mb to 149? I recently seen Angry Birds GO has apk size of 149 on google play, https://play.google.com/store/apps/details?id=com.rovio.angrybirdsgo&hl=en

Yet google says apk size limit is 50 mb.So my question is,has google increased apk size limit from 50 mb?

sentences:
Unity - How to save variables for Android Game? This is my current code, it only work into unity, when i test it in an Android Device it don't save the variable

public class Click : MonoBehaviour{

public UnityEngine.UI.Text proiettiliTotali;
public UnityEngine.UI.Text bpc;
public float proiettili = 0.00f;

void OnEnable(){
        proiettili = PlayerPrefs.GetFloat("Player Score");
}

// Update is called once per frame
void Update () {
    proiettiliTotali.text = ConvertiroreProiettili.Instance.GetCurrencyInString(proiettili, false, false);
    bpc.text = ConvertiroreProiettili.Instance.GetCurrencyInString (proiettiliOgniClick, false, true);
}

public void Clicked () {
    proiettili += proiettiliOgniClick;
}

void OnDisable(){

    PlayerPrefs.SetFloat("Player Score", proiettili);
    PlayerPrefs.Save ();
    Debug.Log (proiettili);
}

sentences:
For creating a distant moon in a 3D game, is it better to use a model or texture? I'm working on my indie game and I want to create a moon (it's a 3D game) however I am unsure if I should create a model and put it far away, or if I should use a texture on a plane and have it constantly move so the face of the plane is facing the player.

The problem I had last time I tried a model is the render view, as the model was really far away (as when I did it very small, you could sort of tell it was a tiny model rather then a far-away moon) and with the texture I'm not sure if it comes across as tacky.

I'd really like to hear the pros and cons of each, since I'm planning to use the 'render objects only when in view' method and basically want advice on which I should go with.

sentences:
Heightmap terrain picking I've implemented an OpenGL based terrain unsing a tesselation-shader for dividing each 'terrain-cell' into the desired tiles.
The heightmap is uploaded to the GPU and applied on the shader.

When it comes to picking, I don't really know what to do.
Testing triangles on intersection with the pick ray is not possible because only the GPU 'knows' the mesh.

Is render to texture with an unique color the way to go?
Or holding an additional mesh in RAM, only for picking/collision?

sentences:
How can I avoid a stack overflow when recursively checking adjacent game objects? I am building a simple game on Unity to learn the system. I am using C#.

The game is a basic "blocks" game, whereby when the player clicks on a block, the block and its neighbours of the same colour all disappear (get destroyed).

My process is this:

To keep a track of which blocks are neighbours of the same colour, on each refresh each block checks their details on the event OnCollisionEnter and adds these collision neighbours to a List of valid neighbouring gameobjects.
When a block is clicked, this list is checked and each neighbour has its own neighbours list checked, after list checking each block is distroyed.

Somehow, this process is causing a StackOverflowException

  StackOverflowException
  UnityEngine.GameObject.GetComponent[setupscript] () (at
  C:/buildslave/unity/build/artifacts/generated/common/runtime/GameObjectBindings.gen.cs:35)
  setupscript.checkNeighbours () (at Assets/scripts/setupscript.cs:86)
  setupscript.checkNeighbours () (at Assets/scripts/setupscript.cs:87)
  setupscript.checkNeighbours () (at Assets/scripts/setupscript.cs:87)
  setupscript.checkNeighbours () (at Assets/scripts/setupscript.cs:87)
  ....

Here is my script, first my List establishment:

 private List<GameObject> neighbours = new List<GameObject>();

Next, here is how the neighbours list is populated:

void OnCollisionEnter (Collision other)
{
    Rigidbody other_rb = other.rigidbody;
    if(rb.velocity.magnitude < 1f && other_rb.velocity.magnitude < 1f
        && other.gameObject.tag == tagName && !neighbours.Contains(other.gameObject)) {
    /***
     * Same tag so add to list of valid neighbours
     ***/
        neighbours.Add(other.gameObject);
    }
}

Now, there are four conditions [above] to check when adding to the list:

Is the current block stationary.
Is the "other" colliding block stationary (so they're at rest next to each other).
do these blocks have the same tag (so they're the same type/colour)
does this block not already exist in this list.

So once all four conditions are met, the block GameObject is added to the List.

( On conditions of OnCollisionExit blocks are removed from the List in a  similar fashion.  )

Now, my CheckNeighbours() script:

public void checkNeighbours(){
    if (neighbours.Count > 0) {
        foreach (GameObject othercube in neighbours) {
            setupscript otherCubeScript = othercube.GetComponent<setupscript>();
            otherCubeScript.checkNeighbours();
        }
    }

    Destroy (gameObject);
}

This should, as far as I understand it, run once through each List element and check that element for any neighbours who match.

As I write this question out I think I'm realising that the issue is that we're in a loop as block 1 references neighbour block 2, which references neighbour block 3, which references neighbour block 1, etc. etc.

But my StackOverflow exception occurs when there are only two blocks, so one refers to the other, refers to the first, etc. But as they should destroy after running the reference, this shouldn't (ideally) be an issue? Do I need to make the checkNeighbour() a Corountine to allow it to not hold up destroying the GameObject?

If this [repetition cycling] is indeed what's going on, what would be the best way of getting each neighbour to be checked only once? Or checking that the GameObject referenced in the List still exists in the game itself?

I have a quick edit here:

foreach (GameObject othercube in neighbours) {
    if (othercube != null){
        setupscript otherCubeScript = othercube.GetComponent<setupscript>();
        otherCubeScript.checkNeighbours();
    }
}

But I'm not sure this will work as I feel this List will purely be a reference rather than the actual GameObject in the level?

sentences:
How to get a Read-Write Reference to Parent GameObject from a script component attached to it? I have a game object(object) with a script component(myscript) attached.

I have a reference to myscript component through getComponent, and I want to change the transform of the gameObject the script is attached to.

myscript.gameObject.transform = (new value);

The above code gives me error,

  Property 'UnityEngine.GameObject.transform' is read only.

Is there a way to get a read-write version?

sentences:
Play and Stop Animation on Condition - Unity I've applied a scale animation on Play button of my game. I want to stop animation when play button is not interactable. It stops playing animation, but animation is not playing again, even when play button gets interactable. Here is my snippet to Play and Stop Animation.

if (!PlayButton.GetComponent<Button> ().IsInteractable()) {
    PlayButtonAnimator.Stop ();
} else if (PlayButton.GetComponent<Button> ().IsInteractable()) {
    PlayButtonAnimator.Play ("Play_Button_Animation");
}

What should i do to play animation again. Thanks in advance :)

sentences:
Masking an area inside/outside a line strip I have some point lights in my game which are just sprites implemented with help of HLSL. Currently I'm trying to implement dynamic shadows and I managed to make the program calculate the area in which the light should be drawn (area that is not behind walls etc).

Here is what it looks like when I draw a line strip between the calculated points:

So I was wondering how I would draw the light sprite only inside that line strip? For example if a pixel is inside that area, then draw it, etc. Can it be done with HLSL (I'm not that good at HLSL), or perhaps I should just do it in XNA?

sentences:
How to create enemy "flash-light" for 2D game? I'm developing a 2D stealth game but I cannot figure out how to create something like a torch (flashlight) that the enemies hold and look around with.Any help?
Also, if relevant, I'm using MonoGame.

sentences:
Array Rectangle Collision Handling Inconsistency XNA 4.0 I made a simple collision detection prototype.Here's the code for the Player class's collision handler:

public void handleCollision(GameObject OtherObject)
    {
        if(this.CollidesWith(OtherObject))
        {
            if(OtherObject is Stage)
            {
                float rightEdgeDistance = OtherObject.BoundRect.X - (Position.X + this.BoundRect.Width);
                float leftEdgeDistance = OtherObject.BoundRect.X + OtherObject.BoundRect.Width - Position.X;

                float TopEdgeDistance = OtherObject.BoundRect.Y - (Position.Y + this.BoundRect.Height);
                float BottomEdgeDistance = OtherObject.BoundRect.Y + OtherObject.BoundRect.Height - Position.Y;

                float Left_Right_SmallerDistance = Math.Min(Math.Abs(rightEdgeDistance), Math.Abs(leftEdgeDistance));
                float Top_Bottom_SmallerDistance = Math.Min(Math.Abs(TopEdgeDistance), Math.Abs(BottomEdgeDistance));

                float smallerDistance = Math.Min(Math.Abs(Left_Right_SmallerDistance), Math.Abs(Top_Bottom_SmallerDistance));

                if (smallerDistance == Math.Abs(leftEdgeDistance))
                {
                    Position.X = OtherObject.BoundRect.X + OtherObject.BoundRect.Width;
                    Velocity.X = 0;
                }
                else if (smallerDistance == Math.Abs(rightEdgeDistance))
                {
                    Position.X = OtherObject.BoundRect.X - this.BoundRect.Width;
                    Velocity.X = 0;
                }
                else if (smallerDistance == Math.Abs(BottomEdgeDistance))
                {
                    Position.Y = OtherObject.BoundRect.Y + OtherObject.BoundRect.Height;
                    Velocity.Y = 0;
                }
                else if (smallerDistance == Math.Abs(TopEdgeDistance))
                {
                    Position.Y = OtherObject.BoundRect.Y - this.BoundRect.Height;
                    Velocity.Y = 0;
                }
            }
        }

and here's my Player class's Input Handler method I made:

public void inputHandler(GameTime gameTime,GameObject OtherObject)
    {
        Velocity = Vector2.Zero;

        if (Keyboard.GetState().IsKeyDown(Keys.W))
            Velocity.Y -= moveSpeed * (float)gameTime.ElapsedGameTime.TotalSeconds;
        if (Keyboard.GetState().IsKeyDown(Keys.S))
            Velocity.Y += moveSpeed * (float)gameTime.ElapsedGameTime.TotalSeconds;
        if (Keyboard.GetState().IsKeyDown(Keys.A))
            Velocity.X -= moveSpeed * (float)gameTime.ElapsedGameTime.TotalSeconds;
        if (Keyboard.GetState().IsKeyDown(Keys.D))
            Velocity.X += moveSpeed * (float)gameTime.ElapsedGameTime.TotalSeconds;

        handleCollision(OtherObject);
        Position += Velocity;
    }

Also here's my Update method In the Main Game Class.

protected override void Update(GameTime gameTime)
    {
        if (GamePad.GetState(PlayerIndex.One).Buttons.Back == ButtonState.Pressed)
            this.Exit();

        for (int i = 0; i < 3; i++)
            player.Update(gameTime, stage[i]);
        powerUp.Update(gameTime,player);
        base.Update(gameTime);
    }

It works, but when I use array it becomes buggy for some elements of the arrays as in the character can still move a bit inside of the rectangle when I press the key to go down and it will stay outside of the top of the rectangle only if I let go of the key and vice versa.

The rectangles are an array of 3. If I were to move and test the 3rd box. It will work perfectly.But if test the 2nd, it will sink in a bit and the 1st a bit more than the 2nd.
I use for loop for the update and draw the array elements. I see that the pattern is, the 1st is the first one to be checked in the Main Update method is will suffer the worst collision handling, while the last one will always be perfect. I tried other ways to handle the collision but to no avail. Why is that? And how can I counter this? Help please!

sentences:
Unity2D Isometric layering I'm developing an Isometric Game but I have problem apply the right layer for make, for example, a wall behind or in front of the Player depending on the Player position.

I'm able of getting works in an orthogonal map relating the y-axis value of an object with his layer but in an isometric map, the y-axis is not aligned with the editor one.

Anyone can help me understand how to manage this?

sentences: how to check previous scene in scene manager in unity 3d I'm trying to make my first game using unity 3d and I'm trying to make a game over the scene that when you press the try again? button it should take you back to the previous scene, I was thinking of just making it with the code SceneManager.GetActiveScene().buildIndex - 1)); then just place one after every level on the build index so that it takes to the previous level that the player was in, but I think this would just increase the file size (Idk if it actually does), so I was wondering if there is a more efficient manner on how to do this so that I could only have one Game Over Scene in the Build Index?

sentences:
Calculate an approximate distance between two rigid bodies or OOB Is there any easy way to get an approximate distance between two OOB?

I searched around and people talk about GJK algorithm, however I don't see it returning the distance between two convex objects even they are not colliding.

I don't need to be exact but just sphere checking is not acceptable in my case. Any ideas?

sentences:
Finding tileX and tileY based on x and y (and vice versa) in isometric 2D view I'm working on 2d Isometric game in ruby and gosu, although my problem is probably universal. My map is saved in 2d array:

@map_tiles[layer][y][x] = tile_id

Each tile is displayed on coordinates:

isoX = (x * @tile_width/2) - (y * @tile_height)
isoY = ((x * @tile_width/2) + (y * @tile_height)) / 2

So it's displayed in "diamond" like way. But I'm having a problem with calculating two things.
- Entity's tile_x and tile_y (on which tile is the entity positioned) when given x and y, and;
- Entity's x and y when I'm sending it's tile_x and tile_y.

One method is pretty much the other one reversed. I tried various methods I found over internet, but either I'm doing something wrong, or I don't understand the instructions correctly. The closest I got is:

@x = (tile_x * 32) - (tile_y*32)
@y = ((tile_x * 32) + (tile_y * 32) / 2)

for finding @x and @y based on tiles (player "teleportation" method), and

@tile_x = ((@x / 32) + (@y / 32)) / 2
@tile_y = ((@y / 16) - (@x / 32)) / 2

But they kinda don't work correctly.
- When I send player to tile position (4, 3), he is displayed at (5, 4), and after recalculating it's tile_x/y position, printing says it is at tiles (3,5)
- When I send player to tile position (3, 4), he is displayed at (4, 5), and after recalculating it's tile_x/y position, printing says it is at tiles (2,5)
- When I send player to tile position (4, 2), he is displayed at (5, 3), and after recalculating it's tile_x/y position, printing says it is at tiles (2,5)

So you can clearly see that something's not right here.

That's pretty much it, thanks in advance. I can post the code on github if it's neccessary, but I reckon the problem lies in what I posted.

sentences: What is a "Gameplay Programmer"? In job descriptions, I often see positions called "Gameplay Programmer."  What do people in that position do?

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:
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:
LibGDX - Box2D: Realistic Light and Layers I'm having some problems with my current game. Short description: It's a 2D game where you have to avoid the lights or you lose HP.

My problem is the following one:

Here is the rendering process:

The background is drawn
The Moon image is drawn
The point light is applied
The collision layer and the images attached to it are drawn
Player is drawn
The foreground image (on the top left and bottom middle)

My problem is that the rendering does not look realistic. I need some help on how I could make the light coming from "behind" the collisions and applying it everywhere.

Thanks for your help.

sentences: Unity Remote screen resolution I just made a game using Unity. However, when I tested the game on unity remote, the resolution or graphic of the game was really low compared to the actual game. Would this change when I deploy the game or do I have to tweak the settings? If I have to tweak the setting, can you guys tell me what to tweak.

sentences:
What is the correct way to use GameObject.Find in Unity? I have been following along with a Lynda.com video course to familiarize with Unity. I am currently attempting to grab a reference to a scene's First Person Controller's transform as follows:

Transform targetObject;

// Use this for initialization
void Start ()
{
    targetObject = gameObject.Find("First Person Controller").transform;
}

And this is within a script/class that inherits from MonoBehaviour. However, this gives the error:

 Static member `UnityEngine.GameObject.Find(string)' cannot be accessed with an instance reference, qualify it with a type name instead

I am sure there is a way to just change the logic and get the desired affect with a different approach.  But I do not understand why this results in an error. It is the same code used by the instructor of the course, and from the Unity Script Reference, I can see that MonoBehaviour inherits a gameObject member which has the Find() method.  So this error is saying there is only one GameObject instance for all MonoBehaviour classes right? But shouldn't I still be able to call it's methods?

I am using Unity 4.1 with C# while the instructor is using 3.5 (with JS) if that helps any.

sentences:
Where can I find documentation or an example of a C/C++ Plugin for FSX I want to make a plugin for FSX in C/C++ but all the examples and documentation forward to the SimConnect Examples for FSX.

I want to access USB-hardware from the plugin and for this reason I'm looking for a way to write a plugin in C/C++ which does not rely on the SimConnect interface.

sentences:
Proper way to update pixel array data For a game that updates a board every frame I am calculating the next arrangement of board, updating pixel array data and render board as 2D texture to quad the size of the screen using OpenGL.
I use:

glTexImage2d(GL_TEXTURE_2D,0,GL_RGBA,tex_width,tex_height,0,GL_BGRA,GL_UNSIGNED_INT_8_8_8_8_REV, &pixel_data.front())

to initialize the texture object and

glTexSubImage2d(GL_TEXTURE_2D,0,0,0,tex_width,tex_height, BGRA,GL_UNSIGNED_INT_8_8_8_8_REV, &pixel_data.front())

to update the texture.

The slowest part of the code is update_pixels() (below) Taking  256x128 elements input array and creating four component pixel array based on that. This function is very slow(45ms) and it seems it should be done differently. What would be the proper way to implement this function?

Update pixel data per frame:

void  update_pixels() {
//update pixels
//std::vector <unsigned char> pixel_data
float state = 0;
size_t it = 0;

for (size_t y = 0; y < board.getWorldHeight(); ++y) {
    for (size_t x = 0; x < board.getWorldWidth(); ++x) {
        state = board.get_state(y * golf_board.getWorldWidth() + x);

        pixel_data[y * board.getWorldWidth() + x + it ] = static_cast<unsigned char>(state * 255);
        ++it;
        pixel_data[y * board.getWorldWidth() + x + it] = static_cast<unsigned char>(state * 255);
        ++it;
        pixel_data[y * board.getWorldWidth() + x + it] = static_cast<unsigned char>(state * 255);
        ++it;
        pixel_data[y * board.getWorldWidth() + x + it] = static_cast<unsigned char>(1 * 255);

    }

}
return;
}

Time measurement:

void render(){
render_frame() //glDrawElements() for quad and scale uniform update takes 0.2ms
generate_states() //new states for board takes 1.3ms
auto t1 = std::chrono::high_resolution_clock::now();
update_pixels(); // create new pixel array, takes 32 ms
auto t2 - std::chrono::high_resolution_clock::now();
float update_time = std::chrono::duration_cast<std::chrono::microseconds>(t2-t1).count() /1000.0f;
//cout <<updae_time
glfwSwapBuffers() //from update pixels to swap takes 13ms
}

sentences:
How to deal with overlapping black parts of Light mask textures? I am using this masking texture for a dynamic lighting effect in my game:

It looks beautiful until two lights begin to overlap:

This is obviously because the textures are overlapping when I draw them to the light map FrameBuffer.

lightFbo.begin();
Gdx.gl.glClear(GL20.GL_COLOR_BUFFER_BIT);
            g.begin();

                for(Entity ent : entities){
                    if(ent instanceof Fireball)g.draw(light,ent.x - tlightSize / 2.5f,ent.y - tlightSize * 0.25f, tlightSize, tlightSize);
                }
            if(p instanceof FireCharacter){
                g.draw(light,p.x - lightSize / 2.5f,p.y - lightSize * 0.25f, lightSize, lightSize);

            }
g.end();
lightFbo.end();

I use the buffer texture from this map when I draw my actual game:'

g.setShader(lightingShader);
g.begin();
lightFbo.getColorBufferTexture().bind(1); //u_lightmap
light.bind(0)//u_texture
//draw things
g.end();

I don't want these to overlap, I want the light circles to merge without the border cutting in front of them. I tried making the black transparent in GIMP on the light texture but that made no difference. Here is the lighting shader:

Vertex Shader

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;
}

Fragment Shader

#ifdef GL_ES
#define LOWP lowp
precision mediump float;
#else
#define LOWP
#endif

varying LOWP vec4 vColor;
varying vec2 vTexCoord;

//texture samplers
uniform sampler2D u_texture; //diffuse map
uniform sampler2D u_lightmap;   //light map (frame buffer texture)

//additional parameters for the shader
uniform vec2 resolution; //resolution of screen
uniform LOWP vec4 ambientColor; //ambient RGB, alpha channel is intensity

void main() {
vec4 diffuseColor = texture2D(u_texture, vTexCoord);
vec2 lighCoord = (gl_FragCoord.xy / resolution.xy);
vec4 light = texture2D(u_lightmap, lighCoord);

vec3 ambient = ambientColor.rgb * ambientColor.a;
vec3 intensity = ambient + light.rgb;
vec3 finalColor = diffuseColor.rgb * intensity;

gl_FragColor = vColor * vec4(finalColor, diffuseColor.a);
}

My only ideas are using Gdx.gl.glSetBlendFunc(); and changing the blending source and dest values.

sentences:
What are the basics of implementing a Goal Oriented AI? I am currently developing a nations / factions simulator on a map with in-depth resource system, population system, important characters system.. and this is where I finally met a real obstacle.

You see, I wish to give important characters a set of actions which their AI will use to achieve goals, goals that will depend on their character type. For example, an important character who spawns because he leads a migration wave will have two goals : to keep himself and his party alive and to reach his destination and start a new "population node" there. Another example : warlords could seek to increase their "power" variable by making plans to get ahead of other warlords through simple actions like giving money to a local lord to help develop his land, etc.. this would take very long to describe in great detail.

As you can see, or at least as I see it, the best AI architecture for this kind of behavior would be a Goal Oriented AI : it would allow me to keep expanding the set of actions characters have to advance their interest and at the same time allow me to easily create new types of important characters.

I have done quite a lot of research, and most of the sources I found explain the same thing clearly, which I understood : GOAP is about having a starting "world state" and through a "path" of actions, get to a desired world state called a "goal".

The thing I couldn't understand is how exactly you can achieve this with actions other than actions which do not require any parameters. I could implement a basic system right now, I think, provided actions can fully run by themself with no external information, and more importantly no knowledge of eachother, because that would break the point of the whole system I believe.

The articles talk about that very vaguely. I've read about a "blackboard" system where information like what is the current target, where to move.. can be stored. But while planning how do you use this ? Where does that information come from ? How do you associate it with "world state" key-value pairs ?

Finally, I found that some people solve this problem, or at least solve it for the movement, by making a FSM over the GOAP, where one of the state is "moving" and the other one is, basically "GOAP". But I do not think this is the best approach and more importantly I'd like not to go with a hybrid if I can.

So if someone would be kind enough to explain the basic concepts of implementing a Goal oriented AI, or at least help me deal with actions that require a parameter, I'd be extremely grateful. If you want me to expand this wall of text I can provide more detail, simply ask.

PS : I use Unity, coding in C# exclusively.

sentences:
How can I make a ball glow and cast light? I want to make my ball glow and cast light on other objects in the scene.
The scene is generated at run time so I believe baking is out of the question.
Emission materials work only when the object casting the glow/light is static.

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:
How to perform a fast ray cylinder intersection test? I need an algorithm in c++ to get the intersection point of a line if there is an intersection. My cylinder is defined by a 3d vector center point, a float height and radius. I don't need to take rotation into consideration at all so I don't need any rotation parameters.
The only one found similar to my needs was this: https://github.com/iceman201/RayTracing/blob/master/Ray%20tracing/Cylinder.cpp
but after implementing it gave me wrong results. All the other ones I found used weird arguments that weren't even close to my desire. So I am pretty stuck now.

sentences:
what is order of implementation of matrix transforms? What is the meaning of Tr*Sh*Ro*Sc =M ?

How is matrix M written to form the graphic transformation :  1st Sc=Scale, 2nd: R=Rotate, 3rd : Sh=Shear 4th: T=Translate ?
Is the matrix  M above written properly in a "post multiplcative" format" T*Sh*R*Sc , but executed  Scale, Rotate, Shear , finaly Translate ?

sentences:
AntTweakBar doesn't register SFML mouse events I'm trying to add GUI for easier level editing in our game engine. We're using SFML for all the basic stuff (window management, input events etc). I've chosen AntTweakBar because it is a well known library with a few examples around. I was following the tutorial at AntTweakBar's website

I was able to draw a simple bar with those example codes. However, mouse events received by SFML are not registered by AntTweakBar's TwEventSDL() function. Here is an example code for Input:

sf::Event event;
while (_pWindow->pollEvent(event))
{
    // Check if the event should be handled by AntTweakBar
    int handled = TwEventSFML(&event, 2, 3); // for SFML version 2.3
    if (!handled){
        switch (event.type)
        {
        case sf::Event::MouseButtonPressed: // To check whether SFML received mouse button events properly
            if (event.mouseButton.button == sf::Mouse::Button::Left){
                std::cout << "Left button pressed" << std::endl;
                std::cout << "x: " << event.mouseButton.x << std::endl;
                std::cout << "y: " << event.mouseButton.y << std::endl;
            }
        }
    }
    else{ //To check whether TwEventSFML received events
        std::cout << "FINALLY!" << std::endl;
    }

When I press buttons, I can see "FINALLY!" showing up. I can also see that my mouse clicks are received by SFML. However, when I click on an AntTweakBar element (be it a button or help section) it doesn't register it. (Also, I can't see "FINALLY!" when I use the mouse).

Any help or ideas will be appreciated.

sentences:
Changing alpha of single pixel value? I'm trying to change the alpha values of a grayscale texture based on some conditions. Essentially if the color value is within some min and max threshold, set the alpha to 0.8, and if it is not within the thresholds, set it to 0 (unable to see) alpha.

Here's my code so far:

    Texture2D UpdateThresholdTexture(Texture2D tex)
    {
        Texture2D texture = new Texture2D(tex.width, tex.height);

        for (int y = 0; y < texture.height; y++)
        {
            for (int x = 0; x < texture.width; x++)
            {
                Color color = tex.GetPixel(x, y);

                bool min = color.grayscale >= minThresh;
                bool max = color.grayscale <= maxThresh;

                if (min && max)
                {
                    color.a = 0.8f;
                    texture.SetPixel(x, y, color);
                }
                else
                {
                    color.a = 0f;
                    texture.SetPixel(x, y, color);
                }
            }
        }
        texture.Apply();
        return texture;
    }

At the moment it's just returning the original texture. Could someone point me in the right direction?

sentences:
Is it cheaper to let each tile have its own collision? I'm just now playing around with Tiled, and I think this is the way I'm going to go to create tilesets for my game maps, but I'm curious about the cost (memory/CPU) difference between setting a collision for a specific tile so that Tiled creates them all individually versus manually drawing collision polys around larger sections by hand.  For instance:

By Tile:

Manual:

There are fewer polygons in the manual draw (4), and it's not terribly difficult to create them, but is there a benefit one way or the other?

sentences:
How to code Time Stop or Bullet Time in a game? I am developing a single-player RPG platformer in XNA 4.0. I would like to add an ability that would make the time "stop" or slow down, and have only the player character move at the original speed(similar to the Time Stop spell from the Baldur's Gate series).
I am not looking for an exact implementation, rather some general ideas and design-patterns.

EDIT:
Thanks all for the great input. I have come up with the following solution

    public void Update(GameTime gameTime)
        {

            GameTime newGameTime = new GameTime(gameTime.TotalGameTime,
 new TimeSpan(gameTime.ElapsedGameTime.Ticks / DESIRED_TIME_MODIFIER));
            gameTime = newGameTime;

or something along these lines. This way I can set a different time for the player component and different for the rest. It certainly is not universal enough to work for a game where warping time like this would be a central element, but I hope it should work for this case. I kinda dislike the fact that it litters the main Update loop, but it certainly is the easiest way to implement it.
I guess that is essentialy the same as tesselode suggested, so I'm going to give him the green tick :)

sentences:
How to physically move a rigid body up the stairs? When an object is controlled by a CharacterController, it is easy to make it climb ramps with a certain slope, or climb steps with a certain height.

When the object is controlled by a RigidBody instead, it can still climb ramps naturally - I just use AddForce and it walks on ramps just like on any other surface. I do not have to add any special logic for a ramp. However, it does not climb stairs. Is there a natural "physical" way to make the RigidBody climb stairs, without explicitly checking that there are stairs ahead?

sentences:
Best way of approach? Mob moving around a section of tiles Think the beginning stages of Metroid, where there would be a turtle-like mob that would move around a section of tiles, normally 1-3 in a line.

What would be the best approach to accomplish this sort of AI?

It seems so simple but its giving me headache.

The solution I've found have been to have a fixed distance for it to move, and changing directions once the distance has been met. This isn't that OOP though.

Another would be have a rectangle made of the section of tiles, and when the bounds of the mob no longer contains the line of rectangle, change directions. This is proving to be harder to implement and only works for rectangular sections, not for abstract "tetris" like sections of tiles.

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 can I create an orthographic display that handles different screen dimensions? I'm trying to create an iPad/iPhone game using GLES2.0 that contains a 3D scene with a heads-up-display/GUI overlaid on the top. However, this problem would also apply if I were to port my game to a computer and run the game in a resizable window, or allow the user to change screen resolutions...

When trying to make the 2D GUI/HUD work I've made the assumption that all I'm really doing is drawing a load of 2D textured 'quads' on the screen and am trying to treat the orthographic projection as an old-style 2D display with 0,0 in the upper left and screenWidth,ScreenHeight in the lower right.

This causes me all sorts of confusion when I rotate my ipad into Landscape mode since I can't work out what to put into my projection and modelview matrices to turn everything around the right way. It also gets messy if I want to support the iPad's large screen, an iPhone or a Retina display since I have to then draw three sets of textures for everything and work out which ones to use.

Should I be trying to map the 2D OpenGL co-ords 1:1 with the screen? While typing out this question it occurs to me that I could keep my origin in the centre, still running -1/+1 along the axes. This would let me scale my 2D content appropriately on the different screen sizes, but wouldn't I end up with the textures being scaled and possibly losing quality?

I'm using OpenGLES 2.0 and have a matrix library that has equivalents to the GLES1.1 glOrthof() and glFrustrum() calls.

sentences:
game button animation lag with Photon Friends, I am making games using photon. But I could not do the delay animation as described in this link.
The action appears to be late on the player according to the ping. Can you give an ideas about this?

sentences:
Circle colliders dont work I have a destination and 2 players.

I want the players to reach the destination and not overlap in the process.

I attached to each player a circle 2D collider and a rigidbody 2D.

Also this script:

using UnityEngine;
using System.Collections;

public class Agent : MonoBehaviour {

    public Transform destination;
    private Vector2 destPostion;
    private Vector2 playerPosition;

    public float rotation = 0;

    Vector2 velocity = Vector2.zero;

    public int maxForce = 5; //rate of acceleration
    public int maxSpeed = 4; //grid squares / second

    //private Rigidbody2D rb;

    void Start () {
        //rb = gameObject.GetComponent<Rigidbody2D>();
        destPostion.x = destination.position.x;
        destPostion.y = destination.position.y;
    }

    // Update is called once per frame
    void FixedUpdate () {
        Vector3 temp = transform.position;
        destPostion.x = destination.position.x;
        destPostion.y = destination.position.y;

        playerPosition.x = transform.position.x;
        playerPosition.y = transform.position.y;
        //Work out the force for our behaviour
        var seek = steeringBehaviourSeek();

        //Apply the force
        velocity = velocity + (seek * Time.deltaTime);

        //Cap speed as required
        var speed = velocity.magnitude;
        if (speed > maxSpeed) {
            velocity = velocity * (4 / speed);
        }

        //Calculate our new movement angle
        rotation = Mathf.Atan2(velocity.x, -velocity.y) * 180 / Mathf.PI;
        transform.rotation = Quaternion.Euler(0, 0, rotation);

        playerPosition = playerPosition + (velocity * (Time.deltaTime));

        temp.x = playerPosition.x;
        temp.y = playerPosition.y;
        transform.position = temp;
        //rb.MovePosition(temp);
    }

    private Vector2 steeringBehaviourSeek() {

        //Desired change of location
        Vector2 desired = destPostion - playerPosition;

        //Desired velocity (move there at maximum speed)
        desired = desired * (maxSpeed / desired.magnitude);

        //The velocity change we want
        var velocityChange = desired - velocity;

        //Convert to a force
        return velocityChange * (maxForce / maxSpeed);
    }
}

The problem is they start moving for a bit and they stop.

Also in the scene when I move them with the mouse they overlap. Any ideas?

sentences:
How would I implement procedurally generated tiles in libgdx? I'm creating a simple top down Zelda-esque game in libgdx, and I want to implement tile-based dungeons that are procedurally generated, similar to this.

Libgdx does have a class called TiledMap which would seem to fit my needs, however documentation outside of the official docs suggests that TiledMaps can only be used in conjunction with .tmx files, or in other words pre-designed maps.
I've done a fair amount of Googling to no avail, so I'm asking here as a last resort hoping that someone has experience using libgdx for dynamically-generated tile maps.

edit: Could I use StaticTiledMapTiles in conjunction with the tutorial I linked to above to achieve my goal?

Thanks!

sentences:
Libgdx: How to replace texture with shaperenderer? I have a method that creates rectangles, it takes a texture

 for (Rectangle rect : rect) {
            game.batch.draw(rectImage, rect.x, rect.y);
        }

The texture is simple, I could just draw it instead. I created for example

shapeRenderer.set(ShapeRenderer.ShapeType.Filled);
shapeRenderer.rect(
        rect.x,
        rect.y,
        rect.width,
        rect.height,
        Color.DARK_GRAY,
);

Now what? game.batch.draw doesn't accept shapeRenderer instead of rectImage and doesn't accept only rect.x, rect.y

I'm just wondering how to call it?

sentences:
Programmatically generated mesh vertex colors not showing up in Unity? I'm sorry if this is an obvious thing to solve but I just can't figure it out...did I miss something...I've generated a mesh and during vertices generation I've also set its colors (and colors32 just in case) by reading those values from a ply file, and afterwards I've added a number of vertex color shaders but none of them will show the vertex point colors in play mode, it's either solid black or just like I added no material to the mesh (which I've tried doing manually in play mode too).

Did I miss something please?

sentences:
Exact collision detection for high-detail deformable triangular meshes What robust methods or approaches exist for exact collision detection involving high-detail, deformable geometry?

The kind of mesh I am describing is a surface that is specified as a triangulated polyhedron and looks very similar to this:

For the specific application I am working on, I need to find all the contact points for colliding meshes that undergo subsequent deformation. Possible deformations that may occur during a collisional event:

1) the mesh decomposes, or fragments into smaller (triangulated) meshes

2) the mesh retains integrity but the vertex values of it's surface change

3) both of the above deformations occur

There is no real-time constraint; accuracy rather than performance is the critical factor.

sentences:
Can't get the current animation state name (hash or .IsName) to work I have some hard times trying to get the current animation state name in Unity, to perform specific actions while I'm in a certain state.
I want to know when I'm the "ThoughtsStill" state, I only have the default layer (Base Layer):

To do this, here is what I tried:

AnimatorStateInfo curr_state = _animator.GetCurrentAnimatorStateInfo(0);
if (curr_state.shortNameHash == Animator.StringToHash("ThoughtsStill"))
{
    Debug.Log("I'm in ThoughtsStill state").
}

which is not working.

I also tried with IsName() method but it is not working too (both tried to compare "Base Layer.ThoughtsStill" and "ThoughtsStill").

I'm certain that I'm going in this ThoughtsStill state but I don't know why I can't get it.

Do you guys have any ideas or leads?

Thanks !

sentences:
How do you implement Libgdx touchDragged? I'm a beginner in Java and in Game Development too. I was following some tutorials, but now I'm stuck on implementing a touchDragged listener using libgdx,

Can anyone suggest how to drag the image when the user touches it and then move with the users finger position?

I am using both a stage and an actor. I want to catch a touchDragged event on an actor.

Thanks.

public void create () {
    Texture.setEnforcePotImages(false);

    stage = new Stage();
    Gdx.input.setInputProcessor(stage);
    // create a SpriteBatch with which to render the sprite
    batch = new SpriteBatch();

    // load the sprite's texture. note: usually you have more than
    // one sprite in a texture, see {@see TextureAtlas} and {@see TextureRegion}.
    texture = new Texture(Gdx.files.internal("ball3.png"));
    Skin skin = new Skin();
    skin.add("default", new Label.LabelStyle(new BitmapFont(), Color.WHITE));
    skin.add("ball", texture);
    Image sourceImage = new Image(skin, "ball");
    sourceImage.setBounds(50, 125, 100, 100);
    stage.addActor(sourceImage);

    // create an {@link OrthographicCamera} which is used to transform
    // touch coordinates to world coordinates.
    camera = new OrthographicCamera();

    // we want the camera to setup a viewport with pixels as units, with the
    // y-axis pointing upwards. The origin will be in the lower left corner
    // of the screen.
    camera.setToOrtho(false);
}

public void render () {
    Gdx.gl.glClear(GL10.GL_COLOR_BUFFER_BIT);
    stage.act(Gdx.graphics.getDeltaTime());
    stage.draw();
    Table.drawDebug(stage);

    // if a finger is down, set the sprite's x/y coordinate.
    if (Gdx.input.isTouched()) {
        // the unproject method takes a Vector3 in window coordinates (origin in
        // upper left corner, y-axis pointing down) and transforms it to world
        // coordinates.
        camera.unproject(spritePosition.set(Gdx.input.getX(), Gdx.input.getY(), 0));
    }
}

sentences:
Space to Switch to Hand Tool in Tile Palette? Hi I just download a Utility called: Hold Spacebar for Hand (drag) Tool
I read the code and I can understand it, but now I wondering how can I modify this to support the same functionality but works in Tile Palette tab, thanks!

sentences:
Using Unreal Engine 4 to model Earth I could not find a game that has modeled Earth completely (i.e., The entire planet and full round model). Does UE4 have a limitation, such as maximum map size, that limits modeling the entire Earth?

Edit:
Context: The goal is to create a flight simulator using UE4 with centimeter granularity for modeling earth.

sentences:
SteamVR locks position of dynamically created cameras I'm having trouble tracking down a problem with SteamVR. Here is a quick way to set up an MWE:

Create a new Unity project.
Import the SteamVR package from the Asset Store.
Create the following script:

using UnityEngine;

public class CameraCreator : MonoBehaviour {
    private GameObject cameraObject;

    private void Start ()
    {
        cameraObject = new GameObject("CameraObject");
        cameraObject.AddComponent<Camera>();
        cameraObject.transform.position = Vector3.one;
    }
}

Create an empty game object and add this script to it.

SteamVR seems to lock this object's position (and that of any other game object with a dynamically created camera component) to the origin. No matter what I try to do to change it (inspector; set it inside update; set it in a coroutine), it always ends up back at the origin at some point during the frame (I believe somewhere between LateUpdate and OnRenderObject, but I'm not entirely sure). Without data breakpoints I find this really hard to track down.

This behaviour isn't really a problem for my actual project, but I need to be able to create cameras and modify their positions in my unit tests, where I'm having the same issue.

Does anyone know what's causing this, or have any advice on how to track down the cause?

sentences:
Get Facebook Picture in Cocos2d-iphone V3 I'm trying to get the profile picture from Facebook, but I'm getting the following error:

Terminating app due to uncaught exception 'NSInvalidArgumentException', reason: '-[UIImage stringByStandardizingPath]:

This is my code:

NSURL *url = [NSURL URLWithString:[NSString stringWithFormat:@"http://graph.facebook.com/%@/picture?type=square", userid]];
 NSData *data = [NSData dataWithContentsOfURL:url];
 UIImage *image = [UIImage imageWithData:data];
 //convert UIImage to CCSprite
 CCTexture *texture = [CCTexture textureWithFile:image];
 CCSprite *sprite = [CCSprite spriteWithTexture:texture];
 sprite.position = ccp(winWidth*.5, winHeight*.5);

The error occurs in the UIImage *image line.

sentences:
What to consider legally when cloning an old game? Possible Duplicate:
  How closely can a game resemble another game without legal problems

I'm going to make a game in the form of a 100% free Android phone app that will be basically a clone of an old arcade style NES game, but with a few modifications to make it better. Now the game I am inspired by was released in 1985, so I'm not exactly shitting bricks about being sued, but I just thought I'd ask on here first about what kind of legal considerations developers go through when copying others' games.

sentences:
Texture to Painted Vertex Algorithm I want to generate some game textures into coloured vertex arrays.

Is there a known algorithm  to transform texture/bitmap data into an optimised vertex array. Much like how the Homeworld skyboxes were made.

EDIT:
Don't need the dome part, would like todo these flat.

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:
Why does my collider behave strangely after a coroutine So I'm trying to create a simple script that is going to handle the logic for cutting down a tree
I'm experiencing some strange behaviour with my script.
I have a private field which holds the "HP" for the tree which starts at 100, and when I hit the tree it goes down by 25 every time, so I need to hit it four times in order for me to cut it down.
Once the tree reaches <= 0 in terms of HP it should play an animation which simulates the tree being cut down, wait a couple of seconds and then play another animation of it appearing again.
Most of this works fine, it's not until after the animation, where I start my CoRoutine to wait for a couple of seconds it starts messing up.
ISSUE
The first time I cut it down, it works fine.. However.. After it respawns I need to hit it like 4-5 times for it to go down to 50 health and then it works like normal.
So I hit it once, it gets to 75, I hit it twice, still at 75, 3 times.. still at 75.. And eventually, it starts going to to 50, 25, 0 etc..
This only happens after I cut it down the first time, and the first time it works fine.
Here is my Tree script NormalTree.cs
public class NormalTree : MonoBehaviour
{
    public static NormalTree instance;
    private int health = 100;

    public Animator animator;
    private void Awake()
    {
        if (instance == null)
        {
            instance = this;
        }
        animator = GetComponent<Animator>();
    }

    private void Update()
    {
        if (health <= 0)
        {
            KillTree();

        }
    }

    private void KillTree()
    {
        StartCoroutine(TreeSleep());
    }

    IEnumerator TreeSleep()
    {
        animator.SetBool("treedead", true);
        gameObject.tag = "DeadTree";

        yield return new WaitForSeconds(3f);

        animator.SetBool("treedead", false);
        gameObject.tag = "Tree";
        health = 100;
    }

    public Item DamageTree(int damage)
    {
        health -= damage;
        Debug.Log($"Tree health {health}");
        if (health <= 0)
        {
            return new Item { Amount = 1, ItemRarity = Item.ItemRarityEnum.Gray, ItemType = Item.ItemTypeEnum.Log };
        }
        else
        {
            return null;
        }
    }
}

And in my PlayerController I have this, which essentially checks if my hitbox collides with an object that has the tag "Tree"
private void OnTriggerEnter2D(Collider2D other)
{
    if (other.CompareTag("Tree"))
    {
        var wc = Skills.FirstOrDefault(x => x.Name == "Woodcutting");

        var tree = other.GetComponent<NormalTree>().DamageTree(25);

        if (tree != null)
        {
            inventory.AddItem(tree);
            wc.AddExperience(25);
            Debug.Log(wc.Level);
        }
    }
}

sentences:
Calculate The Proper X and Y Coordinate I have a class called Tile, the constructor takes an integer that represents the tile's
type. You can load a tileset ( via loadTileset() ) which initalizes the fields -

tileset
numOfTiles
tileWidth
tileHeight

My question is, in the constructor, depending on the type variable. How do I figure out the proper x and y cooridates to uses in the getSubimage() method.

So for example, if type is set to the value 2, I'd want to get the x and y position of the upper-left corner of number two.

import java.awt.image.*;
import java.awt.*;
import java.io.*;
import javax.imageio.ImageIO;

public class Tile {

private int type;
private BufferedImage tile;

// tileset attributes
public static BufferedImage tileset;
public static int numOfTiles;

public static int tileWidth;
public static int tileHeight;

// constructor
public Tile(int type) {

    // contruct tile
    this.type = type;
    // ...
    tile = tileset.getSubimage(0, 0, tileWidth, tileHeight);
}

public static void loadTileset(String filename, Dimension tileSize) {

    // load tileset
    try {
        tileset = ImageIO.read(new File(filename));
    }
    catch(Exception e) {
        e.printStackTrace();
    }

    // initalize attributes
    tileWidth  = (int) tileSize.getWidth ();
    tileHeight = (int) tileSize.getHeight();

    numOfTiles = (tileset.getWidth() / tileWidth) * (tileset.getHeight() / tileHeight);
}
}

sentences:
Why are my triangles not being drawn in the color I define? I render a simple mash structure with Tao (don't think this is relevant) using DisplayList.

Following code appears between

int displayList = Gl.glGenLists(1);
Gl.glNewList(displayList, Gl.GL_COMPILE);

and

Gl.glEndList();

Simplified version of the code, with removed unrelevant parts:

Gl.glBegin(Gl.GL_TRIANGLES);

for (int i = 0; i < triangles.Count; i++)
{
    var triangle = triangles[i];

    bool ok = false;
    var normal = triangle.GetNormal(out ok); //get normal of TRIANGLE

  //this method just retrives correct color information here
    var visualData = GetVisualData(visual,
                      visual.RenderSettings, triangle,null, false);

    //Set the color for the vertex here. Color is always the same in THIS case
    Gl.glColor4f(m_colors[visualData.color.R],
                     m_colors[visualData.color.G],
                             m_colors[visualData.color.B],
                                 visualData.transparency);

    //for every vertex in triangle
    for (int vtx = 0; vtx < triangle.Vertices.Length; vtx++)
    {
         var v = triangles[i].Vertices[vtx];
         Vertex3 v3 = v.Coord;
         Gl.glVertex3d(v3.x, v3.y, v3.z); //set vertex
         Gl.glNormal3d(normal.x, normal.y, normal.z);  //set normal

    }

}

Gl.glEnd();

Accoring to documentation if I set the same color for all 3 vertices of the triangle it must have the solid color. But what I get is:

As you see the colors are not uniform across different triangles, but I'm pretty sure that in this loop the color is not changed, it remains static (I even tried to set constant int values as color , but  result is always the same)

Q:

What can be possible reason of this rendering behaviour?

sentences:
A* Pathfinding Gridless With Circles I found that A* is an algorithm for grid (or tiled) maps. I want to use it or some alternative of it to my game. The problem is that I have no grid. I have canvas and GameObjects could be at position { x: 23.91324512, y: 131.12334253461 }. How would you do this?

And another question, I have element with stepSize (concretely called movementSpeed), and getPosition().getX(), getPosition().getY() AND getRadius() which returns the radius of a circle.

How would you do A* algorithm with radius?

Btw I am implementing it in Java, so maybe some Java snippet would be helpful.

EDIT

As you may suggest me to create a virtual grid, how do I check if I can move to the next node when I have my getRadius() and all the obstacles getRadiuses

sentences:
Why is my spritesheet displaying all messed up in game? I'm having an issue I don't quite understand, where my spritesheet is looping strangely and not showing the full sprite I want, even though I feel like I'm specifying it correctly. My code is in phaser.js.

Example: https://imgur.com/a/xJ95Qbj

My code for it is as follows:

this.load.spritesheet('dude', 'assets/bunny.png', { frameWidth: 32 , frameHeight: 42 });

    this.anims.create({
        key: 'left',
        frames: this.anims.generateFrameNumbers('dude', {start: 56, end: 64}),
        frameRate: 5,
        repeat: -1
    });

    this.anims.create({
        key: 'turn',
        frames: [{key: 'dude', frame: 4}],
        frameRate: 20
    });

    this.anims.create({
        key: 'right',
        frames: this.anims.generateFrameNumbers('dude', {start: 40, end: 48}),
        frameRate: 5,
        repeat: -1
    });

Look fine on the 'turn' frame, but not so fine on movement. For reference, here's the spritesheet I'm attempting to use: https://imgur.com/Rzi5i7Z

sentences:
Tweaking Heightmap Generation For Hexagon Grids Currently I'm working on a little project just for a bit of fun.  It is a C++, WinAPI application using OpenGL.

I hope it will turn into a RTS Game played on a hexagon grid and when I get the basic game engine done, I have plans to expand it further.

At the moment my application consists of a VBO that holds vertex and heightmap information.  The heightmap is generated using a midpoint displacement algorithm (diamond-square).

In order to implement a hexagon grid I went with the idea explained here.  It shifts down odd rows of a normal grid to allow relatively easy rendering of hexagons without too many further complications (I hope).

After a few days it is beginning to come together and I've added mouse picking, which is implemented by rendering each hex in the grid in a unique colour, and then sampling a given mouse position within this FBO to identify the ID of the selected cell (visible in the top right of the screenshot below).

In the next stage of my project I would like to look at generating more 'playable' terrains.  To me this means that the shape of each hexagon should be more regular than those seen in the image above.

So finally coming to my point, is there:

A way of smoothing or adjusting the vertices in my current method that would bring all point of a hexagon onto one plane (coplanar).
A better approach to procedural terrain generation that would allow for better control of this sort of thing.
A way to represent my vertex information in a different way that allows for this.

To be clear, I am not trying to achieve a flat hex grid with raised edges or platforms (as seen below).

I would like all the geometry to join and lead into the next bit.

I'm hope to achieve something similar to what I have now (relatively nice undulating hills & terrain) but with more controllable plateaus.  This gives me the flexibility of cording off areas (unplayable tiles) later on, where I can add higher detail meshes if needed.

Any feedback is welcome, I'm using this as a learning exercise so please - all comments welcome!

sentences:
Minecraft Forge setTextureName method not working I am attempting to make an item using the latest version of Forge. For some reason, the setTextureName method gives me an error that says:

  The method setTextureName(String) is undefined for the type ItemKey

I have been trying to fix this for a while, and notice that when I remove the quotation marks from the colon the error for setTextureName disappears, but I get an error on the colon that says:

  Syntax error on token ":", delete this token

an error on the + sign that says

  The operator + is undefined for the argument type(s) String

and finally an error on "key" that says

  The method setTextureName(String) is undefined for the type ItemKey

This is my first time trying to make an item, so help would be greatly appreciated.

EDIT: I just figured out that if I change MODID to modid in the setTextureName method I stop getting an error message for setTextureName but instead get an error for modid saying that

  modid cannot be resolved or is not a field

package com.arti.artismod;

import net.minecraft.item.Item;
import net.minecraft.creativetab.CreativeTabs;

public class ItemKey extends Item {
    private String name = "key";
    public ItemKey() {
        setUnlocalizedName(ArtisMod.MODID + "_" + "key");
        setTextureName(ArtisMod.MODID + ":" + "key");
        setCreativeTab(CreativeTabs.tabMisc);
    }
}

sentences:
How to calculate collision normal between two AxisAlignedBox's? I'm writing a physics simulation in Ogre3D and I'm trying to figure out how to calculate the collision normal between two Ogre::AxisAlignedBox's.

I am checking for collisions using the "intersects" function then calculating the collision normals as below, but I am almost certain that this is where I am going wrong as my collisions are very unpredictable:

Ogre::AxisAlignedBox intersection = boxA.intersection(boxB);
Vector firstCollisionNorm = boxA.getCenter() - intersection.getCenter();
Vector secondCollisionNorm = boxB.getCenter() - intersection.getCenter();

After this, I am normalizing the collision normals, calculating the impulse magnitude using dot product, mass and relative velocity, then I multiply the collision normals by the magnitude to get the final impulse force vector, which is added to my current force vector as "impulseForce / deltaTime" for the next step of euler intergration.

If anyone could help me out I would greatly appreciate it!

Thanks

sentences:
Inline-Building a World (SRT) Matrix Currently, to construct a world matrix, I have the following code:

return FromScale(scale) * rotation.RotMatrix * FromTranslation(translation);

However, this is constructing three matrices, and then applying two multiply operations between them in order to assembly the final world matrix.

However, I'm pretty sure there must be an algorithm or listing for constructing the SRT matrix 'in-place', by doing the necessary multiplications for each matrix element first, and then simply assembling the resultant matrix from that.

However, I can't seem to find a reference for that anywhere; the closest I found was for an SRT transformation with a rotation around a single axis.

Can anyone show me how to make an 'inline' SRT matrix? Or TRS, I don't mind. Row-major or column-major is fine, also.

sentences:
An API independent way of managing video memory? I'm developing a game. The game architecture is very modular. I have a "Graphics Engine", which uses either a Direct3D or OpenGL renderer. However the user does not have access to the renderers directly. Instead the "Graphics Engine" class is used, which uses a renderer interface.

I also have a resource management system. As for now, the renderers are respoinsible for allocating and releasing video memory. That couples my design in a bad way, since the "Graphics Engine" has undesirable logic for transferring resources between the RAM and the VideoRam through sending signals to the "Renderer". I want the resource management system to be responsible for allocating video memory.

I want to decouple the "Renderer" and "Graphics Engine" classes as much as possible, and make the renderer only responsible for rendering. Is there a way to obtain a universal pointer to a Video RAM buffer, and use it to render with both renderers?

My problem is basically that I can only obtain OpenGL or Direct3D handles, which can be used only from the relevant API. And the "Graphics Engine" should not know which renderer it uses.

sentences:
Do game engines put all interpolation onto the GPU? Is it considered standard to push all the vertices and an interpolation of the next position onto the GPU?

Suppose a sector is moving up every game tick at 50 units per second. You could put on the shader something like (good old parametric equation-like formulas):

pos.x = a*x1 + (1 - a)*x0;

Where you'd calculate a as a uniform and only send this value to the GPU in an uncapped fashion, like so:

while (true) {
    a = percentage of the way between frames [in range from 0.0 to 1.0]
    updateGLUniform(..., a);
    render();

    // Rest of stuff

    delay();
}

The other way of doing it was to manually set each entity and sector every single time you loop, but then you might have to update the position of a lot of things every game cycle. Just setting one value seems way more efficient.

However, I don't know if there's any downsides to this. Are there any negatives to shoving interpolation off to the GPU to save computation time in the game? Or is there something that I'm missing? What do major games do?

sentences:
Managing player/AI state in Entity Component System I am working on a 2d platformer game. Right now, I'm also using ECS. My question is how can I manage player's and AI current states in the context of ECS when some states are exclusive and some may be combined.
At this moment, for the player entity I have several components: HorizontalSpeedComponent, VerticalSpeedComponent, CollisionComponent... and also a PlayerComponent that holds a player state flag.
I also have several systems:

PlayerInputSystem that maps player input to state
PlayerWalkSystem that manages player horizontal speed while moving
PlayerGravitySystem that manages player vertical speed while jumping/falling and also checks if player is on the ground.
CollisionSystem that calculates collisions
AnimationSystem that maps entity state to animation frame
DrawingSystem that renders every entity

Player state flag represents following states:

Idle
Walking
Jumping
Falling
Attacking

Now some of the states are exclusive: if player is Idle, then he is not doing anything else.
But if player is walking (moving horizontally), then he may also be jumping(moving vertically up) and attacking. On the other hand, if player is jumping then he is not falling.
I thought about using a single Finite State Machine system to avoid having state checks and transitions mixed in other systems, but I do not know how it could be implemented it while keeping some states exclusive and some not.

sentences:
How can I respawn enemies in Gamemaker Studio 2? I know this may have been asked before but I would like an updated answer. So how do I respawn enemies in Gamemaker Studio 2?

Say I have an object called objBullet and an enemy objenemy; when they collide with each other I want the bullet to destroy the enemy, and the enemy to respawn after a few seconds. As a bonus, if you could tell me how to respawn the enemy in a new random spot that'd be awesome.

sentences:
How to maximize enclosed area and minimize perimeter on a grid with obstacles? Developing an RTS game, I have a tile-based terrain (grid) filled with obstacles. It looks like this (red shapes are obstacles):

Now I need to plan an enclosed area on the terrain with some restrictions:

tile marked with a "star" must be included (it is a seed)
area needs to be at least 20 tiles (for this example)
farthest area tile from the seed needs to be no more than 7 steps away (for this example)
area needs to traversable by moving in 4 directions
area should be bound by existing obstacles and by new fences
new fences building takes time and resources, it is beneficial to use existing obstacles as much as possible and have the smallest number of fences placed.
there are cases where terrain could be free of any obstacles, or contrary to that - be a maze-like labyrinth)
it is okay to fail (e.g. there's not enough walkable tiles around the seed), or the area/fences ratio is too low.
processing is done on CPU (if that matters)

So, here are some "manual" attempts at outlining an area of required size using the least fences:

As you can see, there are 3 enclosed areas (green, blue, orange) with very similar perimeters, yet different areas. Best one in this case would be "green" one - it has the least fences added (just 10) and has the sufficient area (21).
What is the algorithm to allow to plan area of given size (~20) while minimizing the amount of additional fences required?

So far I have tried to take the larger area and try to clip it - using BFS to get the area within possible reach (7 steps), clipped the last step (since it is touching the unexplored and has no neighbor info) and clipped the obvious protruding buds - leaves plenty of tiles to work with. I'm out of good ideas on how to improve from that:

yellow tile is the seed
red tiles are walkable (saturation shows distance from the seed)
dark grey tiles are obstacles
light grey tiles are obstacles that also need fences
purple tiles got clipped by existing incomplete algo
black tiles are unexplored
yellow dashes are required fences

As you can see, it looks quite sub-optimal, but I'm at loss as to how to proceed.

sentences:
How can I enable flat surface reflections in UE4 on mobile? Could someone please tell me how do I enable reflections on flat surfaces on a mobile in UE4? I have a simple room with one directional light. I need reflections on the tables and ground planes. I have tried every single setting and variation possible and nothing works.

I have tested the Sun Temple demo project and the Reflection Content Example demo project and nether of those projects have reflections on the mobile (iPhone 6). Those projects do have some kind of glare on the ground plans but noting close to what would be classified as a realistic reflection.

SSR does not work on mobile, neither do Sphere or Box Reflection captures. An alternative solution to get reflections working may be to use a Scene Capture Cube, but they don't work on mobile either.

UE4 is suppose to be an amazing game engine but it doesn't even offer the ability to support reflections on mobile. Reflections are quite simple to get running in Unity.

I have spent so much time trying to get reflections to work, and the worst thing is, every post or document that i have read about this subject does not offer a solution.

If someone could please confirm for me that reflections do not work on mobile or offer me a solution to get detailed reflections displaying on the ground and tables I would be so appreciative.

sentences:
Ray tracing - texture and phong lighting Other questione releated to my ray tracer implementation for iPad.

If I have a polygon that has a texture and a material, how do I calculate the color using Phong lighting model? Is the texture used in substitution of some of the component (diffuse?)? Or if there's a texture I need to just ignore the material and get only the texture color?

sentences: XNA 4.0 Point Vertex Rendering I have a buffer of about 134 million particles and a very powerful computer to render them smoothly, but I am getting an error when trying to render them as primitive lines. It says that I cannot render more than around 1 million. Is there a way I can do this? Is there a better way to render this other than with lines? I'm comfortable with having 1 pixel points or anything as long as the vertices are shown all the time. I'm basically just plotting the points.

sentences:
3D game engines for XNA games Before I start development of an XNA game, I need to choose a 3D game engine to develop upon. Is this belief unfounded? Does XNA have basic object transformation, lighting and mesh/texture importing functionality by which you can develop a decent 3D side-scrolling game?

Chances are I'm going to need a 3D engine such as Torque X to handle most of the special effects, animation and sound for me. What are the engines that you recommend building an XNA game with? What work reliably in your experience? Is XNA alone enough? do you have repositories of code that work directly with XNA to create effects and other game environments with sunlight, fog and rain?

sentences:
3D Collisions - Walking below a slope pushes me through the floor Here's a really short video (less than 30s) of this issue : https://www.youtube.com/watch?v=JrKbpTY8cMU

When I move the player towards a slope (the player is below it), it pushes the player inside the floor Collider instead of blocking it.

I've searched the Internet for a while but haven't found anything about it

Do you have something in mind ?Thanks for your time

Info : I move the player using rigidbody.MovePosition()

The collision of the player is a Capsule.

sentences:
How to implement SDL Button/Menu GUI with callbacks? I have been reading Bjarne Stroustrup's Programming Principles and Practice Using C++ for a while now and am nearing the end of the book. I have to tried to make a very simple game using the SDL libraries as a little exercise to practice programming and utilize techniques from the book.

I've attempted to implement a rather crude GUI system that sort of resembles the one described in the book. The problem that I am having is implementing a callback system so that when a button is constructed it takes a member function as an argument so that it can be called when the button pressed. The reason why it needs to be a member function is that the game has a state system very similar to this http://gamedevgeek.com/tutorials/managing-game-states-in-c/ since I followed the tutorial when crafting my own game state system.

The existing code looks like this:

class Button : public Widget {
private:
    SDL_Surface* m_image;
    SDL_Rect* m_clip;
    bool m_pressed;
    bool m_released;
    int frame;
public:
    Button(int x, int y, int w, int h, SDL_Surface* img, SDL_Rect* clip);
    void handle_events(SDL_Event& event);
    void show(SDL_Surface* screen, GameState* state);
    bool released();
};

Button::Button(int x, int y, int w, int h, SDL_Surface* img, SDL_Rect* clip)
   :Widget(x,y,w,h),
   m_image(img),
   m_pressed(0),
   m_released(0),
   m_clip(clip),
   frame(0)
{
}

So my question is: How do you pass a function in the constructor and call it when the button is pressed? (Like a callback). Currently each state, for example a Menu state, will just look if a button is pressed and perform a corresponding task which is pretty bad and hardly readable.

Stroustrup's code for the GUI system in the PPP book can be found here:
http://www.stroustrup.com/Programming/Graphics/
in the two GUI files.

Thanks in advance.

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:
libgdx Camera and World Size Question I'm new to libgdx and especially to using OrthographicCameras. I'm trying to understand how useful they are.

The question is, suppose I have a game map 500 units wide. I have an OrtographicCamera vith a viewport of 50x50. Now If I use SpriteBatch to draw texture of my game map as 500 units (I set projection matrix to cameras combined matrix) and move the camera around as the character moves, is this a right practice to do? If that map is 20000 pixels wide (an entire level for a platformer for example), is this really the way to go? Or should I make my camera and render logic myself (render only part of the map according to current coordinates of the character)? If I need to do this myself, what's moving the camera useful for?

sentences:
How do I play audio with Javascript? I want to add a short audio track to a game of concentration I'm coding. I want the sound to occur when the user has won the game. How do I go about doing this?
I would really appreciate the help, thank you.

sentences:
Unity Terrain Tools plants trees sideways My tree is clearly straight, but painting trees result in sideways ones.
What can cause this?
Tree is straight when placed manually as a prefab.

sentences:
How can I make players move diagonally at equal speeds? In a tile-based 2D RPG, a character is supposed to walk into all eight directions.

However, if we blindly tell the player to move in the direction (1, 1), he will be around 41% (√2-fold) faster. Thus, my next idea was to normalize the direction vector before moving.

Unfortunately, since the vector (1, 1) normalizes to (√2 / 2, √2 / 2) ≈ (0.71, 0.71), but the game functions on a whole-pixel basis, this will make the player reach invalid 2D locations. My next idea was that I should just make diagonal movement slower by √2 somehow.

So next, I tried another approach: When I receive an input and the player isn't already walking, I set the player's destination point. Then, I compute how much of his way to the destination the player can actually walk in one frame, given the player's velocity in "pixels per frame". I will repeat the player position update every frame, until the destination is reached.

So for example, if the player needs to move from the origin (0, 0) in the direction (1, 1) at speed 1, his sprite will be displayed at (0.71, 0.71) after one frame, and in the next frame it snaps to his destination (1, 1). This is okay, because the player ends up at a valid coordinate.

While this last approach sounds okay, it has only created more problems, because now diagonal movement takes two frames, and orthogonal movement takes only one frame. In other words, the walking speeds are still not equal.

How do you usually solve this?

sentences:
Does duplication happen quicker than generation? I am evaluating performance of bullet instantiation methods in Unity. I have a thing against prefabs. So each bullet is made from a function that sets the shape material, scripts and behaviors (tracking, velocity, duration, etcetera). Call this the "ammo type" if you like. Here are my instantiation methods:

Generate one bullet from script.  Disable it. Instantiate(duplicate) new bullets from this bullet and enable them when gun fires.
Each time the gun fires, generate a new bullet from the script. Still technically a duplicate but arrived at through a different method.

Which of these would have better performance? Would it be a drastic difference or a minor one?

The first method makes much more sense than the second. However there is a problem with delegates not being transferred when duplicating. Thus I am considering the second method and wondering how bad it would be on performance.

For more information on the problem with delegates when duplicating a prefab read this post.

I am happy to clarify any of the above should you find my explanation lacking.

sentences:
How can I detect "rooms" in a 2D side scrolling game? I'm looking to create a system that recognizes certain types of buildings and rooms you can create in game, like how Terraria detects "residences." In that game, a house can be constructed in a tile-based world by constructing a zone of blocks satisfying a set of conditions:

The zone is completely insulated from the "outside" by player-placed blocks.
The zone can fit a 5x7 rectangle.
there is at least one table, one light source, and chair in the enclosed area.
There is a door leading out from the zone.
Terraria has both a foreground and background tile layer. The entire background of the zone must be filled with player-placed blocks.

How can I efficiently detect when a player has constructed a suitably-sized area, and how can I efficiently check that the area contains all the required furnitture/components?

Example of an interior zone that satisfies all the housing requirements:

sentences:
What are good games to "earn your wings" with? I believe that in order to become a good game developer, you need to make games.

From a programmer's perspective, what are some good entry level games to get your hands dirty? What skills and challenges do each of these games teach you?

sentences:
How do I find the intersection of a ray and a cylinder? I'm looking for the algorithm to find the intersection (or lack of) between a ray and a cylinder. I have rotating coin like objects in my game world and need to check for a collision on that object. I also need to know the location of intersection to determine which part of the coin was hit.

The cylinder has an arbitrary rotation. I can provide as input the direction (vector) it is facing, a centre point, and a radius.

For the ray I can generalize to a line, as it'll be easy to check within the segment afterwards. Ideally I'd like the array to be an infinite cylinder, but I can easily fudge this aspect once I have the collision for a line.

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:
How do I change from positive degrees to negative degrees? Recently, in Unity, I tried to move a sphere along a figure-eight path. It first moves in a circle, and after completing the circle, it starts the  second circle in reverse, using negative rotation. However, my plan did not work as I expected. The reason is that Unity changes negative degrees into positive degrees, so -15 degrees becomes 345 degree. Therefore, the direction of the circular movement won't change, when you flip from a positive degree to a negative degree. In other words, if the first path is clock-wise the second path (after changing the sign of the degree) will be clock-wise, too.

Is there any practical way to overcome this problem, and change the direction of rotation by changing from positive degrees to negative degrees?

Here is one of the scripts I have tried:

public class PlayerMover : MonoBehaviour
{
    float x;
    public float speed=100.1f;
    private Transform playerTransform = null;

    void Start ()
    {
        playerTransform = GetComponent<Transform>();
    }

    void Update ()
    {
        x=speed*Time.deltaTime;
        playerTransform.Rotate(0, 5 *funct(x) * x, 0);
        playerTransform.position += playerTransform.forward ;
    }

    public float funct(float u)
    {
        u=Mathf.Sin(u);
        return u;
    }
}

As you can see. even the function I use to flip from positive degrees to negative degrees is a smooth and continuous function, mathematically speaking.

sentences:
How do you execute Trigger-collider collision only in one gameobject? I'm trying to deal with units (generated from the same prefab) dealing damage to each other on collisions.
Each Unit has both a Collider2D and a trigger on the front, that deals damage to other units that enter it.

I drew a small image (with Paint, sorry) to better illustrate what I mean and want.

The problem I am having is that when a collision occurs (one unit enters the trigger of the other), both units damage each other, meaning Unit 2 also deals damage to Unit 1.

I have seen that you can create a separate gameObject as a child of the unit and attach the trigger to this gameObject.

However, the number of units will be very high so if possible I don't want to double the number of gameObjects used by units.

Also, the amount of damage dealt is calculated from many other parameters from many other scripts on the units and doubling all those references doesn't look like an elegant solution.

Any Ideas?
Thanks

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:
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:
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:
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:
Pixel-perfect 3D sprite-picking on cylidrical-billboarded sprites? Background Info

I have an OpenGL app where a player (just an AABB with an eye-height, look and move vectors), can walk along a 3D grid made of a square cells, essentially like a player walking along a Minecraft level.  The cells can also have differing heights, which qualifies it as a 3D level, rather than 2D.

On each cell, there is potential to be a static sprite, which is centered on that cell.  The sprite is rendered as a "cylindrical billboard" so that it's always facing the camera, but the base/bottom of the sprite is always rooted in the ground.  Like this https://www.youtube.com/watch?v=2-queKkSVnw

(The point I'm making is that these cylindrical billboarded sprites render a bit differently than standard sprites which would be coplanar to the view plane on the vertical axis, as well)

Here's a simple representation, where the green stick is the player, and the pink squares are the billboarded sprites which are centered on their cells.

(Note: normally, the camera view would be from the player's eyes, and thus all the pink sprites should be aligned with the player's view plane)

I also have an "arm reach" vector which is a line segment that extends outward from the crosshair a certain distance, in other words a line segment.  This line segment is slightly less than the width of one cell.  So, worst case scenario, then, is that this line segment is intersecting with three cells at once, like this:

Question

My question is how should I detect that the user's arm reach ray/segment is intersecting with a vertically billboarded sprite, knowing that the sprites may have transparent pixels?

I know that the first step would be to find which cells the ray/segment is overlapping, as shown in the previous pic as the green-highlighted cells.  The next step (in my case) shall be a 3D distance check from the player to the sprite location.  If too far, can't click it, no matter how you rotate the camera view (and distort the sprite).  After that, I'm unsure.  I assume I need to somehow first check if the ray is intersecting the billboarded sprite's "rectangle" (the pink rectangle) (I say rectangle in quotes because it will be a distorted rectangle in first person view, due to perspective angle), and then pixel-pick on the sprite and look for the transparent color, but I'm not sure how to do either of those steps.

Daggerfall somehow accomplished this.  Interacting with a billboarded sprite (i.e. a treasure pile) requires you to actually click on a non-transparent pixel of that sprite, or the click doesn't count.

Any sources on related techniques would be greatly appreciated.  Thank you for your time!

sentences:
Scaling sprite velocity / co-ordinates in Android I'm trying to find the answer to a question that I've had for a long time, but am having trouble finding it! I hope someone can help :-)

I'm trying to find information on how to scale sprite velocity / movement / co-ordinates.

What I mean by this is how do I get a sprite to move at the same speed relative to the screen size / DPI so that it takes the same amount of real-time to get from one side of the screen to the other?

All of the posts pertaining to sprite scaling that I can find on the various forums relate to the size of the sprite, but this part of it I'm OK with so far, it's just that when I move a sprite, it kind of gets there at different speed depending on the dpi / resolution of the device. I hope I'm making sense.

This is the code I have so far, instead of using explicit amounts, like 1, I'm using something like the following:

platSpeedFloat= (1 * (dpi/160)); //Use '1' so on an MDPI screen, the sprite will move by 1 physical pixel

Then basically what I'm doing is something like this: (all varialble previously declared)

platSpeedSave+=platSpeedFloat; //Add the platSpeedFloat value to the current platSpeedSave value

platSpeed=(int) platSpeedSave; //Cast to int so it can be checked in the following statement

if (platSpeed==platSpeedSave) //Check the casted int value to float value stored previoiusly

{floorY=floorY-platSpeed; //If they match then change the Y value

platSpeedSave=0;} //Reset

Would be grateful if someone could assists - hope I'm making sense. The above doesn't seems to work the sprite moves 'faster' on lower DPI screens.

Thanks

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:
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:
Inventory management syncronized network I'm implementing an inventory system with items in 1x1 slots in a open-world multiplayer game. But I can't decide how I want to synchronize the item management with the server. I see two options here.

Server and client are fully synced after every move.
Synchronize every action the player takes in their inventory, even the action of "lifting" items.
Server only syncs "when neccessary" An unordered list on the server keeeping track of WHAT items the player has and not WHERE (in what slot) they are. Then every time the player drops/uses/acquires or stacks/unstacks an item the client syncs their inventory including slot positions with the server.

Is there perhaps another option that's even better?

sentences:
Resource loader for an HTML5 and Javascript game I have made a type to shoot game using HTML5, Javascript and Ruby on Rails.
Here is the link for the game Tweetraitor

I wanted to make a loader for resources (sounds, images) when the game starts. Currently when the game starts the background image takes time to load and it does not look good. This loader should load all the assets those are used later in the game.

Code for the game is here: Tweetraitor on GitHub

In the current version, all the images are loaded using js in an erb file which controls the game logic. Is there a better way to do this?

sentences: How do I create a selection rectangle? I have a basic prototype working with health, resources and units. The problem is: How do I select multiple units? I have an idea of making an rectangle which dynamically extends with the mouse position. I think I need to convert this rectangle to transparent rectangle.

sentences:
Detecting a mouse click While in a Trigger Why does the following code not working? (weird, sometimes it works sometimes not )
I want to move player by touching on the screen and change  the color of gameObject when detect trigger and release mouse click.
"Drag and move" script works correctly I just add following code and sometimes it works sometimes not

  private void OnTriggerStay2D(Collider2D colider)
  {

    if (Input.GetMouseButtonUp(0) & colider != null)
    {
      colider.gameObject.GetComponent<SpriteRenderer>().material.color = Color.blue;

    }

  }

There is a full script :

  private Camera _cam;
  private Vector3 _daragOfset;
  [SerializeField] private float _speed = 4.55f;
  private bool isEntered = false;

  void Update()
  {
    if (Input.GetMouseButtonDown(0))
    {
      _daragOfset = transform.position - GetMousePos();
    }
  }

  private void OnTriggerStay2D(Collider2D colider)
  {
    if (Input.GetMouseButtonUp(0) & colider != null)
    {
      colider.gameObject.GetComponent<SpriteRenderer>().material.color = Color.blue;
    }
  }

  void Awake()
  {
    _cam = Camera.main;
  }

  void OnMouseDrag()
  {
    transform.position = Vector3.MoveTowards(transform.position, GetMousePos() + _daragOfset,_speed * Time.deltaTime);
  }

  Vector3 GetMousePos()
  {
    var mousePos = _cam.ScreenToWorldPoint(Input.mousePosition);
    mousePos.z = 0;
    return mousePos;
  }

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:
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:
Demystifying "chunked level of detail" Just recently trying to make sense of implementing a chunked level of detail system in Unity. I'm going to be generating four mesh planes, each with a height map but I guess that isn't too important at the moment. I have a lot of questions after reading up about this technique, I hope this isn't too much to ask all in one go, but I would be extremely grateful for someone to help me make sense of this technique.

1 : I can't understand at which point down the Chunked LOD pipeline that the mesh gets split into chunks. Is this during the initial mesh generation, or is there a separate algorithm which does this.
2 : I understand that a Quadtree data structure is used to store the Chunked LOD data, I think i'm missing the point a bit, but Is the quadtree storing vertex and triangles data for each subdivision level?
3a : How is the camera distance usually calculated. When reading up about quadtree's, Axis-aligned bounding box's are mentioned a lot. In this case would each chunk have a collision bounding box to detect the camera or player is nearby? or is there a better way of doing this? (raycast maybe?)
3b : Do the chunks calculate the camera distance themselves?
4 : Does each chunk have the same "resolution". for example at top level the mesh will be 32x32, will each subdivided node also be 32x32. Example below:

sentences:
Getting collisions with equal values in Sweep and Prune When sorting an (incremental and persistent) SAP, you generally move extremas left until you run into a smaller/equal extrema, gathering collisions along the way.  However, that results in the collisions of end-points being exclusive (equal extrema don't collide).  At first, I was thinking of moving left until a smaller (but not equal) extrema is found, but I'm pretty sure that would give incorrect collision results.

If I want equal values to properly collide (and uncollide), how would that handled?

sentences:
BoundingBox created from mesh to origin, making it bigger I'm working on a level-based survival game and I want to design my scenes in Maya and export them as a single model (with multiple meshes) into XNA.

My problem is that when I try to create Bounding Boxes(for Collision purposes) for each of the meshes, the are calculated from origin to the far-end of the current mesh, so to speak.

I'm thinking that it might have something to do with the position each mesh brings from Maya and that it's interpreted wrongly... or something.

Here's the code for when I create the boxes:

private static BoundingBox CreateBoundingBox(Model model, ModelMesh mesh)
    {

        Matrix[] boneTransforms = new Matrix[model.Bones.Count];
        model.CopyAbsoluteBoneTransformsTo(boneTransforms);

        BoundingBox result = new BoundingBox();

        foreach (ModelMeshPart meshPart in mesh.MeshParts)
        {
            BoundingBox? meshPartBoundingBox = GetBoundingBox(meshPart, boneTransforms[mesh.ParentBone.Index]);
            if (meshPartBoundingBox != null)
                result = BoundingBox.CreateMerged(result, meshPartBoundingBox.Value);
        }
        result = new BoundingBox(result.Min, result.Max);
        return result;
    }
    private static BoundingBox? GetBoundingBox(ModelMeshPart meshPart, Matrix transform)
    {
        if (meshPart.VertexBuffer == null)
            return null;

        Vector3[] positions = VertexElementExtractor.GetVertexElement(meshPart, VertexElementUsage.Position);
        if (positions == null)
            return null;

        Vector3[] transformedPositions = new Vector3[positions.Length];
        Vector3.Transform(positions, ref transform, transformedPositions);

        for (int i = 0; i < transformedPositions.Length; i++)
        {
            Console.WriteLine(" " + transformedPositions[i]);
        }
        return BoundingBox.CreateFromPoints(transformedPositions);
    }

public static class VertexElementExtractor
{
    public static Vector3[] GetVertexElement(ModelMeshPart meshPart, VertexElementUsage usage)
    {
        VertexDeclaration vd = meshPart.VertexBuffer.VertexDeclaration;
        VertexElement[] elements = vd.GetVertexElements();

        Func<VertexElement, bool> elementPredicate = ve => ve.VertexElementUsage == usage && ve.VertexElementFormat == VertexElementFormat.Vector3;
        if (!elements.Any(elementPredicate))
            return null;

        VertexElement element = elements.First(elementPredicate);

        Vector3[] vertexData = new Vector3[meshPart.NumVertices];
        meshPart.VertexBuffer.GetData((meshPart.VertexOffset * vd.VertexStride) + element.Offset,
            vertexData, 0, vertexData.Length, vd.VertexStride);

        return vertexData;
    }
}

Here's a link to the picture of the mesh(The model holds six meshes, but I'm only rendering one and it's bounding box to make it clearer:
http://www.gsodergren.se/portfolio/wp-content/uploads/2011/10/Screen-shot-2011-10-24-at-1.16.37-AM.png
The mesh that I'm refering to is the Cubelike one. The cylinder is a completely different model and not part of any bounding box calculation.

I've double- (and tripple-)-checked that this mesh corresponds to this bounding box.

Any thoughts on what I'm doing wrong?

sentences: Drawing many separate lines using mouse OpenGL(GLFW/glad) So, in order to draw a line, I track the coordinates of the mouse, then I add them to the array and capture it as GL_LINE_STRIP_ADJACENCY. However, for example, I completed drawing a line1 at P1 and decided to start drawing a different line at P2 as shown in the figure, but my two points P1 and P2 joined together, how to fix it? Need to clear the array after drawing at the point P1, actually it doesn't help if I use glClearColor and glClear(GL_COLOR_BUFFER_BIT).. Is there any other way?

sentences:
Locating different models in a single scene I have a curiosity.

Say I wanted to create a big forest using Blender, in this forest I'd like to have a campfire or several campfires. What I could do is create the entire scene in Blender with campfires included and of course in-engine I would add a fire effect to it. Now what I do not understand is how can I actually find the fireplaces' locations in the engine? Since it's all in one scene, I can't just say getLocation on the model.

I guess what I'm asking isn't how to do it per say, but what the "professional" way is. Do professional game developers fiddle around with coordinates until they find it? Do they load the campfire on top of the scene as a separate model and move it until it fits the scene? Just in case it is important, I am using jMonkeyEngine.

sentences:
Unity 2D collision detector not working I'm making a 2D sidescrolling game in Unity where the player shoots at obstacles while running. But nothing I try seems to get the collision detection to work. This is the obstacle script:

void onCollisionEnter2D(Collision2D col)
{
    if (col.gameObject.tag == "circle")
                    Destroy (gameObject);
    }

the circle tag refers to the projectile being shot at the obstacle

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:
Corgi Engine - Character glitches with "jump" animation on top of a ladder I'm new to Corgi Engine and Unity in general. I have an issue that I could find a way to resolve.
I'm using CorgiEngine's "RetroLadder" prefab and extended "Rectangle" character with custom animations from "MinimalLevel":

The problem is that when character finishes climbing the ladder, for a very short amount of time, jump animation appears. As in my case jump animation is very different from idle animation, this feels like an unpleasant glitch to me, so that's why I want to fix it. You can see it on the GIF below (at first I jump near the ladder to show how animation looks and then start climbing the ladder and on the top jump glitches) -

I checked some other demos (e.g. RetroVania, which uses some ladders there) and they also have this "glitch" with Corgi demo character, but as the character's idle and jump animations are not very different, it doesn't seem wrong (GIF below) -

I suspect that this glitch happens because "CharacterLadder.cs" script disables gravity during ladder climbing and then enables it back which triggers fall of the character -

Do you think it's possible to workaround it somehow?
Thanks!

sentences:
How do I calculate the boundary of the game window after transforming the view? My Camera class handles zoom, rotation, and of course panning.  It's invoked through SpriteBatch.Begin, like so many other XNA 2D camera classes.  It calculates the view Matrix like so:

public Matrix GetViewMatrix() {
    return Matrix.Identity
        * Matrix.CreateTranslation(new Vector3(-this.Spatial.Position, 0.0f))
        * Matrix.CreateTranslation(-( this.viewport.Width / 2 ), -( this.viewport.Height / 2 ), 0.0f)
        * Matrix.CreateRotationZ(this.Rotation)
        * Matrix.CreateScale(this.Scale, this.Scale, 1.0f)
        * Matrix.CreateTranslation(this.viewport.Width * 0.5f, this.viewport.Height * 0.5f, 0.0f);
}

I was having a minor issue with performance, which after doing some profiling, led me to apply a culling feature to my rendering system.  It used to, before I implemented the camera's zoom feature, simply grab the camera's boundaries and cull any game objects that did not intersect with the camera.

However, after giving the camera the ability to zoom, that no longer works.  The reason why is visible in the screenshot below.  The navy blue rectangle represents the camera's boundaries when zoomed out all the way (Camera.Scale = 0.5f).  So, when zoomed out, game objects are culled before they reach the boundaries of the window.  The camera's width and height are determined by the Viewport properties of the same name (maybe this is my mistake? I wasn't expecting the camera to "resize" like this).

What I'm trying to calculate is a Rectangle that defines the boundaries of the screen, as indicated by my awesome blue arrows, even after the camera is rotated, scaled, or panned.

Here is how I've more recently found out how not to do it:

public Rectangle CullingRegion {
    get {
        Rectangle region = Rectangle.Empty;

        Vector2 size = this.Spatial.Size;
        size *= 1 / this.Scale;

        Vector2 position = this.Spatial.Position;
        position = Vector2.Transform(position, this.Inverse);

        region.X = (int)position.X;
        region.Y = (int)position.Y;
        region.Width = (int)size.X;
        region.Height = (int)size.Y;

        return region;
    }
}

It seems to calculate the right size, but when I render this region, it moves around which will obviously cause problems.  It needs to be "static", so to speak.  It's also obscenely slow, which causes more of a problem than it solves.

What am I missing?

sentences:
Where can I find a list of gameplays? Long ago I found a website with a huge list of different gameplays; around 250 or so. I wanted to go back but right now I cannot find it (I've already spent some time on Google, believe me).

The site had a little picture with a brief explanation, that's all I remember.

I'd appreciate if anyone who rememebers the web site publish the link.

Thanks in advance.

sentences: Unity immediate mode I have some existing C++ 2D game code that draws using immediate mode (i.e., each frame is drawn bottom-up one sprite at a time by my game code -- not using a scene graph or other retained mode concepts). I'm wondering if I can port this code to Unity without having to rework the game code to operate in terms of retained mode (adding objects to a scene, removing objects, etc.). I have read that Unity has an immediate mode GUI option. But in my case I want to use this for the game sprites themselves, not just the UI elements. I realize that for a 2D game there isn't a big difference between UI elements and game sprites. But I need to be able to do things like rotation and render-to-texture, so I wasn't sure if I'd run into trouble "misusing" the immediate mode GUI mechanism to handle the whole game. Alternatively, does Unity have a more general immediate mode option? (I did search for it and didn't see anything aside from the immediate mode GUI stuff.)

sentences:
How to calculate collision detection from big rectangle to small rectangle? I have big rectangle that can move from side to side, its boundaries can't enter the small rectangle inside it, the anchor point is in the middle of both of them.

Let's say the big rect is 1000 * 1000, and the small one is 200 * 200
in the game the small rect is the "camera" and the big rect is the ground, only the ground moves.

The solution can be in any programming language.

Here is some drawing to show what I mean :

sentences:
How to restrict jumping to a single jump? I'm making a VolleyBall game in HTML5 with PandaJs GameEngine and plugin is used physics and Box2D.

The problem is that players can jump, but they can jump over the net with multiple jumps. I have already implemented collision detection but i don't know how the restrict move space for player. I also attaching my screen shot here so look at this
:

In the picture Player1 goes Player2 side and vise-versa.

sentences:
Unity emission lighting I have created a scene with a blue sphere inside of a white room of planes. The room is being lit by a point light above the roof, and the sphere is emitting a blue light.

How do I get the emission from the sphere to contribute to the lighting of the walls without making it static?

sentences:
Physics for moving blocks I'm working on a 2D game for windows phone where the player moves blocks around to bounce a laser beams.

I need to create some simple physics for moving the blocks.

For the moment I have a simple collision class, telling me if two rectangles collide. But that's not enough because when I'm moving a block the rectangle/rectangle function doesn't work.

By Doesn't work i mean,I manage the collision but I don't how to stop the block mooving while the user sliding the block.

The collision response for the block I want is if the user tries to slide it on another object, the block should slide up against the other object and not overlap.

How would I go about implementing this functionality?

Some code about how i impletement mooving block

{
            Currentposition = Station.Position;

            TouchPanelCapabilities touchCap = TouchPanel.GetCapabilities();
            if (touchCap.IsConnected)
            {
                TouchCollection touches = TouchPanel.GetState();
                if (touches.Count >= 1)
                {
                    Vector2 PositionTouch = touches[0].Position;
                    for (int i = 0; i < ListDragObj.Count(); i++)
                    {
                        if (ListDragObj[i].Shape.Contains((int)PositionTouch.X, (int)PositionTouch.Y))
                        {
                            ListDragObj[i].selected = true;
                        }
                        else
                        {
                            ListDragObj[i].selected = false;
                        }
                        ListDragObj[i].Update(PositionTouch);
                    }
                }
            }
        }

sentences:
What is the optimal scene size? I'm coding a small "Binding of Isaac"-like game, with a little help from the official "Scavengers" Unity tutorial, since it's my first game.
In the tutorial every level is comprised of only one room. The player moves around and, when it reaches the ending, the whole scene is reloaded, creating a new procedurally generated map, but I wanted to do something different on my game.
My idea is to have levels comprised of a procedurally generated maze of many many rooms and the player should be able to navigate across them back and forth at will, but I'm unsure about using a scene per room or per level.

Q: What is the ideal size (in terms of gameplay content) for a scene?
Is the act of loading scenes resource-expensive (therefore prohibiting it's frequent use)?
Are there relevant performance differences between using many small scenes versus using one big scene?
Should I make every room a scene just like the tutorial, or should I make a bigger scene for the whole level?

sentences:
Combining mesh on the fly without using gameObject I procedurally generate chunks and use the marching cube algorithm to create meshes in 3D.
At first, I just created a gameObject for each cube (of course, I knew it was not optimized, but I wanted to see if the algorithm worked).
For now I stock all gamesObject in child of "blocks" but it would be much more optimized to directly merge the meshes between them and only create a single gameObject.
However, i did not find any way to directly merge the meshes between them.
So my question is: is there a way to directly merge meshes between them without having to use gameObject? (don't worry about texturing)

Here's the code:

    public static GameObject GenerateChunk(int[,,] map, int chunkSize, Vector3 chunkPosition)
    {
        GameObject blocks = new GameObject("BlockList");
        GameObject newMesh;
        int[] cubeVertices = new int[8];

        // create each mesh in a gameObject as child of "blocks"
        for (int x = 0; x < chunkSize; x++)
            for (int z = 0; z < chunkSize; z++)
                for (int y = 0; y < chunkSize; y++) {
                    /*
                    define the vertices (cubeVertices)
                    */
                    Vector3 cubePosition = new Vector3(chunkPosition.x + x, chunkPosition.y + y, chunkPosition.z + z);
                    newMesh = GenerateCube(cubePosition, cubeVertices);

                    if (newMesh != null)
                        newMesh.transform.parent = blocks.transform;
                }

        //combine every children of "blocks" and delete them
        MeshFilter[] filters = blocks.GetComponentsInChildren<MeshFilter>();
        List<CombineInstance> combine = new List<CombineInstance>();
        for (int i = 0; i < filters.Length; i++) {
            if (filters[i].sharedMesh == null)
                continue;
            for (int j = 0; j < filters[i].sharedMesh.subMeshCount; j++) {
                CombineInstance ci = new CombineInstance
                {
                    mesh = filters[i].sharedMesh,
                    subMeshIndex = j,
                    transform = filters[i].transform.localToWorldMatrix
                };
                combine.Add(ci);
            }
            Destroy(filters[i].gameObject);
        }

        //create the chunk and set the final mesh with the CombineMeshes function
        GameObject chunk = new GameObject("Chunk", typeof(MeshFilter), typeof(MeshRenderer));
        chunk.GetComponent<MeshFilter>().mesh.CombineMeshes(combine.ToArray(), true, true);
        Destroy(blocks);
        return chunk;
    }

sentences:
2D Collisions engine I am working on a fabric simulator at low level, I have done some work and at this point there are some points where I would appreciate help.

The input of the program is a DRF file. This is a format used in sewing machines to indicate the needles where to move.

The 2D representation is accurate, I parse the DRF info to a polyline, apply tensions and I extrude this in a openGL render.

Now I am trying to achieve the 3D ZAxis physics. I tried two methods:

1) Asuming information

First method is based on constrains about the process of  manufacturing:
we only take care of the knots where a set of yarns interact and comupte z separation in this crucial points. The result is regular: good in a lot of cases but with a lot of botched jobs in order to avoid causistincs where this is not a good assumtion (for example, doing beziers, collisions in zones between this crucial points). We desist on this alternative when we saw there was a lot os causistic we would have to hardcode,probably  creating aditional gliche.

2) Custom 2D Engine

The second attempt is to aprox the yarns with box colliders 2D, check collisions with a grid, and compute new Z in funcion of this. This is by far more expensive, but leads to a better results. Although, there is some problems:

The accuracy of box colliders over the yarn is not absolute ( there are ways to solve this but it would be great to read some alternatives)
There is not iterative process:

First we compute collisions pairwise, and add to each collider a list of colliding colliders. Then, we arrange this list and separate the Z axis in function of yarn's radius with center 0.The last step is to smooth the results from discrete z to a beziers or smoothing filters. This leads to another glitches.
If I extend this recomputation to all the collisions of the current collisions, I get weird results because z changes are bad propagated( maybe I am not doing good this point)
Some colliders are recomputed wrong ( first computed yarns have more posibilites to be altered for the last ones, leading on gliches)

some of the glicthes (mainly in the first yarns computed:

Details of bad aproximated curves:

At this point I have some questions:

Can I fix this glitches (or a great part at least)?
Glitches about bad aproximation and glitches for z recomputation
A 3D engine like ODE could do the job in a reasonable time?

If you need some specific code don't hestiate on ask for it.

Thanks a lot!

sentences:
Can I publish an indie game on XBL made with directx So I know that XNA can be used to publish games on Xbox Live Indie Games and I signed up for the $100/year subscription thing.

I haven't downloaded XNA yet but I was wondering if I can publish a game made entirely in DirectX onto it or do I have to go through XNA?

sentences:
How can I save an XML file with Unity on the Android platform? I am writing a game that has a save function which looks like this

    public void Save()
    {

        System.Xml.Serialization.XmlSerializer ser = new System.Xml.Serialization.XmlSerializer(this.GetType());
        System.IO.StreamWriter file = new System.IO.StreamWriter(("Assets/Resources/Save");
         ser.Serialize(file, this);
        file.Close();
    }
}

This will work fine in the editor and on Windows machines, but when we build to Android the saving no longer works. Why is that?

sentences:
Why are meshes limited to 65k indices or uint16 in most game engines? Why are most game engines like unity limiting their meshes to 65k indices by default, or enforcing to use uint16 as the default datatype for indexbuffers?

I know that its better for performance to use uint16 indexbuffers, but I think there might be more reasons, because webGL 1.0 specification allows only uint16 vertexbuffers. I know that it's possible to use uint32 indexbuffers in webGL if the "OES_element_index_uint" extension is available in webGL 1.0 devices.

How big is the performance impact when using uint32 indexbuffers instead of uint16 indexbuffers? I think the only difference is in the memory bandwidth during the initial upload of the indices and should not matter much during runtime.

sentences:
Can I make a multiplayer Android Game using Android Studio? I want to create a multiplayer android game, where the clients connect together via a web server.

My question is: Is it possible to make this kind of games using Android Studio with other libraries like LibGDX and Java sockets?

sentences: Minecraft Optifine - where is the zoom class? I'm working on a mod where I want to have a zoom feature like Optifine. To start out, I want to try messing around with the zoom in the actual Optifine mod. There are a lot of .class files, and I don't want to decompile all of them one by one, so if anyone knows which one(s) have the zoom that would be super helpful.

sentences:
Are there any game engines for developing in C? I cant find any game engines which use C, mostly just Java, Anyone know any good engines that support 2d Development in C?

ALso I have an additional question how hard is it to write your own game engine? How would one go about it I'm really curious about how they work.

sentences:
Why can't I store a value in transform.position.y? Well I have this line of code

            Vector3 pos = cell.CellPosition;
            float light1Height = 10f;
            pos.y = light1Height;

            lightGameObject.transform.position.y = light1Height;
            lightGameObject.transform.position.x = pos.x;
            lightGameObject.transform.position.z = pos.z;

The error states that

Cannot modify a value type return of 'UnityEngine.Transform.position". Consider storing the value in a temporary variable.

What should i do? Thanks!

sentences:
Y Axis inverted on vertex output I've got my project running and somehow it seems my vertex y components are inverted. 10 in the positive on Y goes down and 10 negative on the Y axis goes up.

I can't find anything with the initialization and I am not doing any negative scaling in the view matrix. I've never had something like this happen before, does anyone have some tips or things to look for ?

How I am sending verteces to the GPU ( Currently intermediate mode )
glVertex3f( x_pos_n, 10, z_pos );

I am using CG in the project but even without shaders the Y axis seems to be inverted.

sentences:
std::map inserts a NULL pointer I ran into an access violation reading error and when I debugged it, I saw that the insert function of std::map is inserting a NULL pointer into the map.

Though I've fixed the error by first inserting a NULL value into the map and then changing that value to the corresponding object I wanted to insert in the map. But I want to know the reason the error occurs and why it got fixed.
My code looks like this:

void CTextureBank::AddTexture(int ID)
{
    // Create a CTexture object, load texture into it and insert it into the Texture List
    CTexture* texture = new CTexture();
    texture->LoadTextureFromFile(mRenderer, ID);
    mTextureList.insert(std::make_pair<int, CTexture*>(ID, texture));
}

In the AddTexture function, I'm first creating a texture object, loading a texture into it and putting that texture into the map.
But, this one gives me an access violation reading error.

And doing this doesn't:

void CTextureBank::AddTexture(int ID)
{
    // Create a CTexture object, load texture into it and insert it into the Texture List
    CTexture* texture = new CTexture();
    texture->LoadTextureFromFile(mRenderer, ID);
    mTextureList.insert(std::make_pair<int, CTexture*>(ID, NULL));
    mTextureList[ID] = texture;
}

So it would be great if someone can tell me why this occurs.
Thanks :)

sentences:
MonoGame SharpDX Error 'The Parameter is Incorrect' when using graphics.DrawUserPrimitives Below is a small section of code that is meant to draw a multicolored triangle to the middle of the screen in a MonoGame game. This uses the basic function DrawUserPrimitives to draw the triangle. This works fine in XNA, but the moment i try to use it in a MonoGame DX game (Which compiles using SharpDX) it will crash with the following error:

An unhandled exception of type 'SharpDX.SharpDXException' occurred in SharpDX.dll

Additional information: HRESULT: [0x80070057], Module: [General], ApiCode: [E_INVALIDARG/Invalid Arguments], Message: The parameter is incorrect.

Below is the code that is causing the error.

private void SetUpVertices() {
        vertices = new VertexPositionColor[3];

        vertices[0].Position = new Vector3(-0.5f, -0.5f, 0f);
        vertices[0].Color = Color.Red;
        vertices[1].Position = new Vector3(0, 0.5f, 0f);
        vertices[1].Color = Color.Green;
        vertices[2].Position = new Vector3(0.5f, -0.5f, 0f);
        vertices[2].Color = Color.Yellow;
    }

    public void Draw(GameTime gameTime) {
        gDevice.DrawUserPrimitives(PrimitiveType.TriangleList, vertices, 0, 1, VertexPositionColor.VertexDeclaration);
    }

Has anyone ever come across simillar errors using the DirectX version on MonoGame and SharpDX when dealing with primatives? And do you know of a way I can fix this issue?

sentences: Windows Phone 7 Networked Game Im creating a multiplayer asteroids type game for the Windows Phone 7, 2 players can challenge each other over who will get the highest score. On each players phone the opponent is displayed and both go about shooting asteroids and enemies. In an assignment I have due I would like to talk about the packet design, what would be the least amount of info that I can send over the connection? Instead of constantly having to send each players position, asteroid position, bullet position and enemy position etc. Or would all that data constantly need to be sent?

sentences:
Body inside other body after collision I'm using bullet to create a 2D topdown game. In my physics proof of concept, I can walk around and push a box. However, if I walk too fast the character goes through the box, instead of colliding with it. See gif:

This seems like a common thing to me. However, I cannot find other people having the same problem, so that's why I'm asking a question directly. I'm using a DiscreteDynamicsWorld with two rigid bodies which I step through at 60Hz.

Why does this happen?
Is there a way to tune bullet to support higher speeds and prevent this issue?

Help is very much appreciated.

Edit

Regarding the question about how I setup collision shapes:

btConvexHullShape shape;
shape.addPoint({-size, size, 0.0f});
shape.addPoint({size, size, 0.0f});
shape.addPoint({size, -size, 0.0f});
shape.addPoint({-size, -size, 0.0f});

sentences:
Rendering a selected part of the terrain with different shading I'm trying to understand how to modify the shading of the section of the terrain based on some user selection. In a game like Civ5, when a user selects a city or unit, that area is lit up more than the other parts of the terrain. I'm trying to implement this effect.

In the civ 5 example the selected tile is has a circle outline and the selected city has a transparent overlay that follows the height of the terrain nicely.

My current pipeline so far is at a primitive state. I render a quad and texture it with a grass texture. Then I draw a rectangular grid on top of this (a set of lines, with a slightly higher height value than the background grid). Upon selection (ie a mouse click inside the grid area), I calculate the approriate grid index by converting mouse to world coordinates and then to grid coordinates, and highlight the appropriate grid rectangle by changing the color of that particular rectangle. But, my approach gets outdated the moment I get a height map (as it assumes constant height), and looks pretty bad, hence this question.

EDIT : Added my pipeline description

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:
What is the best way to implement the story functionality (dialogue and cutscene management, etc.) in an RPG? I would like to know what the best way to implement the story functionality of an RPG would be. I am writing the game in C++ using the SFML library for graphics, and I have implemented drawing tiles, level loading and player movement, but I am not sure on how exactly to go about implementing the story. How would I implement when to do cutscenes, what to do in cutscenes, changes in dialogue, and have dialogue options affect the game? I am planning to have the dialogue in JSON files in a format similar to this

"dialogue" :[
        {"type" : "dialogue", "character" : "player", "text" : "dialogue here", "result" : "next"},
        {"type" : "dialogue", "character" : "character", "text" : "more dialogue", "result" : "next"},
        {"type" : "option", "options" : [{"text" : "option 1", "result" : "goto 4"}, {"text" : "option2", "result" : "goto 5"}]},
        {"type" : "dialogue", "character" : "character", "text" : "from option 1", "result" : "next"},
        {"type" : "dialogue", "character" : "character", "text" : "from option 2", "result" : "next"}
]

Is this a good way to go about this?
Should I also consider embedding a scripting language like Lua for cutscenes and other high-level tasks?

sentences: Can all DirectX11 games be deployed to Xbox One? If I program a game with DirectX 11 and C++ and make my own implementation can I deploy it on an Xbox one to test it? Otherwise, what do I need to do so?

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:
Unity3D - GameObject as a static function Newbie Unity3D/C# developer here.
I've tried learning Unity3D during my May/June college vacation and came across a problem:Code 1:

CameraObj returnVoid;

void Start ()
{
    returnVoid = GameObject.Find ("Main Camera").GetComponent<CameraObj> ();
    returnVoid.ComponentType ();
}

Code 2:

GameObject returnDirectLight;

void Start ()
{
    returnDirectLight = GameObject.Find ("Directional Light");
    Debug.Log (returnDirectLight.GetComponent<DRLight>().directionString);
}

CameraObj is my custom component.
As far as I know, GetComponent is actually a public method. I understand the logic behind Code 2. What I fail to understand is Code 1. How does GetComponent become a static function here? Does it become abstract in my CameraObj class?

sentences: Any problems with flipping a sprite by scale? (2d Platformer) I am wondering if there are any problems with flipping a sprite on the x-axis using vector2 to tell which direction it is facing/flip. Though doing this helps me write less code for Ray-cast direction and creating single states with a single animation (using 1 animation player facing right than using 2 animation facing left and right). If there is a better solution please tell me and thanks. Btw I am still pretty new and learning.

sentences:
What is the standard C# / Windows Forms game loop? When writing a game in C# that uses plain-old Windows Forms and some graphics API wrapper like SlimDX or OpenTK, how should the main game loop be structured?

A canonical Windows Forms application has an entry point that looks like

public static void Main () {
  Application.Run(new MainForm());
}

and while one can accomplish some of what is neccessary by hooking the various events of the Form class, those events don't provide an obvious place to put the bits of code to perform constant periodic updates to game logic objects or to begin and end a render frame.

What technique should such a game use to achieve something akin to the canonical

while(!done) {
  update();
  render();
}

game loop, and to do with minimal performance and GC impact?

sentences:
Playing with hashmap in drawing I'm developing a game in Java for Android, using LibGDX.
In my render(), between the batch.begin() and batch.end() I'm running through all the game objects and draw them.

Every game object is stored in a list, which that list is stored inside a hash map. I iterate through this hash map, getting every list and going through that list, like this:

    batch.begin();
    Iterator it = objectsMap.entrySet().iterator();
    while (it.hasNext()) {
        Map.Entry pair = (Map.Entry) it.next();
        Array list = (Array) pair.getValue();
        for (int i = 0; i < list.size; i++) {
            GameObject object = (GameObject) list.get(i);
            drawObject(object);
        }
    }
    batch.end();

My drawObject() code:

private void drawObject(GameObject object, float x, float y) {
    if (object == null) {
        return;
    }
    if (object.getVisibility()) {
        TextureAtlas.AtlasRegion currentFrame = object.getCurrentFrame();
        if (currentFrame != null) {
            float objectAlpha = object.getAlpha();
            Color color = batch.getColor();
            if (objectAlpha != 1) {
                color.a = object.getAlpha();
                batch.setColor(color);
            }
            batch.draw(currentFrame, x - object.getOriginX(), y - object.getOriginY(), object.getOriginX(), object.getOriginY(), currentFrame.getRegionWidth(), currentFrame.getRegionHeight(), object.scaleX, object.scaleY, object.getSpriteDirection());
            color.a = 1;
            batch.setColor(color);
        }
    }
}

A method called setRegion() sets the current animation frames of the object:

protected void setRegion(String name, float frameDuration) {
    currentFrame = atlas.findRegion(name, 0);
    if (currentFrame == null) {
        currentFrame = atlas.findRegion(name, -1);
    }
    width = currentFrame.getRegionWidth();
    height = currentFrame.getRegionHeight();
    animationStateTime = 0;
    animation = new Animation(frameDuration, atlas.findRegions(name),      Animation.PlayMode.LOOP);
}

And in the update() of the objects this is called:

            currentFrame = (TextureAtlas.AtlasRegion) animation.getKeyFrame(animationStateTime, isLooping);

The getCurrentFrame() method only returns currentFrame variable.
The alpha is a field with a value between 0 and 1. (getAlpha() returns only the field)

My question is that considered a "heavy" activity? Can this be a significant impact on the FPS values? Because I'm running my game on old devices (like Galaxy S2) and the FPS can get pretty low values. I'm trying to find the cause to it.
I used to have a reference to every list but with the time I realized I'm going to have too much lists, so I decided to do it like this. Maybe you know a better way of holding references to all game objects?

Thanks!

sentences:
Efficiently checking input and firing events I'm writing an InputHandler class in XNA, and there are several different keys considered valid input (all of type Microsoft.XNA.Framework.Input.Keys). For each key, I have three events:

internal event InputEvent XYZPressed;
internal event InputEvent XYZHeld;
internal event InputEvent XYZReleased;

where XYZ is the name of the Keys object representing that key. To fire these events, I have the following for each key:

if (Keyboard.GetState().IsKeyDown(XYZ))
{
  if (PreviousKeyState.IsKeyDown(XYZ))
  {
    if (XYZHeld != null)
      XYZHeld();
  }
  else
  {
    if (XYZPressed != null)
      XYZPressed();
  }
}
else if (PreviousKeyState.IsKeyDown(XYZ))
{
  if (XYZReleased != null)
    XYZReleased();
}

However, this is a lot of repeated code (the above needs to be repeated for each input key). Aside from being a hassle to write, if any keys are added to/removed from the keys (if functionality is added/removed), a new section needs to be added (or an existing one removed).

Is there a cleaner way to do this? Perhaps something along the lines of

foreach key
  check which state it's in
  fire this key's event for that state

where the code does the foreach (automatically checking exactly those keys that "exist") rather than the coder?

sentences:
Implementing a color picker I'm making a paint program using applets in Java, and I want to create some sort of color palette where the colors blend into each other, similar to this:

However, I'm having trouble understanding the correlation between the R, G, B, values and the X, Y coordinates for both the outer circular color palette, and the inner hue selecting palette.

Representation:

sentences:
What size textures do I need for a 2D grid based game if my tiles are larger than textures I have? I'm building a grid-based game for iPad, and for usability purposes I've selected my game grid to be built of 75x75 squares. However, so far I've seen that the majority of (free)texture catalogs I can find are either 16x16 or 32x32.

Currently I have the graphics engine stretch the 32x32 texture onto a 75x75 tile, which does not look very sharp.

How can I make my game look good -  do I need to create textures whose size is equal to my game tile? Should I try to stitch multiple textures together (like 4 texture squares per game square)?

sentences: BEPUphysics collision with generated terrain? I've got randomly generated terrain which is stored in a indices and vertex buffer.  How do I go about using this for collision in BEPU?  It seems I can do it with a Mesh but it would be a waste to convert it to a Mesh :/.

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

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

sentences:
Creating an Android port of old PC games I have seen some decent ports to Android of old PC games.

The graphics and game engines are the same, and all that seems to have been changed was the key mapping, and adding touch-screen events.

I want to play around with learning how to do this, but I have done a lot of searching online, and haven't been able to find a general overview of how to begin.

What would I to do, or at least, where can I learn how, to take an old, existing PC game, and port it to Android, only changing the key-mappings, and add touch-screen support?

From what I have seen, a native app is created to launch the game, and then from that point, you're just playing the original game.

And I'm not referring to playing games through emulators.  This is something that would be able to be downloaded from the Google App store.  And I would first get rights to do so, of course, unless it was, or has been released as, an open-source game.

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:
OnCollisionEnter2D just flat out not running for certain objects I am working with the Unity3D Engine in 2D mode. Currently I am trying to make a circle collider bounce off of a composite collider for the walls of my game. The only issue is that for some reason the OnCollisionEnter2D function does not seem to even trigger when the circle collider hits the walls. I have used the log to determine this. I am curious as to why it has this behviour, since it does end up triggering when the player contacts the circle collider? Here is the important parts of the script:

public class sword : MonoBehaviour {

public Rigidbody2D rb;
public CircleCollider2D coll;

public float speed;
public Vector2 trajectory;
public GameObject Player;

// Use this for initialization
void Start () {
    speed = 0.0f;
    anim = Player.GetComponent<Animator>();
}

private void OnCollisionEnter2D(Collision2D collision)
{
    Debug.Log("collided");
    if (collision.gameObject.tag == "player")
    {
        transform.position = new Vector2(-1000, -1000);
        Player.GetComponent<movement>().equipped = true;
    }
    if (collision.gameObject.tag == "solid")
    {
        ContactPoint2D otherObject = collision.contacts[0];

        Vector2 hit = otherObject.point;
        Vector2 normal = otherObject.normal;
        trajectory = Vector2.Reflect(trajectory, normal);

    }
}

private void FixedUpdate()
{
    //constantly calculating new velocity
    rb.velocity = speed * trajectory;
    speed = speed * 0.93f; //drag
    if (speed < 0.0001f)
    {
        speed = 0.0f;
    }
    if (speed > 1)
    {
        Physics2D.IgnoreCollision(Player.GetComponent<CircleCollider2D>(), coll, true);
    }
    else
    {
        Physics2D.IgnoreCollision(Player.GetComponent<CircleCollider2D>(), coll, false);
    }
}
}

More Details: My speed variable is set from a separate script, in case you are wondering. Everything is on the layer 0.. The Rigidbody for player is dynamic, for the ball it is kinematic, and for the walls it is static. Also here is an image of what the game screen would look like, I've labelled the walls and the circle collider (used for a sword).

Thank you.

sentences:
Time granularity for games So far I've always used a time granularity of 1 msec (that's it, 1 millisecond is the atomic time unit).

I'm wondering if this is always fine, or if for some cases (some specific games, game components or platforms) it would be suggested to have a more accurate time unit (on the order of microseconds or, I don't know, hundreds of microseconds).

sentences:
Unity3D smooth movement with joypad button press First off, I'm sorry this is such a silly question, but for the life of me I can't seem to get it to work. And I've just spent the last hour trying to do so.

All I want to do is have my camera move up, in a smooth fashion, when I press the shoulder button on my joypad. I have it so that when I press the button, it jumps up. Not in a smooth movement.

The code I have is as follows:

    float _maxY = 0.0f;
    if (Input.GetKeyDown(KeyCode.Joystick1Button5))
   {
      _maxY++;
      transform.Translate(0, _maxY, 0);
   }

This is found within my update function. I've been looking for the answer to this for hours now, but can't find anything. Can anyone please help me?

sentences:
Particles to Denote Movement in Space I'm currently working on a WebGL project to realise an idea I've had for some years. On my desk is book on making a space sim written 15 years ago.

There I found some algorithm for particles in space. The idea is simple: A cloud of particles that stay in place so they fly past the player, but reset to be in front of the player when they move past the ship. This shows the player they're moving while there's nothing else around. For this, I reworked the algorithm found in the book a little:

ParticleField.prototype.updateCloud = function(frustum, position, direction) {
  var s = this.size, s2 = s * 2;

  for (var i = 0; i < this.vertices.length; i++) {
    if (!frustum.containsPoint(this.vertices[i])) {
      this.vertices[i].set(
        (position.x + s - Math.floor(Math.random() * s2)) + (s * direction.x),
        (position.y + s - Math.floor(Math.random() * s2)) + (s * direction.y),
        (position.z + s - Math.floor(Math.random() * s2)) +
                         ((s + Math.floor(Math.random() * s2)) * direction.z)
      );
    }
  }
};

Where s is the size of cloud. I played around with the sizes, but this simple function has several weaknesses.

The particles 'pop up' in front of the player when they're moving.
If the player backs up and moves backwards, the particles won't reset, leaving the cloud visible popping the illusion.
Particles appear to be flying through the player.

Without regard of how the particles look (they're simple points right now), how can I make this look more natural? I've seen the effect in games like Elite: Dangerous and Freelancer, and I'd like to be closer to them, and I'd appreciate any hint on the topic.

sentences:
Is there a way to capture back button twice in same activity libgdx game Can anybody tell me if there is a possibility to capture back button twice in same activity in libgdx.
What i want to achieve is  that if the user press back button once the game pause. if in the pause screen user press back key again so the level exit. This happens well in "Video" that is the built in app in android OS. During video play a if user press back button it toast to press back again to exit.

so I want somthing like this.

if (Gdx.input.isKeyPressed(Keys.BACK)) {

        code to call game pause  state

  if (Gdx.input.isKeyPressed(Keys.BACK)){   //// is this possible?

  game.setScreen(new Menu(game))

 }

    } else {
        code to call game resume state
    }

sentences:
Memory allocation patterns used in game development I have been researching creating my own allocator methods (that will support things such as a memory pool and profiling), however, as I continue my research I have been looking for how this was done in game development.

What memory allocation technique could I use, and why is it a good technique?

sentences:
What is the connection between an isometric angle and scale I am trying to work out an isometric projection matrix for a custom angle.
In the engine I'm using there's a projection matrix defined like so:

projection.rotate(45 * (Math.PI / 180) );
scale = 1.4142137000082988; // not sure why this magic number is needed- now working on a "real" solution
projection.scale(scale * 1, scale * .5);

I'm currently trying to get my head around the wiki article.
I see the beta angle is 45, like in the matrix above, but I don't understand  where does the 'magic' number come from, and the connection between the isometric angle and the scale ratio (1,1/2).

If I want to use a custom angle, how do I work out what angle I use instead of 45 ? , what would the scale value and scale ratio be ?

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:
LibGDX: How to use AssetManager with Texture Atlases? A similar question was asked before, but I never saw an answer.

How does one load individual texture regions that derive from a texture atlas using assetManager? I know that assetManager relies on a file name. (the file name could be the .pack file, for instance).

How would this work for individual texture regions? What would go in the file handle?

How would I do this:

manager.load("sprite_sheet.txt", TextureAtlas.class);

but with a textureRegion from that atlas?

sentences:
Should I use one line per .wav or one scene per .wav for character speech? I'm building a game in XNA and I wanted to know how I would organize the character speech portions of the game. These would include both cutscenes and anything else where characters interact.

I wanted to know if it would be more efficient to use sound file (.wav) per character line, such as:

SCENE 4: ENTERING THE CAVE

PLAYER1: Wow, this is going great! } One file called "04_PLAYER1_01.wav"
PLAYER2: I know! } A file called "04_PLAYER2_01.wav"
PLAYER1: Let's get going! } A file called "04_PLAYER1_02.wav"

I wanted to know if that would be better opposed to:

SCENE 4: ENTERING THE CAVE

PLAYER1: Wow, this is going great! }
PLAYER2: I know!                   } One file called "scene_04.wav"
PLAYER1: Let's get going!          }

I am aware that by going with option 2, you'd probably save a bit more space because you have less files (but they might be larger) but it poses the problem of coordinating it all.

I was thinking maybe XML for coordinating the speech and cutscenes, but am open to other suggestions. :)

P.S. This not intended to be a "DIALOG-TREE". These are actual models moving their lips in accordance with sound!

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:
A good place to learn about Game Programming with Mathematical Vectors? I am looking for a place in the web where I can turn my current game development process into a vector based approach. I am sorry If this question has been asked once.

According to my google search analysis, few places I've found pretty interesting are Tony Pa's tutorials and Metanet. But, due to limited explanations, I found it little bit tough to implement. I could try out the same examples as provided there, but when I have to use it in my games, I am STUCK. I want to know about the dot products and cross product stuff, Its uses and detecting collisions and predicting collisions with these mathematical techniques.

Please, write down some links and a brief description of the link. Thank you

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:
Loading levels from .txt or .XML for XNA I'm attemptin to add multiple levels to my pong game. I'd like to simply exchange a few elements with each level, nothing crazy. Just the background texture, the color of the AI paddle (the one on the right side), and the music.

It seems that the best way to go about this is by utilizing the StreamReader to read and write the files from XML. If there is a better, or more efficient alternative way then I'm all for it. In looking over the XNA Starter Platformer Kit provided by MS it seems that they've done it in this manner as well. I'm perplexed by a few things, however, namely parts within the Level class which aren't commented.

/// <summary>
    /// Iterates over every tile in the structure file and loads its
    /// appearance and behavior. This method also validates that the
    /// file is well-formed with a player start point, exit, etc.
    /// </summary>
    /// <param name="fileStream">
    /// A stream containing the tile data.
    /// </param>
    private void LoadTiles(Stream fileStream)
    {
        // Load the level and ensure all of the lines are the same length.
        int width;
        List<string> lines = new List<string>();
        using (StreamReader reader = new StreamReader(fileStream))
        {
            string line = reader.ReadLine();
            width = line.Length;
            while (line != null)
            {
                lines.Add(line);
                if (line.Length != width)
                    throw new Exception(String.Format("The length of line {0} is different from all preceeding lines.", lines.Count));
                line = reader.ReadLine();
            }
        }

What does width = line.Length mean exactly? I mean I know how it reads the line, but  what difference does it make if one line is longer than any of the others?

Finally, their levels are simply text files that look like this:

....................
....................
....................
....................
....................
....................
....................
.........GGG........
.........###........
....................
....GGG.......GGG...
....###.......###...
....................
.1................X.
####################

It can't be that easy..... Can it?

sentences: How to remotely debug a D3D9 application I've got a D3D9 application, which works fine on my machine. But when I send it to a friend, his machine won't render any of the 3D content. I already changed the build to enable all error-code checking and they all come back clean. How can I remotely debug why his machine's rendering is broken?

sentences: transformation before the perspective divide but after projecting perspectively My problem is that I would like to confine a scene render to a (possibly rotated) rectangle without using glViewport(). I don't want to use it to save, if possible, some cycles that would otherwise be spent on state switching. Also, there is the tantalizing possibility of rotating the scene render, which is not possible with glViewport... Is it possible to confine a scene render to this (possible rotated) rectangle in this way?

sentences:
How to restart a coroutine I want to run my code multiple times without using the Update() method, now, I could use a coroutine or an Invoke(), but since the Invoke() is not very performance friendly as a coroutine, my best option is to use a coroutine instead.

Now, my problem is, when my coroutine is completed and I want to restart it, how exactly should I do it?

Here is what I've done, but it doesn't work:

private void Start()
{
    StartCoroutine(DoSomething());
}

private IEnumerator DoSomething()
{
    //Does something
    yield return new WaitForSeconds(20f);
    //Does another thing
    yield return new WaitForSeconds(20f);
    StartCoroutine(DoSomething());
}

sentences:
Unity IAP crash on Android I have just launched a game on the Playstore with Unity IAP 1.19.0 . Everything worked fine during the internal tests though last week I got a crash report from Crashlytics that I have difficulty analyzing. Any help on finding the root cause would be really appreciated. Here is an extract from the trace:

Fatal Exception: java.lang.Error: FATAL EXCEPTION [main]
Unity version     : 5.5.4p3
OS Version: 7.1.1
Device: Nexus 6

Caused by java.lang.RuntimeException: Unable to start activity ComponentInfo{com.abc.abcd/com.unity.purchasing.googleplay.PurchaseActivity}: java.lang.NullPointerException: Attempt to invoke virtual method 'java.lang.String android.os.BaseBundle.getString(java.lang.String)' on a null object reference
at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2665)
at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:2726)
at android.app.ActivityThread.-wrap12(ActivityThread.java)
at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1477)
at android.os.Handler.dispatchMessage(Handler.java:102)
at android.os.Looper.loop(Looper.java:154)
at android.app.ActivityThread.main(ActivityThread.java:6119)
at java.lang.reflect.Method.invoke(Method.java)
at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:886)
at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:776)
at de.robv.android.xposed.XposedBridge.main(XposedBridge.java:107)

Caused by java.lang.NullPointerException: Attempt to invoke virtual method 'java.lang.String android.os.BaseBundle.getString(java.lang.String)' on a null object reference
at com.unity.purchasing.googleplay.PurchaseActivity.onCreate(PurchaseActivity.java:41)
at android.app.Activity.performCreate(Activity.java:6679)
at android.app.Instrumentation.callActivityOnCreate(Instrumentation.java:1118)
at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2618)
at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:2726)
at android.app.ActivityThread.-wrap12(ActivityThread.java)
at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1477)
at android.os.Handler.dispatchMessage(Handler.java:102)
at android.os.Looper.loop(Looper.java:154)
at android.app.ActivityThread.main(ActivityThread.java:6119)
at java.lang.reflect.Method.invoke(Method.java)
at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:886)
at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:776)
at de.robv.android.xposed.XposedBridge.main(XposedBridge.java:107)

sentences:
How to offset a 2D GameObject by a pixel amount? I'm extremely new to game creation.

I'm playing around with creating a 2D Unity game. The scene is setup from the default Unity 5 2D template.  Following a tutorial, I've created a TerrainManager GameObject and Script.  The script instantiates tiles and sets their position using a standard double-loop.

I've found a 2D isometric tile set.
Each tile is visually rendered as rotated around the vertical axis by 45 degrees, creating more of a diamond shape rather than a square.  This requires that every second tile be offset by half the tile width on the x-axis, and half the tile height on the y-axis.

As each tile is of a different height, one can not simply offset the tile on the Y axis by half its height.  Each terrain "layer" is 16px tall in the PNG.  Some PNGs have a single "layer", some have multiple "layers".  (For instance, a single layer water tile is 83px in height, while a dual layer "grass on top of dirt" layer is 99px in height.

As the game object expects the transform.position as a Vector3 in (I assume) game units, I do not know how to compose this using pixel values.

So the question I have is, how do I achieve the 16px y-axis offset of the game object?

I'm more than happy to provide additional details if needed.

sentences:
List to hold copies of a prefab for later deletion I'm working on a game in which obstacles are Instantiated randomly 5 to 20 units ahead of the player.

When they are instantiated, I want to add them to a list so that when there are too many obstacles loaded in the game, it will remove them from the list and then delete them from the game.

I'm having trouble adding them to the list, because using obstacleList.Add(Obstacles.name); doesn't work.

Here's my code:

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

public class Generate : MonoBehaviour{

    //player position
    public Transform Player;

    // The prefab for an obstacle
    public GameObject Obstacle;

    // Holds float distance from 0 for each obstacle that is instantiated
    private float nextObstacle = 30;

    // is supposed to hold the names of all active instances of the obstacle prefab
    List<string> obstacleList = new List<string>(10);

    void FixedUpdate()
    {
        //Checks to see if the player is colser than 30 units to the most recently spawned obstacle
        if (nextObstacle - Player.position.x < 30)
        {
            //Generates a new obstacle
            GenerateObstacle();
        }
    }

    void GenerateObstacle()
    {
        // Randomly assignes a number for horizontal and vertical Transform
        int randH = Random.Range(5, 20);
        int randV = Random.Range(1, 3);

        //Instantiates an obstacle using those random values
        Instantiate(Obstacle, new Vector3(nextObstacle + randH, randV, 0), Quaternion.identity);

        //Makes that obstacle the new distance so a new obstacle can be spawned
        nextObstacle += randH;

        // Is supposed to add the name of the obstacle that was Instantiated to a list
        obstacleList.Add(Obstacle.name);

        //checks when list has more than 10 items in it
        if (obstacleList.Count > 10)
        {
            DeleteObstacles();
            // Removes the first item from the list
            obstacleList.RemoveAt(0);
        }
    }
    void DeleteObstacles()
    {
        // Supposed to destroy the copied prefab
        Destroy(Obstacle);
    }
}

sentences:
How do I optimize searching for the nearest point? For a little project of mine I'm trying to implement a space colonization algorithm in order to grow trees.

The current implementation of this algorithm works fine. But I have to optimize the whole thing in order to make it generate faster. I work with 1 to 300K of random attraction points to generate one tree, and it takes a lot of time to compute and compare distances between attraction points and tree node in order to keep only the closest treenode for an attraction point.

So I was wondering if some solutions exist (I know they must exist) in order to avoid the time loss looping on each tree node for each attraction point to find the closest... and so on until the tree is finished.

sentences:
How can I draw crisp per-pixel images with OpenGL ES on Android? I have made many Android applications and games in Java before, however I am very new to OpenGL ES. Using guides online, I have made simple things in OpenGL ES, including a simple triangle and a cube.

I would like to make a 2D game with OpenGL ES, but what I've been doing isn't working quite so well, as the images I draw aren't to scale, and no matter what guide I use, the image is always choppy and not the right size (I'm debugging on my Nexus S).

How can I draw crisp, HD images to the screen with GL ES?

Here is an example of what happens when I try to do it:

And the actual image:

Here is how my texture is created:

//get id
int id = -1;
gl.glGenTextures(1, texture, 0);
id = texture[0];

//get bitmap
Bitmap bitmap = BitmapFactory.decodeResource(context.getResources(), R.drawable.ball);

//parameters
gl.glBindTexture(GL10.GL_TEXTURE_2D, id);
gl.glTexParameterf(GL10.GL_TEXTURE_2D, GL10.GL_TEXTURE_MIN_FILTER,
        GL10.GL_NEAREST);
gl.glTexParameterf(GL10.GL_TEXTURE_2D, GL10.GL_TEXTURE_MAG_FILTER,
        GL10.GL_LINEAR);
gl.glTexParameterf(GL10.GL_TEXTURE_2D, GL10.GL_TEXTURE_WRAP_S,
        GL10.GL_CLAMP_TO_EDGE);
gl.glTexParameterf(GL10.GL_TEXTURE_2D, GL10.GL_TEXTURE_WRAP_T,
        GL10.GL_CLAMP_TO_EDGE);
gl.glTexEnvf(GL10.GL_TEXTURE_ENV, GL10.GL_TEXTURE_ENV_MODE,
        GL10.GL_REPLACE);

GLUtils.texImage2D(GL10.GL_TEXTURE_2D, 0, bitmap, 0);

//crop image
mCropWorkspace[0] = 0;
mCropWorkspace[1] = height;
mCropWorkspace[2] = width;
mCropWorkspace[3] = -height;
((GL11) gl).glTexParameteriv(GL10.GL_TEXTURE_2D, GL11Ext.GL_TEXTURE_CROP_RECT_OES, mCropWorkspace, 0);

sentences:
Proper use of async, await and task.delay for a game loop I'm currently in the process of making a game loop in a console application. I'm trying to make the game loop wait at the end of its loop for (1000*10000/fps) - ElapsedTicks to put a cap on game loop speed. For reference 1 millisecond is 10,000 ticks.

If the ElapsedTicks < FrameTimeTicks I execute await Task.Delay(FrameTimeTicks - ElapsedTicks) but this ends my console application.

The code responsible is the await Task.Delay so I assume I'm not using it properly.

My code:

using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.Diagnostics;

namespace ConsoleApp1
{
    class Program
    {
        static byte fps = 30;
        public static byte Fps { get { return fps; } set { fps = value; } }
        //user specified fps

        static long frameTimeTicks = (1000 * 10000) / Fps;
        static long FrameTimeTicks { get { return frameTimeTicks; } }
        //amount of ticks desired in one frame

        static bool draw = true;
        public static bool Draw { get { return draw; } set { draw = value; } }

        static long elapsedTicks;
        static long ElapsedTicks { get { return elapsedTicks; } set { elapsedTicks = value; } }
        //ticks elapsed in one game loop

        static void Main(string[] args)
        {
            GameLoop();
        }

        static void UpdateGame()
        {
            int a = 0;
            a++;
        }
        static void Render()
        {
            Console.WriteLine("@");
        }

        public static async void GameLoop()
        {
            Stopwatch gameLoopTicks = Stopwatch.StartNew();

            while (true)
            {
                gameLoopTicks.Restart();

                if (Console.KeyAvailable == true)
                {
                     char KeyPressed = Console.ReadKey().KeyChar;
                }
                UpdateGame();
                if (Draw == true)
                {
                    Render();
                }
                ElapsedTicks = gameLoopTicks.ElapsedTicks;
                if (ElapsedTicks > FrameTimeTicks)
                {
                    Draw = false;
                }
                else
                {
                    Draw = true;
                    await Task.Delay(TimeSpan.FromTicks(FrameTimeTicks - ElapsedTicks));
                }
            }
        }
    }
}

I Have also tried this variation but to the same result, my console application ends.

public static async void GameLoop()
    {
        Stopwatch gameLoopTicks = Stopwatch.StartNew();
        async Task PauseGameLoop()
        {
            //Console.ReadKey(); execution ends here!
            await Task.Delay(TimeSpan.FromTicks(FrameTimeTicks - ElapsedTicks));
            GameLoop();
        }

        while (true)
        {
            gameLoopTicks.Restart();

            if (Console.KeyAvailable == true)
            {
                 char KeyPressed = Console.ReadKey().KeyChar;
            }
            UpdateGame();
            if (Draw == true)
            {
                Render();
            }
            ElapsedTicks = gameLoopTicks.ElapsedTicks;
            if (ElapsedTicks > FrameTimeTicks)
            {
                Draw = false;
            }
            else
            {
                Draw = true;
                await PauseGameLoop();
            }
        }

Task.Delay MSDN, await MSDN. Am I tackling this problem the wrong way ? This post is why I chose this method. Thanks for the help!

sentences:
Approximating particles with with nebula I have a 2d galaxy where each star is rendered a particle:

I'd like to approximate it with nebula, so that instead of seeing lots of tiny dots from afar, users will see lots smooth light in the area. Something like this:

I'm more interested in technology-agnostic solution which accurately resembles underlying particles. E.g. how would one approach this problem from math/physics standpoint?

But if you have hints how to do it in a specific technology - those are welcome too! I don't even know how to approach it. The final thing is implemented with WebGL.

sentences:
Unity Browser inside UI Panel What is the best option if I want to show a remote webpage inside a UI Panel in Unity ?

I want to target android and iOs platform.

I had uniWebView in mind but that thing is more like an overlay I guess, or can it be kept in bound of the panel (the canvas which holds the panel is using world co-ordinate) ?

sentences:
Travel over step angle http://www.gamasutra.com/blogs/AdamWinkels/20140220/211306/DevLog_7_Learning_How_to_Walk.php

Following the link above I have been able to get my character to move and rotate very smoothly over angled surfaces up-to 80 degrees.  Anything over that and it begins to clip and wobble when traveling down the surface. The spiders rotation only reaches half of the desired angle.  So at 85 degrees it only rotates to 42.5.  Going up is a mess, but I have not implemented the fix for that from the link above, so I am less worried about that.  Any suggestions?

private float RayDuration = 0;
private float RayAngle = 5f;
private float RayLength;
Vector2 MovementDirection;
float OffSetY  = 5;
float OffSetX = .5f;
int GroundMask = 1 << 8;

 void Start()
{
    SpiderRect = GetComponent<RectTransform>();
    RayLength = SpiderRect.rect.height;
}

private void TouchHeld(CustomEvent customEvent)
{

    if (Input.mousePosition.x > 400)
    {
        MovementDirection = transform.right;
    }
    else
    {
        MovementDirection = -transform.right;
    }

    Vector2 transformUp = transform.up;
    Vector2 position = transform.position;

    Vector2 rightRayPosition = new Vector2(transform.position.x + OffSetX, transform.position.y + OffSetY);
    Quaternion rightOffSetAngle = Quaternion.AngleAxis(-RayAngle, new Vector3(0, 0, 1));
    Vector2 rightRayAngle = rightOffSetAngle * Vector2.down ;

    Vector2 leftRayPosition = new Vector2(transform.position.x - OffSetX, transform.position.y + OffSetY);
    Quaternion leftOffSetAngle = Quaternion.AngleAxis(RayAngle, new Vector3(0, 0, 1));
    Vector2 leftRayAngle = leftOffSetAngle * Vector2.down;

    RaycastHit2D rightHit = Physics2D.Raycast(rightRayPosition, rightRayAngle, RayLength, GroundMask);
    RaycastHit2D leftHit = Physics2D.Raycast(leftRayPosition, leftRayAngle, RayLength, GroundMask);

    #region move
    if (rightHit && leftHit)
    {

        Debug.DrawRay(rightRayPosition, rightRayAngle, Color.red, RayDuration);
        Debug.DrawRay(rightRayPosition, rightHit.normal, Color.green, RayDuration);

        Debug.DrawRay(leftRayPosition, leftRayAngle, Color.yellow, RayDuration);
        Debug.DrawRay(leftRayPosition, leftHit.normal, Color.magenta, RayDuration);

        Vector2 averagePoint = (leftHit.point + rightHit.point) / 2;
        Debug.DrawRay(averagePoint, -transform.up, Color.cyan, RayDuration);

        Vector2 averageNormal = (leftHit.normal + rightHit.normal) / 2;
        Debug.DrawRay(averagePoint, averageNormal, Color.cyan, RayDuration);

        Quaternion targetRotation = Quaternion.FromToRotation(Vector3.up, averageNormal);
        Quaternion finalRotation = Quaternion.RotateTowards(transform.rotation, targetRotation, 10);
        transform.rotation = Quaternion.Euler(0, 0, finalRotation.eulerAngles.z);

        transform.position = Vector2.MoveTowards(transform.position, averagePoint + MovementDirection, .15f);
    }
    else
    {
        Debug.Log("What");
    }

sentences:
How can I make RPC function calls in Unity? I am making a multiplayer game. I am sending score via the server and client but I want to be sure that can I call an RPC function of a script from any other script.

For example, say Table_Manager as a script which contains a get_score function and I want to call it from a game_stat script like Table_Manager.networkview.rpc("Table_Manager", rpcmode.all, 25); The get_score method would look something like:

[RPC]
public void get_score(int new_score)
{
   // ...
}

How can I accomplish that?

sentences:
What does pressing CTRL do when editing a sprite sheet? I have a multi-sprite sprite sheet.  When I have a blue box selected, and I hold CTRL, the box turns green.  I have played with it, but cannot figure out what it does.  I checked the documentation, but I don't see anything about turning the boxes green.

What does holding CTRL when editing a sprite within a multi-sprite sprite sheet do?

sentences:
How do I lerp between values that loop (such as hue or rotation)? View Demo

I'm trying to make the joint rotate smoothly around the center of the canvas, toward the angle of mouse pointer. What I have works, but I want it to animate the shortest distance possible to get to the mouse angle. The problem occurs when the value loops around at the horizontal line (3.14 and -3.14). Mouseover that area to see how the direction switches and it takes the long way back around.

Relevant Code

// ease the current angle to the target angle
joint.angle += ( joint.targetAngle - joint.angle ) * 0.1;

// get angle from joint to mouse
var dx = e.clientX - joint.x,
    dy = e.clientY - joint.y;
joint.targetAngle = Math.atan2( dy, dx );

How can I make it rotate the shortest distance, even "across the gap"?

sentences:
glsl demo suggestions? In a lot of places I interviewed recently, I have been asked many a times if I have worked with shaders. Even though, I have read and understand the pipeline, the answer to that question has been no. Recently, one of the places asked me if I can send them a sample of 'something' that is "visually polished".

So, I decided to take the plunge and wrote some simple shader in GLSL(with opengl).I now have a basic setup where I can use vbos with glsl shaders.

I have a very short window left to send something to them and I was wondering if someone  with experience, could suggest an idea that is interesting enough to grab someone's attention.

Thanks

sentences:
How to attach "exiting" event in OpenFL? What is the exiting event (closing app by user or system) in new OpenFL?

And how does it differs between target platforms?

sentences:
Make a object render behind/trough another but make hide it if its behind some other object So first of all sorry for this strange title...
I know it may sounds worse and a bit complicated...

But heres my problem :

My player belongs to the "Player" layer.
He stands somewhere on my map, which belongs to the "Map" layer.
When the falls trough the map he isnt visible anymore... but he should ( dont ask why... he just should ).
But the should still be hidden by other objects ( Walls, Trees, other players ).

Player is standing ontop of the ground.

He is hidden by the tree ( works fine ) .

But he also should be visible while in the ground... and than while hes in the ground he also should be hidden by the tree for example.

I already tried to modify the shaders by setting ZTest to Less or Greater. But this caused strange iusses ( Half of the player was rendered and he wasnt hidden by any objects ).
I also tried to modify the render que... but this doesnt worked somehow... it just didnt changed anything...

So what else i could do to achieve this effect ?
I really appreciate any help ! :D

sentences:
How can I get the Selector dialog to include my prefabs When setting a variable for an object in Unity, for built-in types there is an option on the right-hand side to bring up a dialog that lists the possible values that can be chosen for that variable, for example when selecting a Sprite for a Sprite Renderer:

Is it possible, and if so what do I need to do, to have that list populated with the prefabs within my project?

In this example, there are a number of Item prefabs (both inside and outside the Resources folder if that makes a difference), however they do not appear in that dialog. Is there an attribute I am missing that needs to be specified on the Item class, or something else to enable this?

using UnityEngine;
using System.Collections.Generic;

public class Item : MonoBehaviour, IIdentifiable, IFilterable
{
    [SerializeField]
    private int IdField;
    [SerializeField]
    private bool ActiveField;

    public int Id => IdField;
    public bool Active => ActiveField;
}

public class ItemRandomiser : MonoBehaviour, IWeightedObject
{
    [SerializeField]
    private List<string> NamesField;
    [SerializeField]
    private List<Item> ItemTemplatesField;
}

sentences:
How can I set 3d sound to my game in unity5? I have been working on a racing game in unity5. Now I want to set 3d sound so that if the game objects are far away from and coming towards the camera then it sounds like began to attenuate and then louder when closer to the game camera.

But I don't know how to do that.......if anyone knows then please help me out.
Thanks...!

sentences:
Camera is centered on character, but doesn't show character in game window I'm using Unity 4.6.3. I create an animation from sprite. When I press Play button, I see animation plays on scene window, but on Game Window, I don't see anything.

Here is Inspector for main camera:

Here is Inspector for Player:

I have checked that both z = 0 when execute. Please tell me which part I config wrong ?

sentences:
Adjust Line Renderer start position to follow bone rotation I'm trying to make my first game in Unity and I want a line renderer to draw from the end of a turret's gun barrel. The problem is I'm rotating 2 bones in the turret to make it look at the enemy. I've used the bounding box of the turret to calculate the offset from the turret's origin to the end of the gun barrel. But when the turret rotates this position is obviously wrong. How can I calculate the correct starting point for the line renderer after performing a rotation?

Here is the code for the rotation and the line renderer:

void Start () {
    enemyManager = GameObject.Find("EnemyManager").GetComponent<EnemyManager>();
    lazerLine = GetComponent<LineRenderer>();

    platform = transform.root.Find("Armature/BaseBone/PlatformBone"); //Get the root transform of this turret (I.e. the turret itself, not the gun barrel)
    gunBox = transform.root.FindChild("Armature/BaseBone/PlatformBone/LowerArmBone/UpperArmBone/GunBoxBone");

    gunBounds = transform.parent.GetComponent<SkinnedMeshRenderer>().bounds.size; //Get the bounding box of the turret
}

void LateUpdate()
{
    Vector3 lookAt;
    Quaternion platformRotation;
    Vector3 gunLookAt;
    Quaternion rotation;

    if (enemiesInRange.Count > 0)
    {
        //Rotate Platform (The silver platform at the base of the turret)
        lookAt = enemyManager.activeEnemies[enemiesInRange[0]].transform.position - platform.position;
        lookAt.y = 0; //0 the Y axis to stop the turret tilting up or down

        platformRotation = Quaternion.LookRotation(lookAt);

        float rotateSpeed = 10.0f * Time.deltaTime;
        platform.rotation = Quaternion.Lerp(platform.rotation, platformRotation, rotateSpeed);

        //Rotate GunBox
        gunLookAt = enemyManager.activeEnemies[enemiesInRange[0]].transform.position - gunBox.position;

        rotation = Quaternion.LookRotation(gunLookAt);
        gunBox.rotation = Quaternion.Lerp(gunBox.rotation, rotation, rotateSpeed);

    }

    if (timer <= effectsDisplayTime)
    {
        Vector3 lazerStart = transform.position;
        //Adjust the lazer to draw from the default position of the top gun barrel (using the bounding box of the turret to calculate the position)
        lazerStart.y += (gunBounds.y * 0.85f);
        lazerStart.z += (gunBounds.z / 2) + 0.05f;

        //Adjust the lazer to follow the current rotation of the gun
/* ##### This is the part I need to add ##### */

        //Draw the lazer
        lazerLine.enabled = true;
        lazerLine.SetPosition(0, lazerStart);
        lazerLine.SetPosition(1, enemyManager.activeEnemies[enemiesInRange[0]].transform.position); //Of the enemies in range, shoot the first enemy that entered the turrets range

        effectsEnabled = true;
    }
}

Here are 2 picture to give you a better idea of what's happening.

This is with the rotation code commented out.

This is with the rotation code running.

sentences:
Canting of track in a racing game I am trying to create a small racing game in which the track would be modeled using a BSpline curve for the path's center line and directional vectors to define the canting of the track at each point.

My problem is that I don't know how to calculate the correct canting / slope of the curve, in such a way that it would be optimal or at least visually nice for a car to 'slant in the corner'.

My idea was to use the direction of the 2nd derivatives of the curve, however while this approach looks fine for most of the track, there are points in which the 2nd derivative makes sharp 'twists' / very quick 180 degree flips. I also read about 'knots' of bsplines, but I don't know if such 'twist' in 2nd derivatives is a knot or knots are something else.

Can you tell me that using a BSpline:
1. How could I calculate a visually nice canting of a track for a racing game?
2. Is it possible to do this by using some simple calculations of centripetal force / gravity?
3. Is it possible to do this by using 1st, 2nd and 3rd derivatives of the BSpline curve?

I am not looking for the 'physically correct' canting angle for the track, I would just like to create something which is visually pleasing in a simple game.

I am using a framework which has a built-in class for BSpline, including support for 1st, 2nd and 3rd derivatives of the curve.

sentences: Algo for Minimum no of solving in a level like Bubble Blast2 Is their any way to make a algo to know minimum no of way to solve in Bubble Blast 2. I am trying to make a clone of it. My real problem is only to determine the minimum no of tap to finish the game. I can play and find them but if level are more then 100 , it is time consuming . In Bubble Blast 2 there are 10000+ levels. So is there any way to solve this problem?

sentences:
OBB vs Frustrum collision detection Some definitions:

An oriented bounding box (OBB) is a rectangular block which can be represented in many ways, as a collection of eight vertices, a collection of six planes or others, for this particular case let's just consider these 2.
The camera frustrum is a convex object formed by 6 planes, resulting from converting the unit cube [(-1,-1,-1),(1,1,1)] to world space.

After a lot of researching I've seen you can use the SAT theorem to check collision between convex objects so I assume this could be a choice to check whether my objects will intersect with the camera frustrum.

Right now I've got the OBB of my meshes stored as 8 vertices in world space and my camera frustrum stored either as 8 vertices or 6 planes (also in world space).

So my question, is it SAT suitable to solve this particular problem? If it's so, how would you implement it or where can i find a decently fast implementation of it?

sentences:
Reusable top-down collision class I've recently picked up monogame and am working on a simple top down game to get me started and learn the basics.
I've got the movement and the rotation to follow the mouse sorted out but I'm stuck with the collisions.
What I want to know, basically, are two things:

What would be the best way to handle collisions? I know that Rectangle.Intersects(Rectangle1, Rectangle2) returns the overlapping rectangle, but, as the movement in top down is on x/y axis I'd like to know where the collision is happening so I can create kind of "wall sliding" where the player doesn't get stuck at the wall.
Is checking the players x/y coordinates against solid objects coordinates, then throw the player to his previous position if he enters the bounds of a solid object really the best approach? What would you suggest?
What would be the best way to apply collisions to all of the solids, npc's etc.? I'm currently thinking of creating a gameObject class that all of the objects will inherit from and just handle the collisions there.

Thanks for reading and hope that someone can give me some tips.

sentences:
Character doesnt move along with his rotation Decided to change my character movement from transform.Translate to a rigidbody movement, the only problem is that my character is not moving to where he is facing, also it falls really slowly in the Y axis. Heres the code related to the movement:

    float moveHorizontal = Input.GetAxis("Horizontal") * rotSpeed;
    float moveVertical = Input.GetAxis("Vertical") * speed;

    rb.velocity = new Vector3(0, 0, moveVertical);
    transform.Rotate(0,moveHorizontal, 0);

sentences:
Instancing with empty data, or varying vertex counts? I am new to game development, having only developed a few games before, in 2D space, but with 3D rendering.

I have implemented instancing before, but this is only my 2nd time doing it. I have a question regarding instancing.

To do instancing, I have a geometry buffer having a vertex declaration (for instance) 32 VertexPositionColor elements. This is because I have a few elements with 32 vertices in them.

I am rendering all elements as linelists. However, there are some elements in the list that doesn't have 32 vertices. I would like to include these in the instancing render process too.

So my final question is, what happens if I (for instance) fill out 8 of the vertices with their indexes, but then still send all the 32 vertices into the instancing shader? Is it possible?

Is there a better approach to be able to instance all kinds of elements, with various vertex counts?

sentences:
2D simulating light sources (subtract a texture from an other) I want to simulate a night and day cycle with SFML (plain 2D, no shadows). What I want is to get a smooth transition from day to night, and during night having some lights "on".

So the approach I've thought is adding a black layer on top and change its transparency with time, that gives the effect I'm looking for. For adding lights I can crop out circles out of that layer

sf::CircleShape lightCircle(200);
lightCircle.setFillColor(sf::Color(255, 255, 255, 1));

sf::RenderTexture renderTexture;
renderTexture.create(/* view size */);

while (window.isOpen()) {
  // ...

  // update light
  renderTexture.clear(sf::Color::Black);
  renderTexture.draw(lightCircle, sf::BlendNone);
  renderTexture.display();

  // draw
  window.clear();
  window.draw(sf::Sprite(renderTexture.getTexture()));
  window.display();
}

Now, what I would like to do is use my own image instead of a CircleShape. Say a circle or a cone with fading borders, some more realistic than just a circle. Like

I have tried with sf::Image and createMaskFromColor but I'm not able to handle the fading edges.

How can I get that?

Am I in the right path or is there a simpler approach?

sentences:
WebGL half float equivelant? I'm trying to find a half float for the purposes of doing math in a fragment shader, not trying to have a half float texture.

Is there an equivalent of the half float data type in WebGL?
I know you can create a lowp float, but is that the same, or not necessarily?

sentences:
"Unable to create OpenGL 3.3 context (flags 0, profile 1)" Trying to run any of the well-known McKesson's tutorials on a friend's laptop results in the aforementioned exception.

I read that in order to run applications which use OpenGL 3.3 you must at least have an ATI HD or Nvidia 8xxx GPU series. He has an ATI HD class graphics processor which eliminates (maybe) this issue. Also, I read that this error may result in having old drivers. He updated his drivers but that didn't solve the problem.

The tutorials are built as said in the book introduction and glsdk is installed.

If more information is needed, say so and I will provide it.

What are the other reasons for this kind of exception? And how can I fix them?

sentences: LibGDX ImageButton resizeing How can I resize ImageButton ? It show very big on screen . How I know it is an Actor and it is not resizing automatically . I can`t find the method for resizing it. Any ideas?

sentences:
Board Game Design in Cocos2d I am going to start a chess like board game. And for that I have reviewed a number of things available.

One is http://www.mapeditor.org/, using which you can create a grid base games.

Another option is geekgameboard for iphone available at http://mooseyard.lighthouseapp.com/projects/23201-geekgameboard

Now I want your expert opinion on what would be better to make a game in cocos2d, using the first option or the second option? Both looks promising to me and give good control over board design.

PS: Sorry for duplicates, I found about the https://gamedev.stackexchange.com/ lately after posting it on stackexchange. So I am just posting it here again as I feel this is a more relevant board.

sentences:
Whats the most efficient method for controlling entities? I'm creating a tower defense game and I'm having logistical issues trying to figure out how to best have all of the enitites do their apporiate task.

I have considered just constantly looping through a list of all the game entities calling a onAction() method, but I'm not sure if that is effective.

I have also considered having each entity be a thread, but when I am dealing with hundreds of entities, some of which don't need thread time, I'm back to square one.

Can I get any suggestions on a solid approach? Am I on the correct track with my first idea?

Thanks for any help ~Aedon

sentences:
How to prevent bullets from passing right through entities? (sorry for bad english)

I'm making 2D arcade game. I write all of physics stuff myself. The problem involves bullet behaviour. Imagine bullet flying towards some entity. If the bullet's velocity is relatively high and the entity is small, the bullet passes right through the entity which is obviously not what it's meant to do. Here's the gif that shows why that happens (values are exaggerated to better show the process):

As you can see bullet's velocity is simply bigger than the size of the entity. Then I came up with this:

Getting point of impact coordinates means I can check if the distance between the point of impact is smaller than the bullet's velocity. If the distance is smaller then bullet should collide with the entity at the point of impact. But I don't know how to calculate the coordinates of the point of impact. Pls help.

sentences:
Sketchup model renders wrong in XNA My XNA model renders wrong.

It should render like that:

But it renders like that:

The background doesn't matter. It's just the model that renders wrong.

Here is the drawing code:

protected override void Draw(GameTime gameTime)
{
    GraphicsDevice.Clear(Color.CornflowerBlue);

    DrawModel(model);

    base.Draw(gameTime);
}

private void DrawModel(Model m)
{
    GraphicsDevice.RasterizerState = RasterizerState.CullNone;

    Matrix worldMatrix = Matrix.CreateRotationY(MathHelper.ToRadians(rot))
        * Matrix.CreateTranslation(new Vector3(0,0,0));

    foreach (ModelMesh mesh in m.Meshes)
    {
        foreach (BasicEffect effect in mesh.Effects)
        {
            effect.EnableDefaultLighting();
            effect.World = worldMatrix;
            effect.View = viewMatrix;
            effect.Projection = projectionMatrix;
        }

        mesh.Draw();
    }
}

sentences:
Box2d pathfinding using raytracing / predicted collisions I have a Box2d/Cocos2d iOS game with enemies that attempt to follow the player (to attack). I'm working on improving the pathfinding logic so that the enemies won't crash into objects in the world.

Using raytracing, I know when there's an obstacle between an enemy and the player. I know when the enemy can't see the player.

I'm attempting to find a good way for the enemy to navigate around the obstacle, no matter what direction it's facing.

Right now, I start with the angle between the enemy and the obstacle. I gradually increment the angle, looking for any on-obstructed path that will allow the enemy to travel further than the obstacle's distance. This seems to work well so far, but it doesn't take into account the size of the enemy.

For example, if I have a 32px-squared enemy, the raytrace may find a clear path that would involve the edges of the ship hitting an obstacle.

Is there a way I can run a raytrace, predict collisions for something with a known width? Or is there a better way for my enemies to navigate around an obstacle.

sentences:
Rendering 10M point that changing position (individualy) at 30Hz i'm able with openTk (vb.net) to draw 10M of points adn rendering it.
The problem is that the bind operation take 114mS on every frame refresh.
I need to refresh the position at 30 Hz , so what can i use for speeder this operation.

sentences:
When learning, nothing is better than practice A little introduction:

I'm 25, and going to this private french school, CreaJeux, which begins in october. I will be learning mostly game programming, something I wanted to do a long time ago, since the day I wondered how were 3d graphics working on my playstation, when I was 14 or so.

I'm very eager and impatient to begin, and I can't think on anything else (I'm bored), I feel like I'm wasting my time doing nothing, and I wanted to just practice on something during my spare-time, whatever it is.

I'm not a beginner in C/C++, I know how to program, but I didn't make a lot of stuff excepy a little tetris-like with pygame: I just want to make something in 3D, even if it awful and plain ugly, non-accelerated or whatever.

Isn't there anything else than open source 3D engines like irrlicht, panda3d or ogre3d to start something ? Isn't there some game dedicated to modding or dedicated to educate begginners ? Or some projects or practices for begginners like me ? Even simple and ugly 3D seems hard to come by...

sentences:
JFrame pack() method I'm quite new to java.

I was developing a game using java and I realized that the position of pack() method can influence rendering. For instance:

Frame Class

public class Frame {
    public Frame(int width, int height, Game game) {
        JFrame frame = new JFrame("Practice Game");

        frame.setPreferredSize(new Dimension(width, height));
        frame.setMaximumSize(new Dimension(width, height));
        frame.setMinimumSize(new Dimension(width, height));

        frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
        frame.setLocationRelativeTo(null);
        frame.setVisible(true);

        frame.pack();  // pack method is used before adding game component to frame
        frame.add(game);
    }
}

Game Class (I skipped few methods for simplicity)

public class Game extends Canvas implements Runnable {
    // Dimension
    public static final int WIDTH = 320;
    public static final int HEIGHT = 320;

    public Game() {
        new Frame(WIDTH, HEIGHT, this);

        menu = new Menu(WIDTH, HEIGHT);

        start();
    }

    public void render() {
        BufferStrategy bs = this.getBufferStrategy();

        if (bs == null) {
            this.createBufferStrategy(3);
            return;
        }

        Graphics2D g = (Graphics2D) bs.getDrawGraphics();

        menu.render(g);

        g.dispose();
        bs.show();
    }

    public static void main(String[] args) {
        new Game();
    }

This set of code results in making an empty frame without any component displayed.

However, when I tried putting pack method after I added game component to the JFrame, it successfully displayed what I intended to display.

I heard that pack() method is used to pack the components within the JFrame based on the component’s preferred sizes. However, I don't understand how the position of pack() method could influence the entire rendering (only displaying an empty frame).

Also, the actual size of frame doesn't match the dimension that I assigned to the frame. To illustrate this:

Menu Class

public class Menu {
    public Menu(int width, int height) {
        this.width = width;
        this.height = height;

        squareSize = 64;

        squareRowNum = height / squareSize;
        squareColNum = width / squareSize;
    }

    public void render(Graphics2D g) {
        drawBackground(g);
    }

    public void drawBackground(Graphics2D g) {
        for (int i = 0; i < squareRowNum; i++) {
            for (int j = 0; j < squareColNum; j++) {
                g.setColor(Color.black);
                g.setStroke(new BasicStroke(3));
                g.drawRect(j * squareSize, i * squareSize, squareSize, squareSize);
                g.setColor(Color.white);
                g.fillRect(j * squareSize, i * squareSize, squareSize, squareSize);
            }
        }
    }

When running these 3 classes together, it display:

The rectangle box at the bottom are cut off instead of fully displaying 5 * 5 rectangles (each rectangles has dimension of 64, 64 and the frame size is supposedly 320, 320). I assumed that it's because I'm using mac. I think this can also be fixed using pack() method but I don't know how.

sentences:
OpenGLES how to make a 3D object iOS I am a newbie in OpenGLES, so pardon me if I cannot state the question properly.

Is it possible to create a 3D box with the following imports only:
OpenGLES, QuartzCore, GLKit
I have created a 2D object, (squares, triangles, polygons) but I want to make them into 3D without using cocos3D or blender or other frameworks or api (if its possibe). But how?

sentences:
What shall I choose between CoronaSDK or AirPlay? 1st Question is I want to write a board game for iOS and Android so I'm coming up with CoronaSDK and AirPlay. Since I have a mac, development platform is not an issue but the problem is which one should I choose. I'm fluent with PHP and web languages and familiar with C but it's a new language for Lua. I know a lot of people prefer Corona but why not Airplay? It even provides more devices and able to write in C/C++.

2nd Question is I want a SDK with shortest development time and easier coding. I don't need complex 3D or animation engine since the game is a board game like chess or monopoly. What would you recommend?

Really appreciate anyone trying to answer my questions here :)

sentences:
Can I run old projects after updating Unity? Today I decided to upgrade unity from 5.0.0 to 5.5.0.

But before updating it, I wanted to know: Can I run/build my projects made in Unity 5.0.0 in Unity 5.5.0?

sentences:
Multiple ( V- / I- ) Buffers, is it sane? Currently I am developing an RTS game using XNA ( / ANX.Framework ).
There is one thing bothers me. I am not sure in what way or how to organise Buffers.
Should I use a new Vertexbuffer for any object ( e.g. a Char, a Table, an model ) or is it better to use ONE HUGE/ BIG Buffer to store any geometry in?

I am still new to 3D Programming though I finished yet couple games using DirectX 9.

Well, I hope this question qin't a duplicate and I appreciate any answer leading me into the right direction.

sentences:
Most optimal way to load 2D world I am creating a 2D car racing game. (Yes, a Hill Climb Racing clone)

What I am doing right now is load 10% of the map every time the user gets to 7%. For example:

Imagine the map has 10km. (10000m)

When the game starts, the game loads the road from -100m to 1000m.

When the user gets to the 700m (7%) mark, the game deletes 0-500m and loads 1000m to 2000m (10%) (Having loaded from 500m to 2000m).

This will happen every 1000m from now on (1700m, 2700m, 3700m).

I used to create the whole world, and with this new method, I increased my mobile phone fps from 32-34 to stable 60 fps.
BUT, every time the user is in the 700m mark, the game freezes for 0.55-0.60 seconds. (When I load/delete the new road).

Is there a better way (In terms of FPS (Performance)) to load the world?

sentences:
Error instantiating Texture2D in MonoGame for Windows 8 Metro Apps I have an game which builds for WindowsGL and Windows8. The WindowsGL works fine, but the Windows8 build throws an error when trying to instantiate a new Texture2D.

The Code:

var texture = new Texture2D(CurrentGame.SpriteBatch.GraphicsDevice, width, 1); // Error thrown here...
texture.setData(FunctionThatReturnsColors());

You can find the rest of the code on Github.

The Error:

SharpDX.SharpDXException was unhandled by user code
  HResult=-2147024809
  Message=HRESULT: [0x80070057], Module: [Unknown], ApiCode: [Unknown/Unknown], Message: The parameter is incorrect.

  Source=SharpDX
  StackTrace:
       at SharpDX.Result.CheckError()
       at SharpDX.Direct3D11.Device.CreateTexture2D(Texture2DDescription& descRef, DataBox[] initialDataRef, Texture2D texture2DOut)
       at SharpDX.Direct3D11.Texture2D..ctor(Device device, Texture2DDescription description)
       at Microsoft.Xna.Framework.Graphics.Texture2D..ctor(GraphicsDevice graphicsDevice, Int32 width, Int32 height, Boolean mipmap, SurfaceFormat format, Boolean renderTarget)
       at Microsoft.Xna.Framework.Graphics.Texture2D..ctor(GraphicsDevice graphicsDevice, Int32 width, Int32 height)
       at BrewmasterEngine.Graphics.Content.Gradient.CreateHorizontal(Int32 width, Color left, Color right) in c:\Projects\Personal\GitHub\BrewmasterEngine\BrewmasterEngine\Graphics\Content\Gradient.cs:line 16
       at SampleGame.Menu.Widgets.GradientBackground.UpdateBounds(Object sender, EventArgs args) in c:\Projects\Personal\GitHub\BrewmasterEngine\SampleGame\Menu\Widgets\GradientBackground.cs:line 39
       at SampleGame.Menu.Widgets.GradientBackground..ctor(Color start, Color stop, Int32 scrollamount, Single scrollspeed, Boolean horizontal) in c:\Projects\Personal\GitHub\BrewmasterEngine\SampleGame\Menu\Widgets\GradientBackground.cs:line 25
       at SampleGame.Scenes.IntroScene.Load(Action done) in c:\Projects\Personal\GitHub\BrewmasterEngine\SampleGame\Scenes\IntroScene.cs:line 23
       at BrewmasterEngine.Scenes.Scene.LoadScene(Action`1 callback) in c:\Projects\Personal\GitHub\BrewmasterEngine\BrewmasterEngine\Scenes\Scene.cs:line 89
       at BrewmasterEngine.Scenes.SceneManager.Load(String sceneName, Action`1 callback) in c:\Projects\Personal\GitHub\BrewmasterEngine\BrewmasterEngine\Scenes\SceneManager.cs:line 69
       at BrewmasterEngine.Scenes.SceneManager.LoadDefaultScene(Action`1 callback) in c:\Projects\Personal\GitHub\BrewmasterEngine\BrewmasterEngine\Scenes\SceneManager.cs:line 83
       at BrewmasterEngine.Framework.Game2D.LoadContent() in c:\Projects\Personal\GitHub\BrewmasterEngine\BrewmasterEngine\Framework\Game2D.cs:line 117
       at Microsoft.Xna.Framework.Game.Initialize()
       at BrewmasterEngine.Framework.Game2D.Initialize() in c:\Projects\Personal\GitHub\BrewmasterEngine\BrewmasterEngine\Framework\Game2D.cs:line 105
       at Microsoft.Xna.Framework.Game.DoInitialize()
       at Microsoft.Xna.Framework.Game.Run(GameRunBehavior runBehavior)
       at Microsoft.Xna.Framework.Game.Run()
       at Microsoft.Xna.Framework.MetroFrameworkView`1.Run()
  InnerException:

Is this an error that needs to be solved in MonoGame, or is there something that I need to do differently in my engine and game?

sentences:
One or multiple VertexBuffers I'm currently working on a personal project where I'm trying to load the levels and all of the geometry from the game "Medal of Honor Allied Assault" into my own C# code-base based on SharpDX.

I managed to do all that, but now that I'm trying to cleanup the code I came across a few questions on which Google and other sites don't give me a clear answer to, hence I'm turning myself to StackExchange once more!

Currently, I'm rendering the whole scene using the following equation:
1 VBO (BSP) + 1 VBO (Terrain) + (1 VBO (Model) * NumberOfModels)

For each VBO, I'm keeping track when and where I have to start a new DrawIndexedPrimitive-call (eg. Texture-swap).

Is my current setup sufficient, or should I put everything into as less VBO's as possible? Or is there a better approach. How about culling which I'm not bothered with just yet, would one massive VBO work better for that than lots of smaller ones?

To give a little more information: some models require 3-4 Texture-swaps, are relatively small (128 vertices to 4k vertices) and I'm currently not even animating them yet.

If I'd go with my feeling, I would give everything its own VBO, arranging vertices in such a way I can batch textures and use instancing techniques, but I'm unsure this the way to go.

Feel free to ask for more information!

sentences:
Cant write/read to/from external storage with LibGDX My create method looks like this:

@Override
public void create () {
    batch = new SpriteBatch();

    FileHandle file = Gdx.files.external("file.txt");
    file.writeString("My god, it's full of stars", false);
}

I allso included:

<uses-permission android:name="android.permission.WRITE_EXTERNAL_STORAGE"/>
<uses-permission android:name="android.permission.READ_EXTERNAL_STORAGE"/>

The Exception i get is this:

02-13 14:45:51.858 12439-12466/com.snowdevs.tweetiebirds E/AndroidRuntime: FATAL EXCEPTION: GLThread 1120
Process: com.snowdevs.tweetiebirds, PID: 12439
com.badlogic.gdx.utils.GdxRuntimeException: Error writing file: file.txt (External)
   at com.badlogic.gdx.files.FileHandle.writeString(FileHandle.java:353)
   at com.badlogic.gdx.files.FileHandle.writeString(FileHandle.java:339)
   at com.snowdevs.tweetiebirds.TweetieBirdsGame.create(TweetieBirdsGame.java:22)
   at com.badlogic.gdx.backends.android.AndroidGraphics.onSurfaceChanged(AndroidGraphics.java:254)
   at android.opengl.GLSurfaceView$GLThread.guardedRun(GLSurfaceView.java:1519)
   at android.opengl.GLSurfaceView$GLThread.run(GLSurfaceView.java:1240)
Caused by: com.badlogic.gdx.utils.GdxRuntimeException: Error writing file: file.txt (External)
   at com.badlogic.gdx.files.FileHandle.writer(FileHandle.java:330)
   at com.badlogic.gdx.files.FileHandle.writeString(FileHandle.java:350)
   at com.badlogic.gdx.files.FileHandle.writeString(FileHandle.java:339)
   at com.snowdevs.tweetiebirds.TweetieBirdsGame.create(TweetieBirdsGame.java:22)
   at com.badlogic.gdx.backends.android.AndroidGraphics.onSurfaceChanged(AndroidGraphics.java:254)
   at android.opengl.GLSurfaceView$GLThread.guardedRun(GLSurfaceView.java:1519)
   at android.opengl.GLSurfaceView$GLThread.run(GLSurfaceView.java:1240)
Caused by: java.io.FileNotFoundException: /storage/emulated/0/file.txt: open failed: EACCES (Permission denied)
   at libcore.io.IoBridge.open(IoBridge.java:452)
   at java.io.FileOutputStream.<init>(FileOutputStream.java:87)
   at com.badlogic.gdx.files.FileHandle.writer(FileHandle.java:322)
   at com.badlogic.gdx.files.FileHandle.writeString(FileHandle.java:350)
   at com.badlogic.gdx.files.FileHandle.writeString(FileHandle.java:339)
   at com.snowdevs.tweetiebirds.TweetieBirdsGame.create(TweetieBirdsGame.java:22)
   at com.badlogic.gdx.backends.android.AndroidGraphics.onSurfaceChanged(AndroidGraphics.java:254)
   at android.opengl.GLSurfaceView$GLThread.guardedRun(GLSurfaceView.java:1519)
   at android.opengl.GLSurfaceView$GLThread.run(GLSurfaceView.java:1240)
Caused by: android.system.ErrnoException: open failed: EACCES (Permission denied)
   at libcore.io.Posix.open(Native Method)
   at libcore.io.BlockGuardOs.open(BlockGuardOs.java:186)
   at libcore.io.IoBridge.open(IoBridge.java:438)
   at java.io.FileOutputStream.<init>(FileOutputStream.java:87)
   at com.badlogic.gdx.files.FileHandle.writer(FileHandle.java:322)
   at com.badlogic.gdx.files.FileHandle.writeString(FileHandle.java:350)
   at com.badlogic.gdx.files.FileHandle.writeString(FileHandle.java:339)
   at com.snowdevs.tweetiebirds.TweetieBirdsGame.create(TweetieBirdsGame.java:22)
   at com.badlogic.gdx.backends.android.AndroidGraphics.onSurfaceChanged(AndroidGraphics.java:254)
   at android.opengl.GLSurfaceView$GLThread.guardedRun(GLSurfaceView.java:1519)
   at android.opengl.GLSurfaceView$GLThread.run(GLSurfaceView.java:1240)

I use a Nexus 5 with Android 6 Marshmallow for testing.
I searched and found that Android 6 uses runtime permissions but the LibGDX guys says that it works even on Android 6... Is there a fix With or Without runtime permissions?

sentences:
Unity: objects behaving different when NetworkTransform is used to sync movement I am experimenting with some simple multiplayer/networking in unity. Currently I have a plane object as the ground, and a cube prefab as the player object. I have a network manager with round-robin spawn and the built-in HUD. The cube has simple movement control (up/down is forward/backward, left/right turns the cube).

I can successfully start a game, build it, and add a client from the built app. However, when movement gets sent over the wire, the non-local player cubes in the game appear to "tilt forward," seemingly from the drag that the cube creates against the plane while moving. Strangely, when moving the local cube, no such tilt is experienced.

Here is a gif which illustrates:

In the above gif, the cube being moved is in the foreground window. Notice how the cube is only tilting in the other window.

Here is Update function of the Cube controller script:

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

        // Change translation
        float moveAmount = CrossPlatformInputManager.GetAxis("Vertical");
        Vector3 deltaTranslation = transform.position + transform.forward * movementSpeed * moveAmount * Time.deltaTime;
        localRigidBody.MovePosition (deltaTranslation);

        // Change rotation
        float turnAmount = CrossPlatformInputManager.GetAxis("Horizontal");
        Quaternion deltaRotation = Quaternion.Euler (turnSpeed * new Vector3 (0, turnAmount, 0) * Time.deltaTime);
        localRigidBody.MoveRotation (deltaRotation * localRigidBody.rotation);

        MoveCamera();

    }

The ground is a plane with a rigid body and doesn't have a network identity or transform.

How do I stop the dragging from occurring and have the behavior be consistent across both instances of the game?

The full code to this project as it is right now is here: https://github.com/andyperlitch/blocks-multiplayer

Thanks!

sentences:
Correct order of operations in a platformer game loop I've run into an issue with my Mega Man engine, and the structure of my game loop is making it very difficult to fix. With Rush Jet, or any falling platform, Mega Man needs to stay attached to the platform as it falls. Right now the best I can do (without resorting to workarounds like magic forcefields that pull him down) has it so that he falls for a single frame when the platform first starts falling. But even this requires the falling platform to pull him down during the collision check. Without this extra step, he constantly "jitters" in falling as the platform descends.

The order of events in my game loop is making this happen. It goes like this:

Mega Man and Rush Jet are flying horizontally for a while.
Thinking phase: Player presses down - the platform decides to set its velocity to downward.
Action phase: Platform moves down, player has no awareness of this.
Reaction phase: The two are not colliding, so no "binding force" check can occur.
Next frame, Mega Man falls. A frame later, gravity catches up and he lands on the platform again, resetting his y velocity to 0.

You can see there the basic order of my loop:

Thinking phase, where you analyze collisions from the previous frame, and any other variables, to decide on state transitions and other adjustments.
Action phase - everyone moves according to their velocity.
Reaction phase - collision checks, adjust positions to fix them. This also handles effects like moving platforms, eg. push the player by some amount. The changes to his velocity are applied in the next frame, during the action phase.

I've tried reordering these steps and various other changes, but they all make the whole thing much worse, with all sorts of bugs. If I need to make sweeping changes to my engine to get these things right, I'd rather know what the "proper" way is before wasting any time.

I know one possible solution would be for the movement step to look at who was touching the platform in the previous frame and pull him then, so they actually move together. That seems too complex though, reaching between components like that. My engine code already feels way more complicated than the original game could have been, suggesting that I'm doing something wrong.

So is there a proper sequence of events? There's another question on here about moving things along with a platform, but that doesn't address the order of events issue which causes my problem. Also, if anyone actually knows the way the classic Mega Man games did it, that would obviously be a huge help.

Find as much of my code as you want at https://github.com/Tesserex/C--MegaMan-Engine/tree/master/Mega%20Man. The CollisionComponent and MovementComponent may be the most useful.

sentences:
Should I calculate in meters or pixels In my car sim I am doing my calculations in Standard Units, except for the distance which is in pixels. Is this still correct (my guess is no) or should I use Meters ?

If I should use meters what is the best way to go about it?
should I just pick a scale 10px = 1m or is there a better way to do this ?

thanks in advance.

Some additional info: I'm using Unity3D and using its physics engine.

sentences:
Can MoonSharp call functions from static classes? My question is very simple. I'm using MoonSharp to add Lua scripting to my game. One use case involves calling a static artificial intelligence function from a static class I've implemented in C#. I know you can easily call static functions using MoonSharp, but can those functions be called if the class is static?

I haven't been able to find an answer so far through Google or on this site. My own experimentation with code hasn't been successful either. There are pretty simple workarounds for the problem I'm asking about (like making the AI class not static), but I'd prefer to avoid them.

Thank you :)

sentences:
Why are 3d projections on a 2d screen not like what the human eye sees? Firstly, I'm sorry if this question doesn't make much sense or is poorly written - I have almost no experience with programming, and none at all with game development. I'm also not sure it's an appropriate question for gamedev stack exchange, so sorry if that's the case.

Anyway, the question is this - what are some ways of doing the vision in a fps game?

If I understand it correctly, the problem can be stated the following way - given a 3d environment given in 3d coordinates, and a camera with some direction and certain field of vision, our goal is to somehow project the environment, to a 2d screen, similar to how our eyes do it, or similar to how a camera does it.

One way to do this is the following - whatever is exactly in the direction of the camera will get displayed exactly to the middle of our 2d screen (let's presume the 2d screen is round for simplicity, with radius 1), and the rest in the field of vision will get projected linearly based on the angle. For example, if field of vision is 90 degrees (anything 45 degrees from the direction of the camera will be in the field of vision), then things 45 degrees away from the direction of the camera will get displayed to the outer circle/edge of the 2d screen, and things 22.5 degrees away will get displayed to the circle with radius 0.5. This might be similar to how a camera or our eye does it, but I'm not sure.

Now in reality, this doesn't seem to be how it's done. To give an example, if I take something like DOOM, or I think any modern fps game, and I were to stand in front of a very long wall that's of the same height everywhere, and I were looking perpendicularly towards it, the height of the wall will be the same everywhere in my 2d projection - in reality though, or a camera for example, would display the very furthest (furthest from the center of the vision) parts of the wall to be shorter in height.  But, given a small enough field of vision, the difference seems negligible.

Either way, it seems like fps games don't really consider this fact, and I want to ask - why? Maybe the difference is barely noticeable, but much more power demanding? Either way, I would appreciate an explanation or information concerning how exactly the human eye or camera projects 3d environment to a 2d picture.

sentences:
How to resolve OBB collision penetration? I would think this is a common issue, but I couldn't find an answer that helped me. Help would be appreciated.

In my game I have rectangular objects. They have rotating bounding box, aka not AABB but boxes that rotate with the entity and always match it's exact shape (I think it's called OBB).

When two objects collide, they often penetrate each other a little:

My question is, how can I move the objects out of each other? (Before performing the 'actual' collision handling, i.e. setting velocities etc).

sentences:
OpenGL vs OGRE : Which is the best for beginner? I am interested in getting into game development and posses good C/C++ programming skills. I have tried OGRE before, and I am curious whether I should learn either OGRE or OpenGL as a starting point.

From my understanding, OGRE is a wrapper for OpenGL and DirectX. So, supposed that I learn OGRE, do I still need to learn OpenGL as well to develop a game?

Also, can someone points me good tutorial for OpenGL? I found that OGRE is well documented (it's even come with the distribution!) but for OpenGL, most of the tutorials I came over are outdated.

sentences:
Game actions that take multiple frames to complete I've never really done much game programming before, pretty straightforward question.

Imagine I'm building a Tetris game, with the main loop looking something like this.

for every frame
    handle input
    if it's time to make the current block move down a row
        if we can move the block
            move the block
        else
            remove all complete rows
            move rows down so there are no gaps
            if we can spawn a new block
                spawn a new current block
            else
                game over

Everything in the game so far happens instantly - things are spawned instantly, rows are removed instantly etc. But what if I don't want things to happen instantly (i.e animate things)?

for every frame
    handle input
    if it's time to make the current block move down a row
        if we can move the block
            move the block
        else
            ?? animate complete rows disappearing (somehow, wait over multiple frames until the animation is done)
            ?? animate rows moving downwards (and again, wait over multiple frames)
            if we can spawn a new block
                spawn a new current block
            else
                game over

In my Pong clone this wasn't an issue, as every frame I was just moving the ball and checking for collisions.

How can I wrap my head around this issue? Surely most games involves some action that takes more than a frame, and other things halt until the action is done.

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:
How can I calculate current level from total XP, when each level requires proportionally more XP? In my game, XP needed to reach the next level is Current Level × Level Threshold.  Given that, how can I get my current level from the total XP ever earned?

For example:

Level Threshold = 50
Current Level = 1

Starting at level 1, I would need (1 × 50) = 50 XP to get to level 2, and so on.

Level 1: 50 XP needed to reach level 2
Level 2: 100 more XP needed to reach level 3
Level 3: 150 more XP needed to reach level 4

In other words, the progression table is as follows:

Level 1: 0 XP to 49 XP
Level 2: 50 XP to 149 XP
Level 3: 150 XP to 299 XP
Level 4: 300 XP to 499 XP

If I have 300 XP, I'll just reached level 4. How can I calculate that generally?

sentences:
Send request for Turned Based Battle I want to create a turn based battle system for Pokemon online rpg!

I will some how implement the coding of the battle..but I want to know how can a user send request for a battle to other user?

If a user wants to have a live battle with some other user, he will send a battle request!
If the opponent wants to battle he will accept it otherwise it will be rejected and no battle will take place...!

How can I implement the above??

sentences:
How Apple Metal API distinguishes uniforms from vertices buffers? I am not sure how metal distinguishes uniforms from vertices buffers?
As far as I know code for passing uniforms in buffers are the same like for vertices:

[self.commandEncoder setVertexBuffer:positionBuffer offset:0 atIndex:0];
[self.commandEncoder setVertexBuffer:uniformBuffer offset:0 atIndex:1];

In shader code there is no keyword defining some struct as uniforms, so how Metal know it? In Opengl GLSL was uniform keyword which was clear for me but I can't figure how it is solved in metal.

sentences:
Find closest point from an origin, in a mesh I want to do something similar to a raycast. With a raycast, you can set an origin and a destiny, and check where the ray collides with something but only with a line. What I want to do, is given an origin with x, y and z coordinates, check which is the closest point it collides in a mesh. so if I have a box in 0, 0, 0 with width 2, and my origin is on 0, 0.5, 0, the algorithm/function should return that the closest point it collides is 0, 1, 0. I hope I am clear enough.

I am using Ogre3D, and bullet physics. I can also use OpenGL.

Thanks.

sentences: my android game works very well on unity editor but not on device Im working on a android unity project. My game works very well on the editor but, when i build it and run it on blue stacks emulator, it starts working corruptly. Bullets shoot twice in a time. When level is not started, the screen to the next level shows and...  what can be the cause of this problem?  maybe reason is bad emulator

sentences:
How do I read input from multiple keyboards/mice on one computer? I want to be able to read inputs from multiple keyboards and still differentiate them. It's for split-screen. I know it's possible, because Serious Sam 3 allows it.

Edit : Well a whole lot of my description has been removed, anyway, one of the maine details was that it had to be cross-platform! However, I found just today a POSSIBLE solution, which is using libusb 1.0 (it's Windows-compatible since 1.0), I'm using 1.0.15 (which is actually libusbx, they've created a branch and have come back to the main branch for 1.0.16 =/ )! So my actual answer now is (because I have no PS/2 port :S), is libusb recognizing PS/2 devices (I know nothing about PS/2 standard, so I don't know, but I have some reasons to think it can be recognized). Does anyone know it? If noone knows, I wrote a program that enumerates USB devices and displays their Product and Manufacturer name, is anybody willing to test it? (you can run it in Avast! Sandbox if you prefer, it still works ^^)

Thanks in advance, and thanks for all the responses yet!

Oh by the way, using RawInput is out of question because of its Windows exclusive API, I thought about it once, but I want my game to be Windows/Linux/Mac compatible ;)

Edit2 : As marked in the tags, I'm coding in C++ (was also part of the original post)! I really don't understand what happened, since the original post title even changed =/ That was not my original question, the question was about the PS/2 / USB thing!

sentences:
What is the term for collectibles which enhance storytelling (i.e. audio logs, bestiary entries, etc.)? For example, Borderlands uses ECHO logs, there are audio entries in BioShock, RPGs often have "books" that you can collect pages to read a mini bonus story.

Is there a term more specific than "collectible" which conveys the element of storytelling?

sentences:
How can I support different resolutions with Monogame? I want to support the following 4 resolutions in my Windows Phone 8 game: 480 × 800, 768 × 1280, 720 × 1280, 1080 x 1920.
How can I do that with Monogame? If I draw a sprite with Monogame, the sprite is not drawn on the right place in every resolution. For example, with a resolution of 768 × 1280, the sprite is drawn in the center of the screen, but if I use another resolution, the sprite is no more drawn in the center of the screen.

What should I do so that the sprite is in every resolution on the same place?

sentences:
Should I batch up debug primitives for rendering in modern OpenGL? I've recently started porting some old rendering demos I did to modern OpenGL. I had a debug drawing class in my old code which used immediate mode glBegin(), glEnd() etc. for rendering debug objects such as triangles, cubes and spheres etc.

Originally I replaced the code in these functions with code to generate the VAO and VBOs (for position and colour), bind them, assign the vertex data, render, then disable and delete the VBOs and VAO. Is there anything wrong with this?

I've been thinking about modifying the class so that every time it gets a draw primitive call it generates the VAO and VBOs and assigns the vertex data but doesn't actually do the rendering until after all the other rendering has been completed. Then it renders all the debug prims that have been stored at once.

I'm not sure of the benefits of either way of doing this and was just wondering what people thought.

sentences:
Google street view racing game? How would one create a map for gaming using Google street view? Are there any programs for doing this? The cars, people and objects could be edited out and replaced with digital copies if the same objects for that area. Originally I was thinking GTA Local but would require a much more work.

3D game with Pre-rendered background

https://law.stackexchange.com/questions/37810/do-objects-in-the-public-view-need-licencing

sentences:
Citrus Engine - How do I set-up the camera? (Would be great if someone with greater rep created the Citrus Engine tag and add it to this question)

I want to make a game where my inner starling stage dimensions are 320x240. My game will have three parts:

A vertical (left-aligned 32x208) toolbar in Rect(0, 0, 32, 208)
A horizontal (bottom-aligned 320x32) toolbar in Rect(0, 208, 320, 32)
The game content (right-top-aligned 288x208) in the remaining area: Rect(32, 0, 288, 208). It will be handled by the state, view, and camera.

My game would consist of only one playable state (which would render the level content by fetching the data from the server), and would be reset when the player goes to another map (other states are meaningless here since they are just form/UI states).

Please correct me if I'm wrong with these steps, and help me with the further:

I can set cameraLensWidth to 288px and cameraLensHeight to 208.
I can set the inner center to 0.5 and 0.5 with no deadZone (my game will require it), and set the bounds to Rect(0, 0, myMapWidth * tileWidth, myMapHeight * tileHeight) to track player movement only inside the map, and ensuring the camera follows the target by focusing it in its center (as long as it can).
What I don't know is how to ensure the camera top-left corner position be at (0, 32).

What must I do to ensure the last point?

sentences:
Unity Serialize IConvertible variable How can i Serialize IConvertible variable to show up in the inspector? As it now, i can only see the string name. But not the value.

E.g adding CStat

item.AddCStats("description", "This a long ranged boosted weapon.");
item.AddCStats("attack", 10);
item.AddCStats("speed", 50f);
item.AddCStats("unique", true)

[System.Serializable]
public class Item : ISerializationCallbackReceiver
{
    [SerializeField]
    public int id = 0;
    [SerializeField]
    public int amount = 1;
    [SerializeField]
    public List<CStats> cstats = new List<CStats>();
    public Dictionary<name, IConvertible> cstatsDictionary = new Dictionary<name, IConvertible>();

    public Item(int id, int amount)
    {
        this.id = id;
        this.amount = amount;
    }

    public void AddCStats<T>(string name, T value) where T : IConvertible
    {
        if (!cstatsDictionary.TryGetValue(name, out _))
        {
            cstatsDictionary.Add(name, value);
        }
        else
        {
            cstatsDictionary[name] = value;
        }

        for (int i = 0; i < cstats.Count; i++)
        {
            if cstats[i].name == name)
            {
                cstats[i].value = value;
                return;
            }
        }

        cstats.Add(new CStats(name, value));
    }

    public T GetCStat<T>(string name) where T : IConvertible
    {
        return cstatsDictionary.TryGetValue(name, out IConvertible value) ? ConvertToType<T>(value) : default;
    }

    public void OnAfterDeserialize()
    {
        cstatsDictionary = new Dictionary<string, IConvertible>();
        for (int i = 0; i < cstats.Count; i++)
        {
            cstatsDictionary.Add(cstats[i].name, cstats[i].value);
        }
    }

    public void OnBeforeSerialize()
    {
    }

    private T ConvertToType<T>(IConvertible value) where T : IConvertible
    {
        return (T)value.ToType(typeof(T), null);
    }
}

[System.Serializable]
public class CStats
{
    [SerializeField]
    public string name = String.empty;
    [SerializeField]
    public IConvertible value = null;

    public CStats(string name, IConvertible value)
    {
        this.name = name;
        this.value = value;
    }
}

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

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

sentences:
How does one calculate color intensity? How do I calculate color intensity if I have a image sample of RGB?

The sample is of a float3 of red, green, blue. I'm trying to do a bilateral blur and have to not change the image if the color intensity is the same so it will preserve edges.

 float4 BilateralFiltering(VertexOut input) : SV_Target
{

 const float pixel = 0.01f;

     float4 centralColor;
     float gaussianWeightTotal;
     float4 sum;
     float4 sampleColor;
     float distanceFromCentralColor;
     float gaussianWeight;
     float distanceNormalizationFactor = 1.0;
     centralColor = gDiffuseMap.Sample(samAnisotropic, input.Tex.xy + float2(0,0));
     gaussianWeightTotal = 0.18;
     sum = centralColor * 0.18;

     sampleColor = gDiffuseMap.Sample(samAnisotropic,  input.Tex.xy + float2(-pixel,-pixel));
     distanceFromCentralColor = min(distance(centralColor, sampleColor) * distanceNormalizationFactor, 1.0);
     gaussianWeight = 0.05 * (1.0 - distanceFromCentralColor);
     gaussianWeightTotal += gaussianWeight;
     sum += sampleColor * gaussianWeight;

     sampleColor = gDiffuseMap.Sample(samAnisotropic,  input.Tex.xy + float2(-pixel,0));
     distanceFromCentralColor = min(distance(centralColor, sampleColor) * distanceNormalizationFactor, 1.0);
     gaussianWeight = 0.09 * (1.0 - distanceFromCentralColor);
     gaussianWeightTotal += gaussianWeight;
     sum += sampleColor * gaussianWeight;

     sampleColor = gDiffuseMap.Sample(samAnisotropic,  input.Tex.xy + float2(-pixel,pixel));
     distanceFromCentralColor = min(distance(centralColor, sampleColor) * distanceNormalizationFactor, 1.0);
     gaussianWeight = 0.12 * (1.0 - distanceFromCentralColor);
     gaussianWeightTotal += gaussianWeight;
     sum += sampleColor * gaussianWeight;

     sampleColor = gDiffuseMap.Sample(samAnisotropic,  input.Tex.xy + float2(0,-pixel));
     distanceFromCentralColor = min(distance(centralColor, sampleColor) * distanceNormalizationFactor, 1.0);
     gaussianWeight = 0.15 * (1.0 - distanceFromCentralColor);
     gaussianWeightTotal += gaussianWeight;
     sum += sampleColor * gaussianWeight;

     sampleColor = gDiffuseMap.Sample(samAnisotropic,  input.Tex.xy + float2(0,pixel));
     distanceFromCentralColor = min(distance(centralColor, sampleColor) * distanceNormalizationFactor, 1.0);
     gaussianWeight = 0.15 * (1.0 - distanceFromCentralColor);
     gaussianWeightTotal += gaussianWeight;
     sum += sampleColor * gaussianWeight;

     sampleColor = gDiffuseMap.Sample(samAnisotropic,  input.Tex.xy + float2(pixel,-pixel));
     distanceFromCentralColor = min(distance(centralColor, sampleColor) * distanceNormalizationFactor, 1.0);
     gaussianWeight = 0.12 * (1.0 - distanceFromCentralColor);
     gaussianWeightTotal += gaussianWeight;
     sum += sampleColor * gaussianWeight;

     sampleColor = gDiffuseMap.Sample(samAnisotropic,  input.Tex.xy + float2(pixel,0));
     distanceFromCentralColor = min(distance(centralColor, sampleColor) * distanceNormalizationFactor, 1.0);
     gaussianWeight = 0.09 * (1.0 - distanceFromCentralColor);
     gaussianWeightTotal += gaussianWeight;
     sum += sampleColor * gaussianWeight;

     sampleColor = gDiffuseMap.Sample(samAnisotropic,  input.Tex.xy + float2(pixel,pixel));
     distanceFromCentralColor = min(distance(centralColor, sampleColor) * distanceNormalizationFactor, 1.0);
     gaussianWeight = 0.05 * (1.0 - distanceFromCentralColor);
     gaussianWeightTotal += gaussianWeight;
     sum += sampleColor * gaussianWeight;

     return sum / gaussianWeightTotal;

     }

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:
Multi-colored text and kerning Drawing multi-colored text or highlighted text in XNA/MonoGame is pretty annoying, and the standard way I've seen to do it is to just to make multiple SpriteBatch.DrawString calls, and place them using the x-coordinates given by SpriteFont.MeasureString. This is fine if you're highlighting whole words or blocks of text, but if you only want to highlight select letters inside of a word, you get a kerning nightmare:

Sometimes this looks alright, but not consistently and I can't think or find a good way to space out the letters properly.

Therefore, I would like to know if there's either a better way to draw highlighted text like this in XNA/MonoGame, or a way to pull kerning data out of a font so I can space the letters properly or some other fancy way to do it using masks or whatnot.

Thanks in advance!

sentences:
Drawing slope lines in a confined space This isn't a game development question per se, but here goes...

I have a 50x50 pixel space in which I need to draw five lines: X and Y axes, and one line for each of a steepest, average, and flattest slope.

I'm working with (Java) code that was handed down to me with no documentation or commentary and I've never worked with drawing on a canvas before. Here's the code for a box that measured 175x75 px. This needs to be adapted for a 50x50 area as described above.

    DrawingArea canvas = new DrawingArea(175, 75);
    canvasContainer.add(canvas);
    Rectangle rectangle = new Rectangle(0, 0, 174, 75);
    canvas.add(rectangle);
    Line slopeMainLineX = new Line(5, 70, 170, 70);
    slopeMainLineX.setStrokeOpacity(0.5);
    canvas.add(slopeMainLineX);
    Line slopeMainLineY = new Line(40, 70, 40, 0);
    slopeMainLineY.setStrokeOpacity(0.5);
    canvas.add(slopeMainLineY);
    steepestLine = new Line(40, 70, 0, 0);
    steepestLine.setStrokeWidth(3);
    canvas.add(steepestLine);
    avgSlopeLine = new Line(40, 70, 0, 0);
    avgSlopeLine.setStrokeWidth(2);
    canvas.add(avgSlopeLine);
    flattestLine = new Line(40, 70, 0, 0);
    flattestLine.setStrokeWidth(1);
    canvas.add(flattestLine);

    int steepestAngle = Math.round(site.getSlope().getMax());
    int averageAngle = Math.round(site.getSlope().getAvg());
    int flatestAngle = Math.round(site.getSlope().getMin());

    double xPointSteepestAngle = 40 + 120 * Math.cos(steepestAngle*0.0174532925);
    double yPointSteepestAngle = 70 + 120 * Math.sin(steepestAngle*0.0174532925);
    double xPointAverageAngle = 40 + 120 * Math.cos(averageAngle*0.0174532925);
    double yPointAverageAngle = 70 + 120 * Math.sin(averageAngle*0.0174532925);
    double xPointFlatestAngle = 40 + 120 * Math.cos(flatestAngle*0.0174532925);
    double yPointFlatestAngle = 70 + 120 * Math.sin(flatestAngle*0.0174532925);

    steepestLine.setX2((int) xPointSteepestAngle);
    steepestLine.setY2(70 - ((int) yPointSteepestAngle - 70));

    avgSlopeLine.setX2((int) xPointAverageAngle);
    avgSlopeLine.setY2(70 - ((int) yPointAverageAngle - 70));

    flatestLine.setX2((int) xPointFlatestAngle);
    flatestLine.setY2(70 - ((int) yPointFlatestAngle - 70));

I'm completely lost here, so any help would be greatly appreciated.

sentences:
Perlin noise looks uncoherent on higher z I was experiencing with my Perlin noise function and I tried to animate a 2D noise by changing the z value of a small amount every frame. However, as z increases, the result becomes stranger and stranger, looking like this:

Why is this happening? How could I solve this?

Here's the Lua code that could be wrong (as asked):

function perlin.fade(t)
    return t * t * t * (t * (6 * t - 15) + 10)
end
function perlin.lerp(t, a, b)
    return a + t * (b - a)
end
function perlin.grad(hash, x, y, z)
    local h = hash % 16
    local u
    local v
    if (h < 8) then u = x else u = y end
    if (h < 4) then v = y elseif (h == 12 or h == 14) then v = x else v = z end
    local r
    if ((h % 2) == 0) then r = u else r = -u             end
    if ((h % 4) == 0) then r = r + v else r = r -v end
    return r
end
function perlin:noise(x, y, z)
    y, z = y or 0, z or 0
    local X = math.floor(x) % 256
    local Y = math.floor(y) % 256
    local Z = math.floor(z) % 256
    x = x - math.floor(x)
    y = y - math.floor(y)
    z = z - math.floor(z)
    local u = perlin.fade(x)
    local v = perlin.fade(y)
    local w = perlin.fade(z)
    local A  = self[X + 1] + Y
    local AA = self[A + 1] + Z
    local AB = self[A + 2] + Z
    local B  = self[X + 2] + Y
    local BA = self[B + 1] + Z
    local BB = self[B + 2] + Z
    return perlin.lerp(w, perlin.lerp(v, perlin.lerp(u, perlin.grad(self[AA + 1], x    , y    , z    ),
                               perlin.grad(self[BA + 1], x - 1, y    , z    )),
                       perlin.lerp(u, perlin.grad(self[AB + 1], x    , y - 1, z    ),
                               perlin.grad(self[BB + 1], x - 1, y - 1, z    ))),
               perlin.lerp(v, perlin.lerp(u, perlin.grad(self[AB + 2], x    , y    , z - 1),
                               perlin.grad(self[BA + 2], x - 1, y    , z - 1)),
                       perlin.lerp(u, perlin.grad(self[AB + 2], x    , y - 1, z - 1),
                               perlin.grad(self[BB + 2], x - 1, y - 1, z - 1))))
end

sentences:
How to apply Ackermann steering without wheel colliders? I want to implement steering, have torque force, acceleration force but I am considering whether apply wheel colliders or not with Ackermann steering
I notice with only torque to rigidbody the car turns but slides non realistically
want sth like Arcade Car Physics https://github.com/SergeyMakeev/ArcadeCarPhysics
here steering is a bit too much but it smoothly steers no slides except of drifting
and also I want no jumps so I think the suspension is not needed

my code car controller

using Rgn;
using System.Collections.Generic;
using TMPro;
using UnityEngine;

public class CarCtrl : MonoBehaviour
{
    private Rigidbody rb;

    public float horizontalInput;
    public float verticalInput;

    public float steerAngle;

    public List<Transform> Wheels;

    [Header("input")]
    public float steerInput;

    public float turnSpeed = 10f;

    public float maxSteerAngle = 30f;
    public float engineForce = 20;

    public const int topSpeed = 300;

    private TextMeshProUGUI speedText;

    private float speed = 0.0f;

    public void GetInput()
    {
        horizontalInput = Input.GetAxis("Horizontal");
        verticalInput = Input.GetAxis("Vertical");
    }

    private void Steer()
    {
        var dt = Time.deltaTime;
        steerAngle = maxSteerAngle * horizontalInput * dt;
        var smoothedSteering = Mathf.Lerp(0.0f, steerAngle, 10);
        var turnForce = transform.up * turnSpeed * steerAngle;
        // Debug.Log(turnForce);

        Wheels[0].Rotate(transform.forward * -1, steerAngle);
        Wheels[1].Rotate(transform.forward * -1, steerAngle);

        rb.AddRelativeTorque(turnForce, ForceMode.Acceleration);
    }

    private void Accelerate()
    {
        // speed in m/s
        speed = rb.velocity.magnitude;
        var force = transform.forward * -1 * engineForce * verticalInput;
        var speedKph = Car.MpsToKmh(speed);
        if (speedKph < topSpeed)
        {
            var speedtxt = speedKph.ToString();
            rb.AddForce(force, ForceMode.Acceleration);
            speedText = (TextMeshProUGUI)FindObjectOfType<TextMeshProUGUI>();
            speedText.text = $"speed: {speedtxt} kmh";

            rollWheels();
        }
    }

    private void FixedUpdate()
    {
        GetInput();

        Accelerate();

        Steer();
    }

    // Start is called before the first frame update
    private void Start()
    {
        //stop rotating
        Destroy(GetComponent<Turn>());

        var car = new Car("make", "model");
        print(Car.AckermannLeft(2, 2, 10));

        this.gameObject.transform.Translate(-30, 0, 0, Space.World);

        rb = GetComponent<Rigidbody>();

        rb.useGravity = true;
    }

    private void rollWheels()
    {
        var angle = engineForce * verticalInput;
        foreach (var wheel in Wheels)
        {
            wheel.Rotate(Vector3.right, angle);
        }
    }
}

sentences:
Game development and research Game development is currently a largely non-academic enterprise.  There are a lot of commercial developers of games, as well as a large hobbyist community.  The academic community focusing on games seems to be small, and new.  [Or so it appears to me].

Having said all that, are there some must read papers/books on game development from academics?

sentences:
Designing a game that allows for selectable perks/customization Call of Duty games all have the core functionality of any FPS (walking around, killing, dying and repeat). Layered on top are various stuff. Of interest to me is during pre-game when you pick your perks. These perks can have very different effects and targets. Some affect walking speed and persist throughout the game, others are only activated at certain events and last for a certain duration. I am wondering what sort of design architecture/pattern would allow such a system that supports a wide variety of perks that have little in common.

For instance, imagine I want to add a perk that speeds up the rate of fire:

Do I make all my gun classes take as a constructor argument 'rateOfFire'? but then I will need to expand the code for each perk that affects the gun and the constructor gets bloated.

Maybe have it as a setter property on each gun? but then I can also bloat properties and make code insecure since I don't want anyone except the appropriate perks to change that property. I will also have to go back exposing more properties for each new perk. In addition, other classes that depend on this value might have already been initialized after the gun was created and acted upon the original 'rateOfFire' value before I get to change it.

and so on... and to further complexity, now imagine I want to add a new perk 'walk faster for 5 seconds after you die 5 consecutive times without killing anyone(death streak)'. This perk has nothing in common with the 'rateOfFire' perk.

And also there is the issue of how to deliver those chosen perks to their targets? I was thinking of the visitor pattern, but it seems inefficient since a perk that affects only certain guns will be passed to all game components that are customizable(level manager/presenter/physics and so on). And I will also need to expose their properties so that the perk can change them once visited.

I thought of other solutions that might work, but they all seem either too complex/over engineered. I am wondering how the Call of Duty developers might have implemented what seems to be a flexible and extensible perk system (many sequels).

Any suggestions are welcome.

Note am not remaking COD, instead I am making a simple mobile puzzle game but the perk problem is similar.

sentences:
Overridden movement function doesn't work I moved from C to C# so I am a novice in Object Oriented Programming. I wanted to implement OOP in my character movement, but it didn't work the way I expected.
My character is instantiated when the scene starts, but it doesn't move (maybe because of bad parameter passing).
I just want to control input from derived class which is giving my character the ability to sprint.

characterB script is attached to character in Inspector
that character is instantiated prefab and is instantiated when scene start
inherited script which is overridden is giving ability to sprint to character
photon is package for multiplayer games so you don't have to notice it

whole source code is so big, so i put there one method for movement
and sorry for my weak english skillz
 //works like standard MonoBehaviour
public abstract class characterMain : MonoBehaviourPunCallbacks
{

    // declaration of variables

    public virtual void Start()
    {
        RB = GetComponent<Rigidbody>();
    }

    protected virtual void movement(float horXF, float vertYF, bool sprintB)
    {
        //Debug.Log("movement function base class" + horF); // NOT responding
        groundDetect = Physics.Raycast(...);

        if (standOnGround)
        {
            direction = new Vector3(horXF, 0, vertYF) * Time.deltaTime * speed;

            direction.Normalize();
            adjustSpeed = speed;
            targetSpeed = transform.TransformDirection(direction) * adjustSpeed * Time.deltaTime;
            RB.velocity = targetSpeed;
        }
    }
}

public class characterB : characterMain
{

    [Header("Movement")]
    protected float horXF;
    protected float vertYF;
    [Header("sprint")]
    private bool sprintB;

    public void FixedUpdate()
    {
        if (!photonView.IsMine) return; //Photon

        //MOVEMENT INPUT
        horXF = Input.GetAxisRaw("Horizontal");
        vertYF = Input.GetAxisRaw("Vertical");
        //JUMP INPUT
        skokB = Input.GetKey(KeyCode.Space);

        movement(horXF, vertYF, sprintB);

        //Debug.Log("movement function" + horF); //responding
    }

    protected override void movement(float horXF,float vertYF,bool sprintB)
    {
        //Debug.Log("movement function" + horF); // NOT responding

        if (sprintB && ... ) //sprint
        {
            base.movement(horXF, vertYF, sprintB);

            sprintB = bZrychlenieC && groundDetect && ... ;
            if (sprintB) direction = new Vector3(0, 0, sprintSpeed) * Time.deltaTime;
        }
    }
}

sentences:
How can I draw a specific GameObject into a texture in Unity? I need to draw only a few specific objects into a texture (with their material) and then use that RenderTexture as a texture for an another object. I think Graphics.DrawMesh() and Graphics.SetRenderTarget() would be helpful, but I'm not sure.

Ultimately I'm trying to create refractive water, which will refract only specified GameObjects, not layers. How can I do this?

sentences:
Could someone explain why my world reconstructed from depth position is incorrect? I am attempting to reconstruct the world position in the fragment shader from a depth texture. I pass in the 8 frustum points in world space and interpolate them across fragments and then interpolate from near to far by the depth:

highp float depth = (2.0 * CameraPlanes.x) / (CameraPlanes.y + CameraPlanes.x - texture( depthTexture, textureCoord ).x * (CameraPlanes.y - CameraPlanes.x));

// Reconstruct the world position from the linear depth
highp vec3 world = mix( nearWorldPos, farWorldPos, depth );

CameraPlanes.x is the near plane CameraPlanes.y is the far.

Assuming that my frustum positions are correct, and my depth looks correct, why is my world position wrong?

(My depth texture is of format GL_DEPTH_COMPONENT32F if that matters)

Thanks! :D

Update:

Screenshot of world position http://imgur.com/sSlHd

So you can see it looks nearly correct. However as the camera moves, the colours (positions) change, which they shouldnt.

I can get this to work, if I do the following:

Write this into the depth attachment in the previous pass:

gl_FragDepth = gl_FragCoord.z / gl_FragCoord.w / CameraPlanes.y;

and then read the depth texture like so:

depth = texture( depthTexture, textureCoord ).x

However this will kill the hardware z buffer optimizations.

sentences:
Unable to Merge Android manifest error is showing up I used Google Admob to put ads in my game but as soon as I hit build and run this error showed up I used a Github file and imported into my unity project, I will link it right here

https://github.com/unity-plugins/Unity-Admob.

CommandInvokationFailure: Unable to merge android manifests. See the Console for more details.
C:\Program Files (x86)\Java\jdk1.8.0_101\bin\java.exe -Xmx1024M -Dcom.android.sdkmanager.toolsdir="C:/Users/jayso/AppData/Local/Android/android-sdk\tools" -Dfile.encoding=UTF8 -jar "C:\Program Files\Unity\Editor\Data\PlaybackEngines\AndroidPlayer/Tools\sdktools.jar" -
stderr[
Error: [Temp\StagingArea\AndroidManifest-main.xml:21, C:\Users\jayso\OneDrive\Documents\Tap Happy\Temp\StagingArea\android-libraries\play-services-ads-10.2.0\AndroidManifest.xml:2] Main manifest has  but library uses minSdkVersion='14'
Error: [Temp\StagingArea\AndroidManifest-main.xml:21, C:\Users\jayso\OneDrive\Documents\Tap Happy\Temp\StagingArea\android-libraries\play-services-ads-lite-10.2.0\AndroidManifest.xml:7] Main manifest has  but library uses minSdkVersion='14'
Error: [Temp\StagingArea\AndroidManifest-main.xml:21, C:\Users\jayso\OneDrive\Documents\Tap Happy\Temp\StagingArea\android-libraries\play-services-base-10.2.0\AndroidManifest.xml:2] Main manifest has  but library uses minSdkVersion='14'
Error: [Temp\StagingArea\AndroidManifest-main.xml:21, C:\Users\jayso\OneDrive\Documents\Tap Happy\Temp\StagingArea\android-libraries\play-services-basement-10.2.0\AndroidManifest.xml:2] Main manifest has  but library uses minSdkVersion='14'
Error: [Temp\StagingArea\AndroidManifest-main.xml:21, C:\Users\jayso\OneDrive\Documents\Tap Happy\Temp\StagingArea\android-libraries\play-services-gass-10.2.0\AndroidManifest.xml:2] Main manifest has  but library uses minSdkVersion='14'
Error: [Temp\StagingArea\AndroidManifest-main.xml:21, C:\Users\jayso\OneDrive\Documents\Tap Happy\Temp\StagingArea\android-libraries\play-services-tasks-10.2.0\AndroidManifest.xml:2] Main manifest has  but library uses minSdkVersion='14'
]
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.BuildPlayerWindow:BuildPlayerAndRun()

sentences:
Collision representation in game overworlds I'm implementing a 2D overworld where one can walk through an area that is not tile based. I was wondering the best way to implement collisions. In the past when I've done similar things, I've used one image (or set of images) to show an elaborately drawn world and then a second binary image that does nothing but differentiate "wall" and "not wall". Then, I'd use the first for all drawing to the screen, but the second for collision detection. Having another image of the same size to represent collisions seems like lots of overhead. Is there a better way to handle this?

(I'm currently using C++ with SDL, although I'm more interested in general concepts)

sentences:
Do I really need a render() method in the game loop if the view subscribes to the models? For a game that I'm working on, we've followed the MVC paradigm. However, in classic MVC, the view subscribes to the model and when the model updates it informs the view. We've implemented this as an Observer pattern so the model doesn't really have a direct link to the view, to reduce coupling.

Now, given such a configuration, is the call to render in the game loop really necessary?

That is,

while(true){
 update(); //mostly called via user interaction
 render(); //necessary if called by model?
}

The game loop is more like:

while (game_is_running){
 getUserInput();//This updates models which in turn asks views to render the changes.
}

Is there really an advantage to having render in the game loop? Is it acceptable to have the models inform the view to render themselves? What's the preferred way to go about this?

sentences:
Strange behavior in collision detection I am making a 2d platform game with a tiled map,i now avoid passing through the walls an the ground but when the character hit the ground it shakes vertically,and when i make it walk on a wall it shakes horizontally.
the atualization code:

public void atualizar() {

    this.detectarColisoes(mapa.getTilesAdjacentes(this.getXAbsoluto(),this.getYAbsoluto(),this.getXAbsoluto()+this.getWidth(),this.getYAbsoluto()+this.getHeight()));
    if(movendo){

        this.setVelX(direcao*5);
        if(this.getVelX()>0 && colisaoLateral==1){
            this.setVelX(0);
        }
        if(this.getVelX()<0 && colisaoLateral==-1){
            this.setVelX(0);
        }
    }else if(this.getVelX()!=0){
        if(this.getVelX()>0){
            this.setVelX(this.getVelX()-1);
        }else{
            this.setVelX(this.getVelX()+1);
        }

    }
    if(this.getXRelativo()>490 && this.getVelX()>0){
        mapa.moveMapX(this.getVelX());
    }
    if(this.getXRelativo()<150 &&this.getVelX()<0){
        mapa.moveMapX(this.getVelX());
    }
    if(estadoSalto==2 && this.getVelY()>0){
        estadoSalto=1;
    }

    super.atualizar();
    if(estadoSalto!=0){
        this.gravidade();
    }
    System.out.println(estadoSalto);

}

the code for the collision detection:

public void detectarColisoes(ArrayList<Rectangle> adjTiles){
    Rectangle chara=new Rectangle(this.getXAbsoluto(),this.getYAbsoluto(),this.getWidth(),this.getHeight());
    if(adjTiles.isEmpty()){
        if(estadoSalto!=2){
            estadoSalto=1;
        }
    }
    boolean caindo=true;
    this.colisaoLateral=0;
    for(Rectangle aux:adjTiles){
        Rectangle ints=aux.intersection(chara);
        if(!ints.isEmpty()){

            if(ints.height<ints.width){

                if(ints.y>chara.y ){

                    estadoSalto=0;
                    this.setVelY(0);
                    this.setY(this.getYAbsoluto()-ints.height);
                    nSaltos=1;

                    caindo=false;

                }

            }else{
                if(ints.x>chara.x){
                    this.setX(this.getXAbsoluto()-ints.width+1);
                    this.colisaoLateral=1;

                }else{
                    this.setX(this.getXAbsoluto()+ints.width-1);
                    this.colisaoLateral=-1;
                }

            }
        }
    }
    if(caindo){
        estadoSalto=1;
    }

}

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:
What are some good resources for learning HLSL? The last time I tried learning HLSL, I made a few shaders and mostly understood what I was doing, but I still felt like I was stumbling in the dark. Most of what I learned I got from various blog posts that didn't explain things very well.

Also, the documentation on MSDN seems to be more of a function reference.

Where can I learn to not only write HLSL, but learn techniques for writing shaders?

sentences:
What does 'Discretizing Space' mean in the context of paper prototyping I was browsing some lecture slides by Eric Anderson for his Cornell course CS 4154 (Analytics-driven Game Design). In a series of slides he mentions discretizing space as a way of paper prototyping action games. As an example he illustrates  with a screen shot of Super Mario with a grid overlay (shown below). Unfortunately the slides do not expound on how this technique is used.

How is discretizing space used to prototype platform games or action games generally?

sentences: How to detect a cursor inside a non-rectangle shape How can I detect and do something if the cursor is inside a hexagonal shape? Is there any way other than detecting if it's in a rectangle area close to the shape of the hexagon? It would also have to work with a grid of hexagons, detecting each individually.

sentences:
Orthogonal projection and world transform I'm reading about projection matrix. Needs of perspective projection is obvious, but I'm not sure about orthogonal projection. Because orthogonal projection effect looks possible with only world transform.

What is main purpose of orthogonal project which make it different with world transform?

sentences:
Better streaming economy algorithm? Does anyone here have experience making games with streaming economies? I am working on a game and am looking for a better way to handle the economy.  I feel like there must be a better algorithm than what I am using.

Background:

ResourceBin objects contain resources
Settlement objects contain ResourceBin objects
Settlement objects have three queues of Building objects in arrays (Low, Medium, and High priorities)
Building objects have a nextTick() method that accepts a ResourceBin and modifies it

Right now on every tick the Settlement class will loop through all of the Building arrays starting with High and working towards Low.  On each Building object it calls the nextTick() method and passes its ResourceBin.  After making sure that the transforms won't cause any Resource to become negative, the nextTick() method modifies the ResourceBin and exits. If any of its transformations would cause a Resource to become negative it just exits.

The issue with this is that the entire system depends heavily on the order in which the buildings are processed.  I also can't have it proportionally affect the resource transformations if you are low on resources (like what is done in Total Annihilation).

Does anyone know how other games implement streaming economies?  Is there a better way to do this?

Also let me know in the comments if a code example would be useful. I can pastebin one if need be.

sentences:
Level Design V.S. Modeler From what I understand being a level designer and a character/environment/object/etc Modeler are two different jobs, yet sometimes it feels like a Modeler can also do the job of the level designer.  I know this also depends on the scale of the game.  For small games maybe they are one and the same, but for bigger games they become two different jobs.

I understand a background in some modeling could not hurt when it comes to level design, but the question I have is:  Do jobs prefer people who can model for level designing?  This way they can kill two birds with one stone and have someone to create the assets and design the level.

What is your opinion of the training?  Does level design contain skill sets that make them completely different from what a modeler can do, or is this an easy transition for a modeler to become a level designer?  Can you be a bad level designer but a good modeler and vice versa?

sentences:
Create Bezier curves with random heights that connect In unity, I am trying to create several curved platforms that connect using bezier curves, however I am having issues. I understand the basics of genertating a bezier curve and I have something working well

My goal is to generate a series of forward moving Bezier curves, that are all connected to each other, while also having varying lengths and points. I have something working, however I am having issues connecting the curves, while retaining random Y values for different heights in the 4 points.

Below is my attempt:

Below is a Sketch I did in MS Paint to help explain goal:

From the sketch you can see that there is a diffrence in height between gameobject 0 and 1 but they are still connected. How can I generate the next points with random Y values, while still accounting for the previous curve? Any help would be greatly appreciated,

Thank you for your time.

sentences:
How to send an int array and struct via ENet? I've been using the ENet library for networking and so far it's been working ok. I have established a connection between my client and server. On the client side all it does is send all user input to the server. On the server side I have an array int map[24][24] that stores all of the map tiles. I also have a struct for each player. After I get all of the user input, do all the calculations, and update the map, how would I send the map back to the client? Right now the function I've been using supports sending chars. Would I convert my int array and struct objects to char and send them? How should I accomplish this, also should I send the map and player structs in one packet, or send each in a separate packet? This is my first to experimenting with multiplayer so I apologize if this is a simple mistake or stupid question.

This is my function for sending packets:

void send_packet(int channel, char pack[11]) {
    ENetPacket *packet = enet_packet_create(pack, strlen (pack) + 1, ENET_PACKET_FLAG_RELIABLE);
    enet_peer_send(peer, channel, packet);
    enet_host_flush(host);
}

sentences:
How can I make a C++ countdown timer that doesn't freeze user input? I'm planning to use the Sleep() function to implement a countdown timer. But this freezes the input of the user at the same time. Thus I wanted to ask if it is possible to have the countdown still running in realtime, whether they're typing or not; or in other words not freeze everything.

Is it possible? If so, how?

Example : Pop Quiz with Timer

sentences:
Client Tells Server What Gamestate Data to Send Back I'm just stepping into the world of MMORPGs and how they function, so assume I know very little.

in a game, a client doesn't see everything that the server does. For example, the client can't see through mountains, walls, etc. So why send them data that's not relevant?

My question is:
 - If the Client was designed to tell the server what gamestate data would be relevant to them, then the server sent back only what was relevant, could you minimize lag / amount of data downloaded?

You would have to find a way for the server to discern what data the client needed, maybe this is where it becomes inefficient?

Thanks for your time!

sentences:
What is a cheap (better free) way to make multiplayer in a shooter? I'm a newbie indie, so I don't have a budget for a game. But I'm making a 3rd person shooter and I need multiplayer for it.
It's a mech shooter, so it won't have very fast movements, meaning I don't need fast sync between participants.

I've thought about peer-to-peer, it seems good, but what if the host's PC crashes or they just kill the game? It would be the end of the whole match!
So it seems like I need to have some sort of centralised server, but do I really need a dedicated server, and even a number of servers to be able to host thousands of matches? Or can I sync it through database services like playfab somehow?

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:
Moving/spilling water inside a cup of glass I made a glass of water but there are somethings i didnt know how to do well, what i did is i put a mesh on the top of the glass to represent the surface of the water but it doesnt really work well with glass because if you look from the sides you wont really see that there is water in there, this is what i did :

the glass from the side :

as you can see it doesnt really work well in my case.
I also tried putting an object that has the same shape as the cup inside to represent water but that would make it difficult for what i want to do next, because my next step would be to make the water rotate in the opposite rotation of the cup and make it spill if it reaches the top of the cup, and that is my second question how do i make the water spill from the cup?

Any help is very much appreciated.

sentences:
Animating DOM elements vs refreshing a single Canvas A few years ago, when the HTML Canvas element was still kinda fresh, I wrote a small game in a rather "unusual" way: each game element had its own canvas, and frequently animated elements even had multiple canvases, one for each animation sprite. This way, the translation would be done by manipulating the DOM position of the canvases, while the sprite animation would consist of altering the visibility of the already drawn canvases. (z-indexes, of course, were the tricky part)

It worked like a charm: even in IE6 with excanvas it showed a decent performance, and everything was rather consistent between browsers, including some smartphones. Now I'm thinking in writing a larger game engine in the same fashion, so I'm wondering whether it would be a good idea to do so in the current context (with all the advances in browsers and so on).

I know I'm trading memory for time, so this needs to be customizable (even at runtime) for each machine the game will be running. But I believe using separate canvases would also help to avoid the game "freezing" on CPU spikes, since the translation would still happen even if the redraws lag for a while. Besides, the browsers' rendering engines are already optimized in may ways, so I'm guessing this scheme would also reduce the load on the CPU (in contrast to doing everything in JavaScript - specially the less optimized ones).

It looks good in my head, but I'd like to hear the opinion of more experienced people before proceeding further. Is there any known drawback of doing this? I'm particulartly unexperienced in dealing with the GPU, so I wonder whether this "trick" would nullify any benefit of using a single, big canvas. Or maybe on modern devices it's overkill (though I'm skeptic about the claims that canvas+js - especially WebGL - will ever be a good alternative to native code). Any thoughts?

sentences:
How can I make a gate with two cubes that close/open nonstop? using System.Collections;
using System.Collections.Generic;
using UnityEngine;

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

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

    }

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

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

sentences:
Camera.WorldToScreenPoint not working with perspective transform.position = Camera.main.WorldToScreenPoint( new Vector3( origin.position.x, origin.position.y, origin.position.z ) );

I have this code on a Unity 4.6 UI object. The origin is some transform I want the UI element to stay above( like a floating health bar ).

The camera is top-down, but angled slightly on the x-axis. When the camera is moved, the UI element moves away from the origin slightly as if the camera was orthographic.

How would I go about compensating for the perspective? Is there another method I should be using to convert from world space to canvas space?

EDIT: Pictures added. Note that the transform is at the center of the model, not the base.

sentences:
How to fix bad Collada produced by FBX? I tried to use the FBX SDK (2011.3.1) to load FBX files and save them as Collada files in order to be able to import FBX files in Panda3D.
Unfortunately the resulting Collada files are not usable for several reasons, among them:

There's a Maya specific extra technique

diffuse

<diffuse>
    <texture texture="Map__2-image" texcoord="CHANNEL0">
        <extra>
            <technique profile="MAYA">
                <wrapU sid="wrapU0">TRUE</wrapU>
                <wrapV sid="wrapV0">TRUE</wrapV>
                <blend_mode>ADD</blend_mode>
            </technique>
        </extra>
    </texture>
</diffuse>

It assigns a texcoord channel name that isn't referenced anywhere else in the file (in the previous code sample, no geometry uses "CHANNEL0"...)
Every polygon is exported twice, a first time with a basic material (only diffuse color, specular color, etc.) and a second time with a textured material --> this doubles the number of polygons of each model without any valuable reason

Anyway, the resulting Collada file cannot be opened correctly either with OpenCOLLADA or Panda3D's "dae2egg".

Anyone has any experience on how to "fix" it and make it understandable by common and well-reputed Collada importers such as OpenCOLLADA?

sentences: Can a standalone WPF application create an interface that looks like a Flash interface? It seems like WPF was created as the application answer to Adobe's Flash.  Silverlight is used for creating web pages.  But, can that same functionality be pulled into a standalone WPF application.  Scaleform allows Flash to be used within unmanaged C++ games.  Can WPF be used to create the same type of interfaces?  What I've read seems to make me believe it can.  But, I haven't seen any sheetshots of applications that show this kind of interface.

sentences:
What is the term for how much a game's code is coupled to its engine? Essentially, what is a word or phrase I might use/search for to describe how much the choice of an engine dictates the structure of your code, such as the language it is written in or the way objects much be structured, as well as aspects of what design patterns can be used or how assets are formatted?

For instance, Unity has a high amount of this coupling because, while it allows the use of C# (which runs on many platforms), it requires many object interconnections to be exposed as concrete classes and public member variables. GameMaker Studio is almost completely coupled in this way because it has its own proprietary scripting language and asset format.

sentences:
Game Maker - Shader CGA - how to swap the palette I created a shader that get the actual color of the surface and render it to the closer of a cga palette

I have to change it to swap the palette in 4 colors but I don't know how
secondary, I have to render it dynamic (maybe using an uniform variable)
because it have to change in base of the palette

please help me, thanks

///CGA Shader
varying vec2 v_vTexcoord; //xy
varying vec4 v_vColour; //rgba

#define _ 0.0
#define o (1./3.)
#define b (2./3.)
#define B 1.0

#define check(r,g,b) color=vec4(r,g,b,0.); dist = distance(sample,color); if (dist < bestDistance) {bestDistance = dist; bestColor = color;}

void main(out vec4 v_vColour, in vec2 v_vTexcoord)
{
    float dist;
    float bestDistance = 1000.;
    vec4 color;
    vec4 bestColor;

    vec2 pixel = vec2(320,200)-floor( v_vTexcoord.xy / iResolution.xy * vec2(320,200));
    vec4 sample = texture2D(iChannel0, pixel / vec2(320,200));

    sample += (texture2D(iChannel1, pixel / iChannelResolution[1].xy)-0.5)*0.5;

    // pallete 0

    check(_,_,_);
    check(o,B,o);
    check(B,o,o);
    check(B,B,o);

    vec4 color1 = bestColor;
    bestDistance = 1000.;

    // pallete 1

    check(_,_,_);
    check(o,B,B);
    check(B,o,B);
    check(B,B,B);

    vec4 color2 = bestColor;

    float t = (clamp(sin(iGlobalTime)*4.,-1.,1.)+1.)/2.;

    v_vColour = mix(color2, color1, t);

    gl_FragColor = v_vColour * texture2D( gm_BaseTexture, v_vTexcoord );
}

sentences: Merging InputProcessor and GestureDetector I'm planning to make a simple soccerball app. When I attempt to drag the ball, I use the touchDragged() from InputProcessor to move the ball left or right. Next, while holding before releasing, I use the fling() from the GestureDetector to set the power. However, when I'm trying to set the input processor of both the implementing InputProcessor and the GestureDetector, it didn't work.  Moreover, whenever the last time you set the input processor and that would be either the two of them. Why?

sentences:
UNITY IEnumerator Function I am currently using the IEnumerator function to pause a for loop, in which a ball  should move towards another game object. From my print statements it seems like the ball moves a little, but it's actually never reaching the object and I'm not sure why. I have never used IEnumerator so I'm not sure if this is a part of the issue.

    public IEnumerator CoUpdate(){
    float waitTime = 8;

    yield return new WaitForSeconds (waitTime);

    for (int i = 0; i <= 19; i++) {
        //Finding Game Objects
        numbers = GameObject.FindGameObjectsWithTag ("num");
        ball = GameObject.FindGameObjectWithTag ("ball");
        float step = speed * Time.deltaTime * 2;

        //Picking the random cube
        index = Random.Range (0, numbers.Length);
        pickedNumber = numbers [index];

        print ("number picked");
        print (pickedNumber.name);

        print ("numer postion");
        print (pickedNumber.transform.position);

        //Moving ball to cube
        target = pickedNumber.transform;
        ball.transform.position = Vector3.MoveTowards(transform.position, target.position, step);

        //Checking balls position
        print ("ball Position");
        print (ball.transform.position);

        //Pause here
        print ("PAUSE!");
        yield return new WaitForSeconds (waitTime);

        //Ball Returns to position
        ball.transform.position = new Vector3 (0, 0, 0);
        print ("ball reset");
        print (ball.transform.position);
    }
}

sentences:
Can you call a method from the script of all instantiated prefabs of a cetain object? I am currently trying to recreate chess and the problem I am having is that I need to instantiate all of the pawns in a loop (I could write it out but it seems inefficient) and I need to be able to call a method from all of the pawns to look for a check (I'll probably use raycast but I haven't gotten to that yet). How can I go about calling the method that looks for checks from all of the instances of the pawn?
I'm pretty new to unity so please go easy on me if I said something dumb

sentences:
3D movement on an authoritiative server? I'm developing an MMORPG, using Unity for the client and "standard" C# 4.0 for the authoritative server. The server should check each player's movement and ensure that it does not collide with props or walk through unpassable terrain (like a cliff). Collisions with other players and such are not checked. In addition, the server must be able to retrieve/calculate the position of a player at any time so it can be sent to other players (who just walked into range, for example).

To make this all a little more complex, the game is a 3D space, meaning you can have things such as a spiral staircase and flight, and it has multiple maps.

I've run into a problem, though. I'm not quite sure how to actually implement all this.

I've come up with two ideas:

Make the server interop with a Unity client tasked solely with tracking player positions and validating movement
Get the props and terrain onto the server and use math to define the character's movement and check for collisions.

The first one seems ugly to me, and I don't even know if Unity will allow me to load multiple maps onto the same client. I've made some progress on the second one: I managed to export props as OBJ files and read them on the server. But from there, I'm kinda lost.

My question is two parts: Is there a better way to achieve what I want? And if not, how should I proceed with my current plan?

sentences:
In a large space simulation, why is my sun light not reaching the planets? I want to create a space simulation, but I'm facing some difficulties when I try to create a realistic sun.

Currently, I've a simple Point Light inside a sphere. But for some reasons, no matter the intensity and the attenuation radius of this light, the other objects in the scene (the planets, for instance) aren't lit any more if their centre are separated by more than 1.5 kilometres approximatively.

(Top) Lit planet, 1.4 km away from the sun.
(Bottom) Unlit planet, 1.5 km away from the sun.

Do you know what can cause this phenomenon? Is there a way to bypass it? If not, how can I create a realistic sun light in a large space simulation?

sentences:
Using angle_difference to calculate shortest turn to target [Gamemaker] I've tried, but I cannot understand angle_difference.

I have an object, oTurretDetTurret, which turns to face its Target, which lies at the angle DirectionOfTarget from it.

It does this by updating its direction thus:

direction = direction + SpinDirection

SpinDirection can be either +3 or -3, meaning it can turn in either direction at a rate of 3 degrees per step.

What determines the direction it turns in is the angle between its current direction and the `DirectionToTarget. I want the turret to turn in the direction with the shortest number of degrees to travel.

I've been using this:

if angle_difference(direction, DirectionToTarget) > 0 {
direction = direction + 3
} else if angle_difference(direction, DirectionToTarget <= 0 {
direction = direction - 3
}

However, in game this just means that the turret faces the opposite direction to its target at all times, oscillating back and forth slightly.

In my understanding, angle_difference returns the smaller of the two angles between two directions.

For example, if the turret's direction is 300 degrees and the DirectionToTarget is 90 degrees, angle_difference should return +150, the smaller of the two angles, and thus my above code should move the turret counter-clockwise towards 90 degrees.

Can anybody help me?

sentences:
Minecraft : Mod-making (MCreator) : Redstone Result Event I am currently using a Mod-making Tool called "MCreator" made by Pylo.

I am currently making a Block Element and creating an event when The block is right clicked by a Prismarine Shard, then The block will power redstone.

I did this by doing the following:

Event : On block rightclicked
Condition : itemInPlayersHand[] == Items.prismarine_shard
Event parameters (Redstone Power; State of power) : true
I also checked "Can provide power?" In Advanced properties

The problem is that when I test the mod in a client environment and click the block, it will not power any redstone around it.

I tried to change when the event happens to Print a text and when I tested and clicked on it with a prismarine shard, it printed the text to the console.

So is there something wrong with the Redstone Power event result or am I doing something wrong.

Thanks in Advanced,
Bryan

sentences:
glReadPixels with GL_DEPTH_COMPONENT into PBO is slow I need to read depth buffer back to cpu memory. It may be few frames old, so I use glReadPixels with a buffer bound to GL_PIXEL_PACK_BUFFER. I use several buffers and ping-pong them. Finally, I read from the PBO with glGetBufferSubData. I have tried creating the buffers with GL_STATIC_READ, GL_DYNAMIC_READ and GL_STREAM_READ all with same results. Unfortunately, all this is still horribly slow.

class DepthBuffer
{
private:
    static const uint32 PboCount = 2;
    Buffer buffer;
    uint32 index;
    uint32 pbo[PboCount];
    uint32 w[PboCount], h[PboCount];

public:
    DepthBuffer();
    ~DepthBuffer();

    void performCopy(uint32 fbo, uint32 w, uint32 h);

    // returns 0..1 in logarithmic depth
    float valuePix(uint32 x, uint32 y); // pix in 0..(cw/ch-1)
    float valueNdc(float x, float y); // ndc in -1..1
};

DepthBuffer::DepthBuffer()
    : index(0), pbo{ 0, 0 }, w{ 0, 0 }, h{ 0, 0 }
{
    glGenBuffers(PboCount, pbo);

}

DepthBuffer::~DepthBuffer()
{
    glDeleteBuffers(PboCount, pbo);

}

void DepthBuffer::performCopy(uint32 fbo, uint32 paramW, uint32 paramH)
{
    // copy framebuffer to pbo

    glBindBuffer(GL_PIXEL_PACK_BUFFER, pbo[index]);
    if (w[index] != paramW || h[index] != paramH)
    {
        glBufferData(GL_PIXEL_PACK_BUFFER,
            paramW * paramH * sizeof(float),
            nullptr, GL_STREAM_READ);
        w[index] = paramW;
        h[index] = paramH;
    }

    glBindFramebuffer(GL_READ_FRAMEBUFFER, fbo);
    CHECK_GL_FRAMEBUFFER(GL_READ_FRAMEBUFFER);
    glReadPixels(0, 0, w[index], h[index],
        GL_DEPTH_COMPONENT, GL_FLOAT, 0);

    CHECK_GL("read the depth (framebuffer to pbo)");

    // copy gpu pbo to cpu buffer
    index = (index + 1) % PboCount;

    float *depths = nullptr;
    {
        uint32 reqsiz = w[index] * h[index] * sizeof(float);
        if (buffer.size() < reqsiz)
            buffer.allocate(reqsiz);
        depths = (float*)buffer.data();
    }

    glBindBuffer(GL_PIXEL_PACK_BUFFER, pbo[index]);
    glGetBufferSubData(GL_PIXEL_PACK_BUFFER, 0,
        w[index] * h[index] * sizeof(float), depths);

    glBindBuffer(GL_PIXEL_PACK_BUFFER, 0);

    CHECK_GL("read the depth (pbo to cpu)");
}

float DepthBuffer::valuePix(uint32 x, uint32 y)
{
    if (w[index] * h[index] == 0)
        return nan1();
    assert(x < w[index] && y < h[index]);
    return ((float*)buffer.data())[x + y * w[index]];
}

float DepthBuffer::valueNdc(float x, float y)
{
    assert(x >= -1 && x <= 1 && y >= -1 && y <= 1);
    return valuePix((x * 0.5 + 0.5) * (w[index] - 1),
        (y * 0.5 + 0.5) * (h[index] - 1));
}

The glReadPixels is taking all the time (on cpu). Am I doing something wrong? I thought that reading into the PBO should be asynchronous.
Thanks.

sentences:
Aquaria-like graphics look in 3DS Max? I'm making a 2D game and I'm starting to think about graphics. I'm pretty good at 3D modelling, but I'm not very good at drawing or painting. I was wondering if there were settings, or even a renderer that someone could recommend that could achieve the nice painted look found in Aquaria.

Thanks.

sentences:
How do texture lookups for trig functions work? I have a pixel shader that calculates a mandelbrot fractal. It uses the standard formula:

z = z2 + c

I'd like to extend it so the power z is raised by varies. To do this i have the following function:

float2 ComPow(float2 Arg, float Power)
{
    float Mod = pow(Arg.x * Arg.x + Arg.y * Arg.y, Power / 2);
    float Ang = atan2(Arg.y, Arg.x) * Power;

    return float2(Mod * cos(Ang), Mod * sin(Ang));
}

The problem i've got is the xbox does this really slowly compared to squaring a complex number. I'm thinking it's partly because of the increased number of instructions, but mainly it's using trig functions (cos, sin and atan2).

I tested this by adding a single atan2 within the for loop and it's visibly jerky, whereas before it was getting a good FPS.

Can i use texture lookup to speed up / replace the cos, sin and atan2 calls? If so, how?

sentences:
Do I have to take aspect ratio into account, when computing a direction in View Space? I read an article about implementing a Single-Pass Volume Renderer.

After thinking about it, I have a question, which concerns the provided GLSL code snippet of the Fragment Shader.

To calculate the ray direction, the author uses the FocalLength (distance of the projection plane from view point) as Z-component, and the fragment coordinates in NDC-space as xy component. This gives a vector pointing from the view point to the pixel on the projection plane which is computed. Obviously this direction is supposed to be in View Space, because it assumes 0,0,0 as view point and the ModelView Matrix is used to convert the direction to object-local space. But I am not sure if that is correct, because isn't it that in view space the projection window isn't necessarily normalized, but has a width of twice the aspect ratio? It gets normalized by applying the projection matrix (at least in Direct3D as far as i know). So if this is true, why does this work? Why he maps the x component of gl_FragCoord to [-1;1], when the leftmost pixel would have an x-coordinate of -aspectRatio in view space?

sentences:
CenterContainer makes my button too small I get the perfect width for my buttons, but CenterContainer overrides that value of theirs to make the button as wide as the biggest text length of the buttons when I put the buttons inside of the container

godot 3.1

sentences:
How can I do unit testing in Unity? How to implement Unit Test at Unity3D.

I wonder if it would be possible to extend the Unity editor to have some sort of testing framework in it.

Is there any guideline to implement it?
Any reference like book, blog?
Any working example or project?

sentences:
How to connect a skeleton to an animator at the parent I have two different meshes with similar armatures. And the parent contains the Animator Component with a universal avatar and animation controller.
The animations doesn't apply when the bones are not the imminent child of the Animator. Is there a way to get this working?

sentences:
Does md2 support skeletal meshes? I'm creating an FPS game. I'm writing my own game engine. So far all the backend stuff is going great. I'd like to support md2 as the native file format for 3D Objects, but I also want to use skeletal meshes. Does anyone know if the md2 file format supports skeletal meshes?

In-case you need to know, I'm going to use blender as my Mesh creation tool and C++ as my programming language...

Thanks

For got to mention, the engine is based on OpenGL...

Alright, for anyone who is reading this, I just found the Doom 3 md5 specifications (http://tfc.duke.free.fr/coding/md5-specs-en.html). It gives you some help on writing a parser (see bottom of link), but the example doesn't support lighting and texture mapping (the second set of example code allows for animation). Thanks @Neverender for answering my question...

sentences:
LibGDX simple button with image I want to make two image buttons (play, restart) in my main menu screen but I dont know how to do it. I tried this:

Texture playTexture = new Texture(...)
Image playImage = new Image(playTexture)
ImageButton playButton = new ImageButton(drawable?)

but I have no idea what is drawable.

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:
Grainy texture from distance I am using SharpDX, a C# wrapper over DirectX 11 to render terrain.  While I am able to render terrain correctly, I noticed that moving around creates a lot of visual noise and makes the texture of the ground very grainy.  I have attached a picture of how the texture looks on the terrain. (Make sure to make full screen for clarity)

Here is the dirt texture I am using:

Here is the dirt texture normal map:

I thought I set up the mip maps appropriately in this code (note that filename is just the path to the terrain bitmap I showed above):

public bool Initialize(SharpDX.Direct3D11.Device device, string fileName)
{
  try
  {
    using (var texture = LoadFromFile(device, new SharpDX.WIC.ImagingFactory(), fileName))
    {
      ShaderResourceViewDescription srvDesc = new ShaderResourceViewDescription()
      {
        Format = texture.Description.Format,
        Dimension = SharpDX.Direct3D.ShaderResourceViewDimension.Texture2D,
      };
      srvDesc.Texture2D.MostDetailedMip = 0;
      srvDesc.Texture2D.MipLevels = -1;

      TextureResource = new ShaderResourceView(device, texture, srvDesc);
      device.ImmediateContext.GenerateMips(TextureResource);
    }
    // TextureResource = ShaderResourceView.FromFile(device, fileName);
    return true;
  }
  catch
  {
    return false;
  }
}

public Texture2D LoadFromFile(SharpDX.Direct3D11.Device device, ImagingFactory factory, string fileName)
{
  using (var bs = LoadBitmap(factory, fileName))
    return CreateTexture2DFromBitmapSource(device, bs);
}

public BitmapSource LoadBitmap(ImagingFactory factory, string filename)
{
  var bitmapDecoder = new SharpDX.WIC.BitmapDecoder(
      factory,
      filename,
      SharpDX.WIC.DecodeOptions.CacheOnDemand
      );

  var result = new SharpDX.WIC.FormatConverter(factory);

  result.Initialize(
      bitmapDecoder.GetFrame(0),
      SharpDX.WIC.PixelFormat.Format32bppPRGBA,
      SharpDX.WIC.BitmapDitherType.None,
      null,
      0.0,
      SharpDX.WIC.BitmapPaletteType.Custom);

  return result;
}

 public Texture2D CreateTexture2DFromBitmapSource(SharpDX.Direct3D11.Device device, BitmapSource bitmapSource)
{
  // Allocate DataStream to receive the WIC image pixels
  int stride = bitmapSource.Size.Width * 4;
  using (var buffer = new SharpDX.DataStream(bitmapSource.Size.Height * stride, true, true))
  {
    // Copy the content of the WIC to the buffer
    bitmapSource.CopyPixels(stride, buffer);
    return new SharpDX.Direct3D11.Texture2D(device, new SharpDX.Direct3D11.Texture2DDescription()
    {
      Width = bitmapSource.Size.Width,
      Height = bitmapSource.Size.Height,
      ArraySize = 1,
      BindFlags = SharpDX.Direct3D11.BindFlags.ShaderResource | BindFlags.RenderTarget,
      Usage = SharpDX.Direct3D11.ResourceUsage.Default,
      CpuAccessFlags = SharpDX.Direct3D11.CpuAccessFlags.None,
      Format = SharpDX.DXGI.Format.R8G8B8A8_UNorm,
      MipLevels = 1,
      OptionFlags = ResourceOptionFlags.GenerateMipMaps, // ResourceOptionFlags.GenerateMipMap
      SampleDescription = new SharpDX.DXGI.SampleDescription(1, 0),
    }, new SharpDX.DataRectangle(buffer.DataPointer, stride));
  }
}

Here is my samplerstate code:

SamplerStateDescription samplerDesc = new SamplerStateDescription()
            {
                Filter = Filter.MinMagMipLinear,
                AddressU = TextureAddressMode.Clamp,
                AddressV = TextureAddressMode.Clamp,
                AddressW = TextureAddressMode.Clamp,
                MipLodBias = 0,
                MaximumAnisotropy = 1,
                ComparisonFunction = Comparison.Always,
                BorderColor = new Color4(0, 0, 0, 0),  // Black Border.
                MinimumLod = 0,
                MaximumLod = float.MaxValue
            };
            SamplerState = new SamplerState(device, samplerDesc);

Is there anything wrong here?

sentences:
Unity - Stuttering character rotation Am working on the controls and camera movement for my character.  What I am trying to do is have the character head be able to rotate left and right and then when the head is rotated a certain amount, the whole character rotates around.  I have kinda of done it, the head can move smoothly, but it stutters when it starts rotating everything.

Hopefully it is visible in this GIF.

You may be able to see that the head does rotate smoothly, but when the body starts rotating, it stutters.

Here is the code that is in LateUpdate that handles all the rotations.

this.current_rotation = Quaternion.Lerp(this.current_rotation, Quaternion.Euler(new Vector3(this.pitch, this.yaw, 0)), this.mouse_sensitivity * Time.deltaTime);

this.cam.transform.rotation = this.current_rotation;
this.head.transform.rotation = this.current_rotation;

if(this.head.transform.localRotation.y > 0.3 || this.head.transform.localRotation.y < -0.3){
    Quaternion from = Quaternion.Euler(0, this.player.transform.eulerAngles.y, 0);
    Quaternion to = Quaternion.Euler(0, this.current_rotation.eulerAngles.y, 0);

    Quaternion q =  Quaternion.Lerp(from, to, this.mouse_sensitivity * Time.deltaTime);
    this.player.transform.rotation = q;
}

sentences:
How can I create animated card graphics like in Hearthstone? In the game Hearthstone, there are cards with animated images on them. A few examples:

http://www.hearthhead.com/card=281/argent-commander
http://www.hearthhead.com/card=469/blood-imp

The animations seem to be composed of multiple effects:

Particle systems.
Fading sprites in and out/rotating them
Simple scrolling textures
A distortion effect, very evident in the cape and hair of example 1.
Swirling smoke effects, the light in example 1 and the green/purple glow in example 2.

The first three elements are trivial, what I'd like to know is how the last two could be done. Can this even be done realtime in a game, or are they pre-rendered animations?

sentences:
How is constant buffer allocation handled in DX11? I'm starting with DX11 and I'm not sure if I'm doing the things right. I want to have both pixel and vertex shader program in one file. Both use some shared and some different constant buffers. So it looks like this:

Shader.fx

cbuffer ForVS : register(b0)
{
    float4x4 wvp;
};

cbuffer ForVSandPS : register(b1)
{
    float4 stuff;
    float4 stuff2;
};

cbuffer ForVS2 : register(b2)
{
    float4 stuff;
    float4 stuff2;
};

cbuffer ForPS : register(b3)
{
    float4 stuff;
    float4 stuff2;
};

....

And in code I use

mContext->VSSetConstantBuffers( 0, 1, bufferVS);
mContext->VSSetConstantBuffers( 1, 1, bufferVS_PS);
mContext->VSSetConstantBuffers( 2, 1, bufferVS2);

mContext->PSSetConstantBuffers( 1, 1, bufferVS_PS);
mContext->PSSetConstantBuffers( 3, 1, bufferPS);

The numbering of buffers in PS is what bugs me, is it alright to bind random slots to shaders (in this example 1 and 3)? Does that mean it still uses just two buffers or does it initialize 0 and 2 buffer pointers to empty?

Thank you.

sentences:
How to play a YouTube video in XNA? Is there any way to play a YouTube video given the URL in XNA? I know it can be done using a shockwave control but I need it in XNA.

I need to make a game where it has to be a YouTube video on the back... something like this:

Texture2D texture = YouTubevideoPlayer.GetTexture();

Because I need the streaming on a texture.

I think it can be done by using the youtube APIs... but some tutorial or useful code its a great help.

sentences:
How do I avoid "too" lucky / unlucky streaks in random number generation? I'm currently dealing with a multiplayer combat system where the damage dealt by the players is always multiplied by a random factor between 0.8 and 1.2.

In theory, a truly random RNG may eventually yield the same number many times (see the Tetris dilemma). This could result in a match where player is always making very high damage while the other always makes very low damage.

What can I do to make sure this doesn't happen? Are some RNGs better than others at avoiding repetition?

sentences:
Checking game objective status in efficient way on each update call I am creating a 2d mobile game where there are three levels. Each level has 20 objectives. This can increase in the future.

Examples:

Level 1
Current Objective: 2/20
Objective : Collect 1000 coins
Rewards: 100  coins.

Level 1
Current Objective: 20/20
Objective : Kill 100 aliens
Rewards: Shotgun

The question is, when a user is playing a game, how do you check if he has already completed his current objective in efficient way? This is not involving any third party listener like GameCenter, Scoreloop, etc.

I do not want to have a method with zillions of switch/if-else/or any other conditional blocks to be checked in every update call since this will affect the FPS. Some frameworks are not thread-safe. So having a separate thread is not an option either since I am going to port it to some other platforms using some other frameworks.

How do I go about it?

sentences:
outline object effect How can I achieve an outline effect similar to the ones found in League of Legends or Diablo III?

Is it done using a shader? How?
I would prefer answers that are not tied up to any particular engine but one that I can adapt to whatever engine I'm working on.

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:
How to tell if a glut window has focus from c# How can I tell if a glut window has focus? Im using c#/tao, Ill use p/invokes if necessary.

Basically I want to ignore input if it doesn't have focus.

sentences: In terms of Game Design, is the definition more of designing the ENTIRE game, or can it be limited to contributing to the artwork? I am a person who desires a job in the artwork development of a video game, but the exact term for the general career often confuses me. What I want to do is Character Design, but what general career does it fall under in terms of video games? Is the overall concept Game Design, or is it just Illustration? I get confused that Game Design is just creating the ENTIRE game from the top of your head and not just a specific area of the development, like the art. Am I wrong? Does Game Design work for both the idea and the artwork, and can the term be separated between the two? A helpful answer would be much appreciated.

sentences:
Creating multiple levels in Unity without duplicating scripts I'm trying to create a falling word typing game like z-type.

I have used the code provided here

I want to create multiple levels in the game, and it seems like I need to make some changes in the code for each level.

For example, in the word display file, I want the active word to be changed to red for level 1 and blue for level 2.

So I created a copy of my level 1 scene, created a duplicate WordDisplay script file, changed the code for active word to blue....

public class WordDisplay : MonoBehaviour {
    public Text text;
    public float fallSpeed = 1f;

    public void SetWord (string word)
    {
        text.text = word;
    }

    public void RemoveLetter ()
    {
        text.text = text.text.Remove(0, 1);
        text.color = Color.red;
    }
    //...

Here's the duplicate script I made:

public class WordDisplay1 : MonoBehaviour {
    public Text text;
    public float fallSpeed = 1f;

    public void SetWord (string word)
    {
        text.text = word;
    }

    public void RemoveLetter ()
    {
        text.text = text.text.Remove(0, 1);
        text.color = Color.blue;
    }
    //...

Then I made a copy of the WordSpawner as well because I was getting an error: I had to change the method's return type to to WordDisplay1 and then got one more error which was in the Word file, leading to more changes...

public class WordSpawner : MonoBehaviour {
    public GameObject wordPrefab;
    public Transform wordCanvas;

    public WordDisplay SpawnWord()
    {
        //...

public class WordSpawner1 : MonoBehaviour {
    public GameObject wordPrefab;
    public Transform wordCanvas;

    public WordDisplay1 SpawnWord1()
    {
        //...

Then I created a duplicate of the word prefab and selected the appropriate word spawner file...

All of this seems like too many changes for a simple colour.

Is there a better way to have multiple levels without having to create a duplicate of all these files and the word prefab?

sentences:
How often should multiplayer games communicate with the server? I once heard that Runescape "ticks" every 0.3s, and that seemed like a very long period of time, although Runescape is kind of a slow game.

I'm building a more dynamic top-down shooter game, and I'm wandering, how often should I communicate with the server? ASAP, or every 0.1s? How do shooter games usually do it?

Both the server and the client are written in Javascript, node.js and socket.io are being used.

sentences:
Word game - board implementation? I'm working on a boggle type game for android, using libgdx. The user is presented with a 4x4 grid of letters and must find words by dragging their finger over the letters.

Unlike boggle I want used letters to disappear. Remaining letters will fall down (to the bottom of the board, screen orientation is fixed) and the board is refilled from the top. Users can rotate the board to try and put hard to use letters in a better place by strategic word selection.

An example:

d g a o
u o r T
h v R I
d G n a

If i selected the word GRIT, those letters would disappear and the remaining fall down:

d
u g a
h o r o
d v n a

and then get replaced by new letters

d w x y
u g a z
h o r o
d v n a

I'm stuck figuring out how to represent the board and tiles.

I tried representing the board as a matrix to keep track of tiles selected and valid moves and the tiles stored in a matrix as well so that there was an easy mapping. This works, but I had to write some convoluted code to rotate the board.

How do other games handle this problem?

EDIT:
So thinking about it, I should really just process my touch point according to the board rotation so cells stay constant. Attached an image of what I'm thinking.

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:
Loading a heavy scene behind some loading screen in unity Is there a way to load a heavy built scene behind a loading screen in unity to not make the game look like stuck loading the scene rather show the player some loading bar that would help the player think some background process is happening.
any sites or vidoes that describe about this would be a great help! Thanks!

sentences:
Position Reconstruction from Depth by inverting Perspective Projection I had some trouble reconstructing position from depth sampled from the depth buffer. I use the equivalent of gluPerspective in GLM. The code in GLM is:

template
GLM_FUNC_QUALIFIER detail::tmat4x4 perspective
(
    valType const & fovy,
    valType const & aspect,
    valType const & zNear,
    valType const & zFar
)
{
    valType range = tan(radians(fovy / valType(2))) * zNear;
    valType left = -range * aspect;
    valType right = range * aspect;
    valType bottom = -range;
    valType top = range;

    detail::tmat4x4 Result(valType(0));
    Result[0][0] = (valType(2) * zNear) / (right - left);
    Result[1][2] = (valType(2) * zNear) / (top - bottom);
    Result[2][3] = - (zFar + zNear) / (zFar - zNear);
    Result[2][4] = - valType(1);
    Result[3][5] = - (valType(2) * zFar * zNear) / (zFar - zNear);
    return Result;
}

There doesn't seem to be any errors in the code. So I tried to invert the projection, the formula for the z and w coordinates after projection are:

and dividing z' with w' gives the post-projective depth (which lies in the depth buffer), so I need to solve for z, which finally gives:

Now, the problem is I don't get the correct position (I have compared the one reconstructed with a rendered position).
I then tried using the respective formula I get by doing the same for this Matrix.
The corresponding formula is:

For some reason, using the above formula gives me the correct position. I really don't understand why this is the case. Have I done something wrong? Could someone enlighten me please?

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:
Generate camera shakes in Java How would one of these work?

(If you don't know what I'm talking about, think like in a game where you shoot a big gun, and your screen bounces in the opposite direction.)

I've been experimenting with a couple different ideas but none are either fully working, or fully smooth.

Using this function for setting the camera position:

x = -target.x + halfScreenW;
y = -target.y + halfScreenH;

One problem I've run into is when setting the camera to move a certain distance in a direction, it will reach its target X or Y before the other, causing it to go travel in a straight line for a short while. I believe the solution to this is using the Bresenham line algorithm?

What would be the best way to achieve a camera shake?

edit: Related - Realistic Camera/Screen Shake from Explosion

sentences:
Libgdx: If Rectangle overlaps anything? I've written a code that allows me to talk with an NPC. This works as long as there is only 1 NPC on the map. I'll explain why.

public void getNPCCollision(){
    for (int i = players.size() - 1; i >= 0; i--) {
        Player player = players.get(i);
        for (int j = beings.size() - 1; j >= 0; j--) {
            Being being = beings.get(j);
            if(player.getBounds().overlaps(being.getBounds())) {
                setX(oldX);
                velocity.x = 0;
                setY(oldY);
                velocity.y = 0;
            }
            else if(player.getBounds().overlaps(being.getTalkingBounds())) {
                canTalk = true;
                talkAbleBeing = being;
            }
            else{
                talkAbleBeing = null;
                canTalk = false;
            }
        }
    }
}

I check every update if my Player walks into an NPC's Talking Rectangle. It goes by every NPC on the map. The thing is If I'm not on NPC 1's rectangle but on NPC 2's rectangle, It'll still set canTalk to False because I'm indeed not in his rectangle.

Is there any way I can fix this issue? Please, any help appreciated.

sentences:
Sprite batching and dealing with isometric depth sorting So I'm using Love2D which uses SDL2* as far as I'm aware and I have a question about texture atlases & spritebatching.

I have an isometric chunk, with 2 layers, terrain and objects (trees, buildings, units). The terrain is not animated and the tiles are 32x16, they fit perfectly even in a 1028x1028 texture atlas.

However the object spritebatch\layer is a different thing. I have trees, that are animated and each frame uses up to 200x200 space in the atlas. You can see the problem. Now, I think I can fit all of it in a 8192x8192 texture and this is OK for my GPU, which is entry level (GT 720). It gets stored in the VRAM.
So I conducted some test and imported a 10k x 10k image, the GPU could not handle it, and it was loaded onto the RAM.
What exactly happens here? How much is the performance loss, I'm about to test, but is this going to cause any incompatibility problems? Other than the 300MB RAM usage instead of VRAM.

Now, you might state the obvious, "Why not use 2 or more texture atlases?".
I don't know if I'm doing things wrong, but I want to use sprite batches for the object layer, and the way I'm drawing it is this:

function update_objects()
  object_batch:clear();
  for i=0,chunk_width-1,1 do
    for o=0,chunk_height-1,1 do
      object_batch:add(
                        tile_quads[objects_chunk[i][o]],
                        (i - o) * tile_width  * 0.5,
                        (i + o) * tile_height * 0.5
                        - tile_offset[objects_chunk[i][o]]);
    end
  end
  object_batch:flush()
end

In order to deal with the depth issue that isometric games have, I simply draw furthest to closest. As far as I'm aware, sprite batches can only use 1 texture atlas, and I confirmed that by tests.
Of course, there's a draw call that draws the sprite batch. I'm ok with several draw calls (units, buildings, environment in 3 separate batches for example), but I don't see how I will deal with the depth issue if I do go that way.

*(not OpenGL as I previously stated)

Any ideas?

sentences: How to collide with a 45degree wall in XNA I want to make a PAC MAN imitation game to start working on AI, and while my first version will feature rectangles with widths or heights of 1 to makes walls for collision detection, I want to eventually make walls that are at 45 degree angles. I have found no guides out there to do this, only that rectangles can't be rotated apparently.

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:
Confusion with the texture coordinate system in XNA I am creating a cow out of primitive shapes, and am using the minecraft cow texture as a placeholder. To create the primitive model I have created a 'model' class and created a sub class 'ModelCow' which inherits from the Model class. Each model contains a List of the component class which is like a sub part of the model. In the creation of the components a texturemap for each component is created, which defines the locations of each texture foreach face for that cube in a texture map for that cow.

The way each texture is determined is the top left pixel of the texture and the bottom right, I had to go through each texture and find the top left x and y and divide them by the width and height respectily - the same thing with the bottom right. The thing is the textures are all one pixel off what they should be i.e it is shifted right too far or one pixel is missing. The question is what am I doing inncorrectly. Am I meant to start counting from zero when I get the x and y/ top and right coordinates for the texture. Also in this case the actual width and height of the texture and subtracted by one, i.e. 32 is 31 and 64 is 63

Example of what I am doing is:

AAAAAAAA

AAAAAAAA

A#AAAAAA

AAAAAAAA

the '#' would be 1, 2 and the width would be 7 and the height would be 3. Is this correct?

Here is the code:

    float width = 63f;
    float height = 31f;

    // Body
    TextureMap bodyMap = new TextureMap();
    bodyMap.Add(new Vector4(28f / width, 4f / height, 39f / width, 13f / height), FaceDirection.ZIncreasing);
    bodyMap.Add(new Vector4(40f / width, 4f / height, 51f / width, 13f / height), FaceDirection.ZDecreasing);
    bodyMap.Add(new Vector4(18f / width, 14f / height, 27f / width, 31f / height), FaceDirection.XDecreasing);
    bodyMap.Add(new Vector4(28f / width, 14f / height, 39f / width, 31f / height), FaceDirection.YDecreasing);
    bodyMap.Add(new Vector4(40f / width, 14f / height, 51f / width, 31f / height), FaceDirection.XIncreasing);
    bodyMap.Add(new Vector4(52f / width, 14f / height, 61f / width, 31f / height), FaceDirection.YIncreasing);
    components.Add(Shape.BuildCube(new Vector3(0, 0, 0), new Vector3(0.7f, 0.7875f, 1.30f), bodyMap));

Whereas the first two coordinates are the top left and the last two are the bottom right. X and Y respectively.

sentences:
How to do profiling and memory pooling per system? I have been interesting in profiling and keeping a managed memory pool for each subsystem, so I could get statistic on how much memory was being used in something such as sounds or graphics. However, what would be a design that works for doing this? I was thinking of using multiple allocators and just using one per subsystem, however, that would result in global variables for my allocators (or so it would seem to me). Another approach I have seen/been suggested is to just overload new and pass in an allocator for a parameter.

I had a similar question over on stackoverflow here with a bounty, however, it seems as if perhaps I was too vague or just there is not enough people with knowledge in the subject.

sentences:
How do I offset a TouchPanel input in Monogame I am creating my first 2D game in monogame.  I have used RenderTarget2D to maintain a 4:3 aspect ratio.  If it is played in a window of any other ratio it will offset the RenderTarget2D position to create a Letterbox black bar effect.  I accomplish this with:

        Rectangle RenderArea;
        // Calculate target and current aspect ratios
        float outputratio = (float)Window.ClientBounds.Width / (float)Window.ClientBounds.Height;
        float targetratio = (float)Screen.Width / (float)Screen.Height;

        // Calculate rectangle on screen we will be drawing to
        if (outputratio <= targetratio)
        {
            // output is taller than it is wider, bars on top/bottom
            int currentheight = (int)((Window.ClientBounds.Width / targetratio) + 0.5);
            int barheight = (Window.ClientBounds.Height - currentheight) / 2;
            RenderArea = new Rectangle(0, barheight, Window.ClientBounds.Width, currentheight);
        }
        else
        {
            // output is wider than it is tall, bars left/right
            int currentwidth = (int)((Window.ClientBounds.Height * targetratio) + 0.5);
            int barWidth = (Window.ClientBounds.Width - currentwidth) / 2;
            RenderArea = new Rectangle(barWidth, 0, currentwidth, Window.ClientBounds.Height);
        }

(Screen being my RenderTarget2D)

I then draw my RenderTarget2D to this area on the screen.  This works great.  The only issue I have is how to get touch and mouse inputs offset to this location on the screen without having to offset my TouchPosition.Position.X and Y manually every time I check their position.

I have already set my TouchPanel virtual size with:

        TouchPanel.DisplayWidth = Screen.Width;
        TouchPanel.DisplayHeight = Screen.Height;

but I don't know of a way to offset the returned TouchLocation X and Y by my RenderArea X and Y.

Is there any way to accomplish this without manually offsetting every position check?

sentences:
Libgdx how to add popup interaction I am looking for someone to point me in the right direction. I am working in libgdx.  I have a game where a player will approach an object on a map and then interact with it. On interaction a new screen should come up, that then has separate interaction.

Think, lockpicking. if you walk to a door, a minigame would popup with the lock on the screen.  All background art and action halts while this happens.

I was considering using an Object that triggers a Looped event that you can't escape until the condition is met EG:  while(!Finished){lockpick()} then creating a render() inside lockpick()... is this a terrible idea? Should I just dump out to a different screen, and reload my game screen from saved settings?  I really don't know the best way to handle this...

sentences: Rotating a button in Unity UI by -180 on the Y and it stops working If I rotate my button by -180 on the Y axis I can't even click on it. If for example I rotate it 180 on the Z axis everything is fine. Why does this happen and how can I fix it ?

sentences:
How to tween to move an object in arc? Okay, so I think I need to use a tween in order to move an object in my game.  I have some little green dudes that need to move in an arc (bezier) to a location that is clicked by the user.  My game functions by having the mouse point raycast to the screen giving my character a position to move to.  They don't just run though,  they fire off their jetpacks and should travel in an arc to the target position.  I'm pretty new to Unity but all I can come up with is using a tween to do this.  Am I missing something?   That being said,  I'm totally confused on what a tween actually is.  I can't wrap my head around how the object can be moved outside of an update function.  I'm using the "free from the asset store" LeanTween package.  I feel like there should be some sort of easier way to achieve the desired behavior.

How can I have my character move from Vector3 A to Vector3 B in an arc?

sentences:
How to make money from creating a game for Windows? I'm going to create a game. Well, a set of games, but they will accrue little by little.
So, at the beginning there will be one game.

The game will be written in C# with WPF and WCF techs, including server-side game processing, statistics and so on.

And yeah, I just have quit my current job in one company, so I need to live on.

So, how to start making money on this wonderful development? It will make much pleasure for me, as soon as I like developing and actually playing those games (gomoku, sea battle, etc)?

I only see two ways — one of them is to find an investor and the other one is to complete at least one game with 100% server uptime and start distributing it.

But I need recommendations. I need help, actually — the explanation how exactly to do all of this things and to to not starve:) .

sentences: Receive UDP packet in android I'm sending UDP packet to android over a wireless network from some other software . how can I receive that in android ? should I write a client in android to get the data?

sentences:
Unity Physics collision metrix doesn't work on ParticleCollisions I have this Physics collision metrix(1).
I have Player layer on the ship and PlayerShells on Particles whitch's my shooting.
The problem:
When I shoot, OnParticleCollision on my shells collides with player, but as you can see on the picture it shouldn't happen.
Proofing my theory, I testet it: (2) and (3) screenshoots;
My "collision" code:
private void OnParticleCollision(GameObject other)
        {
            SetDamage(other.GetComponent<ISetDamage>());

            //Creating hit effect
            _mainParticles.GetCollisionEvents(other, _collEvent);
            Vector3 pos = _collEvent[0].intersection;   //hit posotion
            Quaternion newRot =
               Quaternion.Euler(transform.rotation.x, -transform.rotation.y, transform.rotation.z);
               //Tryed to rotate effect like opposite from bullet, but it doesn't work for now

            switch (other.GetComponent<Stats>().GetMatter)
            {
                case Matter.Steel:
                    Instantiate(_hitSteel, pos, newRot);
                    break;
                case Matter.Wood:
                    Instantiate(_hitWood, pos, newRot);
                    break;
                case Matter.Flesh:
                    Instantiate(_hitFlesh, pos, newRot);
                    break;
                case Matter.Dirt:
                    Instantiate(_hitDirt, pos, newRot);
                    break;
                case Matter.Stone:
                    Instantiate(_hitStone, pos, newRot);
                    break;
            }
        }

What am I doing wrong?? :(

sentences:
player movements aren't working python #from pygame.locals import
import pygame
import math
from time import sleep
import display_world

# class Player(pygame.sprite.Sprite):
class Player():
    x = 10
    y = 500
    speed = 10

    # stores if the player is jumping
    isjump = 0

    # force(v) up and mass m.
    v = 8
    m = 2

    def moveRight(self):
        self.x = self.x + self.speed
        # moving right

    def moveLeft(self):
        self.x = self.x - self.speed
            #moving left

    def jump(self):
        self.isjump = 1

    # Jumping
    def update(self):
        if self.isjump:
            # Calculate force(F).
            if self.v > 0:
                F = (0.5 * self.m * (self.v*self.v))
            else: F = -(0.5 * self.m * (self.v*self.v))

        # Change position
            self.y = self.y + self.y

        # Change velocity
            self.v = self.v - 1

        # If ground is reached
        if self.y >= 500:
            self.y = 500
            self.isjump = 0
            self.v = 8

class App:
    windowWidth = 800
    windowHeight = 600
    player = 0

    def __init(self):
        self._running = True
        self._display_surf = None
        self.image_surf = None
        self.player = ()

    def on_init(self):
        pygame.init()
        self.display_surf = pygame.display.set_mode((self.windowWidth, self. windowHeight), pygame.HWSURFACE)

        pygame.display.set_caption('MY FIRST GAME')
        self.running = True
        self._image_surf = pygame.image.load('small_mario.png').convert()

    def on_event(self, event):
        if event.type == QUIT:
            self._running = False

    def on_loop(self):
        pass

    def on_render(self):
        self._display_surf.fill((0,0,0))
        self._display_surf.blit(self._image_surf, (self.x, self.y))
        self.player.updatepygame.display.flip()
        sleep(0.03)

    def on_cleanup(self):
        pygame.quit()

    def on_execute(self):
        if self.on_init() == False:
            self._running = False

        while(self._running):
            pygame.event.pump()
            keys = pygame.key.get_pressed()

            if (keys[K_RIGHT]):
                self.player.moveRight()

            if (keys[K_LEFT]):
                self.player.moveRight

            if (keys[K_UP]):
                self.player.jump()

            if (keys[K_ESCAPE]):
                self._running = False

            self.on_loop()
            self.on_render()
        self.on_cleanup()

sentences:
How is a gimbal connected with Euler rotation angles? When I see any video that explains how gimbal lock occurs, they explain it using a gimbal machine and I totally understand the effect on that machine. What I don't understand is how Euler angles are related to the idea how gimbal machine works.

And my #1 confusion comes from the following:

Euler angles rotate the coordinate frame but the axes stay orthogonal.
Gimbal circles rotate so that two rotation axes become collinear.

Hence I don't understand how gimbal mechanism can show how Euler angles work.

sentences:
Is there any advantage in using  DX10/11 for a 2D game? I'm not entirely familiar with the feature set introduced by DX10/11 class hardware. I'm vaguely familiar with the new stages added to the programmable graphics pipeline, such as the geometry shader, the compute shader, and the new tessellation stages. I don't see how any of these make much of a difference for a 2D game though.

Is there any compelling reason to make the switch to DX10/11 (or the OpenGL equivalents) for a 2D game, or would it be wiser to stick with DX9 considering that that a significant share of the market still runs on older technologies (e.g. the February 2012 Steam surveys lists around 17% of users as still using Windows XP)?

sentences:
Why shouldn't I permit changing the field of view, if the technology allows for it? This is less of a question aimed at developing a game and more about the technology behind it. A number of gaming journalists and pro gamers (both in the tournament and the home entertainment sector) often hammer on the matter that any first or third person game should have a way to change the field of view, and I agree with them. The main reason they mention this is because a pretty large number of players get motion-sickness related headaches and eyestrain if they play with an overly constrained field of view.

I can understand if an indie developer does not allow this due to budget constraints, because they need to add support to the engine for that. However, a number of developers use high profile third party engines like Frostbite, Unity, Unreal, or Cryengine, but don't offer an option for changing the field of view.

Why shouldn't I permit changing the field of view, if the technology allows for it?

sentences:
How to make the player unable to change some of the game elements? I am making a text turn based RPG fighting game in which you create your own spells. You also share them as JSON files with your friends. Sharing is required to win.
The game is designed so that it isn't a problem if a spell is copied and shared one billion times

I do not want players to edit the files or the spell creator. The only reason is to not ruin others' experience.
I wouldn't mind at all if there were no multi-player elements in the game.

Is there a way to make some game elements unable to be modified ?

My game is interpreted in Lua and has some bash integrated into it for file managing.
It is also GNU/Linux only.

sentences:
Score Based on Game play Time and a Int I'm trying to do a score that is based on the time taken and number of manipulators used. The faster you do it, with the fewest manipulators, the higher the score. I've managed to get it working with you get the lowest score but not the highest and i can't think how to do it. Any help would be appreciated.

I have a play time (GameTime.TotalGameTime.TotalSeconds - startTime.TotalSeconds) and a count of the manipulators used (grid.NumberOfManipulatorsInGrid(TextureList.GameplayTextures)) to work with

sentences:
Has anyone got the Krypton Lighting Engine working in MonoGame for Windows 8? I've converted the core of the Krypton Lighting Engine so that it's compatible with Windows 8.

The trouble I'm having when actually using it is that it can't load the KryptonEffect.xnb file.  I'm aware that MonoGame doesn't have XNA content processors, so I'm compiling the KryptonEffect.fx file in an XNA Content project.

When I try to load the Effect, I get an exception saying The MGFX file is corrupt in the ReadEffect method in MonoGame.  The header should be MGFX but it's a seemingly random byte array.

I then came across this page that says to use a tool named 2MGFX.  I tried this, but the tool reports: The effect must contain at least one technique and pass.  From what I can see from KryptonEffect.fx the file, it does.

Has anyone got the Krypton Lighting Engine working on MonoGame for Windows 8? Or has anyone been able to load any kind of Effect file under Windows 8?

sentences: What methods are there for representing 3D terrain? I'm making a terrain system which needs to be procedurally generated and would like to know my options. So far I know of: Height-field terrain, Vector-field terrain, and Voxel terrain. Is there anything missing from that list?

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 to draw equal length line stripes on a parabola? Simply put I'm making a basketball game. I'm using these equations to predict the ball position and it works fine:

x = vx * t
y = vy * t + 0.5 * gravity * t * t

But I can't find a way to draw equal length line stripes on the parabola. At this moment I'm using:

t = t + dt

in which dt is the time elapsed in last frame. It works but the line segments would be longer if velocity is larger. Anybody know a way to draw equal length line stripes like the flying trails in Angry Bird? Thanks very much.

I suppose I should calculate the integral on the curve but I can't get it through...

sentences: Play .mp3 with Craftyjs I want to play .mp3 sound files in a game I built with Crafty.js. Is this possible without converting the sound file?

sentences:
How do I ensure consistent behaviour when using Unity's Collider2Ds for triggers and collisions? I am experiencing inconsistent behavior using Unity's 2D Physics engine and their Collider2Ds to detect collisions and triggers on my projectiles. I will classify it into two problems. The first is that occasionally the projectile will pass through walls/objects it should collide with. The second is that occasionally the projectile will pass through enemies that it should hit without triggering. I will try to elaborate in detail below.

A projectile is organized into a container Projectile GO and two children GO: a PhysicsColliders GO and a HitBoxColliders GO.

The PhysicsCollidersGO job is to hold the colliders that define the solid regions of the projectile using Collider2D components. It's GO is on a Projectile layer which is set to collide with other solid layers such as the ones my walls are on. Walls are static colliders.

The HitBoxCollidersGO job is to define the a HitBox area. It's GO is on a HitBox layer and also uses Collider2D components that are set to be triggers. A HitScript on the GO listens for OnEnterTrigger.

Projectiles are set in motion by setting the velocity of the RigidBody once upon firing.

Here is a visual of the structure:

 ProjectileGO
  - PhysicsCollidersGO
  - HitBoxCollidersGO

Here are descriptions of the GameObjects and their components:

 ProjectileGO
   - RigidBody2D Component (collisionDetectionMode is set to Continious)

 PhysicsCollidersGO (Layer is set to Projectile)
   - BoxCollider2D Component

 HitBoxCollidersGO (Layer is set to HitBox)
   - BoxCollider2D Component (IsTrigger is set)
   - HitScript Component

Problem 1. Projectiles will sometimes not collide with walls/solid objects/etc...

Problem 2. Projectiles will sometimes not trigger a hit.

What could be causing these inconsistencies?  How can ensure that collisions and triggers will consistently behave correctly?

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:
How do I draw a point sprite using OpenGL ES on Android? Edit: I'm using the GL enum, which is incorrect since it's not part of OpenGL ES (see my answer). I should have used GL10, GL11 or GL20 instead.

Here's a few snippets of what I have so far...

void create()
{
    renderer = new ImmediateModeRenderer();

    tiles = Gdx.graphics.newTexture(
        Gdx.files.getFileHandle("res/tiles2.png", FileType.Internal),
        TextureFilter.MipMap,
        TextureFilter.Linear,
        TextureWrap.ClampToEdge,
        TextureWrap.ClampToEdge);
}

void render()
{
    Gdx.gl.glClear(GL10.GL_COLOR_BUFFER_BIT | GL10.GL_DEPTH_BUFFER_BIT);
    Gdx.gl.glClearColor(0.6f, 0.7f, 0.9f, 1);
}

void renderSprite()
{
    int handle = tiles.getTextureObjectHandle();
    Gdx.gl.glBindTexture(GL.GL_TEXTURE_2D, handle);
    Gdx.gl.glEnable(GL.GL_POINT_SPRITE);
    Gdx.gl11.glTexEnvi(GL.GL_POINT_SPRITE, GL.GL_COORD_REPLACE, GL.GL_TRUE);

    renderer.begin(GL.GL_POINTS);
    renderer.vertex(pos.x, pos.y, pos.z);
    renderer.end();
}

create() is called once when the program starts, and renderSprites() is called for each sprite (so, pos is unique to each sprite) where the sprites are arranged in a sort-of 3D cube.

Unfortunately though, this just renders a few white dots...

I suppose that the texture isn't being bound which is why I'm getting white dots. Also, when I draw my sprites on anything other than 0 z-axis, they do not appear -- I read that I need to crease my zfar and znear, but I have no idea how to do this using libgdx (perhaps it's because I'm using ortho projection? What do I use instead?).

I know that the texture is usable, since I was able to render it using a SpriteBatch, but  I guess I'm not using it properly with OpenGL.

sentences:
What is the shader format for Metal shaders shipped with iOS applications? I am interested in analyzing existing shaders implemented using Apple's Metal framework. From my previous experience on other platforms with OpenGL, I have found that applications sometimes bundle shader code more or less in plaintext within the application binary. I have not found this to be the case with iOS.

Is there a special final format that Metal shaders are compiled into?
Can they be disassembled?
Where should one normally look for shader code in iOS applications?

Please let me know if this isn't posted on the right SE before downvoting. I was torn on whether this should go on Graphics SE or GamesDev SE. I do not think this should go on ReverseEngineering, or Security SE, as I fear those communities have very little experience with shader formats and likely wont be much help.

sentences:
Developing game progress screen I'm developing an application for iPhone with a screen where the user will track his progress. Something like so, as seen in the Two Dots game:

Currently I plan on creating this using constraints and size classes. But I feel its too much of work for each screen size. I've set a background UIImageView and I place different circles, manually hardcoding the position. The curved path in my case is made of a texture. So I can't plot it using Bezier Curves either.

Is there an easier way to do it? Perhaps using SpriteKit or Cocos2D-x?

sentences:
Libgdx ParallaxScrolling and TiledMaps I implemented ParallaxScrolling for my SideScroller project, everything is working but the tiled map (the most important part!). I've been trying out everything but it doesn't work (see the code below).

I'm using  ParallaxCamera from GdxTests, it's working perfectly for the background layers.

I can't explain myself properly in english, so I recorded 2 videos:

Before parallaxScrolling

After parallaxScrolling

As you can see, now the platforms appear in the middle of the Y-axis.

I've got a Map class with 2 tiled maps, so I need two renderers too:

private TiledMapRenderer renderer1;
private TiledMapRenderer renderer2;

public void update(GameCamera camera) {
renderer1.setView(camera.calculateParallaxMatrix(1f, 0f), camera.position.x - camera.viewportWidth / 2,
           **camera.position.y - camera.viewportHeight/2**, camera.viewportWidth, camera.viewportHeight);
renderer2.setView(camera.calculateParallaxMatrix(1f, 0f), camera.position.x - camera.viewportWidth / 2,
           **camera.position.y - camera.viewportHeight/2**, camera.viewportWidth, camera.viewportHeight);
}

In bold, the code I think I should change. I've tried changing parameters, even adding hardcoded values, etc, but one of two:
1. Nothing happens.
2. Platforms disappear.

Here is some aditional code. The render method:

     world.update(delta);
    parallaxBackground.update(camera);

    clear(0.5f, 0.7f, 1.0f, 1);

    batch.setProjectionMatrix(camera.calculateParallaxMatrix(0, 0));
    batch.disableBlending();
    batch.begin();
    batch.draw(background, -(int)background.getRegionWidth()/2, -(int)background.getRegionHeight()/2);
    batch.end();
    batch.enableBlending();

    parallaxBackground.draw(batch, camera);
    renderer.render(batch);

sentences:
Converging at position and angle using motor-based rigidbody movement I am given a rigidbody positioned in \$\mathbb{R}^2\$. It is a box of length \$l\$ and height \$\epsilon\$. The position of the box's left center is described by \$\vec{p}\$, and its angle from the x-axis is \$\theta\$. The body is in a vacuum (no friction), and its mass is \$m\$ (uniformly distributed). Here's a quick diagram.

Next, I am given a target position and angle to reach. It is not guaranteed that the body will reach the target position and angle the next time frame.

I need to calculate the necessary force \$F\$ and torque \$T\$ that will push the body closest to the target. I am given constraints for max force and max torque.

To make things complicated, the body might be affected by external forces. One of them is gravity \$F_g\$, which will always remain constant. Sometimes, normal forces exist as well. The applied forces or the total force is unknown, but the velocity or the angular velocity is available.

I tried to solve this problem using steering behaviors. However, the angle seems to fluctuate constantly. Here's part of my code in C# (Unity).

\$\vec{p}_0=\$transform.position
\$\theta_0=\$transform.eulerAngles.z
\$\vec{p}_t=\$position
\$\theta_t=\$angle

private RigidBody _body;

public float SlowDownRadius = 2f;
public float MaxVelocity = 50f;
public float MaxForce = 10000f;

public float SlowDownDelta = 15f;
public float MaxAngVelocity = 180f;
public float MaxTorque = 10000f;

public void Next(Vector3 position, float angle) // angle in degrees
{
    // force
    Vector2 to = position;
    var from = (Vector2) transform.position;
    var desired = to - from;
    var dist = desired.sqrMagnitude;

    desired = desired.SetMagnitude(dist < SlowDownRadius * SlowDownRadius
        ? MaxVelocity * Mathf.Sqrt(dist) / SlowDownRadius
        : MaxVelocity);

    Vector2 vel = _body.velocity;
    var steering = desired - vel;

    var mass = _body.mass;
    Vector2 force = mass * UnityEngine.Physics.gravity;
    var time = Time.deltaTime;

    var newForce =
        (time <= 0 ? new Vector2() : (mass / time * steering)) - force;

    _body.AddForce(newForce.Clamp(MaxForce)); // limits magnitude of newForce to MaxForce

    // torque
    var toAngle = angle;
    var fromAngle = transform.eulerAngles.z;
    var desiredAngle = AngleDistance(fromAngle, toAngle);
    var distAngle = Mathf.Abs(desiredAngle);

    if (distAngle < 1f)
    {
        transform.eulerAngles = new Vector3(0, 0, angle);
        return;
    }

    desiredAngle = Mathf.Sign(desiredAngle) * (distAngle < SlowDownDelta
                  ? MaxAngVelocity * distAngle / SlowDownDelta
                  : MaxAngVelocity) * Mathf.Deg2Rad;

    var angVel = _body.angularVelocity.z; // in radians
    var steeringAngle = desiredAngle - angVel;

    var newTorque = (time <= 0 ? 0f : (mass / time * steeringAngle));

    _body.AddTorque(0, 0, Mathf.Sign(newTorque) * Mathf.Min(Mathf.Abs(newTorque), MaxTorque));
}

public static float AngleDistance(float from, float to)
{
    var dist = (to - from + 180f) % 360f - 180f;
    return dist <= -180f ? dist + 360 : dist;
}

If I made any errors, please let me know.
Thank you in advance!

sentences:
How can I hide the camera gizmo in Unity? How can I hide the camera gizmo in Unity?
As said here I tried to use the gismos menu in the top of my Scene view. But it does not work. Why?
Also, I tried saving my scene and project after the gizmo changes. Did not help. I have the Unity 2020.1.17f1.

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:
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:
Sync Collider size with bones in model I'm setting at runtime a BoxCollider2D size by taking the difference between the Y position of two bones on the model... but the size I'm getting out of this creates a collider that is almost twice as tall as the distance between the two points... am I making a dumb mistake somewhere? If it matters, it's a 3d model in a 2d environment.
BoxCollider.size = new Vector2(
         BoxDefaultSize.x,
         Mathf.Abs(head.position.y - Mathf.Min(leftFoot.position.y, rightFoot.position.y))
        );

In the picture the blue gizmo shows the foot position, the green one the head position. The collider is almost 2x the distance between them:

Maybe there's a better way to sync the collider with the model animation that I don't know about?
Addendum:

Vector3.Distance(head.position, leftFoot.position) returns pretty much the same result

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:
Implementing a lexicon for a word-based game with C# or C++ In my game project I have a lot of word existance checks based on some word bank. As usual arrays or map/set are not realy appropriate for this due to their speed/memory usage, I want to use Ternary Search Tree. After some googling I've realised that there's not so much info or code ready to use there. So I want to implement it myself.

Question is - can I write it in C++ and then export to Unity with cross-platform support? To be more precise: will I be able to use this cpp library on Android and iOS? Or maybe I should just write it in C# which, I believe, will be slightly less efficient?

sentences:
More Efficient Data Structure for Large Layered Tile Map It seems like the popular method is to break the map up into regions and load them as needed, my problem is that in my game there are many AI entities other than the player out performing actions in virtually all the regions of the map. Let's just say I have a 5000x5000 map, when I use a 2D array of byte's to render it my game uses around 17 MB of memory, as soon as I change that data structure to a my own defined MapCell class (which only contains a single field: byte terrain) my game's memory consumption rockets up to 400+ MB. I plan on adding layering, so an array of byte's won't cut it and I figure I'd need to add a List of some sort to the MapCell class to provide objects in the layers. I'm only rendering tiles that are on screen, but I need the rest of the map to be represented in memory since it is constantly used in Update.

So my question is, how can I reduce the memory consumption of my map while still maintaining the above requirements? Thank you for your time!

Here's a few snippets my C# code in XNA4:

public static void LoadMapData()
    {
        // Test map generations
        int xSize = 5000;
        int ySize = 5000;
        MapCell[,] map = new MapCell[xSize,ySize];
        //byte[,] map = new byte[xSize, ySize];

        Terrain[] terrains = new Terrain[4];
        terrains[0] = grass;
        terrains[1] = dirt;
        terrains[2] = rock;
        terrains[3] = water;

        Random random = new Random();

        for(int x = 0; x < xSize; x++)
        {
            for(int y = 0; y < ySize; y++)
            {
                //map[x,y] = new MapCell(terrains[random.Next(4)]);
                map[x,y] = new MapCell((byte)random.Next(4));
                //map[x, y] = (byte)random.Next(4);
            }
        }

        testMap = new TileMap(map, xSize, ySize);
        // End test map setup

        currentMap = testMap;
    }

public class MapCell
{
    //public TerrainType terrain;
    public byte terrain;

    public MapCell(byte itsTerrain)
    {
        terrain = itsTerrain;
    }

    // the type of terrain this cell is treated as
    /*public Terrain terrain { get; set; }

    public MapCell(Terrain itsTerrain)
    {
        terrain = itsTerrain;
    }*/
}

sentences:
Propel entities at some angle (depending on explosion's position) I have a 2D platformer. There are multiple particles that are just 1x1 colored pixels. Let's assume there are 256 particles laid out as a 16x16 cube. Say I popped an explosion right in the middle. All of these particles should fly out all over the place.

My question is how would I calculate the angle at which they have to be propelled toward and find what the initial velocity vector right after the blast has to be set to. I already have gravity and friction so that they would be naturally attracted to the ground and slow down after they have traveled a good distance along the X axis.

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:
Rendering order in an Entity System Say I use a basic ES approach, and also inside Systems I hold lists of all entities that Systems are required to process.

How do I maintain this list of entities in desired rendering order, i.e. for a dumb 2D RenderingSystem?

I saw this discussion, and what they suggest is to do something like Z ordering - what I would probably do is just to store a "layer" int in DrawableComponent and then, inside RenderingSystem, just sort entities by mentioned "layer" whenever the entity list for RenderingSystem changes.

They also say we could just delete and recreate the entity whenever we want it on the top, but it seems too inflexible to me.

How is this problem usually solved?

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:
What does the "DXGI Flip Model Swapchain" setting in Unity do exactly? I'm preparing a Standalone Unity game for Windows and Mac.

There is a checkbox in Player Settings called "Use DXGI Flip Model Swapchain for D3D11", which seems disabled by default.

Needless to say, I don't understand this setting at all. The Unity documentation has this:

  Flip model ensures the best performance. Disable this to fallback to
  Windows 7-style BltBlt model. This setting affects only D3D11 graphics
  API on Windows 8.1 or greater.

  Note that even if the flip model is enabled, the BltBlt model will be
  used in exclusive fullscreen mode to reduce input latency.

It doesn't exactly tell me what this is (I literally don't know what most of that means) - but it almost seems like there is no reason not to have it enabled.

Can someone explain the pros and cons of this setting? Under what scenarios would I want to enable/disable it?

Since disabling it fallbacks to the Windows-7 style, it almost gives the impression that enabling this might make the game less compatible on Windows 7?

sentences:
How can I consistently identify location on a mesh from a raycast hit? I am using RaycastHit.triangleIndex to identify a location on a mesh (very low poly). However, I have discovered that a given triangle on the mesh does not have the same triangleIndex value from one execution of the game to the next (index "1" maps to location "A" on the first run, but location "B" on the second run). It is consistent within a given game, but for my mapping to work I need it to be consistent across games.

Given that I am using Raycast, how can I consistently identify the same logical location on the model?

Notes:

The game object must be instantiated from a prefab (there are a variable number of them), so it could be that this is why the vertex order changes? Is there a way to instantiate with consistent vertex order?
If I need to ask the artist to recreate the asset with submeshes for each location, will I be able to consistently identify those?

sentences:
Problem with LAN multiplayer game in Unity I'm trying to learn how to make an offline LAN multiplayer game in Unity.

So for example, I make something that can send a text message and make a cube XD

Now this is my problem:

(When I send a message, try connecting to the server, or when I try to create a cube I should first click on the other window!)

StartServer:

    using UnityEngine;
using System.Collections;

public class StartServer : MonoBehaviour {
    public Transform Taghsimobj;
    public Transform Makan;
    public Transform CubeOBJ;

    public string MSG;
    public string ResMsg;

    void Ress (string inres) {
        ResMsg = inres;

    }

    void OnGUI () {

        if (Network.peerType == NetworkPeerType.Disconnected)
        {
            if (GUILayout.Button ("StartServer"))
            {
                Network.InitializeServer(10, 25000);
            }
            if (GUILayout.Button ("Connect"))
            {
                Network.Connect ("192.168.1.101", 25000);
            }

        }
        else
        {
            if (GUILayout.Button ("CreatCube"))
            {
                Network.Instantiate (CubeOBJ, Makan.transform.position, Makan.transform.rotation, 0);
            }
            if (GUILayout.Button ("CreatChat"))
            {
                Network.Instantiate (Taghsimobj, this.transform.position, this.transform.rotation, 0);
            }
            if (GUILayout.Button ("SendMessage"))
            {
                GameObject.Find ("GameObject(Clone)").GetComponent<NetworkView>().RPC ("ResText", RPCMode.All, MSG);
            }
            MSG=GUILayout.TextField(MSG);
            GUILayout.Box (ResMsg);
        }

    }
}

taghsim:

    using UnityEngine;
using System.Collections;

public class Taghsim : MonoBehaviour {

    void Start () {
    }

    [RPC]
    void ResText (string ResIn) {
        GameObject.Find ("Main Camera").SendMessage ("Ress", ResIn);

    }
}

sentences:
Conditional priority in behavior trees I want to trigger behavior based on certain conditions. I currently just have a sequence that runs different behavior, it triggers on condition but always in sequence. When the first condition is met it runs that.
Let's say I have 2 behaviors. Flee from threat and find food if hungry. Usually the flee from stronger threat prevails and thus is placed early in the sequence. But what if the entity running the behavior is starving, it can take more risk. Since the flee from threat comes first in sequence and triggers on a threat it will never pick to gather food if there is a threat present. I guess I need something like a scoring system and let the tree pick the best option. Is this common in behavior trees? How is it called or best implemented?
I'm using gdx.ai in particular and perhaps there is something out of the box I can use. I can make a task in the behavior tree that weighs all the possible actions but this ties everything together and bt's are widely used for the opposite.

sentences:
LibGDX how to remove PointLight that is attached a destroyed Body I have this code:

@Override
public void beginContact(Contact contact) {
    fa = contact.getFixtureA();
    fb = contact.getFixtureB();

    if (fa == null || fb == null) return;
    if (fa.getUserData() == null || fb.getUserData() == null) return;

    final Body toRemove = contact.getFixtureA().getBody().getType() == BodyDef.BodyType.StaticBody ?
            contact.getFixtureA().getBody() :
            contact.getFixtureB().getBody();
    Gdx.app.postRunnable(new Runnable() {
        @Override
        public void run () {
            world.destroyBody(toRemove);
        }
    });

}

It removes the FA body, but this body have a pointlight attached.
I want to remove this PointLight attached.
I have no idea how to do this :/.

sentences:
Content loading, Content processing and add processed file to a DataContainer? I'm trying to create some kind of editor in Windows Forms for XNA and I was wondering if there's anyway to do this:

Load content (known types, like Model/SpriteFont/Effect/Texture) through OpenFileDialog, then Process it to an *.xnb file and finally be able to add it to a datacontainer, so you can use it in an editor.

Is this possible, and since I only want to use known types that already have Importers/Processors - what is the best way to go about doing this?

Because for me, to just manually have to add content when later creating the game logic and having everything set up in the editor feels very static.

So simply put, I want to be able to load content and process it and later be able to store it so when I create a game using this I can add a DataContainer that I can change and add to in the editor as well as use in the game.

Doing Content.Load() 2000 times later in the game feels like a time waster.

sentences: DirectX11 bind all textures at once? If my game will use say 100mb of raw memory for textures, would it be a good idea to put all of them in srv array, bind once and leave it for the rest of the program so that I won't have to bind them ever again and thus save some processing power? I'm targeting gpus with at least 2gb of vram.

sentences:
Batches Count increase when applying GPU instancing I have camera across a very weird issue where my batches count significantly increase if I enable GPU instancing:
Before applying GPU instancing"

After Applying Gpu Instanching:

I have a pylon object where i am sharing the material with standar specular shader.

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:
Preventing the mouse from breaking keyboard navigation in UI? I am trying to achieve the following, a behavior like Windows Explorer where mouse and keyboard play nice together.

Here's a GIF along explanations:

first I click one of the folders using the mouse
second I click the background area, folder is not focused but still selected
third I move to the next folder below using the keyboard

To sum it up, mouse and keyboard play well together.

Now in Unity it's an entirely different story, here is a fairly simple menu created using the actions in Hierarchy context menu, nothing special:

Here's what happens:

I click one of the buttons using the mouse
I move down to the next button using the keyboard
I click in the blank area, button loses focus
I try to move down to the next button using the keyboard, nothing happens

I have tried a couple of things like disabling Raycast target on images, disabling background panels or making them opaque but without success.

How can one make Unity UI behave like Windows Explorer's one ?

(where clicking in the blank area with the mouse does not break keyboard navigation)

sentences:
Billboards offset for character names + rotation I am successfully using Matrix.CreateBillboard in my XNA game to print the characters name above the models. The problem I have is with the offset (to appear above the models). Currently, I am creating the location of the text using;

Vector3 objTextPosition = objPlayerShip.objShipVector + new Vector3(0, 3, 0);

This works fine if I stay within the same general lateral location. If I rotate above or below the model the text either appears on top of, or is covered by (or even below) the model. To compensate for this, I would need to create a rotation around the model (should I use a quaternion?) with the top always pointing up (with a Vector3(0, 3, 0) offset).

Am I over thinking this? Is there a simple way to achieve this?

Thanks in advance!

Here is the correct way (above the model)

Here is looking from top, down

sentences:
Estimate angle to launch missile, maths question I've been working on this for an hour or two now and my maths really isn't my strong suit which is definitely not a good thing for a game programmer but that shouldn't stop me enjoying a hobby surely?

After a few failed attempts I was hoping someone else out there could help so here's the situation.

I'm trying to implement a bit of faked intelligence when the A.I fires it's missiles at a target in a 2D game world. By predicting the likely position the target will be in given it's current velocity and the time it will take the missile to reach it's target. I created an image to demonstrate my thinking: http://i.imgur.com/SFmU3.png which also contains the logic I use for accelerating the missile after launch.

The ship that fires the missile can fire within a total of 40 degree angle, 20 either side of itself, but this could likely become variable.

My current attempt was to break the space between the two lines into segments which match the targets width. Then calculate the time it would take the missile to get to that location using the formula. So for each iteration of this we total up the values and that tells us the distance travelled, ad it would then just need compared to distance to the segment.

startVelocity * ((startVelocity * acceleration)^(currentframe-1)

So for example. If we start at a velocity of 1f/frame with an acceleration of 0.1f the formula, at frame 4, would be

1 * (1.1^3) = 1.331

But I quickly realized I was getting lost when trying to put this into practice.

Does this seem like a correct starting point or am I going completely the wrong way about it?

Any pointers would help me greatly. Maths really isn't my strong suit so I get easily lost in these matters and don't even really know a good phrase to search for with this.

So I guess in summary my question is more about the correct way to approach this problem and any additional code samples on top of that would be great but I'm not averse to working out the complete code from helpful pointers.

sentences:
How to make a gameObject follow non trivial trajectories? as the title of the question says, I was wondering if there is common method to make gameObjects e.g. enemies or bullets follow curvilinear trajectories before reaching their target. For instance, assuming to be talking about a top-down 2D game, there are multiple ways to make an gameobject, say an enemy follow a straight line like this to go hit the player:

But how to make it so that before reaching the player it would do something like this?

Does somebody have an idea?

I know that the question may sound not too specific, therefore for sake of argument, how could I make so that a bullet shot from an enemy follows an arch "à la Wanted" before hitting the player instead of just flying straight?

sentences: camera.render reads a file in the middle of a gameplay Why does camera.render read a file in the middle of a gameplay? This causes a lag in my game:

sentences:
How to extract data from a resource compiler script in c# I need to know how to extract all data from a resource compiler script to a folder or the desktop.

the .res files are compiled and added to an exe file.

.res is the file extension.

and if that is possible I need to know how to re-pack the data after it's been changed.

The shorter answer I need to extract the data from a resource compiler script aka ".res" and then after data changed re-pack the data back into the ".res" file.

sentences:
How would a game-state snapshot system be implemented for networked real-time games? I want to create a simple client-server real-time multiplayer game as a project for my networking class.

I've read a lot about real-time multiplayer network models and I understand the relationships between the client and the server and lag-compensation techniques.

What I want to do is something similar to the Quake 3 network model: basically, the server stores a snapshot of the whole game state; upon receiving input from the clients, the server creates a new snapshot reflecting the changes. Then, it calculates the differences between the new snapshot and the last one and sends them to the clients, so that they can be in sync.

This approach seems really solid to me - if the client and server have a stable connection, only the minimal necessary amount of data will be sent to keep them in sync. If the client gets out of sync, a full snapshot can be requested as well.

I cannot, however, find a good way to implement the snapshot system. I find it really hard to move away from single-player programming architecture and think about how I could store the game state in such a way that:

All the data is separated from the logic
Differences can be calculated between snapshot of game states
Game entities can be still easily manipulated via code

How is a snapshot class implemented? How are the entities and their data stored? Does every client entity have an ID that matches an ID on the server?

How are snapshot differences calculated?

In general: how would a game-state snapshot system be implemented?

sentences:
What use does the unary & operator have in this piece of C++ code? In an example for a little game framework (that does work), there are the lines:

ID3D10Device* device;
ID3D10Buffer* pBuffer;

followed by the line

 device()->CreateBuffer(&bd, NULL, &pBuffer());

The third argument requires a pointer, so why do you need to put an ampersand before pBuffer? an ampersand gets a memory address right? But pBuffer is already a pointer so what does the ampersand do to it?

sentences:
Help with OnTriggerEntered + Canvas UI This seems like it should be incredibly easy and I know there are other posts out there with a similar title, but I promise you I have looked at all of them. All I want is for my canvas that simply says "you win" to appear when I enter an invisible box collider that I have . My canvas is by default set to disabled.

public class YouWin : MonoBehaviour {
public Canvas myCanvas;

private void Start()
{
    myCanvas = GetComponent<Canvas>();

}

void OnTriggerEnter (Collision Collider)
{
    {
        myCanvas.gameObject.SetActive(true);
    }
}

This script seems incredibly simple and straightforward, but for whatever reason, when I enter my box, nothing at all happens. Why might this be? What am I missing?

As per an answer I also tried

public class YouWin : MonoBehaviour {
public GameObject canvas;

void OnTriggerEnter (Collider Collider)
{
    {
        canvas.gameObject.SetActive(true);
    }
}

But had no luck with this either. I've been tinkering to no avail, can you please give me some suggestions?

sentences:
Loading .PNG file and using it for UnityEngine.UI.Image Have an Unity UI Image.

I want to load a .PNG file that is in my persistent data path and use it as the sprite source for the UI Image. Code:

    byte[] bytes = File.ReadAllBytes(Application.persistentDataPath + "/sprite.png");
    Texture2D texture = new Texture2D(width, height);
    texture.filterMode = FilterMode.Trilinear;
    texture.LoadImage(bytes);
    Sprite sprite = Sprite.Create(texture, new Rect(0,0,width, height), new Vector2(0.5f,0.0f), 1.0f);

    myObject.GetComponent<UnityEngine.UI.Image> ().sprite = sprite;

This almost works. Only a portion of the image is displayed.

The initial guess would be that I didn't load the image properly. However, if you use a SpriteRenderer instead of UnityEngine.UI.Image like

    myObject.GetComponent<SpriteRenderer>().sprite = sprite;

The image is displayed in full. So this seems to be a problem with UnityEngine.UI.Image specifically...

... However, if you drag an image from the editor into the Sprite Source property of UnityEngine.UI.Image, then such image is displayed in full - then suggesting that there is something wrong with the way I load my image bytes.

What should I do?

Edit: If you set the image type to Tiled, you can see that it tiles with the full image... So apparently the UI Image component DOES have all the image data but for some reason it won't render all of it.

sentences:
What's the right way to re-use open source game assets? This is a hypothetical question, but one I always wanted to know about.  Suppose I wanted to create a game in the same fantasy style as Battle for Wesnoth.  Having no arts skills myself, I could write the code for the game engine and borrow (steal?) their artwork and use it myself.  IIRC, their stuff is licensed under the LGPL, so if my game were LGPL'ed I should be fine legally.

My question is: just because I can do that, should I?  What's the expected procedure for borrowing some other game's art assets?  Do I need to formally ask permission first?

Obviously I would credit their work before making anything public.

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:
OBB vs OBB Collision Detection Say you have two Bounding Box Objects each of them storing the current vertices of the box in a vector with all the vertices of the object rotated and translated relative to a common axis.

Here is an image to illustrate my problem:

How can I work out if the two OBB's are overlapping any links to help explain the solution to the problem would be welcome. Nothing too convoluted please...

sentences:
How to smooth hand drawn lines? So I am using Kinect with Unity.

With the Kinect, we detect a hand gesture and when it is active we draw a line on the screen that follows where ever the hand is going. Every update the location is stored as the newest (and last) point in a line. However the lines can often look very choppy.

Here is a general picture that shows what I want to achieve:

With the red being the original line, and the purple being the new smoothed line. If the user suddenly stops and turns direction, we think we want it to not exactly do that but instead have a rapid turn or a loop.

My current solution is using Cubic Bezier, and only using points that are X distance away from each other (with Y points being placed between the two points using Cubic Bezier). However there are two problems with this, amongst others:

1) It often doesn't preserve the curves to the distance outwards the user drew them, for example if the user suddenly stop a line and reverse the direction there is a pretty good chance the line won't extend to point where the user reversed the direction.

2) There is also a chance that the selected "good" point is actually a "bad" random jump point.

So I've thought about other solutions. One including limiting the max angle between points (with 0 degrees being a straight line). However if the point has an angle beyond the limit the math behind lowering the angle while still following the drawn line as best possible seems complicated. But maybe it's not. Either way I'm not sure what to do and looking for help.

Keep in mind this needs to be done in real time as the user is drawing the line.

sentences: How to continue Lego microgame tutorial? I was passing Lego microgame tutorial. I closed it and quit Unity. Now, how can I continue it from the same place? If I opening it's project, I am getting just silent Unity project, without any guidance.

sentences: Fill with Transparency in Built-In Sprite Editor When I imported an image for a sprite, I realized it had a white background. I went into the built-in sprite editor to remove it. I tried using fill as there was a transparent color in the color selector. It did not work. Is there a way to do this, or an easier way than erasing it all by hand?

sentences:
Using an object as a model to avoid too many parameters - XNA/C# I have 3 classes(Skill,Projectile and Status),Skill has Projectile and Projectile has Status, all of them need to read information from a txt and to avoid open it everytime I want to create an object I want to read all the txt on Skill and pass the information Projectile need as arguments and then on Projectile create Status passing the information needed as arguments too

As Projectile going to create a lot of Status objects it need to receive Projectile's informations and Status's informations from Skill, to avoid too many parameters can I create a Status object on Skill and pass it to Projectile and everytime I need to create another status I use the first one as a model?

As example:

 public class Skill
{
  String skillName,projectileName,statusName;
  int    skillNumber,projectileNumber,statusNumber;
  public Skill(){
      //Code to read txt and fill variables

      //What is happening
      Projectile projec = new Projectile(projectileName,statusName,projectileNumber,statusNumber);

      //To avoid above
      Status status = new Status(statusName,statusNumber);
      Projectile projec = new Projectile(projectileName,projectileNumber,status);

  }
}

And then at Projectile

public class Projectile
{
  //Constructor,variables and methods

  //Method that create Status
   public void Update(){
         if(hitEntity){
          //this status was received from Skills
          Status tempStatus = new Status(status.statusName,status.statusNumber);
          }
   }
}

sentences:
How could I make the player's movement more responsive? I am working on an Air Hockey game;
I tried making the movement physics-based, by doing this:
using UnityEngine;

public class Player : MonoBehaviour
{
    private Rigidbody m_Rigidbody;

    private float HorizontalInput;
    private float VerticalInput;

    public float Speed = 1.0f;

    private void Start()
    {
        m_Rigidbody = GetComponent<Rigidbody>();
    }

    private void Update()
    {
        HorizontalInput = Input.GetAxisRaw("Horizontal");
        VerticalInput = Input.GetAxisRaw("Vertical");
    }

    private void FixedUpdate()
    {
        m_Rigidbody.AddForce(new Vector3(VerticalInput * Speed, 0.0f, -HorizontalInput * Speed),ForceMode.VelocityChange);
    }
}

and by adding a PhysicsMaterial to the MeshCollider attached to my player:

The movement should be quick and responsive, but it feels rather sloppy and unresponsive; I also tried using Input.GetAxisRaw(...), but the controls become quite clunky.
How can I improve on this? Is there a go-to way to do this type of movement in Unity?
(I would like the final version of the game to be played on controllers)

sentences:
Limitation on irandom() of game maker? I have three objects. All of them in the create event contain an action each (execute a piece of code):

obj_r01 => r01=0;

obj_r02 => r02=0;

obj_r03 => r03=0;

Image (to clarify what I have tried to explain):

So far so good, but I have one more object that modifies the variables of these other three: obj_control

The obj_control contains two events: create and draw.

crete event (obj_control):

obj_r01.r01=irandom(9);
obj_r02.r02=irandom(9);
obj_r03.r03=irandom(9);

draw event (obj_control):

This event contains three actions, precisely three "execute a piece of code":

piece one:

draw_text(x,y,obj_r01.r01); => applies to obj_r01

piece two:

draw_text(x,y,obj_r02.r02); => applies to obj_r02

piece three:

draw_text(x,y,obj_r03.r03); => applies to obj_r03

The objects are arranged as follows in the room:

In execution this is what happens:

The value of r01 is randomized, but that of r02 and r03 is not. I also tried to modify the obj_control creation event code to:

randomize();
obj_r01.r01=irandom(9);
randomize();
obj_r02.r02=irandom(9);
randomize();
obj_r03.r03=irandom(9);

However the result does not change. With this I could only suspect that the irandom () function can only create a storable random value, would it solve such a problem?

EDIT 1:

I tried putting randomize() only at the beginning of the code as suggested to me by @Philipp and @DH.:

randomize();
obj_r01.r01=irandom(9);
obj_r02.r02=irandom(9);
obj_r03.r03=irandom(9);

But there was no change in the result.

I also did a test to be sure if the value was not even being randomized or if the values of r02 and r03 were being randomized to 0 and for that I modified their values in the creation of each object:

In obj_r02:

r02=10

In obj_r03:

r03=100

The result:

The first value (not surprisingly) was randomized, but the second and third values were not. Thus it is clear that the randomization is not being made or that the draw event is occurring before the radomization of r02 and r03.

sentences:
2D open world MMORPG; big map memory problem I am developing an 2d open world mmorpg game for learning purposes, and have a issue with big maps.
A year ago i developed 2d open world single player / co-op game. It saved map in chunks, and AI for NPCs starts 'ticking' when specified map chunk is loaded.
In my mmorpg game, NPCs AI is handled by server, and its always 'ticking' in some specified interval. That is where my troubles begin. I want NPC to walk in random directions. For this to work, I have to check map collision for every step, so my NPC wouldn't end up in wall. Problem is when I have big map, for example 10000x10000, and every tile is represented with 6 bytes, that is about 572MB of map data my server must hold in memory all the time, and i cant load just few map chunks, like in my single player RPG because of lot NPCs AI needs to be updated all the time, even if player is not located near by.
My goal is to archive map size of 50000x50000 tiles. I know its possible because i seen 2d mmorpgs with huge open worlds, a lot bigger then 50000x50000, and I doubt that their server have 20GB of ram to waste just on maps.
If anyone have any ideas how I can lower memory usage, I woud like to hear you.

Thanks in advance, and sorry for my bad english

sentences:
Randomly instantiate avoiding overlapping in Unity 5 I'm starting a 2D game where I want all the letters A-Z displayed in a random position and, then, the player collects them all in the correct order.
I need to randomly instantiate the letters without overlapping. I use C#.

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:
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:
Downsides of using a 8192 x 8192 texture? So I am using Unity to build a 2D game and one thing that I needed is to be able to render a lot (talking about 10s of thousands) of sprite to the screen so I have a custom solution that basically is a single game object with a script that uses Graphics.DrawMesh() with pretty good results right now. Now I know another way to reduce draw calls is to have a few materials as possible (as I believe a single mesh can only use 1 material) so I was think about using a 8192 x 8192 texture as basically my main (maybe only texture) as with 64 x 64 sprites, I can fit a bit over 16000 sprites which should be more than enough for all the sprites in the game world).
My question is whether or not there is any major downside of using a texture of this size? I am sure there are decides and video cards that would not support this but I am curious as to what those are. Would current gen / next gen consoles support this? At what point would video card not support this? For the game I am working on mobile / VR is not a concern.
If this texture size would restrict support too much, what about 4096 x 4096?

sentences:
Help with off-game tasks I love writing video games for fun, and often do that.

I noticed, anyway, that most of the times implementing the gameplay itself doesn't take too much time to me (maybe because I already did that plenty times and know what and how to do for most of the things), but when I try to implement off-game stuff I get lost.

By off-game I mean what is not gameplay: menus, cutscenes between levels, world map to choose levels, saving and loading status, managing replays ... Only tried to write a few of these a few times, but always failed; that's why I never really completed and distributed a game.

Are these common problems? And where should I start to do this? Where could I find some books/guides about such stuff?

sentences:
Simultaneous line of sight for hundreds of individual agents on a grid? I have a large grid with hundreds of individual agents, each of which is moving around based on its own visual inputs and a fast control algorithm.

My question is: How can I efficiently provide each agent with a set of other agents (or walls) that they can see?

Ray casting from each individual works, but is slow.  It seems like I should be able to preprocess the world at each step to speed up this process since I'll be doing it MANY times, but I haven't been able to come up with an appropriate algorithm.  Is there some known trick that I've missed?

sentences:
Unity Animation Controller: Is the "atomic" attribute in 4.6.3 the same as the "has exit time" attribute in 5.0? I'm viewing a tutorial based on Unity 5.0. In this version, I see an option whose name is: Has Exit Time:

But on my Unity, version 4.6.3, I don't have this option. Instead I have an option called Atomic.

My guess is that these options mean the same thing. That is, if this box is checked, then the controller should finish playing this state before moving to a new state. But I'm not sure here. If my guess is wrong, which option is equivalent to Has Exit Time in Unity 4.6.3 ?

Thanks :)

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:
Bouncing projectile off of sprite, the sides work but top and bottom do not I'm having a problem bouncing a projectile off a sprite, we've been asked to move the projectile using the equations of motions which makes things a little more difficult but as far as I can see what I have should work.

What I'm trying to do is change the angle of the collided projectile depending on which direction it is coming from.

Here is a video that is hopefully not too laggy for you to see what is happening:

Link

When the projectile collides with the left or right hand side of the sprite everything works as expected, it just switches X direction.

When it hit's the top or bottom of the sprite however it doesn't change, it just sort of rolls along the top and the shoots off.

Here is the movement code:

float nX = get_x() + cos(nGetAngle() * 3.14 / 180) * getU() * getT();
float nY = get_y() - sin(nGetAngle() * 3.14 / 180) * getU() * getT() + 0.5 * 9.8 * getT() * getT();
set_world_position(nX, nY);

Where U is initial velocity, T is time and nGetAngle() is the angle in degrees (which is set to radians whenever the angle is set).

Here is my collision for the top of the player:

//if the projectile is colliding in any way with the player sprite

if (projectiles[currProj]->get_y() < player->get_y()) // top of player
{
    float vx = cos(projectiles[currProj]->nGetAngle());
    float vy = sin(projectiles[currProj]->nGetAngle());

    float newAngle = atan2(-vy, vx) * 180 / 3.14;

    projectiles[currProj]->nSetAngle(newAngle);
    projectiles[currProj]->set_world_position_y(player->get_y() - projectiles[currProj]->get_height() - 1);
}

and here is my collision for the left of the player:

else if (projectiles[currProj]->get_x() < player->get_x()) // left of player
{
    projectiles[currProj]->set_world_position_x(player->get_x() - projectiles[currProj]->get_width());

    float vx = cos(projectiles[currProj]->nGetAngle());
    float vy = sin(projectiles[currProj]->nGetAngle());

    float newAngle = atan2(vy, -vx) * 180 / 3.14;

    projectiles[currProj]->nSetAngle(newAngle);
}

The left side collision works, the top does not and I have no idea why.

If necessary I can post the entire project somewhere.

sentences:
Multiplayer Game - Node.js syncing other players' position I'm creating a multiplayer platformer game with 4 players in multiple rooms. I've read a lot of articles and researched about client prediction and lag compensations. I think I can somehow manage to understand how to update "my client". But what would be the best approach in the multiplayer platformer game to update "other clients". This is what I'm thinking:

Approach 1: the client sends input "left" to the server -> server increases the velocity of the player -> the server sends the actual input "left" of this client to all other clients -> other clients run the physics on the input.

Apporach 2: the client sends the input to the server -> server adds velocity, update state -> game loop in server updates the position of every single client back to everyone, sends it to all clients -> client gets it and updates.

What would be a better approach? or please if there is a better approach, tell me I am very stuck..

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 I translate a spherical coordinate to a Cartesian one? Could someone point me in the right direction as to how this might be achieved? 3D math / geometry often throws me.

I'm looking for something like this (ideally in C#):

public Vector3 getCartesianFor(float elevation, float asimuth, float polar)
{
   return ????;
}

sentences:
Game logic implemented using TPL / async / await, and performance of it I'm working on a game, and as a typical game (here using Monogame) it uses frame based approach, where all logic happens in Update() method called every frame.

As a consequence, any sequential logic of operation, like going from one level to another, moving some entity to a different place over time or having a bunch of entity movements happening one after another has to be implemented in some complicated way, using states and finite state machines to track what is where. I obviously can't do anything like this:

foreach (var level in Levels)
{
    while (!level.LevelCompleted)
    {
        level.ShowIntroduction();
        WaitForClick();

        level.ShowMapOverview();
        WaitForClick();

        level.Run();

        level.ShowResult();
        WaitForClick();
    }
}

(might be little dumb example, but you get what I mean)

This while and foreach would block everything. But the thing is, it is very often the best way to describe the algorithm behind, way better than state machines, and these algorithms do get complicated sometimes.

And I just learned a lot about TPL recently and WOOOOOWW, what a great thing it is. Now I can do this. I tested this already both for simple few second actions of moving things in a game, as well as for complete control of scenes and intermissions, where one async method takes minutes or even hours. It can look like this:

foreach (var level in Levels)
{
    while (!level.LevelCompleted)
    {
        level.ShowIntroduction();
        await WaitClickAsync();

        level.ShowMapOverview();
        await WaitClickAsync();

        await level.RunAsync();

        level.ShowResult();
        await WaitClickAsync();
    }
}

To make this work, I have some AsyncManager, which allows me to wait for next frame, like this:

private async Task WaitClickAsync()
{
    while (true)
    {
        await asyncManager.WaitNextFrameAsync();

        if (World.Keyboard.JustPressed.Contains(Keys.Space))
            return;
    }
}

This thing await asyncManager.WaitNextFrameAsync() is used to break the execution of a method and continue it at the next frame. This makes it very easy to make code like above, or to make movement of entities etc. All other stuff in Update() still works, things gets rendered, and all is done without using any additional threads.

Of course in reality it needs to be more complicated than this, to support cancellation of these async methods, but TPL seems to have good support for this.

So first of all I wanted to share it with. And then ask the following, before I start modifying all of my game logic to use TPL:

am I not going in trouble using it everywhere in my game? I'm not really sure if TPL designers really thought about using it for such scenarios, and have those methods run for hours. Any cons?
what could the price in terms of performance be, if anything significant? Am I going to get some problem here?

sentences:
Character blocking when walking on cube edges I have my character walking on a ground made of cube. (scale 1,1,1). There is no space between them.  Also, I have a RigidBody with 15 drag and I'm moving with AddForce.

When I walk, my character sometimes block when trying to pass over the place where the 2 box meet. Like if my player collider was hitting the collider under him. Any fix for that?

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:
Algorithm for sensing mouse movements like a wiimote I want to make a driving game where you can do tricks with your mouse when you hold down LMB. Ex. if you move it up in a straight line really fast (your cursor goes from the bottom to the top of the screen in, say, 0.1s),  your bike will do a flip. If you do a quick circular movement, your bike will spin. Essentially, drawing a shape onto the screen = performing a move.
How would this be sensed? Currently, I can only think of having shapes defined by coordinates relative to some starting position (it would be some function taking in your mouse down coords), and within a certain time frame, every update loop will check to see if the current mouse coordinate pair is between the current preset one and the next preset one (and within a margin of error). To know which shape to use, you'd loop through the shape list, see whether or not the mouse coord is invalid for the current shape, and knock it off the possibilities if true.
Example circle path:

X = Coordinate
Red arrows = Expected mouse movement path
Green = Margin of Error

Problems I can see with this algorithm right now:

If I have a lot of moves, then there are a lot of shapes to loop through every frame before the deduction process kicks in
It's not an optimal solution for doing consecutive moves in a short timespan, because the player would have to release LMB before pressing it down again for the system to sense that a new shape is starting
Tiny circles vs big circles, how wide the margin of error would need to be to allow for both, and how that would affect calculations (clashing with other shapes that have similar valid spaces)
What if you draw circles like flattened, diagonally skewed ovals, even when you're not trying to do it fast? It is indeed a circular motion, but maybe diagonally skewed ovals are for another move. Is it okay to just shun your artistic ability?
How much time will it take before the system recognizes that you're doing a specific move? Must a full circle be completed before any bike spinning occurs?

What would be a better algorithm?

sentences: How do I manually create a .atlas file? I am trying to learn Andengine, and it seems it does not support sprites in any other way other thab a Texture Atlas. I am using the Android AIDE app and importing the older Andengine .JAR because I dont have a laptop and dont plan on forking up $250-400 for one when I can get a quad core android for $100 flat. I want to make a simple .ATLAS file but dont know how. Does anyone else here know how to solve my problem?

sentences:
Programmatically Modifying Images to Create Morning, Sunrise/Sunset and Night-Time Modes I'm using RPG-Maker-XP-like sprites (any 2D adventure/RPG style sprites). I would like to tint them so that they look different at different times of day.

Times of the day are the set of:

Daytime (normal)
Early morning (bluish?)
Sunrise and Sunset (orangish?)
Night time (dark)

What do I need to do to tint them, and make them look good, during different times of the day? Are there any "known" formulas for any of these times, like "delete the green blue component and tint heavily red+green for a sunrise effect"?

Ideally, I have just the original sprites, with no additional information or images (like spot-highlights or shadows separated out).

Finally, I'm using Silverlight/FlatRedBall for this, so I do have access to per-pixel information, as well as RGB tinting (adding, subtracting, multiplying, etc.)

sentences:
3DS Max MassFX -- Animation to XNA without bones/skins? I made a model in which a number of cobble stones fall into a hole using the rigid bodies in 3DS Max 2012 MassFX. They are just editable polys, no skin, no bone. I want this to play (Take 001, 0-100 frames) when the game loads the mesh. I haven't found a way to get to the animation though.

Does anyone have suggestions? All the tutorials for animated skinned models don't seem to work with a model set up like this? Do I really need to give each of 145 rocks a bone? If so, does anyone have a suggestion how to streamline that, or if there is an alternate solution to achieving this effect? The animation only needs to play once when the game starts, and that's it.

Thanks.

sentences:
Where to put graphic representation of game entity? I am working on simple 3D version of Snake game. I created classes like snake and grid so far. My concern is, putting all render logic (draws cubes - to show snake, and lines to show the grid) in above class could obscure the "pure" logic which should be divided from "view" layer.

So my question is, how to handle the whole render layer, separately from entity objects?

My current idea is to add object of "renderer" to each class which will encapsulate whole canvas work inside. There will be also master-renderer always looking for renderer inside all entities.

PS. I use JavaScript and Three.js

sentences:
Crate destroy when in trigger and button E pressed There are no errors in the console but I feel like im doing something wrong. The crate is not destroying when I click E.
public class CrateDestroy : MonoBehaviour
{
    public GameObject crate;

    void OnTriggerStay2D(Collider2D other)
    {
        if (other.CompareTag("Player"))
        {
            if (Input.GetKeyDown(KeyCode.E))
            {
                Destroy(crate);
            }
        }
    }
}

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:
Why is my sprite leaving copies as it moves in Monogame? I am pretty new to Monogame, and I'm trying to draw a character sprite and move it using keyboard. Instead of moving to different positions, it leaves a track of copies along the way.

I have 2 game states; one is the menu, and the other one is the level, where the sprite is called to draw.

Why is my sprite leaving copies as it moves in Monogame?

Player.cs

class Player : Entity
{
    private float velocity;
    private int hp;
    public Texture2D texture;
    public Rectangle hitbox;
    public Vector2 pos;
    KeyboardState oldState;

    public void Init(ContentManager content)
    {
        texture = content.Load<Texture2D>("char");
        hitbox.Width = texture.Width;
        hitbox.Height = texture.Height;
        velocity = 150f;
        pos.X = 100;
        pos.Y = 100;
    }

    public void Update(float delta)
    {
        KeyboardState newState = Keyboard.GetState();

        if (newState.IsKeyDown(Keys.D))
            pos.X += 100 * delta;
        if (newState.IsKeyDown(Keys.A))
            pos.X -= 100 * delta;

        oldState = newState;
    }

    public void Draw(SpriteBatch sb)
    {
        sb.Begin();
        sb.Draw(texture, pos, Color.White);
        sb.End();
    }
}

Level1.cs

class Level1 : State
{
    private Texture2D background;
    public Player player;

    public void Init(ContentManager content)
    {
        //background = content.Load<Texture2D>("Level1/bg");
        player = new Player();
        player.Init(content);
    }

    public void Update(float delta)
    {
        player.Update(delta);
    }

    public void Draw(SpriteBatch sb, GraphicsDeviceManager graphics)
    {
        player.Draw(sb);
    }
}

Game1.cs

public class Game1 : Game
{
    GraphicsDeviceManager graphics;
    SpriteBatch spriteBatch;
    State CurrentState;
    KeyboardState oldState;

    public Game1()
    {
        graphics = new GraphicsDeviceManager(this);
        Content.RootDirectory = "Content";
    }

    void SetState(State state)
    {
        GraphicsDevice.Clear(Color.White);
        CurrentState = state;
        CurrentState.Init(Content);
    }

    protected override void Initialize()
    {
        SetState(new MenuState());
        graphics.PreferredBackBufferWidth = 1920;
        graphics.PreferredBackBufferHeight = 1080;
        graphics.IsFullScreen = true;
        graphics.ApplyChanges();
        base.Initialize();
    }

    protected override void LoadContent()
    {
        spriteBatch = new SpriteBatch(GraphicsDevice);
    }

    protected override void Update(GameTime gameTime)
    {
        KeyboardState newState = Keyboard.GetState();

        var delta = (float)gameTime.ElapsedGameTime.TotalSeconds;

        CurrentState.Update(delta);

        if (CurrentState is MenuState && (newState.IsKeyDown(Keys.F)
            && oldState.IsKeyUp(Keys.F)))
        {
            SetState(new Level1());
        }

        if (CurrentState is MenuState && (newState.IsKeyDown(Keys.Escape)
            && oldState.IsKeyUp(Keys.Escape)))
        {
            this.Exit();
        }

        if (CurrentState is Level1 && (newState.IsKeyDown(Keys.Escape)
            && oldState.IsKeyUp(Keys.Escape)))
        {
            this.Exit();
        }

        base.Update(gameTime);
        oldState = newState;
    }

    protected override void Draw(GameTime gameTime)
    {
        CurrentState.Draw(spriteBatch, graphics);
    }
}

sentences:
OpenGL ES - render to texture - how to preserve original depth buffer I render to texture and attach my own depth buffer that has texture target. However, after I finish rendering I would like to set original depth buffer back.
To start rendering to texture I do:
glGetIntegerv(GL_RENDERBUFFER_BINDING, &bindedDepthBuffer); //returns 0
glGetIntegerv(GL_FRAMEBUFFER_BINDING, &bindedFrameBuffer);  //returns 0

glBindFramebuffer(GL_FRAMEBUFFER, rttFboId);
glBindRenderbuffer(GL_RENDERBUFFER, rttDepthId);
glViewport(0, 0, rttViewPortWidth, rttViewPortHeight);

... render scene

glViewport(0, 0, origWidth, origHeight);
glBindFramebuffer(GL_FRAMEBUFFER, bindedFrameBuffer);

Now after I do:
glBindRenderbuffer(GL_RENDERBUFFER, bindedDepthBuffer);

the original depth buffer stops working and it seems as its content is empty (everything that is rendered after this point behave like the depth buffer has been cleared). This problem occurs only on some OpenGL ES devices with Android and I dont know what can cause this.

sentences:
Html5 games, what is the standard dimension to use? I am trying to make html5 games to be played on the browser(not offline apps), and I am trying to support the maximum number of platforms, hence I need to know what dimension should I use for the game canvas so that it works in the most number of places.

Also is there anyway to "scale" a large game to fit in the tiny size of iphone(around 320x356px I think). By "scale" I don't mean to actually resize just the canvas, as because that can mess up the coordinate based calculations, and for a large number of objects, re-positioning based on canvas size can be a real hassle.

sentences:
Dynamic VBO update possibly corrupting data? I want to draw a line between two vertices.  On a mouseclick the vertex data will change and I want to update the line to use the new values.  I am using a VBO for this and it looks like the update process is somehow corrupting the VBO data.  The line is not drawing in a direction that I would expect given the values of the vertices.

There are four lines in total and I am updating only the last two vertices.  The vertex data is initialized as:

      float[] vertLineBuffer = {
          1.0f,0.0f,0.0f,//right
          0.0f,1.0f,0.0f,//top
          0.0f,0.0f,0.0f, //center
          -1.0f,0.0f,0.0f, //START
          0.0f,-1.0f,0.0f //END
            };

The init routine:

  public void setLineVBOs(GL4 gl)  throws Exception {

      vboLineHandles = new int[2];
      gl.glGenBuffers(2, vboLineHandles, 0);

      //populate the position buffer
      FloatBuffer fbData = Buffers.newDirectFloatBuffer(vertLineBuffer);
      gl.glBindBuffer(GL4.GL_ARRAY_BUFFER, vboLineHandles[VERTICES_LINE_IDX]); //the vertex data
      gl.glBufferData(GL4.GL_ARRAY_BUFFER, fbData.capacity() * 4,
              fbData, GL4.GL_STATIC_DRAW);
      fbData.clear(); //don't need this anymore

      //populate the color buffer
      FloatBuffer fbColor = Buffers.newDirectFloatBuffer(vertLineColor);
      gl.glBindBuffer(GL4.GL_ARRAY_BUFFER, vboLineHandles[VERTICES_LINECOLOR_IDX]); //the vertex data
      gl.glBufferData(GL4.GL_ARRAY_BUFFER, fbColor.capacity() * 4,
              fbColor, GL4.GL_STATIC_DRAW);
      fbColor.clear(); //don't need this anymore

      //set vertex array index
      IntBuffer intBuffer = BufferUtil.newIntBuffer(1);
      gl.glGenVertexArrays(1, intBuffer);
      iLineVao = intBuffer.get(0);
      gl.glBindVertexArray(iLineVao);

      gl.glEnableVertexAttribArray(VERTICES_LINE_IDX);
      gl.glEnableVertexAttribArray(VERTICES_LINECOLOR_IDX);

      gl.glBindBuffer(GL4.GL_ARRAY_BUFFER, vboLineHandles[VERTICES_LINE_IDX]); //the vertex data
      // Associate Vertex attribute 1 with the last bound VBO
      gl.glVertexAttribPointer(0,3, GL2ES2.GL_FLOAT, false,0,0);

      //color
      gl.glBindBuffer(GL4.GL_ARRAY_BUFFER, vboLineHandles[VERTICES_LINECOLOR_IDX]); //the vertex data
      gl.glVertexAttribPointer(1,3, GL2ES2.GL_FLOAT, false,0,0);

  }

And then I attempt to update the VBO on an event (mouseclick) like this:

  public void updateLine(GL4 gl, float[] pos)
  {
      //pos contains the new vertex data
      vertLineBuffer[9] = pos[0];
      vertLineBuffer[10] = pos[1];
      vertLineBuffer[11] = pos[2];
      vertLineBuffer[12] = pos[3];
      vertLineBuffer[13] = pos[4];
      vertLineBuffer[14] = pos[5];

      FloatBuffer fbData = Buffers.newDirectFloatBuffer(vertLineBuffer);

      gl.glBufferSubData(GL4.GL_ARRAY_BUFFER, 0, fbData.capacity() * 4, fbData);
      gl.glBindBuffer(GL4.GL_ARRAY_BUFFER, vboLineHandles[VERTICES_LINE_IDX]);

      fbData.clear();

  }

The vertex shader:

#version 430

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

out vec3 Color;

void main(void) {
    Color = vertexColor;
    gl_Position = vec4(vertexPosition, 1.0);
}

The frag shader:

#version 430

in vec3 Color;

layout (location = 0) out vec4 FragColor;

void main(void) {

    FragColor = vec4(Color, 1.0);

}

Does this look right?  Can anyone see where this might damage the contents of the VBO?

sentences:
Marching cubes and LoD I have and octree based world constructed (on the start) via marching cubes with certain density function to make a terrain (variations on noises). The terrain is rater smooth, it is not like minecraft blocky terrain at all. The deepest level of LoD is 12 and on this level (let's say) player is moving. The player have an ability to place blocks (just like in minecraft) and dig holes (block-like) in terrain. The blocks are stored as an overrides to density function so that the rendering algorithm looks if there's an override for each point of the certain marching cube block, and if there is, it constructs solid block, or hole there. Pretty simple.

The question is, what technique of LoD do you recommend, when I move away from the certain place where I have put my blocks to sustain details on lower LoD levels as much as possible?

I can see two ways there:

Render the terrain separately on each LoD and custom geometry (blocks) leave as they are. What this means is that my terrain will contain all blocks I placed rendered on LoD 12 while the terrain will be on appropriate LoD. This will lead to resource drain because all my custom blocks need to be rendered with maximum detail not depending how close I am to them, but on the other hand my house I built will look as house from the distance.
Just interpolate weights when switching to lower LoD level. This will be fast, but it will change how my blocks look (or should I say it will change a lot how looks whole my construction) drammatically - if I make a house from blocks and move away, my house won't look as house anymore.

sentences:
Unity3D object fill shader I've been researching this for a while, and had no luck yet. I figured I'd ask here to see if anyone had any good ideas.

Essentially what I want is a shader that can make only part of an object transparent based on a slider. Similar to fill effects on 2D sprites, the object would fill from the bottom up, when the slider was set to 0 the whole object would be transparent, when it was set to 50 just the bottom half would be visible, and when it was set to 100 the whole object would be visible.

I've tried various masking effects, but it would be best if I could build this in to existing shaders or have a separate mask. Is there perhaps a way to adjust the alpha on individual pixels used for the diffuse texture without incurring great performance loss?

sentences:
How do I render a mirror or other reflective surfaces? I just wondered how to create a mirror within a 3D game?
My suggestion is/was to trace rays, hitting the "mirror" object then drawing a picture of a second cam onto the "mirror" object which is located at the original camera's mirror "point" by using the hit side of the mirror object as mirroring plane.

We would have to use the one ray coming from the center of the original camera to determine the point where the center of the vision is located on the mirror plane.

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:
How can I convert OBJ data into CSS3D transformations? I want to convert the data in a 3D .obj file (vertices, normals, faces) to CSS3D (width, height, rotateX,Y,Z and/or similar transforms).  I found a bunch of formulae and what-not, but 3D isn't my forte, so I don't know which I should use.

Essentially: How can I get the X/Y/Z-rotation of a 4-point plane from it's matrix of x,y,z coordinates?

For example, here are  2 simple planes in .obj format:

g plane1
# simple along along Z axis
v  0.0  0.0  0.0
v  0.0  0.0  1.0
v  0.0  1.0  1.0
v  0.0  1.0  0.0

g plane2
# plane rotated 90 degrees along Y-axis
v  0.0  0.0  0.0
v  0.0  1.0  0.0
v  1.0  1.0  0.0
v  1.0  0.0  0.0

f  1 2 3 4
f  5 6 7 8

I'd like to convert it into CSS:

#plane1 {
    width: X;
    height: Y;
    transform: rotateX(Xdeg) rotateY(Ydeg) rotateZ(Zdeg) translateZ(Zpx)
}

#plane2 {
    width: X;
    height: Y;
    transform: rotateX(Xdeg) rotateY(Ydeg) rotateZ(Zdeg) translateZ(Zpx)
}

/* Or equivalent, like using transform: matrix3d() */

sentences:
Which is the best LOD method for planet rendering? I'm currently working on my thesis, it is an engine to render terrains of planetary size.

I'm still finishing my research and I have encountered a lot of stuff about this subject, the problem is that I can't decide on which Level of Detail (LOD) method I should use.

I know about geomipmapping, geometry clipmaps (GPU) and chunked LOD by Ulrich that work good on large terrains and can be used to render 6 faces of a cube and then "spherify" the cube by this method and I understand how to implement all of these methods on GPU using C++/OpenGL/GLSL (using methods like ROAM or any other method that doesn't use a cube is out of my reach because of texturing is a pain). Also I recently got into a tutorial of rendering terrains using tessellation shaders here

So, I don't have the time to implement ALL the methods and see which one is the best and more suitable for a planetary scale and I'm asking here to see if someone has made this kind of comparison and help me decide which method should I implement and use (my tutor is kind of crazy and wants me to do something with an icosahedron, but I can't understand that method unless using ROAM)

Anyways, if you can help me decide or have any other suggestion or method I really will appreciate. One condition is that the method should be able to implement GPU side (at least most of it) to prevent CPU bottleneck.

Another request is that I know there are numerical problems about precision with floats when getting a lot of detail in the terrain, I don't know how to solve it, I read a solution in a forum but can't get to understand how to implement, I lost track of that thread and I would like to know how to solve this precision problem.

I'm currently reading about some matrix transformations to solve the float precision, z-fighting issues, frustum culling with dynamic z-values, and data representation for chunks (using patch space with floats and its position in the world coordinates as double) so I think I can solve the precision problem easily. I still need a comparison between LOD methods with your opinions and suggestions to decide which is better for this project. Take in count difficulty of implementation vs visual quality vs performance, I want the best.

Something I forgot to mention is that the generation is hybrid, I mean, I should be able to render the planet entirely using GPU (heights calculated on the fly) and/or using a base height-map image and add details with GPU (vertex shader). Texturing will be a side part I will trouble latter, right now I'm happy using just colors depending on the height, or maybe using some kind of noise texture generated on the fragment shader.

sentences:
Will my game engine be compatible with physics engines? My engine supports scene handling, cameras, and has a renderer. Also, it has a class called Drawable, which has the position, the shape and the picture of an object. The picture property has width, height, rotation and a draw method. All game objects are supposed to inherit from this Drawable class, and are added to the scene, along with a map (a collection of Tiles, that also inherit from Drawable), lights, and so on and so forth.

The shape property of a Drawable is a Polygon, a collection of user defined vertices around the position of a Drawable. This is a relative coordinate system, so [0, 0] is the position of the Drawable.

With this setup, will the users of my engine (which will probably only be me) still be able to integrate physics engines such as Box2DJS into their games?

sentences:
Box2d jetski on water At the moment I am trying to code a 2d game in java, where a jetski is riding on water. If you press on the screen the jetski should dive down and jump back up on release. How do I have to do this in Box2d? My idea was to put a rectangular body as the water and an other one as the jetski. Since I am new to box2d I don't really know how I should bring this into code.
I hope one of you can help.

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:
Can anyone explain step-by-step how the as3isolib depth-sorts isometric objects? The library manages to depth-sort correctly, even when using items of non-1x1 sizes. I took a look through the code but it's a big project to go through line by line!

There are some questions about the process such as:

How are the x, y, z values of each object defined? Are they the center points of the objects or something else?
I noticed that the IBounds defines the bounds of the object. If you were to visualise a cuboid of 40, 40, 90 in size, where would each of the IBounds metrics be?

I would like to know how as3isolib achieves this although I would also be happy with a generalised pseudo-code version.

At present I have a system that works 90% of the time but in cases of objects that are along the same horizontal line, the depth is calculated as the same value.

The depth calculation currently works like this:

x = object horizontal center point
y = object vertical center point

originX and Y = the origin point relative to the object so if you want the origin to be the center, the value would be originX = 0.5, originY = 0.5. If you wanted the origin to be vertical center, horizontal far right of the object it would be originX = 1.0, originY = 0.5. The origin adjusts the position that the object is transformed from.

AABB_width = The bounding box width.
AABB_height = The bounding box height.

depth = x + (AABB_width * originX) + y + (AABB_height * originY) - z;

This generates the same depth for all objects along the same horizontal x.

sentences:
Why transform.Rotate(X,0,Z) rotates also Y? In my game I'm trying to rotate a turret.
I'm using the classic pattern:

float h = Input.GetAxis ("Horizontal");
float v = Input.GetAxis ("Vertical");

if (h != 0 || v!=0)
    rb.transform.Rotate (new Vector3(v, 0, h));

The problem is that if I move in vertical axis also Y axis rotates. Why?

How can I achieve a rotation that rotates only the X and Z axis and not the Y axis?

sentences:
What do html5 game buyers/sponsors do with the game? I understand there are html5 devs who make contracts with companies: they allow them to use their games for payment.

My question is how do these companies use these games to their benefit: what purposes do they have in forming these contracts and how does "buying" html5 games helps them accomplish it?

For example, if their purpose is generate money, how do they employ the html5 games for this goal?

sentences:
How would you recommend I get started with ActionScript 3? I wanted to make Flash games so I bought the book "Flash Games Development with AS3." I did the 'hello, world' program by trace and addChild (or something like that). But the problem was, instead of understanding what I was writing, I was just copying and pasting those lines of code. I felt it wouldn't work that way, and as the book had asked the learners to know at least some Java/Javascript, C#/C++, I didn't go any further.

Now, I want to start again (and yes, I still don't know Java or C programming). What would you recommend for me?

Thanks :)

sentences:
GUI scaling: Viewport-based scaling or individual logic I want to use scene2d for creating a GUI for a libGDX game. In scene2d all sizes are provided in pixel units (instead of percentages). So I wonder what is the best approach to deal with different screen resolutions? Two solutions came into my mind and I wonder how to proceed:

Use a fixed resolution for the GUI (e.g. 1920x1080), optimize all widgets for this size and let the viewport do the rest (so there will be super- or subsampling)
or write a resizing logic for the gui to properly adapt the widget sizes and positions to the screen's resolution

Is there any known best practice how to deal with this problem?

sentences:
Design pattern for world objects caching I'm developing in Unity a voxel-generated terrain and I'm trying to find an extensible design pattern for voxels and more in general, world objects caching. E.g. storing in a 'ChunkCache' class only the nearest Chunks and updating it after a set amount of time

As of now, I'm using a static World class with the following members in pseudocode

static class World
   Player reference
   Enemies reference
   WorldCache reference
   etc.

The WorldCache instance contains a list of objects all deriving from the same base class 'Cache'. The implementation so far calls worldCache.update() method with an enum indexing this list of 'Cache' objects

WorldCache class
   List<Cache> differentTypesOfCache;

   void update(Enum whichCache) {
      differentTypesOfCache[whichCache].update();
   }

The problem I'm facing with this design pattern is different types of derived Cache classes need different types of information (e.g. a ChunkCache class will judge wether a chunk needs to be removed from the cache depending on the player's distance from the center of the chunk, whereas other types of derived Caches may need differing information) and as of now the only way to gather this information is to directly query the static World class members.

Also if a certain Cache object requires information from another Cache object, it starts to look spaghetti.

Is there a completely different pattern better suited for this scenario, or a way to modify the existing one for the better?

sentences:
How to flip a rectangle I'm curently working on a system that make the player character look towards the mouse pointer.
My system is effective but i'm having an issue while displaying the rectangle.

In the Following code i test the mouse position by translating it in the world and then i test if the world pos of the mouse is greater than the position of the player or not. if the mouse is on left side of the boundary, the player will rotate to look at it. To make the rotation, i put the X coordinate on the other side of the position and i make the width negative. THis normaly should emulate the rotation. but my rectangle does not shows up.

Point MousePos = Vector2.Transform(Mouse.GetState().Position.ToVector2(), Matrix.Invert(Camera.GetViewMatrix())).ToPoint;
if (MousePos.X > Position.ToPoint().X)
{
    EntityDisplayRectangle.X = Position.ToPoint().X - (int)EntitySize.X * (int)TileSize.X * _displayResizeFactor / 2;

    EntityDisplayRectangle.Width = (int)EntitySize.X * (int)TileSize.X * _displayResizeFactor;
}else{
    EntityDisplayRectangle.X = Position.ToPoint().X + (int)EntitySize.X * (int)TileSize.X * _displayResizeFactor / 2;

    EntityDisplayRectangle.Width = -((int)EntitySize.X * (int)TileSize.X * _displayResizeFactor);
}
EntityDisplayRectangle.Y = (int)Position.Y - ((int)EntitySize.Y + 1);

here is two screenshots of what i curently have:

the red dot is a point drawn by this line

spriteBatch.DrawPoint(new Vector2(getEntityDisplayRectangle().X, getEntityDisplayRectangle().Y), Color.Red, 3);

So, is there an other way to do or is it even possible?

The player texture is from a tileSet and i use a source rectangle to pick the correct image from it

here is the code that draws the player:

spriteBatch.Draw(TileSet, EntityDisplayRectangle, TileSetOffsetRectangle, Color.White);

Up:

here is the rectangle drawn with a draw rectangle

Note: the red box is the collision box. it's showwn just for debug purpose

it seems that the rectangle struggle to exist when it's width is negative.

sentences:
How to fix this elbow issue when converting to humanoid Good day, how can I fix this? it looks fine in Blender and generic but not when I switch to humanoid. There is no error on rig tab but there are in animation tab under the import message that say "is in between humanoid transforms and has rotation animation that will be discarded" and I can't seem to fix it.
Here are the things I've tried so far:

Put the right bones to the right slots.

Enforce T-pose.

Translation DoF.

Clicked Generate Retargeting and applied it.

sentences:
Manipulating a free camera I have a camera class in my code which stores two 4x4 matrices. One for the view matrix and one for the projection matrix. Originally, I had two floats in the class for pitch and yaw and these were updated based on keyboard and mouse input. Then on update I would do something like this to set the view matrix:

Matrix33 xRot = Matrix33::CreateRotationX(m_pitch);
Matrix33 yRot = Matrix33::CreateRotationY(m_yaw);

Matrix33 rot = xRot * yRot;

const Vector3& rUp = rot.GetColumn1();
const Vector3& rForward = rot.GetColumn2();

m_viewMatrix = Matrix44::CreateLookAt(m_position, m_position + rForward, rUp);

However, I'm now wanting to add roll to the equation but I know that if I carry on using this method I'm going to run into gimbal lock. I do have a function in my maths library to rotate about an arbitrary axis. The function definition is:

static Matrix33 CreateRotation(const Vector3 &rAxis, const float rad);

But I'm not sure, based on pitch/yaw/roll how to create the arbitrary axis to rotate around. This got me thinking that perhaps pitch/yaw/roll isn't the best way to be doing it so I thought I'd ask on here about what might be the best way? I don't even have to use CreateLookAt(), it just seemed easier at the time :)

I don't have a quaternion class yet but I could add one if that would be the best way. I think ideally I'd rather do it with just matrices for now, though.

Any help would be much appreciated.

sentences:
Finding Pixels within UV Coordinates I am building lightmaps for 3D models. My lightmap algorithm needs to determine which pixels( lumels ) within the lightmap texture fall within the boundary of a mesh face( triangle )...this process takes place for each mesh face...

I was using barycentric coordinate techniques to accomplish this task. It works for the most part...here is code:

bool PixelIsWithinBounds( const D3DXVECTOR2 &t0,
                            const D3DXVECTOR2 &t1,
                            const D3DXVECTOR2 &t2,
                            const D3DXVECTOR2 &pUV )
{
    // compute vectors
    D3DXVECTOR2 v0 = t1 - t0,
        v1 = t2 - t0,
        v2 = pUV - t0;

    // do bounds test for each position
    float f00 = D3DXVec2Dot( &v0, &v0 );
    float f01 = D3DXVec2Dot( &v0, &v1 );
    float f11 = D3DXVec2Dot( &v1, &v1 );

    float f02 = D3DXVec2Dot( &v0, &v2 );
    float f12 = D3DXVec2Dot( &v1, &v2 );

    // Compute barycentric coordinates
    float invDenom = 1 / ( f00 * f11 - f01 * f01 );
    float fU = ( f11 * f02 - f01 * f12 ) * invDenom;
    float fV = ( f00 * f12 - f01 * f02 ) * invDenom;

    // Check if point is in triangle
    if( ( fU >= 0 ) && ( fV >= 0 ) && ( fU + fV <= 1 ) )
        return true;

    return false;
}

This function takes as input 3 UV coordinates( mesh face ) and a pixel UV coordinate. The problem with this method is that if the pixel is only partially covered by the face, the function returns false( because the pixel center does not ly within the triangle ). I could do overlap tests for each point on the triangle...I would like to know if there is a more efficient method...as this process takes place many times per generation of a lightmap...

...any ideas?

here is a screenshot showing the endpoint of a mesh face after lightmap generation...the corner of this face overlaps a pixel surface but doesn't overlap the pixel center...the algorithm left this pixel black( no light )...

EDIT: Shader code to dilate pixels

//--------------------------------------------------------------//
// Dilation Pass
//--------------------------------------------------------------//
PS_INPUT_Quad DilationPass_Vertex_Shader( VS_INPUT_Quad Input )
{
    PS_INPUT_Quad Output = ( PS_INPUT_Quad )0;

    Output.Position = mul( Input.Position, mOrtho );
    Output.UV = Input.UV;
    return Output;
}
float4 DilationPass_Pixel_Shader( PS_INPUT_Quad Input ) : COLOR0
{
    float4 vC = tex2D( g_SamplerLightMap, Input.UV );
    if( vC.w != 0 )
        return vC;

    int nValidPixels = 0;
    float4 vFinalColor = 0;
    for( int i = 0; i < 8; ++i )
    {
        float4 vNeighborColor = tex2D( g_SamplerLightMap, Input.UV + TexelKernel[ i ] );
        if( vNeighborColor.w == 0 )
            continue;

        //vFinalColor = ( length( vFinalColor ) > length( vNeighborColor ) ) ? vFinalColor : vNeighborColor;
        vFinalColor += vNeighborColor;
        nValidPixels++;
    }
    return vFinalColor / max( nValidPixels, 1 );
}

sentences:
Basic Random Tile Map Generation Currently I've got a map like this:

It's pretty simple but what I want is that area of tiles to be random, with the number of tiles present being random (Within a minimum and maximum amount of tiles of course) and the positions of the tiles being random (but still all connected to each other), but I'm not exactly sure how I should go about implementing that.

I'm sort of looking for a system that will generate random sections of tiles, a bunch of tiles within a group at random positions around the screen with all these sections being connected to each other via a larger section of tiles.
Like the example shown in this perfect drawing I've quickly done:

Each square would be a group of tiles, they're all of different shapes and sizes but all connected together via another large (or small) group of tiles in the middle.

I have looked into grid map generation before making this post but all the information I found would tend to go over more advanced map generation methods that have multiple layers which is not really what I need for my game so I was wondering if someone would possibly be able to advice me on what the best method would be to do this?

I'd very much appreciate it.

sentences:
Transform a Screen Delta I have a delta in screen coordinates that I want to transform to a 3d delta in world space.

The delta is in this case a movement across the (x,y) coordinates in screen space on the near projection plane for a known z in the 3d space. The goal is to move an object in 3d space horizontally and vertically.

How would I do this?

I guess it has something to do with getting rid of the translation component in the world-view-projection matrix, as the delta is only influenced by the scaling and rotation part of the matrices.

I tried the naive approach by setting the translation component in the world-view-projection matrix to 0, but that did not work.

The only working solution i found so far is to unproject the (0,0,z) coordinate of the object to world space and then unproject the delta (x,y,z) to world space. The result of these 2 un-projections is then substracted to get the delta in world space.

sentences:
How are minimaps rendered for open worlds? When I've created minimaps for smaller to medium levels before I would use a large texture mapped to a plane for the minimap and world map. The minimap/world map camera would then view this texture from a top down view.

For larger, open world style environments though I'm facing a performance vs fidelity issue. For example, a large environment requires a large texture to fit everything in, but at the same time the texture also needs to be a high enough resolution for when the player decides to zoom in onto a specific point in the map. I can make the map high resolution with enough detail up close but this creates quite a large texture size. Or I can make a lower res map which is more efficient but it becomes blurry/pixelated when zooming in.

Is this just a balance that I have to play with, or is there a better way to handle this? For example, creating a simple 3d mesh whose shape would act as the map. Or instead of using a texture using a vector graphic. How is this usually done?

sentences:
Responsibility of rendering in a component/entity game engine I am developing a simple component/entity game engine in C# (https://github.com/alexvm/BlueShift) and have a few questions regarding the responsibility of certain items in the engine itself. I have the following:

Scene
Entity
Component

I am planning to have the scene maintain a collection of entities. To draw components on screen, the scene will loop over entities draw any components that extend from a drawable parent.

E.g. a drawable component might look like:

public class SpriteComponent : Drawable {

}

And in as scene I would call:

foreach(var entity in entities) {
    Scene.DrawComponents(entity.DrawableComponents());
}

Does the responsibility of each class make sense? I.e. does it seem like good design for the scene to maintain all entities and for the entity to present the drawable components to the scene to draw?

sentences:
How can I create a musical sheet using sprites?(Ocarina of time ) I am looking to make a musical sheet similar to the image below:

I want to:

use sprites prefabs
have each sprite correspond to a different line
Move down notes are more are being played
have tail end notes disappear or go outside of text view (like when you type past a search bar)

I am unsure if there is a UI asset in Unity that can perform what I just mentioned. I was thinking could just instantiate the prefabs in the right positions, shift them down, then delete the tail end prefabs as more are being played. Outside of that, I'm lost.

sentences:
How can I create a pressure pad in order to open a door? I'm making a 2D platformer with Unity. I want to create a pressure pad in order to open a door and I want the door to open when the player is on the pressure pad and close in few seconds after the player leaves the pressure pad. I've tried different ways but none of them worked. In this case, the door should be open upwards and close downwards. Also, I already created some animations (idle, open and close) for the door but don't know how to make a connection between these two objects then play the animations at the proper time. Thank you in advance.
using System.Collections;
using System.Collections.Generic;
using UnityEngine;
using UnityEngine.Events;

public class PressurePad: MonoBehaviour
{
    public UnityEvent OnActivate;
    public UnityEvent OnDeactivate;

    int objectsInContact;

    IEnumerator Timer()
    {
        yield return new WaitForSeconds(6);
        OnDeactivate.Invoke();
    }
    void OnTriggerEnter2D(Collider2D other)
    {
        objectsInContact++;
        if (objectsInContact == 1 && OnActivate != null) OnActivate.Invoke();
    }

    void OnTriggerExit2D(Collider2D other)
    {
        objectsInContact--;
        if (objectsInContact == 0 && OnDeactivate != null) OnDeactivate.Invoke();
        StartCoroutine(Timer());

    }

}

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:
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:
Libgdx Platform collision problem I am trying to come up with a collision function where all the cases are made.

If the player (Who's hit box is a circle) collides with a platform (hit box is a rectangle) from the right the platform will push the player back.
If the player collides with the platform for the top the player will stand on the platform.
If the platform is to the left of the player the player cant move to the left.

I am not asking how to tell if they are colliding or not but which side of the platform they are collide with where each platform is it's own object.

Can someone help me make this function?

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:
Accessing uniform variables from a Cg shader in OpenGL I am trying to implement a simple PC program with OpenGL, using mandatorily Cg shaders (no Unity whatsoever).

I have found some tips on this page http://bobobobo.wordpress.com/2008/10/05/cg-1/ and kept the Cgprogram, Cgcontext and Cgprofile types in my own project.

Problem is: How can you access uniform variables in the C++ code?
I have tried the glGetUniformLocation way, but that won't work because the first parameter must be the program's ID of GLuint type and I have CGprogram type.

I have already searched by myself (including the Nvidia Cg 'tutorial') but I can't seem to find both Cg and OpenGL discussed on a page without having to deal with Unity.

edit: I can now access the variables, but in my case I'm trying to change a texture, and it doesn't bind.

sentences:
How do I avoid interpolation artefacts when scaling up a heightmap? I am using a bicubic interpolation algorithm in order to upscale a height map, and I am noticing some artifacts around the pixels boundaries. However, these artifacts don't seem to appear when I use a simple cubic interpolation (spline).

Could it be because the bicubic interpolation doesn't guarantee the second derivative to be continuous, unlike the cubic spline ? If so, is there known algorithms that have a continuous second derivative ? Otherwise, is there a way to deal with these artifacts ?

Linear interpolation (shows the pixels boundaries):

Bicubic interpolation (artifacts visible at pixels boundaries):

Cubic interpolation (no noticeable artifacts):

I tried several bicubic formulas, which gave me the same results. Here are some examples:

http://paulbourke.net/miscellaneous/interpolation
http://www.paulinternet.nl/?page=bicubic

sentences:
Unity editor PropertyDrawer custom button I has a PropertyDrawer, everything goes fine, except one feature: I can't figure out how to add button and I use checkbox instead

using UnityEngine;
using UnityEditor;
using System.Collections;

[CustomPropertyDrawer (typeof (InteractiveObject))]
class InteractiveObjectPropertyDrawer : PropertyDrawer {

public override void OnGUI (Rect position, SerializedProperty property, GUIContent label) {

    EditorGUI.BeginProperty (position, label, property);
    position = EditorGUI.PrefixLabel (position, GUIUtility.GetControlID (FocusType.Passive), label);
    var indent = EditorGUI.indentLevel;
    EditorGUI.indentLevel = 0;
    Rect colorRect = new Rect (position.x, position.y, 40, position.height);
    Rect unitRect = new Rect (position.x + 50, position.y, 90, position.height);
    Rect nameRect = new Rect (position.x + 150, position.y, position.width - 150, position.height);

    EditorGUI.BeginChangeCheck();
    EditorGUI.PropertyField (colorRect, property.FindPropertyRelative ("show"), GUIContent.none);
    if (EditorGUI.EndChangeCheck() ) {
        RenderSettings.skybox.SetColor("_highlight", property.FindPropertyRelative ("id").colorValue);
    }

    EditorGUI.PropertyField (unitRect, property.FindPropertyRelative ("name"), GUIContent.none);
    EditorGUI.PropertyField (nameRect, property.FindPropertyRelative ("name"), GUIContent.none);
    EditorGUI.indentLevel = indent;
    EditorGUI.EndProperty ();
}
}

How I can add button there?

sentences:
Pygame Import Error, Python 3.2 I'm having an issue with the Pygame module. I run Python 3.2 and installed the respective Pygame file, but now when I try to import it in the IDLE, it gives me this error:

>>> import pygame
Traceback (most recent call last):
  File "<pyshell#0>", line 1, in <module>
    import pygame
  File "C:\Python32\lib\site-packages\pygame\__init__.py", line 95, in <module>
    from pygame.base import *
ImportError: DLL load failed: %1 is not a valid Win32 application.

Any help will be appreciated.

sentences:
Managing many draw calls for dynamic objects We are developing a game (cross-platform) using Irrlicht. The game has many (around 200 - 500) dynamic objects flying around during the game. Most of these objects are static mesh and build from 20 - 50 unique Meshes.

We created seperate scenenodes for each object and referring its mesh instance. But the output was very much unexpected.

Menu screen: (150 tris - Just to show you the full speed rendering performance of 2 test computers)
a) NVidia Quadro FX 3800 with 1GB: 1600 FPS DirectX and 2600 FPS on OpenGL
b) Mac Mini with Geforce 9400M 256mb: 260 FPS in OpenGL

Now inside the game in a test level: (160 dynamic objects counting around 10K tris):
a) NVidia Quadro FX 3800 with 1GB: 45 FPS DirectX and 50 FPS on OpenGL
b) Mac Mini with Geforce 9400M 256mb: 45 FPS in OpenGL

Obviously we don't have the option of mesh batch rendering as most of the objects are dynamic. And the one big static terrain is already in single mesh buffer. To add more information, we use one 2048 png for texture for most of the dynamic objects. And our collision detection hardly and other calculations hardly make any impact on FPS. So we understood its the draw calls we make that eats up all FPS. Is there a way we can optimize the rendering, or are we missing something?

sentences:
How can I split my entity manager class into a gameworld class and gamerenderer class? I currently have a libGDX game where I have an entity manager class which is called in the gamescreen. Instead, I would like to utilise it in a gameworld class and a gamerenderer class, but I cannot figure out how to split it up (if that makes sense). I want to do this so that I can manipulate my player class separately and not as a part of the entity manager. Previous attempts have failed because taking 'player' away meant that checkCollisions stopped working (hence why I want to use gameworld and gamerenderer classes instead). Does anyone have any ideas on how to achieve this?

Here is my entity manager class:

public class EntityManager {
    private final Array<Entity> entities = new Array<Entity>();
    private final Player player;

    public EntityManager(int amount) {
        player = new Player(new Vector2(110, 15), new Vector2(0, 35));
        for (int i = 0; i < amount; i++) {
            float x = MathUtils.random(0, ManicMeltdowns.WIDTH - TextureManager.DROPS.getWidth());
            float y = MathUtils.random(ManicMeltdowns.HEIGHT, ManicMeltdowns.HEIGHT * 3);
            float speed = 2;
            addEntity(new Drops(new Vector2 (x, y), new Vector2(0, -speed)));
        }
    }

    public void update() {
        for (Entity e : entities)
            e.update();
        player.update();
        checkCollisions();
    }

    public void render(SpriteBatch sb) {
        for (Entity e : entities)
            e.render(sb);
        player.render(sb);
    }

    private void checkCollisions() {
        for (Drops e : getDrops()) {
            if (e.getBounds().overlaps(player.rectangle)) {
                ScreenManager.setScreen(new GameOverScreen());
            }
        }
    }

    public void addEntity(Entity entity) {
        entities.add(entity);
    }

    private Array<Drops> getDrops() {
        Array<Drops> ret = new Array<Drops>();
        for (Entity e : entities)
            if (e instanceof Drops)
                ret.add((Drops)e);
        return ret;
    }
}

Thanks.

sentences:
Using SDL instead of Allegro? While looking for a cross platform library for game development, I came across both SDL and Allegro. After extensive research on fora, it seems SDL it way more widely used than Allegro is. I got the impression SDL is like 'the standard library' for developing graphical applications.

Now, I was wondering why this is the case. From a purely technical perspective, Allegro supports (almost) the same platforms as SDL. Moreover some functions in Allegro seems more intuitive than the SDL counterparts. On the other hand, the support of SDL for iOS and Android is better.

My question therefore is:

What is the cause of the widespread use of SDL over Allegro? Is it only due to personal preference or are there technical reasons for this?

To put my search into context, I'm looking for a low level library preferably written in C++. My goal is to develop a game engine from the lowest level possible just for the learning experience.

sentences: My lighting stays the same when I go indoors? My problem can be seen here notice how the shadows don't change intensity or color when moving indoors to the cave. The only thing that changes is the highlights when I move under the directional light. I was thinking about adding global illumination but I don't think that would work with a toon shader. How can I get my lighting to become darker once I enter indoors e.g a cave. Thanks!

sentences:
Check collision with rectangle and pixels I have done a function to check the pixels collision against two animated sprites, and now I need to check a "Rectangle x animated sprite" collision, but I have no idea how to do this. I tried to create a new Texture2D for the rectangle and fill it with some color, but it is expensive to do at every frame when I need check the collisions.

This is my function to check the pixel colisions of two animated sprites:

public static bool IntersectCharacterSpritePixels(CharacterSprite spriteA, CharacterSprite spriteB)
{
    if (!spriteA.BoundingBox.Intersects(spriteB.BoundingBox))
    {
        return false;
    }

    // Get the current frame for each sprite
    var rectangleA = spriteA.GetCurrentFrameRectangle();
    var rectangleB = spriteB.GetCurrentFrameRectangle();

    // Create the color data based on the current frame
    Color[] dataA = new Color[rectangleA.Width * rectangleA.Height];
    spriteA.TextureRegion.Texture.GetData(0, new Rectangle(rectangleA.X, rectangleA.Y, rectangleA.Width, rectangleA.Height), dataA, 0, dataA.Length);

    Color[] dataB = new Color[rectangleB.Width * rectangleB.Height];
    spriteB.TextureRegion.Texture.GetData(0, new Rectangle(rectangleB.X, rectangleB.Y, rectangleB.Width, rectangleB.Height), dataB, 0, dataB.Length);

    // Find the bounds of the rectangle intersection
    var boundingA = spriteA.BoundingBox;
    var boundingB = spriteB.BoundingBox;

    int top = Math.Max(boundingA.Y, boundingB.Y);
    int bottom = Math.Min(boundingA.Bottom, boundingB.Bottom);
    int left = Math.Max(boundingA.Left, boundingB.Left);
    int right = Math.Min(boundingA.Right, boundingB.Right);

    // Check every point within the intersectionbounds
    for (int y = top; y <bottom; y++)
    {
        for (int x = left; x < right; x++)
        {
            // Get the color of both pixels at this point
            Color colorA = dataA[(x - boundingA.X) + (y - boundingA.Y) * rectangleA.Width];
            Color colorB = dataB[(x - boundingB.X) + (y - boundingB.Y) * rectangleB.Width];

            // Ifboth pixels are not completely transparent,
            if (colorA.A != 0 && colorB.A != 0)
            {
                // then an intersection has been found
                return true;
            }
        }
    }

    // No intersection found
    return false;
}

sentences:
Advice needed for a physics engine I've recently started a project, building a physics engine.
I was hoping you could give me some advice related to some documentation and/or best technologies for this.

First of all, I've seen that Game-Physics-Engine-Development is highly recommended for the task at hand, and I was wondering if you could give me a second opinion.Should I get it?
Also, while browsing Amazon, I've stumbled onto  Game Engine Architecture and since I want to build my physics engine for games, I thought this might be a good read aswell.

Second, I know that simulating physics is highly computation intensive so I would like to use either CUDA or OpenCL.Right now I'm leaning towards OpenCL, because it would work on both NVIDIA and ATI chipsets.What do you guys suggest?

PS: I will be implementing this in C++ on Linux.

sentences:
Shadow artifacts/acne on block intersections This is using the default shader and depth shader from LibGdx. It creates lines at the blocks intersections.

This is what I use to create the blocks models for now:

private Model createModel(Color color) {
    Model model = modelBuilder.createBox(
            cellSize, cellSize, cellSize,
            new Material(ColorAttribute.createDiffuse(color)),
            Usage.Position | Usage.Normal);
    return model;
}
...
for(int x = 0; x < data.models.length; x++) {
    for(int y = 0; y < data.models[x].length; y++) {
        int z = data.getElevation(x, y);
        ModelInstance instance = new ModelInstance(model);
        instance.transform.setTranslation(new Vector3(cellSize * x + cellSize/2, cellSize * y + cellSize/2, z * cellSize - cellSize/2));
        getWorld().addToCache(instance);
    }
}

This sets the environment lights:

getEnvironment().set(new ColorAttribute(ColorAttribute.AmbientLight, getAmbiantBrightness(), getAmbiantBrightness(), getAmbiantBrightness() , 1f));
getEnvironment().set(new ColorAttribute(ColorAttribute.Specular, getAmbiantBrightness(), getAmbiantBrightness(), getAmbiantBrightness() , 1f));
getEnvironment().add((shadowLight = new DirectionalShadowLight(1024*4, 1024*4, 600f, 600f, 0.1f, 100f)).set(db, db, db, dx, dy, dz));
getEnvironment().shadowMap = shadowLight;

This is how I render:

@Override
public void render(float delta) {
    getWorld().buildCache();
    clearScreen();
    renderShadows(delta);
    controls.update(delta);
    renderWorld(delta);
    renderHud(delta);
}
public void clearScreen() {
    Gdx.gl.glViewport(0, 0, Gdx.graphics.getWidth(), Gdx.graphics.getHeight());
    Gdx.gl.glClearColor(getBGColor().r, getBGColor().g, getBGColor().b, getBGColor().a);
    Gdx.gl.glClear(GL20.GL_COLOR_BUFFER_BIT | GL20.GL_DEPTH_BUFFER_BIT);
}

protected void renderShadows(float delta) {
    shadowLight.begin(Vector3.Zero, getCam().direction);
    shadowBatch.begin(shadowLight.getCamera());
    shadowBatch.render(world.cache, env);
    getWorld().tempModels.forEach(m -> shadowBatch.render(m, env));
    shadowBatch.end();
    shadowLight.end();
}

protected void renderWorld(float delta) {
    getBatch().begin(getCam());
    // render the cached models
    getBatch().render(getWorld().cache, getEnvironment());
    // render the temp models
    getWorld().tempModels.forEach(m -> getBatch().render(m, getEnvironment()));
    getBatch().end();
}

I tried to copy the default fragment and vertex shader and edit the PCFoffset with random values, but the result wasn't better.

float getShadow()
{

    float pcfOffset = 0.0f;
    return (//getShadowness(vec2(0,0)) +
            getShadowness(vec2(pcfOffset, pcfOffset)) +
            getShadowness(vec2(-pcfOffset, pcfOffset)) +
            getShadowness(vec2(pcfOffset, -pcfOffset)) +
            getShadowness(vec2(-pcfOffset, -pcfOffset))) * 0.25;
}

Should I code the lights/shadows myself using Lwjgl instead of using LibGdx defaults? Seems like a lot of work for something I expected to be included.

sentences:
How do I check if a surface is sloping? I'm implementing gravity over a 3D terrain and I'm struggling with how to check if surface "under your feet" is flat or sloping.

I read some tutorials but gravity is always considered along a single axis.

How do I proceed?

sentences: How can I convert THREE JS Texture to WebGL texture I am a C++ OpenGL programmer trying my hands on Web Developement. I have created Three JS Render Target and rendered my scene to it. The output is correct. Now I have a need to convert output of Render Target i.e THREE.Texture, to WebGLTexture. I don't want to use doElement.toDataURL() or something like that.

sentences:
OpenGL ES 2.0: Picking Individual Polygon Sprites from within VBO Say, I send 10 polygon pairs (one polygon pair == one 2d sprite == one rectangle == two triangles) into OpenGL ES 2.0 VBO. The 10 polygon pairs represent one animated 2D object consisting of 10 frames.

The 10 frames, of course, can not be rendered all at the same time, but will be rendered in particular order to make up smooth animation.

Would you have an advice, how to pick up proper polygon pair for rendering (4 vertices) inside Vertex Shader from the VBO?  Creating separate VBO for each frame would end up with thousands of VBOs, which is not the right way of doing it.

I use OpenGL ES 2.0, and VBOs for both Vertices and Indices.

sentences:
How to do FoV similiar to Nethack? I am currently writing a little roguelike and wondered how Nethack/other games do the FoV of the player. I had a look at Nethacks source code, but since it's C it's pretty hard to read.

For people who don't know how it looks in nethack:

I couldn't find good resources on how to achieve this result.
Of note is that my maps are a little more complex with regards to shape and objects that block sight.

So how would I actually implement that? Map is just an array of ints.

I figure I should have flags on each cell saying if it's been discovered or not, but how to I simulate the FoV?

sentences:
How to circle a target at a constant distance I have an AI ship that stops approaching when it gets within firing range, and starts strafing around its target. The problem is that it doesn't circle its target very well. The following code attempts to do this, and for short periods of time, it's convincing, but as soon as you let it run for ~5-10 seconds, the AI ship drifts out of range of the target and is forced into the approach state again.

Vector2 tangent = Vector2.Normalize(new Vector2(TargetVector.Y, -TargetVector.X));
velocity += 0.8f * tangent * accelerationMagnitude * (float)gameTime.ElapsedGameTime.TotalSeconds;
velocity += 0.2f * TargetVector * accelerationMagnitude * (float)gameTime.ElapsedGameTime.TotalSeconds;

The above doesn't work for obvious reasons, so I attempted to bring the target into my frame of reference using the following:

Vector2 tangent = new Vector2(TargetVector.Y, -TargetVector.X);
Vector2 asdf = tangent + (velocity * (float)gameTime.ElapsedGameTime.TotalSeconds);
velocity += Vector2.Normalize(asdf) * accelerationMagnitude * (float)gameTime.ElapsedGameTime.TotalSeconds;

Here is a quick video on how it behaves using the second method while trying to maintain a firing distance of 350: https://www.youtube.com/watch?v=16Bc46ekJI0  The white line and number indicate the Ship->Station vector and distance, and red circles are the weapon ranges.

How do I make my AI ship circle its prey convincingly?

sentences: Google Play Game Services real-time multiplayer secure game data architecture Is it secure to allow all game clients in a multiplayer game session to store sensitive opponent player data which should be revealed in the UI only upon a certain action (e.g. enemy building type only revealed after the player has hit the building) to save network traffic? Clients could then calculate public ("visible to them") information to render on the UI on their own after the action has taken place (without the need for a response from the server providing the type of building which was destroyed in this example). Or is this approach too insecure, provided Android app data can be compromised revealing sensitive opponent information, which otherwise would only be revealed on demand while progressing through the game session?

sentences: In XNA 3.1, is it possible to disable texture filtering? I want to disable texture filtering (since I'm making a retro-style game where it looks bad if a texture gets filtered like that), but since I'm on XNA 3.1 there seems to be no option to set a SamplerState with SpriteBatch.Begin or anything. Is it possible to do 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 script work when clicked only on the given prefab? I am very new to unity but not to C#.

I am working in Unity 2D

I made this prefab called LongLane. Its basically a collection of sprites of road, put together into a Gameobject. Now I wanted objects to spawn on the road when I ONLY click on the road, I can spawn the object on the road but they spawn regardless of where I click. I have written some code but they aren't clear and readable.

So how do I make a script work only when clicked on that specific prefab

sentences:
How to efficiently batch blocks and reduce drawcalls in a voxel-like game To fully get the benefits of GPU instancing in Unity in a voxel-like game I'm trying to batch as many static blocks as possible (the terrain won't be destructible, and I can't set these blocks to 'static' since I'll later need to assing different properties for each instance)

I see two possible solutions for this kind of problem:

• Creating a prefab for every possible block in my game, and batching togheter blocks with the same material/mesh/uvs

pros: won't need giant textureAtlas for storing albedo textures

cons: certain scenes with many differing terrain blocks may be hard to batch efficiently, and adding a property to every type of block would mean changing every block prefab (a nightmare if I have more than a handful of biomes)

• Creating a single block prefab and offset it's UVs with MaterialBlocks directly in the fragment shader

pros: every scene involving terrain blocks should at least in theory be efficiently batched, a single prefab to describe every type of terrain block

cons: needs a giant texture Atlas, and if it doesn't fits all of the block textures in the game more textures will be needed and I'll be limited in the future in the amount of blocks my game can have (unless I create different materials with different texture bindings, defeating the purpose of this solution), + fragment shader overhead for every type of block in the scene

Am I missing something here? Is there a different approach? If not, which one of the two would you consider the most appropriate in this scenario?

sentences:
How can I reward dungeon masters that take risks? I am working on a MORPG project featuring essentially two major roles: adventurers and dungeon masters. My concern is about balancing the two roles.

For those who have heard of it, the principle is inspired from the French comics Dungeon. The business model of a dungeon, as stated in the comics, is the following:
dungeon masters place treasures in heavily guarded dungeons, to lure in adventurers seeking fame and fortune. While some of them succeed, most die in the process, dropping valuable items which joins the pile of treasures of the dungeon, further attracting more adventurers.
Dungeon master make a living by collecting the right amount from these drops to create new rooms, pay mercenaries, fetch new creatures, breed dragons and whatnot.

Adventurers are quite classic: they are combat oriented characters that can attack monsters or fellow players and earn XP, items and money in the process, gradually making them stronger.

Dungeon masters are trade oriented. Their difficulty is balancing budgets: treasures and dragons are expensive. Now, I already expect a sort of equilibrium among dungeon masters because dungeons that are either too hard or too easy are naturally penalized (low attempt rate or low kill rate, respectively). DM vs DM balancing: check.

Since PvP combat is enabled in dungeons, there is also a competition  among adventurers pushing weak players to stick to easy dungeons that offer little reward to more advanced players. Adventurers vs advanturers balancing: check.

However there is one specific imbalance between the two roles that I am trying to solve: adventurers have a bias toward attempting dungeons above their league, because even if they die (dropping some items and respawning outside the dungeon), they will have gained some XP in the process. This is good because it rewards risk-takers. On the other hand, dungeon masters do not have any advantage of this kind: if an adventurer completes the dungeon and escapes with their share of the treasure, nothing is gained. This would be a pity if it lead dungeon master to be too cautious about their defenses, killing the probability of ever completing the dungeon. Adventurer vs DM balancing: problem.

Hence my question: what reward mechanism could I introduce that incitates dungeon masters to maintain a small but non-zero winning probability?

sentences: How would I implement a level transition when reaching a cave in Raylib? I am the developer of an upcoming 2d/3dRPG. I have a simple scene setup where there is a bridge over some acid and a cave entrance-like thing that I want to change the level with. I have used C and C++ in the past, and considered state machines, but I actually have no idea how to do this in raylib. plus I heard it's only that good for transitioning from a title to a game or something, not loading levels on collision. also, the acid has to destroy the player.

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:
Best way to deal with a large variety of items? I am currently working on my first java game and I am having trouble figuring out how I should implement my classes that will have heavy variety.  For example, I am considering having an abstract item class that every item in the game will inherit from, but I don't really know how specific I should get with the sub classes.  Is an armor class enough?  Should I break it down into where the armor will be equipped(head, chest, etc)?  Should I go so far as to give every single item it's own class and use a factory?

I apologize in advance for the noobie question, I have been searching around for a couple of hours but haven't been able to find a solid best practices guide that really goes in depth with this kind of stuff.

sentences:
How to implement the swipe up and down number select Unity3d I want to implement the UI like in the image.
I want the users to select the number by swiping up and down.
I found the tutorial on the YouTube which is similar to the what i wanted (https://www.youtube.com/watch?v=mL-FLsV3WRs)
But it shows only the numbers from 0 to 9. I want to show from 1 to N (n can be any number).
Any idea to help me to get this would be great.

sentences:
Pixel-art sprite distortion with 1:1 pixel ratio So I've been studying the Unity's PPU, pixel density, camera settings topic to make my game pixel-perfect. I've set everything in a way that my screen pixel to sprite texel ratio equals 1.

The art looks very good and crisp overall on the game view...

But!

There are still some minor distortions and I don't know where it comes from.

Take a look at this example:

In this example my settings are:

Screen: 870x510
PPU: 100
Camera size: 2.55
Pixel snap on Sprite material: on

The issue happens when I move the sprite manually by ~0.001 values on the Y axis. Same happens on the X axis.

Any ideas what's the problem?

sentences: Starting off in game development Recently I acquired a myriad of free time and have decided that I want to learn how to program. My question is what language should a newbie start off in? I understand that each language has its own pros and cons, but were could someone who is interested in making games start off?

sentences:
Java vs Javascript for Web-based games With all the recent interest in developing HTML5 apps and games, and I am curious why all the focus is on Javascript, and not on Java.

Minecraft is a great example of what can be accomplished in a browser, and it's written in Java, not JS. I doubt if it is even possible/practical to attempt such a complex project in JS.

Java is clearly a more powerful platform, and it probably runs significantly faster (this is just my guess, though). About the only drawback of Java I can think of is that it runs as a plugin, and with the trend towards plugin-free browsers (e.g. IE10 metro) Java applets may become obsolete in mobile environments. This has already happened with Flash on iOS.

What do you think? Is there a future in developing Java-based Web apps (especially for mobile devices)?

Thanks

sentences:
Player with Character Controller and children colliders won't collide properly I have a player that consists on a root object with the Character Controller attached and some children with its components. Those have box colliders attached.

When moving the player I want to be able to collide with other objects using the box colliders, but it won't, instead it will only collide with the Character Controller.

As you can see in the image, the red object didn't stop when the collider crashed with the framed cube, but it did when it did with the Character Controller.

There is any way to use the player colliders instead of the Character Controller for collision detection?

sentences:
Decoupling the entity from whatever controls it In a lot of games the player can choose whether an entity will be controlled by the AI or by the player. For example in the game Little Fighter 2, the player can choose how many of a maximum of 8 characters would be AI-controlled and how many of them would be human-controlled.

I was thinking how I can achieve this in my game. Currently in my game whatever controls the characters is hardcoded into them. I even have an AIAgent abstract superclass that all AI characters derive from, and a Player class that represents the player-controlled entity.

I realized that in order to be able to choose dynamically if an entity will be controlled by the player or by the AI, I need to decouple the entity itself from "it's brain", i.e. whatever controls it.

By "the entity itself" I mean the attributes and actions of the entity: it's mass, it's image, the way it implements shooting a missile, etc. By "the brain" I mean the system that decides when, and possibly how, to act.

As I said, currently "the brain" of my entities is hardcoded in their update() function. My Player class responds to player input in it's update() method, and my AIAgent subclasses usually delegate to a StateMachine of some sort in this method.

So I was thinking: how can I decouple the entities from their "brains", in order to be able to choose dynamically whether a Monster is player or AI controlled - and without a lot of ugly code duplication.

The solution that comes to mind is creating an abstract Controller class, with subclasses that can be plugged into the entities. Then the entities simply delegate to their controllers in the 'update()` function, and the controller controls the entity through it's interface.

To demonstrate:

abstract class Entity{
    // .. stuff omitted
    Controller brains;

    public void update(){
         brains.update(this);
         // .. non-behavioral physics stuff omitted
    }

    public void setController(Controller brains){
        this.brains = brains;
    }

    // methods that will be called by the controller in order to control the entity:
    public void attack(){
        ....
    }
    public void moveLeft(){
        ....
    }
    // ....
}

A PlayerController can read user input and control the entity accordingly, while an AIController would implement a state machine to control the entity. The controllers would use the entity's public interface to control it.

The only doubt I have about this approach is that it forces the entities to offer a lot of public methods to control them, such as moveLeft() and shootMissile().

Conceptually, it doesn't "feel right" that the entity would expose methods like these to the outside world, when 'conceptually' it should be it's own job to control itself. Just like it isn't possible to control a human's legs or heart from the outside. Feels like it breaks encapsulation.

So my question is: what do you think of this approach? Can you recommend a better one? How is this often done in games?

sentences:
Destroying a networked projectile and creating a client side visual for all clients in Unity? I'm making a shooter in Unity with UNET, and of course I handle projectile (like arrows) collision on the server.

The arrows are Networked rigidbodies with NetworkBehaviours, and I would like to spawn a Non-networked, eye candy like client side prefab at the collision point.

Current solution:

protected override void OnServerFixedUpdate()
{
    var distanceSincePreviousFrame = Vector3.Distance(positionAtPreviousFrame, rb.position);
    Collider collider;
    Vector3 impactPoint;
    if(CheckForImpactInNextFrame(distanceSincePreviousFrame, out collider, out impactPoint))
    {
        transform.position = impactPoint;
        DoImpactEffect(collider);
        GetComponent<Rigidbody>().isKinematic = true;
        NetworkServer.Destroy(gameObject);
    }
    positionAtPreviousFrame = rb.position;
}
void OnDestroy()
{
    var go = Instantiate(ClientSidePrefab, transform.position, transform.rotation);
}

The rigidbody flies on the server (rigidbody synced), and CheckForImpactNextFrame checks collision by raycasting. (needed so projectiles won't go through things due to simulation errors).
If it collides, then it does its impact effect, then destroys itself on the network.
Clients instantiate a client side, non networked prefab for visuals when the networked projectile is destroyed.

At the server side this works well, "client side arrow" is instantiated at the impact position,

but at clients, it's instantiated at its previous position, because the transform.position = impactPoint; in the if isn't synced before it is destroyed on the clients.

How could I make those client side visuals appear at the correct position?

Could I call a "force sync" before destroying?

I can't call an RpcCreateVisuals(position) method, because the entity may be destroyed on the client when the Rpc message arrives. (because the destroy message was faster.)

I could call an "always alive" object's Rpc, like a ProjectileManager's method, and I think that it will always arrive, because destroying the projectile has no effect on it. But it feels hacky, non OOP. Doesn't it?

How should I solve this solution? What is the common approach for this problem?

The same problem described by someone else: https://answers.unity.com/questions/1636182/client-objects-not-traveling-same-distance-as-on-s.html

Maybe I could disable them, and subscribe them to a "GarbageCollector" system, which destroys them only after a delay? Is this a well designed solution?

sentences:
Slow down in the same time over different distances I'm trying to slow down a object over different distances in the same time, say 3 seconds.

My slow down code is.

function lerpSpeed (speed: float, lerpSpeedTime: float)
 {
     incomingFlightSpeed = flightPathScript.flightSpeed;

     i = 0;
     while(i < 1)
     {
         i += Time.deltaTime/lerpSpeedTime;
         i = Mathf.Clamp(i, 0, 1);

         flightPathScript.flightSpeed = Mathf.Lerp(incomingFlightSpeed, speed, i);

         yield;
     }
 }

So I call it with.

 waypointScript.lerpSpeed(1,(totaFlighpointsDistance/flightSpeed));

In the picture below I've draw a bezier curve and at the last 8 flight points (the red and yellow spheres) I want to start the slow down from the yellow sphere to the last red sphere.

I get the distance in between each of the last 8 flight points and total them up to give me the total distance, I understand to get the time it will take to travel that distance is time = total distance/speed, but as I'm slowing the speed in my function above this will not work.

And because every bezier curve I generate is different, some stretched out, with total distances sometimes ranging from 30 to 8.

So I'm a bit stuck here, thought I'd get this one, but unless I'm missing something simple I can't get my head around it, so any help would be greatly appreciated, thanks.

sentences:
Multiplayer architecture in games like Diablo 2 So I've been wondering, what kind of architecture would games like world of warcraft, diablo 2 (which is most probably a different beast than WoW) use?

As far as I know, RTS games state-syncs every client and server, and the input from the clients get relayed to the server, and all states from all clients will get the same input, because everything is synced.

And because everything is synced, state changes can be done safely, thus allowing large numbers of entities in the game (e.g zerglings), because the clients only need to know the players' inputs.

This is all fine and well, but AFAIK diablo 2 allows players to join servers mid-game, which leads me to believe they use a different architecture. I'm stumped on how they do this though, and if elegant solutions exist for such a thing. Does anyone have a better idea?

sentences:
Vertex definitions and shaders I noticed that from looking at other examples like say .. riemers tutorials he takes a buffer with a bunch of vector3's in it and ties it to a shader which expects a float4 ... why does this work in his situation and not mine?

Also is there a simple fix for this situation that will allow me to do this with the shader  determining the w component as to my game logic this means nothing but is obviously crucial to the gpu.

Riemers code is here:

http://www.riemers.net/eng/Tutorials/XNA/Csharp/Series4/Textured_terrain.php

and mine (key parts only) ...

CPU Code:

public struct TexturedVertex: IVertex
{
    public Vector3 Position { get; set; }
    public Vector2 Uv { get; set; }

    public TexturedVertex(Vector3 position, Vector2 uv) : this()
    {
        Position = position;
        Uv = uv;
    }
}

Shader Code:

struct VS_IN
{
    float4 pos : POSITION;
    float2 tex : TEXCOORD;
};

struct PS_IN
{
    float4 pos : SV_POSITION;
    float2 tex : TEXCOORD;
};

Texture2D picture;
SamplerState pictureSampler;

PS_IN VS(float4 inPos : POSITION, float2 uv : TEXCOORD)
{
    PS_IN output = (PS_IN)0;
    output.pos = mul(inPos, mul(World, ViewProjection));
    output.tex = uv;
    return output;
}

How do the two tie together?

I am however using sharpDX not XNA so my code for setting up the buffers is different slightly ...

I created my own mesh class that does this:

VertexBuffer = Buffer.Create(device, BindFlags.VertexBuffer ,Vertices.ToArray());
context.InputAssembler.SetVertexBuffers(0, new VertexBufferBinding(VertexBuffer, Utilities.SizeOf<TexturedVertex>(), 0));

sentences:
How to create a reasonable AI? I'm creating a logic game based on Fox and Hounds game. The player plays the fox and AI plays the hounds. (as far as I can see) I managed to make the AI perfect, so it never loses. Leaving it as such would not be much fun for human players.

Now, I have to dumb-down the AI so human can win, but I'm not sure how. The current AI logic is based on pattern-matching - if I introduce random moves which make the board go out of pattern space the AI would most probably play dumb until the end of the game.

Any ideas how to dumb down the AI in such way that is does not go from "genius" to "completely dumb" in a single move?

sentences:
What is GPU instancing and what are its differences in comparison to standard instancing? I have been reading a lot of debate on a new feature that will be in Unity 5.4: GPU instancing. I understand the importance of instancing in general, both in terms of saving memory and draw calls.

However, even after doing some reading, I still couldn't understand what exactly are the differences between GPU instancing and non-GPU instancing - and, more importantly, where the alleged GPU advantages in terms of performance come from.

Thanks for your knowledge and for any references.

sentences:
How to sort scores and assign positions based on the scores? I have three game objects each with an individual score. I was wondering how I should go about sorting these scores in ascending order. I want to also give these objects a position based on their score. Any help would be appreciated.

For example:

object1.score = 1300,

object2.score = 3000,

object3.score = 2200

What I'm looking for is:

object1.position = 3,

object2.position = 1,

object3.position = 2

Game Object code:

SGameObject
{
    int cp = 0;
    int lap = 0;
    int score = 0;
    int position = 0;
}

sentences:
Unity 4 mecanim; 'Quaternion to Matrix conversion failed, input quaternion is invalid' I'm trying to animate a stick figure in Unity, with placeholder animations. Character is built/animated in Blender, exported to FBX. When imported to Unity, everything appears correct in the editor. All animations are imported, and i can preview them normally.

I set up the "rig" section of the model import to use generic rigging. This creates the avatar which is used in mecanim.

I set up a simple "walkForward" animation, and setup mecanim parameters to get it called when the player moved forward; all that works. The animation is called at the right times.

However, during play, as soon as any animation is started on the avatar, the model disappears, and a flood of error messages appear in the console, stating

Quaternion to Matrix conversion failed because input Quaternion is invalid {-1.#IND00, -1.#IND00, -1.#IND00, -1.#IND00} |=-1#IND00

I'm not altering the animation with any scripts of my own, it's all mecanim. Is there a setting i'm missing?

I'm using Unity 4.3.0.0f4, building/exporting my mesh with Blender (latest).

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:
Is the source code of the Source Engine available? Is the full C++ source code of the Source Engine available?

I know the SDK is available with the purchase of a Source-based game, but my goal is to find a open-sourced game engine that includes its full implementation details for learning purposes.

sentences:
Unity: Blender's Armature messes up Faces The Model itself is fine when imported but when I activate the Animation all Normals and lighting get Inverted from the Bones.

Result:

Import Settings:

Import Settings:

Blender Armature Settings:

Blender Export Settings:

sentences:
How do I make mask work I have been trying to make a game, but mask collision doesn't seem to work. Here is my code:

    class Player(pg.sprite.Sprite):
            def ___init__(self, game, x, y, lvl):
                    self.group = game.all_sprites
                    pg.sprite.Sprite.__init__(self.groups)
                    #nothing else important

            def update(self):
                    self.mask = pg.mask.from_surface(self.image)
                    #check if hits
                    hits = pg.sprite.spritecollide(self, self.game.kill, False, pg.sprite.collide_mask)
                    if hits:
                            #stops game
                            self.game.playing = False

    class Kill(pg.sprite.Sprite):
            def ___init__(self, game, x, y, lvl):
                    self.group = game.kill
                    pg.sprite.Sprite.__init__(self.groups)
            def update(self):
                    self.mask = pg.mask.from_surface(self.image)

The problem is that the game sets self.game.playing to False even before the pixels collide.

sentences: Is it legally possible to make a clone of the game? With board games like "Monopoly", "Domino", "Checkers", or "Chess", can game developers make clones and sell them? Also, can I make a clone of ZX Spectrum games? Are there many parts of the game with which can do the same?

sentences:
Why is my zooming-in + changing scenes not woking in Unity? I'm zooming on a map using Math.Lerp and then I use the scene manager to change the scene. Here is my attempt but it doesn't work on the map.

I have attached it to the main camera, in the worldView:

public class zoom : MonoBehaviour {

    // Use this for initialization
    private bool zoomedIn = false;
    int zooom = 20;
    float smooth = 5f;
    void Start () {
        SceneManager.LoadScene("worldView");
    }
    // Update is called once per frame
    void Update () {
        if (Input.GetMouseButtonDown (0)) {
            zoomedIn = !zoomedIn;
        }
        if (zoomedIn == true) {
            Camera.current.fieldOfView = Mathf.Lerp (Camera.current.fieldOfView, zooom, Time.deltaTime*smooth);
            SceneManager.LoadScene("countryView");
        }
    }
}

sentences:
Jump-through & drop-down platform I'm creating platforms in my game where the player can:

1) Jump through them from the bottom and land on top of them

2) While on top of them, drop down through them

I've been able to get #2 working just by disabling the contact using contact->SetEnabled(false) and this has worked fine. I'm mainly having some issues on the best way to handle #1. Here's the basic idea I have, though there's still some things that I need to concretely figure out. (Note: The logic below is very Box2D specific, but should apply to most physics engines):

Add 4 sensor fixtures to the 4 sides of the main fixture that extends a small amount past the main fixture
When the top, left, or right sensor fixtures make contact with a platform, disable the contact by using contact->SetEnabled(false) and set a boolean flag inside the Sprite object indicating that the Player is passing through the platform
When the bottom fixture ends contact with the platform, disable the boolean flag

This would basically make the top, left, and right fixtures act as enablers for the pass through logic and the bottom fixture act as the disabler. So when the player is falling back down from their jump, the bottom fixture will make contact, but won't disable the contact.

This makes sense on paper, but I can think of a few corner-case issues that might arise from this. Before I start plugging down this path, does anyone have any suggestions that might make my plan better or even a completely different way of doing it?

sentences:
Inherited property in derived class reference only base class [Context] I am developing a game in Unity, and wanted to make a Game Manager. Like many examples out there, it uses a Singletron design pattern. But i have several other Managers, all using Singletron pattern, so i decided to make a Singletron base class and make all the managers derive from it. When trying to access the Instance property declared in Base Class within one method in Game Manager derived class, the Instance property refers to the Singletron base class, which is expected.

But it`s not the behaviour i need. I have tried to look for alternatives, but everytime i found a possible solution, i have to declare the member variables/properties in the derived class, and there would be no need to a Singletron Base Class.

I have also looked for generic alternatives (Singletron < T >) but it was not clear how to use these without the need of another script calling it, which would be nonsense since the Game Manager should be the object to manage the game. I could use something like a root game object to creat the managers is instances, but it feels like a ugly and inelegant solution.

The managers are all coded, and this refactor would improve code maintenance, in future.

[Code from Singletron Base Class]

public abstract class Singletron : MonoBehaviour
{
    public static Singletron Instance { get; protected set; }

    protected virtual void Awake ()
    {
        if (Instance == null) {
            Instance = this;
        } else {
            Destroy (gameObject);
        }

        DontDestroyOnLoad (gameObject);
    }
}

[Pertinent code from Game Manager Derived Class]

public class GameManager : Singletron
{
    public List<GameObject> gameObjectsList;

    public static void SomeMethod()
    {
        foreach (GameObject go in Instance.gameObjectsList)
        {
            go.DoSomething();
        }
    }
}

[Question] What can i do inside Singletron Base Class to make the Instance.gameObjectList refers the actual class (in example, Game Manager Derived Class) so that i could use the gameObjectsList? Should i cast it to the pertinent manager inside the method (which seens like an inneficient option)?

Thanks in advance!

[Edit] Looking into design patterns page in wikipedia, i found another design pattern related to singletron. In my case, each manager follows the singletron pattern, but its somewhat equivalent to my singletron base class following a Multiton Pattern

sentences:
How do I get an XNA 4.0 game to run on other machines? Whenever I try and run a game made in XNA 4.0 on a machine other than one used for development, it just won't run. I've followed the instructions here to ensure that all the dependencies are present.

To be clear I've done the following:

Downloaded and installed the Microsoft .NET Framework 4 Client Profile.
Downloaded and installed the Microsoft XNA Framework Redistributable 4.0.
Made sure I am not using anything contained within GamerServices and XNA.Net.*, my references are as follows:

  Microsoft.Xna.Framework
  Microsoft.Xna.Framework.Avatar
  Microsoft.Xna.Framework.Game
  Microsoft.Xna.Framework.Graphics
  Microsoft.Xna.Framework.Storage
  Microsoft.Xna.Framework.Video
  Microsoft.Xna.Framework.Xact
  mscorlib
  System System.Core
  System.Windows.Forms
  System.Xml
  System.Xml.Linq

I also followed the advice here to ensure the problem was not within the code itself.

I've tried the follow methods to get it to run (on both Vista and 7):

Use the built in publishing functionality. This results in an error saying that Microsoft.Xna.Input.Touch needs to be present in the GAC. I've tried adding Microsoft.Xna.Input.Touch to the references, and this does not fix the issue.
Copy the XNA dll files locally. This results in an error message stating that Microsoft.Xna.Game.dll or one of its dependencies could not be located.
Copy over everything contained in Release. This results in an Application X stopped working... or APPCRASH error message the second it starts. My code is never reached.

Is there any way to get this to work? I've been trying to get this to work with the deadline looming, and it's been a source of unneeded stress.

sentences:
when to do A* pathfinding? I'm trying to build my first game, a really simple RTS like Age of Empires but I have a question about pathfinding.

When do this kind of games usually do pathfinding?

I've read some games do a global pathfinding once at game start but I'm not sure if that will fit this kind of games.

Do they usually calculate pathfinding each time a game entity starts a new task and has to move?

How do they handle when a obstacle suddenly appears on the path? Do they re-calculate pathfinding on every step? Or do they check if the current path is clear on every step? Or they just walk the current path until they actually hit the unexpected obstacle?

Actually if you know a link to a source code of pathfinding on some RTS game I would really appreciate it.

Thanks in advance

sentences:
Pre-calculating skeletal animation data I'm working on skeletal animation and so far I've got the skeleton drawn with interpolated animation working (just on the cpu still). I was thinking about changing my file format for my skeleton and animations to have fully calculated matrices stored.

Right now I calculate my matrices recursively by multiplying the parent's world matrix(absolute matrix) by the childs joint matrix, same thing with each frame of animation. I think it would be a good idea to just export all of this pre-calculated to my model format so I could just send these matrices to the shader for skinning.

Is there any reason I should not do this?

Edit: Calculating the matrices is negligible by itself on a rather small skeleton anyway but is there any reason I should calculate them at run time or just pre-calculate in my file format?  I think this sums up my question better.

sentences:
2D Shader for affecting lights based on y-distance I've been struggling with this problem for a few weeks (mostly because I'm so new to shaders), but I have an angled camera for my 2D game that uses lights.

I saw this link about the '3D light simulation' and wondered how the shader responsible was written.

I'm in Godot, which uses its own shader language. I just need a way to compare the y-value's of the light source and the sprite.
I found

float d = (1.0 - (length(LIGHT_VEC)) + 1.0);
    float yoff = abs(VAR1.x * half_size_h / half_size_w);
    LIGHT_VEC.y += (half_size_h - VAR1.y - yoff) + z_offset;
    LIGHT = LIGHT;

which lowers the vector from the light to the fragment, but I couldn't get what I needed out of that.

sentences:
Drawing text from update method in XNA I am having a problem drawing the "Game Over!" text once the user is on the last tile.

This is what I have:

The Update and drawText methods are in a class named turtle:

public void Update(float scalingFactor, int[,] map, SpriteBatch batch, SpriteFont font)
{
    if (isMovable(mapX, mapY - 1, map))
    {
        position.Y = position.Y - (int)scalingFactor;
        angle = 0.0f;
        Program.form.direction = "";

        if (mapX == 17 && mapY == 1)// This is the last tile(Tested)
        {
            Program.form.BackColor = System.Drawing.Color.Red;
            drawText(batch, font);
        }
    }
}

public void drawText(SpriteBatch spritebatch, SpriteFont spriteFont)
{
    textPosition.X = 200; // a vector2
    textPosition.Y = 200;
    spritebatch.Begin(SpriteSortMode.BackToFront, BlendState.AlphaBlend);
    spritebatch.DrawString(spriteFont, "Game Over!!!", textPosition, Color.Red);
    spritebatch.End();
}

This update is in the Game1 class:

protected override void Update(GameTime gameTime)
{
    // Allows the game to exit
    if (GamePad.GetState(PlayerIndex.One).Buttons.Back == ButtonState.Pressed)
        this.Exit();

    turtle.Update(scalingFactor, map, spriteBatch, font);

    base.Update(gameTime);
}

I have also added the font content to LoadContent:

font = Content.Load<SpriteFont>("fontType");

What am I doing wrong? Why does the text not want to show on game completion? If I call the turtle.draw() in the main Draw method. The "Game Over" text stays on screen from the beggining. What am I missing?

Thanks

sentences: How can I rasterize 3D triangles in software? I am creating a 3D software renderer, and I have a wire frame cube rendering. Now I am working on solid color rendering and I am wondering what an efficient algorithm for shading the contents of the triangles would be?

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:
Server side game loop Many java games use thread.sleep() to controll fps. Since the server does not display graphics, should the server game loop keep running just calculating delta time? Like this example:

long lastLoopTime = System.nanoTime();
final int TARGET_FPS = 60;
final long OPTIMAL_TIME = 1000000000 / TARGET_FPS;

while (gameRunning)
{
   long now = System.nanoTime();
   long updateLength = now - lastLoopTime;
   lastLoopTime = now;
   double delta = updateLength / ((double)OPTIMAL_TIME);

   doGameUpdates(delta);
}

sentences:
Nothing gets rendered in SceneKit I have this code in OpenGL:

Vuforia::Matrix44F modelViewProjection;

VuforiaApplicationUtils::translatePoseMatrix(0.0f, 0.0f, self.scale, &Vuforia::modelViewMatrix.data[0]);
VuforiaApplicationUtils::scalePoseMatrix(self.scale, self.scale, self.scale, &Vuforia::modelViewMatrix.data[0]);
VuforiaApplicationUtils::multiplyMatrix(&projectionMatrix.data[0], &Vuforia::modelViewMatrix.data[0], &modelViewProjection.data[0]);

And the modelViewProjection gets used like this:

glUniformMatrix4fv(mvpMatrixHandle, 1, GL_FALSE, (const GLfloat*)&modelViewProjection.data[0]);

With mvpMatrixHandle being a piece of code in the shader:

mvpMatrixHandle = glGetUniformLocation(shaderProgramID, "modelViewProjectionMatrix");

And in the shader itself:

gl_Position = modelViewProjectionMatrix * vertexPosition;

Now I try to convert this to SceneKit code (never used it before, so I might miss a big part of my SceneKit code)

// Setup
let plane = SCNNode(mdlObject: MDLAsset(url: Bundle.main.url(forResource: "Bubble", withExtension: "obj")!).object(at: 0))
scene.rootNode.addChildNode(plane)

let camera = SCNCamera()
plane.camera = camera

// Each frame
modelViewMatrix = SCNMatrix4Translate(modelViewMatrix, 0, 0, scale)
modelViewMatrix = SCNMatrix4Scale(modelViewMatrix, scale, scale, scale)
let modelViewProjection = SCNMatrix4Mult(arrayToMatrix(pose: projectionMatrix), modelViewMatrix)

//camera.projectionTransform = modelViewProjection
scene.rootNode.childNodes[0].transform = modelViewProjection

As you can see, I have also tried to set this as the projectionTransform of the camera, but that did not work either.

My result is the most annoying to debug: nothing gets rendered using the SceneKit code, while the OpenGL code works.

sentences:
Point welding on generated terrain I am converting two 2D images (A Voronoi graph and a Diamond Square noise map) into a 3D object.

However when finding the corner points of the Voronoi I am left with gaps, so I thought to drop these by calculating adjacency to existing nodes before creating the vertex. However no matter which algorithm for the weld I use, or the tolerance level of the distance I can't seem to get it to work.

This has led me to believe I am doing something wrong.

Image of the issue:

These gaps do not appear if I run without the weld, they are created by the weld jumping to spots, but then later welds not finding that spot.

I have even tried to increment the weld distance to a maximum of 10, if a suitable node wasn't found. But this is far to aggressive and has the effect of simplifying the mesh instead and creating more gaps.

My Repo for the full code is here: https://github.com/HughAJWood/TerrainGenerator

private void CalculatePolys()
{
    var nodesForEdges = new List<VNode>();
    foreach (var region in _regions)
    {
        foreach (var point in region)
        {
            if (point == null)
            {
                continue;
            }
            // We calculate where the voronoi node corners are, and pass them into the region
            var diff = ColoursDifferent(point);
            if (diff > 1)
            {
                RenderNodePointsOnImage(point);

                // Points are 2D, so to translate to 3D they are set to the Z property of the 3D node
                var node = new VNode
                {
                    X = point.X,
                    Z = point.Y
                };
                // Weld points within 1 unit from each other by determining if we already have one that exists
                // then using the existing node instead
                // A weld is calculated by determining the X,Z distance to see if we have a node stored already
                // that is within 2 units of the node we are creating
                VNode existingNode = Nodes.FirstOrDefault(n => n.Adjacent(node));
                if (existingNode == null)
                {
                    // Optimise node creation by skipping perlin lookup and ID iteration for only when needed
                    node.ID = VNodeId;
                    node.Y = _perlin.GetPixel(point.X, point.Y).R;
                    Nodes.Add(node);
                    Mesh.ControlPoints.Add(new Vector4(node.X, node.Y, node.Z, 1));
                }
                else
                {
                    node = existingNode;
                }
                nodesForEdges.Add(node);
            }
        }
        //if (i++ > 20) return;
        AddNodesToMeshAsPolys(nodesForEdges);
        nodesForEdges.Clear();
    }
}

The adjacency method is currently simplified to the fact I want to ignore the height of the node.

internal static bool Adjacent(this VNode a, VNode b, int tolerance = 3)
{
    var distance = Math.Abs(a.X - b.X) + Math.Abs(a.Z - b.Z);
    return distance < tolerance;
}

[UPDATE]

I have tried sorting the points by distance and fuzzy distance, both sort in the correct order. Then I tried taking the first point and using that as the welding point. Same effect.

I tried to average the points at the intersections at the image level and pass that back as the point every time, then weld. Same effect.

Clearly there are many approaches I can take for this, the problem arises when there are 2 points close to each other on the edge of a voronoi region. Sometimes they weld and create a gap. Sometimes however in some variances of the algorithm that the points don't weld even though their X,Z coordinates are very close to each. I'm still stumped as how to approach this.

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:
What scripting language would you recommend for a C++ game project? By scripting here I mean not just putting config data in a script, but scripting parts of the project like some class methods, test specific game loop, etc. This would be not just to accelerate development, but also allow players to see some of these scripts to tweak some aspects of the game.

Some language like Lua have some wrappers like luabind, but when I've used it in the past it had problems because it didn't support method redefinition in a context of inheritance.

What are your suggestions of language / wrappers to use or not to use?

sentences:
Need help to find error in collision dection in XNA I really need some help to find the reason why not any of my Asteroids sprites are visible on the screen after I added som code to dedect collision. My suspect is that it has to do in the collision method and that the sprites are removed from the list from the beginning!? The Spaceship is visible.

In my manager class I have this method for checking the collision:

public void CollisionControl(Spaceship spaceShip)
    {
        for (int i = 0; i < asteroidList.Count(); i++)
        {
            if (asteroidList.ElementAt(i).Bounds().Intersects(spaceShip.Bounds()))
            {
                asteroidList.RemoveAt(i);
                i--;
            }
        }
    }

And then from the Game1 class I call this manager from the Update Method like this:

 asteroidManager.CollisionControl(spaceship);

And finally in the SpaceShip class and the Asteroids Class I have this code:

// Bounds
    public Rectangle Bounds()
    {
        //return new Rectangle((int)(position.X - orgin.X), (int)(position.Y - orgin.Y), texture.Width, texture.Height);
        return new Rectangle(0,0,60,60);
    }

// Draw method
    public void Draw(SpriteBatch spriteBatch)
    {
        //spriteBatch.Draw(texture, position, new Rectangle(0,0, (int)texture.Width, (int)texture.Height) , Color.White, rotation, orgin, 1, SpriteEffects.None, 0);
        spriteBatch.Draw(texture, position, null, Color.White, rotation, orgin, 1, SpriteEffects.None, 0);
    }

Help is really preciated! I'm doing a hand in task that I need to complete soon! Thanks!

sentences:
Port a WP7 game to WP8 with Monogame I have a full working game for WP7, I want to port it to WP8 with Monogame. I have installed Monogame and I have done all tests to see that it is working inside Visual Studio Express 2012 for Windows Phone 8. Now I just don't understand how to rebuild my WP7 version game within a Monogame project to target WP8 devices.

So, if you would have the entire solution of a WP7 game, how would you make it work on WP8 with Monogame?

Thanks!

sentences:
Game Maker x and y coordinates wrong I'm making a game which the user can use the arrow keys to scroll left and right to view the map.  I had an issue with the health bars of my enemies being drawn way off even though I set them to be drawn at the x and y position of the enemy.

I tried to debug using the following line to draw something at mouse_x and mouse_y:

draw_text(mouse_x, mouse_y, "X");

The X on screen would be at the correct position (the mouse position) when the mouse was at 0, 0, BUT as the mouse was moved farther right or down, the respective x or y offset became bigger and bigger, almost like I said to draw the X at mouse_x * 1.5, mouse_y * 1.5.

I'm using a view (view[0]) to allow the user to scroll through the map, and I thought this might be the source of the issue.  This is the code I used to allow the user to scroll left and right:

if (view_xview[0] < room_width - view_wview[0]){
    view_xview += clamp(room_width - view_xview[0], 0, 10);
}else{
    view_xview[0] = room_width - view_wview[0];
}

The same code was used for moving left, but reversed.

sentences: What decrease of polycount should occur as a function of distance? What decrease in polycount should occur as a function of distance. I make a terrain and I wounder what is the right formula to keep the "poly size"(the screen size) constant. Or is there some mental flaw in this approach?

sentences:
How can I manipulate a single pixel with LWJGL? This is a very simple question. Is there a way to manipulate a single pixel?

Here's an example of what I want in pseudo-code:

while(gameIsOn) {
    renderAllObjects();
    setPixel(x,y,r,g,b);

}

Is this possible in any way? (Notice it's is not a solution to render a 1 by 1 quad, since it's too resource expensive.)

sentences:
Unity 5.1 Asset bundle for windows I am working on the asset bundle method, i know how to use the asset bundle for untiy 4.x series but i am trying to do this in unity5. I heard in unity 5 is more compatibility to do. I searched in youtube and google but i didnt get the proper tutorial to how to use that. So please suggest me or provide some tutorial to do this.

Thanks in Advance.

sentences:
How do I go about ensuring a unique ID value? I am using Unity and coding in C#. I have a game object called Enemy, which has a script called EnemyMotor. EnemyMotor has an int called ID. When EnemyMotor starts, I need to find an ID value that is not been using by any other instance of EnemyMotor.

For example: Enemy one spawns; check if an ID value of 1 is not being used. Enemy two spawns; check if an ID value of 1 is being been use. In this case, it is, so I need to find another ID value that is not being used. In this case, it should be 2. Continue with Enemy three, Enemy four and so on.

How do I go about ensuring a unique ID value?

sentences:
How do I create a half-ortho half-perspective projection matrix I've been trying to make a formula for the projection matrix where your vertical axis is projected orthographically but your horizontal axis will have perspective to it.
So the view frustum would look like this:

I studied how the formulae of orthographic projection and perspective projection and how they where achieved. And tried to modify those to try to reach projection I wanted. It seemed to me it wasn't possible to have one axis scale to Z and the other not (or to have them scale at a different factor).
It it possible to reach the perspective I want? If so what would the projection matrix look like?

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 can I secure a high score table? Possible Duplicate:
  How can I prevent cheating on global highscore tables?

So, I create a game in Flash and I want to keep a hi-score table for people to compete in.

After a player has finished playing a game, the game needs to transmit the score (& player's name etc) back to a central server, to store the results in a database, probably via a PHP web page for simplicity.

All this is fine, but at this point nothing is stopping some 'clever' individual from sending a their own customised message directly to the PHP page and entering their own values directly into the hi-score tables, therefore cheating the data without even playing!

So, what can I do to ensure that the data being sent is only validated if it comes from the game itself?

sentences: Need advice concerning the creation of open world game in Unity 3D I just wanted to ask for advice those being an expert in Unity 3d and overall in game industry about how it is possible to create an open-world game by means of Unity 3D, that is, I already tried to combine several tiles of terrains, 4 to be exact, and their respective size is 500x500. However, once I started to add the fifth terrain to those terrains, Unity stopped working. Moreover, another problem that I faced was with light mapping in Unity, that is, the more terrain I add to the scene the more it is difficult to bake the light mapping. The question is if I am doing correctly by adding terrains to each other and how open-world games are actually created. Yes, I heard of chunk loading but is it possible to code it on my own without using ready plugins. Lastly, Is it possible to combine tiles of terrains just manually without using any tools like Terrain Slicing kit or Gaia please I really need your help Thank you for your attention))).

sentences: What comes with Nintendo's DS SDK? Presumably a development machine for sure, but would it contain any sort of editor (of any kind)? Or are there any editors in existence that work with the SDK that are commercially available?

sentences:
How can I stop Substance's runtime texture caching? Procedural textures with the Substance Engine seem to update very quickly if you turn off caching, modify one exposed variable at a time, modify it frequently, and even then only after you've attempted to modify it 2 or 3 times.

However, I want basically the opposite. For example, units have a "blood" variable that generates blood differently on them as they take damage, as well as a "battle wear" variable that generates scratches and dents, but doesn't revert when they heal.

So to force a variable not to cache, I have to set it to some dummy value, then back to normal, then call RebuildTexturesImmediately.

How can I tell Substance not to cache a variable at runtime, so I can change it once and have the texture regenerate quickly?

sentences:
Changing JavaScript Player Object based on keypress I'm currently working on a basic JavaScript top-down shooter and I've run into a dilemma. I'm trying to implement a basic toggle weapon system however when I press the key it changes the weapon properly but when I press it again to toggle back it doesn't work. I don't think it's an issue with the rendering because the drawing function is able to detect the different weapons properly. I feel it's an issue with the actual toggle system code.

Here's the code for the player class

class Player{
    constructor(set){
        this.cx = set.x;
        this.cy = set.y;
        this.r = set.r;
        this.color = set.color;
        this.angle = 0;
        this.toAngle = this.angle;
        this.state = 1;
        this.up = false;
        this.down = false;
        this.right = false;
        this.left = false;

        this.bind();
    }
    bind(){
        const self = this;
        c.addEventListener('mousemove', (e) => {
            self.update(e.clientX, e.clientY);
        });
        window.addEventListener('keydown', (e) => {
            if(e.keyCode == 81){
                if(self.state = 1)
                    self.state = 0;
                if(self.state = 0)
                    self.state = 1;
            }

        });
        //toggle code:
        window.addEventListener('keyup', (e) => {
            if(e.keyCode == 81){
                if(self.state = 1)
                    self.state = 0;
                if(self.state = 0)
                    self.state = 1;
            }

        });
    }
    update(ex, ey){
        this.toAngle = Math.atan2(ey - this.cy, ex - this.cx);
    }
    canv(){
        if(this.angle !== this.toAngle){
            clear();
            ctx.save();

            ctx.translate(this.cx, this.cy);
            ctx.rotate(this.toAngle - this.angle);
            ctx.translate(-this.cx, -this.cy);

            drawPlayer(this.cx, this.cy, this.r, 0, 180, this.color, this.state);

            this.angle = this.toAngle;
        }
    }
}
//drawing code (above this one in the complete file)
function drawCircle(x, y, rad, startAngle, endAngle, color){
    ctx.fillStyle = color;
    ctx.beginPath();
    ctx.arc(x, y, rad, startAngle, endAngle);
    ctx.fill();

}
function drawPlayer(x, y, playerR, playerStartAng, playerEndAng, color, state){
    //left hand start
    if(state == 0){
        ctx.fillStyle = color;
        ctx.beginPath();
        ctx.arc(x - 15, y - 15, 10, 0, 180);
        ctx.fill();

        //border
        ctx.strokewidth = 10;
        ctx.strokeStyle = "brown";
        ctx.stroke();
        //end

        //right hand start
        ctx.beginPath();
        ctx.arc(x + 15, y - 15, 10, 0, 180);
        ctx.fill();

        //border
        ctx.strokewidth = 10;
        ctx.strokeStyle = "brown";
        ctx.stroke();
    }
    if(state == 1){
        //right hand start
        ctx.beginPath();
        ctx.arc(x + 7, y - 21, 10, 0, 180);
        ctx.fill();

        //border
        ctx.strokewidth = 10;
        ctx.strokeStyle = "brown";
        ctx.stroke();

        ctx.fillStyle = color;
        ctx.beginPath();
        ctx.arc(x - 7, y - 17, 10, 0, 180);
        ctx.fill();

        //border
        ctx.strokewidth = 10;
        ctx.strokeStyle = "brown";
        ctx.stroke();

        //gun start
        ctx.fillStyle = "black";
        ctx.beginPath();
        ctx.ellipse(x, y - 20, 3, 25, 0, 0, 2 * Math.PI);
        ctx.fill();

        //gun border
        ctx.strokewidth = 10;
        ctx.strokeStyle = "black";
        ctx.stroke();
        //end

    }

    //draw player
    drawCircle(x, y, playerR, playerStartAng, playerEndAng, color);
}

sentences:
2D wave-like sprite movement XNA I'm trying to create a particle that will 'circle' my character. When the particle is created, it's given a random position in relation to my character, and a box to provide boundaries for how far left or right this particle should circle. When I use the phrase 'circle', I'm referring to a simulated circling, i.e., when moving to the right, the particle will appear in front of my character, when passing back to the left, the particle will appear behind my character.

That may have been too much context, so let me cut to the chase:

In essence, the path I would like my particle to follow would be akin to a sine wave, with the left and right sides of the provided rectangle being the apexes of the wave. The trouble I'm having is that the position of the particle will be random, so it will never be produced at the same place within the wave twice, but I have no idea how to create this sort of behavior procedurally.

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: How can I copy/move a file from a folder to another with RGSS? I've been trying to do this but I can only find Ruby answers. I'm trying to move or copy a file from, say, Game Directory/Graphics/Pictures/file.png to Game Directory/file.png. How can I do this in RGSS?

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: What's the difference between Destroy() and SetActive(false)? I read about both methods in Unity and wanted to ask about which was the best in efficiency : destroying the object or deactivating it. What is the performance difference?

sentences:
Getting more particles in engine I followed rbwhitakers tutorial on making a particle engine and I'm wondering how to get more particles on the screen. I was thinking that the "total" variable would do it but it doesnt. Is this something I'm doing wrong in the method or a hardware problem?

private Particle GenerateNewParticle()
    {
        Texture2D texture = textures[random.Next(textures.Count)];
        Vector2 position = EmitterLocation;
        Vector2 velocity = new Vector2(0, 10);
        float angle = 0;
        float angularVelocity = 0;
        Color color = Color.LightSkyBlue;
        float size = (float)random.NextDouble();
        int ttl = 100;

        return new Particle(texture, position, velocity, angle, angularVelocity, color, size, ttl);
    }

    public void Update()
    {
        int total = 100;

        for (int i = 0; i < total; i++)
        {
            particles.Add(GenerateNewParticle());
        }

        for (int particle = 0; particle < particles.Count; particle++)
        {
            particles[particle].Update();
            if (particles[particle].TTL <= 0 || particles[particle].Position.Y > 550)
            {
                particles.RemoveAt(particle);
                particle--;
            }
        }
    }

Im creating rain but I want it to be really heavy rain. Right now it just looks like a heavy sprinkle...I guess I would call it.

            particleEngine.EmitterLocation = new Vector2((float)rand.NextDouble() * (graphics.GraphicsDevice.Viewport.Width), 0);

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 determine what difficulty is right for the game? I am targeting mass casual audience as I am developing the hyper-casual game. The problem is that I have played Helix Jump and Color Bump 3d and those games have a pretty big difference in difficulty level (well at least for me). They are both considered hyper-casual, both target mass casual audience and both have market success.

If two so similar games have such decent difference in difficulty how to determine that the difficulty of my game is just right? It's easy to say that it's subjective but when you invest so much time in your project you need to have at least some benchmark to work with. How to define this benchmark?

sentences:
Loading maps on HTML5 Games I was wondering if my 2D Pixel Art platformer HTML5 game(a lot of words there..) should have loading screens for maps.

My game has different maps and I don't know if a loading screen should be implemented to transition to those maps, they are already loaded when the page finished loading right?

The framework I am using is Phaserjs.

Thanks for your help :')

sentences:
How do I design very difficult games? I would like to design games with very high difficulty levels. I have read these questions:

How is game difficulty tested/balanced?
What is an optimum failure rate that will keep people coming back to my game?

Yet they focus on general game design and balance, and not on the particular topic of increasingly adding to the difficulty of a game.

I understand that difficulty is different for every game, so I would like to know if there are any general guidelines I could follow to avoid falling into common problems that there may be while designing games and levels on the hard side of the difficulty line, regardless of the genre of the game.

Some sub-questions that come to mind are:

How to ensure 'beatability' while designing insanely hard parts of game?
How to know it is possible to actually beat my game?

For instance, when designing a platformer, I could make a really hard sequence of jumping and dodging. Now, as developer, I know precisely how far the player character can jump, how fast projectiles are moving etc, but how can I ensure that the designed level is actually beatable?

I know that the most obvious answer is to try and play it, but then, the game would be only as hard as how good at playing it the developer is.

Does anybody with actual experience making hard games know of any tricks or guidelines I can use to successfully create a difficult game?

sentences:
How do I take 2D ballistic trajectory planning and apply it to 3D? I am currently using this formula

speed = sqrt((gravity.y*target.x^2)/(2*cos^2(angle)*(target.y - target.x*tan(angle)))

provided by DMGregory as an answer for my question here to determine the speed of a trajectory given an angle and start/end points. So now I need to be able to apply this to a 3D scenario. How would I go about doing that?

sentences:
Java heart based health mechanic so I've made a basic game in java w/ LWJGL 2 and Slick. Right now Im working on the hud and health system. I'm kindof trying to get a minecraft like health system, 15 hearts for health,but I want the health to change from level to level.
Right now Ive got this:

    int z = (int) (Math.floor(hp/15)); // this is how many hearts are being drawn
    for(int k = 0; k < z; k++){
        if(z >= 15){
            z = 15; // here it says that it can't draw more than 15 hearts
        }
        g.drawImage(heart, x + k * 32, y); // it draws the hearts with some distance inbetween each heart
    }

I'd be happy if I get some suggestions on how could I add half a heart "mechanic", like if I have 30 max health and 15 hearts (allthought rightnow I have 200 hp, I wanna work with bigger numbers :P) that would mean that If I had 15 health it should draw 7 full hearts and 1 half heart. I don't exactly know how to do that. If you can please do help :D. Thank you

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:
Which platform and what strategies can I use There's this game, that I've been wanting to make for quite some time. It's a project that I've started and had to abandon in the middle a couple of times. However, this time I'm determined to finish it. I want to make a RPG (tile based) game, I'm okay with having it be 2D but am considering something in the middle of 2D and 3D. I would also like the game to be at least partially multilayer if not an MMO. I'm not a bad programmer, so I can work my way through any problems I might come across, I just don't have any experience making games, so I'm interested in any technologies I can use that I might not yet be aware of, or what type of architecture I can implement and what strategies I can use to make a decent (and secure game).

I made this game (2D tile based and partially multiplayer) before using MySql, PHP and JavaScript/Ajax. But now I would like it to be a bit more advanced with fluid graphics, and multiplayer where user's (or at least friends) can explore the maps together.

My first thought was to use Flash, PHP and MySql. Where Flash calls to a php file that returns an xml object with coordinates and etc., but I'm not sure how fast or efficient this will be.

With all that said, I'm wondering if anyone has any suggestions to what other technologies are out there that I can use. I would prefer that the game is browser based, but if it has to be run on the desktop I would like it to be at least cross-platform. I am familiar with HTML, JavaScript/jQuery, PHP, Flash, C#, WPF/XAML already and would prefer a combination of what I already know, but I don't mind learning something new either.

Any helpful links on this are appreciated as well.

Thanks in advance!

sentences:
Achieving Retro Resolution with HD I couldn't really find any tips on this (or perhaps I just lack the proper words once again), but I'm thinking about how to get some retro looks (SNES 16 Bit, specifially) using a modern system. Basically, the game still runs with the native resolution, however, vertially and horizontally we're limited to 256x224 (512x448). The colour palette is not an issue nowadays.

So I basically came up with this idea and am wondering if it's a smart approach (using OpenGL):

Create Orthogonal Projection Matrix with 256 units width and 224 units wide.
Use a fragment shader that doesn't do anti-aliasing on the textures, so the textures are upscaled to look pixel-y.

Since I couldn't really find a shader for 2), I also came up with a plan b):

Same as 1a)
Don't use textures at all, replace pixels with 1x1 coloured quads, convert spritesheets to 3D models made of quads.

I think plan a) seems more realistic, however. But I do wonder how other games (Shovel Knight, Freedom Planet) approach a pixel-y, retro look that stays true to the systems of 20 years ago.

sentences:
What is Vulkan and how does it differ from OpenGL? Khronos Group (the standards body behind OpenGL) has just announced Vulkan:

  Vulkan is the new generation, open standard API for high-efficiency access to graphics and compute on modern GPUs. This ground-up design, previously referred to as the Next Generation OpenGL Initiative, provides applications direct control over GPU acceleration for maximized performance and predictability.

Their page is quite marketese/jargon-heavy, as is the press release… In simple terms, what does Vulkan mean to game developers? (Gabe Newell is quoted as being strongly in favour, without further explanation.)

What exactly is Vulkan's relationship to OpenGL? Its previous name "glNext" (short for "Next Generation OpenGL Initiative") makes it sound like a replacement.

Update: The Vulkan 1.0 spec was released on 16-02-2016.

sentences:
Google Play Game Services Detecting Top 3 Players I used Google Play Services Leaderboard in my Libgdx game. This is what I want to do; I would like to give awards to the best 3 players in this table. How can I help you?
It automatically connects to the Google Play Services Leaderboard and I can show players' information in the game.
Please help

sentences:
Different way to pass uniforms to seperate draws in glMultiDrawElementsIndirect Given OpenGL version 4.3 and GLSL 430, what would be the best way to pass a matrix to each model in a draw call to glMultiDrawElementsIndirect?

I am thinking of going the way of a TBO and indexing it based on my own attribute passed in to each model that tells the shader which draw call it is currently on. That technique is not my favourite as I have to create another buffer for something that should be basic functionality for the type of draw call (think gl_DrawID), so I have come here to ask what I could do instead.

(gl_DrawID is not supported on my current system. Although it really should be: AMD catalyst 14.4 with OpenGL 4.4 support)

sentences:
Sidescrolling terrain 1D perlin noise I'm working on a tile based game and already got a generator working. But it doesn't seem to be smooth enough to look realistic.

Here's the code I'm using:

for (int i = 0; i < width; i++)
        {
            float y = ClassNoise.PerlinNoise1D(i, 2f, 4);
for(int j = 2048+y;j<height;j++)
{
  tiles[i][j] = new Tile(i,j);
}
}

public class ClassNoise
{
    public static float Noise(int x)
    {
        x = (x<<13) ^ x;
        return (float) ( 1.0 - ( (x * (x * x * 15731 + 789221) + 1376312589) & 0x7fffffff) / 1073741824.0);
    }
    public static float PerlinNoise1D(float x, float persistence, int octaves)
    {
        float total = 0;
        float p = persistence;
        int n = octaves - 1;

        for (int i = 0; i <= n; i++)
        {

            float frequency = (float) Math.pow(2, i);
            double amplitude = Math.pow(p, i);
            total += InterpolatedNoise(x * frequency) * amplitude;
        }

        return (int) total;

    }

    private static float InterpolatedNoise(float x)
    {
        int integer_X = (int) x;
        float fractional_X = x - integer_X;

        float v1 = SmoothNoise1D(integer_X);
        float v2 = SmoothNoise1D(integer_X + 1);

        return CosineInterpolate(v1, v2, fractional_X);

    }

    public static float CosineInterpolate(float a, float b, float x)
    {
        float ft = (float) (x * Math.PI);
        float f = (float) ((1 - Math.cos(ft)) * 0.5);

        return a * (1 - f) + b * f;
    }
    public static float SmoothNoise1D(int x)
    {
        return Noise(x)/2  +  Noise(x-1)/4  +  Noise(x+1)/4;
    }

}

How can I make this terrain generator smoother?

EDIT:

It currently looks like this (The terrain on the screenshot isn't the full terrain it's just the terrain on the screen):

sentences:
Creating Animations Without Hardcore Art for 2D Action RPG I'm working on a 2D action RPG. One of the issues I run into is art; in the vein of Flash games like FF7, Secret of Mana, or Epic Battle Fantasy, I would like to actually display the weapon with the player while they're walking around, and swap it out with a different image when they change weapons.

As a simple example, if I have a bronze and gold sword, when walking around, attacking, etc. you would see the bronze or gold sword image accordingly. This is an oversimplifcation, because I'm not sticking to only recolouring based on the weapon; I may actually change the design (not 100% sure about this yet).

As such, my core question is: how can I design this to minimize the amount of artwork I need to make for each weapon?

It seems like I need to create standardized weapon sizes (eg. 18x36px sword), positions relative to the character to show them for each frame, and I need to create a sprite-sheet for each frame. (I have four directional images for walking, each with four frames of animation.)

This means, per weapon, I need another 4x4 frames of animation; that's a lot (for a non-artist like me). The other approach would be programmatic animation; but how will that work? I have to worry about:

Positioning must be always similar for each weapon (different sizes?)
Occlusion; the whole weapon appears when looking down, but most of it is hidden when looking up; how can I standardize this?

For reference, see (really) FF7; they did a fairly decent job of this, albeit in 3D.

Sample:

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:
Infinite loop of prerendered 3d graphic I have a game where I want a never ending pathway for the character to walk along. So in my 3d modeling tool I created a path like this:

now I want to loop that model over and over in my prerendered 2d game for the character to walk on (most of the other game elements are in 2d). The problem is that simply overlaying one image on top of another results in the tiles facing opposite directions. Here's another picture I slapped together so you'll get the idea. In the final game the outer border of the pathway won't separate the two paths.

as you can see, the tile pattern looks unnatural, like one pathway segment is a mirror of the other. How can I change the lens/render the model differently so that it can become a seamlessly looping 2d texture?? Can it be done using only the camera view, without a "quadrilateral reshape" or falsely stretching the back end of the platform in my 3d modeler?

sentences:
XNA 4: RenderTarget2D textures getting transparent on fullscreen I'm generating a Texture2D object using RenderTarget2D as in the following code

public static Texture2D GetTextTexture(string text, Vector2 position, SpriteFont font, Color foreColor, Color backColor, Texture2D background=null)
{
            int width = (int)font.MeasureString(text).X;
            int height = (int)font.MeasureString(text).Y;

            GraphicsDevice device = Settings.game.GraphicsDevice;
            SpriteBatch spriteBatch = Settings.game.spriteBatch;

            RenderTarget2D renderTarget = new RenderTarget2D(device, width,
            height, false, SurfaceFormat.Color, DepthFormat.Depth24Stencil8,
            device.PresentationParameters.MultiSampleCount, RenderTargetUsage.DiscardContents);

            device.SetRenderTarget(renderTarget);
                device.Clear(backColor);
                spriteBatch.Begin(SpriteSortMode.Immediate, BlendState.Opaque);
                if (background != null) spriteBatch.Draw(background, new Rectangle(0, 0, 70, 70), Color.White);
                spriteBatch.End();
                spriteBatch.Begin();
                spriteBatch.DrawString(font, text, position, foreColor, 0, new Vector2(0), 0.8f, SpriteEffects.None, 0);
                spriteBatch.End();
            device.SetRenderTarget(null);
            ResetGraphicsDeviceSettings();
            return (Texture2D)renderTarget;
}

It's working all fine. But when I ToggleFullScreen() (and vice-versa), the previous textures are getting transparent. However, the new textures after that are being generated correctly.

What can be the reason for this?

sentences:
How can I deal with actor translations and other "noise" in third-party motion capture data? I'm working on a game, and I've run into a problem with motion capture data. My team is using 3DS Max 2011 and trying to put free motion capture files on our models.

The problem we're having is it has become extremely hard to find motion capture data that stays in place. We've found some great motion captures of things like walking and jumping but the actors themselves move within the data, so when we attach these animations to our models and bring them into XNA, the models walk forward even when they should technically be standing still (and then there's also the problem of them resetting at the end of the animation).

How can we clean up, at runtime or asset-processing time, the animation in these motion capture files?

sentences:
What's the best control scheme for an arena shooter on a touchscreen phone? I am developing Android an game. It's going to be a top-down shooter with stealth features. I am now thinking about how to the make controls. Most top-down games are now twin stick (joystick on the left and right sides) but I need more buttons (for choosing weapons, commanding your squad, and using skills).

So here are my ideas:

Two (virtual) sticks like in other games, when you tap somewhere on the display, a circle with buttons appears, where you can choose abilities or weapons.
One stick on the left side for walking, shoot where the second finger is pressed, weapons and skills on the right side.

What do you think is the best? Or do you have any other idea? I want to choose the most intuitive and simplest.

sentences:
Clicking in a UI Button activate another I'm new to unity and creating my first game to learn more about it. Now i got a problem wich i click on a button and sometimes another button active, for example: i press "Options" on pause menu and it active "Restart" or the "Main Menu".
if someone can help me, I appreciate it.
I set them up like this, if there's any error or need more info please let me know. And in the first image i tried split in 2 canvas, but didn't work.
P.S.: It happens even with buttons with no actions or scripts on them.

public void OnPause()
{
    Time.timeScale = 0;
    isPaused = true;
    unPauseButton.SetActive(true);
    pauseButton.SetActive(false);
    PauseGameMenu.SetActive(true);

    GameObject.Find("PowerUpSpawner").GetComponent<PowerUpManager>().enabled = false;

}
public void UnPause()
{
    Time.timeScale = 1;
    pauseButton.SetActive(true);
    unPauseButton.SetActive(false);
    PauseGameMenu.SetActive(false);
    GameObject.Find("PowerUpSpawner").GetComponent<PowerUpManager>().enabled = true;
    isPaused = false;

}

sentences:
2D Hitboxing on an HTML image I want to make a turn-based game where the player is given "opportunities for attack." An image of the in-game sprite character appears when it's the player's turn to attack. The player can mouseover the various parts of the image, which will highlight that specific body part, like so:

The player can then choose to attack that given body part.

To do this, I was thinking of adopting the "grid" method, and put my image within a 2D array... with each region of the body mapped to a certain square, like so:

Or, I could generate a pixelated version of the in-game sprite within a grid to begin with, so I would already have the mappings, like so:

Minecraft Pixel Art

I'm not sure:

how to partition the image up so that each section is represented meaningfully in the matrix
if this is the right way of doing this

Any guidance would be helpful

sentences:
How to blur entire scene but a specific spot in Unity? What I want is basically: A way to blur every object/sprite on the scene, but have a "blur-free" circular zone, that can move. And everything that's behind that circular zone won't have the blur effect applied to it.

In a 2D mobile game, how would I do that, especially in a way that's not too heavy, performance-wise(if possible).

And if it's not possible to do that in a way that won't completely destroy my performance, I also have those sprites already "pre-blurred" so maybe there's a way to have both blurred and "unblurred" objects at the same position, and only draw the right parts of them as they go through the scene and reach the blur-free zone. If there's a way to do that, that'd also help immensely.

Thanks for your time.

sentences:
How to enable the option "edit physics shape" in the Sprite Editor? I can successfully import .png files, create tilesets, and use them in my tilemaps in Unity.
Thanks to DMGregory, I just learned that there exists an option to customize the Tilemap Collider 2D in the Sprite Editor, which allows me to set a custom collider for every tile instead of going through them one by one.

The steps I follow while creating a tileset in Unity is as follows.

Import the .png file.
Open the Sprite Editor.
Select the option Multiple for Sprite Mode.
Select Slice from the Sprite Editor.

Then, I create a Tile Palette in a folder, drop and drag my created tiles, and start creating my level.

I have never encountered the option to modify the colliders tile by tile. What am I doing wrong?

sentences:
How to generate portal zones? I'm developing a portal-based scene manager. Basically all it does is to check the portals against the camera frustum, and render their associated portal zones accordingly.
Is there any way my editor can generate portal zones automatically with the user having to set the portals themselves only? For example, the Max Payne 1/2 engine ("Max-FX") only required to set the portal quads, unlike the C4 engine where you also have to explicitly set the portal zones.

sentences:
What causes this graphics quality difference between WebGL Build and Unity 5 Editor? The Editor version and WebGL version of my Minesweeper clone have some graphics quality differences. I chose 'Fast' option when building this deployment.

Is this the difference between 'Fast' and 'Fastest' options of Optimization Level in Build Settings, meaning that if I choose the 'Fastest' option, the WebGL deployment will be the same as Editor version, unlike below? If not, why this happens?

sentences:
Using Bullet physics engine to find the moment of object contact before penetration I would like to use Bullet Physics engine to simulate the objects in 3D world.

One of the objects in the world will move using the position from 3D mouse control. I will call it "Mouse Object" and any object in the world as "Object A"

I define the time before "mouse object" and "Object A" collide as t-1
The time "mouse object" penetrate "Object A" as t

Now there is a problem about rendering the scene because when I move the mouse very fast, "Mouse object" will reside in "Object A" before "Object A" start to move. I would like the "Mouse Object" to stop right away attach to the "Object A". Also If the "Object A" move, the "Mouse object" should move following (attach) the "Object A" without stop at the first collision take place.

This is what i did

I find the position of the "Mouse Object" at time t-1 and time t.  I will name it as
pos(t-1) and pos(t)

The contact time will be sometime between  t-1  to t, which the time of contact I name it as t_contact,  therefore the contact position (without penetration) between "Mouse object" and "Object A" will be  pos(t_contact)

then I create multiple "Mouse object"s  using this equation

pos[n] = pos(t-1) *  C * ( pos(t) - pos(t-1) )   where  0 <= C <= 1

if I choose C = 0.1, 0.2, 0.3,0.4..... 1.0, I will get  pos[n] for 10 values
Then I test collision for all of these 10 "Mouse Objects" and choose the one that seperate between "no collision" and "collision".

I feel this method is super non-efficient. I am not sure the way other people find the time-of-contact or the position-of-contact  when "Object A" can move.

sentences:
Redundant checks from spatial partitioning A simple 2D grid partition system for collision detection divides space into equal-sized tiles. Colliders then map themselves to tiles with their bounding box in O(1) time. Collision detection only has to be performed between objects that occupy the same tile(s).

Collision detection is expensive so the more culled, the better. With a grid partitioning system, how are collisions culled when colliders share multiple tiles?

For example, Circle_A and Circle_B both sit on the edge between Tile_1 and Tile_2. Iterating both tiles would make collision detection between Circle_A & Circle_B run twice.

A global pair hashtable seems performance expensive since it has to be cleared every frame. Tracking pairs inside colliders takes a lot of memory. How do you mitigate redundant pairs when iterating through partition grid tiles?

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:
New game shows up as an update instead of a release I'm not sure if this is the right place to ask this sort of question but since there is a google-play tag...

I've just released a new game (my first one actually) two days ago. And I've just noticed that it showed up as an update instead of a freshly released game: Under ADDITIONAL INFORMATION section on the listing page it shows Updated instead of Released. I don't know how that happened and I'm worried it may affect the relevance of the game on the store. Is there any way to fix this issue? Am I right about worrying about the relevance of the game?

Link to the listing page of the game: Google Play link.

EDIT:

To clear any confusion, I'm not talking about people seeing the install/update button when they are about to install/update the game. I'm talking about the game release dateitself. The game shows up as an update from the Google Play Console as if it was released before. Me publishing the game for the first time was interpretted as updating an already released game, why?

sentences:
Dot Product Vs Cross Product Turning a Turret Towards A Enemy and firing http://pastebin.com/iw9DHf7s is code demonstrating dot product turning a turretto a target and firing. It works and chooses best angle to spin.

A problem can occur when game goes faster (better computer) and that threshold no longer applies. Making the threshold bigger obviously stops the turret early.

My friend mentions cross product is the way to fix it. Then he disappears for long periods of time. Doesn't dot product NOT get a inner angle between two vectors? Ok lets just say I agree and dot product doesn't work ever.

So tell me how does vector product do the trick? I'm going from a single scalar that I can get degrees out of to a third orthogonal vector. I've read about cross product and the function and watched a you tube video and I don't get (given the same code pasted) how to use cross product here.

Update:
Would this work?

//towerFacing is the at/forward vector of the cannon
Vector v1 = cannonPos - targetPos ;
Vector v2 = towerFacing - cannonPos ;

//The z plane
double cross = v1.x*v2.y - v1.y*v2.x ;
if (cross > 0) { return Direction.Left ; }
if (cross < 0) { return Direction.Right ; }

Obviously the zero is not what we want to use in games. However The difference is now our zero means our at vector and target is perpendicular and on each other which a x b = 0. The dot product since it uses cosine I used the right vector which is orthogonal with the facing( a . b = 0).

Am I wrong on how the cross product works by what has listed for answers still?

sentences:
Does Direct3D 11 enable Z-clipping/discard by default? I'm rendering simple 2D figures in DirectX 11.1 and I cannot get Z-values to be rendered; all pixels with Z != 0 get discarded. I'm doing proper world transform as far as I know. X/Y translations work. Rotation over Z works.

Do I need to setup a depth/stencil buffer to avoid DirectX to discard all primitives with Z coordinates?

Thanks, I'll supply any additional information ,code or screens if required.

EDIT:

I've fixed D3D11_VIEWPORT minDepth and MaxDepth members to 0.0/1.0 (I was clearing both to zero). Now pixels with 1.0 < z < 0.0 are discarded.

EDIT 2:

My platform is Windows Runtime App (Win8.1 / WinPhone 8.1).

EDIT 3:
Example screenshots.

Rotated triangle over the Y-axis (pixels with Z>1 discarded)

Triangle Vertex at (x=-0.5,y=-0.5) with z=2. Clipped and hidden.

sentences:
Updating settings UI from script also triggers method to update settings from UI interaction My application has a UI for settings which is a mixture of textboxes and scrollbars with which users can interact. I have created a class for these settings and create an object to store them. The user can also give command line arguments to apply settings from a file.
I have a function that loads this data into the UI from the object (i.e read from a file) and another function that changes object data when user make changes to the UI.
My problem is: if I load the data from file into UI, the function responsible to reflect these changes in the UI fires up but the other function also fires up because changes were made to the UI.
So what should I do to overcome this? Should I implement some kind of state mechanism that would tell code that user has made the changes, or setup some flag which will mark that the data is loaded from a file. If you can suggest some design patterns to follow?

sentences: Stop music in crafty.js How do I stop a looping music file from playing in crafty.js? I want the music to stop playing once a gameover condition has been reached.

sentences:
Can I use the ENet library in a commercial game? I have some problems understanding ENet's license. It's not the zlib license as far as I know, but it seems like it's not GPL either. I'm not a native English speaker and I can't understand what the license exactly is.

Can I use ENet for a commercial game? If yes, do I need to mention that I used ENet and do I need to deliver ENet's license with my game?

I have no problem with mentioning that I use ENet in my credits, but ENet's license delivering thing seems just stupid and not-understable to me.

sentences:
What is a normalized Vector? Can someone explain the following code? I need to learn what each part means so I can turn it into enemy movement in a space shoot-em-up

Vec2d playerPos;
Vec2d direction; // always normalized
float velocity;

I get the above is naming two 2d Vector objects, and creating a variable called velocity. I'm not sure what the normalized comment is about, though.

update()
{
   direction = normalize(playerPos - enemyPos);
   playerPos = playerPos + direction * velocity;
}

sentences:
Styles of games that work at low-resolution I'm taking a class on compilers, and the goal is to write a compiler for Meggy Jr devices (Arduino). The goal is just to make a simple compilers with loops and variables and stuff.

Obviously, that's lame, so the "real goal" is to make an impressive game on the device. The problem is that it only has 64 pixels to work with (technically 72, but the top 8 are single-color and not part of the main display, so they're really only useful for displaying things like money).

My problem is thinking of something to do on a device that small. It doesn't really matter if it's original, but it can't be something that's already available. My first idea was "snake", but that comes with the SDK. Same with a side-scrolling shooter.

Remaining ideas include a tower defense game (hard to write, hard to control), an RPG (same), tetris (lame)..

The problem is that all of the games I like require a high-resolution screen because they have a lot of text. Even a really simple game like nethack would be hard because each creature would be a single color.

tl;dr What styles of games require a. No text; and b. Few enough objects that representing them each with a single color is acceptable?

EDIT: To clarify, the display is 8x8 for a total of 64 pixels, not 64x64.

sentences:
Determine if Plane is seen by Camera If I have an arbitrary plane (center and normal) or a quad (center, normal and width and height) and a camera (frustum, projection & view matrix, etc). Then how would I go about calculating if the plane/quad is visible to the camera?

Additionally how would I calculate to check if it's the front or the back of the plane/quad that is visible to the camera?

My first idea was to do some ray vs plane intersection, but then I realized that it of course wan't going to work!

bool plane_visible = false;
const float denom = plane_normal.dot(camera.getLook());

if (abs(denom) > 0.0001f)
{
    const float t = (plane_position - camera.getPosition()).dot(plane_normal) / denom;

    plane_visible = (t >= 0.0f);
}

Using the dot product of the plane/quads normal and the camera's look direction. Will give wrong results!

For instance, use the following image as an example! A dot product will tell me that I'm looking at the face that's facing outwards of the frustum. Though the face that I'm actually looking on is face facing inwards the frustum/towards the camera!

sentences:
Planet Surface Rendering: Precision issues I have been experimenting with C++ and OpenGL, and I am currently writing a program that renders the surface of a planet; specifically, our moon. It's a modified version of the GPU Gems implementation of Geometry Clipmaps which is normalized to the unit sphere and then offset by a heightmap in the terrain's vertex shader. On small scale scale this works rather well:

However, I want to scale this up to the size of the actual moon. Unfortunately, when I do so, stepping artifacts appear:

Now I am (almost) certain that this is simply an issue with floating point precision; 32-bit floats just simply don't have enough precision for planets of this size. However, I am in an interesting situation where I cannot simply change one of my numbers to a double to gain more precision. My vertex shader code is this:

layout (location = 0) in vec3 VertexPosition;

uniform mat4 MVP; //projection and camera rotation matrix
uniform mat4 PLM; //scale and translation matrix
uniform dmat4 SurfaceRotationMatrix; //transforms vertices to be the correct position on surface

uniform samplerCube bump_map; //heightmap cubemap

uniform dvec3 PlayerLocation;

uniform double PlanetRadius;
uniform double TerrainHeightScalar;

void main(){

    //find the world space position of the flat grid (high precision)
    dvec4 worldSpacePosition = PLM * vec4(VertexPosition, 1.0);

    ...

    //offset the y position by the planets radius
    worldSpacePosition.y += PlanetRadius;

    //vertex position in relation to camera (located at origin)
    dvec4 OriginNormal = normalize(worldSpacePosition);
    //vertex position in relation to planets surface
    dvec4 surfaceHighP = SurfaceRotationMatrix * OriginNormal;
    //also calculate surface normals at this point
    dvec4 tangentHighP = SurfaceRotationMatrix * vec4(1.0, 0.0, 0.0, 1.0);
    dvec4 bitangentHighP = dvec4(cross(surfaceHighP.xyz, surfaceHighP.xyz), 1.0);

    // vvv I think this is the problem vvv
    // dvec4 surfaceHighP has to be cast to a vec3 (float) in order for the
    // shader to compile
    double height = texture(bump_map, vec3(surfaceHighP.xyz)).x;

    //set position by multiplying the normal by the distance the point should be from the surface
    worldSpacePosition.xyz = (PlanetRadius + height * TerrainHeightScalar) * OriginNormal.xyz;

    //move the position back to the origin
    worldSpacePosition.y -= PlanetRadius;

    //offset y position by the player's height (both statements are split for best precision)
    worldSpacePosition.y -= PlayerLocation.y;

    //final position: multiply by projection matrix
    gl_Position = MVP * vec4(worldSpacePosition);
}

OpenGL's texture() function only seems to take float parameters as an input. This makes me believe that this stepping is a result of the cast down to a lower-precision vector, where the program cannot distinguish the tiny change in angle between each grid position. At first I thought it might have been a texture precision error, so I tried switching the heightmap texture to an 8-bit copy but I didn't see any difference in step size or quantity. The texture filtering is linear, so the heights should be smoothly blended between one another, and at large scales big landforms like mountains and hills seem to have no associated problems.

Can anyone confirm that this cast in the texture() call is the reason for the stepping? If so, is there a way to pass high-precision numbers into a GLSL texture call, or, failing that, a solution to this problem that doesn't involve a complete redesign? I was thinking about maybe getting a weighted average of each neighboring "step", and then linearly interpolating between them, averaging between the areas where the float breaks down. Would something like that be possible, or is there a better alternative?

sentences:
How to Color.Lerp between multiple colors? I have found it rather difficult to find a solution to this in the Unity documents.

Color.Lerp(Color a, Color b, float t) is a function that gradually changes a color according to a step t, giving it the final value of the Color b.

How do I Lerp between multiple colors one after another?

sentences:
Does AddForce continue to add force indefinitely? Does the AddForce method continue add velocity to an object forever? Does it need to be limited by another line of code?

Sorry if it is too broad or too simple; I am completely new to programming and Unity, as well as 3D development.

sentences:
How to blend textures with different size optimally? I am trying to create a 2D lighting map.

For each light source I have an Color[,] with size less than whole map and a coordinate of center. There can be many light sources and they can intersect (2 or more, so I can't just sum it).

I need to blend all light colors for every map pixel, not override.

Is there a better approach other than to loop over every light for each map pixel, get colors and mix them?

sentences:
Is it possible to tilt the canvas and have entities react to it I will try and explain this as simple as I can, let me know if you need more details and I'll edit the text.

Imagine a simple gravity-enabled 2D-game with a ball inside a room where the objective is to prevent the ball from hitting the walls of the room while the room itself is tilting from side to side. As a player you can control the ball left or right. The game is over when the ball hits one of the walls.

I have been trying to think of a way to have the ball (entity) react to the tilt of the room (canvas), specifically how to manage the acceleration, velocity and movement of the entity in respect to the tilt, but I haven't been able to find a suitable plugin or solution to this. Has anyone tried implementing this? How do you handle acceleration, velocity and movement, and would you implement the tilt in the canvas, a room entity or something else?

sentences:
Syncing game states in a multiplayer RTS game I'm working in a group with 2 friends on our Gr. 12 final project for programming. We're making a multiplayer RTS game. I've been assigned to the networking section of the game, and none of us have any experience doing network programming.

We've established that we'll have the server process everything such as path finding, build queues etc. The client will receive packets from the server, which will contain information such as HP, x, y, etc of each unit/building (Well, the server will send a packet whenever a unit/building's state such as losing HP, movements etc is changed).

The problem is identifying which unit the packet contains information for. I've thought of generating a number as an ID for each unit/building, and storing the units in a map data structure, where the key is the ID. Is there a better way to do this? How do most RTS games do it?

sentences:
How can I return the class as a Transform in the array instead of each property? public class TransformInfo
    {
        public string sceneName;
        public string name;
        public Transform parent;
        public Vector3 pos;
        public Quaternion rot;
        public Vector3 scale;
    }

Then the method:

public static TransformInfo[]  LoadTransformInfo()
    {
        string jsonTransform = File.ReadAllText(@"d:\json\json.txt");
        if (jsonTransform == null)
        {
            return null;
        }

        TransformInfo[] savedTransforms = JsonHelper.FromJson<TransformInfo>(jsonTransform);

        return savedTransforms;
    }

The return is:

But then when using it:

var test = TransformSaver.LoadTransformInfo();

Each item in the array contain the the TransfomInfo but instead I want it to return a Transform with already the info.

So I can do for example:

Transform test1 = test[0];

Instead make a loop and assign each property from the Test to the new Transform test1.

sentences: What would be the easiest way to define actions of multiple buttons So I'm creating a game that involves lots of different areas that involve pushing buttons to do certain things.  Anyway, I'm trying to figure out how to let each button do its own separate thing, like open a door or things like that.  I already know how to setup a Raycast between the player's mouse to the button, but now I'm just figuring out how to make each button trigger a separate action.  Basically, should I set up a new tag for each button?  Or create different scripts, even?  I haven't tried anything yet and I need help.  Thanks :D

sentences: Calling opengl32.DLL from java? I don't like LWJGL in some cases, so I prefer to use Swing. The thing is that Swing doesn't have OpenGL. I have tried JOGL and it's a mess to install, needs external jars, and I have yet to get it working. So I was wondering if I could just make an OpenGL class that uses opengl32.DLL and put the graphics into a window made with Swing? Also, is opengl32.DLL able to be called with a 64 bit Java program?

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: How can I make Iridescence material In unity? One of the characters of the Dota2 that Is called Nyx Assassin has an interesting material effect If you look at the body and feet you can see this effect.It looks like poily/polluted water.I like to know how can I make something like that In unity.

sentences:
texture movement stutters Hey I at the moment I have got my texture to move however it stutters as I increment by 0.001 every second.  My animation is done via FPS if that make sense and here is some code

FrameCount++;

p_Time = c_Time;
c_Time = PVRShellGetTime();

elapsed = c_Time / 1000.0f;
DT = ((float)(c_Time - p_Time)) / 1000.0f;

fCount += DT;

if(fCount >= 1.0f) //if time is over 1 second reset counters and recount
{
    FPS = FrameCount;
    FrameCount = 0;
    fCount = 0;
    move += 0.001;
    glUniform1f(m_ShaderProgram.auiLoc[eTime], move);
}

My problem is I want it to move more seamlessly and not sure how to achieve this and thought I would get some ideas from you.

Oh and here is my vertex and fragment shader

Vert

    attribute highp   vec3  inVertex;
attribute mediump vec3  inNormal;
attribute mediump vec2  inTexCoord;
attribute mediump vec3  inTangent;

uniform highp   mat4  MVPMatrix;
uniform mediump vec3  EyePos;
uniform mediump float Time;

varying mediump vec3  EyeDir;
varying mediump vec2  TexCoord;
varying mediump vec2  TexCoord2;
varying mediump float vTime;

void main()
{
    // Transform position
    gl_Position = MVPMatrix * vec4(inVertex,1.0);

    /*mediump vec2 waterCoord = inTexCoord;
    TexCoord = waterCoord.xy * waterSX;
    TexCoord += watermovementX;*/
    TexCoord = inTexCoord;
    vTime = Time;
}

and here is my frag

    uniform sampler2D  n_mapTex;
uniform sampler2D  n_mapTex2;

varying mediump vec2  TexCoord;
varying mediump vec2  TexCoord2;
varying mediump float vTime;

void main()
{
    gl_FragColor =  texture2D(n_mapTex, vec2(TexCoord.x + vTime, TexCoord.y + vTime));
}

Thanks

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: iOS gaming with copyrighted characters? Can I use animate characters in an iOS game if I do a citation in the credits. Ex Steven univers in a fighting game and I list Rebecca Sugar in the Credits or by the character bio.

sentences:
LibGDX Box2DLights shadow offset problem on bodies Hello I just started to use LibGDX, and it's awesome.
I looked at the Box2DLights library, and started to learn how the lighting work here.

I got something up:

(source: gyazo.com)

As you can see, it works, but the shadow of the sprite goes over itself, and doesn't start in the right place.

Why is it doing this? is it possible to set offsets?

This is how I initialize them:

    this.texture = new Texture("sprites/water.png");
    this.camera = new OrthographicCamera(Gdx.graphics.getWidth(), Gdx.graphics.getHeight());
    this.camera.setToOrtho(false);
    this.renderer = new SpriteBatch();

    this.map = new TileMap(20, 20);
    this.map.generateAllSame(new Texture("sprites/sprite.png"));

    this.world = new World(new Vector2(), true);

    this.createBodies();

    RayHandler.setGammaCorrection(true);
    RayHandler.useDiffuseLight(true);
    this.ray = new RayHandler(this.world);
    this.ray.setAmbientLight(0.2f, 0.2f, 0.2f, 0.1f);
    this.ray.setCulling(true);
    this.ray.pointAtLight(50, 0);
    this.ray.setBlurNum(1);
    camera.update(true);
    this.spriteLight = new PointLight(ray, 128);
    this.spriteLight.setDistance(500f);
    this.spriteLight.setPosition(150, 150);

    this.spriteLight.setColor(new Color(0.5f, 0.8f, 0.7f, 1f));
    this.spriteLight.setSoftnessLength(0);
    this.spriteLight.setSoft(true);

public void createBodies() {
    CircleShape chain = new CircleShape();
    chain.setRadius(10);

    FixtureDef def = new FixtureDef();
    def.restitution = 0.8f;
    def.friction = 0.01f;
    def.shape = chain;
    def.density = 1f;

    BodyDef body = new BodyDef();
    body.type = BodyType.DynamicBody;

    for (int i = 0; i < 3; i++) {
        body.position.x = 40 + MathUtils.random(500);
        body.position.y = 40 + MathUtils.random(500);

        Body box = this.world.createBody(body);
        box.createFixture(def);
        this.bodies.add(box);
    }
    chain.dispose();
}

And my rendering:

public void render() {
    handleInput();
    camera.update();
    Gdx.gl.glClear(GL20.GL_COLOR_BUFFER_BIT);
    renderer.setProjectionMatrix(camera.combined);

    renderer.disableBlending();
    renderer.begin();
    this.map.render(renderer);
    renderer.draw(texture, 50, 50);

    renderer.enableBlending();

    for (Body body : this.bodies) {
        Vector2 pos = body.getPosition();
        renderer.draw(texture, pos.x + amount, pos.y);
    }
    renderer.end();

    ray.setCombinedMatrix(camera.combined, camera.position.x, camera.position.y,
            camera.viewportWidth * camera.zoom, camera.viewportHeight * camera.zoom);

    ray.update();
    ray.render();

}

What did I do wrong?

sentences:
How can I make a scrollable text view? I am trying to do an appication in monogame windows. I have a long text to be displayed on screen. I tried to render it on screen using spriteBatch.Drawstring, was succesful to an extent. But, the text did not fit into a required area. I had followed this tutorial. I need a vertical scroll to be implemented to have the entire text inside my desired area. Can anyone suggest some help. This is my current code :

protected override void LoadContent()
    {
        spriteBatch = new SpriteBatch(GraphicsDevice);
        _boxTexture = new SolidColorTexture(GraphicsDevice, Color.Red);
        _borderRectangle = new Rectangle(100, 100, 500, 500);
        _textboxRectangle = new Rectangle(105, 105, 490, 490);
        _font = Content.Load<SpriteFont>("Rockwell");
        _text = "He determined to drop his litigation with the monastry, and relinguish his claims to the wood-cuting and fishery rihgts at once. He was the more ready to do this becuase the rights had becom much less valuable, and he had indeed the vaguest idea where the wood and river in quedtion were.";

    }

private String parseText(String text)
{
String line = String.Empty;
String returnString = String.Empty;
String[] wordArray = text.Split(' ');

foreach (String word in wordArray)
{
    if (font.MeasureString(line + word).Length() > textBox.Width)
    {
        returnString = returnString + line + '\n';
        line = String.Empty;
    }

    line = line + word + ' ';
}

return returnString + line;
}

and inside draw function :

spriteBatch.DrawString(font, parseText(text), new Vector2(textBox.X, textBox.Y), Color.White);

sentences: Moving non-local player from local player with Mirror Networking i am using mirror networking which is based on UNet. I can move non local objects easly by assigning their authority to the local player and move them, but i can't assign/remove authority for other player's in the game, therefore i can't directly change their velocity. Any ideas how can i change other non local player's velocity from local player ?

sentences: How do I add AndEngine documentation in Eclipse? I am very new to AndEngine. I have just downloaded the full documentation file, but I can't attach it to Eclipse. How can I do that?

sentences: Why are big files better than small files for consoles? Why do console game developers use large files to store game data instead of small files like on PC? Less streams in memory? Need to access file tree many times? Other reason?

sentences: How to avoid ai hands or any body part going inside wall or ground? (Unreal Engine4) Whenever my character get killed near wall his hands or any body part its goes through the wall making it look like half of the hands front of wall and another half through back. but i dont like it.. i want it look like modern game where if i killed him near wall it should be realistic where his body part should change posistion according to it. like lifiting his hand because he cant put his hands through wall and also i made a little mistake in my death animation making the hands below the ground so whenever he get killed his hands go through ground.. so how to make this work?

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: How do I use Ogre with CodeBlocks? I want to start writing games using ogre in combination with the CodeBlocks compiler but am struggling with the installation. I got the latest version of the compiler as well as the ogre engine from their respective websites. I have installed the compiler but cannot find my way in the integration of ogre though I read their installation guide, which I found confusing.I need clear step by step guide please.

sentences:
LibGDX Box2D Lights - Illuminate background I have a box2D world made of tiles. I use a custom DirectionalLight for light up the scene from above (It shines through transparent blocks [eg.: the water] more deeply). The problem is (as expected), as soon as I build a bridge-like thing in the air, I'll get shadows underneath. What I'd like to achieve, is to get light in the places where there aren't any blocks (i.e. neither in the foreground nor in the background).

Should I completely forget the DirectionalLight, or is there any method to easily "post-fix" these shadowed areas?

sentences:
Why is my player spinning after a collision? I've made a very simple 2D top down prototype with Unity. This is the code I use for the player:
public class PlayerTurnsController : MonoBehaviour
{
    private Rigidbody2D m_rb;
    public float Speed;

    Vector2 m_movement;

    void Start()
    {
        m_rb = GetComponent<Rigidbody2D>();
    }

    private void Update()
    {
        var moveHorizontal = Input.GetAxis("Horizontal");
        var moveVertical = Input.GetAxis("Vertical");
        m_movement = new Vector2(moveHorizontal, moveVertical);
    }

    void FixedUpdate()
    {
        m_rb.MovePosition(m_rb.position + m_movement * Speed * Time.fixedDeltaTime);
    }
}

At the start and while moving everything seems OK. But when I bump into some Colliders, the player sprite starts spinning when it should just stop (not pressing any button anymore)
I already tried:

To set the rotation only when the m_Movement-Vector is > 0.1f. But this didn't change anything.

sentences:
How do I make good guy attacks only hit bad guys and vice versa? My game has many different type of good guys and many different type of bad guys.  They will all be firing projectiles at each other but I don't want any accidental collateral damage to occur for either alignment.  So bad guys should not be able to hit/damage other bad guys and good guys should not be able to hit/damage other good guys.

The way I'm thinking of solving this is by making it so that the Unit instance (this is javascript, btw), has an alignment property that can be either good or bad.  And I'll only let collision happen if the

class Attack

    boolean didAttackCollideWithTarget(target)
        return attack.source.alignment != target.alignment and collisionDetected(attack.source, target)

This is pseudo-code, of course.

But I'm asking this question because I get the sense that there might be a much more elegant way to design this besides adding yet another property to my Unit class.

sentences: How to make a triangle move and rotate using GDI in C++ I want to make a triangle move from one place to another then rotate it 270 degrees using Polygon() function does anyone knows how to?? Just a simple one.

sentences:
How to design a drag and drop inventory system with transition from icons to game objects? I’m trying to write a simple 2D game in Unity with an inventory where the user can drag and drop different objects on the screen.

I need the inventory to contain icons which on drag will become different game objects.

I’m struggling in positioning the game object after clicking the icon and using its drag-and-drop functionality (a script component which i attached to it).

I would really appreciate some guidelines or opinions about the design because I feel I’m doing things wrong.. What do you think?

sentences:
Error saying attempting to reference a deleted function while using a vector list I’m making a 2d top down shooter game and I was working on shooting bullets. Im using a vector for the bullet in my player class:
std::vector b;
And I have coded a shoot function which shoots the bullet and deletes it if it is out of the screen:

void Player::shoot(float timer)
{
//Getting Key Press
if (Keyboard::isKeyPressed(Keyboard::Space))
{
    space = true;
}
else
{
    space = false;
}

Bullet b1;
b.push_back(Bullet(b1));

if (space)
{
    for (int i = 0; i < b.size(); i++)
    {
        b[i].setPos(pos);
    }

}
else
{
    for (int i = 0; i < b.size(); i++)
    {
        b[i].update(true);
        if (b[i].getPos().y < 0.0f)
        {
            b.erase(b.begin() + i);
            i--;
        }
    }
}
}

But I have encountered an error:
    Error   C2280   'Bullet &Bullet::operator =(const Bullet &)': attempting to
    reference a deleted function

I don’t understand why this is happening can someone explain?
Here is the bullet class
Header:

#pragma once
#include <SFML/Graphics.hpp>

using namespace sf;

class Bullet
{
private:
Texture t;
Sprite bullet;
Vector2f pos;
public:
Bullet();
~Bullet();
void setPos(Vector2f pos);
void move(bool up);
Sprite getSprite();
Vector2f getPos();
};

Cpp file:
    #include "stdafx.h"
    #include "Bullet.h"

Bullet::Bullet()
{
//Setting Texture
t.loadFromFile("Graphics/bullet.png");
bullet.setTexture(t);

}

Bullet::~Bullet()
{
}

void Bullet::setPos(Vector2f pos)
{

//Setting Position
this->pos = pos;
bullet.setPosition(this->pos);
}

void Bullet::move(bool up)
{
if (up)
{
    bullet.move(0.0f, -10.0f);
}
else
{
    //TODO
}
}

Sprite Bullet::getSprite()
{
return bullet;
}

Vector2f Bullet::getPos()
{
return pos;
}

sentences:
Get the XZ to the right of a rotated point? I need to do this entirely with math, take a look at this picture:

What I'm doing is building a path finder algorithm that basically looks 30 units ahead, raycasts a few times perpendicular to the future point, finds the midpoint between the min/max vectors that found the dirt road, and puts a green cube in the middle.

I thought this would be rather simple, yet here I am trying to figure out how to plot the exact geometry of a rotated left/right projection.

I hope I explained this well enough!  I'm also open to suggestions on how to do this if my approach is silly.  Eventually this path will split and the algorithm has to detect the split and have the user decide which direction to go.

EDIT: After applying the math below (I opted to use the trig version) I go this result on my algorithm.  THANK YOU!!!

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:
Inserting into the first available inventory slot Hello my inventory system picks up one item but does not pickup any more to fill the other two slots. It is saying the whole inventory is full when it should be one slot is full.
Here is my code for the inventory and this is attached to the player.
public class MedInventory : MonoBehaviour
{
    public bool[] isFull;
    public GameObject[] MedkitSlot;
    public GameObject[] BandageSlot;
    public GameObject[] CoffeeSlot;
}

This next script is attached to the items you pickup.
    public class MedPickup : MonoBehaviour
{
    private MedInventory medInv;
    public GameObject itemButton;
    private void Start()
    {
        medInv = GameObject.FindGameObjectWithTag("Player").GetComponent<MedInventory>();
        itemButton.SetActive(false);
    }

    void OnTriggerStay2D(Collider2D other)
    {
        if (other.CompareTag("Player"))
        {
            GameObject[] targetSlot = new GameObject[0];
            bool validItem = true;

            switch (gameObject.tag)
            {
                case "medkit": targetSlot = medInv.MedkitSlot; break;
                case "bandage": targetSlot = medInv.BandageSlot; break;
                case "coffee": targetSlot = medInv.CoffeeSlot; break;
                default: validItem = false; break;
            }

            if (validItem)
            {
                for (int i = 0; i < targetSlot.Length; ++i)
                {
                    if (!medInv.isFull[i])
                    {
                        medInv.isFull[i] = true;
                        itemButton.SetActive(true);
                        Instantiate(itemButton, targetSlot[i].transform, false);
                        Destroy(gameObject);
                        break;
                    }
                }
            }
        }
    }
}

sentences:
Can I use Havok Physics for free in my game? I found out that Microsoft purchased the Havok physics engine. Where can I get it for Windows Visual Studio 2015 Community?

I tried to look around, but I could not find anything for the latest version. There are no download links at both the official website, nor on the Microsoft site.

What do I need to do to use Havok in my own game?

sentences:
Best way to create icon for UI , based on 3d model player can use in game I'm trying to figure the best way to create icon (for UI) from my 3d model (object) that player can use in the game.
Maybe this is a silly question, but: how do you create icon ?
Do you create a new scene, place object and use a "shift-print" to take screenshots ?

Others way ?

Thanks

sentences:
NavMeshAgent.CalculatePath produces a PathInvalid result Anyone know what can cause NavMeshAgent.CalculatePath to return false and give a path with PathInvalid status?

I have two characters; each character has a NavMeshAgent.  Character x is a standard Humanoid, character Y is a vehicle with a custom agent type.
Characters start out in scene A, which has two NavMeshes, one for each type, and both are able to navigate just fine.
Characters get moved to DontDestroyOnLoad so that scene A can be unloaded and scene B can be loaded.
Scene B has two NavMeshes, one for each type.
Characters are placed on the ground, on a valid NavMesh location.
NavMeshAgent is asked to path to another valid location on the NavMesh.  Character Y (the weird one) paths just fine, but for character X, the call to CalculatePath fails and the NavMeshPath object's status is PathInvalid.

I honestly have no idea what's going on here.  If anything, I'd expect pathing to work for X and fail for Y, due to it being a nonstandard (and larger) agent.  Not sure if the scene change is relevant or not; including it just in case it is, and to show that the basic setup is working for 3/4 scenarios here.
Anyone know how to go about debugging this?

sentences:
How can I make a sprite slow down to the speed of another sprite while following it? I'm making a SpriteKit game where two SpriteNodes are in a maze. That maze is represented as a grid. One sprite (A) travels faster than the other (B). Items randomly pop up, and the sprites have to collect them.

Pathfinding is easy (GKGridGraph is simple to use).

Here's the problem: At any given time, A and B could be on the same stretch of the maze. If A is behind B, I want A to be forced to go the same speed as B (cannot pass through or around). How can I accomplish this?

Thank you for your time!

sentences:
Locking frame rate to 60 in the editor My game runs at several hundred frames per second. I want to limit it to 60. So I used

    Application.targetFrameRate = 60;

This works on the iPhone. But in the editor it only reduced the frame rate to around 80-90. Am I missing yet another setting?

Mac OSX Mavericks.

sentences:
Trying to bounce a box with a plane using bullet physics I'm trying to simulate a box that bounces with a plane and I'm beginner with bullet physics. I created a plane (box) and and a box that is falling. The problem is the ball is stalled while colliding with the plane and doesn't rotate (no bouncing effect), even if the box is rotated so that it can sharply bounce with the plane. Here is my configuration.

// in update
if (m_pBoxMotionState)
    {
        btTransform transform;
        // get the world transform from our motion state
        m_pBoxMotionState->getWorldTransform(transform);

        btQuaternion quat;
        quat.setEuler(0, 290, 0); //or quat.setEulerZYX depending on the ordering you want
        transform.setRotation(quat);

        XMMATRIX world = btTransform_to_XMMATRIX(transform);
        m_Cube->Draw(world, m_Graphics.getViewMatrix(), m_Graphics.getProjectionMatrix());
    }

// Init
    m_Grid.CreateGrid(360.0f, 360.0f, 50, 50); // width*depth, 360*360
    m_Grid.SetPosition(1, -90, 1);
    m_Cube = GeometricPrimitive::CreateCube(m_Graphics.getContext(), 5.0f, false);

      m_pCollisionConfiguration = new btDefaultCollisionConfiguration();
            // create the dispatcher
            m_pDispatcher = new btCollisionDispatcher(m_pCollisionConfiguration);
            // create the broadphase
            m_pBroadphase = new btDbvtBroadphase();
            // create the constraint solver
            m_pSolver = new btSequentialImpulseConstraintSolver();
            // create the world
            m_pWorld = new btDiscreteDynamicsWorld(m_pDispatcher, m_pBroadphase, m_pSolver, m_pCollisionConfiguration);
            m_pWorld->setGravity(btVector3(0, -10, 0));

            btBoxShape* pBoxShape = new btBoxShape(btVector3(1.0f, 1.0f, 1.0f));
            // give our box an initial position of (0,0,0)
            btTransform transform;
            transform.setIdentity();
            transform.setOrigin(btVector3(0.0f, 50, 0.0f));
            pBoxShape->calculateLocalInertia(4, btVector3(0, 0, 0));
            // create a motion state
            m_pBoxMotionState = new btDefaultMotionState(transform);
            // create the rigid body construction info object, giving it a
            // mass of 1, the motion state, and the shape
            btRigidBody::btRigidBodyConstructionInfo rbInfo(4.0f, m_pBoxMotionState, pBoxShape);
            btRigidBody* pRigidBody = new btRigidBody(rbInfo);
            pGroundShape->calculateLocalInertia(0, btVector3(0, 0, 0));
            btBoxShape* pGroundShape = new btBoxShape(btVector3(360, 1,360));
            btTransform groundShapeTransform;
            groundShapeTransform.setIdentity();
            groundShapeTransform.setOrigin(btVector3(1.0f, -90.0f, 1.0f));

            // create a motion state
            m_pGroundMotionState = new btDefaultMotionState(groundShapeTransform);
            btRigidBody::btRigidBodyConstructionInfo rbGroundInfo(0, m_pGroundMotionState, pGroundShape);
            rbGroundInfo.m_friction = 1.0f;
            rbGroundInfo.m_restitution = 1.0f;
            btRigidBody* pRigidBodyGround = new btRigidBody(rbGroundInfo);

            // inform our world that we just created a new rigid body for
            // it to manage
            m_pWorld->addRigidBody(pRigidBodyGround);
            m_pWorld->addRigidBody(pRigidBody);

sentences:
How to create levels (tile maps) I am new to game programming and I am having so much hard time learn on my own. My goal is to make a game with different levels.

so far my plan:
i have 2 classes
1 - main.java
2 - level_01.java
3 - more levels if i want

in my level_01.java:
1- make 2d array of map(done)
2- Do i need to store the make in arraylist or list?????
3- print in paint method?

public class level_01 extends levels
{
    private int map01[][] = {{0,0,0,0,0,0,0,0,0,0,0,0,0,0,0},
                             {0,0,0,0,0,0,0,0,0,0,0,0,0,0,0},
                             {0,0,0,0,0,0,0,0,0,0,0,0,0,0,0},
                             {0,0,0,0,0,0,0,0,0,0,0,0,0,0,0},
                             {2,2,2,2,2,2,2,0,0,2,2,2,2,2,2}};

    //Is a good idea to store this map in list or arraylist?
    //if yes should I use ArrayList or list?
    //or should i just print the right now?

sentences:
Why code reflection became a must in game engines? I'm currently doing some research on programming languages(compile time reflection area, if you ask) and I found that on the game engine area the reflection feature becomes a must, an engine either uses a language which has reflection feature itself(for example uses C#), or implements it for non-reflection languages(for example both UE and CryEngine implement reflection mechanisms for C++).

I'm not a game developer, so I have no experiences on game developing and not familiar with engines, so can anyone tell me in what case the reflection becomes a must? And what's more, does reflection used only in development phase or also used in released production?

sentences:
How can I increase the speed and frequency of a spawn? I'm using the official Unity tutorial for the Space Shooter game, and I'm at the part where the ability to spawn a set amount of hazards in a wave at a certain delay is introduced.

I want to make it so that at the end of a certain level, the speed of the hazards, and the amount of hazards both increase. I'm pretty sure that can be handled in the game controller, but I don't know the commands I would be needing to use to make that happen. This is the existing code:

public class GameController : MonoBehaviour
{
    public GameObject hazard;
    public Vector3 spawnValues;
    public int hazardCount;
    public float spawnWait;
    public float startWait;
    public float waveWait;

    void Start ()
    {
        StartCoroutine (SpawnWaves());
    }

    IEnumerator SpawnWaves ()
    {
        yield return new WaitForSeconds (startWait);
        while (true)
        {
            for (int i = 0; i < hazardCount; i++)
            {
                Vector3 spawnPosition = new Vector3 (Random.Range (-spawnValues.x, spawnValues.x), spawnValues.y, spawnValues.z);
                Quaternion spawnRotation = Quaternion.identity;
                Instantiate (hazard, spawnPosition, spawnRotation);
                yield return new WaitForSeconds (spawnWait);
            }
            yield return new WaitForSeconds(waveWait);
        }
    }
}

What commands would I need to use to increase the amount of hazards that spawn at the end of each round? And likewise, how could I change the Hazard's script so that it will increase in speed by a certain factor at the end of each round? Is there a way I can reference the hazard's script in this script, by any chance?

sentences:
How can I achieve a bullet tracing effect similar to the one in Planetside? I've noticed that bullet tracers in Planetside 2 don't show up close -- every time I see them, it came from a barrel a ways away. I don't believe Planetside traces every bullet either, because then it'd look really weird.

I'm not sure what the exact parameters are, so how can I achieve a similar affect?

sentences:
Separating rendering from HWND I'm considering separating my game simulation from the message loop. It seems odd to me to have other systems tied directly to the window in which my game is running. Most examples I see are implemented similar to the following (I'm glossing over details here, code is only meant to get the idea across)

... WndProc(...)
{
    //PeekMessage
    //Update input
    //Update timer
    //Update simulation
    //Update renderer
}

To increase separation of concerns, I'd like to move the update of input, simulation and renderer out of the specific window itself. This seems simple to accomplish

... WinMain(...)
{
    //Update window
    //Update input
    //Update timer
    //Update simulation
    //Update renderer
}

... WndProc(...)
{
    //PeekMessage
}

There is information that must be obtained from the window to be consumed by the rest of the game. Namely, input (if using the message system), window size, window focus, etc. I should be able to use callbacks or passing in references to state objects the window will update to get this information.

This approach allows me to separate each concern into it's own class. The window code is implemented in a Window class, input in Input, etc. I can use WinMain or a Game class to create each system and coordinate state between them.

Further, it allows me to divorce the renderer from the HWND itself. It seems smelly to me to have the renderer embedded directly within the Window. What if something happens to the window? What if I want to use the same renderer to output multiple views into separate windows (via CreateAdditionalSwapChain)?

The questions that arise from this:

Primary:

It seems I can just rebuild the swap chain to hook up to a new window. Do scenarios exist where the HWND could be invalidated or destroyed but I want to retain my rendering context? Or is this overkill?

Secondary:

Are there flaws to this approach I'm not considering?
Are there better implementations I'm not considering?

sentences: Can someone help me with my mario-inspired timer scoring system? I am new to GameMaker's coding language or GML. I have learned and done a lot so far, but now i am having a problem. I have a countdown timer starting at 5 minutes counting down and I want the player to receive points based on how much time is left kind of like in Super Mario Bros. along with the points accumulated for performing other tasks. How do I go about doing this with the coding language? Thanks in advance!

sentences:
Should components have sub-components in a component-based system like Artemis? I am designing a game using Artemis, although this is more of philosophical question about component-based design in general. Let's say I have non-primitive data which applies to a given component (a Component "animal" may have qualities such as "teeth" or "diet").  There are three ways to approach this in data-driven design, as I see it:

1) Generate classes for these qualities using "traditional" OOP. I imagine this has negative implications for performance, as systems then must be made aware of these qualities in order to process them. It also seems counter to the overall philosophy of data-driven design.

2) Include these qualities as sub-components. This seems off, in that we are now confusing the role of components with that of entities. Moreover out of the box Artemis isn't capable of mapping these subcomponents onto their parent components.

3) Add "teeth", "diet", etc. as components to the overall entity alongside "animal". While this feels odd hierarchically, it may simply be a peculiarity of component-based systems.

I suspect 3 is the correct way to think about things, but I was curious about other ideas.

sentences:
What are levels made of in games? I feel like most will think this is a dumb question but I'm really curious.

Are levels made of just multiple textures or just a collection of models that make up the whole area? I'm working on creating assets at this point and I feel like this is a question I should ask now because I get to deep in the wrong direction. (if i'm headed there)

Example,
Lets say I wanna make level setups like those in Bastion, would that be models that
represent each area of the map? Or possibly one big model for each square area?

sentences:
use of undeclared identifier 'GL_TEXTURE_COORD_ARRAY' Anyone please help me .i am working on sneakyjoystick class when i import these class some error are identified they are following :-

use of undeclared identifier 'GL_TEXTURE_COORD_ARRAY'

use of undeclared identifier 'GL_COLOR_ARRAY'

sentences:
How to randomly spawn obstacles for infinite runner? I am trying to create randomly generated path properly? Think of flappy bird (its not really) but my code/algorithm is all wrong. If I make BarMax, BarMin too large, then player can cheat cos in centre there will always be space. Make it too small and pipes are spawned randomly and sometimes very close to each other (unlike flappy). So my player sometimes could run into a situation where its impossible to move past two pipes. My adjacent pipes are really close together as well unlike flappy birds big gap between pipes.

So this is what i dont want to happen.  I have also thought about spawning sets of pre-configured pipes but then i thought they might run into this impossible situation at some point too. I had my level set-up like this  So when a bar touches the looper, it spawns again - code is above.

int numBGPanels = 35;

float BarsMax = 1.5f; float BarsMin = -1.5f;

float widthOfBGObject = 1; float offset = 0.75f; Vector3 pos;

void Start() {
    StartBarsPosition(); }

void OnTriggerEnter2D(Collider2D collider) {

    if(collider.tag == "Bars") {       // this is not getting called cos theres no collider attached atm
        pos = collider.transform.position;
        pos.x += widthOfBGObject * numBGPanels * offset;

        pos.y = Random.Range(BarsMin, BarsMax);
        collider.transform.position = pos;

    }

}

void StartBarsPosition() {
    GameObject[] bars = GameObject.FindGameObjectsWithTag("Bars");

    foreach(GameObject bar in bars) {
        Vector3 initialpos = bar.transform.position;
        initialpos.y = Random.Range(BarsMin, BarsMax);
        bar.transform.position = initialpos;
    }

}

sentences:
Unity Augmenter Reality on Android with Video playing Hey sisters and brothers,
So, I created an augmented reality marker, which works perfectly, I was able to display 3 shape on the screen with my Nexus 5.

I would like to replace my shapes with a Video. So, when the user track on the marker, I would like to start to play a video above the marker as a part of the augmented reality (No full screen playing).

I tried to use this video tutorial (https://www.youtube.com/watch?v=YBc3ubr18ks) , but on Android you can't use MovieTexture (they say).

My question(s): how can I display a shape above the marker, with a video on it and what it the video format ? When I trying to build the project with mp4, it failing, but when I do with AVI it's okay, but the app crashing.

Thank you,

sentences:
How can I load 24-bit audio as SoundEffect? When I try to load .wav file I get an error:

  Audio file *.wav contains 24-bit audio. Only 8-bit and 16-bit audio
  data is supported.

Here is my code:

SoundEffect menuSelectionChange = content.Load<SoundEffect>("Sound/Menu Selection Click");
SoundEffectInstance menuSelectionChangeInstance = menuSelectionChange.CreateInstance();

Even if I delete this code I'm still getting this error.

sentences: Identify whether object is off screen or not I have placed three game object in the scene.How to know whether the object is visible on the screen.Print a message if the object is not visible on the screen.

sentences:
Blender wont export textures (materials) to OGRE3D .mesh i am exporting a model from BLENDER to OGRE3D using the blender2ogre script. the desigre output is a single .mesh file but i know there should be also materials scripts that i should copy to my ogre path. the problem is that blender does not export those files for me it export only 1 mesh file (after i joined all objects) this is the model. in blender it looks fine but in my demo Ogre app it looks like :
i can use a little help here.

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:
Forcing Non-Pitch Preserving Audio in HTML5, Construct 2 I'm working on a simple game built in HTML5 using Construct 2, in which a circle eats other circles; nothing fancy. The idea is that a song plays during the game, starting at a low pitch, and rising as more circles get eaten (which along with increasing movement speed, makes it pretty manic). Construct 2 has a way to set the playback speed for audio tracks (using the .ogg or aac formats for browser support), but passes the actual implementation of setting the speed to the browser used.

Since some browsers use a pitch-preserving algorithm, and others do not, the same HTML5 game may have the desired low to high pitch transition in one browser, but a artifact filled pitch-preserving version in another. I was wondering, then, is there a way to force the playback speed of the audio to act equivalently to a pitch setting, regardless of the browser used?

sentences:
How can a team work together to assemble a large world map? I recently played a open world FPS game with a large and dense game world, in a single map like this.

It contains many objects, roads, rivers, trees, houses, rocks, hidden places, NPCs, etc... all carefully placed relative to each other. The game was made in two years (which is pretty fast regarding the content).

How can a team work at the same time on such a huge map?

3D models and textures can have been done separately and in parallel as I understand. The question is about how to put all this content on the map and model the map itself (lowering or raising some parts since it is a huge heightmap).

Several things solutions I have in mind:

The map could be divided into big chunks, with each person (or small team) working on a small part. Then (at the end) everything is reassembled. I seriously doubt this, because of the map topology. Or maybe the height of the map was fixed first (no more change possible after some point), then map cut in squares, then reassembled (which would work because height was not changed).
Developers created a multi user editor where it is possible to connect to a server (using LAN) then any change in editor would be directly visible and propagated to other editors connected to the same server. Something like Minecraft.

How can this be done? Has anybody worked on a similar game?

sentences: What is an efficient way to get a look-at direction from either a quaternion or a transformation matrix? So, I have an object in my custom engine (C++), with a column-major transform in world space. I'm using a package that takes a look-at direction as an input. What's the most efficient way to get a look-at direction from this transform? Do I extract the rotation matrix? Do I try to extract a quaternion?

sentences: Visual Studio not adding the header file to the Solution explorer I'm having trouble with my Unreal Visual Studio 2019 project.  I created a new header file, and saved it in the same folder my other ones are in.  (I didn't add these, they were in the starter project of the video course I'm following.) For some reason, the file is not showing in the solution explorer, and IntelliSense isn't working in the particular file.  How do i fix this?  sorry if it's obvious, I'm not an expert at Visual Studio.

sentences:
Basic multiplayer matchmaking implementation I am currently writing a matchmaking server application for a 5vs5 UDK game.

Here is the scenario on which I built my code:

The player starts the game and authenticate
The player clicks an huge "Play" button and asks the server for an open lobby
The server searches for a lobby and adds the player to the lobby found, and sends back lobby informations to the player so it can react accordingly (lobby id, players in lobby). Note that if no lobby is found (all lobbies are full, or there's no lobby at all) then a new one is created.
The player (now in a lobby) selects a character and hits a "Ready" button.
Once all players are ready, the server searches for an opposing team
Once an opposing team is found, the server sends match infos (udk server ip and port) to all of the concerned players

I have written my matchmaking server with the C# Web Api template. This RESTful webservice can at the moment take care of steps 1, 2 and 3 as they are transactions between the frontend (player in UDK game) and the backend (the C# matchmaking server). The player asks for something, the server replies with JSON data. I have done so because having many HTTP requests seemed less foolish than having all authenticated players on a constantly alive TCP connection.

However, for the next steps (particularly the steps concerning what happens inside the lobby), I am undecise on what approach I should take. How can the server notify the players of new events (disconnections, new player, character chosen by a player, player ready...)? Should the players poll the server on a (very) regular basis for new events? Or would it be better to have a pool of threads to keep a TCP connection alive with the players in order to broadcast new events? Or something else? (UDP?). I'm kinda lost.

This is my first post so I hope it's not poorly phrased. Thanks.

sentences:
XNA - How to scale sizes and speeds for a minimap? I'm recreating the arcade game StarGate, and I need to create a minimap. But I'm having problems scaling the minimap textures to fit in the radar box, and ontop of that, making sure the speed of the scrolling for the main map and mini map are proportional.

My textures are sized below:

Entire side scrolling map: 4800 x 620
Screen Size 960 x 720

StarGate screen shot below:

sentences:
Why does an emulator use more RAM than the original system? Why does an emulator use more RAM than the original system? What are emulators doing that requires so much more power?

For example, when using the PSP emulator PPSSPP I'm experiencing lag on a modern PC with gigabytes of RAM, even though the PSP runs with only 32MB of RAM.

When developing my own console emulator, should I not expect it to use a similar amount of RAM / CPU cycles / other resources as the original system has to offer? Or is there extra overhead that makes emulating much more demanding than what the original hardware's specs would suggest?

sentences:
What image format supports transparency in Android? I want to show an apple on screen but the image has a white background and it doesn't blend with the background of a tree.

Is there any image format in which only the red apple is displayed?

sentences:
Designing progression levels I'm new here so forgive me if I have some lingo wrong.

I am designing an app for hockey players that trains them in stickhandling skills. The app tracks time you watch videos/do the exercises.

We want to have the players progress through levels (34 levels), so we can celebrate their progress and give them something to chase after. The truth is the more they drill, the better they actually become, so it really benefits them.

My problem is I don't know how to really design the levels. You train by running through a playlist, let's say that's a standard 4 minutes of training (Somewhat high intensity, too). My thought was doing the first playlist gets you the first level, and it's pretty easy through the first 5. Then it gets tougher each 5 levels until the last 4-5 are really difficult.

Is there some kind of formula for this to design it so the levels make sense vs. just guessing? We want them to train and progress through the levels, not being too hard or too easy.

sentences:
Unet Syncing within AR Hololens I am out of options. I have tried everything I could and no matter what I do, the Transforms don't sync up. I have had multiple solutions that worked in my test, non AR project, but once I put on the HoloLens, it doesn't work.
Here is what I did:

//PlayerObject that is spawned by the NetworkManager
//(obviously has Network Identity component)
public class ClientObject : NetworkBehaviour {
    public static ClientObject CurrentClient;

    private void Start() {
        if(isLocalClient) CurrentClient = this;
    }

    public void MoveObject(GameObject obj, Vector3 position) {
        Cmd_MoveObject(obj, position);
    }

    [Command]
    public void Cmd_MoveObject(GameObject obj, Vector3 position) {
        obj.transform.localPosition = position;
    }
}

And now the object that wants to get synced. It has a Network Transform with standard settings, a network identity and (obviously) no-one has authority since it doesn't get spawned:

public class AnObject : MonoBehaviour {
    public void IWasMoved() {
        /*
         * Someone Moved this object, either by dragging it or
         * clicking on one of it's arrows through the hololons.
         */

        Vector3 newPosition = (the new position i want this object to have);
        ClientObject.CurrentClient.MoveObject(gameObject, newPosition);
    }
}

That's what I have. The only thing different from the version that works on my PC without the HoloLens is that I don't set localPosition = position, but instead use Translate(position) (which is obviously the non local version);

I am tired of writing new code, building the project, having Visual Studio translate the code to C++, start my HoloLenses and test if it works, which takes over an hour every time I do so.

So: is there anything fundamentally wrong with my code? Again: it works on my test project just fine. I refuse to believe that it's the HoloLens's fault...

sentences:
2D Game : How do I draw my entities (player, etc.) by their Y position? I am using C# with MonoGame 3.6

A picture of what I mean: http://i.imgur.com/S3i5iB0.png You see, the little black box is drawn over the red box, because it is drawn before the red box gets drawn. Our view is diagonally forward, which means the red box should get drawn over the red one.

Now, I of course could loop through all entities and sort them by their Y coordinate, but I wanted to know if there was a faster way, as this would be totally inefficient if I had to do it on every game tick / every entity move.

Thank you!

sentences:
How to implement a track for a wipeout-style game on a mobile device? I was wondering what is the best way to manage a 3D track for a game with the same mechanic as Wipeout on a mobile device. Build a track out of multiple segments and load new segments as the player advances or build just one single mesh, maybe with multiple level of details ?

I'm very unfamiliar with this kind of problems so suggestions for other approaches are welcome.

sentences:
Spawning random items to drop from the top of the screen I'm wondering how to make specific random objects drop. In my case, from the top of the screen.
I have 16 objects, named recycle_items_0 through recycle_items_15.
IEnumerator CreateRoutine()
{
    while (true)
    {
        yield return new WaitForSeconds(3);
        CreateItems0();
    }
}

private void CreateItems0()
{
   Vector3 pos = Camera.main.ViewportToWorldPoint(new Vector3(UnityEngine.Random.Range(0.0f,1.0f),1.1f,0));
   pos.z = 0.0f;
   Instantiate(recycle_items_0, pos, Quaternion.identity);
}

sentences:
stats or profit give away result of game Think of a coinflip game, whose logic looks as follows:

Server sends websocket message (RESULT_MESSAGE) to frontend with result of a game (won/lost)
Server sends websocket message to frontend with updated aggregated stats (STATS_MESSAGE) (think all-time profit after the new coin flip, or updated all-time stats)
Frontend reacts to RESULT_MESSAGE by playing an animation (coin flipping). It also updates the all-time stats and profit in response to STATS_MESSAGE

The problem with this logic is, responding to STATS_MESSAGE (updating profit and stats) gives away the result of the coin flip before the animation finishes.

Solutions I cannot use:

Merging RESULT_MESSAGE and STATS_MESSAGE together, and only updating the  stats/profit after animation finishes. Because those 2 messages are produced and sent by different services.
Linking a particular RESULT_MESSAGE to a STATS_MESSAGE and only reacting to a STATS_MESSAGE when its corresponding RESULT_MESSAGE has been processed and its animation completed. Because in reality I have several kinds of STATS_MESSAGES (trophies updated, stats updated, profit/balance updated, etc), and it's just not practical for the frontend to hold onto all those messages until their respective RESULT_MESSAGE is processed

Solutions I've tried successfully before, but I'm trying to avoid:

Having the backend send STATS_MESSAGE with a delay, to make sure it doesn't reach the frontend before the coinflip animation has finished. This sort of encodes frontend behavior (animation) on the backend.

All ideas and suggestions appreciated. Thanks a lot!

EDIT: I made the coin-flipping example for simplicity, but it's not precisely con-flipping. It's a multiplayer game where dozens of games/animations per user per seconds are going on. So queuing a bunch of stuff on the frontend might be less than ideal (I'm still looking into performant versions of this solution though).

Pulling the STATS data via an API call when the animation finishes (instead of using websockets data) is another alternative that I've considered, but for the same reason described above it might not be feasible (dozens of API calls per user per second). Plus there's a chance that an API call is triggered by game-1 finishing, but while game-2 animation is still going on, giving away the result of game-2

sentences:
Testing Multiplayer Browser Game on Single Computer I am writing a multiplay browser based game and am running into an issue with playtesting simple interactions. When a browser window loses focus is stops running requestAnimationFrame calls. This effectively pauses the state all visuals when focus is lost.

I would like to have two instances of the game running at the same time. I could playtest in one window and observe how a thirdparty would see those actions in another window.

Right now I am only able to toggle between the two windows and see teleportation like behavior as the client state catches up to the new server state.

I am not sure how, without setting up a second computer, I might test this. Anyone have any experience with this or any advice?

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: Publish game as pay-what-you-want on Steam Is it possible to publish a game on Steam as pay-what-you-want? Something in the likes of the Humble Bundle. If it's not natively supported by Steam, would it be fine (as in, not violating any contracts or agreements) to have the game published as free (or at a very low cost) and include a link to a page where you, if you so wish, could donate a sum of money?

sentences:
Moving in an arc using Vector3 I'm trying to get this object to move right across the screen until it gets close to the center and arc down smoothly into a straight downward movement. Here's what I've tried:

if (position.X < -5000)
   Velocity = Vector3.Right * speed;
else if (position.X < -1000)
{
   Velocity = new Vector3(
   MathHelper.Lerp(Velocity.X, 0, (float)gameTime.ElapsedGameTime.TotalSeconds),
   MathHelper.Lerp(Velocity.Y, -1, (float)gameTime.ElapsedGameTime.TotalSeconds), 0)
   * speed;
}
else
   Velocity = Vector3.Down * speed;

However, when it gets to where it should be arcing, it just moves to the right at blinding speed and vanishes before it hits the point where it should be going straight down. If I remove the else if, it does a sharp direction shift no problem. What am I doing wrong in that section?

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:
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:
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:
2D Simplex Smooth Cave Generation So I'm creating a system of caves below my random terrain generation, and I'm using 2D Simplex Noise to do so and I have a pretty good grasp on generating the random caves.  However, the cutoff from the terrain to where the cave layer starts is a bit abrupt, and I was wondering how I could prevent this.

Random Level Generation:

public static Level GetRandomLevel(int rows, int cols, float scale = 1f)
{
    Tile[][] tiles = new Tile[rows][];
    for (int i = 0; i < rows; i++)
    {
        tiles[i] = new Tile[cols];
        for (int x = 0; x < cols; x++)
        {
            tiles[i][x] = new Tile(0, new Vector2(x, i), scale);
        }
    }
    int left = Main.rand.Next(rows / 4, rows / 2);

    double seed = Main.rand.NextDouble() * 255;
    for (int i = 0; i < cols; i++)
    {
        float noise = Noise.Generate((float)seed);
        noise *= 7;
        int height = left + (int)noise;
        height = (int)MathHelper.Clamp(height, 0, rows - 1);
        tiles[height][i] = new Tile(2, new Vector2(i, height), scale);
        FillLower(tiles, height, i, scale);
        seed += .05f;
    }

    int[] heightmap = new int[cols];
    for (int i = 0; i < cols; i ++)
    {
        for (int j = 0; j < rows; j++)
        {
            if (tiles[j][i].TileID == 2)
            {
                heightmap[i] = j;
                break;
            }
        }
    }

    //Smoothing out terrain
    for (int i = 0; i < cols - 1; i++)
    {
        if (heightmap[i] > heightmap[i + 1])
        {
            tiles[heightmap[i] - 1][i] = new Tile(6, new Vector2(i, heightmap[i] - 1), scale);
            tiles[heightmap[i]][i] = new Tile(3, new Vector2(i, heightmap[i]), scale);
        }
    }
    for (int i = cols - 1; i > 0; i--)
    {
        if (heightmap[i] > heightmap[i - 1])
        {
            tiles[heightmap[i] - 1][i] = new Tile(5, new Vector2(i, heightmap[i] - 1), scale);
            tiles[heightmap[i]][i] = new Tile(4, new Vector2(i, heightmap[i]), scale);
        }
    }

    //Caves
    for (int y = 0; y < rows && left + 10 + y < rows; y++)
    {
        for (int x = 0; x < cols; x++)
        {
            double noise = Noise.Generate(x / (70 * scale), (y + 1) / (70 * scale));
            //Not air
            if (tiles[left + 10 + y][x].TileID != 0 && noise > 0)
            {
                tiles[left + 10 + y][x] = new Tile(0, new Vector2(x, left + 10 + y), scale);
            }

        }
    }

    return new Level(tiles);
}

Here is a picture demonstrating what I mean about the 'cave layer cutoff' being to abrupt.

sentences:
Constant size geometries How can I display objects in a 3D perspective projection that look like as if their size does not change, despite of the camera's position?
I am using DirectX 9.0. I know of PositionTransformed declaration usage, but I was thinking of scaling the objects in every frame as the camera zooms in/out to achieve this.
Is there a way to know the "scale" of a perspective projection?

An example usage would be to show lines with constant width. E.g. roads on a map.

Update, I've found the solution

check the accepted answer.

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:
How do I get players to say "no" when they are afraid of missing out on sidequests or XP? In my RPG, I have a companion NPC who is overconfident in his abilities and lacks self-control. I wanted to create a few situations where the player needs to reign them in and tell them "no". One such situation basically boiled down to this:

Companion: Hey boss, I want to do this really stupid thing that will almost certainly make things harder for us down the road and possibly jeopardize our goal. Is that okay?
Player Choices:

Yes, go ahead!
No, don't do that!

My hypothesis was that the vast majority of playtesters would choose "No". To my surprise, the vast majority chose "Yes"! And then when the consequences played out and indeed made things worse, playtesters wanted to reload from an earlier save point and pick the other option (choosing "Yes" wasn't game-ending, but it did mean that a perfect outcome wasn't achievable).
When I asked the playtesters why they chose yes, they made it clear that they understood that saying yes was undesirable and saying no was desirable. They also weren't seeking a challenge or anything. Instead, the most common thing I heard was:

I was afraid that if I said "No", then I'd miss out on a sidequest or XP.

One of them even said that in other RPGs he played, the only way to get a 100% playthrough was to say yes at every opportunity, and so they assumed that was the case for mine.
I don't want players to assume that saying "yes" is always the right answer, and for now, I'd like to keep the situation of having to tell the NPC "no" every once in a while. But I don't know how to overcome these player expectations and their fear of missing out of content, especially without just flat out saying "this isn't like other games, you won't miss out if you say 'no'".
So how do I get players to say "no" when they are afraid of missing out on sidequests or XP?

sentences:
How to determine the cost of new units Suppose I design a game such as Battle of Wesnoth, where there are many races, each of which with many types of units.
Is there any rule-of-thumb for determining how much each unit should cost?

One obvious rule is that weaker units should be cheaper, otherwise no-one would like to buy them. But how much cheaper should they be?

As an example from the above link, is there any formula by which I could decide that "vampire bat" (based on its HP and damage properties) should cost 13 while "blood bat" should cost 21?
Or is it just a guess that is validated by extensive playtesting?

EDIT: To make the question more focused, let's assume for simplicity that the units in Wesnoth differ by only two stats: health points ($h$) and damage points ($d$), and all their other stats are equal. Is there a way to calculate a formula to determine the cost as a function of $h$ and $d$?

sentences:
How can I set up a Pong-style game using the physics system in Unity? I've just been using Unity and chose to learn it by making a Pong game which sounded simple enough as a "hello world" type of game. My goal was to try and encompass enough of the built in engine without needing to write scripts but I ran into a few problems.

Here is my setup so far:

Paddle Game Object:

Box Collider
RigidBody (Set as Kinematic)

Ball Game Object:

Sphere Collider<
RigidBody (not kinematic)

Wall Game Object:

Box or Plane Collider

I've set my material on my Ball to 'Bouncy' and I get a pretty good bouncing ball (given a starting force).

I've also added the following script to the Paddles:

void OnCollisionEnter(Collision collision)
{
    BallRidigBody.AddForce(rigidbody.velocity);
}

Here are some of my problems:

Collision: I was trying to figure out why my kinematic objects wouldn't collide before stumbling upon the collision matrix. I was wondering what are good approaches to enable kinematic collisions for my setup;
Forces: I'm confused how ApplyForce should be used. Even if I pick ForceMode.Impulse, is that a constant force?
I'm a bit stuck on how to get proper bouncing off the walls and paddle. Since I've already applied a starting force, should my wall apply force on an onCollisionEnter method or change the velocity?

sentences:
Do I need a server to connect two players in a mobile game? I would like to make a 2 players app game, where 2 players can compete with each other in real time.

If I want the player to be able to compete with the public (anyone who registered with my game able to compete with one another), do I need a server?

If I want the player to be only able to compete with his facebook friends, do I need a server?

Do I need a server at all in the first place, for 2 players game?

sentences:
How do character/object interaction animations work in isometric games? I am planning an isometric business simulation game where the player sees an office with the usual furniture such as desks, whiteboards etc.

Characters (Staff/NPC's) within the game should interact with these objects by performing some pre-defined tasks such as typing on the keyboard at the desk or writing on the whiteboard etc.

What I am interested in, specifically, is the following scenario:

Character moves across the office (1) to his desk (2) and sits down and starts to type (3).

From what I understand I would have a sprite sheet for the character movement (1) and a static sprite for the desk (2) but I don't quite understand how the third step would be handled?

Is there a combined sprite that contains both desk and character? I assume not, otherwise I would need to have a sprite sheet for every desk and character combination.

How is this normally handled?

EDIT:

Here is a specific example animation from the game Theme Hospital. You can see the video here.

As far as I can see the animation is split into several steps.

Step 1 - Character moves between desk and chair.

This suggests that chair and desk are in fact separate sprites.

Step 2 - Character sits down animation

Notice how in the very last frame the chair is closer to the desk.

Step 3 - Desk animations

Step 4 - Stand up animation

Is the same as sit down but played in reverse.

Step 5 - Move away

Use normal move animation to move away.

The questions I have is how are these animations best separated and how would a graphic artist usually provide these animations?

Is the character sitting and typing on the desk actually three different sprites (desk, character and chair)? Does anyone know any example sprites of similar animations?

EDIT 2:

I guess my biggest concern is that I have the right expectations on how the sprites will actually look like. I can't draw them myself so I will have to pay someone to do it and I assume there is some kind of best practice way to do these kind of animations?

sentences:
Capture Video without Third Party SDK's I am trying to capture the game play and store it on local memory without using any third party sdk's. I tried This Video Capture Script but i didn't get the recorded file even i don't know whether it's recording or not.

anybody please help me to complete the task. Thanks in Advance

sentences:
How does 3D games work so fluent provided that each mesh's size is so big? I'm surprised to find that each mesh takes at least 5-6 MB,

how can a 3D game be so fluent when there are hundreds of models?

I'm expecting it will simply go out of memory or something else that makes the game un-playable..

What's the trick employed here?

sentences:
Relative vertical alignment of 3 Texts on Canvas This is a menu that appears if I press Enter on the RE4 inventory if an item is selected. I have drawn a thin red rectangle around it:

And here is a video that shows some of the menu's effects.

I am familiar with a simple text canvas.
I understand that I need to make each line a separate "Text" object so that I can scroll up and down through them.

Here is what I have so far:

The problem that I'm facing now is that the Canvas will be scaled at runtime.
I don't work with fixed values.
This is a problem since I don't see how I could easily make it so that each TextLine object fills 33,3% of the canvas.

Am I right to assume that I can only solve this by making a scripts that holds a reference to each TextLine object and which then calculates their position when the scale of Canvas is known?

Or is there any easier solution?

Thank you!

sentences:
OpenGL ES wrong orientation I'm writing a little Android game in OpenGL ES. My game graphics are not appearing in the right orientation. In fact everything is drawn in reverse vertically. Can someone please comment on my understanding of how OpenGL works below please?

My understanding is that OpenGL works in a right handed coordinate system, e.g.

        y(+)
        |
        |
        o-----x(+)
       /
      /
     z(+)

So, I set my orthographic projection matrix using

Matrix.orthoM(..., -2, 2, -2, 2, 1, 15)

for example, so if I were to draw a line from (-2, 2, 0) to (2, -2, 0) I should be drawing a line in the X/Y plane from (-2, 2) top (2, -2). Near and far planes are 1 and 15 respectively.

In addition I am setting up my view matrix using

Matrix.setLookAtM(mViewMatrix, 0, 0, 0, 10, 0, 0, 0, 0, 1, 0)

so I'm standing on the positive Z axis at 10 units, looking towards the origin with the Y axis as the upwards vector.

But when I come to draw stuff, everything is flipped in the X axis. So a point at (1, 1) would appear at (1, -1).

Does anyone see what might be wrong here?

sentences:
Forge 1.14.4 Minecraft modding: Override vanilla loot tables I cannot figure out how to override vanilla loot tables, I've been at this for hours, and I can't find anything online. Just very outdated tutorials.
I added custom crops and seeds to my mod, now I need those seeds to drop from the in-world grass.

The loot tables for my custom blocks are in data.modId.loot_tables.blocks and they work just fine.

Now, when I try to override the grass to drop an item of my choosing, say, coal, I do this:

1) Make  grass.json

2) Fill it:

{
  "type": "minecraft:block",
  "pools": [
    {
      "rolls": 1,
      "entries": [
        {
          "type": "minecraft:alternatives",
          "children": [
            {
              "type": "minecraft:item",
              "conditions": [
                {
                  "condition": "minecraft:match_tool",
                  "predicate": {
                    "item": "minecraft:shears"
                  }
                }
              ],
              "name": "minecraft:grass"
            },
            {
              "type": "minecraft:item",
              "conditions": [
                {
                  "condition": "minecraft:random_chance",
                  "chance": 0.125
                }
              ],
              "functions": [
                {
                  "function": "minecraft:apply_bonus",
                  "enchantment": "minecraft:fortune",
                  "formula": "minecraft:uniform_bonus_count",
                  "parameters": {
                    "bonusMultiplier": 2
                  }
                },
                {
                  "function": "minecraft:explosion_decay"
                }
              ],
              "name": "minecraft:coal"
            }
          ]
        }
      ]
    }
  ]
}

3) Place it in my project in data.minecraft.loot_tables.blocks

When I test it in game, grass still drops wheat seeds and not coal. Why?

sentences:
Unity-Error within Tree Editor I've been making a tree in with the Tree Editor in Unity, and for a realistic effect, I need to make all the leaves face a general direction, the problem is that most of them don't face that direction and are upside down or sideways.

So you further understand, i'll add some images.

I'd like all the leaves to face in this direction.

(Image 1) In here you can see that some leaves are upside down or sideways and i'd like to make all the leaves face the same way.

(Image 2) In here you can see the leaf is facing up and this is the way I would like all the leafs to face.

Any help is appreciated, thank you.

sentences:
Getting .mesh & .skeleton from Blender2Ogre export I have downloaded the add-on blender2ogre from this source :
http://code.google.com/p/blender2ogre/

And I have created a simple mesh, with walking animation (similar to the gingerbreadman tutorial). My question is, whenever I want to export the project, I can only see the .scene export format. There is no option whatsoever to export as .mesh and .skeleton. Also, how can I export the walking animation separately, in other words, if my project have couple more animation, how can i separate those during export?

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:
What is the math behind the light effect in krakatoa? I'd like to know the math behind the light effect in krakatoa (click here for an example).

Light source is traveling with particles, but how is shading done? Is it something simple, like Phong shading? Is it possible to implement such effect in real time on GPU?

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:
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:
Box2D simulation running slower on lower FPS(even when the desired FPS is lower than the actual) I´m playing around and trying to make myself an easy platformer using the Box2D physics, before that I was not using it and was using my own physics implementation(just simple movements with timestep). My gameloop architecture now works like this:

while (_isRunning) {

    //Processing input events
    processInput();

    update();

    //Rendering stuff
    startFPSCap();

    render();

    delayFPS();
}

The update function is consisting of updating a game world (normal update function without deltatime) - inside this I´m calling a Box2D step function, with desired timestep at 1/60(wanted to have simulation at 60 fps) and then I call my own timestep function to update entity components(so they can be updated also with timestep not just the physics).

void update()
{
    _physics->Step(1.0f / 60.0f, 6, 2);

    updateEntitiesWithOwnTimestep();
}

However when I tried to run it on slower FPS, the simulation slow downs (even when I capped the FPS to like 200 at the start, so running it at 100 fps is like a slowmotion). I thought that when I set the desired physics simulation for 60 fps it will be no problem when reducing the FPS, but it seems like I´m missing something. Or is there something wrong? I mean, maybe the fact I´m running also my own timestep function.. Thanks for help.

Edit1 - according to Timos answer

Do you mean I should put the delta value I pass to my update function during each step in my own timestep? Like this:

void TimestepManager::update() {

int i = 0;

while ((_totalDeltaTime>0.0f) && (i<MAX_PHYSICS_STEPS)) {

    _deltaTime = std::min(_totalDeltaTime, MAX_DELTA_TIME);

    //This is std::function - i can define my own behavior via this
    _f.exec(_deltaTime);

    _physics.Step(_deltaTime, 6, 2);

    _totalDeltaTime -= _deltaTime;

    i++;
}

}

Or should I pass the total deltaTime? Because I thought that I should keep this unchanged because I don´t want to tie the simulation with the FPS.

sentences:
How to iterate a sprite group correctly in Pygame avoiding "maximum recursion depth exceeded"? I'm making a game and I have almost finished it, but I'm usually finding the error RuntimeError: maximum recursion depth exceeded when I iterate a sprite group.

This is an example and the group is self.nextStageCollision():

def nextStageCollision(self):
    for tile in self.nextStageCollision():
        if tile.rect.colliderect(self.rect):
            self.rect.x = 18*20
            self.rect.y = 20*20
            return True

    return False

The group self.nextStageCollision() has 4 sprites (tiles) and I'm checking collision between my player and those 4 tiles to go to the next stage but I have to be doing something wrong iterating the sprite group because (I don't know why) it becomes recursive and raises the maximum recursion depth runtime error. I've debugged it and when it reaches the for each line, it loops a lot of times there (althought there are only 4 sprites in that group).

I know I can increase the recursion depth, but probably it's better to not play with that and try to improve the code. So, what am I doing wrong? Is there another better way to interate a sprite group to check collisions?

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:
Online RTS Game Architecture for Mobiles We came up with an idea for a real-time strategy game for mobile devices that can play with other players over a network. I'm trying to plan out the architecture/protocol required for such as system. Some other related questions (1,2) mention that P2P is the way to go for RTS games. The problem is that most mobile phones cannot open TCP ports to allow incoming connections, so a central server would be required to relay messages between the players. Another issue that is mentioned on the linked questions is the difference in floating point operations and random number generators, etc among different platforms (Our game would run on iOS and Android for example) so running the game simulation on each device may not be optimal. I could run the game simulation on a server and have it broadcast updates, but simulating/broadcasting up to 200 units per game would be quite expensive especially when multiple people are using the same server to play games. The server's performance might drop significantly with more than a few hundred people using it.

I'm currently thinking the central server would be the best method, but would require a lot of server power. I'm looking for any suggestions on a architecture/protocol that would work for this game and any insight on the issues I mentioned with existing protocols.

sentences:
How to Implement a Timer for my Prefab for Roll-a-Ball Game (C# in Unity) I am trying to create a public float timer that senses when the particular prefab has not been there for a certain amount of time. Then, it will replace that particular object.

The goal is to randomly spawn 10 of these cubes across the game board. Then when the player picks one up, it disappears. Then after say, 2 seconds, a new cube should be placed on the board.

Right now the Player already moves around the board just fine, and can pick up the cubes. When the player picks up a Cube, a new cube is automatically placed on the board with no delay.

This script will be attached to the cube prefab directly.

Apologies for the appearance of the code in advance.

using UnityEngine;
using System.Collections;

public class RandomPlacement : MonoBehaviour
{
public GameObject prefab;
private GameObject prefabClone;
public int count;
private GameObject[] getCount;
public float timer = 2;
// Instantiate the Prefab somewhere between - 10, 10 on the x, and z planes, with a height of 0.5 in y.

void Update ()
{
   getCount = GameObject.FindGameObjectsWithTag("PickUp");
   count = getCount.Length;
   if (count < 10)
   {
        timer -= Time.deltaTime;
        if (timer <= 0f);
        {
            Vector3 position = new Vector3(Random.Range(-9.0f, 9.0f), 1.0f, Random.Range(-10.0f, 9.0f));
            prefabClone = Instantiate(prefab, position, Quaternion.identity) as GameObject;
            timer = 2;
        }
    }
}
}

The code for the collision between the pick-up and ball is given by:

void OnTriggerEnter(Collider other)
{
    if (other.gameObject.CompareTag("PickUp"))
    {
        other.gameObject.SetActive(false);
    }
}

}

The "Cube" prefabs are all given the tag "PickUp" This script is attached to the "Player"

sentences:
Player positions in a race game through arrays or...? First time posting on these forums so go easy on me!

I've been programming a race game which has been going quite well. I've just discovered now how hard it is to set up player positions!(As in 1st, 2nd, 3rd, etc). From research I've discovered that the easiest way of doing this is through checkpoints which I've successfully managed to set up. Each player races through the checkpoints in the game and this progress is stored as an int. There's 2 int, one for laps and one for checkpoints. When the checkpoint integer reaches a certain number it resets back to zero and the lap integer is incremented.

I was planning to compare these to work out player positions. Hopefully by putting them into arrays and then sorting them so it could tell me the player's positions in the race as the person with the high lap and checkpoint count would surely be the highest ranked.

Also to make the measuring of player positions more accurate I've measure the distance between checkpoints. At each checkpoint it works out how far the player is from the next point and using the distance from the previous to the next I'm able to generate a percentage which tells me how far the player is from the lap.

What I was hoping to do is create an integer worked out from the players race progress. So for example going through a checkpoint would increment the player's race progress integer by 100. If there were 12 checkpoint a complete lap would obviously be 1200. 2 laps would be 2400 and so on. By inverting the percentage I generated earlier it gives me the distance to the next checkpoint. so for example a player 75% towards the 4th checkpoint in their first lap would have an integer of 375, whereas a player 50% towards the first checkpoint in their second lap would have an integer of 1250.

I hope that logic made sense.

So what I'm essentially looking to create is a sort of table, using the player's object or even a unique player id as an index. And then to sort this table by the player position int.

I think this maybe possible through multidimensional arrays but I'm quite unsure. I've looked into associative arrays, dictionaries and hashtables but I'm still pretty unclear on what to do.

Would really appreciate being pointed in the right direction.
Thanks!

sentences:
Execute native ios code in unity I want to execute native iOS code in unity. For this I have added two files in /plugins/ios.

ViewController.h
ViewController.m

Code for each file represented as under.

ViewController.h

@interface ViewController

-(void)sampleMethod;
@end

ViewController.m

#import "ViewController.h"

@implementation ViewController

-(void)sampleMethod
{
     NSLog(@"Sample Method Execute");
}
@end

For C# file I have added following code

[DllImport("__Internal")]
private static extern void sampleMethod();

and call to above method

sampleMethod();

When I am export project for iOS, xCode give me following error that I can't able to understand.

I can't able to understand how to solve this problem? Please give some suggestion here.

EDIT :

I have added extern keyword in my .m file after reading some suggestion.

#import "ViewController.h"

@implementation ViewController

extern "C"
{
   -(void)sampleMethod
   {
        NSLog(@"Sample Method Execute");
   }
}
@end

But in xCode now I am getting Expected Identifier or '(' at the line of extern keyword line. So what to do next?

sentences: How do I get light to go through a window texture in Unity? I'm having trouble with the lighting (I have windows and the light wont go through). How do I get the light to proceed through the glass?

sentences:
Roatating a Game Object downward In my game I have a rocket which is traveling horizontally across the screen.

What I am trying to do is when the player runs out of fuel, the rockets engine stops (already coded) and then the rocket will slowly rotate to point at an almost 45 degree angle and fall down off the screen as gravity takes its affect.

How do I do this?

sentences:
Switching Screens without initializing them every time I have a UI with four Screens (all extending a "main Screen") that users switch between very frequently, at the moment I am switching Screens using g.setScreen(new screen);, but this leads to the problem that I have to reload and initialize everything inside the Screen every single time, which is causing memory leaks.

Is there some way I can save the Screens in memory and just load them without having to re-initialize everything inside them? Or is this bad? Because my current approach is not going to cut it.

I was thinking something like initializing all Screens on startup and saving them in an array, then just loading the Screen I need from that array when I need it, ie g.setScreen(screenArray.get(nextScreen));. Is this a viable approach? Please any advice you can give will help, really need help with this.

sentences:
LOVE Physics - Joint Stretching After asking a similar question yesterday I've come across another problem with using joints in box2D / LOVE and trying to create a weighted chain.

Everything is set up as follows, I've tried to remove most of the fluff:

Each link is created as a body/shape pair then joined together and added to a links table.

    for i = 1, segments, 1 do

        link = {}

        link.body = love.physics.newBody(world, xpos, ypos, "dynamic")

        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(links,link)

        ypos = ypos + link_distance

    end

Links are joined together using rope joints to allow for some springy-ness:

    for i = 2, #links, 1 do

        x1,y1 = links[i-1].body:getPosition()
        x2,y2 = links[i].body:getPosition()
        links[i-1].join = love.physics.newRopeJoint(links[i-1].body, links[i].body, x1, y1, x2, y2, link_distance, true )

    end

The player controls the first element of the chain and holds the table of links, its created as follows:

local body = love.physics.newBody(world, 300, 100, "kinematic")
local shape = love.physics.newCircleShape(3)
local fixture = love.physics.newFixture(body, shape)
local chain = _chain.new(world)

Joined to the chain:

x1,y1 = body:getPosition()
x2,y2 = links[1].body:getPosition()
join = love.physics.newRevoluteJoint(body, links[1].body, x1, y1, x2, y2, true )

The player tracks the mouse cursor, determines a velocity and moves towards it by setting the linear velocity of the first chain element:

    body:setLinearVelocity(velocity.x, velocity.y)

And this very nearly works, you can pull the chain around quite nicely using the mouse (directing the top pink element), however if you keep spinning the chain it begins to stretch and pull away from the first element:

Any ideas on how to solve this?

I've tried using different joints and parameters, adding a reinforcing joint from the first link to the last, adjusting body weights and altering the update iterations but can't seem to find anything effective.

Many thanks.

sentences: How to export Visual Studio game for mass distribution I've coded a Visual Studio 2015 game in SDL2 and ran some distribution tests, I gave a user the game's .exe (the raw game with no files) and they got the error SDL2.dll is missing. How would I export the game so it includes the least amount of rubbish (visual studio) files and doesn't produce these sdl errors.

sentences:
Implementing network smoothing We are making a multipler first person shooter.
The client sends it's position to the server at a fixed rate (currently at 10Hz). The server sends a single message contatining all player's positions to all players at the same rate (10Hz).

As expected, the movement is pretty choppy since the 60fps game is only recieving updates 10 times a second.
What is the best way to smooth this movement?
The most obvious way would be to interpolate between the last two packets, so that the interpolation finishes as we recieve a new packet. But this adds an instant 100ms delay for all players.

The other way would be to use the velocity and acceleration inferred from the last few packets to predict where the player is before the next packet arrives, however if the prediction is wrong, the player would tend to jump as soon as a new packet is recieved.

Does anyone know how AAA titles solve this problem?

sentences:
Using a Vertex Buffer and DrawUserIndexedPrimitives? Let's say I have a large but static world and only a single moving object on said world.

To increase performance I wish to use a vertex and index buffer for the static part of the world.

I set them up and they work fine however if I throw in another draw call to DrawUserIndexedPrimitives (to draw my one single moving object) after the call to DrawIndexedPrimitives, it will error out saying a valid vertex buffer must be set.

I can only assume the DrawUserIndexedPrimitive call destroyed/replaced the vertex buffer I set. In order to get around this I must call device.SetVertexBuffer(vertexBuffer) every frame. Something tells me that isn't correct as that kind of defeats the point of a buffer?

To shed some light, the large vertex buffer is the final merged mesh of many repeated cubes (think Minecraft) which I manually create to reduce the amount of vertices/indexes needed (for example two connected cubes become one cuboid, the connecting faces are cut out), and also the amount of matrix translations (as it would suck to do one per cube). The moving objects would be other items in the world which are dynamic and not fixed to the block grid, so things like the NPCs who move constantly.

How do I go about handling the large static world but also allowing objects to freely move about?

sentences: Is it possible to run GLFW eventhough my graphic card(Nvidia) supports Direct3d API? I have Nvidia 820M GPU installed in my windows 7 machine. In nvidia control panel it is showing it supports Direct3d API version 11. Am I able to run OpenGL applications(using GLUT,GLFW) on my machine with this configuration? see the below screenshot for configuration details.

sentences:
Diffuse Reflection confusion From what I've read, with a simple directional light, the color of a point, if you only take diffuse reflection into account (intensity = 1), should be

color = color_of_point * color_of_light * dot(normal, -light_direction);

However, this is confusing for me. For example, if the light direction is parallel to the normal, and if the color of the point is pure red (1,0,0) and the color of the light is pure blue (0,0,1) I'd expect the point to have a color of violet - yet the result will be black.

Similarly, if I have a completely white point, or a completely black point, I wouldn't intuitively assume that the result is completely white (regardless of light color) or completely black either.

I guess I'm fundamentally misunderstanding something here. Can someone explain?

sentences:
My Raycast2D doesn't go where I want and it doesn't return a GameObject I want my Objects to teleport when they hit a wall. For that, I want to shoot a Ray backwards and teleport it to where the ray hits the wall, but whatever I try, it always teleports to the centre of the scene and the ray hit doesn't return a GameObject. This version I tried runs on OnTriggerEnter2D:
RaycastHit2D hit = Physics2D.Raycast(transform.position, -transform.up, 300);
Debug.DrawLine(transform.position, hit.point);
transform.position = hit.point;

I tried some other variations too. If you have any idea, please let me know.

sentences:
Game Maker: is 08 the same as 8 in arrays? if I make an array A_[01], can I refer to it later with A_[1]?

I am asking because I am not sure if this is the reason why I am getting some bugs.

sentences:
Implementing a Deferred Renderer (Basic Understanding) I am trying to implement a Deferred Renderer in Direct3D11. I am fairly new to this.
I already bought a book: Practical Rendering & Computation with Direct3D 11.
However, this book doesnt answer many of my questions.

The Book just says "Call one of the Draw Commands to execute the Pipeline"

In the context of a deferred Renderer I would like to know How I can actually render the different GBuffers, merge them and put actual Lighting to my scene.
Let's say my GBuffers should represent Diffuse, Specular and Normals.
I understand that Vertex Shaders have Constant Buffers that represent my Camera through Matrices. Vertices get Transformed in shaders into ViewSpace.
How Do I get my Diffuse/Specular/Normal information out of that?

Do I have to execute the Rendering Pipeline for every GBuffer?
Technically do I just need to transform my vertices once in a VS and just execute my different GBuffer PS?
The Context Object offers functions like "OMSetRenderTarget". The OutputMerger however is the last stage of the Pipeline, not the first...

The Book itself just calls "Present(0,0)" exactly once and doesnt explain how you actually put things together.

Sorry, quite a lot of different questions :(

sentences:
Are objects made out of lines still classified as meshes? A cube or a sphere is a mesh, but are lines and circles?

I'm currently creating a renderer responsible for drawing many different types of object. functions in a namespace called MeshDescription are responsible for running and returning mesh objects so you can do things like this:

Mesh mesh = MeshDescription::Cube();

but I'm wondering if functions for lines and circles should be categorised differently? with a view to changing this soon so that everything is instanced.

sentences:
City/Nation Builder - Unlocking game elements over time Current Git (Needs more documentation)

Current working prototype to play with (Git code is after a BIG refactor)

Background: I'm making a javascript text city/nation builder along the lines of A Dark Room or Candy Box. This is going to be the player managing a city but be able to vassalise other cities (Ala Europa Universalis), giving you a tribute of their income but no specific control over it like your own one.

Each city has a tree of things in it, including buildings, resources, tools/machines and intermediate crafting items. These types each have their own object constructors and can easily have a complex object of about 5-50 keys depending on the item just from a few lines of code. Each tree starts at the top, a category for sorting on the UI/namespace, and then inside that is the actual object itself. So whenever referencing an item in a crafting recipe or production chain there's a "resource.material.wood" or "buildingHouse.tent.small" or such.

The player or "empire" can own multiple cities, but only directly control one in the city view screen (You can tell your city exactly how to be managed, but all other cities you've taken over live their own life, but you can send them requests and investments to boost specific things). Because the item trees are so expansive (170 items in the prototype on my website) I need an easy way to hide things away that aren't unlocked yet. Decided to go with the Civ 5 tech tree route.

Current problem: In the prototype I had the tech tree and items bound to the window instead of to the city. This meant there was only ever a single instance of everything and to unlock something in the UI I could just go (simplified) foreach (unlockedItem) {item.unlocked = true}. I can't do this as easily in the multiple city model because the tech system is player specific, not city specific, and so if you take over a new city they should retroactively build the city's tech level from that player's tech level. I'm not sure how I want to handle inheriting resources/buildings from a more advanced civ yet either.

Relevant code pulled from the Git as an example: pastebin.com/DbbUXbaL

As far as I can tell, there's a not so easy way I can work around this.

Flip the way I unlock things. The item is then bound to a tech that unlocks it instead of a tech being bound to multiple items. In my head I prefer the latter way because it means I can group like items together (The resource with the building that produces it) and it's easier to list the items that the tech unlocks when you're in the research menu. It's also much easier in the code to see what a tech unlocks at a glance, instead of going from class to class. The problem with the latter way though is that it's hard to retroactively unlock things in a newly unlocked city.

The question to Gamedev: Those of you with more experience than I, how would you go about designing a technology system for an entity heavy game like the Anno series or Civ if each tech unlocked 5+ things? Do I have the right idea binding the item to the tech or is there a much simpler way of doing it I'm just not seeing?

sentences:
How can I get multiple players play my multiplayer game at launch? Lets take a example of Apex Legends, it was release in February 4, 2019 and got 25 millions users in after a week (Source: The Verge). I know EA is the publisher so its easy for them to market and have huge user base but what if Im new in the industry and have been funded or invested to make huge game like that but could not get million of user in such short period of time?

How could I achieve something like this? How can I get a lot of players to play my game when I launch it? I thought of adding AI/bots to keep the real players in until my player mass is good enough, but is that just it? Are there other options?

sentences:
Flip rotation matrix I'm doing character control with kinect. I need to mirror the joint orientation because the character faces the player. Somehow by Googling through internet I've done it and everything works very well. But I have little idea about how the math works, here's my code:

//-------------------------------------------------------------------------------------
Ogre::Quaternion JointOrientationCalculator::buildQuaternion(Ogre::Vector3 xAxis, Ogre::Vector3 yAxis, Ogre::Vector3 zAxis)
{
    Ogre::Matrix3 mat;
    if(isMirror)
    {
        mat = Ogre::Matrix3(xAxis.x, yAxis.x, zAxis.x,
                            xAxis.y, yAxis.y, zAxis.y,
                            xAxis.z, yAxis.z, zAxis.z);
        Ogre::Matrix3 flipMat(1, 0,  0,
                              0, 1,  0,
                              0, 0, -1);
        mat = flipMat * mat * flipMat;
    }
    else
    {
        mat = Ogre::Matrix3(xAxis.x, -yAxis.x, zAxis.x,
                           -xAxis.y, yAxis.y, -zAxis.y,
                           xAxis.z,  -yAxis.z, zAxis.z);
    }

    Ogre::Quaternion q;
    q.FromRotationMatrix(mat);

    return q;
}

When I need to mirror/flip it by axes z I calculate mat = flipMat * mat * flipMat;
but I don't understand how this equation works.

sentences:
Sending a shot left/right/up/down based on directional key press I am trying to make a top-down shooter game with similar combat to the Binding of Isaac:

when I press the up key the shot goes up
when I press the right key the shot goes to the right

I have all the rest of the code such as the point where the projectile is instantiating and the if statement to check for the button press I just want to know where I should put the vector 2 to allow me to set the direction and what to write into the vector 2

private void Update()
{

    if (Input.GetKeyDown("up"))
    {
        if (Time.time >= shotTime)

        {
            Instantiate(projectile, shotPoint);
            shotTime = Time.time + timeBetweenShots;

        }
    }

}

This is my Projectile script (at least the parts that I think would be useful)

void Update()
{
    transform.Translate(Vector2.up * speed * Time.deltaTime);
}

I realized that if I change the Vector2.up to make it say Vector2.down it would now shoot down But I need that to be able to change depending on which direction I am shooting.

sentences:
Unity object stuck where it shouldn't Here's the thing. I am making a 3D top-down game about cars on the road. Right now I have different-colored cuboids representing cars. They are position-locked in Y and rotation-locked on all three axis (axises? Sorry, English isn't my first language). The cuboid in question is controlled with the following code:

using UnityEngine;
using System.Collections;

[System.Serializable]
public class Boundary
{
    public float xMin, xMax, zMin, zMax;
}

public class PlayerController : MonoBehaviour

public float speed;

public Boundary boundary;

void FixedUpdate ()
{
    float moveHorizontal = Input.GetAxis("Horizontal");
    float moveVertical = Input.GetAxis("Vertical");

    Vector3 movement = new Vector3 (moveHorizontal, 0.0f, moveVertical);
    GetComponent<Rigidbody>().velocity = movement * speed;

    GetComponent<Rigidbody>().position = new Vector3
        (
            Mathf.Clamp (GetComponent<Rigidbody>().position.x, boundary.xMin, boundary.xMax),
            0.0f,
            Mathf.Clamp (GetComponent<Rigidbody>().position.z, boundary.zMin, boundary.zMax)
        );
    }

}

It's pretty simple, almost unchanged code from the Unity tutorial. Boundaries are set as -8, 8 on X and -13, 13 on Z. The cuboid spawns at 0, 0.55 (It's 1 height, I gave it some clearance), -13. I move it forward with the WASD and it just gets stuck at 0.15 Z. Just dies there and can't move anywhere.

I'm very new to Unity, so I expect it to be some rookie mistake. Can someone help me out? Thank you.

sentences:
(Unity) Is there a way to automatically create a material for each texture and assign the texture to it? I have imported hundreds of textures in my Unity project, and I'd like to create a material for each of them. This would obviously take a lot of time, so how would I go about doing this automatically?

These are just basic textures that I want to assign to albedo on the standard Unity 5 shader. No need for normal maps.

sentences:
Confusion about flow and architecture for basic multiplayer card game state As a web developer I'm used to a straightforward flow where all interactions typically correspond to a database read/write and the life-cycle corresponds with a single request.

As a learning exercise I wanted to write a basic multiplayer card game and realized I have a lot of confusion about where to best store active game state.

While I know a card game could easily read/write to a database per action, I was wondering if it is as simple as (in my case, a javascript node server):

Create a global state object
Create an active game object
Push it to an array in the global state
Perform actions on this active game in memory, broadcast new state to frontend via websockets
When the active game is complete, write the results to a database for persistent storage
Remove the active game from the state, thus freeing memory?

My questions:

Is this a reasonable solution or is it a bad practice? (global variables, memory management, state loss on process crash/restart etc...)
Would it make more sense to set up a redis server for handling temporary state?

This is quite different from a frontend perspective where redux/vuex makes handling state a straightforward task, and from what I've read, it is desirable for the backend to be 'stateless' - it just seems weird to me to read/write to a database for things that don't require long-term persistence.

Edit: I also know firebase could be a very suitable solution, I just prefer to avoid vendor lock-in if possible.

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:
Bullet physics weird behavior. Jittering and drifting with btBoxShape I'm dropping a simple box onto a plane from 100 units and my solution using Bullet Physics is giving me some weird behavior. The dimensions of the box are {2, 4, 1}.

When the box hits the ground it jiggles up and down, drifts off to the side, and finally settles by sinking 1.5 units into the ground.

When I reduce the fall height to about 5 units the box doesn't sink into the ground, and the sideways drift is less pronounced.

When I declare a btSphereShape instead of a btBoxShape the problems go away. It should be noted that I'm developing for iOS with Objective-C file that interphases my code with Bullet.

Here's my code:

- (void)setUpPhysicsWorld { //This sets up the physics world and plane shape:

    collisionConfiguration = new btDefaultCollisionConfiguration();
    dispatcher = new btCollisionDispatcher(collisionConfiguration);
    broadphase = new btDbvtBroadphase();
    solver = new btSequentialImpulseConstraintSolver;
    dynamicWorld = new btDiscreteDynamicsWorld(dispatcher, broadphase, solver, collisionConfiguration);

    btTransform t;
    t.setIdentity();
    t.setOrigin(btVector3(0, 0, 0));
    btStaticPlaneShape *planeShape = new btStaticPlaneShape(btVector3(0, 1, 0), 0);
    btMotionState *motion = new btDefaultMotionState(t);
    btRigidBody::btRigidBodyConstructionInfo info(0.0, motion, planeShape);
    btRigidBody *planeRigidBody = new btRigidBody(info);
    dynamicWorld->addRigidBody(planeRigidBody);
    [self addBlock];

}

- (void)addBlock {

    btTransform t;
    t.setIdentity();
    t.setOrigin(btVector3(0, 5, 0));

    /* Actual declaration of the box shape. For some reason, when I change this
    to a btSphereShape, all the problems go away. */
    btBoxShape *boxShape = new btBoxShape(btVector3(1, 2, 0.5));
    btVector3 inertia(0, 0, 0);
    boxShape->calculateLocalInertia(1.0, inertia);

    btMotionState *motion = new btDefaultMotionState(t);
    btRigidBody::btRigidBodyConstructionInfo info(1.0, motion, boxShape, inertia);
    blockRigidBody = new btRigidBody(info);
    dynamicWorld->addRigidBody(blockRigidBody);

}

- (GLKVector3)getBLockLocation {

    dynamicWorld->stepSimulation(1/60.f, 10, 1/300.0);

    btTransform trans;
    blockRigidBody->getMotionState()->getWorldTransform(trans);

    return GLKVector3Make(trans.getOrigin().getX(), trans.getOrigin().getY(), trans.getOrigin().getZ());

}

Can anyone tell me what's wrong here?

sentences:
Understanding animations of controllable characters I am a newbie trying to learn basics of Unity3D (5) before starting to do the real thing. Even though I tagged it as Unity3D, the logic should be the same for every kind of game engine. So I will be glad if you share your experience even though you do not use Unity.

Assume that you are importing the "Lamp" character (fbx) of Pixar. (Jumping, moving forward by little jumps, etc..)

OR

Assume that you are basicly importing a humanoid model with animations from Unity Asset Store. (I know that they generally include controllers too, assume that there are no controllers)

In unity, I want to make the character jump so I use jump animation. But I really want to make it jump. Also when I move it forward I really want it to move forward by appying a force or setting it's velocity. These will probably will not match the animation and even if they match, my own physics manipulations will be mixed with the animation's transformations. Even if I put the animation/object into another GameObject, it changes the position and/or rotation of the parent gameobject. So, animation changes those values and I also change them myself... The result will be the combination of all which is very hard -if not impossible- to sync or calculate.

The same thing is valid for almost every animation including Jumping. For example, the animation jumps and I also make the object jump.. It will create a double jump.. If I only let animation does that, I won't be able to control how it really behaves and If I make the animation look like it's crouching (actually jumping, but transformed to 0,0 in every frame, so in Unity changing the vertical position will fix it...) it will be hard to sync too.

What am I missing here? What is the guideline here?

sentences:
glColor3f Setting colour This draws a white vertical line from 640 to 768 at x512:

glDisable(GL_TEXTURE_2D);
glBegin(GL_LINES);
      glColor3f((double)R/255,(double)G/255,(double)B/255);
      glVertex3f(SX, -SPosY, 0); // origin of the line
      glVertex3f(SX, -EPosY, 0); // ending point of the line
glEnd();
glEnable(GL_TEXTURE_2D);

This works, but after having a problem where it wouldn't draw it white (Or to any colour passed) I discovered that disabling GL_TEXTURE_2D Before drawing the line, and the re-enabling it afterwards for other things, fixed it. I want to know, is this a normal step a programmer might take? Or is it highly inefficient? I don't want to be causing any slow downs due to a mistake =)

Thanks

sentences:
Sampled texture from bitmap font produces blue glow I'm creating a texture is DirectX 11 from bitmap fonts. I realize that I can use DXTK, but this is an exercise for me, not in learning another library. My sample code looks like this.

// Object Declarations
Texture2D g_MeshTexture;            // Color texture for mesh

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

float4 PS(VS_OUTPUT input) : SV_TARGET
{
    return g_MeshTexture.Sample(MeshTextureSampler, input.uv);
}

The texture of the rendered font produces strange blue artifacts where the text should have alpha values but instead appear as blue.

I did try gamma color correction with the code

float4 PS(VS_OUTPUT input) : SV_TARGET
{
    float4 sRGBA = g_MeshTexture.Sample(MeshTextureSampler, input.uv);
    float3 sRGB = float3(sRGBA.x, sRGBA.y, sRGBA.z);
    float3 gRGB = pow(sRGB, 1/2.2);

    return float4(gRGB.x, gRGB.y, gRGB.z, sRGBA.w);
}

However this did not provide results any different from what the image showed above. I sample the text from the bitmap data and store it in a vector when then is used to create the texture with CreateTexture2D.

for (long y = 0; y < m_texture_height; y++)
{
    for (long x = 0; x < m_texture_width; x++)
    {
        BYTE alpha = (bitmap_bits[m_texture_width * y + x] & 0xff);

        if (alpha > 0)
            pixel_data.push_back(0xFFFFFF00 + alpha);
        else
            pixel_data.push_back(0);
    }
}

My back buffer uses DXGI_FORMAT_R32G32B32A32_FLOAT, however I have tried DXGI_FORMAT_R8G8B8A8_UNORM and experienced no change. If there's any other information I should provide please let me know.

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:
I prefer C/C++ over Unity and other tools: is it such a big downer for a game developer? We have a big game project using Unity at school. There are 12 of us working on it. My teacher seems to be convinced it's an important tool to teach students, since it makes students look from the high level to the lower level.

I can understand his view, and I'm wondering: Is unity such an important engine in game development companies? Are there a lot of companies using it because they can't afford to use something else? He is talking like Unity is a big player in game making, but I only see it fit small indie game companies who want to do a game as fast as possible.

Do you think Unity is of that much importance in the industry?
Does it endanger the value of C++ skills?

It's not that I don't like Unity, it's just that I don't learn anything with it, I prefer to achieve little steps with Ogre or SFML instead.

Also, we also have C++ practice exercises, but those are just practice with theory, nothing much.

sentences:
demographics of paying mobile gamer I was googling for this now for a while but didn't find any relevant data.

Does someone know any statistics of the demographics of mobile gamers that actually spend money on their games? It's clear that this data may vary over different genres but any kind of analysis in this direction would be interesting for me.

sentences:
How can I rotate a quad around it's center? My code is:

GL11.glPushMatrix();

// rotate around center
GL11.glTranslatef(-200/2, -200/2, 0);
GL11.glRotatef(30, 0.0f, 0.0f, 1);
GL11.glTranslatef(200/2, 200/2, 0);
// draw quad
GL11.glBegin(GL11.GL_QUADS);
GL11.glTexCoord2f(0f,0.5f);
GL11.glVertex3f(50,50,1);
GL11.glTexCoord2f(0.5f,0.5f);
GL11.glVertex3f(50+200,50,1);
GL11.glTexCoord2f(0.5f,0f);
GL11.glVertex3f(50+200,50+200,1);
GL11.glTexCoord2f(0f,0f);
GL11.glVertex3f(50,50+200,1);
GL11.glEnd();

GL11.glPopMatrix();

and it's not rotating it around the center, am I doing this correctly? if not how would I?

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:
How can I randomize my speeds just once, each time values are changed in the Inspector? private void SpeedUpdater()
    {
        if (changeSpeedOnce == false)
        {
            foreach (WaypointsFollower follower in waypointsFollowers)
            {
                if (randomSpeed)
                {
                    follower.speed = Random.Range(minRandomSpeed, maxRandomSpeed);
                }
                else
                {
                    follower.speed = speed;
                }
            }

            changeSpeedOnce = true;
        }
    }

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

sentences:
How to create "broken glass" animation? I have started making a 3D game in Unity5 that consists in avoiding obstacles. It is very easy but I want to add a collision effect when I collide on the wall.

I would like to slice the screen into many parts (random pieces is better) that are falling down from screen with gravity.

An example of what I mean:

How can I do this?
I've tried using a lot of different images (shapes) but I'm sure that is not the best way...

Thanks for any suggestions.

sentences:
Implementing match-making & community system for multiplayer games These days, games often have multiplayer portals with chat channels & match making system for the multiplayer aspects of the game.

An example would be battle.net, magic the gathering online's chat rooms, halo etc.

Now, for the rest of us indie gamers that probably won't be able to spend much development effort on creating those back-ends from scratch, what options do we have?

I was thinking of something along the line of using IRC as the backbone of the system. From there, implement the "community" aspect, player tracking, game tracking and match making on top of that. It seems to be what the old battle.net (brood war era) used to be.

The question is, is this easy to do? What does it take to run an irc server, and I suppose this also requires writing an IRC client (which seems to have been done a lot these days?)?

If there are other ways as well (say, an open framework for this stuff), let's hear them too.

sentences: Framerate limited by lack of mouse movement? Using Torque, it appears that the program is running at around 25fps when the mouse is still, but as long as I keep the mouse moving, the framerate can hit well over 300fps. What in the world would cause the framerate to be tied to mouse movement?

sentences:
How to store renderer vertex / index data in scene graph objects? I have a SceneNode class which contains a Mesh instance. The Mesh class stores client side information such as vertex and index arrays (before they're uploaded to the GPU). I also have an abstracted Renderer class, for GL and D3D, which render the SceneNodes. However, I'm not sure where I should store the API specific variables, e.g. GLuint via glGenBuffers for GL, and an ID3D11Buffer for D3D.

The few options I've considered are:

Create a derived Mesh class for each API, e.g. GLMesh / D3DMesh
Create a derived MeshData class for each API, which is stored in the main Mesh class
Store a map of Mesh to API variables in each renderer, e.g. perform a lookup of Mesh to GLuint / ID3D11Buffer for each object that is rendered (variables would have to be generated after the scene had been updated, but before rendering).
Separate the logic of rendering from scenes, by visiting the SceneGraph after update, and generating a RenderGraph of all renderable nodes in the scene.

What's the recommended way of doing this?

sentences:
How can I fire a bullet from an actor's position? I want to shoot a bullet from an actor.

I know I need a location in space to fire a bullet from, which I've got in the form of a model set as an actor. Now I need to create a new object (in this case, a bullet) with the same starting coordinates as that actor and set its movement direction to be the direction the actor is facing.

(Imagine a gun, a bullet is to be created at the coordinates of the tip of the barrel and the bullet will move forward in the direction that the gun was facing).

I can't figure out how to get the gun to generate the bullet or how to set the speed of the bullet. How can I do that in Unreal?

sentences:
Odd behavior in Unity 5.1 2d project prefabs I am very worried something is corrupt in my project. I am making a 2d top-down rogue-like and am currently using prefabs to generate enemies from. I have started running into an issue where I get a null reference error when trying to iterate a collection of enemies after doing anything on the prefabs, even just selecting one in the editor. If I drag any of the enemy prefabs into the scene then immediately delete it I am fine until I touch a prefab in the inspector again. at one point I was getting "iHasError" 6 times with no info but the unity reinstall fixed that so far

I have tried:

•Deleting the library folder
•Doing a Reimport All
•Uninstalling and reinstalling Unity
•Reloading the project from a few days ago
•Removed a bunch of animations added this weekend
•Commenting out everything I had done recently in the Enemy script
•Googled for a couple hours and looking for things that seem similar

My prefab is structured:

•Gameobject
•Sprite Renderer
•Enemy (Script) About 500 lines
•Animator (simple 2-sprite swap animation)

Does anyone have any ideas?

Mike B

sentences:
How to get dynamic RigidBody rotation/tilt on uneven platform? I have a rigid body with PolygonCollider2D which has some complex circular shape and I'm using uneven platform.

Im using Following code to move the object forward

CharacterRigidBody.velocity = new Vector2 (speed, CharacterRigidBody.velocity.y);

Problem : The rigid body keeps on rotating when it moves forward.

I want the character to move without rotation on asymmetrical  platform(above).But i don't want to freeze rotation because i want the character to tilt when climbing or decending platform.

My RigidBody2D config(I'm using unity 5.1.2)

Can collider do anything with this problem?

sentences:
Text tool for designing gameplay elements I'm still in the design phase of my game and I'm realizing that there are too many elements to keep track of and it just looks like a mess in the plain text that I created it in. My notes are basically going to translate to the classes and subclasses that'll make up the objects within my game, but I'd like to find a tool that will make it simpler to keep track of. Here's an example of the structure of my notes:

NPCs:
    - Humans:
        - Human A: description
            - Abilities:
                - Ability A: description
                [...]
            - Attributes:
                - Attribute A: description
                [...]
        - Human B: description
            - Abilities:
                - Ability A: description
                [...]
            - Attributes:
                - Attribute A: description
                [...]
    - Elves:
        - Elf A: description
            - Abilities:
                - Ability A: description
                [...]
            - Attributes:
                - Attribute A: description
                [...]
        - Elf B: description
            - Abilities:
                - Ability A: description
                [...]
            - Attributes:
                - Attribute A: description
                [...]
    [...]
World:
    - Continent A: overall description
        - City A: city description
            - Building A: description
            [...]
        [...]
    [...]
Items:
    - Melee: overall description
        - Melee Weapon A: description
            - Damage: X
            - Damage Type: some type
            [...]
        [...]
    - Ranged: overall description
        - Ranged Weapon A: description
            - Damage: X
            - Damage Type: some type
            [...]
        [...]

And so on...

Even this simple list is starting to look messy, and once you have pages of classes and multiple subclasses for each class along with lengthy descriptions, it gets really jarring when you view it.

What I would really like is a way to expand and collapse these elements so I can either view the big picture or go down to details, and maybe be able to set some groups a different color or make them bold, etc. for better viewing and categorization. It's basically a class diagram but with more game-world-related descriptions rather than function/method descriptions. I'm currently using Sublime for this, so either a plugin or a different tool that accomplishes this would really help. Thanks!

sentences:
Disable default unity editor behaviour on input I'm creating a tool to create scenes easier on edition mode. I'm using the right click to delete elements, and I'd like to be able to delete several elements by keeping the right mouse button pressed and moving the mouse around.

The issue is that when I keep the right mouse button pressed over the scene window, the Hand Tool automatically activates, making the camera pan as I move the mouse.

Is there a way to disable this behaviour?

sentences:
How can I accommodate custom pronouns in voice acting? I am currently developing an RPG in which, during character creation, players may choose their pronouns as he/him/his, she/her/hers, or a custom entry based on their own text input. Whenever characters refer to them in dialogue, they will use the pronouns listed as they were typed into the character creation.
To head off some objections that have been raised in comments: this game isn't a hardline historical fiction, it's a video game RPG. My setting is what I write it to be, and in my game I want people to be able to make the character they want.
The trouble I've arrived at is that I will eventually be getting dialogue voice acted, and I am not sure how to account for these voice lines. Say for example a character set their name as Pete and pronouns as he/him/his, the dialogue might appear on screen as:

Hey! This is my friend [Pete]! [He] is new in town, want to help me show [him] around?

Under normal circumstances with a male/female only option, I could simply record two lines which omit the name, such that the line sounds like this in voice:

Hey! This is my friend! He is new in town, want to help me show him around?

Pronouns, however, cannot simply be omitted from speech.
What ways can I account for this in the voice acting of my game? Do there exist examples of voice acted games with custom pronouns that get around this issue?
Solutions I have come up with thus far:

Write the story such a way that pronouns simply aren't used in dialogue, only e.g. in UI

This is doable from a writing perspective but doesn't feel right because it makes the pronoun selection feel completely meaningless. I would like players to feel like the gender represented by their pronouns, so a completely pronoun-neutral dialogue would feel weak to me.

In voice acting, use a generic "they/them/their" pronouns and display the custom pronouns in text

Players will notice this, and it will feel out of place. Playing as a "he/him/his" or "she/her/hers" will probably seem confusing when they hear their "common" pronoun replaced with a neutral variant. Also, some consider "they/them/theirs" to be grammatically incorrect.

In voice acting, record three lines: "he/him/his", "she/her/hers", and "they/them/theirs" used for any custom pronouns

This is the solution I'm currently leaning towards, but it still feels dirty. Like I'm offering token representation but then reducing it to an "other".

sentences:
Why is my model's scale changing after rotating it? I have just started a simple flight simulator and have implemented Roll and pitch. In the beginning, testing went very well; however, after about 15-20 seconds of constantly moving the thumbsticks in a random or circular motion, my model's scale begins to grow. At first I thought the model was moving closer to the camera, but i set break points when it was happening and can confirm the translation of my orientation matrix remains 0,0,0. Is this a result of Gimbal Lock?

Does anyone see an obvious error in my code below?

    public override void Draw( Matrix view, Matrix projection )
        {
            Matrix[] transforms = new Matrix[Model.Bones.Count];
            Model.CopyAbsoluteBoneTransformsTo( transforms );

            Matrix translateMatrix = Matrix.Identity
                * Matrix.CreateFromAxisAngle( _orientation.Right, MathHelper.ToRadians( pitch ) )
                * Matrix.CreateFromAxisAngle( _orientation.Down, MathHelper.ToRadians( roll ) );

            _orientation *= translateMatrix;

            foreach ( ModelMesh mesh in Model.Meshes )
            {
                foreach ( BasicEffect effect in mesh.Effects )
                {
                    effect.World = _orientation * transforms[mesh.ParentBone.Index];
                    effect.View = view;
                    effect.Projection = projection;
                    effect.EnableDefaultLighting();
                }
                mesh.Draw();
            }
        }

        public void Update( GamePadState gpState )
        {
            roll = 5 * gpState.ThumbSticks.Left.X;
            pitch = 5 * gpState.ThumbSticks.Left.Y;
        }

sentences:
MVC (Model-View-Controller) Game Engine Architecture - Yes or No? I am reading one great book, Game Coding Complete, and that book strongly recommends using MVC (Model-View-Controller) approach, with three key layers:

Game Application Layer
Game Logic
Game View

To me, this approach looks like an overkill for a mobile computer game.

What is your opinion, please? Is it worth of implementing this architecture, even if it adds extra communication needed between modules? Can this design consume so much CPU power, that at the end, the result would be significantly slower, than if it weren't implemented?

sentences:
Converting 3D coordinates to 2D and back? I'm wondering if there is a simple way to convert 3D coordinates to 2D coordinates. Also, if it's possible, to convert in the reverse direction.

I'm using OpenGL(GLUT) in my C++ project.

I am also using SFML for the 2D information (sprites text etc.)

I found out that I can use gluProject(), but I have no idea how to use this.

I'm asking for a simple example of using gluProject() or another example to convert 3D coordinates (such as from the player) to 2D coordinates.

If I can't get the simple process I'm confident that I can figure out the rest.

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: Free AAA RTS engine SDK? I'm currently trying out the various free SDKs out there (Cryengine3, UDK, Source) however all of them are mainly designed for FPS games. I was wondering if there are other AAA 3D engine SDKs that are aimed towards RTS games?

sentences:
How to make a chat lobby in my game? I'm writing my own RTS game in Delphi. Single-player part is almost done and works well and I'm thinking about adding multi-player to it now. There's going to be a lobby where players should be able to chat and organize games. I tried googling for a convenient way to do it, but couldn't find anything related ..

My idea looks like follows:

Players are identified by Names they choose and their IPs
There's main chat area where all players meet
There are rooms, where players may select game options (map, teams, flag colors, etc..).
After everything is settled players exchange IPs and multi-player engine starts.

I want to avoid usage of server-side software. Currently I'm looking into running everything through SQL database where each player commits posts and his state and reads other players posts/states.

Whats the common practice of organizing in-game chat lobby?

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:
How to pass values in UE2Runtime to UnrealScript? We have a game that launches via vbscript and calls UE2Runtime:

set demofile = filesys.GetFile("..neuro2\Inifiles\"&usrFoldername&"\LostWorld.ini")
'WShell.Run "..\System\UE2Runtime.exe LW1_basic.urt?Class=neuro2.Exp2Subject -log=" & usrName & "_training.log"

How do you grab the value in usrName that is passed to UE2Runtime to a console command in UnrealScript 2 when certain events are triggered in the game?

Many thanks in advance

sentences:
Cube map faster than 6 2D textures? - shadow mapping I've managed to implement shadow mapping to a scene. However, I had problems using a cube map so I eventually gave it up and used 6 2D texture maps instead. To make this work with 6 2D maps, during the rendering process I have to identify in which texture of the 6 each fragment belongs. I'm afraid this could be dropping my frames significantly.

I'm not gonna go into many details for now. I will upload the relevant code if necessary. My main concern is if this method makes my program slower.Will my fps increase using a cube map?

sentences:
Minecraft - How do I check if someone has a clear inventory How do I check if a player has a clear inventory?
I'm making a PvP arena plugin but I need it so when someone types /pvp join, it checks if they have a clear inventory. If they do have a clear inventory, it lets them join, if they don't, it asks them to.

I tried this but it's not reliable as there are more slots:

if(p.getInventory().getArmorContents() == null
    && p.getInventory().getItemInHand() == null
    && p.getInventory().getItemInHand() == null) {

Then I tried this but it did not work:

if (p.getInventory().getContents().length == 0) {

sentences:
from normal to rotation matrix (i'm on OPENGL)

i have a mesh O (object) and a mesh T (terrain).
i know a single triangle in T and i want to orient O to be aligned to that triangle (torate O to align to T in that point).

i have only the normal in the triangle. how can i achive the roation matrix?

i have thought this algorithm:

// pseudocode
float[] normal2rotation(Vector3D normal) {
    angleX = Vector3D.angleBetween(normal, Vecto3D.Axis3D.X);
    angleY = Vector3D.angleBetween(normal, Vecto3D.Axis3D.Y);
    angleZ = Vector3D.angleBetween(normal, Vecto3D.Axis3D.Z);

    float[] result = {angleX, angleY, angleZ};
    return result
}

but it does not give me the desired result.

sentences:
How to convert RotateAround speed to directional speed in Unity? I am currently using

transform.RotateAround(transform.position, Vector3.forward, degreesPerSecond * Time.deltaTime)

to make an object rotate around another object. This works well, but I want to make the object stop rotating around and instead move in a certain direction at the same speed that it was rotating. However, I can not figure out how to convert the degreesPerSecond into a directional speed.

My goal is to have something like this:

if(rotating) {
    transform.RotateAround(transform.position, Vector3.forward, degreesPerSecond * Time.deltaTime)
} else {
    transform.position += transform.right * DegreesToDirectionalSpeed(degreesPerSecond ) * Time.deltaTime;
}

float DegreesToDirectionalSpeed(int degrees) {
    // Code that I don't know goes here
}

Any tips on how to achieve this?

sentences:
How do I read color data from UTexture2D in UE4? Here's my code:

// get RenderTarget2D
static ConstructorHelpers::FObjectFinder<UTextureRenderTarget2D> TargetObj(TEXT("/Game/Textures/RenderTexture"));
// generate a UTexture2D
CameraTexture = TargetObj.Object->ConstructTexture2D(Target->GetOuter(), "mytexture", Target->GetFlags(), 255);
//Turn off Gamma-correction
CameraTexture->SRGB = 0;

//Guarantee no garbage collection by adding it as a root reference
CameraTexture->AddToRoot();

//Update the texture with new variable values.
CameraTexture->UpdateResource();

GetColor(CameraTexture);

...

FLinearColor ANextGenHUD::GetColor(UTexture2D *MyTexture2D)
{
     FColor* FormatedImageData = static_cast<FColor*>(MyTexture2D->PlatformData->Mips[0].BulkData.Lock(LOCK_READ_ONLY));
     for (int32 y = 0; y < MyTexture2D->PlatformData->Mips[0].SizeY; y++)
     {
         for (int32 x = 0; x < MyTexture2D->PlatformData->Mips[0].SizeX; x++)
         {
             int32 curPixelIndex = (y * MyTexture2D->PlatformData->Mips[0].SizeX) + x;
             FColor c = FormatedImageData[curPixelIndex];
             c.A = 255;
             MyTexture2D->PlatformData->Mips[0].BulkData.Unlock();
             return c;
         }
     }
}

This code is a bit messy fo testing purposes, but shoiuld theoretically get me the color of the first pixel. Instead it just gives me a random color the constantly changes as well when I draw it on the HUD.

What am I doing wrong?

sentences: How to make a delay between animations in mecanim? How to make a delay between animations in mecanim? For example after anim1 ends then there will be a delay then anim2 starts. I tried to increase the exit time but it doesnt work.

sentences:
Should we always prefer OpenGL ES version 2 over version 1.x OpengGL ES version 2 goes a long way into changing the development paradigm that was established with OpenGL ES 1.x. You have shaders which you can chain together to apply varios effects/transforms to your elements, the projection and transformation matrices work completly different etc. I've seen a lot of online tutorials and blogs that simply say "ditch version 1.x, use version 2, that's the way to go". Even on Android's documentation it sais to "use version 2 as it may prove faster than 1.x".

Now, I've also read a book on OpenGL ES (which was rather good, but I'm not gonna mention here because I don't want to give the impression that I'm trying to make hidden publicity). The guy there treated only OpenGL ES 1.x for 80% of the book, and then at the end only listed the differences in version 2 and said something like "if OpenGL ES 1 does what you need, there's no need to switch to version 2, as it's only gonna over complicate your code. Version 2 was changed a lot to facillitate newer, fancier stuff, but if you don't need it, version 1.x is fine".

My question is then, is the last statement right? Should I always use Open GL ES version 1.x if I don't need version 2 only stuff? I'd sure like to do that, because I find coding in version 1.x A LOT simpler than version 2 but I'm afraid that my apps might get obsolete faster for using an older version.

sentences:
How to write properly shader with gradient based on vertex-color? I took 4 squares with the outer corners painted in black, and the other ones in white. For some reason, they have a different gradient.

fixed4 frag (v2f i) : SV_Target
{
    fixed4 mainTex = tex2D(_MainTex, i.uv);
    fixed4 overTex = tex2D(_OverTex, i.uv3);
    fixed4 final = fixed4(lerp(mainTex.rgb, overTex.rgb, overTex.a) * i.color, 1.0);
    final = lerp(float4(0, 0, 0, 1.0), final, i.color.a); // shadows

    return final;
}

How can i make the same gradients as bottom-left and top-right?

In-game this is faces of blocks (like minecraft) and gradients - is smooth shadow/light. So I cannot change tris

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 automatically test a game's mechanics without duplicating work? I've heard and read enough programmers firmly advocating automatic tests. According to many, tests are themselves part of a code's functionality, untested code is broken and/or legacy by definition, long-term manual testing is more time-consuming and provides far weaker guarantees against failures than automatic testing... etc.

I'm trying to hobbystically develop a turn-based Pokemon-like game. While talking to a far more experienced developer I said that when I add a new attack I run my game, go into 1v1 combat, use this move and see if it does what its supposed to do. His answer was: Why won't you instead write a test that goes into a 1v1 combat, uses this move and checks if it does what it's supposed to do? Doing what you're doing manually may be faster than writing tests if you do it once, twice, thrice. But after 10 times? One hundred times?

I'm thinking about what he said. I'm thinking and I still don't feel convinced. About any other kind of project, perhaps. But a game?

Assume I'm adding lifesteal to a monster's attack. Problem is I'll have to anyway boot my game and play it! To see if it feels right, if it plays right, if not for anything else.

Tests on the other hand add maintenance cost: for example, once I (for balancement reasons) change the lifesteal coefficient, I'll have to reflect that change in tests. (Or I won't have to reflect this change in tests if I copy&paste the formula, parametrized by attack strength, lifesteal coefficient, etc, but doesn't this defeat the purpose of testing?)

Automatic tests are supposed to replace manual tests; but given I have to manually play my game anyway, isn't this duplication of work?

Or is my thinking wrong? What am I missing?

sentences:
2D map/plane with nodes overlayed that supports panning, scaling and clicking on nodes I'm trying my hand at Android development and seem to be running into an invisible ceiling in trying to get what I want accomplished. Basically I'm trying to create an app that renders a 2D surface map that I can (pinch) zoom and pan. I'll have to place nodes on the surface of the map that will scale/zoom and pan in relation to the surface.

I started out with a 2D ImageView approach and got as far as pinch zoom, pan and laying nodes as relative ImageViews, but all the methods I tried to get X,Y,W,H for the 2D surface were always off for some reason. Additionally, I was never able to scale the node ImageViews correctly, and as a result never got far enough to try and work out their X,Y scaled offset.

So I decided to get back to 3D rendering. Conceptually pan/zoom is camera manipulation, so I don't have to mess with how to scale the 2D map or the nodes. But I need a starting point or sample to get me going that's close to what I'm trying to achieve. A sample on a translucent spinning cube isn't helping as much as I need it to.

Any tips? Links, insults and sympathy are all welcome!

sentences: How to use/apply class inheritance in Enchant.js You're developing a game using Enchant.js and you just need an Enemy class which multiple enemy classes derive from and every enemy has its own sprite and stuff.

sentences:
How should I make (3D) buildings that can be entered in the game? I have no idea about how would I make a building that can be entered in a game.
Should I model separate parts of it and than combine them or should I model the entire thing as one object?

Are these things are built up in a 3D modeller like blender or if not where?

sentences:
Load scene without being in build settings and without using AssetBundle This is the closest I've gotten:

    EditorSceneManager.OpenScene(
        AssetDatabase.GUIDToAssetPath(
            AssetDatabase.FindAssets(
                "t:SceneAsset " + MenuSceneName,
                new string[] { "Assets" }
            )[0]
        )
    );

However this generates an error at runtime:

InvalidOperationException: This cannot be used during play mode, please use SceneManager.LoadScene()/SceneManager.LoadSceneAsync() instead.

I can't follow its suggestion because those functions require the scene to be in build settings or an asset bundle. So, is there any other option?

I wonder how (and if) Addressables achieve this? Note: I'm not willing to switch to Addressables - I'm quite enjoying working with AssetBundles.

Why?

My game uses AssetBundles for general loading of EVERYTHING, so there's only one blank scene in build settings. However, during development I'd rather not have to continuously build and load from AssetBundles, so I'm trying to dynamically load scenes WITHOUT having to add them to build settings.

sentences:
Lots of bouncing balls sink into each other I'm trying to model a system that simulates an arbitrary number of bouncing balls with some gravity. So far I've come up with a solution that can be seen here: https://github.com/ahahalol/BouncingBalls

It works fine if the number of balls is small (a few dozens) or if I do not set any gravity. But once I turn gravity on and set the number of balls to a few hundreds, the balls "on the bottom" start sinking into each other over time as new balls fall on them "from the top".

Here's a picture that shows lots of sinking balls when I have gravity and hundreds of balls:

I want a system that perfectly simulates rigid balls physics: no matter how many objects "on top" push the ones "on bottom", nothing should ever sink. How can I achieve this?

sentences: Use of SpriteFonts without installing on host machine I am working on a Windows game for my university project. In this project I am using a custom TrueType font which is not installed on any university computers. For submission my game is required to run in debug mode and a demonstration given. Therefore is there any possible way to read the font from within my project rather than installing the font on each computer that the project will be viewed on.

sentences:
Why do my character's feet slide when I auto-configure a humanoid rig in Unity3D? I've downloaded an FBX animation of someone walking from the "Walking" section here.

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

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

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

Thanks

sentences:
Java JBullet models not colliding Hello I wan't to do model collsion in JBullet but that don't won't to work. Models look like have some invisble holes.

Here the code for creating collsion shape:

int triangles_count = (int) ((mesh.getVertices().length) / 3);
    int vertices_count = (int) (mesh.getVertices().length);

    ByteBuffer index = BufferUtils.createByteBuffer(vertices_count * 3 * 4).order(ByteOrder.nativeOrder());
    index.clear();
    for(int i=0; i < triangles_count; i++) {
        index.putInt(i);
    }

    ByteBuffer shape = BufferUtils.createByteBuffer(triangles_count * 3 * 4).order(ByteOrder.nativeOrder());
    shape.clear();
    for(int i=0; i < triangles_count; i++) {
        shape.putFloat(mesh.getVertices()[i].getPos().x());
        shape.putFloat(mesh.getVertices()[i].getPos().y());
        shape.putFloat(mesh.getVertices()[i].getPos().z());
    }

    shape.rewind();
    index.rewind();

    TriangleIndexVertexArray triangle_mesh = new TriangleIndexVertexArray(triangles_count, index, 3 * 4, triangles_count, shape, 3 * 4);
    BvhTriangleMeshShape out_shape = new BvhTriangleMeshShape(triangle_mesh, true);

    return out_shape;

When I change first for loop to this:

for(int i = 0; i < vertices_count; i++)

I have exception  java.lang.IndexOutOfBoundsException produced in this line of code:

BvhTriangleMeshShape shape = new BvhTriangleMeshShape(trimesh, true);

sentences:
Interpolating positions in a multiplayer game In order to save bandwidth in my multiplayer game, I do not update every object every server tick, instead each object has an updateRate which tells the game that this object is expected to be updated every X server ticks.

When I receive an update message for an object I calculate the time I expect the next update to come in:

origin = serverCurrentPosition
diff = serverNextPosition - origin
arriveTime = now + timeBetweenTicks * updateRate

When I draw the object I calculate the time that's left till the next update and interpolate the position accordingly:

step = 100 / timeBetweenTicks * updateRate
delta = 1 - step * ((arriveTime - now) / 100)
position = origin + diff * delta

It works... but there's still a bit of jitter in the drawing, although in my theory every thing should work out fine, since the scaling should take care of some amount of lag, should it?

So the question here is, is this the best approach? Should I put actual lag into the computation? If so, how would I do that? I did some experiements, but the jitter only got worse.

sentences:
Rotate/Translate object in local space I am just trying to create a movementcontroller class for game entities. These class should  transform the entity affected by the mouse and keyboard input. I am able to calculate the changed rotation and the new globalPosition. Then I multiply:

 newGlobalMatrix = changedRotationMatrix * oldGlobalMatrix;
 newGlobalMatrix = MatrixSetPosition(newPosition);

The problem is that the object rotates around the global axis and not around the local axis.

I use XNAMath for the matrix calculation.

sentences:
How do you actually build once you encounter the 'Too many method references' error? I'm making a very simple mobile F2P arcade game in Unity
After adding SDKs for facebook, gamesparks, firebase, and appodeal I coud not build, getting the "Too many method references: 76221; max is 65536" error.

The solution from Too many field references: 70613; max is 65536 is apparently to export an ADT project, import it into Android studio and go from there.

I built following these instructions, and after building my Android studio project had errors relating to the facebook SDK similar to here: Unity exporting android project with Facebook SDK issue

The solution proposed there is to copy all the .aar from your Unity project to files to the Android studio project and add lines to the build.gradle file referencing them, which I did.

After doing all that the 4 facebook related errors are gone but one new one appears:

  Error: more than one library with package name 'android.support.v7.appcompat

A proposed solution for that is to search for the offending file and delete it in windows explorer but there is nothing with that name in my Android studio project folder. I tried removing some .aar files with appcompat in the name but I ended up reverting to the previous 5 facebook errors

This whole thing has been a bit of a nightmare and I have no idea what I am doing. I would love to hear from someone who encountered this error and got past it and was able to build their game again. Surely this must be a common issue for anyone making a commercial mobile game in Unity?

sentences:
How can I convert screen coordinates from a click to 2D scaled world coordinates? I need a way to convert screen coordinates obtained from mouse clicks to world coordinates in my 2D game.

To create a zoom effect controlled by the user, before drawing a model I will scale all of it's points by a world scale value.

The screen origin (0,0) is at the top left corner while the world has it's center (0,0) at the center of the screen (width/2, height/2).

I need a function to convert the coords obtained by mouse clicks (screen coords) to the corresponding scaled-world coordinates, so that I can determine what world element is clicked by the user in this scaled world.

Any of my approaches worked as required and unfortunately none of the found solutions where aplicable to my case.

This is a very simple example JS Bin:

Use the mouse wheel to zoom in/out
Click on the screen to set a point

Thanks!

sentences:
SFML function does all the job with setting up timestep? Usually i set up timestep something like this:

timestep=1.0f/60.0f;
if(time>=timestep)
{
update;
time-=timestep;
}

But SFML has the next function: window.setFramerateLimit(). Does it do the same thing i described above?

sentences:
Depth testing before fragment shader Accoring to this, depth testing is usually performed after the fragment shader stage. Why is that? I thought that a fragment is sent with its depth value to the FS, then the depth test happens before the FS executes, so the gpu can avoid a spare FS execution if the pixel is covered by a closer one.

Why is it not like that?

sentences:
How to solve this Git SourceTree conflict? I have recently joined a amateur studio as the single programmer. The previous programmers have left me the project folder. Upon trying to create a repository and a new remote to have version control I encountered a problem. Upon using source tree a lot of previous versions appeared, on a pretty long branch, somehow it knew all the previous versions and who made them.

Now, upon trying to push them to a new remote I created, as I do not have access to the old one, I get a conflict problem and upon pulling I get another.

git -c diff.mnemonicprefix=false -c core.quotepath=false --no-optional-locks push -v --tags --set-
upstream ********* master:master
Pushing to https://github.com/*******
To https://github.com/******
! [rejected]        master -> master (non-fast-forward)
error: failed to push some refs to 'https://github.com***'

hint: Updates were rejected because the tip of your current branch is behind
hint: its remote counterpart. Integrate the remote changes (e.g.
hint: 'git pull ...') before pushing again.
hint: See the 'Note about fast-forwards' in 'git push --help' for details.

Completed with errors, see above.

f

git -c diff.mnemonicprefix=false -c core.quotepath=false --no-optional-locks fetch ***

git -c diff.mnemonicprefix=false -c core.quotepath=false --no-optional-locks pull --no-commit
****
 master
From https://github.com/********
* branch            master     -> FETCH_HEAD

fatal: refusing to merge unrelated histories
Completed with errors, see above.

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:
Lock Z axis from the gyroscope rotation Here's the code I use.

public class CameraGyro : MonoBehaviour {

private float initialX;
private float initialY;
private float initialZ;

// Use this for initialization
void Start () {
    Input.gyro.enabled = true;

    initialX = Input.gyro.rotationRateUnbiased.x;
    initialY = Input.gyro.rotationRateUnbiased.y;
}

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

    transform.Rotate (initialX - Input.gyro.rotationRateUnbiased.x, initialY - Input.gyro.rotationRateUnbiased.y, 0f);
}

}

The thing is when I rotate the phone, the Z axis seems to change even if I've set it to 0f in the code above. Is there a way to really lock this position to 0?

sentences:
Space partitioning when everything is moving Background

Together with a friend I'm working on a 2D game that is set in space. To make it as immersive and interactive as possible we want there to be thousands of objects freely floating around, some clustered together, others adrift in empty space.

Challenge

To unburden the rendering and physics engine we need to implement some sort of spatial partitioning. There are two challenges we have to overcome. The first challenge is that everything is moving so reconstructing/updating the data structure has to be extremely cheap since it will have to be done every frame. The second challenge is the distribution of objects, as said before there might be clusters of objects together and vast bits of empty space and to make it even worse there is no boundary to space.

Existing technologies

I've looked at existing techniques like BSP-Trees, QuadTrees, kd-Trees and even R-Trees but as far as I can tell these data structures aren't a perfect fit since updating a lot of objects that have moved to other cells is relatively expensive.

What I've tried

I made the decision that I need a data structure that is more geared toward rapid insertion/update than on giving back the least amount of possible hits given a query. For that purpose I made the cells implicit so each object, given it's position, can calculate in which cell(s) it should be. Then I use a HashMap that maps cell-coordinates to an ArrayList (the contents of the cell). This works fairly well since there is no memory lost on 'empty' cells and its easy to calculate which cells to inspect. However creating all those ArrayLists (worst case N) is expensive and so is growing the HashMap a lot of times (although that is slightly mitigated by giving it a large initial capacity).

Problem

OK so this works but still isn't very fast. Now I can try to micro-optimize the JAVA code. However I'm not expecting too much of that since the profiler tells me that most time is spent in creating all those objects that I use to store the cells. I'm hoping that there are some other tricks/algorithms out there that make this a lot faster so here is what my ideal data structure looks like:

The number one priority is fast updating/reconstructing of the entire data structure
Its less important to finely divide the objects into equally sized bins, we can draw a few extra objects and do a few extra collision checks if that means that updating is a little bit faster
Memory is not really important (PC game)

sentences:
Mapping 3D object coordinates to 2D screen coordinates with perspective projection Sort of following on from where this person was in their topic:
Matrix for 2D perspective

What I have at the moment is a transformation matrix that's defined as follows:
http://pastebin.com/GM6BhP0R
-- The field projMat is just a 4x4 matrix.

I have an array of 3D points that I'm trying to map to the canvas and I'm doing that by first multiplying each vertex (3D point) by a view matrix, which I've just set to the identity matrix for the time being, although if I can get this set up that will be responsible for creating a camera with I suppose.

Lastly I take this newly transformed 3D point and I multiply it by the projection matrix as defined in the code sample above. I was hoping that this would give me the screen coordinates for the points, however there appears to be no depth to the points (e.g. points with a higher Z coordinate should start to taper in, while closer points shouldn't), so objects further away from the camera appear smaller.
As I said though, after the transformations it appears to render the points in the same position irrespective of its Z coordinate. Here's how I'm rendering the points (in Java just in case you want to know):

for(int i = 0; i < vertices.length; i++) {
    Vector3f transPos = Matrix4f.multiply(projMat, Matrix4f.multiply(viewMat, vertices[i]));
    screen.drawPoint((int) transPos.getX(), (int) transPos.getY(), 0xffffffff);
}

As you can see here the inner multiplication just multiplies the vextex (point) with the view matrix, which is set to the identity, then the 3D vector that's produced by that is then multiplied by the projection matrix, which should set it to a perspective view.

If you can see where I've gone wrong I'd appreciate any help.

sentences:
Roguelike 2D Collision Detection I'm just a normal guy trying to do some basic collision detection but I suck at it. I either get stuck in a wall or I go in reverse in the wrong direction trying to update the player position to a non collision part. So here is how I check for collision and this function will return true or false. True if collision and false if not.

roguelike.player.collision = function() {
  var player = roguelike.player;
  for(var i = 0; i < roguelike.map.rooms.length; i++) {
    var room = roguelike.map.rooms[i];
    if(player.x > room.x && player.x < room.x + room.width && player.y > room.y && player.y < room.y + room.height){
      return false;
    }
  }
  return true;
};

This function works just fine just like expected. But it's when I try to stop the player when he hits a wall is where I get bugs. When the player goes down and hits a wall he gets stuck there. Here is the function that updates the player position.

roguelike.update = function() {
  var player = roguelike.player;

  //Left
  if(player.moving.left && !player.collision()) {
    player.x -= roguelike.game.speedPerSecond(player.speed);
  } else if(player.collision()){
    player.resetPosition();
  }
  //Up
  if(player.moving.up && !player.collision()) {
    player.y -= roguelike.game.speedPerSecond(player.speed);
  } else if(player.collision()){
    player.resetPosition();
  }
  //Right
  if(player.moving.right && !player.collision()) {
    player.x += roguelike.game.speedPerSecond(player.speed);
  } else if(player.collision()){
    player.resetPosition();
  }
  //down
  if(player.moving.down && !player.collision()) {

    player.y += roguelike.game.speedPerSecond(player.speed);
  } else if(player.collision()){
    player.resetPosition();
  }
  player.savePosition();

};

So what I do is check what direction the player is moving and if there is no collision detected then the player is free to move. Otherwise if there is a collision I put the player position as the last position he was when there was no collision so he will be free to move. This works going left, up, and right, but not going down. Going down the player gets stuck in the collision and the resetPosition function doesn't put the player back in the safe zone.

So I know there must be a better way. And I would appreciate your advice on what you think that way should be.

sentences:
How to model classes to be serialisation friendly in c#? It is going to be just a fraction of the code but for the sake of the example let's say I have a class Stat

class Stat
{
    private string _name
    public Name { get { return _name; } }

    public Stat(string name)
    {
        _name = name;
    }
}

When I serialise object of type Stat with for example TinyJSON, it produces:

{ "Name": "some random name" }

So I figured I will create StatData with public property and not a getter so then I can use it for serialisation.

class StatData
{
    public string name
}

As far as I can tell I have now 2 choices:

Write converter method and, upon serialisation request, convert Stat to StatData and serialise StatData.
Pros: single responsibility principle preserved
Cons: more code and nested dependencies
Go with private StatData _data in Stat class and using getters as previously and adding, eg.: ToJSON() method on Stat
Pros: public interface
Cons: generics to handle inheritance eg.: StatComposite and serialiser dependency

Is/are there any other method(s) or potentially design pattern to deal with the problem?

sentences: Pathfinding Algorithms I am new to game programming I currently am using unity's 2D power to remake an 2D game for sake of practice. So I am just little confuse about one thing, so far every enemy in my game was dumb(they move on predefined paths) but this enemy, alien-copter, flies and follow the player wherever the player goes. My question is should I implement any pathfinding algorithm? I had studied A* but I trying to figure out if A* is gonna be helpful in my envoirnment because player will be moving and the enemy have to keep on looking for shortest path. I tried to write code for this AI my code was working perfect when there were no obstacles but my game has obstacles so I want something efficient so what do you people think should I implement A* or any other algorithm or not?

sentences:
Draw/"rasterize" irregular circle onto a 2D grid I'm using the midpoint circle algorithm to choose cells on a 2D grid which outline a circle. However, I need to incorporate some random noise so that I get an irregular circle, and this method won't work anymore given how it works. Another stack exchange answer describes an equation (the "pink noise" example) I'd like to try but I'm not sure on the best approach to implement it.

I can replicate the equation via code, but I'll need to start choosing grid cells/coordinates differently and I'm not sure the best solution.

How can I "rasterize" an irregular circle like this?

sentences:
How to generate random level from a seed? How would I go about using a random seed to generate a game level? The same seed should always generate the exact same level.

For this example it would be a Worms style level. So each level would have a theme (grasslands, snow etc), base terrain, different objects such as trees.

So where would I start to create this kind of level generator? What would be involved? What concepts does it use?

Bonus points for any any good links (bonus bonus points for anything related to how it was done in worms or similar).

Thanks.

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:
OpenGL large tile map rendering I want to be able to have a big tilemap (e.g. like Terraria, or an infinite procedural generated one), with only a handful of tiles on my screen.

This means that I have a texture atlas (i.e. spritesheet) which contains the textures for the tiles. For the sake of simplicity, let's assume that I have a huge internal 2D array, containing the tileIDs and a lookup tablel/hasmap for the UV coords for each tile type. All the tiles have the same dimension (the texture AND the onscreen tiles). I know a couple of methods to render such a 2D grid/tilemap, but I don't know which one of them is a solid foundation for a game which heavily relies on modifiable tiles.

Additionally, I want to be able to dynamically change the tilesize (i.e. zooming in/out), modifying the tiles/tilemap (e.g. destroying, building) and fast loading (fast paced player actions).

Using a single draw call. I create a VBO with all the quads to fill the screen (multiple overlapping vertices, because each quad needs a different texture) and have a persistent buffer to modify the texture buffer object. As soon as the camera moves, I update the UV coordinates in the TBO.
I can use attributeless rendering. I make a glDrawArrays call on an empty VAO, and use gl_VertexID%6 and gl_VertexID/6 to get the vertex ID and the tileID. To map the UV coordinates, I pass a TBO, which is updated at every camera move. I don't know how expensive this calculation is for the GPU.
Hoping on the train of attributeless rendering, I can pass a uniform or create a const array to hold the UV offsets of every tile type, and only pass at every camera move the updated tile type IDs to the shader (with a uniform?). With gl_VertexID/6 I know which index holds the current tiles type information, and then with this type, I can access my constant array to lookup the UV coordinates.
Either using triangle strips, or indices to reduce the vertex count, and use provoking vertices to correctly map the UV coordinates (this can be combined with attributeless rendering). The vertices are all fixed for the window, and only the textures change. Here, once again, I have to map the TBO to a persistent buffer and update it at every camera move.
Every tile gets a separate draw call (thus a separate VBO, IBO, TBO) and I can therefore render only the tiles which are seen by the camera. Because of the low amount of onscreen tiles, those separate draw calls shouldn't be too expensive.
I put the whole map at the start of the game in the VAO and TBO, and modify the indices buffer, to only render the onscreen tiles (the IBO only holds enough indices to render the onscreen quads). My problem here is that I send too much data to the GPU every frame, and I have a really bad cache locality, because the information has to be accessed from different parts of the buffer objects.
There might also be a way to use a geometric shader, although I have never used one.

My concrete question is, is there a "state of the art" method to render big tilemaps, is any of my above mentioned ideas a good solution, and, does it really matter which option I use?

Thank you!

sentences:
Unity: How to use delegates with EventManager ? and use variable number of arguments in listenners? As answered here, I would like to know how to implement an EventManager with delegate instead of UnityAction for pass arguments. I tried but I did not succeed.

Also, can someone tell me if it's a better solution than following ? And is it possible to change this code for invoke listenners with a variable number of arguments?

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

namespace Assets.Scripts
{
    [System.Serializable]
    public class Event : UnityEvent<System.Object> { }

    public class EventManager : MonoBehaviour
    {

        public static EventManager Instance;

        private Dictionary<string, Event> _eventDictionary;

        private void Awake()
        {
            ...
        }

        public static void StartListening(string eventName, UnityAction<System.Object> listener)
        {
            Event thisEvent = null;
            if (Instance._eventDictionary.TryGetValue(eventName, out thisEvent))
            {
                thisEvent.AddListener(listener);
            }
            else
            {
                thisEvent = new Event();
                thisEvent.AddListener(listener);
                Instance._eventDictionary.Add(eventName, thisEvent);
            }
        }

        public static void StopListening(string eventName, UnityAction<System.Object> listener)
        {
            if (Instance == null) return;
            Event thisEvent = null;
            if (Instance._eventDictionary.TryGetValue(eventName, out thisEvent))
            {
                thisEvent.RemoveListener(listener);
            }
        }

        public static void TriggerEvent(string eventName, System.Object arg=null)
        {
            Event thisEvent = null;
            if (Instance._eventDictionary.TryGetValue(eventName, out thisEvent))
            {
                thisEvent.Invoke(arg);
            }
        }
    }
}

sentences:
LibGDX Cross Platform Networking Backstory:
I've been developing a game with LibGDX for the past two years, and I've seen it refactored more times than I remember.

I jumped on the iOS iKVM port as soon as it was released.
But I've been struggling with it ever since in regards to cross platform networking.
Kryonet will not port over to iOS unfortunately. So it's either I ditch Kryonet, or lose a large chunk of my target audience (iOS Users)

My question for you is:
I noticed LibGDX has cross platform classes ready for sockets and HTTP Requests, but no documentation exists for these sockets at all.

Has anyone used these sockets at all in the past, and does anyone know how they work?

sentences:
Box2dWeb: must fixtures be destroyed explicitly when destroying the body? I use b2WorldObj.DestroyBody(bodyObj) to destroy the body when it is not needed anymore. The body has one fixture attached to it.

Do I need to destroy the fixture before destroying the body? or should I assume that by destroying the body all its fixtures will be automatically destroyed?

Right now, I do not destroy the fixtures explicitly and the game runs fine. But my concern is more about memory leaks. I want to make sure that all the bodies and fixtures that are not used anymore are completely removed from the memory. How can I best achieve this?

Thanks!

sentences:
XNA 4.0 - Mixing 3D and 2D - SpriteBatch putting weird alpha texture over whole scene I am working on a game in XNA 4.0 that has been entirely in 3D so far but now I want to incorporate a HUD.

I have tried doing a simple test using spriteBatch as such:

spriteBatch.Begin();
spriteBatch.Draw(Player.Texture, new Rectangle(0, GameConstants.GraphicsDevice.Viewport.Height - 50, 50, 50), Color.White);
spriteBatch.End();

This works fine and the test texture shows as a rectangle in the correct position but the 3d World behind seems to have a sort of "haze" over the top which looks like the drawn "Player.Texture" has been put all over the viewport but at an alpha of like 0.1f.

I googled around and have a reset() function to change some of the GraphicsDevice properties back after drawing the SpriteBatch but nothing has changed and I haven't seen anyone else with this problem.

I thought it would be that SpriteBatch changes the blendmode to additive but in my reset() function I set the blendmode to opaque so I have no idea where this strange effect is coming from, it looks like I've ran some post-processing on the whole scene.

If I change the Player.Texture that is drawn in the SpriteBatch then the "haze" changes to look like the new texture so it is definitely to do with that.

Are there any other GraphicsDevice propterties I should check to change back?

Edit

Okay, I have just realised the "haze" over the top is from the SkySphere texture, I am using the MSDN skysphere shader from this tutorial.

So when I comment out the SkySphere code, the spritebatch and 3d drawing looks completely fine, but this leaves me with the problem that I can't have a SkySphere anymore.

Is there some reason why the skysphere is sort of drawn over the scene translucently rather than behind the 3D after I use a SpriteBatch? As I said before, it kind of looks like additive blending.

Below are 2 screenshots, the top is with spritebatch and no skysphere, below is with spritebatch and skysphere where I am having problems. I have cropped the images down to save upload (my internet is pretty slow at the moment) and I've changed the area of the scene in the 2nd image to show more clearly what it looks like. As I move around the scene with the camera the "haze" overlay stays in the same place exactly as how the SkySphere works, as in not taking into account the world matrix.

sentences:
Monogame: Texture anti-aliasing result in transparent edges This is a follow-up question on a previous issue I faced with a game I'm trying to make. It's in a 2D isometric perspective and the levels are created from individual tiles. A simple 3x3 map can be seen here:

The tiles are individually added to the sprite batch, and (at least, this is what I think is happening) each one get anti-aliased on their edges, resulting in a small blur which creates the thin edges that you can see in the picture.

To make matters worse, I actually want to provide a bit more complex tiles in my game than what is displayed above. For example, I want to be able to show roads. To do so, I wanted to layer multiple sprites on top of each other, resulting in the picture below:

I think you can see where I'm going here. The same problem that I described with the aliasing is now occuring aroud each texture. So sad.

I know I can use Point sampling to make the textures align pixel perfect, but even though this does work, the (relatively) high resolution textures really do not seem fit for such a setting:

I mean, these edges simply need to be anti-aliased.

So, my question to you all is: Is there a way to stitch my tiles (and tile-pieces) together in a way so that anti-aliasing does not ruin it with those annoying edges, while still being able to produce a nicely anti-aliased result?

I hope there is, and that someone here can show me how :)

Thanks,

Rutger

Edit 1: Changed the title to be more representative to the problem (I hope?)

sentences:
How do I program attacks and combos in a fighting game? I'm working on a game a bit like "Super Smash Bros.", using C++ and SFML. I can't figure out a good way to program attacks.

First, I coded individual functions for each attack. The problem with this was that I needed three functions for each attack; one for dealing knock-back to other players, one for setting variables for the actual punch and one for checking for unique types of collision. This ends up being almost the same code for all the other attacks, and was also very messy for programming combos.

I then tried creating a class called Attack, and inherited classes like Punch and Kick. The problem with this was that I wasn't sure how to implement all of the methods in the Player class.

How do I program attacks and combos in a fighting game?

sentences:
Randomised Path from A to B for cursor movement simulation I'm trying to simulate the movement of the mousecursor, by creating a path from point A to B that has random variation. The algorithm I'm using at the moment is very basic, and is limited in that  it's only really good for creating a path where X and Y distance from the start are the same, forming a square:

The code looks something like this:

   function calcualtePath(from, to)
   {
      var pathNodes = [];
      while (from.x != to.x || from.y != to.y)
      {
         var newTransition = {x: from.x, y: from.y};

         if (Rand(1, 3) != 1 && newTransition.x > to.x)       newTransition.x--;
         else if (Rand(1, 3) != 1 && newTransition.x < to.x)  newTransition.x++;
         if (Rand(1, 3) != 1 && newTransition.y > to.y)       newTransition.y--;
         else if (Rand(1, 3) != 1 && newTransition.y < to.y)  newTransition.y++;

         pathNodes.push(newTransition);
         from = newTransition;
      }
      return pathNodes;
   }

I'd like some assistance in creating is a relatively fast algorithm that creates a randomised path between point A and B, that has a more curve like path and isn't limited like the one above. Ideally something a bit like this, with a pronounced curve:

sentences:
Unity - Get list of gameobjects close to object clicked? I have a stack of balls of 4 colors some touching some not. When you click on one color ball I want to destroy that ball and any other balls of that color that are close. They may not be touching so collision wont work.

How do I detect gameobjects close but not touching that are the same color? Say half a radius away from the edge of the ball clicked.

Here are the two scripts I'm working with to create and touch the game objects.

public class SpawnBalls : MonoBehaviour {
public Rigidbody ball;
public float waittime = 0.5f;

// Use this for initialization
void Start () {
    spawn ();
}

// Update is called once per frame
void Update () {
    //Instantiate (ball);

}
public void spawn(){
    //yield WaitForSeconds(waittime);

        for (var i = 0; i < 10; i++) {
            Instantiate (ball);
        }
}

}

Selecting the balls

public class Ball : MonoBehaviour {

public Color[] colors;
private Color ballpicked;

// Use this for initialization
void Start () {
    GetComponent<Renderer>().material.color = colors[Random.Range (0, 4)];
}

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

}
 void OnMouseDown(){
    if (Input.GetKey("mouse 0")){

        ballpicked = GetComponent<Renderer> ().material.color;

        //if (ballpicked == "Any other balls within a half a ball width") {

        //}

        Destroy (gameObject);
    }
}

sentences:
In Inform 6, what is LibSerial and how does it factor into action-based dispatching? By no small amount of pain, I have discovered that the following  Inform 6 source doesn't work as expected: instead of calling the right branch of Bar.after based on the current action, it always prints Called from Foo:

Global action;

[ R_Process a;
    action = a;
    indirect(#actions_table-->a);
];

Verb 'foo' * -> Foo;
Verb 'baz' * -> Baz;

Object Bar "bar"
  with after [;
    Foo: "Called from Foo";
    Baz: "Called from Baz";
    ];

[ BazSub;
    print "[Baz]^";
    Bar.after();
];

[ FooSub;
    print "[Foo]^";
    Bar.after();
];

[ Main;
  <foo>;
  <baz>;
];

Running it produces the following output:

[Foo]
Called from Foo
[Baz]
Called from Foo

However, if I prepend the following three lines to the Inform script above, then it works as expected:

Constant LibSerial "foo";
Global reason_code;
Property additive life;

Now the output becomes:

[Foo]
Called from Foo
[Baz]
Called from Baz

The three lines are all important:

Omitting the definition of the LibSerial constant (i.e. keeping the other two lines only) causes Called from Foo to be printed from both callbacks.
Omitting the declaration of the (as far as I can see, unused) variable reason_code gives the following compile-time error:

"<constructing output>", line -65535:
Error:  No such constant as "reason_code"

Omitting the declaration of the life property causes a similar compile-time error:

"<constructing output>", line -65535:
Error:  No such constant as "life"

So basically my question is, what is going on here? What is the effect of defining LibSerial and why does it need the life property and the reason_code global variable to be declared?

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: 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:
Stuck on development of turn-based-strategy game I am developing a turn based political/military strategy game similar to the DOS game Conflict.  I have my game design document completed, but I'm having trouble actually putting together the logic of the turns.

How do I determine the strengths/weakness of the various nation-states in my game?  Is there a common set of mathematical formulas somewhere on the interwebs that I can modify?  Or do I need to come up with my own?

If I do need to come up with my own, how do I go about doing this?  I have very limited experience playing games like Dungeons and Dragons and Settlers of Catan--would it be a good idea for me to buy a copy of a board game that is similar to my idea and model my game off that?

sentences:
Getting user id from one scene then to the next scene I'm new to multiplayer and photon so pardon me if this question is somewhat frequent.

I have successfully set up my project to start from a main menu - waiting room - actual gameplay scene.
However I couldn't search my way through getting a sort of user id from waiting room(ie; order of user joined to waiting room) then use it in the gameplay scene to manipulate sort by score / by hp / etc.

Perhaps I got the while concept of having to identify unique players via such variable? I'm not quite sure. I just got my foot in the multiplayer development realm, so please go easy on me.

// Edit

Sorry for my initial question being quite vague.
Basically, I'm trying to replicate this with Photon.
I've got various things set up but was stuck at where designating individual players to individual player info panels as if captured(Get WHAT to connect to those UI elements I've got set up).

It'd be simple enough even for me if this was a singleplayer, but since it's not I'm also refactoring a lot on the way as well.
Thanks to both of the answers given so far I'm looking into Photon UtilityScripts(To a novice to anything simply directing where to look helps a ton, so thanks again), but since I'm not quite there yet I'll update my progress.

sentences:
How to use 3D transformation matrices with GLM old version that has simd functions I need matrix 3D transformation, model transformation i.e scale-rotate-translate and then that model into world space so model-projection-view matrices.

I need it with GLM specified simd vectors and matrices according to their old version.
But I can only find transformation functions without simd vectors or matrix in examples like this

#include <glm/vec3.hpp> // glm::vec3
#include <glm/vec4.hpp> // glm::vec4
#include <glm/mat4x4.hpp> // glm::mat4
#include <glm/gtc/matrix_transform.hpp> // glm::translate, glm::rotate, glm::scale, glm::perspective
glm::mat4 camera(float Translate, glm::vec2 const & Rotate)
{
glm::mat4 Projection = glm::perspective(glm::radians(45.0f), 4.0f / 3.0f, 0.1f, 100.f);
glm::mat4 View = glm::translate(glm::mat4(1.0f), glm::vec3(0.0f, 0.0f, -Translate));
View = glm::rotate(View, Rotate.y, glm::vec3(-1.0f, 0.0f, 0.0f));
View = glm::rotate(View, Rotate.x, glm::vec3(0.0f, 1.0f, 0.0f));
glm::mat4 Model = glm::scale(glm::mat4(1.0f), glm::vec3(0.5f));
return Projection * View * Model;
}

I need it something like this

 glm::detail::fmat4x4SIMD MatrixMultiply()
    {
        glm::detail::fmat4x4SIMD m(1.0f);
        glm::detail::fmat4x4SIMD m1(1.0f);
        m1 = m1 * m;
        return m1;
    }

But If I try to give glm::lookAt, glm::rotate with fvec4SIMD/fvec4x4SIMD it gives me error that these built in functions does not support simd.

Any idea how to do this?

sentences:
How to calculate shot angle and velocity to hit a moving target? I am developing a 2D Android game and I am making an aiming algorithm for AI projectiles to hit enemies either following a path, or free moving. At the moment it just calculates where the target will be after a distance and fires a projectile to meet it at that distance. Of course this means varying the projectile speed to meet the target.

Does anyone have any tips for a simple-ish algorithm (optimal-ish) to calculate when the projectile needs to fire and where it needs to aim if it can only travel at a constant velocity? Say the projectile goes twice the speed of the target?

The only way I can think of involves searching and seems quite large.

sentences:
Adaptive Characters: AI Solution Needs a Problem Have sophisticated adaptive programming, will travel - so to speak. I'm part of a group that developed sophisticated learning / adaptive software for robotics. The system "thinks" via its simulator, building and adapting code on its own; and then carries out the best solution. The software can also adapt to new situations, etc.
http://mensnewsdaily.com/2007/05/16/robobusiness-robots-with-imagination/

It's easy to imagine using it with automated game characters that will adapt to the players moves and style - the easiest example would be fighting. The more the simulated fighter fights with the human player, the more it learns to counter that players fighting skills. But there should be more.

Anyone have any ideas as to how adaptive characters might be interesting in games?

sentences: How to create memory manipulation and how does it works? How does memory manipulation works for cheats?, how does one create it, i think it must be something to do with your RAM and changed it to give a different value, but how to create it?

sentences:
Moving texture OpenGL ES 2.0 I am trying to implement a sprite of 8 columns and 8 rows in OpenGL ES 2.0
I made appear the first imagen but I cant figure out how to translate the Texture matrix in OpenGL ES 2.0 , the equivalent of the code in OpenGL 1.0 that I am looking is

        gl.glMatrixMode(GL10.GL_TEXTURE);
        gl.glLoadIdentity();
        gl.glPushMatrix();
        gl.glTranslatef(0.0f, 0.2f, 0f);
        gl.glPopMatrix();

This are the matrix that I am using atm

/**
 * Store the model matrix. This matrix is used to move models from object space (where each model can be thought
 * of being located at the center of the universe) to world space.
 */
private float[] mModelMatrix = new float[16];

/**
 * Store the view matrix. This can be thought of as our camera. This matrix transforms world space to eye space;
 * it positions things relative to our eye.
 */
private float[] mViewMatrix = new float[16];

/** Store the projection matrix. This is used to project the scene onto a 2D viewport. */
private float[] mProjectionMatrix = new float[16];

/** Allocate storage for the final combined matrix. This will be passed into the shader program. */
private float[] mMVPMatrix = new float[16];

/**
 * Stores a copy of the model matrix specifically for the light position.
 */
private float[] mLightModelMatrix = new float[16];

sentences:
How to place objects/entities randomly in JS? I'm making a game and I have a script (running it with Node) on the server that currently just randomly places things on the map... I'd like to change that. I saw something about Perlin noise but I'm not sure if that's the thing I want and I'm even less sure how to implement it...

I want something like this, green dots represent trees, red ones represent enemies and grey ones represent rocks. Where can I get a simple JS algorithm to achieve this?

sentences: GameObject walk onto platform Unity2D I currently am working on a 2D game designed for android and iOS. I have a repeatedly spawning enemy game object which comes in from the left. I want the enemy game object to walk onto a slope which leads to a platform. I've tried adding physics rendering but it doesn't seem to work. I tried adding colliders to both and still nothing. The enemy object just goes straight through the slope and doesn't actually climb it.

sentences:
Sever-side physics simulation and client 'inputs' send rate in a fast multiplayer game I am building a very tiny first-person multiplayer game. I'm just aiming to get the basic rights: client-side prediction and reconciliation + entity interpolation. I have read many articles on these topics but I have a question that I can't find answer for. Consider the following problem:

There's a queue on the server where the client inputs are stored (movement keys + camera vectors)
Server runs the physics simulation 60 times per second. This means that each input from a client will be simulated for 16.6 ms.

Now, consider that I have two clients: one with a beefy computer able to run the game loop 100 times per second, and a slower one that is only able to run it 30 times per second.
My game will send the 'client inputs' packet to the server on every iteration of the game loop. This means that the 100 fps client will send 100 packets, while the 30 fps client only 30.
What this means is that the fast client will get more simulation time on the server, since each input is simulated for 16ms. So the fast client will move significantly more than the slower client.
What is the appropriate way to design the 'client input' packet send rate? What is a solution that ensures that fast clients and slow clients receive an equal or roughly equal amount of simulation time?
Thanks for your time!

sentences:
Now that Articles 17 & 11 have passed, what should indie developers do? Since on the 26th of March 2019 the EU has voted in favor of Articles 17 (previously known as Article 13) and 11, what should an indie developer who is based in the EU do to setup a game and a website for the game s/he develops?

I'm taking into consideration the following:

The developer has a website for the game he publishes.
The developer also has an account system on the said website (required by the game for customizability and authentication).
The developer sells the game on his/her own website (for 100% profit).
The indie developer is funding the game entirely from his/her own money (no investors).
The game is fully customizable, i.e. all text, textures, sounds and models can be changed.
The marketing is handled only by the game developer. This also takes into consideration the platforms which are available in the EU when these Articles take effect.

I'm curious about this as I'm based in the EU and wish to create a game with a lot of user customizability (to the level that the game's assets are all replaced by custom ones), but I'm unsure of how Articles 17 (upload filter) and 11 (link tax) will affect me. I'm also concerned about how link tax will affect the website, and how marketing is supposed to be done on the EU internet.

sentences:
How to create simple physics for a group of balloons colliding in the screen (2D) The game is 2D, how can I make simple physics for a group of balloons colliding in the screen.

What I need is the balloons not to overlap and to bounce when they reach the limits of the screen or other balloons.

Should I use something like box2d or is there a simple algorithm to do something like this?

sentences:
How to get button component in Unity 2019.3 I have a simple class attached to a button in Unity Canvas:

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

public class AudioButtonPlay : MonoBehaviour
{
    public Button button;
    void Start()
    {
        button =  gameObject.GetComponent<Button>();
    }
}

But on the line button =  gameObject.GetComponent<Button>(); I get the following message:

GetComponent requires that the requested component 'Button' derives from MonoBehaviour or Component or is an interface

How can I access the "Button" component?

sentences: how to make sure a developer is working effectively? Let's say I hire some developer or an artist for a project, and that I pay him hourly. How am I supposed to know how many hours he worked for the content he provides to me ?

sentences:
How did they make the screen move in Dangerous Dave? I've made games in BASIC when I was a child, and I was curious about how the graphics were done in the 1988 version of Dangerous Dave made in C++; especially because they didn't have any worthwhile graphics packages those days.
Remember how when Dave reached the edge of the screen, the entire screen graphic used to move leftward in a sweeping motion? I remember reading that Romero had used a special technique to do that.
I've been wanting to create something like Dave, and was wondering

what graphics package/method they
used for Dave?
and how to make the entire screen
graphic move like they did?

sentences:
Are my lines instanced? I have a class which "collects" line mesh transformations throughout the update and then draws them in one place by drawing one line over and over again. I'll post the code below. I'm just wondering if this is instanced or if the idea is to join them all into one mega-mesh and send that through?

Or if I'm missing some key-part altogether....

void BatchLineRenderer::RenderLines(D3DXMATRIX matView, D3DXMATRIX matProjection)
{
    device->IASetInputLayout(pVertexLayout);

    device->IASetPrimitiveTopology(D3D10_PRIMITIVE_TOPOLOGY_LINESTRIP);

    // select which vertex buffer and index buffer to display
    UINT stride = sizeof(LINE);
    UINT offset = 0;
    device->IASetVertexBuffers(0, 1, &pBuffer, &stride, &offset);
    device->IASetIndexBuffer(iBuffer, DXGI_FORMAT_R32_UINT, 0);

    std::vector<LINE>::size_type allLines = permanentLines.size();

    for(int i = 0; i < allLines; i++)
    {
        pColour->SetFloatVector(permanentLines[i].colour); // in the line loop too?

        // combine the matrices and render
        D3DXMATRIX matFinal =
        permanentLines[i].scale     *
        permanentLines[i].rotation  *
        permanentLines[i].position  *
        matView * matProjection;

        pTransform->SetMatrix(&matFinal._11);
        pRotation->SetMatrix(&permanentLines[i].rotation._11);    // set the rotation matrix in the effect

        pPass->Apply(0);

        device->DrawIndexed(2, 0, 0);
    }

    allLines = temporaryLines.size();

    for(int i = 0; i < allLines; i++)
    {
        pColour->SetFloatVector(temporaryLines[i].colour); // in the line loop too?

        // combine the matrices and render
        D3DXMATRIX matFinal =
        temporaryLines[i].scale *
        temporaryLines[i].rotation *
        temporaryLines[i].position *
        matView * matProjection;

        pTransform->SetMatrix(&matFinal._11);
        pRotation->SetMatrix(&temporaryLines[i].rotation._11);    // set the rotation matrix in the effect

        pPass->Apply(0);

        device->DrawIndexed(2, 0, 0);
    }

    temporaryLines.clear();
}

sentences:
Cloth folding animation in Unity I want to implement a basic animation to show clothes being folded. A good example of what I want to do is shown in this game (https://youtu.be/_J-_PAqxtAQ?t=109) at 1:49. You may want to watch it at .25x speed to see the dress fabric’s movement in detail.
I know this kind of animation can be done using bone animations but I think that the cloth will look like an overly stiff and rigid plane. I don’t need to create a very realistic cloth simulation but I would like the cloth to drape a little more naturally as in the link shared above.
I have explored Unity’s cloth simulation component but as far as I can understand, it would simulate cloth’s natural draping but it won’t be able to show the basic cloth folding moves. It also looks a little more realistic than what I need; I’m trying for a more cartoon look as in the game above.
I’d like suggestions for an approach that will both allow the cloth to be folded while maintain a basic level of cloth flexibility (as in the link above). I’m considering using bone animations and have some specific questions:

Using bone animations, can I achieve the effect of a more natural cloth? If yes, will it require a complex bone setup?
Are there other mesh deformation techniques that would be effective to create that effect? If yes, what are those?

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

sentences:
Optimizing HTML5 canvas transformed drawing in Javascript I am trying to optimize my HTML5 game engine and have noticed that currently a majority of the time taken in the game loop can be taken when drawing transformed tiles.  I think this is because each transformed tile saves the state of the canvas, applies a transform, draws the tile, then restores the state of the canvas.  Fortunately I have (at least) 2 classes of tiles, and if I am only drawing un-transformed tiles, the game runs quite smoothly.  Take a look:

Slow with transformed tiles in the background: http://sgdk2.enigmadream.com/ben/JavaSampleo.html
Faster with no transformed tiles in the background:
http://sgdk2.enigmadream.com/ben/JavaSample.html

Sure you could say that drawing the extra tiles alone is responsible, but I have used Chrome profiling to confirm that XFrame (transformed frame) is consuming more than 50% of the time.  So here's the drawing code for XFrame:

XFrame.prototype.draw = function(ctx, x, y) {
   ctx.save();
   ctx.transform(this.m11, this.m12, this.m21, this.m22, this.dx+x, this.dy+y);
   ctx.drawImage(this.imageSource, (this.cellIndex % this.graphicSheet.columns) * this.graphicSheet.cellWidth,
      Math.floor(this.cellIndex / this.graphicSheet.columns) * this.graphicSheet.cellHeight,
      this.graphicSheet.cellWidth, this.graphicSheet.cellHeight, 0, 0, this.graphicSheet.cellWidth, this.graphicSheet.cellHeight);
   ctx.restore();
};

Now one thing I can imagine improving this is if I could determine that many of the tiles I was drawing were using the same transformation, and make the single transform span the drawing of many tiles.  It would be a challenge given my current design, but I might be up to it if it would make a difference.  However that is of little use because the position of the tile has to become part of the transformation if I want the location of the tile to be excluded from the transform operation, I think.  For example, if I want to draw a tile rotated 90 degrees at a coordinate of 64,32, I can't simply apply the rotation matrix and then draw at those coordinates because 64,32 will get transformed to something like 32, -64 (right).  So I have to apply the offset as part of the transform for all transformed drawing operations.  And since each tile is drawn at a different location, that means a different transform for each tile.

Any suggestions for optimizing tile drawing operations where transformations may be applied at the tile level in real time?

sentences:
How to copy the value of a variable from one script to another in Unity? I would need some help with making two floats from two different classes, match their "data".

What I want to do here is to make it so when Body.healthb hits a value of 0, Head.health will also hit 0.

Any suggestions? I'm barely new to this.

The class from which the float comes from:

public class Body : MonoBehaviour
{
  public GameObject body;

  public float healthb = 50f;

  public void TakeDamageb(float amountb)
  {
    healthb -= amountb;
    if (healthb <= 0f)
    {
      Dieb ();
    }
  }

  // Update is called once per frame
  public void Dieb()
  {
    Destroy (gameObject);
  }
}

The class it has to reach:

public class Head : MonoBehaviour
{
  public static float health = 10f;
  public void TakeDamage(float amount)
  {

    health -= amount;
    if (health <= 0f)
    {
      Die ();
    }
  }

  // Update is called once per frame
  public void Die()
  {
    Destroy (gameObject);
  }
}

sentences:
Why does my mesh disappear from certain angles? I'm trying to construct a hexagonal prism from vertices for my turn-based strategy game. This is my first time working with meshes and I have been following this tutorial.

The problem I am having is that the sides of my shape disappear at certain angles (in this example, I only rendered the top, bottom, east, and west sides).

I have tried removing the main camera and lighting from the scene. I have tried using RecalculateBounds() but that had no effect and besides, Unity's documentation says it's not needed when assigning triangles.

The whole thing gets rendered if I position the camera perfectly, so I don't imagine I'm calculating vertices incorrectly or anything like that. Is there something I should know about Unity meshes that would cause this to happen?

sentences:
I was expecting a circle to trace a path of parabola . why isnt that the case? Why isn't the rendered shape a parabola?

@Override
public void render () {
    Gdx.gl.glClearColor(1, 0, 0, 1);
    Gdx.gl.glClear(GL20.GL_COLOR_BUFFER_BIT);
    renderer.begin(ShapeRenderer.ShapeType.Filled);
    position.x += 1;
    position.y = position.x * position.x ;
    renderer.circle(position.x,position.y,radius);
    renderer.end();
}

sentences:
Creating practically solvable 15 puzzle inputs I am now developing a 15 puzzle game. I know the method to detect unsolvable puzzles. But unlike 8-puzzle, solution for 15-puzzle takes quite long time for some input states and can be solved within 5 seconds some other set of input states.

Now the problem is that I cannot give the user(the player), a problem for which the solution takes more than 10 seconds(if he/she chooses to see the solution). So what I want is that when I initially shuffle the puzzle, I want to only present those puzzles which can be solved within 10 seconds. There must be some way to determine the hardness of the puzzle. I tried searching the net but could not find it.

Does anyone know a way of determining the hardness of a puzzle?
NOTE : I am using A* algorithm to find out the solution on a computer with 3GB RAM and 2.27GHZ processor.
EDIT : I have an additional requirement also. I am including a Puzzle Solver also. So based on the user's input, the cpu will solve the problem. Present A* algorithm with manhattan distance as heuristic takes a lot of time. First of all I would like to know which algorithm to choose - A* or IDA or some other. And I would like to know about other heuristics also.

sentences:
Why does my value increase a ton when the tab switches from inactive to active? I basically have a lerp function similar to this one: Client interpolation for 100% serverside game when a new server update is received, the update frequency is added to a variable (msAhead) and the delta is subtracted from it every client frame. But when I do it the variable msAhead increases a lot when the tab is switches from inactive to active. Here is my code:

msAhead += updateFrequency; //when new update is received.

(function loop(now) {

var now = Date.now();
delta = now - Time;

Time = now;

msAhead -= delta;

console.log(msAhead);

requestAnimationFrame(loop)

    })(0);

How can I fix my issue?

sentences:
Is it possible to animate the texture of a model? Below is how far I've got. I just made a simple block with user primitives to test it. But I haven't found a way to crop the spritesheet.

textureLava = frames[activeFrame];

This line is how I want it but off course this doesn't work. Is there a way to crop this spritesheet or is there another way to animate the texture of a model?

public void CreateFrames()
{
    for (int i = 0; i < 64; i++)
    {
        frames.Add(new Rectangle(WIDTH + i, i, WIDTH, HEIGHT));
    }
}

public override void Update(GameTime gameTime)
{
    if (System.Environment.TickCount - lastFrameTime > TIME_BETWEEN_FRAMES)
    {
        activeFrame++;
        lastFrameTime = System.Environment.TickCount;

        if (activeFrame > 15)
        {
            activeFrame = 0;
        }
    }

    textureLava = frames[activeFrame]; --> DOESN'T WORK

    base.Update(gameTime);
}

public override void Draw(GameTime gameTime)
{
    effect.TextureEnabled = true;
    effect.World = Matrix.Identity;
    effect.View = Camera.ActiveCamera.View;
    effect.Projection = Camera.ActiveCamera.Projection;

    effect.Texture = textureLava;

    foreach (EffectPass pass in effect.CurrentTechnique.Passes)
    {
        pass.Apply();

        GraphicsDevice.SetVertexBuffer(vertexBuffer);

        GraphicsDevice.DrawPrimitives(PrimitiveType.TriangleList, 0, 10);
    }
}

sentences:
How can I implement a Boardgame.io project using Webpack? I am following the boardgame.io tutorial, but I do not want to use either of the two implementation options covered in the tutorial (React and Parcel).
The tutorial requires a framework or bundling method because the client web application has dependencies on node.js modules which cannot be directly imported into browser scripts.

sentences:
How to layer the Worley noise like this? Recently I'm trying to implement Siggraph15_Schneider_Real-Time_Volumetric_Cloudscapes_of_Horizon_Zero_Dawn, you can also find this in GPU Pro 7, (part II Lighting, chapter 4, Real-Time Volumetric Cloudscape).

I can make the first Worley noise above and increase the frequency, I can get another Worley noise, but how to blend the two noise to get the middle noise and finally, the third noise"?

The last image is two single frequence worley noise and the result I blend them.You can try your method with them.

My formula is this:

tmp = (worley1 + smoothstep(0, 1, worley1)*worley2*0.5) / (1 + smoothstep(0, 1, worley1)*0.5);
tmp = ReMap(0, 1, 0, 0.7, tmp);

ReMap is:

double ReMap(double oldMin, double oldMax, double newMin, double newMax, double src);

Note that worley1 and worley2 is worley noise range from 0 to 1.The result is close in the first glance,but it's not the same apparently. I think the formula is TOO tricky and maybe I got something wrong.

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:
HLSL: An array of textures and sampler states The shader must switch between multiple textures depending on the Alpha value of the original texture for each pixel. Now this would word fine if I didn't have to worry about SamplerStates. I have created my array of textures and can select a texture based on the Alpha value of the pixel. But how do I create an Array of SamplerStates and link it to my array of textures? I attempted to treat the SamplerState as a function by adding the (int i) but that didn't work. Also I can't use Texture.Sample since this is shader model 2.0.

//shader model 2.0 (DX9)
texture subTextures[255];
SamplerState MeshTextureSampler(int i)
{
    Texture = (subTextures[i]);
};

float4 SampleCompoundTexture(float2 texCoord, float4 diffuse)
{
    float4 SelectedColor = SAMPLE_TEXTURE(Texture, texCoord);
    int i = SelectedColor.a;
    texture SelectedTx = subTextures[i];
    return tex2D(MeshTextureSampler(i), texCoord) * diffuse;
}

sentences:
Making multiple VertexPositionColor variables in the same class? - XNA I have studying XNA on my spare time for about a year now and I could use some professional help on this issue. Any time given to my problem is appreciated.

I have two VertexPositionColor variables both of which are placed into two separate vertex buffers to draw up three triangles

basicEffect = new BasicEffect(GraphicsDevice);
        VertexPositionColor[] vertices = new VertexPositionColor[6];
        vertices[0] = new VertexPositionColor(new Vector3(0, 1, 0), Color.Red);
        vertices[1] = new VertexPositionColor(new Vector3(-1, -1, 0), Color.Green);
        vertices[2] = new VertexPositionColor(new Vector3(1, -1, 0), Color.Blue);
        vertices[3] = new VertexPositionColor(new Vector3(0.05f, 1, 0), Color.Yellow);
        vertices[4] = new VertexPositionColor(new Vector3(-1, -1, 0), Color.Blue);
        vertices[5] = new VertexPositionColor(new Vector3(-1, 1, 0), Color.Pink);
        vertexBuffer = new VertexBuffer(GraphicsDevice, typeof(VertexPositionColor), 6, BufferUsage.WriteOnly);
        vertexBuffer.SetData<VertexPositionColor>(vertices);

        VertexPositionColor[] vertices2 = new VertexPositionColor[3];
        vertices2[0] = new VertexPositionColor(new Vector3(0, 1, 0), Color.Blue);
        vertices2[1] = new VertexPositionColor(new Vector3(-1, -1, 0), Color.Red);
        vertices2[2] = new VertexPositionColor(new Vector3(0.9f, -0.9f, 0), Color.Orange);
        vertexBuffer2 = new VertexBuffer(GraphicsDevice, typeof(VertexPositionColor), 6, BufferUsage.WriteOnly);
        vertexBuffer2.SetData<VertexPositionColor>(vertices2);

I then use the draw function to draw all three triangles ..

public override void Draw(GameTime gameTime)
    {
        basicEffect.World = world;
        basicEffect.View = view;
        basicEffect.Projection = projection;
        basicEffect.VertexColorEnabled = true;
        GraphicsDevice.SetVertexBuffer(vertexBuffer);
        GraphicsDevice.SetVertexBuffer(vertexBuffer2);
        RasterizerState rasterizerState = new RasterizerState();
        rasterizerState.CullMode = CullMode.None;
        GraphicsDevice.RasterizerState = rasterizerState;
        foreach (EffectPass pass in basicEffect.CurrentTechnique.Passes)
        {
            pass.Apply();
            GraphicsDevice.DrawPrimitives(PrimitiveType.TriangleList, 0, 3);

        }
        base.Draw(gameTime);
    }

But it does not draw all three triangles. I have tried various variations and all that gets drawn is either the last vertex buffer or the first one. I know it would be more efficient to place them all in the same buffer or have them used with indices, but in the future I will run into issues where I am going to need more than one buffer to draw something and I want to be prepared. What is the problem here and how do I draw more than one vertex buffer at a time?

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:
How to deform 2D tileable texture in XNA/MonoGame I'm looking for a way to deform tillable texture in a 2D game I'm building using MonoGame but I'm not sure how this effect is called and searching the internet for "deforming textures" gives me mostly articles about 3D.

I want to texture procedurally generated terrain which can contain lots of little hills. Like on the following picture:

I've deformed this image using Photoshop's free transform tool and I would like to know how can I do this in code.
And also, I would like not to have this "obviously deformed" look with blurred areas where deformation occurred.

sentences:
How can I store spell & items using a std::vector implementation? I'm following along with a book from GameInstitute right now, and it's asking me to:

  Allow the player to buy and carry healing potions and potions of
  fireball. You can add an Item array (after you define the item class)
  to the Player class for storing them, or use a std::vector to store
  them.

I think I would like to use the std::vector implementation, because that seems to confuse me less than making an item class, but I am unsure how to do so. I've heard from many people that vectors are great ways to store dynamic values (such as items, weapons, etc), but I've not seen it used.

sentences:
Why do we use 4x4 matrices to transform things in 3D? To translate a vector by 10 unit in the X direction, why do we have to use a matrix?

We can just add 10 to the mat[0][0], and we got the same result too.

sentences:
Firing a particle effect toward the tapped target I am editing this game, where i have to destroy this pyramid when user will tap, i want to  show particle effect moving towards Pyramid Like this:

but sometime it is not moving towards pyramid like this but moving straight Like this:

Script for RayCast and Particle Effect Instantiation:

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

public class General : MonoBehaviour
{
    public static GameObject currentPyramid;
    RaycastHit Hit;
    public GameObject LineStart;
    public GameObject ParticleEffect;

    void Awake(){
    }
    void Start(){
    }
    void Update ()
    {
        Debug.Log (currentPyramid);
        if (Input.GetMouseButtonDown (0)) {
            RaycastHit hitInfo = new RaycastHit ();
            bool Hit = Physics.Raycast(Camera.main.ScreenPointToRay(Input.mousePosition),
                                       out hitInfo);
            if (Hit) {
                currentPyramid = hitInfo.transform.gameObject;
                if (currentPyramid != null) {
                    Instantiate (ParticleEffect,
                                 LineStart.transform.position,
                                 LineStart.transform.rotation);
                }
            }
        }
    }
}

code for Pyramids

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

public class PyramidScript : MonoBehaviour
{
    void Update () {
        if (PlayerPrefs.GetString ("Pyramid") == gameObject.name) {
            General.currentPyramid = this.gameObject;
        }
    }
}

sentences:
Geometry Shader : points + Triangles I have different Shaders and for each Shader a instance of the ShaderClass class, which initializes the Shaders, Renders the Shaders, etc.

I use most of the Shaderclasses without Geometry Shader, but in one Shader Class i also use a Geometry Shader.

The problem is, that when I render one object with the Shaderclass that uses the Geometry shader, all other object are rendered with the same geometry that I create in the Geometry Shader.  Can you help me?

Is it possible that I have to use a Geometry Shader for each object, when I use one for one object?

I use DirectX 11 with C++.

sentences:
How can I update my materials to work with LWRP? I'm using Unity 2019.1.6f1.

When I open a new scene with  the LWRP template project, I see errors from all materials in the scene. For example, the Jigsaw appears in my scene but in console window I see a message telling me:

  Jigsaw_Mat material was not upgraded. There's no upgrader to convert Lightweight Render Pipeline/Lit shader to selected pipeline
  UnityEditor.Rendering.LWRP.LightweightRenderPipelineMaterialUpgrader:UpgradeProjectMaterials()

All materials show this message, and I don't know what to do to fix these materials. How can I resolve this error?

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:
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:
Is this a correct way to solve contact? Hi there,
I'm learning the impulse based physics engine these days. Can someone please check my image about solving a contact( a sphere resting on ground) , and please let me know where is wrong.
Thanks for any help!

sentences:
Is Time.deltaTime the last frame time or it is the time difference between frames? I just came across the unity blog and found that unity 2020.2 trying to fix Time.deltaTime which is good for more smooth movement (correct me if I am wrong). But when I am reading the blog I found this thing:

In layman’s terms, delta time is the amount of time your last frame
took to complete.

Then, i realized i don't know what exactly the delta time is because i was thing that it actually the difference between the two frame. Then, i consult the unity docs again and find this thing
The completion time in seconds since the last frame (Read Only).

the second line telling something different (isn't it?) which i am thinking is the defination of deltaTime
This property provides the time between the current and previous frame.

I try to understand it through an example:
time - difference:
4
5 (1)
6 (1)
6 (0)
5 (1)
3 (2)
If you see the above what will be the delta time?

sentences:
OnMouseUpAsButton not always called I'm working on a 2D implementation of Free Cell in Unity 4.6.1, and I'm having trouble getting my click-detection code working consistently. The code below should be called every time a card is clicked (they all have BoxCollider2D components) but it doesn't always happen.

// Handle Clicks on Card
void OnMouseUpAsButton()
{
    print ("test");

    int cardLayerMask = LayerMask.GetMask("Cards");

    RaycastHit2D[] hit = Physics2D.RaycastAll(Camera.main.ScreenToWorldPoint(Input.mousePosition), Vector2.zero, Mathf.Infinity, cardLayerMask);

    print ("Hit length: " + hit.Length.ToString());

    if (hit.Length > 0)
    {
        print ("Hit");

    }
}

Even the "Test" print statement doesn't get called consistently, so it's not a problem with the raycast. If it manages to print the test, the raycast always works.

Each time the game runs, the cards get dealt onto the playing field randomly into stacks. On each run, some subset of the cards don't call the above code. The number of cards that work correctly varies, as does their position on the field. It's not consistent with any particular card.

I'm wondering if maybe there's an issue with the BoxCollider2D instances overlapping. The other colliders in the scene, like the one on the "table", always trigger OnMouseUpAsButton() successfully.

I need to be able to register clicks on every card, so I need to find a way to make this work.

Have any of you run into a similar issue before? If not, is there a way for me to work around this? Maybe a different way to detect the clicks on the cards?

Here's a screenshot of an example card from the inspector. Aside from transform position & script property values, all of them are identical (from a prefab):

Update w/ Solution from Accepted Answer

Using @Byte56's solution, I was able to take care of this pretty easily. I've included sample code below.

Note that to get the sample to work, the "top" object has to have the highest transform.position.z out of all the objects the raycast hits. I also put all the possible hit objects into their own layers so I can trigger different behavior based on what type of object is clicked.

// Handle clicks
    if (Input.GetMouseButtonDown(0))
    {
        // Cast a ray, get everything it hits
        RaycastHit2D[] hit = Physics2D.RaycastAll(Camera.main.ScreenToWorldPoint(Input.mousePosition), Vector2.zero, Mathf.Infinity);

        if (hit.Length > 0)
        {
            // Grab the top hit GameObject
            GameObject lastHitObject = hit[hit.Length - 1].collider.gameObject;

            // Determine layer of last hit object, take next steps as appropriate
            switch (LayerMask.LayerToName(lastHitObject.layer))
            {
            case "Cards":
                print ("Hit card!");
                break;
            case "Table":
                print ("Hit Table!");
                break;
            case "Cells":
                print ("Hit cell!");
                break;
            }
        }
    }

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:
How do I manually accelerate the rotation of a sphere in Unity 3D? I'm a little new to this so any help will be appreciated.

Context:
I'm creating a VR billiard/pool game and trying to get the physics as realistic as possible. I have a cue ball being hit with a cue across a surface with accurate friction values calculated from real world trials.

Problem:
The angular acceleration of the balls isn't realistic at all. Therefore the angular velocity is off (this is due to how Unity calculates physics of interaction as a point of contact rather than an area of contact and therefore friction calculation is done at one point causing it to rotate slower).

Question:
How can I manually set the angular acceleration to a value in code until the angular acceleration is greater than or equals to horizontal velocity, then the angular acceleration is set to 0? Thanks in advance.

sentences:
Multiple Viewports/Windows Dear IMGUI c++ How do I use IMGUI with multiple GLFW windows? I know Dear IMGUI already has a virtual viewport system going in the viewport branch but I found that to be lacking a bit on how to use this new system.

To accomplish this would you share a single GLFWwindow context and using that for a single IMGUI context? Would there be any disadvantages to using this approach?

sentences:
Unity animation editor's object rotation is doing weird When using the Unity timeline to create an animation or by using the animator itself, I am unable to properly rotate an object. Whenever I do rotate it, it will usually go something as follows: From 0 -> 20 = 0, -132, 67, -89 and then 20.

I have tried to manually set the rotation values, doing this does help, but this means that I will have to do everything manually which is a crap ton of work. I also did make an animation yesterday with the timeline animation with no problems at all, in the morning there were the same problems and I have no clue how it suddenly worked.

I have also tried selecting rotation in the animation window and changing Euler to Euler (Quaternion) or Quaternion itself. This doesn't work, it will only have a less spinning outcome.

I would like to know if anyone has any solutions for this problem. I am using Unity version: 2018.3.5f1.

Thanks for any help in advance.

sentences:
What should I expect from volunteer playtesting? I have recently been invited to do some volunteer playtesting for a pretty well known developer. They made it very clear that it was on a volunteer basis only. It's not a job and I won't be getting paid. What should I expect? What kind of input are they going to be looking for from me? What tips do you have for doing the playtesting well? What should I do to ensure I'll be invited back? Have you or anyone you know done something similar to this before?

Also, although this is unlikely (at best) to turn into a job, what tips do you have for possibly getting my foot in the door at the company? I am happy to just be able to participate, but I would love to be able to make some good connections since I plan on building a career in the game industry. Thanks in advance.

Update:
I've been invited back to be part of a regular test group for the same game. We went over some UI designs and filled out a survey on what we thought of them and how well we understood them. Then we had a video taped Q&A session with the QA supervisor and some of the developers. We discussed the designs we critiqued in the survey and elaborated more on what we thought of them. Finally, before leaving, we played a few rounds of one of the test builds of the game, just for fun. It was a great experience and from what I observed about the offices and the general work atmosphere, I'm even more sure I've made the right career choice for myself, personally.
I've accepted an answer to this question, but I'm still open to hearing about experiences from other people who have been involved in volunteer playtesting!

sentences:
How to write testable MonoBehaviour and test scripts in Unity? I had problems with decoupled scripts and exposing interfaces in Unity, and these answers helped me a lot. But now, since I don't have hard-coded references in my scripts, I wanted to write unit tests for my code.

This presented a problem - I can't instantiate MeonoBehaviours using new
because of how the engine works. What is more, I can't mock out anything from the Unity API.

I found a great blog post by Tomek Paszek. He suggests using the Humble Object pattern, and it seems reasonable. Still, maybe thats just me, because I haven't used that pattern too much, when using the Humble Object pattern even simple code seems to be very complex.

Are there other ways to write testable MonoBehaviors?

sentences:
How to display multiple textures with OpenGL without a texture atlas I tried to dig into OpenGL a bit to use in 2D games (mainly because of shaders). There are multiple tutorials out there showcasing how to display and blend textures, and that's fine. But i haven't found a single one that would teach how to display multiple textures at once. Now, I know that one of the popular methods is using a texture atlas and then, provided you have a well-done atlas, it's just a matter of assigning proper UVs to objects using the texture in vertices sent to a buffer array. However, how would one go about it if he didn't want to use a texture atlas. Modern OpenGL offers at least 70something texture units if my memory serves me right, that's something, but then you would have to bind different textures (and possibly end up with an outrageous amount of samplers) which would waste a lot of GPU's computing power. Let's consider the following screen, assuming that everything, including clouds, is a separate object using it's own texture

How, in pseudocode, should I handle displaying that "the proper way" without a texture atlas to get an effect like that? I experimented with rebinding textures etc. but none of that helped. Also, how shaders should look like because i don't think that having a sampler for every object is a way to go as well. Maybe something with a TEXTURE_2D_ARRAY, but if yes then how to use it properly? Again, what I'm looking at is just a list of steps i need to take to get an image like that written in a pseudocode. Thanks in advance!

sentences:
Have a method accept generic methods for a in-game console I'm making a console, like in Half-Life so that the devs can add their commands.

I'm making this in Unity's C#.

I have a problem when dealing with the commands. When you want to add a commands, you create a class Command and add it through a method to the Console List of Commands.

The code of the class Command is the following one:

public class Command
    {
        /// The string by which this command will be called
        public string commandKey;
        /// The information of this command that the help option will show
        public string helpInfo;

        public delegate string stringVoid();
        public delegate string stringString(string consoleInput);
        public delegate void voidCmd();
        public delegate void voidString(string consoleInput);

        public stringVoid _stringVoid;
        public stringString _stringString;
        public voidCmd _voidCmd;
        public voidString _voidString;

        public Command(string commandInput, string helpTooltip)
        {
            commandKey = commandInput;
            helpInfo = helpTooltip;
        }

        #region Add Command Methods
        public Command addVoidCommand(voidCmd voidCommand)
        {
            _voidCmd = voidCommand;
            return this;
        }
        public Command addStringVoid(stringVoid stringVoidCmd)
        {
            _stringVoid = stringVoidCmd;
            return this;
        }

        public Command addStringString(stringString stringStringCmd)
        {
            _stringString = stringStringCmd;
            return this;
        }

        public Command addVoidString(voidString voidStringCmd)
        {
            _voidString = voidStringCmd;
            return this;
        }
        #endregion
    }

As you can see users can add four types of delegates methods:

Void methods with no parameters.
String methods with no parameters.
Void methods with a string parameter.
String method with a string parameter.

This makes the class very heavy, and makes the users have to navigate through a lot of options to add a class.

I want to have some way to add methods without having to go through so many options, and, from my side, taking out the need of searching through so many options when a command is called from console.

You can find the whole script/project here.

In conclusion, I want to have a way that the user simply write

// way I want it to work
new Command("commandName", "this is an example" ExampleCommand);
new Command("commandString", "this is another example" ExampleString);

void ExampleCommand(){ }
string ExamplesString(string ble){ return ble + "bla"; }

// way it currently works
new Command("commandName", "this is an example").addVoidCommand(ExampleCommand);
new Command("commandString", "this is another example").addStringString(ExampleString);

To simplify everything. Is any way I can achieve this with delegates, Unity Actions or something else?

Thank you very much.

sentences:
Why the shareware (not demo) model died? In the early days of the industry, instead of fighting piracy, companies let the users share their games freely, and put some nag screen or something like that on the game.

Then they would sell DLC and expansions (yes, DLC is 20 years old actually :P), hintbooks, cheat codes, swags, etc...

Why this model died?

Note: I am talking about classic shareware, not the crippleware or demo crap.

sentences:
As an indie game dev, what processes are the best for soliciting feedback on my design/spec/idea? Background

I have worked in a professional environment where the process usually goes like the following:

Brain storm idea
Solidify the game mechanics / design
Iterate on design/idea to create a more solid experience
Spec out the details of the design/idea
Build it

Step 3. is generally done with the stakeholders of the game (developers, designers, investors, publishers, etc) to reach an 'agreement' which meets the goals of all involved. Due to this process involving a series of often opposing and unique view points, creative solutions can surface through discussion / iteration. This is backed up by a process for collating the changes / new ideas, as well as structured time for discussion.

As a (now) indie developer, I have to play the role of all the stakeholders (developers, designers, investors, publishers, etc), and often find myself too close to the idea / design to do more than minor changes, which I feel to be local maxima when it comes to the best result (I'm looking for the global maxima, of course).

I have read that ideas / game designs / unique mechanics are merely multipliers of execution, and that keeping them secret is just silly. In sharing the idea with others outside the realm of my own thinking, I hope to replicate the influence other stakeholders have.

I am struggling with the collation of changes / new ideas, and any kind of structured method of receiving feedback.

My question: As an indie game developer, how and where can I share my ideas/designs to receive meaningful / constructive feedback? How can I successfully collate the feedback into a new iteration of the design? Are there any specialized websites, etc?

sentences:
Unity - DontDestroyOnLoad - FindObjectsOfType(GetType()).Length is always returning 1 I'm trying to have an object with the DontDestroyOnLoad property. I want an object with NetworkIdentity to persist across scenes, so I can have a holder script for RPCs.

This answer suggests the following code:

public void Awake()
{
    DontDestroyOnLoad(this);

    if (FindObjectsOfType(GetType()).Length > 1)
    {
        Destroy(gameObject);
    }
}

Despite this, I still end up with duplicate objects. FindObjectsOfType(GetType()).Length is always returning 1, and I don't know why, or how to fix it. It makes no difference whether this object is a prefab instance or a simple object in the hierarchy.

I have also tried to clone this object in my NetworkManager script, which is automatically persistent, but GameObject.Find("ObjectNameHere(Clone)") is always returning false. However, the above solution seems simpler so I'd prefer to figure out  FindObjectsOfType(GetType()).Length.

sentences:
RPG Data (Skills, Monsters, Items, Equippables) I'm creating a simple RPG type game. I've dabbled with the idea of just loading all the skills, monsters, items and so on at once. However, to do that seems horrible wasteful since I would have potentially hundreds of things in memory that may not necessarily be used just for the battle system.

I'm pretty close to finishing the battle system, I just need to figure out how to handle the data prior.

So would it be best just to just access the disk to load this information in when I need it?   I was considering porting this to another device after I get it working on a PC.

I was looking at the decompilation of Pokemon Red and I'm not exactly sure how they managed to do it either. Given that the RAM for the Gameboy was 8 kilobytes (32 if expanded).

Any pointers (no pun intended) or ideas?

sentences:
How can I make the main game loop frame-rate independant? I am trying to create a frame independent game loop.

I am currently using the following code

 private class MainGameThread extends Thread {
        public static final int PAUSE_SLEEP_TIME = 10;
        long previous = getCurrentTimeInMillis();
        long totalElapsed = 0;
        long gameTimeStart = 0;
        long currentTime = getCurrentTimeInMillis();
        long accumulatorTime = 0;

        @Override
        public void run() {
            gameTimeStart = getCurrentTimeInMillis();
            while (mIsRunning) {
                // Pause game
                while (mIsPaused) {
                    try {
                        Thread.sleep(PAUSE_SLEEP_TIME);
                    } catch (InterruptedException e) {
                        e.printStackTrace();
                    }
                }
                long current = getCurrentTimeInMillis();
                long elapsed = current - previous;
                previous = current;
                processGameInput();
                updateGameState(elapsed);
                totalElapsed += elapsed;
                if (totalElapsed > MainGame.MS_PER_FRAME) {
                    drawGame();
                    totalElapsed -= MainGame.MS_PER_FRAME;
                    if (totalElapsed > MainGame.MS_PER_FRAME) {
                        Log.e("GAME", "Performance warning, rendering or update took too long");
                    }
                }
                checkIfGameShouldStop(gameTimeStart);
            }
            shutdownGracefully();
        }

        private void shutdownGracefully() {
        }
    }

It works, however it performs differently on different devices.

In my game models update method I am performing the following actions

  mCenterX += (mVelocityVector.x * timeElapsed);
  mCenterY += (mVelocityVector.y * timeElapsed + gameSpeed.getValue())

I have read this article, but I can't understand the final example:

double t = 0.0;
double dt = 0.01;

double currentTime = hires_time_in_seconds();
double accumulator = 0.0;

State previous;
State current;

while ( !quit )
{
    double newTime = time();
    double frameTime = newTime - currentTime;
    if ( frameTime > 0.25 )
        frameTime = 0.25;
    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 );
}

What does the State class object mean in this case?

Could someone please help to adapt this example to my case or explain the example from the article and how I could update my loop to be frame independent?

sentences:
How to display all the previous strings except the current strings from the list? I would like to create some sort of log to display previous strings for my game, but I still cannot figure out how to properly displaying them. I am using a button to run this method every time player clicks it.

public void AddLog()
{
    foreach (string logEvent in DisplayDialogueList)
    {
        logTextList.text = logText;
        logText += logEvent;
        logText += "\n\n";
    }
}

This method supposed to be displaying all the previous strings that has been displayed before inside DisplayDialogueList but I can't limit the displays only for the previous strings, and it will always display all the strings from the list.

I have tried the .Skip method to detect the current index of the list that are currently being displayed but it does not refresh the list, meaning if I loop to skip the first index from the list, it will always skips the first index even the current index to be displayed is second index and so on.

I also having trouble to skip the last index on the list since C# Unity does not support .SkipLast.

Any help would be appreciated.

EDIT:
Sorry for the confusion, this is how I managed to distinguish which is the current string to be displayed, it runs on button click

public void Display()
{
    //Checks to see which element from the list has the same index number as the current index
    if((index == textIndex) && !(DisplayDialogueList.Count <= index))
    {
        //Displays the string from the list that has passed the argument above
        textList.text = DisplayDialogueList[textIndex];
        index +=1;
        textIndex = index;
    }
}

Everytime the button is clicked, the index number will be increased, so it will matches with the string with the same index from the list and displays it.

UPDATE:
Ok I managed to skip the current displayed index and last index (thanks to the answer below) but this happens apparently

The Hello, my name is Mira text is in the first index of the list. How do I make sure that text won't be displayed again after the back button is clicked, which run the AddLog()?

The updated code is below:

if(!(index > DisplayDialogueList.Count))
    {
        firstIndex = DisplayDialogueList.First();
        lastIndex = DisplayDialogueList.Last();
        foreach (string logEvent in DisplayDialogueList)
        {
            if(logEvent != lastIndex && !(firstIndex == currentIndex))
            {
                logTextList.text = logText;
                logText += logEvent;
                logText += "\n\n";
            }
        }
    }

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:
What's the best way to keep battle log in a browser based game written in PHP? I've searched for it, but I couldn't find any question about this.

I'm working on a game where PvP fights are possible. The game is written in PHP/MySQL.

What I want to implement is to save all the actions of users in the fight (hits, misses, critical hits etc.).

However, I couldn't decide how and where to keep them. As an array, xml file, in json format; in a log file, in the database or in a separate cookie? Which way is the best practice?

sentences:
Determine "bounding box size" (not scale) of model in MonoGame I'm working on integrating some the 3D models I import into my physics system by trying to take their "size" and use that as the side for objects within my physics system. When I say size, I'm referring essentially to a bounding box size around my model. Here's an example of a test level layout I'm designing:

All of the cubes below are 1x1 units in Blender (measuring from the center), so I've been able to just code in those assumptions. However, it starts to get more interesting when you consider the slope and smaller platform I have.

For the slopes, I've found an easy hack for the time being (as long as their size remains 1x1). However, the platforms are throwing me off. A few things to call out with the platform model:

The model itself is centered at (0,0,0) and no scaling was done on the model itself in Object Mode
I scaled down the Z of the model in Edit Mode, while the model itself remains at (1,1,1) scaling

I'm now trying to figure out how to get some form of size for the model. For what I'm looking for, if we assume the cubes I have are bounds box size of (1,1,1), then this platform would be a bounding box size of (1, 1, .25). I would assume that I would need to look at the model's meshes to determine this, but I'm not entirely sure

Any help on this would be appreciated. Thanks!

sentences:
Inverting the Z coordinate of the light vector I noticed that in some vertex shaders they invert the Z coordinate of the light vector, i.e.

// Compute denormalized light vector in world space
float3 vLightWS = g_LightPosition.xyz - vPositionWS.xyz;
// Need to invert Z for correct lighting
vLightWS.z = -vLightWS.z;

Shouldn't be that the light vector starts at the light's position and ends at the vertex position, but in order to use it in the diffuse lighting calculation it is reverted to start at the vertex position and end at the light's position as float3 vLightWS = g_LightPosition.xyz - vPostionWS.xyz suggests?

In this case what is the meaning of the Z coordinate inversion?

sentences:
How can I determine the first visible tile in an isometric perspective? I am trying to render the visible portion of a diamond-shaped isometric map.
The "world" coordinate system is a 2D Cartesian system, with the coordinates increasing diagonally (in terms of the view coordinate system) along the axes. The "view" coordinates are simply mouse offsets relative to the upper left corner of the view.

My rendering algorithm works by drawing diagonal spans, starting from the upper right corner of the view and moving diagonally to the right and down, advancing to the next row when it reaches the right view edge. When the rendering loop reaches the lower left corner, it stops.

There are functions to convert a point from view coordinates to world coordinates and then to map coordinates.

Everything works when rendering from tile 0,0, but as the view scrolls around the rendering needs to start from a different tile. I can't figure out how to determine which tile is closest to the upper right corner.

At the moment I am simply converting the coordinates of the upper right corner to map coordinates. This works as long as the view origin (upper right corner) is inside the world, but when approaching the edges of the map the starting tile coordinate obviously become invalid.

I guess this boils down to asking "how can I find the intersection between the world X axis and the view X axis?"

sentences:
2D stop on collision So, this is the code I have right now:

if (keysPressed.Count() > 0)
        {
            switch (keysPressed[0])
            {
                case Keys.W:
                    {
                        characterStats.Velocity.Y += velocityCahge*(-1);
                        break;
                    }
            }
        }

        for (int i = 0; i < 2; i++)
        {
            if (Rectangle.Intersects(anotherRectangle))
            {
                characterStats.Velocity.X *= -1;
                characterStats.Velocity.Y *= -1;
            }
        }

       characterStats.position.X += Velocity.X;
       characterStats.position.Y += Velocity.Y;

The problem with this, is that sometimes, after collision, when pressing button to go in opposite direction from the collided sprite, the character starts going inside the sprite, in the opposite direction to where the button should move him. I know, that it happens cause of that *= -1, but how do i prevent that?

sentences:
Z buffer for large vs small objects Are there common, tried and tested techniques for making sure that when displaying very large and very small objects, in a 3D environment, those objects don't display in front or behind each other?

The scenario I am thinking of is a small person object being closer to the camera than a single, large (for the sake of argument) wind mill arm. As the wind mill turns, the centre of the arm would pass in front and behind the person object's centre. However, depending on the position of the camera, the arm should only be shown as passing either behind or in front of the person object.

sentences:
Efficiently rendering tiled map on OS X I'm writing an original (top-down) SimCity clone in Swift and attempting to use SpriteKit as the basis for the game. However, I am running into performance issues when rendering and animating the tile map which represents the city map.

I'm rendering a 44x44 tile map with each tile being 16x16 pixels. Tile animation could happen on any arbitrary tile and is implemented by having a separate image for each frame of the animation. The map is dynamic (naturally) since the player will draw on it and tiles can be animated (roads, etc). I have tried several implementations to render the map the screen and each has had its own performance issues.

What I've tried:

Each tile is an SKSpriteNode with its texture loaded from a texture atlas. Textures were swapped for tiles that were dirty (needed redraw). I disabled physics simulations and physics bodies on the nodes.

Pros:

Minimal draws (due to the Texture atlas)
Code wasn't very complex

Cons:

Redrawing the entire map destroyed performance
Swapping textures to animate was inefficient

Map was rendered using NSView, drawRect, etc.

Pros:

Drawing was relatively efficient
Dirty rectangle drawing was easy to implement

Cons

Not really suitable for animation (really bad performance)

My question is: What is the most efficient way of rendering/animating my tile map? Is there an optimization I can make to SpriteKit to speed this up? Or do I need to use something lower level (OpenGL/GLSL) to draw/animate the map efficiently?

Any help would be greatly appreciated!

sentences: How to deal with VBOs when rendering mesh's that may or may not be displayed? I'm working on a multiplayer game and will be displaying other players near the player.  At most 16 players could be near the gamer however there could also be 0.  What I'm thinking of doing is setting up 16 empty VBOs so they're ready to load with character's position when the client receives them.  Is it valid to create empty VBOs?  If not how should I go about rendering data that may or may not be there depending on what the server is sending the client?

sentences:
How to Make Border of 2D Game in Unity I have a border by default. But, I'm having trouble detecting if my object collides with the border. I am looking for efficient ways to do this, and I am not sure what should I use. I thought using a Tilemap might work. But, it was only giving me a grid, not a Tilemap. Even then, I was unable to figure out how to use the grid.
How should I go about creating this?

sentences:
How to create a wind tunnel / sky diving effect like in Fortnite? I am using Unity and I want to create a sky diving effect, as if you were looking directly down while falling and have the wind fly past you. My guess is I have to do something with the particle system. How can I do this?

An example is this video of Fortnite https://youtu.be/JFHs3uNJ9Cw?t=23s, you can see the wind flowing from the characters hands and feet.

sentences: HTML5 realtime MMO games, should I do server side physics update or client side? I am using socket.io and HTML 5 canvas to build a MMO game as a practice. I finished the client side first and currently I am working on server side. Apparently the position/physics update is on client side for now. But I am facing the decision of moving the position update logic and physics update to the server or leaving them on the client side. If I put the update on the server side I will pass the mousemove/keystrokes to the server. But if I update positions only on clients side I will pass the positinos/directions/speed to the server. Which approach is better in my case?

sentences: Oculus Rift DK1 and DK2 compatability issues For a project I need to make a multiplayer game using Unity and the Oculus Rift. My project works fine with the DK2 but it turns out the second rift is a DK1 and it won’t work with Unity. I was thinking the best way forward would be to use an older version of the Oculus Runtime and Unity. Does anyone know what versions of Unity and the Runtime I need to have both the DK1 and DK2 work with Unity?

sentences:
Input and packets handling when using render interpolation I'm implementing valve's networking model for my simple top down game but I have some design problems and I just can't think of good solutions. The one of the main ideas that there is a render time separate from simulation time. So for example I have interpolation time of 50ms (as my server update rate is 20Hz).

So, on client my simulation time is 1000ms and render time is 950ms. But I have some design problems... When the user presses a key (in example cast spell), the logical choice is to trigger it in the render time (950ms), but that's impossible since my simulation is in 1000ms already. I think that the solution may be to trigger input using simulation time (and use "lag compensation", so if spell casting time is 100ms, user casts it at the time when render is at 950ms, and it will start in simulation at time 1000ms as 50% casted spell). However I'm not sure, is it a good solution?

The second problem is about sending packets. So If my solution for the first problem is good, then I will send the newest packet from simulation (and don't bother with render time when sending packets). Is it good or should I send packets using render time (ie when simulation time is 1000ms I send to server packet from 950ms)?

The third problem is about receiving packets. When I receive packet when the simulation time is 1000ms, should I save it as packet received in 1000ms or 950ms? In valve networking model (which I use as I said), when server receives info "started casting spell" at server time 250ms, it is compensated by rtt/2 AND by client interpolation time... So I don't know how valve clients handle input, looks like they handle it at render time which I don't understand. Anyway, as I want to use my solution for handling input, I think that I shouldn't compensate for interpolation on server, yes? Or maybe I should compensate on server also by client interpolation time?

I hope that you can help me with my 3 questions. Thanks in advance!

sentences:
Box2DLights in libGDX - Bad quality of the light gradient on Android I am facing a problem while porting one of my libGDX project from desktop to Android : My game uses Box2DLights. While the light effect look very fancy on the desktop version of the game, it looks really ugly on the Android version. The light gradient is not smooth at all. Take a look at the comparative screenshot below :

To use Box2DLights in my game, I use this code in my GameScreen :

 rayHandler = new RayHandler(world);
 rayHandler.resizeFBO(Gdx.graphics.getWidth()/5, Gdx.graphics.getHeight()/5);
 rayHandler.setBlur(true);
 RayHandler.useDiffuseLight(true);
 rayHandler.setAmbientLight(new Color(0.15f, 0.15f, 0.15f, 0.1f));

Of course, I tried to play with different parameters, such as :

RayHandler.useDiffuseLight(fasle);

Or

rayHandler.diffuseBlendFunc.set(GL20.GL_DST_COLOR, GL20.GL_SRC_COLOR);

Or

rayHandler.shadowBlendFunc.set(GL20.GL_DST_COLOR, GL20.GL_SRC_COLOR);

Everything I tried so fare gave the same ugly light gradient. I already played games that uses Box2DLights that rendered very well on my tablet, thus, I don't think it's due to a limitation of Android.

Does anybody know what's the trick to overcome this problem ?

Thanks !

sentences:
How do I get the networkId of an object? My clients have a way of spawning "defense" barriers and I would like to limit the number of defense barriers per client to 1; A way of doing this is to destroy the old defense (if any) and then spawn the new one. Since this defenses are spawned by the server, how can I tell the server to destroy only the defense that was created by that client?

I guess that by storing the networkID of the spawned defense I can later tell the server to destroy it and repeat. Am I attacking this right?

Having this:

[Command]
void CmdDefenseSpawned(string _playerID, string PlaceToDefenseName, Vector3 toDefense, Quaternion defenseRotation)
{
    Debug.Log("Player " + _playerID + " placed a defense on " + PlaceToDefenseName + " Position= " + toDefense);
    GameObject defenseInstance = Instantiate(defense, toDefense, defenseRotation);
    NetworkServer.Spawn(defenseInstance);
}

I would like something like this:

NetworkInstanceId defenseInstanceNetId = defenseInstance.NetworkIdentity.netID

So I can later delete the object whenever the client wants to spawn it again.

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:
Best game loop architecture So I understand how a game loop works (listenInputs/updateData/redrawInterface) but what I'm struggling with is how am I supposed to equalize rendering? I initially thought I had to make the thread sleep for 16.67 ms (in order to get a 60fps output on the screen) but if a user has a low quality hardware it will slow the game down instead of the traditionnal "frame skip", so I figured out this solution was not valid.
So what I thought was the way to go was (in pseudo-java but langage doesn't really matter):

long start = System.currentTimeMillis();
while(...){
    int tick = Math.round((System.currentTimeMillis() - start) / (1000.0 / 60));
    listenInputs();
    updateData();
    redrawInterface();
}

So now anything graphical such as displaying a looping animation can easily be done by printing the specific image of the whole animation for instance.
Am I right? Or is there a better solution or a way to make this one run better?
But with this technique I will have to re-synchronize it every x ticks otherwise it will shift because 1000.0 / 60 is still not an exact value.

sentences:
How can I set my application to run on the High performance GPU by default? Nowadays a good deal of laptops come with 2 GPUs - a high-performance one and a power-saving one (less powerful). Most of the application, which I use on my laptop run with my integrated(power-saving) GPU, but still some of them are set to open with the high-performance card. I am trying to config the app which I am building to run on the high performance GPU by default, but I can't find any information about the topic anywhere. I hope that someone can shed a bit of light onto this. I will distribute my application with an NSIS installer and I guess that I'll have to add the path of my application to a list of applications for NVidia/ATI cards. The application is programmed in C#. Also, does anyone know how things stand with desktop PCs? What happens if a PC has 2 GPUs and I have to choose the more powerful one?

Milcho

sentences:
Does XNA provide any special class to make a game server? For my multiplayer game server, I made a class inheriting from "Microsoft.Xna.Framework.Game", just like I did for the client-side part.

The thing is, I don't need any graphical display for the server, so I end up with a useless blank game window floating around. Also, the LoadContent/UnloadContent and Draw overrides are left empty. On the other hand, I still need to use Microsoft.Xna.Framework.Game for the game loop and logic update parts.

So is there any special class in XNA made especially for the server-side part, or is everyone else doing it just like I do?

sentences:
Unity mesh collider detecting collision on object empty inside I'm trying to get my first 3D game done with Unity. In this game the character will be flying through some rings.

I made the ring asset with MagicaVoxel, exported it in .obj and reimported in Unity withouth problems. I've set a rigidbody and a box collider on the character model and a mesh collider withouth rigidbody to the ring and I've also set Convex and added the default mesh of the ring.

The problem is that whenever I try to go inside the ring, I can't because I collide even with the empty part inside it. I'm not sure on how to made Unity collide only with the external part, but as far as I can see in the editor I'm using, I've no setting for it. I'm using Unity 5.3.4f1.

Can someone please explain me how to solve this problem?

Thank you very much.

EDIT

I'm sorry, I forgot to mention that I'm aware I can unset the ring mesh Convex property and get it to work. The problem of this solution, though, is that whenever I put adjacent rings I can glitch through them even if there's no space to fit. So basically I need a solid collider with Convex only on the external part of the ring and with empty space to fly through on the inside. Is this possible somehow?

sentences:
Mouse coordinate conversion Libgdx I have a camera:

//Map is a my object that wrapper of TiledMap class

In the create method:

this.renderer=new OrthogonalTiledMapRenderer(this.map.getMap();
this.camera=new OrthographicCamera();
this.camera.translate(map.getMapPixelWidth()/2, map.getMapPixelHeight()/2);
this.camera.update();
view=new StretchViewport(map.getMapPixelWidth(),map.getMapPixelHeight(), camera);
batch=new SpriteBatch();
In the update method:

this.renderer.setView(this.camera);
this.renderer.render();
this.camera.update();
batch.setProjectionMatrix(camera.combined);

ArrayList<RectangleMapObject> layer=this.getObjectsFromLayer("collision");//find collision layers
//Mouse coordinates
int x=Gdx.input.getX();
int y=Gdx.input.getY();
Vector3 coordinateScreen=new Vector3(x,y,0);
Vector3 coordinateWorld=camera.unproject(coordinateScreen);
Rectangle rectMouse=new Rectangle(coordinateWorld.x,coordinateWorld.y,20,20);
for(RectangleMapObject rect: layer)
if(Intersector.intersectRectangles(rectMouse, rect.getRectangle(), rectMouse)){
                    System.out.println("COLLISION MOUSE-MAPOBJECT ");}

public ArrayList<RectangleMapObject> getObjectsFromLayer(String layerName){

        ArrayList<RectangleMapObject> array=new ArrayList<RectangleMapObject>();

        MapObjects og=this.map.getMap().getLayers().get(layerName).getObjects();

        for(MapObject object : og)
            if (object instanceof RectangleMapObject)
                array.add(((RectangleMapObject) object));
        return array;
}

My problem is that the collision between mouse and mapobject never occurs Also if I click on the area where stands the MapObject. I think it is a problem of conversion of the coordinates of the mouse. Thank you for your time.

sentences:
Why do my sprites have a dark shadow/line/frame surrounding the texture? I'm starting OpenGL with Apple's GLKit hand I'm having some trouble to get my sprites displayed properly. The Problem is that they all are surrounded with thin dark lines. The screen shot below shows two rectangles with a png image textures containing transparency (obviously).

The black shadows, surrounding them are definitely not part of the pngS. The green png is done without anti-aliasing the blue one has an anti-aliased border. The black border is also apparent if I draw only one sprite.

Te relevant part (hope so...) of code is:

//render the scene
-(void)render
{
    glClearColor(69./255., 115./255., 213./255., 1.);
    glClear(GL_COLOR_BUFFER_BIT);
    [shapes enumerateObjectsUsingBlock:^(AAAShape *shape, NSUInteger idx, BOOL *stop)
     {
         [shape renderInScene:self];
     }];
}

//creating and storing the effect inside shape class
-(GLKBaseEffect *)effect
{
    if(!effect)
    {
        effect = [[GLKBaseEffect alloc] init];
    }
    return effect;
}

//rendering the shape (including effect configuration)
-(void)renderInScene:(AAAScene *)scene
{
    //TODO: Storing vertices in Buffer
    self.effect.transform.projectionMatrix = scene.projectionMatrix;
    self.effect.transform.modelviewMatrix = self.objectMatrix;
    if(texture)
    {
        self.effect.texture2d0.enabled = GL_TRUE;
        self.effect.texture2d0.envMode = GLKTextureEnvModeReplace;
        self.effect.texture2d0.target = GLKTextureTarget2D;
        self.effect.texture2d0.name = texture.name;
    }
    [self.effect prepareToDraw];

    if(texture)
    {
        glEnableVertexAttribArray(GLKVertexAttribTexCoord0);
        glVertexAttribPointer(GLKVertexAttribTexCoord0, 2, GL_FLOAT, GL_FALSE, 0, self.textureCoordinates);
        glEnable(GL_BLEND);
        glBlendFunc(GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA);
    }

    glEnableVertexAttribArray(GLKVertexAttribPosition);
    glVertexAttribPointer(GLKVertexAttribPosition, 2, GL_FLOAT, GL_FALSE, 0, self.vertices);
    glDrawArrays(GL_TRIANGLE_FAN, 0, self.vertexCount);
    glDisableVertexAttribArray(GLKVertexAttribPosition);

    if(texture)
    {
        glDisableVertexAttribArray(GLKVertexAttribTexCoord0);
        glDisable(GL_BLEND);
    }
}

Any ideas anyone? Thank you.

sentences:
What kind of performance issues does multiple instances of the exact same object have on a game? I'm fairly new to programming, and I've pretty much learned all the things I know on the go, while working on projects. The problem is that there some things that I just don't know where to begin searching.

My question is about performance, and how can multiple instances of the same object affect it -- Specifically, I'm talking about XNA's "GraphicsDevice" class. I have it instanced on four different parts of my game, and in three of those, the object has the exact same values for all the attributes. So, in that case, should I be using the same instance of GraphicsDevice, passing it as a parameter, even if I use it in different classes?

I apologize if the question seems redundant, but like I said, I've taught myself most of what I know, so there are quite a few "holes" in my learning process.

sentences:
How to manage input state in Unity3D? In Unity3D how do I manage input among many components, especially in relation to "blocking" input messages to certain components?

To make my question clear, an example:

Component 1: Input Manager

Manages a list of components that require input. They do this via a Register method, which adds the component to a List. Each registered component can poll input via this method:

public static bool GetKeyUpAndActive(KeyCode keyCode, MonoBehaviour entity) {
    return Input.GetKeyUp(keyCode) && List.Contains(entity);
}

This feels clunky, as each entity needs to pass itself to the manager, and the manager has to keep a list of registered input events.

Component 2: Script Manager

Manages scripts such as "Open Dialogue Box, say "Hello", play SFX, add Item x to inventory. Script manager responds to input, for example, if over component, and Input.Action is pressed, run this script.

Component 3: Dialogue Manager

Manages the dialogue box, pretty stock standard stuff. It also responds to input, pressing Input.Action will cycle through the dialogue boxes, until it reaches the end, then returns back to the game.

The main issue I am facing is that the script manager and the dialogue manager are responding to the Input.Action during their own updates. So Script 001 responds to Input.Action which triggers an open dialogue box, but because dialogue manager also responds, it has already cycled through to the next dialogue box.

I think the Input Manager is breaking encapsulation. I also feel like I'm missing an obvious component here, maybe I need a stronger subscriber pattern to follow, or should there be a separate state manager, and if so, should the input manager only send events/provide methods to components in the correct state, or should components check the state machine themselves?

sentences:
How can I make 3D games in 4K that are a few megabytes? I would like to make 3D games in 4K that are a few Megabytes (MB) in download size.

Is there a way to use 3D Vector Graphics in games to reduce the file size ?
Or is there any other way to achieve the same level of compression achieved by Flash(.swf) and Swift3D ?

sentences:
Long running calculation on background thread In my Cocos2D game for iOS I have a relatively long running calculation that happens at a fairly regular interval (every 1-2 seconds). I'd like to run the calculation on a background thread so the main thread can keep the animation smooth.

The calculation is done on a grid. Average grid size is about 100x100 where each cell stores an integer. Should I copy this grid when I pass it to the background thread? Or can I pass a reference and just make sure I don't write to the grid from the main thread before the background thread is done?

Copying seems a bit wasteful but passing a reference seems risky. So I thought I'd ask.

sentences:
How do you make a object that always follow another object? I'm trying to make a game object follow another game object and switch to another when a button is pressed. But right now it just seems to change the position when the button is pressed but it doesn't follow the object. How can I make it follow the other object?

public Transform PosObjOne;

public Transform PosObjTwo;

public Transform PosObjThree;

void Update () {
    if (Input.GetButtonDown("UseVr"))
    {
        PosObjThree.position = PosObjTwo.position;
    }

    if (Input.GetButtonDown("NoVr"))
    {
        PosObjThree.position = (PosObjOne.position);
    }
}

sentences:
What is the best way to limit player movement? I'm currently programming a 2d game where the player moves around on a rectangular playing field. The player has a direction and a velocity. What is the best way to limit the player's movement so he/she cannot move past the boundaries of the playing field?

Thanks,

DLiKS

sentences:
Math question: How to move/extrude a cube's face in Unity? The short question is: What's the math to move the face of a cube? I.e. how to stretch (or shrink) a cube in the direction of one of its faces?
Here's a picture:

The camera shows a cube (left). When the user clicks and drags on one of the faces (yellow), the face (it's vertices) should follow the mouse and as a result expand (or shrink) the cube in the given direction (like the right cuboid in the picture above).
Please note that this should be done ingame, by moving the vertices, not by scaling the object.
Now, I already have the selected face and all the vertices of its four corners. Further, the distance how far it should be moved is also known.
The question is, what needs to be done with the vertices to pull the face out (or push it in)? Whats the math?
Your help is very much welcome. Thank you.

sentences: How did you learn DirectX 11? How did you learn the DirectX 11 API? MSDN documentation, tutorials, blogs, sample applications, books, etc?

sentences:
Player's feeling towards stage selection in a platform game In a 2D platform game with RPG elements (not that it matters much), there's three ways, among others, for the player to choose the next stage he will play:

He can only play the next stage and the ones he already beat
On game start, half of the stages are open, and the other half is released when he beats the first half
All stages are available to the player

What's the difference in perspective to the players general experience and his feelings towards a game rating of these three alternatives?

(I know it sounds like a copy of an exercise, but it isn't. I did this way so people may take this question in a more academic way)

sentences:
Create vector based on length, angle and origin vector I have been trying to come up with a function that allows me to take in an origin vector, angle, and a length I want to be between the old and new vector, but I can't wrap my head around it.

The function requires the angle input to be a 3D vector that is normalized and needs to look something like this.

glm::vec3 CreateAngledVector(glm::vec3 origin, glm::vec3 angle, float length)
{
    angle = glm::normalize(angle);

    ...
}

If anyone has any suggestions on how I can achieve this, I'd be happy to hear them.

Edit
I've managed to make it so I can create angles on a 2D plane on all 3 dimension but I can't figure out how to rotate it on two planes at the same time.

glm::vec3 CreateAngledVector(glm::vec3 start, glm::vec3 axis, float angle, float length)
{
    axis = glm::normalize(axis);

    glm::vec3 output = axis;
    output = glm::rotate(output, (angle*DEG2RAD) * axis.z, glm::vec3(1.0f, 0.0f, 0.0f));
    output = glm::rotate(output, (angle*DEG2RAD) * axis.x, glm::vec3(0.0f, 1.0f, 0.0f));
    output = glm::rotate(output, (angle*DEG2RAD) * axis.y, glm::vec3(0.0f, 0.0f, 1.0f));

    output *= length;
    output += start;
    return output;
}

Using this function I can create circles using the following.

int loops = 180;
float angle_part = 360.0f / loops;
glm::vec3 axis = glm::vec3(1.0f, 0.0f, 0.0f);
for (int i = 0; i < loops; i++)
{
    glm::vec3 new_vector = CreateAngledVector(l1.position, axis, angle_part*i, 1.0f) ;
    ...
}

The state before the function works fine creating angled vectors on a 2d plane (end goal is to make circles) but when I attempt to turn the axis of the function to go into 3D such as glm::vec3 axis = glm::vec3(1.0f, 1.0f, 0.0f); It breaks the function (see example)

axis = glm::vec3(0.0f, 1.0f, 0.0f)

axis = glm::vec3(0.0f, 0.0f, 1.0f)

"Broken one" axis = glm::vec3(1.0f, 1.0f, 0.0f)

sentences:
When to use GameComponents? I know what it is and I'm using it as a frame counter for example. But when should I use it?

Does it make sense to say "I make all the input handling happen in a gamecomponent"? Is it flexible enough to add and remove fast in runtime? I see I can set the update order and draw order, but I guess to keep track of it an enum should be best like "GamePadInput = 0" or "MessageBox = 100".

Or should I just design simple, for example when I want to determinate if a messagebox is open checking "if (MessageBox.Active)" and then manually updating/drawing?

I'm a bit confused and can't decide what to do. I don't want to start designing the game and see later "oops". Maybe you can help me out :)

sentences:
How do I make an on-screen HUD in libgdx? I'm new to libgdx, and I am finding I am getting stumped by the simplest of things.  It seems to want me to do things a specific way, but the documentation won't tell me what that is.

I want to make a very simple 2d game in which the player controls a spaceship.  The mouse wheel will zoom in and out, and information and controls are displayed on the screen.

But I can't seem to make the mouse wheel NOT zoom the UI.  I've tried futzing with the projection matrices in between

Here's my (current) code:

public class PlayStage extends Stage {
...
    public void draw() {
    // tell the camera to update its matrices.
    camera.update();

    // tell the SpriteBatch to render in the
    // coordinate system specified by the camera.
    spriteBatch.setProjectionMatrix(camera.combined);

    spriteBatch.begin();

    aButton.draw(spriteBatch, 1F);

    playerShip.draw(spriteBatch, 1F);

    spriteBatch.end();
}
}

camera.zoom is set by scrolled(int amount).

I've tried about a dozen variations on the theme of changing the camera's projection matrix after the button is drawn but before the ship is, but no matter what I do, the same things happen to both the button and the ship.  So:

What is the usual libgdx way of implementing an on-screen UI that isn't transformed by the camera's projection matrix/zoom?

sentences:
Marching Cubes - Legalities? I know this isn't a "Is this legal" website, but because Marching Cubes is definitely a large subject in game development, and isn't really about a specific graphic/item, it would pass...

To the point!

Does anyone know whether Marching Cubes is allowed in a commercial game? If so is there anything i must do? Credit to someone/company etc?

Cheers.

sentences:
How can I optimize per-pixel drawing in SDL? I've been messing around with C++ the last few days and I'm trying to figure out how to draw the screen pixel by pixel each frame.

It sounded simple enough at first, but then I realized for loops during the games main loop is nothing but a slow mess. How do I safely and with speed show visual effects?

sentences:
How to configure A* for large 2D Grid based pathfinding, where paths could be long or short? I thought A* was Optimal, meaning I'd always get the quickest path.

I have written a generic Pathfinding implementation here:
https://github.com/mGuv/mGuv/blob/PathPerformanceExperiment/mGuv/mGuv/Pathfinding/Pathfinder.cs

It's a bit messy/weird as I've branched off my original to fix some issues and experiment.

I wrote a testing class that can read in an image file that uses Black for Obstacles, Blue for start, Green for goal. It too is a little messy but I'm just debugging again.

http://hastebin.com/wikejexige.avrasm

So it uses Euclidean Distance and Orthogonal movement to attempt to path.

It then generates an output image, with Black for Obstacles, Blue for the Path found, Orange for the Nodes Expanded, and Cyan for the Open Set.

Given the input image:

It outputs:

Which is less than Optimal?

I've tried tweaking the cost/heuristic functions and their weighting.

Eventually I can get something like:

But now look at that open set, it's essentially turned in to Dijkstra's Algorithm.

I also believe I have the "Breaking the tie" problem, as an input like:

Will expand way more nodes that necessary:

I've tried to follow the Wikipedia article on A* to come up with better cost handling but most of those assume you know the estimated path length. Which is difficult for me as I will be using this to path find on giant (1024x1024+) grids that are dynamic. From tiny (<10 step paths) to huge (> 10000 step paths).

I'm a little lost now as to where I'm going wrong. I don't know if there's a bug or a misunderstanding. I apologise for the tiny images, it was just easier to work a pixel basis.

sentences:
How to make UI text longer? I'm working on a menu that needs a wordy description, but I've noticed that it only shows 4 letters, then cuts off and this doesn't seem right.

I right click, select UI > text and again, it only displays 4 words, even though I can write a lot more there. Am I doing something wrong here?

I'm not sure how to get past this and I want to ask if anyone knows how to get past this? It seems like such a strange limit to put on the UI canvas.

sentences:
How do I reduce overdraw in a forest scene with lots of foliage? Unity comes with an overdraw view that looks something like this:

We've probably all seen it, and have probably been advised to check for overdraw. How do you go about actually doing anything about it?

My specific case:

I'm currently seeing a lot of overdraw from my terrain grass and trees as they do not respect occlusion culling. This seems to be a limitation in Unity. Is there anything I could do about it to reduce overdraw without losing the lush environment?

For reference, here is the foilage responsible for most of the overdraw and I'm exploring options other than to simply reduce the amount of foliage in the scene and lose the aesthetics:

sentences:
LWJGL 3 how to convert screen coordinate to world coordinate? I'm trying to convert screen coordinate to world coordinate on mouse click event.
For LWJGL 3 there's not GLU utility class is available whereas LWJGL 2 has.

I'm using JOML math classes and wrote following code, but its returning wrong world coordinate, I'm doing something wrong and couldn't figure out.

On program init, I get viewProjMatrix and viewport:

viewProjMatrixUniform = glGetUniformLocation(this.program, "viewProjMatrix");
IntBuffer viewportBuffer = BufferUtils.createIntBuffer(4);
int[] viewport = new int[4];
glGetIntegerv(GL_VIEWPORT, viewportBuffer);
viewportBuffer.get(viewport);

On render loop, I calculate viewProjMatrix:

viewProjMatrix
    .setPerspective((float) Math.toRadians(30), (float) width / height, 0.01f, 500.0f) // define min and max planes
    .lookAt(eye_x, eye_y, eye_z,
            eye_x, eye_y, 0.0f,
            0.0f, 2.0f, 0.0f);
glUniformMatrix4fv(viewProjMatrixUniform, false, viewProjMatrix.get(matrixBuffer));

I convert screen coordinate to world coordinate with following code:

DoubleBuffer mouseXBuffer = BufferUtils.createDoubleBuffer(1);
DoubleBuffer mouseYBuffer = BufferUtils.createDoubleBuffer(1);
glfwGetCursorPos(window, mouseXBuffer, mouseYBuffer);
double x = mouseXBuffer.get(0);
double y = mouseYBuffer.get(0);
System.out.println("clicked at: " + x + " - " + y);

Vector3f v3f = new Vector3f();
viewProjMatrix.unproject((float)x, (float)y, 0f, viewport, v3f);
System.out.println("world coordinate: " + v3f.x + " - " + v3f.y);

Here's the full source code: https://gist.github.com/digz6666/48bb433c83801ea4b82fa194f05b4f02

sentences: How to always draw a child mesh in front of its parent mesh I need to display a gizmo-like mesh at runtime, and it must be always in front of its target mesh. How can I achieve that?

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:
Understanding the perspective projection matrix in OpenGL Setting the Perspective projection matrix in Open GL (including OpenGL ES 2.0) has the following general format:

glm::mat4 perspective(float fovy, float aspect, float zNear, float zFar);

Notice the last two parameters; First one specifies zNear plane, which is the plane closer to the camera. The second one specifies zFar plane which is far from the camera.

It is common knowledge that, in OpenGL, things that are further, in other words "deeper into the screen", have negative Z axis. Why then all the OpenGL examples, that set perspective projection  matrix (taken from reliable sources like OpenGL SuperBible and simmilar) look like the two above mentioned parameters (zNear, zFar) of Perspective projection funcion are swapped?

This example is taken from GLM(OpenGL Math) webiste:

glm::mat4 Projection = glm::perspective(45.0f, 4.0f / 3.0f, 0.1f, 100.f);

You can see, that the zNear parameter is actually further from the camera, than zFar parameter, which is 100 points closer to the camera/viewer.

Can you provide easy to understand explanation, please? I it is not just one but all the examples, which pass zFar as higher positive value than zNear. Thanks.

My Example:

In my code, when I set:

glm::mat4 Projection = glm::perspective(45.0f, 4.0f / 3.0f, 1000.0f, -500.0f);

I assume my frustum being 1000 points long in z-positive direction and 500 points long in z-negative direction.

When I set things like this, I can see at least some object, although things are not perfect: for some reasons I see only objects positioned on negative z coordinates.

This might relate to my incorrect understanding of the perspective projection function.

sentences:
Directx 11 full screen I build simple directx 11 application in c++ that draw square to screen.

Also check in the end of the program when I close the last peace of directx the number of free reference.

This work great in normal window but in full screen the reference count return 1.
I did some checks and I realised that if I destroy the window before I am closing the swap chain it works even in full screen.

My question is how can I close the swap chain with reference count of 0 without destroying the window before.

sentences:
How to find out the vertices of the polyhedron formed by the overlapping area of two rotated boxes? What is the most efficient way for finding out the vertices of the polyhedron formed by the overlapping area of two rotated 3D boxes?

If it is still confusing what I mean by "polyhedron formed by...", see the picture below:

Of course, in that picture the boxes are still not rotated*.

But imagine I rotate both. I would like to identify the vertices that form the inner area of the overlapping.

What is the less expensive way for doing so? (I'm using C#, but can read C++ well).

*The picture comes from a blog post that teaches how to get the overlapping area of two 3D AABBs: http://blog.meltinglogic.com/2015/04/aabb-overlapping-area/

sentences:
What's the 'proper' way to get unit vectors? My apologies if I've misunderstood the term 'unit vector' or misapplied it in concept, but I think that is the term for an object's heading when expressed as [x, y] when x and y are a value between -1 and 1; so if an object were moving 'south' on a computer screen, it would have a unit vector of

[0, 1]

...right?

Anyway, I've been using this concept to move my objects and rotate their images (when needed), but I think the math I'm using to determine the unit vector is... suboptimal.

def set_heading(self, goal):
    """Uses a 'goal' (x, y) to set the object's heading.
    Returns list of 0s and 1s for 'straight' headings.
    Diagonal headings are + and/or - math.sqrt(2)/2.
    """
    vals = [a - b for a, b in zip(goal, self.pos)]
    self.heading = [i / abs(i) if i != 0 else 0 for i in vals]
    if 0 not in self.heading:
        self.heading = [i * (sqrt(2)/2) for i in self.heading]

(If you're not familiar with Python ternary syntax, the second line contains i / abs(i) if i != 0 else 0 which is Python's way of saying x if Condition else y as opposed to the usual Condition? x : else y syntax in other languages. Basically I'm just trying to avoid dividing by zero!)

So as you can see, this method of doing this sort of 'locks' the object into eight directions; if a 0 is not present in the heading, the method assumes that we're traveling diagonally and so multiplies the values by sqrt(2) / 2 to ensure that the object doesn't travel faster than it should when moving diagonally.  In this way I can move the object by simply adding the result of the unit vector times its speed to its current x and y coordinates.

def move(self):
    """Moves the object by changing self.pos."""
    self.pos = [a + (b * self.speed) for a, b in zip(self.pos, self.heading)]

I can't help but feel like the method for getting the unit vector (if that's what it's correctly called) is sophomoric. Especially since it is locked into eight directions - it's fine for the little project I'm working with currently, but I'm not sure of the right method for getting a more precise unit vector. What is the correct method for doing so - and is it more or less performant than the weirdness I have come up with independently?

sentences:
LibGDX - On the "slowness" of loading assets Many tutorials I've seen put the loading of assets via AssetManager in a dedicated screen which displays some progress bar or image while the loading happens in background. Each "real" screen then gets the resources it needs from the asset manager, typically in the constructor, eg

public class GameScreen extends ScreenAdapter {

  private MyGame game;

  private Texture t1;
  private Sound s1;

  public GameScreen(MyGame game) {
    this.game = game;

    AssetManager am = game.getAssetManager();

    t1 = am.get("....", Texture.class);
    s1 = am.get("....", Sound.class);
  }
  // use t1 and s1

Now another source I've seen takes this concept a bit further and also does the actual get()s in the asset loading class, so screens don't have to do them themselves, eg

// in the Loader class

public AssetManager am = new AssetManager();
public Texture t1;
public Sound s1;

...
am.load(...);
am.load(...);
am.load(...);

// finishLoading() or update()....
...
t1 = am.get(...);
s1 = am.get(...);
...

// in the screen class

t1 = game.am.t1;
s1 = game.am.s1;
...
// use t1 and s1

Now my question is: is this good practice? What's the expensive part of loading assets, the AssetManager's .load()s or also the .get()s? (I thought it was only the .load()s.) Is removing the get()s from the screens really a performance gain?

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:
How do i update opengl lightning equation in my fragment shader to make my texture less glossy and more like a fabric I built a model in blender, and am currently trying to import it into my android app using assimp together with opengl, i dont have any issues with the importing but my goal is to make the object look realistic as possible, and this is where my problem lies...I have implemented normal mapping using both the diffuse and normals of my texture but after rendering it the objects looks smooth and glossy, yes the bumps were rendered well and i like it but i need the material to look more like a fabric (cloth/textile), please how can i do this? do i need to update my lighting equation or the issue is with my original diffuse texture?

Here is my original diffuse texture

Here is my rendered model

Here's my fragment shader

    void main()
{
    // obtain normal from normal map in range [0,1]
    vec3 normal = texture2D( normalMap, textureCoords ).xyz;
    // transform normal vector to range [-1,1]
    normal = normalize(normal * 2.0 - 1.0);  // this normal is in tangent space

    // get diffuse color
    vec3 color = texture2D( textureSampler, textureCoords ).xyz;
    // ambient
    vec3 ambient = 0.1 * color;
    // diffuse
    vec3 lightDir = normalize(tangentLightPos - tangentFragPos);
    float diff = max(dot(lightDir, normal), 0.0);
    vec3 diffuse = diff * color;
    // specular
    vec3 viewDir = normalize(tangentViewPos - tangentFragPos);
    vec3 reflectDir = reflect(-lightDir, normal);
    vec3 halfwayDir = normalize(lightDir + viewDir);
    float spec = pow(max(dot(normal, halfwayDir), 0.0), 32.0);
    vec3 specular = vec3(0.2) * spec;

   gl_FragColor  = vec4(ambient + diffuse + specular, 1.0);
}

Here's my vertex shader

mat3 transpose(mat3 m) {
    return mat3(m[0][0], m[1][0], m[2][0],
    m[0][1], m[1][1], m[2][1],
    m[0][2], m[1][2], m[2][2]);
}

void main()
{

    gl_Position     = mvpMat * vec4(vertexPosition, 1.0);

    vec3 fragPos = vec3(model * vec4(vertexPosition,1.0));

    vec3 T = normalize(normalMatrix * tangent);
    vec3 N = normalize(normalMatrix * normal);
    T = normalize(T - dot(T, N) * N);
    vec3 B = cross(N, T);

    mat3 TBN = transpose(mat3(T, B, N));

    //values for fragment shader
    tangentLightPos = TBN * lightPos;
    tangentViewPos  = TBN * viewPos;
    tangentFragPos  = TBN * fragPos;
    textureCoords   = vertexUV;
}

sentences:
How should I design my classes in a game? I'm stuck for ideas on classes in game programming. This is probably more of an opinion based question. I'm looking for information that is proving hard to find on the internet.

Say I have a class called  Bullet or Mob, the name doesn't really matter it's just an example. With this, there are two options I can think of.

Have the class purely as a way of storing data and nothing else. So I could have, for example, properties such as EntityID, Velocity, HealthPoints, NumberOfAttacks.
I would then have some other part of the game which iterates through every instance of every object and update the properties from there.

Example: During the iteration, it checks what type of object it is, such as Bullet etc. Once it has checked this, it will calculate where the bullet should move to next based upon the Velocity property.
Or, have the same properties within the class, but also have all the code for updating it's own properties in there too. Example: The bullet has some kind of Update() method which get's called periodically by the game engine. This Update method would then take it upon itself to calculate the new Velocity and update it's position etc.
Some combination of the both? Something else I haven't thought of?

Which of these options is the more commonly used approach in game programming? What are the benefits or disadvantages of these different methods?

Have I got it all completely wrong?

sentences:
Problems generating procedural mesh I have this code below that I found on catlikecoding that generates a procedural grid that I want to apply noise to, however once I go over a certain value it does expand vertically. Can anyone see why it wouldn't?

For example, 100x100:

However, 500x500 is clearly wrong:

Code used:

using UnityEngine;

[RequireComponent(typeof(MeshFilter), typeof(MeshRenderer))]
public class Island : MonoBehaviour {

public int xSize, ySize;

    private Mesh mesh;
    private Vector3[] vertices;

    private void Awake () {
        Generate();
    }

    private void Generate () {
        GetComponent<MeshFilter>().mesh = mesh = new Mesh();
        mesh.name = "Procedural Island";

        vertices = new Vector3[(xSize + 1) * (ySize + 1)];
        Vector2[] uv = new Vector2[vertices.Length];

        for (int i = 0, y = 0; y <= ySize; y++) {
            for (int x = 0; x <= xSize; x++, i++) {
                vertices[i] = new Vector3(x, y);
                uv[i] = new Vector2((float)x / xSize, (float)y / ySize);
            }
        }

        mesh.vertices = vertices;
        mesh.uv = uv;

        int[] triangles = new int[xSize * ySize * 6];
        for (int ti = 0, vi = 0, y = 0; y < ySize; y++, vi++) {
            for (int x = 0; x < xSize; x++, ti += 6, vi++) {
                triangles[ti] = vi;
                triangles[ti + 3] = triangles[ti + 2] = vi + 1;
                triangles[ti + 4] = triangles[ti + 1] = vi + xSize + 1;
                triangles[ti + 5] = vi + xSize + 2;
            }
        }

        mesh.triangles = triangles;
        mesh.RecalculateNormals();
    }
}

sentences:
Libgdx Recoil Effect I set -velocityX to my sprite gun.

float velocityX = -20 * dt;
if(trigger) {
   gun.setX(gun.getX() + velocityX);
}

I basically set a velocity of -20m/s to my gun vertex X. The problem is when I rotate the gun in a vertical position or example: 30degree angle.

How can I add recoil effect even if the sprite is not in a horizontal position, or should I just add it in the animation?

sentences:
HLSL SetVertexShader Texture2DArray Sample I want to do some texture samples in the vertex shader, but it seems this cannot be done in the same was as when using the Pixel shader.

The code is basically..

Texture2DArray   gTexture;

VS()
{
    gTexture.Sample(samPoint, float3(x, y, z)
}

PS()
{
    gTexture.Sample(samPoint, float3(x, y, z)
}

technique11 main
{
   pass P0
   {
      SetVertexShader(CompileShader(vs_4_0, VS()));
      SetGeometryShader(NULL);
      SetPixelShader(CompileShader(ps_4_0, PS()));
   }
}

The PS() will compile and work fine but I also need to do this sort of thing in VS().

When putting this code in the VS() I get:
Error   X4532   cannot map expression to vs_4_0 instruction set ....

I have done some googling and it looks like you can sample a texture in the VS but I cant get enough detail together to make this work.

Any help on this would be good.

Just for reference:
I am using
DirectX11
VS2015

sentences:
Collision detection problem in monogame C# protected virtual void CollisionDetection()
    {
        if (CanGoRight() == false) pos.X -= velocity;
    }

    protected bool IsTouchingLeft(Basic2d asset)
    {
        return pos.X + dims.X / 2 > asset.pos.X &&
               pos.X - dims.X / 2 < asset.pos.X &&
               pos.Y + dims.Y / 2 < asset.pos.Y + dims.Y &&
               pos.Y - dims.Y / 2 > asset.pos.Y;
    }

    protected bool CanGoRight()
    {
        foreach (Basic2d asset in Globals.GameAssets)
            if (IsTouchingLeft(asset) == true) return false;
        return true;
    }
}

That's my code(just starting) for collision detection. All of this code is in Character class which has also methods for moving and updating and displaying character.

I struggle with collision detection. I have all my assets(blocks) in the list of objects which is in the class named Globals. Class character is a subclass of a Basic2d class(this is class for all bricks assets).

So I check if a character is overlapping with any of bricks from the list. Criteria for checking left side overlapping is in the IsTouchingLeft method and it doesn't work. I cannot see what is wrong with this code, but every time I change sth it works differently but not well.

What should I change?

And the object of Character class has an origin point in in the center of the texture, but the object of Basic2d class has origin point in the bottom left corner.

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:
How to use a .mtl file in Unity? I want to use a .mtl file to draw my objects in unity.
Can I somehow convert a .mtl file into a normal Unity material?

My .mtl file is like this:

newmtl phongE1SG
illum 4
Kd 0.00 1.00 0.00
Ka 0.00 0.00 0.00
Tf 1.00 1.00 1.00
Ni 1.00
Ks 0.50 0.50 0.50

Is this the same as a Unity material which has the sliders "albedo", "metallic", "smoothness", etc?

Or is there any shader to do it?

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:
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:
Trigger scene loading in one device from another device using Unity WWW class I have a master device and client device. I want to load a scene in the client device by pressing a button in the master. My method is, when the button is pressed in the master device, a data is stored in a server using the WWW class and in the client device it is checked whether the data is there, through a coroutine.

But, in the client device, the coroutine is not waiting for the trigger from the master. Instead it continues the execution. Because in the yield return statement, it says downloading is complete. Can I make it to wait for a trigger from the server?

sentences:
Ray-Triangle Intersection Detection using Barycentric Coordinates I am attempting to convert the algorithm from http://www.cbloom.com/3d/techdocs/fast_ray_tri.txt to java code, but my solution does not function correctly.

The only intentional change I made was for the second point, my method accepts a unit vector instead of the other end of the line segment.

For now, all collision calculations are done in this one method (nothing is pre-calculated).

Any suggestions as to what I may have done wrong?

//collision with barycentric coordinates
boolean checkCollision(Vector3f rayStart, Vector3f rayDirection){

    Vector3f normal=new Vector3f().cross(new Vector3f(point1).sub(point0), new Vector3f(point2).sub(point0)).normalize();

    planeOffset=-normal.dot(point0);

    Vector3f
    edge1 = new Vector3f(point1).sub(point0),
    edge2 = new Vector3f(point2).sub(point1),
    edgePerp1 = new Vector3f().cross(normal, edge1),
    edgePerp2 = new Vector3f().cross(normal, edge2);

    float edgePlaneDist1 = edgePerp1.dot(point0),
                edgePlaneDist2 = edgePerp2.dot(point1);

    {
        float distance1=edgePerp1.dot(point2)-edgePlaneDist1;
        float distance2=edgePerp2.dot(point0)-edgePlaneDist2;

        edgePlaneDist1/=distance1;
        edgePlaneDist2/=distance2;

        edgePerp1.scale(1/distance1);
        edgePerp2.scale(1/distance2);
    }

    //point-plane distance
    float dFm=normal.dot(rayStart)-planeOffset;

    Vector3f rayEnd=new Vector3f(rayStart).add(new Vector3f(rayDirection).scale(30));

    float dTo=normal.dot(rayEnd)-planeOffset;

    float denom=dTo-dFm;

    Vector3f temp=new Vector3f(rayStart).scale(dTo).add(rayEnd.scale(dFm));

    float uTimesDenom = edgePerp1.dot(temp) - edgePlaneDist1 * denom;

    if ( uTimesDenom < 0 || uTimesDenom > denom )
    {
        // off triangle
        return false;
    }

    float vTimesDenom = edgePerp2.dot(temp) - edgePlaneDist2 * denom;

    if ( vTimesDenom < 0 || (uTimesDenom+vTimesDenom) > denom )
    {
        // off triangle
        return false;
    }

    return true;

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:
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:
bullet raycast vehicle - understanding coordinate system Bullet world space coordinate system is the same as opengl world coordinate system. I have noticed that raycast vehicle has the following function:

virtual void btRaycastVehicle::setCoordinateSystem(int rightIndex,
                                                   int upIndex,
                                                   int forwardIndex)

How does that function work ?

By default raycast vehicle has the following parametets:

forward vector: [0, 1, 0]
forward axis: 1
right axis: 0
up axis: 2

Does it mean that y axis is swapped with z axis ?

After calling:

raycastVehicle.setCoordinateSystem(0,1,2);

I get the following parameters:

forward vector: [0, 0, 1]
forward axis: 2
right axis: 0
up axis: 1

which makes more sense to me but I'm still confused why a default setup is other (not compatible with world coordinate system) and how to interpret it.

sentences:
midpoint displacement algorithm in sdl I am trying to implement moving random hills in SDL. I am using midpoint displacement algorithm to create some random terrain and I have also accomplished to move the terrain too. But the problem is that the terrain repeats itself after certain period of time. Why is that exactly happening and how to rectify it. Here is my source code.

#include <SDL2/SDL.h>
#include <iostream>
#include <cstdlib>
#include <cmath>
using namespace std;
const int SCREEN_WIDTH = 640;
const int SCREEN_HEIGHT = 480;
SDL_Window* gWindow = NULL;
SDL_Renderer* gRenderer = NULL;
int arr_size = pow(2.0,11.0) + 1;
int terrain_array[10000];
float roughness = 0.5;
int intial_displacement = 150;
int count = 0;
bool init()
{
    bool success = true;
    if( SDL_Init( SDL_INIT_VIDEO ) < 0 )
    {
        cout << "SDL could not initialize. SDL_Error: " << SDL_GetError() << endl;
        success = false;
    }
    else
    {
        if( !SDL_SetHint( SDL_HINT_RENDER_SCALE_QUALITY, "1" ) )
        {
            cout << "Linear texture filtering not enabled.\n";
        }
        gWindow = SDL_CreateWindow( "Midpoint_Displacement_Algortihm", SDL_WINDOWPOS_UNDEFINED, SDL_WINDOWPOS_UNDEFINED, SCREEN_WIDTH, SCREEN_HEIGHT, SDL_WINDOW_SHOWN );
        if( gWindow == NULL )
        {
            cout << "Window could not be created. SDL_Error: " << SDL_GetError() << endl;
            success = false;
        }
        else
        {
            gRenderer = SDL_CreateRenderer( gWindow, -1, SDL_RENDERER_ACCELERATED | SDL_RENDERER_PRESENTVSYNC );
            if( gRenderer == NULL )
            {
                cout << "Renderer could not be created. SDL_Error: " << SDL_GetError() << endl;
                success = false;
            }
            else
            {
                SDL_SetRenderDrawColor( gRenderer, 96, 96, 96, 96 );
            }
        }
    }
    return success;
}
void close()
{
    SDL_DestroyRenderer( gRenderer );
    SDL_DestroyWindow( gWindow );
    gWindow = NULL;
    gRenderer = NULL;
    SDL_Quit();
}
void initializeArray()
{
    for(int i = 0; i < arr_size; i++)
    {
        terrain_array[i] = 0;
    }
}
void generateTerrain(int leftindex, int rightindex, int displacement)
{
    if((leftindex + 1) == rightindex)
        return;
    int midindex = floor((leftindex + rightindex) / 2);
    int change = ((rand()%1) * 5 - 1) * displacement;
    terrain_array[midindex] = (terrain_array[leftindex] + terrain_array[rightindex]) / 2 + change;
    displacement = displacement * roughness;
    generateTerrain(leftindex, midindex, displacement);
    generateTerrain(midindex, rightindex, displacement);
}
void drawTerrain()
{
    int start_point = 1;
    int i;
    SDL_SetRenderDrawColor( gRenderer, 96, 96, 255, 255 );
    for(i = 1; i < arr_size; i++)
    {
        SDL_RenderDrawLine( gRenderer, start_point, SCREEN_HEIGHT, i, (terrain_array[(count + i)%arr_size] + 3 * intial_displacement));
        start_point = i;
    }
    count++;
}
int main()
{
    initializeArray();
    if( !init() )
    {
        cout << "Failed to initialize\n";
    }
    else
    {
        bool quit = false;
        SDL_Event event;
        while( !quit )
        {
            while( SDL_PollEvent( &event ) != 0)
            {
                if( event.type == SDL_QUIT )
                {
                    quit = true;
                }
            }
            generateTerrain(0, arr_size - 1, intial_displacement);
            SDL_SetRenderDrawColor( gRenderer, 96, 96, 96, 96 );
            SDL_RenderClear( gRenderer );
            drawTerrain();
            SDL_RenderPresent( gRenderer );
        }
    }
    close();
    return 0;
}

I am new to this stuff and trying to learn.
This is what it looks like.

sentences:
How to display sprites on a 2D canvas, using Unity 5 and C# I want to show a mini-map on the screen, but I don't have any idea to how to paint something in a panel on a canvas by code. The mini-map would look like this prototype I made some time ago, in Visual Studio.

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

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

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

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

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

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

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

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

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

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

The map is stored in an array for checking positions.

sentences:
Performance of manipulating a mesh in realtime Does Unity allow streaming mesh data that can be continuously changed?

I have a level that is dynamically changing based on some parameters. The number of triangles stays the same, they just change positions.

I'm speaking of around 2000 triangles that need their position updated each frame (they follow a spline that is computed on CPU), running on mobile phones.

I can't use a TrailRenderer because the object is a whole level. I can't use bones, because I need to know the final position for each vertex for my custom collision code.

The mesh should be marked Mesh.MarkDynamic.

sentences:
Performance problems with many entities in AndEngine I'm developing a rolling scene based game. I'm loading all the entities from a XML file and create them in the Loading Scene.

I recently increased the game width, and, by doing so, I now have about 300 entities (instead of about 100) in the whole level. This causes a performance problem: the game is "Lagging" \ "jumping" and everything moves slowly.

I'm loading the entities with the "LevelLoader".

I tried to add:

levelObject.setCullingEnabled(true);

before returning the object in :

public IEntity onLoadEntity(final String pEntityName, final Attributes pAttributes){...}

and also set Dithering in the engineOptions:

engineOptions.getRenderOptions().setDithering(true);

but it didn't help...

I'm implementing the sprite created from XML as Matin does in his tutorial:

http://www.matim-dev.com/full-game-tutorial---part-11.html

Is there a better way to handle such a high number of entities? Or is there another way to improve the performance?

sentences:
Multiple animations on flash timeline I am working on a game inside Flash with ActionScript 3.

I have a horse game object with different animations for Walk, Run and so on. I have never worked with different animation types with Flash timeline. I want to have all these animations setup on the timeline at different key frames with different labels for each animation.

After setting this up, how do I select a specific animation?

Currently what I have setup inside Flash does not seem to work. When the walk animation is about to end, I want it to loop and start from the beginning. Currently what it does is it plays all the animations set on the timeline and not just the walk animation.

horseOne.gotoAndPlay("startwalk");

if(horseOne.currentLabel == "endwalk"){
    horseOne.gotoAndPlay("startwalk");
}

Please refer to the image of my fla timeline.

sentences:
When do you use StartCoroutine and when Invoke? I am confused. Both seem to do the same thing: Delay a method.

Both Invoke and StartCoroutine allow you to call a method by name (string).

StartCoroutine("functioncalls", 2f);
StartCoroutine(functioncalls());

Invoke:

void Call()
{
    Invoke("FunctionCall",2f);
}

void FunctionCall()
{
    Debug.Log("this function run");
}

StartCoroutine:

void Call()
{
      StartCoroutine(functioncalls());
}

IEnumerator functioncalls()
{
    yield return new WaitForSeconds(2f);
    Debug.Log("this function run");
}

Both do the same thing, or not?

What exactly is the difference between Invoke and StartCouroutine? In which situation would I use one and when the other?

sentences:
Is it possible that elements in the StreamingAssets folder are not read in build? I'm making a 2D game. In my StreamingAssets folder I have a JSON file with some info about inventory items (id, description, rarity, name, is stackable or not) and a png file which contains a pixel map (128x32) of the level I want to load after a first scene (this is from Quill18's tutorial: https://www.youtube.com/watch?v=5RzziXSwSsg , basically a specific color corresponds to a specific prefab. An object reads through all the pixels and then spawns the level). The fact is that I have issues with both these elements when the game is built (everything works perfectly in the game window in Unity): the inventory items don't collide with the player and the level is not loaded.

This is the code that gets the image name

public string levelFileName;
string filePath = Application.dataPath + "/StreamingAssets/" + levelFileName;
byte[] bytes = System.IO.File.ReadAllBytes (filePath);
Texture2D levelMap = new Texture2D (2, 2);
levelMap.LoadImage (bytes);

And the pickable objects basically have a collision detection script and have a specific ID, so that when they collide with the player, the inventory adds in a free slot an image with the specs correspondant to that ID (i.e. ID=1 then it's an health potion, is stackable, it's not rare and so on). Everything else works fine in the game.
Do you think that the issue is linked to the StreamingAssets folder (first time using it) or is it just a coincidence? And also could you help me solve the problem?
Thank you in advance for any kind of help.

Edit: my Player logs:

sentences:
How can I find the position of a corner of a transformed sprite in SFML? I need help with calculating the end points of a stick (a sprite) in my stick game.

First, I set up it's position by some coordinate (x,y) after that I rotate it by theta degrees.

I know the width and height (427, 17), but I can't figure out how to calculate it's end points after the rotation (I need them for intersect detection algorithm).

Moreover, I can't figure out how to detect when I clicked on it with the mouse, because getGlobalbounds.contains(mouse) gives me its bounding box, but I want to detect that I was clicked exactly on the entity..

sentences:
Loading PNG textures for use in Android OpenGL ES1 I'm very new to Android and OpenGL coding (I have previously used ogre3d).  I am trying to find an efficient way to load PNG textures.  It is currently taking around 8 secs to load 3 512x512 textures on a fairly fast phone (Motorola Defy)

There seems to be a problem with the texture being upside-down (I used a Matrix to flip it below).  Secondly, the order of the colour channels are incompatible, therefore each pixel needs changed.  This (I believe) is the cause of the slowness, is there a way to make the BitmapFactory load it in a channel order that is compatible with opengl?   Is there a better approach here?

Here is the code: -

// Will load a texture out of a drawable resource file, and return an OpenGL texture ID:
private int loadTexture(GL10 gl, Context context, int resource, boolean loadMipMaps) {
    // We need to flip the textures vertically:
    Matrix flip = new Matrix();
    flip.postScale(1f, -1f);

    // This will tell the BitmapFactory to not scale based on the device's pixel density:
    BitmapFactory.Options opts = new BitmapFactory.Options();
    opts.inScaled = false;

    // Load up, and flip the texture:
    Bitmap temp = BitmapFactory.decodeResource(context.getResources(), resource, opts);
    Bitmap bmp = Bitmap.createBitmap(temp, 0, 0, temp.getWidth(), temp.getHeight(), flip, true);
    temp.recycle();

    int id = loadTextureFromBmp(gl,bmp, true);

    bmp.recycle();

    return id;
}

protected static int loadTextureFromBmp(GL10 gl, Bitmap bmp, boolean reverseRGB) {
    ByteBuffer bb = ByteBuffer.allocateDirect(bmp.getHeight()*bmp.getWidth()*4);
    bb.order(ByteOrder.nativeOrder());
    IntBuffer ib = bb.asIntBuffer();

    for (int y=bmp.getHeight()-1;y>-1;y--)
            for (int x=0;x<bmp.getWidth();x++) {
                    if (reverseRGB) {
                            int px = bmp.getPixel(x,y);
                            int alpha = (px & 0xFF000000) >> 24;
                            int red = (px & 0xFF0000)>>16;
                            int green = (px & 0xFF00)>>8;
                            int blue = (px & 0xFF);
                            ib.put((alpha << 24) | (blue << 16) | (green<<8) | (red));
                            //ib.put(Integer.reverseBytes(bmp.getPixel(x, y)));
                    }
                    else {
                            ib.put(bmp.getPixel(x,y));
                    }
            }
    ib.position(0);
    bb.position(0);

    int[] tmp_tex = new int[1];

    gl.glGenTextures(1, tmp_tex, 0);
    int tex = tmp_tex[0];
    gl.glBindTexture(GL10.GL_TEXTURE_2D, tex);
    gl.glTexImage2D(GL10.GL_TEXTURE_2D, 0, GL10.GL_RGBA, bmp.getWidth(), bmp.getHeight(), 0, GL10.GL_RGBA, GL10.GL_UNSIGNED_BYTE, bb);
    gl.glTexParameterf(GL10.GL_TEXTURE_2D, GL10.GL_TEXTURE_MIN_FILTER, GL10.GL_LINEAR);
    gl.glTexParameterf(GL10.GL_TEXTURE_2D, GL10.GL_TEXTURE_MAG_FILTER, GL10.GL_LINEAR);

    return tex;

}

sentences:
Blueprint formula doesn't match material formula I'm currently working on a physical water system for Unreal. To represent the water surface, I have a simple flat grid mesh that I then apply a material to which has a formula for world position offset.

The formula currently is pretty simple, I just have a simple sine wave powered by world X position and elapsed time, however despite both formulas being, as far as I can tell, the same, they give different outputs.

As you can see below, both formulas perform the same operations, and both are powered by the same input, world position and Game Time in Seconds. In theory,  the material (second-last image) should be dividing X position by 2000 and multiplying time by 0.1, just as those values are in the material, however instead the closest I could get to having both values line up is 314* and 0.625.

It's important that these values line up, as the blueprint version is meant to be used for buoyant objects to make sure they stay on the surface of the water, and probably other calculations as I progress.

Does anyone know why these formulas don't line up like they should? Does math work differently in the material editor? Does Absolute World Position give values in a different scale compared to Actor Position?

*I thought this might be 100 * PI, but that doesn't seem to line up exactly either so may be a coincidence.

The final result here is piped directly into World Position Offset.

Time parameter is updated every frame to match the blueprint version.

Blueprint function that I need to match the material formula for accurate buoyancy and such.

Included for completeness, an example of how the water height function is used.

sentences: Writing a dynamic achievement system without hardcoding rules into the application I really enjoyed the solution provided here for groundwork on writing an achievement framework. The problem I have is I have game designers that would like to be able to insert achievements into a CMS at runtime. In a way, it sounds insane and complex to do this, but is it really? I think the concept of having to do a hard push of the application for every new achievement is cumbersome. I would love to be able to give our designers the capability to put together new achievements by entering them into a database. It shouldn't matter what tool I'm using, but for those interested, my backend is being written in JRuby (Ruby on top of the JVM). What are some possible ways of going about abstracting the logic in the aforementioned link even further so that rules can be interpreted at runtime?

sentences:
How can I make natural rain drops on screen? I'm trying to make rain effect drop with metaballs and trail on screen.I find a clue in shadertoy but I didn't understand how implemented:
https://www.shadertoy.com/view/ltffzl
unfortunately it have many math calculations and i can't use it in unity because it produces a lag.obviously I should use textures but how can I have trail effect?!

my idea is using a texture and trail renderer for droping but how can I have metaballs effect?

Update
I could Implement Metaballs by This Article
https://github.com/smkplus/RainFX/tree/master
but I haven't Idea about trail

sentences:
How to calculate new velocities between resting objects (AABB) after accelerations? lately I have been trying to create a 2D platformer engine in C++ with Direct2D. The problem I am currently having is getting objects that are resting against each other to interact correctly after accelerations like gravity have been applied to them.

Right now I can detect collisions and respond to them correctly (I think) and when objects collide they remember what other objects they're resting against so objects can be pushed by other objects (note that there is no bounce in any collisions so when objects collide they are guaranteed to become resting until something else happens). Every time the simulation advances, the acceleration for objects is applied to their velocities (for example vx += ax * t, where t is time elapsed since last advancement).

After these accelerations are applied, I want to check if any objects that are resting against each other are moving at different speeds than their counterparts (as different objects can have different accelerations) and depending on that difference either unlink the two objects so they are no longer resting, or even out their velocities so they are moving at the same speed once again. I am having trouble creating an algorithm that can do this across many resting objects.

Here's a diagram to help explain my problem

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:
Why some audio files are not working in Unity? I am making a 2D game in which I wanted to attach audio file to a button. I was able to do this successfully. But later I felt like changing that sound. So I simply replaced it with another audio file. Then it stopped working! When I again attached the first audio file instead of second one, it worked again.

My setup is as follows: The file format is wav. I created an empty gameobject and attached an Audio Source component to it. Assigned an audio clip to it. Unchecked "Play on Awake". Went to the OnClick() section of the UI Button. Clicked the plus sign to add an item to the list. Assigned the Audio Source object to the object field. Chose AudioSource.Play in the dropdown.

I wanted to know why is my second audio file of the same format not working!

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: Alternative to Google Play when publishing Android game app (.apk)? In order to register as a game developer and publisher of the Android app for Google Play Developer account, you must pay around $100. But what if there's a tight budget, especially for indie game developers from the start? I want to know where can I find alternatives to publish and promote Android game apps with no registration cost. It is something like a stepping stone.

sentences:
What are the steps taken by this GLSL code? 1 void main(void)
 2 {
 3     vec2 pos = mod(gl_FragCoord.xy, vec2(50.0)) - vec2(25.0);
 4     float dist_squared = dot(pos, pos);
 5
 6     gl_FragColor = (dist_squared < 400.0)
 7         ? vec4(.90, .90, .90, 1.0)
 8         : vec4(.20, .20, .40, 1.0);
 9 }

  taken from
  http://people.freedesktop.org/~idr/OpenGL_tutorials/03-fragment-intro.html

Now, this looks really trivial and simple, but my problem is with the mod function.

This function is taking 2 vec2 as inputs but is supposed to take just 2 atomic arguments according to the official documentation, also this function makes an implicit use of the floor function that only accepts, again, 1 atomic argument.

Can someone explain this to me step by step and point out what I'm not getting here?

It's some kind of OpenGL trick? OpenGL Math trick? in the GLSL docs i always find and explicit reference to the type accepted by the function and vec2 it's not there.

sentences: How do I use graphics APIs to select the proper display device among multiple attached to a PC? I have an LCD monitor display and Oculus Rift attached to my PC. I have an Nvidia 820M dedicated GPU. How does the GPU know to which display device it has to render (or to send rendered information)? Are there any OpenGL/DirectX calls to bind display with the GPU?

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:
LWJGL: Camera distance from image plane? Let me paste some code before I ask the question...

public static void createWindow(int[] args) {

    try {

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

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

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

}

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

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

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

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

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

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

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

Thank you for your help.

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

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

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

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

How can I implement such a feature?

sentences:
How should I adjust starting sample position of audio track to match next buffer fill? I've written my own audio mixer. For Linux/Windows, my game uses SDL. On a small handful of Linux machines (including my laptop), SDL has a bug where it allocates a ridiculously large (about 120 milliseconds) audio buffer. While I'm not to the point that I care so much about affected machines, it points out a problem I'd like to solve.

The problem is that when an event occurs that triggers an audio track to be played, I've already written audio for a small portion of "the future." In other words, I can't really play something "now." If I wait until the next audio buffer fill and start playing this track at sample position 0, I will effectively create a small lag period before the track is heard. With the enormous buffer size mentioned above, this is very noticeable.

One approach I've come up with is to estimate how many audio samples the track would play between "now" and the next sample I can give to the audio buffer. However, this would be incorrect if the game were to be paused/resumed or even slowed down, and this introduces some added complexity to the mixing code.

Is there a standard way to solve this problem, and/or do you have any helpful ideas?

sentences:
Unit testing graphics What is the standard (if there is one) method which professional games developers use to unit test (or closest equivalent) graphics output?

I am developing with Corona SDK and I would like to test the visual output of my game code. I don't believe it is reasonable to pre-generate screenshots, scene definitions or some such for comparison at the end of a test, I would like to know if there is a good testing mechanism for graphics in general.

sentences:
PHP development for online games I am not pro on programming and games but i had developed an online browser-based game with php . Now i am creating a game like a chess that it do not needs an live-stream and FPS data exchanges.

I want to know is my knowledge about php and tcp protocol is enough to develop such a game ? or i need to develop on other language and do not use tcp protocol ( use UDP instead ) .

And one thing more ... Can i develop with php on a UDP protocol ? where can i get little information about udp and programming on it.

thank you very much :)

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:
Getting world space vertex coordinates in Unity I'd like to get world space coordinates for a specific mesh vertex. Transform.TransformPoint() seems to be what I need however I'm unable to get the correct position.

In the scene I have an object called "head" at Pos (0, 0, 0) Scale (0.03, 0.03, 0.03) and I'm trying to get the position of vertex id 590 in order to spawn another object at that specific location.

Mesh mesh = GameObject.Find ("head").GetComponent<MeshFilter>().mesh;
Vector3[] vertices = mesh.vertices;
Vector3 newPos = transform.TransformPoint (vertices [590]);
Debug.Log (newPos);

The value of newPos is not on the head object.

sentences:
How to calculate FPS and what factors affect FPS? In this case, FPS means Frames Per Second and that means the number of frames that graphic hardware render in one second. I'm wondering what kind of stuffs could affect FPS?

So, for some tests I created a simple scene in Unity with some cubes and capsules and then create a empty game object and then add this c# code to it:

public class FPSReport : MonoBehaviour {

    public double Fps;

    void Update ()
    {
        Fps = 1.0 / Time.deltaTime;
    }
}

I think it can tell me the FPS. When I played it it worked but it wasn't more than 30.

I was saw a lot of games that their fps was normally on 150. Is this fps rate ok?

If I add more objects, textures, animations , etc ... to my scene.

What happen to my fps?
Could it attain zero? and
If it attain zero, what is the meaning of a zero FPS (the hardware stopped working?!)?

sentences:
How to get the texture coordinate of a neighbouring pixel for a blur shader? I'm still having some trouble to get my head around fragment shaders and doing some image processing on textures. The context is a 2D sprite: a simple texture painted on a quad. All done with OpenGL ES 2.0.

My very basic goal is a simple blur filter using a 3x3 Kernel with average weights: every pixel used is weighed 1/9th and summed up.

Besides many ways to improve the performance of the fragment shader(code below) so far I'm still having some difficulties to find the right texture coordinate for the kernel.

My approach so far is to use the actual size of the quad on the screen on which the texture is painted and pass those two values to the shader. This is done outside the shader and passed as a uniform to the shader program.

glUniform2f(_offset, 1 / spriteWidth, 1 / spriteHeight);

This should result in the step in both directions to calculate a texture coordinate in the 0 to 1 space.

The result is kind of looking good. BUT I am still struggling if this is something that could be done within the shader. Is there a way to get the size of the texture within the fragment shader? If we would be only doing this on a bitmap, I'll just go from pixel to pixel and read the color of the surrounding pixels. I am wondering if my understanding of a fragment shader is quite right: It's run per rendered pixel on the screen. I found some examples for the GLSL to do this but I wasn't able to port it to OpenGL ES, so I had to start from scratch.

For the sake of readability I write a bit more code in hope it's easier to understand the fragment shader:

varying vec2 v_texCoord;
uniform vec2 u_offset;
uniform sampler2D u_texture;

const int size = 3;
const int KernelSize = size * size;

void main()
{
    int i, j;

    vec4 sum = vec4(0.0);
    vec4 intensityOfPixel;
    vec2 texCoordForKernel;

    for (i = 0; i < size; i++)
    {
        for (j = 0; j < size; j++)
        {
            texCoordForKernel = vec2(v_texCoord.x + (float(i) - 1.0) * u_offset.x,
                                     v_texCoord.y + (float(j) - 1.0) * u_offset.y);

            intensityOfPixel = texture2D(u_texture, texCoordForKernel);

            sum += intensityOfPixel * 1.0 / float(KernelSize);
        }
    }

    gl_FragColor = sum;
}

Thanks alot in advance!

sentences:
Simplified aerodynamics for 2d (top-down) airplane I am writing a top-down 2d game, in which the player can control an airplane via the WASD keys. The W key should move the plane upwards (north), the A key to the west, and so on.

Now I need a simplified aerodynamics model to control the flight direction and speed of the plane. Pressing W should accelearte the plane a bit to reach full speed, then while the player continues to press W the plane should continue to move upwards on the screen (remember, top-down view).

When the player releases the W key and presses the D key now, the plane should behave similar to the real world. That is, it must not immediately move to the right (east), instead it should continue to fly to the north, but gradually start to move to the east. Then if the player continues to press the D key, the plane eventually has to fly solely to the east. So all in all in this example the airplane has to fly a curve from north to east.

In general the plane must not change its direction immediately and directly when the player presses another key, but instead fly using a simplified inertia (?) model. This should of course also work correctly if the player presses two keys at the same time, for example W (north) and A (west).

How would I achive this general in a 2d top-down game?

sentences:
Developing an interactive book for Windows-Runtime My three year old loves playing with the interactive books on our iPad, and I love playing with code and I love my Surface RT...

So I thought I'd try and make a basic animated book using WinRT, I've spent some time reading about animations
(granted the book isn't WinRT based), and thought I'd try and use the Storyboard approach rather than rolling any kind
of bespoke animation framework.

That was until I saw the Faresee Physics Engine, and the Physics XAML Helper.

I've played around with some of the more basic examples, and it seems pretty good - very easy in-fact.

My issue is when I start thinking about stringing together animations that can react to input,
the Farsee and Physics XAML Helper blows my mind a little.

As a proof of concept I was thinking about getting a character to walk from a path (in the top right),
and while moving closer (getting larger) walk to the front at the center.

Then, based on some kind of decision, via an input, walk either back to the right, or up to the left.
Both are back into the distance (getting smaller) as if walking away.

The character should have basic humoid movement, athough slightly cartoon-like - swinging arms, moving head and legs.
Also, it would be nice to have the ability for the character model to swap images when it walks back up the path.

My question (finally!), is do you think that it's better to use the built in Storyboarding features of WinRT, with it's
animations - primarily using easing and descrete key frames to create each animation 'scene'. Or, use something like
Farsee and the Physics XAML Helper to create the scene using real word objects and physics?

Are there any examples, samples, tutorials etc of creating anything similar?

Thanks,
Kieron

sentences:
python for game development Possible Duplicate:
  Famous games written in Python

Is python any good for game development? Can I have some examples of great indie python games.

So I can have an idea what it's capable of?

I'm looking for games which are on a realistic scale for one person.

thanks.

sentences:
AndEngine Scoreloop - java.lang.IllegalStateException: you are not calling from the main thread context I am a very novice android developer but also created a game using andEngine successfully. Now I want to integrate Scoreloop and everything is fine with Leaderboard view and TOS view, except I am having hard time submitting scores from a game scene. I implemented OnScoreSubmitObserver in the main BaseGameActivity (GameActivity). I used the following line inside the onCreateEngineOptions method:

ScoreloopManagerSingleton.get().setOnScoreSubmitObserver(this);

I also declared the override method perfectly inside GameActivity as mentioned in the scoreloop tutorial:

@Override
public void onScoreSubmit(int status, Exception error) {
    // TODO Auto-generated method stub
    //Calls the ShowResultOverlayActivity. Make sure you have modified the
    //AndroidManifest.xml to reference this overlay class.
    startActivity(new Intent(this, ShowResultOverlayActivity.class));
}

Now I want to submit score from inside a scene using the following line:

ScoreloopManagerSingleton.get().onGamePlayEnded(score, null);

But this shows the following error:

java.lang.IllegalStateException: you are not calling from the main thread context

I also tried implementing OnScoreSubmitObserver on the scene class and tried calling each line mentioned above inside the scene class using "activity" instead of "this", as "activity" is an instance of the GameActivity. but it also shows the same error. Please help.

sentences:
Need some general direction for turn-based planning AI I'm planning to make a turn-based fleet battle game. While I think I can figure out most of the things I need, I have no idea about the AI handling this sort of game. I need some general direction about how should I deal with it.

None of the things I described below is currently done - except maybe unit movement stuffs.

The combat resembles Frozen Synapse or Steambirds, in which you and your opponent plan their unit's actions and then execute it to see how it resolves. Since the units are naval warships, their movement is restricted by current direction and speed, etc etc. They attack when you order them to do so(not automatic).

I think I can give scores to each move(like Chess AI), depending on its location, direction, possible movement area, known enemy positions and things like that. Then I can use Minimax algorithm to let the AI select the best move.

Now, I'm asking because I can't figure out

which situation should the score be based on. Should the AI make a plan assuming the enemies are all moving straight, predict the best enemy plan based on it, and then write the actual plan based on the prediction? Is it going to demand a lot of processing power? Or is there simpler way using Minimax?
Unlike grid-based tactical games, the area which a unit can move is a (semi-)continual area. If I try to give score to all possible positions, that might take too much processing power. Is there a way to handle this issue neatly?
There might be more efficient/effective alternatives to the Minimax on this particular game which I do not know.

So... i'm asking for general direction about how should I handle the AI. Details will be in when I actually make it.

sentences: Making (or emulating) a "D-Pad" on a touch-screen; virtual d-pad With the proliferation of touch based devices, many lacking a true D-Pad, I'm wondering if anyone has any resources on how to emulate a D-Pad on a touch screen? I'm specifically interested in XNA and/or Android code examples.

sentences:
Box2dWeb: setting velocity of bodies using events I would like to move a kinematic box by pressing the down arrow. As is noted by the console logs, the keydown actually does change the box's velocity... but for reasons beyond my grasp it still doesn't move.

Note that if you place the SetLinearVelocity() call in a spot where it runs immediately, the box will move, but if it is in a setTimeout, or as in my example, called from an event, the box stays frozen despite its y velocity property changing to 1.

I created the simplest example I could to show my problem.

Note: I am using the latest release of Box2dWeb

//std variables
     var   b2Vec2 = Box2D.Common.Math.b2Vec2
        ,   b2BodyDef = Box2D.Dynamics.b2BodyDef
        ,   b2Body = Box2D.Dynamics.b2Body
        ,   b2FixtureDef = Box2D.Dynamics.b2FixtureDef
        ,   b2Fixture = Box2D.Dynamics.b2Fixture
        ,   b2World = Box2D.Dynamics.b2World
        ,   b2PolygonShape = Box2D.Collision.Shapes.b2PolygonShape
        ,   b2DebugDraw = Box2D.Dynamics.b2DebugDraw;

//create world and gravity
     var world = new b2World(
           new b2Vec2(0, 10)
        ,  true
     );

//fixture defs
     var fixDef = new b2FixtureDef;
     fixDef.density = 1.0;
     fixDef.friction = 0.5;
     fixDef.restitution = .2;

//body defs
     var bodyDef = new b2BodyDef;
     fixDef.shape = new b2PolygonShape;
     fixDef.shape.SetAsBox(2,2);
     bodyDef.type = b2Body.b2_kinematicBody;
     bodyDef.position.x = 3;
     bodyDef.position.y = 0;

//body and fixture creation
     var body1 = world.CreateBody(bodyDef);
     body1.CreateFixture(fixDef);

//"Before" console log
     console.log("Claimed velocity before down is pressed: " + body1.GetLinearVelocity().y);

//Listener and keycode switch for intended velocity change
     window.addEventListener("keydown", onKeyDown, false);
     function onKeyDown(e) {
        switch(e.keyCode) {
            case 40://down
                body1.SetLinearVelocity(new b2Vec2(0,1));
                console.log("Claimed velocity after down is pressed: " + body1.GetLinearVelocity().y);
        }
     }

//debug drawing
     var debugDraw = new b2DebugDraw();
        debugDraw.SetSprite(document.getElementById("canvas").getContext("2d"));
        debugDraw.SetDrawScale(30.0);
        debugDraw.SetFillAlpha(0.5);
        debugDraw.SetLineThickness(1.0);
        debugDraw.SetFlags(b2DebugDraw.e_shapeBit | b2DebugDraw.e_jointBit);
        world.SetDebugDraw(debugDraw);

     window.setInterval(update, 1000 / 60);

//loop
     function update() {
        world.Step(1 / 60, 10, 10);
        world.DrawDebugData();
        world.ClearForces();
     }

sentences:
How can I create an array of GameObjects? I need to add one assest multiple times in my scene similar to the blender array tool and I was wondering what is the best way to do this because adding each asset individually and setting there locations doesn't seem like the best way to do it. I need to:

Create multiple sprites quickly
Be able to set the distance between the sprites
Set the number of sprites

How can I do this in the editor preferably without any plugins?

sentences:
How to make an object that has no rigidbody2d component smoothly fall on the ground in Unty2d? I have two character in my game: enemy and main character. Enemy can throw different objects into the main character. For this moment i am doing this action in such way:

void FixedUpdate(){
    if (CanMove){
        transform.position = Vector2.MoveTowards(transform.position, TargetPlayer.transform.position,  15 * Time.deltaTime);
    }
}

public void StartMove(bool canMove){
    CanMove = canMove;
    TargetPlayer = GameObject.FindGameObjectWithTag(Tag).transform;
    rigidbody2D.gravityScale = 0;
}

This script is attached to the prefab of the object that will be thrown into main character by the enemy. This script is working, but in this case the object that was thrown will follow  by main character all the time, because of this line of code:
transform.position = Vector2.MoveTowards(transform.position, TargetPlayer.transform.position,  15 * Time.deltaTime);

To my mind this is not good, because i want to give my player the opportunity to escape from the object that was thrown at him. For example run away. When the object reaches the player position (and the player is on the new position) - he will simply fall onto the ground. I did this, but this wasn't looking nice, because when the object was reaching his position, he was hanging in the air. Can anyone give me an advice how to make this process more good-looking?

Edit:
I need to make good-looking movement of the object, that was thrown by the enemy into main character. Every frame i am moving the instantiated object to the current player position. So the player can't escape from that object, because he always knows current player position. I think that this is not good idea, and i want to give to player an opportunity to run away from that object. In this case i am saving the position of the player into variable, and then every frame i am moving the instantiated object to that position. So when the player run away, the object, that was thrown doesn't know anything about new position of my player. But this is looking not good, because when the object is reaches its destination position he hangs in the air((

Edit # 2:
I was thinking about destroying that object anyway, but to my mind this will not look good: the object is moving and suddenly disappears from screen(. May there is some ways how to make him smoothly fall onto the ground? The problem is in that this instantiated object has no Rigidbody2d component attached to it, so it will never fall down by itself.

sentences:
Saving and loading large tilemaps As the title state, I have a large tilemap 400 x 400 x 26. Which currently just about fairs when using it. Saving takes a couple of seconds and it saves to a .ser file which is okay at the moment however when re-loading the map it takes a couple of minutes and is painful.

I'm wondering how I can improve my saving/loading and also if possible improve the way the maps are used eg: using a 2D array instead of a 3D array but still with the z-level.

sentences:
Java - Lemmings - How to detect mouse over lemming My first post on gamedev :) And my first go at game dev :D

To ease me in, I'm starting with a lemmings clone.

I have my lemmings moving about and already have a MouseAdapter for moving around the map with the mouse.

In order to detect when the mouse is over a lemming I thought the easiest way
would be to override the mouseMoved method. This would iterator over the lemmings and check if the mouse coords are in the lemmings rectangle. Is the normal way to do this?

I realised this wouldn't work for a lemming walking under/past the mouse cursor.

sentences:
How to use Left Shift to run Unity? So, I need to use LShift to run, but I can't exactly figure out how to do so....
I don't know what to use....
Here my code:
using UnityEngine;
using System.Collections;

// This script moves the character controller forward
// and sideways based on the arrow keys.
// It also jumps when pressing space.
// Make sure to attach a character controller to the same game object.
// It is recommended that you make only one call to Move or SimpleMove per frame.

public class Move : MonoBehaviour
{
    CharacterController characterController;

    public float speed = 6.0f;
    public float jumpSpeed = 8.0f;
    public float gravity = 20.0f;
    public Transform charBody;
    private Vector3 moveDirection = Vector3.zero;
    public float mouseSense = 11f;
    public float runSpeed = 12f;
    public bool isRunning = false;

    void Start()
    {
        characterController = GetComponent<CharacterController>();
    }

    void Update()
    {
        if (characterController.isGrounded)
        {
            // We are grounded, so recalculate
            // move direction directly from axes

            moveDirection = transform.forward * Input.GetAxis("Horizontal") + transform.right * Input.GetAxis("Vertical");
            moveDirection *= speed;
            moveDirection = transform.right * Input.GetAxis("Horizontal") + transform.right * Input.GetAxis("Vertical");
            moveDirection *= speed;

            if (Input.GetButton("Jump"))
            {
                moveDirection.y = jumpSpeed;
            }
        }

        // Apply gravity. Gravity is multiplied by deltaTime twice (once here, and once below
        // when the moveDirection is multiplied by deltaTime). This is because gravity should be applied
        // as an acceleration (ms^-2)
        moveDirection.y -= gravity * Time.deltaTime;

        // Move the controller
        characterController.Move(moveDirection * Time.deltaTime);

        float MOUSEY = Input.GetAxis("Mouse Y") * mouseSense * Time.deltaTime;
        float MOUSEX = Input.GetAxis("Mouse X") * mouseSense * Time.deltaTime;

        charBody.Rotate(Vector3.up * MOUSEX);

    }
}

So, when left shift is clicked I want the speed to change to runSpeed...
Can I please have some help doing so?
Thanks

sentences:
How do I prevent flickering when drawing to a JPanel? So I have a JFrame holding a JPanel, to which I'm drawing at about 60 FPS. I've been told that "Swing is double buffered by default", but, nevertheless I'm getting massive flickering. At first, I tried modifying the Graphics object from JPanel.getGraphics(), but was not surprised when it flickered (to black, the background colour of the game so far), as I assumed that it was redrawing when I blanked the screen. However, then I overrode paintComponent(), passing the Graphics to all objects to draw with, and made it call the super version, which I assumed would solve it, but no difference.

I'm still getting the Graphics object from the same place, i.e. JPanel.getGraphics(), because paintComponent() needs a Graphics argument. Should I be getting it from some other place? If not, what else could be causing the problem?

sentences:
Some questions about lists I've been looking for articles or tutorials on this and I can't seem to find any, so I thought I'd ask here. I've created a bullet class in my game that is added and removed through a list. If I'm going to make these bullets work the way I want them to I need to be able to do two things:

One, I need to check if the bullets are colliding with each other and then remove the two bullets that are colliding. I've tried doing it by updating the bullet list with a for statement and then checking for collision with another for statement, but that occasionally crashes the game.

Two, I need to be able to check how far away every other bullet in the list is from the current one.

So how can I go about doing this?

sentences:
WebGL wrong scaling of rectangle I'm working with this tutorial http://www.html5rocks.com/en/tutorials/webgl/webgl_transforms/

and my result is, that the rectangle moves in the direction of it's scaling values, and also scales at the same time. So if I scale (2.0, 1.0) it moves right and stretches, but I only want to strecht/scale it. This is my vertex shader, it is nearly the same as in the tutorial (declarations omitted):

void main(void) {
vec2 scaledPosition = a_position * u_scale;

vec2 rotatedPosition = vec2(
    scaledPosition.x * u_rotation.y + scaledPosition.y * u_rotation.x,
    scaledPosition.y * u_rotation.y - scaledPosition.x * u_rotation.x);

vec2 pos = rotatedPosition + u_translation;

vec2 zeroToOne = pos / u_resolution;
vec2 zeroToTwo = zeroToOne * 2.0;
vec2 clipSpace = zeroToTwo - 1.0;

v_texCoord = a_texCoord;

gl_Position = vec4(clipSpace, 0, 1);
}

What could be the mistake if it is not in the shader? Thanks in advance.

sentences:
Which 3D Engine for iPad development? I have built a couple of games on the iPad using core animation, but for my next project I would like to built a 3D game. I am not really comfortable with programming OpenGL directly and would also like the toolset that usually comes with a mature 3D engine project. I have used Ogre3D on the PC before and was very happy with that, but I wasn't sure if it had been ported to the iPad specifically and if there were better alternatives available.

What engines have used and can recommend? Specifically I am interested in:

Cost
Tool support
Data import functionality

sentences:
directional lightning I have managed to get a point light working, but I am facing problem with directional lightning.

    Fragment shader
 uniform vec4 lightColour ;
 uniform vec3 lightPos ;
 uniform float lightRadius ;

in Vertex {
vec3 colour ;
vec2 texCoord ;
vec3 normal ;
vec3 tangent ;
vec3 binormal ;
vec3 worldPos ;
} IN ;

  void main ( void ) {
  vec4 diffuse = texture ( diffuseTex , IN . texCoord );
  mat3 TBN = mat3 ( IN . tangent , IN . binormal , IN . normal );
  vec3 normal = normalize ( TBN * ( texture ( bumpTex , IN . texCoord ). rgb * 2.0 - 1.0));
  vec3 incident = normalize ( lightPos - IN . worldPos );
  float lambert = max (0.0 , dot ( incident , normal ));
  float dist = length ( lightPos - IN . worldPos );
  float atten = 1.0 - clamp ( dist / lightRadius , 0.0 , 1.0);
  vec3 viewDir = normalize ( cameraPos - IN . worldPos )
  vec3 halfDir = normalize ( incident + viewDir );

  vec3 viewDir = normalize ( cameraPos - IN . worldPos );
  vec3 halfDir = normalize ( incident + viewDir );
  float rFactor = max (0.0 , dot ( halfDir , normal ));
  float sFactor = pow ( rFactor , 33.0 );
  vec3 colour = ( diffuse . rgb * lightColour . rgb );
  colour += ( lightColour . rgb * sFactor ) * 0.33;
  gl_FragColor = vec4 ( colour * atten * lambert , diffuse . a );
  gl_FragColor . rgb += ( diffuse . rgb * lightColour . rgb ) * 0.1;

As far as I know, directional lightning do not have a radius or a position, just direction.
How should I calculate directional lightning?

sentences:
Lightmapper artifacts I really don't understand why this is creating these kinds of artifacts. I'm starting to think something is wrong with Unity.

There are clearly no overlapping faces on the Model. There is enough of a margin to remove all chances of bleed. Yes the lid is a seperate object but any UV's of the lid and it's box are not overlapping. Thix odd pixelation occurs no matter the quality. It happened all the time sofar here and there and it forced me to replace a few objects in older projects. No idea what causes it. Really sick and tired of this.

Edit:

when I rotate the crate by 90 degrees the artifacts appear on the adjacent side of the cube. From the perspective of the camera it would be the same side. So clearly it's not the UV's or anything.

Lightmap settings

Object Import settings

sentences:
How can I visually see changes made to a scene since the last git commit I'd like to see the changes made in a scene (.unity file) before I commit them to git.

I have looked into several GIT/Unity solutions but all of them are made for merging changes and not for showing a diff with last version.

The problem with scene files is that they use GUIDs that point to other assets and when I open a diff for a scene file I can't really make anything out of it.

For example:

Instead, I'd like to see something like this:

Is there anything existing that does this?

sentences:
When to Dispose Textures I recently realized Texture2D implements IDisposable, and now (while trying to track down a memory leak) wonder about where and when I should dipose this.

My current architecture is that I have a SpriteComponent instance which encapsulates and hides the Texture2D. Internally, when I switch screens (eg. MainMenuScreen => WorldMapScreen), I call Dispose on the current screen, which calls dispose on the entities, which calls dispose on the textures.

But this results in some wacked-out behaviour, like textures apprearing super zoomed in momentarily, or appearing black, or appearing as garbage image data.

So my question is really, when should I call Dispose on Texture2Ds?

(FYI, I also can switch to a screen, and then later switch back to it, which currently causes me to reload the sprites, and by proxy, the textures.)

sentences: OpenGL Transform Feedback output size I'm working on a particle system using transform feedback, and I would like to know if it is possible to render to anything other than floats, like halfs, using Transform Feedback (OpenGL 3.3)? It would save some bytes and possibly speed up the process a little bit.

sentences:
Where do I begin if I want to write a C++ 2d game? I am a C# web developer and I want to expand my skillset and have some fun while doing it. I know some of the basics of C++ and I would love to write a simple 2d game/game engine for myself using C++. What other libraries or SDKs do I need and where would I find some tutorials and informational resources to move forward?

I've already looked into XNA with C#. There are a lot of resources for that but I would rather use non Microsoft products. The point of this is to have a little fun while becoming a better rounded programmer.

Please note that I'm not asking for the best place to start. I'm just asking for a place to start.

Thanks for any help!

sentences:
My game's title is similar to other game's title. Will I get sued? I have a game called 'Shapes Dodge' which is still in development. I figured out the name back in February when I began developing it. Since then I've been checking monthly the Google Play Store for games with similar titles and today I saw my worst nightmare coming true - there are a few games with a similar name:
https://play.google.com/store/search?q=shapes%20dodge&c=apps

I am worried about the first two games which both have the name 'Shape Dodge'.
So will I get sued if I publish my game with the name 'Shapes Dodge' ('shapes' with 'S' at its end) on the Google Play Store?

I want to emphasize that the content of my game is very different from these games' (different controlls, gameplay, graphics, music, etc), only the title is similar.

Please answer me as simple as possible because I am not very familiar with legislation, laws, copyright, trademark and so on.
Thank you! :)

Edit

So after serios consideration and brainstorming I figured out a new name for my app: 'Dodgy Shapes'. Obvously the amount of similarity with the other apps which contain these keywords (https://play.google.com/store/searchq=shapes%20dodge&c=apps) is much less. But do you think it is enough difference so that I won't have any problems in the future?

Again, thanks to all who responded. :)

sentences: How to adjust texture on a sphere? As seen, the texture is not adjusted to the sphere. I tried to change alignment, but it still displays multiple sides. How can I fix this?

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:
Movement doesn't look smooth (slight lag) Currently I'm using a variable time step and when the FPS drops by even a small amount you can easily notice a slight lurch forward of the player. I'm making a platformer and I'm wondering whether I should use a fixed timestep instead, however I'm confused as to why my movement doesn't look smooth, because the various articles I've read all say that a variable timestep is meant to make movement look much smoother.

So my question: Is a fixed timestep the better option for a 2D platformer, and why would anyone even use a variable timestep if your sprite appears to jump forward every 2-3 seconds?

private static final int UPDATE_RATE = 90;
private static final long UPDATE_PERIOD = 1000000000L / UPDATE_RATE;

private void mainLoop() {
    long beginTime, timeTaken, timeLeft;
    while (state == State.PLAYING) {
        beginTime = System.nanoTime();

        update();
        repaint();

        timeTaken = System.nanoTime() - beginTime;
        timeLeft = (UPDATE_PERIOD - timeTaken) / 1000000L;
        if (timeLeft < 10)
            timeLeft = 10;
        try {
            Thread.sleep(timeLeft);
        } catch (InterruptedException ex) { }
    }
}

Delta time is calculated every time repaint is called.

long currentTime = System.nanoTime();
        deltaTime = (currentTime - previousTick) / 1000000L;
        previousTick = currentTime;

This is how I pass the delta time into the player class.

public void move(float deltaTime) {
    if(left && !right)
        xPos -= 250*(deltaTime/1000);
    if(right && !left)
        xPos += 250*(deltaTime/1000);
}

sentences:
What data structure to use to implement ocean currents and trade-winds I'm creating an RPG/simulation game which is similar to the Uncharted Waters Series. The game allows the player to control a fleet to explore and navigate the world on the world map. My Game stores the world map as a tiled map into a 2158 * 1080 2D array.

The problem I'm facing is I want to simulate the ocean currents and trade winds on the world map so when the player is sailing on the map, the speed of the fleet will be affected by the current and the wind. It does not have to be a really accurate simulation because this is not a high-detailed simulation game but it should resonably simulate the ocean currents and the wind.

Requirements:

Need to come up with a data structre to represent the ocean currents
For each point (x,y) on the map, the data structure should provide a fast way to look up what is the strengh and direction of the current at that particular point
The current can have 8 directions (N W S E NW NE SW SE).
The strengh of the current is represented as an Int
Same requirements for trade wind so I think the solution should be the same

My thoughts:

I'm thinking about dividing the world into several regions and each region can be subdivided into smaller regions like a quad tree. For look up I can do a contains(x,y) and find out which region the point is in and then for sub-regions to the same thing until it arrives a leave of the tree which stores the strengh and direction of the current.

Is that a reasonable solution or there are better ways to do this? What are the gotchas for implementing it?

Thank you for you answers!

sentences:
How do I construct the planes for my camera's frustum? I'm trying to get a handle on frustum culling, but I'm not quite there yet.

I have a camera in three-dimensional space

Camera
    position (cx, cy, cz)
    rotation (tx, ty, tz)
    fieldofview
    near-plane
    far-plane

and a quadtree containing my chunks of terrain

Quadtree
    Chunk
        bottomleft (x, y)
        width
        length
        heightmap

Currently, I am rendering every chunk within the quadtree. However, I would like to cull all chunks outside the six planes of the camera's frustum.

I am unsure how to:

Generate these planes given the information in the camera class.
Efficiently test for intersection using my quadtree. If one region of the quadtree fails, do all of its children (that seems reasonable, I just want to make sure)? What is the process for running through a quadtree for culling?
Perform the intersection test using the planes and my terrain chunks. How do I quickly tell if a piece of terrain (square with varying y values) lies within the 6 camera planes?

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

I want articles/books that would answer something like:

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

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

sentences:
Random environment runtime generation in Unity I need a tip for a project: basically I need to randomly generate an environment (a map) for a game.
As generating a full map completely procedural is impossible for me, I thought to create a static map (I made one ice based, one rock based, one desert based etc) with some static elements in it like a "spawn area", a map border.

Next, I made some "piece of map" smaller that the actual size of the border (like the border is 1000x1000 and this piece are max 200x200). Each piece has the same style of the border (e.g. I made few icy pieces with a spawn of polar bear and few desert pieces with a spawn of scorpions).

Now I'm stuck; I can't randomly spawn all the little squares inside a border & I can't randomly spawn them inside and make them match one with an other. Incidentally, this is a 3D project.

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:
UNITY Prevent 3D Text Render Trough All Object Without Shader im tired of those answer i found trough search engine that just keep saying " the trick is to modify the shader " without thinking because they want to gain reputation , in my case , i have 2 3D text , one of them using special font and the other  one using default font , and the shader to prevent the text render trough all object from http://wiki.unity3d.com/index.php?title=3DText is not working and giving weird white square plus i don't want to change from default Arial font because i want to make them look different , i also cannot use sprite as background because i need to change their color trough script to give some effect , this is my picture showing my problem -- :

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

The menu dropped is at Z = 100 while the background is at Z = 20 , as you see , the text is rendered while the other not ( such as the border , ect ).

And this is the picture when my special font without using the shader

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

Now the picture of my special font using the shader

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

Is there any possible way to prevent the text rendered without shader / change the background to sprite  ?

Im sorry if this already asked somewhere , i just cannot find it at search engine ( neither here ) .

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:
Designing Character Movement Need Advice (This game is written in C++ with GDI+ It's a simple side-scroller.)

I am having a problem deciding on how I should handle player movement. Currently it runs at 20 frames per second (I just chose that number, it could no doubt run at higher fps.)

Now I have one function that moves the character 1 pixel. It checks collisions with anything around.

There is two ways I can do this (because moving 20px/ second is too slow.)

I can use a for loop and then I can move any amount of space per frame. One minor problem is that the player will be moving several pixels between screen updates, so the player moves 5px (or any amount) increments every second.
I can turn up the fps, and then, consistently move the character 1px per frame, and it would be smooth movement.

I am having trouble deciding which way of doing this is better and need a bit of input, ideas, advice, etc...

Thanks.

sentences:
Ways to define a curve I'm trying to give shapes in my physics engine roundness/ curvature.

I am aware of various methods for mathematically defining curves; such as bezier-cruves, ellipses, etc. However I am not sure which methods would be most appropriate for use in my physics engine, because speed, feasibility of construction, and flexibility of each method must be considered. I want a system in which a user can easily form fairly complex curves, but still make the intersection calculations simple and fast.

My physics engine is also purely continuous, which means I must be able to calculate the time in which curves will collide with other curves and lines based on a constant linear/angular velocity.

What techniques are there for mathematically defining a 2D curve?
What are the advantages/disatvantages of each in terms of speed, flexibility, and  simplicity of construction?
Is the technique feasible for an engine where predictability of shape intersection is crucial?

sentences:
Changing State in PlayerControler from PlayerInput In my player input I wanna change the the "State" of my player controller
but I have some trouble to do it

my player input is declared like that :

class ResistancePlayerInput extends PlayerInput within ResistancePlayerController
    config(ResistancePlayerInput);

and in my playerControler I have that :

class ResistancePlayerController extends GamePlayerController;

var name PreviousState;

DefaultProperties
{
    CameraClass = class 'ResistanceCamera' //Telling the player controller to use your custom camera script
    InputClass = class'ResistanceGame.ResistancePlayerInput'
    DefaultFOV = 90.f //Telling the player controller what the default field of view (FOV) should be
}

simulated event PostBeginPlay()
{
    Super.PostBeginPlay();
}

auto state Walking {
    event BeginState(name PreviousStateName) {
        Pawn.GroundSpeed = 200;
        `log("Player Walking");
    }
}

state Running extends Walking {
    event BeginState(name PreviousStateName) {
        Pawn.GroundSpeed = 350;
        `log("Player Running");
    }
}

state Sprinting extends Walking {
    event BeginState(name PreviousStateName) {
        Pawn.GroundSpeed = 800;
        `log("Player Sprinting");
    }
}

I have tried to use

PCOwner.GotoState(); and  ResistancePlayerController(PCOwner).GotoState(); but won't work.

I have also tried a simple GotoState, and nothing happen

how can I call GotoState for the PC Class from my player input ?

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:
ECS: AI components and systems I'm trying to find the best design pattern for my AI code using an ECS.

Right now the entities that act as CPU-controlled have components like:

WeaponComponent
ChargeComponent
MovementComponent
AIControlledComponent

...

I have an AIControlSystem that goes over the entities that have the AIControlledComponent and during each frame switches the mental state of the entity based on some rules like "can I see the player?", "can I move somewhere safe?", etc...

Based on the mental state, this systems adds a set of actions to a queue.

Then the queue is being consumed and evaluated. An action like "Attack" is actually calling a method of the system that checks whether the entity has a WeaponComponent attached and fires, or if there's a ChargeComponent it charges at the player. This way, those methods tend to grow as the kind of enemies and actions grow and the code starts to become a mess as there are way too many checks and paths to follow.

I thought I could refactor the code splitting it up based on the kind of enemy (aka an enemy that has a Weapon won't be able to Charge and vice versa) but then I'd have to have a base AIControlSystem and inherit from that and specialize it based on the components attached to the entities. This would result in pretty much one new system per enemy kind and it doesn't really look like a good solution.

I thought about diverging from the pure ECS pattern of keeping components as data containers only and actually implement those methods in the components themselves so that I can have a base AIControlledComponent with the virtual methods that interpret the queue of actions and inherit a new component from that one for each enemy type. It looks a bit better for code organization but I'm not sure that making this kind of exception is a good idea.

Is there any other way to keep the code under control and at the same time have the flexibility needed?

sentences:
Basic 3D Collision detection in XNA 4.0 I have a problem with detecting collision between 2 models using BoundingSpheres in XNA 4.0. The code I'm using i very simple:

private bool IsCollision(Model model1, Matrix world1, Model model2, Matrix world2)
{
for (int meshIndex1 = 0; meshIndex1 < model1.Meshes.Count; meshIndex1++)
{
    BoundingSphere sphere1 = model1.Meshes[meshIndex1].BoundingSphere;
    sphere1 = sphere1.Transform(world1);

    for (int meshIndex2 = 0; meshIndex2 < model2.Meshes.Count; meshIndex2++)
    {
        BoundingSphere sphere2 = model2.Meshes[meshIndex2].BoundingSphere;
        sphere2 = sphere2.Transform(world2);

        if (sphere1.Intersects(sphere2))
            return true;
    }
}
return false;

}

The problem I'm getting is that when I call this method from the Update method, the program behaves as if this method always returns true value (which of course is not correct). The code for calling is very simple (although this is only the test code):

 if (IsCollision(model1, worldModel1, model2, worldModel2))
                {
                    Window.Title = "Intersects";
                }

What is causing this?

The way Im drawing the scene is to load the number of elements and their coordinates from a file like this (it is called from Update method):

OpenFileDialog Otvaranje = new OpenFileDialog();
        if (ks.IsKeyDown(Microsoft.Xna.Framework.Input.Keys.L))
            {
                this.GraphicsDevice.Clear(Color.CornflowerBlue);
                Otvaranje.ShowDialog();
                try
                {
                    using (StreamReader sr = new StreamReader(Otvaranje.FileName))
                    {
                        String linija;
                        while ((linija = sr.ReadLine()) != null)
                        {
                            red = linija.Split(',');
                            model = red[0];
                            x = red[1];
                            y = red[2];
                            z = red[3];
                            elementi.Add(Convert.ToInt32(model));
                            podatci.Add(new Vector3(Convert.ToSingle(x), Convert.ToSingle(y), Convert.ToSinglez)));
                            sfere.Add(new BoundingSphere(new Vector3(Convert.ToSingle(x), Convert.ToSingle(y), Convert.ToSingle(z)), 1f));

                        }
                    }

And then in the Update() method I had the following code (this was my first attempt):

if(sfere.Count != 0){
for(int i = 1; i<sfere.Count; i++)
{
 if(sfere[0].Intersects(sfere[i])) Window.Title = "Intersects";
}
}

This code never returned that collision is true because the bounding boxes are moving when the box moves, and I don't know why. The code that moves the box is this:

if (Microsoft.Xna.Framework.Input.ButtonState.Pressed == Mouse.GetState().LeftButton)
                {
                    worldKutija = Matrix.CreateTranslation(new Vector3(0.01f, 0f, 0f)) * worldKutija;
                }

So if the model is set to be the box it is drawn into the worldKutija, and all other models are drawn into world matrix so they would not move with the box model. So why are their BoundingSpheres moving? After this started happening I tried the code I posted in the original question, and got the problems I was talking about

sentences:
Swapping out Vertex Buffer Necessary for Terrain LOD? I am using Directx 11 to try and implement terrain level-of-detail.

I am trying the idea represented in this tutorial:
http://www.rastertek.com/tertut18.html

Which is split your terrain into nodes, and render different quality nodes depending on how far away they are from you.

Each of my nodes has its own vertex buffer (bad idea?), however I am trying to map/unmap when I swap out a particular node for its higher quality version.  I noticed that unless my vertex buffer is the size of the high quality version, then surrounding nodes gets affected, I believe this is to be expected since I am essentially overwriting memory in the vertex buffers of the other nodes.  So is the only way to go about map/umap is to make each node have the space for the high quality terrain?

If so, then I can't do map/unmap because I run out of memory.  What's another approach then?  Making a new vertex buffer with the desired size whenever I swap?  Won't this be too slow?

sentences:
Would a Python game run on multiple platforms? I have plans to write a game in Python and probably some SQL.
I'm concerned about how versatile my program will be when I finish it, ideally I'd like it to run on Windows, Mac, Android, and iPhone... however I have a feeling the phones would be off-limits for this sort of thing.
How would I go about writing a program that runs on multiple platforms?
Is this even feasible for a beginner programmer?

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:
Can I load a SpriteFont without a content project? I'm developing a game in XNA, however, I do not want to use a content project. I'm loading all my textures through different means, and I'd also like to load my fonts without a content project.

Is there any quick way to maybe include the SpriteFont in the main game project?

sentences:
Make gameObject “stick” to another gameObject after it has collided with it? Currently, I am using the following code to make objects stick to other gameObjects.

rb = GetComponent<Rigidbody>();
rb.isKinematic = true;
gameObject.transform.SetParent (col.gameObject.transform);

It works perfectly, but it causes many other problems... For example, after colliding, it can no longer detect collisions... Is there an alternative to this code (which makes a gameObject stick to another one after collision)?

sentences:
VS Code is no more suggesting Pygame methods for me I've been using Pygame a lot. And I'm cuurently coding in VS Code. Last week, I have installed JAVA and started learning it's basics. However, from the moment I installed the JDK, VS Code have changed (the theme, the code suggestions...) . So when I got back to Python and Pygame, I noticed that VS Code is not suggesting the methods and functions for me when I start typing. I also noticed that this issue is happening mostly with Pygame as everything is working properly with the standard Python library.
So what can I do ?
Btw, what are these suggestions called (I think they have a specific name) ?

sentences: How can I obtain a triangle ID during rasterization? I want to know the triangle ID of each rendered pixel is coming from. Is there a way to do this in OpenGL?

sentences:
How to handle data for a competitive multiplayer games I am kinda new to Multiplayer Games and I am really wondering how I should handle my data

Should each player send and update their data to the database (server) everytime one of their essential variables changes (like health or ingame currencies), or should they save the data as long as the game is running and then update the data all at once at the end of, lets say, each round?

I was thinking about using Firebase and Unity and here's a scenario:

Let's say 2 players connect to a game. Then one of them gets damage and the other one gets gold. Does the data change get sent to the FireBase Database immediatly or should I just update everything when the round ends/they disconnect?

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: Calculate Jump Limits My question is in a similar vein to this question, I am creating a pre-mapped pathfinding solution much akin to how Ash Blue was for my 2D platformer-style game (in XNA). As part of the process, I have to be able to 'neighbor' nodes in the pathfinding algorithm. To be able to do this, I need a procedural manner to precalculate the maximum capabilities of motion from a given game object at a given location. I am having a difficult time with one specific aspect of this: I cannot, for the life of me, figure out how to test whether or not a game object will be able to successfully jump to a given platform from where they are standing. I know there's a way to express this in some manner of equation, but I cannot find what the proper equation would be, it's probably in the vein of projectile physics, but the answer eludes me. If anybody can shed some insight into the matter, I would be very grateful.

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:
How can I get a list of player IDs on the server without starting the game? Sorry for my English.
When I launch the ARK Survival Evolved game and connect to the server, I can receive player IDs and track changes if someone comes in or out.
Below is the code that gives me this information.

#include <windows.h>
#include <iostream>
#include "include\steam\steam_api.h"
#pragma comment(lib, "steam_api.lib")
using namespace std;

int main(int argc, char* argv[])
{
    if(!SteamAPI_Init()) {
        return 0;
    } cout << "\n";

    while(true) {
        int friendCount = SteamFriends()->GetFriendCount(0x10);
        cout << "friendCount: " << friendCount << "\n";
        for (int i = 0; i < friendCount; ++i) {
            CSteamID playerID = SteamFriends()->GetFriendByIndex(i, 0x10);
            long long steamID64 = playerID.ConvertToUint64();
            //...
        }
        //...
        Sleep(500);
    }
    return 0;
}

Function

SteamFriends()->GetFriendCount(0x10)

returns the number of players that are displayed in the overlay in the "current game".

If I terminate the game through the task manager, the connection will continue and I will continue to receive the IDs and track the changes! Therefore, the presence of a running game is optional.

How can I get a list of player IDs on the server without starting the game? I know the IP and port.

Function

SteamUser()->TerminateGameConnection(1438555551, 7783);

breaks connection with overlay (friendCount == 0). However, the inverse function

SteamUser()->InitiateGameConnection(pAuthBlob, cbMaxAuthBlob, k_steamIDNonSteamGS, 1438555551, 7783, true);

does not connect back (perhaps the third argument is incorrect).

Any ideas?

sentences:
How to balance hybrid classes? In RPGs sometimes there will be hybrid-classed characters, ie, characters that can fill the roles of multiple characters. Sometimes they're really weak and useless because despite filling out many roles they're just not good enough to do it, and othertimes they're extremely overpowered because they can do the job of characters with a single dedicated role just as well, while still being able to do other jobs.

This often leads to either using those characters all the time, or avoiding using those characters because they're dead weight. Even just "fine tuning the numbers" doesn't seem to work because the weaker they get in regards to a dedicated role character the less useful they are overall, and then when buffing their numbers to make them more capable of holding their own makes a small reduction in power compared to a dedicated role character a minor tradeoff, because they're doing the roles of two characters in one spot.

Is there a way to actually make hybrid-role characters useful while still making players want to carry single-role characters too?

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:
Torus World Collision Dection I am looking for a collision detection solution for use when 2d screen wrapping.  Specifically, when the image is split between the right and left side I can only detect a collision for a limited area.

For example, the program detects the collision when the rectangle intersects the circle in the first image.  However, it doesn't in the second image.  I am using the Rectangle.Instersects method to check for the collision in both cases.

I used the screen-wrapping solution at the following link:
How to create a 2D region where sprites are automatically wrapped?

However, since I am not using the physics engine, I am not using the related solution at:
How to create a very specific kind of joint in Farseer?

I am aware of the following question:
https://stackoverflow.com/questions/8679304/wrapping-drawn-image-in-xna-4-0, and incorporated part of the code to reset the draw rectangle's position when wrapping for both sprites:

 // reset draw rectangle for wrapping
        if (drawRectangle.X < -sprite.Width)
        {
            drawRectangle.X += parentWindowWidth;
        }
        if (drawRectangle.X > parentWindowWidth)
        {
            drawRectangle.X -= parentWindowWidth;
        }
        if (drawRectangle.Y < -sprite.Height)
        {
            drawRectangle.Y += parentWindowHeight;
        }
        if (drawRectangle.Y > parentWindowHeight)
        {
            drawRectangle.Y -= parentWindowHeight;
        }

This post also says that I have to check for the collision in the two separate positions, but I am having trouble doing so.

Any suggestions?

sentences:
Unity - export package - but on import, scene and folder structure are different (screenshots) I export a package and shows me all the files I am exporting.

When I go to import this package, one of the files is renamed and placed in a folder that no longer exists.

Can anyone explain what is happening here and how I can fix it?

Here is the image of me exporting, including the assets folder in the screenshot.

Then I start a new project, and I try to import that package. But a filename has changed itself, and there is a folder there that I did not export, I actually purposely deleted it and it exported anyway:

sentences:
Passing through edges of AABB collision When I move, I grab the tile in front of the player, but when the player is colliding between two tiles, I grab the wrong tile due to rounding error. I made a video explaining what I mean.

As you can see, when the player is moving down on the edge of a tile, they pass through. This is how I find the tile:

Tile t = world.tiles[(int) ((int) getX() / 32 + x)][(int) ((int) getY() / 32 + y)];`

This is my collision detection code:public static boolean isColliding(AABB a, AABB b) {
        if (Math.abs(a.pos.getX() - b.pos.getX()) < a.size + b.size) {
            if (Math.abs(a.pos.getY() - b.pos.getY()) < a.size + b.size) {
                return true;
            }
        }
        return false;
    }
The pos variable in the AABB class is the center of the entity and the size is half the size of the player.

How can I fix this so it finds the correct tile?

Edit:
Ok, I changed my move method to get the tiles around the player, but now the player only collides if he is colliding in the middle of four solid tiles! I don't understand!

private void move(int x, int y, float sx, float sy) {
    Vector2f tempPos = new Vector2f((pos.getX() + (pos.getX() + 32)) / 2, (pos.getY() + (pos.getY() + 32)) / 2);
    box.update(new Vector2f(tempPos.getX() + sx, tempPos.getY() + sy), 16);
    if (getX() / 32 + x > 0 && getX() / 32 + x < world.mx && getY() / 32 + y > 0 && getY() / 32 + y < world.my) {

        for (int xx = 0; xx <= 1; xx++) {
            for (int yy = 0; yy <= 1; yy++) {
                if (world.getTile((int) (getX() / 32) + xx, (int) (getY() / 32) + yy) != null) {
                    Tile t = world.getTile((int) (getX() / 32) + xx, (int) (getY() / 32) + yy);
                    t.color = true;
                    if (t.type != 0 && !Collision.isColliding(box, t.getBox())) {
                        setPos(getX() + sx, getY() + sy);
                    } else if (t.type == 0) {
                        setPos(getX() + sx, getY() + sy);
                    }
                } else {
                    setPos(getX() + sx, getY() + sy);
                }
            }
        }

    } else {
        setPos(getX() + sx, getY() + sy);
    }
    glPushMatrix();
    glTranslatef(getX(), getY(), 0);
    glPopMatrix();
}

The type in Tile is just for checking to see if the tile is air. As you can see, I have two for loops that loop through the four tiles above, below and to the right and left of the player, and see if he collides with any of them. I have no idea why this isn't working, and I've tried to figure out how to do this for a week now. Can anyone show me a link or code to get the tiles around a player and see if he collides with them?

sentences:
How to stop camera from rotating in 2.5d platformer I'm stuck with a problem: I can not make my camera stop rotating after character.

What I already have tried: using empty game object with rigid body and locked rotation and make it parent of camera, while player being the parent of object.
Also, I've tried using few scripts from web, that did not help.

Right now I'm bad with using JS in Unity (can handle JS on website, but I dont know how to integrate it for now) and practicing the basics, making easy 2.5d platformer with basic features, so I can not write code for now.

sentences:
Applying friction force not working correctly I have a simple physics simulation I'm creating whilst following the Nature of Code tutorials on YouTube by Daniel Shiffman, at the moment I've just started learning about friction and have had a go at implementing in it my project.

But for some reason, applying friction doesn't work when placed directly in the update method. To elaborate, when I apply friction by holding down the space bar rather than just doing it every frame, the friction works as instead.

Another thing to note is that when I apply friction directly in the update method, the objects don't appear on the screen.

Below is the loop I have that iterates through all the rigid bodies in the scene:

        foreach (var body in this.bodies)
        {
            Vector2 wind = new Vector2(0.01f, 0.0f);;
            Vector2 gravity = new Vector2(0.0f, 0.1f * body.Mass);

            // Setup friction
            float c = 0.05f;
            var friction = body.Velocity;
            friction *= -1;
            friction.Normalize();
            friction *= c;

            if (Keyboard.GetState().IsKeyDown(Keys.Space))
            {
                // If I move this call to where I'm applying
                // all the other forces, the objects dissappear.

                // But if I apply force by pressing the space bar
                // the force is applied correctly.

                // Apply friction
                body.ApplyForce(friction);
            }

            // If I apply friction out here, it doesn't work
            // also, friction when printed to the screen is
            // NaN.

            // Apply wind and gravity
            body.ApplyForce(wind);
            body.ApplyForce(gravity);

            body.Update();
        }

and also, here is the source code that I'm following along with (essentially copying) in the video tutorials here

I feel as though I've supplied enough information, but if you need to know anything else please don't hesitate to do ask.

sentences:
How to scroll background image-Android App Basically, I have a main menu, and I would like the background image to scroll (parallax I believe is the term?  Like the Angry Bird's title screen background).

However, I'm used to just having a variable iterate (x++) and setting that as the x value so the image scrolls.

So is there any way to confer variables and such between xml and my java files so I can use iteration?  Or can I skirt this completely somehow?

sentences:
Sharing a texture resource from DX11 to DX9 to WPF, need to wait for DeviceContext.Flush() to finish I'm following these instructions on TheCodeProject for rendering from DirectX to WPF using D3DImage.

The trouble is that now that I have no swap chain to call Present() on -- which according to the article shouldn't be a problem, but it definitely wasn't copying my back buffer.

An additional step that I have to take before I can copy the texture to WPF is to share it with a second D3D9Ex device, since D3DImage only works with DX9 (which is understandable, as WPF is built on DX9). To that end, I've modified some SlimDX code to work with DirectX 11.

I tried calling DeviceContext.Flush() (the Immediate one) at the end of each render cycle, which kind of works -- most of the time it'll show my renderings, but maybe for maybe 3 or 4 out of 60 frames each second, it'll draw my clear color instead. This makes sense -- Flush() is non-blocking; it doesn't wait for the GPU to do its thing the way SwapChain.Present does.

Any idea what the proper solution is?

I have a feeling it has something to do with my texture parameters for the back buffer, but I don't know.

sentences:
It lags when it collides. Help? :( I am trying (and believing) to make a game of pong. I have got a slightly decent working game. I haven't implemented the scoreboard or AI yet because I want the physics to work first. I am trying to reverse the direction of the ball when it hits either paddle just to make it work cleanly and am having the issue where it changes direction twice, it bounces off the paddle as expected and then goes in the opposite direction to when it hit the paddle -.- If anyone could help me, it would be much appreciated.

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

    public class BallController : MonoBehaviour {

        private float randomNumber;
        private float range;
        private float pointOfContact;
        private float paddleTop;
        private float paddleBottom;
        private float[] limits;
        private int speed;
        private int caseNumber;
        private Vector2 direction;
        private Rigidbody2D ballRigidbody;

        void Start () {
            //Getcomponent finds the rigidbody of the attached object.
            ballRigidbody = GetComponent<Rigidbody2D> ();

            speed = 5;
            caseNumber = Random.Range (0, 2);
            range = PickARange (caseNumber);
            ballDirection (speed, range);
        }

        void FixedUpdate() {

        }

        void OnCollisionEnter2D (Collision2D coll) {
            if (coll.gameObject.tag == "Player" || coll.gameObject.tag == "Computer") {
    //          pointOfContact = ballRigidbody.position.y;
    //          print (pointOfContact);

                ballRigidbody.velocity = new Vector2 (ballRigidbody.velocity.x, ballRigidbody.velocity.y * -1);
            }
        }

        void ballDirection (int ballSpeed, float yDirection) {
            randomNumber = (Random.Range (0, 100));

            if (randomNumber < 49) {
                direction = new Vector2(Random.Range (-1.0f, -0.5f), yDirection);
                ballRigidbody.velocity = (direction * ballSpeed);
            } else {
                direction = new Vector2(Random.Range (0.5f, 1.0f), yDirection);
                ballRigidbody.velocity = (direction * ballSpeed);
            }
        }

        float PickARange (int number) {
            switch (number) {
            case(0):
                range = Random.Range (0.5f, 1.0f);
                return range;
            case(1):
                range = Random.Range (-1.0f, -0.5f);
                return range;
            default:
                range = 1.0f;
                return range;
            }
        }
    }

I thought to multiply the whole velocity by -1 but that just caused a loop because of the lag. Even though that's the right way to reverse the direction. I think.

Thanks Peeps!

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:
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:
Is correct to calculate values in percentage, using the total number of iterations? Trying to clarify the problem.

Imagine a factory that produce soccer balls; if you produce 1 ball, it will take a certain amount of game cycles. For sake of simplicity, let's say it could take between 5 and 15 cycles (depending from various conditions, like number of workers, quality of workers and so on). Once you make a certain amount of soccer balls, the process is considered done.

Now, I want to display a value in percentage for costs, and a value of defective balls made. with "cost", I am trying to display how much did I spent (materials, workers wage and so on), at the moment. The number in currency is self esplicative, but I believe a percentage value could help to know if you are using too many workers, or burning too many resources, resulting in a waste of money.

To calculate the percentage of defective is relatively simple, since every X amount of time, when I refresh, I can check the balls produced against the defective ones, and the result should be

Total produced * 100 / defective = percentage of defective.

But for the costs, things are different; so I was planning to use the number of cycles to calculate percentage for costs:

cycles * 100 / current costs = percentage of costs

Would this be considered correct? Since the number of cycles for a whole batch of balls may vary slightly, this may represent that when there are less cycles, it means that you spent less money, henche the percentage will be smaller.

sentences: How to create a material with variable color I'm new to Unity and trying to create a Carrom game. Since all the White and Black pieces, Queen basically have the same material and physical properties and texture except for their color, I'm trying to create a single material that I could assign to all 3 types of objects but could then set the material color per object type. Can this be achieved in Unity (I'm using 5.3.2)?

sentences: Price for Unity on Android and iPhone? I was looking at the Unity site, and I was a bit confused with the pricing. It says it's free, but for iOS/iOS Pro or Android/Android Pro. I need to shell out $400 minimum each.  So if I want to develop with Unity for Android and iPhone, I need $800 to do this? (not saying that it's a lot of money, actually seems reasonable, just wondering)

sentences:
Tiled tilemapper - isometric I'm attempting to move from oblique mapping (45 degree angles) to isometric (30 degree angles) in Tiled.

I made a test tile in Photoshop:

Made an isometric map:

But my tile appears completely distorted, and the 'isometric' map just appears as a top-down grid rotated 45 degrees:

How do I create a proper isometric scene using tiled?

Hi, in your example (here), your Tiled grid is angled down. As you can see, mine appears Top down. How do I configure this?

sentences:
Costs/profit of/when starting an indie company In short, I want to start a game company. I do not have much coding experience (just basic understanding and ability to write basic programs), any graphics design experience, any audio mixing experience, or whatever else technical. However, I do have a lot of ideas, great analytical skills and a very logical approach to life. I do not have any friends who are even remotely technical (or creative in regards to games for that matter).

So now that we've cleared that up, my question is this: how much, minimally, would it cost me to start such a company? I know that a game could be developed in under half a year, which means it would have to operate for half a year prior, and that's assuming that the people working on the first project do their jobs good, don't leave game breaking bugs, a bunch of minor bugs, etc.. So how much would it cost me, and what would be the likely profit in half a year? I'm looking at minimal costs here, as to do it, I would have to sell my current apartment and buy a new, smaller one, pay taxes, and likely move to US/CA/UK to be closer to technologically advanced people (and be able to speak the language of course).

EDIT: I'm looking at a small project for starters, not a huge AAA title.

sentences:
NullReferenceException: Object reference not set to an instance of an object on boolean variable from separate class I'm trying to develop game scenario that able to trigger the alarm with alarm light and siren audio to play. For the testing purpose I set it that to boolean value as "alarmOn" in AlarmLight class.

**AlarmLight.cs**
public class AlarmLight : MonoBehaviour {

public float fadeSpeed = 2f;
public float highIntensity = 2f;
public float lowIntensity = 0.5f;
public float changeMargin = 0.2f;
public bool alarmOn = false;

private float targetIntensity;
public Light light;

//add alarm lights
// tag as siren
void Awake()
{
    light.intensity = 0f;
    targetIntensity = highIntensity;
}

void Update()
{
    if (alarmOn==true)
    {
        light.intensity = Mathf.Lerp(light.intensity, targetIntensity,fadeSpeed * Time.deltaTime);
        ChecktargetIntensity();
    }
    else
    {
        light.intensity = Mathf.Lerp(light.intensity, 0f, fadeSpeed * Time.deltaTime);

    }

}

void ChecktargetIntensity()
{
    if (Mathf.Abs(targetIntensity - light.intensity) < changeMargin)
    {
        if (targetIntensity==highIntensity)
        {
            targetIntensity = lowIntensity;
        }
        else
        {
            targetIntensity = highIntensity;
        }
    }
}

}

Then I  tried to access that value with LastPlayerSight class and for the testing purpose i was trying to return false as below.

alarm.alarmOn = (playerPosition != resetPlayerPosition);

Then I tried to play my scene, and I got the error which is the problem with above line of code.

This is my LastPlayerSight.cs class

public class LastPlayerSight : MonoBehaviour {

public Vector3 playerPosition = new Vector3(1000f, 1000f, 1000f);
public Vector3 resetPlayerPosition = new Vector3(1000f, 1000f, 1000f);

public float lightHighIntensity = 0.25f;
public float lightLowIntensity = 0f;
public float fadeSpeed =7f;

public float musicFadeSpeed = 1f;

//directional alarmlight ref
private AlarmLight alarm;

//main directional light ref
private Light mainLight;

private AudioSource panicAudio;

//siren audio
private AudioSource[] sirens;

void Awake()
{
    alarm = GameObject.FindGameObjectWithTag(Tags.alarms).GetComponent<AlarmLight>();
    mainLight = GameObject.FindGameObjectWithTag(Tags.mainLight).GetComponent<Light>();

    GameObject[] sirenAttachedGameObjects = GameObject.FindGameObjectsWithTag(Tags.siren);
    sirens = new AudioSource[sirenAttachedGameObjects.Length];

    for(int i = 0; i<sirens.Length; i++)
    {
        sirens[i] = sirenAttachedGameObjects[i].GetComponent<AudioSource>();
    }
}

void Update()
{
    SwitchAlarms();
    MusicFading();
}

void SwitchAlarms()
{
    alarm.alarmOn = (playerPosition != resetPlayerPosition);

    float newIntensity;

    if(playerPosition != resetPlayerPosition)
    {
        newIntensity = lightLowIntensity;
    }
    else
    {
        newIntensity = lightHighIntensity;
    }

    mainLight.intensity = Mathf.Lerp(mainLight.intensity, newIntensity,fadeSpeed*Time.deltaTime);

    for (int i = 0; i < sirens.Length; i++)
    {
        if (playerPosition != resetPlayerPosition)
        {
            sirens[i].Play();
        }
        else
        {
            sirens[i].Stop();
        }
    }
}

void MusicFading()
{
   //AudioSource audioTemp = audio.GetComponent<AudioSource>();

    if (playerPosition != resetPlayerPosition)
    {
        //audio.GetComponent<AudioSource>().volume = Mathf.Lerp(audio.volume, 0f, musicFadeSpeed * Time.deltaTime);

        panicAudio.volume = Mathf.Lerp(panicAudio.volume, 0.8f, musicFadeSpeed * Time.deltaTime);

    }
    else
    {
        panicAudio.volume = Mathf.Lerp(panicAudio.volume, 0.0f, musicFadeSpeed * Time.deltaTime);

    }
}

}

I'm beginner of developing such things and can anyone guide me to correct the problem?

sentences:
How can you create a trigger collider between two moving objects? I want to create a trigger-collider between two boxes. When one of the boxes moves, the trigger is supposed to change its size and shape so that its left and right edge stay attached to the two boxes.

How can I implement this in C# or JavaScript?

sentences:
After baking my lights again in Unity, my character is black? I had to re-bake my scene several times before getting the look that I wanted. This last time, the scene looks great, but my characters are now very dark and the playable character is completely black. He lights up only when the directional light hits him.
Saying this makes me realize the problem (sort of): All the spotlights from the room's interior were probably baked while the characters were turned off, making their solution require the only real-time light in the scene in order to be seen.
Still, I didn't think the characters would be involved in the lightmap data? How do I redo the lights just for characters and moving objects? How can I fix this and keep the scene lighting?

sentences:
Modifying A* pathfinding based on size of moving object I've implemented basic A* pathfinding in my top-down 2D game, and I'm almost ready to test it, but I thought of something while adding the movement code to my enemies that I think could affect the pathfinding.

My tiles are 64x64 px, and most enemies are as well. However, I do have some boss monsters that are larger than that. My initial thought was that to move to their goal, they have to move toward each node in their path, and to determine whether they've arrived at that node and to start targeting the next node, I need to test the distance between the enemy and their current target node. So what happens if, for example, their next node is next to a wall, and because of their size, their center is too far to "reach" the node?

My solution to that would be to check if the distance between their center of mass and the next node location is less than half the enemy's width plus maybe 10 px. However, what if one of their movement nodes is in between two tiles, and they're too large to fit through the two objects the node goes between? Is there a simple way to modify A* that takes size into account?

sentences:
Player customization of entity and handling textures I'm developing a racing game where you can customize your vehicle with pre-made textures and also user generated ones (players can add assets to the game).

I want to know what you think is the best approach to this type of customization.

Use pre-packed textures and load the corresponding atlases for every single part (I think this is the easiest, but wastes memory having 3 or 4 atlas in memory and just using one texture of each).
Check what the user selected and pack those textures into an atlas at runtime and use that until the user changes any part and pack it again, and so on... (more complex, less gargabe in memory).

Take into account that customizable parts include: wheels, spoilers, hoods, decals, exhausts and the user also has the possibility to add content.

I've never implemented something like this so any help would be appreciated.

sentences:
Is my collision-free location script working? I've recently been learning C# and I wanted to take one of my 2D tutorials to Unity.

I reached a step where I need to spawn my new sprite into a collision free location. I've followed direction - generated random location, calculating Vector2s using the location and collider, and then used a while loop to check Physics2D.OverlapArea using my 2 vectors.

But, because I'm still only just learning C#, I'm finding it difficult to know if I have actually written my code correctly. Is there any simple way of being able to figure this out? Using Debug or something?

Vector3 spawnLocation = new Vector3 (Random.Range (minSpawnX, maxSpawnX),
                                     Random.Range (minSpawnY, maxSpawnY),
                                     -Camera.main.transform.position.z);
Vector3 spawnPoint = Camera.main.ScreenToWorldPoint (spawnLocation);
Vector2 lowerLeftCorner = new Vector2 (spawnPoint.x - teddyBearColliderHalfWidth,
                                       spawnPoint.y - teddyBearColliderHalfHeight);
Vector2 upperRightCorner = new Vector2 (spawnPoint.x + teddyBearColliderHalfWidth,
                                        spawnPoint.y + teddyBearColliderHalfHeight);
while (Physics2D.OverlapArea (lowerLeftCorner, upperRightCorner) != null)
{
    spawnPoint.x = Random.Range(minSpawnX, maxSpawnX);
    spawnPoint.y = Random.Range(minSpawnY, maxSpawnY);

    lowerLeftCorner = new Vector2 (spawnPoint.x - teddyBearColliderHalfWidth,
                                   spawnPoint.y - teddyBearColliderHalfHeight);
    upperRightCorner = new Vector2 (spawnPoint.x + teddyBearColliderHalfWidth,
                                    spawnPoint.y + teddyBearColliderHalfHeight);
}
Debug.Log (Physics2D.OverlapArea(lowerLeftCorner, upperRightCorner));

I was trying to use a debug at the end there, but it doesn't seem to continue running every single time that there's a spawn, so I am still unsure if it is working.
I'm terribly sorry for my nooby code. Feel free to direct to me some place else if you feel I need to do so.

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 do I run code for a period of time and then return to normal behavior? i wanna run a code for my special power for five seconds only and then return to my normal working. when that power activates i am changing my player's material and i wanna return to my old material after those five secs are over. this is the code i tried:

void Start () {

        transform.GetComponent<Renderer> ().material.mainTexture = texts [0];
    }

    void Update () {

        if (condition) {
            for (int t1 = 0; t1 < 5; t1 += (int)Time.deltaTime) {
                transform.GetComponent<Renderer> ().material = mats [0];
            }
            transform.GetComponent<Renderer> ().material.mainTexture = texts [0];
        }
    }

this code breaks the game i think because unity is freezing when the condition is being met.

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:
Do meshes marked "shadows only" require light maps to block light? I want to use an .fbx mesh to block light from entering a room (except for holes cut for windows). The mesh itself must stay invisible. I know marking it "shadows only" will hide it from the camera, but light still passes through it unless I mark the mesh as "lightmap static" as well. The problem is that this is a huge mesh that doubles the number lightmaps required, and it won't even be seen.  Is there a better way to do this?

I am using the Lightweight Render Pipeline in Unity 2019.1.4f1 on Windows 10. Using CPU to render on an Intel Core i5 laptop.

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:
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:
Why does my vertex shader produce no output until I add some arbitrary value to the position attribute? I want to draw a textured quad but there is nothing drawn and the setup should be right.
This is my vertex shader:

#version 330

in vec2 position;
in vec2 texel;

out vec2 texCoord;

void main() {
    texCoord = texel;
    gl_Position = vec4(position, 0.0, 1.0);
}

This code is producing no output on screen. Now comes the crazy stuff. If I add the following,

#version 330

in vec2 position;
in vec2 texel;
in vec2 foo;

out vec2 texCoord;

void main() {
    texCoord = texel;
    gl_Position = vec4(position + foo, 0.0, 1.0);
}

everything is as it should be.

I am pretty sure that my setup is correct. I have checked the values of the vertex attributes by passing them as texCoord instead of the uv coordinates, and assigning them to my fragment color output in the fragment shader. In both cases this produces the expected color gradient. The extra uninitialized attribute foo must be zero, because its rendered as the vertex color.

So the thing is, nothing is drawn unless I add an vertex attribute to position. It doesn't matter if I add texel or the mysterious, uninitialized vertex attribute. The output is the same.

update:

glVertexAttribPointer(1, 2, GL_FLOAT, GL_FALSE, sizeof(Vertex), 0);
glVertexAttribPointer(2, 2, GL_FLOAT, GL_FALSE, sizeof(Vertex), sizeof(glm::vec2);

This is my vertex struct:

struct Vertex {
    glm::vec3 pos;
    glm::vec2 tex;
    glm::vec3 normal;
    Vertex(const glm::vec3& _pos,const glm::vec2& _tex,const glm::vec3& _normal):
    pos(_pos),tex(_tex),normal(_normal){}
    Vertex(const Vertex&)=default;
    Vertex& operator=(const Vertex&)=default;
};

The buffer is correct. I have mapped the vertex buffer and put it on the standard output.
All numbers are correct.

sentences:
Convert Rainbow gradient Shader to 3 colors gradient I am attempting to convert this rainbow shader into just using three colors.
I thought I would be able to set the three colors in the shader file, but I can't understand how to link them through the shader helper file.

shader: https://hastebin.com/uworiduluc.cs
Shader helper: https://hastebin.com/kifezufegi.cs

fixed4 frag(fragmentInput i) : SV_TARGET
{
    fixed2 lPos = i.localPosition / _Spread;
    half time = _Time.y * _Speed / _Spread;
    half timeWithOffset = time + _TimeOffset;
    fixed sine = sin(timeWithOffset);
    fixed cosine = cos(timeWithOffset);

    fixed hue = (-lPos.y) / 2.0;
    hue += time;

    while (hue < 0.0) hue += 1.0;
        while (hue > 1.0) hue -= 1.0;
            fixed4 hsl = fixed4(hue, _Saturation, _Luminosity, 1.0);

    return HSLtoRGB(hsl);
}

I added these properties at the top

_Color3 ("Top", Color) = (1,1,0,1)
_Color2 ("Middle", Color) = (1,1,0,1)
_Color1 ("Bottom", Color) = (1,1,0,1)

But I am not sure where I can add them into the code to have them be the colors that are used.

sentences:
How can I track the frame rate on a mobile device? I am trying to track the frame rate when performaing certain actions on my mobile device.

Scenario: I open my game via the device browser and run through specific actions.
Preferably would like the frame rate stored somewhere, like a text file. Would settle for visual display if that is not possible.

sentences:
2d Rectangle Collision Resolution My Journey...

I've long struggled with rectangle to rectangle collision resolution. I've been making games for almost 10 years and still have yet to find a foolproof, reliable strategy.

When doing research on 2d, rectangle to rectangle collision resolution, I find myself digging through piles of collision detection, or other topics that have nothing to do with my search for truth (circle to rectangle, other detection methods...)  For me, detecting collision has never been the issue...

if player.x + player.width > box.x and
   player.x < box.x + box.width and
   player.y + player.height > box.y and
   player.y < box.y + box.height then
     // A collision has been detected...
     // But now I am lost.....

Assuming both the player and box objects are positioned at their upper left corner

The Rectangular Paradox...

For those brave enough, there is the path of chaos, torture, and unknown horrors available... The road known as "creating your own". I have chosen to walk this path many times, never to find the answers I'm looking for. I'm sure I share some quarrels of this road with fellow developers.

At first you might think it a simple task: "Once you know the rectangles are overlapping, how difficult can it really be to push one out of the other?" Oh boy, how I miss that sweet innocence...

Let us say, the player in the above example is falling down on top of the box, and we want it to stop and be pushed back to the top of the box. Easy, right? We can just do a simple check if the player is above the box, and if so, push him up to the top.

// We know the player is overlapping with the box..
if player.y < box.y then
  player.y = box.y - player.height

Done. Tested and proven to work. But, let's say now we want the player to stop at the left side of the box as well..

if player.x < box.x then
  player.x = box.x - player.width

Looks like it should work fine right? But no. Upon testing you move the player to collide with the left side of the box, and bam. Suddenly, he has immediately moved to the top of the box.

Why? The player can be both above the box, and to the left of the box at the same time. So one seems to end up always being favored over the others. To mitigate this I have written 3 nested if statements, 50 line chunks of code for each side of the rectangle, and wasted near weeks of my life..

Conclusion

Although I walk my journey alone - I know there are others, battling the same demonic mystery of rectangle to rectangle collision resolution. And also.. Those who have conquered it...

I'm hoping someone can help me understand their solidified, proven methods of resolution. To help me and any other developers reading this right now, become level 100 devs.

I made a codepen for anyone who is interested to use as a playground for showcasing resolution methods.

sentences:
Is there a way to identify, within a shader, the current GPU thread ID? My question is rather simple: within a shader, is there a way (that works both in DirectX and OpenGL) to retrieve the ID of the given GPU thread being executed at the given iteration?

I am using Unity 5.3.4, if that helps. But I guess this is actually quite a platform-agnostic question. I have searched quite a bit for it, but found nothing satisfactory.

sentences:
Unity build shows wrong date I made a 3D game in Unity named Sniper Shot.

I am facing a problem when I build the project: at the end it shows the wrong date of build.

I have tried many scripts resolving this issue but I did not find any accurate way to fix it.

I completed this project on 4 march 2019 but this is showing me a wrong date, 23 July 2017.

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:
Difference between 'max distance' and 'radius' in Physics.SphereCastAll I needed a way to check for all gameobjects within a set sphere of my player object.

I found Physics.SphereCastAll which will return a RaycastHit[], exactly what I wanted. But, I am having trouble understanding the method signature/docs.

Basically, it's the two things in the title I am confused on right now:

From Unity docs:

radius    - The radius of the sphere.
maxDistance - The max length of the sweep.

Is 'max length of the sweep' a measurement of time (or degrees?)? I would have thought the length would be the same as the radius (or at least you could calculate it from the radius) but it obviously isn't what I think length means.

sentences:
How can I create a slope/hillsde tileset? I struggle to create a 2D slope/hillside for a tileset. Not an impassable mountainside like in Pokemon, more a gentle slope which you can walk both directions. When you see the tilemap, one should get a feeling that the two sides of the slope have a different heigth.

Ideas and suggestions are welcome.

sentences:
How should game objects with fixed positions in the world be positioned? I have some game objects that are always at the same position in my game world as they make up some of the scenery of my puzzle game. At the moment, their positions are sort of hard coded in and some of their positions are calculated relative to the hard coded positions of other objects at the time of game initialization. This has been hard to maintain because whenever I've decided to change the position of these scenery objects as the game design evolved, I have to go and rewrite parts of the code that place the created objects and calculate their positions in the world.

Is there a more maintainable way of handling the positioning of fixed game objects?

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:
Problem with Raycasting in a 2D Game I'm new to using unity and came across a problem when I was following a tutorial. The game is in two dimensional space, and when my player walks over a certain tile the detection never goes off. Here's the code that I have,

function calculateWalk() {

    yield WaitForSeconds(0.3);

    var hit : RaycastHit;

    if(Physics.Raycast (transform.position, Vector3.down, 100.0)) { // Never evaluates to being true
        var distanceToGround = hit.distance;
        Debug.Log("Hit");

        if(hit.collider.gameObject.tag == "tallGrass") {
            walkCounter++;
            Debug.Log("Tall Grass");
        } // END if
    } // END if
} // END calculateWalk()

I've made sure to attach the script to my player, as well as tag the tiles that I want with "tallGrass". I've followed what was done in the tutorial, but for some reason it's not working out for me, not sure if this is all the code needed to help solve this problem, if more information is needed let me know, I also set my player 1 unit above the tiles.

sentences: Can LittleBigPlanet2's engine be used for other? LittleBigPlanet2 just came out. I've worked with the original LBP level editor a bit and really enjoyed it. I've read that LBP2's featureset in the game is much richer; is it possible to use these advanced features to create different sorts of game other than just a regular platformer? I imagine that something along the lines of a Breakout clone would definitely be manageable, but I'm interested in hearing more about the capabilities of the platform.

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

sentences:
How can glass breaking effect from Smash Hit be achieved? I saw Smash Hit the other day and was amazed by the physics of the game, specially the shattered glass effect:

I've read other posts about this subject but I still feel that they don't share enough details to let me get started on implementing this on my own with OpenGL/GLSL.

Is it possible for somebody with an enhanced perception and graphics understanding to watch the gameplay and give some pointers on how this effect could be replicated?

I rather not use 3rd party physics engine and do the entire thing on my own for educational purposes, so could you mention some of the physics that goes behind this as well?

References to other documents and demos are highly appreciated.

sentences:
How does Texture2D.GetData return coloured pixels? I'm trying to work out how the pixels are stored in the returned array but I'm not having a lot of luck (and thus my calculations don't seem to be working).

I realize that the pixels are stored in one long continuous array but are the pixels grabbed width first or height first? I've tried drawing out the "pixels" of a texture on paper to calculate where the pixels should be based on the single array but I'm not getting expected results.

My assumption is the following:

Assuming I am using i to specify rows and j to specify columns that any given pixel in a 2D texture can be calculated by the sum of i * j or is this incorrect?

sentences: DirectX 12 and Feature levels As far as I know the DirectX12 SDK that comes with the Windows 10 SDK can only be used on a Windows 10 machine. Although I'm not entirely sure about the runtime and the use of future levels (which came with DX11). Considering the radical API changes in DX12, is it possible to initiate a level 11_0 device that will operate on the DX11 runtime on Windows 7 for instance? Or am I getting the feature levels idea wrong?

sentences:
How to check if a test ad is ready I was going through UnityAds for Unity3D, and came across this setting:

AD TEST MODE
Force all

So as I understood it states that I will be able to see real ads, in test mode, without monetizations on my testing tool, which in my case is Unity3D IDE, but I am still getting that blue sample ad screen "Here would be your ad screen". Is there anything that I can do to check if any ad is placed for my app, and check this via code before Advertisement.Show(); statement? Or am I missing something?

sentences:
2D games and modern OpenGL Preconcepts
Ok, so what I've gathered so far is this:

don't use fixed pipeline (deprecated or going to be deprecated)
vbos store "object models" (n vertex data, mostly)
vaos describe how data is laid down so that draw calls know what part of each vbo is for what kind of vertex information (one vao can refer to multiple vbos, the opposite is kinda difficult)
each draw call also sends vertex data to shaders

How I see 3D (optional)
Given these informations, I can see how drawing 3D complicated objects is very nice with modern OpenGL. You basically load a bunch of object models (probably from Blender or other similar software) into VBOs with local coordinates, and then you simply provide for each instance of an object a different shader parameter (offset) to draw to world space.
Problem/question
In 2D problems and priorities are completely different, though. You don't draw much complex objects, you don't need complicated projection matrixes and whatnot and shaders are much simpler.
What would be the best way to draw frequently (really frequently, basically every frame) changing geometry with modern OpenGL?
In the following paragraph you can see some ideas of problems (the circle and rectangle problem), that better identify the kind of changes I'm interested in.
My attempts (optional)
So, I began to think how I would deal with drawing basic 2D geometry on the screen:

a square: load a [(1, 0), (1, 1), (0, 1), (0, 0)] VBO for the geometry of a square in local space, then provide the shader with the actual width of the square and world coordinates and color informations

cools, looks easy. Let's move to a circle:

a circle: triangle fan with... eh. how much precision (number of vertexes)? for small circles precision must be small and for bug circles precision must be high. Clearly loading 1 VBO cannot possibly fit all cases. What if I need to add precision because a circle is resized to be bigger?

Less cool. Let's move to something slightly easier, a rectangle:

a rectangle: eh. there's no "general rectangle geometry". You just have a width/height proportion and that's it, but each rectangle is probably different if the size changes.

As you can see, things go downhill from there. Especially with complex polygons and whatnot.
No code policy :P
I just need an overview of the idea, no code is necessary, especially C or C++ code. Just say stuff like: "make a VBO with this vertex data, and then bind it, ...".

sentences:
Game Architecture and Separation of Concerns I'm trying to build a "simple" Tetris game, but I want to have enough flexibility to add a few things:

The game can be played by a human, or (if the human presses a certain key) an AI is swapped in.
The rendering code should be "configurable". That is, the user may enable or disable animations, or speed them up.

MVC initially looks like a good fit: the game itself is encapsulated in a Game object, providing some methods to interact with it (moveLeft, rotate). The Controller would handle user input or AI. The View just renders the game, and gets notified of updates by the Game itself whenever something interesting happens (PieceMoved, LineDestroyed and so on).

However, my problem mostly lies in "What if I want a blocking animation?"

When lines are destroyed, I want to do a "falling" animation where the top lines crush the bottom lines (or whatever), but since this animation may take some time, I want to avoid updating the game (that is, piece gravity) until the animation is completed.

Does it make sense to have the Controller do something like...

void update() {
    input.process()
    render.update()
    if (!render.blocked()) {
        game.update();
    }
}

Is MVC a bad fit for this? What's a good way to separate concerns in games?

(I am using libGDX, but my question isn't limited to it.)

sentences:
Input prediction and server re-simultaion I have read plenty of articles about multiplayer principles and I have basic client-server system set up. There is however one thing I am not clear on.

When player enters input, it is sent to the server and steps back in time to check if what should have happened at the time of that input and it resimulates the world again. So far everything's clear.

All articles took shooting as an example, because it is easy to explain and it is pretty straightforward, but I believe movement is more complicated. Imagine following situation:
2 players move towards each other.

A------><------B

Player A stops halfway towards the collision point, but there is lag spike so the command does not arrive on the server for a second or so. Current state of the world on the server (and on the other clients as well) at the time when input arrives is this:

[1]:

-------AB-------

The command arrives and we go back in time and re-simulate the world, the result is this:

[2]:

---AB-----------

Player A sees situation [2] which is correct, but the player is suddenly teleported from the position in [1] (center) to the position in [2].

Is this how this is supposed to work? Point of the client prediction is to give lagged player feeling that everything is smooth, not to ruin experience for other players.

Alternative is to discard timestamp on the player's input and handle it when it arrives on the server without going back in time. This, however, creates even more severe problems for lagged player (even if he is lagging just a bit)

EDIT:

To give you more info about my situation, I am making a game where exact position is quite important and the action is quite fast-paced. Imagine air-hockey with some perks on top.
Another thing worth considering is that this is flash game and I have to use TCP. From my previous experience, ping times of 200ms are the norm (unlike 50ms on pc games) in situations I will be facing.

sentences:
How can I make a sprite based animation using Cocos2d JS? I am learning Cocos2d JS, but I can find very few tutorials and I find the documentation very vague. I can put a simple image on a layer like this:

var sprite = new cc.Sprite(res.my_image_png);
sprite.setAnchorPoint(0.5, 0.5);
sprite.setPosition(cc.winSize.width / 2, cc.winSize.height / 2);
this.addChild(sprite);

I can also move it like this:

var actionTo = cc.moveTo(2.5, cc.p(100, 100).easing(cc.easeInOut(1));

sprite.runAction(
    new cc.Sequence(
        actionTo,
        new cc.CallFunc(
            function() {
                cc.log("Animation complete");
            },
            this
        )
    )
);

How could I improve this code to also show some sprite-based animation? I would like to exchange the sprite image every 0.25 seconds. What is the designed way to do that in Cocos2d JS?

sentences:
OpenGL, fetching the names of all uniform blocks in your program I want to auto-bind uniform blocks with certain named values to certain binding points when I compile a shader.  For example, I have some basic, default fixed binding points that are always used for certain things like:

0 Camera
1 Model
2 Material
3 Lights

At the moment I'm binding manually by finding the index of a named block with glGetUniformBlockIndex, and then binding it with glUniformBlockBinding.  What I'd like to do is fetch the set of all block names in my shader program.  When I iterate with glGetActiveUniformsiv, I get a list of all uniforms, which excludes block names.

Is there any way to do this without testing and failing each of my above names to see if it's an active block with glGetUniformBlockIndex?  There's no glGetActiveUniformBlocksiv, is there...

sentences:
How i can play movie in unity by script(android platform)? my script is correct in pc platform but when i switch on android platform i have compiler error cs0246, why i can not export my apk file.
how i can play movie in unity android platform by other way?

     public class NewBehaviourScript : MonoBehaviour {
     public MovieTexture myMovie;

     void Start()
     {
         myMovie.Play();
     }

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

sentences:
NULL REFERENCE EXCEPTION Object reference not set to an instance of an object So I have 3 scripts:

first for my player movementscript
second for my speed powerup speedscript
third for my obstacle box script i

I'm trying to get the component of box script in speed script, to get the function 'added' (which is in box script) into speed script but it keeps giving me nullreferenceexception error

Here are those scripts:

public class box : MonoBehaviour
{

    [SerializeField]
    GameObject effect;

    public int damage = 1;
    [SerializeField]
    float Speed =10f;
    [SerializeField]
    GameObject audioexplosion;

    void Update()
    {

        transform.Translate(Vector2.left * Speed* Time.deltaTime);

    }

    void  OnTriggerEnter2D(Collider2D col)
    {
        if(col.CompareTag("Player"))
        {
            Instantiate(audioexplosion, transform.position, Quaternion.identity);
            Instantiate(effect, transform.position, Quaternion.identity);

            movment tmp = col.GetComponent<movment>();

                tmp.health -= damage;
            Destroy(gameObject);
        }
    }
    public void added(float spd)
    {
        Speed += spd;
    }

}

And here is my speed script.

public class speedscript : MonoBehaviour
{
    [SerializeField]
    GameObject effect;
    [SerializeField]
    GameObject speedaudio;
    //[SerializeField]
   public float speed;
    public float add_v = 5;
    private float timeindue;
    //[SerializeField]
 //  public box io;

    void Start()
    {

     //  io= GetComponent<box>();
       // Debug.Log(io);
    }

    void Update()
    {
        transform.Translate(Vector2.left * speed * Time.deltaTime);
    }

    void OnTriggerEnter2D(Collider2D sp)
    {
        if (sp.CompareTag("Player"))
        {
            Instantiate(speedaudio, transform.position, Quaternion.identity);
            Instantiate(effect, transform.position, Quaternion.identity);
            box io = GetComponent<box>();
                Debug.Log(io);
                io.added(add_v);

                Destroy(gameObject);
        }
    }
}

sentences:
Create acceleration with direction I want to move my object with an acceleration in the proper direction.  For example if I have these values:

friction = 0.3;
direction = 180;
speed = 5;

For making it clear, I need a formula to create a linear acceleration.

sentences: How to draw Isometric game Back to front What is the for loop or algorytm for a 2D array of tiles that I would render the tiles back to front like this:

sentences:
Why the timer is not showing the hours? It's showing minutes seconds milliseconds but I want to show also the hours.

At the top:

private int seconds; // Seconds.
private int minutes; // Minutes.
private int hours;   // Hours.

In Update:

void Update()
{
if (seconds < 1)
        {
            seconds = 59;
            minutes--;
        }
        if (minutes < 1)
        {
            minutes = 59;
            hours--;
        }
        if (hours < 1)
        {
            hours = 59;
        }
        seconds--;

        EditorGUILayout.LabelField("Next: ", hours.ToString() + ":" + minutes.ToString() + ":" + seconds.ToString());

Update, This is what I tried:

using System;
using System.Collections;
using System.Collections.Generic;
using UnityEditor;
using UnityEditor.SceneManagement;
using UnityEngine;
using UnityEngine.SceneManagement;

public class Timer : EditorWindow
{

    private static Timer editor;
    private static int width = 300;
    private static int height = 110;
    private static int x = 0;
    private static int y = 0;
    int totalSeconds;

    [MenuItem("Window/Timer")]
    static void ShowEditor()
    {
        editor = EditorWindow.GetWindow<Timer>();
        editor.Init();
    }

    public void Init()
    {
        StartTimer(1, 1, 50);
        Debug.Log("The level will now be saved automatically");
    }

    void OnGUI()
    {
        EditorGUILayout.LabelField("Next: ", TimeString());
    }

    public void StartTimer(int hours, int minutes, int seconds)
    {
        totalSeconds = seconds + 60 * minutes + 60 * 60 * hours;
    }

    string TimeString()
    {
        return string.Format("{0:00}:{1:00}:{2:00}",
                      totalSeconds / (60 * 60),   // Hours
                      (totalSeconds / 60) % 60, // Minutes
                      totalSeconds % 60);     // Seconds
    }
}

But the timer is not moving not counting back it stay still.
I tried also to move the line:

StartTimer(1, 1, 50);

To be inside the OnGUI before the LabelField.

sentences:
implementing magnet like system in unity I'm implementing magnet like behavior in unity3d.
the red object have a script that add force to it toward a blue object.
to do that i use this code:

void FixedUpdate()
{
    float distance = Vector2.Distance(blue.transform.position, transform.position);
    speed = MAX_DISTANCE - distance;
    body2d.AddForce((blue.transform.position - transform.position).normalized * speed);
}

MAX_DISTANCE is maximum distance that red and blue object can have.

with this code i got this behavior :

but i don't want red object gets this far after reaching blue object i want red object to decrease it's speed and after maybe some shaking around blue object and eventually stop on blue object, how can i implement this?

UPDATE
red and blue objects can't collide with each other they just know their location.

sentences:
Vertex Normals, Loading Mesh Data My test FBX mesh is a cube. From what I surmise, it seems that the cube is on the extreme end of this issue, but I believe that the same issue would be able to occur in any mesh:

Each vertex has 3 normals, each pointing a different direction. Of course loading in any type of mesh, potentially ones having thousands of vertices, I need to use indices and not duplicate shared verts. Currently, I'm just writing the normals to the vertex at the index that the FBX data tells me they go to, which has the effect of overwriting any previous normal data. But for lighting calculations I need more info, something that's equivalent to a normal per face, but I have no idea how this should be done. Do I average the 3 different verts' normals together or what?

sentences:
State Changes in a Component Based Architecture I'm currently working on a game and using the naive component based architecture thingie (Entities are a bag of components, entity.Update() calls Update on each updateable component),
while the addition of new features is really simple, it makes a few things really difficult: a) multithreading / currency b) networking c) unit testing.

Multithreading / Concurrency is difficult because I basically have to
do poor mans concurrency  (running the entity updates in separate
threads while locking only stuff that crashes (like lists) and
ignoring the staleness of read state (some states are already
updated, others aren't))
Networking: There are no explicit state changes that I could
efficiently push over the net.
Unit testing: All updates may or may not conflict, so automated
testing is at least awkward.

I was thinking about these issues a bit and would like your input on these changes / idea:

Switch from the naive cba to a cba with sub systems that work on
lists of components
Make all state changes explicit
Combine 1 and 2 :p

Example world update:

statePostProcessing.Wait() // ensure that post processing has finished
Apply(postProcessedState)

state = new StateBag()

Concurrently(
 () => LifeCycleSubSystem.Update(state), // populates the state bag
 () => MovementSubSystem.Update(state), // populates the state bag
  ....
})

statePostProcessing = Future(() => PostProcess(state))
statePostProcessing.Start()
// Tick is finished, the post processing happens in the background

So basically the changes are (consistently) based on the data for the last tick; the post processing can a) generate network packages and b) fix conflicts / remove useless changes (example: entity has been destroyed -> ignore movement etc.).

EDIT: To clarify the granularity of the state changes:
If I save these post processed state bags and apply them to an empty world, I see exactly what has happened in the game these state bags originated from -> "Free" replay capability.

EDIT2: I guess I should have used the term Event instead of State Change and point out that I kind of want to use the Event Sourcing pattern

sentences:
How to make and render a simple game just with 3d max? I want to make a simple EXE file, where there is one object in the scene and the user can rotate that object by using arrow keys (or mouse).
Is there any way in which I don't have to use a game engine and do it only using 3dsmax script?
Cause there is a special renderer I want to use, which is V-Ray a kind of renderer which provides 3D images for 3D glasses.
I am not good at making games and engines so I want to know if I can do it only with 3dsmax scripts?

sentences:
What technique should I use for the AI for Go? I am currently undertaking a project where I need to program AI for Go (the Asian strategy game) and I would like to know, how do I start? I am aware of the many approaches to AI for their applications to Go, such as the neural network, machine learning (supervised learning, etc), the Monte-Carlos method, or knowledge based AI. I am more interested in machine learning however I am short on time as I have about two months to complete it.

I am also considering minimax and alpha-beta pruning with brute force as a compromise in case I don't have enough time to do anything else. I am fully aware that it is not the best way to go about this but if I am short on time then I have no other choice.

sentences:
Pygame proble, moving picture Thats my problem on the Picture...The stripes

How can i fix that?

My Code:

import pygame, sys
from pygame.locals import *

pygame.init()

sound = pygame.mixer.Sound('start.wav')
sound.play()

size = width, height = 1600, 848
speed = [2, 2]
black = (0, 0, 0)

pygame.mouse.set_cursor(*pygame.cursors.broken_x)

screen = pygame.display.set_mode(size)
background = pygame.image.load("background.PNG")
dragon1 = pygame.image.load("dragon1.gif")
screen.blit(background, (0,0))

x,y=0,0
clock=pygame.time.Clock()
speed=250
movex, movey=0,0

while True:
    for event in pygame.event.get():
        if event.type == QUIT:
            pygame.quit()
            sys.exit()
    if event.type==KEYDOWN:
            if event.key==K_a:
                movex=-1
            elif event.key==K_d:
                movex=+1
            elif event.key==K_w:
                movey=-1
            elif event.key==K_s:
                movey=+1
    if event.type==KEYUP:
            if event.key==K_a:
                movex=0
            elif event.key==K_d:
                movex=0
            elif event.key==K_w:
                movey=0
            elif event.key==K_s:
                movey=0
    x+=movex
    y+=movey

screen.blit(dragon1, (x,y))
pygame.display.flip()

sentences:
Hemisphere Projection I came across the following segment of code that is supposed to project an image on a hemisphere:

void main(void)
{
    vColor = aColor;
    vec4 pos = uModelViewMatrix * vertex;
    float lenxy = length(pos.xy);
    if(lenxy != 0.0)
    {
       float phi = atan(lenxy, -pos.z);
       pos.xy = normalize(pos.xy);
       // pos.xy is equal to (cos theta, sin theta)
       float r = phi / (PI/2.);
       // radius is less than or equal to 1.
       pos.xy *= r;
       // same theta, different radius
    }
    gl_Position = uProjectionMatrix * pos;
 }

The followings are what I need clarifications for:

Why would r be less than or equal to 1 by dividing phi by PI/2.?
Why are we multiplying pos.xy with r?
And, how does normalizing pos.xy give us cos theta and sin theta?

The followings are the accompanying images:

Thanks.

sentences:
Unity2D 100x100 tile map, best practice? I'm trying to create a top-down map in Unity2D, this map will act as an ocean that a 1 tile sized boat will drive across. I want to be able to generate this map programmatically by going through the grid to create shallow areas, spawn things, etc.

I've been reading it's not good practice to create game objects for each tile as there's so many. You can use object pooling but that sounds harder to manage. I've read that using a mesh map is the best way but no one follows up with the best way to implement it. Any clues to push me in the right direction?

sentences:
What is a good approach to dynamically change actor Position? In my card game there are 2 players with each player having a hand(a ListArray of  of Cards.In this case its handPlayer1).
The Card class extends Actor.This is the code I use to deal the cards to the first player(I call this in the show() method) :

 for (int i = 0; i < 6; i++) {
        handPlayer1.get(i).setPosition(20 + i * 35, TABLE_HEIGHT - CARD_HEIGHT - 30);
    }

For now whenever a player plays a card it is removed from their hand and moved to the table.If the player draws a card it is added to the hand of the player like so :

deck.get(deck.size() - 1).addAction(Actions.moveTo(handPlayer1.get(handPlayer1.size() - 1).getX() + 20, 30, 0.1f));

But the problem is that sometimes the cards go out of screen bounds when the player has too much cards and are not visible.

.What is a good way to manipulate the positioning of Actors so that the hand stays in the center and all cards are a set distance from one another? I have read up on Groups but I don't know if adding the cards to a Group would change anything.(Picture below for reference)

sentences: When should I use velocity versus addForce when dealing with player objects? I'm confused about these two methods in the Unity framework.  Both make the player object move, stop, change direction, etc.  When should one be used over the other and when is one appropriate?

sentences:
Find your value between four values in a grid based on distance, Unity Please note: Originally posted in stack overflow, redirected due to nature of problem.

I am making a procedural mesh game. I am trying to calculate the temperature for the player's current chunk by getting nearby temperature values and interpolating.

The way this works is, let's say we are at world space 95, 0, 65 (x,y,z). What I do is:

1) generate, using perlin noise, temperature values for every 20 squares (smartly generated to only do so to the 4 squares most relevant to us at any given time). We will get the points: 80, 0, 60 100, 0, 60 80, 0, 80 100, 0, 80

Each of these points is fed into a perlin noise generator and spits out a number. That number is the temperature.

So, in order to make the climate smoothly transition, I need to figure out how to get the distance each point weighted against its temperature so I can calculate the temperature of the space I am standing in.

If there is a name for this (there must be, I'm essentially sampling a gradient made by four points) and a way to do it, please just link that instead.

I tried taking the distance from my point to each point and multiplying that number against the temperature at that point, but I'm not sure if that's a correct first step, or what to do from there (just average the four resulting numbers?!).

sentences: What is the delta value passed to the Screen's render method? The delta value given to the render method in the Screen class is a non-constant number. What is it? Where does it come from? Does it differ by screen size?

sentences:
Cross platform data format I've got a best/common practice question about cross platform development. We're developing a Unity game and we've got a custom data format (a modified jpeg) that a C# tool we developed pumps out and gets loaded into unity using a dll. We use some nice gdi+ tricks on Windows with this file format, however when we move this to the Mac, we're running into issues that we think is the mono implementation of gdi+ is missing something.

That aside we're not sure what the best practice moving forward is. Should we develop a new file format that works cross platform and is loaded the same on both systems, or should we use a platform specific data format that allows for the use of the C# tricks on Windows and maybe a different trick on Mac?

sentences:
Utility of submesh class in a 3d game engine? I've read somewhere that we use sub mesh for being able to give different materials to one mesh. But why not simply do this with scenegraph ?

I mean you have a car mesh, and instead of using submeshes for windows, wheels etc... We could have one car node which would be composed of child nodes ( wheel, window ) with differents meshes and materials.

What's the utility of submeshes while there is scenegraph ? I've noticed that in Ogre3D there is both scenegraph ( SceneNode class ) and a mesh/submesh system, why ?

sentences:
Suggestions for implementing a dynamic 2D level I am working on a game that needs a level that is completely generated. Currently my approach is to draw textures for the levels pixel by pixel during the game (in XNA with SpriteBatch). This is too intensive unfortunately. The game has frame drops even when I only draw 1 level texture each draw cycle.

Here is an example of the current prototype. It is a simple sidescroller with the avatar swimming through a cave. The shape of this cave will alter throughout the level (textures and physics collision shapes). You can clearly see the boundaries of the level tiles in the screenshot below. These are generated just before they move into camera view.

For inspiration I looked at PixelJunk Shooter 2. These levels are obviously not generated, but some of the levels have movement. How do you guys think they implemented it? My guess is that the level and other objects in the game are actually flat 3d models, but I am not sure..

sentences:
Android game crashes when attempting to start wifi hotspots I have two methods that will try to start the WiFi hotspot on the android device so that others can connect and play the game.the problem is both method have problems and don't work.
the first method:

    public void ConnectWiFi()
    {
        try
        {

            using (AndroidJavaObject activity = new AndroidJavaClass("com.unity3d.player.UnityPlayer").GetStatic("currentActivity"))
            {
                using (var wifiManager = activity.Call("getSystemService", "wifi"))
                {
                    AndroidJavaObject wifiConfiguration = new AndroidJavaClass("android.net.wifi.WifiConfiguration");
                    wifiConfiguration.Set("SSID", meSSID); // string
                    wifiConfiguration.Set("preSharedKey", mePassword); // string
                    wifiManager.Call("setWifiApEnabled", wifiConfiguration, enabled);
                }
            }
        }
        catch (System.Exception E)
        {
            T.text += "\nE - " + E.Message;
            T.text += "\n\t" + E.StackTrace+"\n";
        }
    }

it crashes the game and I can't debug it.
the secont method:

    public void ConnectWiFiHardWay()
    {
        try
        {

            using (AndroidJavaObject activity = new AndroidJavaClass("com.unity3d.player.UnityPlayer").GetStatic("currentActivity"))
            {
                using (var wifiManager = activity.Call("getSystemService", "wifi"))
                {

                    using (AndroidJavaObject classObj = wifiManager.Call("getClass"))
                    {
                        using (AndroidJavaObject wifiConfiguration = new AndroidJavaObject("setWifiApEnabled"))
                        {
                            wifiConfiguration.Set("SSID", meSSID); // string
                            wifiConfiguration.Set("preSharedKey", mePassword);
                            using (AndroidJavaObject wifiCfgClass = wifiConfiguration.Call("getClass"))
                            {
                                using (AndroidJavaObject booleanObj = new AndroidJavaObject("java.lang.Boolean"))
                                {
                                    using (AndroidJavaObject booleanClass = booleanObj.Call("getClass"))
                                    using (AndroidJavaObject methodObj = classObj.Call("getMethod", "setWifiApEnabled", wifiCfgClass, booleanClass))
                                    {
                                        methodObj.Call("invoke", wifiManager, wifiConfiguration, enabled);
                                    }
                                }
                            }
                        }
                    }
                }
            }
        }
        catch (System.Exception E)
        {
            T.text += "\nH - " + E.Message;
            T.text += "\n\t" + E.StackTrace+"\n";
        }

this one throws an exception that says setWifiApEnabled Cannot be found
I can post the complete error text if that helps.
Also I followed this questions instructions.

sentences:
Call function via ContactListener I've been creating a game on my own in LIBGDX, BOX2D and there' s a problem I can' t solve. When two World bodies collide, method "beginContact" is called in MyContactListener class that implements ContactListener interface.

How am I supposed to change player's healthpoints when it's fixture collides with other bodies' fixtures. I know I have to do this somehow through MyContactListener class, but I can' t find the way how to call the method I need..

Note: My player's body and fixture are created in "Player" class and there are methods "setRemainingHealth()" and "getRemainingHealth()".

Here's also some code, which might illuminate this situation.

MyContactListener.java

package utils;

import com.badlogic.gdx.physics.box2d.Contact;
import com.badlogic.gdx.physics.box2d.ContactImpulse;
import com.badlogic.gdx.physics.box2d.ContactListener;
import com.badlogic.gdx.physics.box2d.Fixture;
import com.badlogic.gdx.physics.box2d.Manifold;

public class MyContactListener implements ContactListener {

@Override
public void beginContact(Contact c) {

    Fixture fa = c.getFixtureA();
    Fixture fb = c.getFixtureB();

    if (fa == null || fb == null) return;
    if (fa.getUserData() == null || fb.getUserData() == null) return;

    if (isTunnelMachineCollision(fa, fb)) {
        // call somehow method "player.setRemainingHealthPoints(player.getRemainingHealthPoints-0.01f)" here
    }

}

@Override
public void endContact(Contact c) {

}

@Override
public void postSolve(Contact c, ContactImpulse arg1) {

}

@Override
public void preSolve(Contact arg0, Manifold arg1) {
    // TODO Auto-generated method stub

}

private boolean isTunnelMachineCollision(Fixture a, Fixture b) {
    return (a.getUserData()) == "terrain" && (b.getUserData()) == "machine";
}

}

TestPlayer.java

package testPackage;

import com.badlogic.gdx.math.Vector2;
import com.badlogic.gdx.physics.box2d.Body;
import com.badlogic.gdx.physics.box2d.BodyDef;
import com.badlogic.gdx.physics.box2d.BodyDef.BodyType;
import com.badlogic.gdx.physics.box2d.CircleShape;
import com.badlogic.gdx.physics.box2d.Fixture;
import com.badlogic.gdx.physics.box2d.FixtureDef;
import com.badlogic.gdx.physics.box2d.World;

public class TestPlayer {

private float remainingHealthPoints = 3;

private CircleShape shape;
private CircleShape defenseBarrier;
private Fixture defenseBarrierFixture;
private Fixture mainBody;
private BodyDef bodydef;
private Body body;

private float x;
private float y;
private float width;

public TestPlayer(World world, float x, float y, float width) {

    this.x = x;
    this.y = y;
    this.width = width;

    bodydef = new BodyDef();
    bodydef.type = BodyType.DynamicBody;
    bodydef.position.set(x, y);
    bodydef.fixedRotation = true;
    body = world.createBody(bodydef);

    shape = new CircleShape();
    shape.setRadius(width);
    mainBody = body.createFixture(shape, 1.0f);
    mainBody.setUserData("machine");
}

public float getRadius() {
    return shape.getRadius();
}

public BodyDef getBodydef() {
    return bodydef;
}

public CircleShape getShape() {
    return shape;
}

public Body getBody() {
    return body;
}

public void activateDefenseBarrier(World world) {

    defenseBarrier = new CircleShape();
    defenseBarrier.setRadius(width*1.5f);

    defenseBarrierFixture = body.createFixture(defenseBarrier, 1.0f);
    defenseBarrierFixture.setUserData("defenseBarrier");
}

public void destroyDefenseBarrier() {
    if (defenseBarrierFixture != null) {
        System.out.println("olemas");
        body.destroyFixture(defenseBarrierFixture);
        System.out.println(defenseBarrierFixture);
    }
    else {
        System.out.println("fixture on null");
    }
}

public Fixture getDefenseBarrier() {
    return defenseBarrierFixture;
}

public float getRemainingHealthPoints() {
    return remainingHealthPoints;
}

public void setRemainingHealthPoints(float remainingHealthPoints) {
    this.remainingHealthPoints = remainingHealthPoints;
}

}

sentences:
How do you get the best rendering performance in a 2D Java Game? I have seen a lot of tutorials, and they develop games with 2 different ways:

The first one is using a virtual image (BufferedImage) and filling it's pixels. And displaying virtual picture.

private BufferedImage image = new BufferedImage(WIDTH, HEIGHT, BufferedImage.TYPE_INT_RGB);
private int[] pixels = ((DataBufferInt) image.getRaster().getDataBuffer()).getData();
private int[] colors = new int[6 * 6 * 6];

Second one is using lots of real images. And displaying they.

SpriteSheet sheet = new SpriteSheet(ImageLoader.loadImage("/textures/sheet.png"));

    //PLAYER SPRITES PROVIDED BY: AddFact
    player = sheet.crop(width * 4, 0, width, height);

    dirt = sheet.crop(width, 0, width, height);
    grass = sheet.crop(width * 2, 0, width, height);
    stone = sheet.crop(width * 3, 0, width, height);
    tree = sheet.crop(0, 0, width, height);

First Question: Which one has the best performance ?

Second Question: How should we load maps? With images or with text files ? Which one is good to chose ?

Sorry for my english. I hope I can explain to you :) Thanks for helping, have a nice day ^^

sentences:
How should I use this 1D perlin noise function? I'm trying to create a terraria like terrain with SDL2 and C++. For generating the terrain I'm trying to use the 1D noise function from here:
https://github.com/SRombauts/SimplexNoise

It's pretty basic and only takes a x value. I've been messing around with it for a while but can't work out what to pass into the function as the x value. I first tried passing just the x value of the column I'm finding the noise for. This just returned 0 every time. Next I tried passing a value between 0 and 1, so I passed it x / width. This sort of worked, but the wider I made the terrain, the more spaced out it became.

Hope you understand, what I do give the function for the x value?
Thanks in advance.

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 to place an instance of Editor Window in screen center? I want to create an instance of Editor Window by using CreateInstance or GetWindow. And I want to place it in center of the screen (or center of Unity).

I didn't find any methods in Unity Engine that could help me. Do they exist?

How can I do it within the script?

Note: I mean: how can I find out what is the user's screen resolution? Which method can give me that?

P.S. Screen.width/Screen.height - is not what I need. Because it refers to the Game View's window, not Unity.exe Editor's size and not monitor Screen

sentences:
A python script controlling a Unity game I wish to build a simple game in Unity such that the objects in the game can be controlled via a Python script (or a code in any other programming language). Is this possible? If yes then how? If no then are there any other alternatives to achieve similar results?

To make it more clear, say that I have 10 objects in my current scene. What I wish to do is to address each object individually via Python. One way of doing this is setting up keyboard bindings to select a particular object and then using keyboard and mouse events to control this object. But, is there a more cleaner (a native) way of doing the same?

sentences:
Which tools are artists using out there and how for game development to produce the material used by game programmers? What processes, tools, methods are used by game artists to prepare materials for the programmers?

I am interested in tools (ie: photoshop, pixelmator, etc for drawing) and also how they are used together to produce texture atlases or individual images for the programmers.

Methods or way of working (tool-chains maybe), which can be used by the artist to

Present ideas (sketches)
Mesh up game images (photosop: front menu, in-game)
Cut up images/layers into (ie: copy paste?)

smaller individual pieces
texture atlases (some other tool)

Generate coordinates ie: (xywh) for button "Options" on the main screen which is stored as main_options.png or (uvhw, xywh) for in-game HUD which is in a texture_atlas.png.
Any way to automate some of the steps above?

============ before edit ============

The artist(s) might use hand drawings-scanner/sketch pad for illustration.
These are then imported and further improved in some other image manipulation tools.
The result then can be used to produce both preview of the game (menu, in-game meshups) and final elements which will be used by the programmer(s): individual images or texture atlases.

Which tools are artists using out there and how for game development to produce the material used by game programmers?

I am particularly interested if there are automated tools where a small change at the illustration part can be propagated to produce final production images/textures without the need for the artist to cut/merge them.

sentences:
Scaling a game world both for realism and for mechanics I am currently working on a turn-based 4X game, and one of the things I quickly ran into was a question of scaling. On one hand, I want things like realistic sizes (having some idea of what each tile represents in terms of area), but on the other hand, doing so would limit me in terms of certain mechanics I want to implement (the size of a realistic city would not even occupy a tile, let alone multiple tiles, a mechanic I want to use).

How would I go about scaling the world so that I can have both realistic scaling AND the mechanics I want?

Some things I have considered:

Changing the size of the world. Nothing says that I have to have this take place on an Earth clone (especially with randomly generated terrain). Smaller worlds might allow the detailing I'd need for the cities without having unrealistic tile sizes.

Foregoing the realism: Something that came up while I was researching was that ancient cities were tiny by today's standards. Ancient Rome (the part encompassed by the Aurelian Walls) was only 5.3 square miles (for comparison, Manhattan is 22.96 square miles- enough to fit four Romes). I could forgo the realistic sizes of cities and make them the size I want for my mechanics.

Not including the entire world: Depending on the time-period I end up basing this off of, it may be pointless to include areas that effectively did not exist.

What is the best way to balance realism and mechanics for the scaling of a game world?

sentences:
Simulating an object floating on water I'm working on a top down fishing game. I want to implement some physics and collision detection regarding the boat moving around the lake. I would like for be able to implement thrust from either the main motor or trolling motor, the effect of wind on the object, and the drag of the water on the object.

I've been looking at the farseer physics engine, but not having any experience using a physics engine, I am not quite sure that farseer is suitable for this type of thing(Most of the demos seem to be the application of gravity to a vertical top/down type model).

Would the farseer engine be suitable? or would a different engine be more suitable?

sentences:
What is the most efficient way to add and remove Slick2D sprites? I'm making a game in Java with Slick2D and I want to create planes which shoots:

int maxBullets = 40;
static int bullet = 0;
Missile missile[] = new Missile[maxBullets];

I want to create/move my missiles in the most efficient way, I would appreciate your advise:

public void shoot() throws SlickException{
    if(bullet<maxBullets){
        if(missile[bullet] != null){
            missile[bullet].resetLocation(plane.getCenterX(), plane.getCenterY(), plane.image.getRotation());
        }else{
            missile[bullet] =
            new Missile("resources/missile.png", plane.getCenterX(), plane.getCenterY(), plane.image.getRotation());
        }
    }else{
        bullet = 0;
        missile[bullet].resetLocation(plane.getCenterX(), plane.getCenterY(), plane.image.getRotation());
    }
    bullet++;
}

I created the method resetLocation in my Missile class in order to avoid loading again the resource. Is it correct?

In the update method I've got this to move all the missiles:

if(bullet > 0 && bullet < maxBullets){
    float hyp = 0.4f * delta;
    if(bullet == 1){
        missile[0].move(hyp);
    }else{
        for(int x = 0; x<bullet; x++){
            missile[x].move(hyp);
        }
    }
}

sentences:
How do I check whether a camera has unobstructed view of a GameObject? I want to check if a GameObject is visible to the camera. The renderer.isVisible-method only checks if the camera is turned towards the object, not if there is anything between them (like a wall).

How can I check whether the object is actually visible?

sentences:
What are the advantages and disadvantages of overlap testing and intersection testing? I have been looking for the advantages and disadvantages of both overlap testing and intersection testing, but I was only able to find a few disadvantages; overlap testing may fail for objects moving very fast, and intersection testing makes assumptions that may lead to wrong predictions, such as a constant speed and zero accelerations.

What are the advantages and disadvantages of overlap testing and intersection testing?

sentences:
How to stop counting point when player dies (Destroy) In my game, I'd like to stop counting points when the player's y is -4. When the pink and red balls fall off the Plane the player gets points. But it seems a bit strange to be able to collect points after the player dies.

This is the code for the player:

     if (transform.position.y < -4)
    {
       Destroy(gameObject);
       gameManager.GameOver();
    }

And in the GameManager.cs I have this:

   public bool isGameActive;

   public void UpdateScore(int scoreToAdd)
   {
      score += scoreToAdd;
      scoreText.text = "POENG: " + score;
   }

   public void GameOver()
   {
      isGameActive = false;
      restartButton.gameObject.SetActive(true);
      gameOverText.gameObject.SetActive(true);
   }

And this is the code for adding points when the enemies fall over the edge:

    if (transform.position.y < -4)
    {
       Destroy(gameObject);
       gameManager.UpdateScore(pointValue);
    }

How can I make the game stop counting points when the player dies?

sentences:
How to store XMLs in Unity for web player deployment? I've created with Unity a short demo that works as a standalone .exe on Windows, and I was interested in deploying it as a web player game too.

When I run the game on the web player, though, I get this error in the Unity console:

  StreamingAssets is not available on this platform.

I have some XMLs I parse at runtime in the StreamingAssets folder. Where can I put them in a web player build so to be able at runtime to load them?

Thanks for your answers.

sentences:
Programming Pattern: Representation of pick up objects I'm pondering about the best way to represent objects that can be picked up in my 2D engine.

I have an Actor class which is the base for all objects that can be spawned into the game. This class offers a location and some other information needed by all actors.

Now, let's take an Apple for example. It's derived from Actor and carries with it all the information needed to be in the game-world. But when I pick this item up and put it inside an inventory, I don't need all that Actor stuff. So I was pondering. Does it make sense to maybe have an AppleActor class instead that derives from Actor, and inside it have an Apple class derived from something like InventoryItem?

When I pick up an Actor, I would take the InventoryItem out of it, store it in my inventory and destroy the Actor. Then, when I drop the InventoryItem, I would first create the corresponding Actor for it, put the InventoryItem inside it and spawn that Actor in the world.

Does this make sense at all? Any feedback or advice from more experienced people here is welcome.

sentences:
Why does Unity not detect my camera attached via the inspector? I want to use camera.ViewportToWorldPoint() to show the bottom center bounds of my screen. So, I created a script and added that component to my object that needs it.

using UnityEngine;
using System.Collections;

public class PathMovement : MonoBehaviour {

    public Camera cam;
    private Vector3 bound;

    void Awake () {
        cam = GetComponent<Camera> ();
    }

    void Start(){
        bound = cam.ViewportToWorldPoint (new Vector3 (0f, 0.5f));
        Debug.Log (bound);
    }
}

and then, I attach the MainCamera via the GUI

And then, when I run it, there's still an error says:

  MissingComponentException: There is no 'Camera' attached to the "RiverPath" game object, but a >script is trying to access it.
  You probably need to add a Camera to the game object "RiverPath". Or your script needs to check if >the component is attached before using it.
  UnityEngine.Camera.ViewportToWorldPoint (Vector3 position) (at C:/buildslave/unity/build/artifacts/generated/common/runtime/UnityEngineCamera.gen.cs:408)
  PathMovement.Start () (at Assets/Scripts/PathMovement.cs:21)

This is quite weird since I've attached the main camera, but somehow unity didn't detect that. I also have tried to put the cam = GetComponent<Camera>(); on Awake() as well as Start(), but none work. :(

This is an Android app, using Unity 5.

How do I do this correctly?

sentences:
Level data for Mario or similar platform game It has become a widespread to implement a Mario-clone to practise writing platform games or in order to demonstrate how a game engine works.

For that reason I expected it to be easy to find level data for Mario.

Are the levels of Mario in a ready to use format available?

Note: Edited to narrow the scope of the question.

sentences:
Need material for character anatomy in a 2D game. Spartan Like, See Picture I'm creating my art for an 2d based IOS game. I know some basic anatomy as you can see by the picture but I have no idea how I will make draw the pics for animation of the character walking, attacking with his sword and protecting himself with shield.

Is there any anatomy reference for 2d game out there, book or anything else?

for your information, I did try to find but all of stuff I found are very amateur and incomplete

The picture was my attempt of creating a example of the character walking, which I'm not happy with

please help, thanks

Update:

Since I am in a hurry I decided I would copy the anatomy from other 2d games, it is not that clean but at least I wanna be able to start it. The question is still open.

sentences:
Javascript-How to create a moving bullet animation from canvas the bullet cant see to move at all

function bullet() {
    this.x=playerx;
    this.y=playery;
    this.init=function(){
        this.x+=5;
        draw(this.x,this.y,10,10,"blue");
        console.log(this.x)
    }
}

in another function

if(k.keyCode==17){
    bullets=new bullet();
    bullets.init();
}

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:
Managing large amounts of data and processes for an economy management game I'm making a management game in the vein of Anno or Stellaris, but I'm unsure how to manage all my data efficiently.

Short example: the player controls multiple islands. Each island has factories on it. A factory has inputs, a process that does something with the inputs, and outputs. The process depends on the inputs and the outputs and other parameters. The outputs could be another factories input. A factory needs human workers. Human workers have stamina ... ... ...

So the question is: how do you manage so much data and processes programmatically? And it's not only about running many processes simultaneously, they also depend on each other and the data, use each other, inform each other - on each tick. You also need the ability to get information out of those sub processes and put data into it at any time.

I'm struggling to come up with a system/codebase that could handle those things. I've choose C#/dotnet core since I assume it has something to do with threading, but I still haven't got anything that works.

sentences: Java code to get android phone hardware specs Is there code available to view the specs of a phone that is running your application?

sentences:
Unity - SetActive() on GameObject dont works on child's objects I have the following line of code:

GameObject.Find("_obstacles").SetActive(false);

It serves to leave an inactive object, but the children of this object are not getting with the same status.

My result is:

  The objects children do not inherit the parent object state (as stated in the > documentation of Unity)!

But the obsolete method "SetActiveRecursively()" works for me! O.o The Very strange, no?

sentences: How do I zoom in using the App version of Twine? How do I zoom in using this program in Windows 10?

sentences:
How do I detect a destroyed object in Unity? I have an object in unity which is spawn through a script. Upon detecting that the object has taken substantial damage, objectDestroy is called and the object is removed.

However, I would like for a message to appear upon having this object destroyed. The code I posted below doesn't work.

hudText.Add ("Use Mouse 1 to fire !", Color.red, 2f);

while(trigger==false){
    if(enemy==null){

        Debug.Log ("Gone");

        yield return new WaitForSeconds(1);
        hudText.Add ("Nice work!", Color.green, 3f);

        trigger = true;
    }
    Debug.Log (trigger);
    yield return null;
}

I suspect that this has to with the fact that the object is destroyed at the end of the frame, but the while loop here never allows the loop to test for the following frame.

How do I do this?

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: Xna: Splitting one large texture into an array of smaller textures I would like to split a large texture into a one dimensional array of smaller textures. How should I do this?

sentences:
Driving Force GT: Force Feedback and Wheel Rotation I'm diving into the world of game development on PC and have a language agnostic question in regards to controller output.

I have in my possession a Logitech Driving Force GT. This particular steering wheel controller has force feedback (aka vibration or rumble) and the ability to turn the wheel through the game.

What are my options for interfacing with this advanced functionality (not the basic axis rotations and button presses)? I've read the DirectInput and xInput documentation with no luck. Is it like a propriety Logitech only API, or as simple as passing information via HID?

Any pointers that will lead me in the right direction would be greatly appreciated!

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:
#pragma target 3.0 or 3.5? What is gained. What is lost for compatibility with older systems I've just designed an image-based layering system shader. Multiple textures with Alphas overlay to create a fully dressed character, using 1 material.
pragma target 3.0 is where I had started (suggested default in UnityProjects).
After creating so many transparent-overlay layers in my code, I got this:
Shader error in 'Custom/Test': Too many texture interpolators would be used for ForwardBase pass (12 out of max 10)
The fix seems to be to upgrade to #pragma target 3.5
My game is going to be a Steam-distributed game, PC only.
What do I lose by using #pragma target 3.5? Will only super-dvanced PCs be compatible? Or should a fairly good/average PC be able to run this?
I don't know the intricacies of this subject.

sentences:
How should I manage states in my game? I can't understand what design pattern I can take advantage to build an intro screen, help screen, level select screen, game screen, game over screen, altogether.

I can make one in AS3, but the code becomes hugely messy.

That's what I sort of do. I would create a different class for each one but all classes don't share nothing in common, I just separate the classes to short the code in each file. The only parameter I pass on is stage as reference for all of them so that I can place the sprites and assets on the screen. I instantiate the game itself in a separated file and when the player reset the level that class would be re-instantiate or overwrite again. I run garbage collector in each class because there are some events I can't use reference.

Only I understand what I do, but as you can see it's certainly the wrong way since it has  became messy and hard to maintain. I learned by trial and error because I couldn't find examples showing how to code with OOP these layers or states(play, select, send score, play again and so on) of the game.

sentences: Unity Ads or Google Ads wich one is better? I don't know if i can ask this here, but i have a doubt about wich ad advertiser is better, a friend said unity and other said google... I want to know in general wich one is better? If there's one wich is better than both let me know. If i can't ask this here let me know and i delete this question :D thanks

sentences:
How to achieve realistic fake physics? In my opinion, games that are most entertaining to watch and play implement fake physics, the difficult issue is how to implement the fake physics and still allow it to appear realistic. Most popular car driving games implement this really well.

Question
Anyone has any tips or know of anywhere I can learn more about how these are implemented?

Long Story
For example, Need For Speed is entertaining when the player car crashes into the computer car, but it would not be fun if we land off the track each time the player collide. In the game, it is obvious that some game logic is in place to steer or land the player car upright, face correct direction and on track most of the time even after a massive collisions. The game instead causes the computer car to suffer heavier damages like flying of the screen after many spins etc to enhance effects.

As another example, suppose at a time instance, a speeding player car is driving at the close rear left of a computer car and real physics dictates in the next time instance the player will definitely bump into the computer and lose speed and control. Then at this point, the player could steer right to avoid the car, or steer left to bump into its rear. In an entertaining game, we may still want the player to avoid the front car completely if he steers away and experience an exciting near miss.

In NFS, this experience appears to be implmented in a few ways such as player auto-steer avoidance, scraping pass and rebound to right of computer, computer car steer away to avoid, computer gets hit but lose control and spin off track to give way to player.

On the other hand, it the player steers to engage in a collision, we want to add excitement to spin the computer very badly but still keep the player on track with a good speed.

In NFS, these fake collisions and steering are not easily noticeable as they feel very realistic even though if we study them closely, it looks almost like the are scripted. One method I have tried is to determine the final state of collision and then compute the path backwards. But this only ensures the car is in a desired final state, does not address the realism.

sentences:
How can I render text using the new(ish) JOGL GPU curve rendering classes? I'm fairly new to OpenGL/JOGL, working through various tutorials and books and making steady progress. Text, however, is an area where I'm stuck. I figured out one way using BufferedImage and Graphics2D to draw strings and then swizzle the pixels and copy to an OpenGL texture, but the quality is low, it is resolution dependent, and it's not efficient.

I found this: http://forum.jogamp.org/GPU-based-Resolution-Independent-Curve-Rendering-td2764277.html. Unfortunately while there are some demos in the GitHub repo I can't quite get my head around them. The code I've tried to use is below:

In the init() method:

    InputStream fontFile = getClass().getResourceAsStream("media/futura.ttf");
    try {
        font = FontFactory.get(fontFile, true);
    } catch (IOException e) {
        System.err.println("Couldn't open font!");
        e.printStackTrace();
    }

    RenderState renderState = RenderState.createRenderState(SVertex.factory());
    renderState.setColorStatic(1, 1, 1, 1);
    renderState.setHintMask(RenderState.BITHINT_GLOBAL_DEPTH_TEST_ENABLED);

    renderer = RegionRenderer.create(renderState, RegionRenderer.defaultBlendEnable, RegionRenderer.defaultBlendDisable);
    renderer.init(gl, Region.VBAA_RENDERING_BIT);

    util = new TextRegionUtil(Region.VBAA_RENDERING_BIT);

In the display() method:

    PMVMatrix pmv = renderer.getMatrix();
    pmv.glMatrixMode(GLMatrixFunc.GL_MODELVIEW);
    pmv.glLoadIdentity();
    pmv.glTranslatef(0, 0, -300);
    float pixelSize = font.getPixelSize(32, 96);
    util.drawString3D(gl, renderer, font, pixelSize, "Test", null, samples);

I've searched and searched for a tutorial on this stuff or a simple, commented code example explaining how it works but to no avail. If anyone can help me I'd be extremely grateful!

sentences:
Strange behavior of RigidBody with gravity and impulse applied I'm doing some experiments trying to figure out how physics works in Unity.

I created a cube mesh with a BoxCollider and a RigidBody. The cuve is laying on a mesh plane with a BoxCollider.

I'm trying to update the object position applying a force on its RigidBody.
Inside script FixedUpdate function I'm doing the following:

public void FixedUpdate()
{
    if (leftButtonPressed())
        this.rigidbody.AddForce( this.transform.forward * this.forceStrength, ForceMode.Impulse);
}

Despite the object is aligned with the world axis and the force is applied along Z axis, it performs a quite big rotation movement around its y axis.
Since I didn't modify the center of mass and the BoxCollider position and dimension, all values should be fine.

Removing gravity and letting the object flying without touching the plane, the problem doesn't show. So I suppose it's related to the friction between objects, but I can't understand exactly which is the problem.

Why this? What's my mistake? How can I fix this, or what's the right way to do such a moving an object on a plane through a force impulse?

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:
Is storing all game objects in a single list an acceptable design? For every game I've made, I just end up placing all my game objects (bullets, cars, players) in a single array list, which I loop through to draw and update. The update code for each entity is stored within it's class.

I've been wondering, is this the right way to go about things, or is a faster more efficient way?

sentences:
In PhaserJS, how do I get a clicked Physics.P2 body's data? I have a sprite with Phaser.Physics.P2 enabled, using a custom shape loaded with loadPolygon() from a .json file. I have also activated its debug and debugBody properties, so I can see the custom shape:

How could I collect the shape data information when I click on the debug shape?

For example, if I were to click the head of the sprite, can I get the polygon information from the click event?

sentences:
html/ javascript shop Im new to drop down menus. How can I make a working shop in html/javascript. I have this so far  http://prntscr.com/o15oj7   . I want help with the selling of a material part. i know i should use if statements but im not sure how to format the function . I want if bronze is selected for how much you can sell it for to be displayed. then if u press sell button you gain that much gold then lose 1 bronze.

var goldcoins = 0;
var goldcoins = 0;
var Bronzeprice = 10;
var Silverprice = 20;
var GoldPrice = 50;
var DiamondPrice = 100;
var ShrimpPrice = 10;
var BassPrice = 20;
var SalmonPrice = 50;
var SharkPrice = 100;

function sellItem(){
    var mylist=document.getElementById("myList");document.getElementById("favorite").value=mylist.options[mylist.selectedIndex].text;}

Html code:

   </style>
                   Shop

                       Auto Miner <button
onclick="buyMiner()"
    id="MinerCostBtn" >Buy</button>

                   Auto Fisher <button onclick="buyFisher()" id="FisherCostBtn" >Buy</button>

                <form>
                Sell:
                <select id"SellBox" >
                    <option> Bronze </option>
                    <option> Silver </option>
                    <option> Gold </option>
                    <option> Diamond </option>
                    <option> Shrimp </option>
                    <option> Bass </option>
                    <option> Salmon </option>
                    <option> Shark </option>
                    </select>
                    For:&nbsp;0 &nbsp;<button onclick="SellItem()" id="SellBtn" >Sell</button>

                  </form>

                  Gold Coins: 0

                  Buy skillpoint 100,000 gold <button onclick="buySkillPoint()" id="SkillPointBtn" >Buy</button>

                  Buy diamond 10,000 gold <button onclick="buyDiamond()" id="diamonddBtn" >Buy</button>

                  Buy shark 10,000 gold <button onclick="buyShark()" id="sharkkBtn" >Buy</button>

I expect when bronze is selected (etc) for how much you will gain from it to be displayed then when button is pressed for you to lose 1 bronze and gain that amount of gold. While the drop down menu is on that item. I have the variables on a diffrent javascript . i do that all those drop down button items . I just need to know how to format the funtion so if they are selected in the drop down menu that item will sell.

sentences:
I want to clamp each instance of the same prefab to the y axis only I instantiated the prefab "paddle" twice then I tried clamping it to the y-axis only; using Mathf.Clamp, however, the min and max values end up being applied to both instances of "paddle" and hence they can move in the x-axis

ok so I'm trying to make a 2d mobile pong game, I have a prefab "paddle" which are the rackets/bats which the balls collide with.

I instantiated the same prefab twice one on each side of the screen :

Paddle paddle1 = Instantiate(Paddle) as Paddle;
Paddle paddle2 = Instantiate(Paddle) as Paddle;
paddle2.Init(true); //right paddle
paddle1.Init(false); //left paddle

Now i want each of the paddles to only be able to move in the y axis (UP And DOWN).

So I tried clamping them with:

var poss = transform.position;
poss.x =  Mathf.Clamp(transform.position.x, -1.0f, 1.0f);
transform.position = poss;

However, this caused the left paddle to still be able to move to the right and the right paddle to be able to the left( I don't want them to move in the axis at all).

This is the file GameManager.cs:

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

public class GameManager: MonoBehaviour
{
    public Ball Ball;

    public Paddle Paddle;

    public static Vector2 topRight;
    public static Vector2 bottomLeft;

    // Start is called before the first frame update
    void Start()
    {
        bottomLeft = Camera.main.ScreenToWorldPoint(new Vector2 (0,0));
        topRight = Camera.main.ScreenToWorldPoint(new Vector2
        (Screen.width,Screen.height));

        Instantiate(Ball);

        //Paddle paddle1 = Instantiate(Paddle) as Paddle;
        Paddle paddle1 = Instantiate(Paddle) as Paddle;
        Paddle paddle2 = Instantiate(Paddle) as Paddle;
        paddle2.Init(true); //right paddle
        paddle1.Init(false); //left paddle
    }

    void Update()
    {

    }

}

This is the file paddle.cs:

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

public class Paddle : MonoBehaviour
{
    Rigidbody2D rb;
    float directionY;
    float speed;
    float height;

    float distance;
    string input;
    bool isRight;

    // Start is called before the first frame update
    void Start()
    {
        height = transform.localScale.y;
        speed=5f;
    }

    public void Init(bool isRightPaddle)
    {
        isRight = isRightPaddle;
        Vector2 pos = Vector2.zero;

        if(isRightPaddle)
        {
            //Place paddle on the right of the screen
            pos = new Vector2(GameManager.topRight.x, 0);
            pos -= Vector2.right * transform.localScale.x; //Move a bit to the left
        }
        else
        {
            //Place paddle on the left of the screen
            pos = new Vector2(GameManager.bottomLeft.x, 0);
            pos += Vector2.right * transform.localScale.x; //Move a bit to the right
        }

        //Update this paddle's position
        transform.position = pos;
    }

    void Update()
    {
        var poss = transform.position;
        poss.x =  Mathf.Clamp(transform.position.x, -8.0f, 8.0f);
        transform.position = poss;
    }
}

I expect each paddle to not be able to move in the x axis. Only in the y axis

c# unity3d mobile

sentences:
Box2D stable range and position Box2D marks stable range of object size is 0.1M ~ 10M. This specifies object size range. How about space size? If I make an 1M object at (1000.0f,1000.0f) position? Is it can be stable? Or should I assume spatial range is also limited same with object size?

PS. Maybe the resolution limit is defined because of limit of floating-point operations. I believe there's also some limitation on spatial range, but I couldn't figure out specific range myself.

sentences:
Should many constants utilize constant variables or a database? If you decide to design some sort of in-depth customization system for the player that utilizes a ton of different options, would you be better off using SQLite or just a whole bunch of constant variables in the program?

For instance, let's say you want the player to be able to build their own weapons. For a sword, they can put together a hilt, a blade, and maybe a jewel and inscription. That's 4 parts, of which there can be many different options, and that's just for one weapon. For the sake of example, let's say there are hundreds of different parts alone, which makes for a great number of combinations. The parts themselves are of course just weapon components, and don't have any special properties that need to be programmed - just certain attributes that say how they interact with the weapons (like which ones they can be attached to) and how they interact with other parts (if there is a special effect when combined with other ones, for instance - though this is probably better off programmed).

Presumably, this would allow for a great deal of customization, so there would be an in-game system in place that would allow the player to easily search for parts of a certain type/with a certain effect/of a certain element/etc. by using search filters, which sounds perfect for a database and not-so-perfect for program variables.

As a general question, how do you know when it is time to manage all of your constants through a database as opposed to doing it through the program? Is it the number of your variables? How valuable search/sort is? Will using a database quicken or slow the performance of these customization options?

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: Multiple directx runtimes in game I see by Process Explorer that many of Unreal Engine games load multiple DirectX runtimes. For example game Gears 5 in requirements has DirectX 12 only support, but uses DirectX 9 and 11 runtimes also. Is it correct - this because unreal engine developers don't remove\rewrite some code which uses old DirectX versions features to new and now we have many legacy code inside and games need this runtimes because of legacy?

sentences:
How can I simulate the sun's position for 3D lighting? I'm using a directional light as a light source. It dosn't have a positon, only a direction, represented by a vec3.

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

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

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

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

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

Any help is appreciated, thanks in advance!

sentences:
MonoGame Gamepad Y axis flipped? I'm following a book I bought on Google Play that is teaching me the ropes of MonoGame, and in Chapter 2 it introduces creating an input wrapper that takes care of all the input methods for a game pad or keyboard. What's supposed to happen is that the WASD keys is mapped to the same inputs that the right thumb-stick would be on the game pad, but what happens for me is that the WASD keys move up and down correctly, but on the game pad it is flipped for some reason. I've looked over every line that I think would cause the problem, even replacing my code with the source code in the book, and the project they provide as an example works perfectly, but my project using THEIR code does not. If anyone can look over my project and see what the problem could be, that would be awesome!

Project: Here

MonoGame Book (Would Recommend So Far): Here

sentences:
Time to render each frame is proportional to the amount of models in the scene This question is deliberately written in a "High-Level" manor to avoid screeds and screeds of code snippets, hopefully I can get my point across, I am using C++ and OpenGL.

I have a game engine, and in the engine I have my "game loop" that is called every frame, one of the things in this game loop is my call to Render(), before a call to SwapBuffers(), nothing new there.

Essentially my engine draws the scene using a scene graph, that is I have GameObject's and each object has a GameComponent. So when the Render() is called in the "game loop" I get the root GameObject and render its GameComponent and then move onto the next GameObject and render its GameComponent, etc. until all GameObject's and each of their GameComponent's are drawn using glDrawElements(...).

One of the GameComponent's a GameObject can have is a MeshRenderer, that is a Mesh paired with a Texture. In my scene I want to add loads of tree models, therefore I create for example 50 GameObject's that each have a MeshRenderer component (a tree) that will eventually in the game loop described above be drawn.

The issue with this is that the time it takes to render a frame is directly proportional to the number of tree models I have (O(N) I think is how you word it). For example with 100 trees the render time is 23ms, with 200 trees it is 46ms, with 400 trees it is 90ms so on and so forth.

This is terrible, I need at least 1000 trees in my "game world" and even at around 400 my game is "laggy". Because the time to draw a frame is proportional to the number of tees I know that each frame it is re-drawing each mesh essentially (every frame drawing 100 trees, and then 200 and so on, and the time to draw scales with it)

My question is this - How can I store the mesh data so that I don't need to draw them from scratch every frame, I can just draw them once, and then re-use that data for the next frame, but don't re-draw it all? is there a way to firstly use glDrawElements(...), then store that mesh data(all the vertices etc.) and then every frame after call something like for example glDrawExcistingElements() instead of  glDrawElements(...). Ultimately meaning that for consecutive frame draws the time is the exact same wether I have 1 tree or 1000 trees because the system is simply saying "here is the scene I already drew", instead of "lets draw it all again from scratch".

sentences:
How can I prevent my bullet from influencing other players when colliding with them? So when my bullet which is a Rigidbody is hitting another player which is also a Rigidbody, the bullet is getting destroyed immediately. But it seems that this isn't enough to prevent the physics to be applied. I guess that's why my player is getting pushed backward all the time when he is getting hit. I don't want this behaviour, so I tried to fix it :

I tried to lower the mass of the bullet which didn't help. I also tried to change the bullet behavior to a trigger, but the collision detection failed very often.

sentences:
Enemy AI chase twitching left and right to move vertically I'm making an enemy follow the player based on his possition and attack if he is within a distance and his last movement (if the enemy last moved to the left, it will attack to the left, etc.). It attacks just fine left and right but not up or down. I tried watching frame by frame to see what happened and discovered that the enemy was twitching left and right to get to the player even if it was above or below him, which is the reason it is recording the last move to the left or right and not attacking top or bottom.

This is the code I use to update the position to where the enemy is going to move (pposX and Y is the player's current position and stillLock the last direction to where the enemy moved)

        xMove = 0;
        yMove = 0;

        if(pposY < y){  //UP
            yMove = -speed;
            stillLock2 = 3;
        }
        if(pposY > y){  //DOWN
            yMove = speed;
            stillLock2 = 4;
        }
        if(pposX < x){  //LEFT
            xMove = -speed;
            stillLock2 = 1;
        }
        if(pposX > x){  //RIGHT
            xMove = speed;
            stillLock2 = 2;

And this is the method I call to create a rectangle with the range of the attack if the cooldown limit is met and hurt the player if it intersects it's collision bounds. (attack is a boolean var indicating enemy is ready to attack)

public void checkAttacks(){
    attack2Timer += System.currentTimeMillis() - lastAttack2Timer;
    lastAttack2Timer = System.currentTimeMillis();
    if(attack2Timer < attack2Cooldown){
        return;
    }

    Rectangle cb = getCollisionBounds(0, 0);
    Rectangle ar2 = new Rectangle();
    int arSize = 50;
    ar2.width = arSize;
    ar2.height = arSize;

    /*
     * Still lock diagram
     * 1 = Left
     * 2 = Right
     * 3 = Up
     * 4 = Down
     */

    //creates collision rectangle

    if(attack && stillLock2 == 3){          //UP
        ar2.x = cb.x + cb.width / 2 - arSize / 2;
        ar2.y = cb.y - arSize;
    }else if(attack && stillLock2 == 4){    //DOWN
        ar2.x = cb.x + cb.width / 2 - arSize / 2;
        ar2.y = cb.y + cb.height;
    }else if(attack && stillLock2 == 1){    //LEFT
        ar2.x = cb.x - arSize;
        ar2.y = cb.y + cb.height / 2 - arSize / 2;
    }else if(attack && stillLock2 == 2){    //RIGHT
        ar2.x = cb.x + cb.width;
        ar2.y = cb.y + cb.height / 2 - arSize / 2;
    }else
        return;

    attack2Timer = 0;

    //if something above happened, check collisions
    if(handler.getWorld().getEntityManager().getPlayer().getCollisionBounds(0, 0).intersects(ar2)){ //damages if player is there
        handler.getWorld().getEntityManager().getPlayer().hurt(1);
        return;
        }
    }

I would appreciate so much if anybody had an idea of how to fix this! (And I'm trully sorry about the code dump).

sentences:
How to properly differentiate single-clicks and double-click in Unity3D using C#? What I am trying to understand and learn here is a very basic thing: what is the most general and most polished way to properly differentiate single-clicks and double-clicks for the 3 main mouse buttons in Unity, using C#?

My emphasis on the word properly is not for nothing. Although I was surprised that this seems to have never been asked in this website before, of course I have searched and found numerous similar questions on Unity's forums and Unity's own question-answer pages. However, as it is often the case with answers posted in these resources, they all seemed to be either plain wrong or at least a bit too amateurish.

Let me explain. Proposed solutions always had either of the two approaches and their corresponding flaws:

every time a click happens, calculate time delta since last click and if it was smaller than a given threshold, a double click would be detected. However, this solution results in that a quick single click is detected before the double-click is detected, which is undesirable in most situations because then it activates both single and double click actions.

Rough example:

float dclick_threshold = 0.25f;
double timerdclick = 0;

if (Input.GetMouseButtonDown(0)
{
   if (Time.time - timerdclick) > dclick_threshold)
   {
       Debug.Log("single click");
       //call the SingleClick() function, not shown
   } else {
       Debug.Log("double click");
       //call the DoubleClick() function, not shown
   }
   timerdclick = Time.time;
}

set a wait-for delay for the single-click to be activated, which means, at every click, only activate single click actions if the time delay since last click is above a given threshold. However, this gives sluggish results, since a waiting before it is possible to notice the waiting before single-clicks are detected. Worse than that, this kind of solution suffers from discrepancies across machines, since it does not take into account how slow or how fast is the user's double-click speed setting at the OS level.

Rough example:

   float one_click = false;
   float dclick_threshold = 0.25f;
   double timerdclick = 0;

   if (one_click && ((Time.time - timerdclick) > dclick_threshold))
   {
       Debug.Log("single click");
       //call the SingleClick() function, not shown
       one_click = false;
   }

   if (Input.GetMouseButtonDown(0))
   {

       if (!one_click)
       {
           dclick = -1;
           timerdclick = Time.time;
           one_click = true;
       }

       else if (one_click && ((Time.time - timerdclick) < dclick_threshold))
       {
           Debug.Log("double click");
           //call the DoubleClick() function, not shown
           one_click = false;
       }

   }

Therefore, my questions becomes the following. Is there a more polished and reliable way of detecting double clicks in Unity using C#, other than these solutions, and one that handles the problems aforementioned?

sentences: Who know how to implement the 2D bone animation showed in the game? I wonder how do they implement the bone animation in the flash game http://www.foddy.net/athletics.swf Do you know any study materials which I can start to learn 2D bone system from? I just implemented a avatar system by compose multiple bitmaps in each frame(similar with maple story), but some guys tell me that, a bone system can save more art resources, so I want to learn some thing about that.

sentences:
LIBGDX fadeout, hide and remove action not triggered I try to execute an sequence of actions, but fadeout and following are not working for me. I can see the actor moving to the desired point, but after that it just stays there.

My code. personActor is an Actor of a list in my mainactor:

    SequenceAction sequence = new SequenceAction();
    sequence.addAction(Actions.moveTo(0, 300));
    sequence.addAction(Actions.moveTo(1000, 300,3f));
    sequence.addAction(Actions.fadeOut(0.5f));
    sequence.addAction(Actions.hide());
    sequence.addAction(Actions.removeActor());

    personActor.addAction(sequence);

The main actor loops through the list of childactors:

@Override
public void draw(Batch batch, float parentAlpha) {
    super.draw(batch, parentAlpha);
    for(PersonActor personActor : personenActors){
        personActor.draw(batch,parentAlpha);
    }
}

Do someone see, whats wrong here ?

sentences:
Avoid useless copies of buffers The other day I was looking at a opensource engine, basically it was uploading the image from a file to a RAM buffer adding some decoding while streaming (I assume this is done "in-cache" so I can't count the decoding as an extra copy), then the buffer was feeded to glTexImage2D.

According to GL specifications, glTexImage2D is free to keep a in-RAM copy of the image and wait for the best moment to upload it to the GPU.

So basically we have

From disk to RAM
From RAM to RAM
From RAM to GPU

Thos are basically 4-5 BUS runs x Textures Size in megabytes  bandwith payload

3 copies of the same data.

Isn't there anyway to reduce the copies to

From disk to RAM
from RAM to GPU

Or even

From disk to GPU

?

(Assuming hard-disk already have data in the correct memory layout and hence no decoding is necessary).

sentences:
glColor3f() 0.0 = no intensity 5.0 = full intensity? I have a very weird behavior of openGL's glColor right now.

I've wasted hours to detect why my line colors acting so weird until I found out that 0.0 rgb values is zero intensity and 5.0 lead to full intensity (yes NOT 1.0 it's not clamping!)

If I color a line with 1.0, 1.0 1.0 I get very dark grey instead of white.
If I color a line with 5.0, 5.0 5.0 I get white.
Here is my code:

gl.glDisable(GL2.GL_BLEND);
gl.glDisable(GL2.GL_TEXTURE_2D);

/* We need to disable any shaders to get colored lines */
gl.glUseProgramObjectARB(0);

gl.glColorMaterial(GL2.GL_FRONT_AND_BACK, GL2.GL_AMBIENT_AND_DIFFUSE );
gl.glEnable(GL2.GL_COLOR_MATERIAL);

gl.glBegin(GL2.GL_LINES);
for (int lineIndex = 0; lineIndex < lineSegments.getNumberOfLines(); lineIndex++) {
  gl.glColor3d(5, 0, 0);
  //gl.glColor3dv(lineSegments.getLineColor(lineIndex).data(), 0);
  gl.glVertex3fv(lineSegments.getLineStartPoint(lineIndex).floatData(), 0);
  gl.glVertex3fv(lineSegments.getLineEndPoint(lineIndex).floatData(), 0);
}
gl.glEnd();

gl.glEnable(GL2.GL_TEXTURE_2D);
gl.glEnable(GL2.GL_BLEND);

Why is OpenGL acting so weird on glColor? Did I miss a gl state or something?
I could scale up the colors so I bypass this, but I want to find out whats wrong here.

(The code example leads to a line that ist 100% red)

sentences:
How do you turn a cube into a sphere? I'm trying to make a quad sphere based on an article, which shows results like this:

I can generate a cube correctly:

But when I convert all the points according to this formula (from the page linked above):

    x = x * sqrtf(1.0 - (y*y/2.0) - (z*z/2.0) + (y*y*z*z/3.0));
    y = y * sqrtf(1.0 - (z*z/2.0) - (x*x/2.0) + (z*z*x*x/3.0));
    z = z * sqrtf(1.0 - (x*x/2.0) - (y*y/2.0) + (x*x*y*y/3.0));

My sphere looks like this:

As you can see, the edges of the cube still poke out too far. The cube ranges from -1 to +1 on all axes, like the article says.

Any ideas what is wrong?

sentences:
AI parameters for Tetris like game I am building an AI to play a variation of Tetris. The rules are changed in that there are 19 different types of pieces, rotation is not allowed, and the pieces can be placed anywhere in a 10X10 grid. Also, a line is removed once it is full (all 10 cells contain some block). I was trying to figure out which parameters I might choose in order to optimise how the game is played. Some obvious parameters which I thought of:

a) A piece should be placed in a position where it forms the maximum number of full lines, as they can be removed in the next step.

b) A piece should be placed to minimise the 'bumpiness' or roughness of the topmost surface, i.e, it should be as level as possible.

c) This is arguable, but the AI should try to keep as minimum height as possible.

d) The number of columns containing atleast one block should be minimised.

But the AI is still not playing good enough and keeps getting stuck. I would like to know if there are some other important parameters which I may be missing?

sentences:
Pull OVRCameraRig over RTS map via touch controller grabbing gesture Currently developing a little prototype RTS with the Oculus VR devkit.
I want to implement camera movement via "grabbing" onto the world space with a touch controller and move the OVRCameraRig object on the X- and Z-axes. For the prototype purpose, I rather decided to go with a simpler approach, namely just pull the map around, since it's not that big, and not much is happening on it.

So far I got this script:

public class MapMover : MonoBehaviour
{
    private bool movementEnabled;

    Transform map;
    Transform leftController;
    Vector3 offset;

    public bool IsMovementEnabled { get { return movementEnabled; } }

    private void Awake()
    {
        leftController = GameObject.Find("LeftHandAnchor").transform;
    }

    public void BeginMovement()
    {
        offset = transform.position - leftController.position;
        movementEnabled = true;
    }

    public void EndMovement()
    {
        movementEnabled = false;
    }

    private void LateUpdate()
    {
        if (movementEnabled)
        {
            transform.position = new Vector3(
                (leftController.position.x * 1.1f + offset.x),
                transform.position.y,
                (leftController.position.z * 1.1f + offset.z)
            );
        }
    }
}

BeginMovement() is called when I press the Hand Trigger on the left Touch controller. My current results are unproductive: The first BeginMovement() call is sufficient, but the movement of the map is very minimal, since the controller models are tiny and their position clamps around -1.0f and 1.0f. The second call of BeginMovement() makes the map do a jump to either side before going back to the minimal movement.

My question is, what exactly am I missing? Is there a simpler approach to this?

sentences:
XNA: How to Flip/Mirror a position over a custom vector? I want to flip Horizontally my Sprite/Texture however the SpriteEffects.FlipHorizontally isn't cutting it for me as it just flips the texture in place.

I want to flip the texture over a specified Vector2/Vector3?

Thanks!

sentences:
glDrawElements draws nothing As the title says…. :( nothing is drawn on screen… is there something I'm missing?

Mesh *Mesh_Create(GLfloat vertices[], GLuint indices[], GLfloat uvs[], GLfloat colors[])
{

Mesh *mesh = (Mesh*)malloc(sizeof(Mesh));

mesh->vertices = (GLfloat*)malloc(sizeof(vertices));
memcpy(mesh->vertices, vertices, sizeof(vertices));

mesh->indices = (GLuint*)malloc(sizeof(indices));
memcpy(mesh->indices, indices, sizeof(indices));

mesh->elementCount = sizeof(indices) / sizeof(GLuint);

glGenVertexArrays(1, &mesh->vao);
glBindVertexArray(mesh->vao);

glGenBuffers(1, &mesh->vbo[VERTEXBUFFER]);
glBindBuffer(GL_ARRAY_BUFFER, mesh->vbo[VERTEXBUFFER]);
glBufferData(GL_ARRAY_BUFFER, sizeof(mesh->vertices), &mesh->vertices, GL_STATIC_DRAW);
glVertexAttribPointer(0, 2, GL_FLOAT, false, 0, 0);
glEnableVertexAttribArray(0);

/*glGenBuffers(1, &mesh->vbo[TEXTUREBUFFER]);
glBindBuffer(GL_ARRAY_BUFFER, mesh->vbo[TEXTUREBUFFER]);
glBufferData(GL_ARRAY_BUFFER, sizeof(uvs), uvs, GL_STATIC_DRAW);
glVertexAttribPointer(1, 2, GL_FLOAT, false, 0, 0);
glEnableVertexAttribArray(1);
*/
glGenBuffers(1, &mesh->vbo[INDICESBUFFER]);
glBindBuffer(GL_ELEMENT_ARRAY_BUFFER, mesh->vbo[INDICESBUFFER]);
glBufferData(GL_ELEMENT_ARRAY_BUFFER, sizeof(mesh->indices), &mesh->indices, GL_STATIC_DRAW);

/*glGenBuffers(1, &mesh->vbo[COLORBUFFER]);
glBindBuffer(GL_ARRAY_BUFFER, mesh->vbo[COLORBUFFER]);
glBufferData(GL_ARRAY_BUFFER, sizeof(colors), colors, GL_STATIC_DRAW);
glVertexAttribPointer(3, 4, GL_FLOAT, false, 4 * sizeof(GLfloat), NULL);
glEnableVertexAttribArray(3);*/

/*glBindVertexArray(0);
glBindBuffer(GL_ELEMENT_ARRAY_BUFFER, 0);
glBindBuffer(GL_ARRAY_BUFFER, 0);*/

return mesh;
}

Mesh *Mesh_CreateQuad()
{

GLfloat vertices[] = { -0.5,  -0.5,
                        0.5,  -0.5,
                        0.5,   0.5,
                       -0.5,   0.5 };

GLuint indices[] = { 0,1,2,
                      0,2,3 };

GLfloat uvs[] = {   0 , 1,
                    1,  1,
                    1,  0,
                    0,  0 };

GLfloat colors[] = {    1, 1, 1, 1,
                        1, 1, 1, 1,
                        1, 1, 1, 1,
                        1, 1, 1, 1 };

return Mesh_Create(vertices, indices, uvs, colors);
}

void Mesh_Render(Mesh *mesh)
{
    glBindVertexArray(mesh->vao);
    glDrawElements(GL_TRIANGLES, mesh->elementCount, GL_UNSIGNED_INT, &mesh->indices);
}

sentences: How do you unzip a Texture2D from image or string from txt from a zip file using SharpZipLib How do you unzip a Texture2D from image or string from a txt file - contained in a zip file - using SharpZipLib or System.IO.Compression?

sentences:
Organising gameobjects into multiple lists I have a very simple little game that consists of a player, zombies, food, and treasure. It's all automated. The player will walk towards a zombie and shoot within a certain distance, which costs energy. If the player goes below a certain energy level, it will find the closest food item and walk towards that and once the player has reached it, the player will gain energy, and continue to move towards zombies and shoot them, until all are dead and the player will movie towards the zombie.
This is meant to be a way of learning object oriented programming for a class, so standard functional concepts such as ECS do not apply (and its so simple that would be overkill). Currently I have an array of GameObjects that all other objects such as player, zombie etc inherit from that gives them a position and an image to render (I'm aware an object shouldn't be responsible for its own rendering). All GameObjects are put into this array so I can interate through it and rendering everything which works fine. But not every entity requires an update, so I made an updatable interface, allowing classes that require updating to implement. So now i'm in  a situation where there are two lists, renderable game objects, and updatable game objects. My problem arises when the player must operate on a specific subset of entities at a time. e.g. find all the zombies or all the food items to determine which is the closest. So would it be better then, to have arrays of zombies, and arrays of food items instead that I can pass to the player to operate on? And since only 2-3 game objects will need to actually be updated, should I just not bother putting them into a list to be updated and just keep a list of all renderables, with seperate lists for all zombies and food items etc?
Any thoughts on how this could be best designed would be appreciated.

sentences:
Trouble with SAT style vector projection in C#/XNA Simply put I'm having a hard time working out how to work with XNA's Vector2 types while maintaining spatial considerations. I'm working with separating axis theorem and trying to project vectors onto an arbitrary axis to check if those projections overlap, but the severe lack of XNA-specific help online combined with pseudo code everywhere that omits key parts of the algorithm, googling has left me little help.

I'm aware of HOW to project a vector, but the way that I know of doing it involves the two vectors starting from the same point. Particularly here:

http://www.metanetsoftware.com/technique/tutorialA.html

So let's say I have a simple rectangle, and I store each of its corners in a list of Vector2s. How would I go about projecting that onto an arbitrary axis? The crux of my problem is that taking the dot product of say, a vector2 of (1, 0) and a vector2 of (50, 50) won't get me the dot product I'm looking for.. or will it? Because that (50, 50) won't be the vector of the polygon's vertex but from whatever XNA calculates. It's getting the calculation from the right starting point that's throwing me off.

I'm sorry if this is unclear, but my brain is fried from trying to think about this. I need a better understanding of how XNA calculates Vector2s as actual vectors and not just as random points.

sentences:
OpenGL using quaternion to rotate camera to avoid gimbal lock I read in many sources about using quaternion to avoid gimbal lock but I can't apply this practically in my code, so I have a camera class I want to rotate it with mouse so I have Euler angles Pitch and Yaw, I have a camQuat qauaternion to store the rotation quaternion each frame, so I have the initCamera method which initialize the camera:

void Camera::initCamera(glm::vec3& pos, glm::vec3& center, GLfloat yaw, GLfloat pitch) {
    view = glm::translate(view, center - pos);
    camQuat = glm::quat(glm::vec3(glm::radians(pitch), glm::radians(yaw), 0.0));
    camQuat = glm::normalize(camQuat);
    glm::mat4 rot = glm::mat4_cast(camQuat);
    view = view * rot;
    view = glm::translate(view, pos - center);
}

then each frame I update the camera by this method

void Camera::rotate(GLfloat xoffset, GLfloat yoffset, glm::vec3& c) {
    xoffset *= this->mouseSensitivity;
    yoffset *= this->mouseSensitivity;
    view = glm::translate(view, c);
    glm::quat q(glm::vec3(glm::radians(yoffset), glm::radians(xoffset), 0.0f));
    q = glm::normalize(q);
    glm::quat temp(q);
    q = q * camQuat * glm::conjugate(q);
    camQuat = temp;
    glm::mat4 rot = glm::mat4_cast(q);
    view = view * rot;
    view = glm::translate(view, -c);
}

this makes the rotation but with gimbal look, what is the bug in my code or what is the right way to use quaternion to prevent the gimbal look?

Edit: the first image is the normal camera FPS the rotation should be around the x and y axis only (No Rolling), once I rotate around any axis (as I read until the angle becomes 90) the gimbal lock appear and the camera begins to roll around z like the second image.
enter image description here

Solution: due to DMGregory link below this code works fine:

void Camera::rotate(GLfloat xoffset, GLfloat yoffset, glm::vec3& c, GLboolean constrainpitch) {
    xoffset *= this->mouseSensitivity;
    yoffset *= this->mouseSensitivity;
    glm::quat Qx(glm::angleAxis(glm::radians(yoffset), glm::vec3(1.0f, 0.0f, 0.0f)));
    glm::quat Qy(glm::angleAxis(glm::radians(xoffset), glm::vec3(0.0f, 1.0f, 0.0f)));
    glm::mat4 rotX = glm::mat4_cast(Qx);
    glm::mat4 rotY = glm::mat4_cast(Qy);
    view = glm::translate(view, c);
    view = rotX * view;
    view = view * rotY;
    view = glm::translate(view, -c);
}

I get the quaternion for both x and y then post multiply the QX by the view matrix then pre multiply the QY by the view matrix, the idea is rotating pitch globally and yaw locally to avoid unwanted creeping roll.

sentences:
Assets bundles have higher size than uncompressed sprites I've created a script that generates assets bundles by compressing sprites using LZ4 compression. I need this in order to generate smaller files that I'll download from a server at runtime but after taking a look at those bundles. I've found out that they actually have a higher size than the uncompressed sprites.
For example, I've generated a bundle from three sprites that have a size of 201KB together, but if I take a look at its generated bundle, its size is 300KB. This is only one example, there are other bundles that are 6MB but their original files are only 500KB and that doesn't make any sense to me. Can someone point me in the right direction?

sentences:
How to march tiles together like in Terraria? I've been trying to get tile marching to work like in Terraria, and I got something to work. I don't think it's actually very good way of doing this, so I'm wondering what would be really the main way of doing this.

Here's a picture of what I want to accomplish:

As you can see, this really does the thing that I want, but it's so horrible looking and it'd be a pain to extend for different types of tiles.

Here is my code for this. I coded this as a test, so my full game would use tile classes etc.

for x, tile in enumerate(row):
    if tile:
        try:
            air = row[x + 1]
        except Exception:
            pass
        else:
            if not air:
                if not LEVEL[y - 1][x]:
                    tile = 3
                else:
                    tile = 6
        air = row[x - 1]
        if not air:
            if not LEVEL[y - 1][x]:
                if tile == 3:
                    tile = 5
                else:
                    tile = 4
            else:
                if tile == 6:
                    tile = 8
                else:
                    tile = 7
        LEVEL[y][x] = tile
for y, row in enumerate(LEVEL):
    for x, tile in enumerate(row):
        if LEVEL[y - 1][x] in (6, 3, 14):
            try:
            pos = LEVEL[y][x + 1]
        except Exception as e:
            print(e)
        else:
            if pos in (2, 3):
                LEVEL[y][x] = 11
    if LEVEL[y - 1][x] in (7, 4, 15):
        pos = LEVEL[y][x - 1]
        if pos in (2, 4):
            LEVEL[y][x] = 12
    if LEVEL[y - 1][x] in (5, 8):
        if LEVEL[y][x] == 1:
            LEVEL[y][x] = 13
    if LEVEL[y][x] == 6:
        if LEVEL[y][x - 1] in (2, 4):
            LEVEL[y][x] = 14
    if LEVEL[y][x] == 7:
        try:
            tile = LEVEL[y][x + 1]
        except Exception as e:
            print(e)
        if tile in (2, 3):
            LEVEL[y][x] = 15

The basic idea behind this is just to look for some air and dirt, and set the tiles image from those.

Basically then when I'm drawing this I just take the value at a coord and blit the corresponding image to the screen.

So how would I go about making this as readable and easily extendable as possible? Does anyone know how Terraria handles this?

sentences:
What is Serialization? I have been around programming for a while as a hobby, but I did not start seeing this concept until recently. I have google'd "what is serialization" numerous times, but I never actually get any sort of definition, usually just examples of how to do it. I am seeing it around the Ogre forums, the Bullet forums, and every other forum I go to, so I think it is about time I actually understand what it is, and why to use it.

Edit

To clarify, I am looking more for why to use it, especially in the sense of game programming. For example, the Bullet Physics API talks a lot about serializing a mesh, so I want to understand why that is.

Thank you :)

sentences: Is there any reasons to make sprites and bodies line up? So in LibGDX the Sprite objects position is where it's 0,0 mark is in the word.  In Box2D a a bodies position is in it's center.  So to line these up when you update the sprites position with the bodies position you would adjust it by half the width and height. But it seems to me theres no reason to worry about that. Because the relative position is always going to be the same, and that it'll just waste calculations lining it up. Is there any reason I should do it?

sentences:
Make character move behind object I used Tiled Editor for making maps for my own game, I do not run any engine or anything. I have separated terrain layer and object layer in TiledEditor.

However I have problem with trees I want to make my character move behind the tree. But I have no idea how because even if it is different layer I am still rendering it by 8x8 pixel blocks.

Now my character is always on top as it is the last thing that I render.

But if I change the render order my character would be behind the tree even if the character will stay in front of the tree like this:

sentences:
UI clicks hitting the GameObjects below I've made a simple script which makes a mesh with a collider act like a button. However the mesh button get clicked through the UI.
I figured out how to fix this in editor, however this problem still occurs on the android device (did not test iOS)

    using UnityEngine;
    using UnityEngine.Events;
    using UnityEngine.EventSystems;

    public class MeshButton : MonoBehaviour {
        public bool Interactable = true;
        public UnityEvent onClick;

        private void OnMouseDown() {
            if (Interactable) {
                if(IsPointerOverGameObject()) return;
                onClick.Invoke();
            }
        }

        private bool IsPointerOverGameObject()
        {
#if UNITY_ANDROID || UNITY_IPHONE
            Touch touch = Input.touches[0];
            return EventSystem.current.IsPointerOverGameObject(touch.fingerId);
#else
            const int fingerId = -1;
            return EventSystem.current.IsPointerOverGameObject(fingerId);
#endif

        }
    }

sentences:
Dungeon Generation with no corridors and room dependencies I'm making a game with a procedurally generated world created at the beginning of the game, consisting of several areas represented by grids (say, 8x8, 9x6, the sizes would ideally be arbitrary). These areas are supposed to be connected to each other through a dependency list.

A connection exists when at least 3 spaces of that grid are exposed between those two areas. In the middle cell of that 3 space connection area is the doorway between areas:

I've been trying to figure out a way to connect them, but it becomes increasingly complex the more areas you need to consider at the same time.

I've tried some paper prototyping and while it's a very simple process when doing it visually, I haven't found out a good set of mathematical expressions that allows me to place rooms with the same efficiency by code.

Here's a "simple" example I'm struggling with right now:

Area 'a' needs to be connected to 'b' and 'c'
Area 'b' needs to be connected to 'a' and 'd'
Area 'c' needs to be connected to 'a' and 'd'
Area 'd' needs to be connected to 'b' and 'c'

Consider, for simplicity, we're placing the rooms by their order of appearance on the list (I've tried others). So I'm approaching this as your standard procedural Dungeon Generation algorithm.

We place 'a' anywhere on the board, since it's the first area. Next, we pick a wall at random and, since nothing is connected to that wall, we can place 'b' there:

Now we need to place 'c', but 'a' is already on the board, and has an occupied wall, so we decide to put it on another wall. But not every placement will do, because 'd' is coming up and it needs to be connected to 'b' and 'c' too:

I tried a possible limitation that 2 rooms that have the same set of dependencies cannot be on opposite walls, but even that doesn't guarantee success:

And in other cases, where the areas have different sizes, being on opposite walls can work:

Also, not considering a used wall is a flawed assumption since it rules out valid solutions:

I've tried looking up research on other Procedural Generation algorithms or similar, such as Optimal Rectangle Packing and Graph Layout algorithms, but usually those algorithms don't take into account every constraint of this problem and are hard to mix together.

I thought about a bunch of approaches, including placing an area and backtrack until a suitable placement is found, but they seem very dependent on trial and error and costly in terms of computation. But, given the extensive research on the last two problems I mentioned, it might be the only/best solution?

I just wanted to see if someone has had similar problems in the past or is willing to help me figure this out and give me a few pointers on where I should start with the algorithm. Or, failing that, I'll have to look into loosening the constraints I've set.

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:
Unity - Handling external data files I'm moving from an old game dev tool to Unity, and wondering how to go about handling external data files.
In my previous program I'd set up external (txt/ini) files like this:
[Group1]
Count=1
1=Hello

[Group2]
Count=2
1=lol
2=end

Then I would simply reference which group name and line I wanted to pull.
What's the equivalent to this in unity? I see I can import TextAssets but I can't find functions to pull select data from it. Do these exist?
Do I have to split by lines, loop through them all and convert it into groups (lists) manually? What is the standard method for doing this? Is it moving to xml files?

sentences: What do game developers do when they have to port their DirectX games to PS4/Switch? I'm not a game developer (hope to be one day though!) and was wondering how devs handle porting their games that use DirectX to PS4/Switch? From what I know neither supports DirectX, only OpenGL, and Vulkan. Do the devs just have to recreate their game with OpenGL or Vulkan? That seems like a lot of work. I'd imagine it would probably be a fairly common scenario, especially with AAA games so I'd assume that there would be something somebody has made to make it easier?

sentences:
Turn and point Animation not ending in correct position I have Right Turn, Point & talk Mixamo animation. I am playing animation in this order

Play Idle animation
Turn animation
Point Animation
Then, run Turn animation again with - speed to bring it back(reverse)
and then finally played Idle animation and loop continue.

But the problem is, each time when I return from step 4 my character rotation is different. And over different iterations the character rotation become completely changed. The rotation of the character increment in each iteration. How can I solve this problem? I am learning this but unable to understand.

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:
Physics engine deltaTime and force acceleration I am working on a physics engine that uses basic Euler integration to compute forces. So, here is the thing:

function applyForce (rigidbody, force) {
    rigidbody.forces.add(force);
}

function computeAcceleration (rigidbody) {
    rigidbody.acceleration = rigidbody.forces / mass;
    rigidbody.velocity = rigidbody.velocity + rigidbody.acceleration * time.deltaTime;
}

// The forces are reset after each gameloop

So now imagine I want to apply a force to jump, I will use applyForce at the moment the player presses the jump button.

But: What happens is that the amount of movement depends on the gameloop speed, since the force is applied for a single frame. I feel like I missed something about how you should use forces, but I don't see how I should manage it properly.

In which cases should we use a force, considering this deltaTime issue? And also, what should I use instead?

sentences:
Who should manage projectiles? I was following a tutorial that was recommended to me to learn the basics of game design through XNA. And I got to this tutorial:
http://www.xnadevelopment.com/tutorials/thewizardshooting/thewizardshooting.shtml

This is the tutorial that shows management of dynamic object generation and handling.

In the tutorial, he links the "Fireball" class to the "Wizard" class. The wizard class maintains a List<Fireball> and they're updated, drawn, loaded, etc. within the Wizard class itself.

My question is this: Is this good design? Should the Producer of the Objects be the one to manage them, or would it be better to implement, say, a ProjectileHandler class, that could manage the fireballs shot both by the Wizard and the Evil Dragon?

sentences:
LibGDX controllers: how to fix crashes in JRuby? I'm using JRuby with LibGDX and it's been going quite swimmingly, save for a crash I experience every time I try to use the controllers extension.

Here's a basic rundown:

I've required all the related jars (gdx-controllers.jar, gdx-controllers-desktop.jar, and gdx-controllers-desktop-natives.jar).
I've imported the controllers package via import "com.badlogic.gdx.controllers".
I call Controllers.controllers, which goes to the getControllers method.
My game crashes with this error:

libc++abi.dylib: terminating with uncaught exception of type OIS::Exception: CocoaInputManager::_parseConfigSettings >> Unable to find a window or event target

I think the error is due to a lack of a view being passed to OIS library (here's an online view of a related source).

How do I prevent the controllers extension from crashing my game? More importantly, how do I make it work? :)

sentences:
Monogame 3.3 SoundEffect play Freezes After using Monogame 3.3 with Xamarin Android, SoundEffect.Play method freezes the game. I try to convert wav files 8bit mono, 16bit mono no changes. This error on Samsung T101 android 4.0.3 but SoundEffects works with another android device which has 4.2.2.

I don't have this problem with Monogame 3.2. Any suggestion?

Thank you!

Android debug log below.

The thread 'Unknown' (0x4) has exited with code 0 (0x0).
Failed to generate OpenAL data buffer:
04-22 23:34:04.380 I/mono-stdout(10068): Failed to generate OpenAL data buffer:

Failed to get buffer bits: , format=Stereo16, size=73632, sampleRate=44100
04-22 23:34:04.380 I/mono-stdout(10068): Failed to get buffer bits: , format=Stereo16, size=73632, sampleRate=44100
04-22 23:34:04.390 D/Mono    (10068): DllImport searching in: 'openal32.dll' ('./libopenal32.so').
04-22 23:34:04.390 D/Mono    (10068): Searching for 'alDistanceModel'.
04-22 23:34:04.990 D/Mono    (10068): Image addref System.Runtime.Serialization[0x28084d0] -> System.Runtime.Serialization.dll[0x27ef090]: 1
04-22 23:34:04.990 D/Mono    (10068): Assembly System.Runtime.Serialization[0x28084d0] added to domain RootDomain, ref_count=1
04-22 23:34:04.990 D/Mono    (10068): AOT module 'System.Runtime.Serialization.dll.so' not found: Cannot load library: load_library[1091]: Library '/data/data/com.homemadegames.exterminator/lib/System.Runtime.Serialization.dll.so' not found
04-22 23:34:04.990 D/Mono    (10068): Assembly Ref addref MonoGame.Framework[0x1c80558] -> System.Runtime.Serialization[0x28084d0]: 2
04-22 23:34:04.990 D/Mono    (10068): Assembly Ref addref System.Runtime.Serialization[0x28084d0] -> mscorlib[0x1c66118]: 9
04-22 23:35:31.110 D/dalvikvm(10068): GC_CONCURRENT freed 159K, 5% free 8403K/8775K, paused 5ms+1ms
04-22 23:38:12.350 D/dalvikvm(10068): GC_CONCURRENT freed <1K, 2% free 8905K/9031K, paused 5ms+1ms

sentences:
How do I detect a given sprite's bounds automatically using Java? Background

I have the following png file that contains the player sprite.

As with any png file, the non-colored pixels are transparent.

(Width: 16px; Height: 16px)

Currently, I can erect a rectangle (collision-bounds), using java.awt.Rectangle around the image using the image's width and height, as seen below.

I would like to crop the image so that the width and height are changed to the edges of the colored portion of the image, much like what is shown below.

This will allow for more accurate collision-detection between entities or objects in a game.

I want to construct a method that handles this modification dynamically, as seen below.

//Method calculates how far in from [top, bottom, left and right]
//the [non-zero] or [transparent] pixel-data of an image are
//in order to construct a new image that starts at the edges
//of the colored portion of the image.
public BufferedImage adjustImage(BufferedImage image)
{
    BufferedImage result = null;

    return result;
}

Problem

However, I am uncertain as to the algorithm to use to achieve the result above.

Can anyone give a step-by-step on how to detect these bounds and how to implement such a fuction as described above?

sentences:
Processing component pools problem - Entity Subsystem Architecture description

I'm creating (designing) an entity system and I ran into many problems. I'm trying to keep it Data-Oriented and efficient as much as possible. My components are POD structures (array of bytes to be precise) allocated in homogeneous pools. Each pool has a ComponentDescriptor - it just contains component name, field types and field names.

Entity is just a pointer to array of components (where address acts like an entity ID). EntityPrototype contains entity name and array of component names. Finally Subsystem (System or Processor) which works on component pools.

Actual problem

The problem is that some components dependents on others (Model, Sprite, PhysicalBody, Animation depends on Transform component) which makes a lot of problems when it comes to processing them.

For example, lets define some entities using [S]prite, [P]hysicalBody and [H]ealth:
Tank:   Transform, Sprite, PhysicalBody
BgTree: Transform, Sprite
House:  Transform, Sprite, Health

and create 4 Tanks, 5 BgTrees and 2 Houses and my pools will look like:

TTTTTTTTTTT // Transform pool
SSSSSSSSSSS // Sprite pool
PPPP        // PhysicalBody pool
HH          // Health component

There is no way to process them using indices. I spend 3 days working on it and I still don't have any ideas. In previous designs TransformComponent was bound to the entity - but it wasn't a good idea. Can you give me some advices how to process them? Or maybe I should change the overall design? Maybe I should create pools of entites (pools of component pools) - but I guess it will be a nightmare for CPU caches.

Thanks

sentences:
Resolving collisions with float precision errors I'm facing a problem when I try to resolve the collision between two units using floats as positions of the units in my game.

I am detecting the collisions using the SweptAABB algorithm and if there is a collision I fix it by using the normalized collision time that the SweptAABB function returns. Something like this:

collisionTime = SweptAABB(unitA, platform)
fixedPosition = (currentPos - previousPos) * collisionTime;

This generally works fine but not always, due of the floats precision errors the fixedPosition can result in a VERY SMALL overlap.
For example: suppose that the fixedPosition for the Y axis should be 12.345234 to avoid the collision but instead of getting that value (after multiplying by the collisonTime) I get something like 12.345239 (a difference of 0.000005) and when eventually the overlap method is executed it will still detecting the overlap:

public boolean overlap(AABB b) {
    Vector2 distance = new Vector2(b.position).substract(position);

    return Math.abs(distance.x) < (extents.x + b.extents.x)
        && Math.abs(distance.y) < (extents.y + b.extents.y);
}

So I decided to start changing the code so that I can get the face of the box that collides and use simple arithmetic addition of the positions instead of multiplication but this also fails for the same reason. For instance, suppose this:

// unitA collides with unitB at this point in the X axis:
float unitB_Face_X = 0.7466669f;
// since position is defined at the center of the unit I move unitA to the right:
float unitA_Fix_X = unitB_Face_X + 2;

But unitA_Fix_X will result in a slightly different value (2.746667) that will eventually be detected as an overlap.

Just a clarification: My game is like Super Mario Bros, a 2D platform. I dont need fine precision, two decimals places (or one) is more than enough for my game world (each unit character has 1f for width and 2f for height).

I think that there must be a correct way to deal with this kind of problem (every 2d platform game out there has solved this problem). I have only think in one solution: Use integers instead of floats for the position of every unit in my game. I cannot avoid floats completly  because of deltaTime (also libgdx uses them for the sprites positions and rendering), but I think I can make the integer conversion at the begining of each frame by doing something like this:

float fPos = unitA.velocity * deltaTime;
int intPosition = (int)(fPos * 1000);

And use the intPosition for detecting and resolving the collisions. After that I will have to convert it back to float for rendering the sprites.

Is this a bad approach? I dont want to shoot my self in the foot.
Thanks in advance.

sentences:
Simple Stupid Funnel Algorithm (SSFA) for 3D Navigation tl;dr I need an algorithm similar to SSFA except for portals with 4 vertices (or n vertices if an algorithm like that exists).

I'm working on a game that requires pathfinding in 3 dimensions. By this I mean agents have full control over their position as opposed to many games where agents only control forward, back, left, right, and need to walk up stairs or ramps to go up and down.

To do this I made a "nav-mesh" using an octree that checks for collision at each region, and subdivides if there is a collision (until a certain cube size limit). So I now have a graph where each node is a cube with some size based on the octree. Using this I can run the A* algorithm for pathfinding on the graph.

Unfortunately, just moving towards the center of each node looks bad, and even moving towards the center of each connecting face of the node (the smaller of the two connected node's adjacent faces) looks bad.

In the past, I've used the SSFA for path simplification, but it only applies to situations with an edge as a portal, not a face. Is there an algorithm for this, or is there a way to make my pathing look better?

Ninja-edit: I'm already somewhat using steering behaviors, but since the center of nodes can vary wildly, based on the complexity of the octree, it still doesn't look nice.

sentences:
How do I perform my "String.Format" call with correct localisation? I am currently using this to create a string of a certain length from an integer variable. This is the only way I know of, at the moment; but Android Studio complains, saying it won't work work in all countries.

I will soon have some games that I might release on to the Play Store, and I wouldn't want there to be any unnecessary problems like this.

Is there a better way to achieve the same thing without reams of new code?

timeRemainingLabel = new Label(String.format("%03d", worldTimer),
        new Label.LabelStyle(font, Color.WHITE));

sentences:
How to make an enemy projectile head to the player's position with constant speed How can I dynamically set the movement speed of the X and Y of the projectile so that it moves at a constant speed when the projectile heads at the player's position? I know this has something to do with vectors but I don't really have an idea how to do it. My current implementation of the speed is getting the difference of the x and y positions so what happens is that the projectile will be slower the nearer the player is to the enemy. I set the projectile's speed using the code below:

projectile.moveSpeedX = Math.abs(position.x - targetPlayer.position.x);
projectile.moveSpeedY = Math.abs(position.y - targetPlayer.position.y);

Below is the contents of the update(float delta) method of the projectile:

if(xdirection == LEFT) {
    position.x -= moveSpeedX * delta;
}
else if(xdirection == RIGHT) {
    position.x += moveSpeedX * delta;
}

if(ydirection == UP){
    position.y -= moveSpeedY * delta;
}
else if(ydirection == DOWN) {
    position.y += moveSpeedY * delta;
}

The movement will slow down when the player is near the enemy since the distance between them is small. The speed is the problem although this already makes the projectile head to the player's position.

sentences: AndEngine - Dragging a sprite that has a path modifier registered to it I'm looking to be able to drag a sprite that is currently on a path from a path modifier.  Currently, I have sprites on a path, and I have stationary sprites that are draggable.  However, simply overriding the sprite's onAreaTouched doesn't work until the sprite completes its path.  How would I do this?

sentences:
Shader registers for different graphics card The title is not very explicative, so i'll try to make myself clear.
I have two "working"(on which i work on) PCs : a desktop that runs an NVIDIA GT440 an a laptop with a RADEON HD 4650. I have a shader for multipass rendering that uses both POSITION0 and POSITION1 registers for the vertex shader output :

struct VS_OUT
{
    float4 Position : POSITION0;
    float4 WorldPosition : POSITION1;

   // More variables for normal mapping and more
};

This code works just fine on my desktop, but when i run it on my laptop the rendering is screwed. I finally tracked down the problem to the POSITION1 output parameter, if i change it to TEXCOORD0 it works. Now ... i don't like to do things i do not understand, so i'd like to understand WHY it happens.

It's something GPU related for sure, but i'd be glad if you could link me some papers, articles or anything that explains how the registers work, and why not... even something in-deep about the programmable pipeline.

Thank you for your time and happy coding!

sentences:
Space Invaders-type game: Keeping the enemies aligned with each other as they turn around? OK, so here's the lowdown of the problem I'm trying to solve.

I'm developing a game in PyGame that's a cross between Space Invaders and Columns.  I'm trying to make the motion of the enemies similar to that of the aliens in Space Invaders; that is, they're all clustered in a grid, and if even one hits the side of the screen, the entire formation moves down and turns around.  However, the motion of these aliens is continuous (as continuous as a monitor can be, anyway), not on a discrete grid like in the original.

The enemies are instances of an Enemy class, and in turn they're held by a 2D array in a enemysquadron module (which, if you don't use Python, is in this case essentially a singleton due to the way Python modules work).

Inside the Enemy class I have a class-scope velocity vector that is reversed every time an Enemy object touches the edge of the screen.  This won't do, though, because as time goes on the enemies just become disorganized and jumbled (i.e. not in a grid as planned).  I haven't implemented the Enemies going downward yet, so let's not worry about that right now.

Any tips?

sentences: What is the name of the AI/algorithm used by most MMOs for monsters or mobs? Is there a standard name for the (fairly dumb) AI that most MMOs use where you 'aggro' a monster/mob when you are within a certain radius of it, and the monster chases your character for a set amount of time or distance when you attempt to run away?

sentences:
How can I access LWJGL's Keyboard from a thread other than the graphics thread? I'm loving LWJGL, but have been running into a number of odd problems with it. Most of it seems to deal with the fact that OpenGL is a state-machine and was only ever meant to be accessed from a singular thread.

However, I'm dealing with OpenAL and input as well, and they are both bound pretty tightly into LWJGL. In spite of the fact that they are entirely independent of graphics, I have been getting an IllegalStateException every time I try to access Keyboard.isKeyDown outside of the graphics thread. It's hard to emphasize how important it is to me that I have a new thread for each feature of this project; the classic game loop will not do the job.

How do I accomplish this? There must be a way.

sentences:
Unity C# 2D Platformer Main Camera should stop on sides of level I've been working on a 2D Platformer and i succeeded in setting up a script for my Main Camera to follow my Player gameobject using transform positions.

Now when my character is near the sides (or ends) of my level, it's showing dead space, blue space if you will. I want my camera to stop when it reaches the edges of my background sprite(end of level).

Here's my script that is attached to the Main Camera so far:

using UnityEngine;
using System.Collections;

public class CameraSmoothFollow : MonoBehaviour
{

public GameObject cameraTarget; // object to look at or follow
public GameObject player; // player object for moving

public float smoothTime = 0.1f;    // time for dampen
public bool cameraFollowX = true; // camera follows on horizontal
public bool cameraFollowY = true; // camera follows on vertical
public bool cameraFollowHeight = true; // camera follow CameraTarget object height
public float cameraHeight = 2.5f; // height of camera adjustable
public Vector2 velocity; // speed of camera movement

private Transform thisTransform; // camera Transform

// Use this for initialization
void Start()
{
    thisTransform = transform;

}

// Update is called once per frame
void Update()
{
    if (cameraFollowX)
    {
        thisTransform.position = new Vector3(Mathf.SmoothDamp(thisTransform.position.x, cameraTarget.transform.position.x, ref velocity.x, smoothTime), thisTransform.position.y, thisTransform.position.z);
    }
    if (cameraFollowY)
    {
        // to do
    }
    if (!cameraFollowX & cameraFollowHeight)
    {
        // to do
    }

}

}

sentences:
How do I keep vertex position when changing material? I've created 2 shaders using shader graph which I'm applying to a sphere to simulate a ball of water/ice. The water shader distorts the shape of the sphere over time to look like it's flowing a bit. What I would like to do is swap the shader from water to ice, and keep the shape of the distorted sphere when the materials swap over.
I'm pretty new to unity and shaders in general so I don't know where to start.

sentences:
How to deal with OpenGL and Fullscreen on OS X I do most of my development on OS X and for my current game project this is my target environment. However when I play games I play on Windows. As a windows gamer I am used to Alt+Tab switching from within the game to the last application that was open.

On OS X I currently can't find either a game that supports that nor can I find a way to make it possible.  My current project is based on SDL 1.3 and I can see that cmd+tab is a sequence that is sent directly to my application and not intercepted by the operating system.

Now my first attempt was to hide the rendering window on cmd+tab which certainly works, but has the disadvantage that a hidden OpenGL window in SDL cannot be restored when the user tabs back to the application.  First of all, there is no event fired for that or I can't find it, secondly the core problem is that when that application window is hidden, my game is still the active application, just that the window disappeared.

That is incredible annoying.

Any ideas how to approximate the windows / linux behavior for alt+tab?

sentences:
Recommended 3D camera settings and model sizes for an FPS I'm making a simple FPS and I can't decide on the size of my models and my camera settings. Could someone please recommend a good combination of:

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

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

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

sentences:
How do mobile games implement time gates unhackably? Is it possible in offline games? I'm thinking about porting my game to Google Play, and it would be free to play with time gates which are skippable if you watch an ad.

What are the ways of implementing an unhackable time gating?

Is it possible without internet connection? If yes, how?
If no, is there a way to implement it without custom backend, using Google Play's services?

Or should I care about this at all? Because...

It doesn't affect other players...
Most of the audience couldn't do it anyway, and if the game stays small, hacks couldn't really spread.
Then maybe I should just let them hack those time gates, it's a marginal revenue loss.

What do you think?

sentences: Conditionally use java or android classes I'm using bezier curves in my libgdx project. I was testing the desktop version using java.awt.geom with GeneralPath but when I went to test on android, it raised an error saying that I can't import java.awt. Android have corresponding classes for GeneralPath, Point2D etc so my question is how can I use those classes in their respectives environments?

sentences:
Why isn't the bitangent calculated? In teh tangent space vertex attributes why is the bitangent (aka binormal) provided as an attribute instead of calculated?

If the three vectors of the tangent space must be perpendicular then the bitangent can be calculated as the cross-product of the other two vectors. There are technically two perpendiculars here, but surely we could consistently calculate the one we want, even if it requires a boolean marker to negate it.

Similarly the bitangent itself doesn't need a full vector to be represented. From the normal alone we know the plane on which the tangent must reside. In theory a simple angle would be enough to calculate the tangent vector.

Given that GPU memory is at a premium why do we provide the full vectors for these values rather than calculating them (with reduced data input)?  Or am I wrong in assuming the tangent space must be a cartesian system?

sentences:
Tile based isometric depth sorting on different size objects. I am creating a tile based isometric game.

The problem we are having is with depth sorting, we tried a lot of methods but none work.

They all do a great job but its not perfect, they seem to bug sometimes.

We have tiled objects of different sizes, like 2x2, 2x6, 3x4. This makes it so hard.

We are trying to avoid slicing the bitmaps.

Anyone has a idea?

sentences:
Problem with bounding box in model space and intersection with ray I have a bounding box in model space and I want to intersect it with a ray. I have tried to transform the ray like this. Rotating and scaling works well, but transition does not.

Here is my code:

Xbouding = new BoundingBox(new Vector3(50, 10, 10), new Vector3(120, -10, -10));

ray.Position = Vector3.Transform(ray.Position, Matrix.Invert(MathUtil.CreateWorldMatrix(Position, Rotation, Scale)));
ray.Direction= Vector3.Transform(ray.Direction, Matrix.Invert(MathUtil.CreateWorldMatrix(Position, Rotation, Scale)));
float? dist = ray.Intersects(Xbouding);

I have this:

I want to know if the ray from the mouse intersects with the boxes shown in the image. Pick works fine unless the model is translated (rotating and scaling works).

Another little question: what does float? mean? What's the difference between float and float??

sentences:
How can I realistically simulate audio for multi-sensor processing? I am performing audio simulations in Unreal Engine 4.

Ideally, I need realistic audio propagations. So microphones at multiple locations will experience propagation delays related to their distance from a sound source. Basically to be able to do spatial signal processing with a microphone array.

I have done some experiments with the Steam Audio plugin but I don't think that the propagation delays are built-in. Some research points to needing to add the propagation delays in post processing, but if the sound source is moving, then the problem becomes difficult.

How can I implement this in my project?

sentences:
Creating 3D objects from code and their normals I'm trying to create my own 3D objects from scratch so I can generate my own terrain for a game I'm making.

So I created a cube and realized the lighting was strange, I looked up the cause and found that each face needed multiple vertices so they could hold their own individual normal because face x's normal will be different to face y's normal, even though the vertices are the same.

So I re-made my cube this way and went on with my terrain generating code. Now that I'm getting into creating more sophisticated meshes the number of vertices and indices are getting quite high (atleast compared to my cube) and a big reason for it is because I have to replicate a lot of the vertices just to have a different normal.

I just wanted to ask if this is normal (I know, I'm so funny) and that I'm doing everything right? Or is there a simple way for a single vertice to hold multiple normals?

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:
changing body type without change of center of mass I have an box2d project with some bodies in it, which move around without any user interaction. But if the user selects one of the bodies, he should be able to move it around just like he wants to.

To keep it short, I want to change the type of the body to "kinematic" while the user controls it and back to "dynamic" afterwards. If I do so the rotation center of the body changes with the change of the type. How can I reset this?

The body's fixture is created of a single b2PolygonShape, with its vertices set via SetAsArray().

Greetings philipp

EDIT::

So I looked around about setting the local center of bodies. what brought me to this solution:

var md = new b2MassData();
this.body.GetMassData( md );
this.body.SetType( b2body.b2_kinematicBody );
this.body.SetMassData( md );

that did not work, so I had a look at the source and found that SetMassData() always returns if the body is not "dynamic".

So I tried this:

var md = new b2MassData();
this._body.GetMassData( md );
this._body.SetType( b2Body.b2_kinematicBody );
this._body.m_sweep.localCenter.Set( md.center.x, md.center.y );

what actually is modifying the private data of the body. But it works and no errors appear, but can I really do this without the risk of breaking the application, or in other words, under which circumstances could this solution might cause errors?

n.b.:
I am using box2dweb of the latest release.

Greetings philipp

sentences:
How to implement map scrolling inertia formulae I'm looking for a mathematical formulae to calculate map scrolling inertia. Basically I have an HTML5 Canvas displaying part of a map and I capture the mousedown / mousemove / mouseup to calculate my new offset.

And when I scroll the map I want the map to continue scrolling for a few moments after the user stopped dragging the cursor.

I do have a sample implementation but I'm not really satisfied with it. I'd be looking for a nice clean math formulae to achieve this. I'd like my map to behave for example like in Civ-5 when you scroll the map around.

Here is part of my implementation: (working jsfiddle: https://jsfiddle.net/CowWarrior/dkxnj5d8/1/)

//mouseup
stopMapDrag: function (e) {
    var movementX = (e.pageX - this.startX);
    var movementY = (e.pageY - this.startY);
    this.mapOffsetX = parseInt(this.mapOffsetX) + movementX;
    this.mapOffsetY = parseInt(this.mapOffsetY) + movementY;
    this.isDragging = false;
    this.displayMap();

    //calculate last vector
    ui.vectorX = parseInt(e.pageX - ui.absStartX);
    ui.vectorY = parseInt(e.pageY - ui.absStartY);

    //show inertia
    setTimeout(function(){ ui.dragInertia(2); }, 30);
    console.log("(vectorX:" + ui.vectorX + ", vectorY:" + ui.vectorY + ")");

    $('#canViewport').css('cursor', 'default');
},

//need to find a good formulae for inertia
dragInertia: function (factor) {
    var movementX = parseInt(ui.vectorX / factor);
    var movementY = parseInt(ui.vectorY / factor);
    ui.mapOffsetX = parseInt(ui.mapOffsetX + movementX);
    ui.mapOffsetY = parseInt(ui.mapOffsetY + movementY);
    ui.displayMap();

    if (factor < 8)
        setTimeout(function(){ ui.dragInertia(factor * 1.2); }, 30);
},

sentences:
What is the proper way to instantiate multiple objects from a script while in the editor in Unity? I would like to, for example, be able to spawn a wall of stacked boxes and be able to play with the number of boxes in each dimension in the editor (previously I would be instantiating these at runtime, but it is annoying to not be able to see these in the editor).

Currently I am using a bit of a work around, I am using the OnValidate method to achieve this, but its a bit of a bodge and my instantiated items do not spawn in play mode, I get the following error on play:
MissingReferenceException: The object of type 'Lattice' has been destroyed but you are still trying to access it.
Your script should either check if it is null or you should not destroy the object.
Lattice.<OnValidate>b__8_0 () (at Assets/Lattice.cs:22)
UnityEditor.EditorApplication.Internal_CallDelayFunctions () (at /home/bokken/buildslave/unity/build/Editor/Mono/EditorApplication.cs:346)

Here is the script I am currently using:
public class Lattice : MonoBehaviour
{
    public int nX=1, nY=1, nZ=1;
    public float offsetX=1, offsetY=1, offsetZ=1;
    public GameObject item;

    // Validate called only in editor and only on variable change
    void OnValidate()
    {
        Clean(); // remove old items
        UnityEditor.EditorApplication.delayCall+=()=>
        {
            spawnBox3Grid(item, transform, nX, nY, nZ, offsetX, offsetY, offsetZ);
        };
    }

    void Clean()
    {
        foreach(Transform childT in transform)
        {
            UnityEditor.EditorApplication.delayCall+=()=>
            {
                //Debug.Log(childT.gameObject.name);
                DestroyImmediate(childT.gameObject);
            };
        }
    }

    void spawnBox2Grid(GameObject obj, Transform parent, Vector3 startingPos, int nItemsY, int nItemsZ, float zOff=1.0f, float yOff=1.0f, int k=0)
    {

        Vector3 boxPos = startingPos + new Vector3(0, yOff/2,-zOff*nItemsZ/2);
        Vector3 zOffset = new Vector3(  0, 0, zOff);
        Vector3 yOffset = new Vector3(  0, yOff, 0);

        for (int j=0; j<nItemsY; j++)
        {
            for (int i=0; i<nItemsZ; i++)
            {
                GameObject instance = Instantiate(obj, boxPos, Quaternion.identity, parent);
                instance.name = string.Format( "obj_{0}_{1}_{2}", i, j, k);
                instance.transform.localPosition = boxPos;
                instance.transform.localRotation = Quaternion.identity;

                boxPos+=zOffset;
            }
            boxPos-=nItemsZ*zOffset;
            boxPos+=yOffset;
        }

    }

    void spawnBox3Grid(GameObject obj, Transform parent, int nItemsX, int nItemsY, int nItemsZ, float xOff=1.0f, float yOff=1.0f, float zOff=1.0f)
    {

        Vector3 xOffset = new Vector3(  xOff,0, 0);
        Vector3 boxPos = new Vector3(-xOff*nItemsX/2,0,0);
        for (int k=0; k<nItemsX; k++)
        {
            spawnBox2Grid(obj, parent, boxPos,nItemsY,nItemsZ, yOff, zOff, k);
            boxPos += xOffset;
        }

    }

}

This YouTube video is probably closer to what I want, but I don't entirely understand it and was hoping there was a simpler way.
Edit:
Some extra context:
Delaying the DestroyImmediately calls seems to be the only way to delete objects from inside OnValidate and if I don't delay the Instantiate calls I get SendMessage cannot be called during Awake, CheckConsistency, or OnValidate.
Edit 2:
I guess I can use this code for previewing in the editor then use a scriptable object to store the parameters of my Lattice objects and then re-instantiate things at runtime? But that error that I'm getting; is it trying to run OnValidate just before play? (When presumably, the things I've instantiated aren't stored permanently so the lattice object is lost?) There has got to be a cleaner way of doing this...

sentences:
How do I interpolate an object from point A to B such that it accelerates, overshoots, and bounces back to target position? How The Game Works
You grab and drag an object around. Once you let go, it interpolates to a certain, variable position, and that's what I'm trying to do here.
Problem Description
I'm talking about vectors, but simplifying that to ordinary numbers for the sake of an example, if A is 0 and B is 1, the object would go something like this:

0.0
0.2
0.5
0.9
1.3
0.9
1.1
1.0

What I've Tried
private IEnumerator GoTo(Vector2 endPosition) {
    float elapsed = 0;
    float duration = 1f;

    while (elapsed <= duration) {
        transform.position = Vector2.LerpUnclamped(transform.position, endPosition, animCurve.Evaluate(elapsed / duration));
        distance = CalculateDistance(transform.position, endPosition);
        elapsed += Time.deltaTime;
        yield return new WaitForEndOfFrame();
    }
}

Where animCurve is:

The highest point is approx. 1.3, and the plot converges to 1.0 from there.
Result
This doesn't work at all. Unless something's wrong with Unity's Vector2.LerpUnclamped(), I'm lost.

sentences:
Can diffuse and specular component of Phong model shine thru object? I have been implementing simple 3D engine in OpenGL, mostly based on tutorials by Tom Dalling. I have implemented the Phong lightening model as described in his tutorial, but I see light artifacts on concave shaped objects (and also when using normal mapping). I came to a point, where i don´t know if my code is broken, or this is actually normal behaviour, and you need special handling for it.

I think that these artifacts could be happening, because the normals of concave object at same points head back into the point light source, not actually considering there is a solid object in between. I tried to do a little scetch of this situation in 2D (for diffuse component):

So I need to know, if this is a common problem of this light model, or my calculations are wrong.

sentences:
OpenGL Reconstructing Position from Depth I know this has been asked a lot of time before but none of those answers fixed my problem.
I try to implement deferred shading and to do so I need to reconstruct the world space position from the depth. (Having a position texture in the gbuffer would be a waste of data)

The calculation works fine for rotationing the camera (-> moving the mouse) but as soon as I move the camera (-> pressing wasd) they get weird.

GLSL:

vec4 screenSpacePosition = vec4(pass_Texture * 2.0 - 1.0, texture(gbuffer_texture[2],     pass_Texture).r, 1);
vec4 worldSpacePosition = invertedViewProjection  * screenSpacePosition;
vec3 finalPosition = worldSpacePosition.xyz / worldSpacePosition.w;

gbuffer_texture[2] is the depth attachment of OpenGL.
invertedViewProjection is the matrix I used to render the scene inverted on the CPU.

sentences:
I can't jump when i press up, and left at the same time ///Get player's input
key_right = keyboard_check(vk_right);
key_left = -keyboard_check(vk_left);
key_jump = keyboard_check_pressed(vk_space);
key_jump_held = keyboard_check(vk_space);
key_shoot = keyboard_check(ord("D"));

//React to inputs
move = key_left + key_right;
hsp = move * movespeed;
if (vsp < 10) vsp += grav;

if (place_meeting(x, y+1, Obj_Floor))
{
 vsp = key_jump * -jumpspeed;
}

if (vsp < 0) && (!key_jump_held) vsp = max(vsp,0)

//Horizontal Collision
if (place_meeting(x+hsp, y, Obj_Floor))
{
 while(!place_meeting(x+sign(hsp), y, Obj_Floor))
 {
  x += sign(hsp);
 }
 hsp = 0;
}
x += hsp;

//Vertical Collision
if (place_meeting(x, y+vsp, Obj_Floor))
{
 while(!place_meeting(x, y+sign(vsp), Obj_Floor))
 {
  y += sign(vsp);
 }
 vsp = 0;
}
y += vsp;

//Animate
if (move != 0)
{
 image_xscale = move;
}

if (place_meeting(x, y+1, Obj_Floor))
{

 if (move != 0)
 {
  sprite_index = CalvinWalking;
  image_speed = 0.07;
 }

 else
 {
  sprite_index = CalvinStanding;
  image_speed = 0.025;
 }
}

else
{
 if (vsp < 0) sprite_index = CalvinJumping
 else sprite_index = CalvinJumping
}

and

///Shooting with D
//Shooting direction
if (keyboard_check(vk_right))
{
 mpfacing = 0;
}

if (keyboard_check(vk_left))
{
 mpfacing = 180;
}

if (keyboard_check(vk_up))
{
 mpfacing = 90;
}

//Shooting
if (keyboard_check(ord("D"))) && (canshoot = true)
{
 instance_create(x+13, y-0.5, Obj_MP_Laser);
 canshoot = false;
 alarm[1] = 30;
}

is my code but for some reason when i press up, and move left, i can't jump when i press space. Which i don't understand because i can jump when moving left, and when i press up, but not when i press both.

sentences:
How front-to-back blending works? I would like to implement dual depth peeling in my engine. I read the original paper and examined the corresponding source code. I understand the algorithm, except how the blending works, especially in the front-to-back part. I'm so confused now, I'm not sure anything about alpha blending.
So let's start with the basics. I think there are two options: either we compute the pixel's color and it's transparency and store them separately (straight), or we multiply them and then we don't use the alpha channel's value (premultiplied alpha). The second option is what we usually do when we set glBlendFunc's parameters to GL_SRC_ALPHA and GL_ONE_MINUS_SRC_ALPHA. When we blend two pixels, the GPU multiplies the source color with the source alpha and it multiplies the destination color with (1 - source alpha). We don't multiply the destination color with the destination alpha because basically it's already multiplied with it. So we assume the destination alpha is 1 (and also the destination alpha is not correct, because of the GL_SRC_ALPHA and GL_ONE_MINUS_SRC_ALPHA parameters, so we can't use it anyways). Am I right so far?
At this point the back-to-front part of the dual depth peeling makes sense to me. In  dual_peeling_peel_fragment.glsl we just store the color with the alpha (we can't blend it yet because we have to use max blending in this shader).
void main(void)
{
    ...
    gl_FragData[2] = vec4(0.0);
    ...
    if (fragDepth == nearestDepth) {
        ...
    } else {
        gl_FragData[2] += color;
    }
}

Then in the dual_peeling_blend_fragment.glsl shader we just blend it with the background.
void main(void)
{
    gl_FragColor = textureRect(TempTex, gl_FragCoord.xy);
    ...
}

Here we use additive blending with the already mentioned parameters which makes sense to me.
But when we compute the front-to-back part in dual_peeling_peel_fragment.glsl, I don't understand the code.
void main(void)
{
    ...
    vec4 forwardTemp = textureRect(FrontBlenderTex, gl_FragCoord.xy);
    ...
    gl_FragData[1] = forwardTemp;
    ...
    float alphaMultiplier = 1.0 - forwardTemp.w;
    ...
    vec4 color = ShadeFragment();
    ...
    if (fragDepth == nearestDepth) {
        gl_FragData[1].xyz += color.rgb * color.a * alphaMultiplier;
        gl_FragData[1].w = 1.0 - alphaMultiplier * (1.0 - color.a);
    } else {
        ...
    }
}

Here we compute the color value and multiply it with some alpha values and we also compute the alpha. I don't see where these equations come from. We don't modify the destination color (which is the nearer), but we multiply the source color with the source alpha and with (1 - destination alpha). And then we also compute the alpha value. So this not straight neither premultiplied. Also in the paper they use slightly different equations in page 6.

Where the paper multiplies with destination alpha the source code multiplies with (1 - destination alpha). I found a blog post where the author is also confused about that.
And then, at the end in dual_peeling_final_fragment.glsl we blend together the back-to-front part with the front-to-back part.
void main(void)
{
    vec4 frontColor = textureRect(FrontBlenderTex, gl_FragCoord.xy);
    vec3 backColor = textureRect(BackBlenderTex, gl_FragCoord.xy).rgb;
    float alphaMultiplier = 1.0 - frontColor.w;
    gl_FragColor.rgb = frontColor + backColor * alphaMultiplier;
}

But I don't understand why we only multiply the back part with (1 - front part alpha). In this part we use additive blending.

sentences:
How can I give a MonoBehaviour field a default value that depends on the object? In Unity3D, I have a MonoBehaviour which gets added to game objects. I'm adding a string "name" field to it. I'd like the default value for the name to be the name of the game object the component is added to. Is there an easy way to do this? Some more details:

The component is an existing one to which I'm adding the name field. In old versions, the name was always the name of the game object, and this is a new feature to allow them to be different.
The common case is (still) for the name to be the name of the game object, so having that as the default would simplify the process of adding the component to a new object.
Ideally, deserializing an old scene will fill in the default, so updating scenes takes zero effort. I'm less concerned about this than about newly created scenes/objects.
The component already uses a CustomEditor.
I don't care about updating the name in the component if the game object's name is changed, or if the component values are pasted into a different game object.

One way I can think of is to add a bool "override name" to the object. If the bool is unchecked, it uses the default name (the game object); if it's checked, it uses the new field. But I'd like to avoid adding complexity to the GUI to support it. The whole point of my request is to add the new functionality (overriding the name) without adding steps to the creation workflow.

sentences:
OpenGL vector rotation matrix to a given point I have a sphere with a radius of .5

The sphere is centred at 0,0,0

I am now trying to place items around my sphere based on a given x,y,z on the surface of the sphere.

My items have been draw/created in such a way that they are positioned on the surface when translated to 0,0,0 because their centre offset has been positioned at the centre of the sphere.

What I need is some help with the calculation needed to get the correct glRotate values so that my icons will show at the correct x,y,z on the surface.

To help explain what I mean, here is a picture:

So you can see 0,0,0 at the centre, and also rotating around the same point is the blue line, This represents the rotation of my object. The green part is the visible part of my item, and so will draw on the surface of the sphere.

I have everything ready to go for this, in that I can already draw my items in this manner, however I am not able to correctly calculate the rotation.

With the default rotation of Identity my items will draw on the bottom of the sphere.

In summary I am looking for something like this:

glRotate = GetRotationForSurface(X,Y,Z);

I hope that's clear, this is a bit tricky to explain.

Thanks,

sentences:
LibGDX camera position shifted on movement I'm programming a game with LibGDX and Box2D and I want my camera to follow my player. But as I zoom in (because Box2Ds metric system, using camera.zoom = x) the camera is shifted when the player moves (the camera follows the player):

Shifted View

Normal View

That only happens when the player moves, so there can't be a problem with the coordinates. My Question is how to remove this shifting as the player moves.

Here's some of my code:

Render Loop (excerpt):

@Override
public void render(float delta) {
    //set the camera position to player's position
    cam.position.set(player_body.getWorldCenter().x, player_body.getWorldCenter().y, 0);
    cam.update();

    world.step(Gdx.graphics.getDeltaTime(), 6, 2);
    world.clearForces();

    handleInput();

    Gdx.gl.glClearColor(.05f, .05f, .05f, 1);
    Gdx.gl.glClear(GL20.GL_COLOR_BUFFER_BIT);

    batch.setProjectionMatrix(cam.combined);

    debugRenderer.render(world, cam.combined);

}

Make the player move:

if (Gdx.input.isKeyPressed(Keys.W)) {
    player_body.setLinearVelocity(transX, transY);
    player.setMoving(true);
}

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:
Are there any hex tile sizes where both width and height are integers? I'm trying to figure out the optimal width and height (in pixels) to start building hex tiles for game development. My preference is for "flat topped" hex grids, but the math is similar for both.

I am looking for an "optimal" tile size that allows both the width and the height of the tile to be a rounded pixel number, based on the fact that height = sqrt(3)/2 * width.

My math skills being virtually nonexistent, I just ran a brute force script that ran through widths from 1 to 1024 and did not come up with a single value for w where h was an integer. Is this really the case? How does anyone create pixel-perfect hex tiles if there's no even width & height size that can accommodate a perfect hex aspect ratio?

sentences:
3D solid object in terrain Im trying to make a solid object to stay always in the terrain level, but I am facing some problems. The terrain is not flat, I mean, it can have mountains and craters for example. I just have a ASE (ASCII Scene Export) file of the 3D map. The problem is, I know what is the object's X & Z values are, but I don't know how to determine the Y value for that specific location. I suppose I'd need Y value to always stays with the ground level, so I can realistically make the object walk through the cratter or the mountain.

The only info I have of the map (which I think it should help but I'm not that good in physics or in math, so I can't do much with it) is some vertex coordinates, like:

*MESH {
    *TIMEVALUE 0
    *MESH_NUMVERTEX 5424
    *MESH_NUMFACES 8357
    *MESH_VERTEX_LIST {
        *MESH_VERTEX         0  32472.1055  52576.4922  1245.4102
        *MESH_VERTEX         1  32660.6992  52576.4922  1245.4102
        *MESH_VERTEX         2  32472.1055  52632.8086  1245.4102
        *MESH_VERTEX         3  32660.6992  52632.8086  1245.4102
        *MESH_VERTEX         4  32467.2617  52576.4922  1550.3711
        *MESH_VERTEX         5  32607.6055  52576.4922  1550.3711
        *MESH_VERTEX         6  32467.2617  52632.8086  1550.3711
        *MESH_VERTEX         7  32607.6055  52632.8086  1550.3711
        *MESH_VERTEX         8  32578.9648  52576.4922  1396.7617
....

*MESH_FACE_LIST {
        *MESH_FACE         0:    A:         7 B:         6 C:         4 AB:    1 BC:    1 CA:    1   *MESH_SMOOTHING 1  *MESH_MTLID 0
        *MESH_FACE         1:    A:         4 B:         5 C:         7 AB:    1 BC:    1 CA:    1   *MESH_SMOOTHING 1  *MESH_MTLID 0
        *MESH_FACE         2:    A:        15 B:         0 C:         1 AB:    1 BC:    1 CA:    1   *MESH_SMOOTHING 1  *MESH_MTLID 0
        *MESH_FACE         3:    A:         1 B:        12 C:        15 AB:    1 BC:    1 CA:    1   *MESH_SMOOTHING 1  *MESH_MTLID 0
        *MESH_FACE         4:    A:        12 B:         1 C:         3 AB:    1 BC:    1 CA:    1   *MESH_SMOOTHING 1  *MESH_MTLID 0
        *MESH_FACE         5:    A:         3 B:        13 C:        12 AB:    1 BC:    1 CA:    1   *MESH_SMOOTHING 1  *MESH_MTLID 0
        *MESH_FACE         6:    A:        13 B:         3 C:         2 AB:    1 BC:    1 CA:    1   *MESH_SMOOTHING 1  *MESH_MTLID 0
        *MESH_FACE         7:    A:         2 B:        14 C:        13 AB:    1 BC:    1 CA:    1   *MESH_SMOOTHING 1  *MESH_MTLID 0
        *MESH_FACE         8:    A:        14 B:         2 C:         0 AB:    1 BC:    1 CA:    1   *MESH_SMOOTHING 1  *MESH_MTLID 0
        *MESH_FACE         9:    A:         0 B:        15 C:        14 AB:    1 BC:    1 CA:    1   *MESH_SMOOTHING 1  *MESH_MTLID 0
....

Should I take all the vertices and faces and draw the whole map to simulate the object walking server-side to pass the correct Y values to the client, or can I use somekind of math equation to get them? I don't think it would be wise to "render" the map in the server aswell...

sentences:
Why are my texture coordinates always (0,0) in this shader? What I'm trying to do is add my depth buffers values to my scene, ie. I'm trying to make objects closer to the camera darker and objects further away lighter. Which should be easy: just render the depth buffer to a texture, and then render the scene, multiplying each pixels colour by the colour value at the same coordinates in my depth-buffer texture...

Yet I don't know how to use coordinates for textures.

Or more like it's just failing. What's happening is that the vertex shader is only using the (0,0) coordinate of my texture, so the entire scene changes colour depending on what's there.

What I'm doing is this (the critical stuff from my render function):

glActiveTexture(GL_TEXTURE0);
glBindTexture(GL_TEXTURE_2D, depthTextureId);   //Binds the texture
box.render();    //Sets the viewing matrix and renders a test VBO

I guess that's the right way to bind a texture? Anyhoo, here's the vertex shader's important stuff:

out vec4 ShadowCoord;

void main() {
    gl_Position = PMatrix * (VMatrix * MMatrix) * gl_Vertex;  //Projection view and model matrices
    ShadowCoord = gl_MultiTexCoord0;    //something I kept seeing in examples, was hoping it would work.
}

It seems gl_MultiTexCoord0 is the problem? Maybe?

The frag shader sets the colour using this function:

vec4(texture2D(ShadowMap, ShadowCoord.st).x * vec3(Color), 1.0);

Where the ShadowMap is the sampler2D for the texture, and Color is the vertex's color...

So what am I missing? How come the coordinates are not changing from 0,0?

sentences:
Finding the normal from one 3d vector/line to any point on another 3d vector/line Say I have two 3d vectors, v1 and v2 (you can consider them both lines if you like). I'm trying to figure out a normal for v1 so that it intersects along any point of v2.

I keep drawing blanks on this one. It's easy enough to find a vector that points from v1 to v2 (just do v2 - v1), but that result isn't always perpendicular to v1.

How would you go about making that result perpendicular to v1?

sentences:
Coroutine different behaviour when called from another script I am quite new with game dev, specially with unity. In order to understand how it works, I decided to start small with a pong game.

I have a Ball script, which in the Update() method move the ball depending to the speed, and if a player score, it increment a score field and reset the ball to the center (and stop the ball for 2 seconds) trough a coroutine function.

Ball script:

public class Ball : MonoBehaviour
{
    [SerializeField]
    float speed;
    int isMoving = 1;
    float radius;
    Vector2 direction;
    Vector2 startPosition;

    // Start is called before the first frame update
    void Start()
    {
        direction = Vector2.one.normalized;
        radius = transform.localScale.x / 2; // half the width
        startPosition = new Vector2(transform.position.x, transform.position.y);
    }

    // Update is called once per frame
    void Update()
    {
        transform.Translate(direction * speed * isMoving * Time.deltaTime);

        if (transform.position.y < GameManager.bottomLeft.y + radius && direction.y < 0) {
            direction.y = -direction.y;
        }
        if (transform.position.y > GameManager.topRight.y - radius && direction.y > 0) {
            direction.y = -direction.y;
        }

        // Ball go in any goal
        if (transform.position.x < GameManager.bottomLeft.x + radius && direction.x < 0) {
            GameManager.instance.addScorePlayer("p2");
            StartCoroutine( Reset() );
        }
        if (transform.position.x > GameManager.topRight.x - radius && direction.x > 0) {
            GameManager.instance.addScorePlayer("p1");
            StartCoroutine( Reset() );
        }
    }

    IEnumerator Reset() {
        isMoving = 0;
        transform.position = startPosition;

        yield return new WaitForSeconds(2);

        isMoving = 1;
    }
}

This works as expected! The score is incremented, the ball go back to the center, wait for 2 seconds and start to move again.
However, now I want to call the Ball Reset() method trough my GameManager (because I want to code some logics inside the GameManager).

So here are my modifications:

Ball script: (remove Reset() calls and update Reset() method to public)

public class Ball : MonoBehaviour
{
    ...

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

        // Ball go in any goal
        if (transform.position.x < GameManager.bottomLeft.x + radius && direction.x < 0) {
            GameManager.instance.addScorePlayer("p2");
        }
        if (transform.position.x > GameManager.topRight.x - radius && direction.x > 0) {
            GameManager.instance.addScorePlayer("p1");
        }
    }

    public IEnumerator Reset() {
        isMoving = 0;
        transform.position = startPosition;

        yield return new WaitForSeconds(2);

        isMoving = 1;
    }

GameManager script:

public class GameManager : MonoBehaviour
{

    public Ball ball;

    ...

    void Start()
    {
        ...

        // Create ball
        Instantiate (ball);

    }

    public void addScorePlayer(string player) {

        if (player == "p1") {
            score1 += 1;
            score1Text.text = score1.ToString();
        }
        else if (player == "p2") {
            score2 += 1;
            score2Text.text = score2.ToString();
        }

        StartCoroutine( ball.Reset() );
    }

This doesn't work for some reason. The ball don't come back to the center, and the score increment infinitely.

I have tried many things and I have figured out that the behaviour is the same as running the Reset() method trough the Ball script without the StartCoroutine.

So it seems that the Coroutine don't work properly if called trough the GameManager ?
I have also printed some logs into my console in the Ball.Reset() method, and the method is being called, so I don't understand why the ball don't go back to the center.

(Link to my public github repository https://github.com/Sewake/Unity2D-Pong)

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

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

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

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:
Best approach for destructible car in Unity I'm developing a simple racing car game.
I'm wondering what is the best approach to manage visually car destruction.
For instance: i think one option (expensive) is to build car 3d model with 'separate' mesh, each for any component (bump, door, glass) and relative cooliders..
Other options ?
Thanks

sentences:
Is "entity component system" a principle or a pattern? Since the ECS follows the principle Composition over Inheritance, and it  makes the behavior of game objects can be changed in the runtime.

If ECS is a principle, from my memory of design patterns of GoF, the following patterns can accomplish the principle well:

Decorator pattern
Composite + Visitor

But I'm not sure about that ECS is a pattern like the above or a principle like Open Closed Principle, I've tried to find a video which explains ECS well but found nothing clear.

Current resources I found:

gamedev.net ECS

sentences:
Get project's gravity value in Godot I need to get access project's gravity value which set in Project Settings -> Physics -> 3D -> Gravity, however I couldn't find any related information about this.

How do I get project's gravity value in GDScript? In Unity, it can be done by simply Physics.gravity, but in Godot, couldn't find similar.

Using Godot 3.1.1

sentences:
Best way to do multiple choice in Unity 2D? So I'm about to start development on a game in unity that is going to require multiple choice each choice having a some what unique function. I've thought of 2 ways of doing this but I'm unsure if there is an easier way as I've never really worked with unity.

So the first way I was thinking about doing this and I think better then the second would be to make a class for each choice with all the functions that belong to that choice in there and then just calling it when its needed. However, I don't know if this will scale very well as I will have over 100 different events with their own choices...

The second way I was thinking was to do it via JSON and then just code each function to parse that. So for example: addmoney, dothis, dothat etc... However this seems like a lot more work then it would be worth so I'm not 100% sure...

So I'm wondering what option would be better and if anyone else has any suggestions I'd love to hear!

sentences:
What's the state of the art in Space Partitioning for games? I know about BSP trees, Octrees and Portal that where used for a long time. But modern games still use this systems or they are using new things?

If it's possible with pros and cons, considering rendering and collision detection.

sentences:
How to run code as an instance you just created in GML Alright, I'm looking how to create an instance, and then run a chunk of code on the instance I just created, and not have that code run on any other duplicate instances.

Noob question, I know. Please help though?

sentences:
Environment collision in a pseudo-3d 2d space The game is a 2D brawler with depth movement in the vein of Golden Axe, Final Fight, Castle Crashers etc. Characters and environment are all 2d sprites as well. I've had no real issue setting up collision between characters to take the depth into account either.

However, it's just not a proper brawler without higher ground to jump to and pits to throw the enemy into, and that is where I run into a bit of an issue with how best to implement it.

I considered making the collision boxes for the level in the 3D space and having the sprites just translate the z movement of their game object into y movement of the visual component, but I don't particularly like that approach because it feels difficult to work with for doing the level design of matching 3D colliders to a drawn backdrop and placing objects in there.

Any suggestions for a design that is the 2D first, so to speak? Ideally being able to "paint" height levels and pits in the 2D design wise. If it matters, I'm working in unity with a primarily 2d space (though involving the third dimension here will be necessary), but I think the base design problem would be fairly engine/language agnostic.

sentences:
Stomp on Enemies in Unity to Kill them I want to create a game where the main character can pass through all the zombies that are chasing him but he can also jump up and bounce on their heads to kill them (like in old mario)...

The problems I am running into are:

When I am in the same position as the zombie and jump to kill him the trigger collider triggers the Destroy(Zombie) method. I only want them to be killed when you "Stomp" on them.
How do I make the character able to pass through the zombies without falling through the floor?

Here is my code for the trigger event that is attached to the "Stomper" box collider on my character.

     void OnTriggerEnter2D (Collider2D other) {
    if (other.tag == "EnemyHead") {

        //Destroy
        Rigidbody2D playerRB = transform.parent.gameObject.GetComponent<Rigidbody2D> ();
        playerRB.velocity = new Vector2 (0, 0);
        playerRB.AddForce(Vector2.up * 10, ForceMode2D.Impulse);

        Destroy (other.transform.parent.gameObject);

    }
}

Let me know if you need anything else. I am trying to explain this as well as possible...

sentences:
Diagonal symmetry across a filtered array? I wrote this code to randomly generate a square terrain that somewhat resembles an island. First, I randomly populated a square with grass tiles (1s) on a plane of water tiles (0s):

Then, I looped through each tile and changed its tile type according to its neighboring tiles(if a tile is surrounded by 4 or more water tiles, it becomes a water tile, otherwise it becomes a grass tile):

The results don't seem all that pleasing; not only is the terrain filled with holes and lack overall "togetherness", it is also weirdly symmetrical diagonally.

Here's the code:

private void SmoothMap (Chunk chunk)
{
    for(int row = 1; row < chunk.rows-1; row++)
    {
        for(int col = 1; col < chunk.cols-1; col++)
        {
            //if current tile is not null
            if(chunk.GetTile(row, col) != null)
            {
                //Check its neighboring tiles
                int neighboringTiles = GetSurroundingTiles(row, col, chunk);
                //System.out.println("Position: " + row + ", " + col);
                //System.out.println("Current tile type: " + chunk.GetTile(row, col).type);
                //System.out.println("Neighboring water tiles: " + neighboringTiles);

                if (neighboringTiles > 4)
                {
                    if (chunk.GetTile(row, col) != null)
                    {
                        chunk.GetTile(row, col).texture = GetRandomWaterTexture();
                        chunk.GetTile(row, col).type = Enums.tileType.Water;
                    }
                }
                else if (neighboringTiles < 4)
                {
                    if (chunk.GetTile(row, col) != null)
                    {
                        chunk.GetTile(row, col).texture = GetRandomGrassTexture();
                        chunk.GetTile(row, col).type = Enums.tileType.Grass;
                    }
                }
            }
        }
    }
}

private int GetSurroundingTiles(int r, int c, Chunk chunk)
{
    int surroundingTiles = 0;

    for(int x = c-1; x <= c+1; x++)
    {
        for(int y = r-1; y <= r+1; y++)
        {
            if (x != c || y != r)
            {
                if(chunk.GetTile(x, y) != null)
                {
                    if (chunk.GetTileCode(x, y).equals("0"))
                    {
                        surroundingTiles++;
                    }
                }
            }
        }
    }
    return surroundingTiles;
}

Does anyone know why it is the way it is? Or a better way to approach generating an terrain like this?

Here's the GetTile() code:

public String GetTileCode(int r, int c)
{
    Tile tile;
    ArrayList<Tile> chunk_row;
    if(tiles.size() > r && r >= 0){
        chunk_row = tiles.get(r);

        if(chunk_row != null && chunk_row.size() > c && c >= 0){
            tile = chunk_row.get(c);
            return tile.isGrass() ? "1" : "0";
        }
    }
    return "0";
}

1 is grass, and 0 is water.

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:
How can I implement a "horizontal desynced colors" effect in LWJGL? My plan is to achieve analog video effects like RGB channel desynchronisation.

I'd like to have something like this (I hope you get the idea):

Left: White dot; Right: The same dot, but mind the channel offsets (the center should be brighter and white).

sentences:
Are there any alternative JS ports of Box2D? I have been thinking about creating a top down 2D car game for HTML5. For my first game I wrote the physics and collisions my self but for this one I would like to use some ready made library.

I found out Box2D and its JS port.

http://box2d-js.sourceforge.net

It seems to be quite old port, made in 2008. Is it lacking many features of current Box2D or does it have major issues with it? And are there any alternatives for it?

sentences:
Unity: Non Power of 2 Textures I have a texture that is 1024x900. Should I resize it in Photoshop to be 1024x1024 or leave it as it is?

What about a texture sized 1000x900?

sentences:
How public should you make your betas? I am approaching the point where I can release a playable beta of a very complex game I am making in Flash/AS3. It is fairly involved and the deepest game Ive made so far. I plan on hosting it on my personal site but I want to try and get good feedback on the game elements so far.

Is it worth it to expose this beta to as many places as possible before the release? What are good communities to do this?

Please note this will be freeware in its final release

sentences:
GetComponentsInChildren() raises error I have a gameobject to which a script is attached.

In this script I have the following code:

    foreach (GameObject g in this.GetComponentsInChildren<GameObject>())
    {
        BagItem nBagItemScript = g.GetComponent<BagItem>();
        if (nBagItemScript != null)
        {
            Bounds nBounds = Helpers.BoundsFromGO(g);

            Vector3 nPos = new Vector3((nBounds.size.x / 2) - nBounds.center.x, mapHeight - (nBounds.size.y / 2) - nBounds.center.y, -0.01f);
            g.transform.localPosition = nPos;

        }
    }

I thought this code was fail-safe, but Unity outputs the following error message:

ArgumentException: GetComponent requires that the requested component 'GameObject' derives from MonoBehaviour or Component or is an interface.
UnityEngine.GameObject.GetComponentsInChildren[GameObject] (Boolean includeInactive) (at C:/buildslave/unity/build/Runtime/Export/GameObject.bindings.cs:133)
UnityEngine.Component.GetComponentsInChildren[GameObject] (Boolean includeInactive) (at C:/buildslave/unity/build/Runtime/Export/Component.bindings.cs:88)
UnityEngine.Component.GetComponentsInChildren[GameObject] () (at C:/buildslave/unity/build/Runtime/Export/Component.bindings.cs:98)
Bag.pUpdatePositions () (at Assets/Bag.cs:173)
Bag.Update () (at Assets/Bag.cs:107)

Can somebody tell me which error Unity / C# is choking on here?

Is the error really in this line

foreach (GameObject g in this.GetComponentsInChildren<GameObject>())

... or perhaps somewhere else?

Thank you very much!

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:
Stepping from Point out on Archimedes Spiral for Length along Arc I wasn’t sure whether to put this question in mathematics or programming?

My question has two parts with the second part dependent on the first.
I’m looking to use Archimedes spirals in some game code I’m writing.

I figured that there is possibly a unary Archimedes spiral from which all other achimedes spirals can be derived.  (Hopefully the use of ‘unary’ is correct here?)  That is a unary Archimedes spiral is one where the spiral spirals one radian outwards for every radian of angle starting at centre.

So my first question is:  Is that true?  Can every Archimedes spiral be derived from a ‘unary Archimedes spiral’  like I’ve described?

By derived I mean by the use of simple multiplication and division to transform from the unary Archimedes spiral to any Achimedes spiral with a different rate of out-spiral.

eg.  spiral20RadiansOutPerRadian = unaryspiral * 20

If that is the case then could someone possibly help me also with this second question?

I’m looking to step a measured arc length outwards (and inwards) from a point that is out on a measured Archimedes spiral.  So not from the zero or centre point but from somewhere out on the spiral.  The begin point out on the spiral is represented by a measured radius from zero (or centre).

I’m looking to find:  r' = f(r , arclen)

where r is the initial radius, arclen is the length stepping outwards along the arc (negative to step inwards) and the resultant r' is the new radius at that stepped to point.

My process for deriving from the unit spiral would hopefully then be:

Programmer sets a value for delta_radius which is per radian of angle.
Programmer sets a value for start_radius.
Programmer sets a value for step_length which is the length to step around arc.

The unary_step_length is worked out by dividing step_length by delta_radius.
The unary_start_radius is worked out by dividing start_radius by delta_radius.

We call achimedes() function with the two unary values and it returns unary_end_radius.

The actual end_radius is worked out by multiplying unary_end_radius by delta_radius.
The delta_angle is worked by subtracting unary_end_radius from the unary_start_radius.

My second question is:  Could somebody please help me to write this achimedes() function (if the answer to question 1 is yes)?

I’m looking to have function be of the form:

unary_end_radius = archimedes(unary_start_radius , unary_step_length)

where the unary_delta_radius is understood to be 1 radian.

sentences:
Speed dependent arc question I'm currenlty working on an assignment and would appreciate any sort of help on the following implementation

The question follows

We are tasked to  implement some heuristics but one of them is really confusing to me.

  The following are a set of heuristics widely used by game developers
  for the movement of human characters while trying to reach a target

  A. If the character is stationary or moving very slowly

  If it is a very small distance from its target, it will step there directly, even if this involves moving backward or sidestepping
  Else if the target is farther away, the character will first turn on the spot to face its target and then move forward to reach it.

  B. Else if the character is moving with some speed

  If the target is within a speed-dependent arc (like a narrow perception zone, or a cone of perception) in front of it, then it will
  continue to move forward but add a rotational component to
  incrementally turn toward the target**
  Else if the target is outside its arc, then it will stop moving and change direction on the spot before setting off once more.

B2 I'm not entirely sure what a speed dependent arc is. I googled it and it bring it back to the textbook( Artificial Intelligence for video games). My question is : what is a speed dependent arc?

sentences:
Understanding how to use Quaternion to rotate object I m having hard time to understand Quaternions and to use them in my engine for rotating object.
I m looking for step by step explanation, actually a correction of my view of Quaternions.
Here is how I understand they work.
q = cos(40*) + sin(40)(i+j+k)
->what I understand is that i+j+k represents the axis of rotation. Basically if i = 1 that means we rotate object around X-axis.
Formula q * point * p-1, is what I dont quite understand. Lets for the sake say I understand why forumla goes like this. What I dont seems to get how would I apply this to my engine to rotate object.
What I tried is to create 3dVector with object position, example (0,0,-5). I would use quaternion that would rotate this vector around y axis, so q * ThisVector * q(conjugate),  and then result I would put in translate matrix. But no work.
I cant seem to find a way to implement them. I saw some articles on quaternion to matrices, But what do I  put in that matrix, a result from qThisVectorq(conjugate) or it is just q that is transfromed in matrix?
EDIT
What I want is to rotate object on Y-axis using quaternion. So far,because of lack of my understanding, I m failing to rotate.
I created a class 3dVector ->three dimensional vector, and instantiate a new position (0,0,-5). This position I sent as translate matrix to opengl and multiplied with glPosition.
When I tried to rotate that object using quaternion. I just took that position (0,0,-5) and used it in formula q = q * p * q(conjugate). I manually calculated that but result I get didnt make object rotate on Y-axis around itself.
Now I m not sure, but I think it actually rotated object but not around him self,he was moved to the right, so he was not in the same position anymore
EDIT_2:
I have cube that is on position [0,0,-5] and I want to rotate it around y-axis by some angle.
I tried to write code in python
poinToRotate = Quaternion(w=0,x=0,y=0,z=-5)

angle =45

sinus = math.sin(math.radians(angle));
q=Quaternion(
w=math.cos(math.radians(angle)),
x=sinus*0,
y=sinus*1,
z=sinus*)

newPoint = q.rotate(poinToRotate)

Rotation is somewhere good but it cube does not rotate around it self but around some point.
But when
   p = Quaternion(w=0,x=0,y=0,z=0)

to make it to the center, result is all zeros.

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:
Rendering multiple strings/text using SpriteBatch from LibGDx library I am using the LibGDX library to render a 3D model in my Android application. Now, I am stuck, where I want to render multiple dynamic texts on to different 3D boxes located on different coordinates of the screen. I am able to render a single text using SpriteBatch, but I need to render different string values on different boxes.

SpriteBatch spriteBatch = new SpriteBatch();
BitmapFont font = new BitmapFont();
spriteBatch.maxSpritesInBatch = 5;

spriteBatch.setProjectionMatrix(camera.combined.cpy().scale(camera.combined.cpy()
    .getScaleX()/25,camera.combined.cpy().getScaleY()/25, 0.8f));

spriteBatch.begin();

font.setColor(1.0f, 0.0f, 0.0f, 1.0f);
float xPos = -90;
int count = 0;

for (Widget widgets : display.getWidgets())
{
    float boxWidth = widgets.getBounds().getWidth();
    float boxHeight = widgets.getBounds().getHeight();
    float boxHeightCenter = widgets.getBounds().getCenterY();

    if(count==0)
    {
        font.draw(spriteBatch, "Hello"+count, xPos, boxHeightCenter-25,
            boxWidth, 0, true);
        ++count;
    }
    else
    {
        font.draw(spriteBatch, "Hello"+count, xPos+boxWidth, boxHeightCenter-25,
            boxWidth, 0, true);
        xPos = xPos+boxWidth;
        ++count;
    }
}

spriteBatch.end();`

The above code renders only one string value. While debugging, the "for" loop is getting traversed, but no positive result is obtained. How do I fix this?

sentences:
Project location to perspective fake 3D view I am trying to implement a perspective view in a 2D soccer game, such like Nintendo World Cup. In this case, the soccer pitch will look like a isosceles trapezoid, but not a rectangle in real.

Here is my solution:

I separate the game logic location and the final rendering location. In the game logic part, the pitch is still a rectangle, so we can make easy collision detection, player area change, out-of-bound checks, goal check, etc.. Just like an answer to Stack Overflow question Implement a projectile motion and collision detection - response in a 2D top-down game said:
Then I just project players', ball's location into final screen location, so that player can fit in pitch (because the exact pitch image is a trapezoid like the screenshot)

I tried to do like that post said, but the result is wired, so I am thinking do I need to make a perspective projection like in a 3D game, but I do not know how. A 3D perspective projection needs to know the camera position, camera angle, near plane, but these do not exist in a 2D game.

How do I solve this problem?

sentences:
Google Play downloads never update So I published an app about 3 weeks ago and it still says 10 downloads, but I have google analytics in the app and it says my app has nearly 1000 downloads. After 2 days my app said 10 downloads and it has never updated since then.

Has this ever happened to any of you? I have heard of a few days to a week of delay but 3 weeks is ridiculous. It should have updated by now.

sentences: Can I use sdl_net2.0 with cocos2d-x? Can I use sdl_net2.0 lib with cocos2d-x? And how it cconects to each other. Or analog lib to use?

sentences:
How do I represent blended tiles in a mesh/vertex array? I recently started making a Terraria clone using the LÖVE library, which is based in OpenGL.

In Terraria, for each tile, there is a large texture with all possible combinations for merging with neighbouring tiles. They usually only  support tiles of the same type, and sometimes other materials, like dirt. As a result, they only need a single vertex array.

In Starbound, it seems to be simpler. A tutorial I found notes the use of basic 8x8 blocks, with a few edges drawn if the block is next to a block of a different type.

I want to implement a similar mechanic, but I encountered a serious issue. A single vertex array does not allow z-ordering, which I would need.

My first idea was to use one vertex array for each type of block, but that would eat a lot of memory.
My second idea was to use the fact that OpenGL vertex array draws primitives in order. I could use some complicated data structure to represent tiles, so I would always know where to place their vertices in the array. However, that would either require moving lots of vertices or lots of memory.

What is the best way to implement this?

sentences:
Visual Artifacts from motion blur I tried to use this motion blur effect on my project but found some strange looking artifacts when setting it's alpha to low values. (Which increases the strength of the effect)

The effect works by only rendering a transparent image, so parts of the last few frames are still visible. When I set the alpha of the new image to a fairly low value (less than 0.5f) I get these strange artifacts:

Without the effect, the scene looks like this:

Notice that without the effect, the background is solid (minus lighting). The artifacts do not go away after any amount of time. For my implementation of the effect, I created a BufferedImage, rendered everything to it, then rendered the image to the screen with transparency. Could someone provide an explanation as to why these artifacts are occuring? Is there possibly a way that I could repair this?

image = GraphicsEnvironment.getLocalGraphicsEnvironment().getDefaultScreenDevice().getDefaultConfiguration().createCompatibleImage(width, height, Transparency.TRANSLUCENT)

//Draw everything to image

Graphics g = bs.getDrawGraphics();
Graphics2D g2d = (Graphics2D) g;
g2d.setComposite(AlphaComposite.getInstance(AlphaComposite.SRC_OVER, alpha));
g.drawImage(image, 0, 0, null);
g2d.setComposite(AlphaComposite.getInstance(AlphaComposite.SRC_OVER, 1f));
g.dispose();

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:
Xna 2d texture antialiasing I've got a problem with drawing 2D texture in xna 4.0.
My program generates terrain texture:

The problem is in rough surface of my texture (dark-blue) that is generated by-pixel. Is there any method to smooth my texture without scaling it? (SamplerState didn't help me)

A lot of thanks in advance.

sentences:
Box2d Fixed Timestep and Interpolation I am using libGDX and I have problems implementing the box2d fixed timestep with interpolation.

This is my code:

private void updateWorld() {

    accumulator += Gdx.graphics.getDeltaTime();

    while (accumulator>= step) { // The step is 1/10

        copyCurrentPosition();

        world.step(step, 8, 3);
        accumulator -= step;
    }

    interpolate(accumulator / step);
}

private void copyCurrentPosition() {
    prevPosition = new Vector2(player.body.getPosition().x, player.body.getPosition().y);
}

private void interpolate(float alpha) {
    player.body.setTransform(player.body.getPosition().x * alpha + prevPosition.x * (1.0f - alpha), player.body.getPosition().y * alpha + prevPosition.y * (1.0f - alpha), 0);
}

sentences:
unbelievable strange problem in unity android build - texture and frame Suddenly the texture quality of Unity Android Build and the frame of the game was greatly degraded.

See the picture A and B. In image A the center lines on the road are sharper, but B is blurred. I want my game to look like A, not B.

What is surprising is that you can roll back the project to the point where it worked and then run the apk build again.

In the above picture, A is a screenshot of a normal time. I have installed apk backed up at that point.

B is a screenshot of when I built A after I rolled back the Unity project at the build time.

Both are the same project, but the build output is different. (Of course not good ...)

Of course I did not touch Unity, Java, Android SDK etc at the same time.

Of course, there is no configuration change on the testing phone as well.

It's just like this all of a sudden.

I even reinstalled the PC this morning.

I still have this problem.

Even if you build on a separate PC, you're having the same problem.

I build a project at another pc, mac book pro, but problem is still there.

Of cause, I factory-reset my test phone, but problem still there.

Test phone is Samsung Galaxy S4.

build environment is Windows 10, Unity 2017.

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:
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:
Quaternion rotation is inverse of what I expect I'm trying to learn quaternions and decided to implement my own quaternion class.

To test it I made a couple vertex shaders, one that gets a model matrix (calculated from the quaternion) and another that gets the rotation quaternion directly and rotates vertices in-shader.

I then feed these a quaternion that rotates around the Y axis t / 10000 radians (t = time):

const rotation = Quat.fromAxisAngle(new Vec3([0, 1, 0]), t / 10000)

The result surprises me because my model is rotating counter-clockwise but I expected it to rotate clockwise, since the angle is increasing (checked it, quat's xyz increase with time). Rotation around the X or Z axes is also backwards.

All translations as well as matrix rotations work as expected in my coordinate system. I suspect my formulas are wrong, and probably assume +Z is forward. If I transpose my model matrix (or post-multiply with it) it rotates as expected, which suggests it's a handedness problem.

Where are my formulas wrong and how can I understand the math behind this?

Details

My matrices are column-major in memory (to match GLSL's mat4).
My coordinate system is +X right, +Y up, -Z forward.

My code

Quaternion from axis + angle

function fromAxisAngle(axis: Vec3, angle: number, dest = new Quat()): Quat {
  angle *= 0.5
  const sin = Math.sin(angle)

  dest.x = axis.x * sin
  dest.y = axis.y * sin
  dest.z = axis.z * sin
  dest.w = Math.cos(angle)

  return dest
}

Note: I noticed if I negate this quaternion's x, y and z, everthing works as expected. Is this the root cause? I thought quaternions didn't have handedness!

Since this is actually just inverting the quaternion (and thus its rotation) I'm afraid I'm just patching over the root cause. I don't want to patch the issue, I want to fix my math!

Matrix from quaternion

toMat4(dest = new Mat4()): Mat4 {
  const { x, y, z, w } = this

  const x2 = x + x
  const y2 = y + y
  const z2 = z + z

  const xx = x * x2
  const xy = x * y2
  const xz = x * z2
  const yy = y * y2
  const yz = y * z2
  const zz = z * z2
  const wx = w * x2
  const wy = w * y2
  const wz = w * z2

  // Notice matrix is column-major
  // Source:
  // https://en.wikipedia.org/wiki/Quaternions_and_spatial_rotation#Quaternion-derived_rotation_matrix
  dest.init([
    1 - (yy + zz), xy - wz,       xz + wy,       0,
    xy + wz,       1 - (xx + zz), yz - wx,       0,
    xz - wy,       yz + wx,       1 - (xx + yy), 0,
    0,             0,             0,             1,
  ])

  return dest
}

Matrix vertex shader

precision mediump float;

attribute vec3 aVertexPosition;
attribute vec2 aVertexUV;

uniform mat4 uModelMatrix;
uniform mat4 uViewMatrix;
uniform mat4 uProjectionMatrix;

varying vec2 vUV;

void main(void) {
  vUV = aVertexUV;

  gl_Position = uProjectionMatrix * uViewMatrix * uModelMatrix * vec4(aVertexPosition.xyz, 1.0);
}

Quaternion vertex shader

precision mediump float;

attribute vec3 aVertexPosition;
attribute vec2 aVertexUV;

struct Transform {
  float scale;
  vec3 translation;
  vec4 rotation;
};

uniform Transform uModel;
uniform Transform uView;
uniform mat4 uProjection;

varying vec2 vUV;

// Source:
// https://twistedpairdevelopment.wordpress.com/2013/02/11/rotating-a-vector-by-a-quaternion-in-glsl/
vec3 rotateVector(vec4 quat, vec3 vec) {
  return vec + 2.0 * cross(cross(vec, quat.xyz) + quat.w * vec, quat.xyz);
}

void main(void) {
  vUV = aVertexUV;

  vec3 world = rotateVector(uModel.rotation, aVertexPosition * uModel.scale) + uModel.translation;
  vec3 view = rotateVector(uView.rotation, world * uView.scale) + uView.translation;

  gl_Position = uProjection * vec4(view, 1.0);
}

sentences:
How do I get access to the PS4 platform tools for Unity? I know that you can go to the "Xbox ID" program to get all the resources you need for the Xbox platform (developer forums, Unity SDK, etc.). but there is not really information about how to get the PlayStation tools.

...Well other than the contact sales button in Unity which links to Unity and not Sony (oddly enough).

So where does someone who hopes to put their games onto one of the Sony platforms (PS4, Vita, PS3, etc) go to get the build tools (and other things) they need? Do Sony contact you about it if they're interested or is it really only for developers who are considered above Indy?

sentences:
Multiple IF statements on Update (Unity) Background

I am testing out a "Pause" system for my game. I have a Game Manager script and figured as it's the GM, it's a good place to stick a Pause system.

My pause works that on pressing "P" key, the timeScale is switched between 0 and 1.
Due to the nature of the game, if the game is paused and then unpaused I want the timeScale to not "jump" to 1 but to gradually increase, taking half a second to reach "normal" game speed again.

This aspect is NOT my issue. This is just background.

My Code:

I have the pause detection in the Update script. I figured two if statements to check Timescale values and then to take appropriate action.

(SloMoTime is a timescale that kicks in when the player wins or looses the level)

My Code:

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

public class GManager : MonoBehaviour
{
    public float sloMoTime = 0.2f;
    public bool ballInPlay = false;

    ....

 void Update()
     {
     if(Input.GetButtonDown("PauseGame") && ballInPlay == true)
     {
         if (Time.timeScale == 0)
            {
            //Game is already paused, so now continue...
            // dactivate "paused" text notice
            paused.SetActive(false);
            /***
             * Becauase we are speeding time up we can't use deltaTime
             * Easy as the timescale we want is 0.5f so 1/0.5 == 2. So use 2.
             ***/
            Time.timeScale = Mathf.MoveTowards(Time.timeScale, 1.0f, 2f);
            }
        if (Time.timeScale > slowMoTime)
            {
            //Pause the game.
            Time.timeScale = 0;
            // Show "paused" Text notice.
            paused.SetActive(true);
            }
        }
    } //end Update.
} //close class.

Now, Can you see any major issues here?

My Issue

I found running my script from above, that the game did not pause.

I expected every frame to load Update, then to check IF number 1, and then check If number 2 (hence in that order).  then continue.

I found using error logs that by swapping the If statments around that only the first if statement was ever executed. So the game would alternatively always pause but then never unpause. I additionally found with error logs that the values of TimeScale where not causing this inconsistency.

What I have trouble with is understanding why this happens. Why do two completely mutually exclusive IF statements not both fire, when in the same method?

FAILS:

Class {
    void Update () {
       if(){
          //works
       }

       if(){
         //never works
       }
   } //close method.
}

A Solution

BUT putting the second IF statement within an else solves this issue.

WORKS:

Class {
    void Update() {
       if(){
          //works
       }
       else if(){
         //works
       }
   } //close method.
}

Obviously this is impractical for more than a few ifs at once and I find it hard to understand why this logic works and the previous logic never did.

I havn't yet dug into if this is Update or timeScale (entity rather than value) specific but Why does this happen?

sentences:
According to Collision Change Rotation of Car Basically I want to give rotation to player car as per collision occur with wall. Following image gives you over all idea.

I have following code that giving me correct collision reflection but its in position form not for rotation.

void OnCollisionEnter2D (Collision2D other)
{
    ContactPoint2D contact = other.contacts [0];
//      Vector3 reflectedVelocity = Vector3.Reflect (direction, contact.normal);
//      direction = reflectedVelocity;

    Quaternion reflectedRot = Quaternion.FromToRotation (transform.up, contact.normal);
    transform.rotation *= reflectedRot;
}

What I have to do for getting correct collision rotation for car? As well smooth turn for car on same rotation so car start moving on that way.

Please give me some help for this.

sentences:
How to implement large data files without using up a lot of space at runtime? Say I have a bunch of images that I want to use with my game; I want the image files to be external, so overall I have the game's executable and a directory full of images. Let's say there are 100+ images and the size of the directory is ~500 MB.

I don't want the player to easily access these image files, so rather than having a directory containing 100+ individual files, I pack all the images into one large 500 MB file: "images.big"

With compression, I can reduce the size of "images.big" to ~50 MB. So all the player needs to download is the executable and a 50 MB file.

The problem is when I want to display the images in the game, it has to decompress "images.big" which creates a temporary 500 MB file and then it has to unpack all the images into a temporary directory (taking up another 500 MB) so it can display them based on filename. The game's directory goes from 50 MB to 1 GB, and on top of that the player can easily access the image files while the game is running.

Is there a much better way to go about this, or is it really a non-issue for a game to be creating such large temporary files/directories at runtime?

sentences:
Libgdx: move img from one point to another? I'm trying to make an image move towards another point.
I only have the current X/Y and the destination X/Y + Speed.

That's it.

public void Draw(SpriteBatch batch, int goalX, int goalY){
    destX = goalX - posX;
    destY = goalY - posY;

    dist = Math.sqrt(destX * destX + destY * destY);
    destX = destX / dist;
    destY = destY / dist;

    posX += destX * this.speed;
    posY += destY * this.speed;

    batch.draw(img, posX, posY);
}

This is my code, it kinda moves towards the object, but it moves past the object to a certain distance and then starts spazzing out for some reason.

The other point is also moving, just so you know.

Anybody can help me with this?

sentences:
Texturing without D3DX Well, i have been online for hours looking for solutions, but i have found none. Im looking for a way to create textures without the function D3DXCreateShaderResourceViewFromFile.
Since D3DX is deprecated i figured that DirectXTK was the way to go since it is supported officially. I found that i could use the function CreateWICTextureFromFile, but whenever i use it i get the following linker errors:
LNK2038 mismatch detected for '_MSC_VER' value 1800 doesnt match value 1900 in

LNK2019 unresolved external symbol "__declspec(dllimport) public: void __thiscall std::_Container_base12@std@QAEXXZ referenced in function "public: void __thiscall std::_String_alloc<0,struct std::_String_Base_types>>::_Free_proxy(void)".......

any idea why is this happening? (i have both the header included and the DirectXTK.lib library linked into the project)?
and is there any simpler way to create textures, without the added whole library just for 1 function?

sentences:
how to order entities by their distance from 0 on the x axis I'm creating an infinite runner game in which you control several characters at once.  Right now when you press the spacebar, they all jump at once but, I want them to jump at separately, one after the other from right to left(largest x to smallest x) so I need to order them in some way to represent that.
I tried using bubble sort to do this with no success so I tried my own approach where I scan the screen for the x position of the characters and assign their order to the number of passes the loop has gone through:
public void SetJumpOrder()
    {
        int pass = 0;

        foreach (Alien a in handler.aliens)
        {
            for (int i = 1000; i > 0; i--)
            {
                if (i == a.position.X) a.jumpOrder = pass;
            }
            pass++;
        }
    }

The code above didn't work because it just gave the order of the aliens list instead.  Any suggestions?

sentences:
Clip shadow frustum to scene bounds I have a global light in my scene. It casts shadows using shadow mapping and has an associated camera (for rendering to the shadow map). I'm going to refer to it as my "shadow camera" from now on.

I need to find a way to place my shadow camera's near plane as close as possible to my scene's bounding box (clip it to the scene bounds).
I need to do this so the shadow casters are never clipped by the shadow camera's near plane (otherwise I'd get holes inside of shadows) and to make sure I don't accidentally cull any shadow casters behind the camera. This would also allow me to increase the shadow mapping precision, because it lets me move the near and far planes closer together.

Example 1 (possible to do using a simple plane check):

Example 2 (NOT possible to do using a simple plane check):

The black box is the scene's AABB (but it would be nice if this would work for OBBs or other shapes too).
The yellow arrow represents the light direction.
The green box is the shadow camera's frustum without any modifications.
The red box is my desired result.

At the moment I'm constructing the red box by projecting the black box onto the global light's direction vector and use the closest vertex's distance to compute the shadow camera's near plane. But this makes it impossible to get something as seen in the 2nd image. Instead the red box starts above the scene's AABB.
I have thought of using SAT for this, but it doesn't seem to be the solution.

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:
Unity Editor windows went black I recently bought a new laptop, with Intel i5-5200U HD graphics 5500 and AMD Radeon R5 M230 2GB and 8gb ram, and heres what happens with my Unity: If open it, minimize it and then maximize again, it'll render some weird black screen in random areas of the editor, like this:

But, if I instead of minimizing unity and just opened other window , when I go back to unity nothing happens, no black weird "squares". So this just happens when I minimize unity itself and then maximize it, if I maximize another program over unity and then open unity again, it will not happen. Can anyone please tell me why this happens??? I always have to restart unity.... Is this a problem with my video card? plz help

sentences:
Why do I get a segmentation fault on launch with this code? I am currently writing a pong clone in C++ with SDL on top. Currently, I have hit a roadblock. If I add a new variable, my game won't launch, and will give "segmentation fault" in the debug terminal.

When I comment out a variable, the following code gives no errors, but otherwise, it just returns "Segmentation Fault" on the debug terminal after flashing the frame the game would normally appear in.

#ifdef __cplusplus
#include <cstdlib>
#else
#include <stdlib.h>
#endif
#ifdef __APPLE__
#include <SDL/SDL.h>
#else
#include <SDL.h>
#endif
#include "SDL/SDL_image.h"
#include "SDL/SDL_framerate.h"

#include "checkcol.h"

Uint8 *keystates = SDL_GetKeyState( NULL );

int main ( int argc, char** argv )
{
    // initialize SDL video
    if ( SDL_Init( SDL_INIT_EVERYTHING ) < 0 )
    {
        printf( "Unable to init SDL: %s\n", SDL_GetError() );
        return 1;
    }

    atexit(SDL_Quit);// make sure SDL cleans up before exit

    // create a new window
    SDL_Surface* screen = SDL_SetVideoMode(640, 480, 16,SDL_HWSURFACE|SDL_DOUBLEBUF);
    if ( !screen )
    {
        printf("Unable to set 640x480 video: %s\n", SDL_GetError());
        return 1;
    }

    SDL_Surface* left = IMG_Load("left.png");
    SDL_Surface* right = IMG_Load("right.png");
    SDL_Surface* ball = IMG_Load("ball.png");

    if (!left||!right||!ball)
    {
        printf("Unable to load a png: %s\n", SDL_GetError());
        return 1;
    }

    // centre the bitmap on screen
    SDL_Rect leftr;
    leftr.x = 0;
    leftr.y = (screen->h - left->h) / 2;

    SDL_Rect rightr;
    rightr.x = (screen->w - right->w);
    rightr.y = (screen->h - right->h) / 2;

    SDL_Rect ball1;
    ball1.x = ((screen->w - ball->w) / 2)+50;
    ball1.y = (screen->h - ball->h) / 2;

    SDL_Rect ball2;
    ball2.x = ((screen->w - ball->w) / 2)-50;
    ball2.y = (screen->h - ball->h) / 2;

    bool b1xm=0;//describes ball 1's movement in x
    bool b1ym=0;
    bool b2xm=1;
    bool b2ym=1;

    unsigned short lscore=0;
    unsigned short rscore=0;

    FPSmanager * manex;

    SDL_initFramerate( manex );
    // you want the top framerate to be 60 for example
    SDL_setFramerate( manex, 60 );

    // program main loop
    bool done = false;
    while (!done)
    {
                         //this is where my main code is
    } // end main loop

    // free loaded images
    SDL_FreeSurface(left);
    SDL_FreeSurface(right);
    SDL_FreeSurface(ball);

    // all is well
    printf("Exited cleanly\n");
    return 0;
}

sentences:
When to get input state: multiple times or one time in a static class? Let's say I have these classes:

Player

Here I want to make the player jump:

  current_state_ = Keyboard.GetState();
  if ((current_state_.IsKeyDown(Keys.Space) || current_state_.IsKeyDown(Keys.Up))
       Jump();

Intro scene
GameOver scene

Here I just want to give the possibility to skip those scenes:

  current_state_ = Keyboard.GetState();
  if ((current_state_.IsKeyDown(Keys.Space) || current_state_.IsKeyDown(Keys.Up))
       SkipScene();

My question is what is usual done:

"Asking" for input in every class, or make a static class that asks for input every update, and then you get that value?

public static class InputHandler
{
    private static KeyboardState current_state_;

    public static bool IsSpacePressed()
    {
        return current_key_.IsKeyDown(Keys.Space);
    }

    // Others

    // To be called in game's main loop
    public static void Update(GameTime gametime)
    {
        current_key_ = Keyboard.GetState();
    }
}

I'm worried about that because I thought (don't know if it is correct!) that maybe it is wrong to ask multiple times per update for input.

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:
Optimize polygons renderization I'm developing a game (in Ogre3D) that, in short, consist in a vehicle that moves along a terrain and leaves a colored trail behind it. The trails are basically quads (a), these quads changes their color accordingly to the vehicle's speed.
My challenge now is that I need to subdivide these quads into 5 (or more) sub-polygons (b) and each one of them should have a different color accordingly to others vehicle's properties. When moving around for a while these quads start to accumulate on screen and the render process starts to heavily lag and thus fps count is sub optimal.

Some considerations:
 - All quads are appended to a single mesh that belongs to a single entity sharing the same material, so batching should be optimal.
- Tried adding LOD for this mesh but I had no luck to make it work in Ogre1.9.

So, my main question is how can I optimize the rendering of this polygons??
Can I delegate this task by somehow to the gpu via shader programming?

Edit: My goal would be to avoid having to draw each one of those sub-quads in (b) (only draw the big quad (a)) but by somehow being able to colorize each  one of those sub-quads.

sentences:
In Unity how can I know which direction is the screen auto-rotated? From the Screen.orientation description I get

  If the value is set to ScreenOrientation.AutoRotation then the screen will select [...] automatically as the device orientation changes.

This seems to imply that if the screen does auto-rotate, then Screen.orientation has been set to ScreenOrientation.AutoRotation.

If that's so, how can I know in which direction it has been auto-rotated?

Disabling the auto-rotation doesn't count (obviously), and I need to distinguish between LandscapeLeft and LandscapeRight, so checking height and width doesn't work either.

This should be cross-platform, without including any kind of non-C# plugin.

(the answer, given this documentation, seems to be "you can't", but maybe I'm missing something)

sentences:
Collision Detection Failing at faster Speed? I am new to programming so thought I would make a Pac-Man clone to teach myself. I am doing it in C++ using SFML. Anyway, I use a bunch of collision tests. Everything works great.. but if I am going to fast then the collisions simply fail and nothing happens.

Pac-Man is moving though a factor  = velocity * frametime;

I am using SFML rectangles to do the tests... eg...

sf::FloatRect.contains(pacman.getPostion);

This tests a point in space to see if it is inside the rectangle. The point being the centre of pac-man.

So yeah.. I would love to hear any ideas on this!

Thanks in advance
--Jynks

if ( _rectSwitch.getGlobalBounds().contains( PacMan.getPosition().x, PacMan.getPosition().y )

sentences:
Is there a way to check if an object is currently colliding with anything? I need to test from another Script on a different GameObject, whether a particular GameObject is colliding with anything (in particular using trigger).

So, for my purpose, I don't need OnCollisionEnter/OnTriggerEnter events, but I need something like this:

if ( myObject.isOnCollision )
   do something

How can I do this?

sentences:
Best Method to Create Side Scrolling Levels? - Cocos2D I am looking to start my first side scroller project using Cocos2D, but I am curious. What is the preferred/best method of creating you levels? For large levels I see hand making it very laborious, is there a more visual way of doing so, as punching in coordinates for everything at a guess seems wrong. Which is why Im here to learn from you guys.

So any help would be much appreciated, thanks.

sentences:
Locomotion-system with irregular IK Im having some trouble with locomtions (Unity3D asset) IK feet placement. I wouldn't call it "very bad", but it definitely isn't as smooth as the Locomotion System Examples.

The strangest behavior (that is probably linked to the problem) are the rendered foot markers that "guess" where the characters next step will be. In the demo, they are smooth and stable. However, in my project, they keep flickering, as if Locomotion changed its "guess" every frame, and sometimes, the automatic defined step is too close to the previous step, or sometimes, too distant, creating a very irregular pattern.

The configuration is (apparently)Identical to the human example in the demo, so I guessing the problem is my model and/or animation. Problem is, I can't figure out was it is =S

Has anyone experienced the same problem? I uploaded a video of the bug to help interpreting the issue (excuse the HORRIBLE quality, I was in a hurry).

sentences:
Advice on Story Text-Based Game I am currently in preparation on making a game. This game will be looks like Lifeline by 3 Minute Games, which is a story text-based game.

My game will have the same concept with it. Where there will be a scrollable history of conversation between player and characters in game. However, my game will has more than one conversation history. He will be able to interact with more than one character. Therefore, when the game start, it will show list of interactable characters in game, and player can choose who he will interact with when any available.

I am planning to make it with Unity. But I don't know is it possible to create some scrollable history of text, each with different content, like chat history, in Unity.

So I wanna ask your opinion, is it good to just continue with using Unity, or should I change the game engine I use? If I should change, what is the best game engine to cope with this kind of game?

Thank in advance :)

sentences:
Libgdx Actions interpolation Fadeout In libGDX there is a simple fade Interpolation that speeds up towards the end of the action animation. But what I am looking for is the reversed of it, it needs to start fast and slow down near the end. Is there a Interpolation function for that or how can I create this effect myself?

Currently i'm directly just initiating the action from the actor.

actor.addAction(Actions.moveTo(currentTouch.x - actor.getWidth() / 2,
 currentTouch.y - actor.getHeight() / 2,
 .2f,
 Interpolation.fade));

sentences:
Are these non-standard applications of rendering practical in games? I've recently got into 3D and I came up with a few different "tricky" rendering techniques. Unfortunately I don't have the time to work on this myself, but I'd like to know if these are known methods and if they can be used in practice.

Hybrid rendering

Now I know that ray-tracing is still not fast enough for real-time rendering, at least on home computers. I also know that hybrid rendering (a combination of rasterization and ray-tracing) is a well known theory. However I had the following idea: one could separate a scene into "important" and "not important" objects. First you render the "not important" objects using traditional rasterization. In this pass you also render the "important" objects using a special shader that simply marks these parts on the image using a special color, or some stencil/depth buffer trickery. Then in the second pass you read back the results of the first pass and start ray tracing, but only from the pixels that were marked by the "important" object's shader. This would allow you to only ray-trace exactly what you need to. Could this be fast enough for real-time effects?

Rendered physics

I'm specifically talking about bullet physics - intersection of a very small object (point/bullet) that travels across a straight line with other, relatively slow-moving, fairly constant objects. More specifically: hit detection. My idea is that you could render the scene from the point of view of the gun (or the bullet). Every object in the scene would draw a different color. You only need to render a 1x1 pixel window - the center of the screen (again, from the gun's point of view). Then you simply check that central pixel and the color tells you what you hit. This is pixel-perfect hit detection based on the graphical representation of objects, which is not common in games. Afaik traditional OpenGL "picking" is a similar method.

This could be extended in a few ways:

For larger (non-bullet) objects you render a larger portion of the screen.
If you put a special-colored plane in the middle of the scene (exactly where the bullet will be after the current frame) you get a method that works as the traditional slow-moving iterative physics test as well.
You could simulate objects that the bullet can pass through (with decreased velocity) using alpha blending or some similar trick.

So are these techniques in use anywhere, and/or are they practical at all?

sentences:
Drawing at negative coordinates in XNA? I am trying to make a 2D isometric RPG and I kind of hit a wall when it comes to lighting.
I was thinking of using shaders, if I manage to understand them.The problem I am anticipating is the presence of light sources outside the screen.In order to calculate shadows and so on I'd still need to have those objects rendered even if they're offscreen or else light would pop in and out if I move the view around the map. I was thinking of drawing the entire level, not just what is seen,  but that would mean drawing at negative and outside the view coordinates.Does that work or I should seek a better, more efficient alternative?

sentences: How can I use touch input for 3rd-person controls? I have a 3rd-person controller in my Unity scene, which I can only control with the WASD buttons. But since I plan to make a smartphone game, I wonder how I can change these controls t swipe up/down/right/left and (if possible) keep WASD for debugging.

sentences:
How to shoot a triangle out of an asteroid which floats all of the way up to the screen? I currently have an asteroid texture loaded as my "test player" for the game I'm writing. What I'm trying to figure out how to do is get a triangle to shoot from the center of the asteroid, and keep going until it hits the top of the screen. What happens in my case (as you'll see from the code I've posted), is that the triangle will show, however it will either be a long line, or it will just be a single triangle which stays in the same location as the asteroid moving around (that disappears when I stop pressing the space bar), or it simply won't appear at all. I've tried many different methods, but I could use a formula here.

All I'm trying to do is write a space invaders clone for my final in C#. I know how to code fairly well, my formulas just need work is all.

So far, this is what I have:

Main Logic Code

        protected override void Draw(GameTime gameTime)
        {
            GraphicsDevice.Clear(ClearOptions.Target, Color.Black, 1, 1);

            mAsteroid.Draw(mSpriteBatch);

            if (mIsFired)
            {
                mPositions.Add(mAsteroid.LastPosition);
                mRay.Fire(mPositions);
                mIsFired = false;
                mRay.Bullets.Clear();
                mPositions.Clear();
            }

            base.Draw(gameTime);
        }

Draw Code

            public void Draw()
            {
                VertexPositionColor[] vertices = new VertexPositionColor[3];

                int stopDrawing = mGraphicsDevice.Viewport.Width / mGraphicsDevice.Viewport.Height;

                for (int i = 0; i < mRayPos.Length(); ++i)
                {
                    vertices[0].Position = new Vector3(mRayPos.X, mRayPos.Y + 5f, 10);
                    vertices[0].Color = Color.Blue;
                    vertices[1].Position = new Vector3(mRayPos.X - 5f, mRayPos.Y - 5f, 10);
                    vertices[1].Color = Color.White;
                    vertices[2].Position = new Vector3(mRayPos.X + 5f, mRayPos.Y - 5f, 10);
                    vertices[2].Color = Color.Red;

                    mShader.CurrentTechnique.Passes[0].Apply();
                    mGraphicsDevice.DrawUserPrimitives<VertexPositionColor>(PrimitiveType.TriangleStrip, vertices, 0, 1);

                    mRayPos += new Vector2(0, 1f);

                    mGraphicsDevice.ReferenceStencil = 1;
                }
            }

sentences:
How to instantiate an object to a randomised Vector2 So I'm trying to make a little game where squares randomly spawn around a set area and you have to tap them. The game is 2D. I'm having trouble using my randomly generated x and y floats to instantiate a cube in the game. Here is my code:

#pragma strict

public var play = false;
public var xpos : float;
public var ypos : float;
public var cube : GameObject;

function Start () {

}

function Update () {
}

function Game () {
    xpos = Random.Range(-10f,10f);
    ypos = Random.Range(-4.45f,4.45f);
    Instantiate(cube, new Vector2(xpos, ypos));
}

And here's the error!

Assets/gameController.js(18,20): BCE0023: No appropriate version of 'UnityEngine.Object.Instantiate' for the argument list '(UnityEngine.Rigidbody, UnityEngine.Vector2)' was found.

Any help would be appreciated. Thanks!
-Alex

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:
Line renderer in 3D sorting order I'm using a line renderer as a laser aim for my character. If the aim hits an object it ends at that object. If the aim doesn't hit an object it continues a predefined distance.

If I aim at an object it works fine, if I stand behind the object it also works, but if I stand in front of it, the line is rendered behind the object creating the illussion that the character stands behind the object.

If I change the sorting order for the line I can make it to be in front of the object, but this is a bit tedious because then it will be in front of this object when it is in fact behind it.

In the screenshot below a line is drawn from the picked up C4 which is in front of the pillar, but the line is drawn behind the pillar.

Is there any way to solve this issue with a line renderer? I've been thinking of just using a cube and stretch it instead.

Thanks in advance!

Update 1: I made a cube-solution instead, but soon realized that the issue is with a shader that is set to fade/transparent and that this is due to sorting order. How can I dynamically change the sorting order in code so that my moving transparent object always appear in the correct place?

Update 2: I noticed that my own answer below isn't working 100%. It works for most scenarios but if I'm standing at origo and aiming behind a pillar the sight is rendered in front of the pillar. In the image below it is clearly visible from the top view that I'm aiming behind the pillar. (This is done with a deformed cube, the line renderer had even more issues).

sentences:
How can I pass an array of floats to the fragment shader using textures? I want to map out a 2D array of depth elements for the fragment shader to use to check depth against to create shadows. I want to be able to copy a float array into the GPU, but using large uniform arrays causes segfaults in openGL so that is not an option. I tried texturing but the best i got was to use GL_DEPTH_COMPONENT

glTexImage2D(GL_TEXTURE_2D, 0, GL_DEPTH_COMPONENT, 512, 512, 0, GL_DEPTH_COMPONENT, GL_FLOAT, smap);

Which doesn't work because that stores depth components (0.0 - 1.0) which I don't want because I have no idea how to calculate them using the depth value produced by the light sources MVP matrix multiplied by the coordinate of each vertex.

Is there any way to store and access large 2D arrays of floats in openGL?

sentences:
opengl bump mapping (normal mapping) problem with VBO and GLSL hi i am beginner i am trying to implement bump mapping with vbo and glsl.
My question is: did i make bump mapping ? if i did why these edges didnt disappear ?

high and low meshes (i used low meshes of course)

sentences:
Any good books on graphics programming? I've been looking for a book that takes a bottom-up approach for graphics programming. So something that starts with 2d filtering, maybe moving into normal mapping, then ambient occlusion, etc.

I ask because I've been lazy for the last few years in game development and always used an engine that handles this. I want to start writing some shaders for my games instead of relying on the cryptic ones that I've borrowed in the past. I think a very strong knowledge in this will help and I'm a bottom-up kind of learner so please help me out!

I know the GPU Gems series is great, but they seem to be more like a cookbook than a bottom-up approach that I want. You tend to get more scattered theory from cookbooks instead of building on theory from previous chapters.

EDIT: Preferably something you've read! I can search amazon for this, but it's hard to get a unbiased review that way.

sentences:
Rain World : How to have intelligent movement / animation? In the project RainWorld the characters seem to move "intelligently" as they move "unrestricted". They seem to know "how" to move their limbs and "what" needs to be done.
Here for an example the lizard seems to know how to move his body after he got struck by a weapon.

Also here it looks as if it is intelligently grasping the long ladder/using the jet thinging to climb itself up.

I had been looking into many sources to find out how such gets done but with no significant result. I need help to point myself to the right direction.

Edit

I have figured out from dev log  that characters are just bunch of boxs connected/bounded by an elastic bound "string". But the way the character moves still eludes me.

sentences:
How many LoD versions of a model should I have? Many games facilitate better performance by increasing/decreasing the number of triangles/polygons that are drawn, depending on how close the camera is to said object. Mountains, viewed from far away, could become literally flat. Models would steadily lose resolution as you walk further away from them, etc.

If I want to implement such a system, how many different permutations of the same model/models should I have? Suppose the model is 20,000 triangles when viewed up close, but then I halve that when the camera goes away, so now it is 10,000. Then again, when the camera is even further away, making it 5,000 triangles. Would three versions be enough? Or is this really just an arbitrary implementation? Does it depend on the game itself?

sentences:
Setting up CCMenu for Cocos2d I am very new to Cocos2d programming and was thinking to build up my first app. I learnt some basics related to CCMenu and CCMenuItems. But I was wondering whether I could provide animations in such a way that every CCMenuItem would animate first and then appear in the CCMenu. Will that be possible in Cocos2d? Can I get some tutorials or samples regarding this?

Thanks.

sentences:
Transparent image changing color to very light when used on light background in Unity I'm trying to use this transparent image (transparent brown, with a transparent white shadow):

over this background:

in Unity UI.
But the end result is not similar to what I see in photoshop at all.
What I expect and what I have inPhotoshop:

What I get in Unity:

How can I fix this?

sentences:
Why are some games using some dithering pattern instead of traditional alpha for transparency? Recently, I have seen some 3D games (eg: GTA IV)  to use some kind of ordered dithering to simulate transparency / alpha.

The polygons are not transparent as usual, but instead render a dithering texture that gradually switch from left to right to simulate transparency :

The effect is not unpleasant but rather surprising to see at first (vs traditional alpha blending)

Except for the visual aesthetic effect it produce, is there any reason some games do this (better performance, saving bandwidth or any else i do not think about) ?

I have searched on the web but cannot found anything about this technique.

sentences: Would it be more efficient to handle 2D collision detection with polygons, rather than both squares/polygons? I'm working on a 2D game engine and I'm trying to get collision detection as efficient as possible. One thing I've noted is that I have a Rectangle Collision collider, a Shape (polygon) collider and a circle collider. Would it be more efficient (either dev-time wise or runtime wise) to have just one shape collider, rather than have that and everything else? I feel it would optimize my code in the back end, but how much would it affect my game at runtime? Should I be concerned with this at all, as 3D games generally have tens of thousands of polygons?

sentences:
Why Post-Processing v1 not works in WebGL build? In my WebGL browser app, i've tried to add Post Processing (first version) stack.

I'm using Unity 2018.4.6f1 (i started 1 years ago to develop this app).

I've added Post Processing Behaviour to my Camera, and this is what i've enabled:

When i run my scene on Chrome or Firefox, Camera appears all black but UI is correctly rendered.

Are there any incompatibility issue using Post Processing and WebGL ?

Thanks

sentences:
Why not draw a custom font with lines and/or polygons? Reasons/advantages I see:

More flexible procedural animation.
Completely custom font.
Performance (no texturing or high-poly)?
No assets (unless data-driven).
Multi-resolution compared to sprite fonts / sprites.

Downsides I see:

Effort and time to define every character.
Effort and time to implement the general code.
Future localization pain.

Example: https://youtu.be/Tz7L-92Bo-M?t=2m13s

Is this unreasonable and why?
Will I get a rendering performance win compared to sprite fonts on common multi-core mobile devices?

sentences:
Will scaling images at runtime impact my game's speed? I have read the android developer guide to working on different screen sizes. My question is, if I only provide one image in the drawable file, and let android scale it for me, will it impact the overall performance of my app?

For example, I am simply displaying a red square, and there aren't any details to the square. Should I provide alternative resources, will android's scaling impact my performance as an app on bigger/smaller screens?

sentences:
What certificate do I need for my client-server game? I have a multiplayer game with a custom client app and an application server (no browser or website). I need

the data that passes between them to be encrypted both for the login data obviously and for the game actions.
that the server answer only to requests from my clients and that the clients get information only from the server.

From what I read, I need 2 certificates for that. Can I use self-signed certificates for the client and server? How do other games usually handle this?

sentences:
unity how to make an animation reverse mid way through I have a animation of several parts moving (think bridge) and would like the animation to reverse mid way through if a certain condition is modified (function call). I have the Animation and the AnimationClip which are added via a script.

Currently this is the code:

Animation anim;
public AnimationClip Open;
// Use this for initialization
void Start () {
    anim = GetComponent<Animation>();
    anim.AddClip (Open, "Open");
    anim.Play ("Open");

}
void Update(){
    Debug.Log ("update");
    if (Input.GetKeyDown ("space")) {
        rev ();
        Debug.Log("reversing");
    }
}
void rev(){
    anim.Rewind()

}

However anim.Rewind() doesn't do what I want it to do it moves the animation back the the first frame rather then slowly move the animation backwards. I know there are some tricks involving the time or by changing the speed but I cannot figure those out either.

sentences:
How can I create a set of collision points for an arbitrary mesh? In my project I am working on automatically deforming an arbitrary mesh with respect to another arbitrary mesh, within the context of user generated content, similar to this deformer being developed for Second Life.

In order to preserve the features of a deformed mesh, which may consist of things such as 'folds' for the edge of the mesh, I would like to deform my target with a set of deformers, however defining an appropriate set of deformers has given me trouble and I think now the best way to do it is to create a 'collision mesh'/set of 'control points'. These points will proxy for the target mesh in collision detection and define the deformers used to deform the main mesh. Since I generate it its structure can be more tightly controlled.

I want to create a 'grid' of points which approximate the surface of my mesh, like the control points on a NURBS surface. I was thinking of a technique with principles like those used in the layered depth image technique here, but wondered if there was already a good existing solution for what I want to do?

What is the most effective way to create something that approximates a collision mesh for an arbitrary mesh automatically?

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:
Turn-based Pencil/paper game; phases I'm not entirely sure this is the right place since all I see is coding questions, but I'll ask anyway in the hopes that someone can answer or point me in the right direction.
I've been developing a pencil/paper war strategy game for a while now and have run multiple tests with other players, but I've been having one major issue with the action system.
The game is turn-based and phase-based during the turns. Each turn has 7 phases and each unit has anywhere between 1 and 7 phases, depending on the unit itself. The phases are split up for the turn phase, so a unit with a movement phase can only move on the x; |x|2|x|4|x|6|x|.
I have a separation of attack phases and movement phases which can be two different things. For example, a vehicle has a movement rating of 6 but an attack of 4. This means it can move 6 times and attack only 4 times but only on it's designated rating.
Hopefully that's enough explanation... Anyway, I have had an issue when it comes to initiative. If two units have an attack on the exact same part of the phase and both deal enough damage to destroy each other... How could I determine who attacked who first? Should one unit be able to destroy the other, or should both just destroy each other?
The second part of that would be... If both units still have the same attack phase and unit 1 deals enough damage to destroy the other but unit 2 only deals a small amount... Who went first? Should there be a dice roll or coin toss to determine or can someone help think of a way to fix this?

sentences:
Screen Space - Camera improper scaling on iOS device only I've reproduced the issue in a simple setup where I have two canvas's, one overlay and one camera. I put an image under both set to maintain aspect ratio, and set them to use anchors for sizing instead of pixels. On iOS the camera space canvas stretches the image improperly, and the overlay is fine. Both have identical settings, with Canvas Scaler set to screen size and to match width. This only seems to happen on older iOS devices, but my sample size is too small to say that for certain.
I expect both images to maintain aspect ratio on device, but the image under Screen Space - Camera stretches out of aspect ratio. Local Scale on all objects is what I would expect it to be so nothing interesting there.
Has anybody run into this issue before or have any idea what might be causing it?

sentences:
Huge performance difference when using drawImage with IMG vs CANVAS I put together a couple of simple tests that render an image to a canvas. One renders from an IMG, while the other renders from an offscreen CANVAS. You can see the code and results here: http://jsperf.com/canvas-rendering/2

In most browsers rendering from an image is much faster than rendering from a canvas, except in Chrome, where the situation is reversed. Can anyone explain the reason for the differences? After all, we are rendering the same pixel data to the same destination.

sentences:
Gaussian blur spritesheet/texture atlas without clipping edges I'm trying to apply a Gaussian blur to a shadow to soften them a bit. I can apply the blur fine, but the problem is that I end up with this:

Instead of this:

Which isn't great. The image is part of a spritesheet with a single pixel gutter around each frame.

I don't want to have to go back and add gutters big enough to accommodate the blur to every single frame of every spritesheet. Additionally because of the way the sprites have to be sorted I can't render all the shadows to a render target and then blur the entire target. I can achieve the effect I want with a sprite as a single image instead of as a spritesheet. I do that by creating the triangles 20% bigger than they need to be and then sampling the texture outside the bounds when the UV addressing is set to clamp. That doesn't work with a spritesheet though because then it just starts sampling the frames on either side of the current frame.

Is there a way to achieve what I want with a shader or other trickery? I really don't want to have to alter every spritesheet.

sentences:
What is the appropriate way to implement wobble/balance mechanics in Unity 3D? We are trying to implement a minigame where the player character sits on a bouncing ball, and needs to a) hit forward to move forward and b) hit left/right to adjust against the the ball's natural wobble (in other words, if the ball leans left, you must hit right).

We have tried implementing this by setting the bounciness and weight on the ball so that it bounces naturally when the player is not on it, then fixing the player model to the ball (in other words, treating them as a single unit), then having the CharacterController control the unit while it continues bouncing.

However, no matter how we tune the various factors (bounciness, weight, input multiplier, gravity), the ball remains quite sensitive and eventually spirals out of control. We would particularly like to allow the player some opportunity to regain control.

I have played a number of games that require some kind of reflex-based wobble/balance mechanic. Is there a general approach here that we are missing?

This question is for a small academic project, so we're wondering if there's a specific component we need, or part of the Physics engine we've missed, or technique we should look up - but please don't post code. There are no project requirements here except using Unity 3D (e.g. the assignment is not "implement a bouncing ball minigame").

sentences:
Getting the top layer of 3D perlin Noise I am generating 16x16x64 chunks. Afterwards I apply 3D noise to them. I want the first layer to be all grass blocks and after those I want layers of dirt.

The current problem is that I am getting some dirt blocks in my top layer.
So how do I get the entire top layer of the noise?

TArray<int32> heightMap = CalculateNoise();

    for (int32 x = 0; x < 16; ++x)
    {
        for (int32 y = 0; y<16; ++y)
        {
            for (int32 z = 0; z< 64; ++z)
            {
                int32 voxelIndex = x + (y * 16) + (z * (16*16));

                int heightmapValue = heightMap[voxelIndex];

                if (z == 30 + heightmapValue)
                    ChunkIDs[voxelIndex] = 1;
                else if (z == 29 + heightmapValue)
                    ChunkIDs[voxelIndex] = 2;
                else
                    ChunkIDs[voxelIndex] = 0;

            }
        }
    }

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:
Character animation in physics-simulated environment What are the standard solutions for animating characters in physics-simulated environments?

Let me explain what I mean - in most games characters are pretty much excluded from physics simulation - there are no forces acting on specific body parts (only gravity for the whole character) and limbs are forced to go into positions specified in key frames of animation... which in turn may produce infinite forces on the limbs and we know real muscles have limited strength...

What I want is character animation based on simulated muscles with plausible limitations - so character walking into a 1 T stone won't move it, or if he gets hit with a fast flying brick he would realistically fall (and brick won't just bounce like from the wall, whit character standing still like nothing happened).

Are there libraries that can do that? Maybe free ones for 2D simulations?

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:
Shape Centers as Vectors: Local space or World space? Given a shape (any shape) in a 2D world where all positions, locations, and centers are two dimensional vectors, should the shape's center be described in local space or world space?

EXAMPLE:

World Space center of a Rectangle: Position: (100, 100); Dimensions: (200, 200); Center: (200, 200);

Local Space center of a Rectangle: Position: (200, 200); Dimensions: (100, 200); Center: (50, 100);

World Space center of a Circle: Position: (100, 100); Dimensions: (50, 50) (diameter); Center: (100, 100);

Local Space center of a Circle: Position: (50, 50); Dimensions: (200, 200); Center: (0, 0);

sentences:
Question about CDLOD quad tree I have been digging and researching into CDLOD and there are some things I dont understand.

https://github.com/fstrugar/CDLOD/blob/master/cdlod_paper_latest.pdf states:

  The quadtree structure is generated from the input heightmap. It is of
  constant depth, predetermined by memory and granularity requirements.
  Once created, the quadtree does not change unless the source heightmap
  changes. Every node has four child nodes and contains minimum and
  maximum height values for the rectangular heightmap area that it
  covers.

Doe's this mean I calculate every node and child nodes to the finest level at the setup phase (i do not split and unsplit at run)? If so, what's the roughest level I start with? And how do I get the minimum and maximum height from my perlin noise height map for an node area?

Lastly how CDLOD would work, when I zoom in/out into a big planet (up factor)? Can get that into my imagination.

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:
How to calculate/detect the force of a collision? (Game-Maker Studio) How can I use game-maker to detect the force in a collision between two mobile (not fixed) objects?

This is used for damage calculation and possibly compression calculation.

My problem is this: while net force can be calculated using mass and acceleration, the idea of damage is focused on the individual components of the force applied on an object. For instance, if a car is pushing another car against a wall, even though there are no acceleration, people will logically feel like some damage must be done to both cars because forces were conferred on them. I want to know if there is some underlying mechanism in game maker's physics system (I use the latest version) that actually calculate a reaction force from the wall on the car so I can use it to calculate damage.

sentences:
Quick 3D sight calculation algorithm I have a tile based board game where units move in 3D space on a 2D isometric view. When calculating attack tiles for a unit, how do I verify that they aren't shooting through a wall or a level too high for them see. I need quickly verify a lot of these attack tiles are within a unit's range of sight (about 20). What's the fastest way I can verify line of sight with the x, y, and z axis?

Somebody posted a similar question here, but it covers 2D sight calculation instead of 3D (making the answer very different).

sentences: How to Initilize CCPoint Array from String? I've got string like this: {{0,168},{20,20}}, here indicates two points. I want to get them out to initialize my CCPoint. Do you guys know how to convert this?

sentences:
How to handle jumping up a slope in a runner game? In an 2D endless runner, what should happen when the player is running "too fast" up a slope and jumps?

For example, in a "normal" case:

    .O.
   . __..O_____
  . /
 . /
 O/
_/

If he is moving to the right slowly enough, he will jump upwards and land on the flat part of the surface. However, if he is moving too fast, the jump will have no effect as his forward motion will bring him back in contact with the slope before he can get high enough to pass over it. When the speed is sufficiently high, there will effectively be no jump.

     _________
    /
 .O/
 O/
_/

Are there any known ways to solve this issue? I know it's physically correct*, but are there techniques that other games use to overcome this in a reasonable manner?

As a last resort I'll have to just remove all slopes that are too slanted.

*If you constrain the player to never jumping backwards.

sentences:
How to make a custom event system framerate friendly? I have a simple event system:

class GameEvent{
    float executionTime;
    Action action;
}

class EventMgr : MonoBehaviour{

    List<GameEvent> events = new List<GameEvent>();

    void Update(){

        float timeNow = Time.time;

        for(int i=events.Count - 1; i >= 0; i--)
        {
            if(timeNow >= events[i].executionTime)
            {
                exents[i].action();
                events.RemoveAt(i);
            }
        }
    }

    public void ScheduleEvent(float delay, Action action){
        events.Add(new GameEvent(){
            action = action,
            executionTime = Time.time + delay;
        });
    }
}

Then,

I schedule events like this:

eventMgr.ScheduleEvent(0.1f, () => {
    // EVENT A - should be fired first
};

eventMgr.ScheduleEvent(0.15f, () => {
    // EVENT B - should be fired second
};

Everything works fine when I play on 60 FPS. Update() is fired once every ~0.016s. When I play the game on a device with 20-40FPS - things got a little bit tricky. Events seem to run in an incorrect order (Event B fired before event A).

The only possible cause is of course the framerate itself.
If the game runs at 20FPS, Update() would be called less frequently and both of these events would be fired in the same frame - and then, the order of their execution depends on the list itself.

What to do here?
Is there any trick to prevent this, is there any pattern for accurate, ordered event system in games which is FPS friendly?

sentences:
Unity: Render only select objects but show previously rendered objects I am making an RTS game which is having performance issues.

Is it possible to render the ground and units separately so I can only render the ground when the camera moves but keep the result displaying the units over the top?

I'm not sure what details to include but:

*The camera is fixed angle and orthographic

*The profiler says drawing takes up about 50% of CPU when units are moving.

*All the logic is done by a c# script outside of monoDevelopment but called through a gameobject each frame, (takes 2% of cpu in tests).

*Units are put in place using the "transform.position" command each frame.

*Units and tiles are instantiated and destroyed when the Camera passes them.

*The game is using rigged .3ds models for the units.

*The units have disabled rigidbodies.

*Each tile in the game is a separate sprite.

*The performance drops with ~100 low poly units without animation or ~20 higher poly units with animation.

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:
Zooming into generated map I have generated a 1024 X 1024 heightmap using Open simplex noise. Now i want to zoom into a 64X64 area. Every pixel in the 64X64 is not 16X16 on the larger scale.

I tried just generating the area, but problem is, that I want to also calculate normals from it, and the normals are different for the zoomed in area from the big map. The difference comes from the fact that on the big map the height difference between 2 pixels can be quite large, but when zoomed in, new pixels are place between the original 2 so if now normals are calculated, they are totally different.

How can I zoom into an area of a generated heightmap but retain the normals?
On the left is the large scale map and on the right is the zoomed in area. Zoomed in area is the upper left corner of the large scale map. As you can see the normals are completely different. Both of these images are textures. There are no meshes or anything only textures, and there will not be any meshes in future either.

This is how I calculate normals from heightMap.

            u = noiseValues[x + (y - 1) * width];
            r = noiseValues[x + 1 + y * width];
        }
        Vector3 up = new Vector3(0, 1, (noiseValues[index] - u)*100);
        Vector3 across = new Vector3(1, 0, (r - noiseValues[index])*100);

        normal = across.Cross(up).Normalized();
        normal = (normal + new Vector3(1, 1, 1)) / 2.0f;

After updating these lines in normal calculation:

 Vector3 up = new Vector3(0, 1/zoomFactor, (noiseValues[index] - u)*100);
        Vector3 across = new Vector3(1/zoomFactor, 0, (r - noiseValues[index])*100);

This is the result after adjusting normal calculation:

sentences:
Render 2D textures on a 3D object's face I am not familiar with 3D graphics, and I'd like to know the right way to render some 2D figures on different points of a wider face of a 3D object. My 3D object is just a cube representing a poker table. I have a 2D png for players' placeholders, and I'd like to render these figures on the 3D object where needed. An alternative solution would be to render the whole face with a big picture containing all the placeholders figures. However, it would be a waste of memory and thus less efficient.

What do you suggest?

sentences:
glUniformMatrix4fv OpenTK equivalent Very simple and quick question which surprisingly I couldn't find an answer to over the internet: what is the equivalent of glUniformMatrixfv for opentk? I've browsed all the 7 overloads of GL.UniformMatrix4 and none of them seems correct to me and/or I have found any example usage for.

E.g. if I have a

Matrix4[] matrices;

variable (properly initialized etc..) that I want to map on a

mat4 matrices[2];

in glsl, which GL.UniformMatrix4 overload should I use?

P.S. Using OpenTK.Next NuGet package version 1.1.1616.8959

sentences: Updating the position of a prefab in Unity for A* pathfinding I am trying to use Aron Granberg A* pathfinding project in my game. I am very new to Unity, so I am having some trouble figuring out how to instantiate multiple enemies from a prefab that will seek out my player. I am unable to set the player object from the scene as the target, since prefabs cannot take in scene objects. However, if I use the player prefab as the target, the enemies will only go toward the starting position of the player. Is there any way to update the prefab position as the player instance moves? Or is there a better way of doing this? I want this to be a top-down shooter style game (2D) with constant enemy spawning, so it doesn't make sense to set the target for each individual enemy instance. Any help would be greatly appreciated. Thank you!

sentences:
Unity 5.x - Editor only constructor/initilization event I have three scripts:

Level - Represents a Tile Based level.

LevelEditor - Custom Editor for Level.

Tile - A non monobehaviour class for storing tile information.

Level contains an array of Tiles to be allocated with 'new'. To avoid putting 'If array != null' everywhere in the code, I want to initialize the array simply to a size of 0 before anything else is ran.

However, I do not want this initialization to happen at run time, just only for editing purposes.

Is there some event I can use that will run before Level.OnDrawGizmos(), and also not be part of runtime code? Or is LevelEditor.OnEnable() the best I can do, with some checks in Level.OnDrawGizmos()?

sentences:
Python + Pygame - Collision problems I'm currently developing a game in Python + Pygame and i came up with a problem with the player and the platforms. The game is a 'runner' where the player it's fixed (The 'x' position isn't variable, only the jump).

This is how i'm currently doing the collisions managment:

def collide(self, yvel, platforms):
    for p in platforms:
        if pygame.sprite.collide_rect(self, p):
            if yvel > 0:
                self.rect.bottom = p.rect.top
                self.onGround = True
                self.yvel = 0
            if yvel < 0: self.rect.top = p.rect.bottom

'platforms' its a RenderUpdate group with the platforms (a simple sprite).

When the player is falling from a platform and collides with the next platform, not exactly on top of it but a little below, that's when the character jumps to the position shown in the code above, rather than collide and fall.
I don't know how to check the left bound without a 'xvel' parameter.

(The screen shows an example, but the player only changes the y-axis coordinates, the platforms are updating their position)

I've tried supply a number to a 'xvel' parameter, and check if the character wasn't on the ground (Jumping) and the 'xvel' was greater than 0, but it isn't working at all.

Thanks in advance.

sentences:
Stamina Bar refuses to go back up I am creating a very simple script for my stamina bar to go down when I press M, but when I am not pressing M, for the bar to go back up slowly back to 100.The bar goes down fine when I press M, however, while the bar does go down, it refuses to go back up.

Attached is the code:

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

public class StaminaBar : MonoBehaviour {
    public Scrollbar StaminaGUIBar;
    public float Stamina;

    void Start()
    {
        Stamina = 100;
    }

    void Update()
    {
        Debug.Log(Stamina);
        if (Input.GetKey(KeyCode.M))
        {
            Stamina -= 5;
            StaminaGUIBar.size = Stamina /100f;
            Refuel();
        }
    }

    public void Refuel()
    {
        while (Stamina < 100)
        {
            Stamina += 5f;
            StaminaGUIBar.size = Stamina * 100f;

            if (Stamina >= 100)
            {
                break;
            }
        }
    }
}

Any Ideas

sentences:
How can I define items in my RPG like Java game? I am casually working on an RPG type game in Java but I am having trouble figuring out how I can have items that can do many different things without creating a different class for every item.

As an example, how would I create an Axe that could chop trees and attack monsters?

If I extend either the chopping or the weapon class then I can't extend the other class.

If I have chopping and weapon be an interface then I will have a lot of duplicated code when a dagger can also attack monsters and a different axe can cut trees.

I am hoping there is a way to have a single Item class and load the items and their respective abilities from a file. If that is possible how can it be done? If it isn't then what is the best way to have items in a game?

sentences:
Trouble GamePad input on iOS but works perfect on Android I am having trouble getting input from on iOS devices (iPhone 6 Plus and iPad). Here is my code,

    if (Input.GetKey (KeyCode.JoystickButton14))// A
    {
        chr_show = "A";
    }
    if (Input.GetKey (KeyCode.JoystickButton13))// B
    {
        chr_show = "B";
    }
         ...........................................

    if (Input.GetKey (KeyCode.JoystickButton11))// Select
    {
        chr_show = "SELECT";
    }

And in OnGUI()

    GUI.Label (new Rect(0,0,100,100), "Pressed Button : "+chr_show, guiStyle);

Code works perfect on Android device. I also have tried following:

        if (Input.GetButton ("JSButton"))// JSButton
        {
            chr_show = "JS Button 14";
        }

Please Help Me!

sentences:
How can I achieve a constant drop rate with a variable frame rate? In my game, I have particles that should spawn at random intervals but with an average rate of x per second.

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

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

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

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

sentences:
Libgdx change the image inside table dynamically I am trying to draw a HUD that shows the score and time and image like loading but I want to update and change the image when the score get higher but I tried to do that but it is not working. I thought maybe I can define new table in the update method and put different image each time but I don't want to define new table each time. is there anyway to update the image only inside the table: this is the code:

public class Hud implements Disposable{

        public Stage stage;
        private Viewport viewport;
        private static Integer worldTimer;
        private float timecount;
        private static Integer score;
        Label countdownLabel;
        private static Label scorelabel;
        private Label timelabel;
        private Label levellabel;
        private Label worldlabel;
        private Label mariolabel;
        private Image loading;
        private Table table;
        public Hud(SpriteBatch sb)
        {
            worldTimer=40;
            timecount=0;
            score=0;
            viewport=new FitViewport(Fruits.V_WIDTH,Fruits.V_HIEGT,new OrthographicCamera());//2
            stage=new Stage(viewport,sb);//stage is as box and try to put widget and organize things inside that table
            table = new Table();
            table.top();//table at top of our stage
            table.setFillParent(true);//table is now fill all the stage
            countdownLabel=new Label(String.format("%02d",worldTimer),new Label.LabelStyle(new BitmapFont(), Color.BLACK));//label for gdx
            scorelabel=new Label(String.format("%02d",score),new Label.LabelStyle(new BitmapFont(), Color.BLACK));//label for gdx
            timelabel=new Label("TIME",new Label.LabelStyle(new BitmapFont(), Color.BLACK));//label for gdx
            levellabel=new Label("1-1",new Label.LabelStyle(new BitmapFont(), Color.BLACK));//label for gdx
            worldlabel=new Label("WORLD",new Label.LabelStyle(new BitmapFont(), Color.BLACK));//label for gdx
            mariolabel=new Label("Score"    ,new Label.LabelStyle(new BitmapFont(), Color.BLACK));//label for gdx
            loading = new Image(new Texture("10%.png"));
            //loading.setSize(40, 10);
            table.add(mariolabel).expandX().padTop(10);

            table.add(timelabel).expandX().padTop(10);
            table.add(worldlabel).expandX().padTop(10);
            table.row();
            table.add(scorelabel).expandX();

            table.add(countdownLabel).expandX();
            table.add(loading).width(50).height(10);

            stage.addActor(table);

        }
        public void update(float dt)
        {
            timecount+=dt;
            if (timecount>1)
            {
                worldTimer--;
                if(worldTimer>=0) {
                    countdownLabel.setText(String.format("%02d", worldTimer));
                    loading=new Image(new Texture("90.png"));
                }
                timecount=0;

            }
        }
        public static int getTime()
        {

            return worldTimer;
        }

        public static void addScore(int value)
        {
            score +=value;
            scorelabel.setText(String.format("%02d",score));
        }
        public static int getScore()
        {
            return score;
        }
        @Override
        public void dispose() {
            stage.dispose();
        }
    }

sentences:
Developing games in Go? Google's new Go language is still in its infancy, and it has yet to find widespread real-world use or support.  Even so, it seems like a promising experiment, and I wonder if it could have a future in game development.  I haven't been able to find much game-specific discussion of Go elsewhere, and figured a CW discussion may be appropriate.

Some thoughts:

According to golang.org, Go programs "run nearly as quickly as comparable C or C++ code"--quick enough?
Is Go's garbage collection well suited for games?
How much mental re-tooling is necessary to create games in the land of concurrent goroutines?
Go is frequently called a "systems"-level language, with server software given as an example.  It's hard not to think of multiplayer game servers when hearing this.

Your thoughts?

sentences: Rotate a single member of a group I have a Group object comprised of 2 actor members. Each member in the group can have their height, width, and positions scaled and set independently with no issues. However, attempting to utilize setRotation() or rotateBy() on an individual member of the group does not cause the member to rotate. The entire group can be rotated at once, but not an individual member in the group. Is there a way to rotate a single actor member that is part of a group?

sentences:
render text inside countries I have a map of the world and I want to place text on top of each country. The text can be anywhere from 0 to 1000 symbols long, and can often be changed.

I'm looking for an algorithm to layout text on top of each country "nicely":

Text ideally should not go outside of the country borders
Placed somewhere near poloygon's centroid
Should be visible when possible

I can change font size, and I can split it into multiple lines.

Currently I'm using naive centroid approach, but it requires lots of manual tweaking, and with changing text it can result in suboptimal placement:

Interactive version of the USA map is available here: http://what-people-google.anvaka.com/ (so that you can see labels placement drawbacks and better understand my use case).

One solution I had in mind was to approximate each country by largest posible axis aligned rectangle that can be embedded inside country shape. But maybe there is a better way to do it?

sentences:
How do game makers (without coding) work? How do game makers/engines like Buildbox, GameSalad, Construct, GameMaker, etc work? What technologies (programming languages, APIs, etc) are used to build the and how does the program convert the user's interactions into exportable code?

I realize this is a very broad question. What I'm looking for is how the software creates code/source files from the user interactions with the software. While details would be awesome, a high level overview would be great too.

I'm a second year CS major and have some experience with Java/C/C++ as well as some web languages and framework. It's hard to find information on how a game creation software works because there's more content on how to make games in general.

If there is a more appropriate forum/site to ask this, please point me in that direction!

sentences:
How can I let players "scrape away" one texture to reveal another? In this game I'm making, I want my players to be able to remove rust from an object based on collisions from another object such as a wire brush.  Since it's a VR game, performance is key.

I've been having a hard time getting on the right track; I think I'm not asking the right questions.  The closest I've gotten was a video about making a scratch-off lotto ticket.  Someone in the comments to that video says:

  Good Idea. But, this isn't practical for any real world apps. It instantiates too many gameobjects. There are better more efficient ways of achieving this effect using shaders or render texture.

They don't really expand on that further, but I did do a little more searching to see how I might do this using shaders.  I found this video about using replacement shaders, but I'm still not sure if that's the right track.  I don't know If something like that is the smartest way to do it.

I'm basically a complete noob when it comes to shaders and textures so this is new territory for me.  I apologize if this is a duplicate question, I've tried searching but haven't found anything quite like what I'm looking for.  Please let me know if there's anything I can explain further, and any help that gets me pointed in the right direction would be greatly appreciated.

sentences:
How to move monsters in a C++ game? I'm creating a dungeon crawler in C++ and I'm almost done but I need to make the monster move and I'm at the end of my wits.

This is my map:

Char Map[10][10];

and this is how I initialize the positions of the monsters:

void fieldinfo::RandomizeMonsterPositions()
{
    amountEnemies=10;
    srand(time(0));

    for(i=0; i<amountEnemies; i++){
        map[rand()%9][rand()%9] = enemy;
    }
}

fieldinfo is the name of my class.

Each time the player moves, the map is redrawn with the updated players position and I need the monster to move every time the player does (randomly or not I don't care).

sentences: Create a variety a sprites from a single image in XNA? I want to be able to take a single image and cut them up into a lot of images to make the sprites. How would I do that in XNA since I only know how to load the texture then use it without changing it?

sentences:
Is it feasible to use a DHT to span an MMO over many servers for improving reliability? At the moment I have an idea for how to handle distributing MMO servers. At the core is a bunch of worker nodes that all share the same set of distributed hash tables. Each DHT stores a specific game component. Each frame a coordinator server (which there can also be many of) pushes work out to all of the connected worker nodes and wait for them to complete all of the assigned tasks.

The system is also divided up into four parts: the client, which obviously the player uses. The proxy server that sits behind load balancers and users connect to. All they do is process incoming user packets, verify them and passes the request to the work cluster. The work cluster receives packets from proxies and append them to a process queue and wait for the frame event from the controller node to process them.

I just want to know if adding a DHT to the worker nodes like this would be feasible? This should allow redundency and high availability out of the box as DHT's are quite good at that.

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:
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:
Is Orthogonal in LWJGL 2D or 3D? I'm attempting to develop an orthogonal game with lwjgl 3 and OpenGL in Eclipse, but I can't find an answer for rendering objects in 2D or 3D. Are both applicable? And if so what are the advantages of either one?
I would also like to rotate my camera if that changes your answer.

sentences:
GUI Text counter Skips numbers after a few seconds The counter counts perfectly up until the first bump. After this it starts to add about 4-5 "points" instead of just 1.

using UnityEngine;
using System.Collections;

public class GameController : MonoBehaviour
{

    public GUIText scoreText;
    public int score;

// CONVERT FLOAT TO INT?

    void Start (){
    score = 0;
    StartCoroutine (FeetScoreCounter());
    }

    // STARTS COUNTING AFTER WAITFORSECONDS
    IEnumerator FeetScoreCounter() {
    yield return new WaitForSeconds (1);
    InvokeRepeating("scoreCounter", 2, 1);
}

// FOR EACH 5 SECONDS; score++ ???

    void Update () {
    scoreText.text = score + " ft";
 //     StartCoroutine (FeetScoreCounter());

}

void scoreCounter () {
    score += 1;
    StartCoroutine (FeetScoreCounter());
    score ++;
}

}

I want my counter to start counting when the game starts, to show how far up the balloon is. I am incapable of seeing why my code just randomly adds a whole lot more over time. Care to help?

sentences:
LibGDX: How to make an object falls with random speed I'm trying to make an object (ball) fall into position Y and when the ball collides with the base. The sprite changes and along with the change I want the speed of the fall to change according to the sprite

public void create () {
    circleBall = new Circle();
    rectangleBase = new Rectangle();
    ball = new Texture("ball.png");
}

public void render () {
    spriteBatch.begin();
    fallBall();
    rand();
    spriteBatch.end();
}

void fallBall(){
    fallSpeed++;
    if(posYBall > 0){
        posYBall -= fallSpeed * 2 / 2;
    }
}

void rand(){
    int rand1 = random.nextInt(15 - 1) + 1;
    int rand2 = random.nextInt(10 - 1) + 1;
    int rand3 = random.nextInt((55 - 35) + 1) + 35;
    collisionBallBase(rand1, rand2, rand3);
}

void collisionBallBase(int rand1, int rand2, int rand3){
    if(Intersector.overlaps(circleBall, rectangleBase)){
        if(rand1 <= 5){
            ball = new Texture("ball.png");
        }else if(rand1 <= 10){
            ball = new Texture("ballb.png");
        }else{
            ball = new Texture("ballc.png");
        }

        if(rand2 >= 5){
            ballDirection = 4;
        }else{
            ballDirection = -4;
        }
        fallSpeed = -rand3;
    }
}

sentences:
What resources are available for Mac OS game development? Are there are any modern resources on how to develop games for Mac OS?  I suppose this would include objective c, cocoa and opengl 3+.

The book Beginning Mac OS X Game Development with Cocoa looks very promising but isn't out until early next year.

sentences:
Why PHP over C# for PBBG? I am a C# developer and wanted to start a hobby project building a persistent browser based game (PBBG). I work with C#, MSSQL and Angular and thought I would use those techniques for my hobby project as well.

When I started to search for do and donts and tips I realized that a lot of projects use PHP and I have actually not found any PBBG using C#, which I find really strange. It seems as the stack I'm working with (C#, MSSQL, Angular) could suit a PBBG.

The only reason I can think of C# not being used is the hefty price of Visual Studio and the fact that it wasn't open source.

Is there any other reason, or am I just bad at finding projects which use C#? Or can it be that I'm just bad at my work and don't realise that this stack is not good for PBBG?

sentences:
Why isn't this physics code scaling velocities separately? I'm working my way through this book and I'm trying to work this code out:

var squaredVelocity = this.velocity.x*this.velocity.x
                    + this.velocity.z*this.velocity.z;

if (squaredVelocity > Player.SPEED*Player.SPEED) {
   var scalar = Player.SPEED / Math.sqrt(squaredVelocity);
   this.velocity.x *= scalar;
   this.velocity.z *= scalar;
}

The book doesn't explain it. I've been staring at it for an hour. I can see exactly what it does (in the technical sense), but what's its purpose?

I understand bits: The scalar variable is always a fraction, so multiplying the velocity by it scales back that velocity.

Is this code for limiting speed? Then why are the x and y velocities added together? Shouldn't the X and Y be scaled independently?

Do I need to know this stuff for a career in video games? I understand that all this math is educational, but will I still have to do this sort of thing in an engine like Physijs?

sentences:
How can I place images on the terrain in SC2 maps? I have seen this video where there are logos of the clans rendered on the ground in StarCraft 2.

How can I add images of my own in a custom map?

sentences:
How to design parameters for events I'm working on the event system for my engine, and have some trouble deciding what types of parameters my events should have to be both generic and specific at the same time. I want to be able to notify entities in the world about anything that is happening using something similar to the observer pattern, but merely the notification message itself is not enough, some messages need to carry additional information such as location, radius, damage, and so on. How do I encapsulate all these different kinds of parameters in one event type without making it very bloated like it would be if every event held a field for every type of parameter?

Some examples to show what I would like to achieve and what I have considered so far:

struct Event {
    TYPE     type;
    int      x, y, z;
    unsigned radius;
    float    damage;
    unsigned cost;
    float    healing;
    ...
void Observer::notify(Event event) {
    if (event.type == explosion)
        handle_explotion(event.x, event.y, event.z, event.damage);
    else if (event.type == healing)
        add_hitpoints(event.healing);
    ...

That would make the Event type very bloated, and the handling gets tedious quickly. I considered having fewer parameters, but they would remain unspecified:

struct Event {
    int arg1, arg2, arg3, arg4;
    const char * str1, str2, str3;
    bool b1, b2, b3;
    ...

This would cut down on the amount of parameters because all types are condensed into the same few fields. However from a user point of view this approach is much worse because now I have to remember what each parameter was supposed to represent every time; was arg3 the radius or the damage in an explosion? To fix this maybe the parameters could live in a std::map, but that still makes handling obnoxious:

struct Event {
    std::map<const std::string, int> int_data;
    std::map<const std::string, float> float_data;
    ...
void Observer::notify(Event event) {
    if (event.type == collision)
        resolve_collision(event.int_data["x"], event.int_data["y"],
                          event.int_data["z"], event.int_data["width"],
                          event.int_data["height"]
    ...

I considered making the event hold some kind of general data field that can be cast to the appropriate type:

struct Event {
    void * data;
    TYPE type
};
void Observer::notify(Event event) {
    if (event.type == weapon_augment)
        modify_weapon((Weapon *)(event.data));

This makes instantiating and deleting the event somewhat more tedious, but at least it allows me to use specific types for every event handler.

What is the conventional approach to solving this problem? Even better, what is your own ingenious solution? Thanks.

sentences:
Geometry shader and triangle adjacency I'm currently trying to change my project to use GL_TRIANGLE_ADJACENCY instead of GL_TRIANGLES.

Following this question, I have managed to construct my index buffer fine, but when it comes to the drawing stage, I'm getting unexpected results.

Here is my geometry shader code.
Bare in mind that I store my indices like so:

(vertex1/adjacent1/vertex2/adjacent2/vertex3/adjacent3)

Geometry Shader

    #version 330

    precision highp float;

    layout (triangles_adjacency) in;
    layout (triangle_strip, max_vertices = 3) out;

    smooth in vec2 vVaryingTexCoords[];
    smooth in vec3 vVaryingNormals[];

    smooth out vec2 gsUV;
    smooth out vec3 gsNormals;

    void main(void)
    {
        int i;

        for(i = 0; i < gl_in.length(); i++)
        {
            switch(i)
            {
                case 0:
                case 2:
                case 4:
                    gl_Position = gl_in[i].gl_Position;
                    gsUV = vVaryingTexCoords[i];
                    gsNormals = vVaryingNormals[i];
                    EmitVertex();
                    break;

                default:
                    break;
            }
    }
    EndPrimitive();
}

Any ideas?

EDIT

Just like to point out that setting the adjacent index to be the same as the vertex index, i.e v1/v1/v2/v2/v3/v3 still produces the same results.

sentences:
What variables change the number of lightmaps I need to know what changes the lightmap size.

For example what changes the lightmap from being 2*1024*1024 to 4*1024*1024 - having larger textures or having larger quads (having more models) or having more lights or does it depends on something else?

sentences:
Calculating distance for Gauss Map optimized SAT There's an optimization method for the separating axis test in 3D that uses Gauss Maps to discard certain redundant axes from the set of axes that need to be tested generated by edge-edge cross products.

A detailed presentation can be found here.
Along with some source code.

The presentation also states that using the Gauss Map method lets you compute the distance between the two polyhedra along the separating axis orthogonal to corresponding edges (i.e. ones that the Gauss Map method doesn't discard) in O(1).

This is done by considering the plane formed by the cross product of the two corresponding edges fixed on one edge, and finding the minimum distance from a vertex to the plane on the corresponding edge.

My question is:

Why isn't the distance found this way in the general case when testing the axis formed from the cross product of two edges (i.e. when not using the Gauss Map optimization)?

Generally the method I see used is projection intervals, or fixing the plane for the separating axis to its corresponding edge or face on one polyhedron, and ensuring all vertices of the other polyhedron fall outside.

sentences:
how to pick up multiple coins with Phaser? I have a function that drops coins but I can only pick them up one by one when I click on them. Is it possible to make it so that I can pick up anything that overlaps?

dropCoins: function() {
var coinsNumber = 3;
for (var i = 0; i < coinsNumber; i++) {
  var coin = this.coins.getFirstDead();
  coin.body.collideWorldBounds = true;
  coin.anchor.setTo(0.5, 1);
  coin.reset(this.enemy.x, this.enemy.y - this.enemy.height / 2);
  game.physics.arcade.enable(coin);
  coin.body.bounce.set(0.3);
  coin.body.drag.set(80);
  coin.body.gravity.y = 1500;
  coin.body.velocity.y = -500;
  coin.body.velocity.x = Math.random() * 150 * util.plusOrMinus();
  coin.gold = Math.ceil( game.global.enemyHPTotal * (0.02 + (0.00045 * Math.min(game.global.level, 150))) );
  game.time.events.add(3000, this.removeCoin, this, coin);
}
this.coins.setAll('inputEnabled', true);
this.coins.callAll('events.onInputDown.add', 'events.onInputDown', this.removeCoin);

},

any help is appreciated. thanks

sentences:
In Game Maker Studio, why does the image rotation have to be performed every step? I'm a software developer who's trying to get into game development casually on the side. I picked up Game Maker Studio a while ago on a Steam Sale, and I'm finally getting into using it, especially after hearing that games like Undertale and Hotline Miami were products of said studio. I'm going through Shaun Spalding's Game Maker tutorials to familiarize myself with some of Game Maker's features and GML's coding syntax.

Following this tutorial, I rolled my eyes a little when he said to put the image_angle = direction; in the step event for my object rather than the creation event to rotate my object's sprite. "Why would you want to set a variable to the same value every frame when you could just set it once upon creation?" I thought to myself in my apparent naivety. But lo and behold, when running my project, the images aren't rotated if the image_angle = direction; is in the create event, and not the step event. Why? If image_angle is a member of my bullet object, shouldn't I be able to set it once upon creation? Or does it somehow reset on every frame?

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:
Farseer and 2D Action sidescroller game I'm thinking about using Farseer inside my game (I'm not good in physics), which isn't a bad idea. However something happened while I was thinking about that, I found this tutorial:

http://www.sgtconker.com/2010/09/article-xna-farseer-platform-physics-tutorial/

which talks about how to use Farseer, expecially the first part shows how to create a good collision method with a static object (like ground!!!), which, partially answer to my old question:

2D Side Scrolling game and "walk over ground" collision detection

So, is a good idea to use a physics engine to create a "walkable" terrain in a game? (obviusly I will use it for jumps and other things too)
Is it a bit exaggerated, I mean, does it creates performance issues if I use it for something like ground collision which happens all time (except when jumping) in a game?

If it's ok I've solved 2 questions with 1!

Thanks for suggestions.

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:
Rotation of objects from different axes in Flash AS3 In my game, I have made 4 lines with different colors to form a square but the colored lines are different objects. I want to rotate the lines in a way that the lines will still form a square. Eg:

But I'm only able to rotate them on the central axis, so, it forms a cross:

The code for leftPressed is:

if(leftPressed)
{
black.rotation -= 90;
blue.rotation -= 90;
yellow.rotation -= 90;
red.rotation -= 90;
}

So, I need to know how to rotate objects on different axes.

sentences:
DirectX9 texture flashing or disappearing I am learning DirectX 9 and I have these test models in my scene and this weird texture flashing happens.

If you look at the bottom of the picture you will see a blue area, that is supposed to be filled with the ground texture I have. So every time I move my camera the ground texture flashes very quickly and parts of it disappear lots of times a second. I know it's not a problem with my video card. What could cause this?

sentences:
Legality of remaking a game from a defunct company Ive been a head from a now defunct company under someone else. And I directed coded and produced a game that reached around 99% completion but was never completed. I was wondering if its legal to remake the game or clone it with a different theme. I dont have a contract with the employer but I already prototyped the game before we developed it under the now defunct studio.

Any ideas on how legal is cloning or remaking it?

Also am I able to show of prototype games or footages from the defunct company?

sentences:
Where can I find code examples of different variations of Perlin noise? I have seen the PCG wiki, and it is a great resource. But a lot of the articles are very brief and it is hard to find good links on specific things.

I have been searching for ways to transform my Perlin noise height maps to make ridges, rivers, and other terrain features. I also can't find any articles on how to divide up the map into different areas for calculating texture coordinates or other values specific to the game. I have only been able to find websites detailing their software that can generate the different things, but no code or explanations. Are there any good sources of code examples/explanations on how to do the above mentioned with Perlin noise?

PS. This should probably be a community wiki. I don't know how to make it as one though.

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:
How to transfer drag control from one sprite to another? (Phaser) I have some sprites that are set to horizontal drag only.

What I want to do is, if someone drags vertically up from one of those sprites, when they leave the bounds of that sprite (top edge), spawn a new sprite and be actively dragging that new sprite.  The user should not have to release the mouse button, they should just instantly be dragging the new sprite.

I can successfully calculate when the pointer is leaving the first sprite, and spawn a new sprite at that location, but I can't seem to transfer the drag control.

I tried Pointer.swapTarget, but that doesn't seem to work - the new sprite is spawned, but just sits there and I have to release the mouse button and re-click on the new sprite in order to drag it.

How can I make the transfer seamless?

sentences:
OpenGL es glDrawTexfOES() 2D texture is totaly black no color First of all I know this is a duplicated question and I check out another questions but didn't helped! I'm trying to convert my android game from canvas system to the GL10. After lots of googling I decided to do that for performans. Anyway I tryed to build a class that loads and draws textures. The problem is textures showing up whole black over my blue screen.
I'm not sure If I can draw texture without creating any mesh or something like that but this is what I'm trying to do. I'm only trying to draw 2D texture on their own sizes so I think no mesh needed. Here are my codes:

  onSurfaceCreated

    @Override
    public void onSurfaceCreated(GL10 gl, EGLConfig config) {
        gl.glClearColor(0.0f, 0.0f, 1.0f, 0.2f);
        gl.glClearDepthf(1.0f);
        gl.glViewport(0, 0, 800,  480);

        gl.glShadeModel(GL10.GL_SMOOTH);
        gl.glEnable(GL10.GL_DEPTH_TEST);
        gl.glEnable(GL10.GL_TEXTURE_2D);
        gl.glDepthFunc(GL10.GL_LEQUAL);
        gl.glMatrixMode(GL10.GL_PROJECTION);
        gl.glHint(GL10.GL_PERSPECTIVE_CORRECTION_HINT, GL10.GL_NICEST);
        //gl.glHint(GL10.GL_PERSPECTIVE_CORRECTION_HINT, GL10.GL_FASTEST);
        gl.glLoadIdentity();
        // This is the class where I load and draw my textures.
        textureStorage = new TextureStorage(gl);
        //I'm loading a texture.      **CODE A TEXTURE LOADER**
        bgNightID  = textureStorage.Load(BitmapFactory.decodeResource(context.getResources(),R.drawable.bg_game));
        //This is where I load my units variables. Nothing to do with it.
        RenderingFunctions.InitUnits(this);
    }

  onDrawFrame

@Override
public void onDrawFrame(GL10 gl) {
    gl.glClear(GL10.GL_COLOR_BUFFER_BIT | GL10.GL_DEPTH_BUFFER_BIT);
    gl.glLoadIdentity();
    //gl.glTranslatef(0, 0, -4);
        **CODE B DRAWING**
        // bgNightID is the ID of texture was loaded.
        textureStorage.DrawTexture(bgNightID, 50,50,0,(short)4000,(short)638);
        // Drawing background right here which is shows up black.
}

  CODE A  TEXTURE LOADER

public int glLoad( Bitmap bitmap ){
    if ( gl == null ){
        Log.e(TAG, "Failed to load resource.  Context/GL is NULL");return -1;
    }
    int textureName = -1;
    gl.glGenTextures(1, TexIDStorage, 0);
    textureName = TexIDStorage[0];

    Log.d(TAG, "Generated texture: " + textureName);
    gl.glBindTexture(GL10.GL_TEXTURE_2D, textureName);

    gl.glTexParameterf(GL10.GL_TEXTURE_2D, GL10.GL_TEXTURE_MIN_FILTER, GL10.GL_LINEAR);
    gl.glTexParameterf(GL10.GL_TEXTURE_2D, GL10.GL_TEXTURE_MAG_FILTER, GL10.GL_LINEAR);
    //gl.glTexParameterf(GL10.GL_TEXTURE_2D, GL10.GL_TEXTURE_MIN_FILTER, GL10.GL_NEAREST);
    gl.glTexParameterf(GL10.GL_TEXTURE_2D, GL10.GL_TEXTURE_WRAP_S, GL10.GL_CLAMP_TO_EDGE);
    gl.glTexParameterf(GL10.GL_TEXTURE_2D, GL10.GL_TEXTURE_WRAP_T, GL10.GL_CLAMP_TO_EDGE);
    gl.glTexEnvf(GL10.GL_TEXTURE_ENV, GL10.GL_TEXTURE_ENV_MODE, GL10.GL_REPLACE);

    GLUtils.texImage2D(GL10.GL_TEXTURE_2D, 0, bitmap, 0);

    int error = gl.glGetError();
    if (error != GL10.GL_NO_ERROR){
        Log.e(TAG, "GL Texture Load Error: " + error);
    }else
        Log.d(TAG, "Loaded texture: " + textureName);
    return textureName;
}

  CODE B DRAWING

public void DrawTexture(int TexutreID, float X, float Y, float Z, short Width, short Height){
    gl.glClear(GL10.GL_COLOR_BUFFER_BIT | GL10.GL_DEPTH_BUFFER_BIT);
    //gl.glColor4f(1.0f, 1.0f, 1.0f, 0.5f);
    gl.glBindTexture(GL10.GL_TEXTURE_2D, TexIDStorage[TexutreID]);
    ((GL11Ext) gl).glDrawTexfOES(X, Y, Z, Width, Height);
}

I'm totaly new to GL10 and can't figure out what is the problem and what is it I'm missing. So if anyone can help me that would be great. Thank you for givim time!

sentences:
Arrival Steering Behavior stop before reaching evader Im doing steering behaviors and trying to stop before reaching the evader. Instead of reaching the evader at its center, I need it to stop before. I cant seem to figure this out though. My code is below from Programming Game AI by Example by Buckland.

Vector3 Arrive(Vector3 target, deceleration decel)
{

    Vector3 totarget = evader->target - vehicle->cp;

     //calcualte the distance to the target position
    float dist = totarget.Length();

if(dist > 0.0f)
{
    //because deceleration is enumerated as an int, this value is require to provide fine tweaking of the deceleration
const float decelerationtweaker = 0.3f;

//calculate the speed require to reach the target given the desired deceleration
float speed = dist / ((float)decel * decelerationtweaker);

//make sure the velcoity does not excceed the max
speed = min(speed, 5); //maxspeed

//frome here proceed just liek seek except we dont need to nomalize the totarget vector because we have already gone to the trouble of calculating its lenght: dist
 Vector3 vecDesired = totarget * speed / dist;

 return (DesiredVelocity - vehicle->Velocity);
}

    return Vector3(0,0,0);

}

sentences:
Handling lost graphics device XNA 4.0 in winforms I'm trying to put in a new feature into my level editor. Part of the feature is to bring up a form when a user places a new tile onto the map, but once the form is brought up the XNA embedded screen throws up a big red X.  I think this is due to the embedded screen losing focus to the form and then crashing.

This is where the form is initialized

 public Form1()
   {
    InitializeComponent();

    //Node Editor

    tileDisplay1.OnInitialize += new EventHandler(tileDisplay1_OnInitialize);
    tileDisplay1.OnDraw += new EventHandler(tileDisplay1_OnDraw);

    Microsoft.Xna.Framework.Input.Keys[] allKeys = (Microsoft.Xna.Framework.Input.Keys[])
     Enum.GetValues(typeof(Microsoft.Xna.Framework.Input.Keys));

    foreach (var key in allKeys)
    KeyboardInput.AddKey(key);

     KeyboardInput.KeyRelease += new KeyHandler(KeyboardInput_KeyRelease);
     MouseInput.MouseMove += new MouseMoveHandler(MouseInput_MouseMove);
     MouseInput.MouseDown += new MouseClickHandler(MouseInput_MouseDown);
     MouseInput.MouseUp += new MouseClickHandler(MouseInput_MouseUp);

     Application.Idle += delegate { tileDisplay1.Invalidate(); };

     saveFileDialog1.Filter = "Map File|*.map";

     Mouse.WindowHandle = tileDisplay1.Handle;

   }

This is where the draw event is fired off

void tileDisplay1_OnDraw(object sender, EventArgs e)
        {
            Logic();
            Render();

            KeyboardInput.Update();
            MouseInput.Update();

            foreach (var actor in Actor.Actors)
                actor.Update();
        }

This is where the form is being called

     private void Logic()
    {
               if (colIndex == 8 && AssociateBox.SelectedIndex == 0)
                {
                    currentCollisionLayer.SetCellIndex(collideCellX, collideCellY,form.spawnNumber.ToString());

                    if(form.spawnNumber == "12")
                    {
                       camdetails.ShowDialog();
                    }
                }
    }

sentences:
How can I scale object on one side only with a speed factor? using System.Collections;
using System.Collections.Generic;
using UnityEngine;

public class ScaleOneSide : MonoBehaviour
{
    public float speed = 1;

    float mfX;
    float mfY;
    // Use this for initialization
    void Start()
    {
        mfX = transform.position.x - transform.localScale.x / 2.0f;
        mfY = transform.position.y - transform.localScale.y / 2.0f;
    }

    // Update is called once per frame
    void Update()
    {
        if (Input.GetMouseButton(0))
        {
            Vector3 v3Scale = transform.localScale;
            //transform.localScale = new Vector3(v3Scale.x + 0.1f, v3Scale.y + 0.1f, v3Scale.z);
            //transform.position = new Vector3(mfX + transform.localScale.x / 2.0f, mfY + transform.localScale.y / 2.0f, 0);

            //transform.localScale = new Vector3(v3Scale.x + 0.1f, v3Scale.y, v3Scale.z);
            transform.position = new Vector3(mfX + transform.localScale.x / 2.0f, 0, 0);

            transform.localScale = Vector3.Lerp(transform.localScale, new Vector3(v3Scale.x + 0.1f,0,0), speed * Time.deltaTime);
        }
    }
}

When using only this two lines it was working fine without changing the speed:

 //transform.localScale = new Vector3(v3Scale.x + 0.1f, v3Scale.y + 0.1f, v3Scale.z);
   //transform.position = new Vector3(mfX + transform.localScale.x / 2.0f, mfY + transform.localScale.y / 2.0f, 0);

But now I'm trying to add to the scaling a speed.
I want when I press the mouse left button it will scale the object according to the speed.

sentences:
TiledMap not drawing completely While attempting to constrain camera scrolling to within the TiledMap I discovered that it seems the renderer for the map is not drawing the entire map. The map is 1600x960px so one would assume the setting the camera position to 1600, 960, 0 would result in the top right corner of the map to be centered, however to actually center the map (I had to do some trial and error for this) the coordinates are closer to 1175, 740, 0.

The map is made of 25x15 tiles and each tile is 64x64px. I initialize the map and renderer like this:

    tileMap = new TmxMapLoader().load("maps/" + file);
    renderer = new OrthogonalTiledMapRenderer(tileMap, stage.getBatch());
    renderer.setView((OrthographicCamera) stage.getCamera());

Then to render I just call renderer.render().

Any idea why this could be happening and how to fix it?

sentences: How can I scale/zoom to a point in canvas in the game? I am using html5 canvas to build a MMO game. When I scale my background by default it scales to (0, 0) which is the top left corner of the background. If I have other sprites on the screen they all will look like they are shifting to the bottom right a little bit. Suppose my sprite(player) is at (x,y) of the map and it is placed center on the canvas.How can I make the background scale or zoom to (x,y) instead of (0,0)? Its world position is (x,y) but its screen position is always (canvas.width / 2, canvas.height / 2). I think in this way the sprites around my player wouldn't shift their position to unexpected places. But I don't know how to do this.

sentences:
Lua as a stand-alone for game programming like Python? I've used Python before with PyGame to make games, but PyGame doesn't seem to be so popular anymore, and there arent that many good resources for it. I hear lots of buzz about Lua as a fast scripting language to be used inside of projects made in other languages.

I work much faster and enjoy the higher-level programming that is Python, so that naturally leads me to Lua, which seems to be getting a lot of attention recently. I know it's been around for a while but I think WoW add-on creation made it more popular..

Can Lua make games on its own as a stand-alone language with any 2D or 3D libraries, or is that not really the Lua domain?

I won't bother asking about 3D in Python here, I'll make a new question for that. Thanks!

sentences:
How can I flip a coin? I am working in unity and have flattened out a cylinder object to make a coin for a 3d coin flipping game, but I am not sure how to get the coin to flip when the player swipes across it and allow for a double flip if the player swipes over it a second time while in mid air.

here is what I have tried:

using System.Collections;
using System.Collections.Generic;
using UnityEngine;
public class CoinFlip : MonoBehaviour {

    private Vector3 start;

    private void Start() {
        start = gameObject.transform.position;
    }

    void Update() {
        transform.position += transform.right * Mathf.Sin(Time.time * 0.45f) * -0.025f;
    }

    void OnEnable() {
        gameObject.transform.position = start;
    }
}

sentences:
Make enemy disappear after spawn I have enemies that spawn in different positions but what I want to do is that if you don't kill it after three seconds, the enemy disappears (but the spawning keeps happening of course, the enemy will show up again eventually). I tried using a coroutine but after reading the documentation and watching some tutorials I still don't understand very well how it works so I need some help. Thanks in advance.
This is my code so far:

public class TimedSpawn : MonoBehaviour {

    public GameObject spawnee;
    public bool stopSpawning;
    public float spawnTime;
    public float spawnDelay;

    private GameManagerScript GMS;

    void Start ()
    {
        GMS = GameObject.Find ("GameManager").GetComponent<GameManagerScript> ();
        InvokeRepeating ("SpawnObject", spawnTime, spawnDelay);
    }

    public void SpawnObject ()
    {
        if  (GMS.counterDownDone == true){

        Instantiate (spawnee, transform.position, transform.rotation);
     }

        if (stopSpawning) {
            CancelInvoke ("SpawnObject");
        }
    }
 }

sentences:
Is there a centralized database of game names and IDs? Given two games with very similar names:

Alien Shooter II - Vengeance

Alien Shooter: Vengeance

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

sentences:
How to access random material in a renderer besides first without cloning any materials except accessed one? Clones only first material:

renderer.material

Clones all materials in the same renderer:

renderer.materials[0]

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:
How can I save my game state so it can be resumed when my application resumes? I've found that after resuming my game the whole engine is reloaded and application is reinitialized. I want to save engine state and in "onResume," resume the game process from where it left off.

I've tried to save the engine (mEngine) and then after resume the game in "onLoadEngine" return saved engine. I think it is a bad solution and it doesn't work anyway.

What is the best solution for resuming my game (after the power key was pressed, for example) in AndEngine ?

sentences:
Emit particles from only some parts of a mesh I have a 3D mesh with 3 sub meshes in it, for 3 different materials.

I would like particles to spawn from the mesh, but only from location where one of the material is assigned.

How can I make this happen?

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

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

(Note Dx11 on 2nd line of debug info)

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

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

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

And for completeness, the water volume properties...

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

sentences:
draw two models changing the MVP matrix (android opengl) I'm newbie with opengl2 in android, and I'm making an app in which I'm testing some things. Now I was trying to duplicate a sphere object with a texture, so I thought it was enough to change my MVP matrix applying a small translation to the Model matrix, using same View Matrix and same projection matrix.

int[] numIndices = balon.getNumIndices();
ShortBuffer[] indices = balon.getIndices();

GLES20.glUniformMatrix4fv(mMVPMatrixHandle, 1, false, mMVPMatrix, 0);
for (int j = 0; j < numIndices.length; j++) {
    GLES20.glDrawElements(GLES20.GL_TRIANGLES,
            numIndices[j], GLES20.GL_UNSIGNED_SHORT,
            indices[j]);
}

GLES20.glUniformMatrix4fv(mMVPMatrixHandle, 1, false, mMVPMatrix2, 0);
for (int j = 0; j < numIndices.length; j++) {
    GLES20.glDrawElements(GLES20.GL_TRIANGLES,
            numIndices[j], GLES20.GL_UNSIGNED_SHORT,
            indices[j]);
}

balon is an object of type Sphere. mMVPMatrix and mMVPMatrix2 are the MVP matrices I was talking about. I simply changed the MVP matrix and did the drawing again. The result is that I have the two spheres, but one of them is behaving strangely, appears distorted, the position in which appears is right, the two spheres move along, but one of them changes it's shape.

What I'm missing?, I guess I have to duplicate some things in my code before I do this, but what?, thought that being the same model, this was enough...

This is how I changed the MVP matrix:

Matrix.setIdentityM(mModelMatrix, 0);
Matrix.setIdentityM(mModelMatrix2, 0);
Matrix.translateM(mModelMatrix, 0, posX, posY, posZ);
Matrix.translateM(mModelMatrix2, 0, posX+0.5f, posY+0.5f, posZ);

Matrix.multiplyMM(mMVPMatrix, 0, mViewMatrix, 0, mModelMatrix, 0);
Matrix.multiplyMM(mMVPMatrix2, 0, mViewMatrix, 0, mModelMatrix2, 0);
Matrix.multiplyMM(mMVPMatrix, 0, mProjectionMatrix, 0, mMVPMatrix, 0);
Matrix.multiplyMM(mMVPMatrix2, 0, mProjectionMatrix, 0, mMVPMatrix2, 0);

sentences:
How to properly render a Frame Buffer to the BackBuffer in Stage3D / AGAL After doing a render pass with RenderToTarget (RTT), how do you properly render that texture buffer to the screen while maintaining original scale / proportions so it doesn't stretch or lose quality?

Can an AGAL VertexShader & FragmentShader be written so it's adaptable to any Texture size and Viewport dimensions?

I find I'm getting some "blocky" effects in some of my first attempts at "ping-ponging" between two Texture buffers (to create trailing effects). Perhaps I'm not using the UVs correctly between the rendering-to-target and/or the backbuffer?

Is there a simpler way just to "splash" the texture on the backbuffer, or is a Quad absolutely necessary (4 vertices, 2 triangles)?

If it needs the Quad, should the Texture buffer be fully drawn (0.0 to 1.0 for vertical and horizontal UVs), or only a percentage of it should, like the example below?

Texture Buffer U: 0.0 to viewport.width/texturebuffer.width;
Texture Buffer V: 0.0 to viewport.height/texturebuffer.height;

Thanks!

sentences:
Unity WebGL audio not looping when started with playdelayed() I have an audioSource in which loop is set to true.
I am starting it playing by calling playdelayed()

In the editor its plays fine. In a webgl build it does not loop. It just plays once.

Also in firefox it does not start playing at the correct time, it is a  good fraction of a second off.

public override void MatchStarted()
{
    Intro.Play();
    Loop.PlayDelayed(Intro.clip.length);
}

PlayScheduled has exactly the same effect.

public override void MatchStarted()
{
    Intro.Play();
    Loop.PlayScheduled(AudioSettings.dspTime + Intro.clip.length);
}

Play(ulong) has the same effect

public override void MatchStarted()
{
    Intro.Play();
    Loop.Play((ulong)(44100 * Intro.clip.length));
}

I'm posting this here seeking workarounds. Any suggestions?
As you can see from my code, my use case is a piece of music with an intro and a loop.

...

ps.
I have seen some posts saying that if the bitrate is not 44.1 KHz this can cause looping issues on WebGl. The audio file in question is set to override the bitrate to 44.1 in its import settings.

sentences:
Unity2D Multiplayer - Spawning player at user's end I am currently into a 2d mobile multiplayer project. Its going to be a 2 player game for now. So the host and the client are the only players.

I am using Unity 5.4 and the default multiplayer platform by the way. I am able to spawn the character both on client and server. The syncing also works pretty well.

But for the game to be user friendly, obviously I have to spawn the player on his end of the screen and the opponent on the other end. I am unable to achieve this on the client screen. In the client screen, the client starts from the upper end of the screen making it difficult to play with.

So, my question. How would I go about spawning a player in his device on his end of the screen and the opponent on the other side? The only idea I came up with was switching the spawn points in the client version of the game. Is it possible accessing client's version of the game during runtime? And would it be the right way to go about it? If not please share an alternate solution.

Thanks

sentences:
Permanently Sync a wiimote with a computer i have tried to look up many ways to sync up my wiimotes to my computer so that i can program games with it, but every time it only syncs them up temporarily, or if it says it can permanently sync it, it doesn't actually do it. it gets tiresome when i have to keep on reconnecting it every time i want to save battery life. how would i be able to sync up my wiimote to my computer so that if i turn off my wiimote, i can just hit any button and it will automatically sync it up?

Edit: I have looked here: http://wiibrew.org/wiki/Wiimote under Bluetooth pairing for some advice, but I have no idea how to export the char array to the window (i am using the standard pairing with a Bluetooth device, but instead of pairing without a code, i use the "enter device's pairing code" section. this should work, but I'm stuck at how to enter the weird characters that aren't on the keyboard).

sentences:
Sprite Animation Software That Works With Cocos2D So the title basically says it all. I'm looking for software that would help me to create sprite animations that I could use with cocos2d by allowing me to pose a a sprite and the software create key-frames between the sprites( basic tweening ).

Any ideas?

sentences:
How can I copy or back-calculate definitions for an entire b2World? I'm working on a platformer where I'd like to be able to move or copy bodies between multiple Box2D b2Worlds. The desire has cropped up three times now - moving objects between documents in my editor, moving the player between levels in normal game play, and giving the player a preview of a non-trivial projectile they can shoot in the game, which seems to be most accurately done by simulating the world for a few seconds ahead.

It looks like I can make a parallel world the "long way" - for each body in the world, copy the body data back into a def and re-create it, then copy the fixtures on it in the same way, then do the same for joints; re-set all the velocities; and if it's a "move" rather than a "copy" delete the original one.

I was wondering if someone has already written this code (and if so, was it actually a workable design or not?), or if Box2D has some affordance for doing this within its API which I am missing.

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:
How To Display a friend list Using Play fab? I m making a multiplayer game using playfab.

One player send  a friend request Second player then not display a player name?? I want the access(display) a player name??? see the referance,

Code:

ListingPrefab.cs

   public class ListingPrefab : MonoBehaviour
   {
      public static ListingPrefab Instance;

      public Text playerNameText;
    }

FriendRequest.cs

public class FriendRequest : MonoBehaviour
{
    public GameObject listingPrefab;   //btn
    public Transform panel;           //parent

    //Display Friend
    void DisplayFriends(List<FriendInfo> friendsCache)
    {
        foreach (FriendInfo f in friendsCache)    // I think problem is here
        {
            GameObject listfriend = Instantiate(listingPrefab);
            ListingPrefab templisting = listfriend.GetComponent<ListingPrefab>();
            templisting.transform.SetParent(panel, true);

            //PlayerPrefs.GetString("PlayerName", ListingPrefab.Instance.playerNameText.text.ToString());
            //PlayerPrefs.SetString("PlayerName",  ListingPrefab.Instance.playerNameText.text.ToString());

            Debug.Log("playername:" + templisting.playerNameText + friendsearch);
            //Debug.Log("helloone"+ f.TitleDisplayName);
            templisting.playerNameText.text = f.TitleDisplayName;                               // TitleDisplayName PlayFab unique username for this friend.
        }
    }

    void DisplayPlayFabError(PlayFabError error)
    {
        Debug.LogError(error.GenerateErrorReport());
    }
    void DisplayError(string error)
    {
        Debug.LogError(error);
    }

    //Getfriend
    List<FriendInfo> _friends = null;

    public void GetFriends()  //you can call button click
    {
        PlayFabClientAPI.GetFriendsList(new GetFriendsListRequest
        {
            IncludeSteamFriends = false,
            IncludeFacebookFriends = false
        }, result => {
            _friends = result.Friends;
            DisplayFriends(_friends); // triggers your UI
        }, DisplayPlayFabError);
        Debug.Log("Inside GetFriends");
    }

    //Add friend
    enum FriendIdType { PlayFabId, Username, Email, DisplayName };

    void AddFriend(FriendIdType idType, string friendId)
    {
        var request = new AddFriendRequest();
        switch (idType)
        {
            case FriendIdType.PlayFabId:
                request.FriendPlayFabId = friendId;
                break;
            case FriendIdType.Username:
                request.FriendUsername = friendId;
                break;
            case FriendIdType.Email:
                request.FriendEmail = friendId;
                break;
            case FriendIdType.DisplayName:
                request.FriendTitleDisplayName = friendId;
                break;
        }
        // Execute request and update friends when we are done
        PlayFabClientAPI.AddFriend(request, result =>
        {
            Debug.Log("Friend added successfully!");       //Add a friend
        }, DisplayPlayFabError);
    }

    string friendsearch;
    [SerializeField]
    GameObject friendpanel;

    public void InputFriendID(string inputfriendid)
    {
        friendsearch = inputfriendid;
    }

    public void SubmitFriendRequest()
    {
        AddFriend(FriendIdType.PlayFabId, friendsearch);
    }

    public void OpenCloseFriends()
    {
        friendpanel.SetActive(!friendpanel.activeInHierarchy);
    }

}

Prerequisites
SDK: Unity

The title ID is set in the PlayFabSharedSettings object (alaready i have)
The project can successfully log in a user  (alaready i have)
The title has at least two registered users  (alaready i have)

image:

I have 15 Player.

How To access a PlayerName??

sentences:
How can multiple clients be out of sync if they use the same RNG seed? I have been working on a client-server architecture to enable LAN play for my open source game, Aigilas. In its current state, players stay synced in all running instances of the game but enemies and particle animations are out of sync.

What I cannot understand is how players are the only entities staying synced. I run the clients in lockstep, requiring the latest input states from each client to be announced before taking a turn in the game world. When the game world is built, I seed the random number generator (RNG) with a seed determined by the server. This seed appears to affect the RNG as expected; each client has the same procedurally generated game world and players start in all clients at the appropriate locations.

Particle animations and AI are chosen based on player positions and the RNG. How is it possible for them to become out of sync when the players are always in sync?  To the best of my observations of both the game screen and the logs, players never go out of sync with respect to their positions. That leads me to believe that the RNG in C# is not acting deterministically across all clients.

The basic workflow for the game's client<->server communications are as follows:

Server starts
Client starts and gets RNG seed from server
Client tells server when keys are pressed/depressed by a user
Once a game has started, server tells all clients the current state of each player's keyboards
Once an update has been received from the server, one turn of the game is simulated
Repeat step 4

If there are any specific questions targeting a specific portion of the code, then I am happy link to the appropriate page on GitHub.

sentences:
Using Standard Asset RBFP Controller for Universal Windows Platform I was using the rigidbodyfirstperson controller, and it stopped working when I changed the build settings to UWP. Any body know the reason for this or how to solve it? Thanks...

Rik

sentences:
Generating island terrains with Simplex Noise (C#/XNA) I've got one little question: Is there any code or sample which shows how the simplex noise works? I cannot find anything about it... How should I implement it, without the knowledge how the algorithm works?...

The other question is: Is the simplex noise a good algorithm for island generation? I need huge islands (really huge), with different layers (sand, gras, stone) and clearly visible height-differences, which have soft-edges, so you can go out/into water without jumping over uneven surfaces.

sentences:
How can I hide the collision layer in libGDX with TiledMap? I'm making a 2D game with libGDX, and I'm using its TileMapRenderer to render my map which I have made in the map editor Tiled. In Tiled, I have a dedicated collision layer. However, I can't figure out how I'm supposed to hide it and its tiles in the game.

This is how a map is loaded:

TiledMap map = TiledLoader.createMap(Gdx.files.internal("maps/map.tmx"));
TileAtlas atlas = new TileAtlas(map, Gdx.files.internal("maps"));
tileMapRenderer = new TileMapRenderer(map, atlas, 32, 32);

Currently the collision tiles are rendered on top of everything else, as I see them in the map editor.

sentences:
How should a circuit or power system (like redstone in Minecraft) be implemented I want to implement a power-system like the redstone system in minecraft.

I have n power sources and m cables. If I disconnect the power source or a cable the circuit should turn off.

How do I avoid circles?
If each cable with the status "on" powers the nearby cables I can create infinite circles where there is no power source involved (see image). Plus site is that it runs in T=m

I could send power burst through the graph starting at every power source and in each update call I turn every cable off. Problem is it runs in T=n*m.

Is there a best practice? In Minecraft the redstone system was very slow so I think I overlooked something.

EDIT: The system should work without a distance based decay.

sentences: How to make Frame Independent Timer Clock I want to make a frame Independent Timer that it work consistently across different computer configuration.

sentences: DOTween: How to make a spring bounce effect? I am looking how to make a bouncing effect with DOTween, like when the object is attached to a spring. How can I make an effect like this?

sentences:
How do I move a Unity object with velocity instead of force? I have a 2d car in Unity that I want to move, but Unity does this using relative force & I want to use velocity.
As we know if we add force, an object will move and never stop. I want to use velocity to control movement, because then the car will stop when its velocity is zero.
using System.Collections;
using System.Collections.Generic;
using UnityEngine;

public class GamePlay : MonoBehaviour
{
    public GameObject player;
    public Rigidbody2D rb;
    public float speed, steering;
    void Start()
    {
    }
    void FixedUpdate()
    {
        rb.AddRelativeForce(Vector2.up * speed);
        // rb.velocity = Vector2.up;
        Touch touch = Input.GetTouch(0);
        if (Input.touchCount > 0)
        {
            if (touch.phase == TouchPhase.Moved)
            {
                // Vector2 v = Camera.main.ScreenToWorldPoint(touch.position);
                float pos = touch.position.y;
                player.transform.Rotate(0, 0, pos - steering);
            }
        }
    }
}

sentences: Unity3d 2017 trail renderer behaving weird Please see the screenshot I attached, I am trying to make skid marks using trail renderer, but one side of trail is going upwards just after it renders, it was working fine Unity 5.4, but when I upgraded it to 2017, it is behaving like this.

sentences: Is there a successor to RenderMonkey? I'm starting with GLSL shader programming and have been looking into RenderMonkey. Sadly, AMD no longer supports it. Why? Is there a successor to it?

sentences:
Unity 2d_ Constant Player movement along the x axis The movement of my player depends on swipes,

swipe left-> character moves to the left

swipe right-> character moves to the right

right now i am only getting a small movement, meaning that the player moves along the X axis but it stops inmediatelly. This is the code i have to check the swipes direction:

PLayer.cs:

public Vector2 desiredPosition;

void Update()
{
    if (MobileInput.Instance.SwipeIzquierda)
    {
        desiredPosition += Vector2.left;
    }
    if (MobileInput.Instance.SwipeDerecha)
    {
        desiredPosition += Vector2.right;
    }

    transform.position. = Vector2.MoveTowards(transform.position, desiredPosition, moveSpeed * Time.deltaTime);

In the MobileInput script i control the swipes:

private const float DEADZONE = 100.0f;
public static MobileInput Instance { set; get; }
private bool swipeIzquierda, swipeDerecha, swipeAbajo, swipeArriba;
private Vector2 swipePuntoAhora, touchComienzo;

public bool SwipeIzquierda { get { return swipeIzquierda; } }
public bool SwipeDerecha { get { return swipeDerecha; } }
public bool SwipeArriba { get { return swipeArriba; } }
public bool SwipeAbajo { get { return swipeAbajo; } }

private void Awake()
{
    Instance = this;
}

// Use this for initialization
void Start () {

}

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

    Debug.Log(SwipeIzquierda);

    swipeDerecha = swipeIzquierda = false;

    #region Input Pc
    if (Input.GetMouseButtonDown(0))
    {
        touchComienzo = Input.mousePosition;
    }
    else if(Input.GetMouseButtonDown(0))
    {
        touchComienzo = swipePuntoAhora = Vector2.zero;
    }
    #endregion

    #region Mobile Input
    if (Input.touches.Length != 0)
    {
        Debug.Log("hola");
        if (Input.touches[0].phase == TouchPhase.Began)
        {
            touchComienzo = Input.mousePosition;
        }

        else if (Input.touches[0].phase == TouchPhase.Ended || Input.touches[0].phase == TouchPhase.Canceled)
        {
            touchComienzo = swipePuntoAhora = Vector2.zero;
        }
    }
    #endregion

    #region Calcular distancia

    swipePuntoAhora = Vector2.zero;
    if (touchComienzo != Vector2.zero)
    {
        //Mobile
        if (Input.touches.Length != 0)
        {
            swipePuntoAhora = Input.touches[0].position - touchComienzo;
        }
        //PC
        else if (Input.GetMouseButton(0))
        {
            swipePuntoAhora = (Vector2)Input.mousePosition - touchComienzo;
        }
    }

    #endregion

    #region Calcular DEadzone del swipe

    if (swipePuntoAhora.magnitude > DEADZONE)
    {
        float x = swipePuntoAhora.x;
        float y = swipePuntoAhora.y;

        if (Mathf.Abs(x) > Mathf.Abs(y))
        {
            //Izquierda o Derecha
            if (x < 0)
            {
                swipeIzquierda = true;
            }
            else
            {
                swipeDerecha = true;
            }
        }
        else
        {
            //Arriba o Abajo
            if (y < 0)
            {
                swipeAbajo = true;
            }
            else
            {
                swipeArriba = true;
            }

        }

        touchComienzo = swipePuntoAhora = Vector2.zero;
    }

    #endregion
}

The goal of all of this is to:

If i swipe to te right, the player starts to walk to the right AND continues doing so unless i swipe to the left, only then the player starts to move to the left. I want the movement to be constant in one direction until the other swipe changes it

Any help with this will be really appreciated

sentences:
Unity Help solving Uncaught Abort on HTML5 Build For some reason there is a Invoke that is triggered when a button is clicked that causes my game to crash. Any idea how I can sort this out?

I have plenty other Invokes and none has given problems. I have the Enable Exceptions option set to None and game works fine inside Unity.

I can give more info on the error if you can point to me to what's relevant.
Thanks so much!

Invoking error handler due to
Uncaught abort(145) at Error
    at jsStackTrace (ed63bf36d25f876fa57fb81632b59202.unityweb:8:22380)
    at stackTrace [Object.stackTrace] (ed63bf36d25f876fa57fb81632b59202.unityweb:8:22551)
    at Object.onAbort (https://v6p9d9t4.ssl.hwcdn.net/html/1680115/PowerTheGrid_Level3_v7.2_HTML5/Build/3998187b7e8feaa618a93b293c0e6812.js:4:11065)

EDIT: Here is the code generating the error:

    public void OnClick()
    {
        if (buyCoal.interactable == true)
        {
                trainObject.trainMovementStart();

                if (SceneManager.GetActiveScene().name == "Level1" || SceneManager.GetActiveScene().name == "Level2")
                    Invoke("coal_refill", 6f);

                if (SceneManager.GetActiveScene().name == "Level3")
                    Invoke("coal_refill", 12f);

                Money.UseMoney(coalcost);
                buyCoalAudio.Play();
                countdown += 1; //agora é count up
                tipCoalReady = 2;
                buyCoalButtonIndex = 0; //DISABLE COAL Buy Button
                coal_stock_countdown.text = countdown.ToString();
                coaltipCounter += 1;
        }
    }

    void coal_refill()
    {
        ThermoElectric.quota += 17.5m;
        Invoke("reactivateBuyCoalButton", 5f);
    }
    void reactivateBuyCoalButton()
    {
        buyCoalButtonIndex = 1;
    }
}

}

sentences:
Visitor-pattern vs inheritance for rendering I have a game engine that currently uses inheritance to provide a generic interface to do rendering:

class renderable
{
public:
    void render();
};

Each class calls the gl_* functions itself, this makes the code hard to optimize and hard to implement something like setting the quality of rendering:

class sphere : public renderable
{
public:
    void render()
    {
        glDrawElements(...);
    }
};

I was thinking about implementing a system where I would create a Renderer class that would render my objects:

class sphere
{
    void render( renderer* r )
    {
        r->renderme( *this );
    }
};

class renderer
{
    renderme( sphere& sphere )
    {
         // magically get render resources here
         // magically render a sphere here
    }
};

My main problem is where should I store the VBOs and where should I Create them when using this method?
Should I even use this approach or stick to the current one, perhaps something else?

PS: I already asked this question on SO but got no proper answers.

sentences:
Big level objects collision system for 2d game I read many variants today and get some knowledge in general, so here is a steps of mine thoughts in pictures (horrible paint.net ones).

We need to develop grid system, so we check only thing near, perform simple check to cut out deep check, and at - last deep check like per-pixel collision check.

Step 1 - Let p1, p2 are some sprites lets first just check with circle collision - because large distance between p1, p2 this fails and of course so we don't need test more deeply. But if we have not 2, but 20 objects, why we need to even circle test something so far outside of our view.
Step 2 - Add basic column system, now we don't bother with p2 if it's in a column far from p1 column, so we even don't do circle test. But p3 is in the same col, so let do circle test, which of course will fail.
Step 3 - Lets improve column system to the grid system with grid cell size just like p1, p2, p3 collision boxes, so we cut out things much top or below p1. And this is all great until comes BIG OBJs which is some kind of platforms. They are much bigger then grid cell.

Circle test for will be successful, but deep check for whole big obj will fail

And that the part I can't get.

How do I store the grid position of big object? Like 4 grid coords for big object vertexes? And if one of them close to p1 do circle check for centre of big object then a deep one if succeed? Am I do it wrong?

My possible solution:

sentences: Tiled tmx format into 3d Texture I am thinking of making 3d games with 2d pixels feel. So far, i have been playing around in tiled and monogames. I learned some xml and managed to import and render tmx into my game. This is maybe a dumb question. How do you convert tmx into 3d texture? What kind of software do you need?

sentences:
In GLSL is it possible to offset vertices based on height map colour? I am attempting to generate some terrain based upon a heightmap.
I have generated a 32 x 32 grid and a corresponding height map ->

In my vertex shader I am trying to offset the position of the  Y axis based upon the colour of the heightmap, white vertices being higher than black ones.

//Vertex Shader Code
#version 330

uniform mat4 modelMatrix;
uniform mat4 viewMatrix;
uniform mat4 projectionMatrix;
uniform sampler2D heightmap;

layout (location=0) in vec4 vertexPos;
layout (location=1) in vec4 vertexColour;
layout (location=3) in vec2 vertexTextureCoord;
layout (location=4) in float offset;

out vec4 fragCol;
out vec4 fragPos;
out vec2 fragTex;

void main()
{
    // Retreive the current pixel's colour
    vec4 hmColour = texture(heightmap,vertexTextureCoord);

    // Offset the y position by the value of current texel's colour value ?
    vec4 offset = vec4(vertexPos.x , vertexPos.y + hmColour.r, vertexPos.z , 1.0);

    // Final Position
    gl_Position = projectionMatrix * viewMatrix * modelMatrix * offset;

    // Data sent to Fragment Shader.
    fragCol = vertexColour;
    fragPos = vertexPos;
    fragTex = vertexTextureCoord;
}

However the code I have produced only creates a grid with none of the y vertices higher than any others.

This is the C++ code that generates the grid and texture co-orientates which I believe to be correct as the texture is mapped to the grid, hence the white blob in the middle.

The grid-lines are generated in the fragment shader, sorry for any confusion.

I have tried multiplying the r value of hmColour by 1000 unfortunately that had no effect.

The only other problem it could be is that the texture coordinate data is incorrect ?

for (int z = 0; z < MAP_Z  ; z++)
   {
    for(int x = 0; x < MAP_X  ; x++)
    {
    //Generate Vertex Buffer

    vertexData[iVertex++] = float (x) * MAP_X;
    vertexData[iVertex++] = 0;
    vertexData[iVertex++] =  -(float) (z) * MAP_Z;

    //Colour Buffer  NOT NEEDED
    colourData[iColour++] = 255.0f; // R
    colourData[iColour++] = 1.0f; // G
    colourData[iColour++] = 0.0f; // B

    //Texture Buffer

    textureData[iTexture++] = (float ) x * (1.0f / MAP_X);
    textureData[iTexture++] = (float ) z * (1.0f / MAP_Z);

     }
    }

The heightmap texture I am trying to use appears like so (without grid-lines).

This is the corresponding fragment shader

// Fragment Shader Code
#version 330

uniform sampler2D hmTexture;

layout (location=0) out vec4 fragColour;

in vec2 fragTex;

in vec4 pos;

void main(void) {

    vec2 line = fragTex * 32;
    // Without Gridlines
    fragColour = texture(hmTexture,fragTex);

    // With grid lines
    // + mix(vec4(0.0, 0.0, 1.0, 0.0), vec4(1.0, 1.0, 1.0, 1.0),
  //  smoothstep(0.05,fract(line.y), 0.99) * smoothstep(0.05,fract(line.x),0.99));

}

sentences:
How can I determine "exact moment" of collision with ray casting? I'm currently brainstorming how the physics for my game engine is going to be handled.
It's top down and I'm thinking of using ray casting for collision detection.
I've reached two potential problems (I want collisions to be pretty precise but of course not to operation heavy).

I'd like to use 2 different polygons for each object. One box to check collisions with first and then a polygon for precise checking. Is this wise to do when also checking collisions with ray casting? Or should I go for the more precise polygon right away?
Say I'm going to move an object 10 units X-wise and another object 10 units Y-wise how do I know "when" along this movement they collided so that if they collided after moving 5 units I could handle events at that point?
(One might bounce and move back the same 5 units traveled in the same execution of my update or get instantly destroyed in which case it wouldn't collide with a third object it otherwise would have collided with)

This could be a bit overkill but I still wanna know how one could go about handling this.

sentences:
Registering XNA Custom Pipeline A while back I was looking for a way to export / load Models in XNA for animations. I took the advice from a comment, and tried using the "SkinnedModelProcessor" he linked me to. It worked great at home, but at school, I can't seem to get XNA to acknowledge that I have a custom pipeline in the solution. I've added the references to both the content project and the main project, but no luck. When I compile the example, Visual Studio complains that the content processor can't be found. When using my own project, Visual Studio doesn't have the custom Pipeline Processor as an option. When using the example, "SkinnedModelProcessor" is the value in the fields, but if I click on the combobox, that option isn't there, and VS still complains. Obviously this is a problem with how Visual Studio is configured, but I have absolutely no clue what I should do about it. Any suggestions guys? I guess I could build the code for animations at home, and not worry about it at school, but that sounds like the easy way out.

[/walloftext]

Some notes that are probably worth mentioning:
* Any settings that I apply are reset when I log out.
* Any changes to the C drive are reset when the computer shuts down.
* The project is stored on a network location, which has caused problems in the past, evidently. ( Although, I personally don't know what these problems would include ).

sentences:
Is there a better way to handle a large amount of organized game data in Character Creation? I am currently working on a text based prototype, in where the player is (eventually) allowed to have over 180 character choices in a quickly played permadeath type of game. It's a lot simpler than it sounds, based on a sort-of component system where the player choices several components, which can result in so many character types. However, each character type is distinctly defined, tagged, and marked with data for a very specific reason. So there may be a lot of different "Orcs" the player could create, they are each defined in game data individually with their respective changes to the base character.

Right now, the game only has about 4 character choices. This is easily handled in code, without any save/loading of files, or accessing of databases, or any fancy classes.

In many text based games, it is all handled in code, perhaps with a simple switch. Input choice: 1 = Human, 2 = Elf, 3 = Orc, 4 = Minotaur, etc. etc.
However, this tends to get ugly when there are 180 possible choices. It gets uglier with nested switches.

I want to be able to have players filter the vast number of choices, with something like a GUI search bar or checkbox options. "[ X ] Melee Based, [  ] Uses Spells, [ X ] Uses Stealth."
Even simpler, perhaps a button for players who need help choosing, or suggestions based on a few questions for new players. "Are you big on Swords or Sorcery? blah blah" Alright, we suggest you try a: Elven Fire Wizard.

Besides hard coding this information which is what I am currently planning, is there a more organized way to handle search queries, the process of elimination, filtering of results, or any other thing I might need to help ease players into choosing from what will certainly be an overwhelming number of possibilities?
Even if newbies are only given a small number of choices that are easy to grasp, even expert players will need some sort of filtering system to help them decide.

As a developer, I enjoy having my code easily accessible. Reading through nested control structures to edit information isn't my favorite way of handling it. However, right now it's certainly the easiest since I only have 4 character choices.
I am entirely ignorant on databases, so forgive my ignorance if I mentioned that.

I am not exactly sure if a "database" is overkill or not for game data like this. Especially game data that doesn't need to be accessible to anyone but the developer, and is only very large after a significant amount of time has passed to update the game hundreds of times.

sentences:
Why is there a discrepancy between these two transform.up vectors? I was trying to implement a feature which required transform.up, the result didn't match the green axis gizmo displayed in the editor so I assumed it was being put off by the rotation of the object despite expecting the gizmo to adapt to that. I then modified the prefab such that everything was now child to an empty object and the secondary objects were child to that instead of the rotating model, and wrote a script that simply copies the transform so that it tracks. This still didn't show the values expected from what the gizmo in the editor showed. I then did a Debug.LogError in the track script and this time the result was as expected.

Why is transform.up showing the value expected from the local y-axis gizmo but when passing a reference to the original script and checking tracked.transform.up gives off results?

To reproduce in a simpler environment I set up a simple test scene.

Simple default cube with the hierarchy structure shown in the screenshot.
The transform values are as follows:

parent zeroed
x:0, y:-90, z:0 for cube
x:0, y:-90, z:90 for TrackPoint

Scripts are as follows:

test.cs - attached to trackpoint

private void Update()
{
    Debug.LogError(transform.up);
}

Track.cs - attached to tracker

public Transform transformToTrack;

private void Update()
{
    transform.position = transformToTrack.position;
    transform.rotation = transformToTrack.rotation;
    Debug.LogError(transform.up);
}

byref.cs - attached to cube

public GameObject refObj;

private void Update()
{
    Debug.LogError(refObj.transform.up);
}

When run, if you clear the console then click pause you'll see that one of them differs from the others. I don't understand why. My project and this sample scene differ in which it is that is giving unexpected results but the results are inconsistent with what I would expect.

But wouldn't they all give the same result?

sentences:
Dual Currency vs. One Currency in social games economics and monetization Not a programming question but game development related.

I am creating an iPhone online game which I wish to be free-to-play where in-app purchase is used for monetization. The important point is to make sure that this does not break the game-play, my priority is gameplay first, monetization second.

One popular way of monetizing the player base is to sell your in-game currency, however there are 2 ways to go about this:

One Currency: This currency can buy anything within the game, it can be earned through normal play at a limited rate. Players can, however, choose to buy this currency directly to speed up the acquisition of the currency.
Dual Currency: One currency can be earned through normal play and it can be used to buy a limited set of items that is required for normal enjoyment of the game. The second currency is 'premium' and must be purchased using real world money. This second currency can be used to purchase 'premium items' that gives extra abilities such as increase EXP gain, etc. The 2 currencies can be traded between players to give non-paying players to exchange their time for the 'premium' currency.

Both methods do not break gameplay and allows players who does not wish to pay enjoy the entire contents of the game if they put in enough time and effort.

My question is, is there any reason why you would pick one over another? What are the pros and cons that I should pay attention to when implementing each alternative?

Thank you.

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:
Calculating buoyancy force I am trying to simulate a buoyancy force for objects submerged/suspended in a fluid in a 2D environment.

According to Game Physics: Engine Development: How to Build a Robust Commercial-Grade Physics Engine for Your Game by Ian Millington (Chapter 6, page 99) (ISBN 987-0-12-381976-5) AND the wikipedia article on buoyancy the actual calculation is: PVG where P is the density of the fluid. V is the submerged volume (area) and G is the gravitational acceleration (0.00980665 Kilo-Newtons for Earth, but is variable in the code) and always acts in the opposite direction to gravity.

The code I have, below, produces a clean-looking result, but obviously the density of either the object in question or the fluid is not effecting the calculation, only the mass. If I insert the density of the fluid, say, water, at 1000.0 kg/m^3 the whole system explodes.

Is it something simple that I missed or did I screw up entirely?

The code I have so far:

//area_ratio is a scalar ratio of the area inside the defined fluid area (Volume submerged) and the entire object's bounding area (entire volume).
//area_ratio is equal to a value in the interval [0.0, 1.0]
//gravity is a force vector in Kilo-Newtons.
Vector2D current_weight(mass * area_ratio * gravity);

//current_area = The area inside the fluid. (Volume submerged)
Vector2D buoyancy(gravity.Normalize() * -current_weight * current_area);

//Forces and Impulses are automatically converted to Netwons by multiplying the values passed in by 1000.0
object->ApplyImpulse(buoyancy);

sentences:
String hashing design I'm in the process of developing a game engine and I would like to refer to game objects and assets by an integer id rather than by their string name.  This should avoid any string comparisons at runtime.  As a result I'm trying to implement the string hashing approach that Jason Gregory describes in Game Engine Architecture.
I've got the actual hashing working, using FNV-1a in my case, but there are some parts of the design from the book that I don't understand.
static StringId sid_foo = internString("foo");
static StringId sid_bar = internString("bar");
...
[stringid.h]

typedef U32 StringId;
extern StringId internString(const char* str);

[stringid.cpp]

static HashTable<StringId, const char*> gStringIdTable;

StringId internString(const char* str)
{
    StringId sid = hashCrc32(str);
    HashTable<StringId, const char*>::iterator it
        = gStringIdTable.find(sid);

    if (it == gStringTable.end())
    {
        // This string has not yet been added to the
        // table. Add it, being sure to copy it in case
        // the original was dynamically allocated and
        // might later be freed.
        gStringTable[sid] = strdup(str);
    }
    return sid;
}

Presumably HashTable is a custom hash table implementation as no such class exists in C++?  Is there any problem with my current setup of storing the hashed strings in a std::unordered_map<StringID, const char*>?
From my research, making the hash table static means that it is only accessible inside this translation unit.  a)  Why is it defined this way, and how would you then access the hash table in the rest of the game engine?  b) Or do you call internString for every string and store the returned hash in a header #included in every file that needs access?
What is the purpose of making externString extern?

Thanks.

sentences:
Generating face normals with the geometry shader I'm trying to visualize the face normals for a mesh, using the geometry shader to generate lines represeting the normal vectors. My intention was to draw that line from the triangles centroid, extenting a certain amount in the normal's direction.

This is the vertex shader's code :

#version 450 core

layout (location = 0) in vec3 vs_in_pos;
layout (location = 1) in vec3 vs_in_normal;
layout (location = 2) in vec2 vs_in_texc;

out VS_OUT_GS_IN {
    layout (location = 0) vec3 pos;
    layout (location = 1) vec3 normal;
    layout (location = 2) vec2 texc;
} vs_out;

void main() {
    gl_Position = vec4(vs_in_pos, 1.0f);
    vs_out.pos = vs_in_pos;
    vs_out.normal = vs_in_normal;
    vs_out.texc = vs_in_texc;
}

This is the geometry shader's code :

#version 450 core

layout (row_major) uniform;
layout (triangles) in;
layout (line_strip, max_vertices = 2) out;

in VS_OUT_GS_IN {
    layout (location = 0) vec3 pos;
    layout (location = 1) vec3 normal;
    layout (location = 2) vec2 texc;
} gs_in[];

out GS_OUT_PS_IN {
    layout (location = 0) vec4 color;
    layout (location = 1) vec3 pos;
} gs_out;

layout (binding = 0) uniform transform_pack {
    mat4 model_view_projection;
};

uniform float normal_length;
uniform vec4 start_point_color;
uniform vec4 end_point_color;

void main() {

    const vec3 avg_normal = normalize(
        gs_in[0].normal + gs_in[1].normal + gs_in[2].normal);

    const vec3 triangle_centroid =
        (gs_in[0].pos + gs_in[1].pos + gs_in[2].pos) / 3.0f;

    {
        gl_Position = model_view_projection * vec4(triangle_centroid, 1.0f);
        gs_out.color = start_point_color;
        gs_out.pos = triangle_centroid;
        EmitVertex();
    }

    {
        const vec3 end_pt = triangle_centroid + avg_normal * normal_length;
        gl_Position = model_view_projection * vec4(end_pt, 1.0f);
        gs_out.pos = end_pt;
        gs_out.color = end_point_color;
        EmitVertex();
    }

    EndPrimitive();
}

My problem is that the line representing the face normal has the origin
at one of the triangle's vertices (not the centroid).

If, however, I change this line

const vec3 triangle_centroid =
    (gs_in[0].pos + gs_in[1].pos + gs_in[2].pos) / 3.0f;

with this line

const vec3 triangle_centroid =
    (gl_in[0].gl_Position.xyz + gl_in[1].gl_Position.xyz
    + gl_in[2].gl_Position.xyz) / 3.0f;

the line representing the normal has the origin at the centroid (as it should).

But I really have no ideea why the first approach does not produce the correct
result.

Some screenshots :

first method (wrong):

second method (correct):

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:
Calculating projectile path when fired at an angle, forward I have a problem to code the path of a projectile from a gun as it moves forward and upward. This needs to be done in p5.js.

Although the Angry Birds method has been tried by me, I am looking for a more physics derived function involving the sine and cosine of angle of the gun.

sentences:
Why my canvas isn't showing anything after I put code in the loop for tile map? My canvas stop showing anything when I want to display a tile 25 times. No errors. Here is the code:

var canvas = document.getElementById("canvas");
var context = canvas.getContext("2d");

var StyleSheet = function(image, width, height) {
  this.image = image;
  this.width = width;
  this.height = height;

  this.draw = function(image, sx, sy, swidth, sheight, x, y, width, height) {
    image.onload = function() {
      context.drawImage(image, sx, sy, swidth, sheight,x, y, width, height);
    }
  }
}

var Loader = function(src) {
  this.image = new Image();
  this.image.src = src;

  this.image.onload=function(){
    var sprite = new StyleSheet(background, 16, 16);
    for (i = 0; i < 25; i++) {
      for (j = 0; j < 25; j++) {
        sprite.draw(background, 30, 30, 36, 36, i * 36, j * 36, 36, 36);
      }
    }
  }
  return this.image;
}

var background = new Loader("https://opengameart.org/sites/default/files/PathAndObjects.png");
console.log(background);

sentences:
How to make inputing large inputs more engaging I asked this question on another exchange "Encrypted content in games" and it made me wonder about game design.

The basics of that question is that you are using user-input, either directly or indirectly through the current game state, to generate a decryption key which unlocks/decrypts some secret content. This input would be the solution to some puzzle or come from a series of clues.

The problem is that the input space has to have high entropy to prevent it from being brute-forced, even by a computer. Having a series of levers would mean you need to have 90-120 or so of them. If I want a shorter input like let's 7, then you need 7500 different symbols to match those 90 levers which is way to many for people to distinguish between.

So I would like to hear ideas about how you could make an engaging/fun input method with high entropy. Ideally one that's visible to the user, meaning that the user is aware of it and not happening in the background.

Here is one example I thought about:

Imagine a secret altar outside of any quest lines. In front of it are 10 slots. Any of the 500+ game objects can be placed in the slots. Based on the game objects used and their permutation, a unique decryption key is generated using the object's game-IDs. Then the clues to what objects to use and in what order could be cleverly hidden through the game or somewhere else.

It still suffers from users possible being unable to effectively distinguishing the 500 different objects in the game. Also if your game is small and doesn't have that many objects it doesn't work.

sentences: Make a glass cup look like it's full of water I've been struggling to figure out a way to make a glass cup full of water, and since the cup is made of glass a plane on the top of the glasse won't really do it, so how can i go around making the glass looks like it's full of water?

sentences:
Allow a game object to pass out of a collider but not back in - Unity In my game I have enemies that shoot projectiles out at the player, the only way for the player to get rid of them is by guiding them into a structure.

An example of my enemy shooting a projectile.

The problem I have is that sometimes the enemy spawns on top of one of these structures as seen below.

This results in the projectile exploding/colliding with the structure the moment it is spawned.

I'm not entirely sure how to go about fixing this issue.

I have tried to find a way to disable the collider on the projectile for a few seconds but I couldn't get the timer right. I also think this might cause some odd game-play issues.

The second thing I tried was a platform effector, however I could only get it to form a circle and this didn't work out because my structures are of all different sizes and shapes.

If anyone could point me into the right direction or even help me find a better solution I'd be extremely grateful.
Thanks

ublic class MultiBullet : MonoBehaviour {

    public float speed = 1f;

    private Rigidbody2D rb;

    // Use this for initialization
    void Start () {
        rb = GetComponent<Rigidbody2D>();

    }

    // Update is called once per frame
    void Update () {
        rb.velocity = transform.up * speed;
    }

    private void OnTriggerEnter2D(Collider2D collision)
    {
        ////Add explosion Effect
        //if (collision.gameObject.tag == "Player")
        //{
        //    // Add game over screen here
        //    Debug.Log("Player Killed");
        //    Destroy(gameObject);
        //}
        ////Debug.Log("BOOM");
        ////Destroy(gameObject);
        if(collision.gameObject.tag != "BulletIgnore" && collision.gameObject.tag != "Cloud")
        {
            //Debug.Log("BOOM");
            Destroy(gameObject);
        }
    }
}

Just a simple class to handle when projectiles collide with objects.

sentences:
How to make a z-depth buffer with pygame? I am making a 3d renderer with python and so far am sorting the triangles which I want to replace with a z-depth buffer. The thing is, I don't know how to make a z-depth buffer in pygame. I still want it to be playable however.
By the way, I am using pygame polygons.

sentences: Unity web player API? Just curious about it. I only want to know that what graphics API does the Unity web player uses. Is that WEBGL? Or simply OPENGL? Or A custom one? Then how do the games get gpu acceleration?

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:
Is it possible to use a spherical collision component in UDK? I have an object in UDK, which has a SkeletalMesh. At certain times in the game, I want this object to continue rendering the SkeletalMesh, but I'd like it to use spherical collision temporarily.

After reading a bunch about PrimitiveComponents, my understanding is that UDK supports cylindrical and box-like collision, but not spherical without using a static mesh.

EDIT:
What I have now is a StaticMesh with a material that makes it invisible. I've added a StaticMeshComponent to my Pawns. I can shut off the Pawn's collision, and turn on the StaticMesh collision. But it doesn't respond to impulses. I figure I'm missing something in how you turn on the RigidBody thingy.

CylinderComponent.SetActorCollision(false, false);
SetPhysics(PHYS_RigidBody);
RBCollisionComponent.SetStaticMesh(RBCollisionMesh);
RBCollisionComponent.AddImpulse(InImpulse);
RBCollisionComponent.WakeRigidBody();

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:
How are vertices determined complex geometries in an ever changing game state For example say you wanted to draw a 3D cube you can define an array of hard coded vertices using float3, here is an example. http://msdn.microsoft.com/en-us/library/windows/desktop/jj552949.aspx

But you obviously can't define by hand large and complex changing geometry vertices such as you would have in a game. So I am trying to understand the mechanics behind how these vertices are loaded/interpreted into the Engine.

Another example, you could create a model in say Maya and export this vertex data to say an XML file, then load up the model using GL/DX. So Maya is doing all the work determining the vertex data. You could do this for terrain also, any vertex geometry.

However a game state is constantly updating, it is not static, the camera is constantly moving with user input. So what is the mechanics behind constantly re-evaluating new vertex data depending on user input.

sentences:
Unity: how do I make an input only available to the code? I have a simple function attached to a button. I then decided to change it by adding an input. The problem is that the function won’t run unless I specify the input in Unity via the inspector. I don’t want to do that because it will affect the function and I have already changed it inside. I already set the input when I run the function so there’s no need to set it again in Unity; this is a problem because the input is going to be different depending on different scenarios. How can I overcome this?

public void Eruption(string biome)
{
    if (biome == “sea”) {
        // do something
    }
}

sentences:
In-Game Level Design with XNA? I am wondering about in-game level design. My current situation revolves around Tiled - I have many different layers with different types of objects in them (for anyone who isn't familiar with Tiled, an object is nothing more than a coordinate with arbitrary properties assigned to it).

I am currently re-compiling the game every time I make a little change to my map file to see if everything is positioned properly. Is there a way for me to have my game automatically re-load the level if a map file change is detected? Does XNA even allow for this, or does the way the content pipeline work not allow for dynamic content in such a way? Any tips or suggestions are absolutely welcome.

sentences:
Uncaught TypeError: Cannot read property 'Mesh' of undefined I would like to use dragonBones with pixi.js. I got a problem.

When the following line executes in dragonBones, I am getting an error:

slot.init(slotData, displays, new PIXI.Sprite(), new PIXI.mesh.Mesh(null, null, null, null, PIXI.mesh.Mesh.DRAW_MODES.TRIANGLES));

The error says: Uncaught TypeError: Cannot read property 'Mesh' of undefined.. And yeah, while debugging, I noticed that PIXI.mesh is really undefined.

What can I undertake against the error?

I am using this file for a dragonbones.

May it be that the problem is in the fact that I am using pixi.js - v4.5.6?

sentences:
I am looking for a simple tutorial for sprite animation in android Possible Duplicate:
  What's the best way to create animations when doing Android development?

I saw a couple of them on the internet but they are beyond my level of understanding ...I need to start with basics in a simpler way if possible...can anyone guide me to some good online resources for this

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

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

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

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:
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:
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:
What does the term 'photorealistic' really mean? I was wondering about the term 'photorealistic' in regards to rendering and was wondering how this is used.

Is it used to describe a shader (or set of) that have certain quantifiable features? Or any rendering thats not meant to be abstract, like the cartoon effect seen in Borderlands? Or is it just a subjective term meaning 'really really realistic'?

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 do I do a game loop in c99? I'm having trouble with how to structure a game using c99. I've seen a few tutorials on making a game loop, but they are all done with c++ and classes. My main problem seems to be moving data around between the functions without creating a mess, and what stuff to put in what header files etc. Do I just do something similar to the c++ loops, and create a class-like header with a structure containing all items needed by more than one of the functions, along with the prototypes of said functions, and include the header in each function's header file? Then, in the main function, instantiate the structure and pass a pointer to it to every function in the loop?

Is this ok, or is there a better way to do it, and are there any good 'c' specific tutorials available?

Cheers

sentences:
How to create video from camera? I have a 3d scene and a camera; I want to create video file from camera pre-set movements.
If it is possible, running application by command line (without needed to "show" at video, my camera) .

Is it possible in Unity ?

If yes what's the best approach ?

Thanks

sentences:
Calcluate Mesh top, bottom, left and right position relative to mouse click position on the mesh I have a mesh (suppose it can be circle, or rectangular,square or an arc). The geometry of the mesh can be anything. I can click on mesh at any position. From relative to the clicked position, I want to get its right, left top and bottom position of the mesh. Maybe the picture explain it better then my words

Update: I tried to apply a quick dirty solution. It is incomplete:

// Update is called once per frame
void Update()
{
    if (Input.GetMouseButtonDown(0))
    {
        //Ray r = Ray(Input.mousePosition);
        RaycastHit rayHit;
        Ray r = Camera.main.ScreenPointToRay(Input.mousePosition);

        if(Physics.Raycast(r,out rayHit,1000))
        {
            Debug.Log(rayHit.transform.name);
            Debug.Log(rayHit.point);
            Debug.Log(rayHit.normal);
            StartCoroutine(MoveToDirection(rayHit.point));
        }
    }

}

IEnumerator MoveToDirection(Vector3 startPosition)
{
    GameObject go = GameObject.CreatePrimitive(PrimitiveType.Cube);
    go.transform.position = startPosition;
    while (true)
    {
        go.transform.position=  go.transform.position + go.transform.up * Time.deltaTime* speed;
        yield return new WaitForEndOfFrame();
    }

}

On click i instantiated a gameobject and start moving in upward direction and when it leaves the mesh bounds i will get the position but it have differet problems, like:
1. It will not work with arc object or maybe with non rectangular geomerty.
2. I have to apply onTrigger and onExitEvent that can be skip when the cube move with fast pace.

sentences: Grid based collision - How many cells? The game I'm creating is a bullet hell game, so there can be quite a few objects on the screen at any given time. It probably maxes out at about 40 enemies and 200 or so bullets. That being said, I'm splitting up the playing field into a grid for my collision checking. Right now, it's only 8 cells. How many would be optimal? I'm worried that if I use too many, I'll be wasting CPU power. My main concern is processing power, to make the game run smoothly. RAM is not a big concern for me.

sentences:
Java graphic objects as in flashgames How is it possible (with the standard Java2D engine) to use small sprites like graphic objects?

For those who don't know what I mean, in all those Flash-games like on Facebook they put small sprites on the screen which react to mouse-over and clicks. I tried to do the same in Java but can't find a good method. Swing components always spread over the whole bitmap, but I only want to get a reaction from the object when the mouse is over a pixel that's not transparent.

So basically checking every time if the object below the mouse contains a non-transparent pixel (which i believe could be pretty intense in a gameloop or repaint loop). I have no idea how to implement such a thing efficiently.

sentences:
How can I make actions that effect the position of another player appear responsive when my game server is authoritative? You are playing as Lucio in Overwatch. You boop another player and they immediately get booped away. It feels really responsive. But the server hasn't actually registered the boop yet. By the time your command reaches the server, that player might be in a different location and the result of your boop might be completely different. If we needed to wait for a server confirmation, we wouldn't see our boop for, say, 200ms. (assuming 200ms RTT.)
You are driving around in PUBG and see another player. You drive your car in to a player who is running around on foot. They appear to immediately die or at least get bumped away by the impact. You hit the player where you saw him but he is actually somewhere else on the server (you may have actually missed him!). If our game does not respond immediately, we would see the other player clip in to your car as they continue running, then, say, 200ms later they would die or get knocked around (again assuming a RTT of 200ms)

How are situations like these resolved? It seems like the result is simulated locally (prediction) but the outcomes could be so drastic that an incorrect prediction could result in a lot of confusion. (Running over a player who isn't actually in your way, booping a player to your left off a cliff, but they are actually in front of you and won't fall down the cliff)

sentences:
How can I optimise a Minecraft-esque voxel world? I found Minecraft's marvelous large worlds extremely slow to navigate, even with a quad core and meaty graphics card.

I assume Minecraft's slowness comes from:

Java, as spatial partitioning and memory management are faster in native C++.
Weak world partitioning.

I could be wrong on both assumptions. However, this got me thinking about the best way to manage large voxel worlds. As it is a true 3D world, where a block can exist in any part of the world, it is basically a big 3D array [x][y][z], where each block in the world has a type (i.e BlockType.Empty = 0, BlockType.Dirt = 1, etc.)

I assume that to make this sort of world perform well, you would need to:

Use a tree of some variety (oct/kd/bsp) to split all the cubes out; it seems like an oct/kd would be the better option, as you can just partition on a per cube level not a per triangle level.
Use some algorithm to work out which blocks can currently be seen, as blocks closer to the user could obfuscate the blocks behind, making it pointless to render them.
Keep the block object themselves lightweight, so it is quick to add and remove them from the trees.

I guess there is no right answer to this, but I would be interested to see peoples' opinions on the subject.  How would you improve performance in a large voxel-based world?

sentences:
How to flatten the collider for a tilemap? I am relatively new to game development, and am working on a simple 2D platformer. I have created a tilemap and painted some tiles for the character to walk on.. but he is getting stuck. Yes, I know this is a common question and I did find some answers (including this one: Player gets stuck on edges between TilemapCollider2D tiles), but none seem relevant for me. The thing is my tiles are not flat.. they have pointy edges due to grass.. see the image below:

As you can see, the edge is not flat. I have overcome the problem of getting stuck by changing the "Edge Radius" to what you see in the above screenshot and that works, but the character now looks like he is floating slightly above the ground. Is there any way I can just tell Unity to ignore the jagged grass and make the collider flat and move the edge of it down a bit? That way it would fix the issue and also have the added bonus of looking like some of the grass is behind him and some in front..

sentences:
Can we merge multiple FBX files, using Maya, and export as a single FBX file? I have a humanoid model which is made up of four FBX files; one is for the human, one is for the T-shirt, one is for the pants and one is for the hair. I want to merge them into one FBX, because the manner in which I am using it requires using a single FBX file to represent the character.

Can we merge four FBX files into one, using Maya, and export as a single FBX file?

sentences:
What should a game engine do? I'd like to improve my skills/try something new and I'd like to start with 3D. I have read Starting programming in 3D with C++ but I have question about engines:

What should engine do? I know it is abstraction layer above 3D API (i.e. OpenGL or DirectX) but what should it exactly do?

sentences:
Should I delete the textures I use in OpenGL ES 2 (Android)? Say I have a skybox and the user can choose out of 2 sets of 6 textures (one for each face of the cube) to use on that skybox. For example if user selects set A, I load the textures (GLES20.glGenTextures etc) and put them on the cube.

However, if the user then selects set B, should I delete the textures I previously created? Or what's the standard way of dealing with textures that are (at least temporarily) no longer needed? Also, is texture deletion an expensive operation?

My app will include other scenarios similar to the above, so I might end up having 10-15 (or more) textures in memory with only a few of them displayed, therefore I expect deleting them is the way to go.

sentences: Is there performance difference between OnCollisionEnter and OnTriggerEnter? Is there performance difference between OnCollisionEnter and OnTriggerEnter? I have around 12 objects all calling OnCollisionEnter when in fact OnTriggerEnter could work as well. So I wonder if the are is any difference PERFORMANCE WISE between the two

sentences:
unity - get component variable from object in trigger i want to get a component value from the game object which collides with my trigger's object script. this is my code on the trigger:

 void OnTriggerEnter (Collider obj){
     if(obj.GetComponent<motor>().enabled == true){
         passed = true;
     }
 }

and this is the error i get:

NullReferenceException: Object reference not set to an instance of an object
 cp.OnTriggerEnter (UnityEngine.Collider obj) (at Assets/Scripts/cp.cs:15)

also when changing the code on the trigger:

 motor mObj = obj.gameObject.GetComponent();
    if(mObj != null){
         //code here
         Debug.Log("mObj not null");
     }else{
             Debug.Log("mObj is null");
     }

it returns

  mObj is null

but the parent obj does have that 'motor' script, other scripts in the car which enter the trigger can access it

sentences:
GameServer UDP or TCP Java This is a Java related question.

I've got this question and I searched on the internet but didn't really get any clear answer.

I want to develop a little multyplayer game which needs real time synchronization for a few clients. I don't really want to have a lot of clients, but I want to have the chance to create it for a greater scale later.

Seeing through some Links (also given here from stackexchange) I got the answer that UDP would be better, then others say TCP. I know it's sometimes more an opinion thing what you prefer most for yourself.

But I've developed some network games in the past (not proffessional ;) ) and used TCP. And I didn't really get a lagfree game, even for three clients (players)

I then used the new nio (asynch) network framework of java, but the lag just reduced a little bit.

So how can I develop a reliable Server-Client model? Using TCP or UDP? Or did I just end up developing a bad example and thats why my server-client communication lagged?

If someone has a good tutorial for developing a reliable java game server that would be nice.

Thank you

sentences:
2D BoundingBox Collision Detection Problem I implemented collision detection into my game (using Bounding Boxes) The character is floating above the blocks instead of standing on them. I know what is happening, but I can't figure out how to calculate how high that space is, so I can change the position.

Here is a picture:

sentences:
AI Behaviour design pattern which handles lots of diverse behaviours and mechanics? I'm working on an 2D overhead topdown game in Unity3D and I want the enemies to have lots of diverse behaviours.

How should I design the architecture with this in mind?

For example I want:

A simple walking monster, which can move on walkable tilemaps, attack the player on sight.
A spider like creature, which jumps from wall tile to wall tile, and approaches the player in this manner.
I want a snail which walks on a route, and makes a trail (ie by flagging the tiles) behind itself, apart from this, it's unresponsive (like doesn't care if the player attacks itself)
A werewolf, which can smell the player from X tile away. (Like there is a walkable path to the player)
50 more unique behaviours...

Needless to say, I'm not talking about how to implement this, but how could I design a system which will be robust enough for this many behaviours, not really error-prone, low amount of code duplication, etc.

Thanks in advance!

sentences:
How do I "reset" the color in OpenGl ES 1.0/1.1? In my 2D game I use glColor4f() to set the color and draw my screen border rectangles
but when I try to start drawing my game objects, made up of a texture
on a rectangular "quad", using GL10.GL_TEXTURE_2D, GL10.GL_VERTEX_ARRAY
and GL10.GL_TEXTURE_COORD_ARRAY no GL10.GL_COLOR_ARRAY, it uses the "current
color" from glColor4f().

My question is what do I need to set/reset in OpenGl ES to re-enable it to
use the colors from the texture when I try to draw them?  If I comment out the border drawing, so glColor4f() never gets called, the colors are fine.

I'm not using double buffering.  I read that once you set the color with
glColor4f() it stays set, unless you possibly use glPushAttrib(GL_CURRENT_BIT),
but I heard that that's expensive, time wise.

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:
LibGDX collision with rectangle and circle I have 2 objects, A and B, both are classes with only values, so positions and dimensions are only values (float posX,posY).

I have a render class which render A and B with shapeRenderer; A is rendered as a rectangle and B as a circle, how could check if there is a collision ?

edit:  I have a rectangle coming from up, when it hits the circle I have to stop the game

sentences:
Linux: find force feedback device for joystick device Because SDL 1.3 is still a long way coming I implemented native force feedback (rumble) support for Aquaria:
https://bitbucket.org/panzi/aquaria/

However, I could not find a way to find the according event device (force feedback device) for any given joystick (gamepad) device. I looked in the SDL 1.3 source and I thought this might be how it is done:

std::ostringstream os;
os << "/dev/input/js" << sdl_index;
std::string jsdevice(os.str());
char evdevice[128];
evdevice[0] = 0;

int fd = open(jsdevice.c_str(), O_RDONLY, 0);
if (fd <= 0) {
    std::cerr << "Could not open joystick [" << jsdevice << "]: " << strerror(errno) << std::endl;
    return;
}

if (ioctl(fd, EVIOCGNAME(sizeof(evdevice)), evdevice) == -1) {
    std::cerr << "Could not get event device for joystick [" << jsdevice << "]: " << strerror(errno) << std::endl;
    close(fd);
    return;
}

close(fd);

// ...

But it always just prints this:

Could not get event device for joystick [/dev/input/js0]: Invalid argument

Currently I use an environment variable to indicate the force feedback device that should be used. Does anyone know how to automatically find the correct device? What I've got is the input device as an index (e.g. the 0 in /dev/input/js0) and therefore the path.

sentences: Good game design books? I have some experience in creating, however I like to have some well written reference material to help me produce better products.  Are there any game design books that are not aimed at a particular programming language?

sentences:
Finding roots/zeros for collision detection? For the most simple of 2D games, I have implemented a posteriori collision detection (overlapping rectangles) on the x/y Cartesian plane, but am now interested in understanding the basics of a priori collision detection...

In the link here, I noticed the reference to Newton’s Method.  So, I want to better understand the link b/w finding zeros of an equation and detecting a posteriori collision.

Let's start with the most obvious case of finding roots of an equation:  If you have a projectile's trajectory modeled as a quadratic function, you can find the roots to predict at what time the height will equal zero (or any other constant height, actually, by just solving f(x)=C to be f(x)-C=0 and then finding roots of that expression).

So, as I understand, finding the root can tell me the time at which the object will be at any chosen height.  More broadly, we basically know the (x,y) location of the object for any given time.  But how does root finding, in particular, translate to detecting collisions with another object?  (The other object may be stationary, or be moving.  If the latter, do you also determine roots/location of this moving object as well? Calculate the (x,y) trajectory of both objects and determine where they will intersect?)

Again, the basic question is where does root finding come into play?  Any links to a basic primer on this topic, with a simple example would also be greatly appreciated.

sentences:
Detecting a ledge in Box2D Possible Duplicate:
  Detect Open Space in Farseer
  How do I detect ledges?

I'm making a 2D platformer with Box2D. The player needs to be able to grab onto a ledge and pull him/herself up.

Right now I have a sensor that extends in every direction from the upper half of the player's body.

The logic seems simple enough: if there are tiles inside the sensor and empty space above them, then it's a ledge and the game should act accordingly. The problem is that I can't figure out how to implement that logic with Box2D.

Anyone have any ideas?

sentences:
Chessboard colors with VBO I am trying to draw a chessboard pattern using VBO. Geometrywise, I have it implemented and working nicely. However, I have come to the point where I want to color up the board and I have realized that I cannot do it because vertices should be black and white at the same time, depending which square they are drawing. So, looks like I cannot create a color array the same way I create a vertex array.

Any ideas how I can sort this out? Is there anyway to assign two colors to the same vertex, and select one or another depening on the actual square being rendered?

This is the code I am using so far, which is generating a nice "white to black" diagonal pattern instead of the chessboards-like.

glGenBuffersARB(1, &VBOfloorVerticesAndNormals);
glBindBufferARB(GL_ARRAY_BUFFER_ARB, VBOfloorVerticesAndNormals);
glBufferDataARB(GL_ARRAY_BUFFER_ARB, numVertices*sizeof(float), vertices, GL_STATIC_DRAW_ARB);

glGenBuffersARB(1, &VBOcolors);
glBindBufferARB(GL_ARRAY_BUFFER_ARB, VBOcolors);
glBufferDataARB(GL_ARRAY_BUFFER_ARB, numColors*sizeof(float), colors, GL_STATIC_DRAW_ARB);

glGenBuffersARB(1, &VBOfloorIndex);
glBindBufferARB(GL_ELEMENT_ARRAY_BUFFER_ARB, VBOfloorIndex);
glBufferDataARB(GL_ELEMENT_ARRAY_BUFFER_ARB, numIndices*sizeof(int), indices, GL_STATIC_DRAW_ARB);

glEnableClientState(GL_VERTEX_ARRAY);
glBindBufferARB(GL_ARRAY_BUFFER_ARB, VBOfloorVerticesAndNormals);
glVertexPointer(3, GL_FLOAT, 0, 0);

glEnableClientState(GL_COLOR_ARRAY);
glBindBufferARB(GL_ARRAY_BUFFER_ARB, VBOcolors);
glColorPointer(4, GL_FLOAT, 0, 0);

glIndexPointer(GL_UNSIGNED_SHORT, 0, 0);
glDrawElements(GL_QUADS, numIndices, GL_UNSIGNED_INT, 0);

glDisableClientState(GL_VERTEX_ARRAY);
glDisableClientState(GL_COLOR_ARRAY);

glBindBufferARB(GL_ARRAY_BUFFER_ARB, 0);
glBindBufferARB(GL_ELEMENT_ARRAY_BUFFER_ARB, 0);

And this is the pattern I get:

sentences:
How to render many tiles fast if zoomed out? (Monogame/xna) I'm currently trying to optimize my tile engine. I used monogame with the spritebatch first, but that doesn’t works well. I have read many articles how I could optimize my rendering code.

I moved away from the normal spritebatch and used the vertexbuffer+indexbuffer stuff. Works very well, but not so good as I hoped. I have chunked my tilemap in 50*50 large chunks and render each with his own vertexbuffer. Additional I check whether the chunk is in view and only render it then. But things are getting very bad if I zoom out.

Let’s say the map is 500*500 tiles where a tile is 32*32px tall. Now I must render too many of the chunks to the same time. How can I fix that performance issue here?

I have attached a sample project if some one is interested in it.
https://www.dropbox.com/s/2vbkng7ne6ey43e/TileEngineTestXnaMonoWpf.zip

sentences:
How can I improve the current enemy spawning system for my strategy game I'm currently making an RTS game for mobile where mini battles would take place on tiny battlegrounds.
The problem is that currently the player is spawning its units based on a currency system, whereas the enemy is spawning based on a timed system. The timed system would make sense in a tower defense game, but not here.
Here is a short clip of it in action: https://twitter.com/LewanayG/status/1378009426808950794
This is my current spawn script:
void Start()
    {
        //start spawning waves
        StartCoroutine(SpawnWaves());
    }

    IEnumerator SpawnWaves()
    {
        //before spawning the first enemies, wait a moment
        yield return new WaitForSeconds(startWait);
        while (true)
        {
            //if not all characters of this wave are spawned, spawn new enemy and that wait some time before spawning next enemy in this wave
            for (int i = 0; i < startEnemyCount; i++)
            {
                int random = Random.Range(0, enemies.Length);
                GameObject newEnemy = Instantiate(enemies[random], transform.position, transform.rotation) as GameObject;
                newEnemy.transform.parent = enemyParent.transform;

                yield return new WaitForSeconds(spawnWait);                         // to add some randomness between spawns
            }

            //make sure the next wave contains more enemies than this one
            startEnemyCount += extraEnemiesPerWave;
            //wait before starting the next wave
            yield return new WaitForSeconds(waveWait);
        }
    }

Under the current system, as long as the player has more units on the battleground than the current spawn rate of the enemy it will win, and its really difficult to balance this game based on the two spawn systems.
How do you suggest I handle this problem and the spawn system of enemy units?

sentences:
Staggered Isometric Map In Javascript I'm trying to create a staggered isometric map in Javascript.

    var x, y, row, column, top, left,
        width = window.innerWidth, height = window.innerHeight,
        tile = {width: 64, height: 32};

    row = Math.ceil(width / tile.width); // how many rows will be in map
    column = Math.ceil(height / tile.height); // how many columns will be in map

    for (x=0 ; x<row ; x++){
        for (y=0 ; y<column ; y++){
            top = y * tile.height - (y % 2 == 0 ? 0 : tile.height / 2);
            left = x * tile.width - (y % 2 == 0 ? 0 : tile.width / 2);

            $('<div />').addClass('tile').css({
                width: tile.width,
                height: tile.height,
                top: top,
                left: left
            }).appendTo('body');
        }
    }

My formula doesn't work for vertical axis. It creates something like this.
http://postimage.org/image/ekfnlbgoh/

How can I make it work? I need it to be something like this.
http://legendofmazzeroth.wikidot.com/staggered-isometric-maps

Here is the latest code:

    row = Math.ceil(height / (tile.height / 2));
    column = Math.ceil(width / tile.width);

    for (y=0 ; y<=row ; y++){
        for (x=0 ; x<=column ; x++){
            top = y * (tile.height / 2) - (tile.height / 2);
            left = x * tile.width - (y % 2 == 0 ? 0 : tile.width / 2) - (tile.height / 2);

            $('<div />').addClass('tile').css({
                width: tile.width,
                height: tile.height,
                top: top,
                left: left
            }).appendTo('body');
        }
    }

By the way, thanks to you that column/row mistake has been fixed.

sentences:
Making an indie with friends: Legal considerations I am close to finishing a game I am making with 3 friends. 1 other coder, and 2 graphic designers. We agreed from the start to split revenue (40/40/10/10).

However we have no contract, and I know that I don't own the graphics/sounds in my game just because "my friend made it". What steps should we take to make sure that all graphics/sounds that were provided by my friends, are actually owned by me (the company).

We have a budget of $0 so hiring a lawyer is not an option, should we draft our own contract regarding the revenue share?

sentences:
How to prevent objects from colliding into each other in the Unity editor? I am building a map for a game... I am making most of the buildings with cubes. When I move a cube next to another one they go through each other... Which creates flickering. This is making it very hard to build the map. How do I enable collisions in the editor (Make it so they don't go through each other when you try to move one)?

Here is a picture:

sentences:
How to setup a particular blend state where the alpha channel is additive? I would like to set a blend state to be "additive" and do the following:

Result.R = Source.R + Destination.R;
Result.G = Source.G + Destination.G;
Result.B = Source.B + Destination.B;
Result.A = Source.A + Destination.A;

So I've tried setting a blend state to:

IsBlendEnabled = 1;
SourceBlend = BlendOption.One;
DestinationBlend = BlendOption.One;
BlendOperation = BlendOperation.Add;
SourceAlphaBlend = BlendOption.One;
DestinationAlphaBlend = BlendOption.One;
AlphaBlendOperation = BlendOperation.Add;

I was thinking it would do:

Result = Source*BlendOption.One + Destination*BlendOption.One;

But I doesn't work (I've tried so other combinations as well). The color (RGB) channels are adding up correctly but the alpha channel is not (it's not affected by the blend finally, but still not adding up). I'm drawing three overlapping quads with different colors (red, green, blue) and alpha of 0.1. But result alpha is not 0.0-0.3 (0.0 = no overlap, 0.1 = one quad, 0.2 = two quads overlap, 0.3 = three quads overlap) as I would expect.

Is it even possible to setup blend state to accumulate alpha on render target?

Note: I would like to have a color map (RGB) being mixed and alpha channel indicating how many quads are overlapping (0-3 quads => 0.0-0.3 alpha value).

sentences:
Using a Higher Precision (than 8-bit unsigned integer) Buffered Image for Heightmaps in Java I am generating a heightmap for every quad in my quadtree in openCL. The way I was creating the image is as follows:

DataBufferInt dataBuffer =
            (DataBufferInt)img.getRaster().getDataBuffer();
      int data[] = dataBuffer.getData();
      //img is a bufferedimage
        inputImageMem = CL.clCreateImage2D(
        context, CL_MEM_READ_WRITE | CL_MEM_USE_HOST_PTR,
        new cl_image_format[]{imageFormat}, size, size,
        size * Sizeof.cl_uint, Pointer.to(data), null);

This works ok but the major issue is that as the quads get smaller and smaller the 8-bit format of the buffered image starts to cause intolerable "stepping" issues as seen below:

I was wondering if there was an alternate way I could go about doing this?

Thanks for the time.

sentences:
Unity5 build won't run on android 2.3.3 I made a game using one of the Unity tutorials on their site and now would like to run on my phone (LG P500). But when I try to run it on the device, it says:

  Failure to initialize: Your hardware does not support this application, sorry!

What can I do in this case?

sentences:
How can I find all connected objects of the same type recursively? In my game, when a user selects an object of some type, I'd like to search for all other objects of the same type that are connected to that first one.

For example, if the user selects a object of type 2, I want to check the object next to that one to see if it is also of type 2 and so on in all directions (up, down, left and right, et cetera) until there are no more objects of that type connected.

Does anyone know how I could do something like this? You can assume I have access to the set of connections from any given object.

sentences:
How to make a windows installer for Monogame/F# game? Alright, I have several questions that I haven't been able to find answers to yet. It looks like WiX and Inno Setup are pretty standard solutions for making the installer. WiX looks pretty intimidating and I got lost reading the tutorial on their site, so I'll probably use Inno Setup.

My questions:

What are the dependencies for Monogame that I need to install? I couldn't find any official documentation on this. I found a few forums posts where people said you'll likely need DX 11 and .NET 4.0. My visual studio project says .NET 4.5, so I'm guessing that's actually the one I need?
What things in my output directory need to be installed? I've got some .XML, .pdb, and .config files and I doubt I should be including them? Does MS have documentation on this?
Are there any tools to help me make sure I've got everything? Maybe some Visual Studio automation for doing this stuff? It looks like there is a WiX template for XNA, but I have no idea if I can safely use that with monogame.
Do I need a separate windows computer (including license) just to test the install? Or can I make a VM and use like a trial version of windows? It looks like windows 10 has a trial mode.
Additional guides, tutorials, or documentation I should be reading?

Thanks!

Here are the files in my output directory for the release build (do I need all these?):

font.xnb
FSharp.Core.dll
FSharp.Core.xml
MonoGame.Framework.dll
MonoGame.Framework.xml
NVorbis.dll
OpenTK.dll
Pong.exe
Pong.exe.config
Pong.pdb
Pong.XML
pop.xnb

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:
How to avoid 2d enemy using trigonometry? I'm making a game in Javascript & HTML5.

I have a "bullet" (let's call it so) that needs to reach the enemy (at fixed position) and that need to avoid the enemy's "bullet".

To make the bullet move to the enemy i'm using this code:

var direction = Math.atan2(self.enemy.y - self.y, self.enemy.x - self.x);
var dir_diff = self.rotation - direction;
// ... other code
self.rotation -= dir_diff;
self.x += Math.cos(self.rotation) * self.speed / dt;
self.y += Math.sin(self.rotation) * self.speed / dt;

How can I make the bullet avoid another moving bullet?

I tried to search but algorithms like A* etc. doesn't seem right for this.

Thank you.

sentences:
Having Problems in PyGame with Mouse Cursor and Sprite Collision I know something is not right but I'm just starting out and hit a wall.
Basically, I just want to MouseClick on a Sprite and make something happen.
The mouse clicking itself works, the sprite collision itself works but not when I try to collide the mouse clicking with a sprite.
def new(self):
    self.foodbowl_img = pg.image.load(path.join(self.img_folder, BOWL_IMG)).convert_alpha()
    self.foodbowl_img_rect = self.foodbowl_img.get_rect()
    self.cursor_img = pg.image.load(path.join(self.img_folder, CURSOR_IMG)).convert_alpha()
    self.cursor_img_rect = self.cursor_img.get_rect()

def events(self):
    for event in pg.event.get():

        # Mouse Input
        # I know that pg.mouse.get_pos() does not belong in the event method ...
        # ... and I'll change this so bear with me.
        self.mx, self.my = pg.mouse.get_pos() # saves mouse position to mx and my

        if event.type == pg.MOUSEBUTTONDOWN:
            print("This click works.")
            if pg.sprite.groupcollide(self.cursor, self.foodbowl, False, True):
                print("This click does not work.")

In my sprites.py I have the Cursor Class:
class Cursor(pg.sprite.Sprite):
    def __init__(self, game):
        self.groups = game.all_sprites, game.cursor
        self.image = game.cursor_img
        self.rect = self.image.get_rect()
        self.hit_rect = CURSOR_HIT_RECT
        self.hit_rect.center = self.rect.center

... and the Foodbowl Class:
class Foodbowl(pg.sprite.Sprite):
    def __init__(self, game, x, y):
        self._layer = ITEMS_LAYER
        self.groups = game.all_sprites, game.foodbowl
        pg.sprite.Sprite.__init__(self, self.groups)
        self.image = game.foodbowl_img
        self.rect = self.image.get_rect()
        self.pos = vec(x, y)
        self.rect.center = self.pos
        self.hit_rect = BOWL_HIT_RECT.copy()
        self.hit_rect.center = self.rect.center
        self.content = BOWL_CONTENT

I also tried numerous and different variations of:
#if self.foodbowl_img.get_rect().collidepoint(x, y):
#if pg.sprite.groupcollide(self.cursor, self.foodbowl, False, collide_hit_rect):
#if self.foodbowl_img_rect.colliderect(self.cursor_img_rect):
# colliding = self.foodbowl_img_rect.colliderect(self.cursor_img_rect)

Alas, nothing works...
Any help is much appreciated.

sentences:
How can I cancel a contact in a b2ContactListener? To know when contacts happen we can derive from b2ContactListener and implement our own solution which is great. I'm wondering is there anyway we can cancel a contact, that is to say when we hit begin contact we call a function or do something to destroy the contact before it has a chance to be resolved?

My game logic relies on setting any number of collision groups (which are basically integers). Collision groups can have settings to interact with one another, for example collision group 41 and 13 may be set to never collide while group 41 and 56 will collide. Some groups which are set not to collide are still meant to generate an OnContact callback (but will obviously never get to end contact).

sentences:
How do I clip an image in OpenGL ES on Android? My game involves "wiping off" an image by touch:

After moving a finger over it, it looks like this:

At the moment, I'm implementing it with Canvas, like this:

9Paint pTouch;
9int X = 100;
9int Y = 100;
9Bitmap overlay;
9Canvas c2;
9Rect dest;

    pTouch = new Paint(Paint.ANTI_ALIAS_FLAG);
    pTouch.setXfermode(new PorterDuffXfermode(Mode.SRC_OUT));
    pTouch.setColor(Color.TRANSPARENT);
    pTouch.setMaskFilter(new BlurMaskFilter(15, Blur.NORMAL));

    overlay = BitmapFactory.decodeResource(getResources(),R.drawable.wraith_spell).copy(Config.ARGB_8888, true);

    c2 = new Canvas(overlay);

    dest = new Rect(0, 0, getWidth(), getHeight());
    Paint paint = new Paint();9
    paint.setFilterBitmap(true);

    ...

    @Override
    protected void onDraw(Canvas canvas) {
        ...

        c2.drawCircle(X, Y, 80, pTouch);
        canvas.drawBitmap(overlay, 0, 0, null);

        ...
    }

    @Override
9public boolean onTouchEvent(MotionEvent event) {

        switch (event.getAction()) {
            case MotionEvent.ACTION_DOWN:
            case MotionEvent.ACTION_MOVE: {
                X = (int) event.getX();
                Y = (int) event.getY();9
                invalidate();
                c2.drawCircle(X, Y, 80, pTouch);9
                break;
            }
        }
return true;
...

What I'm essentially doing is drawing transparency onto the canvas, over the red ball image.

Canvas and Bitmap feel old... Surely there is a way to do something similar with OpenGL ES. What is it called? How do I use it?

[EDIT]

I found that if I draw an image and above new image with alpha 0, it goes to be transparent, maybe that direction?

Something like:

gl.glColor4f(0.0f, 0.0f, 0.0f, 0.01f);

sentences:
How to make async step timing (game loop) using Box2D and C++ I'm making a game in C++ using Box2D and WebSocket++. The world needs to updated every 1/60 second. Meanwhile the WebSocket server handles players. How I should make the interval? I know there's no setInterval function in C++, but I can do something like this:

• make async function - https://stackoverflow.com/questions/33234403/using-setinterval-in-c/33234557

• make async thread - https://codereview.stackexchange.com/questions/40915/simple-multithread-timer

or maybe there's a lib?

Note: this isn't a duplicate of How should I write a main game loop? because here I need asynchronous game loop. In linked topic there are synchronous game loops.

Why I won't use while (sync loop):

commands after while (loop) are never excuted if loop is set to true.

sentences:
What common interface would be appropriate for these game object classes? Question

A component based system's goal is to solve the problems that derives from inheritance: for example the fact that some parts of the code (that are called components) are reused by very different classes that, hypothetically, would lie in a very different branch of the inheritance tree.

That's a very nice concept, but I've found out that CBS is often hard to accomplish without using ugly hacks. Implementations of this system are often far from clean. But I don't want to discuss this any further.

My question is: how can I solve the same problems a CBS try to solve with a very clean interface? (possibly with examples, there are a lot of abstract talks about the "perfect" design already).

Context

Here's an example I was going for before realizing I was just reinventing inheritance again:

class Human {
public:
    Position position;
    Movement movement;
    Sprite   sprite;
    // other human specific components
};

class Zombie {
    Position position;
    Movement movement;
    Sprite   sprite;
    // other zombie specific components
};

After writing that I realized I needed an interface, otherwise I would have needed N containers for N different types of objects (or to use boost::variant to gather them all together). So I've thought of polymorphism (move what systems do in a CBS design into class specific functions):

class Entity {
public:
    virtual void on_event(Event) {} // not pure virtual on purpose
    virtual void on_update(World) {}
    virtual void on_draw(Window) {}
};

class Human : public Entity {
private:
    Position position;
    Movement movement;
    Sprite   sprite;
public:
    virtual void on_event(Event) { ... }
    virtual void on_update(World) { ... }
    virtual void on_draw(Window) { ... }
};

class Zombie : public Entity {
private:
    Position position;
    Movement movement;
    Sprite   sprite;
public:
    virtual void on_event(Event) { ... }
    virtual void on_update(World) { ... }
    virtual void on_draw(Window) { ... }
};

Which was nice, except for the fact that now the outside world would not even be able to know where a Human is positioned (it does not have access to its position member). That would be useful to track the player position for collision detection or if on_update the Zombie would want to track down its nearest human to move towards him.

So I added const Position& get_position() const; to both the Zombie and Human classes. And then I realized that both functionality were shared, so it should have gone to the common base class: Entity. Do you notice anything? Yes, with that methodology I would have a god Entity class full of common functionality (which is the thing I was trying to avoid in the first place).

Meaning of "hacks" in the implementation I'm referring to

I'm talking about the implementations that defines Entities as simple IDs to which components are dynamically attached. Their implementation can vary from C-stylish:

int last_id;
Position* positions[MAX_ENTITIES];
Movement* movements[MAX_ENTITIES];

Where positions[i], movements[i], component[i], ... make up the entity. Or to more C++-style:

int last_id;
std::map<int, Position> positions;
std::map<int, Movement> movements;

From which systems can detect if an entity/id can have attached components.

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:
Which part of the rendering pipeline compiles shaders? Generally, video games and other graphical software that use vertex and fragment shaders will have said shaders in the form of actual shader source code (typically in glsl or hlsl), and will compile them for use with the display hardware at runtime. (It is my understanding that shaders cannot really be precompiled into the game binary because the actual shader machine code that the display hardware uses depends on the graphics card brand and even its model/generation, and they may well be incompatible with each other.)

Even though I do myself work on the game programming field and use shaders, I actually don't know exactly which part of the graphics pipeline actually compiles the shaders into the machine code that the graphics card uses. Compiling shaders is essentially a black box: Throw the shader source code into whatever library you are using, and it does its magic behind the scenes.

I would be interested in knowing exactly where this compiling process happens. Which exact part of the entire system takes the shader source code and produces shader machine code from it?

My (wild) guess is that this is done by the graphics card driver (because the driver knows what kind of machine code it should output, and how to optimize it, for the particular brand and model of graphics card).

(If this is indeed so, it would explain at least partially why the graphics driver is so crucial in how efficiently games run, as its optimization of the shader machine code would have great impact on rendering speed.)

Are there any resources out there were I could find more info, in general, about these things?

sentences:
How can I set a Steam achievement in Steam via LibGDX or native Java? Is it possible to set or 'unlock' a Steam achievement via LibGDX or with a native Java solution?

If so, how it this possible. Furthermore, what would be a good implementation for 'saving' achieved achievements when you were offline. For example, when I enable the airsafe mode on my laptop and then run the game, be really good at it and unlock an achievement, how can it be saved the next time I have WiFi?

sentences:
Button not clickable if it's under a Content Size Fitter + Horizontal Layout Group in Unity? I'd like to make a Tooltip System/Tutorial System.
I'm using the Content Size Fitter and Horizontal Layout Group components to have a dynamic text bubble..
Also I'd like to attach a button to it,

so when the tooltip appears, the game pauses,

and then when the player clicks the button, it closes the tutorial text, resuming the flow of the game.

But for some reason the click doesn't reach the component. Not even the animation happen, like something is blocking my button from being clicked.
Hierarchy:

uiTutorialText

Has a CanvasGroup to fade the whole structure.

Interactable = true, BlocksRaycast = false

TutorialText

Has an Image (background)

RaycastTarget = false

Has a Content Size Fitter and a Horizontal Layout Group

And Text and Button are just simple plain Text and Button objects, and the Button's Interactable is true.
I also tried making the Button a child of Text, and then translating it sideways, so the button doesn't share screen space with the tooltip. But it's not clickable this way as well.
As soon as I move the Button out of the hierarchy, like directly under the canvas, it works.

sentences:
2D physics on game object made up of components Say you want to let your users create a 2D airship (side view) made up of components. One component could be a floating balloon, another could be a storage room, etc.

And say you want this airship to have physics applied to it as a whole, with each component playing a part in this. For example, balloons would take away from its down force and other compartments would apply down force to it.

At the same time, the whole airship works as a whole (or at least the only physical separation would be between floater components and the others, which apply weight), so physics are applied to it as if it was one body.

Now, how can this be managed? How can I customize a game object via a script, giving it different components with different weights, and have it behave like it was a single premade object?

I'm sorry if the question is simple, but I'm only getting started with unity. Thank you very much!

TL;DR: Customizable airship gameobject with different components that have different weights. How to make it behave as a single physics entity and manage its different components?

sentences:
How can I give the illusion of height to a ball in 2D? In 2D top down soccer games, sometimes a ball is given the illusion of being in the air, like below:

How can I achieve this?

sentences:
How to access material properties in metal shader I am struggling to find any clear information on how to access the properties of a material inside a metal shader, specifically the diffuse color.

My geometry sources are defined with vertices, normals and texture coordinates:

let sources = [SCNGeometrySource(vertices: vertices),
                   SCNGeometrySource(normals: normals),
                   SCNGeometrySource(textureCoordinates: textureCoordinates)]

let elements = meshIndices.map { SCNGeometryElement(indices: $0, primitiveType: .triangles) }

self.init(sources: sources, elements: elements)

Inside my shader I can access the vertex position and normal using the semantic attributes:

typedef struct {

    float3 position [[ attribute(SCNVertexSemanticPosition) ]];
    float3 normal [[ attribute(SCNVertexSemanticNormal) ]];

} Vertex;

Whilst SCNVertexSemanticColor is a valid attribute, these are not defined on a per vertex basis in my case with the color instead being derived from the diffuse property of the material attached to the shader program.

Is there a way to access the properties of the material attached to my geometry? I would assume that creating a struct and binding it to an input attribute is the correct way forward but I am unsure how these are surfaced to the shader.

typedef struct {

    float3 diffuse [[ materials? ]];//how to reference material.diffuse.contents?

} Material;

I assume that these properties must be available to the shader as everything is rendered as expected if you leave SceneKit to do its own thing. Do I need to bind these properties as uniforms myself or is there a specific argument I can use to access them?

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:
OpenGL shaders messed up So after a long attempt at DirectX I switched back to good old OpenGL. Now I'm running into this weird problem. My code involves shaders, of course, and drawing a basic cube. But I'm getting this weird shape. I've never seen this before. I was just wondering what could possibly be causing this? Thanks very much!

Initialization:

lightingShader->GenerateVAO();
lightingShader->GenerateVBO();

lightingShader->SetVertices(vertices, sizeof(vertices), GL_STATIC_DRAW);

lightingShader->BindVAO();
{
    lightingShader->AddAttribute(0, 3, GL_FLOAT, GL_FALSE, 3, 0);
}
lightingShader->UnbindVAO();

Rendering:

lightingShader->Use();

GLint objectColorLoc = lightingShader->GetUniformLocation("objectColor");
GLint lightColorLoc = lightingShader->GetUniformLocation("lightColor");

glUniform3f(objectColorLoc, 1, 0.5f, 0.31f);
glUniform3f(lightColorLoc, 1, 0.5f, 1);

GLint modelLoc = lightingShader->GetUniformLocation("model");
GLint viewLoc = lightingShader->GetUniformLocation("view");
GLint projLoc = lightingShader->GetUniformLocation("projection");

glUniformMatrix4fv(viewLoc, 1, GL_FALSE, glm::value_ptr(game_->GetCamera()->View()));
glUniformMatrix4fv(projLoc, 1, GL_FALSE, glm::value_ptr(game_->GetCamera()->Projection()));

lightingShader->BindVAO();
{
    glm::mat4 model;
    glUniformMatrix4fv(modelLoc, 1, GL_FALSE, glm::value_ptr(model));

    glDrawArrays(GL_TRIANGLES, 0, 36);
}
lightingShader->UnbindVAO();

Result:

As you can see, position and color is set fine, but I still get that weird shape.

sentences:
Flip x when direction of the movement changed in Unity What is the easiest and the most efficient way to flip x of the SpriteRenderer when direction of the movement changed in Unity?

I use Input.GetAxis() in order to get user input. When it returns 0 I would like to do nothing, when it returns positive number I would like to have x flipped in SpriteRenderer in one side and when number returned is negative another side.

So far I come up with a solution of using a variable which will be keeping the info about to which side the player is turned and flip x if necessary. But I am sure that this is not an efficient way to do it and even not a convenient one since my code will tend to become a lot bigger and messier.

sentences:
Unity 2D: Dealing damage when character is crushed between two solid objects Whats the best approach to dealing damage to a player when they get stuck between two solid objects? For instance, I'm trying to make moving platforms that the player can ordinarily touch. It's only when the player is caught in-between the moving platform and the ceiling, for example, that damage is dealt or the player dies.

So, what would be the best way to approach this? Thanks in advance!

sentences:
Unity3D - Determining if a spherical object is grounded using raycast I'm making a game revolving around moving a ball around a space. My game has a jump mechanic, so I need to know when I'm grounded in order to determine when I'm able to jump. Best way to check this is to setup raycast from ball's origin and make it constantly face downwards. However, I'm running into an embarrassing issue: the ball keeps rotating, so I'm not able to find a constant downward ray to use for finding the ground.

I started making code that looks similar to this, which the object's local transform:

bool grounded = false;
Ray ray = new Ray(transform.position, -transform.up);
RaycastHit hit;

if(Physics.Raycast(ray, out hit)){
//determine if object is on ground
grounded = true;
}

This caused the issue I stated earlier, where the ray would point downward but only relative to the object's current rotation. In other words, if the ball was upside-down, the ray would be pointing upwards.

My current code for this look similar to this, which now uses world space to determine what is 'down':

bool grounded = false;
Ray ray = new Ray(transform.position, -Vector3.up);
RaycastHit hit;

if(Physics.Raycast(ray, out hit)){
//determine if object is on ground
grounded = true;
}

However, in this instance, the ball raycast actually points directly to position Vector3(0,-1,0), which is even weirder than my initial problem and shouldn't be an issue based on other posts about this issue.

The only other way I can think of to properly determine whether the object is grounded is to see if it collides with anything. However, the other reasons I want to determine whether the player is grounded using raycast are:

for determining whether the player is over an endless pit (e.g. if they fell off the world) in order to start a kill/respawn timer
to ensure the player can perform a move equivalent to a butt stomp while in the air

If anyone knows how to perform a raycast on a spherical object in Unity, it's be much appreciated.

sentences:
Java - how to reduce iteration loops for enemies I have many places in my code where I'm iterating through the enemies array and it seems to me it could be optimised somehow, but I can't see how it can be done. For example these two loop checks:
private void arc1() {
    for (Enemy e : gs.getEnemies())
        if (e.distanceFromPlayer() < 32 && !e.seen) {
            arc1.setActive(true);
            return;
        }
    arc1.setActive(false);
}

private void arc2() {
    for (Enemy e : gs.getEnemies())
        if (e.distanceFromPlayer() < 24) {
            arc2.setActive(true);
            return;
        }
    arc2.setActive(false);
}

They're both just checking the distance from the player with one having an extra condition and a different distance. Is there a way to combine them into one? I tried doing it but it didn't work correctly.
Will it actually give any benefit performance wise to combine into one in any case? It does look like duplicate code but not sure if there would actually be any performance benefit.

sentences:
What is used for border parameter? I'm learning OpenGL and have a question. I read about Texturing and found border param in glCopyTexImage and glCompressedTexImage functions. In book: "OpenGL Programming Guide" wrote that border is reserved and must be zero? If it reserved why they place it into parameter?

P.S.: I have one idea, is it used for border texture? Like don't read data below that border, isn't it?

sentences: Using Steering Wheel in Unity Is there any way to use a steering wheel in Unity? All I find online is people with the same problem. The numbering on the axis are not the same as with keyboard input. In some cases left is 1 and as you turn it more to the left it gradually goes down to 0 even though you are still turning left

sentences:
Detecting Groups for Formations In Starcraft 2, unit formations are created when a "group" is generated from a command. Generally, the rules for a group are:

All units in the group are in the same spatial "clump".
All units in the group were given the same move command.
If any unit in the move command is not in the clump, the group is broken and units move towards the destination individually.

How do I define a clump programmatically and detect in a unit is not in the clump?

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:
FollowPath steering behavior I'm having a problem with AI movement in my top-down game. AI builds path and than moves using libgdx FollowPath (this problem is still actual) steering behavior. I have some solutions, but can't guess whitch is better(or I even need other solution). FollowPath params:

followp = new FollowPath<Vector2, LinePathParam>(this,
            new LinePath<Vector2>(path));
    followp.setPredictionTime(0.08f);
    followp.setArriveEnabled(true);
    followp.setArrivalTolerance(0.001f);
    followp.setDecelerationRadius(40f);
    followp.setTimeToTarget(0.1f);

Problem. Character doesn't move straightly according to the path - cuts corners through obstacles.
Solution 1. Find right proportion between character speed/acceleration, character size, obstacles size. Curent parameters: maxLinearSpeed = 100; maxLinearAcceleration = 150; maxAngularSpeed = 15; maxAngularAcceleration = 30; characterRadius=40; obstacleSize=120 (width and height). But if acceleration and speed are too big, character will move like "on rails" and even sticks on corners. Too small - character will be skidding.

Solution 2. Write own FollowPath steering behavior, whitch requires character to get close enough to every point of the path (without using predictionTime,that prevents sticking, but allows cutting corners) and using Arrive on every point of the path, that won't allow skidding.

Solution 3. Use RaycastObstacleAvoidance with FollowPath together(Priority steering). Here comes another problem: cause of raycasting character shakes (especially when it needs to turn around near wall or just target is near wall). Probably, it is solved by usage of lower angular acceleration (causes skidding).

sentences:
How to create a tile map texture in Oxygine? I started playing around with Oxygine and Ogmo last night when I stumbled upon this GitHub that read in the Ogmo level.

I ended up fixing the doRender method as it did not work (could just be due to it being an old version of Ogmo or something):

void OgmoLevel::doRender(const RenderState& rs) {
    auto tileLayers = this->tileLayers;
    Sprite sprite;
    for (size_t layerIndex = 0; layerIndex < tileLayers.size(); ++layerIndex) {
        auto tileLayer = &tileLayers.at(layerIndex);

        auto resAnim = project->resource->getResAnim(tileLayer->tileset->name);
        resAnim->getFrame(0).getDiffuse().base->setLinearFilter(false);

        sprite.setResAnim(resAnim);

        int gridXSize = tileLayer->definition->gridWidth;
        int gridYSize = tileLayer->definition->gridHeight;

        size_t columns = roomWidth / gridXSize;
        size_t rows = roomHeight / gridYSize;

        auto tiles = &tileLayer->tiles;
        size_t tilesSize = tiles->size();

        size_t i = 0;
        float yy = 0;
        for (size_t y = 0; y < rows; ++y) {
            float xx = 0;
            for (size_t x = 0; x < columns; ++x) {
                int tileID = tiles->at(i);
                if (tileID != OGMO_BLANK_TILE)
                {
                    int tWidth = tileLayer->tileset->tileWidth;

                    int actualRow = (tileID * tWidth / tWidth) / tWidth;
                    int actualColumn = (tileID - (actualRow * tWidth));

                    sprite.setColumnRow(actualColumn, actualRow);
                    sprite.setPosition(xx, yy);
                    sprite.render(rs);
                }

                xx += tileLayer->definition->gridWidth;
                ++i;
            }
            yy += tileLayer->definition->gridHeight;
        }
    }
}

The issue I see with this, is that the same exact rendering is happening every single frame. Normally for the tile maps, there are checks to determine whether or not the tile is on the screen. Now that is fine and all, but this time around, I know it is fully static 99% of the time and I want to render it to a texture and just continue to render that.

I've looked at the MemoryTexture and ImageData classes, but there wasn't really anything online I could find to tell me how to properly use them. Does anyone have any idea how I can achieve caching this?

(not enough rep to create proper tags)

sentences:
Infinite Jumper Snow Effect I wish to achieve a snowing effect on my game. The game is made in LibGDX and im using ParticleEmitter. I created a snow effect in ParticleEditor which consists in a line which spawns snow flakes. The problem is:

First, and the most important, since the game movement is vertical (its a jumper), if i just place the line above the screen, the jumping makes it look unnatural since when im jumping up, and the camera follows me, the particle emitter also has to move up, and the snow flakes are spawned with a bigger vertical distance; And when Im going down from the jump, a section of closer snowflakes is spawned due to that occurence. That makes the snow visually inconsistent.

Second, i wanted the snow to show up filling the screen from the start, instead of it starting to follow when the emitter is started.

To try to fix the first problem, i made the snow screen static, but it looks horrible, i really want the feeling that the snow is falling and my character is going up against it.

Any ideas how to achieve such an effect?

sentences:
Instantiating problems I'm beginner here, I'm trying to instantiate a single object every specific duration, either form the left of the screen or from the the right, at the same time I want this object to move to the other side of the screen

So the troubles I'm facing here are:

sometimes 2 objects are being instantiated at the same time.
the objects move in the direction that are defined in the first if statement (both objects on the left and the right move in one direction)

the part where I instantiate objects is in the script(smallFishes) that's attached to an empty gameobject is :

void Start () {
    timer = gameObject.AddComponent<Timer>();
    width = 2f;
    timer.Duration = 3;
    timer.Run();
    left = Resources.Load("Left") as GameObject;
    right = Resources.Load("Right") as GameObject;

}
void Update () {

    if (timer.Finished)
    {
        lr = Random.Range(1, 3);
        if (lr == 1)
        {
            var generetx = -8.8f - width / 2;
            Instantiate(left, new Vector2(generetx, Random.Range(-4.8f,4.8f)), Quaternion.identity);
        }
        else
        {
            var generetx = +8.8f + width / 2;
            Instantiate(right, new Vector2(generetx, Random.Range(-4.8f, 4.8f)), Quaternion.identity);
        }
        timer.Duration = 3;
        timer.Run();
    }

}
public int state
{
    get { return lr; }
}

the part where I make the object move from the script that's attached to the object prefab:

void Start () {
    small = gameObject.AddComponent<smallFishes>();
    rb2d = gameObject.GetComponent<Rigidbody2D>();
}

void Update()
{
    var fishes = GameObject.FindGameObjectsWithTag("small");
    if (fishes!=null)
    {
        if (small.state == 1)
        {
            moveright = new Vector2(4 * Time.deltaTime, 0);
            rb2d.AddForce(moveright, ForceMode2D.Impulse);
        }
        else
        {
            moveleft = new Vector2(-4 * Time.deltaTime, 0);
            rb2d.AddForce(moveleft, ForceMode2D.Impulse);
        }
    }
}

Thanks in advance.

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:
How do I implement a subclass of CCSprite? Can someone tell me how to subclass CCSprite on Android?

I've added this snippet of code into my CharacterSprite:

public static CharacterSprite sprite(String fileName) {
  return new (CharacterSprite)CCSprite(
    CCTextureCache.sharedTextureCache().getTexture(fileName)
  );
}

But getTexture() can't be found. Can someone help me please?

sentences:
2d array to calculate height for player in heightmap? I'm trying to work out how to do so my player position takes into the account of the floor so if I generate a floor that is hilly when I walk I won't walk through the heel. The problem is that I'm not sure how to do it.

I can do basic collision detection for walls. However, this isn't collision detection. I need the add the height of the terrain to the player.

So as you see the terrain is really a grid with 4 points making a face. So I can get the 4 points and work out. I can probably work this out on myself, but I was wondering if I should store say the heigh at (x,z) in a 2d array or do I just work out the height again everytime I move?

It just I use simplexnoise and I worry that this will be expensive to do every turn.

 import java.util.ArrayList;

    public class VoxelLevel
    {
    Mesh mesh;
    Material material;
    Transform transform;
    Shader shader;

    VoxelLevel(String textureName)
    {
        material = new Material(new Texture(textureName));
        transform = new Transform();

        shader = BasicShader.getInstance();

        generateLevel();

    }

    private void generateLevel()
    {
        ArrayList<Vertex> vertices = new ArrayList<Vertex>();
        ArrayList<Integer> indices = new ArrayList<Integer>();

        int sizeX = 10;
        int sizeZ = 10;
        int freq = 25;

        for(int x=-300; x<300; x+= sizeX)
        {
            for(int z=-300; z<300; z+=sizeZ)
            {
                indices.add(vertices.size()+0);
                indices.add(vertices.size()+3);
                indices.add(vertices.size()+2);
                indices.add(vertices.size()+0);
                indices.add(vertices.size()+1);
                indices.add(vertices.size()+3);

                vertices.add(new Vertex(new Vector3f(x,50+25*(float)(SimplexNoise.noise(x/freq, z/freq) + 0.25 * SimplexNoise.noise(2*x/freq, 2*z/freq)),z), new Vector2f(0.75f,0.75f)));
                vertices.add(new Vertex(new Vector3f(x+sizeX,50+25*(float)(SimplexNoise.noise((x+sizeX)/freq, z/freq) + 0.25 * SimplexNoise.noise(2*(x+sizeX)/freq, 2*z/freq)),z), new Vector2f(0.75f,1.0f)));
                vertices.add(new Vertex(new Vector3f(x,50+25*(float)(SimplexNoise.noise(x/freq, (z+sizeZ)/freq)+ 0.25 * SimplexNoise.noise(2*x/freq, 2*(z+sizeZ)/freq)), z+sizeZ), new Vector2f(1.0f,0.75f)));
                vertices.add(new Vertex(new Vector3f(x+sizeX,50+25*(float)(SimplexNoise.noise((x+sizeX)/freq, (z+sizeZ)/freq)+ 0.25 * SimplexNoise.noise(2*(x+sizeX)/freq, 2*(z+sizeZ)/freq)),z+sizeZ), new Vector2f(1.0f,1.0f)));
            }
        }

        Vertex[] vertArray = new Vertex[vertices.size()];
        Integer[] intArray = new Integer[indices.size()];

        vertices.toArray(vertArray);
        indices.toArray(intArray);

        mesh = new Mesh(vertArray, Util.toIntArray(intArray));
    }

    public void input()
    {

    }

    public void update()
    {
        //SimplexNoise.noise(0.25, 0.25);
        //SimplexNoise.noise(0.35, 0.65);
        //SimplexNoise.noise(0.254, 0.225);
        //SimplexNoise.noise(0.254, 0.215);
    }

    public void render()
    {
        shader.bind();
        shader.updateUniforms(transform.getTransformation(), transform.getProjectedTransformation(), material);
        mesh.draw();
    }

}

sentences:
Taking fixed direction on hemisphere and project to normal (openGL) I am trying to perform sampling using hemisphere around a surface normal. I want to experiment with fixed directions (and maybe jitter slightly between frames). So I have those directions:

vec3 sampleDirections[6] = {vec3(0.0f, 1.0f, 0.0f),
                            vec3(0.0f, 0.5f, 0.866025f),
                            vec3(0.823639f, 0.5f, 0.267617f),
                            vec3(0.509037f, 0.5f, -0.700629f),
                            vec3(-0.509037f, 0.5f, -0.700629),
                            vec3(-0.823639f, 0.5f, 0.267617f)};

now I want the first direction to be projected on the normal and the others accordingly.

I tried these 2 codes, both failing.
This is what I used for random sampling (it doesn't seem to work well, the samples seem to be biased towards a certain direction) and I just used one of the fixed directions instead of s (here is the code of the random sample, when i used it with the fixed direction i didn't use theta and phi).

vec3 CosWeightedRandomHemisphereDirection( vec3 n, float rand1, float rand2 )
    float  theta = acos(sqrt(1.0f-rand1));
    float  phi = 6.283185f * rand2;

    vec3 s = vec3(sin(theta) * cos(phi), sin(theta) * sin(phi), cos(theta));

    vec3 v = normalize(cross(n,vec3(0.0072, 1.0, 0.0034)));
    vec3 u = cross(v, n);
    u = s.x*u;
    v = s.y*v;
    vec3 w = s.z*n;

    vec3 direction = u+v+w;
    return normalize(direction);
}

** EDIT **

This is the new code

vec3 FixedHemisphereDirection( vec3 n, vec3 sampleDir)
{
    vec3 x;
    vec3 z;

    if(abs(n.x) < abs(n.y)){
        if(abs(n.x) < abs(n.z)){
            x = vec3(1.0f,0.0f,0.0f);
        }else{
            x = vec3(0.0f,0.0f,1.0f);
        }
    }else{
        if(abs(n.y) < abs(n.z)){
            x = vec3(0.0f,1.0f,0.0f);
        }else{
            x = vec3(0.0f,0.0f,1.0f);
        }
    }

    z = normalize(cross(x,n));
    x = cross(n,z);

    mat3 M = mat3(  x.x, n.x, z.x,
                    x.y, n.y, z.y,
                    x.z, n.z, z.z);
    return M*sampleDir;
}

So if my n = (0,0,1); and my sampleDir = (0,1,0); shouldn't the M*sampleDir be (0,0,1)? Cause that is what I was expecting.

sentences: Is there a good cross-platform C++ vector graphics library out there? I'm making a game and want to use vector graphics. I started re-coding it using Cairo and the performance is horrific. So, I'm looking for a different library. It needs to be for C++ and cross-platform (e.g. no Direct2D). There's another question someone asked before like this, but there weren't any suitable answers. There's got to be something...?

sentences:
Is there a way to layer 2D assets in Unity while maintaining correct player clipping? I'm working on a 2D top-down game, currently building a scene where I want to place one asset on top of another (lamp on top of table).
Game objects are all on the same layer as the player so that the player clips accordingly when moving in front or behind an object, based on the pivot location on the y axis.
The easiest solution would be to adjust the 'Order in layer', setting the lamp asset to 1 instead of 0 so that it sits above the table. However, this interferes with player clipping in game, causing the lamp to always be in front of the player.
It's making it impossible to build custom scenes on the fly inside Unity as I am unable to arrange assets in the correct order using layers whilst maintaining player interactions such as clipping.
Does anyone know of a solution for this issue?

sentences:
Negamax for turn based game I am working on a fast paced turn based game, each turn the player can move left, right or stay put and choose whether or not to fire. Each turn the shots move one block in the direction they are pointing.

I would like to implement NegaMax on this game for curiosity's sake.

Could anyone recommend a brilliant tutorial they tried and found satisfactory?

Thanks

sentences:
How can I add two Vector3 directions together? I have a direction to my target object, which is in a Vector3 format. I want cast a number of rays, as offsets from this initial direction.

X is the object. D is the direction the player needs to travel in. A & C are other directions that I want to cast rays towards to check for impacts.

A    D    C
 \   |   /
  \  |  /
   \ | /
    [x]

I was trying to add an offset, such as Vector3.Right to the Direction and then normalise the result, however this only works if everything is oriented towards World Space.

So how can I convert and add a direction (Vector3.right) as an offset to an existing direction?

I'm fairly sure I just have World Space and Local Space directions mixed up but can't see an easy way to convert between this with Vector3?

sentences:
Draw a sprite when a key is pressed in LibGDX I'm working with LibGDX. How can I draw a sprite when a key is pressed? I have tried with the following, but it doesn't seem to work.

if (Gdx.input.isKeyPressed(Input.Keys.X)) {
    batch.begin();
    sprite.draw(batch);
    batch.end();
}

sentences:
What tools are available for developing 2D games like Tetris or Angry Birds for Android? I would like to ask the following regarding developing Tetris- and Angry Birds-like 2D games for Android:

Is Java the official development language for Android?
What free or commercial Android development environments (like Xcode is for iOS) are available?
What open source game development engines, like cocos2D, are available for Android?
Are there any great tutorials available for developing such games?

sentences:
How to play and pause animation I want to make play and pause buttons to play and pause sound and also I want it to play and pause animation ,how should I do that?

//function
 public void TogglePlay()
    {
        if (audio.isPlaying)
        {
            audio.Pause();
        }
        else
        {
            audio.Play();
        }
    }

sentences:
How to change the mesh of the character in UE4? I made a Bellsprout mesh in Blender, exported it as an FBX file, and imported it into UE4.

I can insert it in the stage without problem, but I would like to use this Bellsprout mesh to replace the mesh of the built-in character.

Even clicking and dragging will not replace the mesh:

I've looked into importing between blender/UE4: https://wiki.unrealengine.com/Static_Mesh_from_Blender

And also about mesh editing: https://docs.unrealengine.com/en-us/Engine/Content/Types/StaticMeshes/Editor

I also looked at some questions in this forum: Changing rendering in UE4 and Making only parts of a mesh destroy in UE4

To see if the question had not already been asked.

sentences:
Best way to distribute graphics, audio and levels with an SDL game? I'm working on finishing up a game written in C++ with SDL I've been working on for awhile, and I'm starting to ponder how I'm going to distribute it. It has hundreds of images that are loaded and used throughout the game, as well as a couple dozen .wav files for audio effects.

What is the best way to distribute these? Should I just include the folders with all the files? Or is there a way I can package them into a single file, then open and extract them in my application?

What's the best way to go about this?

sentences:
When I add UPROPERTY or UFUNCTION to TEnumAsByte the compiler throw a link error FootstepSound.h
#pragma once

#include "CoreMinimal.h"

#include "Sound/SoundCue.h"

#include "FootstepSound.generated.h"

UCLASS(Blueprintable)
class MyProject_API UFootstepSound : public UObject
{
    GENERATED_BODY()

public:

    UFootstepSound();
    ~UFootstepSound();

    UFUNCTION()
        FORCEINLINE TEnumAsByte<enum EPhysicalSurface> GetPhysicalMaterial() const { return this->vPhysicalMaterial; }

    UFUNCTION()
        FORCEINLINE TArray<USoundCue*> GetLeftStepSound() const { return this->sLeftSteps; }

    UFUNCTION()
        FORCEINLINE TArray<USoundCue*> GetRightStepSound() const { return this->sRightSteps; }

    UFUNCTION()
        FORCEINLINE TArray<USoundCue*> GetJumpSound() const { return this->sJump; }

    UFUNCTION()
        FORCEINLINE TArray<USoundCue*> GetSprintingSound() const { return this->sSprinting; }

    UFUNCTION()
        FORCEINLINE float GetWalkVolume() const { return this->fWalkVolume; }

    UFUNCTION()
        FORCEINLINE float GetSprintVolume() const { return this->fSprintVolume; }

    UFUNCTION()
        FORCEINLINE float GetCrouchVolume() const { return this->fCrouchVolume; }

private:

    UPROPERTY(EditDefaultsOnly)
        TEnumAsByte<enum EPhysicalSurface> vPhysicalMaterial;

    UPROPERTY(EditDefaultsOnly)
        TArray<USoundCue*> sLeftSteps;

    UPROPERTY(EditDefaultsOnly)
        TArray<USoundCue*> sRightSteps;

    UPROPERTY(EditDefaultsOnly)
        TArray<USoundCue*> sJump;

    UPROPERTY(EditDefaultsOnly)
        TArray<USoundCue*> sSprinting;

    UPROPERTY(EditDefaultsOnly)
        float fWalkVolume = 0.2f;

    UPROPERTY(EditDefaultsOnly)
        float fSprintVolume = 0.5f;

    UPROPERTY(EditDefaultsOnly)
        float fCrouchVolume = 0.1f;
};

FootstepSound.cpp
#include "Character/Sound/FootstepSound.h"

UFootstepSound::UFootstepSound() {}

UFootstepSound::~UFootstepSound() {}

When I add to TEnumAsByte<enum EPhysicalSurface> UPROPERTY() or UNFUNCTION() the compiler throw a link error (unresolved externals), if I remove UFUNCTION() and UPROPERTY() on TEnumAsByte<enum EPhysicalSurface>, compile completing without any errors. Idk how fix this. On others properties or functions UPROPERTY() and UFUNCTION() works fine

sentences:
Unity Raycasting only hitting mesh colliders from particular directions I have a game which involves clicking to select some objects. Each of the objects has a mesh collider attached to it so that objects can be clicked, handled by the following:

if (Input.GetMouseButtonDown(0)){ // if left button pressed...

    // Find hit object
    Ray ray = task_scene.main_camera.ScreenPointToRay(Input.mousePosition);
    RaycastHit hit;
    if (Physics.Raycast(ray, out hit)){
        execute_some_function();

    }
}

Now this works fine when I run the game in the editor. However, when I build and run in the browser some objects are not being selected when clicked, and it seems to be objects that are created from particular meshes.
I have tried:

changing the mesh import settings to generate colliders but this doesn't seem to do anything
changing Prebake Collision Meshes in build settings, which again doesn't solve the problem
Changing mesh collider cooking option to both 'everything' and 'none'
Setting 'Queries Hit Backfaces' to true in physicsmanager settings
making setting the meshes to convex, which does then work in the build but is not ideal.

EDIT: I've noticed that the raycasting is actually working for the problem objects but only from particular directions. Is this because, according to the manual: 'Faces in collision meshes are one-sided. This means objects can pass through them from one direction, but collide with them from the other.'

Any thoughts on what might be causing this?

sentences:
Change button sprites in scrollview Unity3D_5.2 I have a scroll view with lots of buttons on it. when i press one button, that button needs to change the sprite and stay like that. if any other button (or same one) is pressed previous button needs to revert back to original sprite..
here is some example

button 2 was pressed and changed sprite, it stays like that untill it is pressed again or any other (in this case button 3) is pressed

sentences:
Picking up items and references Just a heads up, I'm sure there are much more efficient ways to do what I'm trying to do. I've even thought of some myself. However, at the moment, I'm mostly interested in getting this code to work. I think I understand exactly why it doesn't work, but I'm not sure how to fix it.

Firstly, there is an ItemPickupTrigger script attached to the drop prefab. The purpose of this script is simply to modify a variable's truth value depending on whether or not the player is in range. This script must be attached to the drop prefab because it uses OnTriggerEnter/OnTriggerExit. No problem here.

Secondly, there is a pretty standard EnemyDrops script.

public class EnemyDrops : MonoBehaviour {

    private EnemyHealth enemyHealth;

    public GameObject dropPrefab;

    private float randomNumber;

    public bool objectDropped;
    private bool numberGenerated;

    public GameObject drop;

    // This is the correct offset for enemies' current y-position of 1.083333
    private Vector3 dropPositionOffset = new Vector3(0f, -0.958333f, 0f);

    void Start()
    {
        enemyHealth = GetComponent<EnemyHealth>();
    }

    void Update()
    {
        if (enemyHealth.isDead && !objectDropped && !numberGenerated) {

            randomNumber = Random.value;
            numberGenerated = true;

            if (randomNumber <= 1.0)
            {
                DropObject();
            }
        }
    }

    private void DropObject()
    {
        objectDropped = true;

        drop = GameObject.Instantiate(dropPrefab, transform.position + dropPositionOffset, Quaternion.identity);
    }
}

It drops the object where the enemy has been killed. This script is attached to each enemy. As it's currently set up for testing purposes, an item will always drop. I'm sure there are better ways to do this, but it works, so no problem here.

Finally, there is an ItemPickup script attached to an ItemController object which is otherwise pretty empty. I'm not even really sure why I decided to do it this way, I just thought that it might be better for things I wanted to do in the foreseeable future to not have this script attached to each enemy. Now get ready because the code below is problematic.

public class ItemPickup : MonoBehaviour {

    private GameObject pickupWindow;

    private bool windowOpen;

    private GameObject drop;
    private ItemPickupTrigger itemPickupTrigger;

    void Start()
    {
        pickupWindow = GameObject.Find("Pickup Window");
        pickupWindow.SetActive(false);

        drop = GameObject.Find("Drop");
        itemPickupTrigger = drop.GetComponent<ItemPickupTrigger>();
    }

    void Update()
    {
        if (Input.GetKeyDown(KeyCode.R) && itemPickupTrigger.playerInRange && !windowOpen) {
            pickupWindow.SetActive(true);

            windowOpen = true;
        }
        else if (Input.GetKeyDown(KeyCode.R) && windowOpen)
        {
            pickupWindow.SetActive(false);

            windowOpen = false;
        }
    }
}

For starters, it only works if there is a drop object already present when the script begins, but there shouldn't be a drop object then. Second, if I don't set the reference there, I'm not sure how to set itemPickupTrigger's reference, since I'm using it in update and need the reference set before then. Make a function called SetReferences() and call it early in Update()? Yeah, I'm pretty lost. Basically, I want to be able to open the "loot window" near any instantiated drop object in the game. Currently, that functionality only in a limited capacity (either only on a "preexisting" drop object in the scene or on one random instantiated drop object(?) depending on how I have been modifying the code). Help!

sentences:
One index buffer with multiple vertex buffers? I noticed that there's IASetVertexBuffers() to set multiple vertex buffers at once but there's only IASetIndexBuffer() to set one index buffer. So I assume that I can simultaneously only have one index buffer set but I can have multiple vertex buffers set at the same time.

Is that correct?
How do I use index buffer with multiple vertex buffers? I.e. what indices do I provide to use more than one vertex buffer and how do I know what buffer conrete indices refer to?

Or is this used only in the case when instead of interleaved vertex data: (Pos, Normal, Pos, Normal, Pos, Normal) I provide the data in multiple buffers: (Pos, Pos, Pos) (Normal, Normal, Normal) and conrete indices refer to the same vertices in each buffer?

sentences:
How to prevent unwanted scaling of textures in world space I allow players to select buildings of different sizes in my game, in the image below is a building that is 30x30 units and one that is 10x10 units.

To indicate that the building is selected, I added a child called Selection indicator, this child is simply a texture dragged into the scene, which creates a plane. I activate/deactivate this on select/deselect.

So far so good, but as you can see in the image, in order to match the different sizes, I need to scale the Selection indicator, which distorts its edges. Simply using sprite editor here does not seem to change anything since it's in world space.

How could I approach this in a way that the frame for my Selection indicator does not stretch like in the image?

sentences:
How to Slice the external Spritesheet programmatically by using C# in Unity I have a sprite sheet like this:

I am using Unity Engine to develope my game. I would like to load this external spritesheet outside and slice it as Grid type programmatically instead of using Sprite Editor in Unity.
I would like to find a way to do it by using C# scripting. Because my game would have more than 5 heroes with 10 animations per hero for next updates in my game.

sentences:
How can I detect mouse events on sprites in a canvas? I'm making an HTML 5 game. I want mouse clicks on sprites drawn in a canvas element cause events that my code can react to. At the moment, I'm doing it by checking through all of my sprites in a for-loop on each click.

Is there a way to do that by adding an event listener to a sprite so it would respond just like that?

Are Javascript's custom events useful in this situation? I know it's possible with KinectJS, but I don't have any experience with it and really I'd like to learn how to do this myself without the help of a library.

sentences:
Referencing a Text in Unity Error I am working on trying to add a coin system to my game. I have it setup right now so that when the player hits a coin the score text goes up by 1. I have setup a reference in the script, which is attached to the coin, to the score text in my scene. In the game the player can click a button that will switch between two lanes to avoid enemies. These lanes are infinte and in these lanes is where I put the coins. And when a new lane is created the reference to the text disappears from the coin and teh tect does not change. I am not sure why the reference is disappearing.

Here is the coin script that is on the coin

public int scoreToGive = 1;

public Text coinText;

void OnTriggerEnter2D(Collider2D other)
{
    if(other.gameObject.tag == "Player")
    {
        AddScore();
    }
}

public void AddScore()
{
    TheScore.theScore++;
    if(coinText != null)
    {
        coinText.text = TheScore.theScore.ToString();
    }

    Destroy(gameObject);
}

void Update()
{
    coinText.text = GameObject.FindGameObjectWithTag("Ui").ToString();
}

}

Thanks to anyone who can help!

sentences:
simple adventure game mechanics stored in database I plan to code a little adventure-like game. To be able to build multiple episodes without deploying new code I want to store any information possible in the database.

This includes stuff like

  if player examines item [cell phone], the contact [xxx] is added into his phone book and the item [cell phone] is replaced by [old nokia phone with scratches]

So something like "SCUMM lite".

Of course, [cell phone], [xxx] and [old nokia phone with scratches] are objects that already exist in the database. But while [cell phone] is of type [inventory-item], [xxx] is of type [contact], so there can't just be no simple link between some database-tables

I got a very basic idea about how I could achieve this but wonder if anyone has done that before and can give me a hint or even best practice

sentences:
Making a scriptable dynamic Distance Joint in Unity I have 2 2D RigidBodies that are connected together using a Distance Joint 2D...

I update the distance of said Distance Joint 2D (using a script) expecting the distance between the two RigidBodies to change, but nothing actually happens.

I'm guessing this is to do with the Physics engine not updating the positions of the RigidBodies?

sentences:
Method of terrain in a 3d RPG I am working on a RPG using the JMonkey engine. While I was conceptualizing the map, I realized I would have a problem with the terrain.

My problem is this: I want to have a click to move interface, and have the player move in increments of 1 world unit (wu). This is actually rather reminiscent of a tile based engine, but in 3d. While making the world map, do I need to make an object made of the world geometries, and load the one object, or would it be better to build a map out of the necessary tiles, using a file to tell the engine how to build the map (similar to 2d tile games)?

I might also add, the game isn't going to use heavy collision detection or real time physics, which is why I thought a tile based "pass-abilty" system might work.

Would loading that many objects for a tile be too much as far as memory goes? What if I make a single object, constructed of tiles by a definition file, and just make the player move in 1 wu increments, giving the illusion of "tile-based"?

I'm assuming that a combination of any of these might work, it's just that I don't have any prior experience making a system like this and would like some opinions on the most efficient method of doing what I'm trying to do.

sentences:
How to get image component from blueprint in c++ I have a dialog screenwith character icon and I need to be able to set up this image in code. But I don't know how to access this Image component (I put material instances in it).

.h

UPROPERTY(EditAnywhere) TSubclassOf<UUserWidget> widgetDialogBottom;
UUserWidget* widgetDialogBottomInstance;

.cpp

widgetDialogBottomInstance = CreateWidget<UUserWidget>(GetWorld(), widgetDialogBottom);
widgetDialogBottomInstance->Image("mi_dialog_2"); // Need something like this
widgetDialogBottomInstance->AddToViewport();

I made a class DialogBottomWidget:

.h

UCLASS()
class HOME_API UDialogBottomWidget : public UUserWidget
{
        GENERATED_BODY()

    public:
        void SetImage(UTexture2D* InTexture);

    private:
        UPROPERTY(meta = (BindWidget)) UImage* CharacterPreview;
};

.cpp

#include "DialogBottomWidget.h"

void UDialogBottomWidget::SetImage(UTexture2D* InTexture)
{
    CharacterPreview->SetBrushFromTexture(InTexture);
}

.. and then I made a blueprint based on that class. What should I do now?

I can get reference to image MaterialInstanceConstant'/Game/Materials/Faces/mi_dialog_2.mi_dialog_2', but how to put it to image component of the blueprint?

sentences:
Picking a 2D Box Collider with the mouse in Unity I have a scene with a bunch of 2D doors that have 2d Box Colliders (no trigger) on them and that live on a Canvas.  I would like to be able to click on them with the mouse, but have had no luck.

Following this earlier topic: (2D) Detect mouse click on object with no script attached , I did the following:

    if (Input.GetMouseButtonDown(0))
    {
        Ray ray = Camera.main.ScreenPointToRay(Input.mousePosition);
        RaycastHit2D hit = Physics2D.Raycast (ray.origin, ray.direction, Mathf.Infinity);
        if (hit)
        {
            Debug.Log(hit.collider.gameObject.name);
        }
    }

However, (hit) is always null.  I have no RigidBody2D objects in my scene, because I only need mouse selection, not any interaction between objects.

In the inspector I the green box collider but clicking within it in the scene (not the inspector, obviously) runs the MouseButtonDown() code but still no Raycast hit.

What else could I be missing?

To reduce this to its simplest, you can do the following:

Create a new 2D scene with a canvas
Add two 100x100 Images to the Canvas
Add a Boxcolllider2D to each image
Now what script is required to detect mouse clicks within them?

sentences:
Can't open scripts in Unity 2019.2.11.f1 version I'm using Visual Studio 2017, Unity Hub to 2.1.3 and just created a project using Unity's 2019.2.11.f1 version.

Once trying to open a script in Unity, it doesn't open and then I'm forced to use Task Manager to End Unity's task because can't even close it normally due to not being able to interact with the screen. No errors or warnings, VS doesn't open, can't interact with Unity anymore.

This doesn't block me from working, it just isn't as convenient as before.

sentences:
android game development using unity 3d I want to learn android game development. I dont have any programing knowledge. So should I learn JAVA and eclispe to develop games for android.

Or should I learn Unity 3d. And is knowledge of java programing is necessary to develop android games in unity? Or knowledge of Javascript/UnityScript will do. Can I develop android games in unity with just JavaScript knowledge??

what are the benefits of unity over Java/eclipse and vice versa when talking of android game dev??

sentences:
Problem designing my pseudo-3D game with SFML I am designing the game so the objects I create (Character, Enemy, Enemycast...) can inherit all from

Collider
SpineDrawable // Sprite // AnimatedSprite
D2D // D3D

Both D2D and D3D inherit from virtual sf::Drawable. D3D also is supossed to apport the functionality of an additional axis. When the object is drawed in screen, the object is scaled and repositioned in (X, Y) with some calculations.

Collider inherits from D3D, because all my colliders are going to have 3 axis, and it creates its own AABB box from D3D interface -to be implemented by the graph type Sprite//SpineDr...-.

I am trying to have two vectors to hold all my graphics, std::vector<D2D*> and std::vector<D3D*>, because the D3D ones will need to be sorted depending on their float z.

The problem arise because D2D///D3D classes inherit virtual sf::Drawable, and I am using my class Sprite inheriting from sf::Sprite, which inherit sf::Drawable as non-virtual function from in Sprite.hpp of SFML.

So I got two questions

Must I rewrite my sprite function in lower level, so it can inherit sf::Drawable as virtual?
I think my design is poor. Which alternatives are there instead of creating two separated lists of sf::Drawable/s to order the ones which have 3 axis?

sentences:
The View-Matrix and Alternative Calculations I'm working on a radiosity processor in DirectX 9. The process requires that the camera be placed at the center of a mesh face and a 'screenshot' be taken facing 5 different directions...forward...up...down...left...right...

...The problem is that when the mesh face is facing up( look vector: 0, 1, 0 )...a view matrix cannot be determined using standard trigonometry functions:

Matrix4 LookAt( Vector3 eye, Vector3 target, Vector3 up )
    {
        // The "look-at" vector.
        Vector3 zaxis = normal(target - eye);
        // The "right" vector.
        Vector3 xaxis = normal(cross(up, zaxis));
        // The "up" vector.
        Vector3 yaxis = cross(zaxis, xaxis);
        // Create a 4x4 orientation matrix from the right, up, and at vectors
        Matrix4 orientation =
        {
            xaxis.x, yaxis.x, zaxis.x, 0,
            xaxis.y, yaxis.y, zaxis.y, 0,
            xaxis.z, yaxis.z, zaxis.z, 0,
            0,       0,       0,     1
        };

        // Create a 4x4 translation matrix by negating the eye position.

        Matrix4 translation =
        {
            1,      0,      0,     0,
            0,      1,      0,     0,
            0,      0,      1,     0,
            -eye.x, -eye.y, -eye.z,  1
        };
        // Combine the orientation and translation to compute the view matrix
        return ( translation * orientation );
    }

The above function comes from http://3dgep.com/?p=1700...

...Is there a mathematical approach to this problem?

sentences:
What's so different/complicated/useful about vectors? Forgive me if this isn't considered a real question, but it is something I am genuinely confused about.

I constantly hear other game developers talk about how using vectors are very useful, but also how everyone is intimidated by vector math and vectors can seem daunting. I have never got around to learning about them.

So, finally I looked Vector on Wikipedia, and I was surprised. Unless I am somehow mistaken, a vector(for sake of simplicity, say it's 2D), is just an x and y coordinate.  If I have misunderstood, please correct me.

So here is my question: doesn't that mean that any representation of two(or three) dimensional coordinates is a vector? If so, then a vectors and coordinates are the same thing. And it's pretty much impossible to create a game without using coordinates, so how are vectors confusing or new to someone who has done any amount of game programming?

This is something I could use some clarification on. Any help is appreciated.

sentences:
i want to move arrow by dragging and than want to toss/throw when i give swipe event In My Application I Have One Arrow Image With Fix Center and i Can rotate it by touch move method on same center but i also need to Toss/trow the arrow after doing some rotation with dragging or without doing that
   How Can I Put The Toss/Throw Action  in MyApplication

Thank You Very Much In/ advance

sentences:
How can I remove sprites when they are outside viewport, but then add them again if I return to their location to save memory I'm creating an open-world RPG like Neverwinter nights. But I’m worried about memory and am afraid if I just populate a huge world with physics based sprite nodes, I won't have any memory for anything else.

The method I thought of is to remove the sprites when they go far outside of the viewport and then re-add those sprites when I get close to their location.

How could I accomplish this?

sentences:
OpenGL concatenate vertex data into one big VBO I successfully can render two triangles (with a texture) that looks like the side of a crate and also "walk" around it.
Also, a small .obj file parser is available which gives me a float array of the vertices, texture coords and an unsigned int array of the indices (of a simple cube).

The vertices and texture coords look like the following:

float vertices[] =
{
     // positions         // texture coords
     0.5f,  0.5f, 0.0f,   1.0f, 1.0f,
     0.5f, -0.5f, 0.0f,   1.0f, 0.0f,
    -0.5f, -0.5f, 0.0f,   0.0f, 0.0f,
    -0.5f,  0.5f, 0.0f,   0.0f, 1.0f
};

And the indices:

unsigned int indices[] =
{
    0, 1, 3, // first triangle
    1, 2, 3  // second triangle
};

To assign the vertices and tex coords I use the following:

unsigned int VBO;
glGenBuffers( 1, &VBO );
glBindBuffer( GL_ARRAY_BUFFER, VBO );
glBufferData( GL_ARRAY_BUFFER, 5 * 4 * sizeof( float ), vertices, GL_STATIC_DRAW );

Creating an IBO

call glEnableVertexAttribArray()
glVertexAttribPointer()

Creating a shader, a texture etc.. and draw it with glDrawElements().

This works all very well, I just can't wrap my head around how to use just a single VBO with the "split" data that my .obj parser gives back.
I now (when using the .obj parser) have the vertices and texture coords separated; how do I put that two arrays into one VBO?

The picture I have in mind is to have fewer draw calls and also prevent redundant code if I, for example, use the same model for 100 times.

sentences:
Non-invocable memeber 'Text.text' can not be used as a method Trying to change text in a text box, and have multiple lines on it, i found something online talking about "\n" but this came up.

Non-invocable memeber 'Text.text' can not be used as a method.

This is my code
private void Start()
{
    if (creditEnding)
    {
        startText.text("You, died? \n well you should get some sleep anyways");
    }
}

sentences:
Having trouble writing a controller class Okay so I'm writing a controller class to expand the SFML joystick library capabilities.  Since the different controllers I want to use for this game have different integer values mapped to different buttons, I want to be able to pass integer values to the class to map these values to buttons I have defined.  As well, SFML can detect whether a button is pressed with sf::Joystick::isButtonPressed(unsigned int joystick, unsigned int button).  However, this only detects if a button is currently pressed and thus holding the button will just register as repeated presses.  So I wrote my own code to detect for a button press without a hold.

So here's the issue: What is the proper way for the player (outside the class) to access the set of buttons without exposing data?  I could have getters for the buttons, but then the buttonPressed method couldn't change the value of held.  The only way I could see this working is if I gave full access to the Button's.  Or should I go about this a different way?  Any help would be greatly appreciated.  Here's the relevant code:

// Controller.h

class Controller
{
public:
    struct Button
    {
        unsigned int id;
        bool held;
    };

    // constructor which assigns a controller ID
    // and a set of buttons
    Controller(...);

    // Checks each frame for each button if
    // any are not held and sets held to false
    void update();

    bool buttonPressed(Button& button);
private:
    unsigned int controllerId_;
    Button A_, B_, X_, Y_, Z_, R_, L_,
    START_, D_PAD_UP_, D_PAD_LEFT_, D_PAD_DOWN_, D_PAD_RIGHT_;
};

// Controller.cpp

bool Controller::buttonPressed(Button& button)
{
    if (sf::Joystick::isButtonPressed(controllerId_, button.id) && !button.held)
    {
        button.held = true;
        return true;
    }
    else
    {
        return false;
    }
}

sentences:
Can I export a model and texture from a terrain file built in Unity3D? I am mostly familiar with building my level maps within unity, and have become quite use to its inbuilt terrain creator, in both generating my terrain, and spraying a texture on to it.

I am making a game using MonoGame XNA, and would like to use a terrain map I built with Unity. I would have to recover the file, however, and have not been able to find anything to support being able to, in the first place.

Can I export my terrain file with its texture, in any way, to use in XNA MonoGame?

sentences: Can I use models of real cars with logos removed to avoid copyright infringement? My friends and I have recently started making a video game. We were going to make it an open world simulator, but can't figure out if using real cars with the real logos is copyright infringement. How can we stay on the right side of the law here?

sentences:
Switching to a vertex shader TL;DR I need to switch from a vertex array passed to the pixel shader with a real vertex shader approach.

In my prototype, the terrain is procedurally generated and I have the following result:

The terrain vertices are passed directly to the pixel shader through an array:

//Number of vertices in terrain array
static const int verticesCount = 20;

//The vertices array, in pixel coordinates
float2 terrain[verticesCount];

//A fixed distance between neighbor vertices
float fixedDistance;

float4 PixelShaderFunction(float2 pixelCoords : VPOS,
                           float2 textureCoords :TEXCOORD0) : COLOR0
{
    float4 color = tex2D(s0, textureCoords);
    int i = pixelCoords.x / fixedDistance;
    float delta = (pixelCoords.x - terrain[i].x)/(terrain[i+1].x - terrain[i].x);
    if(smoothInterpolate(terrain[i].y, terrain[i+1].y, delta) >= pixelCoords.y)
    {
        color.rgba = 0;
    }
    return color;
}

As you can see I just interpolate between the vertices and mask the texture to the terrain.

Now I need a different approach because I'm using a view matrix for the camera and it does not affect these vertices that do not go through the vertex shader, how can I replace the terrain array with a vertex shader to get a similar result?

All suggestions are welcome!

sentences:
Parent and child with different Animators I'm animating my 2D game (Unity 5.4).

Is it a good/bad practice to have parent and child gameobjects with different Animators?

Example: a 2D bug, that has sprites for every body part. On the "body container"=parent object I add an Animator and animate all parts except the head. For the head, that is a child gameobject to the body (in scene's hierarchy) I want to add a separate Animator and animate only the head.

Also is that influencing performance in any way?

sentences:
Convert quaternion to a different coordinate system OSVR has a right-handed system: x is right, y is up, z is near.

I need to convert orientation data from a sensor in OSVR to a different right-handed system in which x is forward, y is left, and z is up.

I need to calculate the transformation that will convert a quaternion from one system to the other.

I naively tried:

void osvrPoseCallback(const geometry_msgs::PoseStampedConstPtr &msg) { // osvr to ros
    geometry_msgs::PoseStamped outputMsg;

    outputMsg.header = msg->header;
    outputMsg.pose.orientation.x = msg->pose.orientation.y;
    outputMsg.pose.orientation.y = msg->pose.orientation.z;
    outputMsg.pose.orientation.z = msg->pose.orientation.x;
    outputMsg.pose.orientation.w = msg->pose.orientation.w;

    osvrPosePub.publish(outputMsg);
    ros::spinOnce();
}

But that made things really weird. Facing north pitch is pitch, facing west, pitch is yaw, facing south, pitch is negative pitch...

How can I convert my OSVR quaternion to the a corresponding quaternion in the new coordinate system?

sentences:
Workflow for accountable file transfers between freelancer and developer I'm an indie game developer and I often hire freelancers for artwork. We sign an agreement to basically state that I'd get ownership of the resources they produce.
I'm a fairly picky person when it comes to formalities in these agreements, and I can't find a good system to document file transfers between freelancer and client. What I'm looking for is:
A way to track a relationship between their email account and mine, and document file exchanges, like a "timeline":

Freelancer uploaded X file at 16:50 UTC+03:00, [download button]
Freelancer uploaded Y file at 17:43 UTC+03:00, [download button]
Client uploaded Z file at 18:35 UTC+03:00, [download button]

And files are permanently kept in the timeline for documentation purposes - it should be impossible to delete an entry (unless both parties agree to delete it). The point of such structure is to "vouch" that this person transferred a file at some point and neither party can deny it.

Technically, e-mail attachments do exactly this. However, if it is a relatively large file, Gmail will ask them to upload to Google Drive. The problem with this is that Drive lets them keep ownership of the file (so if they delete it, I cannot get it back unless I had downloaded it); we would lose the whole "record" thing as there will be no guarantee that the file that I have is in fact the file that they uploaded.
How we've worked with a few freelancers in the past is that they will transfer a bulk of files (zip) to us using whatever convenient method, and then, in written, state that they have produced and transferred a zip with some MD5 hash. So if it is ever necessary to prove that such a file was given to me by a freelancer, we'd just compute its hash. However that's understandably inconvenient.

sentences:
Windows Phone XAML and XNA Apps with Game Components I am using the Windows Phone Template "Windows Phone XAML and XNA Apps" and targeting Windows Phone 7/8. Most examples show your game inheriting from Microsoft.Xna.Framework.Game and then adding Microsoft.Xna.Framework.GameComponent items to the Components collection. But as my game page inherits from PhoneApplicationPage there isn't a Components collection  or a Game property.

How can I use GameComponent from within PhoneApplicationPage?

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:
How do I expose a field with a generic class to the Inspector? I have some utilities implemented as generic classes.

I would like to have fields of these types exposed to the inspector but they appear to not display.

This test code:

[Serializable]
public class TestGenericClass<T>
{
    public string testField;

    public TestGenericClass(T testValue)
    {
        testField = testValue.ToString();
    }
}

[Serializable]
public class TestNormalClass
{
    public string testField;

    public TestNormalClass(string testValue)
    {
        testField = testValue;
    }
}

public class MonoBehaviourClass : MonoBehaviour
{
    public TestGenericClass<string> testGenericClass = new TestGenericClass<string>("generic");
    public TestNormalClass testNormalClass = new TestNormalClass("normal");
}

Produces this result:

As you can see the field for the generic class is missing.

How can I expose a field with a generic class to the inspector?

sentences:
Shader - Transmittance or Absorption I am trying to create a transmittance or absorption shader (glsl, hlsl, cg, etc...) in realtime but I don't find any good tutorial or white paper about this subject. I only find offline rendering references.

Is it possible to achieve this kind of effect in realtime using standard rasterisation of a 3D mesh ? How ?

sentences:
How is text/scripts/dialogue stored and accessed in games? For large, complex games, I imagine that text descriptions, dialogue lines, etc, are organized in some sort of database, and not actually hardcoded into the source.

Are there any conventions on how such textual data is organized and inserted/loaded into the game? And how does this "database" get "compiled" into the executable along with the source code? (Because for most AAA games there aren't additional files containing said database, etc).

In particular, I'd like to know how to load text into a game, without opening some external client-side file (so the client can't just browse the file and read the ending!). I don't see how an external file/database could be bundled into the compiled source executable (for example, how would you do this in C)?

sentences:
UV Texture coordinates out of [0,1] (WebGL) I'm creating a 3D game with WebGL and i'm using Wavefront Objects as a base model format.
I recently found some models, their texture coordinates of which are out of the typical [0,1] range and i really don't know how to handle them (in code).

I know of course this is a known issue, texture coordinates can be outside of [0,1] and the solution is to use GL_REPEAT wrap mode.

But this is no solution to me since i have a lot of non-powered-by-2 textures and i need to use CLAMP_TO_EDGE wrap mode (the solution to non-pow-2 textures).

I tried to bypass this issue by coding, so to convert [0-,1+] ranges into [0,1] but with not much of success (although somewhat). Here's what i did:
I looped "vt" entries (from my parser) and the cases i'm checking are these (pseudo):

U,V = texture coordinates as they come from file

if (U<0) {
   U = U + Math.abs( Math.floor(U) );
}
if (U>1) {
   U = U - Math.floor(U);
}
if (V>=0) {
   V = Math.ceil(V) - V;
}
if (V<0) {
   V = Math.abs( Math.floor(V) - V );
}

The above fragment will take a U,V of unknown range and will convert it into [0,1], taking also care the WebGL texture coordination system (0,0 buttom-left for WebGL but 0,1 for Wavefront, the 3rd case above)

The numbers are calculated correctly but the result is not the expected and i'm afraid there is a misunderstanding by my side on how the GL_REPEAT mode works.

So my question(s)

Can this be solved by code, so i can use CLAMP_TO_EDGE?
In case there's no way, is there any program than can take a model of REPEAT-ed coordinates and produce one in [0,1] range? I'm already using Blender but could not find a setting for this in exporter.

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:
Changing the texture filtering methodology within the same SpriteBatch Begin/End pair How would I go about using changing the texture filtering method being used within the same SpriteBatch Begin/End pairing?

I have this code so far.

spriteBatch.Begin(SpriteSortMode.Deferred, BlendState.AlphaBlend, SamplerState.PointClamp, null, null, null);

spriteBatch.Draw(PixelArtTexture, new Vector2(x, y), null, Color.White, 0f, Vector2.Zero, new Vector2(8, 8), SpriteEffects.None, 0f);

spriteBatch.End ();

This draws a pixel art texture using point filtering, however I want to draw another texture using linear filtering, so how would I do that?

sentences:
Should I get a game focused programming degree or a computer science one? Possible Duplicate:
  Game Development Degree vs Computer Science Degree

Heres the best education I got in ky math is AP Calculus and no technology class that teaches a programming language. So should I just go get a Computer Science degree or a game programming-based one? Might not be a lot; ask if you need more info to decide.

sentences:
Apply a special effect to a scene area My 2D game has a second camera on the scene that renders an upside down image of the scene and distorts it, giving the effect of water reflection. I render this camera first, and on top of it I render the main camera.

This is working correctly as expected, however, I want to improve it's performance by performing this process in small sections of the scene instead of the whole screen. I created a trigger to detect which items should be turned upside down and rendered.

How can I turn these items and distort them as I did with the whole scene, but only to the GameObjects detected inside the trigger?

Note: I can't assign them to a layer since the layer is already in use.

sentences:
How to instantiate new GameObject at position of old GameObject onAnimationComplete I have a GameObject that is a Farmer that plants Seeds. The Seeds will animate into Plants. Once that animation is complete, I'd like to replace my Seed with a Plant. This happens hundreds of times per game at arbitrary positions. I've tried this as something I built off of this question: Unity: detect animation's end

public class SeedScript : StateMachineBehaviour {
[SerializeField] private GameObject seed;
override public void OnStateExit(Animator animator, AnimatorStateInfo stateInfo, int layerIndex) {
    Destroy(this);
    animator.GetComponent<TreeScript>().GrowTree(seed);
    Instantiate (tree, this.position,  this.rotation);
}

}

Obviously, this doesn't work at all. Doesn't even compile.

I've also looked at these co-routines: https://answers.unity.com/questions/981948/statemachinebehaviour-startcoroutine.html but again, I need to get position data from the animating object.

Yes, I could just merge my Seed and Plant classes together, let's pretend I cannot do that and MUST instantiate some arbitrary new object at the position of another object on some animation completion.

sentences:
Vibration duration for mobile devices in Unity I'm used the
Handheld.Vibrate() method. I know that if you call it several times, you can increase the vibration time, but when it is called once, the vibration lasts about 1 second. But I would like to make an imitation of clicking on the android keyboard. (Vibration ~ 0.2s)

How to set the duration of the vibration?

sentences:
Game Maker 8.0 - Can I simulate any collision event within the step event of an object including the "other" reference? Let's say I have two objects. One is "obj_wall" and the other is "obj_player". For the sake of argument, let us assume that I cannot just add a collision event to obj_wall (I truly cannot due to limitations embedded within the nature of the project itself).

Is there a function or block that allows one to write a collision event within obj_wall's step event? I know there are various collision detection functions, but what I need is one that acts identically to the collision event and allows me to access the "other" property. If this is not possible, are there any suitable alternatives (such as a function that detects collision and returns the instance_id of an object colliding the wall)?

My primary issue here is that I want to be able to use collision in one instance of an object without having to have the collision event added. I'd prefer it to be as close as possible to the collision event so as to avoid unnecessary extra checks.

sentences:
How to enable and disable scripts on a Game Object? This worked briefly yesterday, I believe I did something to mess this up. All my inputs that I put in are correct; therefor, it must be the code. I want to switch players. While the red cube's script is enabled and can move under the movement script I want the blue cubes movement script to be disabled and vice versus. Can you give me some insight into what I'm doing wrong? Please and thank you!!

using UnityEngine;
using System.Collections;

public class PlayerMovementScript : MonoBehaviour {

    public float speed = 2f;
    public float height = 2f;

    public Component playerMovement;
    public GameObject redCube;
    public GameObject blueCube;

    void Start()
    {
        var bc = blueCube.GetComponent<PlayerMovementScript>();

        bc.enabled = !bc.enabled;
    }

    // Update is called once per frame
    void Update ()
    {
        if (Input.GetButton ("Right"))
        {
            transform.Translate(Vector3.right * speed * Time.deltaTime);
        }

        if (Input.GetButton ("Left"))
        {
            transform.Translate(Vector3.left * speed * Time.deltaTime);
        }

        if (Input.GetButton ("Jump"))
        {
            transform.Translate(Vector3.up * height * Time.deltaTime);
        }

        var bc = blueCube.GetComponent<PlayerMovementScript>();
        var rc = redCube.GetComponent<PlayerMovementScript>();

        if (Input.GetButton ("Switch"))
        {
            bc.enabled = !bc.isActiveAndEnabled;
            rc.enabled = !rc.enabled;
        }
    }
}

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 change 100 GameObjects' color without pushing RAM to hard? I'm developing a mobile game and one of the gamemodes has 100 gameobjects(basic cubes). And they all have same material. I need to know how to change their color one by one with script.

I'm not very good at programing, so only idea that i have for this situation is declaring 100 objects to var, and then change their color one by one.

But like a said it's a mobile game so i need to do it with simplest code so performance would be perfect.

sentences:
Is there a difference between analytics and telemetry? We are developing a mobile game (using Unity3D). We report various game analytics events to our backend systems so they can be aggregated and analyzed later on.

I've recently watched this session from GDC on game telemetry: http://www.gdcvault.com/play/1012227/Development-Telemetry-in-Video-Games

I was wondering whether telemetry and analytics were in fact the same thing? They seem to be related to one another, although may have different use cases...

sentences:
Collectiion was modified(monogame) I did use this...and when i changed Screens it gave me this error : Collection was modified; enumeration operation may not execute.

foreach(var screen in ScreenList)

Inside Base Screen

  public void HideScreen()
    {
        Enabled = true;
        Visible = true;
        alpha = 0;
        fade = Fade.Out;

    }

    public void Show()
    {
        Enabled = true;
        alpha = 1;
        fade = Fade.Out;
    }

And in Screen manager

 public static void ChangeScreen(BaseScreen CurrentScreen, BaseScreen TargetedScreen)
    {
        TargetedScreen.HideScreen();
        AddScreen(CurrentScreen);
        RemoveScreen(TargetedScreen);
        CurrentScreen.Show();
    }

sentences:
How to make the button rollover by a keyboardEvent I'm designing a game calculator . My problem is how to link between the keyboard event and the button. **When I click no.2 button on my Keyboard the button doesn't roolover .
I want the exact button roolover wen I use the keyboard .

Note

every button have it's instance name
ex:
the button of number one : one_mc

my code is

switch (event.keyCode)
    {
    case 97 :
     res[1].appendText("1");
    break;
    case 98 :
     res[1].appendText("2");
    break;
    case 99 :
     res[1].appendText("3");
    break;
    case 100 :
     res[1].appendText("4");
    break;
    case 101 :
     res[1].appendText("5");
    break;
    case 102 :
     res[1].appendText("6");
    break;
    case 103 :
     res[1].appendText("7");
    break;
    case 104 :
     res[1].appendText("8");
    break;
    case 105 :
     res[1].appendText("9");
    break;
    case 96 :
     res[1].appendText("0");
    break;
    case 8 :
      res[1].replaceText(res[1].text.length-1,res[1].text.length,'');
    break;
    }

sentences:
How can I measure the velocity of a drag gesture? I want to measure the velocity of a drag(FreeDrag, VerticalDrag, HorizontalDrag) gesture on my Windows Phone. For example, if the measured velocity of a drag is 40 km/h, the player will shoot a bullet in the dragging direction that flies with 40 km/h.

How can I measure the velocity of a drag gesture on my Windows Phone?

Update:
I don't know how to measure the time. Is it possible to do it without touchCollection or should I use touchCollection to determine the StartTime and the EndTime?

I'm not sure if I need the touchCollection block. In addition, I'm not sure if I can use two different types, TimeSpan for StartTime and DateTime for EndTime.

What is the best way to measure the time?

TimeSpan StartTime;
DateTime EndTime;
TouchPanel.EnabledGestures = GestureType.FreeDrag;
protected override void Update(GameTime gameTime)
{
 TouchCollection touchCollection = TouchPanel.GetState();
 foreach (TouchLocation tl in touchCollection)
 {
   GestureSample gs = TouchPanel.ReadGesture();
    if ((tl.State == TouchLocationState.Pressed))
    {
     StartTime = gs.Timestamp;
     }
    if ((tl.State == TouchLocationState.Released))
    {
     EndTime = DateTime.Now;
     }
  }

    while (TouchPanel.IsGestureAvailable)
    {
    GestureSample gs = TouchPanel.ReadGesture();
       switch (gs.GestureType)
        {
          case GestureType.FreeDrag:
               StartTime = gs.Timestamp;
           break;
         }
     }
        base.Update(gameTime);
 }

sentences: Game engine animation management Usually in a game scene there might be tens of animations going on at the same time, each being in its own state. I wonder usually how is this managed in game engines? Do they just stack a variable indicating the state of the animation on entity? Or do they use a separate animation system to keep all states?

sentences:
Godot Camera shake without target I'm working with godot 3.2 to make this screen shake, but my issue is that i don't have a target, like in the example, in the example code, it's a kinematic body that is being followed by the camera, i don't have that, i'm  making a match-three type of game, so i don't use those.
What i tried it's to use the main node, in which the game loop logic is executed but the camera shake didn't work, also tried with another elementsd but it failed beacuse they are mostly HUD elements
and shows an error about global positions.
Also i not sure how to get the board/grid, since it's instantiated by code.
How i can make shake camera without a target or get a similar effect?

sentences:
Velocity control of the player, why doesn't this work? I have the following code inside a while True loop:

if abs(playerx) < MAXSPEED:
    if moveLeft:
        playerx -= 1
    if moveRight:
        playerx += 1

if abs(playery) < MAXSPEED:
    if moveDown:
        playery += 1
    if moveUp:
        playery -= 1

if moveLeft == False and abs(playerx) > 0:
    playerx += 1
if moveRight == False and abs(playerx) > 0:
    playerx -= 1
if moveUp == False and abs(playery) > 0:
    playery += 1
if moveDown == False and abs(playery) > 0:
    playery -= 1

player.x += playerx
player.y += playery

if player.left < 0 or player.right > 1000:
    player.x -= playerx
if player.top < 0 or player.bottom > 600:
    player.y -= playery

The intended result is that while an arrow key is pressed, playerx or playery increments by one at every iteration until it reaches MAXSPEED and stays at MAXSPEED. And that when the player stops pressing that arrow key, his speed decreases until it reaches 0.

To me, this code explicitly says that...

But what actually happens is that playerx or playery keeps incrementing regardless of MAXSPEED and continues moving even after the player stops pressing the arrow key.

I keep rereading but I'm completely baffled by this weird behavior. Any insights? Thanks.

sentences:
Add Boo or Python to Unity 5 I'm new to Unity, but I'm more comfortable with Python.

Is there any way to use Python as scripting language in Unity 5?

I heard there is some language called Boo that has a syntax like Python but it seems Unity just supports C# and Javascript.

How can I add Boo or Python scripting to Unity 5?

sentences:
Unity 3D: How to stop/reset 2D sprite animation after releasing key? Im following a tutorial to create animations with a 2D sprite character.
But i put in my own. Which has 8 animation positions.
For some reason when my guy walks around,then stop, the walkings animation continues to play out then resets to idles.

I need the animation to reset as soon as i release the key.

Im using Animator if you are wondering.

EDITED:
Original video with all the keys for each animations.
Youtube video

Second video with only 2 keys per animation, it was a test.
Second Video Here

Code Snipet!

using UnityEngine;
using System.Collections;

public class PlayerMovement : MonoBehaviour {

public float speed;

private Animator _animator;
private Rigidbody2D _rigidbody2D;

// Use this for initialization
void Start () {
    _animator = GetComponent <Animator>();
    _rigidbody2D = GetComponent <Rigidbody2D>();
}

// Update is called once per frame
void Update () {
    CheckDirection();
}

void CheckDirection(){
    if (Input.GetKey (KeyCode.A))
    {
        WalkAnimation(-1,0,true);
    }
    else if (Input.GetKey (KeyCode.D))
    {
        WalkAnimation(1,0,true);
    }
    else if (Input.GetKey (KeyCode.W))
    {
        WalkAnimation(0,1,true);
    }
    else if (Input.GetKey (KeyCode.S))
    {
        WalkAnimation(0,-1,true);
    }
    else
    {
        _animator.SetBool("Walking", false);
    }
}

void FixedUpdate (){
    Move();
}

void Move(){
    float dirX = _animator.GetFloat("VelX");
    float dirY = _animator.GetFloat("VelY");
    bool walking = _animator.GetBool("Walking");

    if (walking)
    {
        _rigidbody2D.velocity = new Vector2(dirX,dirY) * speed;
    }
    else
    {
        _rigidbody2D.velocity = Vector2.zero;
    }
}

void WalkAnimation (float x, float y, bool walking){
    _animator.SetFloat("VelX", x);
    _animator.SetFloat("VelY", y);
    _animator.SetBool("Walking", walking);
}

}

sentences:
Resolving penentration after collision using Separating Axis Thereom I implemented collision detection in my game using SAT. The detection works, but I'm trying to use the algorithm to figure out the penetration vector of the two OBBs and push them apart (before doing the 'actual' collision handling).

I think I got the penetration vector successfully. However I'm not sure which of the two entities in the collision to apply it on (i.e. add to the position of which entity).

If I apply it on both entities, obviously nothing happens. How can I know to the position which entity I need to add the penetration vector so the entities 'touch' at the exact point of collision?

sentences: How to reproduce examples from ShaderToy on my computer? I am a beginner with computer graphics. I have some experience with drawing polygons, shaded surfaces, the use of geometry shaders, etc. I am trying to create a volumetric cloud/volume render shader like this, with techniques such as 'raymarching'. The problem is that I have understood that graphics are rendered throughout a pipeline (generate vertex information with cpu, store them in buffer objects, process them with the vertex shader and then render the image with the fragment shaders), so for me it is not clear at what stage of the pipeline the volumetric rendering is done, since the cloud is not made of polygons or vertex in general. My first step would be reproducing the same rendering from shadertoy, to understand the technique better, add parameters, lighting, etc. What kind of shader is it? how should I write a program to use it? I use OpenGL in Linux. Thank you in advance!

sentences:
Rotate around an axis function for euler angles representation For a 3d game i need a function to rotate an euler representation around an arbitary axis by an angle.
For example an object is rotated with euler angles (0,90,0). Now the object should be rotated by 100 degrees around the axis (0,1,0). The resulting angle will be (0,190,0) using rotation order YXZ.
In this case I can add the angle to the euler value of the axis, however for an arbitary axis this will not work.
Problem with Quaternions & Rotation matrices:
With these representations the resulting rotations will always be smaller that 180 for each axis. I need the rotation to be lerped afterwards for example from (0,0,0) to (0,720,0).
Basically I am searching for a way to display euler angles like most of the 3D editors. When you rotate an object around any arbitary axis rotation might be larger than 360 in the editor, like (420,720,15).

sentences:
Video game entity storage and structures I finally have all the working input/output of a game engine.

However, I'd like to be able to put an amount of about 2000 shots being simulated in a region, total. I have done other games where all the data was stored in a linear array and iterated every turn, and referenced by index number.
This method seems to be fast enough, grants random access instantaneously and I'd say it "just works". However, inserting a new element requires searching for an empty space, and iterating over the "inactive" shots.

Considering the amount of max shots, what would be the best approach to this? Am I thinking too much about this, perhaps, and the array is a good enough system?

The engine works in C99. Shots will be destroyed when out of "practical" range and collisions will be done around the player rather than the entire working map. The game is real-time action style so updating needs to be quick, and shots might need to be accessed by position, which is another weakness of the array approach (unless I add that information to "slices" of the main map, I guess).

To summarize. What would be the best data structure in terms of insertion speed, allowing random access and iterating without gaps? A name, if it exists,  would be enough.

sentences:
How to implement swooping movement? I am trying to code some swooping behavior for a flying enemy in my 2D platformer.

The ideal behavior has the enemy starting from an arbitrary height above the ground, then accelerating downward and horizontally until flush with the ground, after which he slows and comes to a rest.

I would like to code this in such a way that I can adjust a parameter controlling the steepness of the curve.

In other words, I want a kind of asymptotic movement, similar to this:

https://www.mathsisfun.com/algebra/asymptote.html

How can I code this kind of movement in such a way that my enemy can start from any height and smoothly and elegantly accelerates down this kind of curve before gracefully stopping?

I have recourse to all the usual stuff (for example, acceleration, velocity, friction, raycasts, etc.). I would prefer to code the movement using this stuff, rather than hardcoding movement along a curve or path.

I was thinking it might be possible to achieve what I want by raycasting downward and getting the enemy's distance from the ground, and using this distance to adjust accelerations and velocities, but I'm not exactly sure how to go about it.

I work in Godot, but would like an engine-neutral explanation of how to achieve this kind of behavior.

sentences:
Use GKEntity's component(ofType:) with inheritance I'm writing a SpriteKit game in swift and making use of GameplayKit's entity-component system. There are many components that do different stuff but share the same methods in which they do it, so I thought I'd group them into categories. At first I thought about using protocols, but component(ofType:) only accepts classes. So then I thought about making a base class for each category, define methods and variables there and have the actual components classes override them to implement their own functionality (you know like basic OOP). So I had something like:

class InputComponent: GKComponent {
    func handleInput() {
        //Whatever
    }
}

class ControllerComponent: InputComponent {
    override func handleInput() {
        //Do something
    }
}

class KeyboardComponent: InputComponent {
    override func handleInput() {
        //Do something different
    }
}

Then somewhere in my code I'd call

entity.component(ofType: InputComponent)

and I thought I'd get both ControllerComponent and KeyboardComponent type objects. But I am getting none, it seems component(ofType:) doesn't return instances of subclasses.

I guess I can make an extension to GKEntity and define something like

component<P>(conformingTo protocol: P.Type)

and implement that behavior myself but I want to know if I can use the built in function to achieve the same.

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:
Irrlicht engine game wont compile on linux. Undefined refrences(opengl and xfree) I'm trying to port over my game I'm developing to Linux. But when i compile i get a lot of undefined references to mostly functions that look like they belong to OpenGL. Most are titled gl...  But one of them is called XFree.

I compiled it with this command:

g++ main.cpp -L../../../LIB/irrlicht-1.8.3/lib/Linux/ -lIrrlicht -I../../../LIB/irrlicht-1.8.3/include/

one of the errors:

/home/owner/LIB/irrlicht-1.8.3/source/Irrlicht/COpenGLDriver.cpp:3746: undefined reference to `glVertex3f

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:
custom mesh object orientation is not correct using I am making a custom mesh with the help of Traingulator script.  At runtime, user can click and and generate a point then mesh creation start. Here is the way i am getting user input.

void Update()
    {
        RaycastHit hit;
        Ray ray = Camera.main.ScreenPointToRay(Input.mousePosition);
        if (Physics.Raycast(ray, out hit))
        {
            if (Input.GetMouseButtonDown(0))
            {
                GameObject sphere = GameObject.CreatePrimitive(PrimitiveType.Sphere);
                sphere.transform.position = hit.point;
                sphere.transform.localScale = new Vector3(0.2f, 0.2f, 0.2f);
                positions.Add(sphere.transform.position);
                positionsVector2.Add(new Vector2(sphere.transform.position.x, sphere.transform.position.z));

                traingulatorTester.MeshMaker(positionsVector2.ToArray());
            }
        }

    }

And here is the mesh maker function that calling tringulator

 public void MeshMaker(Vector2[] vertices2D)
    {
        // Use the triangulator to get indices for creating triangles
        Triangulator tr = new Triangulator(vertices2D);
        int[] indices = tr.Triangulate();

        // Create the Vector3 vertices
        Vector3[] vertices = new Vector3[vertices2D.Length];
        for (int i = 0; i < vertices.Length; i++)
        {
            vertices[i] = new Vector3(vertices2D[i].x, vertices2D[i].y, 0);
        }

        // Create the mesh
        Mesh msh = new Mesh();
        msh.vertices = vertices;
        msh.triangles = indices;
        msh.RecalculateNormals();
        msh.RecalculateBounds();
        if (gameObject.GetComponent<MeshRenderer>() == null)
        {
            // Set up game object with mesh;
            gameObject.AddComponent(typeof(MeshRenderer));
            filter = gameObject.AddComponent(typeof(MeshFilter)) as MeshFilter;
        }
        filter.mesh = msh;

    }

Now the problem is the rotation of the custom mesh object is not correct look at this.

Now I have manually set the rotation.

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:
Why does my code dividing a 2D array into chunks fail? I have a 2D-Array representing my world. I want to divide this huge thing into smaller chunks to make collision detection easier.

I have a Chunk class that consists only of another 2D Array with a specific width and height and I want to iterate through the world, create new Chunks and add them to a list (or maybe a Map with Coordinates as the key; we'll see about that).

world = new World(8192, 1024);

Integer[][] chunkArray;

for(int a = 0; a < map.getHeight() / Chunk.chunkHeight; a++)
{
    for(int b = 0; b < map.getWidth() / Chunk.chunkWidth; b++)
    {
        Chunk chunk = new Chunk();
        chunkArray = new Integer[Chunk.chunkWidth][Chunk.chunkHeight];

        for(int x = Chunk.chunkHeight*a; x < Chunk.chunkHeight*(a+1); x++)
        {
            for(int y = Chunk.chunkWidth*b; y < Chunk.chunkWidth*(b+1); y++)
            {
                // Yes, the tileMap actually is [height][width] I'll have
                // to fix that somewhere down the line -.-
                chunkArray[y][x] = map.getTileMap()[x*a][y*b];
                // TODO:Attach to chunk
            }
        }

        chunkList.add(chunk);
    }
}

System.out.println(chunkList.size());

The two outer loops get a new chunk in a specific row and column. I do that by dividing the overall size of the map by the chunkSize.

The inner loops then fill a new chunkArray and attach it to the chunk. But somehow my maths is broken here.

Let's assume the chunkHeight = chunkWidth = 64.

For the first Array I want to start at [0][0] and go until [63][63]. For the next I want to start at [64][64] and go until [127][127] and so on. But I get an out of bounds exception and can't figure out why.

Any help appreciated!

Actually I think I know where the problem lies:

chunkArray[y][x] can't work, because y goes from 0-63 just in the first iteration. Afterwards it goes from 64-127, so sure it is out of bounds.

Still no nice solution though :/

EDIT:

if(y < Chunk.chunkWidth && x < Chunk.chunkHeight)
    chunkArray[y][x] = map.getTileMap()[y][x];

This works for the first iteration... now I need to get the commonly accepted formula.

sentences:
What are the most common ways of closing an open world? In many open world games, there are several ways to limit them. From original ones such as Desynchronisation(Assasins' Creed) to invisible walls.

What are the most common ways to close open worlds?

sentences:
OpenGL noob: Using VBO to draw a colored triangle I tried using straight vertex arrays to draw a triangle with different colors for each vertex and it works fine, but when I use VBO it won't work, so I'm doing something wrong.

// point 1
side_1.push_back(-2.0f); //x1
side_1.push_back(-2.0f); //y1
side_1.push_back(0.0f); //z1

// side color
side_color_1.push_back(0.8f); //r1
side_color_1.push_back(0.0f); //g1
side_color_1.push_back(1.0f); //b1

// point 2
side_1.push_back(2.0f); //x2
side_1.push_back(-2.0f); //y2
side_1.push_back(0.0f); //z2

...etc

// init code
////////////
glGenBuffers(2, &m_vertexBuffer[0]); //Generate a buffer for the vertices

glBindBuffer(GL_ARRAY_BUFFER, m_vertexBuffer[0]); //Bind the vertex buffer
glBufferData(GL_ARRAY_BUFFER, sizeof(GLfloat) * side_1.size(),
                 &side_1[0], GL_STATIC_DRAW); //Send the data to OpenGL

glBindBuffer(GL_ARRAY_BUFFER, m_vertexBuffer[1]); //Bind the vertex buffer
glBufferData(GL_ARRAY_BUFFER, sizeof(GLfloat) * side_color_1.size(),
                 &side_color_1[0], GL_STATIC_DRAW); //Send the data to OpenGL

// render code
////////////
glEnableClientState(GL_VERTEX_ARRAY);   // enable vertex array
glEnableClientState(GL_COLOR_ARRAY);    // enable color array

// bind the buffer to the VBO
glBindBuffer(GL_ARRAY_BUFFER, m_vertexBuffer[0]);
glBindBuffer(GL_ARRAY_BUFFER, m_vertexBuffer[1]);

glVertexPointer(3, GL_FLOAT, 0, 0);
glColorPointer(3, GL_FLOAT, 0, BUFFER_OFFSET(sizeof(GLfloat) * side_1.size()));

glDrawArrays(GL_TRIANGLES, 0, 3);

glDisableClientState(GL_COLOR_ARRAY);
glDisableClientState(GL_VERTEX_ARRAY);

sentences:
How to draw point sprites with transparency in OpenGL without depth sorting? I am trying to render point sprites with alpha transparency and because I render millions of points depth sorting would kill performance. My issue as you can probably imagine is that artifacts appear in some of the borders when the draw order is not correct:

My code for drawing:

glEnable(GL_DEPTH_TEST);
glEnable(GL_BLEND);
glBlendFunc(GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA);
glDrawArrays(GL_POINTS,0,nSamples);

In my shader I just specify a alpha value in the output color depending on how close to the point center we are.

Is there any way to get rid of the artifacts and get a correct transparency render?

sentences:
z ordering in directx11 Hi recently i am trying to implement z ordering system into my directx framework.
So every object will have z order property(int), and this value will have higher priority than depth checking for rendering.
the current idea is from these three my assumptions that

depth check happens after vertex shader
value of SV_POSITION is used for depth checking
modifying z component of the value of SV_POSITION doesn't affect anything except in depth checking, because it is in projection space.

so after calculating projection position(local pos * WVP mat), i did projective dividision(it seems to make problem) and modified only z component corresponding orders that i want to draw with.

This is brief Vertex shader code

VS_OUTPUT output;

output.pos = mul(WVPMat, input.pos); // projection pos
output.pos /= output.pos.w;
output.pos.z -= renderPriority;

return output;

And !!! it kinds of works !!! but when i get my camera closer to any object,
it weird thing happens

it doesn't make any this weird thing unless projective division.
i am just curious why it happens instead of knowing another alternative way for z ordering.
but any further advices and informations would be really appreciated.

sentences:
GLES2-AnchorCenter branch has no org.andengine.util.color.Color I am porting my game from GLES2 to GLES2-AnchorCenter branch. I am using

import org.andengine.util.HorizontalAlign;
import org.andengine.util.color.Color;
import org.andengine.entity.particle.modifier.ExpireParticleInitializer;

... but these aren't available in GLES2-AnchorCenter branch, it seems.
Could anybody guide me on this?

sentences:
Unity Animator animations fail to play only when triggered by user input I have a unity animator setup like so. When the game runs, I can trigger each state in the state machine with user input. I can use HasExitTime flag to trigger the animation, and it will play through and loop infinitely as expected.
However, when I try to use the GearChange trigger, the state machine progress bar plays, the correct box is triggered, but the animation itself doesn't play! I'm at a total loss as to what the problem is here, as everything else is exactly the same, minus the user input.
The console isn't showing any errors, the animation simply doesn't respond to the state machine. What am I missing here?
Unity version 2020.1.0f1
So I deleted the animator, and setup everything again the exact same way. Now the animation won't play, period. The state machine progress bars are still triggered as expected, but the animation won't play.
In the transition preview, the animation won't play there either.

sentences:
How can I split up a large model into an octree codewise? For collision detection, I am attempting to split up a large model into an octree.

If we take this black thing thing to be the ship (104,000 vertices):

Then I would like to split up the faces

I could easily split them up, but the problem is one of location. For example, if we take the bottom left chunk, how can I know that the projectile (in this case, a cannonball) is at that specific chunk?

And also how can I define the areas of the chunks in the first place? And for that matter, I need them to rotate with the ship as well!

I'm hopelessly lost as of how to do this, and so I'm hoping someone can help me out.

sentences:
JavaFX import 3D models I want to import some 3d models to my javaFX application.

In javaFX I can create rectangles, traingles, circles, pentagons.
Those figures can be filled with color or filled with image.
They are called nodes. Nodes can be added to group and be visible ( nodes also can be rotated, scaled and translated ).

I want to import 3d model and it to be as a node, so I could add model to a group and rotate, scale and translate.

How can I achieve this?

sentences:
Efficient container(s) for units in an 2D RTS game As the title says, I'm toying around with developing a 2D space RTS game. All of my units are spaceships that basically just shoot at one another, but they have to do a variety of other things as well: they have to "discover" (notify, draw, etc) other ships and planets not owned by the owner of this ship and within the arbitrary range of the ship's "scanners" (since they would otherwise be hidden), and if the ship is told to fire on an enemy ship, it needs to find the closest enemy (and fly to it if out of shooting range), and then shoot it obviously.

I've been wondering what efficient data containers could I use for the ships if there is going to be a large number of ships (100s to maybe 1000s) and why them? Also to note, is that ships must be distinguished by their owner (I may go to war with one player, so I obviously do not want my ships to search for ships of other players), where ownership will probably be represented by some integer (1 = player 1, 2 = player 2, etc) or maybe the unique pointer/memory address of a "player" object (0x4ff = player 1, 0x5ea = player 2, etc) or some other simple identifier.

I initially thought about using an array of vectors (C++), with the index of the array representing the player and each vector being the ships belonging to that player; then take all ships belonging to whatever player you are at war with and place them into a priority queue, whose root would be the enemy ship closest to a specific (friendly) ship and decide if its in range or not, but this seemed far too slow and memory-expensive, and didn't really address how to scan for ships/planets.

I then read up a few related posts about quadtrees and this lead me to other such tree data structures, like R-trees, that are also used for optimal spatial queries, but I do not quite understand exactly how they work and whether or not they would be best for me, so here we are.

sentences:
Algorithm for securing a retro password system For a game I am working on, one of the build targets is the Unity Webplayer, which does not support saving file I/O at all.  However, as it's an action/adventure game based on Zelda 2: The Adventure of Link, I would like to provide my players the capability to save their game somehow.

In light of the webplayer limitations, I was going to circumvent it by creating a password system that the user could simply enter to resume where they left off.  Said password would convey various things about game state, such as event flags, and picked up item flags (true to the game this is based off of, loading a game restarts the player in a pre-determined location.)  This is also convenient for other modes, because the save system would be merely responsible for storing this password, as the password is a compressed version of the game's state.

My understanding is ideally, said setup would just entail creating a series of bits, represented by a complex character (such as, a digit or hexadecimal character) which could be stored in some larger value, then unpacked when entered by the user.

Of course, there's a problem, and that's security.  I have to assume some less-honest player knows the sequence of flags and how to recreate them.  From what I understand, a way to get around that is to append some sort of checksum to the bit sequence.  If that checksum fails, then the system knows that the code is bogus, and to do nothing at all.  Of course, I would also assume that the attacker would be aware of said checksum's existence.

Question: what are some good ways I would go about securing a save-state password as described above to make it less-able to be gamed by cheaters?

sentences:
Unity - character model not blinking I'm a bit confused as to what's going on, but I've just noticed that my imported character model never blinks during his animations. I currently have 3 animations - an idle, walk and jump. Every aspect of the animations work correctly, but for some reason the blinking doesn't. o_o Looking at the keyframes in the Animation tab, they're there, but they don't work. Any ideas what could be wrong?

Thanks

sentences: SDL sprite animation problem I'm currently drawing my character from a single file, and my sprite class handles it taking the file path as an argument. Now, I need to add a simple animation, cycling between two frames. The problem is that I have the other animation frame in another file, not in the same file as the first frame. How can I handle the animation without loading and unloading the two files and without merging the files into one?

sentences:
What is "tools development?" I have been looking at different jobs in the games industry and a lot of the jobs that I have seen advertised are for a "Tool Developer" position. I do not know what this actually is.

Could someone explain what this is to me please? And if anyone has any links to material that would help me understand it more then that would be very much appreciated.

sentences:
What does the identity matrix really do? I understand that multiplying by the identity matrix is like multiplying by 1. Why would you multiply a matrix that will only contain the same result?

Also, I'm experimenting with some OpenGL code and found some very interesting things. Like for example:

When you use setIdentity(), the image rotates slower:

Matrix.setIdentityM(mProjectionMatrix, 0);
Matrix.rotateM(mProjectionMatrix, 0, angleInDegrees, 0.0f, 0.0f, 1.0f);

But if you try to remove the setIdentity(), the image will rotate so fast...
first it will rotate clockwise so fast, and then it will become slower until it stops and then it will begin to rotate counter clockwise, and then will stop again, then rotate clockwise.

I really don't understand how the identity matrix affects them despite multiplying by 1.

Can someone explain to me what's going on?

Here is the tutorial I am following.

sentences:
How to model interentity membership in entity-component architecture? I'm falling in love with simple grace of entity-component design, although I still have issues breaking from MVC and OOP practices. Some of my game entities have membership relationships with each other (ex: a player is a member of a city, a city is a member of a nation), and I am unsure on the best way to implement it.

My initial reaction is to have a a MemberOfCity component that points to the appropriate city component, but components are suppose to have no references to each other. My other option is to have a System do it, but that would require the system to persist data outside of a component.

Is there a clean way to do this in an entity-component design, or am I trying to use a hammer on a screw and should use a hybrid/another approach?

sentences:
Help with "Cannot find ContentTypeReader BB.HeightMapInfoReader, BB, Version=1.0.0.0, Culture=neutral." needed I have this irritating problem in XNA that I have spent my Saturday with:

  Cannot find ContentTypeReader
  BB.HeightMapInfoReader, BB,
  Version=1.0.0.0, Culture=neutral.

It throws me that when I do (within the game assembly's Renderer.cs class):

this.terrain = this.game.Content.Load<Model>("heightmap");

There is a heightmap.bmp and I don't think there's anything wrong with it, because I used it in a previous version which I switched to this new better system.

So, I have a GeneratedGeometryPipeline assembly that has these classes: HeightMapInfoContent, HeightMapInfoWriter, TerrainProcessor. The GeneratedGeometryPipeline assembly does not reference any other assemblies under the solution.

Then I have the game assembly that neither references any other solution assemblies and has these classes: HeightMapInfo, HeightMapInfoReader.

All game assembly classes are under namespace BB and the GeneratedGeometryPipeline classes are under the namespace GeneratedGeometryPipeline.

I do not understand why it does not find it. Here's some code from the GeneratedGeometryPipeline.HeightMapInfoWriter:

 /// <summary>
    /// A TypeWriter for HeightMapInfo, which tells the content pipeline how to save the
    /// data in HeightMapInfo. This class should match HeightMapInfoReader: whatever the
    /// writer writes, the reader should read.
    /// </summary>
    [ContentTypeWriter]
    public class HeightMapInfoWriter : ContentTypeWriter<HeightMapInfoContent>
    {
        protected override void Write(ContentWriter output, HeightMapInfoContent value)
        {
            output.Write(value.TerrainScale);

            output.Write(value.Height.GetLength(0));
            output.Write(value.Height.GetLength(1));
            foreach (float height in value.Height)
            {
                output.Write(height);
            }
            foreach (Vector3 normal in value.Normals)
            {
                output.Write(normal);
            }
        }

        /// <summary>
        /// Tells the content pipeline what CLR type the
        /// data will be loaded into at runtime.
        /// </summary>
        public override string GetRuntimeType(TargetPlatform targetPlatform)
        {
            return "BB.HeightMapInfo, BB, Version=1.0.0.0, Culture=neutral";
        }

        /// <summary>
        /// Tells the content pipeline what worker type
        /// will be used to load the data.
        /// </summary>
        public override string GetRuntimeReader(TargetPlatform targetPlatform)
        {
            return "BB.HeightMapInfoReader, BB, Version=1.0.0.0, Culture=neutral";
        }
    }

Can someone help me out?

sentences:
Keeping a Character Controller grounded? I've got a character that makes use of isGrounded() to determine whether I can jump, whether my air-jump is reset, and the amount of friction to be applied. I've run into a common problem, isGrounded() is fluctuating every frame returning true and false randomly resulting in jagged movement.

The standard suggestion is to constantly apply gravity. Unfortunately, aside from any other more nuanced issues that this could result in, this only works for me if I apply so much gravity that I am no longer able to climb up slopes. I need a way to keep the character grounded without applying large amounts of gravity every frame.

sentences:
How to change chance of spawn based on distance? I am trying to make a cellular automate cave but want to keep the middle empty.

How should I change the chance based on the distance from the middle?

I don't want to completely deny it just want a small enough chance to keep it almost empty.

sentences:
How to apply a force to a wheeled veichle and make wheel rotate ? I've a veichle with 4 wheel and 4 wheel collider.

My veichle is a toy.. so i would like to apply an impulse force (veichle rigidbody.addforce) to that veichle, move it and make wheel rotate...

How can i do ?

Thanks

sentences:
Bounce with multiple collisions Here's the problem: I'm writing an Arkanoid-like game in Unity 5.3. I'm using 3D physics and simply ignoring z-axis in computations. No gravity, 0 drag and velocity reset every bounce by script. My ball has sphere collider and rigidbody with continuous dynamic collision detection on it, and bricks have box colliders with continuous detection. They are set like tiles, one by one, without gaps.

The problem occurs when a ball collides with two bricks at once, which causes a wrong bounce angle. Smaller sphere colliders makes this situation occur less often, but causes the ball to ignore collisions sometimes and phase through a single brick.

I know the probable reason for this bug, I think a collision with two objects affects ball physics twice. The question is: how to avoid it?

sentences:
Specular intensity not imported from Blender into Unity For my current project I'm using diffuse materials for my models in Blender but I do not want any Specular Intensity so I've set that to 0. Yet in Unity there is still a specular highlight and the material has a Smoothness of 0.5. Does Unity actually read Specular Intensity or am I missing some crucial detail?

I haven't been able to find any details on what the .blend-import actually reads and I can see a setting called Glossiness in the .mat-files created by Unity is set to 0.5.

sentences:
How to make a Realtime 3D Eulerian Fluid Simulation like "From Dust" in C#/Unity3D? So, for a game project I'm going to be working on I need to make a fully working 3D fluid simulator in Unity3D using C#, that can work in real time.

The only problem is, I've never done anything like fluid simulation. I've been doing tons of research on it, and I think a Eulerian based fluid simulator would fit my needs best (just like this).

Basically what I need is something that can react to changing terrain and move realistically.

The people that made that simulator have a research paper online, and I've read through it. I understand the basics, but I have no idea how I could get that in to C# or Unity3D. So I was wondering if any of you could help me, either by linking to other fluid-simulators where the code is open source, so I can pick it apart and change it to my needs, or by giving me tips on where to start/what I would need to do.

I've spent hours looking online for fluid simulators, but haven't found a single one programmed in C# as of yet, I have a program that can convert C++ to C#, but I don't understand C++ well enough to know where to put the scripts in Unity once they're converted.

Any help at all would be extremely appreciated, I'm really interested in teaching myself how to make this system, but I just have no clue where I should start, or what has already been done that I could build off of.

sentences:
Make Unity GUI for mobile phones only? I'm using Unity and I want to make a responsive GUI for portrait resolution only. Now I'd like to know if this is a good or bad idea when I force the user to play my game in portrait mode only. Shall I use autorotate? The problem is that when you use landscape mode my GUI looks really shitty.

I have some background images and I'd like to know if I should save them for the highest resolution available in mobile devices (like tablets)? Or shall I ditch the tablets and develop the GUI with the background images for mobile phones only? TIA

sentences:
Depth Stencil Buffer In OpenGL, what is the difference between GL_DEPTH_COMPONENT and GL_DEPTH_STENCIL?
I have looked around and have been unable to find a clear explanation.

Information on their usage with GLSL would also be appreciated (mainly DEPTH_STENCIL).

Thanks for any help.

sentences:
Download a file from internet using c++ and sdl2 I am using the SDL2 libs. I want to know how to download an mp3 file from a weblink (from my website) and use it in game (i know how to play songs but not how to download them).
Obviously these songs are not copyrighted..
Can you give me example code using sdl2_net ? Thanks

sentences:
How to make a Google Play app with paid and free-with-in-app-purchasing versions? I want to implement an IAP system as well as a fully paid one in my game.
There are about 8 levels in my game. I want the paid version to cost around $4 and in case of IAP, each level can be unlocked for 0.99 cents.
Do I have to create two separate apps (one for paid and one for IAP) or can I have both of these in a single app? The user can then decide if they want to buy the entire game or unlock a few levels using the IAP feature.

sentences:
2D Procedural resource generation I'm currently building a Mars colonization game and I'm wondering if anyone can point me to resources on how to procedurally create resources and biomes within a 2d game. Much like in a game like Factorio were different resources and such are spread around the map.

Thanks in advance!

sentences:
How can I produce 3D environments for VR from HDRI images? I have a question regarding to the HDRI maps as many some of you have a bit of experience in this field especially for Oculus Rift platform!

I've been trying to achieve a 3D landscape from this HDRI map. (Also I highly recommend this website for others :)!)

I even decided to render in Maya few images from the orthographic perspective but unfortunately still no luck.

See the results here on YouTube.

Is there any other method to reconstruct 3D models just from images and use them to create environment?

sentences:
Unity : control time interval when using getAxis() in bolt visual scripting i use bolt visual scripting. I add ‘input.getAxis’ in Bolt and set the axis name to ‘Vertical’ so to get response when i press ‘w’ and ‘s’. When running the game and press the ‘w’ key, the output data (acceleration) will increase from 0 to 1. The problem is the increasing time is too fast or too short. How to make it slower/longer? Let say i want it to take 3 seconds to reach 1.
Edit :
This is what i want to achieve  (at time 6:10 to 6:25) : https://youtu.be/m8rGyoStfgQ?t=370 And the code is at the same video at time 6:00 . That codes works perfectly fine. And this is all i want to achieve but i want to do it in Bolt (visual scripting) rather than manual scripting.
So that line of code at 6:00 on that video : Velocity = time.Deltatime * acceleration
That code is controlling how fast or slow the acceleration can go from 0 to 1 when pressing ‘w’ key. But in Bolt, i use ‘getAxis’ and by using default sensitivity setting, if i press “w” it will take less than half a second for the acceleration to go from 0 to 1. I want to make it slower so i can go from 0 to 1 in 3 seconds or 5 seconds.
In fact , this the same as setting up the sensitivity in input manager to low value, but i want to keep this setting as default and want to control it inside bolt.
Pls check my video here : getAxis

sentences:
Making use of the Android GPU debugging tools I tried following the manual to install the Android GPU debugging tools for android Studio 2.0. Unfortunately it has not been very successful.
I have been following the instructions of the official documentation which are still for version 1 of the gpu debugging tools here: http://tools.android.com/tech-docs/gpu-profiler
It also isn't that helpful otherwise.

I am using an arm based emulator for testing since the abi specific folders specified in the manual are for arm abi's only.
Also the red button above the gpu monitor that is used to start the debugging tools is grayed out for me and it tells me that the gpu debugging tools are not installed when I hover over it.

Are there any extra steps I need to follow to get it to work?

sentences:
Can Unity censor my content or invalidate my license for offensive content? If I make an offensive game can they pull my license and prevent me from selling my game? Like we're talking think of the most offensive thing you can think of: you're in charge of the most efficient genocide against some specific racial/religious/political group, your choice... now imagine the game is mocking victims and generally being extremely rude, violent, and insensitive.

Now I have no intention of making such a horrible game but I am using an extreme example to ask my question. It's not unheard of for less extreme things to get blocked by brands who didn't want to associate with them, for example I saw that Apple removed the Confederate flags from Civil War games in the App Store.

Would Unity be able to prevent me from using their game engine or selling my game after I had already purchased appropriate Unity licenses and completed the game?

Do they have that kind of power with their licensing model? Or would even the most extreme cases still be legally allowed to sell the content?

I want to make something that may have some mildly provocative/divisive content (not as offensive as say, South Park, which I know was made in Unity, but more serious than South Park) and I'm just making sure I don't get a bunch of work done and then get disappointed later, wishing I had gone with some kind of more free/open engine.

sentences:
Certain Unicode Characters not displaying when setting text to TextButton in libgdx Ok I am trying to do a word game much like Hangman Pro but for a different language(specifically amharic) using libgdx . And I have got a list of words saved to text file and I have taken care of BOM problem when reading the file. Problem arises when setting the individual characters from a random word to a TextButton.

Here is a snapshot of the problem:

The part I marked red are the ones missing and it is the same word in both cases. And I know the word is correctly being read because it outputs correctly on console

Here is init code and console output

public void init(){
        char [] indiv = WordList.randomWord.toCharArray();
        int index = 0;
        Skin skinCanyonBunny = new Skin(Gdx.files.internal(Constants.SKIN_WORDGAME_UI),
                new TextureAtlas(Constants.TEXTURE_ATLAS_UI));
        String name = "textb-dn";
        TextButtonStyle tbs = new TextButtonStyle(skinCanyonBunny.getDrawable("textb-up"),
                skinCanyonBunny.getDrawable("textb-dn"),
                skinCanyonBunny.getDrawable("textb-checked"),
                Assets.instance.assetFonts.defaultNormal);
        for(int i =0;i<Constants.WORD_TABLE_SIZE;i++){
            String tempText = String.valueOf(indiv[(index++)%indiv.length]);
            TextButton temp = new TextButton(tempText, skinLibgdx);
            btnPlayArray.add(temp);
        }

        for(int i = 0;i<Constants.WORD_TABLE_SIZE;i++){
            btnPlayArray.get(i).addListener(new TestInputtListenerOverflow(btnPlayArray.get(i).hashCode()));
        }

    }

And a sample of console output. the last one is the random selected word.

entry: ቴክኖሎጂ 5
entry: ኢንዱስትሪ 6
entry: ሀይል 3
entry: ወደፊት 4
entry: አቅጣጫዎች 6
entry: ሰው 2
com.tamirat.wordgame.WordGame: ኢንዱስትሪ

Can anyone tell me what is happening? If it helps I am using Nyala ttf font and converting them to bitmap using Font Forge. Alternatively I use BMFont. Thanks

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:
Calculation of distance while switching between two speeds There are two speed values, that are used by moving object. After a while speed switching occurs from V1 to V2. I need the formula that can be used for calculation of current distance (at specified time).

Input variable:

T - Current time

Constants:

V1 - first speed
V2 - second speed
Ts - switching time between V1 and V2
P - switching power

Output variable:

S = ?

I tried to use next formula:
S = Lerp[Clamp(T / Ts, 0, 1) ^ P), V1, V2] * T

But in this case the moving object will be returned back after time and moves forward again.

Probably acceleration should be used in the formula?

sentences:
Can I clip a collection of geometry to render only inside a particular worldspace volume? I am making a VR app in Unity.  I have a giant map that I want to display on a virtual table.  The map is too large to fit on the table, and I cannot change its size.  (It is a third party asset, and does not easily have that capability.)

How can I tell the camera not to render the parts of the map that fall off of the table?  Perhaps something along the lines of:

Camera.DoNotRender(new Vector3(100, 0, 0));

I have been looking into using some MonoBehaviour messages such as OnPreRender, OnRenderObject, etc.  But I do not know which one can help me, if any.  Ideally, the pixels behind the non-rendered pixels should be rendered, but that is not my priority.

The map is made up of 100s of little renderers:

How can I have my Camera not render specific world space pixels?

sentences:
How to ensure a condition in a behaviour tree when processing following nodes? Example tree (Source):

As far as I understood, a sequencer iterates over the children until one failed or all are successful. If one children returns "running", the sequencer will start to process from that child on the next tick.

Let's say "Do I have food?" takes longer than one tick because the AI has to walk to the fridge. When "Am I Hungry" was successful, it won't be processed anymore. Now while walking to the fridge, the hunger magically disappears. How do I prevent the tree from processing the other nodes even though I am not hungry anymore? Should every following node check the condition again? That doesn't seem to fit the idea of a behaviour tree.

How do I implement a condition that has to stay true while following nodes are processed?

sentences:
Architecture for extremely modular game? I'm developing a modular game in Unity 5.6. Each module has very little overlap in assets with the others. I'm concerned about having a bloated repository after a few months of development, and since I'm using Bitbucket (a free account) I'm limited in my repo size, but not in my number of repos. So instead of having one huge folder for my game I'm considering having a launcher project and scene that loads builds from a folder in /Assets. Each module would be its own project, and I would just drop its build into the launcher's folder.

My question is, is this a reasonable approach to building a highly modular game? Hopefully I'll be continuing development for quite a while, and I want to make sure the project is as lightweight and extendable as possible. Or am I overthinking this, and should I just use one big repo?

sentences:
Resizing D3D Buffers within a frame I have a particle system. So far it worked like this: I have a dynamic vertex buffer for a system, which is created with a size that can hold for example 100 000 particles. I map/unmap this and write the new data into it every frame.

But what if the particle count gets bigger than the buffer can hold? I thought of recreating the vertex buffer with the double of its previous capacity (then map/unmap into it). Is this the right direction for this or should I solve it in a different way?

A short example:

ID3D11VertexBuffer* buffer;
ID3D11Device*       graphicsDevice;
//...
D3D11_BUFFER_DESC desc;
buffer->GetDesc(&desc);
if(dataSize>(int)desc.ByteWidth){ //data can't fit, so destroy and recreate
    buffer->Release();
    desc.ByteWidth*=2;
    graphicsDevice->CreateBuffer( &desc, nullptr, &buffer ); //returns S_OK
}

Update:

I want to use it for other things, not just particles but for example instanced meshes. If I spawn a couple of instances, I'd only like to resize a buffer, without creating an other one.

sentences:
TextMeshPro Shader choices difference (when to use) Actually I can see the visual difference that

bitmap/sprite shows blurry text like this:

pink distance field seems like missing texture:

distance field surface grey:

and lastly distance field masking/overlay seems to show the correct/expected result:

so what's the difference between those two? (masking/overlay)

sentences:
How should I do my collision response? I'm making a small lockpicking simulator. Obviously I'll need the pick to not pass through the lock, and I'll need the pins to move when you tap or push them with the pick.

Here's what I have so far, just to give you an idea.

http://megaswf.com/serve/2433982

As you can see, the collision detection is pixel perfect. I've looked into a couple of different ways of doing collision response, but it seems like such a vast and complicated field. Any time I come up with a possible solution I start noticing flaws like what would happen if more than two objects collided and so on.

I've looked into physics engines like Box2D, but it seems like such overkill considering the, I think, simple nature of the game I'm trying to make. I don't like the idea of using a huge library that I don't even begin to understand just because I can't figure out how to do collision response.

But I just don't know where to begin. Maybe I will have to use a library. If anyone with experience could, based on that demo and what I'm trying to do, suggest a course of action, I'd really appreciate it.

sentences:
How to implement a save/load system in Unity? Many game allows the player to save progress at any time and load the save back at any time (like Minecraft and Doom 3).

I would like to implement it in Unity.

I think I will need to put the value of every variable in every script into a save file, but how?
Or maybe not?

sentences:
Getting Directions from player I have a camera player in a scene. Scene contains a fixed north which i want to indicate on my compass with needle but how can i do it?
 I tried this code using a tut so far but its north is not right

   public void ChangeNortDirection() {

        northDirection.z = player.eulerAngles.y + 10;
        northLayer.localEulerAngles = northDirection;

    }

sentences:
Geometry design and buffers I'm making some tests with rendering stuff and I'm wondering how to design my Geometry class. For the moment, here is how I do:

Init: Stock array with positions, array with colors, array with normals, … has attributes.
Just before rendering, if my geometry have changed, I update his vertex buffer and index buffer. To do that, I compute interleaved array here and send it to my vertex buffer.

I've made some tests with particles (10000 on iPad), the heaviest function is "Geometry::computeInterleavedArray.

How can I avoid this part? Is it better to stock geometry's data inside a single array with all data already interleaved?

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:
Saving an interface instance into a Bundle All

I've have an interface that allows me to switch between different scenes in my Android game. When the home key is pressed, I am saving all of my states (score, sprite positions etc) into a Bundle.  When re-launching, I am restoring all my states and all is OK - however, I can't figure out how to save my 'Scene', thus when I return, it always starts at the default screen which is the 'Main Menu'.

How would I go about saving my 'Scene' (into a Bundle)?

Code

import android.view.MotionEvent;

public interface Scene{

void render();
void updateLogic();
boolean onTouchEvent(MotionEvent event);

}

I assume the interface is the relevant piece of code which is why I've posted that snippet.

I set my scene like so: ('options' is an object of my Options class which extends MainMenu (Another custom class) which, in turn implements the interface 'Scene')

 SceneManager.getInstance().setCurrentScene(options);  //Current scene is optionscreen

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:
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:
TCP vs. Reliable UDP? Sending Reliable Packets in Fast-paced Multiplayer Games? I'm currently working on a networking framework for Unity3D in order to simplify making multiplayer games. I'm using UDP for any kind of synchronisation and unimportant data.

My question is: how do I send reliable packets such as RPCs or object instantiation?
Should I use TCP for that or should I go about writing my own reliable protocol on top of UDP?

Thanks in advance!

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:
Collision Detection problems for vertically moving platforms Background

My game is a static screen (ie, no scrolling) 2d platformer and my CD routine is split into 2 - after vertical movements, (ie, gravity etc) I check for collisions, and if they are detected, correct the sprite positions vertically.  Then after horizonal movements do the same thing, correcting any overlaps in the horizontal direction.

My CD code iterates through all the tile coordinates, and when it find a collision, it corrects the position, then exits and checks no more until the next game tic.

This works perfectly for static tiles, however, I've introduced platforms which are comprised of 3 horizontal tiles and which move up and down (ie, like an elevator).

The problem

The problem occurs if my character is standing 'over the edge' of a static block and then the elevator is moving up from under him - what I'm after is for the platform to 'catch' his over-hanging side and take him with it if you see what I mean.  However, what happens is that he gets shoved to the side.  I know why this is, but I'm not sure of the best way to correct it.

I think it happens because gravity is applied, pushing him into the static block, then the elevator move up so he is now embedded in 2 blocks.  The vertical CD routine detects the first overlap (say with the static block), corrects it and then moves onto the rest of the game logic (but now he is still embedded in the platform) - then it eventually gets to the horizontal collision detection which moves him out of the collision horizontally.  Please see my diagrams below, I hope these make it clearer.

Possible solution

Basically, I guess what I need is for the CD routine to carry on checking once it's corrected the first collision, but this would be so wasteful and 99% of the time it only needs to check one collision.  I thought about simply making it check through the tile coordinates twice, but like I say, this seems inefficient.  However, I'm trying to keep things as simple as possible and this seems the simplest solution.

Diagrams

Would appreciate any suggestions for how best to get around this........

sentences:
How does this data oriented design retain level data, while still offering cache-wise benefits? I'm almost sold on the concept of a data oriented engine; however, one thing still eludes me. If we pack the data from a large level into huge arrays, and go over them, any visibility system that we have would basically render most of it as unprocessable.

Consider this exert:

void do_stuff_with_data(data* vdata, const const_data* cdata, int count)
{
    for ( int i = 0; i < count; ++i )
    {
        if ( vdata->active )
        {
            ... process data
        }
    }
}

Considering that most of the data is not visible, and due to stuff moving around, there is no sensible prediction for how to order it, and branch prediction is screwed. Doesn't that void the cache-wise benefits?

I have read up on article dealing with this specific problem, but most of the sources just show the "big picture", completely disregarding this important issue.

sentences: Unreal Engine custom camera I was looking at game engines and found Unreal Engine. I want to make a game where the player has to create a camera by crafting it and can customize how many pixels the camera detects and what the camera detects (Ex: Sound, light, energy, etc). How could I do this?

sentences:
Physics Object on Client moving too quickly in comparison to the Server: Should be a copy I have a client server scenario. On the Server a force is applied to a 2d object. I want the client to copy the movements of the server but not through constant positional updates. My current approach is to send the objects name, position and speed to the client for the client to apply those to its own object and therefore copy the server. The speed is calculated by subtracting the last known position from the current one and working out the magnitude:

physicsManagerScript.SendInfo (transform.name, transform.GetComponent<Rigidbody2D>().position, (transform.GetComponent<Rigidbody2D>().position-lastPos).magnitude);

The position and speed are received via RPC and each go into a list on the client and then the client object applies these via Vector3.MoveTowards:

transform.position = Vector3.MoveTowards (transform.position, receivedPos [index], receivedSpeed [index]/Time.deltaTime);

My problem is that even though the same magnitude is applied on the client as the server, the clients object moves very quickly in comparison to its server counterpart. The server object bounces around and eventually slows, however when it is moving slowly the client object flashes to its new position. I dont understand why this is happening when it should be moving at the same speed as the server object. Any help would be greatly appreciated.

**Additional Info

I have an invokerepeating method on the server that every second sends the name, position and magnitude to a physics manager script. This physics manager script then RPC's the client sending the correct position and magnitude to the correct name of object. The client object places the received position and magnitude into seperate lists. Vector3.MoveTowards is then used to move the client object to its new position at a new speed. However the speed it moves at is very quick in comparison to the server, when i want it to copy the server. This is for a distributed physics project, ie the server handles the physics and sends down the appropriate info without the client using any physics.

sentences:
How to get the Exact Collision Point and ignore the collision (from 2 "ghost bodies") I have a very basic problem with Box2D.

For a arenatype game where you can throw scriptable "missiles" at other players I decided to use Box2D for the collision detection between the players and the missiles. Players and missiles have their own circular shape with a specific size (varying). But I don´t want to use dynamic bodies because the missiles need to move themselve in any way they want to (defined in the script) and shouldnt be resolved unless the script wants it.
The behavior I look for is as following (for each time step):

velocity of missiles is set by the specific missile script
each missile is moved according to that velocity
if a collision accurs now, I want to get the exact position of impact, and now I need a mechanism to decide if the missile should just ignore the collision (for example collision between two fireballs which shouldnt interact) or take it (so they are resolved and dont overlap anymore)

So is there a way in Box2D to create Ghost bodies and listen to collisions from them, then deciding if they should ignore the collision or should take them and resolve their position? I hope I was clear enough and would be happy about any help!

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:
Overcoming float limitations for planet-sized worlds in Unity As far as I know, going further than 1M units from the world origin in Unity is hardly possible due to floating point precision issues.

Making a world more than 1M units in radius would require either using double vars for coordinates or utilizing some space division technique to divide a massive scene into hierarchical chunks with the smallest of them being around 10 000 units, i.e. each world-space position would be expressed by the chunk hierarchy the object's in and a bunch of float vars representing its local position (and possibly rotation and scaling) inside the last chunk.

Either way, doing this would require implementing a completly new coordinate system, so I'd like to know whether or not that is possible in Unity, and if so, how may I make it work with existing Unity systems like physics and so on.

P.S I can't just move the world into origin as the player moves since I want to have things going on simultaneously around the planet.

Thanks!

sentences:
Minimum hardware requirements for developing for iOS and Android with Unity, Cocos2d-x and GameSalad on a Mac I intend to create iOS and Android games. My main priority is to create 2D games. The software that I’m planing to use are Unity, Cocos2d-x and GameSalad.

I am a bit interest in the Mac Mini, because it is cheap compared to other Apple machines. What are the minimum hardware requirements for an Apple machine?

sentences:
Implmenting RLE into a tilemap or how to create a large 3D array? Currently I've been using a 3D array for my tiles in a 2D world but the 3D side comes in when moving down into caves and whatnot. Now this is not memory efficient and I switched over to a 2D array and can now have much larger maps. The only issue I'm having now is that it seems that my tiles cannot occupy the same space as a tile on the same z level. My current structure means that each block has its own z variable. This is what it used to look like:

map.blockData[x][y][z] = new Block();

however now it works like this

map.blockData[x][y] = new Block(z);

I'm not sure why but if I decide to use the same space on say the floor below it wont allow me to.

Does anyone have any ideas on how I can add a z-axis to my 2D array?

I'm using java but I reckon the concept carries across different languages.

Edit: As Will posted, RLE sounds like the best method for achieving a fast 3D array. However I'm struggling to understand how I would even start to implement it? Would I create a 4D array the 4th being something which controls how many to skip? Or would the x-axis simply change altogether and have large gaps in between - for example [5][y][z] would skip 5 tiles? Is there something really obvious here which I am missing?

The number of z levels I'm trying to have is around 66, it would be preferable that I can have up to or more than 1000 in x and y.

sentences:
How do you assign a value of different roles in a game design project? A friend and I are building a game together and having a great time with it, and we hope to sell the product at some point. The prospects for actual earnings maybe be practically nil (and we aren't getting our expectations up), but regardless, we wanted to get some of the hard "profit splitting" questions out of the way.

Originally, my feeling was that we are both putting a full time effort into the game and would split the profits evenly. I am a programming and his role would be art and music/sound. Game design and concept generation is something we are both doing together. This has become complicated, as we are now looking at "hiring" a few other interested parties and we want to split any profit up fairly. We were looking at perhaps hiring another artist, and perhaps a sound person. We are not sure at this point what level of commitment our hired hands will be willing or able to commit.

So:

Our idea was to make a very large list of all tasks that need to be done across all categories (programming, marketing, art, sound, research, design, etc) and assign weighted values to each task based on the time requirement, difficulty/value of skill set required, and importance to the project.

Then, we can assign tasks to our hired hands and as they complete them, they would earn that percent of any profits that came in. My hope is that my original partner and I would divy up the "remaining" profit (the money our hired hands don't earn) equally when all is said and done. There's still a lot of details to work out, but our feelings were to divy things first into broad categories as follows:

14.81% - Marketing (PR, promotional campaigns, website)
 3.70% - Post-release support
18.52% - R&D (programming, tool development, engine development)
 7.41% - HR (hiring, dealing with any legal stuff, registering for digital distribution, etc)
18.52% - Art (all graphics and animations in the game)
11.11% - Sound (music + SFX)
18.52% - Game Design
 7.41% - Production (timesheet management, organizing meetings and project planning)

(The numbers are weird just because the calculated weights worked out that way)

I'm particularly interested in what others who has walked the same path as us feel. For the record, the game is a spin on the real-time strategic genre with a classic 16-bit look and feel.

Is this a sensible approach?
Are the numbers weighted reasonably in your mind? (I'm pushing for more value on game design and a little less on sound, myself)
How should be deal with changing requirements? We are estimating things as best we can currently, but we're all very new at this process, so there are sure to be areas we've over and underestimated.
Any generic advice appreciated!

Thanks everyone!

sentences:
How can i solve this artifact in CSM I have the next issue when a object is suspended in the air far enough of the ground.

How the algorithm works:

It checks if the coordinates in the light view matrix of this cascade are inside the the actual cascade's view ([0,1] interval).
If it is inside, it checks the depth to see if it is in shadow and finish.
If it is not, it checks the next cascade.

The coordinate that it is checking is actually inside this shadow cascade, but the cube lands just partially in this shadow cascade, and for this reason the surface is cut and you can see the floor that is at the other side of the cube, which is the floor that is checking to draw or not the shadow, producing this artifact.

Is it any way to solve it? I tried checking if the next cascade has lower depth but it cause other problems and artifacts that are even worse because of the glur effect and the lower precision of the next cascade.

It just happen with distant flying objects or high objects, anything else it works great.

sentences:
Animation conversion failed: transform for bone not found? I'm trying to animate my first humanoid, and the animations in the Standard Assets pack (HumanoidIdle etc) work really well right out of the box. However, when I try to use other fbx files, like those in Unity's "Raw MoCap Data" pack, I get errors.

I import the animations, select one, go to "Edit…" and go to "Rig", select "Humanoid", copy the avatar definition from the character I'm trying to animate (e.g. Robot Kyle), and under "Animations" I will get an error like "Imported file RunBackward conversion failed: Transform 'Left_Thigh_Joint_01' for human bone 'LeftUpperLeg' not found". When I compare the avatar of the character I'm trying to animate with the avatar that comes with the animations, they have the same bones defined, just with different names (which shouldn't matter, right?), so it's not that bones are missing. Using the animation with the default avatar also doesn't work, I get no error but my character goes into the first frame of the animation but then freezes. I've tried this with the standard models Ethan and Robot Kyle to the same effect.

Does anyone know how to handle this import error?

sentences:
Automatically setting tile variations in a 2D map editor I'm looking to make a map editor for a 2D strategy tile-based game (I am using OpenGL with SDL and writing the game in C). My game levels are made up of a set amount of different tiles, like a river tile, a mountain tile, a sea tile, etc.

A level is a struct holding the tiles like this:

struct Level {
    Tile[LEVEL_ROWS_AMOUNT][LEVEL_COLUMNS_AMOUNT];
    ....

I initialize the level by filling it with a plain default tile. Then I just iterate every tile and render them one by one.

Every one of these tiles always has the same properties no matter what, BUT should look different depending on the tiles surrounding them. For example, if a river tile has a river tile to its left and to its bottom, it should take a top-right corner "L" shape appearance, while the river tile to the left should be horizontal and the one to the bottom should be vertical.

Here's an illustration of what I mean:

All of my tiles' visuals are loaded into a single sprite sheet image, and I have a JSON file pointing to the coordinates of every tile inside the image, where every entry looks like this:

{
"variations": {
    "horizontal": [
        {
            "x": 32,
            "y": 0
        }
    ],
    "top_right": [
        {
            "x": 320,
            "y": 96
        }
    ],
    ...
},

So every tile I place down in my game has multiple possible visual variations, and I'm able to manually set which one a given tile should have. But like stated above, I would like to make this process automatic upon placement of the tile.

What would be a good way to implement this? I have a good amount of unique tiles (around 20 or so) and most of them would require unique logic. I'll also probably be adding more tiles in the future, so I'm hoping I can find a way that doesn't involve long hard-coded if statements.

sentences:
fast 3d point -> cuboid volume intersection test Im trying to test whether a point lies within a 3d volume defined by 8 points. I know I can use the plane equation to check that the signed distance is always -1 for all 6 sides, but does anyone know of a faster way or could point me to some code?

I should add that ideally the test would produce 3 linear interpolation parameters which would lie in the range 0..1 to indicate that the point is within the volume for each axis (since I will have to calculate these later if the point is found to be in the volume)

sentences: UDK - deferred rendering? I plan to use UDK on PC to create commercial game. Can I use deferred rendering in UDK? Or it's only available with expensive UE3 license?

sentences:
Move around the object using head tracking movement in Unity I am developing an app for Samsung Gear VR with unity.I have added a cube and made the cube move forward on the terrain.

Now I need to move around the cube using head tracking movement.I have referred the below link(Flyer VR movement) .But I am not able to understand the code used in it.

https://unity3d.com/learn/tutorials/topics/virtual-reality/movement-vr

Can anybody help me doing this in a simple way to move around the cube by head tracking

sentences:
In OpenGL what's quicker, lots of smaller VAOs, or one large one updated each frame? In my game engine, a mesh can be made of many submeshes. These submeshes may or may not share vertex data with the rest of the mesh, if they don't they have their own vertex data array.

I've noticed that rendering a mesh with many submeshes that don't share vertices is incredibly slow. This is because each submesh has it's own VAO (and vertex/index VBO pair).

The alternative is to gather the vertices and indices into one pair of VBOs and update them every frame. But will this be much faster?

Is it faster to create one large VAO and update it every frame, or to render many small ones which don't need updating each frame?

sentences:
in unity, lightmap comes out blurry on android device as you see, shadow is blurred. (see the tree's shadow)

What settings should I add?

sentences:
HLSL - Creating Shadows in 2D The way that I create shadows is by the following technique:
http://www.catalinzima.com/2010/07/my-technique-for-the-shader-based-dynamic-2d-shadows/

But I have questions to HLSL. The way that I currently do it is, I have a black and white image, where Black means 'object', and white means 'nothing'. I then distort the image like in the tutorial. I do this with a pixel shader, but instead of rendering to the screen, I render to a texture, back to my application. I then take this, and create the shadows, and then send it back to the graphics card to undo the distortion, after the shadow has been added - this comes back and I have a stencil of shadow. I can put this ontop of the original image and send them back to the graphics card, which then puts them on the screen.

To me this is alot of back and forth. Is there a way i can avoid this?

The problem that I am having is that I need to basically go through all positions in the texture 3 times, and use the new new texture every time instead of the orginal one. I tried to read up on Passes, but i don't think that i am heading in the right direction there.

Help?

sentences:
phaser.io mouse cursor sprite I am trying to build a game and i want people to be able to select stuff with a pointer but i don't want it to be just an ugly looking default pointer so i wrote this code to try and get a image as it

first i loaded the image

game.load.image('selector', 'assets/img/pointer.png')

then I put it into my game

selector = game.add.sprite(game.world.centerX, game.world.centerY, 'selector')

and then in my render() function i do this

selector.x = game.input.x;
selector.y = game.input.y;

it moves fine with my mouse but with one problem

my game is designed so that i have to use a camera that follows my character because the map is bigger than the view

so since for some reason my sprite always starts at 0,0 it can only move 800x600px since thats all that the canvas sees the mouse in so i need a way to fix this but i'm not sure how to do this because i am new to phaser

sentences:
Does a 2D Vector or 2x2 Matrix play any role in 2D Transformations? I'm having trouble trying to figure out if a vec2 or mat2 class are used at all in transformations for 2D rendering. Vec2, apart from representing UVs, AFAIK, is relatively pointless in regards to homogeneity.

What about 2x2 Matrix? I guess if we're hanging on to temp variables for shear, scale, and/or rotation it could make sense, but I'm feeling like I'll never use it.

It isn't much effort to implement, but I'd like to know if I'm missing something, or if Vec2 and Mat2 are largely useful for representing objects in 2D space.

I do know that a 3x2 or 2x3 matrix is a more data efficient* way to store the data for affine transformations-- does vec2 have any utility in these sort of cases?

Or is this even true? Do alignment optimizations negate this advantage? Or is it only true for the data that we transfer into OpenGL?

sentences:
How do multiple expansions to a game typically should be implemented? Let's say I have a game that's finished and shipped, what would be the approach that is typically taken in regards to future content such as expansions? I'm not talking about programmatic implementation. I'm talking about how to integrate it to the base game, especially for multiple expansions.

If I finished making Expansion Pack 1 which adds new locations, new quests that tie in to the base vanilla game, etc, and then later down the line, I finish Expansion Pack 2 as well, how do I handle if the player only bought Expansion Pack 2 without making it feel disjointed in relation to the lack of Expansion Pack 1?

Or should I make all older expansions mandatory before being able to use the latest one?

In short, I'm trying to wrap my head around implementing multiple expansions without any of the expansions being mandatory but at the same time, I don't want them to feel "tacked on" to the base game as a side content (meaning, they should be integrated into the game's world). I want them to feel like an actual part of the world. Just that they're optional.

sentences:
Rotate an object smoothly by using Accelerometer Input in Unity There is a simple script where the object orientation is equal to the mobile devices orientation.

it works but the object doesn't rotate smoothly.

void FixedUpdate()
{
    float accelx = Input.acceleration.x;

    float angle = Mathf.Asin(accelx) * Mathf.Rad2Deg;

    transform.eulerAngles = new Vector3(angle , 0, 0);
}

How to rotate an object smoothly by using Accelerometer Input ?

sentences:
What's the difference between using hardware-accelerated APIs and the OS's drawing API? On Windows, I can do drawing with the OS API without OpenGL or D3D. The code I am writing will make calls to a device driver and tell the GPU what to do regardless, right?

How is using OpenGL different exactly? Do these libraries have code that will interact with the GPU differently than just the Windows API does?

sentences:
If online games use permalinks I'm trying to figure out how to accurately capture the state of the web app by a URL, similar to something like https://jsfiddle.net/, where they create https://jsfiddle.net/foobar123 a custom ID for the code you load, and you can share that with anyone and they can run the code. However, it's not a live, interactive thing, so it makes sense to do it that way.

But I'm wondering what games do. I don't really play games so I am not aware how browser-based games use the URL. I'm interested to know if, when you want to start back your game (I'm imagining WoW, though I've never played it), you just go to wow.com and click "start" or "join", and there is no URL involved at all. Or perhaps instead of that, you go to wow.com/123foobar to go to your last saved state, and it loads up the environment as it last was.

I'm not wondering for WoW specifically, just generally any game, if they use the URL to persist state, and if so, how (roughly speaking). Some simpler games like agar.io don't seem to use the URL; if you refresh, you lose your spot and have to start over.

I'm not really sure how a game could save the dynamically evolving state in a URL, which is why I'm interested to see if any of them do.

Another related example is a Collaborative Markdown Editor. I don't know if they dynamically change the URL though to reflect the state, I doubt it.

sentences:
How to create a line that is always connected to two Objects. (iPhone, Cocos2d) I'm wanting to create a rope like animation effect. I don't need any kind of rope physics, all I need is a straight line connected to Object A and the other end connected to object B. Object A and B move relative to one another. So how do I make it so that the line is always attached to both Objects, even thought the distance between the objects decrease and increase?

The game is in 2D space.

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:
Editor-Assignable function pointer in UE4 C++? So I have a TriggerBox that I'm using as a pressure pad, and I want to be able to attach objects to it that, when the TriggerBox is activated, will have specific functions called. Similar to unity's UI buttons, where you can assign a function to be called when the button is clicked.

I am working as the sole programmer, and the rest of my team are designers. They need to be able to assign the object's function to the TriggerBox from within the editor.

I have attempted to use C++'s function pointers, but I have not been able to find a way to make them assignable in the editor.

Is there a solution to this? If not, any suggestions on better ways to do this?

sentences:
ecs network synchronization I'm working on implementing combat into my isometric rpg game which uses an ecs architecture. When synchronizing the actions of the different clients, is it preferable to serialize and synchronize raw components, actions or a mix of both.
For example, an action might be "entity X attacks entity Y", whereas the components approach would need to send stuff more like raw component state (which animation to play, frame, sound, etc). I currently use an action-based approach for movements, and that works very well locally, but implementing combat this way seems more difficult as systems become more complex and components are added down the road, and I want to be as aware as I can about possible friction now.

sentences:
How can I prevent picking up health items when I'm already at max health? This is what I have so far..

public class Per10HealthCollect :MonoBehavior

    void OnTriggerEnter(Collider other)
    {
        if (GlobalHealth.healthValue >= 91)
        {
            GlobalHealth.healthValue = 100;
        }
        else
        {
            GlobalHealth.healthValue += 10;
        }
        GetComponent< CapsuleCollider>().Enabled = false;
        this.gameObject.SetActive(false);
    }
}

sentences:
Is there a standard way to store 3D meshes to easily communicate between libraries? In a 3D game lots of different systems need to know about geometry data, however the only way they seem to be able to agree to on in representing it by an array of triangles.

Can anyone recommend a good geometry manipulation library that will allow me to easily integrate the drawing library(OpenGL), the physics engine(Bullet), Serialization(Several 3D file formats) and my own code(objective-c++).  Focus on the a representation between the drawing library and the physics engine.  Also if the library can triangulate a mesh definition that would be very helpful.  My code can work around what exists already.

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:
How should I choose between Vec3 and Vec4? I find myself torn between using Vec3's vs Vec4's for representing position, directions, etc in my non-gpu code. I see the obvious benefit of using Vec3s for stuff like data in buffers, to more tightly pack mesh data, reducing memory used.

The primary motivation for switching from Vec3 to Vec4 is to reduce the tedius conversions back and forth. For example the math library I am using (GLM) only lets mat4's multiply with vec4's.

I realise it dosn't make sense to have a fourth component in say a direction vector, and to make the distinction between say a position and a direction vector becomes more important.

It's not a big issue, but nonetheless I am curious is there any significant pros or cons between using vec3's or vec4's? What makes the most sense to other users?

sentences:
Setting a texture's "Max Size" while ensuring that its dimensions are still multiples of 4 A version of my game has several large textures with dimensions that are multiples of 4 so that Crunch compression can kick in.
A ported version of my game, for platforms that have very limited RAM restrictions, will need us to limit the "Max Size" of our textures to 512 or 256, etc.
There are some cases in which a Crunch-friendly texture, when resized by Unity's "Max Size" parameter, will actually end up with dimensions that aren't multiples of 4.
944x800 would end up as 512x434, if we select "512", which isn't good for Crunch.
The naive solution in my mind is to write a simple script/tool that resizes/pads all my textures by a couple of pixels in such a way that Unity's resize will end up in a Crunch friendly way. However, I'd rather do that as a last recourse if possible.
Is there a more standard way to approach this situation of mine?

sentences:
OpenGl indices array I have a class terrain which create a grid of Quads. I do it like this

for(int z=0; z<_length;z++){
            for(int x=0; x<_width;x++){
                vertices.push_back(vec3((float)x*250, 0.f, (float)z*250));
    }
}
for(int z=0; z<(_length-1);++z){
    for(int x=0; x<(_width-1);++x){
        int index = z*_width+x;
        Vertex _vertices[] = {
            Vertex(vertices.at(index),vec3(0, 0, 0)),
            Vertex(vertices.at(index+1),vec3(0, 0, 0)),
            Vertex(vertices.at(index+_width),vec3(0, 0, 0)),
            Vertex(vertices.at(index+1+_width),vec3(0,0,0))
        };

        unsigned short indices[]= {index,index + 1,index +
            _width,index + 1,index +  _width,index +  _width + 1};
        Quad quad(_vertices, 4, indices, 6);
        squares.push_back(quad);
        i++;
    }
}

The vertices and the logic are correct, but the indices aren't, for some reason. here is the output for this code :

But when I change this indices to this :

            unsigned short indices[]= {0,1,2,1,2,3};

It works great :

The problem is I don't understand why this line

        unsigned short indices[]= {index,index + 1,index +
            _width,index + 1,index +  _width,index +  _width + 1};

doesn't work. And if it worked, my grid would consume a lot less ressources. If someone could explain me why it doesn't work, It would be great, thanks you.
In case you need to know how I draw a Quad, here is the code :

class Quad{
public:
    Quad(Vertex *_vertices, int _n, unsigned short * _indices, unsigned short _numIndices){
        for(int i=0; i < _numIndices; i++){
            indices.push_back(_indices[i]);
        }

        for(int i=0; i<_n; i++){
            vec3 v = vec3(_vertices[i].position, _lengthPower);
            position.push_back(v);
        }
        glGenVertexArrays(1, &mVertexArray);
        glBindVertexArray(mVertexArray);

        glGenBuffers(1, &mPositionBuffer);
        glBindBuffer(GL_ARRAY_BUFFER, mPositionBuffer);
        glBufferData(GL_ARRAY_BUFFER, sizeof(vec3)*position.size(), position.data(), GL_STATIC_DRAW);

        glGenBuffers(1, &mIndicesBuffer);
        glBindBuffer(GL_ELEMENT_ARRAY_BUFFER, mIndicesBuffer);
        glBufferData(GL_ELEMENT_ARRAY_BUFFER, sizeof(unsigned short)*indices.size(), indices.data(), GL_STATIC_DRAW);

    }

    void draw(){
        glEnableVertexAttribArray(0);
        glBindBuffer(GL_ARRAY_BUFFER, mPositionBuffer);
        glVertexAttribPointer(0, 4, GL_FLOAT, GL_FALSE, 0, 0);
        glBindBuffer(GL_ELEMENT_ARRAY_BUFFER, mIndicesBuffer);
        glDrawElements(GL_TRIANGLES, indices.size(), GL_UNSIGNED_SHORT, 0);
        glDisableVertexAttribArray(0);

    }
    ~Quad(){

    }
private:

    std::vector<unsigned short> indices;
    std::vector<vec3> position;
    GLuint mVertexArray;
    GLuint mPositionBuffer;
    GLuint mIndicesBuffer;
};

I'm using, OpenGL, glm, glfw etc.

sentences:
Multiple traversal of a component-based hierarchy Let's say a game use a component-based hierarchy to store all of its entities.
So it can have objects, characters, lights organized in some kind of tree.

When rendering the game, it needs to first render objects, then lights. So it needs to first traverse the hierarchy and render all the objects it finds, then traverse a second time to render all the lights it finds.
What is a better way to do this? If the hierarchy has thousands of entities, it could be slow to traverse twice the tree.

I thought about having two lists, one containing objects to render, the second one being lights. Each time the user adds an entity to the hierarchy, it adds it to the corresponding list. This way, the game only have to traverse the object list then the light list, without traversing useless entities.

What is the best option?

sentences:
How to deal with collision detection result I have a render loop. In it I always call the update() method which moves all the objects in their own directions. Then after that I call checkCollision on each object with each object like that:

for (GameBodyObject gbo1 : objects) {
   for(GameBodyObject gbo2 : objects) {
      if(!gbo1.equals(gbo2)) {
         gbo1.checkCollision(gbo2);
      }
   }
}

btw I am using Circle as collider

now in checkCollision I first check if they collide and then if yes I calculate the displacement like this:

if(CircleCollider.collide(p1, r1, p2, r2)) {
   double totalR = r1 + r2;
   double a = new Vector(p1.getX() - p2.getX(), p1.getY() - p2.getY()).getAngle();

   double intersection = Math.abs(totalR - p1.distance(p2));

   return new Vector(Math.cos(a) * intersection, Math.sin(a) * intersection);
} else {
   return new Vector(0, 0);
}

then I move the GameBodyObject by this displacement vector like this:

public Point moveByVector(Vector v) {
    if(v.getX() == 0 && v.getY() == 0) {
        return this;
    }
    double a = v.getAngle();
    double l = v.getLength();
    x += l * Math.cos(a);
    y += l * Math.sin(a);
    return this;
}

However I get a bouncing effect so the one gameBodyObject goes into another gameBodyObject and back and again into that gameBodyObject and back. I want it to stop, not to bounce.

How could I do that?

One way that come up to my mind is that I will check for collision in the update() function directly and if it occurs I won't move the guy, but then it may get stuck if he runs into another gameBodyObject...

How should I deal with that?

(BTW did you play Dota 2? I want the mechanics similar to that game so that one player can block another player and trees are static so they don't move so the player can't push them instead he stops...)

sentences:
Unity 2D Bullet AddForce does not work I got the following code :

public ParticleSystem PS;
public GameObject origin;
public float thrust = 1.0f;
public GameObject bullet;
private GameObject _bullet;

// Use this for initialization
void Start () {

}

// Update is called once per frame
void Update () {
    if (Input.GetMouseButtonDown(0))
    {
        Debug.Log("Pressed left click.");
        PS.Play();
        _bullet = Instantiate(bullet, origin.transform.position, origin.transform.rotation);
        _bullet.GetComponent<Rigidbody2D>().AddForce(origin.transform.forward * thrust);
    }
}

Where everything is working except the AddForce, the bullet is just dropping out of my weapon. I've made some research and my script seems to be correct. The bullet has attached a circle collider and a rigidbody2D.

Update: This did not change anything :

_bullet.GetComponent<Rigidbody2D>().AddForce(origin.transform.forward * thrust, ForceMode2D.Impulse);

And this neither :

_bullet.GetComponent<Rigidbody2D>().velocity = origin.transform.forward * thrust;

It's weird, because all of these should work actually.

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:
How do I move the camera in 2D LWJGL openGL? I am making a top-down rpg game with the LWJGL but I can't figure out how to make the camera follow the player. I've tryed using GLU.gluLookAt() but it seems to be designed for 3D and when I try it with my game everything currently on the screen disappears. I have no idea where the camera gets moved to. Please explain simply how to use GLU.gluLookAt() or a better alternative to move the camera.

public class Camera {

    public float x = 0;
    public float y = 0;

    public void moveCamera(float toX, float toY){
    GLU.gluLookAt(x+toX, y+toY, 0.0f, 0.0f, 0.0f, 0.0f, 0f, 1f, 0f);
    }
}

sentences:
How i can sign and/or group a specific set of vertices in a 3D file container like OBJ ? - in Blender I would like to export a 3D model with each part having a name or a label if you will.

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

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

sentences:
What is the line between a serious game and an application with points? Gamification has become a buzz word lately and is being applied to everything from applications to meetings.  In many cases it is being done as an afterthought and sort of game-washing.

What are the key differences between something having real game dynamics and simply being a superficial gamification layer?  Where is the line between a serious game and an application with points?

sentences:
XNA Automatic Collision detection from model? This is going to be a rather vague question xD

In XNA is there a way of working out if a point or rectangle is colliding with a 3D .x object? It is a big model, and would take a long time to map out all the rectangles for collision detection so I was wondering if there was a easier way of doing it :)

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:
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:
Bloom only colors with at least one value equal to 1, I want to bloom/blur any color that has a 1 in it,

like (1,0,0) and (1,0,1) etc.

The script bellow blooms any color over a threshold,
but what I want blooms only specific colors.

'Selective bloom'

uniform sampler2D bgl_RenderedTexture;
const float BRIGHT_PASS_THRESHOLD = 0.55;
const float BRIGHT_PASS_OFFSET = 0.08;

#define blurclamp 0.002
#define bias 10.8
#define KERNEL_SIZE 6.0

vec2 texcoord = vec2(gl_TexCoord[0]).st;

vec4 bright(vec2 coo)
{
  vec4 color = texture2D(bgl_RenderedTexture, coo);
  color = max(color - BRIGHT_PASS_THRESHOLD, 0.0);
  return color / (color + BRIGHT_PASS_OFFSET);
}

void main(void)
{
  vec2 blur = vec2(clamp( bias, -blurclamp, blurclamp ));

  vec4 col = vec4( 0, 0, 0, 0 );
  for ( float x = -KERNEL_SIZE + 1.0; x < KERNEL_SIZE; x += 1.0 )
  {
    for ( float y = -KERNEL_SIZE + 1.0; y < KERNEL_SIZE; y += 1.0 )
    {
      col += bright( texcoord + vec2( blur.x * x, blur.y * y ) );
    }
  }
  col /= ((KERNEL_SIZE+KERNEL_SIZE)-1.0)*((KERNEL_SIZE+KERNEL_SIZE)-1.0);
  gl_FragColor = col + texture2D(bgl_RenderedTexture, texcoord);
}

is the script I was trying to edit, but I don't know GLSL (I know python)

sentences:
Screen coordinates to isometric coordinates? I know this has been discussed here before, but I couldn't find an easy solution for my particular problem. I have a tile system and I'd like to convert screen coordinates into isometric tile coordinates. Here's an image to explain what I need:

As you can see, the coordinates are between 0 and 1. I can't figure out a formula for the conversion though. Can you guys help me?

sentences:
Suitable SDK to develop quick game? I'm currently undertaking a personal project at home that I need to turn around inside the next few months (which working full time and still learning programming makes it a tad difficult). I'm looking for suggestions on SDK's or tools (preferably free or that come with games, similar to steam tools) that I can use to develop a "game". I'm OK with coding but have no 3D development skills at all.

I've very little experience with mod tools or SDK's at all but I'm hoping someone can point me in the direction of one that does the following:

A decent library of prefab 3D models to build scenes.
Ability to add scripting to the scene

I've used Unity before and would prefer to continue to do so however I really have the worst 3D skills imaginable and can't waste time learning them.

I'd be looking for pre-fab items that are both industrial and possibly more lush environments (trees etc). If it makes any difference (due to licencing and what-not) I WILL NOT be selling this game or marketing it in any way and I am a University Student if any places do educations licences.

Another alternative would be to source free 3d models elsewhere but again while I'm still learning I have no idea where to look if someone could point me in the right direction I'll do the rest of the digging.

Thanks

sentences:
Rendering a model with transparent or translucent uv map applied doesn't work Before I try to make anything transparent, the model renders nicely. When I change the uv layout so that one piece of the model will be transparent, it renders horribly. This is the result with a translucent green texture:

I did transparency with OpenGL when I did 2D games and everything worked nicely because of these two lines:

glEnable(GL_BLEND);
glBlendFunc(GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA);

Now, I fear, this won't be enough, right? Or maybe I should use some other technique?

sentences:
OpenGL FBO, render off screen and texture I need to do some offscreen render to use the rendered image in something different from OpenGL context (for instance I need to use the image in a QListWidgetItem inside a Qt application). After documenting a little bit I've found that Frame Buffer Object (FBO) is what I have to use in combination with glReadPixels for getting the raw image from OpenGL/GPU into my application. So, here I am against FBO.

I've found that I need to attach the FBO to a texture otherway it does not work and glCheckFramebufferStatus gives me: GL_FRAMEBUFFER_INCOMPLETE_DRAW_BUFFER. So when I try to init the FBO I need to add also glGenTextures and glBindTexture etc..

But.. why? I don't need a texture for now.. why do I have to declare/init/bind (don't know what is the best word here) a texture?

What is the "minimal" FBO setting for get the images? And what about if in my application I need also stencil or depth images? Are things different?

And using back buffer instead of FBO? Is it slower? Do I still need a texture?

I'm kind of afraid of using textures because of a lot of parameters () I don't understand for now..

Sorry for confusion..

sentences: When trying to render a texture in opengl after including the stb_image.h file in the project i get a linker error Initially i gave the path of the stb_image.h & stb_image.c file location C/C++ include directories as adding the header file directly to the project was not working.

sentences: How to achieve graphics like those in Spy Mouse I'm really interested in making a new application for iPhone, and I have some experience in objective-c. My main problem is the visual part. I want to have graphics like in Spy Mouse. Could this be achieved using simple 2D graphics? Or would I need to use 3D, and just show it from this perspective?

sentences:
Accelerometer bike game rotation help Hi I've been making a game for the last few months and not sure what to do.

It's a 2d bike game and I want the rotation done with accelerometer, at the moment To test on computer I've set the rotation up as if left is hit transform.rotate to the left but because gravity my bike will not stay doing a wheelie.

Is there another way to do this can I just set up that the rotation of the bike is equal to the screen rotation? Or do I need the bike to stay in the air first and then when rotated right it goes right ect?

Really not sure and have been stuck on this for a month noob to unity too thanks

sentences: Create BGRA texture SFML I have a texture sfml but this texture have a format RGBA how i can change it to BGRA? Or how to create texture with need able format for me?

sentences:
Why is my texture array getting only the last link index? Here's my code:

[SerializeField] GameObject[] uitex = new GameObject[3];

void GetTextureFromServer()
{
    string dealer_img = "";

    for (int i = 0; i < PlayInfo.Instance.gametablelist.Count; i++)
    {
        dealer_img += PlayInfo.Instance.gametablelist[i].dlrimage;
        dealer_img += ",";
    }
    Debug.Log("HERE ARE THE LINKS : " + dealer_img);

    string[] links = dealer_img.Split(',');

    for (int j = 0; j < links.Length - 1; j++)
    {
        Debug.Log("HERE ARE THE NEW LINKS : " + links[j]);

        new BestHTTP.HTTPRequest(new System.Uri("*************************amazonaws.com/resources/" + "dealer/pic/" + links[j]),
        (BestHTTP.HTTPRequest req, BestHTTP.HTTPResponse res)
        =>
        {
            for (int k = 0; k < uitex.Length; k++) {
                var tex = new Texture2D(20, 20);
                tex.LoadImage(res.Data);
                uitex[k].GetComponent<UITexture>().mainTexture = tex;
            }
        }).Send();
    }
}

The problem with this code is that it's only getting the last index of my links. What could be the problem on my iteration?

Here's an approach that works that shows what the expected behavior is:

 for (int i = 0; i < tzPlayInfo.Instance.bc_gametablelist.Count; i++)
{
    dealer_img += tzPlayInfo.Instance.bc_gametablelist[i].dlrimage;
    dealer_img += ",";
}
string[] newLinks = dealer_img.Split(',');

new BestHTTP.HTTPRequest(new System.Uri("**************************.amazonaws.com/resources/"
    + "dealer/pic/" + newLinks[0]),
    (BestHTTP.HTTPRequest req, BestHTTP.HTTPResponse res)
    =>
    {
        var tex = new Texture2D(20, 20);
        tex.LoadImage(res.Data);
        uitex[0].GetComponent<UITexture>().mainTexture = tex;
    }).Send();

new BestHTTP.HTTPRequest(new System.Uri("**************************.amazonaws.com/resources/"
    + "dealer/pic/" + newLinks[1]),
    (BestHTTP.HTTPRequest req, BestHTTP.HTTPResponse res)
    =>
    {
        var tex = new Texture2D(20, 20);
        tex.LoadImage(res.Data);
        uitex[1].GetComponent<UITexture>().mainTexture = tex;
    }).Send();

new BestHTTP.HTTPRequest(new System.Uri("**************************.amazonaws.com/resources/"
    + "dealer/pic/" + newLinks[2]),
    (BestHTTP.HTTPRequest req, BestHTTP.HTTPResponse res)
    =>
    {
        var tex = new Texture2D(20, 20);
        tex.LoadImage(res.Data);
        uitex[2].GetComponent<UITexture>().mainTexture = tex;
    }).Send();

new BestHTTP.HTTPRequest(new System.Uri("**************************.amazonaws.com/resources/"
    + "dealer/pic/" + newLinks[3]),
    (BestHTTP.HTTPRequest req, BestHTTP.HTTPResponse res)
    =>
    {
        var tex = new Texture2D(20, 20);
        tex.LoadImage(res.Data);
        uitex[3].GetComponent<UITexture>().mainTexture = tex;
    }).Send();

It's working perfectly, but now the problem is that it is not very clean code.

sentences:
How can i get component script from FirstPersonCharacter? In the Hierarchy i have a FPSController and as child of it FirstPersonCharacter.
I can get script that attached to the FPSController but not from the FirstPersonCharacter.

What i want to get is the Blur script from the FirstPersonCharacter.

using System.Collections;
using System.Collections.Generic;
using UnityEngine;
using UnityStandardAssets.Characters.FirstPerson;

public class FadeScript : MonoBehaviour
{
    public CharacterController firstPersonCharacter;
    public FirstPersonController fpc;
    public float fadeDuration = 5;
    public float speed;

    private Material material;
    private float targetAlpha = 0;
    private float lerpParam;
    private float startAlpha = 1;
    private bool rotated = false;

    void Start()
    {
        material = GetComponent<Renderer>().material;
        SetMaterialAlpha(1);

        fpc.enabled = false;
    }

    void Update()
    {
        lerpParam += Time.deltaTime;

        float alpha = Mathf.Lerp(startAlpha, targetAlpha, lerpParam / fadeDuration);
        SetMaterialAlpha(alpha);

        if (alpha == 0)
        {
            fpc.enabled = true;

            if (rotated == false)
            {
                fpc.GetComponent<FirstPersonController>().enabled = false;
                fpc.transform.localRotation = Quaternion.Slerp(fpc.transform.rotation, Quaternion.Euler(0, 0, 0), speed * Time.deltaTime);
            }

            if (fpc.transform.localRotation == Quaternion.Euler(0,0,0))
            {
                fpc.GetComponent<FirstPersonController>().enabled = true;
                firstPersonCharacter.GetComponent<Blur>
                rotated = true;
            }
        }
    }

    public void FadeTo(float alpha, float duration)
    {
        startAlpha = material.color.a;
        targetAlpha = alpha;
        fadeDuration = duration;
        lerpParam = 0;
    }

    private void SetMaterialAlpha(float alpha)
    {
        Color color = material.color;
        color.a = alpha;
        material.color = color;
    }
}

I can get scripts from the FPSController like this:

fpc.GetComponent<FirstPersonController>().enabled = true;

But i can't get the Blur script from the firstPersonCharacter.
I tried before instead:

public CharacterController firstPersonCharacter;

With GameObject:

public GameObject firstPersonCharacter;

But Blur is not exist. When i make GetComponent The Blur is not exist.

sentences:
Unity3D GUILayout Window Wont Show Components I am fairly new to Unity, but picking things up quick. This is actually one of the first problems I have come across that has me stumped.

I am trying to print a good amount of components onto my GUI on top of my window.

Although, I can only see half of only one component at the upper left hand side of my window, in which the label says "Name". I can actually only see Na and half of the m.

(If I do NOT use the window, and just paint my components out on my OnGUI everything will paint just fine and looks exactly how I want)

To me, this sounded like some sort of Rect(); issue or something along the lines of the width and height not being set properly...Although they are.

Ill provide all the code that has any relation to the GUI. (There is only one object this script is attached to and it inherits from MonoBehavior)

You will notice that the Rects() or any Width/Hieght will be set to some high number, it was just to make sure it wasnt that line of code screwing up my window.

public GUISkin mySkin;
public Rect windowRect = new Rect();

void OnGUI() {
    GUI.skin = mySkin;
    DisplayBox();
}

private void DisplayBox() {
     windowRect = GUILayout.Window(0, windowRect, DoMyWindow, "", GUILayout.Width(800));
}
void DoMyWindow(int windowID) {
    DisplayName();
    DisplayPointsLeft();
    DisplayAttributes();
    DisplayVitals();
    DisplaySkills();
    DisplayCreateButton();
    DisplayResetButton();
}

These functions in the DoMyWindow just call GUI.Component statements to paint the gui.

Like I said above, if I dont use the window everything works perfect.

Also, you'll notice that the windowRect has no params. Its public and they are altered to extremely high numbers in the inspector. Still no result

What am I doing wrong?

sentences:
How to make non-standard sized zones for a procedurally generated 2d map? I am making a procedurally generated map with different zones (plains, forest, village, etc) and am currently just designing each one as a square zone. However, I think it'd be neat if the zones were more randomly distributed so that they could be irregular sizes. I'm not sure how to do that in a good way. (Any given tile needs to know what zone it belongs to quickly and deterministically based on its x, y, and random seed for the world)
Are there existing algorithms for this?

sentences:
Designing client-server to mitigate hosting advantage? My game will be client-server, and I'd like to prevent the hosting player from enjoying the usual benefits you'd associate with playing on a server.  For example, the advantage of the server running ahead of time compared to clients.

Are there simple ways of mitigating host advantage?  Or do I have to make something complicated?  My naive solution would be having the host run a "ghost" state, and a client state, on the same map.

The ghost state is an authoritative server simulation, it doesn't render the simulation which remains invisible, but does run ahead of time making calculations and decisions as usual.  The host also plays a client on the same map, in which their input is regarded as any other client across the network, and like any other client is required to wait for the server simulation to make and transmit outputs.  And so the host doesn't enjoy an advantage because they aren't playing the simulation which is making executive decisions on the game state ahead of client time.

Has this solution been done by any other games, or is there a better way of handling the problem?

sentences:
How to decelerate Ship using Vector Objects in Java I am developing an Asteroids type game in Java, using a custom Vector2D class for the Ship. I have a vector object for its position, direction and velocity. I am having an issue with the ship deceleration, currently when there is no thrust (forward key is released) then I multiply my velocity vector by the Drag constant which is 0.3. However the ships speed does not decelerate and will stop abruptly instead, upon releasing the thrust key.

Here is the update method in my Ship Class:

public void update() {
    velocity = new Vector2D(direction);

    if(ctrl.action().turn > 0) {
        direction.rotate(ctrl.action().turn / STEER_RATE);
    }
    else if(ctrl.action().turn < 0){
        direction.rotate(ctrl.action().turn / STEER_RATE);
    }

    //Acceleration
    if(ctrl.action().thrust == 1) {
        velocity.addScaled(direction, DT).mult(MAG_ACC);
    }
    //Deceleration
    else if(ctrl.action().thrust == 0){
        velocity.mult(DRAG);
    }
    position.addScaled(velocity, DT);
    position.wrap(FRAME_WIDTH, FRAME_HEIGHT);
}

Contructor:

public Ship (Controller ctrl) {
    centerX = FRAME_WIDTH/2.0;
    centerY = FRAME_HEIGHT/2.0;
    this.ctrl = ctrl;
    position = new Vector2D(centerX, centerY);
    direction = new Vector2D(position).normalise();
    velocity = new Vector2D(direction);
}

I'd like to ask how I can slow the ship velocity rather than it losing all of its speed instantly. If more code is required I am happy to show it.

sentences: Line Rendere Default Pink Color still Visible I am using the line Renderer for shooting in my game. Everything works well except for the fact that the default pink color is still visible. I have a Material set, so I do not think it is a problem of materials lacking. Someone Help please.

sentences:
Is it a good idea and a logic to create adventure game with one scene? I mean instead messing with loading scenes and passing variables between the scenes to make one scene and using in the hierarchy empty game objects for each part in the game for example empty game object name main menu and all the childs of it will be main menu objects.

Or instead making a new scene to make one empty gameobject and all it's childs will be like scenes.

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:
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:
What is a good format for a 3d topview map? I am building a 3d topview game like GTA2. In this game the ground is mostly one level (except for tunnels and highways). Most of the ground is also city so the ground is usually covered by either roads or buildings. The buildings are simple 3d models which the player can walk around on. Most of the gameplay is 2d.

How should I model the map? I have considered the following options:

Bitmaps, I think this gives problems when I want to add data smaller than a tile. Also the problem of bridges and tunnels seems hard to solve with this.
Polygons, define all roads, terrain types, buildings with polygons and save that along with physics and texture information.

What approach would you take or have you ever implemented this or know of an implementation?

sentences:
How do OpenGL's texelFetch and texture differ? I understand the main differences between texelFetch and texture, but have some questions about the details:

Does texelFetch involve a performance penalty? Such as not using a cache or such?
Are texelFetch and texture interchangeable when using GL_NEAREST?

sentences:
Game data structure in node.js I am building a simple turn-based game in node.js using sockets.io. My web experience with node.js has typically involved saving everything to a relational database. I set this up for my game. I am using sqlite3 for development and I might use something like PostgreSQL or MySQL for production. I will be doing this for account information regardless of what I set up for handling the actual game.

My concern is that, every time an event is emitted from the socket the whole game-state is loaded into memory from the server. I feel that in practice this will be less efficient than just keeping all of the gamestate data in memory. Events will probably be emitted every 5 seconds or so. A gamestate consists of a set of about 120 groups of small strings and integers (about 10 per group but subject to change).

Is it good practice to keep this type of data in memory?

Should I stick with relational databases?

Should I switch to a third option like a file-based storage structure?

Should I not load the whole gamestate in for every event even though that will lead to a lot more read/writes (at least triple)?

Edit* Clarification: Even though the game is turn based I want the player to be able to see what the opponent is doing on their turn in real time and give the player real time feedback about illegal actions.

sentences:
Programming Action RPG Battle system My best goal atm is just make one 1vs1 battle with no animations more than something which makes me realize the attack is done.

I'm learning C and Xlib, and now I know how to put an image in a window in Xlib.

Yes, it's nothing, but it was my first goal, show images in a window, and then start to do things.

So now I'm starting to think how I will make the game.

Since I'm thinking how make a low quality battle 1vs1 with no more than the two sprites and a black background in a window, I'm focusing in the battle "system" to make a little base and see how things will go.

I think the way is this (Maybe you know a better one, but it's just what i was testing one day and it works):

The map has coords like X and Y, so the sprites or enemies or whatever is in the game, are occuping some X and Y.

Then to use an attack I will take the X and Y of the attacker, and move one of them depending on the direction the attacker is looking.

For example, I want attack with a melee skill. I'm looking at right, so I take my X coord and move the X one step (maybe copying it in a variable first). This will be done with something like X=X+1; or X+=1; So my Y coord still unchanged, but my X is one step to right, then it's like I moved to right, but I'm still in my position because are the coords who are moving, not me really.

Then I make a condition like if X and Y are equal to Xenemy and Yenemy then, do attack.

So the base is move my coords or someone coords and do the attack moving X and Y and testing if they are the same of the enemy.

The ranged attacks will be the same, but repeating the process depending on range until it's done or the range is out.

X++;
if (X and Y are equal to Xtarget Ytarget) then do attack;
else  X++ and try again until the range is out or attack is done;

But, my questions are:

How I should do to attack more than 1 enemy? I need test all the coords of all sprites while I do this, or there is a better way like a selectable target or something?

I should use the Window coords, and the pixmap coords (the images or sprites) and copy them to attack, or I should make a new map with different X and Y?

What I must have in mind for the future? I mean, how I should make all coordinates and be sure the method I'm using is not lacking something which I should realize?

I'm having a wrong start? I guess I'm wrong when I'm focusing on only one target.

I guess the ranged skills should have X and Y, move on the map, and affect whatever is in the X and Y. But I have no more idea than test all the possible targets every time the skill cords move.

There is a way to create a global target to test only one location and know if there is an attackable target?

BTW: I will appreciate some corrections on my english. I will remember it, so I will learn with your edits. I  guess formatting is not needed and will be useless since there is no real code, but maybe you can do or add something to explain better what I'm trying to say.

I must say sorry for my bad english, I'm spanish and the english level here is shit. I've learned more playing wow on pirate servers than at the school and now reading programming docs.

If you know some books, info or questions I can look, please share it if they will be useful for me.

sentences:
How do you stack things in between a Table? So I understand that a Stack is used to overlay things on top of each other, but is it possible to sandwich something in between a Table? For example, let's say I build my main menu using a Table, but after the UI is built, I want to place a full-screen overlay right underneath my play button. How can I achieve this? Here's a simple sketch of what I'm looking for:

The problem I'm facing is that, even if I use a Stack, the button that I want to place on top of the overlay has to be a separate entity apart from the Table I want it to be a participant of, so I can't place it within the underlying Table's structure.

sentences:
Libgdx Actor touch undetected I am looking for detect touch in an actor. The touch in my game is detected in wrong part of the screen. I want to detect touch only on the red circle, here is the code:

Static_values

public class Static_values {

    static public float Width = Gdx.graphics.getWidth();
    static public float Height = Gdx.graphics.getHeight();

}

Circle class:

public class Circle_Obj extends Actor{

    private Vector2 position;
    private float radius;

    private float speedX;
    private float speedY;

    private com.badlogic.gdx.math.Circle circle;
private Texture texture;

    public Circle_Obj(float x, float y, float radius) {

        position = new Vector2(x,y);
        this.radius = radius;

        speedX = 5.5f;
        speedY = 5.5f;

        circle = new com.badlogic.gdx.math.Circle(x,y,radius);
        texture = new Texture(Gdx.files.internal("texture.png"));

        this.setSize(Static_values.Width,Static_values.Height);
        this.setPosition(position.x,position.y);
        this.addListener(new InputListener(){
            @Override
            public boolean touchDown(InputEvent event, float x, float y, int pointer, int button) {
                Gdx.app.log("TOUCHED", " TOUCHED ");
                return true;
            }
        });

    }

    @Override
    public void draw(Batch batch, float parentAlpha) {

        this.setSize(Static_values.Width,Static_values.Height);
        this.setPosition(position.x,position.y);
        batch.draw(texture, position.x, position.y, radius, radius);
}

Screen class :

public class GameScreen implements Screen {

    private Stage stage;
    private Circle_Obj circle_obj;

    public GameScreen() {

        circle_obj = new Circle_Obj(Static_values.Width/3, Static_values.Height/3, Static_values.Width / 100 * 10);

        stage = new Stage();
        stage.addActor(circle_obj);

        Gdx.input.setInputProcessor(stage);
    }

    @Override
    public void show() {

    }

    @Override
    public void render(float delta) {

        Gdx.gl.glClear(GL20.GL_COLOR_BUFFER_BIT);

        stage.draw();

    }
/** other methods **/

Colored area = area where touch is detected :

sentences:
Good ways to edit arbitrary collision shapes for 2D physics engine? Assume you have several 1024x1024 textures which contain an arbitrarily shaped and relatively complex cave system whose walls need to have collision polygons defined. The polygons need to be convex to work with the physics engine.

What kind of process and tools can you think of that would make editing the vertices of these walls as efficient and painless as possible? Especially considering that the polygons need to be convex, and the designer needs to see when that is not the case.

sentences:
Human vs human android chess game design First of all I am total amateur in game development and sorry for my poor English.
I want to make android human vs human chess game. So I am wondering how to design it?

scenario 1: User connect to server, find opponent and send moves to server using socket, so match is running on a server side. I think this is not good idea because move should be validated on client side - or do I have to validate moves on client side? I do not think this is good solution because game is seperated.

scenario 2: Using hole punching technique so server is needed only for connection between players, so game is running on android devices.

which approach do you suggest? Or is there any better solution? Which server is best to use?

sentences:
pick up material from another object is it possible to obtain a material from another object?
I'm trying everything and nothing, the only thing I could get was just the color of another object
public MeshRenderer takematerial;
public GameObject[] Objects;
for (int i = 0; i < Objects.Length; i++) {
    Objects [i].GetComponent<Renderer> ().material = takematerial.material;
}

sentences:
How to apply forces to character with gamepad in Unity? I've been following Brackey's tutorial on this, see the excerpt from my code below. In his tutorial it only teaches "transform.Translate", how do I use this gamepad input system tool to add forces to the character to make them move instead? So I can have jump physics, and when they're in space they'll keep the momentum.
{
    NewControls controls;

    Vector2 move;
    Vector2 rotate;
    private void Awake()
    {
        controls = new NewControls();

        controls.Gameplay.Jump.performed += ctx => Jump();

        controls.Gameplay.Walk.performed += ctx => move = ctx.ReadValue<Vector2>();
        controls.Gameplay.Walk.canceled += ctx => move = Vector2.zero;

        controls.Gameplay.Rotate.performed += ctx => rotate = ctx.ReadValue<Vector2>();
        controls.Gameplay.Rotate.canceled += ctx => rotate = Vector2.zero;
    }

    private void Update()
    {
        Vector2 m = new Vector2(move.y, move.x) * Time.deltaTime;
        transform.Translate(m, Space.Self);**

        Vector2 r = new Vector2(rotate.y, rotate.x) * 100f * Time.deltaTime;
        transform.Rotate(r, Space.Self);
    }
}

To move with rigidbody controls, you have to use things like “forward” or “left” but I want one joystick to control the forward, backwards, and side to side movements. I don’t know how to use the joystick input for moving in all those directions. The tutorials have them as separate arrow keys
does anyone have some sample code, or a tutorial to point me to, or just some explanation?  it would be much appreciated.

sentences:
Better way to generate enemies of different sub-classes So lets pretend I have an enemy class that has some generic implementation and inheriting from it I have all the specific enemies of my game.  There are points in my code that I need to check whether an enemy is a specific type, but in Java I have found no easier way than this monstrosity...

//Must be a better way to do this
if ( enemy.class.isAssignableFrom(Ninja.class) ) { ... }

My partner on the project saw these and changed them to use an enum system instead

public class Ninja extends Enemy {
    //EnemyType is an enum containing all our enemy types
    public EnemyType = EnemyTypes.NINJA;
}

if (enemy.EnemyType = EnemyTypes.NINJA) { ... }

I also have found no way to generate enemies on varying probabilities besides this

for (EnemyTypes types : enemyTypes) {
    if ( (randomNext = (randomNext - types.getFrequency())) < 0 ) {
        enemy = createEnemy(types.getEnemyType());
        break;
    }
}

private static Enemy createEnemy(EnemyType type) {
    switch (type) {
        case NINJA:
            return new Ninja(new Vector2D(rand.nextInt(getScreenWidth()), 0), determineSpeed());
        case GORILLA:
            return new Gorilla(new Vector2D(rand.nextInt(getScreenWidth()), 0), determineSpeed());
        case TREX:
            return new TRex(new Vector2D(rand.nextInt(getScreenWidth()), 0), determineSpeed());
     //etc
    }
return null
}

I know java is a little weak at dynamic object creation, but is there a better way to implement this in a way such like this

for (EnemyTypes types : enemyTypes) {
    if ( (randomNext = (randomNext - types.getFrequency())) < 0 ) {
        //Change enemyTypes to hold the classes of the enemies I can spawn
        enemy = types.getEnemyType().class.newInstance()
        break;
    }
}

Is the above possible?  How would I declare enemyTypes to hold the classes if so?  Everything I have tried so far as generated compile errors and general frustration, but I figured I might ask here before I completely give up to the huge mass that is the createEveryEnemy() method.  All the enemies do inherit from the Enemy class (which is what the enemy variable is declared as).  Also is there a better way to check which type a particular enemy that is shorter than enemy.class.isAssignableFrom(Ninja.class)?

I'd like to ditch the enums entirely if possible, since they seem repetitive when the class name itself holds that information.

sentences:
Why my keyPressed method stops reacting to any key i press after i hold (W/A/S/D) for 1 or 2 seconds? public class Testing extends JPanel{

    public void Action() {
        Timer t = new Timer();
        t.schedule(new TimerTask() {

            public void run() {
                if(move2==true) {
                    switch(direction2) {
                    case 1 : x-=2;
                    break;
                    case 2 : x+=2;
                    break;
                    case 3 : y-=2;
                    break;
                    case 4 : y+=2;
                    }
                }
                repaint();
            }

        }, 10, 20);
    }

    public void paint(Graphics g)
    {
        g.clearRect(0, 0, 526, 690);
        g.drawLine(x, y, x, y-30);
        g.drawLine(x+1, y, x+1, y-30);
        g.drawLine(x-1, y, x-1, y-30);

    }
    static boolean move2 = false;
    static int x = 200;
    static int y = 100;
    static int direction2 = 0;
    public static void main(String[] args) {
    JFrame f = new JFrame();
    Testing t = new Testing();
    f.setVisible(true);
    f.setSize(526,690);
    f.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
    f.setLocationRelativeTo(null);
    f.setFocusable(true);
    f.add(t);
    t.Action();
    f.addKeyListener(new KeyListener() {

        public void keyTyped(KeyEvent e) {

        }
        public void keyPressed(KeyEvent e) {
            System.out.println("did");
            switch(e.getKeyCode()) {
            case KeyEvent.VK_A:
                move2 = true;
                direction2 = 1;

                break;
            case KeyEvent.VK_D:

                move2 = true;
                direction2 = 2;
                break;
            case KeyEvent.VK_W:

                move2 = true;
                direction2 = 3;
                break;
            case KeyEvent.VK_S:

                move2 = true;
                direction2 = 4;
                break;
            }

        }

        public void keyReleased(KeyEvent e) {
            switch(e.getKeyCode()){
            case KeyEvent.VK_A:move2 = false;
            break;
            case KeyEvent.VK_D:move2=false;
            break;
            case KeyEvent.VK_W:move2=false;
            break;
            case KeyEvent.VK_S:move2=false;
            }
        }
    });
    }

}

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:
Run menu in gameloop or as activity? Currently I am running my menu (with buttons "new game" and "choose level") as an xml view of an activity, that then starts my gameactivity with custom view run on a gameloop. But Im starting to see some restrictions with this.

Would it be a terrible idea to let the menu be part of the gameloop and just add another state for it, like gameState = MENU ? and then render and update touch accordingly.

Does anyone have any experience with this and if so how did you choose to solve it?

sentences:
Dialogue Audio: Forming sentences using different recordings I am working on a game where the exact dialogue to be spoken out depends on context. The most common use case is for scoring - The game keeps player score and I want the game to tell the player her current score using audio. For example, audio can be - "You've killed 10 enemies", or "You're score just crossed 100!". In both these sentences, the numbers 10 and 100 depend on the current game context.

What I would want to do is record the sentence "You've killed .... enemies", and then also record all the numbers separately, and then form a complete sentence when needed. Are there any solutions which can do this in a way that the dialogue sounds fairly natural?

sentences:
Get derived Pawn from collision actor in UE4 I am trying to build a basic RTS unit selection but any time I try to possess the target pawn it crashes.

The pawn in the collision is a blueprint derived directly from APawn.

Am I casting from the actor incorrectly?

How do i correctly get a pointer to my target unit from a collision?

void A_test_PlayerController::Input(FHitResult HitResult)
{

    // hit something
    if (HitResult.bBlockingHit)
    {
        AActor* hitActor = HitResult.GetActor();
        APawn* hitPawn = Cast<APawn>(hitActor);

        // hit a pawn
        if (hitPawn != nullptr)
        {
            // pawn is not currently controlled
            if (!hitPawn->IsControlled())
            {
                Possess(hitPawn); // <- crashes here!
                // selected new pawn
            }
            else
            {
                // pawn is already controlled
            }
        }
        else
        {
            // did not hit any pawns
        }

    }

}

Edit: found this, seems i might be doing it the right way, but it still crashes..
https://answers.unrealengine.com/questions/59297/line-trace-not-recognizing-actor.html

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:
Having Trouble holding PlayerPrefs after game restart I am trying to create a highscore value that is stored in playerprefs, and only updates when a higher score is achieved. I got playerprefs viewer on the asset store, and can see that it is holding a value, but it seems that it blows through the if statement that checks to see if the new value is a highscore. This means that no matter what score I get, it always stores it as a highscore.

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

public class Score : MonoBehaviour
{
    public Transform Player;

    public Text scoreText, Highscoretext;

    public GameObject Postgame, Ingame;

    private bool stopScore = false;

    void Update()
    {
        if (stopScore == false)
        {
            //Keeps track of and displays current score
            float floatscore = Player.position.x;
            int intscore = (int)floatscore / 10;
            if (FollowPlayer.gameOver == false)
            {
                scoreText.text = intscore.ToString();
            }

            if (FollowPlayer.gameOver == true)   // Checks wheather the game has ended (from a different script)
            {
                stopScore = true;   // Stops running the score function

                if (intscore > (PlayerPrefs.GetInt("HighScore")));   // Checks to see if the score of the current game is a new Highscore
                {
                    PlayerPrefs.SetInt("HighScore", intscore);   // Sets new Highscore

                    EndScreen();   // Function to load the endscreen
                }
            }
        }
    }
    public void EndScreen()
    {

        Highscoretext.text = "Highscore: " + PlayerPrefs.GetInt("HighScore").ToString();   // Supposed to set the endscreen Highscore value to the new Highscore value

        // Different canvas overlays
        Postgame.gameObject.SetActive(true);
        Ingame.gameObject.SetActive(false);
    }
}

I tried using Debug.Log to debug this, and found that even if intscore is smaller than PlayerPrefs.GetInt("HighScore")), it will still run the code that sets a new highscore.
Anyone have any idea of how to fix this?

sentences:
Emission for Mobile Shaders? I need to use Emission texture to my model, but I can't find any emission parameters in mobile shaders.

I searched this on google, but there's nothing helpful to me.

How do I add emission for mobile shaders, without writing own shader code?
(I'm keep studying shader but still not good at)

sentences:
How to get time since frame start in Unity for loading purposes I am building a big world (1000+ game objects). It takes 2s on the device. I am doing it in the background (the world is hidden until fully loaded). I have figured out that I can maintain the FPS of the active scene by switching to coroutines and making yield return null;.

The main issue is when to fire yield return null;. If I do it too often, then it will slow down the loading. If I do it too rarely, it will reduce FPS on low-end devices.

My idea is simple to detect how much milliseconds have passed since the start of the frame and fire yield return null; just after I have spent for example 12ms (to leave some time to render everything else and maintain something near 60FPS).

However, I can not find an efficient way of getting the time since frame start? Unity should have something as the async loading of assets seems to consume just right time to maintain stable FPS.

sentences:
Does it make sense to use both TCP and UDP at once? After reading Is UDP still better than TCP for data-heavy realtime games?, I'm wondering if it makes sense to use both TCP and UDP at the same time, but for different things:

TCP for sending information that is sent infrequently, but should be guaranteed to arrive reliably.
Such as score updates, a player's name, or even the on/off state of a light in the game world.
UDP for transmitting information that is updated constantly and can be lost occasionally, since newer information is always on the way.
Such as position, rotation, etc.

Is this a reasonable idea?
What are the possible drawbacks?
Are there better ways to handle this?

sentences:
How to draw 2d above 3d scene? I have an OpenGL(3.3)+GLEW application.
I want to draw a black vertical rectangle at the left side of the window for writing some information on it, like fps (I use GLEW function for drawing text).

I have a common pipeline, like this:

 m_transformation = PersProjTrans * CameraRotateTrans *
           CameraTranslationTrans * TranslationTrans *
           RotateTrans * ScaleTrans;

I know how it works, but I can't figure out how to draw a projection of the rectangle on the window, like 2d.

I would be glad to any advise.

sentences:
State changes in entities or components I'm having some trouble figuring how to deal with state management in my entities.

I don't have trouble with Game state management, like pause and menus, since these are not handled as an entity component system; just with state in entities/components.

Drawing from Orcs Must Die as an example, I have my MainCharacter and Trap entities which only have their components like PositionComponent, RenderComponent, PhysicsComponent.

On each update the Entity will call update on its components. I also have a generic EventManager with listeners for different event types.

Now I need to be able to place the traps: first select the trap and trap position then place the trap.

When placing a trap it should appear in front of the MainCharacter, rendered in a different way and following it around. When placed it should just respond to collisions and be rendered in the normal way.

How is this usually handled in component based systems?

(This example is specific but can help figure out the general way to deal with entities states.)

sentences:
Java - LibGDX low fps on completely empty project I started working on a really really small prototype and when I ran the application i noticed the FPS was only half of what it's supposed to be at. FPS stays at around 30-31 instead of 60 - even when I literally erased all code from running sitting with an empty project it's still 30. I even tried to import an old project which used to work fine with high fps but it also runs at 30.

I also tried importing a LWJGL project and it worked fine with 60 FPS.

I've tried restarting my computer as well and other games run fine on my computer. Note that I've developed in LibGDX for quite a long time and never encountered this before - any help is appreciated!

sentences:
Calculating real time moment of inertia around arbitrary axis in 3d I have a 3d rigid body consisting of multiple triangles forming a closed mesh. I know how to calculate the moment of inertia around an arbitrary axis by splitting up the mesh into simpler shapes and using the parallel axis theorem and summarization to calculate the angular mass for the whole thing.

The problem is that in a real time simulation I would have to re-calculate the rotation mass for every impulse applied to the body. In my 2d simulation this is not a problem as there is just one orientation to any rotation axis, so I can calculate the angular mass just once.

Is there a way to pre-calculate the rotation mass for a 3d object, or is there a simplified way of doing this?

sentences: Time calculation between openGL update calls In XNA, the system calls update and draw function with the time information. This contains information such as how much time has passed since last update was called. This makes easy to integrate time and do animation calculation accordingly. But I dont see any such mechanism in openGL. I see openGL requires programmers to have their own implementation which could be buggy or inefficient. Is there any standard (and efficient) code that demonstrate this practice in openGL?

sentences:
C++ Platformer Collision This is very simple, but I have spent nearly 6 months messing with this and it is always messed up.

This is a tile platformer, everything is "normal", x and y correspond to tile. Tiles are 32 x 32 pixels.

// Get all tile numbers, top left, top right, bottom left, bottom right
int X = 63; // and in this, say the player is moving right
int Y = 50;
int Width = 33; // This is the problem, if it is < 32, the collisions are all over the place, in the open, where there shouldn't be.
int Height = 50;

int tile_x = floor( (double) X/32);
int tile_y = floor( (double) Y/32);
int tile_x2 = floor( (double) (X + Width)/ 32);
int tile_y2 = floor( (double) (Y + Height)/ 32);
bool open = true;

// This is meant to catch cases where width < 32
if (tile_x == tile_x2) {
    if (IsOpenPt(tile_x, tile_y)) { return true; }
}

// loop through tiles
for (int y = tile_y; y < tile_y2; y++) {

    for (int x = tile_x; x < tile_x2; x++) {

        // this spot is not open
        if (!IsOpenPt(x,y)) { open = false; }

    }
}

return open;

This works if the width is greater than 32, but if it anything less, everything becomes random open point/ not.

See anything wrong with my formula? I have exhausted searches, nothing. Once again I emphasize, the entire project, I have been trying to get this part to work. I have literally a 100 page notebook of attempts at visualizing and grids to put it on paper.

sentences:
How can I profile the speed of my vertex and fragment shaders separately? I'd like to know how I can check to see if either my vertex or my fragment shader is a bottleneck in my rendering pipeline.

I've read about using glQueryCounter with the GL_TIMESTAMP target to get clock checkpoints between OpenGL commands, but these don't distinguish between different types of shaders.

For example, if one frame on the GPU took 8 ms to render, can I tell that the vertex shader took 7 ms and the fragment shader took 1 ms?

sentences:
How do i prevent IAP abuse using restoring purchases in an online game? Lets say i have a mobile mmorpg (ios/android) where you can purchase premium currency using IAP's... how do i actually prevent the following case :

Player purchases premium currency
Server side checks if the purchase is valid, grants the user premium
currency
Player uses the premium currency to buy some items
Player restores his purchase on google play and gets his money back

Result : Player didnt spended money and still got what he wanted

As long as i know theres no option to prevent that case in google playstore or ios app store... Users can restore purchases within 48 hours after the purchase.

So what could i basically do to prevent this, aslong as i dont use 3rd party payment services like PayPal ?

sentences:
How can i detect if the player is inside an explosion radius? I'm making a driving game, there are enemies which spawn on the side of road and when my player car gets close, they fire a rocket in front of the player. I need to detect if the car is within a certain radius of the explosion center. So when I can detect that I'm assuming I can then use rb.AddExplosiveForce to make the car fly a bit or something.

What is the recommended way to get the blast radius collider (or equivalent) and detect if the player is inside it?

sentences:
All scripts in Unity game can not be loaded I can not provide a "why" here, because as far as I can tell it happened spontaneously - after saving an edit to one of my scripts, it just started happening. But here's the problem:

Every single one of my scripts, while still in the same Scripts file, can no longer be found and loaded. All the Script Components (take the Game Manager component for example) now look like this:

or like this:

Attempting to locate the scripts by going Add Component > Scripts > [Desired Script] doesn't work, because there isn't even a Scripts item in the Add Component menu. I have already looked this up, and none of the answers I found were applicable:

Yes, every script's file name is the same as the Class name within them
I have tried reimporting all  assets (Assets > Reimport All), no success.
Taking all scripts out of the project, restarting unity and then reimporting the scripts. Nothing
Removing all script components, then reapplying them. It didn't work because, as I said, there was no Script item in the Components menu.

This is a pretty game-breaking, literally, because this is a hobby game (I'm not doing this as a job, it's just in spare time). If I can't restore the game as it was, I won't be able to bring myself to restart it. So any help is greatly appreciated.

sentences:
How do I generate a random curve for landscape (like Worms)? Possible Duplicate:
  How do I generate terrain like that of Scorched Earth?
  How can I generate Worms-style terrain?

I must build random curve line for the 2D Game on the BitMap (like in Worms, from the side).

Teacher said that I should do it using Terrain Generation through recourcy
(I work in Delphi 7).
I understand the main principle, but I don't know how to introduce it as code.

All measurements according to the screen resolution.

sentences:
Android Game-Loop (rendering & logic removed, but still 'skipping frames') Overview

Guys really hoping for some help here. My game loop is based on code from Fix Your Timestep!.

I've read the article more than a few times, but I can't quite work out what exactly is supposed to be going on within the loop.

I'm running my code on a Nexus 10 tablet which has VSync set to 60fps.

Playing catch up

When I run my code, I'm getting caught quite often in the while loop, ie it runs my logic more than once - so runs logic twice in a row before rendering).

With my understanding of the loop, this should happen when rending takes too long to fit into the time slice (which is 16.66666666666667ms).

So, maybe in 'normal circumstances', I would expect this to happen occasionally).

However, I've tried removing all rendering and logic updating and just running a skeleton loop and I'm still getting caught regularly and constantly within the 'while-loop'.

Therefore, when I'm running my game (with rendering and logic), I'm getting a lot of stuttering because I know the loop is going to skip frames.  The logic updates are however being capped at 60 which is exactly what I want.

Obviously whether or not my rendering or physics update could be more efficient is not the issue here and is a question for another day as I've already removed that from the equation.

I can smooth things out somewhat with interpolation and it really does make a difference, however, it's not as smooth as some of the games I download from the Play Store and I really need to make it better.

So, what am I missing or not understanding?  I would think it should (certainly with no rendering or logic updating to create a bottleneck):

Enter the while-loop
Exit the while-loop
Wait for next VSync
And repeat

Here is the loop I'm testing with:

@Override
public void onDrawFrame(GL10 gl) {

    newTime = System.currentTimeMillis()*0.001;
    frameTime = newTime - currentTime; //Amount of time this entire frame took
            if ( frameTime > (0.25))
                frameTime = (0.25);

            currentTime = newTime;
            accumulator += frameTime;

            //Update logic
            while (accumulator >= dt){
//              saveGameState();  //Removed for testing
//              updateLogic(dt);  //Removed for testing
                accumulator -= dt;
            }

            //Get the amount to interpolate by
//              interpolation = (float) (accumulator / dt);  //Removed for testing
//              render(interpolate);                         //Removed for testing

}

sentences:
Z-order for cocos2d top-down game with sprite batching I'm trying to understand how to create z-order system like you can see in http://www.realmofthemadgod.com/

Character is above the tree when he is in front of it and vice versa.

Also, I'm planning to use sprite batching and all the sprites will not fit in one texture (2048*2048 for cocos2d-iphone). So I need to use several batches (like one for background and one for characters).

Additional "top-background" layer with  above the character layer will not solve the problem: what if two characters are staying in front and behind a tree at the same time?

So, I'm thinking about some sort of masking but I don't know how to properly implement it.

Example from the RotMG: http://i.stack.imgur.com/d8dAe.png

sentences:
What is a legal way to use music from registered authors in a game? I have recently asked a question about music in games like Guitar Hero.

I have found that that in Europe (at least) if I do want to use a track composed by a musician member of a royalty collecting society I need to pay a flat fee to the society and not only to the member.

So a "one-to-one" agreement is not valid and the society can come up to me and ask me for money for each download. Even if for FREE!

This is a fee sheet list of the UK agency:
for fee, see "Permanent download services"

It is about 1,200 GBP for less than 22,000 copies and they DON'T specify anything more and they said me on the phone that I need to wait and see how many downloads I get before knowing the price.

This is kind of crazy as If I give away the App for free I will have to PAY 1,200 GBP!!

I am shocked and I feel very bad.

The other solution is to work only with non registered musicians.

The question here to you is:

Has anyone found a legal way to use music from registered authors in a game?

sentences:
Centralized User database for multiple Systems I was wondering, how do large companies handle user accounts and allow different applications to access them.

One example that comes to mind is Riot, their game League of Legends has a global user account that allows you to login to forums and the game client itself.

What sort of method would they be using to allow multiple systems to access this database.

sentences: Using depth texture for depth testing I was wondering if it is possible to render my scene onto a depth texture then using that texture for depth testing in another pass. I have an idea to that in shaders, but is that possible hardware-side?

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:
HLSL texture sampler always returns white I'm facing in problem in HLSL with Monogame that I can't figure out. The gist is that sampling from a texture seems to always return white rather than the texture's actual color. My pixel shader code is below, and then I'll say more.

texture2D fillTexture;

sampler fillSampler = sampler_state
{
    Texture = <fillTexture>;
};

sampler s0;

struct VertexShaderOutput
{
    float4 Color : COLOR0;
    float4 Position : SV_POSITION0;
    float2 TexCoords : TEXCOORD0;
};

float4 PixelShaderFunction(VertexShaderOutput input) : COLOR0
{
    return tex2D(fillSampler, input.TexCoords);
}

technique Technique0
{
    pass Pass0
    {
        PixelShader = compile ps_4_0 PixelShaderFunction();
    }
}

First, in my C# code, I'm using the SpriteBatch to draw a large rectangle. That part works fine. Second, I have a smaller texture that I'm passing as a parameter into my pixel shader (fillTexture). No matter what I try, the resulting large rectangle is pure white.

I've already verified that my shader is being applied, as the following code results in a red block.

float4 PixelShaderFunction(VertexShaderOutput input) : COLOR0
{
    return float4(1, 0, 0, 1);
}

I've also verified that my texture coordinates within the pixel shader function are correct. The following code produces the image below.

float4 PixelShaderFunction(VertexShaderOutput input) : COLOR0
{
    float2 texCoords = input.TexCoords;

    return float4(texCoords.x, texCoords.y, 0, 1);
}

I've also verified that the fill texture itself has valid colors (i.e. it isn't pure white itself).

Apart from that, I've tried every combination I've seen. I've tried using sampler2D rather than sampler, fillTexture.Sample rather than tex2D, even compiling with ps_4_0_level_9_1 and level_9_3. I've tried using SamplerState rather than sampler_state, binding registers, everything I can think of.

Any help would be greatly appreciated. Thank you :)

sentences:
How do you create fnt (angelcode format) files from existing bitmaps? I often gets the same problem: Someones creates a nice bitmap font for me in form of a sheet nicely formated into a png, like this:

...and i need to create the angelcode .fnt atlas for using it (into Unity, libGDX, or countless other engines).

Yet, every time I google it, I stumble upon dozen of tools that create .fnt files from rasterized TTF fonts. (BMFont, Fontbuilder, etc.) Correct me if i'm wrong but they don't support exsting images, they always start by generating one from a vector font.

I end up semi-manually creating the file with an ugly script (the format is quite simple), but it's incredibly tedious. Surely there is a much better way to do that? Especially for monospaced fonts which are very easy to partition...

edit: I've made a small javascript tool to solve that. if by any chance you're interested, it's here : http://fontcutter.fbksoft.com/

sentences: Can someone explain radiosity lighting to me? I already have the basics of ambient occlusion down.  I have a raycaster and am capable of shooting rays about a hemisphere uniformly.  It seems like those are the basics of what are needed for radiosity but I don't know where to go from there.  Do I find how much light comes from each face?  (I'm making my game out of cubes like minecraft)  After that what do I do?

sentences:
How do I make a pop-up window with Scene2D? I have a main-menu screen with a logo and a bunch of buttons. When the Login-button is pressed, I pop up a dialogue asking for a username and password.

This works fine, other than the "popping up". At the moment the new the dialogue box just shifts everything about, but I'd want to position it over the current scene.

I'm just learning Scene2D.

sentences:
Libgdx fbx converter doesn't write meshes to g3dj file LibGDX FBX converter doesn't write meshes nor materials to g3dj file.

This happens with blender 2.8 when exporting model to FBX then converting it to g3dj. meshes will result in an empty block.

2.8 blender settings

and when converting...

g3dj file..

{
   "version": [  0,   1],
   "id": "",
   "meshes": [],
   "materials": [],
   "nodes": [
       {
           "id": "Cube",
           "rotation": [-0.707107, -0.000000,  0.000000,  0.707107],
           "scale": [ 10.000000,  10.000000,  10.000000]
       }
   ],
   "animations": []
}

I tried to convert a fbx written with blender 2.76 with these settings...

and meshes and materials are written in g3dj file successfully. I'm thinking this has to do with FBX version, but it seems you can't change FBX version in blender 2.8

sentences:
How do I draw shape distortion with a Texture2D in XNA? Say I have a rectangular Texture2D object in XNA, and I draw it on the screen.
How can I animate it so it slowly changes to a trapezoid shape, and then to a pentagon, etc.

I have no idea what this technique is called, so I couldn't find anything on Google.

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:
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:
How can I speed up this HLSL shader? I have written a lighting shader file that is used as the fragment shader part of a deferred lighting pipeline.

Unfortunately, each iteration seems to be adding 0.5ms to my frame time, so any more than a handful of dynamic lights results in unbearable slowdown.

So clearly I'm doing something stupid but I'm kinda new to optimising HLSL, so anything obvious you can spot would be greatly appreciated. Here is the shader code:

#include "DLLightingInclude.hlsli"

static const float MAX_DIFFUSE_ANGLE = 1.57079637;

Texture2D NormalGB : register(t0);
Texture2D DiffuseGB : register(t1);
Texture2D SpecularGB : register(t2);
Texture2D PositionGB : register(t3);

SamplerState NormalSampler : register(s0);

cbuffer CameraProperties : register(cb0) {
    float3 CameraPosition;
}

cbuffer LightProperties : register(cb1) {
    float3 LightPosition;
    float LightRadius;
    float3 LightColor;
};

void GetGBValues(
    in int2 screenPosition,
    in float2 texturePosition,
    out float3 normal,
    out float3 diffuseAlbedo,
    out float3 specularAlbedo,
    out float specularPower,
    out float3 position)
{

    int3 screenPos3 = int3(screenPosition, 0);
    normal = normalize(NormalGB.Sample(NormalSampler, texturePosition).xyz);
    diffuseAlbedo = DiffuseGB.Load(screenPos3).xyz;
    float4 specularValues = SpecularGB.Load(screenPos3);
    specularAlbedo = specularValues.xyz;
    specularPower = specularValues.w * 50.0f;
    position = PositionGB.Load(screenPos3).xyz;
}

FS_OUT_SPLIT main(FS_IN input) {
    FS_OUT_SPLIT result;

    float3 N;
    float3 diffuseAlbedo;
    float3 specularAlbedo;
    float specularPower;
    float3 position;

    GetGBValues((int2) input.Position, input.TexCoord, N, diffuseAlbedo, specularAlbedo, specularPower, position);

    float3 L = LightPosition - position;
    float lightDistance = length(L);
    float invAttenuation = max(0.0f, 1.0f - (lightDistance / LightRadius));
    float NdotL = max(dot(N, L), 0.0f);
    float angle = acos(NdotL / (lightDistance * length(N)));

    float3 diffuseTerm = LightColor * diffuseAlbedo * (MAX_DIFFUSE_ANGLE - angle);
    float3 V = CameraPosition - position;
    float3 H = normalize(L + V);
    float3 NdotH = dot(N, H);
    float3 specularTerm = pow(saturate(NdotH), specularPower) * LightColor * specularAlbedo * min(NdotL, 1.0f);

    result.BackBuffer = result.PreBloomBuffer = float4(diffuseTerm * invAttenuation + specularTerm * invAttenuation, 1.0f);

    return result;
}

And the included file, DLLightingInclude.hlsli, looks like this:

struct VS_IN {
    float3 Position : POSITION;
    float2 TexCoord : TEXCOORD0;
};

struct VS_OUT {
    float4 Position : SV_POSITION;
    float2 TexCoord : TEXCOORD0;
};

typedef VS_OUT FS_IN;

struct FS_OUT {
    float4 Color : SV_TARGET0;
};

struct FS_OUT_SPLIT {
    float4 BackBuffer : SV_TARGET0;
    float4 PreBloomBuffer : SV_TARGET1;
};

I can't really see anything particularly obvious in what I've written- but like I say, I'm kind of a noob at this.

sentences: Get the scene that MonoBehaviour belongs to (multi-scene setup) Is there a way to get the scene that a MonoBehaviour component belongs to? The MonoBehaviour is part of a setup with several additivly loaded scenes. What I'm looking for is not the currently active scene but an additionally loaded one.

sentences:
Any way to interface methods in objects? Say I have object A, which has children B, C and D.

In OOP I would have A be an interface containing method action(), then I would have B, C and D implement A and, in their class definition, I would define the method in each of them in extremely different ways (as intended).

Is there a way to do something similar in GML? So far I can only think of making a script with an chain of if statements for every kind of action based on object_is_ancestor() which feels messy and unorganized to say the least.

Thank you for the help.

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:
How might I eliminate asymmetrical gameplay caused by turn order? I'm designing a turn based game in which players profit from buying, transporting, and selling resources. Each turn, the map has to produce a certain number of resources and different locations, and resource prices have to be updated. Because of this, each round, after every player has taken their turn, the game state has to be updated; resources are consumed/produced, prices in each cell of the map need to be updated, etc. Originally, I was going to have a simple turn order, where each player took their turn, then the map is updated, then the cycle repeats in the same order. However, after a little bit of testing, it became clear that this gave a significant advantage to players who have their turn right after the map is updated. They're able to collect the newly produced resources before any one else has a chance to.

The easiest way I could think of to balance out the gameplay for all players is to randomize the turn order after each round. While this would give everyone a fair chance, I'm worried that this might be too big of a shift away from strategy and towards luck.

How might I eliminate asymmetrical gameplay caused by turn order?

sentences: Virtual World Plaforms and Unity3d I'm moving in the direction metaverse developing. A few years back I wandered around in Second Life and found it entertaining for a New York minute. Now, I'm set to plunge into the Virtual World/MMO enviroment. ReactionGrid's Jibe seems to be wonderfully paired with Unity3d. I've been a Unity developer for 5-6 years now. Is there a open source Virtual World Platform that integrates with Unity like Jibe? I've read an article on platforms like OGRE, Open Colbalt, OpenSimulator, Project Wonderland and Sirikata but none seem to mention working with Unity3d.

sentences:
How do I delete all saved preferences in my libgdx project? I want to delete the preferences that saved my last highscore. How can I do this?

Here's how I am saving preferences at the moment:

prefs = Gdx.app.getPreferences("ZombieBird");
if (!prefs.contains("highScore")){
    prefs.putInteger("highScore", 0);
}

public static void setHighScore(int val) {
   prefs.putInteger("highScore", val);
   prefs.flush();
}

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:
Unity - change only z axis rotation to 0 I have a child where I want the rotation to work like (parentRot, parentRot, 0).

So first I set its localRotation to 0, meaning it will get the parents rotation: child.localRotation = Quaternion.identity;

But how can I make sure the world rotation (not local) value of the z axis stays at 0?

sentences:
Mobile: Physics and movement actions I've been using spritekit for a while for a few small games. One thing I've noticed is that spritekit is the first game framework I've used that allows me to apply move actions to physics bodies. (without anything screwing up at least.)

Are there any cross platform game frameworks I can use that allow move actions on physics bodies? Not impulses. I've used cocos2d in the past and when I tried ccmoveby on physics bodies the simulation would get totally confused. I rather not use cocos2d anyway.

I'm asking because I want to make cross platform games and spritekit is iOS only.

sentences:
Using 3D models in an 2D Game in libGDX In my libGDX 2D RPG-Game (like Zelda or something) I want to display some items as 3D-Objects. Since I'm using an OrthographicCamera like this:

this.gameWorldCam = new OrthographicCamera();
this.hudCam = new OrthographicCamera();
gameWorldCameraViewport = new ExtendViewport(FRUSTUM_WIDTH, FRUSTUM_HEIGHT, gameWorldCam);

I don't know how to render 3D-Object on it. In my render loop I call this:

// 2D
spritebatch.begin();
...
spritebatch.end();

// ----------------------------------------------
// Just some hardcoded model creation for testing
// ----------------------------------------------
Model model;
ModelInstance instance;
ModelBuilder modelBuilder = new ModelBuilder();
model = modelBuilder.createBox(
  5f,
  5f,
  5f,
  new Material(ColorAttribute.createDiffuse(Color.GREEN)),
  Usage.Position | Usage.Normal
);
instance = new ModelInstance(model);
// ---------------------------------------------

// 3D
modelBatch.begin(gameWorldCam);
modelBatch.render(instance);
modelBatch.end();

// 2D
spritebatch.begin();
...
spritebatch.end();

What do I have to do, to get the proper result? Right now, nothing of the green 3D cube is visible.

sentences:
SFML: How to draw/render from Screen class Game architecture is as follows:

// main.cpp

main() loads data from .csv/.json files.
main() creates an Application class instance as app and passes it data.
main() runs app.genesis();

// Application.cpp

Application::genesis() creates an sfml window
Application::genesis() creates a Menu class : public Screen as screen

// main.cpp

main() runs app.loop()

// Application.cpp

Application::loop() calls screen.step();

// Menu.cpp

Menu::step() calls draw()/render();

How do I either call Application::draw()/render() from Menu::draw()/render()
or in which way should I pass screen (Menu) the window to draw to?

sentences:
isometric drawing order with larger than single tile images - drawing order algorithm? I have an isometric map over which I place various images. Most images will fit over a single tile, but some images are slightly larger. For example, I have a bed of size 2x3 tiles.

This creates a problem when drawing my objects to the screen as I get some tiles erroneously overlapping other tiles.

The two solutions that I know of are either splitting the image into 1x1 tile segments or implementing my own draw order algorithm, for example by assigning each image a number. The image with number 1 is drawn first, then 2, 3 etc.

Does anyone have advice on what I should do?

It seems to me like splitting an isometric image is very non obvious. How do you decide which parts of the image are 'in' a particular tile? I can't afford to split up all of my images manually either.

The draw order algorithm seems like a nicer choice but I am not sure if it's going to be easy to implement. I can't solve, in my head, how to deal with situations whereby you change the index of one image, which causes a knock on effect to many other images. If anyone has an resources/tutorials on this I would be most grateful.

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:
Physics for Android Game I'm making a 2D game for the Android phone, one that involves falling balls. I want to use a physics engine to properly simulate the balls falling and hitting other objects. I'm currently using Phys2D, but when the game runs in the emulator it doesn't look natural; slow and rough. Course, I don't know if this is because of the emulator or Phys2D seeing as how I don't own an Android phone (A real drawback not being able to test on the actual phone, I know, but I can't afford a smartphone).

Anyways, do you think the game would run faster and smoother on an actual android phone, or is it the engine I'm using, or how I'm using it. If it's the engine, any recommendations on Java physics engines?

UPDATE: If you want to test the game yourself, you can find the rough prototype here: http://bpcp.angelfire.com/BallDrop.apk

sentences:
Fixed timestep with interpolation in AS3 I'm trying to implement Glenn Fiedler's popular fixed timestep system as documented here:

http://gafferongames.com/game-physics/fix-your-timestep/

In Flash. I'm fairly sure that I've got it set up correctly, along with state interpolation.

The result is that if my character is supposed to move at 6 pixels per frame, 35 frames per second = 210 pixels a second, it does exactly that, even if the framerate climbs or falls.

The problem is it looks awful. The movement is very stuttery and just doesn't look good.

I find that the amount of time in between ENTER_FRAME events, which I'm adding on to my accumulator, averages out to 28.5ms (1000/35) just as it should, but individual frame times vary wildly, sometimes an ENTER_FRAME event will come 16ms after the last, sometimes 42ms.

This means that at each graphical redraw the character graphic moves by a different amount, because a different amount of time has passed since the last draw. In theory it should look smooth, but it doesn't at all. In contrast, if I just use the ultra simple system of moving the character 6px every frame, it looks completely smooth, even with these large variances in frame times.

How can this be possible? I'm using getTimer() to measure these time differences, are they even reliable?

sentences:
Non axis aligned bounding box collision and physics Exactly how much more expensive, and while we're at it, difficult, is it to have non-axis aligned bounding boxes in your framework?

I realise that it very much depends on what you're trying to do, so here's a little bit of detail; My small demo framework has a number of bots running around shooting each other. when they die, they explode into cubes. When they're hit, or the bullets miss and hit a wall; more cubes.

At the moment I'm taking advantage of the fact that my framework has no floor, just walls, so you can't really tell if the cubes are resting exactly on the floor or not - as a result I'm using bounding spheres as a cheats collision detection. The main visual problem is when a bot dies from a point blank shot; the middle of the agent blows out backwards but the bottom and top parts sort of collapse into a little pile of cubes.

I'd love to be able to have much more realistic physics on all the cubes so they collide and tumble realistically over one-another.

How would I go about achieving this? and how feasible is it? to have a little physics engine which is just cube on cube.

sentences:
Why is depth test not working properly in my code? http://jsfiddle.net/w9WqJ/31/

When rotating the camera, some pieces that are supposed to be hidden are displayed. Should I create more triangles or what did I do wrong here?

sentences:
Panda3D documentation, manual, and tutorials for offline viewing? Is there a way to get the Panda3D's manual and tutorials available for offline viewing? I'm going on a business trip and I will spend a good deal of time at the airports and on long flights. I'd love to get started on Panda3D while in flight. Is there a way to get all that information available for offline, or use some program to download the tutorials and manual webpages?

Thanks

sentences: What percentage of game content is normally free on a Free-to-Play game? If I wanted to launch a free-to-play game with different characters, weapons, items and clothes that can be either unlocked through gameplay or bought with real money, what percentage of items should only be available for real money? This isn't "subjective" - I'm interested in examples of real games and estimates of what percentage of their content is free.

sentences:
What exactly are smart material packs on Quixel Mixer? Not sure if this is a good spot to ask this, but I'm using this for Unreal, so I figure it probably is?  If not, please comment instead of downvoting.
When prompted to select the packs I wanted on the installer, I left it at the default which was only Smart Material Pack 5, mainly because it made it a 3 gb download instead of a 20 gb download.  This leads me to wonder what exactly these packs do, and what I will be missing by not downloading all of them?  Will I still get all of Mixers features?  Are they just materials with settings already set up?  Thanks.

sentences:
How to work with edge Texture Im not sure if i use the right terms, but im not able to find something to start with.

Im trying to develop a little HTML5 game. I have a ground with a texture and now I want to make a surrounding texture. The texture is an image wich should be bend around the ground.

At the moment im using easelJS for display my images/textures. So im looking for some sort of Tutorial/Script/Advice. Im not even sure if I can bend a image in javascript. So the worst case I can think of is split the image in 100 pieces and then put it back together and rotate each piece.

for example like this:

sentences:
Unity3D - Using AddRelativeForce to push an object forever in zero gravity environment Ok, I use AddRelativeForce to basically push an object. But it suppose to keep flying and keep accelerating as I hold down the key because I didn't set gravity. I just started Unity3D last month, so pls give me some advice.

// Force of individual thrusters
public float thrusterForce = 10000;
// Whether or not to add force at position which introduces torque
public bool addForceAtPosition = false;

private bool thrusterIsActive = false;
private Transform objectTransform;
private Rigidbody objectParentRigidbody;

void FixedUpdate() {
    if (thrusterIsActive) {
        if (addForceAtPosition) {
            objectParentRigidbody.AddForceAtPosition (objectTransform.up * thrusterForce, objectTransform.position);
        } else {
            objectParentRigidbody.AddRelativeForce (Vector3.forward * thrusterForce);
        }
    }
}

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:
Implementing an AI controller for Pacman I'm currently implementing an AI controller class that is being used to determine the moves that ms.pacman should make to collect pills and avoid ghosts. In order to determine which is the best move to make in each state (configuration) of the game, I'm using Breadth-First Search to search the decision tree at each state. I've gotten the controller to work (at least somewhat) for Depth-First Search so I was trying to apply the same logic here.

The idea for DFS was to start with a "root" or driver function which would iterate through the possible moves ms. pacman could make at each state in the decision tree and then make a call to a recursive function that searches the tree to find the terminal state (point at which all pills have been eaten) with the highest value (e.g. highest score). This value is returned from the recursive function and stored in a variable in the root function. The root function the returns the move (out of possible moves) that had the highest value in the tree.

Since BFS is not recursive, I was thinking that it wouldn't be necessary to have a driver function like this, so I decided to put it all in one function. Based on DFS, I'm implementing BFS using a queue which stores all of the neighboring states of the current state and visits each state in FIFO order. Once a state is reached in which all pills have been eaten, the current Move should be returned. I'm not sure if this is the best approach, but its what I could come up with. The problem is that the code for the function takes too long to run and ms.Pacman immediately just goes left and runs into a wall. I'm assuming this is because the terminal state is never being found. Here is the function (in Java):

  public MOVE bfs(Game state){
        EnumMap<GHOST,MOVE> ghostMove = new EnumMap<>(GHOST.class);
        MOVE bestMove = MOVE.NEUTRAL;
        Queue<Game> q = new LinkedList<>();
        q.add(state.copy());
        while(!q.isEmpty()){
            Game current = q.peek();
            q.remove();
            for (MOVE move : current.getPossibleMoves (current.getPacmanCurrentNodeIndex())) {
                Game neighbor = state.copy();
                neighbor.advanceGame(move, ghostMove);
                q.add(neighbor);
                if ((current.getNumberOfActivePills() == 0) && (current.getNumberOfActivePowerPills() == 0)) {
                    return move;
                }

            }
        }
        return bestMove;
    }

Is there anything wrong with the design of the algorithm that could be causing this problem?

sentences:
How to design the scenarios in a platform game? I am developing a 3D platform game like Metroid Fusion with XNA. I have many classes for different elements as models, game screens, post-processing and so on. Now I want to start designing the scenarios but I think that the scenarios needed in a platform game are not as conventional.

I am very lost and do not know where to start and how to structure it.

sentences:
Splitting a sprite sheet into sprites Each animation has its own sprite sheet. First I tried to give each sprite their own rectangle and do some calculations to make sure that the bottom left corner of each sprite would be at the same position as the default sprite's bottom left corner. But I discovered this doesn't work properly for some animations.

So I tried to give all sprites in a sprite sheet the rectangle of the sprite with the biggest dimensions. This works for each individual animation, but when changing from one animation to another the rectangle size changes, so it gives the same problem as the first method. Additionally, when flipping the character it's flipped around the center of the rectangle, not necessarily the character.

Now I'm thinking of using the second method, but for each animation defining a pivot point that the character will be flipped around and a sprite offset will be calculated in relation to the x and y distance between the pivot point of the default animation and the current one, so that the character center will always be at the same position. This is manual and thusly means more work and is prone to human error. Is this really the best method? It's certainly better than defining this offset manually for each sprite.

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:
Camera Rotation (for mouse look) with LookAt does not work as expected (Local/Global) My code for rotating my 3D fps camera isn't working as expected.
I expect that the X-axis does rotate with the Y-axis, but it ain't so.

I made some pictures to explain it better, I think its doing global rotation instead of local rotation.
But I searched in the internet and used code for local rotation and it was still the same result.

Image

Normal Position
Rotated on Y-Axis
Rotated on X-Axis (how it is)
Rotated on X-Axis (how it should be)

And this is my rotating code:
X-Axis

float sx = sinf(x);
float cx = cosf(x);

up.y = up.y*cx - up.z*sx;
up.z = up.y*sx + up.z*cx;

center.y = center.y*cx - center.z*sx;
center.z = center.y*sx + center.z*cx;

Y-Axis

Math::Vector3f f = Normalise(center - eye);

float sy = sinf(y);
float cy = cosf(y);

center.z = eye.z + f.z*cy - f.x*sy;
center.x = eye.x + f.z*sy + f.x*cy;

It doesn't matter with which order I rotate, still the same.

sentences:
How to properly write "stick to surface" character logic that handles unexpected large time deltas? I've been trying to wrap my head around this issue: in a 2D platformer game (but this may as well apply to 3D games) I want the character to "stick" to the surface that it's moving along and at the same time maintain the same velocity no matter the incline/decline of the current surface. Also, if my character's speed is 1 unit/sec and the current delta time is 0.25, I want it to travel exactly 0.25 units no matter the "shape" of the surface met along the way during the frame.

Naively, I started with this base logic (warning, pseudo-code incoming):

vel += acceleration * timeDelta;
movementDelta = vel * timeDelta;

hit = raycast(pos, downward);

if (hit)
{
    vectorAlongSurface = hit.normal * fancyLinearAlgebra;
    pos += vectorAlongSurface.Normalized * movementDelta.Magnitude;
}
else
{
    pos += movementDelta;
}

But this is correct only if my character moves along the same surface normal for the whole frame and it breaks pretty badly if during the frame the surface has different normals along the way. This can give the feeling that the speed at which the character is moving is inconsistent. To give you an example:

While I do expect answers like "just don't make your terrain like that" I'm also considering situations where my game might experience an unexpected lag and have to deal with a large time delta that might push the character through different surface normals during the same frame.

Any advice on how to properly handle this would be much appreciated. I was thinking about somehow tracing all the changes of surface inclination from the character's position to the "naive raycast hit" point, but that seems to be quite expensive, especially considering that all the enemy characters would have to do the same. There must be some simple solution to this that I'm not seeing. Or maybe there's a way to make the inconsistency of speed in the given example less noticeable/irrelevant?

Thank you guys.

sentences:
Regarding BGE (Blender Game Engine), is it possible to generate a single .exe file from multiple files linked together? Would any of you guys or gals know the answer, please?

I know one can generate a .exe (windows executable) file from a single blend file. My question is very simple: Can anyone generate a single .exe file from multiple blender files of a same project?

For instance, say I have a project folder with several subfolders and files from my project game. Each folder has specific elements like scenes, models, textures, etc. They are all linked together to form the final game. Now I want to generate a single .exe file for my game. Is this possible?

Or, rather, should I make an entire game inside a single .blend file? (It seems like a very unlikely arrangement, maybe even impossible, but I rather ask). Or maybe even create a master .blend file from where to link all data and when project is finished pack everything before generating the executable (.exe)?

sentences:
Get normal dependent on collisions position As I hask ask here I'm working on how my objects can move over the terrain and other objects. My proposal and also an idea in the answers was to calculate the rotation from the object with the normals from other objects around (under and in front) the moving object.

My main problem for that is how I can get the normal from an object at a special position. Let's take the ramp on the road from the old example. It depends from which side my car comes. If it comes from front it can drive along the ramp but if it comes from back it moves against the wall. Of course there are other normals if I come from the other side. All my objects have these variables:

float vertices[];
float normals[];
short drawOrder[];

float[] modelMatrix;
AABBox boundingBox;

So you see I can allways get the vertices, normals and the position. I can also test if the object collides with another object with the bounding box (axis aligned) but I have no idea how I can get the normal where the collision happens but that is the important thing for the rotation of the car. Do you have any ideas or are there usual way how to do this?

sentences:
How do I detect if my object is grounded? I am trying to detect when an object is grounded.
My script right now is:
using System.Collections;
using System.Collections.Generic;
using UnityEngine;

public class playermovement : MonoBehaviour
{
    public CharacterController2D controller;
    public Rigidbody2D rb;
    float horizontalMove = 0f;
    public float runSpeed = 40f;
    Vector2 forceapplied;
    public bool isGrounded;
    public float NumberJumps = 0f;
    public float MaxJumps = 2;
    public float jumpHeight = 7f;
    public CircleCollider2D bc;

    void Start()
    {
        forceapplied = new Vector2(0.0f, 30f);
    }

    void Update()
    {
        if(bc.gameObject.name == "Grid") {
            isGrounded = true;
            NumberJumps = 0;
        }
        horizontalMove = Input.GetAxisRaw("Horizontal") * runSpeed;

        if (NumberJumps > MaxJumps - 1)
        {
            isGrounded = false;
        }
    }

    private void FixedUpdate()
    {
        if (isGrounded)
        {
            if (Input.GetButtonDown("Jump"))
            {
                rb.AddForce(Vector2.up * jumpHeight);
                NumberJumps += 1;
            }
        }
        controller.Move(horizontalMove * Time.fixedDeltaTime, false, false);
    }
}

In the inspector it always says that Isgrounded is false.
Can someone please help?

sentences:
How can I extrude a regular, grid-based 2D shape to 3D? I have a list of vertex coordinates which encircle several 2D areas. Orthogonal lines only, but not necessarily convex areas... similar to PCB traces of conductive copper areas. I want to draw them like solid objects in 3D using OpenGL, but I'm still very new to 3D and struggling.

Please point me how to do this. I've managed to draw the outline only using GL_LINE_STRIP, but when I try GL_QUAD_STRIP or GL_TRIANGLE_STRIP, the list of coordinates is not properly ordered for triangle strip and the fact the areas are not convex prevent me from doing a simple triangular tessellation.

These are the 2D shapes:

I'd like to render them like this:

sentences:
How can I render "two-sided" clouds like in Minecraft? The clouds in Minecraft are semi-transparent and are rendered on both sides.  If you fly into the cloud you can see inside of the cloud.
If I render clouds the inside faces would be visible on the outside.
How can I prevent that?
Z-Ordering the faces and render near to far with depth test on?
There must be a better, easier way.
Could the accum or stencil buffers be used somehow?

UPDATE : I think the crucial point everyone is forgetting is that these clouds and semi-transparent and "blended" into the scene as each face is rendered.  If two faces are rendered on top of each other the "white" texture will double up which is undesired.  The faces also seem to have slight lighting variations which would rule out using a stencil.

UPDATE2: Just another note.  Each cloud is 12x12x4 blocks (roughly).  Larger clouds are just a group of the base clouds stuck together.

Here's showing clouds from above. They are translucent and the chunks below can be seen.

And here's the view from inside them.

sentences: Will importing more items from unity packages increase the build size? I'm developing a GoogleVR (formerly Google Cardboard) application and need to import the GoogleVR SDK. While I only expect to use some of the items available in the Unity package, I'd like to import them all at once and save potential headaches later when I can't find something I might need. However I'm worried that including everything in the project may affect the build size, which would be troublesome on a mobile application.

sentences:
Location of "units" in Code So, I've been playing around with the concept of a game, mechanically think of the Civilization games(Tile, turn-based strategy) but I am quite uncertain about where I should store the units location in the code. The tiles exist on a X and Y coordination of integers and that's how I imagine that the unit's would work too.

To clarify, I am unsure what's most effective, if it's example one: To have the tiles have a variable for which units are standing upon it and then when the unit move destroy them and recreate them on the tiles they are moving to.

That way when the tile is clicked it should be very easy to get the unit but it seems like it might be unsafe to remove and recreate units or sending a variable along. This might also be very unpractical when issuing an order to move somewhere, though, I am don't know.

The second example is to add the units to some kind of unit arraylist (or alike) but by that the game would have to find the unit with the right coordinates in said list (right?), this might appear as if the game is unresponsive and slow. Though it might not matter when you sort the list every x interval...

Any other ways to do it, ideas, fixes or even comments from you guys would be much appreciated.

sentences:
What models am I allowed use when selling my game? I have purchased models through Daz3D, and I have downloaded a lot, for free. The 3D models were downloaded as .MMD or .FBX.

How do I tell if I can edit or use any of these models, in my game? When I sell my game, will I need a license to include these models?

sentences: Android game programming seperate game logic thread from drawing thread Ok so I want to know what is a proper way to create a multi threaded game. What I have tried is implement a wait and notify between the game logic thread and the drawing thread, but I believe this is a very bad way to do it because one thread waits for the other to finish what it is doing before it can continue to do it`s own task. I mean, I think this kind of beats the whole point. So a better way I am thinking of would be to have blocking queues(I would need more than one for all the different types of data in my game) and the updating thread would put all of the updated/processed values into it and if it was full, the updating thread would block. The drawing thread would then read all of those values and if the queues were empty it would block. This way both the threads are fully utilized. But I don't know if this would be the professional or good way to do it, which is why I am posting this so I can get a little guidance. Thanks!

sentences:
How to handle multiplayer in JavaScript? I'm just doing a bit of research into tech to use for a mobile multi-player game.

It's more an experiment at present so for the moment, the only thing that Players need to be aware of is the other Players.

If this was a typical web application and not a game It'd just have HTTP requests firing all the time -- but since this is a game, performance and accuracy is going to be a problem.

Due to the game being targeted at multiple phone platforms, lets say that the client will be written in JavaScript or a framework based on JavaScript. The server technology is totally open.

Each player will need to make the equivalent of a HTTP post and get only using a faster protocol. The reason for multiplayer being web based is because multiplayer across Bluetooth or other local networking would be too diverse across the platforms and could cause problems.

So the question boils down to whats a good protocol/technology to use for JavaScript multiplayer? Any advice on the server side stuff or does it matter? Any reason I should drop this two-tier architecture and go with direct phone-to-phone connection?

sentences:
How to develop a GameMaker game for both desktop and mobile For a few months I have been creating a game using GameMaker Studio 2 Desktop.
It turns out that I would like to launch it also for cell phones, and for that I bought GameMaker Studio 2 Mobile.
That's when my doubt arises.
In GameMaker Studio 2 Mobile, you have the option to open the projects made in GameMaker Studio 2 Desktop, and its interface is the same as in GameMaker Studio 2 Desktop.
There are 2 shortcuts on my computer:

Now I don't know if GameMaker Studio 2 is a new program, or works only as a license that allows me to launch the game on another platform (like a plugin extension).
I remember that in GameMaker Studio 1.4, there was just one version of the editing software, and each version of the game (desktop or mobile) had its own code.
I basically had to copy the game project and edit the copy with its equivalent features.
I remember that one of the adaptations is at the time of clicking on the screen, because on the cell phone you don't use mouse_x or mouse_y.
What I would like to know is if I will need to adapt the code for this mobile version or, when exporting the game for the mobile platform, will the code be adapted automatically?

Before coming here I looked for solutions in these links:
https://www.reddit.com/r/gamemaker/comments/dgmkld/cross_platform/
https://www.reddit.com/r/gamemaker/comments/5mn0p5/crossplatform_online_multiplayer_with_or_without/
https://www.reddit.com/r/gamemaker/comments/5g2ej2/cross_platform/

At one point I realized that maybe I was using the wrong term in the
search, because the results I was finding revealed different things
than what I was looking for: stuff about whether desktop and
mobile players can play together, which is not useful for me since the
game I am producing is not online.

sentences:
OpenGL why point's size stay the same while zooming/unzooming i'm currently working on a game engine for a college's project. While implementing some debug tools I came across a little problem. When i'm drawing point on the ModelView Matrix the point's thickness doesn't stay at scale with the other objects.

This is how I draw a point

    public static void DrawPoint(Vector3 p1,float size,Color color)
    {
        GL.Disable(EnableCap.Texture2D);
        GL.PointSize(size);
        GL.Begin(BeginMode.Points);
        GL.Color3(color);
        GL.Vertex3(p1.X, p1.Y, p1.Z);
        GL.End();
    });

This is my drawing loop

          protected sealed override void OnRenderFrame(FrameEventArgs e)
    {
        base.OnRenderFrame(e);

        GL.Clear(ClearBufferMask.ColorBufferBit | ClearBufferMask.DepthBufferBit);
        GL.MatrixMode(MatrixMode.Modelview);
        GL.LoadMatrix(ref _Camera.CameraMatrix);
        GL.PushMatrix();

        RenderGame(); //<-- Where I render world object

        GL.Clear(ClearBufferMask.DepthBufferBit);
        GL.LoadIdentity();
        GL.MatrixMode(MatrixMode.Projection);
        GL.PushMatrix();
        GL.LoadIdentity();
        GL.Ortho(0, Width, 0, Height, -1, 1);
        GL.MatrixMode(MatrixMode.Modelview);

        DrawHUD(); //<-- Where I render UI

        GL.MatrixMode(MatrixMode.Projection);
        GL.PopMatrix();
        GL.MatrixMode(MatrixMode.Modelview);

        GL.PopMatrix();
        SwapBuffers();
    }

All points are drawn in the RenderGame method

My question is am I doing something wrong  when I draw points, because it is the only shape that doesn't behave correctly. Or maybe it's just something I don't understand from openGL side.
I'll put images of the problem soon.

sentences:
OpenGL - How can I make the edges of this textured circle smoother? I'm building a game and I've applied a certain texture (RAW file) to a circle (GL_POLYGON) in OpenGL. It loads correctly, with the right size and all, but the edges seem a bit jagged and I would prefer them smooth (without any evidence of a polygon being underneath).

GLuint loadTex(int wrap){
GLuint texture;
int width, height;
BYTE * data;
FILE * file;

file = fopen( "tex.raw", "rb" );
if (file == NULL){
    std::cerr << "O ficheiro da textura não foi encontrado" << std::endl;
    return 0;
}

width = 128;
height = 128;
data = (BYTE*)malloc( width * height * 3 );//Alocação do buffer

fread( data, width * height * 3, 1, file );//Ler dados da textura
fclose( file );

glGenTextures( 1, &texture );//Nome da textura
glBindTexture( GL_TEXTURE_2D, texture );//Selecção da textura actual
glTexEnvf( GL_TEXTURE_ENV, GL_TEXTURE_ENV_MODE, GL_MODULATE );
glTexParameterf( GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, GL_LINEAR_MIPMAP_NEAREST );//Parâmetros da Textura
glTexParameterf( GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER, GL_LINEAR );
glTexParameterf( GL_TEXTURE_2D, GL_TEXTURE_WRAP_S, wrap ? GL_REPEAT : GL_CLAMP );
glTexParameterf( GL_TEXTURE_2D, GL_TEXTURE_WRAP_T, wrap ? GL_REPEAT : GL_CLAMP );
gluBuild2DMipmaps( GL_TEXTURE_2D, 3, width, height, GL_RGB, GL_UNSIGNED_BYTE, data );

free(data);

return texture;
}

void drawCircle(float cx, float cy, float r, float aspectRatio){

GLuint t = loadTex(1);
float angle, radian, x, y, tx, ty, xcos, ysin;

glEnable(GL_TEXTURE_2D);
glBindTexture(GL_TEXTURE_2D, t);

glBegin(GL_POLYGON);

for (angle=0.0; angle<360.0; angle+=2.0){
    radian = angle * (M_PI/180.0f);

    xcos = (float)cos(radian);
    ysin = (float)sin(radian);
    x = xcos * r  + cx;
    y = ysin * r*aspectRatio + cy;
    tx = xcos * 0.5 + 0.5;
    ty = ysin * 0.5 + 0.5;

    glTexCoord2f(tx, ty);
    glVertex2f(x, y);
}

glEnd();
glDisable(GL_TEXTURE_2D);
}

Is this a problem from my texture file? Or is it from my code? I apply Line Smoothing before drawing anything (and it is being applied correctly in my lines I believe)

sentences:
CrossPlatformInput Prefabs - Button handler to move? I am currently trying to put two buttons on my UI that move a character left and right if touched down (Held). I would like to use the cross platform input, and would like the buttons to change the value of the Horizontal axis as my "A" and "D" keys would...

And my code for moving my character is as follows:

private void Update()
    {
        isGrounded = Physics2D.OverlapCircle(groundChecker.position, .15f, groundLayer);

        float move = CrossPlatformInputManager.GetAxis("Horizontal") * moveSpeed;
        playerRB.velocity = new Vector2(move, playerRB.velocity.y);

    }

sentences:
Help Understanding Cameras/View Matrices in DirectX11 (C#) So I'm designing a soft game engine in C# on top of the SharpDX API (a C# wrapper for DirectX). As I'm designing the camera, though, I'm running into some issues getting the 3D perspective correct. I've read through a few tutorials and articles, but I can't seem to find what I'm doing explicitly wrong.

This is my current understanding: The world matrix is the identity matrix (of the world...) times the translation matrix of the model, times the rotation matrix of the model, times the scale matrix of the model, which should then give me the transformed location of each vertex in "world space." The view matrix would then be the output matrix of LookAtLH(cameraPositionVec, targetPositionVec, upVec);. Finally, the projection matrix seems to be the output of the PerspectiveFovLH(fov, aspectRatio, nearDist, farDist); So, I then took the transpose of each of these matrices, multiplied world * view * projection and I should be left with the final transformed vertex coordinate.

Here's the code I have so far. I've left the world matrix untouched by just setting the translation to the origin, the rotation of the model to the identity matrix, and the Scale to 1, which should mean I don't have to actually perform any world matrix calculations for the sake of simplicity right now.

// Setup and create the projection matrix.
projectionMatrix = Matrix.PerspectiveFovLH((float)(Math.PI / 4.0f), ((float)GameWindow.WIN_WIDTH / (float)GameWindow.WIN_HEIGHT), 0.1f, 100.0f);

// Initialize the world matrix to the identity matrix.
worldMatrix = Matrix.Identity

...
//camera class
public Camera(Vector3 _position, Vector3 _target, Vector3 _rotation)
{
    position = _position;
    target = _target;
    rotation = _rotation;
}
public Matrix GetViewMatrix()
{
    //convert degrees to radians
    float pitch = rotation.X * 0.0174532925f;
    float yaw = rotation.Y * 0.0174532925f;
    float roll = rotation.Z * 0.0174532925f;

    //get rotation matrix and the relative up vector
    Matrix rotationMatrix = Matrix.RotationYawPitchRoll(yaw, pitch, roll);
    Vector3 up = Vector3.TransformCoordinate(Vector3.UnitY, rotationMatrix);

    return Matrix.LookAtLH(position, target, up);
}

....

//set the view matrix
viewMatrix = camera.GetViewMatrix();

...
//Transpose the matrices
worldMatrix.Transpose();
viewMatrix.Transpose();
projectionMatrix.Transpose();

From there they are fed to the vertex shader, which is below. If I comment out the projectionMatrix multiplication though, the image shows up. If It's not commented out though, nothing renders to the screen, which leads me to believe that may be the issue.

//vertex shader
cbuffer MatrixBuffer
{
    matrix worldMatrix;
    matrix viewMatrix;
    matrix projectionMatrix;
};

struct VertexInputType
{
    float4 position : POSITION;
    float2 tex : TEXCOORD0;
};

struct PixelInputType
{
    float4 position : SV_POSITION;
    float2 tex : texCoord0;
};

PixelInputType main(VertexInputType input)
{
    PixelInputType output;

    // Change the position vector to be 4 units for proper matrix calculations.
    input.position.w = 1.0f;

    // Calculate the position of the vertex against the world, view, and     projection matrices.
    output.position = mul(input.position, worldMatrix);
    output.position = mul(output.position, viewMatrix);
    output.position = mul(output.position, projectionMatrix); //<-- If I comment this line, it renders to the screen
    // Store the texture coordinates for the pixel shader.
    output.tex = input.tex;

     return output;
}

I feel like I'm missing something really basic, because I think I'm pretty close. Thanks for any help you can provide.

sentences:
Loading and rendering one large image or many smaller ones I am working on an android game with a top down style view similar to the original GTA's or a scrolling version of Legend of Zelda.

I have recently begun designing some prototype levels for the game which vary between a corridor style dungeon similar to diablo or an open area with obstacles similar to Zelda.  My question is would it be better to have one large background image and draw it once or a relatively small one (size of or less than the view) and draw it multiple times.

My concerns are the memory required to load/store a large background image vs the performance boost of only drawing one image.

Any input would be appreciated.

sentences:
pixel displacement with shader Having started learning shaders and experimenting with tools like Shadertoy, I am attempting to make stereoscopic (anaglyph or autostereogram) shaders as an exercise. For this, I need to displace each pixel to the left/right depending on its depth value.

I am trying to generate a double image, based on the original image and the depth map, with each image pixel displaced to the left and right by a value depending on the depth map - so background pixels are displaced more/less (depending on the mode) than foreground pixels.

It would be easy to get the color of the pixel, say, 30 px to the left or right, if I needed a displacement of 30 for this particular pixel. The problem is, this would not actually work: instead, I need to change the color of the pixel 30 px to the left or right, and displace the color of the current pixel there.

One solution would be to use a for loop and check each pixel in the possible displacement range for its depth value. However this has an impact on performance that becomes untenable for large displacement values. With an average eye distance of 65 mm, this can easily require hundreds of pixels of displacement range.

Another solution (as per this answer) would be to generate two viewpoints and combine them, but I want to avoid doing so here. I am searching for a solution based on a single image and its depth map instead.

Is there a another, more efficient way to displace pixels in such a way using shaders?

Note: I am using Shadertoy for ease of use, but if a solution exists but is not usable in it, for example requiring a 3D engine to implement, it is still of interest.

sentences:
Does anybody know of any resources to achieve this particular "2.5D" isometric engine effect? I understand this is a little vague, but I was hoping somebody might be able to describe a high-level workflow or link to a resource to be able to achieve a specific isometric "2.5D" tile engine effect. I fell in love with http://www.youtube.com/watch?v=-Q6ISVaM5Ww this engine. Especially with the lighting and the shaders!

He has a brief description of how he achieved what he did, but I could really use a brief flow of where you would start, what you would read up on and learn and the logical order to implement these things.

A few specific questions:

1) Is there a heightmap on the ground texture that lets the light reflect brighter on certain parts of it?

2) "..using a special material which calculates the world-space normal vectors of every pixel.." - is this some "magic" special material he has created himself, or can you hazard a guess at what he means?

3) with relation to the above quote - what does he mean by 'world-space normal vectors of every pixel'?

4) I'm guessing I'm being a little bit optimistic when I ask if there's any 'all-in-one' tutorial out there? :)

sentences:
how to calculate initial Y velocity required to reach target? I am trying to calculate the y velocity necessary for my player character to jump up and reach a y position within 1 second.

Given that my game engine is at 60fps, I am doing:

velY = (targetY - playerY) / 60

..  However, I need to account for gravity which is being applied to the character on every update, so I am doing:

velY = ((targetY - playerY) / 60) - (gravity * 60)

This results in the player character always jumping significantly higher than expect.

UPDATE

Attempting to try the Equations of Motion approach, I am setting a timestamp when the player character should begin moving to the target position...  So then in my update loop, I am calling a function with currentTime - timestamp.

update: function(paceFactor) {
    // paceFactor in this game engine is how many nominal 60FPS game “ticks” have elapsed. So if the game is running at 30FPS, then paceFactor will be 2.0, if it's 60FPS, then 1.0 will be passed in.

  this.timer += paceFactor * (1 / 60);

  if (this.setVelocityAt) {
    this.setVelocityFor(this.timer - this.setVelocityAt, this.targetPoint);
  }

  this.position.x += this.vel.x * this.speed * paceFactor;
  this.position.y += this.vel.y * this.speed * paceFactor;
  this.position.y += (gravity * (paceFactor * paceFactor) * 0.5);
  this.vel.y += gravity * paceFactor;
},

setVelocityFor: function(time, target) {
  if (time > 1) {
    time = 1;
    this.setVelocityAt = undefined;
  }
  this.character.vel.x = (target.x - this.character.position.x) / time;
  this.character.vel.y = (target.y + (0.5 * GRAVITY * time * time) - this.character.position.y) / time;
},

Then later the position and gravity is applied to the character as described in the previous update.

However, the velocity being set is a huge number which is... wrong.

sentences:
Using shared memory instead of marshalling for C++ native plugins in Unity? So I'm a C++ developer who has been playing with C# for a week or two in order to get acquainted with Unity, and I'm curious about the marshalling process used to transfer data for use in C++ native plugins. From what I can tell, the general consensus is that while using effective C++ plugins can be a performance increase for computation-heavy tasks, the marshalling process of transferring data can be significantly slower than the potential gains provided by the C++ flexibility.

I'm familiar with how shared memory works in C++ and it appears C# has the functionality required to use the buffers as well. From what I understand, the process of marshalling is slow due to copying, creating buffers and transferring chunks from one memory segment into another. Even though there's the problem of cache coherency when operating in shared memory, it may be less than the cost incurred by marshalling. I'm sure I'll have to do some experimenting.

Does anyone have thoughts or experience with using shared memory or marshalling in Unity who could weigh in on the question?

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:
Unity: Shader Outlined/Uniform uses undefined Queue: 'Geometry + 1' my outline shader was working fine but suddenly it started throwing this error. the game still works fine in the editor though but when i try to build it gets stuck on the step:

Packing assets - sharedassets0.assets

this is my shader:

Shader "Outlined/Uniform"
{
    Properties
    {
        _Color("Main Color", Color) = (0.5,0.5,0.5,1)
        _MainTex ("Texture", 2D) = "white" {}
        _OutlineColor ("Outline color", Color) = (0,0,0,1)
        _OutlineWidth ("Outlines width", Range (0.0, 2.0)) = 1.1
    }

    CGINCLUDE
    #include "UnityCG.cginc"

    struct appdata
    {
        float4 vertex : POSITION;
    };

    struct v2f
    {
        float4 pos : POSITION;
    };

    uniform float _OutlineWidth;
    uniform float4 _OutlineColor;
    uniform sampler2D _MainTex;
    uniform float4 _Color;

    ENDCG

    SubShader
    {
        Tags{ "Queue" = "Geometry + 1" "IgnoreProjector" = "True" }

        Pass //Outline
        {
            ZWrite Off
            Cull Front
            CGPROGRAM

            #pragma vertex vert
            #pragma fragment frag

            v2f vert(appdata v)
            {
                appdata original = v;
                v.vertex.xyz += _OutlineWidth * normalize(v.vertex.xyz);

                v2f o;
                o.pos = UnityObjectToClipPos(v.vertex);
                return o;

            }

            half4 frag(v2f i) : COLOR
            {
                return _OutlineColor;
            }

            ENDCG
        }

        Tags{ "Queue" = "Geometry"}

        CGPROGRAM
        #pragma surface surf Lambert

        struct Input {
            float2 uv_MainTex;
        };

        void surf (Input IN, inout SurfaceOutput o) {
            fixed4 c = tex2D(_MainTex, IN.uv_MainTex) * _Color;
            o.Albedo = c.rgb;
            o.Alpha = c.a;
        }
        ENDCG
    }
    Fallback "Diffuse"
}

i tried looking on the internet but couldn't get any help on this error.

sentences:
How do audio based games such as Audiosurf and Beat Hazard work? Note: I am not asking how to make a clone of one of these. I am asking about how they work.

I'm sure everyone's seen the games where you use your own music files (or provided ones) and the games produce levels based on them, such as Audiosurf and Beat Hazard.

Here is a video of Audiosurf in action, to show what I mean.

If you provide a heavy metal song, you would get a completely different set of obstacles, enemies, and game experience from something like Vivaldi.

What does interest me is how these games work. I do not know much about audio (well, data-side), but how do they process the song to understand when it is settling down or when it's speeding up? I guess they could just feed the pitch values (assuming those sorts of things exist in audio files) to form a level, but it wouldn't fully explain it.

I'm either looking for an explanation, some links to articles about this sort of thing (I'm sure there's a term or terms for it), or even an open-source implementation of this kind of thing ;-)

EDIT: After some searching and a little help, I found out about FFT (Fast Fourier Transform). This maybe a step in the right direction, but it is something that does not make any sense to me..or fits with my physics knowledge of waves.

sentences:
Why do modern games not feature extra lives? In the late 80s and early 90s, most games had an extra life mechanic. The player started with limited lives (often three) and dying depleted one of them. If they still had some remaining, they would respawn at the last savepoint. The game would end once all lives had been used and they had to start from the beginning. Players could obtain additional lives during the game.

This mechanic was so widely used that it was rather the exception when games didn't use it. It was and still is one of the most recognized video game clichés (the above image has been printed on countless shirts).

Nowadays, this mechanic seems to have been forgotten.

Almost every modern game gives the player infinite retries from the last save. Many even let the player make their own savepoints with a quicksave mechanic. Those few that try to be different tend to go for the other extreme: The "roguelike" mechanic gives the player no retries.

What happened to the middle-ground of having extra lives? What game design revolution caused the game industry to abandon this feature?

When proposing an answer to this question, please try to back up your answer with citations and factual, objective evidence as much as possible so as to avoid dragging this post into the territory of being "too opinion-based." Focus on "what" happened and "when," which specific examples.

sentences:
Painting a Wall and Calculating the Paint Percentage in Unity I'm trying to paint a wall in Unity by following this tutorial however I don't know how can I calculate the paint percentage and not paint the lines that have been already painted, and also not go beyond plane boundaries. Painting needs to be using swerve mechanics.
What would be the approach to accomplish this?

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:
Why does launching an object using Rigidbody2d.velocity not work properly I am currently trying to launch a gameobject using Rigidbody2d.velocity but whenever I launch it goes backward instead of forwards. I have already tried making the vector 3 that I am using negative, but nothing seems to work. Please help as I don't even know why this happening.

Here is my code

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

public class ArmPower : MonoBehaviour {

    //Priority Script

    public ArmAngle armAngle;
    public bool allowLaunch = false;
    public GameObject armPowerSlider;
    public bool ifLaunched;
    public GameObject armPowerPhone;
    public StartAllowStrengthPower startAllow;
    public PhoneController armPhoneController;

    // Use this for initialization
    void Start () {
        armAngle = FindObjectOfType<ArmAngle>();
        armPowerSlider = GameObject.Find("PowerSlider");
        ifLaunched = false;
        armPowerPhone = GameObject.Find("Phone");
        startAllow = FindObjectOfType<StartAllowStrengthPower>();
        armPhoneController = FindObjectOfType<PhoneController>();
    }

    // Update is called once per frame
    void Update () {
        if (allowLaunch)
        {
            LaunchPhone( (int) (Mathf.Round(armPowerSlider.GetComponent<Slider>().value) ));
            ifLaunched = false;
        }
        if(startAllow.allowLaunchChanger <= 0)
        {
            LaunchPhone((int)(Mathf.Round(armPowerSlider.GetComponent<Slider>().value)));
        }

    }

    public void LaunchPhone(int launchAmount)
    {

        Vector3 launchValue = new Vector3(armPowerPhone.transform.position.x, launchAmount, armPowerPhone.transform.position.z);

        armPowerPhone.GetComponent<Rigidbody2D>().bodyType = RigidbodyType2D.Dynamic;

        armPowerPhone.GetComponent<Rigidbody2D>().velocity = launchValue;

        armPhoneController.armAudio.Play();

        armPowerPhone.transform.SetParent(null);
        armAngle.allowStrength = false;
        allowLaunch = false;
        ifLaunched = true;
        startAllow.allowLaunchChanger = 5;

    }
}

sentences:
Resolving collision with multiple objects I already have SAT implemented for collision detection and MTV computation and it works totally fine when my character collides with only one object.

But it's possible that there is a collision with multiple objects at once. How do I handle such cases? How do I evaluate chracter translation using all computed MTVs?

Pseudocode of how my code currently looks like:

// Contains objects collision with which was detected during broadphase
list<collider> overlappingObjects;
// Collider for the character for which I'm trying to solve the collision
collider characterCollider;

response res;
vec3 translation;
for(collider in overlappingObjects){
   // test if they actally collide and put collision information in `res` if they do
   if(testCollision(characterCollider, collider, res)){
       translation += res.mtv;
   }
}

// Moving character out of the collided objects
characterCollider.offset(translation);

This code works incorrectly if overlappingObjects contains more than 1 object.

What is the correct solution for such problem?

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:
OnCollisionEnter only triggering if colliding object starts inside collider Despite the absurdly high number of "OnCollisionEnter not working" threads around the internet, no one else seems to have had this specific problem.

To start off with, I have a spherical "shield" object around my ship, which has a shader designed to give off impact effects when hit by an object. To trigger the shader impact effect, you need to give it the position from which do the effect. So, the easiest way to do this is to give the shield a Collider and, whenever OnCollisionEnter is called, it sends the contact.point details to the shader. That's not the difficult part. The part that isn't working is that OnCollisionEnter is not being called when the laser bolt fired at the shield actually collides with the shield.

Both the shield and the laser bolt have Sphere colliders, both are not triggers. Only the shield has a rigidbody, which is not kinematic.

void OnCollisionEnter (Collision collision) {
    Debug.Log (Time.time);
    if (collision.transform.tag == "Impact") {
        Debug.Log ("go");
        //Does the shader stuff
        }
    }
}

That script is attached to the shield object. Not only is "go" never being logged, but neither is the Time, so OnCollisionEnter is not being called.

The odd thing about this scenario is that, OnCollisionEnter will be called by objects that begin inside the shield's collider - so if I start the laser bolt inside the shield, then the function gets called as usual. But when I start the laser outside the shield and Translate it into the shield, nothing happens. For the life of me, I can not work out what's going wrong with it.

sentences:
Render-to-texture doesn't work on nvidia cards. OpenGL 3.3 I've implemented some postprocessing effects (DOF, HDR, Bloom) into my engine. I've tested it on AMD card which supports OpenGL 4.2. Yesterday I've made a test on NVidia card which supports only OpenGL 3.3. I tried to write my code to works also in OpenGL 3.3 but I was suprised when I saw something like on the screen:

It seems that textures are filled with random values and never change during app life (only when I'm changing dimensions of textures so basically recreate them). It happens mostly when I want downscale texture to some size (I use 2 textures to do that and a shader). Here is some examples of my code which implements Bloom effect:

Creating framebuffer:

if (!_p_buffer)glGenFramebuffers(1, &_p_buffer); // generate postprocess buffer
glBindFramebuffer(GL_DRAW_FRAMEBUFFER, _p_buffer);

    for (int i = 0; i < 2; i++){
        _lens[i].create(x / D.lensDownsample(), y / D.lensDownsample(), 0, IMAGE_16F_3, IMAGE_2D, true, FILTER_LINEAR); // create Lens Flare texture (with half resolution)
        glFramebufferTexture2D(GL_DRAW_FRAMEBUFFER, GL_COLOR_ATTACHMENT2 + i, GL_TEXTURE_2D, _lens[i].get(), 0);
    }

Render-to-texture:

glBindFramebuffer(GL_DRAW_FRAMEBUFFER, _p_buffer);

// first downsample image
glDrawBuffer(GL_COLOR_ATTACHMENT2);
glClear(GL_COLOR_BUFFER_BIT);

glActiveTexture(GL_TEXTURE0);
_aux[_aux_number].lock();

Shaders["ScaleBias"].set(true);
Shaders["ScaleBias"].set("scale", Vector4(1.2f));
Shaders["ScaleBias"].set("bias", Vector4(-0.4));
Shaders["ScaleBias"].set("texelSize", Vector2(1 / (float)D.x() * D.lensDownsample(), 1 / (float)D.y() * (float)D.lensDownsample()));

glViewport(0, 0, D.x() / D.lensDownsample(), D.y() / D.lensDownsample());
Quad();

ScaleBias shader:

void main() {
    FragColor = max(vec4(0.0), texture(col, gl_FragCoord.xy*texelSize) + bias) * scale;
}

What "create" method actually does here:

if(!_image)glGenTextures(1, &_image);

glBindTexture(GL_TEXTURE_2D, _image);

glTexParameteri(_gl_target, GL_TEXTURE_WRAP_S, GL_CLAMP_TO_EDGE);
glTexParameteri(_gl_target, GL_TEXTURE_WRAP_T, GL_CLAMP_TO_EDGE);
glTexParameteri(_gl_target, GL_TEXTURE_WRAP_R, GL_CLAMP_TO_EDGE);
glTexParameteri(_gl_target, GL_TEXTURE_MIN_FILTER, GL_LINEAR);
glTexParameteri(_gl_target, GL_TEXTURE_MAG_FILTER, GL_LINEAR);

glTexImage2D(GL_TEXTURE_2D, 0, GL_RGB16F, x, y, 0, GL_RGB,GL_FLOAT, NULL);

I used debug extension to check if there is any invalid parameters but debuging shows nothing interesting. I tried make G-Buffer textures as GL_FLOAT but they works ok. I tried make shader as simple as possible (return color texture) but error still was valid. I've observed similar problem on newer NVidia cards but the only difference was that textures are clear (black). But they still didn't update. Framebuffer doesn't output any errors.

Could you point me out the cause of this bug or give some clue?

sentences:
moving in the wrong direction Solution:

To move a unit forward:

forward = Quaternion(0,0,0,1)
rotation.normalize() # ocassionally
...
pos += ((rotation * forward) * rotation.conjugated()).xyz().normalized() * speed

I think the trouble stemmed from how the Euclid math library was doing Quaternion*Vector3 multiplication, although I can't see it.

I have a vec3 position, a quaternion for rotation and a speed.

I compute the player position like this:

rot *= Quaternion().rotate_euler(0.,roll_speed,pitch_speed)
rot.normalize()
pos += rot.conjugated() * Vector3(0.,0.,-speed)

However, printing the pos to console, I can see that I only ever seem to travel on the x-axis.

When I draw the scene using the rot quaternion to rotate my camera, it shows a proper orientation.

What am I doing wrong?

Here's an example:

You start off with rotation being an identity quaternion: w=1,x=0,y=0,z=0
You move forward; the code correctly decrements the Z
You then pitch right over to face the other way; if you spin only 175deg it'll go in right direction; you have to spin past 180deg.  It doesn't matter which direction you spin in, up or down, though
Your quaternion can then be something like: w=0.1,x=0.1,y=0,z=0
And moving forward, you actually move backward?!

(I am using the euclid Python module, but its the same as every other conjulate)

The code can be tried online at http://williame.github.com/ludum_dare_24_evolution/
The only key that adjusts the speed is W and S.  The arrow keys only adjust the pitch/roll.

At first you can fly ok, but after a bit of weaving around you end up getting sucked towards one of the sides.  The code is https://github.com/williame/ludum_dare_24_evolution/blob/cbacf61a7159d2c83a2187af5f2015b2dde28687/tiny1web.py#L102

sentences:
How to make an action perform only after an animation has run? I have an actor who has some animations. Animations perform based on some actor states (animation blueprint of actor):

Conditions at the Event Tick (similar to while loop):

The actor changes perfectly from animation to animation. What I'd like to do is for it to damage an enemy as soon as the attack animation is over.

I tried some codes...

In this one, for example:

This variable (minionAtk) modifies the state of the actor. See the image below in the event (which is only called when the minionAtk is true) that I can successfully change the state of the actor (to the attacking state):

Animation Blueprint:

Transition:

But since the change from true to false is done instantly, the attack animation is not even shown.

To solve this, I put a delay and a condition so that the event could not be called again while the execution of cycle (attack animation => end attack animation) ended:

So when the actor is in the attacking state, the attack animation usually performs. After 5 seconds the animation stops.

It turns out that in this time interval the animation does not play only once.

I imagine there is a way to do the time calculation that the animation lasts, and based on that set the delay time.

But better than that, I wondered if there was no way to know when the animation was finished and from that, change the variable to false and perform the damage action.

Thinking about it I researched and found this:

https://answers.unrealengine.com/questions/329698/animation-damage.html

But I came across this error:

  This blueprint (self) is not a BTTask_BlueprintBase, therefore '
  Target ' must have a connection.

Error link:

https://answers.unrealengine.com/questions/549437/error-this-blueprint-self-is-not-a-therefore-self.html

I also saw something about sphere traces, attached to an actor socket. But in my case I don't want to apply the damage just in case of contact of the actor's arm (armed or unarmed) to the target, it would be something as seen in MOBA style games.

It would be like a basic attack from Garen/Yasuo/Darius.

sentences:
In what kind of variable type is the player position stored on a MMORPG such as WoW? I even heard J. Carmack quickly talk about it...

How a software can track a player's position so accurately, being on a such huge world, without loading between zones, and on a multiplayer scale ? How is the data formatted when it passes through the netcode ?

I can understand how vertices are stored into the graphic card's memory, but when it comes to synchronize the multiplayer, I can't imagine what is best.

sentences:
How to handle sounds muting in settings? I have a easy and specific question.

Let's say that in my game I use singleton for playing/pausing/changing volume of specific sounds (SimpleAudioEngine in cocos2d-x).

What is the best way to handle mute button, which is displayed in the upper corner of the screen? Should I just volume everything down and do not care about checking the state of this setting before playing any kind of sound?

1) This is called when an object is destroyed

if (!UserDefault::getInstance()->getBoolForKey(MUTED, false))
{
    SimpleAudioEngine::getInstance()->playEffect("shouting.ogg", /* other arguments */)
}

I think that not playing a sound at all is bad practise (if muted is on - like in the above example), because when the user changes this setting while eg. his hero is getting shot, nothing will be played - even if it supposed to take 5 seconds and the option was changed after 2,5 seconds.

But if I only volume everything down - then the rest of the shout will be heard.

sentences:
Unity3d or WebGL: Where should I go? I am interested in making a simple 3D game this summer, and I'd prefer if it were playable in a browser. My choices I am considering are Unity and WebGL. Currently I have no experience in either. But I have taken an introduction course to OpenGL. As well I will later be taking a course that will use Unity. I have some C# experience, but no web background.

The factors I'm considering are ease to learn and the penetration each has. I know Unity games can be uploaded to Kongregate, which seems like a pretty big deal if I made a game that would be somewhat successful. But of course that may not be the case at all.

Which way should I lean? Personally I think learning WebGL would be the easiest transition, but I am not sure

sentences:
How to detect whether my Java application is active? I want to pause my game (written in Java Swing), when the player switches to another application.

But I did not find a way to detect this switch. window.isActive() only works for multiple windows within one Java application. But it does return true, when a different application has the focus.

The same is true for the KeyboardFocusManager, it returns the window of my application that had the focus before the focus was given to another application.

sentences:
Slick UnicodeFont displays in different location depending on the screen size? I am using the Slick2D library to draw text. The text draws perfectly, however it is in the wrong location!

I could easily draw it in the correct location, however the problem is that the "correct location" is very different depending on the size of the screen - And my game needs to be able to have the screen size changed.

Here is the render method for the text:

 public static void render() {
    glClear(GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT);
    glLoadIdentity();

    glDisableClientState(GL_VERTEX_ARRAY);
    glDisableClientState(GL_NORMAL_ARRAY);
    glUseProgram(0);
    glBindBuffer(GL_ARRAY_BUFFER, 0);
    glMatrixMode(GL_PROJECTION);
    glLoadMatrix(orthographicProjectionMatrix);
    glMatrixMode(GL_MODELVIEW);
    glPushMatrix();
    glLoadIdentity();
    glDisable(GL_LIGHTING);
    font.drawString(0, 0, "OMG ITS TEXT!", Color.green);
    glEnable(GL_LIGHTING);
    glPopMatrix();
    glMatrixMode(GL_PROJECTION);
    glLoadMatrix(perspectiveProjectionMatrix);
    glMatrixMode(GL_MODELVIEW);
}

So, how can I set the text to be in the middle of the screen irrespective of screen size?

Thanks!

sentences:
Why doesn't my computer paddle move in my Pong game? I'm making a pong game and I can't figure out why the computerPaddle won't move up or down when it's supposed to to hit the ball automatically!

Please help me.

Here's code:

<html>
<h3>- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
PONG- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -</h3>

<canvas id="gameCanvas" width="800" height="600"></canvas>

<script>
var canvas;
var canvasContext;
var ballX = 50;
var ballY = 50;
var ballSpeedX = 11;
var ballSpeedY = 5;

var playerPaddleY = 240;
var computerPaddleY = 240;
const paddleHeight = 120;
const paddleThickness = 12;

function calculateMousePos(evt) {
    var rect = canvas.getBoundingClientRect();
    var root = document.documentElement;
    var mouseX = evt.clientX - rect.left - root.scrollLeft;
    var mouseY = evt.clientY - rect.top - root.scrollTop;
    return {
        x: mouseX,
        y: mouseY
    };

}

window.onload = function() {

    canvas = document.getElementById('gameCanvas');
    canvasContext = canvas.getContext('2d');

    var framesPerSecond = 30;

    setInterval(function() {
        moveEverything();
        drawEverything();
    }, 1000 / framesPerSecond);

    canvas.addEventListener('mousemove',
        function(evt) {
            var mousePos = calculateMousePos(evt);
            playerPaddleY = mousePos.y - (paddleHeight / 2);
        });

}

function ballReset() {
    ballX = canvas.width / 2;
    ballY = canvas.height / 2;
    ballSpeedX = -ballSpeedX;

}

function computerMovement() {
    if (computerPaddleY < ballY) {
        computerPaddleY += 5;
    } else {
        computerPaddleY -= 5;
    }
}

function moveEverything() {

    ballX += ballSpeedX;
    ballY += ballSpeedY;

    if (ballX > canvas.width) {
        if (ballY > computerPaddleY && ballY < computerPaddleY + paddleHeight) {
            ballSpeedX = -ballSpeedX;
        } else {
            ballReset();
        }
    }

    if (ballX < 0) {
        if (ballY > playerPaddleY && ballY < playerPaddleY + paddleHeight) {
            ballSpeedX = -ballSpeedX;
        } else {
            ballReset();
        }

    }

    if (ballY > canvas.height) {
        ballSpeedY = -ballSpeedY;
    }

    if (ballY < 0) {
        ballSpeedY = -ballSpeedY;
    }

}

function drawEverything() {

    canvasContext.fillStyle = 'black';
    canvasContext.fillRect(0, 0, canvas.width, canvas.height);
    canvasContext.fillStyle = 'white';
    canvasContext.fillRect(2, playerPaddleY, paddleThickness, paddleHeight); //
    player

    canvasContext.fillRect(786, computerPaddleY, paddleThickness, 120);
    //computer player

    canvasContext.beginPath();
    canvasContext.arc(ballX, ballY, 12, 0, Math.PI * 2, true); //ball
    canvasContext.fill();

}

</script>

</html>

sentences:
Bullet pattern isn't behaving as expected I have a boss that's supposed to continuously shoot five streams of bullets, each at a different angle. It starts off just fine, but doesn't seem to want to use its entire array of bullets. No matter how large I set the length of bulletList, the boss simply stops shooting after a couple of seconds, then pick up again shortly. Here's what I'm using to generate the pattern:

Vector3 direction = new Vector3(0.5f, -1, 0);

for (int r = 0; r < boss.gun.bulletList.Length; r++)
{
   if (!boss.gun.bulletList[r].isActive)
   {
      boss.gun.bulletList[r].direction = direction;
      boss.gun.bulletList[r].speed = boss.gun.BulletSpeedAdjustment;
      boss.gun.bulletList[r].position = boss.position;
      boss.gun.bulletList[r].isActive = true;
      break;
   }

}
direction = new Vector3(-0.5f, -1, 0);
//Repeat with four similar for loops, to place a bullet in each direction

It doesn't seem to matter if the bulletList length is 1000 or 100000. What could be the issue here?

EDIT: This is the code that removes a bullet, when it goes out of bounds. It is inside Bullet.Update()

if (position.X > 950 ||
position.X < -950 ||
position.Y > 570 ||
position.Y < -570)
isActive = false;

This is the code that removes a bullet on contact with the player ship:

for (int i = 0; i < boss.gun.bulletList.Length; i++)
{
   if (boss.gun.bulletList[i].isActive)
   {
      boss.gun.bulletList[i].Update(timeDelta);

      if (!ship.invincible)
      {
         bulletSphere.Center = boss.gun.bulletList[i].position;
         if (bulletSphere.Intersects(shipSphere))
         {
             boss.gun.bulletList[i].isActive = false;
             ship.health -= boss.gun.damage;
         }
      }
    }
}

And just for safe measure, here's the code that draws the bullets:

for (int j = 0; j < boss.gun.bulletList.Length; j++)
{
   if (boss.gun.bulletList[j].isActive)
   {
      Matrix bulletTransform = Matrix.CreateTranslation(boss.gun.bulletList[j].position);
      DrawModel(boss.gun.bulletModel, bulletTransform, boss.gun.bulletTransforms);
   }
}

EDIT: It would appear that a large number of bullets are getting "stuck" on the boss. That is, they draw at boss.position, and never move.

sentences:
How does one generate mountains out of a Fourier transform? I am watching this IGN video of No Man's Sky in which the founder/programmer of this game talks about how different is his game from other games. Here he talks about how mathematical equations instead of art is used to render graphic of planets and animals and even their behavior.

Then he says that instead of seeing mountains he sees only equation like Fourier transform. I have no knowledge about game development and its intricacies, but I'm curious how one might use a Fourier transform or similar mathematical operation to generate terrain without art?

sentences:
Editing the pixels of a rendered image I want to render a simple OpenGL scene as usual, but then I want to superimpose a small image of my own (such as from a bitmap file) on top of the render, such that this image always shows. For example, this could be thought of as showing a logo in the corner of the screen for a 3D game, where the logo is always displayed on top of the rendered scene.

Please could somebody start me off in the right direction? What should I be looking into? I am rather a novice at OpenGL...

Let us suppose that I have the following code:

#include <GL/glut.h>

void renderScene(void)
{
    glClear(GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT);

    glBegin(GL_TRIANGLES);
        glVertex3f(-0.5,-0.5,0.0);
        glVertex3f(0.5,0.0,0.0);
        glVertex3f(0.0,0.5,0.0);
    glEnd();

    glutSwapBuffers();
}

int main(int argc, char **argv)
{
    // init GLUT and create Window
    glutInit(&argc, argv);
    glutInitDisplayMode(GLUT_DEPTH | GLUT_DOUBLE | GLUT_RGBA);
    glutInitWindowPosition(100,100);
    glutInitWindowSize(320,320);
    glutCreateWindow("GLUT Triangles");

    // register callbacks
    glutDisplayFunc(renderScene);

    // enter GLUT event processing cycle
    glutMainLoop();

    return 1;
}

This renders a triangle on the screen. How, for example, would I now render a 10-by-10 bitmap from file, at location (100, 100) on the screen? If the viewpoint was static, I could just calculate its 3D location and render it. However, I want the bitmap image to always be displayed in this location, even when the viewpoint changes.

Thanks :)

sentences:
How should I set up 2D animations for weapons in Unity? I have a character composed of several sprites (legs, torso, head, arms). The character has the ability to pick up weapons, which are of varied types.

Each type of weapon has its own animation (sprite sheet). Ideally I want the weapons not only to animate themselves, but also affect how the player is animated (e.g. lean back when swinging sword).

Here's how I'm thinking of setting it up right now:

Player has an animator controller with states for Walking, Attacking, Idle, Flinching and this controls all the body parts.

Main questions:
- How can I incorporate jumping in this?
- How can the weapon animations have control over the rest of the body?

For having different weapons I am thinking of adding different states per weapon type, but I don't think that's a great way, especially when I start adding combos.

sentences:
Why the AnchorPoint doesn't affect the `CCLayer` Positioning? I think there is a difference between the CCLayer and CCNode behavior when I change their AnchorPoint.

I will describe what I mean and please somebody explain it.

Scenario:
I start with CCNode

CCNode *node = ...;
node.setContentSize(ccp(W,H));
// 1.
node.setAnchorPoint(ccp(0,0));
node.setPosition(ccp(X,Y); // This line will move the node in a way that its (0,0)-point will be placed at (X,Y).
// 2.
node.setAnchorPoint(ccp(1,1));
node.setPosition(ccp(X,Y); // This line will move the node in a way that its (0,0)-point will be placeed at (X-W,Y-H).
//In other word, this line will move the (W,H)-point of the node to (X,Y)

In addition to the Positioning, all actions (like Rotating, Scaling) are based on this anchor point.

This policy is fair enough and you won't get confused when moving a scaled node (setScale(X)) to some position because the node's position ( and not node's contents!) will not change in the screen after any actions.

( PS: We knew that rotating/scaling a node will rotate/scale internal node contents)

Let's continue with CCLayer:

CCLayer *layer= ...;
layer.setContentSize(ccp(W,H));
// 1.
layer.setAnchorPoint(ccp(0,0));
layer.setPosition(ccp(X,Y); // This line will move the layer in a way that its (0,0)-point will be placed at (X,Y)
// 2.
layer.setAnchorPoint(ccp(1,1));
layer.setPosition(ccp(X,Y); // Unfortunately, This line will move the layer in a way that its (0,0)-point will be placeed at (X,Y).

Although CCLayer also use the anchor point for scaling, rotating and ... purposes, It does NOT use its anchor point for positioning!!!

Question >>>>  WHY? and How can I have the same CCNode-like setPosition() behaviour for CCLayer?

PS: I've also tried ->ignoreAnchorPointForPosition(true) but it didn't help.

(@cocos2d-x version is 2.2.3)

sentences:
Why is this orthographic projection matrix not showing my textured quad? I've been following tutorials, mainly this one, and I am still not quite sure why my textured quad is not showing inside the frustum that I've rendered before. I can see it if and only if I don't multiply gl_Position with OrthoProjMatrix * vertexmodelspace, and instead, multiply gl_position with vertexmodelspace.

Here is some of my code; my Main.CPP is also available via PasteBin.

Orthographic Projection Matrix Setup Code:

void OpenGL_Engine::OrthoProjectionSetup(GLuint program)
{
    GLfloat Right = 100.0;
    GLfloat Left = 50.0;
    GLfloat Top = 100.0;
    GLfloat Bottom = 50.0;
    GLfloat zFar = 1.0;
    GLfloat zNear = -1.0;

    GLfloat LeftAndRight = 2.0f / (Right - Left);
    GLfloat TopAndBottom = 2.0f / (Top - Bottom);
    GLfloat ZFarAndZNear = - 2.0f / (zFar - zNear);

    GLfloat orthographicprojmatrix[] = {
    //XX XY XZ XW
    LeftAndRight,
    0.0, 0.0,
    - (Right + Left) / (Right - Left),

    //YX YY YZ YW
    0.0,
    TopAndBottom,
    0.0 ,
    - (Top + Bottom) / (Top - Bottom),

    //ZX ZY ZZ ZW
    0.0,
    0.0 ,
    ZFarAndZNear,

    //WX WY WZ WW
    - (zFar + zNear ) / (zFar - zNear),
    0.0,
    1.0
    };

    GLint orthographicmatrixloc = glGetUniformLocation(program, "OrthoProjMatrix");
    glUniformMatrix4fv(orthographicmatrixloc, 1, GL_TRUE,
        &orthographicprojmatrix[0]);
}

Vertex Shader Code :

#version 330 core

layout(location = 0) in vec4 vertexposition_modelspace;
layout(location = 1) in vec2 vertexUV;
out vec2 UV;
uniform mat4 OrthoProjMatrix;

void main()
{
    gl_Position =  OrthoProjMatrix * vertexposition_modelspace;
    UV = vertexUV;
}

I'm having problems with the orthographic projection matrix; either it is not being done correctly, not setup correctly, my shader is not setup correctly or it's the textured quad that is not in view. Please note that I do not want to use a library for this. What am I doing wrong?

sentences:
Layers in Unity won't drag I'm trying to rearrange my layers in Unity but I can't seem to drag them. When I try to do this I'm in edit layers under the heading sorting layers and I click on the = symbol and try to drag it but it won't move. I also tried restarting Unity twice but it won't resolve the problem.

Could someone help me with this?

sentences:
How do I plot individual pixels using the XNA APIs? If I wanted to fill my game screen with individually coloured pixels, how would I do this?

For example, if I wanted to write a 'game of life'-type game where each pixel was a cell, how would I achieve this using XNA?

I've tried just calling SetData() on a Texture2D object using a screen-sized array of Color values, but it complains with:

You may not call SetData on a resource while
it is actively set on the GraphicsDevice.
Unset it from the device before calling SetData.

How do I do as it asks? Or better still... is there an alternative, better, efficient way to fill a screen with arbitrary pixels?

sentences:
Why do I get a "Value Cannot be Null" error on material.SetTexture? Probably a really noob question, but:

I'm following this tutorial here and, using the code in the tutorial, I'm getting an annoying error:

Here's the code in question, the error is referring to line 20 (highlighted in the comments):

public class RayTracingMaster : MonoBehaviour
{
    public ComputeShader RayTracingShader;

    public Texture SkyboxTexture;

    private RenderTexture _target;

    private Camera _camera;

    private void Awake()
    {
        _camera = GetComponent<Camera>();
    }

    private void SetShaderParameters()
    {
        RayTracingShader.SetTexture(0, "_SkyboxTexture", SkyboxTexture); // <- Line 20 is here
        RayTracingShader.SetMatrix("_CameraToWorld", _camera.cameraToWorldMatrix);
        RayTracingShader.SetMatrix("_CameraInverseProjection", _camera.projectionMatrix.inverse);
    }

    private void OnRenderImage(RenderTexture source, RenderTexture destination)
    {
        Render(destination);
        SetShaderParameters();
    }

    private void Render(RenderTexture destination)
    {
        // Make sure we have a current render target
        InitRenderTexture();

        // Set the target and dispatch the compute shader
        RayTracingShader.SetTexture(0, "Result", _target);
        int threadGroupsX = Mathf.CeilToInt(Screen.width / 8.0f);
        int threadGroupsY = Mathf.CeilToInt(Screen.height / 8.0f);
        RayTracingShader.Dispatch(0, threadGroupsX, threadGroupsY, 1);

        // Blit the result texture to the screen
        Graphics.Blit(_target, destination);
    }

    private void InitRenderTexture()
    {
        if (_target == null || _target.width != Screen.width || _target.height != Screen.height)
        {
            // Release render texture if we already have one
            if (_target != null)
                _target.Release();

            // Get a render target for Ray Tracing
            _target = new RenderTexture(Screen.width, Screen.height, 0,
                RenderTextureFormat.ARGBFloat, RenderTextureReadWrite.Linear);
            _target.enableRandomWrite = true;
            _target.Create();
        }
    }
}

I really can't see why it's telling me the value is null when I'm calling the name of an already defined Texture class. I have set the texture from the inspector. Any help would be appreciated.

sentences:
Can I create an 2D texture array with different sizes for each textures? I'm making a 2D game engine, and I need a way to batch all textures into one so I only make one glBindTexture call throughout a scene. I am trying to use 2D texture arrays, but they only support textures of the same size.

Do I have to conform to this, or is there a workaround?

sentences:
Place Buildings to represent village I try to convert an array of Buildings into a representation of a small village. There are several different buildings in a village, like factories that are located on the outside of the village, houses that are placed around churches in the center and so on. What would be a good approach to solve such a problem? I thought about using noise but this didn't give me the expected results.
I made a little drawing on what should happen:
I put an array of Buildings like this, for example, through a function
{ houses: 20, churches: 3, factories: 7 }

And i recieve a output similar to this:

Thank you for your help and ideas

sentences:
Error(45,74): Identifier 'collision' is not declared in the current scope func _physics_process(delta):
    direction = Vector3(0, 0, 0)
        if Input.is_action_pressed("ui_left"):
            direction.x += 1
        if Input.is_action_pressed("ui_right"):
            direction.x -= 1
        if Input.is_action_pressed("ui_up"):
            direction.z += 1
        if Input.is_action_pressed("ui_down"):
            direction.z -= 1
        direction = direction.normalized()
        direction = direction * speed * delta
        if velocity.y > 0:
            gravaty = -20
        else:
            gravaty = -30

        velocity.y += gravaty * delta
        velocity.x = direction.x
        velocity.z = direction.z

        velocity = move_and_slide(velocity, Vector3(0, 1, 0))

        if is_on_floor() and Input.is_key_pressed(KEY_SPACE):
            velocity.y = 10
        var hitCount = get_slide_count()
        if hitCount > 0:
            var collision = get_slide_collision(0)
        if collision.collider is RigidBody:
            collision.collider.apply_impulse(collison.position, -collision.normal)

sentences:
How can I use triangle picking to determine location of a triangle in world space coordinates? I am trying to implement point and click movement in my game, but at the moment I am stumped about how I can select parts of a mesh for the player to walk to.

So what I have done is I have got a navigational mesh in my game. I can select points from it but what I want to do is be able to select the navigational mesh in real time and be able to tell the player where to go on the navigational Mesh, how can I achieve this?

I thought triangle-picking might be one way to determine which mesh I am selecting with mouse-unproject but I think I need a bit more accuracy than that, no?

How can I achieve point and click on a navigational mesh in real time?

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:
Cannot create a neutral unit with a trigger I've been playing around with the starcraft UMS (Use map settings) for a while and usually i figure things out pretty quickly when im stuck. Alas not this time.

I'm trying to place a neutral unit (player 12) using a trigger. It refuses to work.
I'm using Scmdraft 2.0 as my editor (but i cant get it to work in other editors either)
(all neutral units placed before the game starts are visible and all other triggers work fine. Also i created a text msg and it does displays it in-game so the trigger triggers )

For testing I created a trigger that looks like this:

Player: neutral (i tried neutral players player 1 and all players as well)
Condition:
-always
Action:
-Create *1 Terran Medic* at '*location 022*' for *Neutral* (also tried neutral players)

When I start the game nothing happens.

Here is what I tried:

I tried placing a start location for neutral player (player 12)
I tried changing the owner under map properties of player 12 to neutral and computer from unused which was the default.

Although it seems like it should be a common enough problem, I don't see it in any FAQ and I cant find anything about it when I Google it.

Thanks in advance.

sentences:
Elegantly simulating NPC movement in inactive areas My AI is utility-driven in a similar pattern to The Sims, where all unique behavior is coded into interactable objects, and the only thing an NPC does is decide which object they wish to use, path to it, and activate it. This is deceptively powerful, as I can extend nearly any desired behavior by creating a novel object and shaping constraints leading to its selection.

The challenge I'm having with this approach is giving the illusion that NPCs are moving around when the player isn't nearby. The game runs a 24/7 clock and seeks to have each NPC go through the motions of maintaining a regular schedule: going to work, going to bed, and randomly doing weird things in their free time to preserve the illusion of unpredictability. This is implemented with a dict(float time, Appointment appointment), which acts as a global behavior queue and is called every time the in-game clock changes to teleport each AI who has an appointment to use an object to that object's position. This works well enough for prototyping other systems, but it isn't very convincing: you never see NPCs moving through the world, and when you're familiar with a few specific characters it becomes very obvious that they're teleporting around when you can't see them.

Is there a better way to simulate movement around a world with a large number of NPCs, or am I better off keeping my current queue-oriented behavior system and writing an entirely different system to fake movement? My optimal endpoint would be a system that can order NPCs to be at any location, at any time, and trust them to move there in a convincing way, but I worry I'm putting too much detail into a simulation that could fake the same behavior more convincingly with a simpler solution.

sentences:
How can I get the WAV data from the whole song? I'm using FMOD (with C++ syntax, not C) and I'm having trouble getting the wave data of a whole sound file.

Channel::GetWave() only gets the wave data of the area on which it is currently playing.

The documentation says:

  Do not use this function to try and display the whole waveform of the
  sound, as this is more of a 'snapshot'
  of the current waveform at the time it
  is called, and could return the same
  data if it is called very quickly in
  succession.

  See the DSP API to capture a continual stream of wave data as it
  plays, or see Sound::lock /
  Sound::unlock if you want to simply
  display the waveform of a sound.

Unfortunately, the Sound::lock and unlock functions are pretty confusing,  at least to me.

Lock:

FMOD_RESULT Sound::lock(
  unsigned int  offset,
  unsigned int  length,
  void **  ptr1,
  void **  ptr2,
  unsigned int *  len1,
  unsigned int *  len2
);

  offset

  Offset in bytes to the position you want to lock in the sample buffer.

  length

  Number of bytes you want to lock in the sample buffer.

  ptr1

  Address of a pointer that will point to the first part of the locked
  data.

  ptr2

  Address of a pointer that will point to the second part of the locked
  data. This will be null if the data
  locked hasn't wrapped at the end of
  the buffer.

  len1

  Length of data in bytes that was locked for ptr1

  len2

  Length of data in bytes that was locked for ptr2. This will be 0 if the
  data locked hasn't wrapped at the end
  of the buffer.

Unlock:

FMOD_RESULT Sound::unlock(
  void *  ptr1,
  void *  ptr2,
  unsigned int  len1,
  unsigned int  len2
);

  ptr1

  Pointer to the 1st locked portion of sample data, from Sound::lock.

  ptr2

  Pointer to the 2nd locked portion of sample data, from Sound::lock.

  len1

  Length of data in bytes that was locked for ptr1

  len2

  Length of data in bytes that was locked for ptr2. This will be 0 if the data locked hasn't wrapped at the end of the buffer.

But as I said, my goal is to be able to get the wave data of the beginning of a song to the end.

sentences: Javascript Audio solution still has issues. Flash works but... requires flash (an issue for iOS). What do you use in Javascript for audio?

sentences: Using Burst Compile attribute on methods Can we use BurstCompile attribute without using any Jobs or ECS System in Unity? does adding [BurstCompile] attribute before methods bring us any benefits?

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:
What are the different attributes of a vertex array object (VAO)? What are the 16 attributes of a VAO?
0. vertex position
1. vertex colours
2. normal vector
3. texture coords
4. ???
5. ???
6. ???
7. ???
8. ???
9. ???
10. ???
11. ???
12. ???
13. ???
14. ???
15. ???

sentences:
Java Slick2d collision feedback I'm trying to build a collision response ( it uses vectors2f from slick2d ) so that enemies don't overlap on each other so basicly what I'm doing right now is, I loop trough all enemies in array trough the same array of enemies to check if they collide or not , if they collide I swap their velocity.

The code partialy works for some enemies and doesn't for others. If anyone can give me some links how to code this or advise me how to do it , that would be nice. I already google'd to see if I could find something like this but I couldn't find anything.

Here is the code for the current code i got:
http://pastebin.com/AbCvTtV0

Slick 2d documentation : http://www.slick2d.org/javadoc/

sentences: How do you create a single/internal pre-loader for a Flash game written using Flex? I've got a somewhat large SWF which I'd like to deliver through a pre-loader so the user doesn't have to appear to wait as long. With Actionscript it's pretty easy to create an external pre-loader but doing so makes it harder to distribute my game. What methods are available for including the pre-loader in a single SWF?

sentences:
How do I position a mesh just outside the camera view? I want to slide in an object into view, coming from the right of the screen.

In order to achieve this, I need to position the object next to the camera view, so that it is still not visible, but close enough for a quick slide in.

For example, placing the object at X=1000000 (so that it is surely outside the camera view) for safety wouldn't work as it couldn't slide in quickly enough. For a reasonable slide, I would need to have it really close next to the camera view.

How could I calculate the object's position for that?

Thank you.

Edit:

Here is the script that I'm now using and which I'm still having problems with:

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

public class NewBehaviourScript : MonoBehaviour
{
    void Update()
    {
        float fDist = Mathf.Abs(Camera.main.transform.position.z - this.transform.position.z);
        Bounds b = BoundsFromTransform(this.transform);

        this.transform.position = GetPointLeftOfCamera(Camera.main, fDist, b.size.magnitude / 2);
    }

    public static Bounds BoundsFromTransform(Transform uTransform)
    {

        Bounds bounds = new Bounds(uTransform.position, Vector3.zero);

        foreach (Renderer renderer in uTransform.GetComponentsInChildren<Renderer>())
        {
            bounds.Encapsulate(renderer.bounds);
        }

        Vector3 nOff = bounds.center - uTransform.position;

        return new Bounds(nOff, bounds.size);
    }
    public static Vector3 GetPointLeftOfCamera(Camera camera, float distance, float goDiameter)
    {
        // 1.
        var ray = camera.ScreenPointToRay(new Vector3(0, camera.pixelHeight / 2f, 0));

        // 2.
        var borderPoint = ray.GetPoint(distance);

        // 3.
        var leftPlane = GeometryUtility.CalculateFrustumPlanes(camera)[0];
        var frustumLeft = leftPlane.normal;

        // 4.
        var halfDiameter = goDiameter / 2f;
        return borderPoint + frustumLeft * halfDiameter;
    }
    public static Vector3 GetPointRightOfCamera(Camera camera, float distance, float goDiameter)
    {
        var ray = camera.ScreenPointToRay(new Vector3(camera.pixelWidth - 1, camera.pixelHeight / 2f, 0));
        var borderPoint = ray.GetPoint(distance);

        var rightPlane = GeometryUtility.CalculateFrustumPlanes(camera)[1];
        var frustumRight = rightPlane.normal;

        var halfDiameter = goDiameter / 2f;
        return borderPoint + frustumRight * halfDiameter;
    }
}

sentences:
Why do MMORPGs still use multiple servers? MMORPGs, some MOBAs like League of Legends or even StarCraft 2 usually force you to pick a server. Usually they are US, EU and SEA, in MMORPGs many per location. I can see that that was necessary a few years ago, but now with the advent of AWS and similar offerings that allow you to seamlessly scale your "server-power", why are there still separate servers?

My train of thought is like this (using Star Wars: The Old Republic as an example): - You are always on one planet, an isolated "instance" from other planets. - If there are too many people on one planet, SW:TOR creates a new instance of the world and puts players in there. - If you leave the world / switch instances you have a loading-screen

So why can't the game create an instance for this planet. This instance (and only this one) has your current data in its database and manages x players. As soon as x-50 players are on this instance, a new server will fire up and new people will spawn on that instance. The 50 spots are reserved for switching to your group, etc.

There could be an instance for all three major regions to keep the latency low, but it would allow you to still play with other players from i.e. SEA if you can live with a 140ms delay (which is still nothing imho).

Whenever you switch an instance or travel to another world, your current server gives all your data to the next server, making sure you don't need one big centralized database. You could still have one that gets updates periodically for analysis purposes.

When you log off or the servers loses connection, the data could then be transferred into a massive database that is optimized for storing the data. The instance servers can then be optimized for high throughput.

Is there any particular reason this will not work? Are there other problems I am missing?

sentences:
What is the difference between a game framework and a game engine? What is the difference between a game framework (for example, XNA with C#, SDL for c++) and a game engine?

Do game frameworks use engines? Does a game engine encapsulate sub-engines like physics engines, particle engines etc? Should they be used together, or are they mutually exclusively?

I take it there are separate engines for both 2D and 3D?

sentences:
Video playback in Unity I'm not satisfied with the quality of video playback in Unity (Movie texture which I run after converting video with Miro converter and importing it to Unity),... so, is there any chance that there is a 3rd party library which I can integrate inside Unity to play my movie file? My movie is full HD intro movie to my 3d app which can be played from application menu.

I've tried to use Media Player Classic (MPC) as external application, but the problem is, when I run MPC as new Process from application menu, my menu minimizes and this looks awkward for one stand alone app. When intro finishes, I have to maximize my menu by clicking on application icon placed on Windows taskbar.

sentences:
Rotating an object towards a target on the Y axis I am attempting to rotate a 3D object on its Y-axis towards a target it is looking at. I have always struggled with rotations so I would like to try to avoid using Unity's built in functions, i.e transform.LookAt() in order to get used to using rotations. Gotta master the basics first, right?

Vector3 currentOrientation = transform.rotation.eulerAngles;
Vector3 directionVector3 = transform.position - target.transform.position;
float angle = Mathf.Atan2(directionVector3.z, directionVector3.x) * Mathf.Rad2Deg;
currentOrientation.y =angle;
transform.rotation = Quaternion.Euler(currentOrientation);

However when I do run this, the character is not looking in the correct direction at all!

Here is a screen shot with the character's parameters

The target object belongs in a hierarchy, where it's position in world space is (150,0,500)

Does atan2 somehow behave differently in 3D space vs 2D space? I ask because I've made 2D games where I would just use atan2(y,x) for a character's rotation.

sentences:
OpenGL ES 2.0: Calculated Cube Vertex Normals Verification Could I kindly ask to confirm, that the calculated normals are correct, please? I have calculated them on my own, but my testcube is still strangely lighted within OpenGLES 2.0.

The vertices were exported from 3D authoring application.
The vertex normals were calculated using matrix cross product.
The vertex and fragment shaders I were exact copies from the book, so there should not be a bug.

The output in OpenGL looks like the sphere is lighted from its bottom. Moreover, it looks, like the box is visible from inside, as the top part is always transparent. Any idea, where can be a problem?

Added:

The vertex normals are calculated based on triangulated quad-polygons. The triangulation is performed internally, by the 3d application. Vertices/ indices are generated by calling API calls of that application.

#begin 8 vertices
vs 24
v -25.000000 -25.000000 -25.000000
v 25.000000 -25.000000 -25.000000
v -25.000000 25.000000 -25.000000
v 25.000000 25.000000 -25.000000
v -25.000000 -25.000000 25.000000
v 25.000000 -25.000000 25.000000
v -25.000000 25.000000 25.000000
v 25.000000 25.000000 25.000000
#end 8 vertices

#begin 12 faces
fs 36
f 0 2 3
f 0 3 1
f 0 1 5
f 0 5 4
f 0 4 6
f 0 6 2
f 1 3 7
f 1 7 5
f 2 6 7
f 2 7 3
f 4 5 7
f 4 7 6
#end 12 faces

#begin 8 calculated normals
ns 24
n -0.577350 -0.577350 -0.577350
n 0.816497 -0.408248 -0.408248
n -0.408248 0.816497 -0.408248
n 0.408248 0.408248 -0.816497
n -0.408248 -0.408248 0.816497
n 0.408248 -0.816497 0.408248
n -0.816497 0.408248 0.408248
n 0.577350 0.577350 0.577350
#end 8 calculated normals

I use OpenGL ES 2.0, but that should not be relevant at this moment.

Update:

I can confirm now, that the calculated vertex normals are correct, and can therefore be used by others, to verify correctness of their triangulated cube vertex normals calculations.

However, I still have a problem that all the vertices, which are in positive z axis, are not rendered. Not sure if they are culled, but I have pretty large frustum. Vertices in the -z axis are kept, so the rendered mesh looks like cut in half, as it is position in 0 z-axis.

This lines below show that I should not concsicously setup small render area:

mProjection = glm::perspective (45.0f, (float)WINDOW_WIDTH / (float)WINDOW_HEIGHT, 1130.0f, -1130.0f);

mViewTransformation = glm::lookAt(glm::vec3(vIntCamera.x, vIntCamera.y, 1130.0f), glm::vec3(vIntCamera.x, vIntCamera.y, 0.0f), glm::vec3(0.0f, 1.0f, 0.0f));

Any ideas, please, what else should I check?

Solved:

Eye position of the camera (in glm::lookAt() function) should be above the top of the perspective frustum, defined by glm::perspective().

Thanks for your support guys, especially with the upper part of my question.

sentences:
Find a position within one radius, but outside other radii I have an Object A which will attempt to stay within a certain distance of another Object B. I would like Object A to also try to stay outside a certain distance of one or more other Objects R.

The idea behind this question is the desire for a companion AI to follow the player around and provide support, but also try to stay out of the attack range of enemies.

Using the image above as an example, we'll say the distance/radius within which we want to stay to Object B is represented by the blue circle. The distances/radii we want to stay outside of for Objects R are represented by the red circles.

How can I find any point (perhaps the closest point? or the point least crowded by red circles?) in the blue circle that is not overlapped by a red circle?

Furthermore, approximately how expensive would it be to calculate these kinds of details?

And how would the answer(s) to the questions above be affected if we used spheres instead of circles (3D instead of 2D)?

I use Unity and C#, so please keep that in mind if you provide specific code examples. Thank you.

sentences:
Triple buffering causes input lag? Consider some time in between two vsyncs. Suppose the first display buffer is being used to display the current image, and suppose the game was really fast and computed and rendered the next image to the second display buffer and the next one after that to the third display buffer. That is the rendering to the second and third display buffer happens so fast that it occurs before the next vsync.

Suppose input from the user comes in now. What you would like is for the results of the input to show up on the next vsync or (probably more typical) the vsync after that. However, with the third display buffer already rendered the input can only effect the image after that. Meaning the input will only take effect at best 3 vsyncs later.

I wish i had an image to show the exact timings of what I mean.

sentences:
Ground contact point for animated character sprites in an isometric game? I'm working on an isometric game. I have the 3D pre-rendered sprites for directions per state (walking/running, etc.) per frame. Now I need to know where a particular character stands on the ground to have it synchronized. But this "ground contact point" (GCP) changes from frame to frame, and is basically (slightly) different for every combination. At this moment I have some rough average, but sprite wiggles a bit during animation. It's rendered correctly (1024x768), but cropping of the frames even though it correctly removes empty borders, it also removes the "offset" information, which is no longer there. So I basically need to remove empty borders while taking into account all the frames in all the animations. So the character in the sprite animation is still stabilized, but unneeded space is removed.

Example:

Is there any software that does it, or is there some technique to do it?

sentences:
How to add event listener to Gifdecoder in Libgdx? I asked this question and implemented the accepted answer. One last piece of the puzzle remains, how to add event listener to the button?

I'm working with a teammate, I suggested to try Gdx.input.justTouched() but he wonders if it's possible to add event listeners like you would do for normal buttons.

sentences:
Libgdx app closes immediately after opening I have a libGdx app, and I am running it using android studio.

It closes immediately after starting it and I see no error report.
Could anyone help?

Starfield.java

public class Starfield extends ApplicationAdapter {

    private static final float STAR_DENSITY = 0.01f;
    ShapeRenderer shapeRenderer;
    Array<Vector2> stars;

    @Override
    public void create() {
        // Initialize a shapeRenderer
        shapeRenderer = new ShapeRenderer();

        // Call initStars
        initStars(STAR_DENSITY);

    }

    public void initStars(float density) {
        // Figure out how many stars to draw. You'll need the screen dimensions,  which you can get using
        // Gdx.graphics.getWidth() and Gdx.graphics.getHeight().
        int screenHeight = Gdx.graphics.getWidth();
        int screenWidth = Gdx.graphics.getHeight();

        // Create a new array of Vector2's to hold the star positions
        stars = new Array<Vector2>((int) (screenHeight * screenWidth * density));

        // Use java.util.Random to fill the array of star positions
        Random random = new Random();

        for (int i = 0; i < stars.size; i++) {

            int x = random.nextInt(screenWidth);
            int y = random.nextInt(screenHeight);

            stars.add(new Vector2(x, y));

        }

    }

@Override
public void resize(int width, int height) {
    shapeRenderer = new ShapeRenderer();
    initStars(STAR_DENSITY);
}

@Override
public void render() {
    // Make the night sky black
    Gdx.gl.glClearColor(0, 0, 1, 1);
    Gdx.gl.glClear(GL20.GL_COLOR_BUFFER_BIT);

    // Begin a shapeRenderer batch using ShapeType.Point
    shapeRenderer.begin();

    // Loop through the star positions and use shapeRenderer to draw points
    for (Vector2 vec: stars) {

        shapeRenderer.point(vec.x, vec.y, 0);

    }

    // End the shapeRenderer batch
    shapeRenderer.end();

 }

    @Override
    public void dispose() {
        // Dispose of our ShapeRenderer
        shapeRenderer.dispose();
        super.dispose();
    }
}

Here is the gradle log

Run build   1s 241ms
Run init scripts    33ms
Configure settings  1ms
Configure build 327ms
Project :   326ms
Resolve dependencies :classpath 200ms
Resolve dependencies :android:classpath 0ms
Calculate task graph    26ms
Project :desktop    15ms
Project :core   3ms
Run tasks   824ms
:core:compileJava   82ms
Resolve dependencies :core:compileClasspath 5ms
:core:processResources  3ms
:core:classes   1ms
:core:jar   16ms
:desktop:compileJava    73ms
Resolve dependencies :desktop:compileClasspath  14ms
:desktop:processResources   2ms
:desktop:classes    0ms
:desktop:run    642ms
Resolve dependencies :desktop:runtime   3ms

EDIT: I got an error, dumb me, I did not see the console.

Exception in thread "LWJGL Application" java.lang.IllegalStateException:    autoShapeType must be true to use this method.
at com.badlogic.gdx.graphics.glutils.ShapeRenderer.begin(ShapeRenderer.java:198)
at gamedev.starfield.Starfield.render(Starfield.java:87)
at com.badlogic.gdx.backends.lwjgl.LwjglApplication.mainLoop(LwjglApplication.java:215)
at com.badlogic.gdx.backends.lwjgl.LwjglApplication$1.run(LwjglApplication.java:120)

Thanks, any help would be appreciated.

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:
Vertex Shader Fundamental Workings I understand that water ripples (e.g. stone thrown into a pond) are often handled with vertex shaders.  My first question is: are the ripples nothing more than an algorithm that is the function of time?

If yes, it means that the size and diameter of ripples is not "additive."  It means water vertices do not statefully "remember" their previous "disturbance" positions and accumulate more translation info.  Rather it means that, as a function of time, the position of "disturbed" water vertices are freshly computed each frame per unit time.

If no, it means that indeed the vertices accumulate disturbance / translation information - the vertices are stateful.

I hope the answer is "yes," because that actually makes sense to me.  If the answer is no, the I feel it creates tremendous burden on the CPU/GPU to keep track of all the state-per-vertice.  If the answer is "neither," do tell. :)

My second question is, assuming a "yes" above, how does such a "water disturbance shader algorithm" account for continuous interaction with irregular shapes?  For example, please look at the video 40 second mark showing a car crashing through water.  It is not so clear how the vertex shader knows how to make a rectangular disturbance shape (the shape of the car).  Perhaps, over-simplifying, the vertex shader takes both time and a vector to generate the ripples, where the vector is the speed/direction of a car (and the shader code always makes a car-shaped rectangle no matter what).

Is this the right high-level understanding of how this water trick works?

sentences:
Ball Physics : Smoothing the final bounces as the ball comes to rest I've come against another issue in my little bouncing ball game.

My ball is bouncing around fine except for the last moments when it is about to come to rest.  The movement of the ball is smooth for the main part but, towards the end, the ball jerks for a while as it settles on the bottom of the screen.

I can understand why this is happening but I can't seem to smooth it.

I'd be grateful for any advice that can be offered.

My update code is:

public void Update()
    {
        // Apply gravity if we're not already on the ground
        if(Position.Y < GraphicsViewport.Height - Texture.Height)
        {
            Velocity += Physics.Gravity.Force;
        }
        Velocity *= Physics.Air.Resistance;
        Position += Velocity;

        if (Position.X < 0 || Position.X > GraphicsViewport.Width - Texture.Width)
        {
            // We've hit a vertical (side) boundary
            // Apply friction
            Velocity *= Physics.Surfaces.Concrete;

            // Invert velocity
            Velocity.X = -Velocity.X;
            Position.X = Position.X + Velocity.X;
        }

        if (Position.Y < 0 || Position.Y > GraphicsViewport.Height - Texture.Height)
        {
            // We've hit a horizontal boundary
            // Apply friction
            Velocity *= Physics.Surfaces.Grass;

            // Invert Velocity
            Velocity.Y = -Velocity.Y;
            Position.Y = Position.Y + Velocity.Y;
        }
    }

Perhaps I should also point out that Gravity, Resistance Grass and Concrete are all of the type Vector2.

sentences:
iPhone 3GS - can't ever seem to hold 60fps with CADisplayLink So I've switched from NSTimer to CADisplayLink and I'm still seeing unexpected variation in my frame counter - it fluctuates between 59-60fps, even when I'm not rendering much.

Has anyone else seen this? Is this an expected variation in iOS? Or should I look more closely at my game loop?

sentences:
C# Design for Ability System I'm a novice programmer but I have completed a pre-university in web prog so I am not a total noob. I'm using Unity, but this is just C# for now.

This is my first big project and I need some professional insight to make sure the design is not flawed. Currently working on abilities in an turn based rpg game.

What you might need to know: Abilities need to be learned/chosen, they may have requirements(levels, weapontype, more/etc.) New abilities will be added to the game with updates.

This is still the primitive stage, but very important to me because this project is more about learning to do it right rather than just getting it done.

Here are the following classes where we create abilities:

public abstract class Ability {
  public readonly int id, multi, manaCost;

 public Ability(int id, int multi, int manaCost) {
   this.id = id;
   this.multi = multi;
   this.manaCost = manaCost;
 }
 public virtual void resolve(Actor user, Actor target){}
 //Would create more methods with different parameters based on different abilities
 //Example for multi target ability
 public virtual void resolve(Actor user, Actor[] targets){}
}

Pretty simple stuff, Actor is just a in-game character. resolve is where the ability effects will be coded

using UnityEngine;
public class Freeze : Ability {
  public Freeze() : base(0, 0, 3) { }

  public override void resolve(Actor user, Actor target) {
    int damage = 2 * user.attribute[2];
    Debug.Log (damage);
    target.damage(damage);

    /*System.Random rnd = new System.Random();
    if(rnd.Next(100) <= 35)
    target.state = new Frozen();*/
  }
}

the way I was planning to use abilities is, in the main script of the battle system
there would be an array that has all the abilities such as this:

Ability[] all_ability;
public void createAbilities(){
    all_ability = new Ability[2]; //size increased as we create more abilities
    all_ability[0] = new Freeze();
    all_ability[1] = new FirstStrike(); //and so on as we create more
}

The index of the array is also the id of the ability which allows us to easily access abilities.

So if an Actor wanted to use freeze, the id of freeze would be stored in Actor i.e. p1.actors[0].ability_ids array

so let's say i've got what ability the player chose, it would be something like this

int aId = p1.actors[i].ability_ids[j]; //would return 0 assuming he chose freeze
all_ability[aId].resolve(p1.actors[i], p2.actors[k]);

Everything works so far, no errors, and damage gets calculated correctly but this is a very simple ability and still much more to add like damage counters, animations, status effects etc.

What should I look out for? is there a much easier way to do this I dont know about? I guess my main concern is, as we learn in web programming, it is said to be very bad to hard code values and everything should come from databases, but, is that also true for a game since each ability can be quite different? As you can see, everything is hard coded here. I guess I just want tips on things I may have done wrong/if there is a clear better way to do this. Thanks for any and all replies!

sentences:
Optimising the modelview transformation in GLSL for 2D So, the standard way to transform vertices and then pass to the fragment shader in GLSL is something like this:

uniform mat4 u_modelview;
attribute vec4 a_position;

void main() {
    gl_Position = u_modelview * a_position;
}

However, I am working in 2D so there is redundancy in the 4x4 matrix. Would it be more efficient for me to do this?

uniform mat3 u_modelview;
attribute vec3 a_position;

void main() {
    gl_Position = vec4(u_modelview * a_position, 1.0);
}

gl_Position requires a 4 component vector so an extra operation is required at output. However the matrix multiplication is for 9 elements instead of 16. Can I do any better?

sentences:
How do I split a texture into differently shaped pieces with libgdx? I want to split a texture into variously shaped pieces with libgdx, like the pieces of a puzzle game. TextureRegion.split() is not an option, as it splits into equally sized rectangular texture regions.

The "Similar Questions" section here is helpful (particularly this question How do I break an image into 6 or 8 pieces of different shapes?), but I'm not sure yet if it's possible to implement the solution with libgdx.

Any pointers?

sentences:
Architecture of networked game engine So after working on my game engine for 2 years, I've decided to step into the networking environment. I just don't know if it's a good idea to rewrite the engine, or how much work it will take (but still want to try it). I'm little bit confused by some approaches, so that's why I'm here.

In short I have an architecture like this:
There is a main object, that controls the whole engine world (physics steps, rendering, audio, input, entities). Then there is a Game instance that is running inside the loop and "creating the content of the game".

I already started with ENet, created a small console chatting app - but packets were just strings.  But I'm not sure if I understand the concept of game networking, so here is my idea:

There is a server and clients. Server is controlling everything. Client sends messages.

So basically:
When client connects to the server, server creates new entity. Now, for example, when client presses A, packet is sent to a server containing this information. Server will process it, moves the entity.

Am I right?

So basically, clients does not have anything, except input controller and keyboard. So when they press keys, action is done. And rendering for the scene render, but all they receive is just a "image" of the scene from the server? Or is there something I miss?

Thanks in advance.

Edit1
And also wondering, everything, like physics manager, or whole scene with entities, are present only on the server machine?

sentences:
How to add a force to jump in unity I have created a simple player control. I have used "Vertical" and "Horizontal" axes as input to move. There is a character controller and I used this to move my player. But I don't know how to add a force as jump with space input. I am new to game development. Please help me to learn this. This is my script,

public class PlayerControll : MonoBehaviour
{
    public Animator anim;
    public CharacterController characterController;
    public Rigidbody rb;
    public float Speed;
    public float Direction;

    Vector3 moveDir = Vector3.zero;
    float speedwalking = 8;
    float gravity = 8;

    void Start()
    {
        anim = GetComponent<Animator>();
        characterController = GetComponent<CharacterController>();
        rb = GetComponent<Rigidbody>();
    }

    void Update()
    {
        if (characterController.isGrounded)
        {
            anim.SetBool("Grounded", true);
            if (Input.GetButton("Vertical") || Input.GetButton("Horizontal"))
            {
                Speed = Input.GetAxis("Vertical");
                Direction = Input.GetAxis("Horizontal");
                anim.SetFloat("Speed", Speed);
                anim.SetFloat("Direction", Direction);
                moveDir = new Vector3(Direction, 0, Speed);
                moveDir *= speedwalking;
                moveDir = transform.TransformDirection(moveDir);
                characterController.Move(moveDir * Time.deltaTime);
                moveDir.y -= gravity * Time.deltaTime;
            }
            else
            {
                anim.SetFloat("Speed", 0);
                anim.SetFloat("Direction", 0);
            }
        }
        else
        {
            anim.SetBool("Grounded", false);
        }
    }
}

sentences:
Gamemaker's xprevious is the same value as x... Same thing happens for the y variabbles So I'm making a tower defense game but for some reason the enemies (which are following a path) have the same xprevious value as their x value. The same is true for their y variables. This also happens when the enemy is not on a path. I double checked that I'm not modifying the x and y previous variables anywhere. Is this a bug in GameMaker?

Thanks,
Philip

sentences:
Counting point for a recursive domino-like game: Carcassone I have to build a 2D version of this game:

http://en.wikipedia.org/wiki/Carcassonne_(board_game)

counting scores for Towns and Roads seems easy enough (but I'm not sure), but for Lands I feel I don't have a clue.

I'm guessing I can define 3 "plugs" for each side, 12 for each tile, and then using pairs to create links between them inside a tile...

I remembered seeing that there is some book about graphes with boost, but I'm sure I don't need that...

sentences:
How can I communicate between libGDXand the Android Studio Java files? The reason I'm asking is because I wanted to create a game and I know I could use Scene2D to create the UI but as far as menus go I wanted to use the tools in android studio to at least create a menu that would lead to the game screen.

They say you should try to do everything in libgdx but how would I go on about trying to accomplish this task?

sentences:
How can I change a sprite used for a Unity Tilemap tile at runtime? I want to change Tile's sprite during runtime, but it doesn't render.

class SwitchableTile : Tile
{
  // usable sprites
  public Sprite[] sprites;
  // index to the sprite
  private int spriteIndex = 0;

  // I don't know when it's called
  // but set sprite to current spriteIndex
  public override void GetTileData(Vector3Int position, ITilemap tilemap, ref TileData tileData)
  {
      // ..
      if (sprites != null && sprites.Length > 0)
      {
        tileData.sprite = sprites[spriteIndex];
      }
   }
  // called per Tilemap.RefreshTile
  public override void RefreshTile(Vector3Int position, ITilemap tilemap)
  {
    tilemap.RefreshTile(position);
  }
}

Also tried to refresh the tile according to the position:

// in MonoBehaviour
BoundsInt bounds = tilemap.cellBounds;
bool updated = false;

foreach (Vector3Int pos in bounds.allPositionsWithin)
{
  TileBase tile = tilemap.GetTile(pos);
  if (tile && tile is SwitchableTile)
  {
    if (!updated)
    {
      // just loop index
      Sprite sprite = ((SwitchableTile)tile).GetNextSprite();
      // set sprite
      ((SwitchableTile)tile).sprite = sprite;

      updated = true;
    }
    // refresh
    tilemap.RefreshTile(pos);
  }
}

Since Tilemap.RefreshTile calls TileBase.RefreshTile per refresh, the problem's solved after I implemented TileBase.RefreshTile.

I'm not using 2d-extra's animation tile because I want to change sprites only under certain condition. Also not using Tilemap.SwapTile because in this case I'm solving it using customized Tile, instead of creating a new Tile.

Update: Well...It proves that I need to implement RefreshTile for a Tile. Now the sprite refreshes. But I'm still not sure about GetTileData, do I need to implement it? When it is called?

sentences:
What is the best way to implement collision detection using Bullet physics engine and a track generated from a curve? I am developing a small racing gam, the track is generated from a curve.

As said above, the track is generated, but not infinite. The track of one level could fit with no problem in memory and will contain a reasonably small amount of triangles.

For collisions, I would like to use Bullet physics engine and know what is the best way to handle collisions with the track efficiently.

NOTE : The track will be stored as a static rigid body (mass = 0). The player will be represented by a sphere shape for collisions.

Here is some possibilities i have in mind :

Create one rigid body, then, put all triangles of the track (except non collidable stuff) into it. Result : 1 body with many triangles (eg : 30000 triangles)
Split the track into several sections (eg: 10 sections). Then, for each section, create a rigid body and put corresponding triangles in it. Result : small amount of bodies with relatively small amount of triangles (eg : 1500 triangles per section).
Split the track into many sub-sections (eg : 1200 sections). Here one subsection = very small step when generating the curve. Again for each sub-section, create a body and put triangles in it. Result : many bodies with very small amount of triangles (eg : 20 triangles). Advantage : it could be possible to "extra data" to each of the subsection, that could be used when handling collisions.
Same as 2, but only put  sections N and N+1 in physics engine (where N = current section where the player is). When player reach section N+1, unload section N and load section N+2 and so on... Issue : harder to implement, problems if the player suddenly "jump" from one section to another (eg : player fly away from section N, and fall on section N + 4 that was underneath : no collision handled, player will fall into void )
Same as 4, but with many sub-sections. Issues : since subsections are very small there will be constantly new bodies added and removed to physics engine at runtime. Possibilities for player to accidently skip some sections and fall into the void are higher than 4.

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

LevelManager.CS

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

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

GameManager.CS

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

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

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

            CheckTheCall();
    }

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

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

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

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

sentences:
Initial force to achieve orbital velocity I'm attempting to get asteroid to orbit a black hole that is asserting gravity. Some parts currently work, like the black hole asserting gravity, attracting asteroids in and destroying them. And sometimes the asteroids, or smaller chunks end up in orbit around the black hole. But my desire is to have them orbiting at random distances at the start of the game.

Gravity

First please note, I am certain the math behind a lot of this is off, I'm hacking a concept at the moment and once enough pieces are in place I intent to come back through and apply proper scale and units to everything.
Next, it's written in JS but concepts should be fairly universal.

  function attractBodyToBlackHole(body) {
    var sx = body.position[0];
    var sy = body.position[1];
    var bx = blackHoleBody.position[0];
    var by = blackHoleBody.position[1];

    var angleToBody = Math.atan2(sx - bx, sy - by);
    var distanceToBody = Math.sqrt(Math.pow(sx - bx, 2) + Math.pow(sy - by, 2));

    var magGrav = 0.8 - (distanceToBody / 14);
    if(magGrav < 0) {
      magGrav = 0;
    }

    body.force[1] -= magGrav*Math.cos(angleToBody);
    body.force[0] -= magGrav*Math.sin(angleToBody);
  }

This function is applied to each object on p2's step, attracting it closer to the black hole.

Asteroids

function addAsteroid() {
  var bx = blackHoleBody.position[0];
  var by = blackHoleBody.position[1];

  var a = Math.random() * (Math.PI * 2);
  var dist = 3 + (Math.random() * 3);
  var x = dist * Math.cos(a);
  var y = dist * Math.sin(a);

  var vx = ?;
  var vy = ?;

  var asteroidBody = new p2.Body({
    mass:10,
    position:[x,y],
    velocity: [ vx, vy ]
  });
}

So my question is, how can I calculate velocity x/y (or force x/y ideally) to get these objects, based on their position, distance and the force of attraction from the black hole?

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:
What are the performance implications of multiple windows with indivdual OpenGL contexts? For an engine I'm developing I've decided to allow users to set up multiple windows showing differing views of the same "world."  This is being developed using OpenGL (hopefully aiming for 3.2 core eventually if that affects the ansmer) and SDL 1.3.  The basic structure I've got set up is:

class Window {
    SDL_Window *sdl_window;
    SDL_GLContext context;

    Window(...) {
        sdl_window = SDL_CreateWindow(...);

        // Rest of the setup of world etc.
    }

    gl_init() {
        context = SDL_GL_CreateContext(sdl_window);

        // Set up initial OpenGL settings.
    }

    render() {
        SDL_GL_MakeCurrent(sdl_window, context);

        // Rendering the world.

        SDL_GL_SwapWindow(sdl_window);
    }
}

This all compiles and runs fine with the rest of the demo code I've developed so far, simply showing a pair of slightly offset views.  However, there's no really performance heavy stuff implemented yet.

Is this the correct approach to use?
Are there any major performance implications with switching the context twice (or more) a frame? (other than the expected double (or more) rendering occurring).

For example, does switching contexts force a flush of the graphics memory to the system RAM or something equally frame-rate killing?

Is there an alternative method  that would allow setting up two different viewpoints and rendering them in one pass?
If this is the best way to do it is there a way of sharing data between contexts?  I'm thinking once I switch to VBO's over display lists, if the views overlap in some way they should be sharing VBO's for that portion.

sentences:
Node representations in a navigation mesh There are different ways to represent nodes in a navigation mesh. It's either along triangle centroid, along triangle vertices or along edge midpoints.

As I understand if you choose triangle centroid or edge midpoints as nodes, the path isn't going to be optimal, but you can use a funnel algorithm to optimize it.

If you choose triangle vertices as nodes however, I understand you can find the more optimal path from get-go. But you will get a "wall hugging" issue. Which you can solve by using some algorithm I unfortunately forgot the name of.

What is the preferred or most optimal option?

sentences:
Monogame + Render Target + antialiasing doesn't work Is there any proper way to use antialiasing, while rendering to a RenderTarget2D and using Monogame?

I do this:

renderTarget = new RenderTarget2D(GameData.GraphicsDevice,
    pp.BackBufferWidth, pp.BackBufferHeight, false,
    GameData.GraphicsDevice.DisplayMode.Format, DepthFormat.Depth24,
    4, RenderTargetUsage.DiscardContents);

but AA is disabled despite setting multiSampleCount to 4. The hardware supports it and it works if rendering directly to the back buffer.

I googled around and it seems it used to work for XNA, but for Monogame I found this: https://github.com/mono/MonoGame/issues/1162

This link suggests it's an open issue and is from 2013. This is hard to believe for me, because it would effectively make using Monogame render targets unusable for most applications..

sentences:
How to render a trimmed sprite? I used TexturePacker to create an atlas for me and I've read it into my game.  I can use unrotated and untrimmed sprites and it works fine.  Now I would like to support trimmed sprites and I'm running into a conceptual issue.

I'm not sure how to do the untrimming.  What do you do with the trim information?

My sprite is rendered as a quad with 4 vertices and 4 uv's.

Let's say the original sprite was:

size.width = 100;
size.height = 100;

Let's say that it exists in the atlas at:

location.x = 0;
location.y = 0;
location.width = 100;
location.height = 100;

To draw this untrimmed image, I do the following.

Compute 4 vertices for the sprite.  I use the height/width ratio
to adjust the top right and bottom right vertices.  That way the
sprite's aspect ratio is what you would expect
Compute 4 UV for the sprite.  In the above case, if the atlas is 1024 pixels square, then the UVs would form a box between the points (0.0, 0.0) to (0.1, 0.1)

And this works fine.  I can see an untrimmed image exactly as you would expect.

Enter trimming....

Let's say the original sprite was:

size.width = 100;
size.height = 100;

Let's say that it was trimmed in the atlas too:

trim.x = 5; // it was trimmed "in" from the left by 5 pixels
trim.y = 5; // it was trimmed "down" from the top by 5 pixels
trim.width = 15; // it was trimmed "in" from the right by 15 pixels
trim.height = 15; // it was trimmed "up" from the bottom by 15 pixels

So now the final location in the atlas is:

location.x = 0;
location.y = 0;
location.width = 80;
location.height = 80;

What I'm confused about is how to "untrim" the image when it is drawn.  I tried:

Moving the UV's by the amount that was trimmed. This resulted in a stretched image and in other tests, I saw parts of the adjacent sprites.  You can't really move a UV.
Moving the vertices by the amount that was trimmed.  Some of my sprites are actually animations.  This causes some frames to have different heights and widths -- sprite appears to "bounce".  It's bounding box shifts around too with the trimming.  (Currently, I have AABB's formed tightly around the vertices of the sprite -- which is what you would expect when the sprite is not trimmed.)

I clearly am missing the concept here.  How does one "untrim" the sprite during a render?  (I'm using OpenGL)  Am I supposed to move around the vertices, but not the bounding box?

sentences:
How to set the object's world position in bullet? In my Ogre3d application I am first changing the parent of a node like this:

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

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

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

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

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

Any ideas what I am missing here?

sentences:
Moving a platform left to right with continuous movement I made a 2D game with Unity, and I am trying to create a platform that will move from left to right continuously, but I don't know how to make the platform move a greater distance then -1 to 1 units because I use the Mathf.Sin function. I can only control the speed of the platform.

Here is my code:

private Vector2 startPosition;
private int speed;

void Start ()
{
    startPosition = transform.position;
    speed = 3;
}

void Update()
{
    transform.position =
        new Vector2(startPosition.x + Mathf.Sin(Time.time * speed), transform.position.y);
}

Here is what the code actually does:

How can I control the distance that the platform can move to each side? For now, it can only move 1 unit to each side.

sentences:
Smooth rotation for a bone? I'm trying to make my character bone "chest" rotate smoothly when face enemy and get back to his stand. Can anyone help me with this ?

public Transform Target;
public Vector3 Offset;

Animator anim;
Transform chest;

public float rotation_speed;
public bool aim_at_traget = false;

void Start()
{
    anim = GetComponent<Animator>();
    chest = anim.GetBoneTransform(HumanBodyBones.Chest);
}

void LateUpdate()
{
    if (aim_at_traget == true) {
    // smooth rotation to face target
    chest.LookAt(Target.transform.position);
    chest.rotation = chest.rotation * Quaternion.Euler(Offset);
    }
    else {
        // get back to you stand smoothly
    }
}

sentences:
Counting multiple touches using Cocos2dx 3.2 I'm trying to count the number of active touches in screen in order to perform an an action in case that there are two touches:

auto jumpListener = EventListenerTouchAllAtOnce::create();
    jumpListener->onTouchesBegan = [=](const std::vector<Touch*>& touches, Event* event)
    {
        CCLOG("Multi-touch detected %d", touches.size());
        if(touches.size() == 2)
        {
            this->_player->jump();
        }

    };

But even if I'm touching with two fingers, I get that only 1 touch has been made, any suggestions?

sentences:
Step by step 3D Game Design in Unity My main question is related to 3D game design for Unity, but please let me introduce my idea so that you can understand what I really mean.

I am very eager to develop an adventurous - travel 3D game (Unity), where the main character is given some kind of task in country A and if he deals with it, he goes to the upper level, which is in another country and so on.

I have never developed a computer game before. I have knowledge of c# and a bit of java (for the programming part of the game). But I really don`t know where to start with the design. I have to think of a main character, episodic characters, environment and distinctive buildings for each country in 3D (for e.g. The Eiffel Tower in Paris, The Colloseum in Rome, The Great wall of China etc. ).

My question is: where to begin with the 3D design of the characters, the cities and the buildings? Can you please give me step-by-step instructions so that I can do something good and meaningful?

I know that Blender is a good option for 3D modeling, but is it the only thing needed for the 3D game design? I have experience with Adobe Illustrator, so can I use it to some extent in this case (for 3D game elements)?

Can I use Illustrator then import it in Blender and finally import the Blender product in Unity?

I accept every advice given. I really need someone to explain these things to me because for now I am really puzzled and not orientated from where to begin.
Thank you!

sentences:
Multiple volumetric lights I recently read this GPU GEMS 3 article Volumetric Light Scattering as a Post-Process. I like the idea to add volumetric light property to realtime render i'm working on. Question is will it work for multiple lights? Our renderer uses one render pass per light and uses additive blending to sum incoming light.

I'm mostly convinced that it have to work nice. Do you agree? Maybe there can be problem where light rays crosses each other.

sentences:
Scaling background without scaling foreground in platformer? I'm currently developing a platform game and I've run into a problem with scaling resolutions.

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

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

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

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

(this makes the translation too small for low resolution)

and

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

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

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

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

Thank you in advance!

sentences:
How are voxel terrain engines made? A few days ago I found something called voxel terrains and I think that they're pretty cool.  But I don't know anything generating them. Do you model it in your modeling software or use something like a heightmap? I read on wikipedia that voxels are like 3d pixels or volumetric pixels.

After I make the voxel terrain, how can I take these voxels and make them  destroyable/diggable?

I will pick the best answer based on:

code and algorithms. preferably based in C#
explanations. I am a beginner with algorithms but I'm very familiar with object oriented programming
step by step demonstrations. Not only concept but direction.
diagrams/illustrations. No, not screenshots of other engines.

I know that this is a complicating subject. But, thanks for any help!

No, I'm not trying to make a minecraft clone.

Edit

Thanks to everyone for your great help (especially Nick Wiggill)! This is what I managed to make (Work in progress).

sentences:
How do I achieve supersampling / anti-aliasing in pixel shaders? I am trying to write a couple pixel shaders to apply to images similar to Photoshop effects. For example this effect:

But I noticed there is aliasing in my resulting image (the above image is a sample from the linked website).

What can I do to prevent this? I couldn't find any article that explains how to solve this. I read some techniques like rendering in a higher resolution and then downsizing the image, but I need to solve this in a pixel shader capacity.

sentences:
Board like strategy map I want to make a strategy game like Risk. I want to use C# for the mechanics and Unity for the graphics.

My problem is that I don't know how to create the map itself and integrate it with C#. I don't want a tile map but instead I want to create a customized world map, with different provinces defined by me.

The map would be something like Imperial Glory, where you see it top down and then move your generals like chess pieces. I'm not implementing any real time battles at this point, it's just something really simple, like a board game. Could anyone please help me?

I'll try to explain it a bit better: I need to create a map of the Mediterranean basin that would cover all the land occupied by the Romans at the height of their empire.

Next, I'll divide the map into 20 provinces (Italy, Gaul, Germania, etc), each one producing a set ammount of resources and population. I also want them to have their own wheather and buildings (for example, you can only train soldiers in provinces that have a barracks). I guess I'll need a text box popup that appears when you click on a province to display it's information.

I'll also need some buttons to open dropdown menus or perhaps whole windows, for other purposes such as diplomacy, statistics, tech trees, etc.

I wanted the map to be in 3d because I think it would be much more interesting to look at it in perspective instead of flatten 2d.

I'm fairly new into Unity so I really admit that I have no idea where to start. Please, have patience with my ignorance. Thank you very much for all your help. If there are any doubts about my question, please let me know and I'll try to explain it better.

PS: I think I'll make it a turn based game since I think this would make it simpler to code and faster to run.

sentences:
How to spin a 2D quad in place using only matrices? In short, I have a textured 2D quad (a sprite).  I would like to rotate/spin it about the z-axis (coming out of the screen) using nothing but matrices.

If I do the following to a transform with scale in it already, the object spins, but also follows a circular path around the origin.   As a test, if I first undo the scale, then this works fine (the object spins in place).  But I'm not normally keeping scale, orientation and translation separate and then computing the matrix every frame in this case.  I'm mutating the matrix all the time.  So this isn't workable.  Can this be done without first undoing the scale?

self is the current transformation matrix (4x4)
pivot is the "center" of the quad's AABB (recomputed immediately before this)
eulerAngles is a vec3 containing {0.0, 0.0, z-angle}

/* translate to the origin */
translate(self, -pivot);

/* rotate */
rotate(self, eulerAngles);

/* go back */
translate(self, pivot);

(I'm using OpenGL, but that probably doesn't matter much here)

There are other related articles, but I didn't get to a solution.  I'm linking for reference:

Combining rotation,scaling around a pivot with translation into a matrix
How can I rotate about an arbitrary point in 3D (instead of the origin)?

sentences:
Causing Update loop with Coroutine Unity Total Noob Alert! < 7 days with C# and Unity

My Win Game screen becomes SetActive and my Player is SetActive false when you are standing in a trigger and crouch. That all works fine except you cant see the crouch animation because he is IMMEDIATELY SetActive false.

I tried to delay this by creating a coroutine. The problem with that is this is all happening in the Update function (or whatever it's called) because of the getkeydown for crouch. That gets called once per frame so my coroutine is trying to go off once per frame.

I tried creating a bool called isCoroutineStarted and set it to false and then set it to true in the Coroutine to break the loop but that didn't work either.

Don't know what to do so I reverted it back to before where it doesn't show my crouch animation.

Here's my script (It's attached to a Game Object with the trigger):

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

public class xxxxxx : MonoBehaviour {

    public bool xxx = false;

    [SerializeField]
    private GameObject youWinUI;

    [SerializeField]
    private GameObject player;

    // Determines whether or not the player is standing on the xxxxx
    void OnTriggerEnter2D (Collider2D other)
    {
        xxx = true;
    }

    void OnTriggerExit2D (Collider2D other)
    {
        xxx = false;
    }

    //Turns on Win screen and makes player disappear when crouch on xxx
    void Update ()
    {
        if (Input.GetKeyDown (KeyCode.S) && xxx == true) {
            youWinUI.SetActive (true);
            player.SetActive (false);
        }
    }
}

P.S. ignore the x's no stealsies lol. Also this piece of script works as intended I just want a delay so you can see the crouch animation.

sentences:
1D vs 2D vs 3D texture performance I'm working on a 3D game with large blocky untextured, but individually colored, voxels (similar to CubeWorld). For rendering, right now I naively convert online all visible faces ahead of time to triangles with the color information stored in the vertex attributes. The screenshot below is an example of what I'm currently doing. There's a lot of room to improve here and I want to switch to a system that uses fewer vertices and stores color information in a texture.

What I'd like to do is combine adjacent triangles with the same normals and simplify the mesh so I'm left with a fraction of the vertices. My big hangup is color information. It's easy to add UVs, but the correct choice for texturing isn't obvious. I'm trying to figure out the relative performance of these options:

Use a 1D texture. This is compact but I'm concerned that large 1D textures won't play nicely with texture mapping units optimized for 2D textures.
Use a 2D texture. Simple, but it'll end up with gaps.
Use a 3D texture with the full set of voxels.

Does anyone have insight as to the relative performance of these options? No mipmapping or other filtering is needed here, so all three options should be viable.

For reference I'm making this in C++ using OpenGL on Windows. My target GPU architectures are GTX 780 Ti and higher or AMD equivalent.

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:
Mixing Javascript with C++ for mobile development? I have a few games for the iPhone, Android, and Windows 8 that I built using native C++. This works great but is really limiting when I try to create menus and start screens.

I have read about rapid development using jQuery Mobile and Phonegap but have never used any of these frameworks. However there looks to be an advantage using this to ceate my game menus and simple screens.

Is it possible to mix my existing C++/OpenGL game code with JavaScript used for simple  navigation, obviously this would need to compile into a native binary for iOS, Android, and BB. Is this possible?

I am all ears to any of the following to solve this; a framework, technique, or any approach that can make this happen.

sentences:
What organic traffic can I expect from publishing on Google Play, without other marketing? I've just published a new Android game on Google Play. It has been a bit over 48 hours.  It's active in the store, and I can search for it by name to get to it.  However, I've had 0 organic downloads thus far, only a couple from my friends. As far as I know, it has not been shown in the "new games" list yet, and the only store listing views in the stats are the ones from myself and friends.

Is there some time by which I can expect some "organic" exposure, or will I ever?  Is promoting my game by other channels the only option?

I'm not asking for advice on promoting my game. I'm only asking about what organic exposure I can expect on Google Play.

sentences:
Examples of RESTful Web Services for Browser Games Can anyone point me towards examples of Browser Games / Browser Game Sites that use RESTful web services?

I have been convinced time and again that building web sites using RESTful principles is a good idea. And I agree.  But I just can't wrap my head around what RESTful means when the service you're providing is just a single (or a few) games.

Any ideas or thoughts would be nice, but I'd also love to see some solid examples.

sentences:
Trying to find a solution for instant knockback in multiplayer game I'm making a server-authoritative fast-paced multiplayer game. I'm trying to implement wack-hammers, they are a melee weapon that knocks close players, in other words, that sets their velocity to inverse of their mass *  to the direction aimed at * the force of the hit. Even if the enemy player is only seen getting knocked after the client input gets processed on the server and after the enemy's position and velocity get sent back, I want to make it seem like your action appeared instantly.
I've tried one thing: when you knock a player, that player gets predicted for a short amount of time instead of being interpolated. That way, players appears to have been knocked out instantly, but there's an issue with that. When should I stop predicting? And how? When you think about it, the prediction is done on your own client time. The positions and velocities of other players are a few millisec old, so when you try to interpolate between your local "futur" predicted player position to the "old" server player position, you essentially move the other players back in time, and it looks real bad.
I'm not quite sure what to try to hide this issue. I can't possibly predict the enemy player's position forward in time, its movement can get too chaotic.
I've already watched the GDC talk from Overwatch's and Rocket League's netcode a million time, I'm not sure if they can help me with my issue.
Edit: I still haven’t found the best solution yet but there’s some useful information over at https://forums.unrealengine.com/development-discussion/c-gameplay-programming/1455487-responsive-knock-back-in-multiplayer-game

sentences:
My HTML Canvas went blank I tried to draw Mario Sprites in my HTML Canvas, but it always went blank.
Anybody knows why?

var canvas = document.getElementById("screen");
var ctx = canvas.getContext("2d");
var mario;
var marioSprite;
var tiles;
var speedX = 1;

//marioSprite Specification
mario = {
    //target picture specification X & Y, Width & Height
    px:276,
    py: 44,
    pwidth: 16,
    pheight: 16,
    //drawing on Canvas specification X & Y, Width & Height
    cx: 16,
    cy: 116,
    cwidth:16,
    cheight:16,
}

//draw Mario in Canvas
function drawMarioSprite(){
    marioSprite = new Image();
    marioSprite.src = 'file:///C:/Users/MASTONO ALI/Desktop/img/characters.gif';
    marioSprite.addEventListener('load', e => {
    ctx.drawImage(marioSprite,
        mario.px, mario.py, mario.pwidth, mario.pheight,
        mario.cx, mario.cy, mario.cwidth, mario.cheight);
    });
    this.position = function() {
        this.mario.cx += speedX;
    }
    position();
}//drawMarioSprite() end

//drawTiles and tilesLoop
function drawTiles() {
    tiles = new Image();
    tiles.src = 'file:///C:/Users/MASTONO ALI/Desktop/img/tiles.png';
    tiles.addEventListener('load', e => {
        tilesLoop();
    });
}
function tilesLoop(){
    for (let x = 0; x < 25; x++){
        for (let y = 11; y < 13; y++){
            ctx.drawImage(tiles,
                0, 0, 26, 26,
                x*12, y*12, 20, 20);
        }
    }
}//drawTiles() end

function draw(){
    ctx.clearRect(0, 0, canvas.width, canvas.height);
    drawMarioSprite();
    drawTiles();
    window.requestAnimationFrame(draw);
}

window.requestAnimationFrame(draw);

sentences:
lwjgl and slick util text over textured quad So, I load a TrueTypeFont like this:

   private TrueTypeFont trueTypeFont;
   try {
        InputStream inputStream = ResourceLoader.getResourceAsStream("assets/fonts/main.ttf");

        Font awtFont2 = Font.createFont(Font.TRUETYPE_FONT, inputStream);
        awtFont2 = awtFont2.deriveFont(24f); // set font size
        trueTypeFont = new TrueTypeFont(awtFont2, true);

    } catch (Exception e) {
        e.printStackTrace();
    }

After that, I draw a textured quad, as one usualyy would and then, draw trueTypeFont.drawString(this.x, this.y, this.text, Color.white);
.
What this gives, however is far from text, this is what it does, the black is supposed to be text...

How to fix?

sentences:
AdMob interstitial ads not showing after publishing in playstore I have create a Unity game, 1st I add an AdMob interstitial ads script on game object then try on my main camera when I test in my mobile before publishing. It has worked like real time ads and mistakenly clicked it and earn 0.3 so I create new ad unit placed it on my game then published my game. But the ads are not showing in real time. No error was found in AdMob but 147 ad requests are shown in AdMob and ads are not visible when my game 1st scene opens.

Here is my interstitial ads script code:

using UnityEngine;
using System.Collections;
using GoogleMobileAds.Api;

public class AdmobScript : MonoBehaviour
{
   private InterstitialAd interstitial;

   private void RequestInterstitial()
   {
      #if UNITY_ANDROID
         string adUnitId = "ca-app-pub-3129337025883034/9036322***";
      #elif UNITY_IPHONE
         string adUnitId = "INSERT_IOS_INTERSTITIAL_AD_UNIT_ID_HERE";
      #else
         string adUnitId = "unexpected_platform";
      #endif

      // Create an interstitial.
      this.interstitial = new InterstitialAd(adUnitId);
      // Load an interstitial ad.
      this.interstitial.LoadAd(this.CreateAdRequest());
   }

   // Returns an ad request
   private AdRequest CreateAdRequest()
   {
      return new AdRequest.Builder().Build();
   }

   private void ShowInterstitial()
   {
      if (interstitial.IsLoaded())
      {
         interstitial.Show();
      }
   }

   public void Start()
   {
      RequestInterstitial();
   }

   void Gameover()
   {
      if(interstitial.isloaded){
        ShowInterstitial();
      }
   }
}

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: How should I reload a ball? I am making an angry bird type 2d game using Unity and C#. After I throw the ball from catapult, I have no idea on reloading the ball. Then I use SceneAsync to reload the ball but it is the worst thing I've ever made since I can't make the other sprite objects to continue their movents after the ball is thrown. So what code should I use to reload the balls after throwing?

sentences:
How to achieve programming experience with PS3 or Xbox360? Possible Duplicate:
  How to get PS3/Xbox 360 experience without having access to Dev kits?

Is there a way to achieve programming experience with PS3 or Xbox360 systems without the development kit that only are selling to great videogame companies ?

There are a lot of game companies that request experience with these systems and I don't know how to achieve this.

sentences:
How can I draw a line of certain length and direction? I want to create a line of certain length and direction.

What I mean by this is drawing a line from Point A to Point B.
Normally in Unity C# to draw a line from Point A to Point B is simply:

Debug.DrawLine(point_A, point_B);

The diagram would be something like this

A----------------B

But I dont want something like this, I want it to draw from Point A to Point B but with a certain length. So I am guessing I need the direction for this to work. But I don't know how to code it.

Here is a basic diagram of how i want it.

A--------        B

sentences:
GLSL Sphere from Vertex I am working on a particle simulation where we have a lot of spheres which can have different radii. Using this tutorial http://mmmovania.blogspot.de/2011/01/point-sprites-as-spheres-in-opengl33.html (see also code below) I was able to create a sphere from a point, but they all have the size from glPointSize(). Is it possible to extend this with a radius?

#version 330
out vec4 vFragColor;

uniform vec3 Color;
uniform vec3 lightDir;

void main(void)
{
    // calculate normal from texture coordinates
    vec3 N;
    N.xy = gl_PointCoord* 2.0 - vec2(1.0);
    float mag = dot(N.xy, N.xy);
    if (mag > 1.0) discard;   // kill pixels outside circle
    N.z = sqrt(1.0-mag);

    // calculate lighting
    float diffuse = max(0.0, dot(lightDir, N));

    vFragColor = vec4(Color,1) * diffuse;
}

Maybe of interest: I am using #version 120 for my shaders.
Or, is there a better way to do this?

So, combining the two answers I now have:

void
Draw::setGeometry(float* geometry, float* velocity, float* radius, GLuint size){
    this->_size = size;

    glGenBuffers(1, &_vertexData);
    glBindBuffer(GL_ARRAY_BUFFER, _vertexData);
    glBufferData(GL_ARRAY_BUFFER, _size * 3 * sizeof(float), geometry, GL_STATIC_DRAW);
    glBindBuffer(GL_ARRAY_BUFFER, 0);

    glGenBuffers(1, &_velocityData);
    glBindBuffer(GL_ARRAY_BUFFER, _velocityData);
    glBufferData(GL_ARRAY_BUFFER, size * 3 * sizeof(float), velocity, GL_STATIC_DRAW);
    glBindBuffer(GL_ARRAY_BUFFER, 0);

    glGenBuffers(1, &_radiusData);
    glBindBuffer(GL_ARRAY_BUFFER, _radiusData);
    glBufferData(GL_ARRAY_BUFFER, size * sizeof(float), radius, GL_STATIC_DRAW);
    glBindBuffer(GL_ARRAY_BUFFER, 0);

}

And the drawing method:

void
Draw::paint(GLenum mode){
    glBindBuffer(GL_ARRAY_BUFFER, _vertexData);
     glEnableVertexAttribArray(0);
    glVertexAttribPointer(0, 3, GL_FLOAT, GL_FALSE, 0, 0);
    glEnableVertexAttribArray(1);
    glVertexAttribPointer(1, 3, GL_FLOAT, GL_FALSE, 0, 0);
    glEnableVertexAttribArray(2);
    glVertexAttribPointer(2, 1, GL_FLOAT, GL_FALSE, 0, 0);

    glDrawArrays(mode, 0, _size * 3 * sizeof(float));
    glDisableVertexAttribArray(0);
}

And the Vertex Shader:

#version 130

attribute vec3 position;
attribute vec3 velocity;
attribute float size;

uniform mat4 MVP;
uniform mat4 MV;

void main(){
   gl_PointSize = size;

   gl_Position = MVP * vec4(position, 1.0);
}

The problem is that when gl_PointSize = 15 is set, they are drawn well. When I make it equal with size, then it looks like this: http://picpaste.com/Big_particles-daIBnJCG.png

Works better now. Particles still getting bigger as they move along.

sentences:
Managing game states (states flow, controlling the state machine...) I am currently struggling really bad to make the game states management. Before we dig into the problem, I must point out that I do know about state machines, I do have both implemented (states and state machine) and they look SIMILAR to this, or you can also see my real outdated implementation from my github.
Alright, my questions are:

Do states usually operate state machines? Eg.: when the LoadingState
finishes (based on the 'update' method) loading something, it tells
the state machine to pop the stack (which would pop the
LoadingState) and to push a new state, such as PlayingState OR
should the LoadingState only notify the state machine and the state
machine itself will be responsible of knowing whats the next state
based on the state that has requested a pop? Knowing which state has
requested a pop (pop, push or whatever) is kind of difficult because
it needs some advanced C++11 stuff, which requires a lot of
'not-easy-to-understand' code and validations (asserts), unless we
use an enumeration inside each state and do a simple switch (again,
more typing).
Should the state machine be opperated/accessed (pointer/static
functions) by any component (class, system, manager...) of the game?
Eg.: the main player has moved into a map teleport and it triggered
a map load, since it should be teleported to a new map. Should the
Map class notify the state machine to push the MapTransitionState
into the stack, through a static (it doesnt really make any sense to
have a pointer to the state machine in the map class) public
function?

Thanks a lot!

sentences:
How to set speed of circular motion Edit 2 - clarification

Just to clarify, the issue I have at the moment is how I specify a time (in seconds) for a complete revolution to occur.  My delta is fixed and is 1/ticks per second (1/60).  As you can see with my linear sprite movement, I have a 'time' variable which is where I specify (in seconds) how long the sprite should take to travel the length (or height) of the screen. I'm looking at how I do this for circular movement.

Edit 1 - Results from suggestions

See at end of question.

Background

When moving my sprites along a straight path, I'm using delta so I can get the same rate of relative motion on all devices like so:

spriteGridX = 240/480;  //I start out with a virtual 'Grid' so I can scale position to all resolutions etc so 240/480 would place the sprite at the center of the screen (X)

spriteScreenX = spriteGridX * width;  //Scale to physical screen where width is the width of the current devices screen (viewport)

spriteXTime = 8f; //8 being the amount of time in seconds that this sprite will take to traverse the entire width of the screen

spriteXVel = 1/spriteXTime; //Velocity that will be used to move the sprite along the virtual grid position

So, when I need to move the sprite, I simply do the following:

spriteXGrid+= (spriteXVel * Delta) //+= for right -=for left. I'm using a fixed delta time
spriteScreenX = spriteGridX * width; //And again, convert to usable screen position for current device
drawsprite(spriteScreenX, SpriteScreenY); //Draw the sprite (drawSprite is just a method I've written to draw openGL quads and it takes the screen X and Y as coordinates - spriteScreenY not shown here but essentially same as X with height instead of width.

Now, I need to have a sprite move along a circular path. So far, I have a test up and running which directly acts on the 'screen' coordinates of the sprite directly like so:

Java Code

int rad = 25;
float angle = 50;

spriteScreenX-=Math.round(rad*Math.cos(angle));
spriteScreenY+=Math.round(rad*Math.sin(angle));
angle+=.1;

The Problem

Now, the above does work, but the sprite completes it's circular path way too quickly (it's doing approximately 1 revolution per second).

So my question is:

Am I doing this correctly and if so..........
How do I slow this down?  I won't particularly need to keep changing the speed, I just want to be able to set it initially.

Would really appreciate some pointers.

Edit 1

When I put the following the code above I get the following result:

If I put the following:

spriteScreenX-=Math.round(rad*Math.cos(angle*Math.PI/180*delta));
spriteScreenY+=Math.round(rad*Math.sin(angle*Math.PI/180*delta));
angle+=.1;

Or:

spriteScreenX-=Math.round(rad*Math.cos(angle*delta));
spriteScreenY+=Math.round(rad*Math.sin(angle*delta));
angle+=.1;

Something like this happens:

sentences:
D3D12 ConstantBuffer - Shader receives wrong values im having trouble with one constantbuffer:

struct CameraConstData
{
    urd::Matrix projection; // 64 ( 16 floats)
    urd::Matrix view;       // 64 ( 16 floats)
    urd::Vec3 viewPosition; // 12 ( 3 floats)
    urd::Vec3 viewDir;      // 12 ( 3 floats)

    // 104 bytes (26 * 4)
    float offset[26];
};

inside the shader its defined like:

// desc heap cbv
cbuffer CameraConstBuffer : register(b0)
{
    float4x4 projectionMatrix;
    float4x4 viewMatrix;
    float3 viewPos;
    float3 viewDir;

}

now viewdir is always filled with wrong buffer indices.

viewDir.x is the passed y value
viewDir.y is the passed z value
viewDir.z is 0.0

checked it in the shader like:

float3 vpos = normalize(float4(viewDir, 0.0)).xyz;
//float value = vpos.x; // uses the passed y value
//float value = vpos.y; // uses the passed z value
color = float4(vpos, 1.0);

GPU Debugging shows that the constant buffer looks fine:

i checked the vectors against the cpu side and they match.

So why is the shader reading index 36-38 instead of 35-37?

Its always affecting the 4th member of the struct. If i switch viewPosition with viewDir, viewPosition is false.

sentences:
Instantiate prefab in editor script I'm working on a script to battle against nested prefabs. The script finds and replaces certain prefabs with a new version of that prefab. Now finding the prefabs is easy:

prefabList.AddRange(GameObject.FindObjectsOfType(typeof(GameObject)).Where(x => x.name == "PrefabName"));

But how can you instantiate a prefab in an editor script when the prefab is not in a resources folder? From what I read the PrefabUtility.InstantiatePrefab is used to do that, but I need a reference to the object which is instantiated.

sentences:
Why does Resources.Load cause a CastException in this case? I am doing this:

string fontName = "freespin_big";

TextAsset xml = Resources.Load<TextAsset>(fontName);
Texture2D image = Resources.Load<Texture2D>(fontName);

Font font = Resources.Load<Font>(fontName);
if (font == null)
{
    font = new Font();
    AssetDatabase.CreateAsset(font, "Assets/Resources/" + fontName);
}

In Resources, we have freespin_big.png and freespin_big.xml. I am planning to import the png and xml and create a font. So I check if the font object is there, if not create it.

But I get this error if the font does not exist yet:

  InvalidCastException: Cannot cast from
  source type to destination type.

If I try to do this:

Font font = Resources.Load<Font>("blorg");

Where no files are named "blorg", I get null as I expect.

Shouldn't Resources.Load return null if it finds no fonts with the right name?

sentences:
iPhone, iPad Rendering Ahead of Input (4-5 seconds) UPDATE I think I solved this one, though any thoughts or suggestions are always welcome!

This one is truly bizarre...  I'm developing using both an iPhone 3GS and an iPad 2.  This symptom is repeatable on the older iPhone hardware much more readily than on the iPad 2.  Here's what happens:

I start the game and the FPS is ticking at about 47 on the 3GS in OpenGLES2.0.  I have quite a lot on screen right now, so that is reasonable at this stage (I still have a few optimizations I can make too).

If you put a break in touchesBegan, it takes roughly 4-5 seconds before the break occurs and the game halts.  This doesn't happen all of the time, and in fact, if you restart the app several times, it usually goes away.  Moreover, if I let the game sit for a bit, it will eventually "sync."  Like I said, the iPad 2 rarely exhibits the problem (one out of every 15-20 test runs), but it is definitely still present.  If you perform a series of touches and accelerometer events in sequence, they are queued up and rendered just like you did them 4-5 seconds later.  Very reminiscent of 4-5s lag delays back in the day online :)

I've tried a couple things like glFlush, or glFinish at the end of each render loop (doesn't seem to have any effect).  Here's the top game loop:

- (void) drawView: (CADisplayLink*) displayLink
{
double dt = 0.0f; // Time in seconds since last loop
if (displayLink != nil) {
    dt = displayLink.timestamp - m_timestamp;
    m_timestamp = displayLink.timestamp;
}

// Update the game
m_gameEngine->Update(dt);

// Render the game
m_gameEngine->Render();
[m_context presentRenderbuffer:GL_RENDERBUFFER];
}

UPDATE:

The more I think about it...  this could be a loading issue. Right now, I instantiate my main controller class for the game loop in the - (id) initWithFrame: (CGRect) frame
call, which is also where I initialize OpenGL and (finally) call [displayLink addToRunLoop:[NSRunLoop currentRunLoop]
                     forMode:NSDefaultRunLoopMode].  It's almost as if the renderer gets behind or ahead of the game logic and it takes it awhile to get caught back up.

From research, I could also just be throttling the CPU too hard.  But if that were the case, I would imagine it wouldn't catch up...  the FPS stays at a solid 44-46, and the input lag does go away if you let it sit for 10-15 seconds (with or without doing anything, it eventually catches up).  I'm stumped, but I'll keep digging...

UPDATE 2:

Doing some profiling... figured out that the accelerometer being polled 1/60 was a bit taxing.  If I moved it to 1/30, this problem went away.  This is concerning to me, as it likely suggests I do have a CPU overloading issue that will only be solved through some serious optimizations across the board (which is okay, I knew I had to do it anyway).

For anyone with a similar issue, especially if you are using the accelerometer, make sure you disable it if/when you aren't using it.  I only use the accelerometer to allow the player to rotate/move the camera - so when the player has the camera locked, I am now toggling it off.  This has solved my problem for now, but like I said, I probably only solved it temporarily.  A real solution is going to take more work!

Hope this helps.

sentences:
How should I setup my sprites for 2D combat? I was painting pixel sprites of a goblin (the enemies in the game). I first thought of making sprites of it for each different scenario:
facing camera, moving toward camera 1, moving toward camera 2,
facing camera with sword, moving toward camera with sword 1, moving toward camera with sword 2,
facing left, going left 1, going left 2
facing left with sword etc.
(for a total of 18 sprites)

Then I wondered, how will I make the sword hit the player ? What if I want the goblin to have a different type of sword ? Do I have to make different sprites of it holding different weapon ?
I realised doing sprites for every scenario wasn't ideal. So my question is, how do I make this ?
Should I keep the sprites I have but remove the sword from them and then add a sword sprite attached to the player sprite and animating it so it matches the players movement ? Is that the way to go ?

sentences:
Unity : how to Rotate GameObject back to Indentity position? Hello i m trying to rotate my object smoothly over MouseButtonDown and rotate to identity position on MouseButtonUp and this code rotate my GameObject smoothly but it won't come back to identity position in time.

void Update ()
    {
        if (GameControls.Games.stateOfGame == GameControls.gameState.inStart || GameControls.Games.stateOfGame == GameControls.gameState.inPlay) {
            if (Input.GetMouseButtonDown (0) || Input.GetKeyDown (KeyCode.Space)) {
                StartCoroutine(FlyCat ());
            }
            if (Input.GetMouseButtonUp (0) || Input.GetKeyUp (KeyCode.Space)) {
                StartCoroutine (ResetCat ());
            }
        }
    }

    IEnumerator FlyCat()
    {
        animate.enabled = false;
        rigidbodyObject.bodyType = RigidbodyType2D.Dynamic;
        tempTimer = 0.0f;
        if (rigidbodyObject.position.y < maxUpperBorder) {
            rigidbodyObject.velocity = Vector2.zero;
            rigidbodyObject.AddForce (jumpForce);
            while (tempTimer < 0.5f) {
                tempTimer += Time.deltaTime;
                transform.rotation = Quaternion.Slerp (transform.rotation, Quaternion.Euler (rotationForce), Time.deltaTime * smooth);
            }
            rigidbodyObject.gravityScale = gravity;
            yield return null;
        }
        if (InstantiateOnce == true) {
            InstantiateOnce = false;
            GameControls.Games.GamePlay ();
        }
        yield return null;
    }

    IEnumerator ResetCat()
    {
        while (tempTimer > 0f) {
            Debug.Log (tempTimer);
            tempTimer -= Time.deltaTime;
            transform.rotation = Quaternion.Inverse (Quaternion.Euler(rotationForce));
        }
        transform.rotation = Quaternion.identity;
        yield return null;
    }

sentences:
Implementing recoil in a realistic and balanced way? To clarify, I've seen this post already

I really like the idea that the chosen answer suggests, yet when I go to implement it the recoil still doesn't "feel" right. The problem is mainly the fact that I'm moving the crosshair instantly to a new location and it feels quite jerky when playing around with it. I think that in order to properly implement recoil I need to move the crosshair more than once over multiple game ticks.

I think the main issue is that many games with realistic recoil "auto re-aim" (if you will) the gun as part of the recoil algorithm. This is from my experiences with various Source Engine games like Garry's Mod and Counter Strike. My best way of describing what I see and thinking about how it is implemented is that a point is chosen with a variance (usually up and slightly right) from the fire coordinates. The gun follows a sort of parabolic path (height depending on velocity of recoil) and eventually gets to the new point.

I'm getting kind of long winded but I hope most of what I said makes sense. Should I attempt to model the recoil implementation in the Source Engine? How would you go about implementing a realistic recoil algorithm? Are there any open source fps game engines that may be able to provide some inspiration?

sentences:
Creating a newspaper that effects the game's economy? I am writing a game in Objective C/cocos2d where a newspaper is a central part of what controls or rather effects the game's world economy as well as what a city might do (such as increase X, reduce Y)

The newspaper is a bit like a "Chance card" in Monopoly, it has an effect on something.

My question is, what is the best way to do write a newspaper that has both a random and specific effect within the game.

Would the best strategy be to write out all the things a newspaper can affect, a PLIST of headlines (with placeholders).

I think Tiny Tower uses a PLIST of events and it randomly picks an event, but I'm not sure how it actually parses it because certain events do different things.

But then how do I parse all the scenarios that a newspaper can deliver?  A big switch statement seems very long and complicated to do.

I am wondering if there is a simpler way to handle this kind of thing.

Related to this is that there might be no news that day and I'm not sure what the newspaper should display, should it just display the last headline?

So, in summary.

1) A newspaper generates a headline, it affects different things, such as the world economy, prices, how city reacts

2) I need the newspaper to generate headlines (although there may be days when there are no headlines at all), but I am not sure how to parse it without using a big-ass switch statement.

Thanks in advance.

sentences:
What is the `AssetBundle` dropdown in the inspector for? I know what an AssetBundle is alright. But what is the dropdown at the bottom right for?

Apparently you can choose an asset bundle for this asset to belong to. So what? What happens when you choose one? Does Unity build an AssetBundle for you? Where?

sentences:
Move Object Around Sphere in Unity3D I am trying to get a GameObject to be able to be controlled to move freely around a sphere using a virtual on-screen joystick. I am building this for iOS and Android in Unity. I am using the standard Joystick script that comes with the Standard Assets (Mobile) package. I can get the object to turn around it's forward vector using the joystick by this code:

if (moveJoystick.IsFingerDown())
{
    // Rotate the ship according to the joystick angle
    currentAngle = moveJoystick.getAngle();
    thisTransform.RotateAroundLocal(Vector3.forward, Mathf.DeltaAngle(lastAngle, currentAngle)*Mathf.Deg2Rad);
    lastAngle = currentAngle;
}

That rotates the ship around it's local axis correctly. My problem is trying to get the joystick to move the object around the sphere based on the axis that the joystick is on. This would mean the object moves in the angle it is pointing but staying at the same radius from the center of the sphere which is located at (0, 0, 0). Then I also need to have the camera follow the object as it moves. Any ideas?

Edit:
I got the orbit to work based off of the joystick using the code below. But the rotations seem to get messed up as soon as it gets to a certain point. Around 180 degrees? Also what is the correct way to have the camera follow the ship? I tried to make the camera a child of the ship in the hierarchy and that is when I really notice the messed up rotations and the ship doesn't respond correctly to my joystick. Also now the joystick doesn't rotate the ship around it's local axis anymore. Hmmm.

   if (moveJoystick.IsFingerDown())
        transform.RotateAround(Vector3.zero, Vector3.up, -moveJoystick.position.x * SPEED * Time.deltaTime);
        transform.RotateAround(Vector3.zero, Vector3.right, moveJoystick.position.y * SPEED * Time.deltaTime);
    }

sentences:
Which 3D graphic engine to use to target old pc's and old graphic cards? I would like to build 3d applications that are targeted at old PCs for education.  Which 3d engine do you recommend to use?  What technology should I use or approach?  I would like to avoid Unity3d or any other non-free frameworks, as this work I'm doing is voluntarily.

It's main idea is to make learning fun, using 3d simple gaming.  The target PCs are old single cpu Pentium4, or maybe even p3 (:

Thank a lot for helping.

sentences:
Storing 2D animation frames and sharing them between objects I store 2D animation frames in some class.
But the problem is that when I want to create multiple objects for example I want to spawn explosion or enemy
void ExampleScene::update()
{
    if (needToSpawnEnemy())
    {
        this->objects.add(Enemy());
    }
}

It means that everytime I want to spawn object I will need to access TextureHolder, pass string, get texture and load or compute animation frames and any other calculations that derivered object wants. It's not problem for example with player beacuse I load it on Scene::onCreate only once during entire game but with enemy I would do this during some update function.
My likewise simplifed implementation
struct Animation
{
public:
    void addFrame(Rect rect);
    //The rest of implementation
private:
    std::vector<Rect> frames;
}

class AnimatedSprite
{
public:
    void addAnimation(Animation& animation);
    //The rest of implementation
private:
    std::vector<Animation> m_animations;
}

How do I represent objects (this is gonna be very small project which will evolve later to ECS architecture but I think my problem will not change anyway so I want to solve it already)
struct Context
{
    TextureHolder textureHolder;
    //The rest of stuff...
}

class Object
{
public:
    //The rest of implementation
private:
    Context* context;
    AnimatedSprite sprite;
}

class Player : public Object { //implementation }
class Enemy : public Object { //implementation }

And how I add animation frames
void Enemy::onCreate()
{
    this->sprite.setTexture(this->context->textureHolder.getTexture("assets//graphics//enemy.jpg"));

    Animation walkAnimation;
    walkAnimation.addFrame({0, 0, 64, 64});
    walkAnimation.addFrame({64, 64, 64, 64}); //etc...
    //Surely it can be changed so frames will be loaded from file on disk

    this->sprite.addAnimation(walkAnimation)
}

Maybe NOW it's not very big problem unless I would get animation frames from file (which I want in future). So is there any gamedev standard / pattern / another aproach for this? I was thinking to store frames in dynamic memory and somehow share that data between objects of same class but I'm getting headache of thinking how I could manage that memory. (I don't see how smart pointers would help me beacuse there could not exist any Enemy objects for some time)
class AnimatedSprite
{
public:
    void setAnimation(Animation* animation)
    //The rest of implementation
private:
    AnimationState* animationState;
    AnimationFrames* animationFrames;
}

Should first object load everything but how do I delete it? I don't know if x enemy will be last one.
Or maybe should I add some methods to Object class
virtual void Object::loadDataFromDisk();
virtual void Object::unloadDataFromDisk();

But it seems to be bit clumsy.
I was also thinking to use my Context class to create somewhat AnimationHolder and use it like this->context->animationHolder.getAnimation("ENEMY_WALK"); but I'm not sure about this.
Or maybe some prefab system?
TLDR;
To be precise my shorter question is how to avoid loading same 2D frames data (not textures) while spawning new objects.
So any help and ideas?

sentences:
Inverse kinematic joint limits I want to limit the joint angle of my character.
I have just one issue i can't get the value of the joint limits of the human
-i search about max, min angle of each joint in x and y but i can't get them-
can someone give me them.

sentences:
Unity prevent force apply on re-enable Physics2D.IgnoreCollision I'm making 2d platformer game. My player and enemies  are rb with body type Dynamic. I choose dynamic for enemies because enemy need physics ( jumping, colliding with ground, etc)
I'm using  Physics2D.IgnoreCollision  for disabling and again enabling collision between Player and Enemies. When player lost life shield is applied on player.Here is code :
Disabling collision
private void OnCollisionEnter2D(Collision2D collision)
       {

    Player player = collision.gameObject.GetComponent<Player>();

    if (collision.gameObject.tag == "Player")
    {
        Physics2D.IgnoreCollision(collision.collider, gameObject.GetComponent<Collider2D>(), true);
        StartCoroutine(EnableCollision(player.timeShildActiveFixed, collision.collider, gameObject.GetComponent<Collider2D>()));

        if (player.playerState != Player.PlayerState.SHIELD)
        {
            playerLostLife();
            player.ActiveShield();
        }
    }

}

Enabling collision again:
    private IEnumerator EnableCollision(float delay, Collider2D collider1, Collider2D collider2)
{
    yield return new WaitForSeconds(delay);
    Physics2D.IgnoreCollision(collider1, collider2, false);
}

This work well but I my problem is that some force is applied on enemy before ignoring collision and enemy is changing its position ( on enemy because mass is set to 0.01 , but on Player mass is 1). This force is more visible when player not moving and shield is disabling and collison between player and enemy occur again and player get shiled again.
I can't work with different layer with disabled physics for Player and Enemy because I need collision between them.
Can someone help me with this? How can I fix this ?
Thanks

sentences:
Screen objects sometimes not rendering I am a mildly experienced programmer who has created several game engine templates and small 2D games in Java. I am currently expanding to 3D game engines and I am re-writing a previous engine to be more adaptive and Object-oriented.

My issue is, and has been periodically, that the objects are only sometimes rendered. This causes me to have to constantly re-run the program just to display any images.

I have not found any direct answers to this question, and nobody else seems to have this same issue (even when observing sources with the exact same code setup). The problem apparently lies within the render() method sometimes not properly creating or utilizing the Graphics & BufferStrategy objects while inside a thread called from the main method.

Here is some code of the 'Main' class:

public Main() {
    addScreenAndFrame();
}

public static void main(String[] args) {
     main = new Main();
     frame.add(main);
     thread =

new Thread(main);
         running = true;
         thread.start();
     }
public void run() {
    while (running) {
        render();
        tick();
    }
}
public void tick() {
    screen.tick();
}
public void render() {
    bs = getBufferStrategy();
    if (bs == null) {
        createBufferStrategy(3);
        return;
    }
    g = bs.getDrawGraphics();
    screen.paintComponent(g);
    g.dispose();
    bs.show();
}

Here is some code from the Screen class:

public Screen(int width, int height) {
    this.width = width;
    this.height = height;
    addEntities();
}
public void paintComponent(Graphics g) {
    p.render(g);
}
public void tick() {
    KeyInput.tick();
    renderInput();
}
public void addEntities() {
    p = new PolygonObject(new double[] {50,200,50}, new double[] {50,200, 200} );
}

And finally here is the PolygonObject class:

    public PolygonObject(double x[], double y[]) {
        Screen.polygonSize ++;
        polygon = new Polygon();
        for (int i=0; i < x.length; i++) {
            polygon.addPoint((int)x[i], (int)y[i]);
        }
    }
    public void render(Graphics g) {
        g.fillPolygon(polygon);
        g.setColor(Color.black);
        g.drawPolygon(polygon);
    }

I don't know why calling render() while within a thread would yield inconsistent results when drawing images to the screen. I have seen many source codes for game templates and tutorials with the exact same code without any rendering issues. The only way rendering works consistently is when I draw images with the paintComponent() method of the Canvas class outside of a thread which limits my program functionality and is poor design of a game engine.

I would like an explanation of this and any possible solutions. There is NO accurate way for me to build the game engine without the use of a thread in order to have controlled time-based functionality.

sentences:
AudioClip is empty saving recording from Microphone EDIT: I updated the code to what I have currently. I'm not sure why but, the editor and my platform complained when I put the WWW in a co-routine, it seems to load the audio clips to the object but I cannot play them. In a script attached to the object I wait until the Audio Clip is loaded before I try to play it.

So I am trying to record some Audio through the microphone and then save an AudioClip to the disk as a .wav file and also save the filepath as a playerpref and then later I can come back and load the string into a url but, for some reason the Audio Clip doesn't get loaded properly as I can see that there is an audio clip on my audio source in runtime but, it has no name and it has no sound on it. However, when I press play in the inspector I can hear my sound

I am using SavWav.cs to save my audio clips to .wav files.

Here is the url(filepath) I am sending to my load method:

string filename = string.Format(@"CapturedAudio{0}_n.wav", Time.time);
string filepath = Path.Combine(Application.dataPath, filename);

Here is the method I am using to get the AudioClip:

private void SpawnObject(string savedNames, Vector3 savedPositions, Quaternion savedRotations)
{

        GameObject cubeToSpawn = Instantiate(cube, savedPositions, savedRotations);
        WWW www = new WWW("file:///"+savedNames);
        cubeToSpawn.GetComponent<AudioSource>().clip = www.GetAudioClip(false, false, AudioType.WAV);

}

The obj is just a cube with an AudioSource attached to it that I instantiate prior to calling this method above.

The filepath works fine for saving but, for some reason it doesn't want to load the audio clip. Any help would be greatly appreciated.

sentences:
How to identify performance issues with large numbers of mods? My current problem is with RimWorld, but in the past I had the same issue with Minecraft. Basically the game gets more fun with more mods, up until the point where performance becomes unmanageable. Most mods are open source and I am confident that I could fix many of these performance issues if I could only identify where the hotspots are.

So as a modder, how can I figure out where I should try and help out?

200+ mods, though obviously I would add more if I could.
I don't have access to the core game source code.
I don't have access to a debug version of the core game.
I probably have source code access to a given mod.
I'm looking for ways to help the community, not ways to make the game faster for just me (like adding more memory).

sentences:
Game development: Pre-production stage I´m starting up a new project. It´s going to be a web browser game, developed using HTML5, JavaScript and CSS3.

I have some general questions regarding the process of game developing.

Should you know everything about your game by the time you start writing the first lines of code? I mean should you know all the details, all the things the player can and can not do? Basically: should you be done writing down new ideas before you begin coding?
I understand the pre-production process is about documenting, doing research etc. What does that mean? Does it mean I should open up Word and write down everything about the game? For example what should happen when you click on different things etc.

Thanks for your help!

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:
How do physics bones relate to animation bones? Skinned animations use a tree of bones where the child bone (say a finger) is the weighted sum of the rotations of all it's parent bones. Physics bones are defined as a rotation matrix of a primitive (a cube) that has its position constrained by each of its child bones.

Is there any correlation with how they map to each other?
Can a physics bone be used in-place of an animation bone?

Thanks in advance.

sentences:
Fixed timestep on the server without hogging CPU? It sounds backwards, but it's the situation I'm currently trying to solve on my dedicated server.

Everything I've read about fixed timestep assumed it was on a client, where you're already running in a loop as fast as you can to render the game, and you are just inserting the fixed timestep updates within that.

Problem is, on the server, that's the only thing being done in the loop, aside from checking for network activity. So my server ends up using 100% CPU, looping needlessly while waiting for the next fixed timestep.

The only way I know to fix this is by adding a sleep to the loop, but I know how inaccurate that delay can be, which would throw off the accuracy of the timesteps.

Is there a better way to keep it from burning CPU? Or is sleep what most dedicated servers are doing anyway?

sentences:
Accessing a char array from another class I'm working on a crossword puzzle game. In order to set the letters in my tiles, I have a script attached to text components that accessing a char array that stores my letters. It looks like this:

First class:

  public class GenerateBoard : MonoBehaviour
  {
    public static char[,]gameBoard = new char[15,15];
    void Start()
    {
        gameBoard[0, 0] = 'W';
    }

Second class:

public class SetLetter : MonoBehaviour
{
    Text letter;
    public int x;
    public int y;
    // Start is called before the first frame update
    void Start()
    {
        letter = GetComponent<Text>();
        letter.text = GenerateBoard.gameBoard[x,y] + "";
    }

    // Update is called once per frame
    void Update()
    {
        Debug.Log("glitch: " + GenerateBoard.gameBoard[0, 0]);
    }
}

I would expect Debug.Log to print 'W' but it appears to be empty. Why isn't it accessing the letter 'W' from the first class? When I use Debug.Log in my first class it properly prints 'W'.

sentences:
What is the most efficient container to store dynamic game objects in? I am making a first person shooter and I know about about a lot of different container types but I would like to find the container that is the most efficient for storing dynamic objects that will be added and deleted from the game quite frequently. EX-Bullets.

I think in that case it would be a list so that the memory is not contiguous and there is never any re sizing that is going on.  But then I am also contemplating using a map or set.  If anyone has any helpful information I would appreciate it.

I am writing this in c++ by the way.

Also I came up with a solution that I think will work.

To start off I am going to allocate a vector of a big size.. say 1000 objects.  I am going to keep track of the last added index in this vector so that I know where the end of the objects are.  Then I will also create a queue that will hold the indices of all objects that are "deleted" from the vector. (No actual deleting will be done, I will just know that that slot it free). So if the queue is empty I will add to the last added index in the vector + 1, else I add to the index of the vector that was at the front of the queue.

sentences:
Why do pixel shaders not let us read directly from the framebuffer or the depth buffer? Letting me sample the framebuffer or the depthbuffer in the pixel shader would be an extremely useful feature. Even just being able to know the depth or the color of whatever is behind the current pixel would be useful.

Why does both OpenGL and DirectX not let me do this? I was expecting there to be some kind of hardware limitation, but alpha blending uses the color in the framebuffer for blending calculations, and the Z-test samples the depth buffer at the current location. Why not just expose these values to us directly? Can I hope to see this in the future?

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:
Why are my objects becoming permanently stuck to walls using Box2D? I setup a simple simulation environment something like billiards. There are four circle balls (dynamic) and four box walls (static).

Simulation works... except one thing. Sometimes when a ball rest against a wall, it sticks to the wall eternally. The other balls hits the stuck ball so many times, but the ball never wants to separated with the wall. The only situation where the ball will become unstuck from the wall is another if another ball is rests against the same wall such that it hits the already-stuck ball.

Why does this situation occur? How can I avoid it?

sentences: Random generation of realistic human faces What would be a practicable way of generating huge numbers of realistically looking human faces? Randomizing 3D-models and rendering them would require a lot of computing power, especially as I'm needing them on an ad-hoc basis. Layering individual 2D-drawn parts requires some artistic talent, which I'm definitely lacking. Also, I'd like to parameterize as many aspects of the generational process as possible. Do you have any suggestions how to go about this?

sentences:
Change velocity of CharacterController? I'm trying to change the velocity of a character controller component on a Third Person Controller, but when I try to change it, the console says the velocity is read only. This is my code.

P.GetComponent(CharacterController).velocity = 0;

(P is my player GameObject variable)

So, any ideas on how to change this?

Thanks, Chris.

sentences:
What is the most secure way to archive a GKScore to be re-submitted later? I'm looking for the safest way to archive and store a GKScore that needs to be re-submitted to Game Center (say, because the user didn't have a network connection at the time the score was earned).  I would like to archive the GKScore instance in case the app is terminated before it can be successfully re-submitted to Game Center.

My worry is that if it's archived to an instance of NSData and saved in a .plist, it would be easy to manipulate.  Perhaps this worry is unjustified?

NOTE: I posted a similar question on Stack Overflow only to realize that it's better asked here.

sentences:
libGDX fileHandle cannot readString() I have created a text file called "useraccounts.txt". All I want to do is to read the file using the filehandle class but I always get this exception:

Exception in thread "LWJGL Application" com.badlogic.gdx.utils.GdxRuntimeException: Cannot open a stream to a directory: useraccounts.txt (Local)

Here is my code:

FileHande accountsFile = Gdx.files.local("useraccounts.txt");
String text = accountsFile.readString();

Any explanation is appreciated!

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:
Editing sprite shading to change perspective? I'm currently developing an RPG in Java with some of my friends, and one of my tasks is to do the pixel art. I'm a beginner at it, but I know that I'll get better in time.
I recently finished the concept of our main character (after many, many revisions), however, because the game is going to be in a 3/4 top down perspective; how would I edit the shading of the sprite to show this? Obviously a frontal view will not look right. My shading skills are not the best though, even with this sprite (some parts appear to be flat).

Below I have the sprite attached.

I did read something that said it would be harder to make higher resolution sprites for beginners (tile size is 32 x 32, MC is almost 2 tiles tall); however, it is a difficulty I am willing to deal with.

Thanks,
Nelson

sentences:
using odd number of sprites in multi-row spriteSheet? Using XNA it's pretty easier to loop through a sprite sheet, I tell it how many rows and how many columns it has and I have a method that loops through the whole set.

I usually use this method in my sprite class, but I have a sprite sheet that has a odd number of sprites, and does not use the entire last line.  Any ideas on how to do this?

for example: I have 3 rows of 6 columns, but on the last row I only have 3 sprites.

Thanks!

sentences:
How can I combine multiple bodies into one in Farseer? I want to create a windmill in Farseer, but I don't know how to combine the 3 windmill sails bodies to one body. During gameplay, the sails could get destroyed. For example, if another body hits one of the sails, then this sail will be destroyed, separating the sails. This means the parts should be able to come apart again.

I'll use the following sprites to create the windmill:

The final windmill should look like this:

What method should I use to combine these together, but have them able to separate when destroyed?

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: Why is there a lack of games for Linux? What is wrong with the Linux/*nix family for games? What makes the development of games for this platform too slow compared to Windows or even OS X?

sentences:
SpriteSheet Animation with XNA Hi i'm working on my First 2D Game with XNA and I have a little problem.
To give a running effect to my Sprite, I scroll through a SpriteSheet with this code(running right):

if (AnimationDelay == 6)
{
    if (CurrentFrameR.X < SheetSizeR.X)
    {
        ++CurrentFrameR.X;
    }
    else
    {
        CurrentFrameR.Y++;
        CurrentFrameR.X = 1;
    }

    if (CurrentFrameR.Y >= SheetSizeR.Y)
    {
        CurrentFrameR.X = 0;
        CurrentFrameR.Y = 0;
    }

    AnimationDelay = 0;
}
else
{
    AnimationDelay += 1;
}

xPosition += xDeplacement;

And these are the objects used :

Point FrameSizeR = new Point(29, 33);
Point SheetSizeR = new Point(5, 1);
Point CurrentFrameR = new Point(0, 0);
int AnimationDelay = 0;

I have the same Code with different SpriteSheet when the sprite is running Left.
Everything is working fine I'd say 90% of the time but the other 10% the sprite animation stays on one Frame of the SpriteSheet, on both directions(left and right) and it stays stuck until I close the program.
The thing is I can't quite figure out why since it never happens at the same moment..Sometimes after 10,15,30 seconds and sometimes even on boot!
Any idea why?
Thanks in advance and let me know if you need any other parts of the code

sentences:
How to initialize OpenGL context with PyGame instead of GLUT I'm trying to start with OpenGL, using Python and PyGame.

I'm going to use PyGame instead of GLUT to do all the initializing, windows opening, input handling, etc.

However, my shaders are failing to compile, unless I specify exactly the version of OpenGL and profile.

They do compile with GLUT initialization from the book:

glutInit()
glutInitDisplayMode(GLUT_RGBA)
glutInitWindowSize(400, 400)

# this is what I need
glutInitContextVersion(3, 3)
glutInitContextProfile(GLUT_CORE_PROFILE)

glutCreateWindow("main")

But, with simple PyGame initialization like this:

pygame.init()
display = (400, 400)
pygame.display.set_mode(display, pygame.DOUBLEBUF|pygame.OPENGL)

which doesn't specify exact OpenGL version 3.3 and CORE_PROFILE,
the same program would fail when trying to compile shaders:

  RuntimeError: ('Shader compile failure (0): 0:2(10): error: GLSL 3.30
  is not supported. Supported versions are: 1.10, 1.20, 1.30, 1.00 ES,
  and 3.00 ES\n', ['\n    #version 330 core\n    layout(location = 0) in
  vec4 position;\n    void main()\n    {\n        gl_Position =
  position;\n    }\n    '], GL_VERTEX_SHADER)

My question is: how do I do this initialization with PyGame?

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:
Destroying instantiated objects stored in a list not working in Unity I have a GameObject with associated a javascript. I have defined a private variable like this:

    private var objects = new Array();

now in the Update method I instantiate new objects and push each obtained reference into the private array like this

    objects.push(newObjectInstance);

when a certain event occurs (i.e. the user press a button in the GUI) I'd like all the objects to be destroyed. I am doing that like this

    for (var i =0 ;i<objects.length; i++){
        Destory(objects[i]);
    }
    objects.clear();

The problem is that although the objects are removed from the array they remain displayed in the Game. What am I doing wrong?

sentences:
Scene2D set table cell size in percentage of tables ´s size Is it somehow possible to set Scene2D table cell´s size in percentage of the table?

I would like to have orientation independent menu, with buttons filling let´s say 75% percent of the screen, and also to respond on window resizing (desktop version). I have tried several methods, for example using Value

table.add(button).width(Value.percentWidth(.75F));

but when value.get(actor) is called inside cell, it is supplied with inner button actor not its container (table).

I have also tried to set it in fixed fashion

table.add(button).width(Value.percentWidth(.75F).get(table));

This works fine, but since I set pixel value insted of Value object it is not recalculated upon resizing.

Is there any way to achieve this?

sentences:
What do you use to create sprite graphics? Possible Duplicate:
  What tools do you use for 2D art/sprite creation?

What do you folks suggest for creating sprite graphics and sprite sheets?

I fiddle with pixelformer and tilestudio.

Pixelfromer has a kicken interface, it is quick and easy to make graphics, but a bit cumbersom if you want to make a spritemap.
Tile Studio is a interesting mix or tiles and maps, but it is a bit buggy and basic.

The Adobe series, just don't really seem to handle tiny graphics well.

(there is a previous posting of this question existing,  but it is a year old and I was hoping for further/updated input from the community)

sentences:
Need help understanding ms to fps for a Unity animation I'm trying to create an animation in Unity (2018.1.1f1) and can't understand how to proceed.

I have a 3 sprites which I need to order like so : 1 2 3 2 (then repeat).
The first and third sprites should have a 640ms delay and the second sprite should be 80ms.

In the animation window, I don't understand how to translate that into fps on the animation timeline.

What sample should I choose and where I need to put each sprites on the timeline to get the 640 and 80ms specified?

sentences:
Unity - Transforming horizontal distance between two spriteRenderers to set UnityEngine.UI.Button width to this distance In my Unity scene, I have a couple of spriteRenderers and a UnityEngine.UI.Button called thisButton. The spriteRenderers are spread horizontally across my scene. I want to change the button width to span from the leftmost spriteRenderer to the rightmost spriteRenderer.
To do this, I have subtracted the x-Coordinate of the rightmost spriteRenderer (fRightEndingPosition) from the x-Coordinate of the leftmost spriteRenderer (fLeftStartingPosition).
float fLeftStartingPosition = leftmostSpriteRenderer.transform.position.x;
float fRightEndingPosition = rightmostSpriteRenderer.transform.position.x;
float fButtonTargetWidth = fRightEndingPosition - fLeftStartingPosition;

Then, I try to set the width of thisButton to the value of fButtonTargetWidth by doing
RectTransform buttonSize = thisButton.GetComponent<RectTransform>();
buttonSize.SetSizeWithCurrentAnchors(RectTransform.Axis.Horizontal, fButtonTargetWidth);

However, when I try to use this as the width of my button, the result is not correct. I am pretty sure this has something to do with different types of coordinates being used for the spriteRenderers and the button (world, screen, viewport, etc.), but I haven't been able to figure this out on my own.
In one specific example fLeftStartingPosition is -1.1, and fRightEndingPosition is 1.1. In my scene, a button that spans this distance has a width of roundabout 40 on its RectTransform. So clearly, setting the width of this RectTransform (buttonSize) to fButtonTargetWidth (2.2) in code results in a button that is way to narrow. In fact, after setting it's width to 2.2, it is not visible at all.
How do I transform this distance of 2.2 to the desired width of roundabout 40, in a way that this distance would be transformed correctly, no matter what the actual value of fButtonTargetWidth is?

sentences:
How do I get my mouse-based input system to work on Android? I am developing the ball breaker game in unity and right now my game work with mouse click button. but i want my game work in android. so what changes i want to do in this code? So when i set the arrow and its jump ball and hit the brick.
Here is the code with image :-

BallController.cs

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

public class BallController : MonoBehaviour {

    public enum ballState {
        aim,
        fire,
        wait,
        endShot
    }

    public ballState currentBallState;

    public Rigidbody2D ball;
    private Vector2 mouseStartPosition;
    private Vector2 mouseEndPosition;
    private float ballVelocityX;
    private float ballVelocityY;
    public float constantSpeed;
    public GameObject arrow;

    // Use this for initialization
    void Start () {
        currentBallState = ballState.aim;

    }

    // Update is called once per frame
    void Update () {
        switch (currentBallState) {
        case ballState.aim:
            if (Input.GetMouseButtonDown (0)) {
                MouseClicked ();
            }
            if (Input.GetMouseButton (0)) {
                MouseDragged ();

            }
            if (Input.GetMouseButtonUp (0)) {
                ReleaseMouse ();
            }
             break;

        case ballState.fire:

            break;

        case ballState.wait:

            break;

        case ballState.endShot:

            break;
        default:
            break;

        }

    }

    public void MouseClicked(){
        mouseStartPosition = Camera.main.ScreenToWorldPoint(Input.mousePosition);
        Debug.Log (mouseStartPosition);
        //didClick = true;
    }

    public void MouseDragged(){
    //  didDrag = true;
        //Move the Arrow
        arrow.SetActive(true);
        Vector2 tempMousePosition = Camera.main.ScreenToWorldPoint(Input.mousePosition);
        float diffX = mouseStartPosition.x - tempMousePosition.x;
        float diffY = mouseStartPosition.y - tempMousePosition.y;
        if (diffY <= 0) {
            diffY = .01f;

        }
        float theta = Mathf.Rad2Deg * Mathf.Atan (diffX / diffY);
        arrow.transform.rotation = Quaternion.Euler (0f, 0f, -theta);
    }
    public void ReleaseMouse(){
        arrow.SetActive (false);
        mouseEndPosition = Camera.main.ScreenToWorldPoint(Input.mousePosition);
        ballVelocityX = (mouseStartPosition.x - mouseEndPosition.x);
        ballVelocityY = (mouseStartPosition.y - mouseEndPosition.y);
        Vector2 tempVelocity = new Vector2 (ballVelocityX, ballVelocityY).normalized;
        ball.velocity = constantSpeed * tempVelocity;
        if (ball.velocity == Vector2.zero) {
            return;
        }
        currentBallState = ballState.fire;

    }

}

sentences:
How should I proceed next with my programming skills? I am currently studying at University of technology in Brno (Czech Republic). This semester is almost over and I might say I have some knowledge of C. Since I went to this school just for the purpose to become a game programmer I would like to start programming a game asap.

My school project are almost done so I have been thinking about writing something already (story driven game running in terminal ^^). But this won't satisfy me.

My question is how should I proceed next? I did my homework and went trough similar questions but I didn't get the answer. I hope this question won't be closed. People are usually mentioning C++, C#, OpenGL and others and I simply don't know which one to choose.

I am currently interested only in 2D games and that won't change for some time. I don't want my game to run on a mobile device yet and I want to make games for PC and Mac, not for consoles obviously. Which language does fit my needs the best?

sentences:
How to change a variable in the spawnpoint from another prefab I refer the website for proper way of referencing the script How to call a public function from another script in Unity? but it does not work, still return a nullreference exception in the example below. Not sure how to fix it.Apart from that I also consider using
 int a;
public int A
{ get; set; }

and in HPscript using spawnpoint.A = spawnpoint.A - 1;
but it come out the content is for read only.
Below is the codes I using.
I attach this code to a capsule gameobject that is use to spawn prefab gameobject,drag and drop prefab to  the enemy GameObject inspector window, this part working correctly.
using System;
using UnityEngine;

public class Spawnpoint: MonoBehaviour
{ public GameObject Enemy;

  public int a;
  int currentstate = 0;
  int previousstate = 0;

   void Counting()
{//the below if statement is to ensure the Gameobject only spawn once when condition become true
 //in every 10seconds
    var d = DateTime.Now.Second % 10;
    if(d==0)
    {
        currentstate = 1;

    }
    else
    {
        currentstate = 0;
    }
}

void Spawn()
{//Stop spawning when Gameobject equal 5

    if (d==0&&currentstate!=previousstate)
        if(a<5)
    {
        Instantiate(Enemy, new Vector3(UnityEngine.Random.Range(0, 4), 1, UnityEngine.Random.Range(0, 4)),Quaternion.identity);
        a = a+1;
    }
}

 void Update()
{
    Counting();
    Spawn();
    previousstate = currentstate;
}

}
The script below is not working. I want the HPscript to deduct the value "a",in Spawnpoint script so the script will continue spawn enemy when number less than 5.This script is attached to the prefab gameobject that is place in asset folder.
 using System;
 using UnityEngine;

public class HPScript : MonoBehaviour
{ Spawnpoint spawnpoint;

void Start()
{
    spawnpoint = GetComponent<Spawnpoint>();
}
public void counting()
{

    var c = DateTime.Now.Second % 30;
    if(c==0)

    {

        spawnpoint.a = spawnpoint.a - 1;

        Destroy(gameObject); }
}

void Update()
{
    counting();

}

}

sentences:
Architectural approaches to creating a game menu/shell overlay on PC/Linux? I'm am working on a collection of games for a custom digital tabletop installation (similar to Microsoft Surface tables). Each game will be an individual executable that runs full-screen. In addition, there needs to be a menu/shell overlay program running simultaneously. The menu/shell will allow users to pause games, switch to other games, check their game history, etc.

Some key requirements of the shell:

it intercepts all user input (mainly multitouch) first before passing it on to the currently running game (so that it can, for instance, know to pop-up at a "pause" command);
can reveal on arbitrary portions of the screen, with the currently running (but presumably paused) game still showing underneath, ideally with its shape/size being dynamic, to allow for creation of an animated in/out drawer effect over the game.

I'm currently looking into different architectural approaches to this problem, including Fraps and DirectX overlays, but I'm sure I'm missing some ways to think about this. What are the main approaches I should be considering?

(Note the table is currently being run by Windows PC, but it could potentially be a Linux box instead. By this I don't mean I need an OS-agnostic solution. I'd be happy with a Windows-specific solution. But I would be willing to consider switching to Linux and using a Linux-specific solution if it's much easier to achieve this in Linux.)

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:
Tagging "regions" in rot.js map generator I'm working on a small roguelike and I'd like to be able to tag the various "regions" generated via the Map generators so that I can use it as a lookup to environment descriptions.  I see that there are "Rooms" that are generated in the dungeon generator algorithms, however I didn't really see anything similar in say, the cellular automata generator.  Is there a way to leverage the generator in rot.js, or am I stuck with manually determining if I'm in a particular open area (and breaking encapsulation of internal, private variables along the way)?
Basically, I'd like to be able to link up my player's location to the text you see at the bottom of , but can't seem to figure out how to do it generically.  I'm fairly certain I could use the 'Rooms' object in the first 2 screenshots, and everything else is a hallway, but I'm not clear on how I could get a particular 'region' in a cellular automata generator (or one of the maze generators, for instance).

sentences:
Issue with rotating particle effects with DrawUserPrimitves I am creating a voxel-like game in XNA/Monogame. I am trying to create particle effect of which I create by making a list that is populated every frame. My issue is here: I am using a WorldMatrix to help rotate the particles, but I don't see how I can rotate them with a translating because each particle is different. Here is an example:

partEffect.CurrentTechnique = partEffect.Techniques[0];
        partEffect.Parameters["View"].SetValue(camera.viewMatrix);
        partEffect.Parameters["Projection"].SetValue(camera.projectionMatrix);
        Vector3 rotAxis = new Vector3(1,0,0);
        Vector3 rotAxis1 = new Vector3(0, 1, 0);

        rotAxis.Normalize();
        Matrix worldMatrix = Matrix.CreateTranslation(-20.0f / 3.0f, -10.0f / 3.0f, 0);// *Matrix.CreateFromAxisAngle(rotAxis1, camera.HORIZONTAL) * Matrix.CreateFromAxisAngle(rotAxis, camera.VERTICAL);// *Matrix.CreateFromAxisAngle(rotAxis1, camera.HORIZONTAL);//RotateToFace(vertices[0].Position, camera.Position, new Vector3(0, 1, 0));//Matrix.CreateBillboard(vertices[0].Position, camera.Position, new Vector3(0, 1, 0), new Vector3(0,0,0));//Matrix.CreateFromAxisAngle(rotAxis, angle);//Matrix.CreateTranslation(-20.0f / 3.0f, -10.0f / 3.0f, 0) * Matrix.CreateFromAxisAngle(rotAxis, angle);
        partEffect.Parameters["World"].SetValue(worldMatrix);

The next code that I call after that is the actual draw code, but my problem is here: How do I modify that translation when it seems to be static while each particle is different? Here is my draw effect:

foreach (EffectPass pass in partEffect.CurrentTechnique.Passes)
{
pass.Apply();
     GraphicsDevice.DrawUserPrimitives(PrimitiveType.TriangleList, vertices, 0, 1, VertexPositionColor.VertexDeclaration);
}

So as you can see, the Matrix.CreateTranslation is called before I run my actual draw code. I just don't see how I can modify that translation so it works for every particle instead of just the translation for the single particle. Any insight would be greatly appreciated.

sentences:
DirectX11 Using Multiple Shaders I currently have a scenario where I am rendering terrain with a shadow map.  I have two passes, one for the depth buffer to create the shadow map (which is rendered to a texture) and a second that takes the shadow map texture as input and actually shadows the terrain, the terrain gets drawn once for each pass.  Within the second shader I also texture the terrain.

I now want to split the second shader so that shadows and texturing are separate shaders.  How do I go about getting the output from the shadow shader to the texture shader (or vice versa), or do I simply do it in the same way as I have with the shadows (rendering to a texture, passing it as an input).

sentences: Do I need Microsoft authorization to support Xbox 360 controllers for a pc game? Do I need to pay Microsoft, or do I need some kind of license so I can support the xbox controller on a pc game? Or I just implement it and let people use their Xbox 360 controllers?

sentences:
Unity, tell matched players to go pick characters (Matchmaking) I need to tell all the players in the match to go to some method that'd take them to character pick. The thing is that the pick happens inside the menu scene after the level get's preloaded (ascyncroneously). So the players stay in the same menu scene but they have to pick characters before the time runs out and the level itself starts.
Is it possible to do that in multiplayer using the matchmaker?
How can it be done if so?

Thanks in advance!

sentences:
World War Game units and resources mechanics I'm currently building a world war game with a timeline between the first world war up to current days. In the game there will be many fighting units with a diversified range of classes and sub-classes. Also there will be around 5 to 6 resources where the player will have to manage because every equipment will have a different trend on cost. Some examples that I have in mind for resources:

Money (Main resource. Used to build buildings and fund researches);
Manpower (Used mainly to make disposable infantry units);
Steel (Used everywhere in fighting units. Used a lot in armored units);
Oil (The heavier, the costlier);
Rare Materials (Used in... I'm not really sure where);
Electronics (Used in modern units);

Here are some examples of fighting units:

Early Anti-Tank Gun

Class: Anti-Tank
Sub-class: Stationary

Self-propelled artillery

Class: Artillery
Sub-class: Self-propelled

Motorized Rocket artillery

Class: Rocket Artillery
Sub-class: Motorized

Machine Gun

Class: Infantry
Sub-class: Machine Gun

And I'm currently facing two problems:

There will be many fighting units and as time passes the player will have to retire some of its older equipment. And the problem is that warfare and the purpose for each war equipment changes through time, so: how do I classify all these fighting units from a very broad timeline?
Also I'm trying to make the player have a very balanced army. If he decides to go full on planes he will soon lack some resource that is crucial to building planes. Or if he spams cheap infantry he will run out of manpower, so: How do I balance the player resources? Which ones should I use? (This can also be manipulated so that in the future I can have a world map where the player plays as a certain country that has a higher production of a given resource in a way that he can play/is forced to play with a certain army configuration)

I'm currently making this system of units and resources to later have many playing modes like world conquest, survive waves of incoming enemy units, missions with rewards, and many others.

Two sources I'm currently using: Wikipedia (for information on technologies used during a given time and trying to make a classification system) and Hearts of Iron 4 (the resources system). My game will be played on the browser (until I change my mind), so It can't be very calculation-intensive such as HoI4. Current prototype is in pure JavaScript that simulates a very simple the battle.

This is my very first game that is more than a couple of source files long and that will probably require a lot more thinking than coding at first.
I'm currently very lost. I feel like if I go head-on making the game and the user interface I will eventually hit a wall because "I haven't thought enough" about how the game mechanics.

Edit:

The battle mechanics is almost done. If needed, I can describe it how it is, but think of it as a very simple one, like machine guns and artillery are good against infantry, anti-tank... well..., planes are good against bombers, CAS against land units and so on. Also there will be ships and submarines...

sentences:
Texturing Custom Meshes/Terrain? Here's the scenario:

I procedurally generate terrain on the fly, creating an isosurface which is an overlay on top of a scalar field of data points. These underlying data points are basically voxel data, and I use the Marching Cubes algorithm to interpolate vertices, which are used to create the triangles for the meshes.

What I end up with is a contiguous terrain, which is split into chunks, with each chunk split into "blocks". Each block's outline, when looking from directly above, is a square, made up of up to 5 triangles.

The underlying mesh data (vertices, indices, texture coords, normals), are calculated for each "block", and then a mesh is built for each "chunk" (collection of blocks' data). Texture coords are determined for each triangle, and as such, you can see separate texture mappings for each triangle when looking at the textured mesh.

At a minimum, I would like to figure out how to apply the textures to each block as a whole, i.e.- stretch it over all the triangles in a block.

Better yet, I would like to implement something like texture-splatting on arbitrary regions of the terrain, spanning accross chunk and block boundaries, so that I can arbitrarily paint different textures where every I want them.

Ideally, I would like to do the splatting I mentioned procedurally, so that aspects of the terrain, (altitude, proximity), will determine what texture is used in what location.

Can someone clue me in to what is involved in achieving this?
I am using Ardor3D (Java) for mesh creation/texturing/etc...

sentences:
Rotating a group of sprites - How to calculate origin I am rotating a group of sprites in XNA, which I developed with the help of the following example:  http://msdn.microsoft.com/en-us/library/bb194912%28v=xnagamestudio.10%29.aspx

It all works very well, however, the rotations rely on a point of origin, which it will rotate around.  The problem is that I do not know how to calculate the point of origin, so that it is exactly in the center of the sprite group.

I am able to set the point of origin to where I want it, but as soon as the sprite group changes, the origin is typically off, and it doesn't rotate from the center of the group.

My main question, is there a way to calculate the center of a group of sprites?  My original idea was to calc the boundaries (left, right, top, bottom), and place the origin the the center, but this doesn't work properly.

sentences:
Raycast algorithm fails to collide with diagonal walls in specific locations I'm having a problem with my ray-cast algorithm in a 2D tile-based universe. I feel the situation would be best explained with a picture, so here it is:

The ray, represented by the blue line, is passing "through" the wall to hit its target when the wall passes through a point where the quantized line moves diagonally and the wall is perpendicular to it. The raycast function is as such:

def raycast(pos, direction, level):
    dx, dy = direction
    t=0
    x, y = pos
    obj=None
    while not obj and t < 5000:
        t+=1
        x+=dx
        y+=dy
        obj=level.get_at((round(x),round(y)),True)
        pass
    return obj

Is there a simple, efficient way to eliminate this kind of edge case?

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

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

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

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

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

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

sentences:
Detecting long held keys on keyboard I just want to ask if can I check for "KEY"(keyboard) that is HOLD/PRESSED for a long time, because I am to create a clone of breakout with air hockey for 2 different human players.
    Here's the list of my concern:

Do I need other/ 3rd party library for KEY HOLDS?
Is multi-threading needed? I don't know anything about this multi-threading stuff and
I don't think about using one(I'm just a NEWBIE).
One more thing, what if the two players pressed their respective key at the same time,
how can I program to avoid error or worse one player's key is prioritized first before
the the key of the other.
example:

Player 1 = W for UP & S for DOWN
Player 2 = O for UP & L for DOWN

(example: W & L is pressed at the same time)

PS: I use GLUT for the visuals of the game.

sentences:
How could I constrain player movement to the surface of a 3D object using Unity? I'm trying to create an effect similar to that of Mario Galaxy or Geometry Wars 3 where as the player walks around the "planet" gravity seems to adjust and they don't fall off the edge of the object as they would if the gravity was fixed in a single direction.

(source: gameskinny.com)

I managed to implement something close to what I'm looking for using an approach where the object that should have the gravity attracts other rigid bodies towards it, but by using the built in physics engine for Unity, applying movement with AddForce and the likes, I just couldn't get the movement to feel right. I couldn't get the player to move fast enough without the player starting to fly off the surface of the object and I couldn't find a good balance of applied force and gravity to accommodate for this. My current implementation is an adaptation of what was found here

I feel like the solution would probably still use physics to get the player grounded onto the object if they were to leave the surface, but once the player has been grounded there would be a way to snap the player to the surface and turn off physics and control the player through other means but I'm really not sure.

What kind of approach should I take to snap the player to the surface of objects? Note that the solution should work in 3D space (as opposed to 2D) and should be able to be implemented using the free version of Unity.

sentences:
Mobile Multiplayer games and coping with high latency I'm currently researching regarding a design for an online (realtime) mobile multiplayer game.

As such, i'm taking into consideration that latencies (lag) is going to be high (perhaps higher than PC/consoles).

I'd like to know if there are ways to overcome this or minimize the issues of high latency?

The model i'll be using is peer-to-peer (using Photon cloud to broadcast messages to all other players).

How do i deal with a scenario where a message about a local object's state at time t will only get to other players at *t + HUGE_LAG* ?

sentences:
When I add in Java transformationMatrix I can't see images? When I add in Java transformationMatrix I can't see images moving but when I remove it I can see why and how to fix it? Any ideas how to fix it?

My Renderer class:

public class Renderer {

    private static final float FOV = 70;
    private static final float NEAR_PLANE = 0.1f;
    private static final float FAR_PLANE = 1000;

    private Matrix4f projectionMatrix;

    public Renderer(StaticShader shader){
        createProjectionMatrix();
        shader.start();
        shader.loadProjectionMatrix(projectionMatrix);
        shader.stop();
    }

    public void prepare(){
        GL11.glClear(GL11.GL_COLOR_BUFFER_BIT);
        GL11.glClearColor(1, 0, 0, 1);
    }

    public void render(Entity entity,StaticShader shader){
        TexturedModel model = entity.getModel();
        RawModel rawModel = model.getRawModel();
        GL30.glBindVertexArray(rawModel.getVaoID());
        GL20.glEnableVertexAttribArray(0);
        GL20.glEnableVertexAttribArray(1);
        Matrix4f transformationMatrix = Maths.createTransformationMatrix(entity.getPosition(), entity.getRotX(), entity.getRotY(), entity.getRotZ(), entity.getScale());
        shader.loadTransformationMatrix(transformationMatrix);
        GL13.glActiveTexture(GL13.GL_TEXTURE0);
        GL11.glBindTexture(GL11.GL_TEXTURE_2D, model.getTexture().getID());
        GL11.glDrawElements(GL11.GL_TRIANGLES, rawModel.getVertexCount(), GL11.GL_UNSIGNED_INT, 0);
        GL20.glDisableVertexAttribArray(0);
        GL20.glDisableVertexAttribArray(1);
        GL30.glBindVertexArray(0);
    }

    private void createProjectionMatrix(){
        float aspectRatio = (float) Display.getWidth() / (float) Display.getHeight();
        float y_scale = (float) ((1f / Math.tan(Math.toRadians(FOV / 2f))) * aspectRatio);
        float x_scale = y_scale / aspectRatio;
        float frustum_length = FAR_PLANE - NEAR_PLANE;

        projectionMatrix = new Matrix4f();
        projectionMatrix.m00 = x_scale;
        projectionMatrix.m11 = y_scale;
        projectionMatrix.m22 = -((FAR_PLANE + NEAR_PLANE) / frustum_length);
        projectionMatrix.m23 = -1;
        projectionMatrix.m32 = -((2 * NEAR_PLANE * FAR_PLANE) / frustum_length);
        projectionMatrix.m33 = 0;
    }
}

Edit added StaticShader class:

package shader;

import org.lwjgl.util.vector.Matrix4f;

public class StaticShader extends ShaderProgram{

private static final String VERTEX_FILE = "src/shader/vertexShader.txt";
private static final String FRAGMENT_FILE = "src/shader/fragmentShader.txt";

private int location_transformationMatrix;
private int location_projectionMatrix;

public StaticShader() {
    super(VERTEX_FILE, FRAGMENT_FILE);
}

@Override
protected void bindAttributes() {
    super.bindAttribute(0, "position");
    super.bindAttribute(1, "textureCoords");
}

@Override
protected void getAllUniformLocations() {
    location_transformationMatrix = super.getUniformLocation("transformationMatrix");
    location_projectionMatrix = super.getUniformLocation("projectionMatrix");
}

public void loadTransformationMatrix(Matrix4f matrix){
    super.loadMatrix(location_transformationMatrix, matrix);
}

public void loadProjectionMatrix(Matrix4f projection){
    super.loadMatrix(location_projectionMatrix, projection);
}
}

Edit vertexShader.txt

#version 400 core

in vec3 position;
in vec2 textureCoords;

out vec3 colour;
out vec2 pass_textureCoords;

uniform mat4 transformationMatrix;
uniform mat4 projectionMatrix;

void main(void){

gl_Position = projectionMatrix * transformationMatrix * vec4(position,1.0);
pass_textureCoords = textureCoords;
colour = vec3(position.x+0.5,0.0,position.y+0.5);

}

sentences:
Performance problems with scrolling html5 canvas for large tile-based game I try programming a splix.io clone as an electron app and do the visualization via the html5 canvas. The movement across the tiles should look fluent like the original, so I target 60 frames a second. The programm worked fine till I tried to replace the tiles created through fillRectangle() with svg images using drawImage(). This resulted in a huge performance drop, which I now try to fix. To mention here is that, like splix.io, I have a quite large playfield with a targeted size of 500x500 tiles and a fullscreen viewport, so basically the canvas has to draw the whole screen each frame.

Known performance improvements, that I implemented are:

Separating the logic calculations and "rendering" into their own
windows, separated from the main process.
Only drawing the area visible to the player
Foreach tileType hold a offscreen canvas, so that I can copy the
ImageData to the onscreen canvas.
Draw tiles and the players on separate canvases.

A drawing loop with requestAnimationFrame() instead of setTimeout() seemed to be impractical because the ultimate goal is to let AIs, which will run in their own child-process, play against each other. Therefore I can't rely on requestAnimationFrame which throttles performance when the window loses focus or is minimzed.

What further performance improvements can you recommend? Is the scale of my game maybe too large for the canvas and would a switch to OpenFL / WebGL may be the better solution?

sentences:
How portable are OpenGL versions, really? If I write a game engine that uses OpenGL 1.5 (not assuming what else I do), is it portable now and is it still portable five years from now or are/will support for OpenGL by hardware and drivers (be) exclusive to their (much more farther along) target OpenGL versions?

Lately I've been looking at a lot of answers on this website that direct users to divert their work towards the most recent OpenGL versions, citing hardware surveys of DirectX support and only recommending earlier versions as a last, final resort (as if to imply there is something wrong with them that makes all usage of them invalid or pointless).

If I only have computers that can provide OpenGL <=1.5 or <=2.1 contexts should I just give up game programming if I can't afford a new computer with hardware and drivers for 3.x and 4.x?  Or should I finish my game engine the way I intended to?

Will by the time I get a 4.x supporting setup will there be new versions and a lack of backwards compatibility that trash all usage of 4.x?  Will 4.x ever dominate over earlier versions support wise before a new major version is realized and released?

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:
Fixed timestep, updates per second keeps changing? I've been trying to create a deterministic, fixed gameloop.
The game loop should run TICK_RATE # of physics updates per second, and then render as quickly as possible (didn't do interpolation yet).
The issue I'm currently having is that the # of physics updates per second isn't constant. I want it to be the same as TICK_RATE, but it constantly changes by 1.
E.g. the tick-rate varies from 60-61 if TICKRATE = 60.
I thought this issue might be due to rounding issues, but manually calculating the delta time with System.nanoTime() and storing everything as a double gives me the same problem. If the physics simulation constantly varies by 1 frame per second, it's not longer deterministic, which I think would be hard to replicate (for networking and replays for example).
Any ideas on how to fix this so the number of physics updates per second is constant?
import com.badlogic.gdx.ApplicationAdapter
import com.badlogic.gdx.Gdx

private const val TICK_RATE = 60 //Number of updates per second
private const val TIME_STEP = 1f / TICK_RATE //Seconds per tick
private const val MAX_FRAME_SKIP = (TICK_RATE * .2).toInt() //If fps drops below 20% of tickrate, slow down game to
                                                            //avoid spiral of death

class FixedTimestep : ApplicationAdapter() {

    private var accumulator = 0f

    //variables for ticks per second tracking
    private var tps = 0
    private var previousNanoTime = System.nanoTime()

    override fun render() {
        var frameSkipCount = 0
        val delta = Gdx.graphics.rawDeltaTime
        accumulator += delta
        while (accumulator > TIME_STEP && frameSkipCount < MAX_FRAME_SKIP) {
            accumulator -= TIME_STEP
            //do physics step

            //display tps to console every second
            tps++
            val currentNanoTime = System.nanoTime()
            if (currentNanoTime - previousNanoTime >= 1000000000L) {
                println(tps)
                tps = 0
                previousNanoTime = currentNanoTime
            }
        }
        //render
    }
}

sentences:
How should I efficiently clear and redraw my canvas with lots of animated sprites? My current solution is to clear the entire canvas and redraw all sprites on every requestFrame().  This works but feels inefficient:

I only need to clear the part of the canvas made invalid by animations.
I only need to redraw objects that intersect the invalid part of the canvas.

I can track invalidated sections, and during requestFrame() I can find out which objects intersect an invalid section and redraw only them, but I'm not sure if that's an improvement or a step back.  If I have 100 sprites and 10 of them are moving, that means I need to do 10 searches through all 100 sprites.  Tall order for every request frame.

I can also put every sprite on its own canvas and remove sprite interaction from the equation, but I haven't been able to find insight into how many canvases is too many.

This seems like a problem that's been solved already, but I haven't found any resources on the topic.

sentences:
Textured trapezoid in Monogame DirectX I'm working on a 2D game, so most of the graphics are sprites. However, some elements are drawn using trianglestrips in Orthographic projection. The thing is that I can't do a 3D projection because the coordinates of the vertices have to line up with some of the sprites in the game.

I'm running into a problem trying to texture these triangles.
I understand how the texturing works, so I understand that the interpolation causes the effect:

For now I have no idea where to start. I Googled and looked for similar questions, but all seem to deal with fixing this in OpenGL. like this one I have no clue how to apply it to Monogame/DirectX. I also don't know how to start with a shader, as I don't really grasp how to interpolate across two triangles.

If it makes the issue easier, I don't care for accurate perspective, just that the texture is correctly stretched over the two triangles.

So far I have only used a BasicEffect like this:

        checkered = Content.Load<Texture2D>("checkered");

        basicEffect = new BasicEffect(GraphicsDevice);
        basicEffect.VertexColorEnabled = true;
        basicEffect.TextureEnabled = true;
        basicEffect.Texture = checkered;
        basicEffect.Projection = Matrix.CreateOrthographicOffCenter
        (0, GraphicsDevice.Viewport.Width,     // left, right
        GraphicsDevice.Viewport.Height, 0,    // bottom, top
        0, 1);

The draw function is like this (nothing special):

        GraphicsDevice.Clear(Color.Green);

        basicEffect.CurrentTechnique.Passes[0].Apply();

        VertexPositionColorTexture[] vertices = new VertexPositionColorTexture[4];

        vertices[0].Position = new Vector3(100,50, 0);
        vertices[1].Position = new Vector3(200, 50, 0);
        vertices[2].Position = new Vector3(50,200, 0);
        vertices[3].Position = new Vector3(250, 200, 0);

        Color color = Color.White;
        vertices[0].Color = color;
        vertices[1].Color = color;
        vertices[2].Color = color;
        vertices[3].Color = color;

        vertices[0].TextureCoordinate = new Vector2(1, 0);
        vertices[1].TextureCoordinate = new Vector2(0, 0);
        vertices[2].TextureCoordinate = new Vector2(1, 1);
        vertices[3].TextureCoordinate = new Vector2(0, 1);

        GraphicsDevice.DrawUserPrimitives<VertexPositionColorTexture>(PrimitiveType.TriangleStrip, vertices, 0, 2);

sentences:
Unity - Convert Camera Gyroscope Attitude to World Space Canvas rotation Suppose you have a worldspace canvas parallel to a camera that is rotated by the gyroscope.
How do you convert from the camera's gyroscope attitude to get the world space canvas rotation?

sentences:
3dsmax crashes when exporting I'm trying to export a (.max) file to openCOLLADA (.dae). Whenever I do this, 3dsmax crashes and produces this error:

  An error has occurred and the application will now close.
      No scene changes have occurred since your last save.

3dsmax then crashes but the COLLADA file is still produced. Whenever I try opening this COLLADA file in other software though, it comes up with a bad mesh data error. This is leading me to think that it wasn't exported correctly out of 3dsmax. Any advice?

sentences:
Good approach in designing game classes I took a semester-long course in java but I'm still a beginner in Object-Oriented programming paradigm. Suppose that I want to create a simple game where the player can go to different locations. Each location has its own unique treasure (that has other attributes) and has its own set of different animals. The question: How can I design classes that are not too naive based on the game? (can be too broad) Is my approach below correct or can it be improved? (narrowed)

I was thinking that I should create a Location, treasure, and Animal classes; Each classes declared in its own file.

public class Location {
    // attributes such as treasure and animals
    private ArrayList<Animal> animals;
    private Treasure treasure;
    public Location(String name) {
        // initialization of attributes
        if(name.equals("Jungle")) {
            treasure = new Treasure("Rare Vine");
            animals.add(new Animal("Monkey", 90, 50);
            animals.add(new Animal("Snake", 100, 60);
        }
        else if(name.equals("Valley")){
            // and so on
        }
        // and so forth
    }
}
public class Treasure {
    // attributes such as name and value
    public Treasure(String name, int value) {
        // initialization of attributes
        this.name = name;
        this.value = value;
    }
}
public class Animal {
    // attributes such as name
    public Animal(String name, int encounterRate, int captureRate) {
        // initialization of attributes
        this.name = name;
        this.encounterRate = encounterRate;
        this.captureRate = captureRate;
    }
}

But I doubt that the use of conditional statements in Location class to initialize its attributes makes the method have so many lines and may confuse the developer after some time. what if there are so many attributes per location and there are many locations?

Another approach that I can think of is to create subclasses of Location and put the corresponding values for the location's attributes. For me, I can understand the structure of the game and efficient if the number of location subclasses is small.

I'm new in creating java games so I don't have a solid view in designing game classes. this problem may be broad so I narrowed it down to my code above.

sentences:
Unity3d iOS build - where are the textures? First time building and running my Unity3D app on my iPhone and it appears that all the textures are missing.  Everything is just a solid block of whatever color I made it.  When running in Unity I see everything correctly.  See images below.

To complicate things I'm using custom shaders, and all the objects are custom procedural meshes.  Quads that I build in script.  If I switch the paper backplate shader to a built in shader I still only see white on the iPhone.

So I suspect that somehow the textures just aren't making it to the iOS project.  When I look in the iOS project I can't find any textures.  Where would they be in the iOS project?  For example in Xcode under Build Phases > Copy Bundle Resources the only thing there is the Images.xcassets, which only contains the splash screens and icons.

Surely I'm missing something simple.

I tried renaming the folder where I keep my textures to "Textures".  Also my textures are not built in to the shader but added programmatically like this:

void Awake ()
{
    meshFilterComponent = GetComponent<MeshFilter>();
    Material material = GetComponent<MeshRenderer>().material;
    material.SetTexture(0, paperTexture);
    material.color = new Vector4(1f, 1f, 1f, 1f);
}

Where paperTexture is set up in the GameObject to point to the correct texture.  Is there any way to force a texture to be part of a build?  Let's say that you swap out textures in code, like swapping themes, how would you make sure they're all there to be loaded as needed?

Running On iPhone:

Running In Unity3D:

sentences:
What is the most efficient way to load all the textures? I am developing a game (in Java) that is going to have a lot of textures and images in it.

What is the most efficient way to load all the textures? I was thinking on pre-loading all the images instead of loading them during runtime (because during runtime they will be loaded over and over again).

I'll be happy to hear your opinion on those strategies, and also, if you have a better strategy I would like to hear that.

sentences:
How can I play an animation only using C#, without animation controller, or create an animation controller at runtime entirely from script? I've been looking around for a while trying to figure out how to play simple animations with Unity via ONLY C# script, with no drag-and-drop involved. So far I've found various tutorials explaining how to manually set up a animation controller for each object, then manually select each animation state and manually create a transition then manually set the transition length to the most minimum possible etc...

I was wondering if there's a simple way to just do something like...

gameObject.playAnimation(
    "stand still /* which would be the name of the action state created in blender or other animation software*/",
    "loop");

...WITHOUT creating an animation controller manually at all, I haven't been able to find any resource to do this simple thing yet.

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:
Bank ship left/right based on virtual joystick I have a 3D game in Unity with a top-down camera view centered directly above a space ship. The ship always stays in the center of the screen, but it allows you to orbit a planet freely using an on-screen joystick. The movement around the sphere is working great, and the camera and ship both move together to orbit the planet.

With that being said, I would like to "bank" the ship left and right as you turn to add a more realistic flight affect. At most the ship will bank 45 degrees to either side, but the amount will be based on how hard they are turning which will come from the joystick as well (distance joystick is from its origin).

I'm having trouble figuring out a good formula for this rotation. I have tried many different things with varying results, but my thought was that I would determine which way the ship is turning first, either left or right. Then apply a hard coded 45 degree angle for now to the y-axis. This actually gets me mostly there. But it seems I need to flip this to the x-axis at times, and when the ship is flying in the opposite direction (pointing down) it seems everything gets mirrored? As you can see, I'm confused haha. Does anyone have any insight as to a better approach, or if you can see issues with my current approach? Thanks!

Here is a bit of code that I have tried:

The update method to apply the rotation:

public void Update()
{
    TurningDirection turningDirection = GetTurningDirection(); // See below for this
    float direction = turningDirection == TurningDirection.Left ? 1f : -1f;
    bankRotationAngle = 45f * direction;

    // Using 45 degrees here for now, but will eventually change this to come from the joystick as well to get the correct amount to bank based on how hard they are turning
    if (Mathf.Abs(bankRotationAngle) > 45f)
    {
       bankRotationAngle = 45f * direction;
    }

    transform.localEulerAngles = new Vector3(transform.localEulerAngles.x, bankRotationAngle, transform.localEulerAngles.z);
}

The GetTurningDirection method (this is based off an angle to capture their last/current angle to see if the ship is turning left or right):

 private TurningDirection GetTurningDirection()
 {
     // If it hasn't changed, return the current direction
     if (joystickAngle == lastJoystickAngle)
     {
         return turningDirection;
     }

     if (joystickAngle < lastJoystickAngle)
     {
         return TurningDirection.Left;
     }
     else
     {
         return TurningDirection.Right;
     }
 }

sentences:
Unity Android game all squashed in center of screen (portrait layout), help I'm developing a demo for Android game in Unity with portrait layout. I used the ViewportHandler script found here (How do you handle aspect ratio differences with Unity 2D?) and it worked well. Yesterday I updated Unity (foolish move I know, two days before deliver of a project!!) to 5.4.2f2 (was using 5.4.1f1). I don't know if that is the reason but now I can in no way get my correct layout again. Sure, it is portrait but all squashed in the center and taking about one-third of the screen, rest just background camera-colour. Things looked well yesterday but now I'm in big trouble :(

Any help would be greatly appreciated!

sentences:
3D collision for non mathematician I am having an extremely hard time understanding smooth 3D collision. I have spent a month trying to figure out the math and still cannot get perfect collision detection that perform the same way as in games such as Quake.

I've resorted to a virtual 2D rectangle collision model applied to 3D plane, but it's full of bugs and doesn't handle slopes. It seems that very complex math is required like matrices and vectors. There are lots of tutorials online but they are full of mathematical symbols and it's impossible for a math novice like me to understand it, I also don't have time to go through a mathematics basics from the beginning. Is it possible to do collision without vectors or matrices or a guide somewhere that can explain in non mathematical terms how to implement smooth collision? How can a nonmathematician overcome 3D math?

sentences: speed up the update of glutidle() I have a client that sends data at 1KHz (i.e. 0.001 sec) to a master over Internet using UDP protocol. In Master, I need to draw an object, but the problem is that the update of GLUT is slower than the client's update. I have tried to use glutTimerFunc(0,glutIdle, 0); but still slow. Is there a way to speed up the update rate of drawing? I need to update Display() every 0.001 sec. Any suggestions? I'm using windows 7.

sentences:
Does it make sense to build a text-based game Facebook app without using Facebook? If I am building a text-based browser game, does it make sense to build it on you domain first, without using the Facebook API?  I don't want to buy an SSL if I don't end up following through with everything. I already have a domain for testing.

In other words, can/should I build the whole thing outside of Facebook and then change it later to use the Facebook API?

sentences:
How can I implement pre-rendered 2D sprites that can face any direction? I've been Googling how games like Clash of Clans render their troops, and it appears they are pre-rendering 3D models to 2D sprite sheets before runtime, and rendering those 2d images at runtime. However, troops in Clash of Clans can face any direction.

In my similar game, if I were to create an image for every orientation (0-360 degrees) for every troop type (there are 18 types) at each frame in their animation, they would have to produce a massive amount of images. I can't imagine this is what other developers are doing, so how can I actually accomplish this?

sentences:
is there a formula to know how many enemies i can place before jumping character? My game is very similar to the hidden game in chromes web browser. I have a character that needs to jump over incoming enemies. Is there any way i can know when to send an incoming enemy? Some of the factors to take in to account i guess are the speed of enemies, height of jump, speed of jump, and dimensions of bitmaps (that represent character, and enemies).

Thanks

sentences:
Strategies to Defeat Memory Editors for Cheating - Desktop Games I'm assuming we're talking about desktop games -- something the player downloads and runs on their local computer. Many are the memory editors that allow you to detect and freeze values, like your player's health.

How do you prevent cheating via memory-modifiation? What strategies are effective to combat this kind of cheating?

For reference, I know that players can:
- Search for something by value or range
- Search for something that changed value
- Set memory values
- Freeze memory values

I'm looking for some good ones. Two I use that are mediocre are:

Displaying values as a percentage instead of the number (eg. 46/50 = 92% health)
A low-level class that holds values in an array and moves them with each change. (For example, instead of an int, I have a class that's an array of ints, and whenever the value changes, I use a different, randomly-chosen array item to hold the value)

The game is offline, free and single-player.

Edit: for posterity, I solved this (in C#) and posted my solution here, on my blog.

sentences:
How manage multiple images in Unity? I'm new in Unity and creating a game. So I have a class PicManager in which I have to load my images(sprites) from assets into a List and then use them in my game. What is the proper way to load multiple images from a folder in Assets?

I know, that I can use  Sprite[] sprites = Resources.LoadAll<Sprite>(texture.name);
But this article of Unity says not to use Resource folder.

sentences:
XNA How do I detect if my mouse if hovering over a specific sprite? How do I detect if my mouse if hovering over a specific sprite?

For example I'm making a custom button and I want to check if my mouse is hovering over it so I can make animations.

sentences:
How to achieve 2D ski movements similar to Alto Adventure? I'm trying to achieve 2d movement similar to Alto's Adventure with Unity 2D. When grounded I want the character to slide alone the terrain parallel to the slope, but I want to be able to freely rotate the character in mid air. In my current failed implementation I tried using a 2d collider attached to an gameobject with a movement custom script. I'm using vertical and horizotal raycast to detect the slopes, and the object rotates based on the angle of the slope. Long story short I've given up on this implementation for now.

Do you guys have any suggestions or pointers on achieving this type of movement?

sentences:
SFML title bar with weird characters when using UTF-8 (Previously asked at https://stackoverflow.com/questions/4922478/sfml-title-bar-with-weird-characters-when-using-utf-8)

I've just started using SFML and one of the first problems I've come across is some weird characters on the the titlebar whenever I try to use accents or any other extended char.

For instance, I've got:

sf::RenderWindow Ventana(sf::VideoMode(800, 600, 32), "Año nuevóóó");

And the titlebar renders like AÂ+o nuevoA³A³A³

This ONLY HAPPENS if my source code file is enconded in UTF-8. If I change the file encoding to ISO-8859-1, it shows properly. Obviously all of my files use UTF-8, as its the system-wide encoding. I'm using GCC under Ubuntu GNU/Linux.

I've tried using the different utilities in sf::Unicode to adapt the text, but none of them seems to work.

sentences:
Dynamic Terrain Texture I've been looking at a 2D physics game called 'Hill Climb Racing' (Android and iOS) and was wondering how they went about texturing the terrain?

I've had a think about it and I've come up with nothing and finding a resource on the web has proved impossible. Please help.

The game mentioned uses Cocos2d. Would it be just as doable in a different environment?

EDIT:

I was looking at another question: Drawing large 2D sidescroller level terrain

The end result is what I'm looking for, but in my mind I was thinking that there would be some way to add this effect (using small textures) to some terrain specified by vertices rather than making a very large image to match whatever is seen in the level.

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: 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:
Do game studios hire people based on their math knowledge alone? I have very little programming skills outside of very basic levels of Java, but I have excellent math and science knowledge. I was wondering what I could offer any potential team if I were to go into video game development? Do people hire people based on their math knowledge alone?

I like to do other things such as writing or drawing, but math and science are the only skills in which I really excel in.

sentences:
Pause on scrolling backgrounds I have a typical parallax backgrounds. They are scrolling by

public float Speed=0f;

void Update ()
{
    renderer.material.mainTextureOffset = new Vector2 (Time.time*Speed,0);
}

I have a character. OnKeyDown he starts to move: Speed of background sets to 0.4f for example. OnKeyUp a character stops by setting the speed of background 0f.
The problem is: when backgrounds stop to scroll, they return to its start position. They must just to pause the position. How to do?

sentences:
Unity open UI from ScriptableObject I have a Canvas that has multiple UI Panels in it for an inventory, crafting, etc. To open these panels I currently have a monobehaviour class on the Canvas with methods like OpenInventory(), etc.

For every item within the inventory I use ScriptableObjects. However, some items open the crafting panel when right clicking, I created a class that extends the Item class and added a method to it that gets added to the inventory slot and gets called when right clicking that item.

Because the monobehaviour on the Canvas is an instance, I can't access it from a ScriptableObject.

Long story short, is there a way to open a UI panel from a ScriptableObject? If not, what would be the best way to fix this issue?

sentences:
Can Mobile Games use Fragments instead of SurfaceViews? All the tutorials of mobile games for android (such as this one), use the  to display game objects. Most other applications tend to use an Activity > Layout Resource architecture.

The guide explains why he uses a Activity > SurfaceView Subclass architecture because of threading and canvasing at this point in the video.

Could you use fragments to have take care of threading and displaying game objects?
If you can, why is using a SurfaceView preferred?

sentences:
In Unity, how can I render borders of provinces from a colored province map in a grand strategy game? I am kind of a beginner of Unity and I am trying do work on a grand strategy game. I already have a province map, colored by unique rgba for each province, looks like something below:

I know that the province map is kind of a look up map for province id. But when I obverse the paradox strategy games, I notice that they have render borders differently for the provinces and nations. For example, in the CK3, the Baron collars are separated with dotted lines, and the kingdoms are separated with enhanced yellow lines.

I thought they have some other maps or files containing those information, so I went to read their dev diary, and I find that all province shape information are stored in the province map.

So, my question is:

Is there any way in Unity3D to create those different borders with some shader and some province map such those given above?

I think what I wish to accomplish is something as this link:
Render border on 3D map

Which is:

sentences:
Why are my geometry-shader-generated billboards not showing up given the following code? My program is a rain particle system. After processing a list of positions of rain particles, I passed them to the geometry shader for generating a billboard for each position.

If I use a simple method to generate the billboard, (it is a rectangle, not really a billboard), it work well and I can see them in the render target. This simple method proves that the input positions for the geometry shader are right.  The below HLSL source implement this simple billboard.

[maxvertexcount(4)]
void GSMAIN( point GS_INPUT input[1], inout TriangleStream<PS_INPUT> SpriteStream )
{
    //Transform to view space
    float4 viewposition = mul(float4(input[0].position, 1.0f), WorldViewMatrix);

    // Emit two new triangles
    for (int i = 0; i < 4; i++)
    {
        // Transform to clip space
        //g_positions is an array of four deltal vectors in the form: (-scale, +scale, 0, 0)..
        output.position = mul(viewposition + g_positions[i], ProjMatrix);
        output.texcoords = g_texcoords[i];
        output.color = color;

        SpriteStream.Append(output);
    }
    SpriteStream.RestartStrip();
}

But if I changed to create a real billboard, it shows nothing. My method is based the velocity vector of rain drop. The implementation is in below:

[maxvertexcount(4)]
void GSMAIN( point GS_INPUT input[1], inout TriangleStream<PS_INPUT> SpriteStream )
{
    PS_INPUT output;

    //Velocity of raindrop = Rate + original velocity
    //The billboard will stays along this vector
    float3 velocityVector =  input[0].speed.xyz/FrameRate + TotalVelocity;

    //ViewPosition: the position of camera
    GenRainSpriteVertices(input[0].position, velocityVector, ViewPosition, pos);

    for(int i = 0; i < 4; i++)
    {
        output.position = mul(float4(pos[i], 1.0f), WorldViewProjMatrix);
        output.texcoords = g_texcoords[0];
        output.color = color;
        SpriteStream.Append(output);
    }
}

///////////////////////////////////////////////////
//The function generating billboard from
//1. Point Position
//2. Eye Position
//3. Velocity vector
///////////////////////////////////////////////////
void GenRainSpriteVertices(float3 worldPos, float3 velVec, float3 eyePos, out float3           outPos[4])
{
    float height = g_SpriteSize / 2.0;
    float width = height / 10.0;

    velVec = normalize(velVec);
    float3 eyeVec = eyePos - worldPos;
    float3 eyeOnVelVecPlane = eyePos - ((dot(eyeVec, velVec)) * velVec);
    float3 projectedEyeVec = eyeOnVelVecPlane - worldPos;
    float3 sideVec = normalize(cross(projectedEyeVec, velVec));

    outPos[0] = worldPos - (sideVec * 0.5*width);
    outPos[1] = outPos[0] + (sideVec * width);
    outPos[2] = outPos[0] + (velVec * height);
    outPos[3] = outPos[2] + (sideVec * width);
}

I tried to use Nsight and Graphics Diagnostics in VS2012 to debug, and all of them show that the geometry shader generated the right vertices. The following pictures are from Visual Studio and Nsight, which present the result after the geometry shader finished its job.

And the next result is from Nsight:

For some reason, the generated vertices in the geometry shader are discarded in the pixel shader. Why might this be?

sentences:
Cocos2dx Windows Phone 8.1: Seperate Characters in RTL Label I use below code to show a text :

auto label = Label::createWithSystemFont("سلام و خداحافظ", "BTitrBold", 24);

( RTL text like Persian, Arabic and Hebrew)
This code works fine in both **Android** and **iOS**. But when I run project on **WindowsPhone8.1-universal** device, the label shows the characters not only separated but also LTR , as below screenshot:

I was faced same problem in Android long time ago. But It solved Link.

In order to solving problem I compiled fribidi library for windowsPhone. this library solve separated character problems (somehow) but still Wrapping is a big problem.

Please solve Right-To-Left problem in WindowPhone8.1. We really miss this platform's store.

PS: cocos2dx 3.10

sentences:
Cubic bezier polygon clipping I have a large cubic bezier defined 2D polygon area which I need to render in DX11 real-time to create as many 4096x4096 textures as needed.
An average control point count would be around the 12k and I need to render it with a 16x resolution, meaning that for every unit of length, I would need 16 line segments.
This makes it impossible to triangulate the generated mesh as the shear number of polygon points would take seconds to triangulate.

I thought of tessellating the bezier polygon and then clipping it to fustrum but again, since we are talking about a lot of triangles that would be too slow for real time rendering (I need to be able to modify the bezier polygon real time).

To add insult to injury, polygon holes and Steiner points are a requirement as the color of the surface would come from the different points "depth".

Ideally, I would clip the bezier polygon (to fustrum or smaller sub-polygons) before tessellating but I don't know of a library that can do that.

The only "idea" I currently have is to cut any bezier segment to sub-segments shorter than 4 units, using the 64 levels of shader tessellation and then move the new vertices according to the control points but needless to say, this seems overly complicated and inefficient.

sentences:
What is this type of camera called? I am trying to find a name like "perspective view" of how a camera like this is called:

It is 2d and 3d at the same time. I'm having a hard time trying to find the name.

sentences: Dynamic obstacles avoidance in navigation mesh system I've built my path finding system with unreal engine, somehow the path finding part works just fine while i can't find a proper way to solve dynamic obstacles avoidance problem. My characters are walking allover the map and collide with each other while they moving. I try to steering them when collision occurs, but this doesn't work well. For example, two characters block on the road while the third one's path is right in the middle of them and he'll get stuck. Can someone tell me the most popular way of doing dynamic avoidance? Thanks a lot.

sentences: When importing Mixamo animated characters into Unity, they come without avatar? I'm using Unity 2019.3.3f1. I create the character in Adobe Fuse. I uploaded it to Mixamo and choose an animation. I then downloaded the fbx for unity file. When imported into Unity, it is visible that the file has no avatar or animator component. How can I fix this? Is it a Unity version issue?

sentences:
Transform.Rotate micro stutter? Hey all I have a quick question.

I am new and obviously still learning the basics of programming/scripting. However I am confused by the result of a simple script.

The goal is to have a Start Menu with a 3d background.The camera is attached to an Empty Object, which has a script that is meant to constantly rotate.

My confusion, is whether I am live testing in Unity, or a built executable. When the empty object is rotating, it will have a pause or a few milliseconds, and then continue with its rotation. Almost like a planned micro stutter. Regardless of where it is in its cycle. How can I make the rotation as perfectly smooth as possible?

Below is the script for rotating the empty object that the camera is attached to.

public class cameraAnchor : MonoBehaviour {

public float speed = 5f;

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

    //rotate camera anchor around y axis
    transform.Rotate(Vector3.down, speed * Time.deltaTime);
}

}

sentences:
How to find the client's monitor valid refresh rates with Unreal Blueprints? I am making a settings menu. This includes a combo box where you can change the refresh rate setting.

How do I find out the maximum allowable refresh rate of the current user's monitor, using Blueprints?

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:
Perlin Noise Problem with Falloff I know this might be a bit of a noob question, but I can't figure out what I'm doing wrong, and the math that I have done should make this work correctly. I am trying to make a perlin noise map that is normal until a specific range, at which point it would decrease to where all the values trend towards zero, creating an island in an ocean. I am currently generating perlin "sample" values, and then dividing them by a factor which stays close to one up to a specific bound, and then increases polynomialy. The problem however, is that the noise stays stuck in the top right corner, and is darker than I would expect. Here is the mathematical function I am using graphed on Desmos where n is the boundary and x is the distance from the center of the map:

And here is the main body code I am using to generate the noise map:

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

public class GenNoise : MonoBehaviour {

public int width = 256;
public int height = 256;

public float scale = 20f;

public float offsetX;
public float offsetY;

public float falloffRange = 100;
public float falloffPower = 10;

public void RenderNoiseMap()
{
    Renderer renderer = GetComponent<Renderer>();
    renderer.sharedMaterial.mainTexture = GenerateTexture();
}

Texture2D GenerateTexture () {
    Texture2D texture = new Texture2D(width, height);

    for (int x = 0; x < width; x++)
    {
        for (int y = 0; y < height; y++)
        {
            Color color = GenerateColor(x, y);
            texture.SetPixel(x, y, color);
        }
    }

    texture.Apply();
    return texture;
}

Color GenerateColor(int x, int y)
{
    float xCoord = ((float)x / width * scale) + offsetX;
    float yCoord = ((float)y / height * scale) + offsetY;
    float falloffFactor = FalloffFactor(x, y, width, height);

    float sample = Mathf.PerlinNoise(xCoord, yCoord);
    sample = sample / falloffFactor;
    return new Color(sample, sample, sample);
}

float FalloffFactor(int x, int y, int width, int height)
{
    float falloffFactor = 1;
    float centerX = (float)width / 2;
    float centerY = (float)height / 2;

    float distanceFromCenter = Mathf.Sqrt(Mathf.Pow(2, ((float)x - centerX)) + Mathf.Pow(2, ((float)y - centerY)));
    falloffFactor = Mathf.Pow(2, (Mathf.Pow(falloffPower, (distanceFromCenter / falloffRange)) + 1));

    return falloffFactor;
}
}

And Here is the code that I am using to generate the image in the editor:

using UnityEngine;
using UnityEditor;

[CustomEditor(typeof(GenNoise))]
public class NewBehaviourScript : Editor {
public override void OnInspectorGUI()
{
    DrawDefaultInspector();

    GenNoise script = (GenNoise)target;
    if (GUILayout.Button("Generate"))
    {
        script.RenderNoiseMap();
    }
}

}

Here is a picture of the result:

sentences:
Device and user progression conflicts Im designing a game with both digital currency and player progression, but have hit a confusing snag, where I possibly can't be the first to come to a decent solution.

To keep it simple, it's a mobile game, where the player is identified by his Device ID in the beginning. He is encuraged to connect with facebook, and if he does so, will be identified by his Facebook User ID (FBID) instead. For security reasons (and because its core to the game) you can only play online, and progression and resources are maintained by the server.

So far, the flow is simple:

If the server has no FBID on the user, an account is created based on his DeviceID, and he plays on that.
If the user connects to facebook, the account is updated with the new FBID, and all resources are carried over.
If the player deletes the app, and redownloads it, we still identify him based on device id, and he gets his old account back.

But here are the area that I'm concerned:

If the same player has a second device, he would like to play from instead/also.

It's a fair scenario that if the player requires an tablet next to his phone, and he wants to play with the same account.

So my play so far, is to wipe the "temporary account" from the server, find the account with the matching FBID, and add this new device to an array of devices on the original account.

I have session based control, so they can't be playing on the same time. The old device will simply be logged out if the same user appears on the new one.

But I have a feeling this is not the best way of doing things. What if the "temporary" game is played by someone else, and that person will technicly get his account wiped and device "taken over" by the logged in user ? Im especially concerned about family-type scenarios, where devices are shared.

Does anyone have any good suggestions on structure on this ? Maybe I'm completely in the woods with my method here, and doing it all wrong.

My priorities are :

Duplication of ingame resources must not occur
A player should never be "punished" by starting over, if he signs in using facebook.
A player should be able to maintain and restore his progress in the game, even if he logs out.

sentences:
Having 3D material properties depend on shader Disclaimer: I apologise if this is somehow a duplicate question or is unclear.

I am in the process of writing a 3D scene renderer/editor in C++ using the OpenGL specification. It is actually going surprisingly well considering my past experience (all but none) however I have hit hurdle in designing the way materials work. First, this is how they work now:

Materials have a diffuse/albedo map, a normal/bump map, and a specular map. They also have a diffuse/albedo colour, and a shininess value for when no specular map is provided. This works fine and all however I noticed Unity's material's properties depend entirely on a shader. This is pretty much what I want as this is wonderfully flexible.

I know you can get a list of a shader program's GLSL uniforms as described here but I am struggling with what my Material class should be looking like. Do I have each material hold a map of textures, colours, floats, with the keys being their GLSL uniform name? Or is there a nicer more elegant way? The reason I am against this is because I wouldn't know how to organise the properties in a GUI when all I am given is a uniform name. For example I might have multiple diffuse or specular maps, and I would like to arrange these in a specific manor.

Please let me know if this is an awful question, or if I could improve it in any way. My brain hurts right now.

sentences:
Resources on expected behaviour when manipulating 3D objects with the mouse In my animation editor, I have a 3D gizmo that sits on the origin of a bone; the user drags the mesh around to rotate the bone.

I've found that translating the 2D movements of the mouse into sensible 3D transforms is not near as simple as i'd hoped.

For example what is intuitively 'up' or 'down'? How should the magnitude of rotations change with respect to dX/dY? How to implement this? What happens when the gizmo changes position or orientation with respect to the camera? ect.

So far with trial and error i've written something (very) simple that works 70% of the time. I could probably continue to hack at it until I made something that works 99% of the time, but there must be someone who needed the same thing, and spent the time coming up with a much more elegant solution.

Does anyone know of one?

sentences:
Textures on grass not showing on android I'm using assets from InfinityBladeGrassLands, and used SM_Plains_Grass01 for some foliage on my landscape.
In editor, the foliage looks like this:

But when building for andoroid, this is what shows up:

What's the problem here?
Edit: I manually added an instance of the grass to the viewport, and that one is showing fine in android, but still the rest added using Foliage tool are not.

sentences: Assign each player a unique ID? For my game's multiplayer matchmaking and back-end, every player is assigned a unique GlobalID and LocalID. The GlobalID is used for keeping track of all players and the LocalID is for keeping track of players in a specific room. How can I assign to each player a unique ID so that at any one time 2 players don't have the same GlobalIDs or LocalIDs? I think I can manage with assigning each player their own GlobalID and let them keep it after they log off but I definitely need to reuse LocalIDs Note: I'm using C# for my server which handles the IDs.

sentences:
Gamepad API For Multiple Pad Types I'm a C++ newbie working on adding gamepad support to Moai as a learning exercise and because I'd like to be able to use a gamepad with it. I'm starting by implementing the Xbox 360 gamepad via XInput and that's going pretty well. Eventually I'd also like to support the PS3 gamepad.

This has got me thinking: the 360 and PS3 pads are mostly similar. They have the same number of buttons in more or less the same places that do more or less the same things (e.g., the right trigger on the 360 pad is an analog trigger, so is the R2 trigger on the PS3 pad). From the standpoint of creating an API to support both pads the main difference is the labeling applied to each button.

The PS3 square button is in the same place as the 360 X button, triangle matches Y, circle matches B, and X matches A. Some comparison images:

When creating the API to work with gamepads I see a couple ways to approach it:

Use the 360 naming conventions exclusively.
Use the PS3 naming conventions exclusively.
Come up with something in between.

I'd like to go with option #3 and could devise my own solution easy enough but don't want to reinvent the wheel unnecessarily.

Is there some standard naming convention used for a gamepad API that supports both 360 and PS3 (and possibly other, similar) gamepads? Is this even really an issue -- should I just create an API, document it and call it good?

sentences:
Viewport.Unproject - Checking if a model intersects a large sprite Let's say I have a sprite, drawn like this:

spriteBatch.Draw(levelCannons[i].texture, levelCannons[i].position, null, alpha, levelCannons[i].rotation, Vector2.Zero, scale, SpriteEffects.None, 0);

Picture levelCannon as being a laser beam that goes across the entire screen. I need to see if my 3d model intersects with the screen space inhabited by the sprite. I managed to dig up Viewport.Unproject, but that seems to only be useful when dealing with a single point in 2d space, rather than an area. What can I do in my case?

sentences:
How do I make players believe they're doing something wrong even when they're not? You're doing it right. …right?

In the game Cart Life, you are led to consider this, even though you are doing fine. This effect is created by making you do mundane jobs, earn little money, and have and things happen that feel like your fault.

Is there a better way than life-like mundane and unfortunate encounters to make you feel like you're failing at the game? I want to use this to mess with how my players play the game. Overwhelm them. Make a little success feel huge. Make them feel depth. Any ideas?

sentences:
Why can't a blueprints project edit BPs derived from c++ classes? I am working in a relatively small team.

Now, because our IT guy is incredibly unhelpful, we don't yet have VS on all the machines (as I know this would solve the error). However, I'm still curious as to the answer to this question.

Computer A:

C++ project
Creates C++ classes
Creates BP derived from said C++ classes.
Sends project to Computer B.

Computer B:

Gets project
Tries to edit BP classes
Can't open them
Reason: 'They derive from parent C++ classes'

So my base question is really why is this?

I understand that this can be solved easily, but I'm interested as to why Unreal imposes these limitations.

sentences:
How to play multiple sounds at once without reloading data? I am making an HTML5 game, which involves one audio being played multiple times at once.
I searched this issue up and found this: https://stackoverflow.com/questions/25654558/html5-js-play-same-sound-multiple-times-at-the-same-time
It seemed to help, except later a question came up:
If I do cloneNode(), will it copy the sound AND the currently loaded audio data, or will it have to reload the data?
Is there a better way to play multiple sounds while making sure no data needs to be reloaded?

sentences:
Relation between TFLOPS and Threads in a GPU? What's the relation between Teraflops and Threads in a GPU like GTX Titan X has 7 TFOPS of Compute Performance but how many threads it has ? And Like Xbox and PS4 have 1.32 and 1.84 TFLOPS of compute performance but how many threads they have? Like what’s the relation between teraflops and threads?

If they are different concepts. Can you please explain both of them?

sentences:
Voice recognition libraries - C++ I need to implement voice recognition in my game, the target is that the user speaks into the microphone and the game responds accordingly to some commands.

What libraries could help me with such task? I need them for C++ and as lightweight as possible to plug into the game(it will be used in mobile games).

An ideal usage would be having it capture input sound or receiving the audio samples, and outputting strings with the recognized text.

Thanks

sentences:
Animation, Interpolation, & Structure I have been working on animation in my small game engine recently and I am implementing some interpolation to be used with skeletal animations. I know how to do interpolation but I am not sure where to put the equation that I get out of it.

Do I save an equation for each channel of every bone in the data structure? Maybe something along the lines of:

struct Channel
{
    std::string boneName;
    std::vector<KeyFrame> keyframes;

    // These equations will be used to find the position/rotation/scale of
    // the bone at t time.
    std::vector<float> rotEqX, rotEqY, rotEqZ;
    std::vector<float> translateEqX, translateEqY, translateEqZ;
    std::vector<float> scaleEqX, scaleEqY, scaleEqZ;
};

Do I just calculate the equation every time I want to update the animation? (Seems a little inefficient?)

sentences:
Sprite won't change with direction I am making a top down Pacman game. I have two sprites: one for facing up and one for facing left.

When I press W, the sprite showing is still the one for when Pacman is moving left, but I want to see the up sprite instead.

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

public class pacman : MonoBehaviour
{
    public int speed;
    Vector2 dest;
    public Transform[] points;
    // Start is called before the first frame update
    void Start()
    {
        dest = transform.position;
        speed = 25;

    }

    // Update is called once per frame
    void FixedUpdate()
    {
        //Vector2 p = Vector2.MoveTowards(transform.position, dest, speed);
       // GetComponent<Rigidbody2D>().MovePosition(p);

        // Check for Input if not moving
        if (Input.GetKey("w"))
            transform.position = Vector3.MoveTowards(transform.position, points[0].position, speed * Time.deltaTime);

        gameObject.GetComponent<SpriteRenderer>().sprite = GameObject.Find("up").GetComponent<SpriteRenderer>().sprite;

        if (Input.GetKey("d"))
            transform.position = Vector3.MoveTowards(transform.position, points[2].position, speed * Time.deltaTime);

        if (Input.GetKey("s"))
            transform.position = Vector3.MoveTowards(transform.position, points[1].position, speed * Time.deltaTime);

        if (Input.GetKey("a"))
            transform.position = Vector3.MoveTowards(transform.position, points[3].position, speed * Time.deltaTime);

        gameObject.GetComponent<SpriteRenderer>().sprite = GameObject.Find("left").GetComponent<SpriteRenderer>().sprite;
    }
}

sentences:
Simple, casual open source OpenGL games to implement other things in I am looking for a simple casual game (open source) done in openGL. I need it to implement communication component i build this is not for learning opengl  and to implement some other stuff into it. Where can I find one?
(I am using C++)
Thanks

sentences:
Rotate sprite along the angle between two objects Im trying to make flames follow my object, I set the direction for my moving object using the points between it and another object (using static destination for testing).

No matter what I do I cannot use the radians (which I use to set the direction), translate them to degrees, then rotate my flames so it looks like they are following it (like a comet).

What I try:

sprite.setPosition(pos.x, pos.y);
radians = Math.atan2(0 - pos.y, 540 - pos.x); //set radians
degrees = radians * 180 / MathUtils.PI; //calculate degrees
fireSprite.setPosition(sprite.getX(), sprite.getY());
fireSprite.setRotation((float)degrees); //rotate according to degrees

I move the object like this:

pos.x += 200 * Math.cos(radians) * delta;
pos.y += 200 * Math.sin(radians) * delta;

Am I missing something in the math? I feel like it should work.

An example of result from calculations:

radians: -1.8745297149164084, degrees: -107.4026382478209
radians: -1.1776894171295331, degrees: -67.47663130103584
radians: -2.1756410640936705, degrees: -124.65504723907603
radians: -1.2244578042111383, degrees: -70.15626242087843

The flames face the wrong direction, and not in a any sort of pattern I can use to debug my problem.

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 can i add a description of gameobject when click on the gameobject? I have this DetectInteractable working script attached to Player (FPSController).

I'm using tag to detect interactable objects, each object i want to be interactable i change his tag in the editor to "Interactable". ( Maybe there is a better way to do it without using tag ? It's working but many told me not to use tag. )

I'm using Raycast to hit a gameobject detect if it's "Interactable" and if it does i display on the gameobject his name. For example "Security Door" or "Screen Monitor" or "Surveillance Camera"

Now i want to do that if i hit a gameobject with the raycast and it's "Interactable" if i will click the mouse left button it will display a description text description about the gameobject. But this time i want to use some gui box so it will be in front of the screen in the middle and not on the gameobject.

The problem is that i need to create a script for every "Interactable" gameobject and make that if i click on a button it will display a description.

Then how do i make the script and how can i make that when i attach the script to each gameobject it will make in the inspector a box of text so i can enter and type there the description of the item(GameObject) ?

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 Image image;
    public bool interactableObject = false;
    public Canvas canvas;
    public Text interactableText;

    private RaycastHit whatObjectHit;
    private RotateObject rotateobj;

    private void Start()
    {
        rotateobj = GetComponent<RotateObject>();
    }

    private void Update()
    {
        Debug.DrawRay(cam.transform.position, cam.transform.forward * distanceToSee, Color.magenta);

        if (rotateobj.rotating == false)
        {
            if (Physics.Raycast(cam.transform.position, cam.transform.forward, out whatObjectHit, distanceToSee))
            {
                if (whatObjectHit.collider.gameObject.tag == "Interactable")
                {
                    image.color = Color.red;
                    objectHit = whatObjectHit.collider.gameObject.name;
                    interactableObject = true;
                    interactableText.gameObject.SetActive(true);
                    interactableText.text = whatObjectHit.collider.gameObject.name;
                    print("Hit ! " + whatObjectHit.collider.gameObject.name);
                }
                else
                {
                    image.color = Color.white;
                    interactableText.gameObject.SetActive(false);
                    print("Not Hit !");
                }
            }
            else
            {
                image.color = Color.white;
            }
        }
    }

    public class ViewableObject : MonoBehaviour
    {
        public string displayText;
        public bool isInteractable;
    }
}

sentences:
Multiple updates for Unity animation per one method call I'm trying to do some simulation where I move objects procedurally in a loop within one method call. So instead of using Update(), method I do for example:

void Simulate(float deltaTime)
{
   // real logic look a lot different, this is just an example
   for(int i = 0; i < 1000; ++i)
   {
      transform.position += direction * speed * deltaTime;
   }
   .....
}

The reason I'm doing this is because I want consistent 'framerate' by passing that deltaTime parameter; Which is for example 0.01f;
And each step of that loop I'm taking snapshots on multiple cameras with calling Render() method on them before taking a picture. The movement works fine and I see it on snapshots, but some objects has an animation which should also be updated procedurally.

I've tried to do

animator.speed = 0;

and then in the same loop, to test it

for (int i = 1; i < 1000; ++i)
{
   ...
   animator.Play("WalkFWD", 0, i/1000f); //for example
}

But animation does not change over that loop. It only works with that Play method when I either make this Simulation() method a coroutine and pass one frame (yield return null), or if I use in Update().
So, my question: is it possible to procedurally update/redraw animation after normalized time of that animation is set. (without waiting for another frame)

sentences:
How should I be loading a player's content and its bullets content later in the game I'm trying out Monogame because my course has a simple game programming class in it which is just going over basics. The final project will be using Monogame so I've been getting ahead and making my game.

Anyway, each player (Tank) has a list of Shells (bullets) and a list of Tracks (tank tracks). I load their content in the player's LoadContent method. LoadContent is called when the game is ran.

Let's say I wanted to add a new player sometime later in the game for whatever odd reason. I would do something along the lines of:

 entityManager.Add(new Player("Player Name", resourceManager.GetTexture("BlueTank"))
 {
      set initial position and keybinds here,
 };

This successfully creates a new player and loads its texture but what about its bullets textures, sound effects, track textures etc... Since LoadContent only gets called once at the start the code below will not run.

Example of the player's LoadContent method:

 // Match the players bullets with the players colour
 switch (Texture.Tag)
 {
      case "BlueTank":
           shellTexture = resourceManager.GetTexture("BlueShell");
           break;
      case "DarkTank":
           shellTexture = resourceManager.GetTexture("DarkShell");
           break;
 }

 // After this I use the resourceManager to set private Texture2D's and sound effects for the bullets, tracks and player.

 // e.g.
 trackTexture = resourceManager.GetTexture("Track");

When I finally shoot a bullet I set the bullets texture and sound effect properties to the private ones in the player.

When a player dies I currently just set their IsActive bool to false and the entity manager will remove them completely so I'm stuck on how to load content again.

I feel like I'm overthinking this but I can't seem to find a clean and simple way to get this done. Also I'm bad at explaining things hopefully this isn't too much of a mess.

Edit: Would it be a bad idea to pass the resource manager in the players constructor and just create a method for loading that is called in the players constructor? That way when a player is created the content is loaded for that player. It's only a small game for a basic school project. I could potentially do all the content setting outside of the player itself and in the GameplayState by looping through unloaded entities or something.

sentences:
Screen Capture rendered on a RenderTexture in Unity I have a pretty wild idea for a unity application that would work on a multi-display setup.

The app would be running in full screen mode on one of my displays, and the contents of the remaining two displays should be rendered in-game on a texture.

I've seen RTMP clients for unity and I've tried streaming my desktop with OBS to a local RTMP server but the delay was too big (more than 5 seconds). I would prefer an instant (or very low delay) solution for mirroring my displays on textures in Unity.

If anyone can help me solve this, i would appreciate it!

sentences:
Position UI.Button to mouse position This has been discussed a couple of times, but I didn't find any solution:

I want to set the position of an UI.Button to my mouse position.
I can get the mouse position like this:

Vector3 cameraVector = Camera.main.ScreenToWorldPoint(Input.mousePosition);

Problem: The UI elements are using another "coordination system". How can I handle that problem?

sentences:
Should Starting a Quick Game via Google Game Services be Iterated? I have been following this tutorial for Google Play Game Services.  I am a little unclear as to if the room matching algorithm should be looped or not.  Can I just initialize this process once and let it time out?  Or by iterating through it is it somehow rechecking it?  If anyone had the approximate timeout that would be great as well.

The problem stems from the fact that even when both phones are signing into the Game Services (at virtually the same time, my friend and I logged in), the room is not registering multiple people.  One time my friend's phone even entered the game map, showing that he somehow was able to progress from the room initialization process.

Relevant screen update methods which I am starting this matchmaking process:

@Override
public void update(float deltaTime)
{
    game.options.updateTiles();

    if(!isInitiated)
    {
        startQuickGame();
    }
}

private void startQuickGame()
{
    // auto-match criteria to invite one random automatch opponent.
    // You can also specify more opponents (up to 3).
    if(game.mGoogleClient.isConnected() && !isInitiated)
    {
        Bundle am = RoomConfig.createAutoMatchCriteria(1, 3, 0);

        // build the room config:
        RoomConfig.Builder roomConfigBuilder = RoomConfig.builder(Network.getInstance());
        roomConfigBuilder.setMessageReceivedListener(Network.getInstance());
        roomConfigBuilder.setRoomStatusUpdateListener(Network.getInstance());
        roomConfigBuilder.setAutoMatchCriteria(am);
        RoomConfig roomConfig = roomConfigBuilder.build();

        // create room:
        Games.RealTimeMultiplayer.create(game.mGoogleClient, roomConfig);

        // go to game screen
        this.mRoom = Network.getInstance().getRoom();
        if(this.mRoom != null && this.mRoom.getParticipants().size() >= 2)
        {
        game.setScreen(new MultiGameScreen(game, this.mRoom));
        isInitiated = true;
        }
    }
    else
    {
        game.mGoogleClient.connect();
    }
}

sentences:
How to make HLSL effect just for lighting without texture mapping? I created an effect and just want to use lightning but in default effect that XNA create we should do texture mapping or the model appears 'RED', because of this lines of code in the effect file:

float4 PixelShaderFunction(VertexShaderOutput input) : COLOR0
{
float4 output = float4(1,0,0,1);

return output;
}

If I want to see my model, I must do texture mapping by UV coordinates. But my model does not have UV coordinates assigned or its UV coordinates are not exported.

I do texture mapping by this line of code in vertexshaderfunction:

 output.UV= input.UV

When I use BasicEffect I have no problem and model appears correctly.

How can I use "just" lightings in my custom effects?

here is inside of my Model Using BasicEffect

This is my code for drawing with or without BasicEffect inside of my draw() method:

    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 part in mesh.MeshParts)
            {
                Effect effect = part.Effect;

                if (effect is BasicEffect)
                {
                    ((BasicEffect)effect).World = localWorld;
                    ((BasicEffect)effect).View = View;
                    ((BasicEffect)effect).Projection = Projection;
                    ((BasicEffect)effect).EnableDefaultLighting();
                }
                else
                {
                    setEffectParameter(effect, "World", localWorld);
                    setEffectParameter(effect, "View", View);
                    setEffectParameter(effect, "Projection", Projection);
                    setEffectParameter(effect, "CameraPosition", CameraPosition);
                }
            }
            mesh.Draw();
        }

setEffectParameter is another method that sets effect parameter if i use my custom effect.

sentences:
Set up indie game studio (UK) - how? I am UK based and am looking to set up my own game studio - essentially, just myself working from home, looking to build casual game apps. I want to ask you guys what steps or process i need to go through and do to make this happen, specifically the legal side of things. Will be great to hear from those who have been through this themselves! Need to register with HRMC as self employed is the only thing i know i have to do but what else?:

Do i need to register/trademark my own company/studio name? If so, where do i do this and does it cost money? Or can i just simply start using a name as is?
Do i need to also do this for any games/apps IP i make? Or is copyright automatically assumed?
I gather acting as sole trader is more appropriate at this stage? At what point, if ever, should i consider moving to an actual limited company setup?
Is it wise to open a new bank account solely for this business?

I think my plan was simply to:
1. Find a suitable domain name and create website based on my company name - assuming available and different enough from similar competitor names
2. Register as self employed with HRMC
3. Sell my game on app store

And thats it! Is this ok or do i need consider other stuff as well such as the questions above?

Thank you for reading and any advice you have!

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:
MMORPG - Representing Money in a DB table Where to begin... I'm currently busy with a few Udemy courses on game development using Unreal Engine 4. My end goal is to develop an MMORPG that I've always wanted to play, but never found online.

Q: How would I represent in-game money in a database table?

I've thought of adding it as a field in the "character" table, but then I struggle to see how I can implement it as a field in the "bank" table... Bank already has a quantity field, so I though about adding the money values as "items", but I just can't get myself to approve that...

Some information on the table fields:

Each players bank will have a size limit (upgrade-able) on how many items they can place in it. I was thinking of moving it out to the "character" table as it doesn't really have anything to do with the bank table...

As for the rest of the tables, I'm still working on them. For now I just wanted to get the communities opinion on how to represent money in an mmorpg database.

sentences:
High Performance Vector Graphics Solutions I'm looking for a high performance vector graphics library I can use in my games.

I'm thinking along the lines of vector graphics such as those that can be made with SVG.

I'll consider any language at the moment (but must run on Windows).
A solution that takes advantage of GPU hardware would be great.

Thanks in advance.

sentences: Are game manuals worthwhile anymore? Is there any point in including manuals with games today?  It seems like most manuals are more for background story or art than any actual help.  Additionally, it seems like most games are including "help" inside of their games in the means of tutorials or similar means.  Do enough users actually look at their manuals to make them worthwhile to include?

sentences:
How to Clamp rotation of a turret I'm going mad to clamp rotation of an object.

I've tested using Inspector that correctly rotation range is Z>-15 and Z<30.

I've written this code but it isn't working properly !

if (rb.transform.rotation.eulerAngles.z > 30)
    rb.transform.Rotate (-Vector3.forward * speedTurretMovement  , Space.Self);
if (rb.transform.rotation.eulerAngles.z < -15 )
    rb.transform.Rotate (Vector3.forward * speedTurretMovement , Space.Self);

Thanks

sentences:
Adding a function call to a prefabbed button in Unity For each of my scenes, I have an empty GameObject _Manager that stores my scripts for setting up the level, keeping track of variables, etc.

On my main screen, I have a play button that isn't instantiated; I simply dragged it into the editor. In my script Main.cs I have a function Play() which calls LoadLevel("Game"). To get my play button to call the Play function, I dragged _Manager into the onClick slot and selected the function. This worked fine and I have a functional play button.

Unfortunately, this is not working for the prefabbed buttons I need to instantaite in my Game scene. In Game.cs I have a function LayoutButtons() which is both public and returns void, yet I am unable to drag _Manager into the slot on my prefabbed button. Even if I do it before converting the button to a prefab, it simply disappears once it becomes a prefab.

I've managed to work around this by putting my LayoutButtons() function in a new script which I attached directly to the prefab, but I'd like to keep the function within Game.cs and attached to my manager object if that's possible.

sentences:
What are some examples of MMOs with small development teams? I'd like to see a list of MMOs with small development teams in order to better understand where small teams have found a place for themselves.

While examples of MMORPGs are of interest, so are games focusing on socializing, trade and commerce, city or empire building, crafting, exploration, strategy and so on.  Any shipping game supporting between, say 800 and 10,000 simultaneous players belongs on this list.

sentences:
Opengl shader questions I'm currently building a shader that takes a 2D texture sampler and uses UV coordinates to map it. This works fine for all textured objects. However, I'm having a bit of a problem as I'm trying to render a Mesh with no texture and the shader objects just keeps sampling based on the parameters of the last object I rendered. What is a good way to make sure whenever no texture is available it will just treat it as a white texture or something?

One thing I've thought of was creating and binding a white 1x1 texture but that seems overkill.

Related question:
I've been wondering about this and I've yet to find an answer: Is it best to make a multi-purpose shader or constantly change the shader program for different objects in the same render update? For instance, should I have just created a shader for non-textured objects?

sentences:
How can I animate/draw a line renderer over a given period of time I have created a line renderer using the code below:

public class MyLineRenderer : MonoBehaviour {
LineRenderer lineRenderer;

public Vector3 p0, p1;

// Use this for initialization
void Start () {
    lineRenderer = gameObject.GetComponent<LineRenderer>();
    lineRenderer.positionCount = 2;

    lineRenderer.SetPosition(0, p0);
    lineRenderer.SetPosition(1, p1);

    }
}

How can I write a coroutine that will animate/draw the line over specific duration, say 2 seconds?

sentences:
The A * algorithm in the map has many moving objects I am using the A * algorithm for my game, it is a kind of Isometric map with lots of tiles. If all the game objects are trees, rocks, houses and only one game object is a moving hero, the A * algorithm works well because then all objects are objects static except for my hero. I use a function: Check_Block (i, j) where i is the row and j is the column of the map. This function will return false if at that location there is a rock or house or tree, etc. But if there are many heroes moving together, I will not be able to use this function because the heroes are not in position permanent.

I have a solution if the hero is in a certain cell, Map [i] [j] = Hero. But if there are many heroes in the same box, I think this solution no longer good.
Can someone show me a solution?

sentences:
Small 3D Scene Graph I'm looking for a 3D graphics library (not a complete game engine). Preferred a scene graph. Something small (unlike jME, XNA or Unity), that I can easily expand and change.

Preferred features:

Cross Platform
Wrriten in Java/Scala (JOGL or LWJGL), C# (preferred OpenTK), Python or JavaScript/WebGL.
Support for OpenGL is a must. Direct3D is optional.
Some material system
Full support for some model format with full animation support (preferred COLLADA)
Level of Detail (LOD) support
Lighting support
Shaders, GUI, Input and Terrain/Water support are also preferred, but not required

Thanks!

sentences:
Unity + Oculus Rift - Setting field of view or rendering part of display I need to render a small portion of the display to a texture.

I found a script to simulate a scissor rect by modifying the projection matrix - Unity 5 doesn't seem to provide any out-of-the-box scissor functionality. However, modifying the matrix in this way causes my scene to render monoscopic.

Suggestions? There used to be an OVRCameraController class that provided a SetVerticalFOV() method, but that appears to have been removed from the SDK.

sentences: What is Surface.set_colorkey() in Pygame? In pygame, what does Surface.set_colorkey() do? Explain it in a very easy way please. Also, what exactly does it do? I heard it makes parts that are the same color as the colorkey transparent, but what is the point of that?

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:
Database vs classes in a rpg character sheet app for android i'm trying to develop an android app to handle character sheets in roleplay games like D&D and Pathfinder.

My target is to avoid calculations of bonuses by the player who only cares to set which talent is he using or by which magic he is afflicted.

The easiest way (imho) is to handle all talents and magic with classes, with methods that modify the attributes of the character class.

Another way is to store all talents and spells in a db and read from it when the user choose or use a talent or a spell.

Am i right saying that with 1st way i use more memory than the 2nd? (if not i'm choosing it)

If is better using db, I don't know how to save the data because is poorly structured:

Talent Improved Bluff: +2 to Bluff checks

Talent Speed: if the character wears no armor or light armor he moves 5 feet fast than his base speed

I can save the talent description as a meta-code string and parse it whithin the program but it seems too complicated. Do you have any better ideas for this db?

sentences: SGC toolkit for PyGame and resizeable windows Can I create a resizeable main window if I use the SGC GUI toolkit for PyGame? If so, how?

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:
Ways to present levels overview I'm working on a game that will have lots of (more than 100) levels. The player has to finish a level before she can play the next one, but also can play levels again that are already finished.

Now I'm looking for ways on how to present an overview of the levels to the player. A simple list (with a small graphic showing the level) is of course a possibility, but I wonder what other, perhaps less boring, ways there are.

sentences:
3D model exported from Maya behaving weirdly I have some 3-4 3D character models which are claimed to be exported with the same configuration from Maya by the 3d designers. Now, some of the models(animations) is working fine in Humanoid settings and not working in Generic mode and vice versa. The one which is working in Humanoid seems to have only one of its feet as crooked up. Though in maya, everything seems to work perfectly fine.

Now if there was some issue with the configurations while exporting, then it has to affect both its feet and not just one. I have also checked the T-Pose and automap settings in the Unity and everything seems to be fine.

Suppose for character A, all the animations work with Humanoid settings, then in Generic, for all animations it is kind of idle in a T-pose structure and do nothing not even simple walk animation.

I have been using Unity v5.0.1.

Please, if anyone could come up with any help would be highly appreciated.

sentences:
What is a good way to test demand for a new game platform? I'm working on a game platform that turns your iPhone, android or iPad into a steering wheel, for racing games (like need for speed and dirt 3) and flight simulators for example.

I'd love to figure out smart ways to figure out whether gamers would like something like this.

I originally asked this question over on the gaming SE and it was for getflypad.com. A lot of the tech is built and most of it is doable - the question here is how to test demand and know whether gamers actually want this.

sentences:
What is the best implementation of an automated tournament? Here are the specs so far to give you an idea to the question.

should be fully automate-able
should not inconvenience the player with regards to time
should allow for a voted wild card system
should involve skill
will be done on a limited time frame

Was thinking of using a ladder like system similar to battle net 2.0 but it would seem to need some tweaking to meet all of the above.

Any suggestions on what would be an ideal tournament implementation for such requirements?

sentences: GraphicsAdapter lacks a definition for CheckDeviceMultiSampleType The MSDN is really confusing about this, with all their different versions of XNA jumbled together for my google results. All I want to do is find out, in XNA 4.0, what antialiasing modes are supported by the display adapter. Supposedly, this involves calling GraphicsAdapter.CheckDeviceMultiSampleType(), but that function isn't defined. What should I be using in its place?

sentences:
How to design a game's software such that it is easy to unit test? Is it practical to use a testing framework like JUnit in a game development situation? What sort of design considerations can you follow in order to make your game more testable? What parts of a game can/should be tested and what parts should/must be left to human testing?

For example, if the game loop is encapsulated in one function, it seems like it would be terribly hard to test. I like to refactor out an "update" function that takes a time delta and moves forward the game logic; this allows some interesting tricks like the ability to slow the game down by feeding it fake, slower time deltas.

sentences:
how to create a curve movement of slider in unity I am trying to create a curved (not circular) movement of slider. Here is my demo images for reference:

I have watched some tutorial but those are for circle images. I want to make this movement along the arrow images below car. Also if this can be done with just images without using slider that will be ok too. I just this done the simpler and easy way.

sentences:
How to calculate the magnitude of the drag in Corona-sdk? I'm making a game on Corona that launches a ball.

The force is based on the magnitude of the drag: the larger is the drag -> the higher is the force.

I'm having some trouble to do this, because I can't calculate the magnitude of the drag.

I tried a simple (finalX - initialX) but that's not a good idea.

local function onTouch(event)

    if "began" == event.phase then

    end
    if "ended" == event.phase then
        local finalX = event.x
        local finalY = event.y

        forceX = event.x - event.xStart
        forceY = event.y - event.yStart

        print(forceX, forceY)

    end
end

local function gameComponents()
    local crate = display.newImageRect( "images/sonic.png", 90, 90 )
    crate.x, crate.y = 60, 360
    crate.rotation = 0
    --physics.addBody( crate, "static", { friction=0.3} )

    Runtime:addEventListener( "touch", onTouch )
    return crate

end

local Game = {}
Game.new = gameComponents
return Game

sentences:
Should I move the world or move the player? I'm about to start developing a sidescrolling game where the player's goal is to travel as far as he can in the horizontal axis before touching down. Note that I do not need to ever travel back on the horizontal axis.

I'm developing this with the AndEngine for Android which uses OpenGL and Box2d.

Before starting, I need to decide on something important: should I use the world around the player to simulate movement or actually move the player and follow him with the camera features of the game engine?

Both approaches seems to have different strengths and fallbacks, so I don't know which one is considered best. For example, what would make it easier to add power ups along the way and have a nice animated background?

Thanks!

sentences: How to find an object which is added to a scene only when game starts? I'm looking for some advice how to find an object which is added to scene only when the game starts? Before start it isn't in Scene hierarchy. It's prefab.

sentences:
Random.range giving me the same value at the same time I created a random direction in x and y-axis at where to move, then my problem is when I tried to randomize it sometimes I get the same value at the same time on both x and y-axis. How do I not let this happen, I only want one axis to have a value, not both?

ERROR

HOW I WANT IT TO HAPPEN

CODE

public Vector2 randomDirection;

void Awake()
{
}

void Update()
{
    randomDirection = new Vector2(Random.Range(-1, 2), Random.Range(-1, 2));
}

sentences:
Why does PIX suggest my frames are rendering out of order? When my application goes into a fullscreen state my movement is not smooth. It seems like frames are not rendered in the correct order, doing something like: 1, 3, 2, 4, 6, 5, ...
making the movement flicker.

For my PIX test, I draw really a low number of primitives (1140 triangle exactly) inside six vertex / index buffers. I clearly see a difference in the GPU frame "ordering" in PIX. Here is the result when in windowed mode:

PIX screenshot1 http://www.s33m3.be/PIX/PIX2.png

You can see that the GPU time needed for the frame is nearly in sync with the CPU time needed to generate it.

But in the fullscreen state here is what I got (same scene, without camera movement):

PIX screenshot2 http://www.s33m3.be/PIX/PIX.png

You can see that each GPU frame processing is split into at least two parts, and the GPU doesn't wait the end of a frame before starting another one.

What could cause this?

sentences: Building a windows game for Mac. I have a game that I made in Unity and I have a windows build for it. It works fine on windows no problems there but I want to make a mac version of it. To make a mac version will it work if I just build it for mac or will I have to reprogram it for mac? I don't have a mac to test this and obviously I dont want to release a broken game. Note that the game uses the command Input.GetMouseButtonDown(0) a lot, not sure if you need a different command for a mac mouse.

sentences:
What is the difference between expand(), grow() and fill() in libGDX? I am currently working with scene2d tables. But I am tired of using hit and trial to make the layout I wanted. Can anyone explain the meanings of expand, fill and grow? I need the behaviour like wrap_content and match_parent as in android.

Some code I tried is:

    Table contentTable = scoreDialog.getContentTable();
    contentTable.debugAll();

    Table topTable = new Table();
    topTable.debugAll();
    topTable.top();

    topTable.add(timeImage).colspan(2).pad(5);
    topTable.add(timeProgressBar).colspan(5).pad(5);
    topTable.add(bonusLabel).colspan(3).pad(5);
    topTable.row();
    topTable.add(alignImage).colspan(2).pad(5);
    topTable.add(alignProgressBar).colspan(5).pad(5);
    topTable.add(penaltyLabel).colspan(3).pad(5);

    contentTable.row();
    contentTable.add(topTable).colspan(10).pad(5).expandX().align(Align.center);
    contentTable.row();

    contentTable.add(scoreLabelDialog).colspan(10).pad(5).expandX().align(Align.center);
    contentTable.row();

    starsTable = new Table();
    starsTable.setHeight(50);
    contentTable.add(starsTable).pad(5).colspan(10).expandX().align(Align.center);

sentences:
Blender support for Android I want to design 3D games for my android smart phone. Though I that two powerful game development software like Blender (under Linux) supports 3D game development. My question is:

How can a game developed under Blender can be exported to Android devices?

sentences:
How to publish a Unity desktop game without a security warning? When I build a Unity game as a Windows Desktop application, zip the folder, and upload the zip to itch.io, then anyone downloading the zip from itch.io and running the game gets a security warning from Windows.
Is there a way to build the game in a way that will not show this warning?

sentences:
How to design a GUI / controls system classes I'm at the stage when I need to develop some kind of GUI with windows, clickable buttons, etc. It's going to be a RPG game so these components will be used extensively so I want them to be as flexible as possible.

I was thinking about something like winform controls funcionality though much simpler, I don't think I'll need anything more than a window/panel, button, label and image controls.

So far I made abstract Component class which basic attributes like position, width/height
and two events - mouseover and click. All controls will be derived from this base class.

public abstract class Component
{

    public event EventHandler MouseOver;
    public void OnMouseOver()
    {
        if(MouseOver != null)
            MouseOver(this, null);
    }

    public event EventHandler Click;
    public void OnClick()
    {
        if (Click != null)
            Click(this, null);
    }

    private Rectangle componentRectangle;
    private bool isVisible;

}

My question is how to integrate my controls with the rest of the game, I was thinking about something like GUIManager class that would contain the list of controls and manage displaying them and firing events. I'll be calling the update method somewhere in the game loop.

public class GUIManager
{
    private List<Component> componenets;

    public void Update(Vector2 mouseLocation)
    {
        foreach (Component component in componenets)
        {
            if (component.IsVisible)
            {   // mouse is over component
                if (component.ComponentRectangle.Contains((int)mouseLocation.X, (int)mouseLocation.Y))
                {
                    component.OnMouseOver();
                }
            }
        }
    }
}

Now lets say I want to show character's inventory screen. Is it a good way to just create the controls, add events and then them to GUIManager's controls list to take care of it? Or maybe you can suggest some entirely diffrent approach?

sentences:
Terrain not rendering like it should be i was following this tutorial here: https://www.youtube.com/watch?v=yNYwZMmgTJk, in which i was translating from Java to C++ to generate a terrain, and stumbled across this issue:

As it appears, it is rendering lines instead of triangles. i have checked, glDrawArrays() which was drawing triangles like normal. i checked the generator and the textures which was normal. But when i put in verticies manually it drew the terrain normally. This then leads to me suspecting that the error is in the terrain generator. another possibility, but least likely, is that i suspect is that i am not passing the data to the vertex and fragment shader correctly.

here is the terrain generator code:

const int vertex_count = 128;
const int size = 800;

GLfloat vert[(vertex_count * vertex_count) * 3]{
    0
};

GLfloat norm[(vertex_count * vertex_count) * 3]{
    0
};

GLfloat texCoord[(vertex_count * vertex_count) * 2]{
    0
};

int vertexPointer = 0;

for (int i = 0; i < vertex_count; i++) {
    for (int j= 0; j < vertex_count; j++) {
        vert[vertexPointer * 3] = -(float)j / ((float)vertex_count - 1) * size;
        vert[vertexPointer * 3 + 1] = 0;
        vert[vertexPointer * 3 + 2] = -(float)i / ((float)vertex_count - 1) * size;

        norm[vertexPointer * 3] = 0;
        norm[vertexPointer * 3 + 1] = 1;
        norm[vertexPointer * 3 + 2] = 0;

        texCoord[vertexPointer * 2] = (float)j / ((float)vertex_count - 1);
        texCoord[vertexPointer * 2 + 1] = (float)i / ((float)vertex_count - 1);

        vertexPointer++;
    }
}

and glDrawArrays():

 glDrawArrays(GL_TRIANGLES, 0, sizeof(vert));

and passing the data to the fragment and vertex shaders:

GLuint vao, vbo;
glGenVertexArrays(1, &vao);
glBindVertexArray(vao);
glGenBuffers(1, &vbo);
glBindBuffer(GL_ARRAY_BUFFER, vbo);
glBufferData(GL_ARRAY_BUFFER,sizeof(vert), vert, GL_STATIC_DRAW);
glVertexAttribPointer(0, 3, GL_FLOAT, GL_FALSE, 0, 0);
glEnableVertexAttribArray(0);

GLuint vbo2;
glGenBuffers(1, &vbo2);
glBindBuffer(GL_ARRAY_BUFFER, vbo2);
glBufferData(GL_ARRAY_BUFFER, sizeof(texCoord), texCoord, GL_STATIC_DRAW);
glVertexAttribPointer(1, 2, GL_FLOAT, GL_FALSE, 0, 0);
glEnableVertexAttribArray(1);

GLuint vbo3;
glGenBuffers(1, &vbo3);
glBindBuffer(GL_ARRAY_BUFFER, vbo3);
glBufferData(GL_ARRAY_BUFFER, sizeof(norm), norm, GL_STATIC_DRAW);
glVertexAttribPointer(2, 3, GL_FLOAT, GL_FALSE, 0, 0);
glEnableVertexAttribArray(2);

sentences: Keeping camera at player's back I'm developing a 3D game similar to the Roller Ball game from Unity's tutorials mixed with a runner type game like Subway Surfers.  The game uses the arrow keys for control.  When the player hits the left or right arrow key, I want the player to do a 90 degree turn and have the camera stay behind the player.  My questions are, how would I do this?  Would I need to do this in my player controller script and just change the rotation?  Or would I need to add some controls to the camera and change the rotation of the camera every time the player hits the right or left key?

sentences:
Convert global 3d coordinate system to a local one with specific direction Imagine a (x,y,z) coordinate system within a solar system, with (0,0,0) beeing the center of sun where Z axis goes thru both solar poles.

I'm standing on a planet inside a house within that solar system.

Now from my perspective Z axis is skewed in unknown direction depending on where exactly the planet is at this moment.

What would be the steps I should take to create a local coordinate system with (0,0,0) being the house and where Z axis is perpendicular to the ground/house, so that I would be able to convert coordinates from local to global.

I have the global coordinate of my house and directional vectors for where is up/forward/right for my house.

I have some limited knowledge of vector math and projecting vectors on other surfaces, but there is a gap in my understanding that keeps me from solving this.

local housePos = vec(getHouseWorldPosition())        -- (x,y,z) position of house in global cooridnates (housePos.x,housePos.y,housePos.z)

local vRight = vec(getHouseWorldOrientationRight())  -- X directional normalized vector
local vForw = vec(getHouseWorldOrientationForward()) -- Y directional normalized vector
local vUp = vec(getHouseWorldOrientationUp())        -- Z directional normalized vector

local playerPos = vec(getPlayerWorldPosition())      -- players position in global coordinates

--Now how to get players position in coordinate system relative to housePos, with Z axis going along vUp vector

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

Here are the textures that are "bleeding":

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

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

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

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

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

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

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

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

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

        float pixelCorrection = 0f;

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

        GL11.glEnd();

        GL11.glLoadIdentity();
    }

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

sentences:
2d starship combat, hit chances based on bearing and speed (vector)? Thinking about a 2d strategy game, where you move your starships turn by turn and fire guns at each other.

Instead of the traditional approach of "range" lowering hit chances, im thinking about some sort of system that throws vectors at each other to calculate relative bearing and speed to calculate hit chances.

I.e. a fast, small ship is harder to hit than a slow, big chip, but in addition the relative bearing (im thinking: is the target flying straight towards your X/Y = good hitchance, or is it strafing very narrowly, low hitchances depending on speed).

Getting the relative the bearing (angle) on an approaching vessel would be easy using atan2, but how could this be translated it into a hitchance that goes up if the angle is like 330 to 30 degree and goes down if its different (as an example) ?

sentences:
Python collision problem I have a hero character with jumping physics that I am trying to figure out the collision detection for. Right now, the problem that I am running into is as soon as the character hits the floor (while I'm pressing left on the left side of the screen) the rect that it recognizes that it is colliding with is the ground. Which is to be expected.
However, based on the checks that I have,
for sprite in self.group.sprites():
        wall_collide = sprite.feet.collidelist(self.walls)
        if wall_collide > -1:
            print wall_collide
            if self.col_ground(sprite, wall_collide):
                self.hero.jumping = False
                sprite.move_back_y(dt)
            if self.col_left(sprite, wall_collide):
                sprite.move_back_x(dt)
            if self.col_right(sprite, wall_collide):
                sprite.move_back_x(dt)
            print ""

since the character is colliding with the ground, the check to see if the character's rect is inside the colliding rect fails for 2 reasons:
1: The current collision rect is the ground which the character is above, so the test fails
2: Because of #1, the character will keep moving left until it realizes it's colliding with the left side, at which point it will have already gone too far into the wall.
What's the best collision solution?
Note: the character starts to the right of the left wall, on the ground but isn't colliding with the ground since the start position is right above it. Also, I realize that my code is a bit jumbled and I'm not taking care of every sprite in the group. I'll fix that once I have this fixed.
I can provide more code/pictures if necessary
Edit:
More code
def col_ground(self, sprite, wall):
    if self.walls[wall].collidepoint(sprite.feet.midbottom):
        return True
    return False

def col_left(self, sprite, wall):
    if self.walls[wall].collidepoint(sprite.feet.midleft):
        return True
    return False
def col_right(self, sprite, wall):
    if self.walls[wall].collidepoint(sprite.feet.midright):
    return True
return False

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:
Creating a BufferedImage with several smaller images? I am making a 2D tile based game. The tiles render fine from a spritesheet and a text file. However, I am using a for loop to draw the map to the screen. When it refreshes, it slows down the loop, and the bottom is black for a fraction of a second.

I was wondering if I could create a separate method to create a BufferedImage to hold the map, so I could render it continuously, and change it when needed.

Map Class:

package uk.co.madmonkeystudios.distortioner;

import java.awt.Graphics2D;
import java.awt.image.BufferedImage;
import java.io.File;
import java.io.FileNotFoundException;
import java.io.IOException;
import java.util.Scanner;

import javax.imageio.ImageIO;
import javax.swing.JOptionPane;

public class Map {

    static BufferedImage sheet;

    public static void SetSpriteSheet() throws IOException{
        sheet = ImageIO.read(new File("res/grid.png"));
    }

    public static BufferedImage GetTile(int id) throws IOException{
        if(sheet == null){SetSpriteSheet();}

        int across = 24;

        BufferedImage tile = null;
        int x = 0;
        int y = 1;
        int w = 31;
        int h = 31;
        for(int done = 0;done<id;done++){

            x= done * w;
            x += id;
            if(done >= across){
                y += h;
                y++;
            }

        }
        tile = sheet.getSubimage(x, y, w, h);

        return tile;
    }

    public static void DrawMap(int id) throws IOException{

        Graphics2D g = (Graphics2D)Core.myself.getGraphics();

        g.clearRect(0,0,640,480);

        int[][] map = ReadMap(0);

        int xsize = map.length;
        int ysize = map[0].length;
        System.out.println("Map Read, size (" +xsize + "," +ysize+")");

        int x = Player.x;
        int y = Player.y;

        for(int loopy = 0;loopy<ysize;loopy++){
            for(int loop = 0;loop<xsize;loop++){
                g.drawImage(GetTile(map[loop][loopy]),loop * 32 + x, loopy * 32 +y + 25,32,32,null);
            }
            }
    }

    public static int[][] ReadMap(int id){
        int [][] map = null;
        try{
        @SuppressWarnings("resource")
        Scanner s = new Scanner(new File("res/maps/area"+id+".map"));
        int [][] map1 = new int[Integer.parseInt(s.next())][Integer.parseInt(s.next())];
        String current;

        int xsize = map1.length;
        int ysize = map1[0].length;

        for(int loopy = 0;loopy<ysize;loopy++){
        for(int loop = 0;loop<xsize;loop++){
            current = s.next();
            map1[loop][loopy] = Integer.parseInt(current);
        }
        }
        map = map1;
        }catch(NullPointerException ex70){
            System.err.println("Cannot read map in area ID " +id);
            JOptionPane.showMessageDialog(null, "Couldn't read map...","",JOptionPane.ERROR_MESSAGE);
            System.exit(1);
        }
        catch(FileNotFoundException ex71){
            System.err.println("Cannot find map in area ID " +id);
            JOptionPane.showMessageDialog(null, "Couldn't read map...","",JOptionPane.ERROR_MESSAGE);
            System.exit(1);
        }
        catch(ArrayIndexOutOfBoundsException ex72){
            System.err.println("Cannot add map to array in area ID " +id);
            JOptionPane.showMessageDialog(null, "Couldn't send map...","",JOptionPane.ERROR_MESSAGE);
            System.exit(1);
        }

        return map;
    }

}

sentences:
How to stop objects pushing each other away on collision? I'm creating something along the lines of Super Smash Brothers. There's a problem with the collision between the two players and projectiles.

We have rigid body on the characters and projectiles and every time they collide they push one another back, I know that is how it operates but is there a way to stop that from happening?

sentences:
Pixel Shader stage did not run I can't figure out why the pixel shader won't run. I'm using the Blinn-Phong per-pixel shader from here. Only change I've made is that I pass an aditional color per vertex which gets multiplied by the light-color in the pixel shader.

So far the Graphics Analyzer shows me a valid IA-result and the same (okay looking) result in the VS-stage. I disabled depth-stencil for testing and though everything looks rather fine I always see "Stage did not run. No output." when I inspect the captured frame.

This is my Projection-matrix:

_projection = Matrix.PerspectiveFovLH((float) Math.PI / 4.0f, viewports[0].Width / viewports[0].Height,
            0.1f, 100f);

Values are Width: 1346, Height: 800

My View is calculated like this:

_rotation = Quaternion.RotationYawPitchRoll(Yaw, Pitch, Roll);
Vector3.Transform(ref _target, ref _rotation, out _target);

Vector3 up = Vector3.UnitY;
Vector3.Transform(ref up, ref _rotation, out up);

_view = Matrix.LookAtLH(Position, _target, up);

Whereas Position: X:50, Y:50, Z:-300, Target: X:50, Y:50, Z:0 and Yaw, Pitch, Roll are all 0.

World-Matrix is currently Matrix.Identity.

The quad I try to render spans itself from X:0, Y:0 to X:100, Y:100 with 4 vertices and 6 indices.

I first thought that SV_POSITION must be a normalized value since it's obviously a SV-coordinate and someone posted in another thread that this solved his problem - but then the VS-stage does not show anything at all and PS still won't run.

It's been quite some years since I last worked with DirectX so I'm not sure anymore why this happens.

sentences:
Installing PhysicsFS on Mingw I am trying to install PhysicsFS (icculus.org/physfs/) on my Win 7 with MinGW. But I am having hard time doing it. I googled it as well but still nothing - I have used linux environment and make toolchain before (not CMake though) - but I guess I am a bit rusty.

I tried following all the directions in INSTALL.txt and google - but here is what I managed till now.

I have MinGW installed and manually installed CMake as well. Now I download the src from the site and do cmake -G "MinGW MakeFiles

The next this is what bemused me - Well I haven't encountered it before - I do make and expect it to make the files but instead it goes into Windows Command Prompt. And then I am lost.

PART 2 -

I am fairly new MinGW - I was wondering if I want to develop do I compile from source or just install the developing package - as I understand compiling from source would give me both ( dev packages as well as binaries/static libs), right? Please correct me if I am wrong.

sentences:
How do I create a toggle button in Unity Inspector? I want to create a tool similar to Unity's Terrain tool, which has some nice toggle buttons in the inspector:

How can I achieve similar design to this? I know how to create normal buttons and other UI components in the inspector, but I can not find enough information to make the buttons toggle.

So far I have used normal toggles that produce a checkbox:

var tmp = EditorGUILayout.Toggle( SetAmountFieldContent, _setValue );

if ( tmp != _setValue )
{
  _setValue = tmp;
  if ( _setValue )
    _smoothValue = false;
}

tmp = EditorGUILayout.Toggle( SmoothValueFieldContent, _smoothValue );

if ( tmp != _smoothValue )
{
  _smoothValue = tmp;
  if ( _smoothValue )
    _setValue = false;
}

Setting the toggle GUIStyle to "Button" does not produce the wanted result. The text or image content goes on left of the button instead of inside.

var tmp = EditorGUILayout.Toggle( SetAmountFieldContent, _setValue, "Button" );

Also none of the options found in GUISkin does not seem to help.

sentences:
Using raw vertex information for sprites rather than SpriteBatch in XNA I have been wondering whether using SpriteBatch is the best option. Obviously for prototyping or small games it works well.
However, I've been wanting to apply techniques such as shaders and lighting to my game. I know you can use shaders to some extent with SpriteSortMode.Immediate, but I'm not sure if you lose power using that.

The other major thing is that you cannot store your vertex data in the graphics memory with buffers.

In summary, is there an advantage of using VertexTextureNormal (or whatever they're called) structs for vertex data for 2D sprites, or should I stick with SpriteBatch, provided I wish to use shaders?

sentences:
How do I move a camera to a new X and Y position when the player collides with a certain object? The lowdown is this: I'm making a 2D overhead game that takes place in separate screens in a room. Each screen is separated by a few blocks of black space (to give the impression of screens being separate rooms) and a rectangular "transition block" in doorways. My idea is, once a player touches this block, they are moved to the next adjacent screen along with the camera instantly.

I can move a player to the next screen this way, the big hangup that I'm having is moving the camera as well. I want every collision box to have the coordinates needed to set the camera around the next screen once player-box collision happens, similar to the setup I have with the player character.

sentences:
What is the hardest thing in game development process? I am new to the game-dev area, although I have professional experience in programming and some other qualities like making graphics in Photoshop or 3D modelling. Currently I am learning one widely used game engine connected with another free 3D modeling tool and my problem is that from my beginner's perspective, it all seems relatively easy and I know that this is not true. Right now It seems I can find all knowledge I need in some online tutorials, courses and if something is missing I can still ask a question on websites such as this one.
I plan to do an FPS multiplayer game as my first game and I wonder what is the hardest (most time, energy or money consuming) stage of game development in 2020?
I am asking because right now I think I can make 30-50% (prototype and some assets like 3d models) of the game myself in around year period of time and maybe later get more money to finish the project, but I know it is not true and this is only my beginner's unexperienced imagination, because similar games are usually being done by a team of experienced developers and their games still have bugs, glitches and other issues and I know some other similar but amateur projects that were started by one or two people and eventually were abandoned due to unknown reason (mostly lack of time I assume). So I am wondering what are the stages that cause most amateurs to fail and abandon their ideas, is it modeling, programing, networking, debugging?

sentences:
How to calculate a movement Vector3 to kill unnecessary momentum and start moving in the right direction? Imagine a rocket is accelerating in a straight line toward PointA, picking up momentum every frame, then suddenly decides it wants to go toward PointB instead.

It can't just turn straight toward PointB and start accelerating, because the new acceleration plus the pre-existing momentum will carry it wildly off-course, and not straight toward PointB.

It could turn exactly 180° around to aim directly away from PointA and thrust until it comes to a stop, then turn toward PointB and start accelerating from scratch. But that's very inefficient, especially if the two points are in generally similar directions.
It would be more efficient to turn and start accelerating in some specific direction that will bleed off the unnecessary momentum but keep any useful momentum, course-correcting so that it is now moving toward PointB.

I'm trying to figure out how to calculate that "specific direction" that the rocket needs to start accelerating toward, in order to efficiently reach PointB. I have the rocket's position, the Vector3 of its inertia, and the Vector3 locations of PointA and PointB, but I'm not experienced enough in Vector Math to totally understand what's needed.
Especially since we're talking about acceleration (not just speed), so the angle will no doubt need to be recalculated each frame as the changing momentum leads to a changing angle toward PointB, etc.
Can anyone help me out?

sentences:
Where does the roughness map go? So I used Quixel, and created a great item. I want to view it in Unity with all the maps the problem however is I have 5 maps but only know how to insert 4.

Diffuse
Normal
AO
Specular
Roughness

I don't see a slot for roughness (AKA gloss).

sentences:
Collision and changing the scene. C# I'm running into a problem where I want to create some code that such that if an object (Cube) is destroyed, it to changes to another scene.

Here is my code:

public class Move : MonoBehaviour {

    void playerWalk()
    {
        var x = Input.GetAxis("Horizontal") * Time.deltaTime * 150.0f;
        var z = Input.GetAxis("Vertical") * Time.deltaTime * 3.0f;

        transform.Rotate(0, x, 0);
        transform.Translate(0, 0, z);
    }

    void OnCollisionEnter(Collision col)
    {
        if (col.gameObject.name == "Cube")
            Destroy(col.gameObject);
    }

    void Update ()
    {
        playerWalk();
        if (Input.GetKeyDown(KeyCode.B))
            print("hello");
    }
}

What do do I need to do?

sentences:
How to have qt5 work on desktop like on mobile devices (es2, correct glsl version)? I am looking for help/information concerning this issue :

My work: I have an opengl es2 render engine that works on an iOS app. I almost managed to make it work by calling the same openGL rendering engine from a Qt(4.8 first, then 5.0 since today) app with a QGLWidget. To support es2 function set my widget also inherits QGLFunctions (QtOpenGLFunctions with qt 5.0.0).

However I still have issues with shaders : I could not compile them on qt with glCompileShader because of almost every keywords (lowp, vec4, vec2 …) were returning compilations errors. So I compiled it with QOpenGLShader program, but I had to specify “#version 120”, the closest to es2. But still, my sprites don’t show up the right size and the only potentially influencing different pieces of code with iOS are in shader compilation / version. I think the issue in the shader is that gl_PointSize is not taken into account.

Is there any better way for me to have shaders compiled on qt like they are on iOS ? ( I know glsl es2 version is coming from version 120 but I don’t know to what extent they differ ).
The hello-gl-es2 example did not help me because glsl version also returns 1.20.

I’ll happily receive any hints, thank you !

My shaders, working well on iOS but not on Qt:

const GLchar vShaderStr[] =
#ifdef  __BUILD_DESKTOP__
"#version 120\n" // necessary for Qt to compile shaders
#endif //__BUILD_DESKTOP__
"attribute lowp vec4 Position;\n"
"attribute mediump vec2 TextureCoord;\n"
"attribute lowp float Weight;\n"
"uniform mat4 MVP;\n"
"varying mediump vec2 TextureCoordOut;\n"
"void main(void)\n"
"{\n"
"  gl_Position = MVP * Position;\n"
"  TextureCoordOut = TextureCoord;\n"
"  gl_PointSize = Weight;\n"
"}\n";

const GLchar fShaderStr[] =
#ifdef  __BUILD_DESKTOP__
"#version 120\n" // necessary for Qt to compile shaders
#endif //__BUILD_DESKTOP__
"varying mediump vec2 TextureCoordOut;\n"
"uniform sampler2D Sampler;\n"
"uniform bool IsSprite;\n"
"uniform lowp vec3 TextureColor;\n"
"uniform lowp float Opacity;\n"
"void main(void)\n"
"{\n"
"   lowp vec4 textureColorResult;\n"
"   textureColorResult = texture2D(Sampler,  IsSprite ? gl_PointCoord : TextureCoordOut);\n"
"   gl_FragColor = IsSprite ? vec4(mix(textureColorResult.rgb,TextureColor, 1.0),\n"
"                    textureColorResult.a * Opacity) : textureColorResult;\n"
"}\n";

Edit : replaced preprocessor QT_OPENGL_LIB with custom BUILD_DESKTOP as the first is no more declared in qt5.

sentences:
How can I fix this error about loading .wav assets in MonoGame 3.2? I'm trying to add a music file to my project, but I get the error "Could not load EpicScores.wav asset!"

I load the music file like this:

Song sound1 = Content.Load<Song>(@"EpicScoreCreatorOfWorlds.wav");

I've tried both with and without the .wav ending.

My file is added to the Content folder, and I've made sure my file properties are set to the "Content" build action and to "copy always."

Why do I get this error and how can I fix it?

sentences:
What is the genre defined by getting as far as possible along an infinite level called? I am interested in making a mobile game in the style of an infinite hallway. Like Jetpack Joyride where the background moves and you just steer your guy up or down to avoid stuff. You can have a glimpse here on YouTube of what it looks like.

I have never made one before, in fact, I have no idea what that genre is called...

What is this genre called?

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:
Algorithms for positioning rectangles evenly spaced with unknown connecting lines I'm new to game development, but I'm trying to figure out a good algorithm for positioning rectangles (of any width and height) in a given surface area, and connecting them with any variation of lines.  Two rectangles will never have more than one line connecting them.

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

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:
Calculating normals after displacement mapping I'm using C++, DX11 and tessellation. After tessellating a triangle I apply displacement mapping to the new vertices. But they still have the original triangle's normal so the lighting calculation behaves like the surface was flat.

So I see two solutions: sampling a normal map (corresponding to the displacement map) or sampling the displacement map in a few more places to calculate the normal myself (both would be done in the shader).

Since I'm using already using another normal map (with more detail than the displacement map contains) a 2nd normal map seems a little like an overkill. And calculating the normals myself seems inefficient.

Both solutions would work though so my dilemma is really this - am I overthinking it? Should I just go with one of the above solutions? Or is there a better approach?

sentences: How is math connected to video games? I have to do a project for my math class in which I choose a topic and connect concepts we learned to it. I chose video games, and I was hoping someone could help me. Possible concepts: Quadratics, statistics, probability, vectors, trigonometry, etc. Or, if this is a terrible topic to write a minimum of 6 pages on, please tell me. P.S. I know absolutely nothing about code, programming, any of that.

sentences: How can I handle a 2d game with tens of thousands of sprites rendering at the same time? We are trying to make a small 2d game which requires an excessive amount of sprites spawning and moving around the screen at the same time. We did try doing this in python but it started choking at around the 500 mark. Are there any good ways to handle this in python?

sentences:
How to make a tile that can be stretched out I was playing angry birds and I saw that the elastic used to throw the birds is a texture that expands well when you push it with your finger.

How can textures like this be made in java with libgdx? What are the techniques used in cases like this?

I am asking this because it is obvious that in this situation they did not used a bunch of tiles to make an animation and I have no idea how it is made.

Thanks

sentences:
How to make borders glow in a 2D game? How can I make the borders (stationary / non moving) of my 2d Unity game glow?
I need a method that is not so expensive. I've read that post processing is very expensive, but I quite liked adding bloom to my scene. It was pretty straight forward.
But now I'm reading that one shouldn't use it, it's expensive, not so good etc.

sentences:
How do I efficiently code both the client and server at the same time? I'm coding my game using a client-server model. When playing on singleplayer, the game starts a local server, and interacts with it just like a remote server (multiplayer). I have done this to avoid coding separate singleplayer and multiplayer code.

I have just started coding and have encountered a major problem. Currently I'm developing the game in Eclipse, having all the game classes organized into packages. Then, in my server code, I just use all the classes in the client packages.

The problem is, these client classes have variables that are specific to rendering, which obviously wouldn't be performed on a server.

Should I create modified versions of the client classes to use in the server? Or should I just modify the client classes with a boolean, to indicate if its the client/server using it. Are there any other options I have? I just had a thought about maybe using the server class as the core class, then extending it with rendering stuff?

sentences:
How do I get objects using layer name? 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.

I want to find all of the player objects on the network that have a specific layer name, and store them into an array when the player spawns on the network. I've been able to add the object to the array, but I can't find the layer's objects with what I found with Google searches.

LayerMask.NameToLayer("LayerName");

LayerMask.LayerToName(8);

This returns the name of layer and layer index. How can I get the objects using a specific layer name, and also store it in to an array?

sentences:
Ensuring that a randomly generated galaxy wont place stars inside one another? I'm attempting to build a game with a spiral galaxy design. In doing so I followed a short guide on making the rough layout of the galaxy.

My code works, but the "stars" (I'm bad with variable names, in this code "star" refers to the central star of a solar system) often clip into one another. Is there a way for me to ensure that no stars will intersect?

Code below is what I'm using to generate my galaxies.

    for(var i = 0; i < starCount; i++) {
    var distance : float = Random.Range(minDistance, maxDistance);
    distance = Mathf.Pow(distance, 2);

    // Choose an angle betweeen 0 and 2*PI
    var angle : float = Random.Range(0.0 , 1.0) * 2 * Mathf.PI;
    var armOffset : float = Random.Range(0.0,1.0) * armOffsetMax;

    armOffset = armOffset - armOffsetMax/2;
    armOffset = armOffset * (1/distance);

    var squaredArmOffset : float = Mathf.Pow(armOffset, 2);
    if(armOffset < 0) {
        squaredArmOffset = squaredArmOffset * -1;
    }
    armOffset = squaredArmOffset;

    var rotation : float = distance * rotationFactor;

    angle = Mathf.Round(angle/armSeparationDistance) * armSeparationDistance + armOffset + rotation;

    //Convert polar coordinates to 2D cartesian ones
    var starX : float = Mathf.Cos(angle) * distance;
    var starY : float = Mathf.Sin(angle) * distance;

    var randomOffsetX : float = Random.Range(0.0, 1.0) * randomOffsetXY;
    var randomOffsetY : float = Random.Range(0.0, 1.0) * randomOffsetXY;

    starX += randomOffsetX;
    starY += randomOffsetY;

    var newStar : Transform = Instantiate(star, Vector3(starX, starY), Quaternion.identity);
    newStar.transform.parent = center;
}

sentences:
Changing node's translation affects to sibling node I have a node which looks like this tree:

FPSController (Root node, and it's KinematicBody)

CollisionShape
Camera
GroundCheckRayCast

When I moved CollisionShape's location down, camera also going down together. There's no code that change Camera's translation, but why this kind of thing happens?

Another weird thing is that y position of Camera won't changed even it's clearly moved down.

Is this some kind of bug or something? Why Camera's y position was changed, also not updated it's own y position value?

Using Godot 3.1.1 and reproduced repo: https://github.com/rico345100/godot-glitch-reproduction

sentences:
What's the process for making a PS4 game? Now that Sony has said that devs can self publish for PS4, I'm betting that a lot more people will be interested in producing games for that platform.

What is the process for getting the SDK, documentation, and testing environment for a PS4?

sentences:
Calculate required position to keep object centered when camera is rotated I always want to keep an object in the center of view of a camera.
When the camera's rotation X value is -45, the object should still be centered.

Therefore I need to calculate the new position of the camera.

How could the "required camera position Y value" be calculated?

Thank you.

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:
Computer generated 2d graphics for games - how to get started I've seen a lot of nice 2d games recently, like Geometry wars that have really nice computer generated graphics.

I would like to know how is it done so game looks really nice even if it is composed only from really primitive graphic objects. All those lights, glowing particles, transformations etc.

Do you have any tips, info, books, articles that would uncover some details about creating graphics this way?

And what about development for all the mobile platforms, any good frameworks for this kind of work?

sentences:
Simple OpenGL program major slow down at high resolution I have created a small OpenGL 3.3 (Core) program using freeglut. The whole geometry is two boxes and one plane with some textures. I can move around like in an FPS and that's it. The problem is I face a big slow down of fps when I make my window large (i.e. above 1920x1080). I have monitors GPU usage when in full-screen and it shows GPU load of nearly 100% and Memory Controller load of ~85%. When at 600x600, these numbers are at about 45%, my CPU is also at full load. I use deferred rendering at the moment but even when forward rendering, the slow down was nearly as severe. I can't imagine my GPU is not powerful enough for something this simple when I play many games at 1080p (I have a GeForce GT 120M btw). Below are my shaders,

First Pass

#VS
#version 330 core

uniform mat4 ModelViewMatrix;
uniform mat3 NormalMatrix;
uniform mat4 MVPMatrix;

uniform float scale;

layout(location = 0) in vec3 in_Position;
layout(location = 1) in vec3 in_Normal;
layout(location = 2) in vec2 in_TexCoord;

smooth out vec3 pass_Normal;
smooth out vec3 pass_Position;
smooth out vec2 TexCoord;

void main(void){

    pass_Position = (ModelViewMatrix * vec4(scale * in_Position, 1.0)).xyz;
    pass_Normal = NormalMatrix * in_Normal;
    TexCoord = in_TexCoord;

    gl_Position = MVPMatrix * vec4(scale * in_Position, 1.0);
}

#FS
#version 330 core

uniform sampler2D inSampler;

smooth in vec3 pass_Normal;
smooth in vec3 pass_Position;
smooth in vec2 TexCoord;

layout(location = 0) out vec3 outPosition;
layout(location = 1) out vec3 outDiffuse;
layout(location = 2) out vec3 outNormal;

void main(void){
    outPosition = pass_Position;
    outDiffuse = texture(inSampler, TexCoord).xyz;
    outNormal = pass_Normal;
}

Second Pass

#VS
#version 330 core

uniform float scale;

layout(location = 0) in vec3 in_Position;

void main(void){
    gl_Position = mat4(1.0) * vec4(scale * in_Position, 1.0);
}

#FS
#version 330 core

struct Light{
    vec3 direction;
};

uniform ivec2 ScreenSize;
uniform Light light;

uniform sampler2D PositionMap;
uniform sampler2D ColorMap;
uniform sampler2D NormalMap;

out vec4 out_Color;

vec2 CalcTexCoord(void){
    return gl_FragCoord.xy / ScreenSize;
}

vec4 CalcLight(vec3 position, vec3 normal){

    vec4 DiffuseColor = vec4(0.0);
    vec4 SpecularColor = vec4(0.0);

    vec3 light_Direction = -normalize(light.direction);
    float diffuse = max(0.0, dot(normal, light_Direction));

    if(diffuse > 0.0){
        DiffuseColor = diffuse * vec4(1.0);

        vec3 camera_Direction = normalize(-position);
        vec3 half_vector = normalize(camera_Direction + light_Direction);

        float specular = max(0.0, dot(normal, half_vector));
        float fspecular = pow(specular, 128.0);
        SpecularColor = fspecular * vec4(1.0);
    }
    return DiffuseColor + SpecularColor + vec4(0.1);
}

void main(void){

    vec2 TexCoord = CalcTexCoord();
    vec3 Position = texture(PositionMap, TexCoord).xyz;
    vec3 Color = texture(ColorMap, TexCoord).xyz;
    vec3 Normal = normalize(texture(NormalMap, TexCoord).xyz);

    out_Color = vec4(Color, 1.0) * CalcLight(Position, Normal);
}

Is it normal for the GPU to be used that much under the described circumstances? Is it due to poor performance of freeglut?

I understand that the problem could be specific to my code, but I can't paste the whole code here, if you need more info, please tell me.

sentences:
Problem WIth Enemies Bullets PyGame I am trying to make my enemy shoot my player but for some reason the bullets arent showing nor they are shooting at the player I don't even know why, I even draw the bullets on my window  VIDEO

bulls = []
runninggame = True
while runninggame:
    clock.tick(FPS)
    for event in pygame.event.get():
        if event.type == pygame.QUIT:
            runninggame = False

    for bull in bulls:
        if bull.x < 500 and bull.x > 0:
            bull.x += bull.vel  # Moves the bullet by its vel
        else:
            for enemys in enemying:
                if playerman.x - 100 <= enemys.x <= playerman.x + 100 and playerman.y - 100 <= enemys.y <= playerman.y + 100:
                    bulls.pop(bulls.index(bull))
                    bulls.append(enemybullets(round(enemys.x+enemys.width//2), round(enemys.y + enemys.height//2), 6, (0,0,0), facing))

then I called it below

    for bull in bulls:
        bull.draw(window)

my enemy projectile class

# enemys bullets
class enemybullets(object):
    def __init__(self,x,y,radius,color,facing):
        self.x = x
        self.y = y
        self.radius = radius
        self.color = color
        self.facing = facing
        self.vel = 8 * facing

    def draw(self,win):
        pygame.draw.circle(win, self.color, (self.x,self.y), self.radius)

```

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:
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:
How do I edit a Unity InputField by clicking on Android UI Button? I have been stuck on this problem for a long time and not sure what I need to do. Would appreciate any help.

I am building an Android app using Unity. In my app I have an InputField, a TMP_InputField to be precise, in my Unity scene as a Prefab. I want to edit this input field by clicking on a button in my Android UI (not part of Unity scene). I don't want the input field to be editable by clicking on the input field itself.

In order to achieve this, I enabled the Hide Soft keyboard option in the editor so that user can't edit the field by clicking on the field. But I am not able to figure out how to edit the input field.

First problem is how to pop up the keyboard when I click on the Android button. I tried this.

TouchScreenKeyboard.Open("");

This pops up the keyboard but the input field doesn't show the caret and doesn't accept input.

I also tried,

EventSystem.current.SetSelectedGameObject(inputField.gameObject, null);
inputField.OnPointerClick(null);

and

inputField.Select();
inputField.ActivateInputField();

But no success. I tried to play with the focused, interactable, activated properties but nothing works.

This should be easy but I am unable to get it to work. Would really appreciate any help. Thanks!

sentences:
Does each game asset always require a prefix such as 'spr' or 'obj' in their name? Having started only recently with using GameMaker for game development (keep in mind that this is the first time in a long while that I'm doing something like this, so I'm technically at beginner level), I've lately been thinking about something that seems to be common place throughout creating a game with the software.

Through all the tutorials I've been through so far in GameMaker:Studio, I've noticed that the tutorials seem to want the names of game assets to always have a prefix in their names depending on what the game asset is, usually something like spr_ for sprites or obj_ for objects.

I've never exactly liked this sort of naming method, but I don't know whether or not to keep doing this or to just avoid using the prefix entirely. Does the engine require these prefixes for a game to compile or something?

Are these prefixes necessary?

sentences:
How to generate multiple particles at once? I am tying to create a cartoony balloon-pop animation. I want there to be particles that come from all sides of a sphere. However they should all come at once, in a single burst.

What I've done is this. I generated a particle system as a child of the sphere. I set the shape to sphere, reduced the duration, and increased the rate. However it doesn't seem like any particles are being generated at the same time still, only one is created at once.

How can I make all of the particles come at the same time?

sentences:
How should I isolate game entities with their concrete Drawable components (in C#)? I've designed my game entities using a common pattern of separating the entity from its components.  In my case, I've used the Strategy pattern to give each of my entities an IDrawable component.

I construct my entities using a factory, which constructs the entity and adds an appropriate drawable, e.g.:

public static PlayerEntity CreatePlayerEntity(...)
{
   PlayerEntity playerEntity = new PlayerEntity(...);
   SpriteDrawable spriteDrawable = new SpriteDrawable(...);
   playerEntity.Drawable = spriteDrawable;

   ...

   return playerEntity;
}

Now here's the question: If I later want to update the player drawable in some way (e.g. modify the sprite, change the animation, etc.), how and where should I do this?

My first thought is to have C# events that the PlayerEntity publishes and the Drawable subscribes to, but this gets tricky from a purist standpoint, because it's hard to do this without the Drawable requiring a reference to a PlayerEntity.  My current hacky solution is to subscribe to these events from within the CreatePlayerEntity() method itself, using anonymous delegates, which can take advantage of the fact that you've still got a reference to the concrete IDrawable implementation.  It just doesn't seem right for the factory to have this responsibility, though:

public static PlayerEntity CreatePlayerEntity(...)
{
   PlayerEntity playerEntity = new PlayerEntity(...);
   SpriteDrawable spriteDrawable = new SpriteDrawable(...);
   playerEntity.Drawable = spriteDrawable;

  playerEntity.SomeEvent += new EventHandler((sender, e) => { spriteDrawable.Texture = blah; });

   ...

   return playerEntity;
}

What is a better, approved way to accomplish this communication between concrete implementations?

sentences: How do I move a sprite around using tile based movement in Java? So, I'm new to Java and I want to get a sprite to move around the screen, like a tile-based movement. I really would like some help and some resources or tutorials could work. I've done a little C#, but I couldn't seem to get it.

sentences: [ C# ]xna to monogame I'm thinking of going back to xna and c# because I have used java 2d, slick 2d and some other libraries. I started off with xna and c# but ignored it for java. I'm thinking of going back, but I see xna isn't being developed anymore. I read there is away to convert it to monogame but seems very complicated. XNA look fairly easy, yet I havn't toyed with monogame yet. So what I want to know , is monogame related to xna or close in coding? Would it be easy to understand if you're good with xna?

sentences:
How to get crash reports from game Unity3d I am working on a project and I am in need of to gather CrashReports, email crash log, along with allowing the user to describe how the crash happened. I cannot find anything on how to do this, anyone has any ideas? Thanks!

-Learning Unity User

sentences:
Unity3D - Despite using Time.deltaTime, my camera and player move faster at higher framerates I'm pretty new to c# and Unity so I wouldn't be surprised if I had made some stupid mistakes, but as far as I know, I don't think I misused Time.deltaTime. Any help would be greatly appreciated.
Movement Script:
using System.Collections;
using System.Collections.Generic;
using UnityEngine;

public class PlayerMovement : MonoBehaviour
{
    public CharacterController controller;

    public float speed = 12f;
    public float gravity = -9.81f;
    public float jumpHeight = 3f;

    public Transform groundCheck;
    public float groundDistance = 0.4f;
    public LayerMask groundMask;
    private float crouchMultiplier = 1f;

    private Vector3 velocity;
    private bool isGrounded;
    private bool isCrouched;
    private float velocityDecay = 1f;

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

        if (isGrounded && velocity.y < 0)
        {
            velocity.y = -2f;
        }

        float x = Input.GetAxis("Horizontal");
        float z = Input.GetAxis("Vertical");

        Vector3 move = transform.right * x + transform.forward * z;

        controller.Move(move * speed * crouchMultiplier * velocityDecay * Time.deltaTime);

        Debug.Log(Time.deltaTime);

        if (Input.GetButtonDown("Jump") && isGrounded)
        {
            velocity.y = Mathf.Sqrt(jumpHeight * -2f * gravity);
        }

        if (Input.GetKeyDown(KeyCode.LeftControl))
        {
            isCrouched = true;
            gameObject.transform.localScale = new Vector3(1, 1f, 1);
        }

        if (Input.GetKeyUp(KeyCode.LeftControl))
        {
            crouchMultiplier = 1f;
            gameObject.transform.localScale = new Vector3(1, 2f, 1);
            velocityDecay = 1;
            isCrouched = false;
        }

        if (isCrouched)
        {
            if (velocityDecay > 0.2f && isGrounded)
            {
                crouchMultiplier = 2.5f;
                velocityDecay *= 0.995f;
            }
        }

        velocity.y += gravity * Time.deltaTime;

        controller.Move(velocity * Time.deltaTime);
    }
}

Camera Script:
using System;
using System.Collections;
using System.Collections.Generic;
using UnityEngine;

public class MouseLook : MonoBehaviour
{

    public Transform playerBody;
    public float mouseSensitivity = 100f;

    float xRotation = 0f;

    // Start is called before the first frame update
    void Start()
    {
        Cursor.lockState = CursorLockMode.Locked;
        Cursor.visible = false;
    }

    // Update is called once per frame
    void Update()
    {
        float mouseX = Input.GetAxis("Mouse X") * mouseSensitivity * Time.deltaTime;
        float mouseY = Input.GetAxis("Mouse Y") * mouseSensitivity * Time.deltaTime;
        xRotation -= mouseY;
        xRotation = Mathf.Clamp(xRotation, -90f, 90);

        transform.localRotation = Quaternion.Euler(xRotation, 0f, 0f);
        playerBody.Rotate(Vector3.up * mouseX);
    }
}
```

sentences:
How to implement a game launch counter in LibGDX I'm writing a game using LibGDX in which I want to save the number of launches of a game in a text file.
So, In the create() of my starter class, I have the following code ..but it's not working

public class MainStarter extends Game {

    private int count;

    @Override
    public void create() {
        // Set up the application
        AppSettings.setUp();
        if(SettingsManager.isFirstLaunch()){
            SettingsManager.createTextFileInLocalStorage("gamedata");
            SettingsManager.writeLine("gamedata", "Launched:"+count ,FileType.LOCAL_FILE );
        }
        else{
            SettingsManager.writeLine("gamedata", "Not First launch :"+count++ ,FileType.LOCAL_FILE );
        }

        //
        // Load assets before setting the screen
        // #####################################
        Assets.loadAll();

        // Set the tests screen
        setScreen(new MainMenuScreen(this, "Main Menu"));
    }
}

What is the proper way to do this?

sentences:
How to calculate left/right oriented angle between two 2D vectors? I would like to calculate angle between two 2D vectors. Here's a picture of what I'm trying to achieve:

I have an obstacle line segment AB and incoming moving PC. If I'm coming from one side C¹D¹ and angle ⍺ < π/2 (i.e. right side) then PC will turn left. On the other hand if ⍺ > π/2 then PC will turn right. But if PC will come from the other side C²D² it should work as well for angle β as per picture.

So what I need is to determine whether the angle between AB and CD is larger to the left or right basically.

I've tried these things, while having vectors defined as:

Vector2 ab = Vector2.Normalize(new Vector2(b.x - a.x, b.y - a.y));
Vector2 cd = Vector2.Normalize(direction);

1) To calculate angle using atan2, but it works only randomly (1/4 of cases).

Single angle = Math.Atan2(cd.Y, cd.X) - Math.Atan2(ab.Y, ab.X);

if (angle > MathUtil.PiOverTwo)
{
    RotateRight();
}
else if (angle < MathUtil.PiOverTwo)
{
    RotateLeft();
}

2) To use normals somehow. This works a bit better but only from one side I think. (1/2 of cases, better but not there)

Vector2 normal1 = Vector2.Normalize(new Vector2(-ab.Y, ab.X));
Vector2 normal2 = Vector2.Normalize(new Vector2(ab.Y, -ab.X));
Double angle1 = Math.Atan2(normal1.Y, normal1.X) - Math.Atan2(cd.Y, cd.X);
Double angle2 = Math.Atan2(normal2.Y, normal2.X) - Math.Atan2(cd.Y, cd.X);

if (angle1 > angle2)
{
    RotateRight();
}
else if (angle1 < angle2)
{
    RotateLeft();
}

sentences:
Is it legal to use Creative Commons art in a commercial game? I would like to know if the following situation would be legal.

Let's say I take some pictures on wikipedia, that are licensed under CC-BY-SA license.
Then I would like to photoshop them, and use it as art in a (perhaps commercial) game.

According to the Creative Commons licence, it is legal to use the content "for any purpose, even commercially".
So I was thinking about creating a web page where I would attribute each picture to the original creator, and publish the photoshoped picture under the same license (even if it would be almost useless for anyone).

Would it be legal?  Or would I need to publish the entire game under creative commons license?

sentences:
How to create a new GameObject, without adding it to the scene? I'm creating what is essentially my own prefab system. Game objects are defined by a human readable data file. I'd like to create an empty GameObject, load it with the components defined in the data file and have it ready and waiting for an Instantiate() call. However, whenever I use GameObject go = new GameObject() a new game object is added to the scene.

Using Unity built in prefabs, I can load a prefab as a GameObject, and it's not added to the scene. (See example below)

The rationale behind this is I'd like to have one list that contains GameObjects, some generated by loading Unity prefabs and others created by my custom prefab system. This needs to happen at run time, and can't involve the Unity Editor (since ideally end users would be able to define their own data files).

How can I create a new GameObject, without Unity automatically instantiating it for me?

For example, I can make a call like this:

Resources.LoadAll("PrefabsDirectory", typeof(GameObject))

And I'll get a list of GameObjects, none of which are added to the scene when the call is made. Essentially, I'm creating a LoadAll method for my own prefabs, and likewise, I don't want to instantiate the GameObjects when the call is made.

sentences:
How do I add a custom mob to Minecraft? Basically decided to make my own mob, I have:

Created my mob's entity class
Created my mobs model class
Drawn the model
Added the function call for addMapping within the EntityList class

I'm stuck on what to do next. I've tried finding the code that deals with passive animal spawning in the world, however I can't seem to find it.

Help greatly appreciated.

sentences:
Simple 3D OBB-Collision (DirectX9, C++) I'm trying to implement a simple OBB vs. OBB collision detection! I don't need to know where the collision occures, I only want to know whether a collision occures.

The problem is, that after lot of research in the internet I only found comments like "It's very simple, just use SAT in 3D" or some complex math. No examples anywhere!

In the best case, the algorithm should use the max/min Vectors of the boxes.

I know, that similar questions where asked before, but (I think) none of them had examples.

Apologise my bad english, I'm German and still in school! Also a reason why I want simple mathes. I hope you can help me and maybe supply me with some code.

sentences:
How to disable Monogame pixel font antialiasing? I am using Monogame 3.4 (I have held off upgrading to 3.5) and am on Windows 10. I'm drawing using the PointClamp setting (as suggested in this similar question).

Whenever I render text with DrawString(), the text is extremely antialiased, as shown below. However, any stretched textures I draw are NOT antialiased, and seem to use the PointClamp setting as expected.

Here are some examples of drawn text:

How do I disable text antialiasing so that fonts don't blur?

EDIT:

It seems that changing some import settings in the .mgcb changes the quality of the AA? When "processorParam:TextureFormat=Color" is changed to "processorParam:TextureFormat=Compressed", it makes the AA more pronounced. The issue is still not solved, but I feel like the font import settings may have something to do with it. Here is the .mgcb

#begin DwellFont.spritefont
/importer:FontDescriptionImporter
/processor:FontDescriptionProcessor
/processorParam:TextureFormat=Color
/build:DwellFont.spritefont

EDIT 2

Since this question got flagged as a duplicate, let me explain. The other question I have already referenced above uses PointClamping. I already use PointClamping, and it works fine with the textures I render (they aren't antialiased). It does not, however, work with my fonts. Therefor, that other question isn't applicable. I'm wondering why that is.

sentences:
Fourth texture = segmentation fault I keep on getting segmentation fault each time I load fourth texture - what type of texture, I mean filename, does not matter. I checked value of GL_TEXTURES_STACK_SIZE which turned out to be 10 so quite more than 4, isn't it?

Here're code fragments:

funciton to load texture from png

static GLuint gl_loadTexture(const char filename[]) {
    static int iTexNum = 1;
    GLuint texture = 0;
    img_s *img = NULL;

    img = img_loadPNG(filename);
    if (img) {
        glGenTextures(iTexNum++, &texture);
        glBindTexture(GL_TEXTURE_2D, texture);
        glTexParameteri(GL_TEXTURE_2D,GL_TEXTURE_MIN_FILTER,GL_LINEAR);
    glTexParameteri(GL_TEXTURE_2D,GL_TEXTURE_MAG_FILTER,GL_LINEAR);
        glTexImage2D(GL_TEXTURE_2D, 0, img->iGlFormat, img->uiWidth, img->uiHeight, 0, img->iGlFormat, GL_UNSIGNED_BYTE, img->p_ubaData);
        img_free(img); //it may cause errors on windows
    } else printf("Error: loading texture '%s' failed!\n", filename);

    return texture;
}

actual loading

static GLuint textures[4];

static void gl_init() {
    (...) //setting up OpenGL

    /* loading textures */
    textures[0] = gl_loadTexture("images/background.png");
    textures[1] = gl_loadTexture("images/spaceship.png");
    textures[2] = gl_loadTexture("images/asteroid.png");
    textures[3] = gl_loadTexture("images/asteroid2.png"); //this is causing SegFault no matter which file I load!
}

Any ideas?

Problem is present on both Linux and Windows.

sentences:
Texture color change not working on custom effect I'm new to custom effects (ex. pixel shaders) in monogame, but I've researched a bit and made some test effects.

I've noticed that the color variable "Color.[color]" doesn't change the color of the texture when an effect is active.

example:

I can't draw text that uses the effect, because the text doesn't turn black, it stays white.

This is my custom shader file:

sampler2D TextureSampler = sampler_state
{
    Texture = <Texture>;
};

float4 PixelShaderFunction(float4 pos : SV_POSITION, float4 color1 : COLOR0, float4 texCoord : TEXCOORD0) : SV_TARGET0
{
    float4 color = tex2D(TextureSampler, texCoord);

    float high = .6;
    float low = .4;

    if (color.r > high) color.r = 1;
    else if (color.r < low) color.r = 0;

    if (color.g > high) color.g = 1;
    else if (color.g < low) color.g = 0;

    if (color.b > high) color.b = 1;
    else if (color.b < low) color.b = 0;

    return color;
}

technique Technique1
{
    pass Pass1
    {
        PixelShader = compile ps_4_0_level_9_1 PixelShaderFunction();
    }
}

And this is an example of the color change that doesn't happen:

spriteBatch.DrawString(font, [text], [position], Color.Black);

When the program starts (with the effect on), the text stays white and doesn't turn black. The effect works on all the other textures, when they don't need a color change.

Is this because of the sampler in the effect file?

EDIT

My question is actually if I can use the "Color.[color]" variable with a custom effect, or do I need to add a color parameter to the effect?

I ask this because I also have a button class that draws buttons with text on it. The draw function for the button draws the text and the button at almost the same time. color change for the text is written in that button class (ex. Color.Black). But when I use the custom shader, it doesn't work.

I'm also not sure if this will work with hlsl parameters for the colors, because I don't know how to seperate the button and the text with a hlsl shader, and only change the color of the text.

sentences:
Texture2D can't find my sprite - how to setup the content directory in XNA So I keep getting told that spr_lives can't be found.  I'm working out of a book and using the samples given to me (have not changed the code or folder structure, so it /should/ work) but nothing's working unfortunately.  I know it's a directory issue but I'm unclear on how to remedy it.

Picture of both code and folder structure:

sentences:
2D platformers: why make the physics dependent on the framerate? "Super Meat Boy" is a difficult platformer that recently came out for PC, requiring exceptional control and pixel-perfect jumping. The physics code in the game is dependent on the framerate, which is locked to 60fps; this means that if your computer can't run the game at full speed, the physics will go insane, causing (among other things) your character to run slower and fall through the ground. Furthermore, if vsync is off, the game runs extremely fast.

Could those experienced with 2D game programming help explain why the game was coded this way? Wouldn't a physics loop running at a constant rate be a better solution? (Actually, I think a physics loop is used for parts of the game, since some of the entities continue to move normally regardless of the framerate. Your character, on the other hand, runs exactly [fps/60] as fast.)

What bothers me about this implementation is the loss of abstraction between the game engine and the graphics rendering, which depends on system-specific things like the monitor, graphics card, and CPU. If, for whatever reason, your computer can't handle vsync, or can't run the game at exactly 60fps, it'll break spectacularly. Why should the rendering step in any way influence the physics calculations? (Most games nowadays would either slow down the game or skip frames.) On the other hand, I understand that old-school platformers on the NES and SNES depended on a fixed framerate for much of their control and physics. Why is this, and would it be possible to create a patformer in that vein without having the framerate dependency? Is there necessarily a loss of precision if you separate the graphics rendering from the rest of the engine?

Thank you, and sorry if the question was confusing.

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:
Releasing a game without really having an officially registered company I'm thinking of releasing my iOS game without formally registering a company at all.  I'm not sure I even want to create a company.

ITunes wants to know the copyright holder of my title. I have 2 questions regarding this:

1) Can I use my (already decided upon if will exist) company name and just register it later (if the need arises)?

2) Or should I just use my NAME as the copyright holder, regardless if I plan to formally register the company later or not?

sentences:
What was game development on the Apple II like? I've asked a similar question about DOS development a while ago and got an excellent answer:
What was the typical toolchain for DOS game development?

Now I'm wondering what game development was like on the Apple II in the late 70s/early 80s. I'm mainly interested in the early ones: II and II+, but I'd like answers about IIe etc. as well.

So here are my questions:

What languages were used?

I presume 6502 assembler, but BASIC was bundled and probably used a lot, too. Can you think of popular games written in BASIC? How about C?

What was 6502 assembler development like?

I've noticed that you can enter op codes directly if you start the system monitor, and you can even execute assembler directly with the mini assembler. But I cannot imagine that games were written like that, were there editors/IDEs? How were programs stored on disks/tapes?

What was BASIC development like?

The Apple II BASIC interpreter is not half bad, I guess you can write full programs in there. It also allows you to SAVE/LOAD programs, I presume to disk/tape. But was there no visual editor?

Were there any APIs or Middleware?

Or was it necessary to talk directly to the hardware all the time if you wanted to draw something or play a sound? Were there any libraries at all?

Anything else that's different from today?

I'd be happy to hear any other differences, like what image/audio formats were used. Given that there wasn't really a concept of files if I understand it correctly, I'm wondering how that worked. Did you have to type your graphics and sounds in assembler? How did that work in BASIC?

sentences:
Change GUI in Java game I'm making a 2D Server/Client game, I have very little to no problems with the server but now I want to work on the client side code.
I'm thinking about using a JFrame and all the other GUI classes/methods.
My question is how do I change the GUI and all things that are displayed.
For example if the user opens the client I want him to login or register, if they logged in I want the client to display the game. Do I just display the new elements and delete the old or is there a other solution? I don't want to use 2 frames.

sentences:
How to make shadows softer as distance increases? I'm trying to make shadows become more blurry as the distance between the caster and receiver, so they look a little more realistic.

What method can I use to achieve this?

sentences:
How can I delete an enemy's bitmap from a canvas? I'm learning to create an Android shooter game where I'll have multiple enemies. I must control the position on the screen and be able to delete each of then (via, for example, a die() function).

But I use a canvas, which is most recomended, is it possible to delete just one bitmap and not the entire canvas (by delete I mean make it vanish from the screen, not just erase its value)? If so, how?

Another approach, I guess, would be using the Android image view, which can be deleted and as well as controlled and positioned, but I think that can make my game run slow if I create various objects of a class enemy; is that correct?

sentences:
How to avoid destroying information when scaling I'm in the progress of making a simple 3D editor, just for developing skills on 3d graphics.
After implementing some basic tools, I realize that scaling isn't working as I expected.
For example, when you scale down a model to a flat plane along some axis, how is it possible to restore that model when you scale up again on that axis?
Every vertex has been crunched to the same position, so they will all be scaling in the same way, so the model's vertex layout will be lost.
I assume that I need some metadata or "shadow copy" of the model, but I'm not sure.
How can I solve this problem in my editor?

sentences:
GLSL - Declaring global variables outside of the main function scope Does it help to declare variables outside of your main function scope in GLSL? Do these variables actually get reused and is it more efficient?

Here is the code in question:

varying vec2 vposition;
uniform float seed;
uniform float top;
uniform float bottom;
uniform float phi;
uniform float theta;
uniform float scaledPI;
uniform float yn;
uniform float ym;
uniform float rx;
uniform float ry;
uniform float radius;

const float PI = 3.141592653589793238462643383;

float left;
float right;
float mscaled;
float xn;
float xm;
void main() {
    float t = vposition.y * yn + ym;

    if(t <= 0.0 || t >= PI){
        left = phi - PI;
        right = phi + PI;
    }else{
        mscaled = scaledPI / (1 - abs(Math.cos(theta)));
        mscaled = mscaled < PI ? mscaled : PI;
        left = phi - mscaled;
        right = phi + mscaled;
    }
    xn = (left - right) / ((-rx / 2.0) - (rx / 2.0));
    xm = left - ((-rx/2.0) * xn);
    float p = vposition.x * xn + xm;

    vec3 coords = vec3( sin(p) * sin(t), cos(t), cos(p) * sin(t) );
    float nv = surface( vec4( coords, seed ) );
    gl_FragColor = vec4( vec3( nv, nv, nv ), 1.0 );
}

sentences:
D3D11 Multiple Render Targets I wanted to try rendering to multiple render targets as a first step to deferred shading, but I'm getting somewhat peculiar behavior where the contents of all render targets are the same as the first one.

So far all the render targets have the same format.

The relevant snippets from the shaders are:

//geometry rendering
struct PS_OUT {
    float4 diff : SV_TARGET0;
    float4 norm : SV_TARGET1;
    float4 spec : SV_TARGET2;
    float4 uv   : SV_TARGET3;
};

PS_OUT PS(PS_IN input)
{
    PS_OUT output;
    output.diff = mytexture.Sample(mysampler, input.uv);
    output.norm = input.normal;
    output.spec = float4(input.pos.xyz, 1);
    output.uv = float4(input.uv, 0, 1);
    return output;
}

//"compositing" with fullscreen quad
Texture2D diff;
Texture2D norm;
Texture2D spec;
Texture2D uv;
SamplerState mysampler;

PS_IN VS(VS_IN input)
{
    PS_IN output ;
    output.pos = float4(input.pos,1);
    output.uv = float4(input.uv, 1, 1);
    return output;
}

float4 PS(PS_IN input) : SV_TARGET
{
    float4 diffuse = diff.Sample(mysampler, input.uv.xy);
    float4 normal = norm.Sample(mysampler, input.uv.xy);
    float4 specular = spec.Sample(mysampler, input.uv.xy);
    float4 uvw = uv.Sample(mysampler, input.uv.xy);

    return normal;
}

Sorry for the long post.

Now, the weird part is, if I return any of the sampled colors alone, like for example the normal, the first G-Buffer "channel" gets drawn to the screen instead. (Even if the normal channel is the only one I sample).

However, if I return this instead: 0.0001*diffuse + 1.0*normal + 0.0001*specular + 0.0001*uvw then it does return the actual normal channel.

This 0.000*diffuse + 1.0*normal + 0.000*specular + 0.000*uvw however results in just the diffuse being drawn again.

There are no Info or Warning or Error messages from the debug layer, turning the debug layer off doesn't change anything either.

Could the HLSL compiler possibly be optimizing the Sample calls away since the result is not used, and then removing the texture objects alltogether since they are not sampled from?

PS, if you think seeing how I create and assign the render targets etc will help, I will add it. I just didn't want to make the post any longer.

sentences:
Why use random numbers when it comes to rewards and stats? Many games use random numbers for things like attack damage, gold loot, or monster type being spawned. It is obvious that random numbers allow you to generate content to make games more re-playable, but I am talking about specific things. For example: In DOTA, when you kill a monster you get a random amount of gold in between x and y where x and y never change. When you attack anything you have a chance to do damage within a range such as 52-60. How would making the gold drops static change the game?

I feel like the random numbers enhance the game-play, but I am having trouble understanding why. Does anyone know any reasons why random numbers can make game-play better when used with things like damage or loot? I'm hoping for answers that don't attribute it to luck being a good thing.

sentences:
Can OpenAL be used with Python? I'm from a background of using OpenAL with other languages; and I'm on a project that benefits very much from Python. I remember PyAL, but it hasn't been updated since 2013 and my computer can't even find a copy of the package to download. I'm also aware of such relative-fringe packages as alpy and python-openal; but I'm hesitant to pick them up if they are also unmaintained. (Can't be sure yet.)

Is there a library that provides a Python binding to OpenAL? Or do I simply need to either write my own or make due with one of the other, non-3D-sound, packages? If getting it is more complicated than pip, how would I go about doing so?

Thanks.

sentences:
best way of rendering more 3D models in three.js that not slow down page? I am in the way of creating a 3D web game using threeJS library. This is a multi-player game that players are 3D human models in game, and I need to add a human 3D model for each player that enters the game. Additionally, I want to animate the humans while they walking, but the problem, here is that adding a 3D model and animating that for each player will slow down the game or maybe cause the browser to crash.

question: what is the better way of showing and animating the player's models that will not slow down the game?

sentences:
top down game - checking, drawing enemy's line of sight area with obstacles Examples of what i'm going to need:

I'm using cocos2d to draw a CCTMXTiledMap, on those tiles i'll have to draw the LOS cone.

How would i test if the player is within that cone, taking obstacles into account?
How would i draw the line of sight area on the map tiles, again taking obstacles into account, like in the examples above?

This is a re-post of a question i've put on stackoverflow.

sentences:
How to cut a desired shape out of a mesh? I want the player to be able to cut a hole through a wall, similar to what's shown in this video

I know for the fact that it's really difficult to achieve, so I was wondering how I can cut a shape out of a simple mesh at run time (or even cut a shape out of a 2D sprite).

sentences:
LibGdx drawing weird behaviour I am finding strange behaviour while rendering TextureRegions in my game, only when pausing it. I am making a game for Android, in Java with LibGdx.

When I comment out the line "drawLevelPaused()" everything seems to work fine, both running and paused. When it's not commented, everything works fine until I pause the screen, then it draws those two rectangles, but maybe ships are not shown, and if I comment out drawShips() and drawTarget() (just trying) maybe one of the planets disappears, or if I change the order, other things disappear and those that disappeared before now are rendered again. I can't find the way to fix this behaviour

I beg your help, and I hope it's my mistake and not a LibGdx issue. I use OpenGL ES 2.0, stated in AndroidManifest.xml, if it is of any help. Thank you in advance.

My Screen render method(game loop) is as follows:

@Override
public void render(float delta)
{
    Gdx.gl.glClearColor(0.1f, 0.1f, 0.1f, 1);
    Gdx.gl.glClear(GL10.GL_COLOR_BUFFER_BIT);

    controller.update(delta);
    renderer.render();
}

When world state is PAUSED  controller.update does nothing at all, there is a switch in it. And renderer.render() is as follows:

public void render()
{
    int worldState=this.world.getWorldState();

    updateCamera();
    spriteBatch.begin();
    drawPlanets();
    drawTarget();
    drawShips();

    if(worldState==World.PAUSED)
    {
        drawLevelPaused();
    }
    else if(worldState==World.LEVEL_WON)
    {
        drawLevelWin();
    }
    spriteBatch.end();
}

And those methods are:

private void updateCamera()
{
    this.offset=world.getCameraOffset();
}

private void drawPlanets()
{
    for(Planet planet : this.world.getPlanets())
    {
        this.spriteBatch.draw(this.textures.getTexture(planet.getTexture()), (planet.getPosition().x - this.offset[0]) * ppuX, (planet.getPosition().y - this.offset[1]) * ppuY);
    }
}

private void drawTarget()
{
    Target target=this.world.getTarget();
    this.spriteBatch.draw(this.textures.getTexture(target.getTexture()), (target.getPosition().x - this.offset[0]) * ppuX, (target.getPosition().y - this.offset[1]) * ppuY);
}

private void drawShips()
{
    for(Ship ship : this.world.getShips())
    {
        this.spriteBatch.draw(this.textures.getTexture(ship.getTexture()), (ship.getPosition().x - this.offset[0]) * ppuX, (ship.getPosition().y - this.offset[1]) * ppuY, ship.getBounds().width*ppuX/2, ship.getBounds().height*ppuY/2, ship.getBounds().width*ppuX, ship.getBounds().height*ppuY, 1.0f, 1.0f, ship.getAngle()-90.0f);
    }

    if(this.world.getStillShipVisibility())
    {
        Ship ship=this.world.getStillShip();
        Arrow arrow=this.world.getArrow();
        this.spriteBatch.draw(this.textures.getTexture(ship.getTexture()), (ship.getPosition().x - this.offset[0]) * ppuX, (ship.getPosition().y - this.offset[1]) * ppuY, ship.getBounds().width*ppuX/2, ship.getBounds().height*ppuY/2, ship.getBounds().width*ppuX, ship.getBounds().height*ppuY, 1f, 1f, ship.getAngle() - 90f);
        this.spriteBatch.draw(this.textures.getTexture(arrow.getTexture()), (ship.getCenter().x - this.offset[0] - arrow.getBounds().width/2) * ppuX, (ship.getCenter().y - this.offset[1]) * ppuY, arrow.getBounds().width*ppuX/2, 0, arrow.getBounds().width*ppuX, arrow.getBounds().height*ppuY, 1f, arrow.getRate(), ship.getAngle() - 90f);

    }
}

private void drawLevelPaused()
{
    this.shapeRenderer.begin(ShapeType.FilledRectangle);
    this.shapeRenderer.setColor(0f, 0f, 0f, 0.8f);

    this.shapeRenderer.filledRect(0, 0, this.width/this.ppuX, PAUSE_MARGIN_HEIGHT/this.ppuY);
    this.shapeRenderer.filledRect(0, (this.height-PAUSE_MARGIN_HEIGHT)/this.ppuY, this.width/this.ppuX, PAUSE_MARGIN_HEIGHT/this.ppuY);

    this.shapeRenderer.end();

    for(Button button : this.world.getPauseButtons())
    {
        this.spriteBatch.draw(this.textures.getTexture(button.getTexture()), (button.getPosition().x - this.offset[0]) * this.ppuX, (button.getPosition().y - this.offset[1]) * this.ppuY);
    }

}

sentences:
How does Ashley keep systems up-to-date with its entities? I am currently trying out Ashley and overall learning how an ECS works internally. What I currently don't understand is how Ashley in particular keeps its systems up-to-date by adding or removing entities based on the specified Family. See the following code:

  def main(args: Array[String]): Unit = {
    val engine = new Engine()

    engine.addSystem(new EntitySystem() {
      var entities: ImmutableArray[Entity] = _

      override def addedToEngine(engine: Engine) = {
        entities = engine.getEntitiesFor(Family.all(classOf[MyComponent]).get())
        println("updated entities")
      }

      override def update(deltaTime: Float) = {
        println(entities.size())
      }
    })

    engine.update(0F)
    engine.addEntity(produce())
    engine.update(0F)
    engine.addEntity(produce())
    engine.update(0F)
    engine.addEntity(produce())
  }

  def produce() = {
    val entity = new Entity()
    entity.add(new MyComponent)
    entity
  }

  final class MyComponent extends Component

Which regurgitates the following output:

updated entities
0
1
2

The entities object is an immutable wrapper around LibGDX's Array collection. The wrapped mutable variant isn't exposed either to the outside. There is no way this array can be mutated. The overrided addedToEngine method is only called when the EntitySystem was added to the Engine.

sentences:
2D Collision Box Clipping There is this strange issue with the collision in a game I am making. When the player is slightly lower than a block it is colliding with from the side, the player ends up clipping to the top of the block rather than sliding along the side of it down. Do you have an idea how to fix it?

If that description didn't help you at all you can reproduce it here (goes to the website with the game on it). (Use WASD/Space/Arrow Keys to move) To reproduce, stand on the single block and hold the right move button. You will fall off the edge, hit the side of the block, and get clipped to the top of it. You are meant to fall onto the block below instead.
(The words and colors are debug info)

The code below is what handles the collision detection. If you need the rest of the code, you can view the source of the page linked above.

this.doCollision = function() {
var tx = Math.floor(this.x),
    ty = Math.floor(this.y),
    nx = this.x % 1,
    ny = this.y % 1,
    cell = this.cell = levelStorage.currentLevel.getTileAtPosition(tx, ty),
    cellRight = this.cellRight = levelStorage.currentLevel.getTileAtPosition(tx + 1, ty),
    cellDown = this.cellDown = levelStorage.currentLevel.getTileAtPosition(tx, ty + 1),
    cellDiag = this.cellDiag = levelStorage.currentLevel.getTileAtPosition(tx + 1, ty + 1);

if(this.vy > 0) { // Ground collision
// The !cell checks return if the cell exists or not (null)
  if((cellDown && !cell) || (!cellRight && cellDiag && nx)) {
    this.y = ty;
    this.vy = 0;
    this.falling = false;
    this.jumping = false;
    ny = 0
  }
}else
if(this.vy < 0) { // Ceiling collision
  if((!cellDown && cell) || (cellRight && !cellDiag && nx)) {
    this.y = ty + 1;
    this.vy = 0;
    cell = this.cell = cellDown;
    cellRight = this.cellRight = cellDiag;
    ny = 0;
  }
}
if(this.vx > 0) { // Right collision
  if((cellRight && !cell) || (!cellDown && cellDiag && ny)) {
    this.x = tx;
    this.vx = 0;
    nx = 0;
  }
}else
if(this.vx < 0) { // Left collision
  if((!cellRight && cell) || (cellDown && !cellDiag && ny)) {
    this.x = tx + 1;
    this.vx = 0;
    cell = this.cell = cellRight;
    cellDown = this.cellDown = cellDiag;
    nx = 0;
  }
}
this.falling = !(cellDown || (nx && cellDiag)); // If player isn't on ground
}
}

Thanks for the help!

EDIT: I should note this also happens with the bottom of blocks as well. The same principles apply as clipping to the top, except you clip to the bottom instead.

sentences:
Benefits of going full AABB? By "going full AABB" I mean using only AABBs for all of your objects (both dynamic and static), with dynamic objects colliding both with each other and static objects. In what specific ways does this simplify physics calculations? Are there any special techniques that require a world made entirely of AABBs? Some way to, say, remove the need for TOI-ordering (or similar) by taking advantage of that fact that all objects are AABBs?

In particular I'm looking for specific large-scale benefits, not just small things like collision detection being slightly faster. There seem to be quite a few games that use only AABBs, like Minecraft for example, so there must be a significant benefit to it or they wouldn't be doing it. Only thing I can think of is getting to do position/velocity corrections per-axis, though I'm not sure how one would exploit that to its full potential.

sentences:
Jump a gameobject when a key is pressed I am working on a platform game,When I press the space bar  the object should jump and  when I release the space bar it should come down.

The code I have used for jump is

void Update () {
    transform.Translate(Vector3.right*Time.deltaTime);
    if(Input.GetKey(KeyCode.Space))
    {
        rigidbody2D.AddForce(Vector3.up*3);
    }

    if(Input.GetKeyUp(KeyCode.Space))
       {
        rigidbody2D.AddForce(Vector3.down);
    }

}

But when I release the space bar the object is not coming down

sentences:
Unity 5 - Texture/Material rendering issue I am working on a Minesweeper clone that started as a Unity 4.6 project and ended up as a Unity 5 project. I have cube objects that use Legacy Shaders/Diffuse. I am new to Unity 5, so I am not fully aware of the changes to the shaders.

The following texture on cube objects does not render as it is (I think it used to).

I want the flag appear on the cube as it is. What causes this output and how do I fix it?

sentences:
How to have separate UI section in Monogame? So I have a game, and you can move and attack and move the camera around, etc...but I want to have a section of the screen dedicated to Character info like health, etc.

How do I make a fixed section for that and have the game window next to 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:
Do I need to build my scripts every time I go back into Unity from my script editor? I saw a few Unity YouTubers who do not build their scripts when they are working.

But I always do it.

Do I have to?

sentences:
How to get the angle to an object from angle you are facing I am making an creature simulator where the creatures have a neural net for a brain.

One of the inputs to the net is the angle it has to travel to go to be facing the nearest piece of food. I can get the nearest piece of food, but I need a way of getting the angle it needs to travel to be facing the piece of food.

For example, if it was facing the food, it would be zero, and if it was facing away it would be 180. I got the creatures angle, if it is facing up it would be 0 degrees, and if its facing right its 90 degrees.

sentences:
My colliders keep going through one another? So, I have some platform with colliders and a character with a collider (everything in 2D). The problem is, while there is some noticeable effects (a certain push back) when the colliders collide, they actually intersect each other and can go through each other.. How can I actually put a collider that doesn't let anything pass, it just stands there like a brick wall against anything?

By the way, any enlightenment on the inner workings of the colliders behavior will be appreciative as I cannot understand how this could even happen.

Demonstration video

Demonstration video 2

Bellow I have the images showing the inspector of both the character and platforms/wall respectively.

]4

Also: I'm moving the character using transform.position += Vector3.right * speed * Time.deltaTime;

sentences:
Main Camera re-sizing in 2d My UI :

An UI from YouTube video :

Look my camera's size is 10 and his camera's size is only 5. But, my camera's width is larger than height. If you look at scale (x,y,z)=(1,1,1). I tried to change them. But, nothing changes.I tried to change ViewPort Rect then, I am able to change the size of Main Camera. But, look at following image. His ViewPort Rect is 1 by 1 mine also. But, we have differences of width and height.
How to fix it?

sentences: gazing and lip syncing in Unity 5.2 Is it possible to achieve gazing or lip syncing in Unity 5.2 at all, similar to Locomotion done through MecAnim?

sentences:
How can I introduce time pressure on the player's decisions? I am designing a hacking game, in which the player usually can take his time thinking about how to overcome the obstacles that he/she currently faces. However, I decided that besides coming up with clever solutions, hacking should also feel intense, and that the game needs some ways to put a time pressure on the player's decisions.

First such mechanic that I added reassured me that I am going in the right direction: Sometimes the player can trigger a network trace, which lasts X seconds and can potentially kick the player out of the network unless he/she reacts quickly enough and succeeds in evading the trace. I would like to add perhaps one or two more mechanics that would put the player under a time pressure, but I am a little stuck and always seem to come up with a variations on  'Countdown', i.e. 'There will be (a punishment) in (X) seconds, unless (some action is taken)', but obviously all those mechanics end up too similar.

In abstract terms — that is, without knowing the particular mechanics in my ruleset — how can I introduce a time-pressure on the player's decisions?

sentences:
Skill system in turn-based board-like RPG I'm working on the implementation of a turn-based board RPG (like Descent: Journeys in the Dark) to improve my C++ skills and learn something about game-dev.

I have already done with general stuff, like Heroes and Monsters, their common action (move, attack) which they can do every turn. Now I want to add some skill system, and I'm not quite sure how to do it. I'm thinking about some skills that can be used after particular action is done (e.g. 'after attack dices are rolled, add +X to damage' or 'after another hero is revived, recover X HP'), some of those skill hero can gain by leveling up or with some item, but I don't know, how to implement this kind of skills.
Maybe adding a checking for a game state could be a good idea, but that leads to tens of different options and doesn't look like efficient way to implement.

Could anyone please help me?

sentences:
How to handle movements of objects in a platformer with a cylindrical map? I was wondering what would be the best approach for a game with a perspective like  Resogun, where the world wraps around in a cylinder:

In my opinion, the easiest approach is to:

have a "Center Parent" for each moving object

Offset the child object by the wanted  radius

Rotate the parent

=> The objects will move, though this will become super limited very quickly, especially if you want to do any sort of physics.
The 2nd approach is math:
x = centerX + cos(angle)*radius;
x = centerY + sin(angle)*radius;

Now i wonder if there is another way, I was thinking of another method which basically consist of changing the Forward direction of the moving objects based on their position in "the circle", so basically the objects always move forward but adjust their rotation according to their position so they are always facing the right angle.
My main question is that if you want to create a puzzle platformer game like Limbo for example, but in a "cylindrical" map like Resogun, how would you tackle it ?
Thanks!

sentences: MenuStrip in XNA 4.0 Is it possible to place a MenuStrip into a XNA 4.0 project. This project is intended for PC-s only and I already have openFile dialogs, but I cant get the MenuStrip drawn. If this is not possible what would be a good alternative. I've been trying to get find it on create.msdn but it keeps redirecting me to the WinPhone/XBox selection page and I cant access the tutorials at all.

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 does hidden surface removal work? Lately, I've been learning some OpenGL for fun, and I've been thinking about hidden surface removal.

Say you have a high poly count static scene, with nothing that moves, no bones, physics, etc. Just static models to be drawn. I was thinking that you could put all the faces in the scene into a quad/octree. And with the camera position, and dimensions of the view frustum, you could traverse the tree to construct an index buffer of all the faces that are within the view frustum (facing towards you of course). You could then update the index buffer with glBufferSubData(), and draw with glDrawElements(), and you would do this every frame, and if my limited understanding is correct, this should theoretically draw only the faces you see, right?

So is this a good/valid way to do occulusion culling? If not, how else can you do it?

sentences:
Level playing field: Punish the better player or enhance the worse player? I am making a 1 vs 1 game where each player controls a car with an identical joystick. The objective for the players is to reach a goal destination before the other player.

The players of the game are placed into categories based of the skills controlling the car e.g. Skill level[1,2,3,4,5] with 5 being the highest skill level.

The players will not be intended to jump up and down in skill levels when playing the game. After a given period, e.g. a week, the skill levels will be updated. This will not be shown to the players.

The objective for me is to make every combination of players in the 1 vs 1 setting be a 50/50 win loss chance for the players.

Example: Player 1(Skill level 5) vs player 2(Skill level 1) should each have 50% change reaching the goal destination first.

I have not been able to find any research on whether the best practice is to limit the abilities of the good player or enhance the abilities of the bad player or maybe a combination.

The idea is to have disabled adolescents playing against their able bodied friends or family members. It is therefore not a possibility to not let good players play against bad ones.
Data from field tests have shown that the disabled adolescents perform worse than able bodied consistently due to spasms.

I am looking for input on how to go about with this; research, your experiences, how other games are doing it? Is there any common recommendations for this?

sentences:
IOS monogame 17 seconds debug timeout I'm trying to debug a monogame application using xamarin studio and breakpoint.
Is it possible to disable the 17 seconds timeout on the FinishedLaunching function?

sentences:
Out of bounds in AAA games In many common AAA titles (Source engine games especially), when the player reaches an area 'un-catered' for, such as out of bounds, or noclipping under the map; a strange effect occurs on the screen (buffer tearing?).

It can be described as being similar to the trail of windows that Windows XP may leave behind a window being dragged whilst theres a system hang.

I can only postulate that the developers do not clear the color buffer when refreshing the screen?

Is that correct? If so, why?

sentences:
How can I achieve UnrealEd's per-face texturing in Blender 2.6? Using UnrealEd I can create geometry and assign a material to each face of that geometry. Each face can have its own UV settings. How can I achieve the same functionality using Blender?

I've seen the "Texture Face" option mentioned but that seems to be gone in Blender 2.59+?

sentences:
How should i manage intro animation never realized how the animation intro of a game is done, I've thought that perhaps you have all the images of each frame of the animation, or have a video made and make the load.

anyway, if it is made of any of these ways,
What is the best way to do this?

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:
How to draw Alpha Masked fragments' depth to depth buffer? I feel like an absolute idiot for asking this. But how exactly do safely draw the depth of a fragment featuring a Masked ( Alpha 1) texture on it's surface?

So far I've literally been doing a depth test on truly opaque geometry.

Here's a logarithic Z-bufer from GTA. And yes... it's strange that I know that and how to do it... but not a alpha mask depth.

EDIT: From this, it looks like it's actually possible to write solid texture data to the depth buffer, and ignore the binary transparency.

Here's an image that's an example of the problem I would like to solve.

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:
How to calculate normal from normal map in world space? (OpenGL) I'm trying to do normal mapping in a deferred renderer and I'm stuck on how to implement normal maps. I have a bool that passes whether or not to use a normal mapped value and thus, whether to calculate the TBN matrix. My vertex code for the geometry pass looks as follows:

#version 410 core

layout (location = 0) in vec3 aPos;
layout (location = 1) in vec3 aNormal;
layout (location = 2) in vec2 aTexCoords;
layout (location = 3) in vec3 aTangent; // Optional Texture coordinates
layout (location = 4) in vec3 aBitangent; // Optional Texture coordinates

out vec3 FragPos;
out vec2 TexCoords;
out vec3 Normal;
out mat3 TBN;

uniform mat4 model;
uniform mat4 view;
uniform mat4 projection;

uniform bool hasNormalMap;

void main()
{
    vec4 worldPos = model * vec4(aPos, 1.0);
    FragPos = worldPos.xyz;
    TexCoords = aTexCoords;
    Normal = transpose(inverse(mat3(model))) * aNormal;

    if(hasNormalMap)
    {
        vec3 T = normalize(vec3(model * vec4(aTangent, 0.0)));
        vec3 N = normalize(vec3(model * vec4(aNormal, 0.0)));
        // re-orthogonalize T with respect to N
        T = normalize(T - dot(T, N) * N);
        // then retrieve perpendicular vector B with the cross product of T and N
        vec3 B = cross(N, T);
        mat3 TBN = mat3(T, B, N);
    }

    gl_Position = projection * view * worldPos;
}

Here is where I am confused:

In my calculation, I multiplied T and N by the model matrix which should have moved it into world space. Now transposing (T,B,N) should move me back into model space (I think, I'm not sure). In the fragment shader how do I use the TBN to calculate the normal in world space?

If there are better approaches, they are welcome. Thank you.

Update:
I removed the transposing of the TBN as there's no reason to transform into tangent space if we want to pass it in world space. Now that we have the TBN matrix in the fragment shader, how do we apply it so that the normal is the correct value for lighting? Currently I've done:

#version 410 core

layout (location = 0) out vec3 gPosition;
layout (location = 1) out vec3 gNormal;
layout (location = 2) out vec4 gAlbedoSpec;

in vec2 TexCoords;
in vec3 FragPos;
in vec3 Normal;
in mat3 TBN;

struct Material {
    sampler2D diffuseMap;
    sampler2D specularMap;
    sampler2D normalMap;
    float shininess;
};

uniform Material material;
uniform bool hasNormalMap;

void main()
{
    // store the fragment position vector in the first gbuffer texture
    gPosition = FragPos;

    // also store the per-fragment normals into the gbuffer
    gNormal = normalize(Normal);

    if(hasNormalMap)
    {
        gNormal = texture(material.normalMap, TexCoords).rgb * TBN;
        gNormal = normalize(gNormal);
    }

    // and the diffuse per-fragment color
    gAlbedoSpec.rgb = texture(material.diffuseMap, TexCoords).rgb;

    // store specular intensity in gAlbedoSpec's alpha component
    gAlbedoSpec.a = texture(material.specularMap, TexCoords).r;
}

but that doesn't feel right. I imagine that I would transform the sampled value from the normal map by the TBN matrix to get it in world space. Am I missing something?

sentences:
Draw Ordering with Glowing Objects This is mostly a general design theory question, but for reference the bulk of my game is in JavaScript.
I can draw images to the screen that layer on top of each other in the order that I please. One of the layers, I call it the light layer, is simply a series of black squares that change opacity based on the light levels in the game. During night, these black squares are almost opaque (unless a light source is affecting them) and during the day they are nearly invisible.
Glowing things, like bulbs or radar console screens, are drawn above the light layer to make it look as if they're exempt from the light effect. (Glowing)
However, the turret head is a non-glowing object that needs to appear above the glowing objects. For example, it might partially cover the radar console screen or light bulbs. However, it isn't meant to glow.
This is where the paradox occurs. The turret head needs to be below the light layer, but also above the glowing elements.
Any ideas of how I could solve such a paradox?

sentences:
Some submeshes of my gameobject dissapear when I set the bindposes Well, I'm trying to animate some Source models imported into Unity3D using this Unity-Source-Tools library:
https://github.com/lewa-j/Unity-Source-Tools
To animate a Mesh generated by this tool I need to create a SkinnedMeshRenderer replacing the MeshRenderer and the MeshFilter components, so I created this method:
    private static void ReplaceRenderer(this GameObject obj, SourceStudioModelv2 model)
    {
        if (obj.GetComponent<SkinnedMeshRenderer>() != null)
            return;

        var mesh = Object.Instantiate(obj.GetComponent<MeshFilter>().sharedMesh);

        const bool debugPoses = true;
        const bool useNativePoses = true;

        var nativeBuilder = debugPoses ? new StringBuilder($"Native Matrix\n{new string('=', 10)}\n") : null;
        var unityBuilder = debugPoses ? new StringBuilder($"Unity Matrix\n{new string('=', 10)}\n") : null;

        var nativeMatrix = model.GetBindPosesFromModel(nativeBuilder).ToArray();
        var unityMatrix = obj.transform.GetBindPoses(model.Bones, unityBuilder).ToArray();

        if (debugPoses)
        {
            Debug.Log(nativeBuilder.ToString());
            Debug.Log(unityBuilder.ToString());
        }

        var matrix = useNativePoses
            ? nativeMatrix
            : unityMatrix;

        mesh.bindposes = matrix;

        Object.Destroy(obj.GetComponent<MeshFilter>());
        Object.Destroy(obj.GetComponent<MeshRenderer>());

        var skinned = obj.AddComponent<SkinnedMeshRenderer>();

        skinned.sharedMesh = mesh;
        skinned.rootBone = obj.transform;
        skinned.bones = model.Bones;
    }

As you can see, I'm creating two bind poses, because one of them is created from this part of the code: https://github.com/lewa-j/Unity-Source-Tools/blob/c5469deb1d630c1582c940ff3cdb0f69fc55eda3/Assets/Code/Read/SourceStudioModel.cs#L724-L728
And this is how I create the bindposes:
Native Poses
    private static IEnumerable<Matrix4x4> GetBindPosesFromModel(this SourceStudioModelv2 model, StringBuilder sb = null)
    {
        for (var i = 0; i < model.MdlBones.Length; i++)
        {
            var mdlBone = model.MdlBones[i];
            // From: https://stackoverflow.com/a/49268287/3286975
            var matrix = (new Matrix4x4(
                new Vector4(mdlBone.PoseToBone[0], mdlBone.PoseToBone[1], mdlBone.PoseToBone[2],
                    mdlBone.PoseToBone[3]),
                new Vector4(mdlBone.PoseToBone[4], mdlBone.PoseToBone[5], mdlBone.PoseToBone[6],
                    mdlBone.PoseToBone[7]),
                new Vector4(mdlBone.PoseToBone[8], mdlBone.PoseToBone[9], mdlBone.PoseToBone[10],
                    mdlBone.PoseToBone[11]),
                new Vector4(0, 0, 0, 1)
            )).transpose;
            sb?.AppendLine($"{i}: {matrix.ToString("F2")}");
            yield return matrix;
        }
    }

Unity Poses
    private static IEnumerable<Matrix4x4> GetBindPoses(this Transform transform, Transform[] bones, StringBuilder sb = null)
    {
        for (var i = 0; i < bones.Length; i++)
        {
            var bone = bones[i];
            var matrix = bone.worldToLocalMatrix * transform.localToWorldMatrix;
            sb?.AppendLine($"{i}: {matrix.ToString("F2")}");
            yield return matrix;
        }
    }

And these are the values that each of them gives to me:
Unity Bindposes
https://pastebin.com/9tybGq7Z
And this is the result:

Native Bindposes
https://pastebin.com/YRZVq04y
But this one doesn't show anything.

I saw this reference on internet: https://hg.alliedmods.net/hl2sdks/hl2sdk/file/4966093d3274/utils/studiomdl/simplify.cpp#l3745
But I'm not sure if I'll be able to transcript this into Unity and if it will be useful...
If you would like to test this model out I created a *.unitypackage file for you to test:
https://mega.nz/file/xKpRSYwJ#j3ckM3GyFDFZKI6Y-OvN2cmcGC_GudGe2finLRQoA4U

So I don't know how to proceed in this case, could anybody help me out with this?

sentences:
Sending RPC calls from server to client inside Unity In my game inside Unity, I have two scenes setup. One for the main server ( acts like authoritative server ) and the other scene for my client. The game starts once my client connects to the server.

Now I am able to send RPC function calls from my scripts in my client scene to the server but I am not able to do it the other way around.

** Further edit to my code after comments **
*********** This is my client side script attached to GameObject CursorDetection inside Scene2 *****

 using UnityEngine;
    using System.Collections;

    // ON THE CLIENT SIDE
    public class CursorDetectionScript : MonoBehaviour {

        private bool hasGameStarted = false;
        void Update()
        {
           if (Input.GetMouseButtonDown(0))
           {
              networkView.RPC("mouseDown", RPCMode.Server,true);
           }
        }

        [RPC]
        public void mouseDown(bool isMouseDown)
        {

        }

    }

**** On the server side script inside scene1 *******

private void OnPlayerConnected(NetworkPlayer player)
{
    Debug.Log(" PLAYER CONNECTED " +player);
    networkView.RPC("AddNetworkPlayer", RPCMode.AllBuffered, player);
}

[RPC]
public void AddNetworkPlayer(NetworkPlayer player)
{
    playersList.Add(player);
    Debug.Log(" FIRST PLAYER IS " + playersList[0]);
}

 if(startGame)
 {
    networkView.RPC("SendMessageToClient1", RPCMode.AllBuffered, playersList[0]);
 }

[RPC]
public void mouseDown(bool isMouseDown, NetworkMessageInfo sender)
{
    isMouseDown = true;
    Debug.Log("CAN PLACE PANELS NOW" + " VIEW IS " + sender.sender.guid);
}

**** back on the client side script inside scene2 I called the SendMessageToClient1 function call *******

[RPC]
public void SendMessageToClient1()
{
    Debug.Log(" INSIDE CLIENT 1 ");
}

sentences:
How to apply code of certain script to another? I have a code in my "OnCollider" script to respawn whenever the player dies and has taken an object containing tag 'Respawn'.
1st script: OnCollider ;

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

    public class OnColllider : MonoBehaviour {
        public GameObject Doorfinder;
        public GameObject Door2;
        public Transform Camera;
        public Transform target;
        public GameObject Coin;
        public bool collided;
        public GameObject Playee;
        public GameObject currentRespawn;
        void Start(){
            Door2 = GameObject.Find ("Door0.2");
            Playee = GameObject.Find ("Player");
        }
        public void OnCollisionEnter2D(Collision2D collision){

            if (collision.gameObject.name ==

"scroll") {
            Destroy (collision.gameObject);
            Destroy (Doorfinder);
        }
        if (collision.gameObject.tag == "Fire" ) {
            Playee.SetActive (false);
        }

        if (collision.gameObject.name == "PathFinder") {
            Destroy (collision.gameObject);
            Destroy (Door2);
        }

        if (collision.gameObject.tag == "Coin") {
            Destroy (collision.gameObject);
        }

        if (collision.gameObject.tag == "subVillains") {
            Playee.SetActive (false);
        }
        if (collision.gameObject.tag == "Bramble") {

            Playee.SetActive (false);
        }

        Respawnable (collision);
    }
    public void Respawnable (Collision2D collision){
        if (collision.gameObject.tag == "Respawn") {
            collided = true;
            collision.gameObject.SetActive (false);

        }
        if (collided = true && Playee.activeInHierarchy == false) {
            transform.position = currentRespawn.transform.position;
            Playee.SetActive (true);
            collided = false;
        }
        if (currentRespawn.activeInHierarchy == false && collision.gameObject.tag == "Respawn") {
            currentRespawn = collision.gameObject;

        }

    }

}

2nd Script: Enemy;

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

public class MaxyMory: MonoBehaviour {
    public Vector2 origin;
    public float distance;
    public int layerMask;
    public float sider;
    public Vector2 secondorigin;
    public float bringer;
    public float lesngther;
    public GameObject destroy;
    public Vector2 origination;
    public float middle;
    public float lengther;
    // Use this for initialization
    void Start () {
        origin = new Vector2 (transform.position.x + bringer, transform.position.y + sider);
        origination = new Vector2 (transform.position.x + bringer, transform.position.y + middle);
        secondorigin = new Vector2 (transform.position.x + bringer, transform.position.y + lengther);
    }

    // Update is called once per frame
    public void Update(GameObject Playee){
        Debug.DrawRay (origin, Vector2.right*distance,  Color.red);
        Debug.DrawRay (secondorigin, Vector2.right * distance, Color.cyan);
        Debug.DrawRay (origination, Vector2.right * (distance + 30f), Color.gray);
        RaycastHit2D hit = Physics2D.Raycast (origin, Vector2.right, distance);
        RaycastHit2D anotherhit = Physics2D.Raycast (secondorigin, Vector2.right, distance);
        RaycastHit2D checker = Physics2D.Raycast (origination, Vector2.right, distance + 2f);
        if (hit.collider.tag == "Player" || anotherhit.collider.tag == "Player") {
            Playee.SetActive (false);
        }

    }

}

OnCollider is attached to the player while the enemy script is attached to the enemy itself.

sentences: How can I spawn and drag 2d object from a Canvas button? I want to create and drag an object from canvas button to scene. How can I do this?

sentences:
How to get a point to the left/right of a vector I have a position vector of a point in space and a quaternion for it's rotation. What i'm trying to calculate is a point too the left and a point to the right.

I have the position and rotation(quaternion) of the red dot. What I want is to get the position of the green dots. I have a float value for the distance I want these points to be.

With only the position and rotation is it possible to get a unit direction vector pointing left/right which I can multiply by my float value?

Edit: I also know the original direction vector.

sentences:
Constant orbit using Rigidbody in Unity I'm trying to make a few game objects (moons) orbit a planet in unity. Basically just picture a planet in the center of the screen, and a few small moons that orbit the planet with a constant velocity. I have gotten this to work nicely using transform.RotateAround(), but I wanted to take advantage of the physics engine that unity provides for realistic "bouncing" of the game objects relative to others as they collide.

I have tried a few things such as Hinge Joints, Configurable Joints, and even just adding forces to try to get it to move in a spherical manner. I can't seem to get it to work correctly though. The configurable joint is the closest that I've come, but it's a bit off and it doesn't stay orbiting. It's likely my lack of knowledge with using rigidbodies in 3d, but I figured someone out there could help get me on the right track. Thanks in advance for any help!

sentences:
Calculating Damage from from object collision I need to calculate the damage resulting from a crash of two objects.

I found the formula of the resulting kinetic energy:

E = m * v² / 2

I guess I also have to use the masses or sizes of the objects as well.

It will make a difference if the spaceship collides with a mountain (which certainly will make both of them dealing heavy damage), or the spaceship is colliding with a floating tennisball in which case neither of them are dealing damage.

sentences:
Managing multiple animation files in a Unity project I am on my project, but find it hard to understand what I'm missing from those few animation and rigging tutorials.
I have an FBX I modelled and rigged from blender... Or I could just take a model from Mixamo or other resources.
Is it possible to have loosely coupled .anim files which could be mix-matched at runtime with different FBXs?
It seems the Animator Controller can reference each .anim file independently if necessary, so I guess we can make one animation per fbx and split anim files in Unity project explorer... There must be a better way, right?

sentences:
Why does my game not update unless I'm moving the mouse? I'm pretty confused by what's happening. Now that I've finally put something moving on my screen, I notice it doesn't update unless I move the mouse, or press a key, or trigger other events.

Using PIX, the "Frame: #" counter only goes up when I fire these events. This is all that happens in my game loop:

while(GetMessage(&msg, NULL, 0, 0) > 0 && m_isRunning)
{
        TranslateMessage(&msg);
        DispatchMessage(&msg);

        m_gameGraphics->BeginRender();
        m_gameGraphics->EndRender();
}

BeginRender clears the screen, and EndRender presents to the swap chain. I thought maybe it was a problem with WndProc, but comparing it to other DirectX 11 game WndProcs, I don't see any major differences. I'm pretty confused, never seen this problem before, and I have no idea what causes it. I'm just hoping maybe someone will have some insight on why this might be happening.

sentences:
How can you represent equip-able items in a 2d game? I've been working on an item system for a post-apocalyptic RPG, with diablo as inspiration, and it would be awesome if I could visually represent an item that can be equipped on the player sprite. I was thinking you could have a player sprite with certain animations, then the equipped item would be drawn as if it was on the player with the same animations, so it syncs with the player animations but that couldn't work very smoothly, I imagine there's a better system.

How can you graphically represent an item worn on the player, which moves like he does, and looks as if he's wearing it? I'm not asking you how to do it in framework X or platform X (altho if you REALLY need it, I'm using Allegro 5 with codeblocks on win XP) but instead I'm asking you how to generally program such an idea.

sentences:
How can I add array of components to a new gameobject? I use Getcomponents to get all components from existing gameobject:

Component[] components = go.GetComponents(typeof(MonoBehaviour));

And I want to add them now to another gameobject:

for (int i = 0; i < components.Length; i++)
                {
                    var comp = components[i];
                    newObject.AddComponent<comp>();
                }

components is type Component[]

But when I try to type components inside the AddComponent<> the variable components not exist. Tried then to make the comp variable but can't type it inside the <> either.

sentences:
ECS: Should Systems access only one component-type Let's say I have a Transform-component-type, and a Color-component-type (to keep things simple).
I also have an entity E that is assigned both of these component-types.
To render E, my engine will internally have to bind a uniform-buffer containing both a mat4-transformation-matrix, and a vec3-color.
Now I think I heard conflicting opinions about whether there should be a strict 1-to-1 component_type-to-system relation, or whether it is considered more appropriate to have systems which act on multiple component-types.
In the latter case I'd know how to do things.
I would have a RenderSystem, which only considers entities which have both a Transform, and a Color component.
For the first case I don't have a solution though..
Both the TransformSystem and the ColorSystem wouldn't know how to render the entity, since they only hold a subset of what is required by the shader.
So I would just jump head-first into implementing my ECS as having one system potentially acting on multiple component-types, but I first wanted to hear from people having more experience with ECSs.
Are there good solutions in an ECS that maps systems 1-to-1 to components to achieve behavior that is the effect of the presence of multiple different component-types, or is a solution in which one system requires the presence of multiple component-types generally preferable?

sentences: Easiest way to create a 2d game in Java? I would like to create a 2d game in Java, but tutorials online for game libraries such as LWJGL are usually filled with errors once I compile the project. Most people do not explain very well, and just go on very quickly. Can someone please provide me a couple examples with source code, and somewhere to have a starting point? I used to have trouble with making a GUI and you guys helped me through, hopefully you can do the same again!

sentences:
Ouya build experiencing odd graphical artifacts, screen half black I'm witnessing very odd graphical artifacts when I run my Unity game on Ouya. After the Unity splash screen, the game loads with the screen half black.

This seemingly has started occurring out of the blue. It also doesn't occur in the editor or the standalone build, only on Ouya. I can't think of a single reason why this would be happening. If I open the Ouya menu screen and close it, the game returns to normal; somewhat, as there may be some artifacts lingering but the screen isn't half black like in the screen shot above.

I know there's not much to go off of, but any insight into why this may be happening is greatly appreciated.

sentences:
Why in the dialogue system it's showing in the conversation only 2 sentences and not the whole 3 sentences? The first script the manager is attached to new empty gameobject:
I want the conversation to start automatic when running the game so i'm calling the method TriggerDialogue in the manager:

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

public class DialogueManager : MonoBehaviour
{
    public DialogueTrigger dialoguetrigger;

    private Queue<string> sentences;

    // Use this for initialization
    void Start ()
    {
        sentences = new Queue<string>();

        dialoguetrigger.TriggerDialogue();
        DisplayNextSentence();
    }

    public void StartDialogue(Dialogue dialogue)
    {
        Debug.Log("Starting conversation with " + dialogue.name);

        sentences.Clear();

        foreach(string sentence in dialogue.sentences)
        {
            sentences.Enqueue(sentence);
        }

        DisplayNextSentence();
    }

    public void DisplayNextSentence()
    {
        if (sentences.Count == 0)
        {
            EndDialogue();
            return;
        }

        string sentence = sentences.Dequeue();
        Debug.Log(sentence);
    }

    void EndDialogue()
    {
        Debug.Log("End of conversation.");
    }
}

Next the DialogueTrigger:

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

public class DialogueTrigger : MonoBehaviour
{
    public Dialogue dialogue;

    public void TriggerDialogue()
    {
        FindObjectOfType<DialogueManager>().StartDialogue(dialogue);
    }
}

Last the Dialogue:

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

[System.Serializable]
public class Dialogue
{
    public string name;

    [TextArea(3, 10)]
    public string[] sentences;
}

In the editor I filled the all 3 TextAreas each one with a sentence.

Hello world

Hi everyone

I have woke up

When running the game it's showing only to the Hi everyone it's not showing the I have woke up.
And it also not showing the "End of conversation." in the log.

sentences: Socket.io emit textfield Hello everyone I learned how to emit from socket.io website guides but I was wondering how does the chat example receive its input? For example in my cocos2dx app how do I pass a text field over to the socket.io chat?

sentences:
Client-side login and password save I'm wondering what would be the best way to store password and login in the client. Many people complain that they need to re-enter this every time they log in and they want me to make a way to save it. But how to save it? Saving it as plain text in game folder wouldn't be clever, but neither would encrypting it help so much. It would still be easy to decrypt the data.

How would you do that?

Best regards!

sentences:
Rotation matrix for a 3D vector I have a direction vector on which I have to apply some rotation to align it to positive z-axis.
To use Matrix.CreateRotationX(angle) of XNA, I need the angle for which I'd have to compute cos or tan inverse.

I think this is a complex task to do. Also, eventually those are also converted to sin(angle) and cos(angle) in the matrix.

Is there any inbuilt way to create rotation matrix from a 3D vector?

However, I can write the function but still asking if there is one already there.

sentences:
Detected problems - libandengine.so text relocations I am creating a game with AndEngine on Android Studio (v.3.0.1). When I run the game on my Honor 8 (7.0) everything works as expected. But on the Samsung A3 (7.0) or J5 (7.1.1) a Dialog appears saying: 'Detected problems with app native libraries (please consult log for detail): libandengine.so: text relocations.

Logcat: W/linker: /data/app/whatever.at.hatchy-1/lib/arm/libandengine.so has text relocations. This is wasting memory and prevents security hardening. Please fix.

AndEngine build.gradle:

apply plugin: 'com.android.library'

android {
    compileSdkVersion 21
    buildToolsVersion "26.0.2"

    defaultConfig {
        minSdkVersion 9
        targetSdkVersion 21

        ndk {
            moduleName "andengine_shared"
        }
    }
    sourceSets {
        main {
            jni.srcDirs = []
        }
    }
    compileOptions {
        encoding "UTF-8"
    }
    buildTypes {
        release {
            minifyEnabled false
            proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.txt'
        }
    }
}

App build.gradle:

apply plugin: 'com.android.application'

android {
    compileSdkVersion 26
    defaultConfig {
        applicationId "whatever.at.app"
        minSdkVersion 19
        targetSdkVersion 26
        versionCode 1
        versionName "1.0"
        testInstrumentationRunner "android.support.test.runner.AndroidJUnitRunner"
    }
    buildTypes {
        release {
            minifyEnabled false
            proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
        }
    }
}

dependencies {
    implementation fileTree(dir: 'libs', include: ['*.jar'])
    implementation 'com.android.support:appcompat-v7:26.1.0'
    implementation 'com.android.support.constraint:constraint-layout:1.0.2'
    testImplementation 'junit:junit:4.12'
    androidTestImplementation 'com.android.support.test:runner:1.0.1'
    androidTestImplementation 'com.android.support.test.espresso:espresso-core:3.0.1'

    compile project(':andEngine4')
    compile 'com.google.android.gms:play-services-analytics:11.8.0'
    compile 'com.google.android.gms:play-services-ads:11.8.0'
    //compile 'com.android.support:support-v4:23.4.0'
}

Additionally the camera/gameview size changes and doesn't adapt to the set width and height but don't know if this problem is dependent on the same issue.

Does anybody know what todo in such case?

Thanks

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:
3D picking for mouse move event I implemented color picking recently and I would like to use it as kind of highlight when mouse is over an object but I am concerned about performance. Color picking requires whole frame to be drawn, loosing effectively up to half of performance (MouseMove can happen nearly every frame).
Also, when mouse moves it is very likely to be nearly above previous point - is there any way how to use this fact to improve performance of 3D picking? Or is my best chance to use some other technique of 3D picking or approximation of results?
tl;dr If I wanted to do "realtime" 3D picking - on MouseMove, what is the best technique for doing so performance-wise?

EDIT: the exact numbers are even worse, when rendering 1m triangles render time increase from 1.5ms to 2-6ms and in spikes up to 15ms.

sentences:
3D Studio Max biped restrictions? I have a stock biped character in 3D studio max which has a jump animation.

The problem I have with the jump animation is that there is actual y offset happening inside it which makes it awkward to play while the character is jumping since it's not only jumping in the game world but the jump animation is adding its own height offset.

I'm tryuing to remove the jump animations height offset, so far I've found the root node and deleted all its key frames which has helped a bit.

The problem I'm having now is that the character still has some height offset and if I try to lower it it has a fake 'ground' that isn't at 0 and the limbs sort of bend on the imaginary floor, si there a way to remove this restriction just for the jump animation?

Here's what I mean: http://i.imgur.com/qoWIR.png

Any idea for a fix? I'm using Unity 3D if that opens any other possibilities...

sentences:
Where does the Framework (XNA) end and the API (DX) begin? I have read a lot of interesting questions asking about XNA vs. OpenTK vs. SlimDX vs. OpenGL vs. DX, and while it is really useful to get others general impressions from 100s of hours using these various APIs/Frameworks, I haven't seen any answer which clearly defines what the scope of each is.

It's understood what the difference between an API, Engine and Framework is in theory, but for someone who has limited experience with graphics systems, its harder to see what on the practical side falls into each category. (Not made easier by all the overlap! e.g. XNA implementing a content pipeline as an integral part)

Take for example face culling - XNA 'does' this in the background without the programmer needing to think about it, but where does it happen? Is there a 'cull face' function in DX that must be called, or perhaps above in XNA? Or does the GPU or its driver do it?

I read in the documentation for one of the managed projects (annoyingly I can't remember which) about how difficult it was to implement efficient rendering code, and how that project abstracted it. This unnerved me a bit, and made me wonder just what XNA is doing beneath DrawIndexedPrimitives that would have to be done manually should the framework be left for something more flexible.

What does XNA do in the background, when rendering that cube, that a managed API would not?

sentences:
Is index drawing faster than non-index drawing I need to draw a lot of polygons consisting of 6 vertices's (two triangles).

Without any texture coordinates, normals etc., both approaches result in 72 bytes. In the future I would definitely also need texture coordinates and normals, which would make index drawing consume less memory. Not a lot though.

So my question is: For VAOs with few vertex overlaps, which approach is faster? I don't care about the extra memory consumed by non-index drawing, only speed.

Edit: To make it clear.

Non-index approach:

float[18] vertices = {
//Triangle 1
1,1,0,
1,0,0,
0,0,0,

//Triangle 2
1,0,0,
0,1,0,
0,0,0,
};

Index approach:

float[12] vertices = {
1,1,0,
1,0,0,
0,0,0,
0,1,0,
};

int[6] indices = {
//Triangle 1
0,1,2,

//Triangle 2
0,3,2
};

sentences:
How to do collision detection on marching cubes terrain? I'm writing the physics part of my game engine. The world uses the marching cubes algorithm  on a 3d perlin noise to make the terrain.

How do I do collision detection on the resulting mesh? I can't use SAT since the terrain is not convex and subdividing it into smaller convex parts seems to be nearly impossible.

What is the best collision detection algorithm for such a mesh? The objects that are supposed to collide with the terrain can be any convex polyhedron.

EDIT: The terrain is not "cubed" (like minecracft). The terrain is smooth with slopes. This is pretty close to what my terrain looks like (this is NOT my video): https://www.youtube.com/watch?v=-4rA3fdKWQA

I am looking for a general collision detection here. I need the point(s) of contact and the normals so that I can put these into my collision resolver.

Example of usage is throwing a box onto the terrain and it should roll and bounce approximately like it would in the real world.

sentences:
Is there any "object" in monogame for windows phone 8, that is similar to Toast in Android? The title pretty much sums it all.

Is there any "object" in monogame for windows phone 8 (for monogame to be exact), that is similar to Toast in Android?

My purpose is to give a notification / hint at what user do, until certain period / until next user input.

For example:
If the player tapped "attack", then there is text shown "Select your target" in either top or bottom screen. Just like Toast in android.

Note 1 : I can do it manually, but i'm just curious. If I can use a pre-made function (such as Toast) it'll be simpler to implement, rather than making it myself.

Note 2 : Mine is a turn based tactic game (such as FF Tactic)

Thank you.

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 would I go about implementing a globe-like "ballish" map? I am new to 3D development and I have this idea of having the game world like our globe is - a ball. So, there would be no corners in the map and the game is top-down RTS game. I would like the camera to go on and on and never stop even though you are moving the camera to the same direction all the time.

I am not sure if this is even possible, but I would really like to build a globe-like map without borders. Can this be done, and how exactly? I am using XNA, C#, and DirectX. Any tutorials or links or help is greatly appreciated!

sentences:
What makes a good educational game? I'm currently creating a game framework/engine for educational games. My hope is that this can be used in elementary schools. It is of course extremely important that the games are both fun and educational.

Any ideas what should be in my initial requirement specification?

What makes a good educational game?

Which platforms should I target?

sentences:
How do I determine the forward/right direction when I have the "up" vector? - Unity I am trying to fix a gameobject for e.g. a cube (which i am using as a sensor) on my character. I need the cube to rotate (with orientation control from the inspector - I have a public quaternion rotation variable set). I have identified 3 vertices using ray cast to fix my sensor onto the character. I already have determined the normal of these vertices which will be the "up" direction of the cube. I am wondering how I can determine the forward/right vector to use in the LookRotation() function. I need to basically be able to rotate the cube ON the character even as the character moves on animation. This is my code, and as of now there is no rotation happening. I'm sure I am missing something and would really appreciate help. I really hope this is enough explanation.

using System.Collections;

using System.Collections.Generic;
using UnityEngine;

public class orientation : MonoBehaviour
{
    // importing from Vertex Finder Script to use InterpolatedNormalInWorldSpace value

private VertexFinder script;
public Transform target;

// to edit orientation of sensor in Unity Inspector
public Quaternion rotation_edit;

// Start is called before the first frame update
void Start()
{
    script = GetComponent<VertexFinder>();
}

Quaternion TurretLookRotation(Vector3 approximateForward, Vector3 exactUp)
{
Quaternion rotateZToUp = Quaternion.LookRotation(exactUp, -approximateForward);
Quaternion rotateYToZ = Quaternion.Euler(90f, 0f, 0f);

return rotateZToUp * rotateYToZ;
}

// Update is called once per frame
void Update()
{
    Vector3 relativePos = target.position - transform.position;

    // aligning axes of sensor to z axis and y axis respectively
    Quaternion rotation1 = TurretLookRotation(relativePos, script.interpolatedNormalInWorldSpace);

    // setting rotation of sensor to values entered in Inspector with respect to the above aligned axes
    transform.rotation = rotation1 * rotation_edit;

}

}

sentences:
3D Camera Rotation (Unwanted Roll) - Space/Flight Cam I am working on a camera class that will have full range of motion (pitch, yaw, and roll).  When only altering pitch and yaw, I am getting a large amount of roll.

I understand that the issue is related to:
I'm rotating an object on two axes, so why does it keep twisting around the third axis?
However, I have not been able to come up with a solution.  I would like the camera to have all motion (i.e. like a spaceship).  Here is the relevant code:
void Camera3D::update(const glm::vec2 & current_mouse_coords){

    if (m_mouse_first_movement) {
        if (current_mouse_coords.x != 0 || current_mouse_coords.y != 0) {
            m_mouse_first_movement = false;
        }
    } else {
        const glm::vec2 mouse_delta = (current_mouse_coords - m_old_mouse_coords) * mouse_sensitivity;
        pitch(-mouse_delta.y);
        yaw(-mouse_delta.x);
    }
    m_old_mouse_coords = current_mouse_coords;
}

void Camera3D::pitch(const float angle){

    // Pitch Rotation
    const glm::quat pitch_quaternion = glm::angleAxis(-angle, m_camera_right);

    // Update Vectors
    m_camera_up = glm::normalize(glm::rotate(pitch_quaternion, m_camera_up));
    m_camera_forward = glm::normalize(glm::rotate(pitch_quaternion, m_camera_forward));
}

void Camera3D::yaw(const float angle){

    // Yaw Rotation
    const glm::quat yaw_quaternion = glm::angleAxis(angle, m_camera_up);

    // Update Vectors
    m_camera_right = glm::normalize(glm::rotate(yaw_quaternion, m_camera_right));
    m_camera_forward = glm::normalize(glm::rotate(yaw_quaternion, m_camera_forward));
}

glm::mat4 Camera3D::get_view_matrix(){
    m_view_matrix = glm::lookAt(
        m_camera_position,
        m_camera_position + m_camera_forward,
        m_camera_up
    );
    return m_view_matrix;
}

I would like the movement of the camera to be based on local coordinates so the controls (up/down/left/right/vertical up/vertical down) move the camera along its own local axis.
Additional clarification based on the comment below:
If I look up 60 degrees and then left, I would like the horizon to stay level (essentially adding roll in the opposite direction to keep the horizon level)
Any help is appreciated.  Thank you!

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

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

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

sentences:
How to detect whether or not a tile is occupied? I'm using Python 2.7 on Win7x64 with PyGame

What is the best way to iterate over all the tiles in the game or screen, efficienty? Ideally I have about 800 tiles, but that is a dynamic number I've been playing around with.

The way I've got it is the logic is looking through all the tiles per frame (at 60fps, and I haven't yet got GFX and Logic decoupled):

for tile in TILES: #tiles is a simple list
  if player_pos is in tile.coords: #coords is a list filled with (x, y) tuples
     tile.color = RED #a simple attribute change, performance hit whether this line is 'pass' or not

but the list of TILES is huge enough that looking through 800 tiles, 60x a second obviously isn't efficient.

What is the best way to proceed from here? How do I find the occupied tiles, without iterating over them every frame? I could split the map up into quadrants or something similar, but maybe there's a fancy concept I'm not familiar with that would work better.

edit: Solved, for now: I added an attribute to the Tile class that has the lowest and highest two coordinates and then every frame, the logic looks to see of the player's pos is between the two ranges like so:

for tile in TILEs: #pos is player pos
    if tile.range_x[0] <= pos[0] <= tile.range_x[1]: #range_x is the lowest and highest
                                       # x coordinate within the tile in pixels
        if tile.range_y[0] <= pos[1] <= tile.range_y[1]: #low and high y here
                     pos_tiles.append(tile)

edit2; I should mention that a tile holds several coordinates, meaning a unit (or player) can move within a tile.

sentences:
Entity Component System: system and components relation I'm planning to develop a game in C# (but I don't think that language matters) and I'll be using Entity Component System since I know by design that my game will have a lot of different game items with different twisted behaviours and logics.
I have some experience using Unity ECS which I find very easy and intuitive. I've also programmed games in the past using the old "inheritance approach" and I found that pattern very not scalable.
As far as I know, a pure ECS (which is not what Unity implements) works like this:

A GameObject is just a collection on Components, it may be seen as a wrapper class or as a shared index in some parallel arrays of Components.
A Component is a collection of data (basically a record) which holds the data needed by its relative System to handle it. It does not implements game logic itself.
A System is a world object which loop through each GameObject which has a component it can process and update game logic of that component.

My point is: if the Systems are the ones responsible for the actual game logic update (practically speaking, the game logic code is written inside the system), is there a 1:1 relation between every component and every system ? Let me explain with an example: let's say I have 2 components:

RenderSpriteComponent
RenderLightSourceComponent

The first one does a simple 2D sprite rendering (using OpenGL or whatsoever); the second one send a light source to the rendering shaders. They do similar operations but with some actual differences. My question is: since they behaviour is different, should I implement two different Systems which will handle them separatly? If not, should I add a bunch of IF statements or overloads to handle those two components inside the same System?
From my point of view both ways seem unnecessary, especially if the ECS should improve code scalability. Using one of those approach would force me either to implement a different system for each component I have (implying a lot of GameObjects loops) or either to fill my Systems with if and overloads making them impossibile to understand after a certain point.
Furthermore, from what I can see and understand, Unity implements a different version of this pattern in which every component implements its own logic (in the Update method) and the GameObject is a wrapper class which has an internal list of components to update. Systems don't exist at all (or if they do they do, they do so for other reasons). This implementation looks easier and more "elegant" from my point of view, but I can't understand why it's not so spread and everyone sticks to the "classic" ECS implementation which has those "problems" I've described above. At the same time, I do not have control over the priority of the components updates, which can be useful in some cases.
I understand there isn't an "absolute" better way to design your game structure, but I'd like to know how is generaly implemented. Or which factors would make a way better than the other.

sentences: What is the difference between HDRP materials and normal materials I want to understand these materials I am always confused of using HDRP materials that which one is used for low texture which one is for high texture, for glass, for particles and many other.

sentences:
Why does Unity in 2d mode employ scaling and the default othographic size the way it does? I previously used SFML, XNA, Monogame, etc. to create 2d games, where if I display a 100px sprite on the screen, it will take up 100px. If I use 128px tiles to create a background, the first tile will be at (0, 0) while the second will be at (128, 0).

Unity on the other hand, has its own odd unit system, scaling on all transforms, pixel-to-units, othographic size, etc, etc. So my question is two-fold, namely:

Why does Unity have this system by default for 2d? Is it for mobile dev? Is there a big benefit I'm not seeing?
How can I setup my environment, so that if I have a 128x128 sprite in Photoshop, it displays as a 128x128 sprite in Unity when I run my game?

Note that I am targeting desktop exclusively.

sentences:
How can I animate a portion of the textures on a model? I have a model to which I have attached multiple textures. Both textures are currently static, but if I want to move (or slide) the texture which is on the top (in UV space), is that possible?

Maybe by moving the texture coordinates or something?

sentences:
how to duplicate a button via script? I have the following code:

public GameObject characterButtonPrefab;
public GameObject characterButtonContainer;
public GameObject optionsContainer;

public GameObject[] charButtons;
private int charButtonsIndex = 0;
private Text[] cBT;
private string[] buttonTexts = new string[] {"Strength 5", "Agility 5", "Intelligence 5", "Charisma 5", "Diplomacy 5" };

private void Start()
{
    LevelIsOver = false;
    IsNextWave = false;
    //Time.timeScale = 1;

    for (int i = 0; i < charButtons.Length; i++)
    {
        int size = charButtons.Length;
        cBT = new Text[size];
        GameObject container = (GameObject)Instantiate(characterButtonPrefab);
        container.transform.SetParent(characterButtonContainer.transform, false);
        cBT[i] = characterButtonPrefab.transform.FindChild("Text").GetComponent<Text>();
        cBT[i].text = buttonTexts[Random.Range(0, buttonTexts.Length)];
        charButtonsIndex++;
    }

    //if (charButtons.Length > 0)
    //{
    //    GameObject currentChar = (GameObject)Instantiate(characterButtonPrefab);
    //    currentChar.transform.SetParent(optionsContainer.transform, false);
    //    currentChar.transform.SetSiblingIndex(0);
    //    currentChar.GetComponent<Button>().onClick.AddListener(() => CharacterSelection());
    //}
}

I declared the size of array to 20 in the inspector and everything work fine. The buttons are created and text changed.
The question is how do I duplicate the first button in that array to another panel ? I have searched the internet  but nothing found about this.

I have tried this:

GameObject currentChar = (GameObject)Instantiate(charButtons[0]);
     currentChar.transform.SetParent(optionsContainer.transform, false);
     currentChar.transform.SetSiblingIndex(0);
     currentChar.GetComponent<Button>().onClick.AddListener(() => CharacterSelection());
 }

But I get ArgumentException: The Object you want to instantiate is null.

sentences:
Fps independent rotation I'm trying in my game to have camera rotation speed idependent of fps. For keyboard it works without problems but not for mouse movoment. At 60 fps it works good but at 200 for example rotation is to slow.

mouse_dif is difference since last frame in pixels. Maybe thats a problem too, bigger screen resolution will rotate faster then smaller.

My code:

const float rot_speed = u.GetRotationSpeed(); // returns 5.f
float val = 0;

if(allow_input == ALLOW_INPUT || allow_input == ALLOW_MOUSE)
    val += float(mouse_dif.x)/200;

if(val > rot_speed*dt)
    val = rot_speed*dt;
else if(val < -rot_speed*dt)
    val = -rot_speed*dt;
u.rot += val;

How can I make it fps independent?

sentences:
Unity OnCollision2D not working I'm new to Unity and C# (though I'm experienced in python) and I am trying to make a pong clone, I've spent ages googling and trying to fix this issue but for some reason my OnCollisionEnter2D won't work

My paddle hit method:

public void PaddleHit(Collision2D col)
{

    float y = WhereBallHitPaddle(transform.position,
        col.transform.position,
        col.collider.bounds.size.y);

    Vector2 dir = new Vector2();

    //determing direction to left or right depending on the paddle

    if (col.gameObject.name == "Player1")
    {
        dir = new Vector2(1, y).normalized;
    }
    if (col.gameObject.name == "Player2")
    {
        dir = new Vector2(-1, y).normalized;
    }

    rb.velocity = dir * speed;

    //play ball paddle collision sound
    SoundManager.Instance.PlayOneShot
        (SoundManager.Instance.ballpaddle);

}

When I run the game the ball moves, then when it comes into contact with a paddle it just stops moving, and if it comes into contact with a wall it bounces off, but at no point does it trigger the OnCollisionEnter2D. (I think my codes indents aren't showing properly here but it is all indented correctly, there are no compile errors or anything).

sentences:
OpenGL object load in reverse I am trying to load a model and it is loading it in reverse. When I am trying to rotate it 180 degrees it changes the lightning as well.
I am not sure what I need to do to change the position that eh model is facing when is being loaded.

This is the object loader:

if (!submarineShader->load("BasicView", "glslfiles/basicTransformations.vert", "glslfiles/basicTransformations.frag"))
{
    cout << "failed to load shader" << endl;
}
glUseProgram(submarineShader->handle());  // use the shader

glEnable(GL_TEXTURE_2D);

cout << " loading model " << endl;
if (objLoader.loadModel("submarine_/submarine v2/submarine5.obj", model))//returns true if the model is loaded, puts the model in the model parameter
{
    cout << " model loaded " << endl;

    model.calcVertNormalsUsingOctree();

    model.initDrawElements();
    model.initVBO(submarineShader);
    model.deleteVertexFaceData();

}
else
{
    cout << " model failed to load " << endl;
}

sentences:
How to make camera smooth when following player When my character moves through my cameras 'FollowPlayer' script, the background just looks really glitchy and bad Is there anyway to fix this?

This is my script:

using UnityEngine;
using System.Collections;
public class FollowPlayer : MonoBehaviour {
    Transform bar;

    void Start() {
        bar = GameObject.Find("PlayerMovingBar").transform;
    }

    void Update() {
        transform.position = new Vector3(
            bar.position.x, transform.position.y, transform.position.z);
    }
}

sentences: Is there a way to get what pixel is being processed within the fragment shader? In OpenGL, a fragment shader goes through each pixel, right? So is it possible (within the shader itself) to get what pixel it is processing and color each specific pixel?

sentences:
XNA 4 / Monogame 3d tunnel collision I am trying to collide an aircraft with a FBX tunnel model. I don't know how to create multiple bounding boxes for a tunnel. The tunnel is contains a single mesh. I tried using the triangle picking sample here http://xbox.create.msdn.com/en-US/education/catalog/sample/picking_triangle
I also created a bounding sphere around the tunnel to be able to detect if the aircraft is inside the tunnel. If the ship is inside the tunnel then I check the triangle & ray intersection. I also detect the intersection. I tried changing the rotation and position of the ship when intersection occurred but although I can detect the intersection ship passes through the tunnel surface mostly and my rotation doesn't work well.

I also tried to calculate ray & plane (here it is triangle) reflection as below:

            if (intersection < 0.4f)
            {
                Plane pickedTriangle = new Plane(vertex1, vertex2, vertex3);
                Vector3 reflectionVector = Vector3.Reflect(direction, pickedTriangle.Normal);
                newPosition = modelPosition + direction * gameSpeed * reflectionVector;
                newDirection = reflectionVector;
                tIntersected = true;
            }

As I see newPosition isn't calculated correctly.

My question is; how can I calculate a new position after a ray & plane intersection.

I think this causes the ship sometimes pass the tunnel surface sometimes.
If there is a better way to detect and calculate tunnel collision I'll appreciate it.

Thanks

sentences:
Confused about order of operation when using a Matrix in XNA, C# Here are two different pieces of code

This is what I started with

Vector2 hold = Vector2.Transform(pos1, mat1);
Matrix inv = Matrix.Invert(mat2);
Vector2 pos2 = Vector2.Transform(hold, inv);

And this is what i'm told is the simplified version

Matrix matrix1to2 = mat1 * Matrix.Invert(mat2);
Vector2 pos2 = Vector2.Transform(pos1, matrix1to2);

What I don't understand is, why isn't the first line in the simpilifed version

Matrix matrix1to2 = Matrix.Invert(mat2)*mat1;

Since in matrix order it looks like the matrix on the right would take effect first and in the original we have mat1 being multiplied in first

Another example,

The following image shows the order of operations desired

http://www.riemers.net/images/Tutorials/XNA/Csharp/Series2D/mat1.png

The tutorial says that to create this transformation you use;

Matrix carriageMat = Matrix.CreateTranslation(0, -carriage.Height, 0) * Matrix.CreateScale(playerScaling)
* Matrix.CreateTranslation(xPos, yPos, 0) * Matrix.Identity;

How could this work if the the order was left to right?

sentences: Editor Window - How to create this? I am trying to create this in my editor window but not sure how. Basically a drop down arrow, next to a C# icon, next to a toggle, next to a Label with a cog at the end

sentences:
How can I make relative movement in GameMaker studio? I know I can change the hspeed and vspeed properties on my object. Assume I do it for the directional diamond in a squared-style movement game (not necesarily snapping to tiles, but it could). So the following scenarios apply (for any constant K) for my obj_Hero object:

Pressing UP: vspeed is -K, hspeed is 0
Pressing DOWN: vspeed is K, hspeed is 0
Pressing LEFT: vspeed is 0, hspeed is -K
Pressing RIGHT: vspeed is 0, hspeed is +K
Otherwis: vspeed and hspeed are 0
Only one directional arrow at the same time will be considered (the last pressed).

My player starts from position of an obj_Start object, and wins when reaching (colliding) an obj_End object. In the meantime, an obj_Enemy will be chasing the player using a step avoid strategy to avoid the player. The player loses if the enemy collides with him. Assuming I can correctly select the enemy current direction sprite, I'm done.

So far, so good.

Now assume some parts of my game have moving platforms. They have a specific platform speed vector (PSH, PSV), assuming I have such constants.

I know I could always condition my player movement speed to be:

(K + PSH, PSV) for player moving right
(-K + PSH, PSV) for player moving left
(PSH, K + PSV) for player moving down
(PSH, -K + PSV) for player moving up
(PSH, PSV) for player not moving

But... How do I alter (relative to the platform movement, as I do with the player) the enemy movement when it is actually generated by the step avoiding strategy?

sentences:
How do I adjust the origin of rotation for a group of sprites? I am currently grouping sprites together, then applying a rotation transformation on draw:

private void UpdateMatrix(ref Vector2 origin, float radians)
{
     Vector3 matrixorigin = new Vector3(origin, 0);
     _rotationMatrix = Matrix.CreateTranslation(-matrixorigin) * Matrix.CreateRotationZ(radians) *  Matrix.CreateTranslation(matrixorigin);
}

Where the origin is the Centermost point of my group of sprites.  I apply this transformation to each sprite in the group.

My problem is that when I adjust the point of origin, my entire sprite group will re-position itself on screen.

How could I differentiate the point of rotation used in the transformation, from the position of the sprite group?  Is there a better way of creating this transformation matrix?

EDIT

Here is the relevant part of the Draw() function:

Matrix allTransforms = _rotationMatrix * camera.GetTransformation();

spriteBatch.Begin(SpriteSortMode.BackToFront, null, null, null, null, null, allTransforms);

for (int i = 0; i < _map.AllParts.Count; i++)
{
    for (int j = 0; j < _map.AllParts[0].Count; j++)
    {
       spriteBatch.Draw(_map.AllParts[i][j].Texture, _map.AllParts[i][j].Position, null, Color.White, 0, _map.AllParts[i][j].Origin, 1.0f, SpriteEffects.None, 0f);
    }
}

This all works fine, again, the problem is that when a rotation is set and the point of origin is changed, the sprite group's position is offset on screen.

I am trying to figure out a way to adjust the point of origin without causing a shift in position.

EDIT 2
At this point, I'm looking for workarounds as this is not working.  Does anyone know of a better way to rotate a group of sprites in XNA?  I need a method that will allow me to modify the point of rotation (origin) without affecting the position of the sprite group on screen.

EDIT 3
I think if I was able to reset the screen coordinates to (0,0) at my sprite position, it would essentially allow me to re-position the origin without movement.  I essentially need a way to set the current position/rotation, then start from scratch.  Does anyone know if it is possible to make my sprite the new screen origin?

MOVING ORIGIN WITHOUT A ROTATION:

MOVING ORIGIN WITH A ROTATION (notice how it shifted upwards):

sentences:
How to prevent a character from going up a steep hill with a height map? I've been trying to make my character unable to go up steep hills, but I just can't manage to make it work. I'm using a simple height map which stores the height for every (x, z) point within the map.
I've tried to do this(using C# and XNA):

float height1 = TerrainHeightAt(cam.Position);
float height2 = TerrainHeightAt(cam.Position + cam.GetVelocity());
//If the difference between the two is bigger than a certain constant, don't move.

Basically I find the current height and the future height of the camera. Then, I check if the character is attempting to go up a too steep hill, and if so, I prevent the character from moving. This is not working and I can't see why it isn't.

So my question is:
What am I doing wrong? I would appreciate any link(specially using XNA, but general articles would be great too) showing how to achieve this.

Thank you.

sentences: Unity trigger problem I have been making my first game but I have encountered a small problem. To show the text when you win, you have to go into a block with the OnTriggerEnter line. I cannot get to this block however, because when I put my player (a sphere) as a trigger it just passes through the ground. How do I fix this?

sentences:
Effective AI for 3D Motion I am developing a game in XNA and am trying to create an effective AI for the enemy and friendly spaceships but am having a hard time keeping the game effective without disadvantaging one side or the other (deliberately). My current setup is as follows:

Ship targets enemy based on proximity.
Ship changes direction and moves toward target, firing when in range. Ship fires single repeater weapon in the forward direction.
Ship will not change direction when closer than certain distance from enemy.
If you are directly following and shooting at a ship, the ship does not attempt to evade fire. (consequence of #3)
All ships have similar firepower.

I am trying to improve this system and am willing to rewrite if necessary. Most of the ships end up flying around each other, shooting but never hitting. I have thought of several ideas to improve it:

Once health drops significantly, ship will boost away from firing ship.
Some ships are randomly chosen to be equipped with torpedoes (maybe add aft firing?).
Make ships more wary of attacking cruisers (they tend to die quickly when attacking).

Does anyone have any other suggestions as to improve the AI of the ships? Does anyone have a completely different system of doing this?

sentences:
Where can I find a free dictionary of words? Hi
I'm writing a game where the player has to connect a group of letters to form words. Something like bookworm but it will be very different I hope.

The point of the question is that I need to build a dictionary of words.

I made a simple java program that crawls the web and  extracts words, but a lot of trash is mixed with the good words and it's impossible to clean it. I'm talking about 100,000 words.

Is there any dictionary available that can be freely used or anybody has an idea of how to build one?

Thanks!

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: Lost connection to forge in eclipse So I am using eclipse to make mods for Minecraft. I recently took a break and was doing other things. My problem is when I came back to it, all my work was gone. There is nothing in the file explorer. The only changes I made to my computer between now and the last time I used eclipse is that I cleaned up my desktop (I moved a few related files into other folders) and that I installed a program called MCreator (to help with a class I'm teaching, and it may have messed with some of the related files). Does anyone have any idea what would have caused it and/or how to fix this?

sentences:
How can I produce heatmaps based off of player reported data? For a really good example of what I'm talking about, see how the developer of Replica Island does it based off of Player deaths: http://www.youtube.com/watch?v=7-62tRHLcHk&feature=player_embedded#t=37m

How can I easily produce heatmaps based off of data that I pass in?

Halo 3 is another good example of heatmap usage in game data reporting: http://www.bungie.net/Online/Heatmaps.aspx

sentences:
How can I create borders in an open-world game that don't feel artificial? When creating open-world maps, a big issue to take into consideration is how "borders" of sorts are implemented. Obviously, in an open-world game, there shouldn't be invisible-wall borders, as it ruins immersion, and makes the game feel more "artificial".

I've done a little bit of research online and I've found the following methods:

Have the map be an island, surrounded by water that will kill you if you venture out too far.
Have the map be surrounded by mountains that are much too steep to climb over.
A combination of the above; mountains plus a body of water. The Elder Scrolls V: Skyrim does something like this but does have places where paths lead out of the world. (Thanks @Pharap)

These seem like the best methods but I'm wondering if there are any other methods that can be used to create borders in an open world without ruining immersion.

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:
Can't move rectangle constantly with key down I can only move the rectangle every time I push a key down. How would I continuously move my shape when the key is down?

Here's my code:

for event in pygame.event.get():

    if event.type == pygame.QUIT:
        running=False

    if event.type == pygame.KEYDOWN:
        if event.key == pygame.K_d:
            lead_x_change += -10
        if event.key == pygame.K_a:
            lead_x_change += 10
        if event.key == pygame.K_w:
            lead_y_change += -10
        if event.key ==pygame.K_s:
            lead_y_change += 10

    if event.type == pygame.KEYUP:
        if event.key == pygame.K_a or event.key == pygame.K_d:
            lead_x_change = 0

    rectx += lead_x_change
    screen.fill(color)
    rect=pygame.Rect(rectx,recty,10,10)
    screen = pygame.display.set_mode(screen_dimensions)
    pygame.display.update()

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:
Using a dissolve shader as well as the Standard shader I'm applying a "burning" dissolve shader to an object which uses the Standard shader already. Because I need the Standard shader for better lighting, etc, I looked into how to use them "both" or how to extend the standard shader.

According to the Unity docs I can define which lighting mode I want to use in the pragma so I used Standard. That must not work the way I thought, because I see none of the lighting I do when using the standard shader directly.

I'm using the burning dissolve shader from Harry Alisavakis

Shader "Custom/BurnDissolve" {
    Properties {
        _Color ("Color", Color) = (1,1,1,1)
        _MainTex ("Albedo (RGB)", 2D) = "white" {}
        _SliceGuide("Slice Guide (RGB)", 2D) = "white" {}
        _SliceAmount("Slice Amount", Range(0.0, 1.0)) = 0

        _BurnSize("Burn Size", Range(0.0, 1.0)) = 0.15
        _BurnRamp("Burn Ramp (RGB)", 2D) = "white" {}
        _BurnColor("Burn Color", Color) = (1,1,1,1)

        _EmissionAmount("Emission amount", float) = 2.0
    }
    SubShader {
        Tags { "RenderType"="Opaque" }
        LOD 200
        Cull Off
        CGPROGRAM
        #pragma surface surf Standard

        fixed4 _Color;
        sampler2D _MainTex;
        sampler2D _SliceGuide;
        sampler2D _BumpMap;
        sampler2D _BurnRamp;
        fixed4 _BurnColor;
        float _BurnSize;
        float _SliceAmount;
        float _EmissionAmount;

        struct Input {
            float2 uv_MainTex;
        };

        void surf (Input IN, inout SurfaceOutputStandard o) {
            fixed4 c = tex2D (_MainTex, IN.uv_MainTex);
            half test = tex2D(_SliceGuide, IN.uv_MainTex).rgb - _SliceAmount;
            clip(test);

            if (test < _BurnSize && _SliceAmount > 0) {
                o.Emission = tex2D(_BurnRamp, float2(test * (1 / _BurnSize), 0)) * _BurnColor * _EmissionAmount;
            }

            o.Albedo = c.rgb;
            o.Alpha = c.a;
        }
        ENDCG
    }
    FallBack "Standard"
}

I also tried adding this as another subshader to a copy of the Standard shader source, but I wasn't able to get it working there. If I put it before the others, it works as if it was alone, if I put it after, the standard shader works like if it was alone.

I'm still new to shaders so I'm sure I'm misunderstanding this. How can I get the dissolve shader to apply as well the standard shader, without hopefully having to manually rewrite stuff.

sentences:
GameObject.Find() finds objects in the old scene I'm trying to create a simple scene transition. On entering a collider, there is a black canvas that's slowly faded in over the duration of 3 seconds. Then, a new scene is loaded, and the scene slowly fades from black to invisible. Now, I've almost finished it. However, I'm running into a small problem I cannot seem to fix.

The animation consists out of two text elements and one image. The hierarchy looks like this:

SceneLoader is an empty object, SceneFader is a canvas. Image is a black image stretched across the screen, and RegionName and RegionSubtext are two text elements that are filled as soon as the transition begins.

The code I'm using to load the scene is this:

private IEnumerator _loadSceneWithTransition(string sceneToLoad, Vector3 spawnCoordinates, string regionName, string regionSubtext) {
    this.screenFade.SetTrigger(SceneLoader.AnimatorTrigger);

    GameObject.Find("SceneLoader/SceneFader/Image/RegionName").GetComponent<Text>().text = regionName;
    GameObject.Find("SceneLoader/SceneFader/Image/RegionSubtext").GetComponent<Text>().text = regionSubtext;

    yield return new WaitForSeconds(4f);

    SceneManager.LoadScene(sceneToLoad);

    GameObject.Find("SceneLoader/SceneFader/Image/RegionName").GetComponent<Text>().text = regionName;
    GameObject.Find("SceneLoader/SceneFader/Image/RegionSubtext").GetComponent<Text>().text = regionSubtext;

    GameObject.Find("Player").GetComponent<PlayerMovementController>().spawnCharacterToLocation(spawnCoordinates);
}

Now, this doesn't work as I'd expect it to. The first part runs perfectly fine: The animation is started, the text is displayed and the scene changes. However, that's the part where everything breaks. As soon as the scene loads, there is no text. Also, the player position is not set to where it should be.

I really do not know why, the only reason I could think of was that the script was called in the first scene, and therefore, the GameObject.Find() calls return the elements in that scene, not in the currently used one (actually, I'm fairly sure of that because GetInstanceID() returns the same for both calls). Now, the problem at this part is that I do not know how to make that work properly. One idea I had was to do try and fetch a new instance of the script with something like: GameObject.Find("SceneLoader").GetComponent<BaseSceneLoader>() and work with that, but then I remembered I still need GameObject.Find() for this, which would probably yield the result of the old scene, so it's not helping at all. On top of that, I'm not even sure if that is the actual problem.

I'm kinda out of ideas here. I also do not know what's the best practice in that situation, and I couldn't find anything meaningful on DDG either.

Lastly, I've created a small video clip showing off the problem. I hope this helps in identifying the issue.

https://imgur.com/a/1eS8rcG

sentences:
On button click wait I have a button I got from google material design asset pack which has a ripple animation when pressed. I'm using the button's click option in the inspector that calls a method that switches scenes. But when I tap the button it switches the scene immediately and feels unnatural since the animation hasn't finished the button ripples animation.

I tried using co-routines. Made the button call a method in which I call a IEnumerator method (since the button can't directly call a co-routine) and then switch the scene. But that doesn't work since it starts the co-routine and switches the scene, the co-routine never pauses the code and never finishes (probably because I loaded a new scene and the object that carries the script isn't transferred).

Code example:

The method that gets called when I tap a button:

 public void OnButtonTap()
 {
     StartCoroutine(Wait(0.2f));
     SceneManager.LoadScene("OnePlayerGameIntro");
 }

The wait coroutine:

 public IEnumerator Wait(float seconds)
 {
     yield return new WaitForSeconds(seconds);
 }

sentences:
How do I use screen-space derivatives to antialias a parametric shape in a pixel shader? In Valve's Alpha Tested Magnification paper, it mentions using "per-pixel screen-space derivatives" for doing anti-aliasing. My understanding is that this is the ddx and ddy intrinsic functions in HLSL?

I'm trying to draw parametric shapes (for example a circle: x² + y² < 1) in a shader, and I don't know how to use this technique to correctly anti-alias the edge pixels of my shape. Can someone provide an example?

For completeness, here is an example of the kind of pixel shader I'm making:

float4 PixelShaderFunction(VertexShaderOutput input) : COLOR0
{
    float dist = input.TexCoord.x * input.TexCoord.x
               + input.TexCoord.y * input.TexCoord.y;
    if(dist < 1)
        return float4(0, 0, 0, 1);
    else
        return float4(1, 1, 1, 1);
}

sentences:
OpenGL rendering to multiple windows, having 1 main loop for each window I have written a little OpenGL framework in the past year that i would like to extend to support multiple windows in the near future. I have an idea about what I would like to do but I am not sure if that is possible so far.

I a nutshell the inner working of my framework is as following:

A window is created.
A render context for that window is created.
An application deriving from an interface is created.
window.run() is called, passing the application running in the window and the render context used as parameter.

sglr::W32Window w(nCmdShow);
w.create(L"DemoApp", sglr::DISPLAY_MODE::ENUM::WINDOWED, sglr::Resolution(800, 800));

sglr::W32Rendercontext r;
r.create(w, 4, 0, sglr::CONTEXT_TYPE::ENUM::DEBUG);

TestApp app;

return w.run(app, r);

The run method on the Win32 implementation looks like following (just some of the code):

        mRunningApp->onInit();

        // start message loop
        while (1)
        {

            while (PeekMessage(&msg, NULL, 0, 0, PM_REMOVE))
            {

                TranslateMessage(&msg);

                DispatchMessage(&msg);
            }

            // if message is WM_QUIT, exit loop
            if (msg.message == WM_QUIT)
                break;

            mRunningApp->onUpdate(mDt);

            mRenderContext->setAsCurrent();

            mRunningApp->onRender();

            mRenderContext->disableAsCurrent();

        }

    }

What I would like to do is to create a seperate window, rendercontext and application and start a seperate main loop by calling run() just like with the first window. I already have a seperate rendercontext for each window and know about setting it active before rendering to each window.
What possible solutions would exist to do that? Just running each run() method in a seperate threads sound like a kinda naive approach to me. (I admit I already tried it with failure :D)

sentences:
What is the integrator used in PhysX? What type of integrator is used in the PhysX engine? Euler? Runge-Kutta?

I tried to look through the comments in the SDK header and source files. But, could not find any information about this.

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:
Can I use two Collision Boxes on the same GameObject? I have two Collision Boxes on the same GameObject. I don't want the Collision Boxes to be triggers. I want the Collision Boxes on the actual GameObject, not its children.

For example, if I want to check for a headshot. My reason for not wanting triggers is that a trigger is already being used. My reason for not wanting children is for cleanliness. I understand there are work arounds. I was wondering if there was a more direct approach.

When there is a collision, how can I check which Collision Box is hit?

sentences:
Render rotated rectangle inside other rectangle bounds using Libgdx I have this code to generate a red rectangle inside a grey rectangle:

new Rectangle(grey_rectangle_position_x, Game.SCREEN_HEIGHT/2-Rectangle.height/2,0);

This code makes the following:

Now, I want to rotate the red rectangle and randomize his X coordinate but keeping it inside the grey rectangle.

This is my actual code of the rectangle:

public class Rectangle {

    public static int width=30;
    public static int height=60;
    public static Color color=Color.RED;

    public Rectangle(int x, int y, int angle) {
        super(x, y,angle);
    }

    public void render(ShapeRenderer shapeRenderer) {
        shapeRenderer.begin(ShapeType.Filled);
        shapeRenderer.setColor(color);
        shapeRenderer.identity();
        shapeRenderer.translate(pos_x+width/2, pos_y, 0.f);
        shapeRenderer.rotate(0.f, 0.f, 1.f, angle);
        shapeRenderer.rect(-width/2, -height/2, width, height);
        shapeRenderer.end();
    }
}

And this is what I should do to randomize the position of the rectangle:

new Rectangle(randomized_x_position, Game.SCREEN_HEIGHT/2-Rectangle.height/2,0);

The problem is that I don't know how to calculate the randomized_x_position in order to keep the rectangle inside the grey rectangle.

Another problem is that the current Rectangle.render() method is making my rectangle outside the grey rectangle after rotation:

When what I really want 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:
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: Different OnMouseDown functions based on where an object is clicked So my problem is I'd like to have one GameObject with multiple "OnMouseDown" functions. I have a target (classic looking bullseye) and I'd like to award a player say 10 points if they click on it, but 100 points if they click the center. Because the "OnMouse" functions don't pass in a collider I'm not sure how to go about doing this. I had an idea (which I think is a bad one) which would be to attach a small "empty" gameobject to my target prefab and give it a smaller hitbox with code that spits out 100 points instead of 10 and place that object "in front of" the other one while being attached. Again, seems wrong. Anybody else have to do this before or have a more elegant solution?? Thanks!

sentences:
How to make a Blend-Effect like yomawari did? I would like to know, how to make that effect, I have seen in the game named Yomawari. The little girl has a lamp and its cone revals the dark spirits around her. But only if they are in the light. I think it's like the additive blending, but I dont get it to work. I use monogame and c#.

Here is a sample: https://youtu.be/kPLRXP7ovB0?t=1241

All ideas are wellcome (sourcecode preferred ;))

Greetings
Kai

My current test code: (DL: https://github.com/EnemyArea/yomawari-lights)

    protected override void Draw(GameTime gameTime)
    {
        var blend = new BlendState
        {
            ColorBlendFunction = BlendFunction.Add,
            ColorSourceBlend = Blend.DestinationColor,
            ColorDestinationBlend = Blend.Zero
        };

        var lightBlendState = new BlendState
        {
            ColorSourceBlend = Blend.Zero,
            ColorDestinationBlend = Blend.SourceColor
        };

        var mousePosition = Mouse.GetState().Position;

        // Draw lights
        this.GraphicsDevice.SetRenderTarget(this.blackpixel);
        this.GraphicsDevice.Clear(Color.DarkGray);
        this.spriteBatch.Begin(SpriteSortMode.Deferred, BlendState.Additive);
        this.spriteBatch.Draw(this.lichtRund, new Vector2(mousePosition.X, mousePosition.Y), null, Color.White, 0f, new Vector2(this.lichtRund.Width * 0.5f, this.lichtRund.Height * 0.5f), 1f, SpriteEffects.None, 0);
        this.spriteBatch.End();
        this.GraphicsDevice.SetRenderTarget(null);

        // Draw hidden
        this.GraphicsDevice.SetRenderTarget(this.renderTarget);
        this.GraphicsDevice.Clear(Color.White);
        this.spriteBatch.Begin(SpriteSortMode.Deferred, blend);
        this.spriteBatch.Draw(this.testeye, new Vector2(this.GraphicsDevice.Viewport.Width / 2f, this.GraphicsDevice.Viewport.Height / 2f), null, Color.White, 0f, new Vector2(this.testeye.Width * 0.5f, this.testeye.Height * 0.5f), 1f, SpriteEffects.None, 0);
        this.spriteBatch.Draw(this.blackpixel, Vector2.Zero, Color.White);
        this.spriteBatch.End();
        this.GraphicsDevice.SetRenderTarget(null);

        // Combine all
        this.GraphicsDevice.Clear(Color.Black);

        this.spriteBatch.Begin(SpriteSortMode.Deferred, BlendState.AlphaBlend);
        this.spriteBatch.Draw(this.background, Vector2.Zero, Color.White);
        this.spriteBatch.End();

        this.spriteBatch.Begin(SpriteSortMode.Deferred, BlendState.AlphaBlend);
        this.spriteBatch.Draw(this.renderTarget, Vector2.Zero, Color.White);
        this.spriteBatch.End();

        this.spriteBatch.Begin(SpriteSortMode.Deferred, lightBlendState);
        this.spriteBatch.Draw(this.blackpixel, Vector2.Zero, Color.White);
        this.spriteBatch.End();

        base.Draw(gameTime);
    }

it results into that:  but is should look like

another sample

sentences:
How to compile custom module for iOS in Godot3.1 I'm trying to add Share module in my game for iOS platform. i have this repo for sharing module Godot-Share.

I'm using godot 3.1 and i download latest godot source code from Link.

To implement share module i follow this step to compile custom module.

Copy share folder to godot/modules folder.
Then i compile for iOS using this Link. I used following command to compile.

scons p=iphone tools=no target=debug arch=arm

scons p=iphone tools=no target=debug arch=arm64

In godot/bin i get as result two files :

  libgodot.iphone.debug.arm.a

  libgodot.iphone.debug.arm64.a

After i used following command to generate *.debug.fat.a file.

lipo -create bin/libgodot.iphone.debug.arm64.a bin/libgodot.iphone.debug.arm.a -output bin/libgodot.iphone.debug.fat.a

as result i get libgodot.iphone.debug.fat.a file in godot/bin folder.

i replaced libgodot.iphone.debug.fat.a file into godot/misc/dist/ios_xcode folder
i copied ios_xcode folder in documents, rename ios_xcode to iphone, then zip it. i get result file iphone.zip in Document folder.
Then i add iphone.zip file to Project>Export>Options>Custom Package>Debug

Then Export project.

Error I'm Facing :

Undefined symbols for architecture armv7:
"_z_verbose", referenced from:
_inflateInit2_ in FBLogin.a(ftgzip.iphone.debug.arm.o)
_inflate in FBLogin.a(ftgzip.iphone.debug.arm.o)
_inflateEnd in FBLogin.a(ftgzip.iphone.debug.arm.o)
_inflateReset in FBLogin.a(ftgzip.iphone.debug.arm.o)
_inflate_blocks_reset in FBLogin.a(ftgzip.iphone.debug.arm.o)
_inflate_codes_free in FBLogin.a(ftgzip.iphone.debug.arm.o)
_inflate_blocks_new in FBLogin.a(ftgzip.iphone.debug.arm.o)
...
"_z_error", referenced from:
_inflate_codes in FBLogin.a(ftgzip.iphone.debug.arm.o)
ld: symbol(s) not found for architecture armv7
clang: error: linker command failed with exit code 1 (use -v to see invocation)

So my question is : Am i compiling and linking custom module for iOS is right?

How do i solve above issue?

sentences: Screen Space vs World Space Canvas When should I use one over the other? I'm pretty sure I understand the key differences, but I'm not sure which use cases would prefer one over the other. For example, let's say I have objects on the ground in my 3D game and they have UI Images above them with the objects' names. Which method is better? Should I stick to world space for objects which are located in the 3D world and screen space for overlay type stuff?

sentences:
Are references between entities in Entitiy Component System allowed? I've got a player entiy in my game that can pick up weapons when colliding with item entities. The player can hold and use the weapon in their hand (the weapon sprite is rendered relative to the carrier).

I'm wondering how to design weapons and items in an ECS approach. Should the weapon be an entity the whole time so that the player entity has a weapon-component which holds a reference to the weapon-entity?

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: Unpack the pak file - Unreal Engine So I have the encryption key. This is stressed so much to have it. Well, I have it. Where do I use it? Unrealpak does not seems to offer an option to supply the encryption key, if your pak is encypted - the unpackaging simply fails.

sentences:
How can I reverse engineer an old MMO? I want to revive an old MMO.

Only the old client exists from the game, so I would have to write a whole server for it.

I'm not sure how to start editing things in the already made client. Most likely I will need catch requests and somehow change those to my own.

How do I go about actually working/editing that client? What should I use, having only .dlls on some other already compiled files?

sentences:
What is an appropriate level of granularity for component-based architecture? I'm working on a game with a component-based architecture. An Entity owns a set of Component instances, each of which has a set of Slot instances with which to store, send, and receive values. Factory functions such as Player produce entities with the required components and slot connections.

I'm trying to determine the best level of granularity for components. For example, right now Position, Velocity, and Acceleration are all separate components, connected in series. Velocity and Acceleration could easily be rewritten into a uniform Delta component, or Position, Velocity, and Acceleration could be combined alongside such components as Friction and Gravity into a monolithic Physics component.

Should a component have the smallest responsibility possible (at the cost of lots of interconnectivity) or should related components be combined into monolithic ones (at the cost of flexibility)? I'm leaning toward the former, but I could use a second opinion.

sentences:
I need to replace the sprite at runtime Unity 2d I need a help, I have some code in Unity that should replace the player's sprite at runtime. But this code does not make it correctly, it does't make the change. Could you help me? Thanks

using UnityEngine;
using System.Collections;

public class PlayerBehavior : MonoBehaviour {

  public enum Skins
  {
    normal,
    verde
  }

  private Skins skinAtual;

  private Rigidbody2D player;
  public float height;
  private Transform posicao;
  public float jumpForce = 10f;
  private AudioSource audio;
  public DeathMenu deathMenu;
  private float initialX;
  public float goBackSpeed = 10f;
  Object[] BGMusics;
  //private SpriteRenderer sprite;

  public SpriteRenderer[] sprites;

  public Sprite skinVerde, skinNormal;

  void Start () {

    //skinAtual = Skins.normal;
    skinAtual = Skins.verde;
    //sprite = GetComponent<SpriteRenderer> ();
    player = GetComponent<Rigidbody2D> ();
    BGMusics = Resources.LoadAll ("Music/BG");
    initialX = transform.position.x;

    //skinVerde = Resources.Load<Sprite> ("Sprites/BOYrECORTADOvERDE");
    skinVerde = Resources.Load<Sprite> ("Sprites/PersonagemFatiado_verde");
    skinNormal = Resources.Load<Sprite> ("Sprites/PersonagemFatiado");

  }

  private void UpdateSkin(Sprite novaSprite)
  {
    foreach (var item in sprites) {
      item.sprite = novaSprite;
    }
  }

  void Update ()
  {

    switch (skinAtual) {

    case Skins.normal:
      UpdateSkin (skinNormal);
      break;
    case Skins.verde:
      UpdateSkin (skinVerde);
      break;
    default:
      break;
    }

    if (Input.GetKeyDown (KeyCode.Escape))
      Pause.INSTANCE.Pausing ();

    if (Pause.isPaused)
      return;

    if (Application.isEditor)
      inputComputer ();
    else if(Application.isMobilePlatform)
      inputMobile ();

    FixePosition ();
  }

  void FixePosition()
  {
    if (transform.position.x <= initialX) return;

    var newPX = Mathf.Lerp (transform.position.x, initialX, Time.deltaTime * goBackSpeed);
    transform.position = new Vector3 (newPX, transform.position.y);

  }

  private void inputMobile(){
    if(Input.GetMouseButtonDown(0))
      playerJump ();
  }

  private void inputComputer(){

    if(Input.GetKeyDown(KeyCode.Space))
      playerJump ();
  }

  private void playerJump(){
    if (player.transform.position.y <= -8.93000f )
    {
      player.AddForce (new Vector2 (0, height * jumpForce), ForceMode2D.Impulse);
      MusicManager.INSTANCE.JumpSound ();
    }
  }

  void PlayRandom(){
    int i = Random.Range(0, BGMusics.Length); // index sortido
    AudioClip m = (AudioClip) BGMusics[i]; // uma referencia ao audioclip sortido
    GetComponent<AudioSource>().PlayOneShot(m); // tocamos esse audioclip
  }

  void Reset(){
    GetComponent<AudioSource>().playOnAwake = false; // aqui tira o play on awake do audio source
  }

  // CONFIGURANDO OS TRIGGERS E SUAS ACOES
  void OnTriggerEnter2D(Collider2D col)
  {
    if(col.gameObject.CompareTag("Heart"))
    {
      Score.INSTANCE.AddPoints ();
      col.gameObject.SetActive (false);
      Handheld.Vibrate ();
      //TOCAR
      PlayRandom ();

    }
    else
    {
      if (col.gameObject.tag == "Doctor")
      {
        MusicManager.INSTANCE.DeathSong ();
        player.gameObject.SetActive (false);
        Handheld.Vibrate ();
        ToggleEndMenu();
      }
    }

  }

  void ToggleEndMenu()
  {
    deathMenu.ToggleEndMenu (Score.INSTANCE.GetScore ()); //Send to DeathMenu the Score value
  }
}

sentences:
Name of this technique used in games such as Minecraft or the sims In Minecraft, there are some blocks which are a little bit different than just cubes.

For example stairs or fences: these elements are "aware" of their surrounding blocks and render differently based on if they are an edge, in the center, etc.

Other building games such as the Sims use a similar technique in the house building mode: the "voxels" are the same 1x1 metres but the mesh itself is usually thinner (like walls, side walls, etc.).

My question is:

What is the name of this technique?

Reference image

For the user perspective, there is only one "stairs" block. But when put next to each other, they behave differently.

sentences:
Resolving this kind of situation in my platformer (movement on slope with roof) I'm building a simple 2D character controller based on raycasts. At this moment I'm trying to finish the player-ground interaction. For the ground I will be using edge colliders and no tiling information.

I have most code working but there's something I don't really know how to fix. Here is an screenshot explaining the situation:

As you can see, Player (purple rectangle) is on a slope. When player wants to move right the new x and y coords are calculated to set the player feet again on the slope (Blue rectangle). But, after this response has been applied to the player to make it out of the slope, It is pushed through the roof and some part of it is sticking out the edge collider (red box).

How do you handle this situation?

On the other hand, If there's any way to accomplish this in a simpler fashion I'm all ears :).

Cheers.

sentences:
Collision between free player and tilebased map so I'm working on some sort of platformer in javascript where the map is tilebased but the player can move freely.

Now, i have a problem with collision detection/response. It's kind of obvious what I'm trying to do, I don't want the player to walk into walls and fall into the ground so i need collision stuff.

Basic info:

The player is the same size as the tiles
The tiles are 8x8
The map is stored in an array like this: [0, 0, 0, 1, 1, 1, 0, 0, 0]. So if the map was 3x3 there would be a horizontal line in the center.

I feel that the system that I'm using is very inefficient and there are some problems with it:

sides = {};

// The tiles are 8x8 wide so i divide the players position by 8 to get the current tile the players is occupying.
// The player.y * mapWidth + player.x thing gets the tile at that position in the map array
// I use Math.floor instead of round to get the tile to the left of the player
if (map[(Math.round(player.y / 8) * mapWidth) + Math.floor(player.x / 8)] == 1) {
    sides.left = true;
} else {
    sides.left = false;
}

if (sides.left) {
    // Set the players x position to exactly outside the wall.
    player.x = Math.floor((player.x / 8) - 1) * 8;
}

Now this works fine for walls but when you use it on the ground it works but it glitches on corners.

For example if the player half way over an edge it falls through the tile and is pushed to the side.

Is there a better way to do this and if not, how do i fix the ground collision?

sentences:
Using NDSLib, how to configure video modes to both print text and draw bitmaps on both screens? In a NDS application, i'd like print text and draw bitmaps on both top and bottom screens.
I have been able to setup code to either draw bitmaps or just print text to console.

If I try to enable both at the same time i only get garbage. My guess is there is a memory conflict between VRAM banks used by console background (for storing characters sprites) and background buffer used to draw pixels on screen.

My questions is : how should i configure video modes to be able to draw text and bitmaps on top and bottom screen ? If not possible, because there is not enough memory, a solution having only text on top screen is also acceptable.

Here is code :

#include <nds.h>
#include <stdio.h>

int main() {
    PrintConsole top, bottom;

    //1) bitmap init
    videoSetMode(MODE_5_2D);
    videoSetModeSub(MODE_5_2D);
    bgInit(3, BgType_Bmp16, BgSize_B16_256x256, 0, 0);
    bgInitSub(3, BgType_Bmp16, BgSize_B16_256x256, 0, 0);

    //2) console init, incompatible with 1)
    consoleInit(&top, 0, BgType_Text4bpp, BgSize_T_256x256, 0, 0, true, true);
    consoleInit(&bottom, 0, BgType_Text4bpp, BgSize_T_256x256, 0, 0, false, true);

    while (1) {
        swiWaitForVBlank();
        //draw pixels on screens
        for (int y = 0; y < 192; y++) {
            for (int x = 0; x < 256; x++) {
                BG_GFX[x + (y << 8)] = ARGB16(1, x + y, 32, y * x);
                BG_GFX_SUB[x + (y << 8)] = ARGB16(1, 32, y, y * x);
            }
        }
        //print text to console
        consoleSelect(&top);
        printf("top");
        consoleSelect(&bottom);
        printf("bottom");
    }
    return 0;
}

sentences: Web site for XAML snippet sharing? I am making a game with WPF and C#, and I frequently am in need of artwork for it.  Some things could be easily shared, such as explosion animations, exhaust plumes, etc.  I was wondering if there are any good web sites for this?  All I can find are tutorials and the infrequent sample, but I imagine there is a site out there that I am missing.  I would also like to clarify that I am looking for pure vector based XAML snippets.  I know there are a lot of sites out there for sprites and textures, but I am looking for XAML components that I can tweak.

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:
Implementing debug "overlay" info This question is actually about GameEngine2D which is part of PSM SDK (for PlayStation Vita development), however as stated in documentation it's loosely based on cocos2d library. I hope that my question is generic enough to be answered by other cocos2d users, so that's why cocos2d tag. Feel free to check my question on Sony forum.

Basically I'm trying to implement "debug layer" functionality, i.e. if I press, for example, "Triangle" button some debug information (like FPS) would apper "above" current Scene.

Currently I've implemented it this way:

I have a DebugNode : Node class, that performs necessary drawing,
it's instance is created on app init, and reference is stored in a
"global-like" Game class.
On Trianle press I check Director.Instance.CurrentScene.Children, and if does not contain DebugNode instance add it, or remove otherwide (so it's a toggle).

It's working fine, but it have issue I don't like, on a scene switch new scene does not have DebugNode, and also I need to remove DebugNode from CurrentScene before scene change, because Node can't have multiple parents. The solution to this could be by having multiple DebugNode instances, but that is also solution I don't like.

I have 2 questions regarding this:
1. Is my approach to a task is generraly reasonable? Is it done if not the best way, but at least reasonable way?
2. How my approach could be improved, particularly in case of Scene switching?

sentences: How can I develop a Lights Out solving algorithm? I am programming the game that named Lights Out. The purpose of this game is turning all the lights out. There's a flash version of the game here. I want to develop a way of solving the game. How can I do this?

sentences:
How can I reduce the size of bundled Unity DLLs on Android? I have created a simple project (I am a Unity beginner) for Android but the apk size is around 18 MB!

I checked the documentation. One way to decrease the apk size is to check the editor log. Then I discovered that imported DLLs have a size of 3.9MB.

I only used UnityEngine and Collision packages. So how can I avoid to import the other big DLLs?

sentences:
Inelastic ball collision I'm trying to implement basic inelastic ball collision.

The example on the link above is for one dimension. It explains that it's the same for 2D but where the velocities are the components in the direction of the normal in the point of collision. I have tried calculating these components by projecting on the normal vector, and then calculating the new velocities. But then I got stuck. How do I get the new velocity vectors? My attempt below does not produce any good result. Can you help me out? (The two balls are intersecting in one common point when I run the code below)

UPDATE: I have edited the code now so that the two last lines is more correct I think. The thing is I have to combine the new velocity vector component with the old velocity vector component that was first subtracted in the projection operation, to get the complete new velocity vector. Now the animation looks a lot better. I still get occasional ball merging and popping but that could be some other part of my code thats wrong.

var m = this.Mass + other.Mass;
// normal in the point of collision
var n = (this.Position - other.Position).Normalized;
// velocity component perpendicular to the tangent in the point of collision for ball A
var ua = (float)(this.Velocity.Magnitude * Math.Cos(this.Velocity.Angle(n)));
// velocity component perpendicular to the tangent in the point of collision for ball B
var ub = (float)(other.Velocity.Magnitude * Math.Cos(other.Velocity.Angle(n)));
// the new velocity for ball A
var va = (0.9f * other.Mass * (ub - ua) + this.Mass * ua + other.Mass * ub) / m;
// the new velocity for ball B
var vb = (0.9f * this.Mass * (ua - ub) + this.Mass * ua + other.Mass * ub) / m;

// the new velocity vector for ball A
this.Velocity -= n * (ua - va);

// the new velocity vector for ball B
other.Velocity -= n * (ub - vb);

sentences:
Unity strange clones behavior I am setting up a grid of tiles (2d sprites) in Unity with this code:

public class Grid : MonoBehaviour {

public GameObject slot;
public int gridW = 9;
public int gridH = 9;

private GameObject [,] grid = new GameObject[9, 9];

void Awake(){

    for(int y=0; y<gridW; y++)
    {
        for(int x=0; x<gridH; x++)
        {
            GameObject gridSlot = (GameObject)Instantiate(slot, new Vector3(x, y, 0), Quaternion.identity);
            gridSlot.transform.parent = transform;
            grid[x,y]=gridSlot;
        }
    }

}

I then would like to have printed on the console the x,y coordinates of an individual tile when clicked on it. This is the script attached to the tile prefab:

public class Tile : MonoBehaviour {

void Start () {

}

void Update () {

    if(Input.GetMouseButtonDown(0))
        Debug.Log(transform.position.x + " " + transform.position.y);
}

Yet when I click on a tile I get printed the coordinates for ALL of the tiles on the grid. Why is this happening? Is there something very basic I am missing...?

Thanks!

sentences:
How do I draw a 2d plane and rotate camara (To be a board) in a 3d XNA game? I am trying to create a simple board game, but the 3d part of this is really killing me.

From what I can gather I have created a plane, but it never moves even though I turn the camara, but that partially makes sense as I only turn the camara with a 3d model, but in my head that makes 0 sense, in my head if I turn the camara it should affect ALL my models? But with this code the camara only "cares" about the 3d cylinder, the plane is just completely still

private void OnDraw(object sender, GameTimerEventArgs e)
    {
        SharedGraphicsDeviceManager.Current.GraphicsDevice.Clear(Color.CornflowerBlue);

        foreach (ModelMesh mesh in cylinderModel.Meshes)
        {
            foreach (BasicEffect effect in mesh.Effects)
            {
                //effect.World = Matrix.CreateRotationX((float)e.TotalTime.TotalSeconds * 2);
                effect.View = Matrix.CreateLookAt(cameraPosition, Vector3.Zero, Vector3.Up);
                effect.Projection = Matrix.CreatePerspectiveFieldOfView(MathHelper.ToRadians(45.0f), aspectRatio, 1.0f, 10000.0f);

                effect.EnableDefaultLighting();
            }

            mesh.Draw();
        }

        //cameraPosition.Z -= 5.0f;
        _effect.World = Matrix.CreateRotationZ((MathHelper.ToRadians(((float)e.TotalTime.Milliseconds / 2) % 360)));
        foreach (EffectPass pass in _effect.CurrentTechnique.Passes)
        {
            pass.Apply();

            SharedGraphicsDeviceManager.Current.GraphicsDevice.DrawUserPrimitives(PrimitiveType.TriangleStrip, _vertices, 0, 1, VertexPositionColor.VertexDeclaration);
        }
    }

Is there a way to get the camara to affect all models?

sentences:
References are missing after migrating Unreal assets I'm currently trying to migrate some VFX assets (meshes, materials, textures, material instances, niagara emitters and niagara systems) to another project on another machine.
My folder structure looks like this: C:\Users\Documents\MyName\UnrealProjects\MyProject\Content\ThirdPersonBP\MyVFX
My current workflow is like this:

In Unreal I right click on "MyVFX" and choose to migrate it and then choose a destination folder (not another project).
Zip the migrated folder and put it on another machine.
Unzip "MyVFX" from the zip to C:\Users\Documents\OtherName\UnrealProjects\OtherProject\Content\ThirdPersonBP
Put the niagara system into the level

The problem that now occurs is that references are not set. For example, the Sample Texture node in a material does not contain a set texture or a niagara system does not have anything set in the Mesh Renderer module (neither mesh nor material).
Everything works again as intended once the references are set again manually. But, that's tedious work of course and I don't want my teammates to do that for every effect I create.

sentences:
Can't get world position from reverse Z buffer I'm using this solution to render using a reversed Z buffer.

This looks fine and completely fixes all my z-fighting, but it breaks what I use in shader to derive the world position from the depth for various purposes such as deferred lighting and fog (it has worked for a regular projection matrix):

vec4 screenSpacePosition = vec4(texcoord * 2.0 - 1.0, depth * 2.0 - 1.0, 1);
vec4 worldSpacePosition = invProjView  * screenSpacePosition;
vec3 finalPosition = worldSpacePosition.xyz / worldSpacePosition.w;
return finalPosition;

I've thought that this was due to this using a single view projection matrix, so I've also tried this:

vec4 clipSpacePosition = vec4(texcoord * 2.0 - 1.0, depth * 2.0 - 1.0, 1.0);
vec4 viewSpacePosition = invProj * clipSpacePosition;
viewSpacePosition /= viewSpacePosition.w;
vec4 worldSpacePosition = invView * viewSpacePosition;
return worldSpacePosition.xyz;

That must be suboptimal performance wise, but it doesn't work either anyway. Any idea what I'm missing?

sentences:
Multi-layered tilemap I need to be able to efficiently render a tilemap which can be constructed this way:

There is one non-transparent base layer

Then there can be 3 partially-transparent layers on top of it. Each tile consist of tile texture + alpha texture.

I do not know much about rendering tile maps but I do have some knowledge of using shaders in Unity. I know something about control texture technique and about texture atlases.

I have about just 50 textures so I could easily put them all in one texture atlas 2048x2048 which most devices (even mobile) support today.

Also I have one animated texture (sea), so chosen approach should consider that.

What I don't know is how I should generate my mesh (two triangels per tile?) and which data exactly I should pass to my shader and how to do rendering there. Everything considering that there is 4 textures + 3 alpha textures per tile and they should be strictly ordered when rendered.

sentences:
How can I make a car follow the terrain in a 2D (side-view) game? I'd like to create a game where a car drives over a 2D terrain.
Which algorithm to use so the car will follow the mountain incline?

sentences:
Transparent parts of texture are opaque black instead I render a sprite twice, one on top of the other.  The sprites have transparent parts, so I should be able to see the bottom sprite under the top sprite.  The transparent parts are black (the clear colour) and opaque instead though and the topmost sprite blocks the bottom sprite.

My fragment shader is trivial:

uniform sampler2D texture;
varying vec2 f_texcoord;
void main()
{
    gl_FragColor = texture2D(texture, f_texcoord);
}

I have glEnable(GL_BLEND) and glBlendFunc(GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA) in my initialization code.  My texture comes from a PNG file that I load with libpng.  I'm sure to use GL_RGBA when initializing the texture with glTexImage2D (otherwise the sprites look like noise).

Edit: Here's a screenshot.

sentences: Images disappear when camera zooms in there is no problem when the camera is away, but as I zoom in to the game, the images disappear and I can't see the game properly. What is the reason ?

sentences:
How to access files in Chrome So, I am making a game-like html file that needs to load a few assets. I have a loading animation which uses the timing of the loading files to create a progress bar. This all goes fine. The files all load, and the app launches. However, none of the files can access each other as they are all in different script tags. And I cannot merge them because the JS is never actually put into the html. So what I need to do is to access the local file system (it uses the file:// prototype) and read the file, then stick the text into a script tag. However, all of the examples I have found on the web throw this error:

  Xhtmlrequests can only access (list of protocols not including file)

What I need is a JS way to access the files with no input from the user (other than opening the application). How can this be done?

sentences:
Cant center screen between black bars As I was trying to adapt my game to different device resolutions I ran into a problem when adjusting the game screen between the "black bars." In my case I am using the FitViewport class from the LibGdx library to add the black bars for me. Everything works fine and the black bars (one bar in my case) are being effectively created when necessary. My problem, however, is that my screen is not centered and I end up with one ugly black bar either to the top, bottom, right, or left of my game. For example:

How can I fix this so it looks like this:

Here is my code:

public class NordicMadness extends Game implements ApplicationListener{
    private Camera camera;
    public static FitViewport viewport;

    @Override
    public void create () {
        camera = new PerspectiveCamera();
        viewport = new FitViewport(Gdx.graphics.getWidth(), Gdx.graphics.getHeight(), camera);
        AssetLoader.loadAssets();
        setScreen(new SplashScreen(this));
        System.out.println(Gdx.graphics.getWidth() + ", " + Gdx.graphics.getHeight());
    }

    @Override
    public void dispose(){
        super.dispose();
        AssetLoader.dispose();
    }

    @Override
    public void resize(int width, int height) {
        // All resizing shall be done in main Game class
        viewport.update(Gdx.graphics.getWidth(), Gdx.graphics.getWidth(), true);
    }
}

The libgdx API states that adding true to the third argument of viewport.update(width, height, boolean center) should do the job but it's not working in my case.

After this I tried doing the following but with no success:

public void resize(int width, int height) {
        // All resizing shall be done in main Game class
        ScalingViewport scalingViewport = (ScalingViewport)viewport;
        float leftGutterWidth = scalingViewport.getTopGutterHeight();
        viewport.update(Gdx.graphics.getWidth(), Gdx.graphics.getWidth()); // Resize screen
        camera.position.set(0, Gdx.graphics.getHeight() - (leftGutterWidth / 2), 0);
    }

sentences:
How to change/modify or animate an existing OpenGL object on Android? I maybe know understand it all a little bit better so i thoug i make a new shorter question to eventually get an answer.

Get back or delete an existing OpenGL object, then change it and draw at new. How?

So if and Admin reads this post, he can feel free to delete it.

I'm working on OpenGL since a Week, so i'm new to the most stuff.
(also my englisch isn't the best. Hop you can understand the most anyway)

So i'm working on an Tamagotchi App for a school project and want to make it with OpenGL.
I allready came this far:

But now i want to animate things.
My mind told me that it shoud be possible to change or modify an existing OpenGL object.
In my situation there are 3 opjekts:

Body
Eyes
Mouth

For example her is my code from the mouth:

public class GLMouth {

private int points = 1000;
private float vertices[]={0.0f,0.0f,0.0f};
private FloatBuffer vertBuff;
private FloatBuffer vertBuff2;

public GLMouth(){

    vertices = new float[points * 2];
    for(int i=0; i<= (points+3); i+=3)
    {
      double rad = (Math.PI *i) / points;

      vertices[i]=(float)Math.cos(rad);
      vertices[i+1]=(float)Math.sin(rad);
      vertices[i+2]=0;
    }

    ByteBuffer bBuff=ByteBuffer.allocateDirect(vertices.length*4);
    bBuff.order(ByteOrder.nativeOrder());
    vertBuff=bBuff.asFloatBuffer();
    vertBuff.put(vertices);
    vertBuff.position(0);

    vertices = new float[points * 2];
    for(int i=0; i< (points+3); i+=3)
    {
      double rad = -(Math.PI *i) / points;

      vertices[i]=(float)Math.cos(rad);
      vertices[i+1]=(float)Math.sin(rad);
      vertices[i+2]=0;
    }

    bBuff=ByteBuffer.allocateDirect(vertices.length*4);
    bBuff.order(ByteOrder.nativeOrder());
    vertBuff2=bBuff.asFloatBuffer();
    vertBuff2.put(vertices);
    vertBuff2.position(0);

}

public void draw(GL10 gl){

    gl.glPushMatrix();
    gl.glTranslatef(0.0f, -1.0f, 0.0f);
    gl.glScalef(1.8f, 0.15f, 1.0f);
    gl.glColor4f(0.0f,0.0f,0.0f, 1.0f);
    gl.glVertexPointer(3, GL10.GL_FLOAT, 0, vertBuff);
    gl.glEnableClientState(GL10.GL_VERTEX_ARRAY);
    gl.glDrawArrays(GL10.GL_TRIANGLE_FAN, 0, points/2);
    gl.glDisableClientState(GL10.GL_VERTEX_ARRAY);
    gl.glPopMatrix();

    gl.glPushMatrix();
    gl.glTranslatef(0.0f, -1.0f, 0.0f);
    gl.glScalef(1.8f, 1.0f, 1.0f);
    gl.glColor4f(0.0f,0.0f,0.0f, 1.0f);
    gl.glVertexPointer(3, GL10.GL_FLOAT, 0, vertBuff2);
    gl.glEnableClientState(GL10.GL_VERTEX_ARRAY);
    gl.glDrawArrays(GL10.GL_TRIANGLE_FAN, 0, points/2);
    gl.glDisableClientState(GL10.GL_VERTEX_ARRAY);
    gl.glPopMatrix();

}

}

In my renderer i just creat a mouth object and then draw it with mouth.draw.

So i thought i have allready drawn the mouth and now i can cange for example the gl.glScalef(1.8f, 0.15f, 1.0f); from that existing mouth to zero with some time in between to let it look like the mouth is closing.

But how can i do that?
I don't find anything with google, mostly because i don't know what i have to look up.
If i understand OpenGL right, than it will just draw new mouths over the original.

edit
Or it is a question about where is the opjekt? Can i save it an take it back (delete it etc) and draw it new with other properties.

sentences:
Project transfer, will re-importing all my models damage my project at all? Recently I had to transfer my Unity game project to another computer and downloaded the same version of Unity I was using for my 3D project and checked that all the files and folders were in the same place and everything.

When I start up the game though my models have vanished and in the hierarchy it just says missing prefab instead of telling me what it was, like it used to if I'd move a model to another folder or something like that.

It shows all my files there and I was about to reimport them all but I got a warning that said:

"Rebuilding assets is only if your project has been corrupted due to an internal Unity bug. It can take several hours to complete, depending on the size of your project.

Please submit a bug report detailing the steps leading up to here."

I am sure that re-importing all my models will fix this but I want to ask if this will have any negative effects on my project or possibly damage anything?

This game is extremely important to me and I've been working on it for the past 3 years(being self taught which is why it's taken so long and I'm still learning)

Thank you guys in advanced! :D

sentences:
What does it mean to "strafe" the camera? I'm looking at a tutorial in which both the terms camera moving and "strafing" are used. I looked onto dictionary.com and found:

  strafe
  verb (used with object)
  1. to attack (ground troops or installations) by airplanes with
  machine-gun fire.
  2. Slang . to reprimand viciously. –noun
  3. a strafing attack.

WTF???

I'm not a native english speaker.

sentences:
What kind of design or structure should I use to implement movement between an over-world map and a menu system? I'm making a simple text-based RPG, where the player is the owner of five creatures that battle other teams for loot, experience and glory. I am using Python, and a curses emulator. I have a static ASCII over-world map. My character, represented by a glyph, can move about this static map. There are locations all over the map that the character can visit, that break down into two categories:

Towns, which are a series of menus that will allow the player to buy equipment for his team, hire new recruits or do other things.
Arenas, where the player's team will have a "battle" interface with actions he can perform, messages about the fight, etc. Later, I may include an ASCII representation of the fight; but for now, just screens of information, with action prompts, will be displayed.

What kind of design or structure should I use to implement movement between an over-world map and a menu system?

Right now, the game goes through a master loop that waits for keyboard input, and then moves the player about the screen. Upon keyboard input, the player  coordinates are checked against a list of location objects, and if the player coordinates match a locations coordinates, then... I am not sure.

I'm not sure if I should call a separate function, to initiate either a menu or combat mode, or if I should create some kind of new GameMode object that contains a method for drawing the screen and printing the necessary info. If I go that way, I am not sure how to pass my players team data into this object.

My main concern is passing around the program flow into all of these objects. Should I be calling straight functions for different parts of my game, and objects to represent "things" within my game? I was reading about the MVC pattern, and how this kind of problem might benefit from decoupling the GUI from the game logic and user input, but I have no idea how this applies to my game.

sentences:
I followed a youtube timelapse video to make same 3d model in blender, Can I use this in my game? I saw a youtube timelapse video about making a car 3d model, I liked it and followed the same, I design almost same looking model (90% same), Can I use this in my game?

There is no license mentioned on video, the creator of video has just written 'Just for fun' in description of youtube video.

Update:
As per my understanding if we download or copy/paste a copyrights protected asset, we will need permission of its author, but I am neither downloading nor copy pasting anything, I am simply just seeing a video and making something similar asset, so do I really need a permission of the video creator and however he hasn't mentioned any license term also in the video.

sentences: When does depth testing happen? I'm working with 2D sprites - and I want to do 3D style depth testing with them. When writing a pixel shader for them, I get access to the semantic DEPTH0. Would writing to this value help? It seems it doesn't. Maybe it's done before the pixel shader step? Or is depth testing only done when drawing 3D things (I'm using SpriteBatch)? Any links/articles/topics to read/search for would be appreciated.

sentences:
Having issue having AI move after changing directions I've frankenstein'd together an AI script for the enemy to chase the player once the player enters the AI's collider. If the player's X is lower than the enemy's X aka he's on his left the enemy turns and should start chasing the player again. My debug log fires saying the enemy should be chasing left and the enemy turns, but he does not chase the player.

Can someone take a look and see if the solution to the issue I'm having is apparent? I'm assuimg it has something to do with my leftward movement but im not experienced enough to know what it is, when I enter the values in different ways I can get the enemy to move left however so I'm not sure what exactly is wrong.

using UnityEngine;
using System.Collections;

public class EnemyMovement : MonoBehaviour
{

    public float movementspeed;
    public Transform player;
    Renderer enemyRenderer;
    bool engage = false;
    public GameObject enemySprite;
    public bool spriteFacingRight = true;
    Rigidbody2D rigid;

    //Animator enemyAnimator;

    void Start()
    {
        enemyRenderer = GetComponent<Renderer>();
        rigid = GetComponent<Rigidbody2D>();
        //enemyAnimator = GetComponent<Animator>();
    }

    void FixedUpdate()
    {
        if (engage == true)
        {

            if (spriteFacingRight && rigid.transform.position.x < player.position.x)
            {

                chargePlayer();

            }

            if (spriteFacingRight && rigid.transform.position.x > player.position.x)
            {

                turnFacing();
                chargePlayer();

            }
        }
    }

    void OnTriggerEnter2D(Collider2D col)
    {
        if (col.tag == "Player")
        {
            engage = true;
            Debug.Log("player engaged");
        }
    }

    void turnFacing()
    {
        float facingX = enemySprite.transform.localScale.x;
        facingX *= -1f;
        enemySprite.transform.localScale = new Vector3(facingX, enemySprite.transform.localScale.y, enemySprite.transform.localScale.z);
        spriteFacingRight = !spriteFacingRight;
        Debug.Log("facing player");
    }

    void chargePlayer()
    {
        if (!spriteFacingRight)
        {
            rigid.AddForce(new Vector2(-1, 0) * movementspeed);
            Debug.Log("chasing left");
        }

        if (spriteFacingRight)
        {
            rigid.AddForce(new Vector2(1, 0) * movementspeed);
            Debug.Log("chasing right");
        }
        //enemyAnimator.SetBool("isCharging", charging);
        Debug.Log("charging player");
    }
}

sentences:
2D active ragdoll/physics-based procedural animation I'm trying to make a 2D quadraped robot stand and walk via physics.

My robot looks like this. (art is not mine. Source is vapgames)

It's rigged via Unity's 2D animation package and each joint/bone has it's own collider + rigidbody with the legs also having hingejoints connecting the lower part to the upper part and the upper part to the main body of the robot. I've also set up IK for both legs using the 2D IK package with the IK target being attached to their respective leg via fixedjoint and can be moved programmatically to move the legs with respect to IK.

I want it to stand up, as at the moment is just falls and acts as a generic limp ragdoll. I've tried these methods:

Adding downward force to the legs via the IK targets
Adding upward force to the torso
Animating the IK targets to try and get the bot to stand up with animatePhysics enabled.

All of these failed (downard force to legs did pretty much nothing, upward force to torso just made it float if there was no ground, animating the IK targets was too glitchy).

I'm out of ideas on how to actually do this now. I've looked around for guides but there seems to be nothing good (I keep getting this suggested to me but it doesn't help. It's in 3D and the only thing that could help, spider legs, isn't finished and probably never will be)

There's very little information on how to do this sort of stuff and even when I find people who know about active ragdolls they just say add force to the head (for a 3D active ragdoll), which I've already tried (see 2. on the list of what I've already tried) and don't explain anyt further.

If anyone could help, that'd be great!

sentences:
Calling an android method from Unity3D with a JAR plugin I am developing a game with Unity only for Android platform and I am requiring to share content of my game through an intent so I have implemented a JAR plugin according to several tutorials with this code:

package a.b.c;

import android.content.Intent;
import android.os.Bundle;

import com.unity3d.player.UnityPlayerActivity;

public class UnityBridge extends UnityPlayerActivity {

    @Override
    protected void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
    }

    public void callShareIntent() {
        Intent shareIntent = new Intent (Intent.ACTION_VIEW);
        startActivity(shareIntent);
    }
}

The JAR is located at Assets/Plugins/Android with an AndroidManifest file which override the file created by unity, this is its code:

<?xml version="1.0" encoding="utf-8"?>
<manifest android:theme="@*android:style/Theme.NoTitleBar" android:versionCode="1" android:versionName="1.0" android:installLocation="auto" package="a.b.c"
  xmlns:android="http://schemas.android.com/apk/res/android">
    <supports-screens android:anyDensity="true" android:smallScreens="true" android:normalScreens="true" android:largeScreens="true" android:xlargeScreens="true" />
    <application android:label="@string/app_name" android:icon="@drawable/app_icon" android:debuggable="false">
        <activity android:label="@string/app_name" android:name="com.unity3d.player.UnityPlayerNativeActivity" android:launchMode="singleTask" android:screenOrientation="portrait" android:configChanges="mcc|mnc|locale|touchscreen|keyboard|keyboardHidden|navigation|orientation|screenLayout|uiMode|fontScale">
            <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" />
            <meta-data android:name="unityplayer.ForwardNativeEventsToDalvik" android:value="false" />
        </activity>
        <activity android:name=".UnityBridge"></activity>
    </application>
    <uses-feature android:glEsVersion="0x20000" />
</manifest>

I just copied the manifest created by Unity and added this line:

<activity android:name=".UnityBridge"></activity>

... as you can see.

In the other hand, I have created a C# file in order to launch the share method of the plugin, this is its code:

using UnityEngine;
using System.Collections;

public class BotonCompartir : MonoBehaviour {

    AndroidJavaClass androidClass;

    // Use this for initialization
    void Start () {
        if (Application.platform == RuntimePlatform.Android) {
            AndroidJNI.AttachCurrentThread ();
            androidClass = new AndroidJavaClass ("a.b.c.UnityBridge");
        }
    }

    // Update is called once per frame
    void Update () {
        if (Input.GetMouseButtonDown (0) && Application.platform == RuntimePlatform.Android) {
            androidClass.Call("callShareIntent");
        }
    }
}

... and I have attached it to a gameobject.

When I deploy the apk to an android device nothing happens, so What am I doing wrong? Any other suggestion?

Thank you very much

sentences:
How to create a 3D world with 2D sprites similar to Ragnorak online? As far as I know Ragnorak Online is a 3D game world with 2D sprites overlayed. I would like to use this style in a game I am making in Unity, so I would like the player to be able to select little square tiles on the terrain.

There are a couple routes I could take such as using a bunch of cubic polygons and linking them together or using one big map. The former approach doesn't seem to make any sense if the world is not flat as polygons wouldn't be reused often. The goal is to break down a 3D polygon into tiles which is hard to wrap my head around.

I believe using something like an interval tree or array would be appropriate to store the rectangle grid, but how would I display a rectangle around the selection the player has his mouse over on the polygon terrain itself?

Here is a screenshot.
Here is a gameplay video.
Here is the camera usage.

sentences:
What kind of skills are required to work in a content pipeline department in a high level role I'm looking more for high level role such as producer/manager of the group making the tools for a content pipeline. This would be for a large AAA studio.

Also what kinds of tools are they creating?

sentences:
Jump height being affected by the duration of how long jump button is pressed So I've been trying to implement a controlled jump the way the title proclaims to make the game easier to play and having the ability to make harder challenges in each level. I have noticed how there are already posts regarding this subject so I have read each individual post trying to implement it by myself. I do think I managed to come up with something good but it is not working properly (this script is placed inside the Players Update method):

timer += (float)gameTime.ElapsedGameTime.TotalSeconds;

        if ((InputManager.pad.IsButtonDown(Buttons.A) && InputManager.lastPad.IsButtonUp(Buttons.A) ||
            InputManager.keys.IsKeyDown(Keys.Up) && InputManager.lastKeys.IsKeyUp(Keys.Up)) ||
            (jumpTime < 0 && !isGrounded && !isJumping))
        {
            if (jumpTime < 0)
            {
                speed.Y = -jumpTime * speed.Y;
                jumpTime += timer;
            }

            else if (isGrounded)
            {
                speed.Y = -8.5f;
                jumpTime = 7.0f;
                speed.Y = jumpTime * speed.Y;
                isGrounded = false;
            }
            else if (!isJumping)
            {
                speed.Y = -8.5f;
                jumpTime = -6.0f;
                speed.Y = -jumpTime * speed.Y;
                isJumping = true;
            }

            else if (jumpTime > 0)
            {
                speed.Y = jumpTime * speed.Y;
                jumpTime -= timer;
            }
        }
        else
        {
            jumpTime = 0;
        }

Basically, the problem with it is the player jumps infinitely and never stops once the button is pressed. I would take a guess that the if-statement has some errors, but I could be wrong. Could I get some advice of what I've done wrong here exactly?

I want to mention too that it's going to be a double jump mechanic, where the double jump is also affected by the duration of how long the jump key is pressed.

sentences:
How do 2D volumetric lights work? Context

So in my current project (written in Java using LWJGL / OpenGL, so GLSL for shaders) I added lighting quite a few months ago, which was already an interesting challenge, having never done something like that before. Now I did my research, and in the past few days I found absolutely nothing particularly helpful about this subject (which was really surprising, I thought this to be a much more common problem), which is why I am asking here. Anyway, after a lot of searching around and asking for help, this is what the current lighting system looks like:

Desired effect

The current lighting is somewhat neat but not good enough, as I would like it to have an additional parameter for something like light width (currently there are already color, intensity, angle, smoothness and linear + quadratic attenuation parameters).

What I would like to achieve is an effect along the lines of this (paint.net mockup, but should make it clearer):

It sounds like such a simple thing to do and yet I can't get my head around how to do it (I thought about somehow having two different light positions and tracing lines between that or rotating the current fragment point in the fragment shader, but both seem incredibly slow and I don't even know where to start with them).

Edit

Here as requested the part of the fragment shader that's responsible for lighting:

for (int i = 0; i < numLights && i < MAX_LIGHTS; i++)
{
    if (lightColor[i].a > 0.0 && myDepth >= minAffectedDepth[i] && myDepth <= maxAffectedDepth[i])
    {
        if (isSpotLight[i])
        {
            lightDistance = lightPosition[i] - myPos;
            distance = length(lightDistance);
            spotEffect = dot(normalize(spotDirection[i]), normalize(-lightDistance));

            if (spotEffect > spotCosCutOff[i])
            {
                spotEffect -= spotCosCutOff[i];
                spotEffect /= (1.0 - spotCosCutOff[i]);

                spotEffect = pow(spotEffect, spotExponent[i]);
                attenuation = spotEffect / (1.0 + linearAttenuation[i] * distance + quadraticAttenuation[i] * distance * distance);

                color += attenuation * lightColor[i] * ownColor * lightColor[i].a;
            }
        }
        else
        {
            color += ownColor * lightColor[i] * lightColor[i].a;
        }
    }
}

TLDR;
I want to add "volumetric" lighting to my 2D project with GLSL, so a width parameter to the lighting system, which currently consists of punctual light sources (and for some reason, light sources in real life usually aren't perfectly punctual ;)).

sentences: Determine where is player facing up, down or left right I have a player object who can rotate(face using mouse) up, down left right and can face straight. I am willing to know that how to determine that where is camera facing? Either it is looking up or down?? while the player is continuously moving in a up/down surface.

sentences:
Should I use one thread per game object? I developing a simple real-time strategy game in a small team with no experience, and we're considering using one thread per game object (tank, soldier, etc). Is this a good idea or is it overkill?

The thread would call each object on each instant change (game timer, not graphic engine timer)

We're using Python with the Panda3D engine, meaning the GIL is probably going to reduce a lot the possible speed improvements.

sentences:
Unity - How to calculate max distance (range) of a Projectile taking drag into account? I am able to calculate the projectile max distance, but it only works when there is no drag applied on the spherical projectile. I used the formula for range of a projectile as follows:-

void OnCollisionExit(Collision other)
{
    if(other.gameObject.name == "bat")
    {
        initVel = ballRigidbody.velocity.magnitude;
        lineObject.transform.LookAt(transform);
        angle = Mathf.Abs(lineObject.transform.eulerAngles.x - 360);
        radianAngle = Mathf.Abs(Mathf.Deg2Rad * angle);
        maxDistance = (initVel * initVel * Mathf.Sin (2 * radianAngle))/ g;
    }
}

This works well if there is no drag. But as I add drag, the range ends up being far away from where the projectile actually lands.

I looked up https://en.wikipedia.org/wiki/Projectile_motion#Trajectory_of_a_projectile_with_air_resistance

but can't quite understand how to use it.

Here's a solution I tried

if(ballHeight > maxHeight)
{
    maxHeight = ballHeight;
}
else
{
    if(!flag)
    {
        maxHalfDistance = Vector3.Distance(ballFollow.transform.position, centerPoint.position);
        maxDistance = maxHalfDistance * Mathf.Clamp(maxHalfDistance, 1f, 1.75f);
        flag = true;
    }
}

Basically calculating horizontal distance at max height and multiplying it a value between 1 and 1.75. ballFollow is horizontal position of ball and centerPoint is the launch position.
This works perfectly but there is a problem that actual range isn't calculated until the ball reaches its maxHeight.

So, how can range of a projectile be calculated taking air resistance in account?

sentences:
Movement velocity relative to a static object (Vector Maths) I have a static object. I have a moving player.

If the player is moving directly towards the object then I want to return the value of 1.
If the player is moving directly away from the the object then I want to return the value of 0.
If the player is moving somewhat between these two directions then I want to return a value proportionally relevant to the two previously mentioned values - between 0 and 1 depending on the direction.
The direction that the player is facing is irrelevant, it's the velocity of the player that's important for my situation.

How do I calculate this value?

This is so frustrating, as I know that I've solved this exact problem in the past but I'm currently drawing a blank. It involves some trig and some dot product, but for now I'm clueless and would appreciate any help that's offered.

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:
Which files should I be looking at to do a total conversion mod using the Source Engine? I just installed Source SDK. Made a multiplayer mod from a template using Source Engine 2007. I'm currently using VS2008.

I was wondering which folder I should work in. For example weapons, which files I should change?

Is it "\src\game\server\hl2\weapon_crowbar.cpp"
or "\src\game\shared\hl2mp\weapon_crowbar.cpp"
or "\src\game\shared\sdk\weapon_crowbar.cpp"

Also, I've seen the various help on the wiki, if I want to change bullets for example, saying I should change the scripts in the mod folder in Steam. Is that necessary? Shouldn't I make changes from the source mod folder to things like that and recompile?

I'm aiming for a total conversion mod rather than just a mini-mod in case that matters.

sentences: SVG textures for 3D game objects in Unity? Is there a way to make textures using vector graphics and use it for 3d models so that textures would be object size independent and won't get blurry?

sentences:
Performing image based lighting in an open world game I finally have a PBR implementation in an engine that I'm writing for a game I'm developing but I'm stuck on how to use IBL in real situations. Most IBL tutorials use it just to show a single mesh or group of spheres but nothing that I can immediately translate to an in-game application.

So I was wondering, in an open world, how would someone go about implementing image based lighting? Different areas will require different environment maps to be generated and then there's the issue of time of day. I guess for that, you could just use values that you would use in your day and night shader to change the colours being sampled from the environment map but you still have the issue of having a large map.

Update:
I've read about light probes and perhaps that's how this is achieved? Create probes around the whole map and then sample and interpolate between the probes that are near the camera. Is this how large open-world games achieve image-based lighting? This way you can have one light probe based on the skybox and multiple light probes spread across the scene and inside rooms.

sentences:
How to smooth terrain to lower polygon count? I'm using Unity.
I've created a simple Beach using Terrain editor.
The problem is that Stats show me already a lot of Triangles only for Terrain renderer: 40K .

So my question is: how can I create a Unity Terrain suitable for Mobile game ?
How can I smooth terrain edge ?

Thanks

sentences:
Calling functions that needs to be on update() So I have a function DialogueRun() for a Dialogue System that changes the line on the dialogue box whenever you click. Which means it has to be in Update(). My test works so far but my next problem is how to make the whole dialogue box only appear whenever I click on a character.
I tried making the characters as buttons and it does make the dialogue box show up whenever clicked, but it won't change the dialogue lines because that function has to be in an update method.
I'm looking at OnMouseDown() right now but the result will be probably the same. Any ideas?
 public void DialogueRun()
{
    dialogueBox.SetActive(true);
    dialogue.text = textLine[nextLine];

    if (nextLine < textLine.Length - 1)
    {

        if (Input.GetKeyDown(KeyCode.Mouse0))
        {

            nextLine += 1;
        }
    }
    else
    {            //counter++;
        dialogueBox.SetActive(false);
        return;
    }

sentences:
MonoGame: 2D Sprite acting weirdly I have a double array of tiles that show the ground.
They are randomly populated with a variety of items.

one item that only spawns one is a creature spawner.

this spawner spawns up to 5 creatures (for testing it does all 5 immediately).

these creatures move around randomly every update.

i know for a fact they are moving independent of each other.

but the weird part is, sometimes i only see 1 or 2 of the 5. the others arent there. console output tells me there is in fact 5.

and, additionally, when there is all 5, some of them get cut off if they move too far in one direction. but only SOME of them. ive seen two different creatures move in the same direction and only one of them got cut off.

to further complicate things, i believe some of the items on the ground are disappearing shortly after the world is created, including the spawner. sometimes i never even see the spawner, but the creatures are still created 'properly'.

i have in the initialization section to randomly generate the world, including all the items and where the spawner is.

after that is done, in the Update section, it checks if a tile contains an updateable object (currently, spawner is the only one). if it does, that objects calls its update method.

after that is done, the creatures are updated, if any.

then it is drawn. background tiles then ground objects then creatures.

if anyone has any idea what i might need to change to fix it or require any further information, just let me know, and thanks in advance!

sentences:
Shadow Glitch on Mesh Stitches I use LWRP, one Directional Light and Hard Shadows with 1024 resolution. When I imported this super simple mesh from blender this happened:

What is this weird line on the stitch of the mesh and how do I fix it? I tried using Soft Shadows with higher quality but it did not help.

sentences:
What are the benefits of using an entity ID system? I'm currently reading the book Programming Game AI By Example.

The book mentions assigning unique ID numbers to each entity in the game. Often when entity A needs to contact entity B, A gets a reference to B by sending B's ID number to an EntityDatabase class. This class recieves ID numbers and returns references to the entities.

The ID numbers of some entities could also be fetched from a file containing the IDs of some of the entities (the main game characters).

My question is: Why would I do this? Why can't I work directly with references? Is it sometimes difficult to get a direct reference? Is using an ID system a common approach? Are there games that don't use IDs?

I'm new to game development. Please explain the benefits of working with an entity ID system. The advantages and disadvantages. Concrete examples would be great. Thanks

sentences:
Two 2D objects in Unity aren't colliding together In Unity 5, I have a player shooting a projectile in aim to hit a boss, and inflict damage upon contact with the projectile. Though for some reason, the projectile and boss aren't colliding with each other.

I've done the following;

Made sure that both the projectile and boss have a BoxCollider 2D and Rigidbody 2D
Made sure that they're on the same Z-Index and on the same layer
Tried to Debug.Log() if there's any collision (there isn't)
Made sure I'm using OnCollisionEnter2D on the boss' health script
Compared the syntax I use with another collision (where the player collides with an object and dies - this works perfectly fine).

However, none of these seem to be working.
This is the boss' health script:

void OnCollisionEnter2D (Collision2D coll)
{
    Debug.Log("COLLIDED");
    bosshealth -= 1;
}

Here is the projectile prefab:

And the boss prefab:

Does anyone have a clue as to why they're not colliding? the projectile just glides over the boss

EDIT: I found a temporary fix! Disabling the Kinematics of the boss allows for both objects to collide, and successfully display a debug message!
Just a problem though; I don't want the boss to freely float around in space. I use the kinematic to ensure it stays put at all times until told to by scripts.

Is there a way to get around not having to disable the kinematics?

EDIT 2: Then again, I am removing the projectiles on impact anyway, so the actual boss doesn't move, but that seems dirty :/

sentences:
How common is arachnophobia among gamers? I am currently designing a spider as a monster for my game. During my research I found that there seems to be a surprisingly large amount of players who suffer from extreme arachnophobia and get panic attacks when they see a spider on their screen, even when in a context of a video game. This makes it impossible for them to enjoy games which feature spiders. There is a whole community of modders who work on mods to remove any spiders from popular games and thus make them playable for these people.

So I wondered if I might alienate a part of my target audience by adding spiders to my game. Are there any reliable numbers about how large the community of arachnophobic gamers really is?

sentences:
How to lower the cost of realtime lights? Besides Deferred rendering, what can I do to make realtime lights cheaper to render? I don't really need them but I could make good use of them in my game.
BTW I thought Deferred render would give me a bigger boost on scenes with many lights but I got kinda let down. Maybe my expectations were too high.

sentences:
How to make a Multicast Delegates in Blueprint? I used the Set Timer by Event, but I could not use the delegate in more than one event:

I've been researching about and it's possible, but I've only found results in c ++:

https://docs.unrealengine.com/en-US/Programming/UnrealArchitecture/Delegates/index.html

My code:

This is not at all functional. I'm using the same function twice.

I could call the "second" event after the execution of the "first" event, but I would like to know a way (if any) to use the delegate in more than one event.

sentences:
Precomputing SSAO causes driver timeout I was trying to do a pre-calculations of an SSAO effect by rendering normals and depth on a cubemap and doing a second ssao pass on each of these faces. The problem is I'm getting a timeout: "the nvidia opengl driver lost connection with the display driver...", when using high resolutions. Is there a good way to do such calculations without having to tweak registry values? I want this to be able to work for other people too.

In essence I'd love if there was also a way to add something like a loading bar so that people don't think the program crashed or something.

sentences:
Unity bounds includes the center of the scene I'm trying to get the bounds of an object and put a box around it.

Sounds simple right? I just encapsulate all the bounds together and use its center and size to do so.

But the problem is one corner of the box is always at the center of the scene, like a part of the object is there, unless the center of the scene is in the bounds.

This is when object is at the center

This is when it isn't

This is the code i'm using:

    public static Bounds Calculate(Transform TheObject)
    {
        Renderer renderer = TheObject.GetComponent<Renderer>();
        Bounds combinedBounds = new Bounds();
        if (renderer != null)
            combinedBounds = renderer.bounds;
        var renderers = TheObject.GetComponentsInChildren<Renderer>();
        foreach (Renderer render in renderers)
        {
            if (render != renderer) combinedBounds.Encapsulate(render.bounds);
        }
        return combinedBounds;
    }

sentences:
Measure a distance point to point in unity3D? I tried to measure a distance point to point on my phone screen by using following code
Vector3 startPoint;
Vector3 endPoint;
public Camera cam;
float distanceX;

void Update()
{
    if (Input.GetMouseButtonDown(0))
    {
        Vector3 startPoint = cam.ScreenToWorldPoint(Input.mousePosition);
    }

    if (Input.GetMouseButtonUp(0))
    {
        Vector3 endPoint = cam.ScreenToWorldPoint(Input.mousePosition);

        distanceX = Mathf.Abs(startPoint.x - endPoint.x);
        Debug.Log(distanceX);
    }
}

but this code does not give me the correct result and I don't know why..

sentences:
How can I restrict the rotation of an object to a subset of axes using quaternions? I've got a question about quaternions in my WebGL application.

How can I rotate an object only around two axes? For example, how can I exclude/nullify rotation about the Y axis?

The problem is that when I rotate something around X axis, and then around Y axis, it rotates around Z axis slightly as well. I have read whole piles of posts about it (for example)  but none of them really helped me. Reversal order of multiplication operations doesn't work for me. My actual code below:

// Main rotation function:

rotateCamera: function(angleX, angleY) {
    if (angleY !== 0) {
        this.yawRotation.axisToQuaternion(angleY, this.tempVec.make(1, 0, 0)));
        this.rotation.multiply(this.yawRotation);
    }
    if (angleX !== 0) {
        this.pitchRotation.axisToQuaternion(angleX, this.tempVec.make(0, 1, 0)));
        this.rotation.multiply(this.pitchRotation);
    }
    this.rotation.normalize();

    MVMatrix.setRotation(this.rotation.quaternionToMatrix());

// Matrix setRotation function:

setRotation: function(m) {
    this.element[0] = m.element[0];
    (... some code omitted ...)
    this.element[10] = m.element[10];
},

And the ought-to-be-working code based on other posts (which is not working):

rotateCamera: function(angleX, angleY) {
    if (angleY !== 0) {
        this.yawRotation.axisToQuaternion(angleY, this.tempVec.make(1, 0, 0));
    }
    if (angleX !== 0) {
        this.pitchRotation.axisToQuaternion(angleX, this.tempVec.make(0, 1, 0));
    }
    this.yawRotation.multiply(this.rotation);
    this.rotation.copy(this.yawRotation);
    this.rotation.multiply(this.pitchRotation);
    this.rotation.normalize();

    MVMatrix.setRotation(this.rotation.quaternionToMatrix());
},

EDIT: I have added more info about the actual code.

EDIT2: Okeeeey, I almost found a working answer for my problem (adapted it from Rick Hoskinson's post). My updated code below:

rotateCamera: function(radX, radY) {
    // Pitch (vertical rotation)
    if (radY !== 0) {
        this.pitch += radY;
        // Prevent camera from flipping upside-down (constrained by vertical "plane")
        this.pitch = Math.clamp(this.pitch, -Math.PI/2, Math.PI/2);

        this.rotation.axisToQuaternion(this.yaw, this.tempVec.make(0, 1, 0));
        this.rotation.multiply(this.tempQuat.axisToQuaternion(this.pitch, this.tempVec.make(1, 0, 0)));
    }
    // Yaw (horizontal rotation)
    if (radX !== 0) {
        this.yaw += radX;

        this.rotation.axisToQuaternion(this.yaw, this.tempVec.make(0, 1, 0));
        this.rotation.multiply(this.tempQuat.axisToQuaternion(this.pitch, this.tempVec.make(1, 0, 0)));
    }

    MVMatrix.setRotation(this.rotation.quaternionToMatrix());
}

Camera's roll has been eliminated using this method, but strange camera motion appears when rotating from one of the sides and then looking below (or I should say trying to look below, cause it curves away from this direction).

sentences:
Why doesn't my material show up on my imported model (Unity / Blender) UPDATE :

The material does work on smaller objects like a simple sphere, but not on my big arena model, which is actually imported from blender, any suggestions?

UPDATE :

Tried to export as .fbx, but doesn't change anything.

I've imported this material pack : https://www.assetstore.unity3d.com/en/#!/content/13004

I tried to apply it to my mesh, but only weird things happen, I can't see the texture at all. So I tried to apply this material in the "shader calibration scene" and that worked without any problem, even updating to the standard shader worked fine. So I tried to fix it with the following things :

Rebaking lighting
Restarting Unity
Tweaking the material settings
Tweaking quality settings in Unity
Building the project

All these things couldn't fix it, but it should most likely be related to my project settings, since this material is working in another project (shader calibration)

Here are my quality settings :

I'm not sure, which information is needed to answer the question, but I can provide it if you ask for it.

Update with Object properties :

sentences:
How to create Elastic rope / Rubber band in box2d? I am trying to create the rubber band type or elastic rope.

i ant to do something like bellow link.
http://heyalda.com/smash-turtle/

Thanks,

sentences:
Locate the shortest path through obstacles when all normal paths are blocked I'm making a Tower Defense and I have basic pathfinding working, but I got a problem.

I want to make the path blockable, and when a block occurs the runners will attack the blocking towers.

So what I need is a way to find the shortest path that, more importantly, has the lowest number of towers in the way.

How do I do that?

sentences: Lightmapping & runtime combine children Is it possible to have lightmapping on runtime generated combine children in Unity? It is possible to bake combined meshes when they are done in the editor, but the .apk/.ipa size increases too much.

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: (Fat) ray cast with MPR OR GJK? I know that it's possible to see if a line segment or a swept shape (to make a "fat" line segment) intersects objects using MPR and GJK.  Is it possible in those situations to find out the distance down the ray cast that the collision occurred?  Thanks!!

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:
How can I create a precise touch in Unity Is there a way so that I can touch an object precisely?

I have these aerial cars and there pretty tiny like 32 by 32 and it's hard to touch them using a raycast. I thought I'd spawn an object with a circle collider on it on the first touch and destroy it after the touch.

sentences: gradient coloring of an object I have an object(FBX format) in my project, it's a line drawn in 3D max. I want to color the line in XNA so that the color starts from a specific RGB color in both the start and end points of the line and finish in a specific RGB color.(e.x., from (255,255,255) to (128,128,128). Something like gradient coloring of an object. I need to do that programmatically, since later in my code I have to change these two specific colors a lot.

sentences:
My script to play the intro scene the first time the player hits play from the main menu wont work The script I am using determines if it is the players first time hitting the play button and if it is it will load the intro scene, but if they have played before it will take them strait to the game scene.
The problem is that it just takes them strait to the game scene.

public class SeenBefore : MonoBehaviour
{
    public string SceneName;

    AsyncOperation preload;

// Start is called before the first frame update
    void Start()
    {
        preload = SceneManager.LoadSceneAsync(SceneName);
        preload.allowSceneActivation = false;
    }

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

    }

    public void before()
    {
        if (PlayerPrefs.HasKey("HasSeenIntro"))
        {
        preload.allowSceneActivation = true;
        }
        else
        {
            PlayerPrefs.SetInt("HasSeenIntro", 1);
            SceneManager.LoadScene("Intro");

        }
    }
}

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:
How is "resolution scaling" done? Lots of new games use Resolution Scaling as an option. At first I thought it was just Super-sampling but it does not appear to remove aliasing so I'm assuming there is more to it than that.

I guess my question is, how are developers implementing this? I'm assuming it means multiplying the width and height of the various rendertargets, and then what?

sentences:
Pressed key doesn't run out of special powerups So I'm making a game in Lua/Love2D and have a problem with my game logic. Mainly I have a spaceship that can use boost and stuff. That part is fine, I click space and it boosts up to speed quickly.

The problem is that if the person holds down space, they stay boosted, which is not the intended behavior. How do I make sure that once boost runs out, it decelerates to normal speed? This is how it is currently:

  Note: Normal speed, 1000. Max boost possible speed, 3000.

if love.keyboard.isDown('space') then
    if player.v < 3000 and UICounters.currentboost > 0 then
        player.v = player.v + 200
        if player.v > 3000 then
            player.v = 3000
        end
        UICounters.currentboost = UICounters.currentboost - 1
    end
else
    if player.v > 1000 then
        player.v = player.v - 100
    end
    if UICounters.currentboost < UICounters.maxboost then
        UICounters.currentboost = UICounters.currentboost + dt
    end
end

sentences:
Sort Polygons in order - not working? I'm fairly new to programming in a 3d world.

I'm trying to create a canvas where all the objects are drawn in order of furthest-to-closest and from bottom to top - so they don't overlap each other, but there are problems.

As you can see, some of the objects are overlapping each other. None of the objects in the screen will be moving so I was wondering: is there an algorithm available to sort the objects in the correct order?
At the moment I have them sorting in the Z axis ascending, then X descending and Y descending.

sentences:
Who should be contacted to request permission, for commercial songs (and cost ballpark) While playing to Fifa, it occurred to me that there is probably a license that EA pay to musicians to play their songs in their game.

Does anyone know if there is a standard license for indie games, to be able to play commercial songs in the game? Either for the intro and for the game itself, like FIFA does.

I did a brief search and the suggestion is to contact the publisher of the specific group/singer; but 90% of the time they probably won't even read such email. Is this the only way?

Of course this won't apply for free music that is distributed to be freely used for any use; my question is specifically for commercial music from decently known artists.

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:
Kepler orbit : get position on the orbit over time I'm developing a space-simulation related game, and I am having some trouble implementing the movement of binary stars, like this:

The two stars orbit their centroid, and their trajectories are ellipses.

I basically know how to determine the angular velocity at any position, but not the angular velocity over time. So, for a given angle, I can very easily compute the stars position (cf. http://en.wikipedia.org/wiki/Orbit_equation).

I'd want to get the stars position over time. The parametric equations of the ellipse works but doesn't give the correct speed :
{ X(t) = a×cos(t) ; Y(t) = b×sin(t) }.

Is it possible, and how can it be done?

sentences:
How can I get the Text component from TextMeshPro ? I'm getting null exception At the top of the screen :
public GameObject uiSceneText;
private TextMeshPro textMeshPro;

Then in the script at some point :
uiSceneText.SetActive(true);

if (textMeshPro.text != "")
    textMeshPro.text = "";

The exception error null is on the textMeshPro on the line :
if (textMeshPro.text != "")

textMeshPro is null.
This screenshot shows the TextMeshPro in the Hierarchy :

and I see that the Scene Image object and its child Scene Text both are enabled true.
I want to get the text and add replace a new text with the text already in the Text but the textMeshPro is null.
The complete script :
using System.Collections;
using System.Collections.Generic;
using TMPro;
using UnityEngine;

public class PlayerSpaceshipAreaColliding : MonoBehaviour
{
    public float rotationSpeed;
    public float movingSpeed;
    public float secondsToRotate;
    public GameObject uiSceneText;

    private float timeElapsed = 0;
    private float lerpDuration = 3;
    private float startValue = 1;
    private float endValue = 0;
    private float valueToLerp = 0;
    private Animator playerAnimator;
    private bool exitSpaceShipSurroundingArea = false;
    private bool slowd = true;
    private TextMeshPro textMeshPro;

    // Start is called before the first frame update
    void Start()
    {
        textMeshPro = uiSceneText.GetComponent<TextMeshPro>();

        playerAnimator = GetComponent<Animator>();
    }

    // Update is called once per frame
    void Update()
    {
        if (exitSpaceShipSurroundingArea)
        {
            if (slowd)
                SlowDown();

            if (playerAnimator.GetFloat("Forward") == 0)
            {
                slowd = false;

                LockController.PlayerLockState(false);

                uiSceneText.SetActive(true);

                if (textMeshPro.text != "")
                    textMeshPro.text = "";

                textMeshPro.text = "Here I will add the new text.";

            }

            if (slowd == false)
            {

            }
        }
    }

    private void OnTriggerEnter(Collider other)
    {
        if (other.name == "CrashLandedShipUpDown")
        {
            exitSpaceShipSurroundingArea = false;
            Debug.Log("Entered Spaceship Area !");
        }
    }

    private void OnTriggerExit(Collider other)
    {
        if (other.name == "CrashLandedShipUpDown")
        {
            exitSpaceShipSurroundingArea = true;
            Debug.Log("Exited Spaceship Area !");
        }
    }

    private void SlowDown()
    {
        if (timeElapsed < lerpDuration)
        {
            valueToLerp = Mathf.Lerp(startValue, endValue, timeElapsed / lerpDuration);
            playerAnimator.SetFloat("Forward", valueToLerp);
            timeElapsed += Time.deltaTime;
        }

        playerAnimator.SetFloat("Forward", valueToLerp);
        valueToLerp = 0;
    }
}

sentences:
Direct3d - Code structure I'm learning directx in a master's degree and they taught us to have a GraphicsLayer class which is the one connecting with the direct3d library. That way this class is completly independent from the other classes (my game classes), meaning changing the renderer to OpenGL wouldn't require much effort but only changing the graphicLayer.

This classe has it's LoadAssets, Paint methods, but I have a question, they told us to load all the assets inside this class. This means all these methods will be in the loadAssets method:

D3DXCreateTextureFromFileEx(g_pD3DDevice,"tiles.png",0,0,1,0,D3DFMT_UNKNOWN,D3DPOOL_DEFAULT,D3DX_FILTER_NONE,D3DX_FILTER_NONE,NULL,NULL,NULL,&texTiles);
// And more resources to load
//...

texTiles as you see is a LPDIRECT3DTEXTURE9 instance which is declared in the graphicLayer.h.

So my question is, how do you manage all the resources? Do I have to declare in the .h all my game textures even if I'm not using them? How would you load only those resources there are in a scene and draw them in a code-strucured way?

sentences:
Unity method to get a vector, which is x seconds behind another moving vector (A bit like TrailRenderer) I want a function, which lets me follow a vector with a bit offset or delay, like it's done in the TrailRenderer. I tried to achieve this with the Lerp function, but that didn't work for me like I want, since I had to wait for a specific time until the lerp was done and then updated my targetVector of the Lerp again, which led to a bad result.

Now a possible solution to my problem would be a List, which holds all Positions of my Vector from the past 50 frames or so and I assign the same values to my other Vector with a specific offset. But I was wondering if there is some built in method in Unity, which could achieve this for me.

Edit: This is about moving a Canvas

sentences:
How do I implement side scrolling in a javascript platformer? I'm building a side scrolling platformer with Javascript and the canvas element for a school project. I have the character all sorted out. He runs left and right, and has a different sprite set for standing still. The game has gravity, and I can jump. Now what I can't get my head around is how to implement side scrolling.

The game world will be tile based. Each tile will be 20x20 pixels. When the character gets to the edge of the screen, it should scroll with the character to explore the level further.

Can anyone point me in the right direction to a resource that explains how to programmatically do this? Language specific to Javascript would be good, but anything would be a help.

sentences:
Switching between Discrete and Integrated GPUs I have a machine with two discrete GPUs and one integrated GPU. I can currently switch between them using NVIDIA's software, but I would like the ability to do so within my applications for purposes of benchmarking and general convenience. Apparently this requires the "NDA version" of NVIDIA's Driver API, which I know not how to obtain. Would using this API be the only way to accomplish what I seek, and if so, how would I obtain it? A solution using Windows APIs would also be acceptable, though less preferable to one which would leverage a cross-platform API. I have created a similar thread concerning the matter on NVIDIA's forum, which is down at the time of this writing.

Thanks for reading my question; it is much appreciated!

Edit: Here's a link to the original post I made on the NVIDIA forums - no luck on either site yet, though.

sentences:
Stop schedule on gameOver I have 2 events running through time in my game. I want that when gameover starts, this events stops running

This is my code:

- (void)onEnter
{
   [super onEnter];
   [self schedule:@selector(addStars:) interval:1.5];
   [self schedule:@selector(addBoxes:) interval:2.5];

}

-(void)gameOver
{

 //stop schedule addStars
 //stop schedule addBoxes

 }

sentences:
How to store and update data table on client side (iOS MMO) Currently I'm developing an iOS MMO game with cocos2d-x. The game depends on many data tables (Excel file) given by the designers. These tables contain data like how much gold/crystal will be cost when upgrade a building (barracks, laboratory, etc.). We have about 10 tables, each have about 50 rows of data.

My question is how to store those tables on client side and how to update them once they have been modified on server side?

My opinion: use SQLite to store data on client side, the server will parse the Excel files and send the data to client with JSON format, then the client parse the JSON string and save it to SQLite file.

Is there any better method?  I find that some game stores CSV files on client side, how do they update the files? Could server send a whole file directly to client?

sentences:
Is it possible to somehow change the collider points to match sprites during the animation in Unity? Is it possible to somehow change the collider points to match sprites during the animation in Unity?
I am using the Unity built in animtion recording feature. I would like to change the points of some of my colliders as animation goes, while at the same time I am changing the respective sprites. I was not able to find any solutions so far.
Any ideas how I could do that?
I have a few attempts to overcome the problem.

Create a few game objects with the different preset points for the colliders. The solution will work. But it is crazy hard to develop and maintain resources wise. I will have to spend an immense amount of time creating a separate game object with a collider for each frame. And also the maintenance will be very lame. Because I will need to add a wrapper around all the places where I access collider. So that the wrapper would return the currently enabled collider.

I can buy the 2DColliderGen. But I do not want to spend money on that. And also it is not completely what I am looking for, because even with it I will have significant difficulties developing my animations, maintaining my game and extending it.

sentences:
(GameMaker) Smooth scaling and transparency while zooming My game has a zoom function. There is a man in a spaceship, we can see the interior of the room room from side on as the outside is totally transparent. When I zoom out I want the outside of the spaceship to become gradually less transparent and the window sprite to shrink to give the illusion of depth. When zooming the opposite will happen. With my current code the scaling and alpha changes are triggered when a the zoom factor is above or below 1.5.

My question is this - How can I make the scaling and alpha changes directly link to the zoom level so the change is smooth and directly correlates to the zoom value at all times, not just at a set point such as 1.5?

Thanks for your help, here is my code :

*****(Event: oWindow_Step_1)*****

    ///set up transparency & scaling

//make transparent to start
if oPlayer.zoom = 1
    {
    image_alpha = 0
    image_xscale = 1
    }

//if camera zooms out make window smaller and more opaque
if oPlayer.zoom > 1.5
    {
    image_alpha += 0.01
    image_xscale -= 0.03
    image_yscale -= 0.03
    }

//if camera zooms in make window bigger and more transparent
if oPlayer.zoom < 1.5
    {
    image_alpha -= 0.01
    image_xscale += 0.03
    image_yscale += 0.03
    }

//stop image_xscale exceeding 3
if image_xscale >= 1.5
    {
    image_xscale = 1.5
    image_yscale = 1.5
    }

//stop image_xscale being less than 1
if image_xscale <= 1
    {
    image_xscale = 1
    image_yscale = 1
    }

///set up transparency & scaling

//make transparent to start
if oPlayer.zoom = 1
    {
    image_alpha = 0
    image_xscale = 1
    }

//if camera zooms out make window smaller and more opaque
if oPlayer.zoom > 1.5
    {
    image_alpha += 0.01
    image_xscale -= 0.03
    image_yscale -= 0.03
    }

//if camera zooms in make window bigger and more transparent
if oPlayer.zoom < 1.5
    {
    image_alpha -= 0.01
    image_xscale += 0.03
    image_yscale += 0.03
    }

//stop image_xscale exceeding 3
if image_xscale >= 1.5
    {
    image_xscale = 1.5
    image_yscale = 1.5
    }

//stop image_xscale being less than 1
if image_xscale <= 1
    {
    image_xscale = 1
    image_yscale = 1
    }

sentences: XNA Silverlight 5 3D Model Position I am use to XNA and starting to learn XNA for Silverlight 5. My Question is that in XNA when you create a Model and load it using content.load you are able to access the models Position, scale etc.. In Silverlight XNA these options are not available. It would be possible  to change the Models position using World Translate, but I need the models position for collision detectection using boundingSphere Any Advice??

sentences:
Disabling impact damage by Kinematic actor on non-dynamic destructibles (using NVidia APEX) I have a destructible non-dynamic object at Apex scene and am hitting the object with a kinematic actor. I do not want it to be fractured by these impacts. Is it possible?

PS: the impact damage is off when the destructible is dynamic. I have tried below settings:

physx::apex::NxDestructibleParameters destructibleParameters =
                                          destructibleActor->getDestructibleParameters();
destructibleParameters.forceToDamage = 0;
destructibleParameters.damageCap = 0;
destructibleParameters.impactVelocityThreshold = PX_MAX_F32;
destructibleParameters.impactDamageDefaultDepth = -10;
destructibleActor->setDestructibleParameters(destructibleParameters);

sentences:
Collisions not working as intended I'm making a game, it's a terraria-like game, with 20x20 blocks, and you can place and remove those blocks. Now, I am trying to write collisions, but it isn't working as I want, the collision successfully stops the player from going through the ground, but, when I press a key like A + S, that means if I walk down and left (Noclip is on atm), my player will go into the ground, bug up, and exit the ground somewhere else in the level. I made a video of it. The red text means which buttons I am pressing.

You see, if I press A and S together, I go into the ground.
Here is my collision code:

Vector2 collisionDist, normal;

private bool IsColliding(Rectangle body1, Rectangle body2)
{
    normal = Vector2.Zero;

    Vector2 body1Centre = new Vector2(body1.X + (body1.Width / 2), body1.Y + (body1.Height / 2));
    Vector2 body2Centre = new Vector2(body2.X + (body2.Width / 2), body2.Y + (body2.Height / 2));

    Vector2 distance, absDistance;

    float xMag, yMag;

    distance = body1Centre - body2Centre;

    float xAdd = ((body1.Width) + (body2.Width)) / 2.0f;
    float yAdd = ((body1.Height) + (body2.Height)) / 2.0f;

    absDistance.X = (distance.X < 0) ? -distance.X : distance.X;
    absDistance.Y = (distance.Y < 0) ? -distance.Y : distance.Y;

    if (!((absDistance.X < xAdd) && (absDistance.Y < yAdd)))
        return false;

    xMag = xAdd - absDistance.X;
    yMag = yAdd - absDistance.Y;

    if (xMag < yMag)
        normal.X = (distance.X > 0) ? xMag : -xMag;
    else
        normal.Y = (distance.Y > 0) ? yMag : -yMag;

    return true;

}

private void PlayerCollisions()
{
    foreach (Block blocks in allTiles)
    {
        collisionDist = Vector2.Zero;
        if (blocks.Texture != airTile && blocks.Texture != stoneDarkTexture && blocks.Texture != stoneDarkTextureSelected && blocks.Texture != airTileSelected && blocks.Texture != doorTexture && blocks.Texture != doorTextureSelected)
        {
            if (IsColliding(player.plyRect, blocks.tileRect))
            {
                if (normal.Length() > collisionDist.Length())
                {
                    collisionDist = normal;
                }

                player.Position.X += collisionDist.X;
                player.Position.Y += collisionDist.Y;

                break;
            }
        }
    }
}

I got PlayerCollisions() running in my Update method.
As you can see it works partly, but if it runs perfectly, it would be awesome, though I have no idea how to fix this problem. Help would be greatly appreciated.

EDIT:

If I remove the break; it works partly, then it is just the thing that it spasms when it hits two or more blocks at once, like, if I touch 2/3 blocks at once, it does twice the force up. How can I make it so that it only does the force for one block, so it stays correct, and does not spasm? Thanks.

sentences:
Paradigm for storing user data for iOS Disclaimer: I'm not well versed in Game Dev best practices so this may be a trivial question.

I'm developing an iPhone game in which I have to store a user profile containing such information as scores for each level, latest level completed, etc. I've thought of a few ways to store this data but want to do it the "right" way (i.e. how it would be done by professionals) so am I on the right track with any of these methods or is there a better way:

Create a User class and serialize it using NSCoding/NSKeyedArchiver/etc. (This seems like overkill)
Store all that information with NSUserDefaults.
Some other method?

sentences:
Set Position of multiple bodies I have a character composed of five bodies which are tied together by a lot of joints. On of them is the overall chassis, to which all forces and impulses are applied to move the whole Character.

All in all that works very fine, except one thing: I need to set the Position of the Character so that it get Beamed from one place to the other in one single frame.

Unfortunately I cannot get this to work. I tried the following code, without any success…

playerbodies.forEach(function (bd) {
    bd.SetLinearVelocity(new b2.Vec2());
    var t = bd.GetTransform();
    t.p.x -= 10;
    bd.SetTransform(t, bd.GetAngle());
});

How can I make that happen?

sentences:
Creating movement path displays in a top-down 2d RTS My game is a top-down 2d RTS coded in C# using SFML's libraries. I want that during unit selection, a unit will display it's movement path on the map. Currently, after the path is computed as a list of directions ({left, up,down, down, down, left}, as an example), it's sent to the graphical component to create it's UI equivalent, and here I'm having some problems. current, these I've checked three ways to do it:

compute the size of the image (in the example above it'll be a 3*2 rectangle) and create an invisible rectangle, and then go over the directions list and mark each spot with a visible point, so as to get a continous line. This system is slightly problematic because of the amount of large images that I need to save, but mostly because I have a lot of fine detail onscreen, and a continous line obstructs the view.
again, compute the size of the image, but now create several (let's say 4) invisible images of that size, and then instead of a single continous line I'll switch between the four images, in each will appear only a fourth of the spots, in a way which creates a path animation. This is nicer on the eye, but here the memory demands, and the amount of time needed to compute each such image-loop is significant.
Just create a list of single markers, each on a different spot on the path. This is very quick & easy on memory, but too sparse.

Is there a simple or resource-light system to create path-animations?

sentences:
Execute script in edit mode when scripts finish compiling, without an object in the scene I need to inspect some method information before game starts to implement something in Unity.

I can run the script by [ExecuteInEditMode] attribute, however it only works if at least one object in the scene has the script as component.

What I want is to run the script in edit mode as soon as Unity finishes each recompilation, without a scene object, so other developers can use my library/framework without creating objects manually.

How do I run the script in edit mode after the scripts recompile, without creating an object in the current scene?

sentences:
Last Matrix operation ignored? I have 2 methods, one to rotate my Quad and one to flip it (using scaleM), they are as follows: (Note, all values in these methods have been properly defined).

If I call just one, they work as expected, but if I call both, then only the one that is called last if applied - why is this?  If I combine them into on 'flip and rotate method' - then my quad is both flipped and rotated. (See third code snippet)

Why is this?

Method to rotate

    public void rotate(float x, float y, int angle){

    //Rotate the quad

    Matrix.setIdentityM(mRotationMatrix, 0);
    Matrix.translateM(mRotationMatrix, 0, centreX, centreY, 0f);
    Matrix.rotateM(mRotationMatrix, 0, -angle, 0, 0, 0.1f);
    Matrix.translateM(mRotationMatrix, 0, -centreX, -centreY, 0f);

}

Method to 'flip' (horizontally)

    public void flipHorizontal(float x, float y){

    Matrix.setIdentityM(mRotationMatrix, 0);
    Matrix.translateM(mRotationMatrix, 0, centreX, centreY, 0f);
    Matrix.scaleM(mRotationMatrix, 0, -1, 1, 0f);
    Matrix.translateM(mRotationMatrix, 0, -centreX, -centreY, 0f);
}

Combined method

    public void flipHorizontal(float x, float y, int angle){

    Matrix.setIdentityM(mRotationMatrix, 0);
    Matrix.translateM(mRotationMatrix, 0, centreX, centreY, 0f);
    Matrix.rotateM(mRotationMatrix, 0, angle, 0, 0, 0.1f);
    Matrix.scaleM(mRotationMatrix, 0, -1, 1, 0f);
    Matrix.translateM(mRotationMatrix, 0, -centreX, -centreY, 0f);

}

sentences:
Bullet Physics too many rigid bodies framerate drops I have a question regarding rigid bodies in bullet physics.

At the moment I have low-poly asteroids, which I create a convex Hull shape.
Then I add a motion state and give them a linear velocity.

Collision and everything is working fine, if its a low amount of asteroids (less than 5).

But as soon as the amound of objects in the world get higher, my framerate starts to drop under 1 FPS.

I have a Intel i56600k and a AMD Fury. Could it be related to my hardware?
Or is bullet limited in this regard? Or did I do something wrong in my program?

I'm writing the game in C++.

sentences:
Switching between meshes vs Loading only specific mesh I am currently developing an online multiplayer game on Unity. In the game, the character of each player will be assigned its mesh after the game receives parameters (their meshes' names) for each character from the server. Assigning each character's mesh can happen after the main scene is loaded. I am wondering whether:

I should make each character's object the same by having every mesh possible loaded into it and only activate the corresponding mesh for that player.
I should create a class that holds every mesh possible (like, mesh manager) and tell each character to use its mesh from that class.
I should delay the characters' meshes loading to wait for the parameter from the server first. Then, load the mesh after the scene has been loaded.

I am not sure if specific assets can be loaded outside of its scene in Unity. If anyone has any different solutions, feel free to suggest. Thanks in advance.

sentences:
Calculating projectile velocity from moving object I'm working on a top down space shooter and am having trouble with calculating/understanding the physics for projectiles launched from the space ship.

The ships have a velocity vector and a turret with rotation independent from the body of the ship. Currently projectiles are launched based on the turrets rotation by making a normalized vector then multiplying each component by a speed. However, this doesn't work when the ship is moving faster than the speed scalar.

Right now if the ship is going faster than the projectile speed scalar and the turret is aimed in the same direction as the ship's velocity, the projectile goes backwards (away) from the ship. Assuming there is no drag/gravity (very deep space), how should I go about handling projectiles?

sentences:
Phaser 3 physics bug in platformer game I'm writing a platformer lode-runner-like game. I would like to ask experienced people to see what's wrong. Everything seems to be ok but I am absolutely confused about 3 bugs.

Why is the player jumping on top of the ladder?
I tried to put the physics of the player's sprite body to -gameSettings.gravity.v to prevent a slow slide down the stairs but after that when the player rises to the top he cannot get off the ladder.
When you collect all the boxes, a ladder appears on the uppermost platform. It is no different from other ladder, but sometimes I can climb on it and sometimes I can't.

I know that I ask too many questions, but I am sure they are all related to physics error I made somewhere in my code.

https://platformergametest.000webhostapp.com/ here I uploaded my game on free hosting

sentences:
Putting items into a 3D space Imagine a fridge and a bunch of random foods. I want to take one food item, automatically put it somewhere in the fridge, and repeat. I can stop at any time.

Basically, the filled fridge should look like it has been gradually stocked over the course of a week or so (as opposed to deliberately organized at once) by a calm human being (as opposed to by someone who's just thrown things into it).

Formally, this procedure has to satisfy the following:

Similar items should stack or be next to each other given that there is sufficient space (ex. egg cartons cases go in one stack, 2L milk cartons go side by side)
Other items should not stack until there is no more space left at the bottom
Placed items should be as upright as possible (ex. plastic-wrapped leftovers shouldn't be sideways), unless limited space requires rotation
Items should be put somewhere in the center of the fridge when it is relatively empty (instead of being squished to one side)
The procedure should automatically stop when the fridge no longer has any room left

Ignoring any dividing racks that may be present in the fridge (say it's just one big container), how should this be done? What variables would I need to define with an Item, and/or what algorithms should I use to determine where to put the next item and how to find out which angle of rotation will give me the fit?

sentences:
Programmatically determine UVs by rotating a plane along X axis I'm having a math brainfart while trying to solve what might be a simple problem.  I've got a plane in 3d space (it's actually the face of a 10-sided die):

Coordinates [x,y,z]:
Point_top  = [0,0,1]
Point_left = [Sin (2pie9/10), Cos(2pie9/10), 0.1] = [-.5878,.809,.1]
Point_right= [Sin (2pie/10) , Cos(2pie/10), 0.1]  = [ .5878,.809,.1]
Point_bot  = [-1,0,-0.1]

If you project that out, it's a plane with the top leaning back away from you, and the bottom closer to you.

I'm trying to automatically build a UV map of that face to put a texture on, so think I should rotate it around the x-asix so that it's only in 2D, then scale that to best fill up a 256x256 texture.  I'm doing this in Three.JS for a canvas app.

Is this the right approach?  In this example:
http://wecreategames.com/games/DiceBoard ( die creation code is in: http://wecreategames.com/games/DiceBoard/die10.js ), I'm estimating the UVs by:

//Build UVs
scope.faceUvs = [[]];
scope.faceVertexUvs = [[]];
for (var f = 0; f < numHalfFaces; f++) {
    var faceuv = [
        new THREE.UV(.2, .6),
        new THREE.UV(.5, .75),
        new THREE.UV(.8, .6),
        new THREE.UV(.5, .2)
    ];
    scope.faceUvs[0].push(new THREE.UV(0, 1));
    scope.faceVertexUvs[0].push(faceuv);
}

But when I view on an iPhone or Android, it shows weird screen artifacts... I'm thinking because the UVs aren't exact.

I think I'd apply some function like this (where andDist is an angle):

rx = x;
ry = (y * Math.cos(angDist)) - (z *Math.sin(angDist));
rz = (y * Math.sin(angDist)) + (z *Math.cos(angDist));

But, I'm not sure how to get the angle that the face is inclined at. Any suggestions?  Or, are those white screen artifacts due to something else I've overlooked?

sentences:
I cant Attach C# Script to my Player? Every time I try to attach my C# Script to my Player, it gives me this error message:

  "Can't add script component 'Player' because the script class cannot be found. Make sure that there are no compile errors and that the file name and class name match."

Here is my script, just for good measures

using UnityEngine;

using System.Collections;

public class Player : MonoBehaviour
{
    public float speed = 50f;
    public float jumpPower = 150f;
    public bool grounded;
    private Rigidbody2D rb2d;
    // Use this for initialization
    void Start ()
    {
        rb2d = gameObject.GetComponent<Rigidbody2D>();
    }

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

    }

    void FixedUpdate()
    {
        float h = Input.GetAxis ("Horizontal");
        rb2d.AddForce ((Vector2.right) * speed * h);
    }
}

I have no Idea how to fix that...

Anyway, I am using Unity Engine 5

EDIT: I HAVE FOUND THE ERROR. (I forgot to save the script XD)

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:
Draw line between tiles of tiled map in libgdx I want to draw line between two tile of my .tmx map in libgdx . I want to get a tile position but not in pixels , in maps grid numbers like : (0 , 6 ).
or is there any way to change a tile color in libgdx.
i can get tile like below:

layer=(TiledMapTileLayer)tiledMap.getLayers().get(0);
layer.getCell(row, col).getTile()

but can not to draw some thing on the tile.

sentences:
Perform intersection (horizontal and vertical) checking in raycasting I want to check the horizontal and vertical intersections on my raycasting view, and I can't exactly understand what is ALPHA using this drawing

source : https://www.permadi.com/tutorial/raycast/rayc7.html

I wrote something that makes the walls straights and with less stairs on top and bottom, but i have some columns which go out of the view row, i can't figure out where i failed my operations (rounds)

this is the code of the vertical and the horizontal intersections :

static inline void      inter_hor(t_wolf3d *w, int i, double angle){
t_vec2f a; // first intersection point
t_vec2f o; // offset
double  tangent;

tangent = ttan(angle) + 0.001;
a.y = (angle <= 180) ? floor(w->cam->position.y / 32) *
32 - 1 : ceil(w->cam->position.y / 32) * 32 + 32;
o.y = (angle < 180) ? -32 : 32;
o.x = (angle < 90 || angle > 270) ? 32 / tangent : -32 / tangent;
a.x = (angle != 180.0 && angle < 359.97) ? w->cam->position.x + (w->cam->position.y - a.y) / tangent :
w->cam->position.x + (w->cam->position.y - a.y) / -tangent; //w->mini_h is the w->map->h  * 32 and so on for w->mini_w
a.x = (angle >= 179.97 && angle <= 180) ? w->cam->position.x + (w->cam->position.y - a.y) / -tangent : a.x;
if (ceil(a.x / 32) < 0 || ceil(a.x / 32) >= w->map->w)
    a.x = (ceil(a.x / 32) < 0) ? 0 : w->mini_w - 1;
while (w->map->board[(int)a.y / 32][(int)a.x / 32] == 0)
{
    a.x += ((angle >= 90 && angle < 180) || angle >= 270) ? -o.x : o.x;
    a.y += o.y;
if (ceil(a.x / 32) < 0 || ceil(a.x / 32) >= w->map->w)
    a.x = (ceil(a.x / 32) < 0) ? 0 : w->mini_w - 1;
    if (a.y < 0 || a.y > w->mini_h - 1)
        break;
}
w->cam->interh[i].x = a.x;
w->cam->interh[i].y = a.y;}
static inline void      inter_ver(t_wolf3d *w, int i, double angle){
t_vec2f a; // intersection point
t_vec2f o; // offset
double  tangent;

tangent = ttan(angle) + 0.001;
a.x = (angle >= 90 && angle < 270) ? ceil(w->cam->position.x / 32) *
32 - 1 : floor(w->cam->position.x / 32) * 32 + 32;
o.x = (angle > 90 && angle < 270) ? -32 : 32;
o.y = (angle > 0 &&  angle < 180) ? -32 * tangent : 32 * tangent;
a.y = (angle != 270 && angle != 90) ? w->cam->position.y + (w->cam->position.x - a.x) * tangent :
w->cam->position.y + (w->cam->position.x - a.x) * -tangent;
if (ceil(a.y / 32) < 0 || ceil(a.y / 32) >= w->map->h)
    a.y = (ceil(a.y / 32) < 0) ? 0 : w->mini_h - 1;
while (w->map->board[(int)ceil(a.y / 32)][(int)a.x / 32] == 0)
{
    a.y += ((angle > 90 && angle < 180) || angle > 270) ? -o.y : o.y;
    a.x += o.x;
    if (ceil(a.y / 32) < 0 || ceil(a.y / 32) >=  w->map->h)
        a.y = (ceil(a.y / 32) < 0) ? 0 : w->mini_h - 1;
    if (a.x < 0 || a.x > w->mini_w - 1)
        break;
}
w->cam->interv[i].x = a.x;
w->cam->interv[i].y = a.y;}

I could use the dir.y / dir.x computed before for my tangent, but i didn't cause i had some divisions by zero when my rays was facing at 180, 360, 0 degrees, angles are complexes and i dont understand completely the vectors method to do that way; these are some screeshots :

sentences:
Unreal 4 - How to access and iterate through the polygons of a mesh? I'm newbie with Unreal Engine 4. I need to create a function which calculates the volume of a mesh, based on the following example:

https://n-e-r-v-o-u-s.com/blog/?p=4415

To achieve that I created an actor blueprint containing a cone. I then created a function to calculate the volume of a tetrahedron composed by a polygon plus the center point of the scene, like that:

Now I want to iterate through each of the polygons composing the cone actor, one by one, and use the above function to calculate the total volume of the cone.

I found a possible beginning for a such iteration:

However I'm unable to find a way to create a loop which iterate through the Triangles array and extract the 3 vertices of each triangles composing the mesh.

I would be grateful if someone explained to me how to implement a such loop.

Or, if so, how to access correctly to the actor mesh vertex buffer object, and to iterate through each of the polygons composing it.

sentences: Decompile an FX shader Is it possible to decompile a .xnb file?  I've lost my shader code, but only have my .xnb file left.

sentences:
Creating weapons/armor procedurally In my current project I am creating a 2d game (rpg) which should be able to dynamically create new weapons and armor based on different components. So, i.e. a sample weapon would consist of barrel1, grip3, etc. It's much like Borderlands, but in 2d.

I thought about using a library like CImg in order to assemble the different parts (which are images) and then using the created sprite in my game.

Am I on the right way? Is there a better way to accomplish this task?

sentences:
What type of dashboard should I create to understand how my game is performing? This is a two part question. Let's say I release a new Flash game to the web. Once players start playing I want to understand how it is performing:

What common performance criteria do people track? (e.g. viral coefficient, play length, returning players.)
How should I go about measuring and monitoring these attributes? Are there any off the shelf tools?

sentences:
Make the texture array node work with cubemaps? I am working on a procedural interior mapping shader in Unity's Shader Graph. Ideally, I'd like to feed it a set of cubemaps it can pick from semi-randomly.
However, it seems that by default the texture array asset one can provide to a graph does not support reading cubemaps.
Does anyone have a way to use this, or perhaps a clever custom node or alternate texture mapping, so that I can read a number of cubemaps into the shader semi-randomly? Preferably an arbitrary number, but even a fixed number would be somewhat of an improvement.

sentences:
How do I get a reference to a component on a sibling object in C# Script? I'm working on a game, where the player dumps trash from Trash cans into a Trash Truck. These Trash cans have a random chance of having a Racoon on top of them.
I have a script set up to detect when the player enters a Collider Trigger attached to the Racoon, which will cause it to play an animation and start attacking the player.
To do that, it needs to work with a racoon navigation component on a neighbouring object:

I'm trying to access the RacoonNAVAI component on the Racoon_Mover game object with this line:
racNav = transform.parent.parent.Find("Racoon Mover").gameObject.GetComponent<RacoonNAVAI>();

But it's throwing a null reference exception. How can I correctly get a reference to this component?

sentences:
Shadow casting in 2D OpenGL I´ve read several articles, tutorials about shadow casting and I think that I understand the way how it works. However I miss some of the steps. Here is included my order list:

Fill framebuffer with ambient light
Render light textures to the framebuffer(adding proper blending)

3. Lights have vector of shadow casters(convex polygons) and check if they touch them(by checking the distance) and if yes, I do proper math calculation to project the polygon to the right "transformation". Then I draw them as black polygons to the framebuffer

4.At the end I use this framebuffers texture and blend it with actual game textures to "do lighting (with shadows)".

As you can see I bolded the step 3 because thats where I´m lost. The first thing, how do I project the polygon? (for these polygons I have a vector of points, also a vector of edges). The second thing, is it efficient to do it this way? I mean to iterate through the possible shadow casters for each light.

Thanks for your help.

sentences:
Can't work out how matrix is applied to 2D vertices I have a texture, some 2D vertices, and a matrix. The matrix is used to calculate the texture coordinates for each vertex, but the problem is that the matrix comes with absolutely no documentation and I'm having trouble working out how to calculate the texture coords correctly. I have it partially working.

The matrix is in this format:

sx rx tx
ry sy ty

Where s means "scale", r means "rotate", and t means "translate".

If the matrix doesn't contain any rotation (i.e. ry = rx = 0), I can correctly calculate the texture coordinates u and v like this:

u = x/sx - tx
v = y/sy - ty

But I can't figure out how to put rx and ry into the equation and get the correct results. Normal matrix multiplication involves multiplying and adding but this one involves dividing and subtracting, so I know I'm missing something but I don't know what it is.

Here is one of the matrices with rotation:

26.191574096679688   7.0180206298828125  1579
-7.0180206298828125  26.191574096679688  1879

Here is one of the matrices without rotation:

27.115478515625  0                1867
0                27.115478515625  800

sentences: What is the difference between ambient lighting and skylight? What is the difference between ambient and skylight lighting? Please give me a detailed description of the differences.

sentences:
Armature rest matrix - why does this exist? I'm not sure I have a clear idea on what purpose the rest matrix/bindpose is supposed to serve in skeleton animation. If it is supposed to transform a bone into the rest pose and the mesh itself is always exported in the rest pose then shouldn't the rest matrix always be the identity matrix? But then why is it not the identity matrix in Blender?

I also find that if I transform my mesh (exported in the rest pose) by the rest matrix for each bone then it is very incorrectly deformed (it was after all already in the rest pose).

sentences:
Pausing and resuming in Unity I've been writing this code quite late so please bear with me.
I'm trying to pause the game and show a menu when I'm inside a collider and then when i press a key it should unpause the game and continue but it wont and i cant figure out why.

Here's the very simple (in my eyes) code:

var savedTimeScale : float;
var playerStatus : Player_Status;
var inTheZone : boolean = false;
private var startTime: float = 0.1;
var start:GameObject;

enum Upgrade { None,Main }
private var currentPage:Upgrade;

function Start()
{
    currentPage = Upgrade.None;
}

//function for ontriggerenter and pressing button to show menu
function OnTriggerEnter(collider:Collider)
{
    playerStatus = collider.GetComponent(Player_Status);
    if(playerStatus == null) return;

    inTheZone = true;
}

function OnTriggerExit(collider: Collider)
{
    playerStatus = collider.GetComponent(Player_Status);
    if(playerStatus == null) return;

    inTheZone = false;
}

function Pause()
{
    savedTimeScale = Time.timeScale;
    Time.timeScale = 0;
    AudioListener.pause = true;
    currentPage = Upgrade.Main;
}

function UnPause()
{
    Time.timeScale = savedTimeScale;
    AudioListener.pause = false;
    currentPage = Upgrade.None;
    if(IsBeginning() && start != null)
    {
        start.SetActive(true);
    }
}

function IsGamePaused()
{
    return Time.timeScale == 0;
}

function OnGUI()
{
    if(inTheZone == true && Input.GetKeyDown(KeyCode.E))
    {
        Pause();
    }

    if(Input.GetKeyDown(KeyCode.N))
    {
        UnPause();
    }

    if(IsGamePaused() && !IsBeginning())
    {
        UpgradeMenu();
    }
}

function UpgradeMenu()
{
    BeginPage(200,200);
    GUILayout.Button("Hello");
    EndPage();
}

function BeginPage(width, height)
{
    //GUI.DrawTexture
    GUILayout.BeginArea(Rect((Screen.width-width)/2,(Screen.height-height)/2,width,height));
}
function EndPage()
{
    GUILayout.EndArea();
    ShowBackButton();
}
function ShowBackButton()
{
    if(GUI.Button(Rect(20, Screen.height-50,50,20), "Resume"))
    {
        UnPause();
    }
}

function IsBeginning()
{
    return Time.time < startTime;
}

I think it's just a case of a new set of eyes. But by my logic this should work.

sentences:
I get weird perspective using GLM where the depth is flipped. Please help The depth is rendered wrong and I can't figure out why.

using namespace std;
using namespace glm;
int width = 640;
int height = 480;
float aspect = (float)width/height;
int fps = 60;

void start(){
  glClearColor(0.0f,0.2f,0.6f,1);
  glEnable( GL_TEXTURE_2D );
  glEnable(GL_DEPTH_TEST);
  glDepthFunc(GL_LESS);
  glFrontFace(GL_CW);
  glCullFace(GL_BACK);
  glEnable(GL_CULL_FACE);

  mat4 projectionMatrix = perspective(radians(60.0f),aspect, 0.1f, 1000.0f);
  mat4 modelViewMatrix = translate(vec3(0,-25,-100));
  modelViewMatrix *= rotate(radians(50.0f),vec3(0.f, 1.f, 0.f));
  modelViewMatrix *= rotate(radians(-90.0f),vec3(1.f, 0.f, 0.f));
  mat4 modelViewProjMatrix = projectionMatrix*modelViewMatrix;

  Shader shader;
  shader.load("vertex.glsl","fragment.glsl");
  shader.bind();
  shader.uniform("modelViewProjMatrix",value_ptr(modelViewProjMatrix));

  Model model;
  model.load("res/bob.md5mesh");

  glClear(GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT);
  model.render();
  glutSwapBuffers();
}

void mainloop(int val){
  glutTimerFunc(1000/fps,mainloop,val);
}
int main(int argc, char* args[]){
  glutInit(&argc,args);
  glutInitContextVersion(3,0);
  glutInitDisplayMode(GLUT_RGB | GLUT_DOUBLE | GLUT_DEPTH);
  glutInitWindowSize(width,height);
  glutCreateWindow("Test");
  glewInit();

  start();
  glutTimerFunc(1000/fps,mainloop,0);
  glutMainLoop();
  return 0;
}

However, I found a way to fix it by multiplying the perspective by scale(1,1,-1),
but it seems kind of a hack to me.

mat4 projectionMatrix = perspective(radians(60.0f),aspect, 0.1f, 1000.0f) * scale(vec3(1,1,-1));
mat4 modelViewMatrix = translate(vec3(0,-25,100));

I'd really appreciate it if someone can tell what I'm doing wrong.

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:
How were old mobile games (J2ME/MIDP/JAR) monetized? (2000s era) When I was in school, me and my friends were just exchanging *.jar files via IrDA and Bluetooth.
However now I realize, that old phone games were of high quality and whole studios stood behind them.
What was the "official" way of getting a game to your old mobile phone? How did mobile game developers get their revenue those days?

sentences: Where to store shaders I have an OpenGL renderer which has a Scene member variable. The Scene object can contain N SceneObjects. I use these SceneObjects for storing the vertex position and any transforms. My question is, where should shaders be stored in this arrangement? I guess they need to be in a central location because multiple objects can use the same shader. But then each object needs access to the shader because it needs to set attributes into the shader. Does anyone have any advice?

sentences: libGDX Multitouch Controls Has anyone had any trouble implementing multitouch on-screen controls in libGDX, such as multiple joysticks? I've tried and I can't seem to get libGDX to play nice with multitouch/multiple pointers on screen at once. I am currently using a Stage with my joystick class extending Actor and they are detecting hits just fine, but when I touch one it interferes with the other. Any examples, or tips? I should note, that when I am using just one of the joysticks that they work as intended.

sentences:
Unity tilemap tiles animation I am beginner in Unity and I have created tilemap using new tilemap system in unity which looks like this:

I created a script that lets me swap tiles. First I click on some tile and than I choose second tile, after I click second time, tiles swap their positions. Which will than look like this:

How can I apply some animation to this process? Seems like I have no control over tile object as it is. I can only access TileBase which as I understand is not all information about tile. I can't create any animator controller or access its transform object. I want to add some custom animation when tiles swap their places. Thank you!

sentences:
Bomberman clone, how to do bombs? I'm playing around with a bomberman clone to learn game-developement.

So far I've done tiles, movement, collision detection, and item pickup. I also have pseudo bombplacing (just graphics and collision, no real functionality).

I've made a jsFiddle of the game with the functionality I currently have. The code in the fiddle is very ugly though. Scroll past the map and you find how I place bombs.

Anyway, what I would like to do is an object, that has the general information about bombs like:

function Bomb(){
  this.radius = player.bombRadius;
  this.placeBomb = function (){
    if(player.bombs != 0){
      // place bomb
    }
  }
  this.explosion = function (){
  // Explosion
  }
}

I don't really know how to fit it into the code though. Everytime I place a bomb, do I do var bomb = new Bomb(); or do i need to constantly have that in the script to be able to access it.

How does the bomb do damage? Is it as simple as doing X,Y in all directions until radius runs out or object stops it? Can I use something like setTimeout(bomb.explosion, 3000) as timer?

Any help is appreciated, be it a simple explanation of the theory or code examples based on the fiddle. When I tried the object way it breaks the code.

Update: I now place bombs, and after a certain amount of time delete it depending on the position I placed it. But if I place a bomb before the first bomb explodes it only deletes one of them (obviously since bombX and bombY has changed since the first was placed).

Now i need to know how to fix this issue, maybe create a new array with all of the bomb positions? What's the best way of doing this?

Current code:

function placeBomb(){
    if(placebomb && player.bombs != 0){
        map[player.Y][player.X].object = 2;
        bombX = player.X; bombY = player.Y;
        placebomb = false;
        player.bombs--;
        setTimeout(explode, 3000);
    }
}
function explode(){
    alert('BOOM!');
    delete map[bombY][bombX].object;
    player.bombs++;
}

sentences:
Only apply Advanced Graphics on high FPS Dynamically I wonder why not prevent lags by only appying advanced optional graphics stuff when the FPS are high at time. So The game could use simpler or even no shaders and skip decorative models some time.

It there an approach of dynamically calculating more or less each frame for higher FPS yet?

Is there a project using this approach yet?

sentences: Calculating time until a ball fall How exactly can I calculate time until a ball fall if I know initial and final x and y position of a ball, gravity, delta time, initial dx and dy of a ball and its speed calculated from the formula sqrt(dx ** 2 + dy ** 2)?

sentences: How can I make particles glow and cast light on its surroundings? Im currently attempting to make a firefly effect on a dark forest. The level has very low light and the player is one of the few light sources. To let the player see the level better, I am attempting to making glowing fireflies appear randomly on the map. One way is to use a particle system. But I cant make the particles cast light one the surroundings. Is there a way to do this?

sentences:
Getting access violation because of ID3D11Buffer I try to create a simple class store my model variables vertex array and vertexbuffer. So I create an array of myclass to create and manage object dynamically. But when

 hr = g_pd3dDevice->CreateBuffer( &bd, &InitData, &pieces[counter].g_pVertexBuffer);

this line run I get the error "Access violation reading location". I try to many things but I never success. If I don't use class and array I don't get this error. Porgram runs without error.

MyClass:

class Piece
{
public:
  double positionX, positionZ,
    red, green,blue;
  bool renderable;
  int type, color, vertexCount;
  XMMATRIX g_WorldPieces;
  ID3D11Buffer* g_pVertexBuffer;
  SimpleVertex* vertices;
  Piece();
  void create(int, int, double, double);
};
Piece::Piece()
{
   g_pVertexBuffer = NULL;
}
 void Piece::create(int t, int c, double pX, double pZ)
{
   g_pVertexBuffer = NULL;
   renderable = true;
   type = t;
   color = c;
   red=green=blue=0.0f;
   if(color == 1)
     red=green=blue=1.0f;
   positionX = pX;
   positionZ = pZ;
   vertexCount = 0;
}

  Piece *pieces;//Global variable which define after defining "ID3D11Device*                       g_pd3dDevice = NULL"

and using objects of myclass:

for(int x=0;x<4;x++)
{
if(x==2)
{
    c=0;
    positionZ = 12.5;
}

for(int y=0;y<8;y++)
{
    pieces[counter].create(typeArray[x][y],c,positionX,positionZ);
    positionX += 5;
    switch(pieces[counter].type)
    {
         //Switching object txt. All cases and breaks are fine.
    }
    fin >> pieces[counter].vertexCount;
    pieces[counter].vertices = new SimpleVertex[vertexCount];
    for(int i=0; i<vertexCountpiyon; i++)
    {
        fin >> pieces[counter].vertices[i].Pos.x >> pieces[counter].vertices[i].Pos.y >> pieces[counter].vertices[i].Pos.z;
        fin >> pieces[counter].vertices[i].Tex.x >> pieces[counter].vertices[i].Tex.y;
        fin >> pieces[counter].vertices[i].Normal.x >> pieces[counter].vertices[i].Normal.y >> pieces[counter].vertices[i].Normal.z;
    }
    fin.close();
    bd.ByteWidth = sizeof( SimpleVertex ) *pieces[counter].vertexCount;
    ZeroMemory( &InitData, sizeof(InitData) );
    InitData.pSysMem = pieces[counter].vertices;
    hr = g_pd3dDevice->CreateBuffer( &bd, &InitData, &pieces[counter].g_pVertexBuffer);//THIS LINE IS MY PROBLEM!
    if( FAILED( hr ) )     return hr;
    counter++;
}
positionX = -17.5;
positionZ += 5;
}

When I get access violation counter is 0.

Source code of my project: http://1drv.ms/1nKdoUf

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:
Does the gender of a game's protagonist affect sales? Most protagonists of games are male. I imagine the conventional wisdom is that this is because

We live in a patriarchal society, especially when it comes to game development, and
The target demographic is predominantly male.

I once heard that for fiction, females are more able to empathise with a male character, than males are with a female character. So the great imbalance in gender in fiction is not necessarily due to patriarchy, but that it just makes sense from a financial point of view. I'm not sure if I subscribe to that, but it is interesting.

And there was a time when gaming was for super hardcore nerdy males, but now almost everybody has a games machine, and it is not a stigma to like games as it once was, I don't know if it is such a male domain any more.

So leaving aside any question of whether we should try to reduce gender stereotypes,
my question is, does having a female protagonist actually affect sales, in particular, for small indie games? Are there any experiments, statistics or research relating to this question? What is the actual demographic breakdown of gamers these days?

I realise this is an inflammatory subject, so I will stress here that I am not looking for opinions:

I am looking for hard facts and data.

sentences: How to move an object in a heart shape pattern in javascript? How can I move an object in a heart shaped pattern? I have a move(x, y) function that I can use to move the object, but how to I make a function that will move the object in a heart shaped pattern, with something like a setInterval?

sentences:
How can I get started making textures for 3D games? Just wondering where to find good tutorials on making textures for 3D games?

Also, is it common practice to take photographs and convert them into game textures or do designers draw the textures themselves?

UPDATE:

To make the situation more specific, I am trying to make a simple game where the game character is in a small building so I would be making textures for computers, tables, chairs, doors, windows, walls, etc... What is outside the building is mostly irrelevant. I don't have any experience in 3D modeling though I'm thinking of using Blender.

sentences:
Noisy edges, smoothing out edges between faces via fragment shader I have a generated terrain, with hexagonal geometry, as per screenshot below:

I then generate biomes, but as you can see the borders between them are really ugly and straight. To hide that hexagonal origin, I would need to smooth out the borders between biomes. This is how it looks now in wireframe with real tringular faces:

What I'm aiming for is something more like this:

Each vertex has attibute that holds the biome type, I can also add special attributes to the vertices on the edge between two biomes, but I just don't seem to be able to figure out how to pull this off in shader code, obviously noise is involved here, but how do I make it continous across multiple faces and entire border of multiple biomes?

I'm rendering with WebGL using THREE.js

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

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

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

How can I do this?

sentences:
Unity Ads showing test ads I am implementing Unity Ads in my game and for some reason I have the test ads showing up in my production version of my app. I have the advertisements initialized with test ads turned off and I have even gone into my settings on the Unity Ads admin and set it to force test ads to be off. I'm not sure what else to do here.

Here is how I am initializing:

Advertisement.Initialize("myID", false);

sentences:
RPG Damage Calculation Logartihm in Java I'm trying to make a damage calculation formula for my RPG game, there are 12 levels for both the Player and the Enemy, I've come as far as making a Reverse Exponential formula, but I want the damage to go down from slow to faster as the Players level gets closer to the level of the Enemy.

import java.io.File;
import java.io.FileNotFoundException;
import java.io.PrintWriter;
import java.io.UnsupportedEncodingException;

public class DamageCalc {

    private static double defense;
    private static double dmg;
    private static String teststring;

    public static void main(String args[]) throws FileNotFoundException, UnsupportedEncodingException{
        for(int i = 1; i <= 12; ++i){
            for(int j = 1; j <= 12; ++j){
                defense = ((j * 3) * 2 + 11) * 2;
                dmg = i * 12;
                double totaldmg = getDamage(i,dmg,defense,j);
                teststring += "Player Level " + i + "\nMonster Level " + j + "\nTotal Damage " + totaldmg + "\n----------------------------------\n";
            }
        }
        PrintWriter test = new PrintWriter("testvalues.txt","UTF-8");
        test.println(teststring);
        test.close();
    }

    public static double getDamage(double level, double dmg, double defense, double enemy){
        double intdamage = (((2*level+10) / 128) * (dmg/defense) * 11 + 1) * 10;
        double damage = Math.ceil(Math.pow(intdamage,level/12) * 10);
        System.out.println(intdamage);
        return damage;
    }

}

The code just loops through the players level (int i) and the enemies level (int j), then returns the damage done. The difference in damage between level 1 and 2 is significantly higher than between 11 and 12, eventhough that should be the other way around.

EDIT: I'll explain it even further. The player starts with 12 for each stat, every level 12 get's added (dmg = level * 12). Every stat for the player has 128 points and monsters 128 points, so that's why the begin defense of a monster is 11. If the damage stat from the player is lower than the defense of the enemy, the damage will get a penalty, otherwise it will get a boost (double * (dmg/defense)).

I hope this explains it.

sentences: Storing game resources in the *.dat file format to reduce file size How can I store sprites(png) or audio files(wav) in the *.dat file format?

sentences: What middle tier and backend libraries exist for handling player matching and out of game information? Are there any libraries or frameworks readily available that handle player metrics, rankings, matching, tournaments, etc? Anything for managing the player community? (Please don't say DotNetNuke)

sentences:
What is a GUI element with a filling-up rectangle shape called? After every game of StarCraft 1, the statistics screen shows up. The part I like on this screen is the points counter. It starts from zero and then it counts up to the points you have achieved, with a filling-up rectangle shape based on the number it represents.

What is this type of counter called?

For example, the Units bar for Alpha Squadron counts from 0 to 4975.

sentences:
Custom shadow mapping in Unity. Works with preservative Light view but not with Orthographic So about a week ago I decided to make my own shadow mapping technique in Unity based on my understanding of the whole thing. The entire experience was somewhat successful. I learned a lot and I get to correct a lot of things such as the MVP matrix and the math behind it.  One thing though didn't work as planned and I don't know why.

First lets talk about what worked. I wrote a replacement shader that will show the depth of every object based on the Light Position/perspective. Therefore I made a custom Light GameObject that act as a camera/light with that replacement shader attached to it, and I record everything the Light sees into a render texture.

Then I made a second Camera which is basically a child of the main camera, and sees what the main camera see with the exception of the replacement Shader that I attached previously to the Light gameobject. again I recorded everything from the camera to a render texture as well.

After that, I wrote a basic Shader that does a basic light calculation and make a the shadow comparison between the two textures, and determines whether a fragment in a shadow or light. Also, I added a shadow Bias as well to eliminate any artifacts.

            struct appdata {
            float4 position : POSITION;
            float3 normal : NORMAL;
            float2 uv : TEXCOORD0;
        };

        struct v2f {
            float4 position : SV_POSITION;
            float2 uv : TEXCOORD0;
            float3 normal : TEXCOORD1;
            float3 worldPos : TEXCOORD2;

        };

        float4 _Tint;
        sampler2D _MainTex;
        sampler2D  SahdowMap_Light, SahdowMap_View;
        float4 _MainTex_ST;
        float4x4 WorldToCamera, WorldToLight;
        float3 _LightDir1;

        v2f VertexProgram(appdata v) {
            v2f i;
            i.position = UnityObjectToClipPos(v.position);
            i.worldPos = mul(unity_ObjectToWorld, v.position);
            i.normal = UnityObjectToWorldNormal(v.normal);
            i.uv = TRANSFORM_TEX(v.uv, _MainTex);
            return i;
        }

        float Shadow_Cal(v2f i, sampler2D DepthMap,float4x4 space) {

            float4 projected2 = mul(space, float4(i.worldPos, 1.0f));
            float2 uv = (-projected2.xy / projected2.w) * 0.5 + 0.5;
            float Shadow = tex2D(DepthMap, uv).r;

            if (uv.y > 1.0)
            Shadow = 0.0;

            return Shadow;
        }

        float4 FragmentProgram (v2f i) : SV_TARGET {

            float LightDepth = Shadow_Cal(i, SahdowMap_Light, WorldToLight);
            float ViewDepth = Shadow_Cal(i, SahdowMap_View, WorldToCamera);
            float bias = max(0.05 * (1.0 - dot(i.normal, _LightDir1)), 0.015);
            float Shadow = LightDepth + bias < ViewDepth ? 0 : 1;

            float4 Texture = tex2D(_MainTex, i.uv);
            float3 lightpos = _LightDir1 - i.worldPos;
            return saturate(dot(lightpos, i.normal)) *_Tint * Texture * Shadow;
        }

The problem is when the Light is on perspective, this works perfectly fine as shown above, but when I switch the light camera to Orthographic this happen:

I tried many different things to fix it but I failed.
I would love your insight in this whole thing, your thought, solution or even a suggestions.

You are free to download the whole project as a package here Download

Special thanks to DMGregory.

sentences:
Is there a method to add partial scorch marks or decals on top of existing sprites? Let's say what I have is a planet like so:

What I want to do is to add a scorch mark like this:

Now, if this was a one time thing, it wouldn't be a problem. I'd make a sprite for this specific occasion and move on. The problem is however, I want the scorch marks to look different and to not use all that much memory (because there might be too many of them on screen and this is for mobile).

The scorch marks will almost always be the same size but the planets will be different sizes, so one sprite that is scaled is not what I want (it would look too big on bigger planets and too small on smaller ones). Also, I want to be able to rotate the sprite to make it look different.

I've thought about adding another sprite on top of the planet (a border-like hack) to hide this but there can be other planets that are really close by to this one and they would be hidden too.

I've looked at a lot of stuff but nothing like this exists.

I've managed to create some stuff with a stencil shader and the use of a sphere with zero Z scale. This does create the problem of showing the sprite on other planets and I haven't been able to push forward on this.

This is what I can currently make:

This is what I need to make:

sentences:
How to normalize angles from points in java Previous thread on projectile slopes

What is the velocity of a translating projectile in 2D?

What I'm trying to do

Get the slope at a constant speed for both X & Y Coordinates though I don't have an understanding on how to use Vectors in programming so I'm going off this guys equations but with both X & Y since I don't understand vectors. I can't tell at this point if there a direction or coordinate.

What I've done so far

Got everything ready

What I need help with

What do I have to put in as Syntax to normalize these 2 points even though their coordinates (Based off the answer on the given thread)

sentences:
2D terrain with midpoint displacement and collision I followed this theory Here to implement a simple scrolling 2D terrain for my running game. I am used to dealing with collision via a tile system but am looking for a good theory on how to perform terrain collision (keeping the player on-top the land) with a midpoint displacement 2D terrain

I am not worried about the physics aspect but how to determine if a character intersects an array of points generated by the theory above. Example if I have an array of points

Points[]

these points are used to draw lines to make a terrain. Now in my mind I would first find the player center. Take the center X and see which two points it is between. So if X is 4.6 lets say it is between points that lay on X=3 and X=6.

Player X = 4.6
Point1 X = 3, Y = 3
Point2 X = 6, Y = 5

So now knowing this I somehow need to calculate  what Y would be giving that X = 4.6. And once I have Y ensure that the Player Y > CalculatedY. If it is not push the player up to what Y the player should be.

So I guess what I a saying is

X = 3, Y = 3
X = 6, Y = 5
X = 4.6, Solve for Y

sentences:
State Machine with State per Entity I have a generic state machine implementation like this:

public abstract class State<TOwner>
{
    public virtual void OnEnter(TOwner owner) { ... }

    public virtual void OnExit(TOwner owner) { ... }
}

public sealed class StateMachine<TOwner, TState>
    where TState : State<TOwner>
{
    public TState CurrentState { ... }
}

Usage looks a bit like this (more or less):

public abstract class SoldierState : State<Soldier>
{
    public abstract void Update(Soldier owner, GameTime gameTime);
}

public class RestState : SoldierState
{
    public static readonly RestState Instance = new RestState();

    private RestState()
    {
    }

    public override void Update(Soldier owner, GameTime gameTime) { ... }
}

public class Soldier
{
    private readonly StateMachine<Soldier, SoldierState> state = ...;

    public void Update(GameTime gameTime)
    {
        this.state.CurrentState.Update(this, gameTime);
    }
}

Importantly, notice how my state classes are singletons. This means every soldier will share the same SoldierState instances.

This is fine until I need to store state per soldier. For example, suppose I want to ensure that soldiers remain in the rest state for a minimum of 10 seconds. That means that any soldier that enters the rest state needs to have an associated piece of data tracked for it.

I could just use a dictionary:

public class RestState : SoldierState
{
    ...

    private readonly IDicionary<Soldier, TimeSpan> restTimes = ...;

    public override void Update(Soldier owner, GameTime gameTime)
    {
        TimeSpan restTime;
        restTimes.TryGetValue(owner, out restTime);
        restTime += gameTime.Elapsed;

        if (restTime > TimeSpan.FromSeconds(10))
        {
            soldier.State = FightingState.Instance;
            restTimes.Remove(soldier);
        }
        else
        {
            restTimes[soldier] = restTime;
        }
    }
}

However, I'm concerned about the efficiency (or lack thereof) here. Is there a better way to achieve what I want? Would I be better off having state instances per entity instead of trying to use singletons?

sentences:
Can I make a Cue in XACT to play two sounds? I have my gun shot and reload sounds with their own cues, can I create a cue that points to both of them so they are played one after the other when playing the cue?

I would have tried the documentation but: Where is the XACT documentation?

UPDATE:

The documentation now found says:

  A cue allows a game programmer to play sounds. It is composed of one or more sounds, and is referenced through a sound bank.

and:

  ...XACT enables audio designers ... to create transitions between cues

So my hunch was correct! But still cannot find how to do it. Why why doesnt the tool come with a comprehensive manual? whats the point in creating it if you dont tell people how to use it!!??

sentences:
[Unity] Render an animated texture to a screen I'm looking for a way to write a typed text on a texture, and then render it on a screen: in the game it's just the screen of a computer where a scientist is typing text on.

The texture will be already generated: it will have several textures in it.

I can't find any obvious way to do a simple render to texture with unity, how could I do that ?

sentences:
Making walls in OpenGL How do I make walls in JOGL 2.0 in Eclipse?
So far, I've tried it with listing vertices, until I realised that was a C method while I need to work it in java.

sentences:
How to create a boxcollider, which surrounds the gameobject and all of his children? I have a Car, who needs a Box Collider.
If the car would be 1 single mesh, i would only need to call:

        boxCol = gameObject.AddComponent<BoxCollider>();

and it would create a boxCollider, which fits perfectly my car, based on my car's mesh.

Now I have a car which exists of many different parts in the hierarchy. (for example: Body of the car is the parent of the 4 doors. Every door is 1 seperate gameobject, and has a doorknob child etc. )

now i need a script which changes the boxCollider so, that it has the box surrounding the whole car.

i found:
http://answers.unity3d.com/questions/22019/auto-sizing-primitive-collider-based-on-child-mesh.html

but it just doesnt get me the right collider.

Edit:
I just tried again - and the Boxcollider stays the same.

using UnityEngine;
using UnityEditor;
using System.Collections;

public class ColliderToFit : MonoBehaviour
{

    [MenuItem("My Tools/Collider/Fit to Children")]
    static void FitToChildren()
    {
        foreach (GameObject rootGameObject in Selection.gameObjects)
        {
            if (!(rootGameObject.GetComponent<Collider>()  is BoxCollider))
                continue;

            bool hasBounds = false;
            Bounds bounds = new Bounds(Vector3.zero, Vector3.zero);

            for (int i = 0; i < rootGameObject.transform.childCount; ++i)
            {
                Renderer childRenderer = rootGameObject.transform.GetChild(i).GetComponent<Renderer>();
                if (childRenderer != null)
                {
                    if (hasBounds)
                    {
                        bounds.Encapsulate(childRenderer.bounds);
                    }
                    else
                    {
                        bounds = childRenderer.bounds;
                        hasBounds = true;
                    }
                }
            }

            BoxCollider collider = (BoxCollider)rootGameObject.GetComponent<Collider>();
            collider.center = bounds.center - rootGameObject.transform.position;
            collider.size = bounds.size;
        }
    }

}

sentences:
What are some ways to make a scene without walls and infinite terrain visually appealing? My Player Character is standing in the middle on flat infinite terrain.
The player can see as far as the farplane of the camera. And there is nothing there which is... boring.

I wanted to Plant a couple of trees which move with the player (but not rotate with them).

But I would need tons of trees for that, and that would destroy performance.

Next I've thought about a "foggy-shadow", or a light or a cubemap with textures of things.

But those things are visually totally ugly.

Now I am in front of a hard decision and I dont know what to do.

Here are examples of infinite terrain so you guys know what I mean.

sentences:
Perlin Noise Variations Currently I'm making a voxel survival game. About a month ago I embarked on procedurally generating terrain using Perlin noise. I understand how to use and apply it for the most part. However I do not understand how to vary terrain structure. Let me say that in a way you probably can understand because "me no grammar good".

By changing frequency and amplitude I know I can change the resulting terrain, varying it from rolling hills to jagged peaks. However the end result will always be the same: either never ending hills or never ending mountains. I don't understand really how I would mix those two "terrain structures" together to get area's of hills and area's of mountains.

sentences:
Where can I learn about Substance maps for 3ds Max 2012? A new feature in 3ds max 2012 is Substance procedural textures.

Are there any good online libraries or resources for substance maps?

sentences: Generate random position within object I have a plate object which is generated somehow (I don't care how), now I want to put another object within this object on random position. Lets say that I want to put random trees on this plate. How can I achieve this in Unity. I had read for bounds but I don't know how to use it to generate position for the tree.

sentences: Most efficient way to optimize based on gpu type? So, I'm writing an optimization button that should optimize a game based on the type of hardware the user has. I know I can use d3dadapter_identifier9 to achieve this, but what would be the most efficient way of actually implementing it? Not sure whether i should check based on deviceid, name, etc. was hoping someone could give me a couple tips for that. Thanks in advance.

sentences: Does triangle-plane clipping in 3D always produce a triangle? When you clip a triangle against a plane, will you always get a triangle out? Are there perhaps cases where you don't get a triangle out of clipping it against a plane?

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:
In track and field dash, determine starting speed from a final time with acceleration I am developing an athletics game, and working on the mechanics of the 100 meter dash. The player controls an athlete, that during the race has acceleration and a max speed. To win the race, the player has to collect boost tokens, which will increase the max speed.

So when the dash starts, the athlete will accelerate to his max speed, then when the athlete picks up a token, the max speed will increase, and he will accelerate again to the new max speed.

The problem is, I want to set the fastest time possible. In a config file, I want to set the fastest possible 100m dash time to 9.4 seconds.

How do I determine my starting max speed, so that when all tokens are collected, the final time will be 9.4 seconds?

This code is not actual code, but to illustrate the problem, and provide an example with numbers.

const acceleration = 6; // meters / seconds^2
const numTokens = 10;
const tokenDistribution = 100 / (numTokens + 1); // one token per 9.1 meters (and not on the finish line)
const tokenIncreaseSpeed = 1; // meters / seconds
const bestTime = 9.4; // seconds

const maxSpeed = ?? // meters / seconds - value so with all tokens the final time is 9.4 seconds...
const speed = 0;
// Pseudo loop code
update(delta) {
    speed += acceleration / delta;
    if (speed > maxSpeed) speed = maxSpeed;
    if (player.collides(token)) {
        maxSpeed += tokenIncreaseSpeed;
    }
    player.y += speed / delta;
    if (player.y > finishLineY) endRace();
    render() etc...
}

sentences: Android sidecroller template I want to create a sidescroller game for Android but it seems stupid to reinvent the wheel and since there are a lot of android sidescroller games already out I though that there must be some sort of template or something so I can get started quicker, so I can keep developing from there.

sentences:
Multisampled Nearest Filtering in PS 2.0 is it possible? My game involves blocky, pixelated 3D textures. When using nearest neighbor filtering with a texture sampler, I get the desired result of nicely pixelated textures -- with the caveat that hard lines between pixels are aliased. Here's a screenshot of what I mean:

See the jaggies?

I'd like to know if I can use some kind of screen-space multisampling to fix these jagged edges. I'm using HLSL and pixel shader 2.0. Is it possible to accomplish this in the shader? (Note that MSAA does not work in this case because the aliasing is in the texture sampler, not in rasterizing geometry).

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:
How do I properly use String literals for loading content? I've been using verbatim string literals for some time now, and never quite thought about using a regular string literal until I started to come across them in Microsoft provided XNA samples. With that said, I'm trying to implement a new AudioManager class from the Net Rumble sample.

I have two (2) issues here:

Question 1: In my code for my GameplayScreen screen I have a folder location written as the following, and it works fine:

menuButton = content.Load<SoundEffect>(@"sfx/menuButton");
menuClose = content.Load<SoundEffect>(@"sfx/menuClose");

If you notice, you'll see that I'm using a verbatim string, with a forward slash "/".

In the AudioManager class, they use a regular string literal, but with two backslashes "\". I understand that one is used as an escape, but why are they BACK instead of FORWARD? (See below)

soundList[soundName] = game.Content.Load<SoundEffect>("audio\\wav\\"+ soundName);

Question 2:
I seem to be doing everything correctly in my AudioManager class, but I'm not sure of what this line means:

audioFileList = audioFolder.GetFiles("*.xnb");

I suppose that the *xnb means look for everything BUT files that end in *xnb? I can't figure out what I'm doing wrong with my file locations, as the sound effects are not playing. My code is not much different from what I've linked to above.

private AudioManager(Game game, DirectoryInfo audioDirectory) : base(game)
{
    try
    {
        audioFolder = audioDirectory;
        audioFileList = audioFolder.GetFiles("*.mp3");
        soundList = new Dictionary<string, SoundEffect>();

        for (int i = 0; i < audioFileList.Length; i++)
        {
            string soundName = Path.GetFileNameWithoutExtension(audioFileList[i].Name);
            soundList[soundName] = game.Content.Load<SoundEffect>(@"sfx\" + soundName);
            soundList[soundName].Name = soundName;
        }

        // Plays this track while the GameplayScreen is active
        soundtrack = game.Content.Load<Song>("boomer");
    }
    catch (NoAudioHardwareException)
    {
        // silently fall back to silence
    }
}

sentences:
Using a shader messes up my alpha in XNA I'm making a 2D game that ends up being too dark on some laptops, so I figured I'd use a shader so people could brighten it up if need be.  Unfortunately, once I got it in there nothing would fade in or out, they'd just pop in and out.

Here's my FX file

float intensity;

sampler TextureSampler : register(s0);

float4 Glow(float2 texCoord:TEXCOORD0):COLOR0
{
    float4 Color;
    Color = tex2D(TextureSampler, texCoord.xy);
    Color.rgb *= intensity;
    return Color;
}

technique Technique1
{
    pass Glow
    {
        PixelShader=compile ps_2_0 Glow();
    }
}

Even after commenting out the Color.rgb *= intensity; line it still removes all fading effects.

I'm using the sprite batch to draw, and I begin and end it a few times because I use different BlendStates

brightnessShader.Parameters["intensity"].SetValue(brightness);
spriteBatch.Begin(SpriteSortMode.Immediate, BlendState.AlphaBlend, null, null, null, brightnessShader, Matrix.CreateScale(scale));
...
spriteBatch.End();
spriteBatch.Begin(SpriteSortMode.Immediate, BlendState.Additive, null, null, null, brightnessShader, Matrix.CreateScale(scale));
....
spriteBatch.End();
spriteBatch.Begin(SpriteSortMode.Immediate, BlendState.AlphaBlend, null, null, null, brightnessShader, Matrix.CreateScale(scale));
...
spriteBatch.End();

I'm using XNA 4.0.

sentences:
unity spriterenderer scale to fit screen portion let me explain what i have.
a camera that render only a sprite ( sprite renderer) and what i'm looking for is to scale that sprite renderer to fit a screen portion (not the entire screen) for example 0.145 (normalized) anyone can help me?
fix : i mean, from 0 to 0.145 so the entire area ( it will be a 125x125 image ) so i need to keep the aspect ( same width and height) and i'm using orthographic camera

sentences:
Organising data of a turn-based strategy I'm intermediate in Java but novice in everything which is on the server-side.
I've set myself a task to rewrite an old game, so learning Java is more fun.
It is a space turn-based strategy. The original was called Stars! (I heard that Master of Orion is somewhat similar). Basically players assign their orders to ships and planets and then submit a turn to server, where a new turn is generated.

I suppose, I will have a lot of objects (ships, fleets, planets and so on), each of them will have some properties (XY position, orders, HP etc.). When generating a turn, the server will have to cycle through all the objects and perform tasks with each one (move a ship, unload a cargo for instance).

The question is:
How should I organize entities, ships for example, so it is easy to process them. Should I store them in a database? Perhaps there is some sort of a best practice for tasks like this?

If I assume, that ships will be stored in a database. Then, each player will send a file with orders to the server. The server will put everything into a database. When all the players have submitted their turns, the server will cycle through everything in the database and generate a turn. Will this be a good way to do this?

sentences:
How to "mark" a track/ road? I'm developing a simple racing game, using Unity.
I've created a road simply applying a texture (asphalt) to a terrain .
Is it possible (and how to do) to mark that roard with an invisible marker to identifiy that as a road (so i can make appears bonus, or others similar things) ?
Which is the approach used in a racing game to accomplish that task ?
Please, don't tell me "buy a Roads assets" because i want to understand the basics, the main concept.

Thanks

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:
Reading text files XNA 4.0 on Xbox 360 I'm working on porting a game from PC to Xbox 360.

When I want to create a level I read a .txt file that I store in my content
I read the whole file as a string using this method

File.ReadAllText(fi.FullName);

Where I'm passing in the full path to that file.

Later on in my code I parse that string to create whatever level I need.

When I try to deploy my game onto the Xbox I usually get an error stating

'System.IO.File' does not contain a definition for 'ReadAllText'

I was wondering if there was a simple way to read the text in a .txt file when I deploy onto the Xbox 360

sentences:
When is transform width in code not equal to the transform width in inspector? I've come across a strange case in Unity's UI where the width of a RectTransform isn't the same as what is being reported. I have a transform which is 50 by 50 with no scaling, it is a root object of the canvas yet when I use the information that I get from the transform in code to draw from the bottom left edge of the transform to the top right it doesn't reach all the way!

Gizmos.color = Color.red;
Vector2 pos = new Vector2(transform.position.x, transform.position.y);
Gizmos.DrawLine(pos - transform.sizeDelta, pos + transform.sizeDelta);

Vector3[] corners = new Vector3[4];
transform.GetWorldCorners(corners);

Gizmos.color = Color.magenta;
Gizmos.DrawLine(corners[3], corners[0]);
Gizmos.DrawLine(corners[0], corners[1]);
Gizmos.DrawLine(corners[1], corners[2]);
Gizmos.DrawLine(corners[2], corners[3]);

The first section should draw a line from the bottom left to the top right according to what the transform reports are the width and height however they don't reach across the entire transform. Using GetWorldCorners the actual corners can be found and drawn around, with that data you can extract that the actual width is 60 (150.2 - 30.2 = 120 / 2 = 60)!

Why? Is this a bug or an I missing something obvious here?

sentences:
Is game development Subcontracted? I was having a conversation with someone who believed that components of a games code where subcontracted out to programmers in different countries where it would be cheaper, then assembled by the local company.
I understand that people often use pre-built engines but I would think that making the actual game would require people to work closely in the same studio.

I couldn't find much clear information on this when I looked, does anyone know?

sentences:
What kind of data structure should I use for a resource container? I am curious what kind of container would be the best choice for a resource container.
BTree, binary search tree or something else?
What like is the priority of the operations over it?
So best inserting performance or best searching performance or between them?

Are there any open source implementation over the net?

sentences:
FPS Android game that moves the gun as user swipes the screen I am Making a First Person shooter game for android. Gun moves in all directions I swipe left right up or down. But the speed is so slow. How can i increase it's Speed.Here is my code.

void FixedUpdate ()
{
    foreach (Touch t in Input.touches)
        if (t.phase == TouchPhase.Began)
        {
            initialTouch = t;
        }
        else if (t.phase == TouchPhase.Moved && !hasSwiped)
        {
            float deltaX = initialTouch.position.x - t.position.x;
            float deltaY = initialTouch.position.y - t.position.y;
                //distance formula
            distance = Mathf.Sqrt((deltaX * deltaX) +(deltaY * deltaY));
            bool swipeSideways = Mathf.Abs (deltaX) > Mathf.Abs (deltaY);
            if (distance > 100f)
            {
                if (swipeSideways && deltaX > 0) {
                    this.transform.Rotate (new Vector3 (0, 30f, 0), rotationSpeed * Time.deltaTime);
                }

                else if (swipeSideways && deltaX <=0)// swipe right
                {
                    this.transform.Rotate (new Vector3 (0, 30f, 0), -rotationSpeed * Time.deltaTime);
                }

                hasSwiped = true;
            }

        }

        else if (t.phase == TouchPhase.Ended)
        {
            initialTouch = new Touch ();
            hasSwiped = false;
        }

}

sentences:
Is UDP still better than TCP for data-heavy realtime games? I know that UDP is usually recommended for real-time multiplayer games with high data usage.

Most articles are serval years old, and since ~80% of all data transmitted on the internet is TCP, a lot of optimization must have been done for TCP.

This make me wonder: is UDP still superior in terms of speed and latency?  Could recent TCP optimizations have made TCP perform better than UDP?

sentences:
Accept keyboard input when game is not in focus? I want to be able to control the game via keyboard while the game does not have focus... How can I do this in XNA?

EDIT: I bought a tablet. I want to write a separate app to overly the screen with controls that will send keyboard input to the game. Although, it's not sending the input DIRECT to the game, it's using the method discussed in this SO question:

https://stackoverflow.com/questions/6446085/emulate-held-down-key-on-keyboard

To my understanding, my test app is working the way it should be but the game is not responding to this input. I originally thought that Keyboard.GetState() would get the state regardless that the game is not in focus, but that doesn't appear to be the case.

sentences:
Rotating kinematic object around a moving point Box2D I'm new at Box2D and I am making a simple game where you control the rotation of the maze and the gravity leads the ball to the exit.

The game looks like:

The problem: I want to rotate the maze, and I'm doing it well. It is a kinematic object, so it will only move when I want. But it always rotate on a static pivot, I think that's it's center of mass. Rotating the maze, the ball hits the walls and when too further to the center, it becomes hard to control the movement of the ball by rotating the maze as the centrifugue force is too high for the ball.

What I want: I want to change the maze's rotation pivot to the ball's position, every game loop/frame, so it will rotate around the ball always and I will be able to use only gravity, not centrifuge forces, to lead the ball to the exit.

What I tried: I already tried to find a function to change the pivot center, or the center of mass, but I only found to change the mass proprieties. It changes the center of mass only if it was a dynamic body. Even the kinematic body having the same localCenter.x and localCenter.y proprieties as the dynamic body, it remains on (0.0 ,0.0) when trying to change it. And when changing the localCenter on the dynamic body, it doesn't rotate at this point anyway, so I'm not sure what to do.

Is there any possibility to change the center of the kinematic body all the time? I'm using Box2D Vestion 2.3.2, as you can see on the picture, and Visual Studio 2013 with OpenGL.

Thanks!

sentences:
how can i move static box2d object how can i move static box2d sprites. i have tried this tutorial from .
http://www.raywenderlich.com/475/how-to-create-a-simple-breakout-game-with-box2d-and-cocos2d-tutorial-part-12.

I managed to add another "paddle" object with box2d body, but i can seam to be able to make the code to move the second "paddle" body.
Can anyone direct me how to do it?

Is there a way to move a "b2_staticBody" box 2d object? i have tried, but i can only move it when i use "b2_dynamicBody" if i used "b2_staticBody" i can move it at all.

sentences:
MeshMemory causing constant spikes I have a ready-to-launch application, cleaning everything right now. I have these strange spikes on Mesh Memory.

The best part of it is that this view below is from a static menu screen, where there are no meshes. I don't even interact with it.

Can this be caused by meshes import options or something like that?

sentences:
What is the contents of the buffer *after* a call to glSwapBuffers()? (SDL_GL_SwapBuffers() in particular)

When you have drawn a scene, and you call swap-buffers, it is routine to then glClear() the scene before drawing anything; if you don't clear, what is the contents of the buffer?  Is this defined by any specification, or does it vary by driver?

sentences:
Alternative solutions to applying an overly large and detailed texture to a mesh I have a very large spherical mesh in my Unity scene (the earth), to which one very large texture is applied (a map of the earth). Now it just so happens that Unity's max texture size (8192 pixels I believe) is not enough to capture the details I need on this huge mesh.

What's the proper way to deal with this situation in Unity? That is, not only overriding the 8192 pixels limitations (although that would be nice as a temporary solution), but also making sure the overhead won't become unbearable...

Is there a way to dynamically stream higher quality sections of textures as the camera gets closer to that specific part of the mesh?

Additionally, I see the Granite add-on (http://graphinesoftware.com/products/granite-for-unity) seems to do just this (if I understood it well), but it's only for Windows, and I'm developing on a Mac. Is there any other adding out there?

sentences:
RPG game engine. Skill application calculations Short preface
I am a part of a small team which is entering game development. We're creating a new RPG setting with custom game system and mechanics based on dice rolls. I'm server-side java programmer, so the game engine is my responsibility.
The problem
I have a problem designing talent classes. Each character may have a set of talents. The problem is, most talents are unique and different from others. For example:
Talent Season fever gives character a stat bonus depending on the season of the year, e.g. strength +2 in Winter, dexterity +2 in Spring, etc. Which gives player an opportunity to add and swap talents because of changed stats four times a year.
Talent Fortune Wheel allows a player to roll d6 each morning and get a bonus on one of the six stats (strength, dexterity, etc.) for that day.
Talent Attuned to partner gives a player +2 on his hit roll if his character has exactly one partner in the battle. If his partner also has this talent, both of them get +4 instead.
As you see mechanics of each talent are different. Question is how to universally implement all this different functionalities in Java classes.
Some technical details
I use latest version of JDK 7.
Springframework stack (spring-data, spring-mvc, spring-security, etc.)
MongoDB for persistent storage.
My ideas
The solution I came up with:

Create a parent Talent class with generic fields and methods, like
id, name, description, requirements to obtain, etc. and an abstract apply() method.
For each talent in the game extend Talent class and add custom logic by implementing the apply() method.
I also need some trigger mechanism (I don't really know how it would look, so please advise if you have ideas). For example, if character has some talent which gives him bonus to a melee attack in some situations (preconditions) the trigger would fire on each event of melee attack made by the player, when the trigger fires it also checks if preconditions are met and if they are it calls the apply() method of a talent.
I have to implement scheduling for triggering or processing talents which depend on times or periods like the Season fever talent described above.

Disclaimer
I have really small experience of asking questions on stack-exchange, so feel free to point out suggestions on question format and additional info required. Also, English is not my native language, so feel free to correct me if something annoys you (grammar-nazi style)

sentences:
Blender to UDK 3 How to smooth Static Mesh I've created a bed cover model for my small game and here is how it looks like in blender:

http://imgur.com/T88Mnbs

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

http://imgur.com/OMXBno3

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

sentences:
XNA partially extending the content pipeline using a ModelContent I am trying to extend XNA's content pipeline in order to import a model in .obj format (a very simple and text-based format, see here for details). Writing a full extension library seems like an overkill to me so I decided I would only create a custom importer and a processor which returns a ModelContent so that I could use the default writer and reader.
My processor sort of works but not exacly as expected: what should look like an aircraft is actually a bunch of triangles stick together! Before writing this I had a simple class derived from DrawableGameComponent which loaded the model in its LoadContent, but that's not exacly XNA-ish. The point is that the code worked, so there must be a problem in the construction of the MeshContent.
I have followed the pattern I found in this question during my researches.

Here's the relevant part:

[ContentProcessor( DisplayName = "dotObjProcessor" )]
public class dotObjProcessor : ContentProcessor<dotObjContent, ModelContent> {
    public override ModelContent Process( dotObjContent input,
        ContentProcessorContext context ) {

        var mc = new MeshContent( );
        foreach ( dotObjContent.Vertex p in input.Vertices )
            mc.Positions.Add( new Vector3( p.X, p.Y, p.Z ) );

        var gc = new GeometryContent( );
        foreach ( dotObjContent.Face f in input.Faces ) {
            gc.Vertices.Add( f.V1 );
            gc.Vertices.Add( f.V2 );
            gc.Vertices.Add( f.V3 );

            gc.Indices.Add( f.V1 );
            gc.Indices.Add( f.V2 );
            gc.Indices.Add( f.V3 );
        }

        mc.Geometry.Add( gc );
        MeshHelper.CalculateNormals( mc, true );

        return context.Convert<MeshContent, ModelContent>( mc, "ModelProcessor" );
    }
}

A dotObjContent is the output of my importer, it simply contains two collections for vertices and indices.

sentences:
Joint constraints in PhysX I'm trying to use PhysX for my physics engine.  I'd like to use spherical joints, but I'm having trouble with the constraints.  All of the examples that I've found refer to SDK v2.8.  I'd like to stick with v3.0.  Even the PhysX support center uses deprecated APIs.  There's a tutorial at the support center (Ch 4 - Grass) that I'm trying to imitate.  Converting that code to the current API has been problematic.  NxSphericalJointDesc is deprecated.  How do you specify equivalent constraints to those found in the tutorial?

There's another post that talks about a similar problem.

sentences:
Lightning not hitting an object? I was following this tutorial, but the lightning is not hitting the other object as the video shows.

    private LineRenderer lRend;
private Vector3[] points = new Vector3[5];

private readonly int point_Begin = 0;
private readonly int point_Middle_Left = 1;
private readonly int point_Center = 2;
private readonly int point_Middle_Right = 3;
private readonly int point_End = 4;

public Transform line;

private readonly float randomPosOffset = 0.3f;
private readonly float randomWithOffsetMax = 2f;
private readonly float randomWithOffsetMin = 1f;

private readonly WaitForSeconds customFrame = new WaitForSeconds(0.05f);

void Start () {
    lRend = GetComponent<LineRenderer>();
    StartCoroutine(Beam());
}

private IEnumerator Beam()
{
    yield return customFrame;
    points[point_Begin] = transform.position;
    points[point_End] = line.position;
    CalculateMiddle();
    lRend.SetPositions(points);
    lRend.SetWidth(RandomWidthOffset(), RandomWidthOffset());
    StartCoroutine(Beam());
}

private float RandomWidthOffset()
{
    return Random.Range(randomWithOffsetMin, randomWithOffsetMax);
}

private void CalculateMiddle()
{
    Vector3 center = GetMiddleWithRandomness(transform.position, line.position);

    points[point_Center] = center;
    points[point_Middle_Left] = GetMiddleWithRandomness(transform.position, center);
    points[point_Middle_Right] = GetMiddleWithRandomness(center, line.position);
}

private Vector3 GetMiddleWithRandomness (Vector3 point1, Vector3 point2)
{
    float x = (point1.x + point2.x) / point_Center;
    float finalX = Random.Range(x - randomPosOffset, x + randomPosOffset);
    float y = (point1.y + point2.y) / point_Center;
    float finalY = Random.Range(y - randomPosOffset, y + randomPosOffset);

    return new Vector3(finalX, finalY, 0);
}
}

Everything is good except that the lightning is not hitting the other object. What am I missing?

sentences:
Text fields in a java canvas So I'm trying to have some form of input in my game and I understand all the keyPresses and whatnot but the only issue is I have no idea of adding a textfield to the game. JTextfield doesnt seem to appear so I started taking keypresses and adding them to a string but this proves to ether be too slow or too fast. Is there any way of adding a textfield to the game?

I'm using just plain java and swing.

Here is a code snippet:

JFrame frame = new JFrame("Game");
    //Sorts out JFrame variables and settings.
    frame.setLayout(null);
    setBounds(0,0,800,600);
    frame.add(this);
    frame.setSize(800,600);
    frame.setResizable(false);
    frame.addWindowListener(new WindowAdapter() {
        public void windowClosing(WindowEvent e) {
            gameRunning = false;
            System.exit(0);
        }
    });
    frame.addKeyListener(this);
    addKeyListener(this);
    addMouseListener(this);
    addMouseMotionListener(this);
    int columns = 25;
    TextField localTextField = new TextField("Text", columns);
    Insets insets = frame.getInsets();
    Dimension size = localTextField.getPreferredSize();
    localTextField.setBounds(25 + insets.left, 5 + insets.top,
                 size.width, size.height);
    frame.add(localTextField);
    frame.setVisible(true);
    //Double Buffer set up.
    createBufferStrategy(2);
    strategy = getBufferStrategy();

Ok, so I pressume the only way of doing this is the way in which I'm currently doing it.While the text box is open it adds all keypesses together with a slight delay between each key press. I just thought that there might have been an easy method of doing this.

sentences:
Unity Movement Questions I have recently been trying to learn how to make Unity games through Lynda.com using the tutorials provided by Jesse Freeman. But I have one issue, he doesn't explain any of the coding. This bit has me confused.

Body2D.AddForce (new Vector2 (forceX, forceY));

1.) Why is Body2D (this is a variable) separated by AddForce with a .?

2.) Why does a new vector2 have to be created?

3.) My last question isn't quite in the code itself but why must we add a () to methods?

(Full Code)

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

public class Player : MonoBehaviour {

public float Speed = 2.5f;
public Vector2 MaxVelocity = new Vector2 (5, 10);

private Rigidbody2D Body2D;
private SpriteRenderer Renderer2D;

// Use this for initialization
void Start () {
    Body2D = GetComponent<Rigidbody2D> ();
    Renderer2D = GetComponent<SpriteRenderer> ();

}

// Update is called once per frame
void Update () {
    var absValX = Mathf.Abs (Body2D.velocity.x);

    var forceX = 0f;
    var forceY = 0f;

    if (Input.GetKey("right")){
        if (absValX < MaxVelocity.x) {
            forceX = Speed;
        }
    } else if (Input.GetKey("left")) {
        if (absValX < MaxVelocity.x){
            forceX = -Speed;
        }
    }
    Body2D.AddForce (new Vector2 (forceX, forceY));

}

sentences:
Is Phong shading supposed to be so camera-angle dependent? I'm not sure if I have a bug in my code or not. It seems like it's a bug, or at least a major shortfall. Here's two images of the same model at slightly different angles (by moving the camera):

As we can see, the diffuse shading is wildly different from moving the camera just a bit. I would expect this effect from the specular, but not the diffuse (and removing the specular component has no noticeable affect on this shading).

The relevant part of the fragment shader (which removing will remove this issue, but also remove all diffuse shading) is:

clamp(dot(normal, lightDir), 0, 1)

Where normal is the normalized normal vector in camera space (found with (VP * M * vec4(vertexNormal_modelspace,0)).xyz) and lightDir is the normalized light direction vector, which is found with:

vec3 vertexPosition_cameraspace = (VP * M * vec4(vertexPosition_modelspace, 1)).xyz;
eyeDirection_cameraspace = vec3(0, 0, 0) - vertexPosition_cameraspace;

vec3 lightPosition_cameraspace = (VP * vec4(lightPos, 1)).xyz;
lightDirection_cameraspace = lightPosition_cameraspace + eyeDirection_cameraspace;

The above clamped dot product is multiplied by the diffuse color and light color. It seems to be exactly what the Wikipedia page describes (they don't clamp it, but describe the need for it in the text).

Most of the Phong shading code is directly or heavily drawn from this site.

Is the Phong model supposed to result in such camera angle dependent diffuse shading? If not, any ideas as to what might be wrong? If so, what alternatives are there that don't have this effect?

What I want to achieve is essentially the diffuse shading, but without it changing on camera angle, which seems very unrealistic to me. Instead, only the angle between the light source and the normal would matter (and these don't change when we move the camera).

This is homework.

sentences:
Rotation going wrong I'm calculating matrices by hand. Translations are fine:

 void Translate (float x, float y, float z, float[4][4] m) {
     Identity (m);
     m[3][0] = x;
     m[3][1] = y;
     m[3][2] = z;
 }

If I multiply a vector with this matrix, I get the correct transformation. My problem now is Rotations. I copied the definition from the OpenGL reference on glRotation, but I can't get it right. Can you spot my mistake?

void Rotate (float angle, float x, float y, float z, float[4][4] m) {
    float c = cos (angle);
    float s = sin (angle);
    m[0][0] = x*x*(1-c)+c;
    m[0][1] = y*x*(1-c)+z*s;
    m[0][2] = x*z*(1-c)-y*s;
    m[0][3] = 0;
    m[1][0] = x*y*(1-c)-z*s;
    m[1][1] = y*y*(1-c)+c;
    m[1][2] = y*z*(1-c)+x*s;
    m[1][3] = 0;
    m[2][0] = x*z*(1-c)+y*s;
    m[2][1] = y*z*(1-c)-x*s;
    m[2][2] = z*z*(1-c)+c;
    m[2][3] = 0;
    m[3][0] = 0;
    m[3][1] = 0;
    m[3][2] = 0;
    m[3][3] = 1;
}

I don't know what else is relevant, so, if you're kind enough to lend me a hand on this and if I just don't present enough info, just say it.

Thank you for taking the time to read this question.

EDIT
The trouble I'm having is the following: If I do Rotate (180,0,0,0), the vertexes are inverted as intended but the resulting triangle (in this case) is smaller.

Screenshot:

sentences:
Creating Sphere Triangles from Vertices I came across a way to create the vertices of a sphere, located here: https://gamedev.stackexchange.com/a/150293/62793
I converted this to the following C# example:
public static GraphicsMesh GenerateSphere(Device device, int numLatitudeLines, int numLongitudeLines, int radius)
        {
            // One vertex at every latitude-longitude intersection,
            // plus one for the north pole and one for the south.
            // One meridian serves as a UV seam, so we double the vertices there.
            int numVertices = (numLatitudeLines * (numLongitudeLines + 1)) + 2;

            Vector3[] positions = new Vector3[numVertices];
            Vector2[] texcoords = new Vector2[numVertices];

            // North pole.
            positions[0] = new Vector3(0, radius, 0);
            texcoords[0] = new Vector2(0, 1);

            // South pole.
            positions[numVertices - 1] = new Vector3(0, -radius, 0);
            texcoords[numVertices - 1] = new Vector2(0, 0);

            // +1.0f because there's a gap between the poles and the first parallel.
            float latitudeSpacing = 1.0f / (numLatitudeLines + 1.0f);
            float longitudeSpacing = 1.0f / numLongitudeLines;

            // start writing new vertices at position 1
            int v = 1;
            for (int latitude = 0; latitude < numLatitudeLines; latitude++)
            {
                for (int longitude = 0; longitude <= numLongitudeLines; longitude++)
                {

                    // Scale coordinates into the 0...1 texture coordinate range,
                    // with north at the top (y = 1).
                    texcoords[v] = new Vector2(
                                      longitude * longitudeSpacing,
                                      1.0f - ((latitude + 1) * latitudeSpacing)
                                   );

                    // Convert to spherical coordinates:
                    // theta is a longitude angle (around the equator) in radians.
                    // phi is a latitude angle (north or south of the equator).
                    float theta = (float)(texcoords[v].X * 2.0f * Math.PI);
                    float phi = (float)((texcoords[v].Y - 0.5f) * Math.PI);

                    // This determines the radius of the ring of this line of latitude.
                    // It's widest at the equator, and narrows as phi increases/decreases.
                    float c = (float)Math.Cos(phi);

                    // Usual formula for a vector in spherical coordinates.
                    // You can exchange x & z to wind the opposite way around the sphere.
                    positions[v] = new Vector3(
                        (float)(c * Math.Cos(theta)),
                        (float)Math.Sin(phi),
                        (float)(c * Math.Sin(theta))
                      ) * radius;

                    // Proceed to the next vertex.
                    v++;
                }
            }
            //Converting it to a Vertex
           Vertex[] vertices = new Vertex[positions.Length];
            for (int i = 0; i < positions.Length; i++)
            {
                vertices[i] = new Vertex(positions[i]);
            }
            return new GraphicsMesh(device, vertices);
        }

And it does indeed create all the vertices of a sphere; here's a picture:
My question now, is how do I take those vertices, and create triangles out of them? Or in other words, how do I link said vertices together to form triangle faces?

sentences:
Drawing roads on heightmaps I've been running into walls for the past week or so on my toy project in UE4. My goal is to draw procedural roads on a procedural landscape (eventually getting to intersections and buildings). The landscape is generated with libnoise and the roads are generated with a slightly modified version of the algorithm found here.

But I'm having issues draping the roads on the landscape and I can't find any straightforward algorithmic way of doing it. You can see my problem below: the geometry of the road intersects the geometry of the landscape.

In short, given:

The landscape index buffer
The landscape vertex buffer
Every road segment's X,Y,Z coordinate

How do I modify the underlying vertex/index buffer so that the landscape "wraps around" the roads?

sentences:
Target tracking with a small delay (actionscript 3.0) I'm having trouble thinking of a good method to track my character with an enemy attack. Of course, I don't want the attack to track my character's current position; I want it to track where the character was about 1 second before (so you can move around and make the attack miss and loop around you sort of a thing).

The general structure of my game uses a timer to update all of my events. I have a timer going off every 25 milliseconds that updates everything, including my player's position and the enemies position. Right now I just have the enemy attack directly targeting my character....which works fine except that it's impossible to escape =p.

Let me know if I didn't supply enough details. My approach was going to basically be get my character's position from about 1 second ago, then have the enemy target that position, the only problem is I can't think of a good way to get my character's position from previous times. Thanks for the help!

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:
Atmospheric scattering sky from space artifacts I am in the process of implementing atmospheric scattering of a planets from space. I have been using Sean O'Neil's shaders from http://http.developer.nvidia.com/GPUGems2/gpugems2_chapter16.html as a starting point.

I have pretty much the same problem related to fCameraAngle except with SkyFromSpace shader as opposed to GroundFromSpace shader as here:
http://www.gamedev.net/topic/621187-sean-oneils-atmospheric-scattering/

I get strange artifacts with sky from space shader when not using fCameraAngle = 1 in the inner loop. What is the cause of these artifacts? The artifacts disappear when fCameraAngle is limtied to 1. I also seem to lack the hue that is present in O'Neil's sandbox (http://sponeil.net/downloads.htm)

Camera position X=0, Y=0, Z=500. GroundFromSpace on the left, SkyFromSpace on the right.

Camera position X=500, Y=500, Z=500. GroundFromSpace on the left, SkyFromSpace on the right.

I've found that the camera angle seems to handled very differently depending the source:

In the original shaders the camera angle in SkyFromSpaceShader is calculated as:

float fCameraAngle = dot(v3Ray, v3SamplePoint) / fHeight;

Whereas in ground from space shader the camera angle is calculated as:

float fCameraAngle = dot(-v3Ray, v3Pos) / length(v3Pos);

However, various sources online tinker with negating the ray. Why is this?

Here is a C# Windows.Forms project that demonstrates the problem and that I've used to generate the images:
https://github.com/ollipekka/AtmosphericScatteringTest/

Update: I have found out from the ScatterCPU project found on O'Neil's site that the camera ray is negated when the camera is above the point being shaded so that the scattering is calculated from point to the camera.

Changing the ray direction indeed does remove artifacts, but introduces other problems as illustrated here:

Furthermore, in the ScatterCPU project, O'Neil guards against situations where optical depth for light is less than zero:

float fLightDepth = Scale(fLightAngle, fScaleDepth);

if (fLightDepth < float.Epsilon)
{
    continue;
}

As pointed out in the comments, along with these new artifacts this still leaves the question, what is wrong with the images where camera is positioned at 500, 500, 500? It feels like the halo is focused on completely wrong part of the planet. One would expect that the light would be closer to the spot where the sun should hits the planet, rather than where it changes from day to night.

The github project has been updated to reflect changes in this update.

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:
Game Development Resources? I want to make an iPhone game and I was wondering if somebody could point me to some resources. Before you rage and close this, I am not looking for just a tutorial on programming, I could just google that.

I need to find a tutorial on how to actually make a game, as in how to organize your code, what type of methods to run in separate threads, how to manage these threads in a game, etc. I already know everything I need; I can write a physics engine from scratch, I can write a 3D graphics pipeline from scratch, and so on. What I cannot figure out is how to combine all of this knowledge into correctly and efficiently making a game. Obviously for this one would probably go to college, but seeing as I am still in high school, that is not an option.

If anyone would know some tutorials or resources, any pointers would be appreciated.

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 can I improve or replace my programmer art? Say I'm a programmer who has done his own sprites or 3d models which would fall into programmer-ish kind of art. What steps can I take in order to improve or replace my own art?

sentences:
Get average tile color In my 2D game I have TileSet class that loads the texture and creates Rectangle[] array which stores each tile coordinates. Pretty basic stuff. Now I'd like to also calculate and store the average color of each tile. How do I do that in XNA/C#?

My goal is to tint the tile with the color based on its value when highlighted. Or maybe there is some other way to achieve similar effect?

sentences:
What approaches are there to re-designing 8/16-bit sprites for HD? I'm new to game development, and my skills with Photoshop are not that great.

I was planning to try to convert a old game to HD, but for this I need HD sprites. What is a good way to approach converting 8/16 bit sprites into something like HD? I mean something like this:

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:
SharpDX DirectInput Force feedback actuators are missing I am using a simple code to read input from a DirectInput device. I would like to add force feedback to the device, however when I run this test, I cannot find any ForceFeedbackActuator, however my device supports rumble effects.

public void Test(Joystick joystick)
{
    joystick.SetCooperativeLevel(new WindowInteropHelper(Application.Current.MainWindow).Handle, CooperativeLevel.Background | CooperativeLevel.Exclusive);
    joystick.Properties.AxisMode = DeviceAxisMode.Absolute;
    joystick.Properties.AutoCenter = false;
    joystick.Acquire();

    foreach (var deviceObjectInstance in joystick.GetObjects())
    {
        if (deviceObjectInstance.ObjectId.Flags.HasFlag(DeviceObjectTypeFlags.ForceFeedbackActuator))
        {
        }
    }
}

I checked the Microsoft specification but found nothing so far.

However my driver is null as well:

deviceInstance.ForceFeedbackDriverGuid

But this can be set from registry HKEY_LOCAL_MACHINE\System\CurrentControlSet\Control\MediaProperties\PrivateProperties\Joystick\OEM adding a new CLSID value for the current device.

Any help is appreciated.

sentences:
Get all images from peristent data path and save them to a Texture2D array So i managed to make a working script that downloads images from firebase in this situation and saves them to Application.persistentDataPath. Now what i would like help in doing is getting all those images "*jpg" and assigning them to a Texture2D array for later use.
So far i have mananged to open one of those images by name and assign it to a single texture.
    public Texture2D image;

 private void Awake()
    {
        string dirname = "levelNature";
        string path = Application.persistentDataPath + "/" + dirname + "/" + "nameofImage.jpg";

        LoadSprite(fileName);

    }

    private void LoadSprite(string path)
    {
        if (string.IsNullOrEmpty(path))
            Debug.Log("null or empty");

        if (File.Exists(path))
        {
            byte[] bytes = File.ReadAllBytes(path);
            Texture2D texture = new Texture2D(1024, 1024, TextureFormat.RGB24, false);
            texture.LoadImage(bytes);
            image = texture;
            Debug.Log("success");
        }
    }

With just one image i can assign it to a texture but since later on in the gameplay i'm using a texture2d array to assign those images to the gameplay , which now are set through the inspector , i would like to load all images in a particular folder to a Texture2D array which later on i will be using to show each image index in a specific level.
I did try it out like this but it isn't successful.
    public Texture2D[] source;

        var fileNames = Directory.GetFiles(Application.persistentDataPath + "/" + dirname + "/" + "*.jpg");

        source = new Texture2D[fileNames.Length];
        int index = 0;
        foreach (var fileName in fileNames)
        {
            source[index] = LoadSprite(fileName); // i get the error here that it cant convert void to texture2D
            index++;
        }

Hopefully once all images are loaded i could see in that array in the inspector all the images and then use that for the rest of the game. Thank you!

sentences:
How to detect which car T-boned the other in a collision? Setup
The game has cars and collisions, and I'm trying to create the following system:

When a car T-bones another, the one getting T-boned is destroyed;
When the cars collide laterally (usually just bump into each other), a normal physics collision happens (and nothing is destroyed);
When the cars collide head-on, the lighter one is destroyed.

The cars are all instantiated from 1 prefab. This can't be changed.
Car Setup
The main body sans the bumper has a normal, non-trigger collider and the dynamic Rigidbody. It has the tag "Destructible".
A child object (which also houses the bumper model, but that shouldn't matter) has a normal, non-trigger collider for the bumper. It has no Rigidbody and reports to the parent's Rigidbody. It has the tag "Destroyer".
Attempted Solutions
1) The transform.forward solution
Get the transform.forwards of both cars and compute their dot product.

If the 2 vectors are opposite each other (or close to it), destroy the lighter car.
If the vectors are facing away from each other (or are close to parallel), let a normal collision happen.
If the vectors are perpendicular (or somewhere in that ballpark)... then I'm lost. How do I know which car T-boned which?

That brings us to the solution #2.
2) The 'multiple colliders' solution
Assign another collider to the bumper of the car and give it a separate tag (e.g. "Destroyer). As a consequence, give the other — main — collider a tag, too (e.g. "Destructible").

If a Destroyer collider hits a Destructible, the latter is destroyed.
If a Destructible hits a Destructible, a normal physics collision happens.
If a Destroyer hits a Destroyer, destroy the lighter one.

But here, I run into an issue.

You can't have multiple colliders on the same game object. Ergo, create an empty child and attach it there. I won't set it to Trigger, or otherwise it won't detect collisions with another of its type (i.e. Destroyer).
In order to destroy colliding objects, I need a script and an OnCollisionEnter() inside it.
OnCollisionEnter() won't run if neither of the game objects has a non-kinematic Rigidbody. This means I need to give the bumper colliders a non-kinematic Rigidbody.
But if I give them dynamic Rigidbodies, they'll just... float away from the car.

In other words, I need a way to create a 2nd collider but keep it firmly attached to the car. Furthermore, if the main collider covers it, then I need to exempt it from collisions with the 2nd collider (let's call it the sub-collider), and I can't use layers to do that or otherwise the sub-collider won't detect main colliders on other cars.
If I don't cover it, then I need the sub-collider to act as a normal physics collider, too, when it hits, for example, a wall, and not have the bumper sink into it. That means it needs a non-kinematic Rigidbody.
How can I solve this issue?

sentences:
Precalculate the position of a rotating Aircraft To start honestly, this question is probably mostly handling math. But thats only the road I tried to go and failed miserably, so maybe theres a much more simple way to do.

Ok the game situation is pretty simple: A 3D space game with nearly no constraints. I don't care about physics in this game, besides from collision.

There is an aircraft (or actually more of them) that gets moved forward every frame according to it's speed and the delta time.  The movement of the aircraft occurs according to its own z-Axis. Before the translation the aircraft gets rotated, too. First around it's y-Axis and then around it's x-Axis. The result is a simply controllable aircraft.

Here some code for you:

void Update()
{
  //Rotate left/right
  float h = HORZ_SPEED * paramX * Time.deltaTime; //HORZ_SPEED is a fixed property of the aircraft, paramX an input value
  Quaternion deltaRotation = Quaternion.Euler(Vector3.up*h);,
  rigidbody.MoveRotation(rigidbody.rotation * deltaRotation);

  //Vertical rotation
  float v = VERT_SPEED * (-1.0f) * paramY * Time.deltaTime;
  deltaRotation = Quaternion.Euler(v,0,0);
  rigidbody.MoveRotation(rigidbody.rotation * deltaRotation);

  //Translation
  rigidbody.velocity = this.speed * transform.TransformDirection(Vector3.forward);
}

I simplified it a bit, but it's not really much more to that. The problem now is:
I want to predict this movement.

For different AI issues like collision avoidance and pattern recognition, I would like to calculate with constant parameters v and h and speed, where my aircraft would be at a point in time X seconds in the future.

What I tried is calculating it the hard way, starting with a start position of object axes, speed and rotation per second and constructing transformations and positions for a few frames progress, hoping it would collapse to a simple pattern. But I didn't find it.

If got the strong feeling that this kind of movement should form a simple pattern like a circle (ok, not soo simple) or an ellipse that I can calculate through a few variables. But I can't seem to make my mind up what that pattern should be and how I can calculate it's characteristics out of the data I have.

EDIT: What I managed to calculate is the transformation the local unit vectors take each frame:
e_z -> e_y * sin(a_y) + [e_z * cos(a_x) + e_x * sin(a_x)]*cos(a_y)
e_x -> e_x * cos(a_x) - e_z * sin(a_x)
e_y -> e_y * cos(a_y) - [e_z * cos(a_x) + e_x * sin(a_x)]*sin(a_y)

On the right all unit vectors are used in their state of the last frame.
a_x and a_y are the rotation parameters for the x resp. y axis:
a_x = VERT_SPEED * paramY
a_y = HORZ_SPEED * paramX

sentences:
Tiled map seen from an angle I have working code to display a tiled map. It's composed of a OrthogonalTiledMapRenderer and an OrthoGraphicCamera :

camera.setToOrtho(false, WORLD_WINDOW_SIZE.x,
            WORLD_WINDOW_SIZE.y);

renderer = new OrthogonalTiledMapRenderer(tiledmap, 1 / TILE_WIDTH);

renderer.setView(camera);

So far so good. The map is rendered as seen from above:

My question is, how do I render it with the camera not facing right down to the floor?

Like this:

[Thanks to all GIMP developers :) ]

Is it possible? I tried Camera.rotate(45) but it rotates in the wrong axis. I can't set Camera.direction because of this  - taken from OrthogonalTiledMapRenderer.setView(camera) documentation :

  Sets the projection matrix and viewbounds from the given camera. If
  the camera changes, you have to call this method again. The viewbounds
     are taken from the camera's position and viewport size as well as
  the    scale. This method will only work if the camera's direction
  vector     is (0,0,-1) and its up vector is (0, 1, 0), which are the
  defaults.

If I change the camera direction, the renders are weird or non-existant.

Is it possible to do so with the standard LibGDX api? If not, how can I do this? If not are there any workarounds to get the same effect?

sentences: 1 kb swf file created when building to flash in unity I am trying to build a project in flash that I have made. It goes through its building process, but when it is done the swf file that it creates is 1 kb in size. I am not sure what I am doing wrong or what is going on. I have built to flash before and never ran into this problem until recently.

sentences:
Replacing client side vertex arrays with glBufferData I need to replace client side vertex arrays in order to upgrade to a new version of OpenGL but I'm not sure what the best way to buffer data is now.

What I have is a 2D sprite engine which is using batching to push as many vertices to the GPU (using fixed pipeline functions glVertexPointer etc...) but frequently the batch is only a single quad. Because of how sorting works the buffer needs to be updated every frame (or more).

I need to use glBufferData/glVertexAttribPointer now so what is the best way to handle this case? I can allocate the buffer for glBufferData large enough to hold the maximum size of a batch (which is more than maybe 5000 vertices) so should I just push the old vertex array to glBufferData every frame or use another method? Maybe calling glVertexPointer/glBufferData has the same costs associated with them to copy memory to the GPU so I don't need to worry about it but I'd like to know since I'm still pretty new to OpenGL.

CONCLUSION:

In my simple tests I found calling glBufferData every frame with all vertices (OpenGL 4.1) actually slightly faster than client side vertex arrays (OpenGL 2.1).

Thanks.

sentences:
Low-level game engine renderer design I'm piecing together the beginnings of an extremely basic engine which will let me draw arbitrary objects (SceneObject). I've got to the point where I'm creating a few sensible sounding classes, but as this is my first outing into game engines, I've got the feeling I'm overlooking things. I'm familiar with compartmentalising larger portions of the code so that individual sub-systems don't overly interact with each other, but I'm thinking more of the low-level stuff, starting from vertices working up.

So if I have a Vertex class, I can combine a list of those with a list of indices to make a Mesh class. How does the engine determine identical meshes for objects? Or is that left to the level designer? Once we have a Mesh, that can be contained in the SceneObject class. And a list of SceneObject can be placed into the Scene to be drawn.

Right now I'm only using OpenGL, but I'm aware that I don't want to be tying OpenGL calls right in to base classes (such as updating the vertices in the Mesh, I don't want to be calling glBufferData etc).

Are there any good resources that discuss these issues? Are there any "common" heirachies which should be used?

sentences:
How can I rig an object to animate from two different orientations? As an example: Say you're animating a skateboard. The board has a nose and a tail. Normally, the nose points forward and the tail points backward. Now say you have two animations: idle and trick. The idle is animated with the nose pointing forward. The trick, however involves the board rotating 180°, ending with the nose pointing backward, functionally swapping the nose and tail. Now, if you were to blend the trick animation back into idle, the blend would rotate the board back around so the nose points forward, which would not be the intended behavior. The intended behavior would be for the animator to somehow know that the tail is now the forward facing orientation and animate as if the tail were the nose.

I'm competent but no expert with rigging/animation and I've been racking my brain trying to come up with either a way to cleverly rig the object to somehow work as intended or to be able to modify the animations procedurally in code or something, but I haven't been able to figure it out.

This seems like a problem that must come up somewhat frequently with game animation, but I haven't been able to find any specific resources.

I'm using Blender and Unity.

Edit: To be clear, I'm not talking about root motion or the animating object's position/rotation in the world, just the orientation of the bones being animated.

sentences:
self extending factory: return type and serialization I'm trying to implement a better management for the objects in my game project.
With input from another thread here on S.O., I decided to implement different collections for different types for better access. Seems to be a common way. So far I #included all the class files and added containers (just maps right now) for each type I needed/wanted, as well as functions to create/add/remove etc., that take care of what is needed. That way no free objects exist (object's constructors are private) that could be missed somewhere.
But ofc that means for every new type the container/manager/factory needs to be modified and that's error prone. So I wanted to try and make it self extending with a registration like this:
template<typename ObjectType>
class Registration
{
    public:
        Registration(const std::string& typeID)
        {
            EntMan::getInstance()->registerTypeCreator(typeID, [] (Properties* props)->Entity* {return new ObjectType(props); } );
        }
};

saving it in a std::map<std::string, std::function<Entity*(Properties* props)> >. This works, ofc it's a common pattern, but has especially one flaw: the return type.
I could add as much additional containers, defined by tags for example, as I want (shurely helps with iteration/preselection), but the contained items would always be just base class pointers.
So if I get an item I still would need to dynamic_cast (or static_cast with if(object->getType == "someThing") ) it to the derived type to get full derived access to the object. Seems wasteful and error prone.
Integrating all functionality with virtual functions would solve this, but in the end turns the base in a kind of blob class. Doesn't feel right either.
Let alone the fact that it would also be also pretty horrible for data locality. Not my main concern right now, but maybe will be in the future.
I'm a bit uneasy with the Properties "parameter amalgamation"-workaround aswell, to fullfill the std::function criteria of having the same signature, as it's a bit error prone doing it "by hand" for example, but should be less of a problem once it's abstracted away with parsing those as prefabs from files and
accessing those. Still, it also would mean a lot of wasted space to save those as prefabs...
So I'm at my wits end here.
How could I go on from here, if I need...

different collections for different types (for preselection)
acessors delivering the proper derived types (for avoiding casts and blobs)
self extending, no modification needed just for adding types
serializable use (ie: create("stone") for use with parsing functions of xml data etc. )

Can this be done? Or is this a dead end? No good idea at all?
Thanks in advance for any help.

sentences:
SDL Combining text and Geometry Rendering to one texture Basically I'm trying to end up with a Texture class that can take in text and have it be drawn over simple geometry (such as a letter 'A' over a filled rectangle). However I'm running into issues when thinking about how to combine these two concepts.

First, following lazy foo's tutorials, Geometry rendering is simple and is done with an

SDL_RECT and SDL_RenderFillRect(SDL_Renderer*, &SDL_Rect);

However, when rendering text it uses Surfaces and Textures in order to 'draw' the text. Specifically these lines:

SDL_Surface* textSurface = TTF_RenderText_Solid( gFont, textureText.c_str(), textColor );
mTexture = SDL_CreateTextureFromSurface( SDL_Renderer*, textSurface );

My confusing comes from trying to figure out several things:

a) Is it possible to maybe first Render the Geometry to a texture, and then render the text over that same texture?

b) I believe a call to  SDL_SetRenderTarget is going to be necessary, but I'm not sure where and when during my combination stage this would need to be done.

c) Right before posting this question, I saw further down on the tutorials this link which describes rendering geometry to a texture, however I'm still not sure how to combine Text with this.

Any help is appreciated, Thanks

sentences:
Xna model parts are overlying others I am trying to import in XNA an .fbx model exported with blender.

Here is my drawing code

public void Draw()
{
    Matrix[] modelTransforms = new Matrix[Model.Bones.Count];
    Model.CopyAbsoluteBoneTransformsTo(modelTransforms);

    foreach (ModelMesh mesh in Model.Meshes)
    {
        foreach (BasicEffect be in mesh.Effects)
        {
            be.EnableDefaultLighting();
            be.World = modelTransforms[mesh.ParentBone.Index] * GameCamera.World * Translation;
            be.View = GameCamera.View;
            be.Projection = GameCamera.Projection;
        }
        mesh.Draw();
    }
}

The problem is that when I start the game some model parts are overlying others instead of being behind. I've tried to download other models from internet but they have the same problem.

sentences:
How to manage state in a component-based game engine? I'm working on a small, data-driven game engine with some friends.

We use GameObjects (a.k.a. Entities, Actors, or whatever it is called in your favorite engine) to represent every entity in the game. These GameObjects owns Components, who communicates via message passing. This is a very well-known pattern, and although implementations differ greatly, it seems to be what every commercial, modern game engine is doing.

Now we have one problem: managing state. Let's say we are creating some kind of platform game. The hero of this game should be able to stand still, jump, attack...

We created some Finite State Machines to hold the player's state. Now the state should, in turn, be consumed by the other components. Running should trigger an animation and modify the player's velocity, attacking should stop the player and spawn a bullet...

But this creates a lot of dependencies. The Sprite component now has to be aware of the State component, and listen to state changes. The Movable component should listen to state changes too, to be able to change the player's speed. Nearly every component depends on the State component. This sounds like a dependency hell.

I think it's a very common problem, but I can't find a good solution for it. Are there some design patterns for situations like this?

sentences:
How to set LinearVelocity exactly in onSceneTouchEvent? I'm beginner in Android programming.
And i use AndEngine GLS2 with Body and AnimatedSprite.

I have a object ball and i want to move it to follow my hand. This is description for my idea:

And my code:

@Override
public boolean onSceneTouchEvent(final Scene pScene,
            final TouchEvent pSceneTouchEvent) {
     ballObject.getBodyball().setLinearVelocity(
                    new Vector2(pX, pY));
}

How to get exactly variables:pX, pY ?

sentences:
how to dent & deform damaged objects in unreal engine? I am trying to simulate damages in cars using unreal engine when a body collides with it like it is done in this video - https://vimeo.com/162729920

I am trying to do it in the first person shooter game template, so that i can shoot projectiles at the object. but the object just moves and doesn't dent. I tried creating a destructible mesh but that cause the object to break down into pieces. I want it to dent when i apply a force to it. Could someone point me in the right direction?

sentences:
LibGDX - Image width is not set to resetting to zero when full width I am making a progress bar for showing the players current experience. However I have come around to a bug, which appears when the player is maxing out his experience and then is getting a new level. In the ideal world my code should reset the progress bar image width (which is a Scene2D image btw), but for some reason it is not setting the image width to zero, but is setting it to its full width instead, which I can't seem to understand why. I hope anyone can help me.

I have provided my code below, and also uploaded a video on youtube with my bug - Video of the bug

The method below is the one I use to change the experience progress bar width as well as the experience.

public void changeLevelExperience(int gainedExperience) {
    float maxExpDividedInPixels = 131f / this.GAME.gameScreen.getGameManager().maxExperience;

    this.GAME.gameScreen.getGameManager().currentExperience += gainedExperience;

    if (this.GAME.gameScreen.getGameManager().currentExperience >= this.GAME.gameScreen.getGameManager().maxExperience) {
        this.GAME.gameScreen.getGameManager().currentLevel++;
        this.currentLevelLabel.setText(this.GAME.gameScreen.getGameManager().currentLevel + "");
        //TODO: Another arrangement for the experience needs to be made.
        this.GAME.gameScreen.getGameManager().maxExperience += 35;
        this.GAME.gameScreen.getGameManager().currentExperience = 0;
        Gdx.app.debug(TAG, this.GAME.gameScreen.getGameManager().currentExperience + "");
    }

    this.levelProgressBar.setWidth((int) (maxExpDividedInPixels * this.GAME.gameScreen.getGameManager().currentExperience * this.scaleFactor));
}

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:
Saving/reading the game data on a disk I'm implementing a simple 2D maze-like game. I'd also like to implement a map editor to easily create the game maps/levels for me and allow users/players to create it's own levels as well. The thing I'm just thinking about now is how to save the game entities/object in files on the hd. I'm thinking about the JSON data format, for e.g. having the list of the game objects like that:
[
   {
      "object_id":1,
      "pos_x":200,
      "pos_y":100,
      "obj_type":"brick"
   },
   {
      "object_id":2,
      "pos_x":100,
      "pos_y":300,
      "obj_type":"enemy",
   }
]

My question is is it a good idea to use the JSON to store the game level info in a game-map file?
My environment: Win 10, Microsoft Visual Studio Community 2019

sentences:
Is there a good comprehensive walk-through of deriving the math for 3D model rendering that starts from scratch? I'd like to fully understand the math of rendering a 3D model in a 2D perspective.

I always find tutorials that are in terms of the APIs used to do the math for you, and not the math itself.

I'd like to understand it from the standpoint of geometry as opposed to linear algebra if possible.  What I mean is, I'd like to be able to visualize what the matricies stand for in the 3D model and/or 2D image which is the result of rendering.

Is there a definitive source or sources I can consult for this?

sentences: Fight with creativity burnout I have big creativity burnout :/ Do you have any ideas how can I fight with it ??

sentences: Add object to a Terrain? It's possible to add object made by blender to unity terrain ? this object will become a part of it. I can add grass and trees on it.

sentences:
bmGlyph alternative for windows (Bitmap font generator) I have been using this tool (bmGlyph http://www.bmglyph.com/) to create fonts from apple machines, but now, I'm on windows and need a program with same / more features. The main features about this program is the possibility of give a grandient color and apply a texture to each glyph. Could anybody recommend something like this for windows?

Thanks in advance.

sentences:
Ideas for refactoring regarding simple state management in entities and level I'm actually developing a very simple 3D game, Arkanoid/Breakout style, with very simple mechanics, and it's progressing while I learn the game dev domain own concepts and techniques (My background is C/C++ middleware/low-level systems programmer).

I've advanced to a functional game loop, input, movement, collision checks, all it's working, but I reached to a day where the code was a mess, e.g: my Level class was doing too much. So I partitioned, OOP style, the code in several classes.

My intention is to get ideas from more experienced programmers regarding how Game state and substates relate with entities. My general picture is:

A game object which contains the main loop
A level object which contains a World instance with a list of all entities.
A renderer class which does Direct2D and Direct3D rendering.

Prior to the major refactoring, I was doing something like

Level::Update(float clockMs)  {
  switch (m_state)
    case (LevelState::Preloading) { ... }
    case (LevelState::Load) { ...}
    case (LevelState::Playing) {
        UpdateBallPosition ( ... )
        CheckCollisions( ...)
    }

}

Level contained references to ball, game bricks, etc. Now  I create the entities in the Level startup and add them to the World instance. (World is a member of Level).

Now I want to move all state-related code to the entities themselves. Suppose "Ball", it shouldn't do anything until Level is in LevelState::Playing. Where do you store typically state for the current Level (suppose a closed-level game)? It's correct to store entities with a pointer to the World and the World to mantain a pointer to the Level containing it? It's a tightly coupled architecture but I want to discuss how to relate world/level states with entities, and how the entities acknowledge in which higher-level states they are.

Keep in mind that I accept good procedural or data-driven approaches. I'm not an OOP fanatic, I think good designs can be built upon several paradigms. Thanks.

sentences:
Using same buffer for vertex and index data? Is it possible to use the same buffer for both GL_ARRAY_BUFFER and GL_ELEMENT_ARRAY_BUFFER?

I load both vertex data and index data into a big slab of memory, so it would be easier for me to just load it all into a single buffer. So naturally, I do like this

glBindBuffer(GL_ARRAY_BUFFER, vboId);
glBufferData(GL_ARRAY_BUFFER, dataSize, data, usage);
glBindBuffer(GL_ARRAY_BUFFER, 0);

Is it legal to – during rendering – simply use it as both?

glBindBuffer(GL_ARRAY_BUFFER, vboId);
glBindBuffer(GL_ELEMENT_ARRAY_BUFFER, vboId);
glVertexAttribPointer(...);
...
glDrawElements(mode, count, dataType, (void*)indexOffset);

I can't find anything in the spec saying it's ok to do so, but I can't find anything that says that I can't either. Googling doesn't turn up much either, but I might be looking in the wrong places.

sentences:
Unity. Input in function for UI button OnClick I am trying to create multiple selections for some items on my UI. To perform multiple selections of items I want a user to hold left control button. But then I add

if (Input.GetKeyDown(KeyCode.LeftControl)){
/* Logic */
}

It registers in debugger what LeftControl is pressed but it skips all logic in brackets. This function is public and created for UI button.
Is Input and Button.OnClick compatible at all?

sentences:
matrix to rotate a vector to a known arbitrary axis Let's say I have a vector V (v.x,v.y,v.z) which is normalized and points somewhere in 3d space.  And that I have another vector Z of (0,0,1).  Knowing only these two things I'm looking for a transformation matrix that will take the vector Z and turn it in to V.

Or some other way to get to the vector V from the vector Z.

In my application for this I'll be taking other vectors that are in a Z axis space and putting them in (or rotating them to) the same space as the V vector.  But a proof that it's working will be to take Z and make it V.

I know that if I had this matrix I could multiply the vec3 by the matrix and get the answer.  But making this matrix from only that destination vector is what I'm not sure how to do.

Seems like it might be super simple and that I'm just not thinking of it correctly.  Answer right in front of my face?

sentences:
Mesh fading to transparent I have a 2D Mesh object generated at runtime painted all with uniform color.
I want that mesh to have its color fade to transparent color close to the edges.

Despite I searched everywhere I could not find any solution. Unfortunately I'm not into Shader programming enough to build logically my solution.

EDIT:According to @wondra's reply my mesh is not fan shaped. It has a non regular hole in it.

How can I achieve this?

sentences:
How do I make my character jump on a platform? This is the code I've written so far:

Html:

Land

    <button id="howtobutton">Instructions</button>
    <button id="hsbutton">High Score</button>
    <button id="optionsbutton">Options</button>
    <button id="playbutton">Play Game</button>

How to Play

      <button class="backtomenu">Back to Menu</button>

High Scores

    (Username), your high score is:
    <button class="backtomenu">Back to Menu</button>

Options

    <button class="backtomenu">Back to Menu</button>

 Score:

      <button id="btn-quit" class="backtomenu">Back</button>

CSS:

div {
  border: 1px solid black;
} h2 {
  text-align: center;
} button {
  display: block;
  width: 100px;
  margin: 10px auto;
} #stage {
  width: 400px;
  height: 400px;
  overflow: hidden;
  position: relative;
  background-image: url(http://www.hlgjyl888.com/data/wallpapers/151/WDF_1917288.gif);
  background-size: cover;
} #splash {
  display: block;
} .screen {
  position: relative;
  display: none;
  width: 100%;
  height: 100%;
  color: white;
} #player {
  width: 30px;
  height: 30px;
  border-radius: 50%;
  position: absolute;
  background-color: blue;
  bottom: 50px;
  top: 269px;
  left: 100px;
}
} #score {
  position: relative;
  top: 0px;
  right: 5px;
  width: 100px;
} #btn-quit {
  position: absolute;
  margin: 0;
  bottom: 0px;
  left: 0px;
} .platform {
  position: absolute;
  background-color: white;
} .onPlatform {
  background-color: blue;
}
#ground {
  top: 300px;
  width: 400px;
  height: 3px;
}

JavaScript:

var gravity = 1;
var maxheight;
var timer;
var jump = 32;
var velocity = 0;
var jumppressed = false;
// var username = prompt("What is your name?")

$(document).ready(function() {

  $('#howtobutton').click(function() {
    showScreen('#instructions');
  });
  $('#hsbutton').click(function() {
    showScreen('#highscores')
  });
  $('#playbutton').click(function() {
    showScreen('#game')
  });
  $('#optionsbutton').click(function() {
    showScreen('#options')
  });
  $('.backtomenu').click(function() {
    showScreen('#splash')
  });

maxheight = Math.round($("#stage").height() - $("#player").height());

timer = setInterval(update, 1000/60);

   $(document).keypress(function(e) {
    console.log(e.which);
    if (e.which === 32) {
      console.log("it works");
      jump();
    }});
});

function showScreen(screen) {
$('.screen').hide();
$(screen).show();
};

function jump() {
  if ($("#player").position().top >= maxheight) {
    console.log("Jump is working")
    velocity = -15;
  }
};

function update() {
  if (velocity === 0 && $("#player").position().top === maxheight) {
  } else if (velocity > 0 && $("#player").position().top >= maxheight) {
    console.log(maxheight + " through ground" + $("#player").position().top);
    $("#player").css("top", maxheight + "px");
    velocity = 0;
  } else {
    velocity += gravity;
    var newPos = $("#player").position().top + velocity + "px";
    $("#player").css("top", newPos);
  }
};

However I'm very new to game development, I've been stumped for a while now, I can't figure out a way to control my character movement. Can anyone tell me what's wrong with my code? My character should be jumping on the platform whenever the space key is pressed (that's it).

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:
GameMaker - Sprite will not stop moving backwards I am very new to game development, and I am using GameMaker Studio as my first engine. I was following along with a tutorial to create an Asteroids-like game from scratch, but right now I am trying to create my own coding. There are small problems, but I believe it may just be my coding. The coding language is GML, its proprietary language.

The first problem is that I cannot get my sprite to stop moving backwards:

motion_add(image_angle,-0.2);
if (speed < 0) speed = 0;

It seems okay, since I am trying to force the sprite to have a motion of zero if the speed starts going negative.

Another thing is that I cannot seem to get the bullets to fire from my ship. The code is under the event "Press <Space>":

bullet = instance_create(x,y,obj_bullet);
bullet.speed = 15;
bullet.direction = image_angle;

The bullet literally just doesn't appear, at all. I know it isn't invisible because firing at an asteroid will not destroy the asteroid.

Thanks for the help everyone!

sentences:
iOS 8 iPad Mini Orientation thinks It should be landscape despite it being disabled I've only enabled portrait mode in the info.plist and generally the iPad Mini running my game works fine except if I quickly change its physical orientation from landscape to portrait, the app reorients itself incorrectly like what happened to this person: http://answers.unity3d.com/storage/temp/33155-screen+shot+2014-10-01+at+8.25.25+am.png (see screenshots, but the repro is different in my case).

I've tried hard setting the orientation (Screen.orientation = portrait, etc, etc) but looks like it's just ignored..

sentences:
How much is java used in 2d/3d indie games? (before/after Minecraft) I wonder for my own use and curiosity, how popular is Java in indie game development ,
in 2d and 3d? Are there any good open/closed source games done in java?

sentences:
Unicode Usage in Video Games When programming Windows games, do you use multibyte character settings or Unicode character settings?  I'm under the impression that professional companies today use the Unicode setting to make future localization and translations as easy as possible.  Is using wchar's a good practice for modern games?

While I'm thinking about the subject, what is the difference between multibyte character sets and Unicode sets in Windows?  Is it UTF-8 vs. UTF-16?

sentences:
Optimize DOM game performance I am working on a game developed on DOM using Crafty JS framework, and Greensock GSAP JS (http://www.greensock.com/gsap-js/) for animations. It is my first time working with these technologies.

I have a problem with FPS going down to 15 and less while animations are performed on bigger DOM elements. After investigating the issue with Chrome Developer Tools Timeline I discovered that 80% of bottleneck events time are:

Image Resize(non-cached)

I assume it is caused by the fact that I am using

CSS Transform scale()

for the game to adjust to browser size. Performance is acceptable once the scaling is disabled.

Is there any way to cache the resized images in browser to improve performance? The game will only be used on a local computer.

Any help and advice will be greatly appreciated.

sentences:
Orthographic Camera settings for a 2D game I'm starting out a 2D wrestling game in Unity 5 and i need some help. The default resolution of game needs to be 320x240. The background sprite that i would be using is 640x480. The camera would move over the background to give it a hovering look. I want the Camera to cover exactly 320x240 resolution. I tried setting the Camera size to 1.2 and it looks approximate but i wanna be sure that the camera is exactly 320x240. By default all the images are set to 100 Pixels per Unit.

So my question is:

How to set the camera to cover exactly 320x240

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:
Can I start implementing Game Center in my iPhone app, without having created a new app in iTunes connect? I'm in the process of developing a game for the iPhone and I want to add Game Center support to it. The problem, as I see it, is that I need to have named my app, created an icon and uploaded screenshots etc. before I can create a leaderboard and start implementation?

My game is unfinished and the iTunes Connect developer guide seems to indicate that certain information can't be edited once entered. Can anyone point me in the right direction on this one?

Thanks.

sentences:
Creating an illusion of stress and danger I'm currently experimenting with an adventure game setting where at some point the game is quite calm and the player has to solve puzzles and at some point there are enemies or environmental traps.

I don't want to have any surprising danger events coming out of nowhere that would scare the player, so I would like to build up the players' tension before a section of the game starts which will contain multiple "player-killing" obstacles (may they be enemies, or the ground falling apart..).

My sound artist made some really good music and sound effects to slowly build up the tension, but game elements during this phase are missing. It's like the player is running from a puzzle-zone to danger-zone through a boring plain section.

Beside sound, what are some generic ways to build up the players' tension? Can i aid with special Visuals, or do i have to improve the story or possibly invent some pre-danger-zone easy obstacles?

sentences: What are some good resources for building a voxel engine? What are some good resources (tutorials, code, papers, etc.) for learning about voxel rendering?

sentences:
Is it ok to use polymorphism as a way of "interfacing" with objects in a scene? I'm designing a class that holds values representing a 3D scene. This includes lights, cameras, meshes, materials, etc.

The way how I'm setting it up is that each "thing" has a name. A camera has a name, a light has a name, etc. But they also have an "interface" to access the object via pointer instead of having to name it each time something needs to be changed.

For example:

Light *light = scene.getLight("light2");
light->setBrightness(2.0f);

The problems is what Light is. Ideally, it's "proper C++" where it's a pointer directly to the internal object. However, these classes are closely tied to how the scene class works, which makes maintainability a mess. It's seems much easier to just have private implementations that do all the dirty work and only let the user receive pointers to an interface.

What I want to do is make Light an interface (struct with virtual functions, no data, no non-virtual functions except empty constructor) and implement the internal details as a private class inside the scene class. While this makes it more maintainable, it comes at the cost of using polymorphism where I'm not dealing with more than one implementation.

Any thoughts or ideas are helpful.

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:
How to hide a MMORPG backend server from the internet? I want to create a network where the main servers IP is never exposed to the client. By going throught tunnels.

Here is a sample:
http://dl.dropbox.com/u/12304631/eliteots/mc/network.jpg

Problem

By making tunnels through dedicated servers I hope to solve latency issues from some clients that are far away from the main server.
But even if this does not succeed, I wish to hide my main server to avoid network attacks directly against it. So the main server only communicates with the tunnel hosts, which then communicates with the clients.

So by creating several tunnels I will be able to let customers easily access the main server by switching tunnel if their preferred tunnel is currently under attack. This is not my problem, should be easy to program, however the network configurations between tunnel and main server is the issue because of my lack of experience in this area.

Requirements

I am not talking about a simple http proxy, I want this to solution to operate on all ports. Or at least the configured ports. Only transmitting TCP.
I do not wish any encryption on the traffic between the vpn and main server, I think it should be as fast as possible.
I am working on an MMORPG, which is why I put so much effort into learning this. The worst thing that can happen to a customer is to be kicked from game server unable to login to finish their needs.
I only operate in an linux environment server-based. (Debian/Ubuntu).

Solution idea

I heard having an openVPN server might be what I need.

But I have problems operating it, I find it quite complex. First off, I want to know, is this even possible in OpenVPN? If so, how should I configure the network logics?

I am open to try out any free solutions you may find/recommend me!

sentences:
How can you tell if you are a large player on a large map or a small player on a small map? If everything is scaled by a constant factor, can you tell that the world is smaller or larger?

I think you could look down at the ground and see that it's "closer".
But how do you know what should be the correct distance? What visual clues give it away?

Edit: The player controller has an FPS camera!

sentences:
Seaming between procedurally generated terrain meshes in Unity I have been generating procedural terrain for an upcoming project however I am coming across a seaming effect between the tiles:

I have searched for solutions including this video.

Here is the code (sorry for the lack of comments):

chunkx and chunky are the x and y coordinates of the chunk that is being generated.

seed is a randomly generated integer.

float Gen_Height(int x, int y, int seed)
{
    float height = 0;
    float newx;
    float newy;
    for (float resolution = 128; resolution >= 8; resolution /= 8)
    {
        newx = (seed / 40f) / resolution + x / resolution;
        newy = (seed / 40f) / resolution + y / resolution;
        height += (Mathf.PerlinNoise(newx, newy) - 0.5f) * resolution;
    }
    if (height < 0) height = 0;
    return height;
}

public List<Vector3> Gen_Vertices(int chunkx, int chunky, int seed)
{
    float height;
    int x = 101;
    List<Vector3> vertices = new List<Vector3>();

    for (int i = 0; i < x; i++)
    {
        for (int j = 0; j < x; j++)
        {
            height = Gen_Height(i + chunkx * (int)x, j + chunky * (int)x, seed) * heightmod;
            vertices.Add(new Vector3(2*i, height,2* j));
            if (height > maxheight) maxheight = height;
            else if (height < minheight) minheight = height;
        }
    }
    return vertices;
}

sentences:
Can Achievement systems be implemented later in development? I'm undecided if I want to implement this feature in my game at the time or not. I don't want the project to get to far out of control so I'm focusing on core mechanics first.

Is this a feature that is easy to implement later assuming I data drive everything and store everything?

sentences:
Sending changes to a terrain heightmap over UDP This is a more conceptual, thinking-out-loud question than a technical one. I have a 3D heightmapped terrain as part of a multiplayer RTS that I would like to terraform over a network. The terraforming will be done by units within the gameworld; the player will paint a "target heightmap" that they'd like the current terrain to resemble and units will deform towards that on their own (a la Perimeter).

Given my terrain is 257x257 vertices, the naive approach of sending heights when they change will flood the bandwidth very quickly - updating a quarter of the terrain every second will hit ~66kB/s. This is clearly way too much.

My next thought was to move to a brush-based system, where you send e.g. the centre of a circle, its radius, and some function defining the influence of the brush from the centre going outwards. But even with reliable UDP the "start" and "stop" messages could still be delayed. I guess I could compare timestamps and compensate for this, although it'd likely mean that clients would deform verts too much on their local simulations and then have to smooth them back to the correct heights. I could also send absolute vert heights in the "start" and "stop" messages to guarantee correct data on the clients.

Alternatively I could treat brushes in a similar way to units, and do the standard position + velocity + client-side prediction jazz on them, with the added stipulation that they deform terrain within a certain radius around them. The server could then intermittently do a pass and send (a subset of) recently updated verts to clients as and when there's bandwidth to spare.

Any other suggestions, or indications that I'm on the right (or wrong!) track with any of these ideas would be greatly appreciated.

sentences:
Is there a way to balance a binary tree continuously? In my game I have a tree of objects in 3D space, to which new objects are frequently added.

Over time, the binary tree becomes unbalanced which is a big problem for efficiency as the tree can become quite large. It might even be at risk of stack overflows from deep recursion.

At the same time, it is important to keep branches of the tree close together in 3D space. So I can't arbitrarily swap tree nodes around to balance the tree.

Is there an efficient algorithm that will do the following:

Allow efficient additions to the tree (O(log n) max)
Keep the tree approximately balanced as additions are made
Ensure that branches of the tree contain objects that are close to each other in 3D space (i.e. it works at least approximately as a spatial subdivision tree)

sentences:
How do you import submeshes on a skeletal mesh? I'm trying to help out a friend on an Unreal issue.  He has a Unity scene he's trying to convert to run on Unreal, and getting the models right has been a bit of a bumpy road.
Like many models, this has several sub-meshes on it.  Some of them are mutually exclusive and should only have one out of a group of submeshes turned on at once, so that the same basic model can be repurposed as multiple different characters with different base geometry.  In Unity, this "just works."  Import the FBX file and you get a prefab with all of the submeshes as sub-objects, and everyone's happy.
In Unreal, it's a bit more complicated.  A bit of searching came up with this question from 4 years ago, which is exactly the problem I'm having here, and says exactly how to deal with it: unselect the "Combine Meshes" option in the importer.  Except that this model is rigged, and for whatever reason, when you check the "Skeletal Mesh" option in the importer, the Combine Meshes option vanishes and everything gets lumped together in one single blob of mutually exclusive geometry!
I find it difficult to believe this this would work perfectly right out of the box in Unity, while Unreal, which has been around almost a decade longer, has no support at all for such a fundamentally important operation.  But at least at first glance, that appears to be the case.  Are there any more experienced Unreal devs out there who know how to get sub-meshes to import correctly on a skeletal mesh?

sentences:
Godot 3, multiplying by delta not making the object to move I have a simple code which makes a sprite rotate and move,

extends Sprite

var vel = Vector2(1,1)

func _ready():
    print(position)
    pass

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

But in the line

position = position + vel * delta

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

sentences:
Showing "Please buy" screen to pirates I recently saw this and this, and that got me thinking

When publishing a commercial game without DRM, would it be a good idea to upload a slightly modified copy of the game that shows a screen like this at startup to, say, The Pirate Bay:

  Hello pirate! Looks like you downloaded this game from The Pirate Bay! That's okay, but:
  Making a game costs time and money. If you like the game, please buy it so we can continue to update this game with new content! You buy it for only $xx.xx at www.example.com!

  In the meantime: Have fun!

  Press Enter to continue

And then continues to the title screen and from there is identical to a legal copy.

The point is that it will probably (very, very, VERY high chance that it will) be uploaded sooner or later anyway, so this may decrease the harm.

Would that be a good idea?

sentences: Remove Sprite Shape Controller Icons from 2D sprite shapes How do I get rid of those "purple icons in my scene"? They are so annoying ... they literally covers the entire 2d shape! GIF showcasing it

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:
Libgdx Animation Timing I'm having a small issue with libgdx animation.

I'm using getKeyFrame() to get the current frame of the animation and I'm updating the state time by adding on deltaTime in my update function for the object. The animation is not looping.

My problem is that the animation seems to play at different speeds depending on the frame rate. On my phone this animation plays particularly slow. My thinking was that the stateTime would cause it to skip a few frames when it's going slow, but this doesn't seem to be happening.

Here is the code;

        sprite = Animation.getKeyFrame(stateTime, false);
        sprite.setRotation(angle);
        sprite.setPosition(position.x, position.y);
        sprite.draw(batch);

Has anyone else experience this issue.

sentences:
HDR / Tone Mapping - choosing parameters I implement HDR in my graphics engine (deferred rendering) based on this document: link I save a luminance in a texture (RGBA16F) this way:

const float delta = 1e-6;
vec3 color = texture(texture0, texCoord).xyz;
float luminance = dot(color, vec3(0.2125, 0.7154, 0.0721));
float logLuminance = log(delta + luminance);
fragColor = vec4(logLuminance, logLuminance, 0.0, 0.0);
// first channel stores max luminance during a minification process

Then I can calculate an average luminance and find a max luminance.

The delta = 1e-6. Is that a good choice ?

Can I calculate "a" (equation 2) dynamically to achieve better results ?

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:
Canvas/Paint Mechanic I'm currently working on an idea for a Unity game app with a canvas mechanic. I understand I may have to use particles for the brush/paint f/x however I can not think of a way to add collision detection let alone the paint itself...onto a canvas...
Any suggestions are much appreciated!

sentences:
How can I handle errors when there is no valid OpenGL context? I'm writing cross-platform (iOS, Android, OSX, Windows) library code that draws its output using OpenGL. I expect my users will often try to call my library's rendering functions without a valid OpenGL context (especially when they are first getting started), so how can I cleanly handle the error?

So far I have tried calling some OpenGL function and then calling glGetError() to see if it failed (and printing my user a helpful error message), but glGetError() segfaults if there is no context:

// Test for OpenGL Context

glClearColor(0.0f, 0.0f, 0.0f, 0.0f); // This line segfaults

if (glGetError() != GL_NO_ERROR)
    printf("You tried to call a rendering function but no OpenGL context was found!");

Is there a way to check for a valid context within OpenGL without getting a segfault?

sentences:
How to make AI detect a target behind a wall, who is only partially exposed? I'm making an FPS game where, even when a target's whole body is behind a wall or box, but its finger or foot exposed, the AI should be able to detect it and shoot its finger.

So far the way I've thought of to implement this it so traverse all the targets, find who is near a wall, and compare their position with the corner of wall. But I don't know how to check whether its finger is exposed.

I could use a raycast forward from the AI's gun, but would I need to add a collider to every small body part of every target?

sentences:
How do I flip upside down fonts in FTGL I just use FTGL to use it in my app. I want to use the version FTBufferFont to render font but it renders in the wrong way. The font(texture?buffer?) is flipped in the wrong axis.

I want to use this kind of orthographic settings:

void enable2D(int w, int h)
{
    winWidth = w;
    winHeight = h;

    glViewport(0, 0, w, h);

    glMatrixMode(GL_PROJECTION);
    glLoadIdentity();
    //I don't even want to swap the 3rd and 4th param
    //because I like to retain the top-left as the origin
    glOrtho(0, w, h, 0, 0, +1);
    glMatrixMode(GL_MODELVIEW);
}

I render the font like this:

//No pushing and popping of matrices
//No translation

font.Render("Hello World!", -1, position, spacing, FTGL::RenderMode::RENDER_FRONT);

On the other forums, they said, just scaled it down to -1, but it wont work in mine. Example:

font is above the screen

I can't see relevant problem like in mine in google so I decide to ask this here again.

How can I invert texture's v-coordinate without modifying its source code ? (assume its read only)

sentences:
Calculate slope for linear interpolated movement I want to move rectangles to their targets the "smooth" way with linear interpolation. I hope this is right.

float slope(float x1, float x2, float y1, float y2) {
    return std::abs((y2 - y1)) / std::abs((x2 - x1));
}

int s = slope(x, target->x, y, target->y);

if(x > target->x) {
    x -= s * speed * delta;
} else if(x < target->x) {
    x += s * speed * delta;
}

if(y > target->y) {
    y -= s * speed * delta;
} else if(y < target->y) {
    y += s * speed * delta;
}

The result is that they barely move. But when they move it is very slow or fast as hell.
I would also apreciate any suggestions on how to reach the target better.
Thanks in advance.

sentences:
How to obtain a camera stream from Unity without rendering it to the player's screen? I'd like to stream the output of two cameras to a separate process. Right now, it looks like the best way to do that is to grab the rendered camera views from the screen via platform specific screen capture hooks then compress them real time with h.264. Is there a way to grab the input of the cameras within unity and avoid rendering them to the screen?

One solution I'm considering involves using Unity's multiplayer capability to run the game on a separate machine and grab it from that screen buffer, unbeknownst to the player.

sentences:
Applying movement to a Rigid Body Isometric in Unity 3D I'm making an isometric dungeon crawler. I initially used transform to get isometric movement and things worked well, but I couldn't use collision which meant it was unsuitable. So I'm now trying to use Rigidbody and I'm having some weird issues.

First of all, this is the code I currently have:

public class CharControllerRigid : MonoBehaviour{
    [SerializeField]
    private Rigidbody characterRigid;
    private Vector3 inputVector;
    void Start()
    {
        characterRigid = GetComponent<Rigidbody>();
    }

    void Update()
    {
        inputVector = new Vector3(Input.GetAxis("Horizontal") * 10f, characterRigid.velocity.y, Input.GetAxisRaw("Vertical"));
        transform.LookAt(transform.position + new Vector3(inputVector.x, 0, inputVector.z));
    }
    private void FixedUpdate()
    {
        characterRigid.velocity = inputVector;
    }
}

I have two issues:

First, how do I get the movement to work on an isometric plain?

Second, how do I get the movement to work in all directions? Current when I move left and right the movement is good, but up and down are really slow in comparison.

sentences:
Global keyboard states I have following idea about processing keyboard input. We capture input in "main" Game class like this:

protected override void Update(GameTime gameTime)
{
    this.CurrentKeyboardState = Keyboard.GetState();

    // main :Game class logic here

    base.Update(gameTime);

    this.PreviousKeyboardState = this.CurrentKeyboardState;
}

then, reuse keyboard states (which have internal scope) in all other game components. The reasons behind this are 1) minimize keyboard processing load, and 2) reduce "pollution" of all other classes with similar keyboard state variables.

Since I'm quite a noob in both game and XNA development, I would like to know if all of this sounds reasonable.

UPDATE: If someone is interested, actual utility class, as suggested by David Gouveia, I've created can be found here.

sentences:
How come the 3d graphics and animations of MMORPGs are usually worse than non-online 3d games? I have noticed that in general it seems like the 3d graphics and animations for MMOs and MMORPGs seem not as seductive and polished as the graphics for normal, non-online 3d games.

How come this is the case?

or
Is my judgement inaccurate?

If my judgement is inaccurate please provide examples of MMORPGs that render 3d graphics and animations that are superior to normal, non-online 3d games.

sentences:
What data structure should I use for a Diablo/WoW-style talent tree? I'm considering implementing a talent-tree system for an online RPG, similar to that seen in World of Warcraft, where acquiring a skill unlocks the next "tier" beneath it in the tree.

Does anyone know of the best way of implementing this structurally in the database/code?

sentences: Unity - How to serialize / show private fields and custom types in Inspector? By default, Unity only serializes public fields. How can I serialize private fields and custom types to show them in inspector?

sentences:
Getting neighbors of hex tiles in 3D space I have a hex tiled model like attached below. Each of the hex tiles are separate objects meaning I can access each of the hex tiles individually inside Unity

Now in my program I want to be able to get the 6 neighboring tiles of the selected tile. At first I thought I would get the 6 edges of the current tile and then check to see if any of the remaining tiles have those edges in common but that would be very expensive if I want to compute neighbors of all the tiles.

Any ideas??

sentences:
Proper updating of GeoClipMaps I have been working on an implementation of gpu-based geo clip maps, but there is a section of the GPU Gems 2 article that I just can't seem to understand, specifically this paragraph, and more precisely the bolded part:

  The choice of grid size n = 2k−1 has the further advantage that the
  finer level is never exactly centered with respect to its parent
  next-coarser level. In other words, it is always offset by 1 grid unit
  either left or right, as well as either top or bottom (see Figure
  2-4), depending on the position of the viewpoint. In fact, it is
  necessary to allow a finer level to shift while its next-coarser level
  stays fixed, and therefore the finer level must sometimes be
  off-center with respect to the next-coarser level. An alternative
  choice of grid size, such as n = 2k−3, would provide the possibility
  for exact centering

Let's take an example image from the article:

My "understanding" of the way the clip maps were updated was that you floor the position of the viewpoint to an int, and as such get the center vertex point. If this is not the same as the previous center point, you update the entire map. Now, this obviously is not the case.  What I am failing to understand is this:

If you look at the image above, if the viewpoint was to move one unit to the right, then the inner ring (the one just around the view point + white center square) would end up getting a 1 unit space on both the left and right side of itself. But there is nothing in the paper that deals with this. What I mean is that it would end up looking like this:(excuse my crummy cut-and-paste editing of the above image):

This is obviously not a valid state. So, would the solution be that a clip ring (layer) can only move in increments of the ring/layer it's contained within? Wouldn't this end up being very restrictive? I feel like I am missing some crucial understanding of parts of the algorithm, but I have been over both this paper and the original paper from 2004 and I just can't see what I am not getting.

sentences:
Which is the most efficient way to make the screen follow a sprite? This is my first non-board game and I'm trying to learn a bit about 2D graphics in Java.
But I don't know, how should I efficiently implement a camera to make the screen follow the main character.
I have a position-fixed, unchanging terrain as BufferedImage on my map and other also mobile and animated entities, including the character itself.
Right now I'm using some calculations(x of character - middle of screen) each time on repaint() to draw the level on the correct position from the (0,0) coordinates. But this method does a lot of calculation and drawing, even for the fixed map.
Is there a better and more efficient way?

sentences:
tex2Dlod to limit max mip level to use for a texture (atlas) I'm developing a 3D multitexturing terrain engine in C# on Monogame (XNA) plateform. I would like my engine works on Windows XP or upper, so on DirectX 9c minimum.
Monogame allow me to build a DirectX 9c version of my engine, equal or less than a SM 2.0 (4_0_level_9_1) shader model.

Because there are not texture arrays on SM 2.0 and for performances, I use a texture atlas with each mipmaps build manually (to apply aliasing to each textures individually). My vertex structure contains textures coordinates of the texture atlas.

That's all right ? Fine :)

In my case, the texture atlas looks like that (textures unity: 512x512 count: 6 total: 1024x1536):

So, normally there are 11 mipmaps for this texture size, but I have just generated 10 mipmaps to avoid textures bleeding. The last mipmap of the texture atlas is not set.

My pixel shader code look like this:

float4 MutiTexturing_PS(MultiTexturing_VSOut input) : COLOR
{
    float4 _color;

    _color  = tex2D(TextureAtlasSampler, input.TextureUV1) * input.TextureOpacity.x;
    _color += tex2D(TextureAtlasSampler, input.TextureUV2) * input.TextureOpacity.y;
    _color += tex2D(TextureAtlasSampler, input.TextureUV3) * input.TextureOpacity.z;
    _color += tex2D(TextureAtlasSampler, input.TextureUV4) * input.TextureOpacity.w;

    return saturate(_color);
}

The result is that:

You can see at the background a gradient of dark: this is normal because the lastest mipmap is not set, so texture is transparent. I've have already tried to set the latest mipmap of texture atlas with the lastest generated mipmap (size: 2x3) but... the shader is more smart ! It knows the lastest mipmap must have a 1x1 size and and based its working area on that. So, the dark gradient become a red color.

To avoid the trouble, the only best solution that I have seen on the web is to use tex2Dlod (but if you have a better solution I take). This function return a color of a sampler texture at specified coordinates (like tex2D) but you can also specify the mip level to use. So, after lots of search, I found most frequently this function on the web to calculate the level of mipmap to use with the textures coordinates:

float GetMipmapLevel(float2 textureUV)
{
    float2 dx = ddx(textureUV * TextureAltasWidth);
    float2 dy = ddy(textureUV * TextureAltasHeight);
    float1 d = max(dot(dx, dx), dot(dy, dy));

    return log2(max(d, 1)) * 0.5f; // I can clamp mipmap here :)
}

But by changing my pixel shader code to use tex2Dlod(sampler, float4(texUV.xy, 0, LOD)) and GetMipmapLevel(texUV), I have this result:

I have adjust the calculation by using: return log2(max(d, 1)) * 0.75f;
You can see at the background, a similar result of tex2D function but ... the hill at foreground is to blured !

This is (finally) my question, how can I adjust the mipmap level calculation to get the same result as the tex2D ? How the tex2D function does it ?

If your solution need to use a SM 4.0, I think I'm ready to leave the DirectX 9c support but I'm sure that's possible to do in SM 2.0...
Resources link that can help other pepole in my case:
http://xboxforums.create.msdn.com/forums/p/82969/502102.aspx
http://xboxforums.create.msdn.com/forums/p/51280/309977.aspx

sentences:
Why do I get glitchy graphics when drawing scene with scene2D? I'm trying to display a simple text for a menu UI using scene2D, but for some reason nothing is being displayed here. The screen displays pure black.

public class ScreenMenu implements Screen {

MyGame myGame;
SpriteBatch batch;
Stage stage;
Label labelNewGame, labelContinue, labelCredits;

public ScreenMenu(MyGame myGame) {
    this.myGame = myGame;
}

@Override
public void show() {
    init();
    BitmapFont font = initFont();
    initLabels(font);
    initStage();
}

private void init() {
    batch = new SpriteBatch();
}

private BitmapFont initFont() {
    return new FontLoader().getMichroma();
}

private void initLabels(BitmapFont font) {
    Label.LabelStyle labelStyle = new Label.LabelStyle(font, Color.WHITE);
    labelNewGame = new Label("New Game", labelStyle);
    labelContinue = new Label("Continue", labelStyle);
    labelCredits = new Label("Credits", labelStyle);
}

private void initStage() {
    stage = new Stage(new ScreenViewport());
    Gdx.input.setInputProcessor(stage);
    stage.addActor(labelNewGame);
}

@Override
public void render(float delta) {
    GlHelper.clearScreen();
    stage.act(delta);
    stage.draw();
}

@Override
public void resize(int width, int height) {
    stage.getViewport().update(width, height, true);
}

@Override
public void pause() {
}

@Override
public void resume() {
}

@Override
public void hide() {
    dispose();
}

@Override
public void dispose() {
    myGame.dispose();
    batch.dispose();
    stage.dispose();
}
}

The following class contains the clearScreen function. If I don't run it, the entire screen becomes super glitchy, but I can see the New Game text.

public class GlHelper {

public static void clearScreen() {
    Gdx.gl.glClearColor(0, 0, 0, 0);
    Gdx.gl.glClear(GL20.GL_COLOR_BUFFER_BIT);
}

public static void clearScreen(float red, float green, float blue, float alpha) {
    Gdx.gl.glClearColor(red, green, blue, alpha);
    Gdx.gl.glClear(GL20.GL_COLOR_BUFFER_BIT);
}
}

sentences:
Convertion from 3D to 2D openGL Few days ago , we learned about Homogeneous Matrices in OpenGL class.
From what I have understood , using these matrices we can convert 3D objects to 2D.
However , I am facing some difficulties answering a simple question like : "Which of those matrices answering to the definition of converting from 3D to 2D (Homogeneous)" :

           A                         B                      C               D

I'm not asking you to do my homework, I know the answer it's D and C and this is all I need for this section. I just want to understand why? how it works? why A,B not and C,D yes.
Thank you.

sentences:
Programmatically creating billboards in unity What is the most efficient way to render a billboard in Unity?

In order to apply a texture to something must it be a GameObject with a Mesh component?  In which case, is my best bet to create a prefab of a Plane with the given texture and Instantiate(...) it at runtime? Or is there some sort of "billboard" primitive I should use instead?

sentences:
How i can make better jump to my game? - C++ SFML So, I ask question about my 2D game, actually it is not game, but it is something like poor game. Well i made moving system and now is time to make jump. I made some kind of gravity with tutorial but I don't like it. It is simple and nice but there is problems in that gravity example: 1. You can hold up arrow and "fly" with jump. I tried to fix that and make some kind of limit to jump but it was bad try. Second problem is that when you jump and you release up arrow (jumping key) then my sprite fall very fast and I can't really control that sprite in air.

This is my first game and I want spend time to do that, but now i have problem that i can't solve with my self so if you can help, please do it. I use C++ with CodeBlocks and SFML multimedia library.

So there is little parts of my code.

First there is velocity and gravity configuration:

     //gravity & velocity
     const float gravity = 1;
     int ground = 600; //height of ground
     Vector2f velocity(Vector2f(0,0));
     float movingSpeed = 0.5f, jumpingSpeed = 2.0f;

Then there is simple when you press button you jump:

if(Keyboard::isKeyPressed(Keyboard::Up)){
            skeleton.move(0,velocity.y = -jumpingSpeed);
            source.y = Up;
            isWalking = true;
        }

And there is system what recognize if you jump and this make you fall:

if(skeleton.getPosition().y + skeleton.getScale().y < ground || velocity.y < 0){
             velocity.y += gravity;
        }else{
            skeleton.setPosition(skeleton.getPosition().x, ground - skeleton.getScale().y);
        }

So my sprite name is "skeleton". And yeah this is first time with game physics. I'm not very good game programmer so these code can be poor and yeah... if you invent a solution share it.

sentences: Is ETC2 Texture Compression available in OpenGL ES 2.0? I have an ES 2.0 app and would like to use ETC2 texture compression if it is available (i.e. I am running on a device that supports ES 3.0 standard).  Is it possible to use ETC2 in ES 1.1/2.0, and if so how can I query if a device supports it?  For most forms of texture compression, there is an extension I can query for, but there is no extension for ETC2 since it is built in.

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:
Raycast Movement on a sphere so I'm working on a mobile game where I have touch input from a Asset from the asset store. It all works perfectly fine, except for one thing:
I want to implement a "drag and drop" feature so when I pick up an Item it should follow to the position of my finger. But because the playground is a sphere, I have to do the movement with a Raycast. So my plan is that the item should follow the Raycasts position. My current attempt looks like this:

public void DragTo(float screenX, float screenY)
{
    if (draggingObject == null)
    {
        return;
    }

    Debug.Log("Dragging");

    //Converts the screen space to world space
    Vector3 mousePosFar = new Vector3(screenX, screenY,      Camera.main.farClipPlane);
    Vector3 mousePosNear = new Vector3(screenX, screenY, Camera.main.nearClipPlane);

    Vector3 mousePosF = mainCam.ScreenToWorldPoint(mousePosFar);
    Vector3 mousePosN = mainCam.ScreenToWorldPoint(mousePosNear);

    //shoots an ray to the world space
    RaycastHit hit;

    if (Physics.Raycast(mousePosN, mousePosF - mousePosN, out hit))
    {
        float step = speed * Time.deltaTime;
        draggingObject.GetComponent<Rigidbody>().MovePosition(hit.point);
    }
}

I already have tried the following options:

draggingObject.GetComponent<Rigidbody>().MovePosition(hit.point);
draggingObject.GetComponent<Rigidbody>().MovePosition(hit.normal);
draggingObject.transform.position = hit.point;
draggingObject.transform.position = normal;

They all work, but they all have really buggy and strange behaviors.
Also when I dont freeze the z. axis on the Rigidbody the item just "flies" up on the z axis, until it reaches the camera. Then it teleportes again down and it all starts again. So its flying up on the ray.
So if you have any Ideas why this happens let me know.
Any help is appreciated.
(Also dont forget that its all happens on a sphere)

UPDATE:
It works now. When the dragging began i changed the layer from the object to "Ignore Raycast" and when it end changed it back to "Default".

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:
OpenGL: Generating a single square with a Quad Strip I am currently trying to create a terrain generation system (for my 3D game) with OpenGL 2.1.

The way I am doing it requires the creation of a massive 2D square that consists of multiple smaller squares. After the flat square is generated, the points are randomly offset in the y axis, making it into a 3D structure.

But I can't seem to figure out how to generate this using GL_QUAD_STRIP. Can someone please help me figure this out?

Thanks!

P.s. I know my method may not be the best, but I would like to get it to work anyway as it suits my game

sentences: How do you transform a vector to use another objects orientation? I want to take a vector that is using world coordinates and position it using the orientation of an object.  So, if the direction of the object is the z-axis, and the vector is (0,0,1), then the orientated vector would point in the direction of the object.  I want to vector to remain in the world coordinate system.  All I have for the object is it's up and direction vector.  So, I can build a matrix with those by crossing them to create the third axis.  Multiplying the vector by this matrix transform the vector into the object coordinate system (right?).  But, I want the vector in world coordinate system.  Should I use the matrix to find euler angles and then use those angles to create a rotation matrix?

sentences:
How do I persist the states of distant objects? How would one manage the state of static living things like trees in a large sandbox world? Trees in Minecraft, for example: They grow even when the player is far away.

One way is to save them with a timestamp as they go "out of range" and stop updating them in the usual way. Then re-instate them with a sensible state by running an update with a delta time of the time elapsed since that saved time.

I'm planning a new prototype but this has me a bit stumped.

sentences:
Collision in EdgeCollider Unity I want to make a collider for a line that I've drawn on the screen using mouse. so the detection should be cover the whole line that has drawn.

What I've learned from edge collider is you can have collider if you assign the position of a certain point in col.transform.position (for example I can assign the startpos of my line and the collider works only for that point).

the green line which is drawn by mouse in front of car is using the LineRenderer and requires EdgeCollider to be a road that car can drive on it's surface

and my functions:

private LineRenderer line; // Reference to LineRenderer
private Vector3 mousePos;
private Vector3 startPos;   // Start position of line
private Vector3 endPos; // End position of line
public Material material;

void Update()
{
    // On mouse down new line will be created
    if (Input.GetMouseButtonDown(0))
    {
        if (line == null)
        {
            createLine();
            mousePos = Camera.main.ScreenToWorldPoint(Input.mousePosition);
            mousePos.z = 0;
            line.SetPosition(0, mousePos);
            startPos = mousePos;
        }
    }
    else if (Input.GetMouseButtonUp(0))
    {
        if (line)
        {
            mousePos = Camera.main.ScreenToWorldPoint(Input.mousePosition);
            mousePos.z = 0;
            line.SetPosition(1, mousePos);
            endPos = mousePos;
            addColliderToLine();
            line = null;
        }
    }
    else if (Input.GetMouseButton(0))
    {
        if (line)
        {
            mousePos = Camera.main.ScreenToWorldPoint(Input.mousePosition);
            mousePos.z = 0;
            line.SetPosition(1, mousePos);
        }
    }
}
// Following method creates line runtime using Line Renderer component
private void createLine()
{
    line = new GameObject("Line").AddComponent<LineRenderer>();
    line.material = material;
    line.SetVertexCount(2);
    line.SetWidth(1.1f, 1.1f);
    line.SetColors(Color.black, Color.black);
    line.useWorldSpace = true;
}
// Following method adds collider to created line
private void addColliderToLine()
{
    EdgeCollider2D col = new GameObject("Collider").AddComponent<EdgeCollider2D>();
    col.transform.parent = line.transform; // Collider is added as child object of line

    col.points[0] = startPos;
    col.points[1] = endPos;

    Vector3 midPoint = (startPos + endPos) / 2;
    col.transform.position = midPoint; // setting position of collider object
    // Following lines calculate the angle between startPos and endPos
    float angle = (Mathf.Abs(startPos.y - endPos.y) / Mathf.Abs(startPos.x - endPos.x));
    if ((startPos.y < endPos.y && startPos.x > endPos.x) || (endPos.y < startPos.y && endPos.x > startPos.x))
    {
        angle *= -1;
    }
    angle = Mathf.Rad2Deg * Mathf.Atan(angle);
    col.transform.Rotate(0, 0, angle);
}

btw i don't know what that col.points[] used for. I just found it from the unity documentation which won't make any collision

sentences:
Mesh with Alpha Texture doesn't blend properly I've followed example from various place regarding setting OutputMerger's BlendState to enable alpha/transparent texture on mesh. The setup is as follows:

            var transParentOp = new BlendStateDescription {
            SourceBlend = BlendOption.SourceAlpha,
            DestinationBlend = BlendOption.InverseDestinationAlpha,
            BlendOperation = BlendOperation.Add,
            SourceAlphaBlend = BlendOption.Zero,
            DestinationAlphaBlend = BlendOption.Zero,
            AlphaBlendOperation = BlendOperation.Add,
        };

I've made up a sample that display 3 mesh A, B and C, where each overlaps one another. They are drawn sequentially, A to C. Distance from camera where A is nearest and C is furthest. So, the expected output is that A see through and saw part of B and C. B will see through and saw part of C.

But what I get was none of them see through in that order, but if I move C closer to the camera, then it will be semi transparent and see through A and B. B if move closer to camera will see A but not C. Sort of reverse.

So it seems that I need to draw them in reverse order where furthest from camera is drawn first then nearest to camera is drawn last.

Is it suppose to be done this way, or I can actually configure the blendstate so it works no matter in which order i draw them?

Thanks

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:
Ranking system in an Android Open Source project This is my first question in any stackexchange board, but I've been reading Stack Overflow answers for a few months. I hope this question is appropriate for this one.

I am developing a simple Android game using Java and libgdx. I want to make a typical ranking, a player who completes a level is awarded some points, and his score is compared with other players who sent theirs. This is all ok (well I still need to find a way to store players' scores). On the other hand, I may want my project to be released as an open source project, so others can look at its code freely. My question is, if anybody can get this code, modify it in order to get some advantatge, compile this game, and load it onto an Android device, how can I stop him/her from sending his/her score? It would by unfair to let them send highscores with a different game.

sentences:
Infinite ball bouncing problem (Unity) I am trying to develop a basic Breakout game using this tutorial using Unity 5. But the ball starts to bouncing infinitely very easily. I cannot understand why this happenes.

In my physics knowledge starting an infinite bounce is very hard, and even impossible. To return the ball to same position after bouncing we must send the ball with zero degrees with the vertical axis. To send the ball with zero degrees with vertical axis we must receive the ball with zero degrees with the vertical axis. To receive the ball with zero degrees with the vertical axis we must send the ball with zero degrees, and so on. We can send a ball with zero degrees only in initial ball throw. In all the other cases there must be an angle which is not equal to zero. Am I wrong?

I mean the ball does not change its rotation. Ball moves between two plates which are parallel to each other infinitely (for example between paddle and upper wall)

I added physics material to ball, paddle and the walls. This material has following settings:
Dynamic friction: 0
Static friction: 0
Bounceness: 1

Settings of the ball:
Mass: 0.5
Drag: 0
Angular Drag: 0
Is Kinematic: true (I changed to false just before firing)
Use Gravity: false

Settings of the paddle:
Mass: 0.5
Drag: 0
Angular Drag: 0
Is Kinematic: true
Use Gravity: false

sentences:
How to go about an intermediate collision resolution system? I would like to know a better way of collision resolution than I am currently doing. My current collision system stores the current positions and previous positions of each object. When an object collides with another it sets the current positions to the previous positions.

This would work fine if objects could only move in four directions, but when they can move in more than four directions the system doesn't work. For example if you are moving an object_A up and right and it collides with and object_B above it, the object_A stops moving even if still going up and right. In most 2d games however if this scenario happened the object_A would stop moving up but continue to move right. This is the kind of collision resolution that I would like to implement. I don't need anymore complicated physics right now this will do.

I'm just using rectangles so that would be the only shape I need to worry about.

sentences:
Smooth Lighting Falloff So, I'm having some issues with lighting in my Unity game.  I had implemented torches, which seem to be working fine, but I have a creature (gelatinous cube) that I've put spot lights facing to give it a "glow".  The reflected and refracted light ends up having two issues:

the light abruptly ends at the edge of floor tiles, and
depending on the position, the light sometimes goes from it's blue color to a reddish color.

I have a short (11 second) video here:  http://www.labyrintheer.com/wp-content/uploads/2016/11/Nov-17-2016-21-07-57.mp4 so that you can see what I'm talking about.  I've tried changing global lighting settings and playing with the settings on the spot lights, but nothing seems to resolve the issue.

Still images for anyone hesitant to click the video link:

Hard falloff:

Reddish color:

Using a single point light inside the cube, instead:

You can see it on the wall in the upper right and the floor at the top a bit.  The upload seems to have lowered the quality a bit, but you can still see it.  The single light makes it a little bit better, but there's still complete falloff.

sentences:
In a game such as Star Wars Galaxies, Planetside, and Warcraft how would server-side collision/terrain navigation work? I'm trying to learn some advanced topics in multiplayer networking for fun and education, specifically how server-side collision/terrain navigation works in MMOs and/or any online game.

Personally, I have a nice little test server where I can move two units around a plane and they can collide with one another, no big issue, then I started to think about real terrain. Features such as mountains, rivers, cliffs, etc.

I know that a map can be chunked out and I could use spatial partitioning to narrow my collision detection down to small chunks, however, I'm a bit stumped if the server and client would be running the exact same physics calculations (gravity, physics, etc).

I'm assuming the server would need to have an exact duplicate of the map-data that the player is seeing client side to perform the appropriate collision/terrain calculations to make sure nothing nefarious is going on - such as a way to prevent map hacks and hiding in walls/mountains.

This is all assuming the player has direct control over the movement/direction of their character ala WoW/SWG/Planetside, and not like a MOBA/RTS game.

My question boils down to this (as I know implementation details vary) what does the server-side need in order to properly keep track of players in a varied terrain world?

sentences:
Level Modeling Workflows in Maya for Unity I'm wondering what the standard workflow for modeling static levels for Unity (or for that matter, other High-Level engines) is? My somewhat limited knowledge tells me that the best process is modeling the entire static level in Maya, texturing, then baking AO and some static lighting into the scene, then importing the single level asset into unity to add dynamic objects.

Is there another way that I should be doing this that is more efficient in a performance sense or from a workflow point of view?

I know the question is somewhat open ended, but generally i'm asking what the standard workflow for level modeling is.

Thanks!

sentences:
Camera Movement - Snap Camera back to origin in relation to the player object I am trying to implement camera movement like it is done in Guild Wars 2. Scenario is when A and D keys are pressed, the player rotates right / left and the camera follows and stays behind the character / player like this
(Starts at 23 seconds)
https://www.youtube.com/watch?v=XkHJ2uSrLjE

I can get the basic working fine, and I did it this way

private void KeysRotateCameraAndPlayer()
{
    float keysOrbitingSpeed = 120;
    this.player = GameObject.FindWithTag("Player").transform;

    if (Input.GetKey(KeyCode.A))
    {
        Debug.Log("Rotate Left");
        CenterPoint.eulerAngles -= new Vector3(0, 360 + Time.deltaTime * keysOrbitingSpeed, 0);
        player.eulerAngles -= new Vector3(0, 360 + Time.deltaTime * keysOrbitingSpeed, 0);

    }
    else if (Input.GetKey(KeyCode.D))
    {
        Debug.Log("Rotate Right");
        CenterPoint.eulerAngles += new Vector3(0, 360 + Time.deltaTime * keysOrbitingSpeed, 0);
        player.eulerAngles += new Vector3(0, 360 + Time.deltaTime * keysOrbitingSpeed, 0);
    }
}

Now the next part I am trying to achieve , when the camera is rotated / orbited around the player using the mouse and is left in a position that is not the origin i.e behind the player (in relation to player)… when A and D keys are pressed, what happens in GW2 is the camera seems to snap back to the origin and then continue to follow the player from the back ( or its relation origin with regards to the player Object if that makes sense)

This is what the game does (which I hope to achieve)
https://www.youtube.com/watch?v=qTTDaeuHl80

so at present moment with my current code
https://www.youtube.com/watch?v=a53lZ_0BDtg
camera and player will continue to rotate (with A and D), from where the camera was last left during orbit. How can I add to this, to force the camera to snap back to origin like they have in Guild Wars 2?

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:
Issues with character controller (unity 4 project in unity 5) I'm having the weirdest issues with a game me and a mate have been working on. They came up immediately after moving from the last version of Unity 4 to Unity 5.

The two objects (player and enemy) return an error "Character Controller Settings are invalid" both on starting and stopping the game.

The enemy settings are:

Slope Limit:        50
Step Offset:        60
Skin Width:         0.003
Min Move Distance:  0
Center:            (0, 0, 0)
Radius:             0.01
Height:             0.01

some of the values have had to be scaled down to accommodate for the scale of the actual model.

Then, whenever the "Move" function calls (which use to have the enemy move towards the player), I get

CharacterController.Move called on inactive controller

which I have located to come from this code:

_controller.Move(moveDirection * Time.deltaTime);

where moveDirection is just a Vector3 co-ordinate of where to move too.

as I said, this was all working before I converted to the new version of Unity. I have checked and confirmed that the Character Controller is both correctly linked and enabled. I have not found anything useful looking up problems others have had with a similar error, and it's pretty much got me stumped.

sentences:
animating a spritesheet using crafty.js this is my jsfiddle : http://jsfiddle.net/seekpunk/ek6ub4u5/1/

i don't understand what i am missing it's been three days now working and trying to do the animation but i am stuck

 Crafty.sprite(128, "https://0.s3.envato.com/files/42440549/1_Ninja.jpg", {
               idle: [1, 0]
           });

i've loaded the spriteseet image and declare idle

 Crafty.c("animation", {
               init: function () {
                   this.requires("SpriteAnimation");
                   this.animate("run", 1, 1, 4);
                   this.bind("enterframe", function () {
                       if (!this.isPlaying("run")) {
                           this.animate("run", 20);
                       }
                   });
               }
           });

then i have declared the animation component and the bindframe function

var player = Crafty.e("2D,Canvas,idle, animation")
                        .attr({ x: 0, y: ch - 128, w: 128, h: 128 });

then i've declared the player ,but sadly the animation is not working .. can anyone tell me what i am missing please

sentences:
Enemy evolution in shoot-em-ups Are there any shoot-em-ups in which the enemies actually evolve as a response to their relative success against the player?

By evolve, I mean that each enemy has some genetic information encoding their behaviour. Enemies which last longer or do more damage are allowed to mix their genes to create new enemies. This way the enemies would become better adapted to the particular player.

sentences:
Understanding the Seek steering behavior I'm currently studying steering behaviors. Have recently learned about Seek.

I have a question about this.

Seek is supposed to turn the agent slowly in the direction of it's target, and then move in that direction.

However, I don't understand how Seek turns the agent around slowly. It seems to me like it should make the agent change direction immediately.

This is the code for a Seek function:

Vector Seek(Point target){

    Vector toTarget = new Vector(target - agent.getPosition());
    Vector desiredVelocity = toTarget.normalize() * agent.getMaxVelocity();

    return desiredVelocity.subtract(agent.getVelocity());

}

And then here is the update() function of the agent.

void update(){

    Vector force = seek(target);
    Vector acceleration = force.divideBy(mass); // mass = 1.
    velocity = velocity.add(acceleration);
    position = position.add(velocity);

}

Anybody mind explaining to me where the gradual change of velocity takes place? Thanks

sentences:
How can I handle different keyboard layouts? Let's say I have a game that uses WASD controls on a QWERTY layout. Trying to use these controls on, say, a Dvorak layout is not ideal (equivalent to <A:H on QWERTY). Obviously, I'd want to use the same physical keys as QWERTY would use (,aoe on DVORAK).

I've come up with a few possible solutions:

Force the user to use QWERTY

obviously not ideal, especially for international users

Change shortcuts based on keyboard layout (WASD -> ,aoe)

forces me to make layout maps for each supported layout (automatable)
easiest for the user if there are more shortcuts than just WASD

Force the user to define shortcuts themselves

More flexible
Annoying if there are lots of shortcuts
Can be used in conjunction with the second option

Use hardware keycodes

consistent across keyboards?

How is this type of thing usually handled?

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:
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:
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:
How do I get the seed of a randomly generated level? I intend to use the Mersenne twister to generate a level using a seed , but I also want to make fixed levels, so for now I'm using XML to store data of the level (~40 numbers).

However, it would be awesome if I could get the seed of a specific level by reversing the process.

I guess if I used my own pseudo-random number generator I possibly could do it, but my question is can I do it with the Mersenne twister?

Here is an example of what I want to do:

If the seed 1234 gives output 25 65 78 01, can I get the seed 1234 knowing only the generated output?

Thanks in advance! (For those who wonder why I'd want to do this; my XML parsing is a lot slower than generating a level, plus XML files are bigger than seed numbers.)

sentences:
Weird problem with advect program in fluid simulator I implemented 2d fluid simulator. Solver runs entirely on GPU. All works fine... on my work PC. But on home PC I have some awful glitches, and I can`t understand how to fix them. Empirically I discovered that problem is localized somewhere in advect program. This is very strange cause at work I have integrated video, and at home — NVIDIA GeForce 9800 GT. Here is the GLSL source of advect program (some lines were dropped for clearness):

#version 130

out vec3 value;

uniform sampler2D q;
uniform sampler2D velocity;
uniform float dt;
uniform float inverseSize;

void main()
{
  vec2 p = gl_FragCoord.xy * inverseSize;

  vec2 np = p - dt * texture(velocity, p).xy;

  value = texture(q, np).xyz;
}

And some screenshots.

Work PC:

Home PC:

sentences:
How can I make water appear darker with depth, like in Minecraft? In Minecraft when you look at water the deeper you view the darker it gets.  Does anyone know how to code something like that?

Minecraft with effect

similar game without effect

sentences:
player teleporting into other levels So I basically want to load another map once the player collides with a object, specifically a "Portal" in my game. Which is really making the player move onto other levels. I don't want to jumble up my code with a bunch of function like "go_to_level_9" or something so I'm planning to use a list or dictionary or something. So how to those game devs out there do that? Code for main.py is here: https://pastebin.com/rpddq1MP. The part with the portal stuff, walls and a few others:
    for tile_object in self.map.tmxdata.objects:
        obj_center = vec(tile_object.x + tile_object.width / 2,
                         tile_object.y + tile_object.height / 2)
        if tile_object.name == 'player':
            self.player = Player(self, obj_center.x, obj_center.y)
        if tile_object.name == 'zombie':
            Mob(self, obj_center.x, obj_center.y)
        if tile_object.name == '#':
            Obstacle(self, tile_object.x, tile_object.y,
                     tile_object.width, tile_object.height)
        if tile_object.name in ['health', 'shotgun']:
            Item(self, obj_center, tile_object.name)
        if tile_object.name == 'portal':
            self.map = TiledMap(path.join(self.map_folder, tile_object.type))

how do you do it? I'm currently using Tiled and pygame so I'm also using pytmx.
Edit: When I run the code, it just gives me an error about my other file, tilemap.py.
Error:
File "D:\coding\my_coding_stuff\python\games\pygames\little rpg\tilemap.py", line 49, in apply return entity.rect.move(self.camera.topleft) AttributeError: 'TiledMap' object has no attribute 'rect'
Tilemap.py:
import pygame as pg
import pytmx
from settings import *

def collide_hit_rect(one, two):
    return one.hit_rect.colliderect(two.rect)

class Map:
    def __init__(self, filename):
        self.data = []
        with open(filename, 'rt') as f:
            for line in f:
                self.data.append(line.strip())

        self.tilewidth = len(self.data[0])
        self.tileheight = len(self.data)
        self.width = self.tilewidth * TILESIZE
        self.height = self.tileheight * TILESIZE

class TiledMap:
    def __init__(self, filename):
        tm = pytmx.load_pygame(filename, pixelalpha=True)
        self.width = tm.width * tm.tilewidth
        self.height = tm.height * tm.tileheight
        self.tmxdata = tm

    def render(self, surface):
        ti = self.tmxdata.get_tile_image_by_gid
        for layer in self.tmxdata.visible_layers:
            if isinstance(layer, pytmx.TiledTileLayer):
                for x, y, gid, in layer:
                    tile = ti(gid)
                    if tile:
                        surface.blit(tile, (x * self.tmxdata.tilewidth,
                                            y * self.tmxdata.tileheight))

    def make_map(self):
        temp_surface = pg.Surface((self.width, self.height))
        self.render(temp_surface)
        return temp_surface

class Camera:
    def __init__(self, width, height):
        self.camera = pg.Rect(0, 0, width, height)
        self.width = width
        self.height = height

    def apply(self, entity):
        return entity.rect.move(self.camera.topleft)

    def apply_rect(self, rect):
        return rect.move(self.camera.topleft)

    def update(self, target):
        x = -target.rect.centerx + int(WIDTH / 2)
        y = -target.rect.centery + int(HEIGHT / 2)

        # limit scrolling to map size
        x = min(0, x)  # left
        y = min(0, y)  # top
        x = max(-(self.width - WIDTH), x)  # right
        y = max(-(self.height - HEIGHT), y)  # bottom
        self.camera = pg.Rect(x, y, self.width, self.height)

sentences: Unity: "inconsistent line endings" dialog shows up ever time I open VS with unity Everytime I open a script file from unity with visual studio this dialog shows up about normalizing the line endings? What does this mean? I click Yes every time but still can't get rid of it. It only happens when I open a file from unity.

sentences:
How can I draw filled triangles in C++? VERY IMPORTANT NOTE: Im trying to fill a triangle. I have already made the 3D part. Sorry if this wasn't understandable.

I'm currently trying to create a simple 3D-Engine. Well, I have successfully drawn a triangle using this method.

void DrawTriangle(int x1, int y1, int x2, int y2, int x3, int y3) {
  drawLine(x1, y1, x2, y2); //Usage: drawLine(x, y, x1, y1)
  drawLine(x2, y2, x3, y3);
  drawLine(x3, y3, x1, y1);
}

After this method worked surprisingly well and a cube appeared very convincing, I tried to add lighting. Now I'm facing a pretty big problem. After a long thought I found this method of filling a triangle but here is the problem. It paints a few triangles but not all. Unfortunately I cannot show any pictures because I do not have a camera and a screenshot would not work (as I explain later). My theory is that it only draws bottom flat triangles (or the other way around). What should I change about my method so that it works? Thanks in advance.

This is my filling code:

void FillTriangle(int x1, int y1, int x2, int y2, int x3, int y3) {
 drawLine(x1, y1, x2, y2);
 drawLine(x2, y2, x3, y3);
 drawLine(x3, y3, x1, y1);
 for(int x = x1; x<=x2; x++) {
    for(int y = y1; y<=y2; y++) {
     drawLine(x3, y3, x, y);
    }
  }
}

I'm currently working with an Arduino UNO
I'm using the Nokia 5110 display
I'm using C++
I'm using this library for displaying
Do not downvote, just comment what you need to know.
I have already tried this code but it wasn't working.

sentences:
How do I set the size of a single 'unit' in my game? I'm currently trying to remake/port an old game created on Unreal Engine 2.5 to my own engine, and I have access to its physics data. It's using a scale of 80 units per meter, or 1 unit = 1.25cm.
The walk speed value for example is 5, and physics is simulated at 60 FPS, so the walking speed I need to implement would be 3.75 meters per second.
But I don't exactly know what the size of a game engine's "unit" actually means. I of course want my own engine (I'm using C++, OpenGL, and GLM) to use this same scale, but I'm not sure how to go about that. I'd assume this affects not only physics/movement code, but the scale of models and maps I load in as well, so it's important to make sure it's the same as in the original game.
How would I implement this? What parts of a game does the size of a 'unit' affect and how? Just the physics and movement calculations, or the graphics side as well (matrices, clipping space, FOV, etc.)?
(I'm not sure if I'm overthinking things)

sentences:
Rotate sprite direction Cocos2d I want that my sprite go always forward, and you can only control his direction moving right and left (on 360 degrees). I don't know why, but the movement it's senseless.

The constants to move and rotate:

const int POD_DEGRE_MOVE = 5;
const int POD_STEP_MOVE = 3;

The sprite initalization:

_dragonSprite->setPosition(Point(visibleSize.width / 2,_dragonSprite->getContentSize().height * 0.75));
addChild(_dragonSprite, 2);

The event key listener:

void GameScene::onKeyPressed(EventKeyboard::KeyCode keyCode, Event *event){
    _pressedKey = keyCode;

    switch (_pressedKey) {

    case EventKeyboard::KeyCode::KEY_LEFT_ARROW:
        giro = -POD_DEGRE_MOVE;
        _isMoving = true;
        break;
    case EventKeyboard::KeyCode::KEY_RIGHT_ARROW:
        giro = POD_DEGRE_MOVE;
        _isMoving = true;
        break;

    }

}
    void GameScene::onKeyReleased(EventKeyboard::KeyCode keyCode, Event *event){
        if (_pressedKey == keyCode) {
            _pressedKey = EventKeyboard::KeyCode::KEY_NONE;
            _isMoving = false;
            giro = 0;
        }
    }

And the calculations of the new direction:

void GameScene::update(float dt) {

    _dragonSprite->setRotation(_dragonSprite->getRotation() + giro);
    _podVector = Vec2(cos(_dragonSprite->getRotation()) * POD_STEP_MOVE, sin(_dragonSprite->getRotation()) * POD_STEP_MOVE);
    Vec2 newPos = Vec2(_dragonSprite->getPosition().x + _podVector.x, _dragonSprite->getPosition().y + _podVector.y);

_dragonSprite->setPosition(newPos);
}

Another problem is that the sprite at the start moves to the right (because Cos(0)==1), so I rotate the image of the sprite 90 degrees to the right, to then rotate it again at the initialization 90 to the left so the sprite is in the right position and his start angle is 90 (sin(90)==1), but the angle is not 90, and it moves as he wishes.

The last problem I have with this is that when I press a key (right or left), the sprite stops, rotates, and starts again (a direction that is not the direction where the sprite is aiming, that's the main problem). The sprite shouldn't stop while you are moving it.

Can anyone help me?

sentences:
How can I open source my Unity project when I use third party assets? I know you are not allowed to open source a Unity project that contains asset store items that are either paid or under the default license. I am just wondering if there's any way to make my git repository public without getting into trouble.

Would it be possible to compile all third party assets into binary and keep the rest of the project text only? Would this solve the redistribution problem of third party assets while still keeping my own code and assets open source?

I know about just adding a list of required assets, but I'm looking for a better approach: a way to just download the repository, import it and it just works. If this is at all possible please share your solutions.

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:
Pickup another book or submerge into XNA Completely read Head First C#.

Should I read something else or get personal with XNA from here on? Got links?

Edit: Hobby. Interested in 2D and 2.5D gamedev for personal fun, nothing serious. Multiplayer(in 2D/2.5D games) is also a very interesting topic for me. Basically not sure where to go now from here.

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:
How can I draw multiple vertexbuffers with indices? I'm using to types of vertices.

For the triangles:

 0 Vector3 Position,
12 Color Color,
16 Vector3 Normal

For the lines:

 0 Vector3 Position,
 12 Color Color

I setup a vertex buffer for each type, and adding them to the GraphicsDevice using VertexBufferBindings. My problem is that I'm only able to draw vertices from the buffer at index 0 of VertexBufferBinding-Array.

//
// This is only a shortened part of the code, which draws the lines but NOT the triangles
//
//
   protected override void Initialize()
{
//Triangles
avl = new AllrounderVertexList(new VertexElementUsageDescriptor[]{
  new VertexElementUsageDescriptor(VertexElementUsage.Position,0),
  new VertexElementUsageDescriptor(VertexElementUsage.Color,0),
  new VertexElementUsageDescriptor(VertexElementUsage.Normal,0)
});
//Clock- and counterclockwise
avl.AddAllrounderVertexList(new Vector3(0, 0, 0), Color.Orange, new Vector3(0, -1, 0));
avl.AddAllrounderVertexList(new Vector3(0, 10, 0), Color.Yellow, new Vector3(0, -1, 0));
avl.AddAllrounderVertexList(new Vector3(0, 0, 10), Color.Navy, new Vector3(0, -1, 0));
avl.AddAllrounderVertexList(new Vector3(0, -10, 0), Color.Gray, new Vector3(0, -1, 0));

//Lines
lines = new AllrounderVertexList(new VertexElementUsageDescriptor[]{
  new VertexElementUsageDescriptor(VertexElementUsage.Position,0),
  new VertexElementUsageDescriptor(VertexElementUsage.Color,0)
});
Color xCol = Color.Red;
Color yCol = Color.Green;
Color zCol = Color.Blue;
for (int i = 0; i <= 50; i+=5)
{
    lines.AddAllrounderVertexList(new Vector3(-50, i, 0), yCol);
    lines.AddAllrounderVertexList(new Vector3(50, i, 0), yCol);
    lines.AddAllrounderVertexList(new Vector3(i, -50, 0), xCol);
    lines.AddAllrounderVertexList(new Vector3(i, 50, 0), xCol);
    lines.AddAllrounderVertexList(new Vector3(0, -50, i), zCol);
    lines.AddAllrounderVertexList(new Vector3(0, 50, i), zCol);

}
short[] lineIndices = new short[lines.Count];
for (int i = 0; i < lineIndices.Length; i++)
  lineIndices[i] = (short)i;
indices = new short[6];
indices[0] = 0;
indices[1] = 1;
indices[2] = 2;
indices[3] = 0;
indices[4] = 3;
indices[5] = 2;

    //Adding indices for the 2 triangles at the end
short[] tmp = new short[indices.Length + lineIndices.Length];
Array.Copy(lineIndices, tmp, lineIndices.Length);
Array.Copy(indices, 0, tmp, lineIndices.Length, indices.Length);
avl.AvgNormalize(indices);
  indices = tmp;

triangleBuffer = new VertexBuffer(GraphicsDevice, avl.vertexDeclaration, avl.Count, BufferUsage.None);
triangleBuffer.SetData<byte>(avl.Data);
indexBuffer = new IndexBuffer(GraphicsDevice, typeof(ushort), indices.Length, BufferUsage.None);
indexBuffer.SetData<short>(indices);
lineBuffer = new VertexBuffer(GraphicsDevice, lines.vertexDeclaration, lines.Count, BufferUsage.None);
lineBuffer.SetData<byte>(lines.Data);
bindings = new VertexBufferBinding[2];
bindings[0] = new VertexBufferBinding(lineBuffer, 0, 0);
bindings[1] = new VertexBufferBinding(triangleBuffer, 0, 0);
GraphicsDevice.SetVertexBuffers(bindings);
GraphicsDevice.Indices = indexBuffer;
}
VertexBuffer triangleBuffer;
VertexBuffer lineBuffer;
IndexBuffer indexBuffer;
protected override void Draw()
{foreach (EffectPass pass in basicEffect.CurrentTechnique.Passes)
{
  pass.Apply();

  GraphicsDevice.DrawIndexedPrimitives(PrimitiveType.TriangleList,lines.Count, 0, 6, lineBuffer.VertexCount, 2);
  GraphicsDevice.DrawIndexedPrimitives(PrimitiveType.LineList, 0, 0, lineBuffer.VertexCount, 0, lineBuffer.VertexCount / 2);
}
}

Do I need to switch somehow between the vertex buffers? Or what am I doing wrong?

sentences:
In HLSL, what is the difference between "static const" and "#define" for constants? So far I've been declaring all my constant variables as static const in my HLSL code, yet virtually every single shader example I've come across uses #define instead.

I know the reasons I would I use static const in C++ over the preprocessor and I just carried it into HLSL as well. However, I'm curious if there are any side effects or pros/cons to this, besides the standard C++ "static const versus #define" arguments.

sentences:
Imported model from Blender stops updating after applying scripts I am new to Unity3D and I am trying to import a model from Blender. I save the .blend file inside the assets folder and everything works well. I drag and drop my model and apply textures, colliders and insert a player. Up until that point, I am able to change things in Blender, and see the changes inside Unity. But my problem begins when I try to apply scripts in my objects. Then the connection between Blender and Unity breaks and the model is not updated in the later.

What am I doing wrong? Any help would be much appreciated!! Thanks!!

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:
How to decide how many textures to break an object into? So I am making a couple spacecraft in my game.  And I want them to look sharp and as photorealistic as possible.

How can I decide if a certain craft should be broken into multiple meshes to each have its own texture based on its size?

Is there a rule?  Like if you are using 4096 size  textures. Obviously a bicycle could be a single mesh with 1 texture.

But what about a small sports car?  An SUV?  A dumptruck?

sentences:
Separation of axis theorem implementation at normals This might be more of a math question, but it relates to the development of a simple physics engine I am trying to create.

I have been stumped on this for about a week now, and have been unable to find an answer in any of the SAT tutorials. (http://www.metanetsoftware.com/technique/tutorialA.html#toc, http://gamedevelopment.tutsplus.com/tutorials/collision-detection-using-the-separating-axis-theorem--gamedev-169, etc.)

I understand how SAT is supposed to work, however I am little confused on the math. First, I am finding my normals like so:

Block.prototype.findNormals = function () {

        var axisVectors = new Array();
        var vertices = this.Properties.Vertices;
        var keys = Object.keys(vertices)

        for( var i = 0; i < keys.length; i++) {
            var last = {x: 0, y: 0};

            axisVectors.push({xComponent: -(vertices[keys[i]].y - last.y), yComponent: (vertices[keys[i]].x - last.x) });

            last = {x: this.x, y: this.y};
        }

        return axisVectors;
    }

I am then precede to project each vertex of the shapes I am testing on those normals.

The problem occurs, and the part of the math that I am not fully understanding, is when I have a situation like so:

axis = (-5, 6)
vertex = (6, 5)

math.dot(vertex, axis)

This results in 0.

Thus my min value for shape1 is always 0. And this results in a false collision.

Can anyone explain the math a little better?

sentences:
SFML drawing Tiles low fps int main()
{
sf::RenderWindow window(sf::VideoMode(800, 800), "SFML works!");
sf::VertexArray Tquad(sf::Quads, 40*40*4);
int size{ 20 };
int width{ 40 };
for (int x = 0; x < width; x++)
{
    for (int y = 0; y < width; y++)
    {
        sf::Vertex* quad = &Tquad[(x + y * width) * 4];
        quad[0].position = sf::Vector2f(x, y);
        quad[1].position = sf::Vector2f((x+1)*size, y);
        quad[2].position = sf::Vector2f((x+1)*size, (y+1)*size);
        quad[3].position = sf::Vector2f(x, (y+1)*size);
    }
}

while (window.isOpen())
{
    sf::Event event;

    while (window.pollEvent(event))
    {
        if (event.type == sf::Event::Closed)
            window.close();
    }

    window.clear();
    window.draw(Tquad);
    window.display();
}

return 0;

}

Hello , im getting very low fps with only 40x40 tiles, in release mode i get 21 fps. If i disable the window.draw i get 2000+- fps.

sentences:
Unity Controller to Make Reticle Orbit based on the right stick input d platformer arena like game. Right now I have it so a reticle moves around the player based on a controller's right stick's horizontal movement using the rotate around function and while it works great on keyboard on it is funky on controllers since you have to hold it left to rotate counter clockwise and right to make it rotate clockwise. I've been working on changing this for well over a month and a half. I've tried coding it myself and then googling it like crazy but I came up with nothing. the input they give you based on vertical and horizontal is what perplexes me the most. in the debugger comes up like this from a debug.log when tilting it up- "H: 0.02528, V: -.9874454". Which makes sense but when going to the top right it looks like "H: 0.7592, V: -.842965". That's the part that confuses me. I can't find a way to use this data in any of the functions I have experience with and experimenting with new ones has gone nowhere. Any suggestions or ideas would help me greatly and would be even more appreciated!

Based on the above image I want my reticle to be placed in a spot on it's orbit around a player's center based on the right stick's position on the controller. So if I completely titled up my stick the reticle goes up but if I release it stays there. Then if I tilt it to the left bottom corner it will "teleport" there without moving along the orbit. So think of old school twin stick shooters where you can aim instantly in the direction of your choice.

This is my old code that used rotate around that slowly makes the reticle orbit as you hold the stick constantly left or right. I added a new axis called AV which is for vertical instead of just horizontal so now I just need a way to use these together somehow.

void AimControllers()
{
    if (currentControllerAimAxisH != null)
    {
        AH = Input.GetAxis (currentControllerAimAxisH);
        if (Mathf.Abs (AH) > stickTol)
        {
              reticle.transform.RotateAround(this.transform.position,new Vector3(0,0,-AH),orbitAngle);
        }
    }
}

sentences: Difference between orthogonal map and isometric map I am laughing at myself ignorant on this. Google didn't produce an obvious answer. Could someone explain what orthogonal map and isometric map are, and how they are different?

sentences:
How to convert screen to world coordinates while using gluLookAt / gluPerspective or similar matrix transforms? I am just starting an adventure in looking under the hood of graphics for a game project I've been working on for a while, and I could use some guidance.

I am using Python/Kivy (though that is not part of the concern), and am trying to use projection and modelview matrices to perform screen-to-world coordinate conversion.   I am using something similar to gluLookAt and gluPerspective matrix transforms for those.

The issue I'm running into, is that the coordinates I get out of multiplying the mv and p matrices together and inverting them, then multiplying by NDC screen coords, the resulting coordinates are only either a fraction of a pixel away from the world position look_at is currently centered on, or a max of a few pixels +/- that point.

I know I'm missing something, and I would love if someone could help me understand.  I wrote a standalone example gist, and made a short youtube video showing what problem I'm having.

https://youtu.be/UxbWQO9e0NE
https://gist.github.com/spinningD20/951e49cb836f08c434a0e9ab0e90c766

The code in question, is the screen_to_world method in the gist, when using the camera_look_at_perspective method to create the MVP, which I will list here:

p = Matrix()
p.perspective(90., 16 / 9, 1, 1000)

self.canvas['projection_mat'] = p
self.canvas['modelview_mat'] = Matrix().look_at(w_x, w_y - 30, self.camera_scale * 350, w_x, w_y, 0, 0, 1, 0)

That is for creating the matrices, and...

def screen_to_world(self, x, y):
    proj = self.canvas['projection_mat']
    model = self.canvas['modelview_mat']

    # get the inverse of the current matrices, MVP
    m = Matrix().multiply(proj).multiply(model)
    inverse = m.inverse()
    w, h = self.size

    # normalize pos in window
    norm_x = x / w * 2.0 - 1.0
    norm_y = y / h * 2.0 - 1.0

    p = inverse.transform_point(norm_x, norm_y, 0)
    # print('convert_from_screen_to_world', x, y, p)
    return p[:2]

Was originally written to convert coordinates when using the previous projection matrix built using translate and creating a clip space (also included in the example).

While the implementation appears to be specific to Kivy, it is just a modelview matrix and projection matrix being used, and their Matrix.transform_point method used above is the same as multiplying a vec against the matrix in question.  It can also include what appears to be the W part of a vec4, which I have also experimented with, with no apparent change.

Here is a screenshot of the standalone example, painting where I have moved the mouse on the screen (red) and where the resulting world coordinate ends up being (green).  The goal is for the converted coordinates in the world to fall directly under the red.

sentences:
How to properly rotate a Turret? I'm having problems understanding how to properly rotate a Turret.
Using Unity Editor, I've simulate turret movement, so I take note that turret can move with this clamp factor (for instance):

( value expressed in euler angles )

X = 1-4

Y = 0-0

Z = 98-100

I've write this code but it not works properly:

float rotX = Random.Range (Cannon1MinX, Cannon1MaxX);
float rotY = Random.Range (Cannon1MinY, Cannon1MaxY);
float rotZ = Random.Range (Cannon1MinZ, Cannon1MaxZ);

Cannon1.transform.Rotate (new Vector3 (rotX, rotY, rotZ),Space.World);

Every time I've to work with rotation i become mad :(

What is wrong ?
Thanks

sentences:
How to find the minimum number in a float array C# Unity i have a for loop that detects the position of every game object in a list and gets the difference between that object and an object anchored in the center and then stores all values in a float array. what should happen next is find the minimum distance in that array and make that object (the object with the smallest distance) move towards the anchored center. the problem is that no matter what i do, it always gets the maximum number (which is the furthest game object). here is what i have so far:

public RectTransform panal;
public GameObject[] characters;
public RectTransform center;
private float[] distance;
private float minDistance;
private bool isDragging = false;
private int distanceBetweenCharacters;
private int minCharNum;

private void Start()
 {
   int charLength = characters.Length;
   center = GameObject.Find("CenterCompare").GetComponent<RectTransform>();
   distanceBetweenCharacters = 200;
 }

private void Update()
 {
     for (int i = 0; i < characters.Length; i++)
     {
         distance[i] = Mathf.Abs(characters[i].transform.position.y - center.transform.position.y);
     }

     float minDistance = Mathf.Min(distance);
     Debug.Log(minDistance);

     for (int a = 0; a < characters.Length; a++)
     {
         if (minDistance == distance[a])
         {
             minCharNum = a;
         }
     }

     Debug.Log(minCharNum);

     if (!isDragging)
     {
         LerpToChar(minCharNum * distanceBetweenCharacters);
     }
 }

 void LerpToChar(int position)
 {
    float newY = Mathf.Lerp(panal.anchoredPosition.y, position, Time.deltaTime * 5f);
    Vector2 newPosition = new Vector2(-386, newY);
    panal.anchoredPosition = newPosition;
 }

 public void StartDrag()
 {
     isDragging = true;
 }

 public void EndDrag()
 {
     isDragging = false;
 }

I assume that the problem is with the array because when i set the minCharNum to a specific integer, it works just fine. What am i doing wrong exactly? Any help is very much appreciated.

sentences:
Player can only dash towards to the top right, but can't in any other direction? I have a dash mechanic, but it only seems to be working when the player is going up, down, left, right, or to diagonally to the upper right. It won't work diagonally in any other directions, and I can't figure out why?
The super weird thing is this problem only happens when my game is running on my computer, not on my laptop?? Any ideas on how I can fix this? Thank you!
void FixedUpdate()
    {
        if (dashing)
        {
            myRigidbody.AddForce(direction * dashspeed/3,
            ForceMode2D.Impulse);
        }
        else
            myRigidbody.AddForce(direction* thrust/4.75f,
            ForceMode2D.Impulse);
            myRigidbody.AddForce(direction * -thrust * 7f,
            ForceMode2D.Force);
        }

void Update()
{
    direction.x = Input.GetAxisRaw("Horizontal");
    direction.y = Input.GetAxisRaw("Vertical");

    if (Input.GetKeyDown(KeyCode.Space) & powerSlider.value > 0)
      {
        if (direction.x != 0 || direction.y != 0)
      {
        if (CanDash) elapsedTime = 0f;
      }

if (elapsedTime < duration)
            {
                if (!dashing)
                {
                    CanDash = false;
                    dashing = true;
                }
                elapsedTime += Time.deltaTime;
                }

        if (elapsedTime > duration)
        {
            if (dashing)
            {
                dashing = false;
                elapsedTime = Mathf.Infinity;
                StartCoroutine("DashCoolDown");
            }
        }

        if (elapsedTime >= duration)
        {
            elapsedTime = Mathf.Infinity;
        }

    IEnumerator DashCoolDown()
    {
        Debug.Log("dash cooldown");
        yield return new WaitForSeconds(.45f);
        CanDash = true;
    }

}

sentences:
A* pathfinding for dynamic obstacles and player made blockages? Hi I'm creating a TD in Unity 5 and need some help with my Pathfinding.

I'm going to use Arons A* pathfinding for my AI which enables me to use dynamic objects and update the path during run-time. However in my game I want the player to be able to block the minions with special turrets which will force the minions to attack the "block tower" instead to get past to their destination.

How could I accomplish something like this?

Image for more clarity:

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: LibGDX Texture blending I have two textures 1 and 2, and a "mask" image 3. I'd like to interpolate between the two textures by using the mask image, and get something like 4. I'm not really sure where to start, as I never did "blending" like this before. Can I do this with the SpriteBatch class, or do I have to make my own shader for this effect?

sentences:
Where can I find good (well organized) examples of game code? Where can I find good (well organized) examples of game code? I'm hoping that I can pick up some organizational tips. Most examples in books are too short and leave out lots of detail for the sake of brevity. I'm particularly interested on how to group your variables and methods so that another programmer would know where to look in the code. For example initializers at the top, then methods that take input, then methods that update views.

I don't care about a particular language, as long as its OOP. I looked at the Quake 2 and 3 sources, but they're straight C and not much help for getting tips on organizing your objects.

So, have you seen some good source? Any pointers to code that makes you say "wow, that's well organized" would be great.

sentences:
OpenGL can an Element Array Buffer points to only one VBO I'm making a Minecraft style game and currently storing 36 vertices and texture coordinates per cube. Could I make an EBO for only the position and leave the texture coordinates as they are?

OK i think thsi is how i will do it.

I would have an array of 24 vertices(3*GLfloat) and 24 texture coordinates(2*GLfloat) for the corners

then i would have an EBO pointing to the corners with 36 indices

So memory total = 24*3*4 + 24*2*4 + 36*4 = 624 bytes

instead of

36*3*4 + 36*2*4 = 720 bytes

sentences:
Underlying skills and knowledge I am trying to expand my knowledge on gaming and programming and I was wondering what underlying skills people think they one should learn to be a great programmer, or developer. What are some important patterns or practices that you use frequently?

Thanks.

sentences:
Changing animation speed at runtime Is there a way in Unity to change the animation speed of an animation managed by an animator controller (Mecanim)?

I'd like to do that at runtime so that I can speedup and slow down an animation based on conditions in code.

sentences:
Clan, guild, team, faction or group? I don't know if this is the right question for Stackexchange because it is based on opinion, so excuse me if it's not.

I'm currently developing a mobile leisure game in a cartoon style where players build and expand their kingdom, in a medieval setting. Users can be part of a group to help each other, trade goods, communicate together,  and support each other when attacked. The game is NOT a fight game only. Developing and maintaining your city and the citizens is an important aspect, socializing with other players is key, and the target audience are both men and women.

I'm really confused how I should name such groups where you can be part of. Clans, guilds, teams, groups or factions: all of them are possible. When should I use which name? And what would fit my situation the best? It's really important to let users feel they are part of a group. Not just a fighting group, but a group both men and women feel attracted to. A fraction for example would not be the best I think.

I realize this heavily depends on opinions. Buy are there any sources that could help me? What do you feel attracted to? What fits my situation the best?

sentences:
How to use alpha channel with emission? I am trying to assemble scene assets and one asset needs an emission material where only the white part emits light:

I set up a texture with a simple (air-quotes) "mask" for the window...

...and tried to make only the white part emit light. This attempt blew up the entire material though (verified by checking model, adjusting intensity). I also tried plugging in the base texture directly but when I turned up the intensity, it looked like the black frame became a deeper black as well, which is not what I want.

Changing the intensity with just the white input and scalar multiplier does not reveal the black metal portion of the diamond pattern. How can I update this graph so that only the white part glows?

I want to use the texture to light the scene but may settle for filler lights, since it could be overkill. Here is the original scene I put together in Blender. The camera will be fixed like this. Note also that there are 9 other windows that emit light in this scene but are made invisible:

Thank you to everyone who takes an interest in helping me solve this problem, your time is appreciated.

sentences:
Keep Mini map static after rotating / zooming with camera Hi I am making a 2D game, where the Camera is able to rotate / zoom in or out on the camera focus (the player usually).

However my game also contains a mini-map, and so far whenever I have to rotate / zoom my camera the mini-map rotates and zooms accordingly. This behaviour was expected, but now I am a little stuck on "un-doing" the changes the view transformation has on my mini-map. What I want to happen is to essentially keep my mini-map statically in the same position throughout the game no matter how the camera rotates or zooms.

I am extremely rusty with my linear algebra / 3D transformations but I have tried the following...

My first thought was, I thought all I had to do was to transform the mini-map origin point with the view matrix, then undo the scaling of the zoom against the mini-map width / height. The zooming was fixed, but the mini-map still rotated so this did not work.

My second try, I remembered to undo the change of a matrix, I would have to multiply the transform by its inverse. So I tried to calculate the inverse matrix, however the determinant of the view matrix was 0, so I could not find an inverse.

Ok... well I guess I'll just see if I can get the rotation down, since I got the zoom to work... So I transformed my mini-map origin by the inverse rotation matrix applied by the view matrix... The mini-map is rotating now, but is not staying in the fixed position I was hoping for.

I was wondering, if anyone here can give me a push in the right direction, or a hint towards a more elegant solution overall. If people would like more information I can upload images, show code... But what I wrote above is exactly how my code would look.

Thanks for any help!

sentences:
Collision detection with Java streams and access of collisionable objects I'm trying to learn some things about collision detection, and I've never known how to cleanly detect this for multiple objects in multiple classes without just copy pasting a lot of code.

I now came up with all collisionable/solid things implementing a class and then using Java streams to return whether one or more things in the list of solid things is colliding with the thing you are checking. Is this the way to do this? Or is this really performance heavy or unconventional? I also didn't know a good way of getting the collisionable objects to the player/other creatures, so I simply used a getter, but that means that player class will get access to all the things in the arraylist and I don't know if this is save.

And are there good resources on collision detection for Java(8)?

And if this were to be for a partially grid based game with unwalkable positions in the grid, but also moving objects that cannot be walked through, would something like this still be the correct way to go about it?

Relevant code:

GameScreen.java

class GameScreen implements Screen {
private Stage stage;
private Game game;
private Player player;
private ArrayList<Solid> solids;

GameScreen(Game game) {
    this.game = game;
    stage = new Stage(new ScreenViewport());

    solids = new ArrayList<>();
    solids.add(new Wall(500, 0, 200, 200));
    solids.add(new Rock(200, 600, 100, 100));

    player = new Player(this);
    stage.addActor(player);
}

public ArrayList<Solid> getSolids() {
    return solids;
}
}

Rock.java (Wall.java is exactly the same but with Rock replaced by Wall)

class Rock extends Group implements Solid {

private int x;
private int y;
private int width;
private int height;

Rock(int x, int y, int width, int height) {
    this.x = x;
    this.y = y;
    this.width = width;
    this.height = height;
}

@Override
public boolean collidesWith(float oX, float oY, float oWidth, float oHeight) {
    return (oX + oWidth > x && oX < x + width)
            && (oY + oHeight > y && oY < y + height);
}
}

Player.java

class Player extends Group {
private final float STEP = 10f;
private GameScreen gameScreen;
private int playerHeight = 130;

Player(Screen gameScreen) {
    setBounds(300, 300, playerHeight / 6.5f * 5, playerHeight);
    this.gameScreen = (GameScreen) gameScreen;
}

private boolean collidesWith(ArrayList<Solid> solids, float x, float y) {
    return solids.stream().filter(o -> o.collidesWith(x, y, getWidth(), getHeight())).findAny().isPresent();
}

@Override
public void act(float delta) {
    super.act(delta);

    if(Gdx.input.isKeyPressed(Input.Keys.W)) {
        if (!collidesWith(gameScreen.getSolids(), getX(), getY() + STEP)) {
            this.setPosition(getX(), getY() + STEP);
        }
    }
    if(Gdx.input.isKeyPressed(Input.Keys.S)) {
        if (!collidesWith(gameScreen.getSolids(), getX(), getY() - STEP))
            this.setPosition(getX(), getY() - STEP);
    }
    if(Gdx.input.isKeyPressed(Input.Keys.A)) {
        if (!collidesWith(gameScreen.getSolids(), getX() - STEP, getY()))
            this.setPosition(getX() - STEP, getY());
    }
    if(Gdx.input.isKeyPressed(Input.Keys.D)) {
        if (!collidesWith(gameScreen.getSolids(), getX() + STEP, getY()))
            this.setPosition(getX() + STEP, getY());
    }
}

}

Solid.java

interface Solid {
  boolean collidesWith(float oX, float oY, float oWidth, float oHeight);
}

sentences:
Render sprites onto a virtual 640x480 "screen" I'm making a game, and in part of it, the player uses a computer terminal. I want to draw to a virtual 640x480 screen with pixel precision, and then draw that "virtual screen" to the player's real screen. The end result will not be "pixel perfect" because 99% of people won't play the game at 640x480 -- and, in fact, I want to then go on and add further effects on top of this so it looks more like a CRT display -- but trying to figure out how to do pixel rendering in Unity has proven pretty difficult so far.

Basically I want to render something that looks like this:

onto the screen, where I draw all of the text characters myself (using Sprites? subsections of a Texture?), and then I want to render this "virtual screen" out onto the player's screen. I know RenderTextures are a thing, and maybe that's part of it? I've tried a lot of different things so far and got nowhere, hence why I'm posting here.

Sorry if this is too nooby of a question, I'm an experienced programmer who is relatively new to Unity.

sentences:
Help to Code Bowling Like Feature in Unity for Mobile I need Code or Guidelines for Touch Feature. When We Drag ball back and Send it Forward.
I am Making feature like bowling, and I need Player to add force while dragging back and also curve the path of the Ball
Anybody, Please Help

sentences:
Experiences of test-driven devleopment in large projects I've used TDD in personal projects, but I wondered if anyone had any experience of using this approach across a large team? Was there resistence to the test-first approach? Did you keep code coverage high for the whole project? How did coverage survive fixing those two-in-the-morning-and-you-ship-in-four-hours crash bugs?  Did you run tests on all platforms, or just assume that passing on one meant passing the others?

I love the decoupled code that TDD produces, and the large suite of regression tests you get for free, but if you only have a few in the team who don't want to contribute tests, won't everyone suffer?

sentences:
Orienting a model to face a target I have two objects (target and player), both have Position (Vector3) and Rotation (Quaternion).  I want the target to rotate and be facing right at the player.  The target, when it shoots something should shoot right at the player.

I've seen plenty of examples of slerping to the player, but I don't want incremental rotation, well, I suppose that would be ok as long as I can make the slerp be 100%, and as long as it actually worked.

FYI - Im able to use the position and rotation to do plenty of other things and it all works great except this last piece I cant figure out.

Code samples run in the Target's class, Position = the targets position, Avatar = the player.

EDIT

Im now using Maik's c# code he has provided and it works great!

sentences:
Event Handling in an ECS I apologize if this has been answered already. I've looked around here, and read a few blog posts, but none seem to fully answer my question.

I am writing an Entity Component System.

Entity is a store for Components, and is the central GameObject.
Component is just a POD struct that describes some attribute (Health, Mana, etc.)
System dictates the laws of the game world. Systems describe how an Entity will behave based on the Components that entity has, and the data stored within the Component. Additionally, a System can interact with other Systems using Events.

A pretty straight-forward and common approach. Now, the issue I am having is when an Event should interact with an Entity. For example, a DieOnCollision event for some Entities, or a HealOnUse event for others.

At first, I thought about just making a bunch of Systems for every type of event. An Entity would subscribe to these Systems, just like other Systems, except their Update function would do nothing. Instead, they only operated once per frame when passed an Event from the EventQueue.

I don't like this approach, because it is putting the System in charge of specific Entities, rather than operating on a collection of Entities.

Another approach I thought of was just creating a Component for each event, each of which holds a function pointer. When an event happens, such as ExplosionEvent, a list of entities in the area is given to the EventHandler, which then checks for the OnExplosionEvent component and calls the corresponding function (or maybe queues it up so all the functions can be processed in order).

I'm not too fond of this approach either, because it puts behavior into a component and it puts the EventHandler in charge of telling the Entities. Of course, I could probably just have the EventHandler pass the Event to GameWorld which then passes it to the Entities who have the needed components, but it still puts behavior into a component, which I want to avoid.

One last idea that just came to me would be to give the Entity a map of events it can listen for, something like std::map<EventID, FunctionPointer>. The entities could then be notified of Events during event handling, and their functions could be queued up. I do like this approach, but I am curious if there are any other suggested ways to handle Events pertaining to an Entity rather than a System.

sentences:
LibGDX trying to create a matrix of circles I am trying to create a circular stage like so:

But I can only make a square:

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 to get pixels affected by a light in deferred shading? I implemented deferred rendering in my little engine using framebuffers but there is no dynamic lighting for now. The g-buffer contains positions and normals in view space and albedo.

To implement real time lighting, I guess that I need to perform one pass for each light. Given the position and shape of a light, how can find all pixels affected by the light? I want to support point lights, spot lights and directional lights.

sentences:
LibGdx input data REQUIRED I am using the code below to ask users for their username.

MyTextInputListener listenerz = new MyTextInputListener();
Gdx.input.getTextInput(listenerz, "Create Username", "");

I have knowledge in PHP but beginner in Java LibGdx.
I know that in HTML there is a REQUIRED

<input name='username' required />

That's why I wanted to know the equivalent coding in LibGdx for the REQUIRED input.

sentences: Unreal Engine 4 DefaultInput.ini mappings not showing in editor The mappings from DefaultInput.ini are not showing up in the editor. I had originally added them in the editor project settings, but it lost the mappings except for 2 of them Jump and Reset VR. They still show up in the DefaultInput.ini file. How do I get the editor to recover them (or read them from the .ini file?

sentences:
Button image on game menu is updating too slow I'm using SDL2 and i'm facing a problem with my game menu buttons.

Every time i detect that the mouse pointer is over a button of the menu i update the image of the button (from MOUSE_OUT to MOUSE_OVER).When i move several times and fast the pointer over the button and then i stop pointing at it the button image keeps updating. Like if the updating of the screen were not synchronize with the update of the events.

My guest is that because i'm polling the events by using SDL_PollEvent() there still events on the queue to poll and that causes the update of the images.

How can i avoid this problem of latency between the polling of events from the poll and the update of the image?

This is the method i use to check if the pointer is over the button. The input object keeps the type of event and the event itself.

int MenuState::update(GameEngine g)
{
    state_play = MOUSE_OUT;
    state_exit = MOUSE_OUT;

    switch(input->get_type()) {
        case MOUSE_PRESSED_EVENT:
            if((input->get_x_pos() > POS_X_PLAY_BUTTON) && (input->get_x_pos() < (POS_X_PLAY_BUTTON + 400)) &&
                (input->get_y_pos() > POS_Y_PLAY_BUTTON) && ( input->get_y_pos() < (POS_Y_PLAY_BUTTON + 100))) {
                state_play = MOUSE_CLICKED;
                next_state = Game;
            }

            if((input->get_x_pos() > POS_X_EXIT_BUTTON) && (input->get_x_pos() < (POS_X_EXIT_BUTTON + 400)) &&
                (input->get_y_pos() > POS_Y_EXIT_BUTTON) && ( input->get_y_pos() < (POS_Y_EXIT_BUTTON + 100))) {
                state_exit = MOUSE_CLICKED;
                next_state = Game_Over;
            }
            break;
        case MOUSE_MOVED_EVENT:
            if((input->get_x_pos() > POS_X_PLAY_BUTTON) && (input->get_x_pos() < (POS_X_PLAY_BUTTON + 400)) &&
                (input->get_y_pos() > POS_Y_PLAY_BUTTON) && ( input->get_y_pos() < (POS_Y_PLAY_BUTTON + 100))) {
                state_play = MOUSE_OVER;
            }
            if((input->get_x_pos() > POS_X_EXIT_BUTTON) && (input->get_x_pos() < (POS_X_EXIT_BUTTON + 400)) &&
                (input->get_y_pos() > POS_Y_EXIT_BUTTON) && ( input->get_y_pos() < (POS_Y_EXIT_BUTTON + 100))) {
                state_exit = MOUSE_OVER;
            }

            break;
        default:
            break;
    }
}

This is where i poll the events.

TypeEvent InputManager::poll_event()
{
    TypeEvent t;

     if(SDL_PollEvent(e)) {
        switch (e->type) {
            case SDL_QUIT:
                input = new QuitInput(QUIT_BUTTON);
                t = QUIT_BUTTON;
                break;
            case SDL_KEYDOWN:
                input = new KeyboardInput(KEYBOARD_EVENT);
                t = KEYBOARD_EVENT;
                break;
            case SDL_KEYUP:
                input = new NoneInput(NONE_EVENT);
                t = NONE_EVENT;
                break;
            case SDL_MOUSEMOTION:
                input = new MouseInput(MOUSE_MOVED_EVENT);
                t = MOUSE_MOVED_EVENT;
                break;
            case SDL_MOUSEBUTTONDOWN:
                input = new MouseInput(MOUSE_PRESSED_EVENT);
                t = MOUSE_PRESSED_EVENT;
                break;
            default:
                input = new NoneInput(NONE_EVENT);
                t = NONE_EVENT;
                break;
        }
        input->set_input(e);
        return t;
    }
    return NONE_EVENT;
}

This is my first try in order to make an input system and is not complete or totally optimal.

Thanks in advance!

sentences:
Setting bounds to a label in libgdx textStyle = new LabelStyle();
textStyle.font = font;
textStyle.fontColor=Color.GREEN;

EnterTextCasheir= new Label("",textStyle);
EnterTextCasheir.setBounds(AssetsHelper.convertWidth(158),
        AssetsHelper.convertHeight(162),
        AssetsHelper.convertWidth(180),
        AssetsHelper.convertHeight(55));
EnterTextCasheir.setWrap(true);
EnterTextCasheir.setFontScale(1f, 1.5f);
EnterTextCasheir.setSize(CashierCounterEnterBoxZoomImage.getWidth(),
        CashierCounterEnterBoxZoomImage.getHeight());

table4.addActor(EnterTextCasheir);

EnterTextCasheir.addListener(new InputListener() {
    private boolean EnterTextCasheirBol;

    public boolean touchDown (InputEvent event, float x, float y, int pointer, int button) {
        if(!EnterTextCasheirBol)
        {
            EnterTextCasheirBol = true;
            Gdx.input.getTextInput(new TextInputListener() {
                private String CasheirBoxStg;

                @Override
                public void input (String text) {
                    EnterTextCasheirBol = false;
                    EnterTextCasheir.setText(text);

                    CasheirBoxStg = (String) text;
                }
            }
        ...
        }
    }
}

Its my brief code;I am not able to display the text into single line ;its coming in 2 lines can anyone help me to resolve.Thank you

sentences:
Getting sprites to move exactly the same on different devices Background

When moving a sprite along the X axis, this is my code:

spriteXReal = spriteXReal + (spriteXVel * dt);  //.5 would be halfway point of, 1 would be right hand side screen etc...
spriteXScreen=spriteXReal*deviceWidth;

And the spriteXVel value above is worked out as:

spriteXVel = 1/spriteXTime;

So I would set spriteXTime to 10 if I wanted my sprite to work it's way across the screen in 10 seconds.

My code:

Uses a fixed delta time
Has tics per second capped at 60 (so my delta is 1/60)

The issue

This is great and works well, however, I am getting odd results when running on a different device (with a different screen res).

When comparing the 2 devices (simply by starting the game on both devices at the exact same time, they are almost identical save for a tiny difference in speed.

The game world is tile based. Let's say the play area on my development device is 16 tiles wide.  16 tiles fit perfectly onto this device So, if I'm moving between 8 tiles, I'm effectively crossing 1/2 of the screen.

Initially, the sprite appears to move the same on both devices, (going back and forth between say the 1st 'proper' tile and the 8th 'proper' tile), but after about 25 seconds, they are clearly out of sync.

On this device, the tiles would look something like this:

So, I'm working out my sprite movement using the device's width as above.

However, if the tiles don't fit exactly, I'm centering the original tiles and adding 'padding' tiles to the play-area like so:

Therefore, my confusion lies in how I should be working out my sprite's new position.  because, now 8 tiles is actually less than 1/2 of the device's screen.  So should I still be using the code above or something like this:

spriteXScreen=spriteXReal*(Block18X - Block2X);

I have actually tried both and when I did, the problem was still evident, so I'm not sure which one I'm supposed to be using.

What is really odd is that when I set my sprite's Time variable to certain amounts, it appears that everything stays in perfect sync between these 2 devices so I'm completely stumped - that's what I've observed thus far anyway.  I'm going to test that theory a bit more.

What else could be causing this discrepancy?!

Really appreciate some help with this one!

Edit

I've pretty much tried everything I can, I've even tried implementing a very simple 'test' game loop that updates sprite positions once every second, and put the two devices side by side, however, the Samsung Galaxy Ace Always runs ahead of the Google tablet, is it possible that System.CurrentTimeMillis(); is actually running faster on the Ace than on the tablet?

sentences:
Getting Past "Boring" Content Creation When I'm creating games, I really love the coding part -- designing, developing the main functionality and "core" part of the game. However, most of my games are reasonably small/easy in terms of coding, but require a lot of content -- whether graphics, levels, sounds, puzzles, story narrative, etc.

I find development speeds through the coding parts, but nearly halts when it comes to content creation -- it's tough, sometimes boring work.

What can I do to make content creation quicker and more interesting/fun? I'm already integrating content into a working game, and building/using tools as much as possible to quickly assemble my content.

Edit: my question is not about learning any particular labor-/time-intensive skills like drawing assets or picking out sound effects; it's about that psychological hurdle when you have to just sit down and grind out the rest of your game, even if it's not the most fun thing in the world to do.

sentences:
How do I prevent clicking at the end of each sound play in OpenAL? I have put together a basic sound handler class for use in my game. It uses OpenAL.

It's a simple method at the moment to play sounds - here's an extract from a switch block:

case "EATEN_PILL":
    wavPath = "D:\\Programming\\SFX\\EATEN_PILL\\Hit_43.wav";
    ALfilename = Path.Combine(Path.Combine("Data", "Audio"), wavPath);
    sound_data = LoadWave(File.Open(ALfilename, FileMode.Open), out channels, out bits_per_sample, out sample_rate);
    buffer_EATEN_PILL = AL.GenBuffer();
    AL.BufferData(buffer_EATEN_PILL, GetSoundFormat(channels, bits_per_sample), sound_data, sound_data.Length, sample_rate);
    AL.Source(source, ALSourcei.Buffer, buffer_EATEN_PILL);
    AL.SourcePlay(source);

    break;

Problems:
1. An annoying click at the end of each sound.
2. Eventually sound stops playing completely. This is after perhaps playing 100 sounds.

Has anyone hit this problem before?

sentences:
What are some ways to texture map a terrain? I'm working with XNA on a 3D Game, and I'm trying to have a proper and nice environnement.
I actually followed a tutorial to create a terrain from a heightmap. To texture it, I just apply a grass texture on it and tile it a number of times.

But what I want to do is to have a really realistic texturing, but also generate it automatically (for example if I want to use Perlin noise to generate a terrain and then texture it).

I already learned about multi-texturing, loading a map file with different colors for different textures, but I don't think this is really efficient, for instance for cliffs or very steep areas it will tile a texture badly as it's a view from the top.
(Also, I don't know how I'll draw roads or dirt paths with that.)

I'm looking for an efficient solution to realistically texture mapping procedurally-generated terrain.

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: How do I come up with the game mechanics for a puzzle game? I want to make a puzzle game, but I don't know how to start. I have observed that each puzzle game has a core mechanic that enables opportunity for numerous puzzles. I'm not sure how to think of ideas. I was wondering how to come up with ideas for my game. I do not want any of your ideas because I want the game to be original.

sentences: What is a good clock implementation for a multiplayer game? In cases where players need to send out their times for game state sync, can everyone send out their default timestamp implementation or should something like NTP be used? http://en.wikipedia.org/wiki/Network_Time_Protocol

sentences:
Unity 5.5 - Modify image of a button from an array of images via script - Logic Help Right now i have this:

Is a placeholder for what i want to do. This blue circles are images in different buttons, i have a blue image circle for every letter. I have to display the correct letter image to create a word. For example: word: "DOG" and the word is created by the "D" "O" "G" images.

That is the logic i cannot get my head around.

How can I, via script, select which image to show depending on the word given?

IDEAS:

I have an array of (INDEX, "letter") in my GameController.CS. Maybe i can add a number to the different images name. Separeate the word in characters. Look the position of this character in the Letters[] and that number turn it into a string and find the image with that number in the name.

I really need help to figure this out.

Thanks in advance for any help.

sentences:
Separating data from model and successfully visualizing it This is a bit of a design question that I'm struggling with. I have a data model and an entity model. The data model is, of course, what is (de)serialized to represent my levels and entities within it, whereas the entity model is the run-time manifestation of the level actually being played.

In addition, I have a game editor that allows the levels to be edited and played all in the same UI. It has 2 modes, each with 2 views:

Design-time Mode:

a top-down, interactive view of the level. This is where the actual editing of the level takes place.
an in-game preview of the level that updates as changes are made in the top-down view

Run-time Mode:

a top-down view of the level that is non-interactive but live
an in-game, run-time view of the game that is interactive. ie. you can actually play the game.

The user switches between the modes by clicking play & stop buttons. Here's an example of my top-down view (this one is run-time):

Now, here is the problem: I want the design-time top-down view to mimic the run-time top-down view as much as possible, but certain information is unknown at design time, such as the texture dimensions and collision circle information. Therefore, I cannot render this information accurately.

I see these options for dealing with the situation:

don't try and mimic the run-time, top-down visualization. Instead, just render something that is as useful as I can make it given the limited information I have available.
hack my data model so that it also returns information that it really has no business knowing, such as the collision circles and texture dimensions. This would facilitate the visualization of that information, but at the cost of maintenance and code design.
since my design-time mode already has two views, one of which is a manifestation of my data model, and the other is a manifestation of my entity model, I could dynamically try to correlate that information for the purposes of my top-down visualizer. This seems like it should work, but also seems rather messy and error-prone.

This seems like it must be a fairly common problem when writing game editors, so I thought I'd try to gather some advice. Any input from the community would be much appreciated.

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:
cocos2d-x: Cache draw I'm drawing a circle using DrawNode.

Is there a way to cache that drawing into Sprite or put it to SpriteFrameCache for later use? Because drawing the circle again each time might slow the game down.

sentences:
Why can't my A* implementation find a path out of an open room? I tried to follow this article with the following example, but in my attempts it always ends up with a dead end.

If we take G being 10 in a straight line or 14 in a diagonal, and H the distance in horizontal or vertical to the target point, then we restart this search for every tile that is the nearest one to the target point.

I have this result: if we take one or the other direction with 54, it ends up with a dead end. For example, if we go up from 40 to 54, then to 60, when we restart the search with G and H, it ends up with "4" (second shema) and comes back in a dead end:

Why does this happen and how can I solve it?

I also looked at the wiki, but I did not understand the system with the colors and the code shown.

sentences:
Translating object from y to y smoothly in Unity 2D I am trying to make a game that has an object on screen, which moves from one Y coordinate to another. Right now, I do it through translations, but that does it instantly. I want to do this as a kind of animation, where it transitions smoothly from one Y coordinate to another. What should I do?

Here is an image of what I'm talking about:

sentences:
How to make an object towards the mouse on one Axis - Gamemaker Studio 2 I am trying to have my "obj_playership" move towards the Cursor on a single Axis.
Prefer it to be the Vertical Axis.
I tried doing this is an "Execute Code Box" in a step event

"direction = mouse_x"
"speed = 1          "
but the movement looks weird and does not do what I am trying to do.

To better refine my question I'm trying to have my "obj_playership" move just up and down in relation to the mouse, so if I'm moving my mouse up or down the obj_playership" will follow towards the mouse either up or down.

sentences:
XNA Render Targets Depth Testing I imagine this is a problem that gets asked quite often, but reading up on it I can't seem to get a definitive answer on how to solve it.

I've got two HLSL shaders (I've simplified them in the example to just output a colour) that require RenderTargets.  For example Blur shaders.

There are two balls spinning around a central point.  As they spin, one passes between the other and the camera occluding the other ball and vice versa.

If I render them both to the same rendertarget (using the same technique) they obviously share a depth buffer, and the depth testing happens correctly.

However, when I need to use different techniques to render each ball seperately (one ball to one rendertarget and the other ball to a different) and then try to composite them depth testing fails and they are just rendered on top of each other.

Attach is the code I'm using.  I've simplified it down a lot, but it indicates the problem I'm having.

How do I go about rendering two different objects, using two different techniques to two different rendertargets and then composite them?

DepthTesting.cs

effect.fx

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:
What's the difference between Mathf.Lerp and Mathf.SmoothDamp I want to smoothly go from one value to a new one (moving a slider or changing color). I tried using both functions and they all basically give the same result. What is the difference between them and which one should I use?

How I used SmoothDamp:

    // Show the HUD
private IEnumerator ShowHUD() {
    var HUDCanvasGroup = GameObject.FindWithTag("HUD").GetComponent<CanvasGroup>();
    var alphaValue = 1f;
    var velocity = 0f;
    var time = 0.30f;

    yield return new WaitForSeconds(1.5f);

    // Gradually fade in the canvas
    while (!Mathf.Approximately(HUDCanvasGroup.alpha, alphaValue)) {
        HUDCanvasGroup.alpha = Mathf.SmoothDamp(HUDCanvasGroup.alpha, alphaValue, ref velocity, time);
        yield return null;
    }

    HUDCanvasGroup.alpha = 1; // Since float is not accurate, manually set the alpha to 1 after
    HUDCanvasGroup.interactable = true;

    var blur = GameObject.FindWithTag("BlurryCamera").GetComponent<BlurOptimized>();
    blur.enabled = true;
}

How I used Lerp:

public static IEnumerator Dim() {
    while (t < 1) {
        t += Time.deltaTime / 0.4f;
        dimRend.material.color = Color.Lerp(undimColor, dimColor, t);
        yield return null;
    }
}

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: How to check if renderer is not empty? I have a SDL_Renderer in SDL2 that I use both to render textures on screen and to render textures on textures, my problem is that when I render to texture the renderer may have some content in it which needs to be drawn, but if it's empty and I call SDL_RenderPresent() on it the screen flickers. So how can I check if there's something drawn inside the renderer?

sentences:
Decreasing distance for a Configurable Joint at run-time | Unity I have written a script that uses ConfigurableJoint to connect a ball to a hing so that it moves in a fixed circular path around the hinge. The problem is that I want to decrease the distance between hinge and ball with time. In other words, I wamt to reduce the radius of circular path on which the ball is moving.

I have created a rough image to demonstrate what I'm trying to do

And below is the code that I am using to create the joint:

     joint = gameObject.AddComponent<ConfigurableJoint>();

     joint.anchor = transform.transform.InverseTransformPoint(closestHinge.position);

     joint.xMotion = ConfigurableJointMotion.Locked;
     joint.yMotion = ConfigurableJointMotion.Limited;
     joint.zMotion = ConfigurableJointMotion.Locked;

sentences:
Implementing directional lighting in voxel based polygon-engine I'm having trouble implementing directional lighting.
(I'm not that familiar with 3D.)

The problem is that the lighting does not "follow/flow with" the other blocks next to them.

How should I fix this.

At the moment all vertices have there own normals.

Should I combine or re-position normals if the blocks are next to each other?

(I tried combining the normals but then it just looks like a plain, as if its just one color.)

Should I maybe do that kind of behaviour with shadows and is directional lighting specifically for ambient lighting and not so much for diffused lighting?

This is a little bit of the code that contains the normals (the last 3 values).

        {0, {x * BLOCK_RENDER_SIZE                    , y * BLOCK_RENDER_SIZE                    , z * BLOCK_RENDER_SIZE                    , getBlockColor(), -1.0f, -1.0f, -1.0f}},
        {1, {x * BLOCK_RENDER_SIZE                    , y * BLOCK_RENDER_SIZE + BLOCK_RENDER_SIZE, z * BLOCK_RENDER_SIZE                    , getBlockColor(), -1.0f,  1.0f,  1.0f}},

        {2, {x * BLOCK_RENDER_SIZE + BLOCK_RENDER_SIZE, y * BLOCK_RENDER_SIZE + BLOCK_RENDER_SIZE, z * BLOCK_RENDER_SIZE                    , getBlockColor(),  1.0f,  1.0f, -1.0f}},
        {3, {x * BLOCK_RENDER_SIZE + BLOCK_RENDER_SIZE, y * BLOCK_RENDER_SIZE                    , z * BLOCK_RENDER_SIZE                    , getBlockColor(),  1.0f, -1.0f, -1.0f}},

        {4, {x * BLOCK_RENDER_SIZE                    , y * BLOCK_RENDER_SIZE                    , z * BLOCK_RENDER_SIZE + BLOCK_RENDER_SIZE, getBlockColor(), -1.0f, -1.0f,  1.0f}},
        {5, {x * BLOCK_RENDER_SIZE                    , y * BLOCK_RENDER_SIZE + BLOCK_RENDER_SIZE, z * BLOCK_RENDER_SIZE + BLOCK_RENDER_SIZE, getBlockColor(), -1.0f,  1.0f,  1.0f}},

        {6, {x * BLOCK_RENDER_SIZE + BLOCK_RENDER_SIZE, y * BLOCK_RENDER_SIZE + BLOCK_RENDER_SIZE, z * BLOCK_RENDER_SIZE + BLOCK_RENDER_SIZE, getBlockColor(),  1.0f,  1.0f,  1.0f}},
        {7, {x * BLOCK_RENDER_SIZE + BLOCK_RENDER_SIZE, y * BLOCK_RENDER_SIZE                    , z * BLOCK_RENDER_SIZE + BLOCK_RENDER_SIZE, getBlockColor(),  1.0f, -1.0f,  1.0f}}

(I didn't add more code because I don't think its necessary)

sentences:
Specific bone not present in the skeleton XNA I have created a human mesh, bone structure, and animation rig in 3ds max for an XNA game I am developing for school. I am currently having a problem with one specific bone upon build in Visual Studio. It's the 3rd bone of the right pinky and I have promptly named it "The Problem Bone".

The build is giving me this error:

Vertex is bound to bone "The Problem Bone", but this bone is not present in the skeleton.

I've checked the skeleton many times to confirm that the bone does exist. The skeleton hierarchy root is the pelvis bone and I verified that no bone was being ignored due to the mesh having more than one skeleton which is usually the cause of this problem.

After reading the .fbx file, I found that the XNA was building the bones starting with the pelvis, then going down the right leg, then the left leg, then the spine up to the head, and then the right arm which where my problem area is.

As we can see in the schematic view, the problem bone is linked to a previous successfully built bone.

The bones are controlled by splines, point helpers, and IK chains through linking and constraining. I don't think that these are the problem since other bones driven by the controllers were successfully built before the problem bone.

So the other bones up until the 3rd bone of the right pinky are being built correctly which gives me the feeling that I'm close to a solution and it's something small impeding my progress.

Does anyone know why I am getting this error?

Exporting from 3ds Max Process:

Select only the bones and the mesh
File > Export > Export Selected
Save as .fbx
Current .fbx export dialog window

sentences:
How can I add these bones to my meta human? Or is there a way I can make virtual bones count when retargetting? Paid for animations thinking they would be fine and they mostly are but... the hands are using these IK bones that I do not have. Is there a way I can add the bones to my meta skeleton within unreal? I tried creating virtual bones but they dont seem to come up in the retarget manager :( Also, I can only seem to add one virtual bone to the root whereas both the foot and hand IK root bones are parented to the root bone here.

Any help would be massively appreciated!

sentences:
(XNA) 3D Model Rotation Angles I'm currently in the process of making a 3d "semi" top down game, the camera comes in at a very high angle near 90 to show off the 3d models. I have a main character which can move in 4 axis (up, down, left right) using the arrow keys. I'm trying to create a smooth rotation between each of the axis so that when you press right when the character faces up, his rotation just doesn't jump.

Rotations seem to be weird and I don't quite understand why MathHelper.ConvertToDegrees or Radians doesn't quite give me what I want. When I try to rotate the model, I am translating it back to the origin, rotating then translating back for my order of matrices.

Although what I've found is that for rotation in the Z-axis, 0f seems to be down, 1.6f seems to be right, 3.2f seems to be up and 4.8f seems to be left. So to translate smoothly what I do is say I'm facing up (3.2f) and I want to face, right: Rotation.Z > 1.6 so, while it's greater keep subtracting 0.08f until we reach 1.6 or lower. This works well.

BUT my problem lies in since down is 0 and left is 4.8, when you're facing left and want to face down, you rotate clockwise all the way back to down instead of the logical counter-clockwise. This only happens in left to down or vice versa.

I've thought long and hard about this, down can also be expressed by 5.4f I assume but that doesn't really solve my problem. The approach for going down looks like this:

    else if (currentKeyState.IsKeyDown(Keys.Down))
    {
        //Rotate character to face this direction
        if (rotation.Z != 0)
        {
            if (rotation.Z < 0)
            {
                rotation.Z += 0.08f;
            }
            else if((rotation.Z > 0))
            {
                rotation.Z -= 0.08f;
            }
        }

Since for the left rotation, the rotation.Z value will be 4.8, then by this logic it'll going counter-clockwise. It's probably a simple solution but it has me stumped and one of my biggest problems is not moving on until a problem is fixed even if the game still works.

I've attached a picture of the axis just in case my post is nonsensical:

Look forward to any potential solutions.

sentences:
How do I rotate a camera around the Y axis of the object it's looking at? I'm making a camera that can currently rotate freely from the back to the front of a target object by giving it an angle and a distance.

I do the above with the following code

directionVector = new Vector3(0, Mathf.Sin (angle*Mathf.Deg2Rad), Mathf.Cos(Mathf.Deg2Rad * angle));
normalizedDirectionVector = (directionVector).normalized;

transform.position = (normalizedDirectionVector*cameraDistance) + target.transform.position;

In the above I take the direction from the angle, normalize it and then add it to the target position. And the camera sets nicely to the wanted angle. But how can I add the sideways movement(x-component) so that I could move the camera freely around the target?

sentences:
Process for developing psd images into animation I wrote a kids' picture book that I want to make into an iPad app and iPhone app.

(More of a story than a game, but same principles, I guess.)

Here's a sample page: https://img.skitch.com/20120108-bqusir4xt3hhxx5fufhh7pw4wy.jpg

(There are words on each page -- I've just scrubbed them out on the image for this example.)

All the images are in Photoshop.

I want to make an app of the book for iPads and other tablets.

For the app, I'd like to add a little animation on each page. Things like fish changing their expressions. Some interaction. Fish swimming on some pages, and other stuff.

I want to know who I should recruit to do the animation:

The illustrator who did the original images normally doesn't do animation.

Since that illustrator doesn't normally do animation, I guess I need to get an animator on board for the project -- what skills am I looking for in that person?

(Obviously they need to know how to make an animation, but what technology etc will they need to know?)

To draw the different frames for the animation, would I need to employ the same illustrator who did the original images, or would a good illustrator be able to do that, based on the images that already exist?

(The illustrator who did the original images is available, but I'd need to wait a while for her to be able to fit the job in.)

The images don't exist as vector files -- they are Photoshop bitmap. Is this an issue?

Thanks, Richard

sentences:
How to get surrounding tiles in a tile array I've created a tiled map that holds two layers, one for the tile type, and the other for whether it is solid or not. I plan on creating very big maps, and checking every tile seems like it would slow down my game immensely.

So lets say I had an array of integers. "0" representing solid, and "1" representing not solid. How would I check only the 8 surrounding integers instead of the whole array each update.

0 0 0

0 1 0

0 0 0

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:
LibGDX Box2D, how to play an animation once, then set the state back So, I've got some animations in LibGDX that I want to get running. Currently, the walking animations work perfectly, but attacking doesn't. I want the attack animation to play once, then set the State back to WALKING.

I've been experimenting with attacking upward (that's why the code's different), and all it does is flash and go back to walking. The other three directions show only the last frame of the animations, and holds it there. Does anyone know how to get this to work? I've looked at the similar questions, but none of them are helping.

There's a lot of code in this method, so I apologize in advance:

private TextureRegion getFrame(float dt) {
        TextureRegion region = null;
        if (currentState == State.WALKING) {
            switch (currentDir) {
                case UP:
                    if (b2body.getLinearVelocity().x == 0 && b2body.getLinearVelocity().y == 0) {
                        stateTimer = 0;
                        region = heroWalkUp.getKeyFrame(stateTimer, false);
                        stateTimer = 1;
                    } else {
                        region = heroWalkUp.getKeyFrame(stateTimer, true);
                    }
                    break;
                case RIGHT:
                    if (b2body.getLinearVelocity().x == 0 && b2body.getLinearVelocity().y == 0) {
                        stateTimer = 0;
                        region = heroWalkRight.getKeyFrame(stateTimer, false);
                        stateTimer = 1;
                    } else {
                        region = heroWalkRight.getKeyFrame(stateTimer, true);
                    }
                    break;
                case LEFT:
                    if (b2body.getLinearVelocity().x == 0 && b2body.getLinearVelocity().y == 0) {
                        stateTimer = 0;
                        region = heroWalkLeft.getKeyFrame(stateTimer, false);
                        stateTimer = 1;
                    } else {
                        region = heroWalkLeft.getKeyFrame(stateTimer, true);
                    }
                    break;
                case DOWN:
                default:
                    if (b2body.getLinearVelocity().x == 0 && b2body.getLinearVelocity().y == 0) {
                        stateTimer = 0;
                        region = heroWalkDown.getKeyFrame(stateTimer, false);
                        stateTimer = 1;
                    } else {
                        region = heroWalkDown.getKeyFrame(stateTimer, true);
                    }
                    break;
            }
        } else if (currentState == State.ATTACKING) {
            switch (currentDir) {
                case UP:
                    region = heroAtkUp.getKeyFrame(stateTimer, true);
                    if (heroAtkUp.isAnimationFinished(stateTimer)) {
                        currentState = State.WALKING;
                    }
                    break;
                case LEFT:
                    region = heroAtkLeft.getKeyFrame(stateTimer);
                    break;
                case RIGHT:
                    region = heroAtkRight.getKeyFrame(stateTimer);
                    break;
                case DOWN:
                    region = heroAtkDown.getKeyFrame(stateTimer);
                    break;
                default:
                    region = heroWalkDown.getKeyFrame(stateTimer); //should never happen
                    break;
            }
        }

        stateTimer = currentDir == previousDir ? stateTimer + dt : 0;
        previousState = currentState;
        previousDir = currentDir;
        return region;
    }

sentences:
OpenGL texture2d/image sampling issue. Strange artifacts in texture I have an issue when using textures in OpenGL, strange artifacts occur where geometry overlaps, but not always.
Video Reference. I am using a GL_TEXTURE_2D with GL_ARB_image_load_store to make a custom depth test shader that stores material data for opaque and transparent geometry. The video given shows the artifacts occur where the support structure for a table is occluded behind the top of the table, but strangely, not occurring where the base of the table is occluded by the support.
#version 450 core

in VS_OUT {
    vec3 Position;
    vec3 Normal;
    vec2 TexCoords;

    mat3 TanBitanNorm;
} fs_in;

// Material data
uniform sampler2D uAlbedoMap;
uniform sampler2D uNormalMap;
uniform sampler2D uMetallicMap;

// Material info out
layout(rgba16f) coherent uniform image2D uAlbedoDepthOpaque;
layout(rgba16f) coherent uniform image2D uNormalMetallicOpaque;
layout(rgba16f) coherent uniform image2D uAlbedoDepthTransparent;
layout(rgba16f) coherent uniform image2D uNormalAlphaTransparent;

// Depth info in/out
layout(r8) uniform image2D uDepthBufferOpaque;
layout(r8) uniform image2D uDepthBufferTransparent;

void main() {
    vec3 n_tex = texture(uNormalMap, fs_in.TexCoords).xyz;
    n_tex = n_tex * 2.0f - 1.0f;

    ivec2 tx_loc = ivec2(gl_FragCoord.xy);
    const float opaque_depth = imageLoad(uDepthBufferOpaque, tx_loc).r; // Stored depth of opaque
    const float trans_depth = imageLoad(uDepthBufferTransparent, tx_loc).r; // Stored depth of transparent

    // Depth processing
    if (gl_FragCoord.z > opaque_depth) {
        bool tran = false;
        if (trans_depth > opaque_depth)
            tran = trans_depth > gl_FragCoord.z;
        else
            tran = true;

        // Transparent
        if (texture(uAlbedoMap, fs_in.TexCoords).a < 1.0f && tran) {
            imageStore(uDepthBufferTransparent, tx_loc,
                vec4(gl_FragCoord.z));

            imageStore(uAlbedoDepthTransparent, tx_loc,
                vec4(texture(uAlbedoMap, fs_in.TexCoords).rgb, gl_FragCoord.z));
            imageStore(uNormalAlphaTransparent, tx_loc,
                vec4(abs(length(n_tex) - 1.0f) > 0.1f ? fs_in.Normal : normalize(fs_in.TanBitanNorm * n_tex), texture(uAlbedoMap, fs_in.TexCoords).a));
        }

        // Opaque
        else {
            imageStore(uDepthBufferOpaque, tx_loc,
                vec4(gl_FragCoord.z));

            imageStore(uAlbedoDepthOpaque, tx_loc,
                vec4(texture(uAlbedoMap, fs_in.TexCoords).rgb, gl_FragCoord.z));
            imageStore(uNormalMetallicOpaque, tx_loc,
                vec4(abs(length(n_tex) - 1.0f) > 0.1f ? fs_in.Normal : normalize(fs_in.TanBitanNorm * n_tex), texture(uMetallicMap, fs_in.TexCoords).r));
        }
    }

    if (opaque_depth == 0.0f) {
        imageStore(uDepthBufferOpaque, tx_loc,
            vec4(0.125f));
    }

    else {
        imageStore(uDepthBufferOpaque, tx_loc,
            vec4(0.125f + opaque_depth));
    }
}

Render with overlapping geometry shows that artifacts still occur outside of reading from the texture. Also in the video, I move the camera back and forth (with orthographic projection) and the artifacts become brighter and darker. Render with overlapping geometry w/out depth processing shows that the brighter/darker values were from the depth test.
Any ideas on why this occurs, and how can I fix it?

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:
SocketException: No connection could be made because the target machine actively refused it I am working on connecting a client to a server using socket connection. I have a button, when I click on the button, it's giving the below exception in Unity.

"SocketException: No connection could be made because the target machine actively refused it.".

What will be the issue? Can anyboady help me out? Below is the code I have written for connecting to the server:

internal Boolean socketReady = false;
NetworkStream theStream;
StreamWriter writer;
StreamReader reader;
try{
        connect = new TcpClient (host, port);
        theStream = connect.GetStream ();
        writer = new StreamWriter (theStream);
        reader = new StreamReader (theStream);
        return true;
        //socketReady = true;
    }
    catch(ObjectDisposedException) {
        return false;
    }

sentences:
3D: How how handle like 500 NPC I'm currently working on a 3D game. My game have like 10 NPC's and a really small world.
But if I want to have a larger world with lots of NPC's? I think it's not a good idea to update and check collision with NPC's that is far far away from the hero.

So any tip on how to handle things that are outside the hero's sight.

sentences:
GetCurrentAnimatorStateInfo(0) returns animation hash which is not found in list of animations I trigger the animation "hg reload g2f" from "Any State" using a trigger.
Here is a screenshot of my animator:

I would now like to detect if the  animation is still being played.
To do that, I have tried the following approaches. None of them returned True while the animation is being played:
void LateUpdate()
{
    Debug.Log(_animator.GetCurrentAnimatorStateInfo(0).IsName("hg reload g2f") + "\n");
    Debug.Log(_animator.GetCurrentAnimatorStateInfo(0).IsName("6 Reload Pistol") + "\n");
    Debug.Log(_animator.GetCurrentAnimatorStateInfo(0).IsName("Base.hg reload g2f") + "\n");
    Debug.Log(_animator.GetCurrentAnimatorStateInfo(0).IsName("Base.6 Reload Pistol") + "\n");

I have then tried a different approach which gives me deeper insights of what is currently being played:
At void Start(), I build a dictionary of the animations in the animator like that:
private void pBuildAnimationNameTable()
{
    _NamesTable = new Dictionary<int, string>();

    foreach (AnimationClip nClip in _animator.runtimeAnimatorController.animationClips)
    {
        _NamesTable[Animator.StringToHash(nClip.name)] = nClip.name;
    }
}

And then at LateUpdate, I call the following:
public string GetCurrentAnimatorStateName()
{
    if (_animator == null)
    {
        Debug.Break();
        return "nothing assigned yet";
    }

    AnimatorStateInfo stateInfo = _animator.GetCurrentAnimatorStateInfo(0);

    string sStateName;
    if (_NamesTable.TryGetValue(stateInfo.shortNameHash, out sStateName))
    {
        return sStateName;
    }
    else
    {
        return "Unknown animator state name.";
    }
}

However, it doesn't find the current animation's hash in the list:

What might be the reason why it's not found in the list of animations?

sentences:
simple 2d car AI unity I have a top down Car Game. how can I implement AI for the Cars? how the car follow the way points?
I want AI cars also rotate itself along the path.

I tried this solution

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

public class waypoint : MonoBehaviour {

    public List<Transform> waypoints;
    private Transform currentWaypoint;
    public float speed = 5f;
    private float closeEnouth = 0.5f;
    int point = 0;

    void Start()
    {
        currentWaypoint = waypoints[point];
    }
    // Update is called once per frame
    void Update()
    {

        Quaternion rotation = Quaternion.LookRotation(waypoints[point].position - transform.position, transform.TransformDirection(Vector3.forward));
        transform.rotation = new Quaternion(0, 0, rotation.z, rotation.w);
        float dist = Vector3.Distance(waypoints[point].position, transform.position);
        transform.position = Vector3.MoveTowards(transform.position, waypoints[point].position, Time.deltaTime * speed);
        if (Vector3.Distance(this.transform.position, waypoints[point].position) < closeEnouth)
        {
            if (point + 1 < waypoints.Count)
                point++;

        }
    }
}

and the car moved in the path but it moves reversed and if arrives the final node it stops and corrects its direction and console displays "Look rotation viewing vector is zero" error.

Thanks in advance

sentences: Javascript keyDown - no event approach I'm making game in JavaScript. I have canvas for drawings and game loop. I'd like to make method readKeyboard, in game loop, to check if there is any pressed key. I don't want to attach event to canvas, because it doesn't fit game loop design. Maybe I should attach this event? What is the best solution?

sentences:
Efficient movement of units to different points with different speeds I have a series of units and have been given 2d points that they must go to. However they are free to go to what point they like as long as all the units get to all the points  in the quickest time possible. Each unit has its own speed.

What is the best algorithm if I ignore unit collisions and terrain is perfectly flat with no obstacles.

sentences:
Creating color texture from greyscale heightmap in shader I'm trying to create a shader that takes a grayscale map as input, and returns a colored albedo that I want to use as texture for my PCG planets, I think that the code below should work, but it only produces flatly white objects.

I'm a total shader noob, so I'm terribly sorry if I'm missing something obvious here.

    Shader "Custom/Planet" {
    Properties{
        _height("HeightMap", 2D) = "white" {}
    }
    SubShader{
        Tags { "RenderType" = "Opaque" }
        LOD 200

        CGPROGRAM
        // Physically based Standard lighting model, and enable shadows on all light types
        #pragma surface surf Standard fullforwardshadows

        // Use shader model 3.0 target, to get nicer looking lighting
        #pragma target 3.0

        struct Input {
            float2 _heightMap;
        };

        float minHeight = 0;
        float maxHeight = 1;

        float inverseLerp(float a, float b, float v) {
            return saturate((v - a) / (b - a));
        }

        //UNITY_INSTANCING_CBUFFER_START(Props)
        //UNITY_INSTANCING_CBUFFER_END

        void surf (Input IN, inout SurfaceOutputStandard o) {
            float hv = inverseLerp(minHeight, maxHeight, IN._heightMap);
            o.Albedo = hv;
        }
        ENDCG
    }
    FallBack "Diffuse"
}

sentences:
Depth sorting 2D textures in a batch with OpenGL ES 2.0 I have a combo of texture atlases and sprite batches in an OpenGLES 2.0 2D game I'm developing which is working well, but I have a problem with depth sorting.

I'm using atlases to reduce the number of texture bind operations, and sprite batches to reduce the number of draw calls and everything is rosy but I've hit a logical problem when it comes to how to arrange the sprites in the game.

Because the whole point of using the atlas together with the batch is to save on bind/draw calls I inherit a limitation that I can't draw sprites in the same batch which have textures across multiple atlases.

This means I have to think carefully about the z ordering of the 2D sprites.  If sprite "A" should sit behind sprite "B" then I have to draw sprite A's batch first.. ok fine.  The problem arises when there are three sprites, A,B and C where A is behind B and B is behind C but A and C are on the same atlas.

That is,

Atlas 1
---------
| A | C |
---------

Atlas 2
-----
| B |
-----

Scene
-----------------------
[CAMERA] -> C -> B -> A

Now obviously I could achieve this with multiple bind/batch operations but that kind of defeats the purpose of having it in the first place.  Ideally I don't want to have to think about which sprite is on which atlas and just change the 'z' value for the sprite.

I experimented with enabling GL_DEPTH_TEST but most of my sprites use textures with some level of transparency so this won't work for me.

Is there a "standard" approach to this?  Or have I painted myself into a corner I should never have?

sentences:
What are the newest alternative to all-in-one game engines? I have been seaching a while for recent alternative to engines like unity or unreal, however, I haven't found one actively maintained that meet my needs.

For instance, I tried irrlicht with maps editors such as 3D world studio or irrEdit, but those didn't have any big feature update since 2010.

That is why I'm looking for new alternatives, here are my constrains :
- Language : C, C++ or JAVA
- Able to render 2D sprites in 3D world ( like the battles of agarest)
- Native Bumpmap support
- Lightweight
- Run both on linux and windows
- Compatible with free or low-cost map editors
- Able to do Borderless fullscreen

sentences:
Stock Game Ranking System I'm currently making a stock game where the user can buy fictional stocks. Upon registering the user will receive 1.000.000 DKK (danish krone) to spend on stocks.

I'm trying to create a ranking system, but I found this to be more difficult than I had imagined.

By giving the user 1.000.000 at the start of the game it's hard to evaluate how good a player is doing when compared to an inactive player.

Thing is, a player could sign up and receive the money and then do nothing else and (probably) do better than a lot of the people who get negative. In this way, inactive players are rewarded for doing nothing and will look better on the scoreboard.

Is there a good way to avoid this?

sentences:
I'm trying to write a randomly patrolling AI for my 2D Platformer I'm trying to write a randomly patrolling AI for my 2D Platformer. The AI already has a ground checker function which checks if there are tiles nearby or not. What I want to do is randomize its actions and create an illusion of a somewhat "sentient" enemy. What I tried to create below is using the built in RNG to make the enemy either jump, change direction, or keep moving.
The problem is, it doesn't seem to work properly. The enemy just jumps every second I want it to change behaviour. The change direction functions, however, don't occur as frequently. I need to know what I've done wrong here. Thanks.
void Update()
{
      //RNG
      behaviour = Random.Range(0,3);
      jumpSpeed = Random.Range(1,5);

      //clock
      timer += Time.deltaTime;
}

  //time
    private float waitTime = 2.0f;
    private float timer = 0.0f;

 void MoveRandomizer()
{
    if((Mathf.Round(timer%waitTime)) == 0)
    {
        if(behaviour == 0)
        {
        movingRight = false;

        }
        if(behaviour == 1)
        {
        movingRight = true;

        }
        if(behaviour == 2)
        {
        rb.velocity = new Vector2(rb.velocity.x, jumpSpeed);
        }
    }

}

sentences: Technical term for the border that appears around the screen, usually in response to low health? This had a strange term but I can't remember what it's called and it's difficult to search for.

sentences: Is it possible to embed a chatbot AI in a game? Is it possible to embed the AI used in evie cleverbot into a game? For example GTA5 or Sims, to enabe conversations and mood that is if you type something and the game characters will react to what you said and respond back. Is it possible to do this?

sentences:
How to enable/ disable GameObject I have child object with ParticleSystem component.
I want to have particles disabled until I press button.

I unchecked child object to make it disabled but when I press play it enables automatically(with no scripts attached). Then I made this script below (with .SetActive(false) part only) and it worked.

But then I needed to activate it somehow, which I did, but now when I press play, object is automatically enabled/ activated again.

Is there another way of doing this because I need it haha.

var particle1: GameObject;
var particle2: GameObject;
var particle3: GameObject;

public var triggered : boolean = false;

function OnTriggerEnter() { triggered= true; }
function OnTriggerExit()  { triggered= false;}

function Start()
{
    particle1.SetActive(false);
    particle2.SetActive(false);
    particle3.SetActive(false);
}

function Update()
{
    if (triggered && Input.GetKeyDown(KeyCode.JoystickButton1))
        particle1.SetActive(true);
        particle2.SetActive(true);
        particle3.SetActive(true);
}

sentences: Understanding Tensors I don't seem to be able to visualize tensors. I am reading The Morgan Kauffman Game Physics Engine Development and he uses tensors to represent aerodynamics but he doesn't explain them so I am not really able to visualize them.

sentences:
Implementing Achievement System in Javascript I understand that for more complex achievements, specific code can't be avoided, but for simple ones like (player clicked 100 times) or (player earned 30 bajillion cookies) or (player played for 1 hour) it should be as simple as abstracting the achievements to something like a list of properties/values and having some event handler.

My problem is that since I'm using Javascript and there's no really clean way to do pointers, how am I supposed to create an achievement class that can be iterated through procedurally?

Ideally I'd like something like this:

Achievement class:

function Achievement(name, property, value, text, points){
  this.name = name;
  this.property = property;
  this.value = value;
  this.text = text;
}

And then I'd add an achievement like so:

achievements.push(new Achievement("Clicktastic", &numClicks, 1000, "You clicked 1000 times!");

And have some kind of function bound to a Window.setInterval that was constantly looping through all achievements and for these simple types doing something like:

for (var i = 0; i < achievements.length; i++){
  if (*achievements[i].property >= achievements[i].value){
    //deal with earning achievement
  }
}

I'm just using some C style pointer/dereferencing notation here.

Basic idea is that I'm not sure how to create a generic achievement that can arbitrarily care about specific properties without pointers.

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 position a Weapons model in a first person shooter with XNA I am building a first person shooter and positioning the weapons is hard. I am trying to get the bat to look like you are holding it but I keep trying things and they don't appear in the positions I want them to be in. Here is what I did with one version of the function.

void DrawModelModel(Model model, Matrix world)
    {
        Vector3 modelPosition = Vector3.Zero;
        float modelRotation = 0.0f;
        Viewport viewport = graphics.GraphicsDevice.Viewport;
        float aspectRatio = (float)viewport.Width / (float)viewport.Height;
        // Set the position of the camera in world space, for our view matrix.
        Vector3 cameraPosition = new Vector3(0.0f, 0.0f, 200.0f);
        // Copy any parent transforms.
        Matrix[] transforms = new Matrix[model.Bones.Count];
        model.CopyAbsoluteBoneTransformsTo(transforms);

        // Draw the model. A model can have multiple meshes, so loop.
        foreach (ModelMesh mesh in model.Meshes)
        {
            // This is where the mesh orientation is set, as well
            // as our camera and projection.
            foreach (BasicEffect effect in mesh.Effects)
            {

                effect.World = transforms[mesh.ParentBone.Index] *
                    Matrix.CreateRotationY(modelRotation)
                    * Matrix.CreateFromYawPitchRoll(0.0f, 1.0f, 1.0f);
                effect.View =  Matrix.CreateLookAt(cameraPosition,
                    Vector3.Zero, Vector3.Up);
                effect.Projection = Matrix.CreatePerspectiveFieldOfView(
                    MathHelper.ToRadians(35.0f), aspectRatio,
                    1.0f, 10000.0f) ;
            }
            // Draw the mesh, using the effects set above.
            mesh.Draw();
        }
    }

Here is what I did with a different version of the function.

void DrawModelModel(Model model, Matrix world)
    {
        Vector3 modelPosition = Vector3.Zero;
        float modelRotation = 0.0f;
        Viewport viewport = graphics.GraphicsDevice.Viewport;
        float aspectRatio = (float)viewport.Width / (float)viewport.Height;
        // Set the position of the camera in world space, for our view matrix.
        Vector3 cameraPosition = new Vector3(0.0f, 0.0f, 200.0f);
        // Copy any parent transforms.
        Matrix[] transforms = new Matrix[model.Bones.Count];
        model.CopyAbsoluteBoneTransformsTo(transforms);

        // Draw the model. A model can have multiple meshes, so loop.
        foreach (ModelMesh mesh in model.Meshes)
        {
            // This is where the mesh orientation is set, as well
            // as our camera and projection.
            foreach (BasicEffect effect in mesh.Effects)
            {

                effect.World = transforms[mesh.ParentBone.Index] *
                    Matrix.CreateRotationY(modelRotation)
                    * Matrix.CreateFromYawPitchRoll(0.0f, 1.0f, 1.0f);
                effect.View =  Matrix.CreateLookAt(cameraPosition,
                    Vector3.Zero, Vector3.Up);
                effect.Projection = Matrix.CreatePerspectiveOffCenter(-2.0f,1.0f, 0.0f, 1.0f, 1.0f, 10000.0f) ;
            }
            // Draw the mesh, using the effects set above.
            mesh.Draw();
        }
    }

What matrix can I use to get the bat model to appear realistically as if you are really holding it in a first person view. I am new to matrices so my knowledge of them is basic. What matrix should I use or what parameters with my current matrix should I be editing? I am thinking the projection matrix is what I need to be editing, but I am very confused at this point. Any help would be great.

sentences:
Unity installed version higher than game project version - can't open the game project anymore Long story short - I had to uninstall Unity and Unity Hub and reinstall them again.
I ended up installing Unity version 2020.2.1f1.
Some of my game projects were made using version 2020.1.6f1
Now I cannot open them - there is a yellow warning triangle next to those games in Unity Hub.
I am installing version 2020.1.17f1 as I type these.
So my questions:

Is there no backwards compatibility between newer versions of Unity and older games?
How do people deal with this?
I've heard people transition their games during development into newer versions of Unity but I wasn't even able to open the games made with older version.
How would I go around this if I had spent 2 years or more of development time and was suddenly locked out from my game project - how do I prevent situations like these?

Here are my Unity versions installed:

And here are my games (tutorials mostly):

I may have answered my own question, but still need your input guys. I just noticed that there is a 'Select Version' dropdown on the right that allows me to open a game project in Unity version I have installed on my system. Is this how you deal with those issues?

sentences:
How can I use shaders in Unity to write a scientific computing program? I want to write a GPU shallow water code on Unity3D. For sure, performance matters a lot. I've done this before using DirectX and C++. But for a couple of reasons I want to redo it in Unity3D.

I have some hands on experiences with Unity3D, but I have no idea how I can write GPGPU codes, like what I did in DirectX.

In DirectX I am using textures as my data structure for the properties of water cells (height, x-velocity, y-velocity, etc.) and HLSL shaders as my parallel computational functions (kernels).

Furthermore, I prefer my code to be [near] cross-platform. Is it possible to do something similar in Unity3D using OpenGL?

I am an engineer, and not a game developer, so please keep it simple ...

sentences:
Creating orientation Quaternion from forward vector Suppose that I have an orientation Quaternion Q, I can compute its forward vector from V = Q * Vector3.forward easily.

Inversely, suppose that I have its forward vector V, how do I compute Q?

I know that is not possible, please tell me what's needed beside V, in order to compute Q.

Motivation behind the problem: I have a forward direction of a game object, I want to find out its up direction and its right direction. I can find out all these 3 directions if I have the orientation Quaternion.

sentences: How can I create a car mod for GTA: Vice City? I am a player of GTA games. I want to create my own car for GTA: Vice City. How do I create a mod that adds a new car to the game?

sentences:
What are the implications of not owning the IP of a character graphic in my game? I'm currently talking with a design studio for the artworks of my game. They are saying they want to still own the IP of their chracter graphic in my game as they want to sell merchandise with my character idea and their artwork.

I'd like to know what kind of stuffs should I look out for in such an agreement. Does owning the character graphics mean, later they can come up and say me I can't use it in my game?

sentences:
Objective-c Cocos2d moving a sprite I hope someone knows how to do the following with cocos2d:

I want a sprite to move but not in a single line by using

[cocosGuy runAction: [CCMoveTo actionWithDuration:1 position:location]];

What I want is the sprite to do some kind of movements that I preestablish. For example in some point i want the sprirte to move for instance up and then down but in a curve. Do I have to do this with flash like this documents says?

http://www.cocos2d-iphone.org/wiki/doku.php/prog_guide:animation

Does animation in this page means moving sprites or what?

thanks

sentences:
add random force and direction to rigidbodies every x seconds i need to add a windForce to multiple rigidbodies, with random direction and random force every x lapse of time. I'm using InvokeRepeating to update the windDirection so that the rigidbodies can be pushed in a different direction every x seconds.
Here's the code:
void windRotate()
{
    windDirection.y = Random.Range(0, 360);
    transform.Rotate(windDirection * smooth);

    if (objectsInWind.Count > 0)
    {
        foreach (Rigidbody rigid in objectsInWind)
        {
            rigid.AddForce(windDirection * 10);
        }

    }
}

This way the rigidbodies don't receive any force. I guess the system does not recognize the Vector3 Update of windDirection, so I need to recalculate it, bit I was not able.
On the other hand if I use this:
rigid.AddForce(Vector3.Up* 10);

the rigidbodies moves but in one direction only, and it's not updated on the next windDirection change.
I tried playing with the various Vector3 values (up, right etc..) and different force methods (AddRelativeForce) but nothing changed.
By using Debug.Log(windDirection); i know that windDirection is updating correctly ever 3 seconds, so it should also be updated in my methods when i apply the force, but id does not work.
Any suggestion?
Thanks

sentences:
Button with hexagon shape not recognizing mouse click I made a hexagonal button, with a png image, the problem is that if i click outside of the image of the hexagon(but still inside of the squared area that defines the whole button), the click is registered , if i click inside of the button nothing happens, now i just read in the docs about the property Click Mask, so i made the same image of the hexagon shape into a bitmap, but this error text comes up:
The selected resource (StreamTexture) does not match any type expected for this property (BitMap).

I used this linkt as a guide to create the bitmap, http://www.herongyang.com/Windows/GIMP-JPEG-Save-Image-in-BMP-Format.html, still i don't know what i'm missing.
Also used MS Paint to save it as bitmap, but that din't work either.
Why i can't load the image as Click Mask in Godot?
I attached the image for testing.

sentences:
Intellectual rights to game concepts For a client I might be making a small puzzle game about getting a item out of a puzzle. The concept will strongly resemble this game :

http://www.alibaba.com/product-gs/355972089/Car_Park_Game_Brain_Teaser_IQ.html

But will not be about cars or parking, and we will make our own "levels".

The game will not be a board game, but a smartphone game (iOS + Android devices).

But does ThinkFun sit on the concept so heavily that I can't make a game like this ? And where does "the line" go to what is acceptable?

The game will be free, and we are a non-US company (based in Denmark, Europe) if that makes any difference.

sentences:
Client-side prediction for movement? How would client-side prediction for movement work? From how I understand it, the player inputs "Move Forward" and the character on the player's computer instantly starts to move forward. It also sends the input to the server along with a framestamp, say frame 100. The input arrives at the server on frame 110. The server knows that the player started movement on frame 100 so the character would've moved forward for 10 frames. On the server, the character moves forward 10 frame's worth then the result is sent. The official state is received and since it nearly matches up with the player's gamestate, the transition is smooth.

My concern is about how this would look on other people's computers who don't have knowledge of the input - only gamestate. How is 10 frame's worth of movement smoothed out when the other computer hasn't started moving the character forward 10 frames earlier?

sentences:
How to select top most gameObject in a stack of gameObjects? I'm stuck trying to figure out how I can select the top most GameObject in a stack of GameObjects. In the picture below, I have a Green and Yellow circle stacked on top of each other. If I try to select the top most gameobject (the green one), it selects the yellow circle. Is there a way that I can make sure that when I go to select a circle, it selects the top most one? I'm currently using the OnMouseDown() function built into unity.

Update Sorting the colors on the z axis did not solve the problem. I'm still trying to figure out a solution

sentences:
How to restrict an AssetReference to a specific type? I am using the Addressables package of Unity.

I am trying to restrict an AssetReference type in the Unity inspector to a specific type.  Currently a user can assign any Unity object to an AssetReference, but I would like to guide the user to assign the correct types to the correct variables and (if possible) filter the assets type list to include only the assignable types when the user click on the drop-down arrow

According to the Unity documentation https://docs.unity3d.com/Packages/com.unity.addressables@1.6/api/UnityEngine.ResourceManagement.Util.SerializedTypeRestrictionAttribute.html

it seems like there is some sort of annotation available. The documentation is very limited and I have tried:

[UnityEngine.ResourceManagement.Util.SerializedTypeRestrictionAttribute(type=typeof(PlayerMaster))]
public UnityEngine.AddressableAssets.AssetReference playerMaster;

but it made no difference.

I also tried to create my own AssetReference type:

    [Serializable]
    public class Reference : UnityEngine.AddressableAssets.AssetReferenceT<PlayerMaster>, UnityEngine.AddressableAssets.IKeyEvaluator
    {
        public Reference(string guid) : base(guid)
        {
        }
    }

but with this new type I cannot select anything!

The following code snippet at least seems to restrict the list to GameObjects which is an improvement, but the user can still assign the wrong GameObjects easily. I was hoping for a more strict filter, but if it is not possible I will settle with:

public UnityEngine.AddressableAssets.AssetReferenceGameObject playerMaster;

sentences:
Multi-tile agent path-finding algorithm? Suppose we have a uniform rectanglular grid as shown below. The a is an agent, o is obstacle and g is goal. What are the options of handling multitile agents (e.g. dragons or tanks)?

.  .  .  .  o  .  .  .
.  .  .  .  o  .  g  .
.  a  a  .  .  .  .  .    <-- too tight
.  a  a  .  o  .  .  .
.  .  .  .  o  .  .  .
.  .  .  .  .  .  .  .    <-- should go through this gate
.  .  .  .  .  .  .  .
.  .  .  .  o  .  .  .

Update: Found this article on clearance-based pathfinding from Red Alert 3. It covers not only the clearance - size, but also a capability - ability of certain units to use certain terrains.

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:
transform.Rotate with z clamped to 0 I have a virtual joystick to rotate the player and this piece of code works nice and smooth for the rotation of the players view.

public void rotatePlayer(Vector3 newPosition){
  transform.Rotate(new Vector3(-newPosition.y,newPosition.x,0)*Time.deltaTime);
}

I pass a Vector3 with the position of the joystick in relation of his parrent's(the joystick border) anchor.That gives me the rotation direction.Which means that if I set the rotation of the camera direclty it will just flip to that point and not move progresively to that point.

Even though z is set to 0 in the vector3, it changes the z axis angle of the camera. How can I clamp it to 0 without using many resources?

I tried other methods but they just switch the camera's rotation directly when the joystick is touched like I already said.Flip and stop.

I guess I could just set the z axis rotation to 0 every time but that just seems like double work.

sentences: How do I link a GameObject activated state to a UI button being held? How do I go about this functionality: When a user taps and still holds onto a UI button, a GameObject will be set active, when they release the UI button, the GameObject will be deactivated.

sentences:
How to compute acceleration by using Kinect device joint positions I have an application which uses the Microsoft Kinect camera device.

At each point I can obtain the position of my hand in the 3 Dimensional space ( X - Y - Z ) and I want to compute acceleration of my hand over each second on each axis.

Basically, I can obtain the coordinates at each frame(where 1 sec = 30 frames), and I want to compute the acceleration of my hand in 1 sec.

StartPoint - (x1, y1, z1)

EndPoint after 1 sec from StartPoint ( 30 frames ) - (x2, y2, z2)

Acceleration between StartPoint and EndPoint = ?

Also I can obtain all the other coordinates of my hand over time, but I want to compute the acceleration in the period of time between start point and end point.

Could you please explain or show me how?

sentences:
how to replace vertex buffer in webGL I want to replace a vertex buffer with another completely different vertex buffer, different size and values, it will not get replaced every frame.

gl.deleteBuffer(vertexBuffer);
vertexBuffer = gl.createBuffer();
gl.bindBuffer(gl.ARRAY_BUFFER, vertexBuffer);
gl.bufferData(gl.ARRAY_BUFFER, vArray, gl.STATIC_DRAW);

I am using that code to replace it, I don't think it is the correct way because I am getting:

GL ERROR :GL_INVALID_OPERATION : glDrawArrays: attempt to render with no buffer attached to enabled attribute 1

I don't know if this is related to the error but I am rendering using the vertex buffer when I replace it.

sentences:
Lightweight sprite animation software Does anyone know of a good lightweight sprite animator solution? I've created a couple of spritesheets using TexturePacker, but I'd like to, for example, create an XML file that tells me frames one through three are part of animation X, and frames 4 through 6 are part of animation Y.

I am primarily a OSX developer.

sentences:
Good book/resource recommendation for HTML5 mobile game development? The problem: I am taking an existing, 5 year old, html based MMORTS game and "HTML5-ing" it, "AJAX-ing" it and most importantly, optimizing for mobile devices like iPhone, android etc. For these devices, the application will be packaged as a downloadable app that is a wrapper for a browser which actually shows the game..

The Question
Looking for a good book, or books, or in-depth articles that would help me learn:

what tools I have in iOS, andriod applications for optimizing an html based game. things like caching of images, etc
what kind of connectivity, or interactivity I can expect between the html/javascript pages and the wrapper - can I play sounds in the wrapper by triggering them from javascript? etc
tip and tricks to optimize html/html5 & Javascript application to run well on mobile devices
ETC :)

Any recommendations would be greatly appreciated!!

sentences:
Sharing functions across multiple shaders Simple question:

In GLSL, is there a way to share functions across multiple shaders, or do I have to define all functions in every shader that needs them?

sentences:
How can I ensure reasonably spaced out enemies I have a simple javascript game and I'm initializing their positions on the y axis using random numbers. How can I ensure that they are reasonably spaced apart?
My simple algorithm is:

 y = (Math.random()*1000%600);

However I frequently get enemies almost directly on top of each other. This is a huge problem for the game, since it's a word game and the enemies have text on their center, that if overlapped makes them impossible to kill since you can't see the words. Any advice would be appreciated! I'm pretty new to making games in general so this has all been a learning experience for me!

sentences:
Picking a local origin as the centroid of given three points in 3D Given three points non-collinear P, Q, R in 3D, I need a generic method to generate x', y', z' unit vectors that behave like origin of local coordinate system.

x' and y' vectos should be on the plane that is defined by P Q and R.

The part that I could not figure out was:
After calculating the centroid C, I can pick x' as normalize(vec(PQ) + vec(PC)) but could not figure out how to generate y' and z'.

The method should be generic. I know this is possible without rotations etc. but how?

I'm going to write a program in Java, so I'd appreciate answers with step-by-step.

sentences:
Predictive Collision Detection - Find Time Of Impact I have a green box at a starting position A. It can move along two paths

A to B is linear motion
A to C is under the influence of gravity (non-linear)

The thin vertical line is a fixed colliding wall. All objects are represented with axis-aligned AABB bounding boxes.

For the path A to B, if my understanding is correct, I (think I) can determine the time of impact (T0) on the wall based on swept-AABB collision techniques. this case simply reduces to motion along x-axis, and time of impact can be calculated easily.

My question is for path A to C. Under the influence of gravity how can I determine the time of impact (T1) relative to the starting time T at location A. (The motion of A to C can be predicted using the standard equations of motion)

Are there any techniques/algorithms available for this?

EDIT To clarify the vertical wall is illustrative - walls can be arbitrarily vertical or horizontal or both (like a corner). They will be stationary, and axis aligned though.

sentences:
On screen enemy indicating arrow I am working on indicating on screen arrow to point towards the enemy. I have a environment which consist of a player and three enemy placed at different position on the environment.I need an arrow indicating the enemy,so that the player can move towards the enemy in the environment.

How can I do this?Can anybody please help me out.

I have got a script on searching.

public Texture2D icon; //The icon. Preferably an arrow pointing upwards.
public float iconSize = 50f;
[HideInInspector]
public GUIStyle gooey; //GUIStyle to make the box around the icon invisible. Public so that everything has the default stats.
Vector2 indRange;
float scaleRes = Screen.width / 500; //The width of the screen divided by 500. Will make the GUI automatically
//scale with varying resolutions.
Camera cam;
bool visible = false; //Whether or not the object is visible in the camera.

void Start () {
    visible = GetComponent<SpriteRenderer> ().isVisible;

    cam = Camera.main; //Don't use Camera.main in a looping method, its very slow, as Camera.main actually
    //does a GameObject.Find for an object tagged with MainCamera.

    indRange.x = Screen.width - (Screen.width / 6);
    indRange.y = Screen.height - (Screen.height / 7);
    indRange /= 2f;

    gooey.normal.textColor = new Vector4 (0, 0, 0, 0); //Makes the box around the icon invisible.
    visible=false;
}

void OnGUI () {
    if (visible) {
        Vector3 dir = transform.position - cam.transform.position;
        dir = Vector3.Normalize (dir);
        dir.y *= -1f;

        Vector2 indPos = new Vector2 (indRange.x * dir.x, indRange.y * dir.y);
        indPos = new Vector2 ((Screen.width / 2) + indPos.x,
            (Screen.height / 2) + indPos.y);

        Vector3 pdir = transform.position - cam.ScreenToWorldPoint(new Vector3(indPos.x, indPos.y,
            transform.position.z));
        pdir = Vector3.Normalize(pdir);

        float angle = Mathf.Atan2(pdir.x, pdir.y) * Mathf.Rad2Deg;

        GUIUtility.RotateAroundPivot(angle, indPos); //Rotates the GUI. Only rotates GUI drawn after the rotate is called, not before.
        GUI.Box (new Rect (indPos.x, indPos.y, scaleRes * iconSize, scaleRes * iconSize), icon,gooey);
        GUIUtility.RotateAroundPivot(0, indPos); //Rotates GUI back to the default so that GUI drawn after is not rotated.
    }
}

void OnBecameInvisible() {
    visible = false;
}
//Turns off the indicator if object is onscreen.
void OnBecameVisible() {
    visible = true;
}

}

The problem is start when I play the scene the arrow is seen at the start but its  get invisible soon

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:
Surface Depth Intersection Shader I recently asked a question about the creating an accurate Depth Intersection Shader.

When creating this in a fragment / vertex shader it could be achieved by the following code

SubShader
{
    Blend SrcAlpha OneMinusSrcAlpha
    ZWrite On

    Tags
    {
        "RenderType" = "Transparent"
        "Queue" = "Transparent"
    }

    Pass
    {
        CGPROGRAM
        #pragma target 3.0
        #pragma vertex vert
        #pragma fragment frag

        #include "UnityCG.cginc"

        struct appdata
        {
            float4 vertex : POSITION;
            float2 uv : TEXCOORD0;
            float3 normal : NORMAL;
        };

        struct v2f
        {
            float2 uv : TEXCOORD0;
        };

        sampler2D _MainTex;
        float4 _MainTex_ST;
        sampler2D _CameraDepthTexture;
        fixed4 _Color;
        fixed4 _GlowColor;
        float _FadeLength;

        v2f vert(appdata v, out float4 vertex : SV_POSITION)
        {
            v2f o;
            vertex = UnityObjectToClipPos(v.vertex);
            o.uv = TRANSFORM_TEX(v.uv, _MainTex);

            return o;
        }

        fixed4 frag (v2f i, UNITY_VPOS_TYPE vpos : VPOS) : SV_Target
        {
            float2 screenuv = vpos.xy / _ScreenParams.xy;
            float screenDepth = Linear01Depth(tex2D(_CameraDepthTexture, screenuv));
            float diff = screenDepth - Linear01Depth(vpos.z);
            float intersect = 0;

            if(diff > 0)
                intersect = 1 - smoothstep(0, _ProjectionParams.w * _FadeLength, diff);

            return fixed4(lerp(tex2D(_MainTex, i.uv) * _Color, _GlowColor, pow(intersect, 4)));
        }
        ENDCG
    }
}

However, when I try to put the same logic into a surface shader, the result does not show any depth intersections.

SubShader {
    Blend SrcAlpha OneMinusSrcAlpha
    ZWrite On

    Tags
    {
        "RenderType" = "Transparent"
        "Queue" = "Transparent"
    }

    CGPROGRAM
    // Physically based Standard lighting model, and enable shadows on all light types
    #pragma surface surf Standard fullforwardshadows alpha:fade

    // Use shader model 3.0 target, to get nicer looking lighting
    #pragma target 3.0

    sampler2D _MainTex;

    struct Input {
        float2 uv_MainTex;
        float4 screenPos;
        float eyeDepth;
    };

    half _Glossiness;
    half _Metallic;
    sampler2D _CameraDepthTexture;
    fixed4 _Color;
    fixed4 _GlowColor;
    float _FadeLength;

    // Add instancing support for this shader. You need to check 'Enable Instancing' on materials that use the shader.
    // See https://docs.unity3d.com/Manual/GPUInstancing.html for more information about instancing.
    // #pragma instancing_options assumeuniformscaling
    UNITY_INSTANCING_CBUFFER_START(Props)
        // put more per-instance properties here
    UNITY_INSTANCING_CBUFFER_END

    void surf (Input IN, inout SurfaceOutputStandard o) {
        float2 screenuv = IN.screenPos.xy / _ScreenParams.xy;
        float screenDepth = Linear01Depth(tex2D(_CameraDepthTexture, screenuv));
        float diff = screenDepth - Linear01Depth(IN.screenPos.z);
        float intersect = 0;

        if (diff > 0)
            intersect = 1 - smoothstep(0, _ProjectionParams.w * _FadeLength, diff);

        fixed4 col = fixed4(lerp(tex2D(_MainTex, IN.uv_MainTex) * _Color, _GlowColor, pow(intersect, 4)));
        o.Albedo = col.rgb;
        o.Alpha = col.a;
        o.Metallic = _Metallic;
        o.Smoothness = _Glossiness;
    }
    ENDCG
}

sentences: How do I get the current location when using slick 2D library? I'm developing a map kind of simple game using slick 2D library, and I want to get the current location of the user.  When the user runs into a special location (ex: hole) to indicate that is dangerous. How can I achieve this?  I'm a new comer to games.

sentences: How to Translate and Position at the same time? Hi I'm having problem Translating and Positioning at the same time e.g take example of retro spacecraft shooting games in which your spaceship moved in x-axis automatically and you just needed to control position on y-axis. I'm using transform.Translate(new Vector3(0f,Time.deltaTime * speed,0f),Space.World); to translate and then transform.position = new Vector3(Input.mousePosition.x,0f,0f); to position using mouse but it doesn't seem to work. Help !

sentences: How do I perform a slice effect like Fruit Ninja? I want to do slice effect like in Fruit Ninja. Is there any class in Cocos2D like CCBlade? How can I use the CCBlade in Cocos2D on Android?

sentences: What are useful server metrics to gather for a table card game? When building a game server intended to accomodate large numbers of simultanous games (e.g. table card games), where the server manages lots of tables and each table has up to a small handful of users, what metrics are most useful to collect and why?

sentences: What are game save files? I've reached the saving part of my game, as in, you press save and it writes to a text file, but I've noticed that most games and programs out there use custom save formats, like Dwarf Fortress DAT files. What are these? are these just text files formatted for the program, or are they a lower level thing?

sentences:
SDL2 Draw scene to texture. SDL2 RenderTexture like SFML I've been developing a 2D Engine using SFML + ImGui.

The editor is rendered using ImGui and the scene window is a sf::RenderTexture where I draw the GameObjects and then is converted to ImGui::Image to render it in the editor.

Now I need to create a 3D Engine during this year in my Bachelor Degree but using SDL2 + ImGui and I want to recreate what I did with the 2D Engine.

I've managed to render the editor like I did in the 2D Engine using this Example that comes with ImGui.

But I don't know how to create an equivalent of sf::RenderTexture in SDL2, so I can draw the 3D scene there and convert it to ImGui::Image to show it in the editor.

If you can provide code will be better. And if you want me to provide any specific code tell me.

Thanks!

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:
What are some basic zoning guidelines for designing game cities? I am planning out a fictional game city. Based on the gameplay and story I have decided on several locations which will need to exist. I'm wondering though to what extent I need to take zoning into consideration when planning everything out. For example, there is an industrial area with processing plants, but there is also a residential area fairly close to this.

It is my understanding that industrial areas need to be a certain distance away from residential areas due to health concerns. This varies of course based on many factors, but I'm wondering to what extent I should be considering this when planning out the city. The game in no way requires realistic city planning, but for the sake of not making it obviously unrealistic I'm wondering if there are any rules of thumbs when planning this.

sentences:
Flipping Textures in Modern OpenGL How do I flip a texture in modern OpenGL (3.1+)?

This is the unflipped render, keep in mind it is drawn with 8x8 tiles from a texture atlas, so I edited green squares below him into the image to represent it. Rendered without horizontal flip:

I have tried doing 1-texCoord.x in my vec2 texCoord in my vertex shader.
It gave me... this result:

This is how texture atlas is laid out, if it matters:

Attempting other methods such as inverting texture coordinates of the VBO gave me similarly garbled results. What should I actually be doing, to flip the texture, or more accurately each individual tile? I know I would also have to change each tile's coordinates, but that's for after.

sentences:
Material usage, one per model or per object? Is it better (memory, time (of developer), space) to use single model that is unwrapped and uses a single material or to break a model down into appropriate bits, each with their own smaller texture/material?

Or does it depend on the target platform as to what is acceptable - ie PC vs tablet?

An example:
Say you have a typical house with a tiled roof.

Model it, make sure everything is attached, unwrap the walls/roof so in your UV template the walls and roof would be in one texture file, side-by-side in say a 512x512 file.
Model the roof/walls as separate objects, unwrap them individually and have two UV templates. You could then have a 256x256 file for each one.

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:
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 would I make a bullet shoot from my player to my mouse. So far I've created an object called obj_mouse. And my plan is whenever the player left clicks, it spawns a bullet from him toward where ever the mouse is pointing. I've got the concept down, but I'm struggling getting it to work.

Extra bits of code I'm messing around with to try and get it to work:

    bullet=instance_create(x,y,obj_bullet)
with (bullet) {
move_towards_point(mouse_x,mouse_y,5)
image_angle=direction
}

point_direction(obj_mouse,obj_mouse,obj_mouse,obj_mouse)
image_angle=direction

(In the above code, I havent attempted to specify to the program that I want the bullet to go in the direction of obj_mouse, or rather, just the mouse. The above code works, and bullets do shoot, however the player must have the mouse on the players sprite for it to work.)

Thank you in advance for any advice given.

sentences:
Markup format or script for data files? Possible Duplicate:
  How to choose how to store data?

The game I'm designing will be mainly written in a high level scripting language (leaning towards either Lua or Squirrel) with a C++ core.  In addition to scripts I'm also going to need different data files.  Many data files will be for static information such as graphical assets and monster types.  I'd also want to create and update data files at runtime for user information like option settings and game saves.

Can I get away with using plain script files (i.e. .lua or .nut files) for my data files, or is it better to use dedicated markup formats like XML or YAML?

If I use script files, loaded separately from my true scripts, then I wouldn't need an extra library to read those files.  Scripting languages like Lua also have table syntax that lend themselves towards data definition.  On the other hand I'd have to write my own schema check code.  These languages also don't seem to support serialization "out of the box" like the markup format libraries do.

sentences:
Teleport Not Working in Unity 2D So I'm basically trying to get my character to "use" a set of stairs by teleporting from one stairway door to another. Each stairway door will be paired with one other stairway door.

Here's the code, I feel like it should be working...my Debug.Logs are even outputting the correct information. Also FYI, I have the Transform doorPairedWith as public so that I can just drag and drop the stairway door that each one is supposed to be paired with.

 using UnityEngine;

 public class Stairs : MonoBehaviour {

 Player player;

 public Transform doorPairedWith;

 Vector3 doorPairedWithPosition;
 Vector3 playerPosition;

 BoxCollider2D playerCollider;
 BoxCollider2D stairsTriggerCollider;

 bool playerIsNearStairs = false;

 void Start()
 {
     player = Player.instance;

     playerPosition = player.transform.position;
     doorPairedWithPosition = doorPairedWith.position;

     playerCollider = player.GetComponent<BoxCollider2D>();
     stairsTriggerCollider = GetComponent<BoxCollider2D>();
 }

 void Update()
 {
     UseStairs();
 }

 void UseStairs()
 {
     if (playerIsNearStairs == true)
     {
         if (Input.GetKeyDown(KeyCode.E))
         {
             Debug.Log("Attempting to use stairway door named: " + doorPairedWith);
             playerPosition = doorPairedWithPosition;
         }
     }
 }

 void OnTriggerEnter2D(Collider2D collision)
 {
     if (collision.gameObject.tag == "Player")
     {
         playerIsNearStairs = true;
         Debug.Log("Player is near stairs: " + playerIsNearStairs);
     }
 }

 void OnTriggerExit2D(Collider2D collision)
 {
     if (collision.gameObject.tag == "Player")
     {
         playerIsNearStairs = false;
         Debug.Log("Player is near stairs: " + playerIsNearStairs);
     }
 }
 }

sentences:
Why is chunk size often a power of two? There are many Minecraft clones out there and I am working on my own implementation. A principle of terrain rendering is tiling the whole world in fixed size chunks to reduce the effort of localized changes.

In Minecraft the chunk size is 16 x 16 x 256 as far as I now. And in clones I also always saw chunk sizes of a power of the number 2.

Is there any reason for that, maybe performance or memory related? I know that powers of 2 play a special role in binary computers but what has that to do with the chunk size?

sentences:
Calculate velocity to hit the target on flat 2d surface I am creating a game using Python and Pygame.

I have used this function before (with JS with p5.js and Java with libwjgl, but for some reason it does not work with pygame (I am not sure if it matters here).

I'm trying to hit a static target shot from a moving object.

This is how I am doing this:

def shoot(self):
  posX, posY = 100, 100 # Static target coordinates

  diffX = self.player.x - posX
  diffY = self.player.y - posY

  distance = math.sqrt((diffX * diffX) + (diffY * diffY)) # Calculate the distance

  velX = float((-1 / distance * diffX * 6))
  velY = float((-1 / distance * diffY * 6))

  # Bullet(x, y, width, height, velocityX, velocityY)
  # Will be rendered on the screen
  self.bullets.append(Bullet(self.player.x, self.player.y, 10, 10,  velX, velY))

Updating bullet location:

  def update(self):
    self.bullet.x += self.velX
    self.bullet.y += self.velY

This works perfectly with other languages I have mentioned, but in Python the launched projectile is off...

Here is how it looks. The red square is the target.

THANK YOU, EVERYONE, FOR THE HELP. I really appreciate it :)

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:
mixing forward and deferred rendering Simplified version of my deferred rendering looks like this:

bind fbo1
clear color and depth buffers
gbuffer stage (gbuffer contains only these pixels which pass a depth test)
unbind fbo1
bind fbo2
clear color buffer
draw a full screen quad, shading stage (render to the texture for some post processing effects)
unbind fbo2
clear color and depth buffers
draw a full screen quad and render to the default framebuffer

How to combine that with the forward rendering ?

sentences:
unity onCollisionEnter does not work I know this question has been asked several times but none of the answers solved my problem.

I made an sphere and gave it rigidbody. then I draged the sphere on to a new made prefab.

on mouse-click Instances of this prefab are made and shot. the spheres collide with things in the scene but the onCollisionEnter function is not called.
all things in the scene have colliders.

I would be grateful if you could tell me what's wrong

edited: it works if either the sphere or the other object's collider is trigger and I use onTriggerEnter.

sentences:
Calculate the starting position of a turning aircraft with inertial force to make it stop at desired position and heading Continued from the answer here, I have some problem when the aircraft in my game has inertial forces after going forward and turning itself. To illustrate, from the following image (https://imgur.com/a/Xvqu2A7) the aircraft is moving from the point A -> B -> C'-> D. I planned to maneuver the aircraft from the point C' which is the point that would make the aircraft stop at the point D after turning with its full performance (using minimum turning radius).

The question is how do I calculate the position of the point C' to make the aircraft roughly stop at the point D with the desired position and heading (It is roughly since there is also an inertial force after stopping the aircraft's engine.)?
Any suggestions and answers would be appreciated.

sentences:
How is the value of transform.position updated and accessed between different private methods? I followed this YouTube video but I'm still confused about how the code actually retrieves the value of transform.position.
I can understand the Camera.main.ScreenToWorldPoint code is to transform the screen position to a position in the world based on the camera's view, and it then uses this to update the transform.position as in the private void OnMouseDrag method.
However, I also learnt that since the method is declared as private, the "transform.position" cannot retrieve the value of "transform.position" in each {}bracket.
So how does the value of "transform.position" in private void OnMouseUp, private void Awake get updated, unless I misunderstood the concept?
using UnityEngine;

using UnityEngine.Assertions.Must;

using UnityEngine.SceneManagement;

public class GreenBird : MonoBehaviour

{
    Vector3 _initialPosition;
    private bool _birdWasLaunched;
    [SerializeField]private float _launchPower = 500;

    private void Awake()
    {

        _initialPosition = transform.position;
    }

    void Update()
    {
        if (_birdWasLaunched &&
                 GetComponent<Rigidbody2D>().velocity.magnitude <= 0.1)
        {
            timeSittingAround += Time.deltaTime;
        }

        if (transform.position.y > 10.00 ||
            transform.position.y < -10.00 || transform.position.x > 10 || transform.position.x <-10)
        {
            string currentSceneName = SceneManager.GetActiveScene().name;
            SceneManager.LoadScene(currentSceneName);
        }

    }

     void OnMouseDown()
    {
        GetComponent<SpriteRenderer>().color = Color.red;

    }

    private void OnMouseUp()
    {
        GetComponent<SpriteRenderer>().color = Color.white;
        Vector2 directionToInitialPosition = _initialPosition - transform.position;
        GetComponent<Rigidbody2D>().AddForce(directionToInitialPosition * _launchPower);
        GetComponent<Rigidbody2D>().gravityScale = 1;
        _birdWasLaunched = true;

    }

    private void OnMouseDrag()
    {
        Vector3 newPosition = Camera.main.ScreenToWorldPoint(Input.mousePosition);
        transform.position = new Vector3(newPosition.x, newPosition.y);

    }
}

sentences:
Drag And Drop in libGDX (Target and Source) I'm trying to put together a drag and drop system in libGDX with the help of DragAndDrop class. I have the typical system in which you can drag something into a box.

So far it is working all dough I don't know if I am doing it in the most optimal way because but the problem is that one of the draggable object contains two more targets.

So say I have all draggable objects on the left and the boxes (the targets) on the right.

This is what I do for every draggable object:

dragAndDrop = new DragAndDrop();
dragAndDrop.addSource(new Source(icon) {
            @Override
            public Payload dragStart (InputEvent event, float x, float y, int pointer) {
                Payload payload = new Payload();

                payload.setDragActor(drag);
                payload.setValidDragActor(valid);
                payload.setObject(icon);
                icon.addAction(Actions.alpha(0.7f));
                return payload;
            }
            @Override
            public void dragStop(InputEvent event, float x, float y, int pointer, Payload payload, Target target){
                icon.addAction(Actions.alpha(1));
                if(target!=null){
                    draggedInDragBox((CommandBin) target.getActor());
                }

            }
        });

The DraggableObject extends Group and contains Image icon. That's what I pass to the constructor of the source. (Maybe I should pass all the object [this]). I also have the images drag and valid in the DraggableObject. The actual Texture is the same for all icon, valid and drag but I think I need all 3 objects to make it work. Am I right?

Then in the boxes I do:

dragAndDrop.addTarget(new Target(this) {
        //Logic is in source
        public boolean drag (Source source, Payload payload, float x, float y, int pointer) {
            return true;
        }

        public void reset (Source source, Payload payload) {
        }

        public void drop (Source source, Payload payload, float x, float y, int pointer) {

        }
    });

So I pass the object DragBox to the constructor of the target. As you can see all the logic is in the Source. Ass you can tell there. What I do is. If target =! null it means that we dropped the object in a valid place so I want to add the DraggableObject to the DragBox (addActor).

public void draggedInDragBox(DraggableObject do){
    //We add the command in the box
    addCommand(_this); //This simply calls addActor(do) in DragBox
    //We create a new draggable object to be able to use it again
    DraggableObject drOb = new DraggableObject();
    northController.draggableObjectsContainer.addActor(drOb);
}

The difference between a normal DraggableObject and the one that displays subDragBoxes (which extends the first one) is this in the constructor:

public RedDraggableBox() {
    super();
    subdraggableBox[0] = new DraggableBox();
    subdraggableBox[1] = new DraggableBox();
}

And when it is dragged to a main box I just call:

public void showSubDraggableBoxes(){
    addActor(subdraggableBox[0]);
    addActor(subdraggableBox[1]);
    icon.toFront();
}

This is what I want to accomplish.

Say the red is a special DraggableObject that creates subdraggable boxes when placed in a draggable box. So when it is there in the box I add to the group DraggableObject the two boxes. Currently I can drag any DraggableObject to a main box. When I drag an object to a box that has already an object it destroys the current object and places the new one instead, which is exactly what I want it to do.

The problem with red DraggableObjects is that when I Drag something to one of its subDraggableBoxes it erases the red draggable object (with the boxes) and substitutes it by the new one in the main DraggableBox. So by the time a RedDragBox is visible: RedDragableBox.parent() -> RedDraggableObject, RedDraggableObject.parent() -> DraggableBox (the main one).

Thanks in advance.

sentences:
Love2d: Failed to load tileset map I'm reading the Love2D Development book, which i think i will stop reading because is outdated and very instable, sometimes i got a lot of troubles. Backing to the question, i made a tileset map with Tiled and saved in .tmx with Base64 ( uncompressed ) then i used Advanced-Tiled-Loader and used the code from the book:

-- This is the main.lua file --

local loader = require ("Advanced-Tiled-Loader-master/Loader")

---the path to our .tmx files and sprites

loader.path = "map/"

local map = loader.load("tilemap.tmx")

function love.load()

    love.graphics.setBackgroundColor(255, 153, 0)

    --- load the level and bind the variable map

    loader.path = "map/"

    local map = loader.load("tilemap.tmx")
end

function love.draw()

    map:draw()

end

When i tested the game, the result was this:

http://i.imgur.com/JM8EYrv.png

The result was suposted to be like this:

http://i.imgur.com/W26XFjE.png

So what it could be?

sentences:
Does the Maya FBX 2013.3 exporter write tangent and binormal data? I'm making an XNA game at the moment and I'm trying to knock out my bump map shader right now. However when I compile the game crashes at the mesh.Draw() line and tells me TANGENT0 is missing. Apparently the FBX 2012 exporter didn't export tangent and binormal data properly, and I'm still having this problem despite installing the most recent exporter for Maya 2012.

For the record the plug-in readme tells me that bug is fixed and I am checking 'Tangents and Binormals' when I export.

What am I doing wrong?

sentences:
Model a chain with different elements in Unity 3D I have to model, in unity 3D, a chain that is composed of various elements. some flexible, some rigid. The idea is to realize a human-chain where each person is linked to the other by their hands.

I've not tried to implement it yet as i've no idea on what could be a good way to do it.
In the game i've to manage a lot of chains of people... maybe also 100 chains composed of 11-15 people. The chain will be pretty simple and there won't be much interaction... Probabily some animation of the people one at time for each chain and some physic reaction (for example pushing a people in a chain should slightle flex the chain)

the very problem of this work is that in the chain each object is composed by flexible parts (arms) and rigid parts (the body) and that the connection should remain firm... just like when people handshake... hands are firm and are the wrists to move.

i can use C4D to model the meshes.

i know this number may cause performance problems, but it's also true i will use low-poly versions of human. (for the real it won't be human, but very simple toonish characters that have harms and legs).
So actually i'm trying to find a way to manage this in a way it can work, the performance will be a later problem that i can solve.

If there is not a fast 'best-practiced' solution and you have any link/guide/doc that could help me in finding a way to realize this is, it would be very appreciated anyway if you post it.

thanks

sentences:
How to create a high score in Unity from a Time.deltatime float? When I play my game, it sets my score to 0 and does not change, no matter how high my float gets.

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

public class highscore : MonoBehaviour {

    public Text Highscore;

    void Start () {
        Highscore.text = PlayerPrefs.GetFloat ("Highscore", 0).ToString();
    }
}

This is where the next page starts

using UnityEngine;
using UnityEngine.UI;

public class Score : MonoBehaviour {

    public Text ScoreText;

    public float playerScore = 0;

    void Update () {
        playerScore += Time.deltaTime*10;

        {
            ScoreText.text = playerScore.ToString("0");
        }
    }

    private void OnCollisionEnter (Collision collisionInfo) {

        if (collisionInfo.collider.tag == "Obstacle")
        {
            PlayerPrefs.SetFloat ("Highscore", playerScore);
        }
    }
}

sentences:
Should references between assets be handled by name or ID or something else? How should content or asset items be referenced in their serialized form?

For example, a material might need to reference several textures. The simplest way would be to use a path, relative to the base directory of the assets.

Alternatively, all content items could be referenced by an ID. I implemented it this way (using GUIDs), which allows content items to be renamed or moved without breaking references. However, this makes it more difficult to replace a content item (delete the original, then rename something else to the same name... requires copy/pasting GUIDs around). It also makes debugging missing content trickier.

Is there a clear winning option here?

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:
Godot - Collision for character teleportation I'm currently working on a little game to discover Godot game engine.
It's a Top-Down game and I want my character to be able to teleport through walls.
I thought to dupplicate my character's collision box and to set its position to the teleportation's position but I didn't find a way to check if there is a collision to this new position.
Any advise?

sentences:
How can I use the same number of tiles in any screen resolution, with an isometric projection? I have an isometric grid with 64x32 diamond images. Each tile is a class, each instance is in a 2D array.

Players have different screen resolutions and the grid must take up the whole screen. Additionally, every player should always see the same tiles (so nobody has an advantage).

The only thing I could think of was to change the tile size: Bigger screen, bigger tiles.

I suppose I could do this by resizing my existing tile images, but is there a better way?

sentences: How to detect if game is hidden? I'd like to pause my game when my app is hidden (user pressed home button or changed app). How can I detect that ?

sentences:
How can I detect connected (but logically distinct) bodies of water in a 2D map? I have a 2D hexagonal grid map. Each hex cell has a height value used to determine if it's water or ocean. I'm trying to think of a good way to determine and label bodies of water. Oceans and inland seas are easy (using a flood fill algorithm).

But what about bodies of water like the Mediterranean? Bodies of water that are attached to larger ones (where "seas" and "gulfs" differ only by the size of the opening)?

Here's an example of what I'm trying to detect (the blue body of water in the middle of the image, which should be labelled differently from the larger body of ocean on the left, despite being technically connected):

Any ideas?

sentences:
Libgdx Application terminate in an unusual way I am developing simple multiplayer game using libgdx and box2D. And Im getting error below.

This application has requested the Runtime to terminate it in an unusual way.
Please contact the application's support team for more information.
AL lib: (EE) alc_cleanup: 1 device not closed
Assertion failed!

Program: C:\Program Files\Java\jre7\bin\javaw.exe
File: /var/lib/jenkins/workspace/libgdx/gdx/jni/Box2D/Dynamics/b2Body.cpp, Line 419

Expression: m_world->IsLocked() == false

I checked similar issue in SO which suggest that I may cause if we destroy Body before our World Stepping but its not case here.
While trying to debug this error I found that following code is causing error:

public void updateScene(PlayerStatus playerStatus){
    Vector2 pos = playerStatus.getPosition();
    Player coopPlayer = coopPlayers.get(playerStatus.getId());
    if (coopPlayer !=null){
          coopPlayer.b2body.setTransform(pos, 0);     //Main cause of error
          coopPlayer.setPosition(pos.x - coopPlayer.getWidth() / 2, pos.y - coopPlayer.getHeight() / 2);
    }
}

Any help is greatly appreciated.

sentences:
Loading a web page in unity Hello I need to open a page in unity and save some of it's contents but I have absolutely no idea how I should do it.

Thanks for help.

sentences:
Abstract skill/talent system implementation I've been making small 2D games for about 3 years now (XNA and more recently LWJGL/Slick2D). My latest idea would involve some form of "talent tree" system in a real time game.

I've been wracking my brain but can't think of a structure to hold a talent. Something like

  "Your melee attack is an instant kill if behind the target"

I'd like to come up with an abstract object rather than putting random conditionals into other methods. I've solved some relatively complex problems before but I don't even know where to begin with this one.

Any help would be appreciated - Java, pseudocode or general concepts are all great.

sentences:
Developing a platform - why are age verifications even a thing? I'm building an online gaming platform and have bumped into the question of age verification. Checkboxes such as "I verify that I am 13 years old or older" or a slider where you put in your age are common online when registering for accounts.

Why? I've been checking that box since I was a kid, it doesn't stop anyone. If you put it in your Terms of Service, is that enough?

Does any of this actually matter?

sentences:
Unity3D Problem Temporarily Stop Players Movement When Playing a specific Animation This is my first time in Unity3D and programming so forgive me if i'm a bit vague on this. I'm working on my own project in Unity3D but I couldn't get the player to stop moving when I press the key. I avoided using the GetButton since it triggered the animation to play twice. After bout 2 hours, I still can't find any answer to my problem.

Can someone help me please?

Here's part of the code of the the player script.

    if (Input.GetButtonDown("Fire1"))
    {
        animator.SetTrigger("AttackSword");
        Debug.Log("Animation called");
    }

    if(!animator.GetBool("AttackSword"))
    {
        Move(inputDir, running);
    }

If you would like me to add the full code of the script, let me know.

sentences:
World, view, projection matrix? What does multiplying an object in local space with a WVP(world,view,projection) matrix do?
My book says "local space to homogeneous clip space"

Luna, Frank D. (2012-05-21). Introduction to 3D Game Programming with DirectX 11 (Kindle Location 5444). Mercury Learning and Information. Kindle Edition.

sentences:
Early Z-test / depth-test in DirectX 11 As a DirectX noob i'm trying to wrap my head around depth buffers and specifically how pixel shaders are called for obscured pixels.

From what i understand, the rasterizer calls the pixel shader for each pixel that is covering the primitive beeing drawn, then later in the output merger stage, the output merger checks the depth buffer and either discards, writes or blends the pixel in the back buffer.

This seems wasteful though if i'm rendering a simple opaque object in front of a very complex one, so it seems it would be useful to have the rasterizer check the depthmap Before even calling the pixel shaders for the complex object.

Doing research i've found references to early Z test / conservative Z testing and so on, but there also seems to be very little documentation about it. i looked for a way to configure that on the rasterizer state desc object, but i only found anything like that on the OM state desc.

It also seems like this was possible to set with SetRenderState in DX9 (i have no experience with DX9 either though)

From my research it seems like this is something some hardware just does if i render objects front to back, is that correct? How can i even tell? With all the Control DirectX gives you it seems weird that there is no control over this, as it seems to be a good optimization :)

Any info or references on this is appriciated

sentences:
Efficiency of the SpriteBatch Does SpriteBatch in XNA draw to the screen only when a sprite would appear on the screen?

Say I have 5 identical sprites placed exactly on top of each other, is SpriteBatch able to determine that it only needs to draw one?

Also, say I have a large map that I've tiled off the screen in every direction.  Does SpriteBatch handle that it does not need to draw these sprites that are off the screen.

(Note: Yes my code should handle this, I am just curious)

sentences:
Is an ECS viable in garbage collected languages? I've done some research on Entity Component System architectures. Right now I have a convoluted OOP implementation which I'm planning on rewriting, so I was considering switching to a different architecture. Since everything was already composed using components, the switch from OOP to ECS shouldn't be too difficult. However, I'm doing my project in a language with managed memory and GC, and  a lot of the benefits of ECS are to do with memory management, processor cache, etc. so I was wondering whether there is any real performance advantage of ECS over OOP in a garbage collected language?
Also, I'm not too familiar with manual memory management and I haven't really used C/C++ for anything big.

sentences: Is 2048 a registered trademark? It looks like 2048 is a registered trademark of Ketchapp (obviously not the original author of 2048): https://trademarks.justia.com/865/87/2048-86587551.html . How applicable is this trademark and why are there still dozens of clones of 2048 on both Apple/Google Play store?

sentences:
Technical names for camera styles in 2D games In 2D gaming, the camera movement method has a lot do with the play style of the game.  I'm not super familiar with the technical terms for camera styles, so I'm going to describe them in hopes someone can tell me the name I could google to find out more info.  I'm also interested in hearing about any common styles I might have left off.
Latching camera style
The camera has fixed positions in the world where it cam be located and when a transition is made from one to the next, the whole world pauses while the screen moves.  An example of this would be like the camera in the original Zelda game.  There are "screens" and as you move from one screen to the next, the camera shifts to it's new fixed position in effect moving you to the next area.
Balloon camera style
The camera follows your every move.  In most games it lags slightly behind the player's movement as if the camera were attached to a balloon being held by the central character.  When the player stops moving, the balloon floats up, eventually coming to it's resting point directly above the central character's current location.  In some games, it just always stays directly on top, but it's effectively the same mechanic.

These are not the technical names (I googled them and nothing comes up, so I'm pretty sure they are not), but can someone tell me what the technical names are?  Also, are there any major styles of camera movement in 2D games that I have left off?

sentences: What is the best way to make a main menu system? I know that's it's easy to make buttons that highlight when you move your mouse over them, but when it comes to sub-menus I'm kinda stuck. Anyone got some tips on the best way to have a main menu with sub-menus? (like Singleplayer -> Load Save -> Save 1-5? -> Start game etc.)

sentences:
Unity3D Camera constantly moving I'm trying to make my own first person camera controls in unity that use both thumbsticks on a joypad. I have this working fine. However, when I move the right thumb stick (the one uses to look left / right & up / down the camera begins to constantly update.

Here is my joypad movement code:

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

    float speed = transform.localEulerAngles.y + Input.GetAxis("LeftRight") * sensitivityX;

    rotationY += Input.GetAxis("UpDown") * sensitivityY;
    rotationY = Mathf.Clamp(rotationY, minimumY, maximumY);

    transform.localEulerAngles = new Vector3(-rotationY, speed, 0);

}

To control the left thumb stick, I've simply attached the my script to a first person character controller Unity provide.

I know my code is updating every frame, but I assumed that it would only update as and when I press the right thumb stick. If that isn't the case, is there a way I can limit it to only increment when I move the right thumb stick?

sentences:
Making Modular Mini's Work in TTS This is not exactly game development, and I have also posted this in Arqade but it is development of a virtual playable version of a board game so maybe it loosely fits. Im hoping someone has an idea either way, or can point me to the right place to post this to get better results.

I am working to create a Tabletop Simulator mod for a newly Kickstarted game: Shiver Me Timbers.

https://www.kickstarter.com/projects/shivermetimbers/shiver-me-timbers-0/description

I have gotten all of the game pieces into the mod, all of the cards, tokens, tiles, I even made 3D models of the standees.

Where I am getting stuck is the pirate ship miniatures. These modular miniatures are what you use to move around the board. In the game one of the things you can do is upgrade your ship. When you upgrade the ship, or get damaged in some way, (IRL) you physically add or remove pieces from the mini (when you upgrade your hull you pull apart the front and back of the ship and add another hull section in between and put them back together, when you upgrade sails you add a different Mast to the ship, when upgrading cannons you push a new cannon into one of the holes in the side of the ship, when taking damage to any of these areas the opposite. You can see how this works in the different GIFs on the kickstarter page above). Each ship can have a maximum of up to 7 hulls, 7 sails, 7 cannons or any combination in between. Also each "hull" piece has a disk/wheel in it that determines what type of cargo you are carrying.

The problem I am running into is making the different components come together in a way that 1. stays together when moved, 2. is able to later be removed, and 3 allows for the disks to rotate/change as needed.

I originally thought about just using different states for each configuration of the mini but that would turn out to be 343 states for just the ship (not to mention the 4 positions each cargo disc can be in) and creating that many states for one mini would not only take an insane amount of time making the 3D models, but would be a HUGE number of assets for the game to load, and be extremely confusing when trying to find the correct state for the configuration you need.

I did decide (potentially incorrectly) to have set it up to use states for the 7 different hull configurations, and use the fixed joint tool to attach the cargo disks and that works, as long as you have each hull state set to be attached to the disk, or if you have each disk state (4 different states for the cargo types) set to attach to the base. But if I have both items having multiple states if I change the one that the Joint is going TO then it breaks and the disks fall out.

The other issue with the mini's is attaching Sail Masts and Cannons. If I bring in the basic ship base and attempt to add a piece to it (aka one of the masts) I can create a snap point that allows it to fit to the correct spot but it always immediately falls over and off of the ship.

I have thought about using the attach tool, but once you place the new part onto the base of the mini, by the time you can get to the attach tool and use it the new part has fallen off or fallen over. It cant just be pre-done (with a gizmo on a locked object or something) because the players have to be able to modify mid game.

I have enough ability with blender to work these models some (though still a bit of a beginner) and I have been trying to learn unity so that I can use the higher poly count ship models (the texturing was done with 3D geometry not a texture png) and set them up to be asset bundles. I have done a tiny bit of work with collider geometry in blender/unity. I also have a minor amount of programming ability and could muddle through learning LUA and doing some scripting to make it work if that is the solution.

Does anyone have any ideas how to make these "Modular" mini's a reality in the virtual space of TTS? Any Ideas are welcome. I Really want to figure this thing out. Thanks in advance.

sentences: How should player be able to hear 2D spatial sound? Let's say there is a multiplayer 2D game and a 2D spatial sound system, in which sound volume decreases, when distance to the sound position increases. E.g. explosion happens. Should player hear it if it's outside the camera's viewport zone? Basically, how big should a max distance to sound position should be? How is it handled in other 2D games?

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:
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:
How do I build games with scripted actors? The idea

I have an idea for a game. A few games, actually, that can built on top of the same general design.

There is a game world that the player and the other actors exist in. The player can get information from the world about his surroundings. The player can also interact with the world, picking up an object for example.
Now, I would like the same thing to be possible for other, scripted actors. They are the player's competition. Instead of navigating the world and performing actions based on human input, a script should decide what they do.

An example

I want to do this using a 2d world eventually, so I might as well give the example I want to build:

There is a 2d world with objects of various sizes and shapes. Every actor has their own field of view. They get information from the world about the objects in their field of view. For the player, this information is displayed on the screen of the user. The player navigates the world by user input.

Scripted actors navigate the world in a scripted way. They walk in a general direction, they follow a wall or things like that. Their scripts should be able to get the information about the objects in their field of view and act on it. If an other actor is detected in their field of view, they should walk in that direction for example.

All of this should happen in pretty much real-time.

The information gotten from the world (showed to the player, and given to the scripted actors) in this case would be something like a collection of "what", "where", and "in what orientation".

The question

My question is: how I can program this effectively and efficiently?

I am thinking to build this with C and Lua. C++ is also an option.
I would store the game state and display the graphics using C.
The part that I don't know how to handle is the interaction between C and Lua.
Not programming-wise, but design-wise. The interaction between the world and the scripted actors.

Should C provide the Lua actors with information, and then have the Lua actors call C functions that change their direction, move a step forward, etc? Will this work in real-time?

I realize that this question is broad, but I think it's not unreasonable. There are obviously ways to do this and I would like to know some.

sentences:
How to get buttons to follow the GUI perfectly while also being usable in GameMakerStudio Basically I'm trying to figure out how to make a button, that you can interact with that shows above the GUI draw event and locks perfectly to the screen.

The current draft I have the button is below the GUI layer so I need it above

The button is functional so thats good

The button does not lock perfectly to the screen when the camera stops it lags behind and has to catch up to the camera no matter what direction I move, I dont want the player to see the button actually following I want all the parts to move seamlessly together.

This is a gif of whats happening

sentences:
MonoGame - 2x2 texture scaling issue I've just recently switched from XNA to MonoGame and now I've run into something that has never happened to me in XNA before.

I've created a 2x2 texture and filled it with a color by doing this:

//Generates a texture from the color.
Texture2D texture = new Texture2D(Constants.GAME.GraphicsDevice, 2, 2, false, SurfaceFormat.Color);
texture.SetData<Color>(new Color[] { alternateColor });

AlternateColor = texture;

What I use this texture for is for drawing rectangles of different sizes using the specified color.
This has usually worked just fine for me in XNA but when I do this in MonoGame I get this:

The screen is suppose to be black here as I'm scaling that 2x2 texture up to fill the entire screen.

I've tried turning mipmaps off, I've tried turning multisampling off and I've tried setting my sample state [0] to use PointWrap but I just can't seem to get this to work.

Any suggestions would be much welcomed.

Thanks!

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:
Euler angles to directional vector I wanted to implement a directional light system in my game, and instead of passing the direction to the light, I chose to use an angle, and only later convert it to a directional vector, so it is a bit more easier, to manage.

I tried to search on the internet for a good solution to this conversion, but the answers I found said different things (Like this one and this one), and not always in understandable form (like using pitch, yaw and roll incorrectly). One of them said to use a format like

x = sin(roll) * sin(yaw)
y = sin(roll) * cos(yaw)
z = sin(yaw)

An other one used something like

x = cos(yaw) * cos(pitch)
y = cos(yaw) * sin(pitch)
z = sin(pitch)

So my question is:

What is the correct way to transform Euler angles (Tait-Bryan version) into a Directional vector?

sentences:
Drawing thousands of isometric tiles per frame with a high FPS This question seems similar to other questions but no other topics I saw helped.
I'm making a game in GML (GameMaker Language).

Regardless of the language/software, this should be a universal topic.

Okay, so I currently barely exceed 60FPS on a game with no code in the tick (step? frame? iteration?) so it should most definitely not be a CPU issue. My computer is fantastic and I can run nearly all (if not, all) games at ultra and high settings. Anyway, my game is isometric and tiles are 32x16.

The terrain data ds_grid (like a 2D array, but can't be jagged) is never changed except when loading other maps. I need the game to be played in a max of 1080p, and higher resolutions won't be implicitly supported.

So, I have a nested for-loop, to loop through a calculated minx/maxx and miny/maxy, basically defining the rectangular area in the terrain data ds_grid that I need to render. However, at the moment, in 1080p, after applying a variable called count to increment every iteration of the nested loop, I have nearly 8000 draw calls every frame, rendering every tile near the view.

Remember, the tiles are both isometric and small, so there are a lot of things needed to be rendered. There are multiple grass tiles to reduce texture repeating. There is also a water tile, and I may add other terrain tiles. So basically, I need a method of rendering tons of tiles (that don't change) with a much higher (preferably at least 300) FPS.

MORE INFO:
in GM, a ds_grid is a data structure that is very similar to a 2D array, where the main differences are that it cannot be jagged (it's similar to a table) and any cell can hold any data type, so I could have strings and real numbers etc. all in the same ds_grid.

My ds_grid contains enumeration values, such as tile.grass or tile.water.

The terrain does not fit within the screen borders, and resolution directly affects view size.

sentences:
How do I create a 2.5d parallax effect? I have a decent background in 3D graphics and programming, but I'm new to game development. I'm currently exploring different possibilities and I really want to make an RPG game. I was thinking about classic 2D isometric view, but I really love how Diablo 2 looks and feels to play.

My question is - how can I achieve Diablo 2's parallax effect? Everything looks hand drawn with baked lights and shadows and looks awesome, but when you move around you notice some perspective.

For example, let's say that I drew a big hall with columns in Photoshop with an orthographic perspective (classic pixel art style, just parallel lines). How would I give parallax effect to this scene when the character moves around? If I use camera-facing sprites for everything it would probably look OK in the distance, but it would be really fake when a character comes close to a column (cylinder) for example.

Any suggestions? How did Blizzard make the parallax effect in Diablo 2?

See this screenshot: http://guidesmedia.ign.com/guides/10629/images/act2tombs.jpg

sentences:
Is Physics2D.BoxCast a safe alternative to a row of raycasting? Raycasting in rows is a common practice.

Is using the Physics 2D BoxCast function a good alternative to using
multiple raycasts spread out (an example use being collision
detection in a custom character controller script)?
There is limited documentation on boxcasting. Would boxcasting be
too intensive or more friendly to call each frame?

sentences:
Component Based Design DLL I'm undecided on a design decision. Now for my game I was thinking on splitting components into separate dlls. This would allow for a more modular approach, especially when in need of updates. On launch it [the game] could swap out newer versions of the dll coming from a centralized server. This would allow us to provide updates to each component separately and also allow us to quickly swap dll's for different implementation.

Now is this design used, and how effective is it?

I started implementing it, and loading a dll through run-time ads a lot of complexity (unless i'm doing it wrong). Another problem that could arise is some components are optional. So it would ad additional complexity.

So what i'm trying to get to is: Is splitting separate components and subsystems in dll's?

This would allow the exe to be a lot smaller, and possibly make the whole system a little more organized.

sentences:
How do you categorize graphic designers for game development? I have hired a graphic designer locally and she is good at drawing things (cartoons, characters, etc.) and good at using Photoshop and Illustrator.

However, when we come to game UIs (such as the dialogs, buttons, etc.), she is not doing ok.

For game development, do you categorize graphic designers? Do you need more than one kind of graphic designer? especially for a small team (4-5 people)?

sentences: How to limit the distance of a point? I'm making an Angry Birds like game and I need to limit the distance that the user can pull back the slingshot, how do I do this?

sentences:
What are some Game Development Publications that accept outside articles What Are some Game Development publications (electronic or otherwise) that aren't so large that there is no chance to potentially get included in the publication after a few well-written articles sent their way.

Looking for publications geared towards developers, not gamers, and can be any aspect of the game process, design, development, business, etc.

sentences: How do I calculate a line segment that is a certain number of degrees from another line segment? I have a line segment that is at an arbitrary angle in 3D space. I want to (in code) draw another line that shares an end point with the first line and has an angle of arbitrary degrees between them. The second line will partially overlap the first in the XZ plane.

sentences:
Isometric smooth fog I'm working on a simple 2d game with direct3d 9. It's a isometric game with diamond tiles and a staggered map. This is what I have:

As you see I have some kind of fog which is acomplished by having a fog matrix which is true  (clear terrain) or false (obscure terran). But the result is very chunky. The fog moves as the player moves by tiles but not by pixels. Basically I check for every tile if there is fog, if so I just change the color of that tile:

D3DCOLOR tile_color = 0xffffffff;
if(scene->fog[i+mapx][j+mapy] == FOG_NONE) { tile_color = 0x666666FF; }
g_pSprite->Draw(texTilesNew,&rect,NULL, &D3DXVECTOR3(pantx,panty,0.0f), tile_color);

Where parameter tile_color is:

  A Color structure. The color and alpha channels are modulated by this
  value. The Transparent value maintains the original source color and
  alpha data.

I also would like the fog to be smoother, for that I followed this "tutorial" but I haven't managed to work it it out becuase I think the tutorial implements a diferent kind of fog than I am.

http://www.appsizematters.com/2010/07/how-to-implement-a-fog-of-war-part-2-smooth/

sentences:
How not to show ads to paid customers when I decided to make it free? I am planning to publish a paid game built with Unity. After a while I will update the game as free and will start showing ads. But I do not want my first paid customers to see the ads after installing update? How can I manage this?

Game will be both on App Store and Google Play.

Thanks

sentences:
Problems putting my game in fullscreen on GameMaker All the rooms in my game have the size of 1280x720, so normally my game runs like this:

When I try to enable fullscreen, none of the game's buttons respond to clicks, but the keyboard still works. So in the initial menu I clicked on the button to go to the settings room (image 1) and nothing happened, but when I typed "c" on my keyboard went to the settings room:

OBS - There is a distortion, but not the view in that image (I had to convert image 3 to jpg, because in png it was over 2MB in size).

I've thought about switching to 1920x1080 and hiding the title bar, but I'd really like to do things the "right way".

EDIT 1 - Another way to enable full screen. (It also does not work)

create event:

window_set_fullscreen(true);

EDIT 2 - By doing a few tests I noticed that when it is in full screen, the clicks behave as if it had a ghost room at the top left of the screen. Like this:

That is, I click the right side of the word music (in blue) and the language changes.

OBS - The buttons in my game are mostly sprites that I mapped and added a global left pressed event.

sentences:
Instantiate creates a clone in wrong position I have this prefab with this transform:

And then using this code to create a clone (the prefab is assigned to a public property of a script, which I assign using the editor, which is the e.Weapon):

Instantiate(e.Weapon, new Vector3(0f, 0f, 0f), Quaternion.identity, rightHand.transform);

I am parenting it to my character's right hand. But whenever the clone gets created, it has different position than the one I have in my code. It appears like this:

Any idea why this is happening?

sentences:
Collision detection with curves I'm working on a 2D game in which I would like to do collision detection between a moving circle and some kind of static curves (maybe Bezier curves).

Currently my game features only straight lines as the static geometry and I'm doing the collision detection by calculating the distance from the circle to the lines, and projecting the circle out of the line in case the distance is less than the circles radius.

How can I do this kind of collision detection in a relative straightforward way? I know for instance that Box2D features collision detection with Bezier curves. I don't need a full featured collision detection mechanism, just something that can do what I've described.

UPDATE: Thanks a lot for the great answers! I'll have to read up on Bezier curves to fully understand the method you've described. Then I'll get back to you.

sentences:
Why does this whirlpool simulation not work? I am trying to create a simple whirlpool simulation, where particles are constantly compelled to move towards a point in a whirlpool like fashion.

To do this I do the following (in sudo code)

variable speed = 1.0 //This can vary to speed things up
Rotate by (70 * speed) degrees
Move Forward (4 * speed) Steps
Point Towards center

And this works quite nicely, however as the particles get nearer to the center it breaks down causing there to be an area where they just circle around never getting closer to the center. The larger the speed variable is the larger the radius is that they begin to not move closer to the center.

If one decreases the rotate by to a value of like 50 degrees the anomaly is much smaller, however the points rotate around the center many less times.

Why is this happening? How can I fix this?

I am open to completely changing the method I use even if it means physics, however polar coordinates will not work because of the way the center moves among other simulation reasons.

sentences:
Trying to better understand Unity gameobjects New to Unity, but develop in C# normally.  I can't seem to get how / why / where to grab certain elements.  For simplicity, I have a top-level game object, say a cube.  I add a sphere to the scene as child to the cube. The child sphere (actually more complex), has navigation mesh, animation object, collider and finally a script in C#.

Now, my C# class is comprised of an instance of an C# class on the class.  Something like

public class CMyGeneric
{
   public void someMethod()
   {
      // invalid getting to "gameObject" reference
   }
}

public class CMyMainScript
{
   public CMyGeneric myGeneric;

   void Start()
   {
      myGeneric = new CMyGeneric();
   }

   void Update()
   {
      myGeneric.someMethod();
   }
}

So, the parent game object is the cube, the child is the sphere, and the CMyMainScript script is attached to the sphere.  However, when I try to reference "gameObject" via the CMyGeneric (instance), call within the "someMethod", the "someMethod" doesn't appear to see the overall "gameObject".

Now, how/what am I missing as each thing that gets attached, unity adds to these game objects, and I don't know how to get respective hierarchical levels of where things are even though I know where they are from a relative perspective.

sentences:
How is game difficulty tested/balanced? How is game difficulty typically tested or balanced so that there's a steady progression of difficulty; how do I ensure that no level is too difficult or too easy for its point in the game?

Are play testers of various skills brought in, or a random sampling of people? What considerations are/should be taken into account during the actual level design process?

sentences:
Box platform collision I'm working on a platform game and my collision code is to picky. I can't exactly do aabb(?) because the map is represented as metatiles. (23-24 16x16 tiles make up a 300ish pixel resolution.) My game thus far simply takes the player's x/y coords and divides them by 16 to check the current tile the player is in. Thus far the only thing I have managed is a very picky collision by simply checking the divided values against weather the tile in the map is solid or not and setting a bool to the player being blocked in that direction. It works, but not solid as the x and y velocity of the player changes so much the hit point of the collision does as well. For example going left at a small speed seems pixel perfect yet full speed results in the collision taking place 5 pixels before the actual collision.

Can anyone point me in the right direction on this?

sentences:
Display/hide image with zoom in/out After spending a while looking through the forums, I haven't been able to find a thread that deals with transforms on an image.

Essentially, what I'm trying to do is display and hide an image at the start of a level in a game I'm working on. The image should start out large and with 100% transparency, then shrink to a certain size within the camera bounds with no transparency, idle for a second, then fade back out the way it came.

How would this be done programmatically? Thanks in advance!

sentences:
Sign APK of several games with same or different key? When you choose a key for signing your APK for publishing in GooglePlay, you need to care of this key for the next 25 years if you want to do updates.

The key should not be shared with anyone.
The key should not be lost.

If you do several games, you face the question of having your key DeveloperName and sign all games with it, or have multiple keys like DeveloperName_GameOne for one game, DeveloperName_GameTwo for another, and so on.

Google says here http://developer.android.com/intl/es/tools/publishing/app-signing.html that if you sign several APPs with the same key, they may talk to each other. So it seems that having all with one key will allow future interoperability between games easier.

Instead, if at some point someone wants to buy you one of your games, but not the other, you don't want to give the keys to the non-sold games but still you don't want the buyer to break the update-flow. So it seems that having each game with a different key is better.

Question 1

What exact benefeits will one have if one signs 2 games with the same key? Is that necessary? Is that worth for future interop between games?

Question 2

What is the correct practice for an indie doing several games regarding the signature of them?

sentences:
What are some easy to use 3D painting programs? I'm looking for an (easy to use) "3D painting" program, a program that lets me load up a UV-mapped mesh, some textures and lets me 'paint' with those different textures.

Exactly like all those terrain painting programs (Unity 3D has one integrated for example) but for a generic mesh, not just a height map.

Cheap is better of course but ease to use is the most important.

Script support is a big plus though.

sentences:
Improve (adding randomness) minmax algorithm for Connect Four I have implemented the minmax algorithm for the Connect Four game. It works well (almost...), but if the player does the same moves, the computer will do the same moves as well, for each match. There is no randomness in the computer choices. This is the code for the minmax:

private int[] minmax(int depth, Seed player) {
    // Generate possible next moves in a List of int[2] of {row, col}.
    List<int[]> nextMoves = generateMoves();

    // mySeed is maximizing; while oppSeed is minimizing
    int bestScore = (player == mySeed) ? Integer.MIN_VALUE : Integer.MAX_VALUE;
    int currentScore;
    int bestRow = -1;
    int bestCol = -1;

    if (nextMoves.isEmpty() || depth == 0) {
        // Gameover or depth reached, evaluate score
        bestScore = evaluate();
    } else {
        for (int[] move : nextMoves) {
            // Try this move for the current "player"
            cells[move[0]][move[1]].setContent(player);
            if (player == mySeed) { // mySeed (computer) is maximizing player
                currentScore = minmax(depth - 1, oppSeed)[0];
                if (currentScore > bestScore) {
                    bestScore = currentScore;
                    bestRow = move[0];
                    bestCol = move[1];
                }
            } else { // oppSeed is minimizing player
                currentScore = minmax(depth - 1, mySeed)[0];
                if (currentScore < bestScore) {
                    bestScore = currentScore;
                    bestRow = move[0];
                    bestCol = move[1];
                }
            }
            // Undo move
            cells[move[0]][move[1]].setContent(Seed.EMPTY);
        }
    }
    return new int[] { bestScore, bestRow, bestCol };
}

/**
 * Find all valid next moves. Return List of moves in int[2] of {row, col}
 * or empty list if gameover
 */
private List<int[]> generateMoves() {
    List<int[]> nextMoves = new ArrayList<int[]>(); // allocate List

    boolean[] columns = {false,false,false,false,false,false,false};

    // If gameover, i.e., no next move
    if (hasWon(mySeed) || hasWon(oppSeed)) {
        return nextMoves; // return empty list
    }

    // Search for possible moves and add to the List
    for(int row = GameMain.ROWS - 1; row >= 0; row--) {
        for(int col = 0; col < GameMain.COLS; col++) {
            if(columns[col] == false && cells[row][col].getContent() == Seed.EMPTY) {
                columns[col] = true;
                nextMoves.add(new int[] { row, col });
            }
        }
    }

    return nextMoves;
}

/**
 * The heuristic evaluation function for the current board
 *
 * Counts open 3 in a row for each player
 */
private int evaluate() {
    int score = 0;

    // very good move for computer
    if(hasWon(mySeed)) {
        return Integer.MAX_VALUE;
    }

    // very bad move, player wins!
    if(hasWon(oppSeed)) {
        return -Integer.MIN_VALUE;
    }

    // counts open 3 in a row for the computer and the player
    int myThree = openThree(mySeed);
    int oppThree = openThree(oppSeed);

    score = myThree - oppThree; // if negative, player advantage, otherwise computer advantage

    return score;
}

I have omitted the openThree method for brevity.

Bug: the computer skips his turn when is destined to lose.

Ps: the main code for minmax is taken from a tutorial.

This is a situation in which the computer skips his turn:

Red is the player, blue is the computer.

The computer does not freeze, he can continue to play, but not always. For example in this situation if i place my red circle over 15, the computer will skip his turn again, while if i place my red circle over 9, the computer will win placing his blue circle over this last one placed by me.

Project zip

sentences:
Draw trajectory arc predictor in game I found this tutorial on youtube and it works pretty well, but I want to add more to it.

How can I draw a smooth arc path in the game view (right now the path is only visible in the editor)?

Here is the code:

public class BallLauncher : MonoBehaviour
{

    public Rigidbody ball;
    public Transform target;

    public float h = 25;
    public float gravity = -18;

    public bool debugPath;

    void Start() {
        ball.useGravity = false;
    }

    void Update() {
        if (Input.GetKeyDown (KeyCode.Space)) {
            Launch ();
        }

        if (debugPath) {
            DrawPath ();
        }
    }

    void Launch() {
        Physics.gravity = Vector3.up * gravity;
        ball.useGravity = true;
        ball.velocity = CalculateLaunchData ().initialVelocity;
    }

    LaunchData CalculateLaunchData() {
        float displacementY = target.position.y - ball.position.y;
        Vector3 displacementXZ = new Vector3 (target.position.x - ball.position.x, 0, target.position.z - ball.position.z);
        float time = Mathf.Sqrt(-2*h/gravity) + Mathf.Sqrt(2*(displacementY - h)/gravity);
        Vector3 velocityY = Vector3.up * Mathf.Sqrt (-2 * gravity * h);
        Vector3 velocityXZ = displacementXZ / time;

        return new LaunchData(velocityXZ + velocityY * -Mathf.Sign(gravity), time);
    }

    void DrawPath() {
        LaunchData launchData = CalculateLaunchData ();
        Vector3 previousDrawPoint = ball.position;

        int resolution = 30;
        for (int i = 1; i <= resolution; i++) {
            float simulationTime = i / (float)resolution * launchData.timeToTarget;
            Vector3 displacement = launchData.initialVelocity * simulationTime + Vector3.up *gravity * simulationTime * simulationTime / 2f;
            Vector3 drawPoint = ball.position + displacement;
            Debug.DrawLine (previousDrawPoint, drawPoint, Color.green);
            previousDrawPoint = drawPoint;
        }
    }

    struct LaunchData {
        public readonly Vector3 initialVelocity;
        public readonly float timeToTarget;

        public LaunchData (Vector3 initialVelocity, float timeToTarget)
        {
            this.initialVelocity = initialVelocity;
            this.timeToTarget = timeToTarget;
        }

    }
}

I found a way to Instantiate projectile along the path. Now I just need to know how to convert that line in debug mode to make it visible in game mode

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:
OpenGL Blending Format In OpenGL, is there a format for a texture in glTexImage2D that prevents blending, or do you have to disable it using glDisable(GL_BLEND).

Reason for use is that I would like to store additional data in the alpha channel of a texture, but it blends with whatever's behind it.

sentences:
What threading strategy does a game like Transport Tycoon use? Transport Tycoon is a simulation game where you control a transport company, place railroad tracks and trains, airports, bus depots, boats etc. Now the game is about 15 years old and I remember running it on a 486sx25 with 4Mb of RAM without any problems.

I was recently thinking about modern simulation game requirements and how high they are for relatively little increase in graphics and gameplay, so how did they managed to pull it with so little resources back in the day?

Does each train car have a thread, that moves it every 100ms, sleeps, wakes, recalculates position and does crash detection, and goes back to sleep?

Or is it one thread that moves every 100ms? What happens if there is too much work to do in each 100ms interval?

sentences:
Combining cubes Issue in Marching Cubes I was trying to implement the marching cubes and combine every little cube this way:

I get a cube of vertices depending on their surfaceLevel
I look for the ones that are below the surfaceLevel and get the edges that relates to them
get a vertice out of the edge using the formula on: http://paulbourke.net/geometry/polygonise/
I put every vertex i created based on the edges on mesh.vertices
I make the order on mesh.triangles based of the edge number on triTable
i combine everything
but i get this:

Here's my code: https://pastebin.com/jqetCk8r.
My guess was that the combine order of every marched little cube is not good.
I've got no idea know how to solve this.
ps: the triTable doesn't show in the pastebin, i copied it from the same link above.

sentences: Best way to do buttons for an OpenGL ES iPhone game I'm making a simple 2d game in OpenGL ES and I want to add movement buttons to it. What's the best way of going about this? In previous projects I've simply added UIButtons to the view but I hear there are performance implications in doing so with OpenGL ES so I'm wondering what the possible alternatives are if so.

sentences:
How are deterministic games possible in the face of floating-point non-determinism? To make a game like an RTS networked, I've seen a number of answers here suggest to make the game completely deterministic; then you only have to transfer the users' actions to each other, and lag what's displayed a little bit in order to "lock in" everyone's input before the next frame is rendered.  Then things like unit's positions, health, etc. don't need to be constantly updated over the network, because every player's simulation will be exactly the same.  I've also heard the same thing suggested for making replays.

However, since floating-point calculations are non-deterministic between machines, or even between different compilations of the same program on the same machine, is this really possible to do?  How do we prevent that fact from causing small differences between players (or replays) that ripple throughout the game?

I've heard some people suggest avoiding floating-point numbers altogether and using int to represent the quotient of a fraction, but that doesn't sound practical to me - what if I need to, for example, take the cosine of an angle?  Do I seriously need to rewrite an entire math library?

Note that I am mainly interested in C#, which as far as I can tell, has exactly the same problems as C++ in this regard.

sentences:
Facebook link gives "This game is not available for your phone" I am developing a game in Unity and have connected to FB using the plugin.
I am able to login and send a request to another user with no problems.

However, when I click on the notification I get the message "This game is not available for your phone".

Everything is set up as it should be and both users are defined as developers for the app.

The only thing is that I have not yet published the app in FB. Is that a requirement?

sentences:
Handling XBox 360 Controller Connections in LibGDX after Game has Started I am currently making a game with the java library LibGDX and want to add XBox 360 controller support using the GDX-Controllers extension. At the moment I have a setup where I create a listener to listen for particular button presses, then attach that listener to the static Controllers class using the method: Controllers.addListener(myListener)

This method works fine for listening for button press events from controllers which were connected at the time the program started but, if I try connecting a controller after the game has started, events for this controller are not registered.

I cannot see from the source code a way to update the listener for new controllers, and it appears from this blog post that disconnects and re-connects may not be supported on the desktop.

My question is: Is there a solution to my problem using GDX-controllers and, if not, what are my options for getting full Xbox 360 controller support (Including controller connects and disconnects) If I want functionality which integrates with the libGDX framework?

sentences:
How to start simple game development with Unity 5 I want to start developing games with Unity because it's easy to learn, but I don't know where to start.

My questions are:
- Which preparations should I make for a game?
- Are there any tips and tricks for efficient work?
- Do I need special equipment?

Thank you for your response!

sentences:
why is it faster to draw lots of small arrays than one big array? This application on-line here has interesting performance characteristics:

Sorting the rectangles to be drawn so it keeps having to change colour is faster than sorting the rectangles by their colour and drawing all of each colour at once...

(Timings are printed to Javascript console.  Javascript profiling and understanding what is happening between the emitting of draw ops and the actual rendering of frames is, well, guesswork and disappointment.  But the result is still surprising (to me).)

I'm very interested in the fps logged to the javascript console when run in your browser, and how it differs when sorted by colour vs sorted by z

Now naturally I assume GPU batches are expensive and in my normal apps I get that impression, but I cannot distill a simple test case to show this; quite the opposite, in fact!

Deep in my code, it places all the vertex data interleaved into a single big VBO array.  It then calls glDrawArrays as often as needed.  So drawing a rectangle (6 vertices, each 4 floats) in three colours can be:

Red*1,Blue*1,Red*1 = 3 glDrawArrays calls
Red*2,Blue*1 = 2 glDrawArrays calls, but is slower

I am not sorting, creating, uploading the vertices each frame.  I compute the buffers to draw once.  Each frame, I simply call glDrawArrays as often as needed.

Because I've built this vertex attribute VBO once, and keep reusing it, I have a tight little draw-loop for rendering each frame.  So the Javascript code is doing more work when I have lots of little calls, and less work when I'm emitting concatenated rectangles.

So why is it faster to call glDrawArrays multiple times with small sub-sequences of the array, instead of calling it only a few times and telling it draw long sequences from the array?

Related: there's +500 pts up for grabs over on StackOverflow for the best general discussion about optimising the drawing of a 2D scene.

sentences:
Determining the first future intersection possible between ships and a planet Somewhat of an extension of this.

The Problem

I have a ship being launched from a planet, and I would like it to travel at a constant speed and direction such that it intersects another planet the soonest that it can.

(Beautiful diagram courtesy of Ausa)

I am ignoring initial velocity, end velocity, and gravity. The angular velocity of the planets and the velocity of the ship is constant. The physics that I am trying to achieve need not be realistic.

Using some quick maths I created a function! The function determines the smallest fly-by distance from the ship to the planet over time if the ship were to take the optimal route (a linear route since there's no gravity). So by determining when the fly-by distance is 0 (when the paths of the ship and planet intersect) I can work backwards to easily determine the angle of which I must launch the ship at to achieve this.

I created an implementation of the Bisection Method to find the first root of the function but depending on the variables of the function, the bisection method isn't the best solution to this problem. So now I'm trying to solve it mathematically! This is essentially what I need to solve:

Any solutions or ideas are greatly appreciated, thank you!

TL;DR:

This means I want to find the x-intersection of the function nearest to the origin.

Desmos

If you're interested in playing around with this function, I graphed it in Desmos https://www.desmos.com/calculator/tdtzt1gqkl

r_0 radius from the planet to the sun ("magic" units)

a_0 current angle of the planet in relation to the run (clockwise radians)

s_0 angular speed of the planet (clockwise radians per second

x_1 current x-position of the ship ("magic" units)

y_1 current y-position of the ship ("magic" units)

s_1 speed of the ship ("magic" units per second)

x_p planet x-position at x time ("magic" units)

y_p planet y-position at x time ("magic" units)

d_x delta x-position from ship to planet at x time ("magic" units)

d_y delta y-position from ship to planet at x time ("magic" units)

d_net net delta position from ship to planet at x time ("magic" units)

v_x optimal x-component of ship velocity ("magic" units per second)

v_y optimal y-component of ship velocity ("magic" units per second)

x_s ship x-position at x time ("magic" units)

y_s ship y-position at x time ("magic" units)

f(x) net distance from planet to ship at x time

sentences:
Why isn't my background drawing to the screen? Ok, So I have a game I have been working on for a few months now and I am now stumped beyond belief. My friend who has spent days working on this background gave it to me and I put it in my game. On the phone the background draws fine, on the PC the background draws fine but my tablet refuses to draw the background and I have no idea why. The game was pretty much built for tablet and I really need an answer because I want to release this to google play soon to make it worth while for the friends who put the effort into this game. Do any of you have any idea why this isn't working? The file for the background is pretty big is that the reason (2500x2500)?

Here is the code to the drawing method

    //Render Function When in Play Mode
private void renderPlayMode(){

    //Draw background
    background.render(mainBatch);

    foreground.render(mainBatch);

}

The background.render and the foreground.render are the two functions that cause the game to go black on the tablet. I really need an answer, please!

EDIT

Ok, so the code above is the code that screws up the tablet and makes the screen black. Because the foreground.render is the last thing that is drawn it makes the entire screen black and if I comment out that line the background.render just makes the entire background black and no drawing.

sentences:
Unity - OnDestroy - When is it called? I was wondering about the method called OnDestroy in Unity (4.5.2f1) on Windows 8.1 Update 1. I know garbage collection in C# in non-deterministic, so I was wondering if game objects had OnDestroy called the moment I called Destroy on them, or when the garbage collector was invoked?

If this is not the case, what are my alternatives? I could of course just call a method inside of the object to be destroyed just before I invoke destroy, but there may be a more elegant solution available that I don't know about.

Note: I did try checking this myself, but being non-deterministic I may not be able to rely on that behavior occurring every time.

sentences:
Setting up a low res viewport to stretch in Unity I am working on porting a low-res game over to Unity. In my previous engine, I had the option to set a native resolution (say, 160 x 144), and it would automatically stretch when the player entered fullscreen (with options for whether you wanted to keep the same aspect ratio, or stretch).

I am having trouble figuring out how to set up something similar in Unity. I see that you can play around with resolution settings from Edit > Project Settings > Player. I tried various combinations of Default Is Fullscreen, Default Is Native Resolution, and Default Screen Width and Default Screen Height, but I haven't been able to get it to work.

When I play the scene in the editor, the viewport is still much larger than my desired resolution. And when I Maximize On Play, the FOV is even larger.

I Googled around, but couldn't find an answer that helped.

Any advice?

sentences:
Create Adventure Game Scene/Room/Backdrop from Real Photo Is there a suitable software or a good tutorial for creating 2D rooms/scenery for adventure games from real photos?

Is it possible to achieve good results by using photos, or the hand-drawn style will always be the best choice?

Thank you!

--- EDIT ---

I want to clarify that I'm particularly interested in the art creation process, not on the environment in which to build games. I'm writing the game in Java for Android, but I don't think it matters.

Also, I'm not trying to decide if the game will have photo realistic rooms or not - I want to achieve 2d pixelated, old-school style background scenes and I wonder if this can be made from photos, because I cannot draw them myself.

For example, can I shoot a scene with my camera and then make it look something like the image in the following link:

PIXEL ART FOREST

I know that I cannot get the same quality as an absolutely hand-drawn pixel, but I'm looking for some decent technology/tutorial/software to make them somewhat similar.

sentences:
How can I load .obj files in the Soya3D engine? I recently found Soya3D, and I want to import .obj files, but it seems to only accept .data files.  How can I import .obj files into Soya3D?

Importing a .obj file named "house" produces this error:

  Traceback (most recent call last):
   File "introduction.py", line 7, in
    model = soya.Model.get("house")
   File "/usr/lib/pymodules/python2.6/soya/init.py", line 259, in get
    return klass._alls.get(filename) or klass._alls.setdefault(filename, klass.load(filename))
   File "/usr/lib/pymodules/python2.6/soya/init.py", line 268, in load
    dirname  = klass._get_directory_for_loading_and_check_export(filename)
   File "/usr/lib/pymodules/python2.6/soya/init.py", line 194, in _get_directory_for_loading_and_check_export
    dirname = klass._get_directory_for_loading(filename, ext)
   File "/usr/lib/pymodules/python2.6/soya/init.py", line 171, in _get_directory_for_loading
    raise ValueError("Cannot find a %s named %s!" % (klass, filename))
  ValueError: Cannot find a  named house!
  * Soya3D * Quit...

sentences:
How would I rotate my billboards parallel to the camera view? I'm trying to make my own space-sim in Godot and I'm stuck trying to get the visuals of the "starfield"-effect that is a staple of the genre. I'm using a Particle system with billboards that would be parallel to the camera's view (creating something like a cylinder).

I'm struggling with the math involved in the Vertex shader to transform those billboards. Can anyone help me?

sentences:
Phaser 3 - How to trigger an event every 1 second? I have just started learning Phaser 3 and making a simple idle game, where you would gain x resources per second. What is the best/recommended way to do something like this?

The two main ways I have found so far are:

delayedCall - this.time.delayedCall(1000, onEvent, null, this);

addEvent - this.time.addEvent({ delay: 1000, callback: onEvent, callbackScope: this });

But I read that Phaser update/rendering is in lockstep and runs at 60fps. So if the game were to drop in FPS, then other things like movement, physics etc. would slow down, but would the timers still fire every second? ie you could end up gaining more resources then you should have as the game is running.

Would it not be better to do a modulus 60 frame count, and invoke any per second logic in that manner?

sentences: what makes render() and update() change frame 60 times every second in LibGDX Whenever we declare the render(float deltatime) or update(float deltatime), in any class, it automatically become a method that is repeated 60 times per second. But what makes this method repeat itself 60 fps? What makes the method do that? In some classes, I am not implementing any other interface or expending any abstract class but that still makes the render(float deltatim) and update(float deltatime) work. Also, even though I do expend a interface like Game, how does the render(float deltatime) work? I mean, there is no special code within the render() in the Game interface class as well.

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 program an attack that I control with the arrow keys? I'm making a 2D game prototype in Unity and I want to have the player attack be a sword that hovers around the player with its direction being fixed to the direction you indicate with the arrow keys. So if the sword is in the upward position and you press the left button, you can see the arc it takes and an enemy in the way of that arc takes damage.

The game is not a platformer. It's on a flat surface.

edit: I want to know how to have the sword hover in a radius to the player and point the direction i press the arrow keys. I want to get the action of moving the sword to these positions to do damage to an enemy. But if the sword is in a upwards position and the player presses down, I want it to do an action that attacks the whole radius around the player, on a cooldown.

How would I go about programming this? I'm new to programming so I would greatly appreciate some helpful pointers.

Edit2:

So this is how far I have gotten:
public class SwordSwing : MonoBehaviour {

public Transform swordHolder;

// Update is called once per frame
void Update ()
{
    if (Input.GetKeyDown(KeyCode.LeftArrow))
    {
        swordHolder.transform.Rotate(0, 0, -90);
    }

    if (Input.GetKeyDown(KeyCode.RightArrow))
    {
        swordHolder.transform.Rotate(0, 0, 90);
    }

    if (Input.GetKeyDown(KeyCode.UpArrow))
    {
        swordHolder.transform.Rotate(0, 0, 90);
    }

    if (Input.GetKeyDown(KeyCode.DownArrow))
    {
        swordHolder.transform.Rotate(0, 0, -90);
    }

}

I don't know if this is right, because when I use the arrow keys it just turns the sword 90 degrees and not to the specified position I want it to move to.

So Candid Moon said that I have to use Mathf.Lerp() and StartCoroutine() but I have no idea how to use them. I'm not really sure how to animate this either, I have done some animations in Unity but have a hard time implementing them into anything.

The hierarchy is now:

Player > SwordHolder > Sword

Now I also have this script:

if (GetComponent<Rigidbody2D>().velocity.x > 0)
        transform.localScale = new Vector3(1f, 1f, 1f);
    else if (GetComponent<Rigidbody2D>().velocity.x < 0)
        transform.localScale = new Vector3(-1f,1f,1f);

That flips the player sprite when i move left. This also flips the sword, I don't really want this. How do I stop it?

Let me know if there is anything I missed, I'm trying to learn.

sentences:
How to resize a button without resizing its text I think it is done with the Anchors of the Rect Transform. I have tried all the possible combinations of the following default anchors:

Unfortunately, when I resize the button in the Scene, the text is always stretched:

sentences:
Jagged array - check if array index is out of range Hey I am a bit confused about how to properly check a Jagged array for "index out of range exceptions"

Im quite sure im somehow supposed to use the .Length of the array but it confuses me to read this, because my tiles are of a TileType type (enum):

https://msdn.microsoft.com/en-us/library/system.array.length.aspx

https://stackoverflow.com/questions/37233225/c-sharp-how-can-i-check-if-a-multidimensional-array-has-a-value-and-its-index

https://stackoverflow.com/questions/25562496/how-to-check-if-multidimensional-array-row-contains-non-zero-value

What im doing is creating a grid of tiles and running through them after the fact and setting their values to have a collider (red in this case) if they are in the correct position. In order to do this I have to check the tiles surrounding the one I am currently on. This sometimes, albeit rarely, leads to an index of out range exception because the tile I am on is on the edge of the tile grid and thus it cannot find the tile I am looking for.

Here is a small peice of the code:

 void SetTilesValuesForRooms()
{
    // Go through all the rooms...
    for (int i = 0; i < rooms.Length; i++)
    {
        Room currentRoom = rooms[i];

        // ... and for each room go through it's width.
        for (int j = 0; j < currentRoom.roomWidth; j++)
        {
            int xCoord = currentRoom.xPos + j;

            //// For each horizontal tile, go up vertically through the room's height.
            for (int k = 0; k < currentRoom.roomHeight; k++)
            {
                int yCoord = currentRoom.yPos + k;

                // Make the left wall have colliders
                // this line is the culprit
                if (xCoord == currentRoom.xPos && tiles[xCoord - 1][yCoord - 1] == TileType.Wall || tiles[xCoord - 1][yCoord] == TileType.Wall)
                {
                    tiles[xCoord - 1][yCoord - 1] = TileType.Red;

                    if (yCoord == currentRoom.yPos + currentRoom.roomHeight - 1 && tiles[xCoord - 1][yCoord] == TileType.Wall)
                    {
                        tiles[xCoord - 1][yCoord] = TileType.Red;

                        if (tiles[xCoord - 1][yCoord + 1] == TileType.Wall)
                        {
                            tiles[xCoord - 1][yCoord + 1] = TileType.Red;
                        }
                    }
                }

Im quite interested to know how I would properly go about checking if the tile I am about to correct is out of range or not.

thank you.

sentences:
How do I write a shader that lights up when objects are near a surface? In this Overwatch gameplay video, the character's shield lights up white in areas that are near other objects' geometry.

Note the white edges on the blue shield, near the floor, walls and pillar.

I believe the shield has its own model and the effect is done with a shader, but I'm lost trying to figure how to translate the concept of "nearness" to shader programming.

sentences:
How to run different animations with same suffix for different public objects? I would like to be able to run the corresponding animation (ending with "Get" in the title) for whatever item GameObject I plug into this treasurebox.

I made 2 prefabs for "item-get" animations today. Both GameObjects consist of 3 sprites: The image representing the item, and 2 lightray images that I enable/disable in alternation to get a halo effect (see animation below).

You can see the 2 prefabs and their corresponding animation components in the Project panel:

These next two images show how similar the animations are--they even both require two of the same sprites, flareA and flareB.

Here is the code I am currently using to set the state of the ItemBox GameObject and run the animations. You can see that while the itemGet prefab is public (that is, I can plug in whatever gameobject I want in the editor), line 27 explicitly calls for the animation belonging only to the turd item.

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

public class ItemBox : MonoBehaviour
{

    bool disabled = false;
    private Animator anim;
    public GameObject itemGet = null;

    void Start()
    {
        anim = GetComponent<Animator>();
        if (!disabled)
        {
            anim.Play("ItemBoxIdleState");
        }
    }

    void OnTriggerEnter (Collider other)
    {
        if (!disabled && other.gameObject.tag == "Player")
        {
            anim.Play("ItemBoxGetItemState");
            GameObject itemClone = Instantiate(itemGet, transform.position + new Vector3(0, 0.375f, 0), Camera.main.transform.rotation);
            itemClone.GetComponent<Animator>().Play("turdGet");
            Destroy(itemClone, 1.6f);
            disabled = true;
        }
    }
}

How can I change line 27 (the line before 'Destroy') so that it runs the appropriate "*Get" animation for whatever itemGet object I plug into the inspector? I think I am already close. I intend to make more items (not too many for now) and the animation I want to play will always be structured like "Get".

UPDATE 07/29/19:  I tried making a public AnimationClip object in the ItemBox script and putting that name in quotes for line 27 and thw script still works, but now I get an index error saying the animation state was not found. I don't think I can plug the name of the public variable into the .Play("") quotes and make it work; I think it only worked because there is only one animation for that item anyway. I ended up removing this new variable and just keeping the .Play("") part as empty quotes and it still works. I might decide to add more animations to these item objects later so I still need to know how to specifically play the animation that ends in "Get".

sentences:
Lerp rotation is offset I am trying to get an object to slowly look at another object, that is, rotate slowly so its forward points towards the target position. Here is my code:

using UnityEngine;

public class LookAtTheDamnThing: MonoBehaviour
{
    public Transform target;
    public float speed;

    void FixedUpdate()
    {
        AimAtTarget();
    }

    public void AimAtTarget()
    {
        Vector3 direction = target.position - transform.position;
        Quaternion toRotation = Quaternion.FromToRotation(transform.forward, direction);
        transform.rotation = Quaternion.Lerp(transform.rotation, toRotation, speed * Time.time);
        Vector3 fwd = this.transform.TransformDirection(Vector3.forward);
        Debug.DrawRay(this.transform.position, fwd * 50, Color.green);
    }
}

This results in the object looking kind of towards the target but never actually looking at it. I cannot for the life of me see my mistake. Can anyone help me?

sentences:
Separate renderng thread in Android (OpenGL ES 2.0) I'm used to mainly working with the Canvas SurfaceView API on Android and have recently been learning openGL ES 2.0

With canvas I know that surfaceView gives you the ability to start a new thread to render on, but it doesn't specifically do this for you, so I was creating a new thread and managing that thread when the app was ended / paused etc....

However, from what I've read with glSurfaceView it seems that this is actually done for you automatically? Does this mean I don't actually need to manually create / start and manage my own rendering thread? (I'm talking specifically about a rendering thread (which could also be used for logic updates) which is separate the main UI thread.

Clarification on this matter would be greatly appreciated.

sentences:
How to make sure that when two bodies collide, there is only one collision detection on box2d? I'm using LibGDX with Box2D and, when two bodies collide, the collision is detected multiple times.

Here's the code:

public void preSolve(Contact contact, Manifold oldManifold)
{
  Body a = contact.getFixtureA().getBody();
  Body b = contact.getFixtureB().getBody();

  if ((Utils.IsPlayer(a) && Utils.IsEnemy(b)) ||
      (Utils.IsEnemy(a)  && Utils.bodyIsPlayer(b)))
  {
    player.isHit = true;
    player.destroy();
    System.out.println(player.isHit);
  }
}

The player is destroyed multiple times; I want the player to be destroyed only once.

sentences:
Tilting towards turn direction (for a motorbike) I have a motorbike which moves along based on a direction vector, I set its forward direction to the direction it's moving.

What I'd like to also do with it is have the motorcycle tilt in the direction it's turning, I haven't had much luck figuring this out though, any ideas?

sentences:
How do developers get their money with Steam Direct? Here's what I know:
Steam is a digital distribution platform developed and owned by the Valve corporation. Steam is mostly known for its video games, XR software, and game development programs. Earlier, the products that were to be published to Steam were decided by the method of voting. This system was called Steam Greenlight. Now, a developer can just pay a sum of IN₹ 7,000 (US$ 100) and publish his/her product to Steam directly. This new system is called 'Steam Direct'.

Here's what I need to know:

In the new system of Steam Direct, do developers get any money off every copy of their product(s) sold on Steam?
If they do, what percentage of money is kept by Steam (or taken away for taxes and/or other purposes) and what percentage is given to the developers of the product?
If developers do get money by selling their products on Steam, what is the most common means by which they receive payments?

sentences:
Fullscreen + Vsync = Stuttering In my research for a stuttering problem in my game engine, I think, I have found the problem, but don't have any idea why this is happening, that's why I ask you if you have an idea !

The situation :
DirectX10 under win7 simple engine. If running fullscreen (and only in fullscreen), with Vsync On and the rendering loop going much more faster than the vsync ==> Stutter (Frame dropped by the driver).

My base solution at this moment : Make the call to device.present() not faster than the Vsync !

My questions :
- What is happening here ? It seems that the called to .present() "is caching" frames, and if the cache is full, it can go to throw away a frame ==> It makes the stutter !
- Why is it not happening in windowed mode under the exact same situation (back buffer resolution, scene, ...) ???

Edit :
Here is a Pix debugging screen (big picture), showing the stuttering :
http://www.s33m3.be/PIX/PIX3.png
You can see that frame 912, that did exactly the same amount of work as other frames, wasn't processed by the GPU. (No GPU start/Duration). And after debugging, it just that for this frame the call to .Present() was really low (more then 10 times faster than the average .Present() of the other frames !

So how can I disable in DirectX10  this "feature" to throw aways frames ? I would prefer the Present method to hold instead of dropping a frame !

sentences:
Deferred Rendering With Diffuse,Specular, and Normal maps I have been reading up on deferred rendering and I am trying to implement a renderer using the Sponza atrium model, which can be found here, as my sandbox.Note I am also using OpenGL 3.3 and GLSL. I am loading the model from a Wavefront OBJ file using Assimp. I extract all geometry information including tangents and bitangents. For all the aiMaterials,I extract the following information which essentially comes from the sponza.mtl file.

Ambient/Diffuse/Specular/Emissive Reflectivity Coefficients(Ka,Kd,Ks,Ke)

Shininess

Diffuse Map

Specular Map

Normal Map
I understand that I must render vertex attributes such as position ,normals,texture coordinates to textures as well as depth for the second render pass. A lot of resources mention putting colour information into a g-buffer in the initial render pass but do you not require the diffuse,specular and normal maps and therefore lights to determine the fragment colour? I know that doesnt make since sense because lighting should be done in the second render pass.

In terms of normal mapping, do you essentially just pass the tangent,bitangents, and normals into g-buffers and then construct the tangent matrix and apply it to the sampled normal from the normal map.
Ultimately, I would like to know how to incorporate this material information into my deferred renderer.

sentences:
Better texture downscaling at 9xMSAA than at 8xMSAA I'm drawing my game on a render-to-texture FBO with multisampling. The multisampling works as expected, except for one thing:

No MSAA

8xMSAA

9xMSAA
(left is a untextured quad, right is a textured quad--the texture is much larger than the quad, the cross in the center of the texture is 2 line primitives)

As you can see, textures seem to suddenly have better downscaling at 9+ samples. Im trying to figure out why this is, because I'd prefer to have this quality of downscaling all the time (even if I'm at, say, 4 samples). The artefacting in the first two images is pretty ugly. I'm not using any mipmapping here, but I did try that as an alternative to this, and it does look much better. However, mipmapping looks a bit blurry compared to the third image, and is still not preferable in comparison.

This was rendered with an NVIDIA GeForce 980M, and it appeared to have the same behavior on other nvidia cards.

sentences:
Using Windows 10 Multi-Touch Functionality In Gamemaker: Studio I have a multi-touch monitor that I am using in Windows 10. I am getting visual feedback on the monitor itself that multiple touches are being recognised. However, within my Gamemaker game, I cannot seem to recognise any other touch than the very first one. From the documentation, it seems that I should be able to just use the device_mouse functions, using 0,1,2,3 and 4 to stand for the different 'mice' that each press represents. However, this does not seem to work at all, for example in the following code:

if device_mouse_check_button(0,mb_left) {
Number = 1
}

else if device_mouse_check_button(0,mb_left) and device_mouse_check_button(1,mb_left) {
Number = 2
}

Can anybody shed some light on this problem? I cannot work out why this doesn't seem to be working. It recognises the first 'mouse' press, but as soon as I add the second finger it stops working.

sentences: Having trouble going from the menu I created w/ Android normally to my LibGDX game file So I wanted to use Android Studio to create the menu for my game so I created a button with an onClick method that included the Intent i and startActivity(i) but when I clicked the button the app would just crash on me

sentences:
How can I incorporate subsurface scattering into a custom shader graph? I'm working on some 3D grass in Unity with HDRP (the grass is not a 2D asset on a plane, it's a mesh).
I did a shader to make it move following a tutorial, it works great. I would like to add Subsurface Scattering (SSS), but I can't find any node or tutorial helping me in that way.

If I could somehow inject the output of this SSS material into my base colour pin, that would solve the problem.
How can I achieve this subsurface scattering look?

sentences:
OpenGL Array Texture generates black texture I am creating a game using OpenGL that has many textured cubes. I am trying to use an Array Texture to load multiple textures from one file. I tried to setup my texture atlas; however, all that renders is a black texture. I'm not sure what exactly I am doing wrong.

Here is the texture loading code:

    // Load image
    stbi_set_flip_vertically_on_load(true);
    unsigned char *data = stbi_load(path, &width, &height, &nrChannels, 0);
    // Generate texture object
    glActiveTexture(GL_TEXTURE0);
    glGenTextures(1, &textureId);

    glBindTexture(GL_TEXTURE_2D_ARRAY, textureId);

    // Actually load texture
    if (data) {
        glTexImage3D(GL_TEXTURE_2D_ARRAY, 0, GL_RGBA, width, height, 0, 0, GL_RGB, GL_UNSIGNED_BYTE, data);
        //glGenerateMipmap(GL_TEXTURE_2D_ARRAY);
    } else {
        std::cout << "Failed to load " << path << " texture" << std::endl;
    }

    // set texture filtering parameters
    glTexParameteri(GL_TEXTURE_2D_ARRAY, GL_TEXTURE_MIN_FILTER, GL_NEAREST);
    glTexParameteri(GL_TEXTURE_2D_ARRAY, GL_TEXTURE_MAG_FILTER, GL_NEAREST);

    // Free memory
    stbi_image_free(data);

Here is my fragment shader

#version 330 core
out vec4 FragColor;

in vec2 TexCoord;

uniform sampler2DArray my_sampler;

void main()
{
    FragColor = texture(my_sampler, vec3(0, 0, 1)) * vec4(1.0f);
}

Here is my texture file:

Does anyone know how I can solve my issue?

sentences:
How to learn 2d animation? Where can I learn how to do simple 2d animation well? Or is it really just literally drawing every single frame of something in photoshop? Is there tips or tricks? Tutorials to help get started?

Also, what software options are there (preferably open source or even just free)?

sentences:
Create a white background for the texture and then blend using GLSL I have a transparent png texture and I'd like to create a white background and then blend this on top of that. Is this possible using just GLSL? I can't multiply, add or mix colors because I don't want to overlay the color white. I want it to be in the background of the texture.

I can achieve what I want by creating 2 objects with the exact same dimensions and position, set the color of the object behind to white and the object in the front to the transparent texture. But this seems less than ideal to me.

Any suggestions will be much appreciated!

sentences:
AI for solving a Match 3  game Is there a known good way to have a "computer" opponent play a Match 3 game? It doesn't have to be fancy, or even considered fair. If the AI always takes the best move on the board that would be OK with me. Note that a valid move is one that doesn't make a match.

Edit:
What I am currently doing is a brute force approach. I look at every tile on the board, and see what the best move that tile can do. I add it to a collection and give it a score (based on how many it will match 3 or 4). Once I have traversed the entire board I use the move with the  best score. In the event of a tie I pick one.

If a 5 match combo is found I short circuit out to that one. 5 is the highest combo you can get)

I may not be able to improve it, but it feels like this should have been solved already.

sentences:
Backface culling in Unity I am a Unity noob trying to recreate something I did a long time ago in raw OpenGL.

I draw a scene normally glCullFace(GL_BACK), and then draw the walls a second time with face culling flipped glCullFace(GL_BACK) and a semi-transparent alpha to everything.

So my question is how to achieve this in Unity?

Can I basically set up Unity to draw the scene twice, the second time with the new culling mode, a global alpha and perhaps only drawing meshes that are children of node with a particular tag?

Or is there some better or other way to achieve this affect?

sentences:
Does vector transformation order matter? Theoretical question - imagine a car object. There are two (or more) 'forces' acting on this car, these forces will affect where the car will steer. But the forces are calculated using car's location in relation to the world, car's steering on the other hand relies on a vector within car's local space. Therefore these forces need to be translated to the car's own space before they can be applied on the car's steering.

Now the question is - should the vectors that represent these forces be summed first and the resulting force then translated to the car's domain? Or should both forces first be translated and then summed, within car's domain? Or does it not matter?

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:
In Box2dFlash my b2body gets detached from my Sprite after I use setXForm() I have a scenario where I have red coin in a Carrom board game which should be moved outside of the visible window when it is pocketed, also if any coin either white or black is not pocketed in the next shot, the red coin should be replaced in the center of the board.

Now my problem is WHEN I apply the setXForm() method to move the b2body of the red coin outside of the visible area of my flash window.It moves,there is no problem in moving the body,but WHEN i replace the b2body and sprite after the event of no coin falling , the b2body is detached and works as a separate entity having no connection with the sprite of the red coin.

I'm not getting a clue as to what is happening, that is why I thought I'd try posting this here.

sentences:
Change layout of Unity's Project->Assets pane contents to show longer filenames? I'm working on a project with assets that have really long filenames. I know about the slider in the lower-right corner of the Project->Assets pane, but THAT slider makes the icons absolutely HUGE & only allows the display of filenames that are slightly longer than the default.

Is there a way to either:

Get Unity to use a view akin to Windows Explorer's "List" view (small icon on the left, long filename on the right)
Get Unity to truncate long filenames in the middle? For example...

Full name: ExtraordinarilyLongFilename-27a.material
How it displays now: ExtraordinarilyLongF...
How I'd like it to truncate: ExtraordinarilyL...e-27a

(the general assumption of a middle-truncated long name being that the last few characters are usually the ones that distinguish between multiple files that all begin with the same prefixes)

sentences:
How can I prevent cheating in a distributed multiplayer game? A problem I've been thinking about recently is how it might be possible to create a multiplayer game without a centralised game server.

Is it possible to distribute "server" responsibilities across players? I feel like it would be too easy for modified/hacked clients to change the multiplayer experience, are there any ways around this?

sentences: How can I set up Unity so that 2d images are displayed in their original resolution? I took images from my iOS game that I am developing in SpriteKit and put them in a Unity Android 1136x640 screen, which are the same dimensions for the iOS game but the images are a lot smaller. How can I get a similar representation that coincides with the screen size? I would like a 284x640 image to be displayed to take a quarter of the screen width, which is what happens in reality.

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:
Lerping character moving up and down slope tiles So, when interpolating position against a standard 'horizontal' platform, everything works great. What happens is something like this..... (Question continues after graphic)

Now, the question I have is, how do we correctly interpolate the player's sprite (blue circle) against a 45° tile? When I attempt to do this, what happens, is that when the player is going up the slope, it is slightly embedded in the tile and when coming down the slope, it floats slightly above the tile.

In the example above, the sprite effectively 'stops' moving along the Y Axis, so therefore, interpolation along that axis stops, however when interpolating the position against a slope, the sprite moves in an X and Y direction, so never stops.  I think this is causing the issue, if my logic is correct, some more graphics follow to illustrate what I mean....

What am I doing wrong?  How do I interpolate my sprite while making sure it's 'on' the slope at all times?

For moving up a slope

When moving down slope

Summary

When interpolating against a horizontal platform, although the sprite isn't rendered on the platform in the frame straight after collision has been resolved, it is rendered on the platform during subsequent frames because the difference between the old and new positions has become 0 as it is no longer moving. However against a slope, again, the initial frame is incorrect but then the sprite moves again, so the next frame is also wrong etc so it never 'settles'. Note it does move at the slope's angle just not on the slope.

I'm trying to work out how to get my two points along the 45°  slope and interpolate between them (ie, along the slope)....

sentences:
Animating a jellyfish hardcoding? I have drew a hemi-sphere by myself, and would like to do basic jellyfish animation by animating the vertices of the hemi-sphere. I tried a lot of experiments but it seems I'm doing it wrong. I need hints or idea on about doing it.

This is the code on how to draw a hemi-sphere. I don't know what values actually to play with to animate the sphere as a jellyfish.

for(float phi = 0.0; phi < 1.567; phi += factor) {

        glBegin(GL_QUAD_STRIP);

        for(float theta = 0.0; theta < 2*3.14 + factor; theta += factor)
        {
            x = rh * sin(phi) * cos(theta);
            z = rh * sin(phi) * sin(theta);
            y = -rh * cos(phi);

            gl::vertex(Vec3f(x, y, z));

            x = rh * sin(phi + factor) * cos(theta);
            z = rh * sin(phi + factor) * sin(theta);
            y = -rh * cos(phi + factor);

            gl::vertex(Vec3f(x, y, z));

        }
        glEnd();
    }

sentences:
How can we compare the scores of 2 Facebook friends? We need to show players their friends' scores during play.

In the past, Facebook worked perfectly for this. However, now they have depreciated their Graph API. How can we work around this?

We do not want to use the Google Play Store or Gamecenter for this, as people are hardly connected on these platforms. Also, of course making an ID for our own app is also not going to work for us.

sentences:
Unreal Engine 3 vs id Tech 3 vs Unity I'm trying to decide which engine I should start using to try to start building a game in.

I had chosen Unity, but upon hearing that Unreal Engine 3 had just become kinda free to use, I found myself questioning my decision.

Technically Unreal is still the most expensive commercially, then Unity, then id Tech 3 (free).

But, it also could be the fastest to work in? Or is just the most powerful, but Unity actually does so much for you, that it makes the most sense to work with this, and take a hit on performance/tuning (like Java/C#).

Thoughts please, can anyone speak from experience of all three?

I have experience with modding since the doom days, then in Quake 1 and Half Life. I also have experience in 3DS Max. I don't have a desire at this point my life to really get into the nitty gritty of C++ animation and rendering issues, I'd rather get something up and running quickly, to see if it's possible. But Unreal experience tempts me greatly.

sentences:
Data structures for a 2D multi-layered and multi-region map? I am working on a 2D world editor and a world format subsequently. If I were to handle the game "world" being created just as a layered set of structures, either in top or side views, it would be considerably simple to do most things.

But, since this editor is meant for 3rd parties, I have no clue how big worlds one will want to make and I need to keep in mind that eventually it will become simply too much to check, handling and comparing stuff that are happening completely away from the player position.

I know the solution for this is to subdivide my world into sub regions and stream them on the fly, loading and unloading resources and other data. This way I know a virtually infinite game area is achievable. But, while I know theoretically what to do, I really have a few questions I'd hoped to get answered for some hints about the topic.

The logic way to handle the regions is some kind of grid, would you pick evenly distributed blocks with equal sizes or would you let the user subdivide areas by taste with irregular sized rectangles?
In case of even grids, would you use some kind of block/chunk neighbouring system to check when the player transposes the limit or just put all those in a simple array?
Being a region a different data structure than its owner "game world", when streaming a region, would you deliver the objects to the parent structures and track them for unloading later, or retain the objects in each region for a more "hard-limit" approach?
Introducing the subdivision approach to the project, and already having a multi layered scene graph structure on place, how would i make it support the new concept? Would you have the parent node have the layers as children, and replicate in each layer node, a node per region? Or the opposite, parent node owns all the regions possible, and each region has multiple layers as children? Or would you just put the region logic outside the graph completely(compatible with the first suggestion in Q.3)
When I say virtually infinite worlds, I mean it of course under the contraints of the variable sizes and so on. Using float positions, a HUGE world can already be made. Do you think its sane to think beyond that? Because I think its ok to stick to this limit since it will never be reached so easily..
As for when to stream a region, I'm implementing it as a collection of watcher cameras, which the streaming system works with to know what to load/unload. The problem here is, i will be needing some kind of warps/teleports built in for my game, and there is a chance i will be teleporting a player to a unloaded region far away. How would you approach something like this? Is it sane to load any region to memory which can be teleported to by a warp within a radius from the player?

Sorry for the huge question, any answers are helpful!

sentences:
Wierd behaviour upon limiting rotation on Y-axis Okay, this is the code that works for a FPS camera, except it allows the player to flip it over by going under/over -/+90° rotation on Y-axis:

transformation->rotateObjectFromRight(glm::radians(angleX), glm::tvec3<GLfloat>(0.0f, 1.0f, 0.0f));
transformation->rotateObjectFromLeft(glm::radians(angleY), glm::tvec3<GLfloat>(1.0f, 0.0f, 0.0f));

transformation object holds the data required to construct the view matrix, among others, a quaternion representing the rotation.

The functions called will construct the quaternion with the given data and then multiply it with the rotation quaternion either from the left (relative to global axes) or the right (relative to local axes) side.

angleX and angleY are mouse X and Y offsets representing the angles to rotate around.

The first line yaws the camera around local Y-axis, while the second then pitches it around global X-axis, creating the characteristic FPS camera movement.

Okay. So far so good. This is the code that should limit the pitch to never exceed the +/-90 boundaries:

transformation->rotateObjectFromRight(glm::radians(angleX), glm::tvec3<GLfloat>(0.0f, 1.0f, 0.0f));

glm::tvec3<GLfloat> forwardVector = glm::rotate(glm::inverse(transformation->getRotation()), glm::tvec3<GLfloat>(0.0f, 0.0f, 1.0f));
GLfloat pitchAngle = forwardVector.y * 90.0f;
angleY = glm::clamp(angleY, -(pitchAngle + 90.0f), -(pitchAngle - 90.0f));

transformation->rotateObjectFromLeft(glm::radians(angleY), glm::tvec3<GLfloat>(1.0f, 0.0f, 0.0f));

First and the last line are the same. What happens here?

First I get the unit vector that lies on the Z-axis and rotate it so that it represents the forward vector of the camera. I then take the Y component of that vector (ranging from -1 to 1) and multiply it with 90 to get the degrees. Then I clamp the angleY so that current rotation combined with the new one never exceeds the +/-90° boundary.

If the rotation was about to flip the camera overhead, it would change the new rotation angle so the camera looks straight up. Similar thing for underfoot flipping.

However, the camera acts weird. It's fastest at pitch angles close to 0°, but gets progressively slower as the pitch nears +/-90°. If I move my mouse slower, the camera is faster, if I move it faster, it's slower.

It's as though it's discarding the too large/small angleY values instead of clamping them to the appropriate values (but it's not, and I can confirm via the debugger - all the calculated values look alright and are correct).

What could be amiss here to cause such weird movement?

sentences:
Game states & passing data between scenes I'm not entirely sure if I'm doing this right, but I always considered the scene system in Unity as some sort of state management (rather than e.g. a level system) which allows to group the contents (entities, components) into the usual main states of the game (menu, ingame), which can then be invoked or replaced together.

Now I have a very specific concern and I have no clue how to deal with that in Unity, mostly because of it's abstractions from code and other restrictions:

My game features a procedurally generate terrain where as I'd like to tweak the generator before actually launching it. The tweaking is done in some sort of 'pre-game' state (as part of the main menu) where the values are stored in e.g. TerrainData model class. Usually in other engines, I'd to it like this:

Providing an UI within the menu state to tweak the parameters of the game
Storing the parameters in a view model (and data model)
Instantiate the ingame state (which requires said data model in the .ctor
Pass the data model to a generator and start the generation

Now, here are the main problems:

Most types in unity (scenes, monobehaviors) do not allow constructors because they use it for themselves
It doesn't seem possible to instantiate scenes manually (there's only e.g. Application.LoadLevel("") which only takes the name of the scene, not a instance reference etc.
it doesn't seem possible to pass data between scenes, without reverting to awkward workarounds such as singletons, playerprefs, DontDestroy etc. which are all not really suitable for this case.

So, how can I properly solve this? Is there a better way to manage states rather than scenes? Prefabs maybe?

Backlink to UntityAnswers question: http://answers.unity3d.com/questions/1149480/game-state-management-and-passing-data-between-sce.html

sentences:
Building multiple android apps via script does not trigger Resolving Android Dependencies I have a Unity Project which builds a number of smartphone android apps
Anytime I need to build an app I have a script (SetupApp) that move a bunch of assets in the Resources folder and changes the package name.
As far as I understood changing the package name triggers the tedious process of “Resolving Android Dependencies”, because all the various libraries in Plugins/Android need to be recompiled.
So far so good.
Recently I tried to create a multi-builder, basically it’s a script (MultiBuilder) that takes all the applications that need to be created and, before each, calls SetupApp and then calls  BuildPipeline.BuildPlayer
My issue is that when MultiBuilder calls SetupApp the “Resolving Android Dependencies” is not triggered, creating all the app with the same (wrong) dependencies.
Some thoughts:
Is there a way to force by script the “Resolving Android Dependencies”  process?
Is there a way to wait for the resolving process to be finished and the continue the building process?
Is there a better way to do so?
This goes really beyond my understanding of Unity, any help is very welcome.
Thanks

sentences: Textures in Unity3D appear with lower quality than in Photoshop I made game assets that look great in Photoshop, but they look like crap when I import then into Unity and run the game.  Why?

sentences:
Why do 3D animations have framerates As far as I'm aware, all 3D animation software (Maya, Blender...) has framerates. That is, keyframes can only be placed on discrete points in time. Why is that? Why can't animation keyframes be placed at any point in time?
The animations are interpolated in the game engine anyway, the game framerate is rarely the same as the animation framerate and even then, somethimes the game's frames land inbetween the animation's frames and we see the interpolated animation anyway.

sentences:
How do you build a matchmaking service for an iOS turn-based board game? I want to build a board game that matches players with similar skill levels against each other.

Take for example a chess iOS app. Log in, and the game pairs you up against someone with a similar elo rating.

But there's a network infrastructure they're using. I haven't been able to find a suggestion for what kind of network architecture I should use.

I've tried Google and searching on YouTube for how to build a multiplayer solution, and I haven't been able to find anything specific.

The closest thing I have is to just use the built-in GameKit features Apple offers.

Otherwise I have to use some things called REST, SOAP, Amazon AWS, or Unity's UNET multiplayer matchmaking service. And that's all fine, but I haven't been able to find any specific directions on how to use those services.

What I'm trying to say: There doesn't seem to be a stock, default solution for multiplayer matchmaking in 2018.

What should I use? What can I use? Should I just stick to the basic Game Center functionality?

Should I explore other services or take a few months to build a custom-solution?

What's the most efficient route towards building a multiplayer server for a simple board game between two players?

sentences: How to import fbx into XNA? I am developing basic XNA car game. I used 3D fbx car models to represent car objects. I drag and drop all tga and fbx files into content and I succesfully showed car in my game by using some basic codes. But the problem is when I move the car around the components move around irrelevant because some components of fbx model have different X, Y, Z directions according to world. I tried a lot of fbx models but all of it same. Also the colors have not shown on game. What is the solution of this broblem. How can I equal all component axes to game world axes to move around together? Why I can not see the colors of components?

sentences:
What would be the level of effort required to implement a screencapture command on a PS3 game? Looking to see what the level of effort is for implementing a screen capture command into PS3 game by a mid-level PS3 game developer.

Bonus for a description of what is involved in the process...

EDIT

Not sure how to get back my question since it was the first but let me clarify some things. @Nate Bross, nope I am not the actor although i've fielded calls for him on occasion

@coderanger my intent was to try and speak to other PS3 developers, however coming from a web development no one in my social circle close or extended develops on the PS3. Additionally i'm interested in hearing the effort required in terms of hours so that this information can be passed on to a client. A client who has a game on the PS3 using the unreal engine. Convo with devs sometimes go something like "can you implement feature a" which gets a response "this will take us 8 weeks and an army". Trying to be educated before the ask. I hope that helps

If anyone here is a PS3 game dev and would like to respond off site so as not to break NDA that would be awesome.

@Roger it would be from within the game, something that users can use. Something akin to the iphone screencap utility. No need to get fancier than that.

sentences:
How can I implement an RPG-maker style I'm currently working with Phaser, making a game that's procedurally generated. I wanted to use some RPG maker art in my game (for reference, I'm using the RTP). I stumbled across this article, which breaks down how auto tiles work. I also stumbled across this answer which links to another article that explains auto tiling.
Here's the thing, I have no idea how I would implement something like this. I'm sure I would have to keep track of which tile sets can connect to which other tilesets (ie, some tiles have grass on the outside, and sand on the inside, so in this example I'd have to note that "grass" tiles were the outer tiles).
I've made a map generator, and I wanted to make seamless connections between my tile areas. For example, the brown areas would be "dense" areas (forests, caves, etc). The purple areas would be stone floors, and the green area is the grass. There is a tileset that works very well for things like this:

So I would like to use the top left grass, and the third tile set, stone, which connects to the grass.
What sorts of things would I have to consider when implementing auto tiling using these sorts of tilesets, and is there an algorithm I can look at to implement?

sentences:
How to rotate a pixmap (LIBGDX) In my game I have a world with randomly generated islands.
My islands are based on the pixel information of the LibGDX Pixmap class.

Now I need to rotate the islands. For this I need to rotate the Pixmaps. Not for drawing, but for reading the pixel data of the rotated Pixmap afterwards.

My problem is, that I don't know how to rotate the Pixmap, so I can read the pixel data of the rotated Pixmap.

Drawing a rotated Pixmap works well, but I need the rotated data persisted, so I can read it.

My code I started with, which doesn't work:

public Pixmap rotatePixmap(Pixmap pixmap, int angle){
    Sprite sprite = new Sprite(new Texture(pixmap));
    sprite.setRotation(angle);
    return sprite.getTexture().getTextureData().consumePixmap();
}

How can I rotate the Pixmap, so the pixels are altered to the desired rotation?

sentences:
Unity2D: Child class inheriting onCollisionEnter() methods I may be an idiot for asking this but I can't seem to solve it myself, I have a GenericWeapon class which has a onCollisionEnter() method which I want applying to all child classes which inherit from it, here is the code:

public void onCollisionEnter(Collider target){
    Debug.Log("Collided with player!");
    if(target.GetComponent<Player>()){
        bc2d.enabled = false;
        rb2d.Sleep();
        equip(target.GetComponent<Player>());
    }
}

My child class is the following:

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

public class RangedWeapon : GenericWeapon
{
    // Start is called before the first frame update
    void Start()
    {
    }
    // Update is called once per frame
    void Update()
    {
    }
    public void attack(){
    }
}

and my in GameObject has the RangedWeapon class as a component however the GameObject does not seem to be picking up any collisions with the player. Could someone point out where I'm going wrong with this?

sentences:
How should I deal with different enemy types? I'm making simple space shooter game for Android in Unity. I want to have different types of enemies (different weapon, stats, movement schemes) and I'm not sure how to do it. I'm quite new to objective programming and I don't really know what classes should I create. I guess I could just make a prefab for every enemy since there won't be many types, but that is not what I'm looking for. I have some ideas:

First of all I'd write an BaseEnemy class and enemy type subclasses that inherit from it.

My first idea is to create those without MonoBehaviour. Then I'd have to make an EnemyScript with MonoBehaviour that I'd add to enemy game object. It'd have a specific subclass object inside, which will set every variable. BaseEnemy would just have undeclared variables and in subclass I'd set particular values. But I'm not sure how to deal with different movement schemes then. I wouldn't be able to put move() function in subclass since it wouldn't have MonoBehaviour, so I'd have to find another way. I might put in EnemyScript every possible scheme and then use correct one depending on some type value, but it doesn't seem like a proper way, does it?

The second idea is to just make a MonoBehaviour BaseEnemy class. Then while creating enemy game object I'd just add correct subclass script (aaand... I'm not sure how to do it :/ )

Could you tell me which one is a better way? Maybe neither of those?

sentences:
How do I make the background color fade into a different color after hovering it? I was trying to make the starter inputs for my text rpg change the background color in a fade effect with JQuery, but I cant figure out what i did wrong. Heres the part im focusing on:

  <script>
    $(document).ready(function() {
      $Intro_Inputs = $('#Header_Intro input');
      $Intro_Inputs.hover(function() {
        $(this).animate({'background-color':'#2E8AE5'}, 'slow');
      });
    });
  </script>

If anyone could help me out with the mistake i made i would greatly appreciate it!

(The problem was that it wouldnt fade the colors in)

sentences: Using Flash in CS5 for iOS So now that the restrictions are lifted from the third party developer by Apple. And the new packager for iPhone for Flash in CS5 is available for download. How much efficient it can be to develop a game in Flash for iPhone. How much worth it can be to invest time in developing games on Flash? anybody started working on game development on Flash for iPhone can help a lot.

sentences:
Interesting and simple missions for text-based game Can you give me an idea for a simple and interesting mission for online text-based game that doesn't require much reading? Or maybe link to a website with a list with missions?

I love programming, but I hate when it comes to create things like this, because I am not creative at all.

Thank you.

sentences:
What math should all game programmers know? Simple enough question: What math should all game programmers have a firm grasp of in order to be successful?

I'm not specifically talking about rendering math or anything in the niche areas of game programming, more specifically just things that even game programmers should know about, and if they don't they'll probably find it useful.

Note: as there is no one correct answer, this question (and its answers) is a community wiki.

Also, if you would like fancy latex math equations, feel free to use http://mathurl.com/.

sentences:
Behaviour trees and agent sensors Assume I have a behaviour tree like the following:

    [A]
   / | \
[B] [C] [D]

A = Selector (Priority node)
B = Perception task
C = Idle task
D = Walk to point task

The reason the tree looks like this is because B has priority over C and D since it should trigger alert procedures. In short, what I'm trying to model here is that the Agent sensors must have priority over behaviours.

Assume now the agent is in D and this node will continue returning running until the destination point is reached.

While D is running, something might happen (for instance, the NPC see or hear something) that should break the current operation as soon as possible but, D will go on regardless until it's done.

I know I could paste the sensors code on top of each tree leaf, like for example:

// kinda javaish pseudo code
void run() {
    // The node running method
    if (this.sensors.alert()) {
        return this.fail();
    }

    // Else, keep going.
    if (! this.reachedGoal()) {
        // do the walking
        return this.running();
    }

    return this.success();
}

But with that solution the "alert" behaviour is hard coded and out of the tree logic.

What solution do you suggest?

sentences:
How does Lua work as a scripting language in games? I'm a little hazy on what exactly Lua is and how a game that is programmed in C++ would use it. I'm asking primarily about how it is compiled and run.

For instance when you use a program written in C++ which uses Lua scripts: does the code in Lua just call to functions in the main program written in C++ and act as a uncompiled class waiting to be compiled and added to the memory heap of the C++ program?

Or does it act like a bash script in Linux where it just executes programs completely separate from the main program?

sentences:
Why is my performance so poor when accessing elements in an unordered_map? I'm trying to implement a component based architecture on a game engine project. Each GameObject has an unordered_map that holds a pointer to Component base class. At this point, I only have one component derived class, which is the Transform class. I wanted to implement this component based architecture similar to the Unity's convention: I want to get a component of game object by calling the member template function like GetComponent<Transform>().

Here are the headers:

Component.h

enum type{
    TRANSFORM   // more will be added later
};

class Component // base class
{
public:
    Component() : _owner(NULL) {}
    virtual ~Component(){}
    static type Type;

protected:
    GameObject* _owner;
};

Transform.h

class Transform : public Component
{
public:
    Transform();
    ~Transform();
    static type Type;

    void Rotate(float deg);

    // to be encapsulated later on
    Vector2D _position;
    float _rotation;
    Vector2D _scale;
};

GameObject.h

class GameObject
{
public:
    GameObject();
    ~GameObject();

    void Update();
    //and more member functions

    template<class T>
    T* GetComponent();
private:
    // some more private members
    unordered_map<type, Component*> _componentList; // only 1 component of each type
};

template<class T>
T* GameObject::GetComponent()
{
    return static_cast<T*>(_componentList[T::Type]);
}

My initial implementation used std::vector for keeping Component* and the application ran at 60 fps (I also have a frame rate controller, which just limits the FPS to 60). When I changed to the unordered_map for accessing those component pointers, the performance went downhill to 15 FPS.

I only draw two quads and I call GetComponent<Transform>() only 6 times per frame at this point, so there is not much going on in the scene.

What I tried?

I tried to use const char*, std::string, type_info and finally enum type as key values for the unordered_map but nothing really helps: all implementations got me 15-16 FPS.

What causes this performance issue? How can I isolate the issue?

 I hope I provided enough detail, feel free to ask for more code if necessary

sentences:
tool for visualizing simple 2d shapes I'm drawing simple 2D line shapes using coordinate sets (for example, moveTo(x,y) drawTo(x,y)). I would like a tool that is like a sheet of graph paper.  When I click on intersection points it records the coordinates I clicked and prints them to a dialog box.

Hopefully it would be a simple website in javascript or something. Does such a thing exist?

sentences:
Which .jar has JBox2d's p5 package? Using Eclipse, I'm trying to write a simple hello world program in processing that simply draws a rectangle on the screen then has gravity drop it as seen in this tutorial.

The problem is that when I try to import the p5 package, it's not resolving so I can't declare my physics object.  I tried two things.

Download the zip, unzip it, then import the 3 jars (library, serialization, & testbed)

a. import org.jbox2d.p5.*; doesn't resolve but the others do

b. Physics physics; doesn't resolve
Download the older standalone testbed jar then import it

a. Physics physics; doesn't resolve;

Here is basically where I'm starting

import org.jbox2d.util.nonconvex.*;
import org.jbox2d.dynamics.contacts.*;
import org.jbox2d.testbed.*;
import org.jbox2d.collision.*;
import org.jbox2d.common.*;
import org.jbox2d.dynamics.joints.*;
import org.jbox2d.p5.*;
import org.jbox2d.dynamics.*;

import processing.core.PApplet;

public class MyFirstJBox2d extends PApplet  {

    Physics physics;

    public void setup() {
      size(640,480);
      frameRate(60);
      initScene();
    }

    public void draw() {
      background(0);

      if (keyPressed) {
        //Reset everything
        physics.destroy();
        initScene();
      }

    }

    public void initScene() {
      physics = new Physics(this, width, height);
      physics.setDensity(1.0f);
      physics.createRect(300,200,340,300);
    }
}

sentences:
How do I calculate a new position from current and target position for intuitive non-instant dragging? I have a simple 2D game where I can move an object using the mouse. I've been improving on the 'feel' of the movement gradually, however it still doesn't behave as you'd expect if the object were to be moved by human hands in a real-world scenario. My improvements were as follows:

New position = mouse position
Sharp unrealistic movement. No max speed.

Cap the maximum speed
Nicer. Still stops abruptly. Doesn't accelerate smoothly

Add 'inertia', recording last change in position and applying it to subsequent moves

Vastly improved, however...

Object is dragged as if on elastic, slow to accelerate, very slow to stop.
Once moving, object oscillates or orbits around a stationary mouse position.

I'm looking for suggestions on how to make the movement more intuitive:

Moving an object from A to B a human would rarely overshoot

A user shouldn't need to correct against inertia to stop an object

I'd like to be able to adjust the weight of the object so that heavier things are harder to get moving

My current code is as follows:

float maxInertiaChange = 0.1;
Vector2 lastPosition = Vector2.negativeInfinity;
Vector2 inertia = Vector2.zero;

private Vector2 InterpretPosition(Vector2 mousePosition) {
    Vector2 newPosition;
    if (lastPosition.x != float.NegativeInfinity) {
        newPosition = lastPosition + (inertia * Time.deltaTime);
        newPosition = GetPointTowardsTargetWithMaxDistance(newPosition, mousePosition, maxInertiaChange);
        inertia = (newPosition - lastPosition) / Time.deltaTime;
    } else {
        newPosition = mousePosition;
    }
    lastPosition = newPosition;
    return newPosition;
}

private static Vector2 GetPointTowardsTargetWithMaxDistance(Vector2 startVector, Vector2 targetVector, float maxDistance) {
    float lerpScale = maxDistance / Vector2.Distance(startVector, targetVector);
    return Vector2.Lerp(startVector, targetVector, lerpScale);
}

Thanks in advance!

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:
GLSL Lighting with attenuation; how to add a fade-out color? I am using the GLSL shader from this link, slightly modified and i got it working.
The shader code is the following:

VS:

  vPosition = uMVMatrix * vec4(aVertexPosition, 1.0);
  vTransformedNormal = uNMatrix * aVertexNormal;
  gl_Position = uPMatrix * vPosition;

FS:

  float minLight = 0.01f;
  float radius = sqrt(1.0 / (uAttenuationFactor * minLight));
  float lightAdd = 0.0f;
  float dist = distance(vPosition.xyz, (uMat4Identity * vec4(uLightPosition, 1.0)).xyz);
  float att = clamp(1.0 - dist/radius, 0.0, 1.0);
  vec3 surf2light = normalize((uMat4Identity * vec4(uLightPosition, 1.0)).xyz - vPosition.xyz);
  vec3 norm = normalize(vTransformedNormal);
  float diffuseCoefficient = max(0.0, dot(norm, surf2light));
  lightAdd += att * (diffuseCoefficient + uSourceIntensity);
  vec4 textureColor = texture2D(uTex0, vec2(vTextureCoord.s, vTextureCoord.t));
  vec3 torch_output = lightAdd * uColorLight;
  vec4 final_color = (vec4(torch_output, 1.0f) * textureColor) * vVertexColor;
  gl_FragColor = final_color;

The shader computes point lighting with attenuation and give very satisfactory results. Look at the pic:

I give uAttenuationFactor = 0.4f and uSourceIntensity = 0.2f to get this result and it satisfies me. However, besides setting the light color, how i could modify the shader to fade-out to another color than black?? Anything i tried it just modifies the visible parts of the screen i.e. walls but the black remains unchanged. I would had liked to be able to set a grey color for rain or whitish for fog effect etc.

Thanx.

sentences:
Get perpendicular vector from another vector I should clarify that I understand there is an infinite amount of 'perpendicular' vectors in 3D space. I am creating an electricity effect, and to do this the ability to have any number of perpendicular vectors is a good thing. The hard part is how to select any random one of these vectors - how would I do that, given a base vector "direction" which has been normalised?

Keep in mind that I want the resultant vector to be random, not just always up and down on the y-axis or anything.

sentences:
Get the dropped object using IDropHandler.OnDrop In Canvas, I drag some UI objects to a panel using this code:

public void OnDrag(PointerEventData eventData)
{
   Vector3 screenPoint = Input.mousePosition;
   screenPoint.z = 10.0f;
   Item2Drag.position = Camera.main.ScreenToWorldPoint(screenPoint);
}

But what I can't figure out is when I dropped an object on the panel, how can I get the gameObject which has been dropped?

sentences: Is it possible to programmatically prevent a game from pausing when its window loses focus? I'm playing Skyrim in windowed mode and I am trying to create a bot for this game for personal use. I would like to have the bot play the game in the background, while I do other things, the only problem is that the game window pauses when it loses focus. Is there a way to make the Skyrim process think that it still has the focus, so it continues to run while I do something else on another window? I'm not a windows programming expert but would this be possible if I could somehow intercept the message that says unfocused or minimized to the process, and thus let the process think its still focused? I think Skyrim uses directx, so is it possible to come up with a solution from that end?

sentences:
How do I pause and unpause gameobjects on is own in the scene without pressing keys in unity3d I can't get my gameobject to pause or unpause in the scene in Unity3d.
I need the game to pause for a couple of seconds maybe longer than unpause
 by itself. Here is my script :

using UnityEngine;
using System.Collections;

public class hu : MonoBehaviour {
GameObject[] pauseObjects;
public bool isPaused;
 void Start () {

 pauseObjects = GameObject.FindGameObjectsWithTag("Player");

 }

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

  {
   if(Time.timeScale == 1)
   {
    Time.timeScale = 7f;

   } else if (Time.timeScale == 8f){

    Time.timeScale = 1;

   }
 }
}
}

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:
Real-time MMO: how should authoritative server update client position I'm trying to build a real-time MMO game. I'm using Phaser for FE and Node.js + socket.io for BE. I have read all the tutorials like http://www.gabrielgambetta.com/client-side-prediction-server-reconciliation.html and so on.

Different players might have different FPS, this is how I update position on the client:

const data = {
  down: this.cursors.down.isDown,
  timestamp: Date.now()
};

var deltaTime = (data.timestamp - this.lastTimestamp) / 1000;
if (data.down) {
    player.position.y += speed * deltaTime;
    socket.emit('input', data);
}

This ensures speed is FPS independent (every player is moving with the same speed).

The server is running a tick at 60 FPS. This method is processing saved inputs from players.
How should the server correct player positions? It doesn't know their delta times. It can't use server's delta time since it would be always around 0.016 and it doesn't reflect player's update interval.

tick() {
    var now = Date.now();
    var serverDelta = (now - this.prevTimestamp) / 1000;
    this.prevTimestamp = now;

    for (var player of players) {
        player.update();
    }
}

player.update() {
    for (input in savedInputs) {
          player.y += input.down * speed;
    }
}

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:
Engine for a Football Manager Type game (data driven, menu clicking) A friend and I had started developing a football manager two years ago, but ultimately squashed the whole thing because we found ourselves in a mess with developing UI and saving/loading.
The basic game loop of simulating matches and advancing days until the match day was already done. We also had a e-mail system up and running (for receiving messages which might need decisions/trigger events).
In our lack of of knowledge, we tried building the game in GameMaker2. It made saving all the objects (a Team has 23 Player, a league has 20 Teams, there are several Leagues) a nightmare. Also, UI development (things like scrollbars for example) ate up incredible amounts of our time and still everything looked relatively bland. Short: GameMaker2 seemed not suitable for the type of game we wanted to build.
There must be a better engine/system for developing a manager type game. Most of the game is spent in menus, There's no time-critical interaction going on.
Since we've benched the project, I started working a legit software development job and I have gained some skills which I hadn't have before, like knowledge of databases and a heap of Python experience.

It has me looking at the game again. Now I see it as having a 'data backend' and an point-and-click-frontend, with game design elements, like tough decisions, events and goals as the driving force in the middle.
We want nice looking menus, where players can set the training schedule, make the line-up for match day, talk to players/executives/whoever. The other necessity is managing all data objects, which there will a lot of. A league might easily contain 400 players which all need to have stats and so on and so forth. I see a relational database for this, but maybe there's something smarter regarding game-development?

So my Question is:

What is a suitable game engine/development stack for developing data-heavy, non real-time menu-clicking type manager games  such as a football manager?

sentences:
How do you write an unlit shader which supports Ambient Occlusion? For performance reasons, a scene might use Unlit shaders only.
Is there an Unlit shader which supports Ambient Occlusion?
What is the best way to achieve this look, for moving and static objects, while prioritising performance?

sentences:
Mouse drag rotation script doesn't work when attached to OBJ model I am new to Unity. I imported an OBJ model and assigned materials to it.

I want to rotate it using the mouse in the game, using this script:

using UnityEngine;

public class MouseDragRotate : MonoBehaviour {
    float rotationSpeed = 0.2f;

    void OnMouseDrag()
    {
        float XaxisRotation = Input.GetAxis("Mouse X")*rotationSpeed;
        float YaxisRotation = Input.GetAxis("Mouse Y")*rotationSpeed;
        // select the axis by which you want to rotate the GameObject
        transform.RotateAround (Vector3.down, XaxisRotation);
        transform.RotateAround (Vector3.right, YaxisRotation);
    }
}

I tried to apply this rotation script to the OBJ asset in my Project folder, but I wasn't able to find an Add Component option in its Inspector.

So I dragged it to the Hierarchy panel to create an instance of the object in my scene. I applied my materials again to this instance.

Then I added the rotation script using the Add Component button in the Inspector.

But when running the game in play mode, I can't rotate it.

I verified that the script above works perfectly for the default Cube or Plane primitives in Unity, but not for this imported object.

How can I make this script work with my OBJ model?

sentences:
Why my raycast sometimes not working? As you see in picture, i cast rays to (vector3.right * direction) from center of boxCollider's bounds.
It can detect the wall mostly, but sometimes it can't detect the wall and pass through it.
the layer of wall is 'obstacle' and ray only detect that layerMask.
why this happend?

            moveAmount.x = input.x * speed;
            moveAmount.z = input.z * speed;

            directionX = Mathf.Sign(moveAmount.x);
            rayLength = Mathf.Abs(moveAmount.x) + .015f;

            if (Physics.Raycast(rayOrigin, Vector3.right * directionX, out raycastHit, rayLength, collisionMask))
            {
                Debug.Log("Hit");
            }

sentences:
Move Object to another Object's position on click Raycast I have one object, a knight, that I click on and want to move around on terrain.

private void OnMouseDown()
{
   if (Physics.Raycast(cam.ScreenPointToRay(Input.mousePosition), out hit, 10000))
    {
        if (unitSelected)
            MoveUnit(hit);
        else if (unitSelected && hit.collider == home)
            GoHome(hit);
     }
}

And

private void OnMouseDown()
{
    if (Input.GetMouseButtonDown(0))
    {
        Ray ray = cam.ScreenPointToRay(Input.mousePosition);
        if(Physics.Raycast(ray, out hit))
            MoveUnit(hit);
    }
}

Both scripts work fine when clicking on the terrain.

The Problem

I want to click on different objects and send the knight towards whatever object I click on.

The knight does NOT move, though the object I click on registers a click (all objects have colliders).

Is Raycast the most appropriate way to do this? Checking another users question similar to mine, (how-to-move-one-object-to-another-objects-position) they seem to use a method similar to "Vector3.MoveTowards".

EDIT:

Moving my code from "OnMouseDown" to "Update" solves that issue. but is there a reason why OnMouseDown won't work or even how to make it work? I was trying to limit my code from going into Update as that's called every frame.

sentences:
Realistically, how long would it take for 1 person to create a 2D isometric RPG? Something I have been looking into for a while is developing my own PC game. I'm very into CRPGs like Fallout 1 and 2, UnderRail, Wasteland 2, etc. I have long desired to create my own game like this, with an emphasis on plot.

While I don't have any experience in development, I use several (mostly proprietary) programming languages in my job, and have a natural aptitude for learning syntax etc. I have taken a few tutorials in Unity and Godot but generally I prefer to feel my way through software myself (tutorials rarely give you enough 'why and how') or reverse engineer an existing product.

I plan for the game to be quite minimal on the asset front, at least to begin with. I've done some basic 3d modelling and mapping (a long time ago, in Source engine - I built my school!)

My question is, if I decide to dedicate the time to this, how long does it generally take for one person to create a game like UnderRail or Darklands? I'd like to know if it's a doable project or a laughable pipe dream for an inexperienced one-man enthusiast!

sentences:
How many OpenGL programs should I use to render multiple objects? My scene has multiple objects in it. (Let's say 3 cubes, 1 cylinder, 8 spheres.) I assume I should create a vertex shader for each. How many programs should I have?

Alternatives:

One program per object
One program for all cubes and another for all spheres (assuming they use the same shaders)
One large program for everything

What is the correct approach?

sentences:
Limit a scrollbar's OnValueChanged to full step intervals only So I have done some research on the matter but I can't find anything.

I created a UI scrollbar and asigned 10 steps to it.Then I noticed that the values of the scrollbar does not change in reference of the handle's steps but in reference of the pointer's position(like a slider).That seriously slows down the performance since it has a lot more to process "onValueChanged" and it is unnecessary for what I am trying to achieve.

The values of the steps should go step 1: 0.1(1),step 2: 0.2(2) etc.I need to get these values and nothing in between or the step that the handle is currently on.

How can I do that ?

sentences:
I added a terrain in Unity, but can't see it In Unity I added a terrain through Create → 3D Object → Terrain. It didn't show up and I can't see it. I tried to press F to focus on it, but I still don't see it. What am I doing wrong?

Here is a screenshot:

sentences:
Reducing the level of detail of a mesh I am importing an extremely detailed mesh (provided by a client) and it consists of something like 16 million triangles. For rendering performance I've been using the ID3DXMesh interface's Optimize and OptimizeInPlace methods. I'm using GenerateAdjacency with an epsilon of around 0.0025, and there doesn't seem to be much optimizing going on. Even with an epsilon of around 50.0 there's no significant increase in performance.

Am I misunderstanding Optimize? Isn't it supposed to get rid of unused faces based on the adjacency buffer? If that isn't the case, what other methods/algorithms/libraries could I use that would reduce level of detail?

Here's my code:

this->m_pMesh->GenerateAdjacency( 0.0025f, l_ulpAdjacencyBuffer );
this->m_pMesh->OptimizeInplace( D3DXMESHOPT_COMPACT | D3DXMESHOPT_ATTRSORT |D3DXMESHOPT_VERTEXCACHE, l_ulpAdjacencyBuffer, 0, 0, 0);

sentences:
Unity - Where are Asset Store assets downloaded on Mac? I'm on a Mac, running Unity 2021.1.5f1 Personal, and am trying to remove an asset I downloaded using Package Manager.
So for the asset in question, I want Unity to have to download the package again, from the Asset Store, to my local mac. That option is currently unavailable, because I have downloaded it in the past.
I've tried deleting the contents of these folders, to remove the downloaded file, but still no "download" option shows up next to the asset.

~/Library/Unity/Asset Store/Cache
~/Library/Unity/cache
MY_PROJECT/Library/PackageCache
I also tried clearing the cache in Preferences | Gi Cache
I looked in the docs for Asset Store cache, and the closest I found was this link

sentences:
Fade in rendering mode doesn't work as intended The picture shows an object made out of one model. The object works as intended when rendering with opaque rendering mode, but I want the object to fade in/out during animation. The glitch seems to have something to do with queue of rendering, but since it's only one model, and since there's only one material on the model (tried fresh materials, same problem), it seems to be weird glitch. Any help is appreciated, and if possible, I need to find a solution without using a 3d modelling software.

Forward rendering is used on the camera.

sentences:
Can you store negative numbers with XNA HLSL? I am trying to make a ripple effect with a HLSL shader, it works so far but I need to output negative numbers and that won't work for the calculations. Is there some way to do this with the SurfaceFormat class? By the way I am rendering 2 RenderTarget2D classes. This is how I calculate it:

float4 add = float4(0,0,0.5,0);
float4 input = tex2D( BaseSampler, Tex);
float4 cur = tex2D( RippleSampler, Tex);
float curY = 0;
float curX = cur.x;
float tempCurY = cur.y;

curY = (tex2D( RippleSampler, float2(Tex.x - pixelSizeX, Tex.y)).x + tex2D( RippleSampler, float2(Tex.x + pixelSizeX, Tex.y)).x + tex2D( RippleSampler, float2(Tex.x , Tex.y - pixelSizeY)).x +  tex2D( RippleSampler, float2(Tex.x , Tex.y + pixelSizeY)).x) * 0.5f - tempCurY;
curY *= damping;

if(curY < 0.01f){
    cur = float4(curX,curY  + input.x,0.5,1);
}else{
    cur = float4(curX,curY,0.5,1);
}

return cur;

sentences:
If condition true, but code is not executed in Unity I have a script which triggers a movement when a rotation is completed. The script casts the Euler angle of a transform to an int. If it is true, the condition is executed. For some weird reason, the code in the if condition does not execute, even if the condition is true. I have confirmed the condition is true through both my compiler and the debug log.

Here is my code:

if(rotationInitiate)
{
    transform.eulerAngles = Vector3.Slerp(transform.eulerAngles,
        new Vector3(0, 0, angleOfRotation), Time.deltaTime * speedOfRotation);

    Debug.Log(transform.eulerAngles.z);

    if((int)transform.eulerAngles.z == 180)
    {
        Debug.Log("Hurray we have successfully executed the if statement");

        // More rotation stuff
    }
}

As you can see by my log, the angle returns an exact value of 180, but does not enter the if statement to perform the second log output:

Why might my if statement not be executing?

sentences:
How to align text dynamically inside a rectangle with Phaser JS I am just starting to learn the Phaser JS framework with my first game. I did not managed to find a way how i can align text inside a rectangle element dynamically without specific coordinates. Here is what i have

pointH11L1 = game.add.text(0, 0, '20');
pointH11L1.stroke = "#000";
pointH11L1.strokeThickness = 4;
pointH11L1.font = 'oswaldbold';
pointH11L1.fontSize = 22;
pointH11L1.fill = '#999999';
//pointH11L1.alignIn(graphicsRectH12L2, Phaser.CENTER);
graphicsRectH12L2.addChild(pointH11L1);
pointH11L1.x = pointH11L1.width / 2 - 6;
pointH11L1.y = -2.5;

//graphicsRectH12L2 is the  rectangle inside which i need to align.

var graphicsRectH12L2 = this.game.add.graphics(950, 405);
    graphicsRectH12L2.beginFill(0xffcd00, 1);
    graphicsRectH12L2.drawRect(0, 0, 44, 29);
    graphicsRectH12L2.endFill(0xffcd00, 1);
    group.add(graphicsRectH12L2);

sentences:
Multiplayer online game engine/pipeline I am implementing online multiplayer game where client must be written in AS3 (Flash) to embed game into browser and server in C++ (abstract part of which is already written and used with other games).

Networking models may differ from each other, but currently I'm looking toward game's logic run on both client and server parts but they're written on different languages while it's not the main problem.

My previous game (pretty big one - was implemented with efforts of ~5 programmers in 1.5 years) was mainly "written" within electronic tables as structured objects with implemented inheritance: was written standalone tool which generated AS3 and C++ (languages of platforms to which the game was published) using specified electronic tables file (.xls or .ods). That file contained ~50 tables with ~50 rows and ~50 columns each and was mainly written by game designers which do not know any programming languages. But that game was single-player.

Having declared problem with my currently implementing MMO, I'm looking toward some vast pipeline, where will be resolved such problems like:

game objects descriptions (which starships exist within game, how much HP they have, how fast move, what damage deal...)
actions descriptions (what players or NPCs can do: attack each other, collect resources, build structures, move, teleport, cast spells) - actions are transmitted through server between clients
influences (what happens when specified action applied on specified object, e.i "Ship A attacked Ship B: field "HP" of Ship B reduced by amount of field "damage" of Ship A"

Influences can be much more difficult, yes, e.i. "damage is twice it's size when Ship has >=5 allies around him in a 200 units range during night" and so on. If to be able to write such logic within some "design document" it will be easily possible to:

let designers to do their job without programmer's intervention or any bug-prone programming
validate described logic
transfer (transform, convert) to any programming language where it will be executed

Did somebody worked on something like that?
Is there some tools/engines/pipelines which concernes with it?
How to handle all of this problems simultaneously in a best way or do I properly imagine my tasks and problems to myself?

sentences:
Health zone heals player but I have a problem Hello I am creating a special health zone that gives the player health and my current scripts health is going up super fast and I want it to go up by 2 hp per second. How would I do this?
Here is the health zone script.
{
    public PlayerHealth playerHealth;
    public float healthGain = 2f;

    void OnTriggerStay2D(Collider2D other)
    {
        if (playerHealth.currentHealth < playerHealth.maxHealth)
        {
            playerHealth.currentHealth += (int)healthGain;
            playerHealth.healthBar.SetHealth(playerHealth.currentHealth);
        }

        if (playerHealth.currentHealth >= playerHealth.maxHealth)
        {
            playerHealth.currentHealth = playerHealth.maxHealth;
            playerHealth.healthBar.SetHealth(playerHealth.currentHealth);
        }
    }
}

sentences:
Transfer mouse movements to a GameObject in 3D according to camera position and rotation I'd like the game object to follow the mouse but I have trouble doing this when the object is in 3D and the camera has been rotated.

The only thing that seems to be true (and still it works only when camera isn't rotated) is :

The visible X for the camera is equal to 2 * Mathf.Abs(object.position.z - camera.position.z)
The visible Y for the camera is equal to VisibleX * (camera.pixelHeight / (float)camera.pixelWidth) (casting to float to avoid int divided by int returning an int)

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:
Verlet chain with two fixed points is not converging properly I am trying to create a simple chain between two fixed endpoints. The problem is that I can't seem to get the chain to reach a stable state. Further, the chain is always biased toward one of the endpoints.

Here are my constants and variables:

const NUMBER_OF_LINKS = 100
const CHAIN_LENGTH = 400
const DIST_BETWEEN_LINKS = CHAIN_LENGTH / NUMBER_OF_LINKS
const ITERATIONS = 20 # number of times we iterate through constraints each frame
const GRAVITY = Vector2(0, 300)

var anchor1
var anchor2

var prev_link_positions = []
var links = []

Here's what I do on initialization:

create_links(NUMBER_OF_LINKS)

var first_link = links[0]
var last_link = links[NUMBER_OF_LINKS - 1]

first_link.global_position = anchor1.global_position
last_link.global_position = anchor2.global_position

And here are the adjustments I do each frame:

links[0].global_position = anchor1.global_position
links[NUMBER_OF_LINKS - 1].global_position = anchor2.global_position

for i in range(NUMBER_OF_LINKS):
    var acceleration = GRAVITY
    acceleration *= delta * delta
    var prev_position = links[i].global_position
    if not i in [0, NUMBER_OF_LINKS - 1]:
        links[i].global_position = 2*links[i].global_position - prev_link_positions[i] + acceleration
    prev_link_positions[i] = prev_position

for iteration in range (ITERATIONS):
    for i in range(NUMBER_OF_LINKS):
        var link = links[i]

        var prev_link_position
        if i == 0 or i == NUMBER_OF_LINKS - 1:
            prev_link_position = links[i].global_position
        else:
            prev_link_position = links[i-1].global_position

        var next_link_position
        if i == 0 or i == NUMBER_OF_LINKS - 1:
            next_link_position = links[i].global_position
        else:
            next_link_position = links[i+1].global_position

        # get vector to previous link and adjust position
        var vec_to_prev_link = prev_link_position - link.global_position
        link.global_position += vec_to_prev_link.normalized() * max(vec_to_prev_link.length() - DIST_BETWEEN_LINKS, 0) / 2.0

        # get vector to next link and adjust position
        var vec_to_next_link = next_link_position - link.global_position
        link.global_position += vec_to_next_link.normalized() * max(vec_to_next_link.length() - DIST_BETWEEN_LINKS, 0) / 2.0

When I run this, I almost get what I want, except the chain contorts and never reaches a stable state. Also, it is biased in the first direction I look at when solving the constraints.

It looks something like this:

What am I doing wrong? How can I get a chain that stabilizes with links more uniformly distributed?

sentences:
How to create a native windows menu / ribbon for a DirectX 11 app I need to create menu items on top of my DX11 windowed app - similar to most windowed applications (File, Edit, etc...). How can I achieve this ? There is a hMenu handle to pass to the DirectX window creation function but I have no idea how to create this object.

Additionnaly I'd like to have 1 or several ribbons under the window menu with icons to trigger functionnality.

EDIT My menu is all good now and I chose to implement a windows ribbon, but I'm still having problems at creating the ribbon. Here is a screenshot of my app. The green color is the Direct3D clear color - I would like my ribbon to display under the menu (and eventually remove the menu after that).

My ribbon code being :

LRESULT CALLBACK WndProc(HWND hwnd, UINT message, WPARAM wParam, LPARAM lParam)
{
    PAINTSTRUCT paintStruct;
    HDC hDC;

    switch (message)
    {
    case WM_CREATE:
    {
        if (!SetupMenus(hwnd)) MessageBox(nullptr, TEXT("Failed to setup GUI."), TEXT("Error"), MB_OK);
    }

    // ...
}

bool SetupMenus(HWND hwnd) {

    // Create the menu
    // ...

    // Create the ribbon
    IUIFramework* pFramework = NULL;
    HRESULT hr = ::CoCreateInstance(CLSID_UIRibbonFramework, NULL, CLSCTX_INPROC_SERVER, IID_PPV_ARGS(&pFramework));
    if (FAILED(hr)) std::cerr << "Fail #1" << std::endl;

    hr = pFramework->Initialize(hwnd, IUIApp);
    if (FAILED(hr)) std::cerr << "Fail #2" << std::endl;
}

outputs Fail #1. Why can't I create the ribbon ?

sentences:
Is Windows window creation faster / more efficient than GLFW window creation? Are there any benefits to using Windows window for OpenGL or Vulkan rendering, rather than using GLFW window?

Is there any performance hits when using C++ Window creation over GLFW since it provides OpenGL and Vulkan interface?

sentences: Smooth movement in a tile based game How can we make our character move smoothly across tiles? He moves tile by tile, but that looks unprofessional. In addition, when you hold down the arrow keys he zips across the screen. How can we prevent that from happening?

sentences:
Rotating a polygon around it's center I have drawn a ship using three lines, and would like to rotate the ship around its axis in opengl, I have tried the following, but the ship translates while rotation!.

void Ship::Draw( )
{
    gl::pushMatrices();
    gl::translate(Vec2f(-m_Pos.x, -m_Pos.y));
    gl::rotate(m_Angle);
    gl::translate(Vec2f(m_Pos.x,m_Pos.y));
    gl::color(ci::Color(1,0,0));
    gl::drawLine(Vec2f(281,70),Vec2f(383,123));
    gl::drawLine(Vec2f(310,85),Vec2f(310,160));
    gl::drawLine(Vec2f(383,123),Vec2f(281,176));

    gl::popMatrices();
    m_Angle+=0.2f;
}

sentences: How to modify normal vectors with a tranformation matrix Transformation is quite simple when it comes to Position or Color of the vertex, for Position just multiply matrix * vector and for color just don't do anything, but my question now is: How to handle normal vectors? If my thoughts are correct I would just need the rotation part of the matrix and apply it to the normal vectors, but how can I do that? Or is it better not to use a matrix for that, but instead allow only direct transformations, one at a time, so I can handle them differently for different vertex attributes?

sentences:
Determine corners of a specific plane in the frustum I'm working on a game with a 2D view in a 3D world. It's a kind of shoot'em up. I've a spaceship at the center of the screen and i want that ennemies appear at the borders of my window. Now i don't know how to determine positions of the borders of the window.

For example, my camera is at (0,0,0) and looking forward (0,0,1). I set my spaceship at (0,0,50). I also know the near plane (1) and the far plane(1000). I think i'd have to find the 4 corners of the plane in the frustum whose z position is 50, and with these corner i can determine borders. But i don't know how to determine x and y.

sentences:
How to reverse or create a group sprites pinned to other objects on a specific pattern. Hey guy i am creating a game, where i am facing some problem.

I am creating a sprite, SpriteT on runtime with a rope effect like snake with proper instances. Also am creating Text object pinned on the rope style sprites with instances and need to handle those sprites objects with text instances.

I gave the leadsprite 8 directions where other families are attached to leadsprite.

Now i want is when i rotate the leadsprite to 90 and then to 180 that is top left movement. I need is to compare the instances of equal positions of sprite Whenever i do this the system never compares each value of sprites. i don't know how to compare the elements of one single array that is definately instances to each other's position record and if they match i want to destroy the sprites objects.

this includes i think there must be some pattern now i need to reverse the remaining spriteT to the Leadsprite on the same pattern.. This is where i am lacking whenever i do this

  // On Destroyed
    OnObjectDestroyed() {
     // This contain let 10 number of sprite to attached with the center of one next sprite.
         SpriteTObjectFamily.setPositionTowardsObject(ImagePoint0);
    }

I have just started and a Noob. Please help this is actually doing in Construct2. Any help would be great. Thanks in Advance!

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:
MonoGame / XNA Texture2D.SetData results in black texture I use the following method to draw a box onto the screen:

private void DrawBox(Rectangle rect, Color color, Vector2 offset)
{
    Texture2D tex = new Texture2D(GraphicsDevice, rect.Width, rect.Height);
    Color[] data = new Color[rect.Width * rect.Height];

    for (int i = 0; i < data.Length; i++)
        data[i] = color;

    tex.SetData(data);

    var pos = new Vector2(rect.Location.X, rect.Location.Y) + offset;

    spriteBatch.Draw(tex, pos, Color.White);

    tex.Dispose();
}

However, this results in a completely black image being drawn onto the screen, regardless of the colour I pass to this method. Why is this happening and how can I fix this?

sentences:
Are Differing Store Identifiers Necessary with the Unity IAP Plugin? I am looking at implementing the new Unity In App Purchasing API for the first time.

Through the guide and the tutorial, I see that there is the ability to add different store identifiers for product ids that vary across stores... and all the examples reference that way of doing it.

Eg.:

public class MyIAPManager {
    public MyIAPManager () {
        var builder = ConfigurationBuilder.Instance(StandardPurchasingModule.Instance());
        builder.AddProduct("100_gold_coins", ProductType.Consumable, new IDs
        {
            {"100_gold_coins_google", GooglePlay.Name},
            {"100_gold_coins_mac", MacAppStore.Name}
        });
    }
}

In my case, my product id's DONT differ, so this seems like unnecessary code bloat to implement it this way... but I don't see any other option?

EDIT

Argh, I'm using VS Code on OS X, which is getting better, but still has
issues, such as having problematic code-completion / API referencing issues, so didn't see the overloaded method option... It's simply enough to do this:

var builder = ConfigurationBuilder.Instance(StandardPurchasingModule.Instance());
builder.AddProduct("100_gold_coins", ProductType.Consumable);

sentences:
Does the size/distance of a single object affect performance? I have a moon that I would like to place in the sky, which will likely be anywhere from 1000-5000 triangles.

Will I experience any performance degradation if I choose to place this sphere several million units away from the player, and increase its size several thousand times? Would this giant (but distant) moon have the same performance impact as the same sphere shrunken into a ball that can fit in the player's hand?

My question is intended to be platform-agnostic, but I am working within Unity.

sentences:
Should developers make their games easier with new versions? It seems that the game Angry Birds is becoming gradually easier with new versions. Maybe so people get the illusion of progress and satisfaction of breaking new records?

I would like to know if gradual small modifications of games to enhance the sense of improvement and learning by users is known/common/standard practice in game developing. (I don't mean to say that there is anything wrong with such a practice.)

sentences:
libGDX - Scene2d Actions or Frame Animation, which is better for performance? I only use Scene2d for the UI layer of my libGDX game. But I need some animations like fading or rotating on my players.

Which is better for performance:

Scene2d fade action or having multiple frames with different opacity and using them in the Animation class?

Also scene2d rotate action or having multiple frames with different angle?

Thanks!

sentences:
3D: First Person Movement I've searched and searched for a solution today but haven't found one.

I have a Camera with Vector3 and also the camera has an angle.

If I use this:

hero.position.x += speedX;
hero.position.z += speedZ;

works great but as soon as I rotate the camera the "hero" still goes in the same direction. So if I press button W I want the hero to go the way the camera is looking.

I've also tried:

hero.position.x += Math.sin(hero.rotation*3.1415/180) * speedX;
hero.position.z += Math.cos(hero.rotation*3.1415/180) * speedZ;

But it wont work and I just can walk in a line.

So how do I move in 3D space in first person mode?

sentences:
Multiplayer Game Data Serialization Problems I want to create a simple game that can be played with one to two player. I plan on using TCP sockets, Farseer Physics, XNA, a BinaryFormater and a Memorystream.

as far as i know i can't do the physics on both clients, or you'll end up with everything out of sync. So my Idea was to do the physics on the host side then send the Farseer World data to the other client, however it is un-serializable and I also realized this was a lot of data to send every tick.

I could just send the players movements back to the server and send a Texture2D to the client to be drawn, however a Texture2D is un-serializable as well. it has dawned on me i must be doing this completely wrong.

But this is how i am attempting to send the data:

[Serializable()]
class ServerData
{
    public Texture2D Test;

    public Vector2 Test2;
}

    static void SendData()
    {
        byte[] DataBuffer = null;

        MemoryStream stream = new MemoryStream();
        BinaryFormatter formatter = new BinaryFormatter();
        NetworkStream netStream = PlayerOneSocket.GetStream();

        ServerData ServerDataToSend = new ServerData();

        formatter.Serialize(stream, ServerDataToSend);
        DataBuffer = stream.ToArray();
        netStream.Write(DataBuffer, 0, DataBuffer.Length);
        netStream.Flush();
    }

what am i doing wrong or how do i do it right.

I've done basic server stuff before with custom classes and serialization, I'm just at a loss on how to make a multiplayer game.

Thanks for the help

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:
Scene dark when perspective camera is far from scenery I can't find anything about this subject in the docs or forums to know if this is normal behavior: There seems to be a direct correlation between how close to the scenery my camera gets and how brightly lit the scene is. My camera is able to move up to 200 units from Vector3.zero. Here are two shots of the same piece of scenery - one close up, one far away:

The camera is set to perspective, using deferred rendering.

Things I've tried:

Turning off post processing
Using auto expose in post processing
Changing to orthographic (removes the issue, scene is uniformly bright at any distance)
Changing the FOV
Changing global lighting to use color rather than skybox
Putting some lights at altitude

This may be normal behavior & I just havent noticed before. Can anyone confirm? Is there some way to prevent this happening? I don't want to use an orthographic camera but I do want the scene to be evenly bright at any distance from the camera.

sentences: How to make an existing Editor window floatable I added a second inspector window tab to Unity and locked it. I tried moving it to another desktop on my Mac but it doesn't move to the next desktop. How can I make a duplicate Inspector Window floatable?

sentences:
Does a game engine affect the quality of pre-baked Global Illumination? If I were to pre-bake Global Illumination into light maps using a high quality renderer like Mental Ray or PRman, and loaded it into two different engines such as Unity and Unreal, would there be a noticeable difference in quality?

If there is a difference, could you give me a few examples of engines that are better at it than others?

sentences:
How to draw multiple shapes in one draw call? I have a misunderstanding about vertex buffers in DirectX. I'm trying to draw infinite vertices that they may represent a line or a circle or a rectangle in a single draw call. I can bind them all together and set a flag for each vertex to determine which shape I have to draw now with DrawPrimitive(), but the questions are:

When I first create the vertex buffer, I set a constant length of 1000 for it because I don't know how many vertices I'm going to draw. How can I avoid this?
I don't know the proper way of drawing these vertices at all. I mean I can draw them right now with a dynamic VB, but I have no idea on performance and etc.

BTW, I've read this article which is pretty good, but it doesn't apply to my issue.

Edit

For example, I have 6 vertices which 2 of them are shaping a line and the other 4 are shaping a rectangle. I can bind them all together and copy them into the vertex buffer and then draw. Now, what if next time I wanted to draw a line and two rectangles? In this case I have to add 4 other vertices to my current list and we suppose my VB is not big enough to do that. This is my misunderstanding that I don't know if I should reserve enough space at first place for my VB or there is an alternative to pitch the length during runtime.

I'm trying to draw basic 2d shapes here nothing 3d:

// A class member
std::vector<Vertex2D> mVertices;

// Draw method
{
void* buffer = new char[this->mVertices.size() * sizeof(Vertex2D)];

Device()->VertexBuffer()->Lock(0, sizeof(buffer), &buffer, D3DLOCK_DISCARD);
memcpy(buffer, this->mVertices.data(), sizeof(buffer));
Device()->VertexBuffer()->Unlock();

Device()->SetStreamSource(0, Device()->VertexBuffer(), sizeof(Vertex2D), sizeof(Vertex2D));
Device()->SetFVF(D3DFVF_VERTEX2D);
Device()->DrawPrimitive(D3DPT_LINELIST, 0, this->mVertices.size());

delete[] buffer;
}

It's a simple draw call in a bigger loop. mVertices is a collection of different vertices for different shapes. My second question was, how to draw different shapes from one vertex buffer in a single draw call. My first question was, how can I adjust vertex buffer's length with a relevant length to my vertices and not a default value at compile time.

sentences: FBX Importer - Vertex Color I imported vertex positions, indices and normals successfully in OpenGL using fbx sdk, but I just can't figure out how to import vertex colors. I tried to fetch the pointer to array of colors trough mesh layer but it returns null. Can anyone help me with this one please?

sentences:
How to get character position in 2D map array by its position on canvas My arrayMap consists of 0, 1 and 2. 0 is water and character is allowed to be on. 1 and 2 are ground and the collision should happen.

To get and check what array number the character is standing on, I take the character position and divide it by my tileset size which is 36px and use Math.floor to round the number. I place it like this: console.log(mapArray[Math.floor(boatPosX / 36)][Math.floor(boatPosX / 36)]); and I know if its 0, 1 or 2 he is standing on. Which is great so far. But my collision still doesn't work the way it should. Actually it acts so weird I don't even know how to fix it properly. If I put some 1 in my player start position, I get collision, but if I place it at 0 in array and move onto 1 myself, it doesn't work.

So it's giving me different results every time. I feel like I'm almost here but some stupid bug is ruining it all.

var mapArray = [
  [2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2],
  [2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2],
  [2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2],
  [2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2],
  [0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0],
  [0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, 0, 0, 0],
  [0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, 0, 0, 0],
  [0, 0, 0, 0, 0, 1, 1, 0, 0, 0, 0, 0, 0, 0, 0],
  [0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0],
  [0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0],
  [0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0],
  [1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1],
  [1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1],
  [1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1],
  [1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1],
];
function isPositionWall(ptX, ptY) {
  var gridX = Math.floor(ptX / 36);
  var gridY = Math.floor(ptY / 36);
  if(mapArray[gridX][gridY] == 1)
    return true;
}

var boatPosX = canvas.height/2 - 50;
var boatPosY = canvas.height/2 - 50;

function render(viewport) {
  context.save();
  context.translate(view.x, view.y);
  requestAnimationFrame(render);
  var oldPosX = boatPosX;
  var oldPosY = boatPosY;

  for (let i = 0; i < mapArray.length; i++) {
    for (let j = 0; j < mapArray[i].length; j++) {
      if (mapArray[j][i] == 0) {
        this.sprite.draw(
          background,
          190,
          230,
          26,
          26,
          i * this.sprite.width,
          j * this.sprite.height,
          this.sprite.width,
          this.sprite.height
        );
      }
      if (mapArray[j][i] == 1) {
        this.sprite.draw(
          background,
          30,
          30,
          26,
          26,
          i * this.sprite.width,
          j * this.sprite.height,
          this.sprite.width,
          this.sprite.height
        );

      }
      if (mapArray[j][i] == 2) {
        this.sprite.draw(
          background,
          200,
          20,
          26,
          26,
          i * this.sprite.width,
          j * this.sprite.height,
          this.sprite.width,
          this.sprite.height
        );
      }
    }
  }
  this.ship.drawimage(boat, boatPosX, boatPosY, 50, 50);

  if(isPositionWall(boatPosX, boatPosY)) {
    //boatPosX = oldPosY;
    console.log("collision");
  }
  console.log(mapArray[Math.floor(boatPosX / 36)][Math.floor(boatPosX / 36)]);
  context.restore();

};

function move(e) {
  if (e.keyCode == 39) {
    boatPosX += 5;
    view.x -= 5
    moveCount++;
    console.log(moveCount);
    console.log("right");
  }

That's parts of the code that are related to the question. If you need need more code, let me know. I'm looking for some directions what I'm doing wrong. Thanks.

Codepen: https://codepen.io/Limpuls/pen/deEGXX

sentences:
Going from a solo game project to a team project, how should I organize the new team and potential revenues? I have been working on a game partial time for 2 years now, I've done the code and assets myself, but eventually I understood that I would not be able to have nice looking assets without spending a lot of time into it. And that greeting a new team member with graphic designer skills on this project would be a good idea.

My project is purely casual ATM. While I would love to earn a bit of money from it, my main goal is to have something fun to play with my friends (it's a couch console game) and I'm not sure what I want for the release of the game.

Now that I'm about to greet a graphic designer in the game project I'm excited but I want to do things right.

What should I define prior welcoming a second member in the team to make things work regarding the organization of the new team and the potential earnings?

What if things goes wrong and we split, when I have worked 900h on the game and him 20?

Any other tips from your experience regarding this aspect of welcoming a new teammate?

sentences:
Draw multiple times same object but translated and rotated I want to draw lots of spheres in different locations and orientations with Opengl4 and JOGL. As the vertexes and colours are the same for all of them, I have just one array for vertexes and another for colours. For the positions and orientations, I have another big matrix where I have all data for all spheres.

In principle, drawing one with glDrawArrays is not a problem but for severals, I have read that I should use glDrawArraysInstanced instead. My problem is that I am a bit confused about how to apply each transformation for my particles. How should I introduce this array into the shader? Should I send the matrix model after doing the transformations in the cpu or should I send the positions and orientations and transform them inside the shader? How do I connect the data to the shader? How should the shader look like?

sentences:
Maya and Game Engines (i.e. Environment Testing) What does it mean if I'm designing an environment and I want to test it in the game engine, to see what its like to "run" [or fly] around my environment? I heard an instructor say that exact thing in a Maya training video and I'd like to know more about "How Game Engines and Maya are related to each other." He stated this would be done to see how things look in "size" (e.g. I assume he meant: 'How big is the cathedral, bridge, wall, building, etc.').

I've tried to research such information but it's too complicated, and detailed. I just want a simplistic response to my query. Thanks to everyone willing to help and not criticize my question.

sentences:
How can I rotate a bitmap without D3D or OpenGL? I've just figured out on my own how to scale a portion of a bitmap using PutPixel. I would like to know the mathematical theory behind rotating a bitmap on my own, using per-pixel operations like PutPixel.

I am not interested in using OpenGL or Direct3D to accomplish this, I'd like to know what the fundamental math and programming technique behind the operation is?

sentences:
Can't seem to get Sprite to face left in sfml c++ I am having some small issues getting my sprite character to flip around. Basically I have a character that can walk to the right.. I am looking to flip it so that it looks like it is walking left.  I haven't found a working solution at the moment so any help would be amazaing!

I am using:

SFML 2.1
C++

I have tried:

  guy.setTextureRect(sf::IntRect(guy.getGlobalBounds().width, 0, guy.getGlobalBounds.width * -1, guy.getGlobalBounds.height));

sentences:
Ward model implementation: specular component too weak I'm trying to implement the Ward shading model, the anisotropic, computationally efficient version:

This is how I made it:

float alphaX=0.5, alphaY=0.5; // asinotropic roughness
float minFloat= 1.e-6;

vec4 Ward(vec3 L, vec3 N, vec3 V)
{
    vec3 H= normalize(L+V);
    float NdotL= max(dot(N,L),0.0);
    float NdotV= max(dot(N,V),0.0);

    vec3 e= vec3(1.0,0.0,0.0);
    vec3 T= normalize(cross(N,e));
    vec3 B= normalize(cross(N,T));
    float HdotT= max(dot(H,T),0.0);
    float HdotB= max(dot(H,B),0.0);
    float HdotN= max(dot(H,N),0.0);

    float beta= -2.0 * ( pow(HdotN/alphaX, 2.0) + pow(HdotB/alphaY,2.0) ) / (1.0 + HdotN);
    float den= max(minFloat, 4.0 * pi * alphaX * alphaY * sqrt(NdotL * NdotV) );
    vec4 specular= Ps * 1.0/den * exp(beta);
    return (Pd + specular) * NdotL;
}

But I get a result similar to a lambertian surface or Oren-Nayar model, where the specular component is absent:

sentences:
Character ability power balance I'm making a game where the player controls a character. This character starts off bland & weak. But over the course of playing the game, picks up abilities which the character uses as attacks/magic/damage dealers during battles. There are many different types of abilities/powers. I want to allow the player to level up these abilities through whatever means I come up with (haven't done that yet).

How do I balance ability ATTACK power (damage dealt) for instance? I'm sure there's some kind of abstract way of approaching this but it's eluding me. I want to make sure that if I make a super overpowered ability that there is another ability out there that can at least counter act it.

So the question: how do I approach ability power upgrade balancing when designing my game? Is it an algorithm? Can it be done linearly? So that there is always an awesome new strong ability waiting around the corner for the player character?

sentences:
Calculating ball trajectory in Pong I'm making a Pong game and I'm just looking for a simple way to calculate a straight travelling path for the ball based on the angle of the ball. How would I go about implementing something like this? Here is my code right now:

public void UpdatePosition()
{
    //For now let's just implement a very primitive movement algorithm
    //TODO: Movement calculation based on angle of the ball
    ball.velocity = (ball.angle < Math.PI / 2) ? 5 : -5;
    ball.Point = new Point(ball.Point.X + ball.velocity, ball.Point.Y + ball.velocity2);

    //Check if the suggested point is beyond the boundaries of the window
    if (ball.Point.X > ball.view.Boundaries.Width || ball.Point.Y > ball.view.Boundaries.Height || ball.Point.X < 0
        || ball.Point.Y < 0)
    {
        ball.Collision(CollisionType.Boundary); // If it does raise collision event
    }

    //Check if the new point collides with the hitbox of a player paddle
    if (ball.gameController.Players[0].Paddle.GetHitbox().Any(point => point.Equals(ball.Point)) ||
        ball.gameController.Players[1].Paddle.GetHitbox().Any(point => point.Equals(ball.Point)))
    {
        ball.Collision(CollisionType.Paddle);
    }
}

sentences:
Quaternion angle calculation I'm working on a programming project, in this project I'm receiving an angle as a quaternion value, I partially understand how they work but I don't find any math to get the values I need.
What I would need is the angle between a fictional line/vector going to the the quaternion point from the origin (yes I know what you are thinking, but I couldn't think of a better explanation) and the "earth" a plane that is perpendicular to the gravitational vector, in this case one of your planes of reference.
Also I would need to get the rotation of the line/vector, this time the rotation should be according to the plane perpendicular to itself.
If possible all angles should be described as an angle between -180° and 180° (that's were my troubles are from.

In this picture γ complementary angle of the first questing and R is the secondary angle.
Angles

PS: This is the last formula I tried to use.

sentences:
Calibration using quaternion I have an external hardware which gives me quaternion values.
Now I would like to calibrate the device at a certain position and show tilt variations from that position on the UI.
For example, I have a small 3D plane model. Whatever position the device maybe, after calibration the model's back should be facing the user with the tail up and from that position the rotation should be relative to the device's rotation.
How to do that?
Simply recording the quaternion values at the calibration position and using that to subtract from the current quaternion values from the device and setting to the 3D model is not working.

Below is the code where I apply the calibrated values:

imu.xAxis = (Style.qX + (imuData.quatX - Style.bX))
imu.yAxis = (Style.qY + (imuData.quatY - Style.bY))
imu.zAxis = (Style.qZ + (imuData.quatZ - Style.bZ))
imu.wAxis = (Style.qW + (imuData.quatW - Style.bW))

where qX,qY,qZ and qW are the initail postion of the model, quatX, quatY, quatZ and quatW are the current quaternion values from the device and bX, bY, bZ and bW are the quaternion values at the calibration position.

sentences:
In collision detection/resolution, what is a "collide and slide" algorithm? Can anyone help me to better understand the concepts behind this algorithm?
I've seen this phrase come up several times during my research into creating a 3D character controller, but am having issues finding much information about it. One example is from a user manual that accompanies a character controller asset on the Unity asset store.
I'm used to handling collisions in 2D that involve primitive colliders, so most of the time I simply move my entity, check for overlaps, and then calculate the shortest distance out of the primitive (if one is using Unity, he or she can also use the ColliderDistance2D API for this). It seems like "collide and slide" might be a bit more involved, especially in 3D where contact with a mesh may be the norm instead of contact with primitives. From the manual I linked earlier it seems that an entity's movement vector is altered based on the normal of the surface with which that entity collides, but where does the actual collision (overlap) occur, and how do we resolve it?

sentences:
How to access the players XBOX account from your Windows 10 game app? We want to release a game that was previously an Android game for Windows 10 (Store / Desktop). Could you tell me how we can access the players XBOX account, see his friends and compare their scores? We also want to display their profile pictures. Sadly we don't even have an idea how the API we're looking for is called. We're confused by these "universal app" things. I saw something similar in the Minecraft app for Windows 10. Our Engine is the latest version of Unity, by the way. If informations are missing, please let me know.

All I have to know is where to find the API and it's name. A link to tutorials could be useful :)

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:
Convert .s file to .midi or any sound file I have a .s file from a game, I think it contains Music . I know this sounds weird but here are snippets :

(I opened it with Visual Studio and it sais it is a 'Assembler Source')

.equ    My_File_grp, voicegroup000
    .equ    My_File_pri, 0
    .equ    My_File_rev, 0
    .equ    My_File_mvl, 100
    .equ    My_File_key, 0
    .equ    My_File_tbs, 1
    .equ    My_File_exg, 0
    .equ    My_File_cmp, 1

The rest is only stuff like this:

@ 001   ----------------------------------------
    .byte       VOICE , 52
    .byte       N36   , An3
    .byte   W36
    .byte       VOICE , 58
    .byte       N48   , An3
    .byte   W48
    .byte       VOICE , 54
    .byte       N12   , Fs3
    .byte   W12

I need to listen to this but I really don't understand what these lines of code mean, please help! I want to convert this file to a file I can listen to.

sentences:
DirectWrite Producing Strange Artifacts? I've written the basis to my UI system around Direct2D. I like it because it's fast and easy to use (even if I had to do some messy work to get it to work with DirectX11). However, I notice when using DirectWrite I'm getting strange problems with my text.

As you can see, the e is a little screwwed up, and it overall looks a little bumpy. This only happens with certain fonts in certain sizes, and with certain arrangements of letters. This particular example is Verdana in size 16.0 font.

Can I fix this? It's pretty annoying to change all my words and fonts because of this problem.

sentences:
Huge slowdown when running Lua as statically linked lib versus stand alone interpreter I'm developing some algorithms in Lua which are run mostly in Lua (few calls to C++) and I'm noticing a huge slowdown when I'm running them from my app rather than the default Lua interpreter.
The script returns in about 11 seconds with the interpreter, and about 5+ minutes with my program.

I don't think it is a problem with calling the C++ function, overruling that function with an empty function in the script has no noticeable effect for time.

Both Lua and the program are compiled with Visual Studio 2010 (I created a new solution for Lua, with projects for both the interpreter and static library)

I've run a profiler on the code (the Very Sleepy profiler, can't get a Lua profiler working but haven't tried to much) and found that in my application around 50% of the time is spend on malloc.. and 40% on free, both called from the Lua garbage collector (tried disabling that to check, but that crashes with using to much memory (understandably), the Lua interpreter peeks at about 4mb ram usage).

I'm new at Lua, so its very possible I've done something wrong somewhere, anyone got a few hints to try?

sentences:
SDL_Image and typical SDL BMP loading fails completely been messing with OpenGL and SDL for a pair of weeks.

The thing is quite weird. I have been loading a texture from a BMP and using a really easy shader to make it work, and so far it has worked very well.

Now, i've refractored my code and made a heightmap loader, with is pretty cool and works nice. I have a ResourceManager class which successfully loads shaders but fails at loading textures.

The structure of that class is simple:

Constructor (empty)
Destructor (empty)
AddTexture (const char* FileName, const char* indexName)
GetTexture (const char* indexName)
typedef map TextureMap
typedef TextureMap::iterator TextureIt
TextureMap Textures

I tried using SDL Load BMP function and SDL_img Load IMG function. The first one makes this weird result:

Close-Up

When the real image is a simple BMP in 32bit format, as always:

Real Texture

And the second method, using SDL_image, simply doesn't show the image.

The 'AddTexture' function:

bool TEXTURE::TextureManager::AddTexture(const char* fileName, const char* indexName)
{
    SDL_Surface* img = SDL_LoadBMP(fileName);
unsigned int id;
glGenTextures(1, &id);
glBindTexture(GL_TEXTURE_2D, id);
glTexImage2D(GL_TEXTURE_2D, 0, GL_RGB, img->w, img->h, 0, GL_RGB, GL_UNSIGNED_SHORT_5_6_5, img->pixels);
glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, GL_LINEAR);
glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER, GL_LINEAR);
SDL_FreeSurface(img);
Textures[indexName] = id;
return true;
}

And the 'AddTexture' SDL_image version:

GLuint id = 0;

SDL_Surface* Surface = IMG_Load(fileName);

glGenTextures(1, &id);
glBindTexture(GL_TEXTURE_2D, id);

int Mode = NULL;
if(Surface->format->BytesPerPixel == 4)
    Mode = GL_RGBA;
else
    Mode = GL_RGB;

glTexImage2D(GL_TEXTURE_2D, 0, Mode, Surface->w, Surface->h, 0, Mode, GL_UNSIGNED_BYTE, Surface->pixels);
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);

std::cout << "The ID of the tex is " << id << std::endl;

Textures[indexName] = id;

return true;

I create the texture here:

Res->TexManager->AddTextureAlt("res/sum.bmp", "Brick");

And the following code is used to bind the texture:

GLuint TEX = Res->TexManager->GetTexture("Brick");
glBindTexture(GL_TEXTURE_2D, TEX);

The normals and tex coords are alright, i've been using it all the time and it was displaying the tex and light perfectly well before.

I can't find the problem. I just can't. Is someone able to help a poor noob?

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:
How to determine vertex index using Shader Model 3 or lower? I need something like SV_VertexId (added in Shader Model 4) in HLSL shader to determine which vertex is currently handled. Unfortunatelly, I can compile only vs_3_0 or lower.

The objective is to change position of one specific vertex using HLSL. I can't edit the mesh and can't pass any data from game engine, my capabilities are limited by HLSL shader.

Shader is writing only for one mesh (humain face), I need to change it's shape a bit (for example, close an eye or make it smiling). I already tried to locate vertex by TEXCOORD, but had no idea how to separate it from other triangles verticles connected to it (placed at the same point where many triangles are met).

if ( VS.TC[0] > 0.8828125 && VS.TC[1] > 0.6328125  && VS.TC[1] < 0.671875 ) {
    // Upper lip center
    VS.Position += VS.Normal * uUpLip;
}

Could you, please, give me any advice how to identify / move only one specific verticle in HLSL? I need something like moving verticle in Blender's Edit Mode (wytn neighbour triangles are still connected in one point), but my attempt with TEXTCOORD makes them moving in different directions

Thanks

sentences:
Opengl drawing a section of a texture stretched over a quad Current Situation

I have a spritesheet loaded in for a texture when drawing the specific portions of the sheet that I'd like to have on my quads I do some simple math to get their location on the sheet and normalize it.

My texture is setup like this:

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_REPEAT);
glTexParameterf(GL_TEXTURE_2D, GL_TEXTURE_WRAP_T, GL_REPEAT);

The Problem

Where I'm facing the problem is that because I'm using a "chunk" of the total texture I can't take advantage of using 1.0 for the mapping of values to glTexCoordPointer to cause the texture to stretch over the entire face.

Looked Into

I've looked for a glTexParameterf option for scaling options but I failed to find anything.

Question

Is it possible with my current methods to stretch the texture over the face of the quad without having to load a separate image for every "sprite" of the texture? Or am I just doing everything completely wrong?

Picture that hopefully sort of clarifies:

Thanks for any help.

edit
The problem was another issue all together:
Turns out it was another issue all together, I thought this didn't make sense cause it was mapping it to the vertices so it should stretch regardless and infact it does work right I was assigning the wrong the width and height values to the drawing routines calculations. And now I feel really stupid, thanks for the help Byte56. Sorry for taking up your time. The GL_CLAMP solution would be the correct answer if I hadn't made a huge fail.

sentences: Creating an Android Game using Java and c++ What's the best way to go about this? I've never coded using two languages before, let alone for an android phone

sentences:
Are there 3D projections other than orthographic and perspective? The question is pretty much in the title. Are there notable 3D projections other than orthographic and perspective that could be used in a 3D system such as OpenGL?

In particular, are there any that have a particular use in game design?

sentences:
For Vertex Buffer Steaming, Multiple glBufferSubData VS Orphaning? I was learning OpenGL recently.
In games, we need to update the position of game objects frequently, and they will come in & out of screen constantly. So it means in rendering we need to update the vertex buffer quite often as well.

In OpenGL's context, one intuitive way is to use glBufferSubData to update those that changed.

But I also read online a trick called Orphaning that creates a new buffer data and upload the whole vertices data to it.

Also due to state chagnes cost and uploading cost, multiple glBufferSubData may also cost more.

Here is my question,

Which method is better?
Is stalls really matters in this case?
Is state changes and uploading cost really matters in this case?

Thanks!

sentences:
Where does Unity save Inspector properties for objects in a scene? If I add a collection of objects to my scene and configure Inspector properties on those objects (like name, layer, tag, transform parameters, attached Components and their parameters), where does the information about those Inspector properties get saved within my project?

Is it all saved within the scene's .unity file or are there other files I should look at?

sentences:
How can I get multiple bullets on screen? I've finally gotten this laser thing to work for my Space Shooter, and so far I've come across a slight problem. I've gotten the laser to position itself at the starting position correctly and move vertically perfectly. Anyway, whenever I hit the space-bar (which is the controls for shooting), it shoots the bullet/laser out, but I have to wait until the bullet clears to shoot another one.

What I want it to do is keep producing bullets until the user releases their hand on the space-bar... here's the code I have so far:

if(spacebar)
// this bool variable is set to true once the user presses the space bar
{
    int frame2 = 0;

    if(once2 == 0)
    {
        projectilex2 = x + 19;
        projectiley2 = y + -35;
        //Positions the bullet at the nose of the ship
    }

    if(frame2 == 3)
    {
        frame2 = 0;
    }

    apply_surface(projectilex2, projectiley2, ShootStuff, screen, &lazers[0]);

    frame2 ++;
    projectiley2--;

    once2++;
    if(once2 == 250)
    {
        once2 = 0;
        spacebar = false;
    }
 //This will eventually get better. My shoot function is horrible lol :/
}

Does anyone have any ideas as to how I can accomplish this without having to wait for the bullet to clear before I can shoot another one :( ?

sentences:
What is Unity Quaternion range? I've read somewhere that a Quaternion in Unity ranges between [-1,1] values. I mean the individual XYZW values. Ex: new Quaternion(.1f,.2f,-.3f,-.4f)

Is this true?

More clearly: I know they take float values therefore the theoretical limit is floating point value limitations, I'm asking the real rotation results. For instance when I look up Quaternion values while rotating a GameObject it is usually in the [-1,1] limits. But I'm not sure if that's my case or not.

sentences:
pyglet how to disable image smoothing? I'm using sprites made up of very few pixels. When scaling the sprite gets blurry, so how do I disable this smoothing? I couldn't find anything in the docs or elsewhere online

Sprite:

In pyglet, scaled 8:

sentences:
Can I trigger input/controls via code? I have the 3rd person controller in my game, which moves with the WASD keys.
But since I am developing for a mobile release, I want touch controls.

I have already the touch control-script in a new script-file, but attached to the same 3rd person controller-prefab.

When I swipe right for instance, I want Unity to trigger the D-key etc.

How can I do that?

...
if (Mathf.Abs(delta.x) > Mathf.Abs(delta.y))
{
    if (delta.x > 0)
        //trigger D?
    else if (delta.x < 0)
        //trigger A?
}
...

sentences:
web based quizz game database design, how do I store results? I'm building a very basic quizz type of php/mysql/ajax game.

At this stage I'm thinking about the DB design, and specifically how to score results, I've two options in my mind. But cannot decide which one is better (being self taught. mostly by doing things, I have no idea what are best practices or what can be useful or not.)

So, I've 3 tables:

Users -> contains: user_id, user_name, user_pass, user_score
Quizz -> contains: quizz_id, quizz_answer, quizz_question, quizz_value
Results -> this is the one I'm debating. Should I keep user results in a separate table and have it like: result_id, result_user_id, result_quizz_id, result_score
Or simply include results for user inside users table under user_results and save it as array of answered quizz_ids

I'm debating if it is good practice to have separate results table or not. If I've it separately it means 10K users can easily create 10K*100 results rows. On the other hand array in user_results can become to contain 100 keys.

Performance wise, and taking into consideration good practices, which way is better?

Can mysql handle 10K*100 row lookups constantly on the bases of user_ID? Or is it wiser to just explode array from user_results column?

sentences:
How do I calculate the new Quaternions from translated points? The code below is for a rag-doll using Verlet method, I have the correct points (or joints) positions, I just need the correct Quaternions, otherwise the resulting model looks like in the picture, I'm constraining the body to the bind pose on purpose for testing purposes.

Based on the two points, their position and quaternion, what will the new Quaternion be for each translated point?

struct Point
{
    XMVECTOR position = { 0,0,0 };
    XMVECTOR quaternion = { 0,0,0,-1 };
};

Point p1;
Point p2;

p1.position += { 0.0f,0.3f, 0.1f };
p2.position += { -1.0,0.3f,0.1f };

sentences:
is there a way to alternate between two state machines? I'm programming an enemy on Unity that has two state machines, one controlling the "normal" behaviour of the enemy (that consists in three states: idle, patrol and chase) and another one controlling the battle behaviour of the enemy (that consists in three more states: attack, dodge and run away). I'm doing these state machines by using enums, like the following code
public enum StateMachines { NORMAL, BATTLE }
public enum NormalStates { IDLE, PATROL, CHASE }
public enum BattleStates { ATTACK, DODGE, RUNAWAY }

I want to loop between the Normal and Battle state machines but I have one problem that is they always get executed at the same time. Is there a way I can alternate between state machines through code in a single script (by conditions)? Thank you!

sentences:
How do I set what beta branch I want to upload my build to in Steamworks? I have many beta branches, and when uploading the game I just run a command which executes the app-build-xxxx.vdf file. How do I set what specific branch I want those changes to be uploaded to? My configuration file looks something like this:
"appid"           "xxxxx"
"desc"            "Beta branch xxxx "

"buildoutput"     "..\output\"
"contentroot"     "..\..\Game\"

"setlive"         "<Name of the branch here as it is in steamworks>"

sentences:
How can I implement rectangle collision response? I am working on a game in JavaScript and my current implementation of collision uses the shortest distance to push the intersecting object away, which isn't always correct. I've made this diagram of the ideal collision. The red box represents the starting position, the green box represents the proper position and the black box represents the static object it is colliding against. The blue arrow is the velocity vector. With my current implementation, the object would be placed in its final position and pushed out (and in this case it would be pushed left)

How can I fix this?

sentences:
Start a progress bar when clicking a button This is basically what i am trying to do:

Click first scene->Button
Start A Progress Bar
When the Progress Bar finishes, then...
Second Scene->instantiate my Game object

This is my code:

// First Scene
public class LoadingScreen : MonoBehaviour  //first scene script
{
    public GameObject slidercanvas;

    public void NextScene()
    {

        StartCoroutine(LoadNextLevel());
    }
    IEnumerator LoadNextLevel()
    {
        slidercanvas.SetActive(true);
        Slider s = slidercanvas.GetComponentInChildren<Slider>();
        AsyncOperation sceneLoading =SceneManager.LoadSceneAsync("ScrollGrids");

        while (!sceneLoading.isDone)
        {
            float progress = Mathf.Clamp01(sceneLoading.progress / 0.9f);
            s.value = progress;
            yield return null;

        }
   }

  //second scene

  public class ScrollGridScript : MonoBehaviour
  {
    public static ScrollGridScript Instance;
    public GameObject SpawnPrefab;
    GameObject newobj;
    public GameObject parent;
    Vector3 pos;
    string msgSpeech;
    int counter=0,totalVal;
    public List<GameObject> btns;
   //float progress;

    void Start()
    {
        btns = new List<GameObject>();
        StartCoroutine(Populate());
    }
    void Update()
    {
        if (totalVal==counter)
        {
            for (int i = 0; i < btns.Count; i++)
            {
                btns[i].SetActive(true);
            }
        }

    }
    IEnumerator Populate()
    {
        //code here(encoding jsonurl)
        StartCoroutine(Downloadimage(newobj, msgSpeech,tname));
        totalVal =  data["categorylist"].Count;
    }

    public void OnButtonclick(string imgname)
    {
        effector.Instance.setEffector(imgname);
        Debug.Log("ButtonId" + imgname);
    }

   IEnumerator Downloadimage(GameObject newobj, string imgUrl, string catid)
   {
      UnityWebRequest www = UnityWebRequestTexture.GetTexture(msgSpeech);

      DownloadHandler handle = www.downloadHandler;
      yield return www.SendWebRequest();

      Texture2D texture2d = DownloadHandlerTexture.GetContent(www);

      if (www.isHttpError || www.isNetworkError)
      {
            UnityEngine.Debug.Log("Error while Receiving: " + www.error);
      }
      else
      {
       counter++;
       newobj = (GameObject)Instantiate(SpawnPrefab, pos, Quaternion.identity);
       newobj.transform.SetParent(parent.transform);
       newobj.transform.localPosition = pos;
       newobj.GetComponent<Button>().onClick.AddListener(() =>
       OnButtonclick(catid));
       Image sprite = newobj.transform.GetComponent<Image>();
       sprite.sprite = Sprite.Create(texture2d, new Rect(0, 0, texture2d.width,
       texture2d.height), new Vector2(0, 0)); //fetch the images from the serve
       //and convert it
       newobj.SetActive(false);
       btns.Add(newobj);  // instantiate object store in list
    }
}

And here is the output I see when I run this code:

sentences:
Is there any way to embed browser component into game for facebook Authentication? Say I have desktop game and I like to make it social, for that I need browser component
embedded into my game  ( c++ openGL) for the Authentication part. Is there any framework
for that?

sentences:
"SetFloatImpl can only be called in the main thread." What does this mean and how can I fix this? I am trying to create procedurally generated terrain and I have a Default texture with some code for my terrain material. An error pops up saying that SetFloatImpl can only be called in the main thread. What does this mean.

My default texture code is below:

    using UnityEngine;
using System.Collections;

[CreateAssetMenu()]
public class TextureData : UpdatableData {

    public Color[] baseColours;
    [Range(0,1)]
    public float[] baseStartHeights;

    float savedMinHeight;
    float savedMaxHeight;

    public void ApplyToMaterial(Material material) {

        material.SetInt ("baseColourCount", baseColours.Length);
        material.SetColorArray ("baseColours", baseColours);
        material.SetFloatArray ("baseStartHeights", baseStartHeights);

        UpdateMeshHeights (material, savedMinHeight, savedMaxHeight);
    }

    public void UpdateMeshHeights(Material material, float minHeight, float maxHeight) {
        savedMinHeight = minHeight;
        savedMaxHeight = maxHeight;

        material.SetFloat ("minHeight", minHeight);
        material.SetFloat ("maxHeight", maxHeight);
    }

}

the picture of the error is here:

Thanks in advance.

the complete message is here:

UnityException: SetFloatImpl can only be called from the main thread.
Constructors and field initializers will be executed from the loading thread when loading a scene.
Don't use this function in the constructor or field initializers, instead move initialization code to the Awake or Start function.
UnityEngine.Material.SetFloat (System.String name, System.Single value) (at /Users/builduser/buildslave/unity/build/Runtime/Export/Shaders/Shader.cs:492)
TextureData.UpdateMeshHeights (UnityEngine.Material material, System.Single minHeight, System.Single maxHeight) (at Assets/Scripts/Data/TextureData.cs:27)
MapGenerator.GenerateMapData (UnityEngine.Vector2 centre) (at Assets/Scripts/MapGenerator.cs:130)
MapGenerator.MapDataThread (UnityEngine.Vector2 centre, System.Action`1[T] callback) (at Assets/Scripts/MapGenerator.cs:73)
MapGenerator+<>c__DisplayClass16_0.<RequestMapData>b__0 () (at Assets/Scripts/MapGenerator.cs:66)
System.Threading.ThreadHelper.ThreadStart_Context (System.Object state) (at <437ba245d8404784b9fbab9b439ac908>:0)
System.Threading.ExecutionContext.RunInternal (System.Threading.ExecutionContext executionContext, System.Threading.ContextCallback callback, System.Object state, System.Boolean preserveSyncCtx) (at <437ba245d8404784b9fbab9b439ac908>:0)
System.Threading.ExecutionContext.Run (System.Threading.ExecutionContext executionContext, System.Threading.ContextCallback callback, System.Object state, System.Boolean preserveSyncCtx) (at <437ba245d8404784b9fbab9b439ac908>:0)
System.Threading.ExecutionContext.Run (System.Threading.ExecutionContext executionContext, System.Threading.ContextCallback callback, System.Object state) (at <437ba245d8404784b9fbab9b439ac908>:0)
System.Threading.ThreadHelper.ThreadStart () (at <437ba245d8404784b9fbab9b439ac908>:0)
UnityEngine.Material:SetFloat(String, Single)
TextureData:UpdateMeshHeights(Material, Single, Single) (at Assets/Scripts/Data/TextureData.cs:27)
MapGenerator:GenerateMapData(Vector2) (at Assets/Scripts/MapGenerator.cs:130)
MapGenerator:MapDataThread(Vector2, Action`1) (at Assets/Scripts/MapGenerator.cs:73)
<>c__DisplayClass16_0:<RequestMapData>b__0() (at Assets/Scripts/MapGenerator.cs:66)
System.Threading.ThreadHelper:ThreadStart()

I am using Sebastian Lagues' code for this.

sentences:
Unity joystick input acting strange After setting up my joystick axes in Unity and sweeping them around I find that the Y-axis jumps to the opposite direction in certain positions.

So, when I press up on the joystick, the input will often indicate that it's pointing down. It will also sometimes do this in the opposite direction. It's somehow tied to the x-axis position, making it especially weird.

sentences:
Drawing on an image before drawing on screen in XNA using VB.NET I'm programming a game in XNA, using VB.NET. I want to create an intro to the game that zooms in/out the whole screen and scaling each image to accomplish this is cumbersome at best. I like to be able to draw a lot of .PNG's (or parts of them) onto a whole image, to then be able to manipulate (scale, turn etc) that whole image, before drawing it with the spriteBatch. The examples I can find use something like:

dim bitmap as New Bitmap

or

dim image as New Image

but these codes highlights the "Bitmap" or "Image" as red, and I cannot use them. I'd be thankful for any help on this issue!

please note: I'm new to this, and self taught, so I prefer concrete examples if possible.

sentences:
Unity AR Ground Plane Detector I need to check a "ground plane" to put objects over it without a marker, using Unity.

Right now I'm using Vuforia, but the Ground Plane on Vuforia only works on some devices, I tested on mine and my mother's Android phone, both modern and from different brands, didn't work. So it's not an option, because many many people couldn't use it.

Same with ARCore, asked me to install some sort of Google Services AR, which the download is locked for my phone.

Is there any way to use Unity with some kind of ground plane detector that many phones can "read" it? Any API, code, anything different that I didn't try yet?

Thanks!

sentences:
How do teams prevent overwriting work in source files? It occurred to me the possibility that while, for example the game engine, is being worked on simultaneously by multiple people how is overwriting prevented?

Let's say developer one is working on Audio.cpp and developer two is also working on Audio.cpp, how is this generally managed in large teams to combat overwriting? (In other words to stop developer two from opening the file until developer one is finished)

sentences:
MMO - Server monster handling Dabbling with basic MMO code because it intrigues me.

How does the server handle monsters / mobs?

I understand that generally on each game tick, the server loops through each player to send them updated positions of each other nearby player or mob.

So every player loop you're also looping through every other player but is it just standard to  loop through the entire mob list too? I mean there could be 1000+ mobs idling around the game world/zone. Would this just slow the loops down?

I thought maybe they keep a seperate list of ACTIVE mobs, ones that are either near a player or are chasing a player, but that would still require looping the idle ones to check if a moving player comes near one. Unless the aggro loop is less frequent (thinking out loud here)..

Is there some tricks or common workarounds involved? Or is that just how they work?

sentences:
How to draw a circle on the ground like in "Warcraft 3"? I've been watching "Warcraft 3", and suddenly realized that I have no idea how to draw a circle on a surface.

Here is an example:

I guess this is projection? I also have very little idea of how to draw a shadow. I only somewhat know OpenGL.

It is also interesting how this circle seems to not perfectly repeat the shape of that cliff. My guess is that it's drawn using a height map, which is stored somewhere separately, and not as the cliff, itself. It looks like it actually goes underwater, but it may be just a compression artifact.

sentences:
How to handle mixed input I'm aiming for the following design in my app, and I am having a difficulty figuring how this could be achieved.

The purple part will be the main part of the game, which I have actually already written, implementing InputProcessor. It uses touch controls for dragging (mainly) and touching down or up with the finger.

I didn't think of creating a HUD beforehand and now decided that a Stage would work perfectly for that, but it definitely wouldn't work with the above input method. Is there a way to split the screen into areas like in the diagram, and depending on touch location pass the touch events to either main game InputProcessor or to the Stage?

sentences:
Action Script 3.0 datatype to match C++ iterator? (Code convertion) I am developing a game with Action Script 3.0 using Starling Framework, converting it from C++

C++ Code :

for (std::vector<MyObject*>::iterator i = m_listEnemy->begin();i!= m_listEnemy->end();)
{

    (*i)->update(dt);
    if ( (*i)->m_Hp <=0 )
    {
            (*i)->release();
            i = m_listEnemy->erase(i);
            continue;
    }
    i++;
}

MyObject is the class.

What Action Script 3.0 data type matches the C++ iterator?
Also , how can I convert this C++ code to Action Script 3.0 code?
Thanks in advance!

sentences:
small independent game development on a virtual machine I've been learning about OpenGL and SFML  with c++ now for about 6-8 months, and would like to work on a small little personal game to put some of my skills to the test.

Now I want to kill two birds with one stone, and also increase my knowledge of Ubuntu and linux development in general by developing this project in Ubuntu. Currently my main computer runs Windows 7 while I have an older computer than runs Fedora 18, so I set up an ubuntu 12.04 LTS virtual machine on my main computer. The problem is, what effects does this have graphics wise? I know windows virtual machines running games can often have some graphical and input bugs, should I not use a virtual machine? Or this fine and I'm simply over thinking the subject? Thanks!

Note**

I am using VM VirtualBox on my windows 7 desktop.

sentences:
2D snake game ( how to rotate snake's head with movement ?) I want to know:

how to rotate snake's head with movement
how to make tail prefabs (body) follows head direction.

public class Snake : MonoBehaviour {

    bool ate = false;
    bool isDied = false;
    public GameObject tailPrefab;
    Vector2 dir = Vector2.right;
    List<Transform> tail = new List<Transform>();

    void Start ()
    {
        InvokeRepeating("Move", 0.3f, 0.1f);
    }

    void Update () {
        if (!isDied) {
            if (Input.GetKey (KeyCode.RightArrow))
            {
                dir = Vector2.right;
                //transform.rotation=Quaternion.Euler(0, 0, 180);
            }
            else if (Input.GetKey(KeyCode.DownArrow))
            {

                dir = -Vector2.up;
                //transform.rotation = Quaternion.Euler(0, 0, 90);
            }
            else if (Input.GetKey(KeyCode.LeftArrow))
            {

                dir = -Vector2.right;
                //transform.rotation = Quaternion.Euler(0, 0, 0);
            }
            else if (Input.GetKey(KeyCode.UpArrow))
            {

                dir = Vector2.up;
                //transform.rotation = Quaternion.Euler(0, 0, 270);

            }
    }

    void Move() {
        if (!isDied) {
            Vector2 v = transform.position;

            transform.Translate (dir);

            if (ate) {
                GameObject g = (GameObject)Instantiate (tailPrefab,
                                  v,
                                  Quaternion.identity);

                tail.Insert (0, g.transform);

                ate = false;
            } else if (tail.Count > 0) {
                    tail.Last ().position = v;

                    tail.Insert (0, tail.Last ());
                    tail.RemoveAt (tail.Count - 1);
            }
        }
    }

    void OnTriggerEnter2D(Collider2D coll) {
        if (coll.name.StartsWith("Food")) {

            ate = true;

            Destroy(coll.gameObject);
        } else {
            isDied = true;
        }
    }
}

sentences:
How to create fog effect over specific tiles in dungeon game I'm working on a game in unity and I have areas the player cannot enter blocked off by game objects that are animated sprites that are supposed to look like fog. They don't look that great and I'd like to try something a little more complex, but as a beginner with Unity I don't know where to start.

I'd like to make a fog effect that surrounds the tiles that are blocked (Similair to this asset I found. But I only want it to be seen over specific tiles.)

I also looked into something like a darkness emitting light, but haven't found anything that works.

Here is a picture of the scene hierarchy.

sentences:
Why does occlusion culling have a negative performance impact on Gear VR in Unity 5.4.03f? I am making a GearVR game using Unity 5.4.03f and Oculus Utilities for Unity 5.

I have problem with Occlusion Culling. I've set appropriate objects as static and baked the data. The culling works correctly when I visualize it in the editor - I set a complex scene and hid it behind a big cube. The scene is not rendered when visualizing in the editor when the camera is behind the cube.

When I deploy this scene to the device, Samsung Galaxy S6. The culling does work - when looking at the complex scene through the occluding cube, I have good a framerate, the scene is culled. Without the cube and occlusion culling, the FPS would be around 40, with the cube and OC, it is around 60.

The problem starts when I get past the cube with OC on - the FPS drop to 30, while without OC in the same spot they were around 55.

I tried looking online for solutions, but this is supposed to be an old bug that was fixed back in Unity 5.1.X.

Any ideas?

sentences:
Turn based card game multiplayer: http polling or TCP I am working on card games for mobile devices. For multiplayer I will be communicating through a central server. For the purpose I sorted out three options:

HTTP polling
TCP
Websocket (client libraries are not good, so will not use it)

HTTP polling is simple, but I fear it will introduce much more delay and too many HTTP calls. TCP introduces other complications.

So my question is: Is HTTP polling appropriate for a card game? Will the HTTP overhead be too much? How much interval should I keep for polling?

Can you give a sample game based on HTTP polling?

sentences:
How do I implement fog of war in a tile-based game? I have created a 2D Tile Based game. The game has a single path that the sprite can move on. I want to create to make the entire screen black except for where the sprite is.

The sprite has commands such as left where he keeps looking left, right where he keeps looking right and move forward where he moves in the direction he is looking. I want to make it such that when he looks left then the tile on the left of the sprites, fog should be removed and so on for all the sides.

How can I do this?

sentences:
LibGDX moving game window with mouse drag TL;DR

How can I move window with mouse without tide effect.

Long Version

So when I tried to move my game window via InputListener(just to test if it would work). I got some strange result. The window goes back and forth between last two locations when mouse drags and while button is held.

Game Part

Gdx.input.setInputProcessor(new InputAdapter() {
    int b;
    @Override
    public boolean touchDown(int screenX, int screenY, int pointer, int button) {
        b = button;
        // TODO Auto-generated method stub
        Rectangle.tmp.set(0, 0, 100, 100);
        if (Rectangle.tmp.contains(screenX, screenY)) {
            lastx = screenX;
            lasty = screenY;
            System.err.println("Touch ( " + screenX + " , " + screenY + " )");
        }

        return true;
    }

    @Override
    public boolean touchDragged(int screenX, int screenY, int pointer) {
        if (lastx != null && tr != null) {
            tr.translate(screenX - lastx, screenY - lasty);
            System.err.println("Drag  ( " + lastx + " - " + screenX + " , " + lasty + " - " + screenY + " )");
            lastx = screenX;
            lasty = screenY;
        }
        return true;
    }

    @Override
    public boolean touchUp(int screenX, int screenY, int pointer, int button) {
        lastx = null;
        lasty = null;
        System.err.println("Up ( " + lastx + " , " + lasty + " )");
        return true;
    }
});

DesktopLauncher Part

Game.tr = new Translator() {

    @Override
    public boolean translate(int x, int y) {
        Display.setLocation(Display.getX() + x, Display.getY() + y);
        return true;
    }
};

PS: What I try&tried to make may look stupid.

Edit: Actually I noticed that window moves less than actual mouse movement.
Edit2: When I move the movement code to touchUp I get exact result as movement.

sentences:
Unity mesh - delete quads I'm trying to delete quads in unity. The code here creates a procedural grid. Setting the gridSizeX to 5 and gridSizeY to 3, creates a 6 by 4 grid. I want to delete the first row of quads when I click the left mouse button (later will implement a trigger to delete). I have created a DeleteTriangle() method but it doesn't work properly. I would like to delete all the quads in the first row when I first click the left mouse button. When I click again, it should remove the next row and so on. Here is the code I have:
[RequireComponent(typeof(MeshFilter), typeof(MeshRenderer))]
public class Grid : MonoBehaviour
 {
   Mesh mesh;
   Vector3[] vertices;
   int[] triangles;

   public float cellSize = 1;

   public int gridSizeX, gridSizeY;

   void Awake()
   {
     mesh = GetComponent<MeshFilter>().mesh;
   }

   void Start()
   {
    MakeGrid();
    UpdateMesh();
   }

   void Update()
   {
    if (Input.GetMouseButtonDown(0))
      {
        DeleteTriangle(0);
      }
   }

  void MakeGrid()
  {
    //set array sizes
    vertices = new Vector3[gridSizeX * gridSizeY * 4];
    triangles = new int[gridSizeX * gridSizeY * 6];

    //set tracker integers
    int v = 0;
    int t = 0;

    for (int x = 0; x < gridSizeX; x++)
    {
        for (int y = 0; y < gridSizeY; y++)
        {
            Vector3 cellOffset = new Vector3(x * cellSize, 0, y * cellSize);

            //populate the vertices and triangles arrays
            vertices[v] = new Vector3(-cellSize, 0, -cellSize) + cellOffset ;
            vertices[v + 1] = new Vector3(-cellSize, 0, cellSize) + cellOffset  ;
            vertices[v + 2] = new Vector3(cellSize, 0, -cellSize) + cellOffset  ;
            vertices[v + 3] = new Vector3(cellSize, 0, cellSize) + cellOffset  ;

            triangles[t] = v;
            triangles[t + 1] = triangles[t + 4] = v + 1;
            triangles[t + 2] = triangles[t + 3] = v + 2;
            triangles[t + 5] = v + 3;

            v += 4;
            t += 6;
         }
      }
    }

   void UpdateMesh()
   {
    mesh.Clear();

    mesh.vertices = vertices;
    mesh.triangles = triangles;
    mesh.RecalculateNormals();
   }

   private void DeleteTriangle(int id)
    {
      Mesh currentMesh = mesh;

      var triangles = currentMesh.triangles.ToList();

      triangles.RemoveAt(id );
      triangles.RemoveAt(id );
      triangles.RemoveAt(id );

      currentMesh.Clear();
      currentMesh.vertices = vertices.ToArray();
      currentMesh.triangles = triangles.ToArray();

      currentMesh.RecalculateNormals();
   }
 }

sentences:
From where does the game engines add location of an object? I have started making my first game( a pong game )with ruby (Gosu). I'm trying to detect the collision of two images using their location by comparing the location of the object (a ball) to another one(a player).

For example:

if  (@player.x - @ball.x).abs <=184 && (@player.y - @ball.y).abs <= 40
            @ball.vx = -@ball.vx
            @ball.vy = -@ball.vy

But my problem is that with these numbers, the ball collides near the player sometimes, even though the dimensions of the player are correct.

So my question is from where does the x values start to count? Is it from the center of gravity of the image or from the beginning of the image? (i.e When you add the image on a specific x,y,z what are these values compared to the image?

sentences:
Is there a way to squash/stretch a sprite based on an angle? I have a ball that can move along any angle, and I want to squash and stretch it based on this angle.
To be clear, if you dropped the ball down at a -90 angle, the squash would be all along the y, and the stretch on the x.
This wouldn't work however for a 0 degree angle, where the squash is on the x, and the stretch on the right.

Is there a way to generalise this into an equation?

sentences:
Writing a custom model file format I am using Ogre for my rendering engine, and I planned on just using the .mesh format that is setup by default with Ogre. However, I recently purchased a large number of 3d assets from a company, only to find out that they use 7 blend weights where as Ogre has a max limit of 4.

I don't know much about modeling and animation (which is why I purchased the art) but just from thinking, it is probably fairly difficult to change something like this in the model without having to reanimate it.

So this led me to think about a custom model format. I know the basics of what is stored, verts/polygons/etc, but I am wondering if this is something I am right in thinking I probably need to do? If so, are there any good resources on developing a custom model format? Tutorials/samples/anything would be great. So far all I have found is http://www.falloutsoftware.com/tutorials/gl/gl6.htm which is helpful but not complete.

sentences:
Unity google play services login dont work properly I have searched everywhere on the internet and I have found nothing about the problem I am encountering.

I am trying to implement google play services to my game (leaderboards especially) and I have made that "work" somehow. Here is the code:

void Start()
{
    PlayGamesPlatform.Activate ();

    Social.localUser.Authenticate((bool success) =>
    {
        if (success)
        {
            Debug.Log("Logging in: Success");
        }
        else
        {
            Debug.Log("Logging in: Failed");
        }
    });
}

The game opens properly and it shows that green window which then disappears and a "loading" icon appears turning in a circle. But after that it disappears too and the window which lists and ask you which account to link with the game does not appear, as it is supposed to do(which "ends" the logging in).

Any help would be much appreciated.

sentences:
How can I move an object in an "infinity" or "figure 8" trajectory? When I want to move object around point I do:

    point.x *= cosf(timer.timeElapsed);
    point.y *= sinf(timer.timeElapsed);

How to make point move on eight or infinity sign trajectory?

sentences:
Unsticking game objects I have used
void OnCollisionEnter(Collision collision) {
    collision.gameObject.transform.parent = gameObject.transform;
}

To stick two players together when they connect.
Basically after they have collided the second game object is still stuck to the original object and i need that not to be the case.
How do i make the game object not stuck when they come apart ?

sentences:
How do I create a camera for a strategy game? How do I make a camera for a strategy game? Think something in the style of Warcraft 3, so you can lower the camera angel and view the world in a somewhat 3D format. Do I need to have some coordinate system where you put every single unit, building, etc., in it and then use an algorithm for the camera to render everything between certain coordinates?

Edit: To clearify the question abit more. How do you render the graphics for a strategy game when the map of the game is bigger then what the players camera view is?

sentences:
Attach a method to every GameObject or use a manager script I'm new to Unity but not new to development so I'm wondering what the standard way of doing this in with Unity.

In the scene from the start is an empty GameObject that has a script that contains all of the items in the game. Once the game starts, chest prefabs are going to be spawned in the game and upon interaction they will reveal some random loot from the items script.

Is it better practice to have a script on all of the chests that accesses the items script or should I create another empty GameObject as a sort of a chest manager that accesses the item script and keeps track of all of the chests in the game and what all of their loot is.

sentences:
Unity3d - c# - changing FPSInputController controls through script For a game I am making I would like the user to be able to change the controls (in game NOT through the clunky launch window (wich i disabled)) I have the system working but don't know how to change the controls for FPS controller. I am okay with writing my own version of the FPSInputController but I don't really know how to do that (the good way (using the CharcaterMotor)) I looked at the original FPSInputController script but that used axes (from the "conventianal" input settings in unity) and I don't really know how to do that with:

if (Input.GetKey(controls.forward))

sentences:
Getting Into Game Development After a bit of research (And a bit of experimenting) I found that coding is quite fun. I've always wanted to try game development, but never really found a place to start. As well as this, this is my first time using Stack Exchange, so if this post is horrendously misplaced, I apologise. I don't want to go into professional game development, as I'm only 13, but I would like to try it. As I said before, I did try some programming (In Java), so I know the very basics of code-Java at least-so this is my question:
How would I go about building a simple platformer? I don't want fancy graphics, or multiple states. All I want to try is the code a simple engine that can use collisions and take keyboard input, and have a single level that can be changed within the code (By that I just mean drawing different sized rectangles). That is it.
How would I go about this, in the simplest way possible? Any help would be appreciated! :D

sentences:
Additive Scene Loading Buttons not Becoming 'Active' I'm quite new to Unity but I'm making a game, and have created a simple Pause menu, when a key is pressed (escape), I just load a Pause scene, additively, and set that Pause scene to the active scene, however, only the buttons on the previous 'game' scene are interactive.
The mouseEnter, exit etc aren't triggering on the pause menu buttons, despite the pause menu being overlayed on top of the 'game' scene; the Pause scene being the active one and the 'game' scene buttons are still the interactive ones (i.e. register clicks, mouse overs etc).
Obviously when I open the pause menu, I want the pause menu buttons to be the interactive ones (registering clicks, mouse over etc), not the previous 'game' scene buttons.
The pause menu scene interacts perfectly when loaded additively with a scene that had no buttons.
Many thanks.

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 to calculate suitable attack speed I'm developing an RPG and am stuck trying to create a formula for attack speed, using four stats and a base speed.

Basically, I'm trying to get an outcome where the encumbrance (basically weight and ease of handling in a single stat) of armor and weapon along with the players´ strength and agility will effect the attack speed.

So - for example: A player with a heavy armor and a 2-handed maul might end up with 0.35 attacks per second, while an unarmored dagger-wielding player should have around 2.5 or even 3 (which would be the maximum speed).

Weapons and armor have an encumbrance stat. Players have agility and strength.

In order to make it more realistic, I'm trying to integrate the following into the formula:

The penalty from the total encumbrance of all items should have a smaller impact on the attack speed than the encumbrance of the weapon
The penalty from the weapon encumbrance should depend on both agility and strength
There should be a maximum attack speed (around 3 attacks per second)
Higher agility should result in higher attack speed
Higher strength should lessen the overall encumbrance penalty

I'm not yet sure if the ranges or min/max stats are needed for the formula, but currently player stats will range between 1-10 and encumbrance (per item) from 1-10 as well.

I've given this a couple of hours of thought but I feel that my math skills might simply not be up to par.

Here's the current state of my attempt (non-functional): https://docs.google.com/spreadsheets/d/1S_NOsJp-FegY7ruR6EZTqWRxuP6gDnZJr9LYw8ETZKQ/edit#gid=0

sentences:
XNA: "TextureCoordinate0" missing, but I'm not using textures I'm trying to create a voxel game using XNA, but I'm getting a somewhat bizarre error when calling DrawIndexedPrimitives():

InvalidOperationException was unhandled
The current vertex declaration does not include all the elements required by the
current vertex shader. TextureCoordinate0 is missing.

Which makes some sense, as it's true my vertex data structure (VertexPositionColorNormal as shown in this Riemers tutorial) does not contain texture data.

However, the effect shouldn't require texture data - I made it a point to set drawingEngine.TextureEnabled = false; in my graphics setup method.  So why is this exception being thrown?  And what can I do about it?

For some context, here's my draw method:

public void Draw(SpriteBatch drawer)
{
    drawingEngine.View = player.createViewMatrix();

    Vector3 direction = player.getDirection();

    for (int x = 0; x < mapSize; x++)
    {
        for (int z = 0; z < mapSize; z++)
        {
            Chunk drawee = map.get(new IntVector3(x, mapCenter, z));
            if (drawee == null)
                continue;
            if(drawee.isTransparent())
                continue;
            #region chunkdrawer

            DynamicVertexBuffer vertexBuffer = drawee.getVertexBuffer();
            int numVertices = drawee.getNumVertices();
            DynamicIndexBuffer indexBuffer = drawee.getIndexBuffer();
            int numIndices = drawee.getNumIndices();

            graphics.SetVertexBuffer(vertexBuffer);
            graphics.Indices = indexBuffer;

            foreach (EffectPass p in drawingEngine.CurrentTechnique.Passes)  //Not sure I entirely understand this
            {
                graphics.DrawIndexedPrimitives(PrimitiveType.TriangleList, 0, 0, numVertices, 0, numIndices / 3);
            }
            #endregion chunkdrawer
        }
    }
    drawer.End();
    drawer.Begin();
}

And here is the graphics setup method:

void graphicsNonsense()
{
    drawingEngine = new BasicEffect(graphics);

    drawingEngine.World = world;
    drawingEngine.Projection = projection;

    drawingEngine.TextureEnabled = false;
    drawingEngine.VertexColorEnabled = true;

    drawingEngine.EnableDefaultLighting();
    drawingEngine.SpecularColor= new Vector3(0, 0, 0);
}

sentences:
Creating a top-down spaceship I'm creating a top-down 2D space game in LIBGDX for android.

When spaceship is going forward it will look like this:

when it goes upward I want to change it's direction with a nice animation so it seems like a real spaceship. A between frame would be like this:

I have rendered the spaceship in different Z axis degrees from ship0 to ship90. Calculating rotation on XY plane wouldn't be so hard, but I don't know how to calculate the rotation on Z axis so I can choose the right sprite to use.

sentences: How to work out given two coordinates should I use a vertical/horizontal/diagonal line to connect them I'm developing an android game and have essentially a grid. The user can drag a line between two points however the line will only ever be vertical, horizontal or diagonal (y=x). So I need to work out given two points which type of line is the best match.

sentences:
In a collision detection loop, when do I apply the velocity? I'm writing a really basic collision detection system (AABB vs AABB, AABB vs Circle, Circle vs Circle), and I've just got to the point of writing the actual loop which iterates the objects and checks for collisions.

My question is when do I apply the velocity to each object? Do I move all objects by vel * dt before I even start colliding? Do I apply the velocity as I iterate? If so, do I apply it to both objects I'm testing, or just the first, and then apply the velocity to the second when I check collisions against that one?

Also presumably I should do the whole collision check recursively (as the act of responding to one collision might cause another), but that obviously effects how and when the velocity is applied.

My suspicion is that I should move all the objects by their velocity before I begin, and then recursively detect and respond to collisions until nothing is colliding (or until some loop limit).

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:
How do I structure AI that uses both Behavior Trees and Pathfinding? Architecturally, what are the best practices for how these two concepts interact with each other?

For instance, say I have an asteroids like game where the AI player must dodge floating asteroids while at the same time collecting powerups. If we want him to perform well we can't just have two separate behaviors for dodge and collect, he should consider everything on the screen.

Should the behaviors in the tree modify the weights of the pathfinding graph nodes (assuming using a graph based approach here)? Is A* like path finding even the best approach for this scenario?

sentences:
switching scenes in libgdx? I'm writing a little something in libgdx to learn more about the platform. Currently, I have a simple generated world consists of tiles, which are just blocks of texture drawn to the screen. It's a simple setup, but I'm wondering how would I go about switching to a different "scene". For instance, just imagine a player, walking around in a grass field, enters a cave, and bam, he is in the cave. The world behind him has transitioned from a grass field to a cave (essentially, from one generated world to another).

I'm not very sure how libgdx handles scenes, so if anyone can share some tips, I'd appreciate it.

NOTE: I know this is a very broad question; right now I'm not asking for a specific solution but rather some tips to help me approach the idea I'm going after.

sentences:
Unity inconsistent memory profiling when running same scene I'm in the making of a 2D silhouette style game where I'm trying basically 2 setups:

One where it consists only of sprites,
One where it consists of a mix of sprites and meshes with NO texture.

Now, I'm experimenting with the two as I wish to want the scenes to take up the least memory.

I have these weird outcomes:

SPRITE SETUP:

Total 280 MB, Textures 155.5 MB, Meshes 1.7 MB
Total 249 MB, Textures 151 MB, Meshes 4.1 MB
Total 279 MB, Textures 151.0 MB, Meshes 10.8 MB

SPRITE & MESH SETUP:

Total 334.4 MB, Textures 188.2 MB, Meshes 1.8 MB
Total 241 MB, Textures 148,0 MB, Meshes 2,3 MB
Total 253.1 MB, Textures 157.7 MB, Meshes 4.2 MB
Total 301.8 MB, Textures 157.7 MB, Meshes 8.4 MB
Total 234.8 MB, Textures 145.3 MB, Meshes 1.9 MB

Now, I find these result strange because:

It was checked on the exact same scene (the mesh setup had same amount of objects, just swapped the sprites for meshes) and the data is inconsistent, meaning there is about 100MB difference between the same mesh scene
A scene of mostly mesh with zero textures uses more, or at least not less, textures than a sprite only scene??

By taking a look at the data above, I would require someone skilled to guide me through this. Shall I keep using those meshes or just go for sprites? What is really goind on here with this data?

sentences:
Component based game engine and dependencies - singletons I am thinking about how to create component based game engine.
I understand that all things should be very similar as in Data Oriented Design (each object is a collection of various structures as Position, 3D Model, Health, Damage etc.), but I don't understand how should I handle the very big project.

I made one game in XNA a while ago and when I tried to create such component based game engine - I ended up having many singletons. Many systems depend on each other and I had to use for example Terrain subsystem to handle AI - so I had to make singletons.

How should I organise the game engine so that I wouldn't have singletons? Is it even possible when I have many dependencies?

Also when I created many Entities I found the problem or repetition of code. If I want to for example make AI for few kinds of enemies - some code can be the same for various enemies (Initializing AI, beginning of AIUpdate function) - it appears that inheritance would be best for such case, but then it isn't component based architecture (or Data Oriented Design) anymore...

sentences:
Nice function for "rolling score up"? I'm adding to the player's score, and I'm using a per-frame formula like:

int score, displayedScore ;// score is ACTUAL score player has,
// displayedScore is what is shown this frame to the player
// (the creeping/"rolling" number)

float disparity = score - displayedScore ;
int d = disparity * .1f ; // add 1/10 of the difference,
if( !d )  d = signum( disparity ) ; // last 10 go by 1's
score += d ;

Where

inline int signum( float val ){
  if( val > 0 )  return 1 ;
  else if( val < 0 )  return -1 ;
  else return 0 ;
}

So, it kind of works where it makes big changes rapidly, then it creeps in the last few one at a time.

But I'm looking for better (or possibly well known?) score-creeping functions.  Any one?

sentences:
Fastest way to group units that can see each other? In the 2D game I'm working with, the game engine is able to give me, for each unit, the list of other units that are in its view range.

I would like to know if there is an established algorithm to sort the units in groups, where each group would be defined by all those units which are "connected" to each other (even through others).

An example might help understand the question better (E=enemy, O=own unit). First the data that I would get from the game engine:

E1 can see E2, E3, O5
E2 can see E1
E3 can see E1
E4 can see O5
E5 can see O2
E6 can see E7, O9, O1
E7 can see E6
O1 can see E6
O2 can see O5, E5
O5 can see E1, E4, O2
O9 can see E6

Then I should compute the groups as follow:

G1 = E1, E2, E3, E4, E5, O2, O5
G2 = O1, O9, E6, E7

It can be safely assumed that there is a commutative property for the field of view: [if A sees B, then B sees A].

Just to clarify: I already wrote a naïve implementation that loops on each row of the game engine info, but from the look of it, it seems a problem general enough for it to have been studied in depth and have various established algorithms (maybe passing through some tree-like structure?).  My problem is that I couldn't find a way to describe my problem that returned useful google hits.

Thank you in advance for your help!

sentences:
Calculating vertex normals in OpenGL C++ Does anyone knows a simple solution for calculating vertex normals? I've been looking for this on the internet but i cant find a simple solution, for example, if I have some vertices like this:

GLfloat vertices[] =
{
 0.5f,  0.5f, 0.0f,  // Top Right
 0.5f, -0.5f, 0.0f,  // Bottom Right
-0.5f, -0.5f, 0.0f,  // Bottom Left
-0.5f,  0.5f, 0.0f   // Top Left
};

sentences:
Why the Vector3.Dot value is -12 when running the game? using System.Collections;
using System.Collections.Generic;
using UnityEngine;
using UnityEngine.UI;
using UnityEngine.Events;
using System;

public class InteractableItem : MonoBehaviour
{
    public string currentMode;

    private Transform player;
    private InteractableMode currentInteractableMode;
    private string currentDesription;
    private float originDistance;

    private void Awake()
    {
        player = GameObject.Find("Player").transform;

        originDistance = transform.GetComponent<InteractableItem>().distance;
    }

    public enum InteractableMode
    {
        Description,
        Action,
        ActionWithoutThrow
    };

    public enum ViewMode
    {
        FrontView,
        AllView
    };

    public ViewMode viewMode = ViewMode.AllView;

    public InteractableMode interactableMode = InteractableMode.Description;
    public float distance;

    [TextArea(1, 10)]
    public string description = "";

    public bool IsAnyAction()
    {
        return interactableMode == InteractableMode.ActionWithoutThrow || interactableMode == InteractableMode.Action;
    }

    public bool IsActionWithoutThrow()
    {
        return interactableMode == InteractableMode.ActionWithoutThrow;
    }

    private void Start()
    {
        currentMode = GetComponent<InteractableItem>().interactableMode.ToString();
        currentInteractableMode = GetComponent<InteractableItem>().interactableMode;
        currentDesription = GetComponent<InteractableItem>().description;

    }

    private void Update()
    {
        var heading = transform.position - player.transform.position;
        var dot = Vector3.Dot(heading, -transform.forward);

        if(viewMode == ViewMode.FrontView
            && dot < 1)
        {
            transform.GetComponent<InteractableItem>().distance = 0;
        }

        if (viewMode == ViewMode.FrontView
            && dot > 1)
        {
            transform.GetComponent<InteractableItem>().distance = originDistance;
        }
    }
}

The script is attached to some objects and one of them the ViewMode is set to FrontView and then when running the game first time the dot value is -12 and then it's getting inside and going the line :
if(viewMode == ViewMode.FrontView
    && dot < 1)
{
    transform.GetComponent<InteractableItem>().distance = 0;
}

but it should not set the distance to 0.  only if I'm getting close enough to the item then it should see the item from the front and then only if I'm moving the player behind the item the dot should be minus and set the distance to 0 but for some reason the dot is minus 12 when running the game so it's setting the distance to 0 right away.

sentences:
Rigidbody player controller on moving platforms So basically, I was trying to make moving platforms. When I finished my prototype, I noticed that the movement on the platform is very wobbly:
https://www.youtube.com/watch?v=hmBumsrlHGA&feature=emb_logo
To snap the player onto the platform, I am just making it a child of the platform. Anyway, I don't know what is causing this issue and was wondering if I can get any help. Thank you in advance
Here, the controller code:
private void Movement()
    {
        //Extra gravity
        rb.AddForce(Vector3.down * Time.deltaTime * 10);

        //Find actual velocity relative to where player is looking
        Vector2 mag = FindVelRelativeToLook();
        float xMag = mag.x, yMag = mag.y;

        //Counteract sliding and sloppy movement
        CounterMovement(x, y, mag);

        //If holding jump && ready to jump, then jump
        if (readyToJump && jumping) Jump();

        //Set max speed
        float maxSpeed = this.maxSpeed;
        if (sprinting)
        {
            this.maxSpeed = 25;
        }
        else
        {
            this.maxSpeed = 15;
        }

        if(sprinting && y < 0)
        {
            this.maxSpeed = 15;
        }

        //If sliding down a ramp, add force down so player stays grounded and also builds speed
        if (crouching && grounded && readyToJump)
        {
            rb.AddForce(Vector3.down * Time.deltaTime * 3000);
            return;
        }

        //If speed is larger than maxspeed, cancel out the input so you don't go over max speed
        if (x > 0 && xMag > maxSpeed) x = 0;
        if (x < 0 && xMag < -maxSpeed) x = 0;
        if (y > 0 && yMag > maxSpeed) y = 0;
        if (y < 0 && yMag < -maxSpeed) y = 0;

        //Some multipliers
        float multiplier = 1f, multiplierV = 1f;

        // Movement in air
        if (!grounded)
        {
            multiplier = 0.5f;
            multiplierV = 0.5f;
        }

        // Movement while sliding
        //if (grounded && crouching) { multiplierV = 0.5f; multiplier = 0.5f; }

        //Apply forces to move player
        rb.AddForce(orientation.transform.forward * y * moveSpeed * Time.deltaTime * multiplier * multiplierV);
        rb.AddForce(orientation.transform.right * x * moveSpeed * Time.deltaTime * multiplier);
    }

sentences:
Legal issues around using real players names and team emblems in an open source game I'm writing a sports management simulation game. Like most sport management games, it makes heavy use of statistics. I would like to use real players, teams and league names.

i) Am I running the risk of getting into legal battles if I should use the real names?
ii) Also what about team colours and emblems etc?

Update
Much thanks for all the input!

sentences:
How should I move 2D objects in OpenGL ES 2? I am a bit confused about what I need to move a basic square. Should I use a translation matrix or just change the object vertices? Which one is better?

I use a simple vertex shader, gl_Position = myPMVMatrix * a_vertex, along with a VBO.

sentences:
How do i create a random planet generator and use it on Unity? For example : https://managore.itch.io/planetarium

Something like this, create random sprite circles who at least are realistic looking, as far as realism can be pixel, I don't think this can be done on Unity alone so i think i might need to implement it after i coded it in another language or another engine, so my how do i do it? can i do it on unity? and how would i implement if i decided that unity isn't fit for this thing?

The usage of the planets will be throughout the game and will be used as the main planet so it is of great value to the game

sentences:
Map Engine Rendering Broken So I've been making my own tile map engine in LibGDX as the one currently implemented doesn't support collision detection with scaling. So I've come up with my own Layer and Map class and a drawing function for the map. Currently this is what it produces:

Here's the rendering code:

public void draw(SpriteBatch batch) {
    for(Layer layer : layers) {
        for(int x = 0; x < layer.getTileMap().length; x++) {
            for(int y = 0; y < layer.getTileMap()[x].length; y++) {
                batch.draw(layer.getTiles()[layer.getTileMap()[x][y]],
                        xOffset + (x * ((layer.getTileWidth() * scale))), yOffset + (y * ((layer.getTileHeight() * scale))),
                        (layer.getTileWidth() * scale), (layer.getTileHeight() * scale));
            }
        }
    }
}

EDIT: Yes, I'm aware the map looks weird, it's just random textures thrown in from a tile-sheet.

sentences:
XNA 4.0 - Strange edges with multilight shader I am generating a light, a depth and a normalmap to calculate the lightning at each pixel with multiple lights.

On both rendertargets, i set the preferredMultiSampleCount parameter to 16 samples because I want smooth edges.
It seems to work well on the first picture (normalmap).
In the second picture (lightmap), multisampling works great, too.
But somehow there are flickering edges at the end of each model.

I think it may have to do something with the depthmap because due to using Surfaceformat.Single I have to use

minfilter = point;
magfilter = point;
mipfilter = point;

for the Texture filter and I think AA doesnt work with filter type point.

Is this a known newbie problem or should I upload the source of my shader files for a better understanding of my problem?

EDIT:
If I turn multisampling off, I dont get these edges:

(Take a look at the bottom of the square in the middle.. )

sentences:
Random Y Axis Movement Within Set Limits (C#) I've searched everywhere for this answer but everything I find is in Javascript and a lot of it doesn't help/work in my situation since most of it is Vector3's and using each axis, and my game is 2D.

So I have these prefabs that get spawned off-screen and then I have a script attached to them that tells them to move left on the x axis. I need them to also pick a random direction (up or down) on the y axis, and travel that way until they get to a certain spot (range) and then to switch directions and go the opposite etc.

Here is what I have tried most recently:

public float itemUp = 0.1f;
public float itemMove = 0.7f;

public float x;
float y;
float z;
Vector3 pos;

void Update () {

    //transform.position = Vector2(Random.Range (1,4),Random.Range (1,4),10);

    transform.position -= Vector3.right * itemMove * Time.deltaTime;

    x = 0;
    y = Random.Range(-100, 100);
    z = 0;
    pos = new Vector3(-x, y, z);
    transform.position = pos * itemUp * Time.deltaTime;
}

Anyone know what I'm missing/not doing correctly? I'd really appreciate any help you can give, thank you.

sentences:
Are there copyrights for board game Risk and can I make the game, or similar, for mobile? are there copyrights for board game Risk? It's popular and with lots of versions floating around, so I don't know if someone has rights or just for specific version. I'm not planning to make money with it, it would be a free game. If not, can I make something similar to that, and how much do I need to change it? I like the game a lot, it's for fun and learning purpose.
Thx in advance :)

sentences:
Navmesh awkward path generation with string pulling due to "inner" vertices I've identified a problem and a possible solution related to navmesh-based pathfinding. Before diving in, I'll preface my post with some questions to keep in mind as you read:

Is this a known problem that people have solved before?
Is there a term for the problem that could help me search for information related to it?
Is the solution I came up with an existing idea? If so is there a name for the algorithm or some other search term I could use to find more information?
Is there a better solution? If so, please point me to it.

For reference, I'm using images from http://jceipek.com/Olin-Coding-Tutorials/pathing.html#navigation-meshes and generally following the advice laid out there.

tl;dr of that blog post is

  Decompose your walkable area into a navmesh, treating convex polygons as nodes and their borders as edges so that you can perform an A* search to get from point A to point B. To translate from "node ids" back to real points, use string-pulling.

Here's a copy of the example space:

And an example generated path after performing string pulling:

So far so good.

But I realized this approach generates an awkward path in a situation like this:

In this situation, a trio of nodes are all adjacent to each other, and so the A* will generally choose a path directly from the starting node to the ending node, despite an intuitive understanding that the agent can move in a straight line from A to B which travels through a different polygon.

I've been working on a solution to this problem and so far my best idea is to apply a transformation to the nav mesh. My description of this will be a little hazy as I'm making up terminology to describe the approach...

Define a shared edge as a line segment that is shared by two convex polygons in the navmesh. Maybe a.k.a. a "portal" for string-pulling purposes.
Define an inner vertex as a vertex in the navmesh for which all attached line segments are "shared edges". The vertex in the center of the three polygons in the image above is an inner vertex.
Identify an inner vertex. Follow its attached shared edges to what I'll call neighbor vertex. (possible improvement; If the neighbor vertex is also an inner vertex, recurse to its neighbors until all of the neighbors are non-inner.)
Remove all shared edges from the navmesh that were traversed in the previous step, forming a new polygon whose border is defined by the neighbor vertices in the previous step. Redefine the edges accordingly (I'll hand-wave that)
Repeat until no inner vertices remain.

The result of this on the example above should result in this:

And with the same A-B path from before, the string-pulling should now result in a straight line:

I believe that as long as the navmesh has no inner vertices, all paths generated with the approach described in the linked blog post should seem "natural" and not have any surprise corners in what seems like open space.

Per my questions at the beginning of this post, I'm looking for more information, e.g. has anybody else solved this problem before, is there a better way to do it, and is there even a name/term for this problem?

sentences:
Using the MVC pattern in games I saw a lot oft tutorials about the mvc pattern, but always it was only a small example/Situation explained.
There was always only one model, one controller and one view.
But what if I have a lot oft models with complex logic, I cant put all the rendering code in one view and all the logic code in one controller.
How I split all in smaller pieces, because the models logic depends in each other(for example collision).
Know someone a good tutorial, or example game that explains this pattern in advanced games?

sentences:
the object of type 'GameObject' has been destroyed but you are still trying to acess it the object of type 'GameObject' has been destroyed but you are still trying to access it .your script should either check if it is null or you should not destroy the object

my script is in c#

    w = brick[0].GetComponent<SpriteRenderer>().bounds.size.x;
    h = brick[0].GetComponent<SpriteRenderer>().bounds.size.y;
    x = brick[0].transform.position.x - w/2;
    y = brick[0].transform.position.y - h/2;
    xp = ball.transform.position.x;
    yp = ball.transform.position.y;
    if (ptobcollision(x,y, w, h, xp, yp)) {
        ball.GetComponent<Ball>().YDirection = 1;
        //Debug.LogError("now Error");
        Destroy(brick[0]);
    }

sentences:
Loading settings files better? I have recently been working on a small game project and decided to implement settings loading at game startup. The problem is that my method seems to be too hard coded and not scalable without having a huge method:

public String loadSettings(String path) {
    String[] file = loadFileAsString(path);

    isFullscreen = Boolean.parseBoolean(file[0]);
    windowWidth = Integer.parseInt(file[1]);
    windowHeight = Integer.parseInt(file[2]);
    ...
}

As you can see, this method will get very large after a while and is at risk of crashing if someone edits the file incorrectly so what is a better way of loading this data?

sentences:
Apply portion of texture atlas I'm trying to write a shader that only maps a portion of a large texture to my sprite and I'm getting a strange behaviour with my current code.
This is what I have right now:

Texture atlas example (256x256px):

EDIT
I've changed both shaders and I get the following output right now (first image), but I need to zoom the texture so I only render the highlighted portion of the second image, how should I modify the shaders to achieve that?
 ->

These are my current shaders:
Vertex:

uniform mat4 uMVPMatrix;
attribute vec4 aPosition;
attribute vec2 aTextureCoord;
varying vec2 vTextureCoord;
varying vec2 vTextureCoordOffset;
void main() {
    // offset and texSize will be defined as attributes later.
    // They're defined here for test purposes only
    vec2 offset = vec2(128.0, 64.0);
    vec2 texSize = vec2(256.0, 256.0);

    float u = offset.x / texSize.x;
    float v = offset.y / texSize.y;
    vTextureCoordOffset = vec2(u, v);
    vTextureCoord = aTextureCoord;
    gl_Position = uMVPMatrix * aPosition;
}

Fragment:

precision mediump float;
uniform sampler2D sTexture;
varying vec2 vTextureCoord;
varying vec2 vTextureCoordOffset;
void main() {
    gl_FragColor = texture2D(sTexture, fract(vTextureCoord) + vTextureCoordOffset);
}

SOLVED
I solved it changing the fragment shader to:

gl_FragColor = texture2D(sTexture, fract(vTextureCoord) * vZoom + vTextureCoordOffset);

vZoom is calculated in the vertex shader:

vZoom = subTextureSize / texSize;

sentences:
Second pass in multipass effect is ignored I am trying to render my vertecies in 2 passes, but it seems I am doing something wrong, because only one pass applying. I cannot make the second one work despite that second pass is applying.

Here is my code:

var effectByteCode =            ShaderBytecode.CompileFromFile(@"Content\Effects\SpriteBatchEffect.fx", "fx_5_0");
spriteBatchEffect = new Effect(this.graphicsDevice, effectByteCode);
pass = spriteBatchEffect.GetTechniqueByName("SpriteBatch").GetPassByIndex(0);
//Layout from VertexShader input signature
var passSignature = pass.Description.Signature;
layout = new InputLayout(graphicsDevice, passSignature, inputElements);

Effect code:

    Texture2D Texture;
    SamplerState TextureSampler;

matrix OrthoMatrix;

struct VertexInputType
{
   float4 position : SV_POSITION;
   float4 color: COLOR;
   float2 tex : TEXCOORD0;
};

struct PixelInputType
{
   float4 position : SV_POSITION;
   float4 color: COLOR;
   float2 tex : TEXCOORD0;
};

PixelInputType SpriteVertexShader(VertexInputType input)
{
   PixelInputType output;
   output.color = float4(0, 0, 0, 0);
   output.position = float4(0, 0, 0, 0);

   // Change the position vector to be 4 units for proper matrix calculations.
   input.position.w = 1.0f;

   output.position = mul(input.position, OrthoMatrix);

   // Store the texture coordinates for the pixel shader.
   output.tex = input.tex;
   output.color = input.color;
   return output;
}

float4 SpritePixelShader(PixelInputType input) : SV_TARGET
{
   return Texture.Sample(TextureSampler, input.tex)* input.color;

}

float4 SpritePixelShader2(PixelInputType input) : SV_TARGET
{
   /*return Texture.Sample(TextureSampler, input.tex)+ input.color;*/
   return float4(1,0,0,0);
}

technique10 SpriteBatch
{
   pass P0
   {
      SetGeometryShader(0);
      SetVertexShader(CompileShader(vs_4_0, SpriteVertexShader()));
      SetPixelShader(CompileShader(ps_4_0, SpritePixelShader()));
   }

   pass P1
   {
      SetGeometryShader(0);
      SetVertexShader(CompileShader(vs_4_0, SpriteVertexShader()));
      SetPixelShader(CompileShader(ps_4_0, SpritePixelShader2()));
   }
}

And how I am using it:

graphicsDevice.SetVertexBuffers(0, vertexBufferBinding);

     var technique = tempEffect.GetTechniqueByName("SpriteBatch");
     for (int i = 0; i < technique.Description.PassCount; i++)
     {
        var localpass = technique.GetPassByIndex(i);
        //if (localpass.IsValid)
        {
           localpass.Apply(graphicsDevice);
           graphicsDevice.DrawIndexed(indexCount, 0, 0);
        }
     }

Could someone point me why second pass is not apply? What I am missing here?
Note that I am not using SharpdDX toolkit - just plain SharpDX + C#

sentences:
Matrix multiplication - Scene Graphs I wrote a MatrixStack class in C# to use in a SceneGraph. So, to get the world matrix for an object I am suposed to use:

WorldMatrix = ParentWorld * LocalTransform

But, in fact, it only works as expected when I do the other way:

WorldMatrix = LocalTransform * ParentWorld

Mi code is:

public class MatrixStack
{
    Stack<Matrix> stack = new Stack<Matrix>();
    Matrix result = Matrix.Identity;

    public void PushMatrix(Matrix matrix)
    {
        stack.Push(matrix);
        result = matrix * result;
    }

    public Matrix PopMatrix()
    {
        result = Matrix.Invert(stack.Peek()) * result;
        return stack.Pop();
    }

    public Matrix Result
    {
        get { return result; }
    }

    public void Clear()
    {
        stack.Clear();
        result = Matrix.Identity;
    }
}

Why it works this way and not the other? Thanks!

sentences: Tiled map editor and objects Ive been searching for an easy way to group multiple sprites of a spritesheet into a single entity. Im using tiled editor as written at the title. Some objects might be larger than the tile size and i need a way to let my game know that in order to manipulate these objects. I dont want to create new tilesets with different sizes for all objects. Is this possible in this app and if not do you know another that can handle this?

sentences:
Smooth movement in point-to-move 2d game based on velocity I have a real-time point-to-move 2D game with one playable character to control.
I want to create smooth player movement using physics and appropriate velocity.
Basic setup:

The player has a maximum speed
The player has appropriate acceleration and deceleration parameters

How I achieving the required behavior right now:
// float currentVelocity = 0
// const float acceleratePerSecond = 35
// const float deceleratePerSecond = 35

// ...

Vector2 positionToMoveTo = pointToMove.position;
Vector2 playerPosition = playerRigidbody.position;
Vector2 point = positionToMoveTo - playerPosition;

if (point.magnitude > 1) // If player is far enough
{
    if (point.magnitude >= currentVelocity) // Hack for smooth slow down
    {
        currentVelocity += acceleratePerSecond * Time.fixedDeltaTime; // Accelerate a little
    }
    else
    {
        currentVelocity -= deceleratePerSecond * Time.fixedDeltaTime; // Decelerate a little
    }
}
else // If player is close enough - stop movement
{
    currentVelocity = 0;
    pointToMove.isActive = false;
}

currentVelocity = Mathf.Clamp(currentVelocity, 0, playerService.MaxSpeed); // Clamping to fix max speed
playerRigidbody.velocity = currentVelocity * point.normalized;

This code is working but it is really hacked on the second if statement. Closer to end point player starts shaking, when the current velocity increasing in the first frame and decreasing in the next frame many times.
So the question is: How can I achieve the required smooth point-to-move movement using velocity vector?
Why I need to use velocity and can't use plain MovePosition of Rigidbody2D?
That's because I rotate a player based on that velocity. It is bad to rotate a player based on pointToMove position because the real front of the player is the current velocity vector.
Some test briefs:

If object is far enough:

   acceleration        max speed        deceleration
|-----------------o-----------------o-----------------|
                 _____________________
        ________/                     \________
 ______/                                       \_______
/                                                      \

If object is closer:

    acceleration      deceleration
|-----------------o-----------------|
               ______
        ______/      \_______
 ______/                     \______
/                                   \

Appreciate any help. Thank you.

sentences: In which software do the professional game developers create 3D Model? I am just thinking about beginning game development in xna c#. However, I don't know (and no tutorial teaches) how do professional game developers create a 3D Model/Scene. How can we create a realistic looking model and what is the hardware configuration needed in machine for using such a software?

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: Support function of Minkowski Difference I am watching this and if you stop at 7:25, you will find an implementation of the support function. The goal of the function is to give you the farthest point in a given direction. My question is how do we achieve this without looking at all the points in the Minkowski Difference? How is this not an O(m*n) algorithm ? Is there a way to get just the points that lie on the edges (I am asking because in the slide after that he just shows the edge points and not all the internal ones)? Am I missing something ?

sentences:
Unity 3d Animation Flickering We are using 3d bus model for our game in Unity 3d.Animation works perfectly fine on Samsung s3 but some kind of texture flickering occurs on Nexus device.Please help us out how to solve this problem.

Thank you

sentences:
Hide "No custom tool available" window I have this annoying window in the bottom right of the scene view.  From the manual, it seems like I opened it by clicking on the wrench & scribe button next to the movement buttons.

How do I make it do away now?

Restarting doesn't make a difference, neither does creating a brand new project.

The documentation say this appears it I've clicked on the tools icon and there aren't any custom tools (which I'm sure I have done).  Surely is should vanish after a while though.

sentences:
Free camera navigation and pre-defined locations I have an interactive scenery app written in Unity, where users can freely navigate the camera through the scene. What I want to do now, is to let user automatically fly to some "hotspots" with a single key stroke, while still allowing the users to navigate manually.
I tried Animation, but with it, auto-fly and manual navigation are mutually exclusive - I have to disable one in order for the other to work.
Right now, I'm attempting the fall-back solution, where I create some empty game objects with special scripts attached, so that when public script functions are invoked, the game object animates the camera to a pre-defined transformation.
My question being: is there a better solution than my fall-back?

sentences:
GLFW Problem "The driver does not appear to support OpenGL" I am trying to learn OpenGL & GLFW , when I run this simple project
I get error ID : "65542" with the message "The driver does not appear to support OpenGL".
My graphics card is an old & cheap Intel 64MB

sentences:
Is there a expected set of button mappings games commonly use? I am making a game that will support a XBox 360 controller but I would like to try and keep the default button mappings to be what is expected from a user's past history from playing other games. Is there a set of guidelines from Microsoft on what should map to what (do you use A for fire or left trigger?), or has the gaming community picked up a common set of controls that is just not written anywhere, everyone just "knows" it (like WASD for movement).

The hardest thing for me is I have walking movement, vehicle movement, and airplane movement. I plan on allowing custom configuration of each, but I don't know what to set as the defaults.

sentences:
"Highlighting" Faces/Edges/Corners How would I "highlight" faces/edges/corners?
I would prefer an explanation OpenGL if possible.

Here's an example:

sentences:
Cocos2d-x: Differences between applying shader to child node and entire scene? I'm beginning with shader.
I wonder what if i apply shader for single node, what'll happen?

The gl_FragCoord = (0.5,0.5) is the bottom left of the screen or the bottom left of the node?

I get some wrong caculations while wanting to draw something in the center of the node (not the screen).

Many shader tutorias with sample code to draw at center using gl_FragCoord.xy / resolution.xy, if it's 0.5, it's center. In this case, it might be wrong because i want to draw in center of the node.

Finally, how's about texture2D i use texture2D instead of texture, are they the same?

I've applied this code on the node and it prints out the whole screen with stretch version (resolution = device resolution)

vec2 xy = gl_FragCoord.xy / resolution.xy;
vec4 texColor = texture2D(CC_Texture0,xy);
gl_FragColor = texColor;

sentences:
Drawing a circle in OpenGL ES Android, squiggly boundaries I am new to OpenGL ES and facing a hard time drawing a circle on my GLSurfaceView.  Here's what I have so far.

The circle class

public class MyGLBall {

private int points=40;
private float vertices[]={0.0f,0.0f,0.0f};
private FloatBuffer vertBuff;

//centre of circle

public MyGLBall(){

    vertices=new float[(points+1)*3];
    for(int i=3;i<(points+1)*3;i+=3){
      double rad=(i*360/points*3)*(3.14/180);
      vertices[i]=(float)Math.cos(rad);
      vertices[i+1]=(float) Math.sin(rad);
      vertices[i+2]=0;
    }
      ByteBuffer bBuff=ByteBuffer.allocateDirect(vertices.length*4);
      bBuff.order(ByteOrder.nativeOrder());
      vertBuff=bBuff.asFloatBuffer();
      vertBuff.put(vertices);
      vertBuff.position(0);

}

public void draw(GL10 gl){
    gl.glPushMatrix();
    gl.glTranslatef(0, 0, 0);
//  gl.glScalef(size, size, 1.0f);
    gl.glColor4f(1.0f,1.0f,1.0f, 1.0f);
    gl.glVertexPointer(3, GL10.GL_FLOAT, 0, vertBuff);
    gl.glEnableClientState(GL10.GL_VERTEX_ARRAY);
    gl.glDrawArrays(GL10.GL_TRIANGLE_FAN, 0, points/2);
    gl.glDisableClientState(GL10.GL_VERTEX_ARRAY);
    gl.glPopMatrix();
 }

 }

I couldn't retrieve the screenshot of my image but here's what it looks like

As you can see the border has crests and troughs thereby rendering it squiggly, which I do not want. All I want is a simple curve.

sentences:
Character on platform move slowly I'm having a problem similar to this link: http://answers.unity3d.com/questions/1295955/character-on-a-moving-platform-slows-down.html

But...

My 2D character is on an elevator (which does not have any physics) and is being moved up and down through an animation (transform). But when my character is on the elevator, the colliders2D overlaps another, as my character's RigidBody2D stands still as I move the game object elevator (crossing each other).
My solution was to try to attach my character as the child of the elevator (SetParent), and this solved the problem of overcoming the colliders, but it gave me a new problem.

The new problem consists of a certain slowness in the movement of the character while it is on the elevator. I believe the problem is because the transform of my character is in motion while the elevator goes up and my rigidbody don't add any force.

Do I need move the elevator with physics to stay movent? Or am I thinking the wrong way?"
How to solve this problem?
See the player movement script:

 using UnityEngine;
 using System.Collections;

 public class Move : MonoBehaviour {

     public float speed;
     public float jump;
     public GameObject rayOrigin;
     public float rayCheckDistance;
     Rigidbody2D rb;

     void Start () {
         rb = GetComponent <Rigidbody2D> ();
     }

     void FixedUpdate () {
         float x = Input.GetAxis ("Horizontal");
         if (Input.GetAxis ("Jump") > 0) {
             RaycastHit2D hit = Physics2D.Raycast(rayOrigin.transform.position, Vector2.down, rayCheckDistance);
             if (hit.collider != null) {
                 rb.AddForce (Vector2.up * jump, ForceMode2D.Impulse);
             }
         }
         rb.velocity = new Vector3 (x * speed, rb.velocity.y, 0);

     }
 }

sentences:
Unity3D: How to play 360 video without VR mode? i followed the official Unity tutorial to make an inverted sphere and play a 360 video inside it and i managed to do it but the problem is i can't build the project to my phone because it says i have to turn on virtual reality support from player settings but the thing is i don't want to because when i do that it also turns on VR mode(that split screen view).

what i want is to play a normal 360 video(full screen) and navigate using the gyro of phone just like Youtube. Youtube provides a button to toggle between headset and non-headset mode.

sentences:
Why would an ambient occlusion (AO) shader's performance be dependent on light direction? One of my favourite games recently implemented ambient occlusion as a graphics feature, which appears to perform very well in most circumstances - except during sunrise and sunset. As someone who is getting into shader programming, I'm intrigued by this.

My understanding of AO is that you precompute the diffuse shading for a range of incident vectors, then use that information to produce a correct shadowing scale for real-time use by enumerating over all the lights and computing how their position in relation to the object compares to each of the incident vectors, essentially interpolating across the closest values. Since the occlusion is pre-computed against a model, taking complex shapes and self-occlusion into account, you don't need to raytrace and the performance is much better.

So here's where I get lost - since the diffuse map is precomputed, and you're just comparing light positions to those maps for all objects within the screen space, why would performance suffer for cases where the ambient light (the sun) is close to the horizon? It seems like this shouldn't matter - surely the performance of such a shader scales against vertices, not the angle of the light?

The game uses the latest version of Unity (they just bumped up a minor release) but I don't know if they use the built-in Unity SSAO shader. Performance hit is major - 28fps at 1440p during "day" hours, dropping to 12-14fps during sunrise/set. This only occurs when AO is enabled.

I'm not interested in finding a solution - I'm sure they'll fix it sooner or later - I'd just like to get a better idea of how AO performance scales, what its pain-points are, and why this kind of behaviour might appear.

sentences:
Find out what word you are hovering mouse over I want to be able to pop up something when the user hovers over particular words that are on a label in pygame.

Can anyone give me a good (or even bad) idea on how to implement this (doesn't have to be pygame specific)? Do I have to put each word in a different label and place them one after the other?

(what I'm calling a label is the result of font.render)

sentences:
Box Collider center relative to GameObject I'm trying to get the distance from the BoxCollider center of a gameobject to the bottom of that same BoxCollider. Note that the center of the collider is slighty modified.

So far, I have:

float halfHeightCollider = (bounds.size.y / 2);

I tried the following to take care of the slight modification:

float halfHeightCollider = bounds.center.y + (bounds.size.y / 2);

But seems like bounds.center give me the position of the center of the BoxCollider in the world, not relative to the gameobject, like in the inspector:

That value is the one I want. How can I get it?

sentences:
rendering a reflection on a texture I want to render reflection on a planar surface but the reflecting surface has a texture mapped onto it.Would the normal technique of using stencil buffer and then blending in the reflected image with the reflecting surface in this case?
If not then could some one suggest me how to render reflection on a surface that has a texture mapped onto it?
Thanks

sentences:
Particle friction with variable timestep in XNA Alright, so I'm working on an engine of sorts in XNA (yes, it's deprecated, I know) and I'm implementing my own particle system. I've defined a "ParticleEffect" such that when it's supplied a GameTime and an IEnumerable<T:IParticle>, it applies an "effect" to every particle in that collection.

For example, my Friction effect:

public sealed class Particle2D_Friction : ParticleEffectBase<Particle2D>
{
    public float Magnitude { get; set; }
    public float StopThreshold { get; set; }

    public override void Apply(GameTime time, IEnumerable<Particle2D> particles)
    {
        if (Enabled)
        {
            if (particles != null)
            {
                float delta = time.GetDelta();
                float magnitude = MathHelper.Clamp(Magnitude, 0.00f, 1.00f);
                Vector2 result = Vector2.Zero;

                foreach (var particle in particles)
                    if (particle != null && particle.Alive)
                    {
                        result = particle.Velocity - (delta * (1.00f - magnitude) * particle.Velocity);
                        if (Math.Abs(result.X) <= StopThreshold) result.X = 0.00f;
                        if (Math.Abs(result.Y) <= StopThreshold) result.Y = 0.00f;
                        particle.Velocity = result;
                    }
            }
        }
    }
}

Unfortunately, it isn't behaving quite as well as I'd like it to, and I know the issue is linked to the delta time. I should mention that time.GetDelta() is an extension method that returns (float)time.ElapsedGameTime.TotalSeconds; as a shortcut.

Anyways, when I remove the delta, the effect is a rather strong, but it comes to an immediate stop when Magnitude is equal to 0.00f (retains 0% of velocity), while it moves indefinitely when equal to 1.00f (retains 100% of velocity). That's fine and that's how it should work.

When I add the delta to smooth it out, I encounter a problem. When Magnitude is equal to 1.00f, it retains 100% velocity as it should. However, when Magnitude is equal to 0.00f, it retains 1/60th of it's velocity instead of stopping. Of course, 1/60 is equal to 0.01666, which is the frames per second on the delta. But it's wrong.

I'm not sure how to fix this behavior. Any suggestions?

sentences:
How do I load a specific Asset Bundle Manifest, but not the Asset Bundle itself? I have a bunch of Asset Bundles.  I load the generic Asset Bundle Manifest to get the names of all of my asset bundles.  I want to load only a specific asset from the bundle, but I need to retrieve the names of the assets so I can choose which one.  The names of these assets are in the asset bundles manifests associated with each asset bundle.

How can I load just the manifest for a particular asset bundle?

This is the closest I have come, but it does not work:

private IEnumerator LoadAssetNames()
{
    foreach (var bundleName in assetBundleNames)
    {
        string url = "my://server/" + bundleName + ".manifest";
        var www = UnityWebRequest.GetAssetBundle(url);
        yield return www.Send();
        if (www.isError)
        {
            Debug.LogError(www.error);
            yield break;
        }
        var bundle = ((DownloadHandlerAssetBundle)www.downloadHandler).assetBundle;
        www.Dispose();
        assetNames[bundleName] = bundle.GetAllAssetNames();
    }
}

It returns to me a failed to decompress error:

Error while downloading Asset Bundle: Failed to decompress data for the AssetBundle 'my://server/bundleName.manifest'.

I can download the manifest directly as a string or set of bytes, but then how can I cast it to an AssetBundleManifest?

sentences:
Custom complex body shape with cut feature I need to create sprites (or scene2d actors or whatever) with custom shape, preferably generated from a png image (marching squares?).

I followed some Mesh tutorials but they all hardcode the triangularized-shape vertices in an array, which is completely insane.

I will later have to give my sprite a cut feature, like this game.
so I'll have to regenerate and redraw a new shape several times. Some told me to review the Drawable classes as well as Mesh, and create my own MeshDrawable that renders using meshes.

Do you have an idea of how to dynamically generate vertices and shapes instead of hardcoding coordinates?

at what level will my Mesh be responding to touch events and reacting with the user?

Any clarification will be welcome, I'm kind of lost.

sentences:
Character Models: Single Mesh vs. Individual Parts I was looking up 3D character models from various games (Battlefield 3 and DMC to be specific), just as research work and upon importing the model into Blender3D, I found that every part of the model was a separate mesh/object (head, armor vest, legs, hands, etc.).

This got me thinking: Why didn't the artist model them as a single object?

I think that would be better because:

You can save a few polygons in your model [*].
Doesn't animating separate parts [**] cause clipping issues as one mesh may not deform in sync with neighboring mesh?

[*] All parts were overlapping each other = the armor vest was overlapping chest polygons, which were not visible and thus wasted.

[**] All polygons and edges connected to each other.

sentences:
udp over cellular networks? I'm starting to build a multiplayer iOS game using UDP. I want the game to be playable over cellular networks, but I can't really find that much information on it. Many people say that it's dependent on your carrier whether or not it will work.

I tried searching but I can't really find much info on this topic. I know carriers must allow UDP because of things like video streaming, but what about custom game protocols? Will UDP work over a cellular network? If anyone has a definitive answer or can point me to some resources that'd be great

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: Best way to save screenshots in a game? I'm making a game, and I'm adding a screenshots feature. Currently I save screenshot files to <Home Directory>/Pictures/MyGame/. However, I'm not sure if these files will be accessible on Mobile. On Mobile, I want to save them to the gallery. What's the best way to save screenshots in my game? I am not using a game engine, so using any cross-platform helper functions is completely out of the question. I only have access to built-in libraries like Cocoa on MacOS.

sentences: Blending effect on textures Hi i am trying to build screen animation like flickering, interlace, color separation similar to old style malfunctioning Amiga screens. The intended effects are shown in this  video. I am using libgdx and I already discovered the universal tween engine, which helps a lot to build transitional animations, but how should I approach those blending effects, any suggestions? I will specify my question once I learned more about libgdx, but maybe you could give me some hints already. Thanks!

sentences:
Can't change the textures of a .FBX or an .X exported from 3dsmax I created a model (real simple) in 3DSMax 2010, exported it to FBX format and loaded it in an XNA 4.0 content project. I also tried with .X files using kW X-port and it has the same behavior.

I can load the model in a game, and it has it's 3DSMax texture. I can't however change the texture of a face (or all) at runtime. When I do this, it doesn't crash or anything, it just doesn't apply the textures.

I've tried with a sample model from a microsoft creative tutorial (the famous spaceship one) and on that model, with my texture, it works. This is why I think my model isn't working properly.

Anyone care to comment/help?

Note: Even though I don't think the problem is there since I've made it work with another model, here is my LoadContent method to load the model and change the texture of all mesh :

protected override void LoadContent()
{
    base.LoadContent();

    ContentManager contentManager = new ContentManager(Game.Services, "Content");

    Model = (Model)contentManager.Load<Model>(ModelName);
    Texture = (Texture2D)contentManager.Load<Texture2D>(TextureName);

    foreach (ModelMesh mesh in Model.Meshes)
    {
        foreach (BasicEffect effect in mesh.Effects)
        {
            effect.Texture = Texture;
        }
    }
}

sentences:
Stop vibration (bouncing efect) I have a game with some ball and I want to make it bounce. I already have movement, gravity, collisions implemented, I only need to make it bounce. Thing is, using this code:

player.getVelocity().y *= Player.ENERGY_LOSS;
player.getVelocity().y = -player.getVelocity().y;

indeed it makes the ball bounce but obviously the .y will get to very small values causing the ball to 'vibrate' and never stop.

How can I 'clamp' this value? Let's say I just want the ball to bounce just 2 - 3 times?

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:
OpenGL Cubemap skybox edge issue I implemented a skybox into my program using a tutorial, and using the provided 6 textures from that tutorial to make a cube map texture, my skybox looked fine. However, ever since then every other skybox texture set I have tried to add has had issues with the edges not blending together. Here is generally how they always end up looking:

here is my code for for loading the textures and the parameters:

glActiveTexture(GL_TEXTURE0);
textureID = SOIL_load_OGL_cubemap(textures[0], textures[1], textures[2], textures[3], textures[4], textures[5], 0, 0, SOIL_LOAD_RGB);
glBindTexture(GL_TEXTURE_CUBE_MAP, textureID);
if (textureID == 0)
{
    glGenTextures(1, &textureID);

    int width, height;
    unsigned char* image;

    glBindTexture(GL_TEXTURE_CUBE_MAP, textureID);
    for (GLuint i = 0; i < 6; i++)
    {
        GLuint sID = SOIL_load_OGL_texture(textures[i], 0, 0, 0);
        image = SOIL_load_image(textures[i], &width, &height, 0, SOIL_LOAD_RGB);
        glTexImage2D(GL_TEXTURE_CUBE_MAP_POSITIVE_X + i, 0, GL_RGB, width, height, 0, GL_RGB, GL_UNSIGNED_BYTE, image);
        SOIL_free_image_data(image);
    }
}

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);
glBindTexture(GL_TEXTURE_CUBE_MAP, 0);

And code for rendering the skybox:

glDepthMask(GL_FALSE);
shader->bind();
glBindTexture(GL_TEXTURE_CUBE_MAP, textureID);
viewMatrix.r4.x = 0;
viewMatrix.r4.y = 0;
viewMatrix.r4.z = 0;
shader->loadMatrix("viewMatrix", &viewMatrix.m11);
glBindVertexArray(vao);
glEnableVertexAttribArray(0);
glDrawArrays(GL_TRIANGLES, 0, 36);
glBindVertexArray(0);
glBindTexture(GL_TEXTURE_CUBE_MAP, 0);
shader->unbind();
glDepthMask(GL_TRUE);

And the shader code

const char vertexShader[] =
    "#version 330\r\n"
    "in vec3 position;\r\n;"
    "out vec3 texCoord;\r\n"
    "uniform mat4 projectionMatrix;\r\n"
    "uniform mat4 viewMatrix;\r\n"
    "void main()\r\n"
    "{\r\n"
    "gl_Position = projectionMatrix * viewMatrix * vec4(position, 1);\r\n"
    "texCoord = position;\r\n"
    "}";

const char fragmentShader[] =
    "#version 330\r\n"
    "in vec3 texCoord;\r\n"
    "out vec4 color;\r\n"
    "uniform samplerCube sampler;\r\n"
    "void main()\r\n"
    "{\r\n"
    "color = texture(sampler, texCoord);\r\n"
    "}";

Does anyone see something that I might be missing that's causing my skybox to not render properly for most cube maps?

sentences:
Scrolling Camera in Pygame is not working properly I implemented a camera with edges in 2D side scrolling game using Pygame, it is working but sometimes it will scroll for more than it should have, and in case of using different moves that involved movement, sometimes the value will be in float number and it will cause the level to be buggy. I have tried different methods of camera, but none of them worked for me so far. Is there any other way to implement camera, or at least make this one work as intended?

Below is the code for scrolling at x-axis:

   if self.rect.right >= 500 and self.in_level.world_shift_x >= -((self.in_level.total_level_width - (Screen_Width + 32))):
        diff = self.rect.right - 500
        self.rect.right = 500
        self.in_level.shift_world_x(round(-diff, 0))

    if self.rect.left <= 200 and self.in_level.world_shift_x <= -((self.speed / 2)):
        diff = 200 - self.rect.left
        self.rect.left = 200
        self.in_level.shift_world_x(round(diff, 0))

sentences:
Unity: Why does playModeStateChanged get called after Start? I have this:

[InitializeOnLoad]
public class MyClass
{
    static MyClass()
    {
        EditorApplication.playModeStateChanged += x => { PlaymodeStateChanged(); };
    }

    private static void PlaymodeStateChanged()
    {
        Debug.Log("Play mode changed");
    }
}

and another class with a Debug.Log("Start()"); in the Start method.
When I hit play I see on the log output:
Start()
Play mode changed

Shouldn't playModeStateChanged get called before Start is called on all objects? Any way to go around this? I need this so I can initialize an object before other objects that need to reference this one run Start.

Thanks in advance!

sentences:
HTML5 - check if font has loaded At present I load my font for my game in with @font-face

For instance:

@font-face {
    font-family: 'Orbitron';
    src: url('res/orbitron-medium.ttf');
}

and then reference it throughout my JS implementation as such:

ctx.font = "12pt Orbitron";

where ctx is my 2d context from the canvas.

However, I notice a certain lag time while the font is downloaded to the user.  Is there a way I can use a default font until it is loaded in?

Edit -

I'll expand the question, because I hadn't taken the first comment into account.  What would the proper method of handling this be in the case that a user has disabled custom fonts?

sentences:
Recommended polycount for a MMORPG character "How much polygons is too many for a MMORPG character?"

I did some research and found a few discussions about the matter. But the answers I found was mostly "Polygons has nothing to do with networking" and they just start to argue and flame each other.

I think the question wasn't received well because it wasn't clear. So, I'll try to make it a bit clearer.

Consider the main character of an offline game, it has so much details, but it is the only character on the scene for most of the time.

Now, on a MMORPG everyone is a main character. Let us say 100 players are in sight of each other at a given time. If we had the same character from the offline game we'd have too many polygons and frame-rate/performance would suffer.

If I target a minimum system requirement of 4GB memory, Intel i3 (3rd gen) CPU, and at-least a laptop GPU (cheap nvidia mobile?).

How much polygon should my characters be limited to?
or, How much polygons should be on the scene/sight at a time? (including terrain, other objects...)
or, Is there a rule of thumb for polycount that applies to any genre of games?

sentences:
Best logic to create and drop new gems in a Match-3 game In a simple match-3 game, with a square gems matrix creating and dropping new gems is fairly simple: when needed I generate those gems above the matrix and then I make them fall into the main matrix simulating that common fall-from-the-ceiling behavior.

Let's now imagine I have a matrix with some rock-type gems, the ones that will never move from their position, and I have cleared an entire column via a "powerful" gem. I have something like this:

OOO OOO
OOO OOO
OOO OOO
OOO OOO
OOX XOO
OO   OO
O     O
OOOOOOO

Here O is a normal gem, and X is a rock gem, that is fixed in the matrix and will not move from its original position.

When the new gems flow into this matrix, they will eventually move to the left or to the right to fill that big empty space, but each one will be dropped into the same column.

I'm wondering what the best way to drop those new gems is. I clearly cannot simply make them move from the top of the screen directly to their final position (as in the previous case), since the would move diagonally across the other gems (too bad).

I'd like to know what's the easiest and most flexible way to compute and the configure the path that each gem will have to follow.

sentences:
How can I use Body tracking in Android using ARCore or some other libraries? I know that ARCore on Android doesn't support Body Tracking like ARKit does. But is there some alternative or workaround to achieve it? Some other SDKs or Libraries or maybe even if there is some way to do it through ARCore itself?
To make it clearer I plan to use something like this in an AR game for Android. I plan to develop it in Unity 2019.4.x.
My search result in Google didn't yield a useful result as it gets mixed with ARCore Motion Tracking (which isn't what I am talking about here) or implementation with ARKit. But I got a little hope that there might be some way out after reading this post on Unity Forums.

sentences:
independent lighting per mesh in blender In Blender, is it possible to assign lighting objects/effects exclusively to a single mesh? For instance, if I place two meshes next to each other, and two lights (one shining on each mesh), I would want each mesh to not cast a cast any shadow on the other.

For example, in the following rendered image from a "test" star system view:

The rings are casting shadows on the right-most planets. I want the rings to only cast shadows on their own planet.

Is this possible?

sentences:
What the difference between public int and int? I was trying to understand the difference of int and public int by checking how unity respond to it
using UnityEngine;
using UnityEngine.Assertions.Must;
using UnityEngine.SceneManagement;

public class Bird : MonoBehaviour

{
 int CurrentState = 1;
 int PreviousState = 1;

}
Void Update()
{(if CurrentState != PreviousState)
 transform.localScale = new Vector3(transform.localScale.x+1,transform.localScale.y+1,transform.localScale.z+1);
  }

Since the equality is false, the scale of object remail unchange and in my next step, I changed "int CurrentState = 1" to "public int CurrentState=0" and "int PreviousState = 1" to "Public int PreviousState = 1" . Isn't that this time, the equality is true as 1 !=0 but the scale of object remained the same. Once I deleted the word "public" on both currentstate and previousstate, the scale increase indefinitely. I thought the word "public" basically meant there no access restriction but why it looks like the "if" statement couldn't retrieve the info correctly?

sentences:
Recent mainstream games written in pure C? not C++ what was/is the point? Recent meaning the current decade. I had found this post
https://gamedev.stackexchange.com/a/15403/6544
wasnt c++ adopted as the industry standard quite some time back.
In what sort of situation does it make sense to go with games written in pure c on established consoles/pc/os

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:
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:
Positioning ropes equidistantly on a landscape display I would like to render 4 similar ropes in my game that are equidistant on a landscape mode display.

How can I proceed? My screen is 1920*1080, at 420 dpi.

Is there any way that I could link the ropes coordinates with pixels or is there another way?

sentences:
Game Design. Question about balance progression Playing in the main mode, the player receives Glory for victory, and for defeat, loses it. When the player reaches the required number of Glory, he moves to the next League. There are N Leagues in the game.
Each League has a recommended Promotion (level) of the Hero. When a player has a Hero's Promotion below the recommended one, he loses more often. The Hero has K Promotions.
And Quastion
Player must complete N Leagues for 360 days. How can i reach this?

sentences:
How do I implement dynamic objects in a voxel engine? I am writing my own voxel engine, based on cubes of different sizes and properties. In order to store and efficiently use voxels, I implemented Sparse Voxel Octree storage, but I plan to have many dynamic structures in the engine that would change their position in space.

How could that be implemented, in my case? Should I use a separate storage for dynamic objects? It would be more desirable to treat those objects as voxels, too, but how do I move them smoothly?

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:
Why don't more games use vector art? It would seem to me that vector art is more efficient in terms of resources/scalability; however, in most cases I have seen artists using bitmap/rasterized art. Is this a limitation put on the artists by the game programmers/designers? As a programmer I think vector art would be more ideal, since it allows for scaling up resolution without having to recreate the art, creating really large graphics or causing graphics to become blurry.

The questions: why aren't more people using SVG/AI to create 2D game art? Would it actually be preferred (and who prefers it)? Are bitmap graphics a standard or a limitation (or maybe neither)?

Background: I am working on an engine, and I had some kinda cool ideas for vector based graphics; however, I don't want to piss off artists in the future.

I guess this is more a question centered around pragmatism and developing games.

sentences:
How to attach two XNA models together? I go back on unsolved question I asked about attaching two models together, could you give me some help on this ?

For example, If I want to attach together Model1 (= Main model) & Model2 ?
I have to get the transformation matrix of Model1 and after
get the Bone index on Model1 where I want to attach Model2 and then apply some transformation to attach Model2 to Model1

I wrote some code below about this, but It does not work at all !! (6th line of my code seems to be wrong !?)

Model1TransfoMatrix=New Matrix[Model1.Bones.Count];

Index=Model1.bone[x].Index;

foreach (ModelMesh mesh in Model2.Meshes)
{
  foreach(BasicEffect effect in mesh.effects)
  {
     matrix model2Transform = Matrix.CreateScale(0.1.0f)*Matrix.CreateFromYawPitchRoll(x,y,z);

     effect.World= model2Transform *Model1TransfoMatrix[Index];
     effect.view = camera.View;
     effect.Projection= camera.Projection;
   }
   mesh.draw();
}

sentences:
Slick2D: constructor vs. init method What is the difference between the constructor of a BasicGameState and the init method?  It appears that they are both called at the same time when the BasicGameState is registered in StateBasedGame, so what makes them different?

A follow up question to this is how do I run a method only when a state becomes active?  Initially I thought the init method was only called when a new state becomes active, but this is not true.  Note that I'd like to call this method only once at the beginning of the new state, so putting it in the update method seems like the wrong place.

sentences:
How to decrease velocity constantly? I am developing a golf game using the GameSalad framework for iPhone. I have one attribute named speed of type integer with value 5000. I also have one boolean attribute named speedControl which is initially false.

When the ball is pressed and its sppedControl is true, I accelerate it with game.speed i.e. 5000.

Now I want to decrease the speed of the ball every 0.5 seconds, so i added a timer behavior and set it to every 0.5 seconds. Every tick of the timer, I set the CHANGE ATTRIBUTE game.speed to game.speed-300. but it's not working.

Sorry, I have no reputation, therefore I can't send you screenshots.

Please help me. I am very new to GameSalad and this is my first project.

sentences:
How to detect collision only in non-transparent texture? I am developing a game using libGDX. I am trying to detect the collision between bee and tube. I am using the following code to detect the collision.

if(player.getBounds().overlaps(boundsBot)){

}

player is a bee and boundsBot is Rectangle of tube. Since there is some transparency in bee image, this returns true even if it doesn't seem to collide. I understand the reason why this is returning true.

I read this solutions. I understood the theoretical concept to the solve the problem but I couldn't achieve it using libGDX.

Here is what I tried,

if(Intersector.intersectRectangles(player.getBounds(), boundsBot, rectangle)) {
    //Gets the intersected rectangle
    System.out.println("Rectangle Bottom: " + rectangle);

    //Converting texture to pixmap
    Texture texture = player.getTexture().getTexture();
    if (!texture.getTextureData().isPrepared()) {
        texture.getTextureData().prepare();
    }
    Pixmap pixmap = texture.getTextureData().consumePixmap();

    //Trying to find transparency.....
    System.out.println("Format: "  + pixmap.getGLFormat());
}

How can I solve this issue?

Thank You!

sentences:
Procedurally generating a building of specific area Myself and a team are working on a factory builder game that gives the player a random factory at the start of the game. To try to make sure there is a sense of "fairness," ideally the randomly generated factory would have an area within a few units of (placeholder value) 30.

Its relatively simple to write a basic random rectangle generator to meet these specifications, but our goal is for the factory to be more complex, perhaps made up of 2, 3, or even 4 intersecting rectangles, producing more complex shapes (think of L, U, and O shaped buildings).

I've tried generating a random rectangle and then using basic algebra to fill in a 2nd rectangle, but so far I've had no luck implementing more than 2 rectangles, and even then I am unhappy with the results for just a 2 rectangle design.

Some more relevant info:
2D top down
Some of the mechanics are factorio style so rooms should have reasonable length and width to allow room for machinery
Currently in Java and Lua (can use built in libraries from either if needed)

Thanks in advance!

EDIT:
When I say "good" or "bad" outputs, a bad output would be any output which has space unusable by the player. The factory shape limits where the player can place factory machines such as conveyor belts. Ideally, the factory shouldn't have areas that are only 1-2 blocks wide, the shape shouldn't be one or two big rectangles with a line of 1-2 blocks "hanging" out to one side.
A good output would be where all floor space is "workable", so all areas are at least 3-4 blocks wide. A good output doesn't always have to be complex (1 or 2 rectangles is okay), but it should have a fair chance if being made up of more than 1-2 rectangles.

sentences:
How can I achieve dynamic pathfinding in Godot? I am new to Godot and trying to implement dynamic pathfinding on a 2D map which includes both static obstacles and moving units. As I understand it, Godot's NavMesh makes it almost trivial to generate a path through a pre-baked polygon map [1], as with the solid-line path in the below image. However, I want my game to be able to re-plan the path if an enemy (or other obstacle) moves to obstruct it--as with the dotted-line path in the image. Is this possible with built-in Godot functionality? And if so, how?

Alternatively, how would you recommend implementing a custom pathfinding script in Godot? I am comfortable with vanilla A* and I plan to learn GDScript and/or C#, but in my experience (in Python/Pygame), grid-based A* is much too slow to re-check the path every frame.

sentences:
Unity directional light for a day night cycle on a hex sphere So I am trying to create a Day Night cycle on a sphere but it doesn't work the way I want it to.
As the model is hex tiled, you see the edges of the hex tiles also lit up like below. I am using a directional light source for the same.

I don't want the above effect. I want it to ignore the edges and just be a straight line instead. Something like below

Is there a way inside Unity that I could achieve this effect just using the lights?

sentences:
Issue with removing sprites on collision I'm trying to make a very simple collision detection procedure just for test purposes.
The problem is with the send/receive information between functions

I have these lines on the update method (could be later implemented for checking what kind of subclass node is)

CCSprite *sprite = [background spriteCollisionWithRect:player.boundingBox];
if (sprite!=nil) {
    [sprite removeFromParentAndCleanup:YES];
}

and this is the spriteCollisionWithRect method

-(CCSprite*)spriteCollisionWithRect:(CGRect)bounds
{
    for (CCSprite *sprite in _spritesArray) {
        if (CGRectIntersectsRect(sprite.boundingBox, bounds)) {
            return sprite;
        }
    }
    return nil;
}

Now, this way not all the sprites are removed. It only works occasionally. But if I remove the node inside the collision method instead of returning it, it works nicely.

-(CCSprite*)spriteCollisionWithRect:(CGRect)bounds
{
    for (CCSprite *sprite in _spritesArray) {
        if (CGRectIntersectsRect(sprite.boundingBox, bounds)) {
            [sprite removeFromParentAndCleanup:YES];
        }
    }
    return nil;
}

Why is this?

sentences:
representing transforms without a world/global reference frame Background:

I'm trying to make a segmented/portal-based game engine
that supports impossible (non-euclidean?) geometry.

By segmented/portal-based I mean the world is divided into segments which are connected by portals.
This technique was used by the engines for classic shooters like Doom and Duke Nukem 3d.

The portals do not look or function like the portals in the game Portal, which is unfortunately what most of the results that queries containing "portal" bring up.

Each area is in its own coordinate system
with each portal defining the transformation between
the portal entrance in the origin segment and
the portal exit in the destination segment.

It is possible for there to be multiple portals connecting the segments and for those portals to have different transformations.
If I understand correctly, this makes the world non-euclidean and precludes storing a transformation for each connected segment on a segment.

Objects have transforms for each segment they are present in.
So instead of the usual transform setup of objects having a local transform, a parent transform, and a world transform
there is no world transform and it is possible to have more than one "parent" transform.

Advanced math is not my strong point.
I understand the basics of the transformations
but there are some details I don't fully grok
and almost certainly some important or useful
properties that I am not aware of.

Questions:

Where do I "store" or "collect" the results of applying transformations to an object?

Do I apply them to the object's local tranform or do I apply it to the object's transforms relative to "parent" segments?

It seems like a bad idea to accrue transformations on the local transform, but perhaps I don't understand the purpose of the local transform.

Research before asking question:

tutorial on simple portals in unreal that helped with outlining the transformation logic, but is focused on unreal and does not answer my questions.

flipcode portal rendering tutorial which gets brought out anytime there is a question about portal-based rendering. I have read through it a couple times, although the small font is hard for me to read so it is very possible I missed some details.

related question

related question

discussion on gamedev subreddit

sentences:
In Unity, how do I correctly implement the singleton pattern? I have seen several videos and tutorials for creating singleton objects in Unity, mainly for a GameManager, that appear to use different approaches to instantiating and validating a singleton.

Is there a correct, or rather, preferred approach to this?

The two main examples I have encountered are:

First

public class GameManager
{
    private static GameManager _instance;

    public static GameManager Instance
    {
        get
        {
            if(_instance == null)
            {
                _instance = GameObject.FindObjectOfType<GameManager>();
            }

            return _instance;
        }
    }

    void Awake()
    {
        DontDestroyOnLoad(gameObject);
    }
}

Second

public class GameManager
{
    private static GameManager _instance;

    public static GameManager Instance
    {
        get
        {
            if(_instance == null)
            {
                instance = new GameObject("Game Manager");
                instance.AddComponent<GameManager>();
            }

            return _instance;
        }
    }

    void Awake()
    {
        _instance = this;
    }
}

The main difference I can see between the two is:

The first approach will attempt to navigate the game object stack to find an instance of the GameManager which even though this only happens (or should only happen) once seems like it could be very unoptimised as scenes grow in size during development.

Also, the first approach marks the object to not be deleted when the application changes scene, which ensures that the object is persisted between scenes. The second approach doesn't appear to adhere to this.

The second approach seems odd as in the case where the instance is null in the getter, it will create a new GameObject and assign a GameManger component to it. However, this cannot run without first having this GameManager component already attached to an object in the scene, so this is causing me some confusion.

Are there any other approaches that would be recommended, or a hybrid of the two above? There are plenty of videos and tutorials regarding singletons but they all differ so much it is hard to drawn any comparisons between the two and thus, a conclusion as to which one is the best/preferred approach.

sentences:
How to set the hair_mesh to follow the animation? How to set the hair mesh to follow the animation?
I am trying this.
.cpp
Hair = CreateDefaultSubobject<USkeletalMeshComponent>("Hair");
    Hair->SetupAttachment(GetMesh());
    Hair->AttachToComponent(MyCharacter::GetMesh(), FAttachmentTransformRules::KeepWorldTransform, TEXT("head"));

.h
UPROPERTY(EditAnywhere, Category = "Components")
    class USkeletalMeshComponent* Hair;

I have attached the hair mesh to the Head socket but the hair mesh is not following the animation.
The hair mesh is called Hair_Mesh and has been attached in the editor while the Hair skeletal mesh component is already sets to UPROPERTY(EditAnywhere, Category = "Components")

sentences:
Stormy water like Temple Run 2 for Mobile How can I make stormy water like they did in Temple Run 2. I've tried with Unity Water Pro to achieve the same result but when I include it in the project the frame rate crashes to 3 frames per second.

Unity Water basic doesn't fulfill the requirements at all. So is there any other way?

sentences:
2d Tile Movement and Camera Let's imagine we have a 60x60 grid (where a Tile is 64x64px). Within the viewport there should be 10 tiles. The player object is 32x32px.

To have smooth movement, I have to take delta time in consideration; and do something like:

this.player.x += 5 * dt;

To calculate viewports:

vX = parseInt(this.player.x); - Math.floor(0.5 * 10);
  if (vX < 0) vX = 0;
  if (vX+10 > 40) vX = 60 - 10;

  vY = parseInt(this.player.y); - Math.floor(0.5 * 10);
  if (vY < 0) vY = 0;
  if (vY+10 > 40) vY = 60 - 10;

And to render position of player:

this.context.rect((this.player.x - vX) * 64, (this.player.y - vY) * 64, 32, 32);

However I cannot get the math right.

How can I determine which tiles that should be rendered based on Canvas coordinates, in context to where the Player "actually" is on the tile grid. Basically I want to achieve this: https://stackoverflow.com/questions/11464550/html5-creating-a-viewport-for-canvas

But with smooth movement (and not jumping to one tile at a time).

sentences:
Why is my client laggy despite 60 update packets a second? I am developing a small multiplayer game with XNA. It's a usual client-server architecture -- I have a server and many clients communicating with it through UDP (via .NET's Socket class). These clients send data to the server (for example, the player's position) and the server handles it and decides what to do (send it to every other client or drop it).

What's the most efficient "correct" way to send position of moving object from a client to a server? Currently, I send the client's ID and player position 60 times a second (XNA's default update rate) while a player is moving. When I see my own player on the screen, it moves very smoothly, but other don't, despite every client having the same update rate. What am I doing wrong?

sentences:
Direct3D11 + Assimp imported model corrupted/failed I use Assimp library to import vertex and index data from model file.

I don't know how to correctly create index buffer from mFaces array of aiMesh. Or something wrong, because i my model is incorrect.

I have already experienced successful mesh rendering, if verticies and indicies are defined manually in code (x5 vertices triangle and indicies).

Here is my code.

// Loading TRIANGULATED vertex/index buffers:

// Load verticies:
m_uVertexCount = pMesh->mNumVertices;
CBasicEffect::sVertex * verticies = new CBasicEffect::sVertex[m_uVertexCount];
for(UINT i = 0; i < m_uVertexCount; i++)
{
    CBasicEffect::sVertex v;
    v.Pos = Vector3FromAi(pMesh->mVertices[i]);
    v.Color = XMFLOAT4(1,1,0,1);//test
    verticies[i] = v;
}

D3D11_BUFFER_DESC bd;
ZeroMemory( &bd, sizeof(bd) );
D3D11_SUBRESOURCE_DATA InitData;

// Create vertex buffer:
bd.Usage = D3D11_USAGE_DEFAULT;
bd.ByteWidth = sizeof( CBasicEffect::sVertex ) * m_uVertexCount;
bd.BindFlags = D3D11_BIND_VERTEX_BUFFER;
bd.CPUAccessFlags = 0;
InitData.pSysMem = verticies;
if( FAILED(pModelOf->GetDevice()->GetDevice()->CreateBuffer(&bd, &InitData, &m_pVertexBuffer)) )
    ;//...

// Load indicies:
m_uIndexCount = pMesh->mNumFaces * 3;
UINT* indices = new UINT[m_uIndexCount];
for (UINT face = 0; face < pMesh->mNumFaces; face++)
    for (UINT idx = 0; idx < 3; idx++)
        *indices++ = pMesh->mFaces[face].mIndices[idx];

// Create index buffer:
bd.Usage = D3D11_USAGE_DEFAULT;
bd.ByteWidth = sizeof( UINT ) * m_uIndexCount;
bd.BindFlags = D3D11_BIND_INDEX_BUFFER;
bd.CPUAccessFlags = 0;
InitData.pSysMem = &indices;
if( FAILED(pModelOf->GetDevice()->GetDevice()->CreateBuffer(&bd, &InitData, &m_pIndexBuffer)) )
    ;//...

UPDATE: Now i see my model. But it is loaded incorrecty: http://i.stack.imgur.com/Z9liR.jpg (originally it is scene with 5 primitives).

My render code:

// <Clean render target view and depth stencil view>

ID3D11Buffer* pVertexBuffer = pMesh->GetVerticiesBuffer();
    ID3D11Buffer* pIndexBuffer = pMesh->GetIndexesBuffer();

    // Set buffers and topology mode
    UINT stride = sizeof( sVertex ), offset = 0;
    m_pDevice->GetContext()->IASetVertexBuffers( 0, 1, &pVertexBuffer, &stride, &offset );
    m_pDevice->GetContext()->IASetIndexBuffer(pIndexBuffer, DXGI_FORMAT_R32_UINT, 0);
    m_pDevice->GetContext()->IASetPrimitiveTopology( D3D11_PRIMITIVE_TOPOLOGY_TRIANGLELIST );

    // Shaders:
    m_pDevice->GetContext()->IASetInputLayout( m_pVertexLayout );
    m_pDevice->GetContext()->VSSetShader( m_pVertexShader, NULL, 0 );
    m_pDevice->GetContext()->VSSetConstantBuffers( 0, 1, &m_pConstantBuffer );
    m_pDevice->GetContext()->PSSetShader( m_pPixelShader, NULL, 0 );
    //m_pDevice->GetContext()->PSSetConstantBuffers( 0, 1, &m_pConstantBuffer );

    // Draw:
    //m_pDevice->GetContext()->Draw( pMesh->GetVertexCount(), 0 );
    m_pDevice->GetContext()->DrawIndexed( pMesh->GetIndexCount(), 0, 0 );

//

sentences:
Premake a texture in SDL (C++) and save it I am new with SDL, and am making a Conway Game of Life.

I want to make a grid appear on the screen, so of course I could make one manually with SDL_RenderDrawLine and two loops. But I don't want to create this grid every single time, once is enough, after I can just copy it to the screen.

So I want to create the grid once, and save it somewhere, like a texture.

The problem is, how do I draw to a texture ?

From what I understand, SDL_RenderDrawLine will need a renderer (which is associated with a window) and so it won't work for my purpose as it will be drawing to that renderer buffer or something, and then to a window.

How can I do that ? You can load an image instead, but I'll lose the whole point of drawing it algorithmically (what if the tile size change, etc).

EDIT :
So I'm trying to use SDL_SetRenderTarget, as well as the correct flag to create the texture. However it simply doesn't show up.

Here is the code that create the whole texture, and should render to it :

// part of my init function for SDL

SDL_SetRenderDrawColor(d_renderer, 0xFF, 0xFF, 0xFF, 0xFF);
SDL_RenderClear(d_renderer);
// Create square grid once
d_grid = SDL_CreateTexture(d_renderer, SDL_GetWindowPixelFormat(d_window), SDL_TEXTUREACCESS_TARGET, WINDOW_WIDTH, WINDOW_HEIGHT);
if (d_grid == NULL){
    fprintf(stderr, "Error creating blank grid texture: %s\n", SDL_GetError());
    return false;
}
SDL_SetRenderTarget(d_renderer, d_grid);
for (x = 0; x < MAP_WIDTH; x++){
    SDL_RenderDrawLine(d_renderer, x * 10, 0, x * 10, WINDOW_HEIGHT);
}
for (y = 0; y < MAP_HEIGHT; y++){
    SDL_RenderDrawLine(d_renderer, 0, y * 10, WINDOW_WIDTH, y * 10);
}
// TODO: Draw the grid to the texture
 SDL_RenderPresent(d_renderer);
// Renderer will now draw to screen again
SDL_SetRenderTarget(d_renderer, NULL);

I've checked it, the two loops does create what I want.

Now when I update the screen:

// Reset display
SDL_RenderClear(d_renderer);
SDL_RenderCopy(d_renderer, d_grid, NULL, NULL);

SDL_SetRenderDrawColor(d_renderer, 0x00, 0x00, 0x00, 0xff);

/* Code used to render the game grid, removed for clarity */

SDL_RenderPresent(d_renderer);

I don't understand how I'm supposed to do. According to LazyFoo tutorial, I need to use the SDL_RenderDraw* function, which will render to the texture, but using SDL_RenderPresent or not doesn't change anything. What am I doing wrong ?

sentences:
Editor data is not there in unity I relaunched my prev unity project and the editor is not behaving as intented...
All the data that was manually set in the scripts in inspector in not there...
All the public variables and references are just empty....
I am using Unity 2019.4.2 lts

sentences:
Alternative to Game State System? As far as I can tell, most games have some sort of "game state system" which switches between the different game states; these might be things like "Intro", "MainMenu", "CharacterSelect", "Loading", and "Game".

On the one hand, it totally makes sense to separate these into a state system. After all, they are disparate and would otherwise need to be in a large switch statement, which is obviously messy; and they certainly are well represented by a state system. But at the same time, I look at the "Game" state and wonder if there's something wrong about this state system approach. Because it's like the elephant in the room; it's HUGE and obvious but nobody questions the game state system approach.

It seems silly to me that "Game" is put on the same level as "Main Menu". Yet there isn't a way to break up the "Game" state.

Is a game state system the best way to go? Is there some different, better technique to managing, well, the "game state"? Is it okay to have an intro state which draws a movie and listens for enter, and then a loading state which loops on the resource manager, and then the game state which does practically everything? Doesn't this seem sort of unbalanced to you, too? Am I missing something?

sentences:
How do I check if one square is overlapping another in HTML5 canvas I have a little program that goes like this:

Whenever somebody presses space, a blue square appears. The blue square shouldn't overlap with any other blue square.

But the function that is checking the overlap is not working! Can somebody please help?

window.onload = function() { //Starts the program when the page is loaded.

  var canvas = document.getElementById("paper");
  var background = canvas.getContext("2d");
  var squareDisplay = canvas.getContext("2d");

  canvas.width = window.innerWidth;
  canvas.height = window.innerHeight;

  var xAndYvaluesOfSquares = [];

  //Makes a randint() function.
  function randint(min, max) {
    return Math.floor(Math.random() * (max - min + 1)) + min;
  }

  function checkForOccupiedAlready(testXPos, testYPos) {
    if (xAndYvaluesOfSquares.length != 0) {
      for (valuePair in xAndYvaluesOfSquares) {
        if (
          ( valuePair[0] + 20 ) < testXPos &&
          ( valuePair[0] - 20 ) > testXPos &&
          ( valuePair[1] + 20 ) < testYPos &&
          ( valuePair[1] - 20 ) > testYPos){ //If in the same area
          return false;
        }
      }
    }
    return true;
  }

  //Makes a new square
  function makeNewsquare() {

    var checkingIfRepeatCords = true;
    //DO loop that checks if there is a repeat.
    do {
      //Makes the square x/y positions
      var squareRandomXPos = randint(50, canvas.width - 50);
      var squareRandomYPos = randint(50, canvas.height - 50);

      //Tests if that area is already occupied
      if (checkForOccupiedAlready(squareRandomXPos, squareRandomYPos) == true) {
        xAndYvaluesOfSquares.push([squareRandomXPos, squareRandomYPos]);
        checkingIfRepeatCords = false;
      }
    }
    while (checkingIfRepeatCords == true);
  }

  function resetBoard() {
    for (i = 0; i < xAndYvaluesOfSquares.length; i++) {
      var XYvalue = xAndYvaluesOfSquares[i];

      squareDisplay.beginPath();
      squareDisplay.fillStyle = "rgb(50, 50, 125)";
      squareDisplay.rect(XYvalue[0], XYvalue[1], 50, 50);
      squareDisplay.fill();

    }
  }

  document.addEventListener("keydown", function (event) {
    if (event.keyCode == 32) { //Space key
      makeNewsquare();
      resetBoard();
    }
  })
}

sentences:
Unity display message upon keypress? Hi I'm trying to get NGUI's HUDtext to display a set of text message one of which being "Try using WASD to move" and displaying "Well done!" upon input of any of the four keys. Unfortunately I'm not well versed in C# and am currently stuck and unsure how to implement this.

using UnityEngine;
using System.Collections;
using System;

//public KeyCode KeyCode.Alpha2;

public class Test : MonoBehaviour {

    public int seen = 123;
    public HUDText hudText;

    void Start() {

        StartCoroutine(MyCoroutine());
        //Debug.Log(KeyCode);
        Tutorial ();

    }

    void Tutorial() {

        while (true) {
            while (!Input.GetKeyDown(KeyCode.Return)) Debug.Log ("Hit return");
        }

    }

    IEnumerator MyCoroutine() {

        hudText.Add("Welcome", Color.white, 3f);
        yield return new WaitForSeconds(3);    //Wait one frame

        hudText.Add("This is System Defence", Color.white, 4f);
        yield return new WaitForSeconds(4);

        hudText.Add ("Try using WASD to move", Color.red, 3f);
        yield return new WaitForSeconds(3);

    }

}

I would appreciate it if someone could tell me how would I go about doing this.

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:
Custom event doesn't update blueprint variables Here's what I have:

To sum it up: calling the OnInteract event (which comes from an interface) prints the 'Proceed' variable. Clicking Fire sets the variable to true and prints it. 'Proceed' is false by default.
The problem is that the OnInteract event always prints 'false', even if the Fire event has been called. The Fire event correctly prints 'true', but if I call the OnInteract event later, it still prints 'false', even though logically the variable should be 'true'.
No outside entity is changing the variable. If I set the default value of the variable to 'true', it prints 'true'. The entire project is just the First Person template, a single blueprint actor whose entire event graph is what you see in the screenshot, and an outside entity calling the OnInteract event when I press the button.
Curiously, if I ditch the OnInteract event completely and replace it with InputAction Jump, the code works as expected and prints 'true'.
What's going on? This is so simple, and yet it has me beat.

sentences:
Randomly generated maps in Multiplayer I am currently trying to get randomly generated maps work in multiplayer but I have so many difficulties trying to figure out how. How do other games implement this(Minecraft, Terraria, Don't starve)? My current solutions are as follows.

Generate the map client side and verify(Hash?)

This is the least bandwidth intense but the algorithm needs to be EXACTLY the same as the server side and it is the easiest to exploit.

Generate Server side and transfer to client

This method will ensure that the players all have the EXACT same map, but it it very resource intensive for the server and requires a lot of bandwidth and increased loading times.

sentences:
Why the changes to the children and grand children objects not taken into account? Currently I am working on a framework for a game utilising the SFML graphics library and in one of the classes representing a renderable object in the framework there is an sf::Sprite that is used to represent and draw the object. The issue is that the object instance of class 1 that is represented by the sf::Sprite (which is a private member variable of class 1), is in turn a private member variable of class 2 of which an instance is in turn a private member variable of class 3 from which the sprites belonging to the instances of class 1 and 2 must be retrieved to be rendered in the renderer class. In classes 1, 2 and 3 there are appropriate getter functions like so:

class One
{
     public:

     //Functions
     One();
    ~One();

     sf::Sprite getOne(){ return oneRep;};
    animate();

     private:
     //One variables
     sf::Texture oneTexture;
     sf::Sprite oneRep;

};

class Two
{
     public:

     //Functions
     Two();
    ~Two();
     One getCOneInst(){ return cOneInst;};

    private:

    //Class 1 private member variable
    One cOneInst;
};

class Three
{
    public:

    //Functions
    Three();
    ~Three();

    initTestSprite();
    One getCTwoInst(){ return cTwoInst;};

private:

    //Class 2 private member variable
    Two cTwoInst;
};

class Renderer
{
    public:

    //Functions
    Renderer();
    ~Renderer();

    private:
    //Class 3 private member variable
    Three cThreeInst;

    //Test Class One private member variables
    One testCOneInst;
    sf::Texture oneTexture;
    sf::vector2f position

};

Which are used to access the sprites representing the instances of class 1 and 2 from the instance of class 3 so that the renderer class may render them to the screen of the game. The issue is that: if an instance of class 1 (represented by the sf::Sprite) is constructed in the renderer class like so:

initTestSprite()
{
    testCOneInst.setTexture(oneTexture);
    testCOneInst.setTextureRect(textRect);
    testCOneInst.setColor(sf::Color(255, 255, 255, 255));
    testCOneInst.setPosition(position);
}

And should the getter function be called on the instance of classOne to retrieve the sprite representing the instance of classOne for rendering in the render class

window.draw(testCOneInst.getOne());

The render class through the function above will render the sprite representing the instance of class One: testCOneInst correctly. The problem and the question is: When the sprite representing the instance of class One must be retrieved from the instance of class Two in which the class One instance is a private member variable – the functions that should be able to be called on the class One sprite to manipulate the texture being applied to it, for example setting the IntRect texture to a new location in order to animate the sprite representing the instance of class One does not function correctly – the original texture is still applied to the sprite representing the instance of class One, if the sprite is accessed by the renderer class from  the instance of class 2 and in turn the instance of class 3 like so:

cThreeInst.getCTwoInst().getCOneInst().animate();

Before rendering the sprite with the updated texture changes to the window like so:

window.draw(cThreeInst.getCTwoInst().getCOneInst().getOne());

The changes to the IntRect of the sf::Sprite instance representing class 1 will not be show when the sprite is rendered – and the question is why?

sentences:
Physics.IgnoreCollision not working right after invoked When invoking Physics.IgnoreCollision in Unity, it seems work but it still have collision detection right after creation.

I have this issue with ejecting empty case after gun fire, it's spawning position located inside of character controller(collider), so when ejecting case created, it immediately hit to my character controller and makes my character slows.

First I thought that it's coming from something else, but it's not, because when I just not spawning the empty case, it never happens.

This is the code:

GameObject ejectedCase = Instantiate(emptyCasePrefab, caseSpawnPoint.position, caseSpawnPoint.rotation);

Collider caseCollider = ejectedCase.GetComponent<Collider>();
Physics.IgnoreCollision(caseCollider, playerCollider);

Note that playerCollider is Collider. I also tried with CharacterController(because it's extended from Collider class) but result was same.

Why I said something like "it's not working right after invoked" because it's actually working after passed some time. If it's not work, character controller step on the empty case and makes camera jittering issue on vertical axis. This is totally gone after ignoring collision detection with above code, however it still works right after creation and makes my character really slow.

How do I avoid this weird glitch, makes IgnoreCollision works right after it invokes?

In addition: I don't want to fix this issue with using Layer Collision Matrix. I didn't tried but it will work sure, however I don't want to spend Layer for this purpose only, because it's number is limited and already using lots of layers in other logics so it makes game logic more complicated if I use Layer to avoid collision detection. I want to know why "Physics.IgnoreCollision" not works because literally it saids "ignore collision" but it wasn't.

sentences: ERROR: The application bundle does not contain a valid identifier I'm getting this error "The application bundle does not contain a valid identifier" after my application successfully compiles.This error prevents my game from launching on the phone or the simulator. I have no idea how to fix this as I was following this tutorial How To Make A Space Shooter iPhone Game using Cocos2d.

sentences:
Collisions on editor mode, or saving changes in play mode through script I have a prefab that has a collider. This collider serves as an obstacle. The thing is that I want to remove this collider from all objects inside another collider defining the map limits.

This way, objects inside the game area will keep their collider, but those outside the play area get their collider removed, and serve just as decoration.

I can't use the OnTriggerEnter2D as physics are disabled in editor mode. But applying the changes in play mode is no good neither, as changes are not saved.

How can I create an script that checks if a collider is inside another collide in editor mode, so I can remove it if it does?

Or is there any way to create a script that runs on play mode and use the OnTriggerEnter to delete the collider I want, then save the changes for the editor?

Using bouding boxes is no good, as the collider delimiting the play area is an irregular polygon collider.

Any ideas?

sentences:
Blueprint script executed on tick but not on construction Below, on event tick, I am initializing a map of images once, which works fine (remember we are in a graph for a widget blueprint here).

Z Cursor Images is the map of the images. The keys in the map are an enum, and I am adding first an image for the default cursor, and then an image for when the player is targeting an object that she can pick up.
Now, when I do the same in the construction script (Event Construct), it does not throw an error but later I cannot access the textures from the map. IsValid returns false for them...
So why is the map filled on tick but not on Event Construct? And how do I solve this?

sentences:
Programmatically creating sprite animations in Unity Some background: I have a set of animated gifs which I've converted to spritesheets, which are then imported into Unity as multiple sprites. The end result is that each spritesheet in the Unity editor contains a list of sprites named xxxxxxx_yyy_zzz -- for example:

1313000_000_000 to 1313000_000_014, followed by
1313000_001_000 to 1313000_001_008, followed by
1313001_000_000 to 1313001_000_031,
and so on.

Now, I would like to make simple sprite animations out of this spritesheet. In the example above, 1313000.anim should contain all sprites beginning with 1313000 played in numerical order, 1313001.anim should contain all sprites beginning with 1313001, etc. etc.

This isn't hard to do by hand -- highlight desired range of sprites, drag and drop -- but we're talking about a lot of animations. Creating an editor script which lets me right-click a spritesheet and generate a series of .anim files seemed the best solution, but I'm turning up conflicting info on the subject. Getting a sprite array from the spritesheet is simple enough, but programmatically creating an animation is something very few people seem to have discussed.

Essentially, is it possible and practical to create and populate sprite animations from an editor script?

sentences:
How do I access a struct that resides within a struct in blueprints? I have a struct: "FOuterStruct"

This is defined in code such that it contains another struct type:

Struct OuterStruct
{
    UPROPERTY(...)
        FInnerStruct memberStruct;
}

Now.

When I break an FOuterStruct apart within blueprints, I do not get the FInnerStruct as a pin on the resultant node.

How am I to edit/access this FInnerStruct?

sentences:
How can I compute delta time in a cross platform fashion in C++? I need a way to get time for calculating the delta time.

I see that OpenGL and GLFW have methods for it, but unfortunately I can't use them since I need to make server software too.

What is the best way to get the time, without using OpenGL/GLFWs methods? Either in milliseconds or microseconds.

Note: Must be cross platform, preferably in the default c++ 11 library or a part of the boost library.

sentences:
QuadTree: store only points, or regions? I am developing a quadtree to keep track of moving objects for collision detection. Each object has a bounding shape, let's say they are all circles. (It's a 2D top-down game)

I am unsure whether to store only the position of each object, or the whole bounding shape.

If working with points, insertion and subdivision is easy, because objects will never span multiple nodes. On the other hand, a proximity query for an object may miss collisions, because it won't take the objects' dimensions into account. How to calculate the query region when you only have points?

If working with regions, how to handle an object that spans multiple nodes? Should it be inserted in the nearest parent node that completely contains it, even if this exceeds the node's capacity?

Thanks.

sentences:
Render to Texture2DArray slices in DirectX11? I would like to set a slice of a Texture2DArray as a render target in D3D/DirectX11. It's not clear how to do this.

What I'm looking for is the DirectX equivalent of glFramebufferTextureLayer(), which sets a slice of a GL_TEXTURE_2D_ARRAY_EXT as a texture resource of a Framebuffer Object.

In D3D11, you set a render target using ID3D11DeviceContext::OMSetRenderTargets, and you can set a Texture2DArray resource view as a render target. However, the only way I see to select which slice of the texture is painted is to use the SV_RenderTargetArrayIndex semantic in an HLSL geometry shader. (The semantic is only available in a geometry shader).

My pipline doesn't have a geometry shader, and I don't know at compile time which primitive type I will be rendering - I'm reading models out of input files. It seems like, to add a passthrough geometry shader I would need one shader program for every possible primitive type (terrible).

The desired output slice will not change between rendering passes. Is there no way to set a slice of a Texture2DArray as a render target without using a geometry shader?

sentences:
Rotating each quad in a batch separately? Background

In my app I use the following code to rotate my quad:

Code

    //Rotate the quad

Matrix.setIdentityM(mRotationMatrix, 0);
Matrix.translateM(mRotationMatrix, 0, centreX, centreY, 0f);
Matrix.rotateM(mRotationMatrix, 0, -angle, 0, 0, 0.1f);
Matrix.translateM(mRotationMatrix, 0, -centreX, -centreY, 0f);

And then apply the matrices:

// Combine the rotation matrix with the projection and camera view
Matrix.multiplyMM(mvpMatrix2, 0, mvpMatrix, 0,  mRotationMatrix, 0);
// get handle to shape's transformation matrix
mMVPMatrixHandle = GLES20.glGetUniformLocation(iProgId, "uMVPMatrix");
// Apply the projection and view transformation
GLES20.glUniformMatrix4fv(mMVPMatrixHandle, 1, false, mvpMatrix2, 0);

The above code works great when I'm drawing single quads.

Problem

However, if I have a few quads with the same texture to draw, I batch them up and draw them with one call to glDrawArrays.

I can't work out if it is possible to rotate each individual quad before drawing them (or how to do it if it is possible) - I realise, they will all be rotated the same amount at the same time but this isn't an issue).

Rotation method

public void rotateBatchQuads(int[] coordinates, int angle){

    for (x=0;x<coordinates.length;x+=2){

        //Center of quad (Along the x)
        float centreX = coordinates[x]+quadWidth/2;  //Pseudo code
        float centreY = coordinates[x+1]+quadHeight/2 //Pseudo code
        //Center of quad (Along the y)

        //Rotate the quad
        Matrix.setIdentityM(mRotationMatrix, 0);
        Matrix.translateM(mRotationMatrix, 0, centreX, centreY, 0f);
        Matrix.rotateM(mRotationMatrix, 0, -angle, 0, 0, 0.1f);
        Matrix.translateM(mRotationMatrix, 0, -centreX, -centreY, 0f);
    }
}

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:
XNA 2D rotation Matrix offset/origin I'm currently struggling with finding the offset for my original camera translation after I have applied a rotation for it.

transform = Matrix.CreateScale(new Vector3(1, 0.75f, 1))
            * Matrix.CreateTranslation(-playerpos.X+dash, -playerpos.Y, 1);

rotation = Matrix.CreateRotationX(MathHelper.ToRadians(valuex))
            * Matrix.CreateRotationY(MathHelper.ToRadians(valuey));

transform2 = rotation
            * Matrix.CreateScale(new Vector3(1, 0.75f, 0))
            * Matrix.CreateTranslation(-playerpos.X + dash, -playerpos.Y, 0);

My original transform matrix is for the camera that follows the player, I use transform2 for sprites I want to rotate.

spriteBatch.Begin( SpriteSortMode.Immediate, BlendState.AlphaBlend, null,
                   null, null, null, camera.transform);

spriteBatch.Begin( SpriteSortMode.Immediate, BlendState.AlphaBlend, null,
                   null, null, null, camera.transform2);

Edit:

for (int i = 0; i < 3; i++)
{
  spriteBatch.Draw( world.mcircle[i],
                    new Vector2(5320, 1200),
                    null,
                    Color.White,
                    (world.finishtime * 5) / (i + 1),
                    new Vector2(50, 50),
                    3f,
                    SpriteEffects.None,
                    0);
}

So I pass two different transformations based on whether I want stuff to rotate or not.

But I just can't seem to find the correct offset in position for the rotated sprites, they seem to gravitate towards (0, 0)? as the rotational value increases.

I'd be really glad if someone could help me out with this.

Edit: I think I'd only need a proper origin for the sprite position, because currently it goes towards (0, 0) and I'm unsure how to incorporate one in this state.

Edit:

Tried several origin points for transform2, but when I input the object's coordinates as source, it just displaces it by that amount, and when I set the object's position to (0,0) it still has the same effect as if having the original origin point.

transform2 = Matrix.CreateTranslation(0, 0, 0)
             * (rotation * Matrix.CreateScale(new Vector3(1, 0.75f, 0))
             * Matrix.CreateTranslation((-playerpos.X + dash), -playerpos.Y, 0)); //just an example currently

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:
User input in game loop I am building a simple multi-player fly-around-a-3D-world game in Javascript/webGL/websocket (Chrome, Firefox mostly).

How should I handle and process user input?

My preliminary design (untested) is to first just track which keys are down in the event handler:

var keys = [];

document.onkeydown = document.onkeyup = function(evt) {
   keys[evt.charCode] = evt.type == "keydown";
   keys[CTRL] = evt.ctrlKey;
   keys[SHIFT] = evt.shiftKey;
   websock.send(JSON({time: (new Date()).gettime(),
      down: evt.type == "keydown",
      key: evt.charCode,
      shift: evt.shiftKey, ctrl: evt.ctrlKey }));
};

and then, in my requestAnimationFrame callback, compute how many time-slices (say 20 per second?) have elapsed since the last render callback, and then compute that many time-steps using the booleans in the keys array to determine if to apply a left bank, right bank, up down and accelerate and so that time-step for each player.

How effective / responsive is this?  Is there a better way?  And is there a neater way to deal with latency than just backdating changes for other user's ships?

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:
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:
The Google Earth solution for panning in a 3D world About a year ago I made a solution for panning and zooming in a 3D world (Three.js) using a formula provided by @DMGregory. Here is the post: How to panning camera on XZ axis with different angles

The result is very cool, because it really feels like you are dragging the scene:
https://codepen.io/josema/full/zMeNry

The problem

It turns out that I have to implement a following-object feature. In other words, I have to change the position of the camera to any part of the scene without losing the pan/zoom feature. And I think is not possible with this solution, because in this case the camera.lookAt.y changes when you pan. And it should be 0 to achieve what I want.

This is an example of what I would need, but the "responsive feeling" is not the same. https://threejs.org/examples/misc_controls_orbit.html (right click for panning). In this solution, we can easily say that the camera.lookAt.y is always 0.

The perfect solution is implemented by Google Earth:
https://earth.google.com/web/@40.40420135,-3.6986483,622.13605706a,960.94224964d,35y,-4.92354397h,63.56373285t,0r
Because it has the responsive feeling and the camera.lookAt.y is 0 when panning.

Question

Is it possible to implement something similar to Google Earth easily? If not how would you implement the https://threejs.org/examples/misc_controls_orbit.html?

sentences:
Vulkan rendering of Minecraft-like world in C++ I decided on using 16x16x16 (4096 total) chunks of blocks.

Problem is with textures.
First idea was about texture atlas but it would require a lot of calculation and possible problems in dividing UV (1) by atlas size (power of 2).
Then I was thinking about using array of textures or sampler2darray.

I do not have fixed amount of textures and I reserved uint16 (65,535) for block-only textures (those textures are not used anywhere else, even items have their own item-only textures).
All those textures are loaded before the world (based on loaded "mods").

I got so far that array of textures should be best solution because they support different resolutions (8x8, 16x16, 32x32, 64x64...) without duplicated pixels (which sampler2darray would require when even 1 texture has higher resolution because all textures would be re-scaled to fit it).

Problems I found with array of textures are:

the length must also be defined in shader (which I would need to recompile at runtime)
limited length (256 to 2048 based on vulkan.gpuinfo.org but even Minecraft has 229 block types, some with multiple textures)

Advantages are:

possible "greedy" mesh optimization reducing number of vertices utilizing VK_SAMPLER_ADDRESS_MODE_REPEAT (GL_REPEAT in OpenGL)

Which type of storage for textures is best in this case?

Or should I separate faces by textures, create VkPipeline for each texture and render them one by one?

EDIT:
Each block has at least 1 texture (most time unique) but can be higher then 6 (different texture for each face) when 1 block is made of multiple cubes = non-solid.

sentences:
What's the term for this illustration style common in MMOs/RPGs? Often I was asked for the "style", but I am not sure how to describe it. I just say "mix of anime and realism". But what is it actually called, a style like this example:

It's popular and you see it in most of all mmo/rpgs. I know that it's called "stylized" in 3D-Texturing. But how would you call that typical style like in the link above (not meaning the clothes or what it expresses do be, its about the illustration and character style. Like anime, Fortnite (as it has very unique style) and so on)

sentences:
Transparency in opengl - texture with alpha, color from background I have to draw texture with transparent areas on square. But I don't want this transparencies to take color from this polygon, but from the background. Do you have any good tutorial to achieve it?

--EDIT--

   glColor4f(1,0,0,1);

  glBegin(GL_QUADS);

  glTexCoord2f(0,0); glVertex3f(-0.5, -0.5, -1);
         glTexCoord2f(1,0); glVertex3f(1, -1, -1);
         glTexCoord2f(1,1); glVertex3f(0.5, 0.5, -1);
         glTexCoord2f(0,1); glVertex3f(-0.5, 0.5, -1);

  glEnd();

I just takes color from polygon. How to make this polygon transparent.

sentences:
Why it's not removing the right doors from the list? GameObject[] doorsLeft = GameObject.FindGameObjectsWithTag(c_doorLeft);
        GameObject[] doorsRight = GameObject.FindGameObjectsWithTag(c_doorRight);

        List<GameObject> allDoors = doorsLeft.Union(doorsRight).ToList();

        for(int i = 0; i < allDoors.Count; i++)
        {
            if(allDoors[i].transform.parent.name != "Wall_Door_Long_01" && allDoors[i].transform.parent.name != "Wall_Door_Long_02")
            {
                allDoors.RemoveAt(i);
            }
        }

        foreach(GameObject door in allDoors)
        {
            Debug.Log("Door Parent : " + door.transform.parent);
        }

If it's not "Wall_Door_Long_01" and not "Wall_Door_Long_01" then remove the item from the list.

After that when I'm doing a loop on the allDoors again and debug log the parents I see that some of the parents are not "Wall_Door_Long_01" and not "Wall_Door_Long_02" but after removing they all should be only "Wall_Door_Long_01" or "Wall_Door_Long_02"

Maybe the comparison is wrong ?

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:
SpriteRenderer batching issue, with Z-Position and Order in Layer I have two sprites (they look the same but with different colors):

I want them to be positioned like on the image above, so there's a feel like blue is standing on the green one.
There are two ways to achieve that:

Blue block with Order in layer 1, Green block with Order in layer 0
Blue block with lower Z coordinate, so it's physically in front of the green one.

Both of the concepts appear to break batching between these two objects. They're on the same atlas (I've tested it by setting the same Z position and Sorting Order and batching works).

How can I achieve batching here?

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:
Android Swipe In Unity 3D World with AR I am working on an AR application using Unity3D and the Vuforia SDK for Android. The way the application works is a when the designated image(a frame marker in our case) is recognized by the camera, a 3D island is rendered at that spot. Currently I am able to detect when/which objects are touched on the model by raycasting. I also am able to successfully detect a swipe using this code:

if (Input.touchCount > 0)
{
         Touch touch = Input.touches[0];

         switch (touch.phase)
         {
                case TouchPhase.Began:

                    couldBeSwipe = true;

                    startPos = touch.position;

                    startTime = Time.time;

                break;

                case TouchPhase.Moved:

                    if (Mathf.Abs(touch.position.y - startPos.y) > comfortZoneY)
                    {

                        couldBeSwipe = false;

                    }
                    //track points here for raycast if it is swipe
                break;

                case TouchPhase.Stationary:

                    couldBeSwipe = false;

                break;

                case TouchPhase.Ended:

                    float swipeTime = Time.time - startTime;

                    float swipeDist = (touch.position - startPos).magnitude;

                    if (couldBeSwipe && (swipeTime < maxSwipeTime) && (swipeDist > minSwipeDist))
                    {

                        // It's a swiiiiiiiiiiiipe!

                        float swipeDirection = Mathf.Sign(touch.position.y - startPos.y);

                        // Do something here in reaction to the swipe.
                        swipeCounter.IncrementCounter();
                    }

                break;

            }

         touchInfo.SetTouchInfo
          (Time.time-startTime,(touch.position-startPos).magnitude,Mathf.Abs (touch.position.y-startPos.y));
       }

Thanks to andeeeee for the logic. But I want to have some interaction in the 3D world based on the swipe on the screen. I.E. If the user swipes over unoccluded enemies, they die. My first thought was to track all the points in the moved TouchPhase, and then if it is a swipe raycast into all those points and kill any enemy that is hit. Is there a better way to do this? What is the best approach?

Thanks for the help!

sentences:
How to prepare a rigged character model to be imported as a humanoid in unity? I want to import a character as a humanoid to be able to use masks on animation system. I used proper human structure but unity gives some errors when I want to turn it from generic to humanoid and says some bones are not in the right place or have a wrong name.

The questions is how should a rigged model be prepared in modeling program to be imported in unity as humanoid?

sentences:
How can I find when moving the mouse pointer over raw image to what file it belong to? I have on the hard disk some images and saved files. Each image have his saved file.
10 images and 10 saved files :

Then I'm loading the images to rawimages and when running the game it looks like that :

This script is loading the images to raw images :
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()
    {
        imagesToLoad = Directory.GetFiles(Application.dataPath + "/screenshots", "*.png");
        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);
            string fileName = imagesToLoad[i];
            byte[] bytes = File.ReadAllBytes(fileName);
            thisTexture.LoadImage(bytes);
            thisTexture.name = fileName;
            go.GetComponent<RawImage>().texture = thisTexture;
        }
    }

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

    }
}

And the last script is for moving the mouse over the raw images and then it's making each image the mouse cursor is over to be brighter :
using System.Collections;
using System.Collections.Generic;
using System.Drawing;
using System.Drawing.Imaging;
using UnityEngine;
using UnityEngine.EventSystems;
using UnityEngine.UI;

public class MouseHover : MonoBehaviour
{
    public SaveLoad saveLoad;
    public SceneFader sceneFader;
    public RawImagePixelsChange rawImagePixelsChange;

    private bool loadGame = false;

    public void OnHover()
    {
        Debug.Log("Enter");
        rawImagePixelsChange.modifyPixels(0.3f);
        PlaySoundEffect();
        loadGame = true;
    }
    public void OnHoverExit()
    {
        Debug.Log("Exit");
        rawImagePixelsChange.restorePixels();
        loadGame = false;
    }

    private void Update()
    {
        if(loadGame)
        {
            if (Input.GetMouseButtonDown(0))
            {
                StartCoroutine(sceneFader.FadeAndLoadScene(SceneFader.FadeDirection.In, "Game"));

                loadGame = false;
            }
        }
    }

    private void PlaySoundEffect()
    {
        transform.GetComponent<AudioSource>().Play();
    }
}

In this script the MouseHover I want to find and get the save file name the mouse cursor is over the image that belong to the saved file. Either inside the OnHover function or inside the GetMouseButtonDown.
Maybe it's be if I will save each image and it's saved file in another folder to identify easier what image belong to what saved file.
now the way the images and saved files are on the hard disk each image the saved file to his left are belong to each other they have saved the same time. So when I click the button mouse down in the MouseHover script it should load the specific saved file the mouse cursor is over the image.

sentences:
Why doesn't my wave movement code account for the game object's initial position? I want an object to move like wave. Currently, when I start the game the object's position doesn't account for its initial position. How would I fix this?

float amplitudeX = 5.0f;
float amplitudeY = 2.5f;
float omegaX = 0.5f;
float omegaY = 2.5f;
float index;

public void Update() {
    index += Time.deltaTime;
    float x = amplitudeX*Mathf.Cos (omegaX*index);
    float y = Mathf.Abs (amplitudeY*Mathf.Sin (omegaY*index));
    transform.localPosition= new Vector3(x,y,0);
}

sentences:
WebGL: Texture appears as black I have a simple WebGL canvas, where I'm attempting to render a texture on a square. When working with textures as local files, all is fine. But when I try to load a texture from the web, I get a black canvas.

Please see this fiddle for a demo. I have made the shaders and JavaScript very simple.

sentences:
Vector field based game engine Does an engine using a vector field exist?

What I mean is that instead of calculating intersections, for example one could calculate the vector field generated by gravity and for the ground and let the object follow those fields.

What are the advantages and drawbacks of this kind of game engine?

sentences:
Where is Light in Game view Very Basic Question.when i run the the game the game Mode is Too dark as shown below in the picture. please suggest me some Setting how to globally switch on built in light while Running the game in game mode.

Thanks.

sentences:
Doing a passable 4X game AI I am coding a rather "simple" 4X game (if a 4X game can be simple). It's indie in scope, and I am wondering if there's anyway to come up with a passable AI without having me spending months coding on it.

The game has three major decision making portions; spending of production points, spending of movement points and spending of tech points (basically there are 3 different 'currency', currency unspent at end of turn is not saved)

Spend Production Points

Upgrade a planet (increase its tech and production)
Build ships (3 types)

Move ships from planets to planets (costing Movement Points)

Move to attack
Move to fortify

Research Tech (can partially research a tech i.e, as in Master of Orion)

The plan for me right now is a brute force approach. There are basically 4 broad options for the player -

Upgrade planet(s) to its his production and tech output
Conquer as many planets as possible
Secure as many planets as possible
Get to a certain tech as soon as possible

For each decision, I will iterate through the possible options and come up with a score; and then the AI will choose the decision with the highest score. Right now I have no idea how to 'mix decisions'. That is, for example, the AI wishes to upgrade and conquer planets at the same time. I suppose I can have another logic which do a brute force optimization on a combination of those 4 decisions....

At least, that's my plan if I can't think of anything better. Is there any faster way to make a passable AI? I don't need a very good one, to rival Deep Blue or such, just something that has the illusion of intelligence.

This is my first time doing an AI on this scale, so I dare not try something too grand too. So far I have experiences with FSM, DFS, BFS and A*

sentences:
How to move vertices of matrix in order to cast a 2d shadow? I am trying to add shadows to my 2D xna game. Currently I have created a "shadow" using the texture of the caster with a transparent gray color, rotated, and stretched using a matrix. This, though, does not look like a real shadow, obviously. What I'm pretty sure I have to do is individually move the vertices of the matrix somehow in order to create a parallelogram so that the top and bottom sides are always parallel to the ground.

So, here are my questions:

1) Is this the correct way to cast shadows in a 2D game?

2) If so, how do I make a parallelogram out of the matrix? I've tried a vertex shader but that didn't go very well. I've also seen some people talk about using bones and using DynamicVertexBuffer, but I have no clue how to use them and can't find a tutorial on them.

3) If it isn't the correct way of casting shadows, then how should I do it? I don't want shadows like in Catalin's method, I want them to look like the shadow caster.

EDIT: I also just learned that the transformation I think I need to do is skew the matrix. XNA unfortunately does not include methods to do that, though.

EDIT 2: Here's a picture of the type of affine transformation I want to do (skewing):

I have sort of solved the problem and in-case anyone else wants to know how to skew horizontally here is how:

Matrix skew = Matrix.Identity;
skew.M12 = (float)Math.Tan(Math.PI / 4); // replace Math.PI / 4 with the radian amount you want

I need to skew vertically (which I can do by rotating and rotating back, but is there a more efficient way?), though and would still like to know if this is the correct way of going about creating shadows in a 2D game, though

EDIT 3: Here's what I have done in my game, and this is how the shadows should look. I've used a bunch of math and transforming to achieve the matrix for the shadow. Hopefully I've done it the right way

sentences:
Unity: why game app on Android takes up much more memory than Unity Profiler reports? We are profiling a game app on Android 4.4.2 device via Unity’s ADB profiling.

We have set up ADB profiling following the official guide: http://docs.unity3d.com/Manual/Profiler.html

The ADB profiling works fine, when the app is running, Unity Profiler reports its memory usage as following:

Used Total: 100.4 MB  Unity: 40.5 MB  Mono: 10.1 MB  GfxDriver: 34.9 MB  FMOD: 3.9 MB  Profiler: 14.8 MB
Reserved Total: 112.8MB  Unity: 47.0 MB  Mono: 15.4 MB  GfxDriver: 34.9 MB  Profiler: 15.5 MB

Meanwhile, we are also running another performance test tool (i.e. Emmagee, https://github.com/NetEase/Emmagee) to monitor the app, which can monitor CPU, memory, network traffic, battery current and etc. However, the memory usage of the app reported by Emmagee tool is much larger:

As shown above, Unity Profiler reported 112.8M memory is totally reserved for running the app, but Emmagee tool reported >200M PSS memory is used. Obviously, more than 90M memory taking up is happened somewhere by something that Unity Profiler does not take into account.

(We also tried other performance monitoring tool for Android apps, e.g. APT, and the result is similar to what Emmagee reported. The extra memory usage problem remains.)

We noticed that the Unity Profiler itself would take up ~15M memory, which is included in the profiler’s report. Also, we knew that PSS memory includes proportional shared libraries with other processes, but 90M+ extra is such large amount considering that Unity Profiler only reported 112.8M totally.

Our puzzle remained: Where does the 90M+ memory come from? How are they used by the app? Why Unity Profiler does not report the extra memory? What can we do for reducing the extra memory and the total PSS memory of the running app, and/or get it close to what Unity Profiler reports?

Any help could be appreciated!

sentences:
how to rotate enemy to face player? Okay so i havebeen rotating my enemy to face the player using

float targetrotation = Math.Atan2(playerpos-enemypos);
enemy.rotation = targetrotation; (<this line of code i want to change)

This simple method has worked fine so far for getting the enemy to look at the player's position. However i decided to add some extra code to get the enemy to gradually rotate towards the player using this method:

if(enemy.rotation < targetrotation)
{
   enemy.rotation++;
}

if(enemy.rotation > targetrotation)
{
   enemy.rotation--;
}

Now the problem i am having is that when the player moves for example from 360 degree target to 1 degree then the enemy rotates the long way round to move to the 1 degree instead of simply adding 1 degree. Any help on how to correct this problem would be welcomed. I have a picture below:

sentences: Play Protect Submission I just filled submission form for google play protect for my new-developed game. the problem is with URL download link. I used file.io to generate a direct download link. it worked fine for the first time but now error 404 for "not found" is shown. I re-submit a new form with same information but different URL to download my APK (I used DropBox to generate direct link and bit.ly for shortening the link) but google told me via email that it doesn't need to re-submit. I know that the the process for accepting my game could last for 7-10 days. what do you suggest?

sentences:
Authenticate player on backend server with google login I would like to create a mobile game which communicates with my own backend server.

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

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

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

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

sentences:
SDL_Image setup problems on windows / mingw 64 / eclipse I've been a software developer for a while, but I haven't done C++ in a long time and I thought I'd try it out with some game developement.  I'm following the tutorial on youtube for Remaking Cavestory in C++ (great tutorial so far).  I'm on Episode 4.  I liked the sound of doing some 64 bit dev, so after a bunch of struggling I got SDL2 to work, scouring the internet and some trial & error I got it set up using the x86_64 libraries with a MinGW-w64 installation.  I opted not to copy lib and include files into mingw as suggested by some guides.  Instead, I figured I could "point" eclipse at the proper folders and everything should work.  This was true up until trying to integrate the SDL_Image library.  I have everything set up such that SDL.h is found by the compiler, and SDL_image.h is found by the compiler.  That is, the SDL.h and SDL_image.h as referenced by my project code are fine.  The problem is the compiler fails on SDL_image.h because IT references SDL.h and that reference is apparently bad.

Windows 10 64 bit (pro I think, though I doubt it matters)
eclipse Neon.2 (4.6.2)
MinGW-w64 (I think 4.3.0)
SDL2 (2.0.5)
SDL_image (2.0.1)

Here's where all of my files are:

C:\MinGW-w64\mingw64
C:\MinGW-w64\mingw64\bin
C:\MinGW-w64\mingw64\include
C:\MinGW-w64\mingw64\lib
C:\MinGW-w64\mingw64\x86_64-w64-mingw32
C:\MinGW-w64\mingw64\x86_64-w64-mingw32\bin
C:\MinGW-w64\mingw64\x86_64-w64-mingw32\include
C:\MinGW-w64\mingw64\x86_64-w64-mingw32\lib

F:\Dev\SDL2-2.0.5\x86_64-w64-mingw32
F:\Dev\SDL2-2.0.5\x86_64-w64-mingw32\bin
F:\Dev\SDL2-2.0.5\x86_64-w64-mingw32\include
F:\Dev\SDL2-2.0.5\x86_64-w64-mingw32\lib

F:\Dev\SDL2_image-2.0.1\x86_64-w64-mingw32
F:\Dev\SDL2_image-2.0.1\x86_64-w64-mingw32\bin
F:\Dev\SDL2_image-2.0.1\x86_64-w64-mingw32\include
F:\Dev\SDL2_image-2.0.1\x86_64-w64-mingw32\lib

In eclipse I have the following configured:

Project -> Properties -> C/C++ Build -> Settings -> Tool Settings -> GCC C++ Compiler -> Includes:

"${workspace_loc:/cavestory-development/source/headers}"
"F:\Dev\SDL2-2.0.5\x86_64-w64-mingw32\include"
"F:\Dev\SDL2_image-2.0.1\x86_64-w64-mingw32\include"

Project -> Properties -> C/C++ Build -> Settings -> Tool Settings -> MinGW C++ Linker -> Libraries:

(top box: Libraries (-l))

SDL2
SDL2main
SDL2_image

(bottom box: Library search path (-L)

"F:\Dev\SDL2-2.0.5\x86_64-w64-mingw32\lib"
"F:\Dev\SDL2_image-2.0.1\x86_64-w64-mingw32\lib"

Project -> Properties -> C/C++ General -> Paths and Symbols -> Includes -> GNU C++:

/cavestorye-development/source/headers
F:\Dev\SDL2-2.0.5\x86_64-w64-mingw32\include
F:\Dev\SDL2_image-2.0.1\x86_64-w64-mingw32\include

Project -> Properties -> C/C++ General -> Paths and Symbols -> Libraries:

SDL2
SDL2main
SDL2_image

Project -> Properties -> C/C++ General -> Paths and Symbols -> Library Paths:

F:\Dev\SDL2-2.0.5\x86_64-w64-mingw32\lib
F:\Dev\SDL2_image-2.0.1\x86_64-w64-mingw32\lib

I've also copied all of the DLLs from these two folders into my Debug (where my .exe is created)

F:\Dev\SDL2-2.0.5\x86_64-w64-mingw32\bin
F:\Dev\SDL2_image-2.0.1\x86_64-w64-mingw32\bin

When I build the project, I get the following error:

F:\Dev\SDL2_image-2.0.1\x86_64-w64-mingw32\include/SDL2/SDL_image.h:27:17: fatal error: SDL.h: No such file or directory

It seems that when the compiler looks at SDL_image.h, it sees that THAT file includes SDL.h, which it can't find.  Again, this worked when I was only including SDL2, and broke when I tried to include SDL2_image because the image library references the normal library in a way that can't be reconciled.

Has anyone dealt with this before?  Let me know if I've left out any pertinent information.

sentences:
How to implement turn-based game engine? Let's imagine game like Heroes of Might and Magic, or Master of Orion, or your turn-based game of choice. What is the game logic behind making next turn? Are there any materials or books to read about the topic? To be specific, let's imagine game loop:

void eventsHandler(); //something that responds to input
void gameLogic(); //something that decides whats going to be output on the screen
void render(); //this function outputs stuff on screen

All those are getting called say 60 times a second. But how turn-based enters here? I might imagine that in gameLogic() there is a function like endTurn() that happens when a player clicks that button, but how do I handle it all? Need insights.

sentences: How Plants vs Zombies animation is done? I really like the plants vs zombies style of animation and it doesn't look complicated yet the result is really good. I doubt it's made of sprites seeing there's a large number of animations, combinations, distortions, outfits. So how that kind of animation is done?

sentences:
LibGDX - Centering different sized Tile Map Levels Suppose I have a Level 1 tilemap which is 32 x 16 tiles in size, and when the player exits into another room, which is on 10 x 6 tiles in size, what's the best way to center the viewport. At the moment I am positioning my game cam as follows:

    gameCam = new OrthographicCamera();
    gameCam.setToOrtho(false,320,240);
    gamePort = new FitViewport(Darkcaster.V_WIDTH / Darkcaster.PPM, Darkcaster.V_HEIGHT / Darkcaster.PPM, gameCam);
    gameCam.position.set(gamePort.getWorldWidth() / 2, gamePort.getWorldHeight() / 2, 0);

The 320x240 is the screen resolution I wanted, and V_WIDTH/V_HEIGHT was also set to 320/240, as this was the size of my first level.

What I want is the smaller level to be centered in the screen (like a mini bonus room) and then I can fill the rest with black, but the scale of the tiles etc needs to stay the same.

I can get the map properties to work out how wide and tall each map is, but can't work out the math I need to get it working.

Obviously on levels which are bigger than the viewport (scrolling levels) the camera would just be centered on the player, but the smaller level would be in the center of the screen and not scroll.

Any ideas on the best way to achieve this?

Thanks

J

sentences:
libpng warning: iCCP: known incorrect sRGB profile I was working with SDL2 and when I loaded some textures, I got this warning in the console libpng warning: iCCP: known incorrect sRGB profile
Though this doesn't cause any error, everything works fine but I just wanted to know what this warning is about.

This is the picture I'm trying to load, maybe the fault is in the picture?

sentences:
How to make Volume Heat Distortion effect in OpenGL? I'm working on adding volume effects to an existent, open-source game engine. At the moment, the engine only supports two dimensional "thruster" bitmaps with a planar heat distortion drawn over the bitmap.

Is it possible to make a Volume filling Heat Distortion? If so, what would be the general idea behind it?

sentences:
How to deal with D3DX .dll hell? There's a large number of versions of the D3DX dll, from each SDK update, each version having a unique name (list of D3DX dll names).

All-too-often, people have versions missing. So even though they have a compatible version of DirectX, your D3D-based project won't run on their machine.

I want to be able to distribute games (little spare-time projects, game jam entries, etc) as a simple zip file, without the need for an installer. But a significant percentage of users run into missing D3DX .dll errors. And without an installer, Microsoft's official solution (the DirectX web installer/updater) isn't really much of a solution.

Unfortunately, Microsoft still won't give us the option of static linking to D3DX (which would be a nice clean solution). And avoiding using D3DX isn't very practical, especially if you're working with shaders (and no, I'm not switching to OpenGL, at least for now)

Does anyone have clever solutions to avoiding this DLL hell?

sentences:
Mobile game: Optimization only working on some devices / Render big texture causes stuttering after level load I'm currently optimizing the rendering of the background of my mobile game. The background consists basically of many colored dots. Since the background is static I'm able ro render the whole background into a 1024x1024 texture (render to texture), so the colored dots don't have to rendered in realtime (especially the blending is gpu intensive).

Unfournately this "optimazation" is only an optimazation for certain devices.

My Notebook:
Without optimazation: 400 FPS
With optimazation:    800 FPS

My gaming pc:
Without optimazation:   1100 FPS
With optimazation:    > 2000 FPS

Consider that mobile devices have a frame cap of 60.

Samsung Galaxy Nexus:
Without optimazation: 40 FPS
With optimazation:    60 FPS

LG G2 mini:
Without optimazation: 60 FPS
With optimazation:    60 FPS, but with stutters after loading a new level, which
                              disappear over time

I don't have the slightest idea why the optimazation isn't working for the LG G2 mini.
So the LG G2 mini is faster at real time rendering many small colored dots but slower at rendering a single texture? It's also weird that the stutters only occur after loading a new level but vanish after a little time?

Game is written in C++ using cocos2d-x, but I don't think its a cocos2d-x related issue.

sentences:
Should a game object class contain the information for how to render it? If I have a class called Enemy:
// Simplified version
class Enemy
{
    float xPosition_;
    float yPosition_;
    int hp_;
};

Should this class also contain the information needed to render an enemy?
Like in these two examples:
class Enemy
{
    float xPosition_;
    float yPosition_;
    int hp_;
    Model renderModel_;
};

class Enemy
{
public:
    void drawSelf(Window& window);
private:
    float xPosition_;
    float yPosition_;
    int hp_;
};

Or should the rendering information be inside a special renderEnemy function?
void renderEnemy(const Enemy& enemy)

Which is the better alternative?

sentences:
Box2D/Farseer - Moving fixtures on a Static Body I am attempting to create a Pool of Fixtures, in order to reduce memory consumption.  My problem is that when I attempt to return a Fixture to the Pool and re-assign its position on the Parent Body, once it is repositioned the Fixture no longer provides any collision response with other world objects.

It seems that if you want to move a Fixture on a Static body, it needs to be destroyed and re-created.  This method doesn't allow me to use my Pool however.

Does anyone know if it is possible to move a Fixture on a Static Body?  I do not want to move the Body, but the Fixtures attached to it.

sentences:
My sprite walking animation code doesn't work at all This is my first time doing code for a game so I followed some online tutorials.

When I got to the walking and the jumping animation I just can't get it to work whatever I do.

I tried multiple codes but it doesn't work.

My animation code right now:

//animation
if (!place_meeting(x,y+1,Owhitetile))
{
    sprite_index = Scute_character_jump_right;
    image_speed = 0;
    if(sign(vspeed)  < 0) image_index = 0;
}
else
{
    image_speed = 1;
    if(hspeed == 0)
    {
        sprite_index = Scute_character_right;
    }
    else
    {
        sprite_index = Scute_character_walk;
    }
}

All my code so far

//player imput
key_left = keyboard_check (vk_left);
key_right = keyboard_check (vk_right);
key_jump = keyboard_check_pressed (vk_space);

//calculate movement
var move = key_right - key_left;

hspeed = move * walksp;
vspeed = vspeed + grv;

if (place_meeting(x,y+1,Owhitetile)) and (key_jump)
{
    vspeed=-7;
}

//horizontal colision
if (place_meeting(x+hspeed,y,Owhitetile))
{
    while (!place_meeting(x+sign(hspeed),y,Owhitetile))
    {
        x = x + sign(hspeed);
    }
    hspeed = 0;
}
x = x + hspeed;

//vertical colision
if (place_meeting(x,y+vspeed,Owhitetile))
{
    while (!place_meeting(x,y+sign(vspeed),Owhitetile))
    {
        y = y + sign(vspeed);
    }
    vspeed = 0;
}
y = y + vspeed;

//player death
if (place_meeting(x,y+vspeed,Ospikes))
{

   instance_destroy()
   game_restart()

}

//animation

if (!place_meeting(x,y+1,Owhitetile))
{
    sprite_index = Scute_character_jump_right;
    image_speed = 0;
    if(sign(vspeed)  < 0) image_index = 0;
}
else
{
    image_speed = 1;
    if(hspeed == 0)
    {
        sprite_index = Scute_character_right;
    }
    else
    {
        sprite_index = Scute_character_walk;
    }
}

sentences: How would I use an object from another animation in Unity? So I have two different .blend files with two different animations. Let's call my aiming with a gun animation animation A, and my other .blend file with idle, run, and jump animations animation B. If I wanted to play the aiming clip from animation A with the Animation B animator, it just looks like my character wants to shake hands, since the gun doesn't appear in the animation. The aiming animation works if I play animation A with animation A's animator. How would I use the gun object from animation A when playing animation A in animation B's animator?  Here is an image of what the animation looks like in the import settings (what i want) and in the actual game (what is happening which I don't want.) The top image is what I want and the bottom image is what is happening. Thanks in advance.

sentences:
slow/fast/slow experience system I am looking for an experience ladder that 'starts' off relatively quickly like a bit of geometric series, then quickly grows like an exponential curve, and then a slow exponetial curve for later levels, in the range of levels 1-5000.

How would I do this mathematically? I am assuming I might just have three sets of equations, but then what is the correct math for getting the level (based on XP), and vice-versa, XP based on level?

I.e., I am thinking something like:

lvl 1 - 10 exp
lvl 2 - 12 exp
lvl 3 - 15 exp
lvl 4 - 18 exp
lvl 5 - 22 exp (not quite fibacconi)
lvl 6 - 26 exp
lvl 7 - 32 exp
...
then maybe around level 150 or so it starts growing quickly, like
lvl 150  -1000 exp
lvl 151 - 1200 exp
...
lvl 3000 - 30000 exp
lvl 3100 - 40000 exp
lvl 4000 - 75000 exp
lvl 5000 - 100000 exp

If it's been done, a link would be great (since I am not exactly sure what I am looking for, not quite sure how to find it). Or if it is easy for you to just write the math, please do that too, thanks for your help!

sentences:
Concerns about APK version compatibility I'm making a game in Unity, and i want to know if I generate the apk in version 4.1 Jelly Bean he will run in newest versions of android?
Can anyone explain me better how the version works?

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:
Multiplatform game, save game state and resume it on other platform This is for a personal and knowledge acquiring project.

I want to create a little TIC-TAC-TOE multiplatform game, app & web. The choosen technology for the app will be Android or Flutter and for the web Angular.

My doubt is, during a game if the user wants to change from the mobile version to the web version, how to resume or change the game to the web application? What would be the best way to save the game state and load it into the other platform? Having in consideration that the user will play only in one platform at a time, which is the best way to implement this restriction too?

Is this as simple and hard at the same time as implementing all controls in both platforms and storing all the data required in the database?

sentences:
How to implement marching cube algorithm for rendering clouds I would like to render clouds using C#, directX9.0

using Microsoft.DirectX.Direct3D;
using Microsoft.DirectX;

Now I have roughly add and render the vertex as per below:

As you can see, the vertex is added in a cubic structure. And what I need to do now is to change the cubic structure to curve structure so that the whole cubic structure should looks like a cloud.

I am not using any graphic library but to build this structure solely using Microsoft.DirectX and DirectX.Direct3D

I did some Google search, and it seems the cube marching algorithm is a useful method to be implemented on these kind of 3D rendering.

From what I researched, there are no ready source for C#, but only for C++ for cube marching algorithm.

So, I would like to ask, if I only want to do the cloud rendering, is the marching cube algorithm a must? Or are there other options to align the structure to let it look like a cloud?

I totally have no idea at all, hope could look for some snipshot of source code or any good reference in C# using DirectX.dll

sentences:
Which pathfinding algorithm should I use for multiple enemies and tower placement? I am new to game development and I am developing my first "Tower Defense"-type game.

I need a pathfinding algorithm to place my towers and to move enemies.

For tower placement case: I want the algorithm to run from entry to exit so that if it passes, the user can place tower and if fails user can't.
For the enemy case: it should help multiple enemies to find their shortest path by running it for each enemy's current position to exit.

Searching about path finding I have found some algorithms like Floyd–Warshall, A*, Breadth First, Dijkstra's and some others. Some answers give priority to Floyd's over it for path finding with multiple enemies. So what do you suggest that I use for my case?

My grid size is 17x23 and my game would have multiple entry and exit points in future.
I am using the Unity game engine and scripting in C#.

sentences:
In Unity, how do I make a mesh change its opacity during runtime? I'm trying to make a isometric game. I want to make it so that when the player goes behind a wall, the wall's alpha goes down.

How do I go about doing this?

I have this code that I made, but I don't understand what's wrong with it.

I already have the wall that's meant to disappear on the "Wall" layer.

using UnityEngine;
using System.Collections;

public class WallAlpha : MonoBehaviour {

    public LayerMask mask =LayerMask.GetMask("Wall");

    void Update() {

        if (Physics.Raycast(transform.position, transform.forward, 100, mask.value))
        {
            transform.GetComponent<Renderer>().material.SetColor("_Color", new Color(1,1,1,0.1f));
            Debug.Log("Something in the way");
        }

        else
        {
            transform.GetComponent<Renderer>().material.SetColor("_Color", new Color(1,1,1,1.0f));
            Debug.Log("Nothing In the Way!");
        }
    }
}

sentences:
How do I render 2D top-down tiled, directed water flow? I'm working on a top-down tile-based fairly graphical 2D game inspired by Dwarf Fortress. I'm at the point of implementing a river in the game world, which covers a number of tiles, and I've calculated the flow direction for each tile, as shown below by the red line in each tile.

For reference of the graphical style, here's how my game looks currently:

What I need is some technique to animate water flowing in each of the river tiles, so that the flow blends into the surrounding tiles so that tile edges are not apparent.

The closest example I have found to what I am after is described at http://www.rug.nl/society-business/centre-for-information-technology/research/hpcv/publications/watershader/ but I'm not quite at the point of being able to understand what's going on in it? I have enough of an understanding of shader programming to have implemented my own dynamic lighting but I can't quite get my head around the approach taken in the linked article.

Could someone explain how the above effect is achieved or suggest another approach to get the result I want? I think part of the above solution is overlapping the tiles (though I'm not sure in which combinations) and rotating the normal map used for the distortion (again no idea on specifics) and past that I'm a bit lost, thanks for any help!

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:
What is the equivalent node in UE4 for Blender's Musgrave Node? I'm trying to recreate Poliigon's non-tiling nodes https://www.youtube.com/watch?v=-VgtSL5ZpYc, in UE4, and the only thing so far I don't see the equivalent to is the Musgrave node https://docs.blender.org/manual/en/latest/render/shader_nodes/textures/musgrave.html, though UE4 has Perlin 3D Noise nodes, I don't see octave control described here https://docs.unrealengine.com/en-US/Engine/Rendering/Materials/ExpressionReference/Vector/index.html

Is there a way to accomplish this? I assume so, UE4 cannot not have it... unless they already have a non-tiling node function already, and I don't know about it.

sentences: How many Pipelines in a Typical Rendered Scene DirectX12 I'm learning DirectX12 right now and I'm missing a few pieces of the puzzle in my own head on the overall structure of how you would setup a game. Specifically, I'm trying to get an idea of how shaders are processed through the pipeline. So in DirectX12, there seems to be a lot of work to setup a pipeline state object (PSO) and then you can assign one each of the following vertex, pixel, domain, hull, and geometry shaders. Well, it seems like there are probably many different shaders being rendered at one given time, so you would have your water shaders, glass shaders, ground, etc.. and you would need a separate pixel shader for each of these correct? So if you had about 50 pixel shaders running on a particular frame, you would need to create and configure another 50 pipeline objects? This seemed like overkill to me, so I'm just trying to figure out how this would work in a real world game engine. Thanks!

sentences:
How can I scroll/animate up lines reading from a string to ui text? This is the reading lines code :
if (primaryTarget != null)
            {
                var lines = primaryTarget.description.Split('\n');
                text.text = "Item found: " + primaryTarget.description;
            }
            else
            {
                text.text = "";
            }

And this is the script of the description :
The script is attached to each interactable target(item) :
using System.Collections;
using System.Collections.Generic;
using UnityEngine;
using UnityEngine.UI;

public class InteractableItem : MonoBehaviour
{
    public enum InteractableMode // your custom enumeration
    {
        Description,
        Action
    };

    public InteractableMode interactableMode = InteractableMode.Description;

    public float distance;

    private bool action = true;

    [TextArea(1, 10)]
    public string description = "";

    public void ActionOnItem()
    {
        if(interactableMode == InteractableMode.Action && distance <= 5f && action == true)
        {

            action = false;
        }
    }
}

Depending on the amount of text in the string I want to show it in the ui Text.
If there is one line then just show the text or even if there are two lines.
but if there is a lot of text then split the lines and scroll the lines smooth up so the first line will be disappear or pushed up and bottom lines will come up.
In the screenshot you can see on the left the text that show in the ui text on the right the text of the description. The ui text can't show all the text and I don't want the text to overlap other ui's or objects so the idea is to make the text slowly smooth scrolling up.

sentences:
Distinguish touch gestures for distinct horizontal and vertical commands In my script below I'm using horizontal and vertical swipe gesture to move the character but both gestures are called on a single touch.

void Update ()
{
  HorizontalSwipe();
  VerticalSwipe();
}

void HorizontalSwipe()
{
  foreach ( Touch FingerTouchx in Input.touches ) {
    if( FingerTouchx.fingerId < 1 ){  //         FINGERID
      if(FingerTouchx.phase == TouchPhase.Began) {
        FingerInitialPositionx = FingerTouchx.position.x;
      }
      else if(FingerTouchx.phase == TouchPhase.Moved) {
        FingerMovedPositionx = FingerTouchx.position.x;

        if(FingerMovedPositionx > FingerInitialPositionx)
          charcter.transform.Translate(Vector2.right * speed * Time.deltaTime);
        else if(FingerMovedPositionx < FingerInitialPositionx)
          charcter.transform.Translate(-Vector2.right * speed * Time.deltaTime);
      }
      else if(FingerTouchx.phase == TouchPhase.Ended) {
        FingerInitialPositionx = 0f;
        FingerMovedPositionx = 0f;
      }
      else {
        FingerMovedPositionx = FingerTouchx.position.x;

        if(FingerMovedPositionx > FingerInitialPositionx)
          charcter.transform.Translate(Vector2.right * speed * Time.deltaTime);
        else if(FingerMovedPositionx < FingerInitialPositionx)
          charcter.transform.Translate(-Vector2.right * speed * Time.deltaTime);
      }
    }
  }
}

void VerticalSwipe()
{
  foreach (Touch FingerTouchy in Input.touches) {
    if( FingerTouchy.fingerId < 1){      //         FINGERID
      if(FingerTouchy.phase == TouchPhase.Began)
        FingerInitialPositiony = FingerTouchy.position.y;

      if(FingerTouchy.phase == TouchPhase.Moved) {
        FingerMovedPositiony = FingerTouchy.position.y;

        if(FingerMovedPositiony > FingerInitialPositiony)
          charcter.transform.Translate(Vector2.up * speed * Time.deltaTime);

        if(FingerMovedPositiony < FingerInitialPositiony)
          charcter.transform.Translate(-Vector2.down * speed * Time.deltaTime);
      }

      if(FingerTouchy.phase == TouchPhase.Ended) {
        FingerInitialPositiony = 0f;
        FingerMovedPositiony = 0f;
      }
    }
  }
}

Whats wrong here? My game character moves in the swipe direction along with continuous jumps.

What I want to achieve is that the character should move horizontally with one touch gesture and vertically(jump) with another touch gesture.

For example: the gesture made on the lower left corner of the touch screen should only consider horizontal movement and make the character move left or right, while the gesture made on the lower right corner should consider only the vertical movement and make the character jump. I'd like to achieve something similar to what's in Leo's Fortune.

sentences:
Inverse transformation matrix for checking whether a point is inside a rect I'm trying to determine which nodes in my scene graph contain a given point in global coordinate space, using the inverse of the node's global transformation matrices.

Here's a simplified version of the Node (real version does dirty checks and caches matrix etc).

class Node {
  parent: Node;

  width: number;
  height: number;

  translation: Vec2;
  rotation: number;
  scale: number;

  // Get the transformation matrix required to draw this node onscreen
  get matrix() {
    let mat = mat2d.clone(this.parent.matrix);
    mat2d.translate(mat, mat, this.translation);
    mat2d.rotate(mat, mat, this.rotation);
    mat2d.scale(mat, mat, [this.scale, this.scale]);
    this.matrix = mat;
  }

  // Check if point is inside this node's rect
  contains(x: number, y: number) {
    let point = this.toLocalPoint(x, y);

    return (
      point.x >= this.translation.x &&
      point.y >= this.translation.y &&
      point.x <= this.translation.x + this.width &&
      point.y <= this.translation.y + this.height
    );
  }

  // Convert a point in global space to local space
  toLocalPoint(x: number, y: number) {
    let inverse = mat2d.create();
    mat2d.invert(inverse, this.matrix);

    let point = vec2.fromValues([x, y]);
    vec2.transformMat2d(point, point, inverse);

    return point;
  }

}

This is working fine for the renderer. Here's an example of how that looks for reference.

for (let node of nodes) {
  renderer.push(node.matrix);
  renderer.draw(node.texture);
  renderer.pop();
}

The Node#contains method has some problems. It seems to adjust correctly to detect rotation and scale changes, but as soon as there's a translation applied to a node, the inverse matrix gives the wrong results.

Here's an example that shows a test of whether the mouse cursor is inside a node.

The cyan node is at the origin, given a scale, and rotation.
The magenta node has the same scale and rotation, but it has also
been translated along the X axis.

There are points off to the right that are registering as inside the node though.

I'm fairly sure that this means that the separate steps of the matrix transform are being applied in the wrong order, but I'm not sure how to apply the inverse matrix in any other way (without decomposing it into the 3 individual components of the transform and applying them in the reverse order that the Node#matrix getter does).

Have I misunderstood how the inverse matrix works here?

sentences:
How to resolve duplicate data in Entity Systems? Whilst working on examples and upgrades for my C++ Entity System, something randomly caught the attention of my mind, by surprise: duplicate data. What I'm referring to is how an entity system that uses other libraries (e.g. Ogre3D, SFML, etc.), which already store some information about your entities, handles storing information in custom components.

The Problem:

Say you have two define component types, called: Position component (which holds the location of an Entity) and Velocitycomponent (which holds how fast an Entity is moving, and the direction it is moving toward). And of course, you have a Movement system, which moves entities with a Position and Velocity component attached to it. Now... here comes the tricky part, how would you store the Position component effectively/efficiently, so that you do not duplicate data? By duplication of data, this is what I mean (this is a simple example): a Sprite object typically has it's own x/y position (take for example, SFML's Sprite class), therefore if I had a Position component with it's own x/y values, then I would be duplicating data, would I not? I thought about using pointers/references* in a Position component, but that doesn't really work out if I want to save entities to files.

*Yes, I do know that sizeof(float) == sizeof(float*), but sizeof(vec2/3) != sizeof(vec2/3*). This doesn't really seem much of a problem at first: but what if I had bigger objects to store, such as:

A Mesh:

How would I store a Mesh effectively in a component? I was thinking of just storing a string to where the mesh data was located, but then I thought, what if it's not in a file? How do I resolve that? I also thought to store the raw data in the component, but if I use a 3rd party graphics library (such as Ogre3D or Irrlicht), then I require to actually create the Mesh data via another object.

So, the summed up question is: what's the best way to reduce duplicate data, using an Entity System design, in your game?

Would I have to re-make everything from scratch so that it just "fits" in my entity-system?  I'd prefer not to do that, especially if I decide to change the design  pattern that I use to make games.

sentences:
draw only on stencil buffer monogame Exactly as the question says. Is there a way i can draw vertices only into the stencil buffer.

Basically i want to perform some operations on some vertices of a mesh and based on the result, draw passing vertices only onto the stencil buffer of the screen

sentences:
How come these 2 lines of code are causing a memory leak? I'm confused, I commented these 2 lines out resulting in no memory leaks, and when I added them again it's leaking.

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

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

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

And here is the declaration of the 2 variables :

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

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

sentences:
AndEngine Moving a Connected Texture and Physics Body In AndEngine, many times we create a TextureRegion for our sprite.  We can move this region around the scene but when I connect that region to a physics body I end up being able to use either one to move around.

My question is, which one do I move around.  Should I use the physics body's position or the Texture?

sentences:
Making A Sprite Rotate To A Specific Angle XNA 4.0 I have a game that the character spins when you press either of the triggers on the xbox remote. Here's the code.

if (gamepadState.IsButtonDown(Buttons.RightTrigger))
        RotationAngle += spinSpeed;

if (gamepadState.IsButtonDown(Buttons.LeftTrigger))
        RotationAngle -= spinSpeed;

what i want to happen is when neither of the triggers are being pressed he rotates back to a rotation angle of 0. I know How to make him go back to 0 when neither triggers are pulled but its too abrupt. How can i make the sprite actually rotate back to an angle of 0?

sentences:
How do I deform a texture? I'm using LibGDX, and I don't know where to start; I would like to deform a texture.

Let's say I have a PolygonSprite, and I have vertices and a texture.

Image 1 represents what I have. I would like to deform the texture, like in image 2, by changing the position of the vertices. I don't know how to do that, and I don't see the methods for this in the PolygonSprite class.

I don't want to re-create the vertices, I want to deform the texture based on the first set of created vertices. How do I do that?

sentences:
How to restart game when player lose? am making a simple in which you drag a player on screen and when a ball hits you you lose ,so you have to move the player away from the balls.level zero:no balls, level one:there is one ball on screen, level two: two balls on screen,the level increases when you reach certain scores. the problem here when player loses the game restart at level 2 and not at level 0.here is my code:

public class MyGdxGame extends ApplicationAdapter implements InputProcessor{

// variables
public int[] x={0,0};
public int[] y={0,300};
public int[] size={100,50};
public Ball ball1,ball2;
public Player player;
// Checker: Checks if Ball Hits Player
public Checker checker;
public Texture background;
public Stage stage;

// creation of application
@Override
public void create () {
    checker=new Checker();
    player =new Player();
    background=new Texture(Gdx.files.internal("background.png"));
    stage = new Stage();
    // Ball(x, y, size , speedX, speedY)
    ball1=new Ball(x[0],y[0],size[0],10,10);
    ball2=new Ball(x[1],y[1],size[1],20,10);
}

// changement of application
@Override
public void render () {
    Gdx.gl.glClearColor(1,1,1,1);
    Gdx.gl.glClear(GL20.GL_COLOR_BUFFER_BIT);

    stage.getBatch().begin();
    stage.getBatch().draw(background,0,0,Gdx.graphics.getWidth(),Gdx.graphics.getHeight());
    stage.addActor(player);
    if(checker.level>0)stage.addActor(ball1);
    if(checker.level>1)stage.addActor(ball2);
    stage.getBatch().end();

    // Checks if Ball Hits Player
    if(checker.check1(player,ball1)){lost();}
    if(checker.check1(player,ball2)){lost();}

    // score increases
    checker.score();

    stage.act(Gdx.graphics.getDeltaTime());
    stage.draw();

    Gdx.input.setInputProcessor(this);
}
// Moethod Called When you lose
public void lost(){
    checker.level=0;
    checker.score=0;
}

// Drag Listener
@Override
public boolean touchDragged(int screenX, int screenY, int pointer) {
    player.updatePosition(screenX,screenY);
    return true;
}

// releasing memory of the app
@Override
public void dispose () {
    stage.dispose();
}

sentences:
Unintended stuttering when moving camera I am using opengl and GLFW to make a rendering engine.

Things work per se, but there is some weird flickering happening when I move the camera.

Due the nature of the problem I need to link a youtube video:

https://www.youtube.com/watch?v=XhFrXadnWbs&feature=youtu.be

If you pay attention you will see the stuttering happening as I move the camera.

I beleive this problem occurs due to how I have implemented my camera movement, which is:

GLFW key callback:

#define CAM_SPEED 0.2f
void static key_callback(GLFWwindow* window, int key, int scancode, int action, int mods)
{
    if(key == GLFW_KEY_W)
    {
        c.translateForward(CAM_SPEED);
    }
    if(key == GLFW_KEY_S)
    {
        c.translateForward(-CAM_SPEED);
    }
    if(key == GLFW_KEY_A)
    {
        c.translateSideways(-CAM_SPEED);
    }
    if(key == GLFW_KEY_D)
    {
        c.translateSideways(CAM_SPEED);
    }
}

Camera code:

    void inline translateForward(float speed)
    {
        glm::vec3 hForward = forward;
        hForward.y = 0;
        hForward = normalize(hForward);

        position += hForward*speed;
    }

    void inline translateSideways(float speed)
    {
        position += side*speed;
    }

sentences:
Why would I receive a NullReferenceException when the object is clearly set, and still works? I am getting the exception "NullReferenceException: Object reference not set to an instance of an object" while changing text of a user interface text field, even though the text changes successfully, as you can see in the image. It still gives me a null reference exception; if it was not set, then how can it change the text?

I don't know what is happening, here. I have re-imported the project, but the problem stays.

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

public class Menu : MonoBehaviour
{

    public Text headingaccuracy;
    public Text magneticheading;
    public Text rawvector;
    public Text trueheading;

    private void Start()
    {
        headingaccuracy.text = "Heading Accuracy  ";
    }
}

sentences:
Entity Component System - Handling Input I'm developing a using the Entity-Component model, and so far have components for position, input, graphics and a camera, and systems for rendering graphics and handling input.

All seems to be working well, and I can use my model to create a multi-player, multi-camera setup relatively easily.

Anyway, my problem is that my input system checks keypresses against each player's controls, but I'm not sure how to react to these keypresses without introducing a lot of coupling.

For example, if 'W' is pressed, I want to tell player 1 to move upwards, but that first involves some collision detection -- something I'm not sure my input system should handle.

Advice greatly appreciated!

Thanks in advance,
Rich.

sentences:
Develop a 2d isometric mobile game on Flash I'm building a game on Flash that will run on web/Android/iOS.
The game is 2d isometric.I heard that developing mobile apps on Flash sucks and the graphics looks just awful.It'd be quite uncomfortable to write code for every platfrom separately.What would you guys recommend-stay with Flash or some other platform?
By the way,do i need to build the game specially on MAC so that i can later port it on iOS?
Thanks

sentences:
What are atan and atan2 used for in games? I am having some trouble understanding Math.tan() and Math.atan() and Math.atan2().

I have basic knowledge of trigonmetry but the usage of SIN, COS, and TAN etc for game development is very new to me.

I am reading on some tutorials and I see that by using tangent we can get the angle in which one object needs to be rotated by how much to face another object for example my mouse. So why do we still need to use atan or atan2?

sentences:
Physics fixed time step with client/server games I'm trying to make a 2D platforming multiplayer game with client/server system.
I want to use Node.js and Phaser for the display.

I read a lot about fixedTimeStep : http://gafferongames.com/game-physics/fix-your-timestep/

Do you think it's viable with JS (and Phaser)?
Do you think it's possible to decouple update() and render() loop with a single-threaded language like JS?

sentences:
Rotating a view of a chunked 2d tilemap I'm working on a top-down (oblique) tile-based engine. I would like for the tiles to have a definable height in the world, with Characters being occluded by them, etc.

This has led to a desire to be able to "rotate" the view of the world, even though I'm using all hand-drawn graphics and blitting.

Therefor, I need to rotate the actual world itself, or change how the Camera traverses these arrays.

How can, or should, I create individual rotations of 90 degrees, when I have multi-dimensional arrays?

Is it faster to actually rotate the array, to access it differently, or to create pre-computed accessor(?) arrays, something like how my chunks work?

How can I rotate an individual chunk, or set of chunks?

Currently I establish my tile grid like this (tile height not included):

function Surface(WIDTH, HEIGHT)
{
  WIDTH = Math.max(WIDTH-(WIDTH%TPC), TPC);
  HEIGHT = Math.max(HEIGHT-(HEIGHT%TPC), TPC);

  this.tiles = [];
  this.chunks = [];

  //Establish tiles
  for(var x = 0; x < WIDTH; x++)
  {
    var col = [],
        ch_x = Math.floor(x/TPC);

    if(!this.chunks[ch_x])
      this.chunks.push([]);

    for(var y = 0; y < HEIGHT; y++)
    {
      var tile = new Tile(x, y),
          ch_y = Math.floor(y/TPC);

      if(!this.chunks[ch_x][ch_y])
        this.chunks[ch_x].push([]);

      this.chunks[ch_x][ch_y].push(tile);

      col.push(tile);
    }

    this.tiles.push(col);
  }
};

Even some basic advice on my data struct would be much appreciated.

sentences:
What are the pros and cons of GameSalad versus Cocos2D? I am currently using the Cocos2D framework for creating my game but I just happened to come across GameSalad and was amazed by this video.

GameSalad claims to allow you to create games without writing a single line of code. So I ask myself, what is the catch? What makes Cocos2D better than GameSalad? What are the pros and cons of GameSalad?

sentences: Why is my color on my obj not showing in Unity! I've been trying to import my full-color obj files to unity for a while now, but I can't get them to be in color. All of the colors show up in Meshlab, but not in Unity. All of the youtube videos I have watched have said that I need some sort of texture file but my obj doesn't have one. It is just the obj and it somehow has color in Meshlab. Is there some sort of setting I need to change in Unity? If I need a texture file for it to work, is there a way I can extract the texture file(s) from the obj?

sentences:
Getting It Done vs Solid Software Design? With barely enough time at our hands to complete the games we craft, how can you strike a good balance between solid software architecture and making good progress to get it all done?

My personal challenge:
How about being effective today and long-term thinking at the same time? Plus, while you're doing it you may just as well want to learn new things on the way instead of resorting to the same repetitive patterns you've been using those past 5 years?

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

Game Layer
Messaging Layer
Networking Layer

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

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

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

I am not sure this is the best solution.

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

sentences:
How to Animate a Mechanical Model to work with Unity's Mechanim? I made a relatively simple model in 3D Studio Max to be used in a game. It's a simple stationary laser turret with an openable maintenance hatch. I want to use Mechanim to handle the animation states. The parts of the model are parented in a way that it's easy to just make it move from code but I rather have it use Mechanim and animation files to make it easier to add details like idle animations. I tried animating it with Unity's build in animation editor which looked nice enough but I couldn't get the animation created with that in Mechanim for some reason. If I have to use an external editor to add animations, I can't seem to find any. Google only gives results on how to animate character models or how to make an animation just to be exported to video.
How would I animate this model to work with mechanim, what programs should I use and what should I pay attention to?

sentences:
Alternative to unity's character controller I wonder what you guy would do for a cheap replacement of character controller in unity. I try a bunch of implementation and they don't work at all, what I'm doing wrong?

I'm trying to make a game with megadrive's sonic pinball physics, think (technically) about mario galaxy meet tony hawk with sonic's high speed. Currently I use a simple raytracing, but I'm looking to listen collision around the sphere collider.

In my case i tried:

Rigidbody turn the game in a slide show, Intel atom n455 for the win (actually I like the limitation so it can run on most machine).
Kinetic body don't collide with scenery (don't listen collision).
Character controller don't rotate.
Sweeptest() and SweepTestAll() but walls and inward curve fails dramatically. + it does not work with the flash preview of unity 3.x

I want to be able to move the character according to tangent of arbitrary complex volumes. For example, taking slope change higher than 90° and leave the case handling with special case code (for example stopping at a wall or falling down a cliff)

What should I do to meet the requirement with good performance?

Currently my code is this one, with sweeptest() which doesn't work:
http://docs.unity3d.com/Documentation/ScriptReference/Rigidbody.SweepTest.html

private void UpdateSurfacePosition()
    {
        Ray//origine, direction
            ground_check_ray = new Ray( gameObject.transform.position, -gameObject.transform.up);// * (Momentum.magnitude + 1));
        RaycastHit
            raycast_result;
        Rigidbody
            rigid_body = gameObject.rigidbody;

        rigid_body.detectCollisions = false;
        rigid_body.isKinematic = true;

        bool onGround;// =
            //Physics.Raycast( ground_check_ray, out raycast_result );//ray, hit
            //rigid_body.SweepTest(-gameObject.transform.up, out raycast_result);//direction, hit, distance

        raycast_result = new RaycastHit();
        RaycastHit[] contacts = rigid_body.SweepTestAll(-gameObject.transform.up);

        rigid_body.SweepTest(-gameObject.transform.up, out raycast_result);

        if (contacts.Length > 0)
        {
            onGround = true;
            int i=0; while (i != contacts.Length)
            {
                raycast_result.normal += contacts[i].normal;
                i++;
            }
            raycast_result.normal = raycast_result.normal.normalized;
        }
        else
        {
            onGround = false;
        }

        debug1 = "Normal > " + raycast_result.normal.ToString()
            + " Position > "+ raycast_result.point.ToString()
                //+" transform > "+ raycast_result.transform.name.ToString()
                + " Contact > " + contacts.Length
                ;

        if ( onGround )
        {
            Vector3
                next_position;

            //UpdateOrientation( gameObject.transform.forward, raycast_result.normal );

            UpdateMoveOrientation( gameObject.transform.forward, raycast_result.normal );
            next_position = GetNextPosition( raycast_result.point );
            rigid_body.MovePosition( next_position );

            //ground_direction = raycast_result.normal;
        }
        else//onAir
        {
            //if forward close to dot.Y = abs(1) choose -up if 1 and up if -1
            UpdateMoveOrientation( gameObject.transform.forward, raycast_result.normal );
        }
    }

sentences:
Why is an empty Unity Iphone Build over 700 Megs? Is this Normal? So after 2 weeks of slaving over my first game I was finally done! I was entirely ecstatic....until I saw its file size.
770 Megabytes
For a simple numbers game, that was way too much and I created an empty unity project as a test and that was also over 700 megs
Why is an empty Iphone project this large?

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:
Animating Tile with Blitting taking up Memory I am trying to animate a specific tile in my 2d Array, using blitting. The animation consists of three different 16x16 sprites in a tilesheet. Now that works perfect with the code below. BUT it's causing memory leakage. Every second the FlashPlayer is taking up +140 kb more in memory. What part of the following code could possibly cause the leak:

//The variable Rectangle finds where on the 2d array we should clear the pixels
//Fillrect follows up by setting alpha 0 at that spot before we copy in nxt Sprite
//Tiletype is a variable that holds what kind of tile the next tile in animation is
//(from tileSheet)
//drawTile() gets Sprite from tilesheet and copyPixels it into right position on canvas

        public function animateSprite():void{

                    tileGround.bitmapData.lock();

                    if(anmArray[0].tileType > 42){
                        anmArray[0].tileType = 40;
                        frameCount = 0;
                    }
                    var rect:Rectangle = new Rectangle(anmArray[0].xtile * ts, anmArray[0].ytile * ts, ts, ts);
                    tileGround.bitmapData.fillRect(rect, 0);

                    anmArray[0].tileType = 40 + frameCount;
                    drawTile(anmArray[0].tileType, anmArray[0].xtile, anmArray[0].ytile);

                    frameCount++;

                    tileGround.bitmapData.unlock();
                }

        public function drawTile(spriteType:int, xt:int, yt:int):void{

                    var tileSprite:Bitmap = getImageFromSheet(spriteType, ts);
                    var rec:Rectangle = new Rectangle(0, 0, ts, ts);
                    var pt:Point = new Point(xt * ts, yt * ts);
                    tileGround.bitmapData.copyPixels(tileSprite.bitmapData, rec, pt, null, null, true);

                }

                public function getImageFromSheet(spriteType:int, size:int):Bitmap{

                    var sheetColumns:int = tSheet.width/ts;
                    var col:int = spriteType % sheetColumns;
                    var row:int = Math.floor(spriteType/sheetColumns);
                    var rec:Rectangle = new Rectangle(col * ts, row * ts, size, size);
                    var pt:Point = new Point(0,0);

                    var correctTile:Bitmap = new Bitmap(new BitmapData(size, size, false, 0));
                    correctTile.bitmapData.copyPixels(tSheet, rec, pt, null, null, true);
                    return correctTile;

                }

sentences:
Does changing a Rasterizer State affect every object (model) on the screen? Quick easy question. When setting a Rasterizer State (like for example wireframe).....does that affect every object (model) on the screen?

For example, let's pretend I have 2 cubes. I use:

devcon->RSSetState(pRSWireframe);

Will that affect all the objects on the screen?

sentences:
Tool for editing sprites contour pixel alpha value I have seen that most games uses sprites that have a transparent contour, that is, the pixels that belongs to the contour of the object in the WxW sprite image is below 255. It is not perfectly opaque, so that when you render it on screen, you avoid aliasing effects.

Is there a tool that automatically loads N .png sprites and process them in order to make their contours semi-transparent?

sentences:
How should we approach publishing our game from India? Me and my friends are developing a game using Java for Windows operating system. We have nearly completed our game. As we feel that the game can make money, we wish to sell it. But in India we don't know any game publishing company.
We want to know the following if possible.
Will game publishers like BigFishGames.com publish our game even though we are not in USA?
We are just students in college. Is it required that we can sell only after we start a company?
Is it possible to sign contracts if the publisher wishes to publish our game, while the publisher and developer are in different countries?
Thank you

sentences:
Why can't I sample a texture in a vertex shader? I'm old in Game Development but very new in shader writing. I just want a shader that transform from 1 texture to another. So I did start learning shader writing and wrote my desired shader. But during writing one thing I cannot understand as I am very dumb in shader writing that if I assign fixed4 color with COLOR semantic in vertex method then compiler gives the following error.

  Shader error in 'Hamza/TwoTextures': cannot map expression to vs_4_0 instruction set at line 39 (on glcore)

  Compiling Vertex program
  Platform defines: UNITY_ENABLE_REFLECTION_BUFFERS UNITY_PBS_USE_BRDF1 UNITY_SPECCUBE_BOX_PROJECTION UNITY_SPECCUBE_BLENDING SHADER_API_DESKTOP UNITY_TEXTURE_ALPHASPLIT_ALLOWED

Here is the not working shader code,

Shader "Hamza/TwoTextures"{
    Properties{
        [NoScaleOffset]
        _Texture1 ("Texture 1",2D) = "white"{}

        [NoScaleOffset]
        _Texture2 ("Texture 2",2D) = "white"{}

        _Mixer ("Mixer", Range(0,1)) = 0
    }

    SubShader{
        Pass{
            CGPROGRAM

            #pragma vertex vert
            #pragma fragment frag

            sampler2D   _Texture1;
            sampler2D   _Texture2;
            float       _Mixer;

            struct appdata{
                fixed4 vertex   : POSITION;
                fixed2 tex      : TEXCOORD0;
            };

            struct v2f{
                fixed4 pos      : SV_POSITION;
                fixed2 tex      : TEXCOORD0;
                fixed4 col      : COLOR;
            };

            v2f vert(appdata i){

                v2f o;
                o.pos = mul(UNITY_MATRIX_MVP,i.vertex);
                o.tex = i.tex;

                // Giving error on this line
                o.col = (tex2D(_Texture1,i.tex) * _Mixer) + (tex2D(_Texture2,i.tex) * (1 - _Mixer));
                return o;
            }

            fixed4 frag(v2f v) : COLOR
            {
                return v.col;
            }

            ENDCG
        }
    }
}

And if I write same expression to throw it as return fixed4 value in fragment method then everything is working fine.

Here is working shader code,

Shader "Hamza/TwoTextures"{
    Properties{
        [NoScaleOffset]
        _Texture1 ("Texture 1",2D) = "white"{}

        [NoScaleOffset]
        _Texture2 ("Texture 2",2D) = "white"{}

        _Mixer ("Mixer", Range(0,1)) = 0
    }

    SubShader{
        Pass{
            CGPROGRAM

            #pragma vertex vert
            #pragma fragment frag

            sampler2D   _Texture1;
            sampler2D   _Texture2;
            float       _Mixer;

            struct appdata{
                fixed4 vertex   : POSITION;
                fixed2 tex      : TEXCOORD0;
            };

            struct v2f{
                fixed4 pos      : SV_POSITION;
                fixed2 tex      : TEXCOORD0;
            };

            v2f vert(appdata i){

                v2f o;
                o.pos = mul(UNITY_MATRIX_MVP,i.vertex);
                o.tex = i.tex;
                return o;
            }

            fixed4 frag(v2f i) : COLOR
            {
                // It is giving me no error
                return (tex2D(_Texture1,i.tex) * _Mixer) + (tex2D(_Texture2,i.tex) * (1 - _Mixer));
            }

            ENDCG
        }
    }
}

Can anyone explain me that why it is happening? And what is the difference between them?

As I mentioned that I did start learning only two days before. I'm sort of noob in this.

sentences:
Software Design/Modelling method and tool for games? I've heard that UML is a great modelling language for software design. However, for software, such as game, that will certainly encounter major changes during the development, I doubt that UML will work effectively.

What are the common ways or models that the game programmers used? and is there any recommended tools for game designing process?

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 do I let a game support different rule sets? I'm making a MUD game engine that supports D&D , Pathfinder and other tabletop-RPG rule sets. I am starting to build out how characters interact with the world (e.g. dialog, battle, searching for traps).

The engine is pretty loosely coupled, to facilitate swapping out components with downloaded plugins and I want to continue down that path with the rules. I've got an ICharacter interface and both a player and non-playable character interface that inherits from ICharacter. I feel that making a developer re-implement those interfaces when making a plugin because the developer is building a Pathfinder plugin instead of a D&D plugin is poor design. Instead, I want to allow them to specify at runtime (via an editor) what rules each character must abide by when performing specific tasks.

I was thinking I'd have a RuleEngine that would be provided an object and process a rule. Some pseudo code for this:

public void Attack(ICharacter target)
{
    IRuleResult result = RuleEngine.Process(
            RuleFactory.CreateRule("CharacterAttack"),
            this);
    // Check result to see what was given back like damage, hit/miss etc.
}

The user within my editor can specify that for CharacterAttack rule requests, uses PathfinderAttackRule, which would be a Type implementing IRule.

This approach feels like it might be to restrictive though. The interface would have to have some knowledge of D&D implementations, like critical miss, damage amounts etc. What if the user wants to build something that isn't D&D, but just a custom combat rule? The interface doesn't allow it and the engine would expect the interface properties to be usable.

Another option I was thinking about was having delegates perform the rule checks and process the attack.

public void Attack(ICharacter target)
{
    Func<ICharacter, IPlayer, bool> attackCheck =
            RuleFactory.CreateRule<IPlayer>("PreAttach");

    if (attachCheck(target, this))
    {
        // Invokes a delegate fetched by an internal factory.
        RuleFactory.Process<IPlayer>("AttachPlayer");
    }
}

This lets builders specify within the editor what custom delegates to use before an attack starts. (it would be a dropdown list of delegates supported, scanned from the assemblies loaded). The user might want a D&D rule delegate from a plugin they downloaded for pre-attack rule checks, then use a pathfinder rule for the actual attack from a 2nd plugin they downloaded.

Now that I've explained what I'm wanting to do, am I way off base here? Are both of the above examples horribly thought-out and/or is there a better approach to take that is loosely coupled and allows swapping rules out?

As a side-note, I chose player combat as the example, but rules are applied to more than just combat, and more than just players. Rooms, items and other objects will have rules. Some of the rules can be shared, some can not.

Where should I be going with this? I'm looking for general concepts and best-practices.

sentences:
Save game state information I'm working on my first game, and are looking into the option to save a number of game state settings.

One of the things I want to save is the high scores, this will contain a list of the 10 players that scored the highest.

I have been looking into this for a while, and was wondering what the best way for this is.

While being ingame I will have a list of high scores comprised of Player, Score, Level. This of course needs to be updated each time the score has been beaten, but it also needs to be saved somewhere where it won't be reset the whole time.

I would think this kind of information should be saved into a file (either xml or comma separated values).

The problem I'm facing is what to do on the initial set up (I would like to have some fake values in the high scores table), however if I add that to the file how do I know that the scores in there are the initial set up ones, or the real ones? Once the player has a endgame for the first time, these fake scores should not being shown anymore.

However the player can also reset the scores, and at that point I would like to have the fake scores shown again.

So my question is what is the best way of setting this up? Do I keep 2 files, one with the real scores, other with fake ones? or do I keep the fake ones in a list inside the game and when the file with high scores can't be found I use that list?

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:
How to code a lot of cards in a trading card game java I want to make a trading card game like Yu-Gi-Oh or Magic. I have a lot of cards in my game and even the user can make new cards. Cards are objects and they have attributes like HP and Mana ,etc but they also has special power which is another object and has different types some of them activate when a card is played into the field, some of them activate at death and etc. One way is simply hardcoding all the different cards in different classes but This way, I cannot implement a user-built card. I am going to use enums for the essential cards but I don't know what to do for user defined cards.

Is there any standard way to implement things like this?

I am very new to Java and OOP. I think maybe Databases could help but I don't know what should I use or search to find the appropriate choice for this matter.

sentences:
Unity Trail Renderer artifacts — flickering & disappearing I have a projectile prefab that have 2 trail renderers attached to it. Whenever I instantiate another projectile, every trail renderer seems to flicker. This is similar to the question: Changes to one Unity trail renderer causes all of them to flicker

In addition to that, I have other rendering artifacts as well. Having too many trail renderers seems to cause some of them to not draw. Also, sometimes, they just seem to randomly choose not to draw.

As you can see, the left most projectile doesnt want to draw its trail.

Similarly, adding more projectiles, the front projectiles seems to lose all of its trails.

So thus, the 2 issues I am having is

Flicking trail renderers when another is instantiated.
Trails not rendering randomly.

Unity Version: 5.3.2f1

sentences: What is the difference between an impulse and a force related to a physics engine? What is the difference between an application of an impulse and an application of a force in relation to a physics engine?

sentences:
Translate object in world space usings it's local rotation I'm using Three.JS to render some objects. I'm struggling with some very simple object rendering and translation.

The scenario is that I spawn an object at 0,0,0 in world space with 0,0,0 rotation.

var scene, camera, cube;

...

function change() {
  var degrees = 90
  var zTranslation = 5;

  cube.rotation.y = degrees * Math.PI / 180;
  cube.rotation.z = zTranslation;

  var newCubeMatrix = cube.matrix;
  newCubeMatrix.identity();
  newCubeMatrix.multiplySelf(THREE.Matrix4.rotationYMatrix(cube.rotation.y));
  newCubeMatrix.multiplySelf(THREE.Matrix4.translationMatrix(cube.position.x, cube.position.y, cube.position.z));

  cube.updateMatrix();
}

function loop() {
  renderer.render( scene, camera );
}

...

What now happens is that the cube is rotation 90 degrees and translated 5 points on the Z axis in world space, not 5 points on the Z axis in the cube's local space.

How do I make the cube translate 5 points in it's local space?

sentences:
Game development: Art vs Programming I'm a programmer and would like to get some perspective on the art / content creation part of game development.

Comparing a 2D platformer like Super Meat Boy and a high-end game like Crysis 2, what do you think:

What is harder to do / more likely to cause the project to fail: Art or programming?
Which will consume more time and take more people to work on?

sentences:
How to compute highscores, so that 10 matches will "correctly" compete 100 matches When computing highscores, it is possible to:

count sum of points (in every match),
count average of points (across all matches).

Sum is vulnerable to: multiple low-quality matches.

Average is vulnerable to: creating new account and playing few high-quality matches.

How to face this problem? Multiply sum x average? How is this done in practice, e.g. in World of tanks?

sentences:
How does networking in XNA work? I am quite confused over how networking works in XNA. I'm currently developing a game for Xbox. I want to create a multiplayer environment and read some tutorials about it.

But I'm confused over how packets are transmitted over the network - E.g.; what is the difference between a LocalNetworkGamer, a NetworkGamer and a LocalGamer? Why do I need to iterate over all LocalGamers when reading packets?

I know that's not a typical SE question, but can anyone point to a tutorial that explains how the networking operates as opposed to how to use it?

sentences:
Implementing complex AI in an ECS? I'm having a hard time wrapping around how something quite stateful such as complex AI would be handled in a pure ECS (such as components being only data and systems operating on that data)
Things like different enemies in a game that cast different spells, or bosses with various phases and abilities like in an MMO.Usually i'd handle such a thing with data and behaviour components and state machines, but this violates the data-driven ECS paradigm.
Is there an easy way to handle this sort of behaviour in an ECS or is a different approach required?

sentences:
Access a ID3D11Texture2D in another thread I created a ID3D11Texture2D texture on a thread with DirectX graphics and I passed its pointer to a worker thread. I'm assured that the creator thread will no longer reference nor use the texture. I now need the worker thread to copy the resource

pContext->CopyResource(..);

What's the correct way of doing this in the worker thread?

In other frameworks like CUDA or OpenGL I would just push/restore the creator thread's context into the worker thread, but I'm not sure if that applies in DirectX.

sentences:
XNA - Weird bug with 2D Sprite Rotation I have a problem with my XNA Game, I have a function where I need my sprite to face towards an enemy, using this code:

        Vector2 currentPosition = Position;
        Vector2 nearestEnemy = gameObjectManager.GetNearestEnemy(Position, GameObjectTypes.Zombie);

        Orientation = (float)Math.Atan2(nearestEnemy.Y - currentPosition.Y, nearestEnemy.X - currentPosition.X)

As found on an XNA forum results in my character looking 90 degrees away from the enemy.

Adding "MathHelper.ToRadians(90);" to the end of my Orientation assignment fixes this bug, why is this happening?

Thanks!

sentences:
Is it ok to use copyrighted assets for educational purposes? A friend and I were wanting to create a Pokemon battle simulator in our mobile development class as our final project but are worried whether or not it would be permissible under "Fair Use" for educational purposes. We have no plans on doing anything with the game after the class and our presentation of the app, we just wanted to try to clone some very basic parts of it onto Android.

Edit: I'm located in the US.

sentences:
How to animate two interacting objects I'm not very familiar with animations but as far as I know, most of the animations are done frame by frame. For example animating a character walking etc. However, let's imagine this scene:

There's a man coming from the left towards the sign. It's easy to animate this. But when he comes to the sign, he picks it up and starts waving with it. Now this is something I don't know how to do. What is generally the recommended way to do this kind of animation (two separate objects)? Specifically we're talking about android live wallpaper here (probably made with libgdx but I can use anything if it's better for me).

sentences:
How do I bring a child object in its original position after it is translated and rotated? This is the original position of the cube and its child object cone.

Over here, I have translated the cone for 2 units

Now I have rotated the parent cube around 25 degrees wrt to the Y-axis

If we translate the cone 2 units back again, it's not in the original position

What formula do I need to apply to the cone while translating it back to bring it back to it's original position?
Code: The below code is a coroutine for translating the child object
  IEnumerator MoveToNewPos()
 {
       Vector3 newPos += Quaternion.Euler(0, 0, 135) * Vector3.left * distance;

    float t = 0;
    float animTime = 30;
    isMoving = true;
    for (; Vector3.Distance(transform.position, newPos) > 0.001f; t += Time.deltaTime)
    {
        float p = t / animTime;
        transform.position = Vector3.Lerp(transform.position, newPos, p);
        yield return null;
    }
   isMoving = false;
}

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:
Keeping Track of Position OpenGL I have a sphere in my 3D world located at the origin. I have models orbiting it and I need to keep track of each models' position (x, y, x coordinates) as well as update their bounding boxes for collision detection. I have calls to glRotate() and glTranslate() but I'm not sure how to keep track of this. Should I create a position matrix and apply rotations and translations to it? Any help on that would be great!

Also if there is a better way to do this I am open to anything.

sentences: Image Interpolaton for Rotation I am building a 2D game in Java in which I use trig operations for rotation. I know Java offers an excellent graphics library but I intend to make my own code just for learning purposes. Now the problem is, I do not understand image interpolation. I do know it tracks the unmapped pixels on rotation and there are various techniques to do it etc. But one thing that Im still confused about even after referring to several tutorials, is - how to find the pixels that are not mapped ?? Once I know it, I can easily implement it in code. Im using PixelGrabber to get pixels and then perform rotation. So could someone just explain how to find unmapped pixels in the array during the rotation operation please?

sentences:
OpenGL: missing GL_SPECULAR light on the texture I'am missing specular lighting on the texture. I have #include <GL/glext.h> in the project, so basically I used glLightModeli(GL_LIGHT_MODEL_COLOR_CONTROL_EXT, GL_SEPARATE_SPECULAR_COLOR_EXT); for specular effect. My init code:

glEnable(GL_DEPTH_TEST);
glHint(GL_PERSPECTIVE_CORRECTION_HINT, GL_NICEST);
glEnable(GL_CULL_FACE);
GLfloat AmbientLight[]   = {  0.3,  0.3,  0.3,  1.0 };
GLfloat DiffuseLight[]   = {  0.7,  0.7,  0.7,  1.0 };
GLfloat SpecularLight[]  = {  1.0,  1.0,  1.0,  1.0 };
GLfloat Shininess[]      = { 90.0 };
GLfloat Emission[]       = {  0.0,  0.0,  0.0,  1.0 };
GLfloat Global_Ambient[] = {  0.1,  0.1,  0.1,  1.0 };
GLfloat LightPosition[]  = { 7.0, 7.0, 7.0,  1.0 };

glLightModelfv(GL_LIGHT_MODEL_AMBIENT, Global_Ambient);
glLightfv(GL_LIGHT0, GL_AMBIENT, AmbientLight);
glLightfv(GL_LIGHT0, GL_DIFFUSE, DiffuseLight);
glLightfv(GL_LIGHT0, GL_SPECULAR, SpecularLight);
glLightfv(GL_LIGHT0, GL_POSITION,LightPosition);

glLightf(GL_LIGHT0, GL_CONSTANT_ATTENUATION,  0.05f );
glLightf(GL_LIGHT0, GL_LINEAR_ATTENUATION,    0.03f );
glLightf(GL_LIGHT0, GL_QUADRATIC_ATTENUATION, 0.002f);

glMaterialfv(GL_FRONT_AND_BACK, GL_AMBIENT, AmbientLight);
glMaterialfv(GL_FRONT_AND_BACK, GL_DIFFUSE, DiffuseLight);
glMaterialfv(GL_FRONT_AND_BACK, GL_SPECULAR, SpecularLight);
glMaterialfv(GL_FRONT_AND_BACK, GL_SHININESS, Shininess);
glMaterialfv(GL_FRONT_AND_BACK, GL_EMISSION, Emission);

glShadeModel(GL_SMOOTH);
glEnable(GL_LIGHT0);
glEnable(GL_LIGHTING);
glEnable(GL_COLOR_MATERIAL);
glColorMaterial(GL_FRONT_AND_BACK, GL_AMBIENT_AND_DIFFUSE);

My render code:

glClearColor( 0.117f, 0.117f, 0.117f, 1.0f );
glClearDepth(1.0f);
glClear(GL_COLOR_BUFFER_BIT|GL_DEPTH_BUFFER_BIT);
// load texture
glEnable(GL_TEXTURE_2D);
glTexEnvf(GL_TEXTURE_ENV, GL_TEXTURE_ENV_MODE, GL_MODULATE);
glEnable(GL_LIGHTING);
glLightModeli(GL_LIGHT_MODEL_COLOR_CONTROL_EXT, GL_SEPARATE_SPECULAR_COLOR_EXT);
glColor4f(1.0, 1.0, 1.0, 0.2);
glDisable(GL_COLOR_MATERIAL);
// render geometry here
glFlush();

What is missing here?

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:
How to efficiently change VBO size? I have created a menu class and now I'm working on getting it to render using OpenGL's VBO's. The menu is fairly simple, it has a number of buttons, the user can press up and down to highlight the desired button and then press ENTER to go to the selected buttons sub-menu which is just another instance of my menu. It should be noted that it doesn't need to have the same amount of buttons as the previous one. Pretty basic.

What I've come up so far is this:

//setting up the buffers and variables
int amountOfVerticesButtons = this.menu.getCurMenu().getNoButtons() * ShapeRenderUtils2D.VERTICES_RECT;
FloatBuffer vertexBufferButtons = BufferUtils.createFloatBuffer(amountOfVerticesButtons * VERTEX_SIZE);
FloatBuffer colorBufferButtons = RenderUtils.createColorBuffer(0.5f, 0f, 0.5f, amountOfVerticesButtons);

int amountOfVerticesBorders = this.menu.getCurMenu().getNoButtons() * ShapeRenderUtils2D.VERTICES_FRAME;
FloatBuffer vertexBufferBorders = BufferUtils.createFloatBuffer(amountOfVerticesBorders * VERTEX_SIZE);
FloatBuffer colorBufferBorders = RenderUtils.createColorBuffer(0.3f, 0f, 0.45f, amountOfVerticesBorders);

//filling up the buffers
for (int i = 0; i < MAX_BUTTONS_PER_PAGE && i < menu.getCurMenu().getNoButtons(); i++) {
    //buttons
    vertexBufferButtons.put(ShapeRenderUtils2D.getRectVertices(new Point(point.x, point.y + (i * (BUTTON_HEIGHT + BUTTON_SPACING))), MENU_WIDTH, BUTTON_HEIGHT));

    //button borders
    vertexBufferBorders.put(ShapeRenderUtils2D.getFrameRectangle(new Point(point.x, point.y + (i * (BUTTON_HEIGHT + BUTTON_SPACING))), MENU_WIDTH, BUTTON_HEIGHT));
}

vertexBufferButtons.flip();
buttons_handles = RenderUtils.createHandles(vertexBufferButtons, null, colorBufferButtons, amountOfVerticesButtons);

vertexBufferBorders.flip();
borders_handles = RenderUtils.createHandles(vertexBufferBorders, null, colorBufferBorders, amountOfVerticesBorders);

This code is run once in the constructor and it sets up the VBO for my buttons, and creates a color array with one color for each button.

My question is:

When the user presses ENTER, a new menu becomes active. The new menu doesn't have to have as many buttons as the previous one, so the old VBO is worthless, because it is of different size. I detect that the menu changes and what I basically do is to run the above code again, for the new menu, but at the end before I flip and create Handles I first do:

RenderUtils.deleteHandles(buttons_handles);
RenderUtils.deleteHandles(borders_handles);

Which removes the handles to the old VBO's. And then I create new ones just like I did the first time, but this time with correct size.

This seems very ineffective. Is there a better way to do it? Is there a better way to change an existing VBO's size?

EDIT: Please note that I've got everything else done with the menu. I only have problems with the VBO rendering. Also, there may be a very large amount of buttons, with many sub-menus that also contain large amounts of buttons, so creating a separate VBO for each case is not possible.

sentences:
MVC? patterns for game development? Possible Duplicate:
  MVC-like compartmentalization in games?

I am thinking of the best way to structure my project and was thought a MVC style pattern would be appropriate. Would be correct having the model handle the majority and basically being the game engine?

Are there any standardised patterns recommended for simple game development?

Model / Game Engine

Data: Level Design, Chat feeds, etc
Game Status: Player status, Enemy status, World Status etc etc.
Engine: Physics, Collisions, AI

View

3D: Gameplay, Camera, Rendering...
2D: UI etc

Controller:

Player Input
UI Input

sentences:
Implementing hitbox polygon I'm creating a shooter, it's still very early, but i'm implementing some polygon hitboxes.

So far i have created a polygon class, and i'm looking into how i can hook it onto my player.

I'm trying to stay away from having a Tick() function in my polygon class, and I would rather not update the position every tick (it would clutter up my tick functions). At the same time I would really like to have the positions in there somehow (it has a drawing function, and i will be using it for hit detection)

How would i go about implementing this polygon object into my entities?

sentences:
Huge procedurally generated subway transit map How could I generate a single transit map image
, which is not based on any real map, on a massive scale? Are there algorithms or tools which could do something like this already?

  Unlike conventional maps, transit maps are usually not geographically accurate—instead they use straight lines and fixed angles, and often illustrate a fixed distance between stations, compressing those in the outer area of the system and expanding those close to the center.

The scale I'm looking for is earth-like. If a line ran horizontally across it could have 40,075 stations kind of map. Ideally, It should also wrap around, like on a sphere.

I want it to look just like any local transit map (I'm basing myself on the Montreal metro map) which means I don't care about what a metro system of this scale should look like or how useless this would be.

So far, the research

Nathan Hellinga's Processing.py subway map generator resembles what I'm looking for and looks great but the algorithm wouldn't scale well to a very large grid.
Jannis Redmann's generating transit map theory is really interesting but bases itself on real world data. Maybe it could be used with generated data but how do you generate that data then?
Fractal generators! But how do I make it look like a transit map?
With Graphviz, I would still need an algorithm to generate data.
Slime is a really interesting idea! But how do you procedurally generate that?
Wave function collapse algorithm!!
Generating a random heightmap, making a graph out of it, and then making it pretty
My idea, a random walker.
You all know what this is, I just don't think that's the best option there is.

sentences:
Check gap in 3d environnement I am in a 3d environnement, when I jump, i'm calculating the hitPoint of the end jump. I want to know when I jump, if there is a GAP between my initial point, and the end point.

But I don't want to set any trigger in the Level Design...

My Initial Idea is to do Raycast each 5-6 steps, but I wonder if this is too much cost effective. MayBe it isn't ?

sentences:
Make timer for game to run for 2min I'm trying to make a game using C++ (in Visual Studio 2015).
I want to make the game run for X minutes and then end.
I have a function play() that calls all other functions required and I need to make play() run for 2min.
I've tried putting play() in loops that run for some time, but none of them work. I am not able to find any other question that addresses the problem I'm facing and so any help would be appreciated.

sentences:
java slick2d - key press being ignored I have the following in my update funtion. The first input for key_enter when textPos!=2 works fine, but the one when textPos==2 doesn't work. The key up and down work fine though.

The System.out.println("Enter: " + choice); never gets printed

public void update() {
        Input input = gc.getInput();
        if (input.isKeyPressed(Input.KEY_ENTER)) {
            if (textShowing && textPos != 2) {
                textPos++;
                textShowing = false;
            }
        }
        if (textShowing && textPos == 2) {
            if (input.isKeyPressed(Input.KEY_ENTER)) {
                System.out.println("Enter: " + choice);
                if (choice == 0) {

                } else if (choice == 1) {

                } else {
                    textPos++;
                    textShowing = false;
                    System.out.println("Text Pos: " + textPos);
                }
            } else if (input.isKeyPressed(Input.KEY_UP)) {
                if (choice > 0) {
                    choice--;
                }
            } else if (input.isKeyPressed(Input.KEY_DOWN)) {
                if (choice < 2) {
                    choice++;
                }
            }
        }
    }

sentences:
Handling Origin/Anchor Points in a Scene Graph I'm trying to implement a simple scene graph on iOS using GLKit but handling origin/anchor points is giving me fits. The requirements are pretty straightforward:

There is a graph of nodes each with translation, rotation, scale and origin point.
Each node combines the properties above into a single matrix (which is multiplied by it's parent's matrix if it has a parent).
Nodes need to honor their parent's coordinate system - including the origin point (i.e. a child's origin should line up with the parent's origin)

So the question is:

What operations (e.g. scaleMatrix * rotationMatrix * translationMatrix, etc.) need to be performs and in what order so as to achieve the proper handling of origin/anchor points?

P.S. - If you are kind enough to post an answer please mention whether your answer is based on column or row major matrices - that's a perennial source of confusion for me.

sentences:
How do I ensure proper date formatting? I'm trying to load a date in the form of a string. As there is always 4 possible date formats (x.x.xxxx, x.xx.xxxx, xx.x.xxxx, xx.xx.xxxx (day month year)) I had to take this into account and it is especially hard with the strings length of 8 as it is either xx.x or x.xx.

So I came up with this:

public void setDate(String CompleteDate, boolean loadOrNew){
  Date = CompleteDate;
  if(loadOrNew){
    int totalLength = Date.length();
    String sday = null;
    String smonth = null;
    String syear = null;
    if(totalLength == 9){
      sday = String.valueOf(Date.toCharArray(), 0, 2);
      smonth = String.valueOf(Date.toCharArray(), 3, 2);
      syear = String.valueOf(Date.toCharArray(), 6, 4);
    }else if(totalLength == 8){
      sday = String.valueOf(Date.toCharArray(), 0, 2);
      if(sday.contains(".")){
        smonth = String.valueOf(Date.toCharArray(), 2, 2);
      }else{
        smonth = String.valueOf(Date.toCharArray(),3, 1);
      }
      syear = String.valueOf(Date.toCharArray(), 5, 3);
    }else if(totalLength == 7){
      sday = String.valueOf(Date.toCharArray(), 0, 1);
      smonth = String.valueOf(Date.toCharArray(), 2, 1);
      syear = String.valueOf(Date.toCharArray(), 4, 4);
    }else{
      Toast.makeText(c, "Critical date format error occurred. Error G205", Toast.LENGTH_LONG).show();
    }
    sday.replace(".", "");
    smonth.replace(".", "");
    syear.replace(".", "");
    this.day = Integer.parseInt(sday);
    this.year = Integer.parseInt(syear);
    this.month = Integer.parseInt(smonth);
  }
  date.setText("Date: " + CompleteDate);
}

However it isn't correct as I get NumberFormatException with "1."

This means I somewhere messed up and the removing of the "." doesn't work. So I need help improving this so it works.

NOTE:

Some of this is android-specific, e.g. the Toast class and TextView class, but everything else is in standard Java.

date and Date isn't the same. Date is the String, date is the TextView(android).

sentences:
Defining the track in a 2D racing game I am designing a top-down racing game using canvas (html5) which takes a lot of inspiration from Micro Machines. In MM, cars can move off the track, but they are reset/destroyed if they go too far.

My maths knowledge isn't great, so I'm finding it hard to separate 3D/complex concepts from those which are directly relevant to my situation. For example, I have seen "splines" mentioned, is this something I should read up on or is that overkill for a 2D game?

Could I use a single path which defines the centre of the track and check a car's distance from this line? A second path might be required as a "racing line" for AI.

Any advice on methods/techniques/terms to read up on would be greatly appreciated.

sentences: How to reverse gravity in Unity I'm trying to figure out how script gravity reversal on collision with an object. How can I reverse gravity?

sentences: FlxSprite ignore camera follow in flixel I am using flixel v2.5 and am using FlxG.camera.follow to get the camera to follow the player. I have a background FlxSprite that I don't want to move with the camera. Is there a way I can set this FlxSprite to stay in the same place on the screen? I would also like to have a GUI HUD that stays fixed to the screen, and was thinking I could do this the same way.

sentences:
Easy way to do gravity in a simple game? I'm looking for an easy, beginner friendly way to do gravity in a platformer.
I've looked into Box2D tutorials, but they all seem very complicated.

All I want is a class that takes into account if my player is grounded, or airborn, and a nice little curve as he jumps. I know this shouldn't be more than a few lines of code, and learning a library seems excessive.

Anyone mind helping me out?

sentences:
How can I make an animation using arrays? I want to take an array of sprites, for example

sf::Sprite animation[3] = { stepLeft, inMiddle, stepRight };

and construct an animation by looping them. Is this possible? How do I go about it?

sentences:
How can I cast light onto a sprite in 3D environment? I'm making a 2.5D game, where 2D sprites are in a 3D environment. I'm using URP and I have a problem with lighting the sprites. The sprites are lighting up from behind, and not front. I tried with directional, spot and point lights but the result is the same no matter what official shader I use they only light up when they receive light from behind. Front light has no effect whatsoever on the sprites.
I spent the entire day looking for a solution but I've got almost nothing. Only solution I saw someone else mention is making the game object with the "sprite renderer" on, a child of another gameobject and rotate it 180 degrees on Y. But that is not an option for me cause I'm using custom scripts to rotate that game object already.
So can there be a custom shader? Can one be created using shadergraph maybe? I know some others have faced the same problem but did anyone really solve it?
Thanks.

sentences:
How can i put a skybox on a new layer with a new camera and then move the skybox? I want to create a moving start effect. For example the space station is moving around the star or moving to the star. But instead moving the space station i think it will be better to make effect of the skybox moving.

I have in the Hierarchy a RigiBbodyFPSController and a child MainCamera.
Now i added a new Camera to the Hierarchy.

Now how do i make the rest  ? Moving the new camera and the skybox to new layer and move the skybox ? Or it's more logic to say to move the new camera that the skybox is with in it in the new layer.

Not sure if my idea is logic or if there are a better ways to do it.
The general idea is to make movement effect like the space station is moving around the star or to the star. Star i mean the skybox.

The skybox is on the right.
I can't see the skybox in the scene view i see it only when running the game in the game view.

This is a screenshot when the game is running then i can see the skybox in scene view and game view:

sentences:
SharpDX / DirectX: How to render text to a transparent BitmapRenderTarget? I'm trying to render text to a BitmapRenderTarget, cleared with transparent color.

My TextBox is drawn on its own SharpDX.Direct2D1.BitmapRenderTarget, which I create in this way:

var bitmapRenderTarget = new SharpDX.Direct2D1.BitmapRenderTarget(renderTarget,
    SharpDX.Direct2D1.CompatibleRenderTargetOptions.None, null, null, null);

As you can see, I don't change the pixel format of BitmapRenderTarget. The pixel format of underlying SharpDX.Direct2D1.RenderTarget, on which I draw my TextBox through DrawBitmap method, is defined in the following code:

renderTargetProperties = new SharpDX.Direct2D1.RenderTargetProperties()
{
    PixelFormat = new SharpDX.Direct2D1.PixelFormat(SharpDX.DXGI.Format.Unknown,
    SharpDX.Direct2D1.AlphaMode.Premultiplied)
};

Here is the code, that produces visual results:

// In the case 1: opaque white background
bitmapRenderTarget.Clear(SharpDX.Color.White);
...

// In the case 2: white background with 50% transparency
bitmapRenderTarget.Clear(new SharpDX.Color4(1f, 1f, 1f, 0.5f));
...

// In the case 3: fully transparent background
bitmapRenderTarget.Clear(SharpDX.Color.Transparent);
...

// The color of textBrush in all these cases is the same solid Black.
bitmapRenderTarget.DrawTextLayout(vector, textLayout, textBrush, ...);

The results:

As you can see, alpha value of the text color is somehow bound to the one in the clear color. The black line around the text is cursor, and it is drawn as it should.

How to fix this issue?

sentences:
How do I use guilayout toggle event to check if true or false? OnGUI()
{
            for (int i = 0; i < scenes; i++)
            {
                GUILayout.Toggle(false, SceneManager.GetSceneAt(i).name);
            }

            if (GUILayout.Toggle(true, "New Scene"))
            {
                Debug.Log("True now !");
            }
}

First in the loop I'm adding some toggles.
Then I want to do that if specific toggle is checked(true) do something and if unchecked(false) do something else.

But the way I did it it's just changing the toggle to true automatic.

sentences: So I have this idea for a videogame. How do I make sure it gets heard? I was wondering how I could get a developer to hear about my idea. I don't really care if my idea gets "stolen", I only want it to be heard. So do you know how I could do this, or am I just being stupid? Again, I only want to know what the developer thinks of the idea, I'm not asking the developer to make it. Sorry if this is a stupid question.

sentences:
What is the benefit of a sparse bindless texture array over just bindless textures? I've seen the talks on AZDO, and they tend to suggest moving towards an architecture where you have one texture array per texture "shape". This is sparse, so you allocate loads of layers for potential future texture loads, and then commit each layer as you load a texture to it. You then make the whole thing bindless, and you can now pass a handle & layer to your shaders for texturing.

This is great, but what has it bought me above just using bindless textures? With bindless textures I seem to have to do exactly the same amount of work - in fact, a little less: I just pass in the texture handle (or sampler handle) to my shader.

So why the push for sparse bindless texture arrays?

sentences:
How to prevent "underwater sight" in games In many games where the player can go underwater, it seems like when you look where the top half of the screen is in the air, and the bottom half the screen is in the water, it's almost like the water doesn't exist and the player is... flying slowly with water sounds?

Is  there a logical way to solve this? An algorithm? Doesn't seem like any solution has come up yet since many games still have this. I don't want to make the same mistake.

sentences:
XNA HLSL Shader Glow I have googled this to death, and I still don't quite understand it.

I'm trying to create a glow effect in XNA using HLSL. A long time ago I was able to do it the way most people suggest which is by sampling the pixels from a texture, however I've always been curious about how you can make it more advanced so that you could do things like set the glow distance and stuff. If I recall from back when I was creating something like this in a similar project, there was always a limit as to how much I could sample before the computer couldn't handle it, hence limiting the glow distance. I wanted to know if there was a more sophisticated way of doing it, one that would have no glow distance limit? And I'm not referring to lighting ground textures either, the idea I have in my head is to have a set of vertices that all join together to create a LineList (for this example lets say they create a cube), so you have very thin lines creating a shape, and then you can set a glow on this object that has no limit to its distance, kinda like how Photoshop works I guess.

Thanks

sentences:
How to send data from compute shader to vertex shader I have some shaders, every shader has the same constant buffer,

//-----------------------
//constant buffer
//---------------------
cbuffer cbPerFrame : register(b0)
{
    float3 gEyePosW;
    float4x4 gView;
    float4x4 gProj;
    float gDim;
    float3 gVoxelOffset;
    float gVoxelSize;
};

I think it's a waste to send these same constant buffer several times, so I want to pack them in one Constant Buffer, and share them to other vertex shaders.

I have tried send constant buffer to compute shader, but they don't work in vertex shader.

Do I need to pack these data in one structured buffer? Is it faster than send constant buffer several times?

Is deferred shading relevant to this problem? Which solution do we usually use to solve this problem?

sentences: WM_PAINT and Direct3D I've seen people who've written in code where the graphics of a scene are rendered in response to WM_PAINT. I only ever rendered the scene once all Windows messages were done translating, and then rendered the scene. Is this the wrong way to go about it, or should I only use DirectX rendering in response to WM_PAINT?

sentences:
How can I perform a masked erase in SDL2? I'm trying to implement some shadow/lighting effects in my 2D-project, and I've concluded that if there is an easy way to perform a masked erase on an SDL_Texture, it would make the drawing operations quite cheap.

Let's say I have a texture of the part of the level where light is not meant to be rendered.
I also have a texture with my "light map"; I want to use this to just draw omni lights from my light sources.
Then I want to use the first image to 'subtract' the portions of the light map that are not to be rendered on the final scene.
Then I draw my "light map" texture on top of my scene, with additive blending enabled.

This sounds like a good theory in my head, but I can't see any functions in the SDL2 API that let me do masked erase from a texture.

Am I overlooking something?  Does anything like this exist?

sentences:
XNA Shader has an unwanted tint I'm working on a shader but it has a weird tint to it and I'm not sure why. Right now it's extremely simple, it just sets a rendertarget, draws to it, passes it as a texture to the shader then oututs the pixels to a fullscreen quad. If I remove the rendertarget/texture part and just directly pass it into the shader it comes out properly, but once I start including rendertargets the colors get a little weird.

Here are two images showing what I mean:

This is how it should look normally

This is how it looks with the rendertargets

I've included the code for the shader and the draw method below:

Shader:

float4x4 World;
float4x4 View;
float4x4 Projection;

Texture glowTexture;

sampler glowSampler = sampler_state
{
texture = <glowTexture>;
magfilter = LINEAR;
minfilter = LINEAR;
mipfilter = LINEAR;
AddressU = clamp;
AddressV = clamp;
};

struct VertexShaderInput
{
float4 Position : POSITION0;
};

struct VertexShaderOutput
{
float4 Position : POSITION0;
};

VertexShaderOutput VSOutline(VertexShaderInput input)
{
VertexShaderOutput output;

output.Position = input.Position;

return output;
}

float4 PSOutline(VertexShaderOutput input, float2 pixel:VPOS) : COLOR0
{
float2 uvPixel = (pixel + 0.5) * float2(1.0 / 1280, 1.0 / 770);

float4 finalColor = tex2D(glowSampler, uvPixel);

return finalColor;
}

technique Outline
{
pass Pass1
{
    AlphaBlendEnable = TRUE;
    DestBlend = INVSRCALPHA;
    SrcBlend = SRCALPHA;

    VertexShader = compile vs_3_0 VSOutline();
    PixelShader = compile ps_3_0 PSOutline();
}
}

Draw method:

            GraphicsDevice.SetRenderTarget(renderTarget);
            GraphicsDevice.Clear(Color.Black);

            scene.RenderGrid();
            playerList.Render();
            scene.RenderObjects();

            GraphicsDevice.SetRenderTarget(null);

            renderTargetTexture = (Texture2D)renderTarget;

            for (int l = 0; l < resourceLoader.GlowShader.CurrentTechnique.Passes.Count; l++)
            {
                resourceLoader.GlowShader.Parameters["glowTexture"].SetValue(renderTargetTexture);

                resourceLoader.GlowShader.CurrentTechnique.Passes[l].Apply();
                renderQuad.Render();
            }

sentences:
Ways to get around the limiting default terrain shaders in Unity I am trying to use the Toon Rim Light shader for Unity however there are a few problems when trying to use any custom shaders for a terrain in Unity. The most well known is of course, that all textures immediately become a blurry mess and ruins the look. The other issue is that all shading on the terrain ceases to be, and causes it to not cast shadows for both nature objects as well as characters.

I have researched methods for circumventing this problem, however all sources for troubleshooting have been inadequate in providing enough details or steps in correcting the issue and I am left to turn here for a possible better breakdown of the processes and coding involved in achieving the effect that I desire.

Thank you in advance, I appreciate any help.

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:
How would I successfully split a vector to increase game performance? Okay so I have a vector for all of the monsters that are spawned in my game. All of these monsters are in a single vector and are "active" according to what zone they are in relative to the player's zone.

If the player is in the same zone as the monster, then have the monster move around and commit actions such as attacking other monsters or the player.

This is all done on a very powerful computer: my main computer.

-BUT-

If I were to attempt using this game on my medium-end computers, the game runs on a steady 2 FPS(where on the main does 50+)

What I attempted is splitting the vector into an array of vectors
vector SpawnList to vector SpawnList[100] as a quick example

Now with this code the monsters are in separate vectors according to their zones(zone is the area that the monster is spawned in)

Note: I use Ogre3D for rendering and bulletPhysics for the physics, and I haven't figured out a way to split the monsters' rendering accordingly.

And with this new idea, my main computer even faces severe slowdowns.

I am wondering if maybe the vectors have been created wrong or it is not a good idea to have an array of vectors.

Is there a better way of having the monsters grouped together where the performance is almost maximum on any computer?

EDIT: I have Profiled my code and here are the updated results. I hope they are of help to this situation: http://pastebin.com/v0PFQf0X

sentences:
How to align a hint arrow to point along a path? I am using CalculatePath and trying to use path.corners in order to give user a hint for path, that where should he lead next. I am using first two instances of Vector3 of path.corners. Lets call those vectors A and B. Let me illustrate this using figure.

Now I want to position my arrow above the midpoint of the line from B to A, and orient it so it's pointing along the direction from B to A.

When I orient the arrow with LookAt(), it doesn't point in the same direction as the path. Here is an image of my arrow prefab, showing how it's oriented:

sentences:
How to create a character animation where the parts of the sprite change? Let's say I'm creating a game (in Java or C++). In this game I have a character that can do a sword swing animation, but the character can equip different swords.

Do I have to make an animation for each individual sword, or is there another way? I Like if a character can equip different armors, do I create a new sprite for each armor, or is there a way to have, say a base character that can perform all the animations with different swords and can have different armors on the same image?

sentences:
Is state change command less reliable than sending the entire state? I'm asking for a game that I develop right now.
The game is using TCP communication, there's server and multiple clients.
While players in a room are playing the game, I send state update commands in a custom binary protocol every 33 ms. (30 FPS)
Problem is those states are huge - there are players moving, objects spawning and also destructible blocks.

If I were to send all this data a single state update to every player will be huge, resulting in huge bandwidth.

So I'm thinking different approach:

Initially send the huge state with all moving and stationary objects, when the room starts
Do the state update commands every 33 ms, but include just the moving objects, and not include the state and location of the stationary objects.
For stationary objects, issue separate commands to tell they are destroyed or spawned and expect clients to update their copy of the state.

My concern is that it may somehow happen that due to not including the stationary objects in every state update, clients may somehow miss the separate commands that update on those and not reflect that change in their copy of the state.

Here is a visual representation of what I imagine:

Less bandwidth (is it less reliable?):

game started -> obj1 {id,location}, obj2{id,location}, obj3{id,location}
state update 1 -> obj1 {id,location}, obj2{id,location} #assumes obj3 is there
state update 2 -> obj1 {id,location}, obj2{id,location} #assumes obj3 is there
state update 3 -> obj1 {id,location}, obj2{id,location} #assumes obj3 is there
object removed -> obj3 #removing the object locally
state update 4 -> obj1 {id,location}, obj2{id,location} #obj3 not present at this point

More bandwidth - include all objects in every state update and assume if something is not present, it has been removed (is it more reliable?):

game started -> obj1 {id,location}, obj2{id,location}, obj3{id,location}
state update 1 -> obj1 {id,location}, obj2{id,location}, obj3{id,location}
state update 2 -> obj1 {id,location}, obj2{id,location}, obj3{id,location}
state update 3 -> obj1 {id,location}, obj2{id,location} #obj3 is not here, so removing it locally
state update 4 -> obj1 {id,location}, obj2{id,location} #obj3 not present at this point

sentences:
minecraft like game server database arhitecture Let's say we have a 2d map 500*500 tiles in size. And each tile is editable by players and has many states. So it's 250k tiles.  The game is multiplayer online game.

What would be the best approach from a server database perspective? Store each tile as an object in db with coordinates? Or store them in chunks? Or any other way?

sentences:
Timing - use individual timer for every task or global timer? I'm writing a game, where a player controls a spaceship.
It regenerates energy over time. So I need to make a little timer that adds certain amount of energy to the pool per second.
My enemies also shoot at me, activate different abilities. I figured I can use separate timers for these too.
But I see how this can quickly go out of hand, since I have different engines with different energy regeneration rates - will I need to replace the timer every time?
Or if I have different energy - I have to manually track all the timers and set them anew.

I thought, maybe I can use some global singleton method that can handle all the timing in my game? It can update everything in the game, and when something new happens (like new enemy spawning) I can just send my singleton information about that object and it will handle all the timing for it?

Is this a good approach? Can I read up something about this somewhere?
Maybe you have some experience with this?

sentences:
OpenGL render shapes without texture file I currently have beginner knowledge of OpenGL and something doesn't go into my head! How do I create shapes like eg. a triangle with rounded borders. Or a quad with rounded borders. Or some random irregular shape. How is something like that done?

The only thing I could think of is creating an empty texture2D and editing the pixel data per CPU, but is that the way to go or are there better ways to do something like this?

sentences: How can I loop through pixels in the material editor? I am using Unreal Engine 4, and I want to try to procedurally generate a grass texture. For now, I am using a noise block. Now I want to loop through every 16 pixels or whatever (4x4 squares), take the average color of those pixels, and make that all one "pixel". I don't see any for loops, loops, etc. in the pallete though. Can you not do this with the material editor? Thanks.

sentences:
How does the fragment shader get data from the vertex shader? How can any interactions between these two shaders work? I mean the vertex shader sends a vertex's color to the fragment shader, but that's only one fragment, what about all the other ones between the vertices?

Does the fragment shader get called a lot more than the vertex shader?

I mean the fragment-to-vertex ratio is pretty high in most games, given that a fragment is a pixel, right?

sentences: Performance of Tristrip vs Indexed Triangles in OpenGL Let's say that I want to take advantage of GPU transform cache and use tristrips for that purpose. In the first case we have three triangles: 012, 213, 234. In the second case we used tristrip topology and passed indices to GPU: 0 1 2 3 4. In both cases all vertices will be cached on GPU. The only difference is the size of index buffer. In the first case (triangle topology) the size is 9. In the second case the size is 5. Even if we get 2x-3x size reduction, the index buffer is usually not the bottleneck. So, the question is why we get performance boost when using triangle strip vs indexed triangles in OpenGL?

sentences:
How do I ensure that perspective and orthographic projection matricies show objects at the same size on the screen? I am working on a 3d scene editor and would like to show the scene in orthographic projection. My current problem is that I am not sure how to calculate the orthographic projection matrix such that the objects do not appear at a completely different size on the screen.

I currently have the following 2 functions for calculating the camera projection matrix.

Matrix4.createPerspective = function(fov, aspect, near, far, result) {
    if (typeof result === 'undefined') {
        result = new Matrix4();
    }

    var ymax = near * Math.tan(fov * Math.PI / 360);
    var ymin = - ymax;
    var xmin = ymin * aspect;
    var xmax = ymax * aspect;

    Matrix4.createFrustum(xmin, xmax, ymin, ymax, near, far, /*out*/ result);

    return result;
};

Matrix4.createOrthographic = function(left, right, top, bottom, near, far, result) {
    if (typeof result === 'undefined') {
        result = new Matrix4();
    }

    var re = result.elements;
    var w = right - left;
    var h = top - bottom;
    var p = far - near;

    var x = ( right + left ) / w;
    var y = ( top + bottom ) / h;
    var z = ( far + near ) / p;

    re[0] =2/w;  re[4] = 0;   re[8]  = 0;   re[12] =-x;
    re[1] = 0;   re[5] =2/h;  re[9]  = 0;   re[13] =-y;
    re[2] = 0;   re[6] = 0;   re[10] =-2/p; re[14] =-z;
    re[3] = 0;   re[7] = 0;   re[11] = 0;   re[15] = 1;

    return result;
};

And this is how they are being used:

    updateProjectionMatrix: function(entity) {
        var camera = entity.getComponent('Camera');
        if (camera.isDirty()) {
            camera.aspect = camera.width / camera.height;
            if (camera.isOrthographic()){
                Matrix4.createOrthographic(
                    0,
                    camera.width,
                    0,
                    camera.height,
                    camera.near,
                    camera.far,
            /*out*/ camera._projectionMatrix);
            } else {
                Matrix4.createPerspective(
                    camera.fov,
                    camera.aspect,
                    camera.near,
                    camera.far,
            /*out*/ camera._projectionMatrix);
            }
        }
    },

Here is an example of what I am trying to accomplish inside Blender (F5 toggles between Ortho and Perspective). Note that both cubes appear to be about the same size on the viewports:

sentences:
Dragging and dropping sword in unreal engine 4 I am developing a 2d game using unreal engine 4 in which the user drags and drops a sword.I want the sword to follow the position of my finger.At the moment, when I drag the sword, it moves at an offset from my finger.The game has been packaged to an pad and I have set up the functionality using blueprints.

Pseudo code:

On Drag (){

finger position = sword position on screen

on drop = finger position on release from screen = position of sword

}

How do I make the sword follow the position of my finger as I drag it?

sentences: Tab between input fields I am new to working with Unity3d, I need to navigate between several inputField, for this I have looked at the solution that is in: tab-between-input-fields, but always the FindSelectableOnUp() or FindSelectableOnDown() returns null, so my next is always null and always ends in: next = Selectable.allSelectables[0];

sentences:
Effort of impementing interpolation in networked Asteroids Questions:
When we draw with interpolation, where should the collision detection code be?
Is it worth implementing interpolation in the following situation?

This is for Scrolling Asteroids. I have my game working at the moment without interpolation. It does physics updates using fixed step time deltas. The frame display rate is decoupled from this. So, it might be doing 40 Physics updates per second and 75 frame draws per second. Up until now, it is in the physics update routine that I do the collision detection and response. Your ship can collide with a rock. Your photons (bullets) can collide with a rock.

Now I am considering improving it to use interpolation as per all the good articles recommend:

http://www.koonsolo.com/news/dewitters-gameloop/

and

http://gafferongames.com/game-physics/fix-your-timestep/

So when this is implemented, I might be making the following calls:

update(dt)
draw(0.24)
draw(0.64)
update(dt)
draw(0.24)
draw(0.76)

The floating point numbers shown are examples of actual calculated interpolation value i.e. the proportion of the physics update that is complete at the time the frame is being drawn. I am going to have to change the draw code to draw the objects at a fraction of the distance between their previous and current value positions and rotations. That is yet to be done.

Question: Will I also have to do move my collision detection code out of the update routine and into the draw routine, seeing as I will be drawing these interpolated frames ?

Bear in mind, my highest priority goal is to make this networked: multiple player ships on as large a Universe as possible. So a physics update solution that is compatible with the networked game that is required. Is the interpolation worth the effort? Right now. I rarely if ever see a problem with smoothness. If I reduce my physics updates to 25 per second which I have only done as an experiment then it is a bit jerky. But the game easily runs at higher rates than that so there may never be a problem.

So the two questions:

Collision detection where?
Is introducing interpolation worth the
effort or should I proceed to networked version straight away?

Thanks in adance:

sentences:
Unity C# - Change color, or material of specific line segments on Line Renderer We're making a game that plays with a LineRenderer, and we want to give it a different visual feedback relative to the side of the screen that it's on.

We want to change the feedback of the specific line segments that are on the other side (when they past the middle point).

The API lets you map the segments positions, but isn't there a way that you can change the material/color of that specific segment? I just see that you can do it, but only for the whole Line Renderer, not segment-by-segment.

sentences:
Unity : Changing color of 2D sprite distorts sprite shape In my 2D game, my circle shape for example, appears round, but when I change the color then it turns into a low poly circle with 8-16 points, more like a potato. Is there any way around this?

    myColor = new Color32 ((byte)colorR1, (byte)colorG2, (byte)colorB3, visibility);
    Color32 negativecolor = new Color32 ((byte)colorR1, (byte)colorG2, (byte)colorB3, (byte)(255-visibility));
    MaterialPropertyBlock props = new MaterialPropertyBlock ();
    props.SetColor ("_Color", myColor);
    rend.SetPropertyBlock (props);
    props.SetColor ("_Color", negativecolor);
    backchildrend.SetPropertyBlock (props);

sentences:
XNA for multiplayer game? I've made a few games without using XNA and recently started to see some documents and samples around and took an interest on it but i have a few doubts for going into it or not.

What limitations do i have if i am planning to create a mmorpg with XNA for distributing it (if it has a item mall or is paid to play for example) ?
Do i need more accounts to test it (for example to login into my own game 3 players) or XNA does not cost anything at this level (heard something about LIVE Gold Membership plus which is why i am asking this one) ?

sentences:
Determine inventory item position shape Not a great title but couldnt think of a shorter way to describe it.

I am trying to think of the best way to determine the shape of items placed in the players inventory. I guess the best examples to explain would be something like the Horadric Cube in Diablo 2 or I suppose also, the Workbench in Minecraft. There are others, I just can't remember them.

Currently the best way I can think of involves multiplying the cell numbers each item is in. This way I can look at the product of that multiplication and know from a short list of values, what shape the items are in.

Example

My inventory is ordered like so:

1 | 2 | 3
4 | 5 | 6
7 | 8 | 9

I would also have various arrays of preset values like:

FourSquares - 40, 180, ..., ...
VLines - 28, 80, ...
HLines - 6, 120, ...
Backslash - 45
Forwardslash - 105

etc, etc

So, say the user places items in 1, 2, 4 and 5 - That would give 40 and I could loop through each shape array and determine that it matched a value in the FourSquares array and go from there.

Does this seem like the best way to do it? Is there maybe a way that I wouldnt have to loop through the arrays? Would this be possible with bitwise operations maybe?

sentences:
How do I tile a specific region of a sprite? I have a sprite that I use as a sprite sheet, where regions of the image represent various UI elements (window corner, border, background, etc.).

I want to use a certain region of that sprite as a texture that I can tile over a larger destination rectangle.

Setting the SamplerState to LinearWrap and then calling SpriteBatch.Draw with destination rect and source rect ends up stretching that region of the image, not tiling it.

All the examples I've seen that implement tiling use the entire sprite - I only want to use a region of it, and tile that region.

Is there any way to do this?

Edit for clarity:

Here's an example spritesheet

where I want that colored region. I have a rectangle that represents a window border, that is larger than the region in the source image.

Here's what I want to end up with

Here's the code I've been using.

spriteBatch.Begin(SpriteSortMode.Deferred, null, SamplerState.LinearWrap, null, null);
spriteBatch.Draw(sourceTexture, windowTopBorderRect, sourceTextureRegionRect, Color.White, 0, Vector2.Zero, SpriteEffects.None, 0);

And what I get is the image stretched across the window border rectangle, instead of tiling the source region within that rectangle.

sentences: 2-D character not falling to the ground I am very new to Game Development and I am making a game with a simple Ragdoll which has a body, a head, and 2 limbs(hands). The head and the limbs are hinged to the body and I have kept the Ragdoll above a cube to be used as the ground on which the Ragdoll falls. Till now, I haven't added any scripts for movement or anything, I just want my Ragdoll to fall on the cube below it properly. But when I click play, the Ragdoll just starts to float above its original position. When I move it through the editor away from the cube(ground), it does fall down. It's like the cube is opposing the downward acceleration of the Ragdoll. The Ragdoll won't land on the cube. All the bodies have Rigid body and collider scripts. The Ragdoll also doesn't disassemble, it manages to keep itself together. Can someone please tell me what I am doing wrong. I researched about this but I have found no solution. I am using the free version of Unity.

sentences: LibGDX - Show a minimap I've started to develop a small roguelike game in LibGDX. I've also made a minimap class, which creates and updates the minimap as the player explores the dungeon, by using a Pixmap. The minimap class has an OrthographicCamera (currently unused), which will be used for centering the minimap on the player. The minimap is currently rendered with it's own SpriteBatch. Now I'd like to put the minimap on the upper right corner, and clip it, because it is so big, that it'd obscure the half of the screen. I'm not really sure how to do this clipping part. I assume I should use the ScissorStack class, but the LibGDX wiki is a bit uninformative for me.

sentences:
Unity augmented reality app doesn't work on android I am pretty new to unity and augmented reality applications. I use unity 2019.4.4f1 and my project is very simple as you can see in the screenshot below:

I am using Wikitude plugin for image tracking and the image i am using as the marker is the Jack of Clubs card as you can see in the assets. The project works fine when i press play and use my laptop's webcam , but when i build the project for android (unity 2019 automatically uses Gradle to build the project) and install the .apk file in my android phone, all i see on my phone screen when i open the application is:

As you can see the phone camera doesn't work and it gets stuck in this screen. How should i fix it? Does it have to do something with Gradle? I haven't tried using unity version 2018 to build it using the "Internal" build option. Anyways that's just my own thought and i might be wrong, but the final question remains which is how this problem can be fixed?
By the way i don't build the .apk file directly from the unity engine. I use the export option in unity to get a gradle project folder then i use that in Android Studio to build the final .apk file. The reason that i don't use unity to build .apk is that it gives errors and doesn't work for me so this is the solution i found for it.
Update: I debugged the application and it seems that the application needs camera permission to work, this is my debugging log:
07-22 17:47:16.908: E/Unity(32483): On Camera Error
07-22 17:47:16.908: E/Unity(32483):         Error Code: 1000
07-22 17:47:16.908: E/Unity(32483):         Error Domain: com.wikitude.camera.android
07-22 17:47:16.908: E/Unity(32483):         Error Message: Permission denied. Make sure to have camera permissions before trying to access the camera.
07-22 17:47:16.908: E/Unity(32483):
07-22 17:47:16.908: E/Unity(32483): (Filename: ./Runtime/Export/Debug/Debug.bindings.h Line: 35)

I'm pretty sure that it didn't ask for camera permission, how should i allow the permission if it's not asking?

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:
Different camera movement methods in a 2d- side-scrolling game that makes it fun Possible reference to this question, but I want specific answers pertaining to Side-scrollers.
IMO, side-scrollers can be classified as

Player doesn't move, the background graphics move to fake player movement.
Player moves also background moves, but background movement is dependent on the (x,y) movement of the player > I find this more appealing
Player can't move, the background
moves at a fast speed. Depending
upon the obstacles coming along with
the background the player has to
perform actions like jumping,
ducking, charging, etc...

I would like to know what all other things can be added to the gameplay so that the above mentioned 3 side-scroller categories can be made more addicting.Please mention the category of the side-scroller in your reply.
Edit Modified the question title to reflect what I actually want

sentences: How to remove a component of an object in a script? I want to remove a Sphere Mesh Renderer component from a certain gameobject. I want to do this in a script. How do I do it? I do not want to destroy the sphere itself, just the component

sentences:
Why are entities in a component system composed at run time? Why are entity component systems the way they are? For example as far as I have seen it may look like this

class Entity
    list of components
    add component
    remove component
    update comentent
    ....

So you are building your entities at runtime. I assume it will look like this

 Entity ork;
 ork.add(AI).add(movement).add(physics).add(renderer)

The problem I see with this approach is that errors appear at run time instead of compile time. It also seems to add a lot of potential errors for example the AI system only makes sense if the entity also has a movement component.

What is the advantage of building your objects that way instead of doing it like this?

class Ork: IEntity
     movementComp
     AiComp
     physicsComp
     rendererComp
     ....
     //wire everything together

One possible advantage that I can see is that object creation takes less code because you don't really need to wire up your objects, you just add your components and your done.

Would you please enlighten me?

sentences:
How do I get a Model to add a name to it's Texture(s) in the XNA Content Pipeline I know that a texture's name is not preserved when it's loaded in.  I also know that you can give it a name.  For example:

Texture2D texture = content.Load<Texture2D>("MyTexture");
texture.Name = "MyTexture"; //Or whatever else you want to call it

However, what about when you load a model?  It automatically loads in the right texture for each ModelMeshPart, and drops the Name (no idea why though).  This is fine, right up until the point where you actually want to identify which texture that ModelMeshPart is using.  I found someone else having the same problem here.  Shawn Hargreaves gave this solution:

  If you need access to this data at runtime, you will need to extend the pipeline to store it somewhere else. For instance you could use a custom processor to store texture filenames in the ModelMeshPart.Tag property

I figured that was easy enough. Yeah...feel free to point and laugh.  I got as far as creating a custom proccessor class and inheriting the standard ModelProcessor before I realised that I didn't know exactly where the ModelMeshPart's texture was stored and I've spent the past few days trying to find out.

I just want to preserve each part's texture name so that I can do something like

Model model = content.Load<Model>("MyModel");
BasicEffect effect = (BasicEffect)model.Meshes[0].MeshParts[0].Effect;
string texName = effect.Texture.Name;

Also Merry Christmas.

EDIT

For the record, I'm importing a .x model.

sentences:
Problems with Creating Snake's Clone on Java I'm creating Snake's clone. My app have too classes: Snake.java and Board.java.

Right now I have three problems:

1) There are two constants - BOARDS_WIDTH, BOARDS_HEIGHT. They are meant to be dimensions for playground where snake moves and collects apples. It's dynamic and I can set them as I want. For example 640 x 480, 160 x 160 or whatever. Only thing I need to keep in my mind is that both numbers must divide with 16. Why? Because constant UNIT is set to 16 x 16 and, for example, when board's dimensions are set to 160 x 160, it means that there would be 10 x 10 units large playground (160 / 16 = 10). Problem: playground is always two pixels (not units) larger than it meant to be. Like if I have set dimensions to 160 x 160, actual dimensions will be 162 x 162! Here are screenshot...

If you measure this image... after pill (apple, if you like) there are two extra pixels.

2) Collisions. I think - it's because problem #1. You see, there are code lines...

if( x[0] < 0 || x[0] > BOARDS_WIDTH || y[0] < 0 || y[0] > BOARDS_HEIGHT ) {

    inGame = false;

}

They should prevent snake from going into walls. Actual result is that snake goes few units in the wall - then only the game stops... i want it to stop exactly when snake collide with the wall!

3) How to make snake start to move only when users clicks any of arrows? Right now it's like snake starts to move her body, but her head is stopped. After joints * DELAY snake's all joints are under her head! Ha, ha...

sentences:
Maya .IFF plugins for Gimp Maya's preferred format for saving off a UV Snapshot is its own .IFF format, so I was hoping to find a plugin allowing Gimp 2 (Windows) to read it. I've found plenty of plugins for different linux distros, but none are win-friendly (that I can discern - admittedly I'm no whiz with Gimp). Does anyone know of one?

Alternately, .tiff seems to work just fine, so if there's no good reason to bother fiddling with IFFs, I'd appreciate the input there, too.

(sorry if this isn't on-topic)

sentences:
Limit rotation angles for Quaternion I have a short snippet that's rotating the meshes of the wheels as I'm driving forward, but it's also rotating wheels to match the direction I'm turning, and I wish to turn this off completely.

        Quaternion quat;
        Vector3 position;
        m_WheelColliders[i].GetWorldPose(out position, out quat);
        m_WheelMeshes[i].transform.position = position;
        m_WheelMeshes[i].transform.rotation = quat;

How would I lock what angles I don't want the wheel meshes rotating?

sentences:
How can a resource manager have dynamic loading/unloading without creating dangling pointers? I have a resource manager that manages the lifetime of resources in memory. A "resource" is something like a texture, mesh, et cetera. I also have an entity class that, the base class for things in my game world, which has pointers to individual resources.

I'm thinking about giving my resource manager a memory quota so it can free and reload resources as it needs to in order to satisfy this quota, and I'm wondering how I could go about this without ending up with dangling pointers in my entity objects.

I'll need the ability to free up a mesh or texture at any time in the resource manager.

I could use shared_ptr in the resource manager and weak_ptr in the entities (as long as I don't expose a shared_ptr out side of the resource manager, I'd still get the ability to free them on demand), but I am more interested in how you would do it without those classes, for example before C++11 existed or before Boost's smart pointer library existed.

sentences:
Unity2D - How to leave and come back to the same scene properly? I am new to game development and for exercise I made endless runner where everything is generated randomly from prefabs and both player and obstacles are being destroyed once they are off the screen. There are two scenes - Start and Game. At the Start scene you can click on Play button which will take you to the Game scene and you can mute the sound.

When I start the game and I click on the Play button it loads the Game scene perfectly and game runs and works just fine. When player dies the game over window is shown. From there two options are available - either go to the Start scene or play the game one more time.

If I choose to play one more time everything works perfectly. But if I choose to go to the Start scene and then click on Play button to play the game then once the Game scene is loaded the player and the obstacle game objects are not being generated and floor and background Quads are not being resized properly to fit the screen. And I get the following error -

MissingReferenceException: The object of type 'RecycleGameObject' has been destroyed but you are still trying to access it.
Your script should either check if it is null or you should not destroy the object.
ObjectPool.NextObject (Vector3 pos) (at Assets/Scripts/ObjectPool.cs:28)

My question is  - what can I do so that every time I come back to the scene everything is being loaded just like the first time?

I am currently loading scenes with this code:

SceneManager.LoadScene("Start");

And this is the ObjectPool class:

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

public class ObjectPool : MonoBehaviour {

    public RecycleGameObject prefab;
    private List<RecycleGameObject> poolInstances = new List<RecycleGameObject>();

    private RecycleGameObject CreateInstance(Vector3 pos)
    {

        var clone = GameObject.Instantiate(prefab);
        clone.transform.position = pos;
        clone.transform.parent = transform;

        poolInstances.Add(clone);

        return clone;
    }

    public RecycleGameObject NextObject(Vector3 pos)
    {
        RecycleGameObject instance = null;

        foreach(var go in poolInstances)
        {
            if(go.gameObject.activeSelf != true)//here I get the error
            {
                instance = go;
                instance.transform.position = pos;
            }
        }

        if(instance == null)
        {
            instance = CreateInstance(pos);
        }

        instance.Restart();

        return instance;
    }

}

sentences:
Indirect indexing (uv coords read from texture) In the vertex shader, I need to make a texture fetch, where the texture coordinate itself is read from some other texture.

vec2 uv = texture(someTexture,coords).xy;
vec4 val = texture(otherTexture,uv).xyzw;

As far as I know, the second sample has undefined results, because the value of uv is outside of uniform flow control.

Is there any way to efficiently (i.e., not copy back the contents of the texture and upload it as a uniform to the shader or something) do what I want to do?

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:
Is this really the reason for smoother movement? Actually i'm watching a tutorial series on youtube about 2D Game programming in Java.
My question is about the player-movement.

The first version:

        public void keyPressed(KeyEvent e) {
            int key = e.getKeyCode();

            if(key == KeyEvent.VK_RIGHT) {
                player.setX(p.getX() + 5);
            }else if(key == KeyEvent.VK_LEFT) {
                player.setX(p.getX() - 5);
            }else if(key == KeyEvent.VK_DOWN) {
                player.setY(p.getY() + 5);
            }else if(key == KeyEvent.VK_UP) {
                player.setY(p.getY() - 5);
            }
        }

The problem in this first version is, that if you press now for example VK-RIGHT (and holding it), than the figur in the game moves first one step to the right, then stops for a half second or so and then the figur moves constantly to the right.
The problem here is the stopping, which takes a half second or so. This is not smooth.

Then the author of the tutorial presented a second, better version:

        public void keyPressed(KeyEvent e) {
            int key = e.getKeyCode();

            if(key == KeyEvent.VK_RIGHT) {
                player.setVelX(5);
            }else if(key == KeyEvent.VK_LEFT) {
                player.setVelX(-5);
            }else if(key == KeyEvent.VK_DOWN) {
                player.setVelY(5);
            }else if(key == KeyEvent.VK_UP) {
                player.setVelY(-5);
            }

        }

        public void keyReleased(KeyEvent e) {

            int key = e.getKeyCode();

            if(key == KeyEvent.VK_RIGHT) {
                player.setVelX(0);
            }else if(key == KeyEvent.VK_LEFT) {
                player.setVelX(0);
            }else if(key == KeyEvent.VK_DOWN) {
                player.setVelY(0);
            }else if(key == KeyEvent.VK_UP) {
                player.setVelY(0);
            }

        }

and the tick() method in the Player.java:

public void tick() {
    x += velX;
    y += velY;
}

The author said, that the second version is smoother, because we don't need to ask first with the get-methods the actually value of x/y.
Is this really the reason, why the second method is smoother respectively we don't have still this stop for a half second or so?

If this is really the reason, why the start time of the player figur is in both version the same? In the first version the player figure would then have to need more time to start movement? But this is not the case! The difference is this stop for a half second or so after the first steop of movement is finished.

sentences:
Unity custom inspector - How to serialize scene objects in ScriptableObject? I am writing a custom inspector for the artist in our team to design some simple animations (without using mecanim).

The basic setup is the following:

Animations are saved as ScriptableObjects. There is a class AnimationBase that inherits from ScriptableObject and different Animation classes that inherit from AnimationBase.

There is an AnimationSystem script that stores the animations for one gameobject. Animations can be added dynamically for different events (I got multiple MyAnimation[] to store those per event type). It also stores a string with the name of a ScriptableObject AnimationList. That ScriptableObject stores the filenames for all the used animations in lists of strings for the different animation event types.

Now I have an animation "EnableAnimation" (inheriting from AnimationBase and therefore a ScriptableObject) that should enable a gameobject. If I select a gameobject from the assets, the reference is saved in the EnableAnimation asset as expected. But when I select a gameobject from the scene, the EnableAnimation assets shows "Type mismatch" instead.

I think the problem is that I use a EnableAnimation asset but want to store information in the scene. Is it possible to store the ScriptableObject in the scene instead?

Other things to take into account for solving the problem:

The custom inspector should work for prefabs, prefab instances and normal gameobjects. If possible prefab instances should be allowed to use the same animations as the prefab but change some values per scene.
I have a prefab "A" that has an AnimationSystem component and a child gamobject "B". With the default inspector I can select B as an gameobject in a script and apply that change to the prefab. If I select a different gameobject in the scene and try to apply, the prefab does not save the reference. If possible, this behaviour should be used too.

Thank you for your help!

sentences: Run a method once per iteration without adding a component to a game object in Unity I want to run a function once per main loop iterator but I don't want to add this as a script to a game object in my scene. This is something that should always run no matter what scene and making people include it into every scene on a game object would cause issues because I'll/people will forget. Is there any hooks into the main loop where I can tell unity to run this function once per loop for the entire game not just per scene?

sentences:
When using IK the player head is looking at down the ground instead looking at the object target up what can be the problem? This script is attached to the player :
using UnityEngine;
using System;
using System.Collections;

[RequireComponent(typeof(Animator))]

public class CharController : MonoBehaviour
{

    protected Animator animator;
    public bool ikActive = false;
    public Transform lookObj = null;
    public float lookWeight = 2f;

    void Start()
    {
        animator = GetComponent<Animator>();
    }

    //a callback for calculating IK
    void OnAnimatorIK()
    {

        if (animator)
        {

            //if the IK is active, set the position and rotation directly to the goal.
            if (ikActive)
            {
                // Set the look target position, if one has been assigned
                if (lookObj != null)
                {
                    animator.SetLookAtWeight(lookWeight);
                    animator.SetLookAtPosition(lookObj.position);
                }

            }

            //if the IK is not active, set the position and rotation of the hand and head back to the original position
            else
            {
                animator.SetLookAtWeight(0);
            }
        }
    }
}

When the lookObj is a sphere or a cube it's working fine but if the lookObj for example is a big spacecraft now the player head will look to the ground down and not to the spacecraft up :

The problem is that the center of the spacecraft is at the bottom this is a screenshot when it's showing the spacecraft at regular when it's in Pivot mode :

Now when I click on the Center button now the center of the object is at the bottom :

Is there any way to fix it maybe eve fix it ?

sentences:
Hide/move the Particle Effect panel on the Scene view window The problem for example is if I want to drag the particle system object to the bottom-right corner of my view, then it goes behind the Particle Effect panel.
Is there any way to do hide or move this panel in editor mode and/or in runtime mode?

sentences:
What are the minimum requirements for UDK on iOS? Infinity Blade asks for 3GS or better devices, which I'm told is because it uses OpenGL ES 2.

Will every game made with the iOS version of the UDK only work with 3GS devices and up?

sentences: What size should i use for my game design? i am currently working on a android game by using libgdx and i am designing graphics with ps for it. I want my game looks the same quality for different screen sizes but i dont know in which size should i design my graphics. For example if i design the graphics 200x200 size and for a bigger screen i should make it bigger by resizing with code. But this will demage the graphic which is something i dont want. What i think is to make a much bigger graphic then shrink for ever screen sizes. is that right approach to do? Or there is a better way. And also if this approach what size should i use for portrait game. Like 800 width is good? Thanks for ur answers.

sentences:
How to simulate a water splash effect? I need to achieve the effect of a ball falling down into a pool then splashing in the water.

At first, I made a sensor to detect the collision between the ball and the water and then show the sprite of the spray.
But it's hard to change the sprite according to the velocity of the ball and the angle between the ball and pool.
So, I want to simulate the physical model of the water.

Now, what I can do is to add a particle system using Cocos2D to show the still water and add physical model to each particle. But, I don't think it is a good solution.
Any other I can do it? Waiting for you help.

sentences:
Unable to launch Unity due to license glitch A few hours ago, Unity crashed on me.  When I went to re-launch it from Unity Hub, that's when the nightmare started.

Any time I try to launch a project from the Unity Hub, the Unity Hub disappears, the Unity splash screen opens, and then about 3 seconds later the Unity Hub reappears, followed shortly by the Unity splash screen disappearing.  I can't get the editor to actually load!

I looked in the Unity Editor log and found this:

[LicensingClient] ERROR Failed to connect to local IPC
[Licensing::Module] Failed to connect to channel: LicenseClient-Mason
[Licensing::Module] Successfully launched the LicensingClient
[Licensing::Module] Successfully connected to LicensingClient on channel: LicenseClient-Mason
[Licensing::Module] Successfully launched and connected to LicensingClient
Entitlement-based licensing initiated
[LicensingClient] Licenses Updated successfully in LicensingClient

LICENSE SYSTEM [202059 16:58:48] Next license update check is after 2020-05-10T19:18:29

Built from '2019.3/staging' branch; Version is '2019.3.10f1 (5968d7f82152) revision 5859543'; Using compiler version '191627012'
OS: 'Windows 10  (10.0.0) 64bit' Language: 'en' Physical Memory: 16332 MB
[Licensing::Module] License is not active (com.unity.editor.ui). HasEntitlements will fail.
BatchMode: 0, IsHumanControllingUs: 1, StartBugReporterOnCrash: 1, Is64bit: 1, IsPro: 0
No valid Unity Editor license found. Please activate your license.

I do, in fact, have a valid Unity Editor license.  It was working just fine this morning, and it doesn't expire for several months yet.  Looking at the "Manage license" function in Unity Hub confirms this.  A bit of Googling suggests doing some of the following things, all of which I have tried, to no avail:

Reboot the computer.
Delete the Unity license file in C:\ProgramData\Unity and recreate it in Unity Hub.
Uninstall and reinstall Unity.
Update to the latest Unity version.

There was no Windows Update, driver update, or hardware change that could have provoked this.  It happens no matter which version of Unity I attempt to open, and no matter which project I attempt to open, and nothing I do to attempt to fix it actually works!

The one thing that does work, for whatever reason, is creating a new Unity project.  This creates a new project as expected, but the Unity theme is reverted to a light gray background, rather than the dark mode I'm accustomed to with my license, and once that project is closed, attempting to reopen it is just the same as attempting to open any other Unity project.

I tried opening Unity on my old, broken computer that has the same license, and it opens just fine... but that computer is old and broken, and will take several times longer to do anything on.  Apparently there's some serious issue, specific to my dev machine, that came out of nowhere this morning and is causing license verification to fail.

Anyone have any idea how I can fix this or, failing that, how I can reach someone at Unity Technologies to get their help fixing it?  Try as I may I can't find any option anywhere on their web site to reach a human being for customer service, at a time when I urgently need a live human being, rather than a "open a ticket and we'll try to respond to it within 3 days if you're lucky".  I'm just finishing up something that I was hoping to have ready today, and this has disrupted everything!

sentences:
How do I get and install the Android SDK on my Ubuntu OS? I heard that it would be a lot easier to do java type games and then move on to Android gaming?
I AM a total beginning but with motive and I have been reading about it from several sources, including similar questions on this site alone.
But I need to know specific things from experienced users.

As for getting the SDK and Eclipse on the computer, I'm having trouble with it, I am running Ubuntu btw so exe files are useless. But I have tired terminal use but I kind of failed because I don't think the SDK and Eclipse are installed, just downloaded.
Ubuntu users especially, I can use help from you seeing how complicated Ubuntu can be compared to windows "click install" setups.

Also if you guys really suggest me learning Java first (which is still a big question cause I don't want to waste time with something I don't want to really use, but getting the feel of gaming is pretty important I know) I am looking at this tutorial:

http://zetcode.com/tutorials/javaswingtutorial/

And it talks about using swing toolkit, but idk how to get that exactly, I tried searching. Sorry for the noobness, but gotta start somewhere and I'm new to this site so I'm really hoping you guys can really help me. I want to make simple games to put on the android market, and then advance.

So going to the tutorial above, it just kind of starts with giving me coding and whatnot which is fine, just copy it but idk where exactly to do all this on (Swing toolkit?) so I can't even start with that.

But really I want help getting this SDK and Eclipse/plugins on my computer and then I can continue with this guide:

www.rbgrn.net/content/54-getting-started-android-game-development

Which is the main guide that I probably should follow, and would be great if some expert skims it a little at least to see if I should start with that guide and skip the java.
But again, I'm stuck on the SDK stuff.

Sorry for the long questions, I am new and I really want to get out of this beginner stage, it's the worst part. Tank you to all and if you want my facebook or AIM to help me through with IM to at least get this SDK and stuff installed fine with Ubuntu OS, ask please (:

sentences:
In games physics engines, what is "tunneling", also known as the "bullet through paper problem"? I have recently had an issue where sometimes a collision would not be detected. Someone told me that maybe I had an tunneling issue.
In the context of game development using physics, what is tunneling?

This is a low-ball question; I realized when suggesting someone that maybe they had that issue that we did not have a clear explanation around about what the issue was, so this question is meant to help users explain things with fewer words.

sentences:
Circular dependency when creating entities I have the following problem:

I have a a class called Stage, that keeps an list of entities, which it iterates over every update loop, and updates them.
One of these entities might be a weapon (PEW PEW!) that when updating spawns new entities (projectiles, KA-ZOOM, KER BANG!).
How do I add these new entities to the list in of entities in Stage?
Currently, I have Stage as an singleton with global access, so that the entities which in turn spawns entities just calls the instance of Stage's addEntity method, but that feels silly.

Stage -> Entity (weapon) -> Stage again?

I have a similar problem when creating enemies:

Stage -> Entity (enemy wave) -> Stage again

I've been thinking about passing the List into all entities that can create other entities, but then I'd have to change the update method for the base Entity class so that it takes this list, a list which most entities have no need of.
Also, when adding an entity to Stage, Stage must be made aware of a number of graphics components for that entity, in order for Stage to be able to tell the renderer (which has an OpenGL context) to load the appropriate resources for those graphic components.

Any ideas what I should do?
Am I doing it the wrong way now?

Also, while we're at it, why is Singletons so frowned upon?

sentences: Is it possible to move a parent object independent of the child object I need to be able to move a Parent Object without moving the Child Objects.

sentences:
database design for a game like "Empires and Alies" in facebook recently im trying to create a isometric game for facebook pretty much like Empires and Allies in facebook , i have used as3isolib to create the game , the user interactions are almost ready , but im stuck in designing the database for it .

i tried to search online but i could'not find any source or sample db designs for it ,,, i have big problem in design db in the way that can handle the different item types , like , housing , research labs , units , their staus and so on, let's say when we build a house it would have different levels to be completed , or different building has different product , and some item's product is still a product , like military house which produce soldiers ... if any body can guid me or a sample design i'll really appreciate it . Thanks.

sentences: Unity Ragdoll moves away from parent So this is a weird one. I've looked it up but can't find anyone with similar issues. Basically I have a simple combat system and after the enemy health is zero I go through each rigidbody component in the enemy object and add a force to make it go flying on death. For some reason, the parent object isn't affected and stays still while the Skeleton goes flying. Does anybody know how to make the parent object follow the skeleton, or make the skeleton follow the parent because as of now they act as separate entities? I've tried just adding force to the parent but that only moves the parent object and none of the children. Would appreciate any advice! Thanks.

sentences:
First object jumps on re-entry of second colliding object The scenario is that I have two objects - Object A and Object B. The Object A is lying on the ground and when Object B enters the collider of Object A, the Object A moves (only X and Z axis) with Object B. The movement works well with the script shown below.
The issue is that most of the time, the Object A's initially position shifts by few meters whenever Object B enters its collider. I feel it is related to offset position. What should happen is that, Object A should be the same position when Object B enters the collider and move along with Object B only when Object B moves.
So how do I fix this?
private Vector3 offsetPosition;

public Transform ObjectB;

public bool ObjectB_Collision = false;

void Start () {
        offsetPosition = ObjectB.transform.position - this.transform.position;
    }

    void ObjectB_HasEntered() {
        offsetPosition = ObjectB.transform.position - this.transform.position;
    }

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

        if (ObjectB_Collision == true) {
            this.transform.position = new Vector3 (ObjectB.transform.position.x, this.transform.position.y, ObjectB.transform.position.z) - new Vector3 (offsetPosition.x, 0, offsetPosition.z);
        }

    }

public void OnTriggerEnter (Collider col) {
        if (!enabled) return;

        if (col.gameObject.name == "Object_B") {
            ObjectB_HasEntered();
            ObjectB_Collision = true;
        }
    }

public void OnTriggerExit (Collider col) {
        if (!enabled) return;

       if (col.gameObject.name == "Object_B") {
            ObjectB_Collision = false;

        }
    }
```

sentences:
Modify a character's rotation without altering it's movement I have a character that moves around using a virtual joystick on screen (mobile game joystick) however the player doesn't face forward to the position the joystick is pointing. Whenever I modify the rotation values on script it goes off the rails and moves erratically. What can I do to achieve this movement without altering it's translation?

Here is my script:

     void Update()
{

    horizontal = inputJoystick.horizontal();
    vertical = inputJoystick.vertical();

    moveDirection = new Vector3(horizontal, 0, vertical);
    moveDirection = transform.TransformDirection(moveDirection);
    moveDirection *= speed;

    //rotationDirection = new Vector3(horizontal, 0, vertical);
    //transform.rotation = Quaternion.LookRotation(rotationDirection, Vector3.up);
    controller.Move(moveDirection * Time.deltaTime);

}

sentences:
Bloom not working on mobile build (URP) I am trying to add bloom in my unity game for mobile phones using URP,
The problem is, everything works perfectly in the editor/pc,
But the bloom effect vanishes on the actual apk build.
This is how it looks in the editor - Upper window is game view and below is the scene view

This is what it ends up on the mobile -

All the other post processing effects works except bloom...
Unity Version - 2020.1.2f1
URP Version - 8.2.0
Post processing is enabled on the camera component
HRD is enabled in the SRP settings asset
I don't know what am I missing or even it is possible to have bloom on mobile.
I've tried all sorts of things, but nothing works, Even tried on multiple android devices,
But I get same results every time...
Anyone who knows how to make it work, please help me,
I'll be really grateful.

sentences: One single texture atlas? When I want to use texture atlasing, should I try to place all of my sprites into one single texture atlas?  Or are there times when I should have multiple smaller texture atlases?

sentences:
No performance gain from instanced rendering? I recently worked through this tutorial about instanced rendering. At the end it promises to draw a huge amount of instances of one model without performance drops.
So I tried some simple instanced rendering to see these effects. So I created a VBO containing four times xyz-coordiantes, vertex color and texcoords.

float[] backgroundData = new float[] {
            -1.0f, -1.0f, 0.0f, 1f,1f,1f,1f, 0.0f, 0.0f, 0.0f,
            1.0f, -1.0f, 0.0f, 1f,1f,1f,1f, 1.0f, 0.0f, 0.0f,
            -1.0f, 1.0f, 0.0f, 1f,1f,1f,1f, 0.0f, 1.0f, 0.0f,
            1.0f, 1.0f, 0.0f, 1f,1f,1f,1f, 1.0f, 1.0f, 0.0f
    };

I also created a VAO and EBO containing the glVertexAttribPointers and indices int[] indices = new int[]{0,1,2,1,2,3};.

Now I draw everything with glDrawElementsInstanced(GL_TRIANGLES, 6, GL_UNSIGNED_INT, 0, 10_000). But the Framerate drops as much as if I had the indices 10.000 times in my EBO. Why is the outcome so different? Did I do something wrong?

sentences:
OpenGL dynamic font glyph cache library I have begun work on an OpenGL application (all on my own and with little knowledge) and started with FTGL, rendering true type fonts, which, with alot of text has a great impact on frames per second.

I believe that to overcome this limitation one needs to generate a font atlas and save glyphs to opengl textures which are then drawn by shaders.

I have done a search of github for such a library and found several, a few of which are incomplete (and by their own admission have memory leaks)

I am looking for, and hoping that one of you can recommend, the most stable opengl font library that you preffer and does the aforementioned. I also need unicode support.

Or a guide to help a noob like me achieve this

Thankyou for reading

sentences:
Collision 100% avoidance implementation I'm an absolute beginner with game development and all I know about collision avoidance/resolution, I learnt it on or through this site in the past week... so don't hesitate to correct me if what I'm asking here is based on wrong assumptions / misunderstanding. I tried of my best to be clear, but that said, the subject is still novel to me.

Vehicles

In my game, I have vehicles that move autonomously. They are placed in a 3D space, and their motion is governed by a number of variables which are different for each vehicles. The one of interest here are primarily:

Only forward motion.
A speed that can vary between min & max, but whose min is not (even close to) zero.
A steering radius that is dependent from the speed (the higher speed, the larger radius)
Two maximum accelerations (for decreasing and increasing speed)

Goal

My goal is to implement some sort of AI that will a 100% accurate collision avoidance (i.e. I will be sure that the vehicles will never ever collide).

Design

Although I would prefer more the idea of having the AI "onboard" (i.e. each vehicle having it's own "collision avoidance AI", eventually querying and/or sending messages to other vehicles) it is also possible for me to implement the CA AI at a central level (dispatching commands to the vehicles).
In most of the cases, the vehicle will simply have to steer clear of each other in any direction, but under certain circumstances, they will have to avoid collision and going towards the same target

What I found so far and where I got stuck

Within the many many links I found in other questions on this very site, I found of particular use these ones:

Collision between pool balls
Unalligned collision avoidance
Queuing

While these three links "opened my eyes" in many ways, it is not immediately clear to me how to use that information in my case. In particular article #2 only "tries" to prevent collision (but collisions do happens time to time). While article #3 needs to stop vehicles sometimes to prevent collisions.

What I also noticed, is that the collision avoidance algorithms linked above use a "instant projection" of linear speed to check if something is on the way of the vehicle. I was wondering if this is enough in my case or if I had to project my position in a more realistic way (e.g.: If I am 60° into a steering 90° to the right, I should calculate my position for the rest of the 30° of the curve, and then assuming linear motion).

Finally, I am particularly afraid of deadlocks. In other words: although the density of vehicles in the world will be fairly low, I am worried that given a certain numbers of vehicles converging towards the same point, once they will realise they are on a collision course, any evasive manoeuvres will be impossible as it would bring the vehicle on a collision path with some other ones.

Question

How can I reach my "goal"? An in depth-explanation is of course very much appreciated, but links to external resources would also be of great help (I'm sure I'm not the first with this problem, but probably I used the wrong keywords to search the web?)

Thank you in advance for your help!

sentences:
Rotating UVs by X degrees I would like to make a tileable texture with UV noise in Unity Shader Graph only, but I have a problem.
After creating simple noise from UV, I want to rotate it by 90 degrees, but the node Rotate (as well as Rotate About Axis) doesn't rotate my UV (like a picture in PS), instead it changes the colors in it from black & white to red (yellow, green, ...) & black.
Could you tell me please, how to fix it?

Some context :
Based on the answer https://gamedev.stackexchange.com/a/23631 , I want to rotate the noise three times (so 0° + 90° + 180° + 270°), multiply them and thus normalize the edges to make the texture tileable.
Instead of it, even at 0° rotation the color of noise is changed to yellow somehow and the multiplication is everything but not the result I want.
That's how I wanted to do it:

sentences:
Terminology for the way Transformation Matrix Data is treated I recently asked a question at math stack exchange and realize a similar questions is more suited for this forum, but the original is here:

https://math.stackexchange.com/questions/1526601/terminology-for-transformation-matrices-update-or-rigid-body-transform

I'm attempting to describe transformation matrix operations within Sketchup's Ruby scripts, and I need some terminology.

Sketchup allows the selection of a group of "loose" drawing objects (i.e. edges and faces), and provides options to create a grouped object from them. The drawing elements inside the group have position data relative to the group's local coordinate system. The grouped objects respond to a getter "transformation" method that returns a transformation object that contains data representing the orientation, scale, and position of the group.

Sketchup's "world space" supports multiple grouped objects, and typically there are numerous grouped entities in the outer level entities, as well as loose drawing objects. Each grouped object has a separate transformation that determines their position, orientation, and scaling in world space.

The transformation can be altered or replaced with methods that include:

a) The "transform" method: Applies a transformation (i.e. like a rotation) to rotate the group; and

b) The "transformation=" setter method: Replaces the existing transformation with the supplied argument.

Lets say I have a grouped object called "entity1" and rotation transformation object called "rotation". To provide the same rotation effect I could perform either of the following in Sketchup's Ruby programming:

entity1.transform!( rotation )
    OR
entity1.transformation= rotation * entity1.transformation

Only groups and components support the "transformation=" setter method, while fundamental Point3d & Vector3d object provide "transform!" kind of methods. It is obvious, at least from within Sketchup (which uses OpenGL internally), that transformation matrix internal data can be treated as either:

Relative: A transformation performs an incremental operation
(Example "entity1.transform! identity" does not have an affect on the grouped model); or

Absolute: The data inside a transformation is treated as absolute position, orientation, and scaling of the grouped object.
(Example "entity1.transformation= IDENTITY" sets the model to Sketchup's origin position, the model is de-rotated to the orientation it was when first grouped, and it is descaled)

Questions:

1) What is the terminology for the type of transformation that is supplied to the "transform!" method?
I was calling it an "affine", now want to call it an "update transformation".

2) What is the terminology for the type of transformation that is the argument to the setter "transformation="?
I have been calling it a "rigid body transformation", and sometimes "absolute transform". It appears that OpenGL is calling this the "model matrix".

3) If I call it "model matrix", is more than one model matrix transform allowed in world space?

A previous english stack exchange article for a word to mean "position and orientation" is at:
https://english.stackexchange.com/questions/119883/word-for-position-and-orientation
The article responses recommend to use "pose matrix".

sentences:
OpenGL get the outline of multiple overlapping objects I just had an idea for my on-going-game made with opengl in c++: I'd like to have a big outline (5-6 pixel) on multiple overlapping object when the player win something.

I thought the best way is to use stencil buffer but it's few hours that I' trying to do some off-screen render of the stencil buffer and I can't achieve any kind of result so probab. there are some other techniques!

This is what I want to get:

Any ideas?

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:
Unreal Engine 4: Help with multithreading and accessing render target images I am working on an application where I need to record images seen from an in-game camera. Initially, the method was to set up a TextureRenderTargetResource from the in-game capture component, and subsequently call ReadPixels to access the frame data and save that data as an image. (code flow below)

bool saveImage() {
  USceneCaptureComponent2D* capture = getCaptureComponent(camera_type, true);
  FTextureRenderTargetResource* RenderResource = capture->TextureTarget->GameThread_GetRenderTargetResource();
  width = capture->TextureTarget->GetSurfaceWidth();
  height = capture->TextureTarget->GetSurfaceHeight();

  TArray<FColor> imageColor;
  imageColor.AddUninitialized(width * height);
  RenderResource->ReadPixels(bmp);
}

This approach was slowing the game thread down significantly, so I am trying to move the screenshot saving procedure to its own thread. My approach now is inspired by the article at https://wiki.unrealengine.com/Multi-Threading:_How_to_Create_Threads_in_UE4. I access the *AActor object from this separate thread and subsequently its camera, and then I call the saveImage() function from the thread: but this is resulting in a crash with no additional information (just "UE4Editor.exe has triggered an exception") at the call to ReadPixels(). So essentially, calling saveImage() and thereby ReadPixels() from the game thread works perfectly, and it fails when I call it from a different thread. Am I doing something wrong in my process here?

sentences:
How to achieve uniform speed of movement on a bezier curve? I'm trying to move an image along Bezier curve. This is how I do it:

- (void)startFly
{
 [self runAction:[CCSequence actions:
             [CCBezierBy actionWithDuration:timeFlying bezier:[self getPathWithDirection:currentDirection]],
             [CCCallFuncN actionWithTarget:self selector:@selector(endFly)],
             nil]];

}

My issue is that the image moves not uniformly. In the beginning it's moving slowly and then it accelerates gradually and at the end it's moving really fast. What should I do to get rid of this acceleration?

sentences: Possible to yield a coroutine when it is taking too long to run? Suppose I have a function that raycasts from (0,0,0) to every object in the scene.  Sometimes the scene contains just a couple objects and sometimes it contains several hundred.  Is it possible to setup the raycasting function in a way that  ensures a good framerate? For example, within the "for" loop that shoots the rays could I somehow evaluate how much time has passed since the loop started and "yield return null" if the time in seconds is greater than the target time of each frame?

sentences:
What version of Marching Cubes bring "ambiguities" I am reading Eric Lengel’s paper about the Transvoxel algorithm.

In an early part describing the classical Marching Cubes (3.1.1), he talks about ambiguous cases. From what I understand, these can result from grouping the cases into “equivalence classes”.

However, in the Marching Cubes paper I read (is this the one he is referring to ?), there does not seem to be any grouping done, and each of the 256 cases produces its own triangulation. For example, taking the case of Lengyel’s figure 3.2 (on page 12 of the first document), the left cube has index 189 (vertices 0 2 3 4 5 7) and the right cube index 24 (vertices 3 and 4), which gives non “equivalent” triangulations: 4 triangles for the left cube, and 2 for the right cube.

To phrase this as a question: are there different versions of Marching Cubes, and could Lengyel be referring to a different one than Paul Bourke's ?

sentences:
Collision with 2 of the same objects I'm looking to make a button that is activated by two of the same objects, but the code I'm using doesn't recognize the second object as a different instance. Not the best explanation but here's the code:

if place_meeting(x,y,obj_cube) && place_meeting(x,y,obj_cube)

So the game sees this as just one obj_cube and the button is pressed even if there is only one cube on the button. I've tried using variables but I might be doing it wrong.

sentences:
GLSL Atomics With Floats I am implementing SDSM and in a GLSL compute shader I need to min/max vec3 values to compute the shadow map bounds. The sample implementation (in HLSL) uses vectors in "light space" that spans from 0-1 and then casts them with touint (in GLSL uintBitsToFloat) so that it can call InterlockedMinMax (atomicMin/Max) with them.

I was wondering if it is a better idea to quantize the values to an uint using the bounding volume in light space as uints instead of moving them into the 0-1 range so integer min/max works on the float bit pattern?

On the one hand using float bits in unit throws about about 2/3 the precision, because the sign bit and exponent are ignored. On the other hand almost all algorithms I came up to quantize the values somehow go past the 0-1 float range and would probably loose the precision anyway.

sentences:
How to move player on unity3D? I checked the input settings. I added a speed value. I also added Time.deltaTime, but the body is not moving.

using UnityEngine;
using System.Collections;

public class PlayerController : MonoBehaviour {

    public float speed;
    private Rigidbody rb;

    void Start () {
        rb = GetComponent<Rigidbody>();
    }

    void FixedUpdate () {
        float moveHorizontal = Input.GetAxis("Horizontal");
        float moveVertical = Input.GetAxis("Vertical");
        Vector3 movement = new Vector3(moveHorizontal, 0.0f, moveVertical);
        rb.AddForce(movement * speed);
    }
}

sentences:
xna: Methods for having sprite characters in 3d game? Methods for having sprite characters in 3d game?
I am making a game much like Doom. The world is 3d but objects and characters are 2d sprites. I am not asking about billboarding objects. I am asking about methods for having sprite characters that aren't always facing the player and have different frames depending on which way the character is facing. For example when an enemy is walking towards the player it is a 2d texture of a front and when walking away it is a 2d texture of a back.

One way I thought I read about was to draw a cube primitive that is "invisible". This 3d cube allows you to track the orientation of the character. Then you apply a sprite frame to each side of the cube but the 2d texture is only drawn on the side the player is looking at.

The other way I suspected I could do this is to make a 3d plane in a modeling program and import it to XNA. Then use the billboarding method to make sure the plane is always facing the player (you don't see the edge). Apply a the appropriate 2d texture (sprite frame) to the plane based on the direction the character is facing.

I know this is not how Doom did it but please tell me what you think of my ideas or a method on how this can be done.

Thank you.

sentences:
How to manage screen and input when using libSDL2 for both desktop and Android? I have worked on libSDL1.2. Since, the release of 2.0, SDL also supports android. So, I am trying to develop game that can work both on desktop and android. But there are few things that are confusing me.

When we are creating a window, we pass the width and height of screen. But on android game covers whole screen and different devices have different resolutions. So how can we create a screen which appears uniform on both desktop and android.
How to handle inputs like back button.
Also, how to load graphics based on DPI.

sentences:
camera relative movement with GL.Translate I'm using the OpenTK library, an OpenGL library, for C#. I'm trying to do camera-relative movement and though I'd use GL.Translate for moving and glRotate for rotation. I've not declared any vectors and every tutorial uses those, how do I do that?
Do I need to limit the user's resolution and just use if statements to check it and move, or something else?
I don't want to declare and use variables like yaw, pitch etc, I just want to directly calculate rotation and apply to movement.
I'm using an old version of OpenGL since my game should be able to run on old GPUs.

sentences:
Problem drawing text in a for loop for (int i = -5; i < 5; i++)
{
    Rectangle screenRectangle = new Rectangle(0, 0, screenWidth, screenHeight);
    spriteBatch.Draw(foregroundTexture, screenRectangle, Color.White);

    Rectangle backGroundRectangle = new Rectangle(x + screenWidth * i, 0, screenWidth, screenHeight);
    spriteBatch.Draw(backgroundTexture, backGroundRectangle, Color.White);

    spriteBatch.DrawString(font, "Variable i:  " + i, new Vector2(0, 0), Color.Brown);
}

I want to show on the screen when I'm running the game the counting of i
like: -5 , -4 , -3...but not in a line, just like a timer. -5 then overwrite it and show -4 overwrite it and show -3 and so on...like seconds of a clock.

The problem is I'm getting a strange painting near the numbers like its repeating and painting something there all the time.

sentences:
Unity 5.6.0f3 Inspector Tooltips are off in macOS, is me or everyone the same? Running latest version (5.6.0f3) in macOS, my tooltips are always misalign to the left of my screen, is me or anyone else also experience the same? And, it is still misalign even after I reset the layout setting to factory default.

Here are the screenshots http://imgur.com/a/dR0Pv

Update: Filed a bug report.

sentences:
Should I make the Cells in a Tiledmap as null when my player hits it I am making a Tile Based game using Libgdx. I took the idea from SuperKoalio platformer demo by Mario Zencher. When I wanted to implement Collectables in my game , I simply draw the coins using Tiled Map Editor. When my player hits that, I use to set that cell as null.

Someday on this site suggested me not to do so... never use null. I agreed. What can be any other way. If I am using layer.setCell(x,y) to set the cell to any other cell... even if an transparent one .. my player seems to be stopped by an invisible object/hurdle.

This is my code:

for (Rectangle tile : tiles)
                {
                    if (koalaRect.overlaps(tile))
                    {
                        TiledMapTileLayer layer = (TiledMapTileLayer) map.getLayers().get(1);
                        try{
                            type = layer.getCell((int) tile.x, (int) tile.y).getTile().getProperties().get("tileType").toString();
                            }
                            catch(Exception e){
                                System.out.print("Exception in Tiles Property"+e);
                                type="nonbreakable";
                            }

                        //Let us destroy this cell
                        if(("award".equals(type))){
                        layer.setCell((int) tile.x, (int) tile.y, null);
                        listener.coin();
                        score+=100;
                        test = ""+layer.getCell(0, 0).getTile().getProperties().get("tileType");
                        }

                        //DOING THIS GIVES A BAD EFFECT
                        if(("killer".equals(type))){
                            //player.health--;
                            //layer.setCell((int) tile.x, (int) tile.y, layer.getCell(20,0));
                        }

                        // we actually reset the player y-position here
                        // so it is just below/above the tile we collided with
                        // this removes bouncing :)
                        if (player.velocity.y > 0)
                        {
                            player.position.y = (tile.y - Player.height);

                        }

Is this a right approach? OR
I should create separate Sprite Class called Coin.

sentences:
Character states in component based entity system I'm working on a Zelda-like game (github), and I made a component-based entity system.

I've a Scene class which holds a std::vector of SceneObject.
SceneObject is a collection of components
Scene uses systems, like MovementSystem, DrawingSystem, CollisionSystem to perform actions using components, or directly on components themselves. For example, this isMovementSystem:

#include "CollisionComponent.hpp"
#include "MovementComponent.hpp"
#include "MovementSystem.hpp"
#include "PositionComponent.hpp"

void MovementSystem::process(SceneObject &object) {
    if(object.has<PositionComponent>() && object.has<MovementComponent>()) {
        auto &positionComponent = object.get<PositionComponent>();
        auto &movementComponent = object.get<MovementComponent>();

        movementComponent.movement->process(object);

        movementComponent.isBlocked = false;

        if(object.has<CollisionComponent>()) {
            object.get<CollisionComponent>().checkCollisions(object);
        }

        movementComponent.isMoving = (movementComponent.vx || movementComponent.vy) ? true : false;

        positionComponent.move(movementComponent.vx * movementComponent.speed,
                               movementComponent.vy * movementComponent.speed);

        movementComponent.vx = 0;
        movementComponent.vy = 0;
    }
}

My problem is that I don't know how to handle states for characters.

For example, let's say Link has three states: Standing, Moving and Pushing.

In each state, a different animation is played, so DrawingSystem have to know about this, but I can't put it in a StateComponent because all the objects which need a state don't always need an information on animation.

In each state, I must check for conditions to change the current state and process an action. For example, if Link's current state is Standing, I must check if he's moving or not, to change his state to Moving.

Which components/system do I need to implement this?

sentences: Why BlackBoardValue Says Invalid And False? UnrealEngine4 Think my ai do not move towards the sound because of the blackboard keys , one says invalid and another says false , i think that is the reason.... Enemy Ai should move to the location where sound is heared , here is the photo of BehaviourTree. Look at those 2 keys named "InvestigatePosistion" and "HasHearNoise" its says False and Invalid. so how make them work?

sentences:
What technique should I use to create models and animation sequences in OpenGL code? I'm getting into game development using OpenGL (and the LWJGL library) and I want to create models for characters, NPC's etc. in the code, as well as animation sequences (for example the way the models are done in Minecraft).

What is the process to go about doing something like this? Is there a particular feature set that is used or common methods of doing this? I'm basically looking for pointers as to what to search for when trying to find examples of how this is done.

sentences:
improving speed of 2d ball collision I am making a game which has many balls bouncing around the screen (around 200-300 balls in a small area). One thing I am trying to do is improve the performance of the collision detection and resolution.

What I've tried to do so far is to maintain a large number of ArrayLists. I split the screen up into a grid and for each cell I keep an ArrayList containing each ball that is currently inside that particular grid square. Whenever I update the positions of the balls, I also update which list they belong to.

When checking for collisions, I have a separate ArrayList which contains all the balls. I iterate through this list, and for each ball:

find out what grid square it is in
check for collisions with all the balls in adjacent grid squares

I've tested this approach and it doesn't seem any different to just iterating over a list of all the bubbles twice.

Does anyone have some suggestions on how I can improve things? For instance, with my current algorithm I am handling collisions twice but I'm unsure how I can work around it.

sentences:
What units does Sprite Kit use for physics? I'm developing a simple ball game in Sprite Kit. I need to predict the ball's trajectory, so I went back to my physics book for the equations for acceleration, time, speed and space.

The problem is that Sprite Kit documentation does not declare the units of measurement of the properties of physics bodies, so it's hard to calculate the needed values.

Based on my experiments/research I suppose that:

gravity is expressed in m/s/s  (m/s^2)
since gravity is a CGVector, all CGVectors are expressed in m/s/s (m/s^2)
velocity (instant speed) is m/s

Then I realized a simple scene where a ball is falling:

Gravity: CGVector(0,1.2);
Height: 218.009499 pixels
Time: 0.302499747
Then acceleration should be:   2*Height / Time^2 = 1441.3863 pixels/s/s
And gravity of 1.2m/s/s corresponds to 1441.3863 in a world measured in pixels

Someone says the internal PTM (pixel to meter ratio) is 150.

Any hints?

sentences:
What are examples of games with "minimalist" models/art assets When teaching game development, my student's obsess about building realistic or complex art/models/animation. And spending wayyy to much time trying to get accurate collision detection between two 3D models [despite my best efforts]

However I would like them to spend more time thinking about developing the game mechanics, interaction and game play.

I'm looking for some games where the visuals are simple but have good game play.

Things I am thinking about are Cubes' vs Spheres or Impossible Game.

What are more examples of visually simple (preferably 3D) games to help inspire my students?

sentences:
How to implement 3d maneuver gear physics in unity? I am trying to create a attack on titan styled game for a school project. I am not new to programming, but I am new to game development. I couldn't find any resources for this, hence I am posting it here.

How do I go about implementing 3d maneuver gear physics from attack on titan anime?

What is it?

In case you don't know, here's a brief link about 3d maneuver gear.

A brief commentary about 3dMG

It's basically a grappling hook based system (similar to what you would find in a spiderman game), but it has different components to it, which makes it quite complex to think about.

My Approach so far

I have seen tutorials on how to use hooks in unity and stuff, but it would be great if someone could give me a general idea as to how to even start with this kind of thing. I would appreciate your answer, even though it is not unity specific.

The idea is to have two points on the character, from where we fire the ropes. These ropes could simply be graphics (or unity's RaycastHit). And then we would also need information about the hook "hit point". Once we know that, we just reel in ourselves towards that. However the problem is that I don't know how to use momentum etc to effect the character's movement. Also since it's not just one rope(like a spiderman's game), but two, it's even difficult to think as to how would the movement be if user uses only left hook, or right hook or both. Also there is this gas aspect, which would propel you further and it should also be taken into account, along with momentum that we would carry.

So any general idea would be greatly appreciated.

sentences:
How to keep balance / Unlock items / achievement rules I'm working on an engine for a game, too learn javascript and just because its fun. I'm a flashdeveloper, I know how to build websites. Now making games is a different challenge, javascript is a challenge, but I'd love to learn how to structure code and what patterns are common. I dont mind if the game ever finish, I'm mostly interested in the programming part of it. I dont have a particular endresult in mind, so I'll see where it takes me.

I currently have a system where you can buy items. The items cost a specified amount of gold, silver, diamonds etc. When you have selected and bought the item, it takes time before getting rewarded. When time is over, you are getting rewarded with other properties (gold, energy, diamonds).
For example, you can buy an apple for 50gold, It takes a minute, you get rewarded with 75energy. Or if you take a run, it cost 50energy, it takes 5minutes, reward is 25gold and 25silver. These definitions is what i call actions. Currently I already have a system where this already works and I can define as much actions with as much properties as I want.

The definitions I have kinda looks like this:

{id:101, category:544, onInit:{gold:-75}, onComplete:{energy:75}, time:2000, name:"Apple", locked: false}
{id:102, category:544, onInit:{gold:-135}, onComplete:{energy:145}, time:2000, name:"Banana", locked: false}
{id:106, category:302, onInit:{energy:-50, power: -25}, onComplete:{gold:100, diamonds:2}, time:10000, name:"Run", locked: false}
{id:107, category:302, onInit:{energy:-70, silver: -55}, onComplete:{gold:100}, time:10000, name:"Dance", locked: false}
{id:108, category:302, onInit:{energy:-230, power: -355}, onComplete:{gold:70, silver:70}, time:10000, name:"Fitness", locked: false}

Now, I would love to add a system where I can lock/unlock the actions using achievement rules. Lets say, if you buy 10 apples, you unlock a new action, like bananas which cost more, and reward more. In the future I maybe want to restrict achievements and actions to levels. I am kinda stuck how to structure this.

I have 2 questions:

Which patterns are used to define achievements? How/where are they defined? Should it be part of the action, or should it be a separate controller? Is it a good idea to register all completed actions to it? I think I want multiple types of achievement rules, Id love to hear some ideas how to develop it.
How do you create/find a good balance, so the user does not get stuck or can cheat by repeat a pattern of actions to get too much rewards. I know there is not a simple answer and i'm lacking of a good game-concept, but I wonder if anyone created such a game and how you dealed and played with it.

sentences:
Anti-Aliasing in Java In my game I want to have the different anti-aliasing option like: none, x2, x4, x8 and x16. I know that you can use anti-aliasing with Graphics2D in the way below bu is there any way that I can use the different levels of anti-aliasing (x2, x4, x8 and x16)?.

RenderingHints rh = new RenderingHints(RenderingHints.KEY_RENDERING,
RenderingHints.VALUE_RENDER_QUALITY);
rh.put(RenderingHints.KEY_ANTIALIASING, RenderingHints.VALUE_ANTIALIAS_ON);
g2d.setRenderingHints(rh);

sentences:
Shoot projectile same direction weapon faces I want to be able to shoot a projectile from a weapon mounted on a vehicle. Right now I am able to do it but only in front of the vehicle. I managed to rotate the weapon to the direction the mouse is facing, but the projectile still goes straight.

I believe that the issue is that the velocity of the projectile is the problem here. Right now I have it like this:

if (playerShooting || NPCShooting)
{
    if ((timer >= cooldown) && hasEnergyAvailable())
    {
        timer = 0;
        GameObject intantiatedProjectileContainer = Instantiate(projectileContainer, transform.position, transform.rotation) as GameObject;
        Rigidbody instantiatedProjectile = intantiatedProjectileContainer.GetComponentInChildren<Rigidbody>();

        if (playerController)
        {
            instantiatedProjectile.velocity = transform.TransformDirection(new Vector3(0, 0, speed + transform.root.GetComponent<PlayerController>().getZSpeed()));
        }
    }
}

Where speed is the projectile speed and it's added to the vehicle speed.

I thought that this should shoot forward but with the parent rotation, can someone tell me what I'm missing here?
Thanks!

sentences:
How to switch screens when a button is pressed? LibGDX Currently working on a game for school and I ran into a problem. I created a Main Menu for my game with the buttons (Play, Level Picker, and Settings). What I'm trying to do is when the "Play" is pressed it will switch to a different screen where the user will play. The menu is under the name of MainMenu and the screen I want it to switch to is called StartGameScreen. I've tried looking online for my answer but can't seem to find something that will work. If it helps here's my code for the play button. Any help would be fantastic!

TextButton playButton = new TextButton("Play", (com.badlogic.gdx.scenes.scene2d.ui.Skin) skin); // Use the initialized skin
playButton.setPosition(Gdx.graphics.getWidth() / 2 - Gdx.graphics.getWidth() / 8, Gdx.graphics.getHeight() / 2 + (playButton.getHeight() + buttonOffSet));
playButton.addListener(new ClickListener() {

    @Override
    public void clicked(InputEvent event, float x, float y) {
        System.out.println("play game button clicked");
    }
});
stage.addActor(playButton);

sentences:
Timer.schedule(task, 0, 100) never fires I added some code using java.util.Timer to execute my spawnMonster function every 100ms. It worked, until I tried instantiating images in it -- since it doesn't run on the libGDX core thread, there's no OpenGL context, so it can't do stuff with images.

I figured using the libGDX Timer class, which the javadocs say runs on the core thread, would solve this problem; but unfortunately, the timer code just doesn't execute.

I tried:

- new Timer().scheduleTask(task, 0, 100)
- new Timer().scheduleTask(task, 0, 100, 99999)
- Timer.schedule(task, 0, 100)
- Timer.schedule(task, 0, 999999)
- Timer.start()
- t = new Timer(); t.scheduleTask(...); t.start();

task appears to execute once, and only once; it never executes again. (It prints a date-time diff from a target time, so I can tell it's not running.)

sentences:
Implicit Functions and extracting an isosurface I recently discovered a paper on Dual Marching Cubes which produces a much reduced poly count to other methods like Dual Contouring and Marching Cubes, however a recurring theme when reading these papers is that they make reference to implicit functions.

I've been wanting to implement a form of this for procedural terrain created using a noise function (like Simplex Noise) but I don't understand how if I were to use a data structure like an Octree, or even a uniform grid, I could then use the algorithm since it wants an Implicit Function.

I think I'm going about this all wrong and not understanding something correctly, can anyone explain how it would be possible, or even if it is at all, to represent procedural terrain with an implicit function?

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:
Binding the camera to the body of the skeleton It is necessary to design: "Only the body of the skeleton rotates with the camera"

Problem above

I'm not advanced. My hunch: Programming CapsuleComponent.h - inherit skeleton components. I could be wrong. Please help me find the right solution to the problem!

sentences:
Unity3d: calling a web service in unity editor works, but not in standalone. Why? I have this line of code:

   SDE3D _webService = new SDE3D();
   int result = _webService.UserLogin(txtLoginUsername.text, hashString);

My UserLogin function looks like this:

[System.Web.Services.Protocols.SoapDocumentMethodAttribute("http://www.something.com/UserLogin", RequestNamespace="http://www.something.com/", ResponseNamespace="http://www.something.com/", Use=System.Web.Services.Description.SoapBindingUse.Literal, ParameterStyle=System.Web.Services.Protocols.SoapParameterStyle.Wrapped)]
public int UserLogin(string username, string password) {
    object[] results = this.Invoke("UserLogin", new object[] {
                username,
                password});
    return ((int)(results[0]));
}

In the Unity Editor it works well.

At runtime, in my Unity game build, it doesn't work and doesn't return any error message!

What is the issue?

Thanks

sentences:
What are some ways to prevent or reduce cheating in online multiplayer games? Punkbuster exists just to prevent cheating, and yet cheating is common in punkbuster enabled games. Modern Warefare 2 is seriously locked down from the end user running their own server or making any mods, and cheating happens constantly.

For a multiplayer game where each client is running on a PC, what can be done to reduce or eliminate cheating?

sentences:
Can instantiated objects have different material/texture? While I have some experience with simple 2D games, I am new to more process-demanding 3D games. One basic question that has been concerning me recently and for which I am having difficulties to find a proper detailed answer, is the following.

I understand that when we instantiate an object, we are saving memory because the instantiated copy does not have to save mesh memory (like vertices' position, UV cood and normals). So, the instantiated copy only needs to save a transformation matrix in order to properly position, scale and rotate the mesh structure they share with the original mesh.

But can the instantiated copies have different texture or material from the original mesh from which they were instantiated? If so, then it means the instantiated objects actually save with themselves more than transformation matrices. I would love to read more on that, so suggestions are welcome.

sentences:
Arc length between two angles As I calculate the length of the arc (green) between two angles;

I need a method like:

arc_lenght (xpos, ypos, radius, ang1, ang2) {
return arc_lenght
}

sentences:
How to create 2D cameras in swing? What is the best way to create a camera for a 2D platformer using swing, and I want to create a camera that moves instead of moving the background. This is because I'm going to have objects rotated by a transformer and need the camera to stay on the object whilst also allowing zooming and rotation.
Any help would be appreciated.

sentences:
Why does my 3d model become invisible as I move the camera away? I'm trying to load a 3d model from Mixamo:

//        let scene = SCNScene(named: "art.scnassets/ship.scn")!
        let scene = SCNScene(named: "art.scnassets/Ch45_nonPBR.dae")!

    // create and add a camera to the scene
    let cameraNode = SCNNode()
    cameraNode.camera = SCNCamera()
    scene.rootNode.addChildNode(cameraNode)
    scene.fogStartDistance = 10000
    // place the camera
    cameraNode.position = SCNVector3(x: 0, y: 40, z: 100)

    // create and add a light to the scene
    let lightNode = SCNNode()
    lightNode.light = SCNLight()
    lightNode.light!.type = .omni
    lightNode.position = SCNVector3(x: 0, y: 50, z: 10)
    scene.rootNode.addChildNode(lightNode)
    lightNode.light?.intensity = 10000;

    // create and add an ambient light to the scene
    let ambientLightNode = SCNNode()
    ambientLightNode.light = SCNLight()
    ambientLightNode.light!.type = .ambient
    ambientLightNode.light!.color = UIColor.white
    scene.rootNode.addChildNode(ambientLightNode)

    // retrieve the ship node

//        let ship = scene.rootNode.childNode(withName: "ship", recursively: true)!
        let ship = scene.rootNode

While the z value for the cameraNode position is 100 or less, I can see the 3d model. But if I increase the value, then the model is no longer visible. Even at 100, parts of the model are not visible.

Is this a problem with lighting or rendering distance ? I would like to move the camera far away so that I can see the whole model on screen. Right now I can only see a part of it.  What do I need to change so I can see the whole model clearly like this:

EDIT: I am using Swift 5

sentences:
How to make hard to hack leaderboards Okay, someone tasked me to make a leaderboard for their game. However, the one I have right now is really insecure. All it does is check if someone is in the top 100, and if they are, post the score to the server, where the server will completely trust the client to give a real score.

My question is: How would I make it harder, or better, impossible, to send a fake high score, because right now they can just post a value to an easy-to-find endpoint.

Clarifications: The game is running in an interpreted environment, therefore obfuscation is not practical, and the game has a lot of input (an hour's worth at least), so sending that to the server is also impractical.

sentences:
Make a light only affect one object I'm wondering if it's possible to make a light source only affect one object? I know that it's possible to use layers and culling mask, but then I would need one layer for every single object which is not possible.

Is there a way for example that I could make only children or siblings be affected by a light source? Or other solution?

Have a nice day!

Update #1:

sentences:
Does TCP slow down server and other clients for MMO game hi guys i made a server and client for mmorpg game of course very amateurish. i am using UDP to send coordinates if the packet is lost doesnt matter i am already sending 10 times in a second. UDP doesn't slow down server and server doesn't slow down other clients. But i also want to use TCP for ID PW and attack skill because when i use attack skill he needs to go absolutely to server. If i use TCP for them, Will client1 slow down Server ? or Will Server slow down other clients ?

i am using c++,opengl,SDL 1.2 and SDL_net 1.2

I will be grateful for your help :)

EDIT I ADD VIDEO :D : youtu.be/J7Ulh4vUBu0 when only udp server loop 658982 in a second like at the end of the video if i add tcp this valuse slow down ?

sentences:
How to programmatically change sprite sheet sub-sprite name I am trying to change the name of the sub-sprites of a sprite sheet. I have searched and tried everything I can think of and cannot get it to work, which makes me think it can't be done at this point in time.

Let's say I have a sprite sheet that has already been split up into individual sprites inside of Unity.

I am attempting to change the sub-sprite names programmatically.

I tried using

AssetDatabase.RenameAsset (...)

on the sprite sheet asset, which only changes the sprite sheet name and not sub-sprites.

I then thought to obtain a sub-sprite and attempt to change its name using the below code.

            if (AssetDatabase.IsSubAsset (subSprite))
            {
                AssetDatabase.RenameAsset (AssetDatabase.GetAssetPath (subSprite), "newSprite" + i.ToString ());
            }

However, this too only changes the sprite sheet name.

I'm not sure where else I can take this to achieve my desired outcome, apart from programmatically copying the original sprite sheet and using that to create a copy. But even then, I still am unable to alter the sub-sprite names.

I also tried changing subSprite.name, but this just changes the internal name and not the asset name.

Any ideas?

sentences:
vector subscript out of range I'm trying to setup a 2d game and have been thrown up an error on vector subscript out of range. I've been trying to look up about it, but have not seen anything that helps. If someone could help and take the time to look at my code and help me fix my error i'd be very grateful. I think it's got something to do with something about that it can't handle more then 0-9 or something but my knowledge/understanding of it is not great and would appreciate the help. I'll paste my code below so you can see what i'm trying to do.

//tile setup
level.loadTexture("gfx/Maptiles.png");
Tile tile;
vector<Tile> tiles;
for (int i = 0; i < 10; i++)
{
    tile.setSize(sf::Vector2f(32, 32));
    tile.setAlive(true);
    tiles.push_back(tile);
}

//sky tile set to false so we don't collide
tiles[0].setAlive(false);
//    X   Y   W   H  of the sprite sheet
/*tiles[0].setTextureRect(sf::IntRect(187, 51, 70, 70));
tiles[1].setTextureRect(sf::IntRect(0, 0, 70, 70));*/
tiles[0].setTextureRect(sf::IntRect(864, 221, 70, 70));
tiles[1].setTextureRect(sf::IntRect(73, 2, 70, 70));
tiles[2].setTextureRect(sf::IntRect(140, 2, 70, 70));
tiles[3].setTextureRect(sf::IntRect(210, 2, 70, 70));
tiles[4].setTextureRect(sf::IntRect(280, 2, 70, 70));
tiles[5].setTextureRect(sf::IntRect(350, 2, 70, 70));
tiles[6].setTextureRect(sf::IntRect(420, 2, 70, 70));
tiles[7].setTextureRect(sf::IntRect(506, 577, 70, 70)); //ground block
tiles[8].setTextureRect(sf::IntRect(560, 2, 70, 70));
tiles[9].setTextureRect(sf::IntRect(630, 2, 70, 70));
//tiles[].setTextureRect(sf::IntRect(630, 0, 70, 70));
//tiles[11].setTextureRect(sf::IntRect(770, 34, 70, 70));
//tiles[12].setTextureRect(sf::IntRect(840, 51, 70, 70));
//tiles[13].setTextureRect(sf::IntRect(910, 0, 70, 70)); //^^ 1st row
/*tiles[14].setTextureRect(sf::IntRect(0, 0, 70, 70));
tiles[15].setTextureRect(sf::IntRect(70, 0, 70, 70));
tiles[16].setTextureRect(sf::IntRect(140, 0, 70, 70));
tiles[17].setTextureRect(sf::IntRect(17, 34, 70, 70));
tiles[18].setTextureRect(sf::IntRect(34, 34, 70, 70));*/
level.setTileSet(tiles);
// Map dimensions
    sf::Vector2u mapSize(25, 19);
// build map
std::vector<int> map = {
    0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 2, //25 X 19
    2, 2, 3, 4, 5, 6, 7, 8, 9, 1, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 2,
    2, 0, 2, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 2,
    2, 0, 0, 2, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 2,
    2, 0, 0, 0, 2, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 2,
    2, 0, 0, 0, 0, 2, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 2,
    2, 0, 0, 0, 0, 2, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 2,
    2, 0, 0, 0, 0, 2, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 2,
    2, 0, 0, 0, 0, 2, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 2,
    2, 0, 0, 0, 0, 2, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 2,
    2, 0, 0, 0, 0, 2, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 2,
    2, 0, 0, 0, 0, 2, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 2,
    2, 0, 0, 0, 0, 2, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 2,
    2, 0, 0, 0, 0, 2, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 2,
    2, 0, 0, 0, 0, 2, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 2,
    2, 0, 0, 0, 0, 2, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 2,
    2, 0, 0, 0, 0, 2, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 2,
    2, 0, 0, 0, 0, 2, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 2,
    7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7
};
//fix tile layout
level.setTileMap(map, mapSize);
level.setPosition(sf::Vector2f(0, 0));
level.buildLevel();

level.render(window);

sentences:
Tetris block kinematic rigidbodies pass through one another with Transform.Translate I am trying to build a Tetris 3D game in Unity but I am stuck at getting the different blocks to interact (to detect each other, to sit one on top of the other rather than going through each other). I have set the ground with a box collider and the spwaned blocks come in with rigidbodies and trigger colliders.
This works for them to nicely settle on the ground but when I try to sit a block on top of another block they both have kinematic rigidbodies and the collision detection doesn't work and they end up overlapping. The problem is if I remove the rigidbody of the already settled block then it will go through the ground.
Any idea how to get 2 spawned objects to detect each other?
using System.Collections;
using System.Collections.Generic;
using UnityEngine;
using UnityEngine.UIElements;

public class moveBlock : MonoBehaviour
{
    public static float speed = 2;
    public GameObject[] blocks;
    public static List<GameObject> blocksSpawned = new List<GameObject>();
    public static List<Rigidbody> blocksRBSpawned = new List<Rigidbody>();
    public static bool triggerPlatform = true;
    Rigidbody rb;

    void Update()
    {
        Vector3 input = new Vector3(Input.GetAxisRaw("Horizontal"), 0, Input.GetAxisRaw("Vertical"));
        Vector3 direction = input.normalized;
        Vector3 velocity = direction * speed;
        Vector3 moveAmount = velocity * Time.deltaTime;

        if (triggerPlatform)
        {
            blocksSpawned.Add((GameObject)Instantiate(blocks[Random.Range(0, 7)], new Vector3(0, 6, 0), Quaternion.Euler(Vector3.right)));
            rb = blocksSpawned[blocksSpawned.Count - 1].GetComponent<Rigidbody>();
            blocksRBSpawned.Add(rb);
            triggerPlatform = false;
        }
        /*if (!triggerPlatform)
        {
            Destroy(blocksRBSpawned[blocksRBSpawned.Count - 1]);
        }*/
        if (blocksSpawned[blocksSpawned.Count - 1] != null)
        {
            blocksSpawned[blocksSpawned.Count - 1].transform.Translate(Vector3.down * Time.deltaTime*speed, Space.World);
            blocksSpawned[blocksSpawned.Count - 1].transform.Translate(moveAmount);
        }
    }
}

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

public class trigger : MonoBehaviour
{
    private void OnTriggerEnter(Collider other)
    {
        moveBlock.triggerPlatform = true;
    }
}

sentences:
Top down off-screen indicator, Unity3D C# I'm working on a top-down 3D game where things spawn off camera. Movement only occurs on 2 axis (x and z). Rotation is about y axis.

The player is in the center of the camera and needs to have indicators at the edge of the screen to show where the item is relative to the players location.

I've managed to figure out the distance from my player to the target just using the distance between 2 Vector3 points.

However, I can't figure out how to translate this into a direction/angle for an indicator arrow that I have instantiated as a child of the canvas UI and make it point to the edge of the screen.

sentences:
Skyrim/Papyrus: Random Actor Patrol I saw this question and was hopeful to find the answer to my question, but no such luck:
How do I make someone walk in Skyrim?

I want to, using papyrus ONLY, make Actors that I spawn to travel/patrol to a PatrolIdleMarker, preferably one that I create in the Papyrus script and set the coordinates for.

Example:
I want a bandit to appear at a random location but specific distance from the Player. Then I want the bandit to start moving towards the player, attacking the player. The script below works just fine for this:

ScriptName SomeQuestName extends Quest

ActorBase property LvlBanditMelee1H auto

Int[] BanditStatus
Actor[] Bandits

Event OnInit()
        Int MaxBandits = 11
        Bandits = new Actor[11]
        BanditStatus = new Int[11]
        int i=0
        while(i

Event OnUpdate()
        Float SpawnDistance = 15000.0
        Float ClearDeadDistance = 10000.0
        Float ClearAllDistance = 20000.0
        Int SpawnCounter = 0
        Int MaxBandits = 10
        if (PlayerRef.Z < 20000 && PlayerRef.GetWorldSpace() == Tamriel && (MQ101DragonAttack.IsCompleted() || MQ101DragonAttack.GetStage() > 195))
            int i = 0
            int j = 0
            while(i
                        if(VerboseDebug==1)
                            Debug.Notification("Bandit #" + i + " has wrong BanditStatus.")
                        EndIf
                    Else
                        Distance = PlayerRef.GetDistance(Bandits[i])
                        if((Bandits[i].IsDead() && Distance > ClearDeadDistance ) || Distance > ClearAllDistance )
                            If(BanditStatus[i]==2)
                                Bandits[i].Delete()
                                Bandits[i] = None
                                BanditStatus[i]=0
                            EndIf
                            if(BanditStatus[i]==1)
                                Bandits[i].Disable(true)
                                BanditStatus[i]=2
                            EndIf
                        EndIf
                    EndIf
                EndIf
                i+=1
            EndWhile

    RegisterForSingleUpdate(30.0)

EndEvent

But lets say I wanted the Bandit to just patrol passed the player, replacing the bandit with say an Imperial guard?

ActorBase property LvlGuardImperial auto

Removing one row to stop spawned actor to start attacking the player from a distance:
Bandits[i].StartCombat(PlayerRef)

And instead adding
Bandits[i].EnableAI()
won't work - the imperial guard will stand in one spot, only moving if combat starts close by or if the player comes into proximity and the guard is hostile to the player. If they are friendly the guard will simply stand/talk but not patrol or walk...

I need the codelines for adding creating a PatrolIdleMarker, LinkedReference or something else that I can set X,Y,Z to related to the Player, so that the spawned Actors will patrol passed the point where the player was when they spawned.

I have even tried to make them patrol to PatrolIdleMarkers already defined in vanilla Skyrim (Stable outside Solitude, Barracks in Falkreath etc), but the Actors will just not start patrolling/walking...

It also seems no forums are active anymore when it comes to Skyrim... I am so glad there will be a new release of Skyrim this fall (Skyrim Remastered) and hopefully some old modders will attend the forums again...

sentences:
Given a plane and a point, how can I determine which side of the plane the point is on? Given the point

Vector pos = new Vector(0.0, 0.20156815648078918, -78.30000305175781, 1.0);

and the plane (triangle)

Vector a = new Vector(-6.599999904632568, 0.0, -78.5, 1.0);
Vector b = new Vector(6.599999904632568, 0.0, -78.5, 1.0);
Vector c = new Vector(6.599999904632568, 4.400000095367432, -78.5, 1.0);

I want to get a plane normal pointing in the direction of pos

//Getting plane normal
Vector ac = Vector.Subtract(a,c);
Vector bc = Vector.Subtract(b,c);
Vector planeNormal = Vector.CrossProduct(bc, ac);

//Testing which side of the plane the point is on
double dprod = Vector.DotProduct(planeNormal, pos);
if (dprod < 0)
{
    planeNormal.Negate();
}

But this method is wrong. The resulting planeNormal points in the negative Z direction, so it should not be negated. Is there a best practise for this? Please help me, I fail massively @ math :)

sentences:
Detecting interesting kill in a 2D shooter In Xonotic for some kills (and maybe even just hits?) the game plays a sound clip saying "Impressive!".
I was wondering how does the game recognize that a kill was impressive. In Xonotic it feels like giving larger damage faster (somehow) increases a probability of this announcement.

Does anyone know how are these things implemented? I can imagine it being easy(-ish) for hitscan weapons like a sniper rifle, where I can just take how fast was the target going across my screen and score the hit based on this. But what about rocket launchers where it might take time before shooting and hitting? I can't think of any reasonable rule for this.

In particular I'm trying to fit this idea onto a fast top down shooter with keyboard movement and mouse aiming and with weapons similar to Xonotic or UT99.

What exactly I'm interested in:

How do existing algorithms for detecting interesting hits / kills work?
Do these handle non-hitscan weapons?
How can they be extended to support them non-hitscan if they don't?

sentences: Unable to check Cardboard XR Plugin in Unity I tried to create a project for Cardboard VR. I imported the git VR package from the Google Cardboard XR Plugin for Unity repository on GitHub. Then, in Project settings -> XR Plug-in Management I tried to check Cardboard XR Plugin, The package is not installed, I got the error message which is shown the below screenshot.

sentences:
How can I rearrange layers in Unity 2D? I'm new to using Unity (2019.30a2) and am currently learning by watching Brackey's (youtube) "How to make a 2D Game in Unity"

At 6:58 he is able to rearrange his layers easily.  On my hand, I can create but am unable to change the order of the layers.

Looking at other questions on similar subjects hasn't provided me with a solution yet.  I'm currently working around it but feel this will hinder me in the future.

The screenshot of the unmovable layers is included below:

sentences:
Pixel Perfect Collision Detection in Cocos2dx I am trying to port the pixel perfect collision detection in Cocos2d-x the original version was made for Cocos2D and can be found here: http://www.cocos2d-iphone.org/forums/topic/pixel-perfect-collision-detection-using-color-blending/

Here is my code for the Cocos2d-x version

bool CollisionDetection::areTheSpritesColliding(cocos2d::CCSprite *spr1, cocos2d::CCSprite *spr2, bool pp, CCRenderTexture* _rt) {
    bool isColliding = false;
    CCRect intersection;
    CCRect r1 = spr1->boundingBox();
    CCRect r2 = spr2->boundingBox();
    intersection = CCRectMake(fmax(r1.getMinX(),r2.getMinX()), fmax( r1.getMinY(), r2.getMinY()) ,0,0);
    intersection.size.width = fmin(r1.getMaxX(), r2.getMaxX() - intersection.getMinX());
    intersection.size.height = fmin(r1.getMaxY(), r2.getMaxY() - intersection.getMinY());

    // Look for simple bounding box collision
    if ( (intersection.size.width>0) && (intersection.size.height>0) ) {
        // If we're not checking for pixel perfect collisions, return true
        if (!pp) {
            return true;
        }

        unsigned int x = intersection.origin.x;
        unsigned int y = intersection.origin.y;
        unsigned int w = intersection.size.width;
        unsigned int h = intersection.size.height;
        unsigned int numPixels = w * h;
        //CCLog("Intersection X and Y %d, %d", x, y);
        //CCLog("Number of pixels %d", numPixels);

        // Draw into the RenderTexture
        _rt->beginWithClear( 0, 0, 0, 0);

        // Render both sprites: first one in RED and second one in GREEN
        glColorMask(1, 0, 0, 1);
        spr1->visit();
        glColorMask(0, 1, 0, 1);
        spr2->visit();
        glColorMask(1, 1, 1, 1);

        // Get color values of intersection area
        ccColor4B *buffer = (ccColor4B *)malloc( sizeof(ccColor4B) * numPixels );
        glReadPixels(x, y, w, h, GL_RGBA, GL_UNSIGNED_BYTE, buffer);

        _rt->end();

        // Read buffer
        unsigned int step = 1;
        for(unsigned int i=0; i 0 && color.g > 0) {
                isColliding = true;
                break;
            }
        }

        // Free buffer memory
        free(buffer);
    }

    return isColliding;
}

My code is working perfectly if I send the "pp" parameter as false. That is if I do only a bounding box collision but I am not able to get it working correctly for the case when I need Pixel Perfect collision.
I think the opengl masking code is not working as I intended.

Here is the code for "_rt"

_rt = CCRenderTexture::create(visibleSize.width, visibleSize.height);
_rt->setPosition(ccp(origin.x + visibleSize.width * 0.5f, origin.y + visibleSize.height * 0.5f));
this->addChild(_rt, 1000000);
_rt->setVisible(true); //For testing

I think I am making a mistake with the implementation of this CCRenderTexture

Can anyone guide me with what I am doing wrong ?

Thank you for your time :)

sentences:
GLSL - Stencil buffer - instanced geometry I have geometry that have attached some "ID" data. I have generated stencil  buffer, that holds these IDs.
Now, in second pass, I render different geometry, but this time I need to mask it with already existing stencil. Each part of geometry can have different "ID". Is there a way, how to control stencil buffer test value from shader?

I give an example:

  render geometry with ID = 1, writes 1 to stencil
  render geometry with ID = 2 if ID in stencil != 1, writes 2 to stencil
  do some other rendering with stencil turn off
  render bunch of particles at one go, but some of them have ID 1, some of them ID 2 -> I want to mask them, so 1 is rendered only if 1
  is in stencil and 2 only if 2 is in stencil

I need this for OpenGL ES 2.0

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:
Texturing an asteroid I'm trying to texture this asteroid so it looks reasonable.  I'm missing something though.

Following this tutorial, I got this so far.

Now I don't understand the next step: how do you resolve the seam problems?  This icosahedral sphere has a seam running through it that cannot be avoided.  Ok.  How do I paint the texture so it looks seamless when applied to the object?  How do I know which edge connects to what side?  I guess it will just be symmetrical?

This seems awfully hard to texture a simple sphere.  Am I missing some technique here?

sentences:
Should I check SDL_Event for NULL? I have taken as a practice (as many others, I think) to always do this when working with pointers:

void I_take_pointer(some_type* arg1)
{
    if(arg1)
    {
        //safely do stuff with pointer
    }
    //optionally an else statement
}

...in almost all functions, except those where I can be sure arg1 will never be null.

Is it good practice/should I perform this check on the SDL_Event* I get on input when working with SDL2?

sentences:
How can I keep a GUI on-screen without moving/resizing it according to camera motion? I'm trying to make a GUI library with SFML, and everything's done except for one problem: making the interface stay still even when the camera moves or zooms in and out.

This would be easy to fix if zooming wasn't possible, but zooming out means having to scale the contents of the interface up so it doesn't shrink, which causes it's text/images to become blurry.

Does anyone have a way to get around this issue (preferably only using SFML as I don't want to make my library OpenGL-dependent)?

sentences:
How do I "teleport" an object in Unity? I'm trying to make a script where once a player triggers a collision they are teleported to another position that is determined by a empty game object. I think it has to do something with the transform function but I haven't been able to figure it out.

There isn't a good example of this type of behavior in c#. Most examples are written in java and that confuses me even more lol.

Here's what I got so far that works

using UnityEngine;
using System.Collections;

public class  colision: MonoBehaviour {
    public Object WarpExit;
    void OnTriggerEnter(Collider other)
    {Debug.Log("ENTERED WARP ZONE");}

    void OnTriggerStay(Collider other)
    {
        Debug.Log("IN WARP ZONE");
        //Warp player

    }
    void OnTriggerExit(Collider other)
    {Debug.Log("EXITED WARP ZONE");}
}

sentences:
What formula does this projectile velocity code derive from? //Calculate the velocity needed to throw the object to the target at specified angle.
float projectile_Velocity =
            target_Distance / (Mathf.Sin(2 * firingAngle * Mathf.Deg2Rad) / gravity);

Which formula is used to derive this projectile code?

sentences:
Unity 2d diffuse sprites not rendering on mobile EDIT:  Just an update, did change from sprite/diffuse to Diffuse and zordering of my level using t2dtk map stuff was backwards. Like the camera flipped around so i had to shuffle things around on the Z axis.  Also things that were rendering in 2d with their y rotated 180 degrees no longer were so I had to change how the other engine I was using (Corgi engine) was moving projectiles.

This all worked then in the editor.  When I pushed to the system, still nothing renders unless the rendering path is legacy vertex lit.  And then it will render but dark like my directional light and point lights are meaningless.  Apparently I am not cool enough to mess with Shaders/Unity 5 and mobile.

It seems like Mobile is having an issue rendering my diffuse sprites.  I just made some of the sprites in my game diffuse so point lights would give them a nice lit up effect.  This works great on PC but when I push the game to my mobile phone (a Galaxy Note 3) nothing that has that diffuse material renders at all.  I am assuming it is just setting but I cannot figure out for the life me how to get this to work.  I tried to muck with settings (rendering paths etc) nothing seemed to help.  Of note:  The stuff renders fine in Unity editor when the mobile target is selected even.

sentences: Math behind simulating a simple light source for rotated rectangle? Say I have a 2D Rectangle. By offsetting its position by x y and rendering a shadow by an offset, it gives the illusion of a shadow. If I rotate the rectangle Z degrees and try it with the same offset, it appears as though the light source has moved. How can I compensate for the angle so it appears as though the shadow is always coming from the same direction?

sentences:
How Can I generate a shield block from a Turn based medieval game fight? Imagine the char below, a Spartan that in his turn attacks and in the opponent turn tris to block. What would be the logic behind the block process? I just don't want to rely generating random numbers to decide

Update:

This is what I want to do, depending of the kind of the shield it would be more likely to block than others:

sentences:
How Do I Save A Value In c# Unity using System;
using System.Collections;
using System.Collections.Generic;
using UnityEngine;
using UnityEngine.UI;

public class AttemptCounter : MonoBehaviour {

    public Text AttemptText;
    public int Attempts = 1;
    public int AddAttempts = 1;

    public void AddAttempt()
    {
        Attempts = Attempts + AddAttempts;
        AttemptText.text = ("Attempts: " + Attempts.ToString(""));
        Attempts = PlayerPrefs.GetInt ("Attempts");
        PlayerPrefs.GetInt ("Attempts");
    }

    void Update()
    {
        AttemptText.text = ("Attempts: " + Attempts.ToString(""));
        PlayerPrefs.SetInt ("Attempts", Attempts);
    }
}

I Am Trying To Add a Attempts System In My Game, Every time a user will restart a level the game will add one attempt, however because when restarting the level it uses the code

SceneManager.LoadScene (SceneManager.GetActiveScene ().name);

It doesnt save the int meaning that its keeping the attempt counter on 1, can anyone help, Thanks.

sentences:
Tracking playing position into an array I'm trying to track playing position every 500ms which i can do but i need it to populate an array which i save to a txt file as a comma delimted list or something.

I have this code so far (which incorporates the player movement code too), which displays the positions in the console:

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

public class CharacterControllerT : MonoBehaviour {

    public float speed = 10.0f;
    public Read_moveT ReadMove;
    [SerializeField] private float _duration = 0.5f;
    private float _timer = 0f;
    public Vector3 PlayerPosT;
    GameObject Mover;
    public Vector3[] PlayerTxyz;

    // Use this for initialization
    void Start () {
        Cursor.lockState = CursorLockMode.Locked;
        Mover = GameObject.Find ("PlayerT");
        ReadMove = Mover.GetComponent<Read_moveT> ();
    }

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

        if (!Input.GetButton ("DoorTrigger")) {
            ReadMove.mUP = Input.GetAxis ("Vertical");
            ReadMove.mLEFT = Input.GetAxis ("Horizontal");
            float translation = ReadMove.mUP * speed;
            float straffe = ReadMove.mLEFT * speed;

            translation *= Time.deltaTime;
            straffe *= Time.deltaTime;

            transform.Translate (straffe, 0, translation);
        }

        if (Input.GetKeyDown ("escape")) {
            Cursor.lockState = CursorLockMode.None;
        }

        _timer += Time.deltaTime;
        if (_timer >= _duration) {
            _timer = 0f;
            PlayerPosT = Mover.transform.position;
            print ("Player:: X: " + PlayerPosT.x + ", Z: " + PlayerPosT.z);
        }
    }
}

I just need these coords to be saved into an array that i can process when the game is over. The problem being that the array will always be (until game over) of undetermined length.

Any ideas?

Thanks,

Paul..

sentences: Detect if a sprite has left the camera in libgdx? Is there a method to know if a sprite has left the camera of the stage? or I have to do my operations? :P

sentences:
Animation file format I'm trying to make a simple 2D animation file format. It'll be very rudimentary: only an XML file containing some parameters (such as frame duration) and metadata, and some images, each representing a frame.

I'd like to have the whole animation (frames and XML document) packed in a single file. How do you suggest I do that? What libraries are there that would allow easy access to the files inside the animation file itself?

The language I'm using is C++ and the platform is Windows, but I'd rather not use a platform dependent library, if possible.

sentences:
Animation after enemy spawns right now in my game, four enemies spawn in four spawn points with a delay, but what I want to do is that if you don't kill the enemy after a couple seconds, an animation (it's an animation of a scratch, basically to let the player know it has been attacked) appears.

Right now I have a script that display an image (it's an image because I was testing the scripts), but now I want to change the image for the animation but after trying and failing a lot of times I decided to ask here, and hopefully someone can help me.

This is the script of the "attack", and it's attached to the enemy prefab:

public Image TargetImage;

void Start ()
{
    TargetImage.enabled = false;
}

public void spawnAttack(){
    StartCoroutine (playerIsAttacked (5, TargetImage));
}

public IEnumerator playerIsAttacked (float t, Image im)
{
    yield return new WaitForSeconds (t);
    TargetImage.enabled = true;
}

}

and this is in the timed spawn script:

public class TimedSpawn : MonoBehaviour {

public GameObject spawnee;
public bool stopSpawning;
public float spawnTime;
public float spawnDelay;

void Start () {
    InvokeRepeating ("SpawnObject", spawnTime, spawnDelay);
}

public void SpawnObject (){
    GameObject newSpawn = Instantiate (spawnee, transform.position, transform.rotation) as GameObject;
    newSpawn.GetComponent <enemyAttack> ().spawnAttack ();

    if (stopSpawning) {
        CancelInvoke ("SpawnObject");
    }
}

}

sentences:
Power-up spawns 2-3 times after a restart, but enemies spawn normally I have two spawning objects that use the same behaviour. They are being called in the same function and in the same situations. The only difference is the variable of time that classifies what's an enemy and what's a power up.
The spawning of enemy objects is working fine: no matter how many times I restart the game, the behaviour is the same. But with the power up spawning object, it spawns the right way sometimes, but in other times it spawns like 2 or 3 times in the same place. This only happens when I restart the game.
How can I fix this bug?
I'm not fluent in english.
File 1:
public float enemySpawnSeconds = 2.5f;
public float powerUpSpawnSeconds = 6f;

public void Start()
{
    gameManager = GameObject.Find("GameManager").GetComponent<GameManager>();
}

private void Update()
{
    GameSpeed();
}

public void StartSpawnObjects()
{
    StartCoroutine(SpawnPowerUps());
    StartCoroutine(SpawnEnemies());
}

public IEnumerator SpawnEnemies()
{
    yield return new WaitForSeconds(2f);
    while (gameManager.startGame == false && gameManager.gameOver == false)
    {
        Instantiate(enemies[Random.Range(0, 2)], transform.position = new Vector3(9.8f, yPosition[Random.Range(0, 2)]), Quaternion.identity);
        yield return new WaitForSeconds(enemySpawnSeconds);
    }
}

public IEnumerator SpawnPowerUps()
{
    yield return new WaitForSeconds(2f);
    while (gameManager.startGame == false && gameManager.gameOver == false)
    {
        yield return new WaitForSeconds(powerUpSpawnSeconds);
        Instantiate(powerups[Random.Range(0, 3)], transform.position = new Vector3(11.1f, yPosition[Random.Range(0, 2)]), Quaternion.identity);
    }
}

File 2:
void Update()
{
    spawnPlayer();
    gameTimer();
    restartGame();
}

public void spawnPlayer()
{
    if (startGame == true) //starting the game
    {
        if (Input.GetKeyDown(KeyCode.Space))
        {
            Instantiate(player, player.transform.position, Quaternion.identity);
            spawned = true;
            startGame = false;
            uiManager.HideTitleScreen();
            spawnManager.StartSpawnObjects();
        }
    }
}

public void gameTimer()
{
    if (startGame == false)
    {
        timer += 0.0165447f; // game time
    }
}

public void restartGame()
{
    if (gameOver == true) // restarting the game
    {
        timer = 0f;
        spawnManager.enemySpawnSeconds = 2.5f;
        if (Input.GetKeyDown(KeyCode.Space) && uiManager.restart == true)
        {
            gameOver = false;
            uiManager.HideTitleScreen();
            spawnManager.StartSpawnObjects();
        }
    }
}

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:
How to set the z axis bound of the collider of child of an instantiated object to zero I have attached a script to an empty GameObject to instantiate a prefab and the script is:
using System.Collections;
using System.Collections.Generic;
using System.Collections.Specialized;
using UnityEngine;

public class Circles : MonoBehaviour
{
    [SerializeField] float Xmax;
    [SerializeField] float Xmin;
    [SerializeField] float Ymax;
    [SerializeField] float Ymin;

    [SerializeField] float outsideMaxsize;
    [SerializeField] float outsideMinsize;
    float insideMaxsize;
    float insideMinsize;

    public GameObject[] enemy;
    GameObject enemyObject;

    int enemyNo;

    float Xpos;
    float Ypos;
    float outsideSize;
    float insideSize;

    // Start is called before the first frame update
    void Start()
    {
        enemyNo = Random.Range(0, 4);

      instantiator();
    }

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

    }
    public void instantiator()
    {
        Xpos = Random.Range(Xmin, Xmax);
        Ypos = Random.Range(Ymin, Ymax);

        outsideSize = Random.Range(outsideMinsize, outsideMaxsize);

        Vector2 circlePos = new Vector2(Xpos, Ypos);
        transform.position = circlePos;

        enemyObject = GameObject.Instantiate(enemy[enemyNo], transform.position, transform.rotation,transform.parent) as GameObject;

        var enemies = enemyObject.transform;
        var outsideComponent = enemies.GetChild(0);
        var insideComponent = enemies.GetChild(1);
        outsideComponent.transform.localScale=new Vector2(outsideSize, outsideSize);
        insideMaxsize = outsideSize * 0.5f;
        insideMinsize = 0.15f;
        insideSize = Random.Range(insideMinsize, insideMaxsize);
        insideComponent.transform.localScale = new Vector2(insideSize, insideSize);

        enemyNo = Random.Range(0, 4);
    }
}

And I have attached a script to the prefab which is being instantiated and that script is:
 using System;
using System.Collections;
using System.Collections.Generic;
using UnityEngine;

public class destroyer : MonoBehaviour
{

    Circles circles;

    CircleCollider2D collider1;
    Collider2D collider2;

    private void Start()
    {

        circles = FindObjectOfType<Circles>();

        print("1 max"+collider1.bounds.max);
        print("1 min" + collider1.bounds.min);
        print("2 max" + collider2.bounds.max);
        print("2 min" + collider2.bounds.min);

    }

    private void OnEnable()
    {
        collider1 = gameObject.transform.GetChild(0).GetComponent<CircleCollider2D>();
        collider2 = gameObject.transform.GetChild(1).GetComponent<Collider2D>();
    }

    void OnTriggerStay2D(Collider2D other)
    {
        print("star max"+other.bounds.max);
        print("star min" + other.bounds.min);

        if (collider1.bounds.Contains(other.bounds.max) && collider1.bounds.Contains(other.bounds.min))
       {

            if (other.bounds.Contains(collider2.bounds.max) && other.bounds.Contains(collider2.bounds.min))
            {

                    Destroy(other.gameObject);
                    Destroy(gameObject);
                    circles.instantiator();

            }

        }
    }
}

the problem is that the z axis bounds of the colliders are coming out to be 15.8
when the prefab is instantiated and when I drag the prefab to scene then the z axis bounds of the collider is 0. I want the z axis bounds of the colliders to be 0 when the prefab is instantiated

sentences:
Multiplayer FPS server side performance This is related to MMO Performance except that question is about bandwidth. This is about cpu load.

I put together a simple FPS using node.js and webGL. It's extremely simple, a lot like the BuddyMaze clone of MIDI Maze. There's very little going on, everyone moves in two dimensions (no height), shoots simple projectiles, and runs into walls.

Right now, if I make multiple connections to the server where every player shoots rapidly while spinning in circles, I can get about 15 - 20 players in the game before the server maxes out a core and slows way down. And this is when running at 30 fps on the server. At 10 fps, I get about 25 - 30 connections. This is pretty bad, since the game is going to have a lot more to do soon and I'll need to fit more players for this to be a feasible endeavor.

My brother just pointed out some stats about his coworker's TF2 server. His server is lower specs than ours, yet it runs TF2, obviously a much more complex game, at a whopping 500 ticks per second, with 36 users per core. Also, we currently consume much more bandwidth than they do, but we haven't been trying to lower that much yet.

How is this possible? What sort of tricks are there to increase server performance to this magnitude? Some things that I know of include:

Lowering framerate on the server, and interpolate positions on the client. I got some benefit, but clearly the TF2 server doesn't even bother with this.
Doing expensive things like collision detection on the client, and verify it infrequently on the server. I haven't moved this over just yet, I will tonight. Even so I don't expect such an enormous gain.
Break the playing field into regions (quad trees) to minimize calculations. Haven't had an opportunity for this yet.
I've considered the unfortunate possibility that node.js is just way slower than whatever TF2 is using, and may not be suited for this kind of high intensity task.
Is it all in the server configuration magic?

So what are the other tricks of the industry to do only the minimum required on the server but still have a flawless game experience? There's a big conflict between "defer to client to save cpu time" and "don't trust the client", so maybe it helps to know where the line is drawn in various situations?

Update

Profiling really is the only mantra I've ever found that's absolutely infallible. I quickly wrapped some timing functions around my code (thanks, FP!) and discovered what I never expected: the act of broadcasting the data to clients accounts for nearly all of the execution time. Specifically, around 90% of it. Further testing showed that this time is dependent on both the number of clients and the size of the data, but more so the latter. On a 20 user load, I cut my broadcast time 90%, from 24ms down to just over 2ms by sending only "{}" instead of the full data. But with only 5 users, broadcasting takes around 0.5 ms. So I clearly need to do some optimization here.

The first most obvious improvement is line of sight checking. This would decrease both the number of people who care about data, and also the amount of data sent to interested parties. Are there other tricks in this realm I can try, which focus on minimizing the cost of my broadcast operation?

sentences:
What are the parameters for btHingeConstraint::setLimit? What does each parameter in btHingeConstraint::setLimit do to the hinge constraint?

void btHingeConstraint::setLimit    (   btScalar    low,
        btScalar    high,
        btScalar    _softness = 0.9f,
        btScalar    _biasFactor = 0.3f,
        btScalar    _relaxationFactor = 1.0f
    )

sentences:
MissingReferenceException being thrown in async method I'm trying to create a UI pop up box to show messages. It is a simple component: it's only a background image, a text and a script to manage it.
The script is very simple and just have a Display method that should show the message and after a while close the element.
public class NoticeBox : MonoBehaviour
{
    [SerializeField]
    private TextMeshProUGUI messageText;

    private int lastUse;

    public async void Display(string text, int lifeTime = 2000)
    {
        lastUse = Environment.TickCount;
        var thisUse = lastUse;

        messageText.text = text;

        gameObject.SetActive(true);

        await Task.Delay(lifeTime);

        if(thisUse == lastUse)
            gameObject.SetActive(false);
    }
}

The problem is: when the scene is transitioned to another one or the game closes (at least in play mode), the code after await Task.Delay(lifeTime); is executed anyway, throwing a MissingReferenceException when executing.
I tried the exact same behavior using WaitForSeconds and coroutines and the problem still rises up.
I tried testing both this and gameObject for null but despite of that the exception still rises.
What should I do in this case?

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:
Can't scale properly to android device in Game Maker Studio 1.4 My phone is using a resolution of 360 x 640 with a 9:16 aspect ratio. I set my room in game maker to 360 x 640  and game maker thinks it's in landscape mode. I disabled landscape mode in the android settings and set to portrait only, like it should be. How do I get it to scale properly?

This is the code I have in my Scale Manager Object.

Create Event:

///Display Properties
ideal_width = 0;
ideal_height = 640;

aspect_ratio = display_get_width()/display_get_height();
ideal_width = round(ideal_height/aspect_ratio);

//check for odd numbers
if(ideal_width & 1) {
    ideal_width++;
}

for (var i = 1; i <= room_last; i++) {
    if(room_exists(i)) {
        room_set_view(i,0,true,0,0,ideal_width,ideal_height,0,0,ideal_width,ideal_height,0,0,0,0,-1);
        room_set_view_enabled(i,true);
    }
}

surface_resize(application_surface,ideal_width , ideal_height);
window_set_size(ideal_width,ideal_height);
room_goto(room_next(room));

sentences:
How to create a splash (loading) screen in cocos2d for Android? How to create a splash (loading) screen in cocos2d for Android?

I need a loading screen that shows my app name and after that the next scene will show automatically.

Thanks

sentences:
Displaying and updating score in Android (OpenGL ES 2) I'm using a FrameLayout where I have a GLSurfaceView at the bottom and a few Views on top of it. One of those Views is a TextView that displays the current score.

Here's how I'm updating the score TextView based on what happens in my game loop: whenever an event happens that increases the score, I call activity.runOnUiThread(updater), where activity is the activity that has the above FrameLayout (my main game activity) and updater is just a Runnable that increments the score. From my understanding, using runOnUiThread() from the OpenGL thread is standard practice - otherwise you'll get an exception, I can't remember its name.

The problem is that there's a very noticeable lag between the event and the score update. For example the character gets a coin, but the coin count is not updated quickly. I tried summing all the score events from my game loop and calling runOnUiThread() only once per loop, but it doesn't seem to make much of a difference - the lag is still noticeable.

How can I improve my design to avoid this lag?

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:
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:
how to get the current location in the map surface - slick 2D @Override
public void mouseMoved(int oldx, int oldy, int newx, int newy) {
  super.mouseMoved(oldx, oldy, newx, newy);
}

we can get the mouse location in this method via newx, newy . i want to know is there any such way to get the location in slick2D? when we press the arrow keys and move a image of a man on the game surface(tile map)?

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:
Is It Possible To Reset UI To Initial State At Runtime Without Any Direct Assignments? Is it possible to reset UI to it's initial state (the state when game started) without directly reseting elements one by one?

Thanks in advance.

Edit: I'm asking for runtime. (ResetToPrefabState doesn't work at runtime.)

sentences:
Can I directly pass a Boost ptr_vector list to glBufferData? I have a data structure like this:

typedef struct vertex_ {
float x;
float y;
float z;
float s;
float t;
}vertex;

Then I add to a list called: boost::ptr_vector<vector> vertices;

Is there a way to use vertices to provide the parameters for glBufferData?

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:
Getting entity type object I have a custom entity class and what it does is create a SQUARE object.

public class Entity {
    Rectangle rect;

public Entity() {
    this.rect = new Rectangle(20,20);
    rect.relocate(200,200);
}

// I want it to be public Entity getEntity() {return this.rect;}
public Rectangle getEntity() {
    return this.rect;
  }
}

The problem is that I can't get my class to return an Entity object, instead of a Rectangle one.

How do I go about doing that?

sentences:
Skewed 3d model when moving device around with Unity and Vuforia I am having trouble with the orientation of a 3d model that is larger (think queen-sized bed) than the target image(a4 size bond paper). The model appears to be slanted in a way that looks totally unrealistic especially when moving the device around. Is there a way to keep the model horizontally aligned with the real-world floor?

I have already enabled Extended Tracking but the behavior is still present. I have also set the world center to Specific Target and set Device Camera focus mode to FOCUS_MODE_CONTINUOUSAUTO.

Thank you.

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:
Invalid coordinates returned by glutMouseFunc() I am using GLUT's glutMouseFunc() function to retrieve the coordinates of mouse clicks.  I want to move the object on that coordinate to another coordinate.  But when I click on the object the coordinates returned by glutMouseFunc() are different than the original.

windowWidth=1250;
windowHeight=1000;

void onMouse(int button, int state, int x, int y);

int main(int argc, char** argv) {

    glutInit(&argc, argv);
    glutInitDisplayMode(GLUT_SINGLE);
    glutInitWindowSize(1250, 1000);
    glutCreateWindow("OpenGL - First window demo");
    // ...
    glutMouseFunc(onMouse);
    // ...
    glutMainLoop();
    return 0;
}

void onMouse(int button, int state, int x, int y) {
    flag++;
    if (state != GLUT_DOWN && button!=GLUT_LEFT_BUTTON)
        return;

    GLbyte color[4];
    GLfloat depth;
    GLuint index;

    glReadPixels(x, windowHeight + y - 1, 1, 1, GL_RGBA, GL_UNSIGNED_BYTE, color);
    glReadPixels(x, windowHeight + y - 1, 1, 1, GL_DEPTH_COMPONENT, GL_FLOAT, &depth);
    glReadPixels(x, windowHeight + y - 1, 1, 1, GL_STENCIL_INDEX, GL_UNSIGNED_INT, &index);

    printf("Clicked on pixel %d, %d, color %02hhx%02hhx%02hhx%02hhx, depth %f, stencil index %u\n", x, y, color[0], color[1], color[2], color[3], depth, index);
    move();
}

Inside my render function i have set the window coordinates to 0,0 using glortho

glMatrixMode(GL_PROJECTION);
glLoadIdentity();
glOrtho(0, windowWidth, windowHeight, 0, 0, 1);
glMatrixMode(GL_MODELVIEW);
glLoadIdentity();

If my object is at (550, 900), onMouse() reports it as (556, 650) while if I click on an object which is at position (375, 475) the onMouse() returns (376, 342).

Basically there is a huge difference between the value of y axis returned by the function.

How can i get the correct screen coordinates?

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:
Unity Photon multiplayer :: check distance between two players How to get distance between two player in a photon multiplayer game. Condition is both the player is moving.
I have tried something like this, in my player control script:

if (photonView.isMine)
pos1 = rigidBody.position;
else
pos2 = rigidBody.position;
Distance= Vector3.Distance(pos1-pos2)

But its not working. For a player the pos2 is always (0,0).
Please help.

sentences:
Flipped vertical button element on Canvas not reacting I have a small refresh arrow circle that I wanted to use for an indicator in which direction the tile gets rotated on click. After I rotated it by 180 under the rect Transform rotation Y to spin the opposite direction, it does not react anymore for OnClick events. Probably since we are technically clicking on the backside of the image. The non rotated version works, changing the rotation from 180 to 0 works as well.
Is there any way to get a flipped image working without duplicating the source image and flip it before assigning it to the button?
The scene is a simple screen space camera, one canvas with 2 buttons (having the same image source), one button has 180 under Y Rotation and the default EventSystem.

sentences:
How can I implement smooth digging effects in a tile-based game? I'm trying to make a Dig Dug styled game where you will be digging into a material. This is going to be a tile-based HTML5 game and I have decided to use the Phaser framework.

One way to do the digging mechanic is to break the play area into tiles and remove tiles as the player sprite collides. But I would like to have a smooth digging animation/physics, so it appears that the player character "carves" out the soil as it digs through. Any tips on how I should do this? Right now I have 15x15px tiles while the player is 45x45px, this sort-of fakes the smooth digging I want. Is there a better way?

sentences:
How to make a ball fall faster on a ramp? So, I'm making a ball game. Where you pick up the ball, drop it on a ramp, and it flies off in to blocks. The only problem right now is it falls at a normal speed, then lightly falls off, not nearly fast enough to get over the wall and hit the blocks.

Is there any way to make the ball go faster down the ramp? Maybe even make it go faster depending on what height you dropped it from (e.g. if you hold it way above the ramp, and drop it, it will drop faster than if you dropped it right above the ramp.)

sentences:
Where can I find the library for org.newdawn.slick.opengl.Texture I started making a game in Java, and someone on stackoverflow recommended me LWJGL.
I found some examples, and they worked. Later I wanted to test sprites and every example that I found that loads images imports org.newdawn.slick.opengl.Texture. I can't find that library anywhere. Is there a better alternative, or where can I find this one?

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 do I fix the YAML error in Unity 5? I'm using Unity 5 and I'm getting an error in a YAML file. The error is "Unable to parse YAML file: [mapping values are not allowed in this context] at line 1"  This comes up every time I open the engine.

I've seen some say to open the YAML file and change some stuff in it. But I can't even find the YAML files. I've also seen that it's caused by meta file issues and version control. The project is local but I don't know if it matters if it's local or cloud based.

Does anyone have a solution for this issue?

sentences:
Unity - I can't change the "colorOverLifetime" property of the "Particle System" via script The goal is to remove the particles via script with fade effect. But I'm not just interested in an alternative, I want to understand why my code doesn't work.

The code below is modified to show only the important parts. I can't know before what time the particles will be dissolved, so I can't set the parameter from the editor.

StarsConfig.Stars.colorOverLifetime.color.gradient.SetKeys
This is the important point (see the log image). The gradient does not take my new values but alphaKey is correct.

Why ?
Thanks

private bool FadeStarts = false;

void Update()
{
    if (FadeStarts) return;
    StartCoroutine(fadeStars(false));
}

private IEnumerator fadeStars(bool show)
{

    FadeStarts = true;

    ParticleSystem.ColorOverLifetimeModule c = new ParticleSystem.ColorOverLifetimeModule();

    c = StarsConfig.Stars.colorOverLifetime;

    Gradient g = c.color.gradient;

    Debug.Log("OFF " + c.color.gradient.alphaKeys[0].alpha + " --> " + g.alphaKeys[0].alpha);

    GradientAlphaKey[] alphaKey = new GradientAlphaKey[2];
    alphaKey[0] = c.color.gradient.alphaKeys[0];
    alphaKey[1] = c.color.gradient.alphaKeys[1];

    while (c.color.gradient.alphaKeys[0].alpha > 0f) {

        alphaKey[0].alpha -= StarsConfig.VelocityAlpha * Time.deltaTime;
        alphaKey[1].alpha -= StarsConfig.VelocityAlpha * Time.deltaTime;

        StarsConfig.Stars.colorOverLifetime.color.gradient.SetKeys(c.color.gradient.colorKeys, alphaKey);

        Debug.Log("g " + alphaKey[0].alpha + " --> " + StarsConfig.Stars.colorOverLifetime.color.gradient.alphaKeys[0].alpha);

        /*
        StarsConfig.Stars.colorOverLifetime.color.gradient.SetKeys(
            new GradientColorKey[] { new GradientColorKey(Color.white, 0f),
                                    new GradientColorKey(Color.white, 1.0f) },
            new GradientAlphaKey[] { new GradientAlphaKey(StarsConfig.Stars.colorOverLifetime.color.gradient.alphaKeys[0].alpha - (StarsConfig.VelocityAlpha * Time.deltaTime), 0f),
                                    new GradientAlphaKey(StarsConfig.Stars.colorOverLifetime.color.gradient.alphaKeys[1].alpha - (StarsConfig.VelocityAlpha * Time.deltaTime), 1f) });

        */

        yield return 0;
    }

    StarsConfig.Stars.Stop(true, ParticleSystemStopBehavior.StopEmittingAndClear);

    FadeStarts = false;
}

UPDATE

Ed_Marty's suggestion is correct, and the solution is there (thanks!). But I would like to understand what is the difference between these two codes.

This code works

var col = StarsConfig.Stars.colorOverLifetime;
while (col.color.gradient.alphaKeys[0].alpha > 0f) {

    float alpha = StarsConfig.Stars.colorOverLifetime.color.gradient.alphaKeys[0].alpha - (StarsConfig.VelocityAlpha * Time.deltaTime);

    Gradient grad = new Gradient();
    grad.SetKeys(
        new GradientColorKey[] {
            new GradientColorKey(Color.white, 0.0f),
            new GradientColorKey(Color.white, 1.0f) },
        new GradientAlphaKey[] {
            new GradientAlphaKey(alpha, 0.0f),
            new GradientAlphaKey(alpha, 1.0f) });

    col.color = grad;

    yield return 0;
}

And this doesn't work

while (StarsConfig.Stars.colorOverLifetime.color.gradient.alphaKeys[0].alpha > 0f) {

    float alpha = StarsConfig.Stars.colorOverLifetime.color.gradient.alphaKeys[0].alpha - (StarsConfig.VelocityAlpha * Time.deltaTime);

    StarsConfig.Stars.colorOverLifetime.color.gradient.SetKeys(
        new GradientColorKey[] { new GradientColorKey(Color.white, 0f),
                                 new GradientColorKey(Color.white, 1.0f) },
        new GradientAlphaKey[] { new GradientAlphaKey(alpha, 0f),
                                 new GradientAlphaKey(alpha, 1f) });

    yield return 0;
}

sentences:
Pathfinding with different sized units I am actually working on a general purpose pathfinding library (find it here), mostly oriented for grid-based maps.
I was looking for ways to integrate support for pathfinding with units of different sizes. Actually, I am working with the assumption that all units are square (i.e. their widths and heights in tile units are the same).

In researching, I came across a very comprehensive article about Annotated A-star, using True clearance values for pathfinding. I tried it, and succeeded in implementing it, and got it working with a wide range of search algorithms (A-star, Theta*, Dijkstra, DFS, Breadth-first search and Jump Point Search).

There are some small details of implementation I think I am still missing. First of all, when an agent is 2x2 sized (i.e it occupies 4 tiles on the grid map), what tile can be assumed to be the agent position ?  On the same page, clearance based pathfinding will fail in some cases. Let's consider the following map, where 0's are passable tiles, 1's are obstacles and x's matches walkable goal to be reached.
Let's assume we are pathing with a 2x2 sized unit:

00000000
00111100
001xx100
001xx100
00000000

For targets on the left (tiles 4,3 and 4,4), clearance value is 2, for both. No problem here. But for the others (tiles 5,3 and 5,4), clearance value is 1. So depending on how the agent position is taken, pathfinding will fail while obviously, for each of these target, the agent can properly fit into the dead-end space.

Another scenario, with the same 2x2 sized agent:

0000000x
0000000x
0000000x
0000000x
xxxxxxxx

Well, all tiles are walkable here, no obstacles. We want the object to reach any goal on the rightmost or bottom-most border. Each of these targets have a clearance of 1, so annotated pathfinding wil obviously fail here...depending on how the agent's position is taken.

How do I work around this issue?

sentences:
How to smoothly track and draw player movement? I am currently using C# XNA Framework to simply connect some development concepts that I've learned/used over the past few months. Right now I have a Web Service that keeps track of connected clients and their 2D positions. I have a very small map that uses triangles to represent clients and their positions.

What I am seeing is my client updates very smooth (because I update my own position locally before sending it off to the web service), however, other triangles come in and appear choppy.

I use a web service that is called approximately every 20ms (and responds pretty quickly might I add). However, I know that XNA framework calls its update/draw methods approximately 60 times per second correct? Given this, there is ALWAYS going to be the appearance of choppiness.

Is there some strategy or pattern to handling this? I thought about implementing a method on the client side that basically says, give me start position and end position and I'll transition the triangle between the two points smoothly. But this may not be the right answer.

What are folks thoughts?

I am using a NetTcpBinding from WCF (Duplex). Is this technology simply too slow?

Is the right strategy simply to let the Service always tell me where the other clients are and the client simply draws them there?

Or does the client compute other information and make assumptions etc?

Thanks for any information on this topic!

sentences:
Strategy for keeping a primitive facing the viewport? Using XNA, c#.

I'm writing a stellarium-type of program-- well, trying to :-) -- and I have a 'sun' texture that I'll be pasting onto triangle primitives. I'll also be floating some text above each node, which will probably be on the primitive as well.

My issue is how to force the primitives to always be facing the camera, despite rotations and movements of the viewport. I'm going through my XNA programming books, but there's no obvious solution. I'd appreciate a pointer in the right direction.

Note: I'm not using 3D models, so AFAIK there's no Matrix to work with. I have 3 vector3's that define a triangle, and I guess I have to modify their addresses on each update to face the camera. That seems pretty intensive, so I'm thinking I may be missing something obvious.

sentences:
How can I get the instantaneous volume level of a sound at a particular playback point? How can I go about getting the current volume output of an audio file in libGDX? By that I mean of the actual file at its current play position.

Essentially I want to write my own version of a plugin I was using in Unity for basic lip syncing. Depending how loud the audio is, a different mouth shape sprite will be shown.

So for example if there was a sound with a sentance "what is that?" you would expect the "that" to be a different shape than the "what is," as it's louder. Is there a way to do this, to get the volume at a certain point?

sentences:
XNA blurring moving images Why does XNA blurs the images which moves less than 1px in between two draws? It is quite annoying, because everything looks really blurry. Is there a way to disable it?
I have tried to set the SamplerState of the spritebatch's SamplerState to PointWrap in it's Begin function, but then it wraps the images to pixels, thus they move choppy. Any suggestions? Thanks!
My SpriteBatch's Begin function:

spriteBatch.Begin(SpriteSortMode.Deferred, BlendState.AlphaBlend);

Edit:

public class Image:IDisplay
{
    public Texture2D texture;
    private BaseModel model;
    private Vector2 position;
    private Util.DISPLAY_LAYERS layer;
    public Image(String asset, BaseModel _model)
    {
        model = _model;
        texture = Main.current.Content.Load<Texture2D>(asset);
        DisplayManager.add(this, model.layer);
    }
}

This is how the Image class looks like (without additional functions), and this is it's draw function which is being called.

public void Draw(SpriteBatch batch)
    {
        if (model== null)
        {
            batch.Draw(texture, position, Color.White);
        }
        else {
            position.X = (int)Math.Round(model.Position.X, MidpointRounding.AwayFromZero);
            position.Y = (int)Math.Round(model.Position.Y, MidpointRounding.AwayFromZero);
            batch.Draw(texture, position, Color.White);
        }
    }

sentences:
Developing a game using opengl Hello Everyone,
               I want to create a game using OPEN GL to learn basics of the game development. I know C++ and OOPS and can manage the coding. I have tried using the free engines on the market like Unreal Engine, Unity and Game Maker. Unreal Engine in particular doesn't work well on my System due to it's higher requirements. Even all other engines have some kind of abstraction to themselves. I have time to spare. So, please suggest me a starting point to start developing using OPEN GL and also the math required to create them. All I want to do is learn it thoroughly at the lower level.
Thanks in advance

sentences:
Animating sprites in HTML5 canvas I'm creating a 2D platformer game with HTML5 canvas and javascript. I'm having a bit of a struggle with animations. Currently I animate by getting preloaded images from an array, and the code is really simple, in player.update() I call a function that does this:

var animLength = this.animations[id].length;
this.counter++;
this.counter %= 3;
if (this.counter == 2) this.spriteCounter++;
this.spriteCounter %= animLength;
return this.animations[id][this.spriteCounter];

There are a couple of problems with this one: When the player does 2 actions that require animating at the same time, animation speed doubles. Apparently this.counter++ is working twice at the same time. I imagine that if I start animating multiple sprites with this, the animation speed will multiply by the amount of sprites. Other issue is that I couldn't make the animation run only once instead of looping while key is held down.

Someone told me that I should create a function Animation(animation id, isLooped boolean) and the use something like player.sprite = new Animation("explode", false) but I don't know how to make it work.

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:
Need help in determing what, if any, tools can be used to create a free Flash game Yes I proudly -and sadly- declare that I am a complete nincompoop when it comes to Flash, and I have been fishing around the big wide web for information. The reason for this is that I have been contracted to create a game(s) for a website -the usual flash-based games caveat. Please I do not mean things like by those gaming generator websites, I mean small yet professional games- but the caveat, as always, is that impossible dream: it needs to be done all for free. The budget...well imagine it as not there.

Annoyingly is that I am a game designer yes, but with a ridiculously tight deadline I haven't got much time to re-learn (ah the heady days of programming at uni) everything by the end of March, so I'd like to ask some people who know their stuff rather than keep looking at a gazillion different things.

This is my understanding: with the flash sdk you can create a game, albeit you need to be pretty programming savvy. FlashDevelop helps there -yet I am not entirely sure how. Yet even FD says to use Flash for the animation/graphics.

Yes its undeniably powerful but as I said there is the unattainable demand of no money. The million dollar question: what, if any, tools can I use to create a free flash game?

sentences: Is there a leveling guide somewhere? I am designing a simple game and am looking for some help designing different level/ranks. For instance, starting from "Novice" to "Intermediate" to "Master". Is there are repository somewhere that records these from various games? For instance, from World of Warcraft, Diablo etc. Any suggestions?

sentences:
Having issue's with a confusing access violation? - C , OpenGL 3.3+ , SDL 2.0+ Hello this code seems so well done and yet I'm getting this weird access violation error when I use anything but 0 in glShaderSources 2nd argument :

glShaderSource( fragshader, 0, fragfilebuff, NULL );

If I use lenofstr or any other number then 0 it calls up an error like this :

I have no idea for the life of me why this is happpening
I've updated my drivers , I've even tried messing around with glewInit();
too see if it's something to do with that but no luck what so ever.

This nvidia dll has some problem with my code and I don't know why?...

void LoadShaders(const char *fragshaderfn, const char *vertshaderfn)
{
    FILE *fragfile;
    const GLchar *fragfilebuff[256] = { 0 };
    fopen_s(&fragfile, fragshaderfn, "r");

    fread(fragfilebuff, sizeof(char), sizeof(char) * 256, fragfile);
    printf(fragfilebuff);

    GLsizei lenofstr = strlen(fragfilebuff);
    printf("this is the length -> %d", lenofstr);

    GLuint fragshader = glCreateShader(GL_FRAGMENT_SHADER);

    glShaderSource(fragshader, 0,
        fragfilebuff, NULL);

    glCompileShader(fragshader);

};

Here's the complete source :

#include <SDL.h>
#include <GL/glew.h>
#include <SDL_opengl.h>
#include <stdio.h>
#include <conio.h>

#define SCREEN_HEIGHT 480
#define SCREEN_WIDTH 640

SDL_Renderer *mainrenderer;
SDL_Window *mainwindow;
SDL_Event event;
bool running = true;

void LoadShaders(const char *fragshaderfn, const char *vertshaderfn)
{
    FILE *fragfile;
    const GLchar *fragfilebuff[256] = { 0 };
    fopen_s(&fragfile, fragshaderfn, "r");

    fread(fragfilebuff, sizeof(char), sizeof(char) * 256, fragfile);
    printf(fragfilebuff);

    GLsizei lenofstr = strlen(fragfilebuff);
    printf("this is the length -> %d", lenofstr);

    GLuint fragshader = glCreateShader(GL_FRAGMENT_SHADER);

    glShaderSource(fragshader, lenofstr,
        fragfilebuff, NULL);

    glCompileShader(fragshader);

};

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

    mainwindow = SDL_CreateWindow(
        "C OpenGL Engine",
        300, 300, 640, 480,
        SDL_WINDOW_SHOWN | SDL_WINDOW_OPENGL );

    SDL_GLContext maincontext = SDL_GL_CreateContext(mainwindow);
    SDL_GL_MakeCurrent(mainwindow, maincontext);

    glewExperimental = GL_TRUE;
    GLenum err = glewInit();

    if (GLEW_OK != err)
    {
        /* Problem: glewInit failed, something is seriously wrong. */
        fprintf(stderr, "Error: %s\n", glewGetErrorString(err));
    }
    fprintf(stdout, "Status: Using GLEW %s\n", glewGetString(GLEW_VERSION));

    if (SDL_GL_SetSwapInterval(1) < 0)
    {
        printf("Warning: Unable to set VSync! SDL Error: %s\n", SDL_GetError());
    }

    LoadShaders("ffile.frag", "");

    glClearColor(0.0, 0.0, 0.0, 1.0);

    while (running == true)
    {
        while (SDL_PollEvent(&event))
        {
            switch (event.type)
            {
                case SDL_QUIT:
                    SDL_GL_DeleteContext(maincontext);
                    SDL_Quit();

                    return 0;
                break;
            }
        }

        glClear(GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT );

        SDL_GL_SwapWindow(mainwindow);
    }

    SDL_GL_DeleteContext(maincontext);
    SDL_DestroyWindow(mainwindow);
    SDL_Quit();
    return 0;
}

All help would be appreciated I am using C , SDL 2.0 and OpenGL 3.3+ ,
MSVC 2015 , Win10 64bit

sentences:
Advice on how to organise the levels in a game I'm thinking of building a 2D platformer game similar to Super Mario Bros, but I'm in the planning process and realised I don't really have a good way of storing information about each level – where should the enemies be placed, where do they walk, what happens if the player enters an area etc.

At first I thought I could make one scene per level, but with 40 to 50 levels I had a feeling that it would get messy pretty quickly. A friend of mine recommended making an array or dictionary containing every single wall, enemy and item a level contained. At first glance this too seemed like a good idea, but since every level is quite different it seems like building an effective system for detecting what the player is doing and where (s)he is at any given time is a really big challenge. This is because I would have to check which level the player is playing in addition to all the other logic, and then maybe it'll get messy anyways?

And so i figured out I maybe just should go with my first idea: It seems like making a separate file and class for each level will make it easier to tailor everything so that the game runs smooth and doesn't encounter issues at runtime. The question is whether this would slow down the loading process a lot, or if there are other issues using this method.

Since this is my first large project though, I'm not too sure what is the best thing to do for a 2D game where each level features different objects, enemies, items, audio etc. What is your advice? Thank you for your time.

Btw., I'm programming this in Swift and use SpriteKit.

sentences:
Zelda like multiplayer combat I have in mind coding a multiplayer game with a similar combat to zelda's. Since i will use flash, i'm limited to use TCP. My question is, is this goal possible? It's not as fast-paced as some shooters, but i'm not sure if it's too much for tcp?

tl;dr: TCP for zelda-like multiplayer combat style?

sentences:
What does 'AlwaysResetOnEntry' do, and where would it be used? In Unreal Animation Blueprints, each state has an option for AlwaysResetOnEntry.

The tooltip text for this is:

Whether or not this state will ALWAYS reset its state on reentry, regardless of remaining weight

Question

What does this do, exactly?

Additionally, what is a good example of where this would be used?

sentences:
SharpDX.Toolkit setting constant buffer I am trying to use a constant buffer in a program using SharpDX.Toolkit. I use the Toolkit because it has nice font support for writing on the screen.

The problem I face is in assigning data to the constant buffer.

In the screen below you may see a debug of my code. When it comes to the Draw event the buffer gets empty (obj:9 is active) and in Geometry Shader all values are 0.0f. On event 76 - GSSetShader the obj:16 is active, which contains the data I want to use, non-zero values. I have no idea why it gets overwritten/cleared. I tried assigning or updating buffer in numerous places in the draw method, but none of them helped. For sure it is not a problem of a slot, as in the debug window both (populated and empty) buffers are in slot 0.

NOTE: this way of loading data to constant buffer worked before I switched to using Toolkit, but then the device was explicitly created with SwapChain. I am not so experienced to tell if it may make any difference.

In my effect file I have defined the buffer as

cbuffer ConstantBuffer : register(b0)
{
    float slideX;
    float sinPi075;
    float cosPi075;
    float scaleK;
}

and in the main program

[StructLayout(LayoutKind.Explicit, Size = 16)]
struct GS_CONSTANT_BUF_DATA
{
    [FieldOffset(0)]
    public float slideX;
    [FieldOffset(4)]
    public float sinPi075;
    [FieldOffset(8)]
    public float cosPi075;
    [FieldOffset(12)]
    public float scaleK;
};

followed by

private SharpDX.Direct3D11.Buffer _constantBuffer;
private GS_CONSTANT_BUF_DATA constData;
private int sizeOfconstData;
private SharpDX.Direct3D11.Device _device;
private void InitializeConstantBuffer()
{
    System.Diagnostics.Debug.WriteLine("InitializeConstantBuffer");
    constData = new GS_CONSTANT_BUF_DATA
    {
        slideX = 0.0f,
        sinPi075 = (float)Math.Sin(Math.PI * 0.75),
        cosPi075 = (float)Math.Cos(Math.PI * 0.75),
        scaleK = 0.003f
    };
    _device = (SharpDX.Direct3D11.Device)GraphicsDevice.MainDevice;
    sizeOfconstData = Utilities.SizeOf<GS_CONSTANT_BUF_DATA>();
    _constantBuffer = new SharpDX.Direct3D11.Buffer(
                                       _device
                                     , sizeOfconstData
                                     , ResourceUsage.Default
                                     , BindFlags.ConstantBuffer
                                     , CpuAccessFlags.None
                                     , ResourceOptionFlags.None
                                     , 0);
    _device.ImmediateContext.GeometryShader.SetConstantBuffer(0, _constantBuffer);
    _device.ImmediateContext.UpdateSubresource(ref constData, _constantBuffer);
}

Draw method in the main program

  protected override void Draw(GameTime gameTime)
    {
 GraphicsDevice.Clear(Color.CornflowerBlue);
 for (int i = 0; i < technique.Passes.Count; ++i)
    {
     _device.ImmediateContext.GeometryShader.SetConstantBuffer(0, _constantBuffer);
    _chartGeometry.Draw(
                        GraphicsDevice
                      , SharpDX.Toolkit.Graphics.PrimitiveType.LineList
                      , technique.Passes[i]);
    }
}

And the Draw method associated with _chartGeometry

 public void Draw(GraphicsDevice graphicsDevice, PrimitiveType primitiveType, EffectPass pass)
    {
        if (pass != null)
            pass.Apply();

        // Setup the Vertex Buffer
        graphicsDevice.SetVertexBuffer(0, vertexBuffer);

        // Setup the Vertex Buffer Input layout
        graphicsDevice.SetVertexInputLayout(InputLayout);

        graphicsDevice.Draw(primitiveType, 4, 0);
    }

I have also tried changing buffer to dynamic, and hence, changing UpdateSubresource to Map/Unmap. The result is the same, see creen below, this time obj:16 (has data) and obj:8 (does not).

and while debuging GeometryShader locals show

sentences:
Assertion b2Assert(m_bodyCount > 0) showing an error I have the following code for deleting a Box2D body:

void b2World::DestroyBody(b2Body* b)
{
    b2Assert(m_bodyCount > 0);
    b2Assert(IsLocked() == false);
    if (IsLocked())
    {
        return;
    }

    // Delete the attached joints.
    b2JointEdge* je = b->m_jointList;
    while (je)
    {
        b2JointEdge* je0 = je;
        je = je->next;

        if (m_destructionListener)
        {
            m_destructionListener->SayGoodbye(je0->joint);
        }

        DestroyJoint(je0->joint);

        b->m_jointList = je;
    }
    b->m_jointList = NULL;

    // Delete the attached contacts.
    b2ContactEdge* ce = b->m_contactList;
    while (ce)
    {
        b2ContactEdge* ce0 = ce;
        ce = ce->next;
        m_contactManager.Destroy(ce0->contact);
    }
    b->m_contactList = NULL;

    // Delete the attached fixtures. This destroys broad-phase proxies.
    b2Fixture* f = b->m_fixtureList;
    while (f)
    {
        b2Fixture* f0 = f;
        f = f->m_next;

        if (m_destructionListener)
        {
            m_destructionListener->SayGoodbye(f0);
        }

        f0->DestroyProxies(&m_contactManager.m_broadPhase);
        f0->Destroy(&m_blockAllocator);
        f0->~b2Fixture();
        m_blockAllocator.Free(f0, sizeof(b2Fixture));

        b->m_fixtureList = f;
        b->m_fixtureCount -= 1;
    }
    b->m_fixtureList = NULL;
    b->m_fixtureCount = 0;

    // Remove world body list.
    if (b->m_prev)
    {
        b->m_prev->m_next = b->m_next;
    }

    if (b->m_next)
    {
        b->m_next->m_prev = b->m_prev;
    }

    if (b == m_bodyList)
    {
        m_bodyList = b->m_next;
    }

    --m_bodyCount;
    b->~b2Body();
    m_blockAllocator.Free(b, sizeof(b2Body));
}

When I close the game I get an exception, and the debugger points to the first line :

b2Assert(m_bodyCount>0);

What exactly does this mean?

sentences:
Is it bad practice to for the server to request data for a client from another client? I'm making a collaborative whiteboard app so that when someone is drawing and uses a rectangle for example, a rectangle packet is sent to the server with parameters like x, y, width, height, color and then that packet is sent to everyone else in the room so that a rectangle is drawn on their screen.

So far everything works perfectly and there's also a stack on each client of all the commands thus far for infinite undo and redo. However, there server does not contain this stack because all it has to do is forward commands to clients in the room.

Everything is working perfectly so far and everyone can see everyone else drawing in real time but I'd like to implement a feature where if someone joins a room late they can see the current whiteboard. That is, the entire command stack would have to be sent to someone. However, this data isn't stored on the server, but each client has their own (identical copy).

Would it be bad for when someone joined to have the server ask one of the clients (which? round-robin?) to send his command stack to the server and have the server forward it to the client? My concerns are the delay and teh amount of data being sent in one go (congestion).

What do you all think? Are there any other options?

sentences:
Get Closest point between a Box 3D and a Point I have a point A (x, y, z),
and a Box: Center (x, y, z), Size (Width, Height)

How to get the closest point in the box from the point A ?

In Unity I can create a bound, and I can find the non-rotated position like that:

Bounds bounds = _mesh.bounds;
Vector3 closestPoint = bounds.ClosestPoint(pointA);

But then If the bound is rotated, the result is not correct.
So I have 2 options:

Find the way to rotate my closestPoint from the pivot.
Find the math formula myleft.

If someone can help ! thanks.

EDIT: here a video:
the red point is the one find with bound.ClosestPoint
the yellow point is the one find with:

Vector3 closestPointInverse = _currentTarget.InverseTransformPoint(closestPoint);

https://youtu.be/RMRRtSaJv8w

I have also tryed to do my own rotateFromPivot function:

public Vector3 RotatePointAroundPivot(Vector3 point, Vector3 pivot, Vector3 angles)
    {
        return Quaternion.Euler(angles) * (point - pivot) + pivot;
    }

When I use it, I get the same result with the InverseTransformPoint method.

sentences:
Character bouncing off ground due to gravity Implementing gravity in the game, the character keeps bouncing up and down slightly when he hits the ground, upon debugging the character is essentially bouncing on and off the ground. Not quite sure how to iron out the issue any help here would be greatly appreciated.

The constant value

private float gravity = 0.09f;

adding to the velocity if the character is on the ground

if (!isOnGround)
 velocity.Y += gravity;

adding the characters overall velocity to the overall position.

position += velocity * (float)gameTime.ElapsedGameTime.TotalSeconds;

Part of the collision method which determines if the character is on the ground or not.

for (int y = topTile; y <= bottomTile; ++y)
            {
                for (int x = leftTile; x <= rightTile; ++x)
                {
                    // If this tile is collidable,
                    TileCollision collision = Level.GetCollision(x, y, tileMap);
                    if (collision != TileCollision.Passable)
                    {
                        // Determine collision depth (with direction) and magnitude.
                        Rectangle tileBounds = Level.GetBounds(x, y);
                        Vector2 depth = RectangleExtensions.GetIntersectionDepth(bounds, tileBounds);
                        float elapsed = (float)gameTime.ElapsedGameTime.TotalSeconds;

                        if (depth != Vector2.Zero)
                        {
                            float absDepthX = Math.Abs(depth.X);
                            float absDepthY = Math.Abs(depth.Y);

                            // Resolve the collision along the shallow axis.
                            if (absDepthY <= absDepthX || collision == TileCollision.Platform)
                            {
                                // If we crossed the top of a tile, we are on the ground.
                                if (previousBottom <= tileBounds.Top)
                                    isOnGround = true;

sentences:
2D Rope Collision Detection I'm wanting to create a rope that can collide with objects like in the following youtube video:

2D Game Physics Rope

I'm thinking that you implement the verlet integration which uses points and connects these points with lines. I'm trying to figure out what type of collision detection you would apply to the rope to get the effect in the video.

I'm thinking you would have to do some cd to each point. I would like to use box2D, so I'm wondering would making each point a rigid body work? Any advice would be appreciated.

sentences:
Numeric problem with ray transformation I am performing ray triangle intersection by transforming the ray into the object space for efficiency. I am using the same technique from this question (The correct way to transform a ray with a matrix?).

My question has to do with the numeric stability of the transformed ray. This is my code

Matrix4f matModel= this->getWorldTransform();
Matrix4f matModelInverted = matModel.Inverted();
Matrix4f matInverseNormal = matModel.Transposed();

rayOrigin = matModelInverted.Transform(rayOrigin);
rayDirection = matInverseNormal.Transform(rayDirection).Normalized();

matModel is the Object-to-World transform and it is a very simple translation matrix with this value

| 1 0 0 -4 |
| 0 1 0 -15|
| 0 0 1 -13|
| 0 0 0  1 |

matInverseNormal is the transposed inverse of the matrix used to transform the ray origin and has the value

| 1  0   0  0|
| 0  1   0  0|
| 0  0   1  0|
|-4 -15 -13 1|

My code works as it should most of the time, the problem appears around certain value where the transformed ray direction behaves erratically and the ray flip flops by as much as 180 degrees for very small changes in the input.

For input ray direction {-0.59531, 0.64250, -0.48249} I get a transformed direction {-0.59531, 0.64250, -0.48249} which is visually the correct behavior. Perturbing the values of the input ray direction to {-0.59520 0.64320 -0.48169} (a change of about 10e-3 magnitude) gets me {0.59520, -0.64320, 0.48169}, which has flipped signs on all axes and is visually the incorrect behavior.

What am I doing wrong?

sentences:
Javascript: Eventlistener 'keydown' not registering all keys pressed when holding down other keys Sollution provided in the comments. The issue is that my keyboard has what is called ghosting issues, this means it doesn't support some key combinations when pressed together.

When the user holds 's' and 'd' key at the same time (movement keys, so character would move south-east), and during this presses the 'n' or 'm' key, the keydown event of the 'n' and 'm' key is not triggered. This happens with other key combinations as well, but not with all. Per example: holding down the 'w' and 'a' key will trigger the 'n' and 'm' keydown events. Is there a way to allow any keydown event to be triggered, regardless of other keys pressed? You can test this behavior using the following code:

document.addEventListener('keydown', (e) => {
    console.log(e.key);
});

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:
Jumping onto higher ground Collider issues What's the general solution to the following character animation problem (I'm using Unity)?

You have a character with a capsule collider and a jump animation that allows you to jump onto higher ground (such s boxes, etc.). The character shouldn't be able to jump unrealistically high so she goes into a crouched posture while in the air and the collider is scaled accordingly in an animation curve.

However when the character jumps onto the box to land, the character animation (and collider) want to extend back to wards the ground but there is not enough space and either collision detection fails and the character falls into the geometry or the collider starts a collision fight with the box and keeps bumping up and down, keeping the character in an airborne state.

Please see screenshots to get a better idea...

What would be a good way to work around this problem?

sentences:
Unity Optimization: Creating Multiple Similar Scenes Effectively I've been working on a mobile game that uses the same framework for each level in the game, and I was wondering what would be the most efficient way to store all those levels in Unity. Should I only use one scene and save all the level data somewhere in the filesystem so that each level can be loaded on demand? Or, should each level have its own scene in Unity? Or is there another, more efficient way to do this?

I just worry that creating multiple scenes with nearly identical assets will take up far too much memory and space on someone's device for such a simple game, but I can't figure out a better way to do it. Any ideas?

sentences:
Rotate to a set degree then stop Unity I'm trying to make an object rotate up on the Y axis 90 degrees, then stop. I've got the rotating up bit working fine, it's getting it to stop once it hits 90.

Some of the things I've tried include the following:

float i = rotateSpeed * Time.deltaTime;
while ( x != 90 )
        {
        transform.Rotate( i, 0, 0);
        }

        int x = 0;
x++;

        if( x == 90 )
        {
            transform.Rotate( 0, 0, 0 );
        }

For some reason I can't get this simple thing to work. What am I missing / not doing?

sentences:
Player's camera, how to obtain smooth movement In a 2D platformer, I have a player that can move both horizontally and vertically. I also have a camera that moves in relation to player. In every update I do this:

public void RepositionCamera()
{
   // For the example I don't consider world rectangle bounds
   current_camera.Position =
      new Vector2(
         player_.Position.X - 250,
         player_.Position.Y - 100));
}

The problem here is that when I press very rapidly "left-right-left-rigth..." the camera does a very annoying effect, it seems an eartquake.

I think this is due to the strict relation to player's position and camera's position.
This is just an example, it is annoying also when climbing onto stairs because every step I force the player's Y up to the step height, so the camera does the same thing!

How can I solve this? How can I edit my RepositionCamera() to be less strict about moving itself?

sentences:
How to replace texture maps on models in a packaged game? I'm trying to do an experiment. I'd like to do some object masking to the assets inside of a game, so during run time, when you are playing, they're texture maps are replaced by the masks.

The masks will literally be just color maps. They are supposed to be labels for a machine learning program.

Preferably if one could replace the texture maps with color masks during runtime that would be better.

sentences:
Deferred decals normal problem I've been working on a deferred decal system. So far I have finished the projection part, meaning I can click something in the scene and it will properly project a decal onto the surface of the object.

There are a couple other things I wish to add to this system: normal clipping and normal mapped decals. Normal clipping is when I discard fragments that are stretched across a sharp angle. Seen here. A way to solve this is to  discard fragments that have a large difference between the normal in the G-Buffer and the decal's normal. This would require reading the G-buffer's normal texture.

In order to do decal normal mapping, I need to blend the decal's normal (from a normal map) with the G-buffer's normal. The requires writing to the G-buffer's normal texture.

I hope it's clear that in order to support these two features, I need to read and write to the normal texture in the same shader pass. Sadly, this is undefined behavior, so I'm wondering if there is some other way to implement these features.

sentences:
Rigidbody has unintended effect, velocity limiter from unknown source I have made a script that alters a rigidbody's angular velocity. It works well but has one issue, its speed plateaus past a certain point.

Here is the script:

    void Start(){
    //Get references.
    bat = transform.GetChild (0).gameObject;
    rig = bat.GetComponent<Rigidbody> ();
    //Initialize variables.
    initPos = bat.transform.position;

    initAngle = bat.transform.rotation.eulerAngles.y;
    if (leftSide) {
        maxAngle = bat.transform.rotation.eulerAngles.y - 45;
        rig.centerOfMass = bat.transform.localPosition;
    } else {
        maxAngle = bat.transform.rotation.eulerAngles.y + 45;
        rig.centerOfMass = -bat.transform.localPosition;
    }
}

void Update(){
    if(leftSide){ // True and false does the same but mirrored effect.
        if(Input.GetButton ("Left Bat")){// button pressed?
            if(bat.transform.rotation.eulerAngles.y > maxAngle){//lower than max angle?(since this is the mirrored version, its rot starts at 180 and turns CCW, thus the '>')
                currAngle = -1 * turnSpeed; // then allow turning
            } else {// otherwise
                currAngle = 0f; //prevent further turning
            }
        } else {// button not pressed?
            if(bat.transform.rotation.eulerAngles.y < initAngle){// greater than resting angle?(same reason as above explanation)
                currAngle = 1 * turnSpeed; // then automatically return
            } else {//otherwise
                currAngle = 0f; //stop returning
                bat.transform.rotation = Quaternion.Euler (new Vector3 (bat.transform.rotation.eulerAngles.x, initAngle, bat.transform.rotation.eulerAngles.z));// this statement re-aligns the rotation of the flipper its initial state(instantly) to prevent slight kinks due to inconsistencies.
                bat.transform.position = initPos;//turning the flipper for some reason can deviate its own position(slight but cumulative), this returns the flipper to its initial position.
            }
        }
    } else { // default version.
        if(Input.GetButton ("Right Bat")){
            if(bat.transform.rotation.eulerAngles.y < maxAngle){
                currAngle = 1 * turnSpeed;
            } else {
                currAngle = 0f;
            }
        } else {
            if(bat.transform.rotation.eulerAngles.y > initAngle){
                currAngle = -1 * turnSpeed;
            } else {
                currAngle = 0f;
                bat.transform.rotation = Quaternion.Euler (new Vector3 (bat.transform.rotation.eulerAngles.x, initAngle, bat.transform.rotation.eulerAngles.z));
                bat.transform.position = initPos;
            }
        }
    }
}

void FixedUpdate(){// rigidbodies should be processed in fixedupdate I think
    rig.angularVelocity = new Vector3( 0, currAngle, 0);
}

The issue is, no matter how high a value I enter for the movement part, it doesn't get faster than a specific speed. I tried hardcoding a value instead of changing the variable but it didn't make a difference. If I enter a small value, the movement is slower though.

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:
C++: from LWJGL to C++ with OpenGL I've been trying my best on porting my 3D game from Java to C++, but to no avail.
I use only LWJGL with OpenGL but I cannot find any other library in C++ that supports as much as LWJGL does for Java. Especially on the math part.

For instance.
I'm trying to port this TransformationMatrix maker to C++.

public static Matrix4f createTransformMatrix(Vector3f translation, float rx, float ry, float rz, float scale){

    Matrix4f newMatrix = new Matrix4f();
    newMatrix.setIdentity();
    Matrix4f.translate(translation, newMatrix, newMatrix);
    Matrix4f.rotate((float) Math.toRadians(rx), new Vector3f(1,0,0), newMatrix, newMatrix);
    Matrix4f.rotate((float) Math.toRadians(ry), new Vector3f(0,1,0), newMatrix, newMatrix);
    Matrix4f.rotate((float) Math.toRadians(rz), new Vector3f(0,0,1), newMatrix, newMatrix);
    Matrix4f.scale(new Vector3f(scale,scale,scale), newMatrix, newMatrix);

    return newMatrix;
}

I've tried using Eigen and GLM, but none of them work the same like LWJGL.
Now I wouldn't mind this, but the lack of actual 3D tutorials on OpenGL in C++ is just abysmal.

Any tips or help with even converting this piece of code would be greatly appreciated.

sentences: Unity3d simple material color display correctly in windows built but yellow color turns to blue in android build? I have a simple roll a ball game as shown in unity 3d tutorials, and I have set the wall color as a shade of yellow using the standard shader and material. This runs flawlessly in windows application, however when running in android phone( Nexus 5 MM) the wall turns into a blue color. Can anyone tell me how to fix it?

sentences:
Generate a wave noise map How can we generate the wave-like texture like this

The author(RujiK) says in reply he used the texture generator(http://www.kitfox.com/projects/perlinNoiseMaker/index.html), but no matter how I tweak the parameters, it looks quite different from the original version

sentences:
Google Analytics collect and visualize custom data I was wondering if Google Analytics (GA) can be used to collect custom metadata about app usage and performance.

An example would be to measure and collect the average frame rate (fps) of the app on the device. How can this data be presented into the Google Analytics Report? If possible, please make an example by sample source code.

sentences:
Efficient Bullet Firing Class I've been struggling with this for a while. I have been trying to create a bullet pool class for a game I have made that doesn't cause a significant fps drop.

I have tried creating a bullet pool and have also tried dynamically creating and deleting bullets, both of which drop the fps of the game around 10-15.

I ran a test a few days ago and just put a return statement in the bullet pool's firebullet function, which represented the logic leading up to this, function calling, etc.

This only dropped the fps 2-4. If I can fire bullets without dropping the fps more than another 2-3, I would be satisfied. My bullets are autorelease objects that are a subclass of a ccnode.

I create a ccsprite and a box2d b2body for each one. I am working on the ios platform. Any thoughts on how to make this more efficient? Has anyone managed to do something similar to this?

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:
Detecting mouse clicks in Unity UI Beta I want my game script to detect mouse clicks everywhere on my screen, except one corner where I have a pair of buttons to control the sound and will be handled separately. To help identify this corner, I've created a soundPanel object with the Rect Transform component (available in the Unity 4 Beta 17+) and have sized/positioned it appropriately in the editor in my UI layer.

In my game's script, I have passed in this corner object, and tried using it in the following way:

bool tap = (Input.GetMouseButtonDown(0) || Input.GetMouseButtonUp(0))
           && !soundPanel.rect.Contains(Input.mousePosition);

Clicking in the soundPanel still triggers a tap. I figured this is because the mouse position and soundPanel.Rect are not in the same coordinate space. Since the documentation on the new Unity Beta UI is a bit lacking / hard to find, I tried converting the mouse coordinates to everything I could:

if (Input.GetMouseButtonDown(0) || Input.GetMouseButtonUp(0))
{
    if (soundPanel.rect.Contains(Input.mousePosition)) { print("Raw"); }
    if (soundPanel.rect.Contains(camera.ScreenToViewportPoint(Input.mousePosition))) { print("ScreenToViewportPoint"); }
    if (soundPanel.rect.Contains(camera.ScreenToWorldPoint(Input.mousePosition))) { print("ScreenToWorldPoint"); }
    if (soundPanel.rect.Contains(camera.ViewportToScreenPoint(Input.mousePosition))) { print("ViewportToScreenPoint"); }
    if (soundPanel.rect.Contains(camera.ViewportToWorldPoint(Input.mousePosition))) { print("ViewportToWorldPoint"); }
    if (soundPanel.rect.Contains(camera.WorldToScreenPoint(Input.mousePosition))) { print("WorldToScreenPoint"); }
    if (soundPanel.rect.Contains(camera.WorldToViewportPoint(Input.mousePosition))) { print("WorldToViewportPoint"); }
    print("-------------------");
}

When I click with the above code, "ScreenToViewportPoint" and "ScreenToWorldPoint" print no matter where I click, and no others trigger. I suspect I need to transform the soundPanel somehow.

Here is the Hierarchy, Scene, and Inspector. The selected rect is the soundPanel, and it is in the bottom-right of the UI Canvas:

sentences:
How detect collision between two bodies? I'm using LibGDX with Box2D and I've two bodies. I just need to know that they have collided.

So, I just need a boolean output.

Example:

if (bodyA.collision(bodyB) == true) {
   // Do something
}

How can I do this?

If it is too complicated, can I detect if two PolygonShape intersect?

sentences:
Interpolating between positions unfeasible at 30 frames per second? I am working on a 3D platformer in Unity and I am targeting Android devices. The game consists of a lot of objects smoothly interpolating from the bottom of the screen to the top.

This whole time I've been testing my game at 60 fps and the performance was quite good. However, when I tested the game at 30 fps, the interpolation of the objects was no longer smooth.

I initially thought that I have way too many objects in my scene and this might be affecting the interpolating performance. So I created a new project which only has the interpolation stuff and object pooling (you can download it here). But even then, the interpolation wasn't smooth at 30 fps. Here's the code I'm using for interpolating the object:

void FixedUpdate()
{
   rb.MovePosition(transform.position + transform.up * Time.fixedDeltaTime * speed);
}

I'm using the object's Rigidbody to interpolate it. I've already set the rigidbody to "Interpolate" and I turned on "isKinematic".

I first thought that the interpolation isn't smooth since I'm using Rigidbody. So I ditched the rigidbody and used transform.Translate instead. But even then the interpolation wasn't smooth. Next I tried Vector3.Lerp. Nope. That didn't work either. The stutter was still there. I even tried Vector3.MoveTowards. That didn't work. The interpolating was still laggy. I even tried turning on GPU instancing for the objects being interpolated (since they all use the same material). That didn't do it either.

Next I started playing around with the fixed timestep (in the Time settings). I thought that maybe if I set the timestep to 0.033, then the objects will interpolate smoothly at 30 fps. But that didn't work either.

I think it's really bizarre that a simple interpolation performs so poorly at 30 fps on an Android device. If the interpolation is only for a short distance, then you don't always notice the stutter. But like I said, in my game the objects have to interpolate from the bottom of the screen all the way to the top. In this case, you can clearly see the laggy movement during interpolation.

Is it possible that long distance interpolation is simply unfeasible for Android devices at 30 fps? How do so many Android game developers manage to achieve good performance at 30 fps? Feel free to download the new project I mentioned which only has the interpolation stuff and the object pooling. It is available here. It's a very simple projects. It only has the prefab that should be interpolated, the material for the prefab, the script for interpolating the prefab, the spawning and object pooling system (for spawning the prefab), and the script for setting frame rate to 30. That's it.

Below a gif of the objects' interpolation. It's not as shaky in reality (since I had to use a bad screen recorder and compress the gif) but it's still pretty close to how the objects move at 30 fps.

sentences:
How can I improve my touch slide mechanic to be more smooth and fluid? I have the following C# code, but it leaves me with two problems:

void FixedUpdate()
{
    if (Input.touchCount == 1)
    {
        this.transform.Translate(Input.touches[0].deltaPosition.x * 0.009f, 0, 0);
    }
}

Firstly, the gameobject (which is a sphere in my case), has a tendency to leave the ground and fly into the air. Additionally, it is not as smooth and snappy but fluid as I would like it to be.

If you look at some of the following gameplay videos, you will see the kind of movement I am looking for.

"Splashy!" Gameplay
"Sky Ball" Gameplay
"Balls Race" Gameplay

More specifically, from actually playing each of the above games, there is a certain "ratio" that seems to be operating in regards to each swipe gesture and the actual movement of the ball. That is, the ball does not go exactly where the finger goes, for it is slightly ahead, if that makes sense. What I mean is, the device is only so wide, yet for that width, the ball can always reach it's required destination on either end of the horizontal axis. This must mean that for every pixel the finger moves, the ball moves a little bit more to fit that pixel density of the screen. In other words, in the case of "Splashy!", it's clear that even if the finger moves the entire distance across the screen, the ball moves more than double that distance.

By "smooth", "fluid", and "snappy", I mean that the swiping gesture is very responsive. It moves where you want it to and does not over or undershoot. Additionally, the "snappy" effect is present when you stop swiping. The ball seems to "snap" into it's end position.

My question, then, is what is the best way to improve my script as to achieve the polished mechanic I am looking for, as is depicted in the above videos? Also, how can I keep the sphere on the ground without constraining any axes on the rigidbody? I am using Unity3D with C#.

I would appreciate any help you could provide. Thank you.

sentences:
How do I choose the scaling factor of a 3D game world? I am making a 3D tank game prototype with some physics simulation, am using C++. One of the decisions I need to make is the scale of the game world in relation to reality. For example, I could consider 1 in-game unit of measurement to correspond to 1 meter in reality. This feels intuitive, but I feel like I might be missing something.

I can think of the following as potential problems:

3D modelling program compatibility. (?)
Numerical accuracy. (Does this matter?) Especially at large scales, how games like Battlefield have huge maps: How don't they lose numerical accuracy if they use 1:1 mapping with real world scale, since floating point representation tend to lose more precision with larger numbers (e.g. with ray casting, physics simulation)?
Gameplay. I don't want the movement of units to feel slow or fast while using almost real world values like -9.8 m/s^2 for gravity. (This might be subjective.)
Is it ok to scale up/down imported assets or it's best fit with a world with its original scale?
Rendering performance. Are large meshes with the same vertex count slower to render?

I'm wondering if I should split this into multiple questions...

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:
Unable to rotate GameObject properly? My GameObject is able to jump towards a moving target (another GameObject), thus adjusting its trajectory - while simulating gravity (as in the .gif).

I want to make the "jumper object" rotate. But I am unable to rotate my GameObject properly. When the GameObject jumps, it doesn't complete its rotation and rotates abruptely. How can I fix this? How can I properly rotate the cube GameObject you see in the .gif? Any fixes are appreciated.

Wanted rotation:

What I get:

sentences:
MonoGame: Draw thousands of quads without hardware instancing In my game, every bit of geometry is a textured quad billboard in 3D. I have many thousands of these things on screen at once, sometimes with overdraw. As I understand it, there are a few ways  I can go about drawing these:

Have a single VBO per type of quad (ie, unique set of texture coords). Batch the VBO and texture, but make multiple draw calls. Looks something like this:

foreach (Quad quad in quadTypes)
{
    // The VBO just contains 4-6 vertices.
    GraphicsDevice.SetVertexBuffer(quad._vertexBuffer);
    Shader.SetTexture(quad._texture);

    // Draw each instance using multiple draw calls
    foreach(QuadInstance instance in quad._instances)
    {
       Shader.SetWorldMatrix(instance._worldMatrix);

       foreach(ShaderPass pass in Shader._passes)
       {
           pass.Apply();
           GraphicsDevice.DrawPrimitive(TRIANGLES);
       }
    }
}

Make a single draw call by somehow combining all the triangles of all the instances of a quad type. Looks something like this:

foreach (Quad quad in quadTypes)
{
    Shader.SetTexture(quad._texture);
    // Probably can cache a vertex buffer for when quads are created/destroyed instead.
    VertexBuffer vertexBuffer = new VertexBuffer();

    foreach(QuadInstance instance in quad._instances)
    {
       // Add all of the (world transformed) triangles of this instance to
       // the vertex buffer
       vertexBuffer.AddAll(instance.CreateTriangles());
    }

    // Draw all the quads with a single draw call and vertex buffer.
    GraphicsDevice.SetVertexBuffer(vertexBuffer);

    foreach(ShaderPass pass in Shader._passes)
    {
        pass.Apply();
        GraphicsDevice.DrawPrimitive(TRIANGLES);
    }
}

True hardware instancing. This is currently how I do it in my (XNA HiDef profile) game, but I can't figure out a way to get it to work in Monogame. With true hardware instancing, each instance is represented as a vertex, and the GPU creates all the necessary duplicate vertices in a single draw call.

In general, which one of these is most desirable? 1) makes many draw calls, but saves the most memory. 2) has a single draw call, but requires creating a vertex buffer for all of the instances, which seems really inefficient, and 3) has the best of both worlds but is not widely supported. Is there a fourth way that I'm missing?

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:
Uploading APK build to Google Play Console error "You uploaded a debuggable APK or Android App Bundle" I was trying to upload my andoid app apk build to my play console account and I keep getting this error:

You uploaded a debuggable APK or Android App Bundle. For security reasons you need to disable debugging before it can be published in Google Play.

In accordance with the informations given at

https://developer.android.com/studio/publish/preparing.html#publishing-configure

and

https://answers.unity.com/questions/1653647/you-uploaded-a-debuggable-apk-or-android-app-bundl.html

Here are what I have done so far:

1) I have gone to the root folder of my unity project, searched for AndroidManifest.xml, and I found multiple Manifest files, and changed the value of "android:debuggable" to false for each of these manifest files that were generated by unity(and I did not edit the google generated manifest files).

2) I have scanned every c# file on my project that contains the keyword "Debug" and I have either deleted or commented out the Debug.log lines except on the files generated by google(as a result of the integration of google play services into my game).

And yet, I still have the same problem when I try to upload my apk to play console. What else am I missing? Should I also remove the Debug.log lines from google generated c# script files?

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:
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:
C++ Independent Objects? before I started C++ I digged around in ActionScript3 for a while.
The first thing I've noticed is that you apparently have to call all your objects/game-characters individually and tell them to update() for example.

My first thought was to sort them into arrays/vectors and do for-loops for efficiency since I don't know about C++ events yet but I'm curious what you guys are doing!

Can you use Recursive functions inside the class to make it work independently?

Let's say I'd want to animate a tree with a spritesheet.
Would I have to call the tree's update() every frame or can I tell the object to get stuck in a Recursive loop and handle the animations itself?

sentences:
Why is Raycast hitting masked layer? Many questions have been posted on this topic but I'm facing a weird behavior which I could not find an explaination for.

I perform a raycast giving it a LayerMask parameter which is defined as public variable and set in the inspector with thick on layer "Wall" and "Enemy".

At first glance it appeared to work fine because raycast rightly stops  on GameObjects with that layer.

But then I saw that it stopped also on GameObjects with default layer, like if the LayerMask was ignored. Is there something I'm missing?

According to this answer I set up everything correctly and I expected it to work fine.

Looking at the inspector at Runtime I can clearly see that my mask is set only to "Wall" and "Enemy", and that the GameObject the collider is attached to has default layer set. I'm then stating that the mask the way I'm using it does not exclude other layers. The only way I found to have this working is by setting that GameObject layer to Ignore Raycast but in this case the LayerMask is not necessary.

I'm calling the function this way:

RaycastHit2D inSight = Physics2D.Raycast(start, end, lm);

Maybe is there something different using Physics2D?
I would really enjoy touse LayerMasks instead of giving specifically Ignore Raycast to whatever I want to ignore. Any clue?

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:
Different screen sizes? I have looked through all of the android docs and many stack overflow questions, and I have a question on supporting multiple screen sizes. If I have some drawables, I know I need to put them in folders like these:

But does android make these folders for me? When I try copy and pasting my images into the drawable folder, I get something like this:

With no directory names. So do I have to manually make those directories, and then will android automatically pick the right image to use depending on the screen size?

I have the same question for the layout. For example, I know that to support many screen sizes, I need to put the layout in many folders like this:

But right now, my layout is like this:

So must I manually create each layout folder, and then copy and paste my current layout into the new layout folder, and then go into each layout, and render it until it looks nice on the android design tab of the XML? Then, will android pick out the best layout depending on the screen size for me?

Thanks so much,

I have been delaying making my app compatible in different layouts because of these questions, I hope they can get answered!

sentences:
How to move around in a map and remember position? I am working on sound labyrinth game. My game is about a person getting trapped in the basement and the only way to navigate and get out is through sound. I have created a map over the basement and for each square there has to be a sound.

The player starts in b5 with an intro sound and then has to move forward using the arrow keys. I've created this bit of code that plays a sound when forward arrow (keycode === 38) is pressed:

var thriller=new Audio("thriller.mp3");

document.addEventListener('keydown',
function (background) {
    if (background.keyCode === 38){
        thriller.play();
    }
}, false);

My question is:

How does the code know in which square the player is situated? Is there some smart way in which I can systematize the squares and the sounds they represent?

sentences:
Should I avoid rescaling models when rendering? I am quite new to game development and currently developing a simple 3D game with MonoGame and Blender. The game is basically a 3D version of Pong.

At first I developed the models at a constant size (e.g. a sphere with radius = 1) and then added a scale when I rendered it to make it proportionate to the other objects within the world. That way it was easy for me to play around and find good sizes for the objects without having to go back to Blender.

However, when I started to work on collision detection, I realized that it now was a lot harder to figure out how large the object is, because I had to manually recalculate the size of the object in the game world according to the scale factors I used. I could not simply look at the model and take the size values from there.

While the calculations might have been rather easy with a simple sphere, it got trickier when I had models I scaled differently in different dimensions. For example I rescaled a cube to be 10 times longer than high.

Pretty much the same problem with rotation.

How is this usually done in projects? Is it better to create the model already in the final size in Blender, so you don't have to keep track of the objects size within your code? Or is it ok to scale the model in code? If yes, how do you keep track of the changes?

sentences: Can a set of 3D positions be separated by plane? I have 3 points in 3D space: A, B and C. I also have another set of 3D points: P, Q, R, S, T and U. What would be the simplest algorithm to figure out if there exists a plane that completely separates the first and second set? I know all the coordinates of all points.

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:
Single or multiple inheritance for game world objects So I am currently laying out on paper the system I want to code for a game in C++.

Now currently I am debating whether to have e.g. a class object_door that inherits from another class object_interactive, which inturn inherits from the base class object

OR

have a class object_door that inherits from both the class object and another base class interactive.

Is there any advantage to either way of doing inheritance? Or is there maybe a commonplace convention for this?

sentences:
Textures created with Photoshop show up with a white border All of a sudden, I started having this problem. I've used libGDX + Photoshop before and never had this problem. One of my textures is showing up with a white border/glow around.

The texture is the black blob on the middle, which is a 256 pixels png with a few black brushstrokes I created with Photoshop, just to test it.

Everything in libGDX is on default. I haven't changed the blending function, I'm just using a SpriteBatch to render the image without any changes.

The weird thing is, some other textures I created with Photoshop, same size, RBG 8 bit color mode (just like my blob image), look fine. These are temporary textures I created by downloading a png from the web, pasting it into Photoshop, applying a solid color overlay effect to it and saving it back as a png.

Any idea what's causing this?

Edit: Here's how I'm loading my textures:

private static Texture createTexture(String fileName, boolean maxQuality, Texture.TextureWrap textureWrap) {
    Texture result = new Texture(Gdx.files.internal(fileName), true);
    result.setFilter(maxQuality ? Texture.TextureFilter.MipMapLinearLinear : Texture.TextureFilter.MipMapLinearNearest, Texture.TextureFilter.Linear); // TODO: Are these the best?
    if(textureWrap != null)
        result.setWrap(textureWrap, textureWrap);
    return result;
}

texture = new TextureRegion(createTexture("data/blob.png"));

I just found out using this technique that the transparent pixels in my texture are white (1, 1, 1, 0). So I'm pretty sure the cause is a combination of this, the linear resizing and probably the blending function. Not sure what's the right way to fix it though. Don't want to change the resizing to nearest.

sentences:
Unity 3d 4.6b New GUI system doesn't take touch when already a touch event is occurring in 3d scene I know this is beta version but..

I have a Canvas->Button which works fine when I tap it normally.

I have a joystick in my scene which is drawn by separate camera other than mainCamera.

now, while i am operating joystick without leaving it, if I tap on he Canvas->Button - it does not respond. When I lift finger from joystick and tap on it, it works fine.
Same goes for another Canvas->Toggle control.

It has something to do with the layering or anything else...I'm not sure?

sentences:
Elements of a widget blueprint do not appear if I click on simulate I made a widget that contains 2 minimaps and 2 texts related to a character's variables.

When I click the play button (Selected Viewport) everything happens fine:

Focus where I circled in pink.

It turns out that when I click the Simulate button, these two texts do not appear, but the minimaps do:

I did a test by first clicking the play button (Selected Viewport) and then I ejected the character (which for me is the same thing as simulating, except without closing and opening the game) and the texts appeared, so my problem is only when I'm done start simulating.

I would like to know how to make these 2 texts appear even if I click on simulate instead of play.

sentences:
Unity-Help with RaycastHit2D.hit.normal I'm working on a little pong clone and trying to implement collisions using triggers.

I have a ball which OnTriggerEnter sends out a raycast from the ball's position towards its velocity. I then take the .normal of the raycast hit and use that to figure out bounce angle.

most of the time this is working, but in a few cases (I can't quite figure out the common element between them) It doesn't work and gives a completely wrong number.

Video example, https://webmshare.com/xAe7X

Full code,

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

public class BallScript : MonoBehaviour {
    public Vector2 velocity;
    public float angularVelocity;
    private Vector2 collisionNormal;

    void FixedUpdate(){
        transform.Translate (velocity.x, velocity.y, 0);
        Debug.DrawRay ((Vector2)transform.position - velocity * 2, velocity * 5,Color.red);
    }

    void OnTriggerEnter2D(Collider2D other) {
        FindCollisionNormal ();
        ReflectVelocity ();
    }

    public void FindCollisionNormal(){
        RaycastHit2D[] hits = Physics2D.RaycastAll ( (Vector2)transform.position - velocity * 2, velocity * 5);
        foreach (RaycastHit2D hit in hits) {
            if (hit.collider.GetType () == typeof(BoxCollider2D)) {
                collisionNormal = hit.normal;
                collisionNormal = new Vector2 (collisionNormal.y, collisionNormal.x);
            }
        }
    }

    public void ReflectVelocity(){
        print (collisionNormal);
        velocity = -velocity + 2 * (Vector2.Dot (velocity, collisionNormal) * collisionNormal);
    }
}

sentences:
Unstable sampled color in GLSL shader It looks like that sampling the same exact color data from different areas of a texture atlas results in different vec4 in the GLSL fragment shader.

In other words, texture2D is directly dependent of the specified texture coordinates, and not only transitively because of the color of the texel at those coordinates.

To say that with an example, I am getting the impression that sampling a red pixel surrounded by blue pixels from, say, (0.1, 0.2) may give a different result than sampling the same shade of red surrounded by the same shade of blue at, say, (0.7, 0.3).

Is this non-deterministic behavior that I am observing likely to be real?

Additional details

I have a atlas that we use to texture multiple screen-aligned quads. Each vertex has a xy position and uv texture coordinates. The allotted rectangles in the atlas do not overlap; furthermore, a 2 pixel margin exists between adjacent rectangles. We are using linear filtering and no mipmapping.

The atlas is populated dynamically using sprites downloaded from the web. Two different runs of the program may have the atlas populated in different orders, even if user input is exactly the same, due to the fact that some HTTP requests may complete before others.

So now imagine that on a run we have a Princess Peach sprite in the middle of the screen; the texture is coming from the upper left corner of the atlas, because Princess Peach was the first sprite added to the scene.

In another run, there have been a few sprites loaded but now their quads are not on the screen and again we have Princess Peach in the middle, in the same exact position as the first run. But this time the texture is coming from a different region of the atlas.

Problem: rendered images are not the same. The differences are imperceptible and usually consist of only a few pixels near the edges of the rendered sprites. The differences are detected by a screenshot testing framework. Where is the source of randomness?

Even more details

It's a WebGL project.
It happens on both GeForce and Quadro cards.
Using nearest neighbor sampling leads to more stable (and ugly) renderings but it does not fully eliminate the problem.
Enforcing a strict order when copying the sprites to the atlas fully solves the problem, but it is not an acceptable solution.
I inspected the GL state using an inspector and I found two frames that should have been the same in two different runs of the program; the state is the same in both cases, the only difference being a different arrangement of sprites in the atlas, and consequently different texture coordinates in the array buffer.
I know that I could test using some sort of fuzzy/thresholded comparison but first I would like to rule out bugs on my side.

sentences:
How do I design a game framework for fast reaction to user input? I've played some games at cca 30 fps and some of them had low reaction time - cca 0.1sec. I hadn't knew why.

Now when I'm designing my framework for crossplatform game, I know why. Probably they've been preparing new frame during rendering the previous.

RENDER  1 | RENDER  2 | RENDER  3 | RENDER  4
PREPARE 2 | PREPARE 3 | PREPARE 4 | PREPARE 5

I see first frame when second frame is being rendered and third frame being prepared. If I react in that time to 1st frame it will result in forth frame. So it takes 3/FPS seconds to appear results. In 30 fps it would be 100ms, what is quite bad.

So i'm wondering what should I design my framework to response to user interaction quickly?

sentences:
Detecting a Collision Between Two Bodies Undergoing Multiple Transformations I have been searching for an answer to this for a really long time and I have not found any definitive answers as of yet.  What I am trying to do is determine if and when two bodies collided between the times t0 and t1.  Calculating this is much more straight forward if each body is only either translating or rotating (about center or any point), but when adding multiple transformations on top of each other, things become a bit more messy.  I made this animation to illustrate the problem.

As you can see, at times t0 and t1 there are no collisions, but between there are multiple collisions occurring.

One way I thought of for tackling this problem was to reduce the size of the time intervals.  So, between t0 and t1 there would be a total of n updates to check for collisions.  This works, but the only way I found that I could guarantee no false negatives, i.e. not finding a collision that happened, was to integrate over extremely small time-steps.  As you can imagine, this is very costly because it resulted in the tens to hundreds of time-steps per body per update cycle.  I am not saying this idea has no merit (it makes calculating the collision response much easier since I know the exact points of contact), but I would need to find a way to calculate the minimum number of time-steps rather than uniformly moving each body forward one unit of distance/rotation until they reach the desired position and orientation.

So, my question is two parts:

Is there a better way of determining if and when a collision occurs?
If not, is it possible to calculate the minimum number of time-steps?

P.S.

I think the maximum translation per time-step can be the shortest distance between any two points in the body.  This would not allow it to hop over anything.  When it comes to rotation about the center or orbiting a point I do not know how to determine the minimum angle.  It probably has to do with the arc length, but what should that maximum distance be?

EDIT: this is not right. For a triangle, the base would be the shortest distance between two of its points, but the top could pass through something that is less wide than the triangle base.

sentences:
how to get width and height of TiledMap in the latest Version of Libgdx I am making a tiled based game, I want not to let the camera show places, where there is no map... this is a obvious solution I got from a tutorial

if(camera.position.x<400){
    camera.position.x=400;
}else if(camera.position.x>map.width*map.tileWidth-400){
    camera.position.x=map.width*map.tileWidth-400;
}

if(camera.position.y<240){
    camera.position.y=240;
}else if(camera.position.y>map.height*map.tileHeight-240){
    camera.position.y=map.height*map.tileHeight-240;
}

camera.update();

but I don't know how to get width & height of the tiledMap in the latest version of libgdx

https://github.com/libgdx/libgdx/blob/master/gdx/src/com/badlogic/gdx/maps/tiled/TiledMap.java

Seems strange... I even tried the Super classes but couldn't find. Please help.

sentences:
What to use if you want a looping list? No, I'm not talking about foreach. I have the following list:

public List<float> angles = new List<float>(new float[] { 0, 90, 180, 270 });

This list can vary depending on the object I use, having only 0 and 90 or all except 270 for example.

What I want to do is have a rotClockwise and rotCounterClockwise function that grabs the value before or after a given value. Here's some pseudo code:

function float rotClockwise(angle) {
    return angles.grabNextAngle(angle);
}

function float rotCounterClockwise(angle) {
    return angles.grabPrevAngle(angle);
}

So calling rotClockwise(90) would return 180, rotCounterClockwise(90) would return 0, rotClockwise(270) would return 0, etc.

How can I accomplish this? Is there a list type that allows me to loop back to the beginning when I reached the end?

sentences:
How do I center a sky sphere on the camera? I'm trying to render a sky using D3D 11. What I have seen in tutorials so far uses cube mapping, which I don't want to use. I want to create a sphere, texture it, and center that sphere on the camera, but I don't know how to do the last part.

How do I center it around the camera?

sentences:
How to use LuaJIT the same that Lua in a C++ program? I'm using Lua in my C++ program, as an library. But I read that LuaJIT is a better implementation.

Is it posible to replace with LuaJIT with little change? How?

sentences:
Ensuring a Recursive method completes in one update tick? OK so I have a method that calls itself as this was the only way I could think to get the behaviour I needed. Its a tetris clone i am making and this method is for checking for full lines across X axis.

    void CheckForFullLine(int starting_Y)
{
    for (int y = starting_Y; y < frozenCells.GetLength(1); y++)
    {
        for (int x = 0; x < frozenCells.GetLength(0); x++)
        {
            if (!frozenCells[x, y].isFilled)
            {
                CheckForFullLine(starting_Y + 1);
                return;
            }

            if (x == CELL_COUNT_X - 1)
            {
                tetrisLinesThisTick++;
                Debug.Log("lines this tick: " + tetrisLinesThisTick + "on tick: " + tick);
                ClearLine(y);
            }
        }
    }
}

but when i test the game, most of the time (more than 9/10 times) when you get multiple lines, the debug log says we only got 1 line in that 'tick'.

Here is the update method where at the top I set tetrisLinesPerTick to 0 at the start of each frame.

    private void Update()
{
    tick++;
    // reset the tetris-lines this tick value:
    tetrisLinesThisTick = 0;

    ClearScreen();
    CheckForFullLine(0);
    HandleMovementAndBlockCreation();
    DrawFallingPiece();
    DrawFrozenBricks();
}

For example if I get 2 lines in one go, I get the debug log saying '...linesPerTick 1' twice in quick succession.

Strangely , occasionaly  I do get the 2 or even 3 lines and it says the correct amount, but this is rare and i don't know how i  reproduce that yet.

Another very strange thing (the relevant code might not be here for this part..) ...quite rarely one of the frozen blocks will turn grey after falling, then I can still 'use' it in game to make more lines, but it doesnt disappear like the others, then make a couple more lines using this grey block and it disappears as normal :S  (well just in case you feel like helping me with this part, he is more code :P):

    void ClearLine(int line)
{
    // TODO: Add score

    // remove complete line
    for (int x = 0; x < frozenCells.GetLength(0); x++)
    {
        frozenCells[x, line].isFilled = false;
    }

    //shift all lines down        // todo: figure out if its a multi-line tetris to give better scores...
    for (int y = line; y < frozenCells.GetLength(1); y++)
    {
        for (int x = 0; x < frozenCells.GetLength(0); x++)
        {
            if (frozenCells[x, y].isFilled)
            {
                if (y > 0)
                {
                    frozenCells[x, y].isFilled = false;
                    frozenCells[x, y - 1].isFilled = true;
                }
            }
        }
    }

}

For some reason, I feel it may be the recursive method i made  and the fact that 'linesPerTick' value is getting set back to zero prior to the other lines being removed (in the same move), is what is causing my problem but i could be completely wrong about it!

The whole project is just one .cs file and a block texture i made in GIMP, I could paste the whole script here if you want to try it please let me know. Cheers for any help!

sentences:
Scene Graph for Deferred Rendering Engine As a learning exercise I've written a deferred rendering engine. Now I'd like to add a scene graph to this engine but I'm a bit puzzled how to do this.

On a normal (forward rendering engine) I would just add all items (All implementing IDrawable and IUpdateAble) to my scene graph, than travel the scene-graph breadth first and call Draw() everywhere.

However in a deferred rendering engine I have to separate draw calls. First I have to draw the geometry, then the shadow casters and then the lights (all to different render targets), before I combine them all. So in this case I can't just travel over the scene graph and just call draw. The way I see it I either have to travel over the entire scene graph 3 times, checking what kind of object it is that has to be drawn, or I have to create 3 separate scene graphs that are somehow connected to each other. Both of these seem poor solutions, I'd like to handle scene objects more transparent.

One other solution I've thought of was traveling trough the scene graph as normal and adding items to 3 separate lists, separating geometry, shadow casters and lights, and then iterating these lists to draw the correct stuff, is this better, and is it wise to repopulate 3 lists every frame?

sentences: How to create a Pixmap from an OrthographicCamera in LibGDX I am trying to create a picture based on what one of my OrthographicCamera can see. LibGDX has a ScreenUtils class that has a getFrameBufferPixels method, but it does not what I want as I want to get only what one camera sees, not the whole screen.

sentences:
Can't move character at all in unity basic platformer guide so, I followed below tutorial.

https://unity3d.com/learn/tutorials/modules/beginner/live-training-archive/creating-a-basic-platformer-game

Going well until 18:50 (video time in tutorial), when the tutor compiles and able to move and jump the character. And then, when I try it, mine was not moving or jumping at all.

So, how to move the character?

I've also tried some solutions on the video's youtube comments, but nothing works.

P.S. I'm not new to C# at all, but new to Unity development. I'm using Unity 5.

Thanks.

Update :
Here are the props screenshots and Controller c# code :

Cube

Hero

SimplePlatformController

using UnityEngine;
using System.Collections;

public class SimplePlatformController : MonoBehaviour {

[HideInInspector] public bool facingRight = true;
[HideInInspector] public bool jump = false;

public float moveForce = 365f;
public float maxSpeed = 5f;
public float jumpForce = 1000f;
public Transform groundCheck;

private bool grounded = false;
private Animator anim;
private Rigidbody2D rb2d;

// Use this for initialization
void Awake ()
{
    anim = GetComponent<Animator> ();
    rb2d = GetComponent<Rigidbody2D> ();
}

// Update is called once per frame
void Update ()
{
    grounded = Physics2D.Linecast(
        transform.position,
        groundCheck.position,
        1 << LayerMask.NameToLayer("Ground"));

    if (Input.GetButtonDown ("Jump") && grounded)
    {
        jump = true;
    }

}

void fixedUpdate()
{
    float h = Input.GetAxis ("Horizontal");

    anim.SetFloat ("Speed", Mathf.Abs (h));

    if (h * rb2d.velocity.x < maxSpeed)
        rb2d.AddForce (Vector2.right * h * moveForce);

    if (Mathf.Abs (rb2d.velocity.x) > maxSpeed)
        rb2d.velocity = new Vector2 (
            Mathf.Sign (rb2d.velocity.x) * maxSpeed,
            rb2d.velocity.y);

    if ((h > 0 && facingRight) || (h < 0 && !facingRight))
        Flip ();

    if (jump)
    {
        anim.SetTrigger ("Jump");
        rb2d.AddForce (new Vector2 (0f, jumpForce));
        jump = false;
    }
}

void Flip()
{
    facingRight = !facingRight;
    Vector3 theScale = transform.localScale;
    theScale.x *= -1;
    transform.localScale = theScale;
}

}

sentences:
What does vertex:disp and tessellate:tessEdge mean? [Shader] [Unity] I came across the following declaration on unity tutorial

#pragma surface surf BlinnPhong addshadow fullforwardshadows
vertex:disp tessellate:tessEdge nolightmap

I think disp is the displacement shader but what does vertex:disp mean?
Likewise for tesselate:tessEdge.

from https://docs.unity3d.com/Manual/SL-SurfaceShaderTessellation.html

Thanks. I am rather new to HLSL.

sentences:
3D visual effects on videos I'm trying to get some hands-on experience with 3D visual effects on videos. Similar to those AR apps, I want to add a 3D model with effects, say a dragon, to a video. Something like this famous demo:
https://youtu.be/u5hQpRbHERg
But I don't really want to make it this fancy with camera tracking. I like to start with the simplest approach- probably just placing a dragon on the field (like its last scenes) with fixed camera.
What's the best way to do it? Some tutorials would be very helpful.

sentences:
Can I remake a game I don't own any copyright to? Can I remake a game I don't own any copyright to?

There's a online browser game which I played 5 years ago. Some time ago, this game was shutdown because its developer went bankrupt. I want to re-make this game and provide it to Web again. Can I do this? Or there's some copyright problem or something like this?

sentences:
How to optimize collisions I'm building a 2D MORPG using JavaScript, Node JS and socket.io

To prevent cheating, I have to run all collisions for all players on my server.

I'm currently doing fairly simple square collisions like this:

  for (var i = 1 ; i < collidables.length ; i++) {
    if (y < collidables[i].y + collidables[i].z &&
        x < collidables[i].x + collidables[i].z &&
        x + z > collidables[i].x &&
        y + z > collidables[i].y) {
          // Handle collision
    }
  }

When a player collides with a wall I halve their speed and bounce them back.
This is not working optimally, but it's fine for now.

The same logic is used to check bullet collision and possibly collision with monsters in the future.

I'm currently using 3 different loops for the follwing:

Player vs Terrain collisions
Bullet vs Terrain collisions
Bullet vs Monster collisions

Since all of them have slightly different logic.

Should I put them all in the same loop or is using multiple loops fine? I feel like using multiple loops will slow down my server a lot once there will be some more terrain / players / monsters.

I chose square collisions because I think they are a lot faster than any other type of collision checking, and my game will have a LOT of collision checking.

I think I will allow between 50-100 players on a single server, with most likely hundreds of monsters and thousands of bullets flying around.

There will also be a rather big map that has to stay loaded on the server. But since the server doesn't actually have to draw anything this should be fine?
Client-side the map is split up into smaller parts and only loads the parts near the player.

My game is working fine for now, but there's no real way to test with 50 players until people actually start playing.

I'm afraid I will find out way too late that my collision checking is taking up way too much server memory and/or cpu.

How can I improve the efficiency of my collision checks?

...

Here's a preview of my game in pre-alpha, it should make my question less abstract.

http://185.115.218.199:3000/

If I need to post any more info / code, please let me know and I will do so!

I'm currently running this game on a very small test-server with 512MB RAM and 1 VCPU (can't find the specifications)
This is scalable to up to 16GB RAM and 8 VCPU's and probably beyond that.

sentences:
How should I go about protecting my script files? I am working on a small multiplayer game with a whole bunch of scripting components.

I know I can't store my files in plaintext otherwise anyone would be able to change the functionality of core parts of the game.

What is the best way to go about preventing this sort of "hacking?"

Would it just be best to develop the program using the script files then just copy the files into strings that are hardcoded in the program?

sentences:
2D Platform Game Jumping I'm currently writing a game in XNA for fun which uses C#.  I have got my sprites loaded and when the character moves right he looks like he is running right and when he moves left he looks like he is running left.

I been looking everywhere for a good coding example for how to create a jumping ability.  I have read all the physics stuff that I can stand and it doesn't help when I can't figure out how to use say space bar to jump yet can't keep them from using space just jump again until they land.

sentences:
Refactoring fighting game Movement class responsibilities I'm a web developer, new to C# and trying to learn Unity. I've learned the C# syntax, I understand how to write working code, although I'm having a hard time understanding when and to what classes should I split my code.
At the moment I'm doing a simple 2D fighting game, similar to Mortal Kombat, I've started out with creating some basic sprites and basic scripts for the environment, like clouds spawning and moving (the action takes places on a rooftop), created a fighter character with animations and started with writing the movement script.
At this point, the Movement script deals with moving, jumping, animations (also triggers for punches and kicks) and player input (I'm using the new Input System), also I want to make the game a two player game, so the Movement script also checks if the the fighter is controlled by player 1 or player 2 and everything is crammed in this little Movement script, not that it's too large, it's just funny that a Movement script is doing so much and furthermore I'll need to add health and attacks (not just animations).
I think it's about time I refactor, my questions are:

Should I create a Character, CharacterController, CharacterManager or whatever script that inherits from MonoBehaviour and other scripts as simple C# scripts, or should all of my scripts inherit from MonoBehaviour and be attached as components to my GameObject with references to each other?

Should I have a separate script for my animations or should they be at their respective scripts as in Attack, Movement, maybe Jumping or Death, whatsoever?

What would be the best way or what would be the ways of managing my Fighter GameObject to determine if it is controlled by player 1 or player 2 and if I'll plan to add an AI for example? Should I have a PlayerController/AIController inherit from Character script, or have a separate AI class, or just have some variable to check against?

My problem with various tutorials is that most of them don't give a larger overview of the whole picture, most of them just focus on a single subject: movement, animations, spawning, pathfinding or some other concrete thing or term, etc. and don't show how they are intertwined together.

sentences:
Unity 2d: Not Destroying enemies - impact on memory I know pretty much zero about game performance in Unity. I am trying to figure out if I can afford to put this feature in my game:
I would like to have the enemies killed to pile up in a sort of heap, so I was thinking about not using the same old destroying routine after they die.

The game itself is really simple, it's 2D and for mobile. It has a fixed background and there's not much moving around aside from the player, the enemies and few npcs (which would get destroyed when offscreen), we're talking around ten 32X32 sprites onscreen at a time. Once dead the enemies would not be removed but they wouldn't need to be raycasting, colliding, ecc.. Just only be there for visual sake.

So the question is: would a mobile device easily handle not removed enemies in the order of a hundred or so (I could destroy those at the bottom of the heap) and not slow down or crash the game?
Are there some example of this kind of feature (other games that don't destroy dead enemies)? Or is there a good practice too keep enemies in game without impacting memory resources?

Thanks for the attention.

sentences:
How should I structure my classes to allow for multithreaded simulation? In my game, there are plots of land with buildings (houses, resource centers). Buildings like houses have tenants, rooms, add-ons, et cetera, and there are several values that have to be simulated based on all these variables.

Now, I'd like to use AndEngine for the front end stuff, and create another thread to do the simulation calculations (perhaps also later include AI in this thread). This is so that one whole thread doesn't do all the work and cause problems such as blocking. This introduces the problem of concurrency and dependency.

The currency problem is my main UI thread and the calculation thread would both need to access all the simulation objects. So I have to make them thread-safe, but I don't know how to store and structure the simulation objects to enable that.

The dependency problem is that in order to calculate values, my calculations depend on other objects' values.

What would be the best way to link up my tenant object in the building with my calculations? Hard-code it into the tenant class? What is a good way to do "store" algorithms so they are easily tweaked?

A simple lazy way would be to bung everything into a class which holds all the object, such as plots of lands (who in turn hold the buildings, et cetera). This class would also hold game state such as the technology available to the user, object pools for things such as sprites. But this is a lazy and dangerous way, correct?

Edit:
I was looking at Dependency Injection, but how well does that cope with like a class that holds other objects? i.e, my plot of land, with a building, which has a tenant and a host of other values. DI looks like a pain in the bum with AndEngine as well.

sentences:
DirectX Performance Issue: Rendering to texture Brief introduction:
I'm programming a game and, till now, I've runned it on my desktop. This morning I decided to try it on my laptop (a i3-4005u with a gt920m) to see cpu/gpu usage and, with my surprise, it couldn't even reach 60 fps... then I discovered that it didn't use the nvidia gpu but the intel's integrated one. I looked a bit on Google and found the problem: https://stackoverflow.com/questions/10535950/forcing-nvidia-gpu-programmatically-in-optimus-laptops.

The usage of the GPU (the Nvidia one now) was still to high for such the game I'm making (kind of 2D platform). Trying it on my desktop (gtx 780) I discovered that it uses even 50% of its power (MSI Afterburner).

A screenshot:

To generate the light map I use a render-to-texture and here is the problem: rendering the lights uses all the power (profiled with visual studio). The only difference between rendering the lights and the background is the active RenderTargetView and the only different between the default back buffer and the light map RTV is the format so I changed it:

textureDesc.Format = DXGI_FORMAT_R8G8B8A8_UNORM; //it was DXGI_FORMAT_R32G32B32A32_FLOAT

After that the gpu usage dropped to 3-4% (and the game looks the same).
Now I'm wondering why things changed. Can you help me?

Still now rendering the lights is the most expensive things and I can't understand why (the shader is simpler than the sprites' one. I can post the code if you want, but is a basic "load data from texture and output")

The first draw call is for lights, then there is the background's one.
I really can't understand what's going on.

P.S
I also found that using a borderless window instead of the fullscreen mode by default adds a 10% of usage on the gpu, while fullscreen mode uses all the cpu power (100% of usage). Can you help me again understanding why?

sentences:
How to manage enemy movement and shoot in a shmup? I'm wondering what is the best (or at least a good) way of managing enemies in a shoot-em-up.

Basically, what I'd do would be a class that manages displaying and updating positions of all the enemies.
But how to create good deplacements for enemies?  A list of where-to-go points? gravitating around some fixed points (with ponderation, distance evaluation etc.)?

Same question for the shoot patterns?

Can you please put me on a track?

sentences:
Camera (pole cam) implementation problem In my project I have simple scene graph to render whole scene and Bullet physics SDK to provide physics simulation.

Each rendered object is represented as scene node. Camera always has target and located behind this target. Target can be any scene node.

First, I want to describe my rendering pipeline.

1)When time to render whole scene, we calculate view matrix from target's world matrix. We take offset vector in order to locate camera behind targeted scene node and transform it to scene node world's coordinate. Then add position of target with transformed offset vector. Finally, get inverse matrix of scene node. This method always is called before rendering whole scene.

HRESULT CameraNode::SetViewTransform(Scene *pScene)
{
    //If there is a target, make sure the camera is
    //rigidly attached right behind the target
    if(m_pTarget)
    {
        Mat4x4 mat = m_pTarget->VGet()->ToWorld();
        Vec4 at = m_CamOffsetVector;
        Vec4 atWorld = mat.Xform(at);
        Vec3 pos = mat.GetPosition() + Vec3(at);
        mat.SetPosition(pos);
        VSetTransform(&mat); // Set normal matrix and calculate inverse matrix
    }
    m_View = VGet()->FromWorld(); // Get inversed matrix
    pScene->GetRenderer()->VSetViewTransform(&m_View);
    return S_OK;
}

2)Then, when time to render particular scene node, we calculate projection matrix and send it to the vertex shader.

Mat4x4 CameraNode::GetWorldViewProjection(Scene *pScene)
{
     Mat4x4 world = pScene->GetTopMatrix();
     Mat4x4 view = VGet()->FromWorld();
     Mat4x4 worldView = world * view;
     return m_Projection * worldView;
}

I have next problem, when I calculate view matrix from target's world matrix and locate target on coordinate ( x = 0; y = 10; z = 1) it started to fall due to physics and jerk/twitch. [1]

When I set view/camera matrix only offset position. Scene node falls without jerking/twitching. [2]

How I can fix this jerking/twitching when camera is following the scene node ?

I suppose that it is problem of matrices multiplication, when Bullet SDK sets new coordinates to scene node. But I have no idea how it can be solved.

sentences:
Basic/research RTS engine/model Does a basic/research RTS engine/model exist that can be used as a basis for further experimentation/research? I'd like to avoid reinventing the wheel if possible.
I'm aware of Spring Engine and Stratagus, but those are real game engines and may not be the best to experiment with and learn from.
Ideally the docs for the model would answer questions like:

How exactly do units move? (constant velocity? constant acceleration? constant force?)
How is pathfinding handled? Does every grid cell become an A* graph node (may be expensive)? Does it consider threats?
How are groups handled? (w.r.t pathfinding and movement)
How is combat handled?

I'm mostly interested in the low-level model details (for now), not the graphics etc.
I've read a lot of the other quesions (and answers/references) tagged RTS but I haven't found my answer yet.

sentences:
Godot - Get button node in click event not working How we can get the button reference on the event function that is connected?
My connect signals never works

extends PanelContainer

onready var hbox_container = $ScrollContainer/HBoxContainer
var btn

func _ready():
    createbutton()

func createbutton():
    btn = Button.new()
    btn.set_name("button 1")
    btn.text = "button 1"
    hbox_container.add_child(btn)
    btn.connect("toggled", self, "button_toggled", [btn])

func button_toggled(toggled, target):
    print("which button = ", target.get_name())
    if toggled == true:
        print("Button ist pressed")
    else:
        print("Button is released")

sentences:
LWJGL Determining whether or not a polygon is on-screen Not sure whether this is an LWJGL or math question. I want to check whether a shape is on-screen, so that I don't have to render it if it isn't. First of all, is there any simple way to do this that I am overlooking? Like some method or something that I haven't found? I'm going to assume there isn't.

I tried using my trigonometry skills, but it is hard to do this because of how glRotate also distorts the image a little for perspective and realism. Or, is there any way to easily determine if a ray starting from the camera, and going outward in a straight line intersects a shape? (I can probably do it with my math skillz, but is there an easier way?)

By the way, I can easily determine the angle at which the camera is facing around the x and y axis.

EDIT: Or, possibly, I could get the angles of a vector from the camera to the object, and compare those angles to my camera angles. But I have a feeling that the distorts from glRotate and glTranslate would be an issue. I'll try it though.

sentences:
Blender: Bones get enlarged in export/import process I have a rig in blender that I want to export into a different blender project. For some reason, when I do that, some of the bones get enlarged. All the scales are applied. Why might this be happening?
I've no clue why this might be happening, as this problem seems exclusive to this project and one other project, where one bone out of the whole armature gets enlarges, but here is the information I can provide:
Some differences between the projects where this happens and the others is that the ones where this does happen have animations, and a pose library. However, this does not seem to cause the problem, as deleting the animations and poses doesn't change anything.
This problem happens when I export/import the project as an FBX.
I usually export the project to unity and in order to compensate for the unity/blender rotation, I follow this [guide][1. I rotate the armature -90 on the x axis, apply rotation. Then rotate the armature 90 on the x axis but only apply the rotation to the mesh. I export the project as a FBX, with unity unit scale, no leaf bones, and the 3rd and 4th box under animations checked off. This also does not seem to cause the problem, as not rotating the armature and such doe not change anything.

sentences:
js canvas tiled map - for loop, while, or matrix I am making a top-down view tiled map in canvas, where player is always in the middle of the screen, and map scrolls depending on where you go, like in moba games. I also want it to loop infinitely in every direction.

That means that when I cross the top border of the map I should end up at the bottom of the map, when I cross the left side of the map I should end up on the right side, etc. At the same time I only want the part visible on screen to be rendered.

Normaly I would just use for loop, but in cases when I am at the border, or corner of a map, and I need to display the same map, but the other end of it, it gets complicated with lots of nested loops.

I could make the map as math.matrix, and do multiple operations to fragment it and arrange so that it represents only the part visible on screen, like so:

So when I am at one of bottom tiles for example and I am at the center of the screen, I will need to fill the bottom with top tiles, and since the map is bigger than what is displayed on screen I would need to also extract only part of it to render.

But that would require a few math functions each draw, and I wonder if it is ok to do it.

It is hard to explain, especially in a language that is not my native, but I hope that someone will help me.

What is the right way to do it?

sentences:
Is there a grey-area with Copyright infringement? Currently a student, I'm trying to put together a game for iOS. From everywhere I've read, it seems any game's sound and art are apart of their IP and covered under their Copyright.

That being said, say I wanted to use the coin sound effect from the original Mario (less than 1s long and used sparsely)... would anyone really care? Having no experience with this, I'm just wondering if cases like this are treated like "Ya you're driving slightly over the speed limit, but nobody cares" or as "you stole that car".

Thanks for any insight anyone may be able to provide.

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:
How do game engines manage to 'detect' the opengl supported in a computer I am learning OpenGL 3.3 and OpenGL 2.1. I want to make a game engine with both. So far I can do advanced stuff with both of them. I noticed that graphics engines like Irrlicht support OpenGL 1.x to 4.x. When i run an Irrlicht program in my computer that supports OpenGL 3.3, it runs perfectly. And when i run it in a computer with OpenGL 2.1, it still runs perfectly.

How does it know that my computer supports OpenGL 3.3, and adapt itself to it. Is it through trial and error? or how are they able to do this. That is a feature i want to incorporate in my game engine.

sentences:
Should I load scenes from files, or hard code them? In a game engine I'm working on, I'm using scenes similar to what you would find in Unity. The entities, in my game, are composed of reusable components and custom data which is linked to those components. Entities have children, and one parent. This is shown, below:

class Entity {
    ...custom data here...
    let parent : Component
    var children : [Component] = []
    var components : [Component] = []

    ...methods...
}

If the entities did not have custom data, then creating a scene would be described by the following steps:

Loading a file into memory.
Creating a tree of entities.
Adding components to them, with parameters listed in the file.

However, this does not leave room for custom data. My other alternative is to create a scene by creating a scene object, then hard-coding the entities in. It would look something a bit like this:

var opening_scene = Scene()

opening_scene.addEntity(Player())
opening_scene.addEntity(Car())
opening_scene.addEntity(Terrain())
...

The downside to this is that everything is hard coded. What can I do to create scenes in a game more efficiently?

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:
Separate parts of a game engine I'm pretty new in developing videogames. By now I only used SDL with C/C++ to create games. I'm currently learning OpenGL and I realized that to be fluid and easy to maintain the code must be logically separated. Since I want to use OpenGLES on iOS and Android I was wondering how the engine must be imagined in a technical way, some questions came up:

Do I have to separate input/update functions from draw functions in different threads?
Is there only one proper way to think a game engine/loop?
What kind of assets should I use to create a 3D game using openGl ES to get better performance?

EDIT: I figured that I had more questions lacking of answers reading the links DMGregory refered me to. I'll keep reading it till I fully understand it and than ask for the good questions. Thanks a lot.

sentences:
In a 2d tile based game, what is a good method for scrolling? I am using Direct3D with the D3DXSPRITE wrapper to draw the tiles to the screen. I have a tile class which contains members such as collision and tile type, then i have an array of tiles e.g.

Tile grid[256][256];

Which would be a better method?

-Draw the player in the center of the screen and offset where the map draws.

-Move the player with the camera following.

I was using the first method, but its getting really complicated when you get to the top left edge of the map, and when other players/enemies are on the map and moving at the same time

if i make the camera follow the player, would i have to call spriteBatch->Draw(...) for every single grid tile even though only a few can fit on the screen?

sentences:
Telling which side of a voxel was hit by an object In XNA, I have an axis-aligned BoundingBox representing the object's hit box, and a Vector3 representing the object's velocity. I also have a stationary 1x1x1 axis-aligned BoundingBox representing a voxel. Using object.box.intersects(voxel.box), I can tell that they intersect. However, I do not know which side of the voxel was first hit by the object.

I am assuming you can just take the direction from the center of the player to the center of the voxel and use that to determine which face it hit. However, my brain is not working right now and I can't figure out the math.

I already know how to respond when you learn which face was hit (from my previous question). I just don't know how to figure out which face the player hit.

sentences:
How do I scale a motion capture animation? I used motion capture in my room using the Kinect. As I don't have much space I make compressed running moves, i.e. I put my legs up and down while not moving far forward.

How can I stretch the animation, so me walking 1 meters amounts to the skeleton walking 3 meters or similar while not exaggerating movements to the left/right?

sentences: Why Are Some Foreign Characters Not Displaying Properly I am localizing a game for the first time and I'm noticing some characters are not displaying properly. Most are fine but there is a small handful that are not correct. For example on a loading screen I display the word Loading. In German I'm displaying Lädt. The ä character is not displayed as ä, instead isn't displayed as shown in the image. I'm running in a standalone game. I packaged a development build to see if the problem was there too but it seem localizing is not working when I package it but I can tackle that problem later unless there is a known issues with this. To change languages I am calling Set Current Culture in blueprints.

sentences:
MonoGame game does not work on other pc, when installed by WiX I made a simple tetris game. I wanted to give it to my friend, so that he could test it. I made very fast WiX project and setted up every file from bin/Debug. On my PC it works after installing, but when I sent installer file (.exe because of EmbedCab="yes") he ran it and it installed, yet game does not work at all. I suppose he does not have some DLLs. Is there a way to install those with WiX and what files should I add there?

I found, that I should use OpenAL installer, but how to run this with WiX?

I found a solution after a lot of searching. I now install OpenAL with WixUtilExtension using CustomAction tag. Now I found, that i need also ensure that .Net4.5 is installed. I will go googling. Maybe after another hour I will find how to do this :)

sentences:
How do I run a headless Unity server in a Windows Docker (without GPU)? I am trying to run a headless Unity server on a Windows Docker.
On Linux, there is Xvfb, but I don't know how I could get similar results on Windows.
How would I do that?

sentences:
Calculate matrix transformation components separately It is possible to calculate the translation, rotation and scale that were used to build a matrix?

I mean if I have a matrix M can I calculate the rotation, scale, and translation it represents?

Of course I could save each component in the matrix individually, but can I recover this information from just the matrix data?

sentences:
FPS - How to handle accuracy with red dot sight on guns I have a gun which you can aim down the red dot sight. If you are moving while aimed down sight, there is some bobbing that comes into play. The arms are bobbing, not the camera itself.

Currently when the player fires their gun, I fire a ray from the center of the camera and check for a hit on a player.

The problem is, if the player is aiming and moving, the red dot is bobbing(since the arms are) but because the camera isn't, the ray always fires down the center which doesn't line up with the red dot. It Doesn't feel right in gameplay.

I was hoping someone may have some ideas to offer on how to handle this..

sentences:
How can I implement a camera like the one in RotMG? RotMG, an MMO top-down shooter, takes on a unique 2d-3d style, and has an intriguing camera;

The game is obviously 3d, not simply isometric, and if you play the game and turn on camera rotation you will notice the effect the game produces, like so.

RotMG is made using flash, and I am currently experimenting with libgdx (which uses lwjgl/opengl). How should I go about implementing a RotMG-like camera?

sentences:
How is a moving object like a platform represented in a 2d Tilemap I'm having trouble understanding how I would implement a moving platform in the actual map file.  Lets say its a file of character's and maybe the letter 'P' would stand for Platform.  Then, how would the game know which direction it moves, how far it's suppose to move before returning, what size it is, etc...  Am I even suppose to represent it in the map file?

I'm coming from the approach of making the game handle the maps as dynamically as possible, where you could basically make a new map file and play it in the game without having to hard code any special information for that map.

sentences:
Height and width of a Farseer body? I have a body named PersonA. If PersonA collides with another body, the width and height of that body should be saved. I tried it like this but I always get error messages that "Width" and "Height" don't exist.

bool PersonA_OnCollision(Fixture fixtureA, Fixture fixtureB, FarseerPhysics.Dynamics.Contacts.Contact contact)
{
//How tall and broad is the body that collided with PersonA
float Width = fixtureB.Body.Width;
float Height = fixtureB.Body.Height;

return true;
}

How can I get the width and height of another body? What should I change?

sentences:
In Photon, What happens networked GameObject's ownership when master client disconnects? I'm creating multiplayer game with Photon. When player disconnects, especially master client does, every GameObject instantiated from Master client is gone, so I can prevent with this:

PhotonNetwork.autoCleanUpPlayerObjects = false;

Now GameObjects are still there even Master is gone, but what about their ownership? I needed to destroy some of enemies when they dies, but if master is gone and other player got selected as Master, is he automatically receive ownership of them too?

If not, is there a way to do that automatically? Any advice will very appreciate it!

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:
How do I implement tilt controls that work even when the device is not vertical? I'm using libGDX to develop an Android game. The main character can be moved freely in the 2d plane by tilting the phone. The relevant part of my current implementation looks somewhat like this:

Vector2 mainCharacter;
float speedX, speedY;

public void render(float delta) {
    speedX = 0.6f * speedX + 0.4f * -Gdx.input.getAccelerometerX();
    speedY = 0.6f * speedY + 0.4f * -Gdx.input.getAccelerometerY();
    mainCharacter.move(speedX, speedY);
}

This simple implementation works quite well as long as the player sits or stands upright. But there are two situations where this approach fails:

If the player holds his phone almost horizontally (e.g. if he lies in bed, see fig. 1). Neither the computation of speedY nor the computation of speedX works properly in that situation.
Inside a moving vehicle. When the vehicle speeds up or slows down, this has a strong impact on the values returned by Gdx.input.getAccelerometerX/Y.

So my question is: Is there anything that can be done to solve these two problems? How can I get satisfying results independent of whether the player is lying, standing or sitting? And is there a reasonable way to reduce the influence that the movement of a vehicle has on the output of the accelerometer?

fig. 1

sentences:
How to convert an octree to a polygon mesh? So if I have dynamic voxel terrain data stored in an octree
  representation what would be the best way to go about converting the
  octree to a polygon mesh which I can render with OpenGL?

A lot of the meshing algorithms I have found online assume that voxel data is stored in a 3D Array however for the level of detail I am using storing chunk data in a massive array isn't really an option (chunk size 64x1024x64 with each block roughly 4bytes) split into several 64x64x64 small octrees, I could make the chunk size smaller but then that means more draw calls etc.

Basic searches on google for 'meshing an octree' seem to bring up lots of research on doing the inverse (converting from meshes to SVOs).

The problem with using these algorithms on the octree instead of the array is that the octree has a much slower access time not to mention the time cost of copying the data from the octree representation.

I have considered the possibility of converting to an RLE or spatial hashing system but these two systems both have their drawbacks especially since I plan to use the same octree when I come to implement collision detection.

I would guess that it would be best to traverse down the tree rather than iterating over it like  an array, but some more ideas about how I could optimise this would be appreciated.

sentences:
What is the logic of 'move_towards_point'? I think I was using the move_towards_point function incorrectly. I discovered that I could not make the object move down.

In the create event, if I include the code move_towards_point(x,y,10);, the object in question moves to the right:

If I include the code move_towards_point(-x,y,10);, the object moves to the left:

I wanted to make the object move up, so I left x and used move_towards_point(x,-y,10);. It moved up as I wanted.

Yesterday, I had the need to make the object move down. That's where my dilemma began. I thought to use move_towards_point(x,+y,10);. It did not work; the object moved to the right, as in the first demonstration. I tried move_towards_point(0,y,0);. The object moved to the left, again, as in the second demonstration.

I began to suspect that I was not using the function correctly. By the name, I assumed it would move an object to a certain specific point. I went back to test move_towards_point(-x,-y,0);, and the object move diagonally:

I found the solution to all cases of movement:

Down : move_towards_point(obj_Bola.x,obj_Bola.y+1,10);
Up : move_towards_point(obj_Bola.x,obj_Bola.y-1,10);
Left : move_towards_point(obj_Bola.x-1,obj_Bola.y,10);
Right : move_towards_point(obj_Bola.x+1,obj_Bola.y,10);

The explanation seems to be that I am now using the x and y, relative to the object. When I do not want to change it's position on any of it's axis, I simply do not add any value. On the axis that I want the object to move in, I add or subtract a value.

One observation is that the value added or subtracted does not change the speed that the object moves, so move_towards_point(obj_Bola.x,obj_Bola.y+99999,10); moves the object down with a speed of 10.

I would like to know the logic behind move_towards_point, and if the way I solved my problem is the right one.

sentences:
How do i make player input object spawning data driven? I'm using component based design and am at the stage or re-factoring simple player input to be data driven.

Currently i have a PlayerControlComponent, which an entity has if it should be player controlled. Currently only a single entity has this.

I have an InputSystem that acts on entities with PlayerControlComponent, PhysicalComponent and MoveableComponent components.

Below is the code that actually does the entity creation:

if (_InputActionManager.IsAction(_ActionFireBullet))
{
    if (WorldManager.CanDoAction(playerControlComponent.CreateBulletActionId))
    {
        // Create a bullet and fire it
        using (var entityTemplate = WorldManager.GetEntityTemplate(@"EntityTemplates\Bullet"))
        {
            var bulletPhysicalComponent = entityTemplate.Item.GetComponentOfType<PhysicalComponent>();
            var bulletMoveableComponent = entityTemplate.Item.GetComponentOfType<MoveableComponent>();

            bulletPhysicalComponent.Position = physicalComponent.Position + physicalComponent.Direction * physicalComponent.Radius;
            bulletPhysicalComponent.Direction = physicalComponent.Direction;
            bulletMoveableComponent.Velocity = moveableComponent.Velocity + physicalComponent.Direction * 200;
        }

        WorldManager.MarkActionDone(playerControlComponent.CreateBulletActionId);
    }
}

I want to get to the stage where I can have an XML file that indicates some how that a given entity will create a new entity based on a given template and set initial values such as position, direction and velocity in the above example.

I want to avoid having to change code and maybe add systems and components for each type of thing I want to spawn.

For example, currently if I wanted to add the ability for an enemy to spawn a missile I'd need to define my missle entity template (fine), create a new component to mark the entity as being able to fire a missle, then create a system that uses that component (want to avoid), then create a system with code similar to the above (want to avoid).

As another example, say I want to change the speed of the bullet, currently I do that in code, but I want to be able to do that in a data-driven way.

How can I create and manage a way of creating an entity based on an event occuring, with properties based on the entity that created it? i.e. Player presses Fire, bullet spawned at ship location, moving away from ship.

sentences: Batching in Java (software rendering) I've watched some tutorials on java game development and when they start using spritesheets all they do is get a subimage out of the spritesheet and create a new BufferedImage out of that. Does java do some sort of batching behind the scene when drawing the images like some engines and libraries do? Is it even possible to batch in java, and if so how would I go about doing it?

sentences:
2D Collision Response I am trying to implement collision response in my libgdx game. I'm using Rectangle objects as my bounbing boxes. This makes collision detection very easy, however I can't quite get the response working correctly. At the moment I have this:

float overlapX = getOverlap1D(dynamicBounds.x, dynamicBounds.x + dynamicBounds.width, blockBounds.x, blockBounds.x + blockBounds.width);
float overlapY = getOverlap1D(dynamicBounds.y, dynamicBounds.y + dynamicBounds.height, blockBounds.y, blockBounds.y + blockBounds.height);

if (overlapX < overlapY)
{
      if (dynamic.getVelocity().x < 0)
      {
            dynamic.getPos().add(overlapX, 0);
      }
      else
      {
            dynamic.getPos().sub(overlapX, 0);
      }
      dynamic.setVelocityX(0);
}
else
{
      if (dynamic.getVelocity().y < 0)
      {
            dynamic.getPos().add(0, overlapY);
      }
      else
      {
            dynamic.getPos().sub(0, overlapY);
      }
      dynamic.setVelocityY(0);
}

private float getOverlap1D(float min1, float max1, float min2, float max2)
{
    return Math.max(0, Math.min(max1, max2) - Math.max(min1, min2));
}

Using this, corners are handled in a very unpleasant way, resulting in less than extraoridnary results like this.
Where am I going wrong that allows this to happen?

sentences:
Best client/server architecture for a mobile management game? For the past year I have worked on a small company that develops a traditional browser based strategy game, of the likes of Travian or Ogame, but using a more interactive approach like Tribal Wars 2.

The game is made in a simple php server without frameworks and a simple mysql database, and all of the game happens in a single static page that is changed through ajax calls and has a map made in pixi.js. The automatic updates are delivered to the client side through polling the server which then queries some specific database tables made for the purpose for changes.

While this approach is solid and works, it has 2 big problems:

Having a mobile app is increasingly more important and there are not enough resources for having two separate codebases. Having a app which is simply a wrapped webview is also not a solution because the performance of a really complex page with a giant webgl map is, while usable, really subpar;
Polling the server for changes creates a lot of programing challanges that make some simple tasks really complicated and creates a lot of convoluted code if we dont want to hurt the game performance, as we are not going make dozens of database queries every 5 seconds.

I want to start developing a game idea that I have that is basically inserted in the same genre and which is going to be, at least initially, mobile only. The real problem here is that after reading a lot on the internet, I am confused on what should be a good client/server architecture for me to start prototyping in a way that I do not run in the problems mentioned above.

Basically, above all, I want the server to be able to know which page/screen/state is each client looking at, and be able to send them messages when another client changes something on that specific screen. It would also be nice if the solution is something lightweight on the server side to be able to scale a little.

Client side I was thinking about Unity because of being cross platform, of all the environment around it (ads, analytics, a lot of support and answers on the internet), and because I have previous development experience with it.

Server side is the real question.

Simple http calls will not work and so PHP is out of the equation.
I have though about using node.js with socket.io to use websockets solving the polling problem. Is this a good idea? Would it be better to store the game state in a relational or nosql database in this case? Would this work on unstable mobile conections?
Lots of people seem to use a c# and sockets for unity. Would this be overkill in this situation? Taking this approach how would the data be stored? would it be feasible with a linux server or would I need a windows server? Would this work on unstable mobile conections?
Don't know, I'm open to suggestions.

tl:dr: I want to make a mobile management game in unity but am confused what to choose for the server side architecture considering that I want the server to be ablose to send a message to the client without the client asking for it. Is there anything I should take in account?

Sorry for the broad question and thanks for the help.

sentences:
How do i make an object to be visible only on a particular layer? Please refer the image below to understand.

I am working on 2D game. I have three elements: "background(layer 0), foreground(layer 1) and the object".

I have used sprite renderer to set background and foreground images. Object gets instantiated during runtime.

How do i make Part-A of the object invisible? I want to make object visible only on foreground. If the object is completely on the background, it should be completely invisible. if the object is completely on foreground, it should be completely visible. Part-A and Part-B are just for reference. It is one single object.

The goal to be achieved is the image below:

sentences:
Update method from script doesn't called After experiments with Unity versions, I have reproduced Mandelbrot example from scratch and got C# script doesn't called. If I set breakpoint, it says it is not reacheable

I think I set up all links. As it seem from IDE hint, inheritance is correct.

Simultaneously, shader is working, i.e. image is displayed, but not updated by controller.

sentences:
Reducing the number of edges in a pathfinder I've worked out an algorithm for pathfinding in a quite free-form terrain (not constrained to grids), with the limitation that it doesn't allow the moving character to rotate. I'll use it for AABBs so that's not a problem, and I'll assume AABBs below.

However, one of the steps consists of creating a graph in which the path is to be found, and that's where the problem is: it seems to me that the number of graph edges to construct is going to be O(V²) where V is the number of vertices. Yet when looking at a typical graph, it is apparent that many of these edges do not need any consideration at all. So the question is if there is a way to reduce the number of edges.

The algorithm goes like this. The input is a traveler, a series of boxes (the maze) and a destination point:

http://www.formauri.es/personal/pgimeno/temp/rect4572.png

(in this example, the reference point of the traveler is at the bottom right of the rectangle because I made a mistake estimating the MDs by hand; sorry about that)

Calculate the Minkowski difference of the traveler and each box in the maze: http://www.formauri.es/personal/pgimeno/temp/rect4574.png - this reduces the problem to having a point crossing that maze, simplifying analysis.
Create the graph:

2.1. Each vertex is a corner of one of the boxes in the Minkowski difference.
2.2. For each pair of vertices, there is an edge iff the line between them does not have any point inside one of the boxes. In other words, if there is a direct line of sight between them.

Result: http://www.formauri.es/personal/pgimeno/temp/rect4758.png (done by hand - I may have forgotten edges)
Run a pathfinding algorithm on that graph. http://www.formauri.es/personal/pgimeno/temp/rect4776.png

The path found is directly usable in the original map: http://www.formauri.es/personal/pgimeno/temp/rect5158.png

The problem is step 2.2. Is it possible to reduce the number of edges?

I'm not aware of any pitfalls in the algorithm, but if you see one, please let me know as well.

sentences:
Hard edges with non power of 2 images in OpenGL When down scaling 2D images in Java2D, it does a great job at preserving hard edges while downscaling to non power of 2s. However, in OpenGL, I have been unable to find a solution to this. I have tried using GL_NEAREST to get hard edges, but it also creates the wonky edges aswell. I cannot use GL_LINEAR in this case either, but still, the linear interpolation still looks wonky.

Example (Both rendering 30x30 hard image, rendering at 30x30 pixels).

Please note : I am aware that this occurs with images that aren't power of twos, like 30, but the main problem is, if I try to upscale or downscale an image that is power of two (say 16x16) to something that isn't a power of two (say 20x20), I still get this effect. This issue with scaling this occurs in Java2D, but it is by far less noticable.

My question is: What parameters will I need to use when rendering a non power of two image? So I can get a similar effect that I get in Java 2D.

I can post source code if needed.

EDIT

Original Image (30 x 30 png)

Turns out I wasn't scaling them at all! Both were being rendered at the original 30 x 30 pixels on both OpenGL and Java2D.

Sample Code:
Java2D:

 g.drawImage(heart, 0, 0, 30, 30, null);

No rendering hints are being applied, just the bare minimum.

In OpenGL

Vertex Shader:

#version 400

in vec2 position;

out vec2 textureCoords;

uniform float width;
uniform float height;
uniform float xOffset;
uniform float yOffset;
uniform mat4 transformationMatrix;

void main(void)
{

    gl_Position = transformationMatrix * vec4(position.x, position.y, 0.0, 1.0);
    gl_Position.x += (xOffset) / (width / 2);
    gl_Position.y += (yOffset) / (height / 2);
    gl_Position.y = gl_Position.y;

    textureCoords = vec2(position.x / 1, position.y / 1);
}

Fragment Shader:

#version 400

in vec2 textureCoords;

out vec4 out_Color;

uniform sampler2D texture2d;
uniform float transparency;

void main()
{
    out_Color = texture2D(texture2d, vec2(textureCoords.x, textureCoords.y));
    if(textureCoords.y > 1 || textureCoords.y < 0)
    {
        discard;
    }
}

Rendering methods:

public void makeWonkyImage()
{
    render(0, 0, 30, 30, heart);
}
public void render(float x, float y, float width, float height, int textureID)
{
    PostProcess.imageRenderer.render(x, Gfx.HEIGHT - y, width / 1000, -height / 1000, textureID);
}
public void render(float x, float y, float width, float height, int textureID)
{
        shader.start();

        prepare(textureID);
        Vector2f position = new Vector2f((-Display.WIDTH / (width * 1000f))
                , (-Display.HEIGHT / (height * 1000f)));
        Matrix4f matrix = Maths.createTransformationMatrix(position,
                new Vector2f(width / Gfx.WIDTH * 1000f, height / Gfx.HEIGHT * 1000f));
        shader.loadTransformation(matrix);
        shader.loadScreenDimensions((float) Display.getWidth(), (float) Display.getHeight());
        shader.loadOffsets(x, y);
        GL11.glDrawArrays(GL11.GL_TRIANGLES, 0, quad.getVertexCount());
        end();
        shader.stop();
}

public void prepare(int texture)
{
        GL30.glBindVertexArray(quad.getVaoID());
        GL20.glEnableVertexAttribArray(0);
        GL11.glEnable(GL11.GL_BLEND);
        GL11.glBlendFunc(GL11.GL_SRC_ALPHA, GL11.GL_ONE_MINUS_SRC_ALPHA);

        GL11.glDisable(GL11.GL_DEPTH_TEST);
        GL13.glActiveTexture(GL13.GL_TEXTURE0);
        GL11.glBindTexture(GL11.GL_TEXTURE_2D, texture);
        GL11.glTexParameterf(GL11.GL_TEXTURE_2D, GL11.GL_TEXTURE_MIN_FILTER, GL11.GL_LINEAR);
        GL11.glTexParameterf(GL11.GL_TEXTURE_2D, GL11.GL_TEXTURE_MAG_FILTER, GL11.GL_LINEAR);
}

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:
how to release unity webgl memory from asset bundle I have stuck in a weird problem, in my Webgl project i am loading asset bundle frequently which is working fine but after unloading the asset bundle the memory is still not releasing. I am using WWW.LoadFromCacheOrDownload method to download and cache asset bundle data.

 IEnumerator DownloadAndCacheAB(string assetName)
    {
        // Wait for the Caching system to be ready
        while (!Caching.ready)
            yield return null;

        // Load the AssetBundle file from Cache if it exists with the same version or download and store it in the cache
        using (WWW www = WWW.LoadFromCacheOrDownload(finalUrl, 1))
        {

            yield return www;

            if (www.error != null)
            {
                Debug.Log("WWW download had an error:" + www.error);
            }

            AssetBundle bundle = www.assetBundle;

            if (assetName == "")
            {
                GameObject abObject = (GameObject)Instantiate(bundle.mainAsset, gameObject.transform.position, gameObject.transform.rotation);
                abObject.transform.parent = this.transform;
                SetTreeShaderSettings(abObject);
            }
            else
            {
                GameObject abObject = (GameObject)Instantiate(bundle.LoadAsset(assetName), gameObject.transform.position, gameObject.transform.rotation);
                abObject.transform.parent = this.transform;

            }

            // Unload the AssetBundles compressed contents to conserve memory
            bundle.Unload(false);

        } // memory is freed from the web stream (www.Dispose() gets called implicitly)
    }

And even calling GC Collect to remove data

public void RemoveBundleObject()
    {

        if (loadBundleRef != null)
        {
            StopCoroutine(loadBundleRef);
        }
        if (this.gameObject.transform.childCount > 0)
        {
            Destroy(this.gameObject.transform.GetChild(0).gameObject);
            System.GC.Collect();
        }

    }

but the problem is memory is not releasing, it keep going up when i again use/load asset bundle.

Edit: I found that using LoadFromCacheOrDownload function is not good so i have updated it with UnityWebRequest but the still problem persist.

sentences:
How do I make a doorway going into the next scene? I new to GDevelop and I use it on a Chromebook.
I'm making this game that I'm kind of proud of! I've found a way to teleport players to the next scene, by just putting the condition, then just make the event: Open url (and then the link of the scene I want the player to travel to). When I use the method I am using now, The game keeps opening tabs of different scenes! And, when I try going back to a tab, It creates like, eight new tabs! It is probably just a glitch. I go to the events section then I set the action to be: open url or file: And then the link of the next scene. I would just like to find a better way.
Can I get a javascript code to make the player teleport when it touches the door or the teleporter?
I would really like to find a BETTER way to teleport the player.

sentences:
How to force a translation to go through an exact point? I have a camera object with a script that will whether translate it with a set speed, or stop it. I also have 7 "checkpoints", where there are 7 different quads, who will stop the camera whenever the camera reaches them.

The problem here is that in my code :

void Update() {

if (scoreholder.CheckScore()<scoretimer) {
//if the current score is less than set X score

        if (killcam.transform.position.y == quadholder.y) {
//and if the camera's position equals the position of the generic quad *PROBLEM HERE*

            killcam.GetComponent<cameraUp> ().SetCam (true); //stop the cam

            while (scoreholder.CheckScore () < scoretimer) { // do stuff

                offset = mr.material.mainTextureOffset;
                offset.y += offsetSpeed * 0.1f;
                mr.material.mainTextureOffset = offset;

                break;
            }
        }

    }

else { //once the score is not less than the desired X score, move the cam
        killcam.GetComponent<cameraUp> ().SetCam (false);
    }

}

So my problem here is that this line of code if (killcam.transform.position.y == quadholder.y) never happens, the translation skips some values, and the camera doesn't hit the exact quad spot. I tried to use > instead of ==, but I ran into another problem, is that after the 3rd quad, since my camera speed increases in time, the code apparently doesn't get processed fast enough, and my camera goes beyond the 4th,5th,6th, and 7th quad without stopping.

I have already tried Vector3.Lerp, and it gives me almost the same result, if I lerp between the beginning and the end of the track, I have to do it with an extremely small fraction, and I can't have my camera move at that speed.

sentences:
OpenXR device not present in Start or Awake methods in Unity C# script I'm developing a VR game using OpenXR in Unity (specifically developing on a Valve Index). When I try to access the input devices through the InputDevices.GetDevices() function, I get 0 devices back when I call this function from my script's Awake() or Start() methods. But when I call the same function from my script's Update() method, I see all the devices (e.g. head set, left controller, right controller).
Why can't I see the devices in the Awake() or Start() methods?

sentences:
How to rotate and move an object in precise time frame My task is to rotate and move an object into a new position and rotation in a given time. Say I have to move a cube from (0,0,0)|(0,0,0) to (1,1,1)|(0,90,0) in 5 seconds. Could anyone explain to me please how to achieve that?
My experiment is:
private IEnumerator DoMove(/*float time, Vector3 targetPosition*/)
{
    foreach(WayPoints wp in tposes)
    {
        float counter = 0;
        float duration = wp.timeStamp;
        while (counter < duration)
        {
            counter += Time.deltaTime;
            Vector3 curpos = cube.transform.position;
            Quaternion crot = cube.transform.rotation;
            float time = Vector3.Distance(curpos, wp.position.position) / (duration - counter) * Time.deltaTime;
            cube.transform.position = Vector3.MoveTowards(curpos, wp.position.position, time);
            cube.transform.rotation = Quaternion.Lerp(crot, wp.position.rotation, time);
            yield return null;
        }
        Debug.Log("Reached position: " + wp.position.position + " in time: " + Time.time);
    }
}

The cube gets to its position in time, but rotation is late. The end position of the cube should be (2,2,2)|(0,120,0), but it stops moving at (2,2,2)|(0,~110,0).
There are two positions I want the cube to be in:

(1,1,1)|(0,90,0) in 5 seconds
(2,2,2)|(0,120,0) in next 4 seconds

sentences:
What engine is used in an introductory game-development course? I am preparing a course in game-development. It is a choice-coures for 3rd-year students of computer science, who have working knowledge of several programming languages (C, C++, Java), algorithms, data structures etc. For the class and home exercises, I am considering two systems.

Initially, I thought of using Unreal Engine - since it is widely used in the industry, so using it will give the students an edge when looking for a job.

However, I then thought that such a complex engine might distract students from the design aspects of a game, and put them too much into the intricacies of graphics and animation. So I thought of using PyGame, which is much simpler.

My question is: what game-development engines are commonly used in similar courses (introductury GD courses for undergraduate CS students)?

sentences: Unity, depth behind a transparent object Is there a way to know how far away is any object behind a transparent object in shader? Like making water fully transparent when close to shore.

sentences:
World coordinates on vertical grid game for different aspect ratios (Unity) new to game development and unity so hopefully someone can help.

I want to make a 2D portrait mobile game that will have a grid of constant size where units can move on in Unity.

This should support different aspect ratios. To do that I was thinking to cut sections at the top and bottom of the screen for smaller aspect ratios.

Additionally, I would like the coordinate system to be natural to the grid, so coordinate (0,0) would be the bottom left tile in the grid, (1,0) would be the tile to the right of that,... To illustrate this concept I drew something quickly:

I tried with a script that resizes the size of the orthographic camera to fit the content horizontally. Problem I had with that is that I couldn't get a good coordinate system on the grid after the camera gets resized depending on the aspect ratio since the number of horizontal world units varies depending on the aspect ratio.

Any thoughts on what would be the best way to do this? Thanks!

sentences:
Rendering shadow sprites in cocos2d-x I am writing a 2D game with cocos2d-x. I want to put a "shadow" sprite on a background sprite using the equation:

  MAX(0, Cd * 1 - Cs * S)

where Cd is the destination color (that is, a background pixel), Cs is the source color (the shadow pixel), and S is the scale factor (between 0 and 1).
The MAX() function is used to avoid negative results. This is a lighting effect: when the shadow sprite pixel is 0, there is no effect on the background
pixel, otherwise, the background pixel becomes darker.

Now, the only way that comes to my mind is to change the blending equation to GL_FUNC_SUBTRACT, but it doesn't compile with cocos2d-x (can't found it).

I would subclass the CCSprite class in order to implement the draw() method in order to change, when needed, the blending equation, call the original draw() method and restore the blending equation to its previous state at the end of the method.

So my questions are two:

How to use glBlendEquation() with cocos2d-x? Keep in mind that I am writing a game for iPhone/Android/Windows.
Are shadows handled this way in 2D games?

sentences:
How can I generate a 2D mountain landscape procedurally? Every level in my game needs to have a different mountain landscape background generated automatically (but the landscape must be the same for each level).

How could I generate such a landscape procedurally? Maybe fractals?

Note: I am using LibGDX and Java on Android

sentences:
A cool way of doing Z-index for XNA components? I am trying to render some elements in my game. First, I render the textures (the textures of the textboxes themselves etc). Then I render the primitives (borders around controls etc). Then I render the text.

However, by doing so, this gives a weird result in my user-interface when showing tooltips (by hovering over a textfield), as seen in the screenshot below.

Due to the order of drawing, borders around the window are drawn after textures, which (for the tooltip that appears when my mouse is over the textfield) makes it look weird.

sentences:
Java create a Polygon for each island in tile game I am making a 2d top-down tile based game, which is randomly generated each new world.

What I want to do is create a Polygon (or other more appropriate shape I don't know of) for each landmass not disrupted by land, basically each unseparated landmass/island, I want to do this for where my player is to spawn in the world, I want to have it so it has a higher chance of spawning on the biggest landmass in the world, rather than spawning on a tiny several tile island. So, all I need to know is how would I create some sort of shape system to recognise different islands.

The reason I suggest a Polygon is because the player would randomly spawn in that area so it has to be accurate to the land, it can't start of by spawning in water nearby.

If a Polygon is obsolete for this idea, and another system would be better let me know.

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:
Rays starting in an octree node I just fixed a bug where rays starting and ending in an octree node were not detected as octree node hits (because the ray doesn't hit the sides).

I'm changing the code to check if a ray starts in the octree node, then it is an automatic node hit.

Any reason to not do this?

sentences:
OpenGL: Transformations I'm not sure if I correctly understand 3D transformations in OpenGL. Let's assume I'm using the typical matrix stack.

It seems like you move the world X units over, drop in a bag of verts (a mesh) and move the world back by popping the matrix off the stack, then you repeat the process to place another model?

Say I wanted to place a model at (10, 0, 0) and another at (0, 10, 0). I think I would...

PUSH move(10,0,0);
DRAW model A;
POP;
PUSH move(0,10,0);
DRAW model B;
POP;

Some questions come to mind, like for example what does loading an identity matrix do in the stack?

Am I right to assume that these operations in effect move the world around, then you draw the mesh at 0,0,0 in world space when you've moved the world to your liking?

Or is it the other way around, does GL "apply" the matrix stack to your mesh as you draw it?

Thanks, -Cody

sentences:
How to name HP/MP/Exp bars in a single word? I have one question related to game design.

In my prototype game, I have an options when you can change look of your HPbar, MPbar and Expbar. Actually I don't know how to easily name this option.

Currently have "player HP/MP/Exp bars - Value", but it doesn't look so great.

I am looking for a simple name for this, so I want to provide more understandable naming for player.

sentences:
XNA: Networking gone totally out of sync I'm creating a multiplayer interface for a game in 2D some of my friends made, and I'm stuck with a huge latency or sync problem.

I started by adapting my game to the msdn xna network tutorial and right now when  I join a SystemLink network session (1 host on PC and 1 client on Xbox) I can move two players, everything is ok, but few minutes later the two machines start being totally out of synchronization. When I move one player it takes 10 or 20 seconds (increasing with TIME) to take effect on the second machine.

I've tried to :

Create a thread which calls NetworkSession.Update() continuously as suggested on this forum, didn't worked.

Call the Send() method one frame on 10, and the receive() method at each frame, didn't worked either.

I've cleaned my code, flushed all buffers at each call and switched the host and client but the problem still
remain...

I hope you have a solution because I'm running out of ideas...

Thanks

SendPackets() code :

    protected override void SendPackets()
    {
        if ((NetworkSessionState)m_networkSession.SessionState == NetworkSessionState.Playing) //Only while playing
        {
            //Write in the packet manager
            m_packetWriter.Write(m_packetManager.PacketToSend.ToArray(), 0, (int)m_packetManager.PacketToSend.Position);
            m_packetManager.ResetPacket(); //flush

            //Sends the packets to all remote gamers
            foreach (NetworkGamer l_netGamer in m_networkSession.RemoteGamers)
            {
                if (m_packetWriter.Length != 0)
                {
                    FirstLocalNetGamer.SendData(m_packetWriter, SendDataOptions.None, l_netGamer);
                }
                }
            m_packetWriter.Flush();//m
            m_packetWriter.Seek(0, 0);
        }
    }

ReceivePackets() code :

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

        if ((NetworkSessionState)m_networkSession.SessionState == NetworkSessionState.Playing) //Only while playing
        {
            if (m_networkSession.LocalGamers.Count > 0) //Verify that there's at least one local gamer
            {
                foreach (LocalNetworkGamer l_localGamer in m_networkSession.LocalGamers)
                { //every LocalNetworkGamer must read to flush their stream
                    // Keep reading while packets are available.
                    NetworkGamer l_oldSender = null;
                    while (l_localGamer.IsDataAvailable)
                    {
                        // Read a single packet, even if we are the host, we must read to clear the queue
                        NetworkGamer l_newSender;
                        l_localGamer.ReceiveData(m_packetReader, out l_newSender);
                        if (l_newSender != l_oldSender)
                        {
                            if ((!l_newSender.IsLocal) && (l_localGamer == FirstLocalNetGamer))
                            {
                                //Parsing PacketReader to MemoryStream

                                m_packetManager.Receive(new MemoryStream(m_packetReader.ReadBytes(m_packetReader.Length)));
                            }
                        }
                        l_oldSender = l_newSender;
                        m_packetReader.BaseStream.Flush();
                        m_packetReader.BaseStream.Seek(0, SeekOrigin.Begin);
                    }
                }
                m_packetManager.ParsePackets();
            }
        }
    }

sentences:
Show 3d object on device live camera in Unity3d for iOS Possible Duplicate:
  How to add render able Texture in Unity 3d for iOS

How render a 3d or 2d(.jpg or .png )object at device live camera in Unity3d, and this 3d object shouldn't stuck with camera. It has to show at specific point, like we can set any object in game scene at particular location.

sentences:
OnMouseDown() execute only once I have the following OnMouseDown() function:

private void OnMouseDown()
{
    Debug.Log("This turret is: " + thisTurret.ToString());
    if (EventSystem.current.IsPointerOverGameObject())
    {
        return;
    }

    if (thisTurret != null)
    {
        buildManager.SelectTurret(thisTurret);
    }

which send to the following functions:

public void SelectTurret(GameObject turret)
{
    if(selectedTurret == turret)
    {
        Debug.Log("Selected turret is: " + selectedTurret.ToString());
        DeselectTurret(selectedTurret);
        return;
    }

    selectedTurret = turret;
    Debug.Log("Selected turret here is: " + selectedTurret.ToString());
    Debug.Log("Pasted turret here is: " + turret.ToString());
    if (oldSelectedTurret == null)
    {
        oldSelectedTurret = selectedTurret;
    }

    //Debug.Log("Selected turret is: " + selectedTurret.ToString());

    if (oldSelectedTurret != selectedTurret)
    {
        turretUI.Hide(oldSelectedTurret);

        //Debug.Log("Old in if Selected turret is: " + oldSelectedTurret.ToString());

        oldSelectedTurret = selectedTurret;
    }
    //Debug.Log("Current Selected turret is: " + selectedTurret.ToString());

    turretToBuild = null;

    turretUI.SetTarget(selectedTurret);
}

public void DeselectTurret(GameObject turret)
{
    if(turret != null)
    {
        Debug.Log("Turret to deselect is: " + turret.ToString());
        turretUI.Hide(turret);
        selectedTurret = null;
    }
    else
    {
        Debug.Log("Turret to deselect is null!");
    }
}

it should deselect the turret if clicked twice but instead it select the turret on first click and don't execute on second click

sentences:
Attach component of other Object to a variable within Unity Inspector This question might sound a bit stupid and I'm sure there is a simple solution for this .. I'm just not finding it:

Actually all I want to do is attach the MeshRenderer Component of this Object

to a variable of a script on another Object like

Problem: As soon as you click on the Capsule Object ofcourse the Inspector changes to this Object and I cannot drag in a component to the previous selected Object anymore.

I know there are a lot alternatives like linkin only the GameObject e.g. as MeshObject and later in code refer to MeshObject.GetComponent<MeshRenderer> but I wondered if this can be done directly, too.

sentences: Automated performance testing I'm wondering if there's anyway of automatically testing the performance of my game on multiple configurations because I know a game runs well on my computer but how do I know how well my game performs over a variety of hardware? Do I just simply have to rely on player feedback?

sentences:
How can I keep track of which "rooms" characters and NPCs are in? I have a Unity 2D project which has a player character and numerous NPCs all potentially moving (top-down) at the same time during play. The number of NPCs is not to exceed 100 (and will be, probably, more like 40-50) but I'd still like to be performant.

The "rooms" are really just rectangles that correspond to sections of my tilemap. All the "rooms" are contiguous, and hence all characters will always be in exactly 1 "room". Like if you picture the floorplan of a house, you're in the "Hallway" or the "Living Room" or the "Front Porch" or the "Driveway", and so on.

My tilemap is not complete, so it would be nice to be able to easily move the rooms around in the Scene editor as I refine it.

I was thinking I could...

Create Rect objects (or maybe an AABE, although I just read very briefly about what this even is) for each room inside a "RoomsController" GameObject, and then on each Update() iterate through each and see who is within the bounds of each room. But that seems majorly wasteful, and pretty brute-force even if done every few frames.
Create a GameObject for each room with an appropriately-sized BoxCollider 2D, and look for collisions with NPCs, and have a script that handles changing the active room on the NPC when he "collides" with a new room. But this requires a RigidBody 2D for each room, and it feels like overkill.

Is there an existing "right way" to solve this problem?

sentences: Hiding pixels inside a Shape I have a player wich is a png image and I want a part of him to be able to go behind things, so I need to know how to hide pixels that are inside of a shape

sentences:
How stencil buffer and glFrontFace help making a shadow? I'm trying to understand the tutorial 27th in Nehe website. This is about how to cast a shadow of an object using stencil buffer in OpenGL.
The idea here is checking the directions of all the faces of the object with the direction of light, and the result will define whether or not this face make a shadow.
In the case of making a shadow, we will draw "shadow" into the stencil buffer as the following code.

// First Pass. Increase Stencil Value In The Shadow
glFrontFace( GL_CCW );
glStencilOp( GL_KEEP, GL_KEEP, GL_INCR );
doShadowPass( object, lightPosition );
// Second Pass. Decrease Stencil Value In The Shadow
glFrontFace( GL_CW );
glStencilOp( GL_KEEP, GL_KEEP, GL_DECR );
doShadowPass( object, lightPosition );

My question here is why "glFrontFace" function in the second pass help remove shadow between objects in the scene?

I Hope to see your answer. Thanks so much!

P/S:this is the explanation in the tutorial, but I don't get it

"They are rendered in two passes as you can see, one incrementing the stencil buffer with the front faces (casting the shadow), the second decrementing the stencil buffer with the backfaces ("turning off" the shadow between the object and any other surfaces)."

sentences:
(Unity3D) Determine If Ray Intersects Given Rectangle I'm building a city generator for my game and I want to ensure buildings are never placed in such a way that they overlap roads. Currently I have the system build the roads, then place buildings alongside those roads.
I have the beginning and end points of the roads as Vector3s (only using X and Z, Y is never considered for road/building placement). For buildings, I use the size of their Box Colliders to check if they can fit in a given space (with rotation and scale applied appropriately). I've done a fair amount of research for answers on lines intersecting planes, though they always seem to be incredibly hard to follow or just don't properly apply to my situation (such as determining if the line is coterminous or not). I simply need to know if the line at any point exists within the bounds of the building's rectangle. I do not need to know where or at what angle.
I also understand that my problem is essentially a 2D math problem, as I'm ignoring Y, and some of the 2D solutions I've seen to this would be extremely costly to do in city generation.
Any help would be greatly appreciated.

sentences:
Corona SDK: Animation takes a long time to play after "prepare" step First off, I'm using the current publicly available build, version 2011.704

I'm building a platformer, and have a character that runs along and jumps when the screen is tapped. While jumping, the animation code has him assume a svelte jumping pose, and upon the detection of a collision with the ground, he returns to running. All of this happens.

The problem is that there is this strange gap of time, about 1/2 a second by the feel of it, where my character sits on the first frame of the run animation after landing, before it actually starts playing. This leads me to believe that the problem is somewhere between the "prepare" step of loading up a sprite set's animation sequence and the "play" step. Thanks in advance for any help :).

My code for when my character lands is as follows:

local function collisionHandler ( event )
    if (event.object1.myName == "character") and (event.object2.type == "terrain") then
        inAir = false
        characterInstance:prepare( "run" ) -- TODO: time between prepare and play is curiously long...
        characterInstance:play()
    end
end

sentences:
game story event programming I have developed a game engine in c/c++ and DirectX.

I have a tile engine for the maps, animated player/npc sprites, talking to the npc, menus, and level changing but there is no game, it just feels empty.

I have looked around and keep hearing buzzword answers but I want to know how to implement a story in my game.

Some people have said a save file that holds flags governing every possible action/state available in the game but this sounds ludicrous.

It is a bit ambitious but I am aiming to get a game like the older Pokemon/Final Fantasy games.

Does any one know how these games work or the theory used?

I have been looking for a while and would really appreciate any input people have.

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:
Unity - Which is more optimal persisting between scenes? `DontDestroyOnLoad` or `LoadSceneMode.Additive` User philip previously marked this as a duplicate question of this, but failed to actually read either question it seems. The question that this was marked as a duplicate of, does not address the Additive scene loading using Unity SceneManager.

Let me premise this with, this is not intended to be an "x vs y" opinion piece, I am simply looking for information on what is more optimal and what is the preferred way.

tldr;

I am new to unity and over the past week built a very small 2D 'Shooter' game to help me learn how to interact with the engine. When trying a new project and looking in to persisting game managers between scenes, I initially found the DontDestroyOnLoad syntax.

DontDestroyOnLoad vs LoadSceneMode

Which is more optimal for large games/scenes?
Both methods appear to do the same thing, except you create the scene yourself of additive scene loading.
New to Unity looking in to methods of persisting objects and in-memory data between scenes.
People mentioned the Unity Docs stating to not use DontDestroyOnLoad but I can't find this.

Essentially, I had the following on (at the time) two 'manager' scripts. When then calling SceneManager.LoadScene(#); in other parts of the code and in other scenes, these managers persisted between scenes.

using UnityEngine;
using UnityEngine.SceneManagement;

public class MyBehaviour : MonoBehaviour
{
    void Awake()
    {
        DontDestroyOnLoad(this.gameObject);
    }
}

It worked, no issues there. However when looking in to other methods to ensure what I was doing is 'good practice' and 'optimal' I had come across a few places mentioning not to use this method, a few people mentioned that the unity docs for DontDestroyOnLoad also reiterate this, I could not find such text. Instead, they mention having a 'Manager Scene' with all of the objects to persist being within that scene.

To implement this, I had to add a third manager, 'CustomSceneManager' that handles unloading the current scene and loading a new one, while persisting the current 'ManagerScene'.

using UnityEngine;
using UnityEngine.SceneManagement;

public class CustomSceneManager : MonoBehaviour
{
    private int _currentScene = -1;

    // This is in the manager scene, so the manager scene always gets pulled in to scenes
    // when a scene is switched via this method.
    public void SwitchScene(int sceneId) {
        if (_currentScene != -1) {
            SceneManager.UnloadSceneAsync(_currentScene);
        }
        _currentScene = sceneId;
        SceneManager.LoadScene(sceneId, LoadSceneMode.Additive);
    }
}

This method also works, with the overhead of a further empty GameObject / Manager to handle scene logic (I would likely need this to be a manager in the future anyway as I instance parts of the game) and the fact that anywhere I switch scene, I need to go via this manager, which means finding it/creating a reference where I want to use it vs just calling Unitys built in scene manager methods.

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:
URP water showing Differently in on Runtime I am using this water for my URP webgl build but the problem is it is showing differently on the editor. When I  run the game then it showing correctly and when I build and run it in the browser then it showing like the editor. here is the snap

water required Depth texture and opaque texture settings on and i have made it. Just start getting this problem from last two days. previously it was running fine. Here is the inspector:

Here are my URP settings and Quality SEttings:

sentences:
What is CC_Time in cocos2dx? I was following this tutorial to understand using custom shaders : http://www.cocos2d-x.org/wiki/User_Tutorial-Realistic_looking_animated_real-time_clouds

I understand that CC_Time is Cocos2d-x built-in uniform vec4-object that holds different versions of time in it's components.
Can someone please explain or point me to a resource so that I can understand what are its different components. Thanks.

sentences:
How to handle multiple enemies with the same script? i'm working on a basic Top-Down Shooter, kind of like... Nuclear Throne or The Binding of Isaac, but since i'm new to Unity, and it's something i'm required to do for school, i'm quite in a rush so i didn't have enought time to look at all the documentation i should've, so i apologize if i'm asking too much.

The thing is like this : I have the Player that moves around, and a Sword that rotates in the mouse direction, clicking the mouse activates a Trigger Collider around the Sword, and it's suposed to Hit all enemies inside its range

The problem :

How should i "plan" my Scripts? i mean, i have a Sword script that handles the click and the OnTriggerEnter, and it should, somehow (Working on it), check if it hit an enemy, and access the Enemy Script to modify its Life Points, but how do handle the GameObject Enemy = GameObject.FindObjectWithTag("Enemy")[...]? since this just gives me one enemy...

I apologize again since i'm really bad at focusing on one point, i dont think it's neccessary to provide all the code since i dont really need you to provide me with code, just... guidelines or a basic pattern of doing this kind of things.

Thank you a lot!.

sentences: Is there a turn-based game service (like GKTurnBasedMatch on iOS) for desktops? Game Center's GKTurnBasedMatch seems to provide a pretty robust service for handling turn-based games, and OpenFeint appears to have something similar. The problem is, I'd like something like this for the desktop. I was thinking of rolling my own REST-based service on Rails, but after looking at the GameKit documentation, I realized it would take longer than I'd like to make it solid. I don't suppose something like this already exists that I missed in my searches?

sentences:
Implementing time step in main game loop So ive read both http://gameprogrammingpatterns.com/game-loop.html and http://gafferongames.com/game-physics/fix-your-timestep/ and I kind of understand how I'm supposed to do it, but some parts are still blurry and I would like some guidance.

By the way, I have programmed my game from scratch and i do not want to change to some framework or anything that has an built in main loop, i want to do this by myself.

Anyway, this is what I have accomplished code-wise, I will re-produce my solution it in psudocode below.

func createPlayer()
{
oData = Empty Object()
oData.id
oData.name
oData.etc.....
Player = LoadSprite("filename", oData)
// Properties
Player.oSprite.x
Player.oSprite.y

Player.oSprite.scale
Player.oSprite.width
Player.oSprite.height
//Methods (Self-explanatory)
Player.oSprite.width()
Player.oSprite.height()
Player.oSprite.centerX()
Player.oSprite.centerY()

return Player
}

// Startup
oPlayer = createPlayer()
oWorld = 1D array of objects which has identical properties and methods from createPlayer()

// Main game loop
while(game){

 //User inputs
 _game_userInputs(byref oPlayer)

 // "Physics" jumps and world collission is done here.
 _game_Physics(byref oWorld, byref oPlayer)

 // rendering, draws the world frame with all inputs and physics done beforehand
 _game_render(byref boWorld,byref oPlayer)

}

This is how I "understand" what flow the loop should have

t = 0.0
dt = 0.0
currentTime = 0.0
accumulator = 0.0

while(game)
{

  newTime = _Timer_QueryPerformanceCounter() // Im feeling like this need something more than just the QueryPeformenceCounter?
  frameTime = newTime - currentTime

  if (frameTime > 0.25) {
        frameTime = 0.25
  }
  currentTime = newTime

game_input()

//This is causing my game to get stuck here, i belive it has something to do with my type of timer
 while accumulator > dt
 {
  game_physics(t, dt) //how is the deltatime helping me in my physics?
  t += dt
  accumulator -= dt
 }

 alpha = accumulator / dt
  game_render(alpha) // I dont know what im supopsed to do with this.
}

TLDR, what do i do with the t, dt in my physics? before i render?

sentences:
Cannot add key in matinee for static meshes (UE4) My problem is the following:
I was trying to make a sliding door based on a video tutorial, I had the static mesh, which was the door itself, and I added a Matinee for that door, so I went 'Add New Empty Group -> Add Movement Track', so I had the door with a movement track, but when I tried to add a key, I couldn't.
This was the error message: "Nothing to keyframe, or selected object can't be keyframed on this type of track."
And I only get this message when I try to add keys in the movement track of a static mesh. When it's a camera, everything is fine.
Any idea why this is happening, and how I can solve this?
Thanks for your help

sentences:
Help with a snake like movement I am looking for an algorithm that moves an object at a regular speed in a snake-circular like movement. This movement should look pseudo-random and smooth, later on I am going to add other body parts, but so far this is the essential.

My try so far has consisted in having a random value t that chages each frame:

t= Random.Range(t-20f,t+20f);

and according to it I was employing a direction. The result should be more directions that are smoothly different, so that the movement itself is smooth.

I would score the solution with 7/10, and moreover, it doesn't describe like short circles, but rather larger ones and the negative result is that the object exits the scene quite fast.

What is your algorithm solution? On the internet I found solutions where the player moves the head of the snake, but here the object acts like an autonomous object.

sentences:
How to Detect Mesh Segmentation? I have a mesh like this (it's all a single mesh):

How I can figure out that the one floating piece is completely disconnected from the rest of the mesh?

sentences:
Rotate an object with 'Quaternion.Slerp' in world space I'm currently working on a multiplayer skydiving Unity game in which i rotate the players like this:

transform.rotation = Quaternion.Slerp(transform.rotation, desiredRotation, delta);

Now this rotates the player relative to it's own rotation. I know rotation in world space is done by multiplying the quaternion of the desired positon with the quaternion of the current position like this:

localRotation = transform.rotation * desiredRotation
worldRotation = desiredRotation * transform.rotation

But how do i slerp to that position in world space?

Thank you all in advance and have a great day!

sentences: Swapping Framebuffers or swapping attachments? I wanted to know what the better approach would be for post-processing: swapping between framebuffers or swapping between textures attached to one framebuffer?

sentences:
How should renderer class relate to the class it renders? I am working on making a Pong clone as a practice project. I have a PongState class with members like Ball, Paddle, Board and Score. I want to structure my code so that each object doesn't have to know how to render itself, but a PaddleRenderer class will. I also want to create a PongStateRenderer class, which may use other classes like PaddleRenderer, as well.

How should I let PongStateRenderer know about the internals of PongState so that it can render it? The Ball object in PongState know's it's own position and size, does that mean Ball has to be a public member variable so that PongStateRenderer can also know the position, or is there a better way to do this without totally breaking encapsulation? Perhaps my architecture is totally wrong, and I should use a different method?

I'm working in C# as it says in the tag but a general answer that applies to many languages could also be helpful.

sentences:
Unity: Messages in Compound Colliders Lets say I have a 2D character with two colliders: a circle collider that represents the feet, and a box collider that represents the body. Lets say that the character is currently standing on the ground, i.e. only the feet collider is in contact with the ground collider. According to the Unity manual, I will receive an OnCollisionEnter2D message. That message contains a Collision2D object that contains an otherCollider field of type Collider2D. I don't see anything in that object that would tell me which of the two colliders - the body or the feet - initiated the message.

So my question is this: how do you figure out which collider in a compound collider initiated a collision/trigger message?

sentences:
Should I refer to browser-based games as HTML5 games or Javascript games? First of all, I know that there are alternatives to both HTML5 and Javascript, but I worded the question so generally ("browser-based") because if I had said "HTML5" or "Javascript" games that would already imply an answer to the question.

When writing wiki posts or discussing, I usually call these games "HTML5/Javascript" games. They are written in Javascript, using the new HTML5 technology. What is the proper way to call them: HTML5 or Javascript games? I see that most people opt for HTML5, why?

sentences:
Box 2D Collision Question I am very new to Box 2D Physics world. I wanted to know how to collide 2 bodies when one is Dynamic and other is Kinematic.

The whole Scenario is explained below:
I have 3 balls in total. I want to balls to remain in their places and the third ball to be able to move. When the third ball hits the other two balls then they should move according to the speed and direction from which they were hit.
My gravity of the world is 0 because I only want z-axis gravity.

I would also like some one to point me towards some good tutorials regarding Box 2D basics which is language independent.

I hope I have explained my scenario well.

Thanks for the help in advance.

sentences:
Controlling Unity 3D cube with remote gyroscope This probably will go into conceptual things as well, but what I would like to do is take a Raspberry Pi (with a Sense Hat), transmit the gyro values to Unity, and effectively have a 1-1 realistic representation of orientation changes.

I have no problem transmitting values from the Pi to Unity (though learning about hidden firewall rules was fun), however I am lacking some understanding of how to transform raw gyro values to something representative in Unity.

I have not calibrated the Sense hat recently, but know that is something that should be done.

For example, I am transmitting the pitch/roll/yaw values from the Pi (resting normally, these are about: 100.30272132022793, 351.3885231076573 354.9306950697191).

I have a cube gameobject that I've flattened out and set to the origin.

My question is basically, what is the best way to translate raw values from some anonymous object to the Unity coordinate system, and have it rotate appropriately?  I don't necessarily want its position to change, just rotation.

Screenshot for reference.  Raspberry Pi sending gyro data is on the left, Unity is on the right.  Tabletop (flattened cube) is what I'd like to rotate to simulate a ball balancer.

sentences:
Why would Assets.getBytes returns null in a test environment? I'm using the latest Haxe (2.10), NME (3.4.3), and MUnit.

I've written some unit tests that need to fetch bitmap data from SWF symbols. The first step is to actually load the SWF data. To do this, I use NME's getByteArray along with the swf library, like so:

var blah:SWF = new SWF(Assets.getBytes("assets/swf/test.swf"));

The call to Assets.getBytes returns null when I'm running this under MUnit. When running my actual game code, I'm able to get the byte array (and consequentially, instantiate the SWF class).

Am I doing something wrong? What am I missing?

Edit: My directory structure is:

. (root
.\assets
.\assets\*.png (other images)
.\assets\swf\*.swf (SWFs)
.\Source\*.hx (source code)
.\Test\*.hx (tests)

sentences:
Unity gizmos vs. referenced game objects I'm designing a Unity script that I intend to be highly reusable and as easy as possible to setup within the editor. To this end, a number of properties of this script really need some kind of visual representation on screen.

It is an unresolved question to me whether the design of the script should require references to placeholder game objects, OR just Vector3's and float's that have associated gizmos drawn for them.

Normally a gizmo would be a natural choice, except that Unity gizmos are not directly manipulable (as far as I can tell). Because of this shortcoming I'm having to consider whether depending on references to placeholder game objects is a more designer-friendly approach ultimately, in spite of the extra setup required, and that it might be counter-intuitive when the placeholder game objects disappear at run-time (which my script would do).

Is there a community standard or preference here in this case? Can a Unity-experienced game programmer / designer speak to which approach they feel is more intuitive or more convenient to setup, when using a 3rd party script? Or is this just splitting hairs as long as I ship an example prefab with my script?

sentences:
Unity Render Texture Artifacting I'm having weird black artifacts appear on my render textures when they are transformed while the game is running.

I am using a ScrollRect as a scrolling container for buttons (the buttons are just textured quads with the same render texture applied to them). When I translate the quads while the game is running, strange black artifacts will appear on the quads themselves.

Is there a way to fix this?

Edit: Interesting to note, setting every quad inactive except for one fixed the artifacting on the only visible quad: http://i.imgur.com/OInBBWs.png

The intensity of the artifacting seems to be related to the number of objects on-screen that use the same render texture. 5 quads active with the same render texture has a really pronounced artifacting, 3 is more subtle, 1 is visibly non-existent.

sentences:
In a 2D physics engine, how do I avoid useless collision resolutions when objects come to a rest? In a physics engine I'm developing (for learning) using love-2d, I implemented collision resolutions in this way:

FixedUpdate(dt)  // I use fixed timestep
 foreach collide c1 in allNotStaticColliders
   c1.integartePhysic // i.e. apply gravitational force..
   foreach collider c2 "near" c1 // "near"= I use spatial hashing
      if collide(c1,c2)
        resolve collision (c1,c2)  // the heavy operation
        collison callbacks c1
        collison callbacks c2
        ...

As you can see at the end of the gif animation, there's a FPS decay when all colliders are almost grounded over a static object.

This because the number of collision resolutions grows as objects spend more time touching as they settle. However, many of the calculations are "useless" because objects have already settled into stable positions against each other.

What's the best practice (hopefully not requiring a physics degree) to avoid these "useless" collision detections?

Edit : accepted DMGregory hints and come to this result   (not yet optimal)

(Red=static, Blue=active, Green=sleeping)

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:
Why do I have to switch T(v) texture coordinates while importing OpenGL to Direct3D? I am importing my code from OpenGL to Direct3D. My D3DTS_PROJECTION uses D3DXMatrixPerspectiveFovRH, and my D3DTS_VIEW uses D3DXMatrixLookAtRH to set a view equal to OpenGL's view. My question is why do I have to switch all of my 1.0000 Tex(v) texture coordinates to "minus value" in D3D to get equal texture mapping as in OpenGL.

OpenGL:

//T(u)   T(v)
1.0000,  1.0000,
0.0000,  1.0000,
1.0000,  0.0000,
1.0000,  0.0000,
0.0000,  1.0000,
0.0000,  0.0000,

0.0000,  1.0000,
0.0000,  0.0000,
1.0000,  1.0000,
1.0000,  1.0000,
0.0000,  0.0000,
1.0000,  0.0000,
// ...

Direct3D:

//           T(u)     T(v)
D3DXVECTOR2( 1.0000f, -1.0000f)
D3DXVECTOR2( 0.0000f, -1.0000f)
D3DXVECTOR2( 1.0000f,  0.0000f)
D3DXVECTOR2( 1.0000f,  0.0000f)
D3DXVECTOR2( 0.0000f, -1.0000f)
D3DXVECTOR2( 0.0000f,  0.0000f)

D3DXVECTOR2( 0.0000f, -1.0000f)
D3DXVECTOR2( 0.0000f,  0.0000f)
D3DXVECTOR2( 1.0000f, -1.0000f)
D3DXVECTOR2( 1.0000f, -1.0000f)
D3DXVECTOR2( 0.0000f,  0.0000f)
D3DXVECTOR2( 1.0000f,  0.0000f)
// ...

Is it because Direct3D's origin (0.0) of texture coordinates lies in different place than in OpenGL?

sentences:
Scene Transition in libgdx How can I make transition between stages in libgdx ?

I have 2 screens MenuScreen and GameScreen each of which has a stage

I write the following to make a transition :

in MenuScreen

SequenceAction sequenceAction = new SequenceAction();
sequenceAction.addAction(Actions.moveTo(-Gdx.graphics.getWidth(), 0, 4.0f));
sequenceAction.addAction(Actions.run(new Runnable() {
     @Override
     public void run() {
        gameMain.setScreen(new GameScreen(gameMain));
             }
     }));
stage.getRoot().addAction(sequenceAction);

in GameScreen

stage.getRoot().setPosition(Gdx.graphics.getWidth(), 0);
stage.getRoot().addAction(Actions.moveTo(0, 0, 4.0f));

but the problem is GameScreen does not following MenuScreen directly
i.e it wait until MenuScreen has completely gone from screen and I want them to move at the same time

sentences:
Batching Homogeneous Render Objects in XNA, 2D Component-Entity Engine? I've been working on my component-entity engine for about 3 months now, and have managed to get nearly every constituent system working with little effort or compromise. My system has the following attributes:

Components are mostly comprised of data.
Services (physics, networking, rendering, etc) operate on these components' data in a type-agnostic manner.
Components register themselves with their respective service provider on start-up.

One of the services I've been struggling to implement is rendering. I want a rendering service that keeps a list of my drawn components in an ordered list depending on what kind of drawing operations they require from the graphics device (i.e. different shaders, textures, draw order, etc) and then every frame iterates over the the list, grabs the indexed vertex arrays from the component and renders them using the settings specified in the "DrawContext."

In my research, I've stumbled upon the Nuclex.Graphics package which seems to solve a great deal of my concerns. It has an excellent implementation of vertex buffer object batching, queuing and such but it is not necessarily tailored towards a component-entity system. With Nuclex's design, all that is required is for my components to "queue" vertex buffer objects with the service which then batches them according to their "DrawContext."

My question is, how I can hide all of these vertex objects from the user? How can I enable my rendering service to draw both simple textured quads and complex stencil shadows while remaining type-agnostic? If you've worked on a component-entity system, how did you tackle complex rendering schemes?

sentences:
NullReferenceException in save game function I was making save system to save position of player.

I get an exception:

  NullReferenceException: Object reference not set to an instance of an object

It comes from this line: FloatPos[0] = DataG.transform.position.x;

Here is my Save Manager:

[System.Serializable]
public class SaveManger
{
    public float[] Player, Top, Ground, ET, ED;
    public int PN, PCN;

    public SaveManger(SaveGame SaveGame)
    {
        PosMath(Player, SaveGame.PlayerPos);
        PosMath(Top, SaveGame.TopPos);
        PosMath(Ground, SaveGame.GroundPos);
        PosMath(ET, SaveGame.EfTop);
        PosMath(ED, SaveGame.EFDown);

        PN = SaveGame.TransformMover.GetComponent<TransformMover>().PuzzleNumper;
        PCN = SaveGame.TopPos.GetComponent<PuzzleSetUp>().PuzzleCloneNumper;
    }

    public void PosMath(float[] FloatPos, GameObject DataG)
    {
        FloatPos[0] = DataG.transform.position.x;
        FloatPos[1] = DataG.transform.position.y;
        FloatPos[2] = DataG.transform.position.z;
    }
}

Here is my saved game component:

public class SaveGame : MonoBehaviour
{

    public GameObject PlayerPos,TopPos,GroundPos,EfTop,EFDown,TransformMover;

    public void Start()
    {
        string path = Application.persistentDataPath + "/GSave.GSF";
        if(File.Exists(path))
        {
            LoadButton();
        }
        else
        {

        }
    }

    public void SaveButton()
    {
        SAVESYSTEM.VoidSaver(this);

    }

    public void LoadButton()
    {
        SaveManger Data = SAVESYSTEM.LoadSave();

        TransformMover.GetComponent<TransformMover>().PuzzleNumper = Data.PN;
        TopPos.GetComponent<PuzzleSetUp>().PuzzleCloneNumper = Data.PCN;
    }
}

sentences:
Best algorithm for different shapes maze Based off my previous question here Maze or puzzle algorithm for something similar to noodles are there specific algorithms that would be best suited to building a maze with only 1 solution for

A grid made of squares.
A grid made from hexagonal tiles

Thanks

sentences:
Making an object orbit using c# script for Unity+Vuforia I have written a simple c# script for Unity+Vuforia. I want to create a simple sample project where an object like a sphere is revolving (orbiting) origin (0,0,0) above image target.

The code I have written is here

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

public class Orbit : MonoBehaviour
{
    float angles;
    float radiuss;
    float angleSpeed;

    // Start is called before the first frame update
    void Start()
    {
        angles = 0;
        radiuss = 0.2f;
        angleSpeed = 1;

    }

    // Update is called once per frame
    void Update()
    {
        angles += Time.deltaTime * angleSpeed;

        float x = radiuss * Mathf.Cos(Mathf.Deg2Rad * angles);
        float z = radiuss * Mathf.Sin(Mathf.Deg2Rad * angles);
        float y = 0;

        transform.position = new Vector3(x, y, z);
    }
}

It works perfectly fine if I am not using it with Vuforia, but when I attach this script as component to an object in Vuforia, it does not work and acts weird.
These are the configurations and hierarchy

Please help me out, I tried a lot of things.

sentences:
Developing AI for Zatacka I am trying to develop a stronger AI for the popular game, Zatacka.
The basic aim of the game is to survive the longest. It's like the TRON game, but the characters can only turn smoothly, instead of 90 degree turns.

I am new to game AI. I have the following ideas in mind, but I don't know how they can be implemented.

Collision prediction. If another player is about to come into the same area, then the player should turn around and try to evade.
Hole taking capability. How to detect holes. How to distinguish holes from a normal empty area.
Early detection of a dead end and being able to turn around before its too late. The problem with this how do we determine a dead end, it could be a bit far than our current position. Doing a path finding algorithm and searching for the wall or a player's body might not be efficient enough as this has to be done for each steps.

Are there any standard algorithms for these problems? Can somebody throw some light on how I can approach these problems?

sentences:
Double vision with Google Cardboard in Unity I am working on a VR app.

I have a terrain and some cube placed in the terrain.Even I have added the Reticle to point at the cube and display some message when the user gaze at the cube.

I have set the distortion to "None".

The problem I am facing here is,when I run the app the cubes and the pointer(reticle) is seeing as double in the scene.What will be the reason for it.Can anybody help me out please.

sentences:
Couldn't all games avoid post-start loading? Just as giant open world games load massive maps dynamically, couldn't we load separate maps, menus, and virtually any interface or 3D setting via that same dynamic loading method? Without changing the environment, it seem like interfaces and various locations within the game could all be loaded dynamically the same way massive open world maps are loaded as you walk through them.
Why isn't this done? I see so many modern games where you have to wait a minute or more while the match / map / level is loading. I know there's a latency involved with connecting peers, but that doesn't take more than a few moments in my experience. What issues exists with this concept to stop it from being used to eliminate loading time involved with loading map / level / interface data?

sentences:
Languages for creating 3d / 2.5d enviroments I want to pick up a language that will allow me to create 2d/3d game environments. I come from web development using PHP, JS, XML and ideally I want to be able to integrate with those languages. I want to deploy to the web and to PC / Mac.

I'm considering Java, Actionscript 3, or some variant of C.

I'm pretty good at picking new languages up so that isn't a consideration.

I have briefly tried Java and ActionScript 3 and the problem is that I'm having difficulty seeing what the strengths of each language are (that is without learning the entire language anyway).

So if a few people could champion their tool of choice, what strengths/weaknesses it offers for game development (feel free to include commercial advantages!), that would certainly help me, it may help others too.

sentences: LibGDX - Check if currently on Android/Desktop I'm using LibGDX and flixel-android to build a Desktop/Android game. It feels like there should be a way of checking to see if you're currently being run on an Android device, the Desktop, and so on, but I can't find it anywhere. Am I supposed to just pass it down from the individual launchers? Surely LibGDX can just tell me?

sentences:
separate fixed-size animation sheet into texture atlas I'd like to separate a 64px x 512px spritesheet into eight 64px 64px images in Adobe photoshop cs 5 so I can use a Texture Packer image atlas rather than a fixed spritesheet.

Is this possible? If so, how?

sentences:
Gyroscope Parallax Effect In Unity I want to make a parallax effect in Unity 3D with gyroscope like the one on this site:
http://matthew.wagerfield.com/parallax/

I found an asset, but it is too expensive.

So I need a script which I can set to the GameObject, so it would move depending phone's gyroscope.

sentences:
Calculating impulse propagation through a rigid body after a collision I'm working on a game. I need to work out what the impulse is at different points on a body as a result of a collision.

For example, in the following diagram, if there is a collision that results in an impulse being applied to the body at A, what will the resulting impulse be at B? I know the mass, center of mass and dimensions of the body.

sentences:
Making a 2D gun spin from recoil when it shoots I am trying to clone the game "Flip the Gun" as an exercise.
Here is the behaviour I have so far.
And here is the code I am using:
if (Input.GetKeyDown(KeyCode.Space))
{
    rigidbody2D.AddForceAtPosition(
                transform.position-recoilPoint.transform.position * recoilForce,
                recoilPoint.position,
                ForceMode2D.Impulse
    );
}

As you can see in the video, the gun is moving too fast and rotating too fast. It seems out of control. I am not sure if the way of adding force to the gun is correct or not.
Thank DMGregory for editing the question for me. I am new to this family so that helped a lot. :)

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:
Get the player front position at specific distance The simple way to get player front position at specific distance

     Vectro3 forward = player.transform.forward * distance;
     Vector3 newPlayerFronPosition= player.transform.position + new Vector3(forward.x, forward.y, forward.z);
     newPlayerFronPosition= new Vector3(newPlayerFronPosition.x, newPlayerFronPosition.y - 4f, newPlayerFronPosition.z);
     navigationCanvas.transform.position = newPlayerFronPosition;
     navigationCanvas.transform.rotation = camRotationToWatch.transform.rotation;

its actually working fine but the problem is as my player move up or down the navCanvas become appear ver near to my player. How to mainitain spcific distance all the time.?? that no matter player look above or down the navcanvas display at specfic distance.(position)

disatnceUICam = Vector3.Distance(newPlayerFronPosition, player.transform.position);

I also logged the distance and surprisingly it the distance is changing when i am moving up or down. its changing from 6 to 12 as i am looking up to down.

sentences:
Prefab instantiate or create gameobject at runtime? I'm developing a skill system for a client-server game, all available player's skills server send to it, then client load it and put it to a spellbook.
So I stuck in loading stage, how for performance and/or memory will be better:

Save all spells in a bunch of prefabs and then just instantiate them
Create JSON/binary/etc file, parse them and create a gameobject at runtime

From the side of editing, both methods are equal.

sentences:
How can I find the location of OpenGL object after rotation? I have a rotating object, a cube, which I rotate in OpenGL as follows:

gl.glPushMatrix();
gl.glTranslatef(400.0f, 300.0f, 1300.0f);
gl.glRotatef(m_x, 4.0f, 0.0f, 0.0f);
gl.glRotatef(m_y, 0.0f, 4.0f, 0.0f);
gl.glRotatef(m_z, 0.0f, 0.0f, 42.0f);
gl.glCallList(++shapeNumber); // cube 2
gl.glPopMatrix();

(m_x, m_y, and m_z are the change in the rotation each frame.)

I want to detect a collision between the camera and that rotating object, and to do that I need to get the coordinates of the rotated object in real time. How can I accomplish that?

sentences:
Smooth 1D terrain generation So I'm pretty happy with my terrain, and the progress on my game. I just want to figure out why the terrain is so steep sometimes. Right now to generate my random seed I use this:

seed = (long)(Math.random() * 10000000 + 12345670);

It works, but some of the seeds just make a really steep point hill, while I'm looking for more bumpy-flat maps (similar to Terraria's).

Here's my create terrain loop:

for (int i = minX; i < maxX; i++) {
    int columnHeight = p.getNoise(i, maxY);
    for (int j = 0; j < columnHeight; j++) {
        System.out.println(columnHeight);
        map[i][j] = new Tile(i * 8, j * 8, 8, 8, TileType.Grass);
    }
}

Here's the class I'm using to try to generate terrain. I tried tweaking parameters but nothing works, and I just keep getting crazy random hills.

public class Perlin {
    private long seed;

    // Constructor to create a seed
    public Perlin(long seed){
        this.seed = seed;
    }

    // Fetches a random value
    private int random(int x, int range){
        return (int) ((x + seed) * (x + seed) * 8) % range;
        // o = (int) (((x + seed)*(x + seed))*5) % range
        //return o;
    }

    // Calculates the noise
    public int getNoise(int x, int range){
        int chunkSize = 64;

        int chunkIndex = x  / chunkSize;

        float prog = (x % chunkSize) / (chunkSize * 1f);

        float left_random = random(chunkIndex, range);
        float right_random = random(chunkIndex + 1, range);

        float noise = (1 - prog) * left_random + prog * right_random;

        return Math.round(noise);
    }
}

Here's a picture of the terrain compared to what I want (what I want is in red):

EDIT
So I understand what you guys mean about the previous Perlin class not actually being perlin noise. I fixed it with some tweaking and using actual perlin noise, the only thing I'm partially confused about is the seeds, and how do they work..

for example in Java this is how they do it

x = (x<<13) ^ x;
return (float)( 1.0 - (( (x * (x * x * 1376312589 + 789221) + 1376312589) + 3517) & Integer.MAX_VALUE) / 2543768824f);

if someone could explain what all that really means it'd be great, and why does it use prime numbers?

sentences:
Simple game engines / development tools made with artists in mind? I've been working in the 2d art side of games for a while now, and my full time job keeps me very busy on the art side of things, but I'm becoming more and more interested in learning to prototype my own games.

I know very very little programming, though I did take some in college (in TorqueScript, of all things), and while I could probably take the time to learn it, the learning curve is a bit too steep for me as it's completely separated from my current job.

I'm wondering if there are any game engines out there with an interface designed with artists in mind, where the learning curve might be easier for me, and where my current skill set will be more easily applied. I bought an indy license for Torque Game Builder but it still requires a lot of scripting and finding good, basic, entry-level tutorials is proving difficult.

Basically I'm looking for a tool where I can focus on the art and game design, and where the programming is minimal, or is easy to learn and has really excellent documentation. No idea if anything like that exists, but it's worth a shot. :]

Any ideas?

sentences:
Do I need to dispose Pixmap in Actor? I create Pixmap in Actor and don't know how to dispose it. Is it necessary in my case?

class MyActor(x: Float = 0f, y: Float = 0f): Actor() {

    var pixmap = Pixmap(1, 1, Pixmap.Format.RGBA8888)
    var texture = Texture(pixmap)
    var sprite = Sprite(texture)

    init {
        setPosition(x, y)
        sprite.setSize(32f, 32f)
        sprite.setPosition(this.x - sprite.width/2, this.y - sprite.height/2)
    }

    override fun act(delta: Float) {
        sprite.setPosition(x - sprite.width/2, y - sprite.height/2)
    }

    override fun draw(batch: Batch?, parentAlpha: Float) {
        sprite.draw(batch)
    }
}

sentences:
Instantiate a new Prefab I’m developing a little 3D game to improve my Unity C# development.
However, I am faced with a recurring error that I cannot find the solution to :/
In fact, I always get the error Nullreferenceexception: Object reference not set to an instance of an object when I want to create a new Gameobject in my scene.

I wish I could spawn a bonus based on a percentage of chance when an enemy is killed.

So I created a Bonus mother class and a Bonushealth daughter class. So Bonushealth inherits the Bonus methods.

Here’s the mother class code (Bonus) :

using UnityEngine;

public class Bonus : MonoBehaviour
{
    protected int lifeTime;

    public int LifeTime { get => lifeTime; set => lifeTime = value; }

    protected void RandomDropBonus(Transform posEnemy)
    {
        int chance = Random.Range(1, 100);

        switch (chance)
        {
            case int n when (n <= 100):
                Instantiate(Resources.Load<GameObject>("bonus"), new Vector3(posEnemy.position.x, posEnemy.position.y, posEnemy.position.z), Quaternion.identity);
                break;
        }
    }

    public void RandomBonus(Transform posEnemy)
    {
        int rdn = Random.Range(1, 1);
        Debug.Log(rdn);

        if(rdn == 1)
        {
            RandomDropBonus(posEnemy);
        }
    }
}

Here's the daughter class code (BonusHealth) :

using UnityEngine;

public class BonusHealth : Bonus
{
    public GameObject prefabHealth;
    // Start is called before the first frame update
    void Start()
    {
        LifeTime = 10;
    }
}

I call the RandomBonus() method when an enemy is killed (in the Enemy class), Here's is the code :

private Bonus bonus;
bonus.RandomBonus(this.transform);

if I make Bonus bonus = new Bonus()
I always get this error : ArgumentException: The Object you want to instantiate is null.

In my prefab folder is contained my bonus prefab named bonus. I added the Bonushealth script on it.

I did a lot of research on the Internet but no way to find a solution :/

Thanks in advance ;)

sentences:
How do I get an object from a .osg file in OpenSceneGraph? I decided instead of using a really heavyweight engine like unreal that I am going to use SDL and Openscenegraph.

I would expect it to be something like:

osgObject* box = file->GetObject("Box");

sentences:
Any tips on figuring out programming in Unreal Engine (without focusing mainly on blueprints, or at least a fairly even mix of the two?) So for the past few months I've been attempting to learn Unreal Engine. Most tutorials feature blueprints which I guess makes sense as it's new and simple and their solution to artists trying to make games. However, when learning to code or program anything, I've always valued actually understanding what I'm typing in. It makes it easy to remember, especially when it's not a habit like say, typing in int main()
before starting your C++ code.
When I need to write code spontaneously, I find it valuable to understand what I'm typing in.

However, UE4's usage of C++ is almost as if you're learning a new derived language, which is what was once done by users of Unreal Engine. Outrageously though, I've found no source which explains the vast amount of macro's and jargon used when programming games in UE4. Thing's such as GENERATED_UCLASS_BODY() or void SetupPlayerInputComponent(class UInputComponent* InputComponent) override;
Perhaps the terms void, class, and override have been mentioned in typical C++, but the Unreal API is a mystery, and I've found no place where I can know what any of this actually means, or more importantly -in my view of course-, why I'm connecting them the way I'm told too. It's somewhat obvious that all these are related, but it's harder to uncover how they're to be formatted and linked together. Does anyone know a way I can get a better understanding of the library of macros and terms Epic has taken no time to explain?

sentences:
How do I get the size of a Plane in pixels and set it multiplied by some factor to be the size of a Sphere? I am doing an attempt to make a 3D snake game, as an experiment but I am still a beginner. I have a Sphere that I wish to dynamically resize to be, let's say, the 20th part of the width of this Plane. How can I do this? I thought to find the size of the Plane first. I also thought to use Screen.width and Screen.height because in my actual project the Plane is almost the size of the screen, but from what I found the Transform class does not have a way to resize it to a specific dimension in pixels.

Using the code below I do not get this work, but I also see that the Sphere becomes a black circle because of the only instruction in the Start method.

Existing code

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

// Attached to the Plane
public class SphereResizer : MonoBehaviour
{
    // Start is called before the first frame update
    void Start()
    {
        // what should I put here?
        GameObject.Find("Sphere").transform.localScale = new Vector3(1f, 1f);
    }

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

Screenshots

Download the example

Here is the GitHub repository.

Thank you.

sentences:
Resources to learn XNA for a professional c# developer I'm a .net consultant (mainly c#) for my job, but for a while now, I've been interested in making a game in XNA (as a hobby project).

I've had a "beginner" course in XNA when I was still a student, but I've lost most of the information (plus, it was VERY beginner, not enough to get you really started).

So my question, which resources would be useful for me to learn XNA (books, blogs, websites, tutorials, resource websites - like textures, audio files, etc..)?

I know this is a very open question, but I'm thankful for any information.

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 do I keep a rigidbody from making unnecessary collisions on smooth surfaces in Unity3d? I have been having trouble with a custom character controller I am making. The root of the problem lies with collisions. I am trying to make movement code, but I have a problem with ground movement. Pay attention to this gif. It might be hard to notice due to the low frame rate, but the collider registers collisions with objects (in red) that do not point out of the ground. They share the same y-position as the ground. I've printed the normals of the collisions, and there are a lot of normals that are perpendicular to the normal of the ground (which is causing the rigidbody to get stuck).

The problem lies with collisions in unity. If I were to print the y-position of the bottom of my collider, it would be just a tad lower than the y-position of the ground. The collider actually rests below the ground by an almost negligible amount (which is why it doesn't always collide with these objects).

Here is what I have tried: I created a function that runs at the beginning of every FixedUpdate() that uses current collisions to change the y-position of the rigidbody. It only runs on collisions that would ground the player (meaning that they are below the collider). The problem with this approach is that the same issue can occur with walls, meaning that the collider can get stuck on walls. I cannot create another function that would do the same for walls for various reasons.

Here is what would fix the issue: I need help figuring out how I can make collisions more discrete in unity. Colliders rest slightly below objects when ontop of them. They can also "sink" just a little into walls. In other words, colliders can rest into other colliders, and I need this to stop.

Any help is appreciated. Thank you.

sentences:
Ball bouncing within polygon I saw there are quite a number of articles and sample code regarding ball bouncing within a rectangle.

Is there any articles or sample code regarding ball bouncing within a polygon? I try to look into Box2D demo, I can't find one yet.

sentences:
StartCoroutine function inside TriggerOnEnter2D not working - unity + kinect So i'm using Kinect with unity to track user's hand movements, and let the user's hand act as a mouse, I have written the code to detect a collision between a button (sprite object) and the hand cursor using OnTriggerEnter2D, but I want the hand cursor to remain on the button (sprite object) for atleast 3 seconds for it to be considered as a button click action. The WaitForSeconds coroutine doesn't seem to be working. What am i doing wrong?

public class MenuSelect : MonoBehaviour{

private string btnName;
private string themeName;

// Use this for initialization
void Start ()
{
    //gestureListener = Camera.main.GetComponent<GestureListener>();
}

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

}

void OnTriggerEnter2D(Collider2D col)
{
    //print("Collision Detected");
    StartCoroutine(WaitTime(3));
    if(col.gameObject.tag == "Button")
    {
        btnName = col.gameObject.name;
        switch(btnName)
        {
            case "musicBtn":
                Application.LoadLevel("Menu_Music");
                break;

            case "startBtn":
                Application.LoadLevel("Menu_Select");
                break;

            case "instructBtn":
                print("Instruction Clicked");
                break;

            case "exitBtn":
                Application.Quit();
                break;

            case "themeBtn":
                Application.LoadLevel("Menu_Theme");
                break;

            case "backBtn":
                Application.LoadLevel("Menu_LoadScreen");
                break;
        }
    }

}

IEnumerator WaitTime(float waitTime)
{
    yield return new WaitForSeconds(waitTime);
    print("seconds up already");
}   }

sentences:
Forcing Proportion Lock on Layout Element I'm trying to develop a Card-Game in Unity3D using 2D mode.

Every Card GameObject on my Scene contains a Layout Element Component with following parameters:

The parent container, a Panel has a Horizontal Layout Group Component with this settings:

Now i have this parent control multiply times on my Scene with different sizes. But now its destroys the proportions of my Card, as you can see below on the screenshot.

So is there a way to ensure the proportions of my Card when scaling or shrinking the parent Panel?

sentences:
Detecting on which side of the box a collision occurred Explanation

I have a rectangle with a trigger on it when it's hit by my player game object from the side it's supposed to activate a certain method. Illustration:

And when it's hit from the bottom or top it's supposed to activate an other method. Illustration:

However the way I'm checking what method to use is not working in all cases.

Problem

There are some cases where the player is hitting the side of the rectangle but the method being called is the one supposed to be called when the rectangle is hit from the bottom or the top. When the player is hitting the top or bottom everything is working just fine.

Code

protected override void OnCollision(Collider2D coll, PlayerMovement player)
{
    float playerMaxY = player.YCord + player.Height / 2;
    float playerMinY = player.YCord - player.Height / 2;

    //YCord is the y coordinate of the rectangle
    float thisMaxY = YCord + Height / 2;
    float thisMinY = YCord - Height / 2;

    base.OnCollision(coll, player);

    //This condition here is where i need an improvement
    if ((playerMinY >= thisMaxY && playerMaxY >= thisMaxY) ||
        (playerMinY >= thisMinY && playerMaxY >= thisMinY))
        BounceHorizontal(coll, player);
    else
        BounceVertical(coll, player);
}

sentences:
Calculation of a fight with many entities User A can have many entities

A Entity is a object that has properties such as health, attack, defence, agility, stamina, etcetera.

When User A want to attack User B with x entities I am looking for the algorithm/equation to calculate the fight. I have brought some couple of ideas but they all have some pros and cons and I am not sure which one I would use or If I should use one of them at all?

Model A - The while loop
Basically I would get all the entities that is suppose to fight in this battle, I would assign each of them (objects) in to an array (the User A array and the User B array). Now I would simply loop through until one of the array is empty. Inside the loop I would let one of the User attack first, calculate the result (If the Entity has 0 health, remove it) and then let the next User attack back, calculate the result (If the Entity has 0 health, remove it) And then continue.

The Pros with Model A would be that every entity would be battling and instead of just do a calculation on all around there would be a justice fight.

The Cons To loop through like 10 entities would be fine but what about 1000-2000 entities? And how about the different strength of each entity I mean how could I decide which entity should battle against what entity? This could be just an sorted array (weakest > to strongest) But then I couldn't have like different types of entities is better against a different type of entity, meaning like a Gunner  wouldn't mean anything If it met a Swordsman even though a Gunner would most likely win such in a real fight.

Model B The idea of Model B is quite simple basically calculate all the attributes (properties) together and then If User A army has greater stats than User B army, User A army would win the fight. The Pros with this is it easy on the performance. The Cons are "Which entities would survive?" And it would basically be, the one with greatest army would win. You wouldn't even have a "chance" to win.

Model B B Then I started to think what If I take the concept of Model B  calculate the stat and then I have a battle between just those two single entities. This way User B actually would have a chance ( a small one but the possibility to win) even though the User A has greater army (better stats). The Cons are yet again, How would I know which entities that would survive on the winning team?

The answer I am looking for to this question is what Model should I use? And how would I solve the cons in that particular Model. Or should I use some completely different model (idea) ? (If possible please provide some php pseudo code)

sentences:
OpenGL VBO Additional Attributes If I have a buffer with my vertices, normals and texture coordinates, and I use glDrawArrays to draw the VBO to the screen, how can I send attributes per vertex that I placed in an array to the shader program? I'm making a voxel terrain, and every chunk is 1 VBO, this works all great, but I want to send the light value of each block (Just an array filled with int's) to the shader as well, how would I do that?

Edit: After reading some comments, here some clarification:
I'm trying to avoid the deprecated glVertexPointer etc, so I'm using Vertex Arrays. Here is the layout of my vertex array:

X, Y, Z, NX, NY, NZ, X, Y, Z, NX, NY, NZ,X, Y, Z, NX, NY, NZ

I'm using this to draw it: (ofcourse with the array buffer bound)

glVertexAttribPointer(0, 3, GL_FLOAT, false, 12, 0);
glVertexAttribPointer(1, 3, GL_FLOAT, false, 12, 12);

glDrawArrays(GL_TRIANGLES, 0, arraySize / 6);

However I get some weird shapes on my screen. Apart from the light problem, that is essentially the same thing, I don't get why this doesn't just work. When I remove the normals, and use just 1 vertexattribpointer it works fine. Yes, the attributes are bound to in_position and in_normal, and the vertex shader is nothing more than gl_Position = gl_ModelViewProjectionMatrix * vec4(in_position, 1.0);

Thanks!

This is what I get:

(This are 6X6 chunks, so this code is called 6*6 times.)

sentences:
Stats on Screen Size for Flash Games I'm working on a Flash game after many, many years. I'm trying to figure out size to make my application run (eg. 600x800). Because it's a tall (not wide) game, I'm confused.

I know about (and love) the Steam hardware stats. However, for Flash gaming, I have two nit-picks with their survey sample:

1) Caters to more hardcore gamers with better hardware (overall)
2) Captures only a subset of Flash gamers. Doesn't capture people who play at school, work, etc. or not netbooks and lighter machines.

Are there any sort of statistics I can use to determine which size to use? Ideally, I would like to know something like:

800x600 will fit 94% of users screens
1024x768 will fit 74% of users screens
1200x960 will fit 53% of users screens
etc.

sentences:
Pros & Cons on different game engines I've been working with the XNA-Framework(only in 2D) for over a year now. Now I want to try and start a bigger 3D-project. But somehow I have difficulties to decide which engine/Framework I should use. So far I gathered three possible Frameworks, I want to list here:

XNA with the OX-engine: I already have some experience with XNA and the Ox-engine seems to be the best possible open source engine I could use here.
OGRE-engine: Always wanted to get a little deeper into C++ and the engine seems to be well documented.
Cryengine/Sandbox 2 or higher: Well this one also needs C++ knowledge, seems to be user friendly and lets face it one of the most powerful engines out there.

My goals are to start learning 3D-programming and to realize first 3D projects by taking baby steps.

So the question is what engine would you guys recommend? Is there any other stuff I have overseen? as mentioned before getting a little more into C++ would be great to but it is not a "must have" as I alredy worked with C/C#. Most important to me would be that I could lear stuff that I can use later on for example in other Frameworks. This is important to me because I want to get deep into one thing I will be doing for a long time.

Thanks in advance!

sentences:
Missing UI options in Inspector window when I import FBX files I am missing all the animation options in the Animation tab in the Inspector Window when importing FBX files.

In the picture below, there are only 2 checkboxes. I can't see the list of animations, options, animation events etc., but you can see on the lower left window that the animations we're imported. Also, the Materials tab is empty as well.

This FBX was exported from Blender. If I directly drag the .blend file to Unity, all those tabs appear normally, but when dragging an FBX, they become empty. I am using Unity 2019.3.0f6.

sentences:
Find normal based on rotation? Given the XYZ rotation of an object, e.g. (90,0,0), how can I find the object's normal assuming the object is pointing along it's local Z axis?

In the above example the desired result is (0,1,0).

I'm using blender, but this seemed like more of a general math question so I decided to ask here..

sentences:
(Phaser) Preload Future States in Create? I'm a first time user of Phaser, been trying to make a simple point and click type game. I'm trying to keep things very modular, so I'm defining a list of levels (states) in a JSON, and then every level has its own JSON containing the objects within that level.

However, I'm encountering an issue in that, when changing states, I get a black flash while the assets for the next state load (this happens whether I iterate through the JSON list or define everything manually). From what I've read, all sprites should be loaded in the preload stage, however, by doing this I'm causing that tiny but noticeable black pause.

I know one way would be to simply load every asset at the start of the game, but that seems incredibly inefficient (wouldn't that fill up the memory immensely?). I would rather load a state's assets from the "parent" state. However, in my quick test (which maybe I did wrong) it seems that game.load doesn't work properly if done within the create stage? What is the best approach to doing this?

sentences:
Timer breaks after changing scenes I am using this script below to move an animation in unity with no root-motion. It simply walks across the terrain.

I have timer attached also so the animation doesn't start to walk for 60 seconds. This works fine in the scene when played…but when I navigate into this scene from another home scene the timer delay doesn't work as I guess it has been triggered already and has already reached the 60 second mark? I have tried using DontDestroyOnLoad but this just recreates the animation in the home scene also.

I'm trying to keep the code as simple as possible and maybe add to the code below to fix it:

void Update ()
{
    if (Time.time > 60)
    {
        transform.Translate (0, 0, Time.deltaTime);
    }
}

sentences:
How to create simple acceleration in a 2D sprite? So here's what I thought might work but half the time I press the 'Right' key, it results in a crash and the rest of the time seems to produce no acceleration at all.

if (KeyboardState.IsKeyDown(Keys.Right))

            while (motion.X < 1)
                motion.X += 0.001f + motion.X;

I want to know why exactly it won't work, and any possible alternate algorithms.

sentences:
ScriptableObjects lose references/stored objects upon build/restarting the Unity Editor? I'm working on implementing room prefabs for my 2D procedural map generation algorithm.

Basically I made a tool which parses a scene's

monsters, items, etc into an ObjectContainer prefab,
and into a ScriptableObject containing the tilemap's TileDatas, EntryTiles, and the ObjectContainerPrefab.

It works well, but my problem occurs when I try to build the game, or just restart the editor.

The TileData array will be empty.

And thus for example the EntryTiles' TileData reference will be null.

Here 's how I use them:

[MenuItem("Custom Tools/Parse room prefab from scene")]
private static void ParseRoomPrefabFromScene()
{
    var tilemap = GameObject.Find("Tilemap").GetComponent<Tilemap>();
    RoomPrefab roomPrefab = ScriptableObject.CreateInstance<RoomPrefab>();
    ParseTilemap(roomPrefab, tilemap);
    ParseObjects(roomPrefab, tilemap);
    ParseEntryTiles(roomPrefab, tilemap);
    AssetDatabase.CreateAsset(roomPrefab, "xyz.asset");
    AssetDatabase.SaveAssets();
}

// How I setup my scriptable object, i.e. in ParseTilemap:
var tileDatas = new List<TileData>();
...
    var tileData = new TileData(coordinates, unityTile, isWall);
    tileDatas.Add(tileData);
...
roomPrefab.tileDatas = tileDatas.ToArray();

Here are the classes:

public class RoomPrefab : ScriptableObject
{
    public TileData[] tileDatas;
    public EntryTile[] entryTiles;
    public ObjectContainerPrefab ObjectContainerPrefab;
}

[Serializable]
public class TileData
{
    public TileBase UnityTile
    {
        get;
        private set;
    }

    public Vector2Int Coordinates
    {
        get;
        set;
    }

    public bool IsWall
    {
        get;
        private set;
    }

    public TileData(Vector2Int coordinates, TileBase unityTile, bool isWall)
    {
        Coordinates = coordinates;
        UnityTile = unityTile;
        IsWall = isWall;
    }
...

[Serializable]
public class EntryTile
{
    public TileData TileData
    {
        get;
        private set;
    }

    public Vector2Int LeaveDirection
    {
        get;
        private set;
    }

    public EntryTile(TileData tileData, Vector2Int leaveDirection)
    {
        TileData = tileData;
        LeaveDirection = leaveDirection;
    }
...

[Serializable]
public class ObjectContainerPrefab
{
    public Vector2Int Coordinates
    {
        get;
        private set;
    }

    public float Rotation
    {
        get;
        private set;
    }

    public GameObject Prefab
    {
        get;
        private set;
    }

    public ObjectContainerPrefab(Vector2Int coordinates, float rotation, GameObject prefab)
    {
        Coordinates = coordinates;
        Rotation = rotation;
        Prefab = prefab;
    }
}

UPDATE: here is a freshly parsed scriptable object. In the Editor everything is fine, while in its file its tileDatas array is already empty. Why?

%YAML 1.1
%TAG !u! tag:unity3d.com,2011:
--- !u!114 &11400000
MonoBehaviour:
  m_ObjectHideFlags: 0
  m_CorrespondingSourceObject: {fileID: 0}
  m_PrefabInstance: {fileID: 0}
  m_PrefabAsset: {fileID: 0}
  m_GameObject: {fileID: 0}
  m_Enabled: 1
  m_EditorHideFlags: 0
  m_Script: {fileID: 11500000, guid: 30263215ad3a45a479bb2dd6409fb0a9, type: 3}
  m_Name: TestRoom
  m_EditorClassIdentifier:
  tileDatas: []
  entryTiles:
  - DebugCube: {fileID: 0}
  - DebugCube: {fileID: 0}

sentences:
photon unity why error GO:Networking Manager appears when trying to make the scene not restart / reload when another clients join the room photon unity why error
Debug.LogError("Illegal view ID:" + view.viewID + " method: " + methodName + " GO:" + view.gameObject.name);
appear
the code
 private void OnJoinedRoom()
{
    Debug.Log("OnJoinedRoom");
    PhotonNetwork.automaticallySyncScene = true;
    if (PhotonNetwork.isMasterClient)
    {
       GoToGame();
    }
    else
    {
        StartCoroutine(ReloaSceneCor());
    }
}

IEnumerator ReloaSceneCor()
{
    //send RPC to other clients to load my scene
  //  mainplayer.GetComponent<PlayerScript>().photonView.viewID = 1;  i added this but not working perfectly, it
    mainplayer.GetComponent<PlayerScript>().photonView.RPC("LoadMyScene", PhotonTargets.Others, "SampleScene");
    yield return null;
    PhotonNetwork.isMessageQueueRunning = false;
    //PhotonNetwork.LoadLevel(SceneManager.GetActiveScene().name); //restart the game
    PhotonNetwork.LoadLevel("SampleScene"); //restart the game
}
[PunRPC]
public void LoadMyScene(string sceneName)
{
    Debug.Log("REcieved RPC " + sceneName);
    PhotonNetwork.LoadLevel("SampleScene"); //restart the game
}

sentences:
What are some good namespaces for gameplay code? I always struggle with naming namespaces when working in a team. I'd be very thankful if someone could share your preferred way of namespacing gameplay code? At least the root namespaces.

Edit: As this question has been downvoted I'm adding more details -
I'm basically looking for a namespacing template/examples that could be easily reused on many projects and won't have names like MarioCharacterNamespace which will obviously last a week. Also no maintenance greedy dependencies like depending on the company name or project name. I also tend to end up with very long namespaces like Game.Battle.BattleLogic.Controllers.Enemy and such that I'd also like to avoid.

So some template that's not too specific nor too general and can easily be reused on many projects at least in the beginning.

sentences:
Zooming in on procedural generated 2D terrain? (LOD) My question is what methods are there to "zoom in" on a procedurally generated map using Perlin Noise (or Simplex).

If I have for example this generated

and I wanted to "zoom" into that little red square I drew, how could I achieve something to the likes of this (ugly drawn) example:

While staying true to the terrain above? I have heard of 3D methods but couldn't find any meant for 2D maps.

Any advice or help would be appreciated.

sentences:
Kart Racing Attack AI I am developing a kart racing game.  In it, the players fight with each other while racing.

There were several ways I tried to add attack AI to the enemies and the player.

When the user clicks on the attack function, it throws raycasts in the certain area; if enemy is found then the user gets presented with the weapon and auto attacks occurred.

Later I moved on from this code for two reasons, first very dirty and highly unoptimised and second it's only able to calculate limited distances (not for missile weapons which are long range); a new approach needed to be implemented.

After thinking and researching I tried Physics.Overlap; this did solve my optimization problem with short range weapons but still the problem of long range persists.
Thinking around more I came up with other ways to implement long range attack, i.e., by spawning one collider just a little behind the player and it will go foreword until a certain distance and if the enemy gets found it will inform the player and the weapon will be spawned and attacked.

Though that third approach looks good so far, the problem arises when the game gets high pace as the collider sometimes do not catch the other players or get too slow to catch the other players and result of that buggy attack look.

So I would like to know: is there any other way to implement long range attacks considering it is a kart racing game?

Any help will be appreciated

sentences:
Checkers games with computer random movement Im studying Java OOP, and I have to make first assignment about making checkers board game. I have to get input from user if he plays, and than when his turn is over the computer will play. Computer's movement is random but if he has the opportunity to "eat" his rival, he has to do this and if not than making random move.
Can someone help me with the coding?

sentences: New to creating AI - where to start? I am new to game programming and am trying to make a basic 2d top-down space game with 2 space ships that fight each other.  I am doing well with the user controlled space ship, but have no idea how to even start programming an AI.  Are certain methods/patterns better for this situation?  Where would I even begin?

sentences:
Any interesting thesis topic? I study Computer Science at Technical University of Lodz (in Poland) with Computer Game and Simulation Technology specialization. I'm going to defend BSc thesis next year and I was wondering what topic I could choose but nothing really interesting is coming to my mind.

Maybe You could help me and suggest some subjects related to programming graphics, games or simulations? (or maybe something else that is interesting enough :) ). I would be very grateful for any suggestion!

sentences:
Tween animation with Universal Tween Engine LIbGDX Let me preface by saying that I'm new to libgdx...

I have an animation that I'm currently drawing to the screen using:

game.batch.draw(flyAnimation2.getKeyFrame(elapsedTime, true), 200,200,0, 0, 124, 90, 1.0f, 1.0f, 90);

Where flyAnimation2 is:
   Animation flyAnimation2;

This works correctly.  I now want to use UniversalTweenEngine to tween it from one side of the screen to the other.

I can't find any decent documentation on how to achieve this affect using an Animation.  Any help would be appreciated!!

sentences:
Efficiently separating Read/Compute/Write steps for concurrent processing of entities in Entity/Component systems Setup

I have an entity-component architecture where Entities can have a set of attributes (which are pure data with no behavior) and there exist systems that run the entity logic which act on that data. Essentially, in somewhat pseudo-code:

Entity
{
    id;
    map<id_type, Attribute> attributes;
}

System
{
    update();
    vector<Entity> entities;
}

A system that just moves along all entities at a constant rate might be

MovementSystem extends System
{
   update()
   {
      for each entity in entities
        position = entity.attributes["position"];
        position += vec3(1,1,1);
   }
}

Essentially, I'm trying to parallelise update() as efficiently as possible. This can be done by running entire systems in parallel, or by giving each update() of one system a couple of components so different threads can execute the update of the same system, but for a different subset of entities registered with that system.

Problem

In the case of the shown MovementSystem, parallelization is trivial. Since entities don't depend on each other, and don't modify shared data, we could just move all entities in parallel.

However, these systems sometimes require that entities interact with (read/write data from/to) each other, sometimes within the same system, but often between different systems that depend on each other.

For example, in a physics system sometimes entities may interact with each other. Two objects collide, their positions, velocities and other attributes are read from them, are updated, and then the updated attributes are written back to both entities.

And before the rendering system in the engine can start rendering entities, it has to wait for other systems to complete execution to ensure that all relevant attributes are what they need to be.

If we try to blindly parallelize this, it will lead to classical race conditions where different systems may read and modify data at the same time.

Ideally, there would exist a solution where all systems may read data from any entities it wishes to, without having to worry about other systems modifying that same data at the same time, and without having the programmer care about properly ordering the execution and parallelization of these systems manually (which may sometimes not even be possible).

In a basic implementation, this could be achieved by just putting all data reads and writes in critical sections (guarding them with mutexes). But this induces a large amount of runtime overhead and is probably not suitable for performance sensitive applications.

Solution?

In my thinking, a possible solution would be a system where reading/updating and writing of data is separated, so that in one expensive phase, systems only read data and compute what they need to compute, somehow cache the results, and then write all the changed data back to the target entities in a separate writing pass. All systems would act on the data in the state that it was in at the beginning of the frame, and then before the end of the frame, when all systems have finished updating, a serialized writing pass happens where the cached results from all the different systems are iterated through and written back to the target entities.

This is based on the (maybe wrong?) idea that the easy parallelization win could be big enough to outdo the cost (both in terms of runtime performance as well a code overhead) of the result caching and the writing pass.

The Question

How might such a system be implemented to achieve optimal performance? What are the implementation details of such a system and what are the prerequisites for an Entity-Component system that wants to use this solution?

sentences:
How do I efficiently send RTS unit selections over the network? I have a multiplayer RTS game with every unit assigned an ID.

How can I efficiently send across a network the units selected by a player? For example, Starcraft 2 has upwards of 200 units per player and each player can select a maximum of 255 units at a time. How can I implement such a system with reasonably low response time and bandwidth?

Should I bother sending IDs? Should I perhaps send a bitmask with each bit defining whether each unit is selected?

sentences:
Sprites saved in INA and AN format? I'm not sure if this is a suitable question but I found a game that had all it is sprites and stuff saved in INA and AN format and I got curious to know which program is it.

Or is it some sort of compressing or alike and how it is usually done?

Anyone know?

Here is the content of one of the files:
http://pastebin.com/EzUsFvdG

Here is a hex dump of the above file: http://pastebin.com/CTErFBcS

The above one is the AN file and the bellow one INA.

Hex dump of a INA file which seems to be some sort of map or data file (I believe because of the layers info, etc?) http://pastebin.com/2fWn8izR

sentences:
How do I find the angle between two 3D angles represented in this form? I have two 3D angles, represented by [a1,a2] [a1,a2] where the a2 is < 180. My coordinates are represented as [X,Y,Z], where X,Y,Z are 64 bit ints (longs in my lang). My direction angles are represented as (Angle1, Angle2) where Angle1 is 360 degrees along the X/Y plane, and Angle2 is 180 degrees along the Z axis.

In this case, I know for a fact that both angles were calculated from a single starting point, so there should be a single angle between them.  However, the math eludes me.  I sure would appreciate some help.

I've read the stuff on calculating the angle between two vectors, which is great, but for me would involve multiplying two longs together, which is
1. not practical, and
2. shouldn't be necessary.

My goal is to determine whether obj1 is moving generally towards obj2.  One of the angles is the direction of movement of obj1, and the other is the direction from obj1 to obj2. Can I get there from here?

sentences:
Connecting 3d corridors created by procedural generation? The 2d case is simple. You generate the segments. You find the intersections. Then you can easily outline the shape of the connecting joint in the 2d embedded graph.

However, in 3d or n-d with a whole new variety of directions (corridors from above and bellow), it is more complicated and I'd like to hear some advice.
The corridors themselves are simple. The challenge is the "connecting room" between them (you can imagine that room as convex hull of the red in blue dots). This is the goal here.

One way to overcome this, is using voxels and then leaving only the exterior of the connected corridors. This is not optimal however. Is there any simply way to generate the room in the center without complex binary operations?

sentences:
MonoGame - correct overloads for SpriteBatch.Draw flipping horizontally I want to flip my sprite horizontally while drawing and I can't figure out how to use the correct parameters without either an error or a warning about the method being obsolete.

This is what I assume it would be:

sb.Draw(NumbersGame.Arrow, resolutionRightArrow, Color.White,
SpriteEffects.FlipHorizontally);

Except it comes up for errors for the color (cannot convert from color to rectangle) and the SpriteEffects bit (cannot convert from sprite effects to rectangle).

What is the correct way to lay out these arguments?

P.S: When I provide all the default values (says it's obsolete):

sb.Draw(NumbersGame.Arrow, resolutionRightArrow, null, null, null, 0f, null,
Color.White, SpriteEffects.FlipHorizontally);

sentences:
Unity assets file structure I'm writing a map editor for a game built with Unity (5).

I want to reuse as much of the resources from the game as possible. That means textures and meshes.

I know they are somewhere in the assets files, but I need to be able to extract that data during runtime since I cannot (and do not want to) redistribute those files.

Additionally, given that the game receives frequent updates, I need to be able to calculate the offsets each time the editor is started. I also need to know how the textures connect to the objects in the game.

In order to do that, I need to know what the structure of assets file is, or at least find a way to extract them all and then use hex editor to figure out how they're put together.

I know there is a devxdevelopment tool that can do the latter, but I don't really have any money to spend on this.

Can you give me any info or pointers that would enable me to figure this out?

sentences:
Why is keeping a constant FPS harder than keeping high FPS? I've noticed this ever since I started playing games, and now see it in my own experiments. If I don't do any capping my game runs at 200~250 FPS, with random drops to 150FPS, but if I cap the FPS to 60 using a simple precision timer + sleep method, the game will sometimes (much more frequently than I want) render at ~40FPS during complex scenes.

I suspect this is simply because my process gets dequeued by the OS during the time I used to spend rendering the other 140 frames, meaning there's more context switches going on, as well as allowing other processes to steal all the cores and do CPU-intensive tasks in them. At the same time, this doesn't feel right, and one would think modern OS's are able to do scheduling that is good enough to avoid that.

So, my question is, are there any techniques to optimize my game for constant FPS rather than high-but-with-lots-of-variation FPS? Should I just make sure my game logic is being updated in a constant rate and don't worry about render rates?

Here's how my FPS-limiting code looks like (somehow pseudo code):

const maxFrameTime = 1/DESIRED_FPS; // say 60

while(running()) {
     now = query_precision_timer();
     thisFrame = now - lastFrame;
     lastFrame = now;

     while(thisFrame > 0.) {
          Update();

          thisFrame -= maxFrameTime;
          now += maxFrameTime;
     }

     Render();
}

sentences: What maps sizes did old 2D RTS games like C&C and WarCraft support? I'm looking for the size (in tiles) of the maps for the old 2D games Command and Conquer and Warcraft 1 and 2.

sentences:
Will my huge sprites for a 2d game create performance issues? I'm new to Unity, and have been confused about this issue for a while. Some people say that for 2D games you don't need to worry about performance (I'm making the game for PC, not mobile) while others report bad performance with larger sized sprites

I have a long scene with some large background sprites, measuring about 14552x3308 (weird resolution I know, would that also cause issues?) All methods of scaling it down and resizing in Unity lead to jagged edges (these are basically hills so I need them to be significantly bigger than the player character) I always keep the image size in the inspector similar to the resolution of the actual file, and set the filter mode to Point, so the jagged edges are not due to that, but only because of me scaling up a smaller file size to fit the scene.

If I use the original sprites of 14552x3308, it's perfectly smooth (image size set to 8192 in inspector) but each file takes about 120mb in the profiler. All combined, my assets are showing a usage of 1.25 GB for this scene. How bad is this? Should I be trying to keep it under 1GB?

I don't really know what the best practices are in this situation, so I don't know what to aim for. I'd ideally like to keep the sprites at this large size so that I don't have to redraw anything.

sentences:
How does delta compression reduce the amount of data sent over the network? Many games use the technique of delta compression in order to lower the data load sent. I fail to understand how this technique actually lowers the data load?

For example, let's say I want to send a position. Without delta compression I send a vector3 with the exact position of the entity, for instance (30, 2, 19). With delta compression I send a vector3 with smaller numbers (0.2, 0.1, 0.04).

I don't understand how it lowers the data load if both of the messages are vector3 - 32 bit for each float - 32 * 3 = 96 bits!

I know you can convert each float to a byte and then convert it back from a byte  to float but it causes precision errors which are visible.

sentences: If i make a game in Unity where a player can host their own servers, will it still cost me more money? I know that with Unity's networking system, you will have to pay Unity if you have more than X players on your servers at the same time.  I believe this is because that Unity is hosting the servers, and it costs them internet service?  But if the players are hosting their own servers, this wouldn't cost Unity any internet.  Is it possible to host your own servers using Unity networking, and if so, will it still cost extra money?  thanks. :)

sentences:
Loading SpriteFont through a different class than Game.cs I am trying to load up a single SpriteFont to print some debug information.
In our current game, we load up both Textures and Music through a ResourceManager. They are both loaded with a filestream, and thus do not require Content.Load

SoundEffect soundEffect = SoundEffect.FromStream( fs );

Since this ResourceManager does not inherit from Game or is like Game.cs, I cannot use the usual method:

SpriteFont spriteFont = Content.Load<SpriteFont>(resource.Key.Item2);

Anyone have any idea how I can either:
-Load the SpriteFont a different way
-Create my own Contentmanager

sentences:
Set an scaled image rectangle coordinates I have used the Origin parameter to draw the image (the image is also scaled) in center of the screen, and created a rectangle to detect whether user tapped on that image.
The problem is that if I tap on left part of the image it doesn't happen anything but at the right part, it executes what it has to.

How can i fix this? I have tried something but any result...

ItemRectangle[ItemID] = new Rectangle((int)Position.X + (int)(Position.X * Scales), (int)Position.Y + (int)(Position.Y * Scales), ItemTexture[ItemID].Width, ItemTexture[ItemID].Height);

spriteBatch.Draw(ItemTexture[i], ItemPosition[i], null, Color.White, 0, new Vector2(ItemTexture[i].Width / 2, ItemTexture[i].Height / 2), Scale, SpriteEffects.None, 0);

sentences: Drawing text in SlimDX with Directx 11? How can I draw text to the screen in directx 11 with slimdx?  In SlimDX.Direct3D10 there's a font class which can be used but there's no font class in SlimDX.Direct3D11.

sentences:
How to change the border color of a button in libGDX? How to change the border color of a button. I know how to change the background, but I don’t know this, although I reviewed the entire documentation.
And is it possible to find out whether the button is pressed or not

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:
Retrieving shader byte code using D3D11 I have a shader as an 'ID3D11VertexShader' (or generally any 'ID3D11*Shader') instance. For my application I would like to read the shader byte code that is associated with this instance.

The goal is the create an D3D11InputLayout without having to carry around the byte code blob.

Is there a way in DirectX 11 to retrieve the byte code, that was used to create this shader? I was looking for something similar to glGetProgramBinary (that would return the byte code instead of the binary code).

sentences: Where can I meet other independent game developers? I live in a large urban area and suspect there are groups of independent game developers that meet to discuss games and just hang out.  Are there any clubs or groups or associations or whatever for indie devs?

sentences:
How to make an object jump an equal height whenever it hits the ground? So, I want to make an object jump an equal height whenever it touches the ground. Something like a bouncing ball. But I can't use Physics Materials. Here are some ways that I tried:
Used Physics.CheckSphere:
isGrounded = Physics.CheckSphere(rayPoint.position, grounDistance, groundLayer);

if(isGrounded )
{
    rb.AddForce(transform.up * jumpForce, ForceMode.Impulse);
}

Used Raycast:
bool groundHit = Physics.Raycast(rayPoint.position, -transform.up, rayDistance, groundLayer);

if(groundHit)
{
    rb.AddForce(transform.up * jumpForce, ForceMode.Impulse);
}

In each cases, the object jumps a different amount of height each time it reaches the ground. How can I make it jump an equal height each time?

sentences:
How do I create a curved line or filled circle or generally a circle using C++/SDL? Hello I've been trying for ages to make a pixel circle using the putpixel function provided by SDL main website here is that function :

void putpixel(int x,int y , int color , SDL_Surface* surface)
{
    unsigned int *ptr = static_cast <unsigned int *> (surface->pixels);

    int offset = y * (surface->pitch/sizeof(unsigned int));

    ptr[offset + x] = color;
}

and my question is how do I curve a line or create an circle arc of pixels or any other curved shape then a rectangle or singular pixel or line.

for example here are some pictures

filled pixel circle below
enter link description here

now my idea was too

change the x and y value of the pixel position using + and -  to create the curves but in practice didn't provide the correct results

what my results are in this is to be able to create a circle that is made out of pixels only nothing else.

thank you for anyone who takes the time to read this question

thanks! :D

sentences: Standard key bindings for movement along three axes? I understand that the WASD keys are standard for moving a character along two axes (left/right, up/down) because in the QWERTY layout, they are arranged like the arrow keys. I want to make a game where the character can move along three axes, i.e. also front/back. Are there standard key bindings for this as well?

sentences:
Rendering different materials in a voxel terrain Each voxel datapoint in my terrain model is made up of two properties: density and material type.  Each is stored as an unsigned integer value (but the density is interpreted as a decimal value between 0 and 1).  The density values are used to generate a mesh with the marching cubes algorithm.

My current idea for rendering these different materials on the terrain mesh is to store eleven extra attributes in each vertex:  six material values corresponding to the materials of the voxels that the vertices lie between, three decimal values that correspond to the interpolation each vertex has between each voxel, and two decimal values that are used to determine where the fragment lies on the triangle.

The material and interpolation attributes are the exact same for each vertex in the triangle.  The fragment shader samples each texture that corresponds to each material and then uses the aforementioned couple of decimal values to interpolate between these samples and obtain the final textured color of the fragment.

It should work fine, but it seems like a big memory hog.  I won't be able to reuse vertices in the mesh with indexing, and each vertex will have a lot of data associated with it.  It also seems pretty slow.  What are some ways to improve or replace this technique for drawing materials on a voxel terrain mesh?

sentences:
How to generate a city street network? I would like to create a city generator for a game, but I am facing a problem at the very start of the generation: the road system.

As it is a medieval world, I don't want a grid plan like many modern cities. I would ideally prefer a pseudo-random generation of large avenues and smaller streets, where it could be possible to get lost, but with still some logic - not a complete labyrinth.
Something that would look like a naturally grown town.

In order to keep it simple, let's say my cities would be on flat and stable terrains, without any river-crossing or relief problems. I could try to integrate it to a solution after.

I didn't decide of a precise size or disposition for my cities, so if you have a solution that would work only with cities of a precise form (square, circle, rectangle etc), I would take it.

sentences:
Why is this LIBGDX Action behavior THE EXACT OPPOSITE of what I expect? Here is a code snippet of the relevant section in my render loop. My intention was to make the actor who was currently focused blinking, to indicate that it was the currently selected UI element. But after noticing that setting the condition of the if statement to == was giving me THE EXACT OPPOSITE of what I expected (namely: all elements that had previously had focus that were not the currently focused element of the stage were blinking), I changed it to the opposite and received the desired outcome.

QUESTION: What fundamental lesson of how Actions work am I missing? Why is this happening?

    Actor currentFocus = stage.getKeyboardFocus();

    if(currentFocus != gameVolumeSlider){
        gameVolumeSliderLabel.addAction(Actions.forever(Actions.sequence(fadeIn(.5f),fadeOut(.5f))));
    }
    if(currentFocus != musicVolumeSlider){
        musicVolumeSliderLabel.addAction(Actions.repeat(RepeatAction.FOREVER, Actions.sequence(fadeIn(.5f),fadeOut(.5f))));
    }
   if(currentFocus != backButton){
        backButton.addAction(Actions.repeat(RepeatAction.FOREVER, Actions.sequence(fadeIn(.5f),fadeOut(.5f))));
    }

    stage.act(Gdx.graphics.getDeltaTime());
    stage.draw();

sentences: what is best iap unitypackage (Asset) for support google play+ amazon in unity 2019.1.9? I need a unitypackage easy and easy for In app purchasing in googleplay and amazon (for Android) Which unitypackage is best in unity 2019.1.9?

sentences:
How do I implement GPU-based dynamic geometry LOD in OpenGL? I'm trying to implement LOD to boost my game's performance. I found a very nice tutorial.

The basic concept that I think I understand is: Get the distance from the camera to the object, check for the right LOD-level and then render the object with the "right amount of instances".

How do I implement that?  The provided example code is a mystery to me...

Some questions:

Is this a good method to implement LOD?
Can someone please explain me detailed, how I have to implement it, with the queries and so on...
I'm rendering all of my objects with

GL11.glDrawElements(GL11.GL_TRIANGLES, model.getRawModel().getVertexCount(),
                    GL11.GL_UNSIGNED_INT, 0);

The example code uses GL_POINTS. Can I implement it also with GL_TRIANGLES?

sentences:
How does pathfinding in RTS games work? [crossposted from stackoverflow]

In a game such as Warcraft 3 or Age of Empires, the ways that an AI opponent can move about the map seem almost limitless. The maps are huge and the position of other players is constantly changing.

How does the AI path-finding in games like these work? Standard graph-search methods (such as DFS, BFS or A*) seem impossible in such a setup.

sentences:
How to Convert a Z Up Matrix to a Y Up Matrix? My 3D program exports my vertex data and instancing matrixes in Z+ up format.  I want to store them in my own data format as Y+ up.  If given a Matrix4 describing a position with Z+ being up. How can I convert that to a Y+ up Matrix4?

I know you can just rotate the object but I don't want to rotate the object.

sentences:
How to render 3d object as 2d with different angles I wanted to make a ship as a 3d object and import it with an atlas file to my 2d libgdx project with different angles like I saw it by another game.

And I was wondering if there is a specific software which should be prefered to make those things.

Where can I create the 3d objects and export them into a big png + atlas file?

sentences:
Drawing a graph in Java JPEG/PNG for a simple map For my game i need to create a map based on a graph starting from the coordinates of the nodes, using "roads" instead of simple lines (for the edges) and circles instead of points (for nodes), but i don't now exactly which library to use.

As far as I now the standard graph visualization libraries wouldn't make me create this kind of graph.

Here is a quick example of what i mean:

If possible for the points i would like to use a custom textures

I only need to learn how to create the picture, because i know how to handle it in my game

sentences:
Billboarding restricted to an axis (cylindrical) I have succesfully created a GLSL shader for a billboarding effect. I want to tweak this to restrict the billboarding to an arbitrary axis, i.e. a billboarded quad only rotates itself about the y-axis. I use the y-axis as an example, but essentially I would like this to be an arbitrary axis. Can anyone show me how to modify my existing shader below, or if I need to start from scratch, point me towards some resources that could be helpful?

precision mediump float;

uniform mat4 u_modelViewProjectionMat;
uniform mat4 u_modelMat;
uniform mat4 u_viewTransposeMat;

uniform vec3 u_axis; // <------------ !!! the arbitrary axis to restrict rotation around

attribute vec3 a_position0;
attribute vec2 a_texCoord0;

varying vec2 v_texCoord0;

void main()
{
    vec3 pos = (a_position0.x * u_viewTransposeMat[0] + a_position0.y * u_viewTransposeMat[1]).xyz;
    vec4 position = vec4(pos, 1.0);

    v_texCoord0 = a_texCoord0;

    gl_Position = u_modelViewProjectionMat *  position;
}

EDIT - The modified shader for cylindrical billboarding.
Its very straight forward! Just swap out the up vector for the axis to restrict rotation about.

precision mediump float;

uniform mat4 u_modelViewProjectionMat;
uniform mat4 u_modelMat;
uniform mat4 u_viewTransposeMat;

uniform vec3 u_axis; // <------------ !!! the arbitrary axis to restrict rotation around

attribute vec3 a_position0;
attribute vec2 a_texCoord0;

varying vec2 v_texCoord0;

void main()
{
    vec3 pos = (a_position0.x * u_viewTransposeMat[0] + a_position0.y * vec4(normalize(u_axis), 0.0)).xyz;
    vec4 position = vec4(pos, 1.0);

    v_texCoord0 = a_texCoord0;

    gl_Position = u_modelViewProjectionMat *  position;
}

sentences:
How can I do fast Triangle/Square vs Triangle collision detection? I have a game world where the objects are in a grid based environment with the following restrictions.

All of the triangles are 45-90-45 triangles that are unit length. They can only rotate 90°. The squares are of unit length and can not rotate (not that it matters)

I have the Square vs Square detection down and it is very very solid and very fast (max vs min on x and y values)

Wondering if there are any tricks I can employ since I have these restrictions on the triangles?

sentences:
ClientDisconnected due to error: Timeout UnityEngine.Networking.NetworkIdentity:UNetStaticUpdate() Why am I getting this error. I think it has problem with port so I change port number and still getting same error. yesterday it was working fine but when I start today it giving me error like this.

  ClientDisconnected due to error: Timeout
  UnityEngine.Networking.NetworkIdentity:UNetStaticUpdate()

I refer this question but, there is not any answer presence for this error.

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:
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:
Why do all my matrices end up with the same values in this code? My programme reads a binary file. For that I made a Dictionary<int, float[]> where int is order number (ID) and float[] is an array of important values.
Here's my code how I read the binary file to my dictionary:

        inv_bind_mats = new Dictionary<int, float[]>();
        float[] Farr = new float[16];

        string path2 = Application.StartupPath + "\\skeletons\\" + skeletonName + ".bone_inv_trans_mats";
        using (BinaryReader inv_trans_mats = new BinaryReader(File.Open(path2, FileMode.Open, FileAccess.Read, FileShare.Read), Encoding.ASCII))
        {
            inv_trans_mats.BaseStream.Seek(4, SeekOrigin.Begin);
            bonesCount = inv_trans_mats.ReadUInt32();
            for (int i = 0; i < bonesCount; i++)
            {
                for (int j = 0; j < 16; j++)
                {
                    if (j < 12)
                    {
                        Farr[j] = inv_trans_mats.ReadSingle();
                    }
                    else if (j >= 12)
                    {
                        Farr[j] = 0.0f;
                    }
                }
                inv_bind_mats.Add(i, Farr);
            }
        }

It doesn't matter which ID I choose all float[] values are same for each.
This binary file is an inverse matrix of skeleton bones.
Each bone has 12 float values when I need to get 16 so I just add 4 more '0' values to what I get from file.

But the problem is all float values from inv_bind_mats[i][0-16] to inv_bind_mats[i][0-16] are equal.

How I want it to work: each bone has it's own matrix (float array) instead of one matrix for all bones.

sentences:
Ability/Skill Data and Method Structure (C#, Unity3D) So I've come to design my game which players will be having a unique set of skill or ability to come with. I can store skill name, mana cost, cooldown, etc in database which each skill have in common, but as we gamer know, a skill is unique not just by its attributes, like the sequence of movement, the object will be instantiate in the world, it's just that very unique.

So the question is, where do I put this "unique", the skill sequences? Do I make skill1.cs, skill2.sc for every single skill? xml for sequence then make script to read and define myXml?

For example, in a game, the effect of each card is very unique for example card1 allow player to deal damage and draw card, card2 just deal damage, card3 deal damage to enemy and then draw a card, and so-on, where and how they store this sequences or method of each card effect?

sentences: What term is used to refer to iPhone and Android games? What do you call games developed for Android or iPhone to differentiate them from games developed for other platforms?

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:
Interstellar Economic Simulation I'm designing a game reminiscent of Elite or Escape Velocity, those old space trading games, where you play a traveling merchant in space.

I'd like to have the game's economy at least resemble a real one. What resources are available that I could look at to get an understanding of the algorithms I'll need to perform the simulation?

One big hurdle is that I'm pretty horrible at math; so a simplistic explanation would be ideal.

I figure an interstellar economy wouldn't be all that different from a global one; certain things can only be manufactured in certain places (due to resources and technology levels), shipping things takes time and money, people in different places need different things... just instead of cities, they'd be planets.

A Google search of "economics simulation algorithm" and similar terms turns up little of use, and nothing I've got the background to understand.

Anyone know of any useful resources I could look into?

sentences:
Matte reflection effect in Unity? I'm trying to achieve that kind of scene but in real time using Unity.

It's basically composed of some primitives, a skybox, and a plane. I'm intrigued on how to do this effect in particular:

The plane acts like a mirror, but tainted and matte (and it appears to be less blurry at the bottom of the buildings... but I'm not quite sure). I have found some shaders to create mirrors in Unity but nothing about the matte effect like in this picture. Could you guide me on how to achieve this kind of effect (knowing that I'm pretty lame when it comes to write shaders but I want to learn).

Thanks.

sentences:
Visually updating the position of a game object controlled by an animator controller I have a game object that is controlled by an animator controller. In order to activate the next animator state, the user is supposed to grab this game object, and then move it from Point A to Point B.

As a test, in said game object's Update() method, I added the following line:

this.transform.localPosition += Vector3.up;

When running the game, I can see that the y-coordinate of the game object's position increases every single frame, just as intended. However, visually, the game object's position is not changing at all -- it remains in the same place all the time.

What should I do to ensure that game object's position is also visually updated?

EDIT:

Here are the properties of the animator I am using:

EDIT:

If relevant, here is the skinned mesh renderer for said game object:

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 to use CC photos from Wikimedia properly? Here is the situation: I want to create a (perhaps commercial) offline trading card game. Like Magic: The Gathering. My game will be about animals. So I want to use CC photos from Wikimedia as an art for each card.

Photos on Wikimedia are under different CC licenses (CC BY 2.0, CC BY-SA 2.5, CC BY-SA 3.0, CC BY-SA 4.0 and so on). I'm not a lawyer, I just want to try to create a game, so before I start I want to be sure:

Can I use such photos in a commercial product?
How to properly attribute each photo? According to Wiki hints, the usual photo should be attributed in this way:

"By AUTHOR NAME from CITY NAME, COUNTRY NAME - PHOTO CAPTION Uploaded by USERNAME, CC BY 2.0, FILE URL"

It's not enough space on the card for so long text. Can I print a short text on each card (like "Photo by AUTHOR NAME") and also make the web page with full credits for all cards' arts? Or credits should be printed and distributed with each booster?

Thanks in advance!

sentences:
Display a variable in the UI I have been searching and searching for an answer to this question but nobody seems to be helping me. I have wasted the past two hours trying to figure out how to do this, so please help me out here.

I am making a FPS game in Unreal Engine 4, and I want to display ammo. I can do that fine, but changing the text of the UI displaying the ammo is turning into a nightmare. I need to access the text label variable

Inside of the blueprint that handles the actual gun firing

From there I should be able to adjust the text to match what my ammo is.

Unfortunately, no matter what I try, I cannot change the variable in my blueprint. I can't even make the variable public to begin with! What do I need to do to accomplish this?

sentences:
Is there any algorithm for creating 3D lightning? Is there any algorithm for generating lightning?
Lets say, you input the starting and ending coordinates (x,y,z) and out comes an array of coordinates to show where the lightning goes.
It doesn't have to be scientifically accurate but as long it looks random and unpredictable

EDIT: I found this, but can't figure out how to put this in to C/++ code. There is a 2D example provided but I want 3D :O

EDIT2: The output might be something like this:

struct coord3 { int x, y, z; };

struct line
{
    unsigned char lumo;
    coord3 start;
    coord3 end;
};

line* lightning = new line[n]; // each element of the array would be a line that
                               // needs to be drawn for the lightning so the
                               // lightning can "fork" and can have different
                               // brightnesses

sentences:
Revert to closest non intersecting position First, let me start by saying:

  Please forgive me if this question have already been asked. I've tried to search but didn't find any solution. (It might be due to my lack of terms).

I have two circles with r radius, p(x,y) position and v(x,y) velocity. I need a formula for calculating position p3 if the first circle (blue) intersects with the second circle (red), thus placing it as close as possible next to the red circle without intersecting.

Any ideas?

Vector2 c1 = new Vector2((p1.X + r1), (p1.Y + r1));
Vector2 c2 = new Vector2((p2.X + r2), (p2.Y + r2));
bool intersects = ((Vector2.Distance(c1, c2)) < (r1 + r2));

sentences:
Why do consoles have so little memory compared to classic computers? I remember the Playstation having 2MB ram and 1MB graphic memory.

The Playstation 3 now has only 256MB ram and 256MB graphic memory, and I'm sure that the day the console was released, even laptop's "standard" capacity was at least 1GB.

So why do they put so little memory in their machines, while developers would benefit a lot by having more ? Or is the memory that much faster than desktops and thus more expensive ? Or is it not that much worth it for developers ? What are the Sony/XBox/Nintendo engineers thinking that seems to be the same reason ?

sentences: Clearing screen in Pygame so content on the screen is not lost, but updated I am creating a Tetris game using Pygame. It generates a random shape from a list and draws it onto the screen. However, when the arrow key is pressed by the user, it draws the shape again without removing the previous one.The problem is that I can't use screen.fill(White) as it will remove the other shapes at the bottom of the grid. How can I refresh the screen without removing the shapes at the bottom of the grid, and so that it doesn't draw the shape multiple times. The first image shows the original shape, and the second image shows the result of pressing the arrow key.

sentences:
Audio Engines , do they work on CPU, GPU or DSP I have been reading design specifications of the audio engines. What I am trying to achieve requires performance and I want to parallelize.

Only and only while reading openAL specification it was mentioned very very shortly that if hardware supports than openAL will use DSP as well.

But I am curious for other engines as well and couldn't find information for wwise for example.

In general do audio engine takes advantage of DSP or even GPU maybe ?

sentences:
Checking for alternate keys with XNA IsKeyDown I'm working on picking up XNA and this was a confusing point for me.

KeyboardState keyState = Keyboard.GetState();
if (keyState.IsKeyDown(Keys.Left) || keyState.IsKeyDown(Keys.A))
{
    //Do stuff...
}

The book I'm using (Learning XNA 4.0, O'Rielly) says that this method accepts a bitwise OR series of keys, which I think should look like this...

KeyboardState keyState = Keyboard.GetState();
if (keyState.IsKeyDown(Keys.Left | Keys.A))
{
    //Do stuff...
}

But I can't get it work. I also tried using !IsKeyUp(... | ...) as it said that all keys had to be down for it to be true, but had no luck with that either. Ideas? Thanks.

sentences: How do I handle moving platforms in a platform game? I don't want to use box2d or anything, I just want simple moving platforms (up-down, left-right, diagonal and circular paths). My question is to handle the update order / control hierarchy so that the player stays fixed to the platform solidly, without bouncing or wobbling?

sentences:
Unity - Hide GameObject that is behind UI I have the following example:

How can I prevent the part of the sprite that is highlighted in red and is behind the UI from being displayed on the camera, but having the background image still showing?

sentences:
Computing pixel's screen position in a vertex shader: right or wrong? I am building a deferred rendering engine and I have a question. The article I took the sample code from suggested computing screen position of the pixel as follows:

VertexShaderFunction()
{
    ...
    output.Position = mul(worldViewProj, input.Position);
    output.ScreenPosition = output.Position;
}

PixelShaderFunction()
{
    input.ScreenPosition.xy /= input.ScreenPosition.w;
    float2 TexCoord = 0.5f * (float2(input.ScreenPosition.x,-input.ScreenPosition.y) + 1);
    ...
}

The question is what if I compute the position in the vertex shader (which should optimize the performance as VSF is launched significantly less number of times than PSF) would I get the per-vertex lighting insted. Here is how I want to do this:

VertexShaderFunction()
{
    ...
    output.Position = mul(worldViewProj, input.Position);
    output.ScreenPosition.xy = output.Position / output.Position.w;
}

PixelShaderFunction()
{
    float2 TexCoord = 0.5f * (float2(input.ScreenPosition.x,-input.ScreenPosition.y) + 1);
    ...
}

What exactly happens with the data I pass from VS to PS? How exactly is it interpolated? Will it give me the right per-pixel result in this case? I tried launching the game both ways and saw no visual difference. Is my assumption right?

Thanks.

P.S. I am optimizing the point light shader, so I actually pass a sphere geometry into the VS.

Solution:

struct PSInput
{
    float2 vPos : VPOS;
};

PixelShaderFunction(PSInput input)
{
    float2 ScrPos = input.vPos*halfPixel*2;

        //The correct Screen Space Texture Coordinates.
    float2 TexCoord = ScrPos + halfPixel;

    //Bonus: getting the world position.
    ScrPos = ScrPos*2 - 1;
    ScrPos = float2(ScrPos.x, -ScrPos.y);

    float4 position;
    position.xy = ScrPos;
    position.z = depthVal; // Read from the depth map.
    position.w = 1.0f;

    position = mul(position, InvertViewProjection);
    position /= position.w;
}

sentences:
Making a Rigidbody return to being level I am working on a game where mouse input affects the torque of the RigidBody but I would like the Rigidbody to return to being level if certain conditions are met.

Currently the angling working right but once you set the mouse in the deadzone and make the mouse_input equal to 0, then the RigidBody will teeter back and forth and not settle.

I would expect this act like so:

User angles the RigidBody to an angle to 45
User decides they are done and move the mouse to the deadzone, making the mouse_input 0.
The level function applies a mouse_input value of the opposite angle causing the RigidBody to level out.

I created a gift of the script below in action: https://giphy.com/gifs/TIcqjZnkiUR1azg3u6

extends RigidBody

# A deadzone where mouse motion has no effect.
var window_half: Vector2 = OS.get_window_size() / 2
var deadzone: Rect2 = Rect2(Vector2(window_half.x - 200, window_half.y - 200), Vector2(400, 400))

# The input amount set by mouse motion.
var mouse_input: float = 0.0
# The angle of the box.
var box_angle: float = 0.0

# Nothing to do in ready, pass.
func _ready():
    pass

# Each frame we check the mouse position and apply the correct force to make the body
# go in the desired direction.
func _process(delta):
    get_mouse_position()
    calculate_angle()
    level()
    calculate_torque()

# Check to see if the mouse is in the deadzone and if not we set a value to the mouse_input.
func get_mouse_position():
    var mouse_pos = get_viewport().get_mouse_position()

    if deadzone.has_point(mouse_pos):
        mouse_input = 0.0
        return

    if mouse_pos.y > deadzone.position.y:
        mouse_input = 0.05
    elif mouse_pos.y < deadzone.position.y:
        mouse_input = -0.05

# Calculate the angle of the RigidBody.
func calculate_angle():
    var flat_forward = get_global_transform().basis.z
    flat_forward.z *= 1
    flat_forward.y = 0

    if flat_forward.length() > 0:
        flat_forward = flat_forward.normalized()
        var local_flat_forward = to_local(flat_forward)
        box_angle = atan2(local_flat_forward.y, local_flat_forward.z)

# If the mouse is not providing any input, we want to level out the RigidBody by applying
# an opposing force until it's equal.
func level():
    if mouse_input == 0.0:
        mouse_input = -box_angle

# Add the torque to make the RigidBody move.
func calculate_torque():
    var torque = Vector3.ZERO
    torque += mouse_input * get_global_transform().basis.x
    add_torque(torque)

sentences:
C#/XNA get hardware mouse position I'm using C# and trying to get hardware mouse position. First thing I tryed was simple XNA functionality that is simple to use

Vector2 position = new Vector2(Mouse.GetState().X, Mouse.GetState().Y);

After that i do the drawing of mouse as well, and comparing to windows hardware mouse, this new mouse with xna provided coordinates is "slacking off". By that i mean, that it is behind by few frames. For example if game is runing at 600 fps, of curse it will be responsive, but at 60 fps software mouse delay is no longer acceptable. Therefore I tried using what I thought was a hardware mouse,

[DllImport("user32.dll")]
[return: MarshalAs(UnmanagedType.Bool)]
public static extern bool GetCursorPos(out POINT lpPoint);

but the result was exactly the same. I also tried geting Windows form cursor, and that was a dead end as well - worked, but with the same delay. Messing around with xna functionality:

GraphicsDeviceManager.SynchronizeWithVerticalRetrace = true/false
Game.IsFixedTimeStep = true/fale

did change the delay time for somewhat obvious reasons, but the bottom line is that regardless it still was behind default Windows mouse. I'v seen in some games, that they provide option for hardware acelerated mouse, and in others(I think) it is already by default. Can anyone give some lead on how to achieve that.

sentences:
Comparison of two 2d top down player movement scripts in Unity I have been following along two different tutorials on making an 2d RPG and comparing the two movement scripts that seem to do the same thing but in different ways. Which is a better way when comparing these scripts?

using UnityEngine;
using System.Collections;

public class PlayerController : MonoBehaviour {

    public float moveSpeed;
    private Animator anim;

    // Use this for initialization
    void Start () {
        anim = GetComponent<Animator> ();
    }

    // Update is called once per frame
    void Update () {
        if(Input.GetAxisRaw ("Horizontal") > 0.5f || Input.GetAxisRaw ("Horizontal") < -0.5f){
            transform.Translate(new Vector3(Input.GetAxisRaw ("Horizontal") * moveSpeed * Time.deltaTime, 0f, 0f));
        }

        if(Input.GetAxisRaw ("Vertical") > 0.5f || Input.GetAxisRaw ("Vertical") < -0.5f){
            transform.Translate(new Vector3(0f, Input.GetAxisRaw ("Vertical") * moveSpeed * Time.deltaTime, 0f));
        }

        anim.SetFloat ("MoveX", Input.GetAxisRaw("Horizontal"));
        anim.SetFloat ("MoveY", Input.GetAxisRaw("Vertical"));
    }
}

Script 2:

using UnityEngine;
using System.Collections;

public class PlayerMovement : MonoBehaviour {
    Rigidbody2D rbody;
    Animator anim;

    // Use this for initialization
    void Start () {
        rbody = GetComponent<Rigidbody2D> ();
        anim = GetComponent<Animator> ();
    }

    // Update is called once per frame
    void FixedUpdate () {
        Vector2 movement_vector = new Vector2(Input.GetAxisRaw("Horizontal"), Input.GetAxisRaw("Vertical"));

        if (movement_vector != Vector2.zero) {
            anim.SetBool ("Iswalking", true);
            anim.SetFloat ("Input_x", movement_vector.x);
            anim.SetFloat ("Input_y", movement_vector.y);
        } else {
            anim.SetBool ("Iswalking", false);
        }

        rbody.MovePosition (rbody.position + movement_vector * Time.deltaTime);
    }
}

sentences:
Speed of bodies in Box2D and libgdx I want to move my bodies at higher speeds, but they have a top speed.

I have an Ortoghraphic camera defined at 800x480.
My world doesnt have gravity.
I apply an impulse of 1000,and a force of 1000 too.

But the speed always is at the same value, it doesnt have more.

How do i add more speed to my body (its a dynamic body).

sentences:
Is ArrayLists so slow that it is doomed to kill performance in Unity? I was reading Which Kind Of Array Or Collection Should I Use?

The document states to use list for the most performance.

  "...They are the fastest array in unity. For this reason, built-in arrays are the best choice if you need the fastest performance possible from your code (for example, if you're targeting iPhone)...performs significantly faster than ArrayList."

I am inclined to use list besides performance issues as well because...

If you're using List you won't have to cast objects since it's generic and use a T[] backing storage (at least .net does this). ArrayList have to cast everything to object and cause boxing with value types.
faster for value types as it avoids boxing., strongly typed elements.

But it got me to wonder, since everyone seems to favor to make a degrading statement about ArrayLists, is ArrayLists that horrible? If so why does it even exist? Is it more of trace of supposedly deprecated codes?

sentences:
Is there a way to make collision necessary? This code I have for my player movement. Now I want to make the player (2d circle) stick to the path. I tried OncollisionEnter2d but it's detection wans't an obligation.

using UnityEngine;
using System.Collections;

public class player : MonoBehaviour {

    public float speed;

    void FixedUpdate()
    {
        float moveHorizontal = Input.GetAxis ("Horizontal");
        float moveVertical = Input.GetAxis ("Vertical");
        transform.Translate (new Vector2(moveHorizontal,moveVertical)*Time.deltaTime*speed);
    }
}

sentences:
Displacement map to create terrain I am trying to figure out the best way to create a procedurally generated terrain at runtime in Unreal Engine 4. For the moment, my idea is to generate a heightmap and apply it to a plane as a displacement map, since it sounds a lot simpler than trying to procedurally generate a mesh.

Is it how it is generally done? And if not, will I run into issues by doing it this way?

sentences:
which is better performance, using a disposable local variable or reusing a global one? This is for an android game.
Suppose I have a function that is called several times for second and do some calculations involving an arraylist (or any other complex objects for what matter).
Which approach would be preffered?

local:

private void doStuff(){
    ArrayList<Type> XList = new ArrayList<Type>();
    // do stuff with list
}

global:

private ArrayList<Type> XList = new ArrayList<Type>();
private void doStuff(){
    XList.clear();
    // do stuff with list
}

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:
How do I add auto login system firebase auth Unity? I want to add an auto login/sign in ability into my game, so when the player quits the game or goes to main menu, the login panel is gone and the player is automatically logged in. Then, I want the player to be logged out and no longer automatically sign in when he presses the "sign out" button.
Here are some previews of my game:

I'm sure this code works like this, but I have low experience on firebase. Additionally, there is lack of documentation on it with Unity so I don't know what is wrong with this script.

void Awake()
    {
        //Check that all of the necessary dependencies for Firebase are present on the system
        FirebaseApp.CheckAndFixDependenciesAsync().ContinueWith(task =>
        {
            dependencyStatus = task.Result;
            if (dependencyStatus == DependencyStatus.Available)
            {
                //If they are avalible Initialize Firebase
                InitializeFirebase();
            }
            else
            {
                Debug.LogError("Could not resolve all Firebase dependencies: " + dependencyStatus);
            }
        });

        //singleton
        if (instance != null)
        {
            Destroy(gameObject);
        }
        else
        {
            instance = this;
            DontDestroyOnLoad(gameObject);

        }

    }

    private void InitializeFirebase()
    {
        Debug.Log("Setting up Firebase Auth");
        //Set the authentication instance object

        if (auth != null)
        {
            _MainMenuUI.instance.loginPanel.SetActive(false);
        }
        else
        {
            auth = FirebaseAuth.DefaultInstance;
            DBreference = FirebaseDatabase.DefaultInstance.RootReference;
        }
    }

sentences:
Reversi/Othello early-game evaluation function I've written my own Reversi player, based on the MiniMax algorithm, with Alpha-Beta pruning, but in the first 10 moves my evaluation function is too slow. I need a good early-game evaluation function.

I'm trying to do it with this matrix (corresponding to the board) which determines how favourable that square is to have:

   { 30, -25, 10, 5, 5, 10, -25,  30,},
   {-25, -25,  1, 1, 1,  1, -25, -25,},
   { 10,   1,  5, 2, 2,  5,   1,  10,},
   {  5,   1,  2, 1, 1,  2,   1,   5,},
   {  5,   1,  2, 1, 1,  2,   1,   5,},
   { 10,   1,  5, 2, 2,  5,   1,  10,},
   {-25, -25,  1, 1, 1,  1, -25, -25,},
   { 30, -25, 10, 5, 5, 10, -25,  30,},};

But it doesn't work well.

Have you even written an early-game evaluation function for Reversi?

sentences:
How can I generate roads such as those in the game Twisty Road? Here is a link to see the gameplay: https://www.youtube.com/watch?v=03PzsgO-uAM
How could I procedurally generate the path upon which the ball rolls in Unity/C#?
I know I could model distinct pieces of the road in Blender and import them into Unity as prefabs. My problem is, I genuinely have no idea where to start when it comes to programmatically generating the whole road out of those prefab sections in a cohesive manner, such that the road is built seamlessly and randomly with twists and turns in three-dimensional space.
I would appreciate any insight you could provide. Thank you.

sentences:
Question about JPanel "transition" for Java Swing I want to make like a sort of main menu (in GUI).
When the user clicks the start button, the screen transition into another "screen" (JPanel). This image will make it easier to understand.
http://i.imgur.com/Cfdry.png

Currently, I have a MainMenu extends JPanel and that gets added into a driver class with a JFrame. I can't figure how to switch to another class like Game extends JPanel.
So when the user clicks the start button in MainMenu, I want it to somehow hide itself and the Game to show itself.
Thanks.

sentences:
Get VertexSize of Instance in VertexShader I'm using Unitys DrawProceduralIndirect function to directly render the content of a ComputeShader.

I setup the argumentBuffer for this function as follows:

    int[] csArgs = new int[] { ptsOnLine, 2, 0, 0};
    argsBuffer = new ComputeBuffer(4, 4, ComputeBufferType.IndirectArguments);

So every instance consists of ptsOnLine (lets say 10) vertices.

My vertexShader then looks like this:

fsInput vert(uint id : SV_VertexID, uint instanceId : SV_InstanceId)
{
    fsInput fsIn;
    float3 worldPos = linePoints[id + (instanceId * 10)];
    fsIn.pos = mul(UNITY_MATRIX_VP, float4(worldPos, 1.0f));
    return fsIn;
}

The question is simple. My problem is: (instanceId * 10). Is there a built in variable telling me the length of one instance? I couldn't find anything. I mean, its in the argument buffer so it shouldn't be too much of a problem? I could forward this value from the compute buffer but thats ugly. :)

Help is much appreciated!

sentences:
How can I tell if a Gameobject is currently touching another Gameobject with a specific tag? I've seen similar questions to this here on Stack Exchange — Game Development, but none of the answers to them have helped my problem. I am working in Unity 2019.2.18f1 with Visual Studios 2019 Community.

What I want to know how to tell when one Gameobject (the player) is currently touching another game object with a tag name of "Block". When the player collides with a "block" I want it to set: jumpPossible = true; But when it leaves the block (by jumping or falling off) jumpPossible = false;

What I currently have in my PlayerController script (the important stuff anyways):

private void OnCollisionEnter(Collision collision) {
    if (collision.gameObject.CompareTag("Block")) {
        jumpPossible = true;
    }
}

private void OnCollisionExit(Collision collision) {
    if (collision.gameObject.CompareTag("Block")) {
        jumpPossible = false;
    }
}

The problem I am having is when the player is currently on a block and then touches another block. When it leaves the one of the blocks, it will set: jumpPossible = false; and so you can't jump.

What I want for this script to do is whenever the player is touching any Gameobject with a tag of "Block" it should allow it to jump.

sentences:
Wall collision response results in jittery physics I have the following game loop :

while true {
    HandleInput()
    Update()
        PhysicsEngine.HandleCollisions()
        PhysicsEngine.Integrate()
    Render()
}

For now, HandleCollisions is simply negating the velocity vector of the player. The problem is that if I hold the button to walk forward this results in a jittery screen flashing between the render of the forward walk and the backward walk. How can I smooth it out so that it feels like the player has stopped even if I am still pressing the button ?

From what I have found on the internet, Unity's Rigidbody.MovePosition solves this problem, but I was not able to find its implementation online.

One thing that I thought about, but am not sure if it is the solution is the following.

Find distance of penetration in the HandleCollisions function
In the same function move object this much
Change velocity to (0,0,0)

The problem here is that from my understanding the Integration step should be the one doing the movement and I should only be changing velocity. If that is correct, then I have no idea how to solve it.

edit : removed architecture tag

sentences:
Generate Angle for Projectile to Follow So It's Ends Facing Downward I am building a game within a game engine. The game is a 2D platform, where the player can move left, right, and jump/fall down. Part of the game is the presence of physical projectiles falling from the 'sky'. When these objects are created (in the sky), impulse is applied to them toward the present location of the player [Pic 1]. Please note the impulse is applied one time using the location of the player at object location, it is not constantly being applied to the location of the moving player. The projectile should move toward that location of the player, not necessarily to the location - and it does - but as it reaches its destination the object starts to curl upward [Pic 2].

I have tried several formulas for setting the angle on each tick (every frame), namely

Set Angle Toward: PlayerWasAtX, LayoutHeight
Set Angle Toward: Self.X, LayoutHeight
Set Angle Toward: If (Self.X > Self.PlayerWasAtX)
                  Then (Self.X - PlayerWasAtX) / 2
                  Else (PlayerWasAtX - Self.X) / 2
                  , LayoutHeight

Where PlayerWasAtX is the stored location of the player upon projectile creation, LayoutHeight is the total height of the canvas, and Self.X is the X-coordinate of the projetile.

In those examples, example 1 would curl, example 2 would keep the object straight down at all times even when falling at a curve, and iirc example 2 just acted wacky.. or it acted the same as example 1.

Any help would be appreciated. Here are my reference pictures:

sentences:
What technologies are required for 3D game development? I want to make a racing game like Need for speed. And I want to start from very start.
Please tell me the skills, technologies that one should posses while making it.

I am beginner in game development, Although I have good programming skills. I am ready to learn. Please also recommend few good books.

Thanks in advance.

Updated: I am interested in making PC games and I have no intention in making my career in gaming. Also no 2D games, just full-fledged 3D games. Here I don't think like creating a games like pacman or mario are gonna help me. if they, then please pardon me.

Updated: Why should I learn 2D game development? I want to develop a 3D game.

sentences:
How to move on a mesh? I am working on my collision system right now and I wondered how you can actually walk on a mesh. For example I'm thinking about a dynamically created little village and I want to be able to move the player across roofs etc.

I read about two different approaches to that problem.

Simulate the next step and test if the step can be performed. If it's all right, perform that step or abort otherwise
Perform the step and let the collision system handle a collision in the next frame.

Now, with regards to speed and accuracy, which one is better suited for my problem. As a sidenote: the player should also be able to climb stairs and I also want to prevent the player from moving on very steep parts of the model.

sentences:
Why does my game display the wrong "required Android version" on Google Play? I'm porting a Unity game to Android, and I've set up the "Minimum API Level" in the Player settings to "2.3.3 (API level 10)".

However, on the store, it says "Requires Android: 1.6 and up".

On the Google Developer Console I didn't find this setting, so I guess the store is just trying to "guess" it examining the application, and failing.

Did I miss something?

sentences:
From camera coordinates to world coordinates I want to calculate world coordinates from camera coordinates. However, I seem to have problems with my understandings of how matrices in HLSL work.

From world to camera is clear:

cameraPosition = mul(mul(worldPosition, view), projection);

Logic would now say that for the reverse, I could just use something like

worldPosition = mul(mul(cameraPosition, invProjection), invView);

However, when I check if it is correct with

cameraPosition = mul(mul(mul(mul(cameraPosition, invProjection),
                                   invView), view), projection);

I don't get the same point back anymore.

The inverses should be fine as view * invView produces the identity matrix etc.

What is my misunderstanding here? Even the simpler case does not work:

void VS_test(in  float4 inPosition            : POSITION,
             out float4 outPosition           : POSITION)
{
    outPosition = inPosition;
}

produces the triangle I want. However, using

void VS_test(in  float4 inPosition            : POSITION,
             out float4 outPosition           : POSITION)
{
    outPosition = mul(mul(inPosition, view), invView);
}

already produces no visible triangle. Same with

void VS_test(in  float4 inPosition            : POSITION,
             out float4 outPosition           : POSITION)
{
    outPosition = mul(inPosition, mul(view, invView));
}

Pixel shader is just a shader which returns a constant color.

UPDATE

I have 3D camera-space coordinates WITH z-buffer value, like (0, 0, zNear) for the point directly in the center of the screen. I want to know what world coordinates correspond to this by doing the whole view-transform backwards.

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:
Shader effect similar to Metro 2033 gasmask I was thinking about effects in games the other day and I was reminded of the Gasmask effect from Metro 2033. Once you put the gasmask on it blurred a bit in the corners and could ice up and even get cracked.

I assume that something like that is done using a shader. I have been experimenting a bit with game development, so far mostly playing with existing rendering engines and adding physics support etc.

I would like to learn more about this sort of effect. Can someone give me a simple example of a shader that would alter the entire scene like this. Or if not a shader then an idea on how it would be done. Thanks.

Edit : Include screenshot of the metro 2033 gasmask effect.

sentences:
LWJGL Resize window and glTranslate breaking screen resolution I'm trying to make a 2D Tile RPG game with LWJGL but I'm having a problem with the display resizing. I want the user to be able to re-size the window to whatever size they want just by expanding it (as opposed to letting them pick a resolution option from a list).

See the images below for the problem.

At default resolution:

At a re-sized resolution:

As you can see the tile is drawn correctly in the first image. However, after moving the camera and resizing the display the tile gets cut off as it moves away from the bottom-left corner of the screen.

The default screen-resolution is 800x600. I have a camera object that moves based on the player using the WASD keys. I decide what's to be drawn by using glTransaltef(camera.x,camera.y,0). Should I use if(Display.wasResized()) in the game loop then get what the new resolution is and use it in the glTranslatef function somehow? Any help or suggestions would be great!

EDIT: I added the code in Fletcher D's answer however it produced this:

The tile doesn't get cut off anymore but in the image above the tile is being drawn at a size of 1x1 pixels. Also when the screen resolution changes the resolution of everything on screen changes, this is not what I want. I want the screen to simply display more of the world. As I said I'm using a panning camera that moves with the player's WASD keys. So if the world is currently being displayed at 0,0 to 800,600 and the player re-sizes the window to 1080x720 I want the display to show the world from -140,-60 to 940,660. (Maintaining the center of the screen at the moment of being re-sized.

sentences:
Pokemon formulas and copyrights? I am developing a multiplayer RPG-like strategic combat game.

If I use the formulas of Pokemon games in this game for damage calculation, does I risk any copyright issue ? What areas of the game is copyrighted ?

sentences:
Objects stick together on Collision I have a ball which has CircleCollider2D attached to it. It is also rigidbody. When it lands on a platform, it jumps . The platform is static, with Edge Collider attached. It also has a platform effector attached with "Use One Way" selected.
Most of the times it works fine, but some times, the ball lands on the platform and instead of bouncing, just sits on the platform.
When ball lands on the platform, following code is executed:
 rb.AddForce(upForce, ForceMode2D.Impulse);

upForce is Vector2(4,10);
image shown below:

Why is this happening?

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:
Changing balls direction in Pong I'm making a Pong game to get started with game-developement but
I've run into a problem that i can't figure out.

When trying to change the balls direction it doesn't change. This is the relevant code:

function moveBall(){
    this.speed = 2.5;
    this.direction = 2;
    if(this.direction == 1){
        ball.X +=this.speed;
    }
    else if(this.direction == 2){
        ball.X -=this.speed;
    }
}

function collision(){
    if(ball.X == 500){
        moveBall.direction = 2;
    }
    if(ball.X == 300){
        moveBall.direction = 1;
    }
}

Why doesn't it work? I've tried many different ways, and none of them seem to work.
The moveBall.direction changes though, since it alerts the new direction once it reaches the defined ball.X position.

If someone could help me I would deeply appreciate it.
I've included a JSFiddle link.

http://jsfiddle.net/hustlerinc/y4wp3/

sentences:
SteamWorks.Net for unity and inviting a friend to a multiplayer game I'm trying to send an invitation to a steam friend and have it that when he accepts I create a PUN 2 room for both players and they can start their match. So far I've done this :

 protected Steamworks.Callback<GameRichPresenceJoinRequested_t> m_GameRichPresenceJoinRequested;

private void OnEnable()
{
    m_GameRichPresenceJoinRequested = Callback<GameRichPresenceJoinRequested_t>.Create(OnGameRichPresenceJoinRequested);
}

public void InviteFriend()
{

    SteamFriends.InviteUserToGame(steamFriendData.friendSteamId, "");
}

private void OnGameRichPresenceJoinRequested(GameRichPresenceJoinRequested_t pCallback)
{
     Debug.Log(pCallback.m_rgchConnect);
    Debug.Log("<color=green>Friend accepted the invite</color> ");
}

The invite is being sent to the correct friend and when he accepts it launches the game but I get no callback from that and thus have no way to place them in a room. What am I doing wrong ?

sentences:
How to move my character by itself but I can still move its direction or where it is going, using Mobile Joystick? So, I am making a 2D airplane game right now and I wanted to know how to move my player automatically but I can still control where it should go or the direction. How do I code this using Mobile joystick?

CODE:

public float moveSpeed;

Rigidbody2D myBody;

protected Joystick joystick;

void Start()
{
    myBody = GetComponent<Rigidbody2D>();
    joystick = FindObjectOfType<Joystick>();
}

// Update is called once per frame

void Update()
{
    myBody.velocity = new Vector2( joystick.Horizontal * moveSpeed, joystick.Vertical * moveSpeed );
}

sentences: What to do to set gravity in unity What to do to set gravity in unity? I'm working on a game called "OXYGEN", and for the space scene. I want to set the gravity of the Controller to 0.38, or Mar's gravity.

sentences:
How do I implement real-time mesh deformation, with regards to environmental damage? I would like to be able to add the following feature to my tech demo: at the moment bullets hit the walls, little pieces fly out of them, as well as decals appearing on the walls. Computing power is good enough, now, so that many games have destructible environments.

I would like bullets to shatter small surface segments off the wall, ideally the segments that fly off would directly relate to the hole that is left, though I don't even know if this is how it's done in commercial games.

How is this done? Are there simply a number of different meshes that are swapped out as, and when, objects are hit? I assumed that this would not be an accurate enough solution. Is real-time mesh deformation feasible. and if so, how is it done?

sentences:
Colouring greyscale images/sprites for HTML canvas What is the best method to colour in sprites at runtime using the canvas element and javascript? I know there are various blending modes using globalCompositeOperation, but I don't know how best to utilise this.

I'll break my question down into the following:

Is there an optimum way to export greyscale images so they can be easily re-coloured later? (At the moment, the images are created with colour in Photoshop or a similar package and then turned into a greyscale and exported from there before I even touch them)
With these greyscale images in place, what method makes colouring them with any colour possible? (They must retain the shading etc)

I've tagged this with HTML5 and Javascript, but any advise from other platforms would be helpful.

Edit: Here's an example greyscale output of the image on the left. I want to be able to restore it to the same colour, but also be able to blend it with other colours for different shades of skin.

sentences:
Transform.position is being changed, but character is not moving back to it when told I'm trying to make a respawn point for my car to jump back to if it presses a button. I can see, using the Print() lines, that all the variables are correct and the methods are being triggered when expected.

But the car doesn't go back to the spawnpoint like I want it to. The velocity part seems to take effect and work ok, but the rotation and position part does nothing.

I tried several different variations of this code (ie. GetComponent<> and setting a public player variable (even though I am already in the player with this script)).

Like I said I tried making a public Player and setting the transform p and r on that. I also tried GetComponentByParent<Transform> and setting like that. I've tried a few other variations of that too. And I get the same results.

Here is the bit of code I think is relevant, if you actually need to see more please let me know.

public void OnTriggerExit(Collider other)
{
    if (other.gameObject.tag == "RespawnTrack")
    {
        print("respawn point added upon Trigger Exit");
        recordedTransformAtRespawnTrack = transform;
        recordedVelocityAtRespawnTrack = rb.velocity * 0.25f;
        print("rotation was: X,Y,Z=" + recordedTransformAtRespawnTrack.rotation.x + " , " + recordedTransformAtRespawnTrack.rotation.y + " , " + recordedTransformAtRespawnTrack.rotation.z);
        print("position was: X,Y,Z=" + recordedTransformAtRespawnTrack.position.x + " , " + recordedTransformAtRespawnTrack.position.y + " , " + recordedTransformAtRespawnTrack.position.z);
    }
}

public void CheckToRespawnCar()
{
    if (isRacing)
    {

        if (CrossPlatformInputManager.GetButtonDown("Jump"))
        {
            print("RESPAWN TRIGGERED BY PRESSING BUTTON");

            transform.position = recordedTransformAtRespawnTrack.position;
            transform.rotation = recordedTransformAtRespawnTrack.rotation;

            rb.velocity = recordedVelocityAtRespawnTrack;

        }

    }
}

sentences:
Start Position & Move Step Problem Swipe Motion Mobile Unity C# i am currently trying left & right, up & down swipe motion in unity C#.

I have done the scripting, it all working,

but after i debug the script,

the object's position suddenly changed to a very weird number:

from (-3, 0, 3) changed to (-3.000004, 0.00000464, 2.99999).

And i intend to move just 1 unit every time i swipe, but the unit seems different,

it always move around 1 but not exact 1 (Ex: maybe like 0.9954, or like 1.002931).

How i set the initial position to be exact integer number,

and also move only 1 unit every time i swipe? Thanks

  using UnityEngine;

    public class Player : MonoBehaviour
    {
        private Vector3 startTouchPosition, endTouchPosition;
        private Vector3 startRocketPosition, endRocketPosition;
        private float flyTime;
        public float speed = 1f;
        bool canMove;

        void Start()
        {
            transform.position = new Vector3(-3, 0, 3);
        }

        void Update()
        {
            if (Input.touchCount > 0 && Input.GetTouch(0).phase == TouchPhase.Began)
            {
                startTouchPosition = Input.GetTouch(0).position;
            }
            if (Input.touchCount > 0 && Input.GetTouch(0).phase == TouchPhase.Ended)
            {
                endTouchPosition = Input.GetTouch(0).position;

                float xDifference = Mathf.Abs(endTouchPosition.x - startTouchPosition.x);
                float yDifference = Mathf.Abs(endTouchPosition.y - startTouchPosition.y);

                if ((endTouchPosition.x < startTouchPosition.x) && xDifference >= yDifference && transform.position.x > -5.5f)
                {
                    //StartCoroutine(Fly("left"));
                    MoveLeft();
                }
                else if ((endTouchPosition.x > startTouchPosition.x) && xDifference >= yDifference && transform.position.x < -0.5f)
                {
                    //StartCoroutine(Fly("right"));
                    MoveRight();
                }
                else if ((endTouchPosition.y > startTouchPosition.y) && yDifference >= xDifference && transform.position.z < 5.5f)
                {
                    //StartCoroutine(Fly("up"));
                    MoveUp();
                }
                else if ((endTouchPosition.y < startTouchPosition.y) && yDifference >= xDifference && transform.position.z > 0.5f)
                {
                    //StartCoroutine(Fly("down"));
                    MoveDown();
                }
            }
            if (canMove)
            {
                transform.position = Vector3.Lerp(startRocketPosition, endRocketPosition, speed * Time.deltaTime);
                canMove = false;
            }
        }

        {
            startRocketPosition = transform.position;
            endRocketPosition = new Vector3(startRocketPosition.x - 10f, 0, transform.position.z);
            canMove = true;
        }
        void MoveRight()
        {
            startRocketPosition = transform.position;
            endRocketPosition = new Vector3(startRocketPosition.x + 10f, 0, transform.position.z);
            canMove = true;
        }
        void MoveUp()
        {
            startRocketPosition = transform.position;
            endRocketPosition = new Vector3(startRocketPosition.x, 0, transform.position.z + 10f);
            canMove = true;
        }
        void MoveDown()
        {
            startRocketPosition = transform.position;
            endRocketPosition = new Vector3(startRocketPosition.x, 0, transform.position.z -10f);
            anMove = true;
        }

sentences: How do 3D rendering pipelines render light effects? How does 3D software like Blender, Maya, Unity, or Houidini etc. render the effects of lights illuminating a 3D scene?

sentences:
What is the best way to "carve" a terrain created from a heightmap? I have a 3d landscape created from a heightmap. I'd like to "carve" some holes in that terrain. That will allow me to create bridges, caverns and tunnels inside it.

That operation will be done in the game editor so it doesn't need to be realtime. In the end, rendering is done using traditional polygons.

What would be the best/easiest way to do that ? I already think about several solutions :

Solution 1

1) Create voxels from the heightmap (very easy). In other words, fill a 3D array like this : voxels[32][32][32] from the heightmap values.

2) Carve holes in the voxels as i want (easy too).

3) Convert voxels to polygons using some iso-surface extraction technique (like marching cubes).

4) Reduce (decimate) polygons created in 3).

This technique seems to be the most promising for giving good results (untested). However the problem with marching cubes is that they tends to produce lots of polygons thus reducing them is mandatory. Implementing 4) also seems not trivial, i have read several papers on the web and it seems pretty complex. I was also unable to find an example, code snippet or something to start writing an algorithm for triangle mesh decimation.
Maybe there is a special decimation algorithm (simpler) for meshes created from marching cubes ?

Solution 2

1) Create some triangle mesh from the heighmap (easy).

2) Apply severals 3D boolean operation (eg: subtraction with a sphere) to carve the mesh.

3) apply some procedure to reduce polygons (optional).

Operation 2) seems to be very complex and to be honest i have no idea how to do that. Also applying many boolean operation seems to be slow and will maybe degrade the triangle mesh  every time a boolean operation is applied.

sentences:
Is there a reliable and fast way of getting a list of all installed games on a Windows PC? Note: This was the best fitting stack I could find for this. Apparently this site doesn't specify in the scope whether this is allowed. I originally asked in Meta, and they told me to create the question so the community could decide using a concrete question.

Like other people with large gaming libraries, I've often been faced with uncertainty about what game to play. There are websites that can check your Steam library and suggest you a game based on things like Metascore, user ratings, genre preferences,... but there are 3 major issues with these:

They require an internet connection;
They check all your games, which also means games you've yet to download or which you got through a bundle deal with no intention of ever playing;
They only check Steam games, not games from other clients or even just classic disc-based games.

During my spare time, I had been working on a small C# program trying to fix this. It worked using a very brute-force way: you entered a folder name, it would get ALL files from that folder, then filter out everything that wasn't a .exe file and the stuff that didn't look like it was a game executable. It kinda worked, but it had 3 main issues:

SLOOOOOOW! it took 15 minutes to get all the files, if it didn't crash due to memory issues.
it included things that weren't games, like uninstallers, C redists and utilities;
I wrote it as an UWP program, which meant it wasn't portable to Windows 7 and 8 and was lacking proper libraries for things like mocking.

I'm taking another stab at it soon, but this time, I don't want to do it brute-force. I'm hoping to leverage the power of the platform and use readily available methods to find what I need.

My question is:

Does Windows have something that can give me a list of installed games?
If Windows can't do it, do the major digital distribution clients (meaning Steam, Origin and UPlay) have a way to provide a list of installed games? I don't mind if it means parsing files and then looking things up.

sentences:
Single pass separable gaussian blur problem I created a single pass gaussian blur using HLSL compute shader. I also want it to be separable, which means, that first I perform blur along the horizontal direction, write out the result to the texture, then perform the vertical blur with the horizontally blurred data.

I do this by creating DeviceMemoryBarriers before and after writing out the blur results to the globallycoherent Texture2D.

This is my shader:

Texture2D<float4> input:register(t0);
globallycoherent RWTexture2D<float4> input_output:register(u0);

// Note: Shader requires feature: Typed UAV additional format loads!
[numthreads(16, 16, 1)]
void main(uint3 DTid : SV_DispatchThreadID)
{
    // Query the texture dimensions (width, height):
    uint2 dim;
    input_output.GetDimensions(dim.x, dim.y);

    // Determine if the thread is alive (it is alive when the dispatchthreadID can directly index a pixel)
    if (DTid.x < dim.x && DTid.y < dim.y)
    {
        // Do bilinear downsampling first and write it out:
        input_output[DTid.xy] = input.SampleLevel(sampler_linear_clamp, ((float2)DTid + 0.5f) / (float2)dim, 0);
        DeviceMemoryBarrier();

        uint i = 0;
        float4 sum = 0;

        // Gather samples in the X (horizontal) direction:
        [unroll]
        for (i = 0; i < 9; ++i)
        {
            sum += input_output[DTid.xy + uint2(gaussianOffsets[i], 0)] * gaussianWeightsNormalized[i];
        }
        // Write out the result of the horizontal blur:
        DeviceMemoryBarrier();
        input_output[DTid.xy] = sum;
        DeviceMemoryBarrier();
        sum = 0;

        // Gather samples in the Y (vertical) direction:
        [unroll]
        for (i = 0; i < 9; ++i)
        {
            sum += input_output[DTid.xy + uint2(0, gaussianOffsets[i])] * gaussianWeightsNormalized[i];
        }
        // Write out the result of the vertical blur:
        DeviceMemoryBarrier();
        input_output[DTid.xy] = sum;
    }
}

The problem is that the result flickers a bit, and has some errors in the image, too. Seems a bit like a thread group can't see writes by other groups.

But there is a globallycoherent modifier before the RWTexture2D which should flush the entire resource so that writes are visible in every thread group (MSDN). Indeed, if I remove that modifier, then the flickering becomes a whole lot worse than if I leave it there.

Here is a screenshot of the problem:

(Notice the lines on the windmill, and it also flickers on the whole image from time to time which is not visible on a still shot)

Anyone here has an idea what I can do about it? (PS. the blur is performed when creating mipmaps, so I very much want to avoid multiple passes because it is already one pass for each mip)

sentences:
Detecting internet Connection on Unity connection to serve ads How can you detect someone's Internet connection in Unity? I see a lot of forums where people make a request to any site (mostly google.com) to check it, but it does not seem to be an elegant solution.

With 3G/4G connections to serve Unity ads or admob interstitial, it takes a lot of time and crashes the game.

Regards!

sentences:
Software rendering 3d triangles in the proper order I'm implementing a basic 3d rendering engine in software (for education purposes, please don't mention to use an API). When I project a triangle from 3d to 2d coordinates, I draw the triangle. However, it's in a random order and so whatever gets drawn last draws on top of all other triangles (which might be in front of triangles it shouldn't be in front of)...

Intuitively, seems I need to draw the triangles in the correct order. So I can calculate all their distances to the camera and sort by that. The objects furthest away get drawn last. Is this the proper way to render triangles? If I'm sorting all the objects, this is n*log(n) now. Is this the most efficient way to do this?

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:
Question About Scrolling A Tilemap In C++/SDL/OpenGL I been working with scrolling this week but I recently encounter a problem that I don't understand why it's happening.

In a 2D scroller I want to scroll a tilemap pixel per pixel which gives a smooth scrolling in the game, but I encounter a weird problem, when the movement of the map corresponds with the exact size of the tile, for example, the map it's scrolling 32 pixels to the right, the map seems to jump to the next tile and not the one that corresponds correctly with the screen.

This is the code for drawing the map:

bool Tilemap::drawTilemap(GLfloat sizeTile, int indexTileset)
{
    offsetX++;
    if (offsetX >= 320.f) offsetX = 320.f;

    GLfloat widthTilesetImage = tilesetList.at(indexTileset).getWidthImage();
    GLfloat heightTilesetImage = tilesetList.at(indexTileset).getHeightImage();

    int widthMap = 40 + offsetX/32;
    int heigthMap = 23;

    glBlendFunc(GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA);

    glEnableClientState( GL_VERTEX_ARRAY );
    glEnableClientState( GL_TEXTURE_COORD_ARRAY );

    glBindTexture( GL_TEXTURE_2D, tilesetList.at(indexTileset).getTexture() );

    for (int i = 0; i < heigthMap; i++)
    {
        int startX = offsetX/32;

        for (int j = 0; j < 40; j++)
        {
            int frameIndex = layerMap[i][startX];

            if (frameIndex == 0)
            {
                continue;
            }

            frameIndex -= 1;

            const GLfloat tileX = 0.0f + ( (sizeTile)*j);
            const GLfloat tileY = 0.0f + (sizeTile*i);

            const GLfloat verts[] = {
                    tileX, tileY,
                    tileX + sizeTile, tileY,
                    tileX + sizeTile, tileY + sizeTile,
                    tileX, tileY + sizeTile
            };

            const GLfloat textureWidth = (sizeTile - offsetX/widthTilesetImage) / (GLfloat)widthTilesetImage;
            const GLfloat textureHeight = sizeTile / (GLfloat)heightTilesetImage;
            const int numFramePerRow = (GLfloat)widthTilesetImage / sizeTile;
            const GLfloat textureX = ((frameIndex % numFramePerRow) * textureWidth)+offsetX/widthTilesetImage;
            const GLfloat textureY = (frameIndex / numFramePerRow ) * textureHeight;

            const GLfloat texVerts[] = {
                    textureX, textureY,
                    textureX + textureWidth, textureY,
                    textureX + textureWidth, textureY + textureHeight,
                    textureX, textureY + textureHeight
            };

            glVertexPointer(2, GL_FLOAT, 0, verts);
            glTexCoordPointer(2, GL_FLOAT, 0, texVerts);
            glDrawArrays(GL_QUADS, 0, 4);

            startX++;

        }
    }

    glDisableClientState( GL_VERTEX_ARRAY );
    glDisableClientState( GL_TEXTURE_COORD_ARRAY );

    return true;
}

The variable offsetX it's the one that helps me move one tile at a time the map. The variable startX indicates when it's no longer drawing one tile, so in this one start in the next column of the matrix of tiles.

So, what could be wrong in my code?

Thanks for the help.

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

Is there an alternative to GPL?

sentences: PyGame for Python 3.5 I am running Python 3.5 and I want to install PyGame, the website only supports up to version 3.2. I have tried a few forums on this and other websites but they are all for Python 3.4. Does anyone know were I can find the install file for Python 3.5 and how to install it?

sentences: Google Play Game Services (Unity Plugin) Turn Based Multiplayer List of Open Matches I took a closer look at Google Play games services Turn based multiplayer, and I cannot find out if I am somehow able to just get a list of all open matches, so that I can implement my own GUI. It seems really weird to me that they would not let you do such a simple task. Is this just a problem with the Unity implementation or is it a general problem? Using the Google UI would make a clunky feel which I would like to avoid.

sentences:
Multi purpose item class design in C# I'm currently trying to get my head around how to create an item class which contains data for multiple purposes.

As for example I would like to have an Axe which could be used as weapon, but also as a tool to chop trees. The class should contain the following:

Durability, weight, damage vs npcs/players (when attacking), damage vs trees (when chopping), attack speed, chop speed and some enum in which equipment slot the axe fits (e.g. melee slot).

What would be the typical approach?

I stumbled about this answer, but I'm not 100% sure if I'm understanding him right. Is it something like:

public class Item {

    public int durability;
    public float weight;

    public Weapon weapon;
    public Tool tool;

    public class Weapon {
        public int damage; // damage vs players
        public int speed; // attack speed
    }

    public class Tool {
        public int damage; // damage vs trees
        public int speed; // chop 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:
How to utilize miniMax algorithm in Checkers game I am sorry...as there are too many articles about it.But I can't simple get this.

I am confused in the implementation of AI. I have generated all possible moves of computer's type pieces. Now I can't decide the flow. Whether I need to start a loop for the possible moves of each piece and assign score to it.... or something else is to be done.

Kindly tell me the proper flow/algorithm for this. Thanks

UPDATE:

MiniMax code

Now I coded the algorithm but not getting correct moves. Please help me find out the logical error.

sentences:
Unity In-game pause menu not working? I have followed a tutorial to implement a pause screen for my platformer game. I followed it thoroughly but could not get it working. When I press the escape button which I assigned under the project manager under the name "Pause", it just doesn't do anything. I checked with the Scene view as well, nothing appears. Any help would be appreciated.
Edit: The script is a component of the Main Camera, not the Canvas or the PauseUI itself.
 public GameObject PauseUI;

 private bool paused = false;

void Start()
{
    PauseUI.SetActive(false);
}

void Update()
{
   if(Input.GetButtonDown("Pause"))
   {
       paused = !paused;
   }

   if(paused)
   {
       PauseUI.SetActive(true);
       Time.timeScale = 0;
   }

   if(!paused)
   {
       PauseUI.SetActive(false);
       Time.timeScale = 1;
   }
}

sentences:
Conservation of energy of a bouncy ball in Unity3d My problem is that in the project I have a ball with a physicMaterial where:

Dynamic Friction and Static Friction both are 0
Bounciness = 1
Friction Combine is set to Multiply
Bounce Combine is set to Maximum

This ball has a rigid body attached in which:

mass = 1
drag  and angular drag both are 0
useGravity = true

There are some cubes which create a boundary for the ball to bounce inside.
The ball bounces in a closed boundary. The problem is overtime its top velocity keeps on increasing and after sometime it gets out of the boundary.

I want the velocity of this ball to NOT exceed a provided maxVelocity. Here i am sharing my project through google drive  bounceProblem.unitypackage

sentences:
Is libgdx fit for 2D game development on Android or are there simpler alternatives? I'm looking for a Java framework to develop 2D games on desktop and Android. I've looked at Slick and I really like the API, however the developer himself says if you want a framework for Android and desktop best go with libgdx atm.

Now I'm reading up on libgdx, but I'm wondering if there are simpler alternatives for just doing 2D sprite stuff on Android and desktop. I'm only interested in creating NES like graphics, nothing too fancy. Something like this.

Because on the wiki of libgdx it says you can't use the OrtographicCamera with OpenGL ES 2.0 (http://code.google.com/p/libgdx/wiki/OrthographicCamera), but I read (http://www.badlogicgames.com/wordpress/?p=504) when your device supports OpenGL ES 2.0 it doesn't support 1.0, so you can't effectively use OrtographicCamera on OpenGL ES 2.0 devices?

I'm confused, should I go with libgdx? Are there simpler alternatives?

sentences:
What is the best way to manage 'state' in Phaser? I have heard that this is not the best way to manage state in phaser

var game = new Phaser.Game(800, 600, Phaser.CANVAS,'YourGameName');
game.state.add("Boot", Boot);
game.state.add("Preload", Preload);
game.state.add("MainMenu", mainMenu);
game.state.add("Play", Play);
game.state.add("GameOver", GameOver);
game.state.start("Boot");

so what is the best way to do it. I am newbie in Phaser game development.

sentences:
How can I model the physics of an air blower? I want to model simple lottery machine, it has got a bottom blower.

Do you know how can I get force applied to object above blower by air from blower, or equations to model this behavior?

Red arrow is blower "wind"

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

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

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

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:
throw a 2D ball facing the target to simulate a 3D like effect How would you update the state of a 2D object that is thrown forward(with an arc) facing a target to simulate a 3D(depth) like effect?

var ball; //2D ball from a sprite sheet
ball.x = 0;
ball.y = 0;
ball.scaleX = 1;
ball.scaleY = 1;

ball.throw(); //set ball to a throwing state
ball.update(); //update the ball's positon and depth by calculating its current coordinates and scale.
ball.render();

sentences:
Ultimate beginner's tutorial to 3d game dev using XNA Framework? I'm looking for a tutorial that starts at square 1 for game development and moves up through intermediate/expert levels of 3D game development. I really want to get into 3D game dev and I've been trying to for awhile in my free time, but I know so little at times that I'm not even sure what terminology to use in order to phrase a question properly.

Ideally, I'm hoping to find tutorials for the XNA Framework, what little experience I have is XNA.

I've been developing for years and don't really need help with the language. What I know I need help on is stuff like rendering, what exactly a Matrix represents, and other things in the framework's library. I don't even know what all is available in the library.

sentences:
Clicking on clues and other objects in a 2D cluedo like game I'm a java/android programmer, but I don't have any experience in game programming, I'm already reading proper books, like "Pro Android Games", but my concerns are more about the ideas behind game programming than the techniques themselves.

I'm working on a 2D game, something like Cluedo to let you understand the genre. I would like to know how should I act with the "scenes", for example, a room with a desk, TV, windows and a lamp. I need to make some items tappable and others not. Is it common  to use one image (invisible to the user) with every different item a different color, then call the getColor() method on the image? Or use one image as background, and separate images for all the items? If the latter, how can I set the positioning? and should I use imageView or imageButton?

I'm sorry if those are really low quality questions, but as "outsider" ( I'm 23 and still finishing my university ) it's pretty hard learn alone.

sentences:
Top-down 2D push angle velocity I'm trying to determine the angle NPCs are pushed in when the PLAYER collides with them, like how 'Retro City Rampage' and 'Shakedown Hawaii' do when you bump in pedestrians.

Here the PLAYER (green) is coming in at an angle of -45, what's the math or formula I need to be looking at to decide the new angle each NPC (red) should adopt?

sentences:
Assets Management, database or versioning system? While developing the assets for the game, (meshes, textures, sounds, videos) ho do you manage them?

Keeping them together with the source code
inside the versioning system? (perforce, git, etc…)
Or having a central back-upped, database
dedicated to the assets and having
the editors always work liked to it?
(PostgreSQL, MySQL, etc…)
Other?

What are the pro and cons of each, and why one should choose it over the other/s?

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:
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:
Context is NULL with SDL_CreateWindowFrom Win32 There is a VC ++ Win32 project. It connected the library sdl, follows CreateWindowW I have written

 SDL_Window* w = SDL_CreateWindowFrom(hWnd);
 //  SDL_WindowFlags(SDL_WINDOW_OPENGL);
   SDL_GLContext glcontext = SDL_GL_CreateContext(w);
   if (glcontext == NULL)OutputDebugString("null");

But my glcontext == NULL and SDL_GetError returns  The specified window isn't an OpenGL window

But if I use SDL_CreateWindow, context turns out successfully

Even after the creation of the window using

static PIXELFORMATDESCRIPTOR pfd = {
       sizeof(PIXELFORMATDESCRIPTOR), // strcut size
       1,                              // Version number
       PFD_DRAW_TO_WINDOW |    // Flags, draw to a window,
       PFD_SUPPORT_OPENGL, // use OpenGL
       PFD_TYPE_RGBA,          // RGBA pixel values
       24,                     // 24-bit color
       0, 0, 0,                // RGB bits & shift sizes.
       0, 0, 0,                // Don't care about them
       0, 0,                   // No alpha buffer info
       0, 0, 0, 0, 0,          // No accumulation buffer
       32,                     // 32-bit depth buffer
       0,                      // No stencil buffer
       0,                      // No auxiliary buffers
       PFD_MAIN_PLANE,         // Layer type
       0,                      // Reserved (must be 0)
       0,                      // No layer mask
       0,                      // No visible mask
       0                       // No damage mask
   };

   // Did We Get A Device Context?
   hDC = GetDC(hWnd);

   PixelFormat = ChoosePixelFormat(hDC, &pfd);

   SetPixelFormat(hDC, PixelFormat, &pfd);

   // Are We Able To Get A Rendering Context?
   hRC = wglCreateContext(hDC);

   // Try To Activate The Rendering Context
   wglMakeCurrent(hDC, hRC);
   ReleaseDC(hWnd, hDC);
   ShowWindow(hWnd, nCmdShow);

   SDL_InitSubSystem(SDL_INIT_VIDEO);

   SDL_Window* w = SDL_CreateWindowFrom(hWnd);
   SDL_GLContext glcontext = SDL_GL_CreateContext(w);
   if (glcontext == NULL)OutputDebugString("null");

Can not get context. How correctly get the context?

sentences: how should a server handle client actions? So I've just started trying to make a multiplayer pong game and  I have read a lot of different ways to code the connections.  However, I read somewhere that you should have the inputs sent to the server queue up and then the server just processes it at fixed intervals.  However, if this is done, how does the server know, process, and send accurate data based on the time the action was sent?  Because if the data is just queued up, if something happens like 100 ms after another but the server processes them at the same time, wouldn't that mess up the synchronization of the game?  Should the server instead be coded to handle the client actions immediately even if it costs a lot of cpu etc in larger games?

sentences:
AdMob Rewarded Video Ads always shows same ad I have integrated AdMob rewarded video ads in my iOS game. Currently, the game is in development stage and not released on the store. Currently, the fill rate is around 30%-40% and I always see the same rewarded video ad. I have following questions:

Why the fill rate is such low? I am testing the game in India and the US.
Why the game is receiving the same ad from AdMob? Are there any settings that can allow different ads from the network?

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

More information:

The test ads gives 95%-98% fill rate. Hence, I think there is no problem with the AdMob SDK configuration. Previously, I tried using AdMob mediation and the ads were coming other ads networks (NO ADS FROM ADMOB).

Is there a AdMob policy where they don't provide enough ads to "under development" game/application?

sentences:
LibGDX - draw bullet physics bounding box I am very new to game development and I am trying to debug my 3d collision bounds. Could somebody give me an example on how to draw the collision bounds of an object in libGDX?

I assume it has something to do with btIDebugDraw but I can't find any examples on how to draw them.

sentences:
How can I create the arriving/ engaging in combat movement like in StarCraft 2? I currently have two armies (smaller scale) crashing into each other. They will usually form a line of units fighting. I have no idea how to handle a unit coming from behind the line to properly go around its allies to reach the enemies. Like in this position, where a new unit approaching from the green army needs to navigate around the battle front to reach the red enemies:

StarCraft 2 handles this beautifully, as seen here:

I've read that SC2 uses steering for local avoidance and A* and some other methods to plan out the paths. Which all is perfectly clear, but I haven't found anywhere any details on engaging the enemy.
This is what I have, it's been a month and I still haven't solved this specific issue.

How is it possible to do continuous checks of possible destinations before engaging the enemy, wouldn't it be too costly? To clarify, in the video of the Zerglings vs Zealots, they first engage each other and form a line, all the other units that come after them will go around the line, but, if space opens in the line they will immediately go towards it. This kind of arrival behaviour is briefly explained in their GDC talk, they have a cone of vision in which they do checks. The only ideas I had was

Have a cone of vectors (in the direction of Velocity) and do checks for each vector to see if it could provide a favorable position to move to
issue: Cannot figure out the math to create offsetted (by an angle) vectors, but it seems like a pretty decent solution

Have a spatial query in a rectangle to where the unit is moving
issue: How do I check for an empty space? I can get all entities in that rectangle but how can I check for empty places and score them (how favorable are they)? Are they even reachable, I'd still need some kind of raycast like with the first option

I have circlular collision shapes, seperation and goal following in place. I somewhat have introduced a goal system that should further spread the units, but as it stands I still lack the arrival behaviour described in the GDC talk.

sentences: Sending position updates from server to clients (Unity + gRPC) So clients connect to the server and the server spawns an entity for each of them. What I'm confused about is how to send position updates from the server to the connected clients. I read about bidirectional streaming but I'm confused because that would mean clients would have to specifically request the positions every update, which is not what I want. I want the server to send positions to every connected client. Is it possible to do it with gRPC? If so, how would I go about it?

sentences:
Calculating position to position B with speed I am trying to find out a formula that calculates the actual position of a player using his speed and a destination position.

These are the informations I have:

Vector3 (X,Y,Z) : Current position
Vector3 (X,Y,Z) : Destination position
float : Speed

I can manage to calculate the angle between these two vectors, but I can't find an efficient formula to calculate the exact position using the speed at each loop. Do you have an idea?

EDIT*

I finally found a formula, but it's not really working as I want...

private void WalkNew()
{
    float speed = 0.1f;
    float distX = this.DestinationPosition.X - this.Position.X;
    float distZ = this.DestinationPosition.Z - this.Position.Z;
    float distance = (float)Math.Sqrt((distX * distX) + (distZ * distZ)); // distance between A and B positions

    float time = distance / speed;
    float currentTime = Time.GetTickFrom(this.lastMoveTime);
    this.lastMoveTime = Time.GetTick();
    float percentage = currentTime / time;

    if (this.Position.IsInCircle(this.DestinationPosition, 0.1f))
    {
        // We arrived
    }
    else
    {
        this.Position.X += distX / percentage;
        this.Position.Z += distZ / percentage;
    }
}

Any thoughts about this formula ?

Thanks

sentences:
Pathfinding onComplete event? In HaxeFlixel 4 all FlxObjects have a path property which must be a FlxPath instance

class FlxObject extends FlxBasic
{
    ...
    /**
     * The path this object follows.
     */
    public var path(default, set):FlxPath;
    ...

a tilemap can be used to find a path

var points:Array<FlxPoint> = tileMap.findPath(pathStart, pathEnd);

and then an object can walk that path

object.path = new FlxPath();
object.path.start(points);

What I want to do is run some custom code when the path ends, whether it was cancelled or was fully completed

what I see others do is this (player being the object in question)

override public function update(elapsed:Float):Void
{
    if(Std.is(player.path, FlxPath)){
        if (player.path.finished || player.path.nodes==null) {
            trace('finished walking');
        }
    }

But this tends to run indefinitely once the player has finished walking, yet I want it to run once. Secondly I don't even want the PlayState update function to be aware that there was an event where the player finished walking, it's none of it's business unless I tell it that it happened, I want this code block to be self-contained.

I discovered that FlxPath has an onEnd function, which is exactly what I need, but it does not call any callback, neither are there any ways that I know of to attach it, there is also the onComplete property, but I was not able to make use of it.

so here is what I'd ideally like

object.path = new FlxPath();
object.path.start(points, function(cancelled){
    trace((cancelled) ? 'path cancelled': 'path completed');
});

and this would run only once upon the path ending or getting cancelled

any ideas on some way of achieving this?

sentences:
How to create a puzzle where the player needs to rotate hexagons to connect to the neighbors? I was researching different puzzle ideas and came across a game called Warframe that requires the player to hack a console to progress further into the level.

The player has to spin around the hexagons (randomly generated, and get more difficult later on) to link up the connections to other hexagon neighbors.  It's simple for the player to do, but also quite fun from my research.

How can I create something similar to this?

Edit:  To be more specific; I would like to know how to generate a puzzle like below and how to check for successful connections.  The graphics, animations, and player input I can handle.  I suppose it's more about the algorithms to create the puzzle and then check the conditions.

I couldn't figure out good search terms to find something similar.  So even if someone can point me in the right direction, that would be helpful.

I will be doing this in Unity / C#.

Example of doing a puzzle.

sentences:
GLFW / OpenGL location and size in pixels I'm using GLFW to create a little game. (and by little, I mean: small, nonprofit)

After a while of puzzling, I found out that this draws a texture (from an image, for instance) to the screen:

(the syntax is in Go, but the library is the same as the C/C++ version)

gl.BindTexture(gl.TEXTURE_2D, tex)
gl.Color4f(1, 1, 1, 1)

gl.Begin(gl.QUADS)

gl.Normal3f(0, 0, 0)

gl.TexCoord2f(1, 1)                     // top right
gl.Vertex3f(1, -1, 0)

gl.TexCoord2f(0, 1)                     // bottom right
gl.Vertex3f(-1, -1, 0) // = location

gl.TexCoord2f(0, 0)                     // bottom left
gl.Vertex3f(-1, 1, 0)

gl.TexCoord2f(1, 0)                     // top left
gl.Vertex3f(1, 1, 0)

gl.End()

This draws the texture perfectly. There is just one downside: as my screen is 16:9, the texture also gets rendered/displayed as 16:9. But as this is a square image (32 by 32 pixels), how do I get it to draw just those pixels, instead of defining it relative to the screen ratio? (values between -1 and 1)

My first assumption was that I can compute what the values should be, by comparing it with the actual screen size, but this feels like it's not the way to go.

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:
XNA Seeing through heightmap problem I've recently started learning how to program in 3D with XNA and I've been trying to implement a Terrain3D class(a very simple height map). I've managed to draw a simple terrain, but I'm getting a weird bug where I can see through the terrain. This bug happens when I'm looking through a hill from the map. Here is a picture of what happens:

I was wondering if this is a common mistake for starters and if any of you ever experienced the same problem and could tell me what I'm doing wrong. If it's not such an obvious problem, here is my Draw method:

public override void Draw()
{
    Parent.Engine.SpriteBatch.Begin(SpriteBlendMode.None,
        SpriteSortMode.Immediate, SaveStateMode.SaveState);

    Camera3D cam = (Camera3D)Parent.Engine.Services.GetService(typeof(Camera3D));
    if (cam == null)
        throw new Exception("Camera3D couldn't be found. Drawing a 3D terrain requires a 3D camera.");

    float triangleCount = indices.Length / 3f;

    basicEffect.Begin();

    basicEffect.World = worldMatrix;
    basicEffect.View = cam.ViewMatrix;
    basicEffect.Projection = cam.ProjectionMatrix;
    basicEffect.VertexColorEnabled = true;

    Parent.Engine.GraphicsDevice.VertexDeclaration = new VertexDeclaration(
        Parent.Engine.GraphicsDevice,
        VertexPositionColor.VertexElements);

    foreach (EffectPass pass in basicEffect.CurrentTechnique.Passes)
    {
        pass.Begin();
        Parent.Engine.GraphicsDevice.Vertices[0].SetSource(vertexBuffer, 0,
            VertexPositionColor.SizeInBytes);
        Parent.Engine.GraphicsDevice.Indices = indexBuffer;
        Parent.Engine.GraphicsDevice.DrawIndexedPrimitives(PrimitiveType.TriangleList,
            0, 0, vertices.Length, 0, (int)triangleCount);
        pass.End();
    }

    basicEffect.End();

    Parent.Engine.SpriteBatch.End();
}

Parent is just a property holding the screen that the component belongs to. Engine is a property of that parent screen holding the engine that it belongs to.

If I should post more code(like the initialization code), then just leave a comment and I will.

sentences:
OpenGL ES 2.0 - How to batch draw particles that have unique translations, rotations, scales, and alphas? I've combined all of my vertex data for many particles into a single array.  How would I batch draw all of those particles in a manner that preserves their unique translations?

Any code examples would be greatly appreciated.

sentences:
Where and how should I check for collision in multiplayer game? I'm making a multiplayer game. For now, I added a script to towers and I have booleans to change using OnTriggerEnter.

When triggered, client sends a message to server and towers health starts to get lower. So it works.

But I don't know if it's safe to use OnTriggerEnter because it calculates on the client side. Should I calculate on the server side ? And how I do it ? (Using Physics.ComputePenetration is a little bit slow.)

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:
Graphics programming replicating the transition from Chrono Trigger inside the gate I started playing this game for the first time lately and this really peaked my interest

You can see the transition in motion starting at ~12:08

There seems to be some interesting maths taking place in there. It would appear that there are two different views combined together. The blue ripples are rendered first in the background and then the purple oscillating waves appear to be rendered on some sort of pseudo 3D projection.

How exactly they came to this result however is beyond me and curiosity has got the better of me.

I don't expect a lot of people would know how this is especially done but if anyone has done some extensive graphics programming, perhaps they could enlighten me.

sentences:
Camera Math for Directions I have a Camera object that has the variables:

class Camera : Object
{
    public:
        float positionX, positionY, positionZ;
        float directionX, directionY, directionZ;
        int speed;
}

The positions are what I will draw my scene's position based on, the direction is a value between 0 and 1 that I will multiply for the speed to get the next position:

if(keyboardInput.GetKeyState(Key::ArrowUp) == KeyState::Pressed)
{
    _viewCamera.positionX = _viewCamera.directionX * _viewCamera.speed;
    _viewCamera.positionY = _viewCamera.directionY * _viewCamera.speed;
    _viewCamera.positionZ = _viewCamera.directionZ * _viewCamera.speed;
}

The problem is the rotation direction, which I'm calculating with:

if(mouseInput.GetButtonState(Button::RightButton) == ButtonState::Pressed)
{
    //Here I get how many pixels the mouse moved between the X and Y axis with mouse sensitivity accounted for
    float rotationX = mouseInput.GetMouseMoveX();
    float rotationY = mouseInput.GetMouseMoveY();

    _viewCamera.directionX = sin(rotationX * 3.1415/180);
    _viewCamera.directionY = sin(rotationY * 3.1415/180);

    _viewCamera.directionZ = cos(rotationX * 3.1415/180);
}

There is something missing here, but I can't get it right.
The direction when I'm looking to the left or right works fine, but when I look up or down I'm not taking into account the rotationY for calculating the Z direction.

This means, if I'm looking straightly down, I'm not supposed to move forward or backwards, just down along the Y axis. But I'm going forward/backward because I'm not calculating the rotationY in the directionZ.

I tried subtracting the cos(rotationY) to directionZ, but the movement didn't felt right (was pretty weird actually).

What's the proper math so I get the correct movement along all axis?

sentences:
In Unity, How to format Old RPCs into new "PunRPCs" In older unity versions you could simply used RPC. With newer verisons of Unity my code now doesn't work and it says that it needs to be transformed into "PunRPC" , Pun being "Photon Unity Networking." I am not sure how to reformat it to work with current unity versions. Can anyone shed light on this?

My Code

FXManager.cs

1 using UnityEngine;
2 using System.Collections;
3
4 public class FXManager : MonoBehaviour {
5
6   [RPC]
7   void SniperBulletFX( Vector3 startPos, Vector3 endPos ) {
8       Debug.Log ("SniperBulletFX");
9
10  }
11}

PlayerShooting.cs

1 using UnityEngine;
2    using System.Collections;
3
4    public class PlayerShooting : MonoBehaviour {
5
6   public float fireRate = 0.5f;
7   float cooldown = 0;
8   public float damage = 25f;
9   FXManager fxManager;
10
11  void Start() {
12      fxManager = GameObject.FindObjectOfType<FXManager>();
13
14      if(fxManager == null) {
15          Debug.LogError("Couldn't find a FXManger.");
16      }
17  }
18
19
20  // Update is called once per frame
21  void Update () {
22      cooldown -= Time.deltaTime;
23
24      if (Input.GetButton ("Fire1")) {
25          //Player wants to shoot...so. Shoot.
26          Fire ();
27      }
28  }
29
30  void Fire() {
31
32      if (cooldown > 0) {
33          return;
34      }
35
36      Debug.Log ("Firing our gun");
37
38      Ray ray = new Ray (Camera.main.transform.position, Camera.main.transform.forward);
39      Transform hitTransform;
40      Vector3 hitPoint;
41
42      hitTransform = FindClosestHitObject (ray, out hitPoint);
43
44      if (hitTransform != null) {
45          Debug.Log ("We hit:" + hitTransform.name);
46
47          // We could do a special effect at the hit location
48          // DoRicochetEffectAt (hitPoint);
49
50          Health h = hitTransform.GetComponent<Health> ();
51
52          while (h == null && hitTransform.parent) {
53              hitTransform = hitTransform.parent;
54              h = hitTransform.GetComponent<Health> ();
55          }
56
57          // Once we reach here, hitTransform may not be the hitTransform we started with!
58
59          if (h != null) {
60              // This next line is the equivalent of calling;
61              //                  h.takeDamage( damage);
62              //Except more "networky"
63              PhotonView pv = h.GetComponent<PhotonView> ();
64              if (pv == null) {
65                  Debug.LogError ("Freak out!");
66              } else {
67                  h.GetComponent<PhotonView> ().RPC ("TakeDamage", PhotonTargets.AllBuffered, damage);
68              }
69          }
70
71          if (fxManager != null) {
72              fxManager.GetComponent<PhotonView>().RPC ("SniperBulletFx", PhotonTargets.All, Camera.main.transform.position, hitPoint);
73          }
74      }
75      else {
76          // We didn't hit anything (except empty space), but let's do a visual FX anyway
77          if (fxManager != null) {
78              hitPoint = Camera.main.transform.position + (Camera.main.transform.forward*100f);
79              fxManager.GetComponent<PhotonView>().RPC ("SniperBulletFx", PhotonTargets.All, Camera.main.transform.position, hitPoint);
80          }
81      }
82
83      cooldown = fireRate;
84  }

If anymore information is needed, please let me know, I would love to figure out how the new "PunRPC(Photon Unity Neworking)" works so I can use it in future projects.

Edit: This is the error I get "PhotonView with ID 2 has no method "SniperBulletFx" marked with the PunRPC or @PunRPC(JS) property! Args: Vector3, Vector3
UnityEngine.Debug:LogError(Object)"

sentences:
Google Play Services Message Handling with Libgdx I'm looking for some idea of how to handle Reliable Messages in Google Play Services with libGDX. So far I've been using it like this: I was waiting for message with OnRealTimeMessageReceivedListener, setting an outside byte[] array to the message received, changing a flag that suggests that new message arrived to true, getting that message in my libGDX class using methods from interface, setting newMessage flag again to false, handling message, and so again waiting for new one

private OnRealTimeMessageReceivedListener mMessageRecievedHandler = new OnRealTimeMessageReceivedListener() {
        @Override
        public void onRealTimeMessageReceived(@NonNull RealTimeMessage realTimeMessage) {

            //Handle received message here

            byte[] message = realTimeMessage.getMessageData();

            /*byte tbye[] = message;
            ByteBuffer bb = ByteBuffer.wrap(tbye);
            if(bb.getFloat() == 1884) {
                Log.d("MESSAGETEST", "Message received in anL : " + debugIntL);
                debugIntL++;
            } */

            byteArray = message;

            newMessageFlag = true;
        }
    };

@Override
    public boolean getNewMessageFlag() {
        return newMessageFlag;
    }

@Override
    public byte[] getMessage() {
        newMessageFlag = false;
        return byteArray;
    }

Libgdx class:

@Override
    public void render (float delta) {
    ...
    checkForNewMessage();
    ...
   }

private void checkForNewMessage() {

    if(game.customHandler.getNewMessageFlag()) {
        handleMessage(); // handling message here
    }

}

private void handleMessage() {

        byte[] message = game.customHandler.getMessage();

        ByteBuffer bb = ByteBuffer.wrap(message);

        float typeOfMessage = bb.getFloat();

        if(typeOfMessage == NEW_UNIT_MESSAGE) {

            Gdx.app.log("MESSAGETEST", "Message received in gdx : " + debugInt);
            debugInt++;
            ...
           }
       }

But the result is, when uncommenting the code in OnRealTimeMessageReceivedListener and adding similar log to my handleMessage(); that some messages are skipped between receiving it in listener and checking for new in my libGDX class, I don't know why, maybe because some render calls take longer to do everything inside and it skips through one check call when there's significant number of those in small amount of time

On the image you can see that first log is from OnRealTimeMessageReceivedListener, which receives every message, but the second one is from handleMessage, and at 251 there it wasn't called, so handleMessage just skipped this message and went to the next one.

So here's my question, what's good way to handle those messages so that I won't skip any?

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:
Using multiple textures in Monogame HLSL Effect shader? My Monogame HLSL shaders only successfully sample one texture (besides the screen). Any additional textures I try to sample end up with the same texture data as the screen.

I've found people with similar issues as me, such as this thread. However, I'm unsure of what they've done to remedy the problem. Any solutions I've seen in other threads don't work.

C#

Lighting.Parameters["NightTexture"].SetValue(night);
Lighting.Parameters["SunsetTexture"].SetValue(sunset);

HLSL

float4x4 World;
float4x4 View;
float4x4 Projection;

Texture2D NightTexture;
sampler2D NightSampler = sampler_state
{
    Texture = <NightTexture>;
};

Texture2D SunsetTexture;
sampler2D SunsetSampler = sampler_state
{
    Texture = <SunsetTexture>;
};

sampler TextureSampler : register(s0);

float4 main(float4 position : SV_Position, float4 color : COLOR0, float2
texCoord : TEXCOORD0) : COLOR0
{
    // Different Grading
    float4 day = tex2D(TextureSampler, texCoord);
    float4 night = tex2D(NightSampler, texCoord);
    float4 sunset = tex2D(SunsetSampler, texCoord);

    float4 col = lerp(day, night, .5);
    col = lerp(sunset, col, .5);

    return col;
}

technique Technique1
{
    pass Pass1
    {
        PixelShader = compile ps_5_0  main();
    }
}

Note: The code is abbreviated to show the issue. When executed, the SunsetTexture and TextureSampler both have correct data, but the NightTexture copies the TextureSampler's data.

Any ideas how to fix this?

sentences: How does displacement mapping generalize bump mapping? This PDF discusses bump mapping, a special case of displacement mapping. A surface is represented as a function \$\overrightarrow{O}\left(u,\,v\right):\:\Bbb R^2\mapsto\Bbb R^3\$. In bump mapping, we shift this surface by \$\delta\overrightarrow{O}=B(u,\,v)\overrightarrow{N}\$, with \$\overrightarrow{N}=\overrightarrow{O}_u\times\overrightarrow{O}_v\$ the surface normal. What happens in more general displacement mapping? Do we, for example, replace \$B\$ with a matrix, or include multiples of \$\overrightarrow{O}_u,\,\overrightarrow{O}_v\$ in \$\delta\overrightarrow{O}\$? If there's too broad a variety of displacement maps to describe in one answer, I'll settle for one or more mathematically detailed references.

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:
Colliders stop working when they move I'm trying to make a game where you play basketball as a catapult. Obviously an idea like this leans heavily on the unity physics engine. The cup of the catapult has a bucket on it to keep the ball from falling out. When you hit space, the arm of the catapult spins, which should throw the ball out of the bucket of the catapult. Instead, the ball passes through the cup of the catapult(when it isn't spinning, it acts normally and rolls around the bucket) and then it doesn't fall whatsoever, eve though has gravity is enabled. Here are my physics settings:
The ball

The cup(and also a cup with flipped normals)

The Rim of the bucket

Here's my ball throwing code:
public class BallThrower : MonoBehaviour
{
    private Vector3 axis;
    // Start is called before the first frame update
    void Start()
    {
        axis = transform.position;
    }

    // Update is called once per frame
    void Update()
    {
        if (Input.GetKey(KeyCode.Space))
        {
            if (transform.rotation.z > -95.4)
            {
                transform.Rotate(0f, 0f, -5f, Space.Self);

            }
        }
    }
}

What's missing here? Should I make the cup a rigidbody? Let me know if you need more info, Thanks!

sentences:
Shooting the closest enemy that you can see I'm trying to make my main character aim at the closest enemy that he can see.

My issue is with the close range criterion taking priority. If the enemy is near the player but the player can't see him, I'd like the player to look for another enemy inside his range.

As you can see in the image, There is an enemy behind the wall. The player is not aiming at him because he can't see him. So far this is correct.

But the player is also ignoring the enemy in front of him because he's busy rejecting the one behind the wall.

What he should do is aim at the one in front of him, because he can see him and he is inside the player's range.

using System.Collections;
using System.Collections.Generic;
using UnityEngine;
using UnityEngine.AI;
using UnityEngine.UI;
public class clickme : MonoBehaviour
{

private NavMeshAgent mAgent;
public float mark, ToPoint;
public bool actives, seeEnemy;
private Transform target;
public float range, enemyDistance; // range is player eyes field.
public float speed = 5.0f;
public Transform aiming_point, playerEye;
private GameObject[] targets;

void Start()
{
    targets = GameObject.FindGameObjectsWithTag("enemy");
    target = targets[0].transform;
    seeEnemy = false;
}

void Update()
{

    if (mAgent.remainingDistance <= mAgent.stoppingDistance)
    {
        actives = false;
        if (actives == false && playerEye == true && target != null)
        {

            if (enemyDistance <= range)
            {
                Vector3 dir = target.position - transform.position;
                Quaternion lookRotation = Quaternion.LookRotation(dir);
                Vector3 rotation = Quaternion.Lerp(transform.rotation, lookRotation, Time.deltaTime * speed).eulerAngles;
                transform.rotation = Quaternion.Euler(0f, rotation.y, 0.0f);
            }

        }
        else  {

        }

    }
    else   {
        actives = true;

    }

    updateTarget();

} // end update

void updateTarget()
{
    GameObject[] enemies = GameObject.FindGameObjectsWithTag("enemy");
    float shortesDistance = Mathf.Infinity;
    GameObject nearestEnemy = null;
    foreach (GameObject enemy in enemies)
    {
        float distanceToEnemy = Vector3.Distance(transform.position, enemy.transform.position);
        if (distanceToEnemy < shortesDistance)
        {
            shortesDistance = distanceToEnemy;
            nearestEnemy = enemy;

            RaycastHit hit; // can I see my closent enemy or not ?
            if (Physics.Linecast(playerEye.position, nearestEnemy.transform.position, out hit))
            {
                Debug.DrawLine(playerEye.position, nearestEnemy.transform.position, Color.blue, range);

                if (hit.collider.tag == "enemy")
                {
                    seeEnemy = true;
                    print(" I can see enemy !");

                }
                else
                {
                    seeEnemy = false;
                    print("No enemy here!");

                }
            }
        }

    } // end foreach

    if (nearestEnemy != null && shortesDistance <= range && seeEnemy == true)
    {
        target = nearestEnemy.transform;
        aiming_point = target.transform.Find("aim");
        enemyDistance = Vector3.Distance(transform.position, target.transform.position);
    }
    else
    {
        target = null;
        aiming_point = null;
        seeEnemy = false;
        enemyDistance = 0;
    }

} // end target

}

sentences:
Love2D Box2D RevoluteJoint and Anchors and apologies in advance for this fairly random question.

I'm using Love2D 0.9.1 and Box2D to create two bodies joined by a revolute joint. A simplified representation of the two bodies is a Sphere and a rectangle:

hero.heroPhysics = {}
hero.heroPhysics.body = love.physics.newBody(theWorld, hero.x,hero.y,"dynamic")
hero.heroPhysics.shape = love.physics.newCircleShape(CONSTANT_heroRadius)

hero.extraPhysics = {}
hero.extraPhysics.body = love.physics.newBody(theWorld, hero.x,hero.y,"dynamic")
hero.extraPhysics.shape = love.physics.newRectangleShape(CONSTANT_heroRadius * 3, 8)

hero.jointPhysics = {}
local hx,hy = hero.heroPhysics.body:getWorldCenter()
hero.jointPhysics.joint = love.physics.newRevoluteJoint(hero.heroPhysics.body, hero.extraPhysics.body, hx, hy, false)

Everything seems to be ok, except that the anchor points of the joint are the centers of mass of the two bodies, and I'd like to manually adjust the anchor point of the rectangle to be closer to one end of the rectangle. However, I can't find a way in Love2D to set the joint anchor points? I can get the anchor points via Joint:getAnchors(), but not set them? Or maybe I'm missing something.

In pictures, I'm only able to get something resembling the bottom picture, whereas I really want something like the top picture (please excuse crude drawing):

I've tried changing the rectangle body's center of mass using body:setMassData(), but that doesn't seem to make a difference (unless I try to offset it too much, at which point Box2D dies).

sentences:
Unity: How to keep the music muted on reloading the scene? I am giving the user a UI button to mute and unmute the ingame sounds but the problem is when I mute the sounds and then when the game ends and the game scene reloads the sounds comes back up which is really annoying.

After some searching I came to know that I need to use DontDestroyOnLoad(transform.gameobject); but it makes the copy of the whole thing and now I have two copies of the same music.

Also I don't know if this is the only way or not but just to mute/unmute an audio source it feels kind of overkill to me since I have a many components attached to my gameobject and then just to mute/unmute it copies the whole thing.

Can someone tell me how to fix that duplicating problem and also is there any simpler way to achieve this?

sentences:
What are the pros and cons to building an audience with a small, simple, free game first as opposed to focusing efforts on a commercial release There are two projects we can work on. One would be a small free game to try and get our name out/build an audience. The second is our main idea for a first product.

What are the pros and cons of building the small, simple, free game first instead of focusing that time/effort into the main money making project.

sentences:
Why does the location of my vehicle spawner change when I open a matinee? I'm doing work with InterActors and vehicle spawners in Unreal Tournament 3's editor, and have it set up like so:

(The Walkway its on is the InterActor)

However if I go in Kemsit and open the matinee that handles the InterActor, this happens:

It does look to me like the editor is moving it out of the way so I can see the InterActor (which would be very clever) because only the image of the vehicle moves, not the gizmo, nor does the vehicle spawn in that location in game.

Is this the case?

sentences:
Change shadervalues for different Meshes in Three.js Hey I am writing a Shader for Three.js.

My goal is to have multiple objects with the same shader and each object should have a color set on the object that is then given to the shader. The goal is to have multiple "units" (think of an RTS game) each with the team color.

I red through a couple of documentation pages and am not really sure how to handle that. I looked into https://threejs.org/docs/#api/materials/ShaderMaterial.

I have tried:

changing a uniform but from my limited knowledge and trial and
error I came to the conclusion that I can not change a uniform value
during a drawcycle.
change the uniform in onBeforeRender which gave me an error that v
was not defined

I am not sure how to go on now. In the ShaderMaterial Documentation is written:

  You're recommended to update custom Uniform values depending on object and camera in Object3D.onBeforeRender because Material can be shared among meshes, matrixWorld of Scene and Camera are updated in WebGLRenderer.render, and some effects(ex:VREffect) render a scene with private their own cameras.

So did I just change the values wrong and it actually works with a uniform that changes? In this Github issue someone wanted to draw meshes in different colors and got suggested to create different materials for each mesh (https://github.com/mrdoob/three.js/issues/1532). But that would kill the idea of having one shader per unit regardless of the team.

sentences:
Prevent near-plane culling in vertex shader I am rendering a non-sphere light mesh and the standard question is how to cull: cull front faces and you loose Z-Testing benefits, cull back and you get into situations where camera is not rendering parts of the mesh due to near-plane clipping.

I thought myself smart, set culling to back and wrote this code in the vertex shader:

o.position = mul(ViewProj, i.worldPos);
if (o.position.z < 0 && o.position.w > 0)
   o.position.z *= -1;

This did nothing :). I wanted to ask if I am even thinking in the right direction (whether it is even possible to prevent camera's near-plane culling in the vertex shader)?

sentences:
Is there a way to make the boundary between materials wavy? I have a sea trading game that I'm working on developing. Right now, my world looks like this:

There are 4 different "biomes", with more to be added. Internally, this is a large mesh which has 4 different types of materials added to it, to make it work. Each region has a material associated with it.

The problem that I'm trying to overcome is to make it look less squary, I believe the process is known as bitmasking. The traditional way to do so I believe is to use images to show the boundary between each one, having one for each possible curve. That doesn't work with my current mesh architecture so far as I can tell. What I'm wondering is if there is a way to make the edges of the mesh to be curvy instead of straight lines. I assume it would have to be a shader of some kind, but my mind isn't quite figuring out the specifics of how to make it work. Any tips? Thanks!

sentences:
How can I make message passing between threads in a multithreaded engine less cumbersome? The C++ engine I'm working on currently is split up into several large threads- Generation (for creating my procedural content), Gameplay (for AI, scripts, simulation), Physics, and Rendering.
The threads communicate with one another through small message objects, which pass from thread to thread. Before stepping, a thread processes all of its incoming messages- updates to transforms, adding and removing objects, etc. Sometimes one thread (Generation) will create something (Art) and pass it to another thread (Rendering) for permanent ownership.
Early in the process and I've noticed a couple things:

The messaging system is cumbersome. Creating a new message type means subclassing the base Message class, creating a new enum for its type, and writing logic for how the threads should interpret the new type of message. It's a speed-bump for development and is prone to typo-style errors. (Sidenote- working on this has me appreciating how great dynamic languages can be!)
Is there a better way to do this? Should I use something like boost::bind to make this automatic? I'm worried that if I do that I lose the ability to say, sort the messages based on type, or something. Not sure if that kind of management will even become necessary.

The first point is important because these threads do so much communicating. Creating and passing messages is a big part of making things happen. I'd like to streamline that system, but also be open to other paradigms that might be just as helpful. Are there different multithreaded designs I should think about to help make this easier?
For example, there are some resources which are infrequently written, but frequently read from multiple threads. Should I be open to the idea of having shared data, protected by mutexes, that all threads can access?

This is my first time designing something with multithreading in mind from the ground up. At this early stage I actually think it's going really well (considering) but I'm worried about scaling, and my own efficiency at implementing new stuff.

sentences:
Adding a profile to a dialogue box I am trying to create dialogue boxes that contain the profile picture of the speaking character in them. As such, I want the profile pic to be attached to the object itself. If I understand this right, the following creates a variable space for profilePic that I then populate within the GUI.

using UnityEngine.UI;

public class NPC : Character {

[SerializeField] private Image profilePic;
}

Then over in my dialogue script I have the following:

using UnityEngine.UI;

//This currently only allows for one sided conversations
//this can be later modified to add profile picture as well as several iterated conversations

public class Dialogue : MonoBehaviour {

    [SerializeField]
    private UnityEngine.UI.Text dialogueText;

    [SerializeField]
    private GameObject dialoguePanel;

    [SerializeField]
    private UnityEngine.UI.Image profilePic;

    private string[] dialogue;
    private int dialogueIndex;

    public void StartDialogue(string[] dialogue)
    {

        dialogueIndex = 0;
        this.dialogue = dialogue;
        dialoguePanel.SetActive(true);
        //This is what actually affects the GUI
        dialogueText.text = dialogue[dialogueIndex];
        this.profilePic = profilePic;

    }

The dialogue functions work. It should be taking the contents of this.profilePic and putting them into the UI.image profilePic component, right? The text works. The panel pops up. Just no picture.

Anyone have any thoughts?

sentences:
Moving all the particles in effect LIBGDX I have a few particle effects that I would like to be in a circle shape
in libgdx i.e. not a cone shape. I have done this by setting the direction
of the particle effect from 0 to 360. The problem is that the particle effect
is moving. So, as the emitters are moving, but not the particles themselves,
the overall shape becomes conical. This could simply resolved by moving all the
particles along with the particle emitters, but I can't fnd any way of doing
this. I have considered drawing the effect to a Frame Buffer Object in one
position, then draw the texture to each new position. However, this would mean I would have to flush the SpriteBatch each time a draw a particle effect, and that would be very expensive.

Is there any  way to move the entire effect, with both the emitters and the particles?

Thannks in advance

sentences:
Restricting character movement to "rails" I'm building a Pacman clone in Unity 3D and am now thinking about how to restrict the movement of the player to the hallways that the map is made up of.

Basically, the player is only allowed to change direction at an intersection. When he is not at an intersection, he can only continue to move in the same direction, or reverse by 180°.

The simplest idea I have come up with so far is, to have little un-rendered Boxes with Colliders at every intersection, and when the player collides with one of those, the collider knows which directions the player can go from there.

This seems easy, but a lot of work. Is there an easier way to restrict the movement of the player to given track (as in a railroad), but allow him to change "onto" a different "track" at given points (those would be the intersections)?

sentences:
Where can I find animated textures for free? I'm looking for some animated textures, especially water textures that show movement.

After a bit of searching, I could only find this list. Although those textures are certainly not bad, there are only 4 to choose from. I was wondering if there is another website with free animated textures.

For static textures, I can find hundreds of websites which offer them for free, but for animated textures, websites seem to be rare.

Does anyone know of a website that offers free animated textures?

sentences:
Isometric Optimization in javascript I'm having some issues with my optimization of my game.

I have a simple tile map looped like this in my case the images are 64 by 64 pixels:

 for (i=0; i < 50; i++){ //horizontal
    for (j=0; j < 50; j++){ // vertical

    var x = (i-j)*(img[0].height/2) + (canvas.width/2)-(img[0].width/2);
    var y = (i+j)*(img[0].height/4);

    abposx = x + offset_x;
    abposy = y + offset_y;

    total_load++;

    ctx.drawImage(img[0],abposx,abposy);
        }
    }

This as you can see is a 50 by 50 map. But i firstly want to do the following optimizations:
Work out the max that fits in canvas window (including partial) so it fills the screen.

The problem i have though by imposing the limit the loops will only load that many tiles ( lets say 10 by 10 ) so the map is always 10 by 10 and as i scroll the rest of tiles remain unloaded for obvious reasons.

So i also need to work out how to change the starting position... any ideas =/ ?

sentences:
FBX SDK Getting Tangents and Binormals From a Mesh? How do I import tangent and binormal data per vertex from a FBX Mesh.
I already know how to get Vertices, Normals and UVs but how would I get tangents and binormals?

For example this is how I would get a vertex.

int vIndex = MyFbxMesh->GetPolygonVertex(triangle, vertex);
FbxVector4 Vertex = MyFbxMesh->GetControlPointAt(vIndex);

What about tangents and binormals?
I searched everywhere on the internet and looked in their documentation but I still can't find a way.

sentences:
Error loading "SpriteFont1". File not found I have an issue while trying to load a font file with the extension ".xnb" and I am receiving following error:

Error loading "SpriteFont1". File not found.

For following code:

public static Dictionary<string, T> LoadListContent<T>(this ContentManager contentManager, string contentFolder)
        {
            DirectoryInfo dir = new DirectoryInfo(contentManager.RootDirectory + "/" + contentFolder);
            if (!dir.Exists)
                throw new DirectoryNotFoundException();
            Dictionary<String, T> result = new Dictionary<String, T>();

            FileInfo[] files = dir.GetFiles("*.*");
            foreach (FileInfo file in files)
            {
                string key = Path.GetFileNameWithoutExtension(file.Name);

                result[key] = contentManager.Load<T>(key);
            }
            return result;
        }

The file is actually there and I am getting here FileInfo[] files = dir.GetFiles("*.*"); one file which is present in the folder.

I am using the function like this:

fontList = ContentLoader.LoadListContent<SpriteFont>(Content, "Fonts");

Is there something which I have overlooked?

sentences:
My sprite is not listening to any keyboard keys First time ever creating html canvas game. Once I finally got my sprite ant tiles drawn on the canvas, now I want to make my sprite interactive. Unfortunately, for some reason it is not working. I get a message in console when the certain key is pressed but the sprite is not changing its position. I wonder why?  The code:

var canvas = document.getElementById("canvas");
var context = canvas.getContext("2d");

var mapArray = [
  [0, 0, 0, 0, 0, 0, 0, 0, 0, 0],
  [0, 0, 0, 0, 0, 0, 0, 2, 2, 0],
  [0, 0, 1, 1, 1, 0, 0, 2, 0, 0],
  [0, 0, 1, 1, 1, 0, 0, 0, 0, 0],
  [0, 0, 0, 1, 1, 0, 0, 0, 0, 0],
  [0, 0, 0, 0, 0, 0, 0, 0, 0, 0],
  [0, 0, 0, 0, 0, 0, 0, 0, 0, 0],
  [0, 0, 0, 0, 0, 0, 0, 0, 0, 0],
  [0, 0, 0, 0, 1, 1, 0, 0, 0, 0],
  [0, 0, 0, 0, 1, 1, 0, 0, 0, 0],
  [0, 0, 0, 0, 0, 0, 0, 0, 0, 0]
]

var StyleSheet = function(image, width, height) {
  this.image = image;
  this.width = width;
  this.height = height;

  this.draw = function(image, sx, sy, swidth, sheight, x, y, width, height) {
      context.drawImage(image, sx, sy, swidth, sheight,x, y, width, height);
  }
  this.drawimage = function(image, x, y, width, height) {
    context.drawImage(image, x, y, width, height);
  }
}

/* Initial Sprite Position */

var boatPosX = 230;
var boatPosY = 200;

var Loader = function(src) {
  this.image = new Image();
  this.image.src = src;
  this.image.onload = function() {
  var sprite = new StyleSheet(background, 36, 36);
  var ship = new StyleSheet(boat, 90, 100);
  for (let i = 0; i < mapArray.length; i++) {
    for (let j = 0; j < mapArray[i].length; j++) {
      if (mapArray[i][j] == 0) {
        sprite.draw(background, 190, 230, 26, 26, i * sprite.width, j * sprite.height, sprite.width, sprite.height);
      }
      if (mapArray[i][j] == 1) {
        sprite.draw(background, 30, 30, 26, 26, i * sprite.width, j * sprite.height, sprite.width, sprite.height);
      }
      if (mapArray[i][j] == 2) {
        sprite.draw(background, 200, 20, 26, 26, i * sprite.width, j * sprite.height, sprite.width, sprite.height);
      }
    }
  }
  ship.drawimage(boat, boatPosX, boatPosY, 50, 50);
}
  return this.image;
}

/* Sprite controls */

function move(e) {
  if (e.keyCode == 39) {
    boatPosX += 2;
    console.log("works");
  }
  if (e.keyCode == 37) {
    boatPosX -= 2;
  }
}

  document.onkeydown = move;

var background = new Loader("ground.png");
var boat = new Loader("ship.png");

console.log(background);

sentences:
Adjust treble and bass on Audio in XNA I am trying to "muffle" the sounds that are being played in my game and the best way I can think of doing this, is by lowering the treble of the sound.

I have looked through all the members of the Song / SoundEffect / SoundEffectInstance classes and I cannot find a way to alter the sounds.

How can I accomplish this?

sentences: Packaging HTML5 games as applications for iPhone/Android Is it possible to package HTML5 game for iPhone and Android as an application or does it have to be accessed through a browser?

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:
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: how to change floor sprite in unreal engine I have started a 2D side scrolling game in Unreal Engine from the menu when you start a new game. The basic environment loads up and it works but I don't know how to change the floor sprites and player sprites. Please Help.

sentences:
Unity 5 - Textures look strange in Deferred Rendering I've created an exterior terrain scene in Unity 5 which features lots of trees and grass but some textures look awful and I'm wondering why. Please see the attached image:

This texture problem is especially obvious at night (I'm using Time of Day unity asset for Day/Night cycle) but also during day light it doesn't look good. The tree bark looks like plastic and also the ground textures are too bright and lack contrast. Stone texture on the other hand look perfectly fine.

Can somebody point me into the right direction of what I'm doing wrong here with my lighting and rendering?

sentences:
Android Live Testing I am making a game for android and in it I am using sensors which are not available in the emulator. At the moment I am connecting my device and transferring the apk, then installing to test but that is a pain to do, and I have gotten to the stage where I need to start logging values for debugging. I have gone into the run configs of my app and set it to prompt me to pick a device, but my device is never in the list when it is connected to my PC and I try to run it. How am I supposed to set it up to work properly?

Thanks for the help.

sentences:
How can I make an inventory system in Unity? I am trying to make an inventory system for the game I'm working on with Unity and I want it to expand and compress whenever objects are added or removed.
Is there any go-to way to do this?

sentences:
Why are most characters all the same height in games? In the majority of video games I play, I notice that NPC's are the same height. What's up with that?

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

sentences:
Hexagon grid gets cut off when generated outside of the JFrame I'm programming a hex-grid based game where you click on adjacent tiles to the player and when the player moves the map/grid moves in the opposite direction (using setLocation() on the jpanel inside the main jframe) so that, relative to the screen, the player is still centered.

When I pass in a big enough number of hexagons some of the grid generates outside of the jframe. When this happens, I can still make the player move around and open the menu and change player skins, but when moving north on the grid (when the top of the grid is what got generated outside the jframe) the grid just gets cut off and ends before the whole hexagon gets repainted.

I was wondering if there was a way to fix this that maybe I've simply just overlooked. My first thought was to delete and then regenerate the grid with new x,y coordinates each time the player moves and not use setLocation() at all, but I feel like that would be very inefficient and more of a brute force solution (last resort). I just feel like there has to be a more elegant or efficient way. I've tried using setSize(), setMinimumSize(), and setPreferredSize() methods to try and make the jpanel or the jframe's content pane bigger.

Picture to help:

sentences:
How to improve my graphics on HTML5 canvas? I am making my own army fighting simulator. Designer have made an 3D model with Blender and textured it, made animations. I have made sprites from that model and did programming. But the result is not as good as I expected. You can look at armyfight.com/simulator.html (refresh until it loads all images properly if it didn't at first time) and when you maximally maximize, you can see there are units moving. But I want to be them clearly visible, with details, high resolution like in flash-games and also that when they are really small units, would be understandable.

Is it possible on canvas?

Or it is my mistake and I must do somehow more HD sprites? I'm stuck now, and I don't know to improve the graphics..

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:
Draw text in OpenGL ES 3D game? I am making a game using OpenGL ES 1.0 and I want to keep player score. So I need to draw text dinamically. What is the best approach? Some library, textures, bitmaps?
I tried to use TextView but when I want to update text I need to do that from main thread, and there is an obvious lag in the game.

sentences:
Has anyone tried using one of those BAAS providers to create mobile games? I'm hearing a lot about different companies offering back-end as a service (BAAS) for mobile apps but it seems like none of them are very successful with mobile games. Is there any reason why not outsource the server to a provider.

The premise here is that the game does need a back-end to implement multiplier ans social functions.

sentences:
RPG level-experience formula I want to make an RPG game and I would like an advice on how should I create my level-experience formula. I saw this formula http://rsdo.net/rsdonline/guides/Experience%20formula.html#PHP and I created a formula myself and I want to ask you which would be better.

    RuneScape rates                     My rates

    Level 2 - 83 xp                     Level 2 - 35
    Level 3 - 174 xp                    Level 3 - 84
    Level 4 - 276 xp                    Level 4 - 150
    Level 5 - 388 xp                    Level 5 - 238
    Level 10 - 1,154 xp                 Level 10 - 1,087
    Level 100 - 14,391,160 xp           Level 100 - 311,017

As you can see at level 100 RuneScape's xp is very big and my level 100 is equal with RuneScape's Level 61. Is it better if the xp grows very fast at one point or depends on how I make my game?

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 do I calculate the duration between 2 frames in an animation file I want to find out the duration between 2 frames in animation file.
Is the following correct?
fDurationBetween2Frames = AnimationClip.length / AnimationClip.frameRate;

Thank you.

sentences:
Unknown length of primitive array For my Voxel like game I need to generate terrain meshes from an array of ids. Because of that I have no idea how big the final vertex array will be.

Currently I'm doing like this: generate mesh and save to arrayList, then in a few lines of code I convert the arrayList to a primitive array. This is working fine, but it's just really SLOW.

So now my question is is there a way I can use a primitive array, without knowing it's final size? If not is there a fast way I can take an array with a lot of empty elements, and then shrink it?

Edit: Heres how I convert it:

List <Float> vertices = new ArrayList <Float> ();

//Generating mesh

float[] doneVertices = new float[vertices.size()];
for(int i = 0; i < vertices.size(); i++) doneVertices[i] = vertices.get(i);

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:
Get direction vector of camera in voxel game I am currently working on a Minecraft clone (a voxel game). The feature I'm working on is the ability to break blocks. I have a ray-casting/ray tracing algorithm for traversing the voxels, but the only thing I don't know how to do is find the direction vector of the ray.
How can I find a unit vector representing the direction of a ray in 3D space given the pitch and yaw degrees of the ray (and the ray origin, of course)?

sentences:
Mesh-level acceleration structures for collision detection when mesh instances can be rotated, scaled and/or resized Short version: in the mid-phase or narrow-phase of collision-detection, does any acceleration structure organizing the mesh's vertices (e.g. AABB-trees, Octrees, Quadtrees) work for the mesh's instances that are re-scaled, re-sizes and/or rotated?

Long version: suppose a concave mesh composed of a very high number of triangles (e.g. 200k) and for which I cannot use convex decomposition in order to perform collision detection. The most efficient solution usually employed would be to organize the vertices of the mesh using acceleration structures to quickly prune which parts of the mesh are likely to have been collided with.

However, that mesh is used for generating instantiated copies - and each of these can have different size, rotation and/or scale at any of the X,Y,Z axis. Would any acceleration-structures work since the instances can be re-scaled, rotated and resized? Suggestions, tips, academic references, are all appreciated.

sentences:
Scaling HUD and Camera I wanted to display an HUD, similar to the strategic games' one (like in DotA 2, Warcraft III, Starcraft II or Age of Empires). I didn't really know how to do it, so I managed to create a Texture Object and placed it in front of the scene. The image attached is the HUD itself, with some transparent "holes" in which I placed the cameras. I don't know if this description explains well what I'm trying to say, so I made this screenshot:

The HUD is just a png image with a greater z-index. The image has three "holes": one for the gameboard, one for the dice, and one for the spells you can see on the right. The holes are filled with the cameras, so we can see the objects beyond the transparency. Everything looks quite nice.

But if I change aspect ratio (which was Free Aspect), my layout gets completely screwed up.

Notice that the HUD borders are not fully displayed; the spells on the right are misplaced, and so are the dice.

I managed to get the free aspect resolution, it is 1440x720, a perfect 2:1. But, even if I change my resolution to 800x400, things are not getting better.

I've read something about pillarboxing and letterboxing, but I'm not sure that those techniques will help me with this issue. Is there something I can do to resize my objects and my cameras dynamically to fit the screen for every resolution like in the first screenshot?

Of course, if you have any other solutions for the HUD, I'll be glad to learn!

sentences:
When/where should a game state transition take place? I'm in the process of redesigning some of my state management code (there are several features I've grown to dislike in practice..) which was based on this tutorial and others. The issue I'm having right now has to do with state transitions.

Where and when should state transitions occur? Should they be executed immediately, or should they be delayed to the end of the current frame, after the current state has finished its work for that frame?

Let's say my states can implement handleEvents, update, render, pause and resume methods, among others that are not relevant for this question.

My thoughts so far are the following:

If the transition is done at the end of the frame, then when I pause the game I might see an update during that same frame I clicked to pause. The Pause State will only appear after the current state has executed the rest of the frame (events, update and render). Perhaps that extra update should not have been done.
If the transition is done immediately I have to be careful to not to delete the current state while it is still executing its method, let's assume the handleEvents method. But even so, if I were to pause a game in the handleEvents function, then the game would immediately pause and the game state update function would not be executed that frame.

The second options is more appealing to me, because as a player I would probably notice that extra bit of movement after pressing to pause the game. What if the player died during that frame? The delayed state change would be unwarranted. But then, the game state itself should probably disable updates if a game pause was requested.

On the other hand it might make more sense to delay state transitions to after the current state has fully executed its functions for the current frame. Maybe the Pause state should be a sub-state of the Game state and not a state of its own.

Is it simply a matter of preference or is one of the approaches clearly superior for a different reason?

sentences:
How can I call Schedule() on interface that inherits from IJob So I have a voxel terrain engine, and I have an interface that all meshing jobs should inherit from. That looks like this (simplified from the actual):
public interface IMesherJob : IJob
{
    VoxelDataVolume<byte> VoxelData { get; set; }

    NativeArray<MeshingVertexData> OutputVertices { get; set; }
    NativeArray<ushort> OutputTriangles { get; set; }
}

One example of a meshing job is marching cubes, which looks like this: public struct MarchingCubesJob : IMesherJob
So here's my question: If I have a reference to an IMesherJob, can I somehow call Schedule on it? If I have a reference to MarchingCubesJob, I can call Schedule on it:
This works:
MarchingCubesJob myMeshingJob = GetMeshingJob();
JobHandle handle = myMeshingJob.Schedule(voxelCount, 64)

But this does not work:
IMesherJob myMeshingJob = GetMeshingJob();
JobHandle handle = myMeshingJob.Schedule(voxelCount, 64);

I noticed that Schedule() is an extension method for T where T : struct, IJob so that might be interfering with it, but it should still work because IMesherJob inherits from IJob

sentences: How can I programmatically change a sprite's pivot without it affecting a game objects current position and rotation? Because of the complexity of positions, I am using the centre pivot for my game objects sprite. Can I possibly change the pivot without it affecting the game objects current position and rotation? or in other words, can I change the pivot while the sprite remains unchanged visibly? I would preferably like to do this using c# script.

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:
Game Engine Entity/Component with Services Architecture I'm currently working on my first game engine and decided to use the entity/component model with services.

Background:
My GameEngine class is an Entity and has multiple services that are Components, like the RenderService and the PhysicsService. Other Entities in my game have components that communicate with services, like the RenderComponent and the PhysicsComponent.

Question: How do I get these components to communicate with their respective services?

Note: I have thought about having a call to the respective service create the components, but I would like to hear about other solutions you guys have. I'm open to adding/removing classes and changing my whole architecture. It is my first attempt, so I'm willing to take advice and learn. Time is not the concern.

Let me know if you need more information.

Thank you in advance.

sentences:
Porting SDL OpenGL Game to Android and IOS I am currently learning OpenGL (3.0+) with C++. I am using SDL for input handling, window creation, etc., GLEW to use OpenGL and call OpenGL Functions, and GLM for OpenGL Math stuff.

If I fully finish a Windows game, how can I port my game with the setup above to Android, IOS, and maybe even other platforms (but my main focus is Android and IOS). I do not want to use any Game Engines.

What I am looking for is a program that could just make my game run on android and IOS. If there is a way to optimize my game using the tools listed above a little bit and change some code to make my game run on android and IOS, I am okay with that (if that is the case, please provide resources).

I have heard of OpenGL Es, not quite sure what that is, but I do not want to use it if it is a completely different library and if I have to rewrite the entirety of my game rendering engine. I also want my app to run without the user having to download any libraries such as SDL, so please make sure that my app can just run as an .apk file or whatever format that I can just tap on and it will open.

I also want my app to run on most smartphones (Android and IOS), so please be sure that what you are suggesting is not only available to a limited amount of smartphones. Another thing that I want is optimal performance. No emulators or simulators from .exe to .apk that run very slowly. It should run as fast as other apps and run at probably the same speed as my windows version. Also point out any mistakes that I may have made (for example, maybe I am just crazy thinking that smartphones use OpenGL).

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:
Pattern for modular ScriptableObject-Database? Lets say we want to store game data inside of scriptableObjects and we have plenty of them... So we need to find a way to store them efficiently in a modular way.

What pattern could we use to code a scriptableObject database for providing a substainable base for our game data- scriptableObjects?

And are there any patterns or structures for extending our game data - scriptableObjects in order to construct them modular and flexible aswell ?

sentences:
Moving panel between two positions smoothly? I'm trying to make my panel moving from one position to another one smoothly. What I get is more faster no matter what I did to make it slower never get slow !! Both Vector3.Lerp and Vector3.MoveTowards did not give me a slow movement. Here is my script:

public GameObject gunsWindow;
private Vector3 a, b;
public bool open; // use inspector
void Start()
{
    a = gunsWindow.transform.position;
    b = new Vector3(100.0f, gunsWindow.transform.position.y, gunsWindow.transform.position.z);
}

void Update()
{

    if(open)
    {
        gunsWindow.transform.position = Vector3.MoveTowards(a, b, Time.deltaTime * 1);
        //weaponPlane.transform.position =  Vector3.Lerp(a, b, Time.deltaTime); // panel shaking
    }
    else
    {
        gunsWindow.transform.position = Vector3.MoveTowards(b, a, Time.deltaTime * 1);
        //weaponPlane.transform.position =  Vector3.Lerp(b, a, Time.deltaTime); // shaking
    }

}

sentences:
How does sprite customization in 2D games work? I´m working on the design of a new game concept at the moment and I would like to know how to handle a customization of sprites. (In 2D that is, hence the topic.)

This is my scenario: The player will have a tower containing 3 floors (or more). Each floor can be replaced by another "piece", i.e. a blue floor, a fire floor, a stone floor.

With the little knowledge of game development I have, creating a sprite for each possible combination is probably not a good idea, since the size of the game file will be HUGE.

So, how does developers solve this? Do you put a standard position and just replace the sprite itself? Any advice or information about this would be great.

Regards.

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:
Unity 2D - Problem with player running ON wall instead of falling I´m having a problem with my game (yes, I'm new with Unity).
I'm trying to make a simple 2d platformer and I ran into this situation:

Youtube Link

As you can see, when the player hits the BoxCollider from the side, it tries to get a hold of it instead of just keep going down...

These are the properties of my player:

And the block only has the default box collider.

Any ideas?
Thanks!

sentences:
Who has ownership of publicly developed projects? After seeing the comments on selling an idea to developer for a game, the general concencus is that without a game, or atleast a demo, it’s not going to happen. So…someone (yes, Noctrine, I am looking at you) suggested that it might me an interesting idea to turn it into a “public” project.

A few people have asked if I minded if they turned some of my concepts into models, something I always have agreed on. They tell me that it would be to use as work for their portfolio or for practice. Still waiting on those, but that is another story.

If I do this, set up a group to help starting modelers and programmers practice or get stuff for their portfolio, after everything is said and done, who has ownership of the project. I ask in case we end up with an actual demo and a studio get’s interested. Who do they buy it from?

I have no issue with paying accordingly to all participants, but in the legal aspect, who owns it before a publisher buys it?

sentences:
Debugging an AMD GPU specific problem without an AMD GPU I've recently started to receive reports from users that I game I'm working on isn't rendering properly on AMD GPUs. I'd like to track down the problem and fix it, but I'm a hobby developer just using my own computer and I don't have an AMD GPU.

Do I have any options here besides going out and buying another graphics card? Perhaps some sort of emulator or a cloud compute service with AMD GPUs? I've looked at the major cloud compute providers (AWS, Google Cloud and Azure) but they all seem to offer only Nvidia GPUs.

sentences:
Hidden copies of the environment in an entity component system For reasons outside the scope of this question, my game has several full copies of the game environment running asynchronously. At any one time, only one of these is rendered.

This is trivial to support in a traditional, object-oriented architecture. Instantiate a few copies of the environment, run each one in its own thread (I actually use a parallel task system for cases where there are more environments than CPU cores), and only call call draw() on the one you want rendered.

The time for large refactorings has come, and I'm considering converting to an entity component system such as Entt. What would be the best way to achieve this same functionality?

The best I've come up with is each environment being a self-contained ECS, managed by an object-oriented system (which would also handle things not replicated, such as UI). The render system would be disabled in all environments except the one being rendered.

I don't like that solution though. I don't want the render system for the game environments to be separate from that of the UI, etc. I also don't like the idea of mixing ECS and object-oriented architectures.

Is there a better solution?

sentences:
Loading texturecube using DirectXTK DDSTextureLoader I've been trying to implement a skybox for some time now and there's probably only a tiny problem left to solve. When I load a texture using DirectXTK's CreateDDSTextureFromFileEx with a TEXTURECUBE flag, the resulting shader resource has its view dimension set to Texture2D and not TextureCube, which means I can't treat it as a TextureCube in HLSL. Also the file I'm loading contains all six faces. Here's the code where the texture is loaded:

// Loading the texture
HRESULT hr = DirectX::CreateDDSTextureFromFileEx(device, filename, 0, D3D11_USAGE_IMMUTABLE, D3D11_BIND_SHADER_RESOURCE,
    0, D3D11_RESOURCE_MISC_TEXTURECUBE, false, &texture, &mSkyboxSRV);

This is the error message being output by DirectX:

D3D11 ERROR: ID3D11DeviceContext::Draw: The Shader Resource View dimension declared in the shader code (TEXTURECUBE) does not match the view type bound to slot 0 of the Pixel Shader unit (TEXTURE2D).  This mismatch is invalid if the shader actually uses the view (e.g. it is not skipped due to shader code branching). [ EXECUTION ERROR #354: DEVICE_DRAW_VIEW_DIMENSION_MISMATCH]

I've also tried this:

ID3D11Texture2D* texture = nullptr;

HRESULT hr = DirectX::CreateDDSTextureFromFileEx(device, filename, 0, D3D11_USAGE_IMMUTABLE, D3D11_BIND_SHADER_RESOURCE,
0, D3D11_RESOURCE_MISC_TEXTURECUBE, false, (ID3D11Resource**)&texture, nullptr);

D3D11_TEXTURE2D_DESC texDesc;
texture->GetDesc(&texDesc);

D3D11_SHADER_RESOURCE_VIEW_DESC srvDesc;

srvDesc.TextureCube.MipLevels = texDesc.MipLevels;
srvDesc.TextureCube.MostDetailedMip = 0;
srvDesc.Format = texDesc.Format;
srvDesc.ViewDimension = D3D11_SRV_DIMENSION_TEXTURECUBE;

hr = device->CreateShaderResourceView(texture, &srvDesc, &mSkyboxSRV);

But that gives me an error message saying the texture's view dimension and the srv's view dimension are not the same:

D3D11 ERROR: ID3D11Device::CreateShaderResourceView: Resources created without D3D11_RESOURCE_MISC_TEXTURECUBE may not be treated as cubemap ShaderResourceViews. [ STATE_CREATION ERROR #126: CREATESHADERRESOURCEVIEW_INVALIDDESC]

Does anyone have any ideas on what to do? Any help is much appreciated!

sentences:
Compute billboard rotation I'm trying to compute a matrix to have object always facing the camera. For the moment, my result look pretty good, the problem is that my original billboard scale isn't preserved (Every billboard have a size of 1/1).

Here is what I've done using this post:

glm::vec3 look = glm::normalize(camera->getPosition() - objectPosition);
glm::vec3 right = glm::cross(up, look);
glm::vec3 up2 = glm::cross(look, right);
glm::mat4 transform;
transform[0] = glm::vec4(right, 0);
transform[1] = glm::vec4(up2, 0);
transform[2] = glm::vec4(look, 0);
transform[3] = glm::vec4(objectPosition, 1);

glm::quat q = glm::quat_cast(transform);
objectTransformable->setOrientationFromQuat(q);

I've tried to add something like that but the result is a bigger object with bad proportion:

transform = glm::scale( transform, objectScale );

To resume, I would like to extract orientation from result matrix to apply it on my transform object, something like Unity:

MyTransform.LookAt(Cam.transform.position, upVector);

sentences:
Can an existing game be optimised by converting it to use cel-shading? I assume it's possible to cel-shade existing games through API interception. If done properly, could this be used as a rendering optimization technique?

This means rather than doing the cel-shading on the pixel shader stage, do a few steps on the vertex side, such as reducing geometry, and lightning complexity.

sentences:
Do OpenGL buffers overflow to CPU memory? This is a question about OpenGL buffers and memory. My game world is mid-sized, one contiguous space, unchanging, and only partially visible from any position.

Will modern OpenGL overflow buffers into CPU memory?

And if so, can I just allocate buffers (vertex and texture) for all of it, and adjust my draw calls to skip non-visible areas, and let OpenGL pull buffers into GPU as needed, hopefully minimizing thrashing? (Or does OpenGL just fail on the allocate after a while?)

EDIT: The above was ambiguous. But maybe both variations are interesting.

Could I just allocate one huge vertex buffer and a few giant textures, and hope that OpenGL moves parts of it in and out of the GPU as needed, and maybe enough early depth-testing lets it skip some of the texture drawing...
Could I have a handful, or maybe a lot, of "sensibly-sized" vertex and texture buffers, but only glDrawXxx() some of them on each frame? In that case, would OpenGL move them up and down from the GPU, maybe in a least-recently-used sort of way?

sentences:
How do history generation algorithms work? I heard of the game Dwarf Fortress, but only now one of the people I follow on Youtube made a commentary on it... I was more than surprised when I noticed how Dwarf Fortress actually generates a history for the world!

Now, how do these algorithms work? What do they usually take as input, except the length of the simulation? How specific can they be?

And more importantly; can they be made in Javascript, or is Javascript too slow? (I guess this depends on the depth of the simulation, but take Dwarf Fortress as an example.)

sentences:
Libgdx Scene2D second screen animating and accept input while still loading I'm currently developing an app Scene2D that involves a small number of screen switches.  I am having a problem that after calling set screen there appears to be a pause of a second or two (I think it's the non UI logic is being performed in the new screen constructor to aid setting up UI actors), which is fine.  But during that second pause.  It appears my second screen is already running in the background but not being rendered. I think this is happening because of two problems:

Animations and Actions that are supposed to begin when the second screen loads are already one or two seconds in progress by the time the second screen loads.
During the pause before the second screen loads, the first screen is still rendered in freeze frame, but any user input is queued and processed in the second screen after it renders! Meaning that the user is effectively clicking on things that are not yet rendered which can cause some problems for their experience.

I already am setting the input processor in the show method but it show appears to be called before the screen is actually visible and rendering frames.

Is there something I have misunderstood about the life cycle? Or common pitfalls I may have fallen into?  Only a problem on Android, Desktop is fine but possibly only because the loading times are too fast to notice either problem.

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:
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:
Not able to move quad wheel robot I am trying to move QWAD wheel robot, I have grouped the wheels separately and added wheels colliders for each wheel.
The problem is that the wheels are moving but the robot is stationary. I have been stuck with this problem from many days.
I am very new to unity3D and C# scripting. At first I tried the concept of moving rigid body using car model and it is working perfectly fine. When I applied the same logic to QWAD wheel ROBOT is not woking as expeted, kindly help me out.

Please find the code below

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

public class RoboMovemnt : MonoBehaviour
{
void Start()
{
    rb = GetComponent<Rigidbody>();
}
public void GetInput()
{
    m_horizontalInput = Input.GetAxis("Horizontal");
    m_verticalInput = Input.GetAxis("Vertical");

}
private void Steer()
{
    m_steeringAngle = maxSteerAngle * m_horizontalInput;
    FR_Wheelwc.steerAngle = m_steeringAngle;
    FL_Wheelwc.steerAngle = m_steeringAngle;
}
private void Accelerate()
{
    RR_Wheelwc.motorTorque = m_verticalInput*motorForce;
    RL_Wheelwc.motorTorque = m_verticalInput * motorForce;

    if (m_verticalInput == 0)
    {
        RL_Wheelwc.brakeTorque = brakeTorque;
        RR_Wheelwc.brakeTorque = brakeTorque;
    }

}

private void UpdateWheelPoses()
{
    UpdateWheelPose(FR_Wheelwc, FR_WheelT);
    UpdateWheelPose(FL_Wheelwc, FL_WheelT);
    UpdateWheelPose(RR_Wheelwc, RR_WheelT);
    UpdateWheelPose(RL_Wheelwc, RL_WheelT);

}
private void UpdateWheelPose(WheelCollider _collider ,Transform _transform)
{
    Vector3 _pos = _transform.position;
    Quaternion _quat = _transform.rotation;

    _collider.GetWorldPose(out _pos, out _quat);

    _transform.position = _pos;
    _transform.rotation = _quat;

}
void HandBrake()
{
    if (Input.GetKey(KeyCode.Space))
    {
        IsBrake = true;
    }
    else
    {
        IsBrake = false;
    }
    if(IsBrake == true)
    {
        RL_Wheelwc.brakeTorque = brakeTorque;
        RR_Wheelwc.brakeTorque = brakeTorque;

        RL_Wheelwc.motorTorque = 0;
        RR_Wheelwc.motorTorque = 0;

    }
    else
    {
        RL_Wheelwc.brakeTorque = 0;
        RR_Wheelwc.brakeTorque = 0;

    }
}

private void FixedUpdate()
{
    GetInput();
    Steer();
    Accelerate();
    UpdateWheelPoses();
    HandBrake();

}

private float m_horizontalInput;
private float m_verticalInput;
private float m_steeringAngle;
private Rigidbody rb;
private int Velocity;

public WheelCollider FR_Wheelwc, FL_Wheelwc, RR_Wheelwc, RL_Wheelwc;
public Transform  FR_WheelT, FL_WheelT, RR_WheelT, RL_WheelT;
public float maxSteerAngle = 30;
public float motorForce  = 500;
public bool IsBrake = false;
public float brakeTorque = 50000f;

}

sentences:
2D Tile Movement in Java I have this tilemap and a player in my game, and I got the player to move by adding the velocity to the position. However, it is very hard to control the player exact this way of the tilemap. So, I began trying to do something like the old final fantasy games did (and a heap of other games too): moving tile by tile, but making it look smooth.

However, I failed. So, if anyone have any idea of what the best way to make the player move tile by tile is, then shout out. If you have played final fantasy V for example, then that's the kind of movement I want to try to implement in my game.

To explain it a bit further; each tile in  my game is 16x16, so is the player. I don't want the player to "jump" between the tiles, but I want it so that say, if you press "A", then move the player to the tile to the left in a smooth way.

I tried something like this:

    private Vector posA;
private Vector posB;
private double time = 0.6 / 60;
private void move(Direction dir) {
    if (!moving) {
        //Initialize Movement
        posA = new Vector(position);
        posB = new Vector(position);

        switch (dir) {
        case UP:
            posB.subtract(0, 16);
            break;
        case DOWN:
            posB.add(0, 16);
            break;
        case LEFT:
            posB.subtract(16, 0);
            break;
        case RIGHT:
            posB.add(16, 0);
            break;
        }

        moving = true;
    }

    //Update Position
    if (moving) {
        Vector v = new Vector();
        v.set((posA.x + (posB.x - posA.x) * time), (posA.y + (posB.y - posA.y) * time));

        //Set  Position
        position.add(v);

        if (position.x >= posB.x && position.y >= posB.y) {
            position.set(posB);
            moving = false;
            System.out.println("DONE MOVING!!!");
            posB = null;
            posA = null;
        }
    }

}

sentences:
Calculating delta time I'm trying to calculate deltaTime, but it's not correct.

What's wrong in my code?

//declared outside
private long timeSinceStart = System.nanoTime() / 1000;
private long oldTimeSinceStart = 0;
public static long deltaTime = 1;

while(running)
  timeSinceStart = System.nanoTime() / 1000;
  deltaTime = timeSinceStart - oldTimeSinceStart;
  oldTimeSinceStart = timeSinceStart;

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:
Keep player within screen bounds, top down shooter I am using x and z axis to go left/right ; up/down respectively. The Camera is on the y-axis.

I have the following code so far -

private float playerWidth;
    private float playerDepth;

private Vector2 screenBounds;

// Other Variables and Initiators

// Start is called before the first frame update
void Start()
{
    playerRigidbody = GetComponent<Rigidbody>();
    screenBounds = Camera.main.ScreenToWorldPoint(new Vector3(Screen.width, Screen.height, Camera.main.transform.position.z));
    //gives x and y values that will be half the screen value. Screen coordinate system is reversed, so these will be negative values
    playerWidth = transform.GetComponent<BoxCollider>().bounds.size.x / 2;
    playerDepth = transform.GetComponent<BoxCollider>().bounds.size.z / 2;
    // we need half the size as we already are at the center of the object, using clamp
}

Tutorials are using SpriteRenderer as this would make more sense in a 2D game, however I am working in 3D space, creating a 2.5D effect.

private void LateUpdate()
    {
        withinScreenBounds();
    }

private void withinScreenBounds()
{
    // check if player does not exceed camera view, else stop all movement.
    Vector3 viewPos = transform.position;
    viewPos.x = Mathf.Clamp(viewPos.x, screenBounds.x + playerWidth, screenBounds.x * -1 - playerWidth);
    viewPos.z = Mathf.Clamp(viewPos.z, screenBounds.y + playerDepth, screenBounds.y * -1 - playerDepth);
    transform.position = viewPos;
    // the above will work with the center of the tank.
}

The tank is currently jittering between screenpoints, not sure if this has to do with the boxcollider itself.

sentences:
Worth using Box2d for collision but not physics? I am currently doing some work in cocos2d-x and am thinking about using their box2d implementation for things like collision detection (but not necessarily response), range detection, and other things like that, which are not strictly physics based.

Is it worth doing this?  or would I be better off just writing a simple system that does checks based on location/size of my objects?

sentences:
What is causing this error in rpg maker mv "Animated Sideview Enemies plugin" I am having trouble with this plugin because when I use it to attack It gives an error. You can clearly see using magic works fine, it only seems to cause the error when attacking and only when using the "" notetags aka side-view mode.

Using Attack

Using Magic

Here is some reference links to what I am talking about.
The plugin: http://yanfly.moe/2015/12/13/yep-44-animated-sideview-enemies/
rpg maker mv: https://store.steampowered.com/app/363890/RPG_Maker_MV/

sentences:
Rendering only a part of text FTGL, OpenGL I'm using FTGL library to render text in my C++ project.

I can easily render text by using:

CFontManager::Instance().renderWrappedText(font, lineLength, position, text);

Unfortunately there is a situation in which this Button which displays text, is partly hidden because of resizing container in which it is situated. I'm able without any problem to draw Button's background to fit the container, but I've got a problem with doing the same with a text. Is it possible to somehow draw only text for given width and the rest just ignore?

This is a screen which presents my problem:

As you can see, the Button "Click here" is being drawn properly, but I can't do the same with "Click here" text.

sentences:
Minecraft Type Game Support Blocks OK I have a game that is similar to minecraft in a sense. Players can build castles block by block. I'm using Unity3D and Photon Network for my game and I was wondering how I would handle detecting if blocks have a support system to the ground. Here is the game in question. Let me know what are some solutions besides using rigid-bodies I've tried doing that and it has severe performance issues over a network. Thanks

Youtube Video of Game

sentences:
Simple Bounding Box Multiple Collision problem I'm making my first game, and in it I use a moving ball to hit static blocks (kinda like breakout).

Basically, I loop through all of the static blocks on the screen each frame, update the position of the ball based on its velocity, and if it collides with a block, the ball will bounce back off of the block.

If the ball hits one block exactly, then there is no problem whatsoever. But if the ball happens to hit two blocks at the same time (that is, it hits in between both blocks), it passes right through both of them--no deflection whatsoever.

(I know the looping is inefficient and I'm looking to correct that later, but if it has to do with the problem, I just hope someone can point to me why it is that the collision resolution fails when two similar objects are hit at once.)

sentences:
A game that can balance itself over time? So after reading some history and learning about how some countries were allowed to survive by stronger countries, just so that a power gap wouldn't exist. That being said, we can assume that if this power gap did exist, eventually the world will rebalance itself one way or another.

Would that be applicable in games? Can a game (for example, Overwatch or any MMORPG) balance itself over time whether the imbalances are a result of how the classes are built or even the population of people in every faction?

I thought about it a lot and I tried finding dissimilarities between my real world example and games.

In games, you are allowed to have many identities. You can essentially have a character in every faction. In a game like OW you can pick any hero. You don't have a fixed identity that defines you like IRL so cloning the idea of a "Country/Nation" in real life to a game is nearly impossible as developers don't have power over how many characters/factions the player can have.
Nations have finite resources. All MMOs I played have infinite resources which simply doesn't make sense compared to the real world. Finite resources is what makes nations great whether by smart utilization of said resources or conquering/invading other nations.

That being said, I still have a feeling that it's possible, one day, to have a game that can balance itself over time. But to achieve that, I believe we need to put many constraints on the gameplay to mimic real life constraints that "define" a nation.

What do you guys think? What would those constraints be?

sentences:
What would it take to program a game engine like the build engine My favorite games of all time are thanks to Ken Silverman's BUILD engine, The engine that brought us DukeNukem 3D, Shadow warrior and Blood. I've read a few articles on the build engine however I haven't found any good ones that go in depth. Ive been programming in C for 3 and a bit years now and am reading through many books every day, so I believe I have minimal skills needed to take on this task.

I was wondering what it would take to make my own "Build engine". What sort of mathematics do I need to learn/know, What books would you recommend, what sort of programming do I need to know (I.E low level programming with bitwise operators or any thing else). My current goal is not to make a game like Duke nukem 3D but to merely make a engine that supports things like sloped walls, translucency, wall and floor sprites etc.

sentences:
Tetris rotation without using arrays I am making a Tetris clone. Is there any way that I can avoid using a 2D array for storing a Tetris block?

EDIT: Suppose I have an array to store an L-shaped piece:

1 0
1 0
1 1

But for the sake of rotation, I do that shape as this:

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

I can do this in either objects or arrays. If I use objects then create four objects for each "square", and I can store the position of each square, and rotate it about the piece's center. But I am finding a better way to optimally perform a rotation on the piece. I believe rotating this array 90 degrees would take O(n^2) time. I try to avoid making rotated copies, and instead rotated on the fly. What algorithm or approach should I use?

sentences:
Can a MonoBehaviour be a private inner class? I want to use a private inner class MonoBehaviour as part of the internal implementation of a class (also a MonoBehaviour). Reduced to the essentials:
public class OuterClass : MonoBehaviour {
  public void SomeMethod(GameObject go) {
    go.AddComponent<InnerClass>();
  }

  private class InnerClass : MonoBehaviour {
  }
}

This appears to be all working absolutely fine, with no errors or warnings. But it also appears to violate the statement in the Unity documentation that:

The class name and file name must be the same to enable the script
component to be attached to a GameObject.

Is this a problematic violation of that rule? If so, what are the problems? I am aware that it means the script is not visible in the Editor, but that's exactly what I want: it should never be added by anything other than its enclosing class.

sentences:
Efficient UI for RTS units I was wondering how I should approach the runtime changes on the game UI when selecting different types of units in a RTS.

For example, in Starcraft, each unit type has its own portrait, attributes, buffs and command cards displayed in the UI. Selecting another unit will update all of these.

I can see two possible solutions:

Each unit type has its own UI panel created (in memory), and selecting another unit disables the current UI panel and enables the new one.
There is only one UI panel, and selecting a unit fills the portrait, attributes, command cards, etc. dynamically.

Both solutions seem inefficient. The first may consume too much memory, and the second makes no caching at all. Maybe the way to go would be something in-between, or completely different.

I'm working with Unity, but I think the discussion should stay pretty high level.

sentences:
Change sprite angle on sloping ground I have a problem here with GameMaker built-in physics environment.My player is designed to be on a skateboard. I want my player to rotate its sprite, according to the kind of fixture(up or down slopes) he is moving on.I've tried everything i could and everything i could find, but it didn't help me much, because the object is rotating in a very strange way.I enabled some flags to see the mask. Also, I've been studying vector algebra and i know it the angle between vector x speed and vector y speed should be the direction. Please help. Here's what i have so far:

1 object which is the player
Information about object: obj_Player
Sprite: sprite7
Solid: false
Visible: true
Depth: 0
Persistent: false
Parent: obj_Static_Parent
Children:
Mask:
Physics
Start Awake: true
Is Kinematic: false
Is Sensor: false
Density: 0.5
Restitution: 0.1
Group: 0
Linear Damping: 0
Angular Damping: 0
Friction: 0.2
Shape: Polygon
Points:
(76, 52)
(76, 60)
(0, 56)
(0, 52)
Create Event:
execute code:

///Initialize the tires
var half = sprite_width / 2;
var halfy = sprite_height / 2;
var tire = instance_create(x-half+12,y+halfy,obj_Wheel);
physics_joint_revolute_create(id,tire,tire.x,tire.y,0,0,0,0,0,0,false);
var tire = instance_create(x+half+12,y+halfy,obj_Wheel);
physics_joint_revolute_create(id,tire,tire.x,tire.y,0,0,0,0,0,0,false);

Step Event:
execute code:

//Code
facing = -point_direction(0, 0, phy_speed_x, phy_speed_y);
phy_fixed_rotation = true;
phy_rotation = facing;

//Move him
if(keyboard_check(vk_space)) {
physics_apply_impulse(x,y,0,-100);
}
if mouse_check_button(mb_left)
{
phy_position_x = mouse_x;
phy_position_y = mouse_y;
}

Information about object: obj_Wheel
Sprite: spr_Wheel
Solid: false
Visible: true
Depth: 0
Persistent: false
Parent: obj_Static_Parent
Children:
Mask:
Physics
Start Awake: true
Is Kinematic: false
Is Sensor: false
Density: 0.05
Restitution: 0.1
Group: 0
Linear Damping: 0.1
Angular Damping: 0.1
Friction: 30
Shape: Circle
Points:
(8, 8)
(8, 8)
Create Event:
execute code:
Keyboard Event for  Key:
execute code:
            physics_apply_torque(-100);
Keyboard Event for  Key:
execute code:
            physics_apply_torque(100);

And here is the result:
  http://i.stack.imgur.com/sn1qh.gif

sentences:
What's the better approach, running multiple server-builds on one instance or running one server-build and managing matches in different rooms? We are building a racing multiplayer game using Mirror and Unity and we've been able to successfully run the authoritative server on AWS-Gamelift and Playfab so far.
Both providers are with the flexibility of running multiple server-builds and mapping with different ports.
So I think running multiple server-build for different matches on one instance is a bit expensive in terms of server usage as compared to running one server and managing multiple matches in different rooms.
But overall it seems to be a safer option to go with since build crash and similar issues will only happen on one match and other matches (servers) will be running fine on the same machine and also it's a bit easier to handle and scale.
What's your opinion on this?
It might be useful if you share any blog or resource to look at for scaling and managing servers on gamelift/playfab.
thanks!

sentences:
General Octree question: What do you actually store? Ok, So I'm experimenting with various terrain generation methods, primarily in Unity, but i'll admit to not use all its features because I started learning about Game Dev in XNA YEARS ago. So, I made a blocky setup like minecraft several times, and made it ineractive. Kool Beans... I did it in chunks, not an Octree method. I've also had a broken version of Marching cubes, but it really wasn't broken, it made the look I was going for at the time.

So I've never really worked with Octrees, and I started reaseaching Dual Contouring and Surface Nets, and a lot of em talk about Octrees. I get the idea logically, but I kinda don't understand some basic "Mechanics" of Octrees, and finding "basic" answers to some of these topics is rough.

So, sticking really to just Octrees, what kind of data to really store in em? I mean, I get I literally could break up a 3D array of strings, but I'm asking about best practices and practicality. I've been using an array of bools generated by another object, really because I'm really trying to make something that does more "computing" than "hashing", and I was thinking bools would be the smallest type to store if I'm going to "blow it up" with other techniques.

So, when I first create this bad boy, and give it a 3D array of data, Do I really go through a method of recusivly testing each value before I "break" the "Master Node" into "Children nodes"? Or Do I start by testing each value in pairs, building Up to larger children nodes?

Any other pointers would be appreciated.

sentences:
Swift - Why does my SKShapeNode pass through an object, pausing briefly beforehand? The code below when run on a device that’s flat on the table shows a red circle (the 'ball') and a line.

When I gently tip the device the circle moves towards the line. When it reaches the line, it stops which is the expected and desired behaviour.

BUT if I keep tipping, the circle moves through the line. I’ve been trying for 2 days to work out why grrr I just want the circle to hit the line and not go through it.

Any ideas? Anything to do with the line being an 'edge'?

Cheers,
Andy

import SpriteKit
import CoreMotion

class GameScene: SKScene, SKPhysicsContactDelegate {
    var ball : SKShapeNode!
    var line : SKShapeNode!
    var motionManager = CMMotionManager()
    var destX : CGFloat!
    var destY : CGFloat!
    let ballRadius = CGFloat(20.0)

override func didMoveToView(view: SKView) {
    backgroundColor = SKColor.whiteColor()
    physicsWorld.gravity = CGVector(dx: 0, dy: 0)
    physicsWorld.contactDelegate = self

    ball = SKShapeNode(circleOfRadius: ballRadius)
    ball.fillColor = UIColor.redColor()

    ball.position = CGPoint(x: frame.size.width/4, y: frame.size.height / 2)
    destX = frame.size.width/4
    destY = frame.size.height / 2
    ball.physicsBody = SKPhysicsBody(circleOfRadius: ballRadius)
    addChild(ball)

    line = SKShapeNode()
    var lineStart = CGPoint(x: frame.size.width/2, y: 0)
    var lineEnd = CGPoint(x: frame.size.width/2, y: frame.size.height)
    var linePoints = [lineStart, lineEnd]
    var linePos : CGMutablePathRef = CGPathCreateMutable()
    CGPathAddLines(linePos, nil, linePoints, 2)
    line.path = linePos
    line.strokeColor = UIColor.blackColor()
    line.physicsBody = SKPhysicsBody(edgeFromPoint: lineStart, toPoint: lineEnd)
    addChild(line)
}

override func update(currentTime: NSTimeInterval) {
    moveBall()
}

func moveBall() {
    motionManager.startAccelerometerUpdatesToQueue(
    NSOperationQueue.currentQueue(), withHandler: {
        data, error in
        var currentX = self.ball.position.x
        var currentY = self.ball.position.y
        self.destY = currentY - CGFloat(data.acceleration.x * 100)
        self.destX = currentX + CGFloat(data.acceleration.y * 100)
        }
    )
    ball.position = CGPoint(x: destX, y: destY)
    }
}

import UIKit
import SpriteKit

class GameViewController: UIViewController {

override func viewDidLoad() {
    super.viewDidLoad()
    let skView = self.view as! SKView
    let scene = GameScene(size: CGSizeMake(
    skView.bounds.size.width, skView.bounds.size.height))
    skView.showsFPS = true
    skView.showsNodeCount = true
    skView.ignoresSiblingOrder = true
    scene.scaleMode = .AspectFill
    skView.presentScene(scene)
}

override func prefersStatusBarHidden() -> Bool {
    return true
}
}

EDIT: many thanks to Attackfarm :)

I changed the moveBall() function as follows:

func moveBall() {
    motionManager.startAccelerometerUpdatesToQueue(
        NSOperationQueue.currentQueue(), withHandler: {
            data, error in
                self.ball.physicsBody!.applyForce(CGVector(dx: -data.acceleration.x*100,
                        dy: data.acceleration.y*100))
        }
    )

which in this proof of concept demonstrates what I needed. Thanks again!

sentences:
Box2D : rotate and set position to a static body with another origin I try to rotate a static body of a PolygonShape, from another origin, and set the position regarding this new origin.

Why ? Because I create bodies from TiledMapEditor object. And origins of objects in this editor are in the left upper corner.

Regarding the documentation, I can set origin using the setAsBox method. But then when I set the position, the body is not where it is supposed to be. (an offset is apply between the current position and the expected position)

I assume that the origin is used for the rotation, but not the position.

How can I set the position from another origin, and rotating from this same origin ? (the upper left corner and not the center of the shape)

My attempt :

  val rotation = 45f // rotation angle (in degree)
  val shape = PolygonShape()
  shape.setAsBox(rectangle.width*0.5f, // half width
                rectangle.height*0.5f, // half height
                Vector2(0f, rectangle.height), // new origin
                rotation * MathUtils.degreesToRadians) // angle to radians

   val bodyDef = BodyDef()
   bodyDef.type = BodyDef.BodyType.StaticBody
   bodyDef.position.set(rectangle.x, rectangle.y) // set the position

Regards

sentences:
Accessing RigidBody2d from OnTriggerEnter2D(Collider) I have the following script on my water object which, when the Players ship triggers it, the ships gravity is inverted to give the sense of buoyancy. I have added a 'print' statement to prove that the collision is working and that the Name condition check works, which it does. However it throws an error when trying to access the plays ship Rigidbody2D property to then access the GravityScale with the message:

There is no 'Rigidbody2D' attached to the "Player" game object, but a script is trying to access it.
You probably need to add a Rigidbody2D to the game object "Player"...

void OnTriggerEnter2D(Collider2D coll)
{
    if (coll.gameObject.name == "Player")
    {
        print("Player Hit Water");
        Rigidbody2D tmp = coll.gameObject.GetComponent<Rigidbody2D>();
        tmp.gravityScale *= -1;
    }
}

Update: It turns out this code is fine it was the structure of my gameobjects  that was the problem as the Rigidbody2D was in the child object, not the parent. See comments below for details.

sentences:
Java2D Shooting in a line tangent to mouse coordinates I am making a top down shooter in Java and I need to be able to shoot in a line tangent to the mouse coordinates. In other words I need to be able to click my mouse and have a projectile spawn from my player, then move its position in a straight line in the direction of where I clicked. I have tried this already and I have failed miserably, and after looking into it for a while I haven't found a good answer. The code is pasted below, any ideas on what I'm doing wrong?

The mouse angle is calculated like this:

mouseAngle = (float) Math.toDegrees((float) Math.atan2(e.getY() - Player.getY(), e.getX() - Player.getX()));

 VectorMath class

package vector;

public class VectorMath {

    public VectorMath() {

    }

    public static void copyVector(Vector2f v1, Vector2f v2){
        v1.setX(v2.getX());
        v1.setY(v2.getY());
    }

    public static void printVector(Vector2f v){
        System.out.println("x: " + v.getX() + " y: " + v.getY());
    }

}

 Projectile Class

package projectile;

import java.awt.Color;
import java.awt.Graphics2D;

import player.Mouse;
import player.Player;
import vector.Vector2f;
import vector.VectorMath;

public class Bullet {

    private Vector2f pos = new Vector2f(0, 0);
    private float x,y, xVel, yVel, moveSpeed = 0.1f, dX, dY;;
    private float mouseAngle;

    public Bullet(Vector2f pos) {
        VectorMath.copyVector(this.pos, pos);
        VectorMath.printVector(this.pos);
        x = Player.getX();
        y = Player.getY();
        mouseAngle = Mouse.getMouseAngle();
    }

    public void update(){
        xVel = pos.getX() + (((float)Math.cos(mouseAngle)) / moveSpeed);
        yVel = pos.getY() + (((float)Math.sin(mouseAngle)) / moveSpeed);

        dX = x + xVel;
        dY = y + yVel;

        x = dX;
        y = dY;

    }

    public void render(Graphics2D g2){
        g2.setColor(Color.green);
        g2.fillRect((int)x, (int)y, 10, 10);
    }

}

sentences:
How powerful is modern hardware for complex, intensive 2D graphics? I am embarking on a massive (image quality, file size, high frame count) project. I am still working on the basic engine, but have a big question that I would like answered before I begin testing. (It requires a lot of work to test, and possibly fail and have to recreate all sprite sheets, so an answer can help me save weeks of work if I'm wrong.)

The game is entirely in 2D, with 2.5D view. I want to eventually have 40 animations, which all have to be animated in 8 directions. I want each direction/animation to have its own sprite sheet. This equates to hundreds of spritesheets and thousands of files.

Before the obvious solution "Degrade quality for file size!" I would like to take every step possible to prevent degradation of quality, animation frame count, and image size.

Before my solution, one character was 350MB in ram (LOL!) but that was fixed quickly down to 10-20MB per whole character. That is...if I were to load ALL (40) animations in ALL directions (8). So if I were to load 320 sprite sheets into memory, it was going to be a ridiculously large amount per character in ram.

MY QUESTION IS THIS:

How much (of total sprite sheets) should I have loaded into memory at any given point?

Can I get away with loading ONLY the CURRENT spritesheet (Direction + Animation) into memory? Is modern hardware fast enough to constantly swap textures on the fly?

Players could, at any moment, change direction. This would change the entire spritesheet.
Same for animation. So within a split second, the game would have to load a specific new spritesheet, unload the old one (or unload it eventually), and render all within a split second. This would have to be done once for every character, anytime they animate or change directions in a real time game.

Fortunately, the amount of characters on screen at once will be limited by the fact the game is 2D, but I'd prefer to be able to cram in the maximum amount without performance issues on a mediocre computer.

Is texture swapping, file loading, instant rendering from HDD and memory-- all so fast with modern hardware that I wont even need to worry about ANY of this?

I just dont want to work on all of these spritesheets (from thousands of images I already have) only to find out my performance will be horrible and have to redo all spritesheets. Even to test, since I have a layering equipment system, is a time consuming task for spritesheet creation. That is, until I find a solution to process those faster (automation, i do it manually currently, using a program)

sentences:
OpenGL setup on Windows I have been trying to use OpenGL for two days now. First on Mac, then on Windows. The problem with Mac is that it doesn't support the newer versions of OpenGL. I ran a tutorial that actually did get some things working, but it only works in XCode (i.e., I can't create a new file, paste in the same code, and get it to work). Because of these issues, I moved to Windows. My Windows 7 has OpenGL 4.3, which is the same that is used in alot of other tutorials. However, not one of these tutorials gives any instruction on how to set it up for the first time. I have come across some vague posts saying that some libraries need to be linked. But WHAT libraries, and HOW do I link them?

Please help. I am pretty desperate to set this up as this project is due for work soon. I have actually used OpenGL before at my university, but the computers already had everything set up. The project itself is very easy, but setting up OpenGL is not something I know how to do.

Edit: Using C++.

sentences:
How to ensure Unity does not rearrange the sub-meshes of a mesh on import? having a bit of a head scratcher problem here. I have my artist's making multiple unique meshes in Maya that contain 3 materials. Each material is assigned to a sub-mesh in a specific order. This order is identical across all the meshes being created. When bringing over these meshes to Unity, we have noticed that some meshes keep their material/sub-mesh order from Maya, and some do not. It's been making code generated material swaps a nightmare. So a few questions:
1.) What is Unity's logic when importing meshes and ordering the sub-meshes?
2.) Is there a simple way to make sure Unity does NOT reorder the sub-meshes/material order?
3.) Is there a way on Maya's side when exporting to make sure the sub-meshes/material order is as intended?
Any help or ideas is appreciated. Thanks!!

sentences:
Three js raycaster WITHOUT camera I seem to find only examples to use the raycaster with the camera, but none that just have a raycaster from Point A to Point B.

I have a working raycaster, it retrieves my Helpers, Lines etc. but it seems it does not recognize my sphere.

My first thought was my points are off, so i decided to create a line from my pointA to my pointB with a direction like so:

var pointA = new Vector3( 50, 0, 0 );
var direction = new Vector3( 0, 1, 0 );
direction.normalize();
var distance = 100;

var pointB = new Vector3();
pointB.addVectors ( pointA, direction.multiplyScalar( distance ) );

var geometry = new Geometry();
geometry.vertices.push( pointA );
geometry.vertices.push( pointB );
var material = new LineBasicMaterial( { color : 0xff0000 } );

var line = new Line( geometry, material );

This will show a line from my point (50 0 0) to (50 100 0) right trough my sphere which is at point (50, 50, 0) so my pointA and direction values are correct.

Next i add a raycaster:
To avoid conflicts with any side effects i recreated my points here:

var raycaster = new Raycaster(new Vector3( 50, 0, 0 ), new Vector3( 0, 1, 0 ).normalize());
var intersects = raycaster.intersectObject(target);
console.log(intersects);

Seems pretty straight forward to me, i also tried to use raycaster.intersectObjects(scene.children) but it gives Lines, helpers etc. but not my sphere.

What am i doing wrong? I am surely missing something here.

IMG of the line and the sphere:

sentences:
Object pooling of different tpyes of agents (Mobile Game) in Unity The mobile game I am developing consists of one to four players and different agents that are being spawned and act in their own way. All those Agents (Car, Animal and Powerup) derive from the same base class 'Agent' which in turn has a field called 'rank' which represents something like 'low', 'medium' and 'high'.
So an agent with rank 'high' will look and behave different than one being tagged 'low'.

The thing is - the 'rank' of the agent is determined at random. The max count of agents active simultaneously is known but this number is not in regard to their 'rank'. When objectpooling, this would lead to the follwing case:

There's a max agent count of, say, 6. This would require 6 instances of each agent with rank 'low' to 'high' to be created, altough some of those instances would never even be used.

So my idea was to create only 6 gameobjects holding the components that each agent requires and use reflection to set the components fields according to the type. The problem is that some compoents which are unique to rank and type would need to be added and removed at runtime.

What solution would be better in terms of runtime and memory performance?

sentences:
Main Controller dont destroy on load I would like to have a Main Controller class that should exist in many scenes.
I used DontDestroyOnLoad and in runtime an object associated with this class is present in hierarchy. However, how can I use this script if its only visible in runtime? How can I assign the coresponding game object to button if I cant see It until I run the game?

sentences:
16-Bit textures in XNA 4 on WP7 WP7 textures are supported in the Reach-Profile that WP7 devices falls into. But XNA converts all my ressources upon adding them to a project to RGBA8, that's insane, the displays of WP7 devices are 16 Bit!

Information: WP7 SDK 7.1 (XNA 4), Visual Studio 2010

Question part 1: How can I add a RGB565 texture to a XNA project and what is the correct way to load them inside a game?

Question part 2: Is there a reasonable 16 Bit texture format (within Reach) that supports alpha with MORE than 1Bit?

Question part 3: Is the normal rendertarget (I think that's what the screenbuffer is?) already 16 bit?

sentences:
Best way to calculate unit deaths in browser game combat? My browser game's combat system is written and mechanically functioning well.  It's written in PHP and uses a SQL database.  I'm happy with the unit balance in relation to one another.  I am, however, a little worried about how I'm calculating unit deaths when one player attacks another because the deaths seem to pile up a little fast for my taste.

For this system, a battle doesn't just trigger, calculate winner, and end.  Instead, it is allowed to go for several rounds (say one round every 15 mins.) until one side passes a threshold of being too strong for the other player and allows players to send reinforcements between rounds.

Each round, units pair up and attack each other.  Essentially what I do is calculate the damage:

AP = Attack Points
HP = Hit Points

Units AP * Quantity * Random Factors * other factors (such as attrition)

I take that and divide by the defending unit's HP to find the number of casualties of defending units.  So, for example (simplified to take out some factors), if I have: 500 attackers with 50 AP vs 1000 defenders with 100 HP = 250 deaths.  I wonder if that last step could be handled better to reduce the deaths piling up.

Some ideas:

I just change all the units with more HP?
I make sure to set the Attacking unit's AP to be a max of the defender's HP to make sure they only kill 1 unit.  (is that fair if I have less huge units vs many small units?)
I spread the damage around more by including the defending unit's quantity more? i.e. in that scenario some are dead and some are 50% damage.  (How would I track this every round?).  This kind of seems like the best idea, but not sure how i'd track it in the DB.
Other better mathematical approaches?

sentences:
How to import character from Blender to Unity? I am trying to import a character into Unity from Blender. I exported the model (which has actions/animations) from Blender as a FBX file and dropped in into my Unity project’s Assets folder. The model with all of its components (mesh, armature, animations) appears in the project window; however, Unity doesn’t immediate associate the animations with the model when I drag an instance of the model into my scene.

I have also imported a Blender default model (“Constructor” - a man with red overalls and a wrench), and have been comparing the settings of my model to the Blender model in order to find discrepancies.

3 observations I have made:

Blender’s model is automatically assigned an “Animation” window in the Inspector panel (image #1), while mine is assigned an “Animator” window (image #2). Since the former window is the one where the animations are listed and you assign the default animation, it seems like this one is crucial. How do I import my model such that the “Animation” window appears in its Inspector window? (I’ve tried adding an “Animation” window myself, but it doesn’t recognize the model’s animations as the Blender model’s “Animation” window does.

In Unity, my model’s animations all begin at -1.0 (even though they begin at keyframe 0 in Blender) (image #3). For each animation, I get the message, “The clip range is outside the range of the source take.” I get this message even when I move the animation forward several keyframes in Blender and re-export the file to Unity as a FBX.
I compiled several of my actions into an animation that I then exported as a .mov file, and this is the sequence of actions that begins when I press “Play” in Unity. When I deleted this animation from Blender (as I thought this was the issue), my model now does nothing when I press “Play.”

I am using:

Blender 2.67 and Unity 4.1.5f1

My actual question: How do I import my character into Unity such that it is automatically assigned an “Animation” window?

I have been struggling with this issue for several hours now, and none of the online tutorials or forums seem to address it.

sentences:
Should I cap the frame rate in SDL? I know this question has been asked a lot, but I never found an answer suitable for me. I have a game with a fairly big logic system and the movement system I am currently using is calling SDL_GetTicks() and measuring the delta time between the frames. I multiply the delta with the speed and I get the pixel movement. The problem with this is that the CPU usage is quite high. I didn't really mind it until my friend started going on about how it was "the end of the world".

The question I really want an answer to is if I should cap the framerate, and if a high CPU usage is unwanted (or even dangerous!).

sentences:
Angle between start and current rotation I'm facing problem of the operations on rotations. I have a wheel with a start rotation of (0, 0, 0). The player has to rotate wheel 270 degrees in Y axis either left or right.
During the rotation slider should indicate progress of the rotation. For example if player rotated 135 degrees in right direction, slider is 50% filled to the right.
The thing is that I'm not sure how to get the value of which the player rotate the object.
For example when I start rotating right my angle changes from (0, 0, 0) to (0, 359, 0). How can I resolve this issue so it knows that change from (0, 0, 0) to (0, 359, 0) means player rotated only +1 degree?

sentences:
game server - fault tolerant If you have for example an MMO with 2000 players, and players are constantly removing / creating / swapping items (and doing some other important things that can't be lost).

If the updates are saved instantly in the database, since they are too many, the database dies. If you save them every "x" minute, there's a window where if your server app dies, players may lose items, and sometimes they may be expensive, let's say 100$, so that can't happen.

Is there a design or a guide I could read that handles this issue? The games I play today do not have that problem.

sentences:
How to capture the screen in DirectX 9 to a raw bitmap in memory without using D3DXSaveSurfaceToFile I know that in OpenGL I can do something like this

glReadBuffer( GL_FRONT );
glReadPixels( 0, 0, _width, _height, GL_RGB, GL_UNSIGNED_BYTE, _buffer );

And its pretty fast, I get the raw bitmap in _buffer.
When I try to do this in DirectX. Assuming that I have a D3DDevice object I can do something like this

if (SUCCEEDED(D3DDevice->GetBackBuffer(0, 0, D3DBACKBUFFER_TYPE_MONO, &pBackbuffer))) {
   HResult hr = D3DXSaveSurfaceToFileA(filename, D3DXIFF_BMP, pBackbuffer, NULL, NULL);

But D3DXSaveSurfaceToFile is pretty slow, and I don't need to write the capture to disk anyway, so I was wondering if there was a faster way to do this.

EDIT: I am targeting only DirectX applications. Actually DX9 apps. I am doing this through a hook to Present. (I am using Detours if that is relevant), and I am doing this for every frame. I don't need (or want) a particular bitmap format like BMP PNG JPEG etc, and a colorspace of RGB24 is OK. Getting it as YUV480p would be better but definitely not necessary. Thanks everyone for the very helpful answers

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:
Topdown Game Collision Detection I am working on a simple game with topdown movement, but I am unable to get the collisions to work properly. I know the collision detection itself works, but the constraining of the player is where I fail. It gets close to working, but on the corners it still clips into the squares. Also, if I add more squares for the player to collide with, it fails completely. I am programming this game in Processing, which uses Java. Here is my code:

void Collide(float WallX,float WallY,float WallWidth,float WallHeight) {

  this.WallX = WallX;
  this.WallY = WallY;

  this.WallWidth = WallWidth;
  this.WallHeight = WallHeight;

  float TestX = PosX;
  float TestY = PosY;

  if(PosX <= WallX) {
    TestX = WallX;
    CollideLeft();
  }

  if(PosX >= WallX+WallWidth) {
    TestX = WallX+WallWidth;
    CollideRight();
  }

  if(PosY <= WallY) {
    TestY = WallY;
    CollideUp();
  }

  if(PosY >= WallY+WallHeight) {
    TestY = WallY+WallHeight;
    CollideDown();
  }

  fill(255,0,0,150);
  ellipse(TestX,TestY,16,16);

  Dis = sqrt(sq(TestX-PosX) + sq(TestY-PosY));

  println("Dis= ",Dis,", TestX= ",TestX,", PosX= ",PosX,", TestY= ",TestY,", PosY= ",PosY);

}

boolean CollideLeft() {

  if(Dis <= Radius+5) {
    //PosX = WallX-Radius;
    return CollideLeft = true;
  }
  else {
    return CollideLeft = false;
  }

}

boolean CollideRight() {

  if(Dis <= Radius+5) {
    //PosX = WallX+WallWidth+Radius;
    return CollideRight = true;
  }
  else {
    return CollideRight = false;
  }

}

boolean CollideUp() {

  if(Dis <= Radius+5) {
    //PosY = WallY-Radius;
    return CollideUp = true;
  }
  else {
    return CollideUp = false;
  }

}

boolean CollideDown() {

  if(Dis <= Radius+5) {
    //PosY = WallY+WallHeight+Radius;
    return CollideDown = true;
  }
  else {
    return CollideDown = false;
  }

}

void Move() {

  if(MoveRight && !CollideLeft) {
    MoveX(1);
  }
  if(MoveLeft && !CollideRight) {
    MoveX(-1);
  }
  if(MoveDown && !CollideUp) {
    MoveY(1);
  }
  if(MoveUp && !CollideDown) {
    MoveY(-1);
  }

}

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:
XNA 4 Content Pipeline dependency I tried to create something to parse XML with, which needs the inclusion of the Microsoft.Xna.Framework.Content.Pipeline; reference. This was fine and all, but as soon as I tried to debug, I got the error that it could not be resolved because it was in the wrong target framework; my main project uses the Client one.

What confuses me is that I can use the SkinnedModelProcessor in the same solution with no problems when it uses said non-Client framework. Why is this? Can I get mine to work without changing the main project's target framework?

sentences:
In a shader, why does substituting a variable with the expression producing it cause different behaviour? I have this correctly-working OpenGL shader producing Perlin noise:

 float left = lerp(fade(v),  downleft,  topleft);
 float right = lerp(fade(v), downright, topright);
 float result = lerp(fade(u), left, right);

Then I tried plugging the definitions of right and left into result:

float result = lerp(fade(u),
                    lerp(fade(v), downleft,  topleft),
                    lerp(fade(v), downright, topright));

Surprisingly, this behaves completely differently, giving visible edges in my Perlin noise. Below are both results:

My whole 30-line shader is here.

What is the difference between those?

sentences:
Light propagation through sub-step ray tracer I have this crazy idea.

What if you made a real-time 3D render that for each frame, progressed some number of light bouncing. In effect this is a ray tracer but it does the ray tracing in steps. First step is direct lightning, second step is 1 degree of indirect lightning and third is 2 degrees of indirect lightning.

For each step, you would accumulate the information in a new frame buffer. Obviously there are limitations to this because you are only considering what's on screen but is the idea sound? Can it be done? What does it look like?

I'm eager to try it out because it appears simple but I'm wondering if something like this doesn't already exist.

Basically a ray tracer implemented with real-time 3D rasterization that converges over time (with sub steps, more than 1 pass per frame) this convergence can be adjusted.

sentences:
Replacing 4 additive sprite layers with a single shader. Just can't get it right I'm using directx9 and have 4 textures I want to draw on top of each other. if I do this:

PDevice->SetRenderState(D3DRS_SRCBLEND,D3DBLEND_SRCALPHA);
PDevice->SetRenderState(D3DRS_DESTBLEND,D3DBLEND_ONE);

SetTexture(0,texture1);
DrawSprite();

SetTexture(0,texture2);
DrawSprite();

SetTexture(0,texture3);
DrawSprite();

SetTexture(0,texture4);
DrawSprite();

I Get EXACTLY the cool effect i want. but I suspect this level of blatant overdraw is inefficient. I'm sure this can be compressed into a single draw call somehow, and run faster. The trouble is, everything I try does not look the same, whether I try a fixed-function muyltitexturing approach setting the 4 textures as different texture stages, or whether I try to implement it inside an fx file as a shader. Nothing has the same effect.

Is it even possible?
I'm guessing within a shader it could be done by just mulitplying the sampled texture at each stage with the current screen value, but tbh I'm not sure if that is accessible to the shader (or how).
My current code works, but it bugs me I'm drawing 4 huge textures separately :D

sentences:
How to render grid properly, especially over distance? I'm drawing a grid, pretty much like one can see in the Unity editor itself or any 3D-editor, many 3D-related applications and some games. But it doesn't look pretty in my case.

I put a few random objects to make perspective more readable.

Please also see it full-size for clearer view on the artifacts at a distance.

How grid is rendered

Whole grid is one big plane.
There is texture representing one cell.
The cell is multiplicated by tiling.

How there are different line thicknesses on the picture?

It's just 3 planes (each with one grid) with different settings on top of each other. I could leave only one, but 3 grids demonstrate my problem better.

Additional details:

Mipmap is disabled (grid cells disappear very soon over distance when it's enabled).
Trilinear filtration and maximum aniso are set (looks worse otherwise).

My guess

I think over distance lines get to be thinner than a pixel, especially under shallow angle (hence “verticals” lines look better than “horizontal”.

Conclusion

Grid rendering is obviously done many times before me, so I presume it should be pretty much wide knowledge how to draw them prettily. I tried to google it, but any query formulation I tried led only to completely unrelated stuff. I have a bit of ideas what I can try, but I believe it would be reinventing the wheel.

P.S.: I'm using Unity engine, but I believe the engine is irrelevant.

Plane simple blurring suggested by user29244 and Thebluefish really makes huge difference:

Biggest lines are too blurry now, but it's irrelevant, because easy to fix.
Note that I had to enable mipmaping if you're trying to reproduce it.

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 do I avoid obstacles on a predefined path? I want is a character to walk along a path defined as a waypoint sequence. For example, a soldier patrolling around a castle.

However, I want the soldier to avoid (dynamic) obstacles, without deviating from the path too much.

How can this be done?

sentences:
Bouncing ball loses its forward momentum after the first bounce I've created a bouncing ball in Unity, and I want to bounce the ball across the field, but the results I get seem very unrealistic.
The ball should bounce in the direction it was launched 2 or 3 more times, but after the first launch the next bounce is bouncing at the same place, going straight into the air. I also didn't see any spin effect on the ball. How can solve this problem?

And here's my physics settings

sentences: Box2D pixels to meters , LibGDX I am confused . what shall I set the orthographic camera viewport in libGDX when I use box2d , in one tutorial I saw that he divided his viewport numbers to 32  because 1meter =32 pixel , but I think it will make the images to be displayed by lower quality , so can anybody explain me what viewport shall I set ?

sentences:
Best way to connect multiplayer users with each other (matchmaking) on a low powered server? OK so I am using unity to make a multiplayer game, but I'm not sure how to connect players with each other over the internet.

Unlike other questions, this isn't a general problem of working out how to do UPnp or using unity's matchmaking server. My issue is that my server that I would use is a simple low powered pc (running normal windows 10, no idea how to use windows server).

I think it is powerful enough to match players with each other, but not to host more than one or two actual games.

The other issue is that I have a residential internet connection with a dynamic ip that changes every few months. However the speed should be ok (150Mb/s download, 20Mb/s download).

Also, I'm not planning to spend money on a monthly basis for a server (like unity's matchmaking service) as I plan to spend as little as possible (So far I've paid £12 to Microsoft for a dev account and I've received a £200 voucher from them so my current spending is -£189!)

So my question is should I use my server (would it work), are there any online services that are very cheap to use, or is there another way to make this work?

Only other thing is I could use the free 20 users at once on unity's matchmaking, but would this limit be too small?

EDIT:
just for information, my game is a simple tank shooter. I was thinking about limiting the amount of tanks in a game somewhere around 8-20. The bullets in my game are physical objects with rigidbodys and they move at a slower speed (if you've ever played tank trouble, it looks like that). The world is in 3D. There is a potential for there to be up to a hundred bullets in a scene at once at the worst.
After hosting a LAN world with 7 players connected for about 20-30 minutes, windows reports the data usage being around 3-4MB.

sentences:
Do you need a license for US military badges, awards, decorations? We would like to use in our game names and images of real US military badges, awards and decoration.

http://en.wikipedia.org/wiki/Awards_and_decorations_of_the_United_States_military
http://en.wikipedia.org/wiki/Badges_of_the_United_States_Navy

I would like to know, if they are copyrighted or protected in any other way, or are they considered to be in public domain.

Regards and thanks
Piotr

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 to implement back and forth steering behavior? I am trying to implement some behavior for a flying enemy in my 2D platformer.

The desired behavior is for the enemy to fly back and forth across the player, harrowing him.

If the player was standing still, the enemy would simply fly back and forth across the player, say 128 pixels to either side of him. If the player was moving, the enemy would adjust his movement accordingly. For example, if the enemy was heading left and the player was moving right and reached a sufficient distance from the enemy, the enemy would start heading to the right of the player.

I currently implement this using a simple seek steering behavior. I have the enemy seek toward a point a fixed distance to the left of the player. When he arrives at that point, I have him then seek toward a point a fixed distance to the right of the player. If the player moves, these points also move.

Further, as my enemy approaches these target points, I slow his velocity in proportion to his distance to the target. In other words, I have a seek-with-approach behavior.

There are problems with this method. For example, if the enemy is currently to the left of the player and is seeking the left target point, if the player then starts moving left, the target point will also move left and the enemy will never reach it. It will appear as though the player is simply chasing the enemy.

So my question is: How can I implement this kind of back and forth steering behavior, accounting for the fact that the target can move? Is there a simpler way that I am not seeing?

I work in Godot, but would prefer an engine-neutral answer.

sentences:
Replacing a sprite for another on runtime (Unity3D) I need to replace the sprite of a face down card for another sprite (of a face up card).

This is the C# script attached to the face down card:

using UnityEngine;
using System.Collections;

public class Entra : MonoBehaviour
{

    public float velocidadDeRotacion = 100.0f;
    public Sprite CartaBase;
    public Sprite CartaDelantera;

    private bool clickActivado = false;
    public void OnMouseDown()
    {
        clickActivado = true;
    }

    // Use this for initialization
    void Start ()
    {

    }

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

        if (clickActivado)
        {
            transform.Rotate(Vector3.up * Time.deltaTime * velocidadDeRotacion);
            if (transform.eulerAngles.y >= 90)
            {
                SpriteRenderer Carta;
                Carta = GetComponent<SpriteRenderer>();
                if (Carta.sprite == CartaBase)
                {
                    Carta.sprite = CartaDelantera;
                    transform.Rotate(Vector3.up * Time.deltaTime * velocidadDeRotacion);
                    if (transform.eulerAngles.y >= 0 && transform.eulerAngles.y <=10)
                    {
                        transform.eulerAngles = new Vector3(0, 0, 0);
                        clickActivado = false;
                        return;
                    }

                }
                clickActivado = false;
                return;
            }

        }

    }
}

As you can see, I rotate the card when I click on it, when the angle reach 90º I stop the rotation and change the sprite, from CartaBase to CartaDelantera.

Right now I have two problems.

When the sprite has an angle of 1º or more, the image breaks. I lose the right half of the image from the center to the right border, and I don't understand why.
Using VS2013 as debugger, I make a step by step walkthrough and when it reach

if (Carta.sprite == CartaBase)

it jumps stright to

clickActivado = false;

So, obviously it's not "seeing" the sprite used by the card. Why???

I'm using this script as reference for the change of sprites.

If you don't understand my problem, you can see live here.

sentences:
What alternatives to large arrays do I have for level data? So I'm going to store my levels in int[] arrays.

Most levels are going to be 300*300*300. However, there will be about 24 levels and so that is 24 int arrays of size 300*300*300. However, that would mean I need about 2.5GB just to hold the information. Was wondering is there ways around this.

It just the nature of the game I need this many things. I can possible go down to 100*100*100 levels, but then I would still need about 17 at minimum.

I just can't get around using large arrays.

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:
How to rotate and move a model in the direction it is facing? I am not using Unity or XNA. Eventually, I will probably use OpenTK for graphics. But for the concept of a game I'm writing, I am using the console for keyboard input and visual logging of events, etc.

I am also using a WPF window to display world and player data.

Update: I am using 0 deg as North. I understand that this may not be 'standard'. I don't mind switching to the standard where 0 deg is East if necessary.

The standard keys are W, A, D, S and Left/Right arrows.
W: move forward
A: move left
D: move right
S: move backward

L Arrow: rotate left 2.5 (degrees)
R Arrow: rotate right 2.5 (degrees)

I am new to the physics of movement within a 2D space (as if I am looking down from overhead). What I have is a World and Player model; each Player encapsulates an IEntityVector object.

Edit: added the conversion to radians in the following method. Seems to work more correctly as long as the orientation is 0, 90, 180, or 270 degrees.

Move Model:

  public static void MoveEntity (Guid EntityId, Direction Direction) {
     var entityVector = default(IEntityVector);
     var gameWorld = default(World);

     if (entityRealms.TryGetValue(EntityId, out gameWorld)) {
        if (gameWorld.entityVectors.TryGetValue(EntityId, out entityVector)) {
           var heading = (Math.PI/180) * entityVector.Heading;

           switch (Direction) {
              case Direction.Forward:
                 entityVector.AddMovementX((float)Math.Sin(heading));
                 entityVector.AddMovementY((float)Math.Cos(heading));

                 break;
              case Direction.Left:
                 entityVector.AddMovementX(-(float)Math.Cos(heading));
                 entityVector.AddMovementY((float)Math.Sin(heading));

                 break;
              case Direction.Right:
                 entityVector.AddMovementX((float)Math.Cos(heading));
                 entityVector.AddMovementY((float)Math.Sin(heading));

                 break;
              case Direction.Backward:
                 entityVector.AddMovementX((float)Math.Sin(heading));
                 entityVector.AddMovementY(-(float)Math.Cos(heading));

                 break;
              default:
                 break;
           }
        }
     }
  }

Rotate Model:

  public static void RotateEntity (Guid EntityId, float Heading) {
     var entityVector = default(IEntityVector);
     var gameWorld = default(World);

     if (entityRealms.TryGetValue(EntityId, out gameWorld)) {
        if (gameWorld.entityVectors.TryGetValue(EntityId, out entityVector)) {
           entityVector.Heading += Heading;
        }
     }
  }

#1 I am trying to understand the rotation first of all. If Heading is increased or decreased by 2.5 per rt/lf arrow key press, how do I keep the resulting value as a true degree value?

#2 How can I use the Heading degrees as the facing to properly move the entity?

Btw, here are the AddMovement methods:

  public static void AddMovementX (this IEntityVector Vector, float X) {
     var newPosition = Vector.Location.X + (X * Vector.Thrust);
     Vector.Location = new Vector(newPosition, Vector.Location.Y);
  }

  public static void AddMovementY (this IEntityVector Vector, float Y) {
     var newPosition = Vector.Location.Y + (Y * Vector.Thrust);
     Vector.Location = new Vector(Vector.Location.X, newPosition);
  }

sentences: How do you create 2D skeletal animations without extra software? I'm working on a Cocos2d-x game and I'm developing on Windows. What I want is to make some skeletal animations, without using a tool or extra software to do so?

sentences:
Best practise for representing large spaces in a scene graph I'm attempting to represent a procedurally generated world in a scene graph, specifically in the Jmonkey engine (Jme3). To make this managable I have broken up the world into smaller chunks. Each chunk consists of a triangle mesh of the relevant piece of terrain. (A Geometry object holding the mesh and the relevant texture.)

I can't find any information however on which way is best to represent these within a scene graph, specifically how to deal with the coordinates of the map & camera.

One way of doing it would be to simply add these pieces on their world coordinate (which could get extremely large) detaching any nodes that are not within range of the camera and moving the camera trough this theoretically-infinite space. This would be very convenient but can the scene graph deal with the currently rendered scene having very large coordinates? The translations on each piece could easily go into the millions or more "distance units" on the graph's axis.

Another method that comes to mind is converting the world coordinates to a smaller local space and move the terrain that is being rendered to stay close to the origin of the scene graph. Essentially moving the world around the camera.Possibly moving the whole structure along with the camera 1 chunk in the opposite direction to keep it centred whenever a chunk border is crossed. However this seems like it could also have a large impact on performance.

Which of these options, or possibly a completely different one, would be preferable to represent the world in terms of CPU/GPU usage?

sentences:
Can't reference my custom editor script from a non-editor script even when using its namespace I know that certain namespaces are necessary to include to specify under what scope certain methods are found, and this also saves typing. Otherwise the error CS0246 is thrown if referencing an unknown type.

The problem is, that I am using a namespace in a script in:

 Assets / Scripts

And that namespace is defined in a script in:

 Editors / Data / AnotherFile

So I am getting an error CS0246.

How could I solve this without moving that script into the Assets / Scripts location?

SCRIPT LOCATED IN EDITOR / DATA / ANOTHERFILE:

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

namespace NodeEditorWindow
{

[CreateAssetMenu]
public class LevelFlowData : BaseNodeEditorData<BaseLevelNode, LevelFlowEditorAttributes>
{
    private const string MENU_ITEM_PATH = "Create / ScriptableObjects / LevelFlowData";
    private const string NEW_ASSET_PATH = "ScriptableObjects / Level Flow Data";

    [SerializeField] private string _name;

    /// <summary>Gets and Sets name property.</summary>
    public string name
    {
        get { return _name; }
        set { _name = value; }
    }

    [MenuItem(MENU_ITEM_PATH)]
    public static void CreateAsset()
    {
        LevelFlowData scriptableObject = ScriptableObject.CreateInstance<LevelFlowData>() as LevelFlowData;
        AssetDatabase.CreateAsset(scriptableObject, AssetDatabase.GenerateUniqueAssetPath(NEW_ASSET_PATH));
    }
}

}

SCRIPT LOCATED ON ASSETS / SCRIPTS / ...:

using System.Collections;
using System.Collections.Generic;
using UnityEngine;
using UnityEngine.UI;
using GameData;
using NodeEditorWindow; //HERE I AM USINGTHE OTHER CLASS'S NAMESPACE

public class LevelController : Singleton<LevelController>
{
    [Header("Level Data:")]
    [SerializeField] private LevelFlowData levelFlowData;
}

These are the errors I get in console (both CS0246):

Assets/Scripts/Scene Controllers/LevelController.cs(6,7): error CS0246: The type or namespace name `NodeEditorWindow' could not be found. Are you missing an assembly reference?

Assets/Scripts/Scene Controllers/LevelController.cs(11,27): error CS0246: The type or namespace name `LevelFlowData' could not be found. Are you missing an assembly reference?

Sorry if this seems to be a repeated question, but I haven't found any solution to this error due to having scripts on different paths (but using the namespaces). Thanks in advance.

sentences:
Synchronizing input, update and rendering threads How do you synchronise the input-handling, state-updating and rendering threads?

If a sprite position is modified due to input, the wrong position of the sprite might be drawn to the screen if the render thread draws the sprite before the update thread finishes its collision resolution routine.

How can this be done?

(The only solution I can think of would be to store input events as they are created and consume them in the update/render threads.)

sentences:
MMO: In-App vs. Website Purchase Im currently writing a turn based start game, which will be played in an MMO style (players download clients, central server handling the game logic etc.) and now I need to decide how I charge my players for playing my game, since this will have some implications on how player account handling is going to work.

After looking a bit around, I found two alternative ways of doing this

a)
Classical in-app purchase, for which my clients need to be able to take the payment info, send them to my server which then charges the selected amount (using some API like stripe.com) and provides the selected services

b)
Account administration and payment via website, and then synchronization between website and game server over some database

Most MMO games I know use the website approach (b) although I assume that in-app purchase (a) is faster and easier for my players and will therefore yield higher conversion rates.

So, my question is:
Are there some major problems (security, paperwork) or drawbacks (complicated to implement) with in-app purchase I overlooked?

Im not doing a mobile game (full desktop) and Im from europe, just in case this information might be needed.

sentences: Memory leak while loading libgdx game screen So, I have a lot of texture atlases in my code for a talking tom type libgdx, and I use around 6 of them per screen. The app crashes abruptly without any errors on devices with 1gb ram or less. I started profiling my code and found that I have 3500+ texture bindings, how should i minimize these?

sentences:
Libgdx Android app: Avoid fullscreen and show titlebar I am developing an app using Libgdx and I don't want the app to go fullscreen and want to show the title bar but the app goes to fullscreen and hides title bar despite all efforts.

Here is my style.xml file

<style name="MyStyle" parent="android:Theme.Light"></style>

Here is AndroidManifest.xml

<application
    android:allowBackup="true"
    android:icon="@drawable/ic_launcher"
    android:label="@string/app_name"
    android:theme="@style/MyStyle" >
    <activity
        android:name="com.mygdx.game.android.AndroidLauncher1"
        android:label="@string/app_name"
        android:configChanges="keyboard|keyboardHidden|orientation">
        <intent-filter>
            <action android:name="android.intent.action.MAIN" />
            <category android:name="android.intent.category.LAUNCHER" />
        </intent-filter>
    </activity>

Here is AndroidLauncher class

protected void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);
    AndroidApplicationConfiguration config = new AndroidApplicationConfiguration();
    config.hideStatusBar=false;
    initialize(new MyGdxGame(), config);
    setContentView(R.layout.main_activity);
    tv=(TextView)findViewById(R.id.tv);
    tv1=(TextView)findViewById(R.id.tv1);
    button = (Button)findViewById(R.id.button);
    button.setOnClickListener(new View.OnClickListener() {
        @Override
        public void onClick(View v) {
            if (Build.VERSION.SDK_INT < 19) {
                Intent intent = new Intent();
                intent.setType("image/*");
                intent.setAction(Intent.ACTION_GET_CONTENT);
                startActivityForResult(Intent.createChooser(intent, "Select Picture"), SELECT_PICTURE);
            }
            else{
                Intent intent = new Intent(Intent.ACTION_OPEN_DOCUMENT);
                intent.addCategory(Intent.CATEGORY_OPENABLE);
                intent.setType("image/*");
                startActivityForResult(Intent.createChooser(intent, "Select Picture"), SELECT_PICTURE);
            }
        }
    });

}

public void onActivityResult(int requestCode, int resultCode, Intent data) {
    if (resultCode == RESULT_OK) {
        if (requestCode == SELECT_PICTURE) {
            Uri selectedImageUri = data.getData();
            selectedImagePath = getPath(selectedImageUri);
            Intent act2 = new Intent(this ,AndriodLauncher2.class);
            act2.setData(selectedImageUri);
            startActivity(act2);
        }
    }
}

public String getPath(Uri uri) {
    String[] projection = { MediaStore.Images.Media.DATA };
    Cursor cursor = managedQuery(uri, projection, null, null, null);
    int column_index = cursor.getColumnIndexOrThrow(MediaStore.Images.Media.DATA);
    cursor.moveToFirst();
    return cursor.getString(column_index);
}

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:
Games that mix emulated old machine code with modern languages Is there any example of game development in a "modern" multi-purpose language (C++, Python, Java, Go) that loads game binaries of an old platform (e.g. 8-bit, 16-bit or 20-bit DOS) and emulates it partially until a given condition and then mixes it with code that runs natively on the host platform?

I am looking for games or extensions of games that use a hybrid approach of emulation and native programming to build newer versions of old games.
I am also not looking for software disassembled and ported to a new system, like SDLPoP.

sentences:
Semi Fixed-timestep ported to javascript In Gaffer's "Fix Your Timestep!" article, the author explains how to free your physics' loop from the paint one.

Here is the final code, written in C:

double t = 0.0;
const double dt = 0.01;

double currentTime = hires_time_in_seconds();
double accumulator = 0.0;

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 );
}

I'm trying to implement this in JavaScript but I'm quite confused about the second while loop...

Here is what I have for now (simplified):

...
(function animLoop(){
  ...

  while (accumulator >= dt) { // While? In a requestAnimation loop? Maybe if?
    ...
  }

  ...
  // render

  requestAnimationFrame(animLoop); // stand for the 1st while loop [OK]
}())

As you can see, I'm not sure about the while loop inside the requestAnimation one...

I thought replacing it with a if but I'm not sure it will be equivalent...

Maybe some can help me.

sentences:
How do you pass arguments with UnityEvents? I was inspired by a great talk at Unite by Ryan Hipple.

https://youtu.be/raQ3iHhE_Kk?t=28m

His examples didn’t cover passing arguments with UnityEvents

Do I need to extend UnityEvent, GameEvent and GameEventListener from a generic base class for this to work properly?

If so do I need to make a new set of classes for each Type and combination of Types that I want to pass?

Game Event Scriptable Object

[CreateAssetMenu]
    public class GameEvent : ScriptableObject
    {
        /// <summary>
        /// The list of listeners that this event will notify if it is raised.
        /// </summary>
        private readonly List<GameEventListener> eventListeners =
            new List<GameEventListener>();

        public void Raise()
        {
            for(int i = eventListeners.Count -1; i >= 0; i--)
                eventListeners[i].OnEventRaised();
        }

        public void RegisterListener(GameEventListener listener)
        {
            if (!eventListeners.Contains(listener))
                eventListeners.Add(listener);
        }

        public void UnregisterListener(GameEventListener listener)
        {
            if (eventListeners.Contains(listener))
                eventListeners.Remove(listener);
        }
    }

Listener Class

public class GameEventListener : MonoBehaviour
    {
        [Tooltip("Event to register with.")]
        public GameEvent Event;

        [Tooltip("Response to invoke when Event is raised.")]
        public UnityEvent Response;

        private void OnEnable()
        {
            Event.RegisterListener(this);
        }

        private void OnDisable()
        {
            Event.UnregisterListener(this);
        }

        public void OnEventRaised()
        {
            Response.Invoke();
        }
    }

sentences:
Loading texture from Resources folder not working C# So I want to load different textures for my game object when different conditions are met. There are no errors when I compile this code. The colours change according to the condition, that part does work. The textures do not load though. The textures are stores in a Resources folder in Unity. The first code works but the second does not. Why is this the case?
Below is my code:

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

public class Level4 : MonoBehaviour
{

    Material _mat;
    GameObject Sphere;

    // Use this for initialization
    void Start()
    {
        Sphere = GameObject.FindWithTag("Player");
        //Material _mat = GameObject.FindWithTag("Player").GetComponent<Renderer>().material;

    }

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

            if (Input.GetKeyDown(KeyCode.UpArrow))
            {
                Renderer _rend = GetComponent<Renderer>();
                Material _mat = _rend.material;
                _rend.material.mainTexture = Resources.Load("face1") as Texture;
                _mat.color = Color.red;
            }
        }
        catch (System.Exception)
        {
        }
    }
}

this is the second code that does not work:

    using System.Collections;
using System.Collections.Generic;
using UnityEngine;
using System.IO.Ports;
public class arduino : MonoBehaviour
{

    SerialPort sp = new SerialPort("//.////COM6", 9600);// Com port and the baud rate of the arduino
    Material m_Material;
    GameObject Sphere;

    void Awake()
    {
        Sphere = GameObject.FindWithTag("Player");
        m_Material = GameObject.FindWithTag("Player").GetComponent<Renderer>().material;
    }
    void Start()
    {
        if (!sp.IsOpen)
        { // If the erial port is not open
            sp.Open(); // Open
        }
        sp.ReadTimeout = 250; // Timeout for reading
    }

    // Update is called once per frame
    void Update()
    {
        if (sp.IsOpen)
        { // Check to see if the serial port is open
            try
            {

                string portreading = sp.ReadLine(); // get the string output of the serial port
                float amount = int.Parse(portreading);

               if ((amount > 251f))
                {

                    Renderer _rend = GetComponent<Renderer>();
                    m_Material = _rend.material;
                    _rend.material.mainTexture = Resources.Load("face1") as Texture;
                    m_Material.color = Color.red;

                }
            }
            catch (System.Exception)
            {

            }

        }

    }
}

sentences:
Quick algorithm to identify undrawn rectangles inside a map I already have a working algorithm for this but it's home-made and there is some redundancy in the things it checks, so I'm looking for a fast algorithm (or the name of it) that would detect undrawn portions of a 2d map (a picture or a grid), returning those portions as a list of Rectangles which borders are parallel to the axis (x, y, width, height). The map is not very big, like 200x200.

Edit: Rectangles to detect have to be parallel to the axis x and y

For instance ran on this map and looking for space character " " and for 2x3 rectangles :

*C***DDD****
*01F  *E*  *
***   ***  *
**    *    *
*A****  ****
************

It would detect the portions marked with "X":

*C***DDD****
*01FXX*E*XX*
*** XX***XX*
**  XX*  XX*
*A****  ****
************

Has anyone heard of one algorithm like this, but fast? Right now what I'm doing is that I'm scanning through each cell and checking if the w*h Rect at current position is filled with the search value. However you can see there is a lot of redundancy there.

I wonder if some bitmap compression algorithm like PNG don't use that kind of detection, so as to compress repetitions of tiles/uniform areas. If that's the case that should be very fast algorithm they use because speed is an issue for them.

The detection doesn't have to be exact (it's ok if some areas are not detected, but most need to be). So mostly it needs to be very fast.

sentences:
my iPhone app skips the splash screen! I have developed an iPhone app. When I have installed it in the device, it worked fine, ie it showed, the logo screen, the title screen and goes to game screen and now I have exited pressing the home button. The problems starts when I relaunch the app, it straightly goes to the game screen, by skipping the splash screens.

While I was working on it the app crashed and when I launched again it showed the logo screen and title screen. But when I relaunched it, the splash screens where skipped.

Could you tell me the possible errors that might have occurred?

sentences:
Unity3D CrossPlatformInput StandardAsset Multitouch I have a small game I am working on, and I am trying to add touch support to it.  Before I try to add that into the real game I wanted to do a test run on a small project.  The project consists of a capsule to be the player, and the application accepts movement from a on screen joystick, and accepts a button click from a UI button.  The button triggers the attack, and the joystick triggers the movement.

Both of these controls work as designed but they will not work together, meaning I can do one or the other.  I was hoping to use the standard asset as to not re-invent the wheel for speed...

below is the code that "Should" be triggering when both controls are used, just as a note this same code works when I use mouse and keyboard together so this is something to do with the mobile stuff..

using UnityEngine;
using System.Collections;
using UnityStandardAssets.CrossPlatformInput;

public class PlayerController : MonoBehaviour
{
    public float playerSpeed = 10f;
    Transform weapon;

    // Use this for initialization
    void Start ()
    {
        weapon = transform.FindChild("Weapon");
    }

    // Update is called once per frame
    void Update ()
    {
        DirectionalMovements();
        ButtonPresses();
    }

    void ButtonPresses()
    {
        if (CrossPlatformInputManager.GetButtonDown("Fire1"))
        {
            weapon.GetComponent<Sword>().AttackOne();
        }
    }

    void DirectionalMovements()
    {
        float moveVertical = CrossPlatformInputManager.GetAxis("Vertical") * playerSpeed * Time.deltaTime;
        float moveHorizontal = CrossPlatformInputManager.GetAxis("Horizontal") * playerSpeed * Time.deltaTime;

        Vector3 movement = new Vector3(moveHorizontal, 0.0f, moveVertical);
        transform.Translate(movement, Space.World);

        if (movement != Vector3.zero)
        {
            transform.rotation = Quaternion.Slerp(transform.rotation, Quaternion.LookRotation(movement.normalized), playerSpeed);
        }
    }
}

Any thoughts would be greatly appreciated.. I just do not see why both controls are not picked up here.

sentences: Callback a function when a label is touched in cocos2d-x? How do I callback a function when label is touched in cocos2d-x?

sentences:
How to pause audio playback when a breakpoint is hit or resume afterward? When my code hits a breakpoint, audio that was previously started (via an AudioSource) continues to play while the threads are paused.
I'm using a coroutine to query the status of the AudioSource, and update my UI. Because the audio continues to play, then after I've spend some time stepping through code the next frame tick when Unity gets control back runs the next iteration of this coroutine, which updates the UI. I never get to see the in-between states.
Because it's a relativley short audio clip it's usually finished playing before I've finished stepping through the code.
I'm using Unity 2018.4 with VSCode and the Debugger for Unity extension, if that helps.
I'm quite lost at what to try here. Looking for issues with Unity's AudioSource and breakpoints yields a lot of varied information about audio issues in general in Unity.
I've tried using Debug.Break(). It pauses the Unity editor, which can be useful but has the following caveats:

it requires extra effort on each breakpoint that requires enabling (if the call is not there already)
it requires manual intervention to resume the editor once you've finished stepping through code
because it is code, it cannot be added after Unity is playing, e.g. to additional breakpoints that are added once debugging has started

Does Unity have a mechanism that enables this behaviour that I've just missed? If not, what's an appropriate alternative approach?

sentences:
"Running" against a steep slope on a Box2D Platformer Ive seen alot of pages talking about how to emulate a platformer on Box2D, specially about how people dont want to slide down a slope. Well, my problem is different and Im surprised I cant find posts/solutions about it.

The problem happens when I have a very steep slope and I run against it. This is what happens:

Being the square a common platformer hero fixture, since in a Box2D platformer the movement is based on applying impulses or setting the velocity, what happens when I "move" torwards such a slope, its like im pushing against it, which creates a vertical force and therefore the square moves UP (specially since friction is 0 to avoid the "sticking to a wall" thing).

I've solved most of Box2D's non-platformer-proficient issues. This one seems unsolveable.

So, how do I avoid my object to go up a steep slope when pushed against it, and instead slide down since its too steep to be climbed?

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:
Ring and Pole - Box2d How I can make a b2Body in box2d so that it could form a ring which does not collide from the center just like a ring. like when we flick the object and there's another body (like pole), the pole can go inside from the ring.

like this:

sentences:
How do I integrate bullet physics into my game? I downloaded the release file found here, but I'm just not sure where to start. In my game I have a number of oblongs and a sphere, I want all of these to collide with one another. (They all have meshes and associated bounding volumes)

edit - I just realised the cuboids actually have AABB's associated with them. I guess I'll have to change that at least.

What are the steps I need to follow?

sentences:
Why aren't the Physics2D.Raycasts reliably colliding with the 2D Box Collider walls? I've got this NPC walking around and I'm trying to create a cone to represent their line of sight, including how it would be blocked by buildings, similar to how Nicky Case has implemented it as described here: https://ncase.me/sight-and-light/

My main problem with this, right now, is that it seems like I'm not detecting collisions between my 2D box colliders and Physics2D.Raycast when I would expect to much of the time. The green rays in the image below are NOT colliding (this is fine on the corners, I don't really care, but when the rays are going straight through walls, that's a big problem for me). Red rays are colliding.

Why aren't the Physics2D.Raycasts reliably colliding with the 2D Box Collider walls?

I believe everything is in the same z-plane and has the correct collision matrix in place.

![
]image of my NPC and raycasts from them at various points along their path

    List<UnityEngine.Vector2> endPoints = new List<UnityEngine.Vector2>();
    GameObject[] corners = GameObject.FindGameObjectsWithTag("verticies");
    //corners MUST BE WORLD-ORIENTED!

    for(int i = 0; i < corners.Length; i++) {
        UnityEngine.Vector2 corner = new UnityEngine.Vector2(corners[i].transform.position.x, corners[i].transform.position.y);
        RaycastHit2D endPoint = Physics2D.Raycast(this.transform.position, corner);
        if(endPoint.collider != null) {
            endPoints.Add(endPoint.point);
            Debug.DrawLine (this.transform.position, endPoint.point, Color.red);
        } else {
            Debug.DrawLine (this.transform.position, corner, Color.green);
        }
    }

sentences:
Map handling - Indoors/Outdoors and loading large maps I have two questions regarding the handling of maps.

Question 1. My map will consist of outdoor enviroments as well as dungeons, houses etc. How would I go on about connecting the outdoors with the indoors?

My simple solution to 1.
Put everything in the same map file and when you, for example, walk through a door the player will be "teleported" to the indoor location. Let's say the outdoor location of the door is at the coordinates (10,10) and the indoor enviroment of the given house is at (1000,1000) the player's coordinates will be set to (1000,1000) when he walks through the door.

Is this optimal or is there a better way of doing this?

Question 2. My map will consist of a bunch of larger cities and paths connecting these cities. Obviously the map will be pretty big and I'm not sure if I can keep the whole map in memory. How would I go on about creating an effective map management system?

My simple solution to 2.
Have the map consist of "chunks" with x*x tiles where x is the number of tiles that will fit in the screen. I would then load the chunk the placer is currently in and also the surrounding chunks but nothing else. When the player moves to a new chunk the map will load new surrounding chunks etc.

Would this be a more effective way of handling the map than loading the entire map into memory? Advantages of this way is that I don't have to keep the entire map in the memory but it will take time to dynamically load each "chunk" when it's needed thus creating loading time.

Any improvements to my rudimentary solutions is gladly appreciated.

sentences:
OpenGL [LWJGL3] - Matrix4x4 not rotating correctly I tried today to make my own matrix4f class because of that LWJGL 3 does not include a class for it. So I arrived at rotation and it does not seem to work. I tried using the old util from LWJGL 2 and then it worked fine. Here's a screenshot of how it looks like.

Here's a gif animation of how it looks.
It's supposed to be a cube but as you can see it stretches when it rotates. Not only the x axis but the y and z axis to.
Here's the code:

public Matrix4f rotate(Vector3f rotation) {
    Matrix4f xRotation = new Matrix4f();
    xRotation.setIdentity();

    float x = rotation.x;
    float y = rotation.y;
    float z = rotation.z;

    xRotation.m11 = (float) cos(x);
    xRotation.m21 = (float) -sin(x);

    xRotation.m12 = (float) sin(x);
    xRotation.m22 = (float) cos(x);

    Matrix4f yRotation = new Matrix4f();
    yRotation.setIdentity();

    yRotation.m00 = (float) cos(y);
    yRotation.m20 = (float) sin(y);

    yRotation.m02 = (float) -sin(y);
    yRotation.m22 = (float) cos(y);

    Matrix4f zRotation = new Matrix4f();
    zRotation.setIdentity();

    zRotation.m00 = (float) cos(z);
    zRotation.m10 = (float) -sin(z);

    zRotation.m01 = (float) -sin(z);
    zRotation.m11 = (float) cos(z);

    return multilpy(xRotation).multilpy(yRotation).multilpy(zRotation);
}

Can someone point the problem because I cannot find it.

Edit:
The multiplication and the projection code:

public Matrix4f multilpy(Matrix4f matrix) {
    // Row 0
    m00 = m00 * matrix.m00 + m10 * matrix.m01 + m20 * matrix.m02 + m30 * matrix.m03;
    m10 = m00 * matrix.m10 + m10 * matrix.m11 + m20 * matrix.m12 + m30 * matrix.m13;
    m20 = m00 * matrix.m20 + m10 * matrix.m21 + m20 * matrix.m22 + m30 * matrix.m23;
    m30 = m00 * matrix.m30 + m10 * matrix.m31 + m20 * matrix.m32 + m30 * matrix.m33;

    // Row 1
    m01 = m01 * matrix.m00 + m11 * matrix.m01 + m21 * matrix.m02 + m31 * matrix.m03;
    m11 = m01 * matrix.m10 + m11 * matrix.m11 + m21 * matrix.m12 + m31 * matrix.m13;
    m21 = m01 * matrix.m20 + m11 * matrix.m21 + m21 * matrix.m22 + m31 * matrix.m23;
    m31 = m01 * matrix.m30 + m11 * matrix.m31 + m21 * matrix.m32 + m31 * matrix.m33;

    // Row 2
    m02 = m02 * matrix.m00 + m12 * matrix.m01 + m22 * matrix.m02 + m32 * matrix.m03;
    m12 = m02 * matrix.m10 + m12 * matrix.m11 + m22 * matrix.m12 + m32 * matrix.m13;
    m22 = m02 * matrix.m20 + m12 * matrix.m21 + m22 * matrix.m22 + m32 * matrix.m23;
    m32 = m02 * matrix.m30 + m12 * matrix.m31 + m22 * matrix.m32 + m32 * matrix.m33;

    // Row 3
    m03 = m03 * matrix.m00 + m13 * matrix.m01 + m23 * matrix.m02 + m33 * matrix.m03;
    m13 = m03 * matrix.m10 + m13 * matrix.m11 + m23 * matrix.m12 + m33 * matrix.m13;
    m23 = m03 * matrix.m20 + m13 * matrix.m21 + m23 * matrix.m22 + m33 * matrix.m23;
    m33 = m03 * matrix.m30 + m13 * matrix.m31 + m23 * matrix.m32 + m33 *    matrix.m33;

    return this;
}

public static Matrix4f perspective(int width, int height, int fov, float zFar, float zNear) {
    Matrix4f matrix = new Matrix4f();

    float aspectRatio = (float) width / (float) height;
    float fovY = (float) ((1f / tan(Math.toRadians(fov / 2f))) * aspectRatio);
    float fovX = fovY / aspectRatio;
    float frustum_length = zFar - zNear;

    matrix.m00 = fovX;
    matrix.m11 = fovY;
    matrix.m22 = -((zFar + zNear) / frustum_length);
    matrix.m23 = -1;
    matrix.m32 = -((2 * zNear * zFar) / frustum_length);
    matrix.m33 = 0;

    return matrix;
}

Vertex Shader:

#version 400 core

in vec3 position;
in vec2 textureCoord;

out vec2 textureCoords;

uniform mat4 tranformation;
uniform mat4 projection;

void main(void) {

    gl_Position =  projection * tranformation * vec4(position,1.0);

    textureCoords = textureCoord;
}

Fragment Shader:

#version 400 core

in vec2 textureCoords;

out vec4 out_Color;

uniform sampler2D sampler;

void main(void) {
    vec4 color = texture(sampler, textureCoords);

    //if(color.a < 0.5) discard;

    out_Color = texture(sampler, textureCoords);
}

sentences:
Disable system sounds in Unity? I've got an editor script in Unity 5 that uses the cursor position in the scene view to change objects in the scene when you press the space key. This all works perfectly, except that Unity thinks that space isn't a valid key to press, so it makes the system "boop" sound to let you know that it's invalid or that nothing happened.

So, focus is on scene view, I press space, my script triggers, and the mac system "boop" sound activates. It spams the sound if you hold it down. Is there a way to:

Disable the system boops in Unity

or

Add space to registered hotkeys / stop unity from triggering the system sound for a specific key

(just to be clear, the script works, I'm just wondering about disabling the sound)

sentences:
Modify texture of sepcific area of Terrain in unity I am developing a farming simulator 3D game in unity. I have a crop field on terrain which is actually a texture paint in square to show a crop area, and i have to perform sowing (prepare field for seeding) in which process as tractor pass on that texture part its texture from plain soil which i had applied on it should change to more darker and rough texture. I have a idea to get that specific texture part from terrain data but i do not understand how to modify that specific area's texture at run time (through code). Any help would be helpful.
Thanks in advance.

sentences:
How to make the camera follow the mouse in first or third person camera I currently I have a game made of a few small scripts, the PlayerController, PlayerStats, and CameraChange (each below).

My question is how do I get the camera to follow the mouse movement? I want the player to be able to switch between each camera and look around with the mouse.

Any idea as to how I'd go about doing this? My current theory is I would some how have to access the current active camera and make it follow the mouse but not sure how to do that.

PlayerController-

using UnityEngine;

public class PlayerContorller : MonoBehaviour

{

    // Update is called once per frame
    void Update ()
    {
        var x = Input.GetAxis("Horizontal") * Time.deltaTime * 150.0f;

        var z = Input.GetAxis("Vertical") * Time.deltaTime * 3.0f;

            transform.Rotate(0, x, 0);
        transform.Translate(0, 0, z);
    }
}

PlayerStats-

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

public class PlayerStats : MonoBehaviour {

    public int Health = 100;
    public int Stamina = 100;
    public int magic = 100;

    // Use this for initialization
    void Start () {

    }

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

        }
    }
}

CameraChange-

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

public class CameraChange : MonoBehaviour {

    public GameObject ThirdCam;
    public GameObject FirstCam;
    public int CamMode;

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

        if (Input.GetButtonDown("Camera"))
        {
            if (CamMode == 1)
            {
                CamMode = 0;
            }
            else
            {
                CamMode += 1;
            }
            StartCoroutine(CamChange());
        }
    }
    IEnumerator CamChange()
    {
        yield return new WaitForSeconds(0.01f);
        if(CamMode == 0)
        {
            ThirdCam.SetActive(true);
            FirstCam.SetActive(false);
        }
        if(CamMode == 1)
        {
            FirstCam.SetActive(true);
            ThirdCam.SetActive(false);
        }
    }
}

sentences:
What is the story of game programmers beside gaming history? Nowadays, game programming is like a big business-ish, technological, academical, programming havoc. There are dozen of engines, free or not, don't-reinvent-the-wheel dos and don't, plenty of different platform, plenty of game genres, and a lot of languages.

The video game economy boomed around the 90's (I guess, with the NES etc), and just before that, I wonder how game programmers were doing their job, what languages they used, what was the equivalent of the current "dev kit", anyways what were those few guys technics and tools to achieve a working game on such tiny computer power ?

I read that the playstation had only 3MB memory total: besides CD-swapping, how could they achieve to build an executable to hold on 2mb or ram, for complex games like Metal Gear Solid or Vagrant Story ?

Since I'm young and I missed all that, I have some questions...

Were game makers only or most programmers ? Why do I think a game programmer who has played a lot, has a more important role that game designers, 3D artists, because they know how a game is really made ?
Since C was invented in the 70, did all programmers use it, or were they forced to use ASM to get the best optimisation ?
Is being a game programmer a safe job (I mean in the job market) ?
Since computers are so freaking fast today, how has the optimisation task changed ? Do we use computer/console power to their maximum, or do we waste it because we can't come up with complex enough gameplay ?

sentences:
Implementing reference counting from scratch or using shared_ptr for resource? In an OpenGL application that I am writing, I want to have a simple shader class to wrap the OpenGL shader handle. Ultimately, I want this shader class to behave very similarly to a shared_ptr in c++ (that is, keep a reference count and free the resource when no references are left). While it is relatively trivial to implement this reference counting from scratch, I was wondering if it is considered a better design choice to instead use std::shared_ptr with a custom deleter to free up the resource.

The main source of my doubt is the fact that it might be considered unconventional due to the fact that (as far as I know), creating an OpenGL shader program handle does not actually involve heap memory (which is what shared_ptr takes care of) but I still feel that it could apply here because I want this resource to be handled very similarly to how heap memory would be handled. The purpose of this question is basically to seek the opinion of others as to whether this actually is unconventional, because I do not know.

Also, although I used shaders as an example, the same question also applies to textures and buffers in OpenGL as they also must be allocated and freed.

sentences: How to handle pixel-perfect collision detection with rotation? Does anyone have any ideas how to go about achieving rotational pixel-perfect collision detection with Bitmaps in Android? Or in general for that matter? I have pixel arrays currently but I don't know how to manipulate them based on an arbitrary number of degrees.

sentences:
How to handle animations? I am coding a simple 2D engine to be used with HTML5. I already have classes such as Picture, Scene, Camera and Renderer, but now I need to work on Animations.

Picture is basocally a wrapper for a normal image object, with it's own draw method, but this is unrelated, I'm interested in how animation in 2D games is usually done.

What I planned to do, is to have the Animation class as well act like a wrapper for a few image objects, and then have methods such as getCurrentImage, next and animate (which would use intervals to quickly change the current image). I meant to feed the animation a couple of PNG's at inicialisation.

Is quickly swapping PNG images acceptable for 2D animation? Are there some standard ways of doing this, or are there flaws in my ways?

sentences:
Mechanim "Hand Closing / Opening" Animation control with trigger I wish to control any given Animator state "Playhead", with a variable - rather than have it play automatically with time. This is for an animation of a hand making a "clench gesture" which will be bound to an analog controller trigger output value.

I have considered the following:

Inside: StateMachineBehaviour.OnStateUpdate method (State machine behavior script attached to a state in the Mechanim graph)

Call Animator.Play or Animator.CrossFade to play a given clip from a given time with speed set to 0. This should get called every update while in the state.

The issue with this is that the whole state will stop, then start again which means OnStateEnter and OnStateExit continually fire, rather than just the OnStateUpdate method to control the "Playhead".
Animator.ForceStateNormalizedTime(time)

This would be fine but it has been depreciated.
Use timers and the Animator speed variable to calculate when to toggle playing a clip at a certain speed such to match the displacement of the trigger. Seems the wrong way to go about it.
Use the legacy animation system

This works fine but you don't get the perks of Mechanim FSM eg. blend trees.

Since Unity seem to have removed the ability to manipulate the time of a running clip or Mechanim state, it makes me think it's something I shouldn't be doing. Am I going about this the wrong way? Why does it seem difficult to play an animation via something other than the time domain?

sentences: Which should be faster: 10 flat shaded polygons or 2 with a transparent texture I have particle system, and I want to the individual particles to take the shape of a star.  Which should be faster: Drawing the 10 polygons using a flat shader, or 2 polygons (a square) with a partially transparent texture?

sentences:
Why does the Debug.DrawRay return these weird lines I am working on a small feature of a 2D mobile game where a indicator points towards a object in 2D space. I am trying to make the indicator turn towards the object, however the vector I am trying to construct that points towards the object is off a bit.

When I decided to draw a debug ray from the indicator position to the objects position it was also off a bit. I then decided to draw the debug ray the other way around which gave me a different line. If my understanding is correct, if you switch the starting point and the end point of a ray the line should stay exactly the same right?

using UnityEngine;
using System.Collections.Generic;

public class Tracker : MonoBehaviour {

public GameObject goToTrack;
private List<Renderer> renderers = new List<Renderer>();

void Start(){
    foreach (Transform child in transform) {
        renderers.Add (child.gameObject.GetComponent<Renderer>());
    }
}

void Update () {

}

void OnGUI(){
    Vector3 v3Screen = Camera.main.WorldToViewportPoint(goToTrack.transform.position);

    // if the target is within the viewable screen the indicator shouldn't be rendered)
    if (v3Screen.x > -0.01f && v3Screen.x < 1.01f && v3Screen.y > -0.01f && v3Screen.y < 1.01f) {
        foreach (Renderer renderableObject in renderers) {
            //renderableObject.enabled = false;
        }
    }
    else
    {
        foreach (Renderer renderableObject in renderers) {
            //renderableObject.enabled = false;
        }

        v3Screen.x = Mathf.Clamp (v3Screen.x, 0.01f, 0.99f) -0.04f;
        v3Screen.y = Mathf.Clamp (v3Screen.y, 0.01f, 0.99f) -0.04f;
        transform.position = Camera.main.ViewportToWorldPoint (v3Screen);

        Debug.Log ("Target planet position: " + goToTrack.transform.position.ToString());
        Debug.DrawRay(Camera.main.ViewportToWorldPoint (v3Screen), goToTrack.transform.position, Color.red, 5.0f);
        Debug.DrawRay(goToTrack.transform.position, Camera.main.ViewportToWorldPoint (v3Screen), Color.green, 5.0f);

        //Debug.Log ("Tracker angle: " + angle);
        //transform.Rotate(0,0, angle, Space.Self);
    }

}
}

Output:

UPDATE:
I have noticed that when i substract the second vector with the first vector of the Debug.DrawRay it draws the ray like i want it to.

From this I am taking that the Debug.DrawRay function draws the second vector on top of the first vector. (kind of like the the first vector is Vector(0,0,0) and the second vector is the actual ray you want to draw)

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:
Keep track of VoxelData/NPC in parallel Level Background

I'm tring to make a First-Person-Shooter Game in a Voxel-World (Finit Size) with Unity3d.

The Player has some kind of a Base that he has to protect against Enemy units. There are also one or more enemy Bases that the Player has to destroy, but in a different Level/Map.

The Game has multiple Levels that are connected through predefined Ports. So the Player and other Units can travel from Level to Level. There are a couple of Levels to explore. (Maybe there could be infinit Levels in the future.)

At game start I create a LevelManager and all Levels as Children of them. They can spawn an manage the Units and Voxel-Blocks independently. One ChunkManager renders always the current Level where the Player is in. He creates multiple Chunks which itself generate the Mesh from the current Voxel-Data of the Level. This works all very well and I'm also able to travel between the Levels. (This runs all in one Scene.)

At the moment I try to implement some kind of a Worm unit. They spawn from time to time anywhere in each level and can move randomly around and modify the Voxel-World by eating the Blocks away... type of random enviroment event.

Problem

The problem I can't solve is how to simulate all the Worms in parallel Levels? And the Blocks they have eaten? Same problem would occur for the enemy bases if they grow and build new defences and so on.
Because when the Player enter a Level there should be some differences since his last visit.

My attempt

All my Units and Buildings have already separated logic and rendering components. So they can work properly even when not rendered by the ChunkManager. Its working for maybe 3 Levels and a handfull of worms but if I increase the amount of Levels it gets starting to go laggy (4-10FPS). So this would not be the right way to go or is it and my code is crap?

Has someone any suggestions for me how I can solve this?

Edit

I disable now all none active Levels and reactivate always the current Level where the Player is in. So I can better manage the objects that realy need computation time.

The problem I get now is how can I simulate the progress in a Level since start? Example for the worm unit. He would have moved across the Level and left a path of removed voxels. Should I made a seperate method to calculate the path that would be made or the last X minutes or should I just call the Update method multipletimes to match the missed calls since last X minutes? This should then be made by all Objects that can modify the Level or produce something.

sentences:
Libgdx: different speed on different devices I am running a simple Libgdx app that I have wrote, on my Android phone and Android tablet and I am getting the unexpected result of having different velocities when a body is moved. To move the body I am using a "drag" movement in this way (snippet):

private Body ballBody;
private int ballX1, ballY1;

@Override
public boolean touchDown(int screenX, int screenY, int pointer, int button) {
    ballX1 = screenX;
    ballY1 = screenY;
    return true;
}

@Override
public boolean touchUp(int screenX, int screenY, int pointer, int button) {
    Vector2 v2 = new Vector2(ballX1 - screenX, screenY - ballY1);
    v2.scl(0.25f);
    ballBody.setLinearVelocity(v2);
    return true;
}

@Override
public boolean touchDragged(int screenX, int screenY, int pointer) {
    return false;
}

Render part with some of my attempts to fix delta-time and FPS:

private static final int SCREEN_HEIGHT = 16; //320;
private static final int SCREEN_WIDTH = 24; //480;
private static final int BOX_VELOCITY_ITERATIONS = 6;
private static final int BOX_POSITION_ITERATIONS = 2;
private static final float BALL_RADIUS = 0.1f;
private static final float MAX_FPS = 1 / 60f;
private static final float PIXELS_TO_METERS = 20f;
private static final long ONE_SECOND_NS = 1000000000;

private int maxUpdates = 10;
private long lastTime = System.nanoTime();
private World world = new World(new Vector2(0, -9.8f), true);

@Override
public void render() {
    ballIsNotMoving = ballIsNotMoving();
    if (ballIsNotMoving && ballBody.getPosition().x > landscape2d[20] && ballBody.getPosition().x < landscape2d[28]) {
        newHole();
    } else if (ballBody.getPosition().x > SCREEN_WIDTH + ball.getWidth() / 2 || ballBody.getPosition().x < - ball.getWidth() / 2) {
        resetBallPosition();
    }

    camera.update();
    Gdx.gl.glClear(GL20.GL_COLOR_BUFFER_BIT);
    Gdx.gl.glClearColor(34/255f, 167/255f, 240/255f, 0);

    fixTimeStep();

    world.step(MAX_FPS, BOX_VELOCITY_ITERATIONS, BOX_POSITION_ITERATIONS);

    shapeRenderer.setProjectionMatrix(camera.combined);

    // Set the sprite's position from the updated physics body location
    ball.setPosition(
            ballBody.getPosition().x - ball.getWidth() / 2,
            ballBody.getPosition().y - ball.getHeight() / 2);

    polySpriteBatch.setProjectionMatrix(camera.combined);
    polySpriteBatch.begin();
    pitch.draw(polySpriteBatch);
    polySpriteBatch.end();

    createStartArea(shapeRenderer);

    fixFPS();

//        debugRenderer.render(world, camera.combined);
}

private boolean ballIsNotMoving() {
    float speedNow = ballBody.getLinearVelocity().len();
    recentSpeed = 0.1f * speedNow + 0.9f * recentSpeed;
    if (recentSpeed < 0.20f) {
        stopBallMovement();
        return true;
    }
    return false;
}

private void fixTimeStep() {
    long time = System.nanoTime();
    long timeDelta = time - lastTime;
    float timeDeltaSeconds = timeDelta / (float) ONE_SECOND_NS;
    lastTime = time;

    // Update the game state in capped time steps (in case we're running too slow)
    int updateCount = 0;
    while (timeDelta > 0 && (maxUpdates <= 0 || updateCount < maxUpdates)) {
        // Update using a time step in seconds
        float updateTimeStep = Math.min(timeDeltaSeconds, ONE_SECOND_NS * MAX_FPS);
        float updateTimeStepSeconds = updateTimeStep / (float) ONE_SECOND_NS;

        world.step(updateTimeStepSeconds, BOX_VELOCITY_ITERATIONS, BOX_POSITION_ITERATIONS);

        timeDelta -= updateTimeStep;
        updateCount++;
    }
}

private void fixFPS() {
    long sleepTime = Math.round((ONE_SECOND_NS / MAX_FPS) - (System.nanoTime() - lastTime));
    if (sleepTime <= 0)
        return;
    long prevTime = System.nanoTime();
    while (System.nanoTime() - prevTime <= sleepTime) {
        try {
            Thread.sleep(1);
        } catch (InterruptedException e) {
            e.printStackTrace();
        }
    }
}

The app start with the same resolution for both devices. Any idea about how to get the same speed?

sentences:
Will using similar/exact name to a current Marvel superhero name for your game be a problem? I have heard that the word 'superhero' is trademarked by marvel and DC and thus we can't use superhero as part of the name of a game we develop. But I wonder do they also have exclusibe rights to all the names of their super hero characters?

For example will people get in trouble if they name their games 'premagneto', 'superwolverine', 'exbeyonder' or 'the cyclop'?

sentences:
Camera rotation around point, but without centering Let's say i have the following:

Point somewhere in space
Camera with position and orientation (up, right, forward)

I want to rotate camera around the point, but also keep this point in same place on screen. So, if point was on (32, 32) on window, after rotation i want it to still be on (32, 32).

I've seen How can I orbit a camera about it's target point? , and it was somewhat helpful. I needed code to rotate point around arbitrary axis (camera's up and right), so i used this resource.

Problem is, i got something like numerical errors and my camera started to wander weirdly when rotating around camera's both up and right (it seems fine when i rotate only around one of them).

I tested my implementation with code:

Matrix m1=MatrixRotate(Vector(-1, -1, 1),  33);
Matrix m2=MatrixRotate(Vector(-1, -1, 1), -33);
Vector a=Vector(-1, -1, -1);
Vector c=a;

c=m1*c;
c=m2*c;
printf("%f %f %f %f\n", c.x, c.y, c.z, c.w);

And got:

-1.028036 -0.960396 -1.124331 0.000000

It worked fine when rotation axis was something 'normal' like (1, 0, 0) or (0, 0, -1).

So, how else can i rotate camera around point, while keeping said point in same point on screen?

sentences: Unity3d: Find a point on the line which has shortest distance from the third point So, initially, I had points A and C. To get point B, I had to shoot a raycast down from point A and get the hit.point, which is point B now. Point D is somewhere between the raycast I shot from A and perpendicular to C. How do I find the point D.

sentences:
Is it still possible to install Unity? When trying to install Unity I am getting the following error:

  The download of version ... was cancelled.

I checked that there are no spaces in the path.

Also I can not Sign in.
When I provide the correct email and password the Sign in window just closes with no result.

Also I tried to report a bug using the Report Bug feature, but it seems not to work.

Also I tried to post a question on Unity Forum. But the Sign In over there does not work as well.

What else may I try? Thank you.

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: Blender to Unreal or Unity - will combining animations into one clip for a parent object to store effect workflow? Hey so I have a gun and a set of rigged hands in blender, and I was wondering if I made a parent object for the gun, hands and everything, took all the animations respectively (such as right hand reload, left hand reload, gun reload, etc) and combined them all into one animation called reload, would there be problems in the future when working in Unreal or Unity? Would I be able to apply the same animation to all the objects that are a part of the action and have them work respectively?

sentences:
Endless Running Game - Changing Lane Function in JAVA I am developing a kind of vertical endless running game, where the character has 4 possible lanes to be in. I am using libGDX and want the character to change lanes by adding a horizontal velocity to a Vector2. The position will be upgraded by velocity increments and not by simply changing the position to the next lane. So far I have a working function, but as I increment the horizontal velocity, along the run, it loses accuracy. Let's assume each lane is 50px width.

I am also using a acceleration vector to slow down as the character gets closer to the next lane.

The 2 functions below are about what happens when the screen is touched right or left.
The position verification is a boundary condition to avoid the character going off the screen.

public void onClickRight(){
    if(!(position.x>=50*2.75)&&isAlive){
        velocity.x=350+extraSlideSpeed;
        acceleration.x=-500;
    }

}

public void onClickLeft(){
    if(!(position.x<=50*0.75)&&isAlive){
        velocity.x=-350-extraSlideSpeed;
        acceleration.x=500;
    }
}

The function below is called about 60 times per second, as delta is a very small number and represents time.

public void updateRunning(float delta){

    velocity.add(acceleration.cpy().scl(delta));
    position.add(velocity.cpy().scl(delta));
    displacement.add(velocity.cpy().scl(delta));

    if(displacement.x>=50||displacement.x<=-50){
        velocity.x = 0;
        acceleration.x = 0;
        displacement.x = 0;
    }
}

I am looking for smarter options as I am not pleased with my own. Help would be appreciated!

sentences:
How to implement an experience system? I'm currently writing a small game that is based on earning experience when killing enemies. As usual, each level requires more experience gain than the level before, and on higher levels, killing enemies awards more experience.

But I have a problem balancing this system. Are there any prebuilt algorithms that help to calculate how the experience curve required for each level should look like? And how much experience an average enemy on a specific level should provide?

sentences:
Grid pathfinding with a lot of entities I'd like to explain this problem with a screenshot from a released game, DROD: Gunthro's Epic Blunder, by Caravel Games.

The game is turn-based and tile-based.

I'm trying to create something very similar (a clone of the game), and I've got most of the fundamentals done, but I'm having trouble implementing pathfinding.

Look at the screenshot. The guys in yellow are friendly, and want to kill the roaches.
Every turn, every guy in yellow pathfinds to the closest roach, and every roach pathfinds to the closest guy in yellow.

By closest I mean the target with the shortest path, not a simple distance calculation.

All of this without any kind of slowdown when loading the level or when passing turns.
And all of the entities change position every turn. Also (not shown in screenshot), there can be doors that open and close and change the level's layout.

Impressive.

I've tried implementing pathfinding in my clone.

First attempt was making every roach find a path to a yellow guy every turn, using a breadth-first search algorithm. Obviously incredibly slow with more than a single roach, and would get exponentially slower with more than a single yellow guy.

Second attempt was mas making every yellow guy generate a pathmap (still breadth-first search) every time he moved. Worked perfectly with multiple roaches and a single yellow guy, but adding more yellow guys made the game slow and unplayable.

Last attempt was implementing JPS (jump point search). Every entity would individually calculate a path to its target. Fast, but with a limited number of entities. Having less than half the entities in the screenshot would make the game slow. And also, I had to get the "closest" enemy by calculating distance, not shortest path.

I've asked on the DROD forums how they did it, and a user replied that it was breadth-first search. The game is open source, and I took a look at the source code, but it's C++ (I'm using C#) and I found it confusing.

I don't know how to do it. Every approach I tried isn't good enough. And I believe that DROD generates global pathmaps, somehow, but I can't understand how every entity find the best individual path to other entities that move every turn.

What's the trick?

This is a reply I just got on the DROD forums:

  Without having looked at the code I'd wager it's two (or so) pathmaps
  for the whole room:

  One to the nearest enemy, and one to the nearest friendly for every
  tile.

  There's no need to make a separate pathmap for every entity when the
  overall goal is "move towards nearest enemy/friendly"... just mark
  every tile with the number of moves it takes to the nearest target and
  have the entity chose the move that takes it to the tile with the
  lowest number.

To be honest, I don't understand it that well.

sentences:
The view matrix finally explained I must say that I am really confused by how a view matrix is constructed and works.

First, there are 3 terms: view matrix, lookat matrix, and camera transformation matrix. Are those 3 the same, or different things. From what I undestand, the camera transformation matrix is basically the model matrix of the camera, and the view matrix is the inverse of that. The lookat matrix is basically for going from world space to view space, and I think I undestand how it works (doing dot products for projecting a point into another coordinate system).

I am also confused by the fact that sometimes, it seems like the view matrix is built by translation and dot products, and some other times, it is built with translation and rotation (with cos and sin).

There are also quaternions. When you convert a quaternion to a matrix, what kind of matrix is this?

Can someone explain to me how it really works, or point me towards a good resource.

Thank you.

sentences:
How to avoid minecraft-like map to blend I am making a minecraft-like world, with some differences. For instance, the camera will be facing always in the same direction.

I am having trouble with the visuals. Here is an example:

As you can see, when looking at a "step", as long as you can see the wall between the 2 levels, kinda like looking from it upwards, it is easy to identify. But when the wall disappear, kinda like when you are looking at it downwards, the step seems to blend, to a point where it is hard to tell where the step begins.

I thought of adding outlines, but due to the heavy palette of tiles that I am going to have, it would require to re-think a lot the logic to choose the correct tile, and I was hoping to find an easier solution.

What could I do to solve this problem?

sentences:
unity2D swipe control's bool for animator doesn't work i was trying to make a control where the animation plays upon swiping one direction. each time i've make a tap/swipe control, it just keeps popping messages like this. the tap animation works fine, but the animation for swipe controls just doesn't work well, the bool for them has assigned but did not make it 'true' when i swipe a direction, but the bool for the tap works, which is weird.(ignore the miss bool in the animator)

it says that i need to assign the anim variable of the Swipe script in the inspector. but there is nothing left for me to assign, which doesn't make much sense for me. (refer to Region: Animation)

i've tried to make some adjustment with the script, but the results is the same, and it has no problems when build. which is why i need help for the animation stuff.

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

public class Swipe : MonoBehaviour {

public Animator anim;
public bool tap, swipeUp, swipeDown, swipeLeft, swipeRight;
public bool isDragging = false;
public Vector2 startTouch, swipeDelta;

private void Update()
{
    tap = swipeUp = swipeDown = swipeLeft = swipeRight = false;

    #region Standalone Input
    if (Input.GetMouseButtonDown(0))
    {
        tap = true;
        isDragging = true;
        startTouch = Input.mousePosition;
        //Debug.Log("Tapped");
    }
    else if (Input.GetMouseButtonUp(0))
    {
        isDragging = false;
        Reset();
    }

    #endregion

    #region Mobile Inputs
    if (Input.touches.Length >= 1)
    {
        if (Input.touches[0].phase == TouchPhase.Began)
        {
            // tap = true;
            isDragging = true;
            startTouch = Input.touches[0].position;
        }
        else if (Input.touches[0].phase == TouchPhase.Ended || Input.touches[0].phase == TouchPhase.Canceled)
        {
            isDragging = false;
            Reset();
        }
    }

    #endregion

    #region Animation
    if (Tap)
    {
        anim.SetBool("Tap", true);
    }

    if (SwipeDown)
    {
        anim.SetBool("Down", true);
    }

    if (SwipeUp)
    {
        anim.SetBool("Up", true);
    }

    if (SwipeLeft)
    {
        anim.SetBool("Left", true);
    }

    if (SwipeRight)
    {
        anim.SetBool("Right", true);
    }

    #endregion

    //calculating the distance
    swipeDelta = Vector2.zero;
    if(startTouch != Vector2.zero)
    {
        if (isDragging)
        {
            if (Input.touches.Length > 0)
                swipeDelta = Input.touches[0].position - startTouch;
            else if (Input.GetMouseButton(0))
                swipeDelta = (Vector2)Input.mousePosition - startTouch;
        }

    }

    //did we cross the deadzone?
    if (swipeDelta.magnitude > 125)
    {
        //which direction?
        float x = swipeDelta.x;
        float y = swipeDelta.y;
        if (Mathf.Abs(x) > Mathf.Abs(y))
        {
            //left or right
            if (x < 0)
                swipeLeft = true;
            else
                swipeRight = true;
        }
        else
        {
            // Up or down?
            if (y < 0)
                swipeDown = true;
            else
                swipeUp = true;
        }
    }

}

public void Reset()
{
    startTouch = swipeDelta = Vector2.zero;
    isDragging = false;
    anim.SetBool("Tap", false);
    anim.SetBool("Down", false);
    anim.SetBool("Up", false);
    anim.SetBool("Left", false);
    anim.SetBool("Right", false);
}

public Vector2 SwipeDelta { get { return swipeDelta; } }
public bool Tap { get { return tap; } }
public bool SwipeUp { get { return swipeUp; } }
public bool SwipeDown { get { return swipeDown; } }
public bool SwipeLeft { get { return swipeLeft; } }
public bool SwipeRight { get { return swipeRight; } }

}

sentences:
How to add a scrolling camera to a 2D Java game? I am attempting to create a game where the camera follows the player, always making sure the player is in the center of the screen. How would I go about this? This game is a 2D Java game, made with no engine.

I found an opensource game demonstrating what I want but I cannot work out how to add that to my game. The game is here, if you need it.

Thanks

sentences:
GameObject in hierarchy needs to know who it belongs to I have two objects from the same prefab. They have bodies and swords. What good options do i have to check if a sword belongs to player2 or player1?

For example when body registers that it has been hit by a sword i need to see if its the sword belonging to the enemy or the same body.

sentences:
Rotate meshes with different pivots, equality If I have multiple equal meshes but with different pivots and I make a rotation on the first, is there a way to replicate this rotation to all meshes using a rotation Matrix?
For example, if I have a cube, one with it's pivot in the center and another with the pivot outside of the mesh, how can I rotate the first one 90 degrees on the X axis and use it's rotation Matrix to have the second model rotate on itself and not on his pivot?
Assuming that when I pass on the rotation matrix to other meshes I can't pass the vector of the pivot, is this possible?

sentences:
Memory is not getting freed on Destroy() Manager script(simple script attached to an empty GameObject on scene) on Start() instantiates 1000 default cubes with rigidbody component added and gravity check ticked.

public class SpawnScript: MonoBehaviour {

    public bool MakeInstances = false;
    public bool GC = false;
    public GameObject instance;
    public int numberOfInstances = 1;

    void Start() {
        if (MakeInstances)
            for (int i = 0; i < numberOfInstances; i++)
            {
                Instantiate<GameObject>(instance);
                //GameObject tempInstance = Instantiate<GameObject>(instance);
                //GameObject.Destroy(tempInstance);
                //tempInstance = null;
                //Debug.Log("obj is " + tempInstance);
            }
    }

    private void Update()
    {
        if (GC)
        {
            GC = false;
            System.GC.Collect();
            Resources.UnloadUnusedAssets();
        }
    }

Cube prefab have self destruction script like this

public class SelfDestruct : MonoBehaviour {
    public float seconds;

    IEnumerator DestructIn(float time)
    {
        yield return new WaitForSeconds(time);
        Destroy(gameObject);
    }

    void Start () {
        StartCoroutine(DestructIn(seconds));
    }
}

Profiler "simple" shows memory usage around 0.7gb after instantiating is done. I expect it to get freed after destroy, but it does not. Tried to apply GC and UnloadUnusedAssets, did not help. Tried to destroy them all right after instantiating, still no luck.
Is it a bug or am I doing something wrong?
This is definitely not a real world example, just wanted to study memory management in Unity and got stuck here.

P.S.A few more strange points I have noticied with profiler:

In Editor/"Detailed" mode it would not notice that I have 1000 cubes on
a scene, while in Build/"Detailed" it did
In "detailed"(both
editor and build) data usage is around 200mb which is definitely not
true(broken?), because Windows Task Manager shows me that build is
using around 0.9gb. Bigger than what "simple" tells me, guess some
overhead is present

EDIT:
Thanks to @Candid Moon for performing a test, he did confirm that software won't eat all the memory. Guess I should add screenshots with my observations
Here we have no instantiation, simple clean scene with a plane, eats around 100mb

Now let us go wild and make that instantiation on a startup

Alright, we did instantiate a lot of objects, they collided and flew away in outer space, in 5 seconds they were destroyed. We are back to clean scene with plane, just like the one with 100mb. Except for now it eats up 0.75gb. Left it hanging for half an hour to see if memory gets freed, nothing happened.
Is it a usual behavior? Is there any way to free all the used memory and go back to 100mb? Can/Should programmer do anything on his side to deal with such situations?

sentences:
Learning to code first game, few questions on basic game development and 3D I've been programming for a while, and I'm concurrently learning how to make a basic game and slimdx, and wanted to talk to someone to hopefully get a few pointers. I've read that Tetris is the "Hello, world" of game programming, which made sense to me, so I decided to give it a shot.

I've been able to code up a basic version in a few hours, which I'm quite happy with, but I had a few questions about 3D programming. Right now I'm using Direct3D to do display the blocks without any textures (just colored squares). I have a data structure (2d array of bytes, where each byte denotes the presence of a block and its color) which is the "game board," and on every render() call I create a new vertex buffer of the existing squares in the game board, and draw those primitives.

This feels very inefficient, and I wondering what would be the idiomatic way of doing this in a 3D world, with matrix/rotations/translation operations. I know 3D is overkill for such a project, but I want to learn any 3d concepts that I can while I'm doing it. I understand that what you'd usually want to do is keep the same vertices/vertex buffers but manipulate them with matrices to achieve rotations/translations, etc. To do so, I assume what would happen is I'd have one vertex buffer for the "active" piece, since that'll be constantly rotated and moved, and have one vertex buffer for the frozen pieces on the bottom of the board, which is pretty much stationary, but will need to be changed/recreated when the active piece becomes frozen.

Right now I'm just clearing and redrawing on every render call, which seems like the easiest way to do things, although I wonder if there's a more efficient way to deal with changes.

Obviously there are a lot of questions I'm asking here, but if you can even just point me a step or two ahead in terms of how I should be thinking, it'd be great. Thanks

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: Where can I find the sprite base grid? There's been many times where I've seen people use this tile grid. It's the one with the base pink background with deep purple bands around each section. Is this available online or will I have to make it myself?

sentences:
Unable to add button in Unity I am wanting to add a button to my scene in order to mute/unmute music.  I can add the button to my scene, but it's not appearing on the UI.  I can't see it anywhere, not on the scene nor the game when running.

Below is a screenshot of the editor.  You can see the button in front of the camera and in front of the scene itself, but it doesn't appear.  I can't actually see a button, just a 'move' control'.

Things I have tried:

Changing the 'Layer' of the button to default
Adjusting the z-axis (I've tried 0, +1-5, -1-5)
Giving the Image (Script) a material inside the Inspector

The button has text, which isn't visible either.

I could create a sprite and do a raycast, but that seems like overkill just to do a simple click action.

Any ideas?

sentences:
How can I run a shader over the entire screen without interfering with other running programs? How can I run a shader over the entire screen without interfering with other running programs? Specifically, I'd like to adjust the screen output with usability tweaks for my severely colorblind nephew. He has trouble playing certain games.
I'd like to avoid hooking into DirectX, and just run a shader over the entire screen. Is this something I can do in Windows without draining an unreasonable amount of resources?
I can use whatever language or tool is most practical for this, but I'm most comfortable with Java and HLSL.

sentences:
How to draw a string to the screen by fading in one letter at a time? I'm making a text adventure-style game with MonoGame. I have created a TextBox class which prints text onto the screen one letter at a time (like it's being typed). It does this by storing received text in a buffer string, and using Update() to periodically push letters into the output string, which is then drawn to the screen (I've written a function for wrapping, so I've had no problem there).

However, this method has some significant limitations - inability to change the font or colour of individual lines, for example - but there is something specific I am trying to achieve: I want each new letter to fade gradually onto the screen instead of just appearing instantly. So far, I've had no luck finding a way to do this.

At the moment, I've been attempting to remake the TextBox class to print each character with its own draw call, allowing me to change a letter's colour - and therefore alpha - individually. However, I've ran into a problem. I am using spriteFont.MeasureString() to allow me to draw the letters in the correct positions relative to each other, but it hasn't been giving me the values I need. Letters are drawn too close together, as it seems to be measuring the actual pixel width of the glyph, rather than the space they would take up if the string was printed all at once.

So, my question is: is there a way around this particular problem with MeasureString, or is there another solution entirely to make each letter fade in individually?

sentences:
Line of sight shader Strategy games (such as Door Kickers) use a player's unit's line-of-sight as a major game feature. To provide feedback to the player regarding which areas are in view and which are not, different colours are used to display areas that are currently visible by a unit and areas which are not.
Can anyone recommend an approach for creating this effect in a shader?

sentences:
How should I structure my Android platform board game? I'm new to developing Android games, but not new to developing mobile games (J2ME). I'm currently developing a board game, for a school project, with 2 things - a board and a spinning wheel (both are displayed at the same time). The user is able to zoom in/out and scroll around the board and spin the wheel. The wheel is also animated - resized during game. The board is build using tiles (2-4 different tiles on one image per board ) and the wheel is a image with numbers draw on it, using graphics.

My questions is what is the best practice to achive the best performance of the game (game has to run on every possible Android version)?

Should i use Android canvas or open GL?
Is there a mechanism for drawing tiles, animations or should i just implement it my self using drawImage()?
Should i separate the wheel and the board into two different threads? Should i separate the wheel and the board in to 2 activities or put it in 1 activity and draw each part separatly?
What would be the best way to resize the wheel during gameplay? Scale the wheel image (but the animation has to be smooth - opengl vs canvas)?
What would be the best way to make the board zoomable - should i scale every image on the board when the zoom is detected or does android have some better way to do this?
What would be the best way to make the board scrollable - should i implement a Camera that displays just a piece of the board or does android have some better way to do this?

sentences:
Manual GLU.gluUnproject Before I used GLU.gluUnproject to calculate my picking ray in my OpenGL game. Recently I switched to my own calculated matrices, and now I can forget the gluUnproject.

How can I calculate the picking ray with my own matrices?

My picking ray code (for the fixed pipeline):

public Ray getPickingRay() {
    FloatBuffer modelBuffer = BufferUtils.createFloatBuffer(16);
    FloatBuffer projBuffer = BufferUtils.createFloatBuffer(16);

    glGetFloat(GL_MODELVIEW_MATRIX, modelBuffer);
    glGetFloat(GL_PROJECTION_MATRIX, projBuffer);

    IntBuffer viewPort = BufferUtils.createIntBuffer(16);
    glGetInteger(GL_VIEWPORT, viewPort);

    FloatBuffer obj_pos = BufferUtils.createFloatBuffer(3);
    float middleX = (Display.getWidth() / 2)-0.01f;
    float middleY = (Display.getHeight() / 2)-0.01f;
    GLU.gluUnProject(middleX, middleY, 1.0f, modelBuffer, projBuffer, viewPort, obj_pos);

    Vector3f objPos = new Vector3f(obj_pos.get(0), obj_pos.get(1), obj_pos.get(2));

    Vector3f.sub(objPos, game.player.position, objPos);

    return new Ray(game.player.position, objPos);
}

At first I thought I just could use my own model- and projection matrix, but I have not found a way to manually calculate the GL_VIEWPORT intBuffer.

Thanks folks.

sentences:
How to pass the correct data into a continuous world I'm having a hard time implementing the player moving around my world of 2048x2048 tiles that is generated using a noise function. I'm in it for weeks, and I can not, I mess around with the coordinates, and there's always a bug. I was trying like this:

1 - I paint the map around the player (I'm using a tilemap) I paint a 64x64 area, with the player positioned in the center

2 - create a rectangle and center it in the player, the rectangle has an equivalent size of 32x32, and each frame creates another rectangle that is compared with the old one, so I take the area that has not yet been painted, so I can paint.

The problem is that when I reach the extremes of the map, when x = 0 or x = 2048 for example, I need that "x" equals 2048, and equals 0, respectively, as if the world had "turned" and I'm not sure how to deal with the world's data and the coordinates of the tilemap, because when I start by painting the map around the player, it will be in a position that would be 32.32, and the rectangle 16.16, I can not understand what I have to do it, I mess up everything with the coordinates, in this question, it helped me, I'm using the mod:

Make a 2d top down game with round map

it works, but what I am not able to do is pass the x and y correct, there are always bugs of this type, where I struggle with the numbers, but no use, if I fix the floor to one side the bug appears on the other:

here was to be water, and it has a land line for example.

I'm using Godot 3.

  Up 1:

I'm not sure, but it seems everything is going very well, what I was wrong was forgetting that, for example, a 64x64 array starts from 0 to 63, I was really dumb. The image below shows what it would look like in a 64x64 world:

As I solved it was just doing this "map_size - 1" and decreasing and adding values to the left or right, 0, +31, respectively, since the rectangle starts at position 16, 16.

but when I do this now, there is another problem when this happens:

which occurs because of the "map_size - 1", but without it it is still more messy.

  ** Up 2: **

I was able to fix the up 1 error, I was calling the wrong mod function, without adding the + x and + y, so it arrived at 33 and it is no more than the verification "map_size - 1", now it is working in the horizontal and vertical movements, however I'm still wrong to move diagonally.

or

  Up 3:

I think I got it, the problem if I was not mistaken was in the "stairs", so it works:

# LEFT-UP

# RIGHT-UP

# DOWN-LEFT

# DOWN-RIGHT

But I still have to hit the pieces of map that are behind, but I think it's in the "turn them off" function. I confess that I do not quite understand why this works, I would like to understand.

Note 1: Still the rare cases that the map generates wrong, but actually abusing the keys, quickly clicking for all meaningless directions, such as varying up and down, pressing low, a very strange movement, but the failure happens.

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:
Using real football (soccer) names from the past? Is it legal to use really old names in a manager style game?
It there an expiration on name license rights?

sentences:
Can Unity support / use textures that are not square? I have been told by another highly skilled Unity artist that Unity cannot efficiently handle non square images. Since that doesn't sound right to me, I wanted to get a second or third confirmation to that claim.

Having worked in the game development industry for almost 15 years, I have always understood that best practice was keeping in powers of two, but that if the UV map called for it, a 1024x512 map was acceptable, rather than using a 1024x1024 map with 1024x512 pixels of wasted UV space. Granted, that was best practice on game engines other than Unity.

Can anyone confirm that in Unity's case, it is better (best practice) to have a 1024x1024 image containing UV islands occupying 1024x512 pixels, rather than using a 1024x512 image map to exactly accommodate the UVs?

Which platforms can use non-square images and which ones cannot with the Unity engine? I am particularly interested in whether or not this limitation affects PC builds.

sentences:
In game engine, how to get the vertices buffers of different vertex formats for render from the mesh file properly? I'm a fresher on engine programming. I have a question of how we can get the vertices buffers of vertex formats from the mesh file.

For example, in OBJ file or FBX file, we save the positions, normals separately. So the whole mesh file is a structure of different arrays which contain the different attribute of the vertices.

But when we offer those data to the graphics card, we'll offer an array of vertex structs, here the vertex struct contains the position, normal, UV... for one vertex.

So, suppose we want to generate different vertex buffers for different shaders from the mesh file(the struct of arrays), then I think we can use 2 solutions:

generate a different array of structs, here the different struct will be the different formats of vertices.
The problem is: It takes a lot of memory to save the different vertex buffers.
generate a general array of struct, here the struct contains all of the vertex attributes we can get from the mesh file, and use offset to get the correct data for different vertex format.
The  problem is: will it be slow for shader program to access the vertex data?

Which one is the better way to do? Or is there any better solution?
Again, I'm just a fresher, So I hope my description is clear enough for the problem :-)

Thank you all very much!

sentences:
How not to break licence laws? I have an idea for a game. Also I have almost everything worked out considering coding.

What interests me the most is how can I know if that game can be published.

As it would be for iOS and android, these markets are of the geratest interest for me.

I found on apples store something similair to what I would make and it's published by some big game developer. How can I be sure I am not breaking any laws when publishing the game? Can I make a game like board game 'Risk'?

I don't have any knowledge considering licencing. This game would be avaliable for free, with an option to donate, so money isn't my objective (but it won't hurt) [:

sentences:
Voronoi regions of a (convex) polygon I'm looking to add circle-polygon collisions to my Separating Axis Theorem collision detection.

The metanet software tutorial (http://www.metanetsoftware.com/technique/tutorialA.html#section3) on SAT, which I discovered in the answer to a question I found when searching, talks about voronoi regions.

I'm having trouble finding material on how I would calculate these regions for an arbitrary convex polygon and also how I would determine if a point is in one + which.

The tutorial does contain source code but it's a .fla and I don't have Flash unfortunately.

sentences:
How to render a grid of dots being exactly 1x1 pixel wide using a shader? I would like to render a grid with many dots, all equally spaced and being exactly 1 pixel wide.
What I was able to achieve so far is this :

What I would like is (simulated using image editing program):

Here is the shader I wrote (which give result of 1st image).
This is rendered as a giant quad.
Shader "Custom/Grid"
{
    SubShader
    {
        Pass
        {
            CGPROGRAM
            #pragma vertex vert
            #pragma fragment frag
            #include "UnityCG.cginc"

            struct vertInput {
                float4 pos : POSITION;
                float4 uv : TEXCOORD1;
            };

            struct vertOutput {
                float4 pos : SV_POSITION;
                float4 uv : TEXCOORD0;
            };

            vertOutput vert (vertInput input)
            {
                vertOutput o;
                o.pos = mul(UNITY_MATRIX_MVP, input.pos);
                o.uv = input.uv;
                return o;
            }

            fixed4 frag (vertOutput output) : SV_Target
            {
                float4 uv = output.uv;
                float x = step((uv.x * 100.0 + 0.025) % 1.0, 0.05);
                float y = step((uv.y * 100.0 + 0.025) % 1.0, 0.05);
                float c = min(x, y);
                return float4(c, c, c, 1.0);
            }
            ENDCG
        }
    }
}

Is it possible to achieve what I want using a shader ?
What is needed from first draft is to control the size of each dot.
I have tried to use partial derivatives (ddx and ddy) but was not able to make it work.

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:
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: Limit buttontext to one line in Unity? I have many buttons in my game. There are different texts on them every time. But some texts are too long and get split up into two different lines. Is there any way I can fix this without resizing the button. How do I limit the button to one line. p.s I do have best fit on and need it.

sentences:
GLSL shader performance reduced by loop? I hav a fragment shader like this:

#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 = texture(u_texture[0], v_texCoords[0]);
    for(int i = 1; i < actual_textures; i++){
        vec4 tex = texture(u_texture[i], v_texCoords[i]);
        final_color = tex * tex.a + final_color * (1 - tex.a);
    }

    frag_color = v_color * final_color;
}

But somehow this slows my game down by 30 - 40fps in comparison to this approach:

#version 330 core

in vec4 v_color;
in vec2 v_texCoords[10];

out vec4 frag_color;

uniform sampler2D u_texture[10];

void main() {
    vec4 final_color = texture(u_texture[0], v_texCoords[0]);
    vec4 tex = texture(u_texture[1], v_texCoords[1]);
    final_color = tex * tex.a + final_color * (1 - tex.a);
    tex = texture(u_texture[2], v_texCoords[2]);
    final_color = tex * tex.a + final_color * (1 - tex.a);
    //...

    frag_color = v_color * final_color;
}

Why does a single loop slow the gpu down so much?

sentences:
How is entering cover animation done for cover system? I am trying to create a cover system for my 3rd person shooter game in Unity.

My implementation is a basic one :

On Player enter Trigger
  Player move to preset cover position
  Player play Enter Cover animation (eg: dash to cover)

This is fine without root motion enabled, when it is enabled (so the movements look natural), instead of dash &
stop behind the cover, the Player will dash and stuck himself inside the cover (due to root motion). So I am curious, what is a good way to do the animation for cover system?

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

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

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

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

sentences:
recommended shader pipeline infrastructure in core opengl 3.3 I am writing a game project in Go and I am using an OpenGl 3.3 core context to do my rendering stuff. At the moment I have different types of renderers. Each renderer has it's own pair of vertex- and fragment-shader, a struct of uniform- and attribute locations. A struct with glBuffers, vertex-array-object, and numverts (int) which contains all data required to render one object (mesh). Last but not least a constructor to create and initialize the attribute/uniform locations a method to load a mesh into mesh data and the render method itself.

I am absolutely not happy with this design. Every time I want to create a new simple shader, I have to write all this code, and I haven't found a way to make the overhead of a new shader smaller. All I was able to make with the help of go reflections is to automatically get the attribute/uniform location based on the variable name in attribute/uniform location struct and to automatically set the attribute pointers based on the layout of the vertex struct.

another thing that I don't like, is that when I want to implement for example the functionality of the function glClipPlane of the fixed function pipeline, I need to add the uniform to each shader separately and I need to set this uniform in each shader and I need to implement the discard of fragments in each fragment shader

Are there some common practices that significantly reduce the code overhead of a new shader? Are there good shader pipelines that you can recommend me to take a look at?
Are there some good practices to add functionality to several shaders at once?

sentences:
Picking college degree (want to be games programmer) Alright, so I know there's plenty of questions that have to do with college degrees on this site, but I don't feel that any of them really answer my question. I recently got accepted into Northeastern University. The thing that drew me to the university was not only that it appears to have a comprehensive computer science program, but that it offers combined majors with the other colleges. Since i'm interested in both game art and game programming, I applied to the Computer Science and Digital Art major. However, after looking at the other combined majors, I wondering if I picked the one that is right for me.

The five majors I'm currently looking at right now:

Computer Science and Digital Art:

Pros: Teaches both programming and art fundamentals.
Cons: The mathematics requirements are the weakest of the five majors
(only require linear algebra).

Computer Science and Game Design:

Pros: Very comprehensive in both computer science and game design.
Requires the most computer science courses out of the 5 majors (the
extra courses are game design specific). I'd be the most likely to
meet like minded peers in this major as well.
Cons: Doesn't really touch on subjects of game art at all. You are
allowed to take two art+design electives, that's it.

Computer Engineering and Computer Science:

Pros: Gives a comprehensive education on computing in general
(hardware and software). The biggest benefit of this major, I feel,
is that it would teach me how to think. By that, I mean it would
teach me to think in such a way that it'd be very easy to dive into
other aspects of both computer engineering and computer science (more
so than the other majors).
Cons: It's a computer engineering major first, and a computer science
major second. Some of the information I learn may be pretty much
useless.

Computer Science and mathematics:

Pros: Naturally, it has the most math courses of any other major.
Cons: The only major con is that I'm not really crazy about math, and
don't know if I really want to subject myself to a bunch of it.

Computer Science and physics

Pros: It's actually pretty well split among math, physics, and
computer science.
Cons: Like the computer engineering major, some of the information I
learn may be pretty much useless.

I don't want this post to be ridiculously long so forgive me if I'm not specific enough. I'm guess I'm torn between different beliefs. Computer Science and Digital Art/Game Design would probably be the most fun majors for me, since they'd suit my personal interests. However, the other majors would give me information that would be useful in a broader sense (I could apply them outside the fields of game design / interactive media). I don't think any one of these majors will prepare me completely for the games industry, not even the game design one. However, I do think that no matter which of these majors I pick, I'll still be able to get into the game industry.

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:
Convert the animation inside FBX into Unity Recently i bought a package with an fbx and lots of animations.

Since I want full control and change a couple of details, I want to convert them into the regular Unities Animation System.
I cant convert them into the normal Unity Animations though.
They are "read only".

I can load them, copy paste them into my own "not-read-only" animation file.
But somehow i cant change the file anymore after I pasted something inside.

What am I doing wrong?
Is that something "impossible"?
Can you guys help?

sentences:
Random world Points in GLSL for tree placement I'm doing tree placement in the geometry shader in GLSL. I've made a seeded random vec3 function based on gold noise that looks like this:

vec3 randomVec3(vec2 xy, int seed)
{
  return vec3(gold_noise(xy, seed * 3), gold_noise(xy, seed * 3 +1), gold_noise(xy, seed *3 +2));
}

This works, but generates strange patterns in the trees. I can't find anything on making random numbers that isn't based on the fragment coord and unseeded - each run of the geo shader needs to generate 15~ random vec3s for trees based on a seed (area on the planet combined with an index for each tree). Here is my results so far:

You can see the diagonal patterns going through the tree clusters. This is what I want to reduce.

Thanks!

Edit: Here is my code that places trees in full

float gold_noise(in vec2 xy, in float seed)
{
    return fract(tan(distance(xy*PHI, xy)*seed)*xy.x);
}

void drawInstanceOnSphere(vec4 worldPos, vec2 sphericalCoords)
{
  //...Draws an instance at the correct height and rotation based on the
world position and spherical coords of the desired instance
}

//Generates a psuedo random vec3 based on a coord and a seed
vec3 randomVec3(vec2 xy, int seed)
{
return vec3(gold_noise(xy, seed * 3), gold_noise(xy, seed * 3 +2), gold_noise(xy, seed *3 +4));
}

//Places a set of trees
void placeTrees()
{
  //All following code assumes planet positon of 0,0,0, and no planet rotation
  //Find the point on the planet closest to the camera
  vec4 closestPoint = normalize(cameraPos) * radius;

  // if the surface is close enough
  if(distance(closestPoint, cameraPos) < 3000)
  {
    //Tree placement is based off this mechaninsim - a geo shader can draw 15
 trees per run before it becomes inefficient. Divide the spherical coords by 1000
 to generate a 1000x1000 grid across the planet. Each point becomes a new seed -
all trees will look the same in this "quadrant". This mean each shader run can
increase their own seed offset by 1 for each tree. I can then run 9 instances on
this shader, choosing the 9 closest "quadrants" to the player.

    //What are we dividing the spherical coords from ?
    float quadrantDiff = 1000;

    //Quadrant.xy is fed from the C++ code. Centre of the world map would be 0.5, 0.5
    vec2 quadrantCoord = quadrant.xy;

    //Get our world point from this coord. Centre of the world map with radius 3150 and origin 0,0,0 would be 0,0,-3150
    vec4 quadrantWorldPoint = (vec4(getWorldPoint(quadrantCoord),0));

    //Draw 15 trees
    for (int treeCount = 0; treeCount < 15; treeCount++)
    {
      //Range number - is fudge, looks okay
      float range = 8000 / quadrantDiff;

      //Position of the tree is the quadrantCentre point plus a random vec3,
 then normalized and multiplied by the radius to place it on the sphere.
Additional height to match terrain is added in the "draw on sphere" method

      vec4 treePos = normalize(quadrantWorldPoint + range *  (vec4(2.0 * randomVec3(quadrantCoord, int( treeCount + 15 * seedOffset)) - vec3(1),1))) * radius;

      //Get the tree's spherical coord for heightmap lookup
      vec2 treeCoord = getAdjustedTexCoord(getTexCoordFromPos(treePos));
      //Draw this tree
      drawInstanceOnSphere(treePos, treeCoord);
    }
  }

}

Here is another image showing the diagonal lines being worse. The centre quad seed for this image is (0.532, 0.532).

sentences:
OpenGL - Drawing multiple meshes at once using VBOs and IBOs I have been learning OpenGL 2.1 but using shaders, VBOs, IBOs, etc. I have gotten a rendering engine that can load and draw meshes, materials, forward lighting (no shadows yet), SceneNodes, and NodeComponents. There are no optimizations yet (for obvious reasons) such as occlusion culling, only Face culling at the moment.

A mesh (simplified) class looks like this:

struct Mesh
{
    GLuint vbo;
    GLuint ibo;
    GLuint size;

    void draw(Program* shaderProgram) const
    {
        glEnableVertexAttribArray(shaderProgram->attrib("vertPos"));
        glEnableVertexAttribArray(shaderProgram->attrib("vertTexCoord"));
        ...

        glBindBuffer(GL_ARRAY_BUFFER, vbo);

        glVertexAttribPointer(shaderProgram->attrib("vertPos"), 3, GL_FLOAT, false,
                              sizeof(Vertex), (const GLvoid*)(0 * sizeof(float)));
        ...

        glBindBuffer(GL_ELEMENT_ARRAY_BUFFER, ibo);
        glDrawElements(GL_TRIANGLES, size, GL_UNSIGNED_INT, 0);

        glBindBuffer(GL_ARRAY_BUFFER, 0);
        glBindBuffer(GL_ELEMENT_ARRAY_BUFFER, 0);

        glDisableVertexAttribArray(shaderProgram->attrib("vertPos"));
        ...
    }
}

When I have been drawing multiple objects with the same mesh (or multiple meshes), I notice a frame drop compared to a single mesh with the same number of triangles.

Stanford Models were used.
(1 Face = Triangle)
| Model  | Num Models  | Total Faces | With Lighting | Without Lighting |
| -      | -           | -           | ms / frame    | ms / frame       |
|--------|-------------|-------------|---------------|------------------|
|        | 0 (control) |        0    |  0.47         |  0.41            |
| bunny  | 1           |    69630    |  1.2          |  0.64            |
| bunny  | 14          |   974820    | 12.4          |  3.50            |
| buddha | 1           |  1087474    |  7.87         |  2.89            |
| buddha | 10          | 10874740    | 71.4          | 23.8             |

I does look like that time/frame is ~O(n). However, drawing one vbo with 12% more faces, the frame time is decreased by 37%.

So my questions are:

Is drawing multiple VBOs actually worse than drawing one big one?
How would I combine these VBOs and IBOs into one big one if this is true?

sentences:
How to add constant force to player with sperical gravity planet.? I have a planet and character. My player move perfect around planet with pressing key like 'w','s','a and 'D'. I want to move my player on every frame with same force around sphere. I try plane surface constant force code  like this this.rigidbody.AddForce ( 3f,3f,3f);, when start playing game this code work fine but after some movement it stop my player on specific position of planet. I want to use this code for 3D sphere.

Any one can help me how can add constant force to my player on 3d sphere.?

I want add constant force to player when game start. I don't want any kind of planet's orbits, because my player is moving on all over the planet.

I try below link but it did not working for me.
 How can i accurately simulate orbits in unity.?

Here is my Sctipts

PlayerController.cs

using UnityEngine;
using System.Collections;

public class PlayerController : MonoBehaviour {

public float moveSpeed = 10;
public Vector3 moveDir;
Rigidbody rigidbody;
// Update is called once per frame3

void Start(){
    rigidbody = GetComponent<Rigidbody> ();
}
void Update () {

    moveDir = new Vector3 (Input.GetAxisRaw("Horizontal")  ,0,Input.GetAxisRaw("Vertical"));
}
void FixedUpdate(){

    rigidbody.MovePosition (rigidbody.position + transform.TransformDirection(moveDir) * moveSpeed * Time.deltaTime);

 }
}

FauxGravityBody.cs

using UnityEngine;
using System.Collections;

[RequireComponent (typeof (Rigidbody))]
public class FauxGravityBody : MonoBehaviour {

public FauxGravityAttractor attractor;
public Transform myTransform;
Rigidbody rigidbody;

// Use this for initialization++
void Awake(){

    this.rigidbody = GetComponent<Rigidbody> ();

}
void Start () {
    myTransform = transform;
    rigidbody.useGravity = false;
    rigidbody.constraints = RigidbodyConstraints.FreezeRotation;
}

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

    attractor.Attract (myTransform);
  }
}

FauxGravityAttractor.cs

using UnityEngine;
using System.Collections;

public class FauxGravityAttractor : MonoBehaviour {

public float gravity = -10;
public void Attract(Transform body){

    Vector3 gravityUp = (body.position - transform.position).normalized;
    Vector3 bodyUp = body.up;

    body.GetComponent<Rigidbody>().AddForce (gravityUp * gravity);
    Quaternion targetRotation = Quaternion.FromToRotation (bodyUp, gravityUp) * body.rotation;
    body.rotation = Quaternion.Slerp (body.rotation, targetRotation, 50 * Time.deltaTime);
  }
}

I am working with this scripts, If any one help me? then please.

sentences:
Random Abstract Art Assignment So I have a school assignment where we have to make a little program that makes random abstract art out of drawn rectangles.

This is what is should look like:

It's the top right element of the canvas.

Now the function has to consist of this: When you press 'backspace' the program should generate a new abstract 'painting' within the boarders and it should consist of 15 new random sized and random colored rectangles.

We work in a custom game engine that our teacher made for us. It uses C# as base.

I basically got everything to work. When I press backspace 15 random rectangles are being drawn on the canvas with random colors. The only problem is that when I press backspace again, only the colors change but not the rectangles.

Here is a pastebin link to the code I made so far: http://pastebin.com/YCrjb2T1

So basically for the colors I made a list (CreateRandomColorList) of int arrays. The int arrays are being  filled with 3 random numbers between 0 and 255 (RGB colors). These 3 numbers can be given as parameters to set the color. So everytime you press backspace the rectangles are given new random colors.

I wanted to do exactly the same for the rectangles themselves but that did not seem to work.

There are 3 parameters you can give to a rectangle: The x position on the canvas, the y position on the canvas, the width and the height.

Any insights/tips on what could be wrong would be welcome, I hope my explanation is good enough.

sentences: UV Coordinates of "curve" (or "bend") I am looking for some tutorial or equation how to map texture from square to "curve" or "bend". (Example on image below) I have tried to convert coordinates of unit circle to UV, but that gives me incorrect result around corners.

sentences:
How do I cover a plane in a bumpy foam material effect? I need to fill a weapon bag with foam material.

This is what it should look lik:

The material in the upper part of the bag looks like this:

I'm using HDRP.

How could I do this?

Thank you!

Edit: I have played around with Parallax Occlusion mapping, and I got this result.

Edit2: I am not sure if I use the Pixel Displacement as it has been suggested to me.

Also, I'm not sure if I use it the correct way:

I have created a Height map and put it into the Height map slot.
This doesn't create any effect.
I have to put the same map into the Base map slot in order to see the effect.
If I put a black image into the Base map slot or if I choose Black as the Base color, no effect is visible.

I don't understand why this is so. I think even if my Base map is black, the Shader has pixels that it can move.

This is my height map:

Edit 3: It was suggested that I should use a normal map. This doesn't look at all what I expected. The normal map was created from the Height map using an online tool:

By Philipp's answer I found out that the normal map alone is not enough.

sentences:
FXAA Parameter Confusion I have a question about the popular FXAA shaders that are out there written using HLSL or GLSL, and they all mainly feature these three parameters:

#define FXAA_REDUCE_MIN (1.0 / 128.0)  //0.0078125
#define FXAA_REDUCE_MUL (1.0 / 8.0)  //0.125
#define FXAA_SPAN_MAX 8.0

What is the function of each parameter?

sentences:
Is it possible to have a script built-in into a custom resource? Here's a rudimentary custom resource:

extends Resource

export(Resource) var scr

I can drag a pre-made .gd script into this exported property in Inspector, and it works as intended. I can click on the exported property field and embed a resource (like "New ShaderMaterial"), and it would also work as intended, and I would be able to edit that sub-resource normally. However, if I click on the exported property and select "New GDScript", there doesn't seem to be a way to open the new gdscript for editing. Is it possible to embed a gdscript sub-resource the same way you can embed a different sub-resource?

sentences:
How can I make the camera to rotate from side side but in static movement range? I mean for some reason now the camera is rotating to the left and to the right but sometimes it's rotating to one of the sides a lot I mean a very sharp angle and sometimes less rotation.

How can I control how much rotation will be from side to side by degrees ?

using UnityEngine;
using System.Collections;

public class scr_camera : MonoBehaviour {

    public float rotate_amount;

    // Use this for initialization
    void Start () {

    }

    // Update is called once per frame
    void Update () {
        transform.rotation = Quaternion.Euler(transform.eulerAngles.x, (Mathf.Sin(Time.realtimeSinceStartup) * rotate_amount) + transform.eulerAngles.y, transform.eulerAngles.z);
    }
}

Sometimes cam14 make almost 240 even close to 300 degrees rotation to one of the sides sometimes less. The rotation is not equal to both sides. I want simple rotation to both side just to see the room and not the walls behind the camera.

In this case I set the rotate_amount to 7 so it will rotate faster.

sentences:
How to fix lag in 64 bit Android devices My game's FPS drops to 30 - 8 FPS on any 64 bit Android device but is at 59 - 60 FPS on an even lesser 32 bit Android device.
I've tried unchecking Development Build on Build settings and I've tried disabling debug calls on my game by using:
void Update ()
{
#if UNITY_EDITOR
if(!Debug.unityLogger.logEnabled)
    Debug.unityLogger.logEnabled = true;
#else
if(Debug.unityLogger.logEnabled)
    Debug.unityLogger.logEnabled = false;
#endif
}

But there wasn't any change. And I tried setting all Stack Trace Log type to None(Edit > Project Settings > Player). Also no change.
PS: I used that update call because there are other imported assets that call the Debug class and I wouldn't want to mess around with their classes.
EDIT: As you can see in the screenshots below, the device that runs the game at less than 30 FPS(every 64 bit device) has Gfx.WaitForPresentOnGfxThread take 71.6% of the frames and RenderPipelineManager.DoRenderLoop_Internal() takes up 51.1%. While the device that ran the game at 60FPS(every 32 bit device) has RenderPipelineManager.DoRenderLoop_Internal() take up the most frames with 35.7% of the frame.
How should I fix the frame rate drop on the 64 bit device?

EDIT:
The 32 bit Android device is an Infinix Hot 4, 2GB RAM, 1.3GHz quad-core MediaTek MT6580 CPU, OpenGLES2, Android 7.0, 1280x720. - This reaches a maximum of 62FPS(Average 59FPS).
The 64 bit Android devices are:

Cubot X19 - 4GB RAM, [8 core CPU: 4x 2.3 GHz ARM Cortex-A53, 4x 1.65 GHz ARM Cortex-A53], OpenGLES3, Vulkan supported, Android 9.0, 2160x1080. - This reaches a maximum of 30 FPS(Average 25FPS).
Qubo P19 - 3GB RAM, 1.5GHz Quad-Core MT6739WA CPU, OpenGLES2, OpenGLES3 supported, Android 9.0, 1280x640. - This reaches a maximum of 25FPS(Average 19FPS).

I'm using Unity 2019.3.1f for my project.

sentences:
Assigning valid moves on board game I am making a board game in unity 4.3 2d similar to checkers. I have added an empty object to all the points where player can move and added a box collider to each empty object.I attached a click to move script to each player token. Now I want to assign valid moves. e.g. as shown in picture... Players can only move on vertex of each square.Player can only move to adjacent vertex.Thus it can only move from red spot to yellow and cannot move to blue spot.There is another condition which is : if there is the token of another player at the yellow spot then the player cannot move to that spot. Instead it will have to go from red to green spot. How can I find the valid moves of the player by scripting.

I have another problem with click to move. When I click all the objects move to that position.But I only want to move a single token. So what can i add to script to select a specific object and then click to move the specific object.Here is my script for click to move.

var obj:Transform;

private var hitPoint : Vector3;

private var move: boolean = false;

private var startTime:float;

var speed = 1;

function Update ()
{
if(Input.GetKeyDown(KeyCode.Mouse0))
{
var hit : RaycastHit; // no point storing this really
var ray = Camera.main.ScreenPointToRay (Input.mousePosition);
if (Physics.Raycast (ray, hit, 10000))
{
hitPoint = hit.point;
move = true;
startTime = Time.time;
}
}

if(move)
{
obj.position = Vector3.Lerp(obj.position, hitPoint, Time.deltaTime * speed);
if(obj.position == hitPoint)
{
move = false;
}
}
}`

sentences:
LibGDX Scene2D event handling and bounding box relative to the center of a TextureRegion I'm experimenting with Scene2D to see if it fits fot the game I want to develop.
Say I have an Actor with the origin in the center of its TextureRegion.

My setup method contains this code:

float width = WorldUtils.pixelsToMeters(Assets.bullet.getRegionWidth());
float height = WorldUtils.pixelsToMeters(Assets.bullet.getRegionHeight());

setPosition(x, y);
setOrigin(width / 2, height / 2);
setSize(width, height);
setRotation(angle);

Where WorldUtils.pixelsToMeters(float) is just a method to convert pixels to world units (basically 64px = 1 meter).

My draw() method is like this:

@Override
public void draw(SpriteBatch batch, float parentAlpha) {
    batch.setColor(getColor().r, getColor().g, getColor().b, getColor().a);
    batch.draw(Assets.bullet, getX()-getOriginX(), getY()-getOriginY(), getOriginX(), getOriginY(),
               getWidth(), getHeight(), 1, 1, getRotation());
}

This way the actor's position is equal to its center position. This simplifies a lot of stuff like moving the actor to a specific (x, y) in the game world. Otherwise everytime I have to use this actor's position I have to take in account for its screen representation's size... and it doesn't make much sense.

But the way I setup things come at the cost of messing up with event handling. From what I understand Scene2D event handling assumes I'm using (0, 0) as origin of the actor's bounding box.
So when I touch/click on my actor during execution it can handle only the ones slightly up-right it real position (obviously).

Is there a way to fix this without touching the library code? I would like to handle certain objects with origin in the center and others with origin in the bottom-left corner.

Maybe I misunderstood how to setup my actor?

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:
How to texture procedurally generated custom terrain mesh I am making an infinite procedural terrain for my game and currently trying to apply textures to it.
The generated terrain has different biomes, so I want to texturize the terrain based on biome and have different textures applied based on the steepness and height of the terrain. I also have different areas generated, such as settlements and also roads so I want to apply specific textures to specific places like those as well.
Unity terrain only supports I think 8 layers, but generally, it should be around 4 for 4 channels? In my case I generate a custom mesh, so I don't really need to worry about this, however, I am trying to figure out how to generate some sort of texture map (splatmap), and have lots of textures in it. I want to use (albedo, normal, height) for each 'layer'. Considering that the biomes are generated based on the noise map and each chunk can have many different biomes in it, I need to have more than 4 layers available. For example, steep areas like cliffs will need to have a rocky texture applied and each biome will have a different rocky texture. So if a chunk has two biomes in it, there are lots of different textures that need to be used, including various misc textures for paths and settlement grounds, etc.
Something like this, where a single chunk mesh has for example two biomes. Also, the terrain has a settlement that has a dirt texture applied to the terrain, which extends to both biomes. So essentially, lots of textures in just one mesh.

The other chunk(s) can have similar biomes or even completely other types of biomes. Also, would like to perhaps add the ability to apply different textures to a specific position on terrain chunk at runtime, for example, if the player would want to create a path or if a specific object is placed that would spread some specific texture around the object on the terrain. Something like this for example, where a placed tree has spread some leaf ground texture around:

So, I am looking for a flexible way in applying various different textures to generated terrain mesh. I would like to do that in the script when I am generating a chunk, so I would know which biomes is it at the position and as well as things like steepness and etc.
I am using Shader Graph to create the terrain shader. I'm not really experienced with shaders, so would like to ask for some help on what would be the correct way to achieve something like this?

sentences:
Multi-platform multi-threading: What are the real challenges? While a library like SDL provides a cross-platform wrapper API for threading, I think it would be naive to assume that this leads directly to easy development of games across vastly different platforms (desktop / mobile).

What is the best way to tackle developing in this way (given any cross-platform threading API) considering the following:

different numbers of cores
vastly different processing capabilities per core
A generally different systems architecture with eg. different latencies for cache, RAM , and I/O access

I get the feeling that the only way to do this is evaluate how many threads may be run per each device you intend to support, and find out what the lowest common denominator is. However, this still leaves me in the dark as to the total amount of processing throughput available. Am I right in assuming the only way to do this effectively is to actively develop for the lowest spec mobile device I intend to support, throughout development? -- i.e. the lowest common denominator? Should this roughly be sufficient? Or is there more to it than this?

EDIT: Please could others offer further experience on this as I don't feel my question has been answered fully yet.

sentences:
What would be a fast way of detecting collision between 2 2d rotated rectangles? Currently I am following this tutorial here for 2D collision detection:
http://www.gamedev.net/page/resources/_/technical/game-programming/2d-rotated-rectangle-collision-r2604

I have found that the way of converting the projected vectors to a scalar value doesn't seem to be correct and there are false reports of collision. I tried to only take the projected x value and using that as a scalar however this runs into the rare corner case of when the axis is pointing up the x values are all 0.

If there is a way to solve this problem it would be great. All help is appreciated.

sentences:
Extracting gamefiles from a game, modify it, then use it commercially, would it be illegal? I kinda get a chance to extract gamefiles from the game fortnite(assets, sounds, etc), and then I want to use them for my animation, would that be illegal.

If it is illegal, what if I alter the assets, like modifying it to a voxel, and use it commercially, is it still illegal?

sentences:
Inconsistent movement / line-of-sight around obstacles on a hexagonal grid In a roguelike game I've been working on, one of my core design goals has been to allow the player to "Play the game, not the grid."

In essence, I want the player's positioning to be tactical because of elements in the game world, not simply because some grid tiles are more advantageous than others in relation to enemies. I am fine with world geometry not being realistic, but it needs to be consistent.

In this process, I have run into most of the common problems (Square tiles? Diagonal movement, LOS, corner cases, etc.) and have moved to a hexagonal tile grid. For the most part this has been great, and I've not had too many inconsistencies.

Recently, however, I have been stumped by the following:

Points A and B are both distance 4 from the player (red lines). Lines-of-sight to both are blocked by walls (black tiles). However, due to the hexagonal grid, A can be reached in 4 moves, whereas B requires 5 moves (blue lines).

On a hex grid, "shortest path" seems divorced from "direct path"; there may be multiple shortest paths to any point, but there is only one direct path (or two in some situations). This is fine; geometry doesn't need to be realistic.

However, this also seems inconsistent: Similar obstacles are more effective in some positions than in others. A player running away from an enemy should be able to run in any direction, increasing the distance between the two actors. However, when placing obstacles or traps between themselves and enemies, the player is best served by running in one of the six directions that don't have multiple shortest paths.

Is there a way to rationalise this? Am I missing something that makes this behaviour consistent? Or is there a way to make this behaviour consistent? I am most certainly over-thinking this, but as it is one of my goals, I should do it due diligence.

sentences:
Anti-cheat Javascript for browser/HTML5 game I'm planning on venturing on making a single player action rpg in js/html5, and I'd like to prevent cheating. I don't need 100% protection, since it's not going to be a multiplayer game, but I want some level of protection.

So what strategies you suggest beyond minify and obfuscation?

I wouldn't bother to make some server side simple checking, but I don't want to go the Diablo 3 path keeping all my game state changes on the server side.

Since it's going to be a rpg of sorts I came up with the idea of making a stats inspector that checks abrupt changes in their values, but I'm not sure how it consistent and trusty it can be.

What about variables and functions escopes? Working on smaller escopes whenever possible is safer, but it's worth the effort?

Is there anyway for the javascript to self inspect it's text, like in a checksum?

There are browser specific solutions? I wouldn't bother to restrain it for Chrome only in the early builds.

sentences:
Every X months Visual Studio Code says: 'UI' does not exist in the namespace 'UnityEngine' I've tried countless fixes in the last 1,5 year, and I still don't know what is the absolute fix for this. Or after fixing it, why it got fixed.
Usually this happens after a Unity update, or after updating the IDE packages.
I tried lots of fixes, and it seems like that it's always changing what fixes it:

Sometimes it's fixed by regenerating all projects files, also sometimes manually deleting them.

Sometimes it's fixed by reinstalling Visual Studio.

Sometimes it's fixed by downgrading the IDE packages (until now not for me, but based on some browsing, it works for some people)

Switching to Visual Studio in the preferences, opening it, then switching back to Code. (At first I thought that this is just regenerates the projects files, but who knows, maybe it does something else in the background.)

This time it got fixed after I switched to Visual Studio, opened Visual Studio, and it showed missing references. So I closed it, regenerated all project files, and then reopened it. Now Visual Studio works. And after this, I switched back to Visual Studio Code, and now it works there as well.

(I always restart Unity and Code after these)
Sometimes it isn't fixed by just going through this list one by one. Sometimes none of them fix it, so I try them all again, in different order, etc, and then it's fixed after some random combination.
Most of the times only Visual Studio Code is broken, but sometimes Visual Studio is missing the references as well.
Could someone tell me why this keeps occurring for a lot of people, and what is the absolute fix and why?
In the log, it says that UnityEngine.UI got successfully loaded and added:
OmniSharp.MSBuild.ProjectManager
Successfully loaded project file 'c:\Projects\RPG\UnityEditor.UI.csproj'.
OmniSharp.MSBuild.ProjectManager
Adding project 'c:\Projects\RPG\UnityEditor.UI.csproj'

sentences:
How can I run and jump at the same time? I'm having some trouble with the game I started.
http://testing.fyrastudio.com/lab/tweetOlympics/v0.002/
The thing is that i have an athlete running and he must jump at the same time. A race with obstacles.

I have him running (with pressing the letter Q repeateadly). I also have him jumping (with letter P)
But the thing is that when he runs and jumps at the same time, he seems to be jumping at the same place, instead of going forward with the jump... any ideas how can I fix this??

This is the code I'm using for running and jumping on a continuos loop.

//if accelearing and the last time that he accelerated was less than X seconds ago, hes running an accelaring
     if (athlete.accelerating && timeCurrent - athlete.last_acceleration > athlete.delay_acceleration) {
      athlete.accelerating = false;
      athlete.last_acceleration = timeCurrent;
      athlete.running = true;
     }
     if (!athlete.accelerating && timeCurrent - athlete.last_acceleration > athlete.delay_acceleration) {
      athlete.decelerating = true;
     }
     if(athlete.decelerating && timeCurrent - athlete.last_deceleration > athlete.delay_deceleration){
      if(athlete.speed >= 1){
       //athlete starts to decelarate
       athlete.last_deceleration = timeCurrent;
       athlete.decelerate();
      }else {
       athlete.running = false;
      }
     }
     if (athlete.running) {
      athlete.position += athlete.speed;
     }
     if (athlete.jumping) {
      if (athlete.jump_height < 1) {
       athlete.jump_height = 1;
      }else {
       if (athlete.jump_height >= athlete.jump_max_height) {
            athlete.jump_height = athlete.jump_max_height;
            athlete.jumping = false;
       }else {
            athlete.jump_height = athlete.jump_height * athlete.jump_speed;
       }
      }

     }
     if (!athlete.jumping) {

      if(athlete.jump_height > 1){
       athlete.jump_height = athlete.jump_height * 0.9;
      }else {
       athlete.jump_height = 1;
      }
     }

     athlete.scaleX = athlete.scaleY = athlete.jump_height;
     athlete.x = athlete.position;

Thanks!

sentences:
How do you parameterize turn based AI? I would like to create/find an AI algorithm/process that can be parameterized such that a change in the parameters causes a change in the AI behavior. I am specifically looking to apply this to a turn based game environment where the player is able to perform several moves (or none at all) in a single turn. The player has full knowledge of the board and should be able to take the opponent's current positioning into account when deciding what moves to make in the current turn.

My question is how can I create this type of AI? An example of behavior that I would like it to show in various situations would be:

Turn X: Attack location A with 7 units and attack location C with 12 units
Turn Y: Do nothing
Turn Z: Invest in resource collection

Then a small change in a parameter may cause the AI to only send 6 units to location A instead of 7 in the same situation as Turn X.

My only thought of how to implement something like this would be to have the parameters act as probabilities of doing action T with magnitude R. However, I could imagine how this wouldn't facilitate long term thinking, and I also have no idea how that approach would take the opponent's positioning into account. I also suspect that this approach would cause the AI to overspend within a single turn, as in, it tries to attack 3 locations with a total of 30 units, but it only has 15.

I've spent the last few hours looking through Google Scholar and have found a few papers that say that they have used a parameterized AI approach, but they don't discuss any actual implementation details. If anyone could tell me what this concept is normally called (so I can Google and research it further) or has any reference links to code that uses an implementation like this then I would really appreciate you adding it as an answer.

Also, just so people don't waste their time answering something that isn't needed, I'm only interested in the design/structure of the described process, I am not looking for ways to get good values for the parameters.

Thanks everyone!

sentences:
Accessing the Properties of an object already in Scene in Unreal Engine using C++ I am trying to learn more about raycasting in C++ and am trying to implement raycasts in a mini third-person game I am creating. In order to shoot a raycast, I first need to determine its starting location, which in this case I intend it to be from the center of the third-person camera already built-in.

In order to do that, however, I need to access the properties of the camera already in the scene and store its location in a variable using c++. I am relatively new to unreal so I have no idea how to access an object's properties that's already in the scene using C++.

Any help is appreciated

I am still searching, but I couldn't find a satisfying answer yet.

sentences:
Not So Beginner Tutorial Request So my game is done for now but every time it flashes on the screen and my game loop is awful. So crowded with logic.

I need to learn more about games and how they are running. My idea now is that at the heart of the game you have a while loop. Inside that you are checking for events to happen. Each time an event happens, you spawn a thread that accomplishes a task.

You then have a layer that draws on the screen the "map". Also a layer that says where objects collide. And finally the logic of how objects interact.

I am using C++ and SDL and I need a complete tutorial that takes me through a complex example to get started. I am a good programmer but have no experience with games. Any suggested tutorials would help.

All tutorials I have found so far are too easy and don't do anything worth while.

sentences:
cutting part of object How to cut part of the object if it is inside a specific area? like showed on attached image.

PS

Looks like stencil should be used, but I am not really sure how to do it.

sentences:
Why was my Facebook game rejected with the note that "your app icon must not overlap with content in your cover image?" My FB game just recently got rejected for two reasons. The first I fixed, but I just can't see to figure out what they mean by the second, and I was hoping someone else got the same issue and did know what they meant.

The remaining error is:

  Cover Image

  Your app icon must not overlap with content in your cover image.  Click on 'Web Preview' in the 'App Details' section to check for overlap prior to submitting your app.  See more here.

All I know is that the rejection has something to do with the cover image, not the icons or the screenshots.

The web preview of my game looks like this now:

Please let me know what to do to get approved.

sentences: Asymetrcal Public Key (Host it on a server or distribute with launcher)? I am currently building a launcher for the front end of my game and I am wondering if I should host the public key on a server and have the launcher pull the data as and when needed, or should I distribute it packaged with the launcher. My thinking is that if I distribute it I will need to update the launcher should I need to change the keys but if I host it then I won't need to I just need to swap the keys on the server. I ask because I am unsure if this would dramatically increase load/traffic on the site should the game become popular.

sentences:
Rendering two textures with blending and alpha test What I am looking for is the following: I have a circle on a square image, alpha is 0 at the corners

and also a square shadow, alpha is 0 everywhere else

I would like to have as final result a blending of these two renders, plus the shadow not being rendered outside the circle

How could I achieve that?

sentences:
Unity GameObject.Find() not working in batchmode? I am trying to make GameObject.Find() work in batchmode but for some reason it returns a null object.

my code:

public class test: Monobehaviour {
    public static GameObject go;

    static void doing()
    {
        go = GameObject.Find ("testing");
    }
}
//testing is the name of the gameobject in the editor

I call it from the console on mac using: /Applications/Unity/Unity.app/Contents/MacOS/Unity -quit -batchmode -projectPath "" -executeMethod test.doing

sentences:
Get quaternion between two objects on sphere In a planetary gravity environment objects are represented in the following way:

struct object {
    struct quaternion quat; // quaternion to represent the rotation between the object and the center of the planet
    float dist; // distance from the center of the planet
};

Here are the steps at which I position my player:

// start at center of the planet
applyQuaternion(&object.quat);
glTranslatef(0.0f, object.dist, 0.0f);
drawObject(&object);

Step 1, translate to center of planet:

Step 2, apply quaternion:

Step 3, translate outwards by distance value:

I am also able to get the current position of the player or enemy by using this code:

struct matrix initialMatrix, resultantMatrix;
glPushMatrix();
getPositionMatrix(&initialMatrix);
applyQuaternion(&player.quat);
glTranslatef32(0, player.dist, 0);
getPositionMatrix(&resultantMatrix);
playerPosition = matrixTranslationToVector(initialMatrix, resultantMatrix);
glPopMatrix();

Given two objects:

struct object player;
struct object enemy;

How can I get the enemy to face in the direction of the player, whilst always standing upright on the planet, using quaternions?

I want the enemy to go from this:

To this:

His feet always on the planet, and head always away from planet.

I'm able to rotate on the axis which doesn't affect the position (from first enemy diagram to second enemy diagram like so):

// Rotate right
Quaternion_multiply(&player.quat, Quaternion_fromAxisAngle(vect(0.0f, 0.0f, 1.0f), degreesToAngle(2)));

// Rotate left
Quaternion_multiply(&player.quat, Quaternion_fromAxisAngle(vect(0.0f, 0.0f, 1.0f), degreesToAngle(-2)));

So I'm unsure as to why I'd need a local orientation in addition to the quaternion I already have.

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:
'Edit Collider' exits after every adjustment When I click the Edit Collider button I can see the collider's region and the handles to adjust it.

After every adjustment (with the mouse) the collider outline disappears as Edit Collider finishes.  It's frustrating to use, having to reclick Edit Collider after every drag/click.

How do I stop Edit Collider mode from exiting after every change and only exit if I click the button, or press some commit key?

sentences:
Abstract Java game objects for Jython I want to create an abstraction layer between my Jython Script objects and my Game Objects. I am not making the all of the engine in Jython. Most of my game logic is in Java. I just want to expose high level functionality. I am thinking of using these classes.

Jython Object is created using a Jython class and a Java interface that is coerced into java.
Abstracted Object and Abstraced Map are objects with get() functions that limit the exposure of the underlying Game Map and Game Object.
Game Object and Game Map are the underlying Java objects. They are wrapper classes for a component based system.
Action Factory provide functionality to Jython Object. My game is a turn based tactic, so any change in the game board is done by a set of generic actions (move, damage, apply buff, etc).

This is the first time I have tried to implement a scripting system. The goal is be able to design objects and abilities in Jython. Also create a modding system. I have read several places that creating an abstraction layer is a good idea. I am just not sure how to do it.

sentences:
Pygame performance issue for many images I've made a script for generating a game world based off of image pixel data.

Trying to make a python map editor

My progress so far has resulted in a program which loads an image and draws sprites in positions correlating with the map, like this:

Now the problem is that even for small levels, I'm noticing a drop in frame rate. The provided example level will make pygame drop from 100 fps to 80 fps. If the map is 40 x 40 the frame rate will be around 17.

This is concerning, for two reasons. The program is not doing anything else than drawing images right now, how bad will the frame rate be when game logic is also being calculated every frame? Second, the aim is to ultimately make a two-player strategy game, in which the levels would be significantly larger than the example, and in that case 20 frames per second is way below acceptable parameters.

Every sprite in the game is a 48x48 pixel png image with some portion of transparency. Everything except rendering the sprites is done once when the game starts. This is the only code being run on every frame:

    def draw(self):
    self.screen.fill((0,0,0))

    for e in self.map_layout.fixed_list:
        self.screen.blit(e.picture, e.rect)

I'm guessing pygame's method for rendering images does not scale very well. Windows task manager shows my CPU utilisation at 2% with a map of size 40x40.

My question is: What can I do to improve frame rate? I don't mind switching from (or complementing) pygame to something else, so long as the transition is not very difficult for a novice programmer like myself.

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:
How would I go about serializing my LibGDX game? I am currently using Kryo for serialization. I have a Player class, but it extends Sprite. Sprite isn't serializable. This means I can't serialize Player as a whole. Is there another way to do this? Or should I make a separate class for every object that needs to be saved, and manage all the data that needs to be saved in there?

This is my first game and I'm going for a top-down (like pokémon) RPG game. I also need to save locations of monsters and animals in certain maps etc. So I'm not sure if this would be the right way to go about it? I can't find that much about this topic for games and kryo in specific online, so hopefully someone can enlighten me a bit.

sentences:
Creating polygons with separate outline/fill colors in OpenGL Subject

I am creating a terrain map with triangle strips and I would like to make the bodies of the triangles black, but have their outlines be colored.

Problem

The solution appears to be to draw the triangles twice, once in solid black, using GL_FILL and once in color using GL_LINE.

The problem with this approach is that, since I am using depth testing and the vertices are at the same position each time, my color lines end up blending with the black lines

Attempted Solution

According to the OpenGL docs, and other sources, it looks like I should be able to utilize the glPolygonOffset() function to give polygons  that are drawn with GL_LINE "precedence" in the depth buffer by offsetting their comparison value by the argument to the function. (so I would think 1.0 would be sufficient)

This, however, does not appear to be working for me.

My Code

I have placed glEnable(GL_POLYGON_OFFSET_LINE); in my init function.

Here is the code in my draw loop where I do the actual rendering. col is the array that hods the real colors, col2 is filled with black.

Please excuse the mess.

glClear(GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT);

glPolygonOffset(1.0,0.0);

glDeleteBuffers(1,&vertex_buffer);
vertex_buffer = createBuffer(GL_ARRAY_BUFFER, vert, sizeof(GLfloat)*(buffer_size), GL_STATIC_DRAW);
attributeBind(vertex_buffer, 0, 3);

glDeleteBuffers(1,&color_buffer);
color_buffer = createBuffer(GL_ARRAY_BUFFER, col2, sizeof(GLfloat)*(buffer_size), GL_STATIC_DRAW);
attributeBind(color_buffer, 1, 3);

glPolygonMode(GL_FRONT_AND_BACK,GL_FILL);
glDrawArrays(GL_TRIANGLE_STRIP,0,s);

glDeleteBuffers(1,&color_buffer);
color_buffer = createBuffer(GL_ARRAY_BUFFER, col, sizeof(GLfloat)*(buffer_size), GL_STATIC_DRAW);
attributeBind(color_buffer, 1, 3);

glPolygonMode(GL_FRONT_AND_BACK,GL_LINE);
glDrawArrays(GL_TRIANGLE_STRIP,0,s);

I'm not sure if I need to call glPolygonOffset() each frame or not.

These are the attributeBind() and createbuffer() functions:

void attributeBind(GLuint buffer, int index, int points)
{
    glBindBuffer(GL_ARRAY_BUFFER, buffer);
    glVertexAttribPointer(
        index,              // position or color
        points,             // how many dimensions?
        GL_FLOAT,           // type
        GL_FALSE,           // normalized?
        0,                  // stride
        (void*)0            // array buffer offset
    );
}

GLuint createBuffer(GLenum target, const void *buffer_data, GLsizei buffer_size, GLenum usageHint)
{
    GLuint buffer;
    glGenBuffers(1, &buffer);
    glBindBuffer(target, buffer);
    glBufferData(target, buffer_size, buffer_data, usageHint);
    return buffer;
}

sentences:
Creating shattering effects without having to use actual physics? For certain effects like glass shattering and falling objects cracking to reveal their inner contents, are there any tricks or ways to implement these fracture physics without having to use actual physics simulation? Also, what are the trade-offs if I don't use real physics simulations?

Since the effects don't really require exact simulation, an actual physics simulation may be too expensive and wasteful.

sentences:
Rotate an existing quaternion around an axis? I have an existing quaternion (Java Quat4f). I would like to rotate this quaternion around an axis (i.e. 90 degrees around the x axis, 25 degrees around the y axis, 10 degrees around the z axis, 180 degrees around the y axis, etc.)

How can I rotate the existing quaternion around an axis?

Thank you!

sentences:
Unity - How to move a ship realistically to a point in a 2D top-down game i'm trying to move a sailing ship to the point where i clicked with the mouse.
this movement should be realistic (oar at the back where the ship moves around)
so if the mouse click is left and in front of the ship the ship should afterwards move there with a curvy path in order to have the right rotation

i'd be glad if someone could help me with this issue
thank

sentences:
Buttons implementation with regards to a basic Game Loop As the title states I am creating a game with SFML being the only library used.

I am entirely unsure how to go about this.

I want the buttons to be activated by simple mouse clicks (when the mouse is within the defined area of the button).

My question however is how do I do this with regards to a standard Game Loop, with the following methods HandleInput(), Update() and Draw().

Should I implement it so that HandleInput() calls a function (on left
mouse click) which stores the mouse coordinates and in Update() every
button checks if it has been clicked on?
Or should I (attempt to) implement Observer pattern?
Or is there a method I haven't even covered?

I hope this question is relevant to GameDev I believe it is.

sentences:
How do I render a PNG with transparency in LibGDX? I'm building a simple tic-tac-toe example with LibGDX. I have simple images: cross, circle and board, all pngs created with GIMP with a transparent background.

How can I render them as a Texture with transparency?

I've tried with GL10 enable feature, but it seems not to work.

sentences:
How to add or increase speed on every 500m distance of player? I'm a a beginner, creating an endless runner game.

I want to increase speed as the player completed the distance and  on every 500 meter speed should be increased.
Anyone have an idea of how to implement this kind of logic?

speed=10;
//as soon as player reach 500 m distance
//speed should be incremented
//it should be continuous process on every 500m

My code:

public class Score : MonoBehaviour
{
    [SerializeField]
    GameObject ground;
    [SerializeField]
    AudioClip clip;
    [SerializeField]
    Transform player;
    [SerializeField]
    public Text LiveScore;
    [SerializeField]
    public GameObject gameOver;
    [SerializeField]
    public bool runningScore = true;
    public Text finalScore;
    public Text Highscore, bestScore;
    float distance;
    ball Ball;
    // Start is called before the first frame update
    private void Start()
    {

        Ball = GetComponent<ball>();
        //  PlayerPrefs.DeleteKey("HighScore");
        Highscore.text = "Best :" + ((int)PlayerPrefs.GetFloat("HighScore", 0)).ToString();
        bestScore.text = "Best :" + ((int)PlayerPrefs.GetFloat("HighScore", 0)).ToString();
    }
    // Update is called once per frame
    void Update()
    {

        distance = player.position.z + 500;
        if (runningScore)
        {
            LiveScore.text = distance.ToString("0");

            //  Highscore.text = LiveScore.text;
        }
        if (runningScore == false)
        {
            float score = float.Parse(LiveScore.text);
            finalScore.text = "Score:" + LiveScore.text;
            if (PlayerPrefs.GetFloat("HighScore", 0) < score)
            {

                PlayerPrefs.SetFloat("HighScore", score);
                Highscore.text = "Best :" + score.ToString();

                bestScore.text = Highscore.text;
                AudioSource.PlayClipAtPoint(clip, Camera.main.transform.position);
            }
            else if (score < PlayerPrefs.GetFloat("HighScore", 0))
            {

                bestScore.text = Highscore.text;
            }

        }

        while (distance > 500)
        {
            Ball.speed += 5;
        }

    }

}

sentences:
What method could I use to avoid using a lookup table for each item when loading a players inventory? Let me explain a little about the pickup items and inventory to make this much clearer.

Every in world item that can be picked up has a ScriptableObject assigned to it that contains all the information about that item (id, name, description, maxstacksize, sprite etc).

When a player picks up an item it gets added to a List<InventoryItem>.  InventoryItem is a class that gets populated with some of the data pulled from the ScriptableObject (id, name, description, maxstacksize), and also gets an amount property.

I want to save the players inventory, but want to simplify the InventoryItem data.  So I created an InventoryItemSimple struct that holds the id and amount for each item in the inventory, and then save that list to file.

When loading the player inventory, currently I have a BIG list of ScriptableObjects that map to the id.  So I am looping over the saved inventory list and matching against the id in the lookup table, and then adding the item to the inventory.  I want to avoid this as over time their could be 2,000+ unique objects that could be in the world.

What's a better method to handle this?

If I stick with the lookup table, do I need to worry about how much memory is being used?  I don't think my lookup table will ever contain 2,000+ elements.  But the thought of having one massive list to manage doesn't appeal to me.

sentences:
What's the term for the "vertical looking angle" in FPSs? I guess the "vertical angle" of looking in an FPS could be called the pitch of the camera, but surely there is another term for it?

(I'm trying to mod ArmA II, but I can't find anything in their documentation and forums about the camera pitch or whatnot. The ArmA people call the horizontal angle "direction.")

sentences:
View individual UI Rect boxes when multiple UI elements are selected? I have 2D UI layout with multiple text boxes over the canvas, I need to easily be able to see where the Rect boxes for each are positioned, so that I can see where the safe areas are for placing buttons etc.

Selecting each individual item shows its own individual Rect box, but selecting multiple items just shows one big box around all of them.

Is there a way of selecting multiple items and see each individual Rect box?
It's extremely time consuming having to go and check each one individually.

sentences:
2D RGBA texture is gray in GLSL shader I have a shader to perform LUT coloring of a texture and a c++/c# programs that call it which work perfectly when i use a 1D texture.
Since i need to support computers that don't support the 1D texture in the shader i thought the easiest would be to convert the 1D texture to a 2D texture with the height==1.
After the conversion (1D -> 2D) when i run the program it seems that the LUT 2D texture is received gray in the shader. I render the exact same texture in another place (not using a shader) in the program and the texture looks fine (same as it did when i used a 1D texture).
The shader code:

uniform sampler2D FluorImage;
uniform sampler2D FluorColorLutRGBA;

void main(void)
{
  vec3 FluorPix = texture2D(FluorImage, gl_TexCoord[0].st).rgb;
  vec2 Coord = vec2(FluorPix.g, 0.0);
  vec4 NewColorFluor = texture2D(FluorColorLutRGBA, Coord).rgba;
  gl_FragColor.rgb  = NewColorFluor.rgb;
}

The texture creation code

glGenTextures(1, &m_FluorShadersParams[fpsFused].m_LutTexture);
glBindTexture(GL_TEXTURE_2D, m_FluorShadersParams[fpsFused].m_LutTexture);
glTexImage2D(GL_TEXTURE_2D, 0, GL_RGBA, 256, 1, 0, GL_RGBA, GL_UNSIGNED_BYTE, NULL);
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);

glActiveTexture(FluorTextureIndexes[fpsFused]);
glBindTexture(GL_TEXTURE_2D, m_FluorShadersParams[fpsFused].m_LutTexture);

glActiveTexture(GL_TEXTURE0);
glBindTexture(GL_TEXTURE_2D, 0);

Filling the texture with data

glActiveTexture(a_FluorTextureIndexes[fpsFused]);
glTexSubImage2D(GL_TEXTURE_2D, 0, 0, i, 256, 1, GL_RGBA, GL_UNSIGNED_BYTE, pLUT);
glActiveTexture(GL_TEXTURE0);

Calling the shader

glUseProgram(m_progObj[fsFluorFused]);

glActiveTexture(FluorTextureIndexes[fpsFused]);
glBindTexture(GL_TEXTURE_2D, FluorTextureIndexesNum[fpsFused]);
glActiveTexture(GL_TEXTURE0);
glBindTexture(GL_TEXTURE_2D, inputTextures[eftIR]); // Fluor image

glBindFramebuffer(GL_FRAMEBUFFER,outputFBO.m_FBO[eftFused]);

uniformLoc = glGetUniformLocation(m_progObj[fsFluorFused], "FluorImage");
if (uniformLoc != -1)
{
  glUniform1i(uniformLoc, 1);
}

uniformLoc = glGetUniformLocation(m_progObj[fsFluorFused], "FluorColorLutRGBA");
if (uniformLoc != -1)
{
  glUniform1i(uniformLoc, FluorTextureIndexesNum[fpsFused]);
}

glClear(GL_COLOR_BUFFER_BIT);

glBegin(GL_QUADS);
 glTexCoord2f(0,    fTextureRatioY);
 glVertex2f(0,      fTextureRatioY);
 glTexCoord2f(fTextureRatioX,   fTextureRatioY);
 glVertex2f(fTextureRatioX,     fTextureRatioY);
 glTexCoord2f(fTextureRatioX,   0);
 glVertex2f(fTextureRatioX,     0);
 glTexCoord2f(0,        0);
 glVertex2f(0,          0);
glEnd();

glUseProgram(0);
glActiveTexture(GL_TEXTURE0);

glBindFramebuffer(GL_FRAMEBUFFER,0);
glBindTexture(GL_TEXTURE_2D,0);

The strange thing is that if i change all the places in the code back from Texture2D into Texture1D and the sampler in the shader to 1D everything works great.
Anyone has any idea where the issue can be?

sentences:
How to extract terrain heightmap from some free online map (OpenStreetMap,GoogleMaps, NASA WinWorld etc.) I downloaded some small tile ( 10x10km ) from OpenStreetMap but I don't see what is the simplest way how to get actuall heightmap like this out of .osm file.

I'm looking to Python OSM API  but I don't see anything about height/altitude channel. Also OpenStreetMap wiki-page about relief and altitude is not very helpful.

In these two projects
pyvotons and
Shadow Mapper
they seem to do it somehow, but I hesitate to dig into
their code, if there is simpler answer.

sentences:
How do I create a single tile in Unity 2019+ I going through the "Ruby's Adventure: 2D Beginner" tutorial, chapter 4, section 3 with Unity 2019.11.

In the tutorial you create a folder for tiles and you are then supposed to right-click in the asset folder and select "Create > Tile" from the menu. There's even a screenshot showing the menu where the option is right below the sprite sections.
However, in version 2019.11 of unity, there is no such option :)

I checked the documentation, and for 2019.3 and 2020.1 the manual states that this should be possible via the assets menu   (there's no docs for 2019.11 specifically), but my Unity editor doesn't have the option.

It seems unlikely that the option is just missing from my version, so I'm guessing something about my project setup is wrong. Is there anything special I need to set up to have the project support tiles?

Edit: I found the feature in the 2018 LTS version. I'm new to Unity, so maybe out of date documentation is the norm.

sentences:
My trigger does not detect my player My trigger does not detect my player.
My Trigger.cs file:
using UnityEngine;

public class Trigger : MonoBehaviour {

public Camera camera1;
public Camera camera2;
public GameObject panel;

 void OnTriggerEnter(Collider other)
{
    camera1.enabled = false;
    camera2.enabled = true;
    panel.SetActive(true);
    Debug.Log ("Entered-");
}

 void OnTriggerExit(Collider other)
{
    camera2.enabled = false;
    camera1.enabled = true;
    panel.SetActive(false);

}
private void Update()
{
    if(Input.GetKeyDown(KeyCode.DownArrow) || Input.GetKeyDown(KeyCode.S))
    {
        panel.SetActive(false);

    }
            }

}

Where I can start troubleshooting te issue?

Object on which the trigger script is sitting on.

 The solution:
-- I created two colliders, and assigned one as a collider, the other (bigger) is a trigger.  -- I also had problems with the small triggers in the scene. The triggers were to small to be detected by my main player, althought
they detected my "sphere" player object

sentences:
How to check the device type using Adobe AIR for iOS How do I check what kind of device the user is running my Adobe AIR app on?

Example: if(device == ipad3) { stagestuff.width = 300; }

sentences:
SimpleOpenNI: Check if user hand is in specific area on image Concerning our Microsoft Kinect project, we need some help.

We control a robot with our movements tracked by the Kinect sensor. We display the depth image of the Kinect sensor on our screen, so we see what the sensor is acutally tracking.

Now we want to implement a feature that a user can turn the robot on and off by moving the hand on a specific area drawed on this depth image. You can see this in the image below. The problem now is, that the coordinates of this "on-drawed" ellipse obviously are relative in the 3d-space.  I know that there must be any possibility to translate the X-, Y- and Z-coordinates of the hand in the 2d-space, but honestly, I have no idea how to do this. I imagine a kind of "tunnel" from the point of view of the sensor, like in the picture below, which the user must hit.

I hope that somebody can help us here.

sentences:
What is Ogre::String? I was working with the OGRE .NET bindings (MOGRE) for quite a long time. To improve my (not that good) C++ skills, I am switching from C# to C++.

After implementing a basic OGRE application, I was curious why Ogre has it's own String class Ogre::String?
Why is it used and not std:string?

Can/shall I mix these String types and what shall I use in my OGRE application for non-OGRE tasks/methods?

sentences:
PIXI v4 - Is possible to disable Multi Texture Batching in PIXI v4 ? I would like to know if is possible to disable the multi texture batching in a PIXI V4 game.

Recently i jus update my game PIXI lib from version 3 to 4.2. I`m using cocoon Canvas + . It seems perfect on iOS and android version greater than 5.
In a old phone the texture batching is messing with the textures.

https://www.youtube.com/watch?v=t6wVYRm731I&feature=youtu.be

Please. Is possible to disable it.

I already tried

PIXI["settings"].SPRITE_MAX_TEXTURES = 1;
PIXI["settings"].SPRITE_BATCH_SIZE = 1024;

without success

sentences:
Unity - Particle System Shuriken - Setting particles in code with random row in texture animation? Good day, I'm attempting to randomly generate a space scene (quite large actually) in Unity through C# code mainly. So far, I've gotten stunning results up to what image #2 will show you. However, now I'm looking to expand the look with more random particles. So, I've made a texture atlas of 8 in a vertical row, which works on the random setting if you have an emitter and the particle system is called with PS.Play();

Assigning different materials would only work on a per particle system basis(which would be new texture PER cloud, so to speak) which is not what I want. So, my question:

How can I use the Shuriken Particle System's Texture Sheet Animation functionality through code, without having an "active" particle system? More precisely, I wish to use the 'Random Row' feature of it to assign random textures to each particle.

Since I can't share my code (due to policies), here is a bit more info on how I do it:

I create an array with coordinates for each cloud.
Assign a particle system to that cloud.
Randomly generate all the particles for the cloud with relative offsets.
Use PS.setParticles(particlesArray);

Using a Texture Atlas consisting of the letters A to H to test, only B showing on all particles.

Using a Texture Atlas consisting of the fog particles to test, only 2nd showing on all particles.

Thank you @DMGregory for the help, I've tested it multiple times and it works perfectly now, I've also went ahead and tweaked a few of my settings just to get a more "clear" space:

sentences:
How to fetch only the sprites in the player's range of motion for collision testing? (2D, axis aligned sprites) I am working on a 2D sprite game for educational purposes. (In case you want to know, it uses WebGl and Javascript) I've implemented movement using the Euler method (and delta time) to keep things simple. Now I'm trying to tackle collisions.

The way I wrote things, my game only has rectangular sprites (axis aligned, never rotated) of various/variable sizes.

So I need to figure out what I hit and which side of the target sprite I hit (and I'm probably going to use these intersection tests). The old fashioned method seems to be to use tile based grids, to target only a few tiles at a time, but that sounds silly and impractical for my game. (Splitting the whole level into blocks, having each sprite's bounding box fit multiple blocks I might abide. But if the sprites change size and move around, you have to keep changing which tiles they belong to, every frame, it doesn't sound right.) In Flash you can test collision under one point, but it's not efficient to iterate through all the elements on stage each frame. (hence why people use the tile method).

Bottom line is, I'm trying to figure out how to test only the elements within the player's range of motion. (I know how to get the range of motion, I have a good idea of how to write a collisionCheck(playerSprite, targetSprite) function. But how do I know which sprites are currently in the player's vicinity to fetch only them?)

Please discuss. Cheers!

sentences: How do I save variables and load them in Unity with JavaScript? I made a game and i want to save the high score and load it back. I need to save 3 variables and load them when the game starts. How do i do it?

sentences:
Unity 2D Player Shoots at my joystick position Hi I am new to unity and have only a little coding knowledge.
Right now I have made my character shoot at my touch position on mobile but when ever I touch the joystick, whick I use to move my character, he shoots there, what should I do to make him not shoot at the joystick when i hold the joystick, any suggestion... heres my code.
Shooting code
public class Shooting : MonoBehaviour
{
    public GameObject shot;
    private Transform playerPos;

    void Start()
    {
        playerPos = GetComponent<Transform>();
    }
    void Update()
    {

            if (Input.GetTouch(0).phase == TouchPhase.Began)
            {
             Instantiate(shot, playerPos.position, Quaternion.identity);
            }
            else if (Input.GetTouch(1).phase == TouchPhase.Began)
            {
                Instantiate(shot, playerPos.position, Quaternion.identity);
            }
        else if (Input.GetTouch(2).phase == TouchPhase.Began)
        {
            Instantiate(shot, playerPos.position, Quaternion.identity);
        }

    }
}

Projectile Code
public class Projectile : MonoBehaviour
{
    private Vector2 target;
    public float speed;
    private Shake shake;
    void Start()
    {
        shake = GameObject.FindGameObjectWithTag("ScreenShake").GetComponent<Shake>();
        target = Camera.main.ScreenToWorldPoint(Input.GetTouch(0).position);
        target = Camera.main.ScreenToWorldPoint(Input.GetTouch(1).position);
        target = Camera.main.ScreenToWorldPoint(Input.GetTouch(2).position);
    }

    // Update is called once per frame
    void Update()
    {
        transform.position = Vector2.MoveTowards(transform.position, target, speed * Time.deltaTime);

        if(Vector2.Distance(transform.position, target) < 0.2f)
        {
            Destroy(gameObject);
        }

    }
    void OnTriggerEnter2D(Collider2D other)
    {
        shake.CamShake();
    }
}

Thanks in advance

sentences:
Isometric projection start point I have a question about isometric projection: Why did in all tutorials and examples start point for isometric is in left top corner ?
For example in cocos2d 3.1 my start screen point in left bottom, so left top isometric position will nearly 1500,1500. So is it normal to make start isometric point in left bottom corner ? i mean :

x,y
0,3 1,3 2,3
0,2 1,2 2,2
0,1 1,1 2,1
0,0 1,0 2,0

or better

0,0 1,0 2,0
0,1 1,1 2,1
0,2 1,2 2,2
0,3 1,3 2,3

sorry for stupid question

sentences:
How to change transform.position.x after a state is changed? When I press attack button, player will change to Normal Attack state to perform Normal Attack animation and you will notice the player seem like step back a little bit as the width of sprite for Normal Attack animation is longer than Idle animation.

http://youtu.be/hnPXt-kprqQ

To solve this issue. I need to change the transform.position.x =+ 0.5 to move a bit further to match the position of Idle animation stands and transform.position.x =- 0.5 when Normal Attack state done its animation and back to Idle state.

How can I perform transform.position.x =- 0.5 when when Normal Attack state done its animation and back to Idle state?

sentences: Which version of AndEngine (gles1 or gles2) should I learn? I m new to Game Development. I've chosen AndEngine, but there are 2 versions: gles1 and gles2. I tried sample code from both and found that gles2 code is not run on an emulator, but required an actual device. And in gles2 there are also BaseGameActivity and SimpleBaseGameActivity. I'm a little confused. Which is best?

sentences:
How to run around another football player I have finished a simple 2D one-on-one indoor football Android game. The thing that it seemed so simple to me, a human being, turned out to be difficult for a computer: how to go around the opponent …

At the moment the game logic of the computer player is that if it hits into the human player will step back few points on the pixel greed and then try again to go towards the ball. The problem is if the human player is in-between then the computer player will oscillate in one place, which does not look very nice and the human opponent can use this weakness to control the game.  You can see this in the photo – at the moment the computer will go along the red line indefinitely.

I tried few ideas but it proved not easy to do it when both the human player and the ball are constantly moving so at each step computer would change directions and “oscillate” again. Once when the computer player reaches the ball it will kick it with certain amount of random strength and direction towards the human’s goal.

The question here is how to formulate the logic of going around the ever moving human opponent and how to translate it into the co-ordinate system and frame by frame animation… any suggestions welcome.

sentences:
Getting around limitations posed by float in space game I'm working on a procedurally generated game set in outer space. As in the real world, the game universe will be pretty much 99% empty, with planets/stars/solar systems etc... being very far apart.

For example at the beginning of the game, you will pretty much be stuck in the solar system you spawn in, as even flying from planet to planet will take a very long time. Flying from one solar system to another will be theoretically possible, however it would take days of IRL time without obtaining the in-game equivalent of a warp-drive.

I realize with all the thousands of planets/stars etc... they can't all be updated 60 times per second, and I can deal with that. Let me describe my problem.

Okay, so lets say 1 meter is 16 pixels.

Earth diameter      =  12,756,000 meters
Earth diameter      = 204,096,000 pixels
Earth circumference = 640,861,440 pixels

Okay, that's... still arguably manageable. Obviously there wouldn't be an earth.png, it could be procedurally rendered. But it gets worse:

Distance from earth to sun =   149,600,000,000 meters
Distance from earth to sun = 2,393,600,000,000 pixels

So if we define earth as our arbitrary origin, and we travel to the sun in our ship:

int main()
{
    //        Distance to sun:
    //        2393600000000
    float X = 2383695718491;
    std::cout << X << "\n";

    X += 6;
    std::cout << X << "\n";
}

This outputs:

2.3837e+012
2.3837e+012

That's the correct amount of zeroes, but now over 4 million pixels of precision is lost, and that's a big deal. And of course, the distance to the sun is tiny compared to the distance to the nearest star.

For the purpose of the game universe, I will decrease the distances just to make travel a little less boring, but this is still clearly impossible by only using x and y variables.

How should I handle these huge distances?

UPDATE: Just to clarify, I realize that earth is unimaginably huge and there's no way I'd be able to fill it with meaningful content. GTA V's map is about 100 square miles, and that's less than .00000005% percent of earth's surface. So my planets will definitely be significantly smaller than this, however the issue with huge distances remains.

sentences:
Static spawning locations for players, creatures, items in Tiled map editor I am using Tiled map editor. I am trying to add static spawning locations (x,y) for various entities (lets say 15) in my game. The best idea I had so far is something like this:

I am using a polygon collider named Player to declare the spawn location of the player. The width and height of this box is irrelevant. I have placed all "spawning colliders" in the same layer. I am using the Name tag to identify the type of the object.

This works fine, however, inside the editor, I would like to be able to see the type of entity (Player, monster, item, etc.) without having to select the polygon collider and look at the Name tag each time.

If I continue doing this I am going to end up with 100 grey boxes one next to the other. Is there any way of adding an indication on the collider that would represent its type (Player, monster, item, etc.) ?

sentences:
Video feedback effect with recursive RenderTextures in Unity 2018.3 I have a project where I'm playing with a video feedback effect by rendering a camera to a RenderTexture and pointing the camera at a quad displaying that RenderTexture.

This works great normally, but when trying out HDRP, LWRP, (and upgrading materials) or upgrading the entire project to 2018.3, the RenderTexture just stops working and shows black. I also tried with a completely new project and just had a camera, a quad, and a cube. That also didn't work.

Is there any obvious reason this wouldn't be working? I spent a while trying out various settings but couldn't find anything that had any effect, so I really don't even know where to start.

sentences:
Java: Updating entities in composite design I'm trying to move beyond inheritance based design, but I've been doing it like that for 6 years. My current hurdle is this: What's the simplest( or proper) way to update all my objects? Before, everything was a subclass of an Entity class. It was as simple as throwing them into ArrayList and iterating through them all, calling update() on each object. How does this translate in composition? Where the Entity class is within classes that can't be simply passed as each other.

for(Entity e : Entites) // I know this is bad practice, but good for an example
    e.update();
// e could be any subclass of entity

Since moving to a component - composition based system I can't do that, as each game object is it's own class. I can't make an ArrayList of my objects and call update on each of them. And as far as I know,

My game objects are setup like this

class Apple implements iEntity {
    Entity  innerEntity;
    public Apple{
        innerEntity = new Entity(1); // 1 represents Apple as an identifier
    }
    @override // From iEntity
    public void update(){
    }
}

Because Apple no longer extends Entity, I can't load it into an ArrayList with Pears(example). All my other objects are similar. Id' rather not make a AppleManager class for Apples, a PearManager for Pears, and build functionality between them. That just seems messy.

Maybe I'm missing a few points, but that's why I'm here. Before this gets closed for some obscure reason, I googled the heck out of this. Each article explained the advantages of a system like this, but failed explaining beyond that. Thanks and advance dudes.

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:
Godot: How do I asign movement cost to tiles in a Tilemap? Pathfinding

I am trying to apply godot's Navigation to create a pahtfinding enemy in a Platformer game. I've read about a method to allow for pathfinding to take into account gravity.

My issue is that what I know I must do is to add more movement cost to higher tiles.

How do I do this?

EDIT

I have since found the documentation for the Astar Node. Wish me luck.

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:
Determine whether a shape formed from a series of other shapes is 'unbroken' I have a grid of tiles in a game and each tile can have a certain simple shape on it.

I want to be able to determine whether the combined shape from any given arrangement of these tiles results in an 'unbroken' or 'broken' larger shape.

For example; this is an example of an 'unbroken' shape...

And this is an example of an 'broken' shape...

I'll be able to write the necessary code once I figure out the logic of this problem, but so far I've been struggling.

I've tried data tables associated to each tile that describe it's edges, for example :

var edges = {
    top : false,
    right : true,
    bottom : true,
    left : false
}

And from this I can determine whether each tile is 'connected' to it's neighbours. But this doesn't help for all situations.

EDIT 1:
Multiple clusters of isolated 'unbroken' shapes would be considered a 'broken' shape...

EDIT 2:

Also, an 'unbroken' shape can be achieved if a shape tile's edge is not connected to every neighbouring tile, it can be just one connection. For example I would consider this to be 'unbroken' ...

Anyone got any ideas on this?

sentences:
XNA/MonoGame and Game Studio/MonoDevelop First off, I have a bit of programming experience in Java and have always programmed using ViM (even though I recently moved to Sublime Text 2) and I'm trying to learn C# and the MonoGame framework. My question is whether or not I REALLY need MonoDevelop.

So, do I really need Visual Studio/MonoDevelop to develop games in C# and MonoGame?

sentences:
How do I use _com_ptr_t with RenderTargetView and DepthStencilView? I have successfully used _com_ptr_t with the ID3D11Device and IDXGISwapChain but when applying the same reasoning to the RenderTargetView and DepthStencilView, the function m_spD3DImmediateContext->OMSetRenderTargets(...) sets the m_spRenderTargetView smart COM pointer to null! Then, subsequent draw calls fail on ClearRenderTargetView and ClearDepthStencilView.

Is it because I am passing the smart pointer incorrectly?

HR(m_spD3DDevice->CreateRenderTargetView(pBackBuffer, 0, &m_spRenderTargetView));
...
HR(m_spD3DDevice->CreateTexture2D(&stDepthStencilDesc, 0, &m_spDepthStencilBuffer));
...
m_spD3DImmediateContext->OMSetRenderTargets(1, &m_spRenderTargetView, m_spDepthStencilView);
assert(m_spRenderTargetView); // <=== FAIL

I think the smart pointer overloads the operator& so that it returns an Interface** (see Extractors in _com_ptr_t class).

sentences:
Texture dimensions guidelines I have 3 related questions:

What are the main optimizations related to power of 2 dimensions for 1D/2D/3D textures? This question gives some answers like mipmapping, but are not well explained and the list of optimizations does not seem to be complete. I want a complete ordered list from most important to less of the optimizations with complete explanations, with references replacing full explanations only where full explanation would overwhelming, and proper references (paper/graphics official page [OpenGL/Vulkan/CUDA]) for every statement about explained optimization. When the comparation is not direct, take a guess based on the one that would improve overall performance most in majority of computer graphics applications. Furthermore I want to specify which of this optimizations are available at least for OpenGL and CUDA. More specifications would be acclaimed.
What benefits exists for divisible by 8 dimensions? This article states the rule as an alternative/complement to the power of 2 one but does not give explanations nor references.
Is there any benefit for divisibility by a larger number? This article uses divisible by 32 dimensions. I know that CUDA has a warp size of 32 and that blocks should be multiple of 32 to have a good overall average utilization, but I do not know if this could be related to texture sizes and would like to know if the answer is no.

In many places posibilities for texture optimization are loosely stated and not properly documentated. This question aims at solving this issue.

sentences:
Trouble getting shadow maps working I am trying to implement shadow maps in my game following this tutorial. For some reason, the light is not being occluded.

In the above screenshot, the big white sprite in the foreground is a rendering of what the occlusion map looks like. In the background, you can see the result does not produce any shadows. It's hard to see, but in the top left it shows the shadow map.

Enlarged version of the shadow map:

The occlusion map and the shadow map seem to be generating correctly, so it must be an issue with how I'm taking it into account when rendering the light. Here is the fragment shader for the light:

#version 330

uniform sampler2D uDiffuseTexture;
uniform sampler2D uNormalsTexture;
uniform sampler2D uShadowMap;

uniform vec4 uLightColor;
uniform float uConstAtten;
uniform float uLinearAtten;
uniform float uQuadradicAtten;
uniform float uColorIntensity;

uniform vec4 uAmbientColor;

in vec2 TexCoords;
in vec2 GeomSize;

out vec4 FragColor;

float sample(vec2 coord, float r) {
    return step(r, texture2D(uShadowMap, coord).r);
}

float occluded() {
   float PI = 3.14;

   vec2 normalized = TexCoords.st * 2.0 - 1.0;
   float theta = atan(normalized.y, normalized.x);
   float r = length(normalized);
   float coord = (theta + PI) / (2.0 * PI);

   vec2 tc = vec2(coord, 0.0);
   float center = sample(tc, r);

   float sum = 0.0;

   float blur = (1.0 / GeomSize.x) * smoothstep(0.0, 1.0, r);

   sum += sample(vec2(tc.x - 4.0*blur, tc.y), r) * 0.05;
   sum += sample(vec2(tc.x - 3.0*blur, tc.y), r) * 0.09;
   sum += sample(vec2(tc.x - 2.0*blur, tc.y), r) * 0.12;
   sum += sample(vec2(tc.x - 1.0*blur, tc.y), r) * 0.15;

   sum += center * 0.16;

   sum += sample(vec2(tc.x + 1.0*blur, tc.y), r) * 0.15;
   sum += sample(vec2(tc.x + 2.0*blur, tc.y), r) * 0.12;
   sum += sample(vec2(tc.x + 3.0*blur, tc.y), r) * 0.09;
   sum += sample(vec2(tc.x + 4.0*blur, tc.y), r) * 0.05;

   return sum + smoothstep(1.0, 0.0, r);
}

float calcAttenuation(float distance) {
    float linearAtten = uLinearAtten * distance;
    float quadAtten = uQuadradicAtten * distance * distance;

    float attenuation = 1.0 / (uConstAtten + linearAtten + quadAtten);

    return attenuation;
}

vec3 calcFragPosition(void) {
    return vec3(TexCoords*GeomSize, 0.0);
}

vec3 calcLightPosition(void) {
    return vec3(GeomSize/2.0, 1.0);
}

float calcDistance(vec3 fragPos, vec3 lightPos) {
    return length(fragPos - lightPos);
}

vec3 calcLightDirection(vec3 fragPos, vec3 lightPos) {
    return normalize(lightPos - fragPos);
}

vec4 calcFinalLight(vec2 worldUV, vec3 lightDir, float attenuation) {
    float diffuseFactor = dot(normalize(texture2D(uNormalsTexture, worldUV).rgb), lightDir);

    vec4 diffuse = vec4(0.0);
    vec4 lightColor = uLightColor * uColorIntensity;

    if(diffuseFactor > 0.0) {
        diffuse = vec4(texture2D(uDiffuseTexture, worldUV.xy).rgb, 1.0);
        diffuse *= diffuseFactor;
        lightColor *= diffuseFactor;
    } else {
        discard;
    }

    return (uAmbientColor + diffuse + lightColor) * attenuation;
}

void main(void) {
    vec3 fragPosition = calcFragPosition();
    vec3 lightPosition = calcLightPosition();

    float distance = calcDistance(fragPosition, lightPosition);
    float attenuation = calcAttenuation(distance);

    vec2 worldPos = gl_FragCoord.xy / vec2(1024, 768);
    vec3 lightDir = calcLightDirection(fragPosition, lightPosition);

    lightDir = (lightDir*0.5)+0.5;

    float atten = calcAttenuation(distance);
    FragColor = calcFinalLight(worldPos, lightDir, atten) * vec4(vec3(1.0),
    occluded());
}

sentences:
Selling Android apps from Android-Market-unsupported countries I am in Latvia (which the Android market doesn't support as a country for selling apps from), and I am thinking about the best way of monetizing my app. So far I've come up with these options:

Pretend I am from a supported country. Get a bank account there, etc.
Use PayPal for in-app purchases. The player gets, say, the first 10 levels for free, but is then asked to pay 0.99$ for the rest of the game. Downside: Players might not feel comfortable entering PayPal details into an app. Android market might not like it either.
Making the app free and earning money through advertising. Let's do some calculation here: Say I get 1M free downloads, each user during his playtime would see 10 banners, so 10m / 1000 * 0.3 is about 33k$ if we use AdMob with their 0.3$ per 1000 impressions. On the other hand, if we use PayPal and in-app purchases, we need a >3% conversion rate to beat this..

What should I do?

Edit: From what I just read all over the net, it looks like advertisers will change their eCPM price a lot without telling you. Using in-app PayPal purchases at least allow you to monitor the cash flow.

sentences:
Google Games Services Display Orientation I'm developing a game using LibGDX and I'm using BaseGameUtils to implement Play Games Services in it. It's working very well. But my game is in landscape mode, so when I call leaderboard or achievements it opens up in landscape mode. I don't want that. I want the games services to open in portrait only. There's no entry of BaseGameUtils in my manifest file and I checked the Android Manifest file in BaseGameUtils module, but there's no <activity> in there.

How can I change the orientation when games services is displayed?

sentences:
How to set the Y position of Camera to another object's y position, but only once, not continuously? Essentially, I want to set the camera's Y position to another GameObject's Y position, but I only want to do this one. If you do

cam.transform.position = new Vector3(0, thing.transform.position.y, 0),

it will continuously update to that object's y. Even if I store the Y float in a variable and set the camera's y to that it still continuously updates. It is only supposed to happen once.

sentences:
How to draw a line in 3d space? I have a top down billiard game. And on click / tap the ball moves in the clicked direction like in the image below:

Now, I want a line to be drawn in the direction where the mouse is hovers or the finger is swiped, here is my update code:

void Update () {

        //this should make the line, why not working?
Vector3 forward = transform.forward;
Debug.DrawRay(transform.position, forward);
Debug.DrawLine(transform.position, transform.position + forward * 10000);

        if (Input.GetMouseButtonDown (0)) {

            //
            Ray ray = Camera.main.ScreenPointToRay(Input.mousePosition);
            RaycastHit hit;

            if (Physics.Raycast(ray, out hit, 100.0f)){

                //

                //
                Vector3 startPos = transform.position;
                Vector3 clickPos = new Vector3(hit.point.x, hit.point.y, transform.position.z);
                Vector3 direction = Direction (clickPos - startPos);

                //direction
                rb.velocity = new Vector3(direction.x * 5, direction.y * 5, 0);

            }

        }

    }

I tried DrawLine, Drawray, any ideas?

sentences:
How to implement this kind of ripples with a GLSL fragment shader? So I have already implemented the reflection part:

uniform sampler2D texture;
uniform vec2 resolution;
uniform vec3 overlayColor;

void main()
{
vec2 uv = gl_FragCoord.xy / resolution.xy;

if (uv.y > 0.3)// is air - no reflection or effect
{
    gl_FragColor = texture2D(texture, vec2(uv.x, uv.y));
}
else
{
    // Compute the mirror effect.
    vec4 color = texture2D(texture, vec2(uv.x, 0.6 - uv.y));
    //
    vec4 finalColor = vec4(mix(color.rgb, overlayColor, 0.25), 1.0);
    gl_FragColor = finalColor;
}
}

source

Now the question is how are these ripples implemented?

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:
Draw a sphere with a custom material from script How can I spawn or draw a sphere with a custom material with a script?

So far I've tried using Gizmos.DrawSphere, but I can't find a way to control the material used to draw it.

I would like to draw it with a material with some specularity, around 0.5.

sentences:
Finding the line segments where 2 polygons share an edge I am working on code to place doors between rooms on my levels.  Rooms are lists of points which make up a polygon.  In order to find a place for a door between two rooms, I need to find what line segment(s) are along the edge of both polygons.  Here are some examples, where I would need to identify the highlighted segment(s):

The code which generates the room polygons will always create polygons that don't overlap, but only touch.  How would I go about finding a shared edge like this?  I am using Godot with the built-in scripting language, but the language doesn't matter as much as the algorithm itself.

sentences:
Why won't Unity drop objects to the origin position? It seems that my objects drop to the middle of the scene, not a global position of (0, 0, 0).

Why is Unity behaving like this?

sentences:
OpenGL - Updating VAO array buffer range I am trying to stream data to a buffer which I have bound to a VAO vertex buffer binding point that I want to access through vertex attributes in the shader.

Usually I stream to buffers which I have bound as GL_UNIFORM_BUFFERs and I do it like this:

//create an immutable data storage
glNamedBufferStorage(uboID, capacity, data, GL_MAP_WRITE_BIT | GL_MAP_PERSISTENT_BIT | GL_MAP_COHERENT_BIT);

//map entire storage forever
mappedPtr = glMapNamedBufferRange(uboID, 0, capacity,  GL_MAP_WRITE_BIT | GL_MAP_PERSISTENT_BIT | GL_MAP_COHERENT_BIT);

//bind buffer to target(GL_UNIFORM_BUFFER) binding point
glBindBufferBase(GL_UNIFORM_BUFFER, uboBinding, uboID);

//bind shader interface block to target binding point
glUniformBlockBinding(shaderProgramID, blockIndex, uboBinding);

Now the uniform block can be accessed in the shader program and i can stream to it like so:

//copy data to mapped pointer at stream offset
memcpy(mappedPtr + uploadOffset, &uploadData[0], uploadSize);

//This is the important part: tell the shader which range of the buffer to use
glBindBufferRange(GL_UNIFORM_BUFFER, uboBinding, uboID, uploadOffset, uploadSize);

//increment offset
uploadOffset += uploadSize;

If I bind a buffer to a VAO and access its data as vertex attributes in the shader, I don´t know how to give the shader the range in which the updated data can be found. I can give an offset when binding a buffer to a VAO when calling glVertexArrayVertexBuffer, but it has a few more parameters and does not seem like the right thing to call every frame. I have not gotten it to work with it, too.

Is there something like glBindBufferRange for vertex buffers bound to VAOs?

sentences:
Web single player 2d top-down RPG - background image, sprites, and new level loading I'm making a web single player 2D top-down rpg using JavaScript (create js library) and have a couple questions.

For the background image, I've currently loaded a 1000x1000 bitmap to represent the background for my rpg world (per level). It's drawn in relation to the camera (aka the canvas - 500x500) so not all of it is on the screen at the same time. If it's not on the screen, is it still using resources to be drawn? I eventually want to have a much larger "world", which will require a much larger bitmap... What is the best way to load a background image?

And what about sprites? I'm assuming if I create several sprite objects with bitmaps... even if they aren't on the camera, they are still using resources? This may slow down the game.

Level loading: If I walk to another level, or go inside a building, I'd like to load that bitmap... Is there a specific way to architect level loading?

Thank you!

sentences:
Coherence between 2d tile maps In dwarf fortress, there are  3 levels of maps in the screen you pick your starting position, and they all coincide with each other perfectly. I am assuming that the top level tile accounts for lets say 36 smaller map blocks, and when the player spawns on the map, that is just a noise value at a different level or frequency of even more tiles.

The selection screen looks like this:

How is such a level of coherence achieved? It doesn't seem like simply adjusting noise frequency/octave values would work perfectly, or maybe it does, I am just not grasping the workflow properly?

sentences:
My GUI stopped working? Okay I bought this asset online so I would like not to show the whole script. The problem is this asset stopped working when I updated from unity 5.0 to 5.1.2. The script is for a controller GUI interface but it seems to be giving me an error :

  NullReferenceException: Object reference not set to an instance of an
  object UnityEngine.UI.Selectable.Select ()

on this line of code :

selectedOject.GetComponent<Button> ().Select ();

so there is a null reference and its no longer recognizing the child objects as buttons is what I'm assuming

if you want to have a better look at his set up he has a short video On youtube :
HERE

I would like to continue to use this script and continue updating Unity.

sentences:
Low fps on Arm Mali GPU I was trying to google and understand my problem in two weeks but i am defeated, so i am asking for help.

The main problem is that my custom unlit frag shader after certain amount of time on devices with mali gpu starts to drop fps - i see it via fps counter in the cpu section. I dont know why in that section and not in render section, but with out this fps counter i can still feel the drop of fps.

So on Samsung S4, Samsung sm-t 380, xiaomi redmi note 5, samsung tab s2 is all ok, the drop was only on samsung s6 - to solve the problem i just half the resolution by Screen.SetResolution function.

I was thinking that drawing the full screen sprite on such a high res device is the point. Then i can test app on samsung sm-t580 - and the drop was there - this device has low resolution than S6.

I assume that the problem in arm mali gpu - or i am sure in my hands.

So again, i am rendering full-screen with draw-mode = tile(countinuous) sprite with 3 textures, just changing theirs uvs in vert func and apply in fragment. This makes distorting effect. The shader show that i have 10 maths and 4 textures, yes 3 textures but i am making 4 sampling.

The textures are 256x256 with repeat mode. I was trying diferrent textures compressions, dxt5, etc1-2, alpha8, R5 - no effect.

I was trying to different precisions half and float in different parts in shader - no effect.

I was thinking in alpha, so i took textures without alpha and not getting it from tex2D. Even the size of textures is doesnt matter, even if they 64x64.

The dance with ZTest, ZWrite, Blend, Queue RenderType, other params - no effect.

My guess was that maybe on mali uv : TEXCOORD0 must be only float2, not float3 or float4 - no effect.

I am applying _Time.y and replace it with float from script - no effect.

Only reducing amount of tex2d in shader - is working. Why?

What i`m doing wrong?

sentences: How to rewind time on just the main character? I have a 2D sidescrolling game and I want the character to be able to rewind time on him if he messes up. I don't want anything else to change, just the main character's position. Any idea how I can do this?

sentences:
How are walkable regions determined, and movements handled on a 3D map? I've created a 3D scene with both indoor and outdoor parts. The outdoor part has bridges and caves also.

How is it possible to handle player movements on it?

My intuition is: To determine the walkable regions, I could create a large grid. If the normal under the segment is not too steep, then it is walkable. If the difference between the heights of two neighboring segments in not large, then the player can move between them.

My solution is far from optimal. It would consume a lot of memory, and it can't handle situations, when there are multiple walkable regions on the same XZ position (for example a bridge over a valley)

How to manage movements effectively? How is it solved in game engines like Unreal or Unity?

sentences: What solutions are available for 3d character creation/editing in games? Many RPGs and MMOs offer a system for creating a character model, with varying levels of customization. Are there any open source libraries for this? Any libraries which can be licensed? Has anyone built anything related to this themselves?

sentences:
How far do I take Composition? (Although I'm sure this is a common problem I really don't know what to search for. Composition is the only thing I could come up with.)

I've read over and over that multiple inheritance and subclassing is really, really bad, especially for game entities. If I have three types of motions, five types of guns, and three types of armoring, I don't want to have to make 45 different classes to get all the possible combinations; I'm going to add a motion behavior, gun behavior, and armor behavior to a single generic object. That makes sense.

But how far do I take this?

I can have as many different types of behaviors as I can imagine: DamageBehavior, MotionBehavior, TargetableBehavior, etc. If I add a new class of behaviors then I need to update all the other classes that use them. But what happens when I have functionality that doesn't really fit into one class of behaviors? For example, my armor needs to be damageable but also updateable. And should I be able to have use more than one type of behavior on an entity at a time, such as two motion behaviors?

Can anyone offer any wisdom or point me in the direction of some useful articles?

Thanks!

sentences: How to rotate an object around one end of line till its lies on the line From the image below, I would like to rotate a game object C around a point A of a line (made using a line renderer) by an angle d to position p1 till C is on the same line joining points A and B over a given period of time. Preferably using a coroutine. Please note that the angle d is not known. How can I achieve this?

sentences:
Collaborative Diffusion vs. A* for loose armies combat: any clear winner? Collaborative Diffusion (CD) takes a lot of the work that A* does and combines (writes) it cheaply for multiple agents to read cheaply. This is because the majority of CD's processing works via a simple CA / diffusion approach that produces a single shared map for every agent to use on a given game update. Agents then perform hill-climbing within that space, which is also very cheap.

The primary downside is that the data structure created by CD must apply for all agents; that is, each agent's subjective view of the environment is identical; A* OTOH needs a path calculation per agent, each frame. In spite of this, the relatively low cost associated with CD would seem to make it, on average, a far more suitable approach than A*, even when we must create unique views for agents (comments / experience on this are welcome).

EDIT Consider the following example using Collaborative Diffusion:

Two armies are on a battlefield, each army emitting a uniform scent. They charge (climb the scent gradient), and as the two lines clash, each agent takes on the first, closest enemy agent on the opposing line. This happens because on each approach step for each unit, it checks whether it's yet adjacent to an enemy; if so it locks on / attacks indiscriminately. This is much freer than specific targeting, which is where A* would seem to be a better choice.

Am I correct in these assumptions? Are there other downsides to CD as opposed to [insert your flavour of] A*, for selecting ANY target between large groups?

sentences:
Water reflection xna I'm actually trying to do the reflection map for my water component, but even following the riemer's tutorial about reflection map the formulas provided doens't work. http://www.riemers.net/eng/Tutorials/XNA/Csharp/Series4/Reflection_map.php

I've read somewhere on the Internet that riemer uses Z-axis as UpVector, and I'm using the Y-axis instead.

So my system for now is somethink like this:

private void DrawReflectionMap()
{
        this.GraphicsDevice.SetRenderTarget(this.reflectionMap);
        this.GraphicsDevice.Clear(ClearOptions.Target | ClearOptions.DepthBuffer, Color.Black, 1.0f, 0);

        if (this.CameraPosition.Y > this.Options.Height)
        {
            Matrix reflectionMatrix = Matrix.Identity;

            // Camera position
            Vector3 reflectionCameraPosition = this.camera.Position;
            reflectionCameraPosition.Y = -this.camera.Position.Y + this.Options.Height * 2;

            // Camera target
            Vector3 reflectionCameraTarget = this.camera.TargetPosition;
            reflectionCameraTarget.Y = -this.camera.TargetPosition.Y + this.Options.Height * 2;

            Vector3 cameraRight = Vector3.Transform(new Vector3(1, 0, 0), this.camera.Rotation);
            Vector3 invUpVector = Vector3.Cross(new Vector3(1, 0, 0), reflectionCameraTarget - reflectionCameraPosition);

            reflectionMatrix = Matrix.CreateLookAt(reflectionCameraPosition, reflectionCameraTarget, invUpVector);

            Plane _reflectionPlane = this.CreatePlane(this.Options.Height - 0.5f, new Vector3(0, -1, 0), reflectionMatrix, true);

            if (this.Options.Draw != null)
                this.Options.Draw(reflectionMatrix, true, _reflectionPlane);
        }

        this.GraphicsDevice.SetRenderTarget(null);
}

and there is my camera: http://pastebin.com/hK9fi5DV

When I run all of this, I got this:

As you can see, it seems the reflection map is not in the right side and when I move my camera, the reflection map also moves thru the edges of the texture...

Do you have an idea from where this problem could come?

Thanks.

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:
How to design a character animation system? I'm searching for suggestions and resources on the possible ways to design a character animation system. I mean a system built on top of the graphics engine (as graphics engine I use Ogre3D, that provide an animation layer), and in strict contact with the logic of the game.

It's for a sports title, so the question is not easy.

Edit: What I'm searching for are suggestions and resources about the action state mechines (or animation state machines), that is build on top of the animation pipeline already provided by the graphics engine. So, a state-driver animation interface for use by virtually all higher-level game code.

sentences:
tvOS game launch image shows on simulator but not on device I’ve set up a launch image in XCode and it does show up in the simulator, but on the Apple TV it just displays a blurry gray background. The image is the correct size and doesn’t have any transparency.

I have tried full clean and delete the app from the device – neither has worked.

sentences:
What is the minimum of shader I need to use to run basic calculation on GPU? I read, that the Hull Shader, Domain Shader, Geometry Shader and Pixel Shader can be used optional. So, is the Vertex Shader optional too? If no: What does a basic Vertex Shader look like? Just like a simple pass through? Is the Vertex Shader necessary to tell what kind of datastructure (Van Stripes or Meshes) are used? What can I do, with just the vertex shader?
Are the fixed functions working without any help of programming a programmable stage?

sentences:
How do I get the player's position in Roblox Studio? In Roblox Studio, I have this code in a script file:

while true do
    wait(0.01)
    local PlayersService = game:GetService("Players")
    local players = PlayersService:GetPlayers()
    for i, player in pairs(players) do
        print(player.Name)
    end
end

This successfully prints the player's name many times per second. However, I would like to know how I can get other properties, such as the player's position. player.Position doesn't work, and I have no idea what options are available because autocomplete is not working when I type player.. What properties are available on player and how do I get the position?

sentences:
addressables unity unknown async error public AssetLabelReference imgs;
List<IResourceLocation> myImgs = new List<IResourceLocation>();
[SerializeField]List<Texture2D> loadedImages = new List<Texture2D>();
private void Start()
{
    Addressables.LoadResourceLocationsAsync(imgs.labelString).Completed += imgReady;
}
void imgReady(AsyncOperationHandle<IList<IResourceLocation>> op)
{
    myImgs = new List<IResourceLocation>(op.Result);
    insta();
}
 void insta()
{
    Addressables.LoadAssetsAsync<Texture2D>(myImgs, cb);
}
void cb(Texture2D s)
{
    loadedImages.Add(s);
}

I get the locations of the images but not the asset themselves
I get an error of

  Exception encountered in operation Resource(Man.png): Unknown error in AsyncOperation
  UnityEngine.ResourceManagement.Util.DelayedActionManager:LateUpdate() (at

sentences:
Unity - Blend tree weird transition I have duplicated the blend tree from the ThirdPersonCharacter (Ethan) which comes with the Standard Assets package.

In the duplicate I went into the blend tree and swapped out the walk animation "HumanoidWalk" with my own animation named "walk", but now I get a weird transition from the animation "walk" to "HumanoidRun".

Both animations, my walk animation and the original "HumanoidWalk" are root animated and look similar they have around 1.5 velocity both and same frame length.

Animation Settings:

I created the animation in blender, you will see in my video below that the animation itself runs smooth and as it should, but the transition to HumanoidRun is very weird for unknown reasons. I am using a custom metarig armature which comes with the blender add-on "rigify", I deleted some bones on the finger, but the avatar has a check and is ok (no warnings either).

Rig Settings

Player settings

I basically "copied" all the components from Ethan (ThirdPersonController) and only changed the Animator Controller and the Capsule Collider settings to match the model.

I made some short videos where you clearly see the problem, it happens if the parameter Forward is at about 0.6 - 0.8.

https://youtu.be/Q-T7FplDxLE

https://youtu.be/nrJNeo1ltsg NOTE: First I am demonstrating how it looks with the normal animations, then I add my own.

What am I doing wrong?

More Infos:

I just baked the walk animation in blender and exported it to unity again, but this made no difference.

I tried to export it from blender as FBX, it made no difference. However, I noticed that the import is happening much faster and applying in unity importer is very fast now.

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:
why does my objects only spawn once or really slowly? public GameObject fallingRockPrefab;
public Vector2 spawnsMinMax;
float randX;
float randY;
void Update()
{
    if (Time.time > nextSpawnTime)
    {
        float SpawningInBetween = Mathf.Lerp(spawnsMinMax.y, spawnsMinMax.x, Difficulty.GetDifficultyPercent());
        print(SpawningInBetween);
        nextSpawnTime = Time.time + SpawningInBetween;

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

    }

}

I set the "spawnsMinMax" over at the inspector in Unity as high as I can like (25 or 30 etc) but it still spawns once or like 1 or 2 per second. Even I set the number as low it can go, it still spawn in the same way. How do I fix this?

sentences:
XNA 2D - How can I draw a sprite over another? I'm working on a simple 2D game that is similar to the classic Invader arcade. What I want to know is:

How can I draw a new sprite over the player sprite upon colliding with an enemy/a bullet?
Better yet, how can I hide the player so that the hit animation can be shown?

I got the collision detection up and running except for the hit animation. It's being drawn behind the player current position which is awkward.

sentences:
How to create a reasonably sized urban area manually but efficiently I have a game concept that only really works in an urban area that is of reasonable scale and diversity. In terms of what it should look like, think GTA, in terms of the size think more like a small neighbourhood with residents and a few local shops, perhaps a supermarket.

I'm mostly experienced in programming and not at all with modelling, texturing or drawing, but I've found that SketchUp allows me to design interesting looking buildings that I model after real world buildings in my own neighbourhood.

Designing these buildings and other objects can take from a few tens of minutes to a few hours. My question is: what is the best approach for a one man army like me who does manage to model buildings to create an interesting city environment in a reasonable amount of time? My game will not be based on procedural generation, the environment will actually be modelled like GTA cities.

sentences:
PyGame - Top down shooter mechanics I'm currently developing a game for some school work using the PyGame library for Python. I'm almost done with most of the game's core mechanics, but have gotten hung up on the shooting mechanics. My current code is too long to post fully, but I'll put excerpts of it and explain what I have so far.

all_sprites_list = pygame.sprite.Group()

bullets = []
bullet_list = pygame.sprite.Group()
bullet_speed = 10

class Bullet(pygame.sprite.Sprite):
def __init__(self):
    super().__init__()

    self.image = pygame.Surface([4,10])
    self.image.fill(red)
    self.rect = self.image.get_rect()

def update(self):
    if self.rect.x > chx:
        self.rect.x -= bullet_speed
    elif self.rect.x < chx:
        self.rect.x += bullet_speed
    if self.rect.y > chy:
        self.rect.y -= bullet_speed
    elif self.rect.y < chy:
        self.rect.y += bullet_speed

This code shows the class I have for my bullets and their movement. The problems with this right now are that A) the bullets get stuck around the crosshair position, of which the chx and chy variables show the x and y position of the mouse.

    if event.type == pygame.MOUSEBUTTONDOWN:
        bullet = Bullet()
        if weapon == "hg" and hg_move == True:
            bullet.rect.x = hgrect.x
            bullet.rect.y = hgrect.y
            all_sprites_list.add(bullet)
            bullet_list.add(bullet)

This code shows an example of one of the firing commands later in the main game loop. hg, hg_move, and hgrect.x/y are all variables used for the movement of the character depending on the type of weapon he is holding.

Some of the main issues are seemingly caused by the fact that I can't find a way store a static value of the likes of the crosshair positions, or to keep the bullets going on a trajectory until they leave the screen or hit an object.

Any help would be greatly appreciated!

sentences:
cant add script component So I'm just starting to try to learn unity development with C# using this tutorial but I cant add the script to any game object and I get the following error:

Code of the script:

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

public class NewBehaviourScript : MonoBehaviour
{
    // Start is called before the first frame update
    public Light myLight;

    void Update()
    {
        if (Input.GetKey("space"))
        {
            myLight.enabled = true;
        }
        else
        {
            myLight.enabled = false;
        }
    }
}

I know it's been answered before but I've done everything I read, I did my homework and I still cant get around this issue. I allready checked the name of the class and its the same as the file's name.
I think it may be something regarding installation (?) I installed unity hub and it installed Unity and Microsoft Visual Studio by itself.

Unity version: 2019.3.3f1
MS Visual Studio version: 16.4.5
MS Net Framework version: 4.7.03062

I honestly dont know what else to do people! Please help!

sentences:
Unity - Load Lightmaps at Runtime I'm a bit of a novice to lighting, but I think what I want to do is possible, so please bear with me.

Due to the nature of my game, I've taken an approach where a singular scene game is where all of the gameplay occurs.

For each level, I'm arranging all the GameObjects and Terrain in a secondary scene (named testbed) to my liking. Once I've got it to my liking, I save that to a prefab, which in turn is saved to an AssetBundle. I also generate the lighting at this point, which I can see appear in my project under a Assets/Scenes/testbed/ folder.

At runtime, a script in the game scene reads the appropriate AssetBundle, and then loads & positions all of my objects and characters. Everything about this works, except for updating the lighting.

My approach is to store references to the lighting textures that have been output into the aforementioned testbed folder via a ScriptableObject (after trying and failing to use the LightingData object that appearred in this same folder):

Then, when I'm loading my level up into the game scene, this block is executed:

    public void LoadLighting(LevelKey key)
    {
        var data = levelMap.metaData.Find(it => it.key == key);
        var directions = data.lightData.directions;
        var lights = data.lightData.lights;

        var lightmaps = new LightmapData[directions.Length];
        for (int i = 0; i < directions.Length && i < lights.Length; i++)
        {
            var lightmapData = new LightmapData();
            lightmapData.lightmapDir = directions[i];
            lightmapData.lightmapColor = lights[i];

            lightmaps[i] = lightmapData;
        }

        LightmapSettings.lightmaps = lightmaps;
    }

Based on a lot of searching, this should cause something to happen, but I can't detect any change in the scene.

Does what I'm trying make any sense? Should I just scrap this and make dozens of different scenes (which I'm trying to avoid) instead? Really any advice here is appreciated.

sentences:
Why isn't my player moving? Why is my code not working?

using UnityEngine;
using System.Collections;

public class NewBehaviourScript1 : MonoBehaviour
{
    public float moveSpeed;
    public Vector3 input;
    public Rigidbody rb;

    void Start ()
    {
        rb = GetComponent<Rigidbody>();
    }

    void FixedUpdate ()
    {
        moveSpeed = 2;
        input = new Vector3(Input.GetAxis("Horizontal"), 0, Input.GetAxis("Vertical"));
        rb.AddForce(input * moveSpeed);
    }
}

sentences:
Space nebula cloud generation? I found a cool kickstarter project called "Skywanders".
It's an minecraft like space game with a lego like building system and pretty cool graphics.

One thing I noticed are the "nebula clouds". They are procedurally generated 3D Objects and they look amazing.

How do I generate such nebulas? I bet there's a way to do that. And is it possible to convert a 2D nebula into a 3D one? I didn't found any algorithm yet or other sources.

sentences:
Flash/Flex/Air and iOS I'm just a little confused with all of the news recently regarding the cancellation of mobile flash, so was hoping for a little help. I've had a search through and can't find the answers to these questions, so any help would be great.

First up, I'm looking to create a game in Flash first, to test whether the concept works as a fun game (on Newgrounds/Kongregate/Facebook etc.). Would it be best to use Flash CS5.5, or Flash Builder?

Secondly, with mobile flash now being discontinued by Adobe, could I still port this game over to iOS through the Flash platform, or would it be better at that point to re-write the whole game using Objective C? (NOTE: I'm not an Objective C developer, but am instead a Javascript and Actionscript dev).

Any help would be great. Thanks!

sentences:
Is Godot's NavMesh viable for dynamic pathfinding (e.g. avoiding moving enemies)? I am a novice (read: low-budget) designer looking at moving from Pygame to a real engine, and between Unity and Godot it looks like the latter has a much better 2D engine [1, 2, 3]. I would be happy to support Godot's open-source model except that, as far as I can tell, its built-in navigation mesh is purely static--i.e. it can't update its path to account for dynamic obstacles [4, 5]--while Unity's pathfinding system can [6].

So my question is: Am I "stuck" with Unity? Or is there functionality that I haven't yet been able to find? Or, alternatively, is GDScript significantly faster than Python such that basic algorithms like fixed-grid A* would do the job?

Edit: By "stuck" with Unity I don't mean that it's a bad option or that there aren't good options; I mean, 'if I need good pathfinding, do I have to give up on Godot and use what would otherwise be a second-choice engine?'

sentences:
Porting WP8 to IOS GraphicsDevice Error (Monogame/Xamarin) I seem to be having a problem porting to IOS. I have my game working on WP8 and Android with any major issues but when trying to run on iPhone I seem to get an error when initialising the GraphicsDevice

below is a screenshot to the problem. has anyone else had this issue and is there a workaround/fix?
Thanks in advance! :)

http://i.imgur.com/6Kwk6D6.png

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: Unity Ragdoll Colliders don't collide I have a humanoid character with Ragdoll setup in Unity. However the box/capsule colliders on the various parts of the body don't collide with other static geometry. They do collide with the ground but not with any other static meshes. Is it possible to use them as colliders towards static meshes and what do I need to do for it to work?

sentences: LibGDX: Max number of textures? I've been developing a game targeted at android. I know not to think about program optimization until the project is finished, but I have to wonder how many textures most phones can handle safely without melting or murdering battery. I've seen that the max SIZE of a texture should be 1024 or 2048 pixels squared (I've been combining sprite-sheets into 1024x1024 atlas's) but I can't help but wonder if there is a limit to how many of these I can use at runtime. I understand it should depend on the GPU but what spec determines it?

sentences:
Displaying a grid based map using C++ and sdl I am trying to create a roguelike game using c++ and SDL. However, I am having trouble getting it to display the map, which is represented by a 2d array of a tile class.

Currently, my code is this:

for (int y = 0; y!=MAPHEIGHT; y++)
{
    for (int x = 0; x!=MAPWIDTH 1; x++)
    {
        apply_surface( x * TILEWIDTH, y * TILEHEIGHT, mymap[x][y].image, screen );
    }
}

However, running this code causes it to both dither for a while before opening the SDL window, and (usually) tell me there is an access violation.
How can I display my map?

sentences:
My Game Renders Awful In Android Build I'm working on a 3D Sniper game and have finished the project. When I test it on Windows (7). It's All Fine, not even a bug. But when I take the app into android (Bluestacks App Player), my buttons and images render in Solid Black color. and my trees are Solid White. Some materials are rendering black too. You can see this in the image below

That Black Square On Top Right Corner Is A UI Button And The White Regions Are Tree And Bushes. The Black Thing In The Bottom Is A APC Tank.

sentences:
Enemy doesn't fire at player My script looks pretty good but it says Target variable has not been assigned value.

public GameObject AntagonisticElement;
public GameObject Target;
public float bulletSpeed;
public float enemySpeed;
public float bulletDestroyTime;
public GameObject explsn;
public GameObject bulletPrefab;
public Transform bulletSpawn;

Vector3 pos;

public float min = 20;
public float max = 10;

public int MaxCounter;
public int CounterStatus;
int numberofEnemy;
// Use this for initialization

void Start()
{

}

// Update is called once per frame
void Update()
{
    if (CounterStatus <= 0)
    {
        if (numberofEnemy < 3)
        {
            Vector3 creationPoint = transform.position;
            creationPoint.y = -0.5f;
            Instantiate(AntagonisticElement, creationPoint, transform.rotation);

            CounterStatus = MaxCounter;
            numberofEnemy++;
        }
    }

    else
    {
        CounterStatus--;
    }

    transform.LookAt(Target.transform.position);

    if (Vector3.Distance(transform.position, Target.transform.position) >= min)
    {
        transform.position += transform.forward * 4 * Time.deltaTime;

    }
    if (Vector3.Distance(transform.position, Target.transform.position) <= max)
    {
        shootAt();
    }

}

    void shootAt()
    {

        Instantiate(explsn, bulletSpawn.position, bulletSpawn.transform.rotation);
        var bullet = Instantiate(bulletPrefab, bulletSpawn.position, bulletSpawn.rotation);
        bullet.GetComponent<Rigidbody>().velocity = bullet.transform.forward * bulletSpeed;

    }

sentences:
Combat numbers in an MVC Bear with me this will take some explaining...

I'm trying to design my game as close to Model-View-Controller design principles as possible. At least in and so far as I understand those principles.

I have two relevant classes in my View and Model respectively (with an irrelevant-in-this-case playerInput class acting as the controller)

BattleSerializable (My model that handles battle logic)
BattleView (My view that handles battle display stuff)

BattleSerializable has a method called DoDamage that subtracts health from a player. BattleView has a method DoDamageView that calls the model's method (DoDamage) and then renders a number on the screen to indicate the amount of damage done.

So far so good.

But there's a friendly fire penalty! In the sense that if you do damage to an ally, you also take damage.

Ok, so now I can go one of three ways:

1) My BattleView can handle the friendly fire logic and call the DoDamage method twice in the case of a friendly fire occurrence, but this goes against what "View" is supposed to do. It doesn't make sense that BattleView should handle friendly fire logic. It should handle view logic only.

2) My BattleSerializable class can handle the friendly fire logic, but now I have to return a complex custom return object instead of a simple integer to handle all the state that changed. This seems needlessly complex or, at the very least, in-eloquent.

3) Instead of calling my model method from the view method, I could have the model run independently and, from the view, "poll" the Model every frame for changes and then render combat numbers if a change is detected. This seems inefficient and in-eloquent to me as well.

What is the preferred way to design this?

sentences:
Who Handles Collision in a Component Based Entity System I kind of stucking at my current plattformer protoype for learning the component based entity system pattern.

I have CollisionComponent and a CollisionSystem. The CollisionSystem checks every frame all entities with CollisionComponents for intersection. Then it marks inside the CollisionComponent the entities which are colliding with this entity. So if an entity A collides with Entity B then they both have a the other as a reference inside their CollisionComponent as data.

This works absolutely fine and I can tell which entity is colliding with something/someone.

Now I have the problem how to use this information properly. I have a MovementSystem and it moves entities with a MovementComponent based on the velocity and the acceleration.

Who is now responsible for NOT moving a entity or do something else on a collision. Should the MovementSystem check if the entity has a CollisionComponent and if there is one, should the MovementSystem handle the NOT movement?

Let's say I have this situation. I have an entity (player) with a MovementComponent and a velocity to the right (because the player presses the right arrow) and the usual downwards velocity due of gravity influences. The player entity collides with another entity. A GroundComponent entity. Now which system should put entity A (the player) upwards so that he does not colliding with the ground anymore? The MovementSystem? At the same time, the player entity collides with another entity, an enemy. Which system should now handle the damage, or the knockback or whatever that enemy does to a player unit?

I really like the CBES but it really does not get into my mind how everything glues together.

I want to threat the components as pure data, so no logic in there (besides of ScriptComponents, but this is another type of problem)

Now my question is, which system handles which cases and how to treat passes of system (e.g. Movement pass one then the other systems then movement pass 2 and so on? How many systems do I really need and should a system only handle one type of problem? MovementSystem -> pure movement no matter what. CollisionSystem -> pure collision registration no matter what, DamageSystem -> damage handling based on component data

sentences:
C# 2D Enemy Follow Y Axis Only While Rotating to Look At Player (Unity) I have a 2D game where the player can move up and down on the y axis, I need the enemy to rotate to look at my player (which I have working, but probably isn't the best method) while also moving up and down with the player.

I have both of those things working, but not fully, right now whenever I move up and down, the rotation happening seems to cause the enemy to move backwards more and more with each up and down movement.

I need it to remain stationary on the x and z axis's.

Also, if anyone knows how I could make it so the enemy always wants to be slightly above the player on the y axis, that'd be awesome. Meaning, instead of locking onto the player dead straight, maybe the enemy can be up slightly by perhaps 20%.

This is the code I'm working with:

public float moveSpeed = 3.0f;
public Transform target;

private Transform myTransform;

// Use this for initialization
void Start () {
  myTransform = transform;
}

// Update is called once per frame
void Update () {
  Quaternion rotation = Quaternion.LookRotation(
    target.transform.position - transform.position,
    transform.TransformDirection(Vector3.up));
  transform.rotation = new Quaternion(0, 0, rotation.z, rotation.w);

  if (target.transform.position.y < myTransform.position.y)  {

    myTransform.position -= myTransform.up * moveSpeed * Time.deltaTime;
  }
  else if (target.transform.position.y > myTransform.position.y) {

    myTransform.position += myTransform.up * moveSpeed * Time.deltaTime;
  }
}

sentences:
Setting the Box2D gravity for a pixel coordinate game? I'm making a game with Box2D with a top left coordinate system. I multiply positions by an M_TO_PX_RATIO of 10.0f to convert from meters to pixels.

I noticed that when I set gravity to 9.8, the simulation is rather slow. When I set gravity to 9.8 * M_TO_PX_RATIO, the simulation runs at the correct speed, like normal gravity. However, the high gravity causes jittering.

Am I doing it properly? When using a top left, pixel coordinate system, must I do anything else to account for meters to pixels?

Thanks

sentences:
Customizing Unity WebGL index.html Hey everyone just some css and styling tips needed! i want to use a game as a 404 page. so i would need on top to be either text or a contact form then some spacing and then the actual game window. iframes dont work that good on mobile devices and by doing a simple div in unity index although on mobile it works rather crude but nice, on desktop the text is going behind the unity game window. any tips please? Note that im adding the style in the index.html and not using the separate css file in the template folder.
So to sum up how can i make another div centered in the page and well responsive for mobile above the game container and add a margin on the bottom of that div!
Thank you!!

sentences:
Double jump, without allowing two jumps after falling down a cliff I created a script that allows the player to double jump, which works like a charm.

The problem is if the player walks off a cliff, they will still be able to jump twice. But that isn't how double jump works, right?

Can someone tell me how to make it so that if the player falls down a cliff, they will be able to jump only once?

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

public class PlayerController : MonoBehaviour
{
    private Rigidbody2D rb;
    private Animator anim;

    private float movementInputDirection;

    public float movementSpeed = 10f;
    public float jumpForce = 16f;

    public int amountOfJumps = 1;
    private int amountOfJumpsLeft;

    private bool isFacingRight = true;
    private bool isWalking;
    private bool isGrounded;
    private bool canJump;

    public float groundCheckRadius;
    public LayerMask whatIsGround;

    public Transform groundCheck;

    void Awake()
    {
        rb = GetComponent<Rigidbody2D>();
        anim = GetComponent<Animator>();
    }

    void Start()
    {
        amountOfJumpsLeft = amountOfJumps;
    }

    void Update()
    {
        CheckInput();
        CheckMovementDirection();
        UpdateAnimations();
        CheckIfCanJump();
    }

    private void FixedUpdate()
    {
        ApplyMovement();
        CheckSurroundings();
    }

    private void CheckMovementDirection() //flips sprite
    {
        if (isFacingRight && movementInputDirection < 0)
        {
            Flip();
        }
        else if (!isFacingRight && movementInputDirection > 0)
        {
            Flip();
        }

        if(rb.velocity.x != 0)
        {
            isWalking = true;
        }
        else
        {
            isWalking = false;
        }
    }

    private void UpdateAnimations()
    {
        anim.SetBool("IsWalking", isWalking);
    }

    private void CheckInput()
    {
        movementInputDirection = Input.GetAxisRaw("Horizontal");

        if (Input.GetButtonDown("Jump"))
        {
            Jump();
        }
    }

    private void ApplyMovement() //player movement
    {
        rb.velocity = new Vector2(movementSpeed * movementInputDirection, rb.velocity.y);
    }

    private void Flip()
    {
        isFacingRight = !isFacingRight;
        transform.Rotate(0f, 180f, 0f);
    }

    private void Jump()
    {
        if (canJump)
        {
            rb.velocity = new Vector2(rb.velocity.x, jumpForce);
            amountOfJumpsLeft--;
        }
    }

    private void CheckSurroundings()
    {
        isGrounded = Physics2D.OverlapCircle(groundCheck.position, groundCheckRadius, whatIsGround);
    }

    private void CheckIfCanJump()
    {
        if (isGrounded && rb.velocity.y < 0.01)
        {
            amountOfJumpsLeft = amountOfJumps;
        }

        if (amountOfJumpsLeft <= 0)
        {
            canJump = false;
        }
        else
        {
            canJump = true;
        }
    }

    private void OnDrawGizmos()
    {
        Gizmos.DrawWireSphere(groundCheck.position, groundCheckRadius);
    }
}

sentences:
Generating Mesh using Compute Shaders I am working on a game project in unity which has a procedurally generated terrain made up of 16*128*16 chunks of blocks. The map size is going to be finite (Possibly up to ~100*100 chunks). Currently the data for the chunk is stored in a 1D Array, and takes a couple milliseconds to generate. But generating the mesh takes longer, averaging 30-40ms. So generating terrain as it enters the range of the camera isn't feasible as it's too slow, and generating all the meshes on load up would take a lot of memory as well as a long time. I've thought about attempting to try it on the GPU through Compute Shaders (although I don't have any experience with them).

Would generating the mesh for each chunk in a Compute Shader be viable/efficient? (The chunks could be made smaller if would be more performant)

sentences:
Why are dungeons so often created subtractively rather than additively? I'm having difficult deciding on how to procedurally generate a dungeon floor. The way I've been doing it so far is like so:

Populate list of Rooms with random height and width.
Place first room in list at (0, 0).
Add room to a temporary list of rooms that have been successfully placed.
Place next room adjacent to a room randomly chosen from the aforementioned temporary list
Keep repeating previous step until room is successfully placed then move onto the next room.
Repeat the two previous steps until all rooms have been placed.

After that the doorways between the rooms are created and various steps are taken to assure collision is working properly but my question is this: Why does it appear to be common practice to first create a large area of cells that all are 'filled in' and to then 'carve out' rooms and corridors rather than to generate dungeons my way? I'm not saying my way is better, I would be happy for someone to tell me what I'm doing wrong and why I should be doing it differently. I just find my way easier for managing the various rooms and cells within my dungeon. It also means I don't have a bunch of 'useless' cells on the other side of the dungeon walls doing nothing but hogging processing power - that's something I never understood.

I just want to a way of generating a dungeon which balances efficiency and design.

sentences: Does decreasing rendering resolution also decrease the amount of polygons in my 3d models? When lowering my game resolution I reduce the pixel count of the final rendered output image, does the 3d model I use to render the final image also lose polygons?

sentences:
Finding out what pixel on the screen the fragment falls on In my 2D game, I render tiles. I want to do lighting without needing an extra buffer the size of the screen.

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

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

Thanks

Using ps 2.0

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

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

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

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

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

sentences:
Command Interface design for RTS Commands may have different target type; like NONE, COORD, UNIT.
Some example commands may be: Attack (target UNIT), Move (target COORD), AttackMove (target COORD), Stop (target NONE), UseAbility (target ability.getTargetType).
Commands will be executed by UI or AI.
So in an OOP approach here, what methods should my Command interface have?
For the command execution has access to the target the command wants.

sentences:
No sound in android using Phaser I have developed a simple game using Phaser.  It's work perfect on ios webkit, but on android there is no sound.  What causes this problem on one platform but not the other?

We are using this code to load:

this.load.audio('game_audio', 'audio/bgm.mp3');

Playing:

this.music = this.add.audio('game_audio');
this.boom.play()

sentences:
Why are my animations flickering? My animation is supposed to be used in my physics project I am making. I am using 10 millisecond setInterval() and setTimeout() and it glitches in and out.
The setTimeout() handles the clear() function in my code, but I have the setTimeout() at 9 milliseconds and it works the best. If someone can help me, here's the code:

var canvas = document.getElementById("canvas")
var ctx = canvas.getContext("2d")
var x = 10
var y = 0
var xPos = 0
var yPos = 0

function updateVariables() {
    x = x * 0.9
    y = y * -0.9
    y = y + 1
    xPos += x
    yPos += y
}

function clear() {
    ctx.clearRect(0,0,600,600)
}

function Draw() {
    ctx.fillRect(xPos,yPos,20,10)
    ctx.fillRect(0,131,600,20)
    setTimeout(clear, 9)
}

function collisionCheck() {
    if (yPos > 120) {
        yPos = 120
    }
}

function keyCheck() {
}

setInterval(Draw, 10)
setInterval(updateVariables, 1)
setInterval(collisionCheck, 10)
<canvas id="canvas"></canvas>

sentences:
Unity: SpritePacker Atlas with Dynamic Access Here are current conditions for a game I'm building in Unity 5.6.3:

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

So...

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

OR

What other solutions can solve this without a major overhaul?

sentences:
Unity - 2D - Scaling to fit between two objects The game is a top down 2d shooter and I'm facing trouble in doing this :
- I got a player 2D ship
- The player fires laser, which is a long thin image with box collider attached.
- What I want is that when the laser hit the enemy ship, the laser's length (Height) should be equal to the distance between the player and the enemy. (That is the laser shouldn't go through the enemy)

So what I have done is this :
In the Laser's script :

Vector3 scale = new Vector3(1, 1, 1);

void OnCollisionStay2D(Collision2D col) {
  If (col.gameObject.layer == 12) //ENEMY
     {
          scale.y = (col.gameObject.transform.position.y - Info.PlayerPosition.y) / this.gameObject.renderer.bounds.size.y;
          this.transform.localScale = scale;
     }

void OnCollisionExit2D(Collision2D col)
     {
          scale.y = 10 / this.gameObject.renderer.bounds.size.y; // 10 is the height of the screen;
          this.transform.localScale = scale;
     }

That's it. So when I run it, things go crazy, the scale.y value kind of oscillates between some low value and high value and withing 2-3 seconds, scale.y becomes infinity (as of Unity Console)

I can't make anything out of it :( Been like 1.5months with unity.
Thanks in advance :)

sentences:
How can check a collision between 2 non-axis aligned boxes? I'm making a simple and easy game and I need to detect the collision between 2 boxes. It only needs to return trueor false, no physics involved.

I started working and couldn't find an algorithm that would check the collision for turned squares.

Here I visualized the problem.

As you can see squares 1, 2 and 3 would return true because they collide with the green squares. 4 would return false because it isn't colliding.

I do have all the squares of both colors in separate array lists.

Does anybody know a library or algorithm for this problem? Thanks in advance.

sentences:
Unity Lerping & Following Camera is too slow I'm using this script to follow a game object in 2D :
public class CameraFollow : MonoBehaviour
{
    ...
    void LateUpdate(){
        Vector3 position = target_transform.position;
        float targetX = position.x;
        float targetY = position.y;
        targetX = Mathf.Lerp(transform.position.x, targetX, 1/m_DampTime * Time.deltaTime);
        targetY = Mathf.Lerp(transform.position.y, targetY, m_DampTime * Time.deltaTime);
        transform.position = new Vector3(targetX, targetY, initial_z);
    }
}

I've set damping time to 2.
But with this when the object's speed gets higher it can't follow anymore, it lags. Any suggestions or solutions ?
Here is the current situation :

sentences:
Tilemap is sent to back/disappears behind background when I go into play mode or save (video included) screencap of the problem here
I'm sure this has a simple solution but I haven't found it answered yet. I have two tilemaps, one a BG and one a middle layer, and everything works when I paint on the middle layer. It shows up on top of the BG.
But if I save the project or open play mode to test it, the middle layer disappears. Seems like it gets sent behind the BG tilemap but the order of the tilemaps hasn't changed. Also of note is that nothing changes even if I reorder the tilemaps, and the only way I can make the tilemap "reappear" is by ctrl-z undoing my last action. At a loss, any takers?
EDIT: I just realized that my video capture didn't pick up my drop down menus, but I create a new tilemap at the bottom of the hierarchy, put some assets in it, then save the project (stuff disappears) and then undo (stuff reappears).

sentences:
Simulating pressure in a grid based liquid simulation I have a 2D grid based water system in my XNA game, we have a method using cellular automata to simulate water falling and spreading.

Example of water flowing down a slope:

Each tile can contain a mass of 0 to 255 values of liquid, stored in a byte. I do not use floats, the old water system I had did, however it added complications and had a performance hit.

Each water tile updates itself with a simple set of rules:

If the tile below has space in it, move as much as possible from the current tile to the bottom one (Flow Down)
If the 2 sides aren't the same and aren't zero and both are passable, we get the sum of the 3 tiles (left + current + right) and divide it by 3 leaving the rest on the middle (current) tile
If the rule above gave a number of 2 as sum, we should divide the tiles into the two sides (1, 0, 1)
If rule 2 gave 1 as the sum, choose a random side to flow into
If rule 2 failed, we should check if one side is passable and the other isn't. If that is true, we split the current tile in half for the 2 tiles

How can I expand this logic to include pressure? Pressure will make liquids rise over "U-Bends" and fill in air pockets.

Example on how this currently fails:

The water should flow and equalize on each side of the U-Bend. Additionally, I have created methods to find out how far down a water block is, and therefore how much pressure it is experiencing. Now I need to be able to take these numbers and apply them to the other areas to equalize the pressure.

sentences:
Rotate an objects velocity I have a collision system (in 3D but for the purpose of the question assume 2D) where I want to calculate the new velocity (stored as a vector) after a collision.

What I have is the velocity of the object colliding against a plane and I want the object to then slide down that plane.

I know the angle of impact with the plane and I know the normal of the plane.  I can create a Rotation Matrix for the rotation that the velocity needs to be changed by, I just am not sure how I rotate the velocity vector by that matrix.

I'm sure it's an easy answer but I haven't quite been able to get it.

I added a picture as requested

Any help would be appreciated.

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:
Finding Game Object with Regular Expressions Is there a way to use a Regular expression in the GameObject.Find() method?

I'm making a checkers game and I've got pieces named Red Piece (x,y) and White Piece (x,y) (where x & y are actual integer coordinates). I want to destroy a piece at a certain x,y. So what I'm trying to do is something like

Destroy(GameObject.Find(Regex.Matches("(Red)|(White) Piece (" + x + ","+ y + ")")));

I need it to find any object with a name that contains "Piece (x,y)" whether it's a red piece or a white piece, and destroy it. Any ideas?

sentences:
Avoiding constant IF checks for loops As an example, I have 3 different loops that are executed in certain conditions.
I want to know if there's any way short of something like this:

if(day)
   x++;
else if(night)
   y++;
else
   z++;

Avoiding the continuous if checks, because I know under what conditions they will be executing... do I make myself clear?

I've thought of something along the lines of starting to execute a loop under the said x or y conditions, like so:

if(day)
 loopX();
else if(night)
 loopY();
else if(something else)
 loopZ();

But by doing this I'll effectively have to do checks for when to exit the loops, which ends up being the same, right?

I want to be able to say: "Start doing this!", and then eventually, at my discretion, "Now start doing this, instead!", without constant polling of conditions!

For example, were I currently in the "something else" state, I'd be doing 3 if checks every frame just to enter the loop! If I had something like 100 states, and was on the 100th, I would be checking 100 conditions just to get to the loop I want to execute!

A pratical game programming example: every frame, I do collision checking. Suddenly, I want to stop doing the collision checking.
I do not want to have it check an if(collideStuff), I want it to straight out not do it.

void gameloop() {
   movestuff();
   something();
   collision(); // this would suddenly not have effect, as if it weren't there
}

sentences:
My SFML sprite Move() function: FeedBack? Hey so I'm making a pong game with SFML and in the process made a function that takes a Time, Speed, Angle of movement, buffer for the movement on the X axis, and buffer for the movement on the Y axis.

I then implemented this function into my custom mySprite class, more specifically into it's update() function which updates its Position using the above function to calculate its new position.

However I'm worried that giving the function the FrameTime() of the Window (the time since the frame was last updated) is not the best choice as the sprites might start jumping around if there's lag between frame updates or other problems.....

Finally I would like to know how my organization, planning, etc is..  Thanks!

my UPDATED, WORKING Code:

   #include<SFML/Graphics.hpp>
#include<SFML/System.hpp>
#include<cmath>
#include<vector>
#    define M_PI 3.14159265358979323846

sf::RenderWindow Window;

template<typename T>
void CalculateMove(T Time, T Speed, T Angle, T& buffX, T& buffY)
{   //Make the degrees positive
    if(Angle<0) Angle= 360+Angle;
    //determine what quadrant of circle we're in
    unsigned int  Quadrant= 1;
    if(Angle>90)  Quadrant= 2;
    if(Angle>180) Quadrant= 3;
    if(Angle>270) Quadrant= 4;

    //anything above 90 would be impossible triangle
    Angle= (float)(Angle-(int)Angle)+(float)((int)Angle%90);

    // calculates x and y based on angle and Hypotenuse
    if((int)Angle!=0){
        if(Quadrant==2 || Quadrant==4) Angle=90-Angle; //The unit circle triangle is flipped otherwise, causing x and y to be switched
        buffY= sin(Angle / 180 * M_PI)/ (1.f/(Speed*Time));
        buffX= sin((180-Angle-90)/ 180 * M_PI)/ (1.f/(Speed*Time));}

    else{// Movement is a straight line on X or Y axis
        if(Quadrant==0 || Quadrant==2) buffX= Speed*Time;
        if(Quadrant==1 || Quadrant==4) buffY= Speed*Time;}

    //Quadrant Factor (positive or negative movement on the axis)
    switch(Quadrant){
    case 1: break;
    case 2: buffX=-buffX; break;
    case 3: buffX=-buffX; buffY=-buffY; break;
    case 4: buffY=-buffY; break;}
};

/////////////////////////////////////////   Mysprite    ////////////////////////////////
class mySprite : public sf::Sprite
{
private:
    float velocity;
    float angle;

public:
    // all the values needed by the base class sprite();
    mySprite(
        const sf::Image& Img,
        const sf::Vector2f& Position = sf::Vector2f(0, 0),
        const sf::Vector2f& Scale = sf::Vector2f(1, 1),
        float Rotation = 0.f,
        const float Angle= 0.f,
        const float Velocity= 0.f,
        const sf::Color& Col = sf::Color(255, 255, 255, 255)):
      Sprite(Img, Position, Scale, Rotation, Col){
        angle= Angle;
        velocity= Velocity;};

    float Velocity(){return velocity;};
    void SetVelocity(float newVelocity){velocity=newVelocity;};
    float Angle(){return angle;};
    void SetAngle(float newAngle){angle=(float)(newAngle-(int)newAngle)+(float)((int)newAngle%360);};

    void Update(){
        float frameTime= Window.GetFrameTime();
        float X=0,Y=0;
        SetRotation(angle);
        CalculateMove(frameTime,velocity,angle,X,Y);
        Move(X,-Y);
    };

    void Accelerate(float PPS){velocity+=PPS;};
    void Turn(float degrees){
        angle=(float)((angle+degrees)-(int)(angle+degrees))+(float)((int)(angle+degrees)%360);};

    void Reflect(float CollAngle){
        SetRotation(-GetRotation());
        angle=360-angle;
        //TODO: factor in the collision angle
    };
};

sentences:
How to account for speed of the vehicle when shooting shells from it? I'm developing a simple 3D ship game using libgdx and bullet.

When a user taps the mouse I create a new shell object and send it in the direction of the mouse click. However, if the user has tapped the mouse in the direction where the ship is currently moving, the ship catches up to the shells very quickly and can sometimes even get hit by them - simply because the speed of shells and the ship are quite comparable.

I think I need to account for ship speed when generating the initial impulse for the shells, and I tried doing that (see "new line added"), but I cannot figure out if what I'm doing is the proper way and if yes, how to calculate the correct coefficient.

public void createShell(Vector3 origin, Vector3 direction, Vector3 platformVelocity, float velocity) {
    long shellId = System.currentTimeMillis(); // hack
    ShellState state = getState().createShellState(shellId, origin.x, origin.y, origin.z);
    ShellEntity entity = EntityFactory.getInstance().createShellEntity(shellId, state);

    add(entity);
    entity.getBody().applyCentralImpulse(platformVelocity.mul(velocity * 0.02f)); // new line added, to compensate for the moving platform, no idea how to calculate proper coefficient
    entity.getBody().applyCentralImpulse(direction.nor().mul(velocity));
}

private final Vector3 v3 = new Vector3();
public void shootGun(Vector3 direction) {
    Vector3 shipVelocity = world.getShipEntities().get(id).getBody().getLinearVelocity();
    world.getState().getShipStates().get(id).transform.getTranslation(v3); // current location of our ship
    v3.add(direction.nor().mul(10.0f)); // hack; this is to avoid shell immediately impacting the ship that it got shot out from
    world.createShell(v3, direction, shipVelocity, 500);
}

Edit - I switched to:

    v3.set(direction);
    v3.nor().mul(velocity);

    if (platformVelocity != null)
        v3.add(platformVelocity);

    entity.getBody().setLinearVelocity(v3);

And it seems to work (so adding the velocities and setting them on the body).

However, I'm not sure what the drawbacks are and why the tutorial application used impulses instead of setting velocities.

I also think that while this is physically correct it leads to strange results (gun range is two times further when shooting forward than when shooting sideways).

The root cause is because really the shells are indeed too slow, but I like them slow as otherwise the gameplay is too fast-paced, and they travel too far.

I think I need some compromise between physics-realistic and ignore-platform-velocity.

sentences:
Run some objc code very early in unity iOS game lifetime I want to hook up a crash reporting service to my unity iOS game. It's just one line of objC to add, as early into the app lifecycle as possible, but I'm not sure how to get it to run. I know I could make a native plugin and then call that from some Awake() function in C#, but that's too late for my purposes.

I'm not a native iOS developer, but I know enough to be dangerous. I have been able to google enough that I know I want something to with UnityAppController, probably preStartUnity(). But that's all.

Has anyone got further resources on how to do this? Or another way, if I'm barking up the wrong tree?

edit: I'm on unity 4.6.

sentences:
3D Picking: Doesn't Work Consistently I'm trying to implement a 3D picking function that at the moment simply calculates the ray being sent from the camera after the user clicks the mouse on the window.

It kind of works well when the camera is facing forward (orientation [0.0, 0.0, 1.0]) but when I orient the camera upside-down or looking up/down it produces really stupid results (i.e. the ray is wildly out-of-line with the cursor, or even sometimes points behind the camera somewhere).

Here is the code:

// sv (the SceneViewport) is the window/viewport I'm clicking in
// pixel (the Vector2) is the position of the cursor, relative to the viewport centre, in pixels
public Ray PixelRayCast(SceneViewport sv, Vector2 pixel) {
    Vector2 viewportSizePixels = sv.SizePixels;
    float aspectRatio = sv.AspectRatio;
    float invFov = (float) Math.Tan(GetVerticalFOV(aspectRatio) * 0.5f);
    Vector3 rayOrientation = new Vector3(
        ((2f * pixel.X) / viewportSizePixels.X) / (1f / (aspectRatio * invFov)),
        ((2f * pixel.Y) / -viewportSizePixels.Y) / (1f / invFov),
        1f
    ) * Quaternion.FromVectorTransition(Vector3.FORWARD, Orientation); // Orientation is the camera's current orientation
    Vector3 rayStart = Position; // Position is the camera's current position
    return new Ray(rayStart, rayOrientation);
}

I'm not really a great mathematician so I'm hoping someone will be able to read through my small function and spot the mathematical error I'm making.

sentences:
Turn-based Strategy Loop I'm working on a strategy game. It's turn-based and card-based (think Dominion-style), done in a client, with eventual AI in the works. I've already implemented almost all of the game logic (methods for calculations and suchlike) and I'm starting to work on the actual game loop.

What is the "best" way to implement a game loop in such a game? Should I use a simple "while gameActive" loop that keeps running until gameActive is False, with sections that wait for player input? Or should it be managed through the UI with player actions determining what happens and when?

Any help is appreciated. I'm doing it in Python (for now at least) to get my Python skills up a bit, although the language shouldn't matter for this question.

sentences:
What is Clash of Clans projection called? What is the Clash of Clans projection (it doesn't seem to be isometric Image )
Image from here

sentences:
Tower Defence game scoring system I am in the process of developing my first game on android mobile platform, it’s a tower defence game and I am currently busy designing the scoring system.

At the end of the stage when the user has defeated all the waves of enemies I want to take his score and somehow calculate a rating out of 3 Stars.

What will the best way be to calculate a score?
When should I increment the score during gameplay for example when an enemy dies?
And how do I calculate if the score is worth 1-3 Stars at the end of the stage?

Basically I want help or any ideas on how the formula should look like and how to calculate if the user scored a 1.. 2... or 3 Stars.

My variables in game :

Every enemy has a value:   Example $5

The stage has a number of life’s before you are defeated: Example 20

Each stage starts with money that you buy your towers with: Example $120

Each towers costs money:  Example $30
A stage can consist of 1 or more waves of enemies.

Any help or ideas would be appreciated as I am new to game development….

sentences:
Framerate Dependant Steering Behaviour I've been studying steering and flocking behaviors, if not directly from Craig Reynolds work on Steering Behaviors For Autonomous Characters (http://www.red3d.com/cwr/steer/). I understand the basic concepts and how to apply forces but the main issue with this is performance. Using Unity, ECS and the job system, I have been able to implement a multi-threaded implementation of some simple behaviors (seek, arrival, evade etc).

The problem is simply that all of the implementations of steering behaviors that I find are all based on this same principle and they all seem to suffer from the same problem - framerate independence. For example, a simplified example of seeking:

// get a vector pointing directly at our target, at the maximum speed.
desired_velocity = normalize(target - position) * max_velocity

// get the steering force direction
steering = desired_velocity - velocity

// ensure the steering force never exceeds our maximum steering force
steering = truncate(steering, max_steering_force)

// ensure the velocity never exceeds the max speed
velocity = truncate (velocity + steering , max_speed)

// apply our velocity
position += velocity * delta_time

When dealing with the final velocity, we are utilizing delta_time to ensure that the velocity is applied in a framerate independent manner. But the steering force is not framerate independent at all. If this was running at 120fps, the steering would reach it's maximum velocity much faster than if the game was running at 30fps.

Is there something more I should be doing here. I've experimented with using delta_time with the steering, but that seems to make little difference.

sentences:
Best practices for communication between game designer and artist I'm having big troubles to sharing ideas and communicating my ideas to artists. They're friends who don't get a dime helping me so I don't want to waste their time trying to figure out what I have in mind. And my crappy sketches don't seem to be enough.

How do you communicate with the artist to create the assets? What kind of templates are commonly used? I'm looking for best practices and templates to define characters, assets, backgrounds.

sentences:
C++ Multithreading: accessing objects together I'm kinda new to C++ Multithreading, and I'm keeping it simple right now. I will keep things simple and write psuedo-code. I'm making a Turn Based Strategy Game but let's keep it at Chess for now.

I have a basic draw thread and update thread.

function DrawThread
    CurrentScreen Drawn
end

function LogicThread
    CurrentScreen Update
end

Both of these functions run in their seperate threads.
Now I've run into a few problems.

For example: My pieces (units) are stored in a vector in the CurrentScreen

Class MapScreen
public:
    GetPieces returns VectorOfpieces

private:
    VectorOfpieces
end

The draw thread constantly draws the Chess pieces.

function Drawn
    for each chesspiece in VectorOfpieces
        draw chesspiece
    end
end

I have a cursor that moves grid-based and on, for example, ENTER checks if there is a Chess piece underneath it. (I've omitted any other code that has nothing to do with it)

function PollInput
    if KeyPressed is ENTER
        CheckUnderNeath
    end
end

function CheckUnderNeath
    for each chesspiece in MapScreen.GetPieces
        if chesspiece position is cursor position
            return chesspiece
        end
    end
end

Now as you might have guessed this Cursor update is in the other thread

function Update
    Cursor PollInput
end

And as you might have seen coming miles away, both threads will eventually end up using the same vector at the same time, causing a crash.

Is there any easy implementation to fix a problem like this, as my 2-3 problems right now are eventually down to this problem, threads bumping heads.

What bothers me is this crash isn't consistant.
Because it's a vector I will get a "map/set iterator not dereferencable" error.

I'd appreciate a C++ answer eventhough my question was in Psuedocode. Thanks in advance!

TL:DR One thread tries to update the position of the same pointer the other tries to draw.

sentences:
libgdx continuous movement while touch and hold (even after jump)? So, I have these buttons where I have implemented a method to handle 'touch and hold' (without polling). If the player touches and holds the walk button ..it will keep walking till the button is released. Problem is when I combine jump with it ...
In the update method,

if (activeTouch) {
        translateScreenToWorldCoordinates(touchCoords.x, touchCoords.y);
         if (touchPoint.x < 5) {
           // Code for walk left
        } else if (touchPoint.x > VIEWPORT_WIDTH - 5)
        {
            // Code for walk Right
        } else if ((touchPoint.x > 6 && touchPoint.x < VIEWPORT_WIDTH - 6) && player.isGrounded() && player.getState() != Player.State.Falling) {
           // Code for Jump
        }
    }

The touchdown and touchup events,

 public boolean touchDown(int screenX, int screenY, int pointer, int button) {
        touchCoords.set(screenX, screenY);
        activeTouch = true;

        return false;
    }

    @Override
    public boolean touchUp(int screenX, int screenY, int pointer, int button) {
        activeTouch = false;
        return false;
    }

So i can move right,left and also jump. But my problem is, while walking if I jump ... it will jump and then stop walking. How to continue walking after the jump if the player is still holding onto the walk button?

sentences:
Simulation step size in a physics engine I am trying to integrate a physics engine (Bullet) into my game engine, but I immediately found that I do not know how big should I make the simulation step. I think of 2 options:

Use a fixed step size of 1/60. This way I have consistent simulation. Bullet allows making multiple steps when this time is exceeded. I think this is good for consistent simulation but I think it has a big flaw and that is that position of objects will not update when my framerate is higher than 60FPS. Right now I have around 1000 FPS but it will drop significantly to around 150 I expect because I use simple materials and not many objects plus the simulation time is not included yet. Is it possible to interpolate between steps so that 2 frames are always different but check for collisions only when 1/60 of a second passed?

Update physics every frame but when frame time is longer than 1/60 then use substeps. This way I should be able to get more precision but it would lower framerate because the step is performed more than 60 times per second. I definitely get the new position of the object in every frame.

Which is a better approach and why? Is there a standardized way to go about it?
I know that when slow-motion footage of CSGO is taken in every frame the position of the object change but the tick rate is just 64. Which would not update the position in every one of the 240 frames monitors can handle and duplicate frames would be created. I know that animation can be sampled at any point in time but not the position of the objects. How is that achieved?

sentences:
How would I create classes for each map tile instead of using a tmx? LibGdx I am making a top down style game using LibGdx that I want to be randomly generated each new game load.

I already have the algorithm to generate the array for what tile should be what.

But i'm stuck on how I should handle the tile classes.

I have this class called Tile

import com.badlogic.gdx.graphics.g2d.Sprite;

public class Tile extends Sprite{ // Should I use sprite??? Seems wrong..

public byte id;

public static Tile[] tiles = new Tile[256];

public static Tile grass = new GrassTile(0);

public Tile(int id) {
    this.id = (byte) id;
    if (tiles[id] != null)
        throw new RuntimeException("Tile Already Exists....");
    tiles[id] = this;
}

}

And I want to have multiple classes that exened this class for each tile. For example this is grass.

import com.badlogic.gdx.graphics.g2d.Sprite;

public class Tile extends Sprite{

public byte id;

public static Tile[] tiles = new Tile[256];

public static Tile grass = new GrassTile(0);

public Tile(int id) {
    this.id = (byte) id;
    if (tiles[id] != null)
        throw new RuntimeException("Tile Already Exists....");
    tiles[id] = this;
}

}

Should these classes be extended off of a sprite? Or some other class from libgdx?

Also These tiles are going to be 16 x 16 that are made up of 4 smaller 8x8 sprites.

sentences:
How to use HD and SD sprites in Unity addressables I am able to load sprites using Unity addressables. But how can I use SD or HD variants of a sprite based on my device resolution?
Previously I was using LIBGDX, and it has ResolutionFileResolver to handle this scenario.

sentences:
C++ timer function acts as if time limit is instantly reached if it is less than 1 second I'm trying to make a Snake clone with C++ and OpenGL/GLUT, but I've been having trouble with programming the timed input. I made a timer class, as you'll see below, to be used for the short time intervals allowed for input and movement. It's function checkTime() is called to start the timer. Then on following calls, it checks if the time limit (represented by the int variable limit) has been reached.

To test it, I set up a simple, looping console program, that displays keyboard input. When working properly, it displays what key is being held precisely at the point when the timer finds the time limit has been reached (it returns "true"). Given a limit of 1 second, it will only display current input every second. If it is given a value below 1 however, like 0.333, it will act as if the time limit has instantly been reached, and will display input instantly whenever a key is pressed. How can I get it to only display the input every 0.333 seconds?

Also - I realize my method of doing things here may not be the best, given the tools I'm using. However, I'm curious why this won't work properly.

#include <iostream>
#include "timer.h"
// Include all files necessary for OpenGL/GLUT here...

using namespace std;

Timer timer;

void update(int value)
{
    if (timer.checkTime())
    {
        if (GetAsyncKeyState(VK_LEFT))
            cout << "You pressed LEFT!" << endl;
        else if (GetAsyncKeyState(VK_RIGHT))
            cout << "You pressed RIGHT!" << endl;
        else if (GetAsyncKeyState(VK_UP))
            cout << "You pressed UP!" << endl;
        else if (GetAsyncKeyState(VK_DOWN))
            cout << "You pressed DOWN!" << endl;
    }

    glutTimerFunc(1000/60, update, 0);
    glutPostRedisplay();
}

timer.h

#pragma once

class Timer
{
public:
    Timer();
    bool            checkTime(int limit = 0.333);
private:
    unsigned long   getElapsed();
    bool            running;
    unsigned long   elapsed;
    unsigned long   start;
};

timer.cpp

#include "timer.h"
#include <ctime>

Timer::Timer()
{
    running = false;
    elapsed = 0.0;
    start = 0.0;
}

bool Timer::checkTime(int limit)
{
    (unsigned long) limit;

    elapsed = getElapsed();

    if (elapsed < limit)
    {
        return false;
    }
    else if (elapsed >= limit)
    {
        running = false;
        return true;
    }
}

unsigned long Timer::getElapsed()
{
    if (! running)
    {
        start = (unsigned long) clock();
        running = true;
        return 0.0;
    }
    else
    {
        return ((unsigned long) clock() - start) / CLOCKS_PER_SEC;
    }
}

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:
Are references to other games considered an infringement of copyright? My team frequently reminisces about the games we grew up with in the 1990s, and we'd like to include references and Easter eggs that pay homage to this decade and that will invoke nostalgia or even make players smirk.

One example would be a character calling out another character: "Dude, why on Earth are you hiding in a stupid box?" (a reference to hiding in cardboard boxes from Metal Gear). Think of it as being similar to when the characters from Bad Company 2 teased the snowmobile level from Modern Warfare 2.

Would these sorts of references be considered copyright infringement? As far as I'm aware, this falls under parody and fair use, as it is neither used to capitalize on a specific game element (like basing our gameplay on people hiding inside cardboard boxes) nor does it directly reference a game character. To me, it seems more like paying homage to the companies making those games. Of course, when the time comes, we will consult with a lawyer and are willing to go as far as asking direct permission from the copyright owners.

But until then, I'd like to be informed on the topic.

sentences:
Generate a random number of enemies to appear on screen I am currently trying to create 2d shmups. I am trying to:

Generate a random number of enemies to appear on screen
Whatever number is generated will then be added to my List (the list is used to keep track of enemies). to load that number of textures.
I would also like to keep a collection of Vectors to determine the positions the enemies will spawn randomly.

This is what I have done so far:

 List <Enemies> enemies = new List<Enemies>();
 Random rnd = new Random();
 int numberOfEnemies = rnd.Next(1,5); // I would like to generate between 1 and 5.
 if (enemies.count < numberOfEnemies){
     enemies.Add(new Enemy(Content.Load<Texture2D>("alienship");// one of the vectors from the collection of vectors will go here
 }

sentences: Is Font Squirrel for real? I found Font Squirrel, and while it claims to have fonts free for commercial use, i can't find a license or legal pages anywhere. Are these fonts really usable for commecial use like they say?

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:
How can I make iPhone apps (games) on Windows? I want to start making iPhone games, but sadly I'm a Windows geek.. Is there a way to make good profesional iPhone games without Xcode/owning a Mac computer?

If not, what do you recommend, a Mac Mini?

Thanks in advance!

sentences:
How to implement a physical with perspective effect on Android? I'm working on a project that looks like PaperToss. Instead of tossing a page, you toss a coin. Suppose that I have a coin put in three-dimensional that have coordinates at A(x,y,z). I throw that point ahead, after 1/100 second, that coin move from A(x,y,z) to A'(x',y',z'). By this way, I  have two problems need to solve.

Where will be the coin at time t?
How can I display this on a screen?

For 2., I thought about using Orthographic projection & Perspective projection. I'm told that OpenGL can help me, but I don't know how.

How can I solve 1. and 2.?

sentences:
Using fixed time for Lerp I would like to change a camera's rotation and position from its current position and rotation to a destination position and rotation.

This should happen within a specific time (seconds).

I call this void "pRotateAndPosition" in each Public void Update().

However, I'm having trouble getting the 3rd argument for Lerp (time) correct.

Could anybody tell me where my mistake(s) are?

Thank you.

private void pRotateAndPosition()
{
    _TimeElapsed += (Time.deltaTime / TimeInSecondsInWhichWeWantToGetToFinalRotationAndPosition);

    if (_TimeElapsed >= TimeInSecondsInWhichWeWantToGetToFinalRotationAndPosition)
    {
        _StopCallingThisVoid = true;//don't call this anymore

        //set the final position and rotation in case we're not completely there yet
        _camera.transform.localRotation = Quaternion.Euler(goalRotation);
        _camera.transform.localPosition = goalPosition;
        return;
    }

    float fTime = _TimeElapsed;//absolutely not sure about this one

    _camera.transform.localRotation = Quaternion.Lerp(_camera.transform.localRotation, Quaternion.Euler(goalRotation), fTime);
    _camera.transform.localPosition = Vector3.Lerp(_camera.transform.localPosition, goalPosition, fTime);
}

sentences:
Networking and physics Context

I have been implementing my own networking for a third person multiplayer game, but controls and physics will be ala old school FPSs. I'm using Unity's transport layer, which allows me to send and recieve raw data between server and client.

I used this model as reference, in order to implement better client response:
http://www.gabrielgambetta.com/client-server-game-architecture.html

Implementing prediction, and interpolation was no problem, but I'm having a problem implementing reconciliation, even though I successfully implemented for normal ground movement.

I do the following each tick:

Client: The client sends the server the delta updates on the player position, and the server validates this movement and updates the player accordingly on the server.
Server: I send a snapshot to all clients with all players' positions. Each client interpolates the rest of the players, and reconciliates it's own position.

Reconciliation

Ground movement seems easy, because each frame the player input determines how the player moves: Each FixedUpdate, the player moves a certain distance.
This makes reconciliation really easy, since knowing which was the last input the server has received, your client just needs to consider the rest of the inputs yet to be processed.

Reconciliating jumping

But I don't know how to deal with jumping. Jumping is an input that has an impact on the player's position over several frames: while it's airborne (and for a few frames, as the placer decelerates in case his air speed was high).

This means I can't just rely on the input "jump" to recalculate my client's position, since depending on the moment I'm present, I could be ascending, or descending. Even more, if I jump and collide with the roof, killing all my vertical speed, the movement would be completelly different.

This lead me to think I should be sending to the server each update on the player's position:
Instead of sending "hey, im jumping here", I could send "I'm moving up 1 unit"..."I'm moving up 0.9 units".... describing the players parabole. But I feel this method is not enterily secure, since the client could be sending "I'm moving up 1" ever single time, allowing the player to just fly away. So the server has to be the one handling the physics on the jump.

Other scenerios

This problem is also present in anything physics related: When the player is pushed away by an external force set up by the server or the client itself. If the client recieves a message saying has been affected by an explosion, I could set the client's speed accordingly, but:
 - If I have any kind of air control (which I want to have), I need to tell the server the change on air speed
 - If the server makes a correction on the physics made, I need to be able to predict and reconciliate the position AND speed. For example: If I collide against a wall in the server, which for some reason, is not present in the client, I also need to kill the player speed or it will keep slamming into an invisible wall.

Posible solutions

There are several solutions I was thinking about, but I'm not really satisfied with any of them:

As said earlier, I could could let the client handle the air movement by sending the position update back to the server, but this feels insecure since th client could technically make himself fly around, and make himself immune to being pushed away.
Besides sending the player positions, I could also send the players' speed, storing this information could make reconciliation easier and more reliable, but it will also increase the size of snapshots and network usage.

Maybe I'm missing a clever alternative, but I don't really see any other option. Any ideas?

sentences:
Need ideas on how to give my levels structure I am making an iOS game for a project at school. It is going to be a tiny bit like Fruit Ninja, as in it will have different things on the screen, and when you hit them, they die, and you get points. The trouble is that unlike Fruit Ninja, my game will have different types of sprites, all doing different things (moving different places, doing different things, etc).
The one thing that is bad about having all of these sprites that do different things is that it is hard for them to look neat on the screen all together. I was planning on having a couple of different gamemodes:

Time Trial
You have 120 seconds to kill as many sprites as possible.

Survival
You have three lives, every time you try to hit a sprite and miss, you lose a life.

????
Whatever I think of.

I am a rookie to game design in general, and I don't know the best way to make my game look good, and play well. I could have all of these sprites on the screen at the same time, or I could have them come in waves, for example 10 of sprite_a come on, and once they are killed, 10 of sprite_b come on, etc...

Please give me your opinion about which one I should code. If you have any other suggestions for either a third gamemode, or a completely different way to make the levels, feel free to tell me.

sentences:
How do I make my game (without performance problems) not stutter? I've made a game that has gameticks every 1/60 seconds. These gameticks take very little time to calculate (< 0.5 ms).

The game is written in Javascript and uses requestAnimationFrame (rAF). rAF fires roughly a few milliseconds (how many is determined by what the browser thinks is necessary) before (mostly) every frame output to the monitor.

The code does the following every rAF:

get a timestamp
figure out how many gameticks should have happened at that timestamp, and (if needed) run enough to catch up
render state after latest gametick to screen

This works fine most of the time. It runs at a consistent 60 gameticks/second, regardless of what the screen is doing (good for syncing multiplayer). It handles any framerate. The game looks smooth except, sometimes, the timestamps happen to be right around the boundary for new gameticks.

frame 10: gametick 2.01 (renders gametick 2)
frame 11: gametick 2.99 (renders gametick 2)
frame 12: gametick 4.01 (renders gametick 4)
frame 13: gametick 4.99 (renders gametick 4)
frame 14: gametick 6.01 (renders gametick 6)

When this happens, it stutters horribly. How do I make it avoid stuttering needlessly?

sentences:
Shader program compiles fine on Ati, fails on other vendors Got a real annoying problem here.

My shader program compiles fine on my Ati Radeon HD card, but on Nvidia and Intel it failes to compile.

Vertex shader:

#version 120
attribute vec3 in_position;
 attribute vec3 in_normal;
 attribute vec3 in_texcoord;

 uniform mat4 modelMatrix;
uniform mat4 viewMatrix;
uniform mat4 projMatrix;

varying vec2 texture_coordinate;
varying vec3 normal;

void main()
{
gl_Position = (projMatrix * viewMatrix * modelMatrix) * vec4(in_position, 1.0);
normal = in_normal;
texture_coordinate = in_texcoord.xy;
}

Fragment shader:

#version 120
varying vec2 texture_coordinate;
varying vec3 normal;

uniform sampler2D gColorMap;

 void main()
 {
   gl_FragData[0] = vec4(texture(gColorMap, texture_coordinate).xyz, 1.0f);
   gl_FragData[1] = vec4(normalize(normal), 1.0f);
}

Any ideas? I checked the shader for errors, but I can't find anything. Thanks.

sentences:
Preparing a 2D character to export from Blender to Unity? I'm an animator for a game currently, and I don't have Unity (can't download due to too much gigs coupled with slow internet,) but the game designer told me I can use Blender to export animations into Unity.

I asked if I needed to prepare multiple files to export, and they told me that I could just have one file with all the animations in it. The game, as stated in the title, is 2D.

My problem now is, how do I turn a rig into an actual character with different animations under it? (Right now I only have an 'idle' animation, but need to make running, jumping, walking, etc.) I mean how do I save this 'idle' animation and work on another animation without overwriting the previously finished animation(s)?

Thank you much

sentences: How to draw a NavMesh Path to a destination without traversing the path in Unity3d? I have a set of pre-determined destinations. When the user chooses any one of those destinations, the path to the destination should be drawn, similiar to google maps. I am trying to do this in unity, but not able to figure out just how.

sentences:
Problem connecting to Steamworks via Facepunch.Steamworks I'm using Facepunch.Steamworks (https://github.com/Facepunch/Facepunch.Steamworks) to connect my Unity game to Steam. The login seems to work fine. The board object is an FP class, and AddScore is a call to the library to send the score to Steam.

I have the boards set up on Steam, and they come out with IsValid == true. Here are the output and the code. The boards currently have no data in them, so I don't think it's because the score isn't beating an existing one.

xxxxxxxx
Standard-Normal
True
Fail

public void SubmitScore(Globals.ApplicationMode mode, Globals.SkillLevels skillLevel, int score)
{
    int index = GetLeaderboardIndex(mode, skillLevel);
    if(index == -1 || !IsSteamPlatform())
    {
        return;
    }
    Leaderboard board = m_leaderboards[index];
    Debug.Log("xxxxxxxx");
    Debug.Log(board.Name);
    Debug.Log(board.IsValid);
    board.AddScore(true, score, null, AddScoreSuccessCallback, AddScoreFailureCallback);
}

private void AddScoreSuccessCallback(Leaderboard.AddScoreResult result)
{
    Debug.Log(result.Score);
}

private void AddScoreFailureCallback(Facepunch.Steamworks.Callbacks.Result result)
{
    Debug.Log(result.ToString());
}

Here's a shot of the leaderboards on the Steam control panel. They seem in order; their "Writes" attributes are false so that the client can submit to them directly.

sentences:
Variable value in inspector is not updating automatically? Something weird is happening when I change a variable value in script and hit play the var value doesn't update I have to reset the script in inspector. Is this normal? Aren't the values suppose to update when we hit play?

The Simple Code I used to test this:

var a:int=0;

function Start () {
print(a);
}

sentences:
How can I reduce writes-per-second when saving player data to a database? Consider a game where the player has some profile or save data stored in a database. What I want to understand is, for things that effect the users score or level, there could be so many factors that this has to be persisted to the database and if it is, this could be many writes per second per player potentially, which could be expensive or slow.

How can I reduce the load on the database while still maintaining critical player information?

sentences:
How to implement pathfinding in this situation So I'm creating a game for android using the libgdx library. I render the map from a tmx file and in it all the water tiles have the property of blocked. My player(a sprite) moves to where I clicked/tapped.

My problem is that I am unsure as to how to implement pathfinding. I can get in the layer with the tiles that which have the blocked property but I'm not sure as to how to stop my player from moving through them. I am using the tweenengine to move the player.

I was thinking that perhaps the code would create waypoints for the tween movement from a path finding code but again I'm not sure as to how to implement it.

I looked at A* and all the examples I was looking at were using rectangles and my player doesnt move in a uniform way(1 tile per move). So I cant really assign it values (10 for vertical/horizontal, 14 for diagonal).

If I have said anything that is not true then please correct me

sentences:
How can I create a 2D "gooey"/"sticky" separation effect? I want to create an effect similar to this animation where two shapes separate over time but are connected (for a time) by something gooey that stretches and eventually breaks. Like pizza cheese, but specifically in 2D.

I'm using Swift and SpriteKit. I'm thinking this probably involves keyframes bezier path animations, but I'm not sure. How can I achieve this effect?

sentences: How does Admob pay for banner ads? I want to know how Admob pays for banners? Is it based on time or impressions or count of times that been showed to users?

sentences:
How do you handle loss aversion in probability-based games? The psychological phenomenon of loss aversion refers to how players feel losses twice as powerfully as victories.

For example, Bite Fight's PvP is a simulation based on probabilities related on character skills, and players voice this feeling many times per week in the community forums.

If you don't want to create a pay-to-win game, but you do want to let the worst players win often enough to feel good about it, how can you do that?

The question has two parts:

How do you handle it technically? Do you use some kind of math techniques or a memory based simulation to avoid many loses in the row for a certain player?
How do you handle it from the community point of view? What do you do about complaints like this on public forums?

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

sentences:
can someone help me with this code for my platformer. ive been working on the script for an eternity but unity keeps saying there is an error using UnityEngine;
using System.Collections;

public class player_controler : MonoBehaviour {

    public float moveSpeed;
    public float jumpHeight;

    // Use this for initialization
    void Start () {
    }

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

        if(Input.GetKeyDown) (KeyCode.Space))
        {
            rigidbody2d.velocity = new vector2(0,jumpHeight;)
        }

    }
}

This is what shows up:

Assets/scripts/player_controler.cs(16,53): error CS0201: Only assignment, call, increment, decrement, and new object expressions can be used as a statement

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:
How to manage different shaders dynamically? Currently I have only a really basic shader and a shader class.

My question is that if I want to make different shaders (with different uniforms, inputs, etc) how should the architecture look like?

Edit: I want it in a way that I can add/remove/modify shaders without recompiling.

(#1, #2, #3 were written before this edit, so I'm sorry if they are irrelevant now)

(I wrote #4 just now, and currently I am very happy with it, but I would like to hear your opinion about it.)

I have a few ideas:

(1.) Should I make an abstract shader class, and a derived class for every invidual shader program?

(So the abstract class handles the general things, and the derived class handles the specific things, like uniforms, inputs, etc)

But in my opinion this isn't a good practice, because for every shader I create, I have to create a new class too, which means that if I want to add a new shader, or modify one's source, I have to recompile the engine.

(2.) Should I register the shader specific things (location of inputs, uniforms, etc.), and pass EVERY possible required data to the shader, which will use only the ones which were registered during the shader's compile time?

Like Shader A needs position and normal, Shader B needs position and UV.
position, normal and UV will be passed to the active shader object, and it will buffer only those which it needs (based on the registered inputs, uniforms, etc) and won't care about the others.

(3.) Having every possible input, uniform etc in all the shaders. The active shader will receive every required input, uniform, etc. So a shader is only unique in its main(). Like Shader A uses input 1,2,3, shader B uses input 1,2,5. (But both of them will receive all inputs)

These are the way I thought of, but these aren't very good in my opinion, there must be a good way for this.

Edit:

(4.) What I most recently thought of:

Only one shader class. has a field: unordered_map < name, location at shader >
During shader initialization, I store the input, uniforms, etc in the previously mentioned map.
When I want to render the Object, I call the active shader's SetInput(...) or SetUniform(...) method
These methods receive a string and a data (like vec3, vec4, mat4, etc)
In these methods, I check if the string is in the map, and if it is, I buffer the data to the location.

I think this is good, because there will be a few method calls for every object, and then finding a key in an unordered_map is really fast.

What do you say?

sentences:
Mobile 3D engine renders alpha as full-object transparency I am running a iOS project using the isgl3d framework for showing pod files.

I have a stylish car with 0.5 alpha windows, that I wish to render on a camera background, seeking some augmented reality goodness.

The alpha on the windows looks okay, but when I add the object, I notice that it renders the entire object transparently, where the windows are. Including interior of the car.

Like so (in example, keyboard can be seen through the dashboard, seats and so on. should be solid)

The car interior is a seperate object with alpha 1.0.

I would rather not show a "ghost car" in my project, but I haven't found a way around this.

Have anyone encountered the same issue, and eventually reached a solution ?

sentences:
Game loop inside libGDX game loop I have the main game loop in libGDX. On the touch() event I want an animation to be executed. So I will have a variable which will store the value which will be updated each frame and further rendered side by side each frame.

The problem:
I want an another animation to take place after the first one finishes. How do I update variable to do so? Because it should take place after first. I can't place two statements in loop one after another. Is there a way to create an another game loop inside first so that when inner runs the outer is paused?

sentences: Rotating the view around the origin of the world coordinate system In OpenGL (using shaders), I want to implement a system that will take the user's mouse as input, and then rotate the view about the origin of the rendered scene. So, I need to compute the view matrix (assume the model matrix is identity) that represents this rotation. If the view were to rotate around its own origin, then I could do this by applying a simple rotation operation to the view matrix. However, I don't want to do this -- I want to rotate about the origin of the world coordinate system. So, given a rotation angle "theta", how can I compute this matrix? Thanks!

sentences:
How to build bullet (hit) damage detection in Augmented Reality to a real life person acting as an opponent? I am building an Android AR game using ARcore 1.18 in Unity 2019.4.5f1 (LTS). Now I want to create something like bullet damage detection just like it is built in a normal Unity 3D game.
Of course, the biggest problem is how can I even detect the real person's hitbox like it is done in a normal game? I need to somehow be able to attach the bullet damage script to the body of the real-life person in real-time.
Has anyone tried this before? How can we achieve this? I understand if I might not get a spoonfed tutorial but some help towards what should I be doing to achieve this will be greatly appreciated.
I see some other FPS Augmented Reality games which either uses Laser Tag (Father.io) or Barcodes to scan the opponents. These are definitely some great ideas to create an FPS game experience but still, if possible, I want to try it with just the mobile camera without any external support. I am ready to bear some accuracy loss :)

sentences:
Large-Scale Case Handling for 2D Procedural Environment I am creating a procedurally generated side scroller and I have a question regarding proper code structure/Architecture when it comes to connecting different platforms and large scale cases. There are various platform types I need to connect (e.g. a hill which leads into a tunnel which then leads into a cave, etc). I can successfully generate and connect the meshes using a bezier curve. My problem is that the way I am handling each platform connection case seems very clunky/inelegant the more I expand.

Currently I am using switch statements to handle each scenario like the above mentioned. Below is a small snippet of how I am handling each case.

public void SetTransition(int PrevPlatform, int CurrPlatform , Vector3 LastPosition)
{
    switch (PrevPlatform) {
    case 0:
        GroundTransition (CurrPlatform,LastPosition);
        break;
    case 1:
        CaveTransition (CurrPlatform,LastPosition);
        break;
    case 2:
        WaterTransition (CurrPlatform,LastPosition);
        break;
    case 3:
        TunnelTransition (CurrPlatform,LastPosition);
        break;
    case 4:
        WallJumpTransition (CurrPlatform,LastPosition);
        break;
    }
}

From here I have separate functions that handle the cases using more switch statements. The problem now is that I am starting to have a large number of branching functions that are relying each case. My code structure is becoming this large tree of switch statements. For the most part it works but I wanted to reach out to other developers before I continued this route. Is there a more effective, organized methodology to handling large scale cases?

sentences: Detect Mouse Enter on An oval shape image in unity I have an image that is attached to a panel and I want to detect On Pointer Enter and exit. The event is working fine but currently, it is working on the full image while I want to detect this event on an inner oval shape. Actual the remaing are of the image is transparent.

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:
Is "Check your surroundings" warning on splash screen really needed for geolocation games? I'm currently building an Android game as a solo dev. It follows the trend of geolocation-based games (like Niantic), but with more unique aspects.

Anyway, I noticed that in Niantic games - Ingress, Pokemon Go - there's always a "check your surroundings" or "don't drive and play" kind of warning to the player in the splash screen. I'm afraid that it might have something to do with legal implications regarding people being trampled or fall to their death while playing.

While I'm definitely not a fan of losing my player base / cause pain and sorrow to their families, I still see no reason to add this to my game. Because let's face it, people promptly ignore warnings like that and play the way the want in the end.

My case is somehow different from most geolocation games, in the sense that one of its unique features is that you don't need to keep looking at the screen to play. In case it helps to clarify how it works here is the play store's link: https://play.google.com/store/apps/details?id=com.arvere.theforage (I'm not sure if this is compliant with SE's rules, if it isn't, I ask to some mod to remove it, please)

So, would there be any reason (besides legal security) to do this in a game like mine?

sentences:
What technology(s)would be suitable for the front end part of a Java web game? As asked in a previous question, I'm looking to create a small MMO that will be deployed onto GAE.

I'm confused about what technologies I could use for the user interface, I've considered the following

JSP Pages - I've got experience with JSP/JSTL and I would find this easy to work with, it would require the user having to "submit" the page each time they perform an action so may become a little clumsey for players.
Applet - I could create an applet that sits on the front end and communicates to the back end game engine, however I'm not sure how good this method would be and have not used applets since university..

What other options do I have? I don't have any experience in Flash/Flex so there would be a big learning curve there.

Are there any other Java based options I may be able to use?

My game will be text based, I may use some images, but I'm not intending to have any animations/graphics etc

Thanks

sentences:
Animated lighting in amusement parks What is the best way to handle animated lights on rides in a night time amusement park scene?

Is there a better way that doing lots of emission lights?

At the moment I have been using emission lights, but there could be a lot of them in a park (some are just static lights) and I would also like to animate some of them on some rides.

Best example I could find was from GTA 5:

Video: https://youtu.be/zVj8D0lqgl4?t=146

sentences:
Unity3D - Button Slicing Problem I'm having trouble getting my button to appear correctly, as you can see in the image below, the right and top sides are stretched out and not displaying properly. I cannot figure out if this is a problem with the image itself or something wrong in the way I'm setting up the button.

Here are the settings in the inspector window:

Here is the original image:

UPDATE: So everything looked fine when I just opened up Unity, so I tried to figure out what I did last time for it to make this switch. It happens when I build and export the scene to my Android device.

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 get a direction vector from a an Euler angle? Im trying to get a directional vector from an euler angle. But im not getting how to do it. This is what i got so far.

escapeAngle += 90;
var radians = escapeAngle * (Mathf.PI / 180);

var escapeAngleAsDirectionVector = new Vector2 ();
escapeAngleAsDirectionVector.x = Mathf.Cos (radians);
escapeAngleAsDirectionVector.y = Mathf.Sin (radians);

escapeAngleAsDirectionVector = transform.TransformPoint (escapeAngleAsDirectionVector);

sentences:
Should I take line thickness into consideration for a grid based light game? I'm currently rewriting some horrific code I wrote for a prototype and have stumbled right at the start! The game I'm working on revolves around directing light and there is a small ambiguity in regards to the way the grid is drawn:

Code wise, information about each node of the grid is stored in an int[,], the grid lines are drawn for debugging purposes. Currently there is nothing explicitly defined for the line thickness, i.e if you look at the pixels closely, the bottom and right lines are drawn in a way which means the grid is not centered on screen, it is one pixel out!

If you shrink the scale of the grid to each being cell being 4x4 pixels the problem is really obvious:

The red area is the cell; the lines show how I draw the grid lines and what the light beams travels across. Would it better to represent this as a grid of 3x3 pixel cells with a line thickness of 1?

Normally I wouldn't be bothered too much because this is really looking into it in a lot of depth, but since the lines of light themselves actually traverse these currently non-existing lines I thought it might be better to make the representation a more elegant! What do you think?

sentences:
Using Actionscript 3's Graphics API in Flixel My question sounds pretty simple but awfully, I couldn't find much information on the internet.

How can I draw a circle in my FlxSprite?

I couldn't find much information about drawing geometric objects or the usage of classic graphics API in Flixel.

sentences:
Unity using different NaveMesh for the same position I have differents environments (they are on the same position, and they are prefab) , each environment have differents obstacles.

The problem comes with the navMesh.

What I want is to have one navMesh for each environment and switch them at runtime

Example:

User choose Environment 1 ----> I switch to NavMesh 1
User choose Environment 2 ----> I switch to NavMesh 2

but every time I bake the navmesh it override the last one,
also, How I can switch between navmesh?

Thanks in advance

sentences:
Steering behaviours that gaurentee not to hit something I'm really struggling how people make steering behaviours that guarantee a given agent will never hit something.

I want to have a flocking algorithm that the agents can follow each other and also avoid each other and avoid objects in the game.

I know how to detect and find a vector for them to change course, but not how to guarantee they adjust in time to make the change before crashing into the object.

Whats the correct way to approach this stuff?

sentences:
XNA 4.0 - Using premade .xnb font files Basically, for our college project, we need to use a font in xna. The only problem is that we are not allowed to install it due to admin rights.

Is it possible to use and load the .xnb file that gets created as the font. Using spritefont gives errors as it searches for the font in windows.

(The .xnb file will be created on someones personal machine beforehand.)

sentences:
Issues making a gradient square in glsl es 2.0, Gamemaker Studio 2.0 I made a triangle list with 4 triangles, having the middle point a different color. And then aim to combine the triangles to get a nice gradient.
But the edges of the triangles create unwanted lines, I don't want these lines I want it to be smooth al the way.
How can I get the desired result?

Images:

Shader Code:

    // Simple passthrough vertex shader
    //
    attribute vec3 in_Position;                  // (x,y,z)
    attribute vec4 in_Colour;                    // (r,g,b,a)
    attribute vec2 in_TextureCoord;              // (u,v)

    varying vec2 v_texcoord;
    varying vec4 v_colour;

    void main()
    {
        vec4 object_space_pos = vec4( in_Position.x, in_Position.y,         in_Position.z, 1.0);
        gl_Position = gm_Matrices[MATRIX_WORLD_VIEW_PROJECTION] * object_space_pos;

        v_colour = in_Colour;
        v_texcoord = in_TextureCoord;
    }

    //
    // Simple passthrough fragment shader
    //
    varying vec2 v_texcoord;
    varying vec4 v_colour;

    void main()
    {
        gl_FragColor = v_colour;
    }

Gamemaker code:
Create event:

    //Build vertices list

    vertex_format_begin();
    vertex_format_add_position();
    vertex_format_add_colour();
    vertex_format_add_textcoord();
    v_format = vertex_format_end();
    v_buff = vertex_create_buffer();
    vertex_begin(v_buff, v_format);

    //triangle 0
    vertex_position(v_buff, 200, 100);
    vertex_colour(v_buff, c_black, 1);
    vertex_texcoord(v_buff, 0.0, 0.0);

    vertex_position(v_buff, 600, 100);
    vertex_colour(v_buff, c_black, 1);
    vertex_texcoord(v_buff, 1.0, 0.0);

    vertex_position(v_buff,  400, 300);
    vertex_colour(v_buff, c_red, 1);
    vertex_texcoord(v_buff, 0.5, 0.5);

    //triangle 1
    vertex_position(v_buff, 200, 100);
    vertex_colour(v_buff, c_black, 1);
    vertex_texcoord(v_buff, 0.0, 0.0);

    vertex_position(v_buff, 200, 500);
    vertex_colour(v_buff, c_black, 1);
    vertex_texcoord(v_buff, 0.0, 1.0);

    vertex_position(v_buff,  400, 300);
    vertex_colour(v_buff, c_red, 1);
    vertex_texcoord(v_buff, 0.5, 0.5);

    //triangle 2
    vertex_position(v_buff, 600, 100);
    vertex_colour(v_buff, c_black, 1);
    vertex_texcoord(v_buff, 1.0, 0.0);

    vertex_position(v_buff, 600, 500);
    vertex_colour(v_buff, c_black, 1);
    vertex_texcoord(v_buff, 1.0, 1.0);

    vertex_position(v_buff,  400, 300);
    vertex_colour(v_buff, c_red, 1);
    vertex_texcoord(v_buff, 0.5, 0.5);

    //triangle 3
    vertex_position(v_buff, 200, 500);
    vertex_colour(v_buff, c_black, 1);
    vertex_texcoord(v_buff, 0.0, 1.0);

    vertex_position(v_buff, 600, 500);
    vertex_colour(v_buff, c_black, 1);
    vertex_texcoord(v_buff, 1.0, 1.0);

    vertex_position(v_buff,  400, 300);
    vertex_colour(v_buff, c_red, 1);
    vertex_texcoord(v_buff, 0.5, 0.5);

    vertex_end(v_buff);
    tex = sprite_get_texture(sprite_index, 0);

Draw event:

    shader_set(shd_prim);
    shader_set_uniform_f(uni_radius, var_radius);
    vertex_submit(v_buff, pr_trianglelist, tex);
    shader_reset();

sentences:
Unity - Set rotation of object using angle between two points? I have a LineRenderer that draws a line between two points, Vector3 startPos and Vector3 endPos. How can I get the angle between these points, and apply it to an objects transform rotation, so that it points in that direction?

Here is my code that draws a line between 2 points by dragging your mouse, if you want to test just Replace the Interact methods with Input.MouseButtonDown(1), hold and up.

Vector3 startPos;
Vector3 endPos;
float angle;

LineRenderer lr;

private void Awake()
{
    lr = GetComponent<LineRenderer>();
    lr.useWorldSpace = true;
}

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

    lr.enabled = true;
    lr.positionCount = 2;
    startPos = PointerHandler.RaycastScreenPoint(Input.mousePosition, UnitManager.instance.movementMask, GameManager.instance.cam).point;
    lr.SetPosition(0, startPos);
}

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

    endPos = PointerHandler.RaycastScreenPoint(Input.mousePosition, UnitManager.instance.movementMask, GameManager.instance.cam).point;
    lr.SetPosition(1, endPos);
}

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

    lr.positionCount = 0;
    lr.enabled = false;
}

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:
Most efficient way to get the world position of the 8 vertexes of a Box Collider (C#) What I am looking for is the most efficient way to get the world position of the 8 vertexes of the Box Collider of a freely rotated Gameobject. I cannot use collider.bounds since object is rotated, not axis-aligned.

As for the framework I am working within, it's Unity 5 with C#.

Would you know how could I achieve that? Thanks in advance.

sentences:
2-d lighting day/night cycle Off the back of this post in which I asked two questions and received one answer, which I accepted as a valid answer. I have decided to re-ask the outstanding question.

I have implemented light points with shadow casting as shown here but I would like an overall map light with no point/light source.

The map setup is a top-down 2-d 50X50 pixel grid.

How would I go about implementing a day/night cycle lighting across a map?

sentences:
How can I use GPL software like Stockfish Chess Engine in my Unity game? I am working on a 3D Chess game and I want to implement an A.I bot to play with the player. I found a chess engine called Stockfish which serves this purpose, and I would like to implement that engine in my project.

Is it as simple as including the Stockfish code in my project or importing a binary as a plugin, or do I have to do something more complex because of the GPL licence?

sentences:
How can I handle versioning changes when saving assets? I've been working on an RPG now for a while and I use two of different serialization techniques.

Enemies, Weapons, items are as saved as XML.
Maps and events are saved as "controlled binary" (every class get a save/load method and they decide what they want to save/load).

But I have started to question my choice for maps and events. My concerns:

I have created a map editor but I still miss being able to change small things by just opening the file.
Changes mess so much up. Say that I want to add a variable to a class, if I don't load/save every map again it break later.

The first concern is hard to get around without changing my technique. I thought about changing to JSON, but it's a lot of work. I also think it look pretty ugly with [DataContract] and [DataMember] attributes everywhere.

That leave me with my second concern and I wonder how I can deal with it? Do you create a small program that loop through all maps and re-save them with the new variable? Because I start to get a couple of maps now and I still do it manually. It make me think twice everytime I want to do some changes as it create a lot of extra work.

sentences:
Fastest approach to 3D animation I'm currently tasked with designing a small HTML5 game.
Having done everything by myself so far (3D models, codebase, game design, etc) I'm now at a point where I'm running out of time.

I've less than a day to animate and bind everything together. However, that's exactly my problem.

I was under the naive impression that everything would be easier if I went with pre-rendered 3D models. However, I didn't consider the most difficult part. Animation.

After having spent over an hour trying to figure out messiahStudio, I figured it's time to ask for outside help.

Is there any easier solution to 3D animation than 3D rigging? What I'm basically looking for is some sort of tool that allows me to simply grab and move/deform select polygons.

It doesn't have to be as life-like and accurate as rigging, just efficient enough.

Were the circumstances any different, I might just learn how to rig. But that's sorely out of scope right now.

PS:The models were created in Sculptris but are fairly low-poly.

sentences:
How to set orthgraphic matrix for a 2d camera with zooming? I'm using ID3DXSprite to draw my sprites and haven't set any kind of camera projection matrix. How to setup an orthographic projection matrix for camera in DirectX which it would be able to support zoom functionality?

    D3DXMATRIX orthographicMatrix;
    D3DXMATRIX identityMatrix;

    D3DXMatrixOrthoLH(&orthographicMatrix, nScreenWidth, nScreenHeight, 0.0f, 1.0f);
    D3DXMatrixIdentity(&identityMatrix);

    device->SetTransform(D3DTS_PROJECTION, &orthographicMatrix);
    device->SetTransform(D3DTS_WORLD, &identityMatrix);
    device->SetTransform(D3DTS_VIEW, &identityMatrix);

This code is for initial setup. Then, for zooming I multiply zoom factor in nScreenWidth and nScreenHeight.

UPDATE

This is going to work:

    D3DXMATRIX orthographicMatrix;
    D3DXMATRIX identityMatrix;
    D3DXMATRIX viewMatrix = D3DXMATRIX(
        1,      0,      0,      0,
        0,      1,      0,      0,
        0,      0,      1,      0,
        (FLOAT)(-(this->nScreenWidth / 2)), (FLOAT)(-(this->nScreenHeight / 2)),        0,      1
    );

    D3DXMatrixOrthoLH(&orthographicMatrix, (FLOAT)this->nScreenWidth, (FLOAT)-this->nScreenHeight, 0.0f, 1.0f);
    D3DXMatrixIdentity(&identityMatrix);

    this->p_device->SetTransform(D3DTS_PROJECTION, &orthographicMatrix);
    this->p_device->SetTransform(D3DTS_WORLD, &identityMatrix);
    this->p_device->SetTransform(D3DTS_VIEW, &viewMatrix);

And put D3DXSPRITE_OBJECTSPACE flag next to other flags when you use ID3DXSprite::Begin():

if(this->p_sprite->Begin(D3DXSPRITE_ALPHABLEND | ... | D3DXSPRITE_OBJECTSPACE) != D3D_OK) return 0;

For zoom functionality you can produce this matrix:

D3DXMatrixOrthoLH(&orthographicMatrix, this->nScreenWidth * this->dZoom, -this->nScreenHeight * this->dZoom, 0.0f, 1.0f);

sentences:
Rotate Box Sprite With Circle Body I want to rotate my rectangular sprite with circle body.
The problem is the body doest not attached to the centre of the sprite. This was the default behaviour of the body and sprite.

But I want that circle body attached in the bottom of the rectangle and when rotation happen at that time rectangular sprite always attached with the body at the bottom and during simulation it change its angle and position according to this only.

I try to write question in words if I don't able to understand you then know me then I post a picture of my problem here.

Although I know that cocos2d has setAnchorPoint method available so similar task become easily but what about my engine that right now I was using - AndEngine. So be relevant to this game platform.

Also thanks in advance for efforts you take.

sentences: Approaches to partner trick taking card game AI I am creating an android game out of a partner based trick taking card game. What are some generic approaches to AI players for these types of games and what are the advantages/disadvantages of each?

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:
Quaternion rotation, translation, scale or 4x3/4x4 matrices for Skeletons? I'm modding a game that uses 4x3 and 4x4 matrices to make skeletons, but I saw that an skeleton can also be made with a quaternian rotation and vector translation and scaling.

What's the difference between both? The first one has more values, I suppose, but, which is better?

If I have a 4x3/4x4 matrices skeleton, can I transform it in some way to the rotation, translation and scaling?

sentences:
Strange momentum on projectiles shot out of "parent" object I'm trying to shoot a projectile out of a moving "parent" object. Both objects move off of rigidbody physics, so I'm using addforce for the projectile.
Whenever I move the "parent" object and turn while it's moving and shoot the projectile, I instantiate the projectile, copy the projectile spawn position to the projectile's position, copy the rotation of the "parent" to the projectile, then add force to the projectile.
It'll shoot but I notice it moves in the direction of the momentum of the "parent" rather than straight forward from where it was created. I'm pretty sure this is just me not understanding how rigidbody physics works for adding force but if anyone has any suggestions as to how to make the projectile move straight forward from where it's created rather than copying the momentum of the parent I'd appreciate it greatly.
My code for moving and creating a projectile looks like this:
void FixedUpdate()
{

    if (Input.GetKey(KeyCode.W))
    {
        //player.transform.Translate(Vector3.forward * 10f * Time.deltaTime);
        this.GetComponent<Rigidbody>().AddForce(transform.forward * 15);
    }
    if (Input.GetKey(KeyCode.S))
    {
        this.GetComponent<Rigidbody>().AddForce(transform.forward * -15);
    }
    if (Input.GetKey(KeyCode.A))
    {
        transform.Rotate(Vector3.up * -15 * Time.deltaTime);
    }
    if (Input.GetKey(KeyCode.D))
    {
        transform.Rotate(Vector3.up * 15 * Time.deltaTime);
    }
}

void ShootBullet()
{
    //create bullet GameObject
    bullet = Instantiate(bulletPrefab);

    //set location where bullet will spawn from
    bullet.transform.position = bulletSpawn.position;

    //set direction of the bullet
    bullet.transform.rotation= bulletSpawn.transform.rotation;

    //add force to the bullet
    bullet.GetComponent<Rigidbody>().AddForce(bulletSpawn.forward * bulletSpeed, ForceMode.Impulse);

    //destroy bullet after x time
    Destroy(bullet, lifeTime);
}

sentences:
How do I prevent a KActor from changing the orientation of its Z-Axis? So I have an object that inherits from KActor that I would like to behave as a dynamic physics object, but I want its Z-Axis to remain upright, but very stiffly. I've tried the bStayUpright that triggers the "Stay Upright Spring". The problem is, it's a spring, and the object in question oscillates into position when I want it to remain oriented properly without wobbling.

In the image above, the yellow block has fallen onto the gray box, and it is currently pivoting about the contact point as it tries to right itself.

Should I be tweaking the StayUprightMaxTorque and StayUprightTorqueFactor parameters, or should I be using a Constraint of some sort?

sentences:
How do i set conditions for an IF statement as the game progress through "difficulty"? This is code that I wanted to put in my IF statement
    public GameObject fallingRockPrefab;
public Vector2 spawnsMinMax;
float randX;
float randY;

//Spawn Positions
Vector2 SpawnPosition;
float nextSpawnTime;

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

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

    }

}

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

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

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

sentences:
Help me optimize my Line Of Sight on a 2d grid algorithm? private bool LOSBetween2Nodes( int2 start , int2 end )
    {
        int2 dif = new int2(
            math.abs( end.x - start.x ) ,
            math.abs( end.y - start.y ) );
        int2 pos = new int2(
            start.x ,
            start.y );
        int2 inc = new int2(
            ( end.x > start.x ) ? 1 : -1 ,
            ( end.y > start.y ) ? 1 : -1 );

        int numIterations = 1 + dif.x + dif.y;
        int error = dif.x - dif.y;
        int walkable = 0;
        bool prevY = false;
        int numSameDir = 0;

        if ( error <= 0 )
            prevY = true;

        dif.x *= 2;
        dif.y *= 2;

        for ( ; numIterations > 0; --numIterations )
        {
            walkable += graphNodeWalkables[ pos.x + pos.y * graphCellLength ];

            if ( numSameDir < 1 )
            {
                if ( prevY )
                    walkable += graphNodeWalkables[ ( pos.x - inc.x ) + pos.y * graphCellLength ];
                else
                    walkable += graphNodeWalkables[ pos.x + ( pos.y - inc.y ) * graphCellLength ];

                if ( error > 0 ) // more steps in x
                {
                    pos.x += inc.x;

                    if ( !prevY )
                        numSameDir++;
                    else
                        numSameDir = 0;

                    prevY = false;
                    error -= dif.y;
                }
                else // more steps in y
                {
                    pos.y += inc.y;

                    if ( prevY )
                        numSameDir++;
                    else
                        numSameDir = 0;

                    prevY = true;
                    error += dif.x;
                }
            }
        }

        return walkable == 0;
    }

This currently checks all grid cells along a line between a certain width and returns telling you if any are unwalkable. This can run thousands-tens of thousands of times a frame.

sentences:
What is involved for a simple UDP game? I once tried to write a simple game with UDP in a week as a throwaway test. It went horribly.

I threw it away early. The main problem i had was restoring the game state of all players/enemies/objects to an old state and fast forward the game to the point of time the player is playing (ie half a second before a jump. A little early or late can make the player miss the jump)

Maybe this method is not the easiest way? i suspect it to be but i designed it wrong from the beginning and realized at the end of 2nd day. (so i didnt learn too much or wasted that much time)

For myself and others, What is involved for a simple UDP game and how do i write one? Or how do i solve the prediction problem restoring to state properly.

I'll mark this as CW bc i know there will be lots of helpful answers.

sentences:
JBox2D bodies don't collide? I have two objects. A dynamic player and a static ground object.

It was working for a while until I did some refactoring and suddenly my play falls right through my ground object.

Is there anything obviously wrong with the following? I have no idea what might be wrong so  if you have experienced this before, enlighten me!

Here's the initialization code of the objects:

(pixelsPerMeter is 10)

    int pixelsPerMeter = Game.instance.pixelsPerMeter;

    //create body def
    BodyDef boxDef = new BodyDef();
    boxDef.position.set(0, 0);
    boxDef.type = BodyType.DYNAMIC;

    //create shape
    PolygonShape boxShape = new PolygonShape();
    boxShape.setAsBox(this.size.width / pixelsPerMeter, this.size.height / pixelsPerMeter);

    //create body
    body = Game.instance.world.createBody(boxDef);

    //finally create the fixture
    FixtureDef boxFixture = new FixtureDef();
    boxFixture.density = 1;
    boxFixture.shape = boxShape;

    //add the fixture to the box? :\
    body.createFixture(boxFixture);

This is done twice, one for the player and once for the ground object.

The player's body type is set to BodyType.DYNAMIC while the ground is STATIC.

And of course the ground is below the body, and gravity is set to 9.8f.

sentences:
How to remove text from a command line box? I'm currently writting a text based game and am currently having a slight issue where all of the text on the screen keeps going up and have had a couple of the testers complaining that it makes the game appear messy and somewhat confusing.

The game is written in C++ as a command line game and I was wondering if anyone knows of anyway that I could clear the screen up without putting a lot of white space into the game as I personally think that isnt a very nice way of doing it. Just to note that this is in a windows environment.

Thanks for any response

sentences:
Need help understanding VkCommandBuffer and VkCommandPool I'm creating my first Vulkan project and I'm at the point where I need to send commands to the GPU. Now I need help understanding how and when commands are being executed and what sort of commands can be sent. I have a working example of where I clear the screen using the following.

Creating the Buffer

VkCommandBufferAllocateInfo commandBufferAllocateInfo{};
commandBufferAllocateInfo.sType = VK_STRUCTURE_TYPE_COMMAND_BUFFER_ALLOCATE_INFO;
commandBufferAllocateInfo.commandPool = engine.pipeline.command_pool;
commandBufferAllocateInfo.level = VK_COMMAND_BUFFER_LEVEL_PRIMARY;
commandBufferAllocateInfo.commandBufferCount = 1;

VkCommandBuffer commandBuffer = VK_NULL_HANDLE;

vkAllocateCommandBuffers(
    engine.device.instance,
    &commandBufferAllocateInfo,
    &commandBuffer
);

Clearing the screen

VkCommandBufferBeginInfo commandBufferBeginInfo{};
commandBufferBeginInfo.sType = VK_STRUCTURE_TYPE_COMMAND_BUFFER_BEGIN_INFO;
commandBufferBeginInfo.flags = VK_COMMAND_BUFFER_USAGE_ONE_TIME_SUBMIT_BIT;

engine.ErrorCheck(vkBeginCommandBuffer(
    commandBuffer,
    &commandBufferBeginInfo
));

VkRect2D renderArea{};
renderArea.offset.x = 0;
renderArea.offset.y = 0;
renderArea.extent = window->GetVulkanSurfaceSize();

std::array<VkClearValue, 2> clearValues{};
// Depth stencil
clearValues[0].depthStencil.depth = 0.0f;
clearValues[0].depthStencil.stencil = 0;
// Color
clearValues[1].color.float32[0] = 0.0f;
clearValues[1].color.float32[1] = 0.0f;
clearValues[1].color.float32[2] = 1.0f;
clearValues[1].color.float32[3] = 0.0f;

VkRenderPassBeginInfo renderPassBeingInfo{};
renderPassBeingInfo.sType = VK_STRUCTURE_TYPE_RENDER_PASS_BEGIN_INFO;
renderPassBeingInfo.renderPass = engine.window.renderPass;
renderPassBeingInfo.framebuffer = engine.window.framebuffers[engine.window.activeSwapchainImageId]; // Get current frame buffer
renderPassBeingInfo.renderArea = renderArea;
renderPassBeingInfo.clearValueCount = clearValues.size();
renderPassBeingInfo.pClearValues = clearValues.data();

vkCmdBeginRenderPass(
    commandBuffer,
    &renderPassBeingInfo,
    VK_SUBPASS_CONTENTS_INLINE
);

I'm finding it difficult to understand. I see that when you define a CommandBuffer you point to the pool that it will be submitted to, then when you execute the command it gets added to the queue to be processed asynchronously with the logic that is happening CPU side? I'm not sure if that is right.

Also, can the command buffer be used for other commands? and if so, what commands and how would I find example usage of them.

And what is a command pool in the scheme of things that is happening?

sentences:
In the new InputSystem of Unity, how to detect the keyboard and the mouse "as the same input device"? I'm trying to use the PlayerInputManager of the new InputSystem (preview 7) and my keyboard and mouse are being detected as separate devices. I'm not saying that it is wrong, but it is not useful at all and I would like to know how to fix it.

As shown in this video, the PlayerInputManager has the ability of Instantiating new players when they press a button of their controller. This is almost exactly what I need, but it is not perfect.

All works fine using controllers but if someone wants to join using the keyboard/mouse, "they won't be able".

When a key is pressed in the keyboard, a player joins, and when the mouse is used, another player joins (despite the fact that in that game youn need both to control a character and neither one of the spawned characters would be playable).

So my question is: how can I configure the InputSystem so that only one player joins when either a keyboard or mouse is used and it reads the input from both devices?

Maybe it is simply a missing feature, but I think that it would be nice if you could achieve what I want because a lot of times the keyboard is used alongside a mouse.

Thanks in advance!

sentences:
Breakout angle calculation I am making my first game in python and I am really stuck at with a physics problem. The game I am trying to make is a copy of the game Breakout. In Breakout, the player controls a "paddle" at the bottom of the screen, which the ball will bounce off of.

I have got the collision to work, but I want the angle between the ball's direction vector and the "paddle" to have an impact on the angle at which the ball leaves the paddle. How can I make this work? I have tried a lot of things, but I can't get it to work.

In these situations I want the angle to be sharper when the ball hit's closer to the edge of the paddle. How can I calculate and make these angles to work?

sentences:
C++ SDL Vector of Textures Storing NULL Objects I'm attempting to (re)learn C++ by making a top-down shooter game using SDL. In my game, I have created a Graphics class that handles all of the drawing, textures, etc.

The game is in its very early stages, and at the moment the Graphics class has a textureList, which is simply a vector of pointers to SDL textures:

vector<SDL_Texture*> textureList;

The Graphics class has an int addTexture(const char* filename) method, which is used by a GameObject to add textures to the textureList vector, and return the vector ID back to the GameObject, so that it can access its texture when needed:

int Graphics::addTexture(const char* filename) {
    SDL_Texture* tx = IMG_LoadTexture(this->renderer, filename);
    this->textureList.push_back(tx);
    return (textureList.size() - 1);
}

The addTexture method is called by a GameObject like this:

GameObject player(10, 10, g.addTexture("player.png"));

Later on, a GameObject will call an updateGraphics() method on the Graphics class, which uses the stored ID to draw a texture:

void Graphics::drawTexture(int id, int x, int y, int w, int h, int angle) {
    SDL_Texture* tx = this->textureList.at(id);
    SDL_Point* centre = NULL;
    SDL_RendererFlip flip = SDL_FLIP_NONE;
    SDL_Rect rect;
    rect.x = x;
    rect.y = y;
    rect.w = w;
    rect.h = h;
    SDL_RenderCopyEx(this->renderer, tx, NULL, &rect, angle, centre, flip);
}

From what I can tell, the SDL_Texture* taken from textureList and stored in tx is NULL, and I've read that this is because textureList is storing pointers to objects that become NULL once the objects are destroyed (after the call to addTexture()?).

I've also read about storing deep copies of the textures in the vector, but I'm unsure how to do that, as I only seem to have access to pointers to textures.

Any help or advice greatly appreciated - especially if I'm just going about this the wrong way!

Thanks,
Rich.

sentences:
generate box2d bodies from isometric tiled map I followed the tutorial here to generate box2d bodies from a tiled map and that worked fine.... for orthogonal tiled maps. Unfortunately isometric maps use their own coordinate system where (0, 0) is at the leftmost corner of the map, and this causes the bodies to be in the wrong place.

I tried implementing a transformation matrix or just transforming the body but I don't think that is possible (or at least I could never find a way). How else can this be solved? Here is the relevant method that needs to be changed:

private Shape getPolygon(PolygonMapObject polygonObject) {
    PolygonShape polygon = new PolygonShape();

    float[] vertices = polygonObject.getPolygon().getTransformedVertices();

    float[] worldVertices = new float[vertices.length];

    for (int i = 0; i < vertices.length; ++i) {
        worldVertices[i] = vertices[i] / units;
    }

    polygon.set(worldVertices);
    return polygon;
}

As you can see I need a way to convert the isometric coordinates to game coordinates using just plain math or something else like a matrix. I think the only line needing to be changed is the line in the for loop.

sentences:
How does GL_INT_2_10_10_10_REV work for color data? Can anybody tell me how exactly to use GL_INT_2_10_10_10_REV as type parameter in glVertexAttribPointer()?

I am trying to pass color values using this type. What is the significance of "REV" suffix in this type? Does it require any special treatment in the shaders?

sentences:
How do I avoid floating point indeterminism when implementing lockstep? I am working on a multiplayer RTS game in Java. It uses lockstep for networking, which requires that both computers can deterministically.

These are the 2 closest/more viable approaches I could come up with- but both have issues:

The first is to just use int and long for all my player positions and stuff, and get any use of floating point math totally out of the game model. I like this concept- but the problem is what happens when I need a square root, or a cosine? I would have to basically make an entire math library!
I also found that I can use the strictfp modifier and StrictMath class to do deterministic math with doubles... Which I could see using this to create deterministic math within my games model. It would be very prone to bugs as it would be very easy to accidentally go outside of the "strict" scope though.

Also I cant seem to figure out if serializing a float or double causes it to lose its determinism. I'm using Kryo/Kryonet right now, but I cant seem to find any information on if it is deterministic with floats or not (I cant seem to find any information on the built in java serialization either, or any other serialization library)

Does anyone have any suggestions on how I could tackle this problem?

sentences:
Implementing Geometry Instancing in DirectX I have a project that I'm doing in Managed DirectX (DX9) where I want to render lots of grass. My current method (many draw calls) is slow, but I've heard Geometry Instancing can fix that.

I know that I have to have one vertex buffer to store the vertices that will drawn multiple times. I know that I need another vertex buffer to store the transformations (from what I've seen you can only have one additional vertex buffer). So should the second vertex buffer store transformation matrices? I tried coding this, but when I want to create a new vertex buffer one of the required parameters is vertexFormat, but I can't supply a vertex format since this is a matrix.

I also wanted to try to have the second vertex buffer store the translation values as Vector3, but how do I tell DirectX that the values in the second vertex buffer are to be used as translation values? Secondly, I also need rotation values. Do I store these in a third vertex buffer?

Basically, I want to use geometry instancing to draw multiple instances of a  quad that are rotated and translated.

sentences:
semi 3d walls, should I use sprite sheet or render them 3d? I'm going to develop a game and this is just a prototype of it's graphics.

Knowing that my primary target platform is iPhone, I'm wondering if it's better to create a spritesheet containing all possible angles from a wall or is it better to render them with 3d boxes?

here is sample spritesheet I was going to use:

sentences:
Creating iOS shortcut game with levels How can I make levels in iOS shortcuts?
i'm making a game which will be about changing some settings to finish levels (logic game) i had idea to make autosave because levels will require that. my idea was about using rarely used system app named 'reminders' where i can save progress in a part of one reminder named 'notes' but shortuts app doesn't recognize 'otherwise' feature for if loop and when i tap shortcut it adds only one more reminder and doesn't show upcoming first level ios version is 14.4.1 (beta i think) and tablet is after JB (but i've never modified shortcuts app) .
xml source from shortcut (github) : https://github.com/hacknorris-notyetbanned/hacknorris.github.io/blob/77a47bff65bc13f21642dbebdf4023aa957ebb0a/Test.xml
where is bug in reminders?
Edit: now i wont mess up on shortcuts - im gonna update this : https://github.com/hacknorris-notyetbanned/glitched.git and leave project. I have 0 ideas and logged out of icloud...  :/

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:
Creating a Nations Stockpile If I created different XML files for each Nations' Stockpiles and made an XMLmanager to do updates such as resource consumption and trade, wouldn't that be too much resource intensive? I mean, if I had to access each Nations' stockpiles every tick and update them (Quantity, Price, Quality).

Is there any other faster way to manage all those updates?

From the back and forth in the comments, I've came up with this approach.

public class Nation
{
    public string NationName;
    public int Population;

    public void NationCreator(string name, int pop)
    {
        NationName = name;
        Population = pop;
    }

    public class Stockpile
    {
        public int food;
        public int water;
        public int wood;

        //Then methods to work with that stockpile
    }
}

However, after some thinking and reading, my next approach to this problem will be Arrays but I only know how to make an array of one particular type like:

double[] balance = { 2340.0, 4523.69, 3421.0};

How could I do an array like this (Lua style array) in C# language?:

raw_material = {
    cotton = {
        Value = 17.50
    }
}

sentences:
How can I simulate physics on my curved LED strip? I have a LED strip with 300 LEDs that I can control one by one:

https://github.com/cipold/pyledstrip

You can think of them as Adafruit NeoPixels:

https://www.adafruit.com/category/168

I have code to detect the physical positions of all LEDs using a camera and generate an x/y heightmap:

https://github.com/cipold/pyledstrip-detector

There is some experimental code to make use of the heightmap and let pixels race along the strip like on a rollercoaster:

https://github.com/Pixe1/pyledstrip-particles
Video: http://mnagel.net/oneshot/2018-03-02/particle.mp4/975a194be7cc6fc8/particle.mp4

The "physics engine" within that code is very ad-hoc, however. I want to rewrite it into something that more explicitly encodes the physical laws of classical/Newtonian mechanics.

I can easily simulate particles with mass, position, velocity (acceleration/gravity/forces). With multiple particles and gravity between them, I would end up with some kind of solar system. Or with constant overall gravity, one particle would fall down in a straight line, accelerating all the time.

What I really want is "global gravity" but restrict the particles to move along the path dictated by the LED strip/heightmap of waypoints (one degree of freedom along that path). How can I adequately model this restriction with formulas that are still reasonably physically accurate?

sentences:
Is it possible to control the difficulty of a multiplayer game? I'm developing a multiplayer game, played between 2 players. But in these types of games, there can only be 1 winner and 1 loser for per match. So for each player who wins, another player had to lose. This means that roughly 50% of all players in the game are having a bad time (losing more than they win).

In a single-player game, it's easy to solve the problem of "50% of players lose more than they win." You just make the game easier to beat (reduce difficulty). Unfortunately, you can't do this with a multiplayer game, since players' opponents are other players. I don't know if there's a way to control the difficulty of a multiplayer game, but is this even possible?

sentences:
How do you do AI path following within a 2d physics engine like farseer/box2d? I'm in the process of moving a 2d top down game I've been working on into a proper rigid body physics engine like Farseer. Up until now, I had just hacked together my own physics code where needed.

I'm trying to learn the proper way of doing things here.

What is the proper way to make your AI follow a set path once you have made them rigid bodies inside of the physics engine?

If I have a path of navigation nodes on my map that I need the AI to follow, previously I would just move them along the path manually by calculating the next position they should be at for the next time step and manually setting them to that position.

But now they are rigid bodies and subject to collisions and any forces that may hit them and knock them off path.

So to make the AI move I believe I should now be applying impulses/forces to them? I should no longer be manually setting their position each frame.

So I think I need to go from a deterministic world where I force the AI to strictly follow a path to a non-deterministic world where they could get knocked about in any direction if hit and I simply nudge them towards the next node in the path to make them move.

Is that right? Is that how other people do it?

This raises some questions about how to then avoid your AI getting stuck on corners of scenery now that they aren't walking a precise path, how do you guys handle that type of thing?

Or is it better to somehow mix the two and still have your AI follow a fixed path by setting their position manually, and only react to other forces under certain circumstances you can easily control?

Thanks for any advice guys.

sentences:
How can I GL_SELECT from a gluPerspective-transformed scene? I'm using JOGL to access OpenGL-methods on an old OpenGL version, because of school.

I have written a method which is called before any objects are drawn. This method shows which object is picked.

Before I call my "picking" method, I draw a camera. This is where the problems begin: I can't click precisely on the objects, because they don't know they are transformed by the camera.  I have tried to leave the projection matrix unchanged, but this leads to other problems...

I first draw the camera, then do picking, then draw the objects to screen.

What am I missing?

My camera:

public void draw(GL2 gl) {
    GLU glu = GLU.createGLU(gl);
    gl.glMatrixMode(GL2.GL_PROJECTION);
    gl.glLoadIdentity();

    glu.gluPerspective(viewingAngle, whRatio, 1, 1000);

    gl.glMatrixMode(GL2.GL_MODELVIEW);
    glu.gluLookAt(xPos, yPos, distance, 0, 0, 0, 0, 1, 0);
}

My picking method:

private void picking(GL2 gl) {
    if (currentClickPoint != null) {
        int buffSize = 512;
        int[] select = new int[buffSize];
        int viewport[] = new int[4];
        IntBuffer selectBuffer = newDirectIntBuffer(buffSize);

        gl.glGetIntegerv(GL2.GL_VIEWPORT, viewport, 0);

        gl.glSelectBuffer(buffSize, selectBuffer);
        //gl.glMatrixMode(GL2.GL_MODELVIEW);
        gl.glRenderMode(GL2.GL_SELECT);
        gl.glInitNames();
        //gl.glPushName(-1);

        gl.glMatrixMode(GL2.GL_PROJECTION);
        gl.glPushMatrix();
        gl.glLoadIdentity();

        glut.gluPickMatrix((double) currentClickPoint[0],
                (double) (viewport[3] - currentClickPoint[1]),
                10.0, 10.0, viewport, 0);

        //gl.glOrtho(0.0, 8.0, 0.0, 8.0, -0.5, 2.5);

        gl.glMatrixMode(GL2.GL_MODELVIEW);
        drawObjects(gl, GL2.GL_SELECT);

        gl.glMatrixMode(GL2.GL_PROJECTION);
        gl.glPopMatrix();
        gl.glMatrixMode(GL2.GL_MODELVIEW);
        gl.glFlush();

        selectBuffer.get(select);

        interpretClicks(select, gl.glRenderMode(GL2.GL_RENDER));

        resetClickPoint();
    }
}

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:
How are animations specified by an artist but implicitly understood by the game engine? I'm trying to understand the relationships between 3D models (files) and the games that load and use them. As a software engineer, I'm willing to make the few following assumptions:

I would assume that most (popular) 3D model formats are basically just storing coordinate positions for all the vertices that make up the model. They probably also store texture/theming information about each polygon (that is formed by combining 3+ vertices)
I would also assume that "labeled animations"" are stored in these files as well. This way, a 3D artist could make a model of some character, and animate them running all from inside whatever tool they use for modeling. Then they associate that animation with some label ("bad_guy_running") and all that info is stored inside the resultant file. Then, in the game code, the developers can programmatically access + execute those labels somehow, therein reproducing the same animation from inside the game. In our case, the bad guys starts running.

Am I way off base here? If so, please begin by correcting me, and please be gentle, as again I'm not even sure what this subject matter would be called to even do the upfront research on my own.

sentences:
Can't connect to Steam using Blueprints in UE4.25 I'm following this tutorial by Unreal Engine itself, but I don't have a Steam overlay popup like I'm supposed to, (according to the tutorial.) And actually a lot of people have a similar issues like this.
What I have done / tried is:

Enabling Steam overlay (in Steam settings, but it was already enabled)

I've already edited the DefaultEngine config file

I'm playing my game (in Unreal Engine) from the Standalone Game option

Searching this up, re-watching tutorial, looking at tutorial's comments

Enabled the Online Subsystem Steam plugin

And I still don't know what the issue is. I've also looked at this thread by the Unreal Engine community, but it didn't help that much.

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:
How should I change the script so I will be able to change the transform height while the game is running and the transform is following? using System;
using System.Collections;
using System.Collections.Generic;
using System.Linq;
using UnityEngine;
using UnityEngine.UI;

public class Follow : MonoBehaviour
{
    public Transform targetToFollow;
    public Transform missionTarget;
    public Text textDistance;
    public Text textSpeed;
    public float lookAtRotationSpeed;
    public float moveSpeed;
    public float followRadius = 1.5f;
    public float fastRadius = 5f;
    public float speedBoost = 0.5f;

    void Start()
    {

    }

    // Update is called once per frame
    void FixedUpdate()
    {
        Vector3 lTargetDir = targetToFollow.position - transform.position;
        lTargetDir.y = 0.0f;
        transform.rotation = Quaternion.RotateTowards(transform.rotation,
            Quaternion.LookRotation(lTargetDir), Time.time * lookAtRotationSpeed);

        float ms = moveSpeed;
        var distance = Vector3.Distance(transform.position, targetToFollow.position);
        // Compute a position no further than followRadius away from our target.
        Vector3 fromTarget = Vector3.ClampMagnitude(-lTargetDir.normalized, followRadius);
        Vector3 stopPoint = targetToFollow.position + fromTarget;

        // Compute a speed that's faster when far away and slower when close.
        float speedBlend = Mathf.Clamp01((distance - followRadius) / (fastRadius - followRadius));

        ms = moveSpeed + speedBlend * speedBoost;

        // Move as far as we can at our speed ms to reach the stopPoint, without overshooting.
        transform.position = Vector3.MoveTowards(transform.position, stopPoint, Time.deltaTime * ms);
    }

    private void Mission()
    {

    }
}

I mean the transform of the gameObject the script is on.
I want to keep the y position up all the way or at least make it finish moving on the ground or above the ground depending on my settings.
Now the transform the script is attached to the name is NAVI.
NAVI is by default position Y set to 5.94 :

Then the game start NAVI is moving to the target the kid_from_space in this case.
Kid_from_space position is at 0,0,0 when the NAVI getting close to the target NAVI position Y is 0 and the result is :

Therefore the NAVI is not on the ground and I also can't change it's Y position up or down. The NAVI is stuck at the Y 0 position. I want to be able to change the Y position up/down, for example if before the game is running I'm setting the Y position of NAVI to 5.94 or 6 or 21 I want the NAVI to stay at this position on the Y and not move down to 0.

sentences:
Why isn't my rotation smooth? I'm currently working on a twin stick shooter but I encountered a problem when I rotate my player. The rotation snaps to right angles. I'm guessing it's a problem, due to the value that the joystick gives me back. Here is a screen recording, via Giphy.

How do I go about fixing this problem?

This is my code:

 void FixedUpdate()
{

    float hR = gamepad.GetStick_R().X;
    float vR = gamepad.GetStick_R().Y;

    float lastHR = hR;
    float lastVR = vR;
    // This part was added recently in the hope of smoothing the rotation
    float lerpHr = Mathf.Lerp(lastHR, hR, Time.deltaTime * speedRotation);
    float lerpVr = Mathf.Lerp(lastVR, vR, Time.deltaTime * speedRotation);

    PlayerRotation(lerpHr, lerpVr);
}

void PlayerRotation(float h, float v)
{
    rotation.Set(h, 0f, v);

    if (rotation != Vector3.zero)
    {
        currentRotation = Quaternion.LookRotation(rotation);
        playerRigidbody.MoveRotation(currentRotation);
        lastRotation = currentRotation;
    }
    else
        playerRigidbody.MoveRotation(lastRotation);
}

I also tried two other ways, but each time, I got the same results. I tried every way I could think of, with these lines of code. I don't know where else to look.

// Attempt Two
playerRigidbody.transform.rotation = Quaternion.Slerp(p
    layerRigidbody.transform.rotation, currentRotation, Time.time * speedRotation);

// Attempt Three
transform.eulerAngles = new Vector3(0, Mathf.Atan2(v, h) * 180 / Mathf.PI, 0);

sentences:
What am I doing wrong? Date comparison There's this one precious little if in my code that is not doing what I want him to do.

Language is written in C# and doing it in Unity

Basically, I put a date on the Inputfield, which is linked to: BonoFinish, as soon as BonoFinish reaches DateTime.Now, it should appear a new gameobject, problem is... it does crap. What am I missing? Here's the code:

if (BonoFinish ==  DateTime.Now)
    {

        PagPrincipal.SetActive (false);

        print (DateTime.Now);

        Bonos.SetActive (true);

        Debug.Log ("funciona");

        Invoke ("apagaBonos", 30f);
    }

Also, Bonofinish is written like this:
 BonoFinish = DateTime.ParseExact (HoraBono.text, "dd-MM-yyyy HH:mm", null);

sentences:
Get GPU Visualizer widget info I want to read some info from the GPU Visualizer widget and use it in my plugin, but I have no idea how.
I guess this code is responsible for running the ProfileGPU console command:
        // Create and display profile visualizer data
        if (RHIConfig::ShouldShowProfilerAfterProfilingGPU())
        {

        // execute on main thread
            {
                struct FDisplayProfilerVisualizer
                {
                    void Thread( TSharedPtr<FVisualizerEvent> InVisualizerData, const FText InVsyncEnabledWarningText )
                    {
                        static FName TaskGraphModule(TEXT("TaskGraph"));
                        if (FModuleManager::Get().IsModuleLoaded(TaskGraphModule))
                        {
                            IProfileVisualizerModule& ProfileVisualizer = FModuleManager::GetModuleChecked<IProfileVisualizerModule>(TaskGraphModule);
                            // Display a warning if this is a GPU profile and the GPU was profiled with v-sync enabled (otherwise InVsyncEnabledWarningText is empty)
                            ProfileVisualizer.DisplayProfileVisualizer( InVisualizerData, TEXT("GPU"), InVsyncEnabledWarningText, FLinearColor::Red );
                        }
                    }
                } DisplayProfilerVisualizer;

                TSharedPtr<FVisualizerEvent> VisualizerData = CreateVisualizerData( EventTree );

                DECLARE_CYCLE_STAT(TEXT("FSimpleDelegateGraphTask.DisplayProfilerVisualizer"),
                    STAT_FSimpleDelegateGraphTask_DisplayProfilerVisualizer,
                    STATGROUP_TaskGraphTasks);

                FSimpleDelegateGraphTask::CreateAndDispatchWhenReady(
                    FSimpleDelegateGraphTask::FDelegate::CreateRaw(&DisplayProfilerVisualizer, &FDisplayProfilerVisualizer::Thread, VisualizerData, VsyncEnabledWarningText),
                    GET_STATID(STAT_FSimpleDelegateGraphTask_DisplayProfilerVisualizer), nullptr, ENamedThreads::GameThread
                );
            }

        }

Any ideas on how to get the widget? Or maybe there is an easier way to get that info?

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 do i initialize and use a Texture Array? LibGDX First of all, I am new to Java and LibGDX..

What I am trying to do is Load my texture images into an array so that I can reference them in my drawing code by number, rather than by name.
I am drawing a tile map.

Instead of this:

tile1 = new Texture(Gdx.files.internal("grass.png"));
tile2 = new Texture(Gdx.files.internal("dirttile.png"));
tile3 = new Texture(Gdx.files.internal("watertile.png"));

I would like it to be more like:

tile[1] = new Texture(Gdx.files.internal("grass.png"));
tile[2] = new Texture(Gdx.files.internal("dirttile.png"));
tile[3] = new Texture(Gdx.files.internal("watertile.png"));

..so that later I can draw them by which tile I need..such as

tileType = worldMap[i][j]; //will be an int number
batch.draw(tile[tileType], tileX, tileY);

I can't figure out how to initialize array and load textures into it though in order to do this, without getting errors.

Basically I need to draw my map based on numbers I have in a tile map like this:

 int worldMap[][] = {
            { 1,1,1,1,1,1,1,1,1,1 } ,
            { 1,1,1,1,1,1,1,1,1,1 } ,
            { 1,1,1,1,1,1,1,1,1,1 } ,
            { 1,1,1,3,3,3,1,1,1,1 } ,
            { 1,1,1,3,3,3,1,1,1,1 } ,
            { 1,1,1,3,3,3,1,1,1,1 } ,
            { 1,1,1,1,1,1,1,1,1,1 } ,
            { 1,1,1,1,1,1,1,1,1,1 } ,
            { 1,1,1,1,1,1,1,1,1,1 } ,
            { 1,1,1,1,1,1,1,1,1,1 } ,
    };

I need to draw the map tile based on the numbers in that map... 1 = grass 2 = dirt 3 = water etc....
Still no luck getting the array working.

sentences:
Should I store local forward/right/up vector or calculate when necessary? I'm working on an object picking and translation/rotation/scale gizmos system in my engine where you select objects and perform transformations on them in a 3d editor-like fashion (e.g. Blender)

In my transform struct, I'm storing the position, rotation angle, rotation axis and a uniform scale value. When transforming my objects, I build the TRS matrix which forms my ModelToWorld matrix. All good.

Now I want to add the notion of local vs world translation. i.e. you select an object, and you can either move it along its local x axis, or the global x axis.

The global movement is easy I just add directly to my position vector. But for the local one, I have to build a local forward/right/up vector. e.g.

v3 GlobalUp = V3(0, 1, 0);
v3 LocalUp = m4_Rotate(Rotation->Angle, Rotation->Axis) * GlobalUp;

And then I translate my position by that amount:

Selection->Transform.Position += LocalUp;

I'm kind of torn whether I should store these local up/forward/right vectors in my transform (which means I have to calculate them once every frame in my update function, but every use of them after that point needs no calculation) or only when needed (no need to calculate every frame, but I have to call a function to do the calculation every time I need one, I could still keep the value in a local variable in my usage area if I'm using it more than once)

I'm not sure what approach to go with but I'm leaning towards calculating them as needed.

Are there any other pros/cons to each approach? or is this one of those things where there's no 'absolute right' way to do it?

Any advice is appreciated!

sentences:
How to only allow a certain amount of the same instance in Game Maker? I am creating a simple jump n' run game. For some reason my game sometimes spawns two instances of the same enemy on top of each other. So you can't tell there are two of him until he uses his attack where he shoots a barrage of bullets in random directions.

So now when the game spawns two of them, there are also twice as many bullets which makes the game too difficult to play.

I don't know what causes the game to spawn two. It only happens very rarely. I would just make it so that if there are two instances of the same enemy, it destroys one of them.

That would solve the problem.

sentences: Why am I getting a down arrow in my Unity scene when using Oculus Rift and how do I get rid of it? In Unity, I have set up a scene to try out in Oculus Rift. When I hit play in Unity, everything works fine until about 5 seconds later when I get an arrow (Assets>OVR>Textures>out.png) that appears in the center of my screen and won't go away. What does this arrow mean and how can I get rid of it? It is obstructing my view of the level that I am trying to view.

sentences:
how to do sprinkle effect of water in opengl in android? I want to achieve sprinkling effect of water in android using opengl.
so,
do i need to achieve it with graphics?
is there any other way to do it using opengl?

or how can i start working on this,any links?

sentences: How to calculate the distance from the camera to make a GameObject fill the screen? How do you calculate the distance from the camera so that a GameObject fills the screen? I.e. Without reaching out of the view and regardless of screen orientation.

sentences:
Developing addons for xbox one controller I want to develop an addon that plugs to the bottom of the controller for the xbox one. Can I legally make addons to the xbox one controllers without Microsoft's blessing?

If so, has anyone done anything like this? Cursory search looks like it has not been done.

sentences:
Why are my exported illustrator graphics blurry and messy in-game when scaling? Non-scaled image:

And this is 2x-scaled:

I use 300dpi and did tick anti-aliasing settings for export png-24 image for my game in illustrator. But it look still bizzard when scaling. Could you please tell me what's wrong here??

What is the best way to get better art in my case?

Thank you in advance!

sentences:
Triangle-Plane intersection in 3D space I would like to clip a triangle if its bounds lie partially out of a cube. I guess I would need some kind of Triangle Plane intersection code - I'm not well versed with math but I do have the points of the triangle in 3d space (P1, P2, P3).

How do I get the 2 points of intersection of the triangle with one of the planes of the cube?

sentences:
Character doesn't move. I think I've tried everything, so I'm asking [Unity3D] The animations are playing fine, however I can't manage to move my character.
My script:

using UnityEngine;
using System.Collections;

public class PlayerMovement : MonoBehaviour {

    public float turnSmoothing = 20f;
    public float speedDampTime = 0.1f;
    public float jumpHeight = 8.0f;

    private Animator anim;
    private Rigidbody rb;
    // Use this for initialization
    void Start () {
        anim = GetComponent<Animator>();
        rb = GetComponent<Rigidbody>();

    }

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

    }

    void FixedUpdate()
    {
        float h =- Input.GetAxis("Horizontal");
        float v = Input.GetAxis("Vertical");
        MovementManagement(h,v);

    }

    void MovementManagement (float horizontal, float vertical)
    {
        if (horizontal != 0.0f || vertical != 0.0f)
        {
            anim.SetBool("Move", true);
            anim.SetFloat("Speed", 6.0f, speedDampTime, Time.deltaTime);
            Rotating(horizontal, vertical);

        }
        else
        {
            anim.SetFloat("Speed", 0.0f);
            anim.SetBool("Move", false);
        }

    }

    void Rotating (float horizontal, float vertical)
    {
        Vector3 targetDirection = new Vector3(horizontal, 0.0f, 0,0f); //2.5D I just want to move on the x-axis atm
        Quaternion targetRotation = Quaternion.LookRotation(targetDirection, Vector3.up);
        Quaternion newRotation = Quaternion.Lerp(rb.rotation, targetRotation, turnSmoothing * Time.deltaTime);
        rb.MoveRotation(newRotation);
    }

}

My character's inspector:

sentences:
Android - Canvas.drawBitmap gives an awful performance I am using SurfaceView for my game and I am loading all of the bitmaps that are the right size for the screen (pre-scaled in mipmap folder) into a class when the game starts. And I am drawing the bitmaps to the canvas using the drawBitmap method.
Though all of the bitmaps are compressed in 8 bit PNG format and scaled for the screen size, I am getting an awful FPS rate (around 40 FPS)
Things I have tried:
Made sure drawBitmap is the cause of the issue by recording the performance via performance monitor and examining the results. Basically, that is the only method that is causing an overhead.
Trimmed all of the transparent bits that are on the sides and used the fill canvas method for the background.
Scaled and compressed the bitmaps properly
Made sure nothing above or below the screen gets rendered
So this left me wondering; is a modern phone equipped with who knows how many times more powerful CPU and GPU than the computers in the early 2000s unable to utilize its hardware and thus unable to perform such a simple rendering request that those computers that are 2 decades old managed to do? I know drawBitmap uses CPU but nonetheless...
I am only drawing a bitmap that is 1/3 of the size of the screen and 2-3 small bitmaps on top of it (1/6 of the screen size) seeing as low as 30 FPS in such a simple task after all those optimizations is simply disappointing. Migrating to OpenGL will break so many parts of the code and obviously will be more challenging. And as far as I know, there isn't a library that simplifies drawing bitmaps by handling the OpenGL side and only exposes the canvas-like API.
So is there anything else I can do to increase the performance?

sentences:
Modern techniques for spriting I would like to know the flow for making modern 2D game artwork.

How are the assets made nowadays? Bitmap? Vector-based? Hand-drawn and painted? Drawn digitally? Modeled in 3D and exported to bitmaps?

I would like some information on programs as well, for fine looking art.
Why does Flash's vector art style look good in most games? How do I make equivalent graphics with external tools? Or equaly good and not vector-based, anyway.

Any special hints for animating?

An answer oriented towards a one-man-army indie developer with little experience but some artistic sense would be appreciated! Not a complete dummy with paint programs, but also not a master at all, just need efficient ways to achieve results.

Thanks.

NOTE: Pixel art is not the goal of this question, nothing related to direct pixel manipulation should be brought up here, but you're free to do exactly that :)

sentences:
Pairing algorithm for the Elo rating system Imagine a 1 on 1 (not teams) competition between AI bots, like the Google AI Challenge.  The various bots are assigned an ELO rating based on the outcome of the various versus matches.  The reason I specify AI bots as they can compete 24/7 without regard for player fatigue, geolocation, etc.

Given limited server resources only so many bouts can be run per day.  I'm looking for a heuristic (or an optimal algorithm) to choose which two bots should compete next.

All the past competitions have been tracked.  By this I mean that the algorithm has more to work with than just the ELO ratings.

The use cases I'm partitularly interested in:

The competition has been pairing randomly for while and now I want to make intelligent pairing decision.
The Elo rating have stabilized and a bot is updated.
The Elo ratings have stabilized and new bot is introduced to the competition.

Update:
I need to clarify.  I'm not looking for an algorithm that will provide fair matches.  I'm looking for an algorithm that will find matches most likely to update the Elo ratings of the bots to their "true" ratings with the least number of matches.

sentences:
Unity c#: Interface object never equals null I've created an interface class for some mechanic I'm using to interact with things in my game. Now, I noticed that checking if that value is null never returns true.
Here's a screenshot of where this happens:

The error I get is the following:

MissingReferenceException: The object of type 'InteractiveItem' has been destroyed but you are still trying to access it.
Your script should either check if it is null or you should not destroy the object.
InteractiveItem.CurrentGameObject () (at Assets/Scripts/Interactive/InteractiveItem.cs:10)
Interactive.ManualStopInteract () (at Assets/Scripts/Interactive/Interactive.cs:30)

The line where this fails is:

if (IsInteracting() && this.interacting.CurrentGameObject().GetComponent<InteractiveUtilityChest>() == null && !MainReferences.UIReferences.IsAnyMenuWindowOpen()) {
        // do something
}

The IsInteracting() check is for some reason returning true here because the last line (InteractiveItem.cs:10) is in the method interacting.CurrentGameObject()

I don't get how this can happen or how I should solve it. As far as I know, an interface is a nullable type.

sentences:
Impact of increasing physics simulation rate I am working one Mini Golf game development using Scenekit (iOS). To fix one of the problem with Scenekit, I have to increase the physics simulation rate by 4 times.

Questions:

What is the impact on the CPU requirements?
What are the common advantages and disadvantages of changing the physics simulation rate?
What are the expected problems/issues with such increase in the physics simulation rate?

I would appreciate any suggestion on this topic. Thank you.

sentences:
Libgdx and Box2D TiledMap render is not smooth I'm building simple side scroller game. My player (square) move fast and it interacts with other world objects. Problem is when my player is moving it seems that all world is rendering somehow strange (for example box2d objects are not rendering smooth). When player is not moving everything is ok. Here pic when player is moving

and here when my player stands still

Here I add my code

private OrthogonalTiledMapRenderer renderer;

mapLoader = new TmxMapLoader();
    map = mapLoader.load("level1.tmx");
    renderer = new OrthogonalTiledMapRenderer(map, DIV);
    gamecam.position.set((gamePort.getWorldWidth() / 2),    (gamePort.getWorldHeight() / 2), 0);

public void update(float dt){
        world.step(1/60f, 6, 2);
        if(playerAndGroundTest){
            player.update(dt);
        }

        float x = gamecam.position.x - gamecam.viewportWidth * gamecam.zoom / DIV;
        float y = gamecam.position.y - gamecam.viewportHeight * gamecam.zoom / DIV;

        float width = gamecam.viewportWidth * gamecam.zoom * 2 / DIV;
        float height = gamecam.viewportHeight * gamecam.zoom * 2 / DIV;
        renderer.setView(gamecam.combined, x, y, width, height);

        gamecam.position.set(new Vector2(player.getBody().getPosition().x, (gamePort.getWorldHeight() / 2)), 0);
        gamecam.update();
    }

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

        renderer.render();

        b2dr.render(world, gamecam.combined);
    }

here's Player update function

public void update(float dt){
        body.setLinearVelocity(200 * dt, body.getLinearVelocity().y);
    }

sentences:
How can I implement "cut outs" for lighting in OpenGL? So, I'm working with OpenGL (I'm not exactly sure of the version), and I want to do an old-style lighting setup by essentially drawing a black rectangle over the screen, and drawing white circles over the areas that should be lit. I already have the rectangle and the circles, but I can't figure out how to make it so that the white circles are transparent when applied to the black areas. Any ideas? I tried to use blending modes, but it still evades me...

EDIT: Here's the code that I'm using (Python).

view_buf = Buffer(GL_INT, 4)
glGetIntegerv(GL_VIEWPORT, view_buf)
view = view_buf.to_list() if hasattr(view_buf, "to_list") else view_buf.list

glDisable(GL_DEPTH_TEST)

glDisable(GL_LIGHTING)

glEnable(GL_BLEND)

if logic.lights['smooth']:
    glEnable(GL_LINE_SMOOTH)

# # Make sure we're using smooth shading instead of flat
# glShadeModel(GL_SMOOTH)

# Setup the matrices

glMatrixMode(GL_PROJECTION)
glPushMatrix()
glLoadIdentity()
gluOrtho2D(0, view[2], 0, view[3])
glMatrixMode(GL_MODELVIEW)
glPushMatrix()
glLoadIdentity()

#glAlphaFunc(GL_GREATER, 0.5)

glColor4f(0.0, 0, 0, 0.75)

glBegin(GL_QUADS);                              # Draw Black screen
glVertex2d(0.0, 0.0);
glVertex2d(view[2], 0.0);
glVertex2d(view[2], view[3]);
glVertex2d(0.0, view[3]);
glEnd()

glColor4f(1, 1, 1, 1)

degtorad = 3.14159/180.0

glBlendFunc(GL_ZERO, GL_SRC_ALPHA)

def DrawCircle(x, y, radius, fill = 1, step = 11):

    glVertex2f(x, y)

    if fill:
        glBegin(GL_TRIANGLE_FAN)
    else:
        glBegin(GL_LINE_LOOP)

    for a in range(0, 360, step):
        angle = degtorad * a
        glVertex2f(x + (sin(angle) * radius), y + (cos(angle) * radius))

    glEnd()

#for layer in range(len(logic.lights['layers'])):
#   size =
for light in logic.lights['points']:
    DrawCircle(light[0][0] * view[2], (1 - light[0][1]) * view[3], light[1], step = light[2])
    if logic.lights['smooth']:
        DrawCircle(light[0][0] * view[2], (1 - light[0][1]) * view[3], light[1], 0, light[2])

# Reset the state
glPopMatrix()
glMatrixMode(GL_PROJECTION)
glPopMatrix()

sentences:
add the variation of the angle to its current angle: trouble with 180 and -180 I need to rotate a character, I would like to add the variation of the angle to its current angle. But my values are between 180 and -180. So if my character is at -179, then he goes right, it arrives at 179. how to compare that it turned by 2 degrees on his right? The goal is to say : "turn only 2 degrees on your right no matter where you are in the world".
Same thing from 179 to -179 : 2 degrees to the left.

Thanks

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:
Java JBullet Mesh collsion problem I have a problem with JBullet mesh collsion. Everything works fine when I create a mesh from my object without scaling, but the problem starts when I want to scale the object. I also tried scaling in Blender, but it has the same problem. Here is my code for creating a mesh from an object:

    int numtriangles = mesh.vertices.length / 3;
    int numverts = mesh.vertices.length;

    ByteBuffer indexBuffer = BufferUtils.createByteBuffer(numverts * 3 * 4).order(ByteOrder.nativeOrder());
    indexBuffer.clear();
    for(int i=0;i<numtriangles;i++) {
       indexBuffer.putInt(i);
       indexBuffer.putInt(i);
       indexBuffer.putInt(i);
    }

    ByteBuffer geometry = BufferUtils.createByteBuffer(numtriangles * 3 * 4).order(ByteOrder.nativeOrder());
    geometry.clear();
    for(int i=0;i<numtriangles;i++) {
       geometry.putFloat(mesh.vertices[i].getPos().x);
       geometry.putFloat(mesh.vertices[i].getPos().y);
       geometry.putFloat(mesh.vertices[i].getPos().z);
    }

    geometry.rewind();
    indexBuffer.rewind();

    TriangleIndexVertexArray trimesh = new TriangleIndexVertexArray(numtriangles, indexBuffer, 3 * 4, numtriangles, geometry, 3 * 4);
    BvhTriangleMeshShape shape = new BvhTriangleMeshShape(trimesh,true);
    return shape;

My scaling was something like this:

    for(int i = 0; i < vertices.length; i++) {
        Vertex acc = vertices[i];

        Vector3 pos = acc.getPos();
        pos.x *= scale.x;
        pos.y *= scale.y;
        pos.z *= scale.z;
        acc.setPos(pos);

        Vector2 tex_coord = acc.getTexCords();
        tex_coord.x *= scale.x;
        tex_coord.y *= scale.z;
        acc.setTexCords(tex_coord);

        vertices[i] = acc;
    }

The problem is when I scale the object, it no longer collides with other objects.

sentences:
Compatibility between DirectX 9 and DirectX 10 shaders I am a beginner to game development and as I am used to programming in C# I decided to go for XNA. I've been playing around with it for a while and now I am learning the basics of HLSL shaders, I have noticed in the MSDN documentation that there have been some syntax changes in HLSL between DirectX 9 and DirectX 10, for example, the Sampler type

Since I am having some troubles with my desktop pc, I am using my laptop which video card only supports DirectX 9.0c. Then I'm gonna have to write my shaders using the DirectX 9 syntax, right? So I am wondering, will my HLSL shaders written using the DirectX 9 syntax work on a system running DirectX 10 (or higher)?

sentences:
Checking for collisions on a 3D heightmap I have a 3D heightmap drawn using OpenGL (which isn't important). It's represented by a 2D array of height data. To draw this I go through the array using each point as a vertex. Three vertices are wound together to form a triangle, two triangles to make a quad. To stop the whole mesh being tiny I scale this by a certain amount called 'gridsize'.

This produces a fairly nice and lumpy, angular terrain kind of similar to something you'd see in old Atari/Amiga or DOS '3D' games (think Virus/Zarch on the Atari ST).

I'm now trying to work out how to do collision with the terrain, testing to see if the player is about to collide with a piece of scenery sticking upwards or fall into a hole.

At the moment I am simply dividing the player's co-ordinates by the gridsize to find which vertex the player is on top of and it works well when the player is exactly over the corner of a triangle piece of terrain.

However...

How can I make it more accurate for the bits between the vertices? I get confused since they don't exist in my heightmap data, they're a product of the GPU trying to draw a triangle between three points. I can calculate the height of the point closest to the player, but not the space between them.

I.e if the player is hovering over the centre of one of these 'quads', rather than over the corner vertex of one, how do I work out the height of the terrain below them? Later on I may want the player to slide down the slopes in the terrain.

sentences:
Unreal Engine Niagara Write to Texture or Data Structure In the Niagara system, is there any way to write to a texture? I want to write the position of each particle into a texture. So the 2d grayscale texture has its intensity as the number of particles in the pixel.

Or, is there any data structure that I can use to store the particle positions? Something like 2d or 3d array?

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:
Making a 2D Platformer in C++/SDL. Looking for tutorials/examples/resources I have a lot of experience with C++, but I have no experience with game programming.  This summer I plan to create a 2D platformer from scratch using C++/SDL for the learning experience.  I am looking for as many resources as possible to help me get started.  Good source code, tutorials, anything.

One of the best tutorials I've found are the inactive jump 'n' run dev tutorials by the late Florian Hufsky.  Any similar tutorials?

sentences:
ECS: is it beneficial to manage the data organisation of components before updating a system? When I process a bunch of component data, I'd like that data to be sorted in such a way that I can iterate through the component buffers linearly. For instance when I want to update the physics system, in an ideal world the buffers for the TransformComponent, MovementComponent and PhysicsBodyComponent are structured in such a way that I would be able to iterate over the entities like this:

for(int i = 0; i < m_numEntitiesInSystem; i++)
{
    Transform& transform = g_transformBuffer[i];
    MovementComponent& movement = g_movementBuffer[i];
    PhysicsBodyComponent& body = g_physicsBodyBuffer[i];
    // ... update physics ...
}

The main advantage of this is that I would have next to no cache misses for this system. Because different systems require different (combinations of) components, this would imply that before every system update, I would either have to sort the respective component buffers so that they are aligned or I would have to use a cache that is local to the system only (this cache would need to be synced every time a component changes).

Of course both approaches come at a cost as well, sorting the component buffers could affect the ability to execute systems on separate threads. Not to mention that the sorting process itself might have its own performance drawbacks.
Syncing the component data implies that some components might need to be copied over possibly several times per frame which again might come with its own performance drawbacks.

My question is: is the price of sorting or syncing worth being able to process data linearly? Or is it wiser to try organise the data in such a way that the most executed/expensive systems perform optimally and others potentially less so. If the former, would it be preferable to use the sorting method or the syncing method?

Also please don't tell me that "premature optimization is evil". Since this is more or less the foundation of my engine, I want it to be as well written and designed as I can. Or at least I want to understand the consequences of picking one method over the other.

Thank you so much!

sentences:
Object orbitting 2D circle java I'm using this code to make a square that orbits a circle . When I use it however the rect(); is quite far away from the circumference of the circle, I would like to make it closer. All variables are floats. YPos and XPos are the x and y of the circles origin.

charx = XPos[0] + cos(angle)*Sizes[0];
chary = YPos[0] + sin(angle)*Sizes[0];
angle += 0.1;
fill(255,255,255);
rect(charx, chary, 10,10);}

Any idea what I should change?
This is probably something very simple, but I'm very new to Java.

sentences:
How can I use D3DXLoadMeshFromX with Direct3D 11? I'm trying to write some class for loading meshes from X files.

But I can't use the function D3DXLoadMeshFromX because its third parameter is LPDirect3DDevice9.

In my D3D initialization code I don't have variable of this type. Did I initialize D3D incorrectly? How can I call this function?

sentences:
Execute a trigger after research is complete I'm making a map where I want to destroy a building when it finishes researching a certain ability.

How do I create a trigger that accomplishes this?

sentences:
How to apply outer glow to a UI game object? Shader? Particle? What's the best or easiest approach to apply an outer glow effect to a UI game object -- let's say, a popup dialog, so it's a rectangular shape -- in Unity 2018.3?

Is this something that should be done with a shader, or is it a particle effect?

Ideally I should be able to specify and perhaps even dynamically adjust the color and size of the glow.

Edit: image below shows a blue rectangle, which has this subtle, grey glow around it. I'm hoping to generate this glow effect somehow in Unity.

sentences: Import blender camera with key frames to unity? I am wondering if I can take a camera tracked camera from blender and import it into unity. Is there any way to do this? Please let me know! Thanks in advance.

sentences:
Should each UI screen contain the list of screens on the stack or should I use a manager class? I have a Screen class that encapsulates the updating and rendering of several distinct states, such as the menu, gameplay, and credits. A stack of screens exists on which the screens themselves need to be able to push new, and pop screens (imagine selecting "Start game" from the main menu, pushing the gameplay screen and popping the main menu screen).

I could have a ScreenManager class to babysit my screens but this would basically just be a wrapper around a list. I am therefore considering to pass each screen the std::list<Screen*> _screens and have them push and remove as they see fit. What I am worried about is overhead of copying this list around. If I recall correctly, since the list contains pointers to screens, the only thing I would be copying are the list of pointers, correct? And not the actual screens themselves.

Would this be an advisable way to go, or would you recommend creating a "wrapper class", such as a ScreenManager in any case?

sentences:
Why does this work? - camera rotation from screen space I do not understand the math behind the linked function or why it works. I would like to know this.

https://sidvind.com/wiki/Yaw,_pitch,_roll_camera

void Camera::motion(int x,int y){
        theta+= x / 200;        /* Adjust this to control the sensitivity */
        phi+= y / 200;

        target.x = cos(theta) * sin(phi);
        target.y = cos(phi);
        target.z = sin(theta) * sin(phi);
}

sentences:
Why are there lines in between my tiles? I'm making a top down XNA game.  The maps are created by tiles.  A problem I recently noticed is a 'grid' of lines between the tiles.  It only shows up sometimes and only depending on the camera position.  I let XNA handle the positioning, why are these lines showing up?

Here is a picture with the lines:

However, after moving my camera over just a bit, it magically goes back to how it is supposed to appear:

Thanks for any help!

EDIT:

This is the best I can do for source code, this is an extremely large project and the rendering is done it multiple areas:

Main Render Loop For dynamic elements such as tiles:

    spriteBatch.Begin(SpriteSortMode.Deferred, Nothing, SamplerState.LinearClamp, Nothing, Nothing, Nothing, Matrix.CreateTranslation(CameraX, CameraY, 0))
    Mode.Render(spriteBatch, False)
    For Each j As [Delegate] In DynamicInjectionList
        j.DynamicInvoke(spriteBatch)
    Next
    DynamicInjectionList.Clear()
    spriteBatch.End()

Mode.Render:

For x As Integer = 0 To GRIDMAX - 1
    For y As Integer = 0 To GRIDMAX - 1
        For z As Integer = 0 To 2
            Dim ter As TiledTerrain = Terrain(x, y, z)
            If ter IsNot Nothing Then
                sb.Draw(CBaseClient.TextureLibrary("TileMap"), New Rectangle(x * GRIDSIZE, y * GRIDSIZE, GRIDSIZE, GRIDSIZE), New Rectangle(ter.Texture_X, ter.Texture_Y, GRIDSIZE, GRIDSIZE), Color.White)
            End If
        Next
    Next
Next

TiledTerrain.vb Class:

Imports ProtoBuf

<ProtoContract()> _
Public Class TiledTerrain

    <ProtoMember(1)> _
    Public Property X As Integer
    <ProtoMember(2)> _
    Public Property Y As Integer
    <ProtoMember(3)> _
    Public Property Z As Integer

    <ProtoMember(4)> _
    Public Property Texture_X As Integer
    <ProtoMember(5)> _
    Public Property Texture_Y As Integer

End Class

My Research:

I've done some searching into it and this is was I've found:

This problem is called tearing (I believe?)
It is commonly caused by using a floating point data type to hold the tile position (I'm using Integer so this shouldn't be a problem right?)

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 should I configure firewall for online game server? I'm complete newbie on game server work.
As I know, online (massively multiplay) game server should keep some TCP or UDP connection from the user. As I (=newbie) guess, maybe huge count of socket port should be opened. So how should I configure firewall for game server? Or should I use some other special method to security?  Any advise will be appreciated.

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:
Should game objects draw themselves? Assuming you have classes like Player, Enemy, Map and Tile.

The first approach to structuring rendering code would be to give each a render() method and let it draw itself:

void render(){
   player.draw();
   enemy.draw();
   // etc.
}

But considering the Model-View-Controller perspective, that feels wrong... Another idea would be to make a Renderer class, but then I wonder how you give the Renderer information what to draw.

Which one should I choose and why?

sentences:
Workaround for Texture2D.GetData I’m converting a game from XNA to iOS with Monogame.
In the code snippet below, smallDeform is a Texture2D on which I call the GetData method.

smallDeform = Game.Content.Load<Texture2D>("Terrain/...");
smallDeform.GetData(smallDeformData, 0, smallDeform.Width * smallDeform.Height);

I’m having some problem with Monogame because the feature in iOS has not been implemented yet because it returns this exception.

#if IOS
   throw new NotImplementedException();
#elif ANDROID

I tried to serialize the data in a XML file from Windows to load the whole file from iOS. The serialized files weight more than 100MB each, that is quite unacceptable to parse.

Basically, I’m looking for a workaround to get the data (for instance a uint[] or Color[]) from a texture without using the GetData method.

PS: I'm on Mac, so I can't use the Monogame SharpDX library.

Thanks in advance.

sentences:
Why is the mana regenerating too fast? So I got this weird problem with regeneration - I decided to create a mana bar which is going down every time when character attack. When the bar is less than integer 100, it should regenerate 1 points per 9 seconds and then stop. The problem is that instead of it, mana regenerate rapidly after chosen time and then, with every attack it regenerate so fast, that is basically staying in same place.

        ////MANA REGENERATION
        currentTime += gameTime.ElapsedGameTime.Milliseconds;
        if (max_mana>=0 && max_mana <= 100 &&currentTime >= 9000)
        {
            max_mana += 1;
        }

that's the parameters for the mana:

in Initialize:

   //PLAYER MANA RECTANGLE

    Texture2D manabar;
    Vector2 posManaBar;
    Rectangle recManaBar;
    //REGENERATION TIME FOR MANA

    int max_mana;
    float currentTime = 0;

In drawGameplay:

        //PLAYER MANA
        spriteBatch.Draw(backBar, posManaBar, recBackBar, Color.Gray);
        spriteBatch.Draw(manabar, posManaBar, recManaBar, Color.Blue);
        recManaBar.Width = max_mana;

sentences:
How can I test if a point is behind a polygon in 2D? In order to improve the performance of my visibility graph generator I am trying to figure out the following.

Given the image below; is there a way to find out if a point is 'behind' the polygon? For example, from the blue points perspective green and pink would be behind the polygon so there is no need to do expensive visibility checks. Is there an easy way to figure this out?

Basically, what I need to know is, when drawing a line from Blue to Green, does it start in or outside the polygon? There must be some simple math for this.

So green and pink are 'behind' and purple and red are in front.

sentences:
Libgdx get texture from Texture Atlas with findRegion I have this code

textureAtlas = TextureAtlas("atlas.atlas")

val box = textureAtlas.findRegion("box")

I want to create a texture with "box". Is it possible? box.texture return the original texture, not the regioned. Oh and I don't want to use Sprite and SpriteBatch. I need this in 3D, not 2D.

Thanks

sentences:
Should I use OpenGL while working with C++? I am completely new to programming and game development for that matter. I am using the C++ software to create my Game Engine with the help of a beginners guide. I noticed it has a OpenGL option when starting up a new project. I've heard of OpenGL pertaining to game development, not sure what it is though.

Should I be using OpenGL when creating my Game Engine? Will it matter if I just start with a blank slate?

sentences:
OpenGL depth problem I am drawing two cubes, first a red one and then a green one in front of the red one. When I rotate the camera I can see the green cube through the red cube.

I have enabled depth test and I clear depth buffer. I'm using OpenGL 4.4 core profile and a simple diffuse shader by the way.

sentences:
How to use a KeyListener and an input handler together? The following class implements a KeyListener, and handleInput() method gets called in an endless loop.

public final class PlayerInput implements KeyboardInputHandler{

  public static final int INVERTED_AXIS = 0;
  public static final int NORMAL_AXIS = 1;

  private Sprite sprite;

  private int axisMode_x=NORMAL_AXIS;
  private int axisMode_y=NORMAL_AXIS;

  private boolean left;
  private boolean right;
  private boolean down;
  private boolean jumping;
  private boolean doubleJump;

  private int jumpCounter=0;
  private boolean stopLeft;
  private boolean stopRight;
  private boolean stopJumping;
  private boolean stopDoubleJump;

  public PlayerInput(Sprite sprite){

    this.sprite=sprite;
  }

  public void setAxisMode_x(int axisMode_x) {

    this.axisMode_x = axisMode_x;
  }

  public void setAxisMode_y(int axisMode_y) {

    this.axisMode_y = axisMode_y;
  }

  public void handleInput(){

    if (left){

      if (axisMode_x==INVERTED_AXIS) sprite.setPos_x(sprite.getPos_x()+sprite.getSpeed_x());
      else sprite.setPos_x(sprite.getPos_x()-sprite.getSpeed_x());
    }
    else if (right){

      if (axisMode_x==INVERTED_AXIS) sprite.setPos_x(sprite.getPos_x()-sprite.getSpeed_x());
      else sprite.setPos_x(sprite.getPos_x()+sprite.getSpeed_x());
    }
    else{

      sprite.goingLeft(false);
      sprite.goingRight(false);
    }

    if (jumping && sprite.collidedDown){

      sprite.addAction(new JumpingAction());
    }
    else sprite.goingUp(false);
  }

  public void keyTyped(KeyEvent e) {}

  public void keyPressed(KeyEvent e) {

    switch (e.getKeyCode()){

    case KeyEvent.VK_LEFT:

      right=false;
      left=true;
      e.consume();
    break;

    case KeyEvent.VK_RIGHT:

      left=false;
      right=true;
      e.consume();
    break;

    case KeyEvent.VK_SPACE:
      jumping=true;
      e.consume();
    break;
    }
  }

  public void keyReleased(KeyEvent e) {

    switch (e.getKeyCode()){

    case KeyEvent.VK_LEFT:

      left=false;
      e.consume();
    break;

    case KeyEvent.VK_RIGHT:

      right=false;
      e.consume();
    break;

    case KeyEvent.VK_SPACE:
      jumping=false;
    break;
    }
  }
}

If I want the player to jump, I need to press Space and then release it... But what if my "jumping" variable checking comes right after my keyReleased method?

Is there a way to synchronize these two pieces of code?

Thank you for your answer.

sentences:
Easiest way to smoothen coarse mesh with HLSL? I've browsed through a couple of presentations and papers about DX11 tessellation and they all say that one of the most common usages of tessellation is to take a coarse (low poly) mesh, smoothen it and then apply displacement mapping. They mention mainly two smoothening algorithms (although I might be wrong, I'm new to the topic): Catmull-Clark and PN Triangles. The former's algorithm is pretty simple to understand but honestly I don't know how to implement that with HLSL. PN Triangle's algorithm seems pretty straightforward.

But maybe there are other important algorithms. Which one is the easiest to implement? Or maybe one is significantly faster that the others?

Or maybe I'm doing it all wrong? :P

sentences:
Check if all gameobjects are destroyed I am making a shooting game, where I have a countdown as I destroy enemies. I want to implement logic when all the game objects are destroyed within the given time, and the countdown reaches zero.

How do I do that?

sentences:
Load character instead of load level I have some trouble finding out how I can load my character at the start of the level, instead of resetting the whole thing. The game mechanics are quite straight forward; don't touch the walls. If the player touches the walls, he "pops" (seeing as it is a balloon.)

This is my current script:

public class playerSpawner : MonoBehaviour {

public Sprite charAlive, charDead;
public AudioClip popAudio;

void  OnCollisionEnter2D (Collision2D col ){

    if (col.gameObject.name == "dirtWalls") {
        AudioSource.PlayClipAtPoint(popAudio, transform.position);
        gameObject.GetComponent<SpriteRenderer>().sprite = charDead;
        StartCoroutine (Dead ());
    }
    if (col.gameObject.name == "gooWalls") {
        gameObject.GetComponent<SpriteRenderer>().sprite = charDead;
        StartCoroutine (Dead ());
    }
    if (col.gameObject.name == "grassWalls") {
        gameObject.GetComponent<SpriteRenderer>().sprite = charDead;
        StartCoroutine (Dead ());
    }
}

IEnumerator Dead() {

    AudioSource.PlayClipAtPoint(popAudio, transform.position); // PLAYS SEVERAL TIMES
    yield return new WaitForSeconds(3/2);
    Application.LoadLevel ("untitled");
    // LOAD LEVEL RESETS EVERYTHING, MAKE LOAD CHAR INSTEAD?
}

}

How can I just respawn the player object instead of resetting the whole scene?

sentences:
Flexible and extendable system of level objectives (victory/failure conditions) in Unity I'm trying to come up with a flexible system of level objectives for a Unity game. What I'd like to achieve is to have a system that on each level (scene) can accept a different set of (configurable) success/failure conditions. Conditions can be repeated between levels but on every level a given type of condition should accept different parameters.

For example on one level success conditions would consist of destroying all enemy units and on the other level success conditions would require destroying a specific enemy unit and escorting a friendly unit to a specific place on map. Failure conditions would for example be player death (on all levels) or not reaching a specific destination within a given time.

First I've tried to approach this problem by using ScriptableObjects but abandoned this idea as it's not possible to save scene object references in a ScriptableObject.

So I've come up with a kind of polymorphic system like this (pseudocode):

public interface Condition {

    bool IsFulfilled();
}

public abstract class VictoryCondition : MonoBehaviour, Condition {

    public virtual bool IsFulfilled();
}

public abstract class AllUnitsKilledCondition : VictoryCondition {

    public List<Unit> units;

    public bool IsFulfilled() {
        foreach (Unit unit : units) {
            if (unit.IsAlive) {
                return false;
            }
        }
        return true;
    }
}

public abstract class FailureCondition : MonoBehaviour, Condition {

    public virtual bool IsFulfilled();
}

public abstract class TimeOutCondition : FailureCondition {

    public float timeLeft;

    void Update() {
        timeLeft -= Time.deltaTime;
    }

    public bool IsFulfilled() {
        return timeLeft <= 0;
    }
}

The idea here is to have a level manager that is given a set of victory/failure conditions in the editor and have it continuously monitor all those conditions. In a simplest scenario a level is won if all victory conditions are fulfilled and lost if any failure condition is fulfilled.

Unfortunately, I'm not sure how to create a LevelManager component that would expose those lists letting me add various conditions and configure them (for example letting me add a list of units from scene to AllUnitsDestroyedCondition). I think it would be doable with a set of custom property drawers for each type of condition but I'm wary of digging into this until I'm sure there is no other, easier way.

I've come up with a way of adding various conditions by adding multiple condition components to a GameObject and then dragging those components to victory/failure conditions lists in LevelManager. But this solution seems awkward and inflexible because it's not possible to dynamically add and configure new conditions in runtime and creating more complex conditions (for example some condition activating only after some other condition is fulfilled) seems like a sure way to create a huge pile of unmaintainable condition component mess.

Please, let me know if I'm approaching this problem correctly and if not, what are other, simpler, more flexible solutions.

sentences:
Rotate model using quaternion Currently I have this to rotate my 3D model that rotates on it's local axis independent from the world's axis:

// Rotate model with Right Thumbstick
modelRotation -= pController.ThumbSticks.Right.X * mRotSpeed; // float value

What I'm trying to do is rotate the model using quaternion and not by a matrix.

I've searched for tutorials, but have found none that explains thoroughly on how to achieve this. Does anyone know how to I can use quaternions to rotate my model or a complete tutorial?

sentences:
Rigidbody & Ray alternative or optimization I am creating an AI that moves around to certain points, but should interact with ais or objects seen.
The ai should find other ai to comunicate or look for objects on the ground.
It works with all those solutions with a low number. But when I have +300 ais the fps drops a lot, caused by Physics2D.FixedUpdate or something related with physics.
How would you deal with this?
I have tried those solutions:

Solution 1
AI:

Rigidbody2D Kinematic
SphereCollider2D Trigger
OnTriggerEnter & Exit Script.

Objects

Rigidbody2D Kinematic
SphereCollider2D Trigger

Solution 2
AI:

Rigidbody2D Kinematic
SphereCollider2D Trigger
OnTriggerStay Script executed each 120 frames & a Coroutine to simulate OnTriggerExit.

Objects

Rigidbody2D Kinematic
SphereCollider2D Trigger

Solution 3
AI:

No RigidBody
SphereCollider2D Trigger
Cone of Rays executed each 2 second to detect colliders at certain layers.

Objects

No RigidBody
SphereCollider2D Trigger

EDIT
In solution 1 and 2, all AI have an "eyes" children GameObject with a TriggerCircleCollider2D and no RigidBody2D, to detect near AIs and GroundObjects.

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: Hardcode model data into geometry shader I have this idea for creating a point cloud and passing an integer into geometry shader to determine which model to draw, each model has the same amount of vertices etc and it would be hardcoded into shader, this would function somewhat like instancing but models have to have the same data size and you can draw multiple meshes in one call. What do you think about it?

sentences:
Unity: How to subscribe for events for easy unit testing? I've run into the same problem multiple times that is begging for a solution. I try to write a lot of decoupled code to make my MonoBehaviour scripts as reusable as possible. This means that I end up using events sometimes. However, when I try to unit test my code I always run into problems with events.

I usually subscribe and unsubscribe to events in OnEnable and OnDisable (sometimes Awake and OnDestroy). However, when writing my unit tests, then I can't test any behaviour dependent on such events since these Unity event functions don't get called in a unit test.

I've tried making the unity event functions public for testing purposes. But this seems to seriously break encapsulation. I've also made functions like public ListenToEvents() that does all the event subscribing, and gets called from OnEnable() and can then also be called in my unit test.

I've read in many places (and see the reasons why) you should never make something public just for unit testing purposes, but I'm struggling how to get event-related behaviour to be tested.

I know about the Humble Object Pattern, which I think could be a good solution here. However, I really like having a single script I can share with myself or someone else for reuse, and this tends to create additional classes/files.

A common example I'm having trouble testing is something like the following MonoBehaviour code (untested code)

bool ignoreInput = false;

void OnEnable() {
    KeyboardEvents.OnIgnoreAllInput += IgnoreInput;
}

void OnDisable() {
    KeyboardEvents.OnIgnoreAllInput -= IgnoreInput;
}

void IgnoreInput() {
    ignoreInput = true;
}

public void UpdateMovement() {
    if (ignoreInput) return;

    // trying to unit test this
    if (Input.GetKeyDown(Keycode.A) {
        MoveForward();
    }
    else {
        DontMove();
    }
}

the issue with the above code, is that I can unit test MoveForward and DontMove, but I can't unit test whether they are correctly controlled by ignoreInput, since in my unit test there's no way (as written) to get OnEnable and OnDisable to be called. I'm also aware of Unity PlayMode tests, that do call such methods, but these are very clunky and slow to run and as far as I can tell can't be called from an IDE.

Ideally my unit test would be something like this:

ScriptUnderTest testScript = new GameObject().AddComponent<ScriptUnderTest>();
KeyboardEvents.IgnoreAllInput();
testScript.UpdateMovement();
Assert.That( <Some result of DontMove happened> )

This test always fails because OnEnable is not being called, and so invoking the event does nothing to the script.

I'd love know how to better set up the MonoBehaviour to make this test work.

Side Question: Do you subscribe to events in OnEnable? Is there a best practice for where in monobehaviours to do this?

sentences:
Entity component system: how and where store pointers to system resources or third-party lib's objects? I'm migrating my game pet-project to ECS. I use C# (custom-made engine, not Unity). It goes pretty well, but one big thing is making me worry.
This is how and where to store pointers to system resources or third party libraries' objects?
For example, I have object with Transform and RenderModel component.
Transform contains data like matrices, quaternions etc (like described in any ECS paper :)
RenderModel contains path to FBX scene and some data how to render this model (materials, overrides, flags, scaling, etc).
For model rendering I use existing rendering library. To render the model I need to create object, add it to this library, update its transform if necessary and destroy it when I don't need to draw this model any more.
The question is where to store pointer to such rendering objects?
I see three approaches:

Any component that holds such resources implements methods OnAdd and OnRemove which are called when component added or removed respectively. On addition the component create lib's object and destroys it on removal. I've focused on this approach because it's pretty straightforward and simple to implement. Main drawback of such approach that I need to implement some kind of workaround to feed transformation to this models.

Systems are stateful and keep tracking of component addition and removal. When given combination of components is added (i.e. RenderModel and Transform) system that handle object drawing creates internal representation of the model and destroys when components are removed. Main drawback that I have no idea how efficiently track multiple component addition and removal.

Some kind of "imperative" approach. For each entity with RenderModel and Transform components system calls method like DrawModel(...). At the end of the frame the internal representation is destroyed and created again on next frame. Such approach looks like most convenient approach from game logic view, but suffer from obvious performance issues, because rendering library might build internal structures, cache visibility data, use interleaved shadow maps etc. Furthermore, updating this systems in parallel threads obviously will become nightmare.

Same issues I've also encountered with physics library and FMOD sound, because such libs also offer some long-living objects (non-POD) and build internal data structures.
Could you suggest better approach to solve such issue?
P.S. I use custom (made from scratch) engine (not Unity)

sentences:
Implementing a time scale in game with fixed physics update I'm currently putting together my game loop based on the "Fix Your Timestep" article at gafferongames.com. This is going fine, but I'm also trying to implement a 'time scale', i.e. a way to control the game speed.

Currently, the delta time is added to an accumulator, and then a loop iterates the physics as many times as there are multiples of the fixed time step in the accumulator.

Now, if I want to add a time scale, I should multiply the delta time by some factor, 0.5 for half speed or something, yes?

Here are my questions:

Should I still use the real fixed time step (prior to multiplication) to determine how often the physics is iterated, but perform the actual calculations with the increased or decreased time step? Or should I use the new time step for both, but surely this would just result in the same behaviour but with higher resolution calculations?

Wait, wait, wait. I have to affect the accumulator too, right? Then it would increase by a smaller frame time, but it would do the right amount of iterations with smaller dTs, over the right amount of time (the real delta time). That'd do it, right?

Given that the purpose of the fixed time step is to perform stable physics calculations, how can I combine these two concepts without jeopardising that stability?

Is it simply that LARGE time steps cause instability? Can I therefore slow down as much as I like? Or is it the variations in time step that causes instability?

Thanks

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:
How does Unity use C# as a scripting language? To my knowledge, thus far, I have thought that C# is and has always been a compiled language. I have recently started studying Unity3d and noticed that they give C# as an option for scripting and interacting with game objects through their API (along with JavaScript and a couple of other alternatives).

How is this done? Is C# actually being executed or is this an abstraction that is being converted to a different scripting language under the covers? It seems to me that there is some sort of interpretation going on for this functionality.

sentences:
Easiest way to make a 3D overworld Using something like Blender, would it be easier and more time and space efficient to create 'tiles', and use some kind of software like Tiled to use these tiles in the various maps, or would it be faster to just create the entire maps in Blender?

I ask because the first approach sounds better, in that it takes less space, time and effort, but the second approach seems to be used everywhere. Right now my game uses tiles, but it's very hard to add any kind of elevation. So should I ditch tiles for building the entire scene in Blender or not?

(sorry if my question doesn't fit the format!)

sentences:
How to resolve concurrent ramp collisions in 2d platformer? A bit about the physics engine: Bodies are all rectangles. Bodies are sorted at the beginning of every update loop based on the body-in-motion's horizontal and vertical velocity (to avoid sticky walls/floors). Solid bodies are resolved by testing the body-in-motion's new X with the old Y and adjusting if necessary before testing the new X with the new Y, again adjusting if necessary. Works great.

Ramps (rectangles with a flag set indicating bottom-left, bottom-right, etc) are resolved by calculating the ratio of penetration along the x-axis and setting a new Y accordingly (with some checks to make sure the body-in-motion isn't attacking from the tall or flat side, in which case the ramp is treated as a normal rectangle). This also works great.

Side-by-side ramps, eg. \/ and /\, work fine but things get jittery and unpredictable when a top-down ramp is directly above a bottom-up ramp, eg. < or > or when a bottom-up ramp runs right up to the ceiling/top-down ramp runs right down to the floor.

I've been able to lock it down somewhat by detecting whether the body-in-motion hadFloor when also colliding with a top-down ramp or hadCeiling when also colliding with a bottom-up ramp then resolving by calculating the ratio of penetration along the y-axis and setting the new X accordingly (the opposite of the normal behavior). But as soon as the body-in-motion jumps the hasFloor flag becomes false, the first ramp resolution pushes the body into collision with the second ramp and collision resolution becomes jittery again for a few frames.

I'm sure I'm making this more complicated than it needs to be. Can anyone recommend a good resource that outlines the best way to address this problem? (Please don't recommend I use something like Box2d or Chipmunk. Also, "redesign your levels" isn't an answer; the body-in-motion may at times be riding another body-in-motion, eg. a platform, that pushes it into a ramp so I'd like to be able to resolve this properly.)

Thanks!

sentences:
How do I use a PC Dance Pad with Xna? I have a Dance Pad and I want use it in XNA as a controller. It has a USB connection.

Can someone help me?

sentences: Does the Windows Raw Input API provide lower latency input than WM_MOUSEMOVE? I've read up a lot about the Raw Input API and so far could only tell that it bypasses os filters like mouse acceleration. However what i am looking for is a way to reduce input latency on mouse movement, and i cannot find any clear comments on whether switching to Raw Input will lower the input latency over the traditional windows messages.

sentences:
What's the proper way to use static objects and singletons in Unity? I have a GameObject in Unity, which I've attached this script to, in order to make it function as a Static Singleton :

using UnityEngine;
using System.Collections;

public class SceneStatics : MonoBehaviour {

    private static SceneStatics instance;

    public static SceneStatics Instance
    {
        get
        {
            if (instance == null)
            {
                instance = new GameObject ("SceneStatics").AddComponent<SceneStatics> ();
                DontDestroyOnLoad(instance);
            }

            return instance;
        }
    }

    public void OnApplicationQuit ()
    {
        instance = null;
    }
}

I have two other scripts that I'd like to be able to access from scene to scene. What's the proper way to do that?

Do I attach my Inventory and Room scripts to the same game object as the SceneStatics? If so, how do I access them? Can I go from SceneStatics.Instance to one of the other scripts directly via GetComponent?

Alternatively, what happens if I add two child gameObjects (each containing one of the other scripts) to the SceneStatics?

Or is the intended use that I simply make any other static items I need properties of the SceneStatics class? (I.e., add in a Public static Inventory and Public static Room attributes)?

sentences:
Why is it a bad idea to store methods in Entities and Components? (Along with some other Entity System questions.) This is a followup to this question, which I answered, but this one tackles with a much more specific subject.

This answer helped me understand Entity Systems even better than the article.

I've read the (yes, the) article about Entity Systems, and it told me the following:

Entities are just an id and an array of components (the articles says that storing entities in components isn't a good way of doing things, but doesn't provide an alternative).
Components are pieces of data, that indicate what can be done with a certain entity.
Systems are the "methods", they perform manipulation of data on entities.

This seems really practical in many situations, but the part about components being just data classes is bothering me. For example, how could I implement my Vector2D class (Position) in an Entity System?

The Vector2D class holds data: x and y coordinates, but it also has methods, which are crucial to its usefulness and distinguish the class from just a two element array. Example methods are: add(), rotate(point, r, angle), substract(), normalize(), and all other standard, useful, and absolutely needed methods that positions (which are instances of the Vector2D class) should have.

If the component was just a data holder, it wouldn't be able to have these methods!

One solution that could probably pop up would be to implement them inside systems, but that seems very counter-intuitive. These methods are things that I want to perform now, have them be complete and ready to use. I don't want to wait for the MovementSystem to read some expensive set of messages that instruct it to perform a calculation on the position of an entity!

And, the article very clearly states that only systems should have any functionality, and the only explanation for that, which I could find, was "to avoid OOP". First of all, I don't understand why should I refrain from using methods in entities and components. The memory overhead is practically the same, and when coupled with systems these should be very easy to implement and combine in interesting ways. The systems, for example, could only provide basic logic to entities/components, which know the implementation themselves. If you ask me - this is basically taking the goodies from both ES and OOP, something that can't be done according to the author of the article, but to me seems like a good practice.

Think about it this way; there are many different types of drawable objects in a game. Plain old images, animations (update(), getCurrentFrame(), etc), combinations of these primitive types, and all of them could simply provide a draw() method to the render system, which then doesn't need to care about how the sprite of an entity is implemented, only about the interface (draw) and the position. And then, I would only need an animation system which would call animation-specific methods that have nothing to do with the rendering.

And just one other thing... Is there really an alternative to arrays when it comes to storing components? I see no other place for components to be stored other than arrays inside an Entity class...

Maybe, this is a better approach: store components as simple properties of entities. For example, a position component would be glued to entity.position.

The only other way would be to have some kind of a strange lookup table inside systems, that references different entities. But that seems very inefficient and more complicated to develop than simply storing components in the entity.

sentences:
How can you subscribe to Unity input events, instead of polling for them Been trying for days to figure out if there is a way to subscribe to keyboard/mouse events in unity. Instead of having to poll for them every frame and make my own events.

Right now I poll through the inputs and fire off my own events if a button is pressed. I'd prefer to subscribe directly to Unities input events, but have yet to figure out how.

I have a Unity Answers post that may have some relevant info to my question as well: http://answers.unity3d.com/questions/878485/is-there-a-more-efficient-way-to-make-events-for-k.html

sentences:
Displaying scores in tutorial projects - GUI and UI I've just started learning to use unity by working through the tutorial projects but in both roll-a-ball and space shooter I've hit dead ends in the text lessons. The lessons tell you to simply add a GUI text object but they don't seen to exist anymore. From what I've gathered they have been replaced with UI text, but I can't find any documentation that explains how to use them in the way the tutorial describes.

Essentially my question is "how do I complete lesson 15 of the space shooter tutorial project now that unity doesn't let me create GUI text objects in the hierarchy?" Any help would be greatly appreciated.

sentences:
What has changed in the lighting systems of Rage, Battlefield 3 to make them so realistic? I've played and completed Rage and currently Battlefield 3 (which looks a lot better with less hype). One thing that is immediately apparent is the lighting, or the bump maps - I can't figure out which it is - makes the experience on a high end PC a lot clearer and better looking.

What is the advancement that these games are making use of in Open-GL/Direct-X or the graphics cards that has increased the realism of the lighting engines so dramatically?

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:
Jump Point Search with Weights Everywhere I've searched on the internet, people seem to assume that jump point search would not work with weighted grids. So why wouldn't it work with this simple modification to the algorithm:

This diagram here illustrates the circumstances that the traditional jump point search algorithm would add the node x to the open set.

Please note that the black squares are numbered 2 and 4 respectively.

In these two images, the reason x is added to the open set is because the optimal paths to the circled squares from the parent of x must go through x. I propose, that if any path going through x from the parent of x to a node around x is lighter than the corresponding path going around x, x should be expanded.

Example psuedocode:

Please note that weightOfPath should return infinity if any of the nodes are impassable.

Horizontal case:

if weightOfPath(4,x,3) < weightOfPath(4,2,3) or weightOfPath(4,x,8) < weightOfPath(4,7,8):
    addToOpenNodes(x);

Diagonal case:

if weightOfPath(6,x,1) < weightOfPath(6,4,1) or weightOfPath(6,x,8) < weightOfPath(6,7,8):
    addToOpenNodes(x);

Why wouldn't this work?

sentences:
Actor not taking touch libGDX I am trying to handle the touch of one of the Actors in the stage. The following is the code I have written:

public class MyGame extends ApplicationAdapter
{
    private GameStage gameStage; //Game stage is custom stage class.
    @Override
    public void create ()
    {
        gameStage = new GameStage();
        Gdx.input.setInputProcessor(gameStage); //Set the input processor
    }

    @Override
    public void dispose()
    {
        super.dispose();
        gameStage.dispose();
    }

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

        gameStage.act(Gdx.graphics.getDeltaTime());
        gameStage.draw();
    }
}

Now in the GameStage class:

public class GameStage extends Stage implements ContactListener
{
    MyActor myActor; //Custom actor object.
    public GameStage()
    {
        super(new ScalingViewport(Scaling.fill, Constants.APP_WIDTH, Constants.APP_HEIGHT, new OrthographicCamera(Constants.APP_WIDTH, Constants.APP_HEIGHT)));
        setUpWorld(); //Code to setup the world. added background and other actors. none of them are touchable.
        addActor();
    }

    private void addActor()
    {
        myActor = new MyActor(100, 100, 100, 100, 1000, 0);
        myActor.setTouchable(Touchable.enabled);
        myActor.addListener(new InputListener()
        {
            @Override
            public boolean touchDown(InputEvent event, float x, float y,
                                     int pointer, int button)
            {
                actorTouched(); //This method is not getting triggered becaused the call never comes in this function.
                return true;
            }
        });
        addActor(myActor);
    }
}

The custom actor class initializes the actor with a sprite image.

public class MyActor extends Actor
{
    public MyActor(int startX, int startY, int startWidth, int startHeight, int endX, int speed)
    {
        TextureAtlas textureAtlas = new TextureAtlas(Gdx.files.internal(Constants.ATLAS_PATH));
        TextureRegion[] runningFrames = new TextureRegion[Constants.MOVING_REGION_NAMES.length];

        for (int i = 0; i < Constants.MOVING_REGION_NAMES.length; i++)
        {

            String path = Constants.MOVING_REGION_NAMES[i];
            runningFrames[i] = textureAtlas.findRegion(path);
            if (horizontalMovingDirection == MovementDirection.Right)
            {
                runningFrames[i].flip(true, false);
            }
        }
    }
//code to draw and animate in a straight line by overriding the draw and act methods.
}

Am I doing something wrong here? Why am I not getting the touch in the actor?

sentences:
Set a minimum distance with navmeshagent I am totally newb. How to set a minimum distance between AI chasing a player if AI has navmeshagent
        if (Vector3.Distance(transform.position, target.position) > minDistance)
        {
            enemy.destination = player.position;
        }

What I need is it works similar to this code below:
if (Vector3.Distance(transform.position, player.position) > minDistance)
{
    transform.position = Vector3.MoveTowards(transform.position, player.position, moveSpeed*Time.deltaTime);
}

But using destination property or SetDestination

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:
Unity Grid Layout causing multiple draw calls We are developing a game in Unity 4.6.6 for both Android and iOS.

Currently I am building the game UI with the new Unity UI system. In particular I am building a button list to create kind of inventory slots using the Grid Layout.

I have noticed that my draw call count is increasing considerably despite having my UI in an atlas (using Sprite packer) and using the same font all over the UI.  After some tests I noticed that one draw call is generated per each UI Text and UI image present in the scene composing each button when using a Grid Layout Group, when the Grid Layout is not used the draw calls are reduced noticeably.

7 elements without Grid Layout, results in 2 draw calls:
(Screenshots taken in play mode)

7 elements WITH Grid Layout, resulting in 14 draw calls:
(Screenshots taken in play mode)

I have no idea if it is possible to reduce the number of draw calls when using the Grid Layouts.

sentences:
Storing player's tilemap position inside the player object I'm trying to create a multidimensional array as a sort of 2D map for a text-based RPG game. I want to create a multidimensional array that's, for example, 5x5. The array would be filled with 0s to represent a space void of an object. Other numbers would represent the player on the map, an enemy, an npc, a skill-object (like an enchantment table, etc.), doors that link to maps, and chests. They would all have different values to represent what object is there. If a player tries walking into a chest, it would instead loot the chest. Then the chest would be reset to 0 to represent the empty space, letting the player walk there and representing that there is no more chest. If the player tries walking over an enemy, it would instead engage combat (handled by a separate class and functions). Walking over a number representing a door would link to another multidimensional array that represents another map.

I want to know what kind of property I need to put inside the player class to handle where he is on the map. A function would then change that value to move him around the map. Would creating a class for a map be a good idea? Would I store the values for the objects there or in the individual classes for those objects? How would I go about this? Thank you for your help. For reference, here's my player class (careful, it's long...):

public class Player
{
    public string   name        { get; set; }        //Name of Player
    public int      level       { get; set; }        //Player's combat level         (average of combat-related skills' levels)
    public int      health      { get; set; }        //Player's health               (player dies when this value reaches 0)
    public int      health_max  { get; set; }        //Player's maximum health
    public int      stamina     { get; set; }        //Player's stamina              (used for power attacks, slowly recharges on own)
    public int      stamina_max { get; set; }        //Player's maxiumum stamina
    public int      fatigue     { get; set; }        //Player's fatigue rate         (player cannot fight or run while fatigue is 100)
    public int      hunger      { get; set; }        //Player's hunger level         (player becomes weaker as hunger increases)
    public int      style       { get; set; }        //Player's fighting style       (refer to styles.txt)
    // tons of skills fields
}

sentences:
Sound Delay With AVAudio Player I'm using the following code in my viewDidLoad to load a sound:

NSURL * url = [NSURL fileURLWithPath:
   [NSString stringWithFormat:@"%@/Moto - Hit Sound.mp3",
   [[NSBundle mainBundle] resourcePath]]];
NSError * error;
hitSoundPlayer = [[AVAudioPlayer alloc]initWithContentsOfURL:url error:&error];
hitSoundPlayer.numberOfLoops = 0;

Then I'm using this in a void method to play the sound:

if(CGRectIntersectsRect(main.frame, enemy1.frame)){
    [hitSoundPlayer play];
}

This does seem to work, however the first time the sound is played there is a lot of lag and the game stops temporarily. I'm using this same method for when in an IBAction and it works fine, it must be the fact that it's also detecting a collision that makes the sound lag. If I want to be able to play sounds quickly and on the spot without any sort of lag am I doing the right thing? Do I want to use another method?
I'm not using any frameworks like cocos2d. If you need to see any more code just ask.

sentences:
Programming and drawing to deal with different screen sizes and resolutions I started making an XNA game years ago and picked it up recently.

I'm looking later to convert it to use Monogame so that it can be deployed on various mobile devices and OS, though I have a sinking feeling that a lot of the sprites and code will be broken by the changing screen sizes when I move outside of the emulator.

The game is currently hard coded to to 800x480 and the level placements and sprite sizes were all done to fit that at the time.

So question:

What do I need to ensure this works and displays properly on a variety of screens and devices?

sentences:
How can I give the player the impression of speed? Possible Duplicate:
  Effects to make a speeding spaceship look faster

I am currently developing a racing game akin to F-Zero in that the race is held at very fast speeds. The player is therefore placed in a 3rd person view.

Graphically, I'm thinking of using motion blur and lowering the camera angle when the ship is going faster to give the player the impression of speed. This from the fact that the closer you are to the ground, the more you percieve speed.

This question has intersting answers, but don't really apply because the effect needs to be progressive and constant, not like a boost effect.

I was wondering if these techniques are viable, and if any other techniques exist?

sentences: Help understanding the parkour tutorial in Cocos2d I was practicing the parkour tutorial for chapter 7, but I failed to understand why we should move the same delta movement of this.gameLayer, which contains the background layer and the animation layer in opposite direction. Why do we do this?

sentences: Want to create live-voice chat between players either in unity or unreal engine I would like to create a real-time voice chat in either in unreal or unity between the players.I would like to associate and apply this voice-chat depend on username. I am saying "or" for the application because I want it to create in easiest(less programming) way. Do you know what class or script I should use? I have a limited budget so I am looking for a in-house or cheap way solution of building it.What would be the easiest way of starting this project?

sentences: How to disable spring joint in unity 3d How can I disable Spring joint in unity 3d, since disabling feature only available in 2d mode, I am not able to find any way to disable it via script

sentences:
What is the difference between Pygames, Pyglet and Kivy and how each helps python game development? I trying to figure out which options would be best to give a graphics to a UNIX based 2D game whose logical part was written in python. Which engine to use.

What is the difference between Pygames, Pyglet and Kivy and how each works in relating the logical part of the game with it's actual graphical display?

sentences:
How can I change the root namespace for scripts in Unity? How can I change the root namespace for scripts in Unity?
I went to Edit - Project Settings... - Editor - Root namespace and put there the gameplay value.
I checked that the Assembly-CSharp.csproj has the <RootNamespace>gameplay</RootNamespace>
Now I go to VS Code editor, create a class and the class still uses a wrong namespace. What may I be missing here?

sentences:
In Monogame, why does Rectangle.Offset not work? I have the following code in a default Monogame Game project:

protected override void Update(GameTime gameTime)
{
    if (Keyboard.GetState().IsKeyDown(Keys.Left))
    {
        paddle.Box.Offset(-10, 0);
        Debug.WriteLine(paddle.Box);
    }
    if (Keyboard.GetState().IsKeyDown(Keys.Right))
    {
        paddle.Box.Offset(10, 0);
        Debug.WriteLine(paddle.Box);
    }
    base.Update(gameTime);
}

paddle.Box is a normal XNA Rectangle.

The problem is that the location of paddle.Box does not change after calling any of the Offset() overloads, as debugging confirms. If I just assign a new Rectangle, it works, but Offset (and Inflate(), FWIW) seems to be broken.

What am I doing wrong?

sentences:
How to Save boolean properly on Playerprefs? I want to make a shop system if I buy the items, the items will be saved on Playerprefs, no need to buy again when I restart or re-open the game, for that I already make it to setInt but I don't know when I call getInt. I tried to call it in the start method with a new int index but it doesn't work.
This my script
for store the itemsType
[System.Serializable]
public class m_ShopItem
{
    public Sprite theIcon;
    public int price;
    public bool isBuyed=false;
}

Then I make it list
public List<m_ShopItem> ShopItemsList = new List<m_ShopItem>();
 [SerializeField] GameObject ShopPanel;
    [SerializeField] Transform theContent;
    GameObject g;
    Button buyBtn;
    public GameObject itemTemplate;

void Awake()
    {
        if (Instance == null)
            Instance = this;
        else
            Destroy(gameObject);

        for (int i = 0; i < ShopItemsList.Count; i++)
        {
            // Create a different PlayerPrefs for each Item in the Shop.
            PlayerPrefs.SetInt("isBuyed" + i, ShopItemsList[i].isBuyed ? 1 : 0);
        }
    }

    private void Start()
    {

        for (int i = 0; i < ShopItemsList.Count; i++)
        {

             g = Instantiate(itemTemplate, theContent);
            g.transform.GetChild(0).GetComponent<Image>().sprite = ShopItemsList[i].theIcon;
            g.transform.GetChild(1).GetComponent<TextMeshProUGUI>().text = ShopItemsList[i].price.ToString();
            buyBtn = g.transform.GetChild(2).GetComponent<Button>();
            ShopItemsList[i].isBuyed = PlayerPrefs.GetInt("isBuyed" + i) == 1 ? true : false;
            if (ShopItemsList[i].isBuyed)
            {
                DisableBuyButton();
            }
            buyBtn.AddEventListener(i, OnShopItemBtnClicked);
            Debug.Log(ShopItemsList[i].isBuyed);
        }
    }
    void OnShopItemBtnClicked(int itemIndex)
    {
        if (m_shopManager.Instance.HasEnoughCoins(ShopItemsList[itemIndex].price))
        {
            m_shopManager.Instance.UseCoins(ShopItemsList[itemIndex].price);
            //purchase Item
            ShopItemsList[itemIndex].isBuyed = true;
            PPlayerPrefs.SetInt("isBuyed" + itemIndex, ShopItemsList[itemIndex].isBuyed ? 1 : 0);

            //disable the button
            buyBtn = theContent.GetChild(itemIndex).GetChild(2).GetComponent<Button>();
            DisableBuyButton();

            //add avatar
            m_Profile.Instance.AddBallType(ShopItemsList[itemIndex].theIcon);
        }
        else
        {
            //NoCoinsAnim.SetTrigger("NoCoins");
            Debug.Log("You don't have enough coins!!");
        }
    }

    void DisableBuyButton()
    {
        buyBtn.interactable = false;
        buyBtn.transform.GetChild(0).GetComponent<Text>().text = "PURCHASED";
    }

but the result is the same I have to rebuy when going to the main menu or restart the game.
Can anyone tell me what's wrong with my script?

sentences:
How can I use the graphics pipeline to render volumetric data based on a density function? Both graphics APIs (OpenGL and DirectX) devise a well defined pipeline in which several stages are programmable. These programmable stages require to take a fixed minimum amount of data and are supposed to do a well defined range of operations on it, and output some defined minimum output, so that data can be passed on to the next stage correctly. It seems as if these pipelines are designed to work with only a limited amount of types of geometric data, which in the case of both D3D and OGL are vertex data and texture co-ordinates.

But, if given a case when the application I plan to make doesn't use vertices ( or even voxels ) to represent its geometric data and does not exactly do transformations or projections or rasterisation or interpolation or anything like that, such limitations of the APIs or the pipeline make things difficult.

So, is there a way in which we can change graphics pipeline in a way so that the functionality of what each stage does to the data and the type of data that is outputted in each stage is changed to my advantage? If not, then is there a way by which I can use the 'raw' API functions to construct my own pipeline? If not, then please mention why it isn't possible.

EDIT : My Application uses density functions to represent geometry. The function has a value at each point in space. I divide the frustum of the camera into a 3d grid, each block can be projected as a pixel. On each block, I integrate the density function and check if its value is more than a required value. If yes, then its is assumed that something exists in that block and that pixel corresponding to that block is rendered.
 so, now in my renderer, I want to pass the function ( which i represent with a string ) to the graphics hardware instead of vertex data in vertex buffers. this also implies that the vertex shader won't have vertices to transform into homogeniouse clip space and the fragment shader doesn't get pixel info. instead, now most of the looking up and evaluation happens per pixel.

sentences:
HDRP project error - unity i just created a new HDRP project and my scene is blank. Pls Help!!!
Unity view:

Error: RenderTexture.Create failed: format unsupported for random writes - RGBA16 SFloat

sentences:
Wrong contineous rotation to car In my 2d game, I want to rotate car face based on collision detected. But at present after 3 to 4 collision its doing continuous rotation only rather than moving straight after collision.

Here is my straight movement related code:

myRigidbody.MovePosition (transform.position + transform.up * Time.deltaTime * GameManager.Instance.VehicleFreeMovingSpeed);

For better collision purpose, I have used Rigidbody position change approach.

Here is my collision time code:

public void OnCollisionEnter2D (Collision2D other)
{
 if (other.gameObject.CompareTag (GameConstants.TAG_BOUNDARY)) {
     ContactPoint2D contact;
     contact = other.contacts [0];
     Vector3 reflectedVelocity = Vector3.Reflect (transform.up, contact.normal);
     direction = reflectedVelocity;
 }
}

if (direction != Vector3.zero && pathGenerator.positionList.Count <= 0) {
        float angle = Mathf.Atan2 (direction.y, direction.x) * Mathf.Rad2Deg;
        Quaternion targetRot = Quaternion.AngleAxis (angle - 90f, Vector3.forward);
        transform.rotation = Quaternion.Slerp (transform.rotation, targetRot, 0.1f);

        if (Quaternion.Angle (transform.rotation, targetRot) < 5f) {
            transform.rotation = targetRot;
            direction = Vector3.zero;
        }

    }

Rotation get applied within other code so that car was changing its face correctly and that method not affecting here that I have checked by placing debug statement.

Share you side thought for this.

sentences:
How do I scale a Spine animation at runtime? The spine docummentation shows how to scale the skeleton when loading.
Is it a must to reload the skeleton to scale the animation while playing it?

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:
Shader Resource Binding Im trying to set a constant buffer in my shader with a value. But getting nothing, no results.

Code in shader

cbuffer MatrixBuffer : register(b0)
{
    float4 test;
};

----------------------------------------------------------------
In main part

#pragma pack(push,1)
struct CB_GBUFFER_UNPACK
{
    D3DXVECTOR4 test;

};
#pragma pack(pop)

            D3D11_BUFFER_DESC cbDesc;
        ZeroMemory( &cbDesc, sizeof(cbDesc) );
        cbDesc.Usage = D3D11_USAGE_DYNAMIC;
        cbDesc.BindFlags = D3D11_BIND_CONSTANT_BUFFER;
        cbDesc.CPUAccessFlags = D3D11_CPU_ACCESS_WRITE;
        cbDesc.ByteWidth = sizeof( CB_GBUFFER_UNPACK );
        device->CreateBuffer( &cbDesc, NULL, &m_pGBufferUnpackCB  );

            D3D11_MAPPED_SUBRESOURCE MappedResource;
            ic->Map( m_pGBufferUnpackCB, 0, D3D11_MAP_WRITE_DISCARD, 0, &MappedResource  );
            CB_GBUFFER_UNPACK* pGBufferUnpackCB = ( CB_GBUFFER_UNPACK* )MappedResource.pData;

            pGBufferUnpackCB->test.x = 10.0f;
            pGBufferUnpackCB->test.y = 10.0f;
            pGBufferUnpackCB->test.z = 10.0f;
            pGBufferUnpackCB->test.w = 0.0f;

            ic->Unmap( m_pGBufferUnpackCB, 0 );
            ic->PSSetConstantBuffers( 0, 1, &m_pGBufferUnpackCB );

What seems to be my problem?

sentences: Sending message to all players in room from Photon server? I need to send a message to all players in the room from a Photon server. Sending the message from a player would introduce too much latency so I need the server to collect data and distribute messages at a rate of 16/s without a player's influence. Is there a way to do this?

sentences:
How do I know what button was clicked? (Unity) I have a prefabbed button (UI.Button) which I'm instantiating ten times:

public void LayoutButtons() {

    GameObject newCanvas = Instantiate (canvas) as GameObject;

    for (int i = 0; i < 10; i++) {
        buttons[i] = Instantiate(button, new Vector2((i * 100.0F)-500, -100), Quaternion.identity) as GameObject;
        buttons[i].transform.SetParent(newCanvas.transform, false);
        buttons[i].GetComponentInChildren<Text>().text = "Button " + i;
    }
}

However, I'm now stuck when trying to figure out which button was clicked. The Unity onClick seems to only allow zero or one parameters. I've tried using public void onClick(Button button) with button.getComponentInChildren<Text>().text but I get ArgumentException: failed to convert parameters

All I want to do is print out the clicked button's text. How can I do this?

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:
Why is there a difference in frame rate between my fps calculation and Unity's calculation So I wrote my own script for calculating framerate but it consistently comes out with a different value than Unitys idea of current framerate.

This is my implementation

  void UpdateFPSStats()
{
double frameTime = new double();
frameTime = Time.deltaTime;
m_times[frameIndex] = frameTime;

frameIndex++;

if (frameIndex == m_numberFrames)
{
  frameIndex = 0;
}

int numberSamples = 0;
double averageFrameTime = 0.0f;
foreach(double t in m_times)
{
  numberSamples++;

  averageFrameTime += t;
}

if (numberSamples > 0)
{
  averageFrameTime = averageFrameTime / numberSamples;
  m_frameRate = 1 / averageFrameTime;
}
}

where m_frames is a list of the last 60 frames frame times and UpdateFPSStats is called in Unitys Update(dt) function.

On average in my scene my fps calculation gives a steady 50fps, while Unity calculates a steady 80fps.

Which is right and why?

sentences:
Text Based Tutorials for Unity3d I hope this is the right place to ask this. I'm very new to Unity but not to programming. I also have some basic game programming experience.

I'm searching for text based versions of the videos from unity3d.com/learn/tutorials. These tutorials are very good, but I end up forwarding videos a lot to get key screenshots and code snippets.

Is there any text / pdf / html / .doc / .rtf (i'm very open) version or similar resource to learn unity? Again, those tutorials are amazing and I'd hope to find something of similar quality, but I know that if I have to skim through tens of hours of video I'll end up frustrated. I get that the long hard way is probably the most robust one for deeper understanding, but I was hoping to hack a quick project.

EDIT :

If this can make it a relevant question, then I am currently looking at the "Roll a Ball Tutorial". Really, any other text tutorial would be very welcome

sentences:
I have a game based on combining 2 ingredients to create a product. What is the best way to code this? (Unity) So to go a bit more in depth, in my game, you can combine a variety of ingredients to make a product. For example, you could combine water and dirt to make mud.

What I am currently doing to achieve this is by listing each combination possibility that a particular ingredient has. The one thing i managed to do to make it a little more efficient is that I managed to remove duplicates (So for example, if i have coded ingredientA + IngredientB = Cheese, there isn't another entry for IngredientB + Ingredient A = Cheese).

The problem I have with my method is that it is very annoying adding new ingredients. If i do so, I have to go back to every previous ingredient i have coded, and add it's interaction with the ingredient(s) i want to add.

The amount of ingredients I have means this is becoming increasingly time consuming.

Is there a better way to do this?

This is a Unity game, coded in C#. Let me know if you need any further info.

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:
Took one major now want to be in different industryssT How different is Programmer Analyst from Game Programmer?
I took the first one as my major but want to go with game development industry.
Is it possible to transition from one to another?

EDIT: There is a single class about game development in this major

sentences:
DirectX9 rendering missing in Release Build I have a c++ application which outputs to screen using entirely DirectX9, running on Win7 64 Home.

It runs as normal in these circumstances:

Debug Build, from within MSVC 2008.
Release Build, from within MSVC 2008.
Debug Build, by opening the compiled
executable itself.

However, strange things happen when I run the compiled executable of the release build. The window is created as expected but no screen output. Nothing.

I can hear the sound working and the log file fills up. I thought maybe the working directory was wrong when running the executable but the log file reports the CWD is correct and indeed all filepaths to data files work.

I am stumped as to why my application will work fine in 3 of the four permutations, but not the most important one - the standalone release executable!

If anyone can contribute, I'd be most grateful.

Thanks

Si

sentences:
Controlling screen and window size in Unity In Java I know how to make a window of a certain size and make it not resizable.

How do I control my game's window size in Unity and prevent players from resizing it?

sentences:
How do people implement pathfinding movement? I understand how A* works, but I don't understand how movement is implemented, e.g. creating a list of directions and then going through that list until every direction is empty. How does that work?

EDIT: Node based.

sentences:
Tweaking and Settings - Runtime variable modification and persistence Most companies have an editor, or a variable control system for tweaking stuff in games, but are there any middleware solutions to this problem? I've written two such systems in the past myself, and worked with five, maybe six different ones, but none of them were off the shelf.

Each of these home grown solutions had problems, ranging from having to keep looking up values, to not being able to save the current state of the variables.

Are there any mature Config/Runtime-variable control libraries/apps?

I generally code in C++, but I would think that a mature settings/variables editor would probably be socket based (and therefore language agnostic to some extent) as all current development hardware apart from Nintendo stuff provides a mechanism to talk to servers. The code implementation would also need to be quite simple (I do like the hot_var/TweakableConstants article shared by Oskar, but it's not a package)

sentences:
How can I keep straight alpha during rendering particles? Rencently,I was trying to save textures of 3D particles so that I can reuse the in 2D rendering.Now I had some problem with alpha channel.Some artist told me I that my textures should have unpremultiplied alpha channel.When I try to get the rgb value back,I got strange result.Some area went lighter and even totally white.I mainly focus on additive and blend mode,that is:

ADDITIVE: srcAlpha  VS  1
BLEND:    srcAlpha  VS  1-srcAlpha

I tried a technique called premultiplied alpha.This technique just got you the right rgb value,its all you need on screen.As for alpha value,it worked well with BLEND mode,but not ADDITIVE mode.As you can see in parameters,BLEND mode always controlled its value within 1.While ADDITIVE mode cannot guarantee.
I want proper alpha,but it just got too big or too small consider to rgb.Now what can I do?Any help will be great thankful.
PS:If you don't understand what I am trying to do,there is a commercial software called "Particle Illusion".You can create various particles and then save the scene to texture,where you can choose to remove background of particles.
Now,I changed the title.For some software like maya or AE,what I want is called [straight alpha].

sentences:
How do you set the movement speed of a sprite? I'm using Slick 2D/Java to play around with graphics. Getting an image to move is easy:

Input input = gc.getInput();

        if(input.isKeyDown(sprite.up)){
            sprite.y--;
        }else if (input.isKeyDown(sprite.down)){
            sprite.y++;
        }else if (input.isKeyDown(sprite.left)){
            sprite.x--;
        }else if (input.isKeyDown(sprite.right)){
            sprite.x++;
        }

However, this is called on every update, so if you hold up, the sprite moves to the edge of the screen in a few hundred milliseconds. Since coordinates are integers, I can't add less than 1 to slow the sprite down. I'm assuming I must have to implement a timer of some sort or something. Any advice?

sentences:
NullReferenceException when using GetComponent I have a script that is attached to all the NPCs in my game.

Here's what the variable declarations and Awake() function look like:

Dialogue dialogue;
TextMeshProUGUI UIText;
GameObject textBox;
Image portrait;
AudioSource audioSource;

private void Awake()
{
    audioSource = GameObject.Find("Audio Source").GetComponent<AudioSource>();
    UIText = GameObject.Find("Canvas").GetComponentInChildren<TextMeshProUGUI>();
    textBox = GameObject.Find("TextBox");
    portrait = GameObject.Find("Portrait").GetComponent<Image>();

    textBox.SetActive(false);
}

All of this works fine, until it gets to

portrait = GameObject.Find("Portrait").GetComponent<Image>();

For some reason, it throws a NullReferenceException on that line.

Two things about this confuse me:

The GetComponents above (for the audioSource and UIText) appear to work fine, despite being called for each of the NPCs. I'd assume it'd either work for all or none of them.
The portrait variable is used to show a portrait of the NPC when the player is talking to them, and even with the errors, one of the NPCs still has their portrait. It's like one NPC grabs the Image component, and none of the others can snag it or something...?

Anyway, very grateful for any wisdom y'all may provide, and happy to provide any other info that could lead to a resolution. Thanks! Hope your new year is going well!

EDIT: There is a Portrait GameObject in my scene under the Canvas, with an Image component attached to it. This I can confirm.

sentences:
Unity - Adding more functionality to a List Inspector Let's say I have the following code:

public List<Armor> armors = new List<Armor> {
    new Armor() { name = "Black set",         folder = "black_set"},
    new Armor() { name = "Conquistador",      folder = "conquistador"},
    new Armor() { name = "Crusader",          folder = "crusader"},
    new Armor() { name = "Gothic Plate",      folder = "gothic_plate"},
    new Armor() { name = "K.D.",              folder = "kd"},
    new Armor() { name = "Lorica segmentata", folder = "lorica_segmentata"},
    new Armor() { name = "Rusty",             folder = "rusty"},
    new Armor() { name = "Spartan",           folder = "spartan"}
};

This appears in the editor like this:

While this is acceptable, there are a couple features I am missing: Lets take for instance the Sorting Layer list:

Here there are 2 features that I would like:

The ability to reorder elements on the editor
The ability to add more elements using + or -

Is there any way to add this functionality into my List?

sentences:
What is the correct way to update a physics frame rate? I've searched around the Internet, and eventually read a suggested article, "Fix your Timestep!". In accordance with the article, I came up with an update method, but I still have problems. Whenever I instantiate more objects, in my scene, I get much slower physical interaction. I've fixed other sub-systems, that they were wasting cycles during the update process, and I've tracked my physics performance drop to this point. I think the way I'm updating my physics is somehow wrong, because I'm using a fixed timing of 1.0 / 60.0 for my Box2D engine.

What are the mistakes I'm making in my update process? What is the correct way to update a physics frame rate? Here is my code:

void Core::Update()
{
    // Input
    this->cInput->Update();

    // Physics
    this->cPhysics->Update();

    // Keep frame rate
    static const double desiredTime = 1.0 / 60.0;
    static double currentTime = (double)(GetTickCount());
    static double accumulator = 0.0;

    double newTime = (double)(GetTickCount());
    double frameTime = newTime - currentTime;

    if(frameTime > 0.25){ frameTime = 0.25; }
    currentTime = newTime;

    accumulator += frameTime;

    while(accumulator >= desiredTime)
    {
        // Input
        this->cInput->Update();

        // Physics
        this->cPhysics->Update(desiredTime);

        // Scripts
        this->cScripts->Update();

        accumulator -= desiredTime;
    }

I've read that you shouldn't tie your physics frame rate to the render frame rate, so I use this->cPhysics->Update();. I've used my previous approach, but with a slight change; I'm not sure if what I'm doing is right, but it solved my performance issue. First, I changed currentTime to get time in milliseconds, instead of seconds. At the end, I've moved all of my update code to a time step loop, except for the renderers update. I still do not know if this is the correct way to go.

sentences:
Is it sound to use javascript for cross platform game scripting instead of lua? I might need web clients for my game I have been looking around for clues on the subject but I'm not convinced to commit to javascript as my primary scripting language.

Currently I have started with lua. But I fear it will be a limiting choice for my future projects which include web clients for my games.

So basically I would like to know if you think it would be a viable solution for handheld devices and consoles.

Also, I would be glad to hear about:

anyone who had much success with javascript in cross platform games
failures with javascript scripting engines
restrictions within console SDKs that would prevent this type of solution
successes using lua in web games

sentences:
Why is there a gameObject inside a GameObject In order to manipulate a game object via script in Unity I need to access the gameObject inside the main GameObject.

Why is it structured this way?  What is the main GameObject representing compared to the gameObject?

public class Sun : MonoBehaviour
{
    private GameObject[] _satelliteGameObjects;
    private Rigidbody[] _satelliteRigidBodies;
    public GameObject[] Satellites;

    private void Start()
    {
        if (Satellites == null)
        {
            Debug.LogError($"You haven't added a {nameof(Satellites)}.'");
            throw new InvalidOperationException($"{nameof(Satellites)} should not be null");
        }

        _satelliteRigidBodies = new Rigidbody[Satellites.Length];
        _satelliteGameObjects = new GameObject[Satellites.Length];

        for (var i = 0; i < Satellites.Length; i++)
        {
            var satellite = Satellites[i];
            _satelliteRigidBodies[i] = Satellites[i].gameObject.GetComponent<Rigidbody>();
            _satelliteGameObjects[i] = Satellites[i].gameObject;
            _satelliteRigidBodies[i].AddForce(Vector3.up * 100);
        }
    }
}

In the example above, I'm passing a GameObject into this class.  However, in order to call members on the actual game object, I need to go through the gameObject property.

sentences:
How to keep track of camera's rotation while it's being rotated? I'm building a 2D game where the sole interaction of the player is rotating what they can see (this is currently the camera, though it could be the world) by plus or minus 60 degrees.

My current approach has their input rotating the camera. The issue I'm having is that I'm finding it impossible to keep track of how many degrees they've rotated it, since the camera is rotating and losing its initial position.

(I'm using libgdx, however, I think this problem is framework independent.)

Edit:

To help with the understanding, let me provide an example. Picture yourself in a school playground. You want to turn 90 degrees. To help you keep track, you mark the ground with the chalk in your hand. Turning 90 degrees is now easy since you have a reference point.

Now imagine you're in space and trying to do the same thing. Instead of chalking the ground, you chalk yourself. It's now nigh impossible to know how much you turn by when you do.

sentences:
1-bit game - How to change the palette for the entire game at runtime? So I'm making a 1-bit color game, and would like to have an option in the menu to change what those two colors are so the player can adjust it to their liking. What is the simplest and/or best method to go about this? This would apply to the entire screen, not individual sprites/meshes, as I want to preserve the 1-bit color look.

Most of my assets are sprites, with a few flat meshes that are rendered without anti-aliasing so that they blend in with the sprites. They're all exported with the two standard colors I'm using (a yellow-ish off-white and a dark grey-ish-blue), but I can go back and re-export them in black and white if that is necessary for the suggested method.

My eventual plan is to support the basic black and white, a few monochrome monitor color schemes, and some color combinations that you'd see on 8-bit computers (C64, Apple, etc.).

sentences:
Do I need to be careful about PPU and Camera size and Device Resolution even if I'm not creaing a pixel art 2d game? I was reading this blog post
https://blogs.unity3d.com/2015/06/19/pixel-perfect-2d/
and was wondering if I need to be super careful about those numbers, although my game's art is not pixel art.

sentences: Logic for selecting random rewards I am making a RPG game and I am seeking a bit of information on how to grant players random rewards, such as game items, weapons, gold, etc... after defeating a monster, or a NPC of some kind. The items would be pre made and already existing. I am not sure on what is the best way to approach this kind of system. Any tips of advice will be appreciated on the matter.

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:
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 is shot synchronization implemented in multiplayer FPS? I'm building a 2D multiplayer shooter game. I have singleplayer working and started working on multiplayer part (server code,...) and there is one thing I just can't get my head around.

When player shoots someone, who is moving, and he has high latency (>200ms or something like that) how to synchronize it with the other client? I thought that the shot vector could be sent relatively to targeted player (so when he would recieve the info about the shot, he could animate the shot hitting him).

Problem is, shots can destroy enviroment or hit other players. So when I shoot a target and there aren't any obstacles, he gets hit and the packet about shot hitting him gets sent. 200ms (+ other player latency) later, other player recieves the packet, but in that time, he moved behind an obstacle.

Problem rises:

a) If the obstacle is destroyable by the shot, clients will have different map (shooting player will have map with obstacle, while the other player will have the obstacle destroyed)

b) If the obstacle can't be destroyed, other player will either complain, because he got shot through impenetrable obstacle or the shot will be shot, so shooter will think that target got hit and target won't see any hit.

I just can't find a better way to solve this. Any ideas or examples how other games did it?

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:
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:
How can I integrate someone well into my project? I am working alone, since over one year on a decent sized project... to speed up things i wanted to incorporate some friends into development, unfortunately i never  did something like this before and so i dont know where to start.

What is important to work as a team ? What should he know, see and understand ? And what shouldnt he be aware of ? And most important, how would you integrate someone into your project ?

sentences:
Why does my collision detection code cause my framerate to drop? I have this code:

foreach (CollisionTiles tile in map.CollisionTiles)
{
  player.CollisionBox(tile);
  foreach (Enemy enemy in enemys)
    enemy.CollisionBox(tile);
}

This is the CollisionBox() function:

public void CollisionBox(CollisionTiles tile)
{
  int x = rectangle.X / Map.Size;
  int y = rectangle.Y / Map.Size;
  int tileX = (int)tile.Position.X;
  int tileY = (int)tile.Position.Y;

  if (tileX >= x - 1 && tileX <= x + 2 && tileY >= y - 1 && tileY <= y + 3)
  {
    Collision(tile.Rectangle, Map.Width, Map.Height);
    tile.Collide = true;
  }
}

These two lines appear to be the problem:

 int x = rectangle.X / Map.Size;
 int y = rectangle.Y / Map.Size;

I guess because it loops through them on every tile...

The Collision() function just check the face's of the two triangles (both player/enemy and the tiles) with these functions:

 public static bool TouchTopOf(this Rectangle r1, Rectangle r2)
 {
   return (r1.Bottom >= r2.Top && r1.Bottom <= r2.Top + (r2.Height / 2));
 }

public static bool TouchBottomOf(this Rectangle r1, Rectangle r2)
{
  return (r1.Top >= r2.Bottom - (r2.Height / 2));
}

  public static bool TouchLeftOf(this Rectangle r1, Rectangle r2)
  {
  return (r1.Top <= r2.Bottom - (r2.Height / 2) &&
          r1.Bottom >= r2.Top + (r2.Height / 2) &&
          r1.Right >= r2.Left &&
          r1.Right <= r2.Left + (r2.Width / 4));
  }

  public static bool TouchRightOf(this Rectangle r1, Rectangle r2)
  {
    return (r1.Top <= r2.Bottom - (r2.Height / 2) &&
            r1.Bottom >= r2.Top + (r2.Height / 2) &&
            r1.Left >= r2.Right - (r2.Width / 4) &&
            r1.Left <= r2.Right);
  }

When there is more then one monster with the player I get a massive FPSdrop, and it's getting worse when more monsters get added. What should I do to fix that problem?

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: How to create axes for a console controller What should I change in the input manager to enable me to use a joystick? I have a usb cable to connect the joystick to the computer but how do I set up the controls?

sentences:
how to switch cameras with one button? using System.Collections;
using System.Collections.Generic;
using UnityEngine;
using UnityEngine.UI;

public class cameraswitch : MonoBehaviour {
 public Camera cam1;
 public Camera cam2;

void Start () {
    cam1.enabled = true;
    cam2.enabled = false;
    Button Button = gameObject.GetComponent<Button>();
    Button.onClick.AddListener(baz);
}

void baz () {
    cam1.enabled = false;
    cam2.enabled = true;
}
}

this is my code . how to switch between the cameras with one button . and Thank You.

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: How to keep Input System and Graphics System separate? I want to keep Input System and Graphics System separate, but the Window Handler that's created by graphics component make everything really hard. How should I approach this situation?

sentences:
Why are my Mecanim animation curves not staying within the entered range? I have an in-place animation that I added curves to (In the rigged FBX which has the animation). I created 2 float parameters in the relevant controller with the same names as the curves in the animation clip.

Now, when I get the value of the float using animator.GetFloat(), the values I get are not in the value range I entered in the curves. My range is between 0.0f and 4.0f but what I get is approximately -0.6f to 0.03f. Why is this? From what I could gather from other threads, there is some blending going on with some other curves. What is this blending? And if there is some blending happening, how can I remove that?

I'm using Unity 5.1.1.

sentences:
Unity 2D switch direction in an auto runner I'm new to Unity and I'm trying to make a 2d endless runner (something like Super Meat Boy Forever), and one idea was that when the player touches a wall he would change direction.
I tried to implement the mechanic, but in game is very strange and buggy. My idea was to change the speed value from positive to negative and vice versa when the character collides to a wall (I used a layer mask for that). If someone could help me I would be very grateful.
Here is the code:
using System.Collections;
using System.Collections.Generic;
using UnityEngine;

public class Movement : MonoBehaviour {

public float speed;
public float jumpForce;
private Rigidbody2D rb;
public bool grounded;
public bool walled;
public LayerMask whatIsGround;
public LayerMask whatIsWall;
private Collider2D myCollider;

// Start is called before the first frame update
void Start() {
    rb=GetComponent<Rigidbody2D>();
    myCollider=GetComponent<Collider2D>();
}

// Update is called once per frame
void Update() {
    grounded = Physics2D.IsTouchingLayers(myCollider, whatIsGround);
    walled = Physics2D.IsTouchingLayers(myCollider, whatIsWall);
    rb.velocity = new Vector2(speed, rb.velocity.y);
    if (Input.GetKeyDown(KeyCode.Space) || Input.GetMouseButtonDown(0)) {
        if (grounded) {
            rb.velocity = new Vector2(rb.velocity.x, jumpForce);
        }
    }

    if (walled) {
       speed = -speed;
    }
}

}

sentences:
How to make mobile movement using CharacterController How can i change my movement for mobile i think left and right gonna work but i don't know what should i do for jump

private void Update()
{

    vector = Vector3.zero;

    if (characterController.isGrounded)
    {
        /*verticalVelocity = -gravity * Time.deltaTime*/;
        verticalVelocity = -0.5f;

        if (Input.GetKeyDown(KeyCode.V))
        {
            verticalVelocity = jump;
        }
    }
    else
    {
        verticalVelocity -= gravity * Time.deltaTime;
    }

    vector.x = Input.GetAxisRaw("Horizontal") * speed;
    if (Input.GetMouseButton(0))
    {
        if (Input.mousePosition.x > Screen.width / 2)
            vector.x = speed;
        else
            vector.x = -speed;
    }
    vector.y = verticalVelocity;
    vector.z = speed;

    characterController.Move(vector * Time.deltaTime);
}

I solved the problem this way

if (characterController.isGrounded)
    {

        verticalVelocity = -0.5f;

        if (Input.GetMouseButton(0))
        {
            if (Input.mousePosition.y > Screen.height / 2)
            {
                verticalVelocity = jump;
            }
            else
            {
                verticalVelocity = -jump;
            }
        }
    }
    else
    {
        verticalVelocity -= gravity * Time.deltaTime;
    }

    vector.x = Input.GetAxisRaw("Horizontal") * speed;
    if (Input.GetMouseButton(0))
    {
        if(Input.mousePosition.y < Screen.height / 2)
        {
            if (Input.mousePosition.x > Screen.width / 2)
                vector.x = speed;
            else
            {
                vector.x = -speed;
            }
        }
    }

sentences:
Unity 5 - Mouse Disappears during runtime My mouse cursor disappears during runtime. When I click esc, it appears and the moment I click on something, it disappears again. This is what I have done so far to fix this. I have added this to a script on an empty gameobject in my scene.

void Start()
{
    Cursor.visible = true;
}

The problem persists and so I added the code to the update function. Still the same. I do not understand what am I missing here. Why is the cursor disappearing the moment I click and why doesn't it appear automatically onStart during runtime? I have also tried to implement a custom cursor and the same problem again. I am using 5.3.2f. I hope someone can point me in the right direction. Cant find a solution in any forums.

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:
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:
What are the code structures for storyline based game? I am curious about how storyline-based games are written.

For example: if the character done Event A, then he meets an NPC and result in Event B.

On the other hand: if the character didn't do Event A, then he meets an NPC and result in Event C.

From the code structure that I've thought up, the NPC should be an object of a class, and there should be a status variable that mark if character have done Event A or not.
However, what if there's thousand of similar type of Event as Event A? How'd I handle huge, complex storyline game in coding?

I just want to know exactly how the trick was done to keep in check of what Events have happened.

Another thing that I'm curious about is how Event is kept in. An object? or just a function?

For example:
Event A might have some flashy effect played in non-fmv ,while maybe Event B is an fmv, and Event C might be a battle.

and there may be variety of them. Therefore, how would I handle variety of Events with a consistence method? or maybe, at the very least, contain them in a consistence way (function? or Object?) I just want to know how the trick was done.

sentences: i want to upload to 2gb model animation to vram with VBO technic but i am getting this error with nvidia (with amd no error) when i try to work with amd its working with amd hd6870 and ati x1550 but when i try to work with gtx 950 its giving this error. if i upload less than 2gb example 300mb then its working but i want to upload 2gb. what can i do ? sorry for bad english.

sentences:
Where to put my entity component messaging functionality? I've done my research and read as many articles and posts on messaging and ECS's as I could find to help me get mine working. However, I'm at a roadblock on how to get my messag functionality to be handled correctly.

A little information on my ECS system.

Pieces:

Entities - Generic objects that only contains a list of attached components, has a few methods to ask if it has certain components and to retrieve them.

Components - Only holds data specific to their nature and all have a bitMask denoting the component type.

Systems - Functionality code specific to their nature and keeps a list of components it will process.

Messages -
Messages are currently created via the MessageInfo class. A message can be created easily using this line of code:

MessageInfo* msg = new MessageInfo(MESSAGE_TYPE, LISTENER_ENTITY, boost::ANY PARAMS);

I am trying to keep things decoupled as possible and have thought about adding a static MessageCenter that I can push messages to which will then either dispatch them immediately or throw them into a queue (depending on the push function call).

Example being that a message is created and pushed to the message center. The message center then immediately looks through its map of systems that care about X message and dispatches the message to a "RecieveMessage" method that's inherent to all systems. This approach sounded really good to me, so I started to develop it on paper and ended up running into a wall.

Let me put forth one of the scenario's I ran up against.

Scenario:

I have a text label entity being used as a % indicator with the position (x/y coords) component and text component (string, font size, etc). I want to alter some data properties of this entity, such as the text displayed and its color.

Since I know that all systems have a recieveMessage method I am quickly  able to encapsulate functionality specific to those types of requests as shown below.

void SOMESYSTEM::RecieveMessage(MessageInfo* messageInfo)
{
    switch(messageInfo->GetMessageType())
    {
    case MessageType::CHANGE_TEXT:
        {
            boost::any params = messageInfo->GetParams();
            if(params.type() == typeid(std::tuple<BaseComponent*,std::string>))
            {
            auto param = boost::any_cast<std::tuple<BaseComponent*,std::string>>(params);
            TextComponent* textComponent = static_cast<TextComponent*>(std::get<0>(param));
            textComponent->SetTextString(std::get<1>(param));
        }
    }break;
case MessageType::CHANGE_TEXT_COLOR:
    {
        boost::any params = messageInfo->GetParams();
        if(params.type() == typeid(std::tuple<BaseComponent*,sf::Color>))
        {
            auto param = boost::any_cast<std::tuple<BaseComponent*,sf::Color>>(params);
            TextComponent* textComponent = static_cast<TextComponent*>(std::get<0>(param));
            textComponent->SetCurrentColor(std::get<1>(param));
            }
        }break;
    }
}

The wall I run into is where do I put this functionality? Currently the only system that touches text components is my RenderTextSystem. It wouldn't seem proper to implement that RecieveMessage function wanting those specific messages. That system just draws the text to the screen. I could be over-engineering here though.

I have other scenarios similar to this and figured if I could solve this one, I could end up solving 99% of the others.

sentences:
How should a Unity object control it's state? I've been using Unity's component based design, and the biggest problem I've faced is how to control an object's( not component's ) state.

The problem is, some components must act differently based on the object's state. However, checking an object's state within a non-specific component( imagine we have a "DamageEnemyComponent" ) won't work at all because it makes assumptions about the object it's attached to.

The alternative is to make each component perform one, and only one function. The components are then disabled/enabled or added/removed depending on the object's state( probably managed by a more specific component. )

Imagine we have a "Boomerang" object. Assume it has only two states; idle( being held by the player ) and firing. In the idle state, the boomerang would have very few components, because we don't want it to interact with the world while it's simply being held. It may have components to listen for a "throw", though. Once it is thrown, some state manager on the object needs to update the object to have components for moving, damaging enemies, maybe picking up items etc. When the boomerang is back in the hands of the player, it's component list would need to be restored. This would work, but it would basically be building a new game object for each state, which is incredibly tedious and messy without Unity's editor. Not to mention the inheritance and interfaces can't be used well here( since the state specific components will be built into the state manager script. )

I can't see a way to control state using Unity's components. How is this usually done? It feels as if Unity should provide a way to build different states in the editor, much like building an object.

sentences:
In a 2D top-down game, how can I create projectiles that have a height? A 2D game called Deer Hunter has projectiles like this:

Are the projectiles 2D or 3D models? How could I implement something similar?

sentences:
Bullet softbody nodes messed up positions I recently switched from Havok physics to Bullet because I wanted to have soft body collisions, but I don't have any budget to license the (superior?) Havok solution, I couldn't even try those functions out there so it is completely new to me.
I want to create a soft body from an arbitrary mesh and for that I use the soft body helper:

btVector3* btVerts = new btVector3[vertices.size()];
for(int i=0;i<vertices.size();++i)
    btVerts[i] = (btVector3(vertices[i].pos.x,vertices[i].pos.y,vertices[i].pos.z));
const int iCount = indices.size();
const int tCount = iCount/3;
int* btInd = new int[iCount];
for(int i=0;i<iCount;++i){
    btInd[i] = (int)indices[i];
}

btSoftBody* softBody = btSoftBodyHelpers::CreateFromTriMesh(
        ((btSoftRigidDynamicsWorld*)dynamicsWorld)->getWorldInfo()
        ,(btScalar*)btVerts
        ,&btInd[0],tCount
        ,false
    );

Where vertices and indices are vector references coming from my graphics engine. I fill out the mesh with that information and seemingly I can create it without problem. After I step the physics world I connect my BULLET softbody nodes to my vertices in the graphics engine, then updating the vertex buffer.
I get the information from the softbody nodes by their tNodeArray m_nodes this way:

btSoftBody::tNodeArray&   nodes(softBody->m_nodes);

    for(int j=0;j<nodes.size();++j)
    {
        verticesIn[j].pos=XMFLOAT3(nodes[j].m_x.getX(),nodes[j].m_x.getY(),nodes[j].m_x.getZ());
        verticesIn[j].nor=XMFLOAT3(nodes[j].m_n.getX(),nodes[j].m_n.getY(),nodes[j].m_n.getZ());
    }

The problem: However I do not get correct vertex positions and neither correct normals. I am using a simple quad mesh with 4 vertices (the positions):
{ (-1,0,-1), (1,0,-1), (1,0,1), (-1,0,1) }
But if I get values from the softbody's nodes after creation, but before stepping any physics I don't get back my original values from the nodes (the positions):
{ (-1,0,-1), (0,1,0), (-1,0,1), (0,1,0) }
I even noticed the node vertices kind of resemble the originals, just "overlapped" somehow or not sure how can I describe if it is even the case, but it is like the second vector has an extra zero at the beginning and the whole mesh got screwed up.
Could it be something is not right with my loading? Or do I miss something in the concept of soft body physics?
I have studied the bullet soft body sample which is quite informative and they sure load their meshes like I do (the bunny mesh for instance), at least it seems like it. I don't have any idea and got stuck here for a day now. Without connecting to the softbody, my mesh remains correct.

sentences:
Frame-rate independent friction on movement in 2d game I have been trying to implement a simple physics system for a 2D space game I am making. I have it pretty much working, but I have encountered an issue with the way I apply friction. I have tried several different ways of solving it, with different guides found online, but my math skills are lacking and it's difficult for me to translate the solutions to fit my problem.

I made a unit test that shows my problem:

            //Simulate a low FPS.
            //Accelerate body1 with 100 pixels/second, for a deltaTime of 1 (A single frame that took 1 second)
            body1.accelerate(100, 1);
            //Performe the physics with the dame deltaTime.
            body1.doPhysics(1);

            //Simulate a higher fps.
            //Accelerate body2 10 times, with 100 pixels/second for a deltaTime of 0.1 (A single frame that took 1/10'th of a second.
            for(int j=0; j< 10; j++) {
                body2.accelerate(100, 0.1);
                body2.doPhysics(0.1);
            }

            Debug.Log("Straight movement result "+body1.getPosition()+" --- "+body2.getPosition());

Which gives the result:
"Straight movement result [0.0, 50.0] --- [0.0, 39.31200662855]"

My acceleration does not seam to be a problem. I have a unit test like the other one, to test the acceleration, and it shows no problems.

public void accelerate(double acceleration, double deltaTime) {
        Vector2f accel = new Vector2f(0, (float)(acceleration));

        //If power is negative, we want to go backwards.
        if(acceleration < 0)
            accel.setTheta(angle+90 - 180);
        else
            accel.setTheta(angle+90);

        velocity.x += (accel.x * deltaTime);
        velocity.y += (accel.y * deltaTime);
    }

In the doPhysics method, is where I calculate the friction. If I remove the friction calculations, the two values printed from the unit test are equal.

private static final float friction = 1.0f;//0.96f;

    private void doPhysics(double deltaTime) {
        //Save the velocity before applying friction.
        Vector2d velBefore = new Vector2d(velocity);

        //Then apply friction, with deltaTime.
        velocity.x -= (velocity.x * friction) * deltaTime;
        velocity.y -= (velocity.y * friction) * deltaTime;

        //And then calculate the average of the friction before and after friction and factor in deltaTime
        double realVelX = ((velBefore.x + velocity.x) * 0.5) * deltaTime;
        double realVelY = ((velBefore.y + velocity.y) * 0.5) * deltaTime;

        //Add the calculated velocity.
        position.x += realVelX;
        position.y += realVelY;
    }

I hope someone can see what I am doing wrong. I would really like my physics to be frame-rate independent and simple enough for me to understand.

sentences:
Overlap color between objects I'm currently trying to build a game with Ogre3D that is basically a moving vehicle that leaves a green trail (2D manual mesh) in it's path, what i'm trying to achieve is exactly what this image shows:

My problem is that i need to change, by some method/technique, the color of the intersected path where the two meshes overlap (red area).
I've been searching around the Ogre forum and found this thread http://www.ogre3d.org/forums/viewtopic.php?f=2&t=47674, I've replicated that solution in my code but now on the screen i only see the intersected path. I'm a total newbie in stencil buffers and in Ogre generally, so I'm still not sure if this is the best approach to solve my problem.
should I try another method rather than applying a stencil buffer? vertex/fragment shader code that could help?

Any advice or direction that you could provide will be very appreciated.
Thanks a lot

***** UPDATE *****

According to JasonPh's answers i've managed to start adding some code:

1) Create manual texture

Ogre::TextureManager* tmgr = Ogre::TextureManager::getSingletonPtr();
gkString mMapTextureName = "pathTexture";
if (!tmgr->resourceExists(mMapTextureName)) {
    Ogre::TexturePtr ptr = tmgr->createManual(mMapTextureName,
                           Ogre::ResourceGroupManager::DEFAULT_RESOURCE_GROUP_NAME,
                           Ogre::TEX_TYPE_2D,
                           480,  // Width
                           640,    // Height
                           1, // Depth
                           0,
                           Ogre::PF_A8R8G8B8,
                           Ogre::TU_RENDERTARGET);

    ptr->createInternalResources();
    ptr->load();

    Ogre::RenderTexture* pathTexture = ptr->getBuffer()->getRenderTarget();
    gkEngine* engine = gkEngine::getSingletonPtr();
    Ogre::Camera* camera = engine->getActiveScene()->getMainCamera()->getCamera();
    pathTexture->addViewport(camera);
    pathTexture->getViewport(0)->setClearEveryFrame(true);
    pathTexture->getViewport(0)->setBackgroundColour(Ogre::ColourValue::Black);
    pathTexture->getViewport(0)->setOverlaysEnabled(false);
    pathTexture->setAutoUpdated(true);
}

2) Create material from scratch and use the previously created texture. This material is then assigned to my "path" entity.

Ogre::MaterialManager* mmgr = Ogre::MaterialManager::getSingletonPtr();
mMaterialName = uniqueMaterialName("pathMaterial");
mMaterial = mmgr->create(mMaterialName, "General");

Ogre::Technique* tec = mMaterial->getTechnique(0);
tec->setSchemeName("ShaderGeneratorDefaultScheme");
Ogre::Pass* pass = tec->getPass(0);
pass->setVertexProgram("pathMaterial/vs", false);
pass->setFragmentProgram("pathMaterial/fs", false);
pass->setCullingMode(Ogre::CULL_NONE);
pass->setColourWriteEnabled(true);
pass->setLightingEnabled(true);
Ogre::TextureUnitState* tus = pass->createTextureUnitState();
tus->setTextureFiltering(Ogre::TFO_NONE);
tus->setTextureAddressingMode(Ogre::TextureUnitState::TAM_CLAMP, Ogre::TextureUnitState::TAM_CLAMP, Ogre::TextureUnitState::TAM_CLAMP);
tus->setTexture(tmgr->getByName(mMapTextureName));

mMaterial->prepare();
mMaterial->load();

3) Fragment shader code

uniform sampler2D pathTexture;

void main()
{
   vec4 color = texture2D(pathTexture, gl_TexCoord[0].xy); =
   if(color == vec4(0.0, 1.0, 0.0, 1) //green
       gl_FragColor = vec4(1.0, 0.0, 0.0, 1) //red
   else
       gl_FragColor = vec4(0.0, 1.0, 0.0, 1) //green
}

This still needs some fixes to work, so new questions have emerged:

1) Do I realy need to render "pathTexture" on screen to this to work? Maybe that texture could only be used to decide pixel colors an then discard it?

2) To only use "pathTexture" as an "input" for my shader, should I add a second pass on my material file with "pathTexture" as a texture unit?

Thanks!

sentences:
Exporting UV coords from Blender So I have searched on google and various other websites but I've not found an answer. The only ones I did find did not work.

So my question is how do I get UV coords from blender (2.63)?

Currently I'm writing my own custom file exporter, and so far have managed to export vertices and their normals. Is there a way to export the UV coords?

N.B. I'm currently try to figure it out using a simple cube that is unwrapped and has a texture applied to it.

sentences:
What can cause shadow slicing while moving camera? Can't explain better than with video: https://youtu.be/4nIMIL6w-0M

The effect I'm trying to achive is a simple fog of war.

See, I have a point light casting shadows on a plane. The plane has a shader which takes light attenuation and either draws a black pixel if there is no light, or discards a pixel to draw background if the light touches that pixel.

After hours spent on this, I came up with a thought that I cannot do anything more.

A problem as I see it:

  Light successefully casts a shadow of shadow casters on a plane, however, with camera at a distance from the shadow, the shadow it self gets splitted and sliced, like it would've been, if some of the shadow casters' faces are suddenly removed from their meshes.

What I have tried:

Changing Z coordinate of a light.
Changing Z height of obstacles (shadow casters).
Changing vertices on the obstacles so that every face would have its own vertices so no faces could share a vertex.
Changing shadow quality in the settings.
Changing camera rendering mode, all four of them.
Changing point light to a spot light with wide cone radius.
Using nice and simple standart unity's shader for a shadow receiver (a plane) - Standart Diffuse.
Switching between hard and soft shadow types.
Changing light's shadow's resolution, shadow strength and biases
Trying out the compiled EXE on another machine.
Changing light's baking type, rage and intensity.
You name it.

None of those had any improvementes on an issue.

I would like to hear authoritive replies (best option would be from the developers) as well as any information you guys think I can try out (so I can do that).

sentences: Saving Skin weights Issue I have Skinned the character using rig simulator and now wanted to add Bendy controls.. How can I export the skin weights and apply on modified rig?

sentences:
Weird behavior using TextMeshPro I have a very simple scene setup. What I want to do is to create a button prefab composed of a sprite and a TextMeshPro object. When I group the sprite and the text under a GameObject, the pivot of the compound object appears very far from the center of the GameObject (please see the attachment).

I can't move the pivot of the text to the center no matter what I do.

Is this an expected behavior?

sentences:
2d libgdx: runtime level generation I have encountered a problem during my first game development:
I thought of a Array<Ground> groundArray that does groundArray.add when a new ground will appear on the screen, and removes oldest ground when it will no longer be seen, if player only moves to the right, like in flappy bird.

The perfect structure would be a queue for such a mechanic, but libgdx doesnt have one. Using libgdx's Array is not intuitive too - i have to reverse the order of elements. It has a method pop() that removes the last element, but no such method to use on the first element.

What are my options here?

extend Array class and add something?
writing my own queue-like class?

UPDATE 18/8/2014

i actually found a way to do it with the default Array:

private void checkGround() {
    for (Ground ground : groundArray){
        if (ground.x  + 500 < camera.position.x){
            groundArray.removeValue(ground, true);
        }
    }

    if (groundArray.peek().x < camera.position.x + 500){
        groundArray.add(new Ground(groundX, -150));
        groundX +=50; //my ground texture is 50 pixels wide
    }
}

Only question left now - will it affect performance when there will be 10000 empty elements before the 10 actual ground elements? In my render method i use:

for (Ground ground : groundArray){
        batch.draw(ground.getTextureRegion(), ground.x, ground.y);
    }

If yes - i will have to make a re-sort method that shifts all the grounds to the beginning of the array.

Will doing so improve this?:

for (Ground ground : groundArray){
        if (ground != null) {
            batch.draw(ground.getTextureRegion(), ground.x, ground.y);
        }
    }

After checking apparently the array size doesnt boost , it size is always equals the number of actual ground objects in it, but i thought that it will count also the null values that were ground objects before. But then surely there would be nullpointers when i tried to draw those null's, so the problem looks fully resolved.

sentences:
Restricting my horizontal slash attack I've been working on making this slash attack for my character in the unity engine. The whole point to this script is to put the damage range in sync with the slashing animation. The slash is completely horizontal and is scripted out make enemies bounce back. I have most of that but what I really need to restrict it on x axis. If I haven't explained it enough let me give you an example of what its doing. When an enemies in front of me but above the area my swing attack shouldn't be able to reach. I use my swing attack and it still does damage anyways. what I need is a way is restrict my hit detection range between two angles rolling around the x axis. I'm sorry if I didn't explain this so well just tell me if I need to make something more clear.

this is the code I've come up with what I've got it doings is it applies damage it can tell if an enemy is in front of it (uses the dot product for that) it can even knock said enemy backwards

void Knockback(){

     Vector3 grenadeOrigin = transform.position; // I'm building this controller using explode for knock back
// and this stuff was based off of a grenade script
     Collider[] colliders = Physics.OverlapSphere (grenadeOrigin, radius);
     foreach (Collider hit in colliders){
         Rigidbody rb = hit.GetComponent<Rigidbody>();
         if (rb){
             Vector3 dir = (rb.transform.position - transform.position).normalized;
             float direction = Vector3.Dot(dir, transform.forward);
             Debug.Log(direction);
             if (direction >0.1){// this is where i tell if something is in front of me
                 rb.AddExplosionForce(power, grenadeOrigin, radius, 0);
                 //This is where we apply force to our enemy and various other rigid bodies
                 hit.gameObject.SendMessage("Damager", Damage, SendMessageOptions.DontRequireReceiver);
                 //This is where we apply damage to the enemy
             }
         }
     }
 }

sentences:
Online convertible board game that is not online but based on multiple players I'm wondering how a system can be made compatible with networking operations (client-server). By saying "networking operations" I mean a system that can handle online operations, multiple user interactions and client-server processes.  For example, in programming term, lets imagine we created a Board class for our awesome board game and this game is played with multiple players but we don't know how to make this game online (This Board class to be online for multiple users) since we don't know how to convert our board game to online, we decided to make the board game be able to convertible to online board game. For example, you made this game and posted to github.com and someone found your game very interesting and said "I want to make this online with a game library or engine". In that case, the first (positive, good) scenario is that the person that wants to make this game online will say "Yeah this game's codes can be converted to online so I can do it" and the second (negative, bad) scenario is that the person will say "This game is quite nice but the codes are as terrible as that cannot be converted to online" So if we want first scenario to happen, we have to make the codes convertible to online. But I don't know what the requirements are and how to achieve this. But I have a theory.
My theory: the board class that represents whole game must be convertible to JSON to transfer the board from server to client or from client to server. So the board that is in client can easily be synchronized with server's board by JSON data transferring. So my board class must represent methods like named "getBoardAsJSON(), toJSON()" so the JSON data that is obtained from the board can be carried to client and to server.
My questions are:

What fundamentals, features are needed for my board game to be able to converted to online?

Is JSON convertible feature enough for my board game to be online?

sentences:
VBO Performance issues I'm making a 2D Tile based game in OpenTK at the moment. Performance was really bad (laggy and slow) with direct drawing, so I switched to VBOs. The performance hasn't changed, it might even be slower than it was.

I render the tiles from a list, but use a single VBO.

public void DrawTiles()
        {
            foreach(Tile t in Tiles)
            {
                if(t != null)
                {
                    GL.Color4(System.Drawing.Color.White);
                    GL.BindTexture(TextureTarget.Texture2D, Global.LoadTexture(t.TileTexture.Path, 1));
                    var i = (CellNum * CellSize) / 2;
                    GL.PushMatrix();
                    GL.Translate((t.Position.X * CellSize) - i, 0, (t.Position.Z * CellSize) - i);
                    var x = CellSize;
                    verts = new Vector3[8]
                    {
                        new Vector3(0, 0, 0), new Vector3(0, 0, 0),
                        new Vector3(x, 0, 0), new Vector3(1, 0, 0),
                        new Vector3(x, 0, x), new Vector3(1, 1, 0),
                        new Vector3(0, 0, x), new Vector3(0, 1, 0)
                    };

                    GL.EnableClientState(ArrayCap.VertexArray);

                    GL.EnableClientState(ArrayCap.TextureCoordArray);

                    GL.BindBuffer(BufferTarget.ArrayBuffer, vbo);
                    GL.BufferData<Vector3>(BufferTarget.ArrayBuffer, (IntPtr)(Vector3.SizeInBytes * CellNum), verts, BufferUsageHint.StaticDraw);
                    GL.BindBuffer(BufferTarget.ArrayBuffer, 0);

                    GL.BindBuffer(BufferTarget.ArrayBuffer, vbo);
                    GL.VertexPointer(3, VertexPointerType.Float, Vector3.SizeInBytes * 2, 0);
                    GL.TexCoordPointer(3, TexCoordPointerType.Float, Vector3.SizeInBytes * 2, Vector3.SizeInBytes);
                    GL.DrawArrays(PrimitiveType.Quads, 0, verts.Length / 2);
                    GL.Flush();
                    GL.PopMatrix();
                }
            }
        }

That method is called in OnRenderFrame, CellSize and CellNum tell me how big the tiles are supposed to be and how many there are each side of the grid. Even if I run say a 20 tile grid, my program is incredibly laggy.

Does any one know a more efficient way to render these tiles, or better yet, speed up my current method?

sentences:
Component-based Rendering I have component Renderer, that Draws Texture2D (or sprite)
Then I have method OnUpdate, and there should be my rendering code, something like

spriteBatch.Draw(Texture, Vector2.Zero, Color.White)

But first I need to do spriteBatch.Begin();. Where should i call it? And how can I make sure it's called before any Renderer components OnUpdate method?

(i need to do more stuff then just Begin() i also need to set right rendertarget for camera etc.)

sentences: Generate static 2D Tilemap from array How do I generate a 2D tile map from an array like in this tutorial for XNA ? I basicly want to generate a static map based on my tile prefabs.

sentences:
Move parent according to child axis in Unity? Can I ask my parent to move according to the child axis? This means if I turn right, then right again, the parent has to be at 180° from its original position, and not only at 90° (because "Right" would mean : "stay on the right axis from the parent axis", and what I want is : "move the parent according to the child axis").

The parent has a script to move, and the child has the script to rotate, so I would need to use the new rotation from the child, and not the rotation from the parent.

My attempt so far is this one : in "MoveBody()", oldTr = transform.position works without a bug, but it is using the parent axis. With oldTr = this_objW;, there is a bug, the parent goes somewhere in the scene and move its "z" axis in an odd way :

this_obj = GameObject.Find("this_obj").transform;//the child to rotate
this_objW = this_obj.TransformDirection(this_obj.forward);//world

//...

MoveBody( new Vector3( 3.0f, 0, 0 ) );

//...

private void MoveBody( Vector3 vec ){

      Debug.Log("transform.position : "+transform.position+" / this_objW : "+this_objW); //same value here: Vector3(0,0,1);
      oldTr = this_objW; //transform.position;
      newTr = this_objW;//transform.position;
      newTr += vec;
      transform.position = Vector3.MoveTowards(oldTr, newTr, sideSpeed * Time.deltaTime);
}

Is it possible to do it this way? Or should I translate each axis by hand?

Thanks

sentences:
cocos2dx - Custom Fragment Shader and CCRenderTexture I have a CCRenderTexture that is filled with a sprite when the scene is loaded, as follows,

canvas = CCRenderTexture::create(this->getContentSize().width, this->getContentSize().height);
canvas->setPosition(data->position);
canvas->beginWithClear(0.0, 0.0, 0.0, 0);
this->visit();
canvas->end();

The above code is written within a class, which derives from CCSprite (Hence this).

Then, in another function applyShader(), I create a sprite named splat, from the texture of CCRenderTexture *canvas. Thus splat will contain the whole texture of canvas.

Now I apply a custom fragment shader to the splat by calling the function splat->renderShader(), which will modify some small portion of the whole  texture.

Then I draw the modified texture back to the CCRenderTexture *canvas.

Hence, applyShader() will
 * take a texture from CCRenderTexture,
 * create a sprite based on it,
 * apply a fragment shader to it
 * and draw the modified texture back to CCRenderTexture.

This applyShader() will be called repetitively and its code is as follows:

splat = Splat::createWithTexture(art->canvas->getSprite()->getTexture());
splat->renderShader();
art->canvas->begin();
splat->visit();
art->canvas->end();

My shader code is (nothing fancy)

precision mediump float;

varying vec2 v_texCoord;
uniform sampler2D u_texture;
uniform sampler2D u_colorRampTexture;
uniform float params[5];

void main() {
    gl_FragColor = texture2D(u_texture, v_texCoord);
    return;
}

So, with the above code I expect the original sprite this to get rendered over and over again without any visual changes. But on each call to applyShader(), the texture is getting stretched a little and the stretched image is getting rendered. After some 10 calls, the image gets so distorted.

Can someone please tell me where I am going wrong?

Thanks :-)

PS: All code shown here is partial, not complete code.

Edit: Adding Screens

Update:
The problem has nothing to do with shaders it seems. It happens even when I dont call renderShader(). The actual lines of code is:

splat = Splat::createWithTexture(art->canvas->getSprite()->getTexture());
splat->setPosition( ccp( art->getContentSize().width * 0.5, art->getContentSize().height * 0.5 ) );
splat->setFlipY(true);
art->canvas->begin();
splat->visit();
art->canvas->end();

sentences:
In OpenGl ES 2, should I allocate multiple transformation matrices? In OpenGl ES 2, should I declare just one transformation matrix, and share it across all objects or should I declare a transformation matrix in each object that needs it?

for clarification... something like this:

public class someclass{
   public static float[16] transMatrix = new float[16];
   ...
   public static void translate(int x, int y){
      //do translation here
   }
}
public class someotherclass{
   ...
   void draw(GL10 unused){
      someclass.translate(10,10);
      //draw
   }
}

verses something like this:

public class obj1{
    public static float[16] transMatrix = new float[16];
   ...
   void draw(GL10 unused){
      //translate
      //draw
   }
}
public class obj2{
   public static float[16] transMatrix = new float[16];
   ...
   void draw(GL10 unused){
      //translate
      //draw
   }
}

sentences:
How to deal with player inquiries (good, bad, and everything in between)? I understand someone previously posted about dealing with bad suggestions from players. But I'd like to ask about dealing with inquiries in general.

When a game becomes popular, it's inevitable for you to receive heaps of emails from players (can be complaint about bugs, errors in purchases, etc). How do you usually handle these? Do you outsource these kind of things or do you try to answer the mails on your own during your free time? Or maybe create an online community like a forum?

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:
LibGDX - ShapeRenderer as principal game entity renderer I am trying to make a 2D game that is just a bunch of default figures like circles, arcs and quadrilaterals with no textures (similar to Super Hexagon), and for that I was using C# and XNA long time ago, but recently I move my code to Java and LibGDX mostly using the ShapeRenderer library.

The problem appears when, reading in internet, I found that render this figures is a more computational cost task than just draw a texture or sprite. But by the nature of this project I just can't use sprites or similar, mostly because I will drastically scale this entities in the game, and when I scale an image the result is just not nice, blurry and/or pixelated.

What I asking for is if is a bad idea to render pure shapes for a game (no images, except maybe the background and text)? is ShapeRenderer a good approach? Do I should try with another way to manage this "not-affected-by-scale"-entities?

I have read some answer from here (like this or this) but they are focused on sprites, not just pure shapes.

For now, I got acceptable results and the game run smootly even when I create a lot of shapes, but in the future I plan to use effects and so, and I don't know if render shapes is the best answer or if this will affect the performance of my game (the game is focus for PC platform). I'm not limited only to Java, and if exist another language/framework that manage this with better result, I'm opened to learn it.

Thanks!.

sentences:
Collision detection performance problem Using python and pygame I've built a collision detection system according to the instructions in this YouTube tutorial.

This is updated 40 times per second and controls movement and collision detection between some number of "agents", which are circles, each with a radius of 20:

for a in self.agents:
    dir = a.target - a.pos
    if dir.length >= 3:
        dir.length = 3
        a.pos = a.pos + dir

for a in self.agents:
    for a2 in self.agents:
        if a==a2: continue
        d = a.pos.get_distance(a2.pos)
        if d<40:
            overlap = 40 - d
            dir = a2.pos - a.pos
            dir.length = overlap/2
            a2.pos= a2.pos+dir
            a.pos= a.pos-dir

This looks and works great, as long as the number of agents is below 100. A higher number of agents will cause the pygame frame rate to drop. I left out some code which increases movement speed and pushback for a selected agent, but I don't think it has any consequence for the issue.

How can I make the code more efficient? For instance, would it help to make it so agents only check the distance of other nearby agents, say within a circle 4X the size of the agent, instead checking the complete list in every iteration of the code. Or is it better to change the method all together?

sentences:
Design/Architecture of a game waiting room I have some experience in creating singleplayer games, but for a new project I want to implement also a multiplayer.

I can imagine what kind of information (position, textureId, ...)  i have to send over the network. But hey, I can't figure out how I "could" represent a game waiting room. Which means :

One player creates a new game (What happens here?Does the server code calls a new instance of the game, but does not start the game yet???)
The player, who created the game then either waits for additional players(in maximum 4) or he starts a solo game (Should my game has something like a value for currentPlayers ? Or is this managed by server code?)
Also can you explain what exactly server code means? Which common functions should it handle (in context of creating a game room)?
How can I make sure, that other players can also start new games

As you can see I am a complete beginner to networking, but i do know about TCP and UDP, but the only thing i have done with it was a simple echo server...
What am i looking for are simple pseudocodes oder examples, but please explain briefly.

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:
Smooth Camera Offsets I am attempting to implement a sort of, smooth camera that has angle offsets from the player as they turn, creating a cinematic effect as well as visual feedback for when the player turns.

Here is an example of the desired functionality.
(Starts at 1:06)
http://youtu.be/uJ6tD-k_RuA?t=1m6s

One idea I was thinking of (if even feasible) is to store a "desired quaternion" of orientation of where the camera wants to look (preferably the player's quaternion of orientation)  and a "current quaternion" of the cameras orientation and SLERP to the desired quaternion. Then possibly set a max angle between the two rotations to cap how large the angle offset could be.

What are the ways of doing that?

sentences:
How to Create a Grid for a 2D Game? So I'm currently writing the engine for my videogame. I've almost integrated Tiled (I think) so I should have a map-creator here soon.

My question is, how do I actually make the grid? I'm really confused here. If I create a large map with, say, 20x20 grids the size of 32x32 (screen size 640x640), then what do I do with it?

Let's say I have the code for creating a window, and then place a player sprite that I can move with input, that's fine. If I use one map that's as big as the screen, then every pixel on the map is also a pixel on the game screen. The mapping is exact.

Now what happens if I have a 2000x2000 map, for example? My character would have to keep moving and move the map around (or rather the camera focused on the player moves). Then I can no longer say that the screen maps exactly to the pixel position of the map.

I tried making a Grid class that maps out the screen area to 32x32 tiles, but I'm not sure if that makes any sense. Once the map moves each tile would have to update its information, or something. I'm just really confused here.

How do I actually make the tiles and a grid and map them to the data I get from tiled, or that I make myself? Are there any good examples of source code that I could look at?

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:
Help interpreting the physics of a rolling ball I'm using this article for reference. I understand handling the collision aspect, but I can't figure out how to calculate the new velocity once the ball collides with the ramp. Without it the ball just slides down the slope and stops at the bottom, with no horizontal velocity generated from the descent.

The equation mentioned is

tangentialVelocity = velocity – (velocity * normal)normal

Which I've tried as

        ball.velocityX = _magnitude - (_magnitude * _normalX) * _normalX;
        ball.velocityY = _magnitude - (_magnitude * _normalY) * _normalY;

to no avail.

Here is what I've done so far, which finds how far the ball is intersecting in the ramp and moves it outside.

        var _distance:int = FP.distance(circleWorld.x, circleWorld.y, ball.x, ball.y);
        var _penetration:int = _distance + ball.radius - worldRadius;

        if (_penetration > 0)
        {
            var _componentX:int = circleWorld.x - ball.x;
            var _componentY:int = circleWorld.y - ball.y;

            var _normalX:Number = _componentX / _distance;
            var _normalY:Number = _componentY / _distance;

            ball.x += _normalX * _penetration;
            ball.y += _normalY * _penetration;
        }

sentences:
What is the name of perspective of Age of Empires II? One would describe Age of Empires 1's "perspective" as a 2D sprite game:

Below is a screenshot of Age of Empires II. How would you describe the "perspective"? Is it also a 2D sprite game?

"Perspective" may not even be the correct word. If it isn't, what should I use?

sentences:
I know that my super simple multiplayer setup is probably not a good idea, but why? I'm making a simple little MOBA just for fun. I was making everything single-player then I realized "oh crap I should probably add multiplayer, huh."

I've never done anything with networking before, so learning how to integrate Lidgren into my game was fun and awesome. The thing is, I pretty much know the way I'm doing things is wrong, because it's not robust enough for mainstream games to use, as far as I know, but what's wrong with it?

What I'm doing is, basically, whenever a player does an action, it sends a message to the server saying "hey, I just did this thing." The server and the client are both running the same simulation. The server then sends a message to all other clients telling them that that guy did that thing.

For the most part, except in a few cases, when a player does a thing, the client assumes it's cool and goes ahead with it on its own. So when you right-click somewhere to move there, that player's client just starts moving his guy there, and then sends a message to the server telling it about it.

So basically:

Player 1 casts a spell to make him move 100% faster for six seconds
Player 1's local client adds that buff to his Unit object
Player 1's client sends a message to the server saying "hey I just cast this spell"
The server makes sure he really did have enough mana to cast that spell, and if so, adds that buff to the server's copy of that Unit object
The server sends a message to all other clients saying "hey this guy just cast this spell"
Every other client receives the message and goes "ah okay cool," and adds that buff to their local Unit object for that player

I've been skimming through stuff to see how big games do multiplayer, and it's kind of confusing for someone who's just starting to dabble in this stuff, but it looks like the Source engine sends a packet containing all of the changes to everything in the world every tick? Again, totally new to this stuff, but can you really push that much data that frequently?

Sorry if this is a bit rambly, but basically, I was wondering why my simpler system isn't the right way to go, because if it was, other games would use it, right?

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:
Java: creating an instance of a user defined class by reading xml file I am trying to write an engine for a game, in particular a component-based one (in my approach components contain both data and logic). So basically I have entities, and each entity has a list of components (each component extends the Component class). Now, I want to be able to define templates for my entities in xml files, and load them at runtime. The template would look something like this:

<Entity>
   <Component name="MovementComponent">
      <...Variables to be initialized...>
   </Component>
   <Component name="RenderComponent">
      <...Animations...>
   </Component>
</Entity>

The "name" attribute is the name of the corresponding component class. Now, of course the components are game-specific so I need a way to create an instance of the component and add it to the entity's list without actually knowing the specific class. I thought about Class.forName("...the "name" attribute...").newInstance(), but this way I can't add the components to the list, since it is an ArrayList of Component and the program cannot know that the object returned by the method newInstance is actually a subclass of Component. Is there any simple way to do this?

sentences:
How do I implement "prewarming" in particle engines? How is prewarming in particle engines made?

I have a particle engine and need to support this, which is a feature I have already seen in Unity.

Is it done at compilation, like informations stored somewhere? or pre-processed at launch? or is there a way to simulate a particle system when it is created?

Considering it is time based, I don't see how I could for example simulate 15 seconds of life for a particle system without actually using 15 seconds

sentences:
Should Unity lifecycle methods be annotated with the UsedImplicitly attribute? Does annotating Unity lifecycle methods with the UsedImplicitly attribute improve the readability of your code?

For example:

public class Example : MonoBehaviour
{
    [UsedImplicitly]
    private void Awake()
    {
        DoSomething();
    }

    private void DoSomething()
    {
        // ...
    }
}

This blog post on "Structuring Your Unity MonoBehaviours" suggests this approach as a useful convention.

  Annotate any Unity lifecycle methods (Start, Awake, Update, OnDestroy
  etc.), event methods, and other functions that are implicitly (or
  automatically) invoked in your code with the [UsedImplicitly]
  attribute. This attribute, although included in the UnityEngine.dll,
  is used by ReSharper to disable code cleanup suggestions for methods
  that are seemingly unreferenced. It also helps to make the code easier
  to read for people who are newer to Unity and your codebase,
  especially for events that are referenced via the inspector.

(Note: I don't think ReSharper shows code-cleanup suggestions for seemingly unreferenced Unity lifecycle methods, so that might be outdated advice.)

I agree with the above post that it could be helpful for those newer to Unity. I also think it could be useful to label those Unity lifecycle functions that are not used as frequently as Awake, Start, and Update. But I am wondering if this is actually a good convention for "clean code", or if it's just noise that reduces readability.

sentences:
Why are god objects so common in game programming? This is a bit of a philosophical question. Excuse me if it's out of place here.

Most modern games developed in C++ use (or at least purport to use) an object-oriented approach. A common axiom of object-oriented design is that a class should have a single, self-evident responsibility. I think that's good advice: You should be able to look at a class definition, take in the list of member functions, and know what a class is designed to do. If your public interface has 50+ functions, you're probably doing something wrong.

Here is the list of public member functions declared in the player character class for Unreal's sample shooter game.

class AShooterCharacter : public ACharacter
{
    virtual void PostInitializeComponents() override;
    virtual void Tick(float DeltaSeconds) override;
    virtual void Destroyed() override;
    virtual void PawnClientRestart() override;
    virtual void PossessedBy(class AController* C) override;
    virtual void OnRep_PlayerState() override;
    void OnCameraUpdate(const FVector& CameraLocation, const FRotator& CameraRotation);
    FRotator GetAimOffsets() const;
    bool IsEnemyFor(AController* TestPC) const;
    void AddWeapon(class AShooterWeapon* Weapon);
    void RemoveWeapon(class AShooterWeapon* Weapon);
    class AShooterWeapon* FindWeapon(TSubclassOf<class AShooterWeapon> WeaponClass);
    void EquipWeapon(class AShooterWeapon* Weapon);
    void StartWeaponFire();
    void StopWeaponFire();
    bool CanFire() const;
    bool CanReload() const;
    void SetTargeting(bool bNewTargeting);
    void SetRunning(bool bNewRunning, bool bToggle);
    virtual float PlayAnimMontage(class UAnimMontage* AnimMontage, float InPlayRate = 1.f, FName StartSectionName = NAME_None) override;
    virtual void StopAnimMontage(class UAnimMontage* AnimMontage) override;
    void StopAllAnimMontages();
    virtual void SetupPlayerInputComponent(class UInputComponent* InputComponent) override;
    void MoveForward(float Val);
    void MoveRight(float Val);
    void MoveUp(float Val);
    void TurnAtRate(float Val);
    void LookUpAtRate(float Val);
    void OnStartFire();
    void OnStopFire();
    void OnStartTargeting();
    void OnStopTargeting();
    void OnNextWeapon();
    void OnPrevWeapon();
    void OnReload();
    void OnStartJump();
    void OnStopJump();
    void OnStartRunning();
    void OnStartRunningToggle();
    void OnStopRunning();
    USkeletalMeshComponent* GetPawnMesh() const;
    class AShooterWeapon* GetWeapon() const;
    FName GetWeaponAttachPoint() const;
    int32 GetInventoryCount() const;
    class AShooterWeapon* GetInventoryWeapon(int32 index) const;
    float GetTargetingSpeedModifier() const;
    bool IsTargeting() const;
    bool IsFiring() const;
    float GetRunningSpeedModifier() const;
    bool IsRunning() const;
    virtual bool IsFirstPerson() const;
    int32 GetMaxHealth() const;
    bool IsAlive() const;
    float GetLowHealthPercentage() const;
    USkeletalMeshComponent* GetSpecifcPawnMesh(bool WantFirstPerson) const;
    void UpdateTeamColorsAllMIDs();
    virtual float TakeDamage(float Damage, struct FDamageEvent const& DamageEvent, class AController* EventInstigator, class AActor* DamageCauser) override;
    virtual void Suicide();
    virtual void KilledBy(class APawn* EventInstigator);
    virtual bool CanDie(float KillingDamage, FDamageEvent const& DamageEvent, AController* Killer, AActor* DamageCauser) const;
    virtual bool Die(float KillingDamage, struct FDamageEvent const& DamageEvent, class AController* Killer, class AActor* DamageCauser);
    virtual void FellOutOfWorld(const class UDamageType& dmgType) override;
    virtual void PreReplication( IRepChangedPropertyTracker & ChangedPropertyTracker ) override;
};

Why is this acceptable? Isn't there a better way?

sentences:
How to Change position + rotation of a parent while keeping X and Z Rotation Sooo this question is a problem , a evolution by another solution of this problem here:

How can I change the parents rotation so the childs rotation is looking at a specific direction

Basically:

We have a "Eye" (HTC Vive).
We have a "Parent" which is the Parent of "Eye".

We can not change the position or rotation of the Eye in code.
We can only change the position and rotation of the Parent.

1.We want to modify the Parent Position so that Eye to goes to a certain "Target 1" position.

2.We want to modify the Parent Y-Rotation so that the Eye looks at a certain  "Target 2" position.

3.While doing this we dont want to modify the Parent X or Z , because this would lead to a Rotated game experience.

The Parent Position changes so the Eye gets to "Target 1" position.
The Parent Position changes so Y- Rotation should look at Target 2 position
The Parent X/Z Rotation should not modify the Eye X/Z

sentences:
Loading TextureRegion with filter diff from that of texture it came from I am using libgdx .
While packing my texture atlas I have set the filter for mag and min to Nearest . But for just one region I wish to draw it with linear filter . Is it possible to have different filters for texture region than that of texture atlas it came from.

sentences:
Raycast will not hit generated box colliders at initialization In my map class I have an algorithm that is generating and merging box colliders together. These belong to the layer "Ground".

After that, in some places on my map I'm generating some new cubes on-the-fly, and some of these cubes I don't want to generate at all. So, I'm doing a raycast to determine if they should be added or not.

I'm doing these raycasts to check if the position they should be generated at have free space to the left and right. For both rays I'm checking if they hit a collider beloning to the layer "Ground".

But I don't get a hit at all!

I've tried to create two cubes in the editor and assign them to the layer "Ground". If I run the game then I get a hit between these two cubes. But I will never get a hit checking against my generated colliders.

I do this logic in the Start-method, is there any certain method in the life cycle when I can start to use my generated box colliders?

sentences:
"Compose PSM Master Package" doesn't do anything I made a game for PlayStation Mobile, and I'm ready to build the master for publishing.

Per the mastering instructions, I have filled out all the required information in app.xml, created app keys for this specific application, and built on Release.

And now that I click on "Compose PSM Master Package", the PSM Studio pretty much does nothing. I have .psdp and .pspp files in the Release folder, but I don't get a .psmp file for submission.

I think all my account information is okay, including bank account information.

I also tried deleting and recreating the app keys, but "Compose PSM Master Package" still refuses to do anything.

What am I missing? What kind of interaction should I expect from "Compose PSM Master Package"?

sentences:
Unreal 4 why does reducing scalability take so long to compile? I have almost nothing in my scene--in fact, I reduced my scalability settings from "High" to "Medium" before even loading my level layout--and doing this has crashed the program multiple times. It didn't crash this time, but it is telling me it is compiling over 5000 shaders (!) and my objects' materials are not showing up in the viewport.

1) that is a ton of shaders, what shaders are these? I only made like 8 shaders.

2) What is making this take so long? it is taking forever, over 10 minutes already.

3) Is this normal?

sentences: How to simulate random scope movement? I want to simulate that random and soft movement that lot of games got (like BF3) when you use the scope of a sniper gun, so the question is how to achieve that.

sentences:
timezone independant Date.now() for node.js game I have a game I'm working on using node.js and socket.io. The issue I'm having, is I'm trying to have it so that players execute whatever actions they inputed about 50ms in the future, giving everyone a chance to stay relatively in sync.

I've got frame-independant code running, which works well until a client has a different time than the server.

to predict when the client should act out movement code from the server, I use

Date.now() >= command.timeStamp

The issue I'm having is that the client isn't in the same timezone as the server, for instance someone I'm testing with is just one minute above/below my server time, resulting in commands being 900 milliseconds in the past or future, which is non-ideal.

Is there some way I can use a common timestamp across clients and server?

sentences:
How do you exactly implement a Semi-Implicit Euler type of movement in a 2D platformer? So I've been following along Sebastian Lague's 2D platformer tutorial, and to understand exactly how
the physics of how a jump is done, I dug into the subject and noticed a lot of people, from GafferonGames and Kyle Pittman, all mention using Semi-Implicit Euler in making an accurate jump.

Now my problem is: How do you exactly implement this type of integration scheme in a game?

Specifically a platformer. A comment on the tutorial I was following said that the code below uses the Explicit Euler type of integration. Though I'm not exactly sure myself on whether or not this is true; another tutorial I found on the topic, specifically Jorge Rodriguez's Math for Game Developers  uses the Semi-Implicit Euler integration to make a spaceship simulator, but the code used was C++ and I only have some limited C# and I was not able to fully understand parts of the code that went into implementing the integration.

  Specifically:

          auto v = [vn, gravity](Vector x, float h) -> Vector
            {
                return vn + gravity(x) * h;
            };

            auto a = [xn, gravity](Vector v, float h) -> Vector
            {
                return gravity(xn) + gravity(xn + v*h) * h;
            };

from what I understand, this function returns a Vector2, but I don't know if the auto = a [xn, gravity] is supposed to be about declaring a variable or what, or how the -> vector bit fits in the whole code.

All in all, I need help, I'm still pretty new to programming and general and these small nuances confuse me. Any help is greatly appreciated, Thank you.

This is the code for the Platformer Character controller I followed from Sebastian Lague.

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

[RequireComponent (typeof(EntityController2D))]
public class PlayerController : MonoBehaviour
{
    EntityController2D playerController;

    #region Y-Velocity Fields
    public float jumpDisplacementDeltaTime = 0.75f;
    public float jumpHeight = 6.0f;

    float gravity;
    float jumpVelocity;

    #endregion

    float moveSpeed = 6.0f;

    Vector2 velocity;

    public void Start()
    {
        playerController = GetComponent<EntityController2D>();

        gravity = -(2 * jumpHeight) / Mathf.Pow(jumpDisplacementDeltaTime, 2);
        jumpVelocity = Mathf.Abs(gravity) * jumpDisplacementDeltaTime;

        print ($"Gravity: {gravity}");
    }

    // Update is called once per frame

    public void Update()
    {
        Vector2 input = new Vector2(Input.GetAxisRaw("Horizontal"), Input.GetAxisRaw("Vertical"));

        if (playerController.collisions.below || playerController.collisions.above)
            {
            velocity.y = 0;
            }

        if (Input.GetKeyDown(KeyCode.Space) && playerController.collisions.below)
            {
            velocity.y = jumpVelocity;
            }

        velocity.x = input.x * moveSpeed;
        velocity.y += gravity * Time.deltaTime;
        playerController.Move(velocity * Time.deltaTime);
    }
}

sentences:
Casting a Matrix4 class to float* glUniformMatrix4fv(glGetUniformLocation(program, "projMatrix"), 1, false, (float*)&projMatrix);

projMatrix is a an object of type Matrix4 where the first variable declared is a float array. Does (float*)&projMatrix therefore somehow retrieve this array? What does the casting appear to be doing?

sentences: How image.ImageGrid() works? How to fix it? I understood what this method do (it cuts one spritesheet into a list of images), but I don't understood how it cuts. What height and weight for an image, it takes? I tried with few spritesheets png, and each time it cuts an image with part of the next image. Not correct.

sentences:
SAT Collisions: Resolving rotations Currently I have a working 2D SAT collision system with only boxes, but works with static rotations as well, leaving room for triangles. One of the issues I've been able to resolve was tunnelling, thanks to this thread's psuedocode that I got working for myself.

Problem is, this doesn't support moving rotations like a system using a minimum-translation-vector. If I rotate alongside the side of an object, the system will fail even if I'm not moving.

My first thought in solving this was to use the longest line you can draw in a square (that being the points on either side of a square) and comparing the length of that to whatever side on any axis, but even squares have different sizes on any given rotation projected onto an axis.

The system also doesn't work with multiple objects, because - while you can use the algorithm on a group of objects and find the shortest distance out of all of them - if I conserve my velocity relative to the colliding axis, diving into the crest of 2 objects means I will phase through one of them not beyond a 45 degree angle.

Is there an effective way to resolve collisions on rotations and groups of objects, while using this anti-tunnelling algorithm? I don't care if it's expensive, I'll take whatever you can think of.

sentences: which is more performant particles_system or animation_player let's say I wanna make an Aura+Thunder effect , I can achieve the result using the Particles System like this vid: https://www.youtube.com/watch?v=4eMZspcU5Is , or by using AnimationPlayer , but which is more performant if there will be like 15 instance of the Aura+Thunder effect + other effects?

sentences:
What Java library/framework for a game with Baldur's Gate like grapics? I really would like to create my own small rpg. It could probably look as simple like baldurs gate. So without fancy 3D stuff.

As language I want to use java (or scala, I thinking about it - the good thing is that all java libs would work with scala too, and there are a lot of java game libs) and I'm not sure what lib/framework should I choose. I thought about LWJGL or Slick2D. Because I wont use that much 3D, Slick2D would be the better choice? Or doesn't matter? Any ideas or suggestions? Thank you

sentences:
Is Unity's Random seeded automatically? I seem to recall Unity's Random is automatically seeded; checking the documentation it doesn't say it outright, but a certain interpretation of their words might seem to imply it.

  The seed is normally set from some arbitrary value like the system
  clock before the random number functions are used. This prevents the
  same run of values from occurring each time a game is played and thus
  avoids predictable gameplay. However, it is sometimes useful to
  produce the same run of pseudo-random values on demand by setting the
  seed yourself.

(emphasis added)

sentences:
Blender Object Appearing Gray when all Lights are Off I have an issue with Blender where, when I turn my only light off (a sun lamp) and render the image my object appears gray rather than black (and thus, not appear to the camera).  I can't figure out why this is happening.

Here's what I just did in my scene:

Added a new UV Sphere mesh (to make a total of two spheres), made it visible to the camera, turned off the sun lamp (by setting energy to 0), and rendered.  The result I obtained is below.

I discovered this when attempting to render the first sphere with a material/texture on it and it was too bright.  The material on the spheres (which are different) are very basic, there's no emit, diffuse and specular are at default values.  Could there be an issue with the way my camera is setup?  Thanks in advance!

sentences:
Can I output a text file on build with build details in it? We have an issue with organizing our builds. They get copied around and moved so much that it's hard to keep track of what is the newest.

I would like to output a simple text file to the build root (same level as exe) that contains info like the build date and time, platform, etc.

Is this possible from within Unity?  Right now we have no automated build process (CI/CD).

edit: I found onPreprocessBuild() but unfortunately one of our main projects still uses Unity 5.3.6f1, so this will not work. Is there an alternative?

sentences:
Blender 2.5 - Using a Bezier Circle to set Bezier Curve as the Bevel Object I'm trying to follow the tutorial found here.

Around 5:40 (ish) in the video, he adds a Bezier Circle. He then adds the existing Bezier Curve as the Bevel Object on the Circle. This makes the Curve go around the circle creating the 3D chess piece.

I'm trying to do the exact same thing, but it's not working. I am using Blender 2.5 however too. When I set my curve to be the Bevel Object of the Circle, my Bezier Circle is just becoming a larger gray disc of goo. I was expecting it to be a 3D chess pawn.

You can see a screenshot of what mine looks like:

Before Bevel Object is Placed

After Bevel Object is Placed

For the record, the name of my Bezier Curve is "BezierCurve" and the name of my Bezier Circle is "BezierCircle".

Thanks in advance,
Andy

UPDATE 1

I just added a plan unchanged Bezier Curve and unchanged Bezier Circle and performed the same steps and it does work. Something must be wrong with my Bezier Curve in that it isn't being projected correctly around the Circle.

UPDATE 2

Just realized that when I set the Bezier Curve handles to "Automatic" using the V shortcut (only for Blender 2.5), then my Circle no longer imitates the 3D curve. I need Automatic I think in order for the Bezier Curve to not be wavy. With Automatic, it does a slight curve directly from point to point. Thoughts?

sentences:
How many matrices do i need to represent a rectangular figure and translate it? I'm learning math at the moment and i can't really understand the purpose of the matrix.
Yes, i've watched several tutorials out there and reading the book but still confused.

Correct me if i'm wrong.
We need one matrix to represent one point(vertex) on the screen. So to represent a rectangular, we need 3 matrices. Right?

sentences:
Can I "Pre-rotate" VBOs while loading them in LWJGL? It is possible to flip VBOs horizontally and vertically by swapping around destination coordinates.

Is it possible to rotate an image by any angle, such as 45 degrees, using different destination coordinates when loading up a VBO?

I realise that rotating present VBOs can easily be done using a matrix uniform in your vertex shader, but I'm asking about pre-loaded (VBOs) rotations; the VBO that you load being permanently rotated by X degrees.

I am not looking for code but a conceptual method (or an explanation of why this isn't possible).

sentences:
How do game companies handle DLL resources? This question is based solely on curiosity. I have played a great many games on my PC over the years, and just now realized a trend across all games(most if not all). In the resources of the game, or in other words, next to the executable that runs the game, there are never DLL(Dynamic Link Library) binaries. This means that those games are created by statically linking to source files and dumping them all into the primary executable. I am certain that most of these game projects: Call of Duty, World of Warcraft, Splinter Cell, and [Include other arbitrary examples here], are utterly massive by scale and have hundreds of smaller children projects. I would probably not be wrong, either, in assuming that those same projects(such as API's, etc) could be packaged into a DLL instead of the obvious static linking. I apologize if it seems like I am rambling, but there is a point to this; it will be coming up soon. Next, I wanted to address the use of the games graphics API. Most games use DirectX, why is not relevant to this question; instead, it is how. Would I be safe to assume that said games are also statically linking to DirectX? And more importantly, why? Is there a logistical reasoning behind this inherently-conventional trait? Do game companies statically link all of their resources? And just again, why? Why not use DLLs instead?

Hopefully someone can answer this question, having been present or currently are present, working for an actual game company. Oh and I typed this all on my phone so I apologize for any errors.

sentences:
Is there a material format for OpenCTM files? I consider using OpenCTM files for my game. Since the format only claims to store raw mesh data, my question is if there is a associated file format for material data and paths to texture maps.

For example material of .obj meshes are stored in .mtl files. Is there such a format for OpenCTM, too?

sentences:
Is it legal to sell or monetize games created with the Unity 3D free edition? Is it okay to use Unity 3D programming and gaming software to create mobile game apps for Android and iOS? I am using a free version of Unity 3D and planning it to sell my current game app I've created by publishing it to Google Play. I also use this method for earning money by setting as a free app with ads on it.

I saw some developers relied on using free version of Unity 3D to create games and published it via App Store or Google Play. If it does, should I have to pay or share contribution to the Unity development team for earnings since I use the free version in order to rely for producing several game apps for business?

sentences:
XNA 4.0, FBX and Texture Loading Failures I've been going through several tutorials on how to use XNA and understand a lot thus far.  I've got a screen, I've got 2D sprites working, got a shader system operational, so far so good.  Now I've hit a wall.

I'm attempting to load a 3D model (FBX Format) I've exported from 3DS.  My issue, is the texture system.  First, I'm trying to avoid embedding the textures directly into the FBX as I'll be reusing a lot of the textures for different things, no need to load multiple copies of the same texture.  I know my texture, even though not embedded, is making it to my XNA classes because I can see it inside the FBX (when saved as ASCII) and get a compiler error if I attempt to move the texture out of its original location.  I can also see it compiling the image during a rebuild.

However, if I attempt to render the object, no texture.  Loading code:

protected override void LoadContent()
{
    objModel = LoadModel("Models/OriginModel");
}

objModel is defined as a Model higher up in the cs file.

My display code:

foreach (ModelMesh mesh in objModel.Meshes)
{
    foreach (Effect currentEffect in mesh.Effects)
    {
        currentEffect.CurrentTechnique = currentEffect.Techniques["TextureNormalMap"];
        currentEffect.Parameters["World"].SetValue(objTransforms[mesh.ParentBone.Index] * worldMatrix);
        currentEffect.Parameters["View"].SetValue(viewMatrix);
        currentEffect.Parameters["Projection"].SetValue(projectionMatrix);
    }
}

I've stripped out the matrix transforms and such as they're not causing the issue.  TextureNormalMap is my shader I've written that displays a texture with a normal map.  This generates a black model.  If I however add...

metalTex = Content.Load<Texture2D>("Textures/brushedmetaltexture");

and

currentEffect.Parameters["ColorMap"].SetValue(metalTex);

where needed, I get the texture to display.  This is of course, the problem.  I have to include the texture in my Content system, causing the image to be compiled twice (which generates a warning..compiled once from the FBX, compiled once from Content).  More importantly, I would have to hand-texture all the models again inside the XNA system in order to get them to display, which is what I'm trying to avoid.  I've already textured them once in 3DS, do I really need to specify, inside XNA during object load, all the textures again?

So, any ideas on what I'm doing wrong here?  What magical step am I skipping?  Am I supposed to, somehow, figure out what the texture name is from the FBX file itself and get a pointer to the extracted image to feed into my Texture2D?  Is there a different object I should use that includes the texture from the FBX?  Do I need to bite the bullet and just go with embedding (which still doesn't work with the above code btw)?

I've been going off of tutorials as I mentioned, but this step seems to be missing, or am I just being daft?  I apologize if this seems trivial, but I just can't solve it.  Is there some step in the object loading process I'm missing?

sentences:
Getting an angle in degrees from north This may have been asked already, but I was unable to find it, because I don't really know what I'm looking for. I drew a picture:

I need theta. I've seen various solutions using Vector.Dot, and Math.Atan2, but they don't seem to work...

BTW, I need the output in degrees. On previous tries, I ran my results through MathHelper.ToDegrees(), but got values over 360, which shouldn't be possible.

This is my current code:

    Vector2 mouse = new Vector2(Mouse.GetState().X, Mouse.GetState().Y);
    Vector2 delta = mouse - Position;
    angle = Math.Atan2(delta.X, -delta.Y);
    angle = MathHelper.ToDegrees((float)angle);

EDIT: A little more info. I'm making a 2D game, and need the angle to 'rotate' one of  my sprites (simply changing which sprite I'm displaying). The code for how I'm doing this is below.

public static Direction GetDirection(double radians)
        {
            if (radians > GetRadians(Direction.Up).Lower && radians < GetRadians(Direction.Up).Upper)
            {
                return Direction.Up;
            }
            else if (radians > GetRadians(Direction.UpRight).Lower && radians < GetRadians(Direction.UpRight).Upper)
            {
                return Direction.UpRight;
            }
            else if (radians > GetRadians(Direction.Right).Lower && radians < GetRadians(Direction.Right).Upper)
            {
                return Direction.Right;
            }
            else if (radians > GetRadians(Direction.DownRight).Lower && radians < GetRadians(Direction.DownRight).Upper)
            {
                return Direction.DownRight;
            }
            else if (radians > GetRadians(Direction.Down).Lower && radians < GetRadians(Direction.Down).Upper)
            {
                return Direction.Down;
            }
            else if (radians > GetRadians(Direction.DownLeft).Lower && radians < GetRadians(Direction.DownLeft).Upper)
            {
                return Direction.DownLeft;
            }
            else if (radians > GetRadians(Direction.Left).Lower && radians < GetRadians(Direction.Left).Upper)
            {
                return Direction.Left;
            }
            else
            {
                return Direction.UpLeft;
            }
        }
public static Radians GetRadians(Direction direction)
        {
            Radians r = new Radians(0,0);
            switch (direction)
            {
                case Direction.Up:
                    r = new Radians(15 * increment, increment);
                    break;

                case Direction.UpRight:
                    r = new Radians(1 * increment, 3 * increment);
                    break;

                case Direction.Right:
                    r = new Radians(3 * increment, 5 * increment);
                    break;

                case Direction.DownRight:
                    r = new Radians(5 * increment, 7 * increment);
                    break;

                case Direction.Down:
                    r = new Radians(7 * increment, 9 * increment);
                    break;

                case Direction.DownLeft:
                    r = new Radians(9 * increment, 11 * increment);
                    break;

                case Direction.Left:
                    r = new Radians(11 * increment, 13 * increment);
                    break;

                case Direction.UpLeft:
                    r = new Radians(13 * increment, 15 * increment);
                    break;
            }

            return r;
        }

sentences:
Not getting desired results with SSAO implementation After having implemented deferred rendering, I tried my luck with a SSAO implementation using this Tutorial. Unfortunately, I'm not getting anything that looks like SSAO, you can see my result below.

You can see there is some weird pattern forming and there is no occlusion shading where there needs to be (i.e. in between the objects and on the ground).  The shaders I implemented follow:

#VS
#version 330 core

uniform mat4 invProjMatrix;

layout(location = 0) in vec3 in_Position;
layout(location = 2) in vec2 in_TexCoord;

noperspective out vec2 pass_TexCoord;
smooth out vec3 viewRay;

void main(void){
    pass_TexCoord = in_TexCoord;
    viewRay = (invProjMatrix * vec4(in_Position, 1.0)).xyz;
    gl_Position = vec4(in_Position, 1.0);
}

#FS
#version 330 core

uniform sampler2D DepthMap;
uniform sampler2D NormalMap;
uniform sampler2D noise;

uniform vec2 projAB;
uniform ivec3 noiseScale_kernelSize;
uniform vec3 kernel[16];
uniform float RADIUS;
uniform mat4 projectionMatrix;

noperspective in vec2 pass_TexCoord;
smooth in vec3 viewRay;

layout(location = 0) out float out_AO;

vec3 CalcPosition(void){
    float depth = texture(DepthMap, pass_TexCoord).r;
    float linearDepth = projAB.y / (depth - projAB.x);
    vec3 ray = normalize(viewRay);
    ray = ray / ray.z;
    return linearDepth * ray;
}

mat3 CalcRMatrix(vec3 normal, vec2 texcoord){
    ivec2 noiseScale = noiseScale_kernelSize.xy;
    vec3 rvec = texture(noise, texcoord * noiseScale).xyz;
    vec3 tangent = normalize(rvec - normal * dot(rvec, normal));
    vec3 bitangent = cross(normal, tangent);

    return mat3(tangent, bitangent, normal);
}

void main(void){

    vec2 TexCoord = pass_TexCoord;
    vec3 Position = CalcPosition();
    vec3 Normal = normalize(texture(NormalMap, TexCoord).xyz);

    mat3 RotationMatrix = CalcRMatrix(Normal, TexCoord);

    int kernelSize = noiseScale_kernelSize.z;

    float occlusion = 0.0;

    for(int i = 0; i &lt kernelSize; i++){
        // Get sample position
        vec3 sample = RotationMatrix * kernel[i];
        sample = sample * RADIUS + Position;
        // Project and bias sample position to get its texture coordinates
        vec4 offset = projectionMatrix * vec4(sample, 1.0);
        offset.xy /= offset.w;
        offset.xy = offset.xy * 0.5 + 0.5;
        // Get sample depth
        float sample_depth = texture(DepthMap, offset.xy).r;
        float linearDepth = projAB.y / (sample_depth - projAB.x);
        if(abs(Position.z - linearDepth ) &lt RADIUS){
            occlusion += (linearDepth &lt= sample.z) ? 1.0 : 0.0;
        }
    }
    out_AO = 1.0 - (occlusion / kernelSize);
}

I draw a full screen quad and pass Depth and Normal textures. Normals are in RGBA16F with the alpha channel reserved for the AO factor in the blur pass. I store depth in a non linear Depth buffer (32F) and recover the linear depth using:

float linearDepth = projAB.y / (depth - projAB.x);

where projAB.y is calculated as:

and projAB.x as:

These are derived from the glm::perspective(gluperspective) matrix. z_n and z_f are the near and far clip distance.

As described in the link I posted on the top, the method creates samples in a hemisphere with higher distribution close to the center. It then uses random vectors from a texture to rotate the hemisphere randomly around the Z direction and finally orients it along the normal at the given pixel. Since the result is noisy, a blur pass follows the SSAO pass.

Anyway, my position reconstruction doesn't seem to be wrong since I also tried doing the same but with the position passed from a texture instead of being reconstructed.

I also tried playing with the Radius, noise texture size and number of samples and with different kinds of texture formats, with no luck. For some reason when changing the Radius, nothing changes.

Does anyone have any suggestions? What could be going wrong?

sentences:
Unity: Game objects in scene load incrementally and not at the same time I am using Unity in my Android app. When the app opens, I show the user data in the Unity scene. User data contains texts and images.

In order to load this data in the scene, I make a lot of
UnityPlayer.UnitySendMessage(GameObject,Function,Params)
calls to many C# scripts in Unity from Android. Each of these calls performs a specific task like loading an image, creating a text, applying the text font etc.

Problem is that the loading of this data right now looks incremental (if that's the right word). So the text is visible first and after a fraction of a second the image shows. Some text effects show later. This looks ugly.

How can I make all the UI elements load at the same time even if it takes some time? Is there a way to freeze the scene before each game object is ready to be drawn?

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:
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:
How to perform game object smoothing in multiplayer games We're developing an infrastructure to support multiplayer games for our game engine.

In simple terms, each client (player) engine sends some pieces of data regarding the relevant game objects at a given time interval.

On the receiving end, we step the incoming data to current time (to compensate for latency), followed by a smoothing step (which is the subject of this question).

I was wondering how smoothing should be performed ?

Currently the algorithm is similar to this:

Receive incoming state for an object (position, velocity, acceleration, rotation, custom data like visual properties, etc).
Calculate a diff between local object position and the position we have after previous prediction steps.
If diff doesn't exceed some threshold value, start a smoothing step:

Mark the object's CURRENT POSITION and the TARGET POSITION.
Linear interpolate between these values for 0.3 seconds.

I wonder if this scheme is any good, or if there is any other common implementation or algorithm that should be used?

(For example - should i only smooth out the position? or other values, such as speed, etc)

any help will be appreciated.

sentences: Can't export Blender model for use in jMonkeyEngine SDK I have a scene rendered in blender called "civ1.blend" which contains multiple materials (for example, I have one called "white"). I want to use this model in jMonkeyEngine, so I used the OGRE exporter to create .scene and .material files. This gives me, for example, a civ1.scene file and a white.material file.However, when I then try to import civ1.scene into the jMonkeyEngine SDK, I get an error along the lines of "Cannot find material file 'civ1.material'". Like I said, I have a white.material file, but I do not have a civ1.material file. Did anyone encounter this problem? How do I fix this?

sentences:
php multiplayer game - server&client model I'm working on a simple round&web-based multiplayer game. The idea of the game is very simple: The players get an array of audio files which they listen to and write the transcripts for in 5 minutes. the player who sends in the most right transcripts gets the most points. its fairly simple and i was able to implement it locally. at the moment i have the .php file which lets me do all this but only in single player. what i'm trying to say is that whenever a player logs him/herself in, the page is loaded anew. what i want to do is to start the game from the server everytime 3-5 players log themselves in, so that the players can play at the same time and their results can be compared at the end of the round.

the thing is, i don't know how to start with this session or server/client model for a multiplayer game. i have read that php isn't ideal for web based multiplayer games because real time data exchange could be problematic, but since that is not really the case here i don't think that should be a major problem. i googled my problem but i have failed to find a solution. any help or advice would be much appreciated. cheers.

edit: is a node.js server what i'm looking for here?

sentences:
How should I handle shared classes between the Game project and the Content Extension Library? I've been using XNA for a while but recently I've needed to write a content extension library which I haven't done before. I need to import a TextureAtlas class from a file that is exported by a tool I wrote. The output of my editor is a serialized XML file that contains a list of all StaticImages and Animations in the TextureAtlasFile class that its serialized from. In my solution I have the TextureAtlasContentLoader project which holds all of the classes that I will need for the texture atlas both in game and for loading the actual content. The importer deserializes the xml back to a TextureAtlasFile and the processor converts it to a TextureAtlas to return after it is loaded.

The problem is that I have no idea how to share the classes between the content extension project and the game project that will be using the TextureAtlas class. I've tried referencing the content extension project in the game project and that works fine to get me pass compiling but it throws a ContentLoadException exception when I call

textures = Game1.content.Load<TextureAtlas>("MainMenu");

saying

  Error loading "MainMenu". Cannot find type Client.Render.TextureAtlas,
  TextureAtlasContentLoader, Version=1.0.0.0, Culture=neutral, PublicKeyToken=null.

The only other clue to whats wrong I have is a warning while compiling that says/

  Warning   2   The referenced assembly
  "Microsoft.Xna.Framework.Content.Pipeline, Version=4.0.0.0, Culture=neutral,
  PublicKeyToken=842cf8be1de50553, processorArchitecture=x86" could not be resolved
  because it has a dependency on "Microsoft.Build.Framework, Version=4.0.0.0,
  Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a" which is not in the currently
  targeted framework ".NETFramework,Version=v4.0,Profile=Client". Please remove
  references to assemblies not in the targeted framework or consider retargeting your
  project.   Client

which leads me to believe I'm not supposed to reference it in the game project. So to summarize my question, how do I handle my TextureAtlas and TextureHandle class that both the content loader and the game project need without causing errors?

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:
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:
how to set volume of sound depending on the impulse a body receives in Libgdx / Box2d? I am trying to set the volume of a bouncing sound of a ball depending on how hard the ball hits something. so the harder the ball hits a wall or a ground the more loud the bounce sound.
I couldn't find anyway to get the impulse of a body other than the postSolve(Contact contact, ContactImpulse impulse)  method inContactListner class.
But i then realized that unlike the beginContact(Contact contact) method, postSolve(Contact contact, ContactImpulse impulse)  gets called repeatedly until the contact ends. so it repeatedly plays the bouncing sound making it sound stalked and buggy.
I cant use the beginContact(Contact contact) method because there is no way to get the impulse that the ball is receiving from this method. I tried to to use the velocity of the ball instead of impulse inside beginContact(Contact contact)but that didnt yield good results and found it very complicated as i had to consider both horizontal and vertical speeds.
so my question is how can I make the sound play only once if i am using the postSolve(Contact contact, ContactImpulse impulse)  method or is there any other solution to achieve what i am trying to do here?

sentences:
Speed after an angled collision? I can calculate the speed when there is no angle, but I can't calculate the speed when it is angle.

Physics paramaters:

Player Physics :
    radius : 15,
    bounce coefficient(coefficient of restitution) : 0.5,
    mass : 2
    damping : 0.96101

Ball Physics :
    radius : 8,
    bounce coefficient(coefficient of restitution) : 0.5,
    mass: 1,
    damping : 0.9902

Gif image(angled): haxball gif angled

Player speed on start: Vx: 5, Vy: 0

Ball speed on start: Vx: 0, Vy: 0

Player speed on collision: Vx: 3.4189778846153844, Vy: -0.9240480769230772

Ball speed on collision: Vx: 2.7721442307692317, Vy: 1.8480961538461544

The formula i use(this formula can calculate the speed when there is no angle):
Formula image: Formula image

V1 = (m1*u1*k1 + m2*u2*k2 + m2*C1*C2*(u2*k2 - u1*k1)) /(m1 + m2)
V2 = (m1*u1*k1 + m2*u2*k2 + m1*C1*C2*(u1*k1 - u2*k2)) /(m1 + m2)

C1 and C2 bounce coefficient of player and ball.

How can i do?

sentences:
Compressed vs Uncompressed Textures differences? What is the difference?

As far as i know, compressed textures would speed things up, because the PCIe bus has to transfer less amount of data, and the interconnect is the main latency issue with GPU's. For this i'm certain.

What i'm not sure of, and this is what i mainly want an answer to is, does the GPU decompress the textures on the fly, or does it display the uncompressed textures? In other words, is there any visual impact of using the compressed textures? The GPU decompresses them automatically? Does this vary with the compression algorithm used, or is it a GPU specific thing?

Thanks in advance.

sentences:
How to make walls opaque in PuzzleScript On the PuzzleScript home page, there is an example of an enemy (Eyeball) which, when you (Player) are directly in its line of sight, will move one square closer to you, using the rule

[ Eyeball | ... | Player ] -> [ > Eyeball | ... | Player ]

However, the Eyeball will walk towards Player even if it shouldn't be able to see you, for instance if there is a wall in the way. This is apparent in a level like

#########
#....O..#
#.......#
#########
#.......#
#..P....#
#########

where, if Player passes below Eyeball, Eyeball will move one square down.

How do I make it so that the enemy can't see me through walls?

Inserting no Wall into the rule above doesn't work, as that doesn't tell ... to only match wall-free tiles, but rather checks whether there is at least one non-wall tile between Eyeball and Player. And adding the rule

[ > Eyeball | ... | Wall | ... | Player ] -> [ Eyeball | ... | Wall | ... | Player ]

in an attempt to correct the movement doesn't work as two ellipses in a single match pattern isn't allowed.

sentences:
How can I create a stretchy, breakable pizza cheese material? I want to create realistic pizza and allow user interact with it.

What I want:

What I created:

I created model of the pizza (8 pieces) in Blender, then imported it into Unity. The piece of pizza looks very artificial, mostly because it is "rigid triangle".

How can I make the cheese stretch and break when the user moves a piece?

sentences:
Articles about a plot in an open world There are plenty of articles about open world game design and writing plots. But have you guys come across articles or blog entries about designing an engaging plot in an open world game? What i mean by this? In TES:Morrowind you're introduced to mechanics and are given the "main quest" within the first 5 minutes and then you're free to go, learn, kill, do whatever you want. I've spent hundreds of hours playing the game, but i have never got to doing the "main quest" and i'm sure alot of people are in the same situation, be it Morrowind, Oblivion or Skyrim. Maybe it's the power of TES games and a true testiment to how great RPGs they are, however for me, thinking as a designer, it seems like a massive design failure. Maybe it's the fact that there's no actual threat that needs to be dealt with, maybe it's that, amongs all the well designed and interesting quest within the game, the "main quest" just doesn't seem so interesting.

I've got a game idea in the back of my head, i want to create an action platformer, but the "level selection" would be open world style "dunegons" like you find in MMOs. This is a vague and undeveloped idea, so don't focus on it, i didn't give this design much thought, however an issue arose, i can't figure out, in general, how to make the player care about the open world aspect (f.e. dealing with roaming, pillaging parties, doing a gauntlet run to get some special armor, clearing a water source from enemies, etc.) while "forcing him" to finish the game, carrot-on-a-stick kind of way. There are "crazy" people who will go search everywhere between cutscenes in FF games, but i'm aiming at the general audience. I want to create  a subtle system for guiding people throughout the game to a goal, while giving them an option of gaining power any way they want. This may aswell be impossible, but it doesn't hurt to ask.

I'm looking for articles or musings on this matter. Not solutions (since there's no design document, no direct solutions matter at this point), just thoughts from other people, probably with other games as a reference.

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: Playing a video in AR using Vuforia and Unity 5 I am trying to play a video in augmented reality using Vuforia and Unity5. I followed a few videos but I am still not able to play it. Can anybody help? I get the "error texture icon" instead of the play icon.

sentences:
Unity3D multiple objects user rectangle selection I wish to allow the user to select multiple units by click and drag as most RTS do. The issue I have is that the tutorials are either in 2D or only use the transform.position such as this one.
Using the transform.position will work for most cases but will not allow the user to select easily as selecting the head or feet of a unit will not work in this instance. It also means I have to do an other script using raycasts for single click selections as it is almost impossible to get the single point of the transform.position with one click.
How can I do a proper rectangle selection for a 3D game? By looking at 3D RTS games I own, I noticed that they use a simplified hitbox (usually a cube or capsule).

sentences:
Glow with forward rendering without two passes/MRT? I am trying to implement controllable bloom. By controllable I mean bloom that can be requested even for non-bright pixels by adding the bloom value into a model's texture channel. To do this I need to somehow pass this value (the strength of the bloom for the current pixel) into the bloom post-processor. The most obvious choice would be storing it in the alpha channel, but I use alphablending for every model I draw so for me this is not an option. A quick and dirty solution is to use MRT, render to two textures and then recombine them into one which is a huge waste of memory and speed. Another solution could be to render the scene twice: once for the color and alpha components and second for the bloom components - that is the by-the-book method I find on every internet page. Even when rendering into a smaller RT this is still an overkill.

Another thing I thought about was using YCbCr encoding and then simply increasing Y to order bloom, but I always get a green-ish image after decoding (even if I encode-decode in the very same shader, line after line). Here is the encode-decode operations I did:

inline float3 RGBtoYCbCr(float3 color)
{
    float3 YCbCr;
    YCbCr.r = color.r*0.299f + color.g*0.587f + color.b*0.114f;
    YCbCr.g = 0.5f + (-color.r*0.168f - color.g*0.331f + color.b*0.5f);
    YCbCr.b = 0.5f + (color.r*0.5f - color.g*418 - color.b*0.081f);

    return YCbCr;
}

inline float3 YCbCrtoRGB(float3 color)
{
    float3 RGB;
    RGB.r = color.r+1.402*(color.b-0.5f);
    RGB.g = color.r-0.344*(color.g-0.5f)-0.714*(color.b-0.5f);
    RGB.b = color.r+1.772*(color.g-0.5f);

    return RGB;
}

float4 MainShader(...)
{
    ...
    output.COLOR.rgb = saturate(output.COLOR.rgb);

    output.COLOR.rgb = RGBtoYCbCr(output.COLOR.rgb);
    output.COLOR.rgb = YCbCrtoRGB(output.COLOR.rgb);
}

So I wanted to ask if anyone knows a way to do it in one pass without MRT and (if possible) by still rendering an HDR image?

sentences:
2D World Mouse Coordinates - Matrices I'm trying to get the world coordinates out of a mouse click. Currently I'm doing the following:

var invertedMatrix = mat4.create();
var viewMatrix = activeCamera.getMatrix();
mat4.invert(invertedMatrix, viewMatrix);

var worldCoord = Vector2.transformMat4(new Vector2(mouseX, mouseY), invertedMatrix);

But the values I'm getting are away off. The Y for instance, is between 0 (top of the screen) and 200.000+ on the bottom of the screen. Also, even if I move the camera, let's say 50 in the x axis, if I click in the same spot before and after, the value calculated is the same.

I'm using gl-matrix to generate and calculate the matrices. The used active camera transform was created by using the following instructions:

 mat4.ortho(this._matrix, -this.viewWidth / 2.0, this.viewWidth / 2.0, this.viewHeight / 2.0, -this.viewHeight / 2.0, 0.0, 1.0);
 mat4.translate(this._matrix, this._matrix, [-this.x, -this.y, 0]);

I've checked both the vector2 transform and matrix invert for any issues but there seems to be none which makes me believe it can be the ortho projection itself but I'm currently lacking the knowledge to understand the problem.

The transform calculation:

    return new Vector2(
       (mat[0] * vec2.x) + (mat[4] * vec2.y) + mat[12],
       (mat[1] * vec2.x) + (mat[5] * vec2.y) + mat[13]);

Any ideas? thanks!

sentences:
How to start an animation just once on an event in libGDX I am trying to show an explosion animation which i created using a few textureregions and created Animation missileblastAnimation from those textureregion like this -- >

 TextureRegion[] explosion = { explodemissile1, explodemissile2, explodemissile3, explodemissile4, explodemissile5,
                 explodemissile6, explodemissile7,explodemissile8, explodemissile9, explodemissile10, explodemissile11,
                 explodemissile12, explodemissile13, explodemissile14,explodemissile15, explodemissile16, explodemissile17,
                 explodemissile18};
        missileblastAnimation = new Animation(0.1f, explosion);
        missileblastAnimation.setPlayMode(Animation.NORMAL);

I have this following code in the render method -- >
Note:-  explosionstarted is set to true when missile hits the ground

  if(explosionstarted){//check if the missile hits the ground to start explosion animation
       batcher.draw(AssetLoader.missileblastAnimation.getKeyFrame(runTime),
                              100, 300-102, 50, 102);
      if(AssetLoader.missileblastAnimation.isAnimationFinished(runTime)){
     // i found that isAnimationFinished tells if animation is finished or not but i still cant understand the passing runTime thing
          explosionstarted = false; //reset the boolean to make the animation stop drawing
        }
    }

Problem is the animation is not playing as it should i.e sometimes it plays too much fast . sometimes it skips first few frames and jumps to ending frames.
What is the right way to do this?
Is there any other way i can check if the animation is completed ?

sentences:
How can I predict player-to-projectile collisions in Box2D? I'm making a real time shooting game with Box2D as the physics engine. The gameplay is mostly about trajectory, like Angry Birds. I want to make a slow motion effect and move camera to the player when he's killed, but the effect should start when the stone is still in the air, before the collision actually happens.

The magnitude of damage is only calculated at collision, based on impulse. Because it's a real-time game, the player must be able to move their character's physics body without lag.

How can I predict their death? Is it even possible? I could raycast, but what if another object moves to block its path?

sentences: How to make the Angry Birds "shot arch" dotted line? I am making a game that includes 2D projectile flight paths like that of Angry Birds. Angry Birds employs the notion that a previous shot is shown with a dotted line "arch" showing the player where that last shot went. I think recording that data is simple enough once a shot is fired, but in my game, I want to show it preemptively, ie: before the shot. How would I go about calculating this dotted line? The other caveat is I have wind in my game. How can you determine a projectile preemptively when wind will affect it too? This seems like a pretty tough problem. My wind right now just applies a constant force every step of animation in the direction of the wind flow. I'm using Box2D and AndEngine if it matters.

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:
What is Khronos EGL? I see that modern OpenGL related code uses EGL, i can't get good resources for this so i ask here:

what exactly is EGL ?
if a platform supports OpenGL ES 2.0+ or OpenGL 3.0+ i can presume that will support EGL too ?
when is convenient to use EGL and when it's not?

for what i can tell by now it's something similar to FreeGLUT to me, but looks much more portable and standardized.

sentences:
How to display custom UnityEvents in the editor? I recently stumbled upon the UnityEngine.Events.UnityEvent class, and it seemed pretty cool so I started using it in a project.

Then I decided that I wanted to add some parameters to the event using its generic variants, like so:

[System.Serializable]
public class BarkEvent<GameObject> : UnityEvent<GameObject> {}

public class MyOtherClass : MonoBehavior {
    public BarkEvent<GameObject> bark;
    // ... Other stuff ...
}

But now it doesn't show up in the editor, making it harder to wire up my subscribers. Is there a way to make unity events with extra arguments show up in the Unity editor?

sentences:
Quite conflicted on advice given to "learn programming" for game development I have been reading a few sources online that talk about learning programming with the end goal of game development in mind. I have heard many people saying that starting with Unity is the best way to go but others stating that C++ is what you need to get started with in order to be a game developer.

But as far as I'm concerned, this leaves me in quite a dilemma. Am I right in thinking that if I'm not overly fussed about making little indie games at the moment and just want to get stuck in with learning how to program, is C++ the right choice?

I have begun my journey with C++ and I am really enjoying it. I think it is the time further down the line that I am confused about. I am quite unsure on where to turn and what direction to go down to try and do this game development thing.

My end goal isn't necessarily working on an indie game project, I'd much rather aim to work at a gaming company which in my mind is a bit more realistic.

Thank you in advance.

sentences:
Grouping game objects I'm trying to create a simple turn based console (command line) game but I'm confused of what approach to use when creating classes for objects. My concern is maintainability and flexibility.

First Approach:

class Weapon{
    ...
}

class Sword:Weapon{
    ...
}

class ShortSword:Sword{
    ...
}

class TwoHandedSword:Sword{
    ...
}

class Axe:Weapon{
    ...
}

class HeavyAxe:Axe{
    ...
}

Second Approach:

class Sword{
    SwordType type;
    ...
}

class Axe{
    AxeType type;
    ...
}

So which is better, first or second? Why?

Important Note: I'm a beginner in game development.

sentences:
How can I make Maya export a mesh as double-sided? I'm exporting from Maya 2009 to OBJ.  The mesh I'm exporting has in it's Render Stats "Double Sided" checked, but when the polygon is exported, only a single side is actually exported.

What really needs to happen is for each polygon that is double sided, two polygons need to be exported, facing in opposite directions..

I can do this manually, but is there a way to make the OBJ exporter do it for me?

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:
GameObject.Find() can't find object after loading the scene I have 2 scenes in my project, MainMenu and Game.

MainMenu scene contains 2 buttons, 'Hide Black' and 'Hide White'. Game scene contains 2 panels, 'Black' and 'White'. When the user clicks any of button from main menu, I wanna hide the corresponding panel in Game scene and also load the scene. This is the script for the same.
using UnityEngine;
using UnityEngine.SceneManagement;

public class MainMenu : MonoBehaviour {
    public void HideBlack() {
        SceneManager.LoadScene(1);
        GameObject black = GameObject.Find("Black");
        black.SetActive(false);
    }

    public void HideWhite() {
        SceneManager.LoadScene(1);
        GameObject white = GameObject.Find("White");
        white.SetActive(false);
    }
}

But it turns out that GameObject.Find can't find the panels in my Game scene. I looked my forums for help but I find them confusing. What's going on here?
EDIT - This is not from my actual project. I created these scenes just to explain the problem better. I must use 2 scenes in my actual project as I have 3D objects in Game scenes.

sentences:
It is feasible to complete decouple a graphics engine from game logic? Is it possible, or even feasible, to have graphics engine completely decoupled from game logic?

Why I ask is because I want to start working on a game (I'm a complete beginner in game development, but I have 8+ years of programming under my belt), but there are more than a couple graphics engines out there to pick from. Also I do not anticipate my development speed will be very fast, so I would like to be able to swap out an old graphics engine for a new one if the old one becomes too out of date.

I want to work with OpenGL for possible cross platform compatibility, so that should at least reduce issues that may arise from supporting multiple graphics APIs.

sentences:
XNA Framework doesn't recognise controller So just a little bit of XNA code:

if (this.IsActive && (Keyboard.GetState().GetPressedKeys().Length > 0 || Mouse.GetState().LeftButton == ButtonState.Pressed || Mouse.GetState().RightButton == ButtonState.Pressed || Mouse.GetState().MiddleButton == ButtonState.Pressed) || GP_state.GetButton(8) == ButtonState.Pressed)
                    {
                        Current_GameState = GameStates.Game;
                            bg_music.Play();
                    }

If something is done --> Switch to a different game state.
Works with: Keyboard and Mouse, but not with the gamepad (which is new and it works with other games) So why does XNA not recognise it correctly??

EDIT: I do have a working solution and mark my own answer as soon as possible as right...

sentences: When to use AI prediction in a Fighting Game I am making a fighting game AI that can predict the player's next move using a N gram predictor. Once I have the prediction, when do I use it ? Do I wait till player makes a move and then use the prediction ? What about distance from the player ? How do I make the use of my prediction look realistic ?

sentences:
Spherical Area Lights do not match reference So I'm adding spherical area lights to my application, and comparing my results with mitsuba, I am getting some differences (left is my approach, right is mitsuba - a pathtraced reference):

What I am mainly noticing is that:

The specular is way too bright for roughness values over 0.5
The specular shape gets "flat" (Left-mine, Right-mitsuba, noise
caused by low sample count):

I am using the closest point approximation and the normalization term proposed in Real Shading in UE4, that is: (radius / (distance * 2.0) + alpha)²

I believe issue 1) could be an issue with my normalization term, however I think issue 2) might probably be an issue with the closest point approximation?

Is this kind of inaccuracy expected with the approximations I use, and if so, are there better approximations?

sentences:
What does the keyword "interface" mean in GLSL? interface vs_out
{
  vec3 get_color();
};

struct vs_out_impl : vs_out
{
  vec3 get_color()
  {

    return vec3(1,0,0);
  }
}

Where is this behavior defined? None of the specifications uses the keyword interface. It is generally reserved in version 460. I myself accidentally, at Visual Studio, discovered that this keyword is recognized, thought about it and remembered the Nvidia language C for graphics. It has the ability to create interfaces. I tried it and it worked! This code does not crash with compilation errors. It compiles fine. To check, instead of the diffuse color, I used the method vs_out_impl::get_color(), and the objects were painted red.

Where to see the specification of this functionality? On the Internet, a bunch of words interface and GLSL leads to articles on interface blocks, which is not the same.

sentences:
Unity ScrollRect many objects perfomance issue I have scrollrect setup and over 1000 objects to scroll through. Currently i'm Instantiating all the 1000 objects at once and notice fps drop. I'm using 2d mask and disbale pixel perfect. Both gave a perfomance boost, but i still Think the bottleneck is that i have 1000 objects already created on the scene. Instead create what is visible to the eye.

What can i do? I've looked into pools. But i dont know how i should use it in my case. Since the inventory is dynamic.

public void ShowInventory(PlayerObject player)
{
    for (int i = 0; i < inventory.GetContainerSize; i++)
    {
        Item item = inventory.GetContainer[i];
        Button itemButton = Instantiate(buttonPrefab, content);
        itemButton.GetComponent<InventorySlot>().SetInventorySlot(player, item, item.amount);
    }
}

sentences:
Graphic hardware texture formats shaders relational speed I'm interested to know, is there a direct correlation to the speed that a shader will run based on the bit depth of a texture upon which it is running. For example: If I have a 2 bit stencil texture and I'm accessing data from this, will the access time be 16 times *'FASTER' than accessing the data in a 32 bit texture or is it primarily used for the memory saving capabilities.

*[SEE EDIT]

sentences:
How do I get the id of an object that created a point in a path? I'm making a rollercoaster tycoon type game. As the title says, I need to get the id of an object that created a path point. These points are currently greated by the rail pieces. I need this because each rail type (down, up, corners, etc) decides how fast the cart is going to go. The cart follows a path, with points created when a new rail is created. Normally, I would just use instance_place, but since the coaster has multiple levels (defined by z), I can't use this because some rails will overlap other. If you have any suggestions, I will be very grateful! For more information just ask and I will respond. Thank you for your time.

Here's a screenshot of the game for reference (the blue thing is the cart, the white numbers are the added or subtracted speed for that particular rail type):

sentences:
Can't get Direct3D11 depth buffer to work I can't get the depth buffer to work correctly.  I am rendering 2 cubes in a single Draw function, and from one angle it looks great

But swing the camera around to view the opposite sides, and I discover it's just Painter's Algorithm.

This is my code to setup the depth stencil buffer:

void Graphics::CreateDepthStencilBuffer(ID3D11Texture2D* backBuffer)
{
    D3D11_TEXTURE2D_DESC dsTextureDesc;
    backBuffer->GetDesc(&dsTextureDesc);
    dsTextureDesc.Format = DXGI_FORMAT_D24_UNORM_S8_UINT;
    dsTextureDesc.Usage = D3D11_USAGE_DEFAULT;
    dsTextureDesc.BindFlags = D3D11_BIND_DEPTH_STENCIL;
    dsTextureDesc.MipLevels = 1;
    dsTextureDesc.ArraySize = 1;
    dsTextureDesc.CPUAccessFlags = 0;
    dsTextureDesc.MiscFlags = 0;
    Microsoft::WRL::ComPtr<ID3D11Texture2D> dsBuffer;
    ASSERT_SUCCEEDED(g_Device->CreateTexture2D(&dsTextureDesc, NULL, dsBuffer.ReleaseAndGetAddressOf()));

    D3D11_DEPTH_STENCIL_DESC dsDesc;
    dsDesc.DepthEnable = true;
    dsDesc.DepthWriteMask = D3D11_DEPTH_WRITE_MASK_ALL;
    dsDesc.DepthFunc = D3D11_COMPARISON_LESS;
    ... snipped stencil properties ...
    ASSERT_SUCCEEDED(g_Device->CreateDepthStencilState(&dsDesc, g_DepthStencilState.GetAddressOf()));
    g_pDevCon->OMSetDepthStencilState(g_DepthStencilState.Get(), 1);

    D3D11_DEPTH_STENCIL_VIEW_DESC depthStencilViewDesc;
    depthStencilViewDesc.Format = dsTextureDesc.Format;
    depthStencilViewDesc.ViewDimension = D3D11_DSV_DIMENSION_TEXTURE2D;
    depthStencilViewDesc.Texture2D.MipSlice = 0;
    ASSERT_SUCCEEDED(g_Device->CreateDepthStencilView(dsBuffer.Get(), &depthStencilViewDesc, g_depthStencilView.GetAddressOf()));
}

And I'm calling g_pDevCon->OMSetRenderTargets(1, g_renderTargetView.GetAddressOf(), g_depthStencilView.Get()); after every Present call.

I've been scratching my head for ages wondering what the problem is.  Any clues will be much appreciated!

Edit:
I used the graphics debugger, and apparently the output merger is doing its job, as seen in the screenshot below, but that isn't what I am seeing on screen.
At the top of the pic is the state of the depth buffer, but I can't make sense of it to determine if it's correct or not.

sentences:
Kryonet usage for game networking Im making a game where real-time data is exchanged between server and clients, and I was using java UDP sockets straight up, but I reached a point where I actually need to know if a few specific packets do arrive or not, like RemoveObject, ChangeLevel etc. UDP alone isnt enough, I needed some reliability.

So i tried to implement a thin layer on top of UDP by following this great article: http://gafferongames.com/networking-for-game-programmers/

Still, although it's being great to learn low-level networking, its also very hard and I've grown tired, so i looked up for a good alternative and found Kryonet.

Kryonet is said to handle both UDP and TCP requests at the same time, by using two ports (although apparently a single port for both protocols can be used...).

My initial idea (which seems more logical for me) would be to send via UDP the packets with info about object state updates and other real-time dependent information, whilst using TCP for object creation, removal, state-changes or even eventually chat-messages.

Still, every example i saw until now only uses TCP even for real time games, which i find odd when every article i read about game networking strongly discourages such.

I also do not understand how UDP and TCP work at the same time since the article states:

  The problem is that since TCP and UDP are both built on top of IP, the
  underlying packets sent by each protocol will affect each other.
  Exactly how they affect each other is quite complicated and relates to
  how TCP performs reliability and flow control, but fundamentally you
  should remember that TCP tends to induce packet loss in UDP packets.

Please explain how is Kryonet supposed to be used on game networking and why it should be used in such way regarding common knowledge about both protocols.

sentences:
What is the correct way to seperate (react) view from state? I would like to know the correct implementation to declare game logic and view logic:

I see 3 ways of implementing this:

1.Storing (eg writing preprocessing to store the change to a property) property changes to data entities that are dispatched to listener(s) of the data entity. The main listener being the view, where the view contains the declared rendering logic (ie changing the entities animation based on a property change, changing the entities render object position).

  State Model (x,y,z,state) -> View (listens to change in
  x,y,z,state)->Scene graph object (x,y,z,animation, gets set by the View)

The issue with this is that it becomes evident that game engines are executing a lot of char[] switch statements (eg the names of properties) in the View.

2.Declaring the view as updating to the entirety of the model. Eg, instead of saving the changes as specified in 1) the view updates the render objects on every tick by inspecting the entire model, as opposed to the provided changes of 1). The tradeoff between 1 and 2 is the necessity of the additional execution of storing the property changes on the state tick.

3.Declaring animation logic in the state logic. Eg, instantiated member render objects are dummy objects when rendering is not performed.

The questions:

As specified in the title, what is the correct implementation to reacting to the game state  in the sense of where should one declare display/rendering/animation (view) logic that reacts to the game state?
What is the implementation used in most game engines that facilitate large projects? (if possible, please specify for specific engines: SupremeCommander/clones, SC2, Unreal, ID, Frostbite, Anvil)
Which implementation do studios implement to architect projects using said engines? It's apparent that it is possible to not seperate model from view in the above engines. Eg, if you implement an entity, you would presumably want it to be viable in multiplayer, coop, and single player.

The questions regarding other engines deals with the fact that perhaps it has been evaluated that it is not a sufficiently optimized implementation to consume the state in a View as opposed to executing direct calls to render objects.

So, on tick we update the game data simulation. For example:

  The state of a unit's weapon is updated to firing. However, updating
  the view of the weapon to firing (by for example, setting the animation of the weapon and animating the hand) is not necessary in all
  instances of the simulation.

sentences:
Why don't mmorpgs use bots? Bots in games can bad and usefull depending on the genre.

A lot of small games use bots to create a fake player base and illude the player that he is playing with real people.

The scariest thing is, that in most of these games you can't actually tell if you are playing with/against real people or bots and sometimes in shooter games bots can be way better than real people, not because they have more HP or more damage, they are not rpgs but shooter games.

And in chatting simulator games, where you actually speak to bots... Some are trashy but a few can get creative , these bots get to the point where they feel like real people... Or at least it means in my life I have encountered people that act like robots.

But there's only one genre of games where bots are not only useful but might be essential.

Rpg's

Why? Immersion.
What's the point of playing a game with an epic giant world twice the size of the real earth if the player base is a few millions (at best) ? You are gonna feel extremely lonely when exploring or you are not in a raid/battleground/dungeon.

most mmos I've explored tend to have really beautiful empy and soulless landscapes and cities... Entire cities with maybe only 30 npcs inside...

And npcs don't do anything, they are different from bots.

Bots try to replicate human behavior, they can talk with you help or try to kill you.

In some games as I have already said bots are created to make the illusion of multi-player but in mmorpgs you already know there are npcs and not every character you encounter is a person but limiting npcs to being statues that stand still in a city to sell you endless items is a waste of pure potential.

So why don't mmos use bots when lesser games can do it perfectly and make their bots seem real? What's the drawback?

sentences: When making 3D model for building, is it better to split it or combine it? As the title say, when making 3d model for building (example: school, office, etc). Used for FPS game so it must have detail and texture must be vary so it won't look like repeating/reused. Is it better to make the whole building as one model with multiple materials and UV map, or split it to sub model such as a wall, pillar, floor, etc. I want to know which is more practical or better for a game. I want to know why is it better, advantage and disadvantage of both, or if there's a better technique I can use.

sentences:
How to manage a multiplayer asynchronous environment in a game I'm working on a game where players can setup villages, which can contain defending units. Any of these units (each on their own tiles) can be set to "campaign" which means they are no longer defending but can now be used to attack other villages. And each unit on a tile can have up to a 100 health. So far so good. Oh and it's all asynchronous so even though the server will be aware that your village is being attacked, you won't be until the attack is over.

The issue I'm struggling with, is the following situation.

Let's say a unit on a tile is being attacked by a player from another village. The other player see's your village and is attacking your units. You don't know this is happening though, so you set your unit to campaign and off you go to attack another village, with the unit which itself is actually being attacked by this other player. The other player stops attacking your village and leaves your unit with say a health of 1, which is then saved to the server. You however have this same unit are attacking another village with it, but now you discover that even though it started off with a 100 health, now mysteriously it only has 1...

Solutions? Ideas?

Edit

The simplest solutions are often the best. I referred to Clash of clans below, well after a bit more digging it seems that in CoC you can only attack players that are offline! ha, that almost solves the problem. I say almost because there's still the situation where a players village could be in the process of being attacked when they come back online, still need to address that.

Edit 2

A solution to the "What happens when a player is attacking your village and you come online" issue, could be the attacking player just get's kicked out of the village at that point and just get's whatever they had won up to that point, it's a bit of a fudge but it might work.

sentences:
How can I divide a 3D mesh into small pieces? I'm considering a manufacturing game. A player should assemble parts of an object in given time. The object will be a 3D mesh model. I want to automatically split the 3D mesh into many small pieces to be provided to players. Each divided piece is needed to have area as similar as possible. And I want to control the number of pieces too within range about 2~6. How can I do this?

I know the method to modify a given mesh like adjusting values of vertices, indices. All I need is the algorithm.

sentences:
How can I update data saved using PlayerPrefs when there is a new version of my Unity3D game? I'm using PlayerPrefs to store the players' highscore on each level, but in the next version I'll change how scoring works.

For example, In the old version players could easily reach 250 points on a specific level, while in the new version it's difficult to reach even 50.

I would like to delete PlayerPrefs data which were saved during earlier versions, because scores that high would cause some issues in the newer version.
What is the best way to safely maintain compatibility of saved data between versions, but also be able to reset them if a new update requires it?
My current solution is that from now on I use new keys to store the data, for example by adding the current version to it.

For example, in version 2.0 the data that was originally saved with the key "score-Level8" would now be saved with "score-Level8-2.0".

This way the player's progression gets "reset" after an update, but the old saves remain until another game changer update comes, and I have to increase the version part of the key from 2.0 to 3.0.
This feels a bit error-prone and unprofessional.

sentences:
How to set widget size that is independent of screen resolution/density in kivy I had coded a simple click game with Python-kivy to android.

You should click dots which are popping out randomly at screen. I set their size 20px to 60px as your level. But it seems when I try on different device screen resolution change the hardness of game. low resolution phones have higher change. I also look at some game (2048 - piano tiles etc) they are also have the same problem.

Should I keep ignore the resolution or try to solve this problem? If so how?

sentences:
To Unity Rigidbody move like Character Controller on collision I want to a blue ball moving like a figure.

in CharacterController, it was possible.

but in Rigidbody, object was stucked.

help me.

sentences:
What controls the platform override codes in AudioClip (and maybe other Assets) .meta files? My game needs to use Unity 2019.3 for the console versions, and 2020.3 for the mobile ports.
The Console Project is the master project. Virtually any changes done to it are replicated to the Mobile project.
I would like to setup import overrides for Android (e.g. the compression quality for my soundtracks). To be consistent, I perform this change in my Console Project using the "Override for Android" checkbox (which affects the .meta file), and then replicate the change to the Mobile Project (a program checks for differences between both projects and applies most changes).
Ideally, the Mobile Project will now reflect the compression quality I want for said soundtracks, but it actually doesn't - in fact, the "Override for Android" checkbox does not appear to be checked in the Mobile Project, despite having a .meta file identical to the Console Project.
I digged into the .meta files, and noticed that when I use "Override for Android" in my Console Project, the .meta file adds an entry code 27:
  platformSettingOverrides:
    27:
      loadType: 2
      sampleRateSetting: 0
      sampleRateOverride: 44100
      compressionFormat: 1
      quality: 0.5
      conversionMode: 0

But, when I go to my Mobile Project and check the checkbox, it adds an entry coded 7:
  platformSettingOverrides:
    7:
      loadType: 2
      sampleRateSetting: 0
      sampleRateOverride: 44100
      compressionFormat: 1
      quality: 0.5
      conversionMode: 0

I don't understand this inconsistency. Does anyone have any insight on the exact conditions/rules Unity uses for the platform codes in the .meta files?
I can only think of a few dubious reasons:

Maybe they changed from 2019 to 2020.
My Console Project actually supports more platforms than the Mobile Project (the consoles, obviously), so maybe they "pushed" the Android code from 7 to 27.

It is not the end of the world; I could make a script that duplicates the settings of 27 into 7... But only if this behaviour is predictable or consistent. So my question is, what is Unity's logic behind the choice of these platform codes?
Note: so far I've only found this behaviour on AudioClip files. With Textures, I see that it actually uses the name of the platform in the .meta file, so the settings do work thankfully, but it is even more puzzling because now I don't understand why Textures and AudioClips use different conventions to begin with... What other Asset Type has numeric conventions?

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:
Container classes in tile-based games. I've recently begun working on a tile-based tactical game, and I have questions regarding a couple of key moments.

Is it feasible to organize the tilemap as an array of containers, which can hold the game objects? What are the pros and cons of such an approach? Should I make a single container class for all the game objects, such as characters, walls, and terrain, or try to break it down to separate container types for every single game object class?

Any examples of a container capable of storing objects of several different classes will be greatly appreciated.

sentences:
DirectX9 thread lock problem with "present" and background loading new textures Given:
Selfmade 3D engine based on DirectX9 written in C++

Task:
While render loop runs load additional textures in a background thread

Current Implementation:
- Create device with D3DCREATE_MULTITHREADED
- Ensure that loaded content is used by render thread only after loading finished

Problem:
Loading performance is very poor because DirectX calls block most of the time

More specific:
Seems that all DirectX calls are blocked for the whole duration the "Present" call waits for the vsync. That is in my case 99% of the time -> Loading thread has very few opportunities to run its DirectX calls.

Absurd observation (on first sight):
Loading performance gets much better when I deactivate vsync and the render tread runs full speed. That is because the relative portion of time the render thread is inside a DirectX function is lower.

Possible but problematic solution:
Do not let "Present" wait for the vsync, instead do a "while" loop with a non waiting "Present" and as long as it returns "D3DERR_WASSTILLDRAWING" do a short "Sleep".

But I do not like that solution:
First I am afraid it degrades maximum performance of the render loop as the resolution of "Sleep" time is limited.
Second problem is that I am using multihead rendering with several monitors and I am afraid taking away full control about vsyncing from DirectX might introduce effects like tearing on some monitors or something like that.

First question: Why?
I would bet my life that blocking whole DirectX while waiting for vsync is not neccessary especially while I am only using separated resources in the loading thread.
But, well, it is like Microsoft implemented it and I am afraid I have to deal with it.

Second question: Better ideas, anyone?
Does anybody have a better solution for this, or enough experience to tell me that my possible solution is not problematic at all or can think of a better way.

I know that Microsoft worked on these things with DirectX11 but porting the whole thing now is not an option, it would take too much time.

Thanks for your time,
Ole

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:
Player going out of boundaries So, I been following up the Space shooter tutorial on Unity, I had an issue where the project was acting up with an alpha version, so I was able to get a version that worked on a old release and applied all the new things I developed

But suddenly, my ship is acting up when getting closer to the boundary of its movement

This is the player movement code

public class playerMovement : MonoBehaviour
{
public float speed = 0.0f;
public float tilt;
public Boundary boundary;

void FixedUpdate ()
{
    float moveHorizontal = Input.GetAxis("Horizontal");
    float moveVertical = Input.GetAxis("Vertical");

    var movement = new Vector3(moveHorizontal, 0.0f, moveVertical);
    var rigidBody = GetComponent<Rigidbody>();
    rigidBody.velocity = movement * speed;

    rigidBody.position = new Vector3
        (
            Mathf.Clamp(rigidBody.position.x, boundary.xMin, boundary.xMax),
            0.0f,
            Mathf.Clamp(rigidBody.position.z, boundary.zMin, boundary.zMax)
        );

    rigidBody.rotation = Quaternion.Euler(0.0f, 0.0f, rigidBody.velocity.x * -tilt);
}

}

[System.Serializable]
public class Boundary
{
    public float xMin, xMax, zMin, zMax;
}

And this is the player boundary properties

It used to work previously moving forward to the alpha, now I'm working on 2019.2.0f1, but since working on the alpha this is the behaviour I'm having

As you can see, getting closer to the player boundary, takes the player out of the play area, and I can't determine why this might be happening.

I already tried removing the Math.Clamp, as I though there migth be bug with the function in this version, but even without it, the problem is present.

sentences:
How can I make the overlapping object's outlines merge and not display on top of other objects that have the outline shader? This is what I am trying to achieve. I was following https://www.youtube.com/watch?v=SlTkBe4YNbo but the outlines show on top of other if the objects overlap. I tried looking through various outline shaders but couldn't find much. I found that it has something to do with Z-Depth but I am not sure how.
My reason for doing this was to replicate the Unity Editor's object selection in the project. I somehow got the gizmo partially working(using a 2nd camera) and am now stuck on object highlighting on selection.

sentences:
How much info can I store in a cookie? Im developing a flash game and I'd like to know how much info can I store in a browser cookie.

The game is simple, but it needs to store several variables in order to save all the details of your current progress.

The game is only one swf file, no server, no nothing.

I need to know how should I use the cookies to achieve this, and if they have the posibility of doing it, of course.

(several = 200 variables i.e)

sentences:
Fair dice over network w/o trusted 3rd party Though it should be a pretty basic problem, I did not find a solution for it:
How to play dice over a network without a trusted third party?

The M players shall roll N dice, one player after another.
No player may "cheat", i.e. change the outcome to his advantage, or "look into the future" before the next roll.

Is that possible?

I guess the solution would be something like public key crypto,  where each player turns in an encrypted message. After all messages were collected you exchange the keys to decode the messages. Then the sha1(joined string of all decrypted messages) mod 6 + 1 is used to determine the die.

The major problem I have: since the message [c/s]hould be anything, I don't know how to prevent tampering with the private keys. Esp. the last player to turn in his key could easily cheat (I guess).

The game should even stay fair, if all players "conspire" against one player.

sentences: Working with Blender (Model individual objects or scenes?) I've been working in Unity for awhile but I'm pretty new to making my own models. I'm using Blender since it seems like a pretty good tool for the job. Let's say I am making a simple scene in Unity with a table that has a cup and plate on it and some chairs. Assume I want to be able to move each of these objects around independently from the other objects. Does this mean that when modeling in Blender, I have to model each object individually and import them separately in Unity? It would be nice sometimes to be able to model entire scenes in Blender, but if stuff in the scene isn't intended to be static, then there is no way to treat parts of these scene as objects and manipulate them individually in Unity right?

sentences:
How should I texture objects in Blender to use in Unity? I need to model some things to use in Unity. How should I texture objects (road, tree, etc.) in Blender?
I almost lost all textures when I exported and loaded them into Unity.

sentences:
Data oriented design in physics engine I am new to data oriented design and I am currently developing a physics engine as a hobby project. I am really interested in data orinted design but I am not sure how to apply data oriented design to my physics engine. I am using Box2D as a reference and when I look at the source code, erin catto use linked list as a container for rigid bodies. The reason why he use linked list over array is stated here. This is what he stated at the forum

  I could use an array of body pointers. That would have worse cache
  performance. First you have to get the array element, then the element
  data. I would also need some extra logic to ensure the array is big
  enough.

  I'm not sure how I would use an array of bodies. If I resize the
  array, the pointers become invalid. I could return an index when you
  create a body, but then the array would have holes as bodies are
  freed. Traversing the body array would then involve extra logic to see
  if the body is allocated or destroyed. Also, it may be cumbersome for
  users to have to use an index rather than the object itself. If I
  return the current body pointer from the index, there will likely be
  many bugs where users hold onto that pointer and it becomes invalid.

  Finally, when islands are created the set of bodies is likely no to be
  contiguous in memory.

I will add that when the physics engine do a broadphase collision detection, It will return a list of collider pairs that will most likely located randomly at memory. From what I understand, you need something like handle so the data can be moved around in memory. With handle, you only need to move the last object to the slot that holds the deleted object. Using handle over pointer will add an extra level of indirection which results in more cache misses. So is it really beneficial to store a set of rigid bodies or their components as array?

Edit: I believe there are parts of physics engine that benefit from storing rigid body using array. For example the integration phase. But I am not sure if the benefits outweight the disadvantages.

sentences:
How to get the actor to follow the mouse while clicking and holding? I am trying to do the top down project from scratch.

I can already get the actor to move toward the mouse click:

Only I need to keep clicking several times to change its path and keep walking indefinitely.

I would like to know how to keep it moving while I hold the mouse button.

In the previous version (4.21) this code below fit perfectly, so I managed to do that (the condition was a variable that only became false when I released the mouse button):

But now I can't make this connection (4.22).

I searched for some functions and even searched the new documentation for this loop (While Loop), but nothing worked.

Link (While Loop BP UE4):

https://docs.unrealengine.com/en-US/Engine/Blueprints/UserGuide/FlowControl/index.html#whileloop

Player Blueprint:

As I could do this before, you can see in the answer to this question:

How to make my character walk by clicking and holding the mouse button?

sentences:
Is there a common invitees/players ratio during closed beta? The question itself is fairly straight forward, but the answer takes a lot of industry insight.

To give an example scenario, I am playing a game that's in closed beta right now. They have about 5000 people invited and the game is only open from Fridays to Mondays. On average there are only about 200-400 players online at any given time, across EU and US. For a closed beta, this looks like a bit of a low turn-over if you ask me.

sentences: Should a beta version of an engine be used to start a new project? Is it advisable to use a beta version of unity(2019.3b) to make an actual complete project? What are the disadvantages?

sentences:
Unity: Set new Origin using empty GameObject You used to be able to set a GameObject with your Mesh as a child of an Empty GameObject. By rotating the Empty the Mesh would rotate around the position of the Empty. Now after the update it seems it's auto calculating a Median Point.

Here's the problem: https://www.youtube.com/watch?v=gxB_6c75oP0

I should be able to keep the original Origin of the empty GameObject no matter what children it gets. What happened to Unity?

This is how it used to be: https://answers.unity.com/questions/609267/how-to-change-the-origin-of-a-gameobject.html

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: Java Tile Collision Detection not accurate enough How can I make my isometric tile collision detection more accurate, I'm using the Rectangle class from java to detect collisions but because it's a rectangle it overlaps other rectangles which means clicking on a tile has a chance of selecting the tile next to it and I would like to know how to fix that.

sentences:
theoretical solution for "drawing" with mask So am trying to create a make-up game and i need to have a basic drawing solution,
and so far i have made a good progress with the help of the DepthMask solution
My approach was like this :
suppose we want to edit the eyelash color (texture)

1-in the beginning there is an eyelash object at a layer named old
2-after choosing the new color that we will draw with, a new game object is created under the first eyelash, which mean it's invisible for the moment
3-then when we start drawing, we are actually creating little circles above the old eye lash, these circles contain the depthMask shader which effect the old eyeLash and give the impression that we are drawing with the new color

So far, everything is going great, my problem is that i cannot use this approach to use a 3rd color, suppose the player want to create an eyelash with mixed color, how can i do that with the previous solution ? or is it impossible to do ?

EDIT: I already thought about adding new layers with each new color, and it works, but since unity is limited to 31 layers, this solution can never be a good one.

I really hope someone can answer this, and if you know a better way to do it then please don't hesitate to tell me.

EDIT2:
After a couple of hours, i've reached a pretty cool result, and i think that this can be the good way to reach my goal, this script allow to replace a specific pixel in a material texture with another chosen texture (target texture must be in the same size, and readable)

// the texture that i will paint with
public Texture2D targetTexture ;
//temporary texture
Texture2D tmpTexture;

void Start ()
{
        //setting temp texture width and height
        tmpTexture = new Texture2D (targetTexture.width, targetTexture.height);

        for (int y =0; y<tmpTexture.height; y++) {
                for (int x = 0; x<tmpTexture.width; x++) {
                        //filling the temporary texture with the target texture
                        tmpTexture.SetPixel (x, y, targetTexture.GetPixel (x, y));
                }
        }
        //Apply
        tmpTexture.Apply ();
        //change the object main texture
        renderer.material.mainTexture = tmpTexture;

}

Now i think that the problem will only be, "how to know which pixel i should replace based on mouse position over the object ?"

Thank you very much and have a great day.

sentences:
In XNA, should I use the built-in game component classes? I'm just getting started on an XNA game for Window Phone 7. For my Flash games I have my own framework that I was just going to port from AS3, but I have just found the built-in game component stuff in XNA. So should I use this stuff? Should my Entity class extend game component/drawable game component? I'm sure it will be quicker just to port my AS3 code, but I thought this built-in stuff may have some advantages?

UPDATE: I decided not to use them. It doesn't seem that they are meant to be used in the way I described.

sentences:
directx render order / alpha blend rendering I have a question about how to proper render 3d objects in a good order.
I use blend states to render some 3d models with a transparent texture.
This works but if there are multiple alpha objects in the scene it gets messed up because of the seemingly random render order.

Now I ask myself how should I do it?

The first theory I have in mind would be:
When I render something I actually don't render it, I just save it in some sort of queue and sort it later at the final end call (expensive because I have to allocate / deallocate memory a lot and sort).

But even with this theory I still dont know how I should sort them.
I cant just look how they are positioned because at some times they are kind of in each other so looking for these values would produce in wrong results.

I already guessed that i have to order in the way the camera is positioned or some way.

Hope you can help me

sentences:
Random number in a range, biased toward the low end of the range I have an input of two values, let's say 1 and 10.
Lesser numbers should overall occur more often in the output than higher numbers, while there is a peak in the probability at #2:

1: very common
2: extremely common
3: very common
4: common
5: somewhat common
...
10: extremely rare

How do I achieve this? My code until now looks like this:

function getValue($min, $max) {
    return random($min, $max);
}

sentences:
How can I make a shader effect that looks like a lightly shaded pencil drawing? I want to make a shader effect using OpenGL ES 2.0 that looks like this image:

I'm not sure if this image was painted or is the result of some filter, but I want to create a shader that produces images looking similar.
I want to know a Shader algoritm to produce this kind of output!

sentences:
BlitzMax - generating 2D neon glowing line effect to png file Originally asked on StackOverflow, but it became tumbleweed.

I'm looking to create a glowing line effect in BlitzMax, something like a Star Wars lightsaber or laserbeam. Doesn't have to be realtime, but just to TImage objects and then maybe saved to PNG for later use in animation. I'm happy to use 3D features, but it will be for use in a 2D game.

Since it will be on black/space background, my strategy is to draw a series of white blurred lines with color and high transparency, then eventually central lines less blurred and more white. What I want to draw is actually bezier curved lines. Drawing curved lines is easy enough, but I can't use the technique above to create a good laser/neon effect because it comes out looking very segmented. So, I think it may be better to use a blur effect/shader on what does render well, which is a 1-pixel bezier curve.

The problems I've been having are:

Applying a shader to just a certain area of the screen where lines are drawn. If there's a way to do draw lines to a texture and then blur that texture and save the png, that would be great to hear about. There's got to be a way to do this, but I just haven't gotten the right elements working together yet. Any help from someone familiar with this stuff would be greatly appreciated.
Using just 2D calls could be advantageous, simpler to understand and re-use.
It would be very nice to know how to save a PNG that preserves the transparency/alpha stuff.

p.s. I've reviewed this post (and many many others on the Blitz site), have samples working, and even developed my own 5x5 frag shaders. But, it's 3D and a scene-wide thing that doesn't seem to convert to 2D or just a certain area very well. I'd rather understand how to apply shading to a 2D scene, especially using the specifics of BlitzMax.

sentences:
How to animate material change to get a status bard effect, in unity Imagine a long cube, like a bar, that has a dark material, and you want to animate changing its material to a light material, but do it gradually from one end to the other, like filling up a tube, or like a progress bar that fills from one end to the other.
Is there a way to achieve this in Unity?
Or do you need to generate the animations in Blender or similar and control them in unity?

sentences:
Should I bother merging faces in my 3D block-based game? Okay, so I have a bunch of cubes in a 3d-world. I already implemented face culling, so that when a cube is next to another cube, their touching faces won't be drawn, or even sent to the buffer. However, a while back when I was still researching how to make a 3d block-based game, I came across a stack overflow question where the asker posted an image of their cubes, which had not only been culled but they had also merged the faces of adjacent cubes into larger rectangular faces. Like this:

My question is, should I do this? Will the drawing time be saved enough to justify the longer update time? And if so, I'm not even sure if it would work some of the time. The cubes aren't textured, they're coloured, so I'm not entirely sure if it would work with multiple colours of cubes.

sentences:
Best way make static GameObject clickable 2D I've built a turn based battle combat game (like pokemon) but i'm stuck between a rock and a hard place.

Asfar as i understod UI elements should be inside Canvas, while Players, Enemies, Items and etc... Should not be inside a canvas. Correct me if i'm wrong.

I've tried different ways how to handle this situation. Such as make Enemy as a button, but seems not to fire. Since i think it has to be inside a canvas. Also make enemy which have animations as button, may not be a good idea?

Update event, to check if the mouse is down and mouse position is converted with screentoworldpoint and see if the positions matches with the enemy position.

Update event, to check if the mouse is down and rayCast see if we colide with something. But i dont feel like this is neccesary since the enemy does not move. So the position is always the same.

Also if it's possible to take into consideration that every enemy is different size. But this is a minor detail, i would like firstly tackle the best way handle onClick event without the extra overhead.

I would appericate any feedback on my dilemma.

sentences:
Open GL polygons not displaying I have tried to follow nehe's opengl tutorial lesson 2. I use sfml for my window creation. The problem I have is that both the triangle and the quad don't show up on the screen:

#include <SFML/System.hpp>
#include <SFML/Window.hpp>
#include <iostream>

void processEvents(sf::Window *app);
void processInput(sf::Window *app, const sf::Input &input);

void renderCube(sf::Window *app, sf::Clock *clock);
void renderGlScene(sf::Window *app);

void init();

int main()  {
    sf::Window app(sf::VideoMode(800, 600, 32), "Nehe Lesson 2");

    app.UseVerticalSync(false);

    init();

    while (app.IsOpened())  {
        processEvents(&app);

        renderGlScene(&app);

        app.Display();
    }

    return EXIT_SUCCESS;
}

void init()  {
    glClearDepth(1.f);
    glClearColor(0.f, 0.f, 0.f, 0.f);

    // Enable z-buffer and read and write
    glEnable(GL_DEPTH_TEST);
    glDepthMask(GL_TRUE);

    // Setup a perpective projection
    glMatrixMode(GL_MODELVIEW);
    glLoadIdentity();
    gluPerspective(45.f, 1.f, 1.f, 500.f);

    glShadeModel(GL_SMOOTH);
}

void processEvents(sf::Window *app)  {
    sf::Event event;

    while (app->GetEvent(event))  {
        if (event.Type == sf::Event::Closed)  {
            app->Close();
        }

        if (event.Type == sf::Event::KeyPressed &&
            event.Key.Code == sf::Key::Escape)  {
            app->Close();
        }
    }
}

void renderGlScene(sf::Window *app)  {
    app->SetActive();

    glClear(GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT);  // Clear the screen and the depth buffer
    glLoadIdentity();                   // Reset the view

    glTranslatef(-1.5f, 0.0f, -6.0f);   // Move Left 1.5 units and into the screen 6.0

    glBegin(GL_TRIANGLES);
        glVertex3f( 0.0f, 1.0f, 0.0f);  // Top
        glVertex3f(-1.0,-1.0f, 0.0f);  // Bottom Left
        glVertex3f( 1.0f,-1.0f, 0.0f);  // Bottom Right
    glEnd();

    glTranslatef(3.0f, 0.0f, 0.0f);

    glBegin(GL_QUADS);  // Draw a quad
        glVertex3f(-1.0f, 1.0f, 0.0f);
        glVertex3f( 1.0f, 1.0f, 0.0f);
        glVertex3f( 1.0f,-1.0f, 0.0f);
        glVertex3f(-1.0f,-1.0f, 0.0f);
    glEnd();
}

I would greatly appreciate it if someone could help me resolve my issue.

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:
World Location issues with camera and particle I have a bit of a strange question, I am adapting the existing code base including the tile engine as per the book: XNA 4.0 Game Development by example by Kurt Jaegers, particularly the aspect that I am working on is the part about the 2D platformer in the last couple of chapters.

I am creating a platformer which has a scrolling screen (similar to an old school screen chase), I originally did not have any problems with this aspect as it is simply a case of updating the camera position on the X axis with game time, however I have since added a particle system to allow the players to fire weapons. This particle shot is updated via the world position, I have translated everything correctly in terms of the world position when the collisions are checked.

The crux of the problem is that the collisions only work once the screen is static, whilst the camera is moving to follow the player, the collisions are offset and are hitting blocks that are no longer there.

My collision for particles is as follows (There are two vertical and horizontal):

    protected override Vector2 horizontalCollisionTest(Vector2 moveAmount)
    {
        if (moveAmount.X == 0)
            return moveAmount;

        Rectangle afterMoveRect = CollisionRectangle;
        afterMoveRect.Offset((int)moveAmount.X, 0);
        Vector2 corner1, corner2;

        // new particle world alignment code.
        afterMoveRect = Camera.ScreenToWorld(afterMoveRect);
        // end.

        if (moveAmount.X < 0)
        {
            corner1 = new Vector2(afterMoveRect.Left,
                                  afterMoveRect.Top + 1);
            corner2 = new Vector2(afterMoveRect.Left,
                                  afterMoveRect.Bottom - 1);
        }
        else
        {
            corner1 = new Vector2(afterMoveRect.Right,
                                  afterMoveRect.Top + 1);
            corner2 = new Vector2(afterMoveRect.Right,
                                  afterMoveRect.Bottom - 1);
        }

        Vector2 mapCell1 = TileMap.GetCellByPixel(corner1);
        Vector2 mapCell2 = TileMap.GetCellByPixel(corner2);

        if (!TileMap.CellIsPassable(mapCell1) ||
            !TileMap.CellIsPassable(mapCell2))
        {
            moveAmount.X = 0;
            velocity.X = 0;
        }

        return moveAmount;
    }

And the camera is pretty much the same as the one in the book... with this added (as an early test).

    public static void Update(GameTime gameTime)
    {
        position.X += 1;
    }

sentences:
Initial setting of camera and ppu to match playing table My goal is to implement another board game as close as possible as I would play it on a table - to not much think about how to arrange elements. The used space on table is in the dimensions of around 1x2m and most of my assets are scans of game cards with a touch of Photoshop (for personal use only). My question is regarding the camera, pixel on import of asset and converting to units. There are no physics in the game involved and it is 2D. For now it will be tailored to my own mobile but I would like to know if one way is preferred if I wanted to later change resolution or is just better best practice. From my understanding it would result both in the same outcomes but there might be some hidden trouble or side effects.

Should I (convert for myself to get a feel for dimensions) take 1 unit as 10cm -> scene of 10x20 units would represent my table or rather have a 1x2 unit scene (since most take one unit as one meter)
Assuming my scanned card has something like 2000x1000 pixel (and is 10x5cm big on a real table), does it make more sense to have it imported as 2000/20000 under pixel per unit or downscale the image first before importing it with a lesser value? I don't really care currently about build/ asset size.

sentences: What is the best and simplest way to get input text from user in an OpenGL app? I have an OpenGL game and and I want to implement a simple way for the user to enter data/text in an input box. What is the easiest method to do this?

sentences:
How to achieve lighting like this in Unity for 2D games? How could I accomplish a lighting effect something similar to this game?:

I'm not talking about the shadows but about the glowing/lighting effect on the crystals and the torches.

Anyone got any clues?

More images from the games steam page

sentences:
Unity 2d - Vector3.Lerp Not Working as Expected I have asked this question on other community but still get no response after a month, so I decided to ask it here.

I am trying to put player position to the middle of camera when it is reaching near the edge of the camera. It works correctly with the following code:

transform.position = playerPosition;

where playerPosition is the current position of the player.

But, when I try it with Vector3.Lerp or Vector3.MoveTowards, it won't reach the player's x position.

Here is how it looks when using Lerp or MoveTowards

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

And here is when not using Lerp or MoveTowards

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

The script:

 public GameObject player;
 private Vector3 playerPosition;
 private Vector3 pos;
 public float offsetSmoothness;
 void Update () {
     // player's position relative to camera
     pos = Camera.main.WorldToViewportPoint(player.transform.position);
     playerPosition = new Vector3(player.transform.position.x,
                                    transform.position.y,
                                    transform.position.z);
     // if player reach the edge of the camera do the following
     if (pos.x < 0.1 || pos.x > 0.9)
     {
          transform.position = Vector3.Lerp (transform.position,
                                                playerPosition,
                                                offsetSmoothness * Time.deltaTime);
          // transform.position = playerPosition;
     }
 }

Why Vector3.Lerp is not positioning the player to the center of the camera when this condition is used to execute it: if (pos.x < 0.1 || pos.x > 0.9) ?

And how to make it working as expected, which is making the Vector.Lerp position the player to the center of camera when the player close to the edge of the camera?

sentences:
Game Asset Management I am making my first small mobile game in C# XNA. Lets say I have 3 screens, the main menu, options and game screen. A single game session usually lasts for 1 min, so the user will alternate frequently between the main menu and game screen. Therefore, once I load the textures for either screen, I want to keep them in memory to avoid frequent reloading. Both screens share some assets like their background textures, but differ in others.
The first solution I came up with is making 2 texture factory classes, MainScreenAssetFactory and GameScreenAssetFactory, each with their own content manager, and ill store them in a globally accessible point so that they persist after either screen is destroyed. There is also a OptionsScreenAssetFactory, but that I dont want to cache it since the options screen is rarely visited.

A typical Factory would look something like this

public class MainScreenAssetFactory
{
    private readonly ContentManager contentManager;

    public MainScreenAssetFactory(IServiceProvider serviceProvider, string rootDirectory)
    {
        contentManager = new ContentManager(serviceProvider) { RootDirectory = rootDirectory };
    }

    public Texture2D ListElementBackground
    {
        get { return contentManager.Load<Texture2D>("UserTab"); }
    }

    public Texture2D ListElementBulletPoint
    {
        get { return contentManager.Load<Texture2D>("TabIcon"); }
    }

    public Texture2D LoggedOutUser
    {
        get { return contentManager.Load<Texture2D>("LoggedOutUser"); }
    }
}

Since both Main, Options and Game Screen share some common resources, instead of loading them more than once, I created another class CommonAssetTexFactory which holds the common stuff and stays in-memory during the app lifetime. For example, this class gets passed to the options screen when it is created.

However, given my small game with its few assets, I am already finding this solution cumbersome and inflexible. Changing anything would require looking to see if its already in the common factory, and if not, modifying existing factories and so on. And this is just considering textures currently, i didnt add sound files yet. I cant imagine bigger games with thousands of resources using this approach. A better idea must exist. Would someone please enlighten me?

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:
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 to handle gun position while running and aiming in an FPS In an FPS, when a character runs, from the view of another character, the gun moves, and similarly when the character aims down sight.  Are the views from the third person and from the first person actually showing the same gun position?  I feel like it would be tricky to that happen and have it look natural from both perspectives.

sentences:
How to access SpriteBatch, Input, and ContentManager from all game screens? I'm trying to make a Game State Manager and I'm using the Microsoft Game State Management Sample as guidance. However, I want a more simplistic design (no transitions, reflection, or support for 360/Phone). Now, I am diverging a bit in to my own design.

I figure every single game screen is going to need access to the SpriteBatch, ContentManager, and Input. Input is a class I defined to detect key and mouse presses/releases/etc.

Currently I'm just using regular old dependency injection and just passing those three references in to the constructor of all newly created screens, but the code repetition is bugging me slightly.

Since all screens in my game are going to need to detect input, load content, and draw to the screen, I'd prefer a solution where I wouldn't have to cumbersomely pass and include these three objects in all new game screens. However, I'm not sure how exactly to do this.

I suppose the Game Screen Manager could maintain a reference to all of these objects, but then each game screen would have to maintain a reference to the game screen manager, which just sounds wrong. Also, they would have to be public properties on the game screen manager and I'm not sure I want to expose that much information to potential clients. Ideally, each game screen would not have to know about the game screen manager and would somehow have access to these three essential objects without requiring them in all of their constructors.

Any ideas? Thanks.

sentences:
Collision planes confusion I'm following this tutorial by thecplusplusguy and in the linked video he explain that for example for the world basement and walls we need to create the actual rendered (shown to the player) walls and then duplicate them, place them in the same coordinates as the rendered walls and call them collision (by defining their material to collision). Then it defines in the Object loader function that those objects with material == collision are collision planes and should not be rendered but just used to check collision.

Now I'm pretty confused. Why would we add this kind of complexity to a problem that can easily be solved by a simple loadObject(string plane_object, bool check_collision);:

Creating only the walls object (by loading .obj file in plane_object)
Define them also as collision planes whenever the check_collision is set to true

In this case we have lowered the complexity of his method and make it more flexible and faster to develop (faster because we don't always have to make a copy for each plane and flexible because we don't hardcode the Object loader). The only case in which this method could not work is when we need hidden collision planes, and for that we could modify the loadObject() function like this: loadObject(string plane_object, bool check_collision = true, bool hide_object = false);

Creating only the walls object (by loading .obj file in plane_object)
Define them also as collision planes whenever the check_collision is set to true
And add the ability to actually show the object or hide it based on hide_object.

The final question is: am I right? What would the possible problem encountered with my solution versus his?

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:
Cocos2d-x : Socket.io-client-cpp crashes after creating scene I'm using https://github.com/socketio/socket.io-client-cpp with cocos, because the built-in socket.io doesn't support callback (http://discuss.cocos2d-x.org/t/doesnt-work-with-socketio-2-0-1-and-failed-calling-back-with-old-version/37225/3)

Everything is fine, until i want to push new scene after receiving server signal
Here is my code

SocIO::SocIO() {

    // client object
    _client = new sio::client();
    _client->connect("ws://localhost:3000");
       ....
       _client->socket()->on("joinedRoom", bind(&SocIO::joinedRoom, this, placeholders::_1));
}

void SocIO::joinedRoom(sio::event &a)
{
    Scene* newScene = PlaygroundScene::createScene(1); // crash on this line
}

I don't know what happened here, didn't get this error with built-in socket.io.
Is it because of threading?

sentences: How to find a valid point if NavMeshObstacle is blocking path? Is there any way to find the closest valid point to my target if a NavMeshObstacle is blocking my agent's path? This point can be any point along the red line in the image above.

sentences: Learning to write a solitaire game Many years ago I did some programming in TurboPascal (on DOS!), but have not programmed since. Since retiring, I have "invented" a few solitaire games that I have given to people who sell solitaire collections. Recently I've invented a game that is different enough from existing solitaires that it does not "fit" into these collection packages. I would have no difficulty writing a simple program to do the job in TP, but that is no longer an option. I purchased BlitzPlus, but would like some help getting started. I hate the idea of reinventing the wheel; ie, learning from scratch how to shuffle decks, assign graphic files to cards in the program, etc, so, ideally, I'd like some basic source code from a very basic (ie, nothing fancy required) solitaire program, but, if necessary, would start from just tutorials on some of the procedures likely to be required. As I said, I've already purchased BlitzPlus, but would be willing to use some other language if that would be better or offer more tutorial assistance. Any help greatly appreciated.

sentences:
Does using the XNA Content Pipline eliminate the overhead caused by file IO when working with a large number of files? I'm working on a game in XNA with my goal being that it is fairly data driven so that I can easily tweak the system without having to update code. The research I've done shows that using XML files combined with the content pipeline should provide me with what I need to accomplish this.

That being said, being a developer that really has only been exposed to object oriented programming I have this "one class per file" mindset that I really like because it makes finding and updating what I want to change very easy. This leads me down a path of wanting to set up a system where instead of a large, heavily nested XML file that defines everything (like the web.config files I am used to), I want to go with a folder structure with files that define individual objects - or at the very least something in between. At this point in time I'm not entirely sure how many files I could end up having but I believe it could escalate to a point where it could cause a performance problem if done wrong and if I discover a performance problem because of it, redesign and consolidation of it all could be a big enough chore that I definitely want to try my best to make the right decision up front.

Usually I would see the above mentioned approach being a big performance hog because of the large amount of file IO that would have to be done when loading up the game. Based on my experience with images in the content pipeline, I am assuming that XML files are also combined into a single XNB file when compiled. From this my questions become:

If it is true that all XML files become a single XNB file should I still expect a notable performance loss when loading the data from these "files" or has that overhead disappeared since its all within a single XNB file?

If yes I am sure there tools out there that can make managing / updating a single and very large XML file more manageable which I will begin researching and am open to suggestions on.

sentences:
How should I organize 2D sprites? I'm using a Unity Tilemap in my 2D game, and I have several hundred 32x32 sprites.  Most of the examples I've seen using sprites have a few consolidated sprite sheets that contain all of the game's sprites.  For instance, I'd have a few 1024x1024 sprite sheets that contain all of my game's sprites.
 Those examples all say that the reason to do it this way is that performance is improved when sprites are packed together like that.

The problem with these large consolidated sprite sheets is that it's difficult to find the sprites that I want when I'm making a tile pallet or animated/scripted sprite.

For example, I have two 1024x1024 sprite sheets called "House Interior 1" and "House Interior 2" that contain all my walls, floors, furniture, doors, windows, and miscellaneous interior objects.  Now I want to create one Unity tile pallet that has only tiles for western-style houses and one tile pallet that has only tiles for eastern-style houses.  Each tile pallet is going to require some, but not all, sprites from both of my sprite sheets (House Interior 1 and House Interior 2).  Additionally, I want to create some animated tiles.  Each animated tile will use a few sprites from somewhere in the middle of one of the large sprite sheets.

My problem is that each sprite sheet image has so many child sprites that it becomes very tedious and time consuming to visually scan through each huge sprite sheet to find the tiles I want, and then drag each of them individually onto my tile pallet.  Making animated tiles results in the same problem because when I assign each animation frame, I have to find the correct sprite from a huge list of sprites that are named House Interior_1, House Interior_2, House Interior_3, and so on.

I'd like to have smaller sprite sheets that only contain one specific type of sprite, rather than huge sprite sheets of often unrelated sprites.  For example, I'd like to have one sprite sheet that has only masonry walls, one that has only brick walls, one that has only the animation frames of a fireplace, and so on.  That way it'll be easier to build up Unity tile pallets by dragging several sprite sheets into the tile pallet in the Inspector, and it'll be easier to find my animated tiles because I can easily find the sprites named Fireplace_1, Fireplace_2, and Fireplace_3.

So my questions are:

How big of a performance hit will I experience if I don't pack my tiles together into a few big spritesheets?  Is it even worth taking this into account considering modern devices are so powerful compared to what is necessary to do sprite-based graphics?
Is this a case of balancing the pros and cons of both methods, or is it generally strongly recommended that I large consolidated sprite sheets?

sentences:
Perlin noise terrain issue when scrolling I am generating a terrain in Javascript canvas using this js project for the Perlin noise. I have an array of points, and when one point leaves the left-hand-side of the window, it is removed, and a new point is added to the right.

For the first few points (before any point moves out of the LHS of the window), it works fine, but once I start removing points from the start of the array and adding them to the end the Perlin stops working.

JSFiddle

Does anyone know why this would happen?

sentences:
Deferred Rendering with SFML I've been looking to implement a deferred rendering system in SFML.

I've read the tutorials on OGLdev for it, and I was wondering how to draw a scene built in SFML (sprites, text, etc) to the multiple render targets needed for the deferred shading process.

Basically, I need to be able to get SFML to draw every object to the GBuffer's MRTs, so I can have the parameters needed to do what I want.

Is this possible, or will I have to build my own rendering backend from scratch?

sentences:
Implementing an Asset Lifecycle I'm currently developing a game using Kotlin and LibGDX. But this Question should be Framework/Engine agnostic. Given I have a Screen class like this:

class MyScreen: Screen {

    private val assetManager = AssetManager()

    private var anyTexture: Texture? = null

    override fun show() {
        assetManager.load("/.../anyTexture.png", Texture.class)
        anyTexture = assetManager.get("/.../anyTexture.png", Texture.class)
    }

    override fun render(delta: Float) {
        // do rendering
    }

    override fun dispose() {
        assetManager.unload("/.../anyTexture.png", Texture.class)
        anyTexture = null
    }
}

Every Screen I have manages it's own assets.
How would I achieve the same Lifecyle of my assets without using the nullable Type for every asset in the Screen? My Goal is just load all assets when the screen is loaded and then unload them when the game switches to another Screen. Has anybody got an idea for implementing this?

sentences:
How do I use virtual joysticks in Unity2d ()top view? I want to use virtual joysticks for character movement, in a top-down 2D game, that includes rotating the character.

I tried an Easy Joystick Unity Package, but it doesn't work properly, so what do I do?
Does anyone have a script (preferably in C#) that would use virtual joysticks to move a character?

sentences:
C++ MMO: Best approach to store creatures in a multi-level world map for the purpose to find spectators I'm developing a game which is a multi-level game, my game can have a maximum of 15 floors, and a fixed amount of tiles width/height.

Each tile in the map can have a creature. All fine until here;
I need to find spectators within a range / radius of the map, and sometimes within specified floor ranges, this can happen multiple times per second (players interacting with the world)

Currently this is how I search for lets say all spectators in all floors:

for (int floor = 0; floor != 15; floor++)
{
    for (int x = posx - range; x != posx + range; x++)
    {
        for (int y = posy - range; y != posy + range; y++)
        {
            Tile* ....
            Spectators.Add(Tile->GetCreature());
        }
    }
}

As you can tell, this isn't the best approach, I've thought about using a hash / chain of creatures on which each hash entry points to a X-Y coordinate in the world map, this would take a lot of trouble to worry about floors, and it's also more performance-friendly.

How can I achieve this?

sentences:
Where can I get a list or data base of light reflectance values for different materials? I'm implementing lighting for a WebGL app but I'm not an artist so I don't know how to generate or where to obtain a list of materials with its values (diffuse, specular, ambient and shininess). I've been searching a lot but with no luck.

Is there any list or DB I might have overlooked? Any common repository or something similar?

Thanks in advance.

Note: English is not my main language, let me know if you don't understand something and I'll try to rephrase it.

sentences:
Java how to rotate an image towards a certain point? Hello I have a game where a spaceship flies towards a different point every time I press a button. I am able to rotate the image but I don't know how to rotate the image to face the direction it is going. How can I make the image face towards the target area.
Heres my code:

public class ship {

    public boolean arrived,sel1,sel2;
    public int amountOfPop = 0;

    public int fc = -1,sc = -1,rot =5;
    private Image img;

    private Vector2 position;
    private Vector2 start;
    private Vector2 target;
    private Vector2 direction;

    private float speed ;

    private float distance;
    public boolean remove;

    public ship(Vector2 position, Vector2 target, float speed,int aop) {
        this.position = position;

        this.start = new Vector2(position.x, position.y);
        this.target = target;

        distance = Vector2.distance(start, target);
        direction = Vector2.direction(target.x - start.x, target.y - start.y);

        this.speed =speed;
        this.amountOfPop = aop;

    }

    public void tick(){

        start.x = position.x;
        start.y = position.y;

        if(play.ds.s1.p.get(play.ds.s1.secondclicked).moon == false){
        target = new Vector2((int)  play.ds.s1.p.get( play.ds.s1.secondclicked).x + 25, (int)  play.ds.s1.p.get( play.ds.s1.secondclicked).y + 25);
        }else{
            target = new Vector2((int)  play.ds.s1.p.get( play.ds.s1.secondclicked).x + 10, (int)  play.ds.s1.p.get( play.ds.s1.secondclicked).y + 10);

        }
        distance = Vector2.distance(start, target);
        direction = Vector2.direction(target.x - start.x, target.y - start.y);

        position.x += direction.x * speed;
        position.y += direction.y * speed;

        if (Vector2.distance(start, position) >= distance) {
                remove = true;
        }

        if(rot >= 360){
            rot = 0;
        }else{
            rot+=5;
        }

    }

    public void render(Graphics g){

        Graphics2D g2 = (Graphics2D) g;

        g.setColor(new Color(255,127,42));
        g.drawLine((int)start.x+7, (int)start.y+7, (int)target.x, (int)target.y);

        AffineTransform at = AffineTransform.getTranslateInstance((int)position.x,(int)position.y );
        at.rotate(Math.toRadians(),7,7);

        ImageIcon i121 = new ImageIcon("res/misc/circle4739.png");
        img = i121.getImage();
        g2.drawImage(img,at, null);

    }
}

sentences:
Write Data From List To CSV File I am trying to write to a CSV file the values that I put in lists from a key press in the keyboard. It does work somehow but in my csv file I get the values 2 times. Also, when I put values to only one of the lists, I don't get any data to CSV file. How can I save the values from the lists to my csv file but to be independent from each other? This is my code:

using UnityEngine;
using System.Collections;
using System.Collections.Generic;
using System.Text;
using System.IO;
using System;

public class record : MonoBehaviour
{

public List<string> inventory = new List<string>();
public List<string> OnlyX = new List<string>();

void Update()
{
    if (Input.GetKeyDown(KeyCode.F))
    {
        inventory.Add("F");
    }
    if (Input.GetKeyDown(KeyCode.J))
    {
        inventory.Add("J");
    }
    if (Input.GetKeyDown(KeyCode.X))
    {
        OnlyX.Add("X");
    }
    string filePath = getPath();
    StreamWriter writer = new StreamWriter(filePath);
    writer.WriteLine("Inventory,OnlyX");

    for (int i = 0; i < inventory.Count; ++i)
    {
        for (int j = 0; j < OnlyX.Count; ++j) {

            writer.WriteLine(inventory[i] + "," + OnlyX[j]);
        }
    }
    writer.Flush();
    writer.Close();
}
private string getPath()
{
 #if UNITY_EDITOR
    return Application.dataPath + "/Data/"  + "Saved_Inventory.csv";
 #elif UNITY_ANDROID
    return Application.persistentDataPath+"Saved_Inventory.csv";
 #elif UNITY_IPHONE
    return Application.persistentDataPath+"/"+"Saved_Inventory.csv";
 #else
    return Application.dataPath +"/"+"Saved_Inventory.csv";
 #endif
}
}

sentences:
Whats a good way to make realistic brick walls? This is a screencap from Blackops III:

I tried this using 5 maps including displace and normal, but it still looks too flat. I was wondering what a good method or workflow is to make walls actually look like theyre popping out, like what the steps are. For example, do people displace in their modeling software and import the mesh? I just want to hear the steps you guys of the community would take to produce this effect. Thanks.

My wall:

sentences: Cant set up to get input from second analog stick So I know for a fact that the stick on my gamepad is working. The problem is I cant set it up in the Input Manager. I tried all possible Axis configurations and still getting a input values of 0. Here is a screenshot of the configuration.

sentences:
How can I build Minecraft-style light propagation without recursive functions? This question is more about expanding on an answer posted for an old but similar question.

Part of the answer says this:

  You simply fill the sunlight from the top to the bottom, every layer
  is gathering light from neighbor voxels in the previous layer with
  attenuation. Very fast - single pass, no lists, no data structures, no
  recursion.

I actually am having an easier time understanding how you would flood fill light for point lights. But doing so for sunlight, in one pass with no recursions, I still can't understand how it is done step by step.

Specific questions I would like to know about this:

Do you compare lighting of neighbor voxels only to the 4 cardinal directions, or do you check the up and down neighbors too?

If you don't store data structures for the lighting algorithm, how do you check for voxels that are already visited?

If there was a diagram explaining a step by step process of a single-pass light propagation that would be helpful. It seems like it would be easier on performance than casting several rays from each voxel to see if it hits light.

sentences: Serialize classes in unity c# Is there some best practices to serialize objects to file on mobile devices in Unity using C#. I've tried to search it myself, but found only this link. However, it looks like here they are trying to cache AssetBundles. I'm new to Unity, but I have some experience in iOS (swift) development. Here we have opportunity to cache some objects(variables) in local storage, to avoid overusing network. So I wanted to create some static class (for example Storage), which caches variables to file permanently and return them by some key.

sentences: GameMaker child objects not inheriting layer structure Using Game Maker Studio 2. I have a parent room. When I create a child room to that parent, it inherits everything properly. But when I add a feature to the parent room, or simply rename the layer in the parent, the child does not inherit or update properly. But if I toggle 'inherit', now I get the original layer as well as the edited layer, when all I expect to see in the child object is the edited layer. This doesn't seem to be expected behavior, any idea what's up?

sentences:
How can people recognize what engine a game uses, based off its graphics? With many games, you can say "oh, that's the Unreal Engine, for sure", or "this was made with an upgraded Rockstar Advanced Engine". We can often recognize the engine used for a game just by looking at its graphics, disregarding user interface.

Why is this? All game engines use the same 3D rendering technology that we all use, and the different games usually have a distinct art style. What's left to recognize?

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:
Libgdx: How to draw the score on the top left? I want to keep the score visible on the top left corner of the screen. I have the score talking care of. I just want to display it.

Score: x

The comment on the accepted answer on Stackoverflow suggests that BitmapFontCache is the best way to do it, inside the render method.

BitmapFontCache.draw() doesn't accept strings, so I cannot pass
Score:
BitmapFontCache.draw(batch, x, Align.topLeft); doesn't work either.
Do I have to keep updating the score position?

EDIT

  game.batch.begin();
        cache.setText("Score: " + score, 500,500);
        cache.draw(game.batch);

.........

or even if I placed it outside batch.begin, if I place it directly in, I get

E/AndroidRuntime: FATAL EXCEPTION: GLThread 172645
                  Process: com.mygdx.game, PID: 16727
                  java.lang.NullPointerException: Attempt to invoke virtual method 'com.badlogic.gdx.graphics.g2d.GlyphLayout com.badlogic.gdx.graphics.g2d.BitmapFontCache.setText(java.lang.CharSequence, float, float)' on a null object reference
                      at com.mygdx.game.GameScreen.render(GameScreen.java:129)
                      at com.badlogic.gdx.Game.render(Game.java:46)
                      at com.mygdx.game.Gam.render(Gam.java:20)
                      at com.badlogic.gdx.backends.android.AndroidGraphics.onDrawFrame(AndroidGraphics.java:459)
                      at android.opengl.GLSurfaceView$GLThread.guardedRun(GLSurfaceView.java:1647)
                      at android.opengl.GLSurfaceView$GLThread.run(GLSurfaceView.java:1352)
E/AndroidGraphics: waiting for pause synchronization took too long; assuming deadlock and killing

Even if I remove score variable and put everything outside batch.begin but inside render I keep getting the same error.

 public void render(float delta) {
        cache.setText("Score: " + 12, 500,500);
        cache.draw(game.batch);

sentences:
Swift Spritekit: Create realistic driving sprite How would I go by creating a realistic driving experience?

I'm using iOS Swift 3 with SpriteKit using the functions applyForce to accelerate when I click the gas button and when braking I add friction to the physicsBody, also I can't seem to turn right, no idea on how to do it.

Right now for turning I'm splitting the screen using the left and right to turn but I'm using applyForce but its very bad because it turns when the car is stopped and in a very unrealistic way.

When I apply force its only to go up so if I do create a turning mechanism and I do a uturn the car will still go up.

Also side note: Multitouch doesn't work?

Any help? Thanks

override func didMove(to view: SKView) {

    // Multi Touch
    self.view?.isMultipleTouchEnabled = true

    car.carNode.position = CGPoint(x: 0, y: 0)
    car.carNode.physicsBody = SKPhysicsBody(rectangleOf: car.carNode.size)
    car.carNode.physicsBody?.affectedByGravity = false
    car.carNode.physicsBody?.angularDamping = 0.1
    car.carNode.physicsBody?.linearDamping = 0.1
    car.carNode.physicsBody?.friction = 0.1
    car.carNode.physicsBody?.mass = 1

    self.addChild(car.carNode)

    // HUD Display
    gas.gasButton.position = CGPoint(x: 300, y: -500)
    self.addChild(gas.gasButton)

    brake.brakeButton.position = CGPoint(x: 150, y: -500)
    self.addChild(brake.brakeButton)

}

override func update(_ currentTime: TimeInterval) {

if touching {

    car.carNode.physicsBody?.applyForce(CGVector(dx: 0, dy: 180))
  }
}

override func touchesBegan(_ touches: Set<UITouch>, with event: UIEvent?) {

for touch in touches {
    let location = touch.location(in: self)

    if location.x < self.frame.size.width / 2 {

        // Left side of the screen
        car.carNode.physicsBody?.applyForce(CGVector(dx: -100, dy: 0))

    } else {

        // Right side of the screen
        car.carNode.physicsBody?.applyForce(CGVector(dx: 100, dy: 0))
    }

    // Gas Button
    if (gas.gasButton.contains(location)) {

        touching = true
    }
        // Brake Button
    else if (brake.brakeButton.contains(location)) {

        car.carNode.physicsBody?.friction = 1
    }

  }
}

sentences:
Splitting a large number of FLAs into multiple gifs I currently have a large number (300 or so) FLAs that I wish to convert to GIFs for a HTML5 game I'm creating.

Each one of these FLAs contains multiple animations in the timeline, and they all have the same basic structure (Animation one in frames 1-25, animation 2 in frames 26-34, etc.)

Is there a way I could automate splitting them up and converting them into the GIFs?

I am on a Mac, but do have access to a Windows machine, so any solution will work, basically. I don't have the Windows version of Flash though, so that is annoying.

Thanks in advance, and if this the wrong StackExchange to ask in, then I apologise in advance.

sentences:
Unity3d Resources.LoadAll empty array In my resources folder structure I have myself a file, now in the unity editor this file is a Texture Type Sprite (2D and UI), now when I attempt to run this code in one of my scripts

var icons = Resources.LoadAll<Sprite>("Images/BuffIcons");

My icons variable is empty, now if I change the line above to

var icons = Resources.LoadAll("Images/BuffIcons");

It comes back with an array which has a Texture2D and then multiple Sprite objects. Now why can't I cast the objects to a Sprite?

Also just for your information the Sprite (2D and UI) is a Multiple sprite so this sprite in total has like 42 different sprites. It seems to me the sprite which holds all the other sprites is classed as a Texture2D and then all the sprites inside of the Texture2D are Sprites. How can I just tell the Resources.LoadAll to load the sprites?

Basically the same problem as this user http://answers.unity3d.com/questions/900990/assetdatabaseloadallassetsatpath-not-loading-asset.html however the answers provided don't work for me either :(

sentences:
My cube goes through side walls on android device I have a cube and it's on the ground and there are two walls (Plane) next to the ground.

Like in the image there is a ground and in side there is a wall.
Here is my code:

    void Update() {

      transform.Translate(userDirection * speed * 14f * Time.deltaTime);
    transform.Translate(mSpeed * Input.GetAxis("Horizontal") * 2 *  Time.deltaTime, 0f, mSpeed * Input.GetAxis("Vertical") * 2 *  Time.deltaTime);

    if (Input.touchCount == 0)
        return;
    Touch touch = Input.GetTouch(0);
    float originalY = transform.position.y;
    float cameraZ = Camera.main.WorldToScreenPoint(transform.position).z;

    if (touch.phase == TouchPhase.Moved || touch.phase == TouchPhase.Began) {
        Vector3 screenPoint = new Vector3(touch.position.x, touch.position.y, cameraZ);
        Vector3 worldPoint = Camera.main.ScreenToWorldPoint(screenPoint);
        worldPoint.y = originalY;
        transform.position = worldPoint;
    }
}

My cube goes through the side walls, but on laptop it works perfectly, and on android device my cube goes through the side walls. Can anyone please tell why is my cube is going through side walls?
Any help is appreciated!

sentences: How to display Textures, Buttons, Created with Unity's GUI (OnGUI()) to get displayed behind other objects in Scene I am making a game in which I am using OnGUI() to make Texture. I want this texture to display behind my Regular 3D objects like cube, spheres in the scene. I have tried and searched but I am unable to figure it out. Is this Possible?

sentences:
How do I enable and disable objects with a certain tag in C#? I have a script that is supposed to find every active object with a certain tag and on the push of a button enable and disable it's meshrenderer and collider. but the script only tries to enable and disable the previous on the object the script is attached to. what am i doing wrong and is there any feasible way to do this?

I've checked all tags, but the script keeps trying to reach this unrelated object. i even tried adding a mesh renderer and a colider. but nothing

here is the script:

private bool on = true;

public void Update()
{
    GameObject[] gameObjectArray = GameObject.FindGameObjectsWithTag("buildnode");

    if (Input.GetKeyDown("b"))
    {
        on = !on;
    }

    if (on == false)
    {
        foreach (GameObject go in GameObject.FindGameObjectsWithTag("buildnode"))
        {
            go.GetComponent<MeshRenderer>().enabled = false;
            go.GetComponent<Collider>().enabled = false;
        }
    }

    if (on==true)
    {
        foreach (GameObject go in GameObject.FindGameObjectsWithTag("buildnode"))
        {
            go.GetComponent<MeshRenderer>().enabled = true;
            go.GetComponent<Collider>().enabled = true;
        }
    }
}

Thank you and have a good day.

sentences:
Instantiate the same gameobject multiple times at once So i am trying to create code where by when I shoot, bullets will shoot out of my gun at the same time, from 3 different positions. If I do a singular instantiate, it works fine, like below:

   IEnumerator ShotgunCoolDown()
    {
        PistolGunEffect.SetActive(false);
        canShoot = true;
        yield return new WaitForSeconds(0.45f);
        GetComponent<AudioSource>().PlayOneShot(PistolGunSound);
        canShoot = false;
        StartCoroutine(COPlayOneShot("Fire"));
        RifleGunEffect.GetComponent<ParticleSystem>().Play();
        (Instantiate(PistolBullet, ShotgunPoint.transform.position, transform.root.rotation) as GameObject).GetComponent<BulletScript>().Activate();
        yield return new WaitForSeconds(0.25f);
    }

However if i add multiple instantiates with different positionings, it will spawn the bullet for a millisecond before disappearing:

     IEnumerator ShotgunCoolDown()
        {
            PistolGunEffect.SetActive(false);
            canShoot = true;
            yield return new WaitForSeconds(0.45f);
            GetComponent<AudioSource>().PlayOneShot(PistolGunSound);
            canShoot = false;
            StartCoroutine(COPlayOneShot("Fire"));
            RifleGunEffect.GetComponent<ParticleSystem>().Play();
            (Instantiate(PistolBullet, ShotgunPoint.transform.position, transform.root.rotation) as GameObject).GetComponent<BulletScript>().Activate();
            (Instantiate(PistolBullet, ShotgunPoint1.transform.position, transform.root.rotation) as GameObject).GetComponent<BulletScript>().Activate();
            (Instantiate(PistolBullet, ShotgunPoint2.transform.position, transform.root.rotation) as GameObject).GetComponent<BulletScript>().Activate();
yield return new WaitForSeconds(0.25f);
 }

Any ideas how to address this?

sentences:
How can I make smoother upwards/downwards controls in pygame? This is a loop I use to interpret key events in a python game.

# Event Loop
for event in pygame.event.get():
    if event.type == QUIT:
        pygame.quit()
        sys.exit()
    if event.type == pygame.KEYDOWN:
        if event.key == pygame.K_a:
            my_speed = -10;
        if event.key == pygame.K_d:
            my_speed = 10;
    if event.type == pygame.KEYUP:
        if event.key == pygame.K_a:
            my_speed = 0;
        if event.key == pygame.K_d:
            my_speed = 0;

The 'A' key represents up, while the 'D' key represents down. I use this loop within a larger drawing loop, that moves the sprite using this:

Paddle1.rect.y += my_speed;

I'm just making a simple pong game (as my first real code/non-gamemaker game) but there's a problem between moving upwards <=> downwards. Essentially, if I hold a button upwards (or downwards), and then press downwards (or upwards), now holding both buttons, the direction will change, which is a good thing. But if I then release the upward button, then the sprite will stop. It won't continue in the direction of my second input.

This kind of key pressing is actually common with WASD users, when changing directions quickly. Few people remember to let go of the first button before pressing the second. But my program doesn't accommodate the habit.

I think I understand the reason, which is that when I let go of my first key, the KEYUP event still triggers, setting the speed to 0. I need to make sure that if a key is released, it only sets the speed to 0 if another key isn't being pressed. But the interpreter will only go through one event at a time, I think, so I can't check if a key has been pressed if it's only interpreting the commands for a released key.

This is my dilemma. I want set the key controls so that a player doesn't have to press one button at a time to move upwards <=> downwards, making it smoother. How can I do that?

sentences:
C# store functions with parameters in a List I want to store functions with parameters in a List, so that I can call them at a later stage.

Let's say (this is rough code)

void Func1(int index)
{
   Debug.Log("Func1"+index)
}

void Func2(int index)
{
   Debug.Log("Func2"+index)
}
.
.
.

void Store(Func1(1))
{
  list.Add(Func1(1));
}

void Replay(int position)
{
  list[position](); // this calls the function with the parameter
}

sentences:
How do videogames store information offscreen? I'm trying to make a videogame from scratch, but I'm really new to this and keep running into basic issues. Most importantly, how do videogames store offscreen information? What I mean is, how does the program know what to display next onto the screen? Or even, if the player changes the environment, how does this change remain for the next time it loads onto the screen?

For example, in New Super Mario Bros, if you hit a ? block and then go off screen, and come back, it still remains hit. How is this information kept and then executed the next time the player loads the block? Why doesn't it just reset?

sentences:
Bullets Stop when Shooting Unity 2D using System.Collections;
using System.Collections.Generic;
using UnityEngine;

public class Makarov : MonoBehaviour
{
    public GameObject Bullet;

    public float BulletSpeed;

    public Transform ShootPoint;

    // Update is called once per frame
    void Update()
    {
        if(Input.GetMouseButtonDown(0))
        {
            shoot();
        }
    }

    void shoot()
    {
        GameObject BulletIns = Instantiate(Bullet, ShootPoint.position, ShootPoint.rotation);
        BulletIns.GetComponent<Rigidbody2D>().AddForce(BulletIns.transform.forward * BulletSpeed);
    }
}

When I shoot the bullets just stop right in front if the gun.
This is for a top down shooting.

sentences:
How to get Flare elements? Is it possible to get the elements or the textures of a Flare and to change them at runtime? If so, then how do I get them?

Pseudocode:

Flare flare = GetComponent<Flare>();
foreach (Element e in flare) {
    e.Size = 10;
    e.Color = Color.green;
}

Thanks in advance :)

sentences: Integrating a leader board with FaceBook? Think like how Bejeweled 2 does its Blitz mode where it connects to Facebook, pulls your friends names and their top scores for the week.  Are there any libraries, etc. that already help facilitate this process?  I would rather not re-invent the wheel if necessary.

sentences: How to add post process volume script in unity 2019? i have old unity 2018 project and imported standard character asset. The 3d player has this script : post process volume and post process layer. In 2018 i can add this component but not in 2019 . This component is not available in 2019. What is the replacement for this ? or how to achieve the same result for 2019 ?

sentences:
Using sky for indirect lighting - should I remove the sun? I'm attempting to achieve slightly more realistic ambient lighting in outdoor scenes using the sky cubemap.

When rendering an object, I first calculate the direct lighting contribution using standard phong diffuse and specular shading from each light source. In outdoor scenes, this is usually a directional light used to model light from the sun.

I then add in the indirect diffuse lighting contribution by sampling a high mip level of the sky cubemap at the normal to the surface. However, it recently occurred to me that, since my sky cubemaps contain the sun, I am actually including the contribution from the sun twice! I'm introducing a directional light to model the sun in the direct lighting stage, then introducing further lighting from the skybox itself.

My question is this: Should I modify my sky cubemaps so that they don't include the sun, or should I just remove the directional light instead?

sentences:
How to correclty play the sounds in a 3D enviornment? I'm currently working on an XNA game with C#. I've been looking into 3D Sounds recently as this is the next objective on my list. I've found several tutorials online and they don't work to the standards I'm after.

What I've found is that even when the player moves, the sounds don't or when the play looks around the sound doesn't change where it's being projected from in my earphones. (When I look at the sound source, I expect to hear it and in front of me, or if I have my left turned to it, then I expect to hear it on my left etc...)

My Code so far:

//Decleration
    private Cue cue;
    private AudioEmitter emitter = new AudioEmitter();
    private AudioListener listener = new AudioListener();
    private AudioEngine engine;
    private WaveBank waveBank;
    private SoundBank soundBank;
    private float angle = 0;

//load content
        engine = new AudioEngine("Content/music/footsteps/footsteps.xgs");
        waveBank = new WaveBank(engine, "Content/music/footsteps/Wave Bank.xwb");
        soundBank = new SoundBank(engine, "Content/music/footsteps/Sound Bank.xsb");

//update
                listener.Position = Vector3.Zero;
                emitter.Position = new Vector3(10, 10, 10);
                cue.Apply3D(listener, emitter);
                cue = soundBank.GetCue("pl_step1");
                cue.Apply3D(listener, emitter);
                cue.Play();

My code works fine in that the sounds are being played and I can hear them, they are just not realistic and so I'm asking if anyone could help me how I could make the sound move around so that it sounds like it does in real life. (If the source/emitter is on my left, the main sounds should be coming through my left earphone.)

sentences: Is there a standardized way for creating a 2D ball physics movement method? Is there a standardized method for creating a 2D ball physics movement like you can see on gif below?

sentences:
Remove bullets from sprite Group I'm having an issue with removing objects from a sprite Group.  What is happening is I have a bullet class and every time the user presses  the player shoots a bullet.  I have 'alive = bool' code and all works great so long as only one instance of bullet is in the list.  If multiple are in the list however only the last one gets removed.  Does anyone know how I can fix this?

elif event.key == pygame.K_SPACE:
                # Fire a bullet if the user clicks the mouse button
                bullet = Bullet()
                bullet.bullet = bullet
                # Set the bullet so it is where the player is
                bullet.rect.x = player.rect.x + 9
                bullet.rect.y = player.rect.y
                # Add the bullet to the lists
                bullet_list.add(bullet)
                all_sprites_list.add(bullet)
                print(len(bullet_list))

    if bullet.alive == False:
        bullet_list.remove(bullet)
        all_sprites_list.remove(bullet)

#In the class
# If the bullet goes off the screen remove it
    if self.rect.y < 200:
        self.alive = False

I have it set to 200 at the moment for testing purposes.

Any help or a better way of doing this would be very much appreciated.  Thank you in advance.

sentences:
Rotating Cannon's Mouth Toward Player I am trying to make my cannon mouth rotate towards player, but the rotation is messed up and up I don't know how to fix it.
class enemyshoot:
    def __init__(self,x,y,height,width,color):
    # [...............]
         self.look_at_pos = (x,y)

 def draw(self):
      # [............]
        self.rect = self.shootsright.get_rect(topleft = (self.x, self.y))

        dx = self.look_at_pos[0] - self.rect.centerx
        dy = self.look_at_pos[1] - self.rect.centery
        angle = (180/math.pi) * math.atan2(-dy, dx)
        self.image = pygame.transform.rotate(self.shootsright, angle)
        self.rect  = self.image.get_rect(center = self.rect.center)

    def lookAt( self, coordinate ):
        self.look_at_pos = coordinate

My full enemyshoot class
shotsright = pygame.image.load("canss.png")
class enemyshoot:
    def __init__(self,x,y,height,width,color):
        self.x = x
        self.y =y
        self.height = height
        self.width = width
        self.color = color
        self.health = 10
        self.hitbox = (self.x + -20, self.y + 30, 31, 57)
       #-------------------------------------------------------
        # Make a Reference Copy of the bitmap for later rotation
        self.shootsright = pygame.image.load("canss.png")
        self.shootsright = pygame.transform.scale(self.shootsright,(self.shootsright.get_width()-150,self.shootsright.get_height()-150))
        self.image    = self.shootsright
        self.rect     = self.image.get_rect()
        self.position = pygame.math.Vector2( (x, y) )
        self.isLookingAtPlayer = False
        self.look_at_pos = (x,y)
    def draw(self):
        self.rect.topleft = (self.x,self.y)
        window.blit(self.image, self.rect)
        self.rect = self.shootsright.get_rect(topleft = (self.x, self.y))

        dx = self.look_at_pos[0] - self.rect.centerx
        dy = self.look_at_pos[1] - self.rect.centery
        angle = (180/math.pi) * math.atan2(-dy, dx)
        self.image = pygame.transform.rotate(self.shootsright, angle)
        self.rect  = self.image.get_rect(center = self.rect.center)

        # ------------
        self.hits = (self.x + 20, self.y, 28,60)
        pygame.draw.rect(window, (255,0,0), (self.hitbox[0], self.hitbox[1] - 60, 100, 10)) # NEW
        pygame.draw.rect(window, (0,255,0), (self.hitbox[0], self.hitbox[1] - 60, 100 - (5 * (10 - self.health)), 10))
        self.hitbox = (self.x + 200, self.y + 200, 51, 65)
    def lookAt( self, coordinate ):
        self.look_at_pos = coordinate

black = (0,0,0)
enemyshooting = []
platformGroup = pygame.sprite.Group
platformList = []
level = ["                                                                                p               p           p                         p                        p        ",
         "                                       ",
         "                             ",
         "                                      ",
         "                                  ",
         "                           ",
         "                                      ",
         "                                      ",
         "                                    ",
         "                                   ",
         "                    ",]
for iy, row in enumerate(level):
    for ix, col in enumerate(row):
        if col == "p":
            new_platforms = enemyshoot(ix*10, iy*50, 10,10,(255,255,255))
            enemyshooting.append(new_platforms)

This is where the cannons rotate towards the player, wherever they are
        for enemyshoot in enemyshooting:
            if not enemyshoot.isLookingAtPlayer:
                enemyshoot.lookAt((playerman.x, playerman.y))

sentences:
Scalling down libgdx game to fit a smaller screen appears only the half of the stage? Hello I have made a game in 1280x720, but I want it to fit devices with smaller size, so far no luck with the current code it only shows the left half of the screen, it also does not work with bigger sizes, there it shows the scene in the left corner and the remaining is black screen, here is my code:

public class MenuStage extends Stage implements Screen {
private PlayStage playStage;
private UVeggFruit uVeggFruit;
private OrthographicCamera orto;
private Viewport vport;

public MenuStage(UVeggFruit uvf) {
    uVeggFruit = uvf;
    initMenu();

}

private void initMenu() {
    ButtonClickListener buttonClickListener = new ButtonClickListener();
    SceneLoader sc = new SceneLoader();
    CompositeItemVO sceneComposites = new CompositeItemVO(sc.loadScene("MainMenu").composite);
    CompositeActor UI = new CompositeActor(sceneComposites, sc.getRm());
    addActor(UI);
    UI.getItem("playbutton").addListener(buttonClickListener);
    UI.getItem("playbutton").addListener(new ClickListener() {
        @Override
        public void clicked(InputEvent event, float x, float y) {
            super.clicked(event, x, y);
            playStage = new PlayStage(uVeggFruit);
            uVeggFruit.setScreen(playStage);
        }
    });
    orto = new OrthographicCamera();
    vport = new ScalingViewport(Scaling.stretch, Gdx.graphics.getWidth(), Gdx.graphics.getHeight(), orto);
    vport.apply();

}

@Override
public void show() {
    Gdx.input.setInputProcessor(this);
}

@Override
public void render(float delta) {
    orto.update();
    Gdx.gl.glClearColor(0, 0, 0, 1);
    Gdx.gl.glClear(GL20.GL_COLOR_BUFFER_BIT);
    this.act();
    this.draw();
}

@Override
public void resize(int width, int height) {
    vport.update(width, height);
}

@Override
public void pause() {
}

@Override
public void resume() {
}

@Override
public void hide() {
     }
  }

Is it wrong that I put viewport in every stage, or I should put it in the application adapter and it will work for all stages? So basically what I want is that my stage renders as it would in 1280X720, but with smaller size, so how is this possible so I can see my whole stage no mater the screen size which is the general goal?

sentences:
Behaviour tree code example? http://altdevblogaday.org/2011/02/24/introduction-to-behavior-trees/

Obviously the most interesting article I found on this website. What do you think about it ?

It lacks some code example, don't you know any ? I also read that state machines are not very flexible compared to behaviour trees... On top of that I'm not sure if there is a true link between state machines and the state pattern... is there ?

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:
Microsoft and media - using the new stuff Over the past 5 or so years, Microsoft has released APIs / that is intended to replace older APIs:

(2006) Direct3D10
(2009) Direct3D11
(2008) XAudio2 / deprecates DirectSound
(2006) Windows Media Foundation / replaces DirectShow

But 66% of Windows users are still on Windows XP as of Oct 2010.

Win XP doesn't and won't have:

Windows Media Foundation
Direct2D
DirectWrite
D3D10
D3D11

There's a lot of cool stuff in these API's!  My question is is there any point, as a game dev, in migrating to the newer technology while you still have to support the old technology and provide a similar gaming experience?

Microsofts refusal to support D3D 11 on XP means there are some cool shader FX that are only supported on Windows 7 machines, such as geometry shaders

http://knol.google.com/k/-/-/2lijysgth48w1/8oyyfu/image2.png

But its generally not that acceptable to say something like "Hey those cool geometry shader FX only show up if you're running Windows 7!"  Suddenly you as a game developer are part of the angry microsoft upgrade push.

UPGRADE YOUR SYSTEM SO YOU CAN PLAY THE GAME!

love,
Microsoft

My point is, if I write code for D3D11, and then I'm going to have to double-up and dupe the rendering code on D3D9 and work extra hard to manually reproduce the stuff that APIs like DirectWrite do for me so easily, why should I bother learning D3D11 at all?

sentences:
Programmatically set color of Box2D body's sprite or image In my basic Cocos2D + Box2D iPhone app I have a bunch of circular Box2D bodies.  I'd like to change the color of the circles programatically.  What's the easiest way to do this?

So far I'm just assigning a CCSprite* to the b2body->userData.  So perhaps I can change the colors in my sprite sheet programmatically?  Seems like there's an easier way.  I'm just not sure what it is.

Cheers!

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:
Making game constants/tables available to game logic classes/routines in a modular manner Suppose I have a game where there are several predefined constants and charts (a XP chart, cost of goods and so on). Those could be defined at runtime, or load from files at start-up. The question is how should those logic routines access the constants and charts?

For example, I could try using global variables, but that cause all classes relying on the variables to  be tightly coupled with them.

sentences:
Open world game state saving Android As a hobby project I'm building a 2D game with a custom game engine in Android. Currently I can render a json map, and let the user interact with objects on the map. The game should be an open world map, with multiple maps. One of my current maps has a 150 x 150 tile pattern, with on every tile one or more objects. Thus, the map has 22.500, multiple layers, and more attributes. The player can edit objects (like fish in water object, plant seeds in soil, etc.), so every object needs to be stored separately. Some objects, like growing plants, need to be updated over time, even when the player is not playing the game.

My question is about efficiently saving and loading the game state. I think I need to store all the attributes of the maps, together with the objects, player progress, npc progress, and so on. Since this is a lot of data for a mobile device, I can't think of a good way to store this on the phone (or in the cloud).

I've tried the following:
- Store the entire game state in a serialized file. The parsing of this file took way to long while loading, and when one object's state changed, the whole game had to be loaded.
- Store every object in a sqlite database, with for every attribute a column. This was even slower than the first option, so not an option either.
- Store every object serialized as a blob in the database. This option wasn't much faster than the previous one.

I've been looking at ObjectBox, but in order to create the entity values for this database, I need to change a lot of reference values to ToOne<> or ToMany<> objects, which will take a lot of time and since I am using the map attributes to render the maps, the wrapping and unwrapping of the objects would cause (unnecessary) delay. (This is an assumption)

How do I save the game state without causing a 20-minute loading delay?

sentences:
How can I prioritize the call order of decoupled scripts? I have a player with many individual components that each handle a behavior such as jump, block, attack, duck, etc..  None of the scripts know about one another. Each listens for a specific input to fire. Some behaviors share the same input depending on the characters state such as ok the ground, in the air.

I'm running into issue where the wrong behavior will fire that has shared input (down+attack instead of down+attack being held down for x seconds).

I'm looking for advice on how to manage these behaviors and have more control over what can happen when.

I've tried resolving this issue by creating a method that will disable other behaviors temporarily while completing the action and I've changed the script execution order.

I thought about adding a discrete player state and restricting what behaviors are able to be performed at any given time but this increases the complexity quiet a bit.

sentences:
Libgdx stop animation at last animated frame How i can stop animation at last frame.

@Override
public void create(){

textureAtlas = new TextureAtlas("pack.atlas");
stage = new Stage(new ScreenViewport());
sb = new SpriteBatch();

 final TextButton button = new TextButton("Start",skin , "default");
        button.setWidth(220);
        button.setHeight(50);

  button.addListener(new ClickListener(){
            @Override
            public void clicked(InputEvent event, float x, float y) {
                spinAnimation.setFrameDuration(0.5f);
                int i = 0;
     Timer.schedule(new Timer.Task() {
                @Override
                public void run() {
                    spinAnimation.setFrameDuration(0f);

                }

            },1);

            }
        });

    stage.addActor(button);

           Gdx.input.setInputProcessor(stage);
    }

@Override
   public void render() {

   elepsedTime += Gdx.graphics.getDeltaTime();
   Gdx.gl.glClearColor(0,0,0,1);
   Gdx.gl.glClear(com.badlogic.gdx.graphics.GL20.GL_COLOR_BUFFER_BIT);

   sb.begin();
   stage.act(Gdx.graphics.getDeltaTime());
   sb.draw(spinAnimation.getKeyFrame(elepsedTime,true), 50,  60

   sb.end();
   stage.draw();
    }

sentences:
Unity ball not bouncing off wall correctly I have been making a brick breaker game in Unity in 2D as my first game. I have got the ball bouncing off the paddle correctly and can bounce it of the paddle at different angles. However, when the ball hits a wall or the roof it always bounces so its either traveling exactly in the X-directon or Y-direction regardless of what angle it hits the wall with instead of bouncing off at 90'.

Im not using any scripts to control the bouncing off the walls or roof just using  2D box colliders on the roof and walls (which are cubes) and a circle collider and 2D rigidbody on the ball (sphere) which Ive given a bouncy material.

Any help would be really appreciated.

Here's a gif of the problem: http://imgur.com/a/YJyNH

sentences:
What is the best way to learn Cocos2D? I've messed around with iPhone development for a couple years now. I've done some contract work. I want to get into Cocos2D to develop a game idea that I have.

I was wondering what might be the best/quickest way to get up in running in cocos2d?

I've thought about a book, but I wondering if that is needed? I'm the type of guy that just wants to know what everything does and is suppose to be used for.

Any ideas?

sentences:
Keyboard input conflict in wall jump I'm trying to make a Megaman-style wall jump in my 2D platform game with JavaScript.

The character can do A,B,C motions when it sticks the wall:

My problem is that when I trying to jump off the wall(motion C), it goes to motion A or B first, C was not happened. I think the keyboard input was conflict but I have no idea how to handle it.

Here is my current code:

if(key['right'] && key['jump']) {//it doesn't work
    //jump off the wall
} else if(key['right']) {
    //leave the wall
} else if(key['left']) {
    //stick the wall
} else {//release all keys
    //falling down
}

Please, Any help would be appreciated.

sentences:
How to add caves to a terrain mesh generated with 2D noise Am I getting it right, that when I'll make a single mesh that represents terrain using unity's built-in 2D Perlin noise function, then I'll be able to somehow add caves using whatever (Perlin worms for example)?
Or do I need to find solution with 3d noise?

sentences:
Recommend a way to draw thousands of particles (liquid) per frame in Unity3d I'm writing a plugin for this library for Unity3d.
I have it working and now I am looking for an efficient way to draw the particles.
My 1st test just uses sprites and runs fine on my laptop but I doubt it will be so good on a mobile device.

Is there a cheap way of simply drawing lots of particles to the screen each frame?
The library generates an array of all the particle positions which updates in FixedUpdate() so I can just draw everything in that array each frame.

I'm thinking maybe somehting in the Graphics namespace would handy here, like maybe Graphics.DrawTexture

Also I might consider doing some kind of metaballs like pass over the particles to make them look more liquid like.

sentences:
Sprite with alpha Blending in 3D world I'm working on a game in a 3D world with elements 2D only (Like Don't starve game) for Android and IOS.

Currently, I've managed "Sprite" without alpha blending, I've just put a condition in the pixel shader to test if pixel alpha channel is null:

if ( texture.a < 0.5 ) discard;

Everything working here. (On old devies like an HTC desire mobile, this condition destroy framerate but it's another problem :/)

But recently, I've tried to had another Sprite with AlphaBlending activated:

glCheck( glEnable(GL_BLEND) );
glCheck( glBlendFunc( GL_ONE, GL_ONE_MINUS_SRC_ALPHA ) );
glCheck( glDisable(GL_DEPTH_TEST) );

My sprite transparency is ok but it is now in front of everything in the scene. (Probably due to glDisable(GL_DEPTH_TEST)).

How can I handle depth with alpha blending activated?

EDIT:
A video to show the problem: http://www.youtube.com/watch?v=W0gpBekEwW8&feature=youtu.be

sentences: Where can I find legal or business resources for a game production company? Where can I find information on the legal or business aspects of running a game production company?

sentences:
How to make a scrolling background in Delphi with FireMonkey? I'm making a scrolling background game alike classic Mario 2D games.

How do I make a scrolling background in Delphi XE7 using FireMonkey?

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:
LineRenderer doesn't apply material in 2D Unity5 I'm making something that draw lines with mouse on top of everything (in 2D), but the color of the line is always purple even though I assign a material to the line renderer. I could change the color by using shader, but after that the line doesn't appear on the screen anymore.

DrawLine.cs

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

public class DrawLine : MonoBehaviour
{
    private bool isMousePressed;
    private List<Vector3> pointsList;
    private Vector3 mousePos;
    private GameObject lineDrawPrefab;
    private LineRenderer lineRenderer;
    public GameObject lineDrawPrefabs;

    struct myLine
    {
        public Vector3 StartPoint;
        public Vector3 EndPoint;
    };

    void Awake()
    {
        isMousePressed = false;
        pointsList = new List<Vector3>();
    }

    void Update ()
    {
        if(Input.GetMouseButtonDown(0))
        {
            isMousePressed = true;
            lineDrawPrefab = GameObject.Instantiate(lineDrawPrefabs) as GameObject;
            lineRenderer = lineDrawPrefab.GetComponent<LineRenderer>();
        }
        else if(Input.GetMouseButtonUp(0))
        {
            isMousePressed = false;
            pointsList.Clear();
        }
        if(isMousePressed)
        {
            mousePos = Camera.main.ScreenToWorldPoint(Input.mousePosition);
            mousePos.z=-5;
            if (!pointsList.Contains (mousePos))
            {
                pointsList.Add (mousePos);
                lineRenderer.SetVertexCount (pointsList.Count);
                lineRenderer.SetPosition (pointsList.Count - 1, (Vector3)pointsList [pointsList.Count - 1]);
            }
        }
    }

    private bool checkPoints (Vector3 pointA, Vector3 pointB)
    {
        return (pointA.x == pointB.x && pointA.y == pointB.y);
    }
}

LineMaterial.cs

using UnityEngine;
using System.Collections;

public class LineMaterial : MonoBehaviour {

    private LineRenderer line;

    void Awake()
    {
        line = gameObject.GetComponent<LineRenderer>();
        //line.material =  new Material(Shader.Find("Particles/Additive"));
        //line.SetColors(Color.green, Color.green);
        line.SetWidth(0.15f,0.15f);
        line.useWorldSpace = true;
    }
}

sentences:
Box2D: Asteroids-Like Spaceship Physics I'm new to Box2D (JavaScript) (and the world of physics/mathematics) so I'm having a hard time working out the methods I need to use to make a spaceship act like it does in the classic arcade game Asteroids. I've tried varying methods and nothing works quite right (as I obviously don't understand what I'm doing).

For example, in Asteroids you can rotate the ship but it turns at a constant rate and won't continue to spin after you let go of the key, unlike the rest of the ship's physics. So I tried SetPositionAndAngle(position, angle-0.1) as an example to make the ship turn without having it rotate after key up, however when I then press the up key to make the ship go forward, it turns left as well as going forwards (via ApplyForce).

Can anybody give some tips on how I should be dealing with Asteroids-type spaceship physics?

sentences:
Unity2D: Wrapping a line around an object I have this 2d platformer made out of box colliders. I have the player connected to a point by a LineRenderer and a DistanceJoint2D, for use in physics puzzles. This tool lets him link to a location and then do grappling hook things with it, like retract the rope at speed to spiderman around.

What I want to do is move the distance joint around the object, thus changing the angle at which the player is pulled. Like in this image.

Very similar to this more general, unanswered question that doesn't not give any specific math.

I know I'll be making a list of positions and then move the joint's anchor around whenever it wraps/unwraps, but I'm not sure how to tell when and where it wraps on something.

sentences:
Get vector3 position of Cursor on a fixed 2D plane within a 3D scene How is it possible to get a cursors X and Y Location relative to the scene planes rather than using co-ordinates based upon pixels of screen height and width?

I have the start of a very basic game, picture with a few physical aids shown below.

I want to find out how far away the cursor is on the X and Y axis from an object in the scene.
The Z axis is irrelevant due to the nature and orientation of the game, so z = 0. (Note that in Unity, the Y axis is vertical)

Basically, the distance of the cursor from the cube on the X Axis upon clicking will define the power of an action.

Because of this. I want to get the cursor X position relative to the 0 point of the scene ( or the object ), not relative to the bottom left corner of the screen.

I could then use Vector3.Magnitude() to get the distance.

How is this possible?

sentences:
Godot: error(10) expected '(' after Identifier When trying to write up a new shader for a material, I've been trying to create a variable to use to alter speed and test animation. Now, the below outputs fine until I try to assign a value to number.

shader_type canvas_item;

uniform float time_factor = 1.0;
uniform vec2 amplitude = vec2(10.0,5.0);
uniform sampler2D frame1;
uniform sampler2D frame2;
uniform sampler2D frame3;
uniform float speed = 1.0;

float number = 1.9;

void vertex(){
    VERTEX.x += sin(TIME * time_factor + VERTEX.x + VERTEX.y) * amplitude.x;
    VERTEX.y += cos(TIME * time_factor + VERTEX.y + VERTEX.x) * amplitude.y;
   }

I had seen tutorials demonstrating that this would have worked fine in previous versions.

sentences:
Disabling RigidBody component I'm trying to create a mechanic in my puzzle game in which if the player clicks on one of the flying game objects, the object's gravity would be enabled and world physics would be applied to it. Initially, I thought I could use the 'enabled' feature to create such a mechanic but I noticed that the RigidBody class does not contain 'enabled'.

Could there be any other way that would allow me to disable the GameObject's gravity or RigidBody component when it is instantiated?

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

[RequireComponent(typeof(Rigidbody))]
public class Plane : MonoBehaviour
{
    private bool clicked = false;
    [SerializeField] private Rigidbody rb;
    // Start is called before the first frame update
    void Start()
    {
        rb = GetComponent<Rigidbody>();
        rb.enabled = false;
    }

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

    }
}

sentences:
Estimate the time it takes for an object to travel from point A to point B I have an object with vec2 position, velocity, and destination with 2 variables maxspeed and acceleration. In each step, its position is calculated as follows:

vec2 desiredVel = destination - position;

var dist = desiredVel.length;
if (2 * dist * acceleration < currentSpeed*currentSpeed)
    desiredVel.zero();

vec2 steering = desiredVel - velocity;
steering.setLength(acceleration);

velocity += steering * dt;
velocity.truncate(maxspeed);
currentSpeed = velocity.length();

position += velocity * dt;

Basically the object will accelerate to its maxspeed towards destination, then maintains  speed until the a certain distance to destination. At that distance, the object will decelerate at the -max acceleration rate so that it stops approximately to the destination point.

My question is that if I have an object with an initial velocity and I set a destination point, how can I estimate the time it will take to reach the destination point? Assuming its maxspeed and max acceleration doesn't change and no other force/acceleration applies to the object in the path.

sentences: Can LWJGL support multiple displays Can LWJGL support multiple displays either as separated windows or as part of an AWT Window?

sentences:
Why should a FPS game use a "floating arms" approach over full body one? I've seen many first person shooter games both single and multiplayer using a set of floating arms and a gun instead of using the whole body model.

What is the advantage of floating arms? You are technically doubling the work making two meshes and two animations for each action.

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:
Bounding Box in Monogame for mouse picking - Ray perspective My mouse ray is screwing up precision. I don't really know how to fix it, maybe you guys can help.

problem :
(5.6mg gif)
https://www.dropbox.com/s/v0z67afso88hsd1/perspective_ray.gif

how i create the mouse ray:

 private Ray GetMouseRay(GraphicsDevice gd, ref Matrix view, ref Matrix proj)
    {
        //create source positions
        // i dont really understand why the 0 and the 1, since the near/far clip plane are totaly diferent, but from experimentation, this is a must
        Vector3 nearsource = new Vector3((float)MousePosition.Value.X, (float)MousePosition.Value.Y, 0.0f);
        Vector3 farsource = new Vector3((float)MousePosition.Value.X, (float)MousePosition.Value.Y, 1.0f);
        //Console.WriteLine("nearsource :" + nearsource.ToString() + " farsource :" + farsource.ToString());
        //Matrices needed are the view proj and this world
        //we are positioning the mouse ray in the origin(model origin, its a 3Dspace ray)
        Matrix world = Matrix.CreateTranslation(0, 0, 0);

        //unproject mouseposition in the clipping planes
        Vector3 nearPoint = gd.Viewport.Unproject(nearsource, proj, view, world);
        Vector3 farPoint = gd.Viewport.Unproject(farsource, proj, view, world);
        //Console.WriteLine("nearPoint :" + nearPoint.ToString() + " farpoint :" + farPoint.ToString());
        // Create a ray from the near clip plane to the far clip plane.
        Vector3 direction = farPoint - nearPoint;
        direction.Normalize();
        return new Ray(nearPoint, direction);
    }

How i am drawing the ray:
 CDebugShapeRenderer.AddLine(mouseRay.Position, mouseRay.Position * mouseRay.Direction * 1000, Color.Red);

how i am calculating the Obb:

Bounding Box in Monogame for mouse picking

How i am calculating the collision:
Line: 349
https://github.com/CartBlanche/MonoGame-Samples/blob/master/CollisionSample/BoundingOrientedBox.cs#L349

So how can i create a mouse ray that is accurate? or remove that perspective somehow.

Roger.

Edit:
I forgot to add the matrices used

 proj = Matrix.CreatePerspectiveFieldOfView(MathHelper.PiOver2, this.GraphicsDevice.Viewport.AspectRatio, 1.0f, 1000.0f);
 view = Matrix.Identity;

sentences:
can it be done with 2D engine or is it real 3D? Possible Duplicate:
  How should I sort images in an isometric game so that they appear in the correct order?
  My isometric game looks flat; how can I improve this?

I'm working with andengine on a tiled map, at the moment I have only something like this

However I want to manage/introduce "heigth" like the folowing image.

Can I do this or have I do change my engine, I want now something like this :

Do you have some example/tuto explaining how to manage a "3D" tiled map?

sentences:
Issues calculating frame independent movement I'm developing a Breakout style game in C++ using SDL. The problem so far is that the ball slows down and speeds up for no particular reason.

The slowdowns usually last a few seconds.

EDIT : When running fullscreen I noticed that the ball movement seems to be a tiny bit jerky as well. This leads me to believe that the timing should be more finely granulated. But at the same time, it shouldn't be necessary to have µs precision...

Here is my code for calculation the movement of the ball :

double deltaMovement = tick * speed;

rect.x += static_cast<int> ( deltaMovement * dirX );
rect.y += stnecessearyatic_cast<int> ( deltaMovement * dirY );

I tried changing it to help prevent float to in truncation, but this affects the speed to much, making the ball move only move horizontally or vertically ( which never happens with the above code. )

double movementX = ( deltaMovement * dirX );
double movementY = ( deltaMovement * dirY );

movementX += ( movementX > 0.0f )? 0.5f: -0.5f;
movementY += ( movementY > 0.0f )? 0.5f: -0.5f;

rect.x += static_cast<int> ( movementX );
rect.y += static_cast<int> ( movementX );

rect is an SDL_Rect and holds the ball's position. dirX and dirY are double and holds the direction of the ball, the values range from -1.0 to 1.0

I'm not sure if the issue is with the float to int conversion. I guess it could also be something with SDL internally, but I am quite sure SDL should be capable of smooth animation.

    Here's my main game loop ( I have removed some irrelevant parts of it )
    while ( !quit )
    {
        while ( SDL_PollEvent( &event ) )
        {
            // Handle input, move paddle, check if user pressed esc
            // Yes I have a means of escaping the outer while loop.
        }
        double delta = timer.GetDelta( );

    // Update the ball, check for collisions with wall/paddle/tiles
    UpdateBalls( delta );

    // Redraws everything
    UpdateGUI();
}

I'm quite sure the issue is not with my delta time, since it's fairly consistant at 1 - 4 msec. And even if it did change a lot, it shouldn't matter. But just in case, here's the code I use for calculating delta time :

double Timer::GetDelta( )
{
    timespec tmCurrent;
    clock_gettime( CLOCK_MONOTONIC_RAW, &tmCurrent);

    // Get current time in nanoseconds
    unsigned long long deltaCurrent = static_cast< unsigned long long > ( tm.tv_sec * 1000000000 + tm.tv_nsec );

    // Get diff. Delta is an unsigned long long that holds previous tick ( see below)
    unsigned long long diff = deltaCurrent - delta;

    // Convert into ms and assign to a double
    double deltaMSec = static_cast< float > ( diff / 1000000.0f );

    // Reset delta so that it can be used the next time delta is calculated
    delta = deltaCurrent;

    return deltaMSec;
}

What am I doing wrong?

sentences:
How to generate tile based natural looking map? I have a tile based map which I generate using interpolation of pixels on a reference bitmap into appropriate tiles depending on the color of the pixel.

I'm trying to make the output look natural in which blocks of similar tiles look like they are forming a single entity as in the following image:

While my version only puts static sprites onto aligned cells, the second image  takes forest tiles and smashes them together like a whole single forest.
The same is done for the water area.

Could someone explain or point me somewhere where I can learn how to make the result of the first image look like the second? Thank you

Also, how are the seamless road connections done in the above image?

sentences: Opengl-es 1.1 draw blur on model? How can I draw blurred models/images in 3d space like here:

sentences:
Determining the price of a trade good depending on supply and demand of a marketplace I've been meaning to add a market/trading system in my space-themed game where a player can buy from one station and sell it to another for profit, etc. (Examples would be Starsector, Elite: Dangerous, EVE Online)
The problem I've been having is actually determining the price of an item based on parameters like: Base Value, Supply, Demand, Transaction costs, Markup, and maybe others if I can think of them. I'm not particularly sure where to start with a price formula.
Any ideas on how to best decide on this?

sentences:
GLM: Euler Angles to Quaternion I hope you know GL Mathematics (GLM) because I've got a problem, I can not break:

I have a set of Euler Angles and I need to perform smooth interpolation between them. The best way is converting them to Quaternions and applying SLERP alrogirthm.

The issue I have is how to initialize glm::quaternion with Euler Angles, please?

I read GLM Documentation over and over, but I can not find appropriate Quaternion constructor signature, that would take three Euler Angles. The closest one I found is
angleAxis() function, taking angle value and an axis for that angle. Note, please, what I am looking for si a way, how to parse RotX, RotY, RotZ.

For your information, this is the above metnioned angleAxis() function signature:

detail::tquat< valType > angleAxis (valType const &angle, valType const &x, valType const &y, valType const &z)

sentences:
Unity Wwise. No audio in my game build I'm building a game in Unity using Wwise as the audio engine. I'm on a Mac and whenever I build the game, there is no audio. Apparently this is because the sound banks are not in the correct folder. They should be in Assets/StreamingAssets/Audio/GeneratedSoundBanks/ followed by a sub-folder with the name of whatever platform you are using. I should have a Mac folder located here however there isn't one. Instead my sound banks just sit in the GeneratedSoundBanks folder which works when i test the game in unity, however there is no audio when I build the game. Apparently this has something to do with environment variables or a python path but I have no idea how to fix or edit these as I am new to coding as well as Wwise and Unity. If I build the game for web player I get an error CS0246: The type of namespace name 'AKRESULT'  could not be found. Web GL says it doesn't work for the unity wise integration package I have either (and going to an older one just messed my whole projects audio up completely). If anyone could give me any help at all, it would be very much appreciated. Thank You.

I'm using: Unity 5.3.5.1f, Wwise v2016.1 (32-bit), WwiseUnityIntergration_v2016.1_Mac.unitypackage.

sentences:
unity Rigidbody jump I absolutely don't know what is the problem with this code and I have tried everything without any success. I need help.

void FixedUpdate()
{
if (Physics.Raycast(transform.localPosition+new Vector3(0f,0.1f,0f),-transform.up,0.2f) )
        {
            grounded = true;
        } else
            grounded = false;

if (Input.GetButtonDown ("Jump") && grounded)

            {
                rb.velocity+= Vector3.up*jumpSpeed;

            }
}

Some time it jumps and some time it doesn't jump with no visible pattern.

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:
Non-GPU Noise for 2D side-view terrain generation? I really couldn't find a correct answer while scowering all the forums for Noise Generation.

My goal is simple, I really want to have two distinct layers for my terrain, a white layer representing air, and a black layer representing earth. An algorithm will pick up from there.

Most noise I found generated "Cloudy" textures, where I am looking for something along the lines of:

So far I have worked with Perlin Noise but adjusting my values yields no useful results.

Does anyone have any ideas?

sentences: Is there a way to reference Unity UI object inside native code? Let's say we have a scene in Unity with canvas and InputField on it. Is there a way i can reference my InputField inside native plugin? Maybe i can pass it from Unity?

sentences:
How to get struct layouts from vertex shader input using ID3D12Reflection I am attempting to write a code generator that builds C++ structs/classes from D3D12 reflection data built using DXC. Given a simple vertex shader signature:
struct Light
{
    float3 Color;
    float3 Dir;
};

struct cbPerPass : register(b0)
{
    float4x4 gWorldProjTransform;
    Light gGlobaLight;
};

struct VertexIn
{
    float3 Pos      : POSITION;
    float4 Color    : COLOR;
};

struct VertexOut;  // unimportant for the question

VertexOut VS(VertexIn vin) { // do calculations here }

I can retrieve the input parameters via ID3D12ShaderReflection::GetInputParameterDesc(), but this only reports the mapping of VertexIn members to shader registers and any attached semantics. I can get the layout of cbPerPass through ID3D12ShaderReflection::GetConstantBufferByIndex() and the layout of Light through the ID3D12ShaderReflectionType interface.
However, what I would like to retrieve is the layout of the VertexIn struct. Is there a way to do this?

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:
My game engine is done, how can I get ideas of a game to make with it? I read at many places how people have this GREAT ideas but are not able to program themselves. I have quite the opposite problem. I have developed game engine, level editor, embedded Lua scripting language, I have even made wrapper for Android and it all works well. But I have no good idea about how to proceed with actual levels; I have no good ideas. The engine itself is very generic and can be used in many game concepts, but I just cannot think of anything useful. Do you have any thoughts on how to proceed? Where should I seek ideas? Who should I ask?
I am sorry if this question is a duplicate.

EDIT: Thank you all for your responses. I see now in FAQ that indeed my question was misplaced. I just saw this thread and people were advising that ideas are worthless and execution is what counts. So I wondered where all the "worthless" ideas are, because I cannot seem to find any when I need it.

Yes, the engine was targeted at one particular game, but I always envisioned it like "based on game X with additional features". So I added additional features but now I don't know how to use them in a funny and entertaining way. I could still finish the original game X, but it would only be unoriginal copy of the game X, which is just pointless.

Anyway, thanks again for your responses, wish you happy coding.

sentences:
How to avoid singleton pattern for Event Scheduler? I want to make an Event scheduler for my Game, I basically want to be able to schedule the triggering of a Game Event. This can be a one time trigger, or a periodic trigger (trigger event "E_BIG_EXPLOSION" on a 5 seconds basis...).

It is tempting to think that this may be a good place to use a Singleton, but singletons can be quite evil and they tend to spread like a disease... so I try to avoid them at all cost.

What design would you propose to avoid the singleton usage in this case?

sentences:
Separating UI and logic in Objective-C at iOS based Games How to separate UI and logic in Objective-C based mobile games?

To develop games, I use Cocos2d library.

I need a good reference to separate my UI code from game logic code.

sentences:
How can I transform a point from world space to object space? If I have an object space described by transformation matrix that should be applied to object to transform it to world space, what I have to do to transform point (world space) to that object space.

I guess it's more of a math question, but I believe gamedevs are more familiar with terminology.

sentences:
Design criteria question kids games I am currently designing a game for small kids that have not yet learned to read and would like to get some opinions, and views, on scoring?

Given that these (hopefully) will be small children that cannot yet read or children that have just learned to read, between 2 - 5 maybe what about scoring, do you think that is needed?

My idea was to avoid both any character at all and only use pictures. However, if scoring is implemented there re always other ways to do that i guess with colors, bars etc.

Would someone nice just elaborate a bit on general design criteria's for this type of games and applications with this target audience?

sentences:
Separation algorithm in flock simulation? I'm using box2d (the c++ one).

I found a method for an arriving behavior (on http://www.red3d.com/cwr/steer/gdc99/ ), which works well, problem is, the bodies are bumping into each other and it results in an ugly shaking effect.

How do you make sure bodies keep away from each other after I applied the arriving behavior ? Or the other way around ?

I'm wondering if it might be a better idea to completely remove the arriving behavior to implement the separate algorithm.

edit: even setting a low restitution results in shaking

sentences:
How to deal with two different axes on isometric game? Hi! Above is a visual of the problem I am having. My game has two different coordinate systems. You have the client, or the canvas, where the game is rendered - a standard coordinate plane; however, I also have the game coordinate plane where it is rotated due to the isometric nature of the game.

Note: The server only feeds chunks of tiles to the game at a time, which makes it impossible for me to just translate the canvas. I have to calculate the drag amount and in what direction, and request the new chunk of tiles to be displayed from the server.

My problem: I can't figure out how to calculate the # of tiles moved (so I can send that data to the server), because I don't know how to determine how many tiles and in what direction the user moves the map. Because if they move to the left, it's not only change the game's x position, but also the game's y position because both new columns and rows would have to be loaded due to the nature of the isometric map.

I hope this made sense, I tried my best to explain the problem and I'm not too sure I explained it correctly.

sentences:
Randomize sound in Unity 5 When I start my game, public AudioSource does not load sound but play a sound.  My code does not have any error.

using UnityEngine;
using System.Collections;

public class random: MonoBehaviour {

    public AudioClip[] gravel;

    void Update()
    {
        if (!GetComponent<AudioSource>().isPlaying){
            GetComponent<AudioSource>().PlayOneShot(gravel[Random.Range(0,gravel.Length-1)]);
        }
    }
}

How can I put my random audio to my audio source.
Video for describle my problem:
In this video play sound twice (because I run my game twice)
In first play I have to attach a file to audio source.
I do not know why my audio source is empty and I have to attach a file to it.
If I can load sound in my audio source I can fix my problem.
I want to play one randomized shot.

sentences:
Ray tracing - BRDF using Cornell measured spectral data I wrote a ray tracer that implements various BRDF models (Oren Nayar, Lamber, Torrance Sparrow and so on).
Now I'm trying to implement a BRDF from measured data.
I choose the Cornell database data available here:

http://www.graphics.cornell.edu/online/measurements/reflectance/spraypaints/index.html

I want to use them because there's a representation of the data as spectrum with 31 sample (my ray tracer use spectral data for light calculation and then convert them to CIE XYZ and then RGB values for the final image rendering).

Which is the correct way to use this data?
Which sample technique must be used?

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:
How can I launch a GameObject at a target if I am given everything except for its launch angle? I am trying to launch an object at a target, given its position, its target position, the launch speed, and the gravity.  I am following this formula from Wikipedia:

$$ \theta = arctan \bigg( \frac{v^2 \pm \sqrt{v^4-g(gx^2 + 2yv^2)}}{gx} \bigg) $$

I have simplified the code to the best of my ability, but I still cannot consistently hit the target.  I am only considering the taller trajectory, of the two available from the +- choice in the formula.

Does anyone know what I am doing wrong?

using UnityEngine;

public class Launcher : MonoBehaviour
{
    public float speed = 10.0f;

    void Start()
    {
        Launch(GameObject.Find("Target").transform);
    }

    public void Launch(Transform target)
    {
        float angle = GetAngle(transform.position, target.position, speed, -Physics2D.gravity.y);
        var forceToAdd = new Vector2(Mathf.Cos(angle), Mathf.Sin(angle)) * speed;
        GetComponent<Rigidbody2D>().AddForce(forceToAdd, ForceMode2D.Impulse);
    }

    private float GetAngle(Vector2 origin, Vector2 destination, float speed, float gravity)
    {
        float angle = 0.0f;

        //Labeling variables to match formula
        float x = Mathf.Abs(destination.x - origin.x);
        float y = Mathf.Abs(destination.y - origin.y);
        float v = speed;
        float g = gravity;

        //Formula seen above
        float valueToBeSquareRooted = Mathf.Pow(v, 4) - g * (g * Mathf.Pow(x, 2) + 2 * y * Mathf.Pow(v, 2));
        if (valueToBeSquareRooted >= 0)
        {
            angle = Mathf.Atan((Mathf.Pow(v, 2) + Mathf.Sqrt(valueToBeSquareRooted)) / g * x);
        }
        else
        {
            //Destination is out of range
        }

        return angle;
    }
}

sentences:
3D Level Navigation Map for a 2D Mobile Game I am currently making a game in which I want to create a level screen map. The Map doesn’t have to do anything with the game logic and stuff but I just want to add it to include a bit of richness.
The Map I am planning to add will be a 3D map. I just want to know how I can use a 3D map for usage in a 2D game. What is the best approach to get started with? I have tried iTween’s Tweening stuff to Animate and control camera over a spline curve but I am not sure what can be the best approach for it?
The Map will be just a set of levels/point in which the initial need to clear before you go to the next.

sentences:
How can I change the color of an object at runtime? I wish to have the shader effect as in the game 'The stack' by ketchapp

https://play.google.com/store/apps/details?id=com.ketchapp.stack&hl=en

As you can see, the color of the objects as well as the skybox keep changing.

I'm completely c# noob and trying my best to find  shaders to replicate the effect. But I can't find anything.

How can I change the color of an object at runtime?

sentences:
How to give a ball a following texture trailing effect How do I draw copies of the leading texture so that there is a line of the leading ball following behind it? (that don't collide)

So far I have tried to create the effect by placing another graphic 2 pixels off the graphic, but I don't see the second ball being drawn.

spriteBatch.Draw(ballTexture, ballPos, null, Color.White, 0.0f, new Vector2(Ballpos.X +2, ballPos.Y +2), ballSize, SpriteEffects.None, 0);

Thanks.

sentences:
How would I create colouring such as in Splatoon? For those who don't know, Splatoon is a game where you color ground with your teams, and other team tries to color more area in their color.

It looks like the whole ground is color-able, which makes every ground part (maybe not every pixel, but very big part of it) rendered every time a color is being sprayed. I would think is a big load on the GPU, but the Nintendo Wii U handles it pretty well.

My question is, how is it possible? Is there a trick behind that kind of process?

sentences:
LibGDX obstacle collision How can I handle collisions with obstacles in LibGDX?

Is there any automatic way to stop the character's movement when it collides with a wall or I have to constantly poll for all the possible objects it might encounter and stop the movement accordingly?
Polling this way seems pretty poor performance-wise, especially if the framework already does that for me and I make no use of it.

My game is a top view roguelike, more or less like "The Binding of Isaac".

EDIT some beginners like me might make good use of it.
Since LibGDX has no built in collision detection without Box2D, for games where physic calculation is not needed you can build your system as follows:
Create 3 lists (Static, Dynamic, Controlled) where you put all your (relatively inherited) objects in the scene.

Static objects (walls, obstacles, traps) are passive and perform no checks.

Dynamic objects (projectiles) perform checks on both Static (stop if you hit a wall, destroy self) and Controlled (deal damage)

Controlled (players, enemies) objects perform checks on self (player hit AI controlled enemy) and static objects

After a collision is reported notify the relative objects.
Controlled objects can be Dynamic aswell but if you have a lot of projectiles flying around you can avoid self-checking Dynamics and improve the performance.
This way you should reduce a lot of useless checks aswell as limit cross-checks (both player and projectile notifying eachother) and keep your game well organized.
This is just an idea that i'm testing now, I can't guarantee it's the best :P

sentences:
Dividing properties between RigidBody and Collider I am currently making a physics engine in Rust.

The 2 main data structures concerning collision detection are:

RigidBody: Physics-related aspects of the body. Contains a reference to a Collider structure.
Collider: Shape and structural-related aspects

However, I am unsure as to which data structure should store the instance fields:

mass (or inverse mass)
inertia (or inverse inertia)
angle of orientation
restitution

The reason for this absolute segregation is that during collision detection, only references to the concerning Colliders will be passed.

Could someone please advise me on the matter?

sentences:
Importing skeletal animation from vertex coordinates in maya I have files of different frames of an animation which have the vertex co-ordinates of a human skeleton in 3D space. I want to import the animation from these keyframes into maya to perform motion retargeting. Please help me get some direction in this.

Also is there any other way to retarget motion from one skeleton to other(different size) other than in maya?

sentences:
With Slick, how to change the resolution during gameplay? I am developing a tile-based strategy game using Java and the Slick API.

So far so good, but I've come to a standstill on my options menu. I have plans for the user to be able to change the resolution during gameplay (it is pretty common, after all).

I can already change to fullscreen and back to windowed, this was pretty simple...

//"fullScreenOption" is a checkbox-like button.
if (fullScreenOption.isMouseOver(mouseX, mouseY)) {
   if (input.isMouseButtonDown(Input.MOUSE_LEFT_BUTTON)) {
      fullScreenOption.state = !fullScreenOption.state;
      container.setFullscreen(fullScreenOption.state);
   }
}

But the container class, contrary to my previous beliefs, does not seem to have any resolution-change functions! And that's pretty much the situation...I know it's possible, but i don't know how to do it, nor what is the class responsible!

The AppGameContainer class, used on the very start of the game's initialization as of Slick's examples and tutorials, is the only place with any functions for changing the display-mode that I've found so far, but it's only used at the very start, and i haven't found a way to travel back to it from my options menu.

  //This is my implementation of it...
  public static void main(String[] args) throws SlickException {
    AppGameContainer app = new AppGameContainer(new Main());
//    app.setTargetFrameRate(60);
    app.setVSync(true);
    app.setDisplayMode(800, 600, false);
    app.start();
  }

I can define it as a static global on the Main, but it's probably a (very) bad way to do it...

sentences:
Unity Assets folder is empty after opening package from the asset store I downloaded the following Survival Shooter Tutorial from the Asset Store :
https://www.assetstore.unity3d.com/en/#!/content/40756
I was prompted to open it in Unity so I did and began following this tutorial :
https://www.youtube.com/watch?v=_lP6epjupJs
I am only 2 minutes into the first video and am stuck. In the tutorial there are lots of folders in the assets folder. I took a screenshot of what my screen looks like to show that it is empty.

sentences:
Should I be caching the assets in my asset manager, or will the browser handle it? I use the asset manager class below in my game to download all the game data at launch. It's about 5000 files. Each file is retrieved like so:

const image = AssetsManager.getImage("rooms.lounge.floor");

Will the browser cache these itself or should I add a caching layer myself?

import {
    ASSET_URL
} from 'src/AssetsManager';

export default class AssetsManager {

    static resolveUrl(path)
    {
        path = path.split('.').join('/');

        return ASSET_URL + path;
    }

    static async getJSON(path)
    {
        const url = AssetsManager.resolveUrl(path) + '/.json';

        return fetch(url)
            .then(response => response.json())
    }

    static async getImage(path)
    {
        const image = new Image();
        const url   = AssetsManager.resolveUrl(path) + '/.png';

        image.onload = () => {
            if (image.complete) Promise.resolve(image);
            Promise.reject();
        }
        image.src = url;
    }

sentences:
How do I prevent memory-modification cheats? There are many memory-altering programs out there nowadays (Cheat Engine & co).  Is there an efficient way to keep a constant variable actually constant?

I had two ideas:

Make a separate thread updating the constant variable to a constant value, e.g. 200 every minute. Problem: One can also alter the second value.
Store the value on the server. Problem: I want to keep the network traffic as low as possible.

I need this mechanism for both constants and variables only allowed to contain a certain range of values.

Are there better ways to do this?

sentences:
How to make projectiles shoot at mouse position? I'm looking to make it so my fired projectile is shot at the position of the mouse so aiming is an option ie:up down ect..

I have the script working to where it spawns the cloned object and launches it but it only shoots straight from my players hand before disappearing. how can I adjust my command so the object is shot in the direction the mouse is pointing?

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

public class ProjectileShooter : MonoBehaviour {
  [SerializeField]
  Transform attachmentPoint;
  GameObject prefab;

  void Start () {

    prefab = Resources.Load ("projectile") as GameObject;
  }

  // Update is called once per frame
  void Update () {
    if (Input.GetMouseButtonDown (0)) {
      GameObject projectile = Instantiate (prefab) as GameObject;
      projectile.transform.position = attachmentPoint.position + Camera.main.transform.forward * 2;
      Rigidbody rb = projectile.GetComponent<Rigidbody> ();
      rb.velocity = Camera.main.transform.forward * 40;
      Destroy (projectile, 2.5f);
    }
  }
}

sentences:
What's the most efficient way to send a users keypresses to the server? So I've been coding a little project in JS recently, using node.js and socket.io to create a server, and HTML5 canvas to draw the client side. The user receives info from the server every 20ms, and the client interprets the data and displays it. If the user presses a key on the keyboard, it stores this information and sends it to the server instatly - so currently, the code is basically 'is keyboard pressed? if yes, send data to server'.

This has all worked great so far, however recently I increased the servers enemies (AI objects) from only 10 to a whopping 100... this lagged the server. Although I will work out enemy spawning efficiency later, the problem that immediately became apparent is that the user's character moved slower when the server was lagging. This meant that chasing enemies were able to easily catch up to the character and kill him, whereas usually the character could run away with relative ease.

This leads me to the question, what is the most efficient way that the server can interpret the keypresses of the user, and ensure that even if it is lagging that enemies will move at the same proportional speed to if the server wasn't lagging.

Sorry if this question is long-winded, any advice or help would be greatly appreciated. I assume that the same methodologies should apply from different coding languages, so if you have a vague idea how it works in a language you've used... please still share! :)

Thanks,

Cameron

sentences:
SteamVR No Longer Opening With Unity Projects I'm trying to get Unity to open/utilize SteamVR for development. Everything was working fine until today, but now Unity does not use SteamVR.
I did not make any changes to SteamVR recently, and I get the same results on multiple projects and Unity installs. I also tried rebooting.
It looks like Windows pushed an update today for KB4023057 but I can't uninstall it. It's not found within uninstall updates, not in add/remove programs, and even using command prompt wusa /uninstall /kb:4023057 results in "KB4023057 is not installed." So it seems I'm stuck with it.
Any other ideas to either try to uninstall the update or else to somehow get SteamVR working in Unity again?

sentences:
Map a normal image to a cubemap How can I map a normal non T form image to a cube map?

and if there is no manner with which to do this, is it possible to, via DX11, split the image, as the image may be generated on the fly?

Cheers.

sentences:
Can't import shaders/textures to Godot from Blender 2.8 I'm using this shader for my models and then i import them like this
This is the original model in blender:

the result in godot:

I think i might have missed some step but not sure of which one, i followed the tutorial video on how to import and other similar guides but the results is the same. Any ideas of what i'm doing wrong?
Looks like my model not importing shader and textures cor

sentences:
How to load geometry/object/scene created in Clara.io with Three.js Does anybody know how to load anything created in Clara.io into your Three.js scene?

Clara.io allows export of ThreeJS geometry, object or scene. I tried all those in combination with all THREE loaders (JSONLoader, SceneLoader, GeometryLoader, etc.) without any success (Parse function inside of three.js fails to process json structure).

Structure of exported file from Clara.io looks to be completely different from what Three.js loaders expect. Can this be achieved in any way or is Clara export simply useless at this point?

I am talking three.js v.65 in combination with current version of Clara.io

sentences: Loading multi-texture 3ds c++ I have a question about loading 3ds using this tutorial. I want to use more than one texture on the model (because here all the models have more than one) but it seems that this library can't do that. Do you know any other alternatives or a way to edit this existing library to reach my aim?

sentences:
Connecting tiles to make a large image based on text file If I am building my level from a text file

0,0,0,0,0
0,1,0,1,0
0,2,1,0,0
0,0,0,0,0

and I want to draw a large image, how do I go about doing that? do I take the image, separate it in tiles (the same size as the other ones) and then add a value to each image

0,1,2,3,4,5,6
0,7,8,9,10,11,12

or is there another way to do this?
Lets say I want to add a house, or a something like this ship?

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:
Update function in html5 canvas game isn't working properly Jsfiddle :  http://jsfiddle.net/seekpunk/6eeKH/15/

the code :

if (this.collection.length > 0) {
    if (((this.collection[0].blockX + this.collection[0].blockW) >= cw)
       || (this.collection[0].blockX <= 0)) {
        this.collection[0].blockSpeed *= -1;
    }
    this.collection[0].blockX += this.collection[0].blockSpeed;
}

the first block from top is drawn twin and i can't figure out why i guess the  problem is in drawing the levels can someone please help me figure out what i did wrong in my code

sentences: Looking for architectures to develop massive multiplayer game server Hello all Where can I find architectures and examples of building massive multiplayer game server Does the does the concept of building it on top of libenevt is right ? or I need to think more on thread per connection ? im targeting to web players playing from flash / html5 clients . Thanks

sentences:
How to display and hide complex object part in 2.5D I am working on a 2.5D mechanical app. I use 3D software like Blender to render the 3D model to create the 2D assets for the 2D game engine (which's cocos-creator , but it doesn't matter for this case).

How can I hide a part of object which's covered by another object with in the game engine? A sort of mask or something else, I am not sure.

For it has hundreds of object in the scene, like a car engine with all parts. So the solution I am looking for need to be automatic or half-automatic generated by 3D software (eg.Blender, etc), instead of full manual work like using Photoshop to create the mask.

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:
Taking a 2D slice of a 3D volume I have a regular 3D polygon and I'd like to display 2D slices of it.

What is the best way to achieve this? (Preferrably in OpenGL, but a general algorithm/tecnique would be good as well).

I've already tried by using a camera with narrow z-near/z-far values, but that doesn't seem like a good solution. I don't know if this could be implemented with a custom shader.

Edit: An example of what I'd like to do:

Kind of the opposite of what is commonly known as 'Volume Rendering'.

Here's an older example: http://answers.unity3d.com/questions/941826/2d-slice-from-a-3d-cross-section-slice.html

sentences:
LibGDX - Wait for action to complete With Scene2D, in the act() method of a Group, under certain circumstances I add actions to some children (eg a moveTo, or a fadeOut), which last a few tenths of seconds. Now I need ALL these action to complete before I start running the code in act() again. Right now I'm using a kludge with a timer, I set a variable actionRunTime before attaching the actions to children, set to the value of how long all actions should take to complete, then in act() I do

public void act(float delta){

  super.act(delta);  // to have the actions run on children

  actionRunTime -= delta;

  if (actionRunTime >= 0) return;

  // ... code to run when no action is running

This looks terrible to me. Is there some cleaner way?

sentences:
How can I clear explosions in my function? Hi I have a function to place bombs, and a for loop that places explosions on the tiles where possible.

My problem is that I can't remove the explosions after a while. I've tried everything I can come up with so now I turn here as a last resort.

The function looks like this:

function Bomb(){
var placebomb = false;
    if(placeBomb && player.bombs != 0){
        map[player.Y][player.X].object = 2;
        var bombX = player.X;
        var bombY = player.Y;
        placeBomb = false;
        player.bombs--;
        setTimeout(explode, 3000);
    }
    function explode(){
    var explodeNorth = true;
    var explodeEast = true;
    var explodeSouth = true;
    var explodeWest = true;

    map[bombY][bombX].explosion = 1;
    delete map[bombY][bombX].object;

    for(i=0;i<=player.bombRadius;i++){
        if(explodeNorth && map[bombY-i][bombX]){
            if(!map[bombY-i][bombX].wall){
                if(!map[bombY-i][bombX].object){
                    map[bombY-i][bombX].explosion = 1;
                }
                else
                    var explodeNorth = false;
                    delete map[bombY-i][bombX].object;
                    map[bombY-i][bombX].explosion = 1;
            }
            else
                var explodeNorth = false;
        }

        if(explodeEast && map[bombY][bombX+i]){
            if(!map[bombY][bombX+i].wall){
                if(!map[bombY][bombX+i].object){
                    map[bombY][bombX+i].explosion = 1;
                }
                else
                    var explodeEast = false;
                    delete map[bombY][bombX+i].object;
                    map[bombY][bombX+i].explosion = 1;
            }
            else
                var explodeEast = false;
        }

        if(explodeSouth && map[bombY+i][bombX]){
            if(!map[bombY+i][bombX].wall){
                if(!map[bombY+i][bombX].object){
                    map[bombY+i][bombX].explosion = 1;
                }
                else
                    var explodeSouth = false;
                    delete map[bombY+i][bombX].object;
                    map[bombY+i][bombX].explosion = 1;
            }
            else
                var explodeSouth = false;
        }

        if(explodeWest && map[bombY][bombX-i]){
            if(!map[bombY][bombX-i].wall){
                if(!map[bombY][bombX-i].object){
                    map[bombY][bombX-i].explosion = 1;
                }
                else
                    var explodeWest = false;
                    delete map[bombY][bombX-i].object;
                    map[bombY][bombX-i].explosion = 1;

            }
            else
                var explodeWest = false;
        }

    }
    player.bombs++;
    }
}

If anyone can think of a good way to remove the explosion after a delay please help.

sentences:
Can I Debug.Log() on Android without all the callstack spam? I get this:

I/Unity   ( 1908): Serialized file length: 754 bytes.
I/Unity   ( 1908): UnityEngine.Debug:Internal_Log(Int32, String, Object)
I/Unity   ( 1908): UnityEngine.Debug:Log(Object)
I/Unity   ( 1908): SerializeTest:Test() (at Z:\Pong\Devel2010\Src\UnityGames\BhvrDemo\BinarySerialization\Assets\Script\SerializeTest.cs:64)
I/Unity   ( 1908): UnityEngine.Events.InvokableCall:Invoke(Object[])
I/Unity   ( 1908): UnityEngine.Events.InvokableCallList:Invoke(Object[])
I/Unity   ( 1908): UnityEngine.Events.UnityEventBase:Invoke(Object[])
I/Unity   ( 1908): UnityEngine.Events.UnityEvent:Invoke()
I/Unity   ( 1908): UnityEngine.UI.Button:Press() (at C:\BuildAgent\work\d63dfc6385190b60\Extensions\guisystem\guisystem\UI\Core\Button.cs:36)
I/Unity   ( 1908): UnityEngine.UI.Button:OnPointerClick(PointerEventData) (at C:\BuildAgent\work\d63dfc6385190b60\Extensions\guisystem\guisystem\UI\Core\Button.cs:45)
I/Unity   ( 1908): UnityEngine.EventSystems.ExecuteEvents:Execute(IPointerClickHandler, BaseEventData) (at C:\BuildAgent\work\d63dfc6385190b60\Extensions\guisystem\guisystem\EventSystem\ExecuteEvents.cs:52)
I/Unity   ( 1908): UnityEngine.EventSystems.ExecuteEvents:Execute(GameObject, BaseEventData, EventFunction`1) (at C:\BuildAgent\work\d63dfc6385190b6

but I would like this:

I/Unity   ( 1908): Serialized file length: 754 bytes.

sentences:
Reusable component design I'm working on an engine for my game (in C++). I've done the graphics related stuff and I've started working on UI (user interface). When I was working on buttons I've realized that hardcoding every kind of button would not be possible (or would be too many classes) as I have buttons with only labels, with colored backgrounds, with texture backgrounds and so on...

So I think what I need are Components. I just build the button I want:

UIButton* btn = new UIButton();
btn->AddRenderComponent(new DrawRectComponent(...));
btn->AddRenderComponent(new DrawStringComponent(...));
btn->AddLogicComponent(new SendEventOnClickComponent(...));

My problem is that I don't know how to tell the component objects what fields should they use from the UI elements? For example position and size (which could change dinamically). Should I use references for example?

Also it would be good if I could not only use this in the UI, but a similar component system could be used in other parts of the engine (at entities for example).

sentences:
What are the hidden cost while deploying game with Unity3D? I just started learning Unity3D. I created a small 2D game, and I want to host for Windows, iPhone, iPad, Android, Windows 8, Xbox and even on websites.

I created it using free Unity3D editor. Now I want to host all these game on my website.

I will purchase iPhone, Android, and Windows 8 developer accounts. Apart from that, do I need to purchase any license in order to deploy the game on my website?

I can lots of license here: https://store.unity3d.com/

If I later purchase Unity Pro, then do I need to purchase any extra licenses?

And will that Unity logo always appear while starting the game?

sentences:
2D object grids to a dictionary I'm pretty new to Unity and trying to figure out what a good way of transferring objects in a grid to a dictionary would be.

For example, if i have a grid of 2D objects (squares) such as below

-------------
| 0 | 1 | 2 |
-------------
    | 3 | 4 |
    ---------
    | 5 |
    -----

I would expect my dictionary to be something like

myDict =
{
 {"0", 1},
 {"1", 0, 2, 3},
 {"2", 1, 4},
 {"3", 1, 4, 5},
 {"4", 2, 3},
 {"5", 3}
}

What i want to do is generate a random grid and then make a dictionary of neighbors of each grid piece that i can later use for other purposes.

Being new to Unity, i'm not really sure what a good way of this would be.

sentences: Is resource management a good idea when dealing with animations? New to the Unity environment here and I have a question concerning how to efficiently manage computer resources in a top down 2D game.  I have a large area that looks like a 2d rpg from the 90's and there are many water "tiles" that have an animation that plays constantly.  My question is: would it be a good idea to attach a script to the said water tiles to make them stop animating while the camera is not showing them?  The same question could be applied to any off screen animation that is currently running.  I guess what I'm not sure about is whether the constant testing for visibility is more "expensive" than the actual animation running.

sentences:
Unity get reference of GameObject under another GameObject I am trying to get reference of the object underneath my Player.

I don't know if I am aproaching this correctly. Right now, I have a player simply put in the scene, like this:

Then I am trying to get reference of it like this (does not work)

public void CheckTileUnder()
{
    Vector3 halfExtents = new Vector3(0f, -1 / 2.0f, 0f);
    Collider[] colliders = Physics.OverlapBox(transform.position, halfExtents);

    foreach (Collider item in colliders)
    {
        Tile tile = item.GetComponent<Tile>();
        if (tile != null)
        {
            RaycastHit hit;

            if (Physics.Raycast(tile.transform.position, Vector3.down, out hit, 1))
            {
                currentTile = tile;
            }
        }
    }
}

Another aproach that I thought of would be to put the player under the Tile like this: Then I guess I would have to change parents like suggested in one of the answers here?

How should I select the Tile under the Player?

sentences:
Box2d :What is the best approach to build static Box2d smooth curve line i want to know what is the best approach to simulate smooth curved line as static body
it will be like path for car to drive .
something like this :
http://www.freeriderhd.com/

how does its box2d static body are constructed ?
Thanks

sentences:
How to print Depth to a Texture2D and then read it in the next pass on a shader in DirectX11 I'm programming a two-pass effect in DirectX 11 (SharpDX). It's supposed to write the depth to a texture in the first pass and then use that texture to extract data on the second one in the pixel shader.

What I get is a white screen, with nothing but the interface and I don't know why nothing is being printed. What could be the problem? I would say I should get at least something from the Depth Texture.

This is how I'm setting the depth texture values:

this.depthBuffer = new Texture2D(device, new Texture2DDescription()
        {
            Format = Format.R32_Typeless,
            ArraySize = 1,
            MipLevels = 1,
            Width = (int)host.ActualWidth,
            Height = (int)host.ActualHeight,
            SampleDescription = new SampleDescription(1, 0),
            Usage = ResourceUsage.Default,
            BindFlags = BindFlags.DepthStencil | BindFlags.ShaderResource,
            CpuAccessFlags = CpuAccessFlags.None,
            OptionFlags = ResourceOptionFlags.None,
        });

this.depthBufferShaderResourceView = new ShaderResourceView(this.device, this.depthBuffer, new ShaderResourceViewDescription()
        {
            Format = Format.R32_Float,
            Dimension = ShaderResourceViewDimension.Texture2D,
            Texture2D = new ShaderResourceViewDescription.Texture2DResource()
            {
                MipLevels = 1,
                MostDetailedMip = 0,
            }
        });
var depthStencilDesc = new DepthStencilStateDescription()
        {
            DepthComparison = Comparison.LessEqual,
            DepthWriteMask = global::SharpDX.Direct3D11.DepthWriteMask.All,
            IsDepthEnabled = true,
        };

And here is how I sample the depth in the .fx file:

int3 posTex = int3(input.p.xy, 0);
float depthPixel = DepthTexture.Load(posTex);
float4 color = float4(depthPixel, depthPixel , depthPixel, 1.0f );
return color;

And here the way I'm now setting the Depth Buffer stencil view as a Render Target in 2 passes. In the first I try to set the depthstencilview as a target. In the second pass I'm trying to set teh depth texture as a shader resource to read from it.

this.device.ImmediateContext.InputAssembler.SetVertexBuffers(0, new VertexBufferBinding(this.vertexBuffer, LinesVertex.SizeInBytes, 0));

// PASS 0
this.device.ImmediateContext.OutputMerger.SetTargets(depthBufferStencilView);
this.device.ImmediateContext.ClearDepthStencilView(this.depthBufferStencilView,     DepthStencilClearFlags.Depth | DepthStencilClearFlags.Stencil, 1.0f, 0);
this.technique.GetPassByIndex(0).Apply(this.device.ImmediateContext);
this.device.ImmediateContext.DrawIndexed(this.geometry.Indices.Length, 0, 0);

// PASS 1
this.device.ImmediateContext.OutputMerger.ResetTargets(); // unbinding the depthStencilView

this.device.ImmediateContext.InputAssembler.SetVertexBuffers(0, new VertexBufferBinding(this.vertexBuffer, LinesVertex.SizeInBytes, 0));
this.depthStencilShaderResourceVariable = effect.GetVariableByName("DepthTexture").AsShaderResource();
this.depthStencilShaderResourceVariable.SetResource(this.depthBufferShaderResourceView);
this.technique.GetPassByIndex(1).Apply(this.device.ImmediateContext);
this.device.ImmediateContext.DrawIndexed(this.geometry.Indices.Length, 0, 0);

Finally, this is how I set the two passes in the .fx file:

technique11 RenderMyTechnique
{
pass P0
{

SetDepthStencilState( DSSDepthLessEqual, 0 );
SetVertexShader     ( CompileShader( vs_4_0, VShader() ) );
    SetHullShader       ( NULL );
    SetDomainShader     ( NULL );
    SetGeometryShader   ( NULL  );
SetPixelShader      ( NULL );
}

pass P1
{
SetDepthStencilState( DSSDepthLessEqual, 0 );
SetVertexShader     ( CompileShader( vs_4_0, VShader() ) );
    SetHullShader       ( NULL );
    SetDomainShader     ( NULL );
    SetGeometryShader   ( CompileShader( gs_4_0, GShader() ) );
SetPixelShader      ( CompileShader( ps_4_0, PShader() ) );
}
}

sentences:
How can I embed music in my XNA .exe? I'm trying to embed music in my XNA game's .exe (with resources) but compiling them as a sound effect stores the music in uncompressed form, which results in a 16 MB .exe.

I can compress my music with wma, and compile it as a song, which unfortunately (in my case) leaves the music as a plain .wma file.

Basically, I want a single standalone .exe, with my content stored as resources. If I could compile a wma song to a single .xnb content file, I could embed that file. I don't know how to do that without uncompressing the music. It might be possible to keep the wma file separate and store it in the resources, but I haven't figured out how to get the .xnb content file to work with it.

In order of preference:

Can I compile a wma to a xnb without decompressing it?
Can I store the wma in the exe resources and load it into a song?
Is there any other way to decrease the size of an exe with embedded music?

EDIT: The comments mentioned using XACT. This seems like a good solution. I have another question. Since the XACT sounds are not loaded with Content.Load, it will not automatically look in the application resources (I have Content set up to do so). Is there a way to load XACT sounds from resources? If not, I will accept having to load content from separate files.

sentences:
Platforms for sharing content and expertise Are there any platforms / sites where people can share expertise in game development and where you can share (either payed or free) digital content (like images, sounds, animations but also frameworks or libraries) to be used in games?
I'd also like the possibility to contact users and request specific pieces of content.

I'd like to start out as an indie developer and have programming skills but I lack the experience and time to create ingame artwork and sound.
Is there any site where I could locate other people (artists mostly) who would want to work on a game for free?

I know I can get most technical questions answered on this site and I have some contacts but I'm affraid this won't be enough.

sentences: Unity 5.. How to Block interaction below panel? New to Unity...Is there an easy way to block all interaction underneath a panel that I would have stationary at top of my game. There will be a pause button in that panel and some game info. Just don't want the mouse input or clicks to go through the panel and interacting with game below.

sentences:
GL11.glTexCoord2f(1.0f, 1.0f); 1.0f screws the image up I recently started using LWJGL in my java programs for the graphics. I'm currently working on a simple game, which I make, to get better at this kind of programming. I ran into some trouble when adding textures to my 2D game.

To show my problem, I have made a simple program which shows one quad with a texture.
This is how the texture looks:

http://i1197.photobucket.com/albums/aa428/GWigWam/LWJGL%20problem/Test.png

However my program shows it like this:

http://i1197.photobucket.com/albums/aa428/GWigWam/LWJGL%20problem/showsme.png

You see the right and the bottom have some strange line hanging there. the shown picture is 100x100 from the top left to the little pixel right down.

The code used for drawing this is:

texture1.bind();
GL11.glBegin(GL11.GL_QUADS);
   GL11.glTexCoord2f(0f,0f);
   GL11.glVertex2f(100, 200);
   GL11.glTexCoord2f(1f,0f);
   GL11.glVertex2f(200, 200);
   GL11.glTexCoord2f(1f,1f);
   GL11.glVertex2f(200, 100);
   GL11.glTexCoord2f(0f,1f);
   GL11.glVertex2f(100, 100);
GL11.glEnd();

This code is called before drawing:

    GL11.glEnable(GL11.GL_TEXTURE_2D);
    GL11.glClearColor(0.0f, 0.0f, 0.0f, 0.0f);
    GL11.glEnable(GL11.GL_BLEND);
    GL11.glBlendFunc(GL11.GL_SRC_ALPHA, GL11.GL_ONE_MINUS_SRC_ALPHA);
    GL11.glOrtho(0, width, 0, height, -1, 1);

When I use

GL11.glTexCoord2f(0.9f,0.9f);

so 0.9f instead of 1.0f the weird lines don't appear. But that's no real solution because I want to use the whole texture not 90% of it.

I hope I did not ask something which has been asked before, I really couldn't find I using google, it is however quite hard to think of the right search words.

sentences:
Whats the best way to light up a scene in unity? What I want is a darkish scene with like neon style lights
Currently is use the bloom post processing effect but sometimes it doesn't render well on my main camera and looks not as good as it does in the scene

My game view with main camera -

My aim is to get the lighting similar to look like Brackeys party killer game
How may I achieve this

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:
How do you keep the gameplay and music in sync in a rhythm game? What's the best way to program a rhythm based game in XNA? (Some sort of game like Dance Dance Revolution) Would you use the built in GameTime? What logic would you use to make sure the game constantly stays in sync to the music? Any tips would be much appreciated!

What I am basically asking is how you would keep the gameplay in sync with the music. For example in DDR how would I correctly sync the arrows to the beat of the music?

sentences:
What am I suppose to use instead of Unity Resources if I have to load and unload sprites at runtime? I recently read this guide posted in the Unity website about Resources. It is clear from the get-go that it is discouraged to use Resources unless you are prototyping something.

My game is like a 2D RPG, and it has over five thousand monster sprites (yes, a lot). As far as I'm concerned, it makes perfect sense to put all the sprites in the Resources folder, and just load the ones that I need (using their name) when a battle starts and then unload them.

The Unity article makes one point that might support my approach:

  Generally required throughout a project's lifetime

Well, I'm not so sure about it - in a single game session it's entirely possible that thousands of those sprites will not be used at all as the player simply doesn't encounter those monsters.

The article goes on to talk about why is it discouraged to use Resources:

  This operation is unskippable and occurs at application startup time
  while the initial non-interactive splash screen is displayed.
  Initializing a Resources system containing 10,000 assets has been
  observed to consume multiple seconds on low-end mobile devices, even
  though most of the Objects contained in Resources folders are rarely
  actually needed to load into an application's first scene.

And it is indeed true - my game does in fact take several seconds to load on some low-end devices, especially Android ones. It is also true that none of those sprites of mine need to be loaded at startup.

So I am willing to stop using Resources - but I am at a loss now: the article doesn't mention a reasonable alternative to this.

Here are the (unreasonable) approaches that I have thought of:

  Create a component with a collection of all the sprites, that way they are all loaded without using Resources.

Yeah but I have five thousand sprites. This sounds extremely tedious.

  Same as the previous suggestion, but use Texture Packer or something similar to pack lots of sprites into different sheets - this way I have to do less work.

My sprites are large and packing them won't be a huge help - I'd still end up with a thousand or so sheets.

My point is, I just can't have 5000+ sprites preloaded. I need to load them at runtime via  Resources, but Unity clearly discourages it. Is there a solution to this?

sentences:
How can I test if one point can "see" another point. (XNA) I want to test if my enemy can see the player, however I want this to be pixel-perfect.

I already have all of the solid objects drawing into a separate render state. It should be noted that every solid object is changing and warping all over the place constantly. I cannot check individual walls because a distortion effect is applied to all of them. The walls blend together.

Essentially it would lerp between the enemy's position and the player's position and see if there are any pixels that have an alpha value of greater than 0.
The rotation of the enemy and the player do not matter.

All of my attempts at doing this on the cpu have worked, however they slowed the game down dramatically. All of my attempts at going this on the gpu just didn't work at all.

What is the most efficient way of doing this?
Is there any way to do this in the gpu?

Edit: There is no geometry at all. The walls are completely amorphous.

I did not realize that global variables were constant in hlsl until after I wrote this:

sampler s0;
texture tex;
sampler tex_sampler = sampler_state{Texture = tex;};

float2 screenSize;
float2 from;
float2 to;
float2 impact;
int impacted;

float4 PixelShaderFunction(float2 coords: TEXCOORD0) : COLOR0
{
    from /= screenSize;
    to /= screenSize;

    impacted = 0;

    for (float i = 0; i < 1; i += 1.0f / length(to - from))
    {
        float2 test = lerp(from, to, i);

        if ( (tex2D(tex_sampler, test)).a )
        {
            impacted = 1;
            impact = test * screenSize;
            break;
        }
    }

    return tex2D(s0, coords);
}

technique Technique1
{
    pass Pass1
    {
        PixelShader = compile ps_2_0 PixelShaderFunction();
    }
}

The solid pixels would be passed into the "tex" variable.
I would read the "impacted" and "impact" variables after one pass on a 1x1 texture.
hlsl just doesn't want to let me do this.
Apparently global variables are implicitly constant.
Is there another way of doing this?

on the variable syntax page it says "Global variables are considered const by default (suppress this behavior by supplying the /Gec flag to the compiler)."
How do I add the /Gec flag to the compiler?

I also wrote this, but it slowed the game down:

private bool CanSee(Vector2 from, Vector2 to)
{
    Color[] t = new Color[target_solid_final.Width * target_solid_final.Height];
    target_solid_final.GetData(t);

    for (float i = 0; i < 1; i += 8.0f / (to - from).Length())
    {
        Vector2 test = Vector2.Lerp(from, to, i);
        Point test_p = new Point((int)test.X, (int)test.Y);

        if (viewportRect.Contains(test_p) &&
            t[test_p.X + test_p.Y * target_solid_final.Width].A > 0)
            return false;
    }

    return true;
}

sentences:
DirectX 9.0c and C++ GUI Well, I'm trying to code a gui for my engine, but I've got some problems.
I know how to make a UI overlay but buttons are still black magic for me. Anything I tried was to compilcated ( if it goes big ). To Example I tried to look if the mouse position is the same as the Pixel that is showing the button. But If I use some bigger areas it's getting to complicated. Now I'm searching for a Tutorial how to implement your own gui.
I'm really confused about it.
Well I hope you have/ know some good tutorials.

By the way, I took a look at the DXUTSample, but it's to big to get overview.

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:
Arrays for a heightmap tile-based map I'm making a game using in C# and Javascript that uses a map which has tiles, corners and borders. Here's a graphical representation:

I've managed to store tiles and corners in memory but I'm having trouble getting the borders structured.

For the tiles, I have a Map Width * Map Height sized array. For corners I have (Map Width + 1) * (Map Height + 1) sized array.

I've already made up the math needed to access corners from a tile, but I can't figure out how to store and access the borders from a single array.

Tiles store their type (and other game logic variables) and via the array index I can get the X and Y coordinates. From this tile position it is possible to get the array index of the corners (which store the Z index).
The borders will store a game object and accessing corners from only border info would be also required.

If someone even has a better way to store these for better memory and performance I would gladly accept that.

sentences:
Dealing with 2D pixel shaders and SpriteBatches in XNA 4.0 component-object game engine? I've got a bit of experience with shaders in general, having implemented a couple, very simple, 3D fragment and vertex shaders in OpenGL/WebGL in the past. Currently, I'm working on a 2D game engine in XNA 4.0 and I'm struggling with the process of integrating per-object and full-scene shaders in my current architecture.

I'm using a component-entity design, wherein my "Entities" are merely collections of components that are acted upon by discreet system managers (SpatialProvider, SceneProvider, etc). In the context of this question, my draw call looks something like this:

SceneProvider::Draw(GameTime) calls...
ComponentManager::Draw(GameTime, SpriteBatch) which calls (on each drawable component)
DrawnComponent::Draw(GameTime, SpriteBatch)

The SpriteBatch is set up, with the default SpriteBatch shader, in the SceneProvider class just before it tells the ComponentManager to start rendering the scene. From my understanding, if a component needs to use a special shader to draw itself, it must do the following when it's Draw(GameTime, SpriteBatch) method is invoked:

public void Draw(GameTime gameTime, SpriteBatch spriteBatch)
{
    spriteBatch.End();
    spriteBatch.Begin(SpriteSortMode.Immediate, BlendState.AlphaBlend, null, null, null, EffectShader, ViewMatrix);

    // Draw things here that are shaded by the "EffectShader."

    spriteBatch.End();
    spriteBatch.Begin(/* same settings that were set by SceneProvider to ensure the rest of the scene is rendered normally */);
}

My question is, having been told that numerous calls to SpriteBatch.Begin() and SpriteBatch.End() within a single frame is terrible for performance and creates a number of special cases for my drawing logic, is there a better way to do this? Is there a way to instruct the currently running SpriteBatch to simply change the Effect shader it is using for this particular draw call and then switch it back before the function ends?

sentences:
Trying to find a function to calculate attribute changes in a game I'm coding a game where after every year depending on results the attributes of characters change. The game is a movie business simulator and here is a example of the ugly code I have in place now:

        if (movie.Reviews.Avg > 8.5f)
        {
            movie.Producer.Reputation += 6f / movie.Producer.Reputation;
            return;
        }
        else if (movie.Reviews.Avg > 7.5f)
        {
            movie.Producer.Reputation += 5f / movie.Producer.Reputation;
            return;
        }
        else if (movie.Reviews.Avg > 6.5f)
        {
            movie.Producer.Reputation += 4f / movie.Producer.Reputation;
            return;
        }
        else if (movie.Reviews.Avg > 5)
        {
            movie.Producer.Reputation += 1f / movie.Producer.Reputation;
            return;
        }
        else if (movie.Reviews.Avg > 4.5)
        {
            return;
        }
        else if (movie.Reviews.Avg > 4)
        {
            movie.Producer.Reputation -= movie.Producer.Reputation / 6f;
            return;
        }
        else if (movie.Reviews.Avg > 3)
        {
            movie.Producer.Reputation -= movie.Producer.Reputation / 5f;
            return;
        }
        else if (movie.Reviews.Avg > 2)
        {
            movie.Producer.Reputation -= movie.Producer.Reputation / 4f;
            return;
        }
        else
        {
            movie.Producer.Reputation -= movie.Producer.Reputation / 3f;
            return;
        }

Few problems I have with this code:
1. Reputations balloon. Good AI producers make good choices so their movies get good reviews and their reputation goes even higher.
2. Because reputations keep growing the absolute changes in attributes get smaller and moving up in ranks gets way too slow and hard.

What I am looking from the function:
1. Range is 0-10.
2. At the top of the range growth is slow even with great reviews, but if your movie gets bad reviews the decline is sharp. And the opposite for the bottom of the range.

sentences:
How to organize GameObjects into logical groups in a Unity Scene? Obviously there are a Scene hierarchy, but the problem is that the scene hierarchy was not meant for organizing GameObjects because parent GameObjects affect the transformation of their children.
For example what can one do to select all the decoration GameObjects? Some might be children of non-decoration GameObjects and buried very deep in the scene hierarchy while others might be root GameObjects.
One solution could be to add a Tag, but since Unity restrict you to only one tag per GameObject, that makes the usage of tags pointless as I have different overlapping categories.
Another solution would be to name objects but that is very error prone as a typing mistake will loose my GameObject. Also the team need to memorize possible tokens in the name which allow even more room for human errors.
Another solution would be to add an identifying Component, similar to how tags work in most other applications. But will there be a penalty in build time/runtime in a large project because of the additional Scripts (Components)?
Any other ideas how I can organize my Scene so that I can easily select a logical group of GameObjects from different unrelated parents in the editor Scene or Hierarchical view?

sentences:
How to generate smoother Perlin Noise? So, recently I've been learning procedural generation stuff (Perlin noise specifically) and I've kind of hit a wall.

This is the result that I've seen everyone get, but this is what I'm getting,

This is my code, (I'm using python):

import random
import math
import PIL.Image

class Noise:

    def __init__(self, x, y):
        self.x = x
        self.y = y

    def lerp(self, start, stop, t):
        return start*(1-t) + (stop*t)

    def smoothstep(self, t):
        return 3*(t**2) - 2*(t**3)

    def gradients(self):
        grads = []
        for _ in range(4):
            x = random.randrange(0, 361)
            y = random.randrange(0, 361)
            grads.append((math.cos(x), math.sin(y)))
        return grads

    def cvectors(self):
        botleft = (self.x, self.y)
        botright = (self.x-1, self.y)
        topleft = (self.x, self.y-1)
        topright = (self.x-1, self.y-1)
        cvecs = [botleft, botright, topleft, topright]
        return cvecs

    def makenoise(self):
        dot = []
        grads = self.gradients()
        cvecs = self.cvectors()
        for i in range(4):
            (x, y) = cvecs[i]
            (a, b) = grads[i]
            dot.append((x*a)+(y*b))
        st = self.lerp(dot[0], dot[1], self.smoothstep(x))
        uv = self.lerp(dot[2], dot[3], self.smoothstep(x))
        stuv = self.lerp(st, uv, self.smoothstep(self.y))
        return stuv

    size = 128
    img = PIL.Image.new('L', (size, size))
    for x in range(size):
        for y in range(size):
            perlin = Noise(random.uniform(0, 1), random.uniform(0, 1))
            img.putpixel(tuple([x, y]), perlin.makenoise())
    img.save("nois.png")

This is just a guess, but I feel like it's a scaling issue. Thanks in advance, and apologies, as well, for the horrible code.

sentences:
UK Indie studio registration I'm from the UK and I've just about completed making an indie game and had some interest from several online retailers that sell games. This requires me filling in a basic contract.

I'm just one guy who works from home as a hobby, I go by a studio name for my game solely because that's the norm.

Do I need to register my 'company' name before I can go any further?

EDIT: I'm already registered as self employed from prior work in a different field

sentences:
Do I need TCP socket? My game uses UDP sockets to stream updates between server and client and I've also made a reliable channel that resends messages if there's no response and makes sure same message isn't processed multiple times.

But TCP is specifically designed to be reliable and the people who made it probably have more experience than me. So would it be good to use TCP to send commands such as "attack", "play animation", etc. instead of my UDP implementation?
(Of course I mean TCP sockets that don't delay sending the data (Nagle algorithm))

sentences:
How do you properly implement level boundaries in a physics room? I have an issue with creating a proper boundary in GameMaker Studio when using a physics enabled room.

My room has a gravity of 0, as it is in Space. My player object has the default values, but a friction of 10 with a box shaped collision shape. I also use View0 on a 1280x720 room with a 1280x720 view. That is to be able to do screen shakes and other neat effects.

I really struggle with containing my player object properly to the room. When I use a collision with view0_boundary and add

phy_position_x = phy_position_previousx;
phy_position_y = phy_position_previousy;

then my ship would get stuck at the screen borders very frequently.

I also tried adding some sprites that block the player off the room and created a sprite, 1280x720 and spawned them at the borders. I gave my player empty events for them and set their density to 0, making them static. However, this resulted in the same problem, I got stuck in them.

I need a smooth solution for this, obviously, to have a fun experience. I have this problem quite for a while, so please help me understanding how to do this properly.

sentences:
How do I position a 2D camera in OpenGL? I can't understand how the camera is working.
It's a 2D game, so I'm displaying a game map from (0, 0, 0) to (mapSizeX, 0, mapSizeY).

I'm initializing the camera as follow :

Camera::Camera(void)
  : position_(0.0f, 0.0f, 0.0f), rotation_(0.0f, 0.0f, -1.0f)
{}

void            Camera::initialize(void)
{
  glMatrixMode(GL_PROJECTION);
  glLoadIdentity();
  glTranslatef(position_.x, position_.y, position_.z);
  gluPerspective(70.0f, 800.0f/600.0f, 1.0f, 10000.0f);
  gluLookAt(0.0f, 6000.0f, 0.0f,
            0.0f, 0.0f, -1.0f,
            0.0f, 1.0f, 0.0f);
  glMatrixMode(GL_MODELVIEW);
  glLoadIdentity();
  glEnable(GL_DEPTH_TEST);
  glDepthFunc(GL_LEQUAL);
}

So the camera is looking down. I currently see the up right border of the map in the center of my window and the map expand to the down left border of my window. I would like to center the map.

The logical thing to do should be to move the camera to eyeX = mapSizeX / 2 and the same for z. My map has 10 x 10 cases with CASE = 400, so I should have :

gluLookAt((10 / 2) * CASE /* = 2000 */, 6000.0f, (10 / 2) * CASE /* = 2000 */,
            0.0f, 0.0f, -1.0f,
            0.0f, 1.0f, 0.0f);

But that doesn't move the camera, but seems to rotate it.

Am I doing something wrong?

EDIT :

I tried that:

gluLookAt(2000.0f, 6000.0f, 0.0f,
            2000.0f, 0.0f, -1.0f,
            0.0f, 1.0f, 0.0f);

Which correctly moves the map in the middle of the window in width. But I can't move if correctly in height. It always returns the axis Z. When I go up, It goes down and the same for right and left.

I don't see the map anymore when I do :

gluLookAt(2000.0f, 6000.0f, 2000.0f,
                2000.0f, 0.0f, 2000.0f,
                0.0f, 1.0f, 0.0f);

sentences:
Please help me with my 2D isometric tile picking Possible Duplicate:
  How to convert mouse coordinates to isometric indexes?

Okay, I apologise in advance if I make no sense here.

Basically, I've got a simple application that takes in a file and populates a 2D array with tile objects that contain the type of tile, their X and Y values, location of the sprite in a tile map etc. The application then renders this back to front so the depth is sorted. The camera can be dragged about.

for (int i = 0; i < map.length; i++){
        for(int j = 0; j < map[i].length; j++){
            m_MapTest[i][j] = new Tile(((j * Tile.TILE_W / 2) + (i * Tile.TILE_W / 2)),
                      ((i * Tile.TILE_H / 2) - (j * Tile.TILE_H / 2)),
                      map[i][j], 0, map[i][j], 0);

The output:

The numbers are an example of where these tiles are located in the array. Ignore the temporary art.

How do I get the tile index of my mouse click? I've tried about 10 different picking algorithms including matrix translations but I haven't got anywhere. The closest I got was the application picking the right tile in one direction, yet the other axis would start at negative one, the next tile would be zero, the next would be zero then the next would be one and would be correct from there, although I seem to have deleted this in frustration. I feel bad that I don't really have any code for this.

My tile width is 64 and the height is 32, although the sprites are 64x64 and the actual tiles are located at the bottom of the image, if that makes sense... I have done it like this as I am planning on having varied tile heights.

If you need any more information to help me, please let me know. Math is not my strong point.

sentences:
How to do collision resolution with 2d rectangles? I am trying to create a basic side scroll 2D game. There are lots of documentation on collision detection but I find the easiest to use at the moment is just basic AABB Collision. This is my basic outline
Rect old_position = player->rect;
if(key == a) {
    player.x += 5; // move 5 px to right
}
if ... // same for up and left

if(key == s) {
    player.y += 5; // move 5 px down
}

player.y += 4; // move player down, gravity

if(collision_detection(player->rect, rectangle->rect)) { // rect = {x pos, y pos, w idth h eight}
    if(player->rect.y - old_position.y > 0) {
        player->rect.y = rectangle->rect.y - player->rect.h; // if player moved down and collided, move the player to the same pos as object + its own height to get directly above the object.
    } else if(player->rect.y - old_position.y < 0) {
        player->rect.y = rectangle->rect.y + rectangle->rect.h; // move to directly under collided object.
    }
     ...
}

this does not work since if I come from the side, falling down, I get teleported up above the object! There are people who write about things such as roleback / moving back before the collision happened, etc. but there is not straight forward way of doing collision resolution. When I try different methods they might work but I always slide into them if I walk straight into a wall or if I jump and move into a wall in the air while jumping I glitch inside the rectangle, etc, etc.
Does anyone have a blueprint for different 2D collision resolution? I am curious what types there are and what pros and cons there is. The above code is just sample dummy code, so there is no need to critique it. Thanks!

sentences:
How can I generate random levels like in "Square it!" game? In this game, you have a 2d field with some free squares and two colored squares which you can move but only together (they'll move only if the spot is still "free"). And you have to fill whole free space.

Here is a video that demos how the game is played.

How can I generate random game levels like in that game?

sentences:
Relationship between Desktop and Android on LibGDX So I finished tweaking a tutorial called Rain Catcher and I ran the desktop application.  It works fine.  I then proceeded to run the application using the android emulator the game then crashes.

I set up the project using libGDX's project set-up.

Why won't it run properly on the android emulator even though it runs fine on the desktop application?

I don't know if you can see it but if you zoom you would be able to see it easier.

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 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:
What technology is best for building my first game I have started a few game projects in the past, but have never finished anything.  I decided that it was probably because I was writing everything thing from scratch, and just ended up dropping the project once development started taking too long.

I've decided that I want to finish my first game now, and needed some opinions on what sort of middleware would be good to use.  I was hoping that with an engine provided for me, I'd be able to finish the game.

I am most familiar with C++, but do know quite a few other languages as well.

sentences:
Loading Bitmap by name in Android Currently, I'm loading images as follows:

sampleimage= BitmapFactory.decodeResource(context.getResources(), R.drawable.sampleimage);

This automatically chooses the correct image from the drawable-hdpi, drawable-mdpi or drawable-ldpi folders.

How can I load the bitmap using the image name as the string "sampleimage.png"?

sentences:
How to "piece together" an image in code, to render later? I want to make a game in Dart and have decided to use the available port of the JS Phaser game engine. This will be my first time really making a game involving graphics so I guess I'll have a lot to learn as I go along...

The main thing I'm trying to reason about doing in code at the moment is as follows: a key part of the game will be that the grid-based map that will be rendered onscreen will be previously generated to be composed of various "tiles" by an algorithm. You could think of it as analogous to a patchwork quilt I suppose in that regard. So naturally with a map like this I need to have some way of piecing together multiple copies of all my base tile images to form the appropriate map configuration to render. So essentially my question is how would I approach doing this in code so that I can indeed programmatically put together the image of my map and not render it tile-by-tile or something like that.

sentences:
Generating background tiles for a side-scroller with variable player speed I'm currently working on a side-scroller which lets the player alter their speed and I wondered how should I properly generate and control background tiles for such a kind o game. I'm using Flixel but I believe it's a strictly mathematical problem. Here's how I see and do it right now:

actually the player is static but he has a pseudo-velocity, that can be increased and decreased (but there is some minimal pseudo-velocity)
tiles are random so they are not kept in any tilemap - they are generated by an emitter instead
background tiles observe player's pseudo-velocity and alter their own velocity (base velocity is static for a given tile but different tiles can have different base velocities) based on it (so they use their velocity to move in the opposite direction to the player but they also increase/decrease this velocity according to the player to create the illusion of acceleration/deceleration)
the starting velocity of each background tile is maintained no matter what the pseudo-velocity of player is (so when the player accelerates, two given tiles with different velocities approach faster to the player but there is no change in the delta of their velocities, so you can say  that one tile aproaches the player fast and the other even faster :-))
background tiles are generated based on same frequency which is also dependend on the player's pseudo-velocity (so when for example the velocity of all tiles is constant, the distance between consecutive tiles is also constant but when the player accelerates, the frequency of tile generation should increase to retain the same distance between generated tiles)
and the last one trick: when the player is moving at minimal speed their sprite is located exactly on the center of the screen but when they accelerate the sprite floats to the left edge of the screen (proportionally to the current speed but with some lag) so the player can see more and has more time to react

Ok, now it's finally time for the problems! :D

I cannot come up with the proper formula for the tile generation frequency according to the player's pseudo-velocity (when the player accelerates the frequency increases too slowly and the distance between tiles increases, and when the player decelerates the frequency decreases also too slowly and the distance between tiles gets much too small, they begin to clutter)
the problem is also intensified by the last point of the above list - when the pseudo-velocity increases the player's sprite is moved to the left so the tile generation frequency should be additionally increased (and respectively delayed during player's deceleration)

Phew! I think that's a whole description of the problem. Has any of you ever fiddled with such a game mechanic and if yes, have you encountered similar problems and what were your solutions?

If the description is not clear enough, please let my know and I'll provide working example showing above concerns.

sentences:
Balance advantage of having the first turn I'm developing a game in which two players compete for area domination. Each player can play four moves per turn, ideally conquering four tiles.
Edit: Here a little more detail on the mechanics: Each player is given the same amount of cards (about 20). Each card has a value. The board consists of 4x5 tiles which you conquer by placing a card on it. If there already is a card on the tile, your can still conquer the tile but your card must have a higher value than the card on the tile.

The problem is that player two could technically (almost) always just undo player ones moves by conquering the same areas immediately. Of course this isn't fun at all and no human player would play this way, but I'm working on implementing an AI opponent, and I've seen the above happen a few times:

Player one conquers four tiles with pretty low value cards
player two immediately takes them
player one takes them back again because not doing so would be a disadvantage
player two takes them back again etc...

So as you can see, this is definitely not the best strategy as it becomes ridiculously expensive to possess the tiles of interest, but there are strategies or situations in which you might play like this.

How should I balance this? Are there any common design solutions for this problem?

(Having player one play more moves in the first turn would give player one a huge advantage as it would allow him/her to conquer highly strategic areas in the first turn. (Unfortunately, the "immediately undo player ones moves" strategy is actually not mathematically bad for player two, but that's another issue))

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:
C++ formatted serialization I've decided it's time to implement serialization in my simple engine but this has caused me many headaches for the past couple of days/weeks. My engine uses an entity/component based approach similar to what is described in the T=Machine blog.

To keep it simple, my first goal was to implement serialization of entities. Since I'm going to use Lua for scripting, I thought it would be nice to serialize entities into Lua tables. Unfortunately, I find the information that is available on serialization in C++ is rather scarce. After many days of thinking I found one approach which is working for my implementation and is described here.

In essence, I have an EntityManager class from which I request new entities. This class holds entity as well as pointers of type BaseComponent from which all components derive. Because I store components as base pointers, I couldn't use a friend class for serialization, but had to make the BaseComponent inherit from a Serializable class, which has pure virtual serialization methods.

So, this is not that bad, I just have to inherit from the Serializable class and implement the serialization method. To support deserialization though, I have to do a few tricks according to the last link. That is, I have to include a static object inside each component whose sole purpose is to populate a map from component names to constructors. Here is a generic example (and please ignore any possible errors),

/* Base.h */
struct Base: public Serializeable{
    static std::map&ltstd::string, std::function&ltBase*(void)&gt &gt deriveds;
    virtual ~Base(void){}
};

/* Derived.h */
template&ltclass T&gt
struct add_map_entry{
    explicit add_map_entry(std::string name){
        Base::deriveds[name] = [](void) -> Base* {
            return new T;
        };
    }
}

class Derived: public Base{
public:
    int x;
    int y;
    Derived(void){
        std::cout &lt&lt "Derived created" &lt&lt std::endl;
    }
    void serialize(std::ostream&);
    static add_map_entry&ltDerived&gt adder_;
};

Then in the implementation file I also have to initialize the static map of the base class as well as the static object of each derived class.

I find this quite a mess and although it could probably be improved with the use of macros, I can't help to wonder if there are better ways. How do you handle this kind of formatted serialization?

PS: Please don't recommend changing to a more flexible programming language :) !

sentences:
Rendering a distant star field in Unity using a separate camera for near stars I'm currently working on a hobby project which is a universe simulator (exclusive to stars) built in unity3D. In order to deal with the raw scale of the universe I'm trying to implement two co-ordinate systems.

In my project I have two cameras; camera1 is the first co-ordinate system where all stars are loaded as high detail 3D objects. While camera2 is used for gathering a list of points within this "extended" frustum. I want to display these stars from camera2 on the farplane of camera1 in a lowdetail 2d manner.

I'm new to game development so this may be completely wrong; my plan was to generate a mesh from all the points in cameras2 frustum (this mesh now respresents my points in world space). I have a variable that represents the conversionFactor between the two co-ordinate systems. I will convert this mesh into projection view using the my conversionFactor in the translation component.

I will display this projection view on my camera1 farplane selling the illusion of far away stars? Please let me know the flaws in my deisgn! any help is much appreciated

sentences:
Instantiate objects that share same variable I'm just wondering how to instantiate the same objects that all share the same variables, except their positions.

I'm basically working on the scene of my HTML5 game, and I've build a streetlamp post that turns on and off. All the lamps will have the same variables, such as Image, Size, on/off function. The only thing that will be different will be the position x and y.

I've built my lamp within a variable function (I think they're called that var = {), and within my actual game DrawFunction, I'm calling LampPost.draw();.

Is it possible to do something like this?

LampPost(0,0);
LampPost(100, 0);
LampPost(200, 0);

etc ... and then possibly place each instantiate Lamp within an array?

This is a snippet code for the lamp:

var LampPost = {

    lamp_xsprite : 0,
    lamp_ysprite : 0,

    light_xsprite : 0,
    lightysprite : 0,

    x : 440,
    y : 320,

    //Flicker effects
    lightFlicker : 0,
    seconds_Off : 0,
    seconds_On : 0,

    randomLength_Off : 500,
    randomLength_On : 150,

    draw: function(x, y) {

        this.x = x;
        this.y = y;

        ctxPropsOver.setTransform(1, 0, 0, 1, -Map.x + gameWidth/2, -Map.y + gameHeight/2);
        ctxPropsOver.rotate(Math.PI / -25);
        ctxPropsOver.clearRect(0, 0, 1000, 1000);

        ctxPropsOver.globalAlpha = this.lightFlicker;
        ctxPropsOver.drawImage(imgLights, 0, 36, 500, 463, -60 + this.x, -190 + this.y, 500, 463);
        ctxPropsOver.globalAlpha = 1;
        ctxPropsOver.drawImage(imgLights, 0, 0, 210, 36, 0 + this.x, 0 + this.y, 210, 36);

----- UPDATE -----

Okay, So I've converted it into an instance of object, this is what I have so far:

LampPost = function(lx, ly, la){

    x = lx; //500;
    y = ly; //335;

    centrex = 12;
    centrey = 17;

    rotate = la; //-8;

}

LampPost.prototype.draw = function (){

    ctxPropsOver.setTransform(1, 0, 0, 1, (-Map.x + gameWidth/2), (-Map.y + gameHeight/2) );

    ctxPropsOver.clearRect(0, 0, 1000, 1000);

    ctxPropsOver.save();
        ctxPropsOver.translate(this.x, this.y);
        ctxPropsOver.rotate(this.rotate*Math.PI/180);
        ctxPropsOver.translate(-this.centrex, -this.centrey);
        ctxPropsOver.globalAlpha = this.lightFlicker;
        ctxPropsOver.drawImage(imgLights, 0, 36, 500, 463, -60, -190, 500, 463);
        ctxPropsOver.globalAlpha = 1;
        ctxPropsOver.drawImage(imgLights, 0, 0, 210, 36, 0, 0, 210, 36);
    ctxPropsOver.restore();
};

sentences:
2D sprites not drawing at correct depths? I've been having some problems with getting my sprites to draw in the correct order.

Right now there are 2 types of objects: nodes and paths. I always want the nodes to draw over the paths so I have set the depths of the nodes to 0 and the depth of the paths to 1. They're being drawn in the same SpriteBatch call and I'm using SpriteSortMode.Deferred yet the paths are still being drawn on top of the nodes.

I've tried swapping the depths of these and they still draw in the wrong order. I've also tried switching the sort mode to BackToFront and FrontToBack but both of those mess up the graphics for the rest of the game so it's not really worth switching to either one of those.

Is there something obvious that I'm doing wrong? Is changing the draw order (paths are always drawn after nodes) the only way to get the nodes drawing on top of the paths?

Thanks!

sentences:
In MySQL, how would I model moves that Pokemon can learn? I'm making a Pokemon MMO Game with Unity + SmartFoxServer/MySQL. At the moment I'm creating the base structure for the database.

If you are not familiar with Pokemon Games, every Pokemon can learn only a fixed set of moves. I want to represent this in my database. How should I do it?

Currently I have a pokemon_base table that is storing all the base data of the Pokemon, like name, elemental types, base stats, etc, and a Unique Identifier. I need for every Pokemon inside this table to have a list of learnable moves.

I have these ideas to continue:

Have a field on the Pokemon table containing comma-separated IDs of learnable moves
Have a field on the Moves table containing comma-separated IDs of Pokemon that can learn this move, or
Have another Table with a Field for Pokemon ID and boolean fields for each move

The first one to me seems the better because once I have a Pokemon ID I can get all the moves in a string, which I can split by commas and do my checks. Have I missed something?

sentences:
What physics engine support force fields and bodies represented as points? I need a game engine that supports force fields in 2d or 3d, but suitable for 2d calculations, like bullet.

Each body I want to simulate is represented as a set of points. Each point has positive mass and can accept force. Force field is updated every tick.
Engine should accept force applied to every point and return point speed values and coordinates.
Each body made of particles should move as a whole thing in result, relative position of particles must persist, hence this is a rigid body.
If engine does not support setting body as a set of points it should allow setting density function, or some other means to let have non-uniform density.

Is there any that can do that, preferably cross-platform.

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:
Math / game design for non-linear armor degradation? I have a game that is about starships shooting each other.
Starships have a values that represent initial Health, Armour and Damage degradation

Example
1000, 800, 80% // 1000 HP, 800 Armour, 80 % mitigation
300, 250, 60% // 300 HP, 250 Armour, 60 % mitigation

Note Armour and mitigation are in relation to each other and armour will be lowered on damage, lowering the associated mitigation in the process.

Resolving damage start with a pure damage value, something like 50.
I then check the targeted ship for existing damage entries.
Depending on that, i reduce the "armour", translate it to a modified mitigation value and mitigate the damage by x%, reducing the armour in the process, so the next hit will encounter less armour, hence less mitigation etc.

example

A virgin ship has 1000/800/60% - hp/armour/% and is hit for an initial 50 damage.

Check the ship, see it has no damage received yet.

Take the damage (50), apply the armour modifier (800 of 800 remains, so 60% mitigation applies).

Split the damage into 40%/60% (hp, armour damage), so 20 of the 50 damage damage the hull, while 30 damage are eaten up by armour - lowering armour, and effective mitigation, for the next hits.

Next hit, 50 damage

Ship has 980/1000 Health, 770/800 armour.

With 800 armour giving 60% mitigation, 760 armour will give 57 % mitigation

50 damage are split into 43%/57% Hull/Armour damage -> 21/29 points.

this continues until a ship has no hull left.

How can i modify this so it becomes more of progressive curve, i.e. initial hits take bigger chunks of armour/mitigation relative to later hits (currently the the first few hits obviously eat more mitigation than later hits, but i want it to be more even more effective at the beginning.

How do i modify my math ? Do i need to add a square/root somewhere ?

sentences:
How should I implement the "Observer" pattern with respect to a game world? I'm thinking of ways to implement the Observer pattern in a game I'm developing at the moment. I can have a Game World (local map) with Game Objects (player, NPCs, monsters etc...) inside of it. Other Game classes (like quest progression tracker for flagging triggers, location tracker for path finding, or maybe a new map need to be loaded into memory and rendered to show the new area the player just walked into) need to be notified when the player walks into a building, or fires a projectile. Also the input listener needs to be aware of when the user presses a key or clicks the mouse, and somehow transport that information to the rest of the game so that it can allow the appropriate actions to take place.

So I'm stuck at the implementation stage. I know I can use the Observer pattern, and possibly the State pattern as well. I know I'll need a Game World (Subject), Game Objects (Listeners), and Game Events (triggers the Game World to render the changes). However that could be the wrong way to go about it, any suggestions?

BTW, its a 2D JRPG tiling styled game, in the fashion of Zelda, Breadth of Fire, Pokémon, or the older Final Fantasies

Alright I've gone and done an implementation, but ran into a few minor issues, although it seems to be working properly.

public interface WorldListener {
    public void OnWorldEvent(WorldEvent e);
}

Above is the Observer that listens to the subject.

public class WorldEvent {
    final int WorldObjectMovedEvent = 1;
}

Above is the Event that triggers a notification.

public class World {

    static WorldListener listener;

    static void addWorldListener(WorldListener wl) {
        listener = wl;
    }

    static void WorldChanged() {
        listener.OnWorldEvent(new WorldEvent());
    }
}

Above is the subject that only stores one subscriber at the moment, I'll make it into a list once i write a class for another observer, right now, I only have one Observer. There is no need for a list at the moment.

public void OnWorldEvent(WorldEvent e) {
    System.out.println("Something has happened in the world");
}

static private void addWorldListener(WorldListener wl) {
    World.addWorldListener(wl);
}

The code above goes into the object that is currently acting as an observer, when an event is fired, it triggers the world's WorldChanged() method, which in turn fires the OnWorldEvent of any listener.

The problem I have ran into is that I can't move the WorldEvent, WorldListener, or World classes into a separate package under the moniker World.my.game because of the static reference. So I'm not sure I'm implementing it correctly. Also if there are any suggestions on making this better, or if I'm flat out doing it wrong let me know, as I haven't delved into design patterns yet and this is my first attempt.

sentences:
SDL Sprite Customization I am currently working in C++ with SDL2. I plan on making a game that utilizes character visual customization. More specifically, equipping clothes and items changes the appearance of characters. However I don't know how to approach this situation. With that being said, how would I achieve this character customization in SDL2?

Right now I have two ideas...

Create a sprite sheet for every possible combination.( Way too much
time).
Break the sprite into different rects to draw each article of clothing or item. (Not sure if this is efficient)

sentences:
How to remove fragment from VAO? I have the OpenGL VAO object (~40K) to draw the 3D scene

glBindVertexArray(VAO);
glDrawElements(GL_TRIANGLES, 4, GL_UNSIGNED_BYTE, nullptr);
glBindVertexArray(0);

To add some data I can use glMapBuffer:

GLuint buffer;
glGenBuffers(1, &buffer);
glBindBuffer(GL_ARRAY_BUFFER, buffer);
glBufferData(GL_ARRAY_BUFFER, (2 * steps) * sizeof(float),
     NULL, GL_STATIC_DRAW);
float *data = (float *) glMapBuffer(GL_ARRAY_BUFFER, GL_WRITE_ONLY);
myFuncAddingData(data,{2.4f, 40.0f, 19.0f});
glUnmapBuffer(GL_ARRAY_BUFFER);

Can I to remove (hide/mask) some verteces (3 from 40K) directly from the located in the grafical memory VAO without full complete replacement all of the 40K?

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:
Circle-Rectangle collision velocity adjustment I created my circle vs. rectangle method based on this algorithm:

https://stackoverflow.com/questions/401847/circle-rectangle-collision-detection-intersection

Currently, I have a dynamic ball with velocities c1SpeedX (for X axis) and c1SpeedY (Y axis). The dynamic ball is supposed to bounce off of the static rectangle when a collision occurs.

The boolean method that I use to detect if the intersection happened is the following:

        public boolean intersects (Circle circle, Rectangle rectangle) {
            double dx = Math.abs(circle.getLayoutX() - rectangle.getLayoutX());
            double dy = Math.abs(circle.getLayoutY() - rectangle.getLayoutY());

            if (dx > rectangle.getWidth() / 2 + circle.getRadius()) {
                return false;
            }
            if (dy > rectangle.getHeight() / 2 + circle.getRadius()) {
                return false;
            }

            if (dx <= rectangle.getWidth() / 2) {
                return true;
            }
            if (dy <= rectangle.getHeight() / 2) {
                return true;
            }
            double cornerX = (dx - rectangle.getWidth() / 2) * (dx - rectangle.getWidth() / 2);
            double cornerY = (dy - rectangle.getHeight() / 2) * (dy - rectangle.getHeight() / 2);

            double cornerDistance = cornerX + cornerY;
            double radii = circle.getRadius() * circle.getRadius();

            return cornerDistance <= radii;

        }

Once a collision has happened, my natural response would be to invert the values of X and Y, so the ball bounces off of the rectangle. The problem is that it's incredibly inaccurate, and the ball often goes through the rectangle without detecting a collision.

if (intersects(circle1, rect1)) {
                    c1SpeedX = c1SpeedX * -1;
                    c1SpeedY = c1SpeedY * -1;
                }

So, how do I optimize my code to make the ball always accurately bounce off of the rectangle? Is it a velocity problem, or is something wrong with the intersects method?

Thanks.

sentences: How can I find an animation's final compression size in Unity? I've been looking at animation compression, and the only way I can seem to find it's final size is to create a Build and check it in the Profiler. There must be an easier way?

sentences:
How would I achieve diablo like 2D isometric projection? I am in the process of coming up with an idea for a game, and I would like it to be isometric like Diablo. The problem is I have no idea how it achieves the effect of height like in the following screenshot (on the columns):

Whatever the case, I'm sure it is going to be harder to achieve then creating a traditional isometric game, but any ideas regarding the topic would be greatly appreciated.

sentences:
Any good web frameworks for asynchronous multiplayer games? I'm trying to craft a site for web-based (original) board games, and my client (currently written in Actionscript, but that's highly fungible) works fine - I can play solitaire games in the client - but it has nothing to connect to.

What I'm looking for is a server framework for handling accounts/authentication and game tracking: something that would let players log in, show them a list of their current games, let them invite friends to new games, let them make moves in the games they have open, etc.  I'm flexible on language; obviously I'm going to have to write a lot of server code to handle the actual game logic, but that should be straightforward enough.  I'm more concerned with how to handle the user (and game) DBs, though suggestions for a good server framework for communicating with the DBs (and serving up, most likely, JSON for client communications) are also welcome.  Right now my leaning is towards Ruby (probably with Rails) but as far as I can determine it would be a pretty good chunk of effort to set up the necessary databases, so having something automagically handle that - or even just having a good example project that I can check out for a how-to - would be really useful to me.

sentences:
Unreal Engine - Scaleform - How do I capture a button click event? I'm new to Unreal Development.

In a nutshell, how do I create a button, install it in a basic game, and capture the button click event?

sentences:
Setting up a shader for RTS construction grid visibility (around cursor) I've set up a shader, thanks to the good help of @DMGregory over at : Draw animating grid with terrain deformation and variable colors
here's what I got so far :

here's what it's supposed to look like :

here's what my shader code looks like as it stands :

forgive my non-2K + screen it's only a 1080p but this is the full shader.
here's each bit in isolation :

here's the main options for the node :

If I set surface to transparent...
I get a much better result :

yet still not what I want because the grid area fades out immediately instead of staying at the center of the cube :

also the corner clearly has a green and red line overlap when line should only ever be red or green.
this is the mock file that I'm currently using for buildable and non buildable area :

it's 256x256 (the size of my map) for now because I want to start small (where 1px maps to one unity square on the terrain of 1 unit) before I move on to the real deal which should be a 3584x3584 Texture 2D (where 1px corresponds to 1/14th of a unity unit).
I want my grid to be 1/14th of an digit. eg cell one is (in diagonal) from (0.0f, 0.0f) to (0.14f, 0.14f).
I've got preliminary code which will serve to generate this texture 2D programmatically :
    editable2DconstructibleMap = new Texture2D(256, 256, TextureFormat.RGBA32, false);
    constructionGrid = GameObject.FindGameObjectWithTag("GridViewer").GetComponent<MeshRenderer>();

    // fill texture color corresponding to navMesh
    for (int x = 0; x < editable2DconstructibleMap.width; x++) {
        for (int y = 0; y < editable2DconstructibleMap.height; y++) {
            NavMeshHit hit;
            if (NavMesh.SamplePosition(new Vector3(x * 1.0f, 0f,y * 1.0f), out hit, 1.0f, NavMesh.AllAreas))
            {
                editable2DconstructibleMap.SetPixel(x, y, Color.white);
            }
            else
            {
                editable2DconstructibleMap.SetPixel(x, y, Color.black);
            }
        }
    }
    constructionGrid.sharedMaterial.SetTexture("BuildableMask", editable2DconstructibleMap);

Here I'm using the navMesh which itself is automatically generated based on terrain slope.
I target each point of the map and see if it falls in or out of the navmesh.
Instead of redrawing this texture 2D when a building is placed and placement becomes impossible. I think I'll simply programmatically edit the 2D texture to add the new black pixels whilst the navmesh will be updated independently.
Anyways, I guess the green + red overlap issue comes from my texture2D being currently too small, but if I don't know yet what one pixel corresponds to, I'll have trouble getting this right.

Update :
so changing the texture to one of 3584x3584 did not help. I still have the exact same behavior.
So basically what did I get wrong in following the instructions from the other answer?

sentences: Animation in top down 2d How is this usually done? Especially when the character might need to use different animations, for instance at his hands and legs. I noticed some skeletal animation solutions but they were only applicable to platformer games. Any ideas?

sentences:
How do I add Different Screens to my C#/XNA Game? I'm working on a Pong clone in XNA. Gameplay-wise, I have it where I want it to be.  I want to add a title screen and some other screens to it like a menu, as well as a screen for the Winning/Losing results.

I've tried the Game State Management Example on the App Hub site, but It's very complicated and I haven't been able to make sense of it. Is there a simpler way?

I'm hoping for a solution that can be used in other projects too.

Plus I'd like to know how to actually create menu items (basically, how do I display the different options on it, and highlight them, etc).

sentences:
Adding terrain features to a perlin noise heightmap I'm currently using Perlin Noise to generate heightmaps and model moisture levels as well as tree density to create terrain (in the form of 2D tilemaps - think dwarf fortress).

How can I generate things like caves, or other landmarks like massive boulders or buildings?

I don't want to model these features (i.e. I don't care about the inside of the cave), I just want the game to be able to say 'there is a cave here' when you're at the x,y position of the cave, and importantly, follow rules about where caves might be (e.g. side of a mountain / rocky areas).

I also want to be able to generate this in a procedural way, similar to perlin noise, so that with any 'seed', the same landmarks will always appear.

I'm struggling to think of a way to create these features, and have them always reappear with the same seed. Does anyone have any ideas? :)

sentences:
2D LibGDX Collision Avoidance I would like to know what is the best way to implement collision avoidance and eventually pathfinding in a LibGDX 2D top view game. Think of "Binding of Isaac".

I use a sort of tilemap to place the obstacles (squares), taken from an ASCII map, but I'd prefer to keep the movements free from it. (Enemies shouldn't move from tile to tile but freely)

Since the target is mobile I can't use heavy algorithms.

I'm not particularly concearned about enemies getting stuck on weird shapes (such as 'U') since it kind of makes sense (they are white globules, not particularly smart :P) but I still want them to be a challenge.

I've taken into consideration Steering Behaviors and the LibGDX-AI framework but I can't find good documentation, I can aswell code it by myself in case.

ANOTHER QUESTION Just to know, which kind of algorithm is used in the Binding of Isaac? It perfectly suits my needs

sentences:
Unity3D - leaving and then returning to a scene Effectively, I need to know how to run a mini game and then return to a scene. I know about

DontDestroyOnLoad (this);

but that works for game objects only and doesn’t do what I need - also because it carries the objects over into the next scene. In my game you play as a computer. When you hack into a computer remotely, you have to go into a sort of mini game where you must traverse the computer for data, experience and end up ‘owning’ the computer, having destroyed its security systems. My problem is that this requires being in a different scene, where the hacking 'minigame' is played out, then return. So I could just make a new scene, fine. But when I have to return to the old scene, it has to kick off from the exact point where I left to hack the computer, as if no time had past and with nothing being different. I am stuck on how to do this, because as far as I know there is no way to write a scenes data to a binary file and the read from it when loading the scene again - and persistent data was the only solution I could think of. Any help is appreciated.

Summary

How to play the scene, load a different scene, finish that minigame and then continue from where you were in the original scene

sentences: Am I allowed to release an app I developed with Xcode on windows? I want to develop an app for the iOS app store, but don't want to invest in a mac since they start very expensive. So I considered running Xcode via VMware using OSX Lion on my windows 7 computer. Would it be legal for me to create and sell an app if it was created on windows? Is Apple fine with it? Selling it on Cydia or other jailbreak stores are not an option.

sentences:
Skeletal Animation Mirrored Okay so I've been working on GPU skinning skeletal animations.

I need help assessing what is going on here. Looks like the animations are completely mirrored

What are the possible issues? I've been looking at it for so long I'm numb to it. Maybe some fresh eyes will be able to pinpoint what it could be?

Thanks in advanced.

This is in Blender(how is should look):

This is what it looks like in my engine:

sentences:
Controlling a GameObject from another GameObject's script component I'm creating a game where when starting the game, a Cube is duplicated GridSize * GridSize times when the game starts. Now, after the cubes are duplicated I want to attach a variable to them, say "Flag" which is a bool, from another script component (let's say I have a Prefab that generates the cloned cubes).

In short, I have something like this:

CreateTiles.cs : Attached to Prefab

void Start() {
    createMyTiles(); // a function that clones the tiles
    flagRandomTiles(); // a function that (what I'm trying to do) "Flags" 10 random cubes
}

CubeBehavior.cs : Attached to each Cube

public bool hasFlag;
// other stuff

Now, I want flagRandomTiles() to set a Cube's hasFlag property via code, assuming I have access to them via a GameObject[] array.

Here's what I've tried:

Cubes[x].hasFlag = true; - No access.
Making a function such as Cubes[x].setHasFlag(true) - still no access.
Initializing Cubes as a CubeBehavior object array, then doing the above - GameObjects can't be converted to CubeBehaviors - I get this error when I try to assign the Cubes into the array.

How do I do this?

sentences:
RPG Monster-Area, Spawn, Loot table Design I currently struggle with creating the database structure for my RPG.
I got so far:

tables:

area (id)
monster (id, area.id, monster.id, hp, attack, defense, name)
item (id, some other values)
loot (id = monster.id, item = item.id, chance)
spawn (id = area.id, monster = monster.id, count)

It is a browser-based game like e.g. Castle Age.
The player can move from area to area.
If a player enters an area the system spawns, based on the area.id and using the spawn table data, new monsters into the monster table.
If a player kills a monster, the system picks the monster.id looks up the items via the the loot table and adds those items to the player's inventory.

First, is this smart?
Second, I need some kind of "monster_instance"-table and "area_instance"-table,
since each player enters his very own "area" and does damage to his very own "monsters".
Another approach would be adding the / a player.id to the monster table, so each monster spawned, has it's own "player", but I still need to assign them to an area, and I think this would overload the monster table if I put in the player.id and the area.id into the monster table.

What are your thoughts?

Temporary Solution

monster (id, attackDamage, defense, hp, exp, etc.)

monster_instance (id, player.id, area_instance.id, hp, attackDamage, defense, monster.id, etc.)

area (id, name, area.id access, restriction)

area_instance (id, area.id, last_visited)

spawn (id, area.id, monster.id)

loot (id, monster.id, chance, amount, ?area.id?)

An example system-flow would be:
Player enters area 1:

system creates area_instance of type area.id = 1 and sets player.location to area.id = 1

If Player wants to battle monsters in the current area:

system fetches all spawn entries matching area.id == player.location and creates a new monster_instance for each spawn by fetching the according monster-base data from table monster. If a monster is fetched more than once it may be cached.

If Player actually attacks a monster:

system updates the according monster_instance, if monster dies the instance if removed after creating the loot

If Player leaves the area:

area_instance.last_visited is set to NOW(), if player doesn't return to data area within a certain amount of time area_instance including all its monster_instances are deleted.

sentences:
How Do Day Night Cycles Work? I know that this is a vage question, but how do day night cycles work in video games? How do I get started programming one? I have researched for a while, but the only thing I saw was "unity 3-d day night cycle". I need just a basic concept.

Edit:
I mean how to make it appear visually. I'm sorry for not saying that first.

sentences:
How can I implement a "Nyan Cat" rainbow? I'm currently making a game similar to this Nyan Cat flash game, although I'm using cocos2d. I'm having a hard time trying to make the rainbow effect:

Currently, every update call I add a piece of rainbow on screen and move it back, having also added it into a special array. When a player changes its y coordinate I rotate all the added spites by a certain calculated value.

Honestly, it looks... not perfect and I've been wondering if there is better way?

sentences:
Irrlicht app: Creating STL exception leads to segfault I'm developing application with C++ language and Irrlicht engine.

When I add std::runtime_error("err") expression into my code, I got segmentation fault at address 0 (before entering to main). If instead I use std::exception(), app runs fine.

How std::runtime_error() causes segfault and how to fix it? Thanks!

#include <stdexcept>
#include <exception>
#include "irrlicht.h"

int main() {
    irr::IrrlichtDevice* device = irr::createDevice();
    if (!device)
        throw std::runtime_error("err");  //without this run fine
}

Compile:

g++ -ggdb -Wall -Wextra -std=c++11 -o main main2.cc \
-lIrrlicht -lGL -lXxf86vm -lXext -lX11 -lXcursor

Backtrace:

(gdb) bt full
#0  0x00000000 in ?? ()
No symbol table info available.
#1  0xb5d88fe1 in init () at dlerror.c:177
No locals.
#2  0xb5d8942e in _dlerror_run          (operate=operate@entry=0xb5d88e10 <dlsym_doit>,     args=args@entry=0xbffff160) at dlerror.c:129
    result = <optimized out>
#3  0xb5d88e98 in __dlsym (handle=0x0, name=0xb7f8afe5  "posix_memalign") at dlsym.c:70
    args = {handle = 0x0, name = 0xb7f8afe5 "posix_memalign", who = 0xb7f674bc, sym = 0xb5d65b20}
    result = <optimized out>
#4  0xb7f674bc in ?? () from /usr/lib/nvidia-   304/libGL.so.1
No symbol table info available.
Backtrace stopped: previous frame inner to this frame     (corrupt stack?)

LD debug

LD_DEBUG=all LD_DEBUG_OUTPUT=log.txt ./main
tail log.txt.*

   3848:    symbol=__pthread_key_create;  lookup in file=/lib/i386-linux-gnu/libgcc_s.so.1 [0]
  3848: symbol=__pthread_key_create;  lookup in file=/lib/i386-linux-gnu/libc.so.6 [0]
  3848: symbol=__pthread_key_create;  lookup in file=/usr/lib/nvidia-304/tls/libnvidia-tls.so.304.131 [0]
  3848: symbol=__pthread_key_create;  lookup in file=/usr/lib/nvidia-304/libnvidia-glcore.so.304.131 [0]
  3848: symbol=__pthread_key_create;  lookup in file=/usr/lib/i386-linux-gnu/libXext.so.6 [0]
  3848: symbol=__pthread_key_create;  lookup in file=/lib/i386-linux-gnu/libdl.so.2 [0]
  3848: symbol=__pthread_key_create;  lookup in file=/usr/lib/i386-linux-gnu/libxcb.so.1 [0]
  3848: symbol=__pthread_key_create;  lookup in file=/lib/ld-linux.so.2 [0]
  3848: symbol=__pthread_key_create;  lookup in file=/usr/lib/i386-linux-gnu/libXau.so.6 [0]
  3848: symbol=__pthread_key_create;  lookup in file=/usr/lib/i386-linux-gnu/libXdmcp.so.6 [0]

sentences:
SDL and smooth transition between changed movement direction I have an object at position (x,x). Using SDL keyboard events every time the user presses one of the arrow keys the objects is to be translated (via a glTranslatef() call for the x and y axes) by a constant factor (for example: 10).

Note: I take the top left corner of the SDL window to be my (0,0) position

Single press of left arrow key - decrease X of object by 10
Single press of right arrow key - increase X of object by 10
Single press of up arrow key - decrease Y of object by 10
Single press of down arrow key - decrease Y of object by 10

In order to allow diagonal movement I added four boolean flags (one per arrow key) that are set to true when the SDL_KEYDOWN event for the respective key is detected. After that I do the following (width and height are the size of the texture that represents my object on the screen):

if(keyLeft) {
  if(x >= 10+width/2) x -= 10;  // Check if the object doesn't go outside the window and translate
  else x = width/2;
}
if(keyRight) {
  if(x < 640-width/2) x += 10;
  else x = 640-width/2;
}
if(keyUp) {
  if(y >= 10+height/2) y -= 10;
  else y = height/2;
}
if(keyDown) {
  if(y < 480-height/2) y += 10;
  else y = 480-height/2;
}

It's working fine. The problem is that when I change the movement direction (for example from a movement in (x++,y++) to (x++,y) direction) I have to press the second key (or key combo) again in order to execute the second movement.

Any ideas how can I fix this? I realize that doing things the way I described above still results in choppy movement due to the limited movement directions, not taking factors such as speed and acceleration into account but it will do for now (prototype stage).

sentences:
How to manage collision of two player ? I'm developing a multi-player car game.
Suppose that car A hit car B: both A and B have Rigidbody and collision functions attached.
Because car A hit car B i want to take actions only to car A (add or remove point) but not to B.
So i need to identify that car A is 'hit' (with guilty ) car B that has no 'guilty'.
Can you suggest me how to do ?

sentences:
Fixed distance between character and ground whatever slope value I am working on character moving on any ground meaning whatever slope degree ,the result i got is the character does not moving on just shake in his place
the following the code i wrote

public float speed = 1;
bool isMoving;
Transform childPosition;
Rigidbody rb;

private void Start ( )
{
    rb = GetComponent<Rigidbody>();
}

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

    if (Input.GetAxis("Horizontal") > 0)
    {
        rb.velocity = new Vector3(1f, rb.velocity.y, rb.velocity.z);
    }
    else
    if (Input.GetAxis("Horizontal") < 0)
    {
        rb.velocity = new Vector3(-1f, rb.velocity.y, rb.velocity.z);
    }
    else
    transform.position += transform.forward * Time.deltaTime * speed;

    detectRoad();
}
private void detectRoad()
{
    Ray ray = new Ray(transform.position, -transform.up);
    RaycastHit hit;

    if (Physics.Raycast(ray, out hit))
    {
        transform.rotation = Quaternion.FromToRotation(transform.up, hit.normal) * transform.rotation;
    }
    if (hit.distance < 0.6f)
    {
        transform.position += transform.up * Time.deltaTime;
    }
    else
    if (hit.distance > 2f)
    {
        transform.position += -transform.up * Time.deltaTime;
    }
}
   `

This animated gif is about what I want:

sentences:
Language agnostic game programming books Possible Duplicates:
  Game programming books that don't teach programming?
  Must read game development books

Does anyone know any good language independent game programming books?

I don't currently know anything about game programming or practices - any good books on stuff like: scene-graphs, handling sprites, layers, collision detection, effects, events?

I'm a college student without the time to learn a new language so the concepts need to be language-agnostic enough they can fit into the languages I know: Javascript, Python, Scheme/Lisp and some light Vala (I'm considering using HTML5 or PyGame). I would use C# books but my OS is Linux and I don't know about the whole mono thing when most C# books use XNA.

Also I know that game programming is an extension of general programming, but I think I've got that down. Like is there a cookbook of some sort?

sentences:
Field of view or resolution? I'm new to CG and I'm building a ray tracer.

I don't quite understand how to set camera parameters and film(pixel plane) parameters.

Say I want to get an image of 400x300 resolution. I can set an fov, and then the distance between the film and camera can be calculated.

If that's true, a high resolution and a "reasonable" fov, e.g 80 degree, will result in a large distance. Does that makes the object small on the final image?

And I feel like people like to determine resolution at first, in order to get an expected image size. To avoid distortion of objects(fish eye), the fov cannot be too large.

So how do I get close look of an object on a high resolution image?

I think the rasterization way is different from ray tracing one since I can project an object into NDC(normalized device coordinate) to make it big, but what about ray tracers?

sentences:
Unity 2D launch player towards mouse location few notes:

I'm new to game development
I'm not new to developing (1 year of front end web development)

I'm trying to get my character to launch towards mouse left click button (which I understood to be translated into screen onclick once its exported to mobile)
I've got the following code down (used the web for help)

move speed is a float that's equal to 10 in this example

if (Input.GetMouseButton (0)) {
        mousePosition = Camera.main.ScreenToWorldPoint (Input.mousePosition);
        direction = (mousePosition - transform.position).normalized;
        rb.velocity = new Vector2 (direction.x * moveSpeed, direction.y * moveSpeed);
    }

Which works great, but has 2 issues:
If I keep holding leftMouseButton my character is pinned to the cursor
I want a single, gravity affected, launch (jump of sort) towards my mouse button.

This is all under the Update() function.

sentences:
Unity, Detect the last GameObject in the hierarchy of a given list of GameObjects I have a list of GameObject , and I need to know which one is the last in the hierarchy ( This is for a UI system, So is kind of 'which one is showing up')

I have a cursor managed by GamePad , and I use Raycast to see if he clicked something, It give me an array of Gameobjects but I need to know which one is showing up(on top of the others) to click on it

Example this is my full hierarchy:

GameObject A
        GameObject B
        GameObject C
GameObject D
        GameObject E
        GameObject F
GameObject G
          GameObject H
               GameObject I
           GameObject J

The list of raycast contain 'GameObject D','GameObject A','GameObject I'

How I cand find that 'GameObject I' is the last one? they don't have a common root

sentences:
Camera bounds grow along with the game scene editor in Unity I am extremely confused by the Unity editor. Look:

I have an image,

And I want my camera to fit it perfectly. I have achieved so by using a size property of 540:

Notice how the viewport rect has 1 width and 1 height. If you run this game in a Samsung Galaxy S5, the sprite will fit perfectly in your device.

Now, resize the game scene view a bit (drag the Unity window border outwards to make it grow). Let's make it bigger. Then this happens:

The camera "white bounds" grew bigger! And the sprite no longer fits perfectly in the Galaxy S5!

My question is, then: why did the camera's bounds grow along with the editor window, if the viewport rect property never changed (it is still at 1 width an 1 height)?

sentences:
Orthogonal projection matrix affecting z-buffer on one device I am experimenting using Matrix.orthoM for a isometric projection, rather than Matrix.frustumM.

On one device, the z buffering does not appear to be working correctly and I get a cut away effect seen below on the wheels in particular. Both devices work fine with frustum projection.

Sorry not much to go on, just hoping someone will just be able to take one look and recognise the problem.

Sony Xperia Z:

LG P920:

Sony Xperia Z:

LG P920:

sentences:
Number Guessing Game: How to ensure player cannot be dishonest about their guess I'm building a number guessing game in Unity. The computer has 10 chances to guess the number the player is thinking of. The player interacts by pressing Higher or Lower or Correct Guess.

The basic game works fine, as long as the player is honest. I'm now trying to make the game watertight and prevent any user error or dishonesty about their number. I created some test conditions to check if the random number generator has produced a number already used before, or to check if the player is pressing Higher or Lower beyond the max and min guess range.

The problem can be demonstrated well by constantly pressing Lower to the point where the final guess is the number 1. Pressing Lower again results in the game freezing. It also happens if the number you are thinking of is displayed and you press Higher or Lower towards a range of numbers which have already been eliminated as possibilities. I am thinking this is due to the game getting stuck in my while loop in MakeGuess().

I think the problem lies in the following test condition in MakeGuess() but any tweaks I make seem to have no effect:

// check if number has been guessed before
if (newGuess == guess && (newGuess > max || newGuess < min)) {

I've uploaded my current playable build to GameBucket.io here: https://gamebucket.io/game/07cc2b61-493b-46ae-a446-aeaa98ffac0e

All the game logic is handled in the NumberWizard script which is attached to the NumberWizard GameObject in the main Game scene:

using UnityEngine;
using UnityEngine.SceneManagement;
using UnityEngine.UI;

public class NumberWizard : MonoBehaviour
{
    int max;
    int min;
    int newGuess;
    public int guess;
    public int maxGuessesAllowed = 10;

    public Text text;
    public Text guessesRemaining;

    // Use this for initialization
    void Start()
    {
        StartGame();
    }

    void StartGame()
    {
        max = 1000;
        min = 1;

        MakeGuess();
        UpdateDisplay();
    }

    public void GuessHigher()
    {
        min = guess;
        NextGuess();
    }

    public void GuessLower()
    {
        max = guess;
        NextGuess();
    }

    public void GuessCorrect()
    {
        StartGame();
        SceneManager.LoadScene("Lose");
    }

    void NextGuess()
    {
        if (maxGuessesAllowed <= 0) SceneManager.LoadScene("Win");

        MakeGuess();
        maxGuessesAllowed -= 1;
        UpdateDisplay();
    }

    void UpdateDisplay()
    {
        text.text = guess.ToString() + " ?";
        guessesRemaining.text = maxGuessesAllowed.ToString();
    }

    void MakeGuess()
    {
        //guess = (max + min) / 2; // old guessing method

        bool validGuess = false;

        while (validGuess == false)
        {
            newGuess = GenerateNumber();

            // check if number has been guessed before
            if (newGuess == guess && (newGuess > max || newGuess < min))
            {
                Debug.Log("Number has been guessed before and is already at either range limit.");
                SceneManager.LoadScene("Lose2");
            }
            else if(newGuess == guess)
            {
                newGuess = GenerateNumber();
                Debug.Log("Number has been guessed before but is not at range limit.");
            }
            else
            {
                validGuess = true;
                guess = newGuess;
                Debug.Log("Number has not been guessed before.");
            }

            Debug.Log("Min: " + min);
            Debug.Log("Max: " + max);
            Debug.Log("====================");
        }
    }

    int GenerateNumber() {
        int result = Random.Range(min, max + 1); return result;
    }
}

Any help with the code

sentences:
How to get a consistent behavior for a rigid body hooked platform? Consider this platform made of RigidBody2D and PinJoint2D objects:

PinJoint2D setup is:

Softness = 0
Bias = 0.9

When I set the mass of the platform with high value, the structure starts to shake like this:

Why is this happening and how to fix that?

sentences:
Why does GLM only have a translate function that returns a 4x4 matrix, and not a 3x3 matrix? I'm working on a 2D game engine project, and I want to implement matrices for my transformations. I'm going to use the GLM library.

Since my game is only 2D, I figured I only need a 3x3 matrix to combine the translation, rotation and scale operations. However, glm::translation is only overloaded to return a 4x4 matrix, and never a 3x3.

I thought a translation could be performed by using a 3x3 matrix; why does GLM only have a translate function that returns a 4x4 matrix, and not a 3x3 matrix?

sentences:
Entity component system implementation choices // Ex.1
    for (Component& component : m_components)
    {
        UpdateComponent(component, dt);
    }
// Ex.2
    for (Component& component : m_components)
    {
        component.Update(dt);
    }

Assume that:

UpdateComponent() and the class method Component::Update() have identical logic.
Component::Update() is not a virtual function.
m_compoents is a container that uses a contiguous memory block (e.g. std::vector).

From the caching perspective, is there any performance difference between the 2 examples?

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:
Single player game into Multiplayer game I developed a Single player game in Flash (Tic Tac Toe) and in the Multiplayer mode i will be able to do both player playing on the same system with out network.

I would like to extend it and make it enable to play the Multiplayer game for two player playing it online.

How i can be made give me some ideas , How test the Multiplayer game playing along with different computers(I do not have internet connection in home).

How I able to change the single player game into Multiplayer game , any minor changes required or I have to change the code base completely.

In which way i can make it possible.

sentences:
Unity yield WaitForSeconds() not working I am new to Unity development. I started learning Unity by reading tutorials, demos, examples, and watching videos. And I am having some trouble with using this timer. Here is my code:

 void OnCollisionEnter(Collision colli){

    if (colli.collider.name == "Car") {
        Debug.Log("On Collision naz ~.~");
        Destroy(Car);
        Destroy(this.gameObject);
        GameObject clone = (GameObject) Instantiate(Bum, transform.position, Quaternion.identity);
        StartCoroutine(deleteObject(clone));
        // Just want to delete "clone" object after 1 second
    }
}
    IEnumerator deleteObject(GameObject bum){
        Debug.Log("chuan bi destroy naz ~.~"); // <-- run normally
        yield return new  WaitForSeconds(1.0F);
        Debug.Log("Destroy rui naz =,='");    //  <-- not display
        Destroy (bum);
    }

Why won't this object be destroyed after 1 second?

sentences:
How to destroy bullet on collision but only after it makes the collided object to bounce? I made a scenario that shooting a bullets on crates make them both bounce nicely (both the bullet and crates are RigidBody2D & Colliders).
When I use OnCollisionEnter2D to destroy the bullet when it hits the crate then the bullet destroyed before it pass the force to the crate and thus the crate stay still and not move physically...

How to make the crate move because of the bullet hit and also make the bullet to destroyed?
There is more elegant way from just destroy the bullet a frame after the hit?

sentences:
Unreal Asset export : vertex-shader I have an Unreal asset, and we need to convert or replicate a similar visual appearance in Unity.
Initially, we started converting the Unreal asset into FBX. Used MAYA to reload the content with relative textures and maps.
As a result, the colour scheme I see on the buildings in the Unreal engine is not the same in MAYA.
Few of the known experts said that in Unreal they might have used vertex colour for the polygons.
Question:

Can we apply a vertex colour in the Unreal engine? if you have a huge scene, how can we control assigning the wall colour (vertex colour)?
If there is an option to add the vertex colour, How can I read that data(Information) in Unreal?
Is it possible to export these properties in any form of data? so that we can load and replicate(duplicate the effect done to get a different wall colour) in MAYA?
Is it possible to make the identical scene in Unity by using Unreal asset?

I am very curious to know the answers to the above questions, any answers from you can provide an insight for us to look for the solution from a different angle.
Thanks in advance for the help.

sentences:
Which programming language to use for tools? I use C++ as my language as choice.  However, I generally use Python to write helper utilities and tools.

My worry is that as my game engine continues to grow it's getting tedious to reimplement some of its features in Python.

There has got to be a better way.

Here are the options as I seem them

Keep on keeping on.
That is often the answer in a cooperate environment.  Maybe it has some merit.
Build bindings for Python (yuck) and have it use pieces of the engine directly.
Start building the tools using C++ instead.
I already use QT in the Python tools to provide a GUI when needed.  It doesn't seem like it'd be that much harder to use QT in C++ instead.  However I'm worried my tool productivity will go down.  I generally strive to apply much less rigidity in tool code than I would in shipping code.

So what is common practice, use the same language for tools, or use a more RAD friendly one?
What if you use a language that differs from the language of the game which do you use?
How do tools interact with the game engine link to it directly or fake it?

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:
How to move the player while also allowing forces to affect it For now, that's how I move the player:

rb.velocity = Vector2.right * input.x;

And I affect him a force while he is damaged by an entity:

rb.AddForce(Vector2.right * force);

It works fine, until I try to move while I'm damaged by an entity.
Since my velocity = input.x while I move, I can't affect any forces to it.
I've tried to summarize velocity:

rb.velocity+=Vector2.right * input.x;

But then I need to clamp the speed and if I clamp it, my force which is affected to player is also clamped.

How can I resolve this problem?

sentences:
GLSL 330 Core Bug? - Uniform variable will not set to value if it is named a certain way In the code below I have a uniform variable named "vw_matrix" used in the calculation for gl_Position. When I run my program, a rectangle gets printed to the screen.

#version 330 core

layout (location = 0) in vec4 position;

uniform mat4 pr_matrix;
uniform mat4 vw_matrix = mat4(1.0);  // Rectangle!
uniform mat4 m1_matrix = mat4(1.0);  // No rectangle!
uniform mat4 mmmmm = mat4(1.0);      // No rectangle!
uniform mat4 test = mat4(1.0);       // Rectangle!
uniform mat4 aaa = mat4(1.0);        // No rectangle!

void main()
{
    gl_Position = pr_matrix * position * vw_matrix;
}

If instead I put "m1_matrix" in the gl_Position line instead of "vw_matrix". The rectangle no longer appears.  I'm not getting any GLSL compile errors.

void main()
{
    gl_Position = pr_matrix * position * m1_matrix;
}

There are no calls to glUniformMatrix4fv changing the value "m1_matrix".
It has the same value as "vw_matrix" so for some reason it must not be initializing.

I did some experimenting, it won't set a uniform variable if it starts with a certain letter and "m" is one of those letters. Anything that starts with a "v" or "t" works fine. I can't make this up!

Is there anything I should double check/post or is this just a rather bizarre bug? The full code is available at https://github.com/nduplessis11/Freeze

I'm running on Linux Mint 17.1 and my GL_VERSION is "OpenGL 4.4 13374 Compatibility Profile Context 15.20.2013". My video driver is AMD's fglrx version 15.200

UPDATE: Ok, I found a bug in my main program in a function that retrieves the location of a uniform.

GLint Shader::getUniformLocation(const GLchar* name)
{
  // This is a very slow operation, optimize later.
  glGetUniformLocation(m_ShaderID, name);
  return 0;
}

This was causing 0 to be passed as the location for glSetUniform* calls. I'm not sure how, but fixing this function stopped the unpredictable behavior when initializing uniform variables from within the shader program. I'm still going to take Trevor's advice and set them from within my main program.

sentences:
Diamond shaped selection on a staggered iso map I have a staggered isometric tile map and want to do a selection that aligns with the diamond shape of the tiles.

This is what I mean:

So I got two points on screen and their map cell coordinates. How do I iterate over all tiles that are within the selection?

What I got to help with this is a method that gets the neighboring tiles.

sentences:
How can I implement world generation like in Don't Starve? I am working on a game similar to Don’t Starve. Mechanics of the game are all also pretty similar. You craft things, you can explore a random open world and you need to survive. Because I really like the way Don’t Starve generates worlds with biomes, and this branch like structure:

I want my world generator to generate worlds similar to this on a large tilemap, with custom biomes, but I don’t think they use perlin noise for it.
Here you can see different biome sections of the game:

Also I want to explore other possibilities than noise to generate worlds, so I don’t want to use it for this project.

sentences:
Unity LWRP Sprite Renderer Sorting incorrectly after upgrading I'm making a project where every tile is a sprite renderer, this would work fine in the old unity system (from the fact that it used it until recently), but upgrading to the LWRP broke the sorting of the sprite renderers. Previously, I didn't have to change the order at all, but now they phase in and out of each other based on the position of the camera, like the picture shown below. They all use LWRP/2d/Sprite-Lit-Default, as any other of the LWRP materials do not use the texture from the sprite renderer and instead make it all black.

I do not want to use sorting layers because I have meshes sprinkled in, and what i have seen there is no way to control if the mesh is on anything but order 0, besides some hacky way. Even using a box mesh it gets cut off when the floor is closer to the camera.

Here is what it looks like far away, the floor should be there the entire time and not have the darkness of the walls seeping down into them.

I don't think I can use mesh renderers either, as I want a way to control the texture from each individual object, and share a material through all of them. I think if I used a mesh renderer I would have to use a material for each different tile, and I would not be able to tile them like I am doing now.

sentences: Where can I find a free SDK for C#? I need a free and recent SDK for use with C#. I will work first in 2D games with visual effects. Thanks for now.  Can anyone help me?

sentences:
How do I create a ToggleButton via code? How do I create a ToggleButton via code? I tried using ButtonGroup. Using a CheckBox works, but TextButton does not:

...
CheckBox checkBox = new CheckBox("one", skin);
CheckBox checkBox2 = new CheckBox("two", skin);
CheckBox checkBox3 = new CheckBox("three", skin);

ButtonGroup buttonGroup = new ButtonGroup(checkBox, checkBox2, checkBox3);
...

...
TextButton playButton = new TextButton("one", skin);
TextButton playButton2 = new TextButton("two", skin);
TextButton playButton3 = new TextButton("three", skin);

ButtonGroup buttonGroup = new ButtonGroup(playButton, playButton2, playButton3);

I found this example, but I still can not adjust the background:

TextButtonStyle textButtonStyle = new TextButtonStyle();
textButtonStyle.font = someBitmapFont;
textButtonStyle.fontColor = Color.WHITE;
textButtonStyle.downFontColor = Color.BLACK;
//Optional color to toggle between when pressed
textButtonStyle.checkedFontColor = Color.GREEN;
final TextButton textButton = new TextButton("Text", textButtonStyle);
final TextButton textButton2 = new TextButton("Text", textButtonStyle);
final TextButton textButton3 = new TextButton("Text", textButtonStyle);

ButtonGroup buttonGroup = new ButtonGroup(textButton, textButton2,textButton3);

On the left is what I am left with; on the right is what I want.

Here is my current code:

com.badlogic.gdx.scenes.scene2d.ui.Button$ButtonStyle: {
    default: { down: default-round-down, up: default-round },
    toggle: { down: default-round-down, checked: default-round-down, up: default-round }
},

com.badlogic.gdx.scenes.scene2d.ui.TextButton$TextButtonStyle: {
    default: {
        down: default-round-down, up: default-round, font: default-font, fontColor: white
    },
    toggle: {
        down: default-round-down, up: default-round, checked: default-round-down,
            font: default-font, fontColor: white, downFontColor: red
    }
},

sentences:
Rotate player to vector3 point? I want my player object rotate to face vector3 point on terrain.

public Vector3 RocketPointer;
public Transform pointer,Player;
public bool rocket_, button_move;

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

    if (button_move == true)
    {
        Ray mouseRay = Camera.main.ScreenPointToRay(Input.mousePosition);
        RaycastHit mousePoint;

        if (Physics.Raycast(mouseRay, out mousePoint, 100))
        {
            RocketPointer = mousePoint.point;
            pointer.transform.position = RocketPointer;
        }

        if (button_move == true && Input.GetMouseButtonDown(0))
        {
        // rotate player object to face rocketpointer point
            rocket_ = true;
            button_move = false;
        }

    }

    if (button_move == false && Input.GetMouseButtonUp(0))
    {
        rocket_ = false;
    }

}

public void move_button() // UI button
{
    button_move = !button_move;
}

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: Syncing first person arms and enemy character for struggle in games Some FPS have it where your arms are struggling or doing something melee to a character model. Both the arms and the character you're interacting with are sync'd up in the animation. What's the general idea behind how that syncing is done?

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:
Snap-to-Grid building palcement So I have created plane in which my buildings are going to be placed on and I was wondering how to add grids to it and make my building snap to it, just like in clash of clans.

Thanks!

sentences:
What is the right way to implement a loading screen in cocos2d-js? We have two scenes that are loaded with heavy computation; a map screen and a puzzle screen. When we change the scene from A to B, the app gets stuck on scene A for a while before it renders scene B.

So to avoid confusion, we created a dummy scene with 'Loading...' written on it and then on it's onEnter function we change to scene B. The game now gets stuck on the dummy loading scene now instead. But the loading scene takes in touch inputs and the device's native button inputs and triggers it as soon as scene B enters. So the map scrolls if you swipe on the loading scene and puzzle takes input on tapping the loading screen.

Has anyone implemented a proper loading scene with cocos2d-js?

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:
How to rotate an object so that it is aligned with a vector? I have the following Scenario:
Two moving objects (A and B in the picture) need to appear "connected" by a third one (C in the picture). I set the position of the connecting object C as "halfway" between A and B, but how do I rotate it in such a way that it is alined with the vector that connects them (i.e. the result of A - B)? I've tried with D3DXMatrixLookAtRH(&rotate, &eye, &look, &UP_VECTOR) where eye = (0,0,0),look = A's position - B's position and using the rotate matrix as a rotation matrix for C but the result doesn't look as what I expect.

sentences:
Is there a reason online video games don't have "benches"? In many physical team sports, in addition to the players deployed on the field, there are also players on the bench who the coach can sub in when the players get tired or run into unforseen circumstances. This is more common at low levels of play.
However, in online e-sports (e.g. Overwatch, League of Legends, Counter Strike), this is almost universally absent, with everyone who queues expected to play the entire duration of the game. This is not always possible, nor, in the case of solo queue, always desired. If it does exist at all, it involves players joining games in progress, which means that the subbing team is left with no one until a replacement shows up, and players being subjected to new skill ratings that they weren't originally matched up to. I have never seen the concept of one or more bench players being available from the start, known to both teams at the start, and available to sub in as needed, akin to how a physical sport would operate.
Why is this? Are there cons to such a system that would cause it to fail or cause more problems than it solves? Has this been tried before somewhere?

sentences:
Realistically drivable car I want my car to be realistically drivable (like in real life...)

Unfortunately all I did so far is Rotate the whole vehicle using A and D; and AddForce in forward-backward direction using W and S (which didn't prevent it from moving sideways and yes, I am using Rigidbody)

I'm assuming I'd have to let front wheels rotate independently from the rest of the car, but how do I use them to move the car? And how do I force the car to move only in the direction of the wheels while still making drifting at high speeds possible?

sentences:
How do I write a wave-spawning system for a shoot-em-up? I recently played Knightmare Tower and was amazed by the way how different monsters are beign spawned.

I'm aware of time-based and count-based spawing systems in shoot-em-ups. Count-based systems allow a certain number of enemies on screen and spawn more as they die. Time-based ones spawn more at given intervals.

How are these spawning mechanism built? Is there some pattern or theory to it?

Additionally, such games typically have increasingly resilient enemies of increasing numbers of types. How are these balanced?

I'm looking for a general answer, independent of any particular game or technology.

sentences:
Networking problems when sending textures from the server When a client connects to my game server, the server sends textures and then the world information.
The problem is that the texture information may come after the world information and so the client errors out because it has no texture to give the models.

How would I combat this?

sentences:
Physics for curved edges? I'm learning how to program simple two-dimensional games in C++ using SFML, I've done a relatively simple pong game already I would like to ask how I could go about creating the physics for a curved edge such as one on an air hockey table Such as this:

Do I have to code a type of reflection of xVelocity/yVelocity for every single point or what? How do I even add a curved edge such as that in the first place?

sentences:
Is it a good idea to use a single sqlite database to store all occurring multiplayer matches? I have a turn based strategy game for desktop and mobile, the game app uses a sqlite database to play local games. There's nothing special about the database design, I have tables to keep track of units in the game, player commands, etc.

I want to implement multiplayer now on a dedicated game server, and am thinking of using the same setup as the client apps. I'd create a sqlite db on the server file system for each game my users create. I'm expecting around 1,500 simultaneous games (based on other games I've run).

Here are the pros I imagined:

I can reuse all the game code as-is - I just point the game wrapper server-side to a sqlite db on the server machine.
Cheap to start and delete games (happens quite often with turn based games).

Downsides:

Hitting disk a lot, since sqlite is a wrapper around a file basically (my game server has SSD drives, tho).
Portability - I'd have a mess of sqlite files on the file system. If I have to move servers, could be a little gross copying them to a new machine. Also have to check the # of files in a directory limit for my OS, or shard them.
Front end synchronization - I'd still have to have a centralized mysql db or similar to keep track of all the individual games on disk, their general states (started, waiting, ended etc) for general user queries on their games list.

I'd be interested if anyone has tried a setup like this. I can always use a single mysql instance and one set of tables shared between all games, just need to add a gameId column to separate all the data. It would be interesting to see the Units table though with millions of rows shared between all the games.

Thanks

sentences:
Optimization for lots of UV coordinates update for tilemap animation In my game, I procedurally generate tile map mesh and modify it when travelling around the "world". Each tile is a quad. So they each, have their own UV points. (Obviously)

I am using Unity for this, and in Unity, i can't have more then 65k vertices in a single mesh.

So i made this "tile mesh", chunk based. It's still a single mesh. But while I am creating it, i first create the "chunks", (which are 16x16 quad meshes), then i "merge" the chunk meshes to create the tile map mesh.

I keep these "chunk meshes" in a list. So basicly i merge all the meshes in the list when i want to "update" the tilemap mesh.

While i am travelling in the world, i can remove farthest chunk from list, and add new chunkes when it's necessary. List capacity is fixed to 9, so i can never exceed the "65k vertices limit".

Now the problem is, when i zoom out in game, there becomes almost 40k vertices in the scene since whole mesh becomes rendered. (Actually since it's a single mesh, it always renedered as whole, but the animation doesn't occur out side of the camera view)

But when i zoom out, there are like atleast (6x6)x(16x16) = 9.216 tiles. Which makes 36.864 vertices (and UV points).

Now updating few tiles (so few uv points) is easy. But updating the whole 36k point takes like 1-2 seconds. Which is really bad for updating animation in that way.

The code snippet for single quad uv update is here

public void SetTile(Coord chunkCoord, Coord tileCoord, Sprite sprite)
    {
        Vector2[] uv = meshFilter.mesh.uv;
        Rect spriteRect = sprite.textureRect;

        int chunkIndex = SearchForChunk(chunkCoord);

        if (chunkIndex == -1)
        {
            Debug.LogError("Chunk not found");
            return;
        }

        int ui = chunkIndex * (16 * 16) + (tileCoord.Y * 16 + tileCoord.X);
        ui *= 4;

        uv[ui] = ToUV(new Vector2(spriteRect.xMin, spriteRect.yMax), sprite.texture);
        uv[ui + 1] = ToUV(new Vector2(spriteRect.xMin, spriteRect.yMin), sprite.texture);
        uv[ui + 2] = ToUV(new Vector2(spriteRect.xMax, spriteRect.yMin), sprite.texture);
        uv[ui + 3] = ToUV(new Vector2(spriteRect.xMax, spriteRect.yMax), sprite.texture);

        meshFilter.mesh.uv = uv;
    }

It takes chunk coordinate, and finds that chunk in the chunk list, so i can get the index of that chunk mesh for UV array.

The sprite that i get as a parameter is in a "sprite atlas", so i call a helper function to convert it's rectangle to uv points.

That's how i update a single tile's UV points.

But It's too slow, how can i optimize it, make it faster?

sentences:
Tilemap Collision w/ different height levels and directions I've been programming a final fantasy 6 clone in C# using Monogame and Monogame Extended, and have met on a few interesting challenges regarding tilemap collision.

The game seems to have different height levels on tilemaps, such as in the picture below where the bridge is on one height level and the ground on another. I'm using Tiled for my maps and have the bridge on it's own layer, and the ground on another. However, when it comes to collision, you shouldn't be able to for example walk up on the bridge and end up on the ground, which leads to the problem of collision detection. Collision for the ground level should be different than on another height level like the bridge, but I'm not sure what a good solution to handle that could be.

Since I'm using TiledMap from Monogame Extended, I can't really modify the Tile class to hold collision data. My initial idea was to have an extra object or tile layer for each height level to specify collision/solids for each height level, but I found that it wasn't very intuitive and that it was a little messy. Optimally I would only need one tile layer per height level, but I'm at a loss for any ideas on how to handle collision in a scalable and intuitive way, so I was wondering if anyone here had any ideas?

Another interesting problem is regarding tile collisions and directions. For example, when standing in front of the fence in the picture below, you should not be able to walk up and behind the fence. But, if you are standing one tile above the fence, you should be able to walk down and behind it, but once you are behind it you should not be able to walk down again and end up in front of it.

I think the solution to that problem is to define collisions on each edge of the tile, so that the bottom edge of the tile is marked as solid, while the other edges aren't. The main issue with that is that I have no idea how to implement something like that with Tiled. It also presents the problem of rendering, since the tile would need to be rendered below the player if the player stands in front of it, and above the player if the player stands behind it. I think using a Z-index would solve it, but again, I haven't found a way to implement that using Tiled. Soo, I was wondering if anyone has any ideas or pointers on how to use Tiled w/ Monogame + Monogame Extended to implement those things?

sentences:
How do I draw lines to a custom inspector? I have a custom editor to which I want to be able to draw a basic line graph. I have much of the functionality down, but I have only been able to test as much via the debug. I am yet to figure out how to draw the actual lines to the inspector.

How do I draw lines to a custom inspector?

I have found plenty of online resources, in regards to custom drawing to the editor. However, everything I find pertains specifically to drawing in the scene view; nothing seems to work inside of an actual inspector.

The two general methods I have found involve using Handles.DrawLine and the GL library. Neither appear to work; however, I have only been able to test functionality with blind coordinates, so far. I can not find anything in regards to actually determining the local coordinates of the area on the inspector where I wish to draw. Perhaps I need to start with an initial "origin" position, Perhaps I need to start with a local area defined by a Rect. I simply don't know.

It has also been a while since I had to use OpenGL, directly. It is entirely possible I am simply doing it wrong, to begin with. Here is my current graph method:

private void DrawVelocityGraph(float[] velocityValues, float minimumVelocity,
    float maximumVelocity)
{
    float velocityValue = velocityValues[0];
    float increment = 0;
    Vector3 lineStart = Vector3.zero;
    Vector3 lineEnd  = new Vector3(horizontalIncrement, velocityValue * verticalIncrement);

    GL.Begin(GL.LINES);

    for(int i = 1; i < velocityValues.Length; i++)
    {
        if(velocityValue == velocityValues[i]
            && (velocityValue == minimumVelocity || velocityValue == maximumVelocity))
        {
            Handles.color = VelocityGrapherColours.outOfRangeColour;
        }
        else
        {
            velocityValue = velocityValues[i];
            Handles.color = VelocityGrapherColours.lineColour;
        }

        lineStart = lineEnd;
        lineEnd.x += increment;
        lineEnd.y = velocityValue * verticalIncrement;

        GL.Vertex(lineStart);
        GL.Vertex(lineEnd);
    }

    GL.End();
}

sentences:
unity webgl not working on server I own the servers of hokuco.com, I am wondering why my test build(not a development build) is not working in webgl I tried a test run as a .exe and it works fine. here is the url to my webgl project, can you determine what is wrong?
http://hokuco.com/test/index.html
(no files on my server are blocked, feel free to view the .htacess, js and other files) the screen is black and nothing is happening.
.htacess:

Options +FollowSymLinks
RewriteEngine on

RewriteCond %{HTTP:Accept-encoding} gzip
RewriteRule (.*)Release(.*)\.js $1Compressed$2\.jsgz [L]
RewriteRule (.*)Release(.*)\.data $1Compressed$2\.datagz [L]
RewriteRule (.*)Release(.*)\.mem $1Compressed$2\.memgz [L]
RewriteRule (.*)Release(.*)\.unity3d $1Compressed$2\.unity3dgz [L]
AddEncoding gzip .jsgz
AddEncoding gzip .datagz
AddEncoding gzip .memgz
AddEncoding gzip .unity3dgz

all my js files seem to be blocked.(but not jsgz...)

sentences: How do i move a 2D object with angle and speed variables in unity? I want to move an object with a certain angle and speed, is there a was to set this as an initial velocity so that it is still possible for the object to collide and bounce of other objects using its rigid body?

sentences:
When do I copyright a game? I don't know how to copyright a video game idea.

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

The main gist is.. I am lost.

sentences:
Transform.LookAt rotates the sprite and collision not triggering I've applied the below script to a gun object to instantiate bullets to the direction of the mouse position.

The bullet collision is not getting triggered since the bullet has been rotated.

How to solve this.

void FixedUpdate()
    {

        mousePosition = Input.mousePosition;
        mousePosition.z = 0.0f;

        //Gun Rotation

        objectPosition = Camera.main.WorldToScreenPoint(transform.position);

        mousePosition.x = mousePosition.x - objectPosition.x;
        mousePosition.y = mousePosition.y - objectPosition.y;

        angle = Mathf.Atan2(mousePosition.y, mousePosition.x) * Mathf.Rad2Deg - 90;

        Vector3 rotationVector = new Vector3(0, 0, angle);
        transform.rotation = Quaternion.Euler(rotationVector);

        //Gun Rotation

        if (Input.GetMouseButtonDown(0))
        {
            GameObject bullet = (GameObject)Instantiate(bulletObject, transform.position, transform.rotation);
            bullet.transform.LookAt(mousePosition);
            bullet.GetComponent<Rigidbody2D>().AddForce(bullet.transform.forward * bulletSpeed);
        }

    }

sentences:
How do I rotate and object around itself, and translate it at the same time? I have this animated gif of my problem.

I have a sprite object with a box collider, and I'm trying to rotate it around its center.

My rotation script consists of this :

this.transform.Rotate (0, 0, Time.deltaTime * rotateSpeed);

and in the translation script this is the code :

this.transform.Translate (0, -tranSpeed * Time.deltaTime, 0);

but as you see in the gif it does not give me the effect I desire.
Can anyone give me what am I supposed to do to be able to rotate it around its center? Thank you.

sentences:
Glenn Fiedler's fixed timestep with fake threads I've implemented Glenn Fiedler's Fix Your Timestep! quite a few times in single-threaded games.

Now I'm facing a different situation: I'm trying to do this in JavaScript. I know JS is single-threaded, but I plan on using requestAnimationFrame for the rendering part.

This leaves me with two independent fake threads:  simulation and rendering. Timing in these threads is independent too: dt for simulation and render is not the same.

If I'm not mistaken, simulation should be up to Fiedler's while loop end. After the while loop, accumulator < dt so I'm left with some unspent time (accumulator) in the simulation thread.

The problem comes in the draw/interpolation phase:

const double alpha = accumulator / dt;
State state = currentState*alpha + previousState * ( 1.0 - alpha );
render( state );

In my render callback, I have the current timestamp to which I can subtract the last-simulated-in-physics-timestamp to have a dt for the current frame.

Should I just forget about this dt and draw using the physics thread's accumulator? It seems weird, since, well, I want to interpolate for the unspent time between simulation and render too, right?

Of course, I want simulation and rendering to be completely independent, but I can't get around the fact that in Glenn's implementation the renderer produces time and the simulation consumes it in discrete dt sized chunks.

A similar question was asked in Semi Fixed-timestep ported to javascript but the question doesn't really get to the point, and answers there point to removing physics from the render thread (which is what I'm trying to do) or just keeping physics in the render callback too (which is what I'm trying to avoid.)

sentences:
How does this snippet of code create a ray direction vector? In the Minecraft source code, this code is used to create a direction vector for a ray from pitch and yaw:'

float f1 = MathHelper.cos(-rotationYaw * 0.01745329F - 3.141593F);
float f3 = MathHelper.sin(-rotationYaw * 0.01745329F - 3.141593F);
float f5 = -MathHelper.cos(-rotationPitch * 0.01745329F);
float f7 = MathHelper.sin(-rotationPitch * 0.01745329F);
return Vec3D.createVector(f3 * f5, f7, f1 * f5);

I was wondering how it worked, and what is the constant 0.01745329F?

sentences:
What's wrong with my animation trigger script? So I am making an RPG and I am setting up the player. I am trying to trigger an attack animation by pressing a button. I wrote this down and I get an error that says "Expressions in statements must only be executed for their side-effects". I don't know what that means, but it is an error that won't let me play the game without fixing it. I'm not sure where to go from here. How would I fix the error? EDIT: I'm not using Mecanim, nor am I planning on using it.

This is the script. It is in JavaScript (Unity3D).

#pragma strict

var anim: AnimationClip;

function Start()
{
    animation["Sword Slash"].layer = 4;
    animation["Sword Slash"].wrapMode.Once;
}

function Update ()
{

    if (Input.GetKeyDown ("c"))
    {
        animation.Play("Sword Slash");
    }
}

sentences:
Smooth Voxel Terrain As a personal project, I'm trying to make a terrain generator that will create terrain looking something like the Castle Story smooth terrain.

If you haven't seen it before, here:

So as you can see, it's  combination of blocks and "smooth" blocks.

What I've tried to do to emulate this look is to give each surface block a mini heightmap.  This generally works, but there are some issues, yielding a terrain like this:

The problem is is that each block is 1x1x1, but sometimes the height at a particular location is negative or > 1.  In that case, I clip it and set the height to 0 or 1.

To better illustrate what I mean, here's a diagram:

To generate the height, I basically do:

genColumn(int x, int z)
{
    int highestBlockY = (int)noise2d(x, z);

    bool is_surface = true;

    for(int y = max_height - 1; y >= 0; y--)
    {
        Block b;

        if(is_surface)
        {
            b = Block.Grass;
            b.HasHeightMap = true;

            // generate heightmap
            for(int ix = 0; ix < 5; ix++)
            {
                for(int iz = 0; iz < 5; iz++)
                {
                    float heightHere = noise2d(x + ix / 4, z + iz / 4) - y;

                    // clip heights
                    if(heightHere > 1)
                        heightHere = 1;

                    if(heightHere < 0)
                        heightHere = 0;

                    b.HeightMap[ix][iz] = heightHere;
                }
            }

            is_surface = false;
        }
        else
        {
            b = Block.Dirt;
        }

        setBlock(x, y, z, b);
    }
}

Perhaps I'm approaching this incorrectly by using the "true" perlin noise value?

Any help would be greatly appreciated!

sentences:
Supporting multiple graphics apis I would like to provide support for switching between both OpenGL and Vulkan in my game (and potentially DX12 later).  Currently I only know OpenGL so I am working on that.
I have read a lot of posts about supporting multiple apis.  Thus far I have been creating a non-specific interface with virtual functions for which I then create a .h/.cpp for the the OpenGL specific implementation.  For example, I have a GraphicsDevice.h and a GLGraphicsDevice.h and GLGraphicsDevice.cpp.  I then have this in my initialisation code:
GLGraphicsDevice gl_graphics_device = GLGraphicsDevice(&gl_window);
GraphicsDevice* graphics_device = &gl_graphics_device;

Using the above approach I would have to determine somehow whether graphics_device would be GLGraphicsDevice or VKGraphicsDevice which I would most likely do using a configuration file.
I recently came across a different approach of handling multiple apis suggesting the use of macros:

Have a base class with the common data e.g., IndexBufferBase.
Each API class (e.g. GLIndexBuffer) inherits from the base class and handles API-specific functionality, such as creating the index buffer and drawing with it.
IndexBuffer inherits from one of the API classes depending on which macro is set.

I'm not sure how I would set the macros for the above approach.
I've read that macros should be avoided but I've also read that virtual function calls are costly, so which is the better approach?  Or perhaps there is another option?
Edit: Based on helpful feedback in the comments I have narrowed my goal to providing compile-time support for multiple apis.

sentences:
Fastest way to get all adjacent tiles? What is the fastest way to get all adjacent tiles in a two-dimensional array of tiles, converted into a single-dimensional array?

If you don't know the answer, then the fastest way to do it in a two-dimensional array would be fine as well.

I tried the following, but it does 9 calculations, which is 1 too much when it comes to optimization.

for(int x = -1; x <= 1; x++) {
  for(int y = -1; y <= 1; y++) {
    if(x != 0 || y != 0) {
      Tile adjacent = Tiles[current.x + x, current.y + y];
    }
  }
}

sentences:
bump mapping with 2 normal maps I was wondering if its actually possible to do bump mapping with 2 normal maps... I have tried doing it this way however I get a function overload on max and dot.

uniform sampler2D  n_mapTex;
uniform sampler2D  n_mapTex2;
uniform sampler2D  refTex;

varying mediump vec2  TexCoord;
varying mediump float vTime;

void main()
{
    mediump vec4 wave = texture2D(n_mapTex, TexCoord - vTime);
    mediump vec4 wave2 = texture2D(n_mapTex2, TexCoord + vTime);
    mediump vec4 bump = mix(wave2, wave, 0.5);
    //this extracts the normals from the combined normal maps
    mediump vec4 normal = normalize(bump.xyzw * 2.0 - 1.0);
    //determines light position
    mediump vec3 lightPos = normalize(vec3(0.0, 1.0, 3.0));

    mediump float diffuse = max(dot(normal, lightPos),0.0);
    gl_FragColor = mix(texture2D(refTex, TexCoord), bump, 0.5);
}

sentences:
Unable to generate standalone noise I've been stuck this evening on getting a Perlin Noise function to generate by itself. Every time I run the program without adding to different types of noise together it calls an ArgumentException error.

Here is my code I'm using.

        //perlin gen
        Random rand = new Random();
        double freq = 1 / 32.0;
        double lacu = 3.0;
        int octave = 5;
        double pers = 0.5;
        int seed = 1;

        Perlin perlin = new Perlin(freq, lacu, pers, octave, seed, QualityMode.High);

        //init the noise map
        noiseMap = new Noise2D(128, 128);
        noiseMap.GeneratePlanar(1, 2, 1, 2, true);

And the error that it calls is here.

public void GeneratePlanar(double left, double right, double top, double bottom, bool seamless)
    {
        if (right <= left || bottom <= top || this.m_generator == null)
        {
            throw new ArgumentException();
        }

I've checked and re-checked the code multiple times, so I'm not sure what is going on that is making the GeneratePlanar function call the ArgumentException error.

sentences:
How to make it clear that a game is in Beta? I develop games on ROBLOX which is a site full of user-generated games that are typically free for other users to enjoy. Many users have studios in which they have a consistent set of playtesters, but I am the only developer in the case of my project. Nonetheless, I still have the need to test my game at times, so I recruit random people from the forums of the site (specifically the site's "Scripters forum"). While recruiting from the forums is a reliable and quick way to get players, it may be hard for them to get over the fact that the game is meant to be unfinished.

ROBLOX has a like and dislike system, and during testing I have already received three likes and one dislike. The dislike concerns me because I feel that someone probably evaluated my game on the notion of "This game should be working for me, but it's not." when those problems are the purpose of why I recruit people to go to the game in the first place. Many users even absurdly evaluated the game on its artistic value  which I believe to be an afterthought in the game development process versus functionality which should be at its core.

For the future, how do I make it clear that the current game should be evaluated for its functionality, and that in the beta phase, it may or may not work for all users?

Side note: I do some preliminary testing before I recruit testers to the game, so it works at the very least on my device, but their own experience varies based upon their quality of connection and device.

sentences:
Which parts to draw in an infinite world? I have an infinite world (from Perlin Noise).

The world is generated in sectors that are that are big cubes (each with a random colour, in the image above; my sectors are 10x10x10).

I'm currently putting the sectors in a hash-table tagged by their top-left-front corner coordinate.  I can loop through all the sectors I've already generated and see if they intersect the frustum.

But how can I compute instead the sectors that I haven't generated but are visible and need generating on-demand?

Even if I have an octree or some other spatial index, I need to compute the sectors that are visible inside the frustum rather than those I've already generated.

sentences:
Animating Two Objects' Interaction? I want to animate a character who could be doing any number of things.

Say for example, I want the character to get into bed, under the covers. Do I animate the character and the sheets moving together? Separately? If separately do I need to call both animations simultaneously to ensure it fits together properly?

Or, if two characters are going to hug. Do I animate them hugging or just animate them separately hugging and try to align them in-game?

sentences:
Unity3D Android - Move your character to a specific x position I want to move my character (which is a cube for now) to a specific x location (on top of a flying floor/ground thingy) but I've been having some troubles with it. I've been using this script:

var jumpSpeed: float = 3.5;
var distToGround: float;

function Start(){
    // get the distance to ground
    distToGround = collider.bounds.extents.y;
}

function IsGrounded(): boolean {
    return Physics.Raycast(transform.position, -Vector3.up, distToGround + 0.1);
}

function Update () {
    // Move the object to the right relative to the camera 1 unit/second.
    transform.Translate(Vector3.forward * Time.deltaTime);

    if (Input.anyKeyDown && IsGrounded()){
        rigidbody.velocity.x = jumpSpeed;
    }
}

And this is the result (which is not what I want):

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

Does anyone have any idea how to do this? I'm using UnityScript (Javascript).

sentences:
Why does a UI button that is child to a canvas not appear in game view? I am trying to place a button onto a canvas background using C# script.
I want the button specific to the canvas (i.e., if I move the camera to look at another canvas, I do not want the button visible).

My C# script is below. I have attached it to an empty game object.
When I run the game, the Heirarchy panel of Unity shows that the canvas and button are created OK, and that
the button is a child of the canvas.
The canvas appears in game view at the right size (200 x 200).

But in game view, there is no button!

The button is definitely present ; clicking on its name the Heirarchy panel shows me a location and size in the scene view that are exactly as specified in my C# script.
But nothing happens when I click the region in game view where the button is supposedly present.

Unity's Inspector panel shows that a "Button (Script)" has been attached to my button object, with Rect Transform parameters as specified in my C# code.
I tried messing with the colors, but still no button.
The "On Click()" window contains nothing except the message "List is Empty".

How do I make the button appear in game view?

How do I make the button work (i.e., generate the Console message "button pressed")?

using UnityEngine;
using System.Collections.Generic;
using UnityEngine.UI;
using UnityEngine.EventSystems;

public class TestScript : MonoBehaviour {

private GameObject myGO;
private Vector2 buttonSize;
private Vector3 buttonPosition;

void Start () {
// setup a canvas
    myGO = new GameObject ();
    Canvas myCanvas = myGO.GetComponent<Canvas> ();
    myCanvas.renderMode = RenderMode.WorldSpace;
    RectTransform parentRectTransform = myGO.GetComponent<RectTransform> ();
    parentRectTransform.sizeDelta = new Vector2 (200, 200); // set size of parent rectangle

// create and place the button
    Vector2 buttonSize = new Vector2 (10, 10);
    Vector3 buttonPosition = new Vector3 (150, -70, 1);

    CreateButton (myGO.transform, buttonPosition, buttonSize);
}  // end Start()

public void CreateButton(Transform panel ,Vector3 position, Vector2 size)
{
    GameObject button = new GameObject();
    button.name = "Button";
    button.transform.parent = panel;
    button.AddComponent<RectTransform>();
    button.AddComponent<Button>().onClick.AddListener (handleButton);
    button.transform.position = position;
}

void handleButton() {
    Debug.Log("Button pressed!");
}

} //  end class TestScript

sentences:
Reloading scene in Unity gives weird result I am making an infinite racing game where you fly an airplane while trying to avoid obstacles. I recently finished my menu that comes up when you die. When I press the restart button that simply reloads the current scene like this:
SceneManager.LoadScene(1);
it gives me a weird result. The obstacles starts generating at about the same position as you died previously. I never get this problem when I start the game with the Unity play button. The only thing I could think off was player prefs. It should not affect the generation of obstacles but tried anyway to use:
PlayerPrefs.DeleteAll();
before reloading the scene, but that did not work. What could be causing this strange problem?

sentences:
Resetting variables when starting a new game What is the best practice when implementing a way to start a game when a previous game has been played and the game's variables have already some kind of values assigned to them?

The most naive answer would be to create a method that would set all the variables and objects the game uses to their default value.

However that would be obviously error prone in cases when some time later a new variable is added to the game and not added to the method where it's set to a default value - such cases could lead to impossible to track bugs when a game would work ok if started first time, but not thereafter.

This would also violate DRY principle as a variable would have a default value at two different places - in the place where it's used and in the method where it's reset.

sentences:
Unity3D) Is there a way not to draw line renderer if vertex pos is zero? I make a curved line with line renderer.
and a sphere move along it.
i want to draw a line only behind the sphere.

so i do something like this.

``
lr.positionCount = 256;

    while (delta < time)
    {
        lr.SetPosition(i++, curPos);

        yield return new WaitForFixedUpdate();
    }

``

and the problem is, because of i set the size of Positions 256,
if time is short, there are zero vectors in position.
so line renderer draw meaningless line.

is there a way to set PositionCount dynamically like List?
or any good way to not draw if positions are zero?

sentences:
Averaging Camera Position I'm making a camera which tracks the player. I am using a basic algorithm to calculate a position for the camera relative to the player. Then I am taking an average of this over the last x number of frames. This creates a nice chase camera which always slightly lags and evens out the players movements.

Where I am running into trouble is with delta Time. How can I weight each entry in my list of previous positions so that delta time is taken into account. Currently I'm having an issue where, when the frame rate is particularly slow, the camera lags really far behind the player.

I should also mention that currently I am adding each entry ElapsedTimeInSeconds/0.01f times to give the weight. So the average is effectively over fewer frames if the frame rate is slow. I also tried entering values as Value * DeltaTime, then keeping an average of delta time to divide the values by when I get them back out of my average tracking class but that didn't work.

What I think I really want is an average over the last n seconds rather than the last n frames.

sentences:
Unity 5.3.5 - Blurry UI text after switching canvasses - until text is refreshed by turning visibility off/on or changing resolution I have multiple scenes in my project where the canvas are switched between, each canvas having UI text included on it.

The project was originally created in version 5.0 and I have just updated to version 5.3.5 and I am now encountering the following issue -

The canvas that is active when the scene first loads displays all UI text just fine, but as soon as I switch to another canvas with the exact same text on, the text on the new canvas is blurred. As soon as I turn the text object off/on (via a button click) it appears to refresh it and it all displays fine again.  It is also rectified by changing the display resolution in the editor play window.

It appears as though unless it has a 'refresh' through clicking something else, or is on screen when the scene first loads, it appears blurry.

The font is 'Open Sans Bold' and I am switching canvasses via a raycast script.

I have read issues of text blurriness in 5.3, but most instances appear to be down to the size of the text being in odd numbers which mine isn't.

Screenshots attached. The settings shown are the same for all canvasses and text.

Any help would be appreciated.

Thanks in advance

sentences:
C99: Dynamic dispatch in math library depending on SIMD Say I am developing a Math library and I want it to be such that it will detect whether or not user's machine support SSE (and which version) and based on that, different functions will be called. I can think of three ways to implement that:

Have global function pointers in the library and let user call mathInit() i their source. When they do, figure out the hardware details and assign the function pointers to different functions.
Same, except instead of having global function pointers, put them in a struct which is returned by mathInit(). This way, user will have to call math.vec3Add(...) or similar.
Same as 1, but instead of having global pointers, make mathInit() a macro so that the function pointers will have local scope in user's main() function (and require mathInit() to be called from main()).

Is any of these methods preferable? Is there some other, better way?

sentences:
Anti-cheat: How secure is the client? Let's say, theoretically, that I'm developing a first person shooter with, of course, a map with things like walls. In the client code, the player is obviously halted upon collision with these wall objects. The server, however, only receives the player's location coordinates.

Without some sort of data encoding in the client, the player could easily read the network communication to the server and send false coordinates to the server, allowing them to go wherever they wanted.

My question is, is there a way to encode  this location message to the server before it exits the client binary such that it would be extremely difficult for  someone to read? Even by someone who disassembles the code to try and break the encoding? Or do all player collisions have to be detected by the server?

sentences:
How do I letterbox a C#/Monogame viewport within a resizeable window? I am making a 2d game with xna/monogame. I want the main view area to always show 15x15 tiles, or 480x480px.

I've got something that sort of works, following this guide. It expands the view range if you make the window smaller. However, it works somewhat properly if you expand it. It works as intended if the window is maximized.

I want the range of what is rendered to be no larger than 480px x 480px regardless of the the window's size, but I'd like the sprites to appear bigger if the window resolution is set larger (and conversely).

sentences:
How can I convert screen coordinatess to world coordinates in OpenTK? I'm making a windows forms application with opengl view. I need to get the mouse coords converted to the opengl world coords. Well, my Y coord gets converted wrong. It's hard to explain, so here is the video:
http://tinypic.com/r/23sal8k/6. I'm constantly pressing left mouse button and the red dot should be where the mouse is(but it isn't). Here is the code:

    private void glview_MouseDown(object sender, System.Windows.Forms.MouseEventArgs e)
    {
        if (e.Button == MouseButtons.Left)
        {
            Point worldCoords = convertScreenToWorldCoords(e.X, e.Y);
            shitx = worldCoords.X;
            shity = worldCoords.Y;
        }
    }

    // functions:
    public static Point convertScreenToWorldCoords(int x, int y)
    {
        int[] viewport = new int[4];
        Matrix4 modelViewMatrix, projectionMatrix;
        GL.GetFloat(GetPName.ModelviewMatrix, out modelViewMatrix);
        GL.GetFloat(GetPName.ProjectionMatrix, out projectionMatrix);
        GL.GetInteger(GetPName.Viewport, viewport);
        Vector2 mouse;
        mouse.X = x;
        mouse.Y = viewport[3] - y;
        Vector4 vector = UnProject(ref projectionMatrix, modelViewMatrix, new Size(viewport[2], viewport[3]), mouse);
        Point coords = new Point((int)vector.X, (int)vector.Y);
        return coords;
    }
    public static Vector4 UnProject(ref Matrix4 projection, Matrix4 view, Size viewport, Vector2 mouse)
    {
        Vector4 vec;

        vec.X = 2.0f * mouse.X / (float)viewport.Width - 1;
        vec.Y = -(2.0f * mouse.Y / (float)viewport.Height - 1);
        vec.Z = 0;
        vec.W = 1.0f;

        Matrix4 viewInv = Matrix4.Invert(view);
        Matrix4 projInv = Matrix4.Invert(projection);

        Vector4.Transform(ref vec, ref projInv, out vec);
        Vector4.Transform(ref vec, ref viewInv, out vec);

        if (vec.W > float.Epsilon || vec.W < float.Epsilon)
        {
            vec.X /= vec.W;
            vec.Y /= vec.W;
            vec.Z /= vec.W;
        }

        return vec;
    }

sentences:
How costly is an OpenGL draw call, and how do I optimise them? How costly is a draw call in OpenGL?

What are the ways to reduce the number of draw calls? I have seen people using glMapBufferRange, but I can't figure out how it improves the performance.

How much impact do draw calls have on the overall performance of a program?

sentences:
How to handle normal vector when duplicating vertex? I'm currently developing a UV mapping, such as the UVW Map Modifier in 3ds Max (Not Unwrap UVW Modifier).

I split the vertices of the model in the form of a primitive shape (Box, Plane, etc.) and set UV coordinates. However, in the process of duplicating the normal vector, i ran into a problem.
For example, there is a box model with 8 vertices. We need to split the vertices into 24 in order to mapping texture to the 6 sides of the box and set normal vectors separately. In the case of the box, the normal vector calculation is simple. After splitting the vertices, calculate the normal vector for each triangle.
The problem is when this algorithm is applied to the Sphere model. Split the vertices of the sphere model into a Box Shape. (Box Shape is one of the functions of UVW Map modifier). Setting the UV coordinates is fine. The problem is the normal vector setting of the seam vertices.
Simply calculating the normal vector for each triangle, the normal vector of the vertices of the seam is different. (duplicated vertices have the same position). If the normal vector is different, the lighting is not applied properly. Of course, this is solved by calculating the normal vector of the Sphere model before splitting the vertices. However, this method could not be applied to a box model with 8 vertices. The three split vertices of the box must each have a different normal vector.
In summary, split vertices may have different normal vectors or may have the same normal vector. How would you like to solve this? (I used the Box and Sphere model as an example, but in practice it should be applicable to a variety of models.)

sentences:
D3D12CreateDevice(pAdapter, D3D_FEATURE_LEVEL_12_0) ISSUE I'm getting this error when I compile this code.

D3D12CreateDevice(pAdapter, D3D_FEATURE_LEVEL_12_0,
IID_PPV_ARGS(&pDevice)).
Error! No such Interface supported

I've got a rtx 2060 GPU installed in my computer.
All my GPU drivers are up to date.
I've got the windows 10 version 1803(OS Build 17134.590)
I've got visual studio 2017 installed and used to compile my code.

Here is the code I'm trying to compile.
https://github.com/acmarrs/IntroToDXR

What, in the hell is this error man its so stupid.
I've been stuck for over 6 damn hours man.
Any help, much appreciated.

sentences:
OpenGL 3.3 Core Compatibility with OpenGL 4.x Are all OpenGL calls in 3.3 Core and GLSL 330 core shaders valid and functionally equivalent in OpenGL 4.0 through 4.5 core?

I can't seem to find a clear and definitive answer; both in specification and the real world, is code written for 3.3 core going to function in a 4.5 core context? I've currently kept all of my OpenGL renderer code strictly to 3.3 core profile, but I'd like to take advantage of some features that are only available in 4.0+ and 4.4+ if the user's environment supports those contexts. The change-logs of OpenGL seem fairly simple and it doesn't look like anything in 3.3 core has been deprecated in 4.

Are there new requirements OpenGL 4.0 or 4.4 that makes 3.3 core code used in conjunction with new features like tessellation shaders incompatible?

sentences: Do you need to pay just to put your game as a closed beta on steam? I'm currently working on my game, and we are planning on releasing a closed beta pretty soon. I would like to use Steam to make it, as it has a key generator to give people access, but I can't figure out or find out anywhere if you need to pay for the Steamworks partner, just to make a closed beta.

sentences: Difference between texture.Load and texture.Sample(PointSampler,..) in HLSL/Dx Conceptually, I understand the difference between load and sample but I want to know if essentially point sampling and load do the same thing when it comes to selecting a texture value (ignoring an out of bound situation).

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:
Rotating a Quad in Shader I'm working Opengles2 and I have a just a texture ID and a quad from an SDK and its shader, and I can not access their code, just the vertex and pixel shader.

The quad from the SDK is rotated and flipped. Is it possible to rotate the quad and flip its sides in shader ?

I don't have also the MVP matrix.

sentences:
glGenVertexArrays causes crash My code keeps crashing at runtime, I have done some creative debugging and determined that it was the glGenVertexArrays that was causing the crash, I've looked around and come across some answers that told me to enable experimental mode in GLEW but that didn't work, as far as I can tell my graphics card supports it, my opengl version is 3.1. I'm using freeGLUT and GLEW

here's the code, the line in question is 45
http://hastebin.com/rekizejuza.cpp

std::cout << "made it here\r\n";
glGenVertexArrays(1, &meshID);
std::cout << "not here here\r\n";
glBindVertexArray(meshID);

sentences:
Dynamically change shader syntax with the help of C++ I'm starting with the programmable pipeline and the shaders in C++ for OpenGL 3.0+, i would love to be able to change some settings on the fly, for example replacing a function with another function, supposing that i have a shader with an operation like

var = A + B

my goal is replacing + with any other operation on the fly with my C++ program, maybe with a GUI, but in general terms with C++, the problem is that until now i'm able to run a shader only after compiling it, so i have something like a static approach.

The same goal applies to the values of the vars that i would also like to change through C++.

It's possible with a programmable pipeline? I'm not interested in performance, just if is possible for the C++ to dynamically communicate and exchange data with the OpenGL pipeline.

sentences:
Outputting Unity commandline build log to console? I'm using Blue Ocean to do a Unity3D build through command lines (https://docs.unity3d.com/Manual/CommandLineArguments.html).

I currently have a stage in blue ocean which runs the build command in a 'Windows Batch Script' outputting the log to a text file on the computer.

is there a way to also output that same logging text to the blue ocean build output? Right now all I see is the batch command.

One way to accomplish this would be if the build output was sent to the console instead of just the logfile passed in the argument.

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 do you use custom collision on a skeletal mesh in UE4? I have a vehicle rig that is a skeletal mesh that imports fine in to unreal but I was wondering how to use a mesh for collision on it. Normally you can just name the collision mesh with UCX_ in front of the name to do it but with skeletal meshes it makes you use a system called phat and I only see cubes/spheres/capsules for collision with that.

sentences:
Pyglet Layout won't render? Here's some sample code I copy pasted to try and get a Pyglet layout to work.  I just get a blank screen.  Every time I try to write my own code based on the docs or copy/paste some example code it just will not render the layout.

Interwebs reveal a few other people with this issue but no answers given.

Labels seem to work fine although even they are quirky.

import pyglet

white = (255, 255, 255, 255)

window = pyglet.window.Window(width=200, height=200, caption='Text layout')

# document
document = pyglet.text.decode_text(
    ('Hello World! Hello World! Hello World! Hello World! Hello World! Hello World! Hello World! Hello World! '
     'Hello World! Hello World! Hello World! Hello World! Hello World! Hello World! Hello World! Hello World!'))
document.set_style(start=0, end=0, attributes=dict(font_size=12, color=white))

# text layout
text_layout = pyglet.text.layout.TextLayout(document=document,
                                            width=window.width,
                                            height=window.height,
                                            multiline=True,
                                            wrap_lines=True)
text_layout.color = (.5,.5,.5,1.0)

@window.event
def on_draw():
    window.clear()
    text_layout.draw()

pyglet.app.run()

sentences:
If "ResourceManager" classes are considered bad, what are the alternatives? I'm hearing conflicting opinions such as:

"Dedicated Manager classes are almost never the right engineering tool"
"Dedicated Manager classes are (currently) the best way to survive a large project with thousands of resources"

Let's take a classic ResourceManager class that has the following functionality:

Loads assets (textures, audio, 3D models, etc)
Ensures assets are only loaded once by keeping a cache
Reference counts assets to determine if they can be deallocated
Hides where the actual assets came from (e.g., could be one file per asset, or all assets in one package file, or assets could even be loaded over the network)
Can reload assets without restarting the program, which is extremely useful for the artists working on the game.

Let's also take the "singletons are bad" argument off the table by pretending these ResourceManager objects are not singletons, and instead are passed around via dependency injection.

Then there is the "use a factory" or "call it a factory" argument. My problem with this is that, yes, it is a factory, but it's also a cache and a reloader (for lack of a better word). Calling it a factory doesn't describe it properly, and if I make it a proper factory then where does the caching and reloading get implemented?

I agree that "Manager" classes are often a symptom of bad architecture, but in this particular case how could it be restructured and still retain all of the functionality? Is this a situation where a "Manager" class is actually appropriate?

sentences:
Calculate a random position inside a 2D area excluding a subset Given this area

- - - -
- X X -
- X X -
- - - -

I have a GameObject size 4x4 and inside another GameObject size 2x2.

I know how to calculate a random position inside the 4x4 zone (using GameObject position and collider size), but I do not know calculate a random position evading the 2x2 zone.

What I am using right now is:

Calculate position inside 4x4.
If that position is inside 2x2 go back to step 1.

But it is not a good way to do this.
Do you know can I calculate a random position inside 4x4 area evading a 2x2 area?

I though generating small GameObjects, 1x1 instead if 4x4. So first select a random of the 4x4 tagged,  for examble, as "IsWalkable", and then calculate a random position insided the selected small square.

sentences:
Projectiles in FPS games - OpenGL I have some experience with Blender, but now I am using Xcode 9.2 and OpenGL 4.1 on MacBook Pro. I am also attending a couple of online courses on edX.

I am developing (for fun and as an exercise) a very simple FPS game. I haven't handled collisions, yet, and I am thinking of how to implement projectiles.The question I have about projectiles, when they are actual object and several of them are present simultaneously in the scene, is the following. Is it better, performance-wise, to generate an object for each active projectile or simply reuse the same object but redrawing it several times and with different transformation matrix (passed to the same shader via uniform mat4)?

sentences:
box2d raycast filter category I am trying to filter a category in my ray casting (jBox2D within libGDX), which should return the closest object that does not belong to the category LEVEL0. I've tried a plethora of approaches, but none of them seem to work.

This post, for example, instructed me to do so:

private static class RayCast implements RayCastCallback {
    Fixture f;
    Vector2 point;
    float fraction;

    public RayCast() {
       this.fraction = 1f;
    }

    @Override
    public float reportRayFixture(Fixture fixture, Vector2 point, Vector2 normal, float fraction) {
       if (fixture.getFilterData().categoryBits == Corpo.LEVEL0)
          return 1f;

       if (fraction <= this.fraction) {
           this.f = fixture;
           this.point = point;
           this.fraction = fraction;
       }
       return 1f;
    }
}

Yet, it ignores the LEVEL0 bodies only sometimes, and sometimes ignores other bodies as well (though it seems to work on most cases, it fails frequently enough to be unacceptable). I've tried a few other solutions, including: returning -1 in the first if (which should mean ignore this collision), return this.fraction always, instead of 1, but nothing works - this, in fact, seems to be a very common problem, as the internet is filled with a variety of workarounds, none of them working for me.

I think my library is updated, or at least is the version that is included in the latest libGDX (which, according to my quick research, is the actual latest).

I've posted this same question here, but I'm not sure about the official forum's activity, so I decided to ask here too, just in case. Whichever website gives the answer first, I shall copy it to the other.

sentences:
objects disappear before time I created a little pool in order to better manage my enemies, to which, an enemySpawner object calls to retrieve a clone and show it on screen

public class ObjectPool : MonoBehaviour
{
    public static ObjectPool current;
    public GameObject objectForPool;
    public int poolAmmount = 20;
    public bool growth = true;

    List<GameObject> objectsForPool;

    void Awake()
    {
        current = this;
    }

    // Use this for initialization
    void Start ()
    {
        objectsForPool = new List<GameObject>();

        for (int i = 0; i < poolAmmount; i++)
        {
            GameObject obj = Instantiate(objectForPool);
            obj.SetActive(false);
            objectsForPool.Add(obj);
        }
    }

    public GameObject GetPooledObject()
    {
        for (int i = 0; i < objectsForPool.Count; i++)
        {
            if (!objectsForPool[i].activeInHierarchy)
            {
                return objectsForPool[i];
            }
        }
        if (growth)
        {
            GameObject obj = Instantiate(objectForPool);
            objectsForPool.Add(obj);
            return obj;
        }
        return null;
    }

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

    }
}

The call(EnemySpawner update)

void Update ()
{
    transform.position = new Vector3(transform.position.x + (speed * Time.deltaTime), 0, transform.position.z);
    if (transform.position.x <= boundary.xMin || transform.position.x >= boundary.xMax)
        speed *= -1;

    if (Time.time > nextSpawn)
    {
        nextSpawn = Time.time + spawnRate;

        GameObject clone = GetComponent<ObjectPool>().GetPooledObject();
        if (clone == null || clone.activeInHierarchy) return;
        clone.GetComponent<EnemyMovement>().SetPlayerShip(playerShip);
        clone.transform.position = transform.position;
        clone.transform.rotation = transform.rotation;
        clone.GetComponent<Health>().RestoreHealth();
        clone.SetActive(true);
    }
}

The problem here is, that my enemies are being deactivated on mid trajectory

https://youtu.be/ZGHC6wwGX1E

I know my issue is in my pooling, but I can't figure out what I'm doing wrong

sentences:
How can I handling rendering of entities with an entity/component system? I'm implementing an entity system in a game engine which is based on the Artemis framework. My question is, how can I wrap an existing rendering engine (like Ogre or Irrlicht) under this framework?

Should I create a component to wrap each mesh, texture, animation class
and wrap the rendering loop as a system in my framework? What should I do?

sentences:
Separating components and logic I've been working on how to build some of my game systems using components and systems. I'm having a little trouble following the approach that components should just be bags of data and systems should implement the logic. It'd seem for this to be true you have to limit the complexity of the components or somehow make the system aware of all possible complexity.

For example, I have equipment in my game that characters can equip. Equipment has an "Item" component that has an item name, description, value etc. and allows me to identify it as an item for the purpose of character inventory, etc. That's simple enough.

Here's my problem though. Equipment also needs to be "equippable". Originally, I implemented it as something like this:

class EquipComponent : public Component
{
public:
     virtual bool equip(Entity* character) = 0;
     virtual bool unequip(Entity* character) = 0;
};

then I'd export this class to my scripting engine, and I'm free to have equip/unequip do whatever I want to the character they're being equipped too.

When I try to implement this component as just a bag of data, it just seems so limited. If I want the equipment to increase stats, I can add an array of stat adders/multipliers. If I want to have equipment add status effect resistances, I can add a table for that. If a piece of equipment has different effects for different weatrers, now I have to add data on a per user basis. Suddenly my simple bag of data has gotten massive. I could split it into seperate components, but now my system needs to be aware of every possible component that can change how an item is equipped.

I can see problems like this popping up in a lot of potential components/systems, so I was wondering how one can decouple the components and systems? Am I thinking too rigidly that most component logic should be handled by systems? As much as this is a learning experience, I would like to have something I can use for more than one project and that has good scalability.

Any insight or advice would be appreciated!

sentences:
Why are the app analytics for iTunes Connect so wrong? I've developed a mobile game and have it listed both at Google Play and the Apple App Store. The install stats from Google Play are very close to my own stats, but the stats iTunes Connect shows are WAY off -- it shows nearly 1,000 "app units" (which I assume means installs) when there's only about 120.

Most of their "installs" come from China.

I'm trying to figure out 1) why iTunes Connect is counting all of these bogus "installs" and 2) what possible benefit someone could have from performing all of these fake installs.

Thanks in advance for your insight.

sentences:
What is a good "easily" moddable and scriptable 3D game? I've made a fair number of 2D games (and actually completed/released a few of them). I'm hesitant to move into the 3D realm, because of the order of magnitude (everything takes ~10x more work).

To get started, I was thinking about picking something and modding it. What's a good, "easily" moddable game? By easily, I really mean:

Most or all of the content can be changed via tools (not code)
Tools are included, and mature (don't crash much, etc.)
The game is free or cheap
The game is scriptable (scripting language or SDK)

I'm not really particular about a target language, although I lean towards something more like C# than JavaScript.

If this is not a "good" question, we can make it a list and community wiki it. I really want to know options to get started in the 3D modding realm.

sentences:
Disable lighting in DirectX10 I'm implementing a D3D10 version of my renderer (not porting to avoid losing Windows XP support). I didn't go straight to D3D11 because MSDN and other sources recommend upgrading to 10 and then to 11.

From what I've read so far, what used to be done with IDirect3D9::SetRenderState is done in D3D10 with ID3D10RasterizerState, ID3D10BlendState and ID3D10DepthStencilState. You declare and fill a descriptor structure, tell the device to create a state object, and then bind it to the device. For example:

//D3D9
m_pd3dDevice->SetRenderState( D3DRS_CULLMODE, D3DCULL_NONE );

//D3D10
//This defines the ID3D10RasterizerStatePtr type used below
_COM_SMARTPTR_TYPEDEF(ID3D10RasterizerState, __uuidof(ID3D10RasterizerState) );
//...
ID3D10RasterizerStatePtr pRasterState;
D3D10_RASTERIZER_DESC rasterDesc;
rasterDesc.CullMode = D3D10_CULL_NONE;
if( !CheckErrorCode( m_pImpl->pDevice->CreateRasterizerState( &rasterDesc, &pRasterState ), "InitDevice", "CreateRasterizerState" ) )
    return false;
m_pImpl->pDevice->RSSetState( pRasterState );

However, now that I have to "port" the line...

 m_pd3dDevice->SetRenderState( D3DRS_LIGHTING, FALSE );

... I cannot find a related property in any of the descriptors. From what I've seen, most  examples implement lighting in HLSL, so perhaps I don't need to explicitly disable lighting, because my shaders don't do it?

This is a desktop app, no fancy Metro stuff. Using unmanaged C++.

sentences:
scale on z axis move At the position z = 0 my box has size on one side 0.2. When, for example, I move it to z = 1.5,  size of it scale up. I've trided to calculate it by using triangle formula z*tan(fov/2), but it does not really work.

Do you know how to get size of one side after primitive moved on z axis ?

(All about in opengl)

sentences: Feathers and wind simulation in Unity I would like to create a bird simulation that will use its wings to interact with the surrounding air. How can I achieve this?

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:
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:
Do I need to initialize a public List variable in Unity? I want to create a list of horses and print the name of the Horses that are stored in the list. Although I got the answer correct as I desired, there's one thing that is puzzling me when I declare a list variable.

I declared it as:

public List<string> myFavouriteHorses;

and in an example I have seen it's declared like this:

public List<string> myFavouriteHorses = new List<string> ();

Despite this difference, both of them worked. What's the difference between these two approaches? Does it matter which one I use?

Here's the entire code which i tried:

using UnityEngine;
using System.Collections.Generic;

public class LearningScript : MonoBehaviour {

    public List<string> myFavouriteHorses = new List<string> ();

    void Start(){
        myHorses ();
        }

    void Update(){
        if (Input.GetKeyDown (KeyCode.Return)) {
            Print ();

        }

    }

    void myHorses(){

        myFavouriteHorses.Add ("Grey Horse");
        myFavouriteHorses.Add ("Black Horse");
        myFavouriteHorses.Add ("Rudolph Horse");
        myFavouriteHorses.Add ("Biting Horse");
    }

    void Print(){
        Debug.Log ("This list has " + myFavouriteHorses.Count + " horses");

        Debug.Log ("The horse at index 1 is " + myFavouriteHorses [1]);
        Debug.Log ("The horse at index 2 is " + myFavouriteHorses [2]);
        Debug.Log ("The horse at index 3 is" + myFavouriteHorses [3]);

    }

}

Here's the output

Why doesn't it make a difference whether or not I initialize the List with new before using it?

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:
Am I implimenting a sweep and prune broadphase correctly? The code that I am using is:

    std::vector <PhysicsBody*> physicsChildren; //containing all objects

    ...

    std::sort(physicsChildren.begin(), physicsChildren.end(), sortByLeft);
    std::vector <PhysicsBody*> activeList;

    unsigned int one;
    unsigned int two;
    for(one = 0; one < physicsChildren.size(); ++one)
    {
        activeList.push_back(physicsChildren[one]);
        for(two = 0; two < activeList.size(); ++two)
        {
            if (physicsChildren[one]->m_position.x + physicsChildren[one]->m_radius > activeList[two]->m_position.x - activeList[two]->m_radius)
            {
                CheckIntersectionBetween(physicsChildren[one], activeList[two]);
            } else {
                activeList.pop_back();
            }
        }
    }

I think something is wrong because for 800 objects 309169 calls to CheckIntersectionBetween. A bruteforce would use 640000 calls, I didn't think this was much improvement (considering only objects close in the x-axis should test).

I wrote the code from reading Jitter-Physics article about SAP:

Create a new temporary list called “activeList”.
You begin on the left of your axisList, adding the first item to the activeList.

Now you have a look at the next item in the axisList and compare it with all items
 currently in the activeList (at the moment just one):
 - If the new item’s left is greater then the current activeList-item right, then remove
the activeList-item from the activeList
 - otherwise report a possible collision between the new axisList-item and the current
 activeList-item.

Add the new item itself to the activeList and continue with the next item in the axisList.

What have I done wrong?

sentences:
Overlay partially transparent texture onto another, but not the background I'm using XNA and C#.
I have two shapes (texture2ds), and I want to overlay shape 2 (50% transparent square) over shape 1 (opaque circle), but I want to get Option B, not Option A.

I basically want to render only the part of the square that's over the circle, without rendering the rest of the square over the background.

EDIT: Let me clarify why exactly I want to do this. I'm essentially using something like this as cheap shadows on top-down 2d planets. When a moon, planet, and sun are all in a 180 degree line, the moon is expected to be completely shaded. So I want to put a shadow behind the planet that won't cover the background, but when the moon passes under it, it gets shaded black.

sentences:
Simplify paths when a user builds I am looking for some guidance on how to simplify my nodes on a path when a user builds on the fly.

Imagine a path like this with a gap:

Logically 3 nodes are required 2 connected one isolated.

But now the user builds another inbetween these nodes like this:

You can see the idea is now the nodes have simplified automatically and i only now have 2 nodes on my path.

My question is how would i approach the logic for this so the code can update accordingly? I currently store my path data as an array of nodes which have a property that lists an array of other nodes that link to them. This is what it would look like before the user adds a new tile to the map:

var path    = [];
    path[0] = {'x':1,'y':3,'linksTo':[1],'id':0};
    path[1] = {'x':1,'y':4,'linksTo':[0],'id':1};
    path[2] = {'x':1,'y':1,'linksTo':[3] ,'id':2};
    path[2] = {'x':1,'y':0,'linksTo':[2] ,'id':3};

I use JavaScript - but the language isn't strictly important only the logical approach here.

I should be more clear, the paths can go in 8 compass directions in total the diagonals will be 45 degree angles rather than any other type of shallow angle. But the image just merely shows an example of a path running north to south.

sentences:
Using ShaderGraph for UI elements with transparency I am trying to design some UI elements using shader graph. In this case specifically a lifebar that is transparent where empty.

For a normal lifebar with a filled and empty color I got it working without much issue. I created my shader using an unlit model, and set it to a material. I set the material on a raw image, and then added it to a canvas.

Now I want to create a lifebar with transparency. It i make the shader transparent, I just get a black box. If i make it opaque i can see the shader, but the transparent (alpha blended) sections of the image are just black. I cannot find any settings to fix this. She shader looks fine outside of UI with the transparency working.

Is there a way to make raw images on a shadergraph shader support transparency even if it is just yes/no per pixel transparency?
Is a raw image the correct way to use a shader on UI?

sentences: Java LWJGL - How can I click to interact with objects? I want to be able to click on a monster to walk to him and start attacking him. The part that doesnt make sense to me is the conversion between the mouse position, and the actual terrain position. There are camera angles to worry about, heights, seperate terrains, how is this done???? I am using Java LWJGL and rendering with OpenGL 4.4

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:
Dynamic Quad/Oct Trees I've recently discovered the power of Quadtrees and Octrees and their role in culling/LOD applications, however I've been pondering on the implementations for a Dynamic Quad/Oct Tree.

Such tree would not require a complete rebuild when some of the underlying data changes (Vertex Data).

Would it be possible to create such a tree? What would that look like? Could someone point me in the correct direction to get started?

The application here would, in my scenario, be used for a dynamically changing spherical landscape with over 10,000,000 verticies. The use of Quad/Oct Trees is obvious for Culling & LOD as well as the benefits from not having to completely recompute the tree when the underlying data changes.

sentences:
Before multiplayer match setup I am implementing a before-match setup in following way:

Users request a multiplayer match (click "New Game" button or similar)
After enough users request the match – connection is established
Users are then moved into Select level view
On that view, there is "Become Master" button, which an user can use to become Master
The Master has ability to select level to play
After clicking "Become Master" – the users vote – simple popup appears "Accept User X becoming Master?"
If > 50% agrees, user X becomes master.
Master then selects level he wants. After 10 seconds, game starts – all users are moved to In-game view, to play selected level.

Question: I am wondering if I am not doing this too complicated? Shouldn't I randomly choose the master, or somehow make selection mechanism simpler?

sentences:
Do UV coordinates need correction for moving object? The image above is a static capture of a dynamic OpenGL project I created in which I wrapped a NASA albedo, i.e., sans clouds, image on an OpenGL generated sphere.  In so doing, I also generated the UV coordinates associated with each vertex position.

This was an incremental learning effort in which I had already applied model matrix corrections to the vertex positions for the rotating and translating (orbiting) "Earth".

I was surprised to find that I did not have to apply a model matrix correction to the UV coordinates.

I have tentatively concluded that once the jpg image coordinates are associated with the corresponding vertex positions with the UV coordinates in the range of [0, 1], they are fixed and need no further correction.

Does that sound correct, or is there more to the situation?

sentences:
Making certain GameObjects visible for a camera I have 2 cameras in my 2D game.

One displays gameobjects normally, and the other camera draws some of these gameobjects reflected (scale.y *= -1). The reflected camera would draw only objects in the "Water" layer, and I would change the layer of the GameObjects I want to reflect on the precull and postrender functions. This way I can decide which GameObjects would be reflected, changing the layer on the fly at runtime, which is a requirement.

-Precull: Change the desired GameObjects layer to "water", and apply scale.y*= -1

-OnPostRender:  Change the Gameobjects layer to their original value, and apply scale*= -1

This was working correctly when my objects were simple, but now my objects are more complex, and I can't rely on changing the layer of the gameobjectson the fly, as I can't tell what their original layer was for each part of the object, in order to revert the changes applied during the precull.

Is there anyway to tell a camera which objects should it render besides using the culling mask?

sentences:
What does HLSL's tex2D return at (0,0)? I'm trying to understand the mapping of texels to pixels, especially in the context of pixel shaders. I already found out the following:

When I define a standard quad with vertices at integer positions (texture coordinates ranging from 0 to 1), a pixel shader for the upper left pixel will be called with texture coordinates (0,0)
When I subtract 0.5 from the vertices' coordinates (as it's recommended when drawing sprites), the pixel shader for the upper left pixel will be called with texture coordinates (1/(2*quadWidth), 1/(2*quadHeight))

My question is about the behaviour of the tex2D function in HLSL:

I would have assumed that it just returns the color of the upper left pixel of the texture when called with texture coordinates of (0,0). But obviously this is not the case, since the second of the above-mentioned variants actually leads to the desired 1:1 mapping.

So is it correct that tex2D returns the original pixel values of a texture when given the following texture coordinates?

sentences:
How can I remove Magic Pink from an image at runtime using GraphicsDevice? In XNA 4.0, I want to load all my textures at runtime, which means I will not be able to take advantage of the content processor. (This is fine because it would allow people to change graphics and other elements without having to have XNA installed to compile them into .xnb)

Suppose that I can't (or don't want to) use premultiplied alpha on my images, and instead rely on the classic magic pink (255, 0, 255) method:

How can I turn it into a Texture2D object and convert the pink to be transparent using GraphicsDevice? It is trivial to iterate the data with GetData() and SetData(), but this uses the processor, rather than the graphics card.

sentences:
How to create a legally valid timestamp of unpublished game artwork Before publishing promotional material of my first indie game I wanted to mark all my artwork with a legally valid timestamp.

There are two ways I know to do this:

 1 go to a sollecitor/lawyer and pay for them to certify the document
 2 use an online webservice to mark any given file/folder readable to the service

Anyone has already done this and if yes how (e.g. which website have you used? which type of solecitor have you contacted? etc..)?

I am doing all this because I have prepared a kickstarter video that I wanted to publish in these days to ask for some additional funds to complete my game and, as it contains sequences of the game, I am at the same time worried about publishing it (somebody might copy the characters as I say in the video that I would like to do also a comic book series based on those characters). I guess that "eCO" (or something similar) becomes a must in this case right?

Kind Regards

PS: I know that there is always the good old "send yourself a mail with a stamp and a date" but is not very strong as proof.

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:
Change Pawn movement speed I'm newbie in Unreal development and I don't know how to move my pawn faster.

By the way, I'm using Unreal 4.16.

I'm developing Pong game and I have this method to move the pawn:

void AAIPaddle::MovePaddle(float Scale)
{
    // Add a movement input, hardcoding Z speed to 100.0f
    FVector direction = FVector(0.0f, 0.0f, 100.0f);

    // Scale could be -1.0f or 1.0f or 0.0f.
    AddMovementInput(direction, Scale);
    if (OurMovementComponent &&
        (OurMovementComponent->UpdatedComponent == RootComponent))
    {
        OurMovementComponent->AddInputVector(direction * Scale);
        ZVelocity = Scale;
    }
}

You can find the class AAIPaddle here.

I use this FVector direction = FVector(0.0f, 0.0f, 100.0f); to set its speed, but I change the value 100.0f with 400.0f or another greater values and it moves with the same speed.

Maybe I haven't understood anything. How can I change its movement speed?

I'm using the following class that inherits from UPawnMovementComponent.

void UPaddlePawnMovementComponent::TickComponent(float DeltaTime, enum ELevelTick TickType, FActorComponentTickFunction *ThisTickFunction)
{
    Super::TickComponent(DeltaTime, TickType, ThisTickFunction);

    // Make sure that everything is still valid, and that we are allowed to move.
    //      PawnOwner: which pawn owns this MovementComponent.
    //      UpdatedComponent: the component we move and update.
    //      ShouldSkipUpdate: Possibly skip update if moved component is not rendered or can't move.
    // If none own this component or there isn't anything to move or we have to skip this update, then return.
    if (!PawnOwner || !UpdatedComponent || ShouldSkipUpdate(DeltaTime))
    {
        return;
    }

    // Get (and then clear) the movement vector that we set in ACollidingPawn::Tick
    FVector DesiredMovementThisFrame = ConsumeInputVector().GetClampedToMaxSize(1.0f) * DeltaTime * 150.0f;
    // If movement isn't nearly zero
    if (!DesiredMovementThisFrame.IsNearlyZero())
    {
        FHitResult Hit;
        // Move our UpdatedComponent by the given DesiredMovementThisFrame, and sets rotation to
        // UpdatedComponent->GetComponentRotation(), do a bSweep and store any hit on Hit.
        SafeMoveUpdatedComponent(DesiredMovementThisFrame, UpdatedComponent->GetComponentRotation(), true, Hit);

        // If we bumped into something, try to slide along it
        if (Hit.IsValidBlockingHit())
        {
            StopMovementImmediately();
        }
    }
};

The project is public in Github.

Maybe I don't understand something about Vectors.

sentences:
XNA - Where should I start playing a song? I am just wondering where is the best place to start playing the background song for a game. In the loadContent() method, Draw(), or Update() methods or when I initialize it?

I am trying to make it so that the song starts playing at the same time the screen appears.

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:
Problem with camera drag and draggable UI elements I implemented my camera drag using the following method:

 if (Input.GetMouseButtonDown(0))
        {
            dragging = true;
            followPlayer = false;
            oldPos = transform.position;
            panOrigin = Camera.main.ScreenToViewportPoint(Input.mousePosition);
        }

        if (Input.GetMouseButton(0))
        {
            Vector3 pos = Camera.main.ScreenToViewportPoint(Input.mousePosition) - panOrigin;
            transform.position = oldPos + -pos * panSpeed;
            transform.position = new Vector3(Mathf.Clamp(transform.position.x, xMin, xMax), Mathf.Clamp(transform.position.y, yMin, yMax), transform.position.z);
        }

        if (Input.GetMouseButtonUp(0))
        {
            dragging = false;
            //  followPlayer = true;
        }

But i also have draggable UI components that implement the  IBeginDragHandler, IDragHandler, IEndDragHandler interfaces. Problem is of course while draging the item in the canvas the camera still moves. Any idea how to solve this besides the obvious setting of bools in the inplementation of the interfaces to prevent the camera drag code from executing. An other problem is that I have other non UI object in the game that I want to click so implementing a transparent UI element behind all other UI will not work for me.

sentences:
Game Update in Libgdx In libgdx, the game loop is the render() method. But why is that, and is there a way where I can make an update() method that is called 60 times a second? As in the update() method, I would add the game logic, and leave the rendering to the render method.
Basically, separate methods, and the update() method called 60 times per second using Libgdx with java.

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 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.

sentences:
TiledMap taking a lot of time to load in libgdx I am developing a game using libGdx in which a level has 2400 * 450 tiles Map and each tile is of 4 pixels. I am also using box2d in my game.

My problem is that when I run the game on my phone it takes a lot of time to load the screen (more than a minute).
How can I reduce this loading time?

I created tilemap using Tiled and I am using Android Studio.

Below is my code (SCALE is 2.0f and PPM is 4)

@Override
public void show() {
    w = Gdx.graphics.getWidth();
    h = Gdx.graphics.getHeight();

    camera = new OrthographicCamera();
    camera.setToOrtho(false, w / SCALE, h / SCALE);
    camera.update();
    viewport = new FitViewport(w / SCALE, h / SCALE  ,camera);
    viewport.apply();
  .
  .
  .

    map = new TmxMapLoader().load("maps/lvl3.tmx");
    tmr = new OrthogonalTiledMapRenderer(map, 1/SCALE);

}

@Override
public void render(float delta) {
    update(Gdx.graphics.getDeltaTime());

    //Render
    Gdx.gl.glClearColor(0, 0, 0, 1);
    Gdx.gl.glClear(GL20.GL_COLOR_BUFFER_BIT);

    tmr.render();

    .
    .
    .
    b2dr.render(world, camera.combined.scl(PPM));
}

public void update(float delta) {

    world.step(1 / 60f, 6, 2);
    cameraUpdate(delta);
    tmr.setView(camera);
    batch.setProjectionMatrix(camera.combined);
}

@Override
public void resize(int width, int height) {
    camera.setToOrtho(false, width / SCALE, height / SCALE);

    viewport.update( width , height );
}

Please help and thanks in advance

sentences:
How to show my XNA game in form C# I have a game in XNA, I want to connect this game with WindowForm to show for example the distance and the position.

I tried to apply many tutorials that talking about this.
but here is my problem :

It's empty!!
How can I show my game.

I think my problem is here :

using Microsoft.Xna.Framework;

namespace MissileProject.CustomForms
{
    public class MissileDisplay : WinFormsGraphicsDevice.GraphicsDeviceControl
    {
        protected override void Initialize()
        {

        }

        protected override void Draw()
        {
           GraphicsDevice.Clear(Color.CornflowerBlue);
        }
    }
}

Any help or advice please ?

sentences:
Moving towards and switching targets in Unity with collision I have these nodes set up for a ship to move towards over time with out looking stops then repeats in a sequence.

like so:

1 2 3 1 2 3 1 2...

THE PROBLEMS i keep having either come from the inability to switch direction or the ship ignores all collision which i would like to be able to shoot it with actual objects.

Ignores all Collision:

Vector3 currentPosition = thisShip.transform.position;
    Vector3 directionOfTravel = targetPosition - currentPosition;
    directionOfTravel.Normalize();
    thisShip.MovePosition(currentPosition + directionOfTravel * speed * Time.smoothDeltaTime);

This one works perfectly but because MovePosition is a kin to translate and actually teleports objects it ignores all collision which i need.

Can't Switch Direction:

Vector3 currentPosition = thisShip.transform.position;
        Vector3 directionOfTravel = targetPosition - currentPosition;
        directionOfTravel.Normalize();
        thisShip.AddRelativeForce(currentPosition + directionOfTravel * speed * Time.smoothDeltaTime, ForceMode.Force);

so in this one i try to stop the rigid body by returning its velocity to zero and it does stop for a second but continues in its original direction anyways.

thisShip.velocity = Vector3.zero; // Use this to pause object

I believe i need another method of movement (maybe use a CC) or maybe i can make AddRelativeForce work and be able to switch targets like MovePosition does. I'd really like to get this one thing done so i can move on to other parts of the project.

sentences: Could you create a game for an older system (say, SNES) and sell it with an emulator as well as the game? I was looking into development for the SNES in assembly, as programming in assembly is my hobby. I then had the thought: what if I could sell my native SNES games for modern use (on steam, bundled with an emulator for example)?

sentences:
Is this Rotation Matrix correct? I'm having heavly troubles with setting up a View Matrix and a Projection Matrix. It simply doesnt work. So I think my problem is related to my rotationMatrix function. I'm using this tutorial to learn some basics about Matrix maths.

This method works fine to rotate a object in 3 angles, but I think it have a bug or something like that. So I need your help just to know if this method is doing hes job right, if so, I'll try to rewrite again all my Camera code to see if I made something wrong (I've do this 2 times already).

public static Matrix4 rotationMatrix(float x, float y, float z){
    //Set as Identity Matrix;
    float[] result = {
            1.0f, 0.0f, 0.0f, 0.0f,
            0.0f, 1.0f, 0.0f, 0.0f,
            0.0f, 0.0f, 1.0f, 0.0f,
            0.0f, 0.0f, 0.0f, 1.0f
        };

    /*
                      Row-Major Matrix
                  ----------------------------
                 |  1       0       0       0 |
            Rx = |  0       cos(X)  -sin(X) 0 |
                 |  0       sin(X)  cos(X)  0 |
                 |  0       0       0       1 |
                  ----------------------------
                 |  cos(Y)  0       sin(Y)  0 |
            Ry = |  0       1       0       0 |
                 |  -sin(Y) 0       cos(Y)  0 |
                 |  0       0       0       1 |
                  ----------------------------
                 |  cos(Z)   sin(Z) 0       0 |
            Rz = |  -sin(Z)  cos(Z) 0       0 |
                 |  0        0      1       0 |
                 |  0        0      0       1 |
                  ----------------------------
     */

    float cos, sin;

    if (x != 0.0f){ //If it has a X value, lets compute the Matrix.
        cos = (float) Math.cos(x);
        sin = (float) Math.sin(x);

        result[0] += 1.0f;
        result[5] += cos;
        result[6] -= sin;
        result[9] += sin;
        result[10] += cos;
        result[15] += 1.0f;
    }

    if (y != 0.0f){//If it has a Y value, lets compute the Matrix.
        cos = (float) Math.cos(y);
        sin = (float) Math.sin(y);

        result[0] += cos;
        result[2] += sin;
        result[5] += 1.0f;
        result[8] -= sin;
        result[10] += cos;
        result[15] += 1.0f;
    }

    if (z != 0.0f){//If it has a Z value, lets compute the Matrix.
        cos = (float) Math.cos(z);
        sin = (float) Math.sin(z);

        result[0] += cos;
        result[1] -= sin;
        result[4] += sin;
        result[5] += cos;
        result[10] += 1.0f;
        result[15] += 1.0f;
    }

    return new Matrix4(result);
}

Also I think this rotation Matrix is in row-major (I dont have sure). I send this Matrix to a Vertex Shader and it multiplies by the Vec3 position, so I think if I got any problem, is with this method.

Thanks for reading it!

sentences:
Method subscribed to an event is called twice for every time the event is raised I am trying to make an inventory system in Unity with ScriptableObjects and a text driver that displays the contents of an inventory. So far the code looks like this:
-An InventoryObject is defined as having a "Container" List of ItemObjects (simple scriptable objects, they just have a little information on the object as its sprite, its name, and whether or not it is stackable) and some methods to properly add or remove items (taking item stacking into account) from that list. https://pastebin.com/t4P3aGmi
-A PlayerInventory is a script that will be carried by the player's character. It contains a method for adding items collided with to its assigned InventoryObject instance. It also contains an OnItemPickedUp event that takes its InventoryObject instance as a parameter and passes it to listeners like UpdateDisplay. OnItemPickedUp is raised whenever a collision with a compatible item happens. https://pastebin.com/RsV7XYPp
-An UpdateDisplay script that listens to the OnItemPickedUp event and subscribes the
ProcessInventoryToSingleString(InventoryObject _inventory) method, that subsequently calls several methods to transform the contents of the InventoryObject's Container list into a single, formatted string. https://pastebin.com/N0nsvcWH
-The items are represented by giving a GameObject with a collider2D, aSpriteRenderer and script that contains the particular ItemObject's data and sets its SpriteRenderer's sprite to the ItemObject's.
The problem I'm having is that the method subscribed to the event is being called more than once for each time the event is raised. as shown by the debug logs. Sometimes it's called twice, sometimes even four. This results in my UI display showing more items than there are.
https://files.catbox.moe/afa467.mp4
https://files.catbox.moe/6oxh9b.mp4
Here are pictures of the console debug logs:

I appreciate any help.
EDIT: These errors also appear. I'd like to believe that they're unrelated.

sentences:
AS3: StageWidth for BOX2D? I know BOX2D uses meters, and AS3 uses pixels.

I'm trying to create objects which are limited to the stageWidth.

If I do this variable:

for (var i:int = 0; i<(stage.stageWidth); i++){...}

The animation will freeze, and this output appears:

TypeError: Error #1009: Cannot access a property or method of a null object reference.
at Box2D.Collision::b2BroadPhase/CreateProxy()
at Box2D.Collision.Shapes::b2Shape/CreateProxy()
at Box2D.Dynamics::b2Body/CreateShape()
at com.actionsnippet.qbox.objects::CircleObject/build()
at com.actionsnippet.qbox::QuickObject/init()
at com.actionsnippet.qbox::QuickObject()
at com.actionsnippet.qbox.objects::CircleObject()
at com.actionsnippet.qbox::QuickBox2D/create()
at com.actionsnippet.qbox::QuickBox2D/addCircle()
at BOX2D_Test_Tutorial_fla::MainTimeline/frame1()

Does anyone know how to fix this?

Full Code:

    [SWF(width = 350, height = 600, frameRate = 60)]
import com.actionsnippet.qbox.*;
var sim:QuickBox2D = new QuickBox2D(this);
sim.createStageWalls();
// make a heavy circle
sim.addCircle({x:3, y:3, radius:0.4, density:1});
// create a few platforms

// make pins
for (var i:int = 0; i<(stage.stageWidth); i++){
//End
     sim.addCircle({x:1 + i * 1.5, y:18, radius:0.1, density:0});
     sim.addCircle({x:2 + i * 1.5, y:17, radius:0.1, density:0});
     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});

}
sim.start();
sim.mouseDrag();

sentences:
Time-passed check with Pause functionality I am working on a game that has a lot of time-passed checks of the following format. These work great, but there is a problem when the game is paused:

If paused for any meaningful amount of time, the if statement will become true.

const t = new Date().getTime(); // Get the current time (in ms)
const fireCooldown = 500; // The time to wait before firing again (in ms)

if(t > lastFireTime + fireCooldown) {
   lastFireTime = t;
   fire();
}

How can I integrate pause functionality into this - in a way where pausing does not make the if statement true?

sentences:
AudioSource not working. Empty Exception I'm trying to load and play an wav file that exists in my Application.dataPath but when the game gets to the line _GoAudioSource.PlayOneShot(audioLoader.audioClip); It justs throws a empty exception and no sound is played.

I've already checked if the path is correct and it is. I've also tried uploading this wav file to an FTP and loading it via HTTP instead of File:/// but nothing changes.

This is my full code:

     private IEnumerator WriteResponseAudio(ResponseModel res)
     {
         File.WriteAllBytes(Path.Combine(Application.dataPath, FILENAME_RESPONSE), Convert.FromBase64String(res.intent.audio.content));
         string path = "file:///" + Application.dataPath + "/" + FILENAME_RESPONSE;
         WWW audioLoader = new WWW(path);
         yield return audioLoader;
         try
         {
             _GoAudioSource.PlayOneShot(audioLoader.audioClip);
         } catch (Exception ex)
         {
             Debug.LogError("Erro: " + ex.Message);
         }
     }

This is the version with HTTP request:

     private IEnumerator WriteResponseAudio(ResponseModel res)
     {
         File.WriteAllBytes(Path.Combine(Application.dataPath, FILENAME_RESPONSE), Convert.FromBase64String(res.intent.audio.content));
         string path = "http://www.raphaelrosa.com/response.wav";
         WWW audioLoader = new WWW(path);
         yield return audioLoader;
         try
         {
             _GoAudioSource.PlayOneShot(audioLoader.audioClip);
         } catch (Exception ex)
         {
             Debug.LogError("Erro: " + ex.Message);
         }
     }

This is the console:

sentences:
How to execute a code from many scripts I want to execute a function from many scripts attached on gameobjects  which will be spawned. Since game objects are spawned, I can't assign the script in the inspector. What i want is that, there are three gameobjects, A,B,C. C is already in the scene. A and B are spawned with different scripts,the spawned gameobject's script should call the function on the gameobject C. I can make a delegate but there are different scripts that want to call the function. So should i have to create different delegates for each script on A and B and then assign them onto the gameobject C so that A and B can call their delegates and these delegates will trigger the function on C or there is something like a event that i can call from B. If it was possible, i can create a event on A and assign it on C. Now A can call the delegate and B can also call that event and trigger the function on C, but this is not possible as event can't be called from another script.
I need something like a function that i can call from any script and it calls the function from C.
Note that function should not be static.
As i can call a static function from any script but it can call only static methods, which i don't want.

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

sentences:
How to draw a diagonal fade-in and fade-out? How to draw a diagonal fade-in/fade-out in 2D using MonoGame draw API?

For a simple (non-directional) fade-in/out drawing the background with alpha variation do  the tricks, but what is the standard way to fade-in/fade-out directionally in 2D?

(The background is a texture, not a unicolored background)

sentences:
GameTime Replacement / Wrapper for Pausing , Slow-mo and 'Fast-mo' I'm looking to change the way in which my game uses GameTime to run the game so that I can easily pause the game (elapsedTime = 0) or change how slow/fast the in game elements interact as a scaler of the actual time passed (elapsedTime *= timeScale).

In my project, I always make the assumption that the game is not running on a fixed time step for a number of reasons. Due to this, any changes of states have the elapsed time factored in from GameTime. I'm hoping this means I can simply simulate slow-mo, fast-mo, force short freezes (like when you kill an enemy in TLoZ: Windwaker - there's a short pause for emphasis) or pause the game by interfering with the GameTime.ElapsedGameTime that all of my Update() code uses.

My first thought is to stop using GameTime within any update code, and to instead wrap a new class (MyTime) around GameTime.

MyTime would do the following:

Seperates real time and game time. Real time is the passage of time outside of the system. Game time is the passage of time within the game's world, i.e if slow motion is in effect, the time passed within the game would be lower for the period of slow motion.
Time scaling can either be started and ended, or requested to be active for a length of real time or game time.
Time can be paused or frozen with either manual start and stop calls, or for a length of time, again based on either real or game time.

Based on this discussion, where it's states that GameTime is recreated every tick within XNA's base Game class, I'm hestitant to just store a reference to GameTime within MyTime as I personally don't know how GameTime is altered. I also don't know the 'best' way to retrieve the GameTime reference in the first place, the reference is available within the Update() and Draw() calls, however since gameTime isn't made available throughout any derived from Game class, it's implied taking the gameTime reference out of those update and draw calls isn't intended.

Is my intended implementation of this the right way of achieveing this system? What is a good to expose GameTime to MyTime? Should I implement my own way to track time and not rely on GameTime at all?

sentences:
Collision detections too fast? I'm creating a simple asteroids game and I have three lists with: big asteroids, small asteroids and missiles. When the player hits a big asteroid two small asteroids are created. But The problem is that for the most of the time, the two small asteroids never get time to show up! It seems like the missile hits them too, despite that I remove the missile from the list, before the small asteroids are created. The code below is from my object manager.

What is wrong and how can I improve my code to avoid this?

 // Check if missile hit big asteroid
    public void CollisionControlMissileHitAsteroidBig(ContentManager content)
    {
        for (int i = 0; i < missilesList.Count(); i++)
        {
            for (int ii = 0; ii < asteroidsBigList.Count(); ii++)
            {
                if (missilesList.ElementAt(i).Bounds().Intersects(asteroidsBigList.ElementAt(ii).Bounds()))
                {
                    missilesList.RemoveAt(i);
                    for(int x = 0; x < 2; x++)
                        AddNewSmallAsteroidToList(new AsteroidSmall(content, asteroidsBigList.ElementAt(ii).Position));

                    asteroidsBigList.RemoveAt(ii);
                    i--;
                    ii--;
                }
            }
        }
    }

    // Check if missile hit small asteroid
    public void CollisionControlMissileHitAsteroidSmall()
    {
        for (int i = 0; i < missilesList.Count(); i++)
        {
            for (int ii = 0; ii < asteroidsSmallList.Count(); ii++)
            {
                if (missilesList.ElementAt(i).Bounds().Intersects(asteroidsSmallList.ElementAt(ii).Bounds()))
                {
                    missilesList.RemoveAt(i);
                    asteroidsSmallList.RemoveAt(ii);
                    i--;
                    ii--;
                }
            }
        }
    }

EDIT:

I'm not sure I have done right? There are some problems, the big asteroids is still on the screen and then I guess the missile is still there to, because when two new small asteroids are created, most of the time there is only one, which I think is because it collide with the old missile? That's why I removed the missile from the list before I created the new small asteroids. More help is appreciated!

    public void CollisionControlMissileHitAsteroidBig(ContentManager content)
    {
        for (int i = 0; i < missilesList.Count(); i++)
        {
            for (int ii = 0; ii < asteroidsBigList.Count(); ii++)
            {
                if (missilesList.ElementAt(i).Bounds().Intersects(asteroidsBigList.ElementAt(ii).Bounds()))
                {
                    //missilesList.RemoveAt(i);
                    for(int x = 0; x < 2; x++)
                        AddNewSmallAsteroidToList(new AsteroidSmall(content, asteroidsBigList.ElementAt(ii).Position));

                    asteroidsBigListRemove.Add(asteroidsBigList.ElementAt(ii));
                    missilesListRemove.Add(missilesList.ElementAt(i));
                }
            }
        }
        asteroidsBigListRemove.Clear();
        missilesListRemove.Clear();
    }

sentences:
Flixel: doesn't light tile up i'm creating a game with flixel, and I want to have a effect when you mouse over a tile, I tried implementing it, and this is what it gives:

    public class GameState extends FlxState
{
    private var block:EmptyBlock;
    public function GameState()
    {

    }

    override public function create():void {
        for (var i:Number = 0; i < 30; i++) {
            block = new EmptyBlock(i, 20);
            block.create();
        }
    }

    override public function update():void {
            block.update();
            super.update();
    }
}

}

GameState class

and here is the EmptyBlock class:

public class EmptyBlock
    {

    private var x:int;
    private var y:int;
    private var row:FlxRect
    public function EmptyBlock(x:int, y:int )
    {
        this.x = x;
        this.y = y;
    }

    public function create():void {
         row = new FlxRect(x, y, 32, 32);
        trace ("Created block at" + x + y);
    }

    public function update():void {
        if (FlxG.mouse.screenX == row.x) {
            if (FlxG.mouse.screenY == row.y) {
                var outline:FlxSprite = new FlxSprite(row.x, row.y).makeGraphic(row.width, row.height, 0x002525);
            }
        }
    }

}

}

UPDATE:

The problem is still not solved.

I tried what you recommended, this is the new code:

  public class EmptyBlock extends FlxSprite {
       private var outline:FlxSprite;
       [Embed(source = 'freetile.png', mimeType="image/png")] private var    freeTile:Class;
    public function EmptyBlock(x:int, y:int) {
        this.x = x * 32;
        this.y = y;
        width = 32;
        height = 32;

        // Note: this is a block, rather than an outline.
        // Create an outline image, then use loadGraphic()
        // instead of makeGraphic() if you want an outline.
        outline = new FlxSprite(this.x, this.y);
        outline.loadGraphic(freeTile, false, false, 32, 32, false);
    }

    override public function draw():void {
        super.draw();
        if (overlapsPoint(FlxG.mouse.getScreenPosition()))
            outline.draw();
    }
}
}

And I call it here:

        public function  createMap():void {
        var block:EmptyBlock = new EmptyBlock(0, 0);
        block.draw();

    }

Do you see what i'm doing wrong?

Thanks!

sentences:
Legal and IP considerations with publishers and playable prototypes I'm almost ready to send a playable prototype of a game to a publisher.  I've never worked with publishers.  What legal or intellectual property issues should I consider at this stage (if any)?

In this specific case the publisher is well known... perhaps this makes a difference.  Also the game is for a mobile platform.

sentences:
How can I render all objects behind a plane with a specific transparency value? I have a game where there a multiple floor levels between the player switches. The floor is not present everywhere, so you can look through it. When 'working' (playing, building stuff, etc.) on a specific floor I want to add a transparency value to everything that is NOT on the current floor.
Ho can I accomplish that, and what is the best/most efficient way to do that?

sentences:
Calculating World Unit or Pixels Per Unit values Is there a formula to calculate world unit or pixels per unit values in LibGdx?
 Most of my objects fit into a 32x32 or 16x16 frame. When the objects are close to 32x32, and I use 1f as the size or 16x16 and use .5f things seem to work out fine. What I try to do is use this:

// Create viewport that is used to as the game size
static final float VIEWPORT_WIDTH = 15f;
static final float VIEWPORT_HEIGHT = 7f;

viewport = new FitViewport(VIEWPORT_WIDTH, VIEWPORT_HEIGHT);

// Scale sizes
final float UNIT_PIXEL = 0.03125f;  // 1 / 32
float newSize = 32f * UNIT_PIXEL;

Which seems to work for 32x32 or 16x16. But size problems seem to happen when you try to use that to calculate other widths or heights. Like if I try to use:

float newSize = 24f * UNIT_PIXEL;

Using this the bounding rectangle becomes much larger than the object.

sentences:
DX12 - how to update part of a buffer? I'm just getting started in DX12 after a bit of time in Vulkan, I am trying to update a part of a dynamically indexed buffer I'm using to hold mesh transforms.
I'm using the MSFT MiniEngine examples which include wrappers for upload buffers, and am not sure if I can use them to update an existing buffer, or if they're supposed to be the main resource used in place of the "GpuBuffer" in the same engine.
Any specific insight into the use of those classes would be really useful, but more generally, is it possible to update part of a buffer, or will I have to upload a copy of the whole thing?
Obviously a simple example would be brilliant if anyone has one..

sentences:
Vertex buffers - interleaved or separate? Interleaved - all vertex data (position, normal, texcoord...) kept in 1 vertex buffer, separate - each vertex attribute is kept in a separate vertex buffer (1 for positions, 1 for normals...).

I know this question came up many times and I also know there's no 1 right answer (sadly). But I'd like to try to list the main advantages/disadvantages of both. Or maybe you have some general rules of thumb for when to use each.

Advantages of interleaved:

faster? (all data for 1 vertex is fetched at once? sth about cache working better)?
less API calls (for creating and setting buffers but that's probably a very small difference)

Advantages of separate:

when different shaders need different vertex attributes (e.g. one shader needs only position and another needs position, normal and texcoord) it's possible to provide each shader only the data it needs and there's no data duplication
when updating only e.g. position of vertices it's not necessary to resend the other attribute data (e.g. normals and texcoords)

If you see any other differences please write. From the above it generally looks like a struggle between memory and performance optimisation. But maybe I'm wrong? Maybe one is better/worse in most cases?

Edit:
One more concern, actually - with interleaved buffers I could end up sending unnecessary data to GPU and the data bandwidth is a big bottleneck in today's cards. Should I worry about that?

sentences:
Determining Player "Forward" in VR EDIT: I've removed some vagueness and replaced it with more of a description of the intended use case.

I'm looking for some suggestions for ways to infer what the player's "forward" vector is in a room-scale 360 experience.
I'm not currently worried about extreme edge cases, especially if it sounds like the user may be intentionally not doing the intended thing, but I am interested in getting a decently accurate forward vector when they could be looking or facing any direction.
I also don't care about "upness" or magnitude of the vector, so it'll end up being projected onto the (Unity's) X/Z plane and normalized.

I'm exploring the idea of punching as a means for locomotion. The player should move in the direction that they punch, which in itself I feel is an easy solve. The problem is, much like the problem of arm-swing movement, it is very hard and unnatural to punch exactly straight forward. People tend to punch at least a little across their body. This causes the player to weave back and forth through the world, like some sort of drunken master.
I don't like the idea of using the headset's forward vector either. I want the player to be able to look around while playing; I feel it is an integral part of the experience to be able to look ahead one punch and plan the next move.

It's also important that sensor set up and room orientation should not be taken into account. I'm looking for something that could work in a large space with 360 tracking.

I've considered:

Grabbing an average position of the hands, getting the vector from the head to this new position. This is where I've spent most of my time, I think. I've tried a weighted average, where hand position gets more or less weight depending on distance from head. In practice, this ends up exacerbating the problem
Grabbing the vector from the head to the dominant hand
Dropping a raycast to the floor and using the hit geometry's forward vector
Getting a complicated IK rig setup, potentially hiding the geometry, and using the rig's hip placement/orientation to infer "forward"

None of these quite feel right to me, although the average-hand-position vector feels the right-est.

Is this a solved problem that I'm just not searching hard enough for? Anybody else have interesting solutions to this problem? Am I being too vague and should really just seek out a solution for a much more specific use-case and be happy with that?

sentences:
XNA Framework HiDef profile requires TextureFilter to be Point when using texture format Vector4 Beginner question. Synopsis: my water effects does something that causes the drawing of my sky sphere to throw an exeption when run in full screen. The exception is:

  XNA Framework HiDef profile requires TextureFilter to be Point when
  using texture format Vector4.

This happens both when I start in full screen directly or switch to full screen from windowed. It does NOT happen, however, if I comment out the drawing of my water.

So, what in my water effect can possibly cause the drawing of my sky sphere to choke???

sentences:
How should I manage my data that needs to be associated with rank (Unity) So I am making a game with a similar content progression to Clash Royale. Essentially u have ranking points (Identified as Trophies), and the number of trophies you have will determine what content you will have access to in the game. So for example every 100 ranking points, you will be able to find new types of cards in chests, new chests in general or new maps. In my game, I want it to be somewhat similar, but I also have some other data that changes based on rank points that is more specific to my game, such as army supply. I'm trying to figure out how I can implement this in a manageable way.
Maybe this is overkill, but this is my design so far:

Basically I have my RankContentItemBase class which has a ranking points int and an IsUnlocked method that returns whether or not the passed in rank is > than the rank passed in. Then I extend this with classes with classes that add the data type I wanna work with (Int, Troop, Map, w/e).
I then have a Generic base container class that has a method for getting all unlocked item in the list of T contents that is extended to contain the concrete RankUnlockItembase types.
I've basically structured things this way so it's easy for me to add new types of items that I want unlocked by rank without having to do much work. Also it prevents things from being coupled together.
Just curious what ppl think of this setup, and what kinda setup you would go with? One concern I have with this design was that if I wanted to see whether a troop was unlocked or not, I can't just say troop.IsUnlocked(). Instead I have to create a new means of determining whether or not a troop is unlocked yet, like for example maybe a method on the RankUnlockedTroopContainer that determines this. Maybe this is ok? I feel like I'm sacrificing simplicity for the sake of maintainability/flexibility.
Thanks

sentences:
How can I store a large amount of items in a space-efficient manner? How can I store a large amount of items inside my game?

Are each of the items default data be loaded from a file into an item class and then stored in a giant array/list/dictionary?

For a point of reference, I'm talking about something like Skyrim where there are hundreds of items that the player is able to touch and pickup. And at any point the player can debug and add an item to their inventory.

I feel like the game would store everything is some kind of list but I also feel like this could consume a lot of memory, but maybe I am overthinking the size of each individual items data.

sentences:
What are some ideal algorithms for Rogue-like 2D dungeon generation? What are some good resources regarding procedural content generation in the context of dungeon generation?

Closest article I could find was Algorithm for generating a 2d maze, which isn't quite what I'm looking for. Features, such as rooms and connected hallways, are ideal.

Thanks!

sentences:
How to make a sprite above my character appear on the minimap attached to the floor? I have a project where I made 2 minimaps.

One of minimaps is linked to the character of my project and the other to the floor:

As I already said in the title of the question, my character has a sprite above the head (red arrow) that appears on the minimap attached to it, but does not appear on the minimap attached to the floor.

Image:

I looked at the rendering options and many others, but I could not get the sprite to show up. How do I get the sprite to appear on the floor minimap?

EDIT 1 (Showing how I made the minimap)

I used a SpringArm:

And a SceneCaptureComponent2D:

The PaperSprite is not the children of the SpringArm and stands a little below the SceneCaptureComponent2D:

The minimap is made from a RenderTarget. From this RenderTarget a material is created:

Widget Blueprint:

sentences:
Why is the rectangle not moving? public class Main {

    public static void main(String[] args) {
        JFrame frame = new JFrame();
        frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);

        Character c = new Character();
        frame.add(c);

        frame.setSize(600, 600);
        frame.setTitle("Keyboard control");
        frame.setResizable(false);
        frame.setVisible(true);
    }
}

character class

public class Character extends JPanel implements KeyListener{

   int posx = 0, posy = 0;

   public void movementX(int i) {
        posx+=i;
    }
   public void movementY(int i) {
       posy+=i;
   }

       public void paint() {
           repaint();
       }

     public void paintComponent(Graphics g) {
        super.paintComponent(g);

        this.setBackground(new Color(0, 0, 0));

        g.setColor(new Color(0, 0, 255));
        g.fillRoundRect(posx, posy, 50, 50, 4, 4);

    }

    public void keyPressed(KeyEvent e) {
        movementX(10);
        paint();
    }

    @Override
    public void keyReleased(KeyEvent e) {

    }

    @Override
    public void keyTyped(KeyEvent e) {

    }
}

sentences:
A canvas to let through a given layer I have two canvases, both of them having a UI element on them.
At some point, both canvases will be active in the game (I just act like so, I want to make sure that my game works even if that's the case) and I want one of them to never block the other canvas's layer.

These two, let's say Canvas1 is on layer UI and is responsible for character jumping.
Canvas2 is on layer toggle time scale and it's job is to switch between timescale 0 and 1.
I want Canvas2 to be ALWAYS accessible, so its layer, toggle time scale is NOT blocked by the first canvas.
I tried messing around with the Blocking Mask but that didn't help, sometimes the ray still gets blocked out. How to set up those Blocking Masks for my canvases to work?

sentences:
How to generate seamless hexagonal textures I'm doing a tactical game (X-Com / Fallout style) for fun.
I've decided to use a hexagonal map, but I'm having a graphic problem.

My current map display is HUD-like, with only the border of the map cells displayed, without any texture. It's simple and allows for display of different types of information by varying the color of the border. For example, the "danger view mode" displays the borders with a color going from green (no damage possible) to red (prob of damage > 90%).

Now, it's a bit hard to differentiate the kind of tile the player is on. I could put a plain color (green is grass, pale blue is water...), but this is going to limit the possibilities. Thus, I would like to display a texture on my tiles. Since the maps are generated, I can not use a picture for the whole map with the HUD over.

So, my question is: does anyone know how can I generate the seamless hexagonal textures (algo or plugin)?

sentences:
How can I increase the resolution of a low-polygon model in ZBrush? I have a low-polygon model of a character used in an old game, and I would like to improve it into a high resolution one, with more details, for a more recent game.

What process should I follow to achieve this in ZBrush?

I've seen this video which explains that they have done it for the Shadow of the Colossus remake, but they're shy on details.

sentences:
Recording Xbox controller button presses? I would like to generate some sort of log file of xbox gamepad events while playing an existing game on PC, such as Call of Duty.

I am not developing a game necessarily, I just would like a static file of all button presses recorded during a session of gameplay. I am writing an application that will use this data as input.

Can anyone recommend any software tools that could enable me to do this? Thanks in advance.

I have Mac, Windows, and Ubuntu that I can use.

sentences:
Normal mapping soft question: What could this be? So I'm trying to implement tangent space normal mapping. I bind the uniforms, load the attributes, set the shaders, and out comes this:

This happens on the sides only, and not when in direct light. I'm pretty sure it's matrix related, but could it be I'm mapping the tangent values incorrectly? Has anyone seen something like this before? Or have a hunch what it could be?

UV screenshot, it's a cube, turned into a sphere, and each side is separated. The final object shows no seams on the top or bottom, but rather on each side.

Update: When I order the tangents according to UVs, I get a much cleaner result, but some areas/sides still get an inverted normal. I'm not sure why this is, or how to fix it. It happens on each side, so it is as if the sides get inverted normals.

sentences:
Unity3D: Change Background Image on a GUI Skin So I'm testing with GUI Skins and trying to make something cool, and I want to change the background image of the application background. This is what I mean

In the screenshot above, the background is just blue, i'd like to change that to an image so it looks a lot better. Anyone know how to do this?

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:
OpenGL - How to draw a transition of two textures on one quad? I know when drawing a rectangle, if we select red and draw two vertices, and then select yellow and draw the other two vertices, the entire rectangle will show a nice transition of color between those vertices and the middle of the rectangle will appear orange.

Suppose I have two textures, and I want to do the same kind of thing. On one rectangle, I want two vertices to use texture from one image and the other vertices to use the texture from the other image, and show a smooth transition in the middle.

Please show me how this can be done in OpenGL, thanks!

sentences:
Getting the Ray position from View and Projection Matrix I'm having some trouble calculating the direction and position of the ray from my matrices. I have tried some things such as:

private Vec3 getPick(Mat4 projection, Mat4 view) {
     Mat4 inverseProject = projection.copy().inverse();
     Mat4 pick = inverseProject.mul(view.copy());
     Vec3 pos = new Vec3(pick.m10, pick.m11, pick.m12);
     return pos;
}

I am using custom math classes and I'm pretty sure they work. Also, would it be better to perform this math in my shader? For better performance etc..?

I contacted Notch (creator of Minecraft) on this issue and he told me  to inverse the view Matrix and multiply by the projection, then multiply by the mouse coordinates. I tried that, it didn't do much.

EDIT: Tried normalising the screen space. It seems to do the job except in negative directions. Plus its a little off.

Vec3 getPick(double w, double h, double ar) {
    double sx = ((Mouse.getX() / w / 2.0) - 1.0) * ar;
    double sw = 1.0 - (2 * ((h - Mouse.getY()) / h));

    Mat4 viewProjInv = view.copy().mul(projection).inverse();
    Vec3 mouseNormal = new Vec3(sx, sw, 1.0);
    Vec3 dir = viewProjInv.mul(mouseNormal);
    return dir.mul(1);
}

sentences:
How can I show slow motion? In my very, very simple 2D game I'm working on, I'd like there to be moments of slo-mo.

What is the best method of showing the player that the game is currently in slow-motion? As in, what is the most typical and obvious method used by most current games where slow-motion is a feature?

I'm fairly new to game development, and even newer to this site, so am looking for an answer which contains, basically, just bullets of things which should be different between real-time and slow-motion-time.

"Best," to avoid opinionated answers, means established and recognized, common methods of demonstrating slow-mo.

sentences:
Is there a way to bypass Directx Effect Files? I am now trying to abstract my rendering pipeline, and I've been able to abstract OpenGL fairly easily. But now I have ran into a rather ugly problem with Directx.

Most of my knowledge about Dx9, 10, and 11 makes use of effect files. Something that openGL distinctly lacks. I know that this file does not have to be used. However, by the way all of DX's documentation had been written, it seems like it is required and there is no way around it.

Can anyone give me a lead here?

sentences:
How do I programmatically animate a .obj model? I am developing on Qt, I have tried translate and rotate an .obj model.

I would like to know is there any possibility to do programmatically animate in Qt.

sentences:
SMFL C++: IntRect intersection not working? I'm trying to find free space to place rectangles, but even though I check for a collision using .intersects() it still places them through each other and somehow doesn't see the intersection happening while it's blatantly there.

This is my code at the moment:

#include "dungeonGenerator.h"

std::map<int, dungeonGenerator::dungeon_room> dungeonGenerator::newDungeon(int x, int y, int n)
{
    srand(time(NULL));
    std::map<int, dungeon_room> rooms;
    bool canPlace;

    for (auto i = 0; i < n; ++i)
    {
        canPlace = false;
        dungeon_room dungeon_room;
        while (!canPlace)
        {
            int height = rand() % x;
            int width = rand() % y;

            int pos_x = rand() % 512;
            int pos_y = rand() % 512;

            sf::RectangleShape room;
            room.setSize(sf::Vector2<float>(height, width));
            room.setFillColor(sf::Color(rand() % 255, rand() % 255, rand() % 255));
            room.setPosition(sf::Vector2<float>(pos_x, pos_y));
            dungeon_room.image = room;
            dungeon_room.collider = sf::IntRect(pos_x, pos_y, width, height);

            if (!rooms.empty())
            {
                auto i = 0;
                for (auto& room : rooms)
                {
                    std::cout << ++i;
                    canPlace = canPlaceRoom(&dungeon_room, &room.second);

                    if (canPlace == false)
                    {
                        break;
                    }
                }
            } else
            {
                canPlace = true;
            }
        }
        rooms[i] = dungeon_room;
    }
    return rooms;
}

bool dungeonGenerator::canPlaceRoom(dungeon_room* room, dungeon_room* target)
{
    if (room->collider.intersects(target->collider))
    {
        return false;
    }
    return true;
}

sentences: Error to open Cryengine editor I am having problems with Cryengine 5, every time I open the editor through the launcher, it appears an image speaking Traceback (most recent call last): File "cry run", line 722, in module File "cryrunapy", line 375, in omd open File ubprocessapy line g59, in init File "subprocesspy", line 1112, in execute child osError: IwinError 216) This version of% 1 is not compatible with the version of Windows being run. Check your system's information if you need an o86 B2-bit or x64 (64-bit) version of the program and cont bug, I do not understand anything about it, I need explanations and resolutions

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:
Moving Object Interception / Projectile Collision I am using Unity to attempt to have missile A launch at incoming missile B and blow it up.
However in order to do this accurately, A must be able to take into account B's current velocity, direction and distance in order to calculate where it needs to aim in order to succesfully hit it.
How do we go about this using the below as an example?

sentences:
C++ Saving and Loading From Text File In my C++ program I am trying to develop a simple saving and loading function for my game. I can easily get the save function on it, but the loading part of it really stumps me.

What I need is to load the numbers on the file (line by line) and insert them into different variables for my player. I'm just not able to figure that out. I've even looked all around the inter webs.

Here is the code for the player save and load functions:

void Player::Save()
{
    std::ofstream savePlayerFile;
    savePlayerFile.open("Save/playerSave.dat", std::ofstream::trunc);

    savePlayerFile << x << "\n" << y << "\n" << prevX << "\n" << prevY << "\n" << health << "\n" <<
    health  << "\n" <<  mana  << "\n" <<  gold  << "\n" <<  level  << "\n" <<  maxHealth << "\n" <<
    maxMana << "\n" << strength << "\n" << defense;

    savePlayerFile.close();
}

void Player::Load()
{
    std::ifstream loadPlayerFile;
    loadPlayerFile.open("Save/playerSave.dat", std::ofstream::in);

    /*std::string line;
    while(std::getline(loadPlayerFile, line))
    {
        std::istringstream iss(line);
        */
    loadPlayerFile >> ( x && "\n" && y && "\n" && prevX && "\n" && prevY && "\n" && health && "\n" &&
    health && "\n" && mana && "\n" && gold && "\n" && level && "\n" && maxHealth && "\n" &&
    maxMana && "\n" && strength && "\n" && defense);
}

sentences:
Instance culling using geometry shaders I'm developing my own game and for that I want to implement frustum culling, to archive an performance optimization. I found a description on the internet (enter link description here) and this one looked really good - but I didn't understood it...
Maybe you can read through it and explain me the concept of this technique. Firstly I don't know the exact concept and secondly I don't know, how I could implement this.

Maybe you can explain it to me and then give me an Idea, how to implement this..

Second Question:
Is this a good technique? (Currently I have implemented frustum culling with boundingspheres, but the technique presented in the blog seems to be even better..)

sentences:
Stop Mesh render on intersect I am generating camera frustum mesh through code, it is working fine. Now I am searching a solution (shader based or else) to restrict
the camera frustum mesh if it intersect with any object. Like you can see in the image my frustum is passing through the plane which is not correct.
How can I control it, I search and apply different kind of shader but nothing worked.

sentences:
How to reset scene (stage1) when selecting it from Level stagemain menu Good day I have a problem when the player finish stage 1 the screen look like this

Then going back to selecting level

When I try to play the stage 1 again. I want to reset the stage 1 so i can play it again.
I only use
Scene.LoadScene("stage1") in main menu to go to stage1 and
Scene.LoadScene("mainmenu") to back to main menu

sentences:
LibGDX: Why won't certain actions work on my Actor? In my GameClass, I called the Stage.act and Stage.draw methods in the right order accordingly.

I have actions set up so that the actor fades in/fades out, bounces down/up, and also rotate, like so:

Label.LabelStyle font = new Label.LabelStyle(new BitmapFont(), Color.BLACK);

    Table table = new Table();
    table.center();
    table.setFillParent(true);

    Label playLabel = new Label("Text", font);

    Action fade = new SequenceAction(Actions.fadeOut(1), Actions.fadeIn(1));
    Action size = new SequenceAction(Actions.sizeBy(-20,-30,1), Actions.sizeBy(10,20,1));
    Action rotate = new SequenceAction(Actions.rotateBy(20), Actions.rotateBy(-40));

    ParallelAction pa = new ParallelAction(fade, size, rotate);

    playLabel.addAction(Actions.repeat(RepeatAction.FOREVER, pa));

    table.add(playLabel).expandX();
    table.row();

    stage.addActor(table);

The thing is, everything works except for the rotate method.

Similarly, I have similar problem when I use an Actor with Texture regions.

This is an example from another class.

public ReadyText () {
    cam = GameClass.cam;
    viewport = GameClass.viewport;
    cam.setToOrtho(true, viewport.getWorldWidth(), viewport.getWorldHeight());
    region = new TextureRegion(GameAssetLoader.Ready);
    this.setX(28);
    this.setY(165);
    this.setWidth(80);
    this.setHeight(30);

    //fade = Actions.sequence(Actions.fadeOut(1), Actions.fadeIn(1));
    Action rotate = Actions.sequence(Actions.rotateBy(80, 1), Actions.rotateBy(-90,1));
    Action resize = Actions.sequence(Actions.sizeBy(10, 5,1), Actions.sizeBy(-10,-5,1));

    ParallelAction pa = new ParallelAction(rotate, resize);

    addAction(Actions.repeat(RepeatAction.FOREVER, pa));

}

@Override
public void draw(Batch batch, float parentAlpha) {
    super.draw(batch, parentAlpha);

    batch = GameClass.batch;
    batch.setProjectionMatrix(GameClass.cam.combined);
    batch.draw(region, this.getX(), this.getY(), this.getWidth(), this.getHeight());

}

In this example, the "sizeBy" method works fine. But for some reason, it will not rotate. I commented out the "fade in/fade out" line; it also wasn't working either.

I know people will usually use an Image Actor instead, which makes sense, but I don't think it explains why the rotation won't work, or at the very least, why the Label didn't rotate either.

sentences:
How to change texture from pvr.ccz in Cocos2d? I'm using .pvr.ccz file that texturePacker application created for me , I created a Sprite that it's image choosed from this file(.pvr.ccz) like below:

  CCSprite *mySprite = CCSprite::createWithSpriteFrameName("first.png");

But how can I change it's texture using .pvr.ccz file?

I knew below solution for changing texture of a sprite, but it works when second.png file is normal PNG file and is not compressed in a.pvr.ccz file.

mySprite->setTexture(CCTextureCache::sharedTextureCache()->addImage("second.png"));

sentences:
XNA's SetData in a SharpDX Texture2D object in DirectX 11? I'm trying to load a texture given a swap chain, and then populate that texture with data. I already have some bitmap data (although not sure if it is in the correct format) that I want to populate the texture with.

However, XNA's SetData method of the Texture2D object is obviously not present in SharpDX. What do I do to populate my texture with data? I load the texture using the following code.

var texture = Resource.FromSwapChain<Texture2D>(swapChain, 0);

sentences:
RectTransform Button Start shaking with Vector3.MoveTowards() I have a RectTransform Button that i want to make it move to a de-terminated vector3.

To move the button i use this code (it is inside Update())

        int i = -1;
        foreach (RectTransform Button in Buttons)
        {
            i++;
            Vector3 NewPosBtns = new Vector3(StartButtonsVect[i].x, (StartButtonsVect[i].y + 192.5f), StartButtonsVect[i].z);
            Vector3 CurPosBtns = StartButtonsVect[i];
            Button.localPosition = Vector3.MoveTowards(CurPosBtns, NewPosBtns, AnimationSpeed);
        }

Buttons is a array and i add the button to the list using unity editor

StartButtonsVect is of vector3 that i add the using this code

void Start()
{
    foreach (RectTransform Button in Buttons)
    {
        StartButtonsVect.Add(Button.localPosition);
    }
}

For some reason the button start shaking instead of going to the target position (NewPosBtns)

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:
XNA SpriteBatch.Draw with rotation, scaling and origin? I use a 1x1 pixel 2d texture as source for SpriteBatch.Draw. The texture is scaled and rotated around an origin. The left image is only scaling. The right one scaling + rotation around the origin at the bottom center. I need the right image as result.  i.e. scaled to 5x10 and rotated around 2.5x10

The problem is with the 1x1 texture the draw starts to act strange if the origin parameter is outside the source texture. And as long as the origin is limited to a max of 1x1 its not possible to rotate around the bottom center of the scaled texture.

Why does the origin behave strangely if it is outside the source texture? With strange I mean the texture moves much more then the origin value set.  i.e. if its origin x=10 the texture moves much more then 10 pixels.

sentences:
How to create a joint, where the rotation of one object is relative to the other? I would like to create a top down view scene, with one rectangle (top) is on top of an other (base). There is a joint, where these two objects are connected.
The one on the top should be able to freely rotate, but if the base rotates, its rotation should be changed as well, because it should behave as if it is on top of it. If the joint is at the center of both objects, then the top one should rotate like this:
Δ top rotation = Δ time * ( top angular velocity + base angular velocity )

If the joint is not at the center of the objects, then it is more complicated than that. How is it possible to define a joint like that in Box2D?
This is a testbed example with the joint. Notice, that the top one is not rotating:
#include "test.h"

class RelJoint : public Test
{

    b2Body* base;
    b2Body* top;
    b2RevoluteJoint* m_joint;

public:

    RelJoint() {

        m_world->SetGravity(b2Vec2(0.0f, 0.0f));

        {

            b2PolygonShape shape;
            shape.SetAsBox(1.f, 0.5f, b2Vec2(0.0f, 0.0f), 0.0f);

            b2BodyDef bd;
            bd.type = b2_dynamicBody;
            b2Body* body = m_world->CreateBody(&bd);
            body->CreateFixture(&shape, 5.0f);

            body->SetAngularDamping(1.f);

            base = body;
        }

        {

            b2PolygonShape shape;
            shape.SetAsBox(0.5f, 0.25f, b2Vec2(0.0f, 0.0f), 0.0f);

            b2BodyDef bd;
            bd.type = b2_dynamicBody;
            b2Body* body = m_world->CreateBody(&bd);
            body->CreateFixture(&shape, 5.0f);

            top = body;
        }

        b2RevoluteJointDef revoluteJointDef;
        revoluteJointDef.bodyA = base;
        revoluteJointDef.bodyB = top;
        revoluteJointDef.collideConnected = false;

        revoluteJointDef.localAnchorA.Set(0, 0);
        revoluteJointDef.localAnchorB.Set(0, 0);

        m_joint = (b2RevoluteJoint*)m_world->CreateJoint(&revoluteJointDef);

    }

    void Step(Settings& settings) override {
        base->ApplyTorque(3.f, true);

        Test::Step(settings);
    }

    static Test* Create()
    {
        return new RelJoint;
    }

};

static int testIndex = RegisterTest("Joints", "Relative", RelJoint::Create);

I tried to combine b2RevoluteJointDef with b2FrictionJointDef. It looks promising, but unfortunately if I apply torque to the top body only, the base starts to rotate too, which I would like to avoid.

sentences:
Achieving more fluent movement I'm working on my first OpenGL 2D game and I've just locked the framerate of my game. However, the way objects move is far from satisfying: they tend to lag, which is shown in this video. I've thought how more fluent animation can be achieved and started getting segmentation faults due to accessing the same object by two different threads.
I've tried the following threads' setting:

Drawing, creating new objects
Moving player, moving objects, deleting objects

Currently my application uses this setting:

Drawing, creating new objects, moving objects, deleting object
Moving player

Any ideas would be appreciated.
EDIT: I've tried increasing the FPS limit but lags are noticeable even at 200 fps.

sentences:
Is there an established way to create a 2D XY NavMesh in Unity? Specifically, one in the empty space between colliders, rather than on an XZ plane (more or less) over the surface of a collider?

Specifically this is because I have a drone, in a current project, which must follow a target. This target isn't always reachable by shortest-path, and I'm currently experimenting with a number of algorithms to find a way to guide it around obstacles. I am on something of a deadline and would like to minimize my work, if I can.

I recognize that there are cheats around this, like having it magically appear from off-screen at a critical distance. I'm going to implement them in any case, but that's not what this question is about.

Unity's NavMesh tools were initially alluring, but as far as I can tell they seem to require a very specific FPS-like setup for this project, which I am in no way following. This feels unlike Unity Technologies, and particularly short-sighted of them; so before I go further, I would like to verify that I'm interpreting all of this correctly.

For the sake of stability, I would like to avoid hack-around solutions, if possible. All the same, they are welcome.

sentences:
Handling input from an ECS input system into actions in another system/actions on a entity? Some background on my engine, each system stores a reference to an entity which has the relevant components for that system. For example movement system has only entities which possess position components, render system takes positions and textures etc.

I'm working on an Entity-Component-System Game Engine for a project and I've hit a bit of a brick-wall in regards to how I'm going to handle input for the entities. I'm unsure of how I would translate say a "W" press input into the movement of a single entity(the player)? I don't want to move the entity inside the input system. I'm unsure of how to go about taking input and getting it to result in a response.

This is my first question, if there's anyway I can improve it or if theres any additional information needed I'd be happy to oblige.

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: Selectively applying overlay shadows in a 2D tile based game I'm currently building a top down 2D tile based game using OpenGL. There are three tile layers, the background layer, player/sprite layer & foreground layer. The foreground layer is pretty much used to place translucent tiles that give the impression of a shadow when blended over the two underlying layers. The problem is that many textures for tiles in the background layer already have a shadow applied in their source images. I would like to exclude these background tiles from having the shadow overlaid whilst still applying it to sprites that may be above these tiles. Any ideas as to how I could go about accomplishing this? In the accompanying image notice how I only want the forground shadow applied to the character in the sprite layer to get the result.

sentences:
Java Thread.sleep() VS Get last and current time I am creating a simple game using Java. I'm not using any game library. I just want to know if it is okay to call Thread.sleep(40) before calling repaint().

public void run() {
    while(isGameRunning) {
        try {
            Thread.sleep(40);
            repaint();
        }
        catch(Exception e) {
        }
    }
}

or should I use:

private long last_time = System.nanoTime();
private double ns = 1000000000/25D;
private double delta = 0;
@Override
public void run() {
    while(Universe.IsGameRunning) {
        long time  = System.nanoTime();
        delta += (int)(time - last_time)/ns;
        last_time = time;
        System.out.println(delta);
        if(delta>=1) {
            repaint();
            delta--;
        }
    }
}

The code below has more CPU and RAM usage than the first one. Can you explain to me how 'Delta Timing' actually works?

sentences:
How do I make a 2D World Political map in unreal engine 4? Can someone explain the basics of making a 2D World map in unreal engine 4 (e.g. similar to the ones used in Plague inc., age of civilizations, etc.)

I've seen it being done in unity, but couldn't find any similar content in unreal engine 4...

Thank you.

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:
Understanding Quake I Timer Here is a snippet of code from Quake I.
    LARGE_INTEGER   PerformanceFreq;
    unsigned int    lowpart, highpart;
    OSVERSIONINFO   vinfo;

    if (!QueryPerformanceFrequency (&PerformanceFreq))
        Sys_Error ("No hardware timer available");

    // get 32 out of the 64 time bits such that we have around 1 microsecond resolution
    lowpart = (unsigned int)PerformanceFreq.LowPart;
    highpart = (unsigned int)PerformanceFreq.HighPart;
    lowshift = 0;

    while (highpart || (lowpart > 2000000.0))
    {
        lowshift++;
        lowpart >>= 1;
        lowpart |= (highpart & 1) << 31;
        highpart >>= 1;
    }

The comment indicates that they are reducing the 64 bit PerformanceFreq to 32 bits and that the resolution is about 1 microsecond (the default resolution of QueryPerformanceFrequency is 1 second).
I understand what the code is doing generally, but I don't know what (lowpart > 2000000.0) is meant to be doing or why it's there. I think it's related to ensuring the resolution is about 1 microsecond.
When I run this code through the debugger the lowpart is shifted 3 times meaning that the resolution is actually 1s / 2^3 - 0.125s or 125 milliseconds and not 1 microsecond. The documentation for QueryPerformanceFrequency says that the result is hardware dependent so I don't see how a constant value 200000.0 could work unless you were making an assumption for the result based on modern hardware of the time.
Is this code wrong about the resolution or am I missing something?

sentences:
Damping the Camera "lookAt" rotation I have created a very short piece of code to make the camera look at a transform object. I locked the rotation of the x and z axis as it is only supposed to rotate on the y axis. I would like to add some damping to this and make it rotate slowly, thanks.
Here is my Code:

public Camera Camera;

public void lookAt (Transform target)   {
    Camera.main.transform.LookAt (target);
}

sentences:
Question about Monster Rancher/My Brute generators I want to build a system based on the idea of Monster Rancher's monster generation system.

First, is it legal per se?

Obviously, I don't know how they built theirs and I will be generating my own "generator". But the idea itself of being able to randomly create a character or monster based on something..is it copyrighted? patented?

sentences:
Why is my obj file imported into pyglet showing a blank screen? I am trying to figure out how to import .obj files generated using Blender into my Pyglet game. There is an importer object, example code, and an example .obj/.mtl file within Pyglet's contrib directory.

The pyglet contrib version works (and is flickery; comment out w.flip) with the pyglet/contrib .obj/.mtl files. When I try to run it with my .obj and .mtl files I get a blank screen.

Why am I seeing a blank screen instead of my Blender-generated object?

FWIW, here's my test repo.

sentences:
How to edit key-value pairs (like a Dictionary) in Unity's inspector? I have a spell system I am creating, the principle is as follows:

Each spell is an autonomous prefab. It contains a script with some properties (base damage, duration...) that can be modified in the inspector.
I have a Spell enum listing all possible spells in the code, which is used in the game logic
When I want to cast a spell, I need to be able to get this spell's prefab to instantiate it and read its informations
Each actor (be it players or enemies) needs to have a list of possible animations for the spells

The problems with how I am trying to implement are:

For listing each actor's animations I could use a Dictionary<Spell, Animation>, but dictionaries aren't supported by the inspector which makes it hard to easily edit multiple actors type.
I need some way to easily access a spell prefab from the corresponding enum. Here too I could use a dictionary but I can only reference to prefabs in the inspector, not in code, meaning I wouldn't be able to fill this dictionary

I am looking for a way to easily associate my spells enums to the corresponding prefabs and animations

sentences:
How do I summarize a game idea into a short document? I have a lot of game ideas, but never the time to work on them. I don't want to lose these ideas, so I want to 'store' them somewhere to come back to in the future. Sometimes an idea isn't really that good, and coming back would help me decide whether a game idea is worth pursuing.

I plan to keep these in some kind of catalog form. I would like to be able to capture the 'feel' of a game in as few words as possible. Even if looking back at the design a few years later, the feel and atmosphere of the game should be recoverable very quickly.

This isn't really a full design document, but something like a 'one-page' summary.

sentences:
For Visual Studio Community 2017, 'Unreal Engine Installer' option is not available On Visual Studio Community Installer, I cannot find 'Unreal Engine Installer' under 'Desktop Developemtn with C++' - 'Optional'. According to the tutorials I am learning, the 'Unreal Engine Installer' should be availbl.e

I have Visual Studio installed on 'C:' and Unreal installed on 'H:'; can this be the problem?

sentences:
Exporting Blender bones' transform matrix I use this simple python script to export bones transformation:

bones = armature.pose.bones
# for eaach bone in bones
SystemMatrix = Matrix.Scale(-1, 4, Vector((0, 0, 1))) * Matrix.Rotation(radians(-90), 4, 'X')
if (bone.parent):
  Export_babylon.write_matrix4(file_handler, "matrix", bone.parent.matrix.inverted() * bone.matrix)
else:
  Export_babylon.write_matrix4(file_handler, "matrix", SystemMatrix * bone.matrix)

I'm using a left handed Y up system but I should forget something about rotation because the result is not correct :(

Original (under Blender):

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:
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 do draw a "visibility polygon" in 2D top-down Unity? I've made a very simple 2D top down prototype with Unity. Now I want to expand the thing and add a feature where objects change when the player looks at them.

So I have to add a visibility polygon feature. I want to be able to get a list of objects (2d Colliders) which are in the Field of view of the player.

How I can do that?

I looked around and only found a tutorial which works with Physics2D.Raycast, but this seems to be only one ray as I need a field of view. Similar to the light of a flashlight.

I've drawn a sketch to illustrate my question:

In this case the list should contain the collider V1, V2 and V3 because the player can see them.

Edit:

I experimented with the sending a "fan" of Raycasts every 0,1 ° but this solution does have some problems. The accuracy depends on how far the collider is away. Also this is not the best performing solution. And there are problems with small objects.
As solutions like this: https://www.redblobgames.com/articles/visibility/ seems to be a lot of work just to reinvent something which is already out there I wonder if there is a built-in way in unity to help me to compute this area.

sentences:
How should one component "trigger" another one in a component system? In my game I have a MoveComponent and a ClimbComponent.

Some characters can only move around on one level, others are able to climb to the next floor.

My intention is to have characters randomly be able to climb if the are about to bounce into a wall.

How would I manage this? Should the ClimbComponent be added dynamically and also be removed again, or should random characters always have the ClimbComponent and it would be activated and deactivated dynamically?

sentences:
What's better - drawing every interval that the window updates, or drawing when necessary and updating when drawing? So what's better?

In case the title is a bit confusing I mean:

1) Drawing every window update interval. For example, for a 60FPS window, every 17 milliseconds. For example:

window.setFramerateLimit(60); //Update every 17 milliseconds for 60FPS
while(window.isOpen()) {
window.display();
}

Or

2) Drawing when you need to (for example, when a sprite moves) and displaying it straight after.
For example:

void func(sf::RenderWindow& window) {
window.draw(sf::Sprite()); //Whatever you're drawing
window.display();
}

Or is there a much better way?

sentences: Unity2D coloring a map I have an image with a bunch of colored regions, with each region corresponding to a province in my game. Each province also has a nation owner, which has a respective color. I need to create a function that, when it is called, changes all pixels of a province's color on the first image and changes them to the owners's color on another image. Should I do this with shaders? A script?

sentences:
Making a new instantiated prefab as a child for existing GameObject I've been searched about how to make these fruit to move as the basket movement if it collided with it, and I've been found that if I want to perform this I've to let these fruit to be a child to the basket game object .. for example :

banana.transform.parent = basket.transform;

banana and basket each of them of type "GameObject" ...

BUT unfortunately this way didn't work !! and I don't know why ??

So now I need to know if it is possible to destroy the banana if a collision with the basket happened and instantiate a new banana in the basket as a child at run time ?!!

I need to try this stupid way because I've tried all the other ways and nothing worked :(

sentences:
Vectors in game development I'm new to programming and game programming.
I've reading something about vectors and math, but I have a question - where do I use vectors in game programming? Maybe anyone can give a simple example where you are using vectors (in 2D)?

I've found examples but mostly they are in the console where they output numbers, and big examples which I don't understand.

sentences:
Where and how to check if game was developed with bought Unity3D licence (not cracked app)? We hired an external team from Eastern country. They built our mobile game app using Unity3d which we paid a lot of $K. We asked them to only use the software with bought license, not cracked one, and they said they will do it.

Now, we're ready to publish apps to official stores and I read on the net that guys from unity3d can always check if the app was made via bought license or via cracked software. If they discover it's been made with cracked software, they will ban the app and probably prosecute us.

Where can we find such tool to confirm that our software was indeed made by 100% licensed unity3d piece of software?

sentences:
EXTREMELY Confused Over "Constant Game Speed Maximum FPS" Game Loop I recently read this article on Game Loops: http://www.koonsolo.com/news/dewitters-gameloop/

And the recommended last implementation is confusing me deeply. I don't understand how it works, and it looks like a complete mess.

I understand the principle: Update the game at a constant speed, with whatever is left render the game as many times as possible.

I take it you cannot use a:

Get input for 25 ticks
Render game for 975 ticks

Approach since you would be getting input for the first portion of the second and this would feel weird? Or is that what is going on in the article?

Essentially:

while( GetTickCount() > next_game_tick && loops < MAX_FRAMESKIP)

How is that even valid?

Let's assume his values.

MAX_FRAMESKIP = 5

Let's assume next_game_tick, which was assigned moments after initialization, before the main game loop is say... 500.

Finally, as I am using SDL and OpenGL for my game, with OpenGL being used for rendering only, let's assume that GetTickCount() returns the time since SDL_Init was called, which it does.

SDL_GetTicks -- Get the number of milliseconds since the SDL library initialization.

Source: http://www.libsdl.org/docs/html/sdlgetticks.html

The author also assumes this:

DWORD next_game_tick = GetTickCount();
// GetTickCount() returns the current number of milliseconds
// that have elapsed since the system was started

If we expand the while statement we get:

while( ( 750 > 500 ) && ( 0 < 5 ) )

750 because time has passed since next_game_tick was assigned. loops is zero as you can see in the article.

So we have entered the while loop, let's do some logic and accept some input.

Yadayadayada.

At the end of the while loop, which I remind you is inside our main game loop is:

next_game_tick += SKIP_TICKS;
loops++;

Let's update what the next iteration of the while code looks like

while( ( 1000 > 540 ) && ( 1 < 5 ) )

1000 because time has elapsed getting input and doing stuff before we reached the next ineteration of the loop, where GetTickCount() is recalled.

540 because, in the code 1000 / 25 = 40, therefore, 500 + 40 = 540

1 because our loop has iterated once

5, you know why.

So, since this While loop is CLEARLY depedent on MAX_FRAMESKIP and not the intended TICKS_PER_SECOND = 25; how is the game supposed to even run correctly?

It was no surprise to me that when I implemented this into my code, correctly I might add as I simply renamed my functions to handle user input and draw the game to what the author of the article has in his example code, the game did nothing.

I placed an fprintf( stderr, "Test\n" ); inside the while loop which doesn't get printed until the game ends.

How is this game loop running 25 times a second, guaranteed, while rendering as fast as it can?

To me, unless I am missing something HUGE, it looks like... nothing.

And isn't this structure, of this while loop, supposedly running 25 times a second and then updating the game exactly what I mentioned beforehand at the start of the article?

If that is the case why couldn't we do something simple like:

while( loops < 25 )
{
    getInput();
    performLogic();

    loops++;
}

drawGame();

And count for interpolation some other way.

Forgive my extremely long question, but this article has done more harm than good to me. I am severely confused now - and have no idea how to implement a proper game loop because of all these arisen questions.

sentences:
Javascript 2D game tile textures I am using a texture atlas for my tiles. Of course I need to get the sub-images to draw them on the canvas as separate tiles. Right now I can think of two ways to implement this.

Divide the texture atlas into separate Image instances. Then draw them onto the canvas accordingly.
Use a single image, and just draw part of it by adding extra parameters to CanvasRenderingContext2D's method `drawImage.

I'm not sure which is better. My thoughts were that the first option would be more manageable and flexible, since each tile is separated. What would be better? What are the ups and downs of each?

sentences:
Commercial 2D game engines? I know that there are several open-source/free 2D game engines out there; I am just wondering about commercial ones (if any). The idea of wanting of looking for a commercial engine is for support and continual updates.

Off the bat I know that there is DarkBasic, Blitz Basic and Torque 2D. What's else are there?

What I am looking for (technical wise):

Sprites and Animation capability
GUI (menus, dialogs, simple controls)
Math helper for usual math operations -vectors, rotation, turning an entity to face another...
Entity management
Particles
Serialization of game data
Level design tools
Deployment tools

And support wise

Documentation
Examples and Tutorials
Continual update
Support through forum/emails/private channels

sentences:
C# XNA Normals Question I have been working on some simple XNA proof of concept for a game idea I have as well as just to further my learning in XNA. However, i seem to be stuck on these dreaded normals, and using the BasicEffect with default lighting i can't seem to tell if my normals are being calculated correctly, hence the question.

I'm mainly drawing cubes at the moment, I'm using a triangle list and a VertexBuffer to get the job done. The north face of my cube has two polygons and 6 vectors:

Vector3 startPosition = new Vector3(0,0,0);
corners[0] = startPosition; // This is the start position. Block size is 5.
            corners[1] = new Vector3(startPosition.X, startPosition.Y + BLOCK_SIZE, startPosition.Z);
            corners[2] = new Vector3(startPosition.X + BLOCK_SIZE, startPosition.Y, startPosition.Z);
            corners[3] = new Vector3(startPosition.X + BLOCK_SIZE, startPosition.Y + BLOCK_SIZE, startPosition.Z);

            verts[0] = new VertexPositionNormalTexture(corners[0], normals[0], textCoordBR);
            verts[1] = new VertexPositionNormalTexture(corners[1], normals[0], textCoordTR);
            verts[2] = new VertexPositionNormalTexture(corners[2], normals[0], textCoordBL);
            verts[3] = new VertexPositionNormalTexture(corners[3], normals[0], textCoordTL);
            verts[4] = new VertexPositionNormalTexture(corners[2], normals[0], textCoordBL);
            verts[5] = new VertexPositionNormalTexture(corners[1], normals[0], textCoordTR);

Using those coordinates I want to generate the normal for the north face, I have no clue how to get the average of all those vectors and create a normal for the two polygons that it makes.

Here is what i tried:

            normals[0] = Vector3.Cross(corners[1], corners[2]);
            normals[0].Normalize();

It seems like its correct, but then using the same thing for other sides of the cube the lighting effect seems weird, and not cohesive with where i think the light source is coming from, not really sure with the BasicEffect.

Am I doing this right? Can anyone explain in lay mans terms how normals are calculated. Any help is much appreciated.

Note: I tried going through Riemers and such to figure it out with no luck, it seems no one really goes over the math well enough. Thanks!

sentences:
RTS game: How to handle disconnects in a fully connected peer to peer architecture? I'm currently working on a game in which I am considering implementing a networking architecture as described in this article: http://www.gamasutra.com/view/feature/131503/1500_archers_on_a_288_network_.php

In order for the implementation as described in the article to work, all peers need to be interconnected without any exceptions. Like so:

This works fine when everything is well. But I am wondering how to agree on disconnects in such a network. (Sadly something the article does not go into). It is relatively easy if one client goes down. Just give every client a timeout, and if a client does not respond for a certain time, it is removed from that client.

However, how should the system solve a case in which one client does not respond to another, but still responds to all others. In such a system the following could happen, resulting in a invalid state:

Of course this can be solved by giving one of the clients some kind of "master" role. It being the only one that can decide whether or not to disconnect other clients. But I'm wondering if it can be achieved in a pure p2p network.

Note I realize this case is not one that can likely occur "naturally". But I want to prevent players from being able to ruin a networking game for others by playing a trick like this by using the firewall for example.

sentences: GL_EXT_draw_instanced vs VBO's I'm having trouble understanding the benefit of the newer GL_EXT_draw_instanced over traditional VBO's.  Don't both keep geometry cached on the gpu for faster redrawing?  VBO's seem much more flexible.

sentences:
How to deal with texture coordinates without range? I have a set of given texture coordinates(u,v coordinates), but they are ranging from (-inf, inf), contradicting the [0,1] convention.

I tried to do a rescaling by
value = (value - min) / (mac - min).
But if I have a rectangle which composed of two triangles, four vertices. Suppose the u,v coordinates are

  -0.260944  0.490887
   3.619507  0.490887
   3.619507 -3.043434
  -0.260944 -3.043434

After scaling, the coordinates would be mapped to exact -1 and 1, resulting in wrong texture.

So how should I deal with this kind of texture coordinates?

sentences: Multiple points of gravity in GameMaker Studio 2 I'm trying to make a simple 2D prototype in GameMaker Studio 2 where there're multiple points of gravity, essentially static objects in the scene that attract the player-object based on distance and mass of the object. Does anyone know if this would be complicated to get working? I've been trying to find resources on how to do this, but so far I've not found much helpful, so if anyone has any pointers for me that would be much appreciated.

sentences:
Storing visibility graph for path-finding: do redundant and non-visible pairs of points have to be saved? Using C# in Unity, I have recently implemented an algorithm that determines during run-time the visibility graph of a given scene in my game project (visibility between corners of obstacles). Now I am in doubt about the best way to save the result.

So, considering that I want the visibility graph for path-finding, I would like to know the following:

1) Suppose that points A and B are visible to each other. Then, AB and BA both detect the same visibility line. It happens to all mutually visible pairs in my case. So, in order to perform an A* algorithm do I really need all these redundant pairs or can I get rid of the redundant ones, leaving only AB or only BA?

2) Now suppose that points A and C are NOT visible to each other. Do I have to save AC and/or CA? It is, to apply an A* algorithm do I have to save pairs of points that are not visible?

I ask that because if the answer to both questions is "yes", then the final array storing the graph becomes NxN, where N is the number of points (corners of obstacles) in the scene, with each cell holding the value 0 for non-visible pairs or a value equal to the distance between each visible pairs. I think technically it is called an Adjacency Matrix.

However, if the answer to any or to both of these questions is "no", then I would be able to save a lot of memory because the final results would require a much smaller array. The reason is that I would then not save redundancy and also most points are not visible to each other (it's technically a non-dense graph), so they would not be included.

But I am not sure I can go that route for path-finding. So, in case the answer to any of the 2 questions above is "no", what is the logical format I should use for saving the results, in order to perform an A* algorithm in the visibility points?

Many thanks for your time.

sentences:
Special moves using mouse movement? Recently, I accidently broke my PC controller and I was forced to play Skullgirls using the keyboard. Needless to say, it sucked. Fighting games are the kind of games where a controller is (almost objectively) better to use than a keyboard, just like how keyboard + mouse is better to use for FPS games than a controller. Keyboards just don't allow the same freedom a controller offers for fighting games, especially because of the analog stick.

So while I was getting my *** kicked and (of course) blaming only my keyboard instead of myself, I had an idea: why don't fighting games use the mouse, too? Couldn't the mouse movements be used as the directional input for the special moves instead of the arrow keys? Examples:

Hadouken - quick flick with the mouse into the direction you're facing
Shoryuken - a steep upward curve towards the direction you're facing
Roundhouse kick - a quick circle motion

What are the advantages and limitations using the mouse in such a way? Are there any examples out there? Maybe there are some limitations I'm not seeing right now? To me, this looks like a way to give players the same freedom in fighting games with keyboard + mouse as a controller would provide, so I'm surprised I don't see more fighting games with that control option.

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:
How to communicate success/failure within an abstract hint system without using sound or words I am designing a hint system for a "game".
The game is an interactive art simulation for multi-touch and although it is rather intuitive to figure out the basics of how to run that simulation there are some more complicated things to it that I would like to help the user discover.
My design rules are that it needs to be abstract and mostly transparent. There can be no sounds or words to this hint system. I am hesitant to use symbols as well.
I realize this makes it quite difficult to effectively communicate with the user but that is sort of the point. It is supposed to be a bit of a puzzle so it is rewarding to solve and in this case it is completely fine if the user does not.
These hints will show up when the user is close to figuring out a new aspect of the simulation. The goal of it is to communicate what the missing piece is for them to get there.
For example on one of the hints I need to get the user to hold a new finger down for more than 1 second under certain conditions.
In order to communicate this I want to show some sort of indicator. When the user puts their finger on the indicator it reacts communicating that that was a good choice but there is still more to do. If the user lifts their finger before 1 second I want to show some sort of "failure animation" however if the user lifts their finger longer than 1 second I want to show some sort of "success animation". The user would also notice that the behavior of the simulation changed.
I have chosen a ring/circle as the core shape for the indicator. This makes sense because generally a hint appears somewhere they are not touching and they begin being "in progress" once their finger is on the indicator. I am good with shaders so I will make it look better later.
So far the hint has been reading but I am concerned about how clear it is whether they failed or were successful at executing whatever the hint was hinting about. I have thought about having the indicator turn "green" for good or "red" for bad but the problem here is that color scheme isn't universal. AND most critically it begs the question of what a "neutral" color is/should be for the indicator before the user has started on the hint and while they are doing it and the indicator is following their finger. Teal was my gut instinct but that color is already pretty close to green.
I am worried about the use of just color and specifically the colors red/green so I am looking for other ideas on how I might be able to get this indicator to communicate success or failure following the rules at the top.
Are there other ways I could communicate success/failure?
In addition does anyone know of any other games/projects that use a non-verbal/written hint system communicating more abstractly/with colors? Would be good to have some reference.
Any related articles are great too.
Here is sort of a state diagram of the indicator if that helps. I have included a simple/mockup of the indicator with very simple shapes but obviously to give you an idea it will look better. In the holding example the hint would start by being in the state "hint start" somewhere on screen and when the user touches it would transition to "hint in progress". If the user releases before 1 second it would then go to "failure" and turn red but if the user releases after 1 second it would go to "green" for success.

sentences: Is it a good idea to perform all matrix operations on the GPU? I was wondering if it is a improvement to use OpenGL for matrix calculations instead of using the CPU. And if it is a improvement, is it worth it to change the math class to use OpenGL?

sentences:
Object-oriented Ability System? For my RTS game's ability system, I need an efficient ability system where each ability is its own class that implements certain functions from an inherited abstract base class, Ability. Every ability is identified by a byte ID (which gets sent over the network and interpreted by other players). I want to be able to call an ability's overrided Execute() Method with its ID. Currently, I've been thinking of storing all the abilities in dictionaries with their IDs as their keys but I'm having trouble storing these derived classes, abilities, in the dictionary.

I've also heard of reflection but I'm a bit hesitant because I've heard it's a quite expensive operation. Would it be recommended to use up to 60 reflection processes in one frame or will this cause performance issues?

Note: I'm using C# and Unity3D.

sentences:
Network Message Format Specification I'm working on a TCP turn multiplayer game.

I've read many tutorials and stuff, and they all said to use Async IO, but, none of than give practical examples on how to do it.

I was thinking that in every TCP data stream sent, the client would have to send who is he, and what he's doing. Is it really necessary? What's the best way to deal with host identifying? If I should deal with this at all...

Should I check in every message if he's who he's claiming to be?
There's any comprehensive game packet analysis avaiable on the web? I think I would learn much from this kind of source.

EDIT: I'm doing a server/many-clients model.

Thanks,
Julio Rodrigues

sentences:
Method keep adding the same monster to the list I'm creating a text based arena RPG where each day new monsters are added to a list, but with my current code, only one monster gets added to the list repeatly with the same stats (which for some reason keep increasing each day).
This method calls the creator.
public static List<Monster> MonsterOfTheDay()
  {
    int count = 0;
    List<Monster> MonstersListOfTheDay = new List<Monster>();

    while(count <= 5)
    {
      MonstersListOfTheDay.Add(Creator());
      count++;
    }

    return MonstersListOfTheDay;
  }

This is the creator
public static Monster Creator()
{
    Random random = new Random();
    Monster monsterChoosen = monsterListPrefab.Find(m => m.Id == random.Next(0, monsterListPrefab.Count -1));

    monsterChoosen.Level = random.Next(monsterChoosen.Level, monsterChoosen.Level + 3);

    //1Offensive, 2Defensive, 3Balance
    monsterChoosen.Type = (Types)typeList.GetValue(random.Next(1, typeList.Length));

    Console.WriteLine("Estou Aqui");

    int atributes = monsterChoosen.Level * 3;
    int spend = 0;

    Console.WriteLine("Estou Aqui");
    while(spend != atributes)
    {
      int chance = random.Next(0, 100);
      if(monsterChoosen.Type == Types.Offensive)
      {
        if(chance >= 0 && chance <= 60)
        {
          monsterChoosen.Str++;
          spend++;
        }

        if(chance >= 61 && chance <= 70)
        {
          monsterChoosen.Int++;
          spend++;
        }

        if(chance >= 71 && chance <= 85)
        {
          monsterChoosen.Agi++;
          spend++;
        }

        if(chance >= 86 && chance <= 100)
        {
          monsterChoosen.Vig++;
          spend++;
        }
      }
      else if(monsterChoosen.Type == Types.Defensive)
      {
        if(chance >= 0 && chance <= 60)
        {
          monsterChoosen.Vig++;
          spend++;
        }

        if(chance >= 61 && chance <= 70)
        {
          monsterChoosen.Str++;
          spend++;
        }

        if(chance >= 71 && chance <= 85)
        {
          monsterChoosen.Int++;
          spend++;
        }

        if(chance >= 86 && chance <= 100)
        {
          monsterChoosen.Agi++;
          spend++;
        }
      }
      else if(monsterChoosen.Type == Types.Balance)
      {
        if(chance >= 0 && chance <= 25)
        {
          monsterChoosen.Str++;
          spend++;
        }

        if(chance >= 26 && chance <= 50)
        {
          monsterChoosen.Int++;
          spend++;
        }

        if(chance >= 51 && chance <= 75)
        {
          monsterChoosen.Agi++;
          spend++;
        }

        if(chance >= 76 && chance <= 100)
        {
          monsterChoosen.Vig++;
          spend++;
        }
      }
      else if(monsterChoosen.Type == Types.Prefab)
      {
        spend++;
      }
      else
      {
        Console.WriteLine("Error");
      }
    }

    return monsterChoosen;
  }

sentences:
Bullet Physics stops detecting collision after a few steps Let me start off by saying that the usage of Bullet here is slightly unconventional. I'm writing a server emulator for a game, and the server is only keeping track of the triggers, players and enemies. It doesn't do a full physics simulation like the client.

Thus, the gravity is set to 0. The client is authorative over the position of the player object, so the rigidbody is just moved around on the server as the player walks through the world.

The problem is that, while Bullet can detect the collisions, it'll stop after a few steps. I presumed this is because the objects went to sleep / toggled as inactive, but moving them, setting flags telling them not to sleep, or forcing reactivation doesn't fix it.

I've created a small program that shows the problem:

void updatePos(btRigidBody* rb, btVector3 position) {
    btTransform initialTransform;

    initialTransform.setOrigin(position);

    rb->clearForces();
    rb->setWorldTransform(initialTransform);
    rb->getMotionState()->setWorldTransform(initialTransform);
}

int main() {
    btDefaultCollisionConfiguration* collisionConfiguration = new btDefaultCollisionConfiguration();
    btCollisionDispatcher* dispatcher = new btCollisionDispatcher(collisionConfiguration);
    btBroadphaseInterface* overlappingPairCache = new btDbvtBroadphase();
    btSequentialImpulseConstraintSolver* solver = new btSequentialImpulseConstraintSolver;

    auto* world = new btCollisionWorld(dispatcher, overlappingPairCache, collisionConfiguration);

    //Create our player:
    btDefaultMotionState* state = new btDefaultMotionState(btTransform(btQuaternion(), btVector3()));
    btCylinderShape* shape = new btCylinderShape(btVector3(1.0f, 1.5f, 1.0f));

    btVector3 localInertia(0, 0, 0);
    shape->calculateLocalInertia(1.0f, localInertia);

    btCollisionObject* rbPlayer = new btCollisionObject();
    rbPlayer->setCollisionShape(shape);

    //Create our trigger:
    state = new btDefaultMotionState(btTransform(btQuaternion(), btVector3(-227.5784454345703, 555.2715454101562, -73.29886627197266)));
    btBoxShape* trigShape = new btBoxShape(btVector3(5.0f, 0.5f, 2.5f));

    btCollisionObject* rbTrigger = new btCollisionObject();
    rbTrigger->setCollisionShape(trigShape);

    world->addCollisionObject(rbPlayer);
    world->addCollisionObject(rbTrigger);

    rbPlayer->setActivationState(ACTIVE_TAG);
    rbTrigger->setActivationState(ACTIVE_TAG);
    rbPlayer->setActivationState(DISABLE_DEACTIVATION);
    rbTrigger->setActivationState(DISABLE_DEACTIVATION);

unsigned int stepCounter = 0;

while (true)
{
    printf("step %i\n", stepCounter);

    world->performDiscreteCollisionDetection();
    if (stepCounter == 1) rbPlayer->getWorldTransform().setOrigin(btVector3(-227.0f, 560.0f, -73.0f));

    int numManifolds = world->getDispatcher()->getNumManifolds();

    for (int i = 0; i < numManifolds; i++)
    {
        btPersistentManifold* contactManifold = world->getDispatcher()->getManifoldByIndexInternal(i);
        const btCollisionObject* obA = static_cast<const btCollisionObject*>(contactManifold->getBody0());
        const btCollisionObject* obB = static_cast<const btCollisionObject*>(contactManifold->getBody1());

        int numContacts = contactManifold->getNumContacts();
        for (int j = 0; j < numContacts; j++)
        {
            printf("yes\n");
        }
    }

    stepCounter++;
    std::this_thread::sleep_for(std::chrono::milliseconds(16));

    if (stepCounter == 15) rbPlayer->getWorldTransform().setOrigin(btVector3());
    if (stepCounter == 30) rbPlayer->getWorldTransform().setOrigin(btVector3(-227.0f, 560.0f, -73.0f));

    rbPlayer->activate(true);
    rbTrigger->activate(true);

    if (stepCounter > 40) break;
}
}

I'm willing to bet it's some slight oversight that caused this, but I couldn't find anyone with the same issue as me online.

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

sentences:
Prefabs moved to before position when zooming scene I have build some pipes for waterline drawing, like following screencast:
https://youtu.be/WnJb1JwOW78
As you can see, when I zoom in the scene,  Pipes moved to lower position. When i zoom out, Pipes moved to higher position.
Actually I have changed the position and  moved down the pipe position before, the unexpected higher position was the pipe before position.
So i guessing this problem might about cache clean.
So I I try to clear the GI cache, but the problem still exist.
And then I try to build a windows executable file and run game again, problem still.
How to fix it?
I am using  Unity 2018.4

sentences:
What method is best to display respawn times? I'm currently working on multiplayer game and am trying to work out how to display respawn times.   I had a few ideas in mind, taking inspiration from other games I've played before.

Text Based

Progress Bar

Visual Timer

Is there another way to display respawning for players that improves visual feedback? Meaning, is clear and effective at conveying exactly how long a player has to wait to respawn?

sentences:
Circle-Circle collision resolution This seems easy but I can't figure it out, when I have one circle(c1) collide with another(c2) I give the c2 circle the heading of c1 and send the c1 circle on the normal vector to the heading (the heading is stored as vector = (cos(theta), sin(theta)) this is probably a bad solution). So this works great when c1 is colliding head-on with c2, however if c1 collides with it's tail into c2 then c2 takes the direction that c1 is facing which causes them to intersect each other. Any ideas of how I can "re-word" the heading vector so it's not dependent on theta (the angle that c1 is looking at in the cartesian plane)?

Here is an example:
Elastic Collision

sentences:
Using a permutation table for simplex noise without storing it Generating Simplex noise requires a permutation table for randomisation (e.g. see this question or this example).

In some applications, we need to persist the state of the permutation table. This can be done by creating the table, e.g. using

def permutation_table(seed):
    table_size = 2**10  # arbitrary for this question
    l = range(1, table_size + 1)

    random.seed(seed) # ensures the same shuffle for a given seed
    random.shuffle(l)
    return l + l  # see shared link why l + l; is a detail

and storing it.

Can we avoid storing the full table by generating the required elements every time they are required?

Specifically, currently I store the table and call it using table[i] (table is a list). Can I avoid storing it by having a function that computes the element i, e.g. get_table_element(seed, i).

I'm aware that cryptography already solved this problem using block cyphers, however, I found it too complex to go deep and implement a block cypher.

Does anyone knows a simple implementation of a block cypher to this problem?

sentences:
Loading animation from server? As android app that will be playing animation online, it will be connected via web-socket to a server.

The question is, what is the recommend way to store animation that will be loaded by the android app?
I can send JSON formatted messaged via websocket, but as I am new to 3D animation, what format is advised for my case using LibGDX?

sentences:
Implementing online connectivity and multiplayer/PVP for a newbie Background

I'm a noob programmer looking to create a simple turn based mobile game as a side project. I've pretty much got the game logic down and am left with implementing the online multiplayer/PVP portion.

More specifically, i'm looking to implementing a system when the player clicks play and will be matched with an opponent in a 1 v 1 format, without any lobbies etc etc.

I'm currently trying to develop my game in android studio(i'm new) but am also open to unity if it makes the development easier.(I have no experience in Unity).

What i want to know

From what i understand,i need to create and host my own server for the multiplayer to run(i.e matching of player to opponent). Do i also need the server to run the game itself or am i able to connect the player to the opponent and simply record the result of the game to my server/database?

Also, how would i go about creating and running/hosting the server? I heard nodeJS is a good choice for writing the server.

End Goal

I just wanna publish my game onto the app store, IOS store, etc.

sentences:
PHP Quest System: Push or Polling? I want to build a quest system in PHP. My idea so far was to create quests based on a class and write two functions for every quest: One is checking if its activated, the other will check the progress.

Since I have to do this on every page reload, this might be bad performance-wise. Is it possibleto build some kind of an event/push system with PHP? How would you do it? Yes, when something happens like the users buys something, a function gets called with for example "CAR_BOUGHT_BY_PLAYER".

My problem is, I don't know how to go on from there.
Any advice?

Thanks!

sentences:
How to check metadata stored in FBX files? Is there a way to check and edit metadata information stored in FBX files? I'm using 3ds Max's fbx exporter. Can this be done with it or is there any other tool for that?

For example: adding name, contact info, tags or anything that provides ownership of the file.

sentences:
Using Box2D for soccer physics I've learned quite a bit of Box2D and I've succeeded basic stuff concluding ball physics.

I want to implement 'opposing forces', as the character kicks the ball with a certain strength, with the leg having a certain mass, in a certain velocity. Basically, I don't want the leg to be controlled by Box2D's world, but to be counted as an object that I (the programmer) can move freely without the b2World::Step() method affecting it (as the player controls the leg).

How do I do so? I'd be happy to have a link, as I can't seem to find one.

sentences:
WWWForm - .AddField vs .headers I am using WWWForm to do the equivalent of GET and POST from python. To add headers to my unity requests, according to the documentation I could two options:

WWWForm form = new WWWForm ();

form.AddField("user", username); //OPTION 1:
https://docs.unity3d.com/ScriptReference/WWWForm.AddField.html

form.headers["user"] = username; //OPTION 2:
https://docs.unity3d.com/ScriptReference/WWWForm-headers.html

With the risk of asking a very naive question: Can someone explain the difference between the two? Thank you

sentences:
Rotated Sprites collision detection I am trying to implement checkCollision function in my game, I used AABB method but the problem is that my sprites are rotated so it's not really precise. I could finely describe my Sprites with rotated ellipses. Is there any more precise way of detecting the collision if I have the following attributes of entities:

entity.x
entity.y
entity.width
entity.height
entity.angle

Here is what I have coded so far (x and y are in the middle of my sprite):

this.checkCollision = function(entity1, entity2) {
  return (entity1.x - (entity1.width*this.COLLISION_EPSILON_WIDTH)/2 < entity2.x + (entity2.width * this.COLLISION_EPSILON_WIDTH)/2 &&
   entity1.x + (entity1.width*this.COLLISION_EPSILON_WIDTH)/2 > entity2.x - (entity2.width * this.COLLISION_EPSILON_WIDTH)/2 &&
   entity1.y - (entity1.height*this.COLLISION_EPSILON_HEIGHT)/2 < entity2.y + (entity2.height*this.COLLISION_EPSILON_HEIGHT)/2 &&
   (entity1.height*this.COLLISION_EPSILON_HEIGHT)/2 + entity1.y > entity2.y - (entity2.height*this.COLLISION_EPSILON_HEIGHT)/2)
}

PS: my cousin told me to do it with three circles (which creates a shape very similar to the ellipse) but I do not really know how to do it.

sentences:
Can't use SFML sprite drawing and OpenGL rendering at the same time I'm using some SFML built in functions to draw sprites and text as an overlay on top of some OpenGL rending in an SFML RenderWindow. The opengl rendering appears fine until I add the code to draw the sprites or text. The sprite or text drawing causes the OpenGL stuff to disappear.

The follow code show what I'm trying to do

sf::RenderWindow window(sf::VideoMode(viewport.width,viewport.height,32), "SFML Window");
glMatrixMode(GL_PROJECTION);
glLoadIdentity();

glOrtho(0,viewport.width,0,viewport.height,0,1);

while (window.pollEvent(Event))
    {
    //event handling...

    //begin drawing
    glClear(GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT);
    glBegin(GL_TRIANGLES);
    glColor3f(col.x,col.y,col.z);
    for(int i=0;i<3;i++)
        glVertex2f(pos.x+verts[i].x,pos.y+verts[i].y);
    glEnd();

    // adding this line causes all the  previous opengl triangles not to appear
    window.draw("Sometext");

    window.display();
}

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: Is it possible to program the entire logic and flow of a game without ever touching a graphic's engine? I'm not interested in rendering engines or level design, but I'm very interested in programming the AI that drives all of the characteristics of game play. I'm thinking of how the d20 system drives the rules behind D&D games. Is there a person that programs that logic, and is it possible to program almost all of an API without ever touching a graphic's engine? I'm a software engineer by trade (Java with some C# experience), so I'm looking to use those programming skills.

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:
Android: Hardware Scaler I was reading through this: using-hardware-scaler-for-performance and am a little confused by it.  It says all you need to do to invoke the scaler is to set it like so:

surfaceView = new GLSurfaceView(this);
surfaceView.getHolder().setFixedSize(1280, 720);

They says to use a fixed size for all devices.  On my Google Nexus 10 (which has a resolution of 2560 x 1600).  I've used 1280*800.  It then goes on to say that the system will scale it to match the device's actual resolution.

So this is what I get:

What am I missing here? Unfortunately the above link says that examples will be added soon but as yet there is nothing.

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:
Client side prediction buffer size considerations for jitter I am currently having a FPS game with client side prediction. Every 20ms, the client sends it's input to the server. The server buffers 5 ticks worth of input (100ms) and starts consuming the inputs each tick and sends a world snapshot to the client. The client then validates the predictions and corrects the simulations if there is a misprediction. The setup works fine under ideal network conditions. However when the latency suddenly spikes from say 50ms to 400ms, the client's tick packet is delayed which causes the server to eat through all of the available inputs in the buffer and resort to using the previous tick values to perform server simulation. When the client input finally arrives at the server late, the server discards the input because it has already processed the input for that particular tick (using old input values).
How do I handle this edge case of latency increasing and decreasing? Sure I could use a larger buffer size for the inputs, but that will cause delays between client state and server state. Using a smaller buffer will cause the server to stall from inputs if there is a jitter that is more than the duration required by the server to process the inputs. I was under an impression that I would need some kind of dynamic buffer size that expands and contracts. However, I am out of ideas to implement something like this.
Does anyone have a solution?

sentences:
Multiple cameras using a single skybox with same perspective I am using the enviro package for weather and to have a moving sun in the background. I'm building an installation with 3 screens and I want to have the sun track across the screens. However what I end up with is 3 separate skyboxes and 3 suns, one on each screen.

Is there a way I can have the cameras share a single skybox?

sentences:
Find transformation to align two polygons at fixed points? Problem

I have a source image (arbitrary width and height c) shown here as a rectangle [X1,X2,X3,X4]. It contains two points C and D (both known coordinates within the image - X4 / top left).

Then I have a target image (might have different height a and width b than source image) that contains two points A and B (|AB| doesn't necessarily equal |CD|). There's also a source of projection S.

I need to somehow calculate coordinates of a transformed rectangle (polygon) such that:

Point C will always be mapped to A (therefore A will be equal to C) and D will be mapped to B (B = D)
Point X3 of this newly calculated polygon will lie on a line between S and A/C (now identical)
Point X4 will lie on a line from S to B/D.
Distance from parallel lines [X1,X2] and [X3,X4] will be still c. (If it turns out that it's not always possible to construct such a polygon the condition 4. can be dropped, and [X1,X2] don't need to be parallel to [X3,X4] as well)

(see below)

What I've tried

I thought I will solve it by:

shrinking width of source image by ratio of |AB| and |CD|
aligning C with A (move source image)
finding angle difference  between AB and CD
rotating source image by angle  (with center in C/A)
calculating X3 and X4

But it doesn't work universally. Steps 1-4 work well, but then changing X3 and X4 moves C (resp. D) away from A (resp. B).

sentences:
unity destroy enemy when jumping on it I am creating a 2D platformer using Unity3D, I want to have the player destroy enemies when it jumps/falls over them (just from the top). But I have been having problems trying to implement this. I stripped everything and used two simple box colliders in order to make it easy. So, when onCollisionEnter2D is called I get the bounds of the objects colliding like this:

    Bounds playerBounds = new Bounds(transform.position, collider2D.bounds);
    Bounds collisionBounds = new Bounds(collision.transform.position, collision.collider.bounds);

Then I check if the object colliding is below by comparing it's bounds:

    //If the player's lowest point is greater than the
    //colliding object's highest, then it is above it
    bool isAbove = playerBounds.min.y >= collisionBounds.max.y;

Then I check if the object is actually an enemy, and if so, I destroy it:

    if(isAbove)
    {
        if(collision.gameObject.tag == "Enemy")
        {
            collsion.gameObject.getComponent<EnemyController>().die();
        }
    }

Now the thing is this never happens, isAbove is never true, so I tried checking the heights of each object so I use

    Debug.Log("player : "  + playerBounds.min.y + " enemy : " + collisionBounds.max.y)

It says the player bottom-most is below the enemy top-most. Since I use this same method to detect if the player is grounded in order to enable jumping I noticed it works beautifully with other things like platforms but not with enemies. Also y used Debug.break to stop the game and noticed that when colliding with platforms the player's collider was always above the platform's, but when it collided with enemies they overlap: so the player's bottom-most part is below the enemy's top-most part. I read somewhere that this is due to the minPenetrationPenalty property, I didn't like the results of messing with it so I just left it the same (If I lower it doesn't even work with platforms, and I increase it they don't even touch and the collision is detected). I tried to compensate for this penetration when checking the bounds so I said:

    bool isAbove = playerBounds.min.y >= collisionBounds.max.y - 0.01;

It sometimes fails and sometimes not depending on the angle and other stuff, I still don't get it because if this was the problem It shouldn't work with the platforms either but it does, it only fails with enemy. I even tried to check for the overlap and said:

    float overlap = playerBounds.min.y - collisionBounds.max.y;

    bool isAbove = overlap > -0.01;

this still works beautifully with platforms only reporting positive values (which means they are not overlapping), but with enemies it actually reports negative values (which confirms the previous: they do overlap), even more strange it actually reports overlaps greater than what should be allowed, the usually report a -0.09 which means a 0.09 overlap which is greater than the 0.01 that the physics engine is supposed to allow.

If I apply this code in OnCollisionStay2D instead it works, I guess by this time the overlap  is fixed, but this looks unnatural and I still don't understand why this works perfectly with platforms (they never even overlap!) and not my enemies.

sentences:
Android Game, Blurring effect while moving camera I have posted this issue on stackoverflow, but unfortunately nobody couldn't find solution, maybe someone here know this.

I'm developing Side Scroll 2D Game, using AND ENGINE

http://i.imgur.com/j8oJD.png

I'm using their SVG extension (I'm using vector graphic)

But I discovered strange and ugly effect, while moving my player (while camera is chasing player exactly, means while camera is changing its position)

Images of my sprites looks just different, they are like blurred or there is effect like those images would be moving (not changing their possition, just jittery effect, really hard to explain and call this effect properly) Hopefully this image may explain it a bit:

http://i.stack.imgur.com/z02UL.jpg

Its more or less, how does it look in the game, where:

a) "FIRST" image is showing square, while player is moving (CAMERA isn't) image looks as it should

b) "SECOND" the same image, but with this strange effect "which looks like image moving/blurring during camera moving [chasing player])

Friend of mine told me that it might be hardware problem:

"the blurring that you notice is actually a hardware problem. Some phones "smooth" the content on the screen to give a nicer feel to applications. I don't know if it's the screen or the graphics processor, but it doesn't occur on my wife's Samsung Captivate. It happens on my Atrix and Xoom though. It's really noticable on the Xoom due to the large screen size."

But seems there is way to prevent it, since I have tested many similar games, where camera is chasing player, and I could not notice such effect.

Is there a way to turn this off in code?

I'm grateful for previous answers, unfortunately, still problem exist.

Till now, I have tried:

casting (int) on setCenter method which is being executed on updateChaseEntity
testing game using PNG images, instead of SVG extension and vector graphic
different TextureOptions
hardwareAcceleration

If someone have different idea, what may cause this strange effect, I would be really grateful for help - thank you.

sentences:
How can I convert my list of vertices and indices to a list of triangles? I have a full 3D collision mesh that is represented by a list of vertices and another list of indices. I need to convert the list of vertices and the list of indices into a set of triangles.

First I tried to group every three vertices from the vertex list into a triangle, so vertices 0-2 were triangle 0, vertices 3-5 were triangle 1, etc. But that method did not produce the same triangles I see on the original mesh.

Then I remembered the indices list, but I didn't know how to use them. So I came here to ask: how can I use the indices list to make my list of triangles?

sentences:
Mouse input and structure in JS I am creating a simple concept where I have a small menu to choose a tool from and then I can click and drag to build.

For example, I click on the rails tool and then I can click and move the mouse to create a rail segment.

I'm coding it something like this(missing some variables for temp values and objects):

var toolSelected = false;//if I click the rails button, it changes to 'rails'

renderer.domElement.addEventListener('mousedown', function(event){

    //here I check which is the tool selected
    if(toolSelected === 'rails'){
        //create rail object starting in event coordinates
    }

});

renderer.domElement.addEventListener('mousemove', function(event){

    //here I check which is the tool selected
    if(toolSelected === 'rails'){
        //pass the mouse movement to the rail object to update end coordinates position so I can drag and see the potential rail
    }

});

renderer.domElement.addEventListener('mouseup', function(event){

    //here I check which is the tool selected
    if(toolSelected === 'rails'){
        //indicate that the rail should be finished and build it with the mouse up coordinates
    }

});

The question is, is there a better or recommended way to structure these mouse events? Or do I have to, under each mouse event, check which tool is selected and perform the appropriate actions?

sentences:
Attempting to remove extra "edges" from truncated icosahedron lead to excessively global concequences I need a truncated icosahedron.  Blender lets me do that with add -> mesh -> math function -> regular solid (assuming the extra plugin is installed.) So far so good.  However, the mesh that is created does not use ngons.  This means that each hexagon or pentagon face is cut by an unusable edge approximately through the middle.  These extra "lines" destroy the visual symmetry I need for the wireframe.
I have tried deleting the extra edges. This results in the in the removal of far more than just the offending edge.  It blows a huge hole in the whole object. I have tried merging the two faces (which compose the pentagon or hexagon) into an ngon. Somehow this again ends up doing far more than just merge the two parts of the face.
No matter what I try I get unintended effects that are far to global. I have also considered drawing fresh lines over only the desired edges. I cannot figure out how to do this either. I have also extracted the faces and edges with python, but those are too cumbersome to edit... and then what?
How do I get a nice clean geometric wire Frame without distracting extra edges?

sentences:
How to build a better game save? I am making a roguelike card game like dream quest, and I want to improve my dungeon/level save method.

Here's what my levels look like:

I checked dream quest saves but I don't like their method because it uses a simple text file for all the information. it's also really messy, repetitive and not extendable.

I used the format below for the first couple of months:

[
  [
    "Wall",
    "Wall",
    "Room",
    "Room",
    "Room",
    "Merchant",
    "Room",
    "Room",
    "Wall",
    "Wall",
  ],
  [
    "Wall",
    "Wall",
    ...
  ]
]

But at the time I did not have multiple enemies, merchants, items. I simply read the file by using an enum which matched the strings used in the save format (item, enemy, merchant etc.) then passed them into an array to create the board.

As I started to create different kinds of enemies, items, and merchants, my current game wouldn't support this. I don't want to create an enum like enemy1, enemy2, enemy3 ...

How can I improve the scalability & legibility of this save game format, so I don't have to keep adding new enum categories for each variety of content?

sentences:
Understanding how to go from a scene to what's actually rendered to screen in OpenGL? I want something that explains step by step how, after setting up a simple scene I can go from that 'world' space, to what's finally rendered on my screen (ie, actually implement something). I need the resource to clearly show how to derive and set up both orthographic and perspective projection matrices... basically I want to thoroughly understand what's going on behind the scenes and not plug in random things without knowing what they do.

I've found lots of half explanations, presentation slides, walls of text, etc that aren't really doing much for me. I have a basic understanding of linear algebra/matrix transforms, and a rough idea of what's going on when you go from model space -> screen, but not enough to actually implement it in code.

sentences: Does it make sense for a view matrix to have a scale? When building a view matrix from an SRT matrix multiply, examples (here and here) only ever compose it with a R and T. Does it make sense to have the S component be anything other than the identity? What does it mean to scale the view matrix anyway?

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:
Getting unit to complete rotation before moving? I've been trying to get a unit in my project to move in a fashion similiar to that of modern MOBA games.

However, I am faced with the issue of the unit moving before the rotation is completed and the unit moving along the Y-axis.

I have tried using a cooroutine to allow the rotation to completed first, but to no avail.
Any help would be greatly appreciated.

using UnityEngine;
using System.Collections;

public class Move : MonoBehaviour {

    public float smooth;
    public float speed;

    private float z;
    private float x;
    private Vector3 targetPosition;

    // Use this for initialization
    void Start () {

    }

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

        if (Input.GetKeyDown(KeyCode.Mouse0))
        {

            speed = 1;
            smooth = 20;

            RaycastHit hit;

            //var playerPlane = new Plane(Vector3.up, transform.position);
            Ray ray = Camera.main.ScreenPointToRay(Input.mousePosition);

            //double hitdist = 0.0;

            if (Physics.Raycast(ray, out hit))
            {
                targetPosition = hit.point;

                x = hit.point.x;
                z = hit.point.z;
                //var targetRotation = Quaternion.LookRotation(targetPoint    - transform.position);
                //transform.rotation = targetRotation;
            }
        }

        StartCoroutine(Turn(x,z));

        //transform.position = Vector3.RotateTowards(transform.position, targetPosition, speed*Time.deltaTime, 0.0f);
        transform.position = Vector3.MoveTowards(transform.position, targetPosition, Time.deltaTime * smooth);
    }

    IEnumerator Turn(float _x, float _z)
    {
        Vector3 turn = new Vector3 (_x, 0, _z);
        transform.Rotate(turn, speed);
        yield return null;
    }
}

sentences:
Stuttering movement when approaching boundary I'm trying to limit my movement in the y-axis by checking if the position will be within the boundaries after the Translate. If it is, only then do I translate the Player.

public class Player : MonoBehaviour {

    private float speed = 5.0f;
    private float bottomY = -4.37f;

    void Start () {
        transform.position = new Vector3(0, -4, 0);
    }

    void Update () {
        Movement();
    }

    void Movement () {
        // vertical movement
        Vector3 yTranslateVector = Vector3.up * Input.GetAxis("Vertical") * speed * Time.deltaTime;
        float newYPos = (transform.position + yTranslateVector).y;
        if (newYPos > bottomY && newYPos < 0) {
            transform.Translate(yTranslateVector);
        }

        // horizontal movement
        Vector3 xTranslateVector = Vector3.right * Input.GetAxis("Horizontal") * speed * Time.deltaTime;
        transform.Translate(xTranslateVector);
    }
}

However, when I do this, the Player kind of pauses when approaching the boundary and then stutters forward towards the absolute limit upon releasing the key. I tried putting the Movement function in the Update and FixedUpdate method, but neither made any difference. Can anyone give me any insight into this?

sentences:
Do you prototype mobile touch games on the desktop with mouse input? What tricks do you use? So I've been prototyping games that if completed would be mobile apps most likely.

But, I'm developing them in XNA on the desktop because its the environment I like the most.

I know I could target windows phone and be testing the touch interface rapidly on that device but I don't own one and I imagine the build and deploy to the phone loop slows you down a bit.

Does anyone else prototype games that would eventually use a touch interface using mouse controls initially?

What tricks do you use to ensure that it will eventually translate well when you move to touch controls?

sentences:
Where to promote your indie game? Possible Duplicate:
  Where to advertise my game?

Let's say I have developed a game and I want to "get it out there".  What I have in mind is open-source, non-commercial games.

What websites do you know of where you can promote your newly developed game, rather than simply posting it on your blog?

sentences:
How do I convert a vector into a distance? I'm doing a 2D raycast where i have to pass distance. The scenario is this:

I'm using rigidbody2d.Moveposition to move my character instantly. However, before a character is moved, i want to do a raycast in that direction.
My Movement code is:

if (Input.GetKeyDown (KeyCode.D)) {
            rigidbody2D.MovePosition(rigidbody2D.position+speedx);
            return;
        }

where speedx is Vector2 Vector2(1,0) (can be increased as necessary). So when A is down, first i want to do a raycast to see if it hits any collider and then move or not move the character to that position. However, i'm not able to understand how to set the raycast distance so that it corresponds to the exact distance my character intends to move.

So, what i'm looking for is a way to corelate Vector2 and float.

sentences:
Algorithm/ Logic of identifying a circle in Go game I'm trying to create a 2 players Go-like game. Unfortunately I can't get the capturing system to act correctly. At the moment the system is half done, however I cannot think of a perfect way for it to recognize a circle correctly. This is the logic that I'm planning at the moment (let say it's currently White's turn):

1.Using the newest placed piece as the starting point, run a flood fill (Up, Down, Left, Right) code to find all the affected nodes/Black piece, and place them in a "suspects list".

2.Using the suspects list, find any White piece that is near them (Up, Down, Left, Right, UpLeft, UpRight, DownLeft, DownRight). Adds those pieces into a "circle candidate list".

3.Run through the circle candidate list and remove any piece that doesn't connect to at least 2 other candidates. Keep doing this until all candidate are connected to at least 2 other candidates or the number of candidates are less than 4 (which won't be possible to make a circle).

4.Using a recursive method checks whether we can make a circle using all the candidates. The last piece must be connected to the first one.

5.If a circle is identified, get all the nodes that are between the candidates, first checks from top-to-down then left-to-right. Records all the nodes that were identified in both checks as dead zones. Kill any Black piece inside the dead zone and any Black piece that is place inside there after this will automatically die.

Here's where the problem is, I noticed that 3 pieces that are next to each other will still be connected to 2 other piece. Which means the system will still see them as a legitimate candidate even if they aren't part of a circle. And secondly the way I use to check if there is a circle can easily fail if there are more than necessary pieces to make the circle since it could turn the wrong way and then unable to get back to the starting point.

I've been struggling with this capturing process for a week now, and tested a number of different ways. All of it will have a problem in certain scenario which resulted in a bug (either they're not capturing piece that should be captured, or capturing piece that should not be captured). So any help are greatly appreciated. Thank you.

sentences:
Resources for designing (not programming) 2D platformer mechanics I've been making a 2D platformer in Unity and it's been going great. I have the fundamentals down (and as an experienced programmer, I know how to get the results I want; this is not a programming question.)

I've been floundering, though, because I realize that I lack vision in terms of a game direction. I originally wanted to make a Metroidvania-style game, but decided to scale back as I thought that would be too ambitious (and take too long) for my first game. As such, I've decided to create a platformer/run-and-gun type game.

I've played enough platformers to know and intrinsically understand basic mechanics, but I also realize that the best games have a core mechanic that defines the game. Megaman's core mechanic, for instance, is obtaining and using boss weapons and abilities; boss battles and levels are built around this. Metal Slug revolves around weapon pickups and its tank gameplay.

I guess I'm at the point where I have a code demo....but it's not a game; it has no soul. I've basically just proven to myself that I can write a platformer game in Unity.

I want to know of any good resources on aspects of video game mechanic design not centered around programming - book recommendations would be amazing, but online resources or other types of resources would be great as well. (Worth noting that I'm not looking for guides on designing levels, but lower-level mechanics, like jump height, hp limits, core mechanics to define a game, etc.)

sentences:
What would be an efficient way to check if there is a collision in a 2d game? As part of my final project of Algorithms and Data Structures, we have to develop an open world game in C++. I already got developed most of the game, but I haven't coded the collisions with the enemies.

First, I'll explain how the game works. It's an open world game, where there are 10 regions. The world is a big map, where only a small portion of it has to be visualized in the screen . The world is 40 screens x 40 screens, where each screen is 1900 x 1080 pixels.

In this world, there are 250 000 enemies that are distributed in all the regions, so that each region has 25 000 enemies.

Besides, there is a main character that has to travel around this world doing missions, collecting items and killing enemies.

Now, my problems raises here, what is the most efficiency way to check if the main character collides with any enemy, so that when he attacks this enemy and kill him I can eliminate the enemy from the world?

In order to solve this problem, I assigned each region a list of enemies, so that the amount of enemies to validates reduces significantly. I also have a function that returns the region where the main character is.

Then, to check for collisions I do this:

for ( Number of Enemies in the Region)

  if ( MainCharacter is colliding with an Enemy and MainCharacter kills the Enemy)
     delete Enemy from the Region

I think this way is pretty inefficient since I have to validate all the enemies in the region and I just want to validate the enemies that are closer to the main character or are visible in the screen.

How should I improve the collision detection so that it's more efficient?

I hope I made my self clear and I would really appreciate any help you can provide.

sentences:
Oscillating Sprite Movement in XNA I'm working on a 2d game and am looking to make a sprite move horizontally across the screen in XNA while oscillating vertically (basically I want the movement to look like a sin wave). Currently for movement I'm using two vectors, one for speed and one for direction. My update function for sprites just contains this:

Position += direction * speed * (float)t.ElapsedGameTime.TotalSeconds;

How could I utilize this setup to create the desired movement? I'm assuming I'd call Math.Sin or Math.Cos, but I'm unsure of where to start to make this sort of thing happened. My attempt looked like this:

    public override void Update(GameTime t)
    {
        double msElapsed = t.TotalGameTime.Milliseconds;
        mDirection.Y = (float)Math.Sin(msElapsed);
        if (mDirection.Y >= 0)
            mSpeed.Y = moveSpeed;
        else
            mSpeed.Y = -moveSpeed;
        base.Update(t, mSpeed, mDirection);
    }

moveSpeed is just some constant positive integer. With this, the sprite simply just continuously moves downward until it's off screen. Can anyone give me some info on what I'm doing wrong here? I've never tried something like this so if I'm doing things completely wrong, let me know!

sentences:
Is white the best base color to start with when planning to shade sprites within Unity? I'm looking into prototyping a game in Unity which will consist of solid square sprites / tiles. I figure I can represent different types of objects with different colors for each of the tiles in the game.

I figure that I can import a single square sprite and shade it appropriately in Unity as opposed to imported squares of many different colors.

My experience with adjusting the hue and saturation within Photoshop shows that white is not an easy color to change as things that are white often stay white. My testing in Unity shows that I can change the "color" of a sprite to anything other than white and the sprite is seemingly shaded appropriately, despite what I would have thought given my Photoshop experience.

Since white objects do seem to take on the appropriate color shading when changed within Unity my gut tells me that this is the best base color to begin with, meaning that I can import a single white square sprite and simply adjust the color to represent different objects and object states.

Is a white sprite actually the best color sprite to begin with and why does something like this work in Unity as opposed to adjusting the hue and saturation within Photoshop?

sentences:
How can I access a method via a string in Unity? I myself am new to unity and I would like to know how it is possible to access a method via a string, something like this:
public string PlayerPrefsName;

public GameObject Button;

public string GadgetForSkin;

private void Start()
{
    GadgetChanged = PlayerPrefs.GetInt(PlayerPrefsName);
    if (GadgetChanged == 0)
    {
        Button.SetActive(false);
    }
    GadgetForSkin = "GadgetForSkin" + GadgetChanged;
}

public void GadgetChecker()
{
    GadgetForSkin();
}

public void GadgetForSkin1()
{

}

If it's not possible, how can I achieve something similar?

sentences:
Translate camera position toward camera orientation I have a camera position (Vec3) and camera horizontal/vertical angle. Now I want to translate my camera position toward the current camera orientation - what is the best way to do that? I am sure it's simple but the logic escapes me.

(I am using GLM math lib btw)

sentences:
Faster way to do multi texture blending(HLSL, triplanar texturing and overhang mapping) Right now I'm doing a lot of lerping to blend my textures based on height(under water, mid ground and height ground), normal.y >= 0.0 for the under side of the terrain, fractal blend map for a marble effect and then triplanar mapping for the slopes.

It looks good and runs ok and I'm getting just the right blending effect where I need but I'm just thinking that all the lerping could be bad?

I end up with this in my terrain shader:

//Find the blend value for the blend zones
float IsLowGround = saturate(max(distance(min(input.WSPosition.y, 350), 350) / 300, 0));
float IsHeighGround = saturate(max(distance(min(input.WSPosition.y, 1500), 1500) / 1250, 0));

//Find the flip value
float3 flip = saturate(float3(normal.x < 0.0, normal.y >= 0.0, normal.z < 0.0));

//triplanar
float3 blend_weights = max((abs(normal) - 0.2) * 0.5f, 0.0f);
blend_weights = pow(blend_weights,2.0f);
float total = (blend_weights.x + blend_weights.y + blend_weights.z);
blend_weights /= total;
float2 coord1 = float2(input.WSPosition.zy / 750);
float2 coord2 = float2(input.WSPosition.zx / 150);
float2 coord3 = float2(input.WSPosition.xy /700);

//Marble blend maps
float Blend = BlendMap.Sample(colorSampler, input.WSPosition.xz / 2500).r; // flat blend
float Blend2 = BlendMap.Sample(colorSampler, input.WSPosition.zy / 6000).r;   //slope blend

//Color and Normal blending

//Slope Color With Marble
Color += lerp(ColorMap.Sample(colorSampler, coord1) * blend_weights.x, ColorMap6.Sample(colorSampler, coord1 * 3) * blend_weights.x,Blend2);
Color += lerp(ColorMap2.Sample(colorSampler, coord3) * blend_weights.z, ColorMap6.Sample(colorSampler, coord3 * 3) * blend_weights.z, Blend2);

//Slope Normal with marble
NormalM += lerp(NormalMap.Sample(colorSampler, coord1).rgb * blend_weights.x, NormalMap6.Sample(colorSampler, coord1 * 3).rgb * blend_weights.x, Blend2);
NormalM += lerp(NormalMap2.Sample(colorSampler, coord3).rgb * blend_weights.z, NormalMap6.Sample(colorSampler, coord3 * 3).rgb * blend_weights.z, Blend2);

//Height based Color Blending with marble eg. (mid -> height) -> marble
float4 GroundColor = lerp(lerp(ColorMap5.Sample(colorSampler, coord2 / 1.5) * blend_weights.y, ColorMap1.Sample(colorSampler, coord2) * blend_weights.y, IsHeighGround), ColorMap7.Sample(colorSampler, coord2) * blend_weights.y, Blend);

 //Height based Normal Blending with marble eg. (mid -> height) -> marble
float3 GroundNormal = lerp(lerp(NormalMap5.Sample(colorSampler, coord2 / 1.5).rgb * blend_weights.y, NormalMap1.Sample(colorSampler, coord2).rgb * blend_weights.y, IsHeighGround), NormalMap7.Sample(colorSampler, coord2).rgb * blend_weights.y, Blend);

 //Last Color Blending with underside flip eg. (underwater -> Ground) -> flip
Color += lerp(ColorMap4.Sample(colorSampler, coord2 / 2) * blend_weights.y, lerp(GroundColor, ColorMap3.Sample(colorSampler, coord2 * 1.2) * blend_weights.y, IsLowGround), flip.y);

 //Last Normal Blending with underside flip eg. (underwater -> Ground) -> flip
NormalM += lerp(NormalMap4.Sample(colorSampler, coord2 / 2).rgb * blend_weights.y, lerp(GroundNormal, NormalMap3.Sample(colorSampler, coord2 * 1.2).rgb * blend_weights.y, IsLowGround), flip.y);

Here is what it looks like when rendered:

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:
How do C# and UnityScript differ in Unity development? Other than the obvious language differences, how do UnityScript and C# differ when developing games in Unity3D?

Is there a noticable performance difference?
Is the UnityScript code packaged as-is? If yes, does this help the game's moddability?
Is it possible to use libraries developed for one language while developing in the other one?
Can the two languages be mixed in the same Unity project; coding some parts in C# and others in UnityScript?

sentences:
LibGDX: Do I have to dispose a texture if I load it from AssetManager? AssetManager manager = new AssetManager();

manager.load("texture1", Texture.class);
manager.load("texture2", Texture.class);
manager.load("texture3", Texture.class);
//And so on...

And then I load it from another screen, do I still have to dispose it? Or manager does it when I call manager.clear?

sentences:
way to implement a menu -pratical i do my first game and already read alot about design strategie, programming style, design .. and so on
theoretically it works perfect but in practice i dont know if i do thinks "right"

i have three classes my main which starts the view
in this i do all my stuff -currently-

it holds an state variable, it has an onDraw method .. and so on

the third class is the game-thread while my game is running, in here are decisions -depending on my current state- what should be done

@Override
public void run() {
    Canvas canvas = null;
    mStartTime = System.currentTimeMillis();
    while (mRun) {
        canvas = mHolder.lockCanvas();
        if (canvas != null) {

            // State Updating State means to manage state transitions, such as a game over, character select or next level.

            switch( mPanel.getModeState() ){
                case Surface.MODE_LOGO_SPLASH :
                break;

                case Surface.MODE_MENU :
                    // the menu

                break;
                case Surface.MODE_LOADING :
                    // loading animation

                break;
                case Surface.MODE_GAME_PLAYING :
                    // game stuff
                                            // GAME START _ RUNNING _ END

                    // Input
                    // AI
                    // Physics

                    // animation
                    //mPanel.animate(mElapsed);
                break;
            }

            // draw everyThing
            mPanel.doDraw(mElapsed, canvas);
            // sound
            // Sound and Video.
            mElapsed = System.currentTimeMillis() - mStartTime;
            mHolder.unlockCanvasAndPost(canvas);
        }
        mStartTime = System.currentTimeMillis();
    }
}

my problem is .. the function onDraw draws everything .. including the menu ?
this sounds for me like bad code because everytime doDraw is executet, i have to check in this function which state i am currently in .. this cost time, dosent it ?

public void doDraw(long elapsed, Canvas canvas) {
    canvas.drawColor(Color.BLACK);

        // currently just gameLayout
        canvas.drawBitmap(background, 0, 0, mPaint);
    gameLayout.draw(canvas);

}

would it not be better do implement an other thread which draws the menu ?
but if so, how can i overlay the menu afer pause the game ?

:\
thanks for help
erwin

sentences:
Parameter "MoveX" (and "MoveY") does not exist using System.Collections;
using System.Collections.Generic;
using UnityEngine;

public class PlayerMovement : MonoBehaviour {

    public float moveSpeed;

    public Animator anim;

// Use this for initialization
void Start () {
    anim = GetComponent<Animator>();
}

// Update is called once per frame
void Update () {
    if (Input.GetAxisRaw ("Horizontal") > 0.5f ||
        Input.GetAxisRaw("Horizontal") < - 0.5f) {
            transform.Translate (new Vector3
        (Input.GetAxisRaw("Horizontal") * moveSpeed * Time.deltaTime, 0f, 0f));
        }

        if (Input.GetAxisRaw ("Vertical") > 0.5f || Input.GetAxisRaw ("Vertical") < -0.5f) {
            transform.Translate (new Vector3 (0f, Input.GetAxisRaw ("Vertical") * moveSpeed * Time.deltaTime, 0f));
        }

        anim.SetFloat("MoxeX", Input.GetAxisRaw ("Horizontal"));
        anim.SetFloat("MoxeY", Input.GetAxisRaw ("Vertical"));

        }
    }

I an trying to run this with a basic 2D animation in unity personal and I keep getting Warning! -
Parameter "MoveX" does not exist
and Parameter "MoveY" does not exist
but it is clearly in the animator as a float.

sentences:
What technologies are used to develop games for tablets and iPhones? What technologies are used to develop games for tablets and iPhones?
Would Flash be commonly used?
Is HTML5 capable of animation and interactivity, or would a game file simply be placed within HTML5 code?
Is Flash and HTML5, and then wrapping the game for different phone/tablet operating systems a common combination?

sentences:
How to setup a client to work with a remote server or a local included server? I'm working on a Networked multiplayer game, but while developing and for testing I want to set up a local server that acts like the multiplayer server.

My thought is to approach the server as a proxy setup. Creating a class that the client sees and essentially allowing it to either load the server code in itself or to use a networking layer.

Is this a good approach? Are there other approaches to look into?
What pitfalls should I be watching for?

Update

A bit more specifically I need to do this because I am targeting the Ouya and I can't guarantee a network connection, or even a spare machine to run the server on. And inside Android it is more difficult to setup and launch a service rather than include my server code right into a client build.

sentences:
How can I create a tile set that will allow me to render a soccer pitch in perspective? I am making a soccer game that needs a large pitch image (the whole play field area is about 3300 * 1200 pixels).

I know I should use the Tiled map editor to create a tile map so that I can create the whole soccer pitch by using just a few tiles, but I'm not sure how I can create a tile set that will allow me to create good-looking fields like in these games:

As you can see, the soccer pitch is not a rectangle but more of a trapezoid, so it changes the way we draw border and grass stripes. The grass stripes are sloping, and the slope changes the closer they are to the goal. That makes it very hard to replicate in a limited amount of tiles.

Currently, I have 3 layers for my field. Each tile is 64 * 64 in size, and I create them this way:

The border tiles. Since the border is not repeating, I take the border, cut it up into tiles, and add them to the tile set. It's fussy, but it seems this is the only way.
Light colored grass. I have a single, repeating 64 * 64 tile that is used to cover the base layer of the field.
Deep colored, sloping stripe grass. This is the one I can't figure out how to create.

How can I create that last set of tiles or otherwise achieve my effect?

sentences:
How do I get realistic sliding contact between objects in a voxel grid? I have a 3D grid of voxels in my game. Entities walk around with simple physics that represents them as an axis aligned bounding box with velocity, mass and acceleration. The way I'm doing collision resolution is fairly simple. Here's some pseudocode:

function ResolveCollisions()
    // For each voxel that could intersect the bounding box...
    foreach (Voxel neighbor in VoxelGrid.GetVoxelsIntersecting(this.bounds))
        // Check a collision between the voxel and the bounding box
        if (neighbor.Collides(this.bounds))
            ResolveCollision(neighbor, bounds);

function ResolveCollision(Voxel neighbor, BoundingBox bounds)
     // Compute the contact normal and penetration distance between the two
     // boxes.
     [Vector3 norm, float dist] = ComputeMinPenetration(neighbor, bounds);
     // Snap the position so its no longer colliding
     this.position += norm * dist;
     // Reflect the velocity over the normal to perform an elastic collision.
     this.velocity = this.Restitution * Vector3.Reflect(this.velocity, norm);

This works pretty well for instantaneous collisions and bouncing, but fails for sliding contact. If an entity is sliding across a flat plane of voxels, for instance, it will rapidly bounce, and will sometimes end up colliding with the sides of the voxels instead of the top.

How do I get realistic sliding contact between the bounding box and a voxel grid, without bouncing or "toe stubbing?"

sentences:
Cant set up ANDENGINE GLES2-AnchorCenter Examples & Extensions I am trying to setup the GLES2-AnchorCenter in my eclipse
Downloaded andengine , extension and examples listed in Anchor center branch .But not yet succed .

Andengine examples missing an extension named

  andengine cocosbuilder extension CC Rotating Sprite extension

But i am not able to find it anywhere.If i am missing the extension please give me a link to get the extension.

In extensions Multitouch extension shows some error with import statement

import org.anddev.andengine.util.SystemUtils;

Actually i am not able to find org.anddev package it self in andegine,

in andengine scripting extensuion it shows error with the statement

import org.andengine.util.color.Color;
What are the things I am missing.
Do i need to install all thse extensions to get the eample get working?

Please Help me ..........

sentences:
How can I use Cross Platform Input in Unity 2019? I am trying to use CrossPlatformInput in Unity 2019 to follow this tutorial to use it on iOS:

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

However, I have no item in the top bar for "Mobile View" like in the tutorial, and I do not know how to enable it. I have Standard Assets imported already. Is there an example project I can download with CrossPlatformInoput that works with iOS or a way for CrossPlatfromInput to work in modern versions of Unity?

sentences:
LibGDX multiple enemies animations Hello everyone i have a question about animating multiple enemies on the screen at the same time.

Basically, i figured out how to use the Pool for creating enemies and dispose them after use etc..
All enemies are equal to each other, and all enemies have 3 different animations for creating, moving, destroying.

Everything is working fine, but when i have multiple enemies on screen, they are all animating at the same times, even if they were (obviously) created in different times.

For example, i create 3 enemies, make them moving on the screen and they all have the same frame.. the animation must be the same for all, but i expected that the time when they change frame should be different.

The animations are instantiated inside the Enemy class, so i guess every instance of Enemy must have its own animation.

This is how i draw them in the Renderer class:

private void drawEnemies(float runTime) {
    enemyArrayLen = catta.activeEnemies.size;
    for (int i = enemyArrayLen; --i >= 0;) {
        currentEnemyAnimation = catta.activeEnemies.get(i).getCurrentAnimation();
        batcher.draw(
            currentEnemyAnimation.getKeyFrame(runTime),
            catta.activeEnemies.get(i).getX(),
            catta.activeEnemies.get(i).getY(),
            catta.activeEnemies.get(i).getWidth() / 2.0f,
            catta.activeEnemies.get(i).getHeight() / 2.0f,
            catta.activeEnemies.get(i).getWidth(),
            catta.activeEnemies.get(i).getHeight(),
            1,
            1,
            0
        );
    }
}

Enemies are stored in the catta.activeEnemies array.

currentEnemyAnimation is a "support" variable in which i put the Enemy in every cicle of the for cicle.

This is how i initialize an Enemy:

public void init(float posX, float posY, int width, int height) {
    this.position.set(posX,  posY);
    this.width = width;
    this.height = height;
    this.alive = true;
    this.enemyRunTime = 0;
    this.creationTime = 0.8f;
    this.destructionTime = 0.8f;
    this.crea_Animation = AssetLoader.enemy_creaAnimation;
    this.crea_Animation.setFrameDuration(this.creationTime / 4);
    this.mo_Animation = AssetLoader.enemy_moAnimation;
    this.des_Animation = AssetLoader.enemy_desAnimation;
    this.des_Animation.setFrameDuration(this.destructionTime / 4);
    this.enemyState = EnemyState.CREATING;
    ...

Maybe it's all a runTime and delta matter?

sentences:
Algorithm for querying linearly through a non-linear list of questions For a multiplayers trivia game, I need to supply my users with a new quizz in a desired subject (Science, Maths, Litt. and such) at the start of every game.

I've generated about 5K quizzes for each subject and filled my database with them. So my 'Quizzes' database looks like this:

|ID   |Subject     |Question
+-----+------------+----------------------------------
|  23 |Science     | What's water?
|  42 |Maths       | What's 2+2?
|  99 |Litt.       | Who wrote "Pride and Prejudice"?
| 123 |Litt.       | Who wrote "On The Road"?
| 146 |Maths       | What's 2*2?
| 599 |Science     | You know what's cool?
|1042 |Maths       | What's the Fibonacci Sequence?
|1056 |Maths       | What's 42?
And so on... (Much more detailed/complex but I'll keep the exemple simple)

As you can see, due to technical constraints (MongoDB), my IDs are not linear but I can use them as an increasing suite.

So far, my algorithm to ensure two users get a new quizz when they play together is the following:

// Take the last played quizzes by P1 and P2
var q_one = player_one.getLastPlayedQuizz('Maths');
var q_two = player_two.getLastPlayedQuizz('Maths');

// If both of them never played in the subject, return first quizz in the list
if ((q_one == NULL) && (q_two == NULL))
  return QuizzDB.findOne({subject: 'Maths'});

// If one of them never played, play the next quizz for the other player
// This quizz is found by asking for the first quizz in the desired subject where
// the ID is greater than the last played quizz's ID (if the last played quizz ID
// is 42, this will return 146 following the above example database)
if (q_one == NULL)
   return QuizzDB.findOne({subject: 'Maths', ID > q_two});
if (q_two == NULL)
   return QuizzDB.findOne({subject: 'Maths', ID > q_one});

// And if both of them have a lastPlayedQuizz, we return the next quizz for the
// player whose lastPlayedQuizz got the higher ID
if (q_one > q_two)
   return QuizzDB.findOne({subject: 'Maths', ID > q_one});
else
   return QuizzDB.findOne({subject: 'Maths', ID > q_two});

Now here comes the real problem:

Once I get to the end of my database (let's say, P1's last played quizz in 'Maths' is 1056, P2's is 146 and P3 is 1042), following my algorithm, P1's ID is the highest so I ask for the next question in 'Maths' where ID is superior to 1056. There is nothing, so I roll back to the beginning of my quizz list (with a random skipper to avoid having the first question always show up). P1 and P2's last played will then be 42 and they will start fresh from the beginning of the list. However, if P1 (42) plays against P3 (1042), the resulting ID will be 1056...which P1 already played two games ago.

Basically, players who just "rolled back" to the beginning of the list will be brought back to the end of the list by players who still haven't rolled back. The rollback WILL happen in the end, but it'll take time and there'll be a "bottleneck" at the beginning and at the end.

Thus my question: What would be the best algorith to avoid this bottleneck and ensure players don't get stuck endlessly on the same quizzes?

Also bear in mind that I've got some technical constraints:

I can't get a random question in a subject (ie: no "QuizzDB.findOne({subject: 'Maths'}).skip(random());"). It's cool to skip on one to twenty records, but the MongoDB documentation warns against skipping too many documents.
I would like to avoid building an array of every quizz played by each player and find the next non-played in the database with a $nin.

Thanks for your help

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:
How can I create "events" that are called in scripts without requiring subscriptions? I am creating an editor extension that includes an API for developers to use. It also includes events like (for example) "OnHealthChanged."

The problem is that events I have stumbled upon would require a user to subscribe to them, which is not what I actually want. I want developers simply type in the event handler in their script, and it would just work.

For example, I want a programmer to write a function "OnHealthChanged" in their own script. When the health changes, their code runs.

void OnHealthChanged()
{
    //code that is going to run when health changes
}

Any idea where can I look?

I want to create something like "OnCollisionEnter()" event in Unity, which runs code every time a game object collides with another game object.

Hope it makes sense.

sentences:
Behavior Trees :: Actions That Take Longer Than One Tick From what I understand on Behavior Trees, each Behavior should be a short goal oriented Action that could be done in a few iterations.

So for example, below is an image of a Behavior Tree:

Now let us assume that the Drive To Enemy behavior takes more than a few iterations in the tree.  So on each pass Drive To Enemy is called because it is now in the running state.

The problem is I want to call Evade Enemy if an Enemy is nearby.  And considering that Drive To Enemy is always called I never get a chance to call Evade Enemy (Should probably be called Avoid Enemy).

Should I traverse the Tree EACH pass no matter what Action is currently running?
Am I going about this the right way?
What is the proper way of handling such a behavior?

Originally asked on Stackoverflow. Thought here would be a more appropriate place to ask this question.

sentences:
Fast self collision/intersection detection algorithm for tetrahedral meshes I want to play with deformation of tetrahedral mesh (soft-body simulation) but I need help with self-collision detection stuff.
I found SOFA collision detection but I'm not sure that it fits for self-intersection of a tetrahedral mesh.
Can anyone suggest me good algorithm for self-collision detection? As far as I can understand, something like BVH of tetrahedra can help me, but it would be great if somebody with expertise shows me right direction.

sentences:
Literature for Inverse Kinematics: Joint Limits and beyond Recently I've been playing around with Inverse Kinematics and have been pretty impressed with the results. Naturally I want to take it further, but have no clue where to start. In particular, I would like to introduce joint limits (ie for a prismatic joint how far it can move, hinge joint what angles it has to be between, etc etc).

Currently I understand how to produce the Jacobian matrix for the various joint types. I am particularly looking for literature (preferably free, and preferably easy to understand) on various ways to implement joint limits. Also I would like to find out different ideas on how inverse kinematics can be used.

sentences:
Efficient systems in an Entity Component System I'm designing a simple Arcanoid game with ECS.

With ECS there are many systems that only update components once in a while. For example, Particle systems are animated sprites that can be used for collision effects or explosions. These kind of effects happen rarely.

ParticleSystem will only update ParticleComponent when they exist, which happens rarely, just on collisions, etc. The rest of the time it's polling to find entities with ParticleComponent.

Isn't this polling inefficient? If I have many more functions similar to the ParticleSystem, that only do work rarely, the update will be clogged with systems that do not update anything. Would it be good practice to "sleep" the system until an entity is assigned to the ParticleComponent?

For example (using EntityX):

class ParticleComponent : Component<ParticleComponent>
{
public:
    ParticleComponent(ParticleId id) : id(id), time(0.0){};

    ParticleId id;
    double time;
};

class ParticleSystem : System<ParticleSystem>
{
public:
    void update(EntityManager & entities, EventManager & events, TimeDelta dt)
    {
        // this list will be empty if there are no entities.. but there is still a search
        entities.each<ParticleComponent>([](Entity & entity, ParticleComponent & particle)
        {
            // update current animation time
            particle.time += dt;
        });
    }
};

class Game : public EntityX
{
public:
    Game()
    {
        systems.add<ParticleSystem>();
        systems.configure();
    }

    void update(TimeDelta dt)
    {
        // this is only useful when there are entities with ParticleComponents
        systems.update<ParticleSystem>(dt);
    }

    void onRareEvent()
    {
        auto entity = entities.create();
        entity.assign<PositionComponent>();
        entity.assign<ParticleComponent>(FIRE_PARTICLE);
        // destroy in 3 seconds
        timer.schedule(3, Game::destroyEntity, entity);
    }

    //void render()...
}

sentences:
How can I do a Metroid like transition between two tilemaps with Monogame Extended? I want to do a transition like those in the Metroid games. Here is an example of what i mean: https://www.youtube.com/watch?v=RKJ3MAi0ZI0.
You enter the door, the screen fades to black and the camera scrolls to the next room where the screen fades in again.

I'm using Monogame Extended and i have a TiledMap. I use them like described in the documentation. I have a camera with a view matrix and a projection matrix

   Camera2D camera;

   ...

   public void DrawGame(GameTime gameTime, SpriteBatch spriteBatch)
   {
        var viewMatrix = camera.GetViewMatrix();
        var projectionMatrix = Matrix.CreateOrthographicOffCenter(0, gDevice.Viewport.Width, gDevice.Viewport.Height, 0, 0f, -1f);

        tiledMap.Draw(viewMatrix, projectionMatrix);
   }

My idea is now to create a second tiledMap to placing them directly next to the first one where the transition occurs. Then i just have to move the camera from one map to the next one. My problem now is that i have no clue how to put them next to each other. From my understanding i somehow have to use the view and projection matrix to draw the tiledMap but i can't figure out how it should work with two tiledMaps.

sentences:
Rigged blender model is deformed when imported into Unity I am facing a strange problem with a model I rigged in Blender. Everything in Blender seems fine:

All scales and rotations are normalized

There is no unassigned vertex

There is no weight bleeding from other bones

However when I imported the model in Unity, I am faced with some distortion happening  in some of the model's meshes (it is a composite model).

Note that this doesn't seem to be happening for all bones or mesh components, but only for a couple of them.
Does anyone have any clue about why this is happening?
Thank you!

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:
Matrix multiplication order for multiple model transformations I have a problem in terms of what frame of reference, I should construct, scaling (S), rotation (R) and translation (T) for a model matrix (in that order). Let us assume the use of glm (or glsl), i.e. to mean column major representation.

I believe, it should be a matrix multiplication of:

M = T * R * S // S * R * T is what we want to apply, but due to being column major, the order gets reversed, due to (AB)^T =B^T*A^T

Now, if I have a previous transformation already applied (say M_prev), and I want to apply a transformation M on top of that, then is the correct form:

M_new = M_prev * M // M_new and M_prev are both column major. I'm post multiplying due to being column major, but this is incorrect, I guess?

I believe this is incorrect (at least in some experiments I carried out, please correct me if I'm wrong), and it should be the reverse. What is the flaw in my calculation of M_new?

sentences:
Component / Entity-based design => no inheritance at all? [I understand that this this could be seen as a rather theoretical question, but I think it has real-application impact].

"Academic" base
With a component-based design one wants to get rid of the long inheritance chains known in larger games ("deadly diamond of death"). So we create a BaseComponent class that handles all the administrative chores (ID and type handling, possibly a generic list of properties, ...).

Now each actual Componentshould inherit from that base [start of academic/dogmatic flair] and only that base [end].

Concrete situation/example:
Assume I have three components with different attributes:

Person: age, name, gender, isTired, isSick, ...
Guest: satisfaction, desires, ...
Employee: current duty, shift end, ...

Now in traditional OOP design, Person would act as the base class for the other two. As I currently "forbid" that type of inheritance for the components in my project, everytime I am e.g. processing my employees and checking/updating their state attributes I have to either use some helper function to access the sibling component Person (if it exists) or send a message out that hopefully Person will be registered for and will process. Or I can simply assume that each Guest and Employee always will have the component Person. But then I might as well let those two components inherit from Person, so they for example both have the member functions to manipulate some specific properties.

Note: There will never be an Entity that has the component Employee, but not component Person (same applies to Guest). They are a fix requirement, which is why I am considering inheritance here at all.

Question:
My question is now whether anyone can see any real-life problems that would be introduced by (re-)incorporating a bit of inheritance into my components other than to a degree violating the original base/dogmatic concept and the risk that (if used excessively) I would end up with the exact same problem the component-based design tried to solve in the first place?

References:
Thread that ultimately led my to asking that question, showing such inheritance.

sentences:
SFML - Moving a sprite on mouseclick I want to be able to move a sprite from a current location to another based upon where the user clicks in the window. This is the code that I have:

#include <SFML/Graphics.hpp>

int main()
{
    // Create the main window
    sf::RenderWindow App(sf::VideoMode(800, 600), "SFML window");

    // Load a sprite to display
    sf::Texture Image;
    if (!Image.LoadFromFile("cb.bmp"))
        return EXIT_FAILURE;
    sf::Sprite Sprite(Image);

    // Define the spead of the sprite
    float spriteSpeed = 200.f;

    // Start the game loop
    while (App.IsOpened())
    {
        if (sf::Keyboard::IsKeyPressed(sf::Keyboard::Escape))
            App.Close();

        if (sf::Mouse::IsButtonPressed(sf::Mouse::Right)) {
            Sprite.SetPosition(sf::Mouse::GetPosition(App).x, sf::Mouse::GetPosition(App).y);
        }

        // Clear screen
        App.Clear();

        // Draw the sprite
        App.Draw(Sprite);

        // Update the window
        App.Display();
    }

    return EXIT_SUCCESS;
}

But instead of just setting the position I want to use Sprite.Move() and gradually move the sprite from one position to another. The question is how? Later I plan on adding a node system into each map so I can use Dijkstra's algorithm, but I'll still need this for moving between nodes.

sentences:
Unity gravity not effecting everyone like it should so My problem is a bit weird. I have a model that will not fall at the correct speed. She falls incredibly slowly. This is the only script attached to her, and I did the "Scale to large" test by placing a box next to her and letting them drop at the same time. The box fell instantly to the ground and she just kind floats taking her time.

Gravity is on kinematic is off, I'm out of ideas and could use some help. :D!

Thank you.

This is unity in c#.

using UnityEngine;

using System.Collections;

public class PlayerController : MonoBehaviour {

// public variables
public float speed = 1.5f;
public float JumpH = 1.5f;
public float RotateSpeed = 30f;

//pivate component checks
private Animator animr;
private Rigidbody LillyRB;

//private generic bits.
private bool checker;
private float movever;
private float movehor;
private float turn;

void Start (){
    LillyRB = GetComponent<Rigidbody> ();
    animr = GetComponent<Animator> ();

}

void FixedUpdate () {

    // movevertical and move horizontal check for player input wasd
    // jump checks for jump/spacebar.

    movever = Input.GetAxisRaw ("Vertical");
    movehor = Input.GetAxisRaw ("Horizontal");
    turn = Input.GetAxisRaw ("mouse x");
    Quaternion rot = LillyRB.rotation;

    Quaternion Exturn = Quaternion.Euler (0.0f, RotateSpeed * Time.deltaTime *  turn + rot.eulerAngles.y, 0.0f);

    if (movehor != 0 || movever != 0) {
        checker = true;
    }
    else {
        checker = false;
    }

    animr.SetBool ("IsMoving", checker);
    LillyRB.MoveRotation (Exturn);
    LillyRB.MovePosition (LillyRB.position + (transform.forward * movever));
    LillyRB.MovePosition (LillyRB.position + (transform.right * movehor));

}

}

sentences:
Problem with camera deapth culling only option and objects in front of each other I have a prefab with 2 cameras. the 1st is rendering the world, the 2nd one all the suff in front of the 1st person characters "face". Now i have a problem with a gun using a muzzleflash - both on the deapth only camera. The muzzleflash is on the very front tip of the gun and i assume because the 2nd face camera is set to "deapth only" it causes the muzzleflash to be off place. I came up with 3 ideas

1: changing the layer of the muzzleflash to world for some frames everytime a muzzleflash appears

2: having a 3rd camera rendering the muzzleflash only

3: adjusting the gun on the face camera, the muzzleflash on the world camera

I assume the 1st two options have a huge overload, i prefer the 3rd one. But is it a good way to do it? How should i proceed in this situation? Or how do others?

I also have animations so it can appear on 2 positions, normal and scoped.

Edit Here is an image i added Debug.Break() as it was instantiated, its totally correct aligned.

sentences:
Why does Forge not find my texture for my custom background? I am creating a minecraft mod that improves the main menu for my minecraft server. At first I wanted to create the background, but somehow when I try to start minecraft it closes and I get a nullpointerexception because minecraft didn't find my background.

public class ThundrialMenu extends GuiScreen {

    @Override
    public void initGui() {

    }

    @Override
    public void drawScreen(int mouseX, int mouseY, float partialTicks) {
        Random rnd = new Random();
        int background = rnd.nextInt(3)+1;
        String backgroundLocation = "/assets/thundrial/gui/Background"+background+".png";
        this.drawBackground(mc.renderEngine.getTexture(new ResourceLocation(backgroundLocation)).getGlTextureId());
        super.drawScreen(mouseX, mouseY, partialTicks);
    }

    @Override
    public void updateScreen() {
        super.updateScreen();
    }
}

This is the folder where the pictures are located:

Why does Minecraft not find those pictures?

sentences:
How to get the 2d field of view using dot or atan2? I tried to implement from this site linear-algebra on how do I check the field of view using dot product. But when I check the angle to the given fov angle, I am not getting the desired result. Instead of getting the field of view of 45 degree, I am getting 90 degree. What am I doing wrong?

Vector2 start = Mapper.transform.get(owner).position;
Vector2 end = Mapper.transform.get(target).position;
float facingAngleRad = 0;
Vector2 ownerOrientation =
   new Vector2((float)Math.cos(facingAngleRad), (float) Math.sin(ficingAngleRad));
Vector2 targetOffset = tmp1.set(end).sub(start);

float product = ownerOrientation.nor().dot(targetOffset.nor());
float checkAngle = (float) Math.acos(product);
float FIELD_OF_VIEW_ANGLE = 45 * MathUtils.degeeToRadians;
if(checkAngle < FIELD_OF_VIEW_ANGLE) {
    // in the field of view
}

In the below image, green is the desired field of view (45 degree), but I'm getting 90 degree (red)

sentences:
How do you triangulate a 3D point from a pair of stereo images? I'm working with a stereo pair of photos, and trying to obtain a set of 3D points from matching points on these 2 images. How exactly is the point triangulated? Do you throw a ray from the camera pinhole centerpoint? Or do you throw a ray perpendicular to the photos?

Edit: I'm also looking for code examples, that document the simple linear/polynomial math involved. Currently I'm simply using 3D line/line intersections to find the point. (actually line/plane intersections) I'm sure this is not accurate and the calibration data of the camera should also be used. Although I don't know how. For instance, with the points on the photos known, should I be drawing the 3D line from the camera pinhole 'origin', or is there a better way? Should I be taking the lens distort into account, or something fancier? The calibration data I have is as follows:

ix, iy -- Image sensor width and height, i.e. the dimensions of the photograph.
fx, fy -- Focal length in x- and y-dimensions measured in pixels.
cx, cy -- Principal point coordinates, i.e. coordinates of lens optical axis interception with sensor plane.
skew -- Skew transformation coefficient.
k1, k2, k3 -- Radial distortion coefficients.
p1, p2 -- Tangential distortion coefficients.

sentences:
Are there tutorials which teach you to paint textures for 3d model UV maps in photoshop? Are there tutorials out there which show how to paint textures for models in photoshop with their UV maps? I already have 4 years experience with modeling in 3ds max and I'm dying to learn how to paint textures for my models. U have photoshop with me but the problem is i don't know how to start or how my textures should look like.

For example this is a model that I'd like to practice painting textures for but it is too bland:

I'm currently using plain 3ds max mental ray materials for it right now but it just looks too bland and plain and I'd like to make more stylised like the following:

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:
How to make an illusion where the contents of a 3D shape change based on which face you look through? I remember coming across a Unity 3D tutorial where there was a technique where the contents of a 3D shape change based on which face you are looking at, similar to this screenshot from Antichamber:

What is this techique called? And how do I implement it into a Unity 3D project?
Thanks in advance.

sentences:
Game Maker: Studio - Make objects avoid other instances of same object with A* pathfinding I have a game where there are multiple enemies who must chase a single player.  I have pathfinding set up using the GML A* pathfinding with mp_grid and a path.  However, these enemies can walk on top of each other when seeking the player.  To fix this, I also told the path to ignore enemies as well with mp_grid_add_instances, but then they stop moving altogether because they see themselves as obstacles, thus trapping themselves within a bounding box.  Is there a way I can add "all other enemies BUT self" with mp_grid_add_instances?

Here's my grid creation code (in a CONTROLS class for initializing variables):

global.zombie_ai_grid = mp_grid_create(0, 0, room_width / 50, (room_height - sp_dashboard.sprite_height) / 50, 50, 50);
mp_grid_add_instances(global.zombie_ai_grid, obj_obstacle, false);

This is my path initialization code (in Zombie class):

path = path_add();
alarm[0] = 5;

This is my path creation code in Alarm 0 (path updates every 2 seconds):

mp_grid_path(global.zombie_ai_grid, path, x, y, nearest.x, nearest.y, true);
path_set_kind(path, 1);
path_set_precision(path, 8);

path_end();
path_start(path, MAX_SPEED, 0, true);

alarm[0] = room_speed * 2;

sentences:
Unity: Change Text with Time (Text Flashes) I am trying to display instructions within the Unity game. The idea is to have the instructions appear over time. For example, "instruction 1" then wait 5 seconds and show "instruction 2" instead of instruction 1 (on the same spot, in this case, I am changing the "message" variable in the code to change the instructions). This code does change the instructions but the problem is that it does it in a haphazard fashion. It appears that "instruction 1" is replaced with "instruction 2" and then it reverts back to "instruction 1" within a second and then back to "instruction 2" so instead of just 1-appearing->1-disappearing->2-appearing->etc in a smooth fashion, it does this weird flashing thing before proceeding to the next instruction. How could I fix this?

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

public class Growing : MonoBehaviour {

    public Text instructions;
    public string message;

    void Start () {
         instructions.text = message;
    }

    void Update () {

         Instructions();

         //other code to begin moving a game object
    }

    IEnumerator Instructions() {
        //run instructions
        message = "GET READY FOR YOUR FOCUSED BREATHING EXERCISE";
        yield return new WaitForSecondsRealtime(5);
        message = "MAKE SURE YOUR BODY IS COMFORTABLE";
        yield return new WaitForSecondsRealtime(5);
    }

sentences:
Recognizing runes drawn by user I want to implement a system where the player can draw runes on the screen with multiple gestures. Meaning its not just one motion it can be up to 3. So far I have implemented the $P Recognizer . In the example it works great and is exactly what I want. But its made with .Net 4.0 and the dll does not work with unity. I eventually managed to get it working by compiling down to 3.5. The problem is that  the integration in unity does not work well at all. It recognizes the shape but when I draw wrong symbols it recognizes them as well. I'm completely lost as how to proceed fixing this. Here is my code that handles the integration.

if (Input.GetMouseButtonDown(0))
        {
            clone = Instantiate(trailHolderPrefab, transform.position, Quaternion.identity) as GameObject;
            clone.transform.SetParent(transform);
            i++;
        }
        if (Input.GetMouseButton(0))
        {

            points.Add(new Point(Input.mousePosition.x, Input.mousePosition.y, i));

            Ray r = Camera.main.ScreenPointToRay(Input.mousePosition);
            Vector3 pos = r.GetPoint(_distance);
            transform.position = pos;
        }
        if(Input.GetMouseButtonUp(0))
        {

            if(i>=3)
            {
                i = 0;
                Point[] _points = points.ToArray();
                Gesture candidate = new Gesture(_points);
                string gestureCLass = PointCloudRecognizer.Classify(candidate, trainingSet);
                spellname.text = gestureCLass;
            }
            clone.transform.parent = null;
            clone.GetComponent<TrailRenderer>().autodestruct = true;

          // GestureXML.GestureIO.WriteGesture(_points, "Triangle",Application.persistentDataPath+"test"+i.ToString()+".xml");
        }

sentences:
Where do I have to put actions when the game state changes I’ve just started to learn Unreal Engine implementing a clone version of Atari’s Pong game.
I’m thinking about where to put the code to change the state of the game. I have an enum in the GameState class to manage when the game hasn’t started, or when we are playing the game. In case when someone scores I decided that I have to stop the ball and move it to its initial position.
My problem comes here because I don’t know where to put the code to do that: on GameMode class or on GameState class.
Where do I have to put that code?

sentences:
Which is better: More puzzle apps in Store or more puzzle levels in a single app The Question: Given a freemium model (ad-supported with in-app-purchase of additional levels/hints)... are chances of overall success better with a single puzzle app with lots (but varied) levels/playing-styles, OR... multiple apps, each app focused on a singular theme/playing-style?

Scenario: Our puzzle engine can support multiple types of puzzles based on the puzzle-piece styles. While the game mechanics are roughly the same, changing the puzzle piece changes the visual aesthetic of the app and gameplay somewhat. The puzzle piece imparts a theme of sorts to the puzzle. Sorry for the lack of further specifics.

I feel that multiple apps will allow us to market the different content more easily. I worry though that spreading the content over say, 4 different apps might limit the playing life of each individual app (the app content is mathematically limited). At which point you hope that cross-promotion will guide your player to the additional app/content.

Are there any precedents here? I've assumed that with the freemium model having more apps in the pipeline is always a good thing. But having your 4 apps on a single player's device sounds challenging.

sentences:
Worker threads are not being utilized in Time rewind system, is this job system really multi-threaded? I am trying to make a simple time rewind mechanic. It's working but it becomes slower as number of game objects increases. I decided to give Job System a shot. My idea is to interpolate between positions and rotations for N game objects in parallel. It is certainly running faster than single thread execution.
However, when I see the profiler, the worker threads are sitting idle.
Here's the screenshot:

And here's the IJob code:
using System;
using System.Collections.Generic;

[BurstCompile]
struct RewindJob : IJob
{
    public int RewindableIndex;
    [ReadOnly]
    public NativeArray<Vector3> positions;

    public NativeArray<Vector3> finalPositions;
    public float currentTime;

    public void Execute()
    {
       //rewind code for interpolating b/w positions
    }
}

and this is how I schedule RewindJob for each entity like this in main thread:
NativeArray<Vector3> finalPositions = new NativeArray<Vector3>(m_Objects.Count, Allocator.TempJob);

for (int i = 0; i < m_Objects.Count; i++)
{
    NativeArray<Vector3> positions = new NativeArray<Vector3>(count, Allocator.TempJob); ;

    TimeRewindable rewindable = m_Objects[i];

    for(int yo = 0; yo < count; yo++)
    {
        positions[yo] = rewindable.m_Transforms[yo].position;
    }

    RewindJob rewindJob = new RewindJob();
    rewindJob.finalPositions = finalPositions;
    rewindJob.positions = positions;
    rewindJob.RewindableIndex = i;

    JobHandle handle = rewindJob.Schedule() ;
    handle.Complete();
    positions.Dispose();
}

for(int i = 0; i < m_Objects.Count; i++)
{
    m_Objects[i].transform.position = finalPositions[i];
    m_Objects[i].transform.rotation = finalRotations[i];
}

finalPositions.Dispose();
finalRotations.Dispose();

What I can understand is it's not real multi-threading but context switching. Can anyone just explain a little bit what's happening? Thanks.

sentences:
GLSL: How do I cast a float to an int? In a GLSL fragment shader I am trying to cast a float into an int. The compiler raises an error:

ERROR: 0:60: '=' :  cannot convert from 'mediump float' to 'highp int'

I tried raising the precision of the int:

mediump float indexf = floor(2.0 * mixer);
highp int index = indexf;

but to no avail.

How do I cast the int properly?

sentences:
How can I exclude my enemies from spawning in certain zones generated at random? I have a code where I randomly generate enemy spawn position, but I want to exclude some areas since it's colliding with some sprites it shouldn't collide with.

This is the code where I generate the random points from where the enemy is coming from (from top,down, left and right):

int z = ran.nextInt(4);
int r1 = ran.nextInt(GameControl.CAMARA_WIDTH+1);
int r2 = ran.nextInt(GameControl.CAMARA_WIDTH+ 1);
int r3 = ran.nextInt(GameControl.CAMARA_HEIGHT+ 1);
int r4 = ran.nextInt(ControlJuego.CAMARA_HEIGHT+ 1);

I set the position of the enemy with the random variable:

if (var == 1) {
   newEnemy.getSpriteEnemy().setPosition(0, r1);
} else if (var == 2) {
   newEnemy.getSpriteEnemy().setPosition(GameControl.CAMARA_WIDTH, r2);
} else if (var == 3) {
   newEnemy.getSpriteEnemy().setPosition(r3, 0);
} else if (var == 4) {
   newEnemy.getSpriteEnemy().setPosition(r4, GameControl.CAMARA_HEIGHT);
 }

Later I move the enemies to the center of the screen.

An image for better vistualizatio of the problem:

I don't want my enemies to ever spawn behind any of the corner sprites or to collide with any of the corner sprites before entering the screen. How can I solve this problem? How can I exclude this areas?

Thanks in advance for the help.

sentences:
Error while reading TGA file and doing Texture Cube map In my program, i read a TGA file with a function like this:

char* LoadTGA(char* filename, int* width, int* height, int* bpp);

As you can see, this function: return a char array of image data (without TGA file header, from the first pixel row of image to the last pixel row of image), width of TGA image, height of TGA image, and bits per pixel of image data. The part of code that read image data is this:

    int w = pHeader->width; //width of image
    int h = pHeader->height;  // height of image
    int rowSize = w * pHeader->bits / 8;   //The bit is bits per pixel
    bool bInverted = ( (pHeader->descriptor & (1 << 5)) != 0 );  //My TGA image is not inverted so bInverted is false.
    for ( int i = 0; i < h; i ++ )
    {
        char * pSrcRow = pSrc +
            ( bInverted ? ( h - i - 1 ) * rowSize : i * rowSize );
        if ( pHeader->bits == 24 )
        {
           for ( int j = 0; j < w; j ++ )
           {
               *pDest ++ = pSrcRow[2];
               *pDest ++ = pSrcRow[1];
               *pDest ++ = pSrcRow[0];
               pSrcRow += 3;
        }
    }
}

As this code show, for my TGA image, which have bits per pixel (bpp) equals to 24, not inverted, the return char array will be from the first pixel row of image to the last pixel row of image.

I read a image of 512 x 384 pixels like this image below:

I use this image for texture cube so i read 6 parts of this image in following function:

bool Texture::SplitTextureCube(int i, char* des)
{
int l, m, size = width/4;
int aTopLeft[][2] = {{size*2, size}, {0, size}, {size, 0}, {size, size*2}, {size, size}, {size*3, size}};
int rowSize = height * bpp / 8;
for (int j = 0; j < size; j++ ) //height
{
    char * pSrcRow = imageData + (aTopLeft[i][2] + j) * rowSize + aTopLeft[i][0];
    if ( bpp == 24 )
    {
        for ( int k = 0; k < size; k ++ )   //width
        {
            *des ++ = pSrcRow[0];
            *des ++ = pSrcRow[1];
            *des ++ = pSrcRow[2];
            pSrcRow += 3;
        }
    }
    else
    {
        for ( int k = 0; k < size; k ++ )
        {
            *des ++ = pSrcRow[m + 0];
            *des ++ = pSrcRow[m + 1];
            *des ++ = pSrcRow[m + 2];
            *des ++ = pSrcRow[m + 3];
            pSrcRow += 4;
        }
    }
}
return true;
}

This function is called as below:

 char *face = new char[width/4 * height/3 * bpp/8];
    glGenTextures(1, &textureId);
    glBindTexture(GL_TEXTURE_CUBE_MAP, textureId);
    for (int i=0; i<6; i++)
    {
        SplitTextureCube(i, face);
        glTexImage2D (GL_TEXTURE_CUBE_MAP_POSITIVE_X+i, 0, GL_RGB, width/4, height/3, 0, GL_RGB, GL_UNSIGNED_BYTE, face);
        //glTexImage2D (GL_TEXTURE_CUBE_MAP_POSITIVE_X+i, 0, GL_RGB, width, height, 0, GL_RGB, GL_UNSIGNED_BYTE, imageData);
    }
    delete [] face;

I guess you need no more explain. The problem is when my program running, my cube texture is disordered like this:

I sure that problems are inside my "SplitTextureCube" function, i sure that i read pixels in the wrong order, please help me fix that function.

sentences:
What files and libraries do I need for OpenGL and controls I am starting a 3D game, however I find OpenGL file system very confusing. OpenGL package doesn't have  one file, other package doesn't have another, so I need a summary of what files do I need to start playing with 3D. It would be good if it included keyboard and mouse controls.

Shortened question: Where can I get all files for OpenGl 4.0 and integrated controls libary?

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:
Can Xcode be used to create very simple games? I am brand new to Xcode, and I am also brand new Objective-C programmer.

I was wondering if it is possible to create simple Mac games with Xcode. If it's not possible, could you recommend me some good, cheap game engines?

sentences:
DirectX sampling a Texture2DArray interpolates between textures unintentionally I'm trying to texture my procedurally generated terrain. Previously I used an array of textures e.g. Texture tex[8], however in the shader you can't access this by index unless you chain if statements (ew), so I switched to using a Texture2DArray where instead you use a 3D UV where the Z component is the texture index. I use texassemble to generate a DDS file containing the Texture2DArray so it can be loaded in with ease.
For whatever reason, DirectX(11) seems to interpolate the Z component whenever the Z changes, resulting in seeing a slice of other textures in the array. I should add I'm trying to change the texture on the same piece of geometry. But I need to do this due to having multiple procedurally generated biomes.

I sample the texture in the pixel shader like so
float4 texCol = Tex.Sample(Sampler, v.UV);

My sampler is set up like this
CD3D11_SAMPLER_DESC samplerDesc(D3D11_FILTER_ANISOTROPIC,
    D3D11_TEXTURE_ADDRESS_WRAP, D3D11_TEXTURE_ADDRESS_WRAP, D3D11_TEXTURE_ADDRESS_CLAMP,
    0.f, maxAnisotropy, D3D11_COMPARISON_NEVER, border, 0.f, FLT_MAX);

The unwanted interpolation in question

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:
Cannot overlay text? I'm trying to make text have a fixed position in world space and be overlayed in screen space at the same time.

I have text in canvas with "Screen Space - Overlay" which covers my text located in canvas (world space).

What should I do? Is this a dead end? Please comment if you didn't understand (I know it's hard to get)

sentences:
Best way to allow a user to Control Body in Box2D I am working on a simple game and I am deciding how I should let users interact with the world. I really have 2 options,

1.) When the user moves an object I apply a force to the body

2.) With each move iteration I "move" the body by setting position.

Which is "better" or am I looking at this wrong entirely and should I be doing something different?

Also, does it matter if I want to keep the object stationary when it is hit by another body (I am assuming this means I will need to use static body which leads me back to #2)?

Thanks

sentences:
How can I smoothly rotate a joint to an angle? I would like to set the speed of my Box2D revolute joint on every update such that it rotates to a desired angle and stops. It should ramp down as its angle approaches the desired angle.

My first thought was just to set the speed to +max or -max based on the difference between the current angle and the desired angle. However, I think this might cause a see-saw effect as the joint overshoots its target angle.

What torque should I apply (each tick) to a joint to achieve a rotation to a specific angle and then rest?

sentences:
Creating Font Textures in Direct3d without D3DX Update: The completed solution using Nathan Reed's answer is posted in my answer below

A few open source programs I've seen that render installed fonts do something like this...

Create a texture for the font
Draw font to texture using native calls
Store the coordinates for each character
Create a vertex buffer with a quad for each character
Render the vertex buffer using the font texture

But I'm really having trouble getting this to work consistently. GetTextExtentPoint32A() for Win32 font sizes which does NOT include italic support and seems to cut off some of the stranger fonts.

Here is an example output from my code. Notice the cut off edge of the Q and a few other characters. A much more exaggerated version happens when rendering italics.

http://i30.photobucket.com/albums/c308/thentsc/font_test.jpg

The code looks something like this...

for (uint8 c = 0; c < 127 - 32; c++)
{
    str[0] = c + 32;
    SIZE size;
    GetTextExtentPoint32A(hDC, str, 1, &size);
    if (x+size.cx+1 > m_TextureSize)
    {
        x  = 0;
        // 1 pixel vertical margin
        y += size.cy + 1;
    }

    uint32 Diff;
    ExtTextOutA(hDC, x+0, y+0, ETO_OPAQUE | ETO_CLIPPED, NULL, str, 1, NULL);
    m_fTexCoords[c].Left = x/m_TextureSize;
    m_fTexCoords[c].Top = y/m_TextureSize;
    m_fTexCoords[c].Right = x+size.cx/m_TextureSize;
    m_fTexCoords[c].Bottom = y+size.cy/m_TextureSize;

    // 1 pixel horizontal margin
    x += size.cx;
}

The image above is actually just a render of the whole texture stretched from -1,-1,0 to 1,1,0 not using the stored texture coordinates to show clipping due to GetTextExtentPoint32A.

Again this works fine for some fonts but looks terrible for others and doesn't support italics.

It is designed to work in a system like this...

cFont* g_Font;
cTextObject g_TextObject;

Setup()
{
    g_Font = SetupFont("Arial", BOLD | ITALIC, 24pt);
    g_TextObject = CreateTextObject("The quick brown fox...", g_Font, X, Y);
}

OnRender()
{
     g_TextObject->Render();
}

So in general I guess my question is what is the correct approach for this issue?

Should I just let each text object have a texture and on text object creation use the GDI to render all text to it (which would bypass the italics and font face problem)?

But then wouldn't texture memory usage get out of hand?

sentences:
LibGDX player movement on X axis is very limited I'm making a side-scroller game using LibGDX, where player can move only on X axis. The problem is that the player can only move on positive X value, so he can't go to negative X. This is not that big of a problem, but the main problem is that where-ever I choose his initial position, he will never move right, so he basically can't extend his initial X value. I'm making movement with Gdx.graphics.getDeltaTime(), but when I don't use it, strangely everything works right. Other things work alright, the animation change works, test outputs worked, the problem always occurs only in the part of adding delta time to the x axis.

Player's initial position:

private Actor hiro;
hiro = new Hiro("Hiro", 106, 4, 32, 32);

(I'm not using LibGDX's Actor class, I made my own which uses animations)

Player's constructor:

public Hiro(String name, int x, int y, int width, int height) {
    super(name, x, y, width, height);
    this.x = x;
    this.y = y;
    this.width = width;
    this.height = height;
    standingRightTexture = new Texture("hiro_standing_right.png");
    standingLeftTexture = new Texture("hiro_standing_left.png");
    walkingRightTexture = new Texture("hiro_walking_right.png");
    walkingLeftTexture = new Texture("hiro_walking_left.png");
    standingRight = new Animation(standingRightTexture, 1, 10f, true);
    standingLeft = new Animation(standingLeftTexture, 1, 10f, true);
    walkingRight = new Animation(walkingRightTexture, 8, 0.6f, true);
    walkingLeft = new Animation(walkingLeftTexture, 8, 0.6f, true);
    setAnimation(standingRight);
    state = State.STANDING_RIGHT;
    facingRight = true;
}

Player's movement:

if(Gdx.input.isKeyPressed(Input.Keys.D)){
        x += Gdx.graphics.getDeltaTime() * 6f;
        facingRight = true;
        state = State.WALKING_RIGHT;
        System.out.println(x);
    }
    if(Gdx.input.isKeyPressed(Input.Keys.A)){
        x -= Gdx.graphics.getDeltaTime() * 6f;
        facingRight = false;
        state = State.WALKING_LEFT;
        System.out.println(x);
    }

Playing Screen's render method:

@Override
public void render(SpriteBatch spriteBatch) {
    cam.update();
    spriteBatch.setProjectionMatrix(cam.combined);
    spriteBatch.begin();
    hiro.getAnimation().update(Gdx.graphics.getDeltaTime());
    spriteBatch.draw(hiro.getAnimation().getFrame(), hiro.getX(), hiro.getY());
    moveCamera();
    spriteBatch.end();
}

If you want other segments of code, I'll provide it.

I greatly thank everyone whiling to help.

Edit: SOLVED! All I had to do was to use float axis instead of integer. Silly me!

sentences:
How to raycast in MonoGame 2D? Currently I am using a Ray class that I built myself. The following is for brevity.

public class Ray : GameObject
{
    public GameObject Shooter;
    public List<GameObject> Objects;
    public float Speed = 250f;
    public bool Collided = false;

    public void Update(){
        if (Collided) return;
        Position.X += Speed * gameTime;
        Position.Y += Speed * gameTime;

        foreach(var obj in Objects){
            if (this.Intersects(obj) {
                 obj.OnCollide(this);
                 Collided = true;
            }
        }
    }

This works, but only if I control the amount of rays, cause if I create too many rays, the game becomes laggy OR the ray/bullet get past through walls (idk why). I am trying to find out which objects that player can see and only draw the visible things, so I need to let out alot of rays. Is there a more efficient way to achieve this objective.

sentences:
Optimal touch controls for a twin-stick shoot 'em up? So we recently launched a shoot 'em up arcade-type game (think Smash TV or I Made a Game with Zombies in It!). You can move in one direction and fire in another, so the ideal control scheme is probably two analog joysticks (like the Xbox 360 has). We support WASD to move and arrow keys to fire. The best way to control though is to move with WASD and aim with the mouse.

We're getting a lot of people asking for mobile versions of the game (mostly for iPad and Android) and the problem is we just can't come up with a good way to translate the controls over to a touch device.

Interestingly, someone actually hacked an early version of our game a while back to work on Android by overlaying D-pads, and sure enough, it was almost impossible to control. The game gets really difficult later on, and the thought of releasing a game with a crappy control scheme that nobody could possibly ever use to beat the game does not sit well with me.

So I was wondering if anyone has any previous experience or suggestions on how to approach this problem? Overlaying two D-pads on the screen is clearly not the way to go and we're kind of at a loss for other ideas.

sentences:
LibGDX, How to create a 2d collision terrain How can I create a surface so my bike collides with the ground?
I'm thinking of placing x,y coordinates, but that will be too straight and I want it more smooth. (I don't want to place 1 million dots)

sentences:
unable to use two gestures simultaneously I have a class implementing gesture listener in libgdx. I want to use longpress gesture in one half of the screen and fling gesture in other part of the screen simultaneously.

public class FlingHandler implements GestureDetector.GestureListener{

GameWorld world;
Bmw bmw;
private float  w,h,xunit, yunit;
private float spd = 1;
private float xtouch = 0, ytouch = 0;
private float xVel = 0, yVel = 0;
private int p = 0;

public FlingHandler(GameWorld world) {
    this.world = world;
    w = SS.WIDTH;
    h = SS.HEIGHT;
    xunit = SS.x;
    yunit = SS.y;
    bmw = world.getBmw();

}
public void update(float delta){
    updateLongpress(delta);
}

public void updateLongpress(float delta){

    if(longPress(xtouch,ytouch)==true && world.getBmw().isDead()==false) {
        if(spd <1600 && Gdx.input.isTouched()){
            spd += 0.9f*delta;
            Gdx.app.log("speed ","increasing"+spd);
        }
    }

    else if(longPress(xtouch,ytouch)==false && world.getBmw().isDead()==false){

            if(spd > 1 ){
                spd -= 8f*delta;
                Gdx.app.log("speed ","decreasing"+spd);
            }
    }
    else{

    }
}

@Override
public boolean fling(float velocityX, float velocityY, int button) {
    xVel = velocityX;
    yVel = velocityY;
    xtouch=Gdx.input.getX();
    ytouch=Gdx.input.getY();
    p = button;

    if(xtouch > SS.WIDTH/2 && world.getBmw().isDead()==false) {
        if (Math.abs(xVel) > Math.abs(yVel)) {
            if (xVel > 0) {
                if (world.getBmw().getPosition().x < 8 * xunit) {
                    world.getBmw().getPosition().x += 4 * xunit;
                }
            } else if (xVel < 0) {

                if (world.getBmw().getPosition().x > 7 * xunit) {
                    world.getBmw().getPosition().x -= 4 * xunit;
                }

            } else {}

        }
        return true;
    }
    else
    return false;
}

@Override
public boolean longPress(float x, float y) {
    xtouch = Gdx.input.getX();
    ytouch = Gdx.input.getY();

    if(xtouch < SS.WIDTH/2 && world.getBmw().isDead()==false){
        return true;
    }
    else if (xtouch > SS.WIDTH/2){
        return false;
    }
    else
    return false;
}

sentences: What is the difference between AR, VR and MR? Please explain clearly and in short about the differences and boundaries between AR, VR & MR.

sentences:
Is GL_DEPTH_COMPONENT32 deprecated in OpenGL 4.5? I'm in the process of migrating our object oriented OpenGL wrapper from 3.3 core to 4.5 core.

Some OpenGL implementations are notoriously permissive on what inputs they'll accept which can make tracking down bugs difficult. Wherever possible the inputs to our wrapper are validated with asserts to keep them in line with the spec.

While setting up the asserts for glTextureStorage3D I've noticed that according to this page on the Khronos website it only accepts the following sized depth types: GL_DEPTH_COMPONENT32F, GL_DEPTH_COMPONENT24, GL_DEPTH_COMPONENT16, GL_DEPTH32F_STENCIL8 or GL_DEPTH24_STENCIL8.

Non-floating point 32bit depth types seem to be missing from that list which leads me to believe they're no longer supported (or at least actively discouraged). There's also this answer to another question which states that:

  GL_DEPTH_COMPONENT32 is probably overkill, and as of 4.5, isn't a required format for OpenGL implementations to support (though 16 and 24 bit ones are).

I have tried to find some reference to this in the 4.5 core spec but turned up nothing.

Is GL_DEPTH_COMPONENT32 a deprecated size type? If so, why?

sentences:
Character controller going down slopes When I go down slopes with character controller, if the speed is too high, the character just flies off the slope and lands at the bottom. I want my character to "stick" to the slope rather then just jump of it. I came up with code to do so, but it didn't turn out as I planned. Now the character just slides on the slope when I stop pressing the arrows (not staying at its place on the slope).

Physics.Raycast (transform.position, Vector3.down, out hit);
transform.position = transform.position
                     + new Vector3(0f, distance - hit.distance, 0f);

Thanks for the help, i couldn't figure this out all day.

sentences:
tiled map - changing textures? (XNA HLSL) I have successfully created a tiled map of various textures. Right now, i had a Vector4 in my own custom Vertex declaration deciding what texture each of the tiles should be. This is working perfectly. I can have any of my four tiles on the map, and any combination of them.

However, i would like to start having the tiles change, yet i do not know how to change this Vector4 of the vertices. They have been added to a vertex buffer if that helps you answer the questions.

sentences:
why each game does not provide the option to download only one graphic quality, instead of having to download low, medium, high and ultra graphics? If there is an option like this it will definitely save storage space.
When you download or stream a film there is an option for graphic quality, and we only download that one graphic quality.
Or is there another reason behind it all?

sentences:
Do any games support different lighting effects according to whether a surface is wet or dry? I've noticed that when driving at night, when the road surface is dry, my headlights appear to illuminate much further than when the road surface is wet. I presume that this is due to the differences in how my headlights is being reflected under wet and dry conditions.

In dry conditions, my headlight will reflect in a diffuse way, producing producing enough scatter to allow me to see the texture of the road for quite a long distance. In the wet however, the thin layer of water over the road surface, combined with the shallow angle of incidence, causes the light from my headlights to be reflected in a specular way and not back scattered to me.

Thinking about this, I realised that I can't remember ever having seen this effect being reproduced in a game.

Has this wet/dry effect been implemented in any game?

If so, what is the name of the technique used to produce the effect?
If not, could this effect be produced without ray-tracing?

sentences:
How can I make a shader that renders only the scene's skybox? I am trying to replicate the following image:

There are a few ways about doing this that involve camera stacking, layers, etc. Is it possible to create a shader that will only render the skybox?

sentences:
If a 3d surface is occluded by another 3d surface, does this have any effect on the performance and rendering speed? We have a 3D character who is wearing a gauntlet on his forearm and visibility of which can be turned on and off. Would it be better to create two versions of arm, one without extra triangles that are hidden beneath the gauntlet? Or we can just one model with gauntlet as separate object which can be turned on and off ?

Does the hidden triangles have any effect on rendering or are they completely ignored by engine?

We are using Unity 3D.

sentences:
How to handle game objects in DirectX Coming from XNA, I would use the content pipeline and create XML files for game objects.  However, if I changed something in the XML, I would need to do a rebuild of the project so it will create the XNB file.

Do I need to create XML files on my own and create* encrypt/decrypt process and XML parser?  Or should I simply hard code (since any changes would need a rebuild anyway)?

Most of the things in my game project will be random.  However, the base types (like Armor types) will be static.  Meaning one type of armor will give 20% armor.  And another type of armor will give 50% armor.

I do not want to use any third party solutions.  I want to do everything myself so I can learn how to handle these situations.

sentences:
Dealing with string memory pollution Consider following example. I have a title screen for a game which displays top scores list, and some other text. The Update method looks like (simplified):

// remove all text
textList.Clear();

// add scores
foreach(var sc in scores)
{
    textList.Add(new GameText(string.Format("{0}: {1}", sc.Name, sc.Score));
}

If I understand all correctly, then each frame 10 new strings are created, polluting memory at high rate. Currently I fight it with creating a cache:

// this is a class level variable, outside of Update method of course
List<GameText> scoreCache = new List<GameText>();

// remove all text
textList.Clear();

// add scores to cache if needed
if(scoreCache.Count == 0)
{
    foreach(var sc in scores)
    {
        scoreCache.Add(new GameText(string.Format("{0}: {1}", sc.Name, sc.Score));
    }
}

// get fast copy from cache
// no new strings created until score cache is invalidated
textList.AddRange(scoreCache);

I wonder, if there are some other reliable solutions and patterns to this common, as I see it, problem?

Update. As @JasonH correctly mentioned, there is no need to update list each time at all, so now scoreCache is initialized once in a LoadContent-like method which is called once before main Game loop starts.

Update 2. Another similar problem was with a debug text layer output which displays FPS, Total game time, etc. on top of all screens. Despite using StringBuilder, intermediate strings were required for creation of final debug text for each frame. I've decided to solve it this way, since I don't actually need per frame response, I update this only each second:

private void PrepareDebugText(GameTime gameTime)
{
    this.refreshAccumulator += gameTime.ElapsedGameTime.TotalMilliseconds;

    // if required time is not elapsed yet
    if (this.refreshAccumulator < RefreshIntervalMs)
    {
        // do nothing
        return;
    }

    // reset accumulator
    this.refreshAccumulator = 0;

    // create debug text below
    // ...
}

Applying this two approaches gives following:

reduced garbage collection frequency by 2 (from 60-70 seconds to 130-140 seconds)
reduced peak heap allocation from 3,4 Mb to 1,5 Mb
reduced short life objects to less than 1% from more than 50%.

Now I'm satisfied.

Update 3. @GeorgeDuckett found an interesting approach example how we can further reduce string pollution then output is integer number.

I also would like to clarify why strings are so specific in XNA (.NET). Despite being a reference type, on each assign (i.e. =) operation new string is created instead of assigning reference. This can produce not very obvious amounts of garbage strings.

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:
Get BP FollowCamera Rotation and Location I'm accessing my FollowCamera https://imgur.com/a/vbFagxg from my BluePrintCharacter class in my C++ code, with this following line :

FollowCamera = GetOwner()->FindComponentByClass<UCameraComponent>();
FVector WorldLocationV = FollowCamera->GetWorldLocation();

But when I run my game, I get this error : GetWorldLocation is not a member of UCameraComponent

Why is this, and how can I get GetWorldLocation from FollowCamera in C++?

In BluePrint this seems to work fine : http://i.imgur.com/8m9TWUW.png

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:
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:
Why can't this event call its parent event? It's me... Back again... with another Unreal problem...

I have an Event in my Parent Class called Overridable :: PreDialogueScreenEnter

I have overridden the same Event in a Child Class:

Yet when I attempt to call the parent event from the child class, the option is greyed out.

Tl;Dr:

Why call parent event not work >:|

sentences:
How can I create Portrait game assets to have same with gap for both iPhone 7 Plus and iPhone X? In my Unity game I made changed my Pixel Per Unit value to 243 since the height of a Portrait game for iPhone X is 2436. The game looks great and the asset sizes look just right on the iPhone X simulator. But when I change to iPhone 7 Plus I get considerable space on the sides and it gets worse when I change to the iPad. How can I make my game have the same width gaps for iPhone 7 Plus and iPhone X without making assets look stretched horizontally or vertically?

UPDATE

The images below give an idea of my game on both 1080x1920 (for iPhone 7 Plus) and 1125x2436 (for iPhone X). It's not a match3 game. All the game objects below are static and have colliders. The gaps between are quite significant for other dynamic objects to move between. Reducing the gaps significantly would alter the movement of the dynamic objects and their sizes too, making the ratio in object sizes look wrong. I haven't started worked on scores or menus yet, so I haven't added a UI canvas yet.

sentences:
Problem with draw distance in Unity editor 3D view The Unity editor scene renderer is not letting me get a close-up view of anything.  As the camera moves closer, the geometry closest to the camera just disappears.  It's as if the draw distance has become far-sighted.

In the example above, the geometry of the green object (a car mesh) is being cut off as I pull the camera in.  The floor is also disappearing, as shown by the grey cut-off at the bottom.

This is making is extremely difficult to line up colliders with render meshes, position smaller objects, and do other detailed tasks.  I don't remember my Unity doing this before about a month ago, but I have no idea what changed.  Is there a setting somewhere?  Has anyone else seen this?

sentences:
How to I access "Deny" message from a Lidgren client? I'm using the Lidgren v3 network for a UDP client/server networking model. On the server end, I'm initializing a NetServer object with the NetIncomingMessage.ConnectionApproval message type enabled.

So the client is able to successfully connect and the first packet it sends is a login packet, containing a username and password supplied by the user. The server is receiving that and doing some black magic to authenticate, and everything works up to that point.

If the login fails, the server calling NetIncomingMessage.SenderConnection.Deny("Invalid Login Credentials"). I want to know how to properly receive this deny message on the client.

I'm getting the message, it shows up with a message type of NetIncomingMessage.StatusChanged. If I call ReadString on that message, I get a corrupted version of the string I passed to the Deny method on the server. The type of corruption varies, I've seen odd characters in there but in every case it's truncated and is way shorter than the string I entered.

Any ideas? The official documentation is sparse on this topic. I could use pointers from anyone who has successfully used the Lidgren library and uses the Accept or Deny methods.

Also, if I don't do any authentication and just Approve() the connection every time, stuff actually works just fine and I'm getting reliable two-way UDP traffic. (And lastly, Stack Exchange said I don't have enough reputation to use the "Lidgren" tag....???)

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:
Using variables in other scripts I need to use a variable from the main script of a game which is the score variable public int scoreCount; I need it in the main script because it will be needed to update the score when they get past a certain point.

I need to be able to access this variable.. so add or subtract from it i.e. scoreCount++; however I am not sure how to do this, I have looked at tutorials and they make no sense for me.. could someone please explain it in more detail.

I also need to be able to use the public void UpdateScore() function from the mainscript too, do I just do it the same way as the variable or is there a different method. Thank you.

sentences:
Will multi-touch become an important/standard method of input for PC games in the future? We've seen that multi-touch on smartphones has been wildly successful. On the iPhone, in fact, it's the only tactile input the user can provide! However, I'm wondering how likely it'll be for multi-touch to take off on desktop PCs (and PC gaming) in the future. Right now, it's mostly a lack of good multi-touch monitors on the market, but the fact that there's not much of a push by manufacturers is disconcerting. It'd be really nice to have multi-touch gestures to navigate in an RTS, for instance, and music games would be really fun with multi-touch input (think Elite Beat Agents or DJ Max Technika, but on the PC). An example.

Do you think that multi-touch for PCs will eventually take foot and become popular, or will it stagnate?

P.S. I'm guessing this would be best suited for CW, so if a mod feels like it's appropriate, feel free to mark it as such.

sentences:
Opengl - Know when a new frame is drawn, regardless of window I want to know the framenumber of the current frame at any time, regardless the bound window or if it was changed. I dont want to implement a framecounter in my window class, since that would 1. require every depending library to check which window is bound and only use frames from there and 2. Isnt independent of windows.

I am sure there is a way to simply know when A opengl context has something new send to it. Please help me find it!

I want a frame number that is in sync with other debugging tools so I can easily compare and contrast.

sentences:
How to deal with pushing objects out of collision in a physics engine I'm developing a 3D physics engine (I know, I should use one of the many good existing physics libraries, however my collision detection is optimised for objects with highly ordered highly complex substructure which seems to be unusual and slow in the engines I've tried).

Collision detection is working really nicely, as are bouncing type behaviours but contact behaviours are not behaving nicely at all. Initially I had the problem that an object would spin up out of control if it had prolonged contact with a surface; I found that the reason for this was that an object was falling under gravity into collision, then getting a "free ride" upwards while it was pushed out of collision; giving the object free energy. If a significant portion of this energy made it into rotational degrees of freedom then considerable energy could be imparted before eventually the object was flung outwards. My solution to this was to impart an energy penalty when pushing out of collision equal to:

 EnergyPenalty=mass * gravity dotted with the push-out-of-collision vector (i.e the E=m*g*h it has gained for free)

This improved matters considerably, but now objects "get stuck" on their corners just before the shape relaxes into its resting position; presumably because too much energy seems to be being taken away.

A loop round the engine works as following

-Collisions detected
-Pushed out of collision (energy penalty if pushed up against gravity)
-Collisional forces applied if object are still approaching (may not be the case if push energy penalty slowed to 0)
-Gravity applied
-Contact forces applied if object are still approaching (as collision but with elasticity = 0)
-Move and rotate objects

I've taken friction out of the equation for the time being

I’ve found that while in contact with the surface the contact forces correctly bring the two objects at their collision points to zero relative velocity (taking into account both translation and rotation) but that that balance of translational movement balancing rotation  is instantaneous. I.e. over a complete physics step the rotational component changes to be no longer in perfect balance with the translational. So a very small push-out-of-collision is required even when in ‘contact mode’ with a very small energy penalty to boot. However this energy penalty seems too large; freezing the object in position.

Which brings me to my question; what is the correct way to deal with the “free energy” imparted by a push-out-of-collision in a collision resolution step? (Even if the answer is; what you're doing is the correct way to deal with it i'll know this is a debugging issue not an algorithmic issue)

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

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

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

sentences:
How can I use multiple meshes per entity without breaking one component of a single type per entity? We are just switching from a hierarchy based game engine to a component based game engine. My problem is that when I load a model which has a hierarchy of meshes, and the way I understand, is that an entity in a component based system can not have multiple components of the same type, but I need a "meshComponent" for each mesh in a model. So how could I solve this problem.

On this site they implemented a Component based game engine:
http://cowboyprogramming.com/2007/01/05/evolve-your-heirachy/

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 make other semantics behave like SV_Position? I'm having a lot of trouble with shadow mapping, and I believe I've found the problem.
When passing vectors from the vertex shader to the pixel shader, does the hardware automatically change any of the values based on the semantic?

I've compiled a barebones pair of shaders which should illustrate the problem.

Vertex shader :

struct Vertex {
    float3 position : POSITION;
};

struct Pixel {
    float4 position : SV_Position;
    float4 light_position : POSITION;
};

cbuffer Matrices {
    matrix projection;
};

Pixel RenderVertexShader(Vertex input) {
    Pixel output;
    output.position = mul(float4(input.position, 1.0f), projection);
    output.light_position = output.position;
    // We simply pass the same vector in screenspace through different semantics.
    return output;
}

And a simple pixel shader to go along with it:

struct Pixel {
    float4 position : SV_Position;
    float4 light_position : POSITION;
};

float4 RenderPixelShader(Pixel input) : SV_Target {
    // At this point, (input.position.z / input.position.w) is a normal depth value.
    // However, (input.light_position.z / input.light_position.w) is 0.999f or similar.
    // If the primitive is touching the near plane, it very quickly goes to 0.

    return (0.0f).rrrr;
}

How is it possible to make the hardware treat light_position in the same way which position is being treated between the vertex and pixel shaders?

This differrence is almost exclusive to the Z component, as the X and Y values of light_position are behaving as expected.

EDIT: Aha! (input.position.z) without dividing by W is the same as (input.light_position.z / input.light_position.w). Not sure why this is.

EDIT 2: Dividing (output.light_position) by (output.light_position.w) in the vertex shader causes really odd behavior, where (input.light_position.z / input.light_position.w) will be either 0 or 1 based on the camera's position and angle.

EDIT 3: Moving the projection multiplication into the pixel shader doesn't seem to make any difference. This means that the hardware is doing something to the SV_Position semantic which is critical to make it work.

EDIT 4: (input.light_position.z / input.light_position.w) IS behaving like depth, it's just that the precision seems to have decreased unbelievably. Only does it approach 0 once it's primitive literally intersects the near plane.

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:
How to check for every n value interval, but not exactly n Let's say I have a game where the player earns n number of points when they pick up an item; the value of n differs depending on what they picked up. When they pick up an item, a method gets called that adds n value to their current total score.

Pseudo code:

void tallyScore(int scoreToAdd) {
   PlayerScore += scoreToAdd;
}

I want to give the player an extra life every time they reach y total points. Let's say 200, for now.

Pseudo code:

void tallyScore(int scoreToAdd) {
   PlayerScore += scoreToAdd;
   if (PlayerScore % 200 == 0) {
      GivePlayerExtraLife();
   }
}

The problem with the modulus approach is that if PlayerScore is currently 190, and we call tallyScore(11), the modulus condition will fail, but I still want to give the player an extra life because they've passed 200 points. If we were to call tallyScore(2) again, I wouldn't want to give them an extra life that time becasue we already did when we called tallyScore(11) previously.

What's a good way to check that PlayerScore has passed an interval of 200 points?

To reiterate, as the game went on, and PlayerScore becomes 395, I call tallyScore(8), I would then want to give the player another extra life since they earned another 200 points.

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:
Finding specific coordinates on a rotating line I'm currently working on a mobile game which mainly consists of a rotating line and a ball. The line rotates 0.500 degrees clockwise around its center every frame. The ball is at first positioned in the centre of the line. When the user touches the screen, the ball should move along the line and when the user stops touching the screen the ball should move in the opposite direction.

I have the line rotation, and the coordinates of the line(top-left corner).

I need to find the position of the ball if the ball moves along the line at a speed of 5.

sentences:
How to clear out a drawn texture from the screen in libGDX I am trying to clear out the drawn texture from the screen.

Lets take a classic game example - in many games when the character goes through the coins the coins clears out from the screen and displays a sweet animation like fade in and fade out the points collected from that coin(+10) and show the coin exploding animation on that position.

I want to do something similar to that.
I am using SpriteBatch to draw the texture region like below.

Setting texture Region:

(...)
 public Texture texture;
    public TextureRegion coin;
    texture = new Texture(Gdx.files.internal("data/texture.png"));
    texture.setFilter(TextureFilter.Nearest, TextureFilter.Nearest);
    coin = new TextureRegion(texture, 0, 336, 65, 73);
 (...)

   Drawing the texture into screen :

 public SpriteBatch batcher;
 batcher = new SpriteBatch();
 batcher.setProjectionMatrix(cam.combined);
  batcher.begin();
    batcher.enableBlending();
    batcher.draw(coin, x, y, 65,73);
    (...)
    (...)
  batcher.end();

The game character is also drawn using the same logic shown above.
Now when the game character will collide with the coin that I have drawn,the coin must be cleared(vanished) and some animation or big font like +50 must fadein and fadeout in that position.I tried but didn't find anything that would do this.
So how to do that ?

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: What is the best way to animate a jumping motion in Unity 3D? I am creating a a simple 3D game in Unity with a character who runs, walks, jumps, swims, shoots etc. I am pretty satisfied with my results in all the motions except jump. I need to know at what height my character is at in relation to the ground at all times (The height of my terrain varies) in order for me to be able to tell the Animator Controller when to transition. I have done some research on the matter and I found out about Raycast but I'm not sure how to use it. Any help would be great, thanks!

sentences:
High-definition Full-motion background system in XNA I'm mostly just working on this as a hobbyist thing, but here's my problem:
I got a bit excited over finding the 'Video' and 'VideoPlayer' classes in XNA 4, and hoped to make a game that works a little bit like how Myst does - with very active backgrounds, but no actual 3D graphics. (Technically, Myst 1 had static backgrounds, but maybe you get the idea) I threw together a small test game in XNA, with a pretty simple WMV included.

The problem I have is that it's not quite responsive enough. I'd like my system to be able to swap the current video in a millisecond, so that the player could click a contraption in the background and instantly see it move. Right now, when I press my trigger key that calls this code:

    private void cycleVideos()
    {
        videoIndex++;
        if (videoIndex == videos.Count)
        {
            videoIndex = 0;
        }
        activeVideo = videos[videoIndex];

        vp.Stop(); // Couldn't find a 'Seek(0)' method
        vp.Play(activeVideo);

    }

...it takes about a full second to re-seek the position it needs, and start playing again. In this example, I hadn't even encoded my video to the HD (1920x1080) resolution I had been planning on. I can understand if XNA's video system is really only meant for full cutscenes between missions or that sort of thing; I'm willing to use additional memory to have large parts of my videos cached, or even include a bit of a dynamic caching system so that things are loaded/unloaded over time (after all, this is the main visual of the game), but I'd like to hear if I have any decent options to accomplish this.

I'm also somewhat open to the idea of using a different engine or coding environment entirely.

EDIT: I've been doing some experimentation in my eagerness to solve this. I can definitely get some faster responsiveness by avoiding the 'stop()' calls, and by maintaining multiple instances of VideoPlayer. A paused video will resume much more quickly; and it's possible to play(), then pause() a video immediately (at the beginning of the program, in order to 'cache' it). It's not a full solution yet - I want to be able to seek back to the beginning of a video, and I still feel like there should be some possibility of that somewhere.

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:
How can my entities avoid walking on certain tiles? In my tile map, created with 'Tiled', I placed some tiles that need to be avoided by my mobiles. Tiles like water or obstacles.

The entities "wander" in the map, choosing random directions, and their position are in world coordinates (float), not grid or tile positions (int). To create a more natural effect, the random directions are similar in a period of time, so no abrupt change of direction occurs.

Is there a way to make entities avoid some tile types, or 'Tiled' tile properties, without losing the "wander" behaviour? I mean, choose random directions that do not reach these type of tiles?

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:
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:
How to flush changes in PlayerSettings inside Editor I have a script which works only in the Editor. The script makes changes inside PlayerSettings. However, the changes made are flushed to the hard drive just after something in Unity is saved for example any scene.

We have a script which increments the build version. The described issue sometimes leads to the wrong version committed to Git as the changes a flushed to the disk later.

How can I flush the changes of PlayerSettings from the code?

sentences:
Tracing a 2d path through multiple gravity fields For a projectile starting at origin O, an initial velocity V, and several stationary planets P[n], how would I pre-calculate and store the path it would take without actually stepping through each frame along the curve?

I have some idea of how to do this for a single gravity source (conic section, parametric curves), but how do you blend multiple forces, and thus multiple curves, together?

The idea is to give the player some idea of the trajectory their shot will take, so it doesn't need to reflect the actual path exactly, but the closer the better.

sentences:
Body lost a velocity component when hitting a wall I am creating a Breakout game using Box2D (of LibGdx if anyone interest). Everything works well until when the ball hits the wall when moving with a very small angle. Please look at the image for details:

I tried to set the wall friction to 0 and restitution to 1, as well as the ball's friction and restitution, but it still move along the wall (I have no World Gravity). This also happens to the vertical wall if the angle is small enough, it will lose X velocity.

How can I move the ball the way I expected? If there is no friction, what caused the problem?

EDIT: In case of LibGdx only, this is a fix:

World.setVelocityThreshold(float threshold);

I set it to 0.1f, and it helped. If you encounter problem, maybe 0 can help, but it is unrecommended..

sentences:
The best way to store and protect game data I'm writing a sandbox-type game and i'm looking for a good way to store game data. I tryed Lua and plain text files, but the have a big minus - player can edit them his self!

So how do I protect data from player? Thank you!

sentences:
How to animate a model in WebGL? I created a human model in Blender, exported the vertices and indices into a JSON file and render the model in a browser using WebGL. Now I created a walk and jump animation in Blender and would like to do the same with WebGL.

I saw examples that use a list of vertices for every frame of the animation. Is this the way to go? Do I need to export the vertices for every frame for every animation?

sentences:
Fast selection of visible child components I'm working on gui and I have next realization of base UI component:

So when I want to get absolute component position I need to sum all parent positions with component position.
Also if I want to skip rendering of component, in case if it out of bounds in one of parent components, I need to go through all parents and check this.
This approach is not very fast in case if there are too much components (about 10.000) so my ups decreased from 2600 to 400 updates per second.

Also till rendering I need to calculate scissoring rectangle by intersecting all parent rectangles with current rectangle.
IMO it is also little bit heavy operation in case a big tree of components.

Is there any way to increase it?
Or some fast way to select only visible components without checking every component in list?
Maybe there should be some another component structure?

sentences:
How to blend biomes with procedural terrain I'm working on a terrain generator. Through multiple noise functions, I'm able to create many kinds of terrain I like, but I'm having a bit of difficulty joining them together in a seamless fashion.

My first thought was to use a single noise call (calling it the mask) and then I could simply say things like:

if (returnVal < .1) GenerateBiome1();
if (returnVal < .2) GenerateBiome2();
if (returnVal < .3) GenerateBiome3();

and so on...

The issue here is that the height of the terrain doesn't blend together when doing this. If biome 1 was more mountainous and biome 2 was flat land, it's a drastic switch from one to the other and it looks atrocious.

My next thought was to attempt blending by giving a 'strength' to each biome based on what my mask noise returns. In C# code, it looks something like this at the moment:

static public float GetHeight(float X, float Z)
{
    float fRollingHills_Location = .25f, fRollingHills_Impact = .5f, fRollingHills = 0;
    float fMountains_Location = .75f, fMountains_Impact = .5f, fMountains = 0;

    float fMask = Game1.GetNoise2(0, X, Z, .01f);
    float fRollingHills_Strength = (fRollingHills_Impact - Math.Abs(fMask - fRollingHills_Location)) / fRollingHills_Impact;
    float fMountains_Strength = (fMountains_Impact - Math.Abs(fMask - fMountains_Location)) / fMountains_Impact;

    if (fRollingHills_Strength > 0) fRollingHills = fRollingHills_Strength * (Game1.GetNoise2(0, X, Z, .02f) * 10f + 10f);
    if (fMountains_Strength > 0) fMountains = fMountains_Strength * (Game1.GetNoise2(0, X, Z, .05f) * 25f + 10f);

    return fRollingHills + fMountains;
}

The issue I have here is that even for only two biomes, it's pretty important for me to manually choose the "location" and "impact" values to ensure I'm getting some combination of strengths to total 100% by the time it returns a value (if not, I get things like giant cliffs making the borders from one biome to another ugly and obvious).

I don't know if I can give a good true question here other than, how should I actually be going about this? While I've managed a few good looking maps, I feel like I'm going about this in an overly complicated way that still doesn't give me all the customization I'm looking for.

sentences:
Why is it so bad to optimize too early? After looking into optimization a bit, I have discovered (literally everywhere) that it seems to be a universally recognized sin to optimize a game too early.

I really don't understand this, would it not be incredibly difficult to change some of the core structures of the game at the end, rather than developing them the first time with performance in mind?

I get that waiting until the game is finished will tell you if you even need optimizations, but shouldn't you do it anyway, after all, it could widen the variety of devices the game could run on, which would increase the number of potential players.

Could someone explain to me why it's such a bad idea to optimize too early?

sentences: Model mesh overlapping while animating in Unity but not in Blender I made an FPS model in blender and created reload animation when I imported that model in Unity I saw that while the magazine ejecting from the rifle it overlapped some of the gun parts. Then I went back to the blender and changed some keyframes and positions in the blender but in Unity, it showed me the same problem. I tried many times it looks fine in the blender but in the Unity, it has the same problem.

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:
Simplyfing/dissolving octree to simple boxes by adjacent octants with similar traits I am looking forward to create a navigation volume to be utilized by AI actors.

The approach I am trying to tackle here is to first generate an octree and associate with respectable flags/data (type, what's contained for now). The octree is going to be fairly deep (up to 0.1 units).

This is the scene I am using for testing purposes:

results in 1947817 nodes in 9 levels. (22 x 9 x 22)

I am looking for an algorithm/concept/pseudo-code that would transform this octree into non-uniform, axis-aligned boxes derived from octants that match certain flags/data, that would, for instance, help me determine the navigation volume similar to what can be seen here (Havok):

With "I am looking for" - I have a feeling of such an algorithm/concept already existing, though, I am not sure. The feeling drives me towards this being a fairly mathematical problem that resides behind a common name.

The other approach would be to utilize a non-uniform grid (creates 4356000 cells) for the detailed shape to then be expanded (simplified) down to some boxes. Which my feeling tells, would utilize the same algorithm.

As for the "what have you tried part" - well... I have googled for some time with various combinations from keywords grid, merge, cell, flags, occupied, gamedev, octant, grow, largest space, adjacent and maybe some others to no avail.
Well, before pushing the Post button, I did try some more keywords and ended up with this answer: https://gis.stackexchange.com/questions/23365/how-to-combine-adjacent-polygons-sharing-similar-trait-into-single-polygon which appears to be close to what I am looking for, except that it's 2D (though, I gave the keyword "polygon" for this query). Having learned that the process is called "dissolve", I made some more attempts with various combos with added word "dissolve". And through my findings some more searches and so on... Well... nothing.

If the answer wont yield any results, I know that I could attempt this by raying the hell out of the graph by starting at either corner and flooding through it all, basically, brute forcing my way.

So...

Is the common algorithm/concept already out there, that I could be pointed towards?;
or - what guidelines should I follow to produce such a product?

sentences:
Can I include a public domain book in my game? Just for fun, I want to include a bookshelf in my game with a real book (or few) that you can actually read.

Would I run into any legal trouble if I included an out of print book in the public domain, such as Pride and Prejudice or Alice in Wonderland?

sentences:
Most efficient way to detect and act upon collision (Specific for my 2d game) Currently, mainly just for fun, I'm working on a 2d game where I have all collide-able blocks (background) assorted into an array when its loading, along with the player put into a different part of the 3d array. The player object gets put in with the AI array. It looks like this -->

    var world_objects = [
  [], //All 'background' collide-able objects. Such as stones and the border ~~ Code name: bg
  [], //All AI ~~ code name: ai
  []  //Projectiles ~~ Code name: ps
];

The map is set up into a bitmap that I've made using another 3d array, that currently is made into a 15x15, but that is subject to change. The brown border is included in the bitmap and world_objects array. And when the blocks/ai/projectiles are inserted, they all will have a basic object properties of:

x, y(2 variations, one with just normal x,y according to the exact pixel in the canvas, and the other is according to which cell its in for the bitmap)

Width, height (Both width and height for ai and projectiles are recorded as percentages according to the size of each cell, because the size is made to change depending on screen size)

Along with other properties not related to collision. What would be the most efficient way of detecting all objects and whether they collide or not? If needed, I could add additional properties to each object if that would make it easier and more efficient.

Click to see all of the code

sentences:
Using an unregistered company name If I want to release an App with a Company Name do I have to have that registered before I can use it?

I have checked and the name is not taken, so is it fine to just use a made up company name?

As a side note, I have made this game just as a hobby project, not looking to make any money from it.

sentences:
Using .svg in unity(2D) Creating resolution independent sprites is tough and memory consuming.

How can .svg assets be used in unity for any kind of 2d game?

What are alternatives to .svg that can be used in unity?

Can sprites with various shapes be generated within unity?

Would like creating universal art asset that'll support all devices with different resolutions.(we'll handle the aspect ratio )

sentences:
How to make Unity sprite animation not lerp? I set sprite animation at key1 and key2.

at Key1 :

Position.x = 0

at Key2 :

Position.x = 1

I want it not lerping. i mean i want it appear at posX 0 and posX 1. not between 0~1.

what should i do?

sentences:
opengl shadow map peter panning effect I am implementing the shadow map in opengl with opentk everything works fine except I have a peter panning effect that I can't solve it by changing the face culling to front then render to the depth buffer.

the model is large so I scale it to  small value to render it to the shadow map.

what is the reason that may cause this problem?

sentences:
Can a texture's UV coordinates be animated (scrolled) when part of a SpriteSheet? Alright so my question is about texture manipulation in Flash Stage3D / Context3D using AGAL for the shader language. But I'm pretty sure this could be applicable in other situations involving GPU programming.

So the goal is, if I wish to have a "scrolling" animation on a certain tile (like a tile of water), can I still have that texture packed along with all the rest of my sprite assets? Or does it have to be alone to avoid bleeding nearby assets?

From what I can understand, when the FragmentShader samples the portion of the texture offsetted during a scroll animation, any coordinates outside the desired texture will reveal incorrect nearby textures.

Some example to clarify:

Fluid motion (lava, water waves, acid bubbles);
Background motion (cloud, trees, houses);
Directional indicators (lines on a conveyor belt, race-circuit dash regions);

Do I need to use some extra operations to wrap the texture if it tries to sample beyond a certain point? How could those constraints be defined / transferred to the FragmentShader?

- UPDATE -

To clarify, I would like to scroll only on 1 single tile that would be part of a SpriteSheet / TextureAtlas (meaning, mixed with other existing sprites part of a game / project).

Imagine you had something like this (but better artwork, of course):

So a 256 x 256 Texture with a "Wavy Water" tile in the top-left corner (128 x 128 in dimensions).

How would you write a shader that can scroll through ONLY the water portion to give a sense of motion without running over the adjacent textures (ex: faces and cars).

How would you handle situations where the Quad is much larger than the texture and could repeat many times as well in combination to being able to scroll it?

sentences:
Rendering (rasterization / ray tracing / others) I'm completely new to this graphics and game development. I have read about Rendering (drawing a 3D graphic on a display 2D) and there are many ways of rendering, Rasterization, Ray tracing, radiosity, ray casting. And my doubt is if OpenGl implements one of these. I mean with OpenGL I can draw lines, circles and so on, so there should be a rendering algorithm on OpenGL, am I right? Which one is it?

What if I want to implement a different rendering algorithm, does this mean I'm no longer using OpenGL?

sentences:
How to calculate whether a cuboids face edge is infront of or behind another for sorting I'm building an isometric game, I want to position and sort objects in a particular way.
All my entities have 3d bounds which determines their cuboid, looking my example, a different edge is used to decide if a cuboid is in front of another, depending on whether the point b2 is left or right of a2.

I have already calculated all the points a1,a2,b1,b2 which are x,y,z
I think I basically need to virtually draw "aedge" and "bedge", and compare some intersection.

If b2 is right of a2 the green cuboid (b) is consider in front of the red cuboid when bline is south east of aline.

If b2 is left of a2 the green cuboid (b) is considered in front of the red cuboid when bline is south west of aline.

Please forgive my ignorance here, I'm sure there's some terminology I should have used here. I'm struggling to put down in words what it is I need.

sentences:
How hard is it to build for other platforms using the Unreal Engine 3? Quick question to those that have used the Unreal 3 Engine for development. (Not the UDK).

How much work would it take to take a game made on/for Windows and output a working build on another platform?

Is it as simple as "File -> Export -> PS3" (or similar) or is there much programming involved?

sentences:
ColorMaterial:AmbientAndDiffuse equivalent for CG\HLSL I have this shader written on shaderlab, which replaces Ambient and Diffuse values of the material, because I need to tweak vertices colors from the script.

Shader "VertexSimple"
{
    Properties
    {
        _MainTex ("Base (RGB)", 2D) = "white" {}
    }

    SubShader
    {
        Pass
        {
            ColorMaterial AmbientAndDiffuse
            Lighting Off

            SetTexture [_MainTex]
            {
                Combine texture * primary
            }
        }
    }
    Fallback "VertexLit"
}

I need to write an equivalent of this shader on CG\HLSL to do some other routines in it. Ideally it should be vertex\pixel shaders, not surface one. How can I do this?

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:
change texture at runtime How can I change the texture at runtime. I have done changing the label(text) at runtime. The following code is used

using UnityEngine;
using System.Collections;

public class switchtime : MonoBehaviour {

    // Use this for initialization
    private bool showLabel = false;
    private bool showLabe2 = false;
    private bool showLabe3 = false;
    private bool showLabe4 = false;

    public void Start() {
        Invoke("ToggleLabel", 1);
        Invoke("ToggleLabel2", 3);
        Invoke("ToggleLabel3",6 );
        Invoke("ToggleLabel4", 9);
    }

    public void ToggleLabel() {
        showLabel = !showLabel;

    }
    public void ToggleLabel2() {

        showLabe2 = !showLabe2;
    }
    public void ToggleLabel3() {

        showLabe3 = !showLabe3;
    }
    public void ToggleLabel4() {

        showLabe4 = !showLabe4;
    }

    public void OnGUI() {
        if (showLabel) {
            GUI.Label(new Rect(300, 200, 100, 20), "Copying window file..");

        }
        if (showLabe2) {

            GUI.Label(new Rect(40, 40, 100, 20), "Epanding windows file..");
        }
        if (showLabe3) {

            GUI.Label(new Rect(80, 80, 100, 20), "Installing Feature..");
        }
        if (showLabe4) {

            GUI.Label(new Rect(100, 100, 100, 20), "Installing Updates");
        }
    }
}

Now I need to change the GUITexture at runtime. How can do this? Can anybody help me in coding?

Here is some changes I made. I worked on changing the gameObject when mouse is placed on it. This is the code I applied and its working for me

using UnityEngine;
using System.Collections;

public class change : MonoBehaviour {

    // Use this for initialization
    public GameObject newSprite;

    private Vector3 currentSpritePosition;
    void update()
    {
    }

    void Start()
    {
        newSprite.renderer.enabled = false;
        currentSpritePosition = transform.position;

        //then make it invisible
        renderer.enabled = false;

        //give the new sprite the position of the latter
        newSprite.transform.position = currentSpritePosition;

        //then make it visible
        newSprite.renderer.enabled = true;
    }

    void OnMouseExit(){
        //just the reverse process
        renderer.enabled = true;
        newSprite.renderer.enabled = false;
    }
}

Now the problem is that, in same code I need to set a time so that the text get loaded without the mouse click. I mean a particular time to load each text one after the another.

Here  is my screen shot

Here I have placed the image one below the another,when the mouse is hovered on it it will change the text from bold to normal text.Changes process stated in (image 2,3).That code I posted is working for me.

sentences:
The most popular Resolutions and Aspect Ratios in Android OS 2019 I develop the game with Libgdx framework. When I tried to deal with support multiple screen resolutions it turns out that Libgdx is not following Android approach how to deal with Screen sizes and densities (mdpi, hdpi, xhdpi, etc folders).

I found only one way to handle assets - ResolutionFileResolver.
I have to create folders with different resolutions and the Libgdx choose more appropriate texture for me automatically for each device.

Android platform has a huge amount of Phones and Tables with different screen resolutions. I have to find a good strategy on how to handle it.

For example let's take a look at the case where I have 2 folders in my game: "800x480" and "1440x2560". The device on which I run the game has "1280x720". In this case, "800x480" resolution will be chosen as more appropriate. It leads to bad quality of the Textures because of stretching.
At the same time, I can't leave only one asset with high quality. It leads to cut all older devices with a small amount of RAM.

The idea is to create 3 most popular resolutions for 3 categories:
low, middle and high resolutions.

Where can I find some statistic about the resolutions popularity of Android Devices? I know about the Android Developer Dashboard but it doesn't show Screen Resolutions.
Does anyone use Libgdx in 2019? How to deal with Multiple Screen Support in this framework?
Any real statistic about the most popular Aspect Ratio? Which aspect ratio you choose as "basic" in your games?

I would love to see any "best practice" how to cover as many devices as possible with the good quality of the view.

sentences: How to integrate images into text lines in Unity? Here are two screenshots from Stellaris, where images are seamlessly integrated into the text. How can I achieve this in Unity?

sentences:
Inifinite scrolling draggable background for a 2D editor I need to create something like blender's Node Editor for my 2D editor. Now I am not sure how to create the background so it is static infinite and draggable simillar to blender.

I need to make it so it doesn't wreck my GPU and that its infinite and can be zoomed in and out without a problem

Can anyone give me tips on where to start?

sentences:
How to get Unity's 4.6 UI images to layer over each other perfectly? I've been noticing that if I have two images, lets say squares. I have  A as the parent of triangle B. Triangle A and B both have their offsets at their anchors, which are on the 4 corners of it's "box".

Triangle A should be behind triangle B, since it renders from top to bottom in the hierarchy (the last item being on top). However as I re-size my screen, sometimes triangle  A will poke out from behind triangle B. Even if they both are using the same image, and have the exact same dimensions.

Whats causing this, and how do I fix it?

Additionally, I noticed that while the anchors and offsets can be finely adjusted, the image is not. You have to adjust by certain interval sizes and the image will just snap to that new size rather than adjusting finely as you change the offset or anchors.

sentences:
Are there any preexisting maps for a Minecraft-like level I could use in my engine? I am working on a tiny cube-based engine like Minecraft. I was wondering if there is a way for me to get large blocky terrain in a text format that I can use for rendering on my engine?

I don't want to start on procedural generation now, I just want a resource where I can get the coord list for a pretty looking terrain.

Alternatively, is it possible for me to parse the Minecraft world files and use that data to generate terrain/buildings in my code?

sentences:
How do I set a scene up for two players? I´m finishing a game in Unity, but I have a new requirement: make it multiplayer. I will do this by splitting the screen and running two instances.

Is there a way to instance a scene twice at the same time, and render them two a different part of the screen? Alternativley, what is the best approach to achieve this?

sentences:
How can I find a projectile's launch angle? I am making a 2d game in which units fire arrows at each other.
I know the shooter's and the target's position and the initial velocity of the projectile. I want to know the angle the projectile should have in order to land on the target. The target could be at a different height than the shooter.

To sum up I know v0, R and g and I need to find the angle (or the height ?).

I read http://en.wikipedia.org/wiki/Projectile_motion ,but I can't find something related to what I need.

sentences:
How to position/transform vertices for 2D UI in shaders? I am building a 3D engine and have a rendering abstraction that focuses on writing shaders. Most my 3D shaders have gl_Position output like:

gl_Position = projection * view * model * vec4(position, 1);

I would like to draw some 2D UI on top of all the 3D draw calls. I am having a hard time understanding how to do this.

Let's say I wanted to draw a HUD player life bar that is fixed to the bottom left corner of the screen. I can imagine drawing a quad. and maybe applying a texture to it. I would have 4 vertices for the quad to feed to the shader. How would I change the gl_Position calculation to handle drawing only to 2D screen space? Would I update the transformation to only apply the projection matrix?

gl_Position = projection * vec4(position, 0, 1);

How to determine the local coordinates of the quad verts? When the screen scales or resolution varies, How to ensure the quad stays positioned to the lower bottom screen? How to ensure the quad dimensions stay the same ratio?

sentences:
Key Handling mechanics I am new to game development and am working on my first game using OpenGL and C++.
I have a game class which handles everything necessary in an update() function.
Now i want to handle keyboard inputs. I use GLFW which supports key callbacks. However i wonder how to deal with inputs. Should i record the keys pressed and poll on it the next time my game updates or should the callback immediately perform the necessary actions? And why?

Thanks :)

sentences:
Accidental noise - Gradient function Related to my previous question (2D Terra(ria)in generation - Accidental noise) I'm stuck on understanding how the gradient function itself works (in the Accidental library).

After help on chat (thanks Jon!) I understand that upon defining the gradient, for example, Gradient(0,0,0,1), it returns a function that upon its turn would return correct values between 0 & 1 for the arguments you provide.

So calling the this function with (0,40) would give you a value back between (0,1). However, I don't understand how it would do this without knowing the outer "range".

E.g. If you'd render the gradient image that's shown on his site:

Would you do that by defining the gradient(0,0,0,1) and then calling it for each pixel? (0,1) (0,2), (50,50),...? In that case, pixel (0,200) would have to return 1, but if you'd have an image of 400 pixels high, (0,200) would have to return 0.5

And calling it with values between (0,0) & (0,1) with predefined steps (1/200 or 1/400 for example), seems to make the gradient noise function itself rather useless.

If possible, pseudo or python code would be very welcome to illustrate how the "internals" on that gradient function would work, perhaps I'm thinking of it too complex.

Thanks in advance!

sentences:
`setVelocity` allows body to pass through bodies In my game, I'm using cocos2d-x and I wanted to have an object that changes direction immediately, so I used setVelocity() on the physics body to do that.

However, when I do that it can run through my physics body that surrounds the screen.  It bumps into it, but ultimately, it gets through.  I tried increasing how thick this other body is, and that does successfully prevent it from getting all the way through, but it still makes progress into the body before getting ejected out.

So, for now, I have changed it to move by calling applyImpulse().  With this method, it hits the edge and works the way I'd expect.  However, the movement behavior is different than I'd like for this case.

Some have said that they increased the number of substeps taken by the physics engine.  I could do that, but it feels like something else is wrong.

Has anyone run into this before?

sentences:
Efficient tile maps in Corona SDK I need to create a tile map based level system for Corona SDK that loads files created with Tiled [1]. It also needs to support user touch scrolling and zooming.

I've searched the Corona forums for possible solutions but the ones they talk about don't convince me. They basically have a matrix of Sprite objects which have an image loaded and a given position. That makes scrolling and zooming a bit hard.

Any better ideas?

[1] http://www.mapeditor.org/

sentences:
Can you use A* to make a unit move nonspecifically? A* is typically used to calculate the best way to move towards something, and it's quite flexible when it comes to threats, extra movement costs, and 'refuelling' on the way to something.

However, if you designate only threats, perhaps with a main threat first and foremost, can you use it for "finding somewhere to go"? What about adding both threats, safety, resources and other such heuristic influencers to determine what a unit does when idle?

sentences:
Create bullet physics rigid body along the vertices of a blender model I am working on my first 3D game, for iphone, and I am using Blender to create models, Cocos3D game engine and Bullet for physics simulation. I am trying to learn the use of physics engine.

What I have done

I have created a small model in blender which contains a Cube (default blender cube) at the origin and a UVSphere hovering exactly on top of this cube (without touching the cube)

I saved the file to get MyModel.blend. Then I used

File -> Export -> PVRGeoPOD (.pod/.h/.cpp)

in Blender to export the model to .pod format to use along with Cocos3D.

In the coding side, I added necessary bullet files to my Cocos3D template project in XCode.

I am also using a bullet objective C wrapper.

-(void) initializeScene {
    _physicsWorld = [[CC3PhysicsWorld alloc] init];
    [_physicsWorld setGravity:0 y:-9.8 z:0];

    /*Setup camera, lamp etc.*/
    ..........
    ...........

    /*Add models created in blender to scene*/
    [self addContentFromPODFile: @"MyModel.pod"];

    /*Create OpenGL ES buffers*/
    [self createGLBuffers];

    /*get models*/
    CC3MeshNode* cubeNode    = (CC3MeshNode*)[self getNodeNamed:@"Cube"];
    CC3MeshNode* sphereNode  = (CC3MeshNode*)[self getNodeNamed:@"Sphere"];

    /*Those boring grey colors..*/
    [cubeNode setColor:ccc3(255, 255, 0)];
    [sphereNode setColor:ccc3(255, 0, 0)];

    float *cVertexData  = (float*)((CC3VertexArrayMesh*)cubeNode.mesh).vertexLocations.vertices;
    int cVertexCount    = (CC3VertexArrayMesh*)cubeNode.mesh).vertexLocations.vertexCount;

    btTriangleMesh* cTriangleMesh  = new btTriangleMesh();

//    for (int i = 0; i < cVertexCount * 3; i+=3) {
//        printf("\n%f", cVertexData[i]);
//        printf("\n%f", cVertexData[i+1]);
//        printf("\n%f", cVertexData[i+2]);
//    }

    /*Trying to create a triangle mesh that curresponds the cube in 3D space.*/
    int offset = 0;
    for (int i = 0; i < (cVertexCount / 3); i++){
        unsigned int index1 = offset;
    unsigned int index2 = offset+6;
    unsigned int index3 = offset+12;
    cTriangleMesh->addTriangle(
           btVector3(cVertexData[index1], cVertexData[index1+1], cVertexData[index1+2] ),
           btVector3(cVertexData[index2], cVertexData[index2+1], cVertexData[index2+2] ),
           btVector3(cVertexData[index3], cVertexData[index3+1], cVertexData[index3+2]
        ));
        offset += 18;
    }

    [self releaseRedundantData];

    /*Create a collision shape from triangle mesh*/
    btBvhTriangleMeshShape* cTriMeshShape   =   new btBvhTriangleMeshShape(cTriangleMesh,true);
    btCollisionShape *sphereShape =   new btSphereShape(1);

    /*Create physics objects*/
    gTriMeshObject  = [_physicsWorld createPhysicsObjectTrimesh:cubeNode shape:cTriMeshShape mass:0 restitution:1.0 position:cubeNode.location];
    sphereObject    = [_physicsWorld createPhysicsObject:sphereNode shape:sphereShape mass:1 restitution:0.1 position:sphereNode.location];
    sphereObject.rigidBody->setDamping(0.1,0.8);
}

When I run the sphere and cube shows up fine. I expect the sphere object to fall directly on top of the cube, since I have given it a mass of 1 and the physics world gravity is given as -9.8 in y direction. But What is happening the spere rotates around cube three or times and then just jumps out of the scene. Then I know I have some basic misunderstanding about the whole process.

So my question is, how can I create a physics collision shape which corresponds to the shape of a particular mesh model. I may need complex shapes than cube and sphere, but before going into them I want to understand the concepts.

sentences:
Distributed C++ game server which use database My C++ turn-based game server (which uses database) does not stand against current average amount of clients (players), so I want to expand it to multiple (more then one) amount of computers and databases where all clients still will remain within single game world (servers will must communicate with each other and use multiple databases).

Is there some tutorials/books/common standards which explain how to do it in a best way?

sentences:
How to add a bump map in scene kit? I'm trying to draw an Earth, as I've found the textures in this site: http://planetpixelemporium.com/earth.html

I loaded the diffuse, specular and bump maps:

let earthGeometry = SCNSphere(radius: radius)

let earthMap = UIImage(named: "Earth_map")
let earthBump = UIImage(named: "Earth_bump")
let earthSpec = UIImage(named: "Earth_specular")

earthGeometry.firstMaterial!.diffuse.contents = earthMap
earthGeometry.firstMaterial!.specular.contents = earthSpec

let earth = SCNNode(geometry: earthGeometry)

But there is no property for the bump map. The only way that comes to my mind is to use a MDLMaterial but I see no way to convert the material back to a SCNMaterial. The method:

+ (instancetype)materialWithMDLMaterial:(MDLMaterial *)mdlMaterial

Runs just in Objective-C and not in Swift. Does anyone know how to convert it to a SCNMaterial, or alternatively to use another way to apply a bump map in a SCNMaterial?

sentences:
Reading text from file changes the text? I'm currently trying to load a simple text file and filter it by a certain string. In the text file I'm using a new line for each value and sometimes use a "--" to make things easier to read for me when viewing the .txt-file.

Now, when I load the file and split it by new lines I end up with a list of substrings, each representing a value I need. Plus, all the "seperators" I put into the file.

My goal is to clean the list from all the seperators and basically just remove them from the list. However, RemoveAll does not work and I found out that the strings containing "--" are not really "--", but something else, because using string.Equals("--") fails on them.

Somewhere when reading the data or splitting it, something happened to those parts, but I can't figure out what's happening.

Here's the code:
void Awake() {

    _fileLines = new List<string>();

    TextAsset txt = Resources.Load<TextAsset>("SubjectPages/test");
    _fileLines = new List<string>();
    _fileLines = txt.text.Split(new string[] { "\n" }, System.StringSplitOptions.None).ToList<string>();

    _fileLines.RemoveAll(x => ((string)x) == "");
    _fileLines.RemoveAll(x => ((string)x) == "--");

    for (int i = 0; i < _fileLines.Count; i++) {
        Debug.Log(_fileLines[i] + " | " + (_fileLines[i].Equals("--")) + " | " + (_fileLines[i] == "--"));
    }
}

Removing empty lines with RemoveAll seems to work fine.

sentences:
Pipe connection game algorithm - Java/Andengine I am creating a game based on Pipe Dream/Pipe Mania using java/andengine for android. I have a square grid of tiles each representing a type of pipe. The player needs to swap tiles to connect the pipes from point A to B.

How do I determine if the pipes are connected to starting point A? How do I then find how far a connected path goes? How do I determine if the path connects point A to point B? How do I handle the switching of tiles which may be in the middle of the path?

This functionality will be almost the same as the pipe mini game in the first Bioshock game.

I am looking for advice on how to go about tackling this problem.

sentences:
Procedural river or road generation for infinite terrain I should say paths, not roads as I'm thinking more medieval-like. Also, not looking for realism. The answer I'm looking for will be to fit into the mold I describe rather than realism.

I am looking for a method to generate procedural roads/rivers in a curvy sort of fashion, but I'm wanting to do so for a infinite terrain type system. Just like how perlin noise generates blobs, I'm wanting to generate random length line segments (possibly infinite length).

I'm aware of strategies like the suggested answer found here, however it relies on a specified start and end point to work, I don't have a specified start and end point. I'd like to be able to simply call a function using arbitrary coordinates and have it return whether the specific coordinates are part of the river/road.

I am not wanting to require terrain to be generated in advance. That includes a heightmap (like used for rainfall simulations or similar). I would also not want to require a start/end point.

Is there such an algorithm or tweak to a noise algorithm someone might know of to accomplish what I'm trying to explain?

The closest I've came to so far is multi-ridged fractals, if I'm using the name properly. I'm just taking the absolute value of value noise (assuming it is scaled to -1 to +1) and setting a threshold. My primary issue with this is the lines overlap way too often, are mostly circular, sometimes converge to form large lakes which is neat but undesired, and often times the thickness of the lines vary too much.

Here's a picture of what I have so far in 2D, but at a very high frequency to show more detail:

sentences:
Enable and disable different component on a Gameobject So far I am not clear how do you actually access the various components on a game object, to enable and disable them.

I have a component that has various scripts and elements, like a camera, transform, audio listener and few other custom scripts.

It is in the scene, so I try to access to it via script:

private GameObject _player;

_player = GameObject.Find("the_player")

So far so good; if I want to access for example to the camera, and enable or disable it, I can do it

    _player.GetComponent<Camera>().enabled = true;

This disable correctly the camera, or eanble it, depending from the paramenter that I pass.

Now, if I want to access my script, called "playerscript"; I can't do the same thing, since I get an error:

    _player.GetComponent<playerscript>().enabled = true;

Not sure why I get an error; I have a class that is called "playerscript", that is attached to that _player object, but instead, VS complain.

This is the error message:

Error   CS0246  The type or namespace name 'playerscript' could not be found (are you missing a using directive or an assembly reference?)

I did try to use also GetComponentInChildren, but the result is the same.

If I have the object _player, which hold a reference to the original game object instantiated in the scene, why I can't simply access all the elements attached to it, via GetComponent and dot notation? I believe this used to work time ago, but in Unity5 I can't get this to work.

EDIT: This is the content of the playerscript class:

using UnityEngine;
using System.Collections;

public class playerscript : MonoBehaviour
{
    // Use this for initialization
    void Start()
    {
        // get the instance of the button from UI manager
    }

    void OnTriggerEnter(Collider world_item)
    {
        //enable item animation
    }

    void OnTriggerExit(Collider world_item)
    {
        //disable item animation
    }
}

sentences:
Why is the button's code not running? My script for a slot machine isn't working. When the button in the Bilboard GUI is clicked, the below dosen't run. I am new to scripting and this is mostly based on wiki/stack exchange/ Dev page info.

local player = game.Players.LocalPlayer
local textLabel = script.Parent
local toggled = false
local button = script.Parent

textLabel.Text = "Click to Play for 5 Cash!"
slot1Combos = {"Bar", "Seven", "Seven", "Seven", "Cherry", "Cherry", "Cherry", "Cherry", "Orange", "Orange", "Orange", "Orange", "Orange", "Lemon", "Lemon", "Lemon", "Lemon", "Lemon", "Banana", "Banana", "Banana", "Banana", "Banana"}
slot2Combos = {"Bar", "Seven", "Cherry", "Cherry", "Cherry", "Orange", "Orange", "Orange", "Orange", "Orange","Orange","Lemon", "Lemon", "Lemon", "Lemon", "Lemon", "Lemon", "Banana", "Banana", "Banana", "Banana", "Banana", "Banana"}
slot3Combos = {"Bar", "Seven", "Cherry", "Cherry", "Cherry", "Orange", "Orange", "Orange", "Orange", "Orange","Orange","Lemon", "Lemon", "Lemon", "Lemon", "Lemon", "Lemon", "Banana", "Banana", "Banana", "Banana", "Banana", "Banana"}

local function onButtonActivated()
    if toggled == false then
        toggled = true

        x = math.random(1,23)
        y = math.random(1,23)
        z = math.random(1,23)
        g = false
        player.leaderstats[currencyName].Value = player.leaderstats[currencyName].Value - 5
        if slot1Combos[math.floor(x)] == "Bar" and slot2Combos[math.floor(y)] == "Bar" and slot3Combos[math.floor(z)] == "Bar" then
            player.leaderstats[currencyName].Value = player.leaderstats[currencyName].Value + 60
            textLabel.Text = "You Got 3 Bars. You won 60 cash"
            wait(5)
            textLabel.Text = "Click to Play for 5 Cash!"
        elseif slot1Combos[math.floor(x)] == "Seven" and slot2Combos[math.floor(y)] == "Seven" and slot3Combos[math.floor(z)] == slot2Combos[math.floor(y)] then
            player.leaderstats[currencyName].Value = player.leaderstats[currencyName].Value + 40
            textLabel.Text = "You Got 3 Sevens. You won 40 cash"
            wait(5)
            textLabel.Text = "Click to Play for 5 Cash!"
        elseif slot1Combos[math.floor(x)] == slot2Combos[math.floor(y)] and slot3Combos[math.floor(z)] == slot2Combos[math.floor(y)] then
            player.leaderstats[currencyName].Value = player.leaderstats[currencyName].Value + 10
            textLabel.Text = "You Got 3 of a Kind. You won 10 cash"
            wait(5)
            textLabel.Text = "Click to Play for 5 Cash!"

        elseif slot1Combos[math.floor(x)] == "Cherry" and slot2Combos[math.floor(y)] == "Cherry" and slot3Combos[math.floor(z)] == "Cherry" then
            player.leaderstats[currencyName].Value = player.leaderstats[currencyName].Value + 20
            textLabel.Text = "You Got 3 Cherries. You won 20 cash"
            wait(5)
            textLabel.Text = "Click to Play for 5 Cash!"
        elseif slot1Combos[math.floor(x)] == "Cherry" and slot2Combos[math.floor(y)] == "Cherry" or slot3Combos[math.floor(z)] == "Cherry" and slot1Combos[math.floor(x)] == "Cherry" or slot2Combos[math.floor(y)] == "Cherry" then
            player.leaderstats[currencyName].Value = player.leaderstats[currencyName].Value + 3
            textLabel.Text = "You Got 2 Cherries. You won 3 cash"
            wait(5)
            textLabel.Text = "Click to Play for 5 Cash!"
        elseif slot1Combos[math.floor(x)] == "Cherry" or  slot2Combos[math.floor(y)] == "Cherry" or  slot3Combos[math.floor(y)] == "Cherry" then
            player.leaderstats[currencyName].Value = player.leaderstats[currencyName].Value + 3
            textLabel.Text = "You Got 1 Cherry. You won 3 cash"
        else
            textLabel.Text = "Sorry, you didn't win"
            wait (5)
            textLabel.Text = "Click to Play for 5 Cash!"

        end
    end
button.Activated:Connect(onButtonActivated)
end)

This is the explorer tree with the script highlighted

sentences:
Acceptable sound quality: stereo needed for an Android game? I have various simple short sound effects (damage sound, dying sound, thunderbolt, fanfare, breaking) for a game that is developed for Android currently.

I use OGG files: 96kbps VBR, 44.1KHz, 2 channels (that means stereo, right?).

I read the other stackexchange topics about "acceptable sound quality", but they're too general, address too many things. My experience is that even with 80kbps, my effects sound OK. But I tested it on a limited number of Android devices (including a Sony Ericsson Xperia Neo and a HTC Desire HD). My questions:

For mobile phones and tablets, generally, what parameters are recommended? Won't my 80kbps sounds be bad on a newer device (such as a modern tablet)?
I don't hear any difference between stereo and mono (2 channels vs. 1 channel, right?), is there any noticeable difference at all for mobile phones / tablets? (in terms of the player experience) May it worth it at all? I assume that stereo sounds take much more in memory (when they're decoded to PCM), despite of the fact that the compressed OGG size is practically the same.

Reacting to Roy T.'s great comment:

Actually, I couldn't measure the PCM size (Android decodes OGG
internally), but I thought that stereo will take more space than
mono when uncompressed
After throwing out one of the WAV channels in Audacity, and re-exporting it:

The new WAV file size is half than before
The OGG file size is practically the same as before

The sound effects and game music was recorded by my friend who is an experienced hobby musician/composer, but he knows little about computers & software so he just gave me some high-quality WAV files generated via his hardware.These were stereo, but if I check them in Audacity, both channels appear to be exactly the same.Can I consider them the same (=> moving to mono), or might there be some unnoticeable differences to the human eye?

sentences:
Generate 2D Triangular Mesh from Vertices on a Map Given a map of vertices {(x1,y1), (x2,y2), ... (xn,yn)}, how can I generate a 2D triangular mesh covering all vertices, and where the area of all triangles completely covers the map?

The triangular areas may fully enclose other triangular areas, but no two triangles may intersect.

sentences:
Find References In Scene of scriptable object unity asset shows incorrect results I'm trying to work out why my game is loading a large sprite atlas that I don't think it should be. The snapshot view of the profiler shows that the atlas is loaded. The references pane shows that it's loaded through a scriptable asset object. That object does indeed reference the sprites in the atlas - but I don't think the object is referenced in the scene at the moment. The game boots to this scene, so the atlas should not be loaded.

I've replicated this profiling on both the editor and on android, so it's not an editor-only thing.

When I right-click on the scriptable object in the project view, while the game is running, and Find References In Scene, it shows a few game objects. None of these objects seem to reference the scriptable object. None even have monobehaviours with fields for this type of scriptable object. Some are new-UI button objects, that have Canvas Renderer, Image and Button scripts only. None of which could be referencing this scriptable object.

Has anyone seen this behaviour before? What's going on?

sentences:
Texture Region drawing issue with LibGDX I am currently moving my old slick2d project to libgdx. I have created a custom AnimationExt class that extends Animation to which I added a draw method. The Animation's frames are actually TextureRegion so I draw current frame TextureRegion. Here is the code, it's pretty simple.

    public class AnimationExt extends Animation {

    float stateTime=0;
    TextureRegion currentFrame=null;
    boolean isStopped=false;

    public void draw(SpriteBatch batch,float x, float y,int originX, int originY, float xscale, float yscale, boolean hMirror, boolean vMirror, float angle, boolean clockwise){
        if(isStopped==false){
            stateTime += Gdx.graphics.getDeltaTime();
            currentFrame=getKeyFrame(stateTime);

        }else{
            currentFrame=getKeyFrame(stateTime);
        }
        batch.draw(currentFrame, x-currentFrame.getRegionWidth()/2, y-currentFrame.getRegionHeight()/2,currentFrame.getRegionWidth(),currentFrame.getRegionHeight());
        }

    public AnimationExt(float frameDuration,
            Array<? extends TextureRegion> keyFrames, int playType) {
        super(frameDuration, keyFrames, playType);
    }
}

This code works well. BUT when I add parameters to the batch.draw method (originX, originY, scaleX, scaleY, angle, clockwise) like this:

batch.draw(currentFrame, x-currentFrame.getRegionWidth()/2, y-currentFrame.getRegionHeight()/2,originX,originY,currentFrame.getRegionWidth(),currentFrame.getRegionHeight(),xscale,yscale,angle,clockwise);

The drawing method goes crazy: it draws the texture rotated to -90 (whereas the angle I entered was 0) and it the width and height are inverted. To fix this I had to do change the code like that :

batch.draw(currentFrame, x+currentFrame.getRegionWidth()/2, y-currentFrame.getRegionHeight()/2,originX,originY,currentFrame.getRegionHeight(),currentFrame.getRegionWidth(),xscale,yscale,90+angle,clockwise);

But I don't want to keep this code as I'm pretty sure it's weird and I want to know why does the drawing method have such a weird behaviour when adding more parameters.
By the way, I'm using the very last nightly builds of 17th June.

sentences:
Bold black bar on right side of game in Unity (Android) I am trying to create an endless runner. I have already created a system to generate infinite backgrounds from an array of some. However, on running the game, I get huge black bar on the right side of the screen, both on PC and on Android phone.

Here are the screenshots :

One more thing, on Android, it doesn't even display the left side of the game, i.e, where the character is. It looks like the things are displaced towards left.

Also, the game is a scrolling on and everything is scrolling but behind that bar. It just doesn't go.

I hope I can get some help. Ask me if you need any piece of code.

EDIT :

"CameraFollow" script

 using UnityEngine;
using System.Collections;

public class CameraFollow : MonoBehaviour {

    public GameObject targetObject;
    private float distanceToTarget;

    // Use this for initialization
    void Start () {
        distanceToTarget = transform.position.x - targetObject.transform.position.x;

    }

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

        float targetObjectX = targetObject.transform.position.x;

        Vector3 newCameraPosition = transform.position;
        newCameraPosition.x = targetObjectX + distanceToTarget;
        transform.position = newCameraPosition;
    }
}

My "GeneratorScript"

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

public class GeneratorScript : MonoBehaviour {

    public GameObject[] availableRooms;

    public List<GameObject> currentRooms;

    private float screenWidthInPoints;

    // Use this for initialization
    void Start () {
        float height = 0.0f * Camera.main.orthographicSize;
        screenWidthInPoints = height * (Camera.main.targetDisplay);
    }

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

    }

    void FixedUpdate()
    {
        GenerateRoomIfRequred ();
    }

    void AddRoom(float farhtestRoomEndX)
    {
        int randomRoomIndex = Random.Range (0, availableRooms.Length);

        GameObject room = (GameObject)Instantiate (availableRooms [randomRoomIndex]);

        float roomWidth = room.transform.FindChild ("floor").localScale.x;

        float roomCenter = farhtestRoomEndX + roomWidth * 3.0f;

        room.transform.position = new Vector3 (roomCenter, 0, 0);

        currentRooms.Add (room);
    }

    void GenerateRoomIfRequred()
    {
        //1
        List<GameObject> roomsToRemove = new List<GameObject>();

        //2
        bool addRooms = true;

        //3
        float playerX = transform.position.x;

        //4
        float removeRoomX = playerX - screenWidthInPoints;

        //5
        float addRoomX = playerX + screenWidthInPoints;

        //6
        float farhtestRoomEndX = 0;

        foreach(var room in currentRooms)
        {
            //7
            float roomWidth = room.transform.FindChild("floor").localScale.x;
            float roomStartX = room.transform.position.x - roomWidth * 6.0f;
            float roomEndX = roomStartX + (roomWidth * 13.0f);

            //8
            if (roomStartX > addRoomX)
                addRooms = false;

            //9
            if (roomEndX < removeRoomX)
                roomsToRemove.Add(room);

            //10
            farhtestRoomEndX = Mathf.Max(farhtestRoomEndX, roomEndX);
        }

        //11
        foreach(var room in roomsToRemove)
        {
            currentRooms.Remove(room);
            Destroy(room);
        }

        //12
        if (addRooms)
            AddRoom(farhtestRoomEndX);
    }

}

(I tried playing with the numbers on GeneratorScript, but nothing seemed to help.

sentences:
Issues with 2D Body/Limb system In my game I have programmed Body and Limb classes. The Body is guaranteed to have an origin in the center of its sprite. The Body class has a List of children Limbs, each with their own offset. Every Limb has a Master value which references the parent Body, but it also has a Parent value which references the Limb it is a child of. However, Limbs do not have to have a parent, they can directly connect to the Body.

The Master, Parent, and Children values of the Limb class:

    //Body containing all limbs this limb is connected to and others.
    public Body Master
    { get; set; }

    //Parent limb, if null then limb directly connected to the body.
    public Limb Parent
    { get; set; }

    //Children limbs
    public List<Limb> Children
    { get; set; }

The Limb methods have if statements to handle these situations. In relation to the offsets and rotations of the Limbs around the Body (using transformation matrices) things seem to work fine. Now, the problem I'm having is when a Limb is attached to another Limb. The child Limb draws and behaves as if it is rotating around the Body instead of its parent Limb, and the parent Limb itself vanishes. Limbs without Children that are directly connected to the Master Body have no issues. Because of this sort of recursive hierarchy I believe the problem has to do with reference types but I may be mistaken. Here is some additional code:

Demonstration:

Here is the worldPosition() method which is used to acquire the Limb's position in world space. I suspect it may be the culprit. The Master.Position is already in world space:

    public Vector2 worldPosition()
    {
        if (Parent != null) return (LocalPosition += Parent.worldPosition());
        else return (LocalPosition += Master.Position);
    }

Finally here is the Update() method of the Limb class:
http://pastebin.com/5L5v5p6x

EDIT: Upon further analysis it appears that any changes I make to either Limb seem to affect the other Limb in one way or another even though they are both quite clearly different instances.

Here is the code to make the initial Body and first Limb:

        b = new Body()
        {
            Sprite = FileFactory.Textures["shoulders"],
            Position = new Vector2(this.Position.X, this.Position.Y),
        };

        Limb l = new Limb()
        {
            Sprite = FileFactory.Textures["left_arm"],
            Master = b,
            Offset = new Vector2(2, 13),
            Origin = new Vector2(0, Sprite.Height / 2),
            RotationalDifference = (float)(0.2 * Math.PI),
            RotateSpeed = 0.15f
        };

        b.Children.Add(l);
        b.Initialize();

And the code to add the child Limb to the first (Parent) Limb:

            Children.Add(
            new Limb()
            {
                Sprite = FileFactory.Textures["right_arm"],
                Master = this.Master,
                Parent = this,
                Offset = new Vector2(27, 0),
                Origin = new Vector2(0, Sprite.Height / 2),
                RotationalDifference = (float)(0.2 * Math.PI),
                RotateSpeed = 0.15f
            }
            );

sentences:
How to setup Cocos2D-X (Android) under Mac OS X? Hi I've made a small game for iPhone that I also want to run on Android but I'm having problems setting up Cocos2D-X for Android.

I've downloaded and installed Android SDK and NDK (under my "/Users/username/Android").

Installed all necessary packages under SDK and created an Emulator.
Copied Cocos2D-x under "/Users/username/cocos2dx".

Installed Eclipse IDE with ADT Plugin.

Opened "Users/username/cocos2dx/tests/build_native.sh" and changed "NDK_ROOT_LOCAL=/Users/username/Android/android-ndk", "COCOS2DX_ROOT_LOCAL=/Users/username/cocos2dx" to the values shown.

On running the script using Terminal it compiles test project. What's next?

sentences:
Calculate Distance Using Lifetime, Speed, and Time Between Ticks I am trying to draw a line from the player to where he is facing, with the line being the distance his rockets will travel. I have ShipMissile.Speed, which is the number of pixels to move per tick, LastTick, the number of milliseconds between each call to Update(), and ShipMissile.Lifetime, which is the number of 10 ms ticks that the missile should be alive for. My current code is as follows:

Distance = (int)((ShipMissile.Speed * ((ShipMissile.Lifetime * 10) / LastTick)) * scale);

LastTick is generally 16.6667 (I have never seen it vary from this value during testing), and for this particular missile type Lifetime = 200, which is 2000 ms, Speed = 7, and scale = 1 ('native' game resolution).

The missile moves by using its rotation to generate a normalized vector, then multiplies by Speed and scale each game tick.

EDIT: Like this:

Missile.Position += direction * speed * scale;

I am finding that the line is too short, and am wondering where the flaw in my code is (and please do not mention that I shouldn't be so dependent on frame rate or not be updating Lifetime outside of Update)? Is it even possible with my current (non optimal) setup? Thanks!

EDIT: I know this is kind of late, but here is a picture of what I mean (ignore the other stuff like the enemy and the score, etc):

sentences:
libGDX collision detection / bounding the object I am trying to implement collision detection so I am drawing a red rectangle to see if it is working. When I put the code below into the update method to check if it is going to work the position is not in the right place. The red rectangle starts from the middle and not at the x and y point? So it draws it wrong.

I also have a getter method so nothing wrong there.

bullet.set(getX(), getY(), getOriginX(), getOriginY());

this is for the render

shapeRenderer.begin(ShapeType.Filled);
shapeRenderer.setColor(Color.RED);
shapeRenderer.rect(bullet.getX(), bullet.getY(), bullet.getOriginX(), bullet.getOriginY(), 15, 5, bullet.getRotation());
shapeRenderer.end();

I have tried to do it with a circle but the circle draws in the middle and I want it to be at the tip of the bullet. At the front of the bullet. x, y point.

boundingCircle.set(getX() + getOriginX(), getY() + getOriginY(), 4.0f);

shapeRenderer.begin(ShapeType.Filled);
shapeRenderer.setColor(Color.RED);
shapeRenderer.circle(bullet.getBoundingCircle().x, bullet.getBoundingCircle().y, bullet.getBoundingCircle().radius);
shapeRenderer.end();

I need it to be of the x and y as the bullet is in the middle of the sprite when drawn originally via paint.

sentences:
Drag object with mouse in diagonal direction I have a gameobject which i want to move using mouse. Currently i can do that in x-axis and y-axis:

public bool moveDiagonal;
 public bool moveX, moveY;
 public float distanceXmin, distanceXmax, distanceYmin, distanceYmax;
 if (moveX)
 {
     if (curPosition.x >= distanceXmin && curPosition.x <= distanceXmax)
          goToMove.transform.position = new Vector3(curPosition.x, goToMove.transform.position.y, 0);
 }
 else if (moveY)
 {
    if (curPosition.y >= distanceYmin && curPosition.y <= distanceYmax)
          goToMove.transform.position = new Vector3(goToMove.transform.position.x, curPosition.y, 0);
 }

I wanted to move my object diagonally as well how to do that according to its direction using mouse? The object should move along the line or the x and y axis limits.

sentences:
How to stop the RotateAround function to rotate after Keypress in Unity I have a camera follow script and I am rotating the camera with Q and E key to right and left. The Camera is a child of a camHolder object. I came up with this code, which rotates around the player to the right and left, but it's shaking as it tries to keep rotating around the player.

I didn't come up with a solution to stop the RotateAround function, instead I tried setting rotateSpeed to 0 after I let go of the key, but that didn't work either.

public Transform player;
public float smoothSpeed = 0.125f;
public float rotateSpeed;
private Vector3 velocity = Vector3.zero;

[SerializeField]
private Vector3 offset;

[Space]
public Transform camHolder;

void LateUpdate ()
{
    CameraFollowPlayer();
}

void Update()
{
    RotateCamera();
}

void CameraFollowPlayer()
{
    camHolder.position = Vector3.SmoothDamp(transform.position, player.position + offset,
                                             ref velocity, smoothSpeed * Time.deltaTime);
    transform.LookAt(player.position);
}

void RotateCamera()
{
    if(Input.GetKey (KeyCode.E))
    {
        rotateSpeed += 20f;
        if(rotateSpeed >= 20f)
        {
            rotateSpeed = 20f;
        transform.RotateAround(player.position, transform.up, rotateSpeed * Time.deltaTime);
        }
    }
    else
    {
        rotateSpeed = 0f;
    }

    if(Input.GetKey (KeyCode.Q))
    {
        rotateSpeed += 20f;
        if(rotateSpeed >= 20f)
        {
            rotateSpeed = 20f;
            transform.RotateAround(player.position, transform.up, -rotateSpeed * Time.deltaTime);
        }
    }
    else
    {
        rotateSpeed = 0f;
    }
}

sentences:
Traffic estimation for a multiplayer flash game hey, i want to know if my rough traffic estimations are right, it would be for a pretty simple realtime flashgame in the style of haxball (but not as a soccer game) heres a video of it http://www.youtube.com/watch?v=z_xBdFg1RcI

So here comes my estimation, i dont know if they are realistic! i hope someone can help me.

consider the packet attached as a typical one sent every 200ms, its 148bytes + 64 bytes of header will make around a 200bytes packet. The server will receive 200bytes x 6 players x 5 times a sec=6000bytes/s=5.85Kbytes/s=46.9kbit/s plus he has to send all back to the players, so at this point are 94Kbit/s.The server received all the information, perform the definitive calculation and send the new position to all players, in a bigger packet of around 900bytes that have to be delivered to the others 6, which makes 900bytes x 6 players x 5 times a sec=27000bytes/s=26Kbytes/s=210kbit/s. overall that would be 26kbyte per second. thats like 130mb traffic per hour for a 6player room. but somehow i think the numbers are too high? that would be really much traffic for such a simple game.

did i calculate something wrong?

sentences:
Putting a material on a fractured model I have a square model that has been fractured using blender's cell fracture.
I also have a material that I want to apply onto the broken pieces.
The only problem is that the material needs to be organized in a certain way so it looks right when I replace it with the broken model.
Scripting-wise i'm using Brackey's tutorial for destruction
How can I make the material look the same on both the fractured and the unfractured model?
I also left a picture if it helps.
The one on the left, is the unbroken model with the material. The one on the right is the broken model with all the cells having the same material.

sentences:
jQuery - div border around map area Let's say I have this map:

<map name="diffmap1" id="diffmap1" class="myMap">
<area shape="poly" coords="152,347,253,292,264,307,167,358" class="diff diff1">
<area shape="poly" coords="93,244,164,215,171,233,97,264" class="diff diff2">
</map>

and javascript:

$('.diff').click(function(e){
//code here
});

How can I make when I click on one one 'diff' to make a div with border appear around that 'diff'?

It has to calculate the position automatically, like the margin-top, margin-left and size based on the coordonates.

Any thoughts?

sentences:
Modern shadow rendering techniques? What is the state of the art in terms of shadow rendering? My target is OpenGL 3.2, using a deferred rendering pipeline, if that matters.

It's been years since I looked into shadow rendering, and at that time there were numerous techniques available, from stencils to the various shadow mapping methods. At that time, rendering shadows required separate rendering passes, controlled by the CPU. But then recently I saw a demo where a scene was rendered entirely on the GPU, including shadows. I have no idea how that would have been accomplished, or if it is even a reasonable thing to do (beyond a tech demo).

Given the large amount of old info on the internet, I'd like to learn what methods people are using these days, and how much of it can be pushed to the GPU (assuming my target OpenGL version supports it).

sentences:
Getting Target position at the time of shooting I have a bullet that has to hit a constantly moving enemy.

So, in BulletScript, I have declared a Transform

public Transform enemy;               //and assigned enemy object to it that is continuously moving and changing its position

Now, when I try to use enemy.position in bullet script so as to hit it, enemy.positiongives the position at which the enemy started and not the position at which it was when bulletprefab was shot.

How can I get the updated position of enemy object every time bulletprefab is instantiated.

sentences:
How can I make the Player animation appear smooth? I'm using GLFW for my window and input related work. I'm calculating delta time and multiplying it with my player speed and then finally adding it to the current position of the player. The thing is that, though it makes my motion frame independent the player movement appears to slow and speed up interchangeably. Well the reason would be the different values of delta time at each frame. What should I do to smooth out this animation?

Here is the relevant code, and a capture of what's going on:

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:
How should I actually enforce the effects of components? I asked a question about implementing components here:

Am I on the right track with this component architecture?

But I had more questions I'd like to ask.

What's the best way to actually enforce the effects of components?

For instance, I have an item object, and an optional HealingComponent. The HealingComponent allows the item to be used as a HealingItem (for restoring HP/MP/etc.). I compose the HealingComponent from up to 3 StatAffectorComponents (one for HP, MP and SP). That Affector dictates the target stat, the target amount of change, and the type of change (%, absolute, etc.). All the basic components are being implemented in C++, but I intend to make the basic components extendtable from my scripts (python)

Now my question is, how do I actually enforce this?

I had three ideas about how to do it.

Allow the HealingComponent to contain a Use function that takes in the appropriate parameters and applies the StatAffector components against them. This has the advantage of making it much easier to override/customize the behaviour if I extend it with scripts, but I'm also tightly coupling the mechanics of usage with the item.
Allow the game mechanics to enforce the components. When the item is used as a Healing Item, the mechanics will extract the stat affectors and apply them against the appropriate targets its self. This has the advantage of seperating the item/component from it's usage, but at the same time, I'll have to change the mechanics anytime I decide to add expanded functionality/components to healing items. Healing items may not change their effects too often in development, but certain item classes might
Allow the item itself to define it's Use function and make it responsible for checking against it's components. This is further specializing Item away from a base entity, but has the advantage of being overridable with scripts to allow custom components

In general, what is the best way to do this?

sentences:
At same positioned game objects collision detection In my game, I am creating two game objects at same position using Instantiate statement. Each generated object has box collider attached.

So I want to detect collision between them so I write following code.

void OnCollisionStay(Collision collisionInfo){
   print("on collision stay");
}

But this statement not called. I generate two object using following code.

BallUtility.AddNormalCommonBall (normalBallPref, Vector3.zero);
BallUtility.AddNormalCommonBall (normalBallPref, Vector3.zero);

I need help in collision detection. I already post question in unity forum but I didn't get any reply from there.

sentences:
How is JS source protected in Chrome games? I was playing a space arcade shooter https://moonbreakers.com/ and tried to see some of the JS and shader code. However, I was unable to find anything but some server communication code. Game code is thus probably run on servers, but the shaders should at least be local, right? And I have understood that even if the server runs the true game state, clients commonly do some physics interpolation etc by themselves.

My only guess is that the game gets the code with jQuery and it doesn't show in the page source. Can that code be looked at via a debugger?

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:
How can I use the mouse to draw a filled arc/wedge of a disc? Instead the mouse for testing I tried to use StartCoroutine to set the speed the circle will be drawn. The speed does change according to the seconds to wait but it also showing the radius line from the center:

And

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;

    void Start()
    {
        line = gameObject.GetComponent<LineRenderer>();

        line.positionCount = (segments + 1);
        line.useWorldSpace = false;

        StartCoroutine(CreatePoints());
    }

    private void Update()
    {
        //CreatePoints();
    }

    IEnumerator 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;

            yield return new WaitForSeconds(0.3f);
            line.SetPosition(i, new Vector3(x, 0, z));

            angle += change;
        }
    }
}

My goal is to use the mouse without dragging, only by moving, to draw a circle around the object (instead of drawing the circle automatically). So if I move the mouse only some of the way it will draw only part of the circle.

And I want to make the circle filled.

The circle will be drawn with a fixed radius around the selected object but with the mouse. The mouse movement will decide how much of the circle will be drawn. The idea is to make smooth mouse movement and drawing.

The idea is to use the mouse to draw something like the Handles.DrawSolidArc: an Arc but in the game view not the scene view.

Something like that:

sentences: How do developers implement custom systems (lighting, physics, etc.) in premade game engines that already have these systems, like Unreal or Unity? Unreal has built in systems for stuff like lighting, for example. If a developer wanted to create and use their own lighting system in Unreal, how do they go about doing that? Or are these systems already so customizable that creating a custom system isn't necessary?

sentences:
Animator from another gameobject keeps disappearing from script on play I am working on a gun script and it worked fine until earlier today when I made a change to the script and it stopped working. I put it back, but for some reason now the animator object attached to the script keeps disappearing.

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

public class RifleShooting : MonoBehaviour
{
    private float NextTimeToFire = 0f;
    private int CurrentAmmo;
    private bool IsReloading = false;

    [Space(10)]
    [Header("Floats")]
    public float Damage = 10.0f;
    public float Range = 100.0f;
    public float ImpactForce = 60f;
    public float FireRate = 15f;
    public float ReloadTime = 1.0f;

    [Space(10)]
    [Header("Others")]
    [Space(5)]

    [Space(10)]
    [Header("Others")]
    [Space(5)]
    public int MaxAmmo = 10;
    public Camera FPSCamera;
    public Animator GunAnimations;
    public ParticleSystem MuzzleFlash;
    public GameObject impactEffect;
    public bool AllowedToShoot = true;
// Start is called before the first frame update
    void Start()
    {
        GunAnimations = GetComponent<Animator>();
        if (CurrentAmmo == -1)
            CurrentAmmo = MaxAmmo;
    }

    private void OnEnable()
    {
       IsReloading = false;
        GunAnimations.SetBool("Reloading", false);
    }
    // Update is called once per frame
    void Update()
    {
        if (IsReloading)
        return;

        if (CurrentAmmo <= 0)
        {
            StartCoroutine(Reload());
            return;
        }

        if (AllowedToShoot == false) return;
        {
            if (Input.GetButton("Fire1") || Input.GetButtonDown("Fire1") && Time.time >= NextTimeToFire)
            {
                NextTimeToFire = Time.time + 1f / FireRate;
                Shoot();
            }
        }
    }

    IEnumerator Reload()
    {
        IsReloading = true;
        Debug.Log("Reloading...");
        GunAnimations.SetBool("Reloading", true);
        GunAnimations.SetBool("IsShooting", false);
        yield return new WaitForSeconds(ReloadTime - .25f);
        GunAnimations.SetBool("Reloading", false);
        yield return new WaitForSeconds(.25f);
        GunAnimations.SetBool("IsShooting", true);
        CurrentAmmo = MaxAmmo;
        IsReloading = false;
    }

    void Shoot()
    {
        //shooting script here
    }
}

Also if it helps here is what I see in the console when I try to fire:

MissingComponentException: There is no 'Animator' attached to the "M4A1" game object, but a script is trying to access it.

sentences:
How or why are major video games programmed so reliably? It seems like every five minutes, you come across yet another installer which fails to install certain components, another .NET application that throws up an unhandled or semi-unhandled error message, a web site whose links are broken or whose JavaScript doesn't work with the most recent IE, popular apps and Flash games that freeze on occasion, etc.  Time and again you come across programs that, though they work most of the time, you will come across occasional serious errors with them, wherein they are either dead in the water or close to it.

I remember seeing a lot of glitches back in the NES days, but since around the early- to mid-90's, major video games seem to have been mostly free of things like this.  I know there are exceptions, but basically unless you are really trying to perform some sort of hack you read about online, you just don't see any issues with them freezing, throwing unhandled exceptions, or doing anything else like that.  At worst it tends to be tiny, momentary graphical anomalies that don't really matter.

In other words, major video games seem to be built to a much higher standard in reliability than most other things out there, aside from development software, despite the fact that they tend to be very large and complex pieces of software - often written in C++, no less.  You just do not have the same sorts of problems with them that you do with software in other fields.

Why?  How?  I know this could just be a result of quality control, plus just using programmers who were at the top of their class, but I've grown doubtful of this.  To me, it seems like even these measures would not ensure consistently more reliable software in situations in which it should be much less reliable.  Are people really just doing their jobs that much better, or is there something more to the picture here (such as a business practice or a development technique that these companies tend to employ)?

I know that this isn't the most scientific question out there, but I still want to make sure I'm not just missing something.  Thanks.

sentences:
Unity UI Button not working on PC build but working on Android mobile build I am using Unity to build a game that is going to be used on PC and Android mobile devices. The problem I have is that when I use a UI Button, it works perfectly on mobile, but on PC and in the editor, is not working.

Why could this be happening?

sentences:
Which of these two particle generator lifetime management techniques is better? What would be better:

An explosion class which gets created when needed, does it's stuff, then is deleted. (one instance per explosion)
An explosion class which persists through the whole game, and creates a new explosion in the appropriate place when needed. (one instance per game)

sentences:
Follow behaviour with transform.LookAt on Unity2d So i've been trying to make an enemy follow my player on Unity2d using transform.LookAt.
While it does follow the player, It also rotates the enemy as well in 3D but my sprite is made for 2d so the sprite just vanishes. Any ideas?

//follows player
transform.position = Vector2.MoveTowards(transform.position, target.position, speedEnemy * Time.deltaTime);

//make enemy look towards player
transform.LookAt(target);

sentences:
My script isn't deleting or destroying my prefab game object in Unity2D My script isn't deleting this game object once it reaches a certain position in my game. This is my script:

public float left;

public GameObject enemyLeft;

void Start ()
{
    enemyLeft= GameObject.Find("Enemy Left");
}

void Update()
{
    if (transform.position.x < left)
    {
        Destroy (enemyLeft);
    }
}

enemyLeft is a prefab gameObject that is being spawned in by my spawner.

This is the script where I intend to Destroy the game object:

    public float left;

    public GameObject[] enemiesLeft;

    void Update()
    {
        for (int i = 0; i < enemiesLeft.Length; i++) {

            if (enemiesLeft[i].transform.position.x < left) {
                Destroy (enemiesLeft[i]);
            }
        }
    }

Why isn't it deleting the game object?

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:
Game artist computer workstation set-up – is this overkill? I'm part of a small business (so very limited constraints)  working with a very talented, professional game artist and will need to provide all necessary equipment. The artist has asked for the following setup (which to me seems super expensive):

Latest graphics targeted high-end laptop with matching keyboard
Large drawing tablet
Ergonomic mount for the tablet
Vertical ergonomic mouse

Do they really need all of this? Why?

sentences:
Failing to move exponential depth term to depth shader in exponential shadow mapping I'm playing around in my little toy project to see if I can understand how exponential shadow mapping works. To begin, I have the following two fragment shaders:

Light depth texture shader

layout(location = 0) out float fragmentdepth;

void main(){
  fragmentdepth = gl_FragCoord.z;
}

Main shader

...
vec3 shadowDiv = shadowCoords.xyz / shadowCoords.w;
float lightDepth = texture(depthMap, shadowDiv.xy);
float visibility = clamp(exp(-70 * shadowDiv.z) * exp(70 * lightDepth), 0, 1);
...

This works fine - I have shadows where I expect them, and I'm using the approximation to the boolean function by taking the product of exponentials, as shown in the ESM paper.

However, my understanding is that the whole point of this, is that I can move exp(70 * lightDepth) out of this shader, and into the shader when I generate the depth texture at the light. That is:

New light depth texture shader

layout(location = 0) out float fragmentdepth;

void main(){
  fragmentdepth = exp(70 * gl_FragCoord.z);
}

Main shader

...
vec3 shadowDiv = shadowCoords.xyz / shadowCoords.w;
float lightDepth = texture(depthMap, shadowDiv.xy);
float visibility = clamp(exp(-70 * shadowDiv.z) * lightDepth, 0, 1);
...

When I make this change, the entire scene becomes shadowed. I'm sure I'm misunderstanding something somewhere, but I'm not sure where. I have tried varying the constant term (70) between 1 and 70, though this doesn't appear to make a difference. I have no errors reported by KHR_debug

I am creating my light depth texture as:

genLightDepthMap :: IO GLTextureObject
genLightDepthMap =
  do lightDepthMap <- overPtr (glGenTextures 1)
     glBindTexture GL_TEXTURE_2D lightDepthMap
     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
     glTexImage2D GL_TEXTURE_2D
                  0
                  GL_DEPTH_COMPONENT24
                  shadowMapResolution
                  shadowMapResolution
                  0
                  GL_DEPTH_COMPONENT
                  GL_FLOAT
                  nullPtr

sentences:
Can one build a game based on something that already exists and make money off of it? Possible Duplicate:
  Is it legally possible to make a clone of the game?

I was planning on producing a game but then I had to stall. I have an idea to make a game, but its very similar to a game already out there. If I made my own graphics, audio and use my own code, would I be allowed to sell it?

sentences:
An algorithm for forming unit groups Currently in my game engine when a user selects a large number of units and commands them to a target each unit finds its own path using Jump Point Search. The performance of this is generally OK. What I dislike is that over longer distances all the paths tend to converge so that the units end up competing to reach the path's nodes.

My solution to this is to group the units together and create a path from the unit closest to the centre of the group. I then use steering behaviours / flocking to sensibly navigate the group along the path to the target.
The problem I am struggling with now is that the user may select many units which aren't physically grouped together. Some may be very far away from each other, others may be close but separated by walls, etc. It is not really possible to create one path for such a group.

What I need is an algorithm that can create discrete physical groups from a larger set of units like in the image above. I'm at a loss as to where to start with this. I had thought of maybe using some sort of brushfire algorithm, adding units to the group as they're discovered and stopping at walls or too much empty space. I'd rather not reinvent the wheel though and would appreciate any help anyone can give me.

sentences:
Can frequent state changes decrease rendering performance? Can frequent texture and shader binding decrease rendering performance?

"Frequent" binding example:

for object
   for material in object
      render part of object using that material

"Low count" binding example:

for material
   for object in material
      render part of object using that material

I'm planning to use an octree later and with this "low count" method of rendering it can drastically increase memory consumption. So is it good idea?

sentences:
Why does my first person camera attached to a rigid body vibrates? I'm trying to make a first-person character with a rigid body. I need a rigid body because I want to add areas where the gravity comes from different directions so I also need to rotate the character accordingly. And as far as I know you cant rotate a character controller.

So I wrote a script for movement and camera rotation.

The problem I now face is that the camera vibrates. I recorded this video to show it.

Why do I get this and how do I fix this?

Movement code:

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

public class PlayerMovementRigidBody : MonoBehaviour
{
    public float speed = 10.0f;
    public Rigidbody rb;
    public LayerMask groundLayers;

    public float jumpForce = 7;
    public CapsuleCollider col;

    float transelation;
    float straffe;

    // Start is called before the first frame update
    void Start()
    {
        Cursor.lockState = CursorLockMode.Locked;
        rb = this.GetComponent<Rigidbody>();
        col = GetComponent<CapsuleCollider>();
    }

    // Update is called once per frame
    void Update()
    {
        transelation = Input.GetAxis("Vertical") * speed;
        straffe = Input.GetAxis("Horizontal") * speed;
        bool jumping = Input.GetKeyDown(KeyCode.Space);

        transelation *= Time.smoothDeltaTime;
        straffe *= Time.smoothDeltaTime;

        /*if (IsGrounded())
        {
            rb.useGravity = false;
        }
        else
        {
            rb.useGravity = true;
        }*/

        if (IsGrounded() && Input.GetKeyDown(KeyCode.Space))
        {
            rb.AddForce(Vector3.up * jumpForce, ForceMode.Impulse);
        }

        if (Input.GetKeyDown("escape"))
        {
            Cursor.lockState = CursorLockMode.None;
        }

    }

    void FixedUpdate()
    {
        transform.Translate(straffe, 0, transelation);
    }

    private bool IsGrounded()
    {
        return Physics.CheckCapsule(col.bounds.center, new Vector3(col.bounds.center.x, col.bounds.min.y, col.bounds.center.z), col.radius * .9f, groundLayers);
    }
}

Mouse look code:

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

public class MouseLookRigidBody : MonoBehaviour
{
    public float mouseSensitivity = 100f;

    public Transform playerBody;

    Rigidbody rig;

    float xRotation = 0f;

    // Start is called before the first frame update
    void Start()
    {
        Cursor.lockState = CursorLockMode.Locked;
        rig = this.transform.parent.gameObject.GetComponent<Rigidbody>();
    }

    // Update is called once per frame
    public void Update()
    {
        float mouseX = Input.GetAxis("Mouse X") * mouseSensitivity * Time.deltaTime;
        float mouseY = Input.GetAxis("Mouse Y") * mouseSensitivity * Time.deltaTime;

        xRotation -= mouseY;
        xRotation = Mathf.Clamp(xRotation, -90f, 90f);

        transform.localRotation = Quaternion.Euler(xRotation, 0f, 0f);
        playerBody.Rotate(Vector3.up * mouseX);

    }
}

sentences:
How do I temporarily pause an XNA game? Collision with an enemy should pause the game for 1.5 seconds.

My failed attempt:

bool tPause;
float timer;

public ovveride Update(GameTime gameTime) {
    if(!tPause) {
        // ...
        if(enemy.rectangle.Intersects(player.rectangle)) {
            timer += (float)gameTime.ElapsedGameTime.TotalMilliseconds;
            tPause = true;
            if(timer > 1500) {
                tPause=false;
                timer=0;
            }
        }
        // ...
    }
}

What am I missing? How can I do this?

sentences:
Disposing only certain resources in XNA? The ContentManager in XNA 4.0 only has one Unload() method that Unloads all Assets.

I want to have some "global" Assets that are always loaded, but then I want per-Level Assets which should be Unloaded when the level is changed.

Should I create a second Instance of the ContentManager as part of the Level.cs Class? Or should I use Game.Content and then call .Dispose on the Assets I load? Or should I create my own ContentManager on top of the ReadAsset function as outlined here?

sentences:
Why does this impulse not affect the body? I'm just getting started with Box2d and I'm trying to apply an impulse to a circle but nothing really happens.

First I define ball:

BodyDef bodyDef = new BodyDef();
bodyDef.type = BodyDef.BodyType.DynamicBody;
bodyDef.position.set(camera.viewportWidth / 2, camera.viewportHeight / 2);
ball = world.createBody(bodyDef);
CircleShape dynamicCircle = new CircleShape();
dynamicCircle.setRadius(50f);
FixtureDef fixtureDef = new FixtureDef();
fixtureDef.shape = dynamicCircle;
fixtureDef.density = 0.5f;
fixtureDef.friction = 0.4f;
fixtureDef.restitution = 0.6f;
ball.createFixture(fixtureDef);
dynamicCircle.dispose();

then I call this line from inside my inputprocessor

public boolean touchDown(int screenX, int screenY, int pointer, int button) {
    Gdx.app.log("input", "touchDown");
    ball.applyLinearImpulse(new Vector2(0f, 5000f), ball.getPosition(), true);
    return true;
}

Here's the render method:

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

    debugRenderer.render(world, camera.combined);
    world.step(1 / 60f, 6, 2);
}

I tried logging this and can confirm the touchDown event is triggered, but the impulse never applies.

Am I forgetting some call to make this work? What might be going wrong?

sentences:
Game() parametters Content and Window are not pre initialized I've been experiencing a really Strange problem since recently, Every variables of XNA Framework Game class seems not to be initialized before my extending Game1 class. Variables does not seem to be initialized before the point where they should be.
I do not plan to change the game engine, but I'll appreciate any help of any kind.
Thanks for your time
here is my Game1 class (a small part of it)
public class Game1 : Game
{
  public static GraphicsDeviceManager graphics;
  public static SpriteBatch spriteBatch;
  public static ContentManager ContentManager;
  public static SceneManager SceneManager { get; private set; }

  public Game1()
  {
    ContentManager = Content;

    graphics = new GraphicsDeviceManager(this);
    ContentManager.RootDirectory = "Content";

    // TODO: Add your initialization logic here
    /*
    GraphicsAdapter.DefaultAdapter.CurrentDisplayMode.Height
    GraphicsAdapter.DefaultAdapter.CurrentDisplayMode.Width
    */
    Window.IsBorderless = true;
    graphics.PreferredBackBufferWidth = GraphicsAdapter.DefaultAdapter.CurrentDisplayMode.Width;
    graphics.PreferredBackBufferHeight = GraphicsAdapter.DefaultAdapter.CurrentDisplayMode.Height;
    IsMouseVisible = true;

  }

    (...) //The code continues
}

and here is the errors:

the Null pointer error on the Window variable occures when i declare a new Content manager

Edit:
It seem that there is a conflict between System.RunTime.Serialization v4 and v2 in my project
1>  Impossible de résoudre le conflit entre "System.Runtime.Serialization, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089" et "System.Runtime.Serialization, Version=2.0.5.0, Culture=neutral, PublicKeyToken=7cec85d7bea7798e, Retargetable=Yes". Choix arbitraire de "System.Runtime.Serialization, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089".

sentences:
Keyboard and Mouse callbacks in GLUT I'm using OpenGL via GLUT in Ubuntu.

While writing text in a text editor, the first keystroke is printed immediately.
But if we keep pressing the key, it waits for a moment and then prints a trail of that character.

This is to reduce the sensitivity while typing.

With GLUT, function callbacks for keyboard behave like that.

glutKeyboardFunc( keyboard );
glutKeyboardUpFunc( keyboard_up );

Now if we keep pressing a key, there is a considerable delay between the first and the second call of keyboard ( and keyboard_up) function. But in real gaming, this not should be the case.

Question 1: How to solve the problem?

Question 2: keyboard_up gets called even if I press and hold a key. Why so? I think it is supposed to get called only when I release it. Moreover, this also suffers from the above jerk problem.

Question 3: For glutMouseFunc( mouse ), the mouse function gets called whenever we press or release a mouse button. I want this too to get called repeatedly if I press and hold my mouse button, and that too without jerk. How to do so?

sentences:
Developing an ELO like point system for a multiplayer gaming site I'm currently working on a gaming site where users will submit virtual players for different games, like Chess, Nash, Backgammon, Go, etc. The idea is that users don't compete themselves, but through their virtual players. There will be leagues, tournaments, and other competition formats.

The question is which would be a good rating system for users in this environment. Take into account that every user may have many different virtual players playing in many different games. As a general guideline I would like to guarantee the following properties:

Users who have a lot of mediocre players should not score higher than users with a few very good players.
A user with a high rating should not be penalized if he adds a new bad player, until he has had enough time to improve his player.
Users who don't play often should not score higher than users who play every day.

Thanks in advance.

sentences:
Make platform's visibility distinct from background I have a 2d infinite runner type game which background is changing its colors constantly. Meanwhile the color of the platforms stays the same. This way the platforms at some point(when their color is the same as the background's) become "invisible" for the player.

How can I creatively, shortly and conviniently avoid this problem with unity?

P.S. I've tried adding glossy material to it but it didn't work.

sentences:
Understanding math used to determine if vector is clockwise / counterclockwise from your vector I'm reading Programming Game AI by Example by Mat Buckland.  In the Math & Physics primer chapter there's a listing of the declaration of a class used to represent 2D vectors.

This class contains a method called Sign. It's implementation is as follows

//------------------------ Sign ------------------------------------------
//
//  returns positive if v2 is clockwise of this vector,
//  minus if anticlockwise (Y axis pointing down, X axis to right)
//------------------------------------------------------------------------
enum {clockwise = 1, anticlockwise = -1};

inline int Vector2D::Sign(const Vector2D& v2)const
{
  if (y*v2.x > x*v2.y)
  {
    return anticlockwise;
  }
  else
  {
    return clockwise;
  }
}

Can someone explain the vector rules that make this hold true?

What do the values of y*v2.x and x*v2.y that are being compared actually represent?

I'd like to have a solid understanding of why this works rather than just accepting that it does without figuring it out.  I feel like it's something really obvious that I'm just not catching on to.

Thanks for your help.

sentences:
how to accurately select a sprite on a scene with a click? I have a scene with some sprite on it (added), the gamer has to select one of them and take the next action.

What is the simplest way to select one of the sprites accurately?

I am looking for a method that recieves a click coordinate and returns one of the sprites on the scene.

Since the sprites cant be well fitted in a bounding box I dont like to use a minimum bounding box approximation.

I was thinking of loading the sprites into a matrix and creating a scene matrix that each member belongs to a specified sprite, but it costs a lot( each pixel must be transformed using an affine transformation and it must be recalculated each time one of the sprites move)

Can someone show me a better way with a lower cost?

P.S I am using Swift and Apple's SpriteKit
There is a code for minimum bounding box but I am looking for an accurate method.

Inaccurate method if some interested is something like this :

     for touch in touches
     {
            var location : CGPoint = (touch as! UITouch).locationInNode(self)
            for asprite in self.viewIso.children
            {
                if (asprite.containsPoint(location))
                {
                    println("Selected : \(asprite.name as String)")
                    return
                }
            }
     }

Thanks
Iman

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:
Instanced rendering with ARB_vertex_attrib_binding I'm trying to separate the vertex format specification from the vertex data. I was able to do that for the mesh vertices successfully. For instanced rendering I wanted to further separate the instance data (i.e. model matrices). Here is what I'm trying out, but nothing is rendered.

Loading the data:

glGenBuffers(1, &vbo_instanced);
glBindBuffer(GL_ARRAY_BUFFER, vbo_instanced);
glBufferData(GL_ARRAY_BUFFER, n_instances * sizeof(glm::mat4), ModelArray, GL_STATIC_DRAW);

Vertex format:

glGenVertexArrays(1, &vao_instanced);

glBindVertexArray(vao_instanced);

glEnableVertexAttribArray(0);
glVertexAttribFormat(0, 3, GL_FLOAT, GL_FALSE, 0);
glVertexAttribBinding(0, 0);

glEnableVertexAttribArray(1);
glVertexAttribFormat(1, 3, GL_FLOAT, GL_FALSE, sizeof(glm::vec3));
glVertexAttribBinding(1, 0);

glVertexBindingDivisor(1, 1);
for(int i = 0; i < 4; i++){ //Model Matrices
    glEnableVertexAttribArray(2 + i);
    glVertexAttribBinding(2 + i, 1);
    glVertexAttribFormat(2 + i, 4, GL_FLOAT, GL_FALSE, sizeof(glm::mat4));
}

When rendering I do the following,

glBindVertexArray(vao_instanced);
glBindVertexBuffer(0, vbo_mesh, 0, sizeof(Vertex));
glBindVertexBuffer(1, vbo_instanced, 0, sizeof(glm::mat4));
glDrawArraysInstanced(GL_TRIANGLES, 0, n_vertices, n_instances);

but I'm pretty sure the stride argument in glBindVertexBuffer of vbo_instanced should be wrong because it is the stride per vertex.

Does anyone know what I'm doing wrong and how to fix it?

EDIT 1: It seems I made a mistake in the last argument of glVertexAttribFormat, it should instead be,

glVertexAttribFormat(2 + i, 4, GL_FLOAT, GL_FALSE, 4 * i * sizeof(float));

But now, although everything gets rendered, my normals are wrong. Even if I don't transform them, they have a single value per instance instead of a single value per face.

This is what the normals look like,

And this is what it should actually look like,

Note that the normals are fine as long as I instead use the glVertexAttribPointer method, i.e. bind the vbo_instanced directly to the vao.

For reference, here is how I declare the attributes in my shader,

#version 330 core

layout(location = 0) in vec3 in_Position;
layout(location = 1) in vec3 in_Normal;
layout(location = 2) in mat4 ModelMatrix;

EDIT 2: I wanted to add that I have checked that all offset values are correct. Additionally, I used apitrace and checked that all vertex buffer data are correctly uploaded. Valgrind also doesn't show any errors.

Now for a weird finding, if I don't use vertex attribute array with index 1 and instead bind vertex positions at 0, vertex normals at 2, and Model Matrices at 3, everything is rendering correctly. Could this be some driver bug? I tried on two linux systems, both having nvidia gpus, with exactly the same results.

EDIT 3: I put together a minimal working example which you can find here. It uses SDL and GLEW and is written in C++11. If I set SKIP to 1 (which means it skips attribute 1), I get what I expect, but if I set it to 0, the normals become messed up.

sentences:
Car simulation, motor torque and brake torque combine problem I am creating a custom wheel collider in Unity. Every thing is fine now (suspension, collision, friction) except one problem that i cant get my head over for last 3 weeks. So now i have a car (one wheel only), it stand on top of a hill, then i apply a brake torque enough to make it stand still, after that i apply a motor torque that less than max brake torque, my question is how the car behave?. In my opinion, that if sum of motor torque (roll down hill direction) and gravity torque(friction force * radius) greater than the max brake torque will cause the car to roll down hill, and it remain stand still if motor torque (roll up hill direction). I really need help!

So i have mT(motor torque), bT(max brake torque), fT(max ground torque), rT(residual torque)

if (|mT| > |bT|) {

    |rT| = |mT| - |bT|;

    if (|rT| > |fT|) {
        wheel spin up with sign(mT) * (|rT| - |fT|);
        ground force = sign(mT) * |fT| / radius;
    } else {
        wheel roll without slipping;
        ground force = mT / radius;
    }
} else {

    |rT| = |bT| - |mT|;

    if (|rT| > |fT|) {
         wheel slow down to 0 with -sign(omega) * (|rT| - |fT|);
         ground force = -sign(velocity) * |fT| / radius;
     } else {
         wheel roll without slipping;
         ground force = -sign(velocity) * (|bT| - sign(velocity) * mT) / radius;
     }
}

All torque sign are on top.

sentences:
Unity associated game object is null when running I am just starting with Unity.
I have two UI Text game objects, Atext and Btext. I have associated them by drag-dropping with my PlayerController script public variables, say public Text atext and public Text btext.
Before running, the Unity editor correctly shows that Atext and Btext are correctly associated with the public variables.
When running with debug, I get a null reference exception with btext and even the Unity Editor shows the association as None (Text). After stopping, the association turns to Btext as it is supposed to be. The script is very simple and I don't set btext to null at any point.

When I create a new UI Text object by duplicating Atext, it works correctly after associating it with some new variable.
When I create a new UI Text object by Create-> UI -> Text, it doesnt work

Might be a stupid question but what am I forgetting?

Edit:
Here is the problem again with code:

Before running with debug, the editor shows

PlayerController2 (Script)
Script: PlayerController2
Speed: 7
Countboxref: Countbox(Text)
Winboxref: Winbox (Text)
Brokenboxref: Text (Text)

where Countbox, Winbox, and Text are Canvas/UI/Text objects which I have drag dropped into place. Winbox object has been created by duplicating it from Countbox, Text has been created by Create -> UI -> Text.

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

public class PlayerController2 : MonoBehaviour {

public float speed;
public Text Countboxref;
public Text Winboxref;
public Text Brokenboxref;
private Rigidbody rb;
private int boxit;

void Start ()
{
    Countboxref.text = "count";
    Winboxref.text = "winner";
    Brokenboxref.text = "broken";
}

When the program breaks on line Brokenboxref.text = "broken”, the editor shows

Brokenboxref: None (Text)

and when the execution is stopped completely, it again returns to

Brokenboxref: Text (Text)

Note 1: In this project, every Text object created with Create->UI->Text is broken. A new Text object works only when I select Countbox or Winbox and duplicate it. Thus it is not possible that the object would be explicitly destroyed in the code. I can create as many Text objects as I wish by copying (all don't work) and as many Text objects as I wish by duplicating (all will work).

Note 2: when I create a new project from scratch, of course everything works as expected. I assume the project is somehow corrupted.

Edit 2: No prefabs or such. Just the basic roll a ball tutorial. But this was my son's project so I am not sure what he has done when following the tutorial.

Note 3: The problem went away when I deleted the Library folder and forced Unity to rebuild it. Don't know yet if I caused any other problems by doing that. I saw that somewhere as a suggestion for corrupted projects. I don't know if there is a proper way to refresh.

Also, this project was originally started with Unity 4.6 and upgraded to 5.02

sentences:
How to do in Godot 2D: game screen in one viewport and minimap in another. Different sprites on each The second day I google the tutorials, but nothing comes of it. All tutorials link to splitscreen demo, but it is made under the second Godot and does not work in the third.

The problem is this: I want to render the world in the main viewport and its simplified view on the minimap in another viewport using two different cameras.

In the main viewport the main AnimatedSprite node of objects should be rendered, and on the minimap there are only additional Sprite node of objects with their schematic view.

Tried to do:

Node2D
-ViewportContainer
--ViewportMain
--- Camera2D
--- World
----Player
-----AnimatedSprite # for main viewport
-----Sprite # for minimap
----OtherObjects
-----AnimatedSprite # for main viewport
-----Sprite # for minimap
-ViewportContainer
--ViewportMinimap
--- Camera2D

In code I assign main viewport's world to minimap's viewport:

$ ViewportMinimap.world = $ ViewportMain.world

For the main AnimatedSprite I set Light Layer #1, for the sketchy Sprite I set Light Layer #2.

And it does not work.

Firstly, nothing is displayed on the minimap. I don’t understand how to make it work. How to tell minimap's viewport to use the world from main viewport?

Secondly, I can’t find anywhere how to set the camera which Light Layer it has to display (in the three-dimensional Camera there is a Cull Layer parameter, but I don’t see it here).

Will this approach hit performance?

How to correctly implement minimap without need to modify it when you add new object to game?

How to correctly replace scenes when player moves from one to another if it child of the Viewport?

sentences:
Are there benefits to stage selections where only the appearance changes (i.e. Street fighter, King of fighters etc.)? I'm not really sure if it's a good value add seeing as it would entail asset generation.

The only value I see in it would be for variance but even that would wear thin really quickly.

Clarification: i.e. Backgrounds that don't add game play related features, just appearance changes.

sentences:
In XNA, how do I access a model's dimensions with code? I'm trying to rotate a model around some axes, but this rotates it around the world origin. I understand that I need to translate the object relative to its own size before rotating it, but I don't know by how much.

I've done it by trial and error until now. How can I automatically read a model's width, height and position?

sentences: rotate to movement direction If I have a player character that can move 8-directionally, I can set the rotation of the player to face the direction of movement. But if I want to smoothly rotate to a direction, sometimes the player will take the "long way around" (i.e., player is at -90 degrees, facing right; I press S and it will rotate 270 degrees to be at 180 degrees, facing down). How can I fix this? I tried adding 360 to the desired angle until it was within 90 degrees, but that didn't work (probably just because I'm too tired, though). Any help is appreciated!

sentences:
Determine terrain color based on slope and height with many types of terrain I've got a specific problem. Take this as a challenge, if you will.
I have a 3D mesh representing a cliffy terrain. It's constructed from a simple height map.
The goal is to determine what type of terrain (in practice, what color) to use for any point on the map, given a height and a slope and a constant configuration. Both height and slope are between 0 and 1.
The configuration looks something like this:
const vec3 WATER_COLOR = vec3(0.0, 0.0, 1.0);
const vec3 SAND_COLOR = vec3(0.76, 0.7, 0.3);
const vec3 GRASS_COLOR = vec3(0.208, 0.624, 0.004);
const vec3 CLIFF_COLOR = vec3(0.435, 0.384, 0.380);
const vec3 SNOW_COLOR = vec3(0.894, 0.953, 1.0);

const float WATER_MAX_HEIGHT = 0.1;
const float SAND_MAX_HEIGHT = 0.15;
const float GRASS_MAX_HEIGHT = 0.5;
const float SNOW_MIN_HEIGHT = 0.9;

const float SAND_MAX_SLOPE = 0.25;
const float GRASS_MAX_SLOPE = 0.50;
const float SNOW_MAX_SLOPE = 0.75;

const float BLEND_FACTOR = 0.1; // Or whatever

I then need a function that takes a height and a slope to produce a color:
vec3 terrain_color(float slope, float height) {
    // Somehow determine the terrain color
}

I've tried to visualize the kind of function I want like this:

Where the x-axis is slope and the y-axis is height. So close to water, the terrain should be sand, but only if the slope is below SAND_MAX_SLOPE and very high up it should be snow, as long as the slope is below SNOW_MAX_SLOPE. The terrain defaults to the cliff color if nothing else fits.
It's easy to just compare the height and slope with the configuration values, but I would like to blend the colors smoothly together, except for the water, resulting in something similar to this:

A higher BLEND_FACTOR should result in more blurring/blending.
Closest thing I've got so far is the following (inspired by Sebastian Lague's similar shader):
const float HEIGHT_FADE_POWER = 16.0;
vec3 terrain_color(float slope, float height) {
    if (height <= WATER_MAX_HEIGHT) {
        return WATER_COLOR;
    }

    float sand_grow_height_fraction = smoothstep(0.0, SAND_MAX_HEIGHT, height);
    float sand_blend_height = SAND_MAX_SLOPE * (1.0 - BLEND_FACTOR);
    float sand_weight = 1.0 - saturate((slope - sand_blend_height) / (SAND_MAX_SLOPE - sand_blend_height));
    sand_weight *= 1.0 - pow(sand_grow_height_fraction, HEIGHT_FADE_POWER);

    float grass_grow_height_fraction = smoothstep(SAND_MAX_HEIGHT, GRASS_MAX_HEIGHT, height);
    float grass_blend_height = GRASS_MAX_SLOPE * (1.0 - BLEND_FACTOR);
    float grass_weight = 1.0 - saturate((slope - grass_blend_height) / (GRASS_MAX_SLOPE - grass_blend_height));
    grass_weight *= 1.0 - pow(grass_grow_height_fraction, HEIGHT_FADE_POWER) - sand_weight;

    float cliff_weight = 1.0 - grass_weight - sand_weight;

    return sand_weight * SAND_COLOR + grass_weight * GRASS_COLOR + cliff_weight * CLIFF_COLOR;
}

Which produces the following when I map it on a plane:

Which is not quite what I want and it's also missing snow.
I have considered simply using the above image as a texture but I would like a computational way to achieve the same thing. I can't really figure out how to do this while getting the blending right. Besides I may want to replace the colors with a texture eventually.
Bonus points for having a different blend factor for each terrain type.

sentences:
How can I highlight words in a word search puzzle? For days I am struggling to implement the highlighting functionality in game as there is not much tutorial also for this. I did how ever make the cell of the grid change the material color but it looks ugly that's why I prefer to choose this method (see pic).

How can I implement a highlighting method that will work the same on link.

My try:

 private bool first_sel = false;
    private void Update() {
        if (Input.GetMouseButton(0)) {
            ray = Camera.main.ScreenPointToRay(Input.mousePosition);
            if (Physics.Raycast(ray, out pressed)) {
                if (pressed.transform.tag == "cell") {
                    if (!first_sel) {
                        GameObject sel = Instantiate(sel_cell, new Vector3(pressed.transform.position.x,
                            pressed.transform.position.y, pressed.transform.position.z - 0.55f), Quaternion.identity);
                    }

                }
            }
        }

sentences:
Why does player still leave map? I'm making a simple HTML5 RPG in pure JavaScript likened after Nox, Diablo or Titan Quest, with the character centered on the screen and the map moving around it.

TL;DR: My character, when colliding with the map edge, can still move outside the map in some cases. How do I quell this inconsistency?

Explanation: I have simple rectangles for the map, character, and one enemy, and I'm using bounding-box collision detection for them. When the character pushes against the map's edge, it stops moving, but the enemy box moves opposite of my character's trajectory of motion. When the enemy hits the wall, it stops, but the collision detection for my centered character fails and I'm flung into the void.

Here is a screenshot demonstrating this (map=white, character=blue, enemy=red):

Here are some bits of relevant code that might help:

Box object:

function Box() {
    this.x = 0;
    this.y = 0;
    this.width  = 50;
    this.height = 50;

    this.init = function(x, y, w, h, c) {
        ...
    };

    this.move = function(dir, amt, reverse) {
        ...
    };

    // stops 'obj' from leaving 'this'
    this.constrain = function(obj) {
        if(this.x > obj.x) {
            this.x = obj.x;}
        if(this.y > obj.y) {
            this.y = obj.y;}
        if(this.x + this.width  < obj.x + obj.width) {
            this.x = obj.x + obj.width  - this.width;}
        if(this.y + this.height < obj.y + obj.height) {
            this.y = obj.y + obj.height - this.height;}
    };
    this.draw = function() {...};
}

Main code:

var m = new Box();
var p = new Box();
var e = new Box();

function rand(a, b) {return ((Math.random()* (b - a)) + a);}

// monster moves away from player on player collision with map.
// player moves off map on monster collision with map.
function init() {
    p.init(cn.width/2 - p.width/2, cn.height/2 - p.height/2, 20, 20, "blue");
    m.init(p.x, p.y, 200, 200, "white");
    e.init(rand(m.x, m.x + m.width  - e.width), rand(m.y, m.y + m.height - e.height), 20, 20, "red");
}

function update() {
    if(key.left)  {
        m.move('left',  p.speed, true);
        e.move('left',  p.speed, true);
    }
    ...

    m.constrain(p);
    m.constrain(e);
}

function draw() {
    c.clearRect(0, 0, cn.width, cn.height);
    m.draw();
    p.draw();
    e.draw();
}

How would I make both the monster and the character consistently collide with the map?

I'm sorry in advance if the code/post is too long. I spent a good, long while shortening it up. I'll happily edit it, just ask. Thank you! :)

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:
Thread-safety in Cocos2d-iPhone? After tinkering a bit with cocos2d, I discovered that there is no classic game loop and everything is more-or-less event driven. I guess I can wrap my head around that, no problem.

But I cannot find anything about thread safety. Say, I schedule something to occur every two seconds, which Thread will run the code? Given that I cannot find anything about that, I guess there is just one Cocos2d Thread and everything will be fine.

Nevertheless, this implicit assumption does not give me a good feeling. Knowing is better than guessing. ;-)

Can anyone shed some light onto that topic?

sentences:
Is it more efficient to use an A* algorithm or a line system drawn in pathfinding in C#? I was recently introduced to the A* algorithm when I asked a friend about making AI/NPC's in video games move to certain points and it sounded very interesting. I am building an FPS and it has AI that must be able to move to certain points, so the A* algorithm sounds very appealing to me.

However, as I went through the Half-Life 2: Episode 1 Developer Commentary, I found another solution that the workers at Valve have been using: a line system. I couldn't find a screenshot and alas, I couldn't find the developer node to show the system. :(

Basically, there's a whole system drawn on the level map for AI to move along. If there happens to be an enemy that shows up in a certain section that might not be on the AI's line of sight, then the AI can break out of the line and attack said enemy.

I'm building the game in C# (XNA) and I wanted to know if it would be better to use the algorithm, the line system or even both to achieve pathfinding?

sentences:
Accessing C++ class members with LuaPlus I've implemented LuaPlus in my engine eventmanager successfully and really like the flexibility I gained. But I'm still not exactly where I want to be, because I can't link my c++ classes to a Lua class.

For example, I have a Actor class in C++, and I want to be able to create the same class in Lua and gain access to members with LuaPlus, but I can't figure how I can achieve that.

Is this actually LuaPlus built-in functionality, or do I have to write my own interface that exchanges data tables between C++ and Lua?

My current approach would be to fire an event in Lua that creates an new actor class in C++ code, and transfer its ID and the data I need to back to Lua. When I modify the data I send the modifications back to C++ code again, but I actually thought there's something in LuaPlus that exposes this functionality already.

sentences:
what happens with missing vertices in geometry shader I am relatively new to GLSL shader programming, and the documentation I found is unfortunately often inscrutable. I am having trouble understanding a few things with how geometry shaders fit into the pipeline.

I am trying to implement silhouette detection by detecting boundary triangles in a geometry shader. A triangle is a boundary triangle if it is front-facing and an adjacent triangle is back facing. The idea then is to emit additional camera-facing triangles to outline them.

For this purpose, I am looking at GL_TRIANGLE_ADJACENCY shaders, since they seem to fit the bill. Let's assume for the moment that I have already got the data loaded properly into the buffer.

For clarity: I plan on doing skinning and the Model View transform in the vertex shader, but to hold off on the perspective projection until I decide what to do in the geometry shader (this seems reasonable, but maybe I am wrong).

Here is where the uncertainties start to come in. First of all, am I expected to manually perform backface culling at some shader stage?

Second, if a triangle has incomplete adjacency information(only 2 out of three triangles for example), how is this conveyed to the shader? Does it just have a length less than 6 vertices?

Third, what does the pass through shader (the one that does nothing special) have to perform? Do I emit every vertex in the input list, or just 3 from the first triangle? And again, am I supposed to/allowed to cull backfaces?

And last, if I decide to emit additional geometry, is there anyway to distinguish that from the (passed-through) input geometry from the point of view of the fragment shader? I'd like to be able to texture map them separately if it is possible.

If I am on the wrong path on any of this, of course feel free to let me know. In case it is important, I am using OpenGL 3.3.

Based on my understanding and Nathan's answer, I could start with a passthrough shader that looks something like this:

layout(triangle_adjacency) in;
layout(triangle_strip, max_vertices = 14) out;
flat out float is_border;

void main() {
    gl_Position = gl_in[0].gl_Position;
    is_border=0.0;
    EmitVertex();

    gl_Position = gl_in[2].gl_Position;
    is_border=0.0;
    EmitVertex();

    gl_Position = gl_in[4].gl_Position;
    is_border=0.0;
    EmitVertex();

    EndPrimitive();
}

And then when/if I add triangle strips for outlines, I will set is_border=1.0 for each of those vertices.

sentences:
Handling real projectiles with different FOVs on a first person shooter camera stack I'm prototyping out a First Person Shooter and I'll admit I have little work experience in the genre (though I've played many of them). I'm using a traditional weapon camera stack in which the main camera has a user selectable FOV and the weapon camera draws on top of that with a fixed (and lower) FOV. This prevents visible model distortion that would be very apparently with something so close to the camera. Both cameras always maintain the same transform, they just have differing FOVs.
In some instances I want to emit actual physics projectiles not just do hitscan bullet checks. Think a rocket or grenade launcher, you don't want those hitscan.
However, I'm not sure how to overcome the perceived visible offset that happens from the muzzle between the weapon camera's low FOV to the main camera's higher FOV. In this example the weapon FOV is 40 and the main camera is 80. The red ball is the point at which the projectiles will spawn.

As you can see they will visually appear to emit quite a distance away from the muzzle of the gun. The spawn point - and my projectiles - are rendered by the main camera and the high FOV visually moves the ball to the front (despite the world space being actually on the muzzle of the gun). What is the normal approach to overcome this?
Things I've thought of is having the bullets secretly emit behind the gun so then rely on the fact the weapon camera is always on top to mask the fact the bullets are emitting from behind the camera's near clipping plane, or actually calculating the camera projection difference when the view changes and attempting to adjust the emission point.
I appreciate any help, thanks!

sentences: How to make a gaussian blur effect in UDK I want to make a plane shape (surface) that have a gaussian blur applied to it and this plane is transperant, so all objects behind it looks like they are having a gaussian blur effect.

sentences: Does Unity have a built in pathfinding system? I know that there a lot of plugins available for pathfinding in unity but I was just wondering if unity has a built in pathfinding system ?

sentences:
Draw fonts in Hololens using SharpDX I am using SharpDX to create an application in Hololens and I'm trying to understand how to use DirectWrite to draw variable text in 3D stereoscopic view. I have gone through this question, but the answers rely on other libraries.

MVP Dwight Goins provided me with this Rendering-3D-Text tutorial to help me out which uses the DirectX ToolKit. The closest I've got to is the Holographic-Tag-Along sample for holographic applications given by Microsoft. These two samples pretty much cover what I'm looking for but it is in C++. However, due to some project constraints, I need this to be in C#.

I am pretty new to computer graphics and therefore I do not fully understand how to achieve the same thing that the above two samples I've mentioned does in C# using SharpDX. Any help that could be provided to achieve the same output in C# would be much appreciated.

sentences: What weight should each frame have in motion blur? I am working on a game and would like to add motion blur to videos that I export from the engine. Right now, I play back gameplay at 1/16th the original speed, giving me 16x more frames (e.g. instead of 60 frames per second, it's 960 frames per second) and averaging the frames. I am curious though, is this the proper weight or should I give frame samples closer to the middle more alpha? Also, should the frames sampled be sampled uniformly?

sentences:
How to FindGameObjectsWithTag then cast the array of GameObjects to an Array of Interfaces I have a few GameObjects that implement a common Interface: IsTree.
I need to call the function doTreeThing() on each of those IsTrees after getting a reference to each of them via FindGameObjectsWithTag("tree").

This line complains that it cannot implicitly convert from GameObject[] to IsTree[]

IsTree[] trees = GameObject.FindGameObjectsWithTag("tree");

So then I tried to leave the GameObject[] an iterate over it to convert each individual object inside to an IsTree.

GameObject[] trees = GameObject.FindGameObjectsWithTag("tree");
        foreach (GameObject tree in trees) {
            IsTree isTree = (IsTree)tree;
            isTree.doTreeThing();
        }

But this complains that it also cannot convert GameObject to IsTree.

Then I got a little desperate and tried to make my IsTree into a GameObject.

public class IsTree : GameObject {
    public System.DateTime getAge(){
        return null;
    }
}

GameObject is a sealed type. (I don't really know what that means besides that this does not work)

So how do I get this array of GameObjects into an array of SomeInterface?

sentences:
Interleaving Arrays in OpenGL In my pursuit to write code that matches todays OpenGL standards I have found that I am completely clueless about interleaving arrays. I've tried and debugged just about everywhere I can think of but I can't get my model to render using interleaved arrays (It worked when it was configuered to use multiple arrays) Now I know that all the data is properly being parsed from an obj file and information is being copied properly copied into the Vertex object array, but I still can't seem to get anything to render. Below is the code for initializing a model and drawing it (along with the Vertex struct for reference.)

Vertex:

struct Vertex {
    glm::vec3 position;
    glm::vec3 normal;
    glm::vec2 uv;
    glm::vec3 tangent;
    glm::vec3 bitangent;
};

Model Constructor:

Model::Model(const char* filename) {
    bool result = loadObj(filename, vertices, indices);

    glGenVertexArrays(1, &vertexArrayID);
    glBindVertexArray(vertexArrayID);

    glGenBuffers(1, &vertexbuffer);
    glBindBuffer(GL_ARRAY_BUFFER, vertexbuffer);
    glBufferData(GL_ARRAY_BUFFER, vertices.size() * sizeof(Vertex), &vertices[0], GL_STATIC_DRAW);

    glGenBuffers(1, &elementbuffer);
    glBindBuffer(GL_ELEMENT_ARRAY_BUFFER, elementbuffer);
    glBufferData(GL_ELEMENT_ARRAY_BUFFER, indices.size() * sizeof(unsigned short), &indices[0], GL_STATIC_DRAW);
}

Draw Model:

Model::Draw(ICamera camera) {
    GLuint matrixID = glGetUniformLocation(programID, "mvp");
    GLuint positionID = glGetAttribLocation(programID, "position_modelspace");
    GLuint uvID = glGetAttribLocation(programID, "uv");
    GLuint normalID = glGetAttribLocation(programID, "normal_modelspace");
    GLuint tangentID = glGetAttribLocation(programID, "tangent_modelspace");
    GLuint bitangentID = glGetAttribLocation(programID, "bitangent_modelspace");

    glm::mat4 projection = camera->GetProjectionMatrix();
    glm::mat4 view = camera->GetViewMatrix();
    glm::mat4 model = glm::mat4(1.0f);
    glm::mat4 mvp = projection * view * model;

    glUniformMatrix4fv(matrixID, 1, GL_FALSE, &mvp[0][0]);

    glBindVertexArray(vertexArrayID);

    glEnableVertexAttribArray(positionID);
    glBindBuffer(GL_ARRAY_BUFFER, vertexbuffer);
    glVertexAttribPointer(positionID, 3, GL_FLOAT, GL_FALSE, sizeof(Vertex), &vertices[0].position);

    glEnableVertexAttribArray(uvID);
    glVertexAttribPointer(uvID, 2, GL_FLOAT, GL_FALSE, sizeof(Vertex), &vertices[0].uv);

    glEnableVertexAttribArray(normalID);
    glVertexAttribPointer(normalID, 3, GL_FLOAT, GL_FALSE, sizeof(Vertex), &vertices[0].normal);

    glEnableVertexAttribArray(tangentID);
    glVertexAttribPointer(tangentID, 3, GL_FLOAT, GL_FALSE, sizeof(Vertex), &vertices[0].tangent);

    glEnableVertexAttribArray(bitangentID);
    glVertexAttribPointer(bitangentID, 3, GL_FLOAT, GL_FALSE, sizeof(Vertex), &vertices[0].bitangent);

    glBindBuffer(GL_ELEMENT_ARRAY_BUFFER, elementbuffer);
    glDrawElements(GL_TRIANGLES, indices.size(), GL_UNSIGNED_SHORT, (void*)0);

    glDisableVertexAttribArray(positionID);
    glDisableVertexAttribArray(uvID);
    glDisableVertexAttribArray(normalID);
    glDisableVertexAttribArray(tangentID);
    glDisableVertexAttribArray(bitangentID);
}

sentences:
Collision Detection algorithms with early Collision exit I'm using collision detection in Monte Carlo simulations and at the moment I'm using GJK which is quite fast. I can't help to think it could be done even faster though. In the simulations, about 70% of the time GJK is run, it detects a collision. Thus collisions are more than non-collisions in my case. Most collision detection algorithms I know have an early non-collision exit test.

Are there any collision detection algorithms that have an early collision detect instead of non-collision and could be potentially faster than GJK in case of collision?

sentences:
2D Real-Time shadows on level on a level made from a Dynamic Bitmap The Bitmap has transparency, and only non-transparent pixels are solid and used for hit detection for the physics engine and gameplay.

I have seen some versions done with convex hulls, but for multiple reasons I am not using convex hulls to build the levels in my game.

How can I implement 2d shadows on a level made out of a Dynamic Bitmap?

The answer jpaver posted is good, but I am sure there are some other ways to do this. Does anyone else have any more information on this question?

sentences:
How to render polygons of arbitrary shape? I am trying to render a plane with nodes.

FYI : Nodes know what other nodes it is being attached to.

I can think of a way to render them as long as they are aligned in a circular pattern; have a center and draw triangles. However I want the shape to be not necessarily circular.

I have a picture below to enhance my description. Attempting to draw such a vertices with my previously stated method will result into an undesired shape, like the third picture.

sentences:
Set the name of an animation in collada to be used by AssImp I am using the collada file format to contain my model and animation but when I use AssImp to load the file the name will be empty for the animation. Where is the name for animation set on the collada file format? The documentation seems to have pointed me to library_animations but I tried setting "name" and "id", but both did not end up setting the animation name.

To get the animation name I am simply doing

        aiAnimation* animation = mAIScene->mAnimations[i];
        auto test = animation->mName;

sentences:
How to prevent a hacked-server from spoofing a master server? I wish to setup a room-based multilayer game model where players may host matches and serve as host (IE the server with authoritative power). I wish to host a master server which tracks player's items, rank, cash, exp, etc.

In such a model, how can I prevent someone that is hosting a game (with a modified server) from spoofing the master server with invalid match results, thus gaining exp, money or rankings.

Thanks. -Cody

sentences:
How can I make an attached gameobject behave correctly on character flip? I have a character that on start-up is equipped with another gameobject/prefab as a weapon, attaching it to a hand.

void Start()
{
    handFront = transform.Find ("root/Hip/BodyBone/OverArmFrontBone/UnderArmFrontBone/HandFrontBone/HandFrontMount");

    instance = (GameObject)Instantiate(Resources.Load<GameObject>("VioletClub"), new Vector3(-0.5f,2f,1f), new Quaternion(0f,0f,45f,-45f));
    instance.transform.parent = handFront;
}

As long as I move the character in the initial direction (right) the attached object behaves as it should, staying in the hand no matter the animation played. But when I flip the character, the attached object doesn't flip correctly. In the initial position (standing still) it looks correct but when I start to move the character, the item flips and rotates the wrong way. It does not follow the arm movement like it should.

This is what I do on flip:

void Flip ()
{
    facingRight = !facingRight;

    Vector3 theScale = transform.localScale;
    theScale.x *= -1;
    transform.localScale = theScale;

}

When I flip the character back to the right again it all work as it should.

Can anyone help me?

sentences:
Adding Openai's GPT3 to a Unity project? I have a text-based project and it has a slot open for Openai's GPT3 model. My project has a terminal module where the user receives emails, I want to go a step further and allow the user to respond to such emails and get some unique response.
Here is a rundown of how I want it to work: User receives "email", they respond to it, GPT3 steps in and feeds a response into a new "email".
So how would I approach this? I think this could be pretty interesting as GPT3 hasn't been implemented in any games yet. I am aware that some beefy hardware may be required but my development computer is quite beefy enough.
P.S. Sorry if my title isn't specific enough, closest thing I could think of for this situation.

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:
Swapping axis labels between 2D and 3D coordinates My game world is 3D.

The map is only 2D, however.

It is natural to think of the map as having an X and Y axis.

And it is natural to think of the world has having an X, Y and Z axis, where Y is upwards.

That is to say, X Y in 2D map coordinates is X Z in 3D coordinates.

What conventions and approaches do you have to keeping things straight at a code level to make mapping between them natural?

(Is Y usually upwards in 3D?  Or do you have X and Z in map coordinates, or?)

sentences:
How to create a very specific kind of joint in Farseer? Edit

Problem solved (see Drackir's answer). Here's a demo of what I was trying to achieve with this joint. More info about the scenario on this other question.

Problem

I'm trying to create a very specific type of joint in Farseer that behaves like this:

Objects should always keep the same distance between them in both the X and Y axes.
Translation - A collision with one of the objects should move the entire group together, but the group must not rotate - only the individual objects may rotate around their centers as a result of torque.
Rotation - Objects should always have the same rotation. A collision with one of the objects should make all others rotate the exact same amount.

Here's a picture:

If there's no way to achieve this with Farseer out of the box, how would I go about extending it to create a new type of join that works like this? Basically I want every body to behave like a "clone" of the others, but with a fixed offset between them.

sentences:
Vector normalization gives very imprecise results When I normalize vectors I receive very strange results. The lengths of the normalized vectors range from 1.0 to almost 1.5. The functions are all written by me, but I just can't find a mistake in my algorithm. When I normalize I just divide all components of the vector by the vector's length.

public double length(){
    return Math.sqrt(x*x + y*y);
}

public void normalize(){
    if(length() > 0){
        x /= length();
        y /= length();
    }
}

Is this supposed to happen? I mean I can see the length ranging from 0.9 to 1.1 at worst, but this is just overwhelming.

Cheers

sentences:
abstracting window and move semantics I am using GLFW to manage OpenGL context and as such, delegate this task to a GLFW window. For managing the pointer to a window instance, I am thinking a class like this:

class window_t {
public:
    using win_handle = GLFWwindow*;

    window_t(size_t width, size_t height, const std::string &title)
    {
        // Initialize GLFW
        if (!glfwInit())
            std::exit(EXIT_FAILURE);

        // Set up OpenGl core profile
        ...

       // Open the window
       w = glfwCreateWindow(width, height, title.c_str(), NULL, NULL);

       if (!w) {
            glfwTerminate();
            std::exit(EXIT_FAILURE);
       }

        glfwMakeContextCurrent(w);
    }

    void swap_buffers()
    {
        glfwSwapBuffers(w);
    }

    void poll_events()
    {
        glfwPollEvents();
    }

    void terminate()
    {
        glfwTerminate();
    }
    bool about_to_close()
    {
        return glfwWindowShouldClose(w);
    }

private:
    win_handle w;
};

Think something similar. In my display_t class, I have an instance of window_t and an instance of scene_graph. Functions on my scene graph are like render(window_t), handle_input(window_t) etc. What would my strategy should be in passing around these window instances? These are actually a handle to GLFW window and OpenGL context. It is not desirable to copy them because some parts of these context variables are living in VRAM and relates to GPU state. So if I want to change the context variables on say handle_input(window_t), copying the window would defy the purpose. On the other hand, I don't want to pass raw pointers around. I can do a singleton maybe, considering I probably won't have multiple windows and OpenGL contexes. I am not really sure about this one though. And they say, singleton is as good as a global variable.

Maybe I should make window_t moveable but not copyable, making it hold a unique_ptr or something like that. I want to use value semantics as much as I can.

I really don't know the correct abstraction here. What would you suggest? Should I get rid of passing a handle to window to each object in scene graph? I am actually looking for a way to do this but all render calls, input handling etc. modifies the context variables. Want to hear your suggestions on this.

sentences:
What should I keep in mind when making 2D games for multiple resolutions? I'm making a 2D (Android) game. Android devices vary quite a lot in screen resolution; what do I need to keep in mind when making my game?

Do I need to keep big versions of all images and scale down depending on the resolution (doesn't that waste space)?
Do bitmap fonts scale well or do I need to use something else?
Anything else I'm forgetting?

sentences:
Are there any open source Source engine VTX/VVD viewers? I've been playing with loading and displaying Source Engine models (TF2, specifically) and have had mild success, but there are some aspects of it that are eluding me still. I've been primarily looking at http://developer.valvesoftware.com/wiki/MDL and online forks of the SDK headers like http://hlssmod.net/he_code/public/studio.h to understand the formats, but I've found the headers to be helpful, but lacking some crucial implementation details. The Developer Community pages do talk implementation, but much of it is speculation and I've already identified several points where it is wrong, so I'm struggling to locate some better resources.

I've got the whole .VVD file parsing now (as in: I can get the correct verts for a given LOD, verified by rendering a pointcloud.) The specific issue I'm looking at now is in the .dx90.VTX file. Drilling down into the Mesh Strip Groups, it seems like I can render the first strip group just fine (I have the Heavy's chest, arms, and legs rendering) but subsequent meshes are a mess of random triangles. It feels to me as if there should be a per-mesh offset into the .VVDs vertexes somewhere within the .VTXs structure, but I can't locate one. Maybe there's something in the .MDL, which I haven't started looking into yet, but it feels very odd to me to have such closely related data in separate files.

I know that's probably all gibberish to anyone that's not intimately familiar with the Source model formats. Really what I could use more than anything else is some reference code from another app that is loading these files. Are there any open-source exporters/viewers out there?

sentences:
One large tileset or multiple tilesets I'm currently writing a 2d tile scroller for a hobby project and I can't find any resources to give me a clear answer to which is more efficient to do.

Each block contains tiles 44 by 24, 32px x 32px in size, and I'm rendering all immediately-adjacent blocks offscreen. With each block, I am specifying what the types of the tiles are, such as Sand, Grass, Pavement, etc. My end goal is to have dozens of unique tiles in each set, potentially having several "Grass" sets to pull from, to have a diverse set of landscapes.

What I want to do:
I would like to only load tilesets that have tiles that appear in the loaded blocks. I would do this by marking tile "families" in Tiled, as well as giving them an ID that pertains to that tileset specifically.

However, I don't know if it's just better to load all of the tiles from one large tileset on the game's start and just keep it in memory, instead of making frequent content loads

Will the game potentially run more efficiently dynamically loading tilesets based on need, or one very large tileset when the game first starts?

sentences:
How do I calculate the bounce vector of a ball hitting the starting point of a segment? I have a ball (with parameters x, y, radius) that travels on the screen (with vectors directionX directionY) and can collide with a segment with random slope (with parameters startX, startY, stopX, stopY).

After i detect the collision i split code for calculate bounce vector in two different situations: first situation is ball in the middle of the segment (which is now working properly) and second is ball colliding the segment corners (starting or ending point) of a segment. Now,my algorythm is more or less working but sometimes there is some wrong behaviour and bounce is wrong or even no bounce (ball pass through the line without bounce)

This is the code i'm currently using:

       if (Math.pow(line.startX - x, 2) + Math.pow(line.startY - y, 2) <= Math.pow(radius, 2) || Math.pow(line.stopX - x, 2) + Math.pow(line.stopY - y, 2) <= Math.pow(radius, 2)) {
          // ball has hit the corner of the segment
           if (Math.pow(line.startX - x, 2) + Math.pow(line.startY - y, 2) <= Math.pow(radius, 2)){
               //calculate bounce vector with starting point of segment
                float x1 = x - line.startX;
                float y1 = y - line.startY;
                float c1 = (float) (-2 * (directionX * x1 + directionY * y1) / (x1 * x1 + y1 * y1));
                directionX += c1 * x1;
                directionY += c1 * y1;

           }
           else{
               //calculate bounce vector with ending point of segment
                float x1 = x - line.stopX;
                float y1 = y - line.stopY;
                float c1 = (float) (-2 * (directionX * x1 + directionY * y1) / (x1 * x1 + y1 * y1));
                directionX +=  c1 * x1;
                directionY +=  c1 * y1;
           }
        }

      else
            {
 //other code for calculating bounce vector after collision inside segment.

}

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:
Can't understand these UV texture coordinates (range is NOT 0.0 to 1.0) I am trying to draw a simple 3D object generated by Google SketchUp 8 Pro onto my WebGL app, the model is a simple cylinder.

I opened the exported file and copied the vertices positions, indices, normals and texture coordinates into a .json file in order to be able to use it on javascript. Everything seems to work fine, except for the texture coordinates which have some pretty big values, like 46.331676 and also negative values. Now I don't know if I am wrong, but isn't 2D texture coordinates supposed to be in a range from 0.0 to 1.0 only?

Well, drawing the model using these texture coordinates gives me a totally weird look, and I can only get to see the texture properly when I am very close (not really me, the cam) to the model, as if the texture has been insanely reduced in it's size and repeated infinitely across the model's faces. (yeah, I am using GL_REPEAT on that texture wrap thing)

What I noticed is that if I get all these coordinates and divide them by 10 or 100 I get a much "normal" look, but still not in the 0.0 to 1.0 range.

Here's my json file: http://pastebin.com/Aa4wvGvv

Here are my GLSL Shaders: http://pastebin.com/DR4K37T9

And here is the .X file exported by SketchUp: http://pastebin.com/hmYAJZWE

I've also tried to draw this model using XNA, but still not working. Using this HLSL shaders: http://pastebin.com/RBgVFq08

I tried exporting the same model to different formats, collada, fbx, and x. All those yields the same thing.

sentences:
(Unity) what happens if i get a transform.position of a nested object Okay so here is the example

You have a plane at position 0,0,0 with a scale 15,1,15 (for demonstration)

Now you have a parent object for the sake of simplicity lets call it parentObject this parent object has the following position: 7,25,26 The parent DOES NOT have a mesh and is thereby an empty gameobject

The parent has a child gameobject Here the issue starts the child has a transform position at 5,-25,30 however this objects transform.position is relative to the parent

last take our agent i know set him to go to childObject.transform.position will he then move correctly to the object or will he, in fact, move to the position that is relative to the parent object?

I know this might seem a bit messy but the general question is if i tell an agent to go to a gameobject that is a child of another object using transform.position will he go to the place we would expect?

sentences:
How to know if two surface are in the same direction? In my code I creat a Mesh that are composed by multiple tile. those tile can have edge that are shared, and I need to know if the normal of the tile that have shared edge have the same direction, because I calculat the normal of the edge to smooth the light. before I used the Vector.Dot() , but I've sometimes two tile that have a curve that make impossible to use this function as you can see in the 4th image.
and the only information that i have in the calcul is the 2 normal of the tile.
 img 1 : diferent direction
 img 2 : diferent direction
 img 3: same  direction
 img 4: same  direction
 img 5: same  direction

sentences:
How can I get textures on edge of walls like in Super Metroid and Aquaria? Games like Super Metroid and Aquaria present the terrain with the other facing parts having rocks and stuff while deeper behind them (i.e. underground) there's different detail or just black.

I would like to do something similar using polygons. Terrain is created in my current level as a set of overlapping square boxes. I'm not sure if this rendering method will work such a system for creating terrain but if anyone has ideas I'd love to hear them. Otherwise I'd like to know how I should re-write the terrain rendering system so it actually works to draw terrain in this manner...

sentences:
2D isometric pixel art technique I recently started to work on a project which consists in developing a game similar to the Urbz on Gameboy Advance (the Handheld version of the game developed by Griptonite Games). This is mainly a project to learn how to make a video game from scratch, especially one in 2D (isometric in this case). I'm planning to use C++ with SFML for this project. I already have some skill in programming, but since I would also like to draw the art by myself and have no experience in that I was wondering how I could do that.
Especially, I was wondering how did the the team behind the Urbz draw their art and what kind of technique was being used? It doesn't seem to me a 'handcrafted' kind of pixel art :

I also made some research about developing a 2D isometric game engine. It seems that a popular technique is to draw the map from an isometric tileset (as shown here by eishiya for instance). However the team from Griptonite Games seems to have used several big maps, such as this :

Or am I getting things wrong ? What kind of engine/technique might have they been using ?
Many thanks for reading this post (and maybe for answering too) !

sentences:
Establishing if a tile is available to move into I'm working on a grid-based game as a hobby project. Think of an ANSI game like ZZT. The grid is represented by a two-dimensional array of objects which contain both the UI element which takes care of displaying the sprite image and also the data accompanying whatever is in that position on the grid. I'm having trouble working out the mechanics of elements on the game grid determining whether they are able to move into a neighbouring cell.

Determining whether there is something in any given grid position is straightforward, as each instance of the class representing a cell on the grid has a property representing the sprite in occupation of the cell. Checking if this property is nil works fine in establishing if something static is there, but it becomes problematic if there are many objects moving from one grid position to another. The problems I'm having are:

Objects in grid cells will attempt to push objects out of their destination cell; this is intended behaviour, so that the player or NPCs can move objects around. The object which is pushed will check if it is capable of moving in that direction, and if the cell into which it is being asked to move already contains another object. If it does, it will attempt to push that object, and so on and so on until an object either agrees to be pushed (into an empty spot), or refuses (because there is nowhere for it to move or because it cannot move in that direction). The return values for the attempt to push will then cascade back up to the originating object and the sprites all move (or not). This causes a problem, however, if there are several sprites moving in a straight line in the same direction. Rather than all moving forwards together (which they should), the last object in the line thinks that the next cell is occupied so tries to push the object in that cell, which is unnecessary, because that object will be moving anyway. This causes the objects to spread out with gaps between them, which is abnormal.
Due to this, I considered having the objects check if the destination cell is occupied, and if so, check if the object in that cell will be moving out, and if anything else will be moving in. However, I'm concerned this could result in a condition where several objects may refuse to move because of each other's presence.

I have considered looking at source code for a similar game, but I don't want to copy another implementation, rather I'm looking for guidance on how I can solve the problem. Thanks in advance!

sentences:
XNA Calculate two points of triangle with given Z I want to calculate the two points of a 3D triangle that have a specified Z coordinate. I guess the way to do this would be to somehow create a plane which is perfectly flat with my given Z coordinate and then calculate where the triangle intersects with it (or is this wrong).

If you know how to do this in any way please help. I have searched for but have not really found anything that seems to work.

sentences:
How can I disable/dim the screen when I click the pause button? I am working in an android game using cocos2d. I want to dim the background screen when I click the pause button.

How can I do this ?

sentences: Approximating strength and hardness of alloys I do not have any formal education in metallurgy, but I am trying to make a game mechanic based on it. I need to be able to alloy together different metals and alloyable materials such as carbon in different percentages, and get an approximation of the strength and hardness of the resulting alloy. If anyone has any ideas how what I would need to do to calculate such a thing I would be very appreciative, thanks!

sentences:
How to stop movement when an action key is pressed even if movement key is pressed I'm making a 2d side-scrolling fighting game in game maker:studio and I want to make a code that when the player attacks he stops moving.
I've tried some options:

keyboard_check(ord("D"));

both this and

keyboard_check_pressed(ord("D"));
x += 0

I also tried

hspeed = 0

I also tried adding these to my left and right key events:

if (sprite_index = spr_atk_right)
 {
 x -=4 for right key event or x += 4 for left key event
 }

I have a right key and left key event with the simple code
x += 4 for the right key and x -= 4 for the left key. I was hoping the second set of codes would cancel it out but neither worked.

sentences:
Copyright laws on famous buildings and monuments in games? I am working on a commercial card game based on the middle east. We would like to have famous buildings and monuments in the game, such as the Burj Al-Arab in Dubai.

Are there laws that would prevent us from using pictures or drawings of famous buildings in commercial games?

sentences: How can i handle collision response in a voxel game? I'm making a voxel game with cubes - like in minecraft - and I have figured out how to check wether the player is colliding with a voxel, I have just done it by checking wether the player is within a voxel which is not air, however I don't know how to respond to that i know that the player is inside of a solid cube/voxel. Can anyone please suggest how to do it?

sentences:
Confused on graphics rendering Implementing a viewport is just a rectangular space on the back buffer usually a 2d texture set to the size of the client window that we render to.

However in direct3d when we describe the viewport it asks for the window width and heights and the top left X,Y position

From what I understand normalized device coordinates for the top left would be represented by 1,-1 and if I chose another type of device coordinate would be represented by 0 , 0.

How does this translate To a coordinate system for primitives I draw on screen from some file formats like wavefronts OBJ format their are coordinates that are out of range from -1 to 1.

sentences:
What are the responsibilities of a game engine, and which of these things need to especially be efficient? Possible Duplicate:
  What should a game engine do?

What are the usual responsibilities of a game engine, and which of these things especially need to be efficient (performance-wise)?

Can I get a break-down of the purposes that a game engine is used to serve, and how it differs from a game itself? I'm a newb, so some intuitive things may need to be explained.... Thanks! :)

sentences:
Dashing mechanic in top down projectile dodging game in pygame im making a simple third person top down game where you dodge projectiles than fly in from either side of the screen, its a simple high score game where the longer you avoid being hit, the better your score.
i want to give the player the ability to dash in any movable direction by using a resource (lets call it a dashcoin)
if the player collides with a certain target, they get one dashcoin, which can be expended to dash forward at increased speed for a brief moment. im also hoping to remove player control while they dash
this is the entirety of the code right now. currently theres no projectiles to dodge, but im working on that.
import pygame
pygame.init()

win = pygame.display.set_mode((630, 530))

pygame.display.set_caption("Cube Dash")

x = 250
y = 250
width = 30
height = 30
vel = 3

run = True
while run:
    pygame.time.delay(10)

    for event in pygame.event.get():
        if event.type == pygame.QUIT:
            run = False

    keys = pygame.key.get_pressed()

    if keys[pygame.K_LEFT] and x > 60:
        x -= vel
    if keys[pygame.K_RIGHT] and x < 550:
        x += vel
    if keys[pygame.K_UP] and y > 10:
        y -= vel
    if keys[pygame.K_DOWN] and y < 490:
        y += vel
    if keys[pygame.K_ESCAPE]:
        run = False

    win.fill((0,0,0))
    pygame.draw.rect(win, (255, 255, 255), (x, y, width, height))
    pygame.display.update()

pygame.quit()```

im completely new to pygame and got most of this from tutorials, so any help is appreciated

sentences:
Unity - Easier way to resize group of buttons to the same size I have a canvas with buttons, with a script attached to each button. This script creates an array for buttons and resizes every button to the same size as the longest one in that array (the button with the longest line of text in it). Everything works, but I was wondering: is there is an easier, more automatic way for this instead of having to drag every button in every array in the Inspector tab?

Any ideas would be greatly appreciated

UnityPackage: https://transfer.sh/6BCDG/buttonwidth.unitypackage

public Image[] otherbutton;

void Start () {

    for(int i = 0; i < otherbutton.Length; i++)
    {

        if (otherbutton[i].rectTransform.sizeDelta.x > gameObject.GetComponent<Image>().rectTransform.sizeDelta.x)
        {
            gameObject.GetComponent<ContentSizeFitter> ().enabled = false;

            gameObject.GetComponent<Image>().rectTransform.sizeDelta = new Vector2( otherbutton[i].rectTransform.sizeDelta.x, otherbutton[i].rectTransform.sizeDelta.y);

        }
    }
}

sentences:
Developing for Chrome App/Android? I have been developing for win7 mobile (XNA/silverlight and will continue to do so, love everything about it) but I wanted to branch a few of my more polished games to google app store online, and perhaps android(though not sure, as with all the different versions it makes learning/loading applications a bit tricky)

What is the most versatile language to start learning from chrome apps/android:

Java would be excellent for android, but could I port it to a web app for chrome? (and its close to C#)

Flash would work for a web app as I can just embed it into a html page (have done actionscript before, didn't care much for the IDE though), but would it also work on android?

or I guess there is always C/C++ but haven't heard much about that, though I think it works for both (though C++ does interest me)

Any advice would be excellent, thanks.

sentences:
Implementing win condition I'm making a turn based game in java for fun, it follows a set game flow pattern contained in a loop. I realized that once a player hits a win condition the game continues playing out the rest of the turn, possibly changing the victor.

Do I need to go back and put if statements everywhere so nothing is executed once a victor is declared? Is there a more elegant solution?

sentences:
How to use facebook sdk on a cocos2dx-project I'm doing a game cocos2d-x, when user gets a high score, I want them to touch on the Facebook icon and share the high score on their Facebook account timeline.

tutorials on facebook.developer.com using for objective-c project

Can anybody help me:(

sentences: How crucial is 3D terrain in a classic RTS game? My love of RTS games is from the days of Warcraft II, C&C, etc, when top-down/isometric views were king and terrain was generally tiled and flat. More modern games - as CPU/GPU power increased - moved to fully 3D terrain but I wondered is this considered a necessity in a modern game or would a more old-school design still have mileage? 3D terrain adds tactical elements but are those essential, or typically not that important to the gameplay, or even gimmicky?

sentences:
Is there a game not using meshes for models? Traditionally, models consist of lots of vertices connected by triangles. That forces the use of a high amount of vertices for detailed  organic shapes or makes models kind of blocky. Even though polygon models can be smoothed by subdivision algorithms, this slow, not that exact or still needs a lot of vertices.

Instead, models could be represented by 3 dimensional splines, bezier patches, nurbs or something similar. This way, we would gain perfectly detailed models instead of blocky one with much less vertices. I am not an expert but I assume that a spline could be even rendered faster than its polygon representation. To make the such mathematically perfect shapes more detailed, we could use displacement mapping.

The only big challenge I can see is projecting those splines in the correct perspective. We can simply multiply all vertices with a projection matrix since they are not connected by straight lines. Instead the parameters of a curve must be modified to fit another perspective. I am not sure if there are mathematical straight forward ways to do this.

Are there games using the latter approach?

sentences: Multiple If Operations at Once In my game, I want to have it so that if a chess piece tries to move farther away than a certain distance it won't work. To do this, I need it to have an if statement that works between two numbers, but I can only seem to do above or below a number, not between. Is there a way to do this, or am I going to have to use to if statements?

sentences:
Match-3 should pieces store their location in the matrix? I'm making a match-3 game. I have a TileManager script which stores all the tiles in a matrix, it's a singleton and it handles tile swapping and basicly everything regarding the management of tiles.
I have a variable called selectedTile. I have a method called SwapSelected which swaps the currently selected tile with the one you just clicked on. As pieces don't know their location in the matrix I can only loop through the whole thing to find them but it feels extremly stupid I just feel like there's gotta be a better way. If pieces stored their location and I kept that updated all the time that'd feel stupid too.
What could I do to make this method work nicer and more optimalized? Is there a way or there is no problem with how I do it?
    public void SwapSelected(Tile tileToSwap)
    {
        Vector3 tempPos = selectedTile.transform.position;
        selectedTile.transform.position = tileToSwap.transform.position;
        tileToSwap.transform.position = tempPos;

        Vector2Int tileToSwapPosition = new Vector2Int(-1, -1);
        Vector2Int selectedTilePosition = new Vector2Int(-1, -1);

        //OPTIMALIZE!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
        for (int x = 0; x < _tileMap.GetLength(0); x++)
            for (int y = 0; y < _tileMap.GetLength(1); y++)
            {
                if (_tileMap[x, y] == tileToSwap)
                {
                    tileToSwapPosition = new Vector2Int(x, y);
                }
                if (_tileMap[x, y] == selectedTile)
                {
                    selectedTilePosition = new Vector2Int(x, y);
                }
            }

        _tileMap[selectedTilePosition.x, selectedTilePosition.y] = tileToSwap;
        _tileMap[tileToSwapPosition.x, tileToSwapPosition.y] = selectedTile;

        UpdateTileName(tileToSwap);
        UpdateTileName(selectedTile);
    }

sentences:
Collisions and Lists I've run into an issue that breaks my collisions. Here's my method:

Gather Input
Project Rectangle
Check for intersection and ispassable
Update

The update method is built on object_position * seconds_passed * velocity * speed. Input changes velocity and is normalized if > 1.

This method works well with just one object comparison, however I pass a list or a for loop to the collision detector and velocity gets changed back to a non zero when the list hits an object that passes the test and the object can pass through.

Any solutions would be much appreciated. Side note is there a more proper way to simulate movement?

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: Keep gravity velocity the same all the time I have 2D rigidbodies that fall to the ground, however they speed up while falling. Also, when they freeze in the air and then unfreeze, the velocity is set to 0 and they gradually start speeding up again. How can I keep the velocity constant at all times, until they hit the ground?

sentences:
Collision Direction Detection I'm making an RPG game where players and enemies can collide with walls.
Right now it pushes the player off the wall when he tries to 'go through' it.
However, I detect which way he should be pushed based on his current direction.
This means that enemies can still push him through walls.
Also if the player moves diagonally, detection doesn't work properly. This is a problem...

I'm using SFML and these Collison-Detection methods: https://github.com/LaurentGomila/SFML/wiki/Source:-Simple-Collision-Detection-for-SFML-2

Specifically I'm using this method:

bool BoundingBoxTest(const sf::Sprite& Object1, const sf::Sprite& Object2)
{
    OrientedBoundingBox OBB1 (Object1);
    OrientedBoundingBox OBB2 (Object2);

    // Create the four distinct axes that are perpendicular to the edges of the two rectangles
    sf::Vector2f Axes[4] = {
        sf::Vector2f (OBB1.Points[1].x-OBB1.Points[0].x,
        OBB1.Points[1].y-OBB1.Points[0].y),
        sf::Vector2f (OBB1.Points[1].x-OBB1.Points[2].x,
        OBB1.Points[1].y-OBB1.Points[2].y),
        sf::Vector2f (OBB2.Points[0].x-OBB2.Points[3].x,
        OBB2.Points[0].y-OBB2.Points[3].y),
        sf::Vector2f (OBB2.Points[0].x-OBB2.Points[1].x,
        OBB2.Points[0].y-OBB2.Points[1].y)
    };

    for (int i = 0; i<4; i++) // For each axis...
    {
        float MinOBB1, MaxOBB1, MinOBB2, MaxOBB2;

        // ... project the points of both OBBs onto the axis ...
        OBB1.ProjectOntoAxis(Axes[i], MinOBB1, MaxOBB1);
        OBB2.ProjectOntoAxis(Axes[i], MinOBB2, MaxOBB2);

        // ... and check whether the outermost projected points of both OBBs overlap.
        // If this is not the case, the Seperating Axis Theorem states that there can be no collision between the rectangles
        if (!((MinOBB2<=MaxOBB1)&&(MaxOBB2>=MinOBB1)))
        {
            return false;
        }
    }
    return true;
}

Note that the method only checks if the sprites collide, not how or where they collide.
I don't know how exactly the collision detection works, I've tried printing out the OBB values but they're nonsensical to me.

Should I somehow modify the function, or is there another way of doing collision direction detection? I'm stuck here.

UPDATE

I managed to actually check for which direction the player was colliding with the wall.
I have a really odd problem now:
It only works properly on the last wall I place.

I have 4 booleans (canWalkUp, canWalkDown, canWalkLeft, canWalkRight) to check for if the player is holding down both left and right, or up and down - so they don't negate each other. This prevents wonky movement.
I also have 4 booleans to check if the player is currently colliding with a wall.

The code which handles player-boundary collision is as follows:

void EventHandler::collisionPlayerBoundary(std::shared_ptr<Entity> player,     std::shared_ptr<Entity> boundary)
{
std::vector<sf::Vector2f> distances = Collision::BoundingBoxDistance(player->sprite, boundary->sprite);
float pushSpeed = 75;
if(distances.at(0).y < 20) //push left!
{
    std::cout << "pushing left" << std::endl;
    player->pushX = -pushSpeed;
    player->canWalkRight = false;
    player->collidingRight = true;
}
if(distances.at(1).y < 20) //push down!
{
    std::cout << "pushing down" << std::endl;
    player->pushY = pushSpeed;
    player->canWalkUp = false;
    player->collidingUp = true;
}
if(distances.at(0).x < 20) //push right!
{
    std::cout << "pushing right" << std::endl;
    player->pushX = pushSpeed;
    player->canWalkLeft = false;
    player->collidingLeft = true;
}
if(distances.at(2).x < 20) //push up!
{
    std::cout << "pushing up" << std::endl;
    player->pushY = -pushSpeed;
    player->canWalkDown = false;
    player->collidingDown = true;
}
}

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:
XBOX + Xna != DirectX? I'm a bit confused. The question is: when I'm developing a XNA game for Xbox (or Windows), is it possible to use DirectX (to make use of the GPU)? Or is everything getting calculated by the CPU?

A quick Google search didn't gave any results of combining those two...

sentences:
Can I dynamicaly modify 3D objects? I am new to OpenGL, I am able to render a model object (a human model) that is using .obj and .mtl file in iOS.

Now I want to make a modification to the loaded model. For example, I want to change the height, or change the shoulder width, stomach size, et cetera.

Is this possible ? If so, how do I go about it?

sentences: Can a game world be made using a 3D editor? I'm just wondering it it's possible to create and render a game world in a 3D modelling program, such as Blender, with landscapes and trees and such, and then import it into a game engine? Is that how open world games make their worlds, or do they use another method?

sentences:
Since Table.drawDebug is deprecated in libGDX, what should I use instead? I am following the "Learning LibGDX Game Development" book to make a simple game. I am in the menu creation section where we create a stage and render it with debug borders.

The book says to use Table.drawDebug(stage) but this static method seems to have been removed from the frameworks Table class entirely.

I am importing com.badlogic.gdx.scenes.scene2d.ui.Table; below is my code:

@Override
public void render(float deltaTime) {
    Gdx.gl.glClearColor(0.0f, 0.0f, 0.0f, 1.0f);
    Gdx.gl.glClear(GL20.GL_COLOR_BUFFER_BIT);

    if (debugEnabled) {
        debugRebuildStage -= deltaTime;
        if (debugRebuildStage <= 0) {
            debugRebuildStage = DEBUG_REBUILD_INTERVAL;
            rebuildStage();
        }
    }
    stage.act(deltaTime);
    stage.draw();

    Table.drawDebug(stage);
}

The last line, Table.drawDebug(stage); has the compilation error "The method drawDebug(ShapeRenderer) in the type Table is not applicable for the arguments (Stage)"

Is there a new way to draw the stage in debug mode?

sentences: How can I provide access to a Python command-line from in-game? Is there a way to interact with the command line from in-game? I would like to have the user be able to jump on a console or even just interact with a button and have the game run a Python script in the background, ideally passing the output back to the user in-game.

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:
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:
OnTriggerEnter / OnTriggerStay triggers multiple times and is not been call a second time I am working on a feature that when the Player pass thru a door, a message will popup on the screen.
I'm having few problems: Debug.Log gives me from 2 to 6 logs when I pass thru the collider plane and when I come back to the same collider plane the script it is not been call a second time.
What I'm trying to achive is that Debug.Log gives me only one log and every time I pass thru the collider the script runs again.
so here is my code:

function OnTriggerEnter (other : Collider) { //OnTriggerStay gives the same result
    if (other.tag == "Player") {
    isColliding = true;
  } else {
    isColliding = false;
  }
}
function OnGUI() {
  if (isColliding) {
      Debug.Log(isColliding);
    //Application.ExternalCall('hive.OpenHiveAlert', 'test');
  }
}
function OnTriggerExit() {
    Destroy(this);
}

Any help would be appreciated, thanks.

sentences:
non-linear interpolation I have an object, and i want to interpolate its position between two points over a given time period; but i dont want it to be a linear interpolation. I'm not sure if i'm phrasing this right.

vector posA; // Where we start
vector posB; // Where we end
float timeI; // An interval from 0 - 1

normally i would just do it linearly

vector currentPos = posA  + (posB - posA) * timeI

but i want the object to either:

a) move faster at the start and slower at the end
b) move slower at the start and faster at the end

Can anybody point me in the right direction

sentences:
3ds max CAT Animation layers export I've made 3 absolute layers

Each layers has it's own animation cycle. Now I would like to export it as FBX and import to unity3d, however, it would import only active layer.
Is it possible to export it the way, it would be possible to choose later on in unity which animation cycle to play?

Thanks in advance

sentences:
How to make a game object scale up from another game object I have a GameObject. I'm trying to make another GameObject grow in scale from touching this GameObject, and when a set amount of scale is reached, destroy this GameObject. My problem is that when I access ScaleUp, it dosn't add any scale to the other GameObject.

How do I scale another GameObject? Here is my ScaleUp script:

using UnityEngine;
using System.Collections;

public class ScaleUp : MonoBehaviour
{

    public GameObject Player;
    public PlayerMovement PlayerScript;

    private float playerScaleX;
    private float playerScaleY;

    public float scaleUp = 10.0f;

    void Start()
    {
        Player = GameObject.FindGameObjectWithTag ("Player");

        PlayerScript = Player.GetComponent <PlayerMovement>();

        playerScaleX = Player.transform.localScale.x;
        playerScaleY = Player.transform.localScale.y;
    }

    void OnTriggerEnter2D (Collider2D other)
    {
        if (other.tag == "Player")
        {
            playerScaleX += scaleUp;
            playerScaleY += scaleUp;

            Debug.Log ("GROW");
        }
    }
}

sentences:
Is an extra collision-mesh for level-data worth the hassle? What is the optimal approach for collision-detection with the environment in an 3D engine (with triangle mesh based geometry, no bsp)?

A) Use the render mesh

[+] no need for additional work for artists to fiddle with collision detection
[-] high detail is harder for physics calculation
[+/-] maybe use collidable flags for materials
[+/-] compute the collision-mesh from the render-mesh

B) Use an additional collision mesh

[+] faster/more optimal collision-detection
[-] additional work (either by the artist or by the programmer who has to develop an algorithm to compute it from the render-mesh)
[-] more memory useage

How do AAA title handle this?
And what are the indie dev's approaches?

sentences:
what function creates rotation effect in three.js? which part of the code is responsible for the rotation in this example? Is it the camera or the scene itself?

http://threejs.org/examples/#canvas_camera_orthographic

sentences:
Persistent Browser Based Game: To Captcha or not to Captcha? I've been working (off-and-on) on a pbbg that's pretty old school.  If you've ever played Carnage Blender then you get the idea.

If not, it's a simple idea that's been done a lot:  A player is allocated a certain number of "points" each day, and spends those points to attack other players.  Points accrue over time, up to a certain cap.

The point system is designed to prevent over-achievers from completely out-pacing casual players.

In the case of carnage blender, a CAPTACHA system prevents a user from "gaming" the system with a bot or a script designed to use all of their points each day with minimal effort.  Every once in a while a random CAPTCHA is displayed, and if not passed the user will be suspended for an hour.

What I'm wondering is how to make this more user friendly for my game.  I recognize that I must prevent bad behavior like this, and I could easily take the same CAPTCHA approach, but is there a more user friendly alternative?

Initial research uncovered ASIRRA by Microsoft, but the fluffy/cute vibe doesn't work well with my intended game theme.

UPDATE
What I'm most interested in are alternatives to the standard "spell this word" CAPTCHA.  I want to try to keep game-play as uninterrupted as possible for the good players.

I've seen what I call One-Time-Use CAPTCHAs, like asking a user "what is five plus six minus two?"  But this would require too much effort compiling a large enough database of questions to foil the malicious users.  Especially since the CAPTCHA is intended to be used so often.

UPDATE #2
As Joe Wreschnig pointed out in his answer, having a CAPTCHA system to limit bots from playing the game faster than humans is a bit redundant if turns are limited per day.  I didn't explain my point system to-the-letter, and that was my fault.  In reality, 10 or 20 points accrue every few minutes, and cap off at 200.  So, a very competitive player could return every few hours and use his points.  I want to reward those people who like my game so much that they return so often.  If I prevent them from playing until the next day when they get their points, I would be turning away players who would otherwise be enjoying my webgame.  This prevents a player from spending points constantly while still giving them a few points every few minutes.

This is open to abuse.

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

sentences:
iOS 9.3.5 WebSocket connection always closes with code 1006 I'm working on an app that uses a LabVIEW implemented server on the backend that is proxied via apache. It works great on desktops and android devices but on iPhone and iPad the websocket connection always fails and provides code 1006 in the close event. (No reason)

The request as received in LabVIEW:

GET /r9000_ws HTTP/1.1
Host: localhost:54663
Origin: http://192.168.1.191
Pragma: no-cache
Cache-Control: no-cache
Sec-WebSocket-Key: ucoJ2G1XNSntZAOBCfG+uQ==
Sec-WebSocket-Version: 13
Sec-WebSocket-Extensions: x-webkit-deflate-frame
User-Agent: Mozilla/5.0 (iPad; CPU OS 9_3_5 like Mac OS X) AppleWebKit/601.1.46 (KHTML, like Gecko) Version/9.0 Mobile/13G36 Safari/601.1
X-Forwarded-For: 192.168.1.193
X-Forwarded-Host: 192.168.1.191
X-Forwarded-Server: localhost
Upgrade: WebSocket
Connection: Upgrade

And the response I'm sending back:

HTTP/1.1 101 Switching Protocols
Upgrade: WebSocket
Connection: Upgrade
Sec-WebSocket-Accept: NUDL0C4/691VkogIvxQRHM1xJA8=

I have tried this in both google chrome and safari on an older iPad. Unfortunately due to the fun of WebSocket security I can't get any useful information on where the failure resides. Thanks to anyone that can see what I'm missing!

sentences:
How can I make a health bar — a UI element — part of a character prefab? Description
I want my character prefabs to come with their own health bar, but I can't simply add one as part of the prefab, because it's a UI element and therefore goes into a Canvas.
Potential Solution
I could write a script that takes in a separate health bar prefab and instantiates it when the character prefab's instantiated, but it's one extra script.
Is there a more conventional way to do this? I'd think this is a common problem.

sentences:
Turning layout items invisible in Android layout I am trying to turn some items visibility off when submitting a high score.

I have the following code but it does not appear to work.  Any suggestions?

mSignText = (EditText) findViewById(R.id.sign);

submitBtn = (ImageView) this.findViewById(R.id.submitbtn);

mSignText.setVisibility(View.GONE);

submitBtn.setVisibility(View.GONE);

sentences:
How can I calculate "All squares within R" in a natural looking manner? I'm working with a square grid, and I have a couple of effects that target all squares within R; in other words, a circular (or spherical) effect.

But, circles being, well, circular, and squares being... less so, things obviously have to be approximated. For instance:

But! I feel that some of these approximations don't quite give the approximation I want. For instance, consider this square:

It's obvious that the majority of the square falls within the circle, but using a pure "square counting" method (i.e., all squares within R of the origin), it gets left out.

Is there a better algorithm to grab all squares for which the majority of their area lies within the circle?

sentences:
How to fix this unexpected movement? I am facing a problem below is the detail.

There are two scripts(actually more than two but these have the problem) Cannon.cs and Launch.cs and three buttons(up, down, and launch) to move cannon and launch the bullet.
Cannon have bullets and each bullet has Launch.cs attached also a RigidBody2D.
When specific event occurs the Cannon.cs calls the Launch.cs's Launch(direction); method.
Parameter "direction" = Cannon.transform.right.
Bullets are being instantiated dynamically and are stored in the list Cannon.cs take one bullet and fires it(firing includes calling the Launch(direction));.
Launch(direction); will always be called once no matter what also to double sure myself I destroy the launch script on launch.

The problem is once the bullet is fired or launched in the direction specified by the direction of cannon(since direction = cannon.right) and I click on the up or down button the launched bullet changes its direction which should never happen because Launch() method is called only once in the lifetime of the bullet and also I detach the Launch.cs script on launch.

I am using rigidbody2D.velocity = direction * thrust; what I think is that rigidbody2D.velocity once called will possess the direction just like a method called by reference. I am totally lost I hope I made my question clear please do help me if you can.

sentences:
Drawing the same model multiple times I am looking ways to improve the efficiency of my draw method in XNA/Monogame and understand how things work. I have just a group of 4 models (bricks), (red, green, blue, yellow) I am drawing multiple times on the screen (100-120 total models, so drawing each model 25-30 times) on the current frame.

Here is how i am drawing 1 of the 4 types of models (the red ones) right now:

Matrix[] transforms = new Matrix[Brick.Red.Bones.Count];
Brick.Red.CopyAbsoluteBoneTransformsTo(transforms);
ModelMesh mesh = Brick.Red.Meshes[0];
BasicEffect effect = (BasicEffect)mesh.Effects[0];
effect.EnableDefaultLighting();
effect.View = Matrix.CreateLookAt(cameraPosition, Vector3.Zero, Vector3.Up);
effect.Projection = Matrix.CreatePerspectiveFieldOfView(MathHelper.ToRadians(45.0f),
   aspectRatio, 1.0f, 10000.0f);
foreach (Brick brick in Bricks)
{
    int i = brick.Index / Columns;
    int j = brick.Index % Columns;
    modelPosition = new Vector3(-HalfWidth + j * BrickWidth,
        HalfHeight - i * BrickHeight, 0.0f);
    effect.World = transforms[mesh.ParentBone.Index] * Matrix.CreateScale(scale) *
        Matrix.CreateTranslation(modelPosition);
    mesh.Draw();
}

This code seems to not perform as well as I expected (since its just 4 models drawn many times on different locations) when I timed it with a StopWatch. Is there something silly in my code that could be done better and i'm missing it ? I can't tell because so far I have only worked with sprites and 2D.

Edit: From other codes I saw that they used effect.Parameters["World"].SetValue(...); to set the BasicEffect values, but that gave me a null exception, and I am not sure what is the difference of that function since in my mind it seems the same with effect.World = ...;

sentences:
Resolution problems when porting a Unity game to Android So, I'm porting a game to the Android for the first time in Unity3D. And I've run in to a few problems along the way. My current problem is the resolution doesn't seem to be right, it cuts off the edges of the screen and my scrolling stops for scrolling the screen left/right are no longer in the right place.

After doing a bit of research, a lot of people say you need to make your game Resolution Independent to be able to run on all Androids/Iphone/Ipad. Is this true? If so, how do I go about doing that? If not, how can I help fix the resolution so when I port to mobile devices it looks right?

EDIT:
I still don't really have what I need, resolutions still aren't working properly even with the code and tricks listed below. I need some way for the resolution to adjust based on the device. For some reason when I try to retrieve the resolution of a device using Mungoid's code it returns 0x0

sentences:
Algorithm to shoot at a target in a 3d game For those of you remembering Descent Freespace it had a nice feature to help you aim at the enemy when shooting non-homing missiles or lasers: it showed a crosshair in front of the ship you chased telling you where to shoot in order to hit the moving target.

I tried using the answer from https://stackoverflow.com/questions/4107403/ai-algorithm-to-shoot-at-a-target-in-a-2d-game?lq=1 but it's for 2D so I tried adapting it.

I first decomposed the calculation to solve the intersection point for XoZ plane and saved the x and z coordinates and then solving the intersection point for XoY plane and adding the y coordinate to a final xyz that I then transformed to clipspace and put a texture at those coordinates. But of course it doesn't work as it should or else I wouldn't have posted the question.

From what I notice the after finding x in XoZ plane and the in XoY the x is not the same so something must be wrong.

    float a = ENG_Math.sqr(targetVelocity.x) + ENG_Math.sqr(targetVelocity.y) -
            ENG_Math.sqr(projectileSpeed);
    float b = 2.0f * (targetVelocity.x * targetPos.x +
            targetVelocity.y * targetPos.y);
    float c = ENG_Math.sqr(targetPos.x) + ENG_Math.sqr(targetPos.y);
    ENG_Math.solveQuadraticEquation(a, b, c, collisionTime);

First time targetVelocity.y is actually targetVelocity.z (the same for targetPos) and the second time it's actually targetVelocity.y.

The final position after XoZ is

    crossPosition.set(minTime * finalEntityVelocity.x + finalTargetPos4D.x, 0.0f,
                minTime * finalEntityVelocity.z + finalTargetPos4D.z);

and after XoY

    crossPosition.y = minTime * finalEntityVelocity.y + finalTargetPos4D.y;

Is my approach of separating into 2 planes and calculating any good? Or for 3D there is a whole different approach?

sqr() is square not sqrt - avoiding a confusion.

sentences:
Retrieving components from game objects (entities) Using C# and XNA 4, I've made the decision to go for an entity-component based design for my game after reading such posts as this and this, but I'm now struggling to find how to retrieve components once they've been added to an entity.

Some articles I've read say that when a component is created, register it with the system that will act upon it, using a messaging system. A drawback I see here is that if a system needs 2 components to act (say CollideComponent and PositionComponent) then this gets complicated (and I can't figure how it would work).

The other possibility, and the one that I'm currently pursuing, is to have a system ask whether an entity has a particular component when it needs it. However I've not seen any code examples, only theory on the net, so I've been trying to muddle it together. Some code here might explain how far I've got :

First a System:

public class RenderingSystem : IGameSystem
{
  public void PerformAction(IQueryable<IGameObject> gameObjects)
  {
    foreach (var gameObject in gameObjects)
    {
      RenderableGameComponent renderableGameComponent = gameObject.GetComponent<RenderableGameComponent>(ComponentType.Renderable);
      if (renderableGameComponent != null)
      {
        this.spriteBatch.Draw(renderableGameComponent.Texture, renderableGameComponent.DrawablePosition, Color.White);
      }
    }
  }
}

Now the actual GameObject:

public class GameObject : IGameObject
{
    private List<IGameComponent> gameComponents;
    private ComponentType componentTypes;

    public void AddComponent(IGameComponent component)
    {
        this.gameComponents.Add(component);
        this.componentTypes = this.componentTypes | component.ComponentType;
    }

    public T GetComponent<T>(ComponentType componentType)
    {
        return (T)this.gameComponents.FirstOrDefault(gc => gc.ComponentType == componentType);
    }
}

And finally the Component and ComponentType enumeration :

public class RenderableGameComponent : IGameComponent
{
    public Texture2D Texture { get; set; }

    public Vector2 DrawablePosition { get; set; }

    public ComponentType ComponentType
    {
        get { return ComponentType.Renderable; }
    }
}

[Flags]
public enum ComponentType
{
    Renderable = 1,
    Updateable = 2,
    Position = 4,
}

Now as you might be able to see, I'm trying to use bitwise operations on the ComponentType enumeration that every Component of each GameObject has. The reason being I thought this would be a much cleaner approach when trying to get the required Component out of the GameObject when asked by a System (also refer to link 1 above).

I'm trying to get away from passing in a type, and doing an iteration over all the Components of a GameObject. eg:

foreach (var component in this.GameComponents)
{
  if (component.GetType() == requestedType) { return component; }
}

This is because when there are a few hundred bullets on the screen and a CollidableSystem is created, it will massively slow the game down checking every type. I've had experience with this when creating a previous game, but admittedly, that was using an inheritance based design system.

It worries me that for each System that is created, it will have to iterate over every GameObject every tick asking the same question every time, "Do you have the component I am looking for ?" and still doing a lot of casting and null checks.

Now my question is this. I want to know whether there is a de facto design pattern for getting Components from GameObjects that don't require null checks or casting ? Someway a System will say "Give me this component, I know that you have it" and not bother wasting time asking those GameObjects that don't have the Component. Tell, don't ask.

sentences:
How can I animate shadow in surface shader? I wrote wind shader that works but as you can see it have shadow problem!
when I animating vertices shadow is fixed!

Shader "Smkgames/Wind Shader" {
        Properties{
            _MainTex("Albedo and alpha (RGBA)", 2D) = "white" {}
            _BumpTex("BumpTex",2D) = "bump"{}
            _WindMap ("WindMap", 2D) = "white" {} // Add noies map like fbm noises
            _Cutoff ("Cutoff", Range(0,1)) = 0.5
            _Speed("Speed",float) = 1
            _Direction("Direction",Vector) = (0,0.2,0,0)
        }

        SubShader{
            Cull Off

            Tags{ "Queue" = "Transparent" "IgnoreProjector" = "True" "RenderType" = "TransparentCutout" "DisableBatching"="True" }
            LOD 200

            CGPROGRAM
            #pragma surface surf Standard alphatest:_Cutoff vertex:vert

            #pragma target 3.0

            sampler2D _MainTex,_WindMap,_BumpTex;
            fixed4 _Direction;
            fixed _Speed, _WindAmount;
            half _Glossiness, _Metallic;
            fixed4 _Color;

            void vert(inout appdata_full v) {
            float4 tex = tex2Dlod(_WindMap, float4(v.texcoord.xy + (_Time.x * _Speed), 0, 0));
            v.vertex.xyz += tex.y *  _Direction.xyz * _Speed;
            }

            struct Input {
                float2 uv_MainTex;
                float2 uv_BumpTex;
            };

            void surf(Input IN, inout SurfaceOutputStandard o) {
                fixed4 c = tex2D(_MainTex, IN.uv_MainTex);
                o.Albedo = c.rgb;
                o.Alpha = c.a;
                o.Normal = UnpackNormal(tex2D(_BumpTex,IN.uv_BumpTex));
            }
            ENDCG
        }
                FallBack "VertexLit"
    }

I couldn't fix it! so I tried to add shadow to my object from scratch by using vertex and fragment shader shadow caster and worked correctly but I want know
Is there a way to fixing this problem in surface shader?

sentences:
Libgdx sprite rotation (image quality) This one is probably really simple but I didn't find a solution.

I'm trying to create a widget (speedometer) with libgdx.
For the arrows I'm using the setRotation() function.
But when the image is rotated, the quality drops.

The result looks like this:

How can I improve the quality of the arrows?

sentences:
How to build an iPad game without an Apple device? I am an experienced PC/mobile app developer trying to build an iPad app but I don't have access to a physical device. I have a PC and an Android phone (whatever good that is!)

The app is essentially a conversion of a Flash-based software. I'm going to use Adobe AIR to target the iPhone/iPad (Adobe has built support for this natively). I have build an Android app using this process and it has been seamless. Since I'm not going to use XCode (unless needed) and Adobe has an iPhone Simulator integration.

Is there any way I can build an iPad app without a physical iPad/iPhone device? Are there emulators on the PC/MacOSX side that I could use and would I be able to build a functioning app?

What I can do:

Install MacOSX on my Windows machine and turn it into a Hackintosh. Nothing wierd here, it would work like a normal mac and support XCode and everything.
Build the app in Adobe AIR or XCode
Test on a iPad/iPhone Emulator on my Hackintosh or PC

In the worst case I'll have to:

Spend like $400 or whatever and buy a physical iPad/iPhone.
Borrow an apple device from a friend.

sentences:
How would one get the pixel value of a texture under the cursor? I have a requirement to detect which pixel of a texture is under the cursor in the 3D world. I assume that Ray casting is involved however, after that I'm not sure how one would accomplish this.

Can anyone please point me to an example? Preferably one that does not require a PhD to understand... lol

sentences:
Best way to manage sprite sheets on Android using NME I'm creating a 2D game for mobile touchscreen devices, specifically Android and iOS. I would like to know what is the best way (regarding performance and best practices) to manage sprite sheets.

Should I create different sprite sheets (for ldpi, mdpi and hdpi) and then scale according depending on the screen resolution or there is a better solution?.

I know that maybe the solution that someone could provide me would be platform independant but I'm using the NME framework (http://www.nme.io/), perhaps you know a good solution using this framework.

sentences:
How to use moveTo Actor? How to use moveTo?

I do so:

actor.addAction(Actions.moveTo(500, 500, 10));

but he does not move

Thanks you

UPDATE

does not move

my code:

public class MyActions extends ApplicationAdapter {
    private Stage stage;
    private Actor actor;

    @Override
    public void create () {

        stage = new Stage();
        actor = new Actor(){
            {
                setSize(100, 100);
            }
            Sprite actorSprite = new Sprite(new Texture(Gdx.files.internal("badlogic.jpg")), 57, 10, (int)getWidth(), (int)getHeight());

            @Override
            public void draw(Batch batch, float parentAlpha) {
                actorSprite.draw(batch, parentAlpha);
            }
        };

        stage.addActor(actor);
        actor.addAction(Actions.moveTo(500, 500, 1));
    }

    @Override
    public void render () {
        Gdx.gl.glClearColor(1, 1, 0, 1);
        Gdx.gl.glClear(GL20.GL_COLOR_BUFFER_BIT);
        actor.act(Gdx.graphics.getDeltaTime());
        //stage.act();
        stage.draw();
    }
}

what's wrong?

sentences:
Unity 5 Google Cardboard VR SDK Frame Rate I am running the Google Cardboard's official demo which doesn't really have much things on the scene (https://developers.google.com/cardboard/unity/download) on my Personal Unity 5 on my Nexus 5.

The fps is around 40 and I am wondering if the fps is so low because of my Nexus 5's hardware specs or is there a way to optimize the fps in Unity or some configuration in Google Cardboard's SDK?

sentences:
How do I create 2D water with dynamic waves? New Super Mario Bros has really cool 2D water that I'd like to learn how to create.

Here's a video showing it. An illustrative part:

Things hitting the water create waves. There are also constant "background" waves. You can get a good look at the constant waves just after 00:50 in the video, when the camera isn't moving.

I assume the splash effects work as in the first part of this tutorial.

However, in NSMB the water also has constant waves on the surface, and the splashes look very different. Another difference is that in the tutorial, if you create a splash, it first creates a deep "hole" in the water at the origin of the splash. In new super mario bros this hole is absent or much smaller. I am referring to the splashes that the player creates when jumping in and out of the water.

How do I create a water surface with constant waves and splashes?

I am programming in XNA. I've tried this myself, but I couldn't really get the background sine waves to work well together with the dynamic waves.

I am not asking how the developers of New Super Mario Bros did this exactly—just interested in how to recreate an effect like it.

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:
Cast a circle around an object and detect other objects in range (with visual) I have my "player" object moving around an arena type area, with miscellaneous objects scattered about. What I want to do is move the player near any of these objects, and on keypress I want to display a circular radius with the player in the center that will detect nearby objects (eventually being filtered by tag).

I realize there are many ways to accomplish this, but being relatively new to Unity I am trying to find a way that is intuitive to me. Looking at the documentation, Physics2D.CircleCastAll seems like it would fit my needs, but I am unable to test at this time (at work).

Provided CircleCastAll is what I do use, is there a way in the scene to display the circle that is being cast so that the player can visually see the radius? I know it returns a RayCastHit2D, so I can get the objects from that, but the player should have something visual to let them know if they are slightly out of range or not.

Any suggesions/tips are welcome. Thanks in advance!

sentences:
How do I draw a dotted or dashed line? I'm trying to draw a dashed or dotted line by placing individual segments(dashes) along a path and then separating them. The only algorithm I could come up with for this gave me a dash length that was variable based on the angle of the line. Like this:

private function createDashedLine(fromX:Float, fromY:Float, toX:Float, toY:Float):Sprite
{
    var line = new Sprite();
    var currentX = fromX;
    var currentY = fromY;
    var addX = (toX - fromX) * 0.0075;
    var addY = (toY - fromY) * 0.0075;
    line.graphics.lineStyle(1, 0xFFFFFF);

    var count = 0;

    // while line is not complete
    while (!lineAtDestination(fromX, fromY, toX, toY, currentX, currentY))
    {
        /// move line draw cursor to beginning of next dash
        line.graphics.moveTo(currentX, currentY);

        // if dash is even
        if (count % 2 == 0)
        {
            // draw the dash
            line.graphics.lineTo(currentX + addX, currentY + addY);
        }

        // add next dash's length to current cursor position
        currentX += addX;
        currentY += addY;

        count++;
    }
    return line;
}

This just happens to be written in Haxe, but the solution should be language neutral. What I would like is for the dash length to be the same no matter what angle the line is. As is, it's just adding 75 thousandths of the line length to the x and y, so if the line is and a 45 degree angle you get pretty much a solid line. If the line is at something shallow like 85 degrees then you get a nice looking dashed line. So, the dash length is variable, and I don't want that. How would I make a function that I can pass a "dash length" into and get that length of dash, no matter what the angle is?

If you need to completely disregard my code, be my guest. I'm sure there's a better solution.

EDIT:
To clarify, I can't use vectors (unless they're easy to implement, I'm not even sure how vec2 works) also I'd like the dash length to be based on neither line rotation NOR line length. So, no scaling the line to get the dash length.

sentences:
How to make a 'One Hit and Dead' platformer feel fair I am currently making a run 'n gun platformer, in which the player dies instantly when they get hit. I'm curious how to make this feel fair. I'm aware of putting checkpoints frequently enough, allowing the player to retry almost instantly, and merciful hitboxes. But I'm curious to know how I should go about level design? Run 'n guns are much different from sanic-speed wall jump platformers like meat boy.

You see, games like Hollow Knight let you learn how to avoid taking hits early in the game by giving easy challenges. If you get hit by something unexpected in Hollow Knight, you can always focus and gain some health, and it wouldn't feel unfair. If that happened in my game, that would feel unfair.

Since I'm designing a Megaman-X like game with a boss at the end of each stage, how am I supposed to go about teaching the player how to dodge fast moving projectiles that you would only know how to dodge after seeing how they act?

And yes, there is going to be a first level before you can go play the other ones in whatever order you like.

sentences:
Is it possible to debug a Unity Android game directly on a device? I'm working on my game and every time I make changes to it I send the game to my mobile device to debug it.

I want to know how I can directly debug my game using an Android device instead of the MonoDevelop editor?

sentences:
Flip the whole Directx output horizontally (mirror the output) I would like to flip the whole fullscreen directX output horizontally so that the final output is presented mirror inverted.

Is there a way to create a IDirect3DDevice9 instance which produces mirrored output? Or even better: is there a way I can mirror the output just before the final call to the  Present(...) method of the IDirect3DDevice9?

Update/Clarification:
The underlying objective is to be able to use a projector which needs vertically flipped input.
The software I am currently using allows to register callbacks and hands over a handle to the IDirect3DDevice9 instance.
After my method is called and returns, the directx output is presented. This repeats after each frame.

I would like to flip the presented output horizontally.

I tried the following:

Use settings of the projector to flip the image (not supported)
Find a setting in the Operating System (windows7 doesn't support flipping of the image)
Find a setting in the graphics driver (AMD Catalyst) but only rotation is supported, not horizontal flipping

I have only little experience with directx so please bear with me (this is also why I would appreciate sample code or at least pointers to the right direction).

Update2:
I found out that I should be able to call SetTransform on the Direct3DDevice9 handle to change the D3DTS_PROJECTION with a proper Matrix. However this does not work in my example application.

sentences: Jump function of player I'm developing game in marmalade sdk in c++. I have player in the area.and I wanna make him jump when i pressed a button.When I use this player.moveUp(5px); it just go up 5px, but he has to fall down back. so that when i use these: player.moveUp(5px); and player.movedown(5px); it do nothing.Because the fps is 30 and it's performing so fast. how i can fix that?

sentences: Get the current time of animation using script Unity3d I want to know the current time of the played animation using script in Unity3d. I tried using currentState.normalizedTime but this time is not the time of the animation, like it's the time of the runtime I think. Any advice please?

sentences:
How to get neigbor pixel coordinates in Unity HLSL shader I am writing Mandelbrot set shader for Unity.
I wrote an Image Effect shader and it works.
Unfortunately, each point "shimmers" on translate scale. This is because, for each shader call I compute value for only one mathematical point, which is infinitesimal. On even small translation, the value can change drastically.
So, I would like to compute math value not for one point, but for several. But for this I need to know, which aother points belong to my pixel, and for this I need to know the distance to neighbor pixel. Unfortunately, my incoming values are float and I don't know, how to step to next pixel.
How to accomplish?

sentences:
Placing nodes in a graph in a random but readable way I'd like to create a simple map from vertices and lines - you know, like a usual graph. A tree, to be precise.

To select the location of the next point that comes from one, I use a simple circle-equation function:

function Point_on_Circle(circle_x, circle_y)

degree = math.random(rad_min, rad_max)

point = { x = 0, y = 0, t = math.rad(degree) }

point.x = circle_x + radius*math.cos(point.t)
point.y = circle_y + radius*math.sin(point.t)

return point

end

The result is something like this:

That's a complete mess! What to do to make it readable? As you can see, I checked, how many ways are going from each single points, but don't have much idea, what to do with them.

The problem is that it's impossible to see individual points because their lines cross each other. I want to avoid line crossing at all, like in a usual tree.

sentences:
Unity 5 - custom lighting model I have tried to use my own lighting model in surface shader in Unity. But there is a problem.

If I init my own lighting via

#pragma surface surf _SimpleSpecular

Lighting_SimpleSpecular method is executed. But, even if I return single color from it, my model has still applied texture (with the tint of my returned color). What I am doing wrong? I am using forward rendering.

If I switch to Standard and return single color, all is at it should be.

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:
Displaying a particular sprite from spritesheet using Phaser I am trying to make a card game using Phaser, the HTML5 JS framework.  Because I'm a terrible artist and can't design my own, I'm using a free spritesheet of playing card images I found online.  The problem is, I can't seem to figure out how to display individual cards using Phaser.

In the previous framework I used, I was able to create individual smaller sprites from the larger sprite sheet that I used.  But I can't figure out how to do that in Phaser, if it's possible at all.

So I looked into loading the image as a spritesheet, but it seems that spritesheets are used for animation only and you can't really display a particular 'frame' of the spritesheet (please correct me if I'm wrong).

I think what I need to do is load the image as a tilemap, however, the particular image that I'm using did not come with a json file specifying the layout (nor could I find one that did).  Being new to javascript I'm having trouble reading the Phaser source code to see how the json file should be formatted.

So in summary, what's the best way to display an individual card of a spritesheet of playing cards in Phaser given that I don't have a json file specifying the map data?

sentences:
How to handle simultaneous mouse and keyboard input with sdl? I'm making a game in SDL2 that so far is basically just a top down shooter, where the player aims at the mouse. When I run the game, you can move properly and shoot properly, and shoot and move the mouse at the same time properly, but you cannot shoot while moving. For example, if I'm using the gatling gun which is fully automatic (as long as I hold the mouse down it keeps on shooting), and I start shooting, then press the w key to move, it stops shooting right away, and doesn't start again until I click again. Here is my code:

void Main::handleInput2(void)
{
double xcomponent,ycomponent,xVel,yVel,angle;
SDL_GetMouseState(&mouseX,&mouseY);
xcomponent = mouseX - (player.getBarrelX() + xOffset);
ycomponent = mouseY - (player.getBarrelY() + yOffset);
angle = atan2(ycomponent,xcomponent);
xVel = cos(angle);
yVel = sin(angle);

if(screen->getEvent()->type == SDL_KEYDOWN)
{
    if(screen->getEvent()->key.keysym.sym == SDLK_a)
    {
        player.setVelX(-1 * player.getSpeed());
    }
    if(screen->getEvent()->key.keysym.sym == SDLK_d)
    {
        player.setVelX(player.getSpeed());
    }
    if(screen->getEvent()->key.keysym.sym == SDLK_w)
    {
        player.setVelY(-1 * player.getSpeed());
    }
    if(screen->getEvent()->key.keysym.sym == SDLK_s)
    {
        player.setVelY(player.getSpeed());
    }
}
if(screen->getEvent()->type == SDL_KEYUP){
    //if(screen->getEvent()->key.keysym.sym = SDLK_8) player.setVelocity(-2,-2); TEST PASSED
    if(screen->getEvent()->key.keysym.sym == SDLK_a)
    {
        player.setVelX(0);
    }
    if(screen->getEvent()->key.keysym.sym == SDLK_d)
    {
        player.setVelX(0);
    }
    if(screen->getEvent()->key.keysym.sym == SDLK_w)
    {
        player.setVelY(0);
    }
    if(screen->getEvent()->key.keysym.sym == SDLK_s)
    {
        player.setVelY(0);
    }
    if(screen->getEvent()->key.keysym.sym == SDLK_1) //Paintball Gun
    {
        player.setWeapon(0);
    }
    if(screen->getEvent()->key.keysym.sym == SDLK_0) //Glock
    {
        player.setWeapon(1);
    }
    if(screen->getEvent()->key.keysym.sym == SDLK_2) //Skorpion
    {
        player.setWeapon(2);
    }
    if(screen->getEvent()->key.keysym.sym == SDLK_3) //Ballistic Knife
    {
        player.setWeapon(5);
    }
    if(screen->getEvent()->key.keysym.sym == SDLK_4) //Spas 12
    {
        player.setWeapon(4);
    }
    if(screen->getEvent()->key.keysym.sym == SDLK_5)
    {
        player.setWeapon(3);
    }
}
if(screen->getEvent()->type == SDL_MOUSEBUTTONDOWN || screen->getEvent()->type == SDL_MOUSEMOTION&SDL_MOUSEBUTTONDOWN)
{
    if(screen->getEvent()->button.button == 1)
    {
        player.Shoot(1,xVel,yVel,screen);
    }
    if(screen->getEvent()->button.button == 3)
    {
        player.Shoot(3,xVel,yVel,screen);
    }
}
}

This was originally all in switch statements, but I thought it might work in if statements. I also tried handling SDL_KEYDOWN and SDL_MOUSEDOWN the same way as I did with SDL_MOUSEDOWN and SDL_MOUSEMOTION. I tried stuff like

if(screen->getEvent()->type == SDL_KEYDOWN|SDL_MOUSEDOWN)
{
    ...
}

if(screen->getEvent()->type == SDL_MOUSEDOWN|SDL_KEYDOWN)
{
    ...
}

if(screen->getEvent()->type == SDL_MOUSEDOWN&SDL_KEYDOWN)
{
    ...
}

if(screen->getEvent()->type == SDL_KEYDOWN&SDL_MOUSEDOWN)
{
    ...
}

But none of those helped, each one in fact made it worse.
Seeing as that SDL is meant for making games, I would imagine there must be a way around this.
Does anyone know how?

sentences:
Can I develop games for mobile platforms in C++? I have a good grasp in C++ and C and have also experience developing AAA game using C++.
Now, I'm shamelessly thinking to dive into mobile game development either in iOS or Android. Unfortunately, I don't know objective-C and java and neither have courage to learn it.
So, As above mentioned reason, Is there any possibility to do mobile development in C++ without using any single statement of JAVA and Objective-C ?

sentences:
how to use glm::rotate with a eulerangle? I have a vec3 to represent my object's orientation/rotation but the glm::rotate method expects a quaternion. If I just convert it to a quaternion like this:

glm::quat rot = rotation;

The W value will just be zero, right? And then there won't be any changes in rotation.

In my code I just want to be able to do rotation.x += 5.0f; in the update method of an object.

This is the method I'm using for my transformations:

glm::mat4 GameObject::Transform(glm::mat4 model, glm::vec3 position, glm::vec3 scale, glm::quat angleAxis)
{
    model = glm::translate(model, position);
    if (angleAxis.w > 360.0f)
    {
         angleAxis.w -= 360.0f;
    }
    else if (angleAxis.w < 0.0f)
    {
         angleAxis.w += 360.0f;
    }
    model = glm::rotate(model, angleAxis.w * toRadians, glm::vec3(angleAxis.x, angleAxis.y, angleAxis.z));
    model = glm::scale(model, scale);
    return model;
}

Currently I'm just passing on that rotation vec3 to that angleAxis quaternion parameter but that obviously doesn't work.

This is how i currently calculate my front, up, and right vectors:

void GameObject::calculateCameraView()
{
    front.x = cos(glm::radians(rotation.x)) * cos(glm::radians(rotation.y));
    front.y = sin(glm::radians(rotation.y));
    front.z = sin(glm::radians(rotation.x)) * cos(glm::radians(rotation.y));
    front = glm::normalize(front);

    right = glm::normalize(glm::cross(front, worldUp));
    up = glm::normalize(glm::cross(right, front));

    front.y = invertMouse ? front.y * -1 : front.y;
}

sentences:
Why won't my block Spaces/Holders hold my blocks when I drag onto them in Unity? In my game I am trying to have numbered blocks and math operators be able to be dragged down into their respectively color coded holders (white holders = Numbers, black holders = operations). The spawn in color coded blocks called spawners. If you drop a block you were dragging in a space that isn't a holder, then the block would immediately snap back to its respective spawner.

However, I am now encountering this issue where 99% of the time when I drop the block onto its respective holder, the block snaps back to its spawner instead of staying there.
Here's the minimum reproducible code for dragging the blocks:
using System.Collections;
using System.Collections.Generic;
using UnityEngine;
using UnityEngine.EventSystems;

[RequireComponent(typeof(Collider2D))]
public class DragDrop : MonoBehaviour, IDragHandler, IBeginDragHandler, IEndDragHandler
{
    [SerializeField] private SpriteRenderer _spriteRenderer;
    public SpriteRenderer _SpriteRenderer => this._spriteRenderer;
    [HideInInspector]public static bool isInSpace;
    [HideInInspector]public Vector3 initialPos;

    private void Start()
    {
        initialPos = transform.position;
        isInSpace = true;
    }

    public void OnDrag(PointerEventData eventData)
    {

        if (isInSpace == false)
        {
            Vector3 movement = new Vector3(
            x: (eventData.delta.x/3) * Time.deltaTime,
            y: (eventData.delta.y/3) * Time.deltaTime);

            this.transform.localPosition += movement;
        }
    }

    public void OnBeginDrag(PointerEventData eventData)
    {
        isInSpace = false;
    }

    public void OnEndDrag(PointerEventData eventData)
    {
        if (isInSpace == false)
        {
            transform.position = initialPos;
        }
    }

#if UNITY_EDITOR
    private void Reset()
    {
        this._spriteRenderer = this.GetComponent<SpriteRenderer>();
    }
#endif
}

And Here's the code for receiving the blocks:
using System.Collections;
using System.Collections.Generic;
using UnityEngine;
using UnityEngine.EventSystems;

public class RecieveBlock : MonoBehaviour, IDropHandler
{
    public void OnDrop(PointerEventData Block)
    {
        if (Block.pointerDrag != null && Block.pointerDrag.tag == gameObject.tag)
        {
            Block.pointerDrag.GetComponent<RectTransform>().anchoredPosition = GetComponent<RectTransform>().anchoredPosition;
            DragDrop.isInSpace = true;
        }
    }

}

I have no idea why it doesn't set off the isInSpace bool to be true and stay there.
Heirarchy Image For Number Blocks:

Heirarchy Image For Operation Blocks:

Heirarchy Image For Holder Blocks:

Thank you for reading.

sentences:
Unity 2d: How stop movement when object hit a wall I created a square that slides on a flat ground.

public class PlayerMoveScript : MonoBehaviour
{

float move = 0;

    void Start (){}

    void FixedUpdate ()
    {
        if (move == 0) {
            move = Input.GetAxis ("Horizontal");
            if (move != 0) {
                move = 15*Mathf.Sign(move);
                rigidbody2D.velocity += new Vector2 (move, rigidbody2D.velocity.y);
            }
        } else
            {
            rigidbody2D.velocity = new Vector2 (move, rigidbody2D.velocity.y);
            }

    }
}

On both sides of the ground lies a wall, when the square hits a wall and stops his movement, the square instead continues to push in his direction.
What I trying to do, is that when the square hits the wall, the square stop the movement and stop to push on the wall, in a way that the player can choose a new direction until the square will hit a new wall.

So imagine a big picture frame, a little square lies on the center.

The player hit the down key
The square starts to move down, with a constant velocity
The square hits the bottom side of the frame, and it stops
The player choose a new direction.
The square starts to move in the new direction
Back to 2

N.B: The walls are rigid bodies 2d with a box collider 2d.

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:
Is it possible to gain performance by omitting vertex normals in the GPU pipe? I am working on a rendering problem where I want to render as many raw triangles to the screen as I can with either OpenGL or DirectX with the absolute fastest performance possible.

I wondered about omitting vertex normals completely and only transforming vertex positions during the vertex shader stage.

1)  Is this possible?

2)  Is it actually going to increase performance --or-- is the "bare metal" of the GPU designed in such a way that trying to omit normals won't gain any more throughput?

p.s.  Yes, I realize that omitting normals will leave you with the problem of how to shade the triangle during the shader stage, but I could at least render a solid color to the screen (no shading).  At this point, all I'm wondering about is how much data I can eliminate from the typical pipeline to increase the pipeline throughput to the absolute maximum.

sentences:
Increase animation speed according to the swipe speed in unity for Android I have the animation done through Maya and brought the FBX file to unity. Here is my code to calculate the speed of the swipe:

Vector2 speedMeasuredInScreenWidthsPerSecond =(Input.touches[0].deltaPosition / Screen.width) *     Input.touches[0].deltaTime;

Now I wanted to take speedMeasuredInScreenWidthsPerSecond and use it to increase the animation speed accordingly like this:

animation["gmeChaAnimMiddle"].speed=Mathf.Round(speedMeasuredInScreenWidthsPerSecond);

However, this results in an error that I need to convert Vector2 to float.

So how do I overcome it?

sentences:
How can I compute a velocity proportional to the difference between two hand positions? I'm working on a project with the Kinect SDK and XNA 4. I need take the position of the hands and draw a sprite over it. I'm was doing it directly and because of that I get a "trembling hands" effect. So, I was thinking of making the sprite move from the previous position to the new one given in every frame by the new hand position.

This way, the sprite does not jump from one position to another. This is working just fine, but I'm using a constant value for the velocity, and I really would like to use a variable velocity given by the difference between the previous and the new position. That is: if the hand move more quickly in the reality, the velocity will be higher.

I really don't have a clue on how to make this work. Can somebody point me in the right direction?

sentences:
Finite State Machine Horizontal Jump I'm creating a 2D Sidescrolling Action RPG with MonoGame and I am using a finite state machine. A state consists of an animation and some behavior, only one state can be executed at once, however:

If the player is moving left/right and then jumps, or if he's jumping and then moves left/right I want to play a specific horizontal jumping animation while executing the behavior of both states at once. How is this usually handled? Should I make a completely seperate state for this and copy the behaviors over? That doesn't seem right in accordance to the DRY principle.

BTW I'm going to have a lot of similar merge states, so just making an exception this time won't do.

sentences:
Java - Adjusting the speed of an object during movement I am trying to get an object to move (on java canvas) in the same angle but at different speed within the X and Y axis. Below you can see how i have implemented the movement of the object.

xPosition += xSpeed;
yPosition += ySpeed;

I want the object to be moving at the same angle. But speed change randomly throughout movement across the canvas.

How can I go about dealing with this?

I've tried changing the speed, such as;

  xSpeed -= 10;
  ySpeed += 10;

Any help would be greatly appreciated.

sentences:
Optimizing Octree Rendering Say I have an octree and at a certain level I store VBOs in that octree. I know the dimensions of of the nodes that own the vbo so I can do basic frustum culling.  That works nicely because everything outside of the screen is never rendered.

However my world is quite big and I currently also draw things behind already drawn octrees.  What would I use to not draw nodes that are occluded by other nodes and how would I go about that?

I saw some mentions of occlusion culling in the OpenGL superbible but I fail to see how I can utilize that when I don't have a clear distinction between occluders and occludees.

sentences:
How can I load .FBX files? I am looking into options for the model assets for my game. I have gotten pretty good with Blender, and want to use C++/DirectX9 (don't need all the excess from 10+), but Blender 2.6 exports .fbx not .x (by nature) and supposedly what is exported from Blender to .x is not entirely stable.

In short how do I import .fbx models (I can work around not having animations if I must) into DirectX9? Is there a middleware, or conversion tool that will maintain stability?

sentences:
Better solution for boolean mixing? Sorry if this question has been asked in the past, but searching Google and here didn't yield relevant results, so here goes.

I'm working on a fragment shader that implements both conditional/boolean diffuse and bump mapping (that is to say, you don't need a diffuse texture or a normals texture, and if they're not present, they're simply changed to default values).

My current solution is to use a uniform float to say "mix amount". For example, computing the diffuse texel works as:

// Compute diffuse amount scaled by vCol
// If no texture is present (mDif = 0.0), then DiffuseTexel = vCol
// kT[0] is the diffuse texture
// vTex is the texture co-ordinates
// mDif is the uniform float containing the mix amount (either 0.0 or 1.0)
vec4 DiffuseTexel = vCol*mix(vec4(1.0), texture2D(kT[0], vTex), mDif);

While that works great and all, I was wondering if there's a better way of doing this, as I will never have any use for in-between values for funky effects.
I know that perhaps the best solution is to simply write separate shaders for mDif=0.0 and mDif=1.0, but I'd like a more elegant solution than splicing shaders before compiling or writing multiple shader files and keeping each one updated.

Any ideas are greatly appreciated. =)

sentences:
MonoGame does not generate xnb from png I am coming straight from XNA and I installed the latest version of MonoGame today (2015-12-22) for Visual Studio 2015 Community. I created a project from the windows Project template.

I right click the content folder and add a png-file. I compile without error but it stops during runtime because it can't find the content file. My solution look like this

Game1.cs look like this:

using Microsoft.Xna.Framework;
using Microsoft.Xna.Framework.Graphics;
using Microsoft.Xna.Framework.Input;

namespace homer
{
    public class Game1 : Game
    {
        GraphicsDeviceManager graphics;
        SpriteBatch spriteBatch;
        private Texture2D simpson;

        public Game1()
        {
            graphics = new GraphicsDeviceManager(this);
            Content.RootDirectory = "Content";
        }

        protected override void Initialize()
        {
            base.Initialize();
        }

        protected override void LoadContent()
        {
            spriteBatch = new SpriteBatch(GraphicsDevice);
            simpson = Content.Load<Texture2D>(@"Images/Homer");
        }

        protected override void UnloadContent(){ }

        protected override void Update(GameTime gameTime)
        {
            if (Keyboard.GetState().IsKeyDown(Keys.Escape))
                Exit();
            base.Update(gameTime);
        }

        protected override void Draw(GameTime gameTime)
        {
            GraphicsDevice.Clear(Color.CornflowerBlue);
            spriteBatch.Begin(SpriteSortMode.FrontToBack, BlendState.AlphaBlend);
            spriteBatch.Draw(simpson, new Vector2(200, 100), Color.White);
            spriteBatch.End();
            base.Draw(gameTime);
        }
    }
}

The problem I encounter is that MonoGame do not make xnb-files from the png and put it in my output folder. I tried to copy the file manually from a compiled XNA project to my MonoGame debug folder and it worked. I have done nothing but create a project from the template and trying to load an image. What do I need to do to make MonoGame compile xnb-files for me. It also runs if I change "Do not copy" to "Copy always" but that is not optimal for runtime as I understand it. Also, I don't want it to be too easy for the users to doodle in the graphics.

Content.mgcb look like this

#----------------------------- Global Properties ----------------------------#

/outputDir:bin/Windows
/intermediateDir:obj/Windows
/platform:Windows
/config:
/profile:Reach
/compress:False

#-------------------------------- References --------------------------------#

#---------------------------------- Content ---------------------------------#

sentences:
Unity third person controller and hills So I've been building a game and using the out of the box unity third person controller demo stuff.

I found that even the tiniest of slopes seems to stop the "dude" dead in his tracks.

Is there an easy way to adjust the sensitivity on the scripts somewhere?

I tried messing with the sensitivity options in the input options setup thinking that it might help but it didn't and I don't really want to go messing about in the scripts unless I really have to because i end up complicating my life when I do that.

sentences:
What language to use to create a browser-MMO? I have a game ready to be implemented (Class Diagrams and other UML stuff are good).

Here are some characteristics:

MMO.
Browser game and download-game.
Multiplatform.
With 2D graphics.
Real time.
Point-and-click.
With an online database (duh!).

What language should I use?

sentences:
Normals showing unexpected results I am making a game in c++ with opengl and glm and was working on my terrain when this happend :

as it appears it is renderering just the way i planned it, but my question was, how do i make it appear so that the their are not as many shadows? i have no idea of how i can fix this.

Here is the normal code:

        glm::vec3 calculateNormal(int x, int z) {
            float heightL = getHeight(x - 1, z);
            float heightR = getHeight(x + 1, z);
            float heightD = getHeight(x, z - 1);
            float heightU = getHeight(x, z + 1);
            glm::vec3 normal(heightL - heightR, 2.0f, heightD - heightU);
            glm::vec3 result = glm::normalize(normal);
            return result;
        }

and here is the terrain normal generation code

for (int i = 0; i < vertex_count; i++) {
                for (int j = 0; j < vertex_count; j++) {

                    float height = getHeight(j, i);

                    vert[vertexPointer * 3] = (float)j / ((float)vertex_count - 1) * size;
                    vert[vertexPointer * 3 + 1] = height;
                    vert[vertexPointer * 3 + 2] = (float)i / ((float)vertex_count - 1) * size;

                    glm::vec3 normal = calculateNormal(j, i);

                    norm[vertexPointer * 3] = normal.x;
                    norm[vertexPointer * 3 + 1] = normal.y;
                    norm[vertexPointer * 3 + 2] = normal.z;
                    ...

here is the terrain generation code

float getNoise(int x, int z) {
            int seed = x + z + (std::rand() % (0 - 15));
            return seed * 2.0f - 1.0f;
        }

        float generateheight(int x, int z) {
            return getIntoplatedNoise(x/16.0f, z/ 16.0f);
        }

        float getSmoothNoise(int x, int z) {
            float corners = (getNoise(x - 1, z - 1) + getNoise(x + 1, z - 1) + getNoise(x - 1, z + 1) + getNoise(x + 1, z + 1)) / 16.0f;
            float sides = (getNoise(x - 1, z) + getNoise(x + 1, z) + getNoise(x, z - 1) + getNoise(x, z + 1)) / 8.0f;
            float center = getNoise(x, z) / 4.0f;
            return corners + sides + center;

        }

        float getIntoplatedNoise(float x, float z) {
            int intX = (int)x;
            int intZ = (int)z;
            float fracX = x - intX;
            float fracZ = z - intZ;

            float v1 = getSmoothNoise(intX, intZ);
            float v2 = getSmoothNoise(intX + 1, intZ);
            float v3 = getSmoothNoise(intX, intZ + 1);
            float v4 = getSmoothNoise(intX + 1, intZ + 1);

            float i1 = interplate(v1, v2, fracX);
            float i2 = interplate(v3, v4, fracX);
            return interplate(i1, i2, fracZ);
        }

        float interplate(float a, float b, float blend) {
            double theta = blend * M_PI;
            float f = ((float) 1.0f - cos(theta)) * 0.5f;
            return a * (1.0f - f) + b * f;
        }

        float getHeight(int x, int z) {
            return generateheight(x, z);
        }

Thank you very much for you time

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:
Storing server information for an MMORPG I wanted to get some professional feedback(I hope) on which is the fastest way to store/retrieve/update/delete information for an MMORPG with the server coded in C++.  For characters, monsters, items, objects, etc. What do games like World of Warcraft, and Lord of The Rings, and Star Wars use?  Do they use linked-lists (stl, or a custom one)?  Do they use vectors, arrays.  Should I store them with vectors to make life easier?  Should I come up with my own clever ways to quickly and efficiently retrieve/change/update massive amount of data?

I was reading on the web and it seems like linked-lists are the way to go.  What are your thoughts?  If one were to use either of the mentioned ways to store data, should it be broken down to even smaller sub-categories?  For example, if I were to use linked-lists.  Would I make linked-lists for items like weapon_on_ground, weapon_owned, armor_on_ground, armor_owned, belt_on_ground, belt_owned, etc. And do that for each type of linked-list and try and make each linked-list as small as possible?  As I could see a potential problem having lets say 100k items in the world, and having to sift through them each time a player drops one, or causes it to be changed/updated/deleted.

I am in the middle of porting a project I was working on to a IOCP server.  Before I was just storing all data into linked-lists called: player_info, items, monsters, objects, etc.  But I fear that it might not be a smart idea, and maybe there are better ways of storing information on a server that I know of.

I hope I can get some great replies.

EDIT:  The "project"(as in, it may or may not get finished) is going to be a 2D dungeon crawler MMO, with a lot of monsters, items, and NPCS.  Lets say itll be a old school classic 2d rpg but MMO style.

sentences:
Do google game services require the users to have a g+ account to enter lobby? I've been reading Google Game Services (GGS) API about multiplayer lobby/rooms and the documentation doesn't make it very clear if the users are required to sign in with a Google+ account (which I don't want).

The web GGS SDK mentions this:

  The simplest way to add a sign-in button to your page is to implement
  the HTML-based sign-in button. For implementation details, see Adding
  the HTML sign-in button to your page on the Google+ Sign-In
  documentation.

What I am looking for is a simple way (service or library) to connect anonymous users together (matchmaking).
My application being in Java, a Java compatible API is also needed.

Can Google Game Services fit the bill or should I keep looking?

sentences:
Combining 2D and 3D in game engine I've implemented basic 3D functionality and made little "2.5D" demo in orthographic projection using OpenGL ES 2 and Box2D.

Now I want to make completely two-dimensional game (using sprites) and consider 2 variants:

Implement 2D graphics separately from 3D in separate layer, leave 3D stuff in background, draw 2D using various simplified algorithms (disable depth testing, simplified culling etc.)
Leave everything as is and use billboards for sprites

Currently I use hierarchical system of entities with matrix transformations. I know about computational complexity of 3D and 2D graphics and believe first method should result in faster code, though it's my first engine and my google-fu fails me this time, so I'm not sure about it.

Engine is Desktop/Mobile.

What method would you recommend? Does implementing first method worth it (in performance aspect)?

sentences:
Shadows in html5 canvas game I'd like to ask for reference. I met an article about how to cast shadows in games. I'm using html5 canvas (currently without webgl) with javascript for my projects.

The article mentioned above is located at http://willyg302.wordpress.com/2012/11/04/2d-visibility/.

I was thinking if this method is possible to employ with canvas (without webgl) and javascript?

More precisely, I have few shapes drawn on canvas some of them are complex made by arc and similar methods. Thus I don't have a simpel way how to describe one shape with an equation where I can store only a few parametrs (i.e. circle is described as centerX, centerY, radius with these I can easily draw it but with more complex shapes I don't have such information) therefore I thought about storing the whole canvas data by pixels with context.getImageData.data, then using method described in the article (polar transformation, ..., back to cartesian system) and putting the whole scene into canvas with canvas.putImageData method.

But before actually applying this I'd like to ask if it's even possible with canvas (no webgl) and javascript to create shadows dynamically (light source moving across the screen) this way without heavy fps loss (I can imagine this method works pretty good for still objects but the moment when I need to do it each time a light source moves I'm not sure if javascript + canvas can handle this in reasonable time, especially when I found information that putImageData and getImageData are quite slow)?

Or if anyone has tried to create dynamic shadows in different way in html5+js I'd appreciate your suggestions about these as well (I do it currently in similar way as is described in http://ncase.me/sight-and-light/, though I'm experiencing some troubles with concave shapes :( ).

This is getting awfully long, I hope I explained myself well enough.

Thank you very much for any advice you can share and I'm sorry that my post grew so large, although I'm asking just one question.

EDIT: Forgot to mention, I'm looking only for 2d solution.

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 Can I Find a Shape on 2D Array? For the code in my test project,  I want to find 2D[,] array shape on the char[][] list. I created an actual map with 'char[][]' array.
So, how can I find a tileChar's shape on the worldChar array?

How to do this in Java, C#, JavaScript, pseudo-code, algorithm or etc.?

For Example;

List<string> mainShape = GetRandomShape().Split('#').ToList();
char[][] tileChar = mainShape .Select(a => a.ToArray()).ToArray();
char[][] worldChar = GenerateRandomWorld();

Example Image:

'*' -> NOT NULL

'-' -> NULL

sentences:
Can't create "hero walking" animation I'm creating a Fez-based HTML5 Canvas game and animating my hero image using sprite sheets. The problem is that I can't create the animation of the hero walking, don't matter how much I try, the output is a weird animation that looks like the hero is just shaking its legs. Can someone help me? You don't need to create the sprite sheet for me if you don't want, just show me what's the correct leg position. I'll post the game link in a comment because I can't post more than two links.

Note that the "hero's legs" are compound by 3 pixels each, that are 2x up scaled.

Here is the sprite sheet:

the walking animation is compound by the 6 first frames.

EDIT: If you fall in the demonstration, open the console, type localStorage.x = localStorage.y = 0; and then reload the page immediately to return to the starting point.

sentences:
Using components in the XNA Game State Management example? In the game state management example at the App Hub, they say that if you want to use components in the example you can extend the GameScreen to host other components inside itself.

I'm having a very hard time trying to tie this up.
I tried extending the GameScreen class by adding a public property of public List<DrawableGameCompnent> components { get; set; } and then add my components to that list when I initialize the current screen as well as looping over the components in the LoadContent, Update and Draw methods. However, this doesn't feel like the correct way to go - mainly because it doesn't work when I get to the implementation of my GameplayScreen.

Any thoughts?

sentences:
Make Render Texture distorted/blurry? I have created a function that clicks images in real time and these images are copied to render texture that is created. I am looking for a way to blur/distort/half-fade-out the render textures. Is there a way to achieve this?

 Graphics.Blit(Texture2D, renderTexture);

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:
Getting rid of dead objects in a game effectively? I'm using a for loop or foreach loop (doesn't matter) to loop through all my objects when they need to be updated or drawn. However, when an object gets killed, I want it to get removed from the collection again.

I do this by adding the object to a dead-objects list, and then, when everything has been drawn and updated, I go through everything in this list, removing the objects in the list from the original source as well.

Is there a better way of doing this?

sentences:
How to make two connected rigidbodies pull each other? I'm making a game in Unity where a ship can connect to a rock in space, and drag it. Both are Rigidbody2D. I want the ship to be affected by the rock like this:

If I drag the rock, then stop the ship, the rock keeps moving with the velocity it had.
If the rock gets pulled away by something, it should drag the ship when the rope is fully extended.
If the rock is heavy, the ship has more trouble pulling it
The rope might be a little elastic to make it more appealing

Is there a joint like this, or should I manually code it so they can affect each other? It seems like a basic game physics thing, but I can't find anything about it.
I tried using a distance joint with "Max Distance only" for this, but it doesn't work, as the rock stops when the ship stops:

For the visual part, I'm using verlet integration, with a slight gravity on the rope to make it more "springy", the current is a little too much but that's finetuning and not the problem of this question. :)

sentences:
Box2d contant speed before and after collision I want to make my body fly at constant speed, how to make it fly at constant speed before and after collision? I set restitution of my body to 1.0 but after some direct and powerful collisions my objects begins to slow, I want it to fly same speed as before. I heard this can be done by setting liner damping of the object, I think it can prevent only from fast flying objects not slow.
 Thanks in advance.

Edit* I can simply modify velocity of the object every frame, is it a solution?

var velocity:b2Vec2=b.GetLinearVelocity();
var speed:Number=velocity.Length();
var ratio:Number=circleSpeed/speed;
velocity.Multiply(ratio);
b.SetLinearVelocity(velocity);

sentences:
Character movement in Unity For an endless runner game such as Subway Surfer, in order to move your character so smoothly in both z-axis and x-axis, which component of the followings is better:

CharacterController or RigidBody?

Can we use both of them together; if so, will it have any effect on the performance of our game?

sentences:
Save Generated GameObject as Prefab I've written a script which will automatically generate a Mesh, assign a MeshFilter, MeshRenderer, BoxCollider, and RigidBody.

This script is meant as a tool to rapidly create a certain class of objects (in this case, dice). I don't want them to actually generate at runtime.

Is there a way to convert the GameObject to a Prefab with all of its different generated properties so that I can simply drop them into my game?

Just trying to drag it into the Assets causes it to lose its Mesh. Also to note, I have it so I can generate the Mesh via the Inspector in a ContextMenu, which works well.

sentences:
How to get surface position from 3D objects in 2D space I am working on simple drag and drop game with JavaScript and PixiJS. The game itself is 2D, but I have some pseudo-3D objects (I guess isometric) and I am trying to get the position of those objects.

My question is if there is any mathematical equation or algorithm to solve my problem:

I have some fruit objects, and the user should put those objects in the basket I have below, but only in the yellow surface like below in the picture. Currently, I am using the code below to check if the object is inside the basket or not, but this checks the entire texture and not the yellow surface!

isInside()
{
    if (this.object.x > basket.x1 && this.object.x <= basket.x2 &&
        this.object.y > basket.y1 && this.object.y <= basket.y2)
    {
        return true;
    }
    else
    {
        return false;
    }
}

Which algorithm can I use to check only the yellow surface?

sentences:
How do I properly link an OrthographicCamera to a OrthogonalTiledMapRenderer how to properly link an OrthographicCamera to a OrthogonalTiledMapRenderer

How do I properly link an OrthographicCamera to a OrthogonalTiledMapRenderer? I have tiled map i'd like render and two stages that have actors on them.. I call render.render() in my screens render method as well as stages.draw(); but every i put render.setView(camera) the screen displayed flashes or does other weird things. How do I properly attach a moveable camera to a tiled map renderer? I render the map first, do game logic and then call draw on the stages. when I call translate on the camera the tiled map zooms way out for some reason?

here is my render method

public void render(float delta) {

    Gdx.gl.glClearColor(1, 0, 0, 1);
        Gdx.gl.glBlendFunc(GL20.GL_SRC_ALPHA, GL20.GL_ONE_MINUS_SRC_ALPHA);
        Gdx.gl.glClear(GL20.GL_COLOR_BUFFER_BIT);
        camera.update();
        renderer.render();

        gameLogic();

        backStage.act(); // acts are called but do nothing

        frontStage.act();

        frontStage.draw();
        backStage.draw();

}

here is where  the camera and renderer get created

public void addMap(GameMap map){

this.map=map;
maps.add(map);
    renderer=new OrthogonalTiledMapRenderer(map.getTiledMap(), 1/20f);
    camera= new OrthographicCamera(Gdx.graphics.getWidth(), Gdx.graphics.getHeight());
    float aspect = Gdx.graphics.getWidth()/Gdx.graphics.getHeight();
    camera.setToOrtho(false, 20*aspect, 20*aspect);

    renderer.setView(camera);
    frontStage= new Stage();
    backStage=new Stage();

    xSize=map.getXSize();
    ySize=map.getYSize();
    Gdx.input.setInputProcessor(this);

}

sentences:
Where can I post job listings or browse through resumes? [Hypothetically] I'm at a smaller company and looking for a place to get the word out about our available openings.  Alternately, I'm looking for a place to browse through resumes of people looking for jobs.  What are some services I can use to find the people I need?

Answer Format

One URL per answer
Costs (if applicable)
Specializations (if any)
Experiences using the service

sentences:
Should all primitives be GL_TRIANGLES in order to create large, unified batches? Optimizing modern OpenGL relies on aggressive batching, which is done by calls like glMultiDrawElementsIndirect. Although glMultiDrawElementsIndirect can render a large number of different meshes, it makes the assumption that all these meshes are made of the same primitives (eg. GL_TRIANGLES, GL_TRIANGLE_STRIP, GL_POINTS).

In order to most efficiently batch rendering, is it wise to force everything to be GL_TRIANGLES (while ignoring possible optimizations with GL_TRIANGLE_STRIP or GL_TRIANGLE_FAN) in order to make it possible to group more meshes together?

This though comes from reading the Approaching Zero Driver Overhead slides, which suggests to draw everything (or, presumably, as much as possible) in a single glMultiDrawElementsIndirect call.

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:
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:
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:
Can I legally sell an XNA game made with Visual C# Express Edition? I've dowloaded Visual C# Express Edition and when it starts up it says "for evaluation purposes only." What does this mean?

Does this mean I have to buy the full version to legally sell my game I make with it? Or can I just use the free express edition? I really dont want to make a game and then find out I can't sell it.

sentences:
Steering and wall hugging problem What I'm hoping to achieve is that when the player steers into a wall the movement is smoothed out by hugging along the wall, moving only with the velocity parallel to the wall, zeroing out the normal force) rather than bouncing back from the wall using the "generic" avoidance method.

I want this: Not this:

The two images are actual behaviors from my code. One removes the velocity normal to the wall so it glides smoothly hugging the wall. The other steers away from the wall creating the bouncing effect. The latter case actually works quite reliably but I do not like the bouncing behavior.

Here's my design for the for handling this case:

The vertical wall is actually made up of many square tiles
The wall avoidance steering checks one unit ahead to see if it is in contact with a tile
The normal is determined by which edge on the tile I'm closest to
zero out the velocity of the player normal to the wall

However this is not reliable for several reasons:

in the gif above, if the look ahead ends up on the bottom edge of a tile, it gets the wrong normal (goes horizontal instead)
the player can get stuck if it happens to penetrate the wall to much (i.e. stay on track for 1 frame, then next frame gets the wrong/perpendicular normal, then both velocities are canceled out)
player can penetrate the wall quite easily if they pick the right spot (which I don't have an obvious sense why)

I am wondering if anyone has a better suggestion on how to handle this case? The only requirement that I prefer to keep is the tile based wall as I have a map editor that generates the map data. Also if there is a method that can be extended to sloped walls that would be even better!

Thanks!

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:
Rotate Character towards Moving direction So my Problem is that my Character is always shooting in the way it is looking. Unfortunaly my solution seems to be a very bad one.  I am not really cabable of aiming with my solution. Neither with Controller or Touchscreen Control.
I already commented many Things out as you can see but nothing works correctly for me.
It is a 2D Top-Down Game.

using UnityEngine;
using System.Collections;

public class PlayerController : MonoBehaviour {
    public int dead = 0;
    //Moving
    public float maxSpeed = 3f;
    public float rotSpeed = 100f;
    public Transform target;
    float zo;
    float opZ;
    //Shooting
    public Vector3 bulletOffset = new Vector3(0, 0.5f, 0);
    public GameObject bulletPrefab;
    int bulletLayer;
    public float fireDelay = 0.25f;
    float cooldownTimer = 0;
    GameObject pau;

    void Start () {
        bulletLayer = gameObject.layer;
        pau = GameObject.FindGameObjectWithTag("MainCamera");

    }

    // Update is called once per frame
    void Update () {
        //Debug.Log("GameP ->" + pau.GetComponent<PauseGame>().isPause);
        if(!pau.GetComponent<PauseGameGameover>().isPause){
        if(dead == 0)
        {
            //Moving
            movePlayer();
            //Shooting
                cooldownTimer -= Time.deltaTime;
            if( CFInput.GetButton("Fire1") && cooldownTimer <= 0 ) {
                shotPlayer();
            }
        }
        }
    }
    void shotPlayer()
    {
            // SHOOT!
            cooldownTimer = fireDelay;

            Vector3 offset = transform.rotation * bulletOffset;

            GameObject bulletGO = (GameObject)Instantiate(bulletPrefab, transform.position + offset, transform.rotation);
            bulletGO.layer = bulletLayer;
    }

    void movePlayer()
    {
        float x = CFInput.GetAxis("Horizontal");
        float y = CFInput.GetAxis("Vertical");
        ////////////////
        /// Rotate the PLAYER
        /// /////////////////////////////
        zo= x*90;
        //Debug.Log("ZO -> " + zo);
        if(y > 0 && x > 0){opZ = 360-zo;} //Oben bis Rechts
        if(y < 0 && x > 0){opZ = 180+zo;} // Rechts bis unten
        if(y < 0 && x < 0){opZ = 180+zo;} //Unten bis Links
        if(y > 0 && x < 0){opZ = -1*zo;} // Links bis oben
        /* Hardcoded Left Right Up Down */
        /*if(y == 0 && x > 0){opZ = 270;}
        if(y == 0 && x < 0){opZ = 90;}
        if(y < 0 && x == 0){opZ = 180;}
        if(y > 0 && x == 0){opZ = 360;}
        if(y == 0.5 && x == 0.5){opZ = 315;}
        if(y == -0.5 && x == 0.5){opZ = 225;}
        if(y == -0.5 && x == -0.5){opZ = 135;}
        if(y == 0.5 && x == -0.5){opZ = 45;}
        //Debug.Log("OPZ: ->" + opZ);
        */
        // Grab our rotation quaternion
        Quaternion rot = transform.rotation;
        // Grab the Z euler angle
        //float z = rot.eulerAngles.z;
        // Recreate the quaternion
        Quaternion rotNew = Quaternion.Euler( 0, 0, opZ );

        transform.rotation = Quaternion.Lerp(rot, rotNew, Time.time * rotSpeed);

        ///////////////////
        // MOVE the PLAYER
        ////////////////////////
        ///

        Vector3 pos = transform.position;

        Vector3 velocity = new Vector3(CFInput.GetAxis("Horizontal") * maxSpeed * Time.deltaTime, CFInput.GetAxis("Vertical") * maxSpeed * Time.deltaTime, 0);

        pos += velocity;

        // Finally, update our position!!
        transform.position = pos;
    }
}

sentences:
how to make a fast fragment shader that converts intensity to saturation? I have a simple fragment shader that looks like this:

#ifdef GL_ES
precision lowp float;
#endif

varying vec4 v_fragmentColor;
varying vec2 v_texCoord;
uniform vec4 u_desiredColor;
uniform sampler2D u_texture;

void main()
{
    gl_FragColor = texture2D(u_texture, v_texCoord) * u_desiredColor;
}

My goal is to take a grayscale image and apply a color to it, but maintain luminance.   There was a stackoverflow post from years ago where the poster was after exactly what I want:

https://stackoverflow.com/questions/4361023/opengl-es-1-1-how-to-change-texture-color-without-losing-luminance

The answers however are outdated (OpenGL ES 1.0) and also I am a little confused by them.  The accepted answer says to use multi-texturing, and the 2nd answer says that is "nonsense".  Regardless, the code example there is incompatible with the version of OpenGL ES 2.0 that my game is using with cocos2d v2.x.

Here are my original grayscale sprites:

With my simple shader applied and setting u_desiredColor to vec4(1.0, 0.0, 0.0, 1.0), you can see it does exactly what I don't want it to do-- it completely tints the entire image, turning everything red, including the white.

What I really want is for the darker shades of gray have the richest color, but as the sampled grayscale pixel approaches white, the colorized pixels lose saturation, where ultimately a sampled pixel of white has 0% saturation-- but a sampled pixel of dark gray would be 100% saturation.

My desired output is:

My thought was that the simplest approach would be to have my shader make the output pixel color's saturation be something like (1.0 - samplePixelIntensity). So, if the sample pixel's intensity was 1.0, that would mean 0% saturation in the output, if the sample pixel's intensity was 0.5, it would have 50% saturation.. if the sample pixel's intensity was 0.2, then it would have 80% saturation.

However, I am not very familiar with writing shaders, so I am wondering how I might construct something like this?

sentences:
On/off buttons in Phaser I am trying to make an on/off button for audio in Phaser, and when you click on the button once it shows the off button, but when I click on it again, the on button does not show.  Right now I did not implement the audio feature, I am just working on the button itself first.  Here is the code:
 soundOnOff() {
 gameState.on = this.add.image(this.config.width - 20 , 0 + 30, 'on')
 .setScale(2);
 gameState.off = this.add.image(this.config.width - 20 , 0 + 30, 'off')
 .setScale(2)

 gameState.on.setInteractive();
 gameState.off.setInteractive();
 gameState.off.visible = false;

 gameState.on.on('pointerdown', () => {
 gameState.on.visible = false;
 gameState.off.visible = true;
 });

gameState.off.on('pointerdown', () => {
gameState.on.visible = true;
gameState.off.visible = false;
});

}

Please tell me how I can fix this! Also, how do I make my bird, in gameState.bird, not jump when I click the button.  Thank You!

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:
How do I determine if I'm allowed to use an asset from the web in my game? I need to incorporate other people's work into my game project. I must admit (with a little embarassment) that I am almost completely ignorant about copyright. I only have a vague idea of what it is, what it protects, or what it means when I see Ⓡ or © or ™. Since English is not my native language, reading all those Wikipedia pages full of legal jargon only gave me an headache.

I'm looking for images (sprites, backgrounds, UI elements mostly) and sound. I intend to publish the game (Google Play and Flash/HTML5 game websites, maybe the iPhone App Store). I don't plan to "sell" it directly, but I do intend to insert ads and/or in-app purchases.

I will most likely need to edit the content before including it in my game. Probably just scaling/rotating, but the greater degree of freedom I have, the better.

So, what should I look for, to be sure I have the rights to use the media I find the way I need to (like "royalty free" or "copyright free")? In which cases do I have to ask for "permission" to use that media, and how? Like, send the owner of the site an e-mail?

sentences:
Is there a good alternative to a world state data structure? How do you avoid one big data structure containing all the current world state ?

Let's pretend we're in a real-time strategy game, how would you code a skill that decrease mana of units around it ?

With a world state it would look like that :

class MySpell : ISkillWithoutTarget
{
  void Cast(Unit caster, World world)
  {
    foreach (Unit target in world.Units)
    {
      if (target.distanceWith(caster) <= N)
      {
        target.Mana -= X;
      }
    }
  }
}

So my question is : Does a good alternative to "world object" exist ? Or world object is the best way to deal with these kind of interactions ?

I'm not looking for a way to organize/optimize my big data structure, but how to avoid it.
I would prefer not using this architecture because almost every piece of code can touch every game object. I'm looking for decoupling to avoid ending with bug almost untraceable.

sentences:
JWJGL Multi-threading to separate update and render Introduction:

I am currently designing a game in Java using the LWJGL 3.0, with Gradle. I have quite an advanced knowledge on multi-threading, and I am aware how GLFW does/doesn't implement multi-threading from this guide. Currently, I have one class Updater with a loop for updating, and another class Renderer for rendering, each extending Runnable with their own loops and time calculations. Below is a diagram showing the structure of the classes and update and render methods. I have also set up a lock system, using the Java Lock class (again below).

My Problem:

Despite setting each thread as the current context before each loop executes its window call, and setting the current context to null at the end, I still get the error Exception in thread "RENDERER" java.lang.IllegalStateException: GLFW error [0x10008]: WGL: Failed to make context current: The requested resource is in use. Any idea as to why? Been at this for a few hours now.

Loop class:

private void threadLoop() {
    try {
        lock.lock();
        locked = true;
        loop();
        TPS++;
    } catch (InterruptedException e) {
        e.printStackTrace();
    } finally {
        lock.unlock();
        locked = false;
    }
}

@Override
public void run() {
    init();
    long lastTime = System.nanoTime();
    double ns = SECOND / (MAX_TPS/2);
    double delta = 0;
    long timer = System.currentTimeMillis();
    while (running) {
        long now = System.nanoTime();
        delta += (now - lastTime) / ns;
        lastTime = now;
        while(delta >= 1) {
            threadLoop();
            TPS++;
            delta--;
        }
        if(System.currentTimeMillis() - timer > 1000) {
            finalTPS = TPS;
            timer += 1000;
            TPS = 0;
        }
    }
    stop();
}

Thread Manager:

public void update() {
    if (window == null) return;
    window.setThread();
    window.update();
    window.nullThread();
}

public void render() {
    if (window == null) return;
    window.setThread();
    window.render();
    window.nullThread();
}

Renderer:

@Override
protected void loop() {
    if (state != null) state.render();
    threadManager.intermediateCode();
    threadManager.render();
}

Updater:

@Override
protected void loop() {
    if (state != null) state.update();
    threadManager.intermediateCode();
    threadManager.update();
}

Window:

public void setThread() {
    glfwMakeContextCurrent(getID());
}

public void nullThread() {
    glfwMakeContextCurrent(NULL);
}

public void render() {
    glClear(GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT);
    glClearColor(0.0f, 0.3f, 0.8f, 0.0f);
    glfwSwapBuffers(ID);
    System.out.println("Rendered window");
}

public void update() {
    glfwPollEvents();
    System.out.println("Updated window");
}

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:
Path solving for a game with a similiar pathing mechanic to Anno I cant quite wrap my head around how to solve pathing in my game. The basic premise is you will place buildings and roads on a 2d field and then you will be able to create routes from one building to another where the pathing alghorithm should figure out the shortest path between them (if there is one).
Something to keep in mind is that the game is going to be quazi infinite scale (think factorio) and i cant think of a performant enough solution.
Currently what i am working with is that i have every straight Path segment saved as two (startPoint, endPoint) Vector2Int points in a list. And everytime a new road gets added or some road segment deleted i update this list depending on what happened, example situation:
I have this road
-----|
     |
     |
     |-----
This would be represented in my Roads list as:
0 = startPoint(0, 0) -> endPoint(5, 0)
1 = startPoint(5, 0) -> endPoint(5, 3)
2 = startPoint(5, 3) -> endPoint(10, 3)

I now add another road so we have something like this
-----|
     |
 ----|
     |-----
Which would change the road list to something like:
0 = startPoint(0, 0) -> endPoint(5, 0)
1 = startPoint(5, 0) -> endPoint(5, 2)
2 = startPoint(5, 2) -> endPoint(5, 3)
3 = startPoint(1, 2) -> endPoint(5, 2)
4 = startPoint(5, 3) -> endPoint(10, 3)

What i am doing currently when a new route is to be calculated is that i create a 2d bool array which i am feeding into a A* solver to get the shortest path so the above road gets transformed into:
1 1 1 1 1 1 0 0 0 0 0
0 0 0 0 0 1 0 0 0 0 0
0 1 1 1 1 1 0 0 0 0 0
0 0 0 0 0 1 1 1 1 1 1

With some starting and endpoint.
This works fine for now but when the player will build on a huge size 10kx10k, i cant imagine generating 10kx10k bool array everytime will be a good solution.
Anybody knows how to optimize this?

sentences:
Get relative angle to collision Unity I want to get the angle between the rotation (euler Angles) of the camera (V1 : Vector3) and the collision point of my character, when it hits a wall, to determin, if it was left, right, or in front of it.I tried to use Vector2.Angle with V1 and V2 (ControllerColliderHit.moveDirection as a Vector2) to get the difference between them.

However I get a different value (0, 90, 180) when running into the wall depending on the world direction. (left wall, right wall, etc.)

How can I get the angle of the collision point relative to the direction the camera is facing?

sentences:
Which gesture recognizer should I use to handle multiple simultaneous flicks? So, if you can picture a game with little ninjas running down at you, and a bunch of shurikens at the bottom of the screen, you're picturing the set-up I'm addressing.

I want the player to be able to flick the shurikens up at the ninjas, but I want them to be able to do it with both thumbs at the same time. Gesture recognizers seem to be the way to do this, but I'm not sure which is the most appropriate. The main ones that seem to fit are the pan gesture and the swipe gesture.

Does anyone have insight into the pluses and minuses of each, or even if a better one exists?

sentences:
How to make a dynamic frontline system for my game? My problem:
Basically the units, units meaning soldiers or vehicles, influence the frontline by moving into the opponents territory (See example image).
I'm trying to understand where to even start with this. I honestly have no idea what kind algorithm would be used to create this kind of system.
Example Image:

More info about the example:
https://www.eugensystems.com/steel-division-normandy-44-gameplay-dynamic-front-line/
This system is not node or tile based, but is fully dynamic (almost looks like a fluid simulation lol). I figured out I would render the line by using spline interpolation with points, but I don't understand the math behind the system itself (the part that controls how the line moves and creates points).
It's really cool and I would love to know where I would even start. Any free references would be highly appreciated.
Thank you!

sentences:
How to duplicate Blender glow and reflection effects in Unity? I am trying to make my game more interesting by making a background with this NEON tunnel made of glowing lines.

Since I am not a good 3D artist, I choose to hire some freelancers, and they made a model that looks great in Blender. I have all that I need...but when I import my object into Unity, it does not have any effects, any colors, any glow or any "mirror" reflection.

The biggest problem is that I cannot find any other freelancer who actually knows how to fix this problem.

This is how it shows up in Blender when my freelancers made it, and it looks perfect:

I want to have the same effects, same look, same colors, same glow in my Unity project, but I don't know how to actually import this object and reproduce that same look.

This is all zip folder which contain pictures, object in blender file, same object in .fbx,.obj.mtl and in many more formats.. but seems like any of those models doesn't work in Unity because I bet Unity needs more modifications...

I hope someone will help me step by step to achieve my goal.

sentences:
Unity 5 light reflection on the water surface How to adjust reflection in Unity 5 to show up it on the water surface. So I have few light elements in the scene. So I want my water pro to reflect this lights.

As example you can see red and yellow lights from the Shanghai's build on the water, that's what I am trying to achieve:

I've added water pro and setup flare:

Looks liker here some small reflection on the rect I market as red. But if comparing with real reflection it's more vertical reflection I've marked it as red well:

If you can see it unity example does not look natural. So if we compare distance from sun to the beach border on real photo, there is a huge sun line over the water surface, but there is not the same line on water pro in unity.

Here is a video link with what I did:
http://screencast.com/t/bq8Ocl24ZAJH

sentences:
How to load images on startup I want to load all my game's images on the game's startup and have a loading bar to show it's progress. I already know how to create and display the loading bar, but I can't figure out how to load the images, and then add the image's frames to it's array.

Not using SLick

sentences:
Unreal: Y-Axis boundary on a Camera Bounding Box I was wondering if I could get some help with modifying a Blueprint I'm currently using for a project in Unreal Engine.

I am currently attempting to make a side-scrolling platformer game and I'm using a camera bounding box Blueprint to restrict where the camera can move when tracking the player's movement, based on the following series of tutorials on YouTube by JvtheWanderer: How to make a Metroidvania/ 2D Camera Blueprint System on #UE.

The camera bounding box works as intended, in that it prevents the camera from moving beyond the limitations of the camera box placed within the scene, but I want to go even further than that and establish a limitation within the camera bounding box that not only limits the camera's movement but also prevents the player from moving on the Y-axis beyond the box's boundaries.

Pretty much every platformer from Super Mario to Sonic the Hedgehog to Castlevania, have such boundary limitations, usually at the very start of the level and also frequently at the end.  The limitation on the Y-axis boundary is also frequently used to lock the player into a particular area for forced enemy encounters, mini-boss fights as well as proper boss battles, a limitation that lasts until the player has vanquished the threat.

I wish to implement similar boundaries on the camera bounding boxes within my project to restrict where the player can go without having to place walls everywhere to keep the player from wandering beyond the level's limits.  Using walls to restrict the player's movement is fine for indoor areas, but it ends up looking distractedly out of place in outdoor areas if used in excess.

I've included screenshots below of the Construction Script & Event Graph from the SideScrollerCamera Blueprint I'm using. I would also include the Viewport and the Level Blueprint as well, except that the time being, I am unable post more than two links.

Construction Script:

Event Script:

Any help with this matter would be greatly appreciated.

sentences:
Create sprite sheet (texture atlas) from video with alpha What's the best way to make a sprite sheet (texture atlas) from a video?

In my case, I have videos of animated character expressions (e.g., smiling, frowning, sad, excited), which I intend to use as frames on quads in my app. I have video sized for retina 2x of a small character, so it's approx 150px square for a 75px character, with alpha/transparency. My animator can output any common format. I'll have 50-100 frames. I do not need a power-of-two size output, any rectangle is ok. I'm working on MacOS.

Is the best workflow still: video -> folder with PNGs -> TexturePacker

Or is there any smarter way to do this? I'll be having a lot of iterations, so I'd like to make it as easy and fast as possible.

There are two older questions from 2010 and 2012 about making sprite sheets.

sentences:
Colour Problems When Using SDL_Resize() In a 3D SDL application I inherited (I have little 3D or SDL experience), I have a 'screenshot' routine that either saves a full-size image or a scaled image, depending on the context (differing key-press).  To save a full-size (i.e. graphics-mode-sized) screenshot I'm using:

SDL_SaveBMP(SDL_GetVideoSurface(), SDL_RWFromFile(filename.c_str(), "wb"), 1);

This works exactly as-intended, and saves an 8-bit bitmap (the display mode is always 8-bit, for another reason entirely) as expected.

However, in order to resize the image, I'm making use of a library that came heavily recommended in several places when searching for a suitable surface-/image-resizing library for SDL: SDL_Resize.

I'm implementing this as such:

SDL_Surface *toResize = SDL_GetVideoSurface();
SDL_Surface *resized = SDL_Resize(toResize, (int)w, (int)h);

SDL_SaveBMP(resized, SDL_RWFromFile(filename.c_str(), "wb"), 1);
SDL_FreeSurface(resized);

This works mostly as intended.  It saves a resized, 8-bit bitmap, seemingly with the correct palette.  However, the colours in parts of the image are incorrect, e.g.

Now, I don't need the output images to be 8-bit, I'd be perfectly happy with a 24-bit or 32-bit bitmap, if I could solve this problem; but I can't find out the answer to either of these questions:

How do I convert an SDL surface to a different bit-depth?
How do I ensure that the output image displays the colours correctly after resize?

I'm anticipating that I may have to settle for a higher-bit-depth bitmap, and that's fine... but a few pointers in the right direction would be fantastic.

Many thanks!

sentences:
Is this a good way to handle different game screens? While developing my game I am often asking myself if my way of handling different game screens (MainMenu, Game, Ending, Highscore) is a good one.
I am currently using only one activity. The game loop is running in this class.
The currently active screen gets a update and paint method called from this loop like this:

while (running) {
    if (!holder.getSurface().isValid())
        continue;

    float deltaTime = (System.nanoTime() - startTime) / 1000000000.0f;
    startTime = System.nanoTime();

    if (deltaTime > 0.315) {
        deltaTime = (float) 0.315;
    }

    game.getCurrentScreen().update(deltaTime);
    game.getCurrentScreen().paint(deltaTime);

    Canvas canvas = holder.lockCanvas();
    canvas.getClipBounds(dstRect);
    canvas.drawBitmap(framebuffer, null, dstRect, null);
    holder.unlockCanvasAndPost(canvas);
}

One problem I am often facing is that the screen classes aren't activities, so I am unable to start a DialogFragment, as an example, because it needs a FragmentActivity. Since these classes are just instantiated the FragmentActivity never gets started.

If I need a dialog, I am currently just making an Activity to a custom dialog.

How would you handle a game framework? Are there any good examples out there?

sentences:
Destructible Enviroments I've got my own game engine, now rendering and animating, MD2 MD3 and MD5 models now. I feel i am only just starting to get comfortable with opengl.

I'm currently writing code to render Quake 3 maps now too but, i would love to know how games like red faction allowed for destructible environments. Not quite sure, where to start with this. If i render a map do i have to turn the map into constitute components where by a physics engine controls every brick in the map or something maybe someone could tell me where i should look or read would be great. Thanks.

sentences:
Bullet Physics Step Simulation Crash when maxSubSteps is not 0 I am using Bullet physics along with Irrlicht. My program consistently crashes when maxSubSteps is not set to zero when calling stepSimulation. I believe it has something to do with the time between the stepSimulation calls because when I stopped Irrlicht from drawing the scene, Bullet worked perfectly fine. Here is my stepSimulation call:

dynamics_world->stepSimulation(frame_delta_time, 0);

The segfault crashing does not occur when the maxSubSteps is zero. I would like to find a better solution to this as I have read that disabling substepping is experimental. Does anyone know how to fix this?

The parameters I am using when calling bullet's stepSimulation() are:

const irr::u32 then = device->getTimer()->getTime();
...
const irr::u32 now = device->getTimer()->getTime();
const irr::f32 frame_delta_time = (irr::f32)(now-then)/1000.f;

The value of frame_delta_time when the program crashes is 0.009.
fixedTimeStep is the default 1/60.

Values other than 0 I have set maxSubSteps to are 1 (the default), 10 and 100.

The gdb stack trace indicates the program is crashing at releasePredivtiveContacts():

Program received signal SIGSEGV, Segmentation fault.

#0  0x000055555557463b in btDiscreteDynamicsWorld::releasePredictiveContacts() ()
#1  0x00005555555746fc in btDiscreteDynamicsWorld::createPredictiveContacts(double) ()
#2  0x0000555555573c8f in btDiscreteDynamicsWorld::internalSingleStepSimulation(double) ()
#3  0x0000555555575335 in btDiscreteDynamicsWorld::stepSimulation(double, int, double) ()

Edit:
The full code is on Github: https://github.com/morgenm/PMC-Game/tree/master/src

sentences:
FPS Crosshair, Should it be drawn on center of the screen or to the forward of bullet spawn point? so my question is where to draw crosshair? I have some things in my mind like:

1): Draw it on the center of camera(which will stays on the center of screen always), but as my gun is little lower to the camera so my bullets will always hit little lower to the target, but at the same time every FPS draws crosshair on the center(correct me if I am wrong).

2): Draw it to the forward of bullet spawn point so bullets will always be on target. But this also has some issues, player can't just be standing freezed it will move a little so did the gun and in turn crosshair will also move, but I haven't seen any FPS with crosshair moving while player is standing to shoot or even walking plus this will also make the game tough or annoying.

3): Draw the crosshair little lower to the camera(camera.y - difference between camera.y and spawnPoint.y) so the crosshair and bullet spawn point are aligned, but won't it look little weird to have a crosshair little lower to the center of screen.

I had read Shooting the bullet out of the gun instead of the camera, yet keeping it accurate with respect to the reticle

What I get from this is that raycast from camera and fire the bullet in direction where the raycast hits, but the bullet will not be going out from the forward of spawn point and this will look bad. The guy explains something with the animation but I didn't get that point. In GTA V's FPS mode crosshair is being drawn in the center, hands and gun are little low from center so there is no way that gun will hit exactly at the center of crosshair but it does hit and we can see that bullet(not actually bullet, some kind of ray) is getting fired from muzzle of the gun, how do they do it? I am sure there is some kind of trick for that.

I don't know what to do or there are other ways of doing this, any help would be much much appreciated.

My question is similar to the given link but it don't have much information so I am not trying to be duplicate here I am just looking for some more information

Thanks for reading this

sentences:
Can't access properties of a class Sorry for the bad title, but I couldn't think of a way to word my problem for a title.

So I have this script, with two classes:

using UnityEngine;
using System.Collections;

public class GameItem {

    public string ItemName { get; set; }

    public string ItemDesc { get; set; }

    public Item_Type ItemType { get; set; }

    public int ItemValue { get; set; }

    public int ItemID { get; set; }

    public GameItem() {

    }

    public GameItem(string name, string desc, Item_Type type, int value, int id) {
        this.ItemName = name;
        this.ItemDesc = desc;
        this.ItemType = type;
        this.ItemValue = value;
        this.ItemID = id;
    }
}

public class Weapon : GameItem {

    public string WeapEnch { get; set; }

    public float WeapEffic { get; set; }

    public Weapon() {

    }

    public Weapon(string name, string desc, string ench, float effic, int id) {
        this.ItemType = Item_Type.WEAPON;
        this.ItemName = name;
        this.ItemDesc = desc;
        this.WeapEnch = ench;
        this.WeapEffic = effic;
        this.ItemID = id;
    }

    public void Attack() {

    }
}

public enum Item_Type {
    APPAREL,
    WEAPON,
    TOOL,
    CONSUMABLE,
    BOOK,
    MISC
}

And then I have a script for adding items to a list using the constructors:

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

public class InventoryManager : MonoBehaviour {

    public List<GameItem> GameItems { get; set; }

    void Start () {
        GameItems.Add(new Weapon("Sword", "It's just a sword.", null, 5, 0));
    }

    void Update () {
        if(Input.GetButtonDown("Interact")) {
            Debug.Log(GameItems[0].ItemName);
        }
    }
}

So when I create a new Weapon in the list, I can access everything from the GameItem class, but nothing from the Weapon class, even though I used the Weapon constructor. So I can't use the Attack () function, or access the Weapon's variables. How can I get around this problem?

sentences:
Radiosity using a hemisphere I'm working on a radiosity processor. I'm projecting scene geometry onto a hemisphere at a high order of tessellation during a visibility pass onto a 1024x1024 render target. The problem is that the edges of certain triangles are not being rendered to the item buffer( render target )...so when I test certain edges( or pixels during pixel shader ) for visibility during a reconstruction pass, visible edges are not identified and as a result the pixel for that edge is discarded.

One solution was to increase the resolution of the item buffer( up to 4096x4096 )...this helped and more edges were visible, however, this was not fullproof.

How do I increase visibility?

Here is a screenshot of a scene after radiosity is applied: the seams are edges along a triangle face that were not visible due to the resolution of the item buffer...

fixed the problem by sampling the item buffer w/8 points:

code to convert world space position into normalized device coordinates for uv lookup of item buffer:

// position lookup for item buffer
    Output.Pos3 = mul( Input.Position, mWV );
// projection is handled by normalizing the viewspace position( as i'm rendering to a hemisphere )
    Output.Pos3.xyz = normalize( Output.Pos3.xyz );

// convert to normalized device coordinates( [ -1, 1 ], [ -1, 1 ] -> [ 0, 1 ], [ 0, 1 ] )
    Output.Pos3.xy *= float2( 0.5, -0.5 );
    Output.Pos3.xy += float2( 0.5, 0.5 );

sentences: Sounds to describe the weather? I'm trying to think of sounds that will help convey the time of day and weather condition. I'm not even sure of all the weather conditions I would consider, and some are obvious. Like if it's raining, the sound of rain. But then I'm thinking, what about for a calm day? If it's morning time, I could do birds chirping or something. Night time could be an owl or something. What are some good combinations of sounds/weather/time to have a good effect?

sentences:
How do I perform an Iris Wipe transition, using C++ in SDL 2.0? How do I perform image masking/clipping using an arbitrary shape like a circle?

I want to do an Iris Wipe transition, similar to in the movies. By Iris transition, I mean the circle transition effect where it starts with a small circle, and zoomed in to reveal the scene.

How do I accomplish it in SDL 2.0 with C++?

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:
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:
Getting AABB Collision to work - C++ I've been trying for weeks to get AABB collision set up on my DX11 project.

So far, I have a 'condition' set up in place, so that when both cubes collide the 'light' cube will show within the scene. At this moment, the cubes pass through each other, which causes the light to show, but I can't figure out how to actually stop them from passing through each other. When cube1 hits cube2, they'll simply collide and won't be able to pass through each other.

This manages the user input

//Manage the users input via keyboard
class Vector3 {
public:
    float x;
    float y;
    float z;
};

class UserInput
{
public:
    float xPos;
    float yPos;
    float zPos;
    Vector3 vecMin;
    Vector3 vecMax;
    float rotationX;
    float rotationY;
    float rotationZ;
    bool isMoving;
    bool isMovingRight;
    bool isMovingLeft;
    bool isMovingUp;
    bool isMovingDown;
    bool isMovingCloser;
    bool isMovingFurther;
    bool isRotatingX;
    bool isRotatingY;
    bool isRotatingZ;
    UserInput()
    {
        rotationX = 0.0f;
        rotationY = 0.0f;
        rotationZ = 0.0f;
        isMovingRight = false;
        isMovingLeft = false;
        isMovingUp = false;
        isMovingDown = false;
        isMovingCloser = false;
        isMovingFurther = false;
        isRotatingX = false;
        isRotatingY = false;
        isRotatingZ = false;
    }

    void UpdatePos()
    {
        //-1 and +1 from the origin of the cube (centre)
        vecMin.x = xPos - 1.0f;
        vecMax.x = xPos + 1.0f;
        vecMin.y = yPos - 1.0f;
        vecMax.y = yPos + 1.0f;
        vecMin.z = zPos - 1.0f;
        vecMax.z = zPos + 1.0f;
    }
};

AABB Collision Function

bool AABBtoAABB(const UserInput& box1, const UserInput& box2)
{
    return!(box1.vecMin.x > box2.vecMax.x ||
        box1.vecMax.x < box2.vecMin.x ||
        box1.vecMax.y < box2.vecMin.y ||
        box1.vecMin.y > box2.vecMax.y ||
        box1.vecMin.z > box2.vecMax.z ||
        box1.vecMax.z < box2.vecMin.z);
}

Update Function

//Update each Frame
void Update()
{
    AABBtoAABB(input[0], input[1]);
    input[0].UpdatePos();
    input[1].UpdatePos();
}

sentences:
How can i Randomize Unique Numbers in Java So i'm making a game where i have to randomize 52 numbers from 1 to 52 so the order has to change i use this

    class Deck
{
    Random r = new Random();
    int[] Card = new int[52];
}

sentences:
Permeable objects in Box2d In Box2d, can I make a static object to be permeable by dynamic objects? Can I simulate something like water in a way that it lets rigid bodies to dive into it but at the same time pushes them off over time?

Here's an illustration I've made:

Three circles in steady state rest inside my "game world" with some gravity.
I push the top circle down, two circles on bottom start sinking into walls since wall objects are permeable.
Walls slowly push circles back into the world once the top circle stopped affecting them.

sentences:
Transformations and basis vectors I've been reading this very nice tutorial on OpenGL, and I encountered a statement which I can't wrap my head around. In Chapter 6, it states:

  Transformation from one space to another ultimately means this: taking the basis vectors and origin point from the original coordinate system and re-expressing them relative to the destination coordinate system. The transformation matrix from one space to another contains the basis vectors and origin of the original coordinate system, but the values of those basis vectors and origin are relative to the destination coordinate system.

This is reaffirmed in Chapter 7:

  ... And this makes sense; a transformation matrix contains the basis vector and origin of the source space, as expressed in the destination coordinate system.

... But isn't it the other way around?

Take a look at this example from the tutorial:

The transformation Matrix to transform from the space on the left to the space on the right is

[1   0   0   1  ]
[0   1   0  -1.5]
[0   0   1   0  ]
[0   0   0   1  ]

The last column of the transformation matrix is the origin of the destination space, expressed relative to the source space.

What am I missing?

Note The above transformation matrix is not from the notes, so feel free to correct it.

sentences:
How to resolve collision of two or more linearly moving non-rotating axis-aligned 2d boxes? Sorry for my bad english.

In my game, to resolve collision of a moving-box (e.g. the player) and fixed-boxes (e.g. tiles) :-

I check in advance whether a moving-box is going to collide with a fixed-box. If yes, then start moving the moving-box in 1 unit displacement in the direction of original displacement but only after checking in advance whether the next movement will result in a horizontal or vertical collision with any fixed-box. If in the next move it is going to collide with a fixed-box horizontally, then the x side of the moving-box is resolved and no more displacement in horizontal direction. Same for the y side.

But my problem is - how to resolve the collision of two (or more) moving axis-aligned non-rotating boxes?

What other people do is update position (resolving collision in the process) of the moving-boxes individually (one box at a time). That is wrong because in a certain time all of the moving-boxes are supposed to move simultaneously. So, this would result in wrong collision resolution. People won't notice it but collision would be resolved in wrong direction.

Other people separate the boxes using a minimum translation vector which they calculate using Separating Axis Theorem. This would also result in wrong resolution since the axis might not be the  one that the boxes were supposed to be in contact with before intersecting with each other.

How can I resolve collision of two moving axis-aligned non-rotating 2d boxes correctly ?

sentences:
unity3d - Object keeps falling down I have an object that moves towards another object using this line :

transform.position = Vector3.MoveTowards(transform.position, target.transform.position, speed * Time.deltaTime);

this is it's attributes:

It doesn't use gravity, kinematic and it's Y position is frozen, but it keeps falling to the floor and colliding with it. How do prevent that and keep it floating ?

sentences:
Why is my model exported from Blender vanishing when using it in UE4 mobile? My 3D models and animation vanishes when I preview it using the mobile view port. However they work just fine for the desktop viewport.

I usually model the characters using MakeHuman and import them into Blender. In Blender I animate them and then I import the model/animation into UE4. The problem is that my model/animation works when I preview it using the shader meant for desktop & consoles. When I preview my animation using the openGLES2 shader, my model vanishes. Anything I import form belnder vanishes when I view it in a mobile viewport. I cant figure out why this is so? Have any of you experienced this before ? Can you guys let me know how I can correct this issue?

Also, if I upload the models from MakeHuman into UE directly, I can upload the files properly in UE. But, when I try the workflow MakeHuman -> Blender -> UE with not much modifications to the models in Blender, the models are not visible in the openGLES2 shader. I am not sure why this is happening in Blender and why the models coming out if it is affected.

Any help would be appreciated.

sentences:
How to make the character move along the axis using touch? I have the following code it works, but I don't know how it works.
This is the code I found:
void Update()
{
#if UNITY_ANDROID

    if(Input.touchCount>0 && Input.GetTouch(0).phase == TouchPhase.Moved )
    {
        Vector2 touchDeltaPosition = Input.GetTouch(0).deltaPosition;
        float offset = touchDeltaPosition.x * 40f / 18 * Mathf.Deg2Rad;
        transform.position += new Vector3(0f, 0f, offset);
        transform.position = new Vector3(0f, 0f, Mathf.Clamp(transform.position.z, -7.1f, 7.1f));
    }
#endif
}

I need to move the player along the axis by touch, for example, like in the game Cube Surfer!
What I want to get (I used android emulator):

The code I wrote works well at 720x1280, but if you set the resolution to 1440x2960, the controls become too sharp. I know why this is happening because touch.delta is getting too big.
My code:
if (Input.touchCount > 0)
{
    var t = Input.GetTouch(0);

    var delta = t.deltaPosition;

    if (delta != Vector2.zero)
    {
        var offset = transform.position;

        offset.x += delta.x * Sensitivity * Time.deltaTime;

        offset.x = Mathf.Clamp(offset.x, -4f, 4f);

        transform.position = offset;
    }
}

How to fix it?
ScreenToWorldPoint this does not fit because the player moves along a spline.
Thank for help

sentences: building timers in strategy games I've got a web-based strategy game in which you build a city. Coding is smooth, but I'm kind of hung up on how long it takes my buildings to build. I want to keep the user playing, but have them long enough to keep them having to come back to the game. I've currently got it where each building has a base build rate that is exponentially increased by the building's level. I can adjust the times by changing the base build rate, but I was wondering if there is a better, or perhaps more widely-accepted way of doing this. I worry that a 113 day build on a level 10 building before reaching the next city level where the user has to start over will discourage further playing.

sentences:
Using SVN with Libgdx I decided to give LibGDX a try and am planning to use SVN for my code repository. I created my LibGDX project via the Gradle build as outlined in the book "Learning LibGDX Game Development". I'm not quite sure how to add the project to my repository. I have tried to upload the root folder (Project below) into svn, which does contain all the sub-project, but when I check out my workspace only contains the Project folder.

Below is the structure of the project in Eclipse after the gradle build.

Project
Project-android
Project-core
Project-desktop
Project-html
Project-ios

After checking out from svn

Project

Has anyone used SVN with LibGDX, if yes can you please guide on how to add a project to repo and checkout correctly?

sentences:
rotating a sprite around a non-fixed center I'm trying to get this character to spin in a circle to aim at the cursor. It all works pretty well, but I can't get the image to rotate around its center. Only around its corner. I've been trying to find a solution be using some crazy trig stuff, but I'm not getting anywhere.

public void draw(Graphics g, double inter)
{
BufferedImage im;
Graphics2D g2d = (Graphics2D)g;
GImage gImage;

gImage = GImages.getImage(p.sprite);
im = gImage.imageFile;
AffineTransform at = new AffineTransform();
at.translate((p.xcord+((float)p.width/2))+(p.xspd*inter), (p.ycord+((float)p.height/2))+(p.yspd*inter));
at.rotate(p.angle+(Math.PI/2));
at.scale((double)gImage.xsize/im.getWidth(), (double)gImage.ysize/im.getHeight());
//at.translate(-(float)p.width/2, -(float)p.height/2);
g2d.drawImage(im, at, null);
g2d.setColor(Color.BLUE);
g2d.drawRect((int)p.xcord,(int)p.ycord,1,1);
//g.setColor(Color.BLACK);
//g.drawString(p.suh, (int)(p.xcord+(p.xspd*inter)), (int)(p.ycord+(p.yspd*inter)));
}

p is my sprite object, the cords make up the point of the corner of the image.
The sprite moves around the screen, so I can't use a fixed point method as far as I know.
If anyone has any suggestions to make this work.

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: Need to find a web database of german words for taboo game I am looking for a web database of german words like this in english. Anyone knows sth about this? I develop the game based on such database of words, so this is why I asked about this here.

sentences:
Stencil test doesn't work at all in Unity when I am using a custom shader I am using Unity 2019.3 and I have a custom shader A which contains the code

Stencil{
     Ref 5
     Comp Equal
     Pass Keep
}

And the other custom shader B contains the code

Stencil{
     Ref 5
     Comp Always
     Pass Replace
}

The stencil test can do the right thing only if I add Fallback "Diffuse" in B, otherwise, it's never working. And A has no code related to Fallback.

Since shader A is using for post processing and I did something like

    buffer.SetGlobalTexture(ShaderID._MainTex,source);
    buffer.SetRenderTarget(destination);
    buffer.DrawMesh(mesh,Matrix4x4.identity,material,0,pass);

The material uses shader A.

Does this cause the issue because before today, I never use the Fallback during stencil test.

PS. You can use this and scene named SSS as example. In that scene the shader named Unlit/PBR has this issue. If you delete Fallback "Diffuse in that shader, the post processing effect never works.

sentences: Should I use threads to check sockets for multiplayer game? In a multiplayer game does the code to get/send info from/to sockets reside in the game loop or does it belong in its own thread?

sentences:
How can I calculate where my camera can be to avoid showing something outside a region? I have a landscape model, which goes from the coordinate -45, -45 to 90, 90.

The edge of the model just cuts off and i would like to somehow stop the screen from ever passing these points. Basically sticking a boundary so that you can't see off the side. The game is always in top view, with the camera directly facing down.

However the problem is that the player can zoom in and out, obviously you have a wider range of view when zoomed out. (There is a limit to how far you can zoom out, you couldn't zoom out say, so that opposite sides of the map are seen at once).

I am assuming using something like Viewport.Project or Unproject, which changes screen coordinates to 3d space and the other way round, could somehow help me in the situation.

My initial idea may lag too much, which would be a while loop saying "While projection of screen point.X is less that -45, add 1 to the camera.X" etc.

Does anyone have any ideas for this? To sum it up, i need to find a way of stopping anything outside the area of -45, -45 to 90, 90 from being shown on the screen.

Thanks for any help!

sentences:
How to make a character jump? I am currently making a game in C# using Direct X 9.0. The game remake is Donkey Kong NES. I have nearly everything completed, but I am having problems with the physics of Mario's jump. I have variables declared for the Y and X co-ordinations.

I was wondering if there was a simple method of doing this. I have searched high and low for an answer but the answers I have found are either irrelevant/ or using a different programming language such as XNA.

I currently have a bool variable set to check to see if W has been pressed then that will trigger any code to make him jump. I have been messing around such as.

  if (jump == true)
    {

        Playerypos -=  vel;
        Playerxpos +=  vel;
    }

Which didn't work that well. I have searched high and low for an answer and now I am desperate, if someone could point me in the right direction to a simple solution. That would be great. Much appreciated for any responses.

sentences:
Inverting matrix in HLSL I've got an object in HLSL and I'm using hardware instancing to render multiple copies. But I've come a bit of a cropper when it comes to the vertex normals. Currently I am not using normal mapping (although planning to implement it soon), I'm just putting the normals inside the vertex structure. I can put the world matrix and get it out in HLSL just fine, but I need the inverse transpose if I want the world position of the vertex normal from object space. How can I invert a matrix in HLSL? Or am I going to have to send the matrix and it's inverse in the instance buffer?

Or is this somehing that normal mapping doesn't require?

sentences:
Convert Mouse Coords into Isometric Tile ID Using GameMaker Language, I'm basing off their Adavnced Examples. How can i convert the current mouse position into a tile position?

The mouse coordinates are 0,0 from top-left

This is the function when it draws. I think this is what needs reversing. I'm tragically bad at Maths, so I'm sorry in advance.

/// DrawLevel()
var xx,yy,destx,desty, base_x,base_y,current_row_x,current_row_y,tile,o,sp, m,h,offy, tileset;

TileRowDX = 68;
TileRowDY = 34;
TileColumnDX = -68;
TileColumnDY = 34;

MapX = 0;
MapY = 0;
MapDrawX = 11;
MapDrawY = 11;

/// Draw the complete isometric level
tileset = global.tiles;

// End point in map drawing (map coordinates)
destx = MapX+MapDrawX;
desty = MapY+MapDrawY;

// Start drawing position - center in the middle of the screen - and just above a little
base_x = surface_get_width(application_surface)/2;
base_y = 150;

// X and Y loop to print all cells.
for( xx=destx-1;xx>=MapX;xx--) {
    current_row_x = base_x;
    current_row_y = base_y;
    for( yy=MapY;yy<desty;yy++)
    {
        // First draw the column of tiles in this cell, bottom to top.
        offy=0;
        for(var h=0;h<global.mapMaxLayers;h++){
            m = Map[h];         // get 2D map grid from level array (Z axis)
            tile = m[# xx,yy];  // get tile from 2D grid (x,y axis)
            if( tile>=0 ){
                // if we have a tile, then draw it.
                draw_sprite(tileset,tile,current_row_x,current_row_y-offy);
            }
            offy+=27;
        }

        // Next, get the object in this cell, and draw it on top.
        // If allowing height for the player, you'd need to add on 27 for each block up.
        o = Objects[# xx,yy];
        if( o!=0 ){
            // Get the object sprite to draw (could also do frames etc)
            sp=o.Sprite;

            // get a 0 to 1 value into the isometric cell.
            var dx = (1.0/15.0) * ((o.x&15));
            var dy = (1.0/15.0) * ((o.y&15));

            // Move to top left of Isometrix grid cell
            var ox = current_row_x - TileRowDX;
            var oy = current_row_y - TileRowDY;

            // Now convert into an isometric offset on X and Y
            ox = ox + (dy*TileRowDX);                   //Y axis first
            oy = oy + (dy*TileRowDY);
            ox = ox - (dx*TileColumnDX);                // now X axis
            oy = oy - (dx*TileColumnDY);

            // and draw this sprite
            draw_sprite(sp,0,ox,oy);

        }

        // Move down and right
        current_row_x += TileRowDX;
        current_row_y += TileRowDY;
    }
    // Back up to top, and move left and down.
    base_x += TileColumnDX;
    base_y += TileColumnDY;

}

I'm sure this is just mostly a mathematics question!

sentences:
How do you apply relativistic physics to a 4x strategy game? I had the big idea of trying to create a hard science fiction 4X strategy game (with the obvious space setting), which is supposed to simulate a realistic way of creating interstellar societies while simulating real life physics as well.

The problem is: how do I apply Einstein's relativistic equations into the game? I will make a separate series of questions for other issues, such as applying Keplerian planetary movement and Newtonian combat physics.

Do note: the game is being made in C++ and in Unity. Be warned: I am trying to simulate special relativity, not general relativity quite yet. That I can try in a different game.

sentences:
How do I calculate the distance between a point and a rotated rectangle? This question is similar to another one about axis-aligned rectangles. However, I specifically want to calculate this for rotated rectangles.

I have a rectangle with a (cx, cy) for the center point and a width, and height, and a (x, y) for the test point, as well as a θ for the angle of rotation.

What's the fastest way to determine the distance between that point, and the nearest edge of the rectangle? If the point is inside the rectangle, the distance should be zero.

I believe that there is going to be only a small change to the equation in the linked question, but I have no idea what it might be.

sentences:
In Unity , How to clear instantiated object when I call the function? Here is a function I call out am UI element:

public void LoadCurrentItem(ItemType t)
{
    List<Item> itemList = SessionManager.singleton.GetItemAsList(t);

    if (itemList == null)
        return;
    if (itemList.Count == 0)
        return;
    GameObject prefab = (t == ItemType.consumable) ? eq_left.inventory.slotTemplateUD : eq_left.inventory.slotTemplateLR;
    Transform p = eq_left.inventory.slotGrid;

    int dif = iconSlotCreated.Count - itemList.Count;
    int extra = (dif > 0)?dif: 0;

    for (int i = 0; i < itemList.Count + extra; i++)
    {
        if (i > itemList.Count -1)
        {
            iconSlotCreated[i].gameObject.SetActive(false);
            continue;
        }

        IconBase icon = null;
        if(iconSlotCreated.Count -1 < i)
        {
            GameObject g = Instantiate(prefab) as GameObject;
            g.SetActive(true);
            g.transform.SetParent(p);
            icon = g.GetComponent<IconBase>();
            iconSlotCreated.Add(icon);
        }
        else
        {
            icon = iconSlotCreated[i];
        }

        icon.gameObject.SetActive(true);
        icon.icon.enabled = true;
        icon.icon.sprite = itemList[i].icon;
        icon.id = itemList[i].item_id;
    }

}

It might seem less informative, but my question is simple and stupid:
I want to destroy my GameObject g that instantiates prefab before it instantiates prefab so that I can refresh GameObject g to create eq_left.inventory.slotTemplateUD or eq_left.inventory.slotTemplateLR

How can I achieve this goal?

sentences: Combe Rectangle and Vector movement I'm completely fresh to game development and came up to a problem which I'm not sure how to solve. I have textures which are quite too big for screen. So i used SpriteBatch.Method which uses rectangle as parameter which allows me to get custom size of texture. But I need as well Vector position for movement to specific direction. So I used method which uses Vector position and float scale to make it smaller. And now I can't check really if it Intersects with other objects or simple width, height properties. It seems that I cannot pass both vector position and rectangle as well. Isn't there a way to specify just a rectangle for texture's height/width to be rendered and vector for position?

sentences:
I can load new tiles but how do I load new chunks? I have successfully been able to add new tiles and place random trees on a 2d map grid however I haven't used chunks. I just load a new tile when the player moves and save it to the map array. But I have had some issues with the forests. And I'm thinking chunks would solve my problem. The problem is my forest just appears on the map when the player moves left or up. But I want to focus on how to handle the chunks because I know if I get that right I'll be able to solve the other symptoms to the main problem. Here is a link to the game.

https://76295db93db3812642fa5ba984c042fa81ffc37c.googledrive.com/host/0B6H3TRExU5M9eEkyd2FreHhiNlU/

Here is how I generate new tiles. This runs every game loop and not sure if that is the best way to do it. Does this cause lag? The bottom of the function checks if the tiles need to be updated to forest graphics. I know this is probably the wrong way to do it but I maybe if I get the chunk thing figured out I won't have these issues.

map.update = function() {
    for(var x = Math.floor(player.x - map.width / 2); x < Math.floor(player.x - map.width / 2) + map.width + 2; x++){
        for(var y = Math.floor(player.y - map.height / 2); y < Math.floor(player.y - map.height / 2) + map.height + 2; y++){
            //Surrounding tiles
            var tiles = [];
            //Check if tile needs to be generated
            var check = function(x, y) {
                if(typeof map.data[x] === 'undefined') {
                    map.data[x] = [];
                }
                if(typeof map.data[x][y] === 'undefined') {
                    map.data[x][y] = new Tile(x, y, map.generate.groundLayer(), map.generate.playerLayer(x, y), map.generate.aboveLayer(), map.generate.event());
                }
                //Add tile to collection
                tiles.push(map.data[x][y]);
            };
            //Center
            check(x, y);
            //Top
            check(x, y - 1);
            //Top Right
            check(x + 1, y - 1);
            //Right
            check(x + 1, y);
            //Bottom Right
            check(x + 1, y + 1);
            //Bottom
            check(x, y + 1);
            //Bottom Left
            check(x - 1, y + 1);
            //Left
            check(x - 1, y);
            //Top Left
            check(x - 1, y - 1);

            //Check if there is a forest
            /*
            if(map.data[x][y].playerLayer === sprite.forest.topLeftCorner) {
                tiles[3].playerLayer = sprite.forest.topRightCorner;
                tiles[4].playerLayer = sprite.forest.bottomRightCorner;
                tiles[5].playerLayer = sprite.forest.bottomLeftCorner;
            }
            */

        }
    }
};

sentences:
Is there an easy and automatic way of converting a Windows XNA project into a Monotouch Monogame project? I have just started with XNA development on Windows. But as I'm a fan of iOS I had to try porting my test code over to Monotouch on the Mac.
I used these instructions: http://www.facepuncher.com/blogs/10parameters/?p=42
But this is so much (manual) work!
And it really doesn't answer open topics like: why would I copy all the XNB files and in addition all the resources, like PNGs?

Is there maybe a tool that automatically converts a Windows XNA project into a Monotouch iOS project or at least creates the correct folder structure?

sentences:
How to tie a bullet release with a firing animation Lets say you have an animation that you want to happen when firing a bullet.  How would you get the bullet to show up at the end of the animation.  The only thing I can figure out is to know the time length of the animation, and delay setting the bullets position and setting it active until that amount of time has passed.  I was just wondering if this is the best approach, how does everyone else handle this?

EDIT:  I think i'm having trouble wording the question properly.

sentences:
How to opitimize Shadows in Unity 3D I made the shadow of Solider in my game using Unity pro shadows feature.

http://docs.unity3d.com/Documentation/Manual/Shadows.html

The performance of my game becomes very slow after adding these shadows. I used light map for buildings shadows but I cant use this thing for solider. I want to ask what technique should I use to make both real and optimize shadow of my solider.

sentences:
Designing a fluent API for card effects I'm currently trying a develop a small game similar to http://www.estiah.com/.

Basically, there are 2 teams of 1 or more actors each, everyone with their same deck. Turn order is fixed and each card is automatically played when drawn, so games play out automatically. I already got the basic game loop, game state and history and turn order and currently try to create a fluent API, that makes it easier to add cards later on.

Each card consists of multiple effects, that can either target the current user, a random ally/enemy, a specific ally/enemy based on some criteria (like, enemy with lowest hp) or all allies/enemies/everyone. On top of this, effects may also have some kind of setup/cleanup, that should only be executed once before/after all targets have been processed.

Below are the use cases i can currently think of:

apply 1 effect to self
apply 1 effect to a random ally/enemy
apply 1 effect to a ally/enemy matching criteria
apply 1 effect to all allies/enemies
apply 1 effect to everyone
apply multiple effects to either of the above (targets should not change between effects, even if, for example, the "enemy with lowest hp" is different after the first effect)
execute effects based on a condition on the user
execute effects based on a condition for each target

Conditions/targets should be resolved during effect execution, since previous effects might influence them (unless multiple effects are joined and assigned to the same target, in which case it should not change between effects, as stated above).

Since the theory probably isn't very expressive, i already developed a basic system, which can be found over here: https://codereview.stackexchange.com/questions/189732/designing-a-system-to-apply-multiple-effects-to-one-or-multiple-targets.

The current system allows me to do things like:

public class MyCard implements Card {
    public Effect getEffect() {
        dealPhysicalDamage(10).to(randomEnemy());
    }
}

Where dealPhysicalDamage(...) returns an instance of TargetedEffect, randomEnemy() returns an instance of TargetSingle and the to(...) method binds the target to the effect, converting it into a plan Effect, which in turn can get executed by the game engine. This modifies the current game state, which gets deep cloned into a history for later usage as a battle log.

I've been trying for days to come up with a better system that gives me the freedom to apply 1-n effects to 1-n targets (single target effects will be the majority), while keeping the API as compact as possible. I'm probably too deep in the code to get a clear view, so maybe someone else can come up with an idea.

sentences:
In unity, some part of mesh doesn't show only in play mode This is screenshot of not playing mode. You can see the the speedloader and bullets inside of the revolver.

And this is when playing mode.

As you can see, I can see the speedloader and bullets in scene view, but not player's camera. Sometimes, it disappears in scene view either!

I made this model same as other weapons, but others are working fine. Only this weapon causes this problem. All weapons that I made are based on same model and rigs, and I kept the weapon's scale fit as same as possible.

I tried move the camera and scale down a little bit, but still couldn't saw.

Why this is happening? How do I solve this? Any advice will very appreciate it.

sentences:
Are there spritebatch drawing limitations on monogame? I've reached a point that it seems when I draw too much on screen, monogame starts doing weird things.

When I call this code in the Draw method

public void drawDialogBox()
    {
        if (dialogueBoxOn == 1)
        {
            spriteBatch.Begin(SpriteSortMode.BackToFront, BlendState.NonPremultiplied, SamplerState.PointClamp, DepthStencilState.Default, RasterizerState.CullNone, null, Matrix.CreateScale(GameGlobals.zoom));
            spriteBatch.Draw(dialogBoxChara, new Vector2(89, 18), Color.White);
            spriteBatch.Draw(dialogBoxTexture, new Vector2(0, 108), Color.White);
            spriteBatch.DrawString(font, "àéùaDASASCZadhkjashdash", new Vector2(4, 108), Color.White);
            spriteBatch.End();
        }
    }

This happens:

This code is supposed to show the character, the textBox itself and the text. But the text isn't drawn correctly. If I comment one of the draw lines, it works.

Or this (if I only comment the character line)

Any ideas of what is happening here? I thought it was some SpriteBatch limitations, but I don't know...

EDIT: After following @Jon advice, i've reached this state

Now it shows the character and dialog properly, but the background and the walls are not displayed now. I have all the walls like this:

spriteBatch.Draw(leftcenterright4, new Vector2(0, 53), null, Color.White, 0, Vector2.Zero, 1, SpriteEffects.None, 0.5f);

And the background

spriteBatch.Draw(background, new Vector2(0, 0), null, Color.White, 0, Vector2.Zero, 1, SpriteEffects.None, 1f);

And the code from earlier fixed:

spriteBatch.Draw(dialogBoxChara, new Vector2(89, 18),null, Color.White, 0, Vector2.Zero, 1, SpriteEffects.None, 0f);
spriteBatch.Draw(dialogBoxTexture, new Vector2(0, 108),null, Color.White, 0, Vector2.Zero, 1, SpriteEffects.None, 0.1f);
spriteBatch.DrawString(font, "àéùaDASASCZadhkjashdash", new Vector2(4, 108), Color.White, 0, Vector2.Zero, 1, SpriteEffects.None, 0f);

sentences:
Super mario bros "rounded" tile collision detection I'm working on a Mario bros clone with SDL and C++ (purely for educational porpuses / and for fun)
I got collision detection working by using AABB collision detection and resolving one axis at a time:

Check collision with X-axis first
Move entity if not collision is detected
Check collision with the Y-axis.
Move entity if not collision is detected

This is working great!
However, one thing that I really like about the original Mario bros is that tiles have some kind of "rounded" feel to them. I think this helps make the map feel more organic, see how Mario moves left when jumping on a corner in the original SNES game:

I thought of using a circle collider for mario instead of an AABB.
This would make Mario "fall" off the tiles if you step too close to the edges. But perhaps someone knows a better approach. I've been thinking about collision detection for longer than I'd like to admit.
I'd love to know if someone has a clean aproach to accomplish what the GIF shows.

sentences:
Resize from one side of the object in runtime Unity For now I managed to resize my object but it resizes always from the center. I have the same problem like this question here.

I've been thinking like adjusting the position and stuff, but nothing works for my code.
Here's my code

if (isMouseDragging)
    {
        //tracking mouse position.
        Vector3 currentScreenSpace = new Vector3(Input.mousePosition.x, Input.mousePosition.y, positionOfScreen.z);
        //converting screen position to world position with offset changes.
        Vector3 currentPosition = Camera.main.ScreenToWorldPoint(currentScreenSpace) + offsetValue;
        if(getTarget.CompareTag("LeftRightWall"))
        {
            currentPosition.y = getTarget.transform.position.y;
            currentPosition.z = getTarget.transform.position.z;
        }
        if(getTarget.CompareTag("FrontWall"))
        {
            currentPosition.x = getTarget.transform.position.x;
            currentPosition.y = getTarget.transform.position.y;
        }
        //It will update target gameobject's current postion.
        Vector3 v3Scale = getTarget.transform.localScale;
        getTarget.transform.localScale = new Vector3(v3Scale.x + 0.1f , v3Scale.y , v3Scale.z);
        getTarget.transform.position = new Vector3(mfX + getTarget.transform.localScale.x / 2.0f, 0 , 0);
        getTarget.transform.position = currentPosition;
    }

My idea is I want to make the gameobject tagged LeftRightWall will be resized whenever the FrontWall is dragged and vice versa, like adjsuting the room size but I want to know how to resize them first. Any ideas?

sentences:
Offloading processing to a remote server in a game engine? What kinds of processes can you offload to a remote server in a game engine?

I'm thinking of making a real time multiplayer RTS, like Starcraft for example.

I was trying to offload as many processes as possible onto a remote server to:

1) Practice the techniques involved in order to offer a responsive gaming experience
     while taking advantage of the latest cloud processing techniques.

2) To make an engine that's the most platform independent possible.

I've already thought of a couple of things that could be processed remotely:

AI (Path finding)
Volumetric particle effects (Smoke after an explosion)
Loading between levels?

I'm also most curious about the following things being possible:

Rendering
Physics

If anybody has any knowledge to share about this subject I'd very much appreciate some guidance.

sentences:
Check whether a vector is to the left or right of another position I don't know how to decide if my point is on the left or right side of another object.

My first thought was to check if x-axis of object1 is bigger or smaller than object2's, but if my objects rotate then that isn't working.

In the picture above we have two states where object2 is on the left side of object1. In one case its x coordinate is greater, in the other, its x coordinate is less.

sentences:
Designing a simple snake A.I I've looked at some stuff online regarding this specific topic, and a lot of the info that I read involved graphs and path finding.

I really don't want to get involved in something too complex & out of my level, and also I don't need my snake to be that intelligent (it will be a large board with the snake not growing in size on every munch).

How could you structure a simpler AI for the snake that gets the job done relatively well? I would be able to get the snake to move towards the food item correctly, but my issue is that I'm not sure how to deal with the snake colliding with itself. Say the snake has a look ahead, and it finds that its tail is in the way, it could change direction, but what happens next?

Any ideas on how to tackle this? Should the snake build an instruction set from every square, or should it think on the go?

sentences:
What should I use instead of randomized start positions for good-looking 2D rain? Right now I'm randomizing the position of my 2D rain's spawn positions on both the X and, slightly, on the Y axis. It looks pretty weird right now, it has a bunch of huge clumps and unfilled areas:

I want a more uniform, but not a completely boring and uniform distribution of my rain. I want something that doesn't look like a perfectly tiled texture, but doesn't look as crazy random as the picture above. What can I do?

sentences:
Why doesn't my projectile move in my code? My projectile currently has a create event with the following code:

//move towards mouse
move_towards_point(mouse_x,mouse_y,30);

My main character has a glob left button event with the following code:

instance_create(0,0,main_shuriken);

For the output, the shuriken appears at the top left of the screen, and does not move. I've noticed that if I tick off physics world in the "rooms" category, my shuriken seems to work fine.

Why doesn't my projectile move with move_towards_point and create_instance commands?

sentences:
Securing a replay-based leaderboard system (as much as possible) A few years ago, I implemented a basic online leaderboard system in one of my games that sent encrypted score data over the wire. The encryption keys were stored in the game client's binary. Of course, the leaderboards got hacked the same day they were released.
I have now released a new game on Steam, and I've worked hard to implement fully-deterministic game logic and a replay system.
The replay system works by simply replaying the user's input that was recorded in a previous playthrough. The fully-deterministic game logic ensures that the replay will work on any machine, independently of the game's FPS.
Now, it is time for me to implement online leaderboards.
My idea is to create a server version of the game executable which receives replay files over the network, replays them on some remote machine, and adds the score to a database if the replay data is valid.
While this prevents cheaters from simply sending a fake score to the server, it opens up many other cheating avenues, including:

Tool assisted creation of replays, either by slowing down the game speed or by manually crafting a replay file after reverse-engineering its format (the game is open-source).

Taking someone else's replay and sending it over the network, changing data regarding who the replay belongs to.

I could somehow encrypt and compress the replay data before sending it over (or saving it on the user's local machine), but since the game is open-source, it would be easy to reverse-engineer the encrypted replay format.
What is a good way of securing a replay-based online leaderboard system?
One possible idea I had is to have the server generate an encryption key / token for a specific user which is only valid for a small amount of time, send it over to the client, and only accept replays that are encrypted with that key. This would prevent users from uploading older replays to the server, but in theory it should work -- am I missing something?

sentences: Problem using ccTouchesEnded/ccTouchesBegan to move sprite in cocos2d-x? I'm using ccTouchesBegan/ccTouchesEnded to move sprite from one point to another but I'm having problem, if i give two or more consecutive inputs one by one while sprite is moving(runAction is being performed). It first moves to last point i touched and then teleports itself to previous touched points one by one.

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:
texture cordinate VBO not being updated OpenGL I'm making a minecraft style game and I decided to add a VBO with the texture atkas coordinates of the vertices but it is appearing all white. However I'm following the same process as another VBO for the block positions which works

the one that works

glBindBuffer(GL_ARRAY_BUFFER,chunk->posOffsetVBO);
glBufferData(GL_ARRAY_BUFFER,sizeof(glm::vec3)*65536,NULL,GL_DYNAMIC_DRAW);

glVertexAttribPointer(2,3,GL_FLOAT,GL_FALSE,3*sizeof(GLfloat),(GLvoid*)0);
glEnableVertexAttribArray(2);
glVertexAttribDivisor(2,1);

then I fill it with glm::vec3s like this

glBindBuffer(GL_ARRAY_BUFFER,adjacentChunks[1][1]->posOffsetVBO);

glBufferSubData(GL_ARRAY_BUFFER,0,sizeof(posOffsets),&posOffsets[0]);

this is the one with the texture coordinates that doesn't work

glBindBuffer(GL_ARRAY_BUFFER,chunk->texCoordVBO);
glBufferData(GL_ARRAY_BUFFER,sizeof(glm::vec2)*36*1000,NULL,GL_DYNAMIC_DRAW);

glVertexAttribPointer(1,2,GL_FLOAT,GL_FALSE,2*sizeof(GLfloat),(GLvoid*)0);
glEnableVertexAttribArray(1);

then  fill It with 36 glm::vec2s for each block so one per vertex

glBindBuffer(GL_ARRAY_BUFFER,adjacentChunks[1][1]->texCoordVBO);

glBufferSubData(GL_ARRAY_BUFFER,0,sizeof(texCoords),&texCoords[0]);

Is there a reason why the texture one doesn't work?

sentences:
2D car physics and high speed turning I've been looking at the following page, which has been very helpful: http://www.asawicki.info/Mirror/Car%20Physics%20for%20Games/Car%20Physics%20for%20Games.html but have come into problems with the high speed turning section (about two thirds down the page)

He gives the following function to calculate the slip angle:

but it looks as if Vlat and Vlong are both vectors, and I can't see how putting vectors into the arctan function or the sgn function (which I assume is a function which returns -1 or 1 depending on the value of the sign) works.

The immediately below this he talks about F n,lat which he describes as "normalized lateral force for a given slip angle", but I am not sure how to calculate this value.

I'm not sure of any of the maths below this either, but this may be because I have not yet worked out the above bits, so if you wish to explain things below it then I would be grateful but it is not necessary.

I am writing the code using C# and XNA if this is important.

Thanks

sentences:
What is the best type of c# timer to use with a Unity game that uses many timers simultaneously? I am developing a stand-alone 3d game in Unity that will have anywhere from 1 to 200 timers running simultaneously. There will be a GameObject containing 1 timer. For this game timer durations will range from 5 minutes to 4 days. There will not be any countdown displays or any UI for the timers.

Each object is a prefab, with all the necessary materials included. An attached script will handle the timer and all the necessary code to change the materials and make any sound effects. Once the timer is expired, the user will then click on the object again, and the object will be destroyed, and the user's inventory will be adjusted.

If the user wants to save or end the game before all the timers are done, the start value of the still running timers is to be saved to an XML file such that when the game is started again, any still running timers will be checked to see if they have expired, where the object's materials will be changed appropriately.

I am still trying to figure out what type of timer to use, and see also if there are any suggestions for saving and calculating times over several days.

What class(es) of timers should I use?
Are there any special issues I should look out for in terms of performance?

sentences:
Accelerometer or on screen controls for mobile UI in 3D games? I can think of several 2D games which use the Accelerometer successfully, but in my experience as a player, character control in a 3D environment tends to be frustrating.  Mostly because a 3D environment often involves a wider, continuous field of view which prevents me from sitting comfortably while playing.

Is this an unfair generalisation? Are there examples of the Accelerometer working well for 3D games on mobile devices? There is the obvious tradeoff here, screen real estate unobscured by thumbs, but is it worth it?

sentences:
AndEngine drawing 2D tiled game field I'm in process of developing simple android puzzle game. I decided to choose andEngine as an engine for my game.

In my game I have a gameField [][] array, which represents a game field, where each element is a cell of game level and consists of a type of the cell (for ex. FLOOR of WALL). During the game, state of cell can be changed (for ex. DOOR_CLOSED changed to DOOR_OPENED), but it happens rarely, almost all the elements of gameField don't change.

I tried to implement that by adding repaint method to updateHandler, which would paint sprites for each cell every tick. But I wonder wouldn't be that approach a wasting of memory and processor time? What is the best practise for doing that?

sentences:
Avoiding lag when playing sound for first time using Cue.Play In my code I'm using SoundBank.GetCue("cuename") and Cue.Play() to play my sounds.

On the xbox whenever I first play a cue I get lag of about about one second.
How can I avoid this?

I'm thinking I probably have to do something like call GetCue (without playing it) for every Cue I'm going to use, however I don't have a central place where I list all cues I'll want to play, so is there an easy way to do that?

Update: It seems calling GetCue for all sounds i want to play doesn't work. I'm still getting stuttering in various places in my game when i call GetCue....Play.

sentences:
How to convert fbx with animations to dae I am making an ARKit app, and I need to implement animations. Our 3D artist has provided these files as fbx with animations.

All resources I find online about animated models in ARKit talk about dae (Collada) files with animation.

Is there a way to convert an fbx file with animations to a dae file containing the animations?

I tried asking our artist to export a DAE file, but that didn't appear to work as he has no experience with DAE files. The animation didn't seem to play.

I have also tried an online converter (http://www.greentoken.de/onlineconv/), but that failed to perform the conversion.

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:
IntersectMovingAABBAABB weird behavior I'm using the IntersectMovingAABBAABB implementation from the book Realtime Collision Detection and I'm having a little bit of an issue. When I have two AABBs next to each other (not touching), A being stationnary and B moving up or down, I'm getting a result saying there's a collision. Obviously this is wrong.

 _______     _______
|       |   |       |
|   A   |   |   B   |  B moving up/down
|_______|   |_______|

I've rechecked my code multiple times to make sure I had the same thing as in the book. Stepping through the code, I realized that the check for v[i] < 0 and v[i] > 0 will never be true for either X or Z axis when moving straight up or down. Therefor, no checks for intersections on these axis will be done. I find that quite weird, and I was wondering if I was missing something, or if this code is simply bad.

Here's my implementation for reference:

public static bool IntersectMovingAABBAABB(AABB a, AABB b, Vector3 va, Vector3 vb, out float first, out float last, out BlockFace face)
{
    face = BlockFace.None;
    if (TestAABB(a, b))
    {
        first = last = 0;
        return true;
    }

    Vector3 v = vb - va;
    float current;

    first = 0;
    last = 1;

    for (int i = 0; i < 3; i++)
    {
        if (v[i] < 0)
        {
            if (b.Max[i] < a.Min[i]) return false;
            if (a.Max[i] < b.Min[i]) if ((first = Math.Max(current= (a.Max[i] - b.Min[i]) / v[i], first)) == current) face = (BlockFace)(1 << (i));
            if (b.Max[i] > a.Min[i]) last = Math.Min((a.Min[i] - b.Max[i]) / v[i], last);
        }

        if (v[i] > 0)
        {
            if (a.Max[i] < b.Min[i]) return false;
            if (b.Max[i] < a.Min[i]) if ((first = Math.Max(current = (a.Min[i] - b.Max[i]) / v[i], first)) == current) face = (BlockFace)(1 << (i + 3));
            if (a.Max[i] > b.Min[i]) last = Math.Min((a.Max[i] - b.Min[i]) / v[i], last);
        }

        if (first > last) return false;
    }

    return true;
}

sentences:
Why are not the images loaded in Phaser? I am starting to use phaser to create games and I found a problem that I can not find for more tests that I did.
I can not show the images I am uploading. You only see a small square in the center, (I show it in this capture: when you should see the entire background of the canvas in green, which is the image that first charge.
In the example I only charge one, so that more if it does not work.
I do not see what error I'm committing, because the navigator inspector does not show errors.
The server is created with Node.js.

const http = require('http')
const fs = require('fs')

const server = http.createServer((req, res) => {
    fs.readFile("./part1.html", (err, data) => {
        if(err){console.error(err); return;}
        res.end(data)
    })
})
console.log('escuchando en el puerto 3000')
server.listen(3000)

I show the code for if someone can see the error that I am committing.
Thank you.

I EDIT the question:

I add the code that I should add first.
The project is in a folder called Game.
Here is the file server.js and package.json
There is also a folder called public where the html code and images are located.
I show you the code.

<!doctype html>
<html lang="es">

<head>
 <meta charset="UTF-8" />
 <title>Primer juego en Phaser</title>
 <script src="//cdn.jsdelivr.net/npm/phaser@3.11.0/dist/phaser.js"></script>
 <style type="text/css">
  body {
   margin: 0;
  }
 </style>
</head>
<body>
 <script type="text/javascript">

  var config = {
   type: Phaser.AUTO,
   width: 800,
   height: 600,
   scene: {
    preload: preload,
    create: create,
    update: update
   }
  };

  var game = new Phaser.Game(config);

  function preload() {
   this.load.image('sky', 'sky.png')
   this.load.image('sky', 'assets/sky.png');
         this.load.image('ground', 'assets/platform.png');
         this.load.image('star', 'assets/star.png');
         this.load.image('bomb', 'assets/bomb.png');
         this.load.spritesheet('dude', 'assets/dude.png', {         frameWidth: 32, frameHeight: 48 });

  }

  function create() {
   this.add.image(400, 300, 'sky')
  }

  function update() {
  }

 </script>
</body>
</html>

sentences:
How to Implement ECS Archetypes in C#? I'm trying to figure out how to implement a simple ECS with an Archetype approach, similar to what Unity's ECS uses.
An archetype is just a category for entities that have a specific set of components.
Let's say I had three components, A, B, and C, and I had the following systems:

System 1 (Archetype requires component A)
System 2 (Archetype requires components A and B)
System 3 (Archetype requires components A and C)
System 4 (Archetype requires components A, B, and C)

Because components could be added and removed from entities on the fly, an entity switches archetypes whenever a component is added or removed.
I'm not quite sure what these archetype collections are supposed to look like. They must be arrays of some kind, but I'm not sure how to store and organize components in them that belong to a specific entity.
My question is, what would this look like in pure, vanilla C# code?
And could generics also help with this?

sentences:
Updating transform position after root motion I have an animation of a character climbing with root motion in it (i.e. the character moves generally upwards for a couple of units during the animation). It is intended as a one shot, not a loop. The skeleton is fairly standard hips > spine 1, hips > right leg, hips > left leg etc. The root is the hips and the pivot is between the soles of the feet.

I know its generally best to make in-place animations without root motion but scripting the upward movement using Vector3.Lerp etc looks unrealistic (in reality when rock climbing for example the upward motion will come in perdiodic bursts as the knees are first bent, then extended, rather than a constant movement upwards), so I want to keep the root motion in the animation.

Problem is when the animation has finished Unity still considers the transform pivot to be in its original location, before the skeleton climbed up two units. Is there any way to instruct Unity that the new transform position is where the characters feet have ended up after the animation has finished?

I figure I could parent the hips to an empty which moves the charaters around normally, detatch the empty before the root motion climb, move it by the same amount the hips moved then re-attach but is there a less hacky way? Some kind of transform.returnToOriginalOffset method perhaps?

sentences:
How to set C++ language standard for VS2019 in an Unreal project? I am trying to a simple thing, just like that, in a header file;
#include <filesystem>
#include <iostream>

namespace fs = std::filesystem;

And IntelliSense goes:
namespace std has no member filesystem.
Okay no worries, it's an easy fix.
Just set the C++ language standard in the propery pages...
Well, it turns out it isn't, it's not an option in Unreal VS project. Tried typing in search bar, View -> Property pages, but no luck.
Okay let's try doing the whole thing in a console project first.
Same message from IntelliSense as before.
Ok, no worries, I found this.
I found my settings under: Project > projectname Properties
And voila, the console app works.
Let's try it in the Unreal project.
Well, well... My options are limited here.

I had a look around in the project settings as well:

How do I get this filesystem header work with my project?

sentences:
How do I know when the app is launched, loses focus and gets focus again on mobile? I searched in Unity Documentation but there are no information. I'd like to know which methods is called and what it returns in the following scenarios on Android:

App initially starts
App goes in the background
App is brought forward after being in the background

As for IOs I know that the scenarios should be the following:

App initially starts:

OnApplicationFocus(true) is called
App goes in the background:

OnApplicationFocus(false) is called

OnApplicationPause(true) is called
App is brought forward after being in the background:

OnApplicationPause(false) is called

OnApplicationFocus(true) is called

sentences:
making Circle button in phaser im trying to make a circle button with tap event i used hitArea property from sprite class and using pixi Circle class i did that

this.sprite = game.add.sprite(50,50,"cursors");

        this.sprite.anchor.set(0.5,0.5);

        this.sprite.hitArea = new PIXI.Circle(50,50,84);

        this.sprite.inputEnabled = true;

        this.sprite.events.onInputDown.add(function(){

            console.log("clicked");
        });

    };

it is not working at all
so i tried removing  this.sprite.anchor.set(0.5,0.5);

input is work fine when there is no hit Area so what should i do

note :
phaser version is 2.2.2

sentences:
What can I do about a "missing mcp.cfg" error? I am trying to use MCP. After trying to run decompile.sh, I manually ran decompile.py, getting the error "ERROR:root:!! Missing mcp.cfg !!"

I tried to copy the variables from mcp.cfg into the files which reference them, but I still got the error. How can I fix this?

sentences:
Logic behind a bejeweled-like game In a prototype I am doing, there is a minigame similar to bejeweled. Using a grid that is a 2d array (int[,]) how can I go about know when the user formed a match? I only care about horizontally and vertically.

Off the top of my head I was thinking I would just look each direction. Something like:

int item = grid[x,y];
if(grid[x-1,y]==item)
{
    int step=x;
    int matches =2;
    while(grid[step-1,y]==item)
    {
        step++;
        matches++
    }
    if(matches>2)
        //remove all matching items
}
else if(grid[x+1,y]==item
    //....
else if(grid[x,y-1==item)
    //...
else if(grid[x,y+1]==item)
    //...

It seems like there should be a better way. Is there?

sentences:
Player appears in front of objects even if it's in the background I have a player in Z=0 and a fence object that I want it to be in from of the player so I set it to Z=1, it's a 2D game but in the 3D view I can see that the fence is actually in front of the player but in the 2D view the player is displayed in front.

Here are a couple of screenshots.

3D view, fence in front of player:

2D view, player in front of fence:

Any idea how to fix this?

sentences:
Physics engine recommendation which can simulate pool game correctly? I'm making a pool-game like game. This game requires correct (or very accurate) reflective bounces.
I tried Box2D and Bullet Physics, but they both have this problem.

If there is a wall on top of this image, red line is expected course of a real ball in a pool-game. But the engines often shows green line course. Especially,

This happens after a slowly moving ball hits the wall.
Sometimes a rapidly moving ball get slower suddenly.

I'm finding a physics engine which can simulate pool-game accurately as much as possible without these problems. Can I get some recommendations? Now I'm digging Newton Game Dynamics, but I am not sure the engine will show what I want. I'm considering the PhysX engine as a next trial, and have to make my own if nothing works. But it's obvious it'll take very long time, so I wish I won't do that.
I'll be very appreciated if you save my time. And of course, solution with Box2D / Bullet Physics are also welcomed.

I am working with C/C++/Objective+C on iOS.

I attach my configuration with Box2D.

Walls

static box shape
linear/angular damping = 0.1
restitution = 1.0
friction = 100
density = 10
bullet = false
fixed rotation = false
inertial scale = 1.0

Balls

dynamic sphere shape
linear/angular damping = 0.1
restitution = 1.0
friction = 100
density = 20
bullet = true
fixed rotation = false
inertial scale = 1.0

sentences:
Candy crush saga popup-like messages I was wondering how could I make in Android something like the popup messages seen in Candy Crush Saga, those messages like "Delicious!", "Tasty!" or similar:

As well as the score of each movement, they will pop up at first and then vanish:

How could I implement something like that in Android?

sentences:
Creating Blender-like cavity shader I'm trying to achieve in Godot something similar to cavity effect from Blender (this can be enabled in viewport options; cube on the left is displayed by viewport with this option enabled):

How would you replicate this?

sentences:
How can I make tree foliage work with baked lighting? I have an issue in Unity where my trees are black and it seems to be due to the fact that I'm using baked lighting in my scene. Luckily, it seems that I'm not the only one who's experienced this. I found a post on the unity3d subreddit which goes into more detail about basically the same problem. I'll repost it here for convenience:

  So, I have some custom trees using the "Nature/Tree Soft Occlusion"
  shaders and they looked great before baking a lightmap. However, now
  that I have baked the lightmap, the trees have turned black. Or
  rather, when I tried baking with the trees set to static, they turned
  invisible, and now that Ive tried without, they're black. Also,
  they're not casting shadows.

  Anyone know how to fix this issue? Perhaps I need to use light probes?

  http://imgur.com/a/21At5 --> before and after (fyi the bark is not
  using the nature/occlusion shader. The shader definitely seems to be
  the root of the issue, but Im just not sure how to fix it without
  using a different shader)

Ultimately, the author of this post eventually "solved" his problem by just switching to realtime lighting instead of baked lighting. Unfortunately, this is not an option for me. However, the author did receive some useful comments before giving up.

One of the comments asks if the leaves have properly laid out UVs. The commenter goes on to say that the leaves all need to have their own unique space in the UV grid. I think this makes sense because I enabled the Generate Lightmap UVs option on my tree model in Unity. But it did nothing. The author apparently also had no luck with that option.

In any case, Maya was suggested (among other software) to check these leaves' UVs. Unfortunately, I've never used Maya and I absolutely can't make heads or tails out of it. I'm just using a borrowed copy from a friend so I've never gone through any tutorials or anything for it. I'm just trying to check this one thing, but I am really at a loss.

EDIT:

According to some comments from DMGregory, he suggests that since trees get spawned and varied dynamically, there's no single mesh to pull apart and check its UVs. His logic seems to make sense, so perhaps Maya is not the solution that I'm looking for. Now, though I'm having trouble with figuring out how to get my tree shaders to work with lightmapping. Details are in the comments.

sentences:
How do you change movement to strafe Right now my player can move forward and backward using

case 'a':case 'A':
    speed.x = lx * 0.1;
    speed.z = lz * 0.1;
    break;
case 'b':case 'B':
    speed.x = -(lx * 0.1);
    speed.z = -(lz * 0.1);
    break;

Ly is equal sin(vertAngle);

Lz is equal -cos(horAngle);

What should i do for sideways movement?

sentences:
Unity: Dimensions of color surface does not match dimensions of depth surface I am receiving the error, "Dimensions of color surface does not match dimensions of depth surface" whenever I attempt to use my screenshot code, without any callstack or anything further insight of what I am doing wrong.

I have a separate camera from my main camera, whose purpose is to take screenshots at different angles.  Hierarchy as such:

The main camera captures the 3D scene just like a normal main camera would, including post-processing components.  No HDR or MSAA.

The GUI camera captures just the UI layer.  Nothing enabled except MSAA.
The canvas and image are simply a watermark, rendered by the GUI camera.

I point both the main camera and GUI camera to the same target render texture.  When ready to take a screenshot, I enable the camera components, thus Unity takes over and tells them to render the frame.  In the OnRenderImage callback, I disable the camera so it can be used again, I remove the render texture I previously assigned, extract the pixels, and save it as a PNG.

In a separate test, this all seems to work as intended.  No error messages.  However, when playing the full game, suddenly I receive the dimensions errors upon each screenshot.

I have read that RenderTexture.IsCreated will test if the render texture is still available.  Supposed, it will be set to false due to a large variety of events, such as window changes.  I have made it impossible to even get the reference to the render texture without it checking if the IsCreated bool is true.  I have also tested if the render texture matches its Descriptor property, out of paranoia.  All of these checks succeed.

I don't know what to look at next.

What is SUPER strange is I have a GIF generator, using quite similar code, that's much more complicated, and it does not suffer from this problem.

Has anyone dealt with this error before?  Any hints at all?

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:
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:
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:
Earth-like acceleration seems slow I wanted to make a kind of "fill the box" style game where you hold down to increase size of a ball that falls when you let go, end goal being covering a percentage of the screen.

Anyway, I wanted to attempt to make the engine myself for learning purposes (fiddle).  However, using 9.8 as a global acceleration makes it feel like really low gravity.

So far, all of my movement is done via the function below.  I feel like I'm missing something obvious, but just can't figure out why it seems more like moon gravity than Earth.

dt = new Date().getTime();
dt = (dt - lastFrame) / 1000;
for (var c in circles) {
  circles[c].v.y += acceleration * dt;

  if (circles[c].x + circles[c].v.x * dt > canvs.width || circles[c].x + circles[c].v.x * dt < 0) {
    circles[c].v.x *= -1;
  }
  if (circles[c].y + circles[c].v.y * dt > canvs.height || circles[c].y + circles[c].v.y * dt < 0) {
    circles[c].v.y *= -1;
  }

  circles[c].x += circles[c].v.x * dt;
  circles[c].y += circles[c].v.y * dt;
}
lastFrame = new Date().getTime();

sentences:
Question about designing and controlling a forklift's forks I am building a forklift for a game that I am working and I am trying to come up with a valid way of designing it. So far I haven't really liked the way it behaves in game The forklift has three parts to it

Wheels
Main body: Has a rigid body component
Forks : Has a rigid body component and a configurable joint where the connected body is the main body(2).

The movement is perfectly fine but its forks behaviour that is a bit troublesome. I am trying to make it move as a whole with the main body but it appears as if it is trying to detach itself when I hit another rigidbody in the scene(link goes to a screen cast I made of the problem in action). I have adjusted the drag and angular drag parameters of both the main body and the forks, adjusted the linear and rotational configurable joint parameters and yet this problem constantly occurs. According to an answer found on the official unity forums, I shouldn't parent two rigidbodies together. I am thinking about setting the fork as a purely kinematic rigidbody and updating its position every frame. Does anyone else have any other ideas?

sentences:
How to create inline glow shader for 2d polygon in CG using Unity Shader Lab? So here is what I am trying to do. Given irregular polygon (on the left) I would like to be able to create a shader that would resemble Photoshop inline glow effect with opaque fill (on the right).

Creating similar effect for 3d object I can achieve with Fresnel function. However, I am not able to do it for a flat surface of any given irregular 2d polygon.

EDIT

I am planning on using Voronoi method to generate polygons and then connecting individual polygons to territory shapes based on which player owns them. Which, then will have border material applied. What I need is effectively border (or territory) shader. That means shader has to work for more irregular shapes, like the one below.

sentences:
Isometric drawing "Not Tile Stuff" on isometric map? So I got my isometric renderer working, it can draw diamond or jagged maps...Then I want to move on...How do I draw characters/objects on it in a optimal way?

What Im doing now, as one can imagine, is traversing my grid(map) and drawing the tiles in a order so alpha blending works correctly.

So, anything I draw in this map must be drawed at the same time the map is being drawn, with sucks a lot, screws your very modular map drawer, because now everything on the game (but the HUD) must be included on the drawer..

I was thinking whats the best approach to do this, comparing the position of all objects(not tile stuff) on the grid against the current tile being draw seems stupid, would it be better to add an id ON the grid(map)? this also seems terrible, because objects can move freely, not per tile steps (it can occupies 2 tiles if its between them, etc.)

Dont know if matters, but my grid is 3D, so its not a plane with objects poping out, its a bunch of pilled cubes.

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:
How can I add left and right movement to my sprite without reducing forward movement? I've made a character sprite that moves left and right when I press A and D, and moves forward automatically. However, whenever the character moves left or right, the forward movement is greatly reduced. Does anyone know a solution?

Here is my blueprint

sentences:
How to increase the selectable size of an object for dragging I am currently dragging a gameobject like this.

   Vector3 screenSpace;
   Vector3 offset;
   void OnMouseDown(){

 //translate the cubes position from the world to Screen Point
 screenSpace = Camera.main.WorldToScreenPoint(transform.position);
 //calculate any difference between the cubes world position and the mouses Screen position converted to a world point
 offset = transform.position - Camera.main.ScreenToWorldPoint(new Vector3(Input.mousePosition.x,Input.mousePosition.y, screenSpace.z));
 }

  private float speed = 7.5f;

  void OnMouseDrag(){
     Vector3 curScreenSpace = new Vector3(Input.mousePosition.x, Input.mousePosition.y,    screenSpace.z);
     Vector3 curPosition =  Camera.main.ScreenToWorldPoint(curScreenSpace) + offset;
     transform.position = curPosition;
 }

Sometimes a user doesn't click directly on an object so is there a way that if a user is between 3-7 pixels off, it still counts as a click and drag? Any help is appreciated.

sentences:
Rotating Object parallel to other object I try to rotate objects in the same direction as a reference object.

Normaly this would be easy:

object1.rotation = reference.rotation

But the same rotation can be expressed with different vectors:

(0, 45, 270) is the same as (0, 225, 90)
(0, 0, 270) is the same as (0, 180, 90)

In my case the final rotation should account for this.

The reference object has a rotation of: (0, 45, 270)

Object1 Should Rotate from (0, 45, 270) to (0, 0, 270)

Object2 Should Rotate from (0, 225, 90) to (0, 180, 90)

How can i calculate this?
Im using unity if this is any help.

sentences:
how do i make AI enemy in unity 2D? How do i make a AI enemy that go to player and if enemy arrives at collision (ex. stone collider) rotating to path , (unity 2D top view)?

(Enemy has a face sprite and  animator component)
In this pic , I want to do :ai enemy following player but when arrives to wall so it's face changes  the path and following again  . 2- if enemy 1 arrives to enemy2 so enemy face change the path for follow player

sentences:
How to increase the acceleration of an object on the Y axis? So far I am able to make the character fall at a constant rate but I am unsure how to make the character accelerate while falling.

When the character is falling I have a line of code as such:

position.y -= 7f;

How can I change my implementation such that the character falls faster over time?

sentences: Off screen image Direct3D processing with SharpDX, pixel shader and C# I currently have a working app that can process images with a window handle. This of course makes use of the swap chain and so on... I need to process an image with pixel shader off screen without a window handle. I have not been able to successfully port this to an off screen model. Can any please help educate me on the best way to do this? I have the Device, context for both Direct3D and Direct2D available. I'm having issues with using the correct texture to image process...

sentences:
Are there any frameworks that allow me to write games in C# on Linux? I'm looking for something like an alternative to XNA - I don't care whether it's a 2D or 3D engine. It's not because I dislike Windows or am anti-Microsoft; it's because I like running Linux, code in Linux completely (for C# I use Mono, obviously), and by no means have any hardware to actually support programming in XNA, simply because my video card is 6 years old. I also don't have a Windows 7/Vista CD for DirectX 10.

Thus, for game development I'm kind of stuck in the stone age. Yet, I like C# very much and would hate to have to drop it as a language due to this.

Is there anything I can do?

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:
Shooting the bullet out of the gun instead of the camera, yet keeping it accurate with respect to the reticle I'm working on a first person game, and I've ran into a problem. In my game, there's the player's gun being rendered, as well as a reticle in the center of the screen - like this:

First, Let's imagine there was no gun model being rendered. Then firing the bullet is easy - you just spawn the bullet exactly where the player's "eyes" are, and then use trig to calculate the velocity based on whatever direction the player is looking.

But now, when we add the gun model... we can't just spawn the bullet where the players eyes are, we have to spawn it at the tip of the gun (right?). So you do that, but then... how do you move the bullet in a way that it will hit wherever the reticle was pointing?

Keep in mind that the bullet in my game (it's actually a rocket, in this case) will be moving slow enough that its movement can be seen, so some workaround that would usually work if the bullet is too fast to be observed will not work. For example, if you didn't spawn it so it looks like it's coming out of the tip of the gun, the player would definitely notice that.

sentences:
How to make the snake to pass from one side of the screen and come out the opposite side? How do I code the left and right collision, and also tell me how I can set the collision of snake according to the form size.

If i want to change or maximize the form, snake should collide with the ending boundaries of the form ..

sentences:
How well (or badly) does Minecraft SMP scale? Has anyone tested and collected some data about how well does Minecraft SMP scale, with an increasing number of players (up to large amounts of players)?

I.e. the bottlenecks are:

mostly in the server or in the client or both
if the players are all in the same area, or if they are in different areas, or it is irrelevant where they are

sentences:
Smooth mesh from voxel grid Im trying to implement smooth voxel grid meshing using marching cubes algorithm but I dont quite understand how to do the interpolating (I understand that this would solve the problem) to achieve the smooth transitions on the borders between the empty space and filled space.

In the picture above I have rendered my voxel grid cells as cubes.
Currently the voxel grid is just a 3d array which stores the values if the cell is empty (0.0) or filled(1.0) (not sure if this is ok, do I need to store each cell corners instead).

When processing marching cubes iteration I have to sample my data at floating point indices e.g. I need to look up if position (3.316, 0.16, 0.5) is empty space / on the surface of the data / inside the data.

Currently I just check the cell value where the position is e.g. (3, 0, 0) for the example above which results with cube mesh.

This shows what I want to do more or less:

sentences:
Handling Ctrl- shortcuts in Unity, respecting user preferences I am implementing some software with Unity that needs to support Ctrl-<key> shortcuts such as Ctrl-c. I want to do this in a way that respects the user's operating system keyboard preferences; for example, these shortcuts must still be recognized when the user uses sticky keys, or when the user has mapped caps lock as control.

Many of the solutions I found online for implementing keyboard shortcuts look something like this:

if ((Input.GetKey(KeyCode.LeftControl) || Input.GetKey(KeyCode.RightControl)) && Input.GetKeyDown("c")) UnityEngine.MonoBehaviour.print("C-c");

This solution is totally unacceptable to me because it "hard-wires" holding down a control key as the method for sending a control-key modifier, bypassing the operating system's possibly-customized handling of the control key modifier.

Most games don't support keyboard preferences properly, but I am hell-bent on making sure the software I write will do this properly. I'm particularly concerned about supporting sticky keys because this is an accessibility issue - some more complicated shortcuts will not be available to users with disabilities if sticky keys isn't handled correctly.

How can I support keyboard shortcuts properly in Unity?

sentences:
Ways to persist entities and components in an ECS? I am working on a small multiplayer game with rpg elements using java and "Artemis ODB". Most of the logic is already done but one important thing is missing. The persistence.
So i am searching for different ways to persist my game. One thing is important, the world is huge and i cant load in the whole world at once. I already stumbled upon two different ways on my own. Using a relational database or a nosql database. But one thing scares me... entity references.
In my game i have an player entity and item entities. The player entity owns a inventory component which stores a reference to some item entities. In my ecs, each entity reference is an simple integer. So this looks like this...
/**
 * Represents the Inventory of our game, contains references to entities acting as items.
 */
public class Inventory extends HibernateComponent {
    public Set<Integer> itemEntities = new LinkedHashSet<>();
}

Why does this scare me ? Well... Entity references are Integers in my case. They are no real ID and i cant set or change this "ID" of an entity because my framework permits it. This brings us straight to the problem. When i serialize this component or the whole player entity it would look like this.
Inventory{
   itemEntities: [40,2,5,50]
}

So when we save this and load it later on we have no entity with the id 40... and even if we recreate that entity we cant set it to an id of 40, because the frameworks permits it. So how the heck do we save references between entities ? ^^
So all in all... what are common ways to save, load entities from an ecs ? How do you do it ? And what would you recommend ?

sentences:
Fix Unity Line Renderer for pointer drawing a jaggy line I think I'm using the standard Oculus setup from the SDK using the OVRCameraRig. I've also got a LaserPointer.

But inside VR on my Rift the line looks like this.

Any idea what I'm doing wrong? It used to be straight. Now it's not. I don't know what I changed.

sentences:
Pygame falling shape and keyboard input I want a shape in pygame to fall down slowly. The user should be able to move the shape with the arrow keys. My code is given below:

while Running:
    Keys=pygame.key.get_pressed()
    if event.type == pygame.QUIT:
        Quit()
    elif event.type == pygame.KEYDOWN:
        if event.key ==pygame.K_LEFT:
            x=x-1
    y=y+1
    pygame.time.wait(3000)

However, it doesn't always take in the keyboard input if the shape is falling. e.g I will have to press the left arrow key 5 or 6 times for the shape to move. Any idea how I can sort this out?

update: I think the error is in the following code, but if I don't have it then the shape falls too quickly.

    pygame.time.wait(3000)

sentences:
Texture coordinates do not map correctly in Direct3D11 game engine I beg your pardon if this question has been already answered elsewhere or if this is the wrong site, but I have a serious issue with rendering textures with Direct3D 11.

Using Cinema 4D R17, I created a simple cube, triangulated all polygons, and UV mapped a texture, as you can see here:

and it renders correctly.

Next, I exported the file to .x because I created a simpler mesh format and .x is ideal for getting vertices, indices, normals, texture coordinates, etc. This conversion is perfect as all data from the source file is successfully transferred to my file (I checked and double checked it).

However, when I upload the file in my game engine, I get the following result:
The cube is being rendered incorrectly where that strange pattern forms.

This is the original .x file (I included only relevant parts):

Mesh CINEMA4D_Mesh {
  8;
  // Cube. These are vertices.
  -0.01;-0.01;-0.01;,
  -0.01;0.01;-0.01;,
  0.01;-0.01;-0.01;,
  0.01;0.01;-0.01;,
  0.01;-0.01;0.01;,
  0.01;0.01;0.01;,
  -0.01;-0.01;0.01;,
  -0.01;0.01;0.01;;

  12;
  // Cube. These are indices.
  3;0,1,3;, // '3;' means that this face contains 3 vertices.
  3;2,3,5;,
  3;4,5,7;,
  3;6,7,1;,
  3;1,7,5;,
  3;6,0,2;,
  3;0,3,2;,
  3;2,5,4;,
  3;4,7,6;,
  3;6,1,0;,
  3;1,5,3;,
  3;6,2,4;;

  MeshNormals {
    8;
    // Cube
    -0.408;-0.408;-0.816;,
    -0.667;0.667;-0.333;,
    0.667;-0.667;-0.333;,
    0.408;0.408;-0.816;,
    0.408;-0.408;0.816;,
    0.667;0.667;0.333;,
    -0.667;-0.667;0.333;,
    -0.408;0.408;0.816;;

    12;
    // Cube
    3;0,1,3;,
    3;2,3,5;,
    3;4,5,7;,
    3;6,7,1;,
    3;1,7,5;,
    3;6,0,2;,
    3;0,3,2;,
    3;2,5,4;,
    3;4,7,6;,
    3;6,1,0;,
    3;1,5,3;,
    3;6,2,4;;

  }
  MeshTextureCoords {
    8;
    // Cube
    1.0;1.0;,
    0.0;1.0;,
    1.0;0.0;,
    1.0;1.0;,
    1.0;1.0;,
    1.0;0.0;,
    0.0;1.0;,
    1.0;0.0;;
  }
  MeshMaterialList {
    2;
    12;
    1,
    1,
    1,
    1,
    1,
    1,
    1,
    1,
    1,
    1,
    1,
    1;

    Material C4DMAT_NONE {
      1.0;1.0;1.0;1.0;;
      1.0;
      0.0;0.0;0.0;;
      0.0;0.0;0.0;;
    }
    Material C4DMAT_Mat {
      1.0;1.0;1.0;1.0;;
      1.0;
      0.0;0.0;0.0;;
      0.0;0.0;0.0;;
      TextureFilename {
        "tex.bmp";
      }
    }

    {C4DMAT_Mat}
  }
}

I also invert the vtexture coordinate (v = 1 -v). This is the vertex data I extract:

8 // Number of vertices.
-0.01 -0.01 -0.01 -0.01 0.01 -0.01 0.01 -0.01 -0.01 0.01 0.01 -0.01 0.01 -0.01 0.01 0.01 0.01 0.01 -0.01 -0.01 0.01 -0.01 0.01 0.01 // Vertices stored in X, Y, Z.
1 0 0 0 1 1 1 0 1 0 1 1 0 0 1 1  // Texture coordinates stored in U, V.
36 // Indices count.
0 1 3 2 3 5 4 5 7 6 7 1 1 7 5 6 0 2 0 3 2 2 5 4 4 7 6 6 1 0 1 5 3 6 2 4 // Indices.
tex.bmp // Texture file name.

I read that there might be a conflict between texture coordinates of vertices that are shared among different faces and that resolving this would imply not using index buffers.

EDIT: I did what @wondra said (replaced texture coordinates with 0 0 0 1 1 0 1 1 0 1 0 0 1 1 1 0 and it looks better indeed:

I am not sure what is wrong here. Could anybody help me? Thank you.

UPDATE: The Cinema 4D .obj is broken. Use Blender or anything else.

sentences:
"The server isn't currently responsive" error when trying to log into Unity Hub I had reinstalled Unity and Unity Hub to fix package manager error, and when I try to log into Unity Hub after it installs, i get the following error

"The server is currently unresponsive"

I tried to log in through both Google and facebook, but it didn't work (i created my account through those methods)

How do i fix this?

sentences:
Should I store game settings in my game data class? I'm working on a small-ish 2d fixed shoot 'em up for iPhone.

I have a master Game object that stores lives, score, current level, etc...

The game will have some other persistent attributes like Music and Sound mute state, difficulty level (easy, medium, hard).

Should I put those attributes in the Game class or should they be on their own?

What's the rule of thumb to decide how to partition attributes among classes?

sentences:
How do I make an AI that stays at a distance from the player act correctly when cornered? I am working on a few different AIs for a tile-based game. I'm trying to figure out one where that tries to keep a certain distance from the player. So if distance becomes small, move away.

The whole game is in a pretty small are so it can't just forever move away. The movement is 4 directional.

How do I make the AI keep going at a distance, and once caught in a corner or close to a side of the room, to ignore the rule and just try to go around the player to the other side of the room?

sentences:
How to define 648 units, with 22 different values in Java A friend and I are currently looking at developing a game. We have 648 units that need to be defined, with 22 final values.

To define the units in the game, we've created an abstract class with 44 variables and two methods. For example, if I encounter this unit in the game, I would pass a method its value, and it would look at some sort of lookup table which give all these base, final values. The problem we've encountered is finding a method of doing this effectively, and securely.

For now I have a few units defined through enumeration, and have their values stored in an array. My partner suggested to create a defining class with a plaintext lookup table. However, I see the problem with such a solution would either be the length, or quantity of lookup tables. I have searched around, but most solutions entail the use of a server. Our current goal is to just release an offline client with everything already defined.

Does anyone have any suggestions on how to store 648 units with 22 different final attributes effectively, so that such an entity could be called later and examined?

sentences:
How to make a cell shader like BOTW in Unity? It seems most cell shader tutorials focus on individual shaders for materials, but the effect used in BOTW seems to be more like a filter, that is applied to everything.
I've researched multiple examples that have been done in UE4 like here and here but nothing in Unity.
How would I apply something like this in Unity?

sentences:
Graphic Engine/Programming/Etc resources? Posting this question here rather than SO because of it's relevance with game development.

My dilemma is this: It is currently my summer vacation after my first semester of CompSci and I have learned enough C++ to actually get started in a little more advanced stuff.

I don't want to start games programming yet until I teach myself linear algebra, trigonometry, etc. However, I do want to know the fundamentals, the theory and the methods used in game programming!

I thought I had some decent books in the college library, but they were horribly outdated with books on game programming or game engines or game/graphic (topic here) from the early 90s to 2002.

Knowing the volatile state of computer technology, I figured grabbing knowledge on cutting-edge technology from a decade-old book isn't a good idea. Amazon itself leaves me clueless as to what book I want.

What I don't want:  A platform-dependent book. I'm not out to learn OpenGL, Direct3D or any specific API. I just want to know things like tessellation, how the GPU handles stuff, what goes on under the hood and what kind of raytracing and radiosity methods there are. The basics, the core concepts- those kinds of things.

I hope that's clear! Books, resources are all welcome. Though I much prefer a book over a website!

sentences:
Character coding / programming Lately I tryed a few times to create characters for some games, but at some certain point (especially when collision detection came in) everything became messy and the interaction between chars, the world and certain items had a lot of bugs. So here is my question, how do you ussualy keep track of actions that your character is allowed to do, or more in general do you have some links / advices how to set up a char efficiantly?

I´m working on a char right now, who should at least be able to run, jump, pick items up and use different fighting animations. Most ideas I came up with until now use some kind of action.priority / action.duration system to determain whats possible and what not, or a "action-manager" which defines for every action what is possible from that action on but it all doesnt work that well together.

sentences:
Data structure for bubble shooter game I'm starting to make a bubble shooter game for a mobile OS. Assume this is just the basic "three or more same-color bubbles that touch pop" and all bubbles that are separated from their group fall/pop. What data structures are common for storing the bubbles?

I've considered using an undirected, connected graph where each node is a bubble. This seems like it could help answer the question "which bubbles (if any) should fall now?" after some arbitrary bubbles are popped and corresponding nodes are removed from the graph. I think the answer is all bubbles that were just disconnected from the graph should fall. However the graph approach might be overkill so I'm not sure.

Another consideration for the data structure is collision detection. Perhaps being able to grab a list of neighboring bubbles in constant time for a particular "bubble slot" is useful. So the collision detection would be something like "moving bubble is closest to slot ij, neighbors of slot ij are bubbles a,b,c, moving bubble is sufficiently close to bubble b hence moving bubble should come to rest in slot ij".

A game like this could be probably be made with a relatively crude grid structure as the primary data structure. However it seems like answering "which bubbles (if any) should fall now?" would be trickier with this data structure.

sentences:
"Your android setup is not correct" error on Unity showing up even after reinstalling OpenSSL (Using Facebook SDK) I want to build for Android and today one error popped up after building.

  Your Android setup is not correct. See Settings in Facebook menu. UnityEditor.HostView:OnGUI()

Important things about this problem:

The only error in the inspector I can see is

  OpenSSL not found. Make sure that OpenSSL is installed and that it is in your path.

Even tho I have installed it and added it to my path

When I open the inspector in Facebook> Edit Settings, unity becomes very unresponsive
This error has not popped up before today
I still get a APK even if I get errors

sentences:
Does glScissor affect stencil and depth buffer operations? I know glScissor() affects glColorMask() and glDepthMask(), but does it affect the stencil and depth buffers?

For example:

glEnable(GL_DEPTH_TEST);
glEnable(GL_SCISSOR_TEST);
glEnable(GL_STENCIL_TEST);

glScissor(X,Y,W,H);

// Is this color mask set only for the scissor area?
glColorMask(TRUE,TRUE,TRUE,TRUE);
// Does this stencil function only work within the scissor area?
glstencilfunc(GL_ALWAYS);
// Does the stencil function only work within scissor area?
glstencilop(GL_KEEP,GL_KEEP,GL_KEEP);
// Is this depth  mask set only for the scissor area?
glDepthMask(GL_TRUE);
// Does this depth function only work within the scissor area?
glDepthFunc(GL_ALWAYS);

sentences:
Should my terrain be one big mesh or several medium ones? While creating a subterranean level with probuilder (irregularly shaped rooms and corridors), I was wondering if I should merge all "terrain" meshes into one or keep them as separate meshes? What are the good practices ?

I'm creating each room as I go and its not hard to create openings and align doors vertices (with progrids) but once I start moving them around (like with polybrush) I'm sure it will soon be a nightmare. I can see pros and cons for both. Separate meshes would be easier to edit, duplicate or replace, probably better performances but at the risk of overlaps or holes because it would get hard to keep connected cleanly. I guess with one mesh you take the risk of having it eat memory and computation time, or having it too big to edit easily.

I settled on each mesh consisting of a room and all half-corridors going out of it, to hide the stitching and keep it simple. Still I wonder if there's a consensus.

sentences:
SDL window crashes when mouse goes below a certain point I added code to check the rgb values of my surface, and whenever i call the function it seems to work fine! the only problem is that whenever the mouse goes under y = 400 the entire window crashes... Right now the program outputs the rgb color of the pixel on the screen, and when it goes below 400 one or all of the pixel values are 0, and then the program crashes. I have no ideas why this is happening. Any help is appreciated! Heres the github repo! https://github.com/jcsq6/SDLGame not much has been done except a couple classes to make my life easier in SDL :)

int* texture::getPixel(int x, int y){
    static int Color[4];
    SDL_PixelFormat *fmt;
    Uint32 temp, pixel;
    Uint32 *pixels = (Uint32 *)Surface->pixels;
    Uint8 red, green, blue, alpha;

    fmt = Surface->format;
    SDL_LockSurface(Surface);
    pixel = pixels[(y * Surface->w) + x];
    SDL_UnlockSurface(Surface);

    temp = pixel & fmt->Rmask;
    temp = temp >> fmt->Rshift;
    temp = temp << fmt->Rloss;
    red = (Uint8)temp;

    temp = pixel & fmt->Gmask;
    temp = temp >> fmt->Gshift;
    temp = temp << fmt->Gloss;
    green = (Uint8)temp;

    temp = pixel & fmt->Bmask;
    temp = temp >> fmt->Bshift;
    temp = temp << fmt->Bloss;
    blue = (Uint8)temp;

    temp = pixel & fmt->Amask;
    temp = temp >> fmt->Ashift;
    temp = temp << fmt->Aloss;
    alpha = (Uint8)temp;

    Color[0] = red;
    Color[1] = green;
    Color[2] = blue;
    Color[3] = alpha;

    return Color;

}

it's worth noting that when I call this function, the input y and x values are the mouse's position.

sentences:
Is it possible to retrieve shader function names associated with a technique pass using the DirectX Effect API? For example, given the pass

pass p0
{
    SetVertexShader(CompileShader(vs_4_0, VSFunction()))
    SetPixelShader(CompileShader(ps_4_0, PSFunction()))
}

Ss it possible to retrieve the names VSFunction and PSFunction? It doesn't look like any of the associated shader descriptors actually contain the name of the entry point.

sentences:
Use constant force to hold something in position This may actually be more of a Physics.SE question but since im doing this in Unity I figured I'd ask here.

I am playing around with the Constant Force component and have a sphere constrained with a linear configurable joint (y-axis free). With one key I apply a force in one direction to get it moving, but then when i press another key, I want to stop it and hold exactly in place by using an opposite force. So even if some other rigid body hits the sphere, it wont move until I remove a force.

Unfortunately, Unity doesnt allow more than one constant force on a gameobject (probably a good reason, not sure exactly) and I know if I do a net force, that it would just end up being 0, which would kind of work but the sphere would move if it gets hit.

Another thing I tried was to take the spheres current force and constantly flip it from positive to negative every FixedUpdate but that didn't seem to work at all.

I know the quick and easy way would be to just set velocity to zero, but I see tons of comments saying that modifying velocity directly breaks the physics, is bad form, etc. and I want to do this as properly as possible.

The best way I can describe what I'm trying to do is like that science experiment where you take a ping-pong ball and use a blower to push just enough air to counter gravity and the ball seems to hover in place. My only difference is that my constraint is side to side instead of up/down.

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 to handle MANY enemies in networked P2P game? Let's suppose a game of 4 players, one is the host.

They will fight many enemies, along the lines of 20-40 at the time. Among other things like sending their own state to the other players (position, rotation, shot this frame, crouched, etc). How do I handle the enemies?

Do the host "decides" the enemies state? (again position, rotation, isattacking, etc). And then sends several messages to the other players so they sync their own game? or do I "divide" the enemies, lets say 40, and 4 players, 10 enemies "controlled" by each player game? and then, each player sends those messages to the other players so all enemies are in sync?

Also, should I group the messages and send one big message instead of 40 little ones? How do I know how big can the message be (how many enemies info in each message)?

Basically I'm asking whats the best way to handle a 4 player p2p game with many enemies on screen.

Any good tip is appreciated.

sentences:
Vertex attributes with strides between them vs blocks of data Using opengl, does it make a difference if I upload plain vertex attribute structs, and then define the strides between them using glVertexAttribPointer, or if I do something like this

//we have position, texCoords, and normal vertex attributes
//allocate enough room for all attributes, set it to null for now
glBufferData(GL_ARRAY_BUFFER, positions.size() + normals.size() + textCoords.size(), NULL, BUFFER_USAGE);

//set positions data
glBufferSubData(GL_ARRAY_BUFFER, 0, positions.size(), positions.data());

//... call glBufferSubData for normals and texCoords as well

sentences:
Monogame render between constraints I have, in MonoGame, a project for which I require the game to not use the full screen depending on the resolution. The game elements etc all behave as they should (So they bounce off for example between 25% and 75% of the screen, instead of the edges). Yet I'm trying to draw a background between these two constraints, and it doesn't work.

To draw the background I am using the following code

spriteBatch.Draw(Background, new Rectangle(leftEdge,0,rightEdge,top),Color.White);

Yet when running the game, the image starts at "LeftEdge" but goes beyond "rightEdge". How would I go about scaling the image appropriately in this scenario?

sentences:
How simulate a random distribution? I'm working on a battle algorithm for a text-based game and I stumble when it comes to randomly distributing attacks on a set of units.

E.G, 100 archers shoot 100 targets at the same time. I thought of doing like this :

The 100 targets are considered as a single block
The arrows are distributed inside
The units hit the same number of times are grouped together.
I manage the life of each new group
Repeat on each new group if necessary

I can distribute the arrows (step 2) and get the result (step 3) through a loop, but with many armies composed of millions archers, computing time & memory consumption becomes a problem.

// Step 2
const targets = new Array( 1000000000 );
targets.fill( 0, 0, 1000000000 );
const arrows = 1000000000;
for( let i = 0; i < arrows; i++ ){
    const index = Math.floor( ( Math.random() * arrows ) );
    targets[ index ] += 1
}
//Step 3
const result = []
targets.forEach( value => {
    if( value ){
        if( result[ value ] ) result[ value ] += 1
        else result[ value ] = 1
    }
} )

Is there another way to solve this problem ? I believe that with large numbers, directly calculating the most likely scenario may be a good option. Unfortunately, I do not know anything about probabilities.

sentences:
Store temporary state in DB or not Background

I'm trying to implement a little MMORPG. I'm planning to use Cassandra DB for the database.

Question

I don't really understand which data should be store in DB and which one should be just kept in memory.

For example : the friend list. Friend list will be stored in DB, but what about connected / disconnected friends ? Should I keep in memory all connected account and access it directly ? Or should I store this information in the DB (therefore writing / reading quite often for something that could be kept in the memory) ?

sentences:
List of 2d action games with level editors Action game level design is hard. If you want to hone your skills at designing action game levels, the problem is that first of all you have to make a good game, with good controls, interesting enemies, not to mention all the more basic code like collision, rendering, and of course the level editor (okay, so you could use an engine for a lot of that, but it's still a lot of work). Even once you have that, if your game isn't any good, that'll hinder any potential practice you might get from designing levels.

So I'm looking for 2d action games with level editors. In addition to reducing your work load and allowing you to focus on level design, having a complete game means that you can play the professionally-made levels first and have something to compare your work to.

Personally I'm thinking of sidescrolling action/platformers, but 2d action includes any 2d game that is primarily execution-based, ie reflexes and knowledge of the controls. So, Super Mario Bros. counts as 2d action in this instance.

My own examples are on the PC, but console games are fine too (although I think PC games usually have better level editors, maybe that's changing though).

PS: I hope this question is acceptable, even though there's obviously no single right answer. I noticed there's no "big-list" tag here, but I've seen questions like this on other SE sites, and it'll be plenty useful to future readers, which is part of the point of SE questions.

sentences:
In Unity3D, what is the relation between inertiaTensor and inertiaTensorRotation? In unity3d there are two properties on rigidbody that correspond to the moment of inertia tensor.

One of them is: rigidbody.inertiaTensor, which I know is the diagonal of the inertia tensor,
The other is rigidody.inertiaTensorRotation, which I don't quite understand. I have, though, created a rigidbody in such a way that I get it to be other number than Quatenion.identity, but I still don't see the connection.

Can I describe the products of inertia tensor with the rotation or ... what is the relation between them and where would I require them?

sentences:
How to create a shining sun in OpenGL ES 2 (on Android) Let's say I created a space scene in OpenGL ES 2 similar to this one:

At the moment my sun is just a small texture similar to the one in the image that I place somewhere far, but it obviously looks very static. How would I make my sun shine & look alive?

EDIT: This is just an example image and all I care about is the sun. In my implementation the lighting and everything else is fine, but the sun itself (which is just a texture at the moment), doesn't "animate"/shine at all. I'm trying to find out how to make my sun shine and look like it's alive.

sentences:
UE 4.25 - Can't create EQS assets Like the title says I am unable to create EQS assets. I am running 4.25 and there is no option in the BT details panel, nor under "Add assets -> AI". AND there is no option to activate it. Neither under settings or under plugin. Nothing.
What am I doing wrong? See screenshots and thanks in advance

sentences:
Unity3D position of 2D objects with size of Object I'm making a 2D project in Unity3D.
I want to place an image in the right upper corner.
I've got this working, but ofcourse the image is falling of the screen for a part (and completely when I change the screenrotation).

This is the code I've got for it;

posImage = new Vector2(Screen.width - imgGear.transform.localScale.x, Screen.height - imgGear.transform.lossyScale.y );

As you can see in the code I've tried to adapt the position with the size of the object, using localScale 1.0f and lossyscale 0.9...f doesn't really do much as it will be changed with 1 unit.
Is their a way to get the real width and height of the objects?

sentences:
Controlling the draw order (z-index) through instancing? Is there any way that I can control in which order elements are drawn with instancing?

Do all elements get drawn in the same order they are added to the instance buffer?

Edit: What about the Z coordinate! Since I am drawing my GUI through this, I should be able to just put elements in front of others, right? I am not at home to try this out yet. I will keep the thread updated.

sentences:
Why are huge polygon amounts bad? It is always said that the polygon amount of a single modell must be as little as possible when it comes to realtime simulations such as computer games. (Or at least lower than when rendering a movie)
I am fully aware that this must be done in order to save performance. But aside from that information i cannot find why huge polygon amounts must be avoided.

(In Short: I know that polygons eat performance. I want to know why they eat performance)

So my question would be:
What happens when a frame is rendered? The polygons are surely somehow processed in the graphicard. What happens there?.
If possible i would like to have some links to sites containig this information.

sentences:
Is it possible to connect an external source machine to Live Link? I would like to be able to connect multiple external machines to Unreal Engine via Live Link in order to stream solved motion capture from one of the Vicon run-time solvers/retargeter (i.e. Pegasus). In one of the streams, it was mentioned that Vicon provides a client-side plug-in for Unreal that was used in the Siren demo. I decided to test Live Link's capabilities by connecting from a different machine to UE4 from Maya (I assume that the concept is the same regardless of the source program because at the end of the day we are sending solved animation data, right?). It turned out that Live Link in Unreal out-of-the-box only detects the incoming data from the source machine that is on the same computer where Unreal is running. I am curious as to whether it is possible to modify Live Link or build a custom plug-in using Live Link that would enable me to connect from an external machine to the engine over the network.

The whole topic is very new to me, but I am tasked with providing a solution, so any information would be appreciated. Please correct me if I misunderstand the process. If you know where to look for more details regarding the problem, please tell me.

sentences:
HLSL Buffer Data Type I'm working on converting a dx11 shader from a .fx file for use in Unity3D and I'm a little puzzled by the HLSL Buffer<> type declared in the shader. More specifically, what are these and how can I implement them in Unity? I'm aware of the Structured, Append, and Consume Buffers but those appear to be different then this and the Microsoft documentation wasn't to helpful. Is it just like an array that is populated and sized from code before getting assigned to the shader? Are they read only or writable as well?
So far I'm thinking the closest approximation I can use is a StructuredBuffer but the .fx file has its own declaration for that as well so I'm not entirely sure I should go that route.

Example:

Buffer<float4> g_someData : register(t18);

sentences:
What exactly makes up a screen in a typical C64 game? I'm trying to figure out the basics of C64 game development past BASIC, and I could use some advice on something very basic, but important: What is all that stuff on the screen actually, and how to draw it?

Take a look at Katakis/Denaris:

There are at least 9 different things on the screen:

The Score bar, with different fonts
The ship itself
A satellite attached to the ship, detachable
Secondary Weapon Projectiles
Primary Weapon Projectiles
Moving objects (can be enemy ships)
The Status bar, featuring an image of the ship, the number of lives and three sections that can fill
The primary weapon charge bar, can fill to the end
A scrolling starfield in the background
(not numbered on the screen) Solid objects like rocks or metal walls that are part of the background

The C64 only supports 8 sprites per horizontal scan line, so I don't think that everything in the middle of the screen can be a sprite? I would assume that anything requiring a collision would be a sprite (since I can get hardware collision detection with sprites), but even then I quickly hit the limit of 8 sprites. Also, my weapons can fire much more than one projectile - my ship, the satellite and 6 bullets would already be 8 sprites on a row (look at about 50 seconds into the video).

Also, which graphics mode would a game like this use? The Programming Handbook lists Bit Map Mode which essentially modifies screen memory directly. Is this the mode I should usually be working in? How would I compose all the non-sprite elements together to get them on screen?

A lot of the stuff in the score and status bar is static ("Area: 01" or the "frame"), so I guess I'll just populate them once when the level starts. Things that need updating - the score, the charge bars at the bottom - would be updated by filling the screen memory with black and then drawing the new score every frame?

Or do I have to draw the entire screen on every frame?

sentences:
How to get the physical camera sensor size on iOS / Android in Unity I'm trying to get the physical camera sensor size on iOS and Android mobile devices for intrinsics calculations.
On Android the sensor size should be found in the SENSOR_INFO_PIXEL_ARRAY_SIZE (Android CameraCharacteristics API). However I don't find a way to access that array via ArFoundation. I can imagine to write a plug-in for that, but I would also require a plug-in for iOS so I don't know if that's the right way to go.
Is there maybe another (easier) way to get the physical sensor size?

sentences:
How to set object's / node's absolute rotation correctly? Usually when I want to rotate an object/node in my Ogre scene I call the node's rotate() method. That rotates the node locally relative to it's current rotation. So for example, when I start with 0 rotation, then rotate twice for 5 degrees about one axis, then after the second call the object is rotated by 10 degrees in total.

Now I need to set the absolute rotation of the node/object directly, regardless of its current rotation. Thus, say I don't know the objects current rotation, I need to set it say to 45 degrees on the X axis. Something like setRotation().

I know there is a setOrientation() method in the SceneNode class, which expects a quaternion object. I also know that I can get the current orientation quaternion. What I don't know: how can I use/change this current orientation quaternion to set the new absolute rotation of the node?

PS: Crosspost at http://www.ogre3d.org/forums/viewtopic.php?f=2&t=77710

sentences:
libgdx UI coordinate consistency in a scaled window I'm having an issue that I'm sure boils down to something simple that I've missed: The UI Graphics can't handle a window resize. Either the graphics get stretched, or the placement is incorrect.

For now I'm working with just one UI element consisting of a Sprite, until i've gotten the project to render properly. Its position is defined in a Settings-class when the asset is loaded:

    touchpadBG = new Sprite(assets.get("ui/joystick_background.png", Texture.class));
    touchpadBG.setCenter(Settings.touchpadPositionX, Settings.touchpadPositionY);

... and drawn like so:

batch.setProjectionMatrix(gameCam.combined);
batch.begin();
// Draw the gameworld. This is done without any issues.

batch.setProjectionMatrix(uiCam.combined);
touchpadBG.draw(batch);

batch.end();

uiCam is defined like this:

    this.uiCam = new OrthographicCamera(Settings.windowSize_X, Settings.windowSize_Y);
    uiCam.translate(Settings.windowSize_X / 2, Settings.windowSize_Y / 2, 0);
    uiCam.update();
    uiViewport = new FitViewport(Settings.windowSize_X, Settings.windowSize_Y, uiCam);
    uiViewport.apply();

I've experimented with different viewports (and no viewport), and while correct placement happens at first, resizing the window will result in the UI element being drawn in the wrong position, stretched, or both.

I then suspected my resize/update methods being off, but I can't find anything wrong:

public void resize(int w, int h) {
    uiViewport.update(w, h);
    update();
}

public void update() {
    aspectRatio = (float)Gdx.graphics.getHeight() / (float)Gdx.graphics.getWidth();
    uiCam.update();
    gameCam.update();
}

Any ideas where I'm going wrong with this? If my post is missing a relevant part of my code, leave a comment, and I'll edit it in.

sentences:
Why is Camera turning with different speed than Player with same code in different scripts? (with unity) I want to integrate a running character in my game, so I downloaded an animation via Mixamo. The player is running and if I attach the camera directly to the Player, it's shaking the camera and the game is not playable. Therefor I made a different script for the camera. In there, the camera is always following the player but turns (like the player) via
float h = PlayerMovement.horizontalSpeed * Input.GetAxis("Mouse X");
transform.Rotate(0, h * Time.deltaTime * 60, 0);

(for the camera) and
float h = horizontalSpeed * Input.GetAxis("Mouse X");
transform.Rotate(0, h * Time.deltaTime * 60, 0);

for the player. (horizontalSpeed is a constant) But after a few seconds I'm running in a completely different way then I look. Why is that and how can I solve this?
I tried different animations - nothing worked.
Update: If there is no rigidbody and no collider attached to it it works fine. But I need them.

sentences:
Writing a shader once without using CG? Is there a tool that can convert a fragment shader from hlsl to glsl or glsl to hlsl? I do not want to use cg since it is not able to work on mobile platforms.

Is there a tool that can make it so I only write a shader once?

Thanks

sentences: How to find the bottleneck of the graphical pipeline I've been wondering about this issue for a while. How to find the bottleneck of the graphical pipeline. Recently I've been using a program to draw massive amount of polygons in a simple scene with alpha blending (AKA grass scene). I've used two programs, one uses static coordinates and another uses rotation and translation. Both run at 60 FPS with no other heavy processes running. But when I use them together (Two windows each having same amount of grasses and grass positions) the one that uses translation and rotation runs at 10 FPS but the other one is about 55 FPS. My question is why are both running @ 60 FPS and when such thing happens why does the second one(Rotation and translation of each grass) drop about 50 FPS but the second is still 55? Sounds like a bottle-neck to me. Please let me know if you have any idea, or in a more general answer if you have an idea or paper about finding bottleneck of GPU(or GPGPU), or optimizing the graphical code for running on GPU?

sentences:
Direct3D 12 can't create a swap chain I'm learning DirectX12 and I'm trying to create a simple application that clears the screen with a solid color, but I'm stuck in Direct3D initialization. I can't create the swap chain and the DXGI factory returns a nullptr. This is my initialization code:

bool Game::InitializeD3D()
{
ID3D12Debug *debug;
D3D12GetDebugInterface(IID_PPV_ARGS(&debug));
debug->EnableDebugLayer();

// hardware result returned by functions
HRESULT hr;

// create device
hr = D3D12CreateDevice(nullptr, D3D_FEATURE_LEVEL_11_0, IID_PPV_ARGS(&mDevice));
if (FAILED(hr))
    MessageBox(0, L"device creation failed", L"error", MB_OK);

// create fence
mDevice->CreateFence(0, D3D12_FENCE_FLAG_NONE, IID_PPV_ARGS(&mFence));

// query descriptor size
mRTVDescriptorSize = mDevice->GetDescriptorHandleIncrementSize(D3D12_DESCRIPTOR_HEAP_TYPE_RTV);
mDSVDescriptorSize = mDevice->GetDescriptorHandleIncrementSize(D3D12_DESCRIPTOR_HEAP_TYPE_DSV);
mCBVSRVDescriptorSize = mDevice->GetDescriptorHandleIncrementSize(D3D12_DESCRIPTOR_HEAP_TYPE_CBV_SRV_UAV);

// check for 4X MSAA quality level support
D3D12_FEATURE_DATA_MULTISAMPLE_QUALITY_LEVELS MSAAQuality;
MSAAQuality.Format = DXGI_FORMAT_R8G8B8A8_UNORM;
MSAAQuality.Flags = D3D12_MULTISAMPLE_QUALITY_LEVELS_FLAG_NONE;
MSAAQuality.NumQualityLevels = 0;
MSAAQuality.SampleCount = 4;
mDevice->CheckFeatureSupport(D3D12_FEATURE_MULTISAMPLE_QUALITY_LEVELS, &MSAAQuality, sizeof MSAAQuality);
mMSAAQualityLevels = MSAAQuality.NumQualityLevels;

// create command queue
D3D12_COMMAND_QUEUE_DESC commandQueueDesc = {};
commandQueueDesc.Type = D3D12_COMMAND_LIST_TYPE_DIRECT;
commandQueueDesc.Flags = D3D12_COMMAND_QUEUE_FLAG_NONE;
hr = mDevice->CreateCommandQueue(&commandQueueDesc, IID_PPV_ARGS(&mCommandQueue));
if (FAILED(hr))
    MessageBox(0, L"command queue creation failed", L"Error", MB_OK);

// create command allocator
mDevice->CreateCommandAllocator(D3D12_COMMAND_LIST_TYPE_DIRECT, IID_PPV_ARGS(&mCommandAllocator));

// create main command list
mDevice->CreateCommandList(0, D3D12_COMMAND_LIST_TYPE_DIRECT, mCommandAllocator, nullptr, IID_PPV_ARGS(&mCommandList));
static_cast<ID3D12GraphicsCommandList*>(mCommandList)->Close();

// create the swap chain
DXGI_MODE_DESC mode = {};
mode.Width = mWindowWidth;
mode.Height = mWindowHeight;
mode.Format = mBackBufferFormat;
mode.RefreshRate.Numerator = 60;  // 60 Hz refresh rate
mode.RefreshRate.Denominator = 1;
mode.Scaling = DXGI_MODE_SCALING_UNSPECIFIED;
mode.ScanlineOrdering = DXGI_MODE_SCANLINE_ORDER_UNSPECIFIED;
DXGI_SWAP_CHAIN_DESC swapChainDesc = {};
swapChainDesc.BufferCount = bufferCount; // double buffering
swapChainDesc.BufferUsage = DXGI_USAGE_RENDER_TARGET_OUTPUT;
swapChainDesc.BufferDesc = mode;
swapChainDesc.OutputWindow = mWindow;
swapChainDesc.SampleDesc.Count = 4; // 4X MSAA
swapChainDesc.SampleDesc.Quality = mMSAAQualityLevels - 1;
swapChainDesc.SwapEffect = DXGI_SWAP_EFFECT_FLIP_DISCARD;
swapChainDesc.Windowed = true;
swapChainDesc.Flags = DXGI_SWAP_CHAIN_FLAG_ALLOW_MODE_SWITCH;

hr = CreateDXGIFactory1(IID_PPV_ARGS(&mFactory));
if (FAILED(hr))
    MessageBox(0, L"factory creation failed", L"Error", MB_OK);

hr = mFactory->CreateSwapChain(mCommandQueue, &swapChainDesc, &mSwapChain);
if (FAILED(hr))
    MessageBox(0, L"swap chain creation failed", L"Error", MB_OK);

// more init code
......

My main window is created and the message box appears saying that the swap chain creation failed and Visual Studio raises an access violation exception.
What am I doing wrong?

sentences:
Problem, why the mouse cursor position is totally wrong, after resizing the window? I come here, because i'm trying to add some "menu" interface in my small XNA Game . I found on internet a nice library adviced by many devellopers. Till now everythink is ok, the problem is my C# code logic. I try to allow the player (user) to change the screen resolution . The resolution and screen are both of them change . The problem is about the "cursor" of my computer mouse . It's really weird, i don't why but the cursor of my mouse does not select the right elements .It's look like a gap persisted between the old window.

Here is the code i use, as you can see , very simple. And should be normally work. I hope you have some idea why . I'm lost :'(

void btnApply_Click(object sender, Controls.EventArgs e)
{
  Manager.Graphics.IsFullScreen = chkResFull.Checked;

  //Resolution set by default
  int w = 1024;
  int h = 768;

  if (rdbRes1024.Checked)
  {
    w = 1024;
    h = 768;
  }
  else if (rdbRes1280.Checked)
  {
    w = 1280;
    h = 1024;
  }
  else if (rdbRes1680.Checked)
  {
    w = 1680;
    h = 1050;
  }

  Manager.Graphics.PreferredBackBufferWidth = w;
  Manager.Graphics.PreferredBackBufferHeight = h;

  Manager.Graphics.ApplyChanges();
}

Here is the screen shot of my original screen ( 800/480 )

Here is the screen shot after change to the screen resolution ( 1280/860 )

sentences:
Simulating water droplets on a window How do I simulate water droplets realistically falling, gathering, and flowing down a window? For example, see http://www.youtube.com/watch?v=4jaGyv0KRPw. In particular, I want to simulate how smaller droplets merge together to form larger droplets that have enough weight to oppose the surface tension and flow downward, leaving a trail of water.

I'm aware of fluid simulation, but how would it be applied in this situation?

sentences:
Supercover line algorithm from corners instead of the square's center? I need to check whether a cell in a 2D grid is visible to the starting cell. I'm currently using amit's supercover line algorithm, this one https://www.redblobgames.com/grids/line-drawing.html#supercover
The algorithm works but I need  the cells that are intersected by the top-left corner-to-corner line instead of the center-to-center.
This shows what I mean:

The green square is the start point and red is the end point
The white dots represents the cells that are visited by the line drawing algorithm I'm using
I want to get the cells that are intersected by the blue line. It's drew from the top-left corner of the start cell to the top-left corner of the end cell.

This is my implementation of the amit's algorithm in gdscript
func _line_of_sight(p0, p1):
    var dx = p1.x - p0.x
    var dy = p1.y - p0.y

    var sx = 1 if dx > 0 else -1
    var sy = 1 if dy > 0 else -1

    var p = Vector2(p0.x, p0.y)
    _points.append(p)

    var x = 0
    var y = 0
    var nx = abs(dx)
    var ny = abs(dy)

    var result = true
    var blocked_cells = _tilemap.get_used_cells()

    while x < nx or y < ny:
        var px = (1+2*x) * ny
        var py = (1+2*y) * nx

        if px == py:
            p.x += sx
            p.y += sy
            x += 1
            y += 1

        elif px < py:
            p.x += sx
            x += 1
        else:
            p.y += sy
            y += 1

        if blocked_cells.has(p):
            result = false

        _points.append(p)

    return result

I've also tried Bresenham's line algorithm and the Bresenham supercover modification, this and this, as well as this, but none did the trick
Any insight would be appreciated - thanks in advance!

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:
How do you reference one game object from another? I am trying to reference a game object that was created in the editor and added to the scene (not created dynamically).  How can I reference this object in a script added to another gameobject?

For example I have a Mesh called QuantumCold_B (in the editor), and I try to get its position in a script to be added to First Person Player, but instead I get

  Unknown identifier ('QuantumCold_B').

Here is my script:

function Update () {
   transform.RotateAround(QuantumCold_B.position, Vector2,20 * Time.deltaTime);
}

Also is position the right way to get the Vector position on QuantumCold_B?

sentences:
How to design programatically a game map like Risk? I'm making a quiz-game based on map territories with a system similar to the Risk game (except there are no tanks but tickets).

The map isn't the world but a custom map that I designed and I'll finish in the future, I just made the logic links among territories.

There are 10 territories who represent 10 different matters. The game I'm developing is for Android (Java), but I'm writing a prototype of the map in C# with Visual Studio to see if the idea of the map is good.

Now, I'm not asking for C# code to use in my app, I'm asking for a programming strategy I should use to implement my map in Code.

I wrote the class Zone to define each territory. I also wrote the class GameMap which implements 10 different Zones.

In the game logic, it's expected that just as risk, to attack 1 territory, you must have one near it. How can I implement at best this concept, of near and far territories in a dynamic and not long-static way?

The final result of what I want would be: I decide which territory attack in order to my owned territories. How can I proceed being as much as dynamic as I can and not write really long and in-efficient code?

EDIT: I'm no more looking for C# help. I'm directly implementing the map in Java and Javascript in both Client and Server sides.

sentences:
(web game) text-based combat system shows progress to client instead of give a report at the end I am developing a text-based multiplayer-RPG using React and dotNet core. The fight logic is handled on server side. Basically what fight() does is:

a while loop that iterate 100 times; in each iteration the characters attack each other; actions are stored in a string list
a winner is determined either at the end of the while loop or one's hp is below 0
write the fight result and rewards into database
send response back to client with the combat log (that string list)

This is what the fight() basically does. Players clicks fight and get the result and the report instantly. I would like to make the fight more engaging to the players by showing the fight's progress in each round (and add time interval between rounds).
I don't know how to achieve this. I would appreciate any ideas you share.
I could let the client side see a "replay" of the fight using the response from the server, but that's not what I want. Maybe this is something other idle games are doing. I don't know since I don't have much experience of game developing.

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:
How to handle materials in an Entity/Component system My E/C implementation is the basic one where Entities are just ID's, Components are data and Systems act on the Data. Right now I'm having trouble with object materials and rendering in general. For simple objetcs I have a ModelComponent, tied to a RenderSystem, ModelComponent has the vertex buffer ids that the render system uses. A simple MaterialComponent would probably have color or specular strenght, etc, but I wanted it to be flexible enough to allow for more than one render pass and general "effects" that are not as easy as a simple variable in the MaterialComponent.

Trying to solve these problems I came up with two solutions:

1 - Super-generic Material Component

Something like this:

struct Material : public Component
{
    ShaderData* shader;
    std::vector<std::pair<std::string, boost::any>> uniforms;
    [...]
};

and in the render system I would loop and pass the uniforms to the shader. I suppose this would be slow, but fast enough for my purposes.

2 - Another layer of abstraction, MaterialData

Having a class to wrap specific materials, that could be inherited by whatever specialized  material, the base class would have something like void set_shader_constants(ShaderData* d) but the implementation is up to each class, and the MaterialComponent would have a pointer to a MaterialData object.

I'm not sure which approach I would prefer, but neither of these touch the subject of multiple passes, or other complex rendering techniques.

Any idea on how to accomplish this?

sentences: How to make Pong Ball Control? I want to know how can I make the control of the Pong Ball in Plain Javascript. I would like to know how to make the ball faster when it hits the edges just like the original pong game, or how if the ball hit's the middle of the paddle it would go straight and slow. I just want to get a feel for how it works.

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:
How to set rotations to 0,0,0 in 3ds max for exporting in unity? I'm a modeler in 3ds max and the unity programmer ask me that the object must have:

pivot with Y up
rotations at 0,0,0

but every object that I export in fbx he says don't have rotations at 0,0,0.
I tryed different solutions as:
- reset xform
- freeze rotation
- rotation to zero
- $.rotation = eulerangles 0 0 0

but in unity he have values like this
[4.577637e-05, -1.525879e-05, 0] or [-90, 1.525879e-05, 0] and so on

It's a problem that can I fix in max or the programmer has to fix it in unity?

Thanks

sentences:
What is the most efficient method of creating a detailed 3d tileset in a 3d game that uses a grid? Well, the most efficient method might be with how minecraft does the terrain by using a single block for a single grid, but one thing I am concerned about is that the method minecraft uses is poorly mixed near the edges where 2 different blocks meet. I would like the blocks to mix together nicely, similiar to how modern 2d games does their tiles.

I had some thoughts.

Perhaps one could adjust the alpha of the texture so that it blends well near the end? So at the edge, between 2 different blocks type, both of the blocks would exit where 1 of the block would be alpha-blended together with the other block based on the priority value of the block.

That's the idea I have currently but I have some doubts about it.

If there's any inquiry about my question feel free to ask.

Edit: Well, even though I use minecraft as an example, it's not a sandbox game, it's just I would like to use a grid style of terrain that some 2D game uses even when it's not sandbox (e.g. Mark of the Ninja) but in a 3D environment instead. An efficient method of doing that is concerned.

sentences:
How do I write an interface for the keyboard and mouse input? I have started to develop a simple 3D engine. I use OpenGL for rendering, and it is developed for Windows. It is all written in C.

How do I write an interface for the keyboard and mouse input? I would like to keep it as simple as possible - in contrast to the native Win32 input system.

sentences: GLFW window becomes unresponsive when asking for input! I am trying to write a simple C++ game using OpenGL. In my render loop i ask for text based input from the user but this causes the GLFW window to become unresponsive. I suspect that this happens because the window does not like it when the main thread is paused from std::cin so it behaves weirdly. If i remove the input prompt the window behaves perfectly. Can someone confirm if this is the case and what workarounds are there to fix it?

sentences:
Frog-Lilypad Animation: Animate Unity2D Tilemap based on Player position I'm developing my first Unity game, involving a frog jumping on lilypads. As the frog leaves a lilypad, I would like it to sink beneath the surface. Here's what I have currently, with the lilypads as static tiles:

What would be the easiest way to do this? I know how to make an animation, but I'm not sure how to get each LilypadTile to be aware of the player's position, and trigger the animation/state change as the player leaves the LilypadTile. I don't even think Tiles have an Update() function, so am I approaching this correctly? Should I instead make my lilypads be Sprites?

Are there any good written references or example documentation regarding common Unity workflows/organization? I'm tired of watching long YouTube videos for each piece of information I need.

sentences:
How to Make UI Open and Close on Keypress I've been working on a 2D RPG and have been trying to make a script that will open or close the public UI element that is selected in properties. I don't receive any errors, but I do receive a warning that says:

Assets\Scripts\KeyManager.cs(7,18): warning CS0414: The field 'KeyManager.activeUI' is assigned but its value is never used

Here's the script that is connected to my canvas:
using UnityEngine;
using System.Collections;
using System.Collections.Generic;

public class KeyManager : MonoBehaviour
{
    private bool activeUI;
    public GameObject UI;

    void Start()
    {
        activeUI = false;
    }

    // Update is called once per frame
    void Update()
    {
        if (Input.GetKeyDown(KeyCode.I) && (activeUI = false))
        {
            activeUI = true;
            UI.SetActive(true);
        }

        else if (Input.GetKeyDown(KeyCode.I) && (activeUI = true))
        {
            activeUI = false;
            UI.SetActive(false);
        }
    }
}

sentences: How do I create a circular progress bar in Unity3D 5? I am new to programming and Unity3D. I want to show a circular progress bar starting invisible and growing in 3 seconds to a circular line when reloading is done. How can I do that?

sentences:
The state that is synced when a window is broken in a FPS game In order to better understand how state syncing works in games, I wanted to pose a specific example. Say you are in a FPS game with multiple players and someone breaks a window in some building. Wondering what happens in terms of state syncing. For example, there are these aspects:

Someone else is watching the player break the window in the game. So it should probably be a real-time update.
Someone isn't watching but they hear the sound of the window breaking.
Someone is out of range of hearing or seeing the window break, so wondering if it still updates their game world, or it somehow lazily picks up the changes when they go to the area with the broken window.

Wondering how it generally works in these different scenarios. Any FPS game is fine. For example, in (1), if they are sending each individual particle of broken glass over the internet, or somehow they just send the generic action "user x threw object y at window z" and it replays the action on everyone's computer who is watching. In which case somehow the game world is broken up into macro chunks rather than being composed of particles. In (2), maybe they divide the level into zones of seeing and hearing range, and somehow send just the right amount of state then (wondering what kind of state, and how much). Then in (3), if it is lazily picked up, then what sort of queue is kept on the backend. If the data is compressed when it is sent, etc.

sentences: What is the game design lingo for the computer's ability to render shiny water? What is the game design lingo for the computer's ability to render shiny water? I am new to game design and I'm trying to write a formal paper to a colleague.

sentences:
How to Stop Background Music When The Game is Over? I am working on a 2D Angry Birds type Unity game. I Created Menu Scene and Level One Scene and all the required scripts are added. After adding background music to Level One, when the game is over and return to Menu I can't stop the music. The Menu scene has its own music and when the level one is over, it continues with its own music and gets mix with the menu scene music. I tried to add Destroy() function to level one GameObject but Level One music became silent after I restart with my menu scene. Here is my code for the attached music game object:

public class background_sound : MonoBehaviour {
    public static bool soundBreaker = false;

    public void Start () {
        if (!soundBreaker) {
            AudioSource myAudio = GetComponent<AudioSource> ();
            myAudio.Play ();
            DontDestroyOnLoad (myAudio);
            soundBreaker = true;
        }
    }
}

And here is the Menu Script:

public class MenuScript : MonoBehaviour {

    public void StartGame () {
        SceneManager.LoadScene ("Level One");
    }
    ...

Here is the code that loads the Menu Scene..

public void GameOver() {
    musicObject.setActive(false);
    startCoroutine(restTime());
}

IEnumerator restTime() {
    yield return new WaitForSeconds (3);
    SceneManager.LoadScene("Menu");
}

sentences:
glVertexAttribPointer stride GL_INVALID_VALUE opengl 3.3 I'm experiencing issues similar to described in this question, which was never answered. Basicly when I'm calling

glVertexAttribPointer

with stride greater than this exact value: 640. OpenGL GL_INVALID_VALUE error is raised. According to documentation such an arror can be raised in one case:

  GL_INVALID_VALUE is generated if stride is negative.

Which is obviously not my case.

In OpenGL 4.4 the maximum value is specified and set to GL_MAX_VERTEX_ATTRIB_STRIDE according to this site

Is there a certain magic number in older versions of OpenGL (3.3 in my case) for a maximum vertex stride? Is there any other reason that this function can raise GL_INVALID_VALUE?

sentences:
same 8bit created surface resulting in a different pitch value Given:
const int w = 10;
const int h = 10;
const int d = 8;
uint8_t* pixels = new uint8_t[w * h]

SDL_Surface* src = SDL_CreateRGBSurfaceFrom(pixels, w, h, d, w, 0, 0, 0, 0);
SDL_Surface* dst = SDL_ConvertSurface(src, src->format, 0);
// src->pitch == 10;
// dst->pitch == 12;
//std:: cout << src->pitch == dst->pitch << std::endl;

My expected result is that the two pitches must match.
In this case I have the "weird" 12 pitch value for the dst image create from the src.

Is that due to memory alignment optimization?
Is there any reasonable explanation about it?
Are those padding bytes used somehow or just wasted?

sentences:
Writing a leather shader I'm trying to write a leather material shader. I have a normal map, bump map (grayscaled), specular map, diffuse map, cube maps.

I have done the following

#version 100

precision highp int;
precision highp float;

uniform sampler2D diffuseColorMap;
uniform sampler2D ambientOcclusionMap;
uniform sampler2D normalMap;
uniform sampler2D specularMap;
uniform sampler2D bumpMap;
uniform samplerCube envMap;

varying vec2 texCoord[2];
varying vec3 viewWorld;
uniform float reflectionFactor;
uniform float diffuseFactor;
uniform float opacity;
varying vec3 eyeVector;
varying mat3 world2Tangent;
varying vec3 lightVec;
varying vec3 halfVec;
varying vec3 eyeVec;

void main()
{
    vec3 normal = 2.0 * texture2D (normalMap, texCoord[0]).rgb - 1.0;
    normal = normalize (normal);

    // compute diffuse lighting
    float lamberFactor= max (dot (vec3(0.0,0.0,1.0), normal), 0.1) ;

    vec3 bumpNormal = texture2D(bumpMap, texCoord[0]).rgb;

    vec3 normalWorld = normalize(world2Tangent * bumpNormal);
    vec3 refDir = viewWorld - 2.0 * dot(viewWorld,normalWorld) * normalWorld;

    vec4 diffuseMaterial = texture2D (diffuseColorMap, texCoord[0]);
    vec4 diffuseLight  =  vec4(1.0,1.0,1.0,1.0);

    // In doom3, specular value comes from a texture
    vec4 specularMaterial =  texture2D (specularMap, texCoord[0])  ;
    vec4 specularLight = vec4(1.0,1.0,1.0,1.0);
    float shininess = pow (max (dot (halfVec, normal), 0.0), 2.0)  ;
    vec4 reflection = textureCube(envMap, refDir);

    gl_FragColor=diffuseMaterial * diffuseLight * lamberFactor ;
    gl_FragColor+=specularMaterial * specularLight * shininess ;
    gl_FragColor+= reflection*0.3;
 }

The result is shown:

My question is how would I use the bump map (Grayscale) to the result of the reflection or what's wrong in my shader ?

sentences:
Accelerometer input for flying game I'm trying to create an infinite flying game where the gameobject (a plane) keeps moving forward and at a particular height throughout the game. I want to be able to
roll and pitch the plane but not move it up/down. I added a rigid body to the plane and selected "y" position constrain. However the plane doesn't stay in the 'y' position but starts move up or down. I just have a script that translates the plane in the z direction. Not sure how to implement the mobile input and keep at the same "y" position throughout.

Update

Here is the code for the plane. Its very basic as I'm not sure how to use the accelerometer:

public class Player : MonoBehaviour {

public float speed = 1.0f;

void Update () {
    float tempx = Input.acceleration.x;
    float tempy = Input.acceleration.y;
    float tempz = Input.acceleration.z;
    transform.Translate(0, 0, 10); // move forward in z
    transform.Rotate( 0,  tempy * speed, tempz * speed);
}

As for the freezing of the 'y' position, I'm just selecting the y constraint available in the inspector that comes along with the rigidbody.

sentences:
How can I move an object over a drawn tile map in HTML 5 without constant buffering? I've been messing around with HTML5 for quite some time now but this is something that I guess I haven't figured out how to handle well yet. I'm sure there's an extremely easy solution and I just haven't opened my eyes to it but anyway.

The problem is thus: I have an HTML5 canvas on which I've loaded image tiles using a function (called once on page load) which sets up an image object called imageObj, and on imageObj.onload, it draws the image that I want it to draw at the specific coordinates.

Now, I generally always run my main canvas game code in a setTimeout that runs at 30 frames per second. I have a separate function which checks what keys have been pressed and stores them in an array (to account for multiple key presses), and if arrow keys are pressed, then global variables that store the player's x and y position are incremented/decremented accordingly.

Now, in the setTimeout loop, here is where i draw a small rectangle with the x and y coordinates as that of the player x-and-y variables. However here is where I have the problem.

I do not refresh my canvas in the sense, I do not clear the screen or put a new black background covering the screen at the beginning of each frame, because then I would have to reload the tilemap and that's incredibly slow on my localhost, and would be even more so online.
Furthermore, since I do not clear the screen, the rectangle of the player is leaving a trail of rectangles behind it (i.e, all previous instances of its position have a rectangle in its place)

How do I handle this? How do I manage dynamic objects over the tile map and refreshing the canvas without having to constantly reload the tile map? (or reloading the tile map in some smart way. I believe there are certain methods such as drawing the next frame beforehand or as such; I'm not too sure)

Edit: I'd rather not use any third party apis or libraries or game engines, bit of a purist that way. Also, just occurred to me, what if I had 2 canvases back to back? One with the tile map and the other containing the objects?

sentences:
How to avoid the collision of objects that move along a path? There are 2 cars (same object) that go through a circuit:

Consider that the white part is an intention that they avoid (it would be as if it were a wall). The black part (circuit) would be just illustrative, it is not an object.
In the program the room looks like this:

Green -> background
Red square -> car
Other light colored squares -> points that are followed by the cars (to go through the circuit)
Black square -> wall

The walls are avoided as follows:
mp_grid_add_instances(grid,obj_Wall,false);

In addition to the walls, I would like cars to avoid each other. I did it as follows:
repeat(instance_number(obj_Car)){
    i++;

    if(instance_find(obj_Car,i-1).id!=id){
        carOtherID=instance_find(obj_Car,i-1).id;
        mp_grid_add_instances(grid,carOtherID,false);
    }
}

It happens more or less like this:

Cars avoid the starting position of other cars, but I would like you to avoid the current position of other cars. For that, I put this part of the code in the step event:
mp_grid_add_instances(grid,carOtherID,false);

I tried some changes, with some conditions, but none worked. Simply buggy, cars even go through walls (something that shouldn't happen, because I don't even change anything in them).
Documentation:
https://manual-en.yoyogames.com/#t=GameMaker_Language%2FGML_Reference%2FMovement_And_Collisions%2FMotion_Planning%2Fmp_grid_path.htm&rhsearch=mp_grid_path&rhhlterm=mp_grid_path

sentences:
Blending vs Texture Sampling Lets say I want to blend two textures together:

A texture containing the result of the SSAO calculation.
A texture containing the rendered scene.

I could do it in two ways:

Use a shader that samples both the SSAO and scene textures, blends them together and outputs the final color to a render target.
Render to the texture containing the scene and use a blending mode to blend the SSAO texture on top of it. Only the SSAO texture will be sampled inside the shader.

Is it possible to give a general answer about which version is faster, or is it highly hardware dependent?

sentences: Is there a way to make a dynamic world such as a MMORPG horizontally scalable? Imagine a open-world of 500+ players with data changing as fast as 20 updates/player/second. Last time I worked in a similar MMORPG, it used SQL, so obvioulsy it couldn't query the DB all the time. Instead, it loaded all players from the DB to memory as C++ objects and used them. That is, it scaled vertically. Would it be possible to make that server horizontally scalable instead? Is there a database designed to support that amount of updates concurrently?

sentences:
Is there any popular AI game engine? Is there any sophisticated game AI engine that can save time on AI implimentation and provides strong and clever AI? The game genre is strategy, so AI should be strong. The game in some aspects is similar to the starcraft. So we can use it as good example. As for me SC2 game AI is is very weak. When I played it, I quickly found very simple strategy line with help of it which could win in 100% of cases for any race. After that it was not interesting to play. So I want stronger AI, and AI that can learn. I don't like deterministic algorithms.  I can accept some good end state machine algorithm, but good implimentation of such algos requare long time and testing. And all of such algos in stratgies are week and not interesting once the player has found weaknesses.

I can try to impliment AI by myself using neural networks, genetic algo or something like that.. but that will requare even more time.

So I am interesting in some ready sophisticated game engine, that would be easy to train and adjust under myself. I looked and found only http://alive.sourceforge.net/ ... it not looks very populat, fast and sophisticated.

(The game is openGL/C++. I have enaph free processor resources for AI)

sentences:
How to simulate camera turbulence for in-game cinematics Are there any good algorithms for generating a convincing turbulence effect that can be applied to an in-game camera.

For example, in use cases such as the viewpoint of a plane flying low and fast over a landscape.

sentences:
model view projection multiplication order I'm debugging a lighting problem where the camera position is effecting the diffused lighting component on my 3d model. In researching my problem I went back and am reading over all the how to documents. I found that one of my old sources (where I learned open gl 2.0) said this (summarized):

  When creating the modelViewProjection matrix you can't change the order or you'll get unexpected results.  First take the View Matrix and post-multiply it by the projection matrix to create a viewProjection matrix. Then post-multiply the model matrix to get the modelViewProjection matrix.

Looking at my code, all this time I haven't been doing this:

matrixMultiply(mView, thisItem->objModel, mModelView);
matrixMultiply(mProjection, mModelView, mModelViewProjection);

As a test I tried changing it to this:

matrixMultiply(mView, thisItem->objModel, mModelView);
matrixMultiply(mProjection, mView, mViewProjection);
matrixMultiply(mViewProjection, thisItem->objModel, mModelViewProjection);

...but the result appears the same.

EDIT: To answer a question about what the matrices contain. A snapshot of the matrix values:

EDIT2: As a test I did the math both ways to compare the results and even with moving the camera and model around and rotating the model I'm getting the same results for the final ModelViewProjection.

sentences:
Smoothing edges on procedural terrain Using perlin noise to create a procedural island for a tile-based game. My map is stored in a 2d array, with each tile having a type (deep water, shallow water, beach, grass, forest, hill, mountain).

What would be the most efficient way to go through my map, after it's generated, and smooth out the edges of the terrain? Using a tileset, we run into issues with a 1x1 tile that sticks out by itself.

sentences:
Unity Events executed out of order According to this page Events in unity are suppose to execute in a specific order.  Specifically, OnCollisionEnter is supposed to be called right after OnTriggerEnter; however, FixedUpdate and Update are both being called at least once in between calls to my OnTriggerEnter2D and OnCollisionEnter2D functions in my Enemy class, why is this the case?

Here is my code:

public class Enemy : Combatant
{
public int kill_points;
public float force;
public List<GameObject> path_verticies;
private int pathi;
private bool on_path;
private bool is_flying;
private bool ignore_collision;          //Used for ignoring collisions with walls, if the enemy has already touched an enemy_controller.

void Start ()
{   Init();
    pathi = 0;
    ignore_collision = false;
    is_flying = false;
    if (gameObject.tag.Contains("Fly")) is_flying = true;//Assuming contains is cheaper than a full string compare.
    on_path = null != path_verticies && 0 != path_verticies.Count;
}

private void FixedUpdate() { ignore_collision = false; }

void Update ()
{   if (!CheckBounds()) Destroy(gameObject);
    if (on_path)
    {   transform.LookAt(path_verticies[pathi].transform, Vector3.up);
        transform.Rotate(new Vector3(0,-90,0));
        phys.velocity = transform.right * speed;
    }
    else dx = Mathf.Sign(Cx) * speed;
}

public void Flip(){ Cx *= -1; }

#pragma warning disable CS0642 // Possible mistaken empty statement
private IEnumerator OnCollisionEnter2D(Collision2D collision)
{   if (on_path && path_verticies[pathi] == collision.gameObject)
    {   if (collision.gameObject == player)
        {   throw new System.NotImplementedException();
            yield return new WaitForSeconds(0.1f);//Used to prevent damage to the player if the player landed on top of the enemy.
            var atk = player.GetComponent<Combatant>().vigor.Attack(2);
            if (Health.Atk.DIES == atk) player.GetComponent<Life>().Die();
        } else pathi = (pathi+1) % path_verticies.Count;
        yield return new WaitForSeconds(0.0f);
    }
    else if (on_path)
    {   if (collision.gameObject == player)
        {   yield return new WaitForSeconds(0.1f);//Used to prevent damage to the player if the player landed on top of the enemy.
            var atk = player.GetComponent<Combatant>().vigor.Attack(2);
            if (Health.Atk.DIES == atk) player.GetComponent<Life>().Die();
        } else if (collision.collider == On(Truebounds)) /*nothing*/;
        else if (collision.gameObject.layer == 0 || collision.gameObject.layer == 8)// TODO
            /*take velocity in the direction opposite of the normal and add it to
             * the perpendicular component the enemy is moving in*/;
        yield return new WaitForSeconds(0.0f);
    }
    else
    {   if (collision.gameObject == player)
        {   yield return new WaitForSeconds(0.1f);//Used to prevent damage to the player if the player landed on top of the enemy.
            var atk = player.GetComponent<Combatant>().vigor.Attack(2);
            if (Health.Atk.DIES == atk) player.GetComponent<Life>().Die();
        } else if (ignore_collision) /*nothing*/;
        else if (collision.collider == On(Truebounds)) { if (is_flying) Flip(); }
        else if (collision.gameObject.layer == 0 || collision.gameObject.layer == 8) Flip();
        yield return new WaitForSeconds(0.0f);
    }
}

private IEnumerator OnTriggerEnter2D(Collider2D collider)
{   var component = collider.GetComponent<MonoBehaviour2>();
    if(!component) yield return null;
    else if (on_path && path_verticies[pathi] == collider.gameObject)
        pathi = (pathi+1) % path_verticies.Count;
    else if (on_path) /*nothing*/;
    else if (component.type == typeof(Enemy_Controller)) { Flip(); ignore_collision = true; }
    yield return null;
}
#pragma warning restore CS0642 // Possible mistaken empty statement

//public void OnDestroy(){  }
}

and these are my timestep settings:

sentences:
Why does Unity use HLSL instead of GLSL? I am beginner in shader programming. I got my introduction (few minutes ago) to shader programming via Unity.

I didn't know what HLSL was. So, I Googled and found this post:  Difference b/w HLSL & GLSL

I can't understand one thing. Unity was initially developed for OSX & introduced at WWDC. Also DirectX is windows only API & HLSL is the shader programming language for DirectX. However, Unity3D for OSX is written in OpenGL. OpenGL uses a standard shader programming language called "GLSL".

So, I'm confused how Unity3D uses HLSL on OSX & why Unity didn't pick GLSL instead of HLSL.

  NOTE: I might be wrong somewhere. So please correct if something is wrong as I told I'm a beginner

sentences:
Why do my animations need to be marked as "legacy?" I'm in the beginning of a project and I'm not really using 3D models but rather a hierarchy of primitive shapes. I made a couple of animations that suddenly don't work anymore. I get an error about that I need to mark them 'legacy'.

I came across this suggestion to mark them as legacy in the rig tab via the model, but I'm not using a model so that doesn't help.

I don't understand how the animations that I made in Unity yesterday don't work today? What is this legacy problem?

sentences:
How do I use Unity's TargetRPC calls? Trying to send data from the server to a client I want to send a large amount of data to only one player, as it would be wasteful to do this for every player when only one player needs the data. After a bit of research, it appears that TargetRPC is the thing that I want to use. Unfortunately, TargetRPC was only introduced semi-recently in Unity 5.4, and I have not been able to find a guide on how to use it properly.

Here is a barebones version of my attempt so far:

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

public class TargetRpcTest : NetworkBehaviour {

    private List<NetworkConnection> finishedConnections = new List<NetworkConnection>();

    void Start () {
        // We don't want to send data to ourselves.
        finishedConnections.AddRange(NetworkServer.connections);
    }

    void Update () {

        // If we're not the server, we don't have any business in sending data to players.
        if (!isServer) {
            return;
        }

        // Do the code contained below for everyone we haven't done it for yet.
        foreach (NetworkConnection connection in NetworkServer.connections) {
            if (!finishedConnections.Contains (connection)) {

                TargetSendStuff (connection);
                finishedConnections.Add (connection);
            }
        }
    }

    [TargetRpc]
    public void TargetSendStuff (NetworkConnection connection) {
        print ("I've just received a target RPC call!");
    }

}

This code is all I could come up with, and it does compile properly. No errors are thrown on the server side, either. However, when a client connects to the server, Unity throws this error:

Could not find target object with netId:5 for RPC call ClientRpc:InvokeRpcTargetSendStuff
UnityEngine.Networking.NetworkIdentity:UNetStaticUpdate()

The 5 in netId:5 varies depending on which object I apply this script to. All objects I attach this script to are required to have NetworkIdentity component because of NetworkBehavior. I have tried applying this script to static scene objects as well as the players themselves, but for some reason UNet still can't seem to find the target objects.

Also, I don't really need the TargetRPC call to apply to any particular object. The code within will do only operations to other objects, and even create new ones based on the sent data. All I need is some way that I can send data to specific clients.

sentences:
Calculate travel time on road map with semaphores I have a road map with intersections. At intersections there are semaphores. For each semaphore I generate a red light time and green light time which are represented with syntax [R:T1, G:T2], for example:

    119                   185                 250
A ------- B: [R:6, G:4] ------ C: [R:5, G:5] ------ D

I want to calculate a car travel time from A - D. Now I do this with this pseudo code:

function get_travel_time(semaphores_configuration)
{
    time = 0;
    for( i=1; i<path.length;i++)
    {
        prev_node = path[i-1];
        next_node = path[i]);
        cost = cost_between(prev_node, next_node)
        time += (cost/movement_speed) // movement_speed = 50px per second
        light_times = get_light_times(path[i], semaphore_configurations)
        lights_cycle = get_lights_cycle(light_times) // Eg: [R,R,R,G,G,G,G], where [R:3, G:4]
        lights_sum = light_times.green_time+light_times.red_light; // Lights cycle time
        light = lights_cycle[cost%lights_sum];

        if( light == "R" )
        {
            time += light_times.red_light;
        }
    }
    return time;
}

So for distance 119 between A and B travel time is, 119/50 = 2.38s ( exactly mesaured time is between 2.5s and 2.6s), then we add time if we came at a red light when at B. If we came at a red light is calculated with lines:

lights_cycle = get_lights_cycle(light_times) // Eg: [R,R,R,G,G,G,G], where [R:3, G:4]
lights_sum = light_times.green_time+light_times.red_light
light = lights_cycle[cost%lights_sum];
if( light == "R" )
{
    time += light_times.red_light;
}

This pseudo code doesn't calculate exactly the same times as they are mesaured, but the calculations are very close to them.

Any idea how I would calculate this?

sentences:
Hit Detection When rotating the camera This bug/feature has been plaguing me for a while and i want to know the best way to fix it.
I'm testing simple hit detection with a wall, like:

 if (Forward button)
        if(Inv.w.z < -49 || Inv.w.z > 49)
            pos.z = 0.0f;
        else if(Inv.w.x < -49 || Inv.w.x > 49)
            pos.z = 0.0f;
        else
            pos.z = +1.0f;

where Inv.w. is the camera positions.
Now obviously when i now hit that certain point i can no longer move away from the wall or anywhere in fact. How can i change this code to allow for the camera to be turned away from the wall so therefore i should be allowed to move?

for example, the player hits the wall and i cant move until i turn around or to the side?

I know its something to do with velocity but im pretty new to this so please bare with me if this is easy.

sentences:
Do I have to use new keyword for unity single game object? I'm using Unity4.
Do I have to use new keyword for single game object? look at the following code.

1.
GameObject obj = new GameObject();
obj = Resources.Load("Prefabs/Ball", typeof(GameObject)) as GameObject;

2.
GameObject obj;
obj = Resources.Load("Prefabs/Ball", typeof(GameObject)) as GameObject;

is it the same?

sentences:
How can I make a proxy server between a client and a server to analyise my packets Otherhand how can i manipulate where the game client want to connect?
I've built a python proxy server that can handle this proxy server, it is a basic thing that just: bind a server, wait till the client connect, and connect to the server, and send all data that have got from the client via this proxy, and send forward to the main server.
And here is the problem that i not able to solve, the client don't want to connect to my proxy server. I modified my etc/hosts before, and i failed as well.
Any idea to solve this problem?

sentences:
How can I fill a Color[] from a Texture2D given a Rectangle in SharpDX? I used to fill a Color[] using XNA's

Texture2D.GetData<T>(int, Rectangle?, T[], int, int)

method, but there doesn't seem to be an equivalent overload on SharpDX's Texture2D. Anyone know how I can get this same functionality with SharpDX?

EDIT

How can I fill a Color[] from a SharpDX.Toolkit.Graphics.Texture2D given a Rectangle in SharpDX?

sentences:
Rotate an arrow on a plane? I'm creating a display for a GPS-based embedded system and would like to have an arrow indicating the current bearing. I'd love the arrow to have a 3d appearance by rotating it on a plane tilted up toward the camera, as per these images.

My original idea was to have an ellipse that represents a circle on the tilted plane and plot the bearing angle as a point on the ellipse (this would be the 'head' of the arrow). The rest of the arrow would be drawn by offsetting the bearing by two fixed angles (say 160 and 200 degrees) to make the two points of the tail, then plotting those on the ellipse. The line connecting these two tail points would have its midpoint moved towards the head point to create the arrow shape.

As the target is a bitmap display and I would have to do the rendering myself, is there  an algorithm for rotating a bitmap on an arbitrary plane given an angle of the plane and the angle of rotation? Or is there a better way to plot the arrow as a 3d shape, then translate to 2d?

sentences:
Are there drawbacks to resizing mesh renderer bounds? I had a problem yesterday where some of the meshes were not visible. I figured out the problem, which was that the mesh renderer bounds were not in the cameras field of view.
So, in order to make the mashes visible, I'm thinking of either making the bounds of the mesh renderer larger, or moving them forward so they are in the camera view.
If I do this, are there any drawbacks, like potential glitches, problems, more strain on the system, etc that might happen?

sentences:
Organizing scene graph nodes that have multiple parents I am trying to understand how, from an abstract sense, scene graphs should be organized.

Say that in a game, there is a scene where the user is inside a house. The house has four walls, and on one wall there is a painting. There is also a wood stove resting on the ground but with an exhaust pipe that extends up and "through" the ceiling. Also on the floor, there is a table with a pen and a piece of paper on it. How might this particular scene graph be organized?

house/
    wall_1/
    wall_2/
        painting
    wall_3/
    wall_4/
    floor/
        table/
            pen
            paper
        woodstove
    ceiling/

Here's the root of my question: the wood stove connects to both the floor and the ceiling, so which parent node should it be a child of?

sentences:
How to cast colored shadows I have a glassy object and when light passes through it I want it to cast colored light behind it, instead of the shadow.

I could just use another light object to cast that colored light, but is it possible to do this using shaders?

sentences:
3D game: is a spatial index necessary? I'm working on a 3D space simulation game in C++.

I've read that in many cases games use spatial indexing (hashing) that allows to quickly detect collisions, find out what entities to draw and so forth.

Is this really necessary for my game, considering that collisions between entities can happen, but are very rare? Is there any viable (and simpler) alternative?

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:
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:
Real Time vs Turn Based (XNA) What is a more difficult type of game to develop on XNA: A Real Time multiplayer game or a Turn Based multiplayer game? (not client server or peer to peer, just in general)

Any links to articles would be greatly appreciated!

sentences:
how are semantics used when declaring a struct? I don't understand how semantics are used in shaders. While reading Unity's shader tutorials, I come across this

struct v2f {
    float worldPos: TEXCOORD0;
    half3 worldNormal: TEXCOORD1;
    float4 pos : SV_POSITION;
};

and also this

       struct v2f {
            float3 worldPos : TEXCOORD0;
            half3 tspace0 : TEXCOORD1;
            half3 tspace1 : TEXCOORD2;
            half3 tspace2 : TEXCOORD3;
            float2 uv : TEXCOORD4;
            float4 pos : SV_POSITION;
        };

Microsoft's documentation says

  A semantic is a string attached to a shader input or output that conveys information about the intended use of a parameter.

I know there is some kind of interpolation of data because vertices and pixels aren't one to one, thus I think semantics are used for telling the graphics library what to do about the data. But here it uses TEXCOORDX for things like world position and tangent space vectors. They don't seem to have anything to do with UV coordinates. So how are these semantics actully used?

sentences:
Issue with importing model to xna I am creating a model with Blender which looks like this:

and I am importing it into an XNA project.
There seems to be some kind of transparency issue.
The model looks like that:

When the camera looks on one side, the side is not shown.
Why do I have this problem and what can I do to fix it?

PS: I am using a custom Effect but I don't think that the issue has something to do with that.

sentences:
How to bundle JRE with a game on Steam for Mac users? Heyo!

I have looked for a step by step tutorial everywhere and haven't been able to find anything so please try to be helpful and fairly slow.

I am creating a game for Steam and I am using Java to write it. I chose Java as  it can be run cross-platform and is the one in which I am the most familiar. On this recent question I asked I was told I could bundle the JRE I needed with the game using a program like Launch4J. But I can't find anything about converting the bundle into an executable that Mac users can run.

So my questions are thus:

1) Are there any step by step tutorials for bundling a completed Java program with the needed JRE into an executable for not only Windows but Mac users as well?

2) And if not, would someone be kind enough to create a quick step by step list of everything I need to do?

sentences:
SDL Surface clipping mask I am creating a GUI for my game, so I use some buttons like
. So you can see it is only text surrounded by a rectangle. But I currently use a huge png image with all the buttons I need arranged as I want it, it is really inefficient, so how can I  upload a single smaller image of the rectangle, a sample of the gradient I want and use SDL_tff to create a surface. Say: I copy the rectangle and the text in an SDL_Surface, it should have two colors (black and white), now make white pixel transparent and black pixels to be replaced with the gradient to create the buttons and place them using SDL_Rects.

sentences:
What are the semantics of glRotate and glTranslate's parameters? I have been trying to play with OpenGL after watching some tutorials and I don't understand how the glTranslatef and glRotatef functions work. I believe a simple picture would help me.

I understand that glTranslatef changes the position of the "camera" (but does it change the position in wich the shapes are getting drawn)?

However, I don't understand the rotation concept at all. If I do glRotatef(1,0,0,1) it makes my quad spin around. If I just do glRotatef(1,0,0,0) it makes the quad smaller (further away) but if I try to rotate around the X or Y axis, I get a black screen. I don't understand the angle either. Help would be appreciated.

sentences:
changescene after timeline Is there a way to change the scene after playing a timeline with the new timeline system?

I have 3 scenes in my project. The first scene is where a player interacts with an object to trigger a change to the second scene. The second scene then plays my timeline. When the timeline finished playing I want to change to the 3rd scene.

How can I trigger the scene change at the end of that timeline?

sentences:
Networking library compatible C++ and Java There is any networking library like eNet compatible with Java and C++?

'm trying to find a way to communicate an Android game in Java with a C + + server, but I prefer to use a network library instead raw sockets.

I've found a java-enet, but I don't know if it's a mature project or compatible with eNet C version.

sentences:
Efficient method to export a lot of pre-rendered sprites from 3D models I have a lot of 3D Characters and I wish to use them in a 2.5D game as Sprites; in doing this I have to render them from a fixed camera angle and since each should have its own atlas file containing animation frames, it's going to be a very time consuming job!
I was thinking to write a python script (models are in Blender format) and let it render the Sprites. Since I don't know Python do you think that it is efficient of me to learn the python first and write the script to do the job for me?
Does anyone have a better idea?

In brief:
I am looking for an efficient method to export pre-rendered sprites from 3D models considering that they all have the same armature with the same animations.

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: iPhone app activated before associated in-app-purchase activated? I recently submitted my iPhone game for review.  I also approved the in-app-purchase for my game (and provided the in-app-purchase screenshot).  It's a few days later and the app status has been updated from "waiting for review" to "in review"... while the in-app-purchase status is still "waiting for review".  Could the app go live in the store before the in-app-purchase?  If so what happens when the user tries to make the in-app-purchase?  Anything the developer can do to remedy this?

sentences:
Java: Exported JAR file doesn't load images I am using Netbeans to create my game. The images do seem to load when I run it in Netbeans. However, the built jar file only leaves me with a blank screen.

This is how I call the images in my game.

public Image playerSprite = playerSprite = Toolkit.getDefaultToolkit().getImage("sprites\\spritesL.png");

I put all image resources in a folder called sprites, and I declared it as a Source in the Project Properties. In addition, the image files does appear in the root directory of the JAR file, but cannot seem to access it.

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:
How to make a 'Picture-book Cutscene' in Unity 2D with simple 2D images? I'm trying to implement a simple cutscene system in my Unity game, preferably one that allows cutscenes to play at the start and end of each of the levels.

What I was imagining was pretty similar to A Hat in Time's 'storybooks' from it's time rifts, but full-screen and advanced with a single key. The images are simple and comic-like, and I was wondering how to implement such a feature since it feels like it's a bit different to Unity's pre-existing Timeline system, as there isn't many moving parts.

How do I go about approaching this problem? At least, I don't know how to get the project to a state where a person can press a key to turn to the next page (whether or not there's a visual transition to the next is optional) and once it's done, to start the actual level/scene. Do I still use the Timeline for this? I know I could potentially use an empty game management prefab in order to set up when to play the cutscenes, however.

sentences:
Why Unity3d takes so long time to "rebuild" when I change build platform? I would like to know what happens "behind the scenes" when I change my unity game target platform .

If I switch from Android to iOS or Pc or etc, Unity rebuild something and takes a lot of hours to complete.

What is the reason ?

Thanks

sentences: Unity UI InputField does not consume the keyboard input Unity UI:  I have an input field in which I can type.  Unfortunately, when I hit any of the movement keys, such as the space bar, I move while I'm typing which is not the effect I want.  Is there a way to force the input field to consume the keyboard input so it doesn't also get picked up by the game?  Or do I have to write the code in my game to do that for me.  (Seems like it should be configurable at least).

sentences:
Conversation tree and question locking/unlocking I have been having issues with managing a conversation tree. I am using PAWN as a scripting language (I have no other options, unfortunately) and I use MySQL databases to store user and game data.

My current issue is storing game conversation trees using SQL. Currently, I have the following table:

TABLE NAME: dialogue
ID: global ID of conversation option
Prompt: question or sentence shown on player's screen
Answer: NPC's answer
[some other stuff related to conditions and mood checks, etc.]

Now, my problem is the following. Suppose I greet the NPC, this would be something like this:

ID: 1
Prompt: Hello there.
Answer: Hi, how's it going?

I want my conversation tree to progress after the player greets the NPC. This is not problematic, I simply use an additional SQL table for that:

TABLE NAME: dialoge_unlock_lock
ID: global ID of dialogue element
Unlocks: option this element unlocks
Locks: option this element locks.

My problem is the following: suppose I greeted the NPC, this would unlock 5 conversation options for the player to choose from (they would have IDs 2-6 for this NPC, and perhaps 241-245 for another NPC). I choose question #2, this would unlock question #8 and lock question #7.

How could I check what questions the player has locked in the current dialogue tree? In this example, I don't want the player to just see question #8, but I want him to see every question that is currently available to him (that is, questions 2-6 & 8).

I have been sitting on this for days and I can't figure out a way to do it. This pretty much sums up my attempts, any help would be greatly appreciated.

sentences:
Blue color instead of alpha using Alpha Blending I am testing rendering with alpha blending state according to this guide.
The aim is to add snow on terrain grass texture.
Finally, I got the wrong result -- the blue color fillings up all alpha = 0 pixels.
I checked the instruction step triple time, can't find any mistakes.
Could someone explain to me what's is wrong with my code?
PS and VS:
SnowPSIn SnowVSMain(SnowVSIn Input)
{
    SnowPSIn Output;
    float fY = g_txHeightMap.SampleLevel(g_samLinear, Input.vTexCoord, 0).a * g_fHeightScale;
    float4 vWorldPos = float4(Input.vPos + float3(0.0, fY, 0.0), 1.0);
    Output.vPos = mul(vWorldPos, g_mViewProj);
    Output.vTexCoord.xy = Input.vTexCoord;
    Output.vTexCoord.z = FogValue(length(vWorldPos - g_mInvCamView[3].xyz));
    Output.vTexCoord.w = length(vWorldPos - g_mInvCamView[3].xyz);
    //Output.vShadowPos = mul(vWorldPos, g_mLightViewProj);

    return Output;
}

float4 SnowPSMain(SnowPSIn Input) : SV_Target
{
    float4 vSnowColor = g_txTerrSnow.Sample(g_samLinear, Input.vTexCoord.xy * 64);
    return vSnowColor;
}

BlendState:
BlendState SrcAlphaBlendingAdd
{
    BlendEnable[0] = TRUE;
    SrcBlend = SRC_ALPHA;
    DestBlend = INV_SRC_ALPHA;
    BlendOp = ADD;
    SrcBlendAlpha = ZERO;
    DestBlendAlpha = ZERO;
    BlendOpAlpha = ADD;
    RenderTargetWriteMask[0] = 0x0F;
};

Pass:
pass RenderShowPass
{
    SetVertexShader(CompileShader(vs_5_0, SnowVSMain()));
    SetGeometryShader(NULL);
    SetPixelShader(CompileShader(ps_4_0, SnowPSMain()));
    SetBlendState(SrcAlphaBlendingAdd, float4(0.0f, 0.0f, 0.0f, 0.0f), 0xFFFFFFFF);
}

all sources
Before:
After:

sentences:
How to convert and handle (controlling) OOP game objects via ECS? I'm having hard time converting OOP game objects to Ashley ECS framework. I have a character, gun & a bullet class. The character uses the gun as weapon, the gun class has a fire method that handles the creation of bullet. In the below code, is my current WeaponSystem that serves as a generic system for any weapon like Gun class.

public interface Weapon {
     void use();
}

public class WeaponComponent implements Component {
     Weapon weapon;
}

public class WeaponSystem extends IteratingSystem {

    ... // Constructor

    ... // Process Entity

    public void use(Entity weapon) {
         WeaponComponent weaponComponent = Components.getWeapon(weapon);
         weaponComponent.use();
         ...
    }

}

The character system..

public class CharacterSystem extends IteratingSytem {

    ... // Constuctor

    ... // Process Entity

    public void attack(Entity character) {
        getEngine().getSystem(WeaponSystem.class).use(character);
        // also can be use like this
        // CharacterComponent characterComponent = ...
        // it seems that, it was redundant
        // characterComponent.weapon.use();
    }

}

And the user controlled system ...

public class UserControlledSystem extends IteratingSystem {
     ...

     public void move(Entity character) {
          ... Set character directions

          InputComponent input ...
          input.key == arrow key, etc...

          getEngine().getSystem(CharacterSystem.class).move(character, direction);
     }

     public void attack(Entity character) {
          getEngine().getSystem(CharacterSystem.class).attack(character);
     }
}

Based on this article, they are using event dispatcher. But do I really need to use dispatcher? Is that possible to not to use dispatcher, just purely ECS? Anyways let's back to the main question(How to convert and handle (controlling) OOP game objects via ECS?). Currently, the Ashley ECS Entity has an access to engine and systems. Like in the above code example, do you think it is the proper way of handling the system?

sentences:
Why are character-classes used in game design? We had a long discussion in my company about character-classes. We are building a skill based game where you will eventually need to select 8 to enter a battle. I am a fan of classless systems, I have always felt that they are created to extend your gameplay hours in a fake way.

We reached a few conclusions:

Classes are there to prevent "best build" scenario where everyone plays with optimal (Personally I feel that this is a weak case, You should be able to design a system where there is no win combination without classes)
Classes create variety by offering different style of play (I agree with this but if you have the freedom to combine different skills you can actually create your own class)
Classes make choosing style of play easier to players. Most of the times players play the same type of character in different games. (Damage Dealer, Healer, Thief/Assassin etc.) (For me this makes most sense from all the arguments from above, but why force people to only part of the skills when you could offer them as templates)

Why are character-classes used in game design? Do you agree with the above points? Yes or no, why do you think like that?

sentences:
Restarting a libGDX game to apply changes to resolution How can I restart a LibGDX game to apply certain changes to the game such as changes to the resolution (going from 1920X1080 to 1280X720), or changing full screen.
Granted the resize(int width, int height) can help with the resolution change, but I need to change other settings as well so I rather restart the game and continue from the options menu instead of forcing the user to manually exit the game and then restart it.

sentences:
How to teleport a game object to an empty game object? I am trying to make a respawn  system where if the player touches a plane, (the name of the object is tutlvl1_flrdead) they get teleported to an empty object at player spawn named "RESPAWN". But, several tutorials and unity answers threads lead me to nowhere since they were written from back in 2013 or somewhere around there.
Code:
using System.Collections;
using System.Collections.Generic;
using UnityEngine;

public class deathfloor : MonoBehaviour
{
    // Start is called before the first frame update
    void Start()
    {

    }

    // Update is called once per frame
    void Update()
    {
        public gameObject myObject; //You can name it whatever you want.
        myObject.transform.position = new Vector3(3.076, 1.74, -3.651);
    }
}

How can I fix this to do what I need for my game?

sentences:
How to align 2 IMUs' quaternions? Suppose I have 2 IMUs that output 2 quaternions.

I place one IMU on my left hand and another one on my right hand.

I put both my hands flat on the table and point it forward to the same direction. What I expect is that they should give very similar quaternion. But it turns out that the IMUs reading differs about 10-20 degrees around the Y axis when plotted in Unity3D.

This means I cannot just apply the quaternion to the hand model inside Unity directly. I need to know the exact offset of this 10-20 degrees error in order to make the hand model point in the same direction.

How do I figure out this offset automatically? Or is there another way that I can align both IMUs? How do people deal with this IMU problem?

PS. Putting the IMU on the hand is just an example. I can put them both directly on the table near each other and they still give slightly different quaternions.

sentences:
To what extent it is legal to declare support of third party commercial products' assets? Is it legal to say that MyGame supports other (specific) games' textures, sounds and models?

I'd like to get involved into an open source game project and implement support for Quake's weapon models (for example), but the owners of the project don't know about the legal aspect of it, so I'm asking here.

sentences:
Blending colors on Surfaces in PyGame? So I'm making a game in Python and PyGame.  I have aliens and blocks that each adopt one of several colors; rather than make several copies of them in different colors, I plan on making the sprite once in white, and recoloring individual aliens and blocks.

Problem is, with PyGame, I only know how to use PixelArrays to replace specific colors with other colors (e.g. pure white with pure red, or (255, 255, 255) with (25, 34, 255)).  The sprites aren't going to be super complex, but they will be shaded.

I could use the Python Imaging Library, but I'd kind of like to minimize dependencies.  If this is the best way then so be it.

What I'd like to know is this; how can I use color-blending in PyGame?  More than anything I'm concerned about color-blending algorithms (that ignore certain desired colors, e.g. black for outlines).  Alpha blending is not of concern.

sentences:
Feasability of mobile 2D multiplayer RPG game with interactive bitmap background I'm looking to develop a 2D multiplayer RPG game for Android, with a bird's eye view similar to that of zelda/pokemon. The game is very simple in all ways since my intent is for thousands of players to occupy the same world which I imagine requires good performance. However, I am unsure about the performance requirements of two properties:

the tile map that is used as a background is dynamic (interactive). For example, a player steps in the water, and the water turns black. Every tile in the game does this.
the tile map is the same object used for all players, but it is displayed differently on each user's mobile device, even though the players exist in the same world. For example, the water that turned black is displayed as red on all other players' screens.

I have knowledge of java, but almost none regarding game dev. tools. Is there a best process for these requirements? Should I develop in pure java, or use some tool like Slick2D etc.? How performance intensive are these properties, if even possible?

Edit: There are no collisions in the game or difficult animations, I am imagining simply changing the colors of the tiles (like in the examples), and a client-server architecture

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:
UnityException: Unable to install APK! Installation failed. See the Console for details I got this error message when trying to build and run on Android actual device.

UnityException: Unable to install APK!
Installation failed. See the Console for details.
UnityEditor.Android.PostProcessAndroidPlayer.ShowErrDlgAndThrow (System.String title, System.String message, System.Exception ex)
UnityEditor.Android.PostProcessAndroidPlayer.ShowErrDlgAndThrow (System.String title, System.String message)
UnityEditor.Android.PostProcessAndroidPlayer.UploadAndStartPlayer (System.String manifestName, System.String stagingArea, UnityEditor.Android.AndroidDevice device, System.String packageName, Boolean devPlayer, Boolean retryUpload)
UnityEditor.Android.PostProcessAndroidPlayer.PostProcessInternal (BuildTarget target, System.String stagingAreaData, System.String stagingArea, System.String playerPackage, System.String installPath, System.String companyName, System.String productName, BuildOptions options)
UnityEditor.Android.PostProcessAndroidPlayer.PostProcess (BuildTarget target, System.String stagingAreaData, System.String stagingArea, System.String playerPackage, System.String installPath, System.String companyName, System.String productName, BuildOptions options)
UnityEditor.Android.AndroidBuildPostprocessor.PostProcess (BuildPostProcessArgs args)
UnityEditor.PostprocessBuildPlayer.Postprocess (BuildTarget target, System.String installPath, System.String companyName, System.String productName, Int32 width, Int32 height, System.String downloadWebplayerUrl, System.String manualDownloadWebplayerUrl, BuildOptions options, UnityEditor.RuntimeClassRegistry usedClassRegistry) (at /Users/builduser/buildslave/unity/build/Editor/Mono/BuildPipeline/PostprocessBuildPlayer.cs:316)
UnityEditor.HostView:OnGUI()

Why it happens? Please advice. Thank you.

sentences:
How can I generate random meaningful words in a typing game? I want to make a typing game where users have to type the words displayed on the screen. But I don't know how to generate meaningful English words not gibberish.

What technique can I use to achieve this?

sentences:
SDL Detect change score I have this in my loop , it works but I get verry low fps and game is working in slow motion :

while (!done)
    {
        //Check for events
        done = processEvents(window, &player);
        updateLogic(&player);

        sprintf(buffer, "SCORE: %d", player.currentScore);

        textSurface = TTF_RenderText_Solid(font, buffer, color);
        text = SDL_CreateTextureFromSurface(renderer, textSurface);

        SDL_QueryTexture(text, NULL, NULL, &textW, &textH);
        SDL_FreeSurface(textSurface);

        doRender(renderer, &player);
        SDL_DestroyTexture(text);
    }

I think I need to update those 2 only when score is changing , not every frame..and I don't know how to do it.

textSurface = TTF_RenderText_Solid(font, buffer, color);
text = SDL_CreateTextureFromSurface(renderer, textSurface);

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:
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:
How do you calculate game map changes, over time, when the user is not online? With a game like "Farmville", there is both processing during gameplay, and when the user is offline (plants are always growing, for example). Many of the game maps elements depend on time.

Is there a trick to make this scale?  How can you possibly calculate 1 million users maps being modified every couple of seconds? Some of these games alert you, when things have changed, so it is not like they calculate everything when you login to the system.

How do you calculate game map changes, over time, when the user is not online?

sentences:
Unity how to have a ghost 3d game object I want to have a 3d game object (player) who converts to ghost.

That means that the user must not collide with other players, but must not pass walls, trees, and must take care about terrain height levels (I mean, I can't put it as kinematic and remove the collider because the Vector3.MoveTowards which moves the player will ignore the height dimension and will pass the mountains, etc)

My was thinking about tagging the players and in some way try to skip the collider between them.

Any idea? Thanks

sentences:
What techniques make next gen look so realistic I have watch several gameplays from upcoming titles for ps4 and xbox one and I must admit that they are breath taking.

Of course with new hardware, models will have more polygons and higher texture resolution but that is obvious tip of iceberg.
So my question  is :Are there any complete new techniques, algorithms, shaders broadly used in next gen, already known on paper but not used in current gen because of limitation of hardware or this is all same but more complex,less generic or made for in-house use(unknown for public) to provide better visual result for specified engine.

From my observation:

Realistic particles,fluids (papers?)
Geometry shaders (examples?)

What I expected to see but was not shown:

Fracturing
Generic destruction of buildings and cars!

Is this still to compute heavy for large scale scenes?

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:
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:
SceneManager.LoadScene doesn't seem to be working in Unity IDE I'm in the start screen scene of my game and I'm trying to load the actual game. I use the following code:

public void LoadGame(){
        SceneManager.LoadScene ("Main", LoadSceneMode.Single);
    }

I set this method to be called when a button in the UI is clicked. When testing in the game in the unity IDE, clicking the button doesn't do anything. Is my code wrong, is the IDE screwing up, or will clicking the button never do anything in the ide?

sentences:
Box2D Difference Between WorldCenter and Position So this problem has been brothering for a couple of days now.  First off, what is the difference between say Body.getWorldCenter() and Body.getPosition().  I heard that WorldCenter might have to do with the center of gravity or something.

Second, When I create a Box2D Body for a sprite the Body is always at the lower left corner.  I check it by printing a Rectangle of 1 pixel around the box.getWorldCenter().  From what I understand the Body should be in the center of the Sprite and its bounding box should wrap around the Sprite, correct?

Here's an image of what I mean (The Sprite is Red, Body Blue):

Here's some code:

Body Creator:

    public static Body createBoxBody( final World pPhysicsWorld, final BodyType pBodyType,
            final FixtureDef pFixtureDef, Sprite pSprite ) {

        float pRotation = 0;
        float pCenterX = pSprite.getX() + pSprite.getWidth() / 2;
        float pCenterY = pSprite.getY() + pSprite.getHeight() / 2;
        float pWidth = pSprite.getWidth();
        float pHeight = pSprite.getHeight();

        final BodyDef boxBodyDef = new BodyDef();
        boxBodyDef.type = pBodyType;

        //boxBodyDef.position.x = pCenterX / Constants.PIXEL_METER_RATIO;
        //boxBodyDef.position.y = pCenterY / Constants.PIXEL_METER_RATIO;

        boxBodyDef.position.x = pSprite.getX() / Constants.PIXEL_METER_RATIO;
        boxBodyDef.position.y = pSprite.getY() / Constants.PIXEL_METER_RATIO;

        Vector2 v = new Vector2( boxBodyDef.position.x * Constants.PIXEL_METER_RATIO, boxBodyDef.position.y * Constants.PIXEL_METER_RATIO );
        Gdx.app.log("@Physics", "createBoxBody():: Box Position: " + v);

        // Temporary Box shape of the Body
        final PolygonShape boxPoly = new PolygonShape();
        final float halfWidth = pWidth * 0.5f / Constants.PIXEL_METER_RATIO;
        final float halfHeight = pHeight * 0.5f / Constants.PIXEL_METER_RATIO;
        boxPoly.setAsBox( halfWidth, halfHeight );  // set the anchor point to be the center of the sprite

        pFixtureDef.shape = boxPoly;

        final Body boxBody = pPhysicsWorld.createBody(boxBodyDef);
        Gdx.app.log("@Physics", "createBoxBody():: Box Center: " + boxBody.getPosition().mul(Constants.PIXEL_METER_RATIO));
        boxBody.createFixture(pFixtureDef);

        boxBody.setTransform( boxBody.getWorldCenter(), MathUtils.degreesToRadians * pRotation );

        boxPoly.dispose();

        return boxBody;
}

Making the Sprite:

    public Car( Texture texture, float pX, float pY, World world ) {

        super( "Car" );

        mSprite = new Sprite( texture );
        mSprite.setSize( mSprite.getWidth() / 6, mSprite.getHeight() / 6 );
        mSprite.setPosition( pX, pY );
        mSprite.setOrigin( mSprite.getWidth()/2, mSprite.getHeight()/2);

        FixtureDef carFixtureDef = new FixtureDef();

        // Set the Fixture's properties, like friction, using the car's shape
        carFixtureDef.restitution = 1f;
        carFixtureDef.friction = 1f;
        carFixtureDef.density = 1f; // needed to rotate body using applyTorque

        mBody = Physics.createBoxBody( world, BodyDef.BodyType.DynamicBody, carFixtureDef, mSprite );
}

sentences:
How to get plane rotation by known normal vector I have a FPP quaternion Camera and Plane with known normal vector.

I want to find the orientation of this Plane so I can replace it to the Camera orientation to put the camera forward vector to a plane's normal vector.

First method I tried, I don't understand RotationAxis and RotationAngle. I built a rotation matrix and applied it to the camera but it didn't behave as I wanted.
The second method I tried  is with method called "from_one_vector_to_another". I don't understand what the "from" vector is in my example; is it the camera's forward vector?

Here is my pseudo code:

Vector3 vector_from = camera->getForwardVector();
Vector3 vector_to = triangle->faceNormal;

Quat cameraQuaternion = camera->getOrientation();

Quat q = vector_from.getRotationTo(vector_to);//The method `getRotationTo` is from Ogre.
camera->setOrientation(cameraQuaternion * q);

Camera does not change their orientation as I expected; it changes its orientation just a little bit.

EDIT:

Maybe I have something wrong with my code:

//Quat xrot = axisToQuat(Vector3(1, 0, 0), vertical);  // disabled for now
Quat yrot = axisToQuat(Vector3(0, 1, 0), horizontal);
rot = rot * yrot;

position += velocity;

Matrix lookAt = Matrix::createLookAt
        (
            Vector3(position.x, position.y, position.z),
            Vector3(position.x, position.y, position.z-1),
            Vector3(0,1,0)
        );

view = rot.toMatrix() * lookAt;

I am only rotating the quaternion. Should I rotate lookAt Matrix too?

sentences:
How to emulate knob turning, based on x/y movement? I'm doing a game where one component is that you turn a knob.  I'm having trouble getting good "knob behavior".

I know the current touch/mouse X,Y location, and I keep track of the previous X,Y location, so I can determine if I'm going left or right and/or up or down.

It works, but it's crude.  I suspect I have to take an average of any given direction over a period of time (say, last quarter second) to eliminate jitter because people don't move uniformly in the same movement every moment.

I can't really use touchdown/release because you should be able to put the touch down, then move left/right up/down continuously without release, and the knob would turn, just as if you had a free-spinning audio control or video shuttle (say).

Any thoughts in this direction on how to even it out?

sentences:
Where to store service urls for a Unity3D game I have URL information for services (dozens of them) that I want to store in a Unity3D web player project.  What is a good practice for storing it.  (please don't say hard coding them)

I've recently joined a large scale Unity 3D project in the business world.  I've noticed that there is no configuration file of any type.  I.e. All URLs for service calls are hard coded.  (among other configuration settings that are not typical for player editing)

While looking for a good solution to store/load, I'm seeing that:
1) Unity does not appear to have any kind of AppSettings.  I.e. like Visual Studio dlls/exes/services might.  (PlayerPrefs expressed in #3)

2) Web Player (which the project uses) does not support File IO, to store my own config.xml/config.json type file.

3) PlayerPrefs appears that it will remain isolated to the local machine.  Updating the project does not replace the player prefs, and new variables are supposed to be hardcoded to populate the PlayerPrefs if those variables didn't already exist.

4) Hard Coding the values creates a hefty inconvenience, as we push our solutions from Dev to Test to Staging to Prod, we have to make sure to replace a code file.  (typically systems are designed to change config files.)  Additionally, once the code was built, we wouldn't be able to reasonably change the settings to experiment with different servers or other configuration changes.

What would you recommend?

sentences:
Export Maya Animation Data I have a pretty simple character rig animation. How can I export the raw data of that animation?

I'm looking for some way to export a raw text array of data that tells exactly what every joint does on every frame. This means rotation, translation, etc.

EDIT:
Thanks for the answers so far. We are looking for a way to get something like this:
This would be one joint of a 14 frame animation.

 <joint>
      <name> rightShoulder </name>
      <xPos>12 14 16 18 19 20 21 24 26 28 32 34 36 38 </xPos>
      <yPos>100 99 98 97 96 95 94 93 92 91 90 91 92 95 </yPos>
 </joint>

We are also trying to keep the file lightweight. So we will be ONLY including this data, no meshes, cameras or anything else. I've been looking into .DAE but it seems pretty heavy.

Any suggestions? If nothing standard works, how would one go about writing their own Maya exporter? Does something like this seem possible?

sentences:
Sprite animation in Android view I'm looking for a way to have different sprite animations in individual Android views.

I try to use LibGDX and AndEngine but most I could find was how to get an Activity with the sprite animation.

Is there a way to accomplish this with native Android or a library?

Thanks for the help. Jose

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:
What's the proper way to check if an Entity is on top of a surface? What would be the best way to implement gravity if I have a list of different "surfaces" which if the player is on top of acceleration will stop? Would there be a better way than to loop through all of the surfaces on the map and see if the player is colliding with it?

BTW, I'm using XNA Game studios, but pseudo code is fine.

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:
Mapping dynamic buffers in Direct3D11 in Windows Store apps I'm trying to make instanced geometry in Direct3D11, and the ID3D11DeviceContext1->Map() call is failing with the very helpful error of "Invalid Parameter" when I'm attempting to update the instance buffer.

The buffer is declared as a member variable:

Microsoft::WRL::ComPtr<ID3D11Buffer>                m_instanceBuffer;

Then I create it (which succeeds):

D3D11_BUFFER_DESC instanceDesc;
ZeroMemory(&instanceDesc, sizeof(D3D11_BUFFER_DESC));
instanceDesc.Usage = D3D11_USAGE_DYNAMIC;
instanceDesc.ByteWidth = sizeof(InstanceData) * MAX_INSTANCE_COUNT;
instanceDesc.BindFlags = D3D11_BIND_VERTEX_BUFFER;
instanceDesc.CPUAccessFlags = D3D11_CPU_ACCESS_WRITE;
instanceDesc.MiscFlags = 0;
instanceDesc.StructureByteStride = 0;

DX::ThrowIfFailed(d3dDevice->CreateBuffer(&instanceDesc, NULL, &m_instanceBuffer));

However, when I try to map it:

D3D11_MAPPED_SUBRESOURCE inst;
DX::ThrowIfFailed(d3dContext->Map(m_instanceBuffer.Get(), 0, D3D11_MAP_WRITE, 0, &inst));

The map call fails with E_INVALIDARG.  Nothing is NULL incorrectly, and this being one of my first D3D apps I'm currently stumped on what to do next to track it down.  I'm thinking I must be creating the buffer incorrectly, but I can't see how.  Any input would be appreciated.

sentences:
How to set default scale on a per bone basis Does anyone know how I can change the default scale on a per bone basis in Maya? (I'm using 2016)

I want the scale to be 1,1,1 for this bone without making it smaller than it currently is.

So, I want to make the default scale of this bone 1.552, 1.552, 1.552.
Therefore, it would read 1,1,1 but still be the same size.

Does anyone know how to do this?

sentences:
Documentation on 2D space partitioning I am looking for documentation that explains the different kinds of (well the major ones anyway) 2D space partitioning algorithms & data structures.

Any pointers besides 'Google it and sift through hundreds of papers'. A book perhaps?

sentences: Why calculate A* Pathfinding F Cost? I just made an A* Pathfinding system in unity that doesn't calculate the f cost (g cost + h cost) and I wondering why do u actually have to calculate the f cost? I mean my pathfinding system that works perfectly fine. Any ideas?

sentences:
Static variable not holding its value I am creating a real time multiplayer game in Unity 3d. When a game ends I set a static boolean value called "waitingToEndGame" to true. In Update() it waits a few seconds before moving to a new scene like this:

if (waitingToEndGame)
{
    waitTime += Time.deltaTime;
    if (waitTime >= 5f)
    {
        showGameScores = false;
        waitingToEndGame = false;
        if (type == "Multiplayer") MultiplayerController.Instance.LeaveGame();
        GameObject levelManager = GameObject.Find("Level Manager");
        levelManager.GetComponent<LevelManager>().LoadLevel("MainMenu");
    }
    DisableAllMovingObjects();
}

My problem is that even though I am setting the boolean value to true it acts as if it doesn't change and it doesn't make it into the code above to move to the main menu. I even had debug statements printing here as well and they seem to just suddenly stop.

sentences:
How are these bullets done? I really want to know how the bullets in Radiangames Inferno are done. The bullets seem like they are just billboard particles but I am curious about how their tails are implemented. They can curve so this means they are not just a billboard. Also, they appear continuous which implies that the tails are not made of a bunch of smaller particles (I think).

Can anyone shead some light on this for me?

sentences:
Textures rendering upside down and small with Pixel Shader in Mono Game but not XNA I'm new to HLSL, attempting to use MonoGame to do some simple post processing effects.

Here is my HLSL file, taken from one of rbwhitaker's xna tutorials (I would post the link, but can't post more than two with my current reputation).

//------------------------------ TEXTURE PROPERTIES ----------------------------
// This is the texture that SpriteBatch will try to set before drawing
texture ScreenTexture;

// Our sampler for the texture, which is just going to be pretty simple
sampler TextureSampler = sampler_state
{
    Texture = <ScreenTexture>;
};

//------------------------ PIXEL SHADER ----------------------------------------
// This pixel shader will simply look up the color of the texture at the
// requested point, and turns it into a shade of gray
float4 PixelShaderFunction(float2 TextureCoordinate : TEXCOORD0) : COLOR0
{
    float4 color = tex2D(TextureSampler, TextureCoordinate);

    float value = (color.r + color.g + color.b) / 3;
    color.r = value;
    color.g = value;
    color.b = value;

    return color;
}

//-------------------------- TECHNIQUES ----------------------------------------
// This technique is pretty simple - only one pass, and only a pixel shader
technique BlackAndWhite
{
    pass Pass1
    {
        PixelShader = compile ps_4_0 PixelShaderFunction();
    }
}

The only line I've changed is the compiler version from ps_2_0 -> ps_4_0, since MonoGame needs 4.0 (I think?)

I'm using MonoGame 3.4, and I've changed nothing from the initial project template except the following:

protected override void LoadContent()
{
    // Create a new SpriteBatch, which can be used to draw textures.
    spriteBatch = new SpriteBatch(GraphicsDevice);
    // TODO: use this.Content to load your game content here
    BlackAndWhiteEffect = Content.Load<Effect>("BlackAndWhite");
    Image = Content.Load<Texture2D>("smiley");
}

private Effect BlackAndWhiteEffect
{
    get;
    set;
}

private Texture2D Image
{
    get;
    set;
}

protected override void Draw(GameTime gameTime)
{

    GraphicsDevice.Clear(Color.CornflowerBlue);

    spriteBatch.Begin(SpriteSortMode.Deferred, null, null, null, null, BlackAndWhiteEffect);
    //spriteBatch.Begin();

    spriteBatch.Draw(Image, GraphicsDevice.Viewport.Bounds, Color.White);

    spriteBatch.End();

    base.Draw(gameTime);
}

Here is the result of the code executing in monogame:

And here is the result from an identical project created in XNA (except for ps_2_0 in the shader, as mentioned before):

Would appreciate any help. I can upload both solution files if needed.

sentences:
IndexOutOfRangeException on array of transform prefabs in Unity I have a public array of length 9 containing prefabs I'm using as position references for a moving object. The start function finds the transform.position of the appropriate transform in the array and makes it the target for a Vector3.MoveTowards() function that is called every update. I have an exception for the start function, but the object moves fine. If I print the length of the array on every update, It shows zero every other frame, and 9 otherwise. There's nothing in the script changing the array, how is this happening?

I'm using the Linux build of Unity.

sentences:
Fullscreen FPS slowdown in Linux I've got a homemade game engine that supports both Windows and Linux using Win32 and Xlib, respectively. By default, the engine will create the window and then switch it into fullscreen mode. When running in Linux, the main game loop updates with a very low framerate (2-7 FPS) that slowly keeps ticking downwards. If I alt-tab out and then alt-tab back in, the game will shoot up to and stay at a consistent 60 FPS.

Since my time since last tick (dt) keeps increasing during this time, my thought is it has something to do with the game not being properly registered as "fullscreen" when it's initially opened, leading the CPU scheduler to not give it full priority. That being said, that's entirely speculation. Does anyone have any idea what the cause of this could be? I can provide code samples if requested.

System info:
Linux Mint 17 Cinnamon 64-bit
Intel Core i7 @ 3.40GHz x 4
8GB DDR3 RAM
Nvidia GeForce GTX 680 with proprietary driver

Edit
My update loop is as follows:

while (gameIsRunning) {
    auto currentTime = std::chrono::steady_clock::now();
    auto dt = std::chrono::duration<float>{currentTime - lastFrame};
    if (dt >= engine->getFrameInterval()) { // getFrameInterval returns (1 / the target framerate) in seconds; in this case, 1/60s
        if (dt >= engine->getFrameInterval() * 2) {
            lastFrame = currentTime;
        } else {
            lastFrame += std::chrono::duration_cast<decltype(currentTime - lastFrame)>(engine->getFrameInterval());
        }

        // input, update, draw...
    }
}

After fooling around with it a bit, this creates a situation where the framerate will jump back up to 60FPS, tick down until it hits about 30FPS, and then jump back up to near 60FPS before ticking down again.

sentences:
Texture with Transparent background has black background in Unity please see the below image. I made a model in Blender that has eye meshes with UV mapped Pupils. But trying to import all this into Unity is causing tons of weird visual errors...

The pupil png has a Transparent background but that background shows up as Black in Unity. Googling says to fix it by choosing 'Transparent' shader but all the ones I try end up cutting out the Eye mesh beneath it.

Any help appreciated.

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:
LibGDX: creating actor conformed by other actors I am making my custom actor class, made up by 3 actors(oneProgressBar, one Label and one TextButton), because I will be using this many times, so it's not a good idea to create 3 of that actors when I can create one that can contain them. So I am making my class:

public class MyActor extends Actor {
ProgressBar bar;
Label nameLabel;
TextButton button;
public MyActor(String name, Skin skin, float progress){
    nameLabel = new Label(name, skin);
    button = new TextButton("Buy", skin);
    bar = new ProgressBar(0f,5f,progress,false,skin);
}

@Override
public void act(float delta) {
    super.act(delta);
    bar.setBounds(getX(), getTop()-getHeight() / 3f, getWidth(), getHeight() / 3f);
    nameLabel.setBounds(getX(), getY()+getHeight() / 3f, getWidth(), getHeight() / 3f);
    button.setBounds(getX(), getY(), getWidth(), getHeight() / 3f);
}

@Override
public void draw(Batch batch, float parentAlpha) {
    super.draw(batch, parentAlpha);
    bar.draw(batch, parentAlpha);
    nameLabel.draw(batch, parentAlpha);
    button.draw(batch,parentAlpha);
}

}

So in my game, I add my actor to the Stage using a table:

Table table = new Table();
table.debug();
MyActor actor = new MyActor("whatever",mySkin,1f);
table.add(actor).size(myWidth,myHeight);

The actor is drawn in the correct place(I know because of the debug lines), but the 3 actor are drawn in the 0,0 coordinates, what am I doing wrong? do I need to override another method?

sentences:
Dodge different type of obstacles I'm writing a 2D game where the player has to kill a Ninja. This Ninja is coming closer with a constant speed chasing the player.
The Map has some static obstacles like stones no one can pass.
The player can move too and has different types of weapons to damage the Ninja in different ways:

Laser: instantly on whole range
Gun: projectile (circular) following a fixed path
Trap: circular floor ability which detonates after time

I want the Ninja to dodge those Weapons the best he can, he is allowed to take some damage, the least is preferred.

I now have different ideas how to achieve that:

A* with 3rd dimension (time): This is working but the paths are ugly and post processing is not my favorite. Also the Graph's size is about 1000x1000, making it inefficient (on creating neighbors), i try to reduce node count by scaling the nodes to unit.hitbox (40px), which drastically improves the calcs, but the paths look even more ugly..
Theta*: won't work even tho I love it, but line-of-sight on moving obstacles is...
Visibility Graph: same as Theta*, moving obstacles...
Steering: haven't tried this one yet how it performs with constant speed and moving (, delayed) obstacles
Local Avoidance: won't work as the weapon speed is bigger than Ninja movement speed
Geometry: tangents, vector projection etc....  could work well if there aren't much obstacles to dodge

Do you have any other ideas how to achieve some good doing for the poor Ninja?

(NINJAS USUALLY DODGE EVERYTHING... That's why I also plan to give the Ninja a Ninja-Roll feature he can use every 10s to dash on some position if he can't dodge something)

Representation of the raw map (little dots are 40px)

A* Pathfinding with time dimension and a 5px-Grid

Edit: I'll check out D*-Lite and RRT*-Smart

Edit #2: Both are not what im looking for, i will try to optimize A*

sentences: Using Unity's uNet to create a turn-based RPG I've been checking some tutorials about uNet and it seems pretty powerful. The NetworkManager is a great tool when you want to make generic games, but what is troubling me about it is the need of spawning a "Player". I intend to create a turn-based RPG, and for that, during the battle there's not a "physical player entity", there's two players which have a set of monsters and the players can select a monster to attack the opponents', but the player itself doesn't exist, in the end it sums up to a trade of commands between the clients. How can I achieve such an architecture with uNet? Should I discard the use of the default NetworkManager? Should I simply create a bodyless Player and go along with it?

sentences:
Retrieve the original prefab from a game object How would one proceed to retrieve the original prefab used for instantiating an object?

In the editor these two functions work :

        Debug.Log(PrefabUtility.GetPrefabParent(gameObject));
        Debug.Log(PrefabUtility.GetPrefabObject(gameObject));

But I need something that works in the release version.

I have objects that can be transported between scenes ands I need to save their data and original prefab to be able to instantiate them outside of the scene they have been originally instantiated.

ie:

Game designers create new prefabs.
Game designers create objects from prefabs and place them in scenes (50 to 150 scenes).
Game is played and objects are moved across scenes.
Game is saved and infos about objects which have moved are saved in the save streams (files or network).

This is where I got stuck. Currently, to palliate to the shortcomings, we're saving the name of the prefab in the prefab. But each time a prefab is moved, renamed or duplicated the string must be changed too, sometimes the objects created from the prefab keep the original name (game designer might have edited the prefabPath field).

Maybe there is a better way to achieve proper save games without having to access to the original prefab/name. But currently we keep the saves segmented on a per level basis (easier and safer to save/load to files and transfer the save games to/from servers)

sentences:
Spotlights and Pointlights not working with Unity Render Pipeline? I'm experimenting with URP, Render Pipelines, and Shaders for the first time recently and have noticed something odd. In the scene I'm building, Point Lights and Spotlights don't work. No matter what I do, they do not affect the environment at all, for static and nonstatic objects. I can't even use a Halo component to visualize them. They exist in the scene but don't do anything and even Lightmaps don't seem to register them.

I suspect that it's because of the render pipeline, but if I go to a blank scene and put a spotlight on an object, it works. I'm just very confused what's happening.

Any idea what might be happening?

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:
Instantiated prefabs dont trigger ontriggerEnter while prefabs created not on runtime, do I am new to unity and trying to make a bouble trouble game. I have enemy prefabs with BoxCollider with is triggered checked. I also have a shooting script. when I am trying to instantiate the enemy prefabs on runtime, they dont seem to trigger the OnTriggerEnter function, but if I am placing an Enemy prefab not ingame, it does trigger the funtion. I have no idea why.
The on run-time instantiate:
public class CreateBalls : MonoBehaviour
{
    public Rigidbody prefab;
    public Transform position1;

    void Awake()
    {

        for (int i = 0; i < 1; i++)
        {
            float random = Random.Range(-45.08f, 44.41f);
            Vector3 vec = new Vector3(random, position1.position.y, position1.position.z);
            Rigidbody ball= Instantiate(prefab, vec, position1.rotation) as Rigidbody;

        }
    }
}

The funtion not being called:
public class DestroyBalls : MonoBehaviour
{
    public Rigidbody potion;
    public Transform posToSpawn;

    private void OnTriggerEnter(Collider other)
    {
        if (this.gameObject.tag == "Enemy"&& other.gameObject.tag=="Bullet")
        {
           //a code not relevent
        }
    }
}

Any idea of why the funtion isnt being called? the bullets are tagged "Bullet" and the Enemies are tagged "Enemy"

Update:
The funtion is triggered when colliding with another Enemy tagged, but not being trigged after collision with anyother tagged object
Also, I have another component on the Enemy Prefab, which also instantiates enemies on run-time and these trigger the function perfectly fine. very wierd.
the code:
public Rigidbody ballToSpawn;
    public Transform spawnPoint;

    private void OnTriggerEnter(Collider other)
    {
        if (this.gameObject.tag == "Enemy" && other.gameObject.tag == "Bullet")
        {
            if (this.gameObject.GetComponent<Size>().size > 1)
            {
                Rigidbody small;

                for (int i = 0,y=-1 ; i < 2; i++,y+=2)
                {
                    Vector3 vec = new Vector3(spawnPoint.position.x+y, spawnPoint.position.y, spawnPoint.position.z);
                    small = Instantiate(ballToSpawn, vec, spawnPoint.rotation) as Rigidbody;
                    small.gameObject.transform.localScale = new Vector3(1, 1, 0);
                    small.gameObject.GetComponent<AutoMoveForBall>().GoToX = this.gameObject.GetComponent<AutoMoveForBall>().GoToX;
                    small.gameObject.GetComponent<AutoMoveForBall>().GoToY = this.gameObject.GetComponent<AutoMoveForBall>().GoToY;
                    small.gameObject.GetComponent<Size>().size = this.gameObject.GetComponent<Size>().size - 1;
                }
            }
        }
    }

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:
How to avoid lots of booleans This was probably asked somewhere but I can't google anything for some reason.
So I'm making a puzzle game as a result I have lots of booleans which affect the game only once and become redundant.
As an example, to enter some door player needs to pickup a key so there is check for that. After that when hero enters a doors for the first there is a special animation triggered.
So after player had entered the door  this checks are no longer neccery.

I am not worried about perfomance but rather code design.
Maybe there is some clever trick to manage game state without bunch of ifs and bools?

sentences:
Drawing the same mesh or drawing the same material? I was wondering. Suppose I have a 1000 grass meshes. They all have the same material, but I create them separately, because they look slightly different, because they have different heights.

Does my GPU speed up if I only draw one mesh over and over again? Or is only the material switching and uniform setting the main problem?

So: Should I consider going to only one mesh a 1000 times, or is it ok to have a lot of different meshes with only the same material?

sentences:
Camera movement with slerp I have 3 spots, I would like to move my camera to using slerp. Just As seen in the image below. My question is how I can connect my camera to the first spot? I should be able to move between other spots after I connect my camera to the first spot.

Maybe a better way to ask is how can I make the camera location my first quaternion spot?

sentences:
OBB collisions in Buildings So I decided on using OBB as the main collision detection in my 3D game but I started to wonder how OBB can be used to detect collisions if a player is in a building, an object you can walk into. Should the building object be broken up into dozens of OBBs or is there like an OBB to mesh check I can do. Or maybe there's some other better way of doing this.

Thanks for the help guys.

sentences:
Workflow for authoring Pokémon-like game database content I'm programming on a game that relies on a database for a lot of the creatures and items in the game (think Pokémon).
Currently, we have a Google Sheet that the designers are making. They will be using it to populate all of the items necessary for the game, so it acts as a 'source of truth'. However, to translate this into the database (SQLite) we'll need to write some code to pull the data, format it and put it into the database. The maintenance of this will also be pretty annoying, as we already need to maintain the database schema and the code representation (Unity C#). DB tables are can be static or dynamic, and the implementation on the Unity side for the DB is not an issue.
Before writing this code I'm exploring other options. I've looked into Microsoft Access (and similar programs) but they seem to be geared towards making applications now and don't have much in the way of SQLite integration.
I'm leaning towards using a visualizer tool like DB Browser for SQLite or SQLiteStudio, but the lack of cloud syncing might mean a janky solution with Google Drive or AWS.
I'm looking for a workflow that:

will be accessible for game designers (who have little to no SQL experience, but willing to learn)
will keep changes between designers synced
will be easy to manage and maintain for the codebase and SQLite database.

How can we solve this problem?

sentences:
Best practice for toggling between ragdoll and CharacterController One feature of the game I'm working on is that if a character is hit with a certain amount of force, it will temporarily ragdoll, then get up off the ground after a small period of time. This character is moved by a CharacterController (CC) component. At the moment, I have the model as a child of an object with a CC component and movement script. My issue is that when the ragdoll is activated/animator is disabled, the model moves independently of the CC - if it ragdolls with some arbitrary force in any direction, the CC does not move with it (as you'd expect). This would be fine if the ragdoll wasn't meant to be re-enabled, but it is. At this stage, the model teleports/moves to where the CC is, and it looks very weird.
I have tried a few different methods to synchronize the two:

Decoupling the CC and model. Both objects are children of a shared parent, and I added them both to an PhysicsIgnoreLayer (for now - eventually if I go with this I'll probably add all the ragdoll colliders to an array and ignore them individually). When the ragdoll state is enabled in the parent, the CC is disabled and the object is teleported to the root bone every frame. When the CC is enabled, the model is teleported to the CC object every frame. See here. The issue here is that setting the position means extra Update() calls and it lags behind the controller a little. Also, because the model isn't a child of the controller, it doesn't inherit the velocity of the controller, so it needs to be manually applied.
Changing the parented GameObject at runtime. Depending on the state of the character, the CC/model will be parented to each other - if the CC is active, the model is set as its child and vice versa using SetParent. I couldn't get this one working (the local position variable was a little confusing to me, but no configuration I tried worked for me).
Conjoined CC and model. I placed the CC on the same object as the model. This isn't really ideal for me because I want greater control over the rotation and presentation of the model. I couldn't get this one working either - I don't know how I could set the position of the CC without moving the whole thing.

Is there a more effective way of doing this? If so, what? I feel like I am greatly overcomplicating this. Any help would be great. In an ideal situation, I could have the model as a child of the controller (or behave that way) and move the CC when it is inactive without affecting the model position.

sentences:
Confused about this Timer function C++ I am confused about the argument "m" of this function.

I also need to know how to make this work. I am working on a simple 2d game and I am really new to programming.
I don't know how to make things work in this Timer() function. I want to animate an object in a specific direction. I know the coordinates of the direction but after a lot of hit and trial, my object moves in a random direction. I have used sin and cos for the movement. But  my real problem is about the functionality of this Timer() function. Can anyone here help me about it? Any help will be appreciated.

float dt = 0, lastframe = 0;

void Timer(int m) {
    dt = (m - lastframe) / 1000.0;
    lastframe = m;

    glutPostRedisplay();
    glutTimerFunc(1000.0 / FPS, Timer, m + 1);
}

sentences: How to use 3 cameras simultaneously in Unity I'm working on a project that requires 3 panels, each rendering a game object.  There will be a search box and when the player enters a string, that key word will zoom to the tagged location on the each object in the 3 panels. How can I go about accomplishing this?

sentences:
How do I make "weaponsclash" = animations adapating to parameters Meaning: how do I build my animations/system so that I can have swords blocking each other?
I honestly believe this is the hardest part of a game: I need animations to interact with each other. If a monster uses attack 1 on hero 2, then both NPCs have to play a different animation based on,

A, How big these NPCs are. I need them to be able to be scaled (monsters can grow, but when it jumps on a small player, it still has to look just as fitting as with other sizes)
B, Speed of the monster when it runs up for the attack.
C, Countless other things I suppose.

How do I achieve this? KI, Pathfinding... all that is meaningless unless I can build a believable combat system.

sentences:
Working with lots of cubes. Improving performance? Edit: To sum the question up, I have a voxel based world (Minecraft style (Thanks Communist Duck)) which is suffering from poor performance. I am not positive on the source but would like any possible advice on how to get rid of it.

I am working on a project where a world consists of a large quantity of cubes (I would give you a number, but it is user defined worlds). My test one is around (48 x 32 x 48) blocks.

Basically these blocks don't do anything in themselves. They just sit there.

They start being used when it comes to player interaction.

I need to check what cubes the users mouse interacts with (mouse over, clicking, etc.), and for collision detecting as the player moves.

Now I had a massive amount of lag at first, looping through every block.

I have managed to decrease that lag, by looping through all the blocks, and finding which blocks are within a particular range of the character, and then only looping through those blocks for the collision detection, etc.

However, I am still going at a depressing 2fps.

Does anyone have any other ideas on how I could decrease this lag?

Btw, I am using XNA (C#) and yes, it is 3d.

sentences:
How is the render() method called in libGDX? I know that the project generator in libGDX finds the render(deltatime) method in my Game project and make it into a game loop so that it repeats itself on an average of 60 times per second. But I want to know how exactly the project generator finds the render() method.

Let me give you an example:

In my game, in the Main class, I declared a SecondClass with its own render() method using its constructor in the create() of the Main class. Then, I didn't have any render() method in the MainClass. When I did this, the render() in the SecondClass worked. However, when I created the render() method in the MainClass, the render() from the MainClass worked but not the render() method in the SecondClass. Does that mean that the project generator access the first render() it can see as the GameLoop?

sentences:
Libgdx switching between screens without losing Information I've been having issues with Screens, as I want to switch between the main game screen, the battle screen and the ingame menu screen (JRPG). The problem is that I have initialised all the information (Position of Player and NPC's, Map data, Sava data, etc) in the Show() function of the screen. That means that when I switch between 2, it will rebuild and reload everything all over again. There is also no Create() function in Screen so I'm at a dead end right now. Is there a way I can reserve data or draw the other screen on top of the main game screen, pausing that one?

I really need help with this.

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: 3D Game Engine comparable to UDK that's not GPL'd Are there any good, free 3D game engines similar to UDK that are under open-source licenses without copyleft provisions?

sentences:
Compute Corners of Cuboid In 3D How can I compute the eight corners of a cuboid given a Depth and Height and two points: A(x,y,z) and B(x,y,z)?

Is it possible to calculate the eight corners/points of a cuboid given only a limited data? I'm trying to make a cuboid with only two 3D vectors by computing the eight vectors.

sentences:
Can a sprite be rendered with thickness in Unreal Engine? Is there a convenient way to have a 2D pixel art image with clip transparency (not partial transparency) rendered with thickness in Unreal Engine? Paper2D does exactly what I want, except it's a flat plane.

I'm able to achieve the effect by making an SVG outline and using Blender to make a model and map UVs, then import that into Unreal, but it seems like a lot of steps for a somewhat simple model. I am new to both of these tools and models in general, so I may be missing something obvious.

sentences:
Where can I find resouces for developing an "Intro to Game Development" class at a Community College? I am an adjunct professor at a technical College in South Carolina.  I currently teach courses in .Net programming and Oracle PL/SQL.  We’ve noticed an influx of students who want to learn more about computer programming and game development in particular.   Their main interest stems from their experiences with video games.  I am a pretty good programmer and have done some simple 2D games in the past.

Now I have been asked to look at possibly developing an "Intro to Game Programming".  The state actually allows the topic to be covered as an accredited course, just hardly any of the schools offer or have faculty that can instruct in the class.
So, I am looking for advice/resources on how to structure the class.  My initial outline is the following.

I plan to use Visual Studio Express C# Edition with XNA Game Development.  The XNA platform is very popular and allows a familiar environment for students and it is FREE!  I am personally a fan of Torque, but my students will all have been introduced to Visual Studio (via prerequisites) by the time they take this class, and I believe Torque will incur extra fees for them if they want to take work home and work outside the lab.
Keep it simple – Input with Controls, 2D side scrolling, character and object animation,  pong type games, basic sound effects and simple collision detection problems.  Being an Intro class and students having to learn C# as they go, I can’t see trying to make this too intensive.

So, now the heart of my question – has anyone done this?  What is the best book to use to teach XNA in a class room setting?

Should we try to write from scratch at the very beginning or go with a basic working game and teach the parts and then have them modify and improve as the semester goes along?

I also feel I need to make it team oriented and make the teams compete with a final demonstration of their games to be voted/reviewed by random selection of students and faculty.

Also, does anyone know of a program/business partnership where I could possibly be lent or given free hardware to use?  Over 90% of my students are full financial aid (Cheraw, SC is very economically depressed) so I need access to game controllers, etc.  Also, the computers we currently have (and budgets keep getting trimmed ) currently run Windows XP and not looking to be upgraded for at least another 2 years.  So an opportunity to borrow some higher end machines would be great along with maybe and Xbox 360!

Also, I am open to using a platform other XNA, but I don’t want to get technically deeper than XNA – therefore going straight against DirectX with C++ is out of question.  Also, it has to be free at least for educational usage.

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:
Automating repetitive game development tasks Disclaimer: this is an open-ended and kinda "far out" question

Over the last few years I've made a few iPhone games.  I use very common programs like Xcode and Illustrator to make the games.

Lately I've become tired of repeating certain tasks over and over again.  Here are some examples:

in Xcode: "clean target, build, run" over and over again
in Xcode: delete image resources and then import updated image resources (identical names)

I'd like to automate these tasks in Xcode.  Any ideas?  I've done some automation in Photoshop using the "button mode" thing where you record a macro... that's been very useful.

Here's the kinda wacky or "far out" part of the question:  how can this automation be done via voice commands?  (perhaps using a Nuance product or something)

Here's an example of what I'd love to do via a few voice commands:

Save artwork from illustrator at a user-specified size (@2x versions as well)
Delete "someArt.png" and "someArt@2x.png" from Xcode
Add the updated versions of someArt.png to Xcode
In Xcode:  clean target, build, and run

I know this question probably seems bizarre...  but something like this could make certain things substantially easier for game developers.

Edit: wonder if a combination of AppleScript and Nuance might work?

sentences:
Handling User Input Based on the Current Game State currently i'm developing a 2D game in my spare time and i'm confused on how to handle the input from the player.

Currently my game uses the state design pattern, each game state is a different object such as Inventory, Playing, Paused etc. All of these states implement an interface called State that have a Render and Input method that is called on whatever the "Current state" is in the game engine.

So my question is would you use multiple key listeners or key bindings, one for each state since the input the player will do differs dramatically between the different game states or would you use one key listener or keybinding somehow? Is there a best practice for this?

Thanks.

sentences:
Ambient occlusion of cubes, a specific case After much fiddling around and thinking I've got my AO working on my game engine as intended; except one specific case.

When a block is nestled between others on two sides, but the corner block is missing, that corner doesn't get occluded. This isn't too shocking, because there's no logic to do otherwise. However, I can't think of a way to neatly solve that case. If I make it detect a block on each pair of sides, then check for the corner piece, we will end up with lots of broken AO in various scenarios, and that will be a lot of checks to boot.

Here's the table I came up with today which finally solved the missing bits of my AO algorithms:

Click for larger view

The logic in my code (C# MonoGame) essentially enforces this table.

If nobody comes up with anything better, I'll put a series of booleans in the checks for each side, then run through each combination and adjust as though a pair of side block were the corresponding corner block.

sentences:
How to create walls and rooms with Pixi I'm a JS dev but pretty new to Pixi and 2D developemnt so please bear with me as I explain this.

I want to write a simulator for short path finding (for evacuation purposes). I decided to use Pixi.js for this since it seems capable of doing everything I need to do. I followed this tutorial to try to learn how Pixi works and if its right for this.

The tutorial didn't seem to answer many questions I have and I still have some confusion. Before I dive into writing the code, I want to know how wall detection in Pixi acheived.

Take the below map for example:
It is a 800 x 800 png file (where everything but the blue is transparent[no grid lines]) that i can load into Pixi as a Sprite. I created it in Tiled editor. So it can be exported as a tilemap, JSON, CSV etc. When I export it as JSON, here is the file contents: https://pastebin.com/zGh1XmR7

The blue boxes represent walls.
I want to load in other various sprite objects so that it will look like this:

The people in the simulations cannot cross the blue walls and they cannot cross the pink circles (they represent danger zones). I intend to use easystar.js to find the shortest path to exits for the people sprites in the map.

So my question is this, how does Pixi recognise the blue walls? Is it something I have to do when creating the tileset png? Like something defined in the JSON file for the tileset atlas? Maybe SVG? Or is there a pixi function to do this?
Is this the best approach to doing this and is Pixi even the best way to do this?

I'm looking for a tried and tested solution or a pointer in the right direction.

sentences:
How do I fix this "java.lang.ClassNotFoundException" error? I received my first crash report via the Google Developer Console, yesterday, and I'm completely lost.

This is my error message:

  java.lang.ClassNotFoundException: Didn't find class "com.unity3d.player.UnityPlayerNativeActivity" on path: DexPathList[[zip file "/mnt/asec/com.JamaludineDolley.NinjaBallDash-1/pkg.apk"],nativeLibraryDirectories=[/vendor/lib, /system/lib, /vendor/lib]]

How do I fix this java.lang.ClassNotFoundException error?

sentences:
When should new threads be created in a game or how should time consuming task be handled? This has been a question that has always troubled me while thinking about the code and logic behind gaming, I was wondering when and when not, is it appropriate to create new threads for different tasks or how should I handle long tasks that could potentially freeze my game?

The first situation I could think of would be the rendering and the update loop. My thought behind this is that keeping these two seperate would prevent update problems because of a low frame-rate so even if the frame rate is changed there would still be a consistent update cycle.

The second situation is somewhat more specific and is just an example but say my game has multiple building components that can be placed over the world and my game updates them every second or so to check maybe if they are floating (if they have physics) or maybe if it's environment has changed, should this update cycle also be in another thread because it could take a long time?

How about if I was pinging a client, would my server not freeze whilst waiting for a response? Is this another situation where threads should be created? or is there another technique that I should be using to enhance performance and efficiancy?

sentences:
How can I optimize this flood fill algorithm? I'm creating a sprite and animation editor like this one. I'm having performance issues with my flood-fill algorithm.

Basically, I open an image with the different modules that are part of a frame of an animation. When I double-click a module I run a depth-first search algorithm that checks all the pixels of that part of the image that are surrounded by transparency. From that I get the rectangle of said module (the position and size). With large images, when I double-click that part of the image the application freezes.

How can I improve my algorithm?

Right now what I do is maintain an array of already-checked pixels and a list of pixels to check. I start with the pixel that I double-clicked and check if the surrounding pixels have transparency. If they do not, I check for the surrounding pixels of those pixels and so on until all the surrounding pixels are transparent. Then I can get the minimum and maximum position in the X-axis and Y-axis and use that to construct the bounding rectangle of the frame.

This is my code:

private Rectangle widthSearch(int posX, int posY)
{
    Rectangle result = new Rectangle();
    int leftX, topY, rightX, botY;
    leftX = rightX = posX;
    topY = botY = posY;

    List<Point> closedList = new List<Point>();
    List<Point> toProcessList = new List<Point>();

    Point processingNode;
    Color colorAux;
    int alphaAux;
    int offsetX = 0;
    int offsetY = 0;

    toProcessList.Add(new Point(posX, posY));

    int[] dx = { 1, 1, 0, -1, -1, -1, 0, 1 };
    int[] dy = { 0, -1, -1, -1, 0, 1, 1, 1 };

    while (toProcessList.Count > 0)
    {
        processingNode = toProcessList.ElementAt(0);
        closedList.Add(processingNode);
        toProcessList.Remove(toProcessList.ElementAt(0));

        for (int i = 0; i < dx.Count(); i++)
        {
            offsetX = dx[i];
            offsetY = dy[i];
            try{
                if (!closedListContains(closedList, processingNode.X + offsetX, processingNode.Y + offsetY) && !closedListContains(toProcessList, processingNode.X + offsetX, processingNode.Y + offsetY))
                {
                    colorAux = bmp.GetPixel(processingNode.X + offsetX, processingNode.Y + offsetY);
                    alphaAux = (colorAux.ToArgb() >> 24) & 0xFF;
                    if (alphaAux > 0)
                    {
                        toProcessList.Add(new Point(processingNode.X + offsetX, processingNode.Y + offsetY));
                    }
                }
            }
            catch (Exception e)
            {
                Console.Write(">>>>>>>>\n" + e + "\n>>>>>>>>>");
            }
        }
    }

    for (int i = 0; i < closedList.Count(); i++)
    {
        if (closedList.ElementAt(i).X > rightX)
            rightX = (int)closedList.ElementAt(i).X;
        if (closedList.ElementAt(i).X < leftX)
            leftX = (int)closedList.ElementAt(i).X;
        if (closedList.ElementAt(i).Y < topY)
            topY = (int)closedList.ElementAt(i).Y;
        if (closedList.ElementAt(i).Y > botY)
            botY = (int)closedList.ElementAt(i).Y;
    }

    result.X = leftX;
    result.Y = topY;
    result.Width = rightX - leftX;
    result.Height = botY - topY;

    return result;
}

private Boolean closedListContains(List<Point> closedList, int posX, int posY)
{
    Point pointer = new Point(posX, posY);
    for (int i = 0; i < closedList.Count(); i++)
    {
        if (closedList.ElementAt(i).Equals(pointer))
            return true;
    }
    return false;
}

I only call the widthSearch() method when I double-click a PictureBox. It is not inside a loop.

sentences:
What exactly is different between a string and an FString in Unreal C++? Sorry, maybe a noob question, I did a quick google search and couldn't find what I was looking for.  I have two related questions about FString.

Does regular C++ Have this, or is this an Unreal term.  (I know python has a variable called FString).

What makes FString different from the String variable?

thnx.  It's not very necessary for development, but I'm just curious why Unreal uses FString instead of String.

sentences: Mesh vs LineRenderer Performance I've created a script, which is drawing a line along a bezier curve, so that I can animate whatever I want with lines, mostly for UI purposes. For the moment I'm using a line renderer, which works, but the performance is not that great in my opinion. So I was wondering if there are actually some better methods to draw lines, like simply creating a mesh along the path I've got.

sentences:
Algorithm for continuously generating a tile map for a topdown 2D game? In essence, what I'm looking for is a procedural 2D tilemap continuously generated in a fashion like Minecraft - which is to say generated as the player approaches the edges of the already explored parts of the map. Map is going to be for a topdown 2D-shooter and the purpose of the map is mostly just for background and determining types of enemies and loot to spawn, so it really doesn't need to be very complex.

I've already researched some into the topic, but most of the answers have honestly been a bit too complicated or seemingly made for pregenerated maps.  Voronoi Diagrams and Simplex Noise, while impressive, I don't really understand how to implement in a continuous fashion in realtime. Or at all, really.

What I'm imagining with the generator would be to create simple biomes, composed of two values determining its 'artificiality' (i.e. how man-made the biome is) and 'life' (which is how populated it is). An example would be a city, with high values of life and artificiality both. The values for each would be skewed towards that of its neighbour to ensure that you don't have completely random values. It'd probably be a good idea to ensure that a 'biome' doesn't get too large too, by limiting the amount of tiles?

My question is, are there any better or simpler algorithms to use for something like this beyond Voronoi and Simplex? The game is programmed in C#, I feel I should mention.

sentences:
Tiled height level collision I have created the below tilemap in tiled and I am wondering about a good approach to "separate" these two different heights in the map. I would like to keep it tile based, so adding a object layer for collision detection is a no for me.

I would like the player to move from the low ground to high ground using the ladder. But as you can see, two walkable tiled adjacent to each other should not be "connected" since they are on different heights.

Since I can only add properties to the tile in the sheet and not on the map itself afaik, I cannot mark the heights on my map. So I guess I have to work with different layers for each height. Check if the layer the player currently on has a tile or something, if that is even possible.

The reason I do not want to use a object layer is simple. My creatures move from tile to tile and I just want to check if that tile is walkable and on the same height level. No need to test vs a rectangle or polygonal object.

What I am actually looking for is having properties per coordinate. This would make it a lot easier (pseudo code):

tileMap[x][y].floorCount;
tileMap[x][y].walkable;

instead of:

map.getLayer(player.currentLayer).layerMap[x][y].tileExists;
map.getLayer(player.currentLayer).layerMap[x][y].walkable;

I simply cannot add properties to a "global" tile (tiled seems to only allow me to add properties to the tile on the sheet which is carried over to every usage of it. This image uses that same corner tile as in the above image, only this time the player is allowed to cross it, or perhaps hop over it.

sentences:
Reconstruct Quaternion from 48 bit rotation data I'm trying to reverse an animation file from a commercial multiplayer game, whose format was recently updated. The problem lies within joint rotation information, which changed from a 128bit format to a 48 bit format.

The old format actually was using a quaternion representation with 32 bit floats for each component (32 * 4 = 128 bit)

The new format was probably added for quantization purposes (serving better multiplayer performance). I played around trying to apply an euler angle representation (3 x 16 bit integers or 3 x 16 bit half floats) but i failed miserably so I think it should be still a quaternion representation of some sort.

I have located a model which has not changed at all structurally but obviously the model files have been updated to the newest format.

So I do have the byte data, I know the correct rotation angles (again from game data) that correspond to those values as well as the quaternion values from the old version of the files.

New Format Bytes       Rotation(deg) X,Y,Z       Quaternion
41 ED 3F ED 41 6D      0, 90.0, 89.99             0.5, 0.5, 0.5, 0.5
85 F7 2C A0 85 77      59.64, 90, 0               0.3516, 0.61347, -0.351634, 0.61347
AE CE FF BF FF 3F      -180, 0, 18.54             0.98 0.16 0 0
40 ED BE 92 BE 12      0,-90,90                   0.5, -0.5, -0.5, 0.5
DE 40 DA 42 CA 3C      -1.017, -3.633, 4.091      -0.009633918, -0.03154902, 0.03542599, 0.9988277

I'm currently searching the web for quaternion quantization techniques and I'm experimenting with different stuff, so if I find anything I'll make sure to update. Thanks in advance

sentences:
How can I render fonts in a game with correct hinting? I've used angel code's bitmap font generator quite a bit; though it's very good, I wonder if there would be a way to use the hinting information to provide a better and more readable result, by using hinting to provide differing thickness based on size/pixel coverage.

I imagine any solution would have to use the distance field tech presented in the valve paper on smoothing fonts while maintaining or reducing asset size. I haven't found any demos of it being used with hinting information turned on, or included in the field gradients in any way.

Another way of looking at this is whether there are any font bitmap generators that will output mipmaps that still maintain their readability in the face of pixel size. I think the lower mip levels would try to guarantee fill and space where it is necessary to maintain readability/topology over maintaining style/form; the point of hinting.

Is there a reason you can't just render the size you want?

The problem lies in the fact that font rasterisers currently don't render in 3D, and hinting information would be important in different amounts, due to the pixel density being different along different axes; even differing in importance along the length of a string, due to the size reducing over distance. For example, I only want horizontal hinting in a texture that is viewed from the side, and only really want vertical hinting in a font that is viewed from below or above. This isn't meant to be a renderer that tries to render a perfect outline as accurately as possible, as hinting distorts the reality of the font; instead, this is meant to be a rendering solution for static scenes, where the scenes use 3D transformed and warped text layout. In this case, the legibility is important; more important than the accuracy of representation of the polygon shape.

sentences:
Why do I get this compile error when using InputComponents in UE4? I'm following this documentation, but it doesn't compile cause of "InputComponent". Unfortunately the error is not that clear even in my language.

Here's the error:

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

Here's the code:

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

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

This is the definition of the method MoveX():

void APlayerTile::MoveX(float AxisValue)
{

}

sentences:
Limiting x and y movement so you can't go off camera So I want to make an on rails shooter like that of Star-Fox in the Unity engine. What I would like to do is limit the ship from moving off the screen. You move along the X and Y axis so i wont have to keep these invisible colliders in their place but I cant get another way to work.

and I know I have to find a way to convert camera space to world space I just can't find a way how.

This is my current controller and I commented a few failed attempts.

also I'm using a perspective camera and I'd like to keep the rigibody movement if possible.

public float turnSpeed = 10;//Horizontal

//private Vector3 moveDirection = Vector3.zero;

public Rigidbody rb;
void Start()
{
    rb = GetComponent<Rigidbody>();
}
void Update()
{//Screen.width
    //transform.position = new Vector3(Mathf.Clamp(transform.position.x, -holdMyRatio, holdMyRatio),
   //                                  Mathf.Clamp(transform.position.y, -holdMyRatio, holdMyRatio), 0);
    //CharacterController controller = GetComponent<CharacterController>();
    rb.AddRelativeForce(Vector3.right * turnSpeed * Input.GetAxis("Horizontal"));
    rb.AddRelativeForce(Vector3.up * turnSpeed * Input.GetAxis("Vertical"));
  //  moveDirection.x = Input.GetAxis("Mouse X") * turnSpeed;// * Time.smoothDeltaTime;
   // moveDirection.y = Input.GetAxis("Mouse Y") * turnSpeed;// * Time.smoothDeltaTime;
  //  controller.Move(moveDirection * Time.smoothDeltaTime);
}

sentences:
Rendering text with SDL2 and OpenGL I've been trying to have text rendering in my OpenGL scene using SDL2. The tutorial I came across is this one Rendering text

I followed the same code, and I get text rendering fine. However the issue I'm having is that there is obviously a "conflict" between the OpenGL rendering and the SDL_Renderer used in the code. When I run my scene the text displays but everything else keeps flickering. The following gif shows the issue:

Any idea on how to overcome this while still just using SDL2 and OpenGL, not another library or anything.

Thanks

sentences:
How do I create an infinite tower So I had this idea of creating a 2D game where the player would just climb a tower the furthest he could.

I do already have a camera and a scene class somewhat ready, but I'm not sure how I would add the side sprites and make it so I dont use all the memory on the 10th update.
Could anyone please shed some light on this?

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:
Unity Unable to blend 2D Light renderers I've followed the documentation on Unity regarding 2D lighting. It said to turn on Alpha blending in the options. But this is how it turns out:
If Alpha blending is off:

If Alpha blending is on:

I'm not entirely sure why it's turning black. These are my settings for the 2D light:

I've checked my layers, specifically the tile map floor, and it's on the Default layer.

I just want my lights to blend well.

sentences:
Shapes and sprites in SVGs I understand SGV images are used in 2D games to store shape data for the physics engine of the game. I'm unsure though, should the raster sprite also be stored in the SVG or should it be separate?

Also, what about animated sprites? In a non-skeletal-based animation system, how should the shape of the character be handled? Is a simple rectangle enough?

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:
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:
How can I use pan gestures to zoom a camera in and out I have the following scene tree for my player:

They have a Camera2D as a child, which has a script attached to it. How can I make the camera zoom in and out as I pan on e.g. a MacBook trackpad?

sentences:
In Unity, how can I check if an input was made x seconds/frames ago? I'm using the Rewired input plugin, and it comes with an input buffer. I enabled the buffer for my directional keys and airdash button so that the player doesn't have to hit both keys on the same frame in order to dash.

However, this means that if you press both keys and hold them down for more than a frame, the airdash code gets run again. I tried to stop this by comparing Time.time at the beginning of Update() to Time.time at the beginning of the coroutine, but this seems inconsistent and it doesn't feel like the right way to do it.

How would you check for the player's input time and compare it to the time since some previous input?

Here's a sample of the dash code within FixedUpdate()

        //Dash

        if (grounded)
        {
            dashCount = 0;
            dashTime = 0;
        }

        if (dashCount < 2)
        {
            //print(currentTime - dashTime);
            if (currentTime - dashTime < 0.1 || dashCount == 0)
            {
                //Double Tap Dash
                if (player.GetButtonDoublePressDown("Left"))
                {
                    StartCoroutine(Dash("left"));
                }

                //Button Dash
                if (player.GetButtonDown("Dash") && player.GetButtonDown("Left"))
                {
                    StartCoroutine(Dash("left"));
                }
            }

        }

        print(dashCount);

and here's a sample of the coroutine:

    //Dash
    IEnumerator Dash(string axis) {

        dashCount++;

        dashTime = Time.time;

        if (axis == "left")
        {
            if (inDash == true)
            {
                anim.SetBool("dashUp", false);
                anim.SetBool("dashDown", false);
                anim.SetBool("Hover", false);
            }
            canControl = false;
            inDash = true;
            anim.SetBool("dashHorizontal", true);
            anim.SetBool("inDash", true);
            rigidbody2D.velocity = new Vector2(rigidbody2D.velocity.x, 0);
            rigidbody2D.AddForce(-dashForceHorizontal, ForceMode2D.Impulse);
            rigidbody2D.velocity = Vector2.ClampMagnitude(rigidbody2D.velocity, maxVelocity);
            rigidbody2D.gravityScale = 0;

            yield return new WaitForSeconds(0.2f);

            rigidbody2D.gravityScale = 2;
            rigidbody2D.drag = 25f;
            yield return new WaitForSeconds(0.2f);

            if (grounded == true)
            {
                yield return new WaitForSeconds(0.1f);
            }

            rigidbody2D.drag = 0f;
            canControl = true;
            anim.SetBool("dashHorizontal", false);
            anim.SetBool("inDash", false);

            inDash = false;

            yield break;
        }
  }

sentences:
Modern OpenGL Sprite Drawing - Not Rendering I'm trying to render sprites based of this tutorial, in LWJGL.

Here's what I have so far, with descriptions of what class I use:

Transformable2D is a class that holds transform matrices meant for 2D rendering, and Drawable is just an interface that has a draw() function.

Texture is a container for loading and creating Textures, and its bind function just sets the active  texture to it's ID and binds itself to the passed unit parameter.

SpriteTechnique is a container for a shader program, and I will paste the shaders here too, although they are the same as from the tutorial.

I make the shader and vao static, because every Sprite uses the same vao and shader.

Finally, I pass a View to the draw() function, which holds the necessary info to make an orthogonal matrix based off the transforms of the object. This matrix is correct, as I also use it for text rendering, where it works as expected.

All of  the classes described above work completely; I am 100% sure the problem is not within the backing classes. Here are the GL settings I set in my backend, too:

glFrontFace(GL_CW);
glCullFace(GL_BACK);
glEnable(GL_CULL_FACE);
glEnable(GL_DEPTH_TEST);

So, onto the actual class:

public class Sprite extends Transformable2D implements Drawable {

    private Texture texture;

    private Vector3f color;

    private static SpriteTechnique tech = new SpriteTechnique();

    private static boolean isRendererInitialized;

    private static int vao;

    public Sprite(Texture texture) {
        this.texture = texture;
        color = new Vector3f();
    }

    public static boolean initRenderer() {
        if (isRendererInitialized) {
            return true;
        }

        if (!tech.init()) {
            return false;
        }

        float[] vertices = {
            // Pos      // Tex
            0.0f, 1.0f, 0.0f, 1.0f,
            1.0f, 0.0f, 1.0f, 0.0f,
            0.0f, 0.0f, 0.0f, 0.0f,
            0.0f, 1.0f, 0.0f, 1.0f,
            1.0f, 1.0f, 1.0f, 1.0f,
            1.0f, 0.0f, 1.0f, 0.0f
        };
        FloatBuffer vertexBuf = BufferUtils.createFloatBuffer(vertices.length);
        vertexBuf.put(vertices);
        vertexBuf.flip();

        vao = glGenVertexArrays();

        glBindVertexArray(vao);

        int vbo = glGenBuffers();

        glBindBuffer(GL_ARRAY_BUFFER, vbo);
        glBufferData(GL_ARRAY_BUFFER, vertexBuf, GL_STATIC_DRAW);

        glEnableVertexAttribArray(0);
        glVertexAttribPointer(0, 4, GL_FLOAT, false, 16, 0);

        //glBindBuffer(GL_ARRAY_BUFFER, 0);
        //glBindVertexArray(0);

        isRendererInitialized = true;

        return true;
    }

    @Override
    public void draw(View v, RenderStates states) {
        if (!isRendererInitialized) {
            System.err.println("Sprite renderer must be initialized before drawing sprites!");
            return;
        }

        tech.enable();

        tech.setTextureUnit(COLOR_TEXTURE_UNIT_INDEX);
        tech.setColor(color);
        tech.setProjection(getOrthoTrans(v).getMatrix());

        texture.bind(COLOR_TEXTURE_UNIT);

        glBindVertexArray(vao);

        glDrawArrays(GL_TRIANGLES, 0, 6);
        //glBindVertexArray(0);
    }
}

Here are my shaders:

Sprite.vs:

#version 330 core
layout (location = 0) in vec4 vertex; // <vec2 position, vec2 texCoords>

out vec2 TexCoords;

uniform mat4 gProjection;

void main()
{
    TexCoords = vertex.zw;
    gl_Position = gProjection * vec4(vertex.xy, 0.0, 1.0);
}

Sprite.fs:

#version 330 core
in vec2 TexCoords;
out vec4 color;

uniform sampler2D gSpriteTexture;
uniform vec3 gSpriteColor;

void main()
{
    color = vec4(gSpriteColor, 1.0) * texture(gSpriteTexture, TexCoords);
}

When I try to render a Sprite, however, nothing appears on the screen. Not even a black quad. I've tried to scale the quad, but to no avail. What am I doing wrong here?

sentences:
Constantly interpolated splines Trying to implement a movement through a curve - I'm trying to find a type of curve/spline that interpolates constantly. What I mean: when I interpolate from t=0 to t=0.1, I want it be the same distance as when interpolating from t=0.1 to t=0.2. And I want it to happen for every delta t on the spline.

I dont' want to make lookup tables that map the interpolated values to distances in order to save the memory. Does anybod knows are there any kind of such mathematical constructs?

I could do a in depth research, but as far as I can, I dont wan go to deep into details. It would be great having some simple formula.

sentences:
How to use world coordinates I am quite new to game development (but not programming) so please forgive me if I am not correctly understanding certain concepts.

I am trying to figure out how to use world coordinates rather than pixel coordinates so that my game can work correctly at different resolutions. As I understand it, I need a viewport and I can use camera functions such as project() and unproject() to convert between the two coordinates. At the moment, I am just placing objects every 16 pixels as this is the size of objects and the objects cannot intersect.

For example:

The bottom left block is located at pixel (0, 0), the one to the right at (16, 0), to the right of that is (32, 0), and so on. However, I would like to be able to place them at (0,0), (1, 0), and (2, 0) with the same result so that it looks the same on different resolutions.

Basically, I'm asking how to set this up and have it work properly as world coordinates.

sentences:
What game systems exist which uses camera input? The group and I is in the middle of a semester project where we are currently researching on which game systems are using camera as input or as an interactive medium?
We would like some help listing some of the game systems which uses camera input, as it seems hard to find other examples.
Currently we know that webcam browser games uses camera input (Newgrounds webcam games), as well as the xbox kinect.
I know this questions seems rather vague, though I still hope some people is capable of helping.

sentences:
Copy velocity of one object to other object I have a script to pick up items with a VR controller. I connect the object to the VR controller through a FixedJoint on a rigidbody attachPoint. When I drop an item through destroying the Joint however it plummets straight down to the ground, no force from the controller is transferred to the released object. Thus I can't throw the object.

I tried it using the AddForce() method. attachPoint's velocity is the controller's as it is a child of the controller. Relevant code below.

Can someone help me with transferring the velocity of the controller at the time of release to the object just released?

Thanks!

public class PickupCarryRelease : MonoBehaviour {

    public Rigidbody attachPoint;

    FixedJoint joint;
    GameObject obj;
    Collider grabbedObjColl;

    void Update()
    {
        Release();
    }

    void Release()
    {
        var device = SteamVR_Controller.Input((int)trackedObj.index);
        if (canGrab && joint != null && device.GetTouch(SteamVR_Controller.ButtonMask.Trigger))
        {
            var obj = joint.gameObject;
            var rb = obj.GetComponent<Rigidbody>();

            grabbedObjColl.isTrigger = false;
            rb.detectCollisions = true;

            //Transfer velocity

            Destroy(joint);
            rb.AddForce(attachPoint.velocity, ForceMode.Impulse);
            StartCoroutine(GrabDelay());
        }

    }
}

sentences:
Correct way to calculate Perspective Matrix I have seen at least 3 different ways to calculate the perspective matrix and I'm confused as to which one I should be using and what the differences are?

OpenGL says to do it this way:

f = cotangent(fov * 0.5)

f / aspect, 0, 0, 0
0, f, 0, 0
0, 0, (far + near)/(near - far), (2 * far * near)/(near - far)
0, 0, -1, 0

glm does it this way:

range = tan(fov * 0.5) * near;
left = -range * aspect;
right = range * aspect;
bottom = -range;
top = range;

(2 * near) / (right - left), 0, 0, 0
0, (2 * near) / (top - bottom), 0, 0
0, 0, (far + near) / (far - near), -1
0, 0, (2 * far * near) / (far - near), 0

sentences:
How is AI most commonly implemented in popular games? I'm no gamedev, I'm just a curious coder of not-games. I wonder, how does AI work in popular modern games, say, FPSs? Is it based on hard-coded rules? How much does it have in common with other kinds of AI (like the one which powers autonomous cars etc)? How do developers ensure the AI behaves naturally and is fun to play against?

Stuff I've googled mentioned different derivatives of MinMax but failed to answer how AI deals with continuous, changeable world, for what actions/states AI is rewarded and how it figures out its chance for success of different actions. I've also seen Machine Learning mentioned here and there but it seems it's not used in any serious game?

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:
Dissolve object starting from the bottom I'm currently getting into using the new "Unity Shader Graph"s and have made an OK dissolve shader that looks like this:

My next goal is to move this effect so the object dissolves bottom-up. This is where I'm stuck. I tried blending this effect with another effect that just fades the object from the bottom up but this does not create the effect I am looking for (#1 is the fade effect, #2 is the two shaders blended together):

The end effect should look something like this:

How can I achieve this effect? Answers do not have to be specific to Unity and a good answer should include the thought-process to creating this effect, not just code or pictures of a shader graph.

sentences:
Screen tearing in emulator I'm trying to make a game boy emulator, and I'm using Windows for the graphics (StretchDIBits).
I'm getting screen tearing like this. I tried enabling vsync in graphic settings but nothing changed.

This is how I'm doing my timing in the end of my main loop.

if (cpu.T >= CLOCKSPEED / 40)
{
    if (MSpassed < 25)
        Sleep(25 - (int)MSpassed);
    MSpassed = 0;
    cpu.T -= CLOCKSPEED/40;
}

CLOCKSPEED is the number of emulated CPU cycles per second.
cpu.T is how many cpu cycles passed until now. MSpassed is in milliseconds. I'm measuring it with QueryPerformanceCounter.

Is the problem in the timing, the way I'm doing my graphics, or somewhere in the GB specific code?

sentences:
text wrapping on a texture applied to a 3D model How would I create and implement a texture of text that wraps around a 3D model? The texture will just be white and you should be able to add text to it, but I need to create this so that when the texture is wrapped around a model of a person, the person is then composed of lines of text and the lines should not be distorted.

In my head the way I would do it is to put the flattened texture in a file, and draw text on to it. Is this the best way? are there any issues that I'm unaware of that I might come across?

sentences:
How to split 2 teams for a FPS death match game in Unity? I'm making a playable one level only FPS death match game in Unity. I'm in the part where the AIs now can find and shoot their own target and keep looping to find targets until nothing left. Every AIs and including player were tagged with tag "Target" for the AIs to randomly find their target. (I already excluded self finding).

Now I want to split them in 2 teams. And here is the thing that I keep wondering. Should I use 2 tags for 2 teams (like team red, team blue for ex) then make and attach 2 scripts separately for each AI in the team (the logic in the script will be like "team red" will find game object with tag "team blue" and vice versa). Is that how it works? Is there more efficient way or should I say, "smarter" way to work around this problem?

Here is the script if you need to know more about what I am trying to say https://github.com/Bezari0us/FPS_AI_Behaviour

sentences:
Multiple fireballs gml I am programming a bossfight in gamemaker, and I want my boss to shoot multiple fireballs simultaneously, but all in a bit of a different direction, a little bit like this, from rogue soul:
It (obviously) doesn't work, and I have been trying for over an hour.
My script is:

//in the create event of fireball 1
direction = hero + 10
speed = 12

//in the create event of fireball 2
direction = hero + 5
speed = 12

and so on.

It just refuses to work. The fireballs go a completely random direction, independent of where the hero is.

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: Generating random Pools or lakes I have implemented functions that can draw any polygonal shape, however I have been unable to generate a smooth shape that mimics the rounded edges of a lake. I tried generating two circles and joining the edges but there is not enough variation or smoothness to it. Does  anyone have any pointers or ideas that could generate a shape like this?

sentences:
How to draw textured tile map in opengl I am trying to create a textured hexagonal tile map in opengl. I have the VBO and respective index buffer. Additionally I have a texture atlas for texturing individual tiles. I'm attempting to create a distinct texture for each hex without mixing the textures.

I understood that one should use a pair of (U,V) texture coordinates for each vertex. Now if the tile map would not be indexed and have the overlapping vertices, I could just set the texture coordinates for each vertex and get each hex rendering the correct texture. However, with indexing the overlapping vertices are gone and I can only set single pair of texture coordinates for each vertex which results in the textures mixing inside the hexes. Is there a way to texture tiles with indexing or another alternative approach to creating hex maps with different textures?

sentences:
Migrating 2D game from immediate mode to VBOs I am in the process of migrating away from legacy OpenGL calls in my 2D LWJGL game. Previously I would render each sprite using immediate mode, which was dead easy - bind the texture, add the vertices, and it's done.

Now I want to use vertex arrays. Ideally I would put the vertices for ALL my entities in one big array and render it in a single draw call. The problem? Each entity type uses a different texture, and glDrawArrays uses just one texure at a time.

Here are some possible solutions I came up with:

1) Create a separate vertex array for each entity

This is by far the easiest solution, but it somehow seems wrong to me, because it's so similar to using immediate mode. Doesn't this defeat the benefit of using vertex arrays?

2) Create a separate vertex array for each entity type

In other words, all entities that have the same texture will be rendered together. This isn't ideal as it would involve a good chunk of extra work and some extra effort on the CPU to separate the entities by type, and more importantly, would affect the z-ordering of the entities.

For example, it would be impossible to have a Tree that appears in front of one Squirrel but behind another Squirrel.

That is, unless I introduced a depth buffer, but I was trying to avoid this as it adds another level of complexity and, as I understand it, more work on the GPU (although that probably doesn't matter too much).

3) Combine all textures using a texture atlas

If I was able to use a single texture for all entities, I could use a single vertex array. However, there are 2 problems with this:

I have not been able to find a good library for creating a texture atlas at runtime, and writing this code myself would be non-trivial.
I am worried that some GPUs may have a prohibitively small texture size limit.

Summary

Would the first solution be viable / advisable?
Am I being foolish for trying to avoid using the depth buffer?
Am I missing something here? Is there a better solution?

sentences:
Unwanted blendspace bone displacement in UE4 My characters hands "fall off" in the blendspace between the animations.
Looking for a way to fix it, if anyone has any ideas.

sentences:
How can I have a Mecanim animation with displacement and physics? I have 3D wolf models from my animator with displacement (i.e the wolf transforms with animation, not in-place). I have added rigid bodies to the models. I am facing following issues while executing them in my project:

When I turn on IsKinematic on my rigid body (i.e disable physics) the animations work perfectly, with displacement. But I need to have physics enabled on my wolf because it doesn't detect collision when physics is disabled and gravity doesn't have any impact.
When turn off IsKinematic (i.e enable physics), the animations don't work; the wolf start wobbling and flying in the air.

How can I resolve this?

sentences: How to center a game in Flash Projector (like AdamAtomic's CAPSULE) Adam Atomic's game Capsule is a flash projector. If you press escape, the game goes out of fullscreen and just shows windowed. How do I get my (FLIXEL/AS3) game to show up centered like that?

sentences:
How to rotate a whole Bezier Curve around a given point I am using the code from the question Adding functionality to make individual anchor points of bezier continuous or non-continuous to create bezier curves (I added a line renderer).

How can I rotate the whole bezier curve (which may contain multiple cubic Bézier segments) around a point?

Please note that the rotation point could be any point including the one of the curves anchor points or control points.

sentences:
OpenGL tile rendering Currently I'm trying to render a TileMap using OpenGL 2.1, GLSL 1.2.
I would like to draw every tile in just one draw call.
I use a single texture with all tiles, identifying each one by an index.

The vertex data per tile is:

vec2 worldPos; // the position to transform the tile Quad in world coordinates
vec2 texCoord; // the uv coordinates, calculated using the tile index, by CPU (top-left corner).

But I can't find a way to draw everything with one draw call:
    - The uv coordinates can't be calculated in shader because the vertex shader don't know which corner of the quad it is processing.
    - Can't draw by element because my quad vertex data only contains 4 vertices, store repeated vertices is a memory waste. Only if I could use a separate element buffer just for the vertex (0, 1, 2, 3, 0, 1, ...).

Does someone have any suggestion about how should I proceed?
Thanks!

sentences:
Storage and Lookup of Voxel Chunks How can one store chunks in such a way that they can be looked up using their XYZ location without wasting memory?

The problem with a HashMap<Vector3i, Chunk> is that you have to keep creating Vector3i objects, just to use them in the lookup.

I am basically looking for a solution that does not involve the creation of an object to perform a lookup.

sentences:
do i need a deterministic game engine for ball physics multiplayer game? I want to create a simple soccer game but where the ball physics is accurately rendered across the network. I looked at Photon's Quantum engine and it is too expensive for indie devs at 1k/month for only 500 CCU.
Is there an alternative approach? Basically I need the ball physics to be as accurate as possible.

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:
Monogame/SharpDX Texture2D doesn't hold value The problem I have discovered is most likely between classes, so I dont really have much option but to post the whole code here:
https://www.dropbox.com/sh/smyw9t1ap3by2vd/pBX-aJJ-Qx

I have been having some trouble with spritebatches rendering textures recently using monogame for windows 8 with xaml where it throws an error after a few seconds of running. The error only occurs after a few seconds, though the less efficient or more textures i render, the quicker it crashes. After doing a git submodule update, the error message is entirely gone, but the textures still dissappear from the screen leaving just the cornflower blue.

The folks on GitHub have decided that this is a problem with my code and not theirs, which means I am definitely doing something wrong. For reference, here is the issue thread: https://github.com/mono/MonoGame/issues/1927. Thanks for any help!

UPDATE: I have identified the source of the problem. It has to do with declaring and holding the texture.

    protected override void LoadContent()
    {
        _spriteBatch = new SpriteBatch(GraphicsDevice);
        ContentManager myManager = new ContentManager(Content.ServiceProvider, Content.RootDirectory);
        terrainEngine.Load(myManager);
    }

    ContentManager content;
    public void Load(ContentManager content)
    {
        this.content = content;
        blockTextures = content.Load<Texture2D>("Graphics\\Blocks");
        spriteFont = content.Load<SpriteFont>("Graphics\\SpriteFont1");
    }

Now, if I call Load(content) from inside the terrainEngine class Update method, then the program works, otherwise, the textures disappear after a second.

sentences:
Prevent parent alarms to activate a child alarm event I'm working on a small game using Gamemaker Studio 2 and I've noticed that my Parent o_enemy.Alarm[0] Is activating the Child enemy_1.Alarm[0] event.

Both alarms were supposed to be activated under different conditions, (The parent alarm is used for all enemies, but the child alarm is used for the specific enemy) but they seem that they'll activate each other because they share the same name Alarm[0].

I could fix it by setting one of the alarms to Alarm[1], but seeing that I've only a limited amount of 9 Alarms, I think there should be an easier solution to solve this problem.

So far I've tried Event.inherited() on the child alarm, but that didn't solved the problem.

Is there a way that a child's Alarm will ignore the conditions of the parent alarm?

sentences:
Why does my position interpolation code result in "jumpy" motion? I am developing an android game with box2d and use a fixed timestep system for advancing the physics.

However as I use this system it requires the box2d positions to be interpolates. I read this article
and have implemented an interpolation method very much like the one in the article.

The method seems to work nicely on the computer but on my phone the positions of objects are very jumpy. There is of course a big frame rate difference between PC and phone, but I think this algorithm should not mind that.

Here is the just of the code if you don't feel like looking at the article :

void PhysicsSystem::smoothStates_ ()
{
    const float oneMinusRatio = 1.f - fixedTimestepAccumulatorRatio_;

    for (b2Body * b = world_->GetBodyList (); b != NULL; b = b->GetNext ())
    {
        if (b->GetType () == b2_staticBody)
        {
            continue;
        }

        PhysicsComponent & c = PhysicsComponent::b2BodyToPhysicsComponent (* b);
        c.smoothedPosition_ =
            fixedTimestepAccumulatorRatio_ * b->GetPosition () +
            oneMinusRatio * c.previousPosition_;
        c.smoothedAngle_ =
            fixedTimestepAccumulatorRatio_ * b->GetAngle () +
            oneMinusRatio * c.previousAngle_;
    }
}

Does anyone know why my game is acting like this?

Thanks for the help

EDIT:
Here is some logging as suggested in the comments bellow log data

EDIT2 :
This log shows the jumpy effect I think ( you can see the position diff is sometimes positive and sometimes negative - and the object are just falling, it should be constant)log data 2

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:
Unity applying forces using animation I'm trying to make a croquet mallet swing to hit the ball using an animation that rotates the mallet mesh. The mesh appears correctly positioned to hit the ball in the center but the ball doesn't go straight. Using a script with rigidBody.AddForce works fine. I do have Animate Physics selected on the animator and have explored many other options. Is there a way to debug the physics in this situation? Am I going about it the wrong way to use an animation to apply a force?

This is what it looks like now:

sentences:
How do I deal with the problems of a fast side-scroller? I'm making a side scrolling airplane game and when I begin going very fast I begin to experience some problems as a player:

Elements are not distinguishable, like power-ups from bullets, etc
I start to feel dizzy and uncomfortable
There isn't enough time to see what's coming

How can I sort this out? Do I use less details in all the grahpics?

Tiny Wings has the same horizontal movement speed as in my game but it doesn't suffer from these problems. Are there any other really fast side-scrollers I could take as a reference?

sentences: Bullet simulation stops after windows inactivate I am having trouble when inactivating window (event resizing); all the contents get rendered and input works. Even the physics work but the btDiscreteDynamicsWorld stepSimulation function does not get called. I am using SFML for window and clock. If any more information is needed please let me know.

sentences:
PlayClipAtPoint() playing multiple times on enemy death I am having problems with PLayClipAtPoint(). I want to play a given sound as soon as a gameObject is destroyed. Here is my code (the concerned parts):

void Update()
{
    if (health <= 0)
    {
        StartCoroutine(Death());
    }
}

public IEnumerator Death() {
    anim.SetBool("isDying", true);
    AudioSource.PlayClipAtPoint(dmgSounds[0], transform.position);
    Destroy(gameObject, 3f);

    yield return null;
}

I assume that the problem is due to the fact that as soon as the conditions are achieved, in this case the health reaching zero, the coroutine starts and it will keep starting for each frame, but how else should I call it? Anybody has some hint to give?

EDIT: I have already tried to wrap the logic in a bool as suggested in the comment so that it would work only when the bool condition is valid, without success. Here is the code with the flag bool:

void Update()
{
    if (health <= 0)
    {
        if(isAlive){
            isAlive = false;
            StartCoroutine(Death());
        }
    }
}

sentences:
Resolving Circle-Circle collision If you have a stationary circle with radius x, and a moving circle with radius y, when a collision is detected, how can you resolve the collision, such that the moving circle stop?

I.e. What would be the 'resolved' position of the moving circle?

sentences: What AI modding is possible in Civ 5? I'm interested in tinkering with the AI in Civ 5.  I know there are XML files that can adjust the AI's strategies, but are there other easily moddable AI components?  The XML files contain comments that reference some CPP files, are those available to end users or are those comments just aimed at internals?

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:
Path finding to collect enough items before the fight with the enemy So I have the following problem : a X by Y grid. On the grid there is a character and a monster and some items that give bonus points to the character's damage if picked and holes that must be avoided. The goal is to collect enough items to be able to defeat the monster, then navigate to the monster and fight it.

What kind of algorithm can be used to solve this problem?

sentences:
Accurately measure time between calls to onDrawFrame (Android OpelGL ES 2.0) I'm trying to sort out some timing issues within my gameloop and I've seen something that I don't understand.

The Nexus 10 is supposed to have (as far as I'm aware) a VSync on 60Hz.  So that would be mean would it not that onDrawFrame is called by the system every 16.66ms?

When I try to measure it I get different readings on every iteration like so:

public void onDrawFrame(GL10 gl) {

        Log.v("NewTag","Millis between this call and last: "+((System.nanoTime()-newTime)/1000000));

        newTime = System.nanoTime();
}

See my results:

As you can see, it varies between 11.53ms and 21.85ms

Why is it not a constant 16.66 or is it just that nanoTime isn't acurate enough to give a more exact reading?

sentences:
Unity UI Chat Message Expanding Bubble How do you set up Unity's UI Layout system so that the chat bubble changes in size automatically based on the length of the text? What's the right use of Layout and Content Size Fitter elements?
How do you turn
into

sentences:
Turn Based Event Algorithm I'm currently working on a small roguelike in XNA, which sees the player in a randomly generated series of dungeons fending off creeps, as you might expect. As with most roguelikes, the player makes a move, and then each of the creeps currently active on screen will make a move in turns, until all creeps have updated, and it return's to the player's go. On paper, the simple algorithm is straightforward:

Player takes turn
Turn Number increments
For each active creep, update Position
Once all active creeps have updated, allow player to take next turn

However, when it comes to actually writing this in more detail, the concept becomes a bit more tricky for me. So my question comes as this: what is the best way to handle events taking turns to trigger, where the completion of each last event triggers the next, when dealing with a large number of creeps (probably stored as an array of an enemy object), and is there an easier way to create some kind of engine that just takes all objects that need updating and chains them together so their updates follow suit?

I'm not asking for code, just algorithms and theory in the direction of objects triggering updates one after the other, in a turn based manner.

Thanks in advance.

Edited: Here's the code I currently have that is horrible :/

        if (player.getTurnOver() && updateWait == 0)
            {
                if (creep[creepToUpdate].getActive())
                {
                    creep[creepToUpdate].moveObject(player, map1);
                    updateWait = 10;
                }
                if (creepToUpdate < creep.Length -1)
                {
                    creepToUpdate++;
                }
                else
                {
                    creepToUpdate = 0;
                    player.setTurnOver(false);
                }
            }
            if (updateWait > 0)
            {
                updateWait--;
            }

sentences:
Min/Max of two vectors? This seems like a simple question, but i'm having trouble searching the internet for it.

In XNA, during a collision detecting method, I would determin the minimum of some vectors.

// Get the minimum top point
Vector2 minTopPoint1 = Vector2.Min(topLeft1, topRight1);
// Get the minimum bottom point
Vector2 minBottomPoint1 = Vector2.Min(bottomLeft1, bottomRight1);
// Get the minimum of both the top and bottom points.
Vector2 minPoint1 = Vector2.Min(minTopPoint1, minBottomPoint1);

I switched over to making a C++ engine, and am trying to replicate the collision formula (Honestly, it's confusing enough, I just need to replicate it from XNA)
I made my own Vector2, and now I need to make this Min function.

So, what is the minimum or maximum of two vectors?
Is it just the magnitude of the two vectors measured against eatchother?
Is it the x and y values min/maxed somehow?

sentences:
Creating a 2D game on the X-Z plane instead of the X-Y plane in Unity, any adverse effects or challenges with this? After coming to the realization that some things I wish to do in a 2D RTS are easier to do on the X-Z plane instead of the default X-Y plane, I'm considering moving my game over to the other plane.

What I am wondering, past the scripting changes to accommodate the different plane, is what specific challenges will this cause for a 2D game (using 3d physics, not 2d physics)? I did a test and flipped some assets to the X-Z plane and things seemed to work just fine, though I am not sure what unique challenges I will end up facing are.

All our objects will have a 90 degree X-Axis rotation so that their sprites display.

sentences:
2D collision-detection middleware (This question was split off from 3D collision-detection middleware)

Are there any recommendable middleware available for 2D collision detection?

I believe I've heard that Box2D could be used for collision detection without the physics part. I'd like to hear if people have any experiences on Box2D or others libraries for 2D collision detection specifically.

sentences:
html5 libgdx project: war to be deployed in a servlet container or only part of the contents to a web server I am new to compiling games with libgdx to be played on the web and I have some doubts perhaps someone can point me in the right direction:

Using the new gradle setup I wrote a simple game to learn how to deploy a game to be played on the web, but I am not sure what files have to be uploaded to my server.

1) Where is the compiled code I should deploy?: In some places I found that the "war" directory has the files I need to deploy. In other places I found that the "build/dist" (generated running gradle's dist task) has the files.

2) What files should I deploy: The war directory gives me the hint I should deploy everything into a servlet container like Tomcat because, besides of the name, I have a war directory structure (it has a WEB-INF sub-dir). But in the badlogic info I found it says I only need to deploy Assets, html, and the index.html file to a WEBSERVER.

Note: Both ways work, so perhaps the deployment of the full war is to be done under certain conditions. So which would these conditions be?

3) I've read about the SuperDev mode to debug the app. When I run the application I get a SuperDev blue button in the browser. When I compile using GWT (I understand this generates production mode) I stilll get the blue SuperDev button. Do I have to remove it manually, or am I doing something wrong?

Please, can someone put a bit of light on this?

sentences:
What's a proper way to change colors of a sprite on the fly in libGDX? I have found a great tutorial series on creating a simple 2D side scroller, Super Mario Brothers, in this case, and I believe I can adapt it fairly well to create a Megaman clone(something I am quite familiar with so that I can focus on learning the code and not necessarily the mechanics).

What has been challenging me is how to swap colors on Megaman when the chosen weapon is changed.  I've found a  few options, but I am unsure which one is viable.

Having each color as a separate sprite sheet

PRO:

simplest implementation I believe

CON:

increased footprint size of overall app

Converting the texture to a Pixmap, changing the colors I want, convert back to a texture and render as normal?

PRO:

no increase in app size

CON:

Is this done on reach render cycle or can I change it once and forget about it until a new weapon change?

Shaders

PRO:

??

CON:

From what I am reading, it sounds like they can only change on color at a time? Do I use 2 shaders?
They can only be applied wholly to the render and not per sprite?

Thanks.

sentences:
Chunk/Region Compression/Decompression Reading this article here, the author writes about chunk saving and using a lookup table and then saving each chunk in a region file, each region file having 4096 chunks and each chunk having 4096 bytes of data. He structures it so that each chunk in the region file is offset by 4096 bytes - perfect. So far so good, I've created this in C# easily.

My problem is now with compression. If I compress each chunk down, that is great, nonetheless I still have a region file that is full length in size based on each chunk being 4096 offset - so the file itself still looks full size despite each chunk being compressed and save within it's 4096 byte allotment. I don't want to compress the entire region file because that is extremely inefficient to have to always decompress 4096 chunks in a region just to get 1 chunk. It is better to compress each chunk individually before adding to region file.

Can someone suggest how I might work around this without resizing the region file? I do not want to resize a region file every time it is modified, which is also what the author of this article avoids too. File resizing would be too costly in performance.

sentences:
Easy SpriteKit question on creating a function The following code is what I'm working on to animate characters in a SK scene class. I can run the code without building, no problem, but I can't build it and run it; I get one error message: Binary operator '+=' cannot be applied to operands of type '[(SKTexture)]' and '[SKTexture!}'.
The code is below:

func initStoryBegin() {
    let CaitAtlas = SKTextureAtlas(named: "cait")
    let DrewAtlas = SKTextureAtlas(named: "drew")

    CwalkAnimation = self.animateSheet(CaitAtlas, walkAnimation: CwalkAnimation, formattedword: "cait%01d")

}
// ***This is where I am having trouble. In the walkAnimation += line.
func animateSheet(nameAtlas: SKTextureAtlas!, walkAnimation: [(SKTexture)], formattedword: String) -> [SKTexture] {
    for index in 1...nameAtlas.textureNames.count {
        let imgName = String(format: formattedword, index)
        walkAnimation += [nameAtlas.textureNamed(imgName)]
        println(walkAnimation)
        return walkAnimation
    }
}

override func touchesBegan(touches: Set<NSObject>, withEvent event: UIEvent) {
    let charNode = self.childNodeWithName("charNode")

    if (charNode != nil) {
        let animation = SKAction.animateWithTextures(CwalkAnimation, timePerFrame: 0.2)

    charNode?.runAction(animation)

    }
}

I can't figure out why the code works when I run it, but it doesn't work when I try to build and run? Any help would be greatly appreciated.

sentences:
Unstable behavior when applying impulse I created a video that describes the problem since it very hard to explain it. Basically, using physi.js, I am applying random impulse on the object. In the video, at 0:17 the problem begins when the object lands not entirely correct. What am I doing wrong and how this problem can be avoided?
There is the js code:

$(function () {
Physijs.scripts.worker = physijsWorkerFile;
Physijs.scripts.ammo = ammoFile;

var renderer
    , scene
    , camera
    , cylinder
    , clock;

function init() {
    var container = $('#webgl-container');
    width = container.width();
    height = container.height();

    renderer = window.WebGLRenderingContext ? new THREE.WebGLRenderer({ alpha: true }) : new THREE.CanvasRenderer();
    renderer.setSize(width, height);
    container.append(renderer.domElement);

    scene = new Physijs.Scene();
    scene.setGravity(new THREE.Vector3(0, -50, 0));
    scene.addEventListener('update', function () {
        requestAnimationFrame(update);
        renderer.render(scene, camera);
    });

    camera = new THREE.PerspectiveCamera(35, width / height, 1, 1000);
    camera.position.z = 190;
    camera.position.y = 200;
    camera.rotation.x = degToRad(-32);
    scene.add(camera);

    clock = new THREE.Clock();

    initObjects();

    $('#applyImpulse').click(function () {
        var force = new THREE.Vector3(0, getRandomInt(20, 30), 0);
        var offset = new THREE.Vector3(getRandomInt(5, 10), 0, getRandomInt(10, 15));
        cylinder.applyImpulse(force, offset);
    });
}

function initObjects() {
    var surfaceMaterial = Physijs.createMaterial(
                new THREE.MeshBasicMaterial({ color: 0xFF0000, sides: THREE.DoubleSide })
                , 0
                , 0
            );
    var surface = new Physijs.BoxMesh(new THREE.BoxGeometry(200, 200, 4), surfaceMaterial, 0);
    surface.rotation.x = degToRad(90);
    scene.add(surface);
    cylinder = new Physijs.CylinderMesh(new THREE.CylinderGeometry(5, 5, 1, 32), Physijs.createMaterial(
               new THREE.MeshBasicMaterial({
                   color: 0x0000ff
               })
               , 0
               , 0
           ), 1.5);
    cylinder.position.y = 10;
    cylinder.addEventListener('collision', onCoinCollision);
    scene.add(cylinder);
}

function update() {
    var delta = clock.getDelta();
    scene.simulate(delta);
}

function run() {
    init();
    update();
}

function onCoinCollision(other_object, relative_velocity, relative_rotation, contact_normal) {

}

function degToRad(input) {
    return (input * (Math.PI / 180));
};

function getRandomCylinderXRotation() {
    return (degToRad(getRandomInt(0, 2) * 180));
}

function getRandomCylinderYRotation() {
    return (degToRad(getRandomInt(1, 360)));
}

function getRandomInt(min, max) {
    return Math.floor(Math.random() * (max - min)) + min;
};
window.onload = run; });

sentences:
Terrain Rendering/Update Failure Python 3.x I have begun to create a procedurally generated RPG using Python, and I am having trouble with rendering the terrain.
What is happening:
I generate some terrain from some files, or create/save new terrain, and display it on the screen as a 2D B&W heightmap; black = low elevation, white = high elevation. The data are stored in .txt files, formatted as a series of arrays populated with floats.
When the game loads, the terrain is displayed properly, however, once you begin to move around, the terrain begins to act funky.

If you move far from where you start, the terrain becomes gridlike.
If you move horizontally, the terrain becomes somewhat vertically offset.
If you move vertically, the terrain does not update.
Even if you DO move horizontally before/after moving vertically, the terrain will not update vertically, only horizontally.

What I just said, but with images/video.
EDIT: I think the problem occurs in this block of code, but I can't be sure. This is taken from grid_generator.py. It returns a merged grid from the 3x3 area around a given point, where merge, loadGrid, and findAdjFnames are custom functions within grid_generator.py.
def threeBYthree(x,y):
    g = []
    for gy in range(-1,2):
        g.append([])
        for gx in range(-1,2):
            adj = findAdjFnames(x + gx,y + gy)
            print(adj)
            shouldSave = not os.path.isfile('./assets/grids/' + str(x + gx) + '_' + str(y + gy) + '.txt')
            print(shouldSave)
            g[gy + 1].append(loadGrid(str(x + gx) + '_' + str(x + gy) + '.txt', adjF = adj, andSave = shouldSave))

    #merge upper four
    g3a = merge(g[0][0],g[0][1],g[1][0],g[1][1])

    #merge bottom-left two
    g3b = []
    for y in range(len(g[2][0])):
        g3b.append(g[2][0][y] + g[2][1][y][1:])

    #merge top-right two
    g3c = []
    for y in range(len(g[0][2])+len(g[1][2])):
        if y < len(g[0][2]):
            g3c.append(g[0][2][y])
        elif y == len(g[0][2]):
            pass
        else:
            g3c.append(g[1][2][y-len(g[0][2])])

    #merge all
    g3d = merge(g3a,g3c,g3b,g[2][2])

    return g3d

The problem may occur somewhere else, but this bit is what I most recently worked on before the code stopped working.
Pastebin files:
Terrain functions: grid_generator.py
Main game loop: main_test.py
Terrain file for coordinate (0,0): 0_0.txt
NOTE: irrelevant, and some necessary, functions have been removed for privacy and security reasons. If you feel that this includes information required for a fix, please comment.

sentences:
Skinning on simple model doesn't work as expected I have created a simple application to make skinning work with OpenGL. so I want to share with my vertex shader:
#version 330 core

layout (location = 0) in vec3 RealPos;
layout (location = 1) in vec3 vertex_color;
layout (location = 2) in vec2 vertex_textcoord;
layout (location = 3) in vec3 RealNor;

layout (location = 4) in vec4 Joint;
layout (location = 5) in vec4 Weight;

uniform mat4 u_jointMatrix[2];

out vec2 vs_text;
out vec3 vs_color;
out vec3 normal;
out vec3 FragPos;

uniform mat4 model;
uniform mat4 view;
uniform mat4 projection;

uniform bool isSkin;

void main()
{

    mat4 skinMatrix = Weight.x * u_jointMatrix[int(Joint.x)] + Weight.y * u_jointMatrix[int(Joint.y)] + Weight.z * u_jointMatrix[int(Joint.z)] + Weight.w * u_jointMatrix[int(Joint.w)];

    vs_text = vertex_textcoord;

    vs_color = vertex_color;

    FragPos = vec3(model * vec4(RealPos, 1.0f));

    normal = mat3(transpose(inverse(model))) * RealNor;

    if(isSkin)
        gl_Position = projection * view * model * skinMatrix * vec4(RealPos, 1.0f);
    else
        gl_Position = projection * view * model * vec4(RealPos, 1.0f);
}

so as you can see, if my model is skinned then it will call the first statement.
and here my C++ code:
unsigned j = 0;
for (unsigned u = 0; u < m.numOfJoints; u++)
{
    glm::mat4 g = glm::mat4(inverseBindMatriceHandler.at(j), inverseBindMatriceHandler.at(j + 1),
    inverseBindMatriceHandler.at(j + 2), inverseBindMatriceHandler.at(j +
     3),inverseBindMatriceHandler.at(j + 4), inverseBindMatriceHandler.at(j + 5),
     inverseBindMatriceHandler.at(j + 6), inverseBindMatriceHandler.at(j + 7),
     inverseBindMatriceHandler.at(j + 8), inverseBindMatriceHandler.at(j + 9),
     inverseBindMatriceHandler.at(j + 10), inverseBindMatriceHandler.at(j + 11),
     inverseBindMatriceHandler.at(j + 12), inverseBindMatriceHandler.at(j + 13),
     inverseBindMatriceHandler.at(j + 14), inverseBindMatriceHandler.at(j + 15));
     m.inverseBindMatrice.push_back(g);
     glm::mat4 gTransform = glm::inverse(g);
     m.globalTransform.push_back(gTransform);
     j += 16 ;
}
                        }

 if (Model.isSkinned)
{
    for (unsigned l = 0; l < Model.numOfJoints; l++)
        jointM[l] = Model.globalTransform.at(l) * Model.inverseBindMatrice.at(l);
    int isSkinLoc = glGetUniformLocation(program, "isSkin");
    glUniform1i(isSkinLoc, 1);
    for (unsigned l = 0; l < Model.numOfJoints; l++) //2
    {
        std::string name = "u_jointMatrix[" + std::to_string(l) + "]";
        int jointMatrixLoc = glGetUniformLocation(program, name.c_str());
        glUniformMatrix4fv(jointMatrixLoc, 1, GL_FALSE, glm::value_ptr(jointM[l]));
    }
}
else
{
    int isSkinLoc = glGetUniformLocation(program, "isSkin");
    glUniform1i(isSkinLoc, 0);
}

inverseBindMatriceHandler is a vector.
I have 2 joints (numOfJoints).
I can't understand why my model doesn't work properly.
can someone help me?
Thanks

sentences: How to make a Unity3d program/plugin and publish it on Asset Store? I want to make a plugin for Unity3d, like TornadoTwins's FPS Control. How can I do that? I already have Visual Studio 2010 installed.

sentences:
Should I be worrying about limiting the number of textures in my game? I am working on a GUI in XNA 4.0 at the moment. (Before you point out that there are many GUIs already in existance, this is as much a learning exercise as a practical project). As you may know, controls and dialogs in Windows actually consist of a number of system-level windows. For instance, a dialog box may consist of a window for the whole dialog, a child window for the client area, another window (barely showing) for the frame, and so on. This makes detecting mouse hits and doing clipping relatively easy. I'd like to design my XNA GUI along the same lines, but using overlapping Textures instead of windows obviously.

My question (yes, there's actually a question in this drivel) is: am I at risk of adversely affecting game performance and/or running low in resources if I get too nuts with the creating of many small textures? I haven't been able to find much information on how resource-tight the XNA environment actually is. I grew up in the days of 64K ram so I'm used to obsessing about resources and optimization.

Anyway, any feedback appreciated.

sentences:
DRY 0-bandwidth-overhead-serialization in C#: virtual, delegates or reflection? I'm (de)serializing some datastructures for a network-multiplayer game, and for each datastructure that's to be (de)serialized, I want to define the order of (de)serialization only once for maintainability without any additional bandwidth overhead, and as little performance cost and extra typing as possible.

I can use C#'s abstract class methods to achieve my goal, but there's several problems with doing so:

performance: adding an additional abstract method call to each (de)serialization operation isn't ideal
extra typing: I have to needlessly initialize all variables I'm deserializing because C# won't allow me to pass "ref" and "out" parameters interchangeably

How can I avoid duplicating the definition of a datastructure's (de)serialization while also avoiding some or all of the above issues, and continuing to avoid any additional bandwidth cost?

(ProtoBufs and BinaryFormatter both seem to use some additional bandwidth for metadata to describe the "payload" data, and XmlSerializer, DataContractSerializer and NetDataContractSerializer are all xml based and therefore more bandwidth intensive than a straight binary serialization. I also toyed with delegates and reflection, but this solution came to me most readily):

public struct ControllerSnapshot
{
    public Vector2 m_lStick;

    static private void Op(ref float lStickX, ref float lStickY, Op<float> op)
    {
        //define (de)serialization order here once and only once
        lStickX = op.Invoke(lStickX);
        lStickY = op.Invoke(lStickY);
    }
    public ControllerSnapshot(uLink.BitStream bitStream)
    {
        OpRead<float> opRead = new OpRead<float>(bitStream);
        float lStickX,lStickY;
        lStickX = lStickY = 0.0f;//2.can't use "out"; have to match Op's "ref" params
        Op(ref lStickX,ref lStickY,opRead);

        m_lStick = new Vector2(lStickX,lStickY);
    }
    public void Serialize(uLink.BitStream bitStream)
    {
        OpWrite<float> opWrite = new OpWrite<float>(bitStream);
        Op(ref m_lStick.x, ref m_lStick.y, opWrite);
    }
};

//in order to make the above work this needs to be defined:
abstract class Op<T>
{
    public Op(uLink.BitStream bitStream)
    {
        m_bitStream = bitStream;
    }
    abstract public T Invoke(T arg);

    protected uLink.BitStream m_bitStream;
}
class OpRead<T>:Op<T>
{
    public OpRead(uLink.BitStream bitStream) : base(bitStream) { }
    override public T Invoke(T arg)
    {
        return m_bitStream.Read<T>();
    }
}
class OpWrite<T>:Op<T>
{
    public OpWrite(uLink.BitStream bitStream) : base(bitStream) { }
    override public T Invoke(T arg)
    {
        m_bitStream.Write<T>(arg);
        return arg;
    }
}

//by contrast, the "obvious" code duplicates the order of (de)serialization, which I
//want to avoid, especially as (de)serialization becomes increasingly complex:
public ControllerSnapshot(uLink.BitStream bitStream)
{
    float lStickX,lStickY;
    lStickX = bitStream.Read<float>();
    lStickY = bitStream.Read<float>();

    m_lStick = new Vector2(lStickX,lStickY);
}
public void Serialize(uLink.BitStream bitStream)
{
    bitStream.Write<float>(m_lStick.x);
    bitStream.Write<float>(m_lStick.y);
}

sentences:
How Can I Improve This Card-Game AI? Let me get this out there before anything else: this is a learning exercise for me. I am not a game developer by trade or hobby (at least, not seriously) and am purely delving into some AI- and 3D-related topics to broaden my horizons a bit.

As part of the learning experience, I thought I'd have a go at developing a basic card game AI.  I selected Pit as the card game I was going to attempt to emulate (specifically, the 'bull and bear' variation of the game as mentioned in the link above).  Unfortunately, the rule-set that I'm used to playing with (an older version of the game) isn't described.  The basics of it are:

The number of commodities played with is equal to the number of players.
The bull and bear cards are included.
All but two players receive 8 cards, two receive 9 cards.
A player can win the round with 7 + bull, 8, or 8 + bull (receiving double points).
The bear is a penalty card.
You can trade up to a maximum of 4 cards at a time.  They must all be of the same type, but can optionally include the bull or bear (so, you could trade A, A, A, Bull - but not A, B, A, Bull).

For those who have played the card game, it will probably have been as obvious to you as it was to me that given the nature of the game, gameplay would seem to resemble a greedy algorithm.  With this in mind, I thought it might simplify my AI experience somewhat.

So, here's what I've come up with for a basic AI player to play Pit... and I'd really just like any form of suggestion (from improvements to reading materials) relating to it.

Here it is in something vaguely pseudo-code-ish ;)

While AI does not hold 7 similar + bull, 8 similar, or 8 similar + bull, do:
    1. Establish 'target' hand, by seeing which card AI holds the most of.
    2. Prepare to trade next-most-numerous card type in a trade (max. held, or 4, whichever is fewer)
    3. If holding the bear, add to (if trading <=3 cards) or replace in (if trading 4 cards) hand.
    4. Offer cards for trade.
    5. If cards are accepted for trade within X turns, continue (clearing 'failed card types').
        Otherwise:
            a. If only one card remains in the trade, go to #6.
                Otherwise:
                    i. Remove one non-penalty card from the trade.
                    ii. Return to #5.
    6. Add card type to temporary list of failed card types.
    7. Repeat from #2 (excluding 'failed card types').

I'm aware this is likely to be a sub-optimal way of solving the problem, but that's why I'm posting this question.  Are there any AI- or algorithm-related concepts that I've missed and should be incorporating to make a better AI?  Additionally, what are the flaws with my AI at present (I'm well aware it's probably far from complete)?

Thanks in advance!

sentences:
Can I add non-trees to terrain.terrainData.treeInstances on Unity 3D? I need to create a brush in which there will be stones, poles, bushes and other elements of the environment. I bought a Prefab Brush. Whether it is possible to add the objects that I draw on the Prefab Brush scene to terrainData.treeInstances, as regular trees add?

Is it possible to use a not prefab tree as an object for the TreeInstance class?

sentences:
How to determine whether the direction of rotating a 2D vector to another one is counter-clockwise or clockwise using the cross product? Vec2 a, b; // some random vector
Vec2 cross = a.Cross(b);
RelativeDirection(a,b,cross); // return true if the direction of
                              // rotating a to b is counter-clockwise

How do I implement the function RelativeDirection()?

I got some suedo code from the textbook:

if a.Cross(b) > 0 then ... else ...

but the cross product is a vector right? how do you compare it with an integer?

sentences:
Moving a continue condition into the for loop produced something NOT logically equivalent? I'm setting up a hex grid. The column/row system I use puts 0, 0 as the top left corner, and increasing columns (x) moves to the right but also vertically upwards. So columns run straight up and down, but rows run to the right but slanted upwards a bit.

This code...

for (j = 0; j < bd*2-1; j += 1) // bd is "board dimension", in my case 9
{
  for (i = 0; i < bd*2-1 and i < j+bd; i += 1)
  {
    if (i <= j-bd)
      continue;

    scr_ini_hex(i, j, bxo + i*hs, byo + j*hh - i*vs); // bxo and byo are arbitrary board x/y origins where the first cell is drawn, hs, hh, and vs are the gaps between cells in horizontal and vertical directions.
  }
}

produced this:

which is exactly what I want, a large hexagon with 9 smaller hexagons on each side.

So I thought I would be sophisticated and move that continue condition into the for loop. I wrote this...

for (j = 0; j < bd*2-1; j += 1)
{
  for (i = 0; i < bd*2-1 and i < j+bd and i > j-bd; i += 1) // added "i > j-bd", basically migrated the condition into this inner loop
  {
    //if (i <= j-bd)
      //continue;

    scr_ini_hex(i, j, bxo + i*hs, byo + j*hh - i*vs);
  }
}

and it produced this:

What went wrong here? I thought they were logically equivalent (except negating the condition, because the continue code was like a do until, but the for condition is like a do while).

sentences:
How can I fix texture clipping in Unreal 4? I made a small project testing out mini-maps, it worked fine, I left it alone for a few months and reopened the project, and now I'm getting this:

I'm not even sure what to call this kind of issue other than clipping.

Also note, a sprite representing the player model is supposed to be at the center of the mini-map, but now it doesn't show. I hadn't made any changes to the project since I last worked on it, and when I check the camera I'm using for the mini-map, the pointer is definitely visible in the Blueprint. The project was made in 4.13.

Though as I took that screenshot, everything else that should be visible disappeared, so the mini-map no longer is showing the floors and walls. This feels like a graphics problem. Anyone know where I can start fixing this?

SOLVED: It was a rendering/shader problem. Project settings > platform > mac > rendering > Max Metal Shader Standard to Target = "Metal v1.1"

sentences:
Draw and update order in 3d graphics In all of the code samples that I have looked at, the game loop looks something like this:

while(true)
{
   InputAndUpdate();
   Draw();

   SwapBuffers();
}

However doesn't this destroy parallelism between the CPU and the GPU? After the swap buffers call, the GPU will be sitting there idly while the CPU is handling input and updating. Then when the CPU has finished issuing draw commands, it waits until the GPU is finished rendering.
Why isn't it done like this? :

while(true)
{
   Draw(); //First issue the draw commands
   InputAndUpdate(); //Update while the GPU is busy rendering

   SwapBuffers(); //Now block and wait for the GPU to finish
}

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:
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:
Raycast does not detect child layer if parent layer is set to ignore I have a LineRenderer that ignores certain Layers based on a Raycast using LayerMask.
I have a cube with a collider on a Layer which is ignored because of the LayerMask.
I have a smaller object inside the cube that is a child object of the cube and is on a layer that is not set to be ignored. I need the Raycast to hit the smaller object.

When this smaller object is un-parented from the larger cube, the LineRenderer behaves like I want it to: the hit data informs me it is being hit by the Raycast, but this does not hold true if the smaller object is a child of the cube.

Is there a way of having this behaviour without having to un-parent the smaller object? It's like the smaller object is inheriting the parent's Layer, despite being on it's own Layer - does this sound like what is happening?

sentences:
How to communicate to an inventory item which character it's being used on? Currently, I have an Inventory that is a ScriptableObject, which means it's not tied to any specific game object or player character. I just drag it into a MonoBehaviour if I would like expose the data of the inventory.

I have created an InventoryUI, which is a MonoBehaviour attached to a GameObject in my scene, and I assign the Inventory SO to it.

The InventoryUI contains button GameObjects with an InventorySlot script, to which I assign the item each slot is holding.

Everything works fine. When I click on one of the InventorySlot buttons, I'm able to call item methods, such as UseItem.

My problem is if the the item is a potion, for example. How can i add health to the player? Of course I could add reference to the player to the slot. But that will reference player repeatedly over 25 slots.

sentences:
How many textures can usually I bind at once? I'm developing a game engine, and it's only going to work on modern (Shader model 4+) hardware. I figure that, by the time I'm done with it, that won't be such an unreasonable requirement.

My question is: how many textures can I bind at once on a modern graphics card? 16 would be sufficient. Can I expect most modern graphics cards to support that number of textures?

My GTX 460 appears to support 32, but I have no idea if that's representative of most modern video cards.

sentences:
Unity sizeDelta of an Image update opposite to what it should I have an IEnumerator coroutine in which I call the UIManager script to update the Image size to fit the text size but it doesn't happen. when I use yield return new WaitForEndOfFrame() it sometimes solve the problem. but I don't want to use it.

edit: I tested the code like I was suggested in an empty unity project and it still happens, the width should change according to the text size but it happens opposite (when the text is small the width of the image is large and when the text is large the width of the image is small) (it only happens correctly at the first time - the width of the image fits the text width)

public class Example : MonoBehaviour
{
    public Image image;
    public Text text;
    private int k = 0;

    public void ButtonClick()
    {
        text.text = (k % 2 == 0) ? "10" : "10 / 10";
        image.rectTransform.sizeDelta = new Vector2(text.rectTransform.rect.width, 30);
        k++;
    }
}

edit: Solved! thanks for the help, Canvas.ForceUpdateCanvases() did the trick

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:
Directional light and finding relevant shadow casters Right now when culling the models to render for the directional light shadow map pass I just do a view frustrum culling using the main camera. At some angles, the objects will be outside the view but still obviously should cast shadows.

My question is, how do you cull/gather all the relevant shadow casters for a directional light?

sentences:
Map video texture to a half sphere in Unity I'm new to unity3D. and am trying to play a 360-degree video. But instead of mapping the whole 360-degree (equirectangular) video to the whole sphere, I need to map the half-video to a half-sphere object. How can I do that? So basically we'll have two half-sphere, tied together, each playing the half of 360-degree video, as if a single video is mapped to a whole sphere. An example or tutorial for a beginner would be great.

e.g. So the top half of this 360 video should be textured on such mesh

UPDATE: No worries...we not cropping the video on the go! It is already cropped as two separate videos)

sentences:
How can I find all shortest paths using A*? It is possible for A* Path Finding to return all the shortest paths given a graph/map?

For example, given the map below:

-----------
--a--X--b--
-----------

The said map can return four (4) distinct path.

-----1-----
--a11X11b--
-----------

-----------
--a22X22b--
-----2-----

----333----
--a3-X-3b--
-----------

-----------
--a4-X-4b--
----444----

The paths follow the Manhattan Heuristic and a Eight (8) directional transition with a default G-value of 1.0f for testing.

The question given the Pseudocode of A* will only return me one (1) of the four (4) distinct paths which I wish to return all four (4) paths instead.

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:
Why can't cross-platform multiplayer games exist? At least, why are they so difficult to make? - assuming that's the reason why not even AAA studios accomplish this feat for their games. Especially with modern cross-platform game engines like Unreal and Unity that can build on Xbox, PS4, and PC, why hasn't this been done yet on a large scale?

For example, Diablo III is a game released on a variety of platforms. Despite it being a product of Blizzard, one of the wealthiest video game companies in the world, it does not allow an Xbox player to play with someone using a PC.

sentences:
How to sample png heightmap in HLSL I am working on simple parallax shader and I have problem with sampling height texture for value.
My aproach amples texture and give me RGB values of picture:

tex2D(TextureHeightSampler, input.BaseOutput.TexCoordAndViewDistance.xy)

But I am not sure how to convert RGB data to height value. How to solve that?

sentences: Walking Sprite animation Cocos2D I am new to cocos2D development. Basically I want to develop game in which i want to move sprite forward with walking kind animation, must look real. Any help will be appreciated.

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:
Circle inside circle collision In one of my projects I have a game area in the shape of a circle. Inside this circle another small circle is moving around. What I want to do is keep the small circle from moving outside the bigger one. Below you can see that in frame 2 the small circle is partly outside, I need a way to move it back to just before it is about to move outside. How can this be done?

Also, I need the collision point along the arc of the big circle so that I can update the small circle's velocity. How would one go about calculating this point?

What I would like to do is before moving the small circle, I predict its next position and if it is outside I find the time of collision between t=0 and t=1 (t=1 full time step). If I have the collision time t then I just move the small circle during t instead of a full time step. But again, the problem is I don't know how to detect at that time the collision occurs when it comes to two circles and one being inside the other.

EDIT:

Example of collision point (green) I want to find. Maybe the picture is a bit off but you get the idea.

sentences:
How to set up Easy Mobile Pro to work with assembly defintions? I have a project with EMP imported, and now I would like to use assembly definitions to clean up my project a little bit. Everything works fine in the editor, but when I hit Build player script in my Addressables or just trying to Build I get a bunch of nasty error messages. When I switch to VS obviously there are no issues in the code editor.
I have asmdef files in:

Core folder in my Scripts folder, these are scripts created by myself. -asmdef
EMP-Editor folder -> this one references 3. -asmref
EMP-Scripts folder -asmdef

There are the kind of errormessages coming up(when trying to build only, there are 200 of them):

Assets\Plugins\EasyMobile\Editor\EM_BuiltinObjectCreator.cs(6,19): error CS0234: The type or namespace name 'SceneManagement' does not exist in the namespace 'UnityEditor' (are you missing an assembly reference?)
Assets\Plugins\EasyMobile\Editor\EM_SettingsEditor_Privacy.cs(9,24): error CS0234: The type or namespace name 'SerializedProperty' does not exist in the namespace 'UnityEditor' (are you missing an assembly reference?)
Assets\Plugins\EasyMobile\Editor\EM_SettingsEditor_Privacy.cs(10,24): error CS0234: The type or namespace name 'EditorStyles' does not exist in the namespace 'UnityEditor' (are you missing an assembly reference?)

I tried adding a refernece to the Unity.Editor dll in VS to the EMP assembly, but VS just doesn't do anything, no errors, no messages...Tried the same in asmdef file in Unity with no luck...

I got the inspiration from this video, and it was working ok...

Unity 2019.3
VS 2019
Android platform
EMP 2.5.2

Thanks

sentences:
If a 3D vector represents a point, how can it have a length? I am trying to understand vector arithmetic (and specifically its use in the Unity engine). I am not able to figure out how a vector can have a length (magnitude) even though it only represents a point (position and direction)?

Does that mean that the magnitude is simply its distance from the origin point (0, 0, 0)? Or am I missing something?

sentences:
ASP.NET Browser game Timers I am developing a simple browser game, using ASP.NET, C# and SQL Server 2012.
I need to implement build time of some unit or building. One way would be storing finish date to database and just fetch remaining time on refresh, but there is one problem. If user doesn't refresh in a long time and building finished days before, the dependent records in database won't get updated (e.g. I have finished building Iron Mine 3 days ago, but the production per hour wont get updated until user refreshes).
How would you approach this problem ? Is there some sort of timed event in database, that will not ruin database server performance when there will be a lot of timers ?

sentences:
Set object rotation according to the outer vertex in unity I am able to get the outer vertices of a mesh using this and able to generate cubes on outer edges of the mesh. Here is my code:
  mesh = GetComponent<MeshFilter>().mesh;
        Stopwatch sp = new Stopwatch();
        sp.Start();
        Vector3[] vertices = mesh.vertices;
        List<EdgeHelpers.Edge> edges =  EdgeHelpers.GetEdges(mesh.triangles).FindBoundary();

        for (int i = 0; i < edges.Count; i++)
        {

            Vector3 v3 = vertices[edges[i].v1];
            GameObject go1 = GameObject.CreatePrimitive(PrimitiveType.Cube);
            go1.transform.localScale = new Vector3(0.25f, 0.25f, 0.25f);
            go1.transform.localPosition = transform.TransformPoint(v3);
            //go1.transform.localEulerAngles = transform.TransformDirection(v3);
            //go1.transform.rotation = this.transform.rotation;
           // go1.AddComponent<CubeMakerOnEmptySpaces>();
        }
        sp.Stop();
        UnityEngine.Debug.Log(sp.ElapsedMilliseconds / 1000);

Now I want to change the rotation of each cube that each cube z should be pointing against the mesh direction (should be outside of the mesh). Maybe picture representation helpful here

Need to be like this:

sentences:
NullReferenceException in Unity Since many users are facing the NullReferenceException: Object reference not set to an instance of an object error in Unity, I thought that it would be a good idea to gather from multiple source some explanation and ways to fix this error.

Symptoms
I am getting the error below appearing in my console, what does it mean and how do I fix it?

NullReferenceException: Object reference not set to an instance of an
object

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:
GameObject not exiting through leftScreen I'm trying to wraparound game object so that, it exits through right screen and enters through left and vice versa.
The code snippet below is what I'm working on.

Vector3 Pos = mainCam.WorldToScreenPoint(transform.position);
Vector3 LS  = mainCam.ScreenToWorldPoint(new Vector3(-1, 0f, 0f));
Vector3 RS  = mainCam.ScreenToWorldPoint(new Vector3(1, 0f, 0f));

if (Pos.x > Screen.width)
        transform.position = new Vector3(LS.x, transform.position.y, transform.position.z);

if (Pos.x < 0)
        transform.position = new Vector3(RS.x, transform.position.y, transform.position.z);

So far, exit through right and re-enter through left works, but the gameObject does not exit through the left screen, there seems to be a barrier preventing it, or maybe my parameters for the second if statement are wrong.

sentences:
How to decide the direction of movement, when navigating a fixed path in a 2d overworld? Suppose, I have a 2D overworld like in Super Mario Brothers 3, but without junctions or intermediate nodes. Only a single, contiguous path of level nodes, which should be navigated with the arrow keys.

Currently, the path is calculated automatically by the order of which the nodes appear. Each node has at most two edges, which extend from the center of each node.

Now there are multiple possible layouts of said path. In the following pictures, "P" is the position of the player. Directions formatted as code will denote arrow key presses.

Axes-aligned paths

This is the trivial case, since each possible direction is aligned with the arrow keys. down moves the player down, left moves him left.

Angled paths

Here it gets a little trickier, since the possible directions are not aligned with the arrow keys anymore. Pressing left is ambiguous, the only option would be to use up and down to move the player up-left and down-left respectively.

Axes-aligned and angled paths mixed

In this case, left could be used to move the player either to the left or to the up-left. But here it would be more intuitive to use left for left and up for up-left movement.

Arbitrary paths

This is where I am kinda lost. Both possible paths lead up-left. Now I could say, since one node is "more left" than the other, let left walk the player to that node. The other node is "more up", so up can walk him there. But what if such a situation doesn't exist? For example, when one node is both "more left" and "more up" than the other one?

Some approaches I had

Give directions a priority, so when ambiguous situations exist, left gets picked over up for example. That means, left will always move the player to the most left node, no matter where the other node is. But with this I think I have to implement a lot of if-checks and it would also be not as intuitive for the player.
Add direction markers, so paths leading from one node to another are only connected at their direction specific markers. This will be more intuitive, since you can simply look at the markers and know, that the left marker is mapped to left.    But this looks rather ugly and unnatural, because the edges don't originate from the center of the node anymore. Furthermore, I think this will cause the same problem as before. I need to decide beforehand, which marker is connected to which other marker. So I basically relocated the problem to another point in the logic.
Restrict placement, so the nodes are only placed in such a way, that the path ends up axes-aligned. Since I'm free to place the nodes anywhere I want, this would be the easiest solution. But that would make the layout of the world map rather boring. I guess this could be my fall-back approach, when everything else fails.
Decide by angle of an edge. Divide a circle into four sectors at (2k + 1) * PI/4 with k = 0..3. Each sector defines one direction. An edge is now mapped to this direction, when the edge lies in that sector. If two edges are in the same sector, the one closer to the main-axis (x or y) in that sector is mapped to that direction. The remaining edge is then mapped to the direction of the next closer sector.  This one came to my mind, while writing this question, so I haven't given it much thought yet. I find this the most elegant approach so far. But I already see two problems where there is some ambiguity:  - If an edge lies exactly on a dividing line between two sectors (e.g.: at 45°)  - If two edges are symmetrical around an axis (e.g.: at 30° and 330°)

Questions:

How could I generalize the decision-making with arbitrarily connected paths?
Are my presented approaches reasonable?
What approach would be the most promising? Or is there a better one, which I haven't thought of yet?

Thanks in advance for your time! I look forward to your suggestions :)

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 randomize Motion/animation without create a state for each animation? I'm using Animator and state for animating my charachter.

So, i've (example) an Idle state, associated to an Idle motion animation , and a Death State, associated to a Death animation.

But I've 5 possible animation for death so i would like to randomize death animation without create a state for each animation.

My State "Death" has a "Motion" variable. I would like to change at runtime this  "motion" variable. Is it possible ?

Thanks

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: How to move X and Y position of sprite in Game Maker Studio 2? In the tutorial it told me to add the sprite to the object and then add an event called step. The GML code i used in the step event is x = x + 4; to move to the right but when i run the game it does not move at all.

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 was the world game market segmented in 2011? Is there a source (or perhaps several) presenting how was the world game market segmented in 2011 (or does anybody know themselves)? For example:

How many casual gamers there are? What is the total business, of which how much in virtual item sales?
How many console gamers there are? How much is spent in hardware, how much in software?
How many mobile gamers there are? How much is spent in hardware, how much in software?

And how all above is in different regions / countries?

sentences:
OpenGL Shadowmaps Limit I would like to render an OpenGL scene with an arbitrary number of point lights (at least 1024) with shadows enabled.

My current method of rendering shadowmaps, however, cannot do this.

Let me explain

There are only 32 textures you can pass to a fragment at a time.

I am using 31 of those 32 textures for shadowmaps at the moment.

pseudocode for my main code...

setShader("DepthBufferPointLight", -1); //the int is actually numlights, used for deciding whether or not to recompile a finalpass shader. Irrelevant in this stage and set to -1 for debugging purposes.
FBO fBO* = CreateFBOs[6 * numLights]
for (int j = 0; j < 6; j++)
for (int i = 0; i < 6; i++)
{
 setRenderTarget(fBO[i]);
 setupCameraforLight(j,i); //Move the camera to the right position
 renderSceneDepth(); //Textures aren't even rendered for this
}
setRenderTargetDefault();
setShader("FinalPass", numLights); //The shader dynamically recompiles for final pass calls if the number of lights has changed, because it will need to change how many uniform struct lights there are.
setLightTextureUnits(fBO, 6, numLights); //glActiveTexture calls and glBindTexture calls
renderSceneFinalPass(); //Textures and uniforms are all set up for this, also does the lights

and then in the shader pipeline I do my calculations using the shadowmaps.
My pseudocode is rough but you get the picture.

(SIDE NOTE: the dynamic recompiling is actually really simple and only changes one line of the shader, and I'm going to deprecate and remove the function once I figure out how uniform variable arrays work...)

my code breaks after numlights*6 is greater than 31.

Is there a better way to do this?

my ultimate goal is to render an arbitrarily high number of point lights using shadow mapping

sentences:
How can I manually call/fire OnTriggerExit() for colliders a trigger is inside of in Unity? In Unity, the OnTriggerExit() method is not called/fired (not sure if it's an event or not) when an object is disabled or destroyed within it's collider. In comparison to it being fired is an active object that was within it's collider no longer being inside the bounds of that collider on the next frame. I want to be able to call OnTriggerExit() on my triggers OnDisable() method as a workaround.

How would I go about calling/firing OnTriggerExit() manually?

sentences:
Playing different particle effects in Unity on the same ParticleSystem The question really sums it up: What is the best way to use one particle system for playing different particle effects?

The scenario: GameObject is picked up and it starts playing a simple indicator particle effect. If the GameObject is placed on a special platform it will play another particle effect.

I have very little experience with particle systems - how would you do this?

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:
AR app: Mapping 3D object to 2D plane? I'm trying to create an Augmented Reality app. I'm using OpenCV to get 4 points from a checkerboard pattern that represent the four corners of the pattern. This should be used to create a plane in my app, but the points are in 2D.

Anyone here have an idea how one is to use these 4 points to create a plane and/or map a 3D object to the pattern

sentences: Deriving from base class but not calling base method I am very new to C#, XNA, and OOP. This is my question: I have an abstract class called Sprite. Sprite handles position and drawing from the sprite sheets, from its update and draw methods, for my other automated and user controlled classes. I have another class that I need to create that also uses a sprite sheet but not in the same way. The sprite sheet in this case shows the texture in 5 states, from whole to destroyed, and I am going to write the update method for it so that when a missile collides with the texture, then and only then does the next frame of the sprite sheet get drawn. Is there a way that I can have this class, called bunker, be a child of the sprite class but never call the update method from the parent? Or should I just make it a seperate class altogether? Thank you for bearing with my noobish question.

sentences:
Intellisence doesn't show the ECS API Summaries I am not sure if this is more of an ECS topic problem or packages in general. but it would be really helpful for ECS programming with all the summaries the Unity has provided. For unity engine methods, intelligence show me descriptions and summary of classes and methods, but it doesn't work on packages I guess.

I have tested this with all IDEs, AutoComplete doesn't show the description for methods and classes. However, I can go to the declaration of packages source code and see the summary. for example, Below you can see a screenshot in the Jetbrain Rider IDE, as you see when I mouse over OnCreate method it doesn't show the description.

sentences:
How to use Transvoxel tables Could someone explain how to use the lookup tables provided on http://transvoxel.org/ with the regular Marching Cubes algorithm?

I'm not even talking about the whole LOD System etc. I actually understand how that is supposed to work and why Transvoxel uses different tables, I just can't seem to figure out what modifications to make to the regular Marching Cubes algorithm to use them.

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:
Calculating t value to use with Hermite interpolation I'm developing an FPS in Unity using Photon for networking. The Photon-provided interpolation is very basic so I decided to roll out my own using the Hermite spline.

It works good and is significantly better than the provided interpolation.
However, I was wondering what's the correct way to choose the t value. In a perfect world, it should be incremented by deltaTime*timeBetweenPositionUpdates. However, that doesn't work since even if the tickRate is set to 10 for example, sometimes the client sends it at 9.5, and then at 10.2 and so on and so forth. This means that we can't have a constant increment rate for the t value since it'll either lag behind or move too fast and we'll run out of buffered frames.
What I decided to do is to send the time between frame updates as well and interpolate using that. But, this also isn't perfect by any stretch of the imagination and the receiving client will soon lag very much behind.

What I'm doing now is using a multiplier on the t value such that if there is more frames in the buffer than we want to have then it'll speed the interpolation up, and if there's less than how many we want in the buffer then it'll slow the interpolation down. This works pretty well, but it's a hack I believe.

Is there a better way, or a proper way to do this?

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:
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:
16-byte aligned matrix in DirectX9 and D3DX with Havok Physics 2012 I want to ask a question about D3DXMATRIX and D3DXMATRIXA16, and how to use them with Havok Physics.

I'm using Visual Studio 2012 on Windows 8.

I successfully created an instance of hkpWorld, added an hkpRigidbody instance with hkpSphereShape.

The class representing the sphere object has:

hkpRigidBody m_RigidBody;  // Rigidbody
D3DXMATRIX m_Transform;    // Rendering matrix

Judging from the values of m_RigidBody->getPosition(), the simulation is running without problem.
So now obviously I want to render the sphere according to its position and orientation calculated by havok.

This is how I tried to extract the matrix for rendering:

const hkTransform& t = m_RigidBody->getTransform();
t.get4x4ColumnMajor(&m_Transform._11);

Then I happily ran the program, which would break in get4x4ColumnMajor and give me this message through my error report function:

  C:\NightlyJobs\09-07-Sun-01\Source\Common/Base/Math/Vector/Sse/hkSseVector4.inl(
  1831): [0x64211C2F] Assert: pointer must be aligned for SIMD.

I took this to mean that the matrix had to be 16-byte aligned, so I changed

D3DXMATRIX m_Transform;

to

D3DXMATRIXA16 m_Transform;

This time, the problem is still there but isn't 100% reproducible.
Sometimes it runs without problem, sometimes get4x4ColumnMajor fails with above message.

Changing the matrix declaration to

_declspec(align(16)) D3DXMATRIX m_Transform;

did not help either.

So, to summarize my question:

How would I go about extracting the matrix suitable for rendering with DirectX9?
Why do D3DXMATRIXA16 and _declspec(align(16)) seem to be inconsistent about being 16-byte aligned or not, every time I run the program ?

sentences:
Stencil buffer appears to not be decrementing values correctly I'm attempting to use the stencil buffer as a clipper for my UI system, but I'm having trouble debugging a problem I'm running in to.

This is what I'm doing: A widget can pass a rectangle to the the stencil clipper functions, which will increment the stencil buffer values that it covers. Then it will draw its children, which will only get drawn in the stencilled area (so that if they extend outside they'll be clipped). After a widget is done drawing its children, it pops that rectangle from the stack and in the process decrements the values in the stencil buffer that it has previously incremented.

The slightly simplified code is below:

static void drawStencil(Rect& rect, unsigned int ref)
{
    // Save previous values of the color and depth masks
    GLboolean colorMask[4];
    GLboolean depthMask;
    glGetBooleanv(GL_COLOR_WRITEMASK, colorMask);
    glGetBooleanv(GL_DEPTH_WRITEMASK, &depthMask);

    // Turn off drawing
    glColorMask(0, 0, 0, 0);
    glDepthMask(0);

    // Draw vertices here
    ...

    // Turn everything back on
    glColorMask(colorMask[0], colorMask[1], colorMask[2], colorMask[3]);
    glDepthMask(depthMask);

    // Only render pixels in areas where the stencil buffer value == ref
    glStencilFunc(GL_EQUAL, ref, 0xFF);
    glStencilOp(GL_KEEP, GL_KEEP, GL_KEEP);
}

void pushScissor(Rect rect)
{
    // increment things only at the current stencil stack level
    glStencilFunc(GL_ALWAYS, s_scissorStack.size(), 0xFF);
    glStencilOp(GL_INCR, GL_INCR, GL_INCR);

    s_scissorStack.push_back(rect);
    drawStencil(rect, s_ScissorStack.size());
}

void popScissor()
{
    // undo what was done in the previous push,
    // decrement things only at the current stencil stack level
    glStencilFunc(GL_ALWAYS, s_scissorStack.size(), 0xFF);
    glStencilOp(GL_DECR, GL_DECR, GL_DECR);

    Rect rect = s_scissorStack.back();
    s_scissorStack.pop_back();
    drawStencil(rect, s_scissorStack.size());
}

And this is how it's being used by the Widgets

if (m_clip)
    pushScissor(m_rect);

drawInternal(target, states);
for (auto child : m_children)
    target.draw(*child, states);

if (m_clip)
    popScissor();

This is the result of the above code:

There are two things on the screen, a giant test button, and a window with some buttons and text areas on it. The text area scroll box is set to clip its children (so that the text doesn't extend outside the scroll box). The button is drawn after the window and should be on top of it completely. However, for some reason the text area is appearing on top of the button. The only reason I can think of that this would happen is if the stencil values were not getting decremented in the pop, and when it comes time to render the button, since those pixels don't have the right stencil value it doesn't draw over. But I can't figure out whats wrong with my code that would cause that to happen.

sentences:
How can I generate 3D noise in chunks for terrain? I'm trying to create a voxel engine that uses marching cubes to create smoothed terrain. I have most of it implemented, but I'm struggling with how I should create a noise function in three dimensions. I have a 2D Perlin noise generator implemented (or I could use the Unity built-in one, I guess). What can I use for 3D?

I'm also interested in the noise function being usable in chunks with uniform output. That way, with one seed, I could create a level in parts that would still all work properly.

sentences:
Why isn't my lighting working properly? Are my normals messed up? I'm relatively new to OpenGL and I am trying to draw a 3D model (loaded from a 3ds file using lib3ds) using OpenGL with lighting, but about half of it is drawn in black.

I set up the light as such:

glEnable(GL_LIGHTING);
glShadeModel(GL_SMOOTH);

GLfloat ambientColor[] = {0.2f, 0.2f, 0.2f, 1.0f};
glLightModelfv(GL_LIGHT_MODEL_AMBIENT, ambientColor);

glEnable(GL_LIGHT0);
GLfloat lightColor0[] = {1.0f, 1.0f, 1.0f, 1.0f};
GLfloat lightPos0[] = {4.0f, 0.0f, 8.0f, 0.0f};
glLightfv(GL_LIGHT0, GL_DIFFUSE, lightColor0);
glLightfv(GL_LIGHT0, GL_POSITION, lightPos0);

The model is in a VBO and drawn using glDrawArrays. The normals are in a separate VBO, and the normals are calculated using lib3ds_mesh_calculate_vertex_normals:

std::vector<std::array<float, 3>> normals;
for (std::size_t i = 0; i < model->nmeshes; ++i) {
  auto& mesh = *model->meshes[i];
  std::vector<float[3]> vertex_normals(mesh.nfaces * 3);
  lib3ds_mesh_calculate_vertex_normals(&mesh, vertex_normals.data());
  for (std::size_t j = 0; j < mesh.nfaces; ++j) {
    auto& face = mesh.faces[j];
    normals.push_back(make_array(vertex_normals[j]));
  }
}
glBindBuffer(GL_ARRAY_BUFFER, normal_vbo_);
glBufferData(GL_ARRAY_BUFFER,
             normals.size() * sizeof(decltype(normals)::value_type),
             normals.data(),
             GL_STATIC_DRAW);

The problem isn't the vertices; the model is drawn correctly when drawing it as a wireframe. I also fixed the normals in Blender using controlN. What could be the problem? Should I store the normals in a different order?

sentences: What is it called when you combine textures for an object I am trying to gain a better understanding for modeling and texturing for Unreal 4 and Blender. Now my question is: What is the process/result called when packing textures into one image as shown below?

sentences:
How can I turn off the sound from another scene? I attached music file to my first scene and thanks to following javascipt code, sound continues without stopping in other scenes.

public static var object : SingletonMusic = null;

function Awake()
{

    if( object == null )
    {
        object = this;
        DontDestroyOnLoad(this);
    }
    else if( this != object )
    {
        Destroy( gameObject );
    }
}

My problem is that I want to turn off the sound from the button in the another scene (setting scene) so that I added a new button to my setting scene and attached the following javascript code to the button that I have created.

Javascript code:

var objects: AudioSource = SingletonMusic.object.GetComponent(AudioSource);
if( objects.isPlaying )
objects.Pause();
else
objects.Play();

However, it gives following errors:

If I start the game from Setting scene; I get this error:

If I start the game from first scene and then, go to Setting scene; I get this error:

sentences:
Game Logic Update Order Is there a commonly-accepted general approach to the order of processing logic updates?

My current 2D platformer has objects that implement different concerns, including the following:

Notifiable - can be event-driven and scripted
Collidable - can interact with solid tiles (eg NPCs)
Intersectable - exists in 2D space and can intersect with the player (eg doors)

In general the order of events in a game loop is:

Get input
Act on input and update stuff
Render

I'm not sure what order to do things in point #2. I've concluded moving things like moving platforms that the player can stand on first is a good idea, but I don't know when to consider scripting. The scripting in my game can give NPCs behaviours (walk between here and there), suspend player input for 'cutscenes', show dialog screens, and move the player to a new level.

sentences: Is it possible to show vertex information in tables in VS2012 like in PIX? In PIX I was able to watch the objects' vertex data at different stages in tables, like before vertex shader, between vertex and pixel shaders, and so on. Can you see this in Visual Studio 2012 graphics debugger? I mean, you can see the data as a list of sorts, but it's impossible to get a good overview of that if you have more than like 3 vertices.

sentences:
How do I prevent my game from being detected as a virus? I developed my own game engine and I'll refer to it as a Software Development Kit (SDK) here, for making a specific type of game.
The SDK encapsulates low level DirectX APIs. It's written in C++ and compiled on its own using Visual Studio 2019 which generates a static library file.
Under the Visual Studio 2019 compiler/debugger with remote debugging tools, I can compile, link and deploy a debug sample application to another computer and continue my development activities.
However, when I copy all the graphics files and the executable to a standalone computer (running antivirus software) and then run my sample application, the antivirus software detects my application as a virus and will go so far as to delete it from my computer.
It does so before I get so far as to change video resolution. I am running Windows 10.
This is now of concern because I would like to use the sample to solicit friends and to gauge interest in collaborating with me on a small gaming project.  The sample is simply a means to test artwork by seeing it animated, so that a graphic artist can work independently with his/her own tool. They would simply have the sample application and an artwork compiler as well.
I read  in another post that is several years old entitled “Conundrum with quality and virus reports: is our game releasable?“, in which the author had similar issues.
In that post it was recommended that the antivirus vendors should be contacted, in hopes that the problem would be corrected before they released their product.
Is this really the best course of action? Does anyone know how my application got into the database used by the antivirus vendor? When I contacted the vendor the analyst whom I spoke with suggested to turn the antivirus software off.
I am trying to prevent the possibility of releasing something I worked hard at, only to have it be detected as a virus after release. Is this preventable and avoidable?
Windows Protected you PC
Microsoft Defender SmartScreen prevented an unrecognized app from starting.
Running this app might put your PC at risk
More Info.
App: Buzz.exe
Publisher: Unknown Publisher
Run Anyway or Don't Run
I select Run Anyway

Down Load Insight
Our information on this file is inconclusive.
We recommend not using this file unless you know it is safe.
Very Few Users
Fewer than 5 users in the NXXXXn Community have use this file.
Buzz.exe
Downloaded from
http://codeload.github.com/david-harding/
Very New
File was relead less than 1 week ago
Unproven
There is not enough information about this file to recommend it.

Stop this program from running.
Remove this file from the system (recommended).
Run this program anyway.

More details.
File Insight

Details
a. Developers Not available
b. Version Not Available
c. Identified 2/11/2021 at 4:14:23 am
d. Last used 2/11/2021 at 4:21:46 am
e. Startup item No

Origin
a. https://codeload.github.com/david-harding/sample/zip/main
b. Downloaded file buzz from github.com
c. File Created Buzz.exe

More Info
Taked me to the AV web site to rate the binary
Click 3. Run this program anyway.
Program runs normally.
++++
I am now using only a release version of my sample executable and the original reported issue has not gone away. The problem is chronic. I am not able to unzip the file downloaded from GitHub on my development computer, the AV software removes the .exe file immediately. I have not done exhaustive testing with USB devices etc. The message above indicates that the file is not trusted.
I am going to digitally sign my sample file with a certificate that is trusted by a trust provider. If the certificate is not too expensive. I tested with a sample PFX, which is included in VS 2019.
I found the following article useful. https://docs.microsoft.com/en-us/dotnet/framework/tools/signtool-exe#sign
If anyone has any suggestions on ordering a PFX cert, I would appreciate suggestions. It looks like that is what is needed here. I will report back when this issue is resolved.  Thanks for everything so far.

sentences:
Applying Angular Acceleration in a Basic Physics Model I'm attempting to use a basic physics system to create an arcade flight model. So far I have managed to get the aircraft moving forward, apply gravity, etc. However, after trying to implement torque I noticed some interesting behaviour in the flight model. When turning after a while the controls appear to reverse, sometimes, the controls for the different movements (pitch, roll, yaw) also seem to change. I was hoping that someone may be able to advise me as to what I should check next. I have included my source code in case anyone spots any glaring mistakes! I have listed some of the variables below to show their data types:

Quaternion rotation = Quaternion.Identity;
Quaternion newRotation = Quaternion.Identity;
Vector3 rotationChange = Vector3.Zero;
Vector3 rotVec = Vector3.Zero;

Below is the update logic for the rotational forces:

dt = (float)gameTime.ElapsedGameTime.TotalSeconds;
if (dt > 1.0f / 60.0f)
{
    dt = 1.0f / 60.0f;
}

Vector3 newRotationChange = rotationChange + dt * angularAcceleration;
Vector3 newRotVec = rotVec + dt * newRotationChange;

rotationChange = newRotationChange;
rotVec = newRotVec;

Vector3 rotAxis = rotVec;
rotAxis.Normalize();

if (rotVec.Length() < 0.001f)
{
    rotVec = Vector3.Zero;
    newRotation = Quaternion.CreateFromAxisAngle(forwardVector, 0.0f);
}
else
{
    float angle = rotVec.Length();
    newRotation = Quaternion.CreateFromAxisAngle(rotAxis, angle);
}

if (rotationChange.Length() < 0.001f)
{
    rotationChange = Vector3.Zero;
}

rotation = newRotation;
angularAcceleration = Vector3.Zero;

My method for creating the torque:

/// <summary>
/// Creates a rotational force for an object
/// </summary>
/// <param name="pointOfAction">Point the force is being applied on the object
/// </param>
/// <param name="forceAmount">Magnitude of the force being applied</param>
/// <param name="forceDir">Direction of the force being applied</param>
public void CreateTorque(Vector3 pointOfAction, float forceAmount, Vector3
        forceDir)
{
    // Vector from position to pointOfAction
    Vector3 r = pointOfAction - position;

    // Create the force
    Vector3 force = forceDir * forceAmount;

    // Create the torque force
    torque = Vector3.Cross(r, force);

    angularAcceleration += torque;
}

Sorry for the massive code block and thanks in advance for any help you can give.

sentences:
Match Making Groups of Players Given a situation where I have a pool of X people of different scores (ranks) S with game size N. How do I partition the pool into N sized games where the standard deviation of ranks for each games is minimized?

(quality of the game is inversely proportional to STD of ranks)

sentences:
Some meshes are visible in game view while others are not I have a FPS character in unity. The FPS character is divided into a few different pieces (upper arm, lower arm, hand, fingers, etc). I exported it from blender, so I'm using the camera that got converted from the blender camera.
For some reason, the mesh is not showing up in the game view/camera vision.
I did a little bit of testing and found out that:

If I move the camera away, the mesh shows up, so the mesh isn't invisible or anything
I put a version of the character that I imported from blender earlier as a test(different rest pose and less animations attached to it) in the same location as the FPS character, and attached the same animator to it. When I did that, you can see the earlier version but not the newest one
The same thing happens even if I change the camera

The camera has a field of view of about 67, and a focal length of 18. Near is set to the lowest value possible. Both characters are visible in scene view, just not in game view.

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:
How can I handle shadowing of a planet's rings by the planet itself? I assume the most straightforward way to draw planetary rings (such as those around Saturn) is to use a texture that is transparent everywhere except for the rings, and then place the planet in the middle of the texture and that's it.

The problem with this approach is that I don't know how to shadow the area of the rings texture that is behind the planet (which isn't lit by the sun). At the moment I have a rings texture that is permanently lit and a planet that darkens in the areas where it's not lit by the sun. The planet revolves around the sun, so the lit/shadowed areas are constantly changing.

Any suggestions on how to apply shadow on the rings?

sentences:
Entity Component System data duplicate I've read some articles about Entity Component System and I like this idea of "entities" having lots of "components" to define them, so I tried to implement it.
Here is an simple overview of what i've got so far:

I've a template class that will hold a list for each component type that exit

That allows me to have a collection of components by its type

Which is good because in memory components will be contiguous

Then I've a component manager that hold all these collections and allows me to retrieve a collection at any time

Also, each entity keeps tack of all components it has with a bitset

So in the final result, each index of all component containers belongs to an entity

I know that this causes a problem than, not all entities have all components, so it causes a waste of space... But for now, I can (saldy) live with it

But the real issue for me here is that some components will have same data, and if each entity have a component for that data, this data will be duplicated unnecessary

Even worst, it would require OpenGL to have different objects in memory that are exactly equal and having to enable those objects and disable them many times is not desirable at all.

I've been scratching my head to figure out a solution for this issue but I can't find any. Could someone give me an advice please?

If you've read this far, Thank You!

sentences:
How do I get pygame to work on intel processor? I downloaded Python 3.4 64 bit IDE and pygame but whenever I tried installing pygame it would say "Not supported on Intel".
So are there version of pygame available for Intel processor or are there any other ways to install pygame on an Intel processor?????

sentences:
How to implement scene changing in real-time? I want to implement real-time scene changing effects to make my game could changing from spring to summer, summer to fall, fall to winter. And Chaning effects like this game. Giana Sisters.

I think Giana Sisters use animation to transit from two scenes, but I dont know how to make these animations.

Is any other suggestions could make this effects?

sentences:
libgdx ActorGestureListener.pan() parameters not moving actor in smooth line I override the pan method in ActorGestureListener to implement dragging actors in libgdx (scene2d).

When I move individual pieces on a board they move smoothly, but when moving the whole board, the x and y coordinates that is sent to pan is "jumping", and in an increasingly amount the longer it is dragged.

These are an example of the deltaY coordinates sent to pan when dragging smoothly downwards:

 1.1156368
-0.13125038
-1.0500145
 0.98439217
-1.0500202
 0.91877174
-0.984396
 0.9187679
-0.98439026
 0.9187641
-0.13125038

This is how I move the camera:

public void pan (InputEvent event, float x, float y, float deltaX, float deltaY) {
    cam.translate(-deltaX, -deltaY);

I have been using both the delta values sent to pan and the real position values, but similar results. And since it is the coordinates that are wrong, it doesn't matter whether I move the board itself or the camera.

What could the cause be for this and what is the solution?

When I move camera only half the delta-values, it moves smoothly but only at half the speed of the mouse pointer:

cam.translate(-deltaX / 2, -deltaY / 2);

It seems like the moving of camera or board affects the mouse input coordinates. How can I drag at "mouse speed" and still get smooth movements?

(This question was also posted on stackoverflow: https://stackoverflow.com/questions/20693020/libgdx-actorgesturelistener-pan-parameters-not-moving-actor-in-smooth-line)

sentences:
Box collider don't catch mouse button press event I have a cupboard with 2 colliders - one for cupboard and one for it's box. When I press on the box, I want to open/close it. It worked fine, but now by some reason it only work when I press on the edge on the box. When click on the center, it don't work.

Video: https://youtu.be/OozsAi7KNzs

Here is the code, which play animation (open/close cupboard), when I press on the box:

public Animation[] animations;
public string[] animationName;
public bool playOneDirection;   // should revert animation speed after second playing?
public AudioSource myAudioOpen;
public AudioSource myAudioClose;

private bool isDoorClosed;
private bool isAimationReadyToPlay = true;
private Collider thisCollider;

public void Start()
{
    thisCollider = GetComponent<Collider>();
}

void Update ()
{
    if (Input.GetButton("Fire1"))
        if(DoPlayerLookAtButton() && isAimationReadyToPlay)
            OpenCloseDoor();
}

bool DoPlayerLookAtButton()
{
    RaycastHit _hit;
    Ray _ray = Camera.main.ScreenPointToRay(new Vector3(Screen.width / 2, Screen.height / 2, 0));
    bool isHit = Physics.Raycast(_ray, out _hit, 1.5f);

    if (isHit && _hit.collider == thisCollider) return true;
    else return false;
}

public void OpenCloseDoor()
{
    if (!isDoorClosed) // Play animation with normal speed
    {
        myAudioOpen.Play();
        for (int i = 0; i < animations.Length; i++)
        {
            animations[i][animationName[i]].speed = 1.0f;
            animations[i].Play();
        }
    }

    if(playOneDirection)
        return;

    if (isDoorClosed) // Play animation with revert speed
    {
        myAudioClose.Play();
        for (int i = 0; i < animations.Length; i++)
        {
            animations[i][animationName[i]].speed = -1.0f;
            animations[i][animationName[i]].time = animations[i][animationName[i]].length;
            animations[i].Play();
        }
    }

    StartCoroutine("DelayBetweenAnimations");
    isDoorClosed = !isDoorClosed;
}

IEnumerator DelayBetweenAnimations()
{
    isAimationReadyToPlay = false;
    yield return new WaitForSeconds(0.5f);
    isAimationReadyToPlay = true;
}

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:
Best way to calculate city influence maps similar to civilisation? As the title says, imagine you want to generate the influence mask for a city, given that the map is a 2D grid rather than hex. An extra bit is that different points on the map might have different "influence absorpion" values. Some simple scenarios to make it less abstract:

Scenario 1:
City centered at (5,2) has 10 influence
All tiles have influence_absorption = 1
Tile at (6,2) has 9 influence, therefore within the influence of the city
Tile at (7,2) has 8 influence, therefore within the influence of the city
Tile at (14,2) has 1 influence, therefore within the influence of the city
Tile at (15,2) has 0 influence, therefore out of the influence of the city

Scenario 2:
City centered at (5,2) has 10 influence
All tiles have influence_absorption = 1, but tile at (6,2) has influence_absorption=4
Tile at (6,2) has 9 influence, therefore within the influence of the city
Tile at (7,2) has 5 influence, therefore within the influence of the city
Tile at (11,2) has 1 influence, therefore within the influence of the city
Tile at (12,2) has 0 influence, therefore out of the influence of the city

It's like using dijkstra on a 2D grid with single-source, multiple-destinations. Any pointers for good/fast algorithms are appreciated. Also, if this problem has a well-known name, that'd be appreciated as well.

I made the following algorithm (independently like Jon's, thanks btw, it's the intuitive solution I guess):

p0 = CITY_COORDS
Initialize all influences with 0
set CITY_INFLUENCE as the new influence at p0
list = [ p0 ]
while list not empty
    p = get point in list with highest influence rating
    pi = get influence at point
    pa = get absorption at point
    new_i = pi -pa
    list_is_updated = false
    for each valid neighbour nb
        nbi = get neighbour's influence
        if new_i > nbi
            set new_i as the new influence at nb
            add nb to list
            list_is_updated = true
    if list_is_updated
        sort list // with selection sort, very fast

And I have the following results, which can also be helpful to understand what I'm after:

Influence absorption

Influence mask

Influence visualisation (city at the brightest spot)

sentences:
Game Database Connectivity Java I'm developing a simple multi-player puzzle game in Java.  Both players should be able to view the same game board on his own computer. Then, when one player makes an action in the game (ex. drags an object onto a coordinate space), the game's view should update automatically on the other computer's game screen. I'd like all this to happen over the internet, not requiring both computers to be on the same LAN connection.

If I need to use SQL/PHP to accomplish this, I'm unsure how to design the database to accomplish something as simple as the following:

Player A drags element onscreen
Game sends coordinates of element to database/server

Player B's computer detects a change to an item in the database
Player B's computer grabs the coordinates of Player A's item
Player B's machine draws onscreen elements at the received coordinates

Could somebody point me in the right direction?

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: What does maximum normalized frictional force mean in this tutorial? I tried following this tutorial: https://nccastaff.bournemouth.ac.uk/jmacey/MastersProjects/MSc12/Srisuchat/Thesis.pdf, but in page 19 I ran onto a problem - I don't understand the step 4. It is also not explained before. Could somebody explain what is it and what values may be used?

sentences: Is there a testing framework for bounding volume classes? This may be a long shot, but is there a small framework out there anywhere for testing custom bounding classes and other collision objects? (for example between rays, spheres and AABB's)

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:
What steps should I take to learn level design/programming? I'm still in high school, and I've been playing games for 12 years, and I've always wanted to eventually learn level development and design, and programming. However I'm no good at art and as of now have absolutely no education what-so-ever about either of these things.

I was wondering which fields of study should I branch into in order to learn these things? Is it even reasonable to attempt to learn level creation if I'm no good at art anyway?

sentences: Destroy the enemy only if the animation is played and touch the enemy I am using Unity. I want to attack an enemy with a knife. So I created an object (the knife) and put an attacking animation to it. Now I want to destroy the enemy only if the attacking animation is played and the knife touches the enemy. And if the animation is not played and the knife touches the enemy it should show a game over screen.

sentences:
QT for lan game devleopment I am making a small game for a course in my school and was planning on using QT to build it. I have worked with pygame[last year] and turbo c++[about 5 years agao] to make games, small easy stuff. This time I am planning to make a game that supports multiplayer over lan, the game idea is simple however, information about the game is here.

I was hoping to know from you all, if it is a good choice to use QT for this! I am totally new to QT, but a decent c++ programmer. Also what problems would I encounter when it is a LAN game, for a start I just want it to support 2 players on the local network.

Thanks

sentences:
Can you load all assets inside an Addressable folder? So, I have a folder marked as addressable. This folder has many sub-folders, which might have more sub-folders, ultimately having some .png images.

I would like to load every single Sprite found in my main folder and its children (i.e. recursively).

public static AsyncOperationHandle<IList<TObject>> LoadAssets<TObject>(IList<IResourceLocation> locations, Action<TObject> callback);
public static AsyncOperationHandle<IList<TObject>> LoadAssetsAsync<TObject>(object key, Action<TObject> callback);
public static AsyncOperationHandle<IList<TObject>> LoadAssetsAsync<TObject>(IList<object> keys, Action<TObject> callback, MergeMode mode);
public static AsyncOperationHandle<IList<TObject>> LoadAssetsAsync<TObject>(IList<IResourceLocation> locations, Action<TObject> callback);

The first, third and fourth seem to take a list of keys for individual addressable assets (e.g. the actual Sprites), which is not what I want. I just want to provide the key for the parent folder, and then get all the sprites in it or its sub-folders.

So, the second function seems a bit promising. I would've expected to use it like this:

Addressables.LoadAssetsAsync<List<Sprite>>("Assets/MyMainFolder", myCallback);

But it just tells me that the key is invalid. I've made sure that the folder is addressable, it has that key, and the group has been built.

So my question is: is there a way to load every addressable asset inside an addressable folder? Like how AssetBundles worked.

Unity 2019.3.0f3.

sentences:
2D Tile based Game Collision problem I've been trying to program a tile based game, and I'm stuck at the collision detection.

Here is my code (not the best ^^):

void checkTile(Character *c, int **map)
{
     int x1,x2,y1,y2;

     /* Character position in the map */
     c->upY     = (c->y)                / TILE_SIZE; // Top left corner
     c->downY   = (c->y + c->h)         / TILE_SIZE; // Bottom left corner
     c->leftX   = (c->x)                / TILE_SIZE; // Top right corner
     c->rightX  = (c->x + c->w)         / TILE_SIZE; // Bottom right corner

     x1         = (c->x + 10)           / TILE_SIZE; // 10px from left side point
     x2         = (c->x + c->w - 10)    / TILE_SIZE; // 10px from right side point
     y1         = (c->y + 10)           / TILE_SIZE; // 10px from top side point
     y2         = (c->y + c->h - 10)    / TILE_SIZE; // 10px from bottom side point

     /* Top */
     if (map[c->upY][x1] > 2 || map[c->upY][x2] > 2)
         c->topCollision = 1;
     else c->topCollision = 0;

     /* Bottom */
     if ((map[c->downY][x1] > 2 || map[c->downY][x2] > 2))
         c->downCollision = 1;
     else c->downCollision = 0;

     /* Left */
     if (map[y1][c->leftX] > 2 || map[y2][c->leftX] > 2)
         c->leftCollision = 1;
     else c->leftCollision = 0;

     /* Right */
     if (map[y1][c->rightX] > 2 || map[y2][c->rightX] > 2)
         c->rightCollision = 1;
     else c->rightCollision = 0;
 }

That calculates 8 collision points

My moving function is like that:

 void movePlayer(Character *c, int **map)
 {
    if ((c->dirX == LEFT && !c->leftCollision) || (c->dirX == RIGHT && !c->rightCollision))
    c->x += c->vx;

    if ((c->dirY == UP && !c->topCollision) || (c->dirY == DOWN && !c->downCollision))
        c->y += c->vy;

    checkPosition(c, map);
 }

and the checkPosition:

void checkPosition(Character *c, int **map)
{
checkTile(c, map);

if (c->downCollision) {
    if (c->state != JUMPING) {
        c->vy = 0;
        c->y = (c->downY * TILE_SIZE - c->h);
    }
}

if (c->leftCollision) {
    c->vx = 0;
    c->x = (c->leftX) * TILE_SIZE + TILE_SIZE;
}

if (c->rightCollision) {
    c->vx = 0;
    c->x = c->rightX * TILE_SIZE - c->w;
}
}

This works, but sometimes, when the player is landing on ground, right and left collision points become equal to 1. So it's as if there were collision coming from left or right.

Does anyone know why this is doing this?

sentences:
Stop player following cameras cameras direction Okay I'm not going to go to much into it but this is what I need my script to do. The way I have my controller set up is that the camera looks to the side of the player a little bit. I use this for aiming attacks, bullets and what not. The problem is that it follow the camera when it looks up causing my character to slightly jump ever time I aim and look up. So i want the player to move with the camera while ignoring its y axis. and i need my character to jump so i cant just make the players y movement = 0.

Here's the code I've been using:

transform.position += Time.deltaTime * cameraMain.forward * Input.GetAxis("Vertical") * speedWilAim;

and I am trying to avoid separating the mouse look script into x and y pivots but if there is no alternative I will do that.

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:
Drawing with SpriteBatch and GraphicsDevice.DrawPrimitives I've faced with a problem when i tried to draw 2d game with SpriteBatch and GraphicsDevice.DrawUserPrimitives. I suppose that what is drawing with SpriteBatch has higher priority, because i can not see a result of its rendering. GraphiscDevice.DrawUserPrimitives renders only if i comment a line of rendering background. Here is my method Draw. Could you check the order of rendering. What is the reason?

protected override void Draw(GameTime gameTime)
{
    GraphicsDevice.Clear(Color.BlanchedAlmond);

    basicEffect.CurrentTechnique.Passes[0].Apply();

    spriteBatch.Begin();
    spriteBatch.Draw(background, new Rectangle { X = 0, Y = 0, Height = Bounds.Height, Width = Bounds.Width }, Color.White);

    DrawCell();
    spriteBatch.DrawString(defaultFont, "fps: " + FPS, new Vector2(10, 75), Color.DarkBlue);

    spriteBatch.End();

    base.Draw(gameTime);
}

private void DrawCell()
{
    basicEffect.Texture = cellBody;
    graphics.GraphicsDevice.DrawUserPrimitives<VertexPositionTexture>(PrimitiveType.TriangleList, cell.Triangles, 0, cell.Triangles.Length / 3);
}

protected override void Initialize()
{
    basicEffect = new BasicEffect(graphics.GraphicsDevice);
    basicEffect.TextureEnabled = true;
    basicEffect.Texture = bg_menu;
    basicEffect.World = Matrix.Identity;
    basicEffect.Projection = Matrix.CreateOrthographicOffCenter
  (0, graphics.GraphicsDevice.Viewport.Width,
  graphics.GraphicsDevice.Viewport.Height, 0,
  0, 1);
...
}

sentences:
Read actor instance's text variable for widget when triggered on different objects What I'm trying to do:
(a 'long story version' is linked in comment below)
(and another user example is hyperlinked in comment below - i couldn't post over 8 images and/or links in this first comment*)
(there are other similar user questions elsewhere I know)
Short story: I'm trying to make a widget that is triggered by an actor blueprint, and I want the widget to display different text that reflects the public-variable-text edits I make in the editor.
My latest progress includes actors that are titled somewhat according to the hyperlinked user case above so, I have a "door_trigger" and a "doorWidget". I have altered the pin connections so much that I am just going to copy and paste all my screen shots below.
I got to change text asset DoorName by making a public variable called "name," as you'll see. I can make the trigger show this text on screen and have it disappear when the user leaves the trigger actor, BUT EVERY INSTANCE ALSO SHOWS THIS TEXT VALUE, EVEN THOUGH I CHANGE IT
In the screenshots (some in comment following too) you'll see the text "3" appear on screen, and it does this for all three of the dummy boxes I made; notice how the second box is supposed to show "dd" (I was just typing random filler content).
ALL HELP SO APPRECIATED!!!!! Thank you!!!

sentences:
How can I get visually accurate collision normals with sphere collisions? I'm solving simple 3D sphere collisions by checking the sphere for overlap with a mesh, finding the nearest point on that mesh's surface to the center of the sphere, and then resolving the collision by moving the sphere out of the mesh using the normal and the penetration distance.

To find the normal, I'm using the normalized vector from the nearest point on the mesh to the center of the sphere.

Now I'm trying to resolve a collision where the sphere has overlapped more than one collider. How I'm currently solving it is by iterating through all the meshes and checking to see if the last correction solved the collision.

In the scenario shown in the bottom image, this can cause a problem when trying to determine a collision normal. The two collisions return two different normals, as they should (Though, Depending on which collision was resolved first, the correction from the right box would solve the collision with the left box, in which case there would only be one normal).

Now, mathematically, that all makes sense, but visually causes a problem. If I'm trying to determine a single normal to, say, bounce the ball off the surface create by those two meshes, any normal that takes both collision normals into effect would be inaccurate. Visually, one would expect the collision normal to be straight op, but since one of the collision normals is at an angle, I would need to somehow determine that that is a sort of "false" normal.

The solution that comes to mind is to order the collision checks by their distance from the sphere, thereby ensuring that, in that scenario, the angled normal never even comes into play. Is this an accurate way to do this, or would that cause other problems I'm not seeing?

sentences: Game engine that allows for objects being placed in-game I am looking for a game engine with multiplayer support that allows for players to place objects in the terrain. (eg. in TF2 one can place teleporters, etc... or in minecraft one can place blocks). I don't need the placeable objects to be interactive like in TF2, but I just need an engine that won't make me code this from scratch. I have decent knowledge of Python, PHP, HTML, C++ and C# (and a small knowledge of Lua scripting, although I have only been at it for a few months) so I should be able to handle most engines. So far I have looked at UDK and Cryengine, and wasn't thrilled with either.

sentences:
FPS networking with server sending input instead of gamestate Why do all fps games have the server send gamestate instead of input which is smaller?

One reason I can sort of see is that if the server sends input to the clients and a packet gets dropped then the client will not be able to gave an accurate simulation until a resend of that packet occurs which could be an entire timeout plus one way trip latency. Presumably this is considered unreasonable for a real time fps game.

But what if at time T the server sends the input processed at time T to the client and at time T+1 the server sends the input processed at time T and time T+1. This way if the packet containing the input processed at time T is dropped the client will get the next packet sent by the server which contains the input processed at time T and time T+1. Thus the client will not stall on the simulation because the server is redundantly sending previous input. The server stops sending a previous input when it gets an ack from the client.

This seems to avoid sending the entire game state. Can someone tell me why this idea is just bad and why no fps games use it?

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:
Is std::deque the best option for storing my graphics objects? I am currently implementing an object buffer, which stores all the objects used in the game at one place. All other components of the game, like the user interface, the level loader, etc, add objects to this buffer and then the objects are accessed by the rendering engine to render them all at once.

I need to store the graphics object in the object buffer contiguously in memory, so that  i can take advantage of cpu caching while rendering. I also need to have stable pointers to the objects stored in the buffer as they have to be editable by their pointers by the components that created them, like the user interface must be able to access the graphics it put into the buffer in response to mouse movement with a pointer to that graphic.

These are the reasons i could not use either std::lists, which are not contiguous, or std::vectors, which invalidate all pointers when they reallocate. One data container i found useful was the std::deque, which though doesn't have complete contiguity, does allow some and keeps pointers valid, but what i wanted to ask was is

is there any other data structure out there which is better at what i want?

As far as i understand deques, they are implemented as vectors of arrays of all definite sizes. Is there a data structure that is able to allocate arrays with increasing size, like vector does?

sentences:
How to use a whole new set of assets (reskinning) I need to be able to load my game with a different set of assets, basically reskinning it.

I knew beforehand that I would need a way to do that in the future so right now i'm accessing my assets via a ScriptableObject that I call an "Accessor".

Basically the accessor only hold references to the assets and when I want to get, for example, the sprite for my cards I make a call that looks like that :

Sprite cardSprite = Accessors.Instance.GetCardFrame();

Solution seem simple, I add a layer above the accessors that allow it to choose between differents sets of references.

The problem is that right now I only use the accessors for dynamically generated gameobject ( When I instantiate a card for exemple ). How could I do that with, let's say, UI in the editor ? It will be nearly impossible to work on the UI if I can't see it due to the sprite not being loaded in editor mode.

sentences:
How to get smooth parallax in a wrap-around world I'm working on a multiplayer space shooter a-la Star Control melee. The background of the game consists of several layers of tiles sprites making up a parallax effect of clouds and stars. The player ship is always centered in the viewport.

The game world has a fixed size and implements wrap-around, so that any object that passes the game world bounds is instantly teleported to the other side.

To make the transition seamless when reaching game bounds ,  all objects but the player ship are also rendered outside the game bounds if they are on the other side of the screen. This makes chasing a ship,  for example feel seamless.

Right now the x and y values of the background tile offsets are determined by the position of the player ship in the game world.

bg1.tilePosition.x = -playerShip.x * 0.01;
bg1.tilePosition.y = -playerShip.y * 0.01;

bg2.tilePosition.x = -playerShip.x * 0.02;
bg2.tilePosition.y = -playerShip.y * 0.02;

My problem is with the parallax background when the player reaches the game world bounds. If the ship jumps from x  position 1000 to position 0, for example,  then all the tile positions jump resulting in a jerky movement.

In the following gif I made a semi white transparent background for the game world so you can see exactly the parallax jump as soon as the purple ship wraps around the game world:

How can I avoid this so that the parallax background is always smooth?

Things I've thought of:

Not changing the position of the player when it wraps around, then use a modulo of the game world size for positioning. I can't do that because it will make the game data dirtier and harder to work with plus it increases network bandwidth which I want to avoid
Tying the tile offset to input. The player ship can move without input from collisions/inertia so that's no help

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 to calculate the exit speed of ball bouncing off a solid surface Hey all, I am working on a simple game to include some rigid body dynamics, involving placing (moving & rotating) some springs to bounce a falling ball into a target area.

My problem is correctly calculating the exit velocity of the ball after it hits the spring surface (Vexit, Ve for short)

Assume the following:
Initial ball velocity vector at point of impact is known (Vimpact, Vi for short)
Surface orientation vector is known (Vsurface, Vs for short)
Bounce coefficient (Bc for short) of ball after hitting surface is constant (for example |Ve| = 1.2 x |Vi|)

My algorithm is as follows:
-get surface normal vector, Vn
-get Vi inverse (reversing both x,y components to get reversed direction vector)
-get normalised Vi inverse, call this Vin
-get angle between Vin & Vn, by arccos(Vin . Vn). Let this be angle A
-rotate Vin by (2A) degrees to get normalised exit vector Ven
-Ve = Ven . Bc

Now as far as I can tell, this would work well. However, I am unable to know on whether to perform the rotation step in clock-wise, or anti-clock-wise motion; since the angle i get is always positive

What do you all think of this algorithm anyways?
Can anyone help me out on how to figure out the rotation direction?
Anyone have a better (faster,simpler,more accurate, etc) algorithm to use?

Thanks a lot!

sentences:
How do I scale down pixel art? There are plenty of algorithms to scale up pixel art. (I prefer hqx, personally.) But are there any notable algorithms to scale it down? My game is designed to run at a resolution of 1280x720, but if it is played at a lower resolution I still want it to look good.

Most pixel art discussions center around 320x200 or 640x480 and upscaling for use in console emulators, but I wonder how modern 2D games like the Monkey Island Remake could look good on lower resolutions?

Of course ignoring the option of having multiple versions of assets (i.e. mipmapping).

sentences:
What is the preferred starting address for a C64 game? When writing a C64 game in 6502 Assembler and loading the game using LOAD "Game",8,1, I can choose the address where the game is loaded to. The most popular address I saw is $c000, closely followed by $0810, but I also saw $1000 and $2000 used a lot.

Why would I choose one over the other? I understand $0810 because it's close to $0801 which you have to write the SYS instruction to, but the other addresses all seem arbitrary.

Can someone shed some light into this?

sentences:
Why Are These 3D Square's Pixels Spaced? So i'm currently attempting to write a 3D renderer. From no prior knowledge because I want to challenge myself. But I'm stuck here, and thought I'd bring it to StackExchange because I always see brilliant solutions! If more code is needed please just ask!

This Is My Square Render Code:

public void renderSquare(int xPos, int yPos, float zPos, int width, int height, int color) {
    clearArray();

    for(int y = 0; y < height; y++ ) {
        int yy = y + yPos;

        for(int x = 0;x  < width; x++) {
            int xx = xPos + x;

            float xS = -1f, yS = -1f;

            if(xx < centerX ) {
                xS = ((xx / zPos)) + centerX;
            }else {
                xS = ((xx / zPos)) - centerX;
            }

            if(yy < centerY) {
                yS = ((yy / zPos) - 0.5f) + centerY;
            }else {
                yS = ((yy / zPos) - 0.5f) - centerY;
            }

            setPixel((int)xS, (int)yS, color);

        }
    }
}

Plus How I Set Pixels:

public void setPixel(int xPix, int yPix, int color) {
    if(xPix < 0 || xPix > width || yPix < 0 || yPix > height)
        return;
    try {
        render_buffer[xPix + yPix * width] = color;
    }catch(Exception e) {
        return;
    }
}

Any help is appreciated]1

sentences:
Cocos2dx - Physics - Abort() When Changing Dynamic PhysicBody to Static? I just learned cocos2dx v3.3 integrated chipmunk physics engine.

Here ,as you see, I create a simple circle with physic as:

auto sprite = Sprite::create("circle.png");
auto body = PhysicsBody::createCircle(sprite->getContentSize().width / 2);
body->setContactTestBitmask(-1); //active collisions event
sprite->setPhysicsBody(body);
sprite->setPosition(...);
this->addChild(sprite);

When I toggle this circle static/dynamic in normal situation everything work fine and when circle become static it stop in its position (as we expect gravity don't move it longer). here is a toggle code which works fine:

body->setDynamic(false);
scheduleOnce([=](float dt){body->setDynamic(true);},3,"Back to Dynamic Mode Timer");

PROBLEM BEGINS

But I want when the circle collide with something else ( in my case screen edge with is not important part of scenario), it become static then. so I use below code:

auto contactListener = EventListenerPhysicsContact::create();
contactListener->onContactBegin = [=](PhysicsContact &contact) -> bool
{
    return true;
};
contactListener->onContactPostSolve = [=](PhysicsContact& contact, const PhysicsContactPostSolve& solve)
{
    contact.getShapeA()->getBody()->setDynamic(false); // ==> Cause Abort() !
};

_eventDispatcher->addEventListenerWithSceneGraphPriority(contactListener, this);

But I just face a abort() message and game exit.

The call stack ( God bless it) show that the error is comming from line 300 in CCPhysicsBody.cpp:

if (_world != nullptr)
{
    cpSpaceRemoveBody(_world->_info->getSpace(), _info->getBody());
}

sentences:
Maya Animated Character export for XNA 4.0 problem To begin with, I'm trying to export an animated character in .fbx format from Maya 2013 to XNA 4.0

In Maya, The Model has a basic rig and the animations are in clips made in the Trax editor.

so the issue i'm having is after selecting the model and the root joint and then hitting export in .fbx format, for some reason when i open the exported .fbx file the joint system is detached from the model with no animation.

Btw, i have the animations in clips so that they can be called in code, for example "run","walk","attack".

So, what can i do to solve this problem?

Thank you.

sentences:
How to connect a 3D head to a body? I am new to Unity, game-making, etc.

I have downloaded the trial version of Avatar Maker and a similar Unity plugin called Didimo Editor, with the hope of using their features to make game characters that look like real people, using photographs. They both do more or less what I want.

However, both tools output only heads, and do not connect them to 3D bodies. Avatar Maker has another plugin that allows for this, but it is only for male bodies and most of its features are not to my liking.

So my question is: how can I put these heads on working 3D bodies?

The trailer for Didimo Editor seems to confirm that it can, at least, and Avatar Maker is able to export its heads to OBJ, FBX and Prefab, so I'm assuming maybe there is a way to do that too.

sentences:
How to resolve this problem with an object's collider? In my game there is an obj_maze:

The width of the maze is 10 pixels in all its extension.

In the game, the goal is to get the obj_Cube through the maze.

obj_Cube:

The obj_Cube is wider than the maze on purpose, to get a pixel exceeding all sides as the object runs.

There are also obj_Tubes. They are responsible for defining what position the obj_Cube should go in the intersections that exist in the maze.

The obj_Tubes also have an extra pixel to stand out from the maze.

I made this whole explanation, to make it easier to understand my problem.

When obj_Cube collides with obj_TubeX, its new direction will be defined by what you can imagine.

It turns out that this is done wrongly, detection happens early in the collision, as expected.

Stirring in the bounding box, I was able to correct the problem.

By doing this I get the obj_Cube go right or left correctly.

Now and when the obj_Cube does not come from below, but from the right or from the left? This collision certainly did not happen properly.

Here is an example of the obj_Cube from the right, with the bounding box I used earlier:

The collision is neither detected.

Believe me, I've tested numerous bounding box possibilities for both obj_TubeX and obj_Cube, so that all cases are resolved, but it's physically impossible.

(At least the way I'm trying)...

I also thought about having three equal sprites from each tube with different bounding boxes, but that would be extremely harder and coarser, making my game weigh a lot more.

Sorry for the bad English, I'm not English speaker. I had to use google translator to translate everything.

Thank you in advance!!!

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: OpenGL: VBO or glBegin() + glEnd()? I recently was given this link to a tutorial site from someone who I gave the original OGL Redbook to. The third header down says distinctly to forget glBegin() & glEnd() as the typical render method. I learned via the Redbook's method, but I see some benefit in VBOs. Is this really the way to go, and if so, is there a way to easily convert the render code, and subsequent shaders, into VBOs and subsequent datatypes?

sentences: How do I create a scrollableparallax background in AndEngine GLES1 In my game I want my background to move side by side as the player moves on screen in AndEngine. I moved my sprite using analogScreenControl. I am using AndEngine GLES1. i don't want to move my background automatically but i want to move the background as per player moves on the screen with the help of analogScreenControl.

sentences:
adding radial gradient to heightmap results in jagged edges I am trying to implement a simple heightmap editor. In this editor, you can elevate the terrain by clicking on a spot in the heightmap, and holding down the mouse button. This will little by little, every frame, elevate the terrain into a hillshape. The hills created looks like this:

http://imgur.com/JNBUXz1

As can be observed, however, the edges of the hill has some pretty awful jagged edges:

http://imgur.com/gvCwSQu

I am not quite sure how to get rid of these edges. For every frame that I hold down the mouse, the following code is executed:

float rad = 35;
for(int ix = -rad; ix <= +rad; ++ix) {

    for(int iz = -rad; iz <= +rad; ++iz) {

    // distance from center of hill.
    float dist = sqrt( (float)ix * (float)ix + (float)iz * (float)iz  );

    // if within the radius of the hill(this ensures that the hill is round)
    if(dist <= rad) {

        // the farther we get from the center, the less we increase the height.
        // this effectively results in a radial gradient being added to the
        // heightmap.
        // Note that we use "x*x" instead of "x", because this results in a
        // more round and natural-looking hill
        float x = dist / rad;
        float y = (1.0 - x*x);

        // maximum height of the hill
        float maxHeight =y * (float)MAX_HEIGHT;

        /*
          Note that cx and cz describe the center position of the hill.
         */

        if( heightData(cx+ix,cz+iz) < (float)MAX_HEIGHT) { // do not exceed the maximum height

             // if we hold down the mouse for 30 frames, the hill will reach its maximum height
             float increment = maxHeight  / 30.0;

            if(heightData(cx+ix,cz+iz) + increment > MAX_HEIGHT) {
                 // clamp the hill height so that it does not exceed the maximum height of the
                // height map.
                heightData(cx+ix,cz+iz) = MAX_HEIGHT;
            } else {
            heightData(cx+ix,cz+iz) += increment;
            }
        }

    }

    } // end for
} // end for

As can be observed, every frame I simply add a radial gradient to the heightmap. MAX_HEIGHT = 65535;, because the heightmap is a grid of unsigned shorts. And the resolution of the heightmap is 256x256. But even if I increased it to 512x512, the jaggies still remained.

sentences:
Circle Depth Penetration I'm resolving some collision between circles and I keep getting this problem.

Note: The rectangles are perfect squares fitting the circles so when I type rect.Width I mean the radius of the circle.

What I was trying to do was make it so that if it penetrated it would get pushed out and then the else if would take over and not call the if anymore. but the depth turns out to be a small number such as .6 and then since it's a float it rounds down and doesn't affect the rectangle at all. Even if I add a round function in there it just starts to jitter a bunch.

if (r < rect2.Width / 2 + rect1.Width / 2 && (fN + fG + fA).Length() != 0)
{
    // Resolve depth penetration
    float mDepth = rect2.Width / 2 + rect1.Width / 2 - r;
    Vector2 depth = new Vector2(mDepth * (float)Math.Cos(theta), mDepth * (float)Math.Sin(theta));
    rect2.X -= (int)depth.X;
    rect2.Y -= (int)depth.Y;

    // Apply an equal and opposite force
    fN = -fG

    // Stop the earth from moving
    v2 = Vector2.Zero;
}
else if(r == rect2.Width / 2 + rect1.Width / 2)
    fN = -fG;
else
    fN = Vector2.Zero;

I also tried changing depth penetration too this but the results are no different.

float mDepth = rect2.Width / 2 + rect1.Width / 2 - r;
Vector2 direction = rect1.Location.ToVector2() - rect2.Location.ToVector2();
direction.Normalize();
Vector2 depth = direction * mDepth;
rect2.X -= (int)depth.X;
rect2.Y -= (int)depth.Y;

The only solution we could think of is creating a range of 5 in which the object could be at rest.

if (r < rect2.Width / 2 + rect1.Width / 2 + 5 && r > rect2.Width / 2 + rect1.Width / 2)
    fN = -fG;
else if (r < rect2.Width / 2 + rect1.Width / 2 && (fN + fG + fA).Length() != 0)
{
    // Resolve depth penetration
    float mDepth = rect2.Width / 2 + rect1.Width / 2 - r;
    Vector2 depth = new Vector2(mDepth * (float)Math.Cos(theta), mDepth * (float)Math.Sin(theta));
    rect2.X -= (int)depth.X;
    rect2.Y -= (int)depth.Y;

    // Apply an equal and opposite force
    fN = -fG;

    // Stop the earth from moving
    v2 = Vector2.Zero;
}
else
    fN = Vector2.Zero;

Is there not a better way to do this?

Here is a video outlining the problem. https://www.youtube.com/watch?v=ZREQDA5BN0s Essentially since depth resolution isn't exact the == part of the if statement isn't used I know this because I placed a breakpoint in the first if statement it keeps going there with a depth of around .6. Then rounds down and doesn't move it at all. If I round it appropriately it just jitters a bunch.

sentences:
Cocos2dx- Draw primitives(polygons) on Update In my game I'm trying to draw polygons on on each step i.e. update method. I call draw() method to draw new polygon with dynamic vertices. Following is my code:

void HelloWorld::draw ()
{
    glLineWidth (1);

    CCPoint filledVertices[] = {
        ccp (drawX1, drawY1),
        ccp (drawX2, drawY2),
        ccp (drawX3, drawY3),
        ccp (drawX4, drawY4)
    };

    ccDrawSolidPoly (filledVertices, 4, ccc4f (0.5f, 0.5f, 1, 1));
}

I call the draw() method from the update(float dt) method. The engine is behaving inconsistently i.e. sometimes it displays the polygons and on other occasions it does not.

Is it the right approach to do such a task? If not what is the best way to display large number of primitives?

sentences:
Collision detection for multiplayer game with MatterJS We are developing JavaScript multiplayer top down game where characters can move freely and collide with each other. We are rather weak at mathematics and physics, luckily we don't need much, just some basic movement & collision mechanics.

After a lot of struggle and failures with custom collision mechanics we decided to use MatterJS library. That works like a charm when character collides with static object (like a wall). However when two characters meet, they basically bounce off each other.

We use simple circle based body with frictionAir and inverseInertia set to 0. There is a lot of other properties, but we are rather clueless how the bounce off actually happens. Anybody can point us in the right direction please?

sentences:
How do I implement deceleration? I say "deceleration" because I'm not using acceleration at the moment; what I mean is moving the velocity back towards zero, eventually stopping.

I'm new to vectors and not so great with physics and such. How is "deceleration" normally handled?

What I have now works, but it seems kind of hackish.

update:function(Game, t, dt) {
    var speed = Game.Input.isKeyDown('shift') ? 8 : 4;

    if (Game.Input.isKeyDown('a')) {
        this.velocity.i -= speed;
    }
    else if (Game.Input.isKeyDown('d')) {
        this.velocity.i += speed;
    }
    else {
        if (Math.abs(this.velocity.i) > 3) {
            this.velocity.i += (this.velocity.i > 0) ? -speed : speed;
        }
        else {
            this.velocity.i = 0;
        }
    }

    if (Game.Input.isKeyDown('w')) {
        this.velocity.j -= speed;
    }
    else if (Game.Input.isKeyDown('s')) {
        this.velocity.j += speed;
    }
    else {
        if (Math.abs(this.velocity.j) > 3) {
            this.velocity.j += (this.velocity.j > 0) ? -speed : speed;
        }
        else {
            this.velocity.j = 0;
        }
    }

    this.updateVectors(dt);
}

I used 3 because anything lower exhibits weird behaviour, I'm guessing if I raised the speed then it would need to be changed.

sentences:
How do I generate paylines and pay dots for a slot game? I'm working on a HTML5 slot game and am completely stuck on the pay lines and the dots that produce the lines from 1 end to the other.

What's the logic behind generating a random number of dots (9-30) and then paylines properly? Paylines shouldn't overlap each other. Similarly paydots shouldn't overlap and position themselves properly. On a small mobile screen 30 dots should just fit fine.

Then, how can I go about matching combinations from reels against the paylines?

sentences:
Unity FPS - Joining players always take over the camera I created a "network manager" and a "network manager hud" for the whole scene. My character is a simple capsule and has a camera, a weapon spawner and 3 weapons as children. I gave him a "network identity" and a "network transform", rewrote the "capsule controler" (attached to the capsule) and also the "mouse controller" (attached to the camera) and saved it as a prefab. I configured the network manager to take the prefab as spawn object and use the default settings of the network manager: localhost:7777.

Now my problem.

I have build an instance of the game, run the inline game as host (localhost:7777) and everything works. Then i run the external build (tried localhost and even local ip)

As soon as i join the game using the 2. instance, the second player take over the camera of the first player! And in the first instance it seems like both cameras are rendered in paralell.

If i dont attach cameras to the player, i can control them as expected :#

Now, finally my question: What am i doing wrong or do i miss?

Thank you

sentences:
Paint game level algorithm I have a game, and I have a level editor where you can build your level from blocks. Blocks positioned in cells. So blocks can have no neighbours or have one or few neighbours. My problem is that I need to put appropriate texture to block, based on block position related to another blocks. Is there some specific algorithms or methods that can help me?

I want it to update textures after adding/moving/deleting each block so it should be fast.

Levels can look like

- - - - - - - - - - - - - - -
|                            |
|             |- - - |       |
|             |- - - |       |
|                            |
|         - - - - -          |
|         |       |          |
- - - - - |       | - - - - -|

sentences:
best way to destroy an gameobject in unity MissingReferenceException: The object of type 'GameObject' has been
  destroyed but you are still trying to access it. Your script should
  either check if it is null or you should not destroy the object.
  grid.objGridSize () (at Assets/scripts/grid.cs:119) grid.hit
  (System.String hitObjString) (at Assets/scripts/grid.cs:109)
  grid.Update () (at Assets/scripts/grid.cs:80)

I'm getting this error and strange results after finding a gameobject, storing it in a new GameObject variable and then destroying it:

void Update () {
    if(Input.GetButtonDown("Fire1")){ // detect left mouse click

        ray = Camera.main.ScreenPointToRay(Input.mousePosition);

        Debug.Log("clicked");

        if(Physics.Raycast(ray, out hitObj)){
            if(hitObj.collider != null){

                // send a message to the object that got hit
                hit(hitObj.collider.gameObject.name);
            }
        }
    }
}
public void hit(String hitObjString){

    Debug.Log("I got hit: "+name);

    GameObject hitTile = GameObject.Find(hitObjString);

    if( hitTile.tag == "tile"){

        Destroy(hitTile);
    }
}

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

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

sentences:
Vectorial clothes / hair cuts that adapt on any character size, how is it done? Rimworld characters are simple but very nice to watch.
They have different sizes, hair cuts, clothes...
And everything seems to adapt to everyone. How does that work technically ?

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

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

See Veli & Baldwin or Tau & Kish below:

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

sentences:
Should Client->Server/Server->Client packets be separate? When working on network packet structure for games, what is more efficient (in terms of code structure) for packet reading for client/server?

Currently, Our packet structure is to send the packet ID as an Int32, which is read when it is coming into the server.
But to minimize the amount of packet ID's we use, instead of having a (for example) LoginRequest AND a LoginResponse, we use just a Login packet. The data is structured differently whether it is the server, or client sending the packet.

Should we use an individual Packet for each Request/Response? Or is there a better way?

EDIT:

And by data being different for whether it is the client or server sending, it is different in terms of complete packet structure. So while it still has the same ID, it uses entirely different data types.

Example (Using a Lobby Request/Lobby Response as one packet)
Client Request

Packet Id (Int32) (Lets say ID = 5)
LobbyName (String)
LobbyPassword (String)
GameLobby (Boolean)

Server Response

Packet Id (Int32) (still ID = 5)
LobbyName (String)
GameLobby (Boolean)
MemberCount (Int32)

sentences:
NPC interaction depending on conditions stored in XML I am developing a RPG game for Android using LibGDX, at this moment the NPCs in the game have some moving AI (pathfinding), like random directions and stuff.
Now I am working on the dialogue system, for that I have the following:

DialogueManager class that just renders the current dialogue on the screen if any
A Dialogue class which consists of an ArrayList of Strings which are the lines of the dialogue
The NPC class holds a Dialogue object, so I can just add(text) to the dialogue.

The result of this is the following

The player is near a NPC and presses Action key
A window is opened showing the current line of the dialogue
When the players touches the screen, the line is replaced by the next one until there is no more lines left and the dialogue window closes and the player can move again
If the player talks to the same NPC, the same dialogue lines are presented

It works fine, but that is not what I really want. I need to make the dialogue to be different depending on some conditions the player has. My dialogues are stored in an XML file:

<npc>
    <name>Alice</name>
    <interaction>
        <dialogue>
            <line>Hello there!</line>
            <line>This is a simple dialogue</line>
        </dialogue>
    </interaction>
</npc>

But I want to have something like this (and I have it in the XML):

<npc>
    <name>Alice</name>
    <interaction>
        <dialogue condition="timesTalked" value="0">
            <line>Hello there!</line>
            <line>You are talking to me the first time!</line>
        </dialogue>
        <dialogue condition="timesTalked" value="1">
            <line>Hmmm...I remember you! Have we met before?</line>
        </dialogue>
        <dialogue condition="haveItem" value="Apple">
            <line>Is that an apple? Gimme!</line>
        </dialogue>
    </interaction>
</npc>

So for example "timesTalked" is a real variable name and "value" is the condition, so the first condition would say

if(timesTalked == 0)
   // do stuff

Now the problem, how can I implement that? I know how to parse the XML, but how can I make it so the conditions work? I don't want to have it all hardcoded in Java, also I dont want to use a scripting language, I think it is good to have XML because is lightweight and easy to use.
Thankyou!

sentences: Create fog (smoke) on Unity3D? I'm creating a game where you are inside a boiler room, the problem is I want to create the fog (smoke) to make this more realistic.

sentences:
Animations in FBX exported from Maya are anchored in the wrong place We are trying to export a model and animation from Maya into Unity3d.

In Maya, the model is anchored (pivot point) at the feet (and the body moves up and down). However after we have performed the FBX export, and imported the file into Unity the model is now appears to be anchored by the waist/head and the feet move.

These example videos probably help explain the problem more clearly:

Example video - Maya - Correct
Example video - Unity - Wrong

We have also noticed that if we take the FBX file and import it back into Maya we have exactly the same problem.

It seems to be that the constraints no longer work after the FBX is reimported back to Maya, which just kills the connection between the joints and the control objects.

When we exported the FBX we have tried checking the 'bake animations' check box.

The fact that the same problem exist when importing the FBX back into both Maya and Unity suggests that the source of the problem is most likely with the Maya FBX export.

Has anyone encountered this problem before and have any ideas how to fix it?

sentences:
XNA SoundEffect with offset I've been trying to make a soundmanager recently which has several functions which fits my needs. But one thing I can't solve, is the offsetting the soundeffects.
Is it possible to play a soundeffect from a specific point? I know I have to use the buffering, but I couldn't find anything on the net about it. Any help would be appreciated!

sentences:
Should I keep login server apart from game server? I'm thinking of making a MMO server, and I've been looking at how other games structure their network. One of the things I've noticed is that there's always a Login server and then the game server(s).

I'm still deciding if I should do this, but I would like to hear some opinions first.
What are the advantages of this, and how does the login server communicates with game server to handle logins?

sentences:
Godot Particles Randomly Turn Off I have a particle emitter on a rocket just to simulate some smoke. The rockets can be free-fired or lock onto a target and gradually steer towards the target. There is an issue that I can't seem to fix. When the rockets steer too sharply from their original trajectory the particle emitter turns off. Printing trail_particles.emitting shows true. GIF illustrating this issue:

I can share code, though I'm not sure which part would be relevant since I don't access the particle emitter in code.

sentences:
Simple Java networking game engine I want to create a simple java networking game and search a networking engine that eases use of sockets etc. I have already read some questions on here and the internet about java networking for games, but many of them were over 10 years old or not really answered.

I have no idea whatsoever about what exactly I need to send in terms of messages, but I figured simple strings or integers will be enough for my purposes.

It's basically a peer to peer game, so I don't need a centralized server structure. Messaging doesn't have to have an extremely low ping, yet of course all players need to have a synchronized view.

What are the possibilities I have here?

sentences:
Querying game objects in real-time I'm thinking about working on a game where I need to find all the objects matching certain properties.

For instances I might need to look up all the objects...

Producing gold.
Whose level is 5 or higher.
Within 10 meter from a point.
Currently fighting.
That have anything to do with metal (e.g. producing, consuming, made of, wearing, standing on etc).

And so on and so forth. I would also like to be able to add new objects with new properties without having to change everything else.

Ideally I would need to run multiple queries per frame (hundreds or thousands per second). I'll probably rely on some properties way more than others, but this kind of usage pattern is likely to change over time.

Is there any data structure, design pattern, method or idea to help me implement an efficient real-time query system?

I've been thinking about assigning to each object a dynamic set of tags with properties, then recursively partition the space storing in each partition a mapping from those tags to the objects. It might work, but I'd like to hear about existing solutions before wasting efforts.

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:
Ghost replay - storage and timing I am working on a car race game and just implemented a ghost sprite for replaying past races.
I use a physics engine and after much reading I came to the conclusion that the best way to store the ghost data for replay would be to record the car's position and rotation at given timepoints, as for example described here: https://gamedev.stackexchange.com/a/8380/26261.

But what would be a good way to find those timepoints during replay?
An example would be a record with this data:

time: +3.19932 (seconds since race start)
position:  180,40 (position at that time)
rotation: 30.4 (rotation at that time)

But I have several problems with that:

When I replay, it's unlikely that I reach the exact timepoint at 3.19932 again - more likely, I will have a timepoint around 3.1 and have to find the closest matching record. When interpolating, even the closest matching above and below. This sounds very inefficient and time consuming?
In which list structure could I store these records for a later replay? An array? Doesn't that mean that search time for records matching a certain time will increase the longer the race is?
Which frequency should I use for timepoints? Each frame would be -I guess- overkill, rather I should save i.e. every nth frame and interpolate in between, which makes the storage questions in 2. even more difficult.

So is this idea even the right approach? If yes, how could I efficiently store and retrieve the data?
Please note that I generally would like to go with using the data structure above, not deterministic gamestates and recording user input etc.

Thanks for any help!

EDIT:
I realise I should describe the environment I use: Cocos2D for iPhone.
There is a method update:(ccTime)delta. Ideally, this method would be called every 1/60 seconds, but there is no guarantee - delta is the actual time passed since the last gametick and could be a lot more or less than 1/60.
It is in this method where I would like to store the current gamestate.

sentences:
To canvas, or not to canvas, when building browser-based games? Background: I have extensive development background, but the last time I coded a game was many years ago. My Javascript skills are quite limited, and I intend to improve them by building a simple game — Tetris, Pac-man, or something of that complexity level.

Question: It seems to me that a fundamental choice I need to make is whether I should render on a <canvas> element or not.

With a canvas, I have basic tools for rendering points, lines, and more complex things on top of that. Presumably there are, or will be, also various frameworks to help with this.

Without a canvas, I could keep my objects in the DOM-tree, like a regular webpage, only quite complex, with many overlapping elements.

Is one approach better than the other? Are they mutually exclusive? How do I know which to pick?

sentences: Creating an Isometric tile map with HTML5 I'm trying to create an isometric tile map using HTML5 Canvas.  Everything I've found online points me towards using a pre-built engine.  I'd like to learn how to do this without using an engine.  Is it possible to do this?  If so, how?  Would I need to look into WebGL?

sentences:
Is using the applet class in a Java game a wise thing to do? I am making an 2D multiplayer game in Java project, by using Java sockets and simple  java.applet.*

Our teacher told us to use J2EE concepts in the project. Do I have to use JSP? Is it better or more employable in game development?

Am I doing the correct thing?

sentences:
What is more efficient: Using matrix translation to move a character, or using a vector/scalar? In 2D or 3D, matrix transformations are used for rotation, scaling, and sheering. However, when it comes to movement, should I go out of my way to use and implement scalar/vector movement, or just stick to matrix translations?
Thanks.

sentences:
Smoothly switch between 2 pairs of oscillating colors I have a simple script that changes the emission color based on a bool.

The first color is its idle color, which transitions between orange and light purple using a lerp weighted with a sine wave.

The second color is its "isinDanger" state, and this lerps between orange and red.

Is there any way to make the transition between both of these color variants smooth? When the bool is set to true the colors switch instantly with no transition. I've tried numerous things to try to get them to be smooth but ultimately it just breaks the lerping.
using System.Collections;
using System.Collections.Generic;
using UnityEngine;

public class GemGlowOrange : MonoBehaviour
{
    public Material Mat;

    Color Red;
    Color lightpurple;
    Color orange;

    public bool isInDanger = false;

    Color CurrentColor;
    float startTime;

    public float speed = 1.0f;

    void Start() {
        startTime = Time.time; // time since game started

        orange =  new Color(1.320755f, 0.5346785f,0.2928088f,1f); // making my colours RGBA

        Red = new Color(0.858f, 0f,0f,1f);

        lightpurple = new Color(1.320755f,0.2973427f,0.8263685f,1f);

        var Mat = GetComponent<Renderer>().sharedMaterial;
        // making a reference to the material so we can enable the emission keyword if you do not want this to affect every object using this
        //material then use "Getcomponent<Renderer>().material" the same goes with setting the color as you can see further down.

        Mat.EnableKeyword("_EMISSION"); // this is making sure this shader has the emission keyword enabled.
    }

    void Update() {

        float frac = (Mathf.Sin(Time.time - startTime) * speed);

        CurrentColor = Mat.GetColor("_EmissiveColor");

        if (!isInDanger) {
            Mat.SetColor("_EmissiveColor", Color.Lerp(lightpurple, orange, frac));
            // getting the same material over and over again each frame and updating its
            // emission colour
        } else if (isInDanger) {
            Mat.SetColor("_EmissiveColor", Color.Lerp(Red, orange, frac)); // if it is in danger then it will alternate between red and orange.
        }
    }
}

sentences:
trouble in making a game questions? all i've a little trouble understanding some concepts while making game please give your suggestions on my questions.

I have a animated sprite image this i want to move this image according to given path. I can get path from

    Path path = new Path();
    Point s = new Point(150, 5);
    Point cp1 = new Point(140, 125);
    Point cp2 = new Point(145, 150);
    Point e = new Point(200, 250);
    path.moveTo(s.x, s.y);
    path.cubicTo(cp1.x, cp1.y, cp2.x, cp2.y, e.x, e.y);

    canvas.drawPath(path, paint);

these points are hard coded and give different results on different screen.

Q1. How can i make path which is similar in all screen size?

Q2. How can i move my animated sprite image according to given path with the image has it's head according to path?

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 can I compare two quaternions for logical equality? I'm trying to write some unit tests and realize I don't know how to compare quaternions. I need to know if two quaternions represent the same orientation (the object would be facing the same way). With a vector like position I'd simply compare the parts and check they are close enough, but for quaternions the values can be very different.

How can I compare two quaternions?

sentences: How do you create a fractal cube-map? I want to create a map similar to how Mincraft and other related games do. I just haven't the faintest clue on how to do so. Can anyone point me to a decent tutorial or give me a decent run through? I program in java and use openGL.

sentences:
Is this a viable architecture for lag compensation? In some games/engines (such as Source), the server compensates for latency by applying player inputs in the past. Whenever the server receives a player's input for a frame, it rewinds the game to the frame that input was intended for, applies the player input, then simulates the game again up to the current time. The server needs to do several times as much game-logic computation as the clients, as each frame can be simulated many times - so it seems like this would not scale well to many clients or processing-intensive games.

However, we can turn this around. If the client input for a particular frame always arrives before the server simulates that frame, then the server never needs to rewind - it only ever simulates each frame once.

In order for a player's input to reach the server before the frame that the player entered it on, the client needs to run in advance of the server. If a particular client has a latency of 250 ms, then it must simulate tick 51388 at least 250ms before the server simulates tick 51388.

Therefore, the client must be predicting the game state several ticks in advance. Every time the client receives an update from the server, the client rewinds the game, applies the update, and fast-forwards up to the current time.

If n is the number of clients, then the clients each do O(n) extra work per tick to support lag compensation, instead of the server doing O(n^(2)) extra work per tick (assuming the game state size scales as O(n)).

I don't know of any games that actually do this. What are the problems with this approach?

sentences:
How should I parse user input in a text adventure game? Parsing user commands in a text adventure is a spectrum from Adventure's simple "go north" to some mind-bogglingly clever ones in hhgttg.

I seem to remember reading nice how-tos in computer magazines back in the 80s, but now I find almost nothing on the 'net except a brief Wikipedia ref.

How would you do it?

Update: I went with the simplest approach possible in my Ludum Dare entry.

sentences:
Modifying Brackeys Unity Inventory Tutorial for Stackable Items? I followed this tutorial: https://www.youtube.com/watch?v=w6_fetj9PIw
and the one after it, and it works fine, but now I'm in a situation where I want to be able to stack my items up. I saw there was a thread on the brackeys forums about this a few years(!!) ago, but the files aren't available and I saw people were having issues with it anyway. Can anyone think of a way to modify it and preferably allow for easy loading/saving as well down the road (though absolutely not necessary, I can go down that rabbit hole later), or alternatively point to a different tutorial that would do so? Thanks in advance!

Here's the link to the scripts, I only went up to video 6 so there might be some new stuff in there but it should at least help!
https://github.com/Brackeys/RPG-Tutorial/tree/master/Finished%20Project/Assets/Scripts/Inventory

(note: I added a variable to the item script that keeps track of how many items of that type the player has, but the problem is that when I add a new item to the inventory it keeps adding it to a new slot and messing up the counter because I'm unsure where to check if the item already has a slot in the inventory and what to do about it.)

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

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

My options menu:

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

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

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

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

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

sentences:
Unable to edit tile sizes in unity I'm trying to change the size of sprites in unity to fit the palette. Except there are no options to change multiple sprite sizes at once.

But when I watched a youtube video on tilemaps and palettes, there were options to change the size of the entire palette!

v2019.2.11f1 (Personal)

sentences:
How to get the fingerID (Touch) that is pressing a specific UI button. (Unity) I want to displace a button along with the screen position that is pressing on it.

However, having multiple touches at the same time results in wanky behaviour.

So I want to limit the button's movement to the touch that started it.

I'm aware of the PointerEventData.pointerId but I couldn't figure out how to use it.

sentences:
InvalidOperationException when peeking from a stack within custom editor I've got a simple state machine for handling game states which works using GameObjects that I enable/disable in order to switch the states. Since some states can be loaded additively (such as the pause menu), I'm using a stack to manage the currently active ones.

public class GameController : MonoBehavior {

    private readonly Stack<GameObject> _stateStack = new Stack<GameObject>();

    public GameObject ActiveState {
        get { return _stateStack.Peek(); }
    }

    public void SetState(GameObject newState, bool isAdditive = false) {
        if(newState = null || newState == ActiveState)
            return;

        if(!isAdditive) {
            while(_stateStack.Count > 0)
                PopState();
        }

        if(!newState.activeInHierarchy)
            newState.SetActive(true);

        _stateStack.Push(newState);
    }

    public void PopState() {
        var gameState = _statStack.Pop();
        if(gameState != null)
            gameState.SetActive(false);
    }

}

Now I'd like to have a custom editor which allows me to see and set the currently top-most active state.

What I did was this:

[CustomEditor(typeof(GameController))]
public class GameControllerEditor : Editor {

    public override void OnInspectorGUI() {
        DrawDefaultInspector();

        var controller = target as GameController;
        if(controller == null)
            return;

        var newState = EditorGUILayout.ObjectField("ActiveState", controller.ActiveState,
              typeof (GameObject), true) as GameObject;
        if (newState != controller.ActiveState)
            controller.SetState(newState);
    }

}

However, the custom editor is never visible and in the console, I see the following exception:

InvalidOperationException: Operation is not valid due to the current state of the object
System.Collections.Generic.Stack'1[UnityEngine.GameObject].Peek()

What does this even mean? What state? Is the stack not initialized? How does Unity instantiate MonoBehaviors when applying a custom inspector?

sentences:
How can I randomly choose a monster from an array of monsters? I have a problem dealing of how can I call the values inside the arrays correctly. First of all, I am into making an array of monsters and a set of hp for them. I made it this way:

string monsterlist [] = {"Imp", "Orc", "Troll", "Gnome"};
float monsterhealth [] = {5.0f, 8.0f, 9.0f, 10.0f};
int monsterlife;
int monsternumber;

wherein, since i can not call the variables correctly, I made a very simple way to do it, which is:

srand(time(0));
monsternumber = 1 + (rand() % 3);
if (monsternumber == 1)
    cout << monsterlist[1];
else if (monsternumber == 2)
    cout << monsterlist[2];
else if (monsternumber == 3)
    cout << monsterlist[3];
else if (monsternumber == 4)
    cout << monsterlist[4];

Is that correct? I know it might be not the proper way. This is what I wanted:

I want to create a random number generation from 1 to 4 and store that variable in monsternumber. The next thing that will happen is, if the monsternumber is equal to 1, for example, should make the monster Imp and 5.0 as its health, seen from string monsterList and monsterHealth.

Is there a proper way to make this simplier or rather the correct way of doing it?

sentences:
Critical input from server arrives late... it must not! To preface, my understanding of networking is mostly from Source Multiplayer Networking and 1000 Archers on a 28.8.  For various reasons I have decided to go with a client-server model instead of peer-to-peer.

My C#/Unity multiplayer game is ruled by an authoritarian server, which uses UDP. Each network instruction has a time index, and is inserted into PlayoutBuffer's data collection.  The buffer executes stored commands at the correct local time index, based on a fixed update loop.

The server is slightly ahead of time, and clients will pause if they have not received any regular update from the server, allowing them to catch up.

Each client will simulate object movement and this movement is corrected by the server (ten times a second).  I've got the basic system working, but when I'm testing it in two windows on the same machine sometimes input arrives late, and is dropped.

Usually the late message is 1 time index too late.  The fixed loop is 50 ticks per second.  The server is 5 ahead of time, and commands are scheduled 5 ahead of time (assuming negligible lag, since ping hasn't been implemented yet and is on the same machine).

This is a problem.  Inputs from server are grouped into a few specific channels:
Ping, Serialise, Inputs, Criticals, Corrections.

Ping has yet to be implemented.  Serialise packs and unpacks mostly pregame multiplayer lobby stuff.  Inputs are player commands; select unit, issue move order, etc.  Criticals are essential updates; create unit, shoot unit's weapon, damage unit, etc.  Corrections are mostly movement updates.

All channels are unordered and with the exception of Corrections all channels are "Reliable" in Unity terms (see Unity documentation).  Given that movement updates happen regularly, if a few are dropped or arrive late this is not a critical system failure.  But if a critical is lost, this would effectively result in a desync.

How can I prevent and handle critical data arriving late from the server?
My first thought is to implement a custom ping. This is used to set the time index for the data relative to the time the last ping took to get back from the client, plus server time index.

But I doubt that would be enough... and if it fails?  Should the client pause or catch up based on the difference between local time index and the time index in the late critical?  Does the PlayoutBuffer need to become an AdaptivePlayoutBuffer to resolve these issues to handle CPU and network lag?  If so, how so?  Any other ideas welcome!

EDIT: The reason inputs were arriving one time index too late sometimes was because the buffer's for loop which read inputs counted from 0 to list.count, and removed items as it iterated... when I changed it to reading from list.count to 0, it fixed the issue and no inputs arrived late.  Whoops.

sentences:
C++ Using clock() with IsKeyDown I am trying to replicate the game Asteroids as a class project. I am having trouble measuring the time elapsed while the "W" key is pressed.

This code is supposed to increase the force applied to the spaceship to increase the movement speed incrementally. This is supposed to let the space ship rotate while moving along a 'line' and then force while be slowly applied to the new direction the ship is angled.

I have tried to research this over many hours and I still don't understand the concept. It seems there are a few ways to go about this but neither attempts have been successful.This is for school submission for the first project of the first year, so obviously my code is very basic and not making use optimal use of classes/structs however I would still like to achieve this movement I have been seeking so that I can understand the concept for use in future projects.

I have tried the use of current/previous variables for speed but haven't been able to come up with an equation to accomodate that. I have also attempted the use of a timestep but have been told that is not the correct approach. Any help would be appreciated. You can view the bulk of my program at https://gist.github.com/Rifuli/4762704

sentences:
Game Modeling good practice regarding quads and ngons I'm asking myself if using quads is really the better practice instead of using ngons (for flat surfaces!) when it comes to game modeling.

I often read this and saw models that look like this (96 tris!).

But I can't understand why this should be preferred instead of this model using ngons (60 tris!)

Are there reasons why the quad variant with more tris should be preferred also for a final game model (that also does not use displacement mapping for example) or is the n-gon actually preferred in such cases because of the lower triangle count?

Because it came up in the discussion: This should be of course only valid for static objects that do not deform, my question came up because I saw that models which are most likely not supposed to deform are modelled using the additional quads and I'm wondering if there's really any benefit of doing it (I just see the disadvantage of additional triangles so far).

sentences:
Many sources of movement in an entity system I'm fairly new to the idea of entity systems, having read a bunch of stuff (most usefully, this great blog and this answer).

Though I'm having a little trouble understanding how something as simple as being able to manipualate the position of an object by an undefined number of sources.

That is, I have my entity, which has a position component. I then have some event in the game which tells this entity to move a given distance, in a given time.

These events can happen at any time, and will have different values for position and time. The result is that they'd be compounded together.

In a traditional OO solution, I'd have some sort of MoveBy class, that contains the distance/time, and an array of those inside my game object class. Each frame, I'd iterate through all the MoveBy, and apply it to the position. If a MoveBy has reached its finish time, remove it from the array.

With the entity system, I'm a little confused as how I should replicate this sort of behavior.

If there were just one of these at a time, instead of being able to compound them together, it'd be fairly straightforward (I believe) and look something like this:

PositionComponent containing x, y

MoveByComponent containing x, y, time

Entity which has both a PositionComponent and a MoveByComponent

MoveBySystem that looks for an entity with both these components, and adds the value of MoveByComponent to the PositionComponent. When the time is reached, it removes the component from that entity.

I'm a bit confused as to how I'd do the same thing with many move by's.

My initial thoughts are that I would have:

PositionComponent, MoveByComponent the same as above

MoveByCollectionComponent which contains an array of MoveByComponents

MoveByCollectionSystem that looks for an entity with a PositionComponent and a MoveByCollectionComponent, iterating through the MoveByComponents inside it, applying/removing as necessary.

I guess this is a more general problem, of having many of the same component, and wanting a corresponding system to act on each one. My entities contain their components inside a hash of component type -> component, so strictly have only 1 component of a particular type per entity.

Is this the right way to be looking at this?
Should an entity only ever have one component of a given type at all times?

sentences: Mysql database reading and writing In my Libgdx application I would like to be able to connect to a mysql server securely and read and write data from it without other users injecting, or changing information. I've found this: http://www.helloandroid.com/tutorials/connecting-mysql-database but its only for reading what about writing data without people messing with it with other apps? I need a form of unique verification.

sentences:
How are Objects rendered or updated, when there's a Pool class? I have a State (Title State for example), that has the ResourcePool (getImage();getSound(); etc.)
and a list of the GameObjects.

How do GameObjects get access to the Resources in the Pool they need?

Should the GameObjects have a reference to their resources at construction time or possibly even the pool itself?

The GameObjects render/update themselves.

sentences:
Animation works, but Unity doesn't realize it I have an animation which plays once, and it played once just fine.  I want to Invoke a method as soon as the animation finishes.  I have been researching and experimenting for over an hour now, but without the result I want.  I try to get the animation from the Animator, but Unity says my animation is not attached.  The thing is, I don't care if it's attached...I just want to know how long it is, not actually do anything with it.  How can I achieve this?  Here is the code which results in the error:

CODE:

using UnityEngine;
using System.Collections;

[RequireComponent(typeof(PolygonCollider2D))]
[RequireComponent(typeof(Animator))]
public class Construction : MonoBehaviour
{
    // Use this for initialization
    void Start()
    {
        Invoke("EnableObstacleState", GetComponent<Animator>().animation.clip.length);
    }

    private void EnableObstacleState()
    {
        GetComponent<PolygonCollider2D>().enabled = true;
    }
}

ERROR:

MissingComponentException: There is no 'Animation' attached to the "Barricade(Clone)" game object, but a script is trying to access it.
You probably need to add a Animation to the game object "Barricade(Clone)". Or your script needs to check if the component is attached before using it.
Construction.Start () (at Assets/Scripts/Construction.cs:11)

sentences:
How can i add spaces between gameobject when Instantiate? void Update()
    {
        if (Input.anyKey)
        {
            foreach (Transform child in go.transform)
            {
                if (Input.inputString == child.name)
                {
                    Instantiate(child);
                }
            }
        }
    }

I want to Instantiate the gameobjects with a space between each one that i will set with public variable. And that the gameobjects position will start from the 0,0,0 of the terrain.

For example like that:

sentences:
How can the player open this door and have its collision physics stay in sync? I just finished modeling a scene in Blender like this:

Now I'm animating and creating interactions between the player and the objects inside the house. When I reached the doors, I started having doubts.
Originally, I created the doors animations using Blend Shapes to easly control the transition between the open/close states and to allow the door being half opened or closed. (That's because my interaction system allows to interact partially with object, like for example the door system at Amnesia The Dark  descent / outlast)

The trouble is, that the collider of the doors doesn't update when the Blendshapes values changes.
How can the player open this door and have its collision physics stay in sync

sentences:
How to vectorize a raster image edges into SVG paths? I'm having a lot of trouble figuring out how to convert a 2D list of points into an SVG Path representing a political map border. I have completed all parts of a 2D terrain generator, including climate simulation, rivers, lakes, rainfall, temperature, biomes, and finally territories. This last part is where the problem lies. The entire script is written in Python.

I have a list of territories, which are represented as dicts with several properties. One of which is Color, used as an ID and to output a pretty map. Another is a list of Pixels, list of Borders, and list of Neighbors. Pixels refers to all points in the territory. Territories can be thought of a polygons. They have Border pixels, which are defined as any outside (meaning not part of the Pixels list) pixel not belonging to this territory (whether it be a River, Ocean, or Unowned pixel). I also keep a list of neighboring territories.

Now, I can't store an array of ~3000 coordinates in a database efficiently when I only really need the border. I aim to draw only the world map with the borders of each territory drawn in a layer above. So I need to convert the border to an SVG Path string.

The Borders list is unordered when the generator finishes. For each border pixel, I go clockwise around the pixel and look for another, and progressively create a SVG Path string. I can't seem to efficiently parse the borders without getting stuck. Another problem is that there may be "lakes" in the middle of the Territory, and Borders are added around those as well. These don't have to be included in the path string.

Territories can also wrap around horizontally (like Google Maps for instance), splitting the territory in two.

So the final result of my algorithm would ideally be an LIST of SVG Paths, each representing individual parts of the territory polygons.

But, how do I do this efficiently? Is there another way to efficiently store a list of potentially thousands of coordinates representing the shape of the territory?

Each white line that sticks out from the coastline is a river. You can also see a lake in the middle of the lower green territory.

PS: I was unsure of a title, if a mod would like to change it.

sentences: TTF fonts are being converted to image in CPU or GPU? Once I use a TTF font, when they are being converted to images to be rendered? Does CPU or GPU do the conversion? How heavy is that operation?

sentences:
How to rotate just the object being touched in Unity? For my first steps in Unity I am just trying to rotate some squares when I touch them.

 using UnityEngine;
using System.Collections;

public class testskript2 : MonoBehaviour {

    // Use this for initialization
    void Start () {
        //transform.Rotate(Vector3.forward * 2 * 100);
    }

    // Update is called once per frame
    void Update () {
        if (Input.touchCount == 1) {
            Ray r = camera.ScreenPointToRay(new Vector3(Input.GetTouch(0).position.x, Input.GetTouch(0).position.y));
            RaycastHit hit0;
            if (Physics.Raycast(r, out hit0, 100f)) {
            transform.Rotate(Vector3.forward * Time.deltaTime * 100);
        }
    }
}
}

It isn't working this way. Any tips?

sentences:
What is a good balance between client and server actions? I'm working on a voxel-based game right now which will have a lot of events, like clicking a block or object.

Say I want to open an interface when I click a certain block. Should I handle this on the client, or send a packet to the server with the action and it's details such as what the ID of the block is, its position et cetera, and then send a packet back to the client with the action OpenInterface with the interface ID?

sentences:
How to draw a character behind and in front of a building? (isometric map) how is it possible to draw the player behind and in front of some building in an isometric map : should I slice them, replace the number in the map (one number for a tile usually) by an array of number (each being a piece of a bigger tile), and somehow add a Z-order related to each small number (the pieces of building), something like this?

//replace :
var map = [
    [1,0,1],
    [0,1,1],
    [0,0,1],
    [0,0,1]
];

//by :
var map = [
    [["2-zOrder/1","3-zOrder/1"],0,1],
    [1,1,1],
    [1,0,1],
    [0,0,1]
];

sentences:
What is the purpose of integration in physics engines? All online resources seem to assume that you know what this means and/or state that this is related to object movement in some way.

How does this differ than just position.x++ and position.y++ and how does integration allow us to simulate movement? (calculus integration?)

I understand there are a few different methods, namely Euler explicit, RK4, and Verlet. These methods I read are meant to solve ODE's, what are we solving for when we solve these equations?

sentences:
Maya - Single Model with different animation I am newbie in Maya and would like to clarify some implementations in Animation. I know how to create simple animations in Maya. These animations are exported to Unity3D (as .fbx with controllers) to use in my application.

I want to know whether it's possible to attach different animations to one model. For example, let's say, I have an arrow mark model and I want to show different animations for the model like moving left, moving right, moving up, moving down, etc. So that, when I export, I'll get one model - Arrow.fbx and different controllers - LeftAnimController, RightAnimController, etc.

Is that achievable? Or I need to create different Arrow mark model with it's own controllers.

Any help will be appreciated.
Thank you.

sentences:
How can I prevent pixel artifacts on programatically generated textures? In the game I'm developing, rooms can be of various sizes, which means I need to vary the size of the floor texture appropriately.

The way I've solved this problem is to generate a Texture2D programatically, and set each pixel to be transparent (or not) as appropriate appropriately.

I get something like this:

Where, if you look at the top left, you'll clearly see the pixel artifacts from the floor texture against the dark blue background.

When I run into this with static textures, the fix is simple. Set the Texture's wrapmode to clamp instead of repeat. But when I try to do that programatically... (and change nothing else!) I get this:

I'm not quite sure what's happening, or why setting the wrapMode changes the results so markedly. Anyway I can avoid the pixel artifacts? I suppose it's possible to add an extra border around the generated texture (so that all edges can be transparent), but that doesn't seem a particularly clean solution.

Code is here:

void DebugFloorTextureMerge()
    {

        //sizeVector makes up the rectangle circumscribing the room's parallelagram
        Vector2 sizeVector = new Vector2(roomBounds.topRight.x - roomBounds.bottomLeft.x, roomBounds.topLeft.y - roomBounds.bottomLeft.y);

        //get the texture of the filled sprite
        Texture2D patternTexture = (Texture2D) floorTexture.image;

        //make a new texture of the size of the room.
        Texture2D fillTexture = new Texture2D( (int) sizeVector.x, (int) sizeVector.y, TextureFormat.ARGB32, false);

            //COMMENTING THIS LINE OUT MAKES THE TEXTURE WORK WITH ARTIFACTS
        fillTexture.wrapMode = TextureWrapMode.Clamp;
            //LEAVING IT IN MAKES THE FOLLOWING CODE WORTHLESS

        int patternX = 0, patternY = 0;

        Vector2 pointVector;
        Color transparent = new Color(0,0,0,0);

        for(int x = 0; x < sizeVector.x; x++)
        {
            for(int y = 0; y < sizeVector.y; y++)
            {
                pointVector = new Vector2(x,y);
                if(roomBounds.Contains(pointVector))
                {
                    //get the next pixel
                    fillTexture.SetPixel(x,y, patternTexture.GetPixel(patternX, patternY));
                }
                else
                {
                //pixel was not in the room, so set it to transparent.
                    fillTexture.SetPixel(x,y, transparent);
                    //resultx = x; resulty = y;

                }

                //increment the pattern counter and reset if necessary.

                //if you only increment this when Contains is true, you'll warp the texture
                patternY++;
                if(patternY >= floorTexture.fillSize.y) patternY = 0;
            }

            //increment the pattern counter and reset if necessary.
            //also reset y, so the pattern will line up properly.
            patternY = 0;
            patternX++;
            if(patternX >= floorTexture.fillSize.x) patternX = 0;
        }

        //set the PixelChanges.
        fillTexture.Apply();
    }

sentences:
Creating three-dimensional biomes I have an idea for a space-based game where there are different sectors of control. These would be set up in a manner similar to terrain biomes, where there will be clusters with limited space between them where there are 'mixed' biomes or even no biomes whatsoever, indicating no 'side' has control over that region.

There are a plethora of articles on the web these days about how to create two dimensional biome maps, but I have seen none about making three-dimensional maps. Has anyone done any coding like this before? My Google-fu is strong but I haven't found any significant pages on it.

I will continue to work on it solo, but as a beginning, solo programmer I expect I will be quite slow on it. I was just wondering if anyone had done this already.

sentences:
Why would I lose the D3D device during an HLSL unroll? I have a pixel shader that downsamples a texture from one size to another. The downsample shader uses a nested 'for' loop to traverse the uv coordinates. When the for loop executes more than four times( [unroll(8)] for example ) the graphics device is lost and all hell brakes loose...Here is shader code:

void DownsamplePass_Pixel_Shader( in float4 Position : POSITION0,
           in float4 PositionSS : VPOS, out float4 vEnergy : COLOR0 )
{
    float width = LastMipInfo.x;
    float height = LastMipInfo.y;
    float mip = LastMipInfo.z;
    float mult = LastMipInfo.w;
    float4 vPos = PositionSS;
    float4 vColor = 0;
    int ncPixels = 0;

    // depending on the size of the visibility buffer( texture to downsample )
    //      it may be necessary to sample more than a 2x2 block of pixels( if the size is greater than twice the target )
    //      this is only necessary for the first pass
    if( bFirstDownsamplePass )
    {
        [unroll(8)]
        for( int y = 0; y < mult; ++y )
        {
            [unroll(8)]
            for( int x = 0; x < mult; ++x )
            {
                float2 vCoord = float2( ( vPos.x * 2 * mult ) / width + x * ( 1 / width ), ( vPos.y * 2 * mult ) / height + y * ( 1 / height ) );
                float4 vTexel = tex2Dlod( g_SamplerMip, float4( vCoord, 0, mip ) );
                if( all( vTexel.rgb == 0 ) )
                    continue;

                vColor.rgb += vTexel.rgb * tex2D( g_SamplerMultiplier, vCoord ).rgb;
                ncPixels++;
            }
        }
    }
    else
    {
        float2 vCoords[ 4 ];
        vCoords[ 0 ] = float2( ( vPos.x * 2 ) / width, ( vPos.y * 2 ) / height );
        vCoords[ 1 ] = float2( vCoords[ 0 ].x + ( 1 / width ), vCoords[ 0 ].y );
        vCoords[ 2 ] = float2( vCoords[ 0 ].x, vCoords[ 0 ].y + ( 1 / height ) );
        vCoords[ 3 ] = float2( vCoords[ 1 ].x, vCoords[ 2 ].y );

        // calc average energy
        float4 vColor = 0;
        int ncPixels = 0;
        for( int i = 0; i < 4; ++i )
        {
            float4 vTexel = tex2Dlod( g_SamplerMip, float4( vCoords[ i ], 0, mip ) );
            if( all( vTexel.rgb == 0 ) )
                continue;

            vColor.rgb += vTexel.rgb;

            ncPixels++;
        }
    }

    vEnergy = float4( vColor.rgb / max( ncPixels, 1 ), 1 );
}

I could just define each uv coordinate but I'm interested in knowing why this problem occurs!

sentences:
Calculating damage reduction of armor parts I am currently implementing a turn-based puzzle/RPG game.
The situation now is the following: The player can have up to 4 armor parts: Helmet, Gloves, Trousers and upper-body-armor.
I actually planned to calculate the damage reduction like this:
ActualDamage = Damage*(1-helmetReduction-gloveReduction-trousersReduction-upperArmorReduction)

But I see some problems with that: If the player collects 4 armor parts with, let's say 0.3, 0.4, 0.2, 0.1 reduction, then the damage will be removed completely.
This is not what I want to achieve.
So I am no looking for a way to consider all armor parts, but have a different formular for calculating then together.
I know a way would be to have an upper limit of damage reduction, but that seems like a dirty hack for me.

I know there are games which already do this (e.g. Diablo 3). In Diablo 3 all armor parts add to the global toughness value which then seems to reduce the damage.
How could such a thing be done for example?

Edit:
To clarify: I am acutally looking for a way/formula which takes every armor piece into account and gives an overall damage reduction value, which is, in every case < 100%.

sentences:
How would a server handle sending entity updates to clients? Lately I've been looking into networking and sockets and made small test programs to get the basics down. So far I've made a TCP turn-based game from where I learnt a lot and helped me getting some fundamentals down.

Recently I also got a basic game working where multiple clients can connect and see each other move, but I feel like the architecture is not the best though.
This made me want to expand the game a little and build a more solid foundation but I've been struggling to find the answers on a few questions I have.

The approach I've had for 2D action games(which is my goal to make) is to have a dedicated server, a separate project written purely in java(I use LibGDX for clients) and in the server project I have a Client class which has a x, y, and an id. Then when a client connects to the server it creates a new Client object, gives it an ID based on the amount of clients connected and puts it in an ArrayList called players.

Then for movement I have the Game client send a message when it moves, structured like id,x,y;. The servers Client object receives the message and tells the server to broadcast() it to all the other clients which in turn receives a position message. The Game clients get a message, structured as above, and the Game client updates his own playerList.

This feels really clumsy and not well structured at all and this leads to my next question, what data should the server have?

Let's say we have a 2-player game where the players cooperate to kill mobs and receive items and exp. How would the server keep track of the mob entities? Would i create an identical Entity class from the Game Client and put in the Server project with everything but the render / graphical stuff? And collision with projectiles and stuff, do I collision check in the Game Client and then validate in the server?

All this feels very overwhelming and I would love if someone could give me some advice or point me to any forum posts they've read. I've searched around the forum but haven't managed to find anything that really answers this structuring part.

Thanks in advance, feel free to ask me anything!

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:
Why doesn't this weaponpickup script work properly? I'm making an FPS game. My guns are disabled at the start.

When I use this script to pick up and hold one weapon at a time, requiring that you click J to drop it, it simply doesnt work!

There are two guns using the same pickup script with different prefabs, and all the prefabs but "MyGun" and "playertransform" are the same.

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

public class weaponpickup : MonoBehaviour {

    public GameObject MyGun;
    public GameObject WeaponOnGround;
    public GameObject DroppedWeapon;
    public Transform playertransform;

    // Use this for initialization
    void Start () {
        MyGun.SetActive(false);
    }

    // Update is called once per frame
    void Update () {
        if(Input.GetKeyDown(KeyCode.J))
        {
            Instantiate(DroppedWeapon, playertransform.position, playertransform.rotation);
            MyGun.SetActive(false);

        }
    }
    public void OnTriggerEnter(Collider other)
    {
        if(other.gameObject.tag == "Player" && MyGun.activeInHierarchy == false)
        {
            MyGun.SetActive(true);
            WeaponOnGround.SetActive(false);
        }
    }
}

sentences:
How to use ref in an enumerator i have this enumerator that loads a folders images asynchronously and i would like to be able ta pass the array as a parameter, but when i try to do it even though i get no error the array (source) does not get populated.
private IEnumerator GetTextureFromPath(string _dirname) // here it would be ,Texture2D _source
    {
        var fileNames = Directory.GetFiles(Application.persistentDataPath + "/" + _dirname, "*.jpg");
        source = new Texture2D[fileNames.Length]; // this source array would be referenced in the params.
        Array.Sort(fileNames, (s1, s2) => Path.GetFileName(s1).CompareTo(Path.GetFileName(s2)));
        int index = 0;
        foreach (var fileName in fileNames)
        {
            UnityWebRequest webRequest = UnityWebRequestTexture.GetTexture("file://" + fileName);
            while (!webRequest.isDone)
            {
                yield return webRequest.SendWebRequest();
            }
            if (webRequest.isNetworkError || webRequest.isHttpError)
            {
                Debug.Log(webRequest.error);
            }
            else
            {
                source[index] =  LoadTextureFromPath(fileName);
                source[index].name = fileName;
                index++;
                Debug.Log("Ends server comm");
                Debug.Log("FileNames :" + " " + fileName);
            }
        }
    }

what this function does is get all files from a directory and populate a texture2d array with each image. now this call happens on game load so since i have 4 more arrays (source1 , source2 etc) i would like the array to be in the parameters so i can tell the script as to which array to populate from that directory
it seems its due to it being asynchronous and an enumerator. Because i made the function into a void one with the texture as a ref and it worked.
public void LoadTextureArray(string _dirname, ref Texture2D[] arr)
    {
        var fileNames = Directory.GetFiles(Application.persistentDataPath + "/" + _dirname + "/", "*.jpg");
        arr = new Texture2D[fileNames.Length];

        Array.Sort(fileNames, (s1, s2) => Path.GetFileName(s1).CompareTo(Path.GetFileName(s2)));

        //Debug.Log(string.Join("\n", fileNames));

        int index = 0;
        foreach (var fileName in fileNames)
        {
            arr[index] = LoadTextureFromPath(fileName);
            arr[index].name = fileName;
            index++;
        }
    }

So my take on this is i need to be able to use ref into the enumerator but that is not possible from what it seems since if i do put it as a parameter i get this error. or if there is another way to be able to pass the texture array from the function call! Thank you!
iterators cannot have ref in or out parameters
```

sentences:
Text based cards tracker I wish to build a card tracker that reads in game text and keeps track on the cards that are out.

Like an Overwolf app, but for a card game.  I mailed Overwolf and asked what are my options, they suggested to use image recognition.  However, it sounds complex (and I luck any experience in it).  Is there a simple way to do it?

The tracker that I want to build is for Twilight struggle and I would like to automate this card counter such that It will track the cards that been played from the a text box in the game that state their name.

sentences:
Is there a portal dedicated to HTML5 games? Just to get something straight; by "portal", I mean a website that frequently publishes a certain type of games, has a blog, some articles, maybe some tutorials and so on. All of these things are not required (except the game publishing part, of course), for example, I consider Miniclip to be a flash game portal. The reason for defining this term is because I'm not sure if other people use it in this context.

I recently (less than a year ago) got into HTML5 game development, nothing serious, just my own small projects that I didn't really show to a lot of people, and that certainly didn't end up somewhere on the web (although, I am planning to make a website for my next game). I am interested in the existence of an online portal where indie devs (or non-indie ones, doesn't really matter that much) can publish their own games, sort of like "by devs for devs", also a place where you can find some simple tutorials on basic HTML5 game development and so on... I doubt something like this exists for several reasons:

You can't really commercialize an HTML5 game without a strong server-side and microtransactions
The code can be easily copied
HTML5 is simply new, and things need time to get their own portals somewhere...

If a thing like this does not exist, I think I might get into making one some day...

sentences:
Example of Data Oriented Design I can't seem to find a nice explanation of the Data Oriented Design for a generic zombie game (it's just an example, pretty common example).

Could you make an example of the Data Oriented Design on creating a generic zombie class? Is the following good?

Zombie list class:

class ZombieList {
    GLuint vbo; // generic zombie vertex model
    std::vector<color>;    // object default color
    std::vector<texture>;  // objects textures
    std::vector<vector3D>; // objects positions
public:
    unsigned int create(); // return object id
    void move(unsigned int objId, vector3D offset);
    void rotate(unsigned int objId, float angle);
    void setColor(unsigned int objId, color c);
    void setPosition(unsigned int objId, color c);
    void setTexture(unsigned int, unsigned int);
    ...
    void update(Player*); // move towards player, attack if near
}

Example:

Player p;

Zombielist zl;
unsigned int first = zl.create();
zl.setPosition(first, vector3D(50, 50));
zl.setTexture(first, texture("zombie1.png"));
...

while (running) { // main loop
    ...
    zl.update(&p);
    zl.draw(); // draw every zombie
}

Or would creating a generic World container that contains every action from bite(zombieId, playerId) to moveTo(playerId, vector) to createPlayer() to shoot(playerId, vector) to face(radians)/face(vector); and contains:

std::vector<zombie>
std::vector<player>
...
std::vector<mapchunk>
...
std::vector<vbobufferid> player_run_animation;
...

be a good example?

Whats the proper way to organize a game with DOD?

sentences:
How to prevent the player from calling the Jump function if no collision is detected? I am back once again. This time with a basic 2D platformer game. I would like to allow my player to jump but only if the ground bool checks as true. I would like to fix my script so that upon collision with the ground the player is able to jump, but while the player is in the air the player is not able to jump. My platform has a box collider and my player has a collider as well as a rigidbody. How do I go about fixing my script to allow this system to go into effect? Please and Thank you!

public class MovePlayer : MonoBehaviour {

    public float speed = 0f;
    public float height = 0f;
    public GameObject player;

    private bool grounded = false;

    void OnCollisionEnter2D(Collision2D coll)
    {
        if (coll.gameObject.tag == "ground")
            grounded = true;
            return;
    }
    // Use this for initialization
    void Movement ()
    {
        if (Input.GetKey (KeyCode.RightArrow))
        {
            transform.Translate(Vector3.right * speed * Time.deltaTime);
        }

        if (Input.GetKey (KeyCode.LeftArrow))
        {
            transform.Translate (Vector3.left * speed * Time.deltaTime);
        }

        while (grounded = true)
        {
             Jump();
        }
    }

    void Jump()
    {
        if (Input.GetKeyDown (KeyCode.UpArrow) || Input.GetKey (KeyCode.Space)) {
            transform.Translate (Vector3.up * height * Time.deltaTime);
            return;
        }
    }

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

        Movement ();
    }
}

sentences:
How do I wait till an animation is finished? I am currently working on a Warfare 1917 like game. Right now I am trying to get the combat system working. I have made animations for a running and shooting soldier. It takes exactly 0.5 seconds till the animation lets the soldier shoot.
I have taken out the animations, hud etc. because I put much effort in them and I don't want someone to steal them just now. :) It currently looks like this:

 Obviously they are killing each other too fast. How can I let them wait till the animation is at the point where they can calculate if they die or not?
    This is my code. First it checks if two "soldiers" are in each others vicinity and then I calculate who of those two will die. german.stop(true); britain.stop(true);In the class where I handle the spawning and the animations of my soldiers I have a simple if else statement. Whenever stop = true then the soldier will stay at his current position and does his shooting animation. That this soldier continues to run after killing the other soldier is also a problem, but that's something for a later time.

ArrayList<britain> britainToRemove = new ArrayList<britain>();

ArrayList<germans> germansToRemove = new ArrayList<germans>();

    for (int i = german_array.size() - 1; i >= 0; i--) {
        germans german = german_array.get(i);
        for (int j = britain_array.size() - 1; j >= 0; j--) {
            britain britain = britain_array.get(j);
            if (german.getBounds().overlaps(britain.getBounds())) {
                //handle collision
                german.stop(true);
                britain.stop(true);
                int german_hit = random.nextInt(100) + 0;
                int britain_hit = random.nextInt(100) + 0;
                message = "Red: " + german_hit + "Blue: " + britain_hit;
                if (german_hit > britain_hit) {

                    britainToRemove.add(britain);

                } else {

                    germansToRemove.add(german);

                }
            }
        }
    }
    britain_array.removeAll(britainToRemove);
    german_array.removeAll(germansToRemove);

sentences:
Rotate Body From Corner I want to ask that how to rotate body from corner?

movableBeam.getBeamBody().setTransform(movableBeam.getBeamBody().getPosition(), angle);

The above line of code rotate the beam from center that I want rotate from one of the conner. Any member please help me.

EDIT :

            float beamCenterX = movableBeam.getX() + movableBeam.getWidth()
                    / 2f;
            float beamCenterY = movableBeam.getY()
                    + movableBeam.getHeight() / 2f;

            float cornerOffsetX = movableBeam.getX() - beamCenterX;
            float cornerOffsetY = movableBeam.getY() - beamCenterY;

            float bodyAngle = (float) Math.atan2(cornerOffsetY,
                    cornerOffsetX);

            float newAngle = imageAngle + bodyAngle;
            float newCornerOffsetX = (float) Math.cos(Math
                    .toDegrees(newAngle));
            float newCornerOffsetY = (float) Math.sin(Math
                    .toDegrees(newAngle));

            cornerOffsetX = movableBeam.getX() - movableBeam.getWidth()
                    / 2f;
            cornerOffsetY = movableBeam.getY() - movableBeam.getHeight()
                    / 2f;

            Vector2 postion = new Vector2(
                    (newCornerOffsetX - cornerOffsetX + movableBeam.getX())
                            / PhysicsConstants.PIXEL_TO_METER_RATIO_DEFAULT,
                    (newCornerOffsetY - cornerOffsetY + movableBeam.getY())
                            / PhysicsConstants.PIXEL_TO_METER_RATIO_DEFAULT);

            movableBeam.getBeamBody().setTransform(postion, newAngle);

sentences:
Importance of scripting engine at Cocos2d Game Engine Each Game Engine is different and solves different problems in different ways, so the engine design does vary greatly from engine to engine (even though a lot of principles are shared from engine to engine).

Cocos2D is a great product on it’s own, but it doesn’t expose engine functionality to a scripting Language like Lua, JavaScript etc.

My Question: How much important to integrate a Scripting Engine at Cocos2d?

sentences:
Player experience using a server in single player adventure to prevent cheating I'm making a game where the user can sell items he finds during the the "single player" adventure on an online, I was looking at ways to prevent any malicious user to create rare and expensive items from scratch to sell them on the net.

I tried obfuscation but soon or later someone will successfully break into my code and I can't afford that, for obvious reasons.

Items are stored in files, so I thought about making client add a digital signature to generated files but I have to keep the key on the client machine, so same problem: if someone finds his key he can apply digital signature algorithm to generate the valid key for any file he creates.

So I ended up think the only secure option was to make the single player adventure interact with the server (everyone around here tends to say this is the way to go, like this subject, in my opinion the accepted answer explains it well).

But what about the user-friendly aspect?

My game is divided in two parts. Firstly the "real" single player adventure, where you can cheat all you want because everything is stored on your pc and server won't ever use it (~24h), then you beat the final boss and you're notified you're able to go online to battle against other players with the stuff you acquired on the single player map. At this point of the adventure, my idea was to record everything the player is doing in singleplayer mode onto the server, so whenever he plays a tournament, his stuff is verified.

I can't verify stuff just before a tournament begins because overpowered items can be obtained but are very rare, I want to systematically know if it was hardly-obtained or cheated.

Do you think it would be acceptable for a player to play "single player mode using internet" if he was told this will allow him later to rank up online and be

The single player map will be kind of mixed with the multi player area, but maybe I can think about a feature to play totally offline but then you won't be able to use your "online items" during this time.

EDIT: My app might outputs txt file (representing an item) with its corresponding digital signature, so I just need a way to be sure that it's my app (and not a modified copy) that has created a given file. That's why I'm reading about Trusted computing and Memory curtaining right now, but maybe I should head to security.stackexchange?

sentences:
Is database necessary? Hi I have studied c# for good few months and I'm at intermediate level at the moment.
And few days ago I decided to make simple 2D Games like "Mr Jump" after studying Unity.
So my question is as follow :

1)Should I study database to make simple mobile games? and if so what would be good language to study?

2)And if you have played "Mr.Jump", can you tell me if that game required complicated database coding and a lot of knowledge?

3)Also when we play the game, our best score and new characters get saved in our phone. Is that something to do with database?

4)Could tell me examples of database in games?

5)Should I study database as much as c#?

sentences:
Need help with algorithm for generating connected bricks in Pick A Brick clone I want to make a clone of an Amiga 500 game, Pick A Brick, a 2D game where the goal is to clear a table of bricks by matching them up, following certain rules. I am getting nowhere when it comes to the algorithm for generating the layout of the bricks. I have added the rules of the game (as I remember them) below.

The player wins the game by clearing all tiles before the time runs out.
Tiles are cleared by clicking on a pair of them and if the following is true:

The tiles must be of the same type (there is only one pair of each type).
There is a clear path between them (more on path in the points below).
The path from a tile must always start towards an (clear) edge of the screen.
The path between the tiles must be u-shaped.

(edit) NOTE: In the video the path is not always the u-shaped. I do not recall if the path shown is just a shortcut or not, but regardless, in my version I do not want to allow removing tiles "from inside out".

I have done some manual testing/prototyping using both outside in and inside out approaches, with variations on both. So far, nothing I have come up with has really come close. I kind of dislike asking a question like this since it is so specific, probably not of general interest and may take up more than a little time for anyone interested in helping out. That being said, some people enjoy coming up with algorithms and "solving stuff", and the community may learn something from the answer, so, a post it is.

(edit) Clarification. The algorithm must provide a solvable solution.

sentences:
How do you technically represent a procedurally-generated map in the scene? I've always wanted to create the type of map generator they use in Kingdoms and castles. Basically you provide a seed, and it generates land/water/trees/resources. Their maps are also completely flat (except water seems to be 1-2 positions down, which I assume would make it easier.

However I do not know where to look for guidance for this type of system, I am wondering if anyone can explain the logic of how that type of system works, or even better, point me to a tutorial that could get me started.

While there are tutorials on perlin noise and the like, I never really understood how to connect it to a proper tile, and what properties that tile should have, does it need colliders? is each tile a gameobject? If not, how do I create tiles with trees/rocks that I can gather? and so on.

sentences:
Libgdx shaperender within a circle as limitter I encountered a problem, where my small entities would be rendered
out of the bounds of my radar.

At the time I solved it like this: ensure, that the object would be within the circle, but, that's not optimal, because I need variable scale for different entitie sizes, which causes further problems to be solved.

So is there a way, that I can do the following:

  draw all items within the circle and ensure that nothing is drawn outside

I thought about something, like a circle canvas, which draws all, but displays only that, which is in the bounds.

The points and lines within the circle are of a variable width / height.
I'd prefer to draw everything, and cut the other stuff off.

Thanks in advance!

€dit: Gosh forgot an important thing: I draw the items with a shaperenderer, and all things are rect's , and it probably wont be polygons

sentences:
Automatic shadow for isometric objects I have like hunderd of isometric objects. One example:

I'm trying to find a way to automate creation of shadow they're casting. I ended up with following transformation:

   matrix.Shear(-0.25f, -0.25f, MatrixOrder.Append);
   matrix.Translate(0.5f * source.Width, 0.125f * source.Height, MatrixOrder.Append);

Whole algorithm:

  string sourceFileName = @"c:\in.png";
  string targetFileName = @"c:\out.png";
  using (var source = (Bitmap)Bitmap.FromFile(sourceFileName)) {
    using (Bitmap target = new Bitmap(source.Width * 2, source.Height, PixelFormat.Format32bppArgb)) {
      using (var g = Graphics.FromImage(target)) {
        GraphicsPath gp = new GraphicsPath();
        gp.AddPolygon(new Point[] { new Point(0, 0), new Point(source.Width, 0), new Point(0, source.Height) });
        var matrix = new Matrix();
        matrix.Reset();
        matrix.Shear(-0.25f, -0.25f, MatrixOrder.Append);
        matrix.Translate(0.5f * source.Width, 0.125f * source.Height, MatrixOrder.Append);
        gp.Transform(matrix);
        g.DrawImage(source, gp.PathPoints);
      }
      var grayscale = new Bitmap(target.Width, target.Height, PixelFormat.Format32bppArgb);
      for (var x = 0; x < target.Width; x++) {
        for (var y = 0; y < target.Height; y++) {
          var pixel = target.GetPixel(x, y);
          if (pixel.A != 0) {
            pixel = Color.FromArgb(255 / 3, Color.Black);
          }
          grayscale.SetPixel(x, y, pixel);
        }
      }
      for (var x = 0; x < source.Width / 2; x++) {
        for (var y = source.Height - 1; y >= 0; y--) {
          var pixel = source.GetPixel(x, y);
          if (pixel.A != 0) {
            break;
          } else {
            grayscale.SetPixel(x, y, Color.FromArgb(0, 0, 0, 0));
          }
        }
      }

      grayscale.Save(targetFileName, ImageFormat.Png);
    }
  }

Which produces something like:

It kind of works - but not 100% - the angle of shadow is changed according to proportion of the source object. Is there a way or algorithm that will work 100% or be closer to real ?

(Edited to explain more detaily).

sentences:
Object rotating error in Bullet Physics with OpenGL I have got some problem in my OpenGL game. I am using bullet physics and I want to achive quite simple effect - I want one object (a sphere) to roll and hit another (box) which will fall down.

I have got almost everything but still I have got some errors. When the box is hit it is rotating almost how I would like to. Well, almost means that when ball hits it it falls and rotates however there are about 20 degrees left to the ground.

It isn't stoping on a ball because the speed is so high that it is throw away and after a while it "meets" ball

This is my code for objects (including floor) initialization:

dynamicsWorld->setGravity(btVector3(0,-10,0));

    ballShape = new btSphereShape(1);

    fallMotionState = new btDefaultMotionState(btTransform(btQuaternion(0,0,0,1),btVector3(2,1,0)));
    btScalar mass = 5;
btVector3 fallInertia(0,0,0);
ballShape->calculateLocalInertia(mass,fallInertia);

    groundShape = new btBoxShape(btVector3(btScalar(50.),btScalar(1.),btScalar(70.)));

    btDefaultMotionState* groundMotionState = new btDefaultMotionState(btTransform(btQuaternion(0,0,0,1),btVector3(0,-1,0)));
    btRigidBody::btRigidBodyConstructionInfo groundRigidBodyCI(0,groundMotionState,groundShape,btVector3(0,0,0));
btRigidBody* groundRigidBody = new btRigidBody(groundRigidBodyCI);
    dynamicsWorld->addRigidBody(groundRigidBody);

    btRigidBody::btRigidBodyConstructionInfo fallRigidBodyCI(mass,fallMotionState,ballShape,fallInertia);
fallRigidBody = new btRigidBody(fallRigidBodyCI);
dynamicsWorld->addRigidBody(fallRigidBody);

    fallRigidBody->setLinearVelocity(btVector3(-5,0,0));

    pinShape = new btBoxShape(btVector3(0.5,2,0.5));

    btDefaultMotionState* fallMotionState2 = new btDefaultMotionState(btTransform(btQuaternion(0,0,0,1),btVector3(0,3,0)));
    btScalar mass2 = 1;
btVector3 fallInertia2(0,0,0);
pinShape->calculateLocalInertia(mass2,fallInertia2);
    btRigidBody::btRigidBodyConstructionInfo fallRigidBodyCI2(mass2,fallMotionState2,pinShape,fallInertia2);
pinRigidBody = new btRigidBody(fallRigidBodyCI2);
dynamicsWorld->addRigidBody(pinRigidBody);

and this is how I am setting the box position and rotation:

btTransform trans2;
pinRigidBody->getMotionState()->getWorldTransform(trans2);
    cubeX = trans2.getOrigin().getX();
    cubeY = trans2.getOrigin().getY();
    cubeZ = trans2.getOrigin().getZ();

    rot = trans2.getRotation();
//...
glTranslatef(cubeX,cubeY,cubeZ);
    glRotatef(rot.getX()*(360/3.14),1,0,0);
    glRotatef(rot.getY()*(360/3.14),0,1,0);
    glRotatef(rot.getZ()*(360/3.14),0,0,1);

    glScalef(0.5,5.0,0.5);
    glutSolidCube(1.0f);

Can someone tell me what is wrong in it? I have got no idea what else I can do.

sentences:
How do you make a Pong slider using touch events for mobiles? I am stuck with an issue of moving the slider on android mobiles with finger touch event while developing pong game in unity 3D, though its working fine for pc.

This game is developed in 2D environment... please help me if anyone have available solution to this issue

Actually I have developed this game for pc so I have code for the movement of slider accordingly as below:

var keyup:KeyCode;
var keydown:KeyCode;
var speed:float=1;

function Update () {
    if(Input.GetKey(keyup))
        rigidbody2D.velocity.y=speed;
    else if(Input.GetKey(keydown))
        rigidbody2D.velocity.y=speed*-1;
    else
        rigidbody2D.velocity.y=0;
}

But now i want to use this game for android mobiles.

sentences:
With a Texture Atlas that has 128x128 tiles, how can I use that in Unity3D? So I've got a working texture atlas that has tiles fitting 128x128. However, I can't quite figure out how to use them. I know it's probably got something to do with

    TileRenderer.material.SetTextureScale("_MainTex", new Vector2(0.25f, 0.25f));
    TileRenderer.material.SetTextureOffset("_MainTex", new Vector2(0 * 0.25f,0));

but I'm not sure where to take it from there. Can anyone offer some advice? The size of the image is 1024x128 if that helps, which I think it might.

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:
Generate random numbers without repetitions How to generate Random numbers without repeating any numbers in the given target like(1-5000) there should be no reparation and I should be able to get 5000 randomized numbers. I should be able to run the randomized as many times as the user wants,How to do with C#

For Sample
Target is (1-10)
No of times to run =2

First run:
5,4,6,8,3,1,2,0,7,10

second run
6,3,5,8,4,2,0,1,10,7

Like this I should be able to get the results as many times as I run..

sentences:
Unity or Monogame or Gamemaker 2 for an experienced application developer? So i know this question has been hammered down several times but please bear with me.

I used to be a C# .Net application developer but i am no longer employed, i am pretty good at C#.

I want to get into serious game development and i dunno where to start, i used to work with unity occasionally which is a very little and i kinda find it clunky, like it works but somehow it does not feel right and feels kinda clunky. But it works with tiled map editor without much of a hassle.

I Remember using Game maker studio when i was back in college and i found it  very good, its a breeze to work with and even have its own tiled map editor, even seems to have some good tutorials, the only con is its price.

I was initially inclined towards Monogame cause of my C# background, but i neither have time nor money and resources to support me for long enough time to be able to code every single thing from scratch and i am kinda in a pretty bad situation overall right now. It just takes too much time to do anything even to make it work with a tiled map editor, and there are very few tutorials or documentation to start with.

It seems like the only option for me is Unity at the moment, cause of ease of access and how easy it is to work with tiled map editor and lots of tutorials.

which one do you guys think is good overall?

Please keep in mind that i am currently unemployed and have very little resources to support myself, and i am a programmer so i don't even know how to compose music and do art for the game and i'd prefer if it provides some asserts to be used so i wont waste time in learning stuff when i cannot afford to spend time.

I will eventually learn them but not now, its not happening now so i prefer something that comes with some sorta free asserts that can be used (mainly music and art), I mean does it even matter if all i am trying to do is earn a decent minimum living?

I just want to make simple 2D NES/Snes style games with multiplayer support.

Thank you.

sentences:
What freeware frameworks and tools to choose if I want to build a game like Farmville or Club Penguin? Say I like to experiment with multiplayer games and I do not want to reinvent the wheel and build yet another game server. I don’t mind configuring and writing wrappers and adapters (both in c++ and java) for the server.
What server does Farmville use? Is it Java or C based?
What isometric flash engine do they use?  What other examples can I look into to learn the subject?
Thanks.

sentences:
How to get plausible platformer physics with Farseer on MonoGame/XNA? I am creating a 2D Vectorial (made of polygons, not tiles !) platformer using MonoGame and Farseer Physics Engine. Everything works perfectly, except the movement of the character which doesn't feels right for a platformer, because Farseer is a physics engine...
I would like to have any advice to achieve a natural feeling -like Mario-. I didn't choose to make my own system because I'm simply not good enough to do something like this.

I've seen some questions already about it, but none had useful answers (they said like 'You have to do a lot of tweaking', but how do I do that exactly ?)

I could eventually use another engine that works for collision detection/response and that gives me more control over the player/entities, but i didn't find any yet. If you know any solution that's simple to use and that corresponds to what I need, then i'd love to hear it :)

Thank you for any help.

PS: Also, I am soon going to try to create AIs for my game. How would I make them move with great control (like the player) ?

sentences: Multiple directional lights use cases? I have been building and designing a hobby-tier game engine and I am currently working on supporting any amount of lights of any type. I checked out Unity and it supports multiple directional lights, what would that be useful for? Doesn't one directional light (without shadow map) already light the entire scene?

sentences:
Collision with supposedly aligned box-colliders I am quite new to game development, and I am trying to create a top-down game with 2D sprites, but with a 3D feel to it. I managed to do so with the 2D engine by setting Transparency Sort Mode to Custom Axis with the axis values set to (X=0,Y=1,Z=0). I then moved the pivot of GameObjects to bottom-center and used the pivot as sorting point for the sprites. I am now trying to create the environment, but my character 'clips' against the Box Colliders, even though I did all I could think of to align them (same pivot coordinates, same collider offset and size). See the attached GIF for an example:

I think that the cause is mentioned here, but there are no solutions mentioned there. My two solutions:

Remove the colliders, group the objects in a parent object, and add the collider there. But then I would get the same issue if I place two of those instances next to each other.
I am still pondering to drop this approach altogether and try the same in the 3D engine, but with a fixed camera angle. I lack experience to estimate if that would be a better approach, so if someone thinks that approach would be better suited to this game style, I am happy to hear it.

Can anyone give me advice on this issue, or point me towards resources that might be useful?
Thanks in advance,
Florian

Some pictures of the settings I used:

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:
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:
Texture prefetching in GLSL I have a fragment shader which needs lots of semi-random access to 32x32 texture patch.  Fortunately, the patch is constant for each poly, so there should be no issue storing the whole thing to the texture cache.

So my question is, is there any way in GLSL to prefetch texture patches?  Normally, I would be fine letting the FS load the texture naturally, but with the nondeterministic access pattern, I'm afraid that could be producing a ton of unnecessary thrashing while it sorts itself out.

sentences:
Why are there different ways of building projection matrices? Matrix.PerspectiveFovLH documentation page says that this method uses the following formula to build a perspective projection matrix.

[w, 0, 0, 0]
[0, h, 0, 0]
[0, 0, zFar/(zFar - zNear), 1]
[0, 0, -zNear * zFar / (zFar - zNear), 0]

where

h = cot(fovY / 2)
w = h * aspectRatio

DirectXMath's DirectX::XMMatrixPerspectiveFovLH uses the same formula but with a difference. It calculates w as w = h / aspectRatio therefore creates a different matrix.

There is a difference between orthogonal projection matrix building too.

Why are there such differences or am i missing something?

sentences:
Cheap way to soften contactpoint of character with ground The view of my game is always semi topdown. I'm trying to make the contactpoint between characters and the floorplane more grounded without rendering hundreds of sprites.

One thing that I think could work well is to just hide some pixels of every object that is i.e. 2 cms above the floor.

See GIF below of an example I did in Photoshop:

Things that I'm thinking about:

check the z depth before rendering - if it's very close, then randomly don't render the pixel
randomly writing "wrong" depth buffer values for the ground plane
a small layer 2cm over the groundplane that writes z values only - draw this before the character

As I'm still in the research phase, I'd like to also explore other possibilities.

Is there already a well established way to do this?

sentences: Unity 3D, Making contiguous looking worlds Im currently involved in making a third person cooperative mobile game in Unity and in said game there will be an area for players to walk around in with various elevations and whatnot throughout the field. Its designed to be set up with 4 biomes in the area to go along with the games theme but I was wondering what would be the best way to mask the "boundaries" or "cut off points" in this area? From certain vantage points  its pretty obvious that the terrain used to make the world simply stops and I was wondering if anyone knew any tips and insights on how to best mask these boundaries without too much "padding" in the game area in order to keep it relatively less taxing on  a mobile device. Thank you in advance.

sentences:
ID3D11Buffer and std::array : buffer looks empty I am having trouble at rendering vertices stored in a std::vector.

// Create and initialize the vertex buffer.
D3D11_BUFFER_DESC vertexBufferDesc;
ZeroMemory(&vertexBufferDesc, sizeof(D3D11_BUFFER_DESC));
vertexBufferDesc.BindFlags = D3D11_BIND_VERTEX_BUFFER;
vertexBufferDesc.ByteWidth = sizeof(VertexData) * this->vertex_data.size();
vertexBufferDesc.CPUAccessFlags = 0;
vertexBufferDesc.Usage = D3D11_USAGE_DEFAULT;

D3D11_SUBRESOURCE_DATA resourceDataVertex;
ZeroMemory(&resourceDataVertex, sizeof(D3D11_SUBRESOURCE_DATA));
resourceDataVertex.pSysMem = &(this->vertex_data);

HRESULT hr = pDevice->CreateBuffer(&vertexBufferDesc, &resourceDataVertex, &(this->pVertexBuffer));
if (FAILED(hr)) return false;

this->vertex_data being a std::vector<VertexData> with VertexData being:

// Vertex data
struct VertexData {
    XMFLOAT3 v;
    XMFLOAT2 vt;
    XMFLOAT3 vn;

    VertexData(XMFLOAT3 v, XMFLOAT2 vt, XMFLOAT3 vn) : v{ v }, vt{ vt }, vn{ vn } {}
};

Now I'm not sure doing resourceDataVertex.pSysMem = &(this->vertex_data); is a good idea. I can render another mesh without problem just by changing the ID3D11Buffer vertex buffer (said mesh being known at compile-time and stored in a C-Array).

This time around I simply get no render at all. I triple checked my object is in sight and vertex_data is fully populated.

sentences:
XNA - Getting pixel shade texcoords? I'm still new to shaders and I'm trying to create a glow a shader. I understand how it all works and I don't think I'll have too much trouble with the rest of it, but I'm stuck at one point in particular which is getting the texcoords of the render target into my pixel shader.

Right now I'm setting the rendertarget, saving it to the texture, passing it to the shader. Then I'm going to do tex2D(texture, coords) but I don't know HOW to get the coordinates into my pixel shader. I've created float2 TexCoord : TEXCOORD0; for my vertex shader output but I don't know how to assign the coordinates as it reaches the pixel shader. Everything else (color,pos, normal) is just automatically passed in through the vertex shader and I'm assuming I don't need to change the format of that to include texcoords and it's something within the actual shader itself I need to add?

Thanks.

sentences:
Alternatives to NSMutableArray for storing 2D grid - iOS Cocos2d I'm creating a grid-based iOS game using Cocos2d. Currently the grid is stored in an NSMutableArray that contains other NSMutableArrays (the latter are rows in the grid). This works ok and performance so far is pretty good. However the syntax feels bulky and the indexing isn't very elegant (using CGPoints, would prefer integer indices). I'm looking for an alternative.

What are some alternatives data structures for 2D arrays in this situation?

In my game it's very common to add and remove rows from the bottom of the grid. So the grid might start off 10x10, grow to 17x10, shrink to 8x10 and then finally end with 2x10. Note the column count is constant.

I've consider using a vector<vector<Object*>>. Also I'm vaguely aware of some type of "fast array" or similar offered by Cocos2d. I'd just like to learn about best practices from other developers!

sentences:
XNA 2 3D Objects Depth Convergence Error Gah! I have a scene with 2 3D objects - a plane and a sphere;

the plane sits on the xy axis with a depth if -100 and diameter of 200;

the sphere diameter is 32 and sits on the xyz = 0 position;

when rendering using indexedprimitive all appears fine.
the sphere appears in front of the plane.

however as i decrease the world z component of the sphere
and the sphere passes through the plane and becomes hidden
it shows the front of the sphere passing through first.

as if the plane were moving down over the sphere but only displaying
the parts of the sphere that should be hidden.

the most puzzling aspect is that this problem only appears as
one object passes through the other. when behind it is hidden,
when in front visible?

Help please :)

Edit 20/12/2015

Has been suggested I upload a sequence of pics to better illustrate my problem so... Hope these help

.

        GlobeTarget = new RenderTarget2D(graphicsDevice, GlobeDiameter, GlobeDiameter, false,
                          SurfaceFormat.Color, DepthFormat.Depth24, 0, RenderTargetUsage.PreserveContents);
        graphicsDevice.SetRenderTarget(GlobeTarget);
        graphicsDevice.BlendState = BlendState.Opaque;
        graphicsDevice.RasterizerState = RasterizerState.CullCounterClockwise;
        graphicsDevice.DepthStencilState = new DepthStencilState
            { DepthBufferEnable = true, DepthBufferFunction = CompareFunction.Less };
        graphicsDevice.Clear(ClearOptions.Target | ClearOptions.DepthBuffer, Color.Black, 1, 0);

sentences:
Godot Engine: Why is baking light making my scene darker? I have an interior scene with some windows.  The light is from an OmniLight near the ceiling, default environmental light from outside, and a desk lamp with emission.  Without baking light, the scene looks like this:

Consistent with the documentation for emission, the desk lamp is not affecting the surrounding objects.  I want to bake the light to see the lamp's effect and to support low end hardware.
I followed the baked lightmaps tutorial and set the BakedLightmap's extents to encompass the entire room.  After baking, the scene looks like this:

I can see the lamp's light, as expected, but now everything is too dark.  It is unclear to me from Godot's documentation if scenes include indirect light without baking.  I have tried this with the OmniLight set to bake "all" and only indirect light.
What am I missing here?

UPDATE 10 April 2021:
The problem seems to be that baking environmental light isn't working as expected.  I was using Godot 3.2.3; now I'm using 3.3rc8.  That gives the BakedLightmap options for environmental light, but the problem remains.
I began troubleshooting by shuttering all the light sources as follows:

Hid the OmniLight, and set its "Bake Model" property to "disabled"
Unchecked "use in baked light" for the desk lamp
Set the default environment's background and ambient energy to 0
Set the BakedLightmap's "environment mode" to "Disabled", verified "Min Light" is set to pure black, and cleared the "Light Data"

When I run the game, I get exactly what I expect--a black screen.  If I bake light under these conditions, I continue to get a black screen, as expected.
Here's where things get screwy.  When I set the BakedLightmap's "environment mode" to "Scene"--with the environment still without any light--I get dim illumination.

sentences:
Change animation speed through the editor in Unity How can I change the speed of the animation through the editor if I have the following animation structure?

I would like Adult1@walk to play faster.

sentences: Handling different version clients in a multiplayer game What are various ways of handling different version clients in multiplayer games? For example, when there's an update, some games allow you to play with people who have a different version of the client. How is this handled?

sentences:
What is an actor in game development? I am reading a book about game development (Game Coding Complete, Fourth Edition) and there is an "Actors" topic which just explains how to use them briefly instead of explaining what it is.

Here's how the book introduces these actors:

  Games are full of objects that bring your world to life. A World War
  II game might be full of tanks and planes, while a futuristic science
  fiction game might have robots and starships. Like actors on a stage,
  these objects are at the heart of the gameplay. It seems fitting that
  we call them “game actors” because that’s exactly what they are.

  A game actor is an object that represents a single entity in your game
  world. It could be an ammo pickup, a tank, a couch, an NPC, or
  anything you can think of. In some cases, the world itself might even
  be an actor. It’s important to define the parameters of game actors
  and to ensure that they are as flexible and reusable as possible.

  There are as many ways for defining a game actor as there are games.
  Like everything else in computer programming, there is rarely a perfect solution.

I could only understand a very few things: it is an abstraction of everything in the game which can perform actions; it has it's own state; it's behaviour is usually implemented as a state machine. This is it. I am coming with systems programming background to the game development, and so I would like to know in general, what the actor is in game development meaning, how to use it, how it is used in general, what problem it solves, how and why. I would like the explanation to be such that a kid could understand.

I have tried to find this information on google but it heads me to another "actors" instead: concurrent programming most of the time or game actors but without a good explanation of it.

sentences:
How do I convert DirectX's .X from binary encoding to text encoding and back As far as I know, .X format can be text encoded and binary-encoded.

I basically want to look into the model I'm playing with, get a better understanding of .X, possibly make some changes in it and convert back.

sentences:
can i modify canvas outside Phaser's update or create functions? can i create/change/destroy game objects (i.e. sprite, text) outside "create" function or "update" game-loop?

i'm working on a multiplayer game with nodejs and socket.io, and following is my former codes:

function create() {...}
function update() {...}
//the following codes are outside any state object
var socket = io.connect("xxx.xxx.xxx.xxx:xxxx");
socket.on("init", function(data) {
    game.add.sprite(0, 0, data.background);
    game.add.text(0, 0, data.title);
});

neither the sprite nor the text displayed correctly (sometimes display a "X" image)

then i move these codes to update function and it works fine:

var initData;
function update() {
    if (initData) {
        game.add.sprite(0, 0, initData.background);
        game.add.text(0, 0, initData.title);
        initDate = null;
    }
}
var socket = io.connect("xxx.xxx.xxx.xxx:xxxx");
socket.on("init", function(data) {
    initDate = data;
});

same thing happens when i wrote title.setText("new title") in socket.on function

so, is there any way i can directly modify canvas objects in socket's callback function ? sorry for my poor english :)

sentences:
game crash on android phone while using unity UI I am trying to use an unity UI in my game. Initially I Created Canvas with all settings what I need then I compiled it on my phone its working perfectly. Inside the Canvas if I created any button or image means in editor its working fine but in android mobile the game get crash. I don't know what's happening?

Note: I already create the game with simple ui system. in that ui using box collider and listenerClicks() I handling all functions. Now i am trying to convert this system to Unity UI system.

Here my Logcat

I am using Unity 5.2, c#

sentences:
How does an AAA graphical workflow look like? So this is how I understand it:

An artist models the thing in Zbrush or Mudbox. It now has 10+ million polygon. He exports it in Zbrush as a normal map + low poly model. (this works?)
The model now has ~20-30k polygons?

Now the artist imports the low poly model into 3dsmax or Maya, applies the normal map somehow as well, so it will look in the modelling program just like it would ingame. Then he starts adding bones and then skins the model.
Then animation, then export. As I understand it, somehow all the textures of a model get "baked" into a single texture which the engine will understand?

Do people still make textures in Photoshop and then UV unwrap the model by hand, then apply the textures? I never understood how someone can make the laid out texture of a face in Photoshop, and somehow he knows that it will look good on the model. Do they paint the textures in Zbrush? But Zbrush doesn't have all the photoshop tools.

What if I want to make a terrain, or an indoor level? Do I just model the whole thing in 3dsmax? What if the textures don't show up in the engine the way they do in 3dsmax?

sentences:
Using Unity built-in sprites programatically I'm trying to figure out how to use the "Panel" built in resource in a game I'm making. I've been able to figure out some potential solutions, but I can't quite figure out how to put all of the pieces together.

panelImage.sprite = UnityEditor.AssetDatabase.GetBuiltinExtraResource<Sprite>("UI/Skin/InputFieldBackground.psd");
panelImage.sprite = Resources.GetBuiltinResource(typeof(Sprite), "Resources/unity_builtin_extra/Background.psd") as Sprite;

The first produces the button sprite, which is almost what I want, but not quite. The second doesn't work at all. I'm missing some small piece of what it takes to make this work, but I can't quite figure it out. How can I use the panel background programmatically?

sentences:
Text Pooling Optimizations In my game I have created popup text for gained points when enemies are killed.
it pops up wherever the enemy was and will say something like
"+32"
float up a bit and fade away at the same time.
This transition lasts for a few seconds if that. and hundreds could appear at a time when AoE attacks destroy a lot of enemies.

That's all well and good. and it works!
but I fear that this could become quite slow on mobile devices. So I did what any good game dev does. I pooled it!

Then it occurred to me.
I'll still be changing the display value of the text elements dynamically and libraries like TextMeshPro already, in surely an optimized way, instantiate actual meshes to render text. So is pooling these text elements really a big optimization?

so here goes my question for experienced and knowledgeable devs. Is it more efficient to pool each character I need and assemble my short strings dynamically as sets of pooled gameobjects for these popups of just a few characters or should I simply pool text elements that will change their text just before appearing? Assume the memory usage difference is minimal. only worried about speed.

This is on top of the game having possibly thousands of projectiles moving at any given time, so I believe it is a valid optimization question, but I ask this more for curiosity than practicality. For now, I already have a working solution. but I believe such an issue could arise in the future. and want to satisfy my curiosity now.

sentences:
Best way to organize models with multiple meshes and textures? I have character models which have different parts, ex: upper body, head, lower body; each part is a separate mesh in the same model. Each part has several textures associated with it (diffuse, normal, etc).

I'm wondering if there is a best practice for associating the textures with the meshes, given a .obj file as the model, for example, and .tga files for the textures.

So for instance, making sure the head textures get mapped on to the head object.

One way would be having a separate file for each mesh, and using the file names to associate them with their textures, but that seems impractical.

Is there a nice, clean way to do this, which is both easy to program (importing and rendering) and easy for the artist?

sentences:
Dealing with "jumping" sprites: badly centered? Thing is, I've used darkFunction Editor as a way to get all the spriteCoordinates off a spriteSheet for each individual sprite, and parse the .xml it generates inside my game.
It all works fine, except when the sprites are all similarly sized, but when a sprite changes from a small sprite into a big one, such as here:

When from walking from some direction, to attacking, it starts "jumping", appearing glitchy, because it's not staying in the same correct position, only doing so for the right attacking sprite, due to the drawing being made from the lower left part of the rectangle.

I think someone experienced will immediately recognize the problem I mean, if not, when I return home soon, I will shoot a little youtube video demonstrating the issue!

So the question is: what possible solutions are there? I've thought that some sort of individual frame "offset" system might be the answer, or perhaps splitting, in this case, the sprite in 2: the sword, and the character itself, and draw sword according to character's facing, but that might be overly complex.
Another speculation would be that there might be some sort of method in LibGdx, the library I'm using, that allows me to change the drawing center (which I looked for and didn't find), so I could choose from where the drawing starts.

sentences:
Unity 2D: Destroy object with dynamic collider after exiting object with static collider I'm using the Unity5 game engine and am programming a 2D shooter in bird's eye view.

I have a static Box Collider 2D which covers the entire game area.

It has "Is Trigger" checked and contains a very simple script which should destroy every object that exits it.

 using UnityEngine;
 using System.Collections;

 public class DestroyByBoundary : MonoBehaviour {
     void OnTriggerExit(Collider other) {
         Debug.Log ("OnTriggerExit");
         Destroy (other.gameObject);
     }
 }

The player character shoots bullets which have a dynamic Circle Collider 2D.

However, the bullets are never destroyed when they leave the game area and just fly on indefinitely. The debug statement never gets executed either, of course. I have tried the same thing with OnTriggerEnter, which yields the same result.

If any more information should be needed, I'll be happy to provide it.

sentences:
Is it useful to distinguish between two different kinds of events? i have thought about this for a long time and i think i just going in circles. I need someone to tell me if im just simply overthinking it.

So, first of all im coming from a 'classical' ECS approach: You got entities that are basically just Ids, Components to these IDs in different colors (PosComponent, 2dGraphicComponent, etc.) and your systems working on those components. Im still working on an game engine, so none of these components are fix.

Now i have an event manager that accepts events. Currently these events are like MouseButtonClicked, KeyPressed, WindowResized etc. These are events, certain systems have to react to these events immediately and can't wait to be resolved in the next game loop. So the polling for these events is at the beginning of the loop. Since the event manager does not know, that system handles this event, every system needs to be called in order, until one system handles the event and gives a positiv feedback. So for example if you click on the gui, you don't want to shoot a bullet.

Then there are events, that always have some context attached to it. Like an event onCollision, where a sound should be played and the player takes damage. In this case this event would need to be handled by two different systems and in context of the collided object. Bumping spikes might actually kill you, while colliding with an enemy may just hurt you. And of course the sounds are different.
Additionally, you may have events that are delayed to trigger. Faraway sounds like gunshots only move with the speed of sound, so delay it in regards to the distance. Or Buffs and Debuffs that run out. So these events should have a connection to a component or entity (id) and some sort of time to dispatch.

These two event types seem so distinct that i can't even think of realizing both as one class, or at least not the all the assumptions i made.

Maybe this is a stupid question, but should i create two different event types and thus eventManager? In my internet searches i have not found anything about this problem, but maybe my Google Fu is a bit rusted.

sentences:
Methods of Creating a "Lightning" effect in 2D well i'm just wondering on the best way to go about create some form of "Lightning" effect to be used in a game, so for example:

-In my game, i would like to have this effect in the menus and in-game in some form of random weather system perhaps.

Just wondering on the methods available? I did read this blog post:
http://drilian.com/2009/02/25/lightning-bolts/

And took a-look at the Lightning sample thats around.
I like the method placed in the blog post, just really a bit unsure on how to create the vertices from the lightning segments.
I would be great if someone could explain that seconded sub-heading (Adding glow) a bit more to me :).

But like i said, i'm really want to know if there's any other ways i could accomplish this?

sentences:
Game-Design: Turn-based ship-to-ship combat with *simultaneous* movement Im currently building a browser-based game, which basicly goes like:
2 Players place starships on a 2d plane, move them around and fire their guns at each other.
The game is divided by turns, each one has 2 phases
Phase 1 - Movement
Phase 2 - Firing

Summarized, it is basicly a table-top game played in the browser.

Due to earlier experience i want to avoid the issue of Players talking movement in turns, i.e. Player A moves ship 1, B moves 2, A moves 3, B moves 4. It makes for some awkward experience and delays the actual firing Phase too Long.

So instead im aiming for something along the lines of "Both Players move all their ships in one step and see the actual Resolution of ALL ships movement afterwards - they then can issue weapons fire".

The Problem is: Manovering ships in this game is Kind of important, because weapons have different arcs of fire and ships different parts of structure. So ideally i want to make "smart" movement choices in order to bring as many weapons as possible to bear while also protecting damaged parts of my fleet / ships.

However, with parallel, "blind" movement, i cant really make smart choices.

What would be a way, from a game-design Point of view, to allow parallel, blind movement while also ensuring impactful choices ?

sentences:
Understanding SpriteBatch.Draw overload XNA I'm talking about the
public void Draw (Texture2D texture, Vector2 position, Nullable sourceRectangle, Color color, float rotation, Vector2 origin, float scale, SpriteEffects effects, float layerDepth) method.

My Sprite has Scaling, Position and Rotation.  I want it to rotate from the center, towards the mouse.

This is the method I've tried using so far:

public void RotateTo(Vector2 point)
{
    var angle = AngleBetween(Position, point);
    Rotation = MathHelper.ToRadians((float)angle);
}
public static double AngleBetween(Vector2 first, Vector2 second)
{
    double sin = first.X * second.Y - second.X * first.Y;
    double cos = first.X * second.X + first.Y * second.Y;
    return Math.Atan2(sin, cos) * (180 / Math.PI);
}

But as you can imagine, this didn't work well. First of all, the origin of the sprite wasn't the center. I've tried changing the origin parameter in the Draw method to sprite.Texture.Bounds.Center.ToVector() (ToVector is an extention method) but that also didn't work. The sprite was rotating in a weird way, not focusing around the mouse, because it seemed that the sprite was rotating around a different center point, not the mouse itself.

I didn't manage to find in depth explanations about SpriteBatch.Draw, so I hoped someone here would have the knowledge and experience to help me.

Thanks for reading, and thanks in advance for the help!

sentences:
How do you draw a random irregular polygon in java? (Asteroids) I am coding an Asteroids game in Java. In the real arcade game, asteroids are made of irregular shapes like this:

When I code, I can only set asteroids to 1 or another specific shape, like this:

I want to make all of the asteroids in my game of totally randomly generated shapes, and I am already tired of designing specific shapes of my own. Here is a snippet of my code that generates the asteroid's shape. P.S: The image does not show it, but I am using the Polygon class and constructor which only enables me to input 2 int[]s and a number of sides.

   public void makeShape() {
    int x = (int) this.x;
    int y = (int) this.y;
    this.shape = new Polygon(new int[]{x - 15, x - 30, x - 10, x - 13, x,x + 10, x + 10}, new int[]{y - 30, y - 15, y + 5, y + 30, y + 35, y + 30, y}, 7);
}

I have tried putting all of the variables on Math.random(), but it outputs nothing but a scribble, even if I were using the Polygon class.

sentences:
OpenGL NDC initial values I have a set of vertex locations to create a plane:

this->Vertices = {
    // position         // color          // texture
    -0.5f,  0.5f, 0.0f, 1.0f, 1.0f, 1.0f, 0.0f, 1.0f,
     0.5f,  0.5f, 0.0f, 1.0f, 1.0f, 1.0f, 1.0f, 1.0f,
     0.5f, -0.5f, 0.0f, 1.0f, 1.0f, 1.0f, 1.0f, 0.0f,
    -0.5f, -0.5f, 0.0f, 1.0f, 1.0f, 1.0f, 0.0f, 0.0f
};

Everything is fine, but I can't grasp how I should input these values at the very beginning. I used to give exact locations for vertices in DirectX in pixel unit, but here in OpenGL I should give vertex locations in normalized coordinates.

If I wanted to create a plane say 200px by 200px how should I deal with that when I set vertex data. I know I can transform my plane with coordinate matrices through model space and view space and etc. I just don't know what I should be giving for the initial vertex location values.

sentences:
license for old vehicle/track If I want to develop an android racing game set in the 1940-1950, with the real track of that period (that differs from the actual one), both closed and street circuit, and the real car of that period (F1 car), do I have to pay a license to use its name and aspect?

If so, how much it would be cost?

sentences:
Running both the server and the client within the same process Question

I have just started working with Lidgren and networking for the first time, and I've come to the realisation that it is possible to run both the server and the client within the same process.

Is this practice discouraged for any reason?

Context

The reason I'm asking is because I theorized that this concept might allow me to treat both singleplayer and multiplayer modes as one and the same, which would be very helpful.

Following my line of thought, this is the distribution I had in mind:

Singleplayer - 1 server + 1 client in the same process. How fast are the communications?
Multiplayer - Same as singleplayer for the host + 1 aditional client for each other player.

The execution flow I'm picturing is for clients to recieve user input and send a notification to the server. Then the server validates it, and broadcasts an action to be executed by all the clients. It shouldn't matter if there is only one client (i.e. singleplayer) or multiple clients (i.e. multiplayer).

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:
WorldToGUIPoint seems always off by about 2 pixels I'm trying to draw small boxes at each vertex of a mesh, in the editor. My OnSceneGUI code looks like this:

foreach (Vector3 vertex in _mesh.vertices) {
    Vector3 worldVertex = _meshTransform.localToWorldMatrix.MultiplyPoint3x4(vertex);
    Vector2 guiPoint = HandleUtility.WorldToGUIPoint(worldVertex);
    var rect = new Rect(guiPoint, Vector2.one * BOX_SIZE);
    EditorGUI.DrawRect(rect, Color.red);
}

I want the upper-left corner of each box to align with the mesh vertices. With the above code, the boxes are drawn at the wrong location, as you can see in the picture below. If I apply an offset of (2, -2) in GUI coordinates, however, the boxes are drawn at the correct location.

I'd like to avoid having to hard-code this (2, -2) offset into each draw call. Why is Unity off by a few pixels here? I also tried using GUI.Box to do the drawing, but it was off by the same amount. What is going on?

Incorrect

Correct. With constant (2, -2) offset

Update: I have an untested hypothesis as to why this is happening. I am rendering a GUI rect with the default GUIStyle. The default GUIStyle has the padding and margin values set. I bet that if I created a custom GUIStyle with zero padding and margin the rects would draw where I want them to.

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:
Game stopped working after adding savegame feature? I'm trying to make a text based adventure game with my limited c++ knowledge.. But I ran into trouble with saving and loading gamestates.. The functions I made are

int currentslot;
void savegame(int savestate)
{
fstream plfile("player.dat",ios::in|ios::app|ios::binary);
player temp;
if(currentslot==1)
{
    plfile.seekg(0,ios::beg);
    plfile.read((char*)&temp,sizeof(player));
    temp.savestate=savestate;
    plfile.seekg((-1*sizeof(temp)),ios::cur);
    plfile.write((char*)&temp,sizeof(player));
    plfile.close();
}
else if(currentslot==2)
{
    plfile.seekg(1*sizeof(player),ios::beg);
    plfile.read((char*)&temp,sizeof(player));
    temp.savestate=savestate;
    plfile.seekg((-1*sizeof(temp)),ios::cur);
    plfile.write((char*)&temp,sizeof(player));
}
else if(currentslot==3)
{
    plfile.seekg(2*sizeof(player),ios::beg);
    plfile.read((char*)&temp,sizeof(player));
    temp.savestate=savestate;
    plfile.seekg((-1*sizeof(temp)),ios::cur);
    plfile.write((char*)&temp,sizeof(player));
}
}
void loadgame()
{
int plno;
cout<<"\n\n\n\n\n\t\tSelect which player to load game from:";
cout<<"\n\n\t\t1.Player 1";
cout<<"\n\n\t\t2.Player 2";
cout<<"\n\n\t\t3.Player 3";
cout<<"\n\n\t\tEnter your choice: ";
cin>>plno;
currentslot=plno;
fstream plfile("player.dat",ios::in|ios::binary);
plfile.seekg((plno-1)*sizeof(player),ios::beg);
plfile.read((char*)&p,sizeof(player));
game(p.savestate);
}
void newgame()
{
int plno;
cout<<"\n\n\n\n\n\t\tSelect which slot to save game to(If there is no player         1, don't choose other slots):";
cout<<"\n\n\t\t1.Player 1";
cout<<"\n\n\t\t2.Player 2";
cout<<"\n\n\t\t3.Player 3";
cout<<"\n\n\t\tEnter your choice: ";
cin>>plno;
currentslot=plno;
fstream plfile("player.dat",ios::app|ios::binary);
if(plno==1)
{
    plfile.seekg(0,ios::beg);
    plfile.write((char*)&p,sizeof(p));
}
else if(plno==2)
{
    plfile.seekg(1*sizeof(p),ios::beg);
    plfile.write((char*)&p,sizeof(p));
}
else if(plno==3)
{
    plfile.seekg(2*sizeof(p),ios::beg);
    plfile.write((char*)&p,sizeof(p));
}
game();
}

With the addition of these functions however, the game() function does not seem to be accepting any values (but no error) related to the class:

class player
{
public:
char pl_name[10];
int hp;
int atbt;
int chk_sword;
int chk_bow;
int chk_healthpotion;
int savestate;
player()
{
    strcpy(pl_name,"Unnamed");
    hp=100;
    atbt=0;
    chk_sword=0;
    chk_bow=0;
    chk_healthpotion=1;
    savestate=0;
}
void namegive()
{
    cout<<pl_name;
}
void nameset()
{
    gets(pl_name);
}
void atbtset()
{
    cin>>atbt;
    if(atbt==1)
    {
        chk_sword=1;
    }
    else if(atbt==2)
    {
        chk_bow=1;
    }
}
}p;

I've spent a lot of time trying to figure it out.. Help and/or advice is very much appreciated.
Thanks

sentences:
How dev consoles work? I want to implement a dev console similar to what is in DOOM.
Is there a standard implementation for dev consoles or would I have to build everything from scratch?

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:
Technical Design Document and PNG filesizes I am writing a Technical Design Document and starting to list assets and their file sizes.

The formula for calculating the file size of a PNG is easy:
width x height x bit depth.

I am having a problem with the file size windows shows in the file properties for some of my png's.

Background image:

The dimensions are 1280 x 720 32bit and filesize ought to be 3,686,400B.  Windows Properties shows 3.6KB. Shouldn't this be 3600KB?

Now I have a cursor image:

32 x 32 32bit ought to be 4,096B.  Why does the file properties in windows say the file size is 304B?

As you can see the size on disk is correct for the cursor but the size is off.  With the background image the size is correct but the size on disk is bigger.

I am using GIMP to create the images and exporting with none of the tick boxes checked, so no comments or background colour saved etc.

Can anyone explain why windows does this? Thank you.

sentences:
Player rewards in games where you normally have nothing to purchase In many games there are rewards such as gold coins, points, etc. When these rewards can be used to purchase in-game items, it motivates the player to keep playing.

Let's say we have an online game, poker, Yatzy etc.  What type of reward would keep the players playing if there are few in-game items available to buy, or none at all?

What I am looking for is a reward system that entices the players to play more in a game environment where there isn't that much to purchase. For example, there isn't much to buy in a poker or Yatzy game with the gold you win.

I guess having some titles that are added to the userid is one way, or maybe purchasing a logo for the id... A leaderboard is another.

Any thoughts on this?

sentences:
Terrain collision detection How should I go about making terrain collision system without hightmap ?

What I have tried is building a heightmap from a blender model, but that works only if the vertices are evenly spaced. Mine are not and I am not sure how to proceed from here.

How do i store the mesh info ? Do I store a Plane object for every triangle in the mesh and then plug those in some kind of grid/quad tree etc ? Is that the best thing to do ? My terrain has around 2000 faces, wouldn't that be too much ?

sentences:
Player sprite animation in 2D platform game It's pretty easy to get animations rolling from a sprite sheet. Though which ways there are on combining the animations with player dynamics and motion?

I've figured there's two starting points anyway:

Player animation contains motion (the animation slab defines how the sprite moves)
Player animation does not contain motion

Simple state machine might do the stuff, but are there alternatives? How would you write the state machine itself for doing it?

I'm writing a small hack&slash&jump platform game in html5. The player should stay in place when he strikes a sword, perhaps even move a bit (one can accomplish it through a hack), but otherwise move pretty much without limits. I've got couple frames and I'd like it all to mesh together well.

sentences:
How to make a smooth projectile in roblox? I am trying to make a projectile (Energy ball) for my game. I am using body velocities, but the issue is is that it seems laggy. I shoot it then half a second through flight it seems to stop in mid air for a quarter of a second then continue. This only happens the first minute of playing.

Here is my code:

local Motion = Instance.new("BodyVelocity", Ball)
Motion.Velocity = ((MouseClickLocation - Player.Character.HumanoidRootPart.Position).Unit*100)

Why is the described behavior happening and how can I make it never happen?

sentences:
How do I publish a game written for Graal Online to Facebook? I made an MMORPG game using the Graal Online game engine. I hosted the game with their engine and servers, and it was fairly successful. Recently, they stopped hosting my game. The game is still fully functional, but with nowhere to host it, I am unsure of my next move.

The game was on Facebook before the hoster decided to not host it, anymore. We have 4,800 images for the game, 350 scripts that were coded in a language very similar to HTML5 and Java, and over 1,000 animations.

My goal is to have the game playable on Facebook and iOS/Android platforms. I do not know if I can use the old gaming engine or not, but I should be able too. If not, I hope that I still have options; I do not want to let all of this development go to waste.

How do I publish a game written for Graal Online to Facebook?

sentences:
Why when coloring a Light from green to red it's coloring only part of it in red? I have in the Hierarchy a door with a script attached to it.

The script:

using UnityEngine;
using System.Collections;

public class DoorVert : MonoBehaviour {

    public float translateValue;
    public float easeTime;
    public OTween.EaseType ease;
    public float waitTime;
    public Light[] lt;
    public bool doorLocked = false;

    private Vector3 StartlocalPos;
    private Vector3 endlocalPos;

    private void Start(){
        StartlocalPos = transform.localPosition;
        gameObject.isStatic = false;

        if (doorLocked == true)
        {
            for (int i = 0; i < lt.Length; i++)
            {
                lt[i].color = Color.red;
            }
        }
    }

    public void OpenDoor(){
        if (doorLocked == false)
        {
            OTween.ValueTo(gameObject, ease, 0.0f, -translateValue, easeTime, 0.0f, "StartOpen", "UpdateOpenDoor", "EndOpen");
            GetComponent<AudioSource>().Play();
        }
    }

    private void UpdateOpenDoor(float f){
        if (doorLocked == false)
        {
            Vector3 pos = transform.TransformDirection(new Vector3(0, 1, 0));
            transform.localPosition = StartlocalPos + pos * f;
        }

    }

    private void UpdateCloseDoor(float f){
        if (doorLocked == false)
        {
            Vector3 pos = transform.TransformDirection(new Vector3(0, -f, 0));
            transform.localPosition = endlocalPos - pos;
        }

    }

    private void EndOpen(){
        if (doorLocked == false)
        {
            endlocalPos = transform.localPosition;
            StartCoroutine(WaitToClose());
        }
    }

    private IEnumerator WaitToClose(){

        yield return new WaitForSeconds(waitTime);
        OTween.ValueTo( gameObject,ease,0.0f,translateValue,easeTime,0.0f,"StartClose","UpdateCloseDoor","EndClose");
        GetComponent<AudioSource>().Play();
    }
}

I added the doorLocked bool variable.
And i want that when it's true and the door is on locked state to change the color of the two Point light 1 from green to red.

In the Start i did:

if (doorLocked == true)
            {
                for (int i = 0; i < lt.Length; i++)
                {
                    lt[i].color = Color.red;
                }
            }

When i'm running the game and doorLocked is false this is how it looks like:
Both lights are green and i selected one of the Point light 1 and you can see in the inspector the Color is green:

Now this is a screenshot when the game is running and when lockedDoor is true.
Now it should be red but it's only red around the Point light 1 the color seems to be still green:

Now i saw that in the Hierarchy one object above Point light 1 is called Light_Small_02 it's a child also of Light_Small_02:

I marked it here with a black circle.

And i think that i need also to change this Light_Small_02 color from green to red. Not sure since i can't find any green color with it in the inspector but when i disable the Light_Small_02 the green color is gone.

Anyway the main goal is to change the color of the two lights according to the door state: doorLocked true/false

This is a screenshot of Light_Small_02 inspector showing the mesh renderer part:

sentences:
How can I improve rendering speeds of a Voxel/Minecraft type game? I'm writing my own clone of Minecraft (also written in Java). It works great right now. With a viewing distance of 40 meters I can easily hit 60 FPS on my MacBook Pro 8,1. (Intel i5 + Intel HD Graphics 3000). But if I put the viewing distance on 70 meters, I only reach 15-25 FPS. In the real Minecraft, I can put the viewing disntance on far (= 256m) without a problem. So my question is what should I do to make my game better?

The optimisations I implemented:

Only keep local chunks in memory (depending on the player's viewing distance)
Frustum culling (First on the chunks, then on the blocks)
Only drawing really visible faces of the blocks
Using lists per chunk that contain the visible blocks. Chunks that become visible will add itself to this list. If they become invisible, they are automatically removed from this list. Blocks become (in)visible by building or destroying a neighbour block.
Using lists per chunk that contain the updating blocks. Same mechanism as the visible block lists.
Use nearly no new statements inside the game loop. (My game runs about 20 seconds until the Garbage Collector is invoked)
I'm using OpenGL call lists at the moment. (glNewList(), glEndList(), glCallList()) for each side of a kind of block.

Currently I'm even not using any sort of lighting system. I heard already about VBO's. But I don't know exactly what it is. However, I'll do some research about them. Will they improve performance? Before implementing VBO's, I want to try to use glCallLists() and pass a list of call lists. Instead using thousand times glCallList(). (I want to try this, because I think that the real MineCraft doesn't use VBO's. Correct?)

Are there other tricks to improve performance?

VisualVM profiling showed me this (profiling for only 33 frames, with a viewing distance of 70 meters):

Profiling with 40 meters (246 frames):

Note: I'm synchronising a lot of methods and code blocks, because I'm generating chunks in another thread. I think that acquiring a lock for an object is a performance issue when doing this much in a game loop (of course, I'm talking about the time when there is only the game loop and no new chunks are generated). Is this right?

Edit: After removing some synchronised blocks and some other little improvements. The performance is already much better. Here are my new profiling results with 70 meters:

I think it is pretty clear that selectVisibleBlocks is the issue here.

Thanks in advance!
Martijn

Update: After some extra improvements (like using for loops in stead of for each, buffering variables outside loops, etc...), I now can run viewing distance 60 pretty good.

I think I'm going to implement VBO's as soon as possible.

PS: All source code is available on GitHub:
https://github.com/mcourteaux/CraftMania

sentences:
What's the rationale for different coordinates systems? Could someone explain to me why Blender and other 3D modeling apps switch axes?

If I export model with Blender, then exporters do following things for the same model:

The 3DS format applies this transform matrix:

     [ 1.0, 0.0, 0.0, 0.0 ],
     [ 0.0, 0.0, -1.0, 0.0 ],
     [ 0.0, 1.0, 0.0, 0.0 ],
     [ 0.0, 0.0, 0.0, 1.0 ]

The Collada format applies this transform matrix:

     [ 1.0, 0.0, 0.0, 0.0 ],
     [ 0.0, 0.0, -1.0, 0.0 ],
     [ 0.0, 1.0, 0.0, 0.0 ],
     [ 0.0, 0.0, 0.0, 1.0 ]

The OBJ format (default) transforms axes just like a transform matrix was applied, but OBJ format (Forward Y, Up Z) gives the original values that I see in Blender. The PLY format also does nothing and I get same values I see in Blender.

PS

Question was edited. I do not ask why there are different coordinate systems.
I understand that.

I do not understand why Blender and other switch axis silently when model is exported.

People in comments say:

It is easy to fix model after export
There are people who needs that.

Actually I never seen these people and if it easy to fix then it is more easy to switch axis for those who really need that switch.

I would love to hear someone who say that axis switch is important and he/she needs in real work (not in theory)

sentences:
Huge 2d pixelized world I would like to make a game field in a indie-strategic 2d game to be some a-like this popular picture.

So every "pixel"(blocks) changes it's color slowly, sometimes a bright color wave happens, etc, but the spaces beetwen this pixels should stay dark (not to count shades, lightning and other 3rd party stuff going on). Units are going to be same "pixelized" and should position them-selfs according those blocks.

I have some experience in game-developing, but this task seems not trivial for me. What approaches (shader, tons of sprites or code-render, i don't now) would you recommend me to follow?
(I'm thinking of making this game using Unity Engine)
Thanks everyone! :)

sentences:
Pygame Error AttributeError: 'pygame.Surface' object has no attribute 'add_internal' I'm making my first game of Pygame. I'm going to create groups for making collisions but when I add an object to the group, I get an error in sprite.py (Pygame's Files)

AttributeError: 'pygame.Surface' object has no attribute 'add_internal'

Why I get this error?
There is a simplest way to make collisions?

There is my code:

import pygame
from pygame.locals import *
import sys
import os
import time
width = 950
height = 500
Game = False
GameOver = False
keyboard = pygame.key.get_pressed()[K_UP]
def main():
    pygame.init()
    screen = pygame.display.set_mode((width, height))
    pygame.display.set_caption('Flappy Dog')
    background = pygame.image.load(os.path.join("Images", "Background_00.png")).convert()
    FlappyDog = pygame.image.load(os.path.join("Images", "Flappy.png")).convert_alpha()
    Play = pygame.image.load(os.path.join("Images", "Play.png")).convert_alpha()
    Dog0 = pygame.image.load(os.path.join("Images", "Dog0.png")).convert_alpha()
    Dog1 = pygame.image.load(os.path.join("Images", "Dog1.png")).convert_alpha()
    SpikeUp0 = pygame.image.load(os.path.join("Images", "SpikeUp0.png")).convert_alpha()
    SpikeUp1 = pygame.image.load(os.path.join("Images", "SpikeUp1.png")).convert_alpha()
    SpikeDown0 = pygame.image.load(os.path.join("Images", "SpikeDown0.png")).convert_alpha()
    SpikeDown1 = pygame.image.load(os.path.join("Images", "SpikeDown1.png")).convert_alpha()
    GameOver = pygame.image.load(os.path.join("Images", "Game-Over.png")).convert_alpha()
    Replay = pygame.image.load(os.path.join("Images", "Replay.png")).convert_alpha()
    Bone = pygame.image.load(os.path.join("Images", "Bone.png")).convert_alpha()

    Game = True
    Dog1_pos_x = 100
    Dog1_pos_y = 100
    screen.blit(background, (0, 0))
    screen.blit(FlappyDog, (0, 0))
    screen.blit(Bone, (550, 100))
    screen.blit(Play, (600, 350))
    screen.blit(Dog0, (5, 240))
    bones = pygame.sprite.Group()
    bones.add(Bone) # <-- Error here
    Dog = pygame.sprite.Group()
    Dog.add(Dog1)
    pygame.display.update()

    while True:
        if GameOver == true:
            screen.blit(background, (0, 0))
            screen.blit(GameOver, (20, 50))
        if pygame.sprite.gropucollide(Dog, Bones, True, True):
            Game = False
            GameOver = True
        while Game == True:
            pygame.event.pump()
            if pygame.key.get_pressed()[K_UP]:
                for i in range(10): # Up
                    Dog1_pos_y = Dog1_pos_y -1
                    screen.blit(background, (0, 0))
                    screen.blit(Dog1, (Dog1_pos_x, Dog1_pos_y))
                    screen.blit(SpikeDown0, (0, 436))
                    screen.blit(SpikeUp0, (0, 0))
                    pygame.display.update()
                    pygame.time.delay(1)
            else: # Down
                Dog1_pos_y = Dog1_pos_y +1
                screen.blit(background, (0, 0))
                screen.blit(Dog1, (Dog1_pos_x, Dog1_pos_y))
                screen.blit(SpikeDown0, (0, 436))
                screen.blit(SpikeUp0, (0, 0))
                pygame.display.update()
                pygame.time.delay(1)

        for event in pygame.event.get():
            if event.type == pygame.QUIT:
                pygame.quit()
                sys.exit()
                pygame.display.update()

if __name__ == "__main__":
    main()

sentences:
Set FBX creator while exporting using FBX SDK I am using FBX SDK 2018.1.1 to write a simple utility application on windows that will export existing FBX file (this file is exported from Blender 2.79).

I need to set the creator of the final FBX file to "My custom FBX exporter". As per documentation of FBX SDK, it can be done using

http://help.autodesk.com/cloudhelp/2018/ENU/FBX-Developer-Help/cpp_ref/class_fbx_i_o_file_header_info.html

here is the code snippet used to export the FBX:

FbxExporter* pExporter = FbxExporter::Create(m_pSdkManager, "");

pExporter->SetFileExportVersion(FBX_2012_00_COMPATIBLE);

FbxIOFileHeaderInfo *infoExporter = pExporter->GetFileHeaderInfo();
infoExporter->mCreator = "My custom FBX exporter";

pExporter->Export(m_pScene);
pExporter->Destroy();

But when I read this newly exported FBX file it shows "FBX SDK/FBX Plugins version 2018.1.1" in the mCreator field.
This is the snippet when I import the file (just to check if mCreator property is properly set)

lImportStatus = lImporter->Import(m_pScene);

info = lImporter->GetFileHeaderInfo();

How do I properly set the mCreator in FBX file header so that it is set in final exported file?

sentences: How to make player move only along the line I am using Line Renderer to draw a line on 2D scene using a path of multiple Transforms. And I want player to move along the line without the ability to get off it, like if he was on a rail. The simplest method I can see is setting a number of invisible walls along the line, so the player couldn't physically move away from the line. But maybe there's better method?

sentences:
How to pass a big (60+) amount of variables to an HLSL pixel shader? I am in trouble at trying to pass a big amount of variables needed for my pixel shader computations.

After trying and failing to link my struct to a cbuffer (data alignement mismatch) I tried passing my variables first to the vertex shader (with an D3D11_INPUT_ELEMENT_DESC / CreateInputLayout) with the intent to link them to the pixel shader through semantics but I hit the 32 shader inputs limit.

I am really stuck (and quite a noob at DX). What is a common / standard way to do this ? Can I only rely on a cbuffer ? Is creating a D3D11_INPUT_ELEMENT_DESC / CreateInputLayout even possible for the pixel shader ?

Example struct I want to pass to my pixel shader :

struct SceneParamsInterface {
    bool DEAOEnabled;
    XMFLOAT4 DEAOColor;
    double DEAOPow;
    bool lightEnabled;
    XMFLOAT4 lightColor;
    XMFLOAT3 lightDirection;
    bool lightMultiply;
    double lightMultiplyFactor;
    bool ambiantLightEnabled;
    XMFLOAT4 ambiantLightColor;
    bool HSEnabled;
    int HSSpread;
    bool fogEnabled;
    XMFLOAT4 fogColor;
    double fogDistanceMax;
    bool glowEnabled;
    XMFLOAT4 glowColor;
    double glowRadius;
    XMFLOAT4 skyColor;
    bool skyBoxEnabled;
    //uniform sampler2D skyBoxTexture;
    int skyBoxScheme0; // top
    int skyBoxScheme1; // left
    int skyBoxScheme2; // front
    int skyBoxScheme3; // right
    int skyBoxScheme4; // back
    int skyBoxScheme5; // bottom
    int skyBoxRotate;
    double skyBoxRotateSpeed;
    XMFLOAT3 skyBoxRotateAround;
    bool orbitTrapsEnabled;
    int orbitTrapsId;
    XMFLOAT4 objectColor;
};

Thanks!

sentences:
Which network engine/library/system to use in a .NET turn-based game? I'm developing an abstract strategy turn-based game in C#.

Being so, high network load is not expected. The players don't even have to be connected all the time. The host could wait for the current player to connect and make his move. I know I could make a web site to run that, but I want anyone to be able to host their own games.

I need something reliable and that enables me to have good productivity.

I'm already underway with WCF. Was that a good choice? Which other network framework should I consider?

sentences:
Good Tools & Methodologies for designing Game Arch I'm currently developing a multiplayer and turnbased silverlight card game and using WCF Polling Duplex communication. I've almost finished the game but I'm still dealing with the methods and animations during the game end. Sometimes I'm loosing control and can't even debug and leave it for days to get some more motivation.

What I'm asking is that there should be some methods to design the gameflow on papers such as GameState charts or similar. I did some by myself to track states of some objects but it didn't work out. There should be some tools or methods to do this.

sentences:
Is it OK to release the source code for your own Xbox Live indie game? Between not being sure how to phrase my question for Google and not being a lawyer, I thought it might be easier to ask you guys. Specifically, I want to know if it's OK to sell an Xbox Live indie game while simultaneously distributing the source code and other assets via GitHub or something.

Edit: The Communist Duck asked "why not?" One reason I can think of is that Microsoft has a small stake in a game's sales. They are hosting the demo/full game, they might be dedicating an advertising slot to the game in their "latest" section, etc. It's true they get a cut of each sale, but they get nothing if everyone just goes and downloads the free version.

Anyway, it's not a matter of what is reasonable and logical, it's a matter of what the terms and conditions allow. I'm going to read through them regardless, but I was hoping someone already knew.

sentences:
Moving Windows Mixed Reality main camera in Unity3D programatically I'm trying to programmatically move the main camera i.e. player's point of view/origin in a Windows Mixed Reality but for some reason it's not working for me (using newest latest stable Unity 2018 and HoloToolkit through which I've setup my WMR project)...
I've done the following:

m_MainCamera = Camera.main;
m_MainCamera.transform.position.Set(100f, 100f, 100f);
UnityEngine.XR.InputTracking.Recenter();

if (Input.GetKeyDown(KeyCode.A)) happens, but even though the code gets run, my VR view position remains unchanged, and I'm guessing at 0,0,0 (or whatever is set initially)...so how exactly do they do those movements in the WMR's UI cliff house when you use the motion controller to point to place you want to transport your view...do they actually move all of the objects showing instead?

Or am I missing something really trivial when I can't move except for by moving my own body inside of VR? Maybe HoloToolkit is disabling it somehow... But how do I reenable it then to move to a predetermined places within a large life sized 3D model objects please?

TIA

sentences:
Unity 2d square position not lining up with its size I want to have one square that rests at the Unity 2d coordinates (5,5). Using transform.localScale I make the square be 3 units by 3 units large. So I thought that if I made another square that is the exact same except it is at the coordinate (8,5), the second square would be directly to the right of the first one, touching it. But instead, the square spawns a bit more to the right than it should, implying that the size x,y units are smaller than the position x,y units. Any way I can solve this problem, and have both touching? Thank you.

Code for placing the squares (tileHeight = 3 and tileWidth = 3):

GrassTile.transform.localScale = new Vector3(tileWidth, tileHeight, 0f);
Instantiate (GrassTile, new Vector3 (0f, 15f, 0f), Quaternion.identity);
Instantiate (GrassTile, new Vector3 (3f, 15f, 0f), Quaternion.identity);

Screenshot of what it looks like, as well as what the prefab looks like:

Screen shot of the grassTile stats:

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:
Can I use real currency name/symbol as an in-game currency? Can I use a real currency name (i.e USD, PKR) or symbol ($, Rs.) for my in-game currency with the same exchange value as original currency? I couldn't find anything about it in google play store policies neither in government websites.

Of course I have other options, I can call it gold or silver etc but I'm just wondering if it is allowed or not.

sentences:
What are some gameplay cases where knowing the Z as a result of the raycasting is useful in a 2D setting? The context is an 3D engine with a 2.5D level format. Like a roller coaster tycoon level, with some other level features added, and layers removed. For example the tile functions have the following interface.

markTile([3, 5]);

This statement places a mark on the tile located at 3x5. This tile can be on top of a mountain or a cave, but different tiles on the same height can't exist, so the Z axis isn't needed. Internally everything is in 3D, but it isn't exposed to the interfaces since there can't be more than one tile at the same X, Y position.

Because the tile functions are 2D, units also store their positions in 2D.

markTile(unit.position); // place a mark where the unit is

There are also cases where knowing the Z of an unit is useful, but it is almost never about the tile or the placement position. For example it is useful to create a sprite or an exclamation mark on top of an unit, but that is done by using the Z from the tile and the height of the unit. That interface also uses an unit as the parameter, not a position, because multiple units can be on the same position unlike a tile.

placeExclamationMarkOnUnit(unitId);

Now, I am wondering, is there a need for the raycaster to even return the Z data in this setting? I can't think of a gameplay case. I can think of cases where the unit height is important, but none that would need to know the Z from the ray. I can also think of cases where I could want to place an effect on an exact position on the unit, but that can be done by just X and Y(floats, not ints) as well.

Thanks.

sentences:
Can I make a "fan game" with characters of one game that already exists? (I'm sorry about my english, I'm from Chile)

Hi!
I'm making a game based on Alone In The Dark, and the history would happen before the events on the game of PS1. However, I would like to make a game with the character Aline, but with 10 years old. The game mechanism would be the same, and the name of a lot of characters and places. I don't really want to make any money, I just want to make a good game, I love the AiTD game. Can I do that or I can be on jail because of that? Thanks!

sentences:
Way to avoid excessively bright objects with specular lighting? I have a typical Phong shading with specular light. I have all the parameters tuned so to give appropriate highlights from a point light source. Now the problem I have is a new object that has a large flat surface which tends to face directly towards the light source (which is a bit offset from the camera). It also has a normal map which is primarily in one direction (steel panels). This results in a pure white object.

I have a lot of options to try and work around the problem, but I was wondering if this is a common issue and perhaps there is a clean workaround. The various options I see (and am trying) are:

Reduce specular map intensity. There are two problems here, first when the object is not facing the camera it looks dull, second on a low quality setting I don't use specular maps.
Clamp the range of specular light. This of course limits the highlights for the entire scene. It also limits the highlights when the object isn't facing the camera.
Put a per-object specular light limit. This at least doesn't affect the whole scene, but does dullen this object when not facing the camera.

sentences:
What is the Workflow? Blender -> Substance Painter -> Unreal Engine 4 My name is Jose and I'm pretty new to Game Art Development.

I know some intermediate UE4 (both C++ and Blueprints), but my weakest point has always been the workflow to import assets from Blender and Substance. Up to this point I have always bought external 3D assets.

As far as I know, the workflow is this (but I don't know if I'm correct):

BLENDER: Create a 3D model in Blender. Create the materials I need for each part of the mesh. UV unwrap it. Export as .fbx
SUBSTANCE PAINTER: Import the .fbx file into Substance Painter. Paint the 3D model. Export the .obj file AND the texture maps (albedo, roughness, metallic, normal, etc.)
UNREAL ENGINE 4: Import the .obj file AND the texture maps. Create a material based on these maps. Apply the material to the model.

I have a few questions now:

Is this workflow correct? Or is there something I'm misunderstanding?
What model do I have to import into UE4? The .fbx from Blender? Or the .obj from Substance? Is there any difference between these two?
When exporting the textures from Substance Painter, I can choose from a dropdown called config, to what game engine I'm exporting these textures to (Unity, Unreal, Lumberyard, Cryengine, etc.). What exactly does this option do? What is the fundamental difference in exporting textures to Unreal or to Unity, for example?

sentences:
Accessibility of games, how is important for you? I'm blind and I would know if there is someone that consider important the accessibility, from a blind in particular, when develop a new game.
I don't speak about an audio game, I'm speaking about a video game that implements a TTS or a GUI compatible with screen readers!

sentences: How can i calculate that normal lays in same part of plane with point? I.e. n0 for A and n1 for B. Plane divided by plane CD.

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:
How do I convert screen coordinates to isometric tile map coordinates in libGDX using matrices I know this has been asked many times but my question doesn't quite fit the others. I have an IsometricTiledMap and I need to get the tile under a set of screen X and Y coordinates. Here is a picture of my game:

I need to get the tile that the player is standing on. I need to convert screen coordinates to isometric tile coordinates and the way that seemed the easiest was by using a matrix as described here: http://www.alcove-games.com/advanced-tutorials/isometric-tile-picking/#comment-56390

Unfortunately I have no idea how to change that code to fit a 128x64 tile instead of a 1.0x.5 tile. Here is my code

isoTransform = new Matrix4();
isoTransform.idt();
isoTransform.translate(0.0f, 32f, 0.0f);
isoTransform.scale((float) (Math.sqrt(2.0) / 2.0), (float) (Math.sqrt(2.0) / 4.0), 1.0f);
isoTransform.rotate(0.0f, 0.0f, 1.0f, -45.0f);

invIsotransform = new Matrix4(isoTransform.inv());

//touch vector
touch = new Vector3();

@Override
public boolean touchDown(int screenX, int screenY, int pointer, int button) {
    touch.set(screenX, screenY, 0);
    touch = gameCamera.unproject(touch);
    touch.mul(invIsotransform);

    pickedTileX = (int)touch.x / 64;
    pickedTileY = (int)touch.y / 32;

    debug(touch.x + " " +  touch.y);
    debug(pickedTileX + " " + pickedTileY);

    return false;
}

I think the problem is in this line isoTransform.scale((float) (Math.sqrt(2.0) / 2.0), (float) (Math.sqrt(2.0) / 4.0), 1.0f); but I'm not sure what to change.

sentences: How can I draw an animated vector field on a map? I want to render an animated vector field map similar to this wind speed visualization. How can I do this?

sentences:
In tactical combat games, why does shooting end your turn? I was wondering about this particular game mechanic in tactical combat games, like XCOM2, where you have two actions, which may be:

move+move
reload+move
move+reload
move+attack

...but not attack+move, because when attacking, it ends your turn.

If I compare this to tabletop D&D 5e, with its move+attack actions, it shouldn't be that different, but this restriction seems to make things completely different.

What is the game design purpose for this kind of restriction?

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: How to tell if a fixture is being squeezed by two other fixtures in Box2D? Let's say I had a ground fixture, a player box, and a kinematic block moving up and down. If the player stands under the block, weird things happen. I want to simply play an event where the player dies. How can I detect when the player box is crushed by the block moving down on it?

sentences: Is it necessary to know some programming language before learning to use Unity I had learnt a bit of Java programming in school...is there any other programming language that I should learn to be able to work using Unity?

sentences:
Multiple joysticks event handling I want to make a game which is totally same idea as "Who pressed the button answers the question".

I have 2 joysticks and both are connected to a pc. My application will be Winforms and I will develop it on Visual studio 2012.

I've used SlimDX, Sharpx so far I've found nothing for multiple joysticks. My problem is not mesuring the time until a player presses a button, all I want to know is which joystick / gamepad have pressed a button first.

Could you give me ideas about how I can achieve this ?

sentences: box2d prismatic joint friction I know it is possible to add friction to rev joints by enabling motor and adding maxMotorTorque. I want the same for prism joint but only maxMotorSpeed option is available which didn't quite work for me. Is there another way?

sentences:
Need the co-ordinates of innerPolygon Let say I have this diagram,

Given that i have all the co-ordinates of outer polygon and the distance between inner and outer polygon is d is also given. How to calculate the inner polygon co-ordinates?
Edit:
I was able to solved the issue by getting the mid-points of all lines. From these mid-points I can move d distance, So I can get three points. No I have 3 points and 3 slopes. From this, I can get three new equations. Simultaneously, solving the equation get the 3 points.

sentences:
Tilemaps in a Entity System Framework? I have been reading up on Entity System Frameworks specifically Artemis. I am trying to decide if it is right for me. I strictly work on tile based 2d pixel art games, and I don’t think they will ever be that resource intensive. I have always used standard OOP with a lot of inheritance in the past.

My understanding of the Entity System Framework right now (I am not sure if I grasp it completely yet) is:

Entities are nothing but ID's
Components are nothing but dumb data added to an entities component pool
Systems are update functions that are attached to the world to handle every entity that matches the Systems component signature

If my understanding is correct then I am having quite a bit of trouble conceptualizing adding tilemaps and AI Behavioral Trees into this framework. I will ask about AI in the future.

Should a tilemap be built into this framework? Or should it be kept separate to make it easy to generate with a tilemap editor?

If the tilemap should be built into this framework, is each tile a different entity? And the tilemap a system? Or is the tilemap itself a single entity with inheritance built off of it?

If the tilemap is sperate, what would be the best way of collision detecting entities against the external tilemap?

I understand that multiple options that I have listed might be correct, but if anybody has done this in the past they might be able to shed some light on my confusion. Maybe there is another alternative that I have not thought of?

Thank you.

sentences:
How to transform only part of an array in OpenGL ES? I have one texture atlas of which I select the "non-animated textures", I put all vertex and UV coordinates in two array:

vertices = new float[] {
            // background
            0.0f, 1920f, 0.0f,
            0.0f, 0.0f, 0.0f,
            1080f, 0.0f, 0.0f,
            1080f, 1920f, 0.0f,
            // character
            240f, 760.0f, 0.0f,
            240f, 14.0f, 0.0f,
            770f, 14.0f, 0.0f,
            770f, 760.0f, 0.0f,
            // object (Will be transformed)
            360f, 800f, 0.0f,
            360f, 600.0f, 0.0f,
            500f, 600.0f, 0.0f,
            500f, 800f, 0.0f,
    };

uv = new float[] {
            // background
            0.50f, 0.25f,
            0.50f, 0.75f,
            1.0f, 0.75f,
            1.0f, 0.25f,
            // character
            0.0f, 0.25f,
            0.0f, 0.75f,
            0.25f, 0.75f,
            0.25f, 0.25f,
            // object
            0.0f, 0.75f,
            0.0f, 1.0f,
            0.25f, 1.0f,
            0.25f, 0.75f
    };

My vertex shader:

uniform mat4 matrix;
attribute vec4 vPosition;
attribute vec2 a_texCoord;
varying vec2 v_texCoord;

void main() {
    gl_Position = matrix * vPosition;
    v_texCoord = a_texCoord;
}

And my fragment shader:

precision mediump float;

varying vec2 v_texCoord;
uniform sampler2D a_texture;

void main() {
    gl_FragColor = texture2D(a_texture, v_texCoord);
}

I don't know how to animate just a part of the arrangements, also I try to create one more texture but when I run the app I only see the last texture.

sentences:
matrix to transform unit cube to space defined by 8 arbitrary points I asked a question relating to similar to this already, but I think this is a clearer objective of what Im trying to achieve.. or whether its possible at all!

Im trying to find a transformation (matrix ideally) which would transform the 8 points of a 3d unit cube to 8 arbitrary points in space.

The 8 target points have no known structure.

e.g:

My gut feeling is that a matrix is unable to provide this xform since the cube faces vertices can be concave.. but are there any other methods of transformation?
Thanks!

sentences:
Silverlight player centered viewport example I am new to game development and i want to use silverlight for it.
First of all i want to learn the logic of player centered gameplay.
Something like this;

Player character moves in large scaled map but player can see only the viewport (centered on player) like on 3000x3000 px map with 400x400 viewport

what do i need to achive this?
Is there a code example or any bookthat contains this?
Do i need to use a map generator? (so when player moves it replaces titles according to matrix text file etc)

Thanks.

sentences:
How can I calculate force and acceleration? I have problem of calculating the movement of the object.

At the moment, I have a vectors calculated from the center of the screen minus the position of the object.

direction vector = centerScreen - positionObject

To calculate the new position of the object

position(new) = position(t) + directionVector * delta

The delta is the time frame rate.

Does anyone know how can I modify the above formula to calculate forces and acceleration? I want to have an object pulling other objects towards it.

sentences:
RawImage texture change event? I have a RawImage and an AspectRatioFitter attached to it so I want to change the aspect ratio to fit the image in the texture field of the raw image.
But I need to avoid checking for it in the update as much as possible.
Is there an event for when the texture of a RawImage element has changed? Something like OnTextureChanged().

sentences:
android game - how to store game elements so gc wont fire I'm developing a android game and I have a question about storing the game elements without firing garbage collector.

My game needs a collection where the game elements are stored according to x,y positions (all game elements have x,y,width and height). The collection is then called every frame to retrieve the elements according to cameraX, cameraY, camera width and height (user can scroll around the game).

Example:

 function draw() {
   tmp = collection.getElements(tmp,cameraX,cameraY,cameraWidth,cameraHeight);
     for(int i = 0; i < tmp.size(); i++) {
        tmp.get(i).draw();
     }
  }

I'm currently using the Vector class to represent the collection elements, but the gc keeps firing every couple of minutes. I do all my allocations up front. I've also modified the getElements function to accept 1 more parameter - a temp vector(allocated upfront) which is filled with elements and then returned.

How should I store the game elements so the gc wont fire (I prefer never if possible)?

I also add elements to the collection during runtime, do I have to allocate them upfront also?

sentences: Difference between Decision Trees & Behavior Trees for Game AI What are some differences between Decision Trees and Behavior Trees for AI Game Development?  For what applications would you use one over the other?

sentences:
Making a gameobject move back and forth in Unity So i have this enemy gameobject and i want it to move in a certain pattern like a patrol. So i want him to move from A to B to C then Back to B to A.
The script I worked out makes him go from C to A directly but I dont want that. Can someone please help .
The Length of PatrolPoint Array in 3 `using UnityEngine;
using System.Collections;

public class EnemyPatrol : MonoBehaviour {

public Transform [] patrolPoints; // An Array of path points to be followed
private int currentPoint ;
public float enemySpeed ;

void Start()
{

    currentPoint = 0;
    transform.position = patrolPoints[ currentPoint].position; // Starting Point
}

void Update()
{

    if(transform.position == patrolPoints[currentPoint].position)
    {
        currentPoint ++ ;
    }

    if(currentPoint >= patrolPoints.Length)
    {
        currentPoint = 0 ;
    }

    transform.position = Vector3.MoveTowards(transform.position , patrolPoints[currentPoint].position , enemySpeed*Time.deltaTime);

    }

}
`

sentences:
Eliminate an Actor dragged outside SlotTarget As the title suggests, i would like to eliminate an Actor from the Stage when the player moves it outside my SourceTarget. The default behavior of DragAndDrop class doesn't allow to drag an Actor on a place that isn't a valid SourceTarget, but i need to implement the elimination of an Actor in this way.

So, can i implement one or both the following solutions?

1) When the Actor is dragged outside SourceTarget, remove it

2) Use a special TargetActor over which the dragged Actor gets removed (like a trash can)

In this latter case i should create a second special TargetActor, but seems that Libgdx doesn't allow it. I can have only one TargetActor. In my particular case SourceActor and TargetActor are the same.

dragAndDrop.addSource(new SourceActor(slotActor));
dragAndDrop.addTarget(new TargetActor(slotActor));

Thank you

sentences:
Having problems with making a button class (checkIfClick) opengl Just basing how sfml does it, I get the globalbound of the object and then check if the mouseposition is within the object. I tried do something like that but I dont know exactly how to do it with opengl. I tried changing the projection from -1 to 1 coords to the size of the application in the hope I could just get the position of the object, but when doing std::cout, it still shows the position in -1 to 1 coords.
So my question is:  "How would I convert my mouseposition to -1 to 1 or vi-versa."
Its actually 0 to 2 and not -1 to 1
So far i have this:
I dont know exactly how to get the top left right with opengl I know with sfml. I would use the position and subtract the half of the width and height to get it but like I said, idk how to do that in opengl. I tried doing that but the object position i still -1 to 1 even though I passed in the
 glm::mat4 proj = glm::ortho(0,width, 0, height,-1,1);

I know my projection is working, because when I enter any big number, my object gets really small.
FYI, just because I see these types of answers alot; I'm not asking you to write me a fully functional button class. I just want a general idea on how it would be done or some article that could help me do that (or a very basic example).
void contain(glm::vec2 position)
{
    if (position.x >= button.left && position.x <= button.right
    && position.y >= button.top && position.y <= button.bottom) {
        std::cout << "True\n";
    }
    else {
        std::cout << "False\n";
    }
}

sentences: Clickable hex grid in c#.net I want to create a Windows Form-based adventure game where the player clicks a hex on a static map to bring up their next encounter. I have the map already and plan to scan it and convert it to a .bmp file. My problem is that I'm not sure how to tie the map image in with the game code. Unless I'm mistaken, I think I need to use some kind of imagemap control. If that's the case, do I need to plot each hex individually, or is there a way to plot the whole map in bulk? I found this article, but I'm not sure if it's relevant to what I want to do or not. I'm just looking for general information or links to relevant articles. Thanks.

sentences:
Is it possible to completely avoid copying image data when uploading textures to the GPU on iOS? I am not a game developer, but I have been doing iOS software engineering for many years. I have a particular interest in graphics and animation, but the finer details are still a little foreign to me.

Here is the scenario I am working with:

I have an extremely memory-contrained iOS environment (i.e., no more than 16-20MB of active memory usage) where I am trying to display many high-resolution sprite frames in rapid succession to show an animation. Each frame might be up to 1210x1210 pixels, and I can have up to 200 frames in a single animation.

Obviously, these constraints mean I have to completely optimize my memory usage. There's no way I can even consider having more than one frame of an animation inflated and being used by my application's memory at any given point. Yet I need images to be loaded super fast.

I had considered trying to pack a bunch of frames together into a PVRTC2 or PVRTC4 image file. The quality and disk-space usage of PVRTC files is superior to other formats, considering they're only using 2 or 4bpp.

I attempted to use SpriteKit to read the texture atlas I created and display the image frames. This "worked" in that it did what I wanted, but the memory usage was insane, around 600-700MB. Apparently, SpriteKit is always going to make copies of texture data for its own use, which is unfortunate.

My question is if it's possible to completely bypass copying image data by my application before sending it to the GPU for rendering. My understanding was that the whole point of PVR image formats was to be an exact representation on disk of the uncompressed image data that the GPU can use directly, without the need for copying the image into its own format. (As far as I know, PVR is the format the GPU needs to render the texture.)

Indirectly, I was able to mostly achieve what I wanted using a framework I helped develop for iOS called Fast Image Cache. Basically, it creates image tables on disk that are fully uncompressed and are page-aligned in advance such that Core Animation can use the image data directly without doing a single memcpy. Fast Image Cache uses mapped memory to further avoid any copies whatsoever. In essence, data goes directly from disk to being rendered on display without any copies being made. (At least, no copies that are made within the context of your application, which could be held against your memory usage limits.)

The problem with FIC is that it is a very naive image table. It doesn't do any sort of texture packing. For my testing, I loaded each frame of the animation as a separate image inside FIC. There was a ton of disk IO overhead going on. In addition, FIC only supports 32bpp (with or without alpha) and 16bpp bitmap formats, which means the image tables are huge.

Is there a way for me to achieve something similar to FIC using OpenGL and PVRTC images? If I need to build out my own simple texture atlas support to map regions of PVRTC images to individual animation frames, I'll do that, though it'd be nice if something else besides SpriteKit could do this for me.

The crucial point is being able to quickly load fairly large image data to be rendered without impacting my app's memory footprint.

sentences:
How do I make a puzzle piece move smoothly between locations? I'm building a 2048 clone to sharpen my Libgdx skills, but I don't know how to ease a tiles between board locations. When I slide my finger, the tile moves rather swiftly. How I can make the movement smoother?

This is the code I'm using to make it move to the left:

 for(float t=0;t<getMax(currentTile);t++
 {
  shapeRenderer.begin(ShapeType.Filled);
  shapeRenderer.setColor(230/255.0f, 220/255.0f, 230/255.0f, 1);
  shapeRenderer.rect(q-t, r, a, b);
  shapeRenderer.end();
 }

sentences:
I need an enemy spawning algorithm for a 2D tower defense I need an enemies spawning algorithm for a 2D tower defense game. I have 4 maps, each has 4 stages and each stage has 40 rounds. I need to create an algorithm which will instantiate waves, increase health and change their type in new rounds, new stages and in new maps. I need your suggestions and ideas to resolve my problem.

It should be done like in geoDefense and Fieldrunners.

Lets take an example which is somewhat in my mind:

MAP1- Stage-1, on Rounds 1,2,3,4 loop around with '+5' on it so also in Rounds 6,7,8,9 ...so on... instantiate 'Type-1 swarm' after increment(+5) add 'Type-1 swarm + some value' so that if previous 'Type-1 swarm' (on rounds 1,2,3,4) has 3 enemies, after above increment(+5) 'Type-1 swarm' has 3+some value. The rounds multiple of 5 will instantiate 'Type-2 swarm + some value', and as round increases health value should also increase.

On Map-1 Stage2/ and other Maps and stages repeat the above process with some slight difficulty and change type swarm1 and swarn2 with other swarn types.

I hope you people got what I actually need. I don't want to hardcode the rounds because there is also an endless option in my game and hard level would have 100 rounds instead of 40.

Any other spawning ideas/algorithms followed by TD game programmers/designers.

sentences:
Would Raycast suffice for a game clock based on sun position? I need help with some logic in my script. I created a dynamic day/night cycle that works fine in itself, but I want to add a game clock that works off the initial position of the sun (Directional Light).

I was thinking that it could be achieved by Shooting a ray from the directional light to the terrain and computing an angle which i would use to estimate the time.

Would ray casting be the best/ most efficient way to do this?
Is it even possible to achieve what I'm asking for, if not is there a method that better suits what I need?

So to go over.. I want the user to be able to place the sun anywhere along the x axis that would rotate around the terrain, when the user is satisfied with the position they chose, on startup of the game I would like my script to calculate the current position of the sun and then estimate the current time.

I can take care of the actual clock after that point but is ray casting from the sun to the terrain the way to go about something like this or should I be looking at this in totally different way?

sentences:
Blender mesh mirroring screws up normals when importing in Unity My issue is as follows:

I've modeled a robot in Blender 2.6. It's a mech-like biped or if you prefer, it kindda looks like a chicken. Since it's symmetrical on the XZ plane, I've decided to mirror some of its parts instead of re-modeling them. Problem is, those mirrored meshes look fine in Blender (faces all show up properly and light falls on them as it should) but in Unity faces and lighting on those very same mirrored meshes is wrong. What also stumps me is the fact that even if I flip normals in Blender, I still get bad results in Unity for those meshes (though now I get different bad results than before).

Here's the details:

Here's a Blender screen shot of the robot. I've took 2 pictures and slightly rotated the camera around so the geometry in question can be clearly seen:

Now, the selected cog-wheel-like piece is the mirrored mesh obtained from mirroring the other cog-wheel on the other (far) side of the robot torso. The back-face culling is turned of here, so it's actually showing the faces as dictated by their normals. As you can see it looks ok, faces are orientated correctly and light falls on it ok (as it does on the original cog-wheel from which it was mirrored).

Now if I export this as fbx using the following settings:

and then import it into Unity, it looks all screwy:

It looks like the normals are in the wrong direction. This is already very strange, because, while in Blender, the original cog-wheel and its mirrored counter part both had normals facing one way, when importing this in Unity, the original cog-wheel still looks ok (like in Blender) but the mirrored one now has normals inverted.

First thing I've tried is to go "ok, so I'll flip normals in Blender for the mirrored cog-wheel and then it'll display ok in Unity and that's that". So I went back to Blender, flipped the normals on that mesh, so now it looks bad in Blender:

and then re-exported as fbx with the same settings as before, and re-imported into Unity. Sure enough the cog-wheel now looks ok in Unity, in the sense where the faces show up properly, but if you look closely you'll notice that light and shadows are now wrong:

Now in Unity, even though the light comes from the back of the robot, the cog-wheel in question acts as if light was coming from some-where else, its faces which should be in shadow are lit up, and those that should be lit up are dark.

Here's some things I've tried and which didn't do anything:

in Blender I tried mirroring the mesh in 2 ways: first by using the scale to -1 trick, then by using the mirroring tool (select mesh, hit crtl-m, select mirror axis), both ways yield the exact same result
in Unity I've tried playing around with the prefab import settings like "normals: import/calculate", "tangents: import/calculate"
I've also tired not exporting as fbx manually from Blender, but just dropping the .blend file in the assets folder inside the Unity project

So, my question is: is there a way to actually mirror a mesh in Blender and then have it imported in Unity so that it displays properly (as it does in Blender)? If yes, how?

Thank you, and please excuse the TL;DR style.

sentences:
How to ensure that a 3D coordinate at Z=1 act like a 2D coordinate (using perspective projection) Possible Duplicate:
  OpenGL ES 2.0: Mixing 2D with 3D

The title probably is not that clear but please help me out here. I am going to write a (mostly) 2D game using OpenGL ES 2.0 so if I have a vertex at (5,10,1) I want it to be drawn at the (5,10) pixel on the screen. But I can't use orthogonal projection because I'll still use some few real 3D objects on it to give a cool effect, and I want to preserve the perspective distortion on their vertices with Z > 1.

How should I set up my view/projection matrices to achieve this?

note: I am so sorry if this sounds like a noob question, but please take in account that I am a noob myself...

sentences:
How to adapt background image size with player score? I have an image and a text for displaying the player score. They are both displayed through a canvas.

Currently, my textbox remains the same size independent of the score, so when the player gets a big score, it prints outside of the image.

I want keep my score inside the background image, and I also want to change the size of the image along with the number of digits in the score, like "10, 100, 1000, 10000" etc.

How can I adapt the size of my background image on the amount of digits in the current score?

sentences:
Spotlight turns off on and based on distance and angle, even in editor I have cloned a spotlight 3 times.  The original and one clone are near eachother and both work as expected.  However, the other two are a few meters away, and behave oddly.  I initially noticed in the player, but it also happens in the editor. If you get a few meters away they go out. I eventually noticed it also happens based on angle, as demonstrated below.

I am relatively new to Unity, but I've asked the other devs and they are stumped.  What could cause this?

sentences:
How best to structure/manage hundreds of 'in-game' characters I've been making a simple RTS game, which contains hundreds of characters like Crusader Kings 2, in Unity. For storing them the easiest option would be to use scriptable objects, but that isn't a good solution as you cannot create new ones at runtime.

So I created a C# class called "Character" which contains all data. Everything is working fine, but as the game simulates it constantly creates new characters and kill some characters (as in-game events happen). As the game continuously simulates it creates 1000s of characters. I added a simple check to make sure a character is "Alive" while processing its function. So it helps performance, but I can't remove "Character" if he/she is dead, because I need his/her information while creating the family tree.

Is a list is the best way to save data for my game? Or it will give problems once there are 10000s of a character created? One possible solution is to make another list once the list reaches a certain amount and move all dead characters in them.

sentences:
Allegro 5 Mouse Look I found good tutorial on how to do mouse look for 2D game here: http://www.atburrow.com/2010/03/08/objects-facing-the-cursor/

My code looks like this:

w = (double)mouse_x - (double)pos_x;
h = (double)mouse_y - (double)pos_y;
d = sqrt(w * w + h * h);
theta = asin(w / d) * 2 * ALLEGRO_PI;

Problem is i cant figure out how to translate it for Allegro 5.
Tried this on many different ways and its working, but not correctly. First im not using OpenGL (its a simple project for 2D controlls) so what i did after this is:

al_draw_rotated_bitmap(playerLook, imWidth / 2, imHeight / 2, pos_x, pos_y, theta, 0);

Object is rotating a bit faster than it should be. So this is blocking me from further exploration. I also found good tutorial for blitz from guy that im subscribed: http://www.youtube.com/watch?v=zFAaILFJtCY

Just went out, but still there is something that confuse me when using Allegro fixed math and i cant learn it without good example.Do anyone know how to set this code right in allegro5 ? How to do 360 degree rotation using mouse in allegro5?

sentences: Is it possible to capture screenshots in headless (no graphics) mode in unity? I am trying to capture screenshots while running unity simulation in headless mode (no graphics), if anybody tried to do the same and it worked, please share how could you make it work.

sentences:
Developing an RPG Encounter System I'm in the middle of an encounter system for an XNA RPG. The idea is, you walk around a dungeon, and certain tiles are makred as RandomBattleTiles, and you have an area in the map defining what monsters can be encountered. What I need is a way to layout the way a monster levels and how it's stat's increase. I was thinking something along these lines:

<Species>
    <Name>MonsterA</Name>
    <ID>001</ID>
    <SpriteName>monstera_sprite</SpriteName>
    <Levels>
       <Level>
          <LevelID>1</LevelID>
          <Stats>
              <Attack>12</Attack>
              <Defense>10</Defense>
              <Speed>20</Speed>
          </Stats>
          <Moves>
               <Move ID="1" Level="2"/>
          </Moves>
        </Level>
     </Levels>
</Species>

Would this be proper? Moves would follow a similar definition pattern.

sentences:
Quaternian coefficient multiplication I have 2 quarternians (Q1 & Q2), I'd like to apply a coefficient to each Quaternian, where the sum of both coefficients = 1.  As far as I'm aware, multiplying a quaternian by another is equivalent to adding them together.

In linear mathematics, this would as simple as:

AC + B(1-C) = Y

and

A.C = S, B*(1-C) = T

so

S + T = Y

I would be lerping C from 0 to 1.  Q1 is dynamic, while Q2 is a fixed target, so for this reason, I don't think Quarternian.Lerp is a practical solution.

How do I mutliply a quaternian by a coefficient, as Q1 * Q1 is equivalent to adding them together, which would be suitable for calculating the final product, ie S+T.

I'm unsure how to go about this.

sentences:
Uniform not being applied to proper mesh Ok, I got some code, and you select blocks on a grid.

The selection works. I can modify the blocks to be raised when selected and the correct one shows.

I set a color which I use in the shader. However, I am trying to change the color before rendering the geometry, and the last rendered geometry (in the sequence) is rendered light.

However, to debug logic I decided to move the block up and make it white, in which case one block moves up and another block becomes white.

I checked all my logic and it knows the correct one is selected and it is showing in, in the correct place and rendering it correctly. When there is only 1 it works properly.

Video Of the bug in action, note how the highlighted and elevated blocks are not the same block, however the code for color and

My Renderer is here (For the items being drawn)

    public void render(Renderer renderer) {
    mGrid.render(renderer, mGameState);

    for (Entity e:mGameEntities) {
        UnitTypes ut = UnitTypes.valueOf((String)e.getObject(D.UNIT_TYPE.ordinal()));
        if (ut == UnitTypes.Soldier) {

            renderer.testShader.begin();
            renderer.testShader.setUniformMatrix("u_mvpMatrix",mEntityMatrix);
            renderer.texture_soldier.bind(0);
            Vector2 pos = (Vector2) e.getObject(D.COORDS.ordinal());
            mEntityMatrix.set(renderer.mCamera.combined);
            if (mSelectedEntities.contains(e)) {
                mEntityMatrix.translate(pos.x, 1f, pos.y);
                renderer.testShader.setUniformf("v_color", 0.5f,0.5f,0.5f,1f);
            } else {
                mEntityMatrix.translate(pos.x, 0f, pos.y);
                renderer.testShader.setUniformf("v_color", 1f,1f,1f,1f);
            }
            mEntityMatrix.scale(0.2f, 0.2f, 0.2f);
            renderer.model_soldier.render(renderer.testShader,GL20.GL_TRIANGLES);
            renderer.testShader.end();
        } else if (ut == UnitTypes.Enemy_Infiltrator) {
            renderer.testShader.begin();
            renderer.testShader.setUniformMatrix("u_mvpMatrix",mEntityMatrix);
            renderer.testShader.setUniformf("v_color", 1.0f,1,1,1.0f);
            renderer.texture_enemy_infiltrator.bind(0);
            Vector2 pos = (Vector2) e.getObject(D.COORDS.ordinal());
            mEntityMatrix.set(renderer.mCamera.combined);
            mEntityMatrix.translate(pos.x, 0f, pos.y);
            mEntityMatrix.scale(0.2f, 0.2f, 0.2f);
            renderer.model_enemy_infiltrator.render(renderer.testShader,GL20.GL_TRIANGLES);
            renderer.testShader.end();
        }
    }
}

        String vertexShader = "uniform mat4 u_mvpMatrix;                   \n"
            + "attribute vec4 a_position;                  \n"
            + "attribute vec2 a_uv;                  \n"
            + "varying vec2 v_uv;                  \n"
            + "void main()                                 \n" + "{                                           \n"
            + " v_uv = vec2(a_uv.x,1.0-a_uv.y);\n"
            + "   gl_Position = u_mvpMatrix * a_position;  \n" + "}                            \n";
        String fragmentShader = "#ifdef GL_ES\n" + "precision mediump float;\n" + "#endif\n"
            + " uniform vec4 v_color;"
            + " uniform sampler2D tex;"
            + " varying vec2 v_uv;     \n"
            + "void main()                                  \n"
            + "{                                            \n"
            + "  gl_FragColor = v_color*texture2D(tex, v_uv);\n"
            + "}";
      testShader = new ShaderProgram(vertexShader, fragmentShader);

sentences:
How to flick gameObject using Touch? I've been searching for a solution for my problem for a while on the web, but i didn't find anything that work properly

What i want to do

I have a bouncing ball and I want to let the user flick it with his finger (using a swipe gesture or whatever).
The ball shouldn't start moving unless the player flick touch the ball. I don't want the ball to move if the player flicks anywhere on the screen, only if the flick touch the ball

What i've done so far :

I've tried to write a script which would detect the touch starting position and the touch end position, and check if the end position is the same as the ball position to make sure that the flick touch the ball. Then the script calculate the direction vector by substrating the start position from the end position.
After that i use the AddForce methode and give it the direction vector as a parameter.

Here's my code, (it's better than 1000 words ) :

using UnityEngine;
using System.Collections;

public class Movement : MonoBehaviour
{
    public Vector2 start;
    public Vector2 end;
    public Vector2 direction;
    public Vector2 ballPos;
    public float Flicktime;
    void Start(){
        }
    void Update(){
        ballPos = new Vector2(transform.position.x,transform.position.y);
        if (Input.touchCount > 0)
        {
            Touch t = Input.touches[0];
            if (t.phase == TouchPhase.Began)
            {
                start = Camera.main.ScreenToWorldPoint(new Vector3(t.position.x,t.position.y,0));
            }

            if (t.phase == TouchPhase.Ended || t.phase == TouchPhase.Canceled)
            {
                end = Camera.main.ScreenToWorldPoint(new Vector3(t.position.x,t.position.y,0));
                direction = end-start ;
                if(t.position == ballPos){

                    rigidbody2D.velocity = direction * 2 ;
                }
            }
        }
    }

}

What's the problem ?

The problem is that the code doesn't work.

When i launch the game in the Unity Remote 4 app in my android device and try to flick the ball it doesn't move, the inspector shows that the the scripte is calculating the start & end positions and the direction vector, but the ball doesn't move, it stays in the same position even when the flick touch the ball.

So what's the problem ? is there a better way to do it ?

Since the ball have a circle collider how to make it detect collision with the player swipe ?

Thank's and have a nice weekend !

sentences:
Unity ECS: How do I stop an entity from spawning twice? I am implementing a flight dynamics model using Unity's built-in ECS package, Entities, and I keep running into one particular issue where the aircraft I'm trying to spawn gets converted into an entity twice.
Essentially, I have a singleton Monobehaviour that handles setting up the aircraft entity from a GameObject Prefab. Here's the script:
public class GameManager : MonoBehaviour
{

    private BlobAssetStore blobAssetStore;

    public static GameManager main;

    public GameObject planePrefab;

    public float zBound = 0.0f;
    public float throttleMaxBound = 1.0f;
    public float alphaMaxBound = 20.0f;
    public float bankMaxBound = 20.0f;
    public float flapMaxBound = 40.0f;
    public float throttleMinBound = 0.0f;
    public float alphaMinBound = 0.0f;
    public float bankMinBound = -20.0f;
    public float flapMinBound = 0.0f;

    public State state;
    public Properties prop;

    Entity planeEntityPrefab;
    EntityManager manager;

    private void Awake()
    {
        if (main != null && main != this)
        {
            Destroy(gameObject);
            return;
        }

        main = this;

        manager = World.DefaultGameObjectInjectionWorld.EntityManager;

        blobAssetStore = new BlobAssetStore();

        GameObjectConversionSettings settings = GameObjectConversionSettings.FromWorld(World.DefaultGameObjectInjectionWorld, blobAssetStore);
        planeEntityPrefab = GameObjectConversionUtility.ConvertGameObjectHierarchy(planePrefab, settings);

        SpawnEntity();
    }

    private void OnDestroy()
    {
        blobAssetStore.Dispose();
    }

    void SpawnEntity()
    {
        Entity plane = manager.Instantiate(planeEntityPrefab);

        prop = new Properties(
            16.2f,
            10.9f,
            2.0f,
            0.0889f,        // slope of Cl-alpha curve
            0.178f,         // intercept of Cl-alpha curve
            -0.1f,          // post-stall slope of Cl-alpha curve
            3.2f,           // post-stall intercept of Cl-alpha curve
            16.0f,          // alpha when Cl=Clmax
            0.034f,         // parasite drag coefficient
            0.77f,          // induced drag efficiency coefficient
            1114.0f,
            119310.0f,
            40.0f,          // revolutions per second
            1.905f,
            1.83f,          //  propeller efficiency coefficient
            -1.32f          //  propeller efficiency coefficient
            );

        state = new State(
            0.0f,           // time
            0.0f,           // ODE results
            0.0f,
            0.0f,
            0.0f,
            0.0f,
            0.0f,
            0.0f,           // roll angle
            4.0f,           // pitch angle
            0.0f,           // throttle percentage
            0.0f            // flap deflection
            );

        float3 position = new float3(state.q1, state.q3, state.q5);

        manager.SetComponentData(plane, new Translation { Value = position });
    }

}

After a little bit of commenting here and there, I was able to determine that the following two lines are responsible for creating two separate entities, though the latter is the only one I'm capable of manipulating using the system. It's also worth mentioning that these two entities are virtually identical in the Entity Debugger, except for the fact that the first entity contains the "prefab" tag.
planeEntityPrefab = GameObjectConversionUtility.ConvertGameObjectHierarchy(planePrefab, settings);

and...
Entity plane = manager.Instantiate(planeEntityPrefab);

Is there a way to spawn this entity without both showing up in the debugger or is this unavoidable? If not, is there a way to remove the entity with the "prefab" tag from the world?
Thanks! :)

sentences:
Big game in Flash - how to create levels structure I'm building a game in Flash similar to the structure of Angry Birds or Cut the Rope (where there are a number of "rooms" and unique levels created within each "room").

The user gets through the game by playing through a room to unlock the next room. I have all the logic to unlock rooms and move between them. The problem I've come to is that I'm not sure how to build out the levels in each room. Let me provide an example.

Let's say I have 15 rooms. Each room has 10 levels, each with their own objects whose attributes change as the levels increase (ie. speed, position, collisions). There can be 2 to 5 objects out of a possible 10 that are randomly generated and placed on the stage, each level. This all adds up, with so many combinations and a total of 150 levels.

Ideally I would like to use a single class that controls the level creation for all rooms. Right now I have a Menu Class, one Class for each room to build the background, one LevelCreation Class, and one for the pause/lose menu. Does this seem like a feasible Class structure? Or should there be a LevelCreation Class for each room?

Switching between levels, re-initialize existing structure or create new one? is sort of helpful in reusing objects when advancing from level 3 to level 4, but I'm lost on how to set up the individual levels. So as a second part to the question: in my LevelCreation class(es), what is the best way to store the level attributes? In an array (or multiple arrays)?

I've also taken a look at How should I manage game levels in a flash games? but it seems to focus more on save/load data and not on how to build the levels. Structuring various game states and unique levels seems to be the closest I could get to an answer, but I guess I'm too much of a noob to quite understand what the answer to the question is saying.

I hope this all makes sense and I appreciate any help that I can get. Please let me know if I need to provide more details.

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:
Change transparency of image at runtime, LOVE2D I would like to know how to take a defined image (e.g. a tile) in the LOVE game engine and draw it with a transparency that may vary per-frame. Stencils seem to only work for completely hiding parts of an image; I need to make an entire tile translucent, and the degree of translucency needs to be able to vary during gameplay.

(purpose: I am messing around with a game idea that involves partial information during fog-of-war, represented by superimposing all tiles that might be somewhere based on what you currently know)

sentences:
What is the recommended way to output values to FBO targets? (OpenGL 3.3 + GLSL 330) I'll begin by apologizing for any dumb assumptions you might find in the code below since I'm still pretty much green when it comes to OpenGL programming.

I'm currently trying to implement deferred shading by using FBO's and their associated targets (textures in my case).

I have a simple (I think :P) geometry+fragment shader program and I'd like to write its Fragment Shader stage output to three different render targets (previously bound by a call to glDrawBuffers()), like so:

#version 330

in vec3 WorldPos0;
in vec2 TexCoord0;
in vec3 Normal0;
in vec3 Tangent0;

layout(location = 0) out vec3 WorldPos;
layout(location = 1) out vec3 Diffuse;
layout(location = 2) out vec3 Normal;

uniform sampler2D gColorMap;
uniform sampler2D gNormalMap;

vec3 CalcBumpedNormal() {

    vec3 Normal = normalize(Normal0);
    vec3 Tangent = normalize(Tangent0);

    Tangent = normalize(Tangent - dot(Tangent, Normal) * Normal);
    vec3 Bitangent = cross(Tangent, Normal);
    vec3 BumpMapNormal = texture(gNormalMap, TexCoord0).xyz;

    BumpMapNormal = 2 * BumpMapNormal - vec3(1.0, 1.0, -1.0);

    vec3 NewNormal;
    mat3 TBN = mat3(Tangent, Bitangent, Normal);
    NewNormal = TBN * BumpMapNormal;
    NewNormal = normalize(NewNormal);

    return NewNormal;
}

void main() {
    WorldPos = WorldPos0;
    Diffuse = texture(gColorMap, TexCoord0).xyz;
    Normal = CalcBumpedNormal();
}

If my render target textures are configured as:

RT1:(GL_RGB32F, GL_RGB, GL_FLOAT, GL_TEXTURE0, GL_COLOR_ATTACHMENT0)
RT2:(GL_RGB32F, GL_RGB, GL_FLOAT, GL_TEXTURE1, GL_COLOR_ATTACHMENT1)
RT3:(GL_RGB32F, GL_RGB, GL_FLOAT, GL_TEXTURE2, GL_COLOR_ATTACHMENT2)

And assuming that each texture has an internal format capable of contaning the incoming data, will the fragment shader write the corresponding values to the expected texture targets?

On a related note, do the textures need to be bound to the OpenGL context when they are Multiple Render Targets?

From some Googling, I think there are two other ways to output to MRTs:

1: Output each component to gl_FragData[n]. Some forum posts say this method is deprecated. However, looking at the latest OpenGL 3.3 and 4.0 specifications at opengl.org, the core profiles still mention this approach.

2: Use a typed output array variable for the expected type. In this case, I think it would be something like this:

out vec3 [3] output;

void main() {
    output[0] = WorldPos0;
    output[1] = texture(gColorMap, TexCoord0).xyz;
    output[2] = CalcBumpedNormal();
}

So which is then the recommended approach? Is there a recommended approach at all if I plan to code on top of OpenGL 3.3?

Thanks for your time and help!

sentences:
OpenGL 4 several glUseProgram overhead I'm developing a little 2D game using OpenGL 4.x and I've also coded a very simple light system which does not take care of shadows.
The main concept behind this light system is the frambuffer multiplicative blending. I basically have two framebuffers, one for the normal scene render and the other one for ambient light and the scene light sources. Then, I blend those two framebuffers and I get my final result (which is pretty good, to be honest).

In this model I have 3 different shader programs:

One for rendering the normal scene (with texturing and other normal features)
One for rendering lights, which compute light halos and other light effects
One for blending the two framebuffers together

Now, in my main application loop I have to switch between those three shader programs in order to complete a full rendering cycle. I'm also planning to add more shaders to render different light effects and particles.
At the moment I'm in the design phase of my game, so I'm not able to test out the performance of this approach and I have no previous experience with it.
And for the same reason I'd like to start with the best approach possibile for this situation.

So my question is: considering your experience, is switching between several shader programs at each frame something good or is it a bad behaviour in a 2D enviroment ? Is using fewer shader programs but with more if statement and more unused uniform variables a better solution?

sentences:
Calculating radius during collision This picture is from one of Dirk Gregorius' presentations:

The original diagram has only one contact point (the red one). The r_1 and r_2 vectors are required to produce rotation while solving the contact constraints. I agree that the r_2 vector is correct, but I think that the r_1 vector should point towards the blue point (which I've added myself)
It's not difficult to retrieve the blue point (just add the minimum translation vector to the red point), but I've seen contrasting depictions of what points the contact manifold consists of.
Excluding the parallel edge-edge case, should the contact manifold consist of two points (the deepest points of each shape) or just one?

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:
Suitability of ground fog using layered alpha quads? A layered approach would use a series of massive alpha-textured quads arranged parallel to the ground, intersecting all intervening terrain geometry, to provide the illusion of ground fog quite effectively from high up, looking down, and somewhat less effectively when inside the fog and looking toward the horizon (see image below).

Alternatively, a primarily shader-based approach would instead calculate density as function of view distance into the ground fog substrate, and output the fragment value based on that.

Without having to performance-test each approach myself, I would like first to hear others' experiences (not speculation!) on what sort of performance impact the layered alpha texture approach is likely to have. I ask specifically due to the oft-cited impacts of overdraw (not sure how fill-rate bound your average desktop system is). A list of games using this approach, particularly older games, would be immensely useful: if this was viable on pre DX9/OpenGL2 hardware, it is likely to work fine for me.

One big question is in regards to this sort of effect:

(Image credit goes to Lume of lume.com)

Notice how the vertical fog gradation is continuous / smooth. OTOH, using textured quad layers, I can only assume that layers would be mighty obvious when walking through them  -- the more sparse they were, the more obvious this would be. This is in contrast to where fog planes are aligned to face the player every frame, where this coarseness would be much less obvious.

sentences:
Working together on a game as a project over the internet I'm looking for someone who would be willing to work on a project that would potentially become something similar to the game evony/tribal wars, but the project won't be primarily for actually making the game, rather than learning from starting to make the game work.

What website would I go about finding someone willing to help me with this and work together on a little project, no money involved unless things started really progressing, in that case if we actually do complete something worth money, then there will definitely be an even split of the income. I'm not what you would call great at programming, I have learned everything from teaching myself and have never taken a college level (or highschool) programming class, but I'm not bad at it or anything. And if anyone reading this is interesting, leave a comment.

sentences: What's the reason behind collision-boxes? I was surprised that some games use extra models called collision-boxes for collision. What is the benefit of doing so? Can't we calculate collisions between the vertices of any game model? Is this possible? Are there performance reasons?

sentences:
Objects aren't rotating in sync This is a follow-up question to How to reapply force applied to one object to another object

  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: This is the new code which only fails when multiple collisions happen at once

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

[RequireComponent(typeof(Rigidbody))]
public class EEScript : MonoBehaviour
{
    public List<EEScript> activeObjects;
    public new Rigidbody rigidbody;
    public Vector3 lastPosition;
    // Start is called before the first frame update
    void Start()
    {
        rigidbody = gameObject.GetComponent<Rigidbody>();
    }

    // Update is called once per frame
    void Update()
    {
        lastPosition = transform.position;
    }

    private void OnCollisionEnter(Collision collision)
    {
        foreach (EEScript entangled in activeObjects)
        {
            if (entangled == this) continue;
            Rigidbody rb = entangled.rigidbody;
            if (rb is null) continue;
            rb.velocity = rigidbody.velocity;
            rb.angularVelocity = rigidbody.angularVelocity;
            entangled.transform.position = entangled.lastPosition + transform.position - lastPosition;
        }
    }
}

sentences:
How can I export Blender game logic for controlling actor actions? How does one export game logic ("Sensors") that Unity references for controlling actions from Blender's "Action Editor" or "Dope Sheet?"

I have a Blender model that has game logic sensors that respond to complex input. These actions are defined in Blender's "Action Editor" or "Dope Sheet". What is the easiest way to export the game logic so that I have access to its input that causes the actions? There are many exporters that focus on the mesh/skeleton, is there a solution for exporting these sensors?

Here is a list with screen shots of Blender's sensors to give a better idea of what I want exported.

For each character made, I want their sensors exported to a file that is easy to read (some kind of XML). This way I don't need to hard-code character behavior or action triggers/sensors. Each modeled Blender actor can have its sensors programmed in Blender with its nice GUI and later exported to my game engine.

This question has been asked before and it seems the asker ended up scripting a very limited exporter (for one variable) but didn't fully explain his approach:
http://www.blender.org/forum/viewtopic.php?t=18803&sid=22ac4b2d3993949b1e71e9568b0d6834

Again, this was asked with no apparent solution:
http://www.blender.org/forum/viewtopic.php?t=18803&sid=22ac4b2d3993949b1e71e9568b0d6834

Looks like someone has already tried using Collada but this was only for exporting actions (not sensors that trigger them):
Blender multiple animations and Collada export

Someone here wrote their own exporter. I don't think they are exporting sensors though:
exporting bind and keyframe bone poses from blender to use in OpenGL

Any ideas?

sentences:
How to model / where to store relational data between classes I'm trying to figure out the best design here, and I can see multiple approaches, but none that seems "right."

There are three relevant classes here: Base, TradingPost, and Resource. Each Base has a TradingPost which can offer various Resources depending on the Base's tech level.

Where is the right place to store the minimum tech level a base must possess to offer any given resource? A database seems like overkill. Putting it in each subclass of Resource seems wrong--that's not an intrinsic property of the Resource. Do I have a mediating class, and if so, how does it work? It's important that I not be duplicating code; that I have one place where I set the required tech level for a given item. Essentially, where does this data belong?

P.S. Feel free to change the title; I struggled to come up with one that fits.

sentences:
Help understanding radar sweep effect in shader code Several days ago I asked about this question: How to construct a propeller clock in Unity? But I don't understand how the answer works.
I have 0 knowledge about shaders, so I picked up a tutorial to understand the math functions, but that still didn't helping much in understanding the code.
I cut off part of the code to check the effect on an image, and I want to understand why the code has this effect.

What is the range of values for the parameters i.uv.y or i.uv.x?

Next I discarded part of the code, simplifying the fragment shader to just:
fixed4 frag (v2f i) : SV_Target
{
    // Simulate the strip of LEDs spinning around very fast.
    float headAngle = _Time.y ;

    // Compute the angle of the pixel we're rendering.
    float angle = atan2(i.uv.y, i.uv.x);

    float difference = frac( angle / (2.0f * 3.141592653589f));

    return difference;
}

And I rendered this on a plane:

According to the documentation, atan2 gives an angle value in between -pi and pi. So the range of angle / (2.0f * 3.141592653589f)) is in between -0.5 and 0.5.
I tested with frac(0.3), frac(0.25), which is the same as return 0.3 or return 0.25 since frac preserves only the decimal number. But why I couldn't generate the same gradient image as the one above? Instead, the plane is all one shade of grey, no matter what number I use.

Next I tried the code float difference = frac(headAngle) and got an image which is constantly varying between dark and bright images like these:

Putting this together:

From the 1st picture, I have an image with a gradient that's dark in the 1st quadrant and bright in the 4th quadrant.

From the 2nd & 3rd pictures, I have all four quadrants at the same brightness, constantly varying between them.

What I don't understand is how the sum of these two pieces of code works. If I combine them like this:
float difference = frac(headAngle + angle / (2.0f * 3.141592653589f));

Shouldn't I get a gradient that stays in one place, like the 1st image, but just changes in brightness like in images 2 & 3?
Instead I get a A brightness gradient that is sweeping in a circle around the plane:

...and I don't understand why.

sentences:
How to give the effect on the obstacle? I want to the obstacle Scale-In and Scale-Out using Dotween PlugIn? means some effect??

See this link: https://www.youtube.com/watch?v=_Tq4t0gx49g&t=569s

Image:

I want to give a effect on the obstacle?

script:

Obstacle.cs

void Update()
{
        goTopToDown();
}

void goTopToDown()
{

  foreach (Transform item in GetComponentsInChildren<Transform>())
  {
      if (item.tag == "obstacleobject") //some obtsacle slow
      {
          item.localPosition += Vector3.down * speed * Time.deltaTime;                   //move top to down object
      }
      if (item.tag == "movefastobject") //some obstacle fast
      {
           item.localPosition += Vector3.down * movefastobjectspeed * Time.deltaTime;     //move fast object
       }
  }
```

sentences:
LibGdx: How do I combine 2 GestureListener objects from 2 seperate classes into 1 GestureDetector I'm trying to make 2 separate classes, 1 a VirtualJoystick class and 1 a VirtualButton class. I want to implement a GestureListener class in each, it just seems like good code to do so, but when I go to my main program, how do I add both GestureListener classes?

Here's some pseudocode that I'm thinking of:

VirtualJoystick vjs = new VirtualJoystick(x, y, width, height, bgImage, fgImage);
VirtualButton vb    = new VirtualButton(x,  y,  width, height, upImage, dnImage);

GestureDetector joyGestureDetector = new GestureDetector( vjs.getDetector() );
GestureDetector btnGestureDetector = new GestureDetector(  vb.getDetector() );

// Here's what I don't know how to do
GestureDetector combinedGestureDetector = ?

Gdx.input.setInputProcessor(combinedGestureDetector);

but as you can see, I'm stuck on how to combine the two, if there's a better way let me know, I'm just trying to get my code to "think through well" and be atomically contained in classes.

sentences:
How to visualize objects in darkness Below I've an image of my current scene, and two images of what I want to achieve. Now the question is, how can I visualize objects in low light, as you can see the current scene isn't that attractive however the pic from kentucky route zero is soul capturing, so what should I do? Any type of guidance will be appreciated c:

Current Scene:

Required Output:

sentences: I installed Linux Build Support, but I need an archive to build, how can I get this? I`m building a game for Mac, Windows and Linux, I builded the Windows and Mac game, but in Linux, says that need a x86_64 archive, like the image shows, what do I do?

sentences:
Entity Component System: Store pointer in Component to Entity I was wondering if it is a bad idea to store a pointer in every Component to the Entity which owns the Component.

E.g. I have a Component "NPC". Each entity which owns this Component also must have a Position and Sprite Component. Sometimes i get a list of NPC Components from one of my Systems, but I also need the coresponding Position and Sprite Components. I can retrieve the entity, but it's quite some code I have to type and it is more expensive than just following the pointer.

So would it be a bad idea to store a pointer to the Entity in a Component?

sentences:
Do 2D games have a future? I'm currently working on a 2D soft-body physics engine (since none exist right now -_-), but I'm worried that there's no point to spending what will most likely be years on it.

Although I love working on it, I doubt such an engine would get any income considering anyone willing to pay money for the library will likely to be working in 3D.

Do 2D games have any sort of future in the game industry?
Should I just drop my engine and find something meaningful to work on?

Bonus:

I've been trying to think of a unique way to implement my physics engine in a 2d game by looking at games that are multiple dimensions, but still in 2d perspective like Paper Mario. Any ideas?

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:
3d Picking under reticle i'm currently trying to work out some 3d picking code that I started years ago, but then lost interested the assignment was completed (this part wasn't actually part of the assignment).

I am not using the mouse coords for picking, i'm just using the position in 3d space and a ray directly out from there.  A small hitch though is that I want to use a cone and not a ray.

Here are the variables i'm using:

float iReticleSlope = 95/3000; //inverse reticle slope
float baseReticle = 1; //radius of the reticle at z = 0
float maxRange = 3000; //max range to target
Quaternion orientation; //the cameras orientation
Vector3d position; //the cameras position

Then I loop through each object in the world:

Vector3d transformed; //object position after transformations
float d, r; //holder variables

for(i = 0; i < objects.length; i++) {

    transformed = position - objects[i].position; //transform the position relative to camera
    orientation.multiply(transformed); //orient the object relative to the camera

    if(transformed.z < 0) {

        d = sqrt(transformed[0] * transformed[0] + transformed[1] * transformed[1]);
        r = -transformed[2] * iReticleSlope + objects[i].radius;

        if(d < r && -transformed[2] - objects[i].radius <= maxRange) {

            //the object is under the reticle

        } else {

            //the object is not under the reticle

        }

    } else {
    //the object is not under the reticle
    }
}

Now this all works fine and dandy until the window ratio doesn't match the resolution ratio.  Is there any simple way to account for that

sentences:
Texture not working on object I have a project that I'm having a bit of trouble with. Let me try and explain. In short, I'm trying to apply a texture to an object, but instead it is a solid color.

I built a building in "Autodesk 123d design", and exported it as stl. Then I used an online converter to convert it to obj, then added that to the unity scene. I created a material with a texture and tried to apply it to the object, but it was a solid color.

I think the UVs on the object might be messed up. I tried some things in blender, but had no luck. Any ideas on how I can fix this?

Edit:

Here is the 3D model I'm working with: http://www.123dapp.com/123D_Design/Conisbrough-Castle-Keep/4578568

sentences:
How to blend motions with Mecanim I'm struggling with Mecanim.

My concern is to blend straight/turning animations with strafe animation for a humanoid character.

I downloaded a SampleAsset from unity and took Ethan character as example. The animator uses a blendtree which naturally blend idle/walking/running animations with a smooth turning left/right animations. In this case the Ethan character cannot strafe.

I'm trying to understand how to blend strafe movement with it's actual straight/turning blending motion.

Was I somewhat clear?

sentences:
How to find the window size in XNA I just wanted to know if there was a way to find out the size of the window in XNA. I don't want to set it to a specific size; I would like to know what dimensions it currently displays as automatically. Is there a way to find this information out?

I realize I probably should have found this information out (or set it myself manually) before working on the game, but I'm a novice and am now hoping to work within the dimensions I have already become invested in. Thanks!

sentences:
How to sync client and server at the first frame I'm making a game where an authoritative server sends information to all clients about states and positions for objects in a 3d world. The player can control his character by clicking on the screen to set a destination for the character, much like in the Diablo series.

I've read most information I can find online about interpolation, reconciliation,  and general networking architecture (Valve's for instance). I think I understand everything but one thing seems to be missing in every article I read. Let say we have an interpolation delay of 100ms, server tickrate=50ms, latency=200ms; How do I know when 100ms has past on the client? If the server sends the first update on t=0, can I assume it arrives at t=200, therefore assuming that all packets takes the same amount of time to reach the client? What if the first packet arrives a little quick, for instance at t=150. I would then be starting the client with t=150 and at t=250 it will think it has past 100ms since its connect to the server when it in fact only 50ms has past.

Hopefully the above paragraph is understandable. The summarized question would be: How do I know at what tick to start simulating the client?

EDIT: This is how I ended up doing it: The client keeps a clock (approximately) in sync with the server. The client then simulates the world at

simulationTime = syncedTime - avg(RTT)/2 - interpolationTime

The round-trip time can fluctuate so therefore I average it out over time. By only keeping the most recent values when calculating the average I hope to adapt to more permanent changes in latency. It's still to early to draw any conclusion. I'm currently simulating bad network connections, but it's looking good so far.

Anyone see any possible problems?

sentences:
Rows of coins in libgdx? I have my coin image in the assetLoader class, then I import it into gameWorld.

My question is, how can I draw() rows of coins without having to write out 15 different coins?

i.e., coin1, coin2, coinRect1, coinRect2, coinX1, coinX2, etc.
Wouldn't it be more efficient/easier on memory&performance to create a 'coin' class and use a loop somehow?

It's a vertical scroller so the coins should be lined up vertically and disappear individually as the playerRect intersects the coinRect.

The coins should not intersect the obstacles and the randomly generated number of coins in any row (e.g. a row of 6 coins all lined up) should be between 1 and 10.
If I used a loop (somehow...) the integer i would be the randomly generated number of coins in any row, so that 1<=i<=10, and if coin.position intersected obstacleRect then it i would become i-1 so that the coins stopped right before the obstacle.

sentences:
Unity can't build AssetBundle for iOS From http://docs.unity3d.com/ScriptReference/BuildPipeline.BuildAssetBundle.html, I am using the sample code

using UnityEngine;
using UnityEditor;
public class ExportAssetBundles {
    [MenuItem("Assets/Build AssetBundle From Selection - Track dependencies")]
    static void ExportResource () {
        // Bring up save panel
        string path = EditorUtility.SaveFilePanel ("Save Resource", "", "New Resource", "unity3d");
        if (path.Length != 0) {
            // Build the resource file from the active selection.
            Object[] selection = Selection.GetFiltered(typeof(Object), SelectionMode.DeepAssets);
            BuildPipeline.BuildAssetBundle(Selection.activeObject, selection, path,
                                           BuildAssetBundleOptions.CollectDependencies | BuildAssetBundleOptions.CompleteAssets);
            Selection.objects = selection;
        }
    }
    [MenuItem("Assets/Build AssetBundle From Selection - No dependency tracking")]
    static void ExportResourceNoTrack () {
        // Bring up save panel
        string path = EditorUtility.SaveFilePanel ("Save Resource", "", "New Resource", "unity3d");
        if (path.Length != 0) {
            // Build the resource file from the active selection.
            BuildPipeline.BuildAssetBundle(Selection.activeObject, Selection.objects, path);
        }
    }
}

To build an AssetBundle. However, whenever I run this on a prefab, I noticed that Unity switches the platform to WebPlayer and THEN builds the bundle. But I need the AssetBundle to be built for iOS and Android - I don't need WebPlayer bundles.

Why does it keep switching to WebPlayer platform whenever I run this? How can I build for iOS and Android?

My prefab is just an object with a Sprite Renderer.

sentences:
Gradual rotation of an object in Java I'm using Java to learn some movement algorithm. I would like to implement the "wandering" algorithm, but in order to do it, i should understand how to rotate an Object gradually.

Actually, my Player changes its orientation instantly (and too many times!) and it is not so good.

This is my code:

logic update

public void update(float delta) {
    // WANDERING

    // orientation as a vector
    float orientation_x = (float)Math.sin(orientation);
    float orientation_y = (float)Math.cos(orientation);

    // update velocity
    velocity_x = maxSpeed * orientation_x;
    velocity_y = maxSpeed * orientation_y;

    int max = 1;
    int min = 0;
    int random1 = (rand.nextInt((max - min) + 1) + min);
    int random2 = (rand.nextInt((max - min) + 1) + min);
    orientation = (random1 - random2) * maxRotation; // random binomial (i don't know which value i have to assign to maxRotation
    System.out.println(orientation);

    x += (velocity_x * delta);
    if(x >= GamePanel.PWIDTH) {
        x = 0.0f;
    }
    y += (velocity_y * delta);
    if(y >= GamePanel.PHEIGHT) {
        y = 0.0f;
    }
}

draw

public void draw(Graphics dbg) {
    // draws the player
    Graphics2D g2d = (Graphics2D)dbg;
    g2d.setColor(Color.RED);
    AffineTransform old = g2d.getTransform();
    g2d.rotate(orientation, x + SIZE/2, y + SIZE/2);
    g2d.fillRect((int)x, (int)y, SIZE, SIZE);
    g2d.setTransform(old);
}

With this code, the behavior that i get is horrible. The Player changes his direction too many times and instantly.

This is the pseudocode of the algorithm:

# Holds the static data for the character
character

# Holds the maximum speed the character can travel
maxSpeed

# Holds the maximum rotation speed we’d like, probably
# should be smaller than the maximum possible, to allow
# a leisurely change in direction
maxRotation

def getSteering():

# Create the structure for output
steering = new KinematicSteeringOutput()

# Get velocity from the vector form of the orientation
steering.velocity = maxSpeed *
character.orientation.asVector()

# Change our orientation randomly
steering.rotation = randomBinomial() * maxRotation

# Output the steering
return steering

sentences: Rendering a black and white image in OpenGL 1.1 Is there is any way that I can simple disable the color in OpenGL 1.1? Or can I "grey out" textures in LWJGL?

sentences:
Vulkan dynamic UBO weird numbers Why these numbers??
I have created a dynamic ubo and two objects, one for view and proj and the other for model.
Here I update the objects:
Render::UniformBufferObject ubo{};
        Render::UniformBufferObject2 ubo2{};

        ubo2.model = &model_transform.GetWorldMatrix();

        ubo.view =  &EditorCamera_transform.GetWorldMatrix().Inverse();

        ubo.proj = &current_camera->GetProjectionMatrix();

        // map memory without a staging buffer
        void* data;
        auto memory = uniform_buffer->get_ubo_memory();
        Render::VulkanMemoryAllocator::get_instance()->map_buffer_allocation(memory[current_image], &data);
        memcpy(data, &ubo, sizeof(ubo));
        memcpy(data, &ubo2, sizeof(ubo2));
        Render::VulkanMemoryAllocator::get_instance()->unmap_buffer_allocation(memory[current_image]);

Here binding and draw command:
std::array<uint32_t, 2> dynamicOffsets =
            { i * static_cast<uint32_t>(Render::StandardUniformBuffer::required_alignment(sizeof(Maths::Matrix4)*2)),
              i* static_cast<uint32_t>(Render::StandardUniformBuffer::required_alignment(sizeof(Maths::Matrix4)))
            };

            cmd.bindDescriptorSets(
                vk::PipelineBindPoint::eGraphics,
                *pipeline->get_pipeline_layout(),
                0,
                2,
                descriptor_set->get_descriptor_sets()->data(),
                2,
                dynamicOffsets.data());

            cmd.drawIndexed(static_cast<uint32_t>(index_buffer->get_primative_indices_size()), 1, 0, 0, 0);

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:
Should the frame rate be consistent or is it normal for it to jump around? As I commented on a post, I started wondering if it was correct or not (the comment, not the answer). And I'd like to straighten that out.

Although not needed as info, here's the link to the question: Scene management for 3D editor

My comment: "Wouldn't mind that much about the framerate, as long as it stays above 60. you can get away with 30 even."

Still I think if the frame rate is over 30, the real time rendering stays as a good animation. But sometimes I read that people restrict the render() to 60fps or 30fps for performance. This could/would remove all unneccecary calculation wich we can't see anyway. Although true, they (sometimes) claim it is an optimization.

When a scene will render more objects, the fps will drop. Think that is normal.

So what's the deal with fps, should it stay more or less the same even when you turn the camera 90 or 180 degrees, or only when keeping (almost) the same view?

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:
Is this possible in cocos2dx 3.0? I have a number of five images (sprite1.png, sprite2.png, sprite3.png, sprite4.png, sprite5.png), these all I want to add as a sprite...

int rndSprtNum = (arc4random() % 5) + 1;
for(int i = 0; i < 5; i++)
{
    int rndSprtNum = (arc4random() % 5) + 1;
    CCSprite *first = CCSprite::create("sprite%d.png",rndSprtNum);

    rndSize = rndSize+(arc4random() % 20) + 15;
    int  width = rndSize + 125*(size.width/768);
    rndSize = rndSize + 90;
    first->setPosition(ccp(width,512 * (size.height/1024)));

    this->addChild(first,0);
}

Is this possible in cocos2dx v3.0?

sentences:
How to open .xml files in Cryengine 5.6.2? I am new at this engine and I am trying to understad its stuff before developing a game(I have good prior experience with unity and UE4) and this got me lots of headaches trying to understand it. My main problem is opening a .xml file, first of all I created a new project using third person shooter template and I started to study C# code and how character was animated using .xml files.

I know that cryengine V uses a thing called flow graph that makes the logic of an object by displaying a graph reading xml text.

What I have tried:

Clicking 1000 billion times the .xml file.

Trying to open it by importing into the flow chart thing.

How do I open this .xml file in a flow graph? There is poor documentation about this in docs.cryengine and makes hard for us to understand the logic.

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:
Standard decibel range for sound effects/music? Is there a standard for a decibel range of sound effects and music in games?

I've been getting sound effects from various sources and some are much louder than others so I've had to adjust them with Audacity to be closer in volume.

Of course the user can just adjust their volume up or down if it's too loud/quiet but I'd prefer that my game's audio be in the same range as other games

(Note: specifically I'm asking for iOS/mobile games but this could apply to other systems)

sentences:
How do I run an APK in a device from the Unity IDE without rebuilding the binary? I know that the button Build creates the APK in my disk.

And the button Build and Run creates it and sends it to a real device if connected via USB.

Question:

Is there any way to "Run" from the Unity IDE an APK in a physical device without having to re-build it (provided you properly built it a few minutes ago, for example?)

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: 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 can I implement A* so that it accounts for the size of the actor? I'm trying to make a little A* implementation using polygon verticies as nodes instead of grids and I ran into the problem of figuring out what paths are wide enough to accommodate the actor moving through them.

Lets say the actor was 10x10 and the space between two verticies was only 5 units wide, the actor shouldn't be able to fit into that space but with the regular A* algorithm it would. How can I prevent this?

sentences:
GLSL to Cg fragment shader I have found very useful resource on the Swiftless website on OpenGL.

Unfortunately, I cannot manage to adapt a GLSL fragment shader to my project, which uses Cg. Here it is:

uniform sampler2D color_texture;
uniform sampler2D normal_texture;

void main() {

// Extract the normal from the normal map
vec3 normal = normalize(texture2D(normal_texture, gl_TexCoord[0].st).rgb * 2.0 - 1.0);

// Determine where the light is positioned (this can be set however you like)
vec3 light_pos = normalize(vec3(1.0, 1.0, 1.5));

// Calculate the lighting diffuse value
float diffuse = max(dot(normal, light_pos), 0.0);

vec3 color = diffuse * texture2D(color_texture, gl_TexCoord[0].st).rgb;

// Set the output color of our current pixel
gl_FragColor = vec4(color, 1.0);
}

I have tried something:

struct fsOutput {
    vec4 color : COLOR;
};

uniform sampler2D detailTexture : TEXUNIT0;
uniform sampler2D bumpTexture : TEXUNIT1;

fsOutput FS_Main(float2 detailCoords : TEXCOORD0,
            float2 bumpCoords: TEXCOORD1)
{

    fsOutput fragm;

    float4 anorm = tex2D(bumpTexture, bumpCoords);
    vec3 normal = normalize(anorm.rgb * 2.0f - 1.0f);
    vec3 light_pos = normalize(vec3(1.0f, 1.0f, 1.5f));
    float diffuse = max(dot(normal, light_pos), 0.0);
    vec3 color = diffuse * texture2D(detailTexture, detailCoords).rgb;
    fragm.color = vec4(color, 1.0f);
    return fragm;
}

But it doesn't work. To debug, I have a function that catches Cg errors, and my program breaks at this point. I have identified the two texture IDs in the main program.
Can you suggest any improvement for this Cg shader?

sentences:
Order of render with transparency opengl I tried to render using different render configurations (GL_BLEND_FUNC()) but I couldn't get the back object to render in certain angles. The first screenshot here shows one angle where the back object is not visible through the front one. In th second screenshot, I looked at the blocks from 180 degrees.

Is there a way I could render them through? Or would I have to implement a sorting algorithm?

sentences:
how does server communication work in a flash game with a php backend I am trying to create a browser game using actionscript/flash. Currently, I'm trying to understand how I would go about creating a back-end which interfaced with my MySQL database.

As far as I understand, If I create a php file on a webserver called test.php and then navigate to a webpage hosted on the server eg. www.example.com/test, the php script will run and display the result in my browser.

This would use http. Is this how communication between client and server usually works in a flash game? for example, if the game needed to query the db. Would actionscript have to essentially invoke the url of the php script that would execute the query? it could then parse the data and use it.

If this is the case, then is JSON considered a good way to transfer data over http?

sentences:
Are GPU drivers hand optimized for specific games using low-level APIs? The GPU drivers often have slightly different behavior depending on game or program, which is using them. It optimizes performance, bypasses bugs and improves overall experience in popular games, especially demanding AAA ones. There was even a question on this stack about it a few years ago.

This strategy seems reasonable in the world of high level GPU APIs, like Direct3D up to 11 and OpenGL. These standards are very complicated, drivers don't comply with them perfectly and much of computation burden is pushed to the driver.

But what about the new, low level APIs like Direct3D 12, Vulkan and Metal? The standards are simpler for drivers to implement correctly and less computations are hidden inside the driver, they are in the hands of game authors. There seems to be just much less to do on driver side about improving game experience.

Are GPU drivers hand optimized for specific applications using low level APIs?

sentences: UE4 Procedural Planet Design I am building a game that requires a full planet but it would be too complicated to create it as one mesh, so I decided that I will use procedural generation to create the (partially) editable landscape, rocks, trees, caves, etc. I was wondering on what server-side a procedural planet is generated? For example, is it generated when the player first plays the game, and is it the same for every player? Or is it completely rebuilt each time the player enters the game? If the answer is the latter, is there any way to somehow save the planet and make it into one map for everybody using the game and not change if they reload the game? If possible, I would strongly prefer any answers in Blueprints rather than C++. FYI: I haven't started building the game yet and am still researching my options for how to create the world. I didn't find much about saving the character's location anywhere so far.

sentences:
In AS3, is it necessary to remove the children from a parent who is also being removed? My point is this:

addChild(parentMC);
parentMC.addChild(child1);
parentMC.addChild(child2);

If I want to then remove parentMC from the current container, is it necessary to also remove child1 and child2 from parentMC in order to properly clean-up? Or is that handled automatically through removing parentMC?

sentences:
UE4. How to create a reference to the physical material asset (which I create in editor) in C++ Oftenly, when we want to assign asset to the particular component in C++ we write code like that:

.h

UPROPERTY(BlueprintReadWrite)
UStaticMeshComponent* Body = nullptr;

.cpp

Body = CreateDefaultSubobject<UStaticMeshComponent>("Mesh Component");
// find mesh asset
auto MeshForBody = ConstructorHelpers::FObjectFinder<UStaticMesh>(TEXT
                        ("StaticMesh'/Game/StarterContent/Shapes/Shape_Sphere.Shape_Sphere'"));
if (MeshForBody.Object != nullptr)
{// if asset is finded -> set to the component
    Body->SetStaticMesh(MeshForBody.Object);
}

Question: how can I set the PhysicalMaterial in C++ through the reference to the asset in editor? Is it possible?

.h
    UPROPERTY(EditDefaultsOnly)
    UPhysicalMaterial* MyPhysicalMaterial = nullptr;

.cpp

    ???

Find this, but still waiting maybe the best solution without casting exists:

auto PhysicalMaterialAsset = ConstructorHelpers::FObjectFinder<UObject>(TEXT(
         "PhysicalMaterial'/Game/PhysicsMaterials/MyPhysicsMaterial.MyPhysicsMaterial'"));

if (PhysicalMaterialAsset.Object)
{
    Sphere->BodyInstance.SetPhysMaterialOverride((UPhysicalMaterial*)PhysicalMaterialAsset.Object);
}

THNX for any tips in advance ;)

sentences:
How can I make Maya or Blender model work with mecanim? I'm working on a simple game project, where I need a stick figure. Due to being stubborn and the desire to learn a new skill, I want to make the stick figure myself! I have followed several tutorials in both Maya and blender. For Maya, I'm using the student version. I have my stick figure rigged within Maya and blender, both utilizing their respective bone tools. I can manipulate their limbs well, enough. However, I can't seem to get the models to work with Mecanim.

I have the Kinect adapter for the PC and would like to be able to use it to create the animations utilizing a tool such as the Kinect v2 mocap animator.

How I can get my model to work with Kinect based mocap?

sentences:
Correct primitive to start with for modified cone shape I am very new to Maya and trying to make a Nikon F camera from reference images.

I can't quite wrap my head around how I would make the shape on top of the camera because it is essentially a square cone but has some modifications to the base and front slanted side that I can't seem to achieve with a square pyramid, I believe because of the rules of quad/tri geometries

Is this possible by starting with a square cone? If so how do I apply the relevant loop cuts horizontally and vertically?
Alternatively if is best to construct with another primitive could someone please detail which one?

sentences:
How to find or compute or look for overall/max RPM by simply checking for rotation? I find it hard to determine the wheel RPM since I'm only making a simple 2D game of rotating object via Z-axis. I wanna try this solution but I got no change since I'm trying to find the RPM from a game object that has a rigid body 2D and a circle collider. I decided to think of something more simple but alternate solution. I'm a bit good at math but not much. Took around to calculate but no luck yet. I want to know possibilities of checking its rotation from transform properties, figuring out yet about 6 degrees per second equivalent to 1 RPM as said from the link. I used the method transform.Rotate() for rotation speed. Also, when the rotation value reaches beyond 360, clockwise or counter-clockwise, sometimes it goes back either 0 or a negative value and I have to maintain total degree so that I can compute for the overall RPM. Please help me.

Re-direct from my original question: http://answers.unity3d.com/questions/1123755/how-to-find-or-compute-or-look-for-overallmax-rpm.html

sentences: 2D character with baseball bat implementation in Unity I'm making a 2D baseball game in Unity and I'd like to know how the player and the bat should be connected. For instance, if I use single sprite for both the player and the bat, then how should the collision between the bat and the ball be detected?

sentences:
Different types of smooth object movement In a game I have a specific object and two positions the object will move from and to.
I already have the function for calculating current position in specific time.

It works like this:

Inputting 0 will move the object to Position 1.

Inputting 1 will move the object to Position 2.

Inputting 0.5 will move the object in the middle of the two positions.

etc...

(In the examples below, time is varying from 0 to 1)
When I want to start the object slowly and stop it when it is moving fast, I use:

MoveObject(sin(time * 90))

When I want to start the object fast and stop it as it is getting slower, I use:

MoveObject(1 - cos(time * 90))

Without the effects, it's:

MoveObject(time)

How do I make the object start moving slowly, move fast in the center of two positions and then get slower while reaching the second position?

sentences:
Animation timeline organization for Unity 5 I create stuff for AssetStore and use 3ds max and Unity 5.

Can someone tell me how I need to work with timeline?

When I create animation for several objects, I need to animate them one by one? (Example: from Frame 0 to Frame 60 object 01 rotates 360 degrees, then from Frame 60 to Frame 120 object 02 rotates 360 degrees) OR I need to animate every one object in same time. (Every one rotates from Frame 0 to Frame 60).

I know that I need to assign animation controllers in Unity, and if I create all animations in same time, I need only one controller for many objects.

If there, any benefits to animate objects one by one and have multiple controllers later in game development?

sentences:
How can I prepare the different difficulty levels for my game? I've though about creating the game for the easiest difficulty level, and from there scale up and create the other, more difficult difficulty levels, but I'm not sure it's the fastest way to go.

How should I create the different difficulty levels for my game?

sentences:
How to make model's arms + weapon follow cursor? 0
Just like the title says. I currently have my controlling movement working just how I want it to. Now in order to proceed with shooting I first should focus on how the model should look like to determine how my script should act when firing. Currently I am using Unity's Constructor model, but now I need to create my own model just to get the arm movements to follow how I want it to. I have an idea how to make the arms follow the cursor, by adjusting the X and Y axis rotation to follow the position of the cursor, taking on screen coordinates then using Atan to find the right angle. First I have no idea how to make a model, so I guess I need to figure that out first, but how can I make it move like the constructor model from Unity. I have heard of rigging, but still not sure what that is. I have played with C4D when in high school which I noticed while modeling it help provide a human like effect when controlling joints. I am planning on using Blender so if anyone had 3D modeling humanoids video with rigging or skeletal joint or something. Not an artist at all, but I need a model I suppose.

This is a 2.5D platform game, 3D environment with 2D physics.

sentences:
How to make a texture not stretch? I have made two textures in Photoshop. I applied one of the textures to the sides (one to each side, in the Unity editor) and the other one to the top and bottom sides. However when I extend the object the texture gets stretched which I don't want.

Is there any way to prevent this? The object is a cube.

I don't want the texture to get stretched if I make the cube larger and I don't want the texture to get shrunk if I were to make the quad smaller.

This is what I don't want as a result:

sentences:
Strange I'm getting exception but the scripts in the exception message are not exist on my pc. What should I do? I'm using unity version : 2019.2.5f1 personal

I searched on my hard disks the entire pc and none of the scripts in the exception message are exist. And the exception is happens only sometimes. When I stop the game in the editor by pressing the play button the exception is show sometimes and sometimes not.  I tried to close and open over agai the unity editor and the project. Still strange.

  MissingReferenceException: The object of type 'ReflectionProbe' has been destroyed but you are still trying to access it.
  Your script should either check if it is null or you should not destroy the object.
  UnityEditor.ReflectionProbeEditor.OnPreSceneGUICallback (UnityEditor.SceneView sceneView) (at C:/buildslave/unity/build/Editor/Mono/Inspector/ReflectionProbeEditor.cs:651)
  UnityEditor.SceneView.CallOnPreSceneGUI () (at C:/buildslave/unity/build/Editor/Mono/SceneView/SceneView.cs:3359)
  UnityEditor.SceneView.DoOnPreSceneGUICallbacks (UnityEngine.Rect cameraRect) (at C:/buildslave/unity/build/Editor/Mono/SceneView/SceneView.cs:1935)
  UnityEditor.SceneView.OnGUI () (at C:/buildslave/unity/build/Editor/Mono/SceneView/SceneView.cs:2320)
  System.Reflection.MonoMethod.Invoke (System.Object obj, System.Reflection.BindingFlags invokeAttr, System.Reflection.Binder binder, System.Object[] parameters, System.Globalization.CultureInfo culture) (at <599589bf4ce248909b8a14cbe4a2034e>:0)
  Rethrow as TargetInvocationException: Exception has been thrown by the target of an invocation.
  UnityEngine.UIElements.UIR.RenderChain.Render (UnityEngine.Rect topRect, UnityEngine.Matrix4x4 projection) (at C:/buildslave/unity/build/Modules/UIElements/Renderer/UIRChainBuilder.cs:238)
  UnityEngine.UIElements.UIRRepaintUpdater.DrawChain (UnityEngine.Rect topRect, UnityEngine.Matrix4x4 projection) (at C:/buildslave/unity/build/Modules/UIElements/Renderer/UIRRepaintUpdater.cs:66)
  UnityEngine.UIElements.UIRRepaintUpdater.Update () (at C:/buildslave/unity/build/Modules/UIElements/Renderer/UIRRepaintUpdater.cs:54)
  UnityEngine.UIElements.VisualTreeUpdater.UpdateVisualTree () (at C:/buildslave/unity/build/Modules/UIElements/VisualTreeUpdater.cs:72)
  UnityEngine.UIElements.Panel.Repaint (UnityEngine.Event e) (at C:/buildslave/unity/build/Modules/UIElements/Panel.cs:637)
  UnityEngine.UIElements.UIElementsUtility.DoDispatch (UnityEngine.UIElements.BaseVisualElementPanel panel) (at C:/buildslave/unity/build/Modules/UIElements/UIElementsUtility.cs:240)
  UnityEngine.UIElements.UIElementsUtility.ProcessEvent (System.Int32 instanceID, System.IntPtr nativeEventPtr) (at C:/buildslave/unity/build/Modules/UIElements/UIElementsUtility.cs:78)
  UnityEngine.GUIUtility.ProcessEvent (System.Int32 instanceID, System.IntPtr nativeEventPtr) (at C:/buildslave/unity/build/Modules/IMGUI/GUIUtility.cs:179)

sentences:
How do I add a sprite to an object layer? I am using Tiled to create a map which I am then using for a game written in Phaser.

I cannot figure out how to add a Sprite into the Object layer using the Tiled editor.   I am having to do it with code but that's not ideal as I want to see the sprites in their positions on the map when I edit it.

I know this is very simple but I cannot see how to add/see sprites in Tiled.  Is Tiled not able to do this or not designed to do this?

sentences:
Pixel Picking vs Raycasting I was recently introduced to a way of picking in OpenGL known as pixel picking (or color picking).

From my understanding, how this is done is that the scene is rendered to the back buffer with a different rgb color representing each object. By reading the color of the pixel clicked by the cursor, the relevant object can be picked. The immediate issue I can think of when using this method is that during the picking process, the scene have to be rendered 2 times, once for picking and another time for display. Additonally this also limits the it to 256^3 unique objects for picking.

With this, I would assume this is a much more accurate way of "raycast" than to use physics raycast. By placing a camera at the raycast source, render once for "raycast" picking, and resetting the camera to the original position for normal render. This would reduce issues of "bullet hitting invisible walls" as its not dependent on physics collision, which can be affected by convex hulls for complex meshes.

Is there any reason why this method is not used? Could it be over complication? Or perhaps it is what is happening behind the scenes in raycasting?

As an example where pixel picking might be better would be when raycasting through a wire fence. Most wire fence models are just textures with a transparent channel, giving the illusion of a wire fence while saving on geometry by having 1 single plane. Using color picking, what the player see is what the camera picks. Whereas in raycast, the raycast will not shoot through the plane unless it doesnt collide with the plane at all.

sentences:
Moving a Box2D object in the direction it is facing using applyForce I'm trying to apply force to a polygon physics object to move it. Whilst I can get it to move upwards easily enough, I'm trying to get it to move in the direction in which it is pointing.

Here's my current movement code -

private void controls(){
    if(Gdx.input.isKeyPressed(Keys.D)|| Gdx.input.isKeyPressed(Keys.RIGHT)){
        shipBody.applyAngularImpulse(-Global.ROTATIONSPEED, true);
    }

    if(Gdx.input.isKeyPressed(Keys.A)|| Gdx.input.isKeyPressed(Keys.LEFT)){
        shipBody.applyAngularImpulse(Global.ROTATIONSPEED, true);
    }

    if(Gdx.input.isKeyPressed(Keys.W)|| Gdx.input.isKeyPressed(Keys.UP)){
        shipBody.applyLinearImpulse(Global.IMPULSE,
                                    shipBody.getWorldCenter(), true);
    }

    System.out.println("Ship angle: " + shipBody.getAngle() * (float)(180 / Math.PI));
}

Global.Impulse is:

public static final Vector2 IMPULSE = new Vector2(0, 25f * MetersToPixels);

Whilst this works fine for rotating the ship, when i apply thrust, it just goes vertically up (I understand why this happens, I'm just not entirely sure how to make it move in the direction it's pointing).

sentences:
Predicting trajectory collisions for multiple moving objects For the most simple of 2D games, I have implemented a posteriori collision detection (overlapping rectangles) on the xy Cartesian plane, but am now interested in understanding the basics of a priori collision detection...

On Wikipedia's entry on collision detection, I noticed the reference to Newton’s Method.  So, I want to better understand the link between finding zeros of an equation and detecting a posteriori collision.

Let's start with the most obvious case of finding roots of an equation:  If you have a projectile's trajectory modeled as a quadratic function, you can find the roots to predict at what time the height will equal zero (or any other constant height, actually, by just rearranging f(x)=C to be f(x)-C=0 and then finding roots of that expression).

So, as I understand, finding the root can tell me the time at which the object will be at any chosen height.  More broadly, we basically know the (x,y) location of the object for any given time.

But how does root finding, in particular, translate to detecting collisions with another object?  The other object may be stationary, or be moving.  If the latter, do you also determine roots/location of this moving object as well? Calculate the (x,y) trajectory of both objects and determine where they will intersect?

sentences:
Move enemies over the network without sending their positions I am trying to move enemies on two clients without sharing their positions. I use this:
startingPosition + GetRandomDir() * Random.Range(1f, 10f)

To have the same movement on clients and server, I set the same seed to get the same directions with Unity Random.
I set it with the system datetime now ticks on server and clients:
Random.InitState(newTicks);

I am getting the same movements on the server and on the clients until a enemy starts looking for a player and chasing that player.
When this happens, the enemy on one client is not at the same position on the other client. One enemy is targeting a player on one client, but on the other client he hasn't targeted that player yet. The enemy keeps wandering creating a different position on one client than on the server or other clients for example.
Is there a better way to synchronize the enemy movement ?
My idea was not to send the positions of the enemies from the server to the clients but rather have the clients move their enemies themselves.
I would also like to know what to search for on Google to get help with this problem: networking ai movement doesn't help, synchronize movement over the network without sending position does not return the results I would like either.
What I think is strange and I don't understand is that the same code is executed on both the client and the server. The players and the enemies are at the same positions. Yet the enemy will choose to chase a player on the server and not to chase a player on the client. Resulting on the client to view the enemy at a different position than the position of the enemy on the server.

sentences:
Ideas/suggestions to implement an item combination system I'm designing a game where there is a relatively small set of items. A single player holds an inventory of item slots. Each item slot contains a single item. The inventory allows you to use the item directly, move item around the slots (to organize), equip the item (weapon), and lastly, to combine compatible items together.

I've come up with the diagram below:

Where I'm having trouble is combining. To simplify the game, the game will only do Health+Health, Ammo+Ammo, Weapon+Ammo, Prop+Prop.

Where should I check if the above is permitted? Should Inventory check, or should I delegate the checking to the items themselves?

If I have a green health item and a red health item, it would double the strength of the green potion (increases HP) due to the red health item. But what if the player tries to do: G+G+G+G+G or G+R+R?

I can see that with this design, I run into the problem of having a health item as an (subtype).

For Props, they're simply items used in the game, like keys, cranks, etc. Sometimes two props can be combined as one.

All combinations are designed. As in, the player wouldn't come up with a unique item combination.

Edit 1: The example, with health items, G+G+G+G+G implies that there's a limit as to how many green health items can be combined together. For example, the green health item has a HealthItem.health_sum=.40 (40% of your HP). After the third combination, it becomes meaningless.

sentences:
Learning OpenGL GLSL - VAO buffer problems? I've just started digging through OpenGL and GLSL, and now stumbled on something I can't get my head around this one!? I've stepped back to loading a simple cube and using a simple shader on it, but the result is triangles drawn incorrectly and/or missing. The code I had working perfectly on meshes, but was attempting to move to using VAOs so none of the code for storing the vertices and indices has changed.

What I have for creating the VAO and buffers is this

//Create the Vertex array object
glGenVertexArrays(1, &vaoID);

// Finally create our vertex buffer objects
glGenBuffers(VBO_COUNT, mVBONames);

glBindVertexArray(vaoID);

    // Save vertex attributes into GPU
    glBindBuffer(GL_ARRAY_BUFFER, mVBONames[VERTEX_VBO]);

    // Copy data into the buffer object
    glBufferData(GL_ARRAY_BUFFER, lPolygonVertexCount*VERTEX_STRIDE*sizeof(GLfloat), lVertices, GL_STATIC_DRAW);

    glEnableVertexAttribArray(pos);
    glVertexAttribPointer(pos, 3, GL_FLOAT, GL_FALSE, VERTEX_STRIDE*sizeof(GLfloat),0);

    glBindBuffer(GL_ELEMENT_ARRAY_BUFFER, mVBONames[INDEX_VBO]);
    glBufferData(GL_ELEMENT_ARRAY_BUFFER, lPolygonCount*sizeof(unsigned int), lIndices, GL_STATIC_DRAW);

glBindVertexArray(0);

And the code for drawing the mesh.

glBindVertexArray(vaoID);
glUseProgram(shader->programID);

GLsizei lOffset = mSubMeshes[pMaterialIndex]->IndexOffset*sizeof(unsigned int);
const GLsizei lElementCount = mSubMeshes[pMaterialIndex]->TriangleCount*TRIAGNLE_VERTEX_COUNT;
glDrawElements(GL_TRIANGLES, lElementCount, GL_UNSIGNED_SHORT, reinterpret_cast<const GLvoid*>(lOffset));

// All the points are indeed in the correct place!?
//glPointSize(10.0f);
//glDrawElements(GL_POINTS, lElementCount, GL_UNSIGNED_SHORT, 0);

glUseProgram(0);
glBindVertexArray(0);

Eyes have become bleary looking at this today so any thoughts or a fresh set of eyes  would be greatly appreciated.

sentences:
Create vertices + indices for cylinder with triangle strips I'm trying to create vertex and index buffer for a cylinder (in OpenGL, but it shouldn't matter). I think my vertex buffer is fine (I checked drawing with GL_POINTS). Here's the code that builds it:

int sides = 10, slices = 40;
float radius = 3.5 * 10.0;

numVertices = sides * slices;
Vertices = malloc(sizeof(Vertex) * numVertices);

int angleincs = 2*M_PI/sides;
int cs_angleincs = 2*M_PI/slices;
float zval;
float zstep = height / (float)sides;

float i;

for(int m=0; m<slices; m++)
{
    int index = (m*sides);
    for (int n=0; n<sides; n++)
    {
        Vertices[index + n].Position.x = cosf(i);
        Vertices[index + n].Position.y = sinf(i);
        Vertices[index + n].Position.z = zval;

        i += angleincs;
    }

    zval += zstep;
}

I'm stuck at the index buffer generation. Any help on how to build it? I tried to adapt some code from a torus generator, and I get something that apparently resembles a cylinder but it's a bit weird and has a few extra weird triangles.

numIndices = (2 * (sides+1) * slices + slices);
Indices = malloc(sizeof(GLushort) * numIndices);

int n=0;
for (int i=0;i<slices; i++) {
    for (int j=0; j<sides; j++) {
        Indices[n++] = i * sides + j;
        Indices[n++] = ((i+1)%slices) * sides + j;
    }

    Indices[n++] = i * sides;
    Indices[n++] = ((i+1)%slices) * sides;
    Indices[n++] = ((i+1)%slices) * sides;
}

Thanks in advance.

sentences:
How to reset the score to 0 when reloading the game? My scoring system uses DontDestroyOnLoad to persist between scenes:

public class ScoringSystem : MonoBehaviour {
 private int score = 0;

 public void Correct(int number){
     // If correct add score;
     score = score + number;
 }

 void Start () {
     score = 0;
 }

 void Awake() {
   DontDestroyOnLoad(transform.gameObject);
 }

 public int GetScore(){
     return score;
 }
}

Here is another script that I should include a description about:

  public void iniTag()
 {
     jawab = true;
     Time.timeScale = 0;

         GameObject objek1 = GameObject.FindGameObjectWithTag("Benar1");
         GameObject objek2 = GameObject.FindGameObjectWithTag("Benar2");
         GameObject objek3 = GameObject.FindGameObjectWithTag("Benar3");
         GameObject objek4 = GameObject.FindGameObjectWithTag("Benar4");

         if (objek1.transform.parent.tag == "Jawab4" && objek2.transform.parent.tag == "Jawab3" &&
             objek3.transform.parent.tag == "Jawab2" && objek4.transform.parent.tag == "Jawab1")
         {
             PanelBenar.SetActive(true);
             buttonNext.SetActive(true);
             GameObject.Find("QuizManager").SendMessage("Correct", playerScore);

     }}

     void Start () {
       if (GameObject.Find ("QuizManager") != null) {
         ScoringSystem scoringSystem = GameObject.Find ("QuizManager").GetComponent<ScoringSystem> ();
         gameObject.GetComponent<Text>().text = scoringSystem.GetScore().ToString ();
             } else {
         Debug.Log("No Scoring system found. To test scoring system start from the front page scene");
       }
     }

sentences:
Do I still owe Epic royalties if I am not enrolled in the Unreal Engine subscription? I have just started using Unreal Engine 4 and I have had a very good experience, though I have left the subscription now.

I've made an Android game with it and I am planning to release it, but I have some doubts about the license. Suppose I post my game on my own website for, say, $%, will I still have to give 5% of my income to Epic? How will they come to know that the game is made in Unreal Engine?

I am very confused in taking this step and I'm not really understanding what they mean by "5% gross revenue."

sentences:
360 degree video of my OpenGL game I want to make a 360 degree video of my OpenGL game.

Concerning the rendering: Is it enough to render it in OpenGL with a specific projection matrix? If yes, which one? Or can I render it into a cube map, and then encode it? (Which will require much more rendering power and be more complicated, which I want to avoid)

And how do I encode a 360 degree video with FFMPEG?

sentences:
Send OpenGL video flux via UDP It is possible to send the video flux of an OpenGL desktop app via UDP on Linux ? I looked up FBO and off-screen rendering but I still can't figure out how to extract the video flux and send it.

I'm working with C++ but if you have explanations in others langages go ahead.

Thanks.

My original post on stack overflow.

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:
Drawing in SFML outside of the main function (passing the window over to other fuctions) doesn't work Why does the drawn Sprite only appear in the Window when drawn from the main-function, but not when drawn from an external function and how can I change this?

class Class {
private:
sf::Sprite sprite;

public:
Class()
    {
        sprite = initializeSprite(sprite);
    }
};

void Class::draw(sf::RenderWindow& win)
{
    win.draw(sprite);
}

int main(int argc, char* argv[])
{
    sf::RenderWindow window(sf::VideoMode(1920,1080), "Window");
    Class instance;
    while(window.isOpen())
    {
        window.clear();
        instance.draw(window);
        window.display();
    }

    return 0;
}

-> Doesn't work.

int main(int argc, char* argv[])
{
    sf::RenderWindow window(sf::VideoMode(1920,1080), "Window");
    sf::Sprite sprite;
    sprite = initializeSprite(sprite);
    Class instance;
    while(window.isOpen())
    {
        window.clear();
        window.draw(sprite);
        window.display();
    }

    return 0;
}

->Works.

I'm using SFML-2.4.0. It also doesn't work when i use a pointer instead of a reference. What's wrong here?

sentences: Typing text animation (dialogue) libGDX or in general Can anyone think of an efficient way to animate the typing dialogue text as found in pokemon? I have a vague idea of using string.length, and having a new letter drawn every .2 seconds or so, but rather than using a timer event, i was wondering if there is a better way to do this. for example an animation, but i can't find anything like that in libGDX. Any ideas?

sentences:
Filling a polygon with a texture (or a color) C# Visual Studio I'm trying to figure how to put a texture or fill a "DrawPolygon" with a simple color in C# Visual Studio (using right now 2015).

 //Left Wall 1
 Point lw1a = new Point(18, 7);
 Point lw1b = new Point(99, 61);
 Point lw1c = new Point(99, 259);
 Point lw1d = new Point(18, 313);

 Point[] lw1 = { lw1a, lw1b, lw1c, lw1d };

 gr.DrawPolygon(pen, lw1);`

This is a example code for one of the things I'm drawing on screen. Any idea on how I can achieve that?
Thanks!

sentences:
OpenGL ES 2.0: Texture does not appear to be correct Here are my shaders...

 GLbyte vShaderStr[] = "attribute vec4 vPosition;   \n"
 "attribute vec2 texPosition; \n"
 "attribute vec4 inColor;   \n"
 "varying vec4 fragColor;   \n"
 "varying vec2 v_texCoord;     \n"
 "void main()                 \n"
 "{                           \n"
 "   gl_Position = vPosition; \n"
 "   fragColor = inColor; \n"
 "   v_texCoord = texPosition; \n"
 "}                           \n";

GLbyte fShaderStr[] =
  "precision mediump float;                            \n"
  "varying vec2 v_texCoord;                            \n"
  "uniform sampler2D s_texture;                        \n"
  "void main()                                         \n"
  "{                                                   \n"
  "  gl_FragColor = texture2D( s_texture, v_texCoord );\n"
  "}                                                   \n";

And here is my code...

GLfloat gObj[18] = {
  0.5f, 0.5f, 0.0f,
  -0.5f, -0.5f, 0.0f,
  0.5f, -0.5f, 0.0f,
  0.5f, 0.5f, 0.0f,
  -0.5f, 0.5f, 0.0f,
  -0.5f, -0.5f, 0.0f
}
...
GLuint textureId;

GLubyte bytePix[4 * 3] ={
        255, 0, 0,
        0, 255, 0,
        0,0, 255,
        255,255,0
};
GLfloat texC[] = {
            0.0f, 0.0f,
            0.0f, 1.0f,
            1.0f, 1.0f,
            1.0f, 0.0f
    };
glPixelStorei(GL_UNPACK_ALIGNMENT, 1);
glGenTextures(1, &textureId);
glBindTexture(GL_TEXTURE_2D, textureId);
glTexImage2D(GL_TEXTURE_2D, 0, GL_RGB, 2, 2, 0, GL_RGB, GL_UNSIGNED_BYTE, bytePix);
glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, GL_NEAREST);
glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER, GL_NEAREST);
glClearColor(1.0f, 1.0f, 1.0f, 1.0f);
glClear(GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT);
glVertexAttribPointer(0, 3, GL_FLOAT, GL_FALSE, 0, gObj);
glVertexAttribPointer(textCoordLoc, 2, GL_FLOAT, GL_FALSE, 0, texC);

glUniform1i(sampler, 0 );
glEnableVertexAttribArray(0);
glEnableVertexAttribArray(1);
glEnableVertexAttribArray(textCoordLoc);
glDrawArrays(GL_TRIANGLES, 0, 6);

But when I run the app I see the following...

This seems wrong, how can I make it so each quadrant of the square is the color in the texture. Of course I could always be misunderstanding textures in general.

sentences:
How could I get rid of these shared_ptr/weak_ptr in this entity-component architecture? We've built an entity-component architecture that works ok for our needs, but it has something that bugs me a bit from a software engineering point of view.

We use std::shared_ptr and std::weak_ptr for the Components: the Entity owns the component through an std::shared_ptr, while the ComponentManager and other Components refer to the component through a non-owning std::weak_ptr.

The issue is that the components are not actually shared, and they should not be shared either. They're owned by a single entity. Having an std::shared_ptr there suggests that anyone can take a copy of the shared_ptr and own it too.

Here is a diagram of how the classes are organized:

Entity:

real owner of the components through shared_ptr
does not know which components it holds

ComponentManager:

we call update() on the ComponentManager, which in turn calls update() on every component it knows about
there is one instance per type of component; we've done it like this to have control over which components get updated first (e.g. CmpRigidBody updates the CmpMatrixTransform, and from which the CmpGfx is then updated)
unofficial owners of the components through weak_ptrs; it's "unofficial" because it's through them that the components are updated
weak_ptrs are stored in a vector
once the (single) shared_ptr goes out of scope (e.g. when the entity gets deleted), a custom deleter tells the ComponentManager to remove the weak_ptr from the vector (this also adds confusion to this architecture)

Component and derived:

holds the core of the information and performs the main operations of the component
can reference other components through weak_ptr (hooked up at initialization, for now)

I strongly believe in using the right tool for the job, and although this architecture works, I'm curious to see if there are alternatives that would remove the confusion introduced by the shared_ptrs.

Maybe this is pertinent:

The amount of entities and components is relatively low, so we won't gain much by making efforts to keep them close together (the rendering and the physics simulation are taking most of our frame time).
We use this approach because of the re-usability offered by the components and entities from project to project.
The project is single-threaded.
The action takes place in the Component, not in the ComponentManager (i.e. it's a entity-component architecture, not an entity-component-system archiecture), so the Component needs access to other Components if they still exist, and these can be removed at any time.

I could use a kind of handle system through the ComponentManager and query the appropriate one every time I need an access to a Component, but this adds a dependency... (Maybe that's the price to pay..?!)

Do I have other options?

sentences:
Camera controll in Libgdx I've a condition in my game where, I want my camera to follow the Player(its a body from Box2d) and in some not.
This is the start screen of my game:

Now, when i press a button(space) the player get an LinearVelocity in x,y direction and starts flying..

As soon as it reaches the end. The box is now out of the camera.

To fix this I made my camera centered the box.

This is where I screwed. I dont want my ground to come in the center it should always needs to be at bottom.. like in Picture 1 and the player should also needs to be at the left-bottom at the start of the game.  And when player flies away ... the x and y coordinates should be moved as my player moves ... i have certain height where player can fly so camera should be able to move in y-axis also.. and the game is endless running game so x- cordinates also keeps comming in.

sentences:
viewing fbx files in windows via xna 4.0 I've made some models in Blender and exported them in Autodesk fbx format.  I'm trying to view them using XNA 4.0 Refresh.

Loading them isn't much an issue, but I'm not familiar enough with XNA 4.0 to, well basically I want to load in the model at say the origin (0,0,0) world coordinates, and then rotate and/or zoom the camera about the world coordinates origin as well so that I can test the model.  Typically the mouse, and maybe some arrow keys for zooming/rotating the camera.

Anyways, this seems like a simple task and I shouldn't have to re-invent this, isn't there a skeleton code somewhere for this kind of thing for XNA 4.0?  I couldn't find a solid example for this on the web.  I found a couple that seemed like they might work for xbox, but I'm trying to do this on windows only.

Anyways, just looking to be pointed in the right direction on this one, thanks.

sentences:
SDL2 linux fullscreen issue at lower-than-desktop resolution Having a problem trying to get proper fullscreen in linux.

I'm using 1440x900 on desktop. When i set SDL to use 1280x720 as fullscreen, it does change screen resolution. But if i drag the mouse cursor to the bottom or right edge of the game screen, it "scrolls" the screen beyond the game surface and makes part of the desktop visible.

Here's how I set the window/screen:

gameWindow = SDL_CreateWindow( "SDL Tutorial", SDL_WINDOWPOS_CENTERED,
SDL_WINDOWPOS_CENTERED, screenWidth, screenHeight,
SDL_WINDOW_FULLSCREEN | SDL_WINDOW_BORDERLESS ); }

Am i missing some flag(s) perhaps?
Is this a common problem? I'm on Linux Mint MATE (Rosa).
This problem also occurs when trying to run the same build in an Openbox session.
Using nVidia drivers (x64, v340.96) from nvidia.com, on 9600 GT card(s). No twin/dual screen or second Workspaces.

Any good tips on how to avoid or workaround this issue?

sentences:
Event-Based Entity-Componenty-System So, I'm new to ECS. The concept is very interesting in contrast to traditional OOP and heavy inheritance. I'm working on a game right now that is open-sourced, but does not actually have a game loop. It works by sending and receiving packets, and acting upon those received packets.

In that case, what would I be looking at in this relationship between Systems and Components? Let's say I have an incoming Movement packet that is telling me to move Player A 5 units to the right. And let's say I have a lot of different types of packet types (let's say up to 100), each for different stuff, like maybe making a purchase at an NPC store. Another one for purchasing at a player store.

Or maybe inviting and expelling players from a party. Or inviting and expelling players from a guild or alliance.

At that point, I start getting a little confused. I can definitely see similarities in ..

Adding/Expelling people from a party, guild, alliance

But each of those packets contain different information at their core. I'm tempted to write a component that Guilds, Alliances, and Parties can use (like AddRemoveMemberComponent), but the information coming in from the packet makes me hesitant.

How would those components handle specifically? Maybe I'm just entangling myself in traditional inheritance, so it's hard for me to see the uniqueness of data. Would I have unique systems for explicitly handling Party, Guild, Alliance expulsions and invitations? And how would I dynamically know what to do with these different packets coming in (different packets for alliance, guild, party).

sentences: Using blend trees for a simple 2d character Let me start by saying that I'm not a animator and basically have no idea what I'm talking about. The character in the game has 3 states : indle(looks at camera) walk left and walk right. I've set up the transitions for all states but now I want to know how to blend from the idle state to each one of the walking states. This is how my animator looks like :

sentences:
(Unity) Physics based movement vs Straight position change Unity provides a cool physics engine for game development and I want to utilize it in my game.

Shorter version

I want to use physics engine for everything else other than character movement because trying to use physics engine for player movement doesn't yield the perfectmovement speed that I want; move x units per second.

If I use physics engine for character movement, it gets complicated. I would rather just add "moved distance" to the position to have things done simple. Is doing something like this wrong? All the learning sources I read recommend to use physics engine for movement if the game incorporates physics engine. I am nervous; am I wrong?

Longer version

The following description is where I use "physics", why I need physics engine.

In my game a player fires a bullet. When enemies collide with bullet, they get pushed back slightly. A strong blast can push enemies far back so that they even bounce back from hitting wall.

A recommend, a proper way, I was told, to utilize this physics engine for character movement is to add force to the direction I want to move.

But doing so(adding force to the direction I want to move) will result in truck-like; slowly warming up by adding velocity. To avoid "truck like movement" I was told to apply greater force at the beginning. Doing so result in change in velocity like the below picture.

However problem is not over yet, you must consider a situation where you change direction of movement while the character is running.

If you started to move backward, all of the sudden while running forward, you will need to slow down forward movement burn velocity by adding backward force. Thus rotation burns velocity.

So a solution is to find out perpendicular velocity to your desired direction, then find out needed amount of force to "burn off" the undesired velocity.

This seems way too complicated for a character to simply move around. I would rather just move character to desired direction by simply adding "constant X distance" to the character's position.

But I can't find a source of example where it utilizes both "simple movement by directly adding moved distance to the position" and "using physics engine for the game". All the sources of learning(using Unity physics) I find say use this complicated way of having character to move around. I wonder is there a reason why people don't just add moved distance to the position?

sentences:
How to calcolate moving vector of object by its rotation degress in 2d i have object in game which is rotating when i move my joystick , now i need to   calculate its movement vector by its rotation
the object always moving forward and controlled by the joystick , the joystick is only setting its direction by degree .
here is the image which illustrate the scene .
i need some formula of the vector which the object will move .

sentences:
What web technology could I use which would support a decision tree? I am a big game development fan but I haven't done any commercial work in the past. I have been asked by a non-profit to look at developing a game similar to the award-winning www.playspent.org

They want the following features:

support 5 scenarios
mobile isn't important but compatibility with older browsers would be a big bonus
they want it to be visual and audible
bonus is to have it easily modifiable
support 4 languages

I don't have much knowledge of Flash and would rather avoid using it as a solution. I started breaking down the problem into segments that I will need to examine, they are as follows:

ability to read the game flow from a file that they can produce (xml, etc.)
db design to store decision tree
language challenge
browser compatibility

I am leaning towards an Google app engine/GWT solution but I am not sure what technology is best for this.

I am really hoping to get your opinion/recommendation on my approach and on what technology is best. A special thanks (and beer if you live in Toronto) will be awarded to anyone who can help give me a ballpark estimate on how much such a game should go for. I know it's tough to estimate but any rough figure will help (how much would you charge for building something like playspent.org?)

Thanks in advance

sentences:
2D Motocross physics I'm looking into making a 2D motocross bike game with plausible physics.

It should look like this:

For a first try, I've created only the player (a motocross driver) and the map (consisting of only straight lines; no curves, to keep it simple).

How should collisions between the motocross bike and the track affect the bike's position and velocity? The bike should rotate if only one of the wheels touches the ground and speed up if the back wheel touches the ground. Pretty standard bike game stuff.

How do I achieve this behaviour?

sentences:
How to make object that moves with constant speed not overshoot the object it collides with? To learn LOVE2D I am creating a simple project. Player moves the square with arrows keys until it hits the goal square, at which point the game is won.

function isCollision(x1,y1,w1,h1,x2,y2,w2,h2)
    return (x1<x2+w2)and(x2<x1+w1)and(y1<y2+h2)and(y2<y1+h1)
end

function love.update(dt)
    if love.keyboard.isDown("escape") then love.event.quit() end
    if isCollision(player.x,player.y,player.w,player.h,goal.x,goal.y,goal.w,goal.h) then
        gameOver=true
        if love.keyboard.isDown("space") then love.load() end
    else
        delta = player.speed*dt
        if love.keyboard.isDown("right") and player.x<=800-player.w then player.x=player.x+delta end
        if love.keyboard.isDown("left") and player.x>=0 then player.x=player.x-delta end
        if love.keyboard.isDown("down") and player.y<=600-player.h then player.y=player.y+delta end
        if love.keyboard.isDown("up") and player.y>=0 then player.y=player.y-delta end
    end
end

But sometimes the square overshoots the goal and it becomes lodged in the goal.

How do I make it so that engine detects when the player simply touches the goal and stops there, without moving further in the frame?

Disclaimer: Using a collision detection library like bump.lua would be too easy. I want to learn the relevant practices so that I can apply it to retro consoles and computers in the future.

sentences:
Finding shapes in 2D Array, then optimising I've just been allowed an image...The image below from my game shows some darkened blocks, which have been recognised as being part of a "T" shape.  As can be seen, the code has darkened the blocks with the red spots, and not seen the "T" shapes with the green outlines.

My code loops through x/y, marks blocks as used, rotates the shape, repeats, changes colour, repeats.

I have started trying to fix this checking with great trepidation.  The current idea is to:

loop through the grid and make note of all pattern occurrences (NOT marking blocks as used), and putting these to an array
loop through the grid again, this time noting which blocks are occupied by which patterns, and therefore which are occupied by multiple patterns.
looping through the grid again, this time noting which patterns
obstruct which patterns

That much feels right... What do I do now?

I think I would have to

try various combinations of conflicting shapes, starting with those
that obstruct the most other patterns first.How do I approach this one?
use the rational that says I have 3 conflicting shapes occupying 8 blocks, and the shapes are 4 blocks each, therefore I can only have a maximum of two shapes.

(I also intend to incorporate other shapes, and there will probably be score weighting which will need to be considered when going through the conflicting shapes, but that can be another day)

I don't think it's a bin packing problem, but I'm not sure what to look for.  Hope that makes sense, thanks for your help

EDIT Despite clarity of question, everyone seems to have understood, yes,

I want to find the maximum "T" shapes within each colour

(because if I gave you points for two and you had made three, you'd be a bit annoyed)

sentences:
View Matrix FINDING U T<----------------------Q

While making a view matrix, I usually cross product a (0,1,0) with W TO GET U
W = (T-Q)/||T-Q||
  U = (W X (0,1,0)/||W X (0,1,0)
v = w x u
this works most of the time. But what about when I want to go y axis and look straight down at 0,0,0

What would be the value of the vector? (0,1,0) does not work. Tried every combination even negatives and didn't work.

sentences:
How to add high score? I wanted to add a high score to my game but I don't know how I already tried to find some videos for it but I just can't find the right one. I already have a scoreUI on my game I just wanted to add a high score.

Here is my UIManager's script which consists of different functions including the score system.

using System.Collections;
using System.Collections.Generic;
using UnityEngine;
using UnityEngine.UI;
using UnityEngine.SceneManagement;

public class uiManager : MonoBehaviour {

public Button[] buttons;
public Text scoreText;
int score;
bool gameOver;

// Use this for initialization
void Start () {
    gameOver = false;
    score = 0;
    InvokeRepeating("scoreUpdate", 0.5f, 0.25f);
}

// Update is called once per frame
void Update () {
    scoreText.text = "" + score;
}

void scoreUpdate(){
    if (gameOver == false) {
        score += 1;
    }
}
public void gameOverActivated(){
    gameOver = true;
    foreach(Button button in buttons) {
        button.gameObject.SetActive(true);
    }
}

public void Play() {
    SceneManager.LoadScene("level1");
}

public void Menu(){
    SceneManager.LoadScene("Menu");
}

public void Retry()
{
    SceneManager.LoadScene(SceneManager.GetActiveScene().name);
}

public void Pause() {

    if (Time.timeScale == 1) {
        Time.timeScale = 0;
    }
    else if (Time.timeScale == 0) {
        Time.timeScale = 1;
    }
}
}

I got the score system from Charger Games. Here is the link to the Video

and here is what my game looks like

sentences:
How can I Instantiate an object only for me? I am trying to make a multiplayer game, and I want to instantiate/create/spawn an object only for the player's game client.

However, when I instantiate it, it spawns for everyone.

Here is the code:

using UnityEngine.Networking;

public class Spell : NetworkBehaviour
{
    void Start()
    {
        //CreateSpell();
    }

    public void CreateSpell()
    {
        var canv = GameObject.Find("Actionbar");
        var btn = Instantiate(spellButton, canv.transform, false);
        btn.SetActive(true);
        btn.GetComponent<Button>().onClick.AddListener(SpellAction);
        btn.GetComponent<Image>().sprite = spellImage;
    }
}

Here, the btn will show for everyone; and I don't want that.

How can I instantiate the object only for the client who creates it?

sentences:
Moving sprites based on Delta time - consistent movement across all devices with different resolutions This is the formula I am currently using to move my sprites across the screen:

Examples below only deal with X coordinates to keeps things as short as possible.

Initial variable declarations:

float frames_per_second = 30;         //Set this to target frames per second, 30 for this example.
float dt = 1/frames_per_second;       //Delta
float spriteXGrid;                    //Sprite's position on a grid (grid can be any explicit value, I use something simple like 800 x 600)
float spriteXScreen;                  //Sprite's actual final position in screen coordinates
float spriteXTime=5;                  //Time variable.  This is in seconds and is the amount of time the sprite should take to traverse the screen
float spriteXVel=1/spriteXTime;       //Velocity value used in conjunction with time value to calculate new position

To set my sprite's initial position I simply do this:

spriteXGrid = (pos/800);           //Where pos is the position on the grid (0-800) and 800 is the grid size that I chose to work with.
spriteXScreen=spriteXGrid*width;  //To convert to actual screen coordinates - where width is the actual width of the device currently running on.

Then to move my sprite, I do this:

spriteXGrid = spriteXGrid + (spriteXVel * dt);  //Update sprite's position on the grid
spriteXScreen=spriteXGrid*width;                //And convert to screen coordinates (again, width is the screen width of the current device)

Then I just use the spriteXScreen variable to plot the sprite, something like:

sprite.drawSprite(spriteXScreen,0);            //this is from a custom class I wrote that takes in sprite's x and y coordinate and draws it there.

My question is, is there an easier way I can do this?!  It's a nightmare to manage when it comes to collision detection etc.... because, you have 2 different coordinates, the 'screen' one (which I would describe as 'superficial'), and the 'grid' one which is needed for all the good stuff, and is a nightmare to actually work out and work with.

is there anyway I can just do something like:

spriteXScreen+='some value'

Which would allow my sprite to move across the screen in the same amount of time on all devices?

(I mean I can't just say move it by 1 pixel, because if I move 400 pixels in say 5 seconds on a 400 pixel wide screen, the sprite will have passed the whole screen in those 5 seconds, but on an 800 pixel wide screen it would have only passed halfway in the same amount of time).

The whole business of have a 'grid' coordinate and having to convert it to a 'screen' coordinate is extremely irritating and I'm wondering if I'm doing this all wrong....?

Suggestions and solutions would be very welcome

sentences:
is wisdom of what happens 'behind scenes' (in compiler, external DLLs etc.) important? I have been a computer-fanatic for almost a decade now. I've always loved and wondered how computers work, even from the purest, lowest hardware level to the very smallest pixel on the screen, and all the software around that.

That seems to be my problem though ... as I try to write code (I'm pretty fluent at C++) I always sit there enormous amounts of time in front of a text-editor wondering how every line, statement, datum, function, etc. will correspond to every Assembly and machine instruction performed to do absolutely everything necessary for the kernel to allocate memory to run my compiled program, and all of the other hardware being used as well.

For example ... I would write cout << "Before memory changed" << endl; and run the debugger to get the Assembly for this, and then try and reverse disassemble the Assembly to machine code based on my ISA, and then research every .dll, library file, linked library, linking process, linker source code of the program, the make file, the kernel I'm using's steps of processing this compilation, the hardware's part aside from the processor (e.g. video card, sound card, chipset, cache latency, byte-sized registers, calling convention use, DDR3 RAM and disk drive, filesystem functioning and so many other things).

Am I going about programming wrong? I mean I feel I should know everything that goes on underneath English syntax on a computer program.

But the problem is that the more I research every little thing the less I actually accomplish at all. I can never finish anything because of this mentality, yet I feel compelled to know everything... what should I do?

sentences:
How do I create and implement a sprite sheet for my SFML game? I have a game I am currently working on, and I have created 6 16 frame animations for my player character. Currently each of these are saved as seperate .jpg files, which are about 1.5x bigger than I want them to be in game. Each animation has a different size for the image, so I have 6 different image sizes. For example, here is the first frame for two different animations:

So I have 6x16 images in a folder, and I want to create a sprite sheet out of them, which I can use in my c++ SFML game. When I create a spritesheet, using a tool like texture packer, I have the sprites in all sorts of positions on a sprite sheet, and I don't know how I can the proceed to implement them in my game. How can implement them such that they
1) Keep in the same position relative to each other in the game
2) Have it so that the game knows the bounding box for the current image that I can use as both a hitbox for collision, as well as the rectangle the game displays the sprite for.

How can I achieve this? My guess is some sort of data file attached to the sprite sheet, but I dont know how to create one.

Additional info: Some images are duplicated, such as my idle frame 2 and idle frame 16. I would like to be able to only put one of those on the sprite sheet.

sentences:
What languages are used to develop MMORPGs like EVE Online and WOW? As I understand it, MMORPGs are games that run on your computer like any other normal 3d video game but, with each action that happens with in the game, changes are made to the universe via HTTP calls to the server. So the players computer does all the heavy lifting in terms of rendering the graphics and animations but, web frameworks do the online communication.

So I am wondering what web frameworks, web servers and databases are being used to create MMORPGs like EVE Online and W.O.W.?
Also, what programming languages and 3d game engines are being used to make the client side (3d graphics/animation/sounds) part of the game?

sentences:
How to prevent enemies from oscillating left and right during chase? I have a grounded enemy with a simple chase state. When in this state, the enemy moves with constant vel.x toward the player.

If my player jumps directly above the enemy however, the enemy will quickly flip directions back and forth a few times, since each time the vel.x is updated it flips sign. If the player is on a ladder above the enemy, the enemy will just oscillate back and forth indefinitely. Very ugly.

My enemy does have an engaged state where he pauses and then attacks, but my player has a high jump and so can maintain a far enough distance to avoid triggering the enemy to enter this state.

I am wondering what design choices I can make to prevent this ugly oscillation back and forth during chase.

sentences:
Lazy way to figure out the two sides of a border? We have a 3d model. There is a simple path on that model's surface graph G of the form:
<v_0, v_1 ... v_n-1, v_n> where if v_i == v_j then i == j

Great! now the simple question appears:
How do you programmatically tell in the human sense if v_orange and v_green are on the same side of the trail and if v_green and v_blue are on the same side or not?
My intuition is that you Dijkstra the shortest path between them and if it goes through the trail an even number of times their on the same side. However that is not defined if you don't know what goes through the trail computes to. If thinking if it was 2d and we could project these trail edges on some flat surface this would be made trivial.
My current solution is a lie. Each edge is normally shared by two faces unless it's an orbifold which is currently not interesting to this question's input population set. Also, in our world, each face has percisely three vertices.

Use Dijkstra to find the shortest path between them. If the path does not touch the trail, their relation to the trail isn't well defined or their on the same side (for now it outputs they are on the same side).
Assuming the path does go through the path, we pick one of the edges it went through.
Each edge belongs to two faces, each of these faces has precisely one vertex that is not on the edge trail. we now have two vertices that are supposed to be on different sides of the trail.
Dijkstra from each of the trail side vertices to the vertices in question.
If the shorter path to both vertices in question is from the same side then maybe they are on the same side. If it each vertex prefers a different side then maybe they are not.

Here is one fault in this solution:

Sometimes the two are on the same side and the other route is shorter.

Clarification
This is a clarification inspired by wondra that felt nothing can be on the right side or the left side of a trail, something that in my opinion people would disagree with as we have a good sense of left & right.
Lets "split" the model where the trail is and add more faces between the two new trails (lips) and get something like this:
Trail 1 is Blue, trail 2 Red and some epsilon wide faces between them. Now we use Dijkstra to find the shortest distance from both trails (Blue and Red). Some vertices are closer to the Red, some to Blue. Very few are (the same), closest simply to the last or first vertex in the original trail that are conjoined between the trails.

sentences: random spike in delta time The title pretty much sums it up. I'm using delta time to move my objects and every few seconds the delta time will spike and all the objects will jump forward. Should I just Interpolate the delta time to eliminate spikes, I don't want to do this because it could cause other problems but it could be a solution

sentences:
Newbie game programmer - Where do I start? Okay, so I have been really inclined towards game programming this past few weeks. I have primarily been a web programmer and know a fair number of lanugages like PHP, Java, javascript, python, etc. I also know a little bit of C++ as I heard that it's used heavily in the game industry. I have no experience in game development, but I am a fast learner.(I am 15 so I guess I still have a lot of time.)

So, is there any language I should learn to develop 2d and 3d games? Also which IDE(free) is a nice place to start compiling your ideas(something like Polycode:-  http://polycode.org/). I looked up Polycode but it was a little confusing for me to build it. I have a fair idea about what DirectX, OpenGL, SDL and shaders are but I have absolutely no clue about programming them. I know it's a little early to start jumping into this stuff already but you gotta start somewhere right? Please help me as I really want to get into serious game programming. Thanks!

I am running Windows 8 Pro 32 bit. Please suggest me any software accordingly!

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: In Godot browser game, is it possible to let the player download a file? I have a Godot game exported to the browser. I want to let the player export some data and let it save the data as a file on their PC, as if they were downloading a file from the Web. Is it possible for me to do that?

sentences:
How can I track how "well-lit" a player is so that I can determine if my AI can see him or her? I want to see how well-lit the player character is in an environment so that my AI can react (or not) to the player when he or she is visible.

Currently I am doing this by reading back the color data of the final render target and computing the brightness of the player's region. It seems expensive and taxing, so I was wondering if there is a better way to approach this?

sentences:
AS3 .hitTestObject() not working with Tween function (This was originally in an other senction but many told me to ask here, hopefully someone can answer this)
I am having a major problem in my new browser app.

Okay so I made game where different cubes (squares) spawn at the top of the screen and I use the Tween class to make them go down the screen and then disappear.

However I want to detect a collision when a cube hits the player (that is also a flying cube).

I tried everything, truly everything but it does not seem to work. The problematic thing is that when I remove the "Tween" function it does detect collision with the hitTestObject method but when I add the "Tween" line collision won't be detected anymore.

The code looks like this:

    function enemiesTimer (e:TimerEvent):void {

newEnemy = new Enemy1();
  layer2.addChild(newEnemy);
  newEnemy.x = Math.random() * 700;
  newEnemy.y = 10;
  if (enemiesThere == 0)
  {
      enemiesThere = true;
      player.addEventListener(Event.ENTER_FRAME, collisionDetection)
  }

  var Tween1:Tween = new Tween(newEnemy, "y", null, newEnemy.y, newEnemy.y+distance, movingTime, true); }

The collision detection part:

private function collisionDetection (e:Event):void
  {

      if (player.hitTestObject(newEnemy))
      {
          trace("aaa");
      }

  }

*Another weird thing is that the collision detection works only in the starting point, where the squares spawn but they aren't really there anymore so I don't quite get it.

I hope someone can answer this and maybe tell me how I can code this. Thanks in advance :)

*I've tried out Tweener & TweenMax as well, the problem is always the same

sentences:
What is the name for the technique to use different palettes for different tiles of a screen? I've found the keywords "subpalette" and "PPU palette", but they seem to be NES-specific. Though the idea of using a small palettes table and use 2 bits per pixel in an image (+ few bits reference to a palette per tile) looks like a cool retro compression method with low decompression drawbacks, so I guess it was used more widely.
Does this technique (of using different palettes for different blocks of pixels) have a name? Does it have a usage apart from NES?

sentences:
How can I make caves with Unity's terrain creator? With Unity's terrain creator, I can't simply make a "hole" on the mesh.

I don't know how I would make cave-like structures other than using "rock" meshes for the roof (wich will indeed look weird) or using portals (wich I always have problems with -- the teleportation isn't thruly smooth and there's always a small "jump". You know, not like a fluid thing.

How can I make caves in terrain with Unity?

sentences: What exactly does Unreal Engine 4's Class Wizard do? I know "it adds classes to your project" and "creates boiler plate code for you" but what does that actually mean? Does it do anything besides properly generate your .h and .cpp files for you?

sentences:
ScreenToWorldPoint: How much depth has to be added to screen point? I am developing a 3rd Person Controller.
The hero's chest should be rotated towards a point on the screen.
To determine the point, I use the following code:
var mousePos = Input.mousePosition;
mousePos.z = 10; // Make sure to add some "depth" to the screen point

var aim = Camera.main.ScreenToWorldPoint(mousePos);

Then I rotate the chest like this:
Vector3 v = new Vector3(0, aim.x, 0);
Chest.Rotate(v);

It does work, but it rotates only minimally, and the the direction is inverted:  If the mouse is on the right of the screen, the chest rotates to the left and vice versa.
Also, I'm not sure how to include the model's overall rotation (but I don't know yet if that is necessary).
Does anybody have any idea what I'm doing wrong?
Edit:
When I add more depth to it, it rotates much more:
var mousePos = Input.mousePosition;
mousePos.z = 100; // Make sure to add some "depth" to the screen point

var aim = Camera.main.ScreenToWorldPoint(mousePos);

But I have no idea how much depth is actually needed.
If I add 1000, it rotates like crazy.
So I would like to know how to calculate the amount of depth that should actually be added to the screen point.

sentences:
Normalizing a homogeneous 3d point As I've seen corruption in geometry, why is it a bad idea to normalize a homogeneous (divide by w) the vertex position returned from vertex shader?

Update

Vertex shader:

// float4 pos : SV_POSITION;
output.pos = mul( mvpMatrix, float4(input.pos, 1) );
output.pos /= output.pos.w; // this line causes the visual corruption below

Three images as I move to the right of a sphere in wireframe. As I get closer the geometry starts corrupting. It seems the geometry immediately around the camera gets the most corrupt.

sentences:
Separate "Battle Character" class from "Character" class? So I have a Class called Character which represents all the player, his companions, and all enemies.  This class does a lot of things including performing actions upon other characters, and upon the environment, and so on.

I'm about to start work on a battle system for this RPG, and there will be the player controlled (and enemy controlled) units which will have a location on the screen, and a delay since their last action, and a ton of other properties and methods that apply entirely to the battle.  But, this thing will also be associated in a one-to-one relationship with a Character which exists separate from a battle.  It will need to access that characters stats for it's battle actions as well as some of it's methods.

So the root of my question is, is it better to create a new "Unit" class, which references the character it's associated with, or should I just expand upon the existing Character class with functions and properties that relate only to a battle?  If it matters I'm writing this in C#.

sentences:
Unity 5 - Occlusion culling at runtime I am creating a game in Unity where the game is rendered while playing. The game is made in a voxel style, and has thousands upon thousands of objects rendered while playing. Of course, this causes a huge amount of lag. Therefor I need to use occlusion culling, to make sure only the objects needed are rendered.

For occlusion culling, you need to bake the area, but I'm planning on creating a huge world. So, any tips on how I could do this?

sentences:
Why does Unity3D crash in VirtualBox? I'm running Unity3D in a virtual instance of Windows, using the Virtual Box software on Linux.  I have guest additions installed with DirectX support.  I've tried using Windows XP SP3 32-bit, and Windows 7 64bit.  My host is Ubuntu 12.04 64bit.

I installed and registered Unity on both.  It loads up fine, and then crashes my entire VirtualBox instance (equivalent of a computer shutting off with no warning).

sentences:
Is there a way to use an arbitrary number of lights in a fragment shader? Is there a way to pass an arbitrary number of light locations (and colors) for the fragment shader, and loop over them in the shader?

If not, then how are multiple lights supposed to be simulated? For example with respect to diffuse directional lighting, you can't just pass a sum of the light weights for the shader.

sentences:
Unknown build errors when building for Android I'm experiencing the following errors when I try to Build + Run to Android and have no idea what to do about them. Can anyone help?

Observed package id 'tools' in inconsistent location 'C:\Users\X\AppData\Local\Android\Sdk\tools.new' (Expected 'C:\Users\X\AppData\Local\Android\Sdk\tools')
UnityEditor.BuildPlayerWindow:BuildPlayerAndRun()
Already observed package id 'tools' in 'C:\Users\X\AppData\Local\Android\Sdk\tools'. Skipping duplicate at 'C:\Users\X\AppData\Local\Android\Sdk\tools.new'
UnityEditor.BuildPlayerWindow:BuildPlayerAndRun()
Transform component could not be found on game object. Adding one!
UnityEditor.BuildPlayerWindow:BuildPlayerAndRun()
GameObject has multiple Transform components! Merged into single one.
UnityEditor.BuildPlayerWindow:BuildPlayerAndRun()
CheckConsistency: GameObject does not reference component MonoBehaviour. Fixing.
UnityEditor.BuildPlayerWindow:BuildPlayerAndRun()
Transform component deleted: GameObject pointer is invalid
UnityEditor.BuildPlayerWindow:BuildPlayerAndRun()
Error building Player: 3 errors
Build completed with a result of 'Failed'
UnityEditor.BuildPlayerWindow:BuildPlayerAndRun()
UnityEditor.BuildPlayerWindow+BuildMethodException: 4 errors
at UnityEditor.BuildPlayerWindow+DefaultBuildMethods.BuildPlayer (UnityEditor.BuildPlayerOptions options) [0x0021f] in C:\buildslave\unity\build\Editor\Mono\BuildPlayerWindowBuildMethods.cs:187
at UnityEditor.BuildPlayerWindow.CallBuildMethods (System.Boolean askForBuildLocation, UnityEditor.BuildOptions defaultBuildOptions) [0x0007f] in C:\buildslave\unity\build\Editor\Mono\BuildPlayerWindowBuildMethods.cs:94
UnityEditor.BuildPlayerWindow:BuildPlayerAndRun()

sentences: How or when to add a copyright notice in published games? I've seen lot of videogame title screens show a copyright notice together with the company name. I'm about to publish my game and I am looking for possibilities or requirements on how or when to add such a copyright notice (including date or year published). Does it apply to both indie game makers and larger companies?

sentences:
Converting normalized device coordinates to world space coordinates flipping my sprites I'm trying to convert my game's camera system to use world space coordinates rather than OpenGL's default normalized device coordinates, however in doing so my sprites are being rendered improperly as you will see in the image below. Using GLM as my math library I have created a 4x4 orthographic matrix with the following code:

m_orthoMatrix = glm::ortho(0.0f, (float) m_screenWidth, (float) m_screenHeight, 0.0f);

I am then performing some translations (and scaling if by chance that is messing with anything) with the following code (m_cameraMatrix is a 4x4 matrix)

vec3 translation(-m_position.x, -m_position.y, 0.0f);
    m_cameraMatrix = glm::translate(m_orthoMatrix, translation);
vec3 scale(m_scale, m_scale, 0.0f);
    m_cameraMatrix = glm::scale(mat4(1.0f), scale) * m_cameraMatrix;

m_scale is a float currently with my testing at value 1.0f. m_position is a vec2 where in the image, the sprite on the right has values (0, 0) and the sprite on the left as values (screen width / 2, 20).

The issue, as you will notice, is that the sprites are rendered upside down, and I can't seem to fix it without getting rid of my translation math and going back to normalized coordinates.

sentences:
glScalef - game math issue I can't get my head wrapped around this issue. The issue is my latest code is making the camera zoom in and out really quickly.

My approach is built on -

http://www.zdnet.com/blog/burnette/how-to-use-multi-touch-in-android-2-part-6-implementing-the-pinch-zoom-gesture/1847?tag=content;siu-container

The opengl scale will be getting the variable - scale.

gl.glScalef(scale, scale, 1);

the distance is obtained by between two fingers, old distance (initial touch points), and new distance (dragging touch points). The zooming in and out works well. However, it would reset glScalef each time the user start using pinch zoom.

scale = newDistance / oldDistance;

I tried calculating by additive ratio. The oldtscale handles the previous distance, if it is same, then it doesn't need to add up anything to scale. The zooming is really quick, I moved the fingers closer by mere 1 cm to 5 cm, zoom goes down or up fast.  I think additive ratio is a bad solution. I think it might be incomplete solution. I'm trying to figure out what's wrong with it.

//additive ratio
tscale = (newDistance / oldDistance) - 1;
                    if(oldtscale == tscale) {
                        oldtscale = tscale;
                        tscale = 0;
                    }
                    else {
                        oldtscale = tscale;
                    }
                            //adding up the additive ratio and scale
                    tscale = scale + tscale;
//checking tscale for limiting the maximum/minimum scale
if(tscale >= 2) {
                        tscale = 2;
                    }
                    else if(tscale <= 1) {
                        tscale = 1;
                    }
                    //supply scale
                    scale = tscale;

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:
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:
How can I retrieve the outer most points on a 2d graph? I have a 2d graph which has some points plotted on it.

What I need to do is get only the outer most points so that I can connect them up (isn't really relevant).

What I can't seem to wrap my head around is the algorithm that I need to use in order to do this?

I think this might help you understand what I want to achieve:

o o o
o x o
o o o

All the o's I want to get and the x I want to ignore. Also, the points can be in any position and any shape but I still want to only grab the outer most points.

Any ideas? Thanks.

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:
Making a physics body so that another body passes through Basically I "think" I want a static body that does not have any density so another body can "pass through it" without getting slowed down. I tried this and it doesn't seem to work. What would be the proper way to do this?

Any version (C,C++, Java) would be fine for an answer.

sentences:
Rope 2D Hinge disconnection I have a game that needs to use a rope-like mechanic should do two things.

Restrict Player's Movement within the length of the rope. In other words, some kind of rubber band that brings the player back to the rope imitating real world.
Rope sections should not go beyond their hinge limits

I'm using the Rigidbody2D.velocity to move the player, the hinges do not stop the player from moving beyond the rope's limits. Thus, causing this visually breaking of the joints.

This is more visible when we flip the player's scale x to -1 since we're moving the player to the left. This also causes the rope segments to spasm or rotate at absurd speeds.

The break force is set to Infinity. I tried looking online for a solution but I'm not entirely sure what joint to use.
These are my hinge settings:

Questions:

How do I fix the rope segments to not have these gaps?
How do I safely flip the player without causing problems in the rope?

sentences:
Is there a way to run a tool script without attaching it to a node in the scene tree? What I want to do is run a tool script on the editor.
The usual way would be to attach it to a scene tree node, but then I'd have to guard it with ifs all over to prevent editor code to be run at runtime and viceversa.
I could instantiate the script and run it directly without it being attached to a node, but the script that instantiates that script would have to be tool too, so not getting rid of the problem.
I guess I could create a node in the scene tree with a tool script attached, that removes itself from the scene tree once the game is running.
Is there a more elegant way of doing it?
Like some kind of project setting to run a tool script on project load?

sentences:
What do potential employers look for in a good portfolio? A buddy from work and myself are wanting to get into the indie scene for game development. I've done a few tech demos demonstrating different ideas and approaches for various problems. Now, I feel it's time for us to commit to a project in order to develop a portfolio for later down the road.

I've been struggling greatly with how to begin an actual project, more specifically to create an engine or use an OTS package, or use one then create one, or create one then use one.. etc.

Which looks better to potential employers? A smaller portfolio of games that includes your engine or a (possibly) larger one that was built using something OTS?

I am a programmer. I'm not an artist. I will be performing most of the programming for this project. My buddy is also a developer, but he is also proficient with graphical tools (thus, he becomes the art guy).

At work, we are both .NET developers (C#). I know, I know "Well then use XNA" some will yell at me. The demos I've completed thus far have been in XNA. But I have some concerns with building an XNA portfolio. While it is nice to abstract DirectX, I worry that I may not build the necessary knowledge base to extend beyond XNA easily. The counter to that argument is probably "you can more easily move on to DirectX after XNA", but since I will   move careers from Business Development to Game Development, is it even worth while to focus on XNA currently? Or will potential employers giggle when I say XNA?

Should I embrace the experience of XNA knowing the concepts and lessons learned will mostly transfer? Or spend my most valuable resource (time) else where?

Looking for some advice from any industry vets out there.

sentences:
Public value null after assigning it from a different script Hello I am a beginner in Unity and still currently exploring with scripts.
So I ran into a problem.

In FetchAndAssign.cs Script

    void Start(){

         GameObject theEdge = GameObject.Find("Edge2");
         StallComponentAdder edge = theEdge.GetComponent<StallComponentAdder>();
         edge._id = _id;

    }

In StallComponentAdder.cs Script where it is attached to Edge2 GameObject

    public string _id;

    void Start () {
         string storeID = _id;
         print(storeID);
    }

When I try to print the storeID it won't print anything, why is that so?

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:
How long till HTML5 canvas becomes a viable game development platform? So I have been working on web application. So invariably what it boils down to is making simple games which were previously based on flash or openGL. Now I know apple was moving away from flash because its proprietary unlike their stance that its got "pathetic performance"!
Not true, try playing a canvas game, I can assure you at any point of time (including when its idle) it will use up a fair bit of processing power just to redraw the UI. Now I do understand that this is my fault because when the game is not active I should not be redrawing the canvas, but honestly its a lot of work and I suppose there should be libraries which should be able to assist me with that! So, how much will it be before I see a decent canvas library which handles these "tiny" issues for me? I can't honestly expect Steve Jobs to be doing anything more for HTML5!
I someone knows of a good library, I am all ears...! :)

PS: I use mootools and am presently using Mootools Canvas Library.

sentences:
Unity Performance: Recycling Pooled Objects OR Re-Instantiating? Re-using pre-instantiated objects in a pool.
Destroying then re-instantiating objects in a pool.

Both pools are limited.

When creating loads of objects which is better for performance?

sentences:
LibGDX drawing map using tiles without space I am making a board game. To draw the map on the board I use different tiles.
On some screen the map looks good but on some other screens there is a space between the tiles.
How can I do so there won't be any space between the tiles?

I am designing my game with the size 480x800. To fit other screens I stretch it.

My tiles looks like this:

I draw the map using a for loop to draw the tile in different (x,y) position on screen.

Here is what I mean with space between tiles:
Screen with 240x400

Screen with 360x600, here there is no spacing between tiles.

I use camera and the screen to draw I don't use stage. I have also tried to use Viewport but I get the same results.

  cam = new OrthographicCamera();cam.setToOrtho(true, gameWidth, gameHeight);
  batcher = new SpriteBatch();
  batcher.setProjectionMatrix(cam.combined);
  shapeRenderer = new ShapeRenderer();
  shapeRenderer.setProjectionMatrix(cam.combined);

How can I do to solve the problem?

sentences:
What are the basic equations in 2D physics collisions? I'm making a 2D fighter, and I have gotten a basic engine, but right now I need to add the collisions, but I'm sure a basic AABB check will not be enough.

I'm sure it needs some basic 2D physics equations, but every resource I see on the web is extremelly complex or try to teach you everything you need to know to make a 2D physics engine.

So far, I'm sure it's related to momentum and forces, but don't know if those are enough for a 2D collision in a fighting game and what are the simplest ways to implement them.

sentences: Am I allowed to use a real life celebrity in a game? In previous questions many users asked whether or not an athlete can be used in a game. Yet the answer was no due to multiple copyright their images and names had. However anyone can use a politician's name and physical appearance due to the fact that they are "public figures" (example: Obama). In this case, I want to use famous game developers such as Kojima and Gabe Newell in a game. Am I allowed to use them? or should I make references to them using distinct names (I.E. Lord Gaben). How can I find out whether or not a person is a "public figure" and if their appearance/name is protected?.

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:
D3DX11CompileFromFile() function problem DirectX11 What do i have to include to use the D3DX11CompileFromFile() function on DirectX11? I'm using visual studio 2015 and reading the "3D Game programming guide" (Frank Luna) and i'm having problem using that function, any solutions?
I read online that is not usable anymore and that now i have to use the D3DCompileFromFile() function, but i have no idea how to do it

sentences:
Screen record in unity3d How to do screen record in unity? I want to record my screen(gameplay) during my running game. That should be play/stop , replay , save that recording on locally from device, open/load from my device (which is already we recorded).

In my game one camera which can capture native camera, and one 3d model.

I wish to record that both and use my functionality whenever i want.

Thank you in advance.

sentences:
Why is my picture distorted after switching from D3D9 to D3D11? I have moved app from Directx9 into Directx11.

After this upgrade strange thing happened with my world. Objects get skewed and became 2D, also they are clipped in unexpected places.

The two arrows at the image I attached point to my HUD reference frame - three nice cones, arranged to point along the 3 axes, which are supposed to be shown in the lower left corner of the window.

Also you can see that sphere got clipped in difference positions and all objects are 2D. There side and front view. Thanks for your suggestions.

Need to point out that sphere is moving.

I use XMMatrixPerspectiveFovLH to get projection matrix.

Example of matrices:

World
2  0  0  0
0  10 0  0
0  0  1  0
0  0  10 1

View - Identity

Proj
1.72 0    0   0
0    2.41 0   0
0    0    1.  1.
0    0   -1.  0

Both previous images are wrong rendered. Just side view and fromnt view of wrong rendering.
Thanks to Tordin i got this:

This one is almost correct, only some problems with culling in cones which form reference frame.

EDIT: Question was answered, but nobody wants to frame his comment as an asnwer. First was

  Tordin:  transpose your matrices. All of them, World, View,
  Projection. DX11 is Row major and not Colume major like dx9 was

sentences:
How to create groups in libGdx? Can any of you please demonstrate a simple example on how to use groups in libGdx ? so if i move the parent, then all the children will move with it and same goes for rotation and scaling.

I looked for tutorials and example online but it seems that the latest version of libGdx did some changes to the Stage class.

Thank you

sentences:
File format for static and animated 3D models I'm currently writing a 3D game in C++ with OpenGL and I'm coming to the part where to load 3D models in. Therefore I'm looking for popular file formats and techniques to

display static meshs and
render animated meshs.

I've already found quite a large number of possible formats and techniques, like keyframe animations, skeletal animation, MD2 up to MD5, 3DS, X, Collada etc. pp.

For simplicity I'd like to use a format (and technique) that allows both, namely static and animated meshs. So my question is if one format is suitable for that task and which one you'd suggest. And to clarify a bit: I don't need super-smooth animations or brandnew features.

Sidenote: Because I'm a blender fan (but not an expert ;-)) it'd be helpful if it can be used with that -- but of course that shouldn't be the show stopper, here.

sentences:
Strange effects (inadvertently dividing edges) when doing Maya's extrusion Firstly, I thought this was the best place to post my question, since there isn't a Maya section or a generic 3-D modeling section, as far as I saw.

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

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

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

Thanks

sentences:
Unity WebGL not loading on chrome I've made a simple game but when I tried to load this on chrome its not loading.

I am building for WebGL (HTML 5). I am getting these errors when the page loads.

Unity version - 5.3.1f1   Chrome version - 47.0.2526.106 m

Its working fine on firefox .

XMLHttpRequest cannot load file:///C:/Users/Public/Documents/Unity%20Projects/Box%20Shooter/HTML5%20Builds/Release/HTML5%20Builds.js. Cross origin requests are only supported for protocol schemes: http, data, chrome, chrome-extension, https, chrome-extension-resource.LoadCompressedFile @ UnityLoader.js:1
UnityLoader.js:1 XMLHttpRequest cannot load file:///C:/Users/Public/Documents/Unity%20Projects/Box%20Shooter/HTML5%20Builds/Release/HTML5%20Builds.jsgz. Cross origin requests are only supported for protocol schemes: http, data, chrome, chrome-extension, https, chrome-extension-resource.DecompressAndLoadFile @ UnityLoader.js:1
UnityLoader.js:1 XMLHttpRequest cannot load file:///C:/Users/Public/Documents/Unity%20Projects/Box%20Shooter/HTML5%20Builds/Release/HTML5%20Builds.mem. Cross origin requests are only supported for protocol schemes: http, data, chrome, chrome-extension, https, chrome-extension-resource.LoadCompressedFile @ UnityLoader.js:1
UnityLoader.js:1 XMLHttpRequest cannot load file:///C:/Users/Public/Documents/Unity%20Projects/Box%20Shooter/HTML5%20Builds/Release/HTML5%20Builds.memgz. Cross origin requests are only supported for protocol schemes: http, data, chrome, chrome-extension, https, chrome-extension-resource.DecompressAndLoadFile @ UnityLoader.js:1
UnityLoader.js:1 XMLHttpRequest cannot load file:///C:/Users/Public/Documents/Unity%20Projects/Box%20Shooter/HTML5%20Builds/Release/HTML5%20Builds.data. Cross origin requests are only supported for protocol schemes: http, data, chrome, chrome-extension, https, chrome-extension-resource.LoadCompressedFile @ UnityLoader.js:1
UnityLoader.js:1 XMLHttpRequest cannot load file:///C:/Users/Public/Documents/Unity%20Projects/Box%20Shooter/HTML5%20Builds/Release/HTML5%20Builds.datagz. Cross origin requests are only supported for protocol schemes: http, data, chrome, chrome-extension, https, chrome-extension-resource.

Why its not loading up on chrome ?

sentences:
Game Maker Studio Gravity Problems I've started messing around with Game Maker Studio. The problem I'm having is trying to get a gravity code for orbiting.

Here's how i did it in XNA

        foreach (GravItem Item in StarSystem.ActiveItems.OfType<GravItem>())
        {
            if (this != Item)
            {
                Velocity += (10 * Vector2.Normalize(Item.Position - this.Position *
                    (this.Mass * Item.Mass) / (Vector2.DistanceSquared(this.Position,
                    Item.Position)) / (this.Mass));
            }
        }

Simple and works well, things or bit and everything is nice.

but in Game maker i don't have the luxury of Vector2's or a For-each loop to loop threw all the objects that have a
mass. I've tried a few different things but nothing seems to work

distance = distance_to_object(obj_moon);

//--Gravity
hspeed += (0.5 * (distance) * (Mass * obj_moon.Mass) / (sqr(distance)) / Mass)
vspeed += (0.5 * (distance) * (Mass * obj_moon.Mass) / (sqr(distance)) / Mass)

thanks for the help

sentences:
VBOs no longer renger when gluPerspective applied I've written a basic program so I can make sure I'm properly learning VBOs before converting my 3d game's rendering to them.

Essentially, this question is why changing the perspective is the GL setup code stops my triangle from rendering:

GLU.gluPerspective(60f, (width/height), 0.1f, 200.0f);

Wihout that code, the triangle renders as expected. With it, only an empty screen is visible. I tried changing the triangle vertices but nothing worked. This may help explain why the VBO rendering isn't working in my game.

I've spent more time reading about gluPerspective but I'm not catching why it prevents the images from rendering.

My display/gl init code:

// Init display
Display.setResizable(true);
Display.setTitle( Game.name );
Display.setVSyncEnabled(true);
Display.setDisplayMode(new DisplayMode(Game.GAME_WIDTH, Game.GAME_HEIGHT));

// Set viewport
PixelFormat pixelFormat = new PixelFormat();
ContextAttribs contextAtrributes = new ContextAttribs(3, 0);
Display.create(pixelFormat, contextAtrributes);
glViewport(0, 0, Display.getDisplayMode().getWidth(), Display.getDisplayMode().getHeight());

glClear(GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT | GL_STENCIL_BUFFER_BIT);

glViewport(0, 0, Display.getWidth(), Display.getHeight());
glMatrixMode(GL_PROJECTION);
glLoadIdentity();

GLU.gluPerspective(60f, ((float) Display.getWidth() / (float) Display.getHeight()), 0.1f, 200.0f);
glMatrixMode(GL_MODELVIEW);
glLoadIdentity();

I have a simple triangle drawing class that uses and interleaved VBO

triangleTesselator.addVertex(-0.5f, -0.5f, 0f);
triangleTesselator.addColor(1, 0, 0);

triangleTesselator.addVertex(+0.5f, -0.5f, 0f);
triangleTesselator.addColor(0, 1, 0);

triangleTesselator.addVertex(+0.5f, +0.5f, 0f);
triangleTesselator.addColor(0, 0, 1);

triangleTesselator.render();

I also tried several different vertex coords thinking the 0 was behind the clipping (near) plane of the perspective but that didn't work.

Update: I've added a basic camera system to this rendering test app, and after looking around a bit I've found the rendered cube behind me...

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: XNA- Rotating around another model Lets say I have a model with multiple meshes. Mesh A is at position PositionA = new Vector3(5,0,10). And mesh B is at position PositionB = new Vector3(7,0,9). How can I rotate mesh B around meshes A pivot point, or its centre?

sentences:
Unity3D - Upload a image from PC memory to WebGL app I need user to upload his(her) avatar picture from PC to game

How can I create a file dialog and upload a image to WebGL game?

sentences:
Random seed function for map generation? I am looking for a function to generate a random tile-based map as the visual boundaries of the map change (by going through the map). I want the map to be infinitely large, and have maze-like structure.

However, if the world is infinite, going back to where a player has already been before raises a problem. The game must remember how everything back there actually looked like.

So, I was thinking - "How does Minecraft solve this issue?" and I thought to myself that they must be using some kind of random-number function with a seed, that can both go forward but also backwards, and in that way, re-generate old tiles exactly as they were, but in new instances.

What are your thoughts on this?

sentences:
How to rotate blocks in tetris I have a gameboard grid which is 20 rows high and 10 columns wide with the origin (0,0) being in the top left hand corner.
I have a tetrimino in play, which is composed of four blocks.
I have the x,y location of each block relative to the top left hand corner origin.
I also have the position of the pivot, the point around which I wish to rotate which is relative to the top left hand corner origin.

Each block has an integer position in a gameboard square and thus the pivot has a fractional position inbetween blocks e.g (10.5,10.5)

My question is: Which formula can I use to rotate each block around the pivot?

I have already looked at existing similar questions and answers but could not find an answer that I could get to work.

Help would be much appreciated.

sentences:
My Earthbound-like Movement Script works in Unity Gameview, but runs differently in Gamebuild First programming question I've ever made in my short journey. I'm trying to create a script which moves members of your party in a line behind you (think Chronotrigger or Earthbound). Here's a clip of what I want it to look like.
Problem:
Everything looks fine in the Game window when I play, but when I build the game to test, the characters begin to stack one on top of each other. I assume it has something to do with Update() frames dramatically increasing the frequency with which I enqueue the positions of the leading character (although I'm not experienced enough to say for sure, clarification on this would be helpful).

I've tried increasing the offset, but this solution is variable
depending on the players computer fps so that wont work.
I've tried running both scripts in FixedUpdate() but a lot of my other
systems run on Update() and so everything stutters.
I've tried enqueue'ing from an IEnumerator and waiting for .1 second
between each enqueue but that stutters as well..

What I'm doing:
The leading character has a script called PlayerTrail which creates a Queue of Vector3s. In Update the game object's transform.position is enqueued. The following character has a script called PlayerFollower which looks at the Queue and Vector3.MoveTowards the position, then dequeues that position and repeats. Each character only looks at the trail of the character in front of it.
Everything seemingly works fine and well in the Unity program, this issue only arises once I build the actual game.
Code Supplied Bellow:
using System.Collections;
using System.Collections.Generic;
using UnityEngine;

public class PlayerTrail : MonoBehaviour
{
    public Queue<Vector3> LeaderTrail;
    public Vector3 LastMovement;

    private void Start()
    {
        LeaderTrail = new Queue<Vector3>();
    }

    private void  Update()
    {
        if (this.transform.position != LastMovement)
        {
            LastMovement = transform.position;
            LeaderTrail.Enqueue(this.transform.position);
        }

    }
}

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

public class PlayerFollower : MonoBehaviour
{
    public GameObject leaderObject;
    public int Offset;
    public int moveSpeed;

    private PlayerTrail leaderTrail;
    private Animator animator;

    void Start()
    {
        animator = gameObject.GetComponent<Animator>();
        leaderTrail = leaderObject.GetComponent<PlayerTrail>();
    }

    void Update()
    {
        if (leaderTrail.LeaderTrail.Count < Offset)
        {
                animator.SetBool("isMoving", false);
                return;
        }
        else
        {
            Vector3 direction = (leaderTrail.LeaderTrail.Peek() - transform.position).normalized;
            this.transform.position = Vector3.MoveTowards(this.transform.position, leaderTrail.LeaderTrail.Peek(), moveSpeed * Time.deltaTime);

            animator.SetBool("isMoving", true);
            animator.SetFloat("moveX", direction.x);
            animator.SetFloat("moveY", direction.y);

            Debug.DrawRay(this.transform.position, direction);

            leaderTrail.LeaderTrail.Dequeue();
        }
    }
}

sentences:
Unable to access jar. Why? I was making a game in java and exported it as jar file. Then after that, I opeed jar splice. I added the libaries and exported jar. I added the natives then i made a main class. I created a fat jar and put it on my desktop. I'm using Mac OS X 10.8 Mountain Lion. When I put in the terminal, java -jar System Front.jar it says unable to access System Front.jar Even if i double click on the file, it doesen't show up! Help! I'm using slick.

I added slick and lwjgl as libraries for the jar splice at the jars.

sentences: Tron type game AI algorithm Im looking for a tron AI algorithm on snap!/scratch. If not can you help me develop an AI for this game?

sentences:
How to output to the Oculus and a 2D screen? We'd like to present an Oculus game to a large group of people. Not everyone will have an Oculus headset, so we'd like to output to both the Oculus and a second display. The problem is that the project uses an Oculus plugin to render its output, so all they output is two distorted circles, which doesn't display well when not wearing the Oculus headset.

I thought of making a second Unity client (the "audience" client, running on the same computer as the Oculus application) that receives the output texture of an "audience" camera from the client running the Oculus version.

My question is: Can I use the network to send the output of a camera to the "audience" client so I can set it up for the second display, bypassing the Oculus plugin? How would I get the input on the "audience" client to map it to the screen?

sentences:
OnTriggerExit2D called multiple times when two triggers touch I have two GameObjects tagged "Point", each with a Collider 2D set to Is Trigger.

I have another GameObject, "pencil", which also has a Collider2D set to Is Trigger

I want to move the pencil the first point to the start drawing a line, and then stop drawing when it hits the second point.

My problem is that when the pencil hits a point, it calls OnTriggerExit2D multiple times. How can I only detect first contact with the point?

Pencil script:

private void OnTriggerExit2D(Collider2D collision)
{
    if (!collision.isTrigger)
    {
        if (collision.gameObject.tag == "Point")
        {
            writing = !writing;
        }
    }
}

sentences:
Double sides face with two normals I think this isn't possible, but I just want to check this:

Is it possible to create a face in opengl that has two normals?

So: I want the inside and outside of some cilinder to be drawn, but I want the lights to do as expected and not calculate it for the normal given. I was trying to do this with backface culling off, so I would have both faces, but the light was wrongly calculated of course. Is this possible, or do I have to draw an inside and an outside? So draw twice?

sentences:
How to move player out of multiple penetrating colliders? The player in my game can teleport like Noctis from ffxv.The player shots a weapon projectile and then teleports to the projectile. I'm using raycast to calculate the weapon position after thrown. However, I need to check if the weapon is stuck in an unteleportable position after being thrown. It is possible to have multiple penetrating colliders. Ex: spear gets sandwiched between two walls that is narrow enough for the weapon to pass through but not tall enough for the player to stand. I want to somehow check for a nearby valid position for after teleporting in that situation.

I also want the teleport to fail if the weapon is horizontally in the middle of the "pipe".

I could do a bunch of overlapBox checks within a radius distance from the teleport point but that doesn't seem efficient. I want to give the player some leeway when aiming a teleport.

Also, the teleport is not immediate. The player can wait some time before teleporting to the weapon. So it is possible for a moving platform to block a raycast from the player. In which case I still want the raycast to succeed.

I'm using unity and a custom raycast based 2d character controller for normal movement.

sentences:
Redeeming an item on a periodic basis I want to allow a user to redeem a token every X time (i.e. 24 hours). Once they redeem it, they must wait X time again before redeeming the next item. This ensures that users must visit the app daily to continue gaining tokens.

I'm not sure how to work with clock differences between machines. What if

Server B:      9:03:41
User A tablet: 9:03.59
Server C:      9:05:23

(assume they all have the same date and all are AM)

User A's tablet makes a request and server B response with "Token available". The user then tries to immediately redeem the token, but server C responses with "Sorry, token not yet available." This would obviously be annoying to the user.

I could potentially handle this on the server. If the server says a token is available, then set a flag that actually guarantees that it is available.

But what if I want to actually let the user know how much time is left before they receive their next token. If all the servers have a different clock time, then all requests for time left would return a slightly different time.

I don't think I could rely on client time, since the user may play with different devices.

How could I handle this?

sentences:
Why when destroying objects when quitting the game it's destroying the objects only in hierarchy? In one script i did:

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

public class GameManager : MonoBehaviour
{
    public LevelGenerator levelGenerator;

    // Use this for initialization
    void Start ()
    {

    }

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

    }

    private void OnApplicationQuit()
    {
        levelGenerator.DestroyNodes();
    }
}

Then in the other script:

public void DestroyNodes()
    {
        GameObject[] nodes = UnityEngine.GameObject.FindGameObjectsWithTag("Node");

        if (nodes.Length == 0)
        {
            //Debug.Log("No nodes to destroy found");
        }
        else
        {
            for (int i = 0; i < nodes.Length; i++)
            {
                DestroyImmediate(nodes[i]);
            }
        }
    }

But the Nodes still exist in the Hierarchy and in the Game and Scene views.

I used a breakpoint it's getting to the OnApplicationQuit

And it's getting to the line:

DestroyImmediate(nodes[i]);

There are 100 objects and it's doing the line for each object.
But then when i make continue they are still exist.

I want that when i quit the game stop the play all the gameobjects to be destroyed.

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:
Character controller passes through mesh collider I need a little help figuring out what's going on with an NPC's character controller. Here are the character controller settings for the NPC.

The problem I'm running into is that the NPC isn't walking up a slight gradient as it should; instead, it moves through the ground.

Below are the settings for the ground.

The NPC isn't on the ground- it is a few units off. Any help is greatly appreciated.

Thanks in advance...

sentences:
How can I rotate my picture using Pygame? I want to make the Dragon on the picture rotate softly to the left when he flies to the left and rotate to the right when he flies to the right and up and down also.

How can I do that with the WASD keys? The Dragon can fly already up, down, lef, and right....but he doesn't turn...
My Code:
import pygame, sys
from pygame.locals import *

pygame.init()

size = width, height = 1600, 848
speed = [2, 2]
black = (0, 0, 0)

pygame.mouse.set_cursor(*pygame.cursors.broken_x)

screen = pygame.display.set_mode(size)
background = pygame.image.load("background.PNG")
dragon1 = pygame.image.load("dragon1.gif")
x,y=0,0
clock=pygame.time.Clock()
speed=250
movex, movey=0,0

while True:
screen.blit(background, (0,0))
screen.blit(dragon1, (x,y))

for event in pygame.event.get():
    if event.type == QUIT:
        pygame.quit()
        sys.exit()

if event.type==KEYDOWN:
        if event.key==K_a:
            movex=-4
        elif event.key==K_d:
            movex=+4
        elif event.key==K_w:
            movey=-4
        elif event.key==K_s:
            movey=+4
if event.type==KEYUP:
        if event.key==K_a:
            movex=0
        elif event.key==K_d:
            movex=0
        elif event.key==K_w:
            movey=0
        elif event.key==K_s:
            movey=0
x+=movex
y+=movey

pygame.display.flip()

sentences:
Detecting "Any Button Press" I'm trying to allow the player to press any button to continue from the main page. I was able to do this by making a List of Buttons and looping through these and checking for one of them being down; however, I feel like this code is kind of ugly and wonder if there's a simpler way to do it that I'm just not thinking of?

Here's my what my code looks like now:

            if (GamePad.GetState(PlayerIndex.One).IsConnected)
            {
                var buttonList = new List<Buttons>()
                {
                    {Buttons.A},
                    {Buttons.B},
                    {Buttons.Y},
                    {Buttons.X},
                    {Buttons.Start},
                    {Buttons.Back},
                    {Buttons.RightShoulder},
                    {Buttons.LeftShoulder},
                    {Buttons.RightTrigger},
                    {Buttons.LeftTrigger}
                };

                foreach (var button in buttonList)
                {
                    if (GamePad.GetState(PlayerIndex.One).IsButtonDown(button))
                        ExitMainMenu= true;
                }
            }

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:
When importing a character to Unity, textures and meshes don't appear I'm relatively new to Unity, and I'm left with doing this as my last step towards my task - importing my animated character to a game engine and program the movements.

The problems that I have noticed are the missing textures and meshes, you can see in the first picture how it should look like in Blender, and what results I get in Unity:

The apple here doesn't have any holes, I think only one material got imported, and it doesn't look right. Textures are missing, the leaf near the stem is completely filled with gray texture. At least the animations work perfectly...

Download link to my .blend file - https://pasteall.org/blend/6c14ec0d9446404b81251585f83f3551

sentences:
Avoiding audio transcoding in Unity? I'm working on a project where I only have access to MP3s versions of audio tracks I'd like to use. Unity  is trying to be helpful and recompressing everything as Vorbis, which is not ideal due to quality loss. Even if I override the audio clip settings and set it to use MP3, Unity still transcodes the file for me, resulting in quality loss. I can set the clip to PCM, which would avoid re-encoding the file into another lossy format, but the resulting file size is too large to be practical.

In a perfect world I would have WAV versions of all the tracks I want to use, but that is not the case. Is there anyway to tell Unity to use the file the way it is and to leave it alone and not recompress it?

For the record I am using Unity 5.3.1 and my project target is iOS.

sentences:
simplest way of making a sphere roll in a realistic way rather than just moving a sphere across a plane, I want to make it roll like a ball. What is the simplest way of doing this? I assume it will have something to do with the circumference of the ball and rotating + moving it at a calculated rate.

What is the relevant maths here?

sentences:
What causes SDL2 error 0xc00007b when running my game on other people's computers? I made a game using SDL2 and made it available for download.
However, I first tried to install and play it on a different computer, to no avail. I made sure to copy all the .dlls and install all the runtimes, yet I still get error 0xc00007b.

Am I doing something wrong?

sentences:
LineRenderer not working using Vuforia in Unity So I'm trying to render a line that shows up when camera sees an image target and moves around with it. Very typical AR application. But my line renderer doesn't seem to show at all.

Here's the code:

using UnityEngine;
using System.Collections;

public class myLine : MonoBehaviour
{
    // Creates a line renderer that follows a Sin() function
    // and animates it.

    public Color c1 = Color.yellow;
    public Color c2 = Color.red;
    public int lengthOfLineRenderer = 20;

    void Start()
    {
        LineRenderer lineRenderer = gameObject.AddComponent<LineRenderer>();
        lineRenderer.material = new Material(Shader.Find("Particles/Additive"));
        lineRenderer.widthMultiplier = 0.2f;
        lineRenderer.positionCount = lengthOfLineRenderer;

        // A simple 2 color gradient with a fixed alpha of 1.0f.
        float alpha = 1.0f;
        Gradient gradient = new Gradient();
        gradient.SetKeys(
            new GradientColorKey[] { new GradientColorKey(c1, 0.0f), new GradientColorKey(c2, 1.0f) },
            new GradientAlphaKey[] { new GradientAlphaKey(alpha, 0.0f), new GradientAlphaKey(alpha, 1.0f) }
            );
        lineRenderer.colorGradient = gradient;
    }

    void Update()
    {
        LineRenderer lineRenderer = GetComponent<LineRenderer>();
        var t = Time.time;
        for (int i = 0; i < lengthOfLineRenderer; i++)
        {
            lineRenderer.SetPosition(i, new Vector3(i * 0.5f, Mathf.Sin(i + t), 0.0f));
        }
    }
}

and here's my set up:

I also tried attaching the script directly to the ImageTarget and nothing happened.

sentences:
Prime31 Plugin Error : "Plugin 'P31RestKit.dll' is used from several locations" I got the following error, when i tried to install "Prime31: MicrosoftAds_2015-04-22" plugin in Unity 5

Plugins colliding with each other
Plugin 'P31RestKit.dll' is used from several locations: Assets/Plugins/P31RestKit.dll would be copied to /P31RestKit.dll, Assets/Plugins/WSA/P31RestKit.dll would be copied to /P31RestKit.dll .Please fix plugin settings and try again.

Thank you

sentences:
Filling up the empty blocks when the player touches the safe zone again! using cocos2d Hi guys i am stuck with filling up the data of all the blocks which are empty like the ones in the image.
 As you can see there i have a pacman like object where i will be moving around.

But when you are in the empty space where there are no Blue boxes available i should be able to add new blocks in the path of my pacman and when it touches  any other blue boxes like in the below case if my pacman touches the top row of the blue box i should be able to fill all the empty boxed inside the border of the path created by pacman.

For now i am using a 2d bool array to store all the filled boxed info like if there is a box inside i am making that cell in an array as true.

But how to fill the area with blue boxes after player finishes his path ?

Any help would be great thank you.

More info about this problem is here:
filling the empty spaces in a certain region in a grid using c++   Same problem

sentences: Repeating UVs wont convert to texture in maya I have designed a material in Maya which i want to convert to a texture jpg, however i have repeating the UV's on the material. When i convert the material to a jpg the repeating UV's wont convert across. Is there anyway i can get them too?

sentences:
What is the meaning of this line algorithm? I have been looking at codes of several open source 2d games and I have found this function.

GetLineCollisionHit(Vector2 Position1, int Width1, int Height1, Vector2 Position2, int Width2, int Height2)
    {
      int tile1X= Position1.X + Width1 / 16.0);
      int tile1Y= Position1.Y + Height1 / 16.0);
      int tile2X= Position2.X + Width2 / 16.0);
      int tile2Y= Position2.Y + Height2 / 16.0);
        do
        {
          int dx= Math.Abs(tile1X- tile2X);
          int dy= Math.Abs(tile1Y- tile2Y);
          if (tile1X== tile2X && tile2Y== tile1Y)
            return true;
          if (dx> dy)
          {
            if (tile1X< tile2X)
              ++tile1X;
            else
              --tile1X;
            (check collision)
          }
          else
          {
            if (tile1Y< tile2Y)
              ++tile1Y;
            else
              --tile1Y;
            (return true if collision)
          }
        }
        while (true);
        return false;
    }

What is really checking is if there is any collision of solid tiles between two points, for this look for the line between the two tiles. But I do not know if it is a coding problem since it is not implementing neither Bresenham's line algorithm nor DDA or similar. So what are you trying to find in this line dx>dy? What sense does it have to advance x while x > y since that way a line is not correctly created.

sentences:
How do I implement my old OpenGL-based gfx_render_triangle_list using DX11? I am working at a game that has lots of procedural content. I had built a game engine using OpenGL that handles everything needed for creating a basic 2D game, sprites, primitives, blending, polygons etc. At a particular moment I decided to implement target textures to obtain interesting effects and problems started to arise: Sometimes the engine did not initialize OpenGL and GLEW properly and could not isolate the exception. Finally I abandoned the idea of using OpenGL because of similar issues (SOMETIMES cannot use newer GLEW functions...NOTE:drivers up to date). I decided to use DX11 instead and take benefit from the new technologies of the latest GPUs. So I did. Now I am porting my engine to DX11 and I am quite stuck.

I had procedures to be called in a render() function, like:
engine->gfx_render_triangle_list(pointer)
which in principle just called a procedure like

glBegin(GL_TRIANGLES);
...
glVertex2f(.....);
...
glEnd();

Now the problem that arises for me is the new pipeline of DX11. Load up vertices in the VertexBuffer, process them by the VertexShader then fill them with pixels and transform with the PixelShader. This is great as I have full access to what is being displayed on the screen, but, how do I do it the 'old-fashion' way?

I mean, how do I draw primitives like in OpenGL, each frame sending unique, new triangles to the screen. I didn't find any resources that explain this and I cannot think this through myself, loading some vertices in the vertex buffer is designed for meshes that are human made and static and they are only transformed by the shaders.

Long story short: How do I implement my old gfx_render_triangle_list using DX11?
NOTE: My engine will be used as a DLL.

sentences:
How to determine size of art assets for Unity UI? Previously when I made games, I used ui assets from the asset store. Working with those assets was easy as the backgrounds were plain. However, I'm now working on a game where custom graphics are used for UI. So, I need to specify size of backgrounds,icons etc to the art team. I understand how aspect ratio works with regards to unity camera, but having trouble understanding the relation between camera size and Canvas. For example, for a camera size of 4.6, an image size of 517X920 will cover the whole screen in 9:16 aspect. However, the same image is considerably larger when used as UI image under the Canvas.
Can someone please help me understand how Canvas deals with image sizes?

sentences:
Virtual Economy Setup - Virtual currencies advice I'm trying to figure out how to build my virtual economy. It seems like some games have one currency and some of them have up to 3 and 4 different ones.

The game is an action game which is currently single player but I'm planning on adding a tournament mode that allows users to compete against each other. The virtual goods that a user would be able to purchase would be either customization to the character or powerups and utilities that give the character more abilities in the game. The character is able to gain coins during game play.

The advice I'm trying to get is whether or not it makes sense to set up more than one currency and more than two currencies? What are the pros and cons?
Reference to some resources that indicate research would be great.

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:
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:
Ranking system for "offline" game? I'm currently developing a game where players will be able to battle each other, not in real time, but offline, in a way where both players doesn't have to be online. This might seem like a bad idea, but it makes sense in the context of the game.

Right now I'm trying to create some kind of ranking system, where the outcome of the match only affects the player who initiated the match, since I don't want players loosing rank when they're not playing.

A simple idea would be to award the player 2 points for winning and take away 1 for loosing.

I honestly have no idea if this design would work, so I come here to get some suggestions on how to design system like this. Thank you.

sentences:
Modular spaceship control I am developing a physics based game with spaceships.

A spaceship is constructed from circles connected by joints. Some of the circles have engines attached.

Engines can rotate around the center of circle and create thrust.
I want to be able to move the ship in a direction or rotate around a point by setting the rotation and thrust for each of the ship's engines.

How can I find the rotation and thrust needed for each engine to achieve this?

sentences: Constant buffer content packing I've read this: http://msdn.microsoft.com/en-us/library/windows/desktop/ff476898%28v=vs.85%29.aspx#Shader_Constant_Buffer but there's not much information in it. When creating a constant buffer do I have to worry about what I put in it and in what order? Do I have to stick to a multiplicity of some power of 2 in bytes or something?

sentences:
I want a variable/field to only be declared when a specific condition is true. I used Compiler Directives. Is the code I wrote valid? I want a field I declared (float attackRange) to be only declared when inheriting class set "bool haveLongRangeAttack" is set to true. I wanted to use Compiler Directives for this purpose. Here is the code I wrote;

using UnityEngine;

public abstract class Enemy<T> : MonoBehaviour where T : Enemy<T>
{
    [SerializeField] protected bool haveCloseRangeAttack = false,
                                    haveLongRangeAttack = false;
#if haveLongRangeAttack == true
    [SerializeField] protected float attackRange = 1f;
#endif

    [SerializeField] protected GameObject mainCharacter = null;
    protected GameObject enemy = null;

    protected virtual void ChasePlayer()
    {
        if(haveCloseRangeAttack)
        {
            //...
        }
        else if(haveLongRangeAttack)
        {
            //...
        }
    }
}

I don't know if it is right way to/of do what I want or using Compiler Directives so please review my code and tell me if there is a problem, or if there is a better way.

It was before 6 months when I started writing code, and C was my first language. I am trying to learn new things/concepts and writing at my own style. So there will be another way (maybe more efficient); if there is one, please teach me. I'm working on my own Game Project right now, I'm open to learn new things that will benefit me...

TY for taking time ^.^!

PS:There is no compiler-directives tag in Tags section. Maybe it will be useful to add this tag.

sentences:
Blender & Unity - Move texture with Bone in way that works with Unity? I created a character model in Blender with non-spherical eyes. The only way I can make the eye movement look good is if I move the pupil Image Textures along the eye meshes.

The way I've achieved the pupil movement in Blender is with modifiers, which Unity apparently doesn't work with. I've tried "UV Warp" controlled by bone and "UV Project" controlled by bone, and moving the eye bones in Unity does nothing.

So, I'm kind of stumped and desperate for something that will work for my use case. Any ideas that will be Unity-friendly, please?

sentences:
Preload scene in unity I have a game with two scenes, menu and maingame. I have uploaded the game to googleplay. However when I open the game and click on the play button in the menu scene, the next scene (maingame) takes about 4-5 seconds to load. Is there any way to load the maingame along with the menu so that there is no delay in loading?
EDIT
I have added code to the MainMenu.cs file so that when the game starts the LoadSceneAsync function is called and allowSceneActivation is set to false. Once the "play" button is pressed, the activation is set to true. The first time the game loads, there is still a bit of delay however if the player dies and I go the main menu and press play again, there is no delay.
AsyncOperation async;

void Start()
{
    async = SceneManager.LoadSceneAsync(1);
    async.allowSceneActivation = false;
}

public void PlayBtnPressed()
{
   async.allowSceneActivation = true;
   AudioManager.audiomanager.Play("PlayButton");
}

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:
Occupation groups for a country simulation game I'm trying to create citizen occupation groups or job classes for a country-management game I'm developing. I want it to be inclusionary but also very basic.

I did some research but all job lists I got contains more than 20 job types like farming, mining, education, law but It's too many for my game's setting and It still doesn't include every workforce. I need wider spectrum of jobs but I'm having trouble to categorize them, like labour, public service etc...

Any help is appreciated.

sentences:
How do I draw individual pixels in the distance? Hello everyone I am working with unity3d and I am faced with a task. I have a list of 3D points and I want to draw a pixel for every point on the list that exists after my cameras frustums far-plane. After I draw each of the pixels I would like to add a few simple effects to them. Sorry for the terminology I am new to unity!
Any help is much appreciated.

sentences:
Z axis for player movement is being incremented, but i don't know how I'm currently learning and developing a 2D plataform game in Unity, but now i'm having some errors that i can't solve.

When I press the arrow keys to make my character move right and left, the Z axis is being incremented somehow,and the player is "getting into the screen", even though I didn't write anything about it in my script.

I read about the "Apply Root Motion" in the Animator segment, and I unmarked it as they said, but I think the error might still be there, but i'm not sure.

Does anyone know about it?

Here is a snippet of my code:

void Movement() {
    anim.SetFloat ("speed", Mathf.Abs (Input.GetAxis ("Horizontal"))); //Makes it record a value of speed between -1 and 1, so that the trigger of the animation can work.

    if (Input.GetAxisRaw ("Horizontal") > 0) {
            transform.Translate (Vector3.right * speed * Time.deltaTime);//speed * Time.deltaTime makes things smoother, it updates frame by frame, so that it does not jump all around
            transform.eulerAngles = new Vector2 (0, 0);
    }

    if (Input.GetAxisRaw ("Horizontal") < 0) {
            transform.Translate (Vector3.right * speed * Time.deltaTime);
            transform.eulerAngles = new Vector2 (0, 188);
    }

sentences: How is scripting done in games such as Zelda? How do games implement their triggers and events that make up the plot of the story. For example, to be concrete how would one implement the story of a game such as The Legend of Zelda: A Link to the Past. I'm assuming there is some kind of scripting that somehow hooks into the game world state? I know absolutely nothing about scripting and game development. And have no clue how the underlying code would be architected in terms of classes, data structures, design patterns, etc.

sentences: Can I add rigging bones to a model imported from Blender inside Unity? I created a model in Blender but recently I stumbled upon a video claiming that you can add rigging to a model in Unity. So instead of rigging in Blender, is it possible to do it in Unity?

sentences:
Painter algorithm vs. 3D rendering with Z-buffer when drawing 2D Sprites I'm currently developing a tile base engine. I want it to look like your average old school tilebased RPG like Zelda - Link to the past (orthographic projection, squared tile texture, textures overlapping each other, alpha channels, etc.). The twist is that the world is internally 3d meaning that every tile has an elevation and entities are moving in a 3d space. Reason for this is beyond the scope of this question but I'm struggling on comparing the follow two ideas for the rendering. I'm using OpenGL with libGDX in Java but wouldn't mind writing my own code to interface OpenGL. That's also why I didn't tag it.
A screenshot of "Zelda - Link to the past" in case you don't know what it looks like.

Painter algorithm
Disable Z-Buffer and use painter algorithm to draw from back to front in the appropriate order with some overdraw and a lot of texture rebinding. I know a texture atlas can minimize the texture rebinding but the engine is supposed to act more like a sandbox so I don't want to rely too heavily on assumptions like a efficient texture atlas that I might not have all the time.
Pro: Easy to implement and very straight forward.
Con: I've no idea how big the impact will be since almost every sprite will cause a texture rebinding. And I don't know how to predict the performance costs of that many texture bind calls.

Full blown 3D
Rotate the camera 45 degrees up around the x axis with an orthographic projection matrix. Then use the 3d information from the game world to draw the tile textures with billboarding at the real position in the worlds 3d space. Same for entities and such. This way I can gather all sprites and then render them sorted by their texture which means one texture bind per texture and reduced overdraw due to usage of the Z-buffer
Pro: I can use a freecam to debug render problems. I assume it's significantly faster that the painter algorithm.
Con: Some sprites might share the same place which could lead to Z-fighting. I'm thinking about how to use multiple layers on a tile. For instance you may have a bridge tile with a railing where the railing is always overlapping an entity on the bridge but the floor of it is always overlapped by the entity. So I would have to add a little offset to different layers in the 3d space. I'm not really sure how that would work out and to be honest had a hard time figuring out how old games did it so maybe I'm overthinking it.

I guess I have a very rough idea of how each method will work out but I don't know how much the texture rebinding (or sorting and preparing the sprites for the 3d approach) is affecting the performance and while it's easy to find information regarding large 3D scenes I found it difficult to get information about 2D scenes with way less polygons.I hope this question is not too much a subject of personal preference. I know that Premature optimization is the root of all evil but due to how the decision is affecting almost the entire rendering process I don't want to make the wrong call.
I deliberately didn't mention any OpenGL functions mainly because I've mostly used the libGDX API which hides the function calls behind it's wrappers but generally I know how the internals work and just got into the internals and how the OpenGL API works. I don't think specific OpenGL calls do matter for the question but feel free to use them for your answer I'll just look them up.

sentences:
Monogame fails to load Effect I'm currently porting an old XNA game over to MonoGame and everything (including custom shaders) build fine.

However when i try to load the xnb file using content.Load<Effect>("BaseDraw");
I receive the following error:

An unhandled exception of type 'SharpDX.SharpDXException' occurred in SharpDX.dll

Additional information: HRESULT: [0x80070057], Module: [General],
    ApiCode: [E_INVALIDARG/Invalid Arguments], Message: The parameter is incorrect.

I even tried building the shaders with 2MGFX.exe and loading it manually but that throws the same error.

I have no idea what to so any help would be appreciated!

sentences:
Comparing performance I wanted to create a portal.
This portal looks like a semi-transparent texture rotating on a cylinder:

At first I created such a portal using a Particle System.

Then I realized that this might be an overkill and built another portal the following way:

I put a cylinder in the scene, put the texture on it and added a script that would rotate the cylinder.

The visual result of the 2 approaches (Particle System vs. Mesh approach) is perfectly the same.

Now I wanted to test which one performs better.

Am I right to assume that I should write a script which creates 10.000 portals of type A or B in the scene and have a look at some statistics (not sure yet which / where to find them), or is there anything more convinient to test performance?

Thank you!

sentences:
How can I tweak this A* search pathfinding algorithm to handle different terrain movement values? I'm creating a 2D map-based action game with similar interaction design as Diablo II. In other words, the player clicks around a map to move their player. I just finished player movement and am moving on to pathfinding.

In the game, enemies should charge the player's character. There are also five different terrain types that give different movement bonuses. I want the AI to take advantage of these terrain bonuses as they try to reach the player.

I was told to check out the A* search algorithm (http://en.wikipedia.org/wiki/A*_search_algorithm). I'm doing this game in HTML5 and JavaScript, and found a version in JavaScript: http://www.briangrinstead.com/blog/astar-search-algorithm-in-javascript I'm trying to figure out how to tweak it though.

Below are my ideas about what I need to change. What else do I need to worry about?

When I create a graph, I will need to initialize the 2D array I pass in passed on with a traversal of a map that corresponds to the different terrain types.
in graph.js: "GraphNodeType" definition needs to be modified to handle the 5 terrain types. There will be no walls.
in astar.js: The g and h scoring will need to be modified. How should I do this?
in astar.js: isWall() should probably be removed. My game doesn't have walls.
in astar.js: I'm not sure what this is. I think it indicates a node that isn't valid to be processed. When would this happen, though?
At a high level, how do I change this algorithm from "oh, is there a wall there?" to "will this terrain get me to the player faster than the terrain around me?"

Because of time, I'm also debating reusing my Bresenham algorithm for the enemies. Unfortunately, the different terrain movement bonuses won't be used by the AI, which will make the game suck. :/ I'd really like to have this in for the prototype, but I'm not a developer by trade nor am I a computer scientist. :D

If you know of any code that does what I'm looking for, please share!

Sanity check tips for this are also appreciated.

sentences:
Making the player walk on walls in box2d I'm making a game in stencil where players walk form left to right along randomly generated walls. I cant use waypoints, since the walls' shapes and positions are unpredictable.

Here's a descriptive sketch:

The red line is the player's path. The red circles are what I thought might make good waypoints until  I scrapped the idea.

sentences:
When is the right time to save game data in a standalone game? For standalone game, what's the best time to save game data, such as player's coins, level, skill data and so on?

Should the data be saved before quitting? Or whenever it changes? Or something else?

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 can I add up the Transform/GameObjects in the Array of Waypoints in Unity? I come up with this code and I try to get the waypoint + 1 when I reach the waypoint and it adds up till the last waypoint. I get Array is out of Index error. I guess I need and foreach loop of waypoints ?

Code:

public float speed;
public float turnSpeed;

public Transform[] waypoints;
private int currentWp = 0;

void FixedUpdate ()
{

    if(waypoints.Length >= currentWp)
    {
        return;
    }

    player.position = Vector3.MoveTowards(player.position, waypoints[currentWp].transform.position, speed * Time.deltaTime);

    var rotation = Quaternion.LookRotation(waypoints[currentWp].transform.position - player.position);
    player.rotation = Quaternion.Slerp (player.rotation, rotation, turnSpeed * Time.deltaTime);

    float distance = Vector3.Distance(player.position, waypoints[currentWp].position);

    if(distance <= 10)
    {
        currentWp++;
    }
}

sentences: Specific Physics Lessons and Reference for Game Development What "Physics stuffs" should I learn in game developments? I'm reading about Verlet Integration, and I'm wondering what other lesson should I learn and if there are available resources can you please provide some link or anything. Thanks.

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:
2D game with 3D models and terrains I am approaching OpenGL and general gaming-development. I want to start by coding a simple 2D game in Java (lwjgl) but, since I can create models with Blender, I don't want to use 2D sprites, but a semi-flat environment. My target is to remake a classic game but with some cool stuff like particle emitters, bump mapping, lighting and so on... The basic idea is to make something that looks like Super Mario Bros Wii (or Kirby's Adventures Wii, or Super Smash Bros. etc...).

Do you think I have to use JavaMonkeyEngine?
Some hints,code snippets, tutorials, links?
Do I have to handle a "z-fixed" camera or set-up OpenGL to render in 2D mode?
What about the HUD?
Sorry if my question is too generic, but I would like to have a clear idea of what I have to do before starting writing code. As always, thanks for your help!

sentences: How to handle day and night in a 2D sprite game Do I need to draw, for example, a tree how it looks in the day (normal colors) and how it looks at night (colors aligned according to the moonlight)? Or does Unity have a function for that?

sentences:
Spherical harmonics lighting interpolation I want to use hardware filtering to smooth out colors in texels of a texture when I'm accessing texels at coordinates that are not directly at the center of the texel, the catch being that the texels store 2 bands of spherical harmonics coefficients (=4 coefficients), not RGBA intensity values.

Can I just use hardware filtering like that (GL_LINEAR with and without mip mapping) without any considerations?

In other terms: If I were to first convert the coefficients back to intensity representations, than manually interpolate between two intensities, would the resulting intensity be the same as if I interpolated between the coefficient vectors directly and then converted the interpolated result to intensities?

sentences: How to convert a silhouette to a blob? Using ShapeShop you draw a silhouette and it converts the silhouette to a "blob", which gives a nice game character. Using 3DSMAX 2012 you draw a line and close the spine. How do you convert it to a "blob" there? Extrude gives sharp edges, BlobMesh only converts the lines to a blob, I want it to be the organic "blob" structure it is in ShapeShop.

sentences:
What Game Development books should my partner/myself read? My partner and I are starting to get into game development on the iPhone. I'm a programmer and he's not. We are looking for some good language agnostic game programming books. Hopefully things that will explain basic game development principles without focusing too much on the particulars of a language and more on the concepts needed to build and design games.

We will probably focus on 2D games (at the beginning anyways) so no need for books on in depth 3D math, complex AI, etc.

Any suggestions?

sentences:
How to determine collision direction between two rectangles? I am trying to figure out how to determine the direction a collision occurs between two rectangles.

One rectangle does not move. The other rectangle has a velocity in any direction. When a collision occurs, I want to be able to set the position of the moving rectangle to the point of impact.

I seem to be stuck in determining from what direction the impact occurs.  If I am moving strictly vertically or horizontally I manage great detection.  But when moving in both directions at the same time, strange things happen.

What is the best way to determine what direction a collision occurs between two rectangles?

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:
Windows 7/8 imcompatibility via XNA? I have MS Visual Studio 2010 installed on my machine (a Windows 7 Pro 64-bit), and im developing a game in XNA 4.0 with it. I can run the program just fine from the .exe file in the bin directory, and it appears to have no bugs.

But when trying it on Windows 8 64-bit, it just doesn't run. Am I doing something wrong or is XNA suddenly incompatible in this case?

BTW this game has no 3d graphics at all, just 2D stuff, but iirc every texture2D is rendered through the GPU thing as some sort of flat 3D surface, so idk.

sentences:
MMO Client-Server Spoofing Vulnerabilities Ive created a working authoritative client-server system using LiteNetLib for my game however im wondering if packet sniffing+modification is a real worry i should be developing for.

I read some information that other Client sniffing the packets of another client is pretty much impossible since the packets are routed through their ISP. Therefore: should i only worry about the client causing problems for the server, instead of also worrying about clients causing problems for other clients?

Currently im encrypting every packet sent by the client including movement commands such as 'move left'. My idea is that this will make packet-sniffing fail, packet-modification fail, and packet-spoofing fail.

If i remove my encryption doesn't that mean someone can spoof a packet by changing the packet source in the header? (thus sending game commands for another client - moving another player!). Usually when its encrypted i know that only the client with the secret key could have sent it, thus validating the packet source.

I see everyone saying that people shouldn't encrypt general traffic like this, but whats the truth here! Whats the best way?

sentences:
How can I use different fonts for different objects in Unity? In Unity 3.5, I have a font that is strangely linked to four game objects. I want to put separate fonts on each object.

In the Inspector, when I click on the circle icon next to the "Text" attribute, I can select a font.  But, then it changes the font on the other three objects as well.

I was hoping Unity would have something like a material ID from 3DS Max. If I could put a new material ID on the other objects, hopefully I could assign a new font to the text mesh. Regardless, is there a way to assign a different font to each of my objects?

sentences:
How do I make an actor move to the foreground temporarily in LibGDX scene2d? I have an inventory UI which is a table in scene2d. Then the table had a bunch of Containers which are basically inventory slots. They have a transparant grey background color. Then in each container is an ItemStack with a picture of an item and a stacksize. When I pull this ItemStack over a container that was created later, it moves behind the container and the transparant grey background will be in front of the item picture. How do I temporarily (or permanently) move it to the foreground so it doesn't matter in front of which container I drag the item?

Example of what happens:
https://i.imgur.com/yq4njex.gifv

This is how I create the containers:

// Create inventory slots
table.row();
inventorySlots.clear();
for (int i = 0; i < inventory.getInventorySize(); i++) {
    if (i % SLOTS_PER_ROW == 0) table.row();

    Container cont = new Container();
    cont.fill();
    cont.background(Utils.createDrawable(1, 1, new Color(0, 0, 0, 0.4f)));

    inventorySlots.add(cont);
    table.add(cont).prefHeight(50).prefWidth(50).pad(5);
}

After that I add each ItemStack to the list of containers/inventoryslots like this:

// Add ItemStacks from Items to their respective slot
ArrayList<Item> items = inventory.getItems();
for(Container slot : inventorySlots) {
    Item item = items.get(inventorySlots.indexOf(slot));

    if(item != null) {
        ItemStack itemStack = new ItemStack(item);
        addInventoryEvent(itemStack, items);
        slot.pad(5);
        slot.setActor(itemStack);
    }
}

sentences:
Tank avoid other objects? My tanks working  good except one thing, they not avoid each other in good way. they not generate the path to find new good position. My tank follow it own agent position and direction. I add NavMeshObstacle fit the tank size. After all this, still I get some bad things. tanks hit each other, tank moving above other tank, some time get stuck between two tanks which lead to strange movement(shaking). example this tank on the middle.

what can I do to improve tank avoiding ?

sentences:
How to develop a real-time game server for html5 web app? I'm contemplating a graduate project proposal of developing a rather complex HTML5 game that requires real-time server communication. The premise of the actual game play is simple: 10 players battle it out with one another. Many pieces of information will be tracked, such as: player health, each players X/Y position on the screen, items in inventory, etc. The server structure for all of these potential changes, however, is not so simple.

My goal is to develop a scalable environment that can theoretically maintain 50,000 concurrent players in 5,000 separate game instances while all running reliably with less than 1 second latency. My comfort skill set is mostly in web technologies. For a small scale app, I would use PHP/MySQL. But for an app this large, I am confident HTTP requests will not be even a short term solution.

I don't really know how to approach this situation.

Should I develop my own server, if so, what language should I use? I do not want to use NODE.JS. Is Python viable?
Is a single, high-performance server capable of maintaining this type of
load, or will I need to look into developing a cloud/cluster?
What type of database read/write would be optimal for this situation? How would I scale beyond 50,000 players? How would this scale with a cloud/cluster?

sentences:
RPG Chance to Dodge formula A friend and I are trying to develop a “chance to dodge” formula that will scale from level 1-1000. I would like to see if one formula can be utilized, using a difference ratio between Character A’s level and Character B’s level. The factors involved in the equation are as follows:

Dexterity (Max 38)

Acrobatics Skill (up to 5 possible skill points)

The equation in theory:

(Acrobatics Skill * 5) + ((Dex - 10) * 0.1) + ((CharacterB's Level - CharacterA's Level) * 0.1)

The formula has been varied a little to make it work better in one regard which has the inverse effect of making it not work in another area. For example, the formula may work and scale well if a lvl 700 is striking at a lvl 1000. Let’s say that works out that Character B has a 65% to dodge. Sounds good…..except if the same formula is applied to a lvl 5 is striking a lvl 20 (low levels).

We don’t want there to be a 100% chance to block. Then again, I guess if a level 1 struck at a level 1000, that would be a little bit ridiculous that he would succeed. But once again, it would be nice if there was a way to scale the entire level spectrum by use of perhaps cosine and the difference-between-level’s ratio.

sentences:
How to attach an UI button to a prefab and follow it in Unity2D My plan is creating a button above my prefab (a tree) and whenever my character is detected, the button will appear and allow me to click on it to active a dialog. I just want my trees are randomly spawned and stay still so it's not "follow" actually but I would like to know in that case too.

I did some researches but most of them were about Text and HP/MP things, which weren't used by UI system.

One more thing, I kinda new to code so it would be fantastic if I got a full code (Button follow only).

Thanks in advanced.

sentences:
How to calculate 1st, 2nd, 3rd place and draw conditions in local multiplayer game? I have a local multiplayer game with an end of round screen that pops up after each round. I'm trying to figure out the logic to calculate the 1st, 2nd, 3rd place from a maximum of 4 players. I also want draw/tie conditions. It's possible for 2 or 3 players to get the same score. The score is just an int for each player. I've been struggling with this for a while... Any help appreciated, even if its just some pseudo code to point me in the right direction. Also, I'd like to avoid using Linq if possible, as I've heard it doesn't play nice with Unity. Thanks

Edit:

Below is what I've managed to come up with for determining the draw conditions. Doesn't seem to hold up in all cases though... Surely there's a simpler approach?

         PlayerScore[] orderedScores = m_scores.OrderByDescending(ps => ps.score).Take(4).ToArray();

        _1stPlacePlayers.Add(orderedScores[0].playerNumber);

        if (orderedScores[0].score == orderedScores[1].score)
        {
            // 2 player draw 1st place
            _1stPlacePlayers.Add(orderedScores[1].playerNumber);
            if(orderedScores[0].score == orderedScores[2].score)
            {
                // 3 player draw 1st place
                _1stPlacePlayers.Add(orderedScores[2].playerNumber);
                if(orderedScores[0].score == orderedScores[3].score)
                {
                    // 4 player draw 1st place
                    _1stPlacePlayers.Add(orderedScores[3].playerNumber);
                }
            }else if (orderedScores[1].score == orderedScores[2].score)
            {
                // 2 player draw 2nd place
                _2ndPlacePlayers.Add(orderedScores[2].playerNumber);
                if (orderedScores[1].score == orderedScores[3].score)
                {
                    // 3 player draw 2nd place
                    _2ndPlacePlayers.Add(orderedScores[3].playerNumber);
                }
            }
            else if (orderedScores[2].score == orderedScores[3].score)
            {
                // 2 player draw 3rd place
                _3rdPlacePlayers.Add(orderedScores[3].playerNumber);
            }
        }

        else if (orderedScores[1].score == orderedScores[2].score)
        {
            // 2 player draw 2nd place
            _2ndPlacePlayers.Add(orderedScores[2].playerNumber);
            if (orderedScores[1].score == orderedScores[3].score)
            {
                // 3 player draw 2nd place
                _2ndPlacePlayers.Add(orderedScores[3].playerNumber);
            }
        }
        else if (orderedScores[2].score == orderedScores[3].score)
        {
            // 2 player draw 3rd place
            _3rdPlacePlayers.Add(orderedScores[3].playerNumber);
        }

sentences:
System.Runtime.Serialization.SerializationException while trying to deserialize List I'm trying to serialize / deserialize a class that holds inventory items.

The code is attached below.

First I call AddOne() void a few times, then I call SaveFile(), then I call LoadFile().

In LoadFile() the following error occurs :

  ex = "System.Runtime.Serialization.SerializationException: End of Stream encountered before parsing was completed.\r\n  at System.Runtime.Serialization.Formatters.Binary.__BinaryParser.Run () [0x00288] in <1f0c1ef1ad524c38bbc5536809c46b48>:0 \r\n  at System.Runt...

Does anybody see my mistake?

Thank you for the help!

using System;
using System.Collections;
using System.Collections.Generic;
using System.IO;
using System.Runtime.Serialization.Formatters.Binary;
using UnityEngine;

public enum Type
{
    undefined = 0,
    Pistol = 1,
    Magnum = 2,
    Grenade = 3,
    BlendGrenade = 4,
    FireGrenade = 5,
    PistolAmmo = 6,
    MagnumAmmo = 7,
    Rifle,
    RifleAmmo,
}

[System.Serializable]
public class Inventory : MonoBehaviour
{
    public class InventoryItem
    {
        public int Amount = 0;
        public int Row = 0;
        public int Col = 0;
        public int Rotation = 0;
        public Type ItemType = Type.undefined;
    }
    public List<InventoryItem> Items;

    public void Start()
    {
        Items = new List<InventoryItem>();
    }
    public void AddOne()
    {
        InventoryItem n = new InventoryItem();
        this.Items.Add(n);
    }
    public void SaveFile()
    {
        string destination = Application.persistentDataPath + "/save3.dat";

        if (File.Exists(destination))
        {
            File.Delete(destination);
        }
        using (Stream stream = File.Open(destination, FileMode.Create))
        {
            BinaryFormatter bin = new BinaryFormatter();
            bin.Serialize(stream, this.Items);
        }
    }

    public void LoadFile()
    {
        string destination = Application.persistentDataPath + "/save3.dat";

        using (Stream stream = File.Open(destination, FileMode.Open))
        {
            BinaryFormatter bin = new BinaryFormatter();

            try
            {
                this.Items = (List<InventoryItem>)bin.Deserialize(stream);
            }
            catch (Exception ex)
            {
                Debug.Log(ex.ToString());
            }
        }
    }
}

sentences:
How to make my simple round sprite look right in XNA Ok, I'm very new to graphics programming (but not new to coding). I'm trying to load a simple image in XNA which I can do fine. It is a simple round circle which I made in photoshop. The problem is the edges show up rough when I draw it on the screen even with the exact size. The anti-aliasing is missing. I'm sure I'm missing something very simple:

        GraphicsDevice.Clear(Color.Black);

        // TODO: Add your drawing code here
        spriteBatch.Begin();
        spriteBatch.Draw(circle, new Rectangle(10, 10, 10, 10), Color.White);
        spriteBatch.End();

Couldn't post picture because I'm a first time poster. But my smooth png circle has rough edges. So I found that if I added:

spriteBatch.Begin(SpriteSortMode.FrontToBack, BlendState.NonPremultiplied);

I can get a smooth image when the image is the same size as the original png. But if I want to scale that image up or down then the rough edges return. How do I get XNA to smoothly resize my simple round image to a smaller size without getting the rough edges?

sentences: .png file to Sprite(2D and UI) - still not visible under source image I am trying to use an image as a UI Image but even after changing its texture type to Sprite(2D and UI), it isn't visible in the source image menu. The file was created in MS Paint and I'm accessing the source image menu via the "circle selector" next to Source Image in the Inspector. I'm pretty sure I've never had this issue before. I wish I could share more details but there's nothing much to say. What could be causing this issue?

sentences:
How would you UV unwrap an octahedron? I tried to UV unwrap this octahedron, by slicing one of the sides.

I was able to lay it out on the texture like this, but with severe distortions.

Can someone help me UV map this without distortions?

sentences: Are there any games that contain a machine learning AI? Can anybody here give a reference to commercial AAA games that implement a machine learning AI?

sentences:
How to make a proper release build - Unity Android - x86, ARM32, ARM64 I'm trying to create a release on Google Play.

I currently have Build App Bundle checked in the build settings, and it helps decrease the build size.

In player settings I've IL2CPP set as the scripting backend, and  x86 + ARM32 + ARM64 checked as target architectures.

Once built it creates *-symbols.zip in addition to just
aab.

My questions are,

Do I need x86 + ARM32 + ARM64 all checked? (I want to comply with Google's new 64-bit requirement)
Can I build split aab's similar to 'split APKs by target architecture'? If so can I have the same version code for aab's which targets different architectures? Is there any advantage of doing so?

sentences:
Using AR measuring techniques to allow free movement in a VR room I am a Game Design student currently working on my graduation project. For this project, I want to develop a VR room, which can be walked through freely by using a smartphone. I already made a 1:1 scale replica of a meeting room (in Unity 3D) in the office I am currently working.

So I have been exploring different technologies that allow distance measuring techniques using markers and AR applications to measure distance between physical objects.

for example:
https://www.youtube.com/watch?v=Tk31uGo7xHo
https://www.ourtechart.com/augmented-reality/augmented-reality-tutorial-47-shapes-combined-trackers-unity3d-vuforia/

Now is it possible to use these methods to translate the measured distance into a vector 3 movement in a VR room? Also, is this relatively easy to do for a beginner programmer?

To be clear: The goal is to allow free movement through a pre-built 1:1 scale 3D room in VR by using a smartphone and markers in the physical room. Which hopefully will create some cool VR experience for the players.

Could anyone give me some advice? For example; is there anyone who already tackled this problem and is willing to share knowledge with me?

Thanks in advance

sentences:
Could not establish connection with local server process when opening or making Unity project Whenever i try to either create or open a Unity project, I get faced with this error.

Does Unity need a proxy server, because I dont have one. (If so, how do I get one?) And
apparently I need to add some environment variables, (HTTP_PROXY, HTTPS_PROXY and
UNITY_NOPROXY=localhost,127.0.0.1) what values do i add to these?

Unity Package Manager Diagnostics (v0.1.5)

Ran 7 checks

1 succeeded

6 failed

❌ UPM registry reachable (FAIL)
Make an HTTP request to the UPM package registry

    Connection error. This could be because a proxy is misconfigured.

❌ Ping UPM registry (FAIL)
Measure the latency of the UPM package registry API

    No successful pings could be made in 0.062 seconds (30 failed)

❌ Ping UPM download (FAIL)
Measure the latency of the UPM package download endpoint

    No successful pings could be made in 0.039 seconds (30 failed)

❌ UPM registry download speed (FAIL)
Test the Internet connection using the UPM package registry

    Connection error. This could be because a proxy is misconfigured.

❌ Speedtest.net (FAIL)
Test the Internet connection using Speedtest.net

    Connection error. This could be because a proxy is misconfigured.

✅ HTTP proxy environment variables (PASS)
Detect whether proxy-related environment variables are set (HTTP_PROXY, HTTPS_PROXY, ALL_PROXY, NO_PROXY, UNITY_PROXYSERVER, UNITY_NOPROXY)

    Proxy support has been configured through the following environment variables:
    HTTPS_PROXY = C:\Program Files\Unity Hub\Unity Hub.exe
    HTTP_PROXY = C:\Program Files\Unity Hub\Unity Hub.exe
    UNITY_NOPROXY = C:\Program Files\Unity Hub\Unity Hub.exe

❌ UPM health check (FAIL)
Start the UPM process and call its health endpoint

    Server started but did not respond to health requests:
    Error: Invalid protocol: c:

How do I fix this?

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:
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:
What is a bank payment gateway concept upon publishing a game app? I was asking a local bank about the possibility of transferring money to my account there upon publishing a paid app on play store. The reply was that they have their own payment gateway that deducts a percentage of the profits besides monthly and yearly charges.

My first question is what exactly is a payment gateway? (The information written on google about this is very confusing and very broad that after hours of research I still do not know what exactly is the benefit of a gateway.)

My second question is do all banks around the world impose this "gateway"deduction?

I always thought that money is transferred directly from google to the concerned developer's bank account without the concept of gateway. Please correct me if am wrong.

Thank you!

sentences:
2D Animation Smoothness - Delta time vs. Kinematics I'm animating a sprite in 2D with key frames of rotation and xy-positions.

I've recently had a discussion with someone saying that when the device (happens to be an iPad using cocos2D) hits a performance bump due to whatever else the user may be doing, lag will arise and that the best way to fight it is to not use actual positions, but velocities, accelerations and torques with kinematics. His message is to evaluate the positions and rotations from these speeds at the current point in time.

I've never experienced a situation where I've heard of using kinematics to stem lag in 2D animations and am not sure of how effective it could be. Also, it seems to be overkill.

The application is not networked so it's all running on a local device. The desired effect is that the animation always plays as closely as it can to the target frame rate.

Wouldn't the technique suffer the same problems as just using the time since the last frame or a fixed time step since the kinematics would also require some time value to perform the calculation?

What techniques could you suggest to best achieve the desired effect?

EDIT 1

Thank you for your responses, they are very illuminating. I want to clarify my question before choosing an answer however, to make sure that this post really serves it's purpose.

I have a sprite of a ball, and a text file with 3 arrays worth of information (rotation,translations x, translations y) with each unit of information existing as a key frame to be stepped through (0 to 49 and back to 0 to replay it again). I have this playing by interpolating from the current key frame to the next, every n-units of time. The animation is visibly correct when compared to a video I was given of it, and it is smooth because of the interpolations between the key frames. This is the existing state of the project.

There are no physics simulated, only a static animation of a ball moving in a way an artist specifically designed.

Should I, instead of rotation in degrees and translations by positions in space, derive velocities, accelerations and torques to express this static animation as a function of time? As in, position now = foo(time now), where foo uses kinematics.

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:
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: How well does Unity 3d work for both Android and iPhone? First off this question might be a bit broad so I apologize if it is. I am really just looking for peoples experiences and personal knowledge on the subject. I am looking to create a game for both Android and iPhone platform. I know Unity is a great game engine and my question is how well does it work for creating one code base to build for both Android and iPhone platforms? Time is a constraint on this project so I am very interested in how smoothly the process usually is when trying to build both applications and how much custom code must be written for each specific application. Any insite that people have on this topic would be much appreciated thanks.

sentences: Render object transparent with camera instead changing object render mode I have a pretty large area where I want to show the floor with 60% transparency using a so-called Opacity camera (an idea). I know I can set mesh rendering mode to transparent and then decrease the alpha value. My question is that, is there any way available to apply mesh transparent rendering setting to my camera instead of the object.

sentences:
Removing duplicate vertices on a mesh I have a set of vertices and another set of indices. Sometimes I find that I have duplicate vertices in my mesh.

I tried at first to check if two identical vertices were in the array of vertices but that didn't work because I remembered that more that if one vertex  represents multiple edges then the vertex would be validly represented as multiple vertices in the vertices array.

Then I remembered that the indices help represent how the vertices are structured but I didn't know how to use them. So I came here to ask how to use them to detect duplicate vertices in a mesh.

sentences:
How do I make light objects in XNA? Here's my dilemma : I want to have light sources placeable by the player, in terms of lanterns.

I know the best way to do this is to use pixel shaders, which I have done a lot of research and use on, but it seems so far that the lights are static.

So what would be the best method to create a dynamically lit scene?

I already have to workings of a few classes to make 2d lights (Color, Position, Type, Direction, Power) but it is just rendering that is the problem.

Thanks for your considerations!

sentences:
Panda3d handling collisions on walls created in blender Edit 2 : Updated code, so runnable zip isn't the same as the copied section bellow (though all that has changed is that part in run_me.py)

Edit: Runnable zip with source files, sorry: https://dl.dropboxusercontent.com/u/12781104/Collisions.zip

Right now I am trying to create a small room for my character to walk around in, it works decently but will walk through walls, I am having difficulty setting up the collision logic to stop the character from walking through walls. The problem is properly creating the collision plane to line up with the walls (is there a way to do this in blender?)...

Code so far that has to do with wall collisions

 [Removed imports]

    ....

    self.cTrav = CollisionTraverser()
    robotCHandler = CollisionHandlerQueue()
    robotWallCHandler = CollisionHandlerPusher()

    WALL_MASK=BitMask32.bit(2)

    ralphStartPos = (0, 0, 0)
    self.ralph = loader.loadModel("robot.x")
    self.ralph.reparentTo(render)
    self.ralph.setScale(1)
    self.ralph.setPos(ralphStartPos)
    self.ralph.setCollideMask(BitMask32.allOff())
    # setup tube to suround robot
    #(robot is 3 height, by 1.5, 1.5)
    cTube = CollisionSphere(0, 0, 0, 3)

    robotCollisionNode = self.ralph.attachNewNode(CollisionNode('robotcnode'))
    robotCollisionNode.node().addSolid(cTube)
    robotCollisionNode.node().setFromCollideMask(WALL_MASK)
    robotCollisionNode.node().setIntoCollideMask(BitMask32.allOff())

    self.environ = loader.loadModel("room2.x")
    self.environ.reparentTo(render)

    root = self.environ.find("**/Root")
    walls = root.findAllMatches("**/Plane*")

    for w in walls:
        # set it to the same bitmask so the collider collides
        w.node().setIntoCollideMask(WALL_MASK)

    robotWallCHandler.addCollider(robotCollisionNode, self.ralph)

    self.cTrav.addCollider(robotCollisionNode, robotWallCHandler)

The bottom line is what I am most confused about, how do I get the collision plane properly setup, do I just have to hard code the points or is there something easier (maybe the geom nodes?)?

sentences:
XNA significant loss in fps by just adding a few hundred thousand more triangles? I've got a minecraftish game that's running nice and smooth with a total of 9.3 million triangles, about 50-70fps average.  Then if I try to render 9.9 million triangles I get hell and it drops to < 1 fps.  I'm drawing them exactly the same way, it's definitely the drawing as I have a vertex buffer for each chunk, then I run through them all, check if they're in sight and if they are I draw them.  It works fine at high fps until I have just those few extra triangles which destroy the FPS.

Edit: Added drawing code:

First I loop through all the chunks.  I check if they're visible and if they are I mark them as visible then draw them.

        foreach (Chunk chunk in GlobalWorld.LoadedChunks)
        {
            if (chunk == null || !chunk.DrawThis)
                continue;

            if (!player.ViewFrustrum.Intersects(chunk.Bounding))
            {
                chunk.IsInSight = false;
                continue;
            }
            chunk.IsInSight = true;

            GlobalGame.graphicsDevice.SetVertexBuffer(chunk.VertexBuffer);
            GlobalGame.graphicsDevice.Indices = chunk.IndexBuffer;

            ChunkShader.Parameters["xWorld"].SetValue(chunk.WorldMatrix);
            ChunkShader.CurrentTechnique.Passes[0].Apply();
            GlobalGame.graphicsDevice.DrawIndexedPrimitives(PrimitiveType.TriangleList, 0, 0, chunk.VertexBuffer.VertexCount, 0, chunk.IndexBuffer.IndexCount / 3);
        }

Then after that I draw all the transparent parts of the chunk (so they don't conflict with other chunks).  I already made clear if they're visible above so I just check if that bool is true.

        foreach (Chunk chunk in GlobalWorld.LoadedChunks)
        {
            if (chunk == null || !chunk.IsInSight || !chunk.DrawThisTransparent)
                continue;
            GlobalGame.graphicsDevice.SetVertexBuffer(chunk.TransparentVertexBuffer);
            GlobalGame.graphicsDevice.Indices = chunk.TransparentIndexBuffer;

            ChunkTransparencyShader.Parameters["xWorld"].SetValue(chunk.WorldMatrix);
            ChunkTransparencyShader.CurrentTechnique.Passes[0].Apply();
            GlobalGame.graphicsDevice.DrawIndexedPrimitives(PrimitiveType.TriangleList, 0, 0, chunk.TransparentVertexBuffer.VertexCount, 0, chunk.TransparentIndexBuffer.IndexCount / 3);
        }

With 3721 chunks loaded it runs fine with them all being drawn at the same time.  With 3844 chunks being loaded it runs fine unless you view all of them.  Now that's only just over 100 more chunks yet it's dropping from 60fps to < 1 fps.

sentences:
How can I trigger a buttton click event at regular intervals? I am trying to make an idle clicker game like Adventure Capitalist. I have created the script for the buttons (say button-type: buy) that would increase the gold and the script to upgrade the gold per click (button-type :upgrade). Now I want to create a C# script for a button(button-type: auto clicker) that would enable me to automatically click those button at regular intervals?

These are my scripts:

public class Click : MonoBehaviour {

    public Gold gold;
    public float gpc;
    public Text goldCount;
    public float price;
    public int active = 0;
    // Use this for initialization
    void Start () {

    }

    // Update is called once per frame
    void Update () {
        goldCount.text = "$" + gold.gold;
    }

    public void Activate()
    {
        if(active == 0)
        {
            if(gold.gold >= price)
            {
                gold.gold -= price;
                active = 1;
            }
        }
    }

    public void Clicked()
    {
        if(active == 1)
        {
            gold.gold += gpc;
        }
    }
}

public class Gold : MonoBehaviour {
    public float gold;
    // Use this for initialization
    void Start () {

    }

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

    }
}

public class UpgradeManager : MonoBehaviour {

    public Click click;
    public Gold gold;
    public float upgradeCost;
    public int count;
    public int clickPower;
    public string itemName;
    // Use this for initialization
    void Start () {

    }

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

    }
    public void PurchasedUpgrade()
    {
        if(gold.gold >= upgradeCost)
        {
            gold.gold -= upgradeCost;
            count++;
            click.gpc = clickPower;
            upgradeCost = Mathf.Round(upgradeCost * Mathf.Pow(1.15f, count));
        }
    }
}

sentences: How to calculate ray unit grid intersections? P is ray origin, D direction. How do I calculate tx, ty(s)? This is for octree raycast. The primary goal is to get 1st intersection voxel (v) then second (v") and so on.

sentences:
Rendering models in isometric view How to setup the rendering and camera for isometric gameworld projection? And specifically how do i get the images exactly the right size?

What angles to use to get the exact 2/1 isomtric view?
Methods to set the camera on the right position?
Options to set like anti alias off.

I have tried many things, 45, 30, 35.264 degree angles. What i do is set the angle of the camera, then place the camera in front of the model then use dolly/fov/lens settings to get the left and right edge of the model lined up with the save frame. Then adjust camera height so the bottom lines up with the bottom of the save frame. But i keep getting jagged edges and not the isometric style 2 width one height.

sentences:
Is the corporate video game development industry habitable? After a bit of research, I realized that almost every article about video game development portrays the industry in a terrible light. In these articles, companies abuse workers with unpaid overtime. Developers are left out to dry when studios fall. Developers have a terrible quality of life, and few stay on board for very long (10 or more years).

What are the real working conditions actually like (regular 40-50 hour work weeks, stability, treated well, ect.)? Are there any statistics about job satisfaction in the in game development industry?

sentences:
How to make compound data in Game Maker? In other languages, such as Lisp, there is such a thing as "compound data", where several variables are grouped together.

For example, if I want to represent an orbital that rotate around the player without creating a new object, I may use something like this:

(define (Orbital rx ry colour))
;; creating a new data type called "Orbital", with 3 var.s

(define ORB1 (make-Orbital 30 -20 "red"))
;; creating a particular orbital at (30, -20) with red as colour,
;; stored under the name "ORB1"

Is there a similar mechanism in Game Maker (made in Delphi) that permits such grouping of information under a structure which itself can be considered a single item, and thus such things to be stored in lists?

sentences:
Renderer.material assignment not working I have a fairly simple question: I am trying to change an object's material via code with the line

rend.material = NewMat;

where rend is of type Renderer (MeshRenderer to be specific) and NewMat is of type Material. Both variables are public and assigned in the inspector and both are not null.

When I now try to assign the material, nothing happens. I don't event get any error. When I look into the inspector I can see that under Materials on my MeshRenderer the material doesn't even change. The line

Debug.Log(rend.material == NewMat);

outputs false.

What am I doing wrong?

sentences: How to show specific item in question on trigger entry? (Unity & c#) So I have multiple, random objects on a plane, and when my player walks into them, I want them to be 'picked up'. The player can only hold one object at a time, and needs to return the item to the base before he can pick up another. Using the OnTriggerEntry function in a collider script, a set of commands are called when the player touches the object. Within the function, the 'itempickup' function from the player script is called using 'col.transform.SendMessage()'. How do I tell the itempickup function which specific object was 'picked up' in the trigger script? That is, is there a variable of some kind that acts as an ID for game objects? Thanks :)

sentences:
Partial recalculation of visibility on a 2D uniform grid Problem
Imagine that we have a 2D uniform grid of dimensions N x N. For this grid we have also pre-computed a visibility look-up table, e.g. with DDA, which answers the boolean query is cell X visible from cell Y?

The look-up table is a complete graph KN of the cells V in the grid, with each edge E being a binary value denoting the visibility between its vertices.

Question
If any given cell has its visibility modified, is it possible to extract the subset Edelta of edges which must have their visibility recomputed due to the change, so as to avoid a full-on recomputation for the entire grid? (Which is N(N-1) / 2 or N2 depending on the implementation)

sentences:
Choosing an Audio API Possible Duplicate:
  Cross-Platform Audio API Suggestions

I have gone down this road a few times, and always decided to put it off. I am finally to the point I need to choose an Audio library and stick with it. I switched physics engines 3 times which caused quite a bit of wasted time, so I would like to be set when I pick an Audio lib. I will be falling into the "indie" section as far as licensing goes. Here is what I have so far..

FMOD - Quality Middleware, success has gone to their heads and it seems they did away with the indie license recently. Price range seems to go from Free - 3000$ - 6000$ which pretty much excludes this.

BASS - So far this is what I am leaning towards. Simple API, great feature list, and quite a bit more. The pricing structure looks somewhat similar to FMOD, but I will need to pull out the Euro to Dollar calculator, and figure out if the Shareware license would be applicable to Digitally Distributed Content.

IrrKlang - Pricing looks fair, features seem generic. Pretty much coming down to a battle between this and BASS. I have heard good and bad things.

The other libraries such as OpenAL, PortAudio, Audiere, etc. were considered, but I am looking for something more drag and drop rather than something I am going to be basically writing my own front-end for. I am curious though, I remember stumbling across another library or two a few months ago on par with FMOD/BASS/etc that were fairly new. No matter how hard I look now, I cannot find them. Hopefully someone here knows what they might be called.

Anyways, basically just looking for feedback from other member's experiences, thoughts, and so on.

sentences:
I want to get back into 2D games programming I used to develop games in the late 80's / early 90's and would like to look at getting back into it these days.

I have seen online there are so many options and libraries etc, so just thought I would try asking on here to see if anyone could offer some advice/a path to take.

I only really want to do 2D games as I did many years. I have seen things like Unity and other javascript libraries and it looks a bit of a minefield.

Ideally I would like to target Android / IPhone games.

I know c#, some c++, javascript/html5

Any info greatly appreciated.

C

sentences:
Unity sprite rig affecting performance I created a simple sprite rig using the skinning editor provided by the new 2D Animation V2 package. But it causes a huge FPS drop when added to the scene.

Methods such as SpriteSkin.LateUpdate generates significant amount of garbage as shown in the picture: See the spike shown on the CPU profiler when the rig is being enabled:

The rig is not even animated.  I also checked the other sample rigs provided by Unity and they also performed in a similar fashion.

Is this normal? I'm targeting mobile, so anything that can be done to avoid or improve the situation will be helpful.

I'm using 2d-animation-v2 2.0.0-preview.2 in Unity 2018.3.8f

sentences:
How can I extend this graphics code to draw more vectors of vertices? I want to include the drawing of other vectors of vertices in the following code, in a number of places it seems easy enough to simply add or multiply size()s of the two vectors, for instance in the first check. But then it gets a bit fuzzy simply because of a lack of understanding.

Should I add them together to create a bigger buffer description and copy everything together? Or should I do it all separately?

Basically how would I extend this code to include more vectors of vertices?

if (temporary2DVerts.size() > 0)
{
    // create the vertex buffer and store the pointer into pBuffer, which is created globally
    D3D10_BUFFER_DESC bd;
    bd.Usage = D3D10_USAGE_DYNAMIC;
    bd.ByteWidth = sizeof(VERTEX) * temporary2DVerts.size();// this breaks the create buffer line : temp2DVerts.size();
    bd.BindFlags = D3D10_BIND_VERTEX_BUFFER;
    bd.CPUAccessFlags = D3D10_CPU_ACCESS_WRITE;
    bd.MiscFlags = 0;

    device->CreateBuffer(&bd, NULL, &pBuffer);

    void* pVoid;    // the void pointer

    pBuffer->Map(D3D10_MAP_WRITE_DISCARD, 0, &pVoid);    // map the vertex buffer
    memcpy(pVoid, &temporary2DVerts[0], sizeof(temporary2DVerts[0]) * temporary2DVerts.size());
    pBuffer->Unmap();

    // select which input layout we are using
    device->IASetInputLayout(screenVertexLayout);

    // select which primtive type we are using
    device->IASetPrimitiveTopology(D3D10_PRIMITIVE_TOPOLOGY_LINELIST);

    // select which vertex buffer to display
    UINT stride = sizeof(VERTEX);
    UINT offset = 0;
    device->IASetVertexBuffers(0, 1, &pBuffer, &stride, &offset);

    // apply the appropriate pass
    screenPass->Apply(0);

    // draw the vertex buffer to the back buffer
    device->Draw(temporary2DVerts.size(), 0);

    temporary2DVerts.clear();
}

EDIT - just to be clearer - there are 4 vectors of vertices. two that don't change and two that constantly change. permanent 2D and permanent 3D and a temporary version of both. This is so the permanent ones can just be loaded in and are always drawn, and the temporary ones  only get drawn for a frame. This way I can create moving lines for debugging, like line of sight cones etc.

EDIT - the naive approach would be to duplicate this code 4 times for each vector, but surely there is a better way? I don't think this is a hard thing to do, but trying to do it has exposed a basic gap in my knowledge about what some of these lines of code do. should I just populate one big list from all the vectors and push that through?

some need to be drawn with different passes, and some don't need to be changed each frame. for example, the permanent ones can just stay on the gpu. right?

sentences:
Why is my DX9 render target restricted to 512×512? When I use a render target higher in resolution than 512×512, I receive an image with black borders, depending on how big this texture was.

Why is this? How can I fix it?

Here's how I create the texture and render target surface:

p_Device->CreateTexture(512, 512, 1, D3DUSAGE_RENDERTARGET,
    D3DFMT_A16B16G16R16, D3DPOOL_DEFAULT, &p_renderTexture, NULL);
p_mainRenderTexture->GetSurfaceLevel(0, &p_renderSurface);

And this is the main render-to-texture function:

void RenderSceneToTex(LPDIRECT3DDEVICE9 p_Device, D3DCOLOR clearColor,
        LPDIRECT3DSURFACE9 p_renderSurface, D3DXMATRIX matView,
        D3DXMATRIX matProjection, bool drawWater, bool drawTransparent,
        bool drawSkybox, LPSTR renderTech) {
    p_Device->SetTransform(D3DTS_VIEW, &matView);
    p_Device->SetTransform(D3DTS_VIEW, &matProjection);
    effect->SetMatrix("matView", &matView);
    effect->SetMatrix("matProjection", &matProjection);
    p_Device->SetRenderTarget(0, p_renderSurface);
    p_Device->Clear(0, 0, D3DCLEAR_TARGET | D3DCLEAR_ZBUFFER,
        ((clearColor != NULL)?clearColor:D3DCOLOR_XRGB(0, 0, 0)), 1.0f, 0);
    p_Device->BeginScene();
    DrawSceneObjects(p_Device, drawWater, drawTransparent,
        drawSkybox, renderTech);
    p_Device->EndScene();
    p_Device->SetRenderTarget(0, p_dx_mainRenderSurface);
}

sentences:
Anti- Aliasing a small image? As you can see above, I have an image of a game I've been working on using Java. Using AWT I added the following:

public static void drawImageRotated(
        Graphics2D g2d, BufferedImage img, double x, double y, int scale, double angle) {

    BufferedImage image = new BufferedImage(
                                     (int)(img.getWidth() * 1.5D),
                                     (int)(img.getHeight() * 1.5D),
                                     2);
    Graphics2D g = (Graphics2D)image.getGraphics();
    g.setRenderingHint(RenderingHints.KEY_ANTIALIASING, RenderingHints.VALUE_ANTIALIAS_ON);
    g.rotate(Math.toRadians(angle), image.getWidth() / 2, image.getHeight() / 2);
    g.drawImage(img,
                image.getWidth()  / 2 - img.getWidth() / 2,
                image.getHeight() / 2 - image.getHeight() / 2,
                null);
    g2d.drawImage(image,
                 (int)x-(image.getWidth()*scale/2),
                 (int)y-(image.getHeight()*scale/2),
                 image.getWidth()*scale,
                 image.getHeight()*scale,
                 null);
    g.dispose();
}

This is the code which draws the ships onto the screen. As you can see there is a blue and a cyan ship on the screen, the blue ship's rotation being 0 and the cyan having a rotation of just over 270 degrees. The cyan ship is distorted and that's what I want to get rid of. Is there an anti-aliasing for small images like that one (16x16)?

sentences:
What's the best way to store tiles' infos in a 2D table? I need to know what's the less time / memory consuming way to store the infos about each tile in a 2D table. The first thing that came to my mind was creating a table holding the infos, and then storing in each tile the string or the number used to access these infos, like:

tilesTable = {
    ["sand"] = {
        walkable = true,
        image = "sand.png",
        --stuff
    },
    ["sea"] = {
        walkable = false,
        image = "sea.png" --...and so on
    }
}

map = {{"sea", "sand", "sand"},
       {"sea", "sea", "sand"},
       {"sea", "sea", "sea"}}

And then accessing their informations like

print(tilesTable[map[x][y]].image)

And the same would be with number indexes.

But then I tought that when trying to access the infos for each tile, I am first accessing the _G table, then the map table, then the map[x] table, then using the result to access again the _G table and the tilesTable, so I tought to store in each position the reference to a global / local table, like

--[[local]] sand = {walkable = true, image = "sand.png"}
--[[local]] sea = {walkable = false, image = "sea.png"}

map = {{sea, sand, sand},
       {sea, sea, sand},
       {sea, sea, sea}}

So that then I just have to call

print(map[x][y].image)

Which i suspect being faster, especially if the table is stored as a local variable.

What should I do? Again, what is the way that is faster and consumes less memory?

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:
Basic terrain shader without using external texture I have this:

(Right now I have the height map in a x*x size 2D array and a 1D vector too.)
What I am trying to achieve is something like this:

Without using any textures, only plain colors. So basically smooth transitions and some shadow (using shaders).
My vertex shader looks like this:
    #version 330
    layout (location = 0) in vec3 Position;
    layout (location = 1) in vec3 Normal;
    layout (location = 2) in vec3 Color;

    out vec3 fragmentNormal;
    out vec4 ex_color,pos;
    out vec3 N;
    out vec3 v;

    void main () {
    pos= vec4(Position,1);
    ex_color = vec4(Color,1);
    fragmentNormal = Normal;

    v = vec3(gl_ModelViewMatrix * pos);
    N = normalize(gl_NormalMatrix * Normal);

    gl_Position = gl_ModelViewProjectionMatrix * vec4(Position,1);

I have normals for all the vertices. Color is set simply in the c++ code based on height.
Here is the fragment shader
    in vec3 N;
    in vec3 v;
    in vec4 ex_color;
    void main(void)
    {
       vec3 L = normalize(gl_LightSource[0].position.xyz - v);
       vec4 Idiff = gl_FrontLightProduct[0].diffuse * max(dot(N,L), 0.0);
       Idiff = clamp(Idiff, 0.0, 1.0);
       gl_FragColor = Idiff*ex_color;
    }

So I guess my problem is what formula should I use to mix the colors. I think I don't need to set the colors in the c++ code but in the shaders.
Update:
Here is the wireframe of the terrain.

Update2:
Based on @Babis' answer the result is:

So the gradient is not "projected" onto the surface as I would like to do. What could cause this? Maybe my qustion wasn't clear.

sentences:
Unity new Input system lists actions and compare them to current input I have a scriptable object called Move that had a list with keycodes (for example to make a Hadouken) easy to use and compare with the current input made it with the old system, but with the new input system I don't know how to make a list of actions (actions that are in my Input Action Asset not new ones) and compare that with the current inputs (and also I do not have any idea how to make buffering inputs like the last input repeats 3 frames).
I already tried and not worked (InputMa is my InputActionAsset generated class):
-InputActions[]
-InputMa[]
-InputMa.PlayerActions
-InputActionReferences[] this seems the correct option, but I don't know how to get the reference from the current input.

sentences:
How do I storing a Score in each level? I have a problem when I store the DistanceScore to text, the problem is why the DistanceScore always storing at text number 1, this happens when I play at level 2 which is the DistanceScore could be store in text number 2and so on, FYI I have 3 levels here.
here the preview

as you can see on the top of level 2 gameplay is distance so when i dead the distance saved and storing to text each level.

and when I go to the main menu the Level 1text updated instead of Level 2.
this is my script:
public Item[] _item;

public int mapIndex;

public enum ITEM_TYPE
{
    LEVEL
}

public ITEM_TYPE _type;

private void Start()
{
    loadItemInformation();
}

public void loadItemInformation()
{
    for (int i = 0; i < _item.Length; i++)
    {
        if (_type == ITEM_TYPE.LEVEL)
        {
            _item[i].bestScore.enabled = true;
            _item[i].distance.enabled = true;

            float distanceUi = PlayerPrefs.GetFloat("distance" + i.ToString());
            float value = PlayerPrefs.GetFloat("Time" + i.ToString());
            float minutes = Mathf.FloorToInt(value / 60);
            float seconds = Mathf.FloorToInt(value % 60);

            if (value == 0)
            {
                _item[i].bestScore.text = "No Record Yet";
            }

            else
            {
                _item[i].distance.text = "Unstopable ";
                _item[i].bestScore.text = "Best Time = " + string.Format("{0:00}:{1:00}", minutes, seconds);
            }

            _item[i].distance.text = "Long distance = " + distanceUi.ToString();

        }
    }
}

}
    [System.Serializable]
    public class Item
    {
        public TextMeshProUGUI bestScore;
        public TextMeshProUGUI distance;
    }

here the distance script:
#region Distance
[Header("Distance")]
public Transform checkPoint;
public TextMeshProUGUI distanceText;
M_GameManager _GameManager;
private float distance;
private float highDistance;
float index;
#endregion

private void Start()
{
    _GameManager = FindObjectOfType<M_GameManager>();
    checkPoint = GameObject.FindGameObjectWithTag("Finish").transform;
    distanceText = GameObject.FindGameObjectWithTag("DistanceTxt").GetComponent<TextMeshProUGUI>();
    index = (float)(PlayerPrefs.GetInt("Level"));// typo here i call it set and now I've fix it
}
index = PlayerPrefs.GetFloat("Level");
distance = (checkPoint.transform.position.x - transform.position.x);
    if (transform.position.x > checkPoint.transform.position.x)
    {
        distance = 0;
        //PlayerPrefs.SetFloat("distance" + index, distance);
    }
    if (_GameManager.isDead || _GameManager.isTimeout || _GameManager.fuelFinished)
    {
        PlayerPrefs.SetFloat("distance" + index, distance);
        PlayerPrefs.Save();
    }
    distanceText.text = distance.ToString("F1") + "m";

and for _item[i].bestScore.text this work to storing each level but why for the distance not working.

sentences:
Changing the camera movement in unity I have a code that allows me to move the camera on the x-axis. I need it to move on the y-axis as well as the x.

    using UnityEngine;
using System.Collections;

public class orbit : MonoBehaviour {

    public float turnSpeed = 4.0f;
    public Transform player;

    private Vector3 offset;

    void Start () {
        offset = new Vector3(player.position.x, player.position.y + 8.0f, player.position.z + 7.0f);
    }

    void LateUpdate()
    {
        offset = Quaternion.AngleAxis (Input.GetAxis("Mouse X") * turnSpeed, Vector3.up) * offset;
        transform.position = player.position + offset;
        transform.LookAt(player.position);
    }
}

sentences:
Implement delay using polling or threads? I'm making a real-time risk-like game in Python. Players can move armies from one region to another. I want army movement to take time proportional to the distance between the two regions, therefore I need to keep a new timer every time an army moves from one region to another (until the army arrives).

I've thought of 2 ways to do this:

One way is to have a list of moving troops and do a for loop through this list every iteration of the main server loop to check if the time is up for each unit.

Another way is to create a new thread for each moving troop and have the run() method of the thread continuously check whether the time is up yet for the unit.

Which way is better?

sentences:
Unity world asset streaming TL;DR: What approach should i use for streaming a maps assets?

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

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

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

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

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

sentences:
How to prevent (most) cheating (server-side) in my JavaScript, Node JS, socket.io MORPG? I'm working on a fairly simple JavaScript + Node JS + socket.io (M)MORPG where multiple people play in the same world.
This is actually working, but cheating is insanely easy at the moment.

My goal is not to stop people from cheating client-side, I know this is impossible.
My goal is to have the server know when someone is cheating and do something about it.
What I really want to know is how well a Node JS server would be able to handle the constant anti-cheat checking.

People can just adjust the client-side JS code and the server currently doesn't do too much checking.

So a player could just change his X & Y coordinate and teleport around the map at will.

It would be fairly simple to implement basic checks that don't allow crazy cheats.
But I'd like a real way to prevent this.

One possibility is to keep track of all player data on the server and make sure nothing weird is happening client-side by constantly comparing the data the server has.
My issue with this is that I have a lot of collision checking and my world will become rather big.
I'm not sure how good of an idea it is to do all of this collision checking server side as well. Sure it would work for one or two players, but what about 10? 50? 200?
Especially with all of these players bouncing off walls, shooting bullets, hitting monsters, getting hit by monsters, colliding with monsters, ...

As far as I know, the only way to actually prevent cheating is by making the server check all movement and wall/bullet/monster collisions.

Are there any other options? Like using an anti-cheat engine of some sort? I know games like MapleStory have that, but I have no idea how they work or how affordable that would be?

Or will doing all the collision checks server side be fine?
At some point, like around 50-100 players, I could set up a second server instance to limit the amount of players on each server.
Ofcourse I would also only check collisions near the player, so not map-wide for each player.

Any help/advice on this is appreciated.

Here's a link to my game that will make my questions less abstract.
It's far from finished and the world is still very small, but it should give a good idea of what I'm asking:

http://185.115.218.199:3000/

sentences:
How to determine what color will be written into single pixel framebuffer? I thinking about rendering into single pixel (1x1) framebuffer.
For example we have two triangles which covers whole NDC area, one is green second red.

What color will be written to 1x1 framebuffer? As far as I understend graphic API (no matter which) tries to put whole scene in to given framebuffer, in our example, into single pixel. But I can't figure how GPU will choose what should  be written into that pixel.

sentences:
JBullet - How can I make my object float on the water? I'm trying to use JBullet for a ship PVP game.

I've got two ships which are meant to rest on the water. Obviously these ships will be colliding, but the problem I have currently is "water" collision.

Water cannot be a "solid" object, and I cannot work anything out that will allow it to have the ship resting in it without falling over or having some sort of speed dampening effect.

Also, the ships keep being launched upwards or downwards depending on the collision. The problem here is that I cannot set a weight for the ships, because if I did, they would currently be sinking into what JBullet believes to be nothingness.

How would I simulate water in this collision world?

sentences:
Finding the Balance - Income vs Expenditure I'm working on a game idea that uses an in-game currency, and basic business (income/outcome).

Basically, a certain type of building will generate 'income' per seconds until it hits a certain capacity (per building).

There are many different types of buildings, each with their own 'rate', 'income' and 'capacity', as well as 'cost to purchase building' in the first place.

I want to know if there is a good tactic, or strategy on how to balance this out? I don't want to make the purchasing of the buildings too easy - so the user has to only wait a few seconds ... thats pointless.

And on top of that - each building can be upgraded, which basically increases the 'rate', 'amount' and 'capacity' - with each upgrade increasingly getting more expensive - however this is relative as the user is now getting more cash flow.

Thanks.

sentences:
What is the correct multiplication order for a 2D matrix? I'm currently trying to create a camera and entity/model matrix for my 2D game similar to that of Unity3D.
I've already tried to find answers to this question on stackoverflow/gamedev but i couldn't find an answer that explains how to center the camera and image.

Goal:

Have a camera matrix wich is centered at the position of the camera.
Have a entity matrix wich draws everything centered

Current implementation:

camera: matrix = Matrix.translation(Screen.width * 0.5, Screen.height * 0.5) *
                 Matrix.rotation(camera.rotation_radians) *
                 Matrix.scale(camera.scale.x, camera.scale.y) *
                 Matrix.translation(camera.x, camera.y);

entity: matrix = Matrix.rotation(entity.rotation_radians) *
                 Matrix.scale(entity.scale.x, entity.scale.y) *
                 Matrix.translation(entity.x, entity.y);

image component draw function:
                 setMatrix(camera.matrix * entity.matrix);
                 drawImage(x=0, y=0, image) // position is already included in the entity matrix

Results:

Image rotates around the upper-left corner of the screen not around it's center
Image is not centered. The image's origin is at its upper-left corner.
The camera matrix seems to be correct.

Questions:

What is the correct multiplication order for the entity/model matrix?
Can i use a single matrix for all components of a entity or do i need to calculate in the width/height of the image/text/animation component.

sentences:
Rendering terrain only with GPU This is not about generating plane geometry and then applying a shader on it. Instead, I want a big single flat plane, then apply a shader on it.

The vertex shader has a uniform vec3 realPlanePosition and calls a height calculation function:

// Vertex shader code

uniform vec3 realPlanePosition;

varying vPosition;

float heightCalculation(vec2 verticePosition) {
    // Just for pseudo-code (more black magic append here).
    return magicNoise2D(verticePosition.x, verticePosition.y);
}

void main(void) {
    vec3 vPosition = position;
    vec2 verticePosition = vec2(vPosition.x + realPlanePosition.x,
                                vPosition.y - realPlanePosition.z);

    vPosition.z = heightCalculation(verticePosition);

    gl_Position = projectionMatrix * modelViewMatrix * vec4(vPosition, 1.0);
}

In my plane update code, I just change realPlanePosition with player position, for example. The plane moves on (x, z) (X rotation: -PI/2.0). The only thing the vertex shader updates is the z (due to plane rotation) value of gl_Position.

Is this good practice? Also, how do I detect collisions with it? And finally, how can I control other terrain objects' generation (rocks, trees, ...)

sentences:
Actual Sizes of An Image loaded with a Path I have a method which selects an Image from device. I need to show this image to users.

The codes below works fine, does what I need.

    Texture2D texture = new Texture2D(512, 512);
    texture.LoadImage(System.IO.File.ReadAllBytes(imgPath));
    texture.Compress(false);
    texture.Apply();

I just want to know how to change new Texture2D(512, 512) to real size of this Image.

Maybe this: new Texture2D(img.ActualWidth, img.ActualHeight)

Any idea?

Additionly is there any way to get original width and height from an Image loaded from a base64String ?

    byte[] imageBytes = Convert.FromBase64String(base64Str);
    Texture2D textureImage= new Texture2D(**250, 300**);
    textureImage.LoadImage(imageBytes);

sentences:
AI for a mixed Turn Based + Real Time battle system - Something "Gambit like" the right approach? This is maybe a question that's been asked 100 times 1,000 different ways. I apologize for that :)
I'm in the process of building the AI for a game I'm working on. The game is a turn based one, in the vein of Final Fantasy but also has a set of things that happen in real time (reactions). I've experimented with FSM, HFSMs, and Behavior Trees. None of them felt "right" to me and all felt either too limiting or too generic / big.
The idea I'm toying with now is something like a "Rules engine" that could be likened to the Gambit system from Final Fantasy 12. I would have a set of predefined personalities. Each of these personalities would have a set of conditions it would check on each event (Turn start, time to react, etc). These conditions would be priority ordered, and the first one that returns true would be the action I take. These conditions can also point to a "choice" action, which is just an action that will make a choice based on some Utility function. Sort of a mix of FSM/HFSM and a Utility Function approach.
So, a "gambit" with the personality of "Healer" may look something like this:

(ON) Ally HP = 0% -> Choose "Relife" spell
(ON) Ally HP < 50% -> Choose Heal spell
(ON) Self HP < 65% -> Choose Heal spell
(ON) Ally Debuff -> Choose Debuff Removal spell
(ON) Ally Lost Buff -> Choose Buff spell

Likewise, a "gambit" with the personality of "Agressor" may look like this:

(ON) Foe HP < 10% -> Choose Attack skill
(ON) Foe any -> Choose target -> Choose Attack skill
(ON) Self Lost Buff -> Choose Buff spell
(ON) Foe HP = 0% -> Taunt the player

What I like about this approach is it makes sense in my head. It also would be extremely easy to build an "AI Editor" with an approach like this. What I'm worried about is.. would it be too limiting? Would it maybe get too complicated?
Does anyone have any experience with AIs in Turn Based games that could maybe provide me some insight into this approach.. or suggest a different approach?
Many thanks in advance!!!

sentences: How do I draw a full screen quad in DirectX 11? How do I draw a full screen quad that shows red on the screen?

sentences:
Unity not opening in Ubuntu I installed the latest version version of Unity for Linux from the official website, but when I try to launch Unity, it displays a blank dialog box. I waited for a long time, but nothing happens.

These are my system specifications. I was running Unity on the same computer, several months ago, using Windows.

Model: Thinkpad R500
Processor: Intel® Core™2 Duo CPU P8600 @ 2.40GHz × 2
RAM: 2Gb DDR3 RAM
Storage: 155Gb HDD
Graphics Card: ATI Mobility Radeon HD 3400 Series 128mb dedicated GFX

Why is it doing this? Is there a problem with the latest build? What should I do to fix it?

sentences:
Sprite sheet resolutions and Tile Maps I am making a game using Cocos2d-x and want to support multiple mobile phone resolutions and sizes.

Right now I have made my game sprite sheets set on a resolution of iPad Retina's resolution of 2048X1536 and then will use Tiled Map editor to design my game levels.

My question is on what basis do I scale my sprite sheets for different resolutions suppose iPhone etc so that my Tiled Map's design does not get effected when used in the game ?

sentences:
Calculating 2D (screen) coordinates from 3D positions in XNA 4.0 I have a program that draws some items to the scene by loading their positions from a file. Now I want to place a Ray on the same location where the items are drawn. So my question is how can I calculate the position of the ray (it's 2D components) by using 3D coordinates of each particular item? The items don't move anywhere, so once they are placed they stay until the end of the programs execution.
 Thanks.

sentences:
Raycast, UI and Update Question I have movable objects in a scene.  When Raycast hits an object, I have a hovering UI that moves to a retaliative distance from the hit object.  When the object is dragged, the UI's position is moved relative to the object.  The UI accesses script functions by way of the Button(Script) component.  I attached my functions to the buttons in the editor.

My issue is when the hovering UI is overlapping the view of another object, the UI moves to the object under the UI and never performed the function.
I would like for raycast never to hit the underlying object while my hovering UI is up, or at least to not hit the underlying object while the UI is in the way.

Both scripts are attached to the object tiles.

updatePentagon.cs

using UnityEngine;
using System.Collections;

public class updatePentagon : MonoBehaviour {
    public Transform target;
    public GameObject UI;
    private RaycastHit hit;
    private Plane dragPlane;
    private Vector3 dragPlaneNormal = Vector3.up;
    private float distanceToDragPlane = 0;
    Ray ray;

    void Update () {
        if (Input.GetMouseButtonDown (0)) {
            ray = Camera.main.ScreenPointToRay (Input.mousePosition);
            if (Physics.Raycast (ray, out hit, 100f) ) {
                //if ((hit.collider.tag == "tileUI")  ){
                    //UI.SetActive (true);
                    target = hit.transform;
                    dragPlane = new Plane (dragPlaneNormal, target.position);
                //}
            }
        }
        if (Physics.Raycast (ray, out hit)) {
            if (Input.GetMouseButton (0)) {
                ray = Camera.main.ScreenPointToRay (Input.mousePosition);
                if (target) {
                    if (dragPlane.Raycast (ray, out distanceToDragPlane)) {
                        target.position = ray.GetPoint (distanceToDragPlane);
                    }
                }
            }
        }
    }
}

updateTileUI.cs

using UnityEngine;
using System.Collections;

public class updateTileUI : MonoBehaviour {
    public GameObject tileHandler;
    updatePentagon updatePentagon;
    float UIoffset = .2f;
    Vector3 pos;

    void Start () {
        updatePentagon = GetComponent<updatePentagon> ();
        updatePentagon.target.Rotate(0, 36, 0);
        updatePentagon.target.Rotate(0, -36, 0);
    }
    void Update () {
    }
    void OnMouseDown(){
        updatePentagon = GetComponent<updatePentagon> ();
        pos = updatePentagon.target.position;
        pos.y = updatePentagon.target.position.y + UIoffset;
        tileHandler.SetActive (true);
        tileHandler.transform.position = pos;
        }
    void OnMouseDrag()
    {
        tileHandler.transform.position = updatePentagon.target.position + new Vector3(0, UIoffset, 0);
    }
    public void cancelUI(){
        tileHandler.SetActive (false);
    }
    public void turnRight(){
        updatePentagon.target.Rotate(0, 36, 0);
        }
    public void turnLeft(){
        updatePentagon.target.Rotate(0, -36, 0);
    }
    public void confirm(){
        //activate colliders
        tileHandler.SetActive (false);

    }
}

sentences:
Board-Games Design: Physical vs Digital? Is there any difference when learning the designing of a physical board-game and digital board game, meaning if I watch a tutorial about a physical board-game design is it applicable on a digital one?

Note: I'm focusing only on design process, not the art-design, only on the gameplay-design (rules, levels, obstacles, etc).

sentences: How to change Unity's display settings/resolution? Unity displays in poor quality on my computer (the software itself), I was wondering how to change resolution/display settings?

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:
How to create smoke that spreads outward in all directions? I saw many tutorials about smoke grenade but they just use volumetric smoke. I want to make something like the smoke grenade in PUBG, where the smoke spreads in all directions; how to do that?

The Unreal Engine 4 smoke grenade throws out smoke in a particular direction, like this:

But I want something more like PUBG's that spreads smoke evenly in all directions:

sentences:
Unity3d - AudioSource is not playing if gameObject is removed after play was started I am not able to play my audio source if I deactivate the panel where the AudioSource is attached to AFTER it.

    _audioBtnEnter = tmpBtnGeneral.GetComponent<AudioSource>();
    _audioBtnEnter.Play();
    tmpBtnGeneral.SetActive(false);

I would totaly understand if this would not be possible:

    tmpBtnGeneral.SetActive(false);
    _audioBtnEnter.Play();

But why does the first code not trigger the audio play?

Is this a race condition problem?

sentences:
How can I get started programming OpenGL on Mac OS X? I'm trying to start OpenGL programming on a Mac, which brings me into unknown territory on a lot of things.

During the day, I'm a Web Developer, working in C# and before that in PHP and Delphi, all on Windows.

During the night, I try to pick up Mac/OpenGL skills, but everything is so different. I've been trying to look for some books, but the OpenGL books are usually for iOS (tons of them out there) and the Mac Books usually cover "normal" application Development.

I want to start simple with Pong, Tetris and Wolfenstein.

I see that there are a bunch of different OpenGL Versions out there. I know about OpenGL ES 1&2, but I don't know about the "big" OpenGL Versions - which ones are commonly supported on 10.6 and 10.7 on current (2010/2011) Macs? Are there any up to date (XCode 4) books or tutorials?

I don't want to use a premade Engine like Unity yet - again, I know next to nothing about any Mac development.

sentences:
Removing unecessary permissions from AndroidManifest that Unity+Plugins put in there? My game has a lot of unnecessary permissions added to it, I suspect some are coming from plugins and some from Unity. I've looked at all the AndroidManifest.xml files and couldn't find any that use those permissions so I suspect it's added as a post build process or some other way by the plugins wrapped up in a binary or something.

Is there a way to remove those permissions in a post process build step?

sentences:
How do I use rigidbody2d.AddForce to apply a force in the direction the object is facing? I'm trying to create a thruster on a spaceship.  It should add this thrust in the direction the thruster is facing, but I am at a loss on how to get that direction and send it to AddForce.  Am I even heading in the right direction with this script?

public float maxThrust;
FixedUpdate()
{
 float moveVertical = Input.GetAxis("Vertical") * maxThrust;
 Vector3 heading = rigidbody2D.transform.eulerAngles;
 Vector2 thrust = new Vector2(heading.normalized.x, heading.normalized.z);
 rigidbody2D.AddForce(thrust * moveVertical);
}

Maybe I'm not understanding something with EulerAngles or Vectors, but it sure seems like this would be a straightforward thing to do.

sentences:
Clamp point to triangle for sphere collision I'm having some issues clamping a 3d to barycentric triangle. I've searched for some time now and keep seeing the same results, that (u,v,w) should be clamped between 0 and 1. But when I clamp those values, I'm getting very weird results as it saying it's always intersecting. Maybe I'm just clamping the wrong values or what I'm doing wrong.

The issue is that I'm projecting a point on a normal from a given triangle, then testing if the point is inside the triangle, if it is, test if it's inside the sphere. Everything works great except when the sphere center is no longer above/in front of the triangle, so the spheres edge can pass through the edge of the triangle beings that the spheres center is no longer above it. Any help with how I'm supposed to clamp the position inside of the triangle would be much appreciated.

Here is a snippet of the triangle/sphere intersect method:

public boolean CollidesWithMesh(MeshCollider other)
{
    float sphereRadius = gameObject.scale * (bounds.Scale().Max()) / 2f;
    boolean collided = false;
    RawMesh mesh = other.gameObject.meshRenderer.mesh.rawMesh;

    for(int i = 0; i < mesh.triangles.length; i++)
    {
        //Store the verts used in the triangle
        int first = i++;
        Vector3 vert1 = mesh.vertices[(int) mesh.triangles[first]].Add(other.gameObject.position);
        Vector3 vert2 = mesh.vertices[(int) mesh.triangles[i++]].Add(other.gameObject.position);
        Vector3 vert3 = mesh.vertices[(int) mesh.triangles[i]].Add(other.gameObject.position);

        //Project a point along the normal closest to the spheres center
        Vector3 normal = mesh.normals[(int) mesh.triangles[first]];
        float dot = Vector3.Dot(normal, gameObject.position.Subtract(vert1));
        Vector3 d = normal.Multiply(dot);
        Vector3 point = gameObject.position.Subtract(d);

        //If the point is not inside the triangle, continue
        Vector3 v0 = vert3.Subtract(vert1);
        Vector3 v1 = vert2.Subtract(vert1);
        Vector3 v2 = point.Subtract(vert1);
        float dot00 = Vector3.Dot(v0, v0);
        float dot01 = Vector3.Dot(v0, v1);
        float dot02 = Vector3.Dot(v0, v2);
        float dot11 = Vector3.Dot(v1, v1);
        float dot12 = Vector3.Dot(v1, v2);
        float invDenom = 1 / (dot00 * dot11 - dot01 * dot01);
        float u = (dot11 * dot02 - dot01 * dot12) * invDenom;
        float v = (dot00 * dot12 - dot01 * dot02) * invDenom;
        if(!((u >= 0.0) && (v >= 0.0) && (u + v <= 1))) continue;

        //If the sphere does not encapsulates the point, continue
        if(!Contains(point)) continue;

        //Respond to the collision
        Vector3 responseNormal = point.Subtract(gameObject.position).Normalized().Multiply(sphereRadius - (point.Subtract(gameObject.position)).Length());
        Vector3.Subtract(gameObject.position, responseNormal);
        if(normal.y > 0.75) isGrounded = true;
        if(normal.y < -0.75) hitCeiling = true;
        collided = true;
    }
    return collided;
}

sentences: Unity - Modify basic dissolve shader graph to dissolve from bottom up I have this dissolve shader made in shader graph which works fine, however I would like it to dissolve from bottom up, how would this be done?

sentences:
Supersampling - Pixel color average calculation I am currently trying to understand Supersampling.

Wikipedia says (or at least Wikipedia tells me) that multiple color samples are taken from one pixel to calculate the final result. But to my mind one pixel has exactly one color and logically, the average of an infinite amount of equal colors remains the same.

So, how can the resulting color differ from the original pixel's color?

sentences:
Unity Transform Origin during Animation I have a sliding animation on this penguin model which moves the penguin from a standing position to a belly position. During this animation, I've noticed that the object transform origin stays locked relative to the animation, using the encoded origin from blender.  In my case this is an undesired pivot point and is often buried beneath other game objects I may want to raycast against.

Ideally, I am hoping to have the origin centered in the model with respect to the XZ plane throughout the animation. Toggling the handle position tool to "Center" in the editor gives me an origin that is closer to what I would like, however I understand this is just a feature of the editor and does not reflect the true object transform.
My question for everyone is:
What are some ways I can achieve a transform that follows the body of my animation?
I have parenting an empty game object, but this transform still would not follow the body animation.
For raycasting below the body specifically, I am considering following the transform of my armature's spine which does follow the animation. Would this be a valid approach?
Any help is much appreciated!

sentences:
Unity 3d Raycast from localspace to worldspace I want a raycast direction not relative to the rotation, but what happens is that the raycast points to one place as if it was a transform.forward

Why is the happening help

if(Physics.Raycast(transform.position, vector3.forward, out hit, SupportedDistance, CanBeSupported))
{
     NotSupported = false;

    //
}

sentences:
Best practice for 4x game management in Unity? I'm trying my hand at creating a turn-based 4x game in Unity, with a galaxy map and 2D hexagon grid maps for each individual planet. The planet grid hexes would be gameobjects, with the overall grid being around 30x40 in size. The number of planets would be under 50.

What would be the best way to set this up? I'm looking for a solid approach regarding performance here, but one that also caters to easier design/programming would be a plus.

Some approaches I've come up with:

Load all of the grids for the individual planets at the start into a single scene, with each being under a "planet gameobject", and then set those gameobjects to inactive. The galaxy map would be its own scene that is loaded additively when needed; clicking on a planet to view it would set its associated gameobject to active and then unload the galaxy map scene.
Instantiate the gameobjects for planets as they're called up; the grid data for the planet is dynamically loaded as part of this. The planet gameobject is destroyed when no longer needed. Galaxy map would function the same as approach 1.
Individual scenes for each planet, loaded/unloaded additively when needed. A separate, single scene would be used for loading procedurally generated planets.

Seems to have serious challenges for managing units/resources across planets/scenes.

Approach 1 seems to be the most straightforward, as the core of the game would be managed in a single scene, but I am concerned about performance. I'm setting up some test projects to stress test the approaches, but it'd be great to get feedback from someone with more experience.

Any help is appreciated!

sentences:
Regarding physics engines and the GPU The rigid body physics engines that use a "bounding box" for collision detection, I am aware of how they are created.

What I want to know is, is there a physics engine that does not use "bounding box" but actually uses something like vertex data to do the physics calculations? What type of physics engine is this called, and does it use the GPU?

sentences:
How to change the speed of an NPC? I created a blueprint. I added several components to the blueprint. I made it follow a target point and it does it correctly. I'd like to make the NPC make this way to the target point faster, but I do not know how to set the speed.

How I Created:

Components of the NPC:

I've clicked on all components looking for a way to set their speed. I also clicked Class Settings and Class Defaults, but nothing resulted.

Then I tried to find some function or command related to the speed, taking a reference from the NPC itself:

I added values to tranform, but did not change the result in the game at all:

Links that I clicked at the time I typed the title of the question:

How do I change the speed of an object without changing path travelled?

Changing speed of an object

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:
Multithreading in Gamedevelopment, specifically Networking Let me quick explain my actual setup:

I use 2 Threads, one for networking and one for the main-loop (input, update, render). I have two synchronized queues, one for mainthread->networking and one for networking->mainthread. When a chunk of bytes arrives, the network-thread decodes a paket. The network-code knows, what each paket is and what it does. It now creates a functor to change the coordinates of an entity, to spawn a new one, or something else. It emplaces this functor in the queue and the main-tread executes every tick all the functors in the queue.

This kinda works for now, but i think i have to change this completely. I might split up some parts of the main-thread, input for example, and stick it in another thread. Also, i might want to add support for plugins written in lua, python or some other language, and i don't want the main-thread to get stuck when the plugin decides to run a long-running task. This would mean, eventually the main thread has to handle a decent number of queues, one for every thread plus one extra for the other direction (thread->main). Also, at the moment, the networking needs to have all the pointers to the data-structures it wants to control (For example, it has a ptr to the entitymanager stored, so it can create a functor to spawn a new entity in the entitymanager), thats kinda weird.

Are there common techniques to synchronize threads better? Especially since i have to provide a lot more control over the gamestate and still need to synchronize the other threads with the main-thread, i don't really see a better approach other then the functor-queue, so i hope for some suggestions.

sentences:
How can I make object to follow first person character and the camera without making the object child? using System.Collections;
using System.Collections.Generic;
using UnityEngine;

public class ObjectFollowCamera : MonoBehaviour
{
    public Transform cameraToFollow;
    public Transform objectToFollow;
    public float distanceFromCamera;

    private void Update()
    {
        objectToFollow.position = new Vector3(cameraToFollow.position.x,cameraToFollow.position.y,cameraToFollow.position.z - distanceFromCamera);
    }
}

This script is attached to a empty GameObject.
The objectToFollow will move once i'm moving the Player with the keys. But when i'm rotating the camera of the player around the objectToFollow is not moving.

The Player have attached to it: Character Controller , First Person Controller , Rigidbody

And the Camera is child of the Player.

sentences:
Loading Collada Files Quickly (three.js, OpenGL, Javascript) Okay, so I've created these sleek-looking spaceship models for an OpenGL game that I'm going to make. To make them look sleek and smooth, I used a Subdivision Surface modifier in Blender. Hmm... 100000+ triangles.

I've managed to get the files down to the 30 to 40 thousands range (EDIT: under ten thousand, but with loss of quality) in terms of triangles though. So the file size is usually around a few megabytes.

Soon I found out that this wasn't really a problem when rendering the spaceships. However, I did quickly notice that it takes forever for Firefox to load one spaceship. And I want to load three of them, possibly more.

Chances are if I create a game that starts up with a "Please wait five years whilst everything loads" loading bar, it's going to turn away a lot of users. And I still haven't even considered loading planets, images, and a bunch of other stuff.

So now, for my questions:

Has anybody else run into this before? Is there a generally accepted solution for this type of problem?
Speaking of libraries, is there one that could apply the subdivision surface modifier on the models at run time? Then I could just export the model frames, which are only somewhere around 1000 triangles.

Also, any other input would be very much appreciated.

Thanks! :)

EDIT: What I've tried so far:

So far, compression looks like a no-go but I'm not sure.

method 1: zip folders: zipping the files drastically reduces filesize, but it requires a gigantic zip.js library to actually use the zip folders. So far I've been unable to get it to work, I guess the zip.js API is just way over my head.
method 2: custom compression: I've managed to make my own sort of compression system, but it's not nearly as effective and only cuts away half of the file size. Oh and it also looks like it is broken ATM xD

EDIT: just realized that the bottleneck might not be my internet speed, but rather the Collada file loading script that I'm using. (ColladaLoader.js, it's from three.js) in this case compression is definitely out of the picture.

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:
extrapolating object state based on updates I have a networked multi-user collaborative application. To maintain a consistent virtual world, I send updates for objects from a master peer to a guest peer. The update state contains

x,y,z  coordinates of object center and his rotation matrix(CHAI3d api used a 3x3 matrix) with 30Hz frequency.

I want to reduce this update rate and want to send with a reduced update rate. I want a predictor on both peers. When the predicted value is outside, say a error value of 10% in comparison to  master peers objects original state the master peer triggers a state update.

Now for position I used velocity,position updates so that the guest peer can extrapolate position.

Like velocity for position what parameter should I use for rotation extrapolition?

sentences:
How to make a fun slot machine? We currently have a simple slot machine in our online virtual world game.

You set the amount you want to bet (in virtual money) and pull the lever, and depending on the 3 figures (there's only one line) you get a reward, a free round, lose some more money, or most of the time, get nothing at all. You can instantly pull the lever again. The previous bet will be maintained.

At the moment this slot machine isn't really fun to play. The chances of winning something are pretty low (though when you win, you can win a lot). When you pull the lever, the result is determined (though not shown) immediately, so there's also no way influence the outcome of the wheels.

How can it be made more fun?

sentences:
How do you deal with transitions in animating walking? I'm pretty new to this whole animating models thing. Just learning the ropes. I got a nice walking animation going, which I can loop while a character is walking, but what about when they stop walking?

I mean, they could be at any point in the animation at the time the player stops walking. How do I get them to smoothly return to a standing still position without having them snap into that position? The same goes for starting walking from a standing still position. Do you need a separate animation? How is this dealt with?

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 can I use OpenType Font in libGDX Is there a way I can use an OTF file with libGDX.

The following throws an exception:

gameFont = new BitmapFont(Gdx.files.internal("data/font.otf"));

Caused by: com.badlogic.gdx.utils.GdxRuntimeException: Invalid padding.

This is the same error thrown if I were to try to use a non font file type as well. (i.e. .png .mp3 etc). I have been able to use .fnt files in the past. Is there anyway around this? Thanks.

sentences:
Why does adding LIBGDX "fadeIn" action to a table in a group make the whole stage fade in? I'm trying to "fadeIn" a store "screen" which is really just an invisible group. I set the group to visible=true, set the alpha to 0 and then do a "fadeIn" on the group. The problem is that the whole stage goes black (my clear screen color) and then fades back in.

storeGroup.addAction(Actions.sequence(Actions.alpha(0), Actions.fadeIn(1)));

I even went as far as to make the Table within my StoreGroup accessible and adding the action to that, but the result is the same.

storeGroup.getTable().addAction(Actions.sequence(Actions.alpha(0), Actions.fadeIn(1)));

Essentially I just want my store group to fade in over whatever is currently displaying, but the fade in seems to apply to every other actor in my Stage, not JUST the one I'm adding it to.

Any help would be greatly appreciated, I've been working on this all morning and can't figure out why the "fadeIn" is applying to everything.

sentences:
How to access entites from scripts in an entity-framework? I'm developing on a simple libGDX-based Game and im using the entity-component-system ashley.

For non-generic but custom behaviour (e.g. the Player Movement), I'm using "scripts" instead of reuseable and generic Entity-Systems. Therefore I've got an ScriptComponent and a ScriptSystem which runs init() and update() on all scripts related to an entity.

At some point I want to generate a map, counting game-related-properties etc.
that brings me to the point where I'm confused about how to access those porperties from any script.

In other Engines/Enviroments like Unity3D the GameObjects (the entities) brings functionality to find other entities like FindGameObjectsWithTag(...).

But how can I realise that in ashley? Also should it be possible in an Entity-Framework to access specific entities in general?

Edit: Additional information

Here comes a simple example-usecase. This is very notional example I've just created for that post. I just wanted to demonstrate, that I thing there is a need of an "main Game Object" in a game which also uses a entity-component-framework like ashley. So I thought a correct way is, to let this main-game-object be an entitiy too which holds the main script. But I'm not sure, if this is a good approach.

Here I demonstrate this with having a PlayerScript which just sets the lives for the player accordingly to the difficulty level of the game (maybe set by the player on the main-menu-screen). This PlayerScript is attached to the ScriptComponent of the player entity.

public class PlayerScript extends Script {

 int playerLives;

  public void init() {
     GameEntity entity = getTheEntityByName("game"); // this method doesn't exist
     GameScriptComponent gsc = scriptComponentMapper.get(entity);
     GameScript mainGameScript = gsc.getScriptByName("game");
     if(mainGameScript.getDifficulty == "easy")
     playerLives = 999;
  }
}

sentences:
What is the right way to use a QStateMachine for a text adventure game? I have seen a couple topics about this already but they were a bit vague for me so I decided to make this. I'm working on a little adventure game just for fun in Qt, its basically just text on the screen and the player inputs commands into a line edit widget which I then process and do the related action/event. Thing is, I am a little confused on how to approach this. I don't want to dig myself a hole by manually coding in lots of commands and events per room because it seems to just be a pain later on. So then I thought about using some sort of database to store the information but which one should I use? I would love some advice from people who have tried something similar.

And here, these pictures are a rough outline of what I am trying to do.

Edit: I should add, the tiles for the level basically work like this. The light gray is a direction the player can move in, the dark gray parts are walls and the colors are various different actions you can do.

I don't particularly care for code, but I would like suggestions on what tools to use for this and maybe how to set them up right.

sentences:
Does it matter who does the collision detection? I gave an answer to How to decide which GameObject should handle the collision?, and received a lot of negative feedback on it, claiming that it does not matter who does the collision detection. I am not understanding that stance.

For example:

There are 100 bullets and 1 player on the screen. Let's assume brute force collision detection and no optimization such as layers or references.

If the collision detection is done by the bullet, each bullet must detect for collision on 100 different objects. That's 100 x 100 detections, for 10000 detections total.

If the player does the detection, that's 100 detections total, one for each bullet.

Am I mistaken? If so, what am I missing?

sentences:
Unity - movement code overriding rigidbody mass? Unity noob here...
I have a basic movement script, but whatever I set the objects mass at it still falls the same speed, floating down off ramps instead of sticking to the floor.
I saw some posts referencing that the movement translate can override the rigidbodys downward velocity. Well I tried several code adjusts but I couldn't get it to work correctly.
float h = Input.GetAxis("Horizontal");
float v = Input.GetAxis("Vertical");

// this code is to keep movement direction when switching to alternate camera
if (Input.GetButtonDown("Horizontal") || Input.GetButtonDown("Vertical")) {
    viewForward = Vector3.Scale(Camera.main.transform.forward, new Vector3(1, 0, 1)).normalized;
    viewRight = Vector3.Scale(Camera.main.transform.right, new Vector3(1, 0, 1)).normalized;
    viewRight = new Vector3(viewForward.z, 0f, viewForward.x * -1f);
    }

moveDirection = v * viewForward + h * viewRight;
if (moveDirection != Vector3.zero) {
    // moveDirection.y = rb.velocity <-- not working
    transform.position += moveDirection * Time.deltaTime * moveSpeed;
    transform.rotation = Quaternion.LookRotation(moveDirection);
    }

Could someone point out what I'm doing wrong?

sentences:
What does [dynamic] do in HLSL Here's an example (this if() is inside of a for loop, which itself has the [unroll] attribute):

[dynamic]
if (n.x > 1.0f || n.x < -1.0f || n.y > 1.0f || n.y < -1.0f || n.z < 0.0f || n.z > 1.0f)
{
    break;
}

I've never seen this before, but I stumbled across this in a shader I'm trying to convert to glsl. Searches turned up nothing but the SM 5 dynamic linking ability. I looked at the available if() attributes, and there's only [branch] and [flatten] listed.

sentences:
How can I compile SM 3.0 effects in D3D11 in SlimDX? var bytecode = ShaderBytecode.CompileFromFile("shaders\\testShader.fx", "fx_5_0", ShaderFlags.None, SlimDX.D3DCompiler.EffectFlags.None, null, null, out str);
var effect = new SlimDX.Direct3D11.Effect(gpu.Device, bytecode);

This works fine but if I try to use another shader model like 4.0 or 3.0 it throws an error on the new effect creation:

E_FAIL: An undetermined error occurred (-2147467259)

How do I compile older shaders?  And I've read about device context but I can't find any information on how to use them to maintain DX9 compatibility.

sentences:
How can I make a sprite move in the direction it's facing using radians? I am using PGELua for the PlaystationPortable. I would just like to know how to make a 2D sprite move in the direction that the sprite is facing.

When the sprite is blitted to the screen it should be heading down the y axis (like it's moving up the screen) but it doesn't appear to be working that way. As far as I am aware, the angles of the images use radians for the rotations.

I have this in a function

function FUNC_MOVE_SHIP(speed,angles)
    VAR_SHIPX = VAR_SHIPX + pge.math.sin(angles) * speed
    VAR_SHIPY = VAR_SHIPY + pge.math.cos(angles) * speed
end

and I call it in my main program like

    FUNC_ST_DR()
    if pge.controls.held(PGE_CTRL_LEFT) then
        VAR_SHIP_ANGLE=VAR_SHIP_ANGLE-0.01
    elseif pge.controls.held(PGE_CTRL_RIGHT) then
        VAR_SHIP_ANGLE=VAR_SHIP_ANGLE+0.01
    end
    FUNC_MOVE_SHIP(VAR_SHIP_SPEED,pge.math.rad(VAR_SHIP_ANGLE))
    SHIP_11:activate()
    SHIP_11:draweasy(VAR_SHIPX,VAR_SHIPY,pge.math.rad(VAR_SHIP_ANGLE))
    FUNC_EN_DR()

sentences: Should I learn OpenGL 1.5? I want to start learning OpenGL with a book I have since a long time ago (Beginning openGL Game Programming) and it uses OpenGL 1.5 so my question is, should I learn OpenGL using this book and then learn a higher version? or should I start learning a higher version at once? are the same core concepts applied to higher versions?

sentences: How do I prevent modders from creating malicious code? Let's say I have both a game and a modding system for it. The modding system loads DLL files containing custom features and allows mod creators to override certain functions to change game mechanics. This is all well and good until some mod creator decides to put a keylogger or a virus in one of those DLL files. What can be done to prevent this problem? Is there any way to allow a high level of customisability in a modding system while still maintaining a strong level of security for the end user?

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:
Workaround the flip queue (AKA pre-rendered frames) in OpenGL? It appears that some drivers implement a "flip queue" such that, even with vsync enabled, the first few calls to swap buffers return immediately (queuing those frames for later use). It is only after this queue is filled that buffer swaps will block to synchronize with vblank.

This behavior is detrimental to my application. It creates latency. Does anyone know of a way to disable it or a workaround for dealing with it?

The OpenGL Wiki on Swap Interval suggests a call to glFinish after the swap but I've had no such luck with that trick.

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:
svg spaceship game movement 2d I've been searching for a way to make an svg box move to all directions using js. I have seen many tutorials on how to do it grid like, but I want it so have a square that can turn, move forward, backwards and sideways. In terms of movement, I want to be like https://www.chromeexperiments.com/experiment/arena5 except there will be a square instead of a triangle and there will be no enemies.

My problem is that I don't know how to make an svg square move fluidly and without a grid, but the movement will only use keyboard, no mouse. Please be patient I'm new to js gaming.

Here is the most reason version of what I've trying, this is svg, right now I'm trying to make it in canvas.http://codepen.io/julian-a-avar/pen/PqZvxp

sentences:
Animations won't transfer states until entire animation is completed I am following the survival shooter tutorial and am using Unity 5.

I just completed this video (linked) and I tested played it to see my animations worked but it seems like it will only transition from idle to walking after the entirety of the idle animation completes. The idle animation is quite long so my character will move around when it looks like its idling since the movement responds right away.

Did I mess up something in my transitions? I followed the directions exactly and didn't change anything in the inspector that I wasn't told to do.

sentences:
How to search for all uGui scripts in scene in the Unity editor? I have many game objects whose properties I need to edit because of a bug/error.

However, this is very time consuming, because I need to check each game object one by one.

Is there any way to search for all game objects that (for example) contain uGui Scripts in a scene?

sentences:
OpenGL Two-point perspective view Summary:
I want vertical lines to be drawn as vertical lines regardless of their position relative to the camera (distance/offset). I want the projection to be perspective so the furthest objects from camera look smaller while keeping their respective proportions.
What am I trying to achieve: A two (vanishing) point perspective like this one http://insidetheoutline.com/wp-content/uploads/2019/07/2_Point_Perspective_Cityscape.jpg
Why am I at it: I'm really bad at 3D (obviously) therefore I'm trying to replace character models with 2D sprites like in Populous 3, or "The Game" quest in Fable 3. I also want to have a top-downish view like in isometric games. Alas, perspective distortion totally kills the effect, making sprites look skewed whenever they are off-center.
What am I doing right now:
  glMatrixMode(GL_PROJECTION);
  glLoadIdentity;
  gluPerspective(FOV, wndWidth / wndHeight, zNear, zFar);
  // Googling lead me to this MV matrix, alas it's not working for me
  // {
  //  1, 0, 0, 0,
  //  0, 1, 0, 0,
  //  0, -camY/camZ, -camZ, 0,
  //  0, 0, 0, 1
  // }
  glMatrixMode(GL_MODELVIEW);
  glLoadMatrixf(@cam);
  // camX = camY = camZ = 50
  gluLookAt(
    camX, camY, camZ,
    0, 0, 0,
    0, 0, 1
  );
  // then I draw a uniform grid -5..5 by -5..5
  // and slightly off-center wireframe box to test if they are drawn correctly

Does it work? No, it doesn't. Provided matrix produce no result at all, so I had to change it to { 1, 0, 0, 0, 0, 1, 0, 0, 0, 0, 1, 0, 0, -camY/camZ, -camZ, 1}. Just like any text on a two-point perspective says: "Set one of the values in the last column to zero". I tried zero in any position, except the last one, to no avail. Generally, I get something like this:

The rightmost vertical line--the one that aligns with screen center--is vertical, just as I want all of them to be, but the others are skewed away.
What else I managed to google: Not much, really. I found an example that kinda looks like something I want to achieve, but they place the camera at ground level with zero Z delta, effectively eliminating the third vanishing point. In some other example, they just narrowed FOV to some absurdly low value, making it look like a two-point perspective to some extent.
I'm afraid I'm missing or misunderstanding something. I also not sure if the desired output will, in fact, look like I want, and I won't discard it if it's not.

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:
Ray casting through terrain mesh + Octree ( Mesh collision ) I'm currently in development of a terrain editor which i will use for my game. One thing that is partially stopping my development is that I don't have collision detection implemented between mouse ray cast and the terrain mesh.

The terrain is consisted of triangles and can be lowered and raised.Also the x and y values of the mesh don't change. Of course what i need to do is ray cast through my mouse positions and get intersected triangle. I would get the point on the triangle using Barycentric coordinates. Just I'm not quite sure how does octree come into play here. As far as I understand it it works like a 3d quadtree, splitting the box into smaller box that the ray intersects. But which box do i choose ? How do i know which box is the closest one to the terrain, if either raised or lowered terrain ? How many subdivisions would i have? I was thinking on having as much as i have tiles( basically the last level of subdivisions would correspond to a x^3 box).

Right now i'm just doing collision with the 0 Z-value plane, and it works okay, but if the terrain is a bit raised then this can give faulty results.

Other two methods that i found is to iterate through the mesh, which of course is insanely inefficient; the other is to project the terrain in reverse and then i guess do some checking with the mouse coordinates (think it's called z-buffer checking or something).

If anyone has any other ideas i'm all ears. Just note that the algorithm should be an efficient one (of course this depends on the implementation) and accurate.

Thanks !

sentences: Another app has the same name as mine on the appstore! I am about to publish a game on the android playstore and the ios appstore. It is called "PairIt". I checked a while back to see if there were any other apps named PairIt on the playstore, and there were none. But I did not check on the appstore. Yesterday, when I tried publishing my app onto the appstore, it said the name was taken. After looking around on the appstore I saw someone else had an app named PairIt. So what I did was changed my app name to "PairIt!". Will this work? Could I get into any legal troubles for this?

sentences:
How should I store a Game Database on Android? I'm looking at creating a game for Android and while I have most of the ins and outs worked out, the one thing I'm struggling with is how to store data for the game.

Ultimately, the game will be based off of a lot of pre-defined data and statistics so the obvious choice to me would be something like SQLite, but as I'm pretty new to the realm of Android and Game Development, I'm not 100% certain if this is the right route to follow.

The data will be general pre-defined data as well as player data (along the lines of careers stats - what place finished, etc).

I was wondering if there was a better/best practice solution that wasn't SQLite and that would provide said functionality and if so, could you point me in the right direction?

sentences:
How can I detect enclosed areas in an arbitrary set of overlapping lines I have game where there can be arbitrary lines, these lines can overlap. I want to find out first if there are any enclosed shapes created by overlapping lines, and then I want to fill the enclosed shape.
The best guess I have at doing this comes from this other post: determine if a set of tiles on a grid forms and enclosed shape. From what I can gather this would be, given a graph you can detect loops. However I can't quite figure out how to construct the graph from my data.
Is this a good way to go about solving this problem? And if so, any pointers on how I might get there given a list of collisions?

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:
With Monogame is it possible to await SoundEffect or SoundEffectInstance before playing another SoundEffect or Song? I am trying to do some proof of concept work using Monogame, mostly for my own knowledge.  One thing I am having trouble with, however, is timing sounds effects and background music to my liking.

So in my scenario I would like to play a series of SoundEffect objects when the game first loads, and when those effects have finished, play a Song in the background until the game is finished.  When either the player or computer meets victory conditions the game will end, which involves stopping the background Song, playing a win/lose SoundEffect, and loading the end screen.

Here's where I started:

var open0 = Content.Load<SoundEffect>("Open0");
var open1 = Content.Load<SoundEffect>("Open1");
open0.Play();
open1.Play();
bgMusic = Content.Load<Song>("BGTrack");
MediaPlayer.Play(bgMusic);
MediaPlayer.IsRepeating = true;
MediaPlayer.Volume = 0.25f;

This approach ends up just playing all three items simultaneously.  Its more noise than good game experience.

I also tried moving the Play() method calls into an async method and using await on the threads, but of course Play() doesn't return Task so that didn't work. Likewise, SoundEffectInstance and DynamicSoundEffectInstance don't seem to offer any kind of awaitable method calls, unless I'm missing them.

I also tried wrapping subsequent calls in a while loop, using the SoundEffectInstance.State property as my logic control:

var open0 = Content.Load<SoundEffect>("Open0");
var open1 = Content.Load<SoundEffect>("Open1");
SoundEffectInstance open0Instance = open0.CreateInstance();
SoundEffectInstance open1Instance = open1.CreateInstance();

open0Instance.Play();
while (open0Instance.State != SoundState.Playing)
    open1Instance.Play();

while (open0Instance.State != SoundState.Playing &&
        open1Instance.State != SoundState.Playing)
{
    bgMusic = Content.Load<Song>("BGTrack");
    MediaPlayer.Play(bgMusic);
    MediaPlayer.IsRepeating = true;
    MediaPlayer.Volume = 0.25f;
}

Ugly code, but I was trying to figure out what would work...and this didn't.  The first sound played and nothing else, so I'm guessing the State property doesn't implement INotifyPropertyChanged (although I'm not even sure that's relevant outside of MVVM now that I think about it).

The sounds at the end of the game are not giving me trouble because I can simply stop the MediaPlayer and play my closing Effect:

MediaPlayer.Stop();
gameObjects.PlayerWinEffect.Play(1.0f, 0.0f, 0.0f);

So is there a way to control SoundEffect and MediaPlayer timing more explicitly?

sentences:
XNA Tile from Screen Location I have a tile based game that is in a semi-isometric view created by a transformation. The tiles are created by a Texture2d rendered on a 3d surface.

Map Image: http://balancedcms.com/Capture.PNG

I am using the following code for transformation:

View = Matrix.CreateLookAt(new Vector3(0, -1.1f, 1.6f), new Vector3(0, 0, 0), new Vector3(0, 53, 0));
Projection = Matrix.CreatePerspectiveFieldOfView(MathHelper.Pi - 2.4f, 4.0f / 3.0f, 1, 500);

quadEffect = new BasicEffect(device);

quadEffect.World = Matrix.Identity;
quadEffect.View = View;
quadEffect.Projection = Projection;
quadEffect.TextureEnabled = true;

quad = new Quad(new Vector3(0, 0, 0), Vector3.Backward, Vector3.Up, 3, 3);

My problem comes along when I attempt to get the current tile that I am hovering the mouse over. I have a mouse X and Y however I can't seem to figure out how to transform these screen coordinates into a tile X and Y. The tiles are 128px by 128px; however, after the camera transformation they are smaller on the top and larger on the bottom(to create the isometric view)

I've tried transforming the mouse X and Y with the same projection matrix. However, this didn't work. I think it is due to the view matrix not being taken into account... sample below:

Vector3.Transform(new Vector3(Mouse.GetState().X, Mouse.GetState().Y, 0), Projection);

This image may provide more information... is also shows the hours I've put into figuring this out: http://balancedcms.com/1111.png

sentences:
How can this kind of entity/component organization improve cache efficiency? I've been reading up about entity component systems as a design pattern for an OpenGL engine. The style I'm trying to implement has entities only being integers, and components being long contiguous arrays of, for example glm::vec3 for a world-position component.

The entity integers then work as indices into those arrays. All of this described best by this post.

As I understand, the main benefits of an ECS would include:

Simplification and elimination of unnecessary dependencies and spaghetti code
Performance boost: contiguous component arrays translate into fewer cache misses and an overall de-bloating of complex inheritance

While I do agree with the first point, I don't understand how the second could be true.

On a regular draw call, you'd need almost always the majority of components. You need position, scale, rotate for loading a MVP matrix into the shaders. You need the mesh and textures for rendering itself. You even need details like light color or whether or not it casts shadows. Everything! This means that you will inevitably encounter cache misses in some form, since you can't fit your component arrays in cache.

Add to that the fact that since the entity integers are indices into the component arrays, all of the component arrays need to grow in size whenever you add an entity - independent of it's type. This means that adding 30 entities with no mesh will inevitable generate 30 empty mesh allocations that will never be used.

How would you implement such a system to truly minimize cache misses without incurring in unnecessary memory waste?

sentences:
Getting location / bounds of centered text I want to show a dialog box where the user should answer a question.
It would look like this:

The question is aligned horizontally.

I don't show the entire question text right away, but it builds up character by character like this:

To do that, I store the text string in a variable at the script start, then I set the text to "", and in a coroutine I add character after character to the text component.

My problem is that (because of the horizontal alignment) Unity wants to build it up starting from the center like this:

Since this is not what I want, I was thinking that I should perhaps measure the bounds of the entire text while it is horizontally aligned, then I would turn off the horizontal alignment and make it left-aligned instead and set its position according to the measure bounds.

However, I don't know if I can measure the bounds of the text anyways.

Can anybody suggest how to handle this problem?

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: What is the status of Monogame now that XNA has been discontinued? XNA has officially been discontinued, with support no longer being offered by Microsoft. Does this mean that Monogame has died also? I see that the site still says it is based upon XNA 4. What is the official status of Monogame?

sentences:
Rotate 2d sprite towards pointer I'm using Crafty.js and am trying to point a sprite towards the mouse pointer.

I have a function for getting the degree between two points and I'm pretty sure it works mathematically (I have it under unit tests). At least it responds that the degree between { 0,0} and {1,1} is 45, which seems right.

However, when I set the sprite rotation to the returned degree, it's just wrong all the time. If I manually set it to 90, 45, etc, it gets the right direction..

I have a jsfiddle that shows what I've done so far.

Any ideas?

sentences:
Why is sin = Y and cosine = X? I'm new to game development in some phases and I want to understand everything I do (at least most of it) so I've started developing in MonoGames framework (XNA) and I saw a function like this.

rocket.angle = System.Math.Atan2(rocket.rocketdirection.X , -rocket.rocketdirection.Y);

I didn't understand this function (I was following a tutorial) and dove deeper into understanding sin, cos and tan. Now I have some understanding over it but one thing is unclear to me.

This was shown to me in a way to show how you calculate sin, cos and tan and I didn't understand it.

Why is the circle represented as 1,1 and -1,-1?
And why is Y = sin and X = cos?
And through this tan = cos/sin?

Can somebody explain this picture in a better way, in a way that is relatively easy to understand?

sentences:
Manipulating time in Unreal messes up Physics simulation? I'm trying to achive a Super Hot like gameplay, where the time only flows when the player moves.

But when I stop time, then restart it, physics simulation will be messed up. Like:

Cloths starts flying around like they are in a tornado.
Rigidbodies fly away, like they were shot from a cannon.

All of these without any kind of forces being applied to them. They were just standing still, I stopped time, then I restarted Time and Booom, rigidbodies fly around.

I use this in the player's Tick method:

auto settings = GetWorld()->GetWorldSettings();
settings->SetTimeDilation(timeScale);

sentences:
graphical interface when using assembly language I want to learn a framework to use in assembly. I know that's not possible without learning the framework in C first. So I'm thinking of learning SDL in C and then teach myself how to interpret the program and run it as assembly language code. Then I will have a window and some graphics routines to display the game while using assembly to code everything in. I need to spend some time learning SDL and then some more time learning how to code all those statements using assembly while calling C functions and knowing what registers returned calls use and what they leave etc.

My question is, is this a good way to go or is there something better to get a graphical window display using assembly language?

sentences:
Why every character I drag to timeline is disabled in the timeline? I dragged 3 different characters to the timeline window and each one asked for track so I did animation track for all of them but on each track on the left side there is a yellow triangle say "The component is disabled"

I created cinemachine virtual camera and it added the brain component to the main camera and created a timeline automatic for the virtual camera but when dragging a character to the timeline window I'm getting this yellow triangle with the message it's disabled.

You can see in the screenshot on the left side in the timeline window the yellow triangles with the message.

sentences:
SDL2 focus lost = massive gain in FPS Whenever I lose focus from my game window, I go from ~60FPS to 6000+, then when the window gains focus again, I go back to around 60 frames per second. And yes, this happens every time I run my game, including Release mode.

Here is an example log output from my game:

[INFO] [10/01/2013 22:37:42.355] Window Gained Focus!
[INFO] [10/01/2013 22:37:45.365] Frames Per Second: 60.0439
[INFO] [10/01/2013 22:37:45.365] Frame Counter: 60
[INFO] [10/01/2013 22:37:46.365] Frames Per Second: 60.0324
[INFO] [10/01/2013 22:37:46.365] Frame Counter: 60
[INFO] [10/01/2013 22:37:47.381] Frames Per Second: 59.4341
[INFO] [10/01/2013 22:37:47.382] Frame Counter: 58
[INFO] [10/01/2013 22:37:49.669] Window Lost Focus!
[INFO] [10/01/2013 22:37:50.383] Frames Per Second: 1240.02
[INFO] [10/01/2013 22:37:50.383] Frame Counter: 9561
[INFO] [10/01/2013 22:37:51.384] Frames Per Second: 1839.02
[INFO] [10/01/2013 22:37:51.384] Frame Counter: 6662
[INFO] [10/01/2013 22:37:52.77] Window Gained Focus!
[INFO] [10/01/2013 22:37:52.400] Frames Per Second: 1656.77
[INFO] [10/01/2013 22:37:52.400] Frame Counter: 34
[INFO] [10/01/2013 22:37:53.400] Frames Per Second: 1512.46
[INFO] [10/01/2013 22:37:53.400] Frame Counter: 60
[INFO] [10/01/2013 22:37:54.401] Frames Per Second: 1391.89
[INFO] [10/01/2013 22:37:54.402] Frame Counter: 60
[INFO] [10/01/2013 22:37:55.402] Frames Per Second: 1289.78
[INFO] [10/01/2013 22:37:55.402] Frame Counter: 58
[INFO] [10/01/2013 22:37:55.876] Quitting with error code: 0

The frame counter is just a simple integer that I increment every loop in the game, and then reset (and print it out) every second. Here is the implementation of my game loop, (inside the run() function), based off of this article.

Is this a problem with my loop, or is this a problem with SDL? I'm not sure why my frame rate is rocketing up.

sentences:
Water cut off effect in UE4 Working on a side scroller game in Unreal Engine 4 and I need to create a water cut off effect like seen in the screenshot of Ori and the Blind forest.

Basically need a side perspective on water bodies like lakes and ponds where I can see objects underwater as well as above water. Water may be subject to ripples and disturbances (caused by player or fish swimming in the water).

Thanks

sentences:
Logic only GUI library I'm not sure whether this place is the correct for asking this. If it's the wrong place I'm sorry, please tell me if so!

I'm making a small game for fun which would uses an own engine with OpenGL and Vulkan as underlying renderer implementation. The engine itself is targeted for Mono/.Net.

Currently I'm not yet there but I'll come to the point where I'm pushed to implement some kind of GUI (I'm thinking ahead because of good design).
I already searched the Internet for render independent GUI systems but I wasn't lucky yet. As result I thought about how I could implement the GUI on my own and came to the conclusion:

a independent implementation is needed which takes care only for layout, positioning of GUI objects with responding to inputs.
another implementation is needed which only takes the results of calculations for rendering (the renderer)

Before I start inventing the whole wheel new I simply want to know:

Is it a correct approach to doing it this way? Is there a different common approach doing what I described?

sentences:
Count number of CCNodes of a certain class on a layer Pretty simple question. I'm working in Objective C (cocos2d) and I'm trying to count the number of a sprites of a certain class are present on the current layer being displayed. For example, I have a class named Seal which is a subclass of of CCNode and in my current layer I want to count how many instances of type Seal are present.

I know how to count the number of children of the layer by doing

int numberChildren = [[self children] count];

which correctly returns the number of children on the layer. But I just want the number of Seals on my layer. How could I do this? Thanks =)

sentences:
Is there a fundamental technical reason for Flash being a more popular game platform than JavaScript? Both Javascript and AS3 are implementations of ECMAScript.

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

sentences:
MonoGame: PC + Mobile? I'm researching Monogame. Their goal is to allow "easy" porting of an existing XNA/Windows game to mobile.

Does this mean you can have one solution (theoretically) with shared code, and it works on all three platforms (PC, Android, iPhone)? Or do you need to port your game from PC to Android, and then again to iPhone?

I'm sure "write once, run anywhere" works 80% of the time, I'm not worried about that other 20% like support for GPS, acceleratometer, etc. which doesn't exist on all platforms.

sentences:
Why would a borderless full-screen window stutter occasionally? I want to be able to allow players to switch between full-screen, windowed, and full-screen-with-a-borderless-window rendering modes. The last mode, borderless is an important one lots of players, myself included.

I have noticed that my game will stutter a little bit in borderless windowed mode. It's not terrible, but choppy gameplay can get slightly annoying and I want to it to be as smooth as it is in full-screen. I know other games have always had some issue with being borderless. I just figured since my game isn't that intensive I shouldn't see much of problem.

I am using David Amador's "XNA 2D Independent Resolution Rendering" code. The trouble comes when I create my gameplay screen and use the following code to create a borderless window:

Form gameForm = (Form)Form.FromHandle(curGame.control.Handle);
gameForm.FormBorderStyle = FormBorderStyle.None;

If I have it set to fullscreen through Amador's Resolution class then this borderless code doesn't seem to do anything at all. If I have it set to windowed it does work as expected and creates a borderless window. The only problem is that strange choppy behavior.

In full screen it doesn't lag one bit so I'm wondering if there's some issue with how the borderless code works. Is how I'm doing a borderless window correct? Am I just going to have to deal with a little bit of stuttering in that mode?

sentences:
Why do my pyramids fade black and then back to colour again I have the following vertecies and norms
GLfloat verts[36] = {

-0.5, 0, 0.5,
 0, 0, -0.5,
0.5, 0, 0.5,

0, 0, -0.5,
0.5, 0, 0.5,
0, 1, 0,

-0.5, 0, 0.5,
0, 0, -0.5,
0, 1, 0,

0.5, 0, 0.5,
-0.5, 0, 0.5,
0, 1, 0

};

GLfloat norms[36] = {

0, -1, 0,
0, -1, 0,
0, -1, 0,

-1, 0.25, 0.5,
-1, 0.25, 0.5,
-1, 0.25, 0.5,

1, 0.25, -0.5,
1, 0.25, -0.5,
1, 0.25, -0.5,

0, -0.5, -1,
0, -0.5, -1,
0, -0.5, -1
};

I am writing my fists Open GL game, But I need to know for sure if my Normals are correct as the colours aren't rendering correctly. my Pyramids are coloured then fade to black every half rotation then back again.

My app so far is based on the boiler plate code provided by apple. heres my modified setUp Method
 [EAGLContext setCurrentContext:self.context];

[self loadShaders];

self.effect = [[GLKBaseEffect alloc] init];
self.effect.light0.enabled = GL_TRUE;
self.effect.light0.diffuseColor = GLKVector4Make(1.0f, 0.4f, 0.4f, 1.0f);

glEnable(GL_DEPTH_TEST);

glGenVertexArraysOES(1, &_vertexArray); //create vertex array
glBindVertexArrayOES(_vertexArray);

glGenBuffers(1, &_vertexBuffer);
glBindBuffer(GL_ARRAY_BUFFER, _vertexBuffer);
glBufferData(GL_ARRAY_BUFFER, sizeof(verts) + sizeof(norms), NULL, GL_STATIC_DRAW); //create vertex buffer big enough for both verts and norms and pass NULL as data..
uint8_t *ptr = (uint8_t *)glMapBufferOES(GL_ARRAY_BUFFER, GL_WRITE_ONLY_OES); //map buffer to pass data to it
memcpy(ptr, verts, sizeof(verts)); //copy verts
memcpy(ptr+sizeof(verts), norms, sizeof(norms)); //copy norms to position after verts
glUnmapBufferOES(GL_ARRAY_BUFFER);
glEnableVertexAttribArray(GLKVertexAttribPosition);
glVertexAttribPointer(GLKVertexAttribPosition, 3, GL_FLOAT, GL_FALSE, 0, BUFFER_OFFSET(0)); //tell GL where verts are in buffer
glEnableVertexAttribArray(GLKVertexAttribNormal);
glVertexAttribPointer(GLKVertexAttribNormal, 3, GL_FLOAT, GL_FALSE, 0, BUFFER_OFFSET(sizeof(verts))); //tell GL where norms are in buffer
glBindVertexArrayOES(0);

And the update method.
- (void)update
{

float aspect = fabsf(self.view.bounds.size.width / self.view.bounds.size.height);
GLKMatrix4 projectionMatrix = GLKMatrix4MakePerspective(GLKMathDegreesToRadians(65.0f), aspect, 0.1f, 100.0f);

self.effect.transform.projectionMatrix = projectionMatrix;

GLKMatrix4 baseModelViewMatrix = GLKMatrix4MakeTranslation(0.0f, 0.0f, -4.0f);
baseModelViewMatrix = GLKMatrix4Rotate(baseModelViewMatrix, _rotation, 0.0f, 1.0f, 0.0f);

// Compute the model view matrix for the object rendered with GLKit
GLKMatrix4 modelViewMatrix = GLKMatrix4MakeTranslation(0.0f, 0.0f, -1.5f);
modelViewMatrix = GLKMatrix4Rotate(modelViewMatrix, _rotation, 1.0f, 1.0f, 1.0f);
modelViewMatrix = GLKMatrix4Multiply(baseModelViewMatrix, modelViewMatrix);

self.effect.transform.modelviewMatrix = modelViewMatrix;

// Compute the model view matrix for the object rendered with ES2
modelViewMatrix = GLKMatrix4MakeTranslation(0.0f, 0.0f, 1.5f);
modelViewMatrix = GLKMatrix4Rotate(modelViewMatrix, _rotation, 1.0f, 1.0f, 1.0f);
modelViewMatrix = GLKMatrix4Multiply(baseModelViewMatrix, modelViewMatrix);

_normalMatrix = GLKMatrix3InvertAndTranspose(GLKMatrix4GetMatrix3(modelViewMatrix), NULL);

_modelViewProjectionMatrix = GLKMatrix4Multiply(projectionMatrix, modelViewMatrix);

_rotation += self.timeSinceLastUpdate * 0.5f;
}

But providing I understand this correct one pyramid is using the GLKit base effect shaders and the other the shaders which are included in the project. So for both of them to have the same error, I thought it would be the Norms?

sentences:
Drawing to create game drafts Man, I'm really bad at drawing...
I feel myself really ashamed because I cannot draw even a little nice sword... :(

The problem is, on game development (I will be on the programming part, relax!) I will need to explain some game ideas to game artists, like "I need that city like this" or "that character needs to have that look and feel".

My idea is, I really need some BASIC skills on drawing some draft of what I'm thinking...

I'm bad in pen/paper drawing and photoshop/corel drawing, but I'm convicted to learn photoshop or corel to draft something...

Someone has passed that problem? What you recommend?

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:
How do 3D player collision work? I don't really know how to explain this but I have always wondered how simple player movement collision work. Take Half-Life or Counter-Strike for example.

Their player collision against the world are very simple - AABB collision box vs. simple brushes. For example, you walk towards a wall and when you collide with it, you are perfectly still.

While in Unity, there we have PhysX which is not even the slightest suitable to achieve perfect, almost pixelated(in 3D) player collisions.

sentences:
Key mapping for a 2-players game I've been struggling for a while trying to figure out the best way to map two players on a single keyboard. Let's consider something generic:

Arrows
Validation
Cancel (optional)
Some common actions shared between the two players (start, reset, etc.)

So far, I used:

P1: WASD + [Space or Tab]
P2: Arrows + [Enter or Return]
Common: R for reset

The problem is that some configuration can be uncomfortable on certain keyboards (especially when there is no keypad). Plus some players like to have the direction on left hand (FPS style) and others on right hand (platformer style). Also SHIFT is usually not a good choice on windows because of the sticky keys feature.

Also I'd like to avoid using a settings screen (kind of heavy for a small game). I guess a config file would be OK, but is there another way to handle this problem that would make every one happy?

sentences:
Which is worst: Too many VertexShader instructions, or FragmentShader instructions? I want to have a better understanding of how to create shaders with optimal performance and realize where some bottlenecks can occur.

Is it usually favorable (when possible) to delegate most of the work to the VertexShader since in certain situations it may only need to process a few vertices vs. having the Fragment process the same thing potentially on thousands of pixels?

For example, if I have scrolling UV values for a texture, is it best that I pass this scroll amount in the Vertex-Shader so that it adjusts the start UV + scroll UV to a Variant register for the Fragment to read, or to just use a Fragment Constant with the scroll UV amount stored in it which will be added with the start UV's read from a Variant register?

Is passing values to one kind of Constant register (Vertex vs. Fragment) faster than the other?

sentences: What has the most efficient intersection test against an AABB tree - OBB, Cylinder or Capsule? I'm currently trying to find collisions in 3D between a tighter volume than an AABB and a tree of AABB volumes. I just need to know whether they are intersecting, no closest distance or collision response. An OBB, Cylinder or Capsule would all roughly fit these purposes but Cylinder and Capsule were the first thing I thought of, which I have found little information about detecting intersections online. Am I right in thinking that they would always be more complex to perform Separating Axis Tests on even though they might seem like simpler shapes? I figure by the time I get my head around SAT for curved shapes I could have done the thing with OBBs but I wanted to find out for sure.

sentences:
Main game objects as static I'm making a game for Android using Android Studio with Libgdx in Java.
In my game there are main object like Screen, ObjectFactory, SoundPlayer, Painter (Responsible for drawing) and a few more. 'til now I passed them to each GameObject that uses them but then I realized I could just make them static and every GameObject who needs them will just call them statically.
I wonder if I make these main objects static, would it hurt the performance? Because it seems like such a comfortable solution...
Thanks in advance.

sentences:
How is ball_pos calculated I'm new to game development and I'm trying to build my first Pong game on the Godot engine. the tutorial I'm following is given below.

Simple Pong Game

What I don't understand is the line:

ball_pos += direction * ball_speed * delta

How is the new ball position being calculated?

As far as I know, delta is the time elapsed in seconds (float) since the last _process() call.

Also, why is the direction vector set to (1.0, 0.0)?

I'm looking for a clear explanation since the tutorial doesn't explain much. Thank you.

sentences:
WEBGL antialias false to pixel art low resolution I know this issue maybe repeated and seems to be very common but I searched first and did not find anything concrete.

I am doing some test and playing around with pixijs. I created an stage 320x180 and I am rendering an sprite of 27x27 in a autodetected renderer (WEBGL always is selected) I am in a macos retina resolution (devicepixerate 4) the problem is I can not achieve having the sprite pixelated even setting antialias false in the renderer. I tested the same without pixijs but native canvas 2d context using drawImage and I could get what I wanted using some hacks like after every drawImage set context.imagesmoothingenabled to false and I have CSS file to canvas image-rendering: pixelated. With those I am having exactly what I want, but of course I would like to obtain the same using pixijs and WEBGL. Is it possible? Disable at all antialias in a WEBGL context? How we can deal with this to render pixel arts properly?

EDITED:
Using canvas 2d context native api

Using PixiJS webgl context.

Cheers.

sentences:
Get random point on NavMesh async I am trying to spawn some entities on a navmesh at runtime. The entities need to spawn at a random point.

Right now i use the following to get a random point:

public Vector3 GetRandomPointOnMesh()
{
    Vector3 randomDirection = UnityEngine.Random.insideUnitSphere * maxDistance;
    randomDirection += transform.position;
    NavMeshHit hit;
    NavMesh.SamplePosition(randomDirection, out hit, maxDistance, 1);

    if (float.IsInfinity(hit.position.x) || float.IsInfinity(hit.position.y) || float.IsInfinity(hit.position.z))
        return GetRandomPointOnMesh();

    return hit.position;
}

My problem here is, some time that random point inside the sphere is not hitting the navmesh, hence the recursive call until it actually hits the navmesh.

How can i make this piece of code run in the background until there is an actual value returned. Cause this holds up the main thread till a value is obtained.

sentences:
Animation Change Delay When Landing On Ground I am working on a 2d platformer-like game in Unity. My problem is that when my player character jumps and lands back on the ground, there is a slight delay at times when transitioning to the player idle animation. This is not due to exit time. Instead, upon researching this topic, I found that my real problem lies in the Unity physics loop(FixedUpdate).

FixedUpdate, as the name implies, is called a fixed amount of times, not every frame. My animator relies on a Jumping boolean to tell it whether or not to be in the jumping animation. In my code, the Jumping boolean is set to false when the player lands on the ground. This is handled by OnCollisionEnter2D, which runs on FixedUpdate.

This is were I think my problem lies:

private void OnCollisionEnter2D(Collision2D collision)
{
    if (collision.gameObject.CompareTag("Ground"))
    {
        _isOnGround = true;
        _animator.SetBool("Jumping", false);
    }
}

I need to know whether or not the player is colliding with the ground, So I setup a tag. I need to find a way to constantly check whether or not I am colliding with the ground, So that I do not see an animation transition delay.

Any Ideas of how I could accomplish this?

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:
Collision detection - player gets stuck in platform when jumping So I'm having some problems with my collision detection with my platformer. Take the image below as an example.

When I'm running right I am unable to go through the platform, but when I hold my right key and jump, I end up going through the object as shown in the image, below is the code im using:

if(shapePlatform.intersects(player.getCollisionShape())){

     Vector2f vectorSide = new Vector2f(shapePlatform.getCenter()[0] - player.getCollisionShape().getCenter()[0],
             shapePlatform.getCenter()[1] - player.getCollisionShape().getCenter()[1]);
            player.setVerticleSpeed(0f);

            player.setJumping(false);
            if(vectorSide.x > 0 && !(vectorSide.y > 0)){
                 player.getPosition().set(player.getPosition().x-3, player.getPosition().y);

            }else if(vectorSide.y > 0){
                player.getPosition().set(player.getPosition().x, player.getPosition().y);

            }else if(vectorSide.x < 0 && !(vectorSide.y > 0)){
                 player.getPosition().set(player.getPosition().x+3, player.getPosition().y);
            }

}

I'm basically getting the difference between the centre of the player and the centre of the colliding platform to determine which side the player is colliding with. When my player jumps and walks right on the platform he goes right through. The same can also be observed when I jump on the actual platform, should I be resetting the players y in this situation?

sentences:
Defining collision response in an Entity system I'm building a really simple top-down 2d shooter which uses an Entity Component pattern.

I've added several different entities to a level and given them different collision groups. I have an entity to represent a teleporter (assigned to collision group A), a player entity (group B), and a bunch of enemies (Group C).

I understand that the actual collision response should be decided in the collision System based on the groups that the colliding entities belong to. What I can't figure out is how to define the specifics of a collision.

For example, if a player collides with a teleporter I need to move the player across the level. Where do I store the target location? I'd assume in a component on the teleporter. Should I create a whole new component just for that data? I feel it should be stored in the teleporters collision component but no all entities that use the collision component will require this data.

Could someone please try to enlighten me?

Thanks

sentences:
Do complementary shadows make sense for games? According to color theory, shadows work better if they don't use pure blacks or grays, but instead use a color that's complementary to the color of the object casting that shadow.

That is, if you have a red apple, you should use a dark green shadow; for a yellow banana, a dark violet shadow.

But in many games, you cannot always predict what kind of background or environment the shadow will appear in, and you may not have the luxury of having dynamic shadow colors. In such cases, does it still make sense to use complementary shadows, or is a neutral black or gray acceptable?

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:
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:
2D Boat controlling physics I'm working on a top-down 2D boat game with Unity3D. I couldn't able to understand how to implement physics of rudder controlling. My physics knowledge is not enough to think how rudder dynamics work. How rudder dynamics works in water? Can you help me for finding a starting point for this?

Since I'm not able to think any solution for this, I can't provide an example code.

EDIT:

I'm trying to apply a force to rigidbody2D of the ship at the point of rudder with angle of the rudder. But I couldn't able to make something working

Sample Code

I draw a sketch. Red point is location of rudder. I'm trying to apply a force at that point with angle of rudder relative to ship heading on each Update. How can I do this?

sentences: How to intentionally make an RPG maker game crash? I'm currently working on a game project that involves tricking the user into thinking the game experienced a bug/glitch and crashed. The reason that I want to code this is that I want to hide the file size of the main game, thus separating it into two files. So I want the first file which has x amount of game to crash at a certain point. Then manually give the second half of the game to the user and they can continue on. It may seem a little pointless, but I think stylistically this is a neat concept to try.

sentences:
How can I implement screen transitions like in the 2D Zelda games? I want to implement a screen transition in the style of the 2D Legend of Zelda games (like this). That is, I'd the screen to remain static until the player moves to an exit, at which point the next screen smoothly scrolls into view as the old screen scrolls out of view.

How can I accomplish this?

sentences: Which library to choose between SDL and GTK for C game Development (Begginer) I've been programming in C it's been some time, now I want to get into game development but I'm not sure which GUI library should I use between SDL or GTK? Is it worth sticking up with C or should I switch to C++ (taking out the learning time barrier) ? What will C++ give me that C won't when developing simple 2D games. I am not willing to switch to any other language such as "Java, python, etc" for I still want to use the low level memory management capabilities that C and C++ give. I am also not willing to use a Game Engine to learn game development.

sentences:
Changing Force of my fall after a jump I'm trying to change the  speed of the jump. I noticed if I jump twice the fall speed force gets implemented. Otherwise it is unchanged. If I try to change my onGround to be else false it remains false. Any Ideas.?

public class PMRigidBody : MonoBehaviour {
    public Rigidbody rb;
    private ConstantForce cf;
    public float fallSpeed = -10;
    private bool onGround = false;
    private int jumpHeight = 7;

    void Start (){
        // get the components
        rb = GetComponent<Rigidbody>();
        cf = GetComponent<ConstantForce>();
    }

    void Update()
    {
        float dist = 1f;
        Vector3 dir = new  Vector3(0, -1, 0);

        Debug.DrawRay(transform.position, dir * dist, Color.green);

        if (Physics.Raycast(transform.position, dir, dist))
        {
            onGround = true;
        }
        //else
        //{
        //    onGround = false;
        //}

        if (onGround)
        {
            cf.force = Vector3.zero;
            if (Input.GetButtonDown("Jump"))
            {

                onGround = false;
                rb.velocity = new Vector3(0, jumpHeight, 0);
                rb.MovePosition(transform.position + transform.up * Time.deltaTime * 10);

                cf.force = new Vector3(0, fallSpeed, 0);
            }
        }
    }
}

sentences:
Can I create realtime textures with text? I have a large number of items in my game, that will eventually have a texture associated with them. The problem is, for right now, I have nothing. I would really like to do something with, say, the first 2 letters of the object's name. As my main system will be pure textures, I really don't want to add a text object to the texture, I would really like to just create a texture with the object's first two letters.

Is there a way I can create a texture, realtime, with font rendered on that texture? Preferably without a camera/ render texture, unless I can create them once. I really want to create a unique default texture for each item at runtime, preferably with some kind of font. Can I do this?

sentences:
When Should You Revisit Old Web/Mobile Games To Improve Them? Note: I would like this to be specific to mobile and web games, since they have easier distribution methods than other models.

Based on the examples in my interfaces question, it looks like (as expected) there's a lot of work cut out for me; there's a lot of room to improve that old, hoary chemistry game.

But should I?

In fact, when should (and shouldn't) you revisit old games and improve them significantly?

I can definitely think of a couple of reasons not to do this:

You're going to write a sequel (improve that instead)
You don't have players howling for your blood (or for improvements)
It's a one-off type of game you're unlikely to code anything similar to ever again

sentences:
What are C++ libraries? I am a total beginner in C++ and programming generaly.

I have watched a couple hours of C++ tutorials and read a lot about it (Can anyone recommend some tutorials?), but what I've come across and couldn't understand was Libraries.

I want to develop games in C++ (I think, it seems the most interesting at the moment). I can understand that I need a library for game programming in C++, but I don't know much about libraries, what specifically a library is, or where to find these libraries.

Thank you for your time. This is my first question here. I apologize if it wasn't a proper question for this website, or if the english was bad. I still hope you can give me some kind of answer and/or reponse.

sentences:
Android landscape mode game I am beginner in android game development. I want my game to run only in landscape fullscreen mode (currently I have Optimus 2X with resolution 800x480 in landscape), and I don't know how to set it.

I found the fullscreen mode settings, and tried some landscape mod (set orientation:landscape in AndroidManifest), but the game is now crashing and its very unstable (eg. when i change phone orientation).

So is there any way to do that?

sentences:
Frame Dependency vs Time Dependency Just today, I was dealing with this very topic in class, and I had a hard time following through the lectures. Could someone explain to me what it means for something to be frame dependent, in layman's terms? As far as I know, it's not Unity-specific. I suppose this applies to every game, regardless of its engine.

An elaborate answer would do really good for me, as I'm a student, and I'm gonna be doing projects on this. Thanks!

sentences:
glBufferSubData and offset alignment? I'm having trouble rendering some of my meshes; some display just fine, some are drawn wrong or not at all.

While troubleshooting I was looking at the openGL docs (http://www.opengl.org/sdk/docs/man3/) and on the topic of glBufferSubData the following line caught my eye:

Clients must align data elements consistent with the requirements of
the client platform, with an additional base-level requirement that an offset
within a buffer to a datum comprising N bytes be a multiple of N.

I am buffering vertex + normal and index data like this:

glGenBuffers(1, &mVBO);
glGenBuffers(1, &mIndexBuffer);
glGenVertexArrays(1, &mVAO);

// buffer vertex, normals and index data
glBindVertexArray(mVAO);
glBindBuffer(GL_ARRAY_BUFFER, mVBO);
glBufferData(GL_ARRAY_BUFFER, (vertexData.size() + normalData.size()) * sizeof(float), NULL, GL_STATIC_DRAW);
glBufferSubData(GL_ARRAY_BUFFER, NULL, vertexData.size() * sizeof(float), &vertexData[0]);
glBufferSubData(GL_ARRAY_BUFFER, vertexData.size() * sizeof(float), normalData.size() * sizeof(float), &normalData[0]);
glBindBuffer(GL_ELEMENT_ARRAY_BUFFER, mIndexBuffer);
glBufferData(GL_ELEMENT_ARRAY_BUFFER, indexData.size() * sizeof(uint32_t), &indexData[0], GL_STATIC_DRAW);

glEnableVertexAttribArray(0);
glVertexAttribPointer(0, 3, GL_FLOAT, GL_FALSE, 0, 0);
glEnableVertexAttribArray(1);
glVertexAttribPointer(1, 3, GL_FLOAT, GL_FALSE, 0, (GLvoid*)(vertexData.size() * sizeof(float)));

// unbind array buffer and VAO
glBindBuffer(GL_ARRAY_BUFFER, 0);
glBindVertexArray(0);

So for the vertex and normals I first allocate the complete buffer using glBufferData and then fill it in using glBufferSubData.
My question then is, according to the docs, do I need to align the offset my normal data, and if so with what? Is this what couldve caused some meshes to draw incorrectly?

sentences:
Enum or Inheritance for event-based interaction? I am currently considering two possibilities to a centralised interaction system within my game.

Consider that you want to produce different results for different types of objects within the game world - you interact with a signpost and dialogue appears, or interact with an item on the ground and it gets added to your inventory with a notification.

Essentially, I cannot decide whether it would be more efficient to implement such functionality all within one centralised place or to spread each function out over separate events.

Option 1: Centralised

This is what I have started coding. One Interact class which contains several "Types" of possible events in my game.

When the player "interacts" with an object implementing this script, it will implement the functionality that it is set to in the Editor. This means I drag and drop this Event Script onto a prefab and can automatically tweak its functionality within a couple of seconds and have it ready to go in the game world.

I have simplified the general consensus of my code into this block for readability:

public string eventName;

public enum EventType
{
    Movement = 0,
    Dialogue = 1,
    NPC = 2,
    ItemCollect = 3,
    Teleport = 4,
    Cutscene = 5,
    Switch = 6,
    Custom = 7
}

public EventType eventType;

/*
* #############################
* ##@@## INITIALIZATION ##@@##
* #############################
*
*/

private void Awake()
{
    SetupEvent(eventType);
}

public void Activate(bool calledFromTrigger = false)
{
    if (autoTrigger && !calledFromTrigger)
        return;

    Debug.Log("Activated " + name + "!");
    StartEvent(eventType);

}

private void StartEvent(EventType type)
{
    switch (type)
    {
        case EventType.Movement:
            MovePlatform();
            break;
        case EventType.Dialogue:
            break;
        case EventType.NPC:
            break;
        case EventType.ItemCollect:
            break;
        case EventType.Cutscene:
            break;
        case EventType.Switch:
            break;
        case EventType.Custom:
            break;
    }
}

Resulting in:

Option 2: Inheritance

It is as if I have a little devil and angel on my shoulder, one tugging me towards the easy and half-finished code of the former example, and another urging me to redesign what I am doing into a much cleaner and abstracted approach.

In the previous example, all "event types" (Movement, Dialogue, Item Collection etc.) were handled by enums that were passed through a Switch statement to check which method should be executed based on the parameters inputted into the Unity Editor for that specific Game Object.

In this system, there would be a base "Interactible" class, which various classes would inherit from to implement functionality. The Activate() method would be overridden in the children for each specific class.

public class NPC : Interactible
{
    public override void Activate()
    {
        //NPC Code...
    }
}

The unfortunate downside to this is that I can't just use one prefab for all my events and change them based on the custom editor that I define.

I would have to create a custom editor for each possible child of the Interactible class, and instead of selecting which type of event I want it to be from a simple drop down, I will have to swap out different scripts for different functionality.

sentences:
LibGDX - why are the shapes from my ShapeRenderer resizing with my viewport? I have created a class called Node which I would like to (currently) contain a single Actor (later I will be adding additional actors, but for now I'm sticking with just one).  The actor is called "body" and is just a container for the position/size of the "Node" actor.

I have also created a Label which I am drawing with a custom font file.

What I am having issues with is that when I RESIZE my app window (on desktop, I'm not currently using Android or any other targets), the LABEL works just fine (stays the same size on my screen), but the Node gets resized with the main window.  That is, if I make the window twice as wide, the square stretches to be twice as wide as it was before.  Why is this?  The coordinates I am using work exactly as I expect UNTIL I resize the screen.  Is there something else I have to do in the resize() method?

App class:

public class App implements ApplicationListener {
    private Stage stage;
    private ShapeRenderer shapeRenderer;

    @Override public void pause() {}
    @Override public void resume() {}

    @Override
    public void create() {
        stage = new Stage(new ScreenViewport());

        shapeRenderer = new ShapeRenderer();

        //  FONT stuff  //  https://github.com/libgdx/libgdx/wiki/Gdx-freetype
        FreeTypeFontGenerator generator = new FreeTypeFontGenerator(Gdx.files.internal("fonts/arial.ttf"));
        FreeTypeFontGenerator.FreeTypeFontParameter parameter = new FreeTypeFontGenerator.FreeTypeFontParameter();
        parameter.color= Color.ORANGE;
        parameter.size = 24;

        BitmapFont arialFont = generator.generateFont(parameter);
        generator.dispose();

        Skin skin = new Skin();

        Label.LabelStyle labelStyle = new Label.LabelStyle();
        labelStyle.font=arialFont;
        skin.add("default", labelStyle);

        Label label = new Label("DOOT", skin);
        label.setX(110.5f);
        label.setY(110.5f);

        stage.addActor(label);

        stage.addActor(new Node(shapeRenderer));
    }

    @Override
    public void resize(int width, int height) {
        // See below for what true means.
        stage.getViewport().update(width, height, true);
        shapeRenderer.updateMatrices();
        System.out.println(""+width+"x"+height);
    }

    @Override
    public void render(){//} {
        Gdx.gl.glClearColor(0.3f, 0.3f, 0.3f, 1);
        Gdx.gl.glClear(GL20.GL_COLOR_BUFFER_BIT);

        stage.act(delta);
        stage.draw();
    }

    @Override
    public void dispose() {
        stage.dispose();
    }
}

Node class:

public class Node extends Group {
    private Actor body;
    private ShapeRenderer shapeRenderer;

    public Node(ShapeRenderer sr) {
        body = new Actor();
        body.setBounds(10.0f, 10.0f, 100.0f, 100.0f);
        shapeRenderer = sr;
    }

    @Override
    public void draw(Batch batch, float parentAlpha) {
        super.draw(batch, parentAlpha);

        shapeRenderer.begin(ShapeRenderer.ShapeType.Line);
        shapeRenderer.box(body.getX(), body.getY(), 0.0f, body.getWidth(), body.getHeight(), 0.0f);
        shapeRenderer.end();
    }
}

sentences:
How can I implement the ability to 'cut' sprites into arbitrary shapes? I want to create a game where you have scissors that cut a sprite in a shape that you create by dragging your finger on the screen.

My problem is that I can't figure out how can I cut my sprite in the specific shape that the user creates with their finger.

So far the only solution that I found searching the web is that I'll need to create my own shader that lets me make a specific part of a texture transparent, but don't understand how I can apply that to my scenario?

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:
Sample Projects/Source for Navigational Meshes Anyone aware of any sample source code that contain Navigational Meshes?

I'm aware of recast navigation (which is a little bit too complicated). - Written in C++.

Preferably C# but C++ is ok.

sentences:
Latitude and Longitude to Vector3 Not Aligning I am trying to align a marker sphere to certain places on a bigger Earth sphere based on the inputted latitude and longitude.

The following is my code for this conversion, this code is based on the code here

void createLand()
{
    double radius = radiusEarth / 2;

    double latitude_rad = latitude * Math.PI / 180;
    double longitude_rad = longitude * Math.PI / 180;

    double xPos = (radius * Math.Sin(latitude_rad) * Math.Cos(longitude_rad));
    double yPos = (radius * Math.Cos(latitude_rad));
    double zPos = (radius * Math.Sin(latitude_rad) * Math.Sin(longitude_rad));

    // move ObjectMarker to position
    ObjectMarker.position = new Vector3((float)xPos, (float)yPos, (float)zPos);
}

radiusEarth = 6371f

I am also using a Mercator projection texture for my Earth object.

Here is what it looks like for the coordinates of London, UK, 51.509865, -0.118092.

As you can see, the marker is in almost the correct position but not quite there.

Here is what it looks like for the coordinates of Chennai, India, 13.067439, 80.237617.

As you can see here, the marker is completely off, it's been placed somewhere on top of Russia, although it does seem to be directly on top of Chennai.

Is there any way I can fix this and make the marker more accurate?

sentences:
Planet sized quadtree terrain precision I've been working on a planet sized and shaped terrain lib for a while (In webgl and Unity) and have a couple of working implementations [Quadtree cubesphere and circular clipmaps].

But both of them suffer from the same problem. In the GPU vertex shader I move the vertices to their correct location on the planet. But 16 bit floats can't handle values that go into the millions. So when you get close to any vertex in the terrain it jiggles from the GPU rounding errors.

With the quadtree solution this is how I put vertices where they belong in the shader:

vec3 newPosition = vec3(normalize(StartPosition.xyz + (WidthDir * position.x + HeightDir * position.y) * Width) * Radius);

In the circular clipmaps I create a point at 0,0,1 and use two quaternions to rotate it to where it belongs (one for where the point is in the clipamp and one for where the clipmap should appear on the planet), then multiply it by the planet radius.

But both implementations require the multiplication of the planet's radius [the clipmap also has one quaternion with precision far higher than a 16 bit float, at ground level it will be a precision of 1/6000000 of PI].

So does anyone know how to handle this problem on the GPU so that at least the points closest to the camera have position values close to zero and no large number multiplication? Or is the only solution to set the positions on the CPU and just do some math work to make sure the vertices on the side of the planet closet to the camera always have values close to zero?

sentences:
How do I check if a window has focus in SDL2? Is there a replacement for SDL_GetAppState function in SDL2 from older SDL versions? Why was it removed? I want to use it so I can check if the user has focused the framebuffer window or not.

I found it in the documentation of the SDL 1.2.15 (Documentation page) but it seems like it disappeared in SDL2.X.

sentences:
How to get several frequency ranges at the same time in fmod? After reading documentation and tutorials about fmod I still have a question about frequency ranges.

I've found how to get a frequency range using low and high pass DSP at the same time on the main channel, but I can't find how to get several ranges at the same time.
For example I want, for a specific phase of my game, to hear range 400 to 600Hz and 1000 to 2000hz of the same sound.
I tried to create a channel by range, but it doesn't seem to work (or maybe I do something wrong).
How can I do that ?

Thank you

sentences:
How to fill a 2d array with elements of a 1d List I have a 2d array for 'Slots' in my inventory screen (slot width: 150px; total slots is based on width and height of inventory panel currently at 1500x600). The slot holds a reference to the pickupObjects that the player has picked up and added to the inventory (these items have been stored in a list).

So I try to make a method which fills the slots using the List of pickupItems. But the problem is that when I iterate through the inventory it will reach a number higher than the width of the first row of slots. I feel like the answer can be simple, but I just can't seem to figure out how to iterate through them and place it into the 2d array. I've solved this very issue in the past but can't remember how I did it.

Here's the code I have for creating the grid of slots, and then the method for putting the inventory in there (even though this method is pretty much empty right now as I am completely out of ideas):

Any help would be massively appreciated. Thanks

void CreateSlotLayout()
{
    panel_rt = GetComponent<RectTransform>();
    panelWidth = panel_rt.rect.width;
    panelHeight = panel_rt.rect.height;
    slotCount_x = (int)(panelWidth / slotWidth);
    slotCount_y = (int)(panelHeight / slotHeight);
    slots = new Slot[slotCount_x, slotCount_y];

    for (int y = 0; y < slotCount_y; y++)
    {
        for (int x = 0; x < slotCount_x; x++)
        {
            Slot slot = Instantiate(slotPrefab);
            slot.transform.SetParent(transform);
            slot.GetComponent<RectTransform>().anchoredPosition = new Vector2(x * slotWidth, -y * slotHeight);
            slots[x, y] = slot;
        }
    }
}

public void FillSlotsWithInventory(Player_Inventory playerInventory)
{
    for (int i = 0; i < playerInventory.GetPickupsList().Count; i++)
    {
          //something like....
          //slots[i?,i?].FillSlot(playerInventory.GetPickupsList[i];
    }
}

sentences:
How to make Pong ai paddle? I'm trying to make an ai so the paddles will move to position before the ball reaches it. I'm not sure how to go about it in this case.
Here's the game http://cssdeck.com/labs/ping-pong-game-tutorial-with-html5-canvas-and-sounds

// Function to increase speed after every 5 points
function increaseSpd() {
    if(points % 4 == 0) {
        if(Math.abs(ball.vx) < 15) {
            ball.vx += (ball.vx < 0) ? -1 : 1;
            ball.vy += (ball.vy < 0) ? -2 : 2;
        }
    }
}

// Track the position of mouse cursor
function trackPosition(e) {
    mouse.x = e.pageX;
    mouse.y = e.pageY;
}

// Function to update positions, score and everything.
// Basically, the main game logic is defined here
function update() {

    // Update scores
    updateScore();

    // Move the paddles on mouse move
    if(mouse.x && mouse.y) {
        for(var i = 1; i < paddles.length; i++) {
            p = paddles[i];
            p.x = mouse.x - p.w/2;
        }
    }

    // Move the ball
    ball.x += ball.vx;
    ball.y += ball.vy;

    // Collision with paddles
    p1 = paddles[1];
    p2 = paddles[2];

    // If the ball strikes with paddles,
    // invert the y-velocity vector of ball,
    // increment the points, play the collision sound,
    // save collision's position so that sparks can be
    // emitted from that position, set the flag variable,
    // and change the multiplier
    if(collides(ball, p1)) {
        collideAction(ball, p1);
    }

    else if(collides(ball, p2)) {
        collideAction(ball, p2);
    }

    else {
        // Collide with walls, If the ball hits the top/bottom,
        // walls, run gameOver() function
        if(ball.y + ball.r > H) {
            ball.y = H - ball.r;
            gameOver();
        }

        else if(ball.y < 0) {
            ball.y = ball.r;
            gameOver();
        }

        // If ball strikes the vertical walls, invert the
        // x-velocity vector of ball
        if(ball.x + ball.r > W) {
            ball.vx = -ball.vx;
            ball.x = W - ball.r;
        }

        else if(ball.x -ball.r < 0) {
            ball.vx = -ball.vx;
            ball.x = ball.r;
        }
    }

    // If flag is set, push the particles
    if(flag == 1) {
        for(var k = 0; k < particlesCount; k++) {
            particles.push(new createParticles(particlePos.x, particlePos.y, multiplier));
        }
    }

    // Emit particles/sparks
    emitParticles();

    // reset flag
    flag = 0;
}

//Function to check collision between ball and one of
//the paddles
function collides(b, p) {
    if(b.x + ball.r >= p.x && b.x - ball.r <=p.x + p.w) {
        if(b.y >= (p.y - p.h) && p.y > 0){
            paddleHit = 1;
            return true;
        }

        else if(b.y <= p.h && p.y == 0) {
            paddleHit = 2;
            return true;
        }

        else return false;
    }
}

//Do this when collides == true
function collideAction(ball, p) {
    ball.vy = -ball.vy;

    if(paddleHit == 1) {
        ball.y = p.y - p.h;
        particlePos.y = ball.y + ball.r;
        multiplier = -1;
    }

    else if(paddleHit == 2) {
        ball.y = p.h + ball.r;
        particlePos.y = ball.y - ball.r;
        multiplier = 1;
    }

    points++;
    increaseSpd();

    if(collision) {
        if(points > 0)
            collision.pause();

        collision.currentTime = 0;
        collision.play();
    }

    particlePos.x = ball.x;
    flag = 1;
}

// Function for emitting particles
function emitParticles() {
    for(var j = 0; j < particles.length; j++) {
        par = particles[j];

        ctx.beginPath();
        ctx.fillStyle = "white";
        if (par.radius > 0) {
            ctx.arc(par.x, par.y, par.radius, 0, Math.PI*2, false);
        }
        ctx.fill();

        par.x += par.vx;
        par.y += par.vy;

        // Reduce radius so that the particles die after a few seconds
        par.radius = Math.max(par.radius - 0.05, 0.0);

    }
}

sentences: How to create realistic rainfall animation in modern OpenGL using shaders? I see many examples of particle system in old style OpenGL with falling raindrops. Examples of rainfall that can interact with environment lighting and look realistic are hard to find. How to create realistic rainfall animation in modern OpenGL using shaders?

sentences:
How to find the right direction to plug a sword into a rig's hand after projecting it? I've downloaded BVH animations and projected it following a book. I can now see a 3D moving rig and it looks alright. The problem is, now I want to plug a sword on the hand of the rig, but I don't know which direction it should face. That is because each vertex has a rotation and an offset, so I can calculate their positions, but there is no information available about their normals. How is this done?

Pseudocode of the position finding procedure for illustration

calculate_position(bone)
     local = bone.rotation_x * bone.rotation_y * bone.rotation_z # matrices
     local[3] = bone.offset_x
     local[7] = bone.offset_y
     local[11] = bone.offset_z
     global = local * bone.parent.global
     return [global[3], global[7], global[11]]

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 do I create a sky box with OpenGL ES 2.0? Can you give me hint to any good sky box example in OpenGL ES 2.0? I have found only OpenGL and does not work for me.
I am doing it this way:
Initialization:

glUseProgram(m_programSkyBox.Program);
glGenBuffers(1, &skyBoxVertexBuffer);
glBindBuffer(GL_ARRAY_BUFFER, skyBoxVertexBuffer);

float vertices[24] = {
    -1.0, -1.0,  1.0,
    1.0, -1.0,  1.0,
    -1.0,  1.0,  1.0,
    1.0,  1.0,  1.0,
    -1.0, -1.0, -1.0,
    1.0, -1.0, -1.0,
    -1.0,  1.0, -1.0,
    1.0,  1.0, -1.0,
};

glBufferData(GL_ARRAY_BUFFER, sizeof(vertices), vertices, GL_STATIC_DRAW);

glGenBuffers(1, &skyBoxIndexBuffer);
glBindBuffer(GL_ELEMENT_ARRAY_BUFFER, skyBoxIndexBuffer);

GLubyte indices[14] = {0, 1, 2, 3, 7, 1, 5, 4, 7, 6, 2, 4, 0, 1};
glBufferData(GL_ELEMENT_ARRAY_BUFFER, sizeof(indices), indices, GL_STATIC_DRAW);

Drawing the skybox:

glClearColor(0.5f, 0.5f, 0.5f, 1);
glClear(GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT);
glUseProgram(m_programSkyBox.Program);

glDisable(GL_DEPTH_TEST);   // skybox should be drawn behind anything else
glBindTexture(GL_TEXTURE_CUBE_MAP, m_textures.Cubemap);

glBindBuffer(GL_ARRAY_BUFFER, skyBoxVertexBuffer);
glVertexAttribPointer(m_programSkyBox.Attributes.Position, 3, GL_FLOAT, GL_FALSE, 0, (void*)0);
glEnableVertexAttribArray(m_programSkyBox.Attributes.Position);
glBindBuffer(GL_ARRAY_BUFFER, 0);

glBindBuffer(GL_ELEMENT_ARRAY_BUFFER, skyBoxIndexBuffer);
glDrawElements(GL_TRIANGLE_STRIP, 14, GL_UNSIGNED_BYTE, 0);
glBindBuffer(GL_ELEMENT_ARRAY_BUFFER, 0);
glEnable(GL_DEPTH_TEST);

Texture loading is working. Shader is correctly compiled and looks like this:
Vertex shader:

attribute vec4 position;
varying mediump vec3 texCoord;
void main() {
   texCoord.xyz = position.xyz;
}

Fragment shader:

uniform samplerCube Sampler;

varying mediump vec3 texCoord;

 void main() {
     mediump vec3 cube = vec3(textureCube(Sampler, texCoord.xyz));
     gl_FragColor = vec4(cube, 1.0);
 }

But I can't get the cube visible. Am I doing anything wrong?

sentences:
Obtain linear depth values on FBO and deal with small differences I've a render target on which I have both a color and a depth attachment. In a second pass I need to run a filter whose width depends on the derivative and values of the depth.

Now, if I try, in the second pass where I'm accessing the texture on which I rendered on previously, to display the depth information all I have is a grey blotch:

http://imgur.com/UFm5oI6   (Don't pay attention to background, I'm showing just non-background values)

Before displaying it I modify it by:

float depthValue = texture(depthTexture, uv);
depthValue =(depthValue - 0.1)/0.9;

as my near clip is 0.1 and far one is 1.0

Instead, if I run the program with gDEBugger and look at the content of the depth texture what I see is a much cleaner result:

http://imgur.com/TtOgMY2

Why what I see is totally different? How gDEBugger show the values? Are the value I fetch from the depth texture wrong? Should I render depth values differently?

Moreover, the width of the kernel doesn't really change as it is computed based on depth value and depth derivatives and those two are practically identical, at least judging from what I see. Is there a way to make these differences more marked?

Sorry if it's a dumb question. Thank you.

sentences:
How to visually represent a time span? I am making a puzzle game. The puzzle in question needs to be solved in advance, with the final solution being given as a series of commands which will instruct an object to navigate a maze.

This means I need to be able to provide all the clues necessary in advance, as pure trial-and-error will be tedious for the player.

When it comes to rotation and distance, this is no problem. Rotation is visually obvious, and I can use regularly sized and evenly spaced blocks/objects for the player to count to work out distance.

However - my problem is finding a similar visual representation for time. At one point, the player will ride a lift/platform to 'a place', where the destination will be X seconds away. The player needs to wait this X seconds before continuing forward.

How can I communicate that time delay in an interesting/thought provoking way? I don't want signs next to each lift that simply state the time it will take.

sentences:
How can I have cutouts in a texture? I want to be able to have a gameobject that's basically just a black box on top of everything else. Then I want to be able to place other gameobjects which are just gradients on top of that and they should "cut out" of the black texture like this:

How can I achieve this sort of effect?

Please keep in mind that I have pretty much no experience with shaders :)

Here's a video that might help explain what I'm trying to achieve
https://www.youtube.com/watch?v=L1dd4fkVSAM

sentences:
Player must places the object in the preset position I want to know how to do like this video:
https://youtu.be/6gouxqSxeG8
At the minute 3:09, the player can put the street vendor in the predetermined location (with the green arrow show that place).

Please tell me some keyword about this or video tutorial about how to implement it in unity 2d.

Thanks.

sentences:
Class Structure for upgrades that depend on other upgrades This game involves making buildings that can be upgraded. Sometimes a building's upgrade isn't available until another building is either created or upgraded to some specific level.

For simplicity's sake, there are two buildings, A and B. Level 1 of both buildings can be built at the start.

Building B can be upgraded freely but building A can't be upgraded to level 2 until building B is at level 4.

As far as class structure, I don't know if there should be a Building class and then BuildingA and BuildingB classes that inherit from it. Or if there should just be a Building class and individual building types are instances of that class. This latter solution seems ugly because there is also the layer of individual instances of building a building type.

In either case, I don't know how to design the class structure to control dependencies like the example I gave. Other than hard coding it which isn't very clean or conducive to extending it to more buildings and nuanced dependencies.

sentences: How do I use playerprefs to make ui slider keep the sound settings? I have not use playerprefs before, I want to know how to keep the change of the audio when the player change it throughout the game.

sentences:
How does Unity Inspector handle values changing during play without any thread-locks? First of all, I'm a Java coder. Usually, when you write a game, you run it on thread different than the UI one like:

// pseudocode starts
new Thread(new Runnable(){
    @Override
    public void run()
        while(someVolatileBoolean){
            input();
            physics();
            graphics();
        }
    }
}

and then you declare some sort of listener for the input which usually works on application/UI thread so you need to mark it as volatile, atomic or perform a basic synchro using the synchronized keyword (depending on the situation).

Let's take a simple Unity script:

public class SomeMovementScript : MonoBehaviour {

    public Vector3 speed = new Vector3(0.1f, 0, 0);

    void Update () {
        this.transform.Translate(speed * Time.deltaTime);
    }
}

If we then play the game, the object starts to move with speed 0.1f.

Now, when the game is playing, we can change the speed variable through the inspector:

I thought from the UI coder point of view: I'm changing a variable, which is being read each frame by the game thread. How does this happen, that I don't get some sort of ConcurrentModificationException if there's no visible synchronization at all. The variable is public, not being cached in any way.

I know that this question should be asked on SO, but I thought that GD has more users specialized in Unity and it's mechanics.

I came up with immutability. Variable is considered thread-safe if it's state can't change. As components are immutable, and classes like Vector2/3/4 are immutable - it would work. But... You can make your own class [Serializable], mark their fields as public and the class is not thread-safe - but it is visible through the inspector.

How does Unity Inspector perform these real-time updates with all the classes you can think of?

sentences:
Picking game entities What is the preferred methods for doing so, performance-wise?

For example I want to pick certain objects in an area around a given point.

What I have thought off so far is using invisible objects as extended hit detectors. Like creating a circle or square then have collision responses to them.

Or maybe just pass the entire object list and iterate on it, then using a distance/angle based condition.

sentences:
D3D11/C++ Inaccuracies in uv interpolation in pixel shader. How to avoid? I'm trying to draw a quad with a texture onto the screen such that texels and pixels perfectly align. Sounds pretty easy. I draw 2 triangles (as TRIANGLE_LIST, so 6 vertices) using these shaders:

struct VSOutput
{
    float4 position     : SV_POSITION;
    float2 uv           : TEXCOORD0;
};

VSOutput VS_Draw(uint index : SV_VertexId)
{
    uint vertexIndex = index % 6;
    // compute face in [0,0]-[1,1] space
    float2 vertex = 0;
    switch (vertexIndex)
    {
        case 0: vertex = float2(0, 0);  break;
        case 1: vertex = float2(1, 0);  break;
        case 2: vertex = float2(0, 1);  break;
        case 3: vertex = float2(0, 1);  break;
        case 4: vertex = float2(1, 0);  break;
        case 5: vertex = float2(1, 1);  break;
    }
    // compute uv
    float2 uv = vertex;
    // scale to size
    vertex = vertex * (float2)outputSize;
    vertex = vertex + topLeftPos;
    // convert to screen space
    VSOutput output;
    output.position = float4(vertex / (float2)outputSize * float2(2.0f, -2.0f) + float2(-1.0f, 1.0f), 0, 1);
    output.uv = uv;
    return output;
}

float4 PS_Draw(VSOutput input) : SV_TARGET
{
    uint2 pixelPos = (uint2)(input.uv * (float2)outputSize);
    // output checker of 4x4
    return (((pixelPos.x >> 2) & 1) ^ ((pixelPos.y >> 2) & 1) != 0) ? float4(0, 1, 1, 0) : float4(1, 1, 0, 0);
}

where outputSize and topLeftPos are constants and expressed in pixel units.

Now for outputSize = (102,12) and topLeftPos = (0,0) I get (what I would expect):

But for outputSize = (102,12) and topLeftPos = (0,0.5) I get:

As you can see there is a uv-discontinuity where the two triangles connect and interpolation of uv is inaccurate. This basically happens (in x and y) only at positions around the .5 (actually below .49 it correctly snaps to texel 0 and above .51 it snaps correctly to texel 1, but in between I get this artifact).

Now for the purpose I need this for it is essential to have pixel perfect mapping.
Can anyone enlighten me why this happens?

sentences:
How to force play area corners to Lighthouses in Unity I'm working for a guy that wants to recreate real environments in VR and superpose them for business demos. Think of one of those mall kiosks where you "enter virtual reality" and at first it looks exactly the same as regular reality until you start interacting with objects and the virtual elements start being superposed. Basically, AR in VR.

To do this, I have an exact model of the kiosk, but I need to be able to force the play area in vive and unity to be always the same and equal to the dimensions of the real space, so that my model can superpose the actual world objects. Is there a way to force the play area to be the same as the distance between the lighthouses?

Additionally, is there a way to force the lighthouses to never recalibrate after the initial setup(as it does when someone moves in front of them for example)?

sentences:
How to get projectile direction vector in a 2d grid? I am having trouble figuring out how to trace the path of my projectiles in an Asteroids clone. Currently the ship is locked to the center of the screen and can be rotated a full 360 degrees. I know the angle the ship is pointing at any given time, but I am not sure how to calculate the vector that the projectile should use for its trajectory. I know that I can find the correct vector by subtracting the end point from the start point.. but the issue is that I do not know the end point. Theoretically.. the end point is whenever the projectile touches the edge of the screen or some object. This is the current game code: https://jsfiddle.net/m6sxrk8w/
 just using a hardcoded movement vector of {x:-1, y:-1}. Can anyone give some advice on how to dynamically determine the true vector given the current direction of the ship? There must be some simple math I am missing here...

sentences:
How can I use a camera matrix with different resolutions? I created a little jump'n'run game. The character(Mario) is always the center of the viewport. The game is running correctly if I use the resolution 800x480 pixel. But when I use another resolution(for example 1280x768), the sprites in the viewport look completely different to the sprites in the 800x480 viewport. I want that the viewport(and the sprites in the viewport) looks always the same, on every single resolution.

How can I do that? Should I change something on my camera matrix parameters or what should I change so that the viewport and the proportions of the sprites look always the same?

I use Monogame to run the game on different Windows Phone devices.

My camera class:

 public class Camera
{
    public Vector2 Cameraposition;

    public Camera(Vector2 cameraposition)
    {
        Cameraposition = cameraposition;
    }

    public void Update(GameTime gameTime, Vector2 CamPosition)
    {
        Cameraposition = CamPosition;
    }

    public Matrix GetMatrix()
    {
        return new Matrix(1, 0, 0, 0, 0, 1, 0, 0, Cameraposition.X, Cameraposition.Y, 1, 0, -Cameraposition.X, -Cameraposition.Y, 0, 1);
    }
}

In Game1:

//I use the camera in Game1 like this:
//At the beginning(in LoadContent):
Vector2 cameraposition = new Vector2(PlayerStartpos.X - GraphicsDevice.Viewport.Width / 2, PlayerStartpos.Y - GraphicsDevice.Viewport.Height / 2);
camera = new Camera(cameraposition);

//Updating the camera position
 protected override void Update(GameTime gameTime)
    {
        player.Update(gameTime);
        Newcameraposition = new Vector2(player.Playerposition.X - GraphicsDevice.Viewport.Width / 2, player.Playerposition.Y - GraphicsDevice.Viewport.Height / 2);
        camera.Update(gameTime, Newcameraposition);

        base.Update(gameTime);
    }

//Drawing:
spriteBatch.Begin(SpriteSortMode.Deferred, BlendState.AlphaBlend, SamplerState.AnisotropicClamp, DepthStencilState.None, RasterizerState.CullNone, null, camera.GetMatrix());
 ...

sentences:
Releasing a demo in an unfinished state? I'm a fairly unexperienced game developer, (despite having some coding abilities) as i never really had the opportunity to launch more than 1 "finished" game.
So in terms of getting the word out, marketing or even getting usefull feedback of players, i have very little experience.

Now, i'm working for almost 3 years on a game which i'm developing in my spare-time. Despite its pretty long development cycle it is a fairly "simple" game.

The question i'm asking myself multiple times (and more frequently as time goes on) is:
- When should i release a demo? (Should i release a demo at all?)

I don't want the players to play it now and loose interest afterwards after the game finishes. (as it will take maybe another full year until it is even remotely finished.)
But at the same time i know that i have to do something in terms of marketing (it is going to be a free game, but i would like to reach as much people as i can) as despite the 3 year long development cycle, not many people know about this project. (Which isn't really optimal, as i have a potential target audience which i know would like a game of this type.)

My strategy up to this point was to simply develope it in my spare time, not having a demo at all and only showcasing (meaningfull) progress of the game in youtube videos (This videos are released every 2 or 4 months, depending on how much time i have to develope the game...) and only release the game after it is more or less finished.

Its a very strage scenario for me to be in. I would love to let people know about the project (like every other dev), but at the same time i fear that people will be put down by its quality (alpha-state) and that they aren't going to be interested in it afterwards after they played it. (The only thing you can currently do is to "free-roam" > no objectives whatsoever.)

So my question is:
Am i to worried about this stuff? Should i release a demo? (Now or later after it's more polished?)
What are your experiences in releasing games or using demos?

sentences:
Where can I find real-world map data for a game? I want to build a game with a concept similar to Ingress, where the game map is overlaid on a real one.

Where can I find map data for an app like that? How (generally) do I integrate my own game objects into that map? Game objects need to move in real time, so having them as static markers on the map isn't sufficient.

I thought I could use Google Maps but as far as I can tell it would be impossible to create my own graphical style (like Ingress has done) with the official API provided by Google.

sentences: In unreal engine, what's the difference among "set global time dilation" and "set current time dilation" and "set custom time dilation"? what's the different effect of these three functions, thanks!

sentences:
Vertex Displacement Distortion Correction I am developing for Mobile VR using GoogleVRSDK and Unity. My target platform is Android.
I have a shader which displaces vertices to create a reverse lens distortion.

Following is my shader,

Shader "Unlit/Cube"
{

Properties {
    _Color("Main Color", Color) = (1,1,1,1)
}

Category {

    Tags { "Queue"="Geometry" "IgnoreProjector"="True" "RenderType"="Opaque" }

    Blend Off
    AlphaTest off
    Cull off
    Lighting Off
    ZWrite On
    ZTest LEqual
    Fog { Mode Off }

    SubShader {
        Pass {
            CGPROGRAM

           // #pragma target 3.5
           // #pragma target 2.0
           // #pragma only_renderers gles2
           // #pragma only_renderers gles

            #pragma vertex VertexProgram
            #pragma fragment FragmentProgram
            #pragma multi_compile __ GVR_DISTORTION
            #include "GvrDistortion.cginc"

            struct VertexInput {
                half4 vertex : POSITION;
                half4 texcoord : TEXCOORD0;
            };

            struct v2f {
                half4 vertex : SV_POSITION;
                half4 uv : TEXCOORD0;
            };

            v2f VertexProgram (VertexInput v)
            {
                v2f o;
                o.uv = v.texcoord;
                o.vertex = undistortVertex(v.vertex);
                return o;
            };

            fixed4 _Color;

            fixed4 FragmentProgram (v2f fragment) : COLOR
            {
                return _Color;
            }
            ENDCG
        }
    }
}

Following is my GvrDistortion.cginc

#if defined(GVR_DISTORTION)

float4x4  _Undistortion;
float     _MaxRadSq;
float     _NearClip;
float4x4  _RealProjection;
float4x4  _FixProjection;

float distortionFactor(float rSquared) {
  float ret = 0.0;
  ret = rSquared * (ret + _Undistortion[1][1]);
  ret = rSquared * (ret + _Undistortion[0][1]);
  ret = rSquared * (ret + _Undistortion[3][0]);
  ret = rSquared * (ret + _Undistortion[2][0]);
  ret = rSquared * (ret + _Undistortion[1][0]);
  ret = rSquared * (ret + _Undistortion[0][0]);
  return ret + 1.0;
}

// Convert point from world space to undistorted camera space.
float4 undistort(float4 pos) {
  // Go to camera space.
  pos = mul(UNITY_MATRIX_MV, pos);
  if (pos.z <= -_NearClip) {  // Reminder: Forward is -Z.
    // Undistort the point's coordinates in XY.
    float r2 = clamp(dot(pos.xy, pos.xy) / (pos.z*pos.z), 0,     _MaxRadSq);
    pos.xy *= distortionFactor(r2);
  }
  return pos;
}

// Multiply by no-lens projection matrix after undistortion.
float4 undistortVertex(float4 pos) {
  return mul(_RealProjection, undistort(pos));
}

// Surface shader hides away the MVP multiplication, so we have
// to multiply by _FixProjection = inverse(VP)*_RealProjection
// and then by inverse(M), in order to cancel it out and leave our
// own transform in place.
float4 undistortSurface(float4 pos) {
  float4 proj = mul(_FixProjection, undistort(pos));
  return mul(unity_WorldToObject, proj);
}

#else
// Distortion disabled.

// Just do the standard MVP transform.
float4 undistortVertex(float4 pos) {

 return mul(UNITY_MATRIX_MVP, pos);
}

// Surface shader hides away the MVP multiplication, so just return   pos.
float4 undistortSurface(float4 pos) {

  return pos;
}

#endif

This shader works completely as excepted in Samsung S6 and LG G3 and the Unity Editor.

But we are working for a phone named Venus. In that phone shader renders but the displacement of vertices doesn't happen.

I tried disabling conditional compiling.
I tried changing render targets and forcing different OpenGL versions in render.

Nothing worked.
I would love to hear a solution. Thank you.

The specs of the Venus,

GPU Adreno(TM) 405
Runs OpenGL ES 3.0
GPU SM:4.0 and VRAM 512MB
RM 2gigs
Screen 1080x1920 60hz  dpi 480
Android 5.1 API-22
CPU is ARMv7 VFPv3 NEON (8 cores)

The shader in LG G3 :

The shader in Venus :

sentences:
Using an engine to create content with PHP - but how should it happen? I need to create an engine that will allow me to add content to a website. The website is a browser-based game. This is a verbose engine that should be able to handle many different aspects of the project.

For an example, I want the developers to be able to insert "dreams" into the game. A dream is called each night for the player, and upon login they will see the dream they had. A developer will write up a cool dream for the game and insert it... but to where?

That's what I'm struggling with. Naturally, I think to myself that all content for the game will enter a database once a developer is done with it. However, the amount of content could be potentially very high, and it may be too hard on the server's resources once the game grows bigger - userbase included. The other way to do it to simply hardcode everything in: a simple "dreams" file that a developer would append their dream to. I cannot have such a system, however, if this project were to have five casual developers that don't know how to even open a PHP tag! ;)

Presently the best way I can imagine a player receiving a dream is to have a developer write it and then the database pulls the dream the player receives from the database. It seems unnecessarily arduous and I'm hoping that if I still must use a database, that you folks can steer me into the right direction for how to execute this efficiently.

sentences:
Best way to add and remove quads in a VBO? What's the best way to handle adding and removing 2D sprites (quads) in a VBO?

I am working on a mobile board game and sometimes game pieces (represented by quads graphically) need to be added to or removed from the screen. Currently, I store all of my quad vertices in an array. When I need to add new quads to the screen, I append this list with the new vertices. However, removing quads is more cumbersome. I track the positions of each quad in the VBO array with a dictionary, and when I comes time to remove it, I remove that block of four vertices from the array. I then have to update the values stored inside the dictionary since the VBO array has been resized.

I am not satisfied with this solution, and I feel like there could be a better way to achieve what I want. I couldn't find any related questions about storing 2D sprites which need to be added or removed during runtime like this. Since the game is really simple graphically, I am thinking it may be easiest to make a draw call per sprite. I can't use instancing since I am restricted to OpenGL ES 2.

sentences:
How many levels should I make? One issue I grapple with across many of my games is trying to decide how many levels to put in my game. This is across genres and platforms.

In general, constraints that may decide -- although they are not applicable in my case -- can include:

Pre-determined schedule or release dates
Fixed budget
The game's story finishes/concludes
(PCG games): difficulty becomes "impossible"

These are all great, but not sufficiently constraining as to tell me how many levels to make.

Another constraint that sounds good in theory but is hard to implement is game time -- for example, Mario or Super Meat Boy, I can guesstimate x minutes per level, and target y minutes of intended total gameplay, yielding y/x levels.

But none of these seem quite right to me. It seems like there should be a better way to decide when to add more levels and when to stop.

sentences:
When entities don't draw themselves, who actually does? There are countless questions here about whether entities should draw themselves or not. The answer is almost universally no, there should be a renderer. And I do see a point in having a single place where everything is rendered. Makes asset management easier and the code less convoluted.

However, I'm struggling to find a good approach to implement this in my 2D game. Currently, every entity is told to draw itself, and I pass the renderer object to it. Now, I want the renderer to draw each entity, but I don't want the renderer to actually know about entities, so I need a more generic class, e.g. RenderObject, and a way to construct render objects from entities.

One obvious approach would be to have a GetRenderObject() method on each entity. However, some of my entities actually draw multiple textures, relative to their position, so I'd probably need a GetRenderObjects() function instead.

But that wouldn't really remove any rendering logic from my entities. I'd still have to refer particular assets and their positions relative to the entity position in the render objects I create.

So my question is: Doesn't having a renderer mean that my entities don't have any drawing logic anymore? If so, who will generate these render objects? Does it even make sense to take the render objects detour?

And, bonus question: How can this work together with a UI system? I'd rather not have the renderer know about widgets and containers and such, so my hunch so far is to have widgets stick to drawing themselves.

sentences:
Save Script Doesn't Save Item Variables I've been working on an RPG videogame, and I have been trying to implement a Save button into my game, which is supposed to save the player's itemAmount variable, which is in another script, called ItemInformation. I retrieve the itemAmount variable at Start() by getting the script from the itemHolder GameObject. I plan to use this script in multiple GameObjects, because I use the same variable (itemAmount) with different values in different GameObjects. For some reason, I don't receive any errors or warnings in the Console. Here is my script to the Saving System:
using System.Collections;
using System.Collections.Generic;
using UnityEngine;
using System;
using System.Runtime.Serialization.Formatters.Binary;
using System.IO;

public class InventorySave : MonoBehaviour
{
    // Public variables for inventory and health
    private GameObject itemHolder;
    private ItemInformation myItemAmount;

    // Initiates before the first frame
    void Start()
    {
        // Gets components for the player variables
        itemHolder = transform.gameObject;
        myItemAmount = itemHolder.GetComponent<ItemInformation>();
    }

    // Function that will be called when player saves game from pause menu
    public void SaveGame()
    {
        // Creates file to store variables
        BinaryFormatter bf = new BinaryFormatter();
        FileStream file = File.Create(Application.persistentDataPath + "/SaveData.dat");
        SaveData data = new SaveData();

        // Gets the player data
        data.itemSave = myItemAmount.itemAmount;

        // Writes player data to file and encrypts it
        bf.Serialize(file, data);
        file.Close();
    }
}

// Holds data that is to be saved
[Serializable]
class SaveData
{
    // Variables for save file
    public int itemSave;
}

sentences:
SetIKHintPosition and SetIKHintPositionWeight seems to have no impact I have recently been exploring Unity's inverse kinematics, to further polish the interaction between our rigged avatars and props.

I have made a sample project, using PuppetMaster's basic humanoid for the model, rig, and idle animation, but without Final IK; meaning this is Unity's inverse kinematics.  Inside our OnAnimatorIK method, we set the right elbow's SetIKHintPosition and SetIKHintPositionWeight like we did with the hand IK:

animator.SetIKHintPosition(avatarIKHint, hintPosition);
animator.SetIKHintPositionWeight(avatarIKHint, hintBlendValue);

animator.SetIKPosition(sourceIKGoal, targetPosition);
animator.SetIKPositionWeight(sourceIKGoal, blendValue);

You can see the left and right hand correctly move to where we set it.  However, it seems like the right elbow is ignoring the hint position entirely.  You can see the white debug line connecting the elbow to the hint position in the picture above.

It seems like the elbow ONLY bends if it absolutely must for the hand to reach the target position, regardless of where the hint is set, and the weight value given.

I have fiddled with this on and off for days and still haven't found a solution.  Others have asked the same question here and on other sites, but no one has posted an answer.

sentences:
Hue, saturation, brightness, contrast effect in hlsl I am new to pixel shader, and I am trying to write a simple brightness, contrast, hue, saturation effect. I have written a shader for it but I doubt that my shader is not providing me correct result, Brightness, contrast, saturation is working fine, problem is with hue. if I apply hue between -1 to 1, it seems to be working fine, but to make things more sharp, I need to apply hue value between -180 and 180, like we can apply hue in Paint.NET.

Here is my code.

// Amount to shift the Hue, range 0 to 6
float Hue;
float Brightness;
float Contrast;
float Saturation;
float Alpha;

sampler Samp : register(S0);

// Converts the rgb value to hsv, where H's range is -1 to 5
float3 rgb_to_hsv(float3 RGB)
{
    float r = RGB.x;
    float g = RGB.y;
    float b = RGB.z;

    float minChannel = min(r, min(g, b));
    float maxChannel = max(r, max(g, b));

    float h = 0;
    float s = 0;
    float v = maxChannel;

    float delta = maxChannel - minChannel;

    if (delta != 0)
    {
        s = delta / v;

        if (r == v) h = (g - b) / delta;
        else if (g == v) h = 2 + (b - r) / delta;
        else if (b == v) h = 4 + (r - g) / delta;
    }

    return float3(h, s, v);
}

float3 hsv_to_rgb(float3 HSV)
{
    float3 RGB = HSV.z;

    float h = HSV.x;
    float s = HSV.y;
    float v = HSV.z;

    float i = floor(h);
    float f = h - i;

    float p = (1.0 - s);
    float q = (1.0 - s * f);
    float t = (1.0 - s * (1 - f));

    if (i == 0) { RGB = float3(1, t, p); }
    else if (i == 1) { RGB = float3(q, 1, p); }
    else if (i == 2) { RGB = float3(p, 1, t); }
    else if (i == 3) { RGB = float3(p, q, 1); }
    else if (i == 4) { RGB = float3(t, p, 1); }
    else /* i == -1 */ { RGB = float3(1, p, q); }

    RGB *= v;

    return RGB;
}

float4 mainPS(float2 uv : TEXCOORD) : COLOR
{
    float4 col = tex2D(Samp, uv);

    float3 hsv = rgb_to_hsv(col.xyz);

    hsv.x += Hue;
    // Put the hue back to the -1 to 5 range
    //if (hsv.x > 5) { hsv.x -= 6.0; }
    hsv = hsv_to_rgb(hsv);
    float4 newColor = float4(hsv,col.w);

    float4 colorWithBrightnessAndContrast = newColor;

    colorWithBrightnessAndContrast.rgb /= colorWithBrightnessAndContrast.a;
    colorWithBrightnessAndContrast.rgb = colorWithBrightnessAndContrast.rgb + Brightness;
    colorWithBrightnessAndContrast.rgb = ((colorWithBrightnessAndContrast.rgb - 0.5f) * max(Contrast + 1.0, 0)) + 0.5f;
    colorWithBrightnessAndContrast.rgb *= colorWithBrightnessAndContrast.a;

    float greyscale = dot(colorWithBrightnessAndContrast.rgb, float3(0.3, 0.59, 0.11));
    colorWithBrightnessAndContrast.rgb = lerp(greyscale, colorWithBrightnessAndContrast.rgb, col.a * (Saturation + 1.0));
    return colorWithBrightnessAndContrast;
}

technique TransformTexture {
    pass p0 {
        PixelShader = compile ps_2_0 mainPS();
    }
}

Please If anyone can help me learning what am I doing wrong or any suggestions?
Any help will be of great value.

EDIT:
Images of the effect at hue 180:

On the left hand side, the effect I got with @teodron answer. On the right hand side, The effect Paint.NET gives and I'm trying to reproduce.

sentences:
Get triangles after subdivision I was able to do subdivision on a triangle mesh with midpoints but then I get polygons with too many faces. How do I convert to triangles after?

Similar to this picture:

sentences:
How could I make the character sound beeps like in old school games? I've been searching around, but I haven't found any resource on how I could achieve this, like those old school character beeps.

I want to have my characters talk with beeps like in Undertale, or Phoenix Wright, or any other games like that, but I've no luck finding anything helpful.

How could I achieve a similar effect?

Edit : Here is an example video of what i mean : https://www.youtube.com/watch?v=V5tX0GyG3_I When the text goes by, there's that deep beeping sound, that's what i meant

Edit 2 : What i mean is not how i get it to work, but rather how do i make a sound like that using a program?

sentences:
Multiple textures on a mesh created in blender and imported in xna I created a cube in blender which has multiple images applied to its faces. I am trying to import the model into xna and get the same results as shown when rendering the model in blender. I go through every mesh (for the cube its only one) and through every part but only the first image used in blender is displayed in every face. The code I am using to fetch the texture looks like that:

foreach (ModelMesh m in model.Meshes)
{
   foreach (Effect e in m.Effects)
   {
      foreach (var part in m.MeshParts)
      {
         e.CurrentTechnique = e.Techniques["Lambert"];
         e.Parameters["view"].SetValue(camera.viewMatrix);
         e.Parameters["projection"].SetValue(camera.projectionMatrix);
         e.Parameters["colorMap"].SetValue(modelTextures[part.GetHashCode()]);

      }
   }
   m.Draw();
}

Am I missing something?

EDIT:

Here is the code for getting the texture from the blender and use it in the XNA:

foreach (ModelMesh mesh in model.Meshes)
            {
                foreach (ModelMeshPart part in mesh.MeshParts)
                {
                    BasicEffect basicEffect = part.Effect as BasicEffect;

                    if (basicEffect != null)
                        modelTextures[part.GetHashCode()] = basicEffect.Texture;

                    part.Effect = material.effect;

                }
            }

sentences:
Creating a DrawableGameComponent If I'm going to draw cubes effectively, I need to get rid of the numerous amounts of draw calls I have and what has been suggested is that I create a "mesh" of my cubes. I already have them being stored in a single vertex buffer, but the issue lies in my draw method where I am still looping through every cube in order to draw them. I thought this was necessary as each cube will have a set position, but it lowers the frame rate incredibly.
 What's the easiest way to go about this? I have a class CubeChunk that inherits Microsoft.Stuff.DrawableGameComponent, but I don't know what comes next. I suppose I could just use the chunk of cubes created in my cube class, but that would just keep me going in circles and drawing each cube individually.

The goal here is to create a draw method that draws my chunk as a whole, and to not draw individual cubes as I've been doing.

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:
AI Agent realistic leap to a player in a MMO In the last month I have been struggling with an issue, movement synchronization of a leap of an AI agent in a MMO. I know some theory and basic movement was not a problem with interpolation and stuff, the difficult part is implementing a leap move.

My current setup has a server and multiple clients connecting to it. The movement of the AI agent and its behaviour is computed on the server, the AI client receives position updates and interpolates between the current position and the position received from the server.

When the server decides that an AI has to attack, it sends an attack command to clients and, to make the thing more realistic, the clients stops their agents as soon as they receive the message and start an attack animation.

The important part now: during this attack animation, the agent quickly (0.6 s approx) translates (the translation is not in the animation) toward the targeted player. The client of that player then sends the landing position to the server which does some validation and hit checks and then resumes its behaviour computation sending new attack commands or position updates to clients.

This creates a very pleasing effect on the client of the player being attacked but may cause weird translations (due to the error in the position of the agents and the players) on other clients.

I tried predicting the "landing position" on the server but it's always somehow too wrong as it depends a lot on the target direction from the agent, and small changes in both the agent position and target position often lead to big errors.

Having a good look and feel of the leap on the client is imperative.

My questions are:

is there a better way to handle this in my case?
is there a good practice to follow in this that I am completely disregarding?

sentences:
Linking maps in Java game In my Java game, I've got a number of randomly-generated maps made of tiles.
I'm struggling with writing the code to handle the entering/exiting of the maps.

Originally, I only had Ascend and Descend. Easy. Enter exit, arrive at entrance. Basically, I used depth-- and depth++. Start at level 1, descend to level 2. Ascend to level 1 if desired.

Now I have maps that have North, East, South, and West entrances.
So when I exit North, I need to arrive at the South entrance. Similarly, when I enter East, I need to arrive at the West entrance.

I'm working on an elaboration of the Ascend/Descend --/++ system. This basically means I have to have code for:

eastEntrance sends player to westExit,

westEntrance sends player to eastExit,

northEntrance sends player to southExit,

southEntrance sends player to northExit.

westExit sends players to eastEntrance (etc for east, south, north).

This seems pretty cumbersome.
What is a good way to link my maps?

I'd really appreciate any input on this.

sentences:
Unity runs custom AssetPostProcessor every time on save I've written a AssetPostProcessor script that make some changes to prefabs and materials on import in some specific folders. I'm using this method to do that:

private static void OnPostprocessAllAssets(string[] importedAssets, string[] deletedAssets, string[] movedAssets, string[] movedFromPath)
{
   // if the importedAsset is a prefab
   GameObject obj = (GameObject)AssetDatabase.LoadAssetAtPath(objName, typeof(GameObject));
   if (obj) {
        if (AssetDatabase.GetAssetPath(obj).Contains("Assets/Tiled2Unity/Prefabs")) {
            // Here's some code that changes the asset
        }
    }
}

For some reason, every time I save this AssetPostProcessor is run which is something I don't want because this is lost time for something that isn't needed. What can I do to stop this?

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:
How can I move an object the fastest way? How can I move an object the fastest way?
What I'm trying to do is to make an object pass by at speed that you almost cannot see - like an airplane that moves from side to side in very high speed.
Here is my code:
transform.position = Vector3.MoveTowards(transform.position,
            stopPoint, Time.deltaTime * ms);

sentences:
Size of an image imported with FreeImage I'm having abit of a brainfart and I can't quite grasp what I'm doing wrong.
It's quite simple, I am importing an image with FreeImage (http://freeimage.sourceforge.net/) which has a method FreeImage_GetBits that returns a pointer to the first byte of the image data. I then try to load all the data into memory using (bitsperpixel / 8) * pixelsWidth ' pixelHeight, like this:

uint32_t bitsPerPixel           = FreeImage_GetBPP(bitmap);   // resolves to 24
uint32_t widthInPixels          = FreeImage_GetWidth(bitmap);  // resolves to 1024
uint32_t heightInPixels         = FreeImage_GetHeight(bitmap);  // resolves to 1024

// container is a std::vector<uint8_t>
pkgMaterial.mTextureData.insert(pkgMaterial.mTextureData.begin(), FreeImage_GetBits(bitmap), FreeImage_GetBits(bitmap) + ((bitsPerPixel/8) * widthInPixels * heightInPixels));

I have a jpg which is 31 kilobytes in size on disc. Yet when I load it using the above formula, I see the vector is then filled with 3145728 bytes, which is approx 3145 kilobytes. What am I doing wrong?

sentences:
Rotate object always at same speed on screen, no matter camera distance? I am rotating a globe like XCOM's hologlobe,

I rotate it using Quaternion.RotateTowards(Quaternion from, Quaternion to, float maxDegreesDelta).

I found a good value for maxDegreesDelta, in my case it is 5.0f.

There is a limit on how close or far the camera can be, let's assume clos is 1.0f and far is 2.0f.

I want to be able to zoom into the globe, but obviously when I do, it rotates a bit too fast then.

When zoomed out, rotation speed is satisfying:

When zoomed in, rotation is too fast, making it more difficult to manipulate:

And the problem is even more evident as game view size gets bigger, i.e. fullscreen.

Using Mathf.Lerp and Mathf.InverseLerp, I've tried to make maxDegreesDelta and mouse delta proportional to the distance the camera is but it's hardly convincing.

Note: I rotate the globe, not the camera.

Question:

How can I ensure object rotates at same speed on screen, no matter how close or far camera is ?

Code:

(assumes there is a sphere of radius 0.5 at Vector3.zero and camera is positioned at Vector3.back)

using UnityEngine;
using UnityEngine.InputSystem;

namespace Test2
{
    public class GeoScapeController : MonoBehaviour
    {
        #region Public

        public Transform TargetObject;

        public Camera TargetCamera;

        [Range(0.01f, 1.0f)]
        public float Sensitivity;

        public bool Smooth;

        public float ZoomDistanceMin;

        public float ZoomDistanceMax;

        #endregion

        #region Private

        [SerializeField]
        [HideInInspector]
        private Quaternion TargetRotation;

        [SerializeField]
        [HideInInspector]
        private int ZoomLevel;

        [SerializeField]
        [HideInInspector]
        private int ZoomLevels;

        [SerializeField]
        [HideInInspector]
        private Vector3 ZoomVector;

        [SerializeField]
        [HideInInspector]
        private Vector3 ZoomVelocity;

        private void Reset()
        {
            Sensitivity = 0.05f;
            Smooth = true;

            ZoomDistanceMin = 0.625F;
            ZoomDistanceMax = 1.25F;
            ZoomLevels = 10;
        }

        private void Start()
        {
            TargetRotation = Quaternion.LookRotation(TargetObject.forward, TargetObject.up);
            ZoomVector = TargetCamera.transform.position;
        }

        private void Update()
        {
            var mouse = Mouse.current;
            var delta = mouse.delta.ReadValue();
            var scale = new Vector4(-1.0f, +1.0f, +1.0f);

            var x = mouse.leftButton.isPressed ? delta.y * scale.y * Sensitivity : 0.0f;
            var y = mouse.leftButton.isPressed ? delta.x * scale.x * Sensitivity : 0.0f;
            var z = mouse.middleButton.isPressed ? delta.x * scale.z * Sensitivity : 0.0f;
            var r = Quaternion.AngleAxis(x, Vector3.right) *
                    Quaternion.AngleAxis(y, Vector3.up) *
                    Quaternion.AngleAxis(z, Vector3.forward);

            if (Smooth) // hopefully, quaternion limits won't be crossed !
            {
                TargetRotation = Quaternion.RotateTowards(TargetRotation, r * TargetRotation, 2.5f);

                TargetObject.rotation = Quaternion.Slerp(TargetObject.rotation, TargetRotation, Time.deltaTime * 5.0f);
            }
            else
            {
                TargetObject.rotation = TargetRotation = r * TargetRotation;
            }

            var wheel = (int) mouse.scroll.ReadValue().y / 120;
            if (wheel != 0)
            {
                ZoomLevel = Mathf.Clamp(ZoomLevel + wheel, 0, ZoomLevels);
                var lerp1 = Mathf.InverseLerp(ZoomLevels, 0, ZoomLevel);
                var lerp2 = Mathf.Lerp(ZoomDistanceMin, ZoomDistanceMax, lerp1);
                ZoomVector = Vector3.back * lerp2;
            }

            TargetCamera.transform.position = Smooth
                ? Vector3.SmoothDamp(TargetCamera.transform.position, ZoomVector, ref ZoomVelocity, 0.3f)
                : ZoomVector;
        }

        #endregion
    }
}

sentences:
most efficient Bounding Sphere vs Ray collision algorithms Is there a known 'most efficient' algorithm for Sphere vs Ray collision detection?

I recently stumbled accross Arvo's AABB vs Sphere collision algorithm, and I am wondering if there is a similarly noteworthy algorithm for this.

One must have condition for this algorithms is that I need to have the option of querying the result for the distance from the ray's origin to the point of collision. Although if there is another, faster algorithm which does not return distance, then in addition to posting one that does, also posting that algorithm would be very helpful indeed.

Please also state what the function's return argument is, and how you use it to return distance or a 'no-collision' case. For example, does it have an out parameter for the distance as well as a bool return value? or does it simply return a float with the distance, vs a value of -1 for no collision?

sentences:
Most Efficient Way to Check Player Distance from a Line? I need to get the player's distance from a line (or the outside edges of an Gameobject, if that's easier) throughout their time in the game. I need the code to be fairly simple because I'm a novice (though if it's thoroughly explained, I can implement more complex solutions).

Is there an optimal way to do this that doesn't involve resorting to using the full formula for a point to a line? Because I think I might have some trouble implementing that in unity's system (translating to/from coordinate systems, maybe).

Thanks!

sentences:
What are some methods to represent train tracks? I looked into this a while back for a small project, but didn't get too far.  I'd like to create a small program that lets a user draw a train track and then allows a "train" to follow said track on a 2D plane.  I'd like the track to be pretty free form and result in a nice smooth line.  I played around with cubic splines and had decent results, but had a ton of trouble getting the train to follow the spline.  I also had a lot of trouble creating multiple tracks and switching a train from one track to another.

Does anyone have advice, articles, or source code that can help me figure something out?  Thanks!

sentences:
multiplayer networking with physics I'm curious how multiplayer networking with physics is implemented in racing games.
We have a physical world with multiple fast-moving vehicles controlled by different people.
Let's say that vehicles have weapons and can shoot each other (Twisted Metal, Vigilante v8)

I'm anxious about hits and collisions.
Authoritative server or a better alternative?

sentences:
Position problems instantiating lasers at the sides of a space ship I'm developing a demo of a 3D Space Ship game concept in Unity, just for learning purposes.

I have a cube representing my space ship in the scene, and a laser prefab that is instantiated at the 2 sides of the space ship any time the user presses the spacebar, i use this C# code (placed in the script attached to the space ship, just a cube right now) to calculate the position of the lasers and instantiate them:

Vector3 laser1Position =
    this.transform.position + this.transform.forward + this.transform.right;
Vector3 laser2Position =
    this.transform.position + this.transform.forward - this.transform.right;

Instantiate (laser, laser1Position, this.transform.rotation);
Instantiate (laser, laser2Position, this.transform.rotation);

At this point, everything worked perfect, and the lasers are instantiated correctly at the sides of the cube, exactly at the middle of the 2 sides.

The problem came yesterday, when i replaced the cube by a real space ship model, a simple design made by my brother in Blender, and attached the same script my cube had, the lasers are instantiated very above from the space ship, producing the effect seen in the next image, the lasers are spawned at the red line i drew just for showing purposes, when i need them to be instantiated at the green line:

Here you can see the space ship model vs the cube, both firing lasers:

We designed the space ship model in blender, in the origin of coordinates, without any other objects or light sources, so my doubts are:

Why are the lasers spawned that high if the model is not there? Is really the model bigger than i see in the editor? (The green box is a box collider i added for collisions managing)

Should we configure or touch something in the Blender project to stablish the real size or axis of the model when we import it?
Is there a better method of calculate where the lasers should be spawned that this one i am using? Imagine that i want to spawn them in the point of the wings, in front of them. Is there any marker or method i could use to easily spot the place where the lasers should be spawned at runtime? Instead of manual calculating it or by test-error.

I don't have the model here right now, if you need it please let me know and i will try to upload it to somewhere later.

Thank you so much for your help!

sentences:
How can I seamlessly animate textures across tiles like in Civilization 6? I am trying to make a much simpler version of the graphic effects we see in the game Civilization 6. This question applies to the graphics on land and ocean tiles. But I first noticed this effect on the ocean tiles.

So you will see the waves effect (fairly near centre of the image), if you ever played the game you'll know that these waves roll into the coast and are there to let you know its an ocean tile and not a lake.

But these waves span several hex tiles, appearingly seamless. But the map is procedurally generated and so land tiles and ocean can appear in any random formations.

How does it know which animated texture to play for each tile?

I already have made the hex tile map.
I have NOT yet learnt how to add my own custom material/shader to make the texture animate, but I believe I can learn this on my own

But I really am at a loss of how the tile 'knows' what its neighbours are doing and is able to join the texture so nicely). Is there a name for this process of which i can do further research? Any tips on where to start making this effect. (I only want it to look very basic to start with , I'm not expecting to be able to recreate Civ6 any time soon :P

Many thanks!

sentences:
Sorting cube depth correctly with an isometric engine Possible Duplicate:
  How should I sort images in an isometric game so that they appear in the correct order?

I'm starting work on a simple isometric engine. Everything thing is going great at the moment, but I think I've hit an issue everyone hits. I'm having difficulty getting sorting the depth of a cube.

This image shows the default view (character not near a cube)

This image shows the character behind a cube

The issue is here, when the character goes in front of the cube.

Is there a common solution to this? How would i go about it? Would i need to give a depth to EVERY cube, then somehow work out the current tile the character is on then apply the depth to him? I'm using game maker on a mac and I'm happy to upload the project somewhere if you need to check it out.

Thanks for any input.

sentences:
Pygame collision detection less frequent when objects are increased I currently experiencing an issue in pygame where whenever i increase the number of objects e.g. platforms, rocks

for a in range(150):
    rock = Rock(0,0)

OR incresing the range which they spawn in:

rock.rect.x = random.randrange(-200,30000)
rock.rect.y = random.randrange(80,500)
rock_list.add(rock)
all_sprites_list.add(rock)

LINE 232

(which i really need to do for an ENDLESS mode) collision detection between the player and all the objects that have have been changed will become less frequent, so the character will just go through th objects as they weren't even there... you can see the character fall through the objects, it falls through in front of the object and not behind. All game code is below, I have tried a number of different techniques and values but I have found that these numbers and ranges work best.

Collision Detection code:
 FOR PLATFORM

medium_collide = pygame.sprite.spritecollide(player, medium_list, False)
if medium_collide:
    player.rect.y-=2

FOR ROCK

    rock_collide = pygame.sprite.spritecollide(player, rock_list, True)
    if rock_collide:
        lives-=1
    if rock_collide:
        player.rect.y = 100
        player.rect.x = 50

!!!!!GAME CODE BELOW!!!!!

GAME CODE

sentences:
Mixing 3D and 2D content on the iPhone? I am at the design phase of a board game on the iPhone and am considering a couple of options for rendering the view:

Quartz to render top down views of the board with core animation to do the transitions to close ups etc. Using a 3D library (or GL directly) to render dice rolls on top of the 2D view.
Full 3D interface to render the board and do the transitions (something like the Monopoly app on the iPhone).

Keeping most of the game in 2D simplifies the implementation and the artwork, but I wonder if the overall finish will suffer.  Is it practical to render 3D views (for the dice rolls) on top of a Quartz 2D app?

Should I just bite the bullet and go 3D?

sentences: What are the benefits of capping frames per second? (If any) I am working on a simple game in OpenGL, using SDL for display initialization and input, and it appears in terms of timing I have two options available to me. Number one being just sleeping for the optimalTimePerFrame - theTimeTakenToRender, when the optimalTimePerFrame in seconds = 1/theFramerateCap. (I'm not entirely sure if this is necessary, as it is equivalent to using vsync, which may be more accurate. If my assumption is correct then please tell me wheter or not SDL + OpenGL has vsync by default, and if not how to enable it.) The other is to measure the time since the last frame was rendered, and merely adjust movement accordingly. (The shorter time taken to render a frame, the less far entities move in that frame). In terms of performance, and decreasing flicker etc, what are the advantages and disadvantages of these two methods?

sentences:
How to preserve Arcball rotation in c++ OpenGL? Firts of all want to say that I've already searched for other people's answers here as same as Google and didn't found anything about it there. Also tried some others arcball implementations but none of them worked as good as the one using at this moment or use older OGL versions.

So I'm following this github page code by subokita to implement an arcball camera myself and got to the point where it works and noticed that whenever you release the mouse and click again the view comes back to the start position.
I know that it happens because of the model rotation matrix obtained from prevPos and currPos comes back to the start whenever you click again since prevPos changes but can't see a clear solution to preserve the previous state without messing up the view.

I tried moving the model to the camera class and having two variables for it that gets exchanged depending on the mouse action as seen in the code below so that it calculate the state over a previous model value when dragging and use the result of it when no dragging being made. But even if it works it produces weird frames at the beggining of the cursor redrag(video) even though it success on preserving the previous state and I have no idea why.

Arcball.cpp

// Arcball.h > glm::mat4 model, smodel = glm::mat4(1.0);
glm::mat4 Arcball::createModelRotationMatrix(glm::mat4& view_matrix) {
    switch (mouseEvent)
    {
    case 0:
        return model = smodel;
    case 2:
        glm::vec3 axis = glm::inverse(glm::mat3(view_matrix)) * camAxis;
        return smodel = glm::rotate(glm::degrees(angle) * rollSpeed, axis) * model;
    }
}

main.cpp

glm::mat4 rotated_model = arcball.createModelRotationMatrix(view);
glm::mat4 mvp = projection * view * rotated_model;

How can I modify this arcball to preserve the rotation when a redrag occurs?

Thanks for your time.

sentences:
Procedurally Generated Top View 2D RPG Map Generation Procedural generation is a fascinating concept and is gaining popularity in the gaming industry.  The thought of playing a game that has new content every-time the game is played is very exciting to me.

My question is how would I go about generating top view 2D maps with the appropriate transition tiles?

I know how to create top view maps with stand alone tiles. For example I can generate a procedural map with grass and trees. However I can not generate forests of different sizes and shapes. How do I know which forest sprite to put where? I'm trying to loop over the map tiles and accessing the surrounding tiles to pick which tile is the appropriate one. However wouldn't this approach lead to error in which forest tile is placed where? The computer would have to know the size of the forest and how the forest is shaped.

The problem seems too complex for me. Any ideas on how to break this problem down would be much appreciated or if you just want to talk about procedural generation I'm game for that too.

So far I've generated a forest but I'm having trouble making it look right. Here is what I have so far. https://76295db93db3812642fa5ba984c042fa81ffc37c.googledrive.com/host/0B6H3TRExU5M9eEkyd2FreHhiNlU/

sentences:
How to add a bolt into my unity project In my game, one of the character you pick as a special ability called the dash. It allows the player to quickly move forward. Included below is the code. It just throws up a bunch of errors. This is a 3d scene

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

public class PlayerJump : MonoBehaviour
{
    // Start is called before the first frame update
    void Start()
    {

    }

    // Update is called once per frame
    void Update()
        {
            if (Input.GetKeyDown("q"))
            {
                transform.Translate(Vector3.KeyDirection * 260 * Time.deltaTime, Space.World);
            }

        }
    }
```

sentences:
Can't Get Component On Photon Instantiated Scene Object I'm completely new to photon. I have a fair bit of experience with Unity but learning multiplayer feels like learning a new game engine lol.
I'm using photon and making a chess game, so I've put photon Views and practically everything, except the objects I want to be unique. I feel like I've gotten most of it figured out, but for some reason, when I start a multiplayer game, it doesn't initialize my chess pieces properly. So, I have it placing all the pieces at start, here is my pastebin for reference, the InitiateBoard() method is what's having issues, starting at line 85, the error is at line 100.
https://pastebin.com/bVUJ25Yu
The "pieces" array is a 2D array of the ChessPiece class, which assigns the sprites, team, and movesets based on position on the board. It's very strange, it works just fine on a single player game, but if I build the game and play two player(which is the exact same script, it just disables the AI), for some reason, only the build gets a null reference exception error at this line,
pieces[x, y] = spawnedPiece.GetComponent();
It seems to be unable to get a reference to the chesspiece, and therefore, it sets all the pieces to white rooks as white rook is in the default position. Weirdly, the pieces initialize properly on the editor's screen. And also, if I play the build version in single player, it seems to initialize everything just fine.
After some testing, I realized it's only the joined player that is having issues, I tried running the build version first, then joining through the editor, it does the exact same bug with the same error code on the editor rather than the build version. So I can look at the editor and see a bunch of white rooks, but when I look at the build, it will be a bunch of properly assigned pieces... And yes, I am certain they are in the same game, as it calls an RPC to start the game and if I move one piece, I can see said piece is moved on both games.
Does anyone know what could be causing this? It's spawning the pieces just fine, but it doesn't seem to be able to get the component on the spawned piece...

sentences:
Creating Unity Handles without any visible game objects at given regions I am trying to create handles without any visible game objects. The image below from a sample scene shows rects (top left rect is at position (-2, 4), size is (1, 1)) of the handles I want to appear when the mouse is hovered over the rectangular areas. So basically in a scene with no game objects I want to be able to hover over with the mouse to show the squares below as handles.

I believe the issue is most likely with the Raycast in UpdateHandlePosition(). The handles only appear when there are objects on the screen and they appear at the wrong places. Please see the relevant code below.

static void UpdateHandlePosition()
{
    if( Event.current == null )
    {
        return;
    }

    Vector2 mousePosition = new Vector2( Event.current.mousePosition.x, Event.current.mousePosition.y );

    Ray ray = HandleUtility.GUIPointToWorldRay( mousePosition );
    RaycastHit hit;

    if( Physics.Raycast( ray, out hit, Mathf.Infinity, 1 << LayerMask.NameToLayer( "Default" ) ) == true )
    {
        Vector3 offset = Vector3.zero;

        if( EditorPrefs.GetBool( "SelectBlockNextToMousePosition", true ) == true )
        {
            offset = hit.normal;
        }

        CurrentHandlePosition.x = Mathf.Floor( hit.point.x - hit.normal.x * 0.001f + offset.x );
        CurrentHandlePosition.y = Mathf.Floor( hit.point.y - hit.normal.y * 0.001f + offset.y );
        CurrentHandlePosition.z = Mathf.Floor( hit.point.z - hit.normal.z * 0.001f + offset.z );

        //CurrentHandlePosition += new Vector3( 0.5f, 0.5f, 0.5f );
    }
}

    static void DrawHandlesCube( Vector3 center )
{

    Vector3 p1 = center + Vector3.up * 0.5f + Vector3.right * 0.5f + Vector3.forward * 0.5f;
    Vector3 p2 = center + Vector3.up * 0.5f + Vector3.right * 0.5f - Vector3.forward * 0.5f;
    Vector3 p3 = center + Vector3.up * 0.5f - Vector3.right * 0.5f - Vector3.forward * 0.5f;
    Vector3 p4 = center + Vector3.up * 0.5f - Vector3.right * 0.5f + Vector3.forward * 0.5f;

    Vector3 p5 = center - Vector3.up * 0.5f + Vector3.right * 0.5f + Vector3.forward * 0.5f;
    Vector3 p6 = center - Vector3.up * 0.5f + Vector3.right * 0.5f - Vector3.forward * 0.5f;
    Vector3 p7 = center - Vector3.up * 0.5f - Vector3.right * 0.5f - Vector3.forward * 0.5f;
    Vector3 p8 = center - Vector3.up * 0.5f - Vector3.right * 0.5f + Vector3.forward * 0.5f;

    //You can use Handles to draw 3d objects into the SceneView. If defined properly the
    //user can even interact with the handles. For example Unitys move tool is implemented using Handles
    //However here we simply draw a cube that the 3D position the mouse is pointing to
    Handles.DrawLine( p1, p2 );
    Handles.DrawLine( p2, p3 );
    Handles.DrawLine( p3, p4 );
    Handles.DrawLine( p4, p1 );

    Handles.DrawLine( p5, p6 );
    Handles.DrawLine( p6, p7 );
    Handles.DrawLine( p7, p8 );
    Handles.DrawLine( p8, p5 );

    Handles.DrawLine( p1, p5 );
    Handles.DrawLine( p2, p6 );
    Handles.DrawLine( p3, p7 );
    Handles.DrawLine( p4, p8 );

}
}

sentences: is it possible to use Ui button to work continous on unity i want to use Ui buttons as joyStick arrows to move character. but as i know buttons just work once. not continous. so is it possible to make button work continous?

sentences:
Smooth animation in Cocos2d for iOS I move a simple CCSprite around the screen of an iOS device using this code:

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

- (void) update:(ccTime) delta {
    CGPoint currPos = self.position;
    currPos.x += xVelocity;
    currPos.y += yVelocity;

    self.position = currPos;
}

This works however the animation is not smooth. How can I improve the smoothness of my animation?

My scene is exceedingly simple (just has one full-screen CCSprite with a background image and a relatively small CCSprite that moves slowly).

I've logged the ccTime delta and it's not consistent (it's almost always greater than my specified interval of 0.0167... sometimes up to a factor of 4x).

I've considered tailoring the motion in the update method to the delta time (larger delta => larger movement etc). However given the simplicity of my scene it's seems there's a better way (and something basic that I'm probably missing).

sentences: How does glfw handle input? GLFW is clearly an OpenGL framework, which means we are working with graphics card. How input gets handled then?Seems like it handles all of the controllers on our system, not only graphics card.

sentences:
How to make a 3D mesh invisible in Godot? Just like the title says i'm trying to make the mesh disappear after a set value reaches zero. Current code is trying to simply turn the entity invisible so that later i can implement a resurrect function.

if Sname == get_node("Entity").get_name():
    print("punched number 1")
    selected.health = selected.health - 10
    if selected.health <= 0:
        selected.health = 0
        get_node("Control/Button").disabled = true
        $Entity.visable = false

Is it even possible to toggle that value or is there an easier way to do this?
I dont want to use free_queue() as that would interfere with other entitys.

Thanks for the help in advance, im new to Godot so sorry if this ends up being a no brainer.

sentences:
Using indices in obj files and handling normals I have been loading obj files and using indices for handling duplicated vector positions, but I have not gotten to the point of requiring normal data to be passed to the shaders as well.

The problem I have is that obj files store the relevant normal data in the face field, and when it comes to loading a point that is used multiple times, the normal might be different for each subsequent face including a particular vertex, but I can only pass one normal per vertex.

How would people suggest getting around this issue?

I can only think of two ways, either stop using indices and that will allow me to pass unique position vector / normal pairings, or store all instances of position/normal pairs and if a new normal is required for a position, create it and index it accordingly.

sentences:
Insufficient memory on creating vertex buffers I'm building a voxel world generator with XNA where the voxels are rendered as polygonal cubes. The world is divided into 1024 chunks of 32x32x256 cubes each (as 32 chunks by 32 chunks), and each chunk has its own index and vertex buffer. Since each chunk is different, vertex buffer size is determined on runtime.

To prevent massive stalling on opening the program, only one chunk is re-built per frame until all chunks are built. Occasionally the program crashes with an "insufficient memory" related error that is caused by the line that creates the vertex buffer. Here is how I set them up:

 vb = new VertexBuffer(
      device,
      VertexPositionColorNormal.VertexDeclaration,
      nextIndex,
      BufferUsage.None
 );

 ib = new IndexBuffer(
      device, IndexElementSize.ThirtyTwoBits,
      nextIndex,
      BufferUsage.None
 );

My vertex structure is not very large, using only a Vector3 for position and Byte4 for color and normal lookup info:

public struct VertexPositionColorNormal : IVertexType
{
    public Vector3 Position;
    public uint Data;

    public readonly static VertexDeclaration VertexDeclaration = new VertexDeclaration
    (
        new VertexElement(0, VertexElementFormat.Vector3, VertexElementUsage.Position, 0),
        new VertexElement(12, VertexElementFormat.Byte4, VertexElementUsage.TextureCoordinate, 0)
    );

    VertexDeclaration IVertexType.VertexDeclaration { get { return VertexDeclaration; } }
}

NextIndex is the number of vertices and indices allocated to the buffers (always 1 index per vertex).

Am I making too many buffers? It crashes despite the GC showing only about 12 MB of usage so I guess memory fragmentation is a problem when creating lots of buffers in a short time? Should I use a smaller amount of buffers that store more data and have several chunks share them?

EDIT: I estimate roughly 0.75 to 1 GB of memory used in the vertex buffers. My graphics card has 2GB of VRAM. Though I also know sometimes not all the vertex data may be stored in VRAM at one time.

sentences:
Detect which tile in a tile palette a player is colliding with I have a megaman-style platformer that I've been working on for a while now. I'd like to have my scene set up so that when a player interacts with certain tiles, it will have some sort of effect on the player.

This could easily be achieved with creating individual sprites for the aforementioned interactables, but I'd ideally like to be able to have a portion of my script handle it so that everything besides the player and enemies would be tilemaps.

For instance, I have a tile that would act as a treadmill that moves the player along in one direction. Another tile would be bouncy, and another would deal damage.

I have the game set up right now to detect when the player is touching a tile, but I have no way of being able to tell which tile the player is touching. Is there a way to be able to compare programmatically which tile from a tile palette my player's hitbox is currently touching?

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:
openGL ES - change the render mode from RENDERMODE_WHEN_DIRTY to RENDERMODE_CONTINUOUSLY on touch i want to change the rendermode from RENDERMODE_WHEN_DIRTY to RENDERMODE_CONTINUOUSLY when i touch the screen.

WHAT i Need :
Initially the object should be stationary. after touching the screen, it should move automatically. The motion of my object is a projectile motion ans it is working fine.

what i get : Force close and a NULL pointer exception.

My code :

public class BallThrowGLSurfaceView extends GLSurfaceView{

MyRender _renderObj;
Context context;
GLSurfaceView glView;

public BallThrowGLSurfaceView(Context context) {
    super(context);
    // TODO Auto-generated constructor stub
    _renderObj = new MyRender(context);
    this.setRenderer(_renderObj);
    this.setRenderMode(RENDERMODE_WHEN_DIRTY);
    this.requestFocus();
    this.setFocusableInTouchMode(true);
    glView = new GLSurfaceView(context.getApplicationContext());
}

@Override
public boolean onTouchEvent(MotionEvent event) {
    // TODO Auto-generated method stub
    if (event != null)
    {
        if (event.getAction() == MotionEvent.ACTION_DOWN)
        {
            if (_renderObj != null)
            {   Log.i("renderObj", _renderObj + "lll");
                // Ensure we call switchMode() on the OpenGL thread.
                // queueEvent() is a method of GLSurfaceView that will do this for us.
                queueEvent(new Runnable()
                {
                    public void run()
                    {
                        glView.setRenderMode(RENDERMODE_CONTINUOUSLY);
                    }
                });
                return true;
            }
        }
    }
    return super.onTouchEvent(event);
}

}

PS : i know that i am making some silly mistakes in this, but cannot figure out what it really is.

sentences:
How to prevent constant movement So I have this code for moving a pointer up and down in a menu. The only problem is it moves way too fast to even stop on any of the selections. It does go to each one, but even just a quick tap of the button the pointer moves down 3 selections. If you go up and down a few times it will go to the selection you want, but it's a hassle. So is there a way to maybe disable movement for about half a second?

        if(Game.stateEngine.menuState == StateEngine.MenuState.ITEM)
        {
            if(Input.dn && Game.pointer.y < 430)
            {
                Game.pointer.y += 15;
            }
            if(Input.up && Game.pointer.y > 172)
            {
                Game.pointer.y -= 15;
            }
            if(Input.x && Game.stateEngine.menuState != StateEngine.MenuState.MAIN)
            {
                Game.stateEngine.menuState = StateEngine.MenuState.MAIN;
                Menu.firstPass = true;
            }
        }

sentences:
Skyrim Creation Kit with Xbox 360 I posted this on stackoverflow but was advised to post here (here is a link to the stackoverflow question). I'm hoping for constructive feedback on its plausibility.

Update on progress: It looks like there are ways to stuff files back onto the console (horizon, modio, xplorer360, etc) and they do require some form of signing.

As of now, though, I've had no luck. I was hoping I could get away with just placing the ".esp" into the directory containing marketplace downloads for Skyrim, along with the signed ".bsa" file (basically a zipped up file containing any extra content the .esp will need to refer that doesn't exist in the basic game).

This doesn't work, at least not in the ways I've tried, so next I'm going to try install the entire game to my flash drive (if possible) and attempt to traverse through the game's directory (this is probably unlikely).

If anyone else has suggestions or luck or wants more detail on my failures comment/answer away.

Here is the question:

  I'm thinking about buying the PC version of Skyrim to get the Creation
  Kit (I already own a copy for the Xbox). I have read the faq and
  scoured plenty of forums to see if there was some way to mod Skyrim
  for a console (Xbox 360, in particular), but they are generally coming
  up negative.

  I realize the CreationKit is on the PC, but I was wondering if there
  was a way to set up the '.esp' (hopefully I'm interpreting this
  correctly) files to be placed on the Xbox 360 file system in a similar
  manner to how game add-ons are downloaded from the Xbox Live
  Marketplace.

  I believe it is possible to transfer saves between the console and the
  PC (e.g. google: 'skyrim mod xbox360'), but these are referencing
  items that already exist in the game (e.g. a console command for
  maximum carry weight does not require reference to new animations or
  models).

  It would probably be easier if one could navigate through the xbox's
  file system to see where the games' files are placed, but with the
  current setup, the file system is abstracted away.

  Any help or insight on the matter would be much appreciated. I would
  love to work on a project that would make it possible to let console
  gamers experience and enjoy all the great mods available to the PC
  community.

sentences:
Command Ordering Architecture of Dwarf Fortress What is the most elegant way to implement a command ordering system for AI? for example in dwarf fortress when you mark a forested area for wood cutting, the dwarfs then would do the following sequence:

Go to the tree
Chop the tree
Deliver wood to the stockpile
Go to another tree
and so on..

I already have a stack command working no. 1 which goes from idle state to reaching the destination tile of the tree.

What I'm afraid of is how this would get messy when I create more orders like this:

Build a house

Go to stockpile
bring wood to construction area
go back to stockpile
Bring stone to construction area
animate building sprite

Planting

Go to stockpile
bring seed to farm plot

Brewing

Go to stockpile
Bring plant to still
animate brewing sprite

So my question is, how do I implement a command ordering system like dwarf fortress and avoiding spaghetti code at the same time? are there any data structures that I need to study? Do I need to put the command sequence on a separate xml file?

sentences:
Achieve anisotropic filtering I want to set anisotropic filtering to my scene. I use SharpDX (DirectX 11) and C#.

How do i set up anisotropic filtering in my shader?

Currently i try that in the shader:

Texture2D tex;
sampler textureSampler = sampler_state
{
  Texture = (tex);
  MipFilter = Anisotropic;
  MagFilter = Anisotropic;
  MinFilter = Anisotropic;
  MaxAnisotropy = 16;
};

float4 PShader(float4 position : SV_POSITION, float4 color:COLOR, float2 tex0 : TEXCOORD0) : SV_TARGET
{
  float4 textureColor;
  textureColor = tex.Sample(textureSampler, tex0) * color;

  return textureColor;
}

I get my object, textured, but it is not filtered anisotropic. I can write everything in the Parameters, even invalid things and i don't get any errors. The result is the same, objects without applied anisotropic filtering.

Do i have to set that in the shader? Can i do that also with SamplerState? I tested that but i didn't get a result too.

Some steps what i have to set would be helpful.

Edit:

Here the current result. You can see the blurred planes of the cube in the middle:

As comparison the same scene in OpenGL with 16x anisotropic filtering. The planes of the cube are not blurred:

Second Edit:

Based on the idea, that in OpenGL the anisotropic filtering is a texture environment variable, maybe i have set some settings in the texture wrong?

Texture2D texture = (Texture2D)Texture2D.FromFile("Test.png");
ShaderResourceView tSRV = new ShaderResourceView(device, texture);
device.ImmediateContext.PixelShader.SetShaderResource(0, tSRV);

sentences: Implementing a large scale (planet-like) level in XNA 4.0 What is the best way to implement continuous level throughout the game, using XNA? Imagine that I have a level with the size of a whole city (like in MMORPGs) however, the game will currently be mainly single-player. I'd like to be able to split this huge planet into parts which load asynchronously as I enter them. However, I also have other questions, such as, what happens with the part that I've come from. Its state should be stored on the disk, right? Then, what if I need to make some changes to that part, when the player comes back. Obviously, other characters should have done something rather than standing still. What's the best way to grab the state as I stored it, and modify it a bit, based on certain parameters, before I load it and let my player return.

sentences:
How to gradually decrease opacity of model? I have been searching for this matter for a long time and slowly I begin to think that this option is not available in XNA for Windows Phone.

I am trying to get a 3D-Model to be drawn at 50% opactity/transparency.

The most promising piece I found is following:

//1. Set the alpha blend mode for the graphics device with:

graphics.GraphicsDevice.RenderState.AlphaBlendEnable = true;
graphics.GraphicsDevice.RenderState.SourceBlend = Blend.SourceAlpha; // source rgb * source alpha
graphics.GraphicsDevice.RenderState.AlphaSourceBlend = Blend.One; // don't modify source alpha
graphics.GraphicsDevice.RenderState.DestinationBlend = Blend.InverseSourceAlpha; // dest rgb * (255 - source alpha)
graphics.GraphicsDevice.RenderState.AlphaDestinationBlend = Blend.InverseSourceAlpha; // dest alpha * (255 - source alpha)
graphics.GraphicsDevice.RenderState.BlendFunction = BlendFunction.Add; // add source and dest results

//2. Set the alpha value in the BasicEffect for the model:
effect.Alpha = 0.5f; // Creates a 50% translucent object.

But GraphicsDevice.RenderState.AlphaBlendEnable isn't even available in XNA for Windows Phone.

So is there any way to achieve that effect?

sentences:
Is there an equivalent of Unity's OnCollisionEnter() in UE4? I've been looking for how to figure out when two objects are colliding all day.

If anyone knows how to do it I would be grateful. What I really want is a similar function to Unity's OnCollisionEnter() and a way to get a pointer to the object that I'm colliding with.

sentences:
Bad quality of the sprite in Unity I need to import a few sprites (background platform and sky) into my game scene but it seems that their quality after importing into Unity is too bad (they are blurred). The original resolution of this two images is big enough (2048 X 400 for background) and they are looking very nice in standard Windows image viewer. Here are the settings for these two textures:

maxSize = 2048
Format = truecolor
TextureType = Sprite(2d)/nGUI
FilterMode - point

I am using Unity2D 4.5 Target resolution of my project is 1280*800.

Can anyone help me to solve these problem?
As you can see the grass on foreground looks very bloory (1 picture)
Texture settings (2 picture)
Original image (3 picture)

sentences:
View-Update versus Model-update I am creating a game using a relatively new platform called "codenameOne", but I'm actually a software engineer, so this question might be rather basic or odd, but I'm unsure what to do.

The game is targeting mobile phones and tablets (codenameOne has the advantage of being close to WORA) and I'm unclear on how to correctly update the "logic" and the "view".

At the moment, both update 60 times per second, but this feels wrong. This means that if I decrease the update speed of the game, the elements will also slow down (such as applying the current acceleration to the velocity, to the position,...)

This comes down to two questions:

1) Should they have separate update frequencies?

2) If so, which ones are conventionel for mobile applications?

EDIT: It might actually be worth noting that the game works (some bugs but it renders fine and it's playable). If you want to take a look at the source it's here: https://github.com/DylanMeeus/CNOGame

sentences:
How do we coordinate which order the systems get processed within an ECS? If I knew all of the systems at compile time, I could order them myself. However, I intend on having user-defined mods. This adds a level of complexity, in that I (as the framework developer) don't know which mods will be developed, or installed on a particular user's machine.

I've thought about adding some sort of execution ordering

// within core code
systemRegistrar.register(PhysicsSystem.class).before(RenderingSystem.class);

// within third-party mod
systemRegistrar.register(ModSystem.class).before(PhysicsSystem.class);

I've thought about an incidental ordering using some sort of message or event bus

// within core code
// - PhysicsSystem
public void update() {
    // do physics-y stuff
    eventBus.send(new PhysicsSystemUpdatedEvent());
}

// - RenderingSystem
public void handle(PhysicsSystemUpdatedEvent event) {
    // do rendering stuff
    eventBus.send(new RenderingSystemUpdatedEvent());
}

But this blurs the line between what will happen, and what could happen.

Another thought that came into my mind is that we can be a little bit dirty and not care too terribly much about what order the systems get executed in, because even if we render before the physics are applied, the next frame will then render the physics update that was made in the previous frame. It's consistent, but it blurs the line between what happens within a frame.

sentences:
Making an AI walk on a NavigationMesh (2D/Top-Down game) For some time I have been working on a framework which should make it possible to generate 2D levels based on a set of rules specified by level designers. You can read more about it here as I won't go into details: http://www.jorisdormans.nl/article.php?ref=engineering_emergence

Anyway, I'm now at the point of putting the framework to use and have trouble coming up with a solution for AI.

I decided to implement a NavigationMesh in the generated levels as I already have that information to start with. Consider the following image (borrowed from http://www.david-gouveia.com/pathfinding-on-a-2d-polygonal-map/):

When I run A* on the NavigationMesh, the red path would be suggested when I want to go from point A to B (either direction). However, I don't want my AI to walk that path directly and clipping corners, I'd rather want them to follow the more logical black path.

How would I go about going from the Red path to the Black path, are there any algorithms for this. Which steps do I take? Is A* the proper solution for this at all?

For some additional information: The proof-of-concept game is a 2D top-down game written in C#, but examples/references in any language are welcome!

sentences:
How can I rotate the two endpoints of a line around the line's center in 3d? The object is a capsule. I have the position of the object vector3, and the orientation of the object, a quaternion. I want to construct a line which goes through the middle of the capsule with the two endpoints of the line being the top and bottom.
The capsule can be rotated in all 3 dimensions.

sentences:
What is the point of update independent rendering in a game loop? There are dozens of articles, books and discussions out there on game loops. However, I pretty often come across something like this:

while(running)
{
    processInput();
    while(isTimeForUpdate)
    {
        update();
    }
    render();
}

What basically is bothering me about this approach is the "update-independent" rendering e.g. render a frame when there is no change at all. So my question is why this approach is often taught?

sentences:
Understanding how to create/use textures for games when limited by power of two sizes I have some questions about the creating graphics for a game.

As an example. I want to create a motorbike. (1pixel = 1centimeter)
So my motorbike will have 200 width and 150 height. (200x150)
But the libgdx only allows to load sizes with the power of 2?! (2,4,8,16,...)

First I thought about that way.
I will create my bike with the size (200x150) and save it as png. Than I will open it again (e.g. with gimp) resize the image to a size which uses values with power of 2 (128x128). I will load that as texture in the programm and set width as 200 and height as 150.

But wouldn't it be a problem? Because I will lose some pixel information when I make the first conversation.?! Isn't it?

sentences:
Derivatives usage in FBM core So I learned now about derivatives and fbm, but can not figure out the effect of this code example (credits https://www.iquilezles.org/www/articles/morenoise/morenoise.htm, bottom of page):

const mat2 m = mat2(0.8,-0.6,0.6,0.8);

float terrain( in vec2 p )
{
    float a = 0.0;
    float b = 1.0;
    vec2  d = vec2(0.0);
    for( int i=0; i<15; i++ )
    {
        vec3 n=noised(p);
        d +=n.yz;
        a +=b*n.x/(1.0+dot(d,d));
        b *=0.5;
        p=m*p*2.0;
    }
    return a;
    }

What effect does (1.0+dot(d,d))? As the slope is more / it flattens the fbm sum?

sentences:
How can I change the highlighted color of a Unity button when it's clicked? I was playing around with buttons in Unity, and I wanted to see if I could change a button's highlighted color every time I clicked on it. I added a script in the same GameObject as a button component, and I had a changeColor function attached to the component's OnClick(). The function was in a ButtonScript class written like this:

public class ButtonScript : MonoBehaviour {
    public Button button;

    public void changeColor() {
        Debug.Log ("Changing highlighed color");
        int r = Random.Range (0, 255);
        int g = Random.Range (0, 255);
        int b = Random.Range (0, 255);
        Color currentColor = button.colors.highlightedColor;
        currentColor.r = r;
        currentColor.g = g;
        currentColor.b = b;
    }
}

I couldn't do button.colors.highlightedColor = new Color(r,g,b); because I got a "Consider storing the value in a temporary variable" error. When I tried a test play and clicked the button multiple times, the highlighted color didn't change. How can I make a function that changes a button's highlighted color when it's clicked, if it's possible?

sentences:
Other games that employ mechanics like the game "Diplomacy" I'm doing a little bit of research and I'm hoping you can help me track down any games, other than Diplomacy (online version here), that employ all or some of the mechanics in Diplomacy (rules, short form). Examples I'm looking for:

Simultaneous orders given prior to execution of orders

In Diplomacy, players "write down" their moves and execute them "at the same time"

Support, in terms of supporting an attacker or defender "take" a territory.

In Diplomacy, no one unit is stronger than another you need to combine the strength of multiple units to attack other territories.

Rules for how move conflicts are resolved

Example, 2 units move into a space, but only one is allowed, what happens.

I may add to this list later, but these are the primary things I'm looking for. If you need clarification on anything just let me know.

  Note: I tried asking this on GamingSE, but it was shot down. So, I am unsure where else I could post this. Since I am researching this for game development purposes, I assume this post is on topic. Please let me know if this is not the case. Please also feel free to re-categorize this. Thanks!

sentences:
Rotating a cube with arrow keys I have a list of rotations (on a cube in 3d space with the y-Axis pointing upwards, x-Axis pointing righthand and z-Axis pointing towards you) for example

+90 deg around x-Axis followed by
+90 deg around y-Axis followed by
+90 deg around y-Axis followed by
-90 deg around x-Axis

All rotations are only of type (+- 90 deg around x / y). The list can be of any length. My goal is to break it down to only three operations. I can't figure out how to calculate the three arguments xDeg,yDeg,zDeg which i can apply in the same order to rotateX,rotateY,rotateZ to get the same result as applying the complete list one after another to the rotation-functions. i tried to build up a permutation matrix depending on the actual position in the list of rotations when i iterate over it to apply the current deg value of a list item to either xDeg,yDeg,zDeg. I couldn't make ist work.

var gTrans = (function() {

  var perm = [[1,0,0],[0,1,0],[0,0,1]];
  var set = [0,0,0];

  function rotateUp() {
    //set = math.chain(set).add(math.multiply(perm,[-90,0,0])).done();
    //set = math.chain(set).add([-90,0,0]).multiply(math.transpose(perm)).done();
    perm = math.multiply([[1,0,0],[0,0,1],[0,-1,0]],perm);
    set[0] -= 90;
  }

  function rotateDown() {
    //set = math.chain(set).add(math.multiply(perm,[90,0,0])).done();
    //set = math.chain(set).add([90,0,0]).multiply(math.transpose(perm)).done();
    perm = math.multiply([[1,0,0],[0,0,-1],[0,1,0]],perm);
    set[0] += 90;
  }

  function rotateLeft() {
    //set = math.chain(set).add(math.multiply(perm,[0,-90,0])).done();
    //set = math.chain(set).add([0,-90,0]).multiply(math.transpose(perm)).done();
    perm = math.multiply([[0,0,-1],[0,1,0],[1,0,0]],perm);
    set[1] -= 90;
  }

  function rotateRight() {
    //set = math.chain(set).add(math.multiply(perm,[0,90,0])).done();
    //set = math.chain(set).add([0,90,0]).multiply(math.transpose(perm)).done();
    perm = math.multiply([[0,0,1],[0,1,0],[-1,0,0]],perm);
    set[1] += 90;
  }
})();

The code above is written with javascript, p5js and mathjs libs. Does someone have an idea? I know it's possible to simply multiply the rotation matrices. But i need the angles and the informations if it's 750 deg (not only 750 mod 360 deg).

sentences:
Move enemy left in sin wave motion over time I'm trying to create a top down shooting game where the enemy moves in sinusoidal motion over time. For the first 10 seconds the enemy needs to move only left and after that it needs to move left in sin wave motion. This is the code I'm using. `

public float enemySpeed;
float frequency = 5.0f;
float magnitude = 1.8f;

void FixedUpdate()
{
    if(Time.time < 10.0f)
    {
        transform.Translate((enemySpeed* Vector2.left) * Time.deltaTime);
    }
    if(Time.time >= 10.0f)
    {
        transform.Translate(enemySpeed* -1.0f * Time.deltaTime, 1.0f * Mathf.Sin(Time.time * frequency) * magnitude * Time.deltaTime, 0);
    }`

What's happening is that for the first 10 seconds the enemy just moves left but after that all the enemies in the screen start moving in sin wave motion. What I want to achieve is that if the enemy has already spawned before the 10th second, it should move left without sin motion. Right now if the enemy is in the middle of the screen and the time is over 10 seconds, even this enemy starts moving in sin motion.

sentences:
Changing location after CommitAnimations I'm using the following code to move a UIImageView:

shootImg.image = [UIImage imageNamed:@"Projectile Left 1.png"];
[UIView beginAnimations:nil context:nil];
shootImg.center = CGPointMake(shootImg.center.x+1000, shootImg.center.y);
[UIView commitAnimations];

This works but what I want to do is after [UIView CommitAnimations]; I want to set the location of shootImg using CGPointMake. If I just put it after commitAnimations then the animation doesn't fully complete. Any suggestions? I'm not using any frameworks like cocos2d and if you need to see any more code just ask.

sentences:
How do I lock drawn lines to be orthogonal to an existing one? I'm making a 2D game in Corona for Android/iPhone that is similar to Volfied. In my game, the user has to touch the screen to draw a line for the character to move along. How can I force the lines to be orthogonal, as opposed to being free-drawn?

I can detect the swipe's direction with atan2 and the difference of X and Y, but I am having trouble determining the pivot points of the line. How can I determine when the line should make a turn?

You can see what I am trying to accomplish in this video of Volfied gameplay.

sentences:
Score does not increment by 1 in Unity I have made a simple code where once the player moves through the collider that acts as a trigger then Unity adds a score. However, it increases by increments of 8 and I am not sure why.

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

public class Game : MonoBehaviour
{
    public int Score = 0;

    void Start()
    {

    }

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

    }

    private void OnTriggerEnter2D(Collider2D other)
    {

        AddScore();
    }

    void AddScore()
    {

        Score++;

    }
}

sentences:
Are hard coded "rooms" better than dynamically generated on a smart phone, from performance point of view This question pertains to a type of platform/maze game (made with Unity 5) for typical smartphones (iOS/Android).

This game has following characteristics:
 1. an upper limit (about 100) on the amount of rooms
 2. 3-5 different "levels", each with a different amount of rooms
 3. the shape and type of the "ground" in each room is dynamically generated
 4. each room has some items that are dynamically placed in the room but are generated from a prefab

A rough idea on the rooms in this game is given in below screen shot.

In that image only the platforms (black and white tiles) and the ground (light brown) would be shaped by an algorithm. The other objects shown in the image are prefabs that would be located somewhere in the room by an algorithm.

But considering that this game would not exactly be an infinite runner, and since it should run on smart phones, would it be better from performance perspective, to create 100 hard coded rooms instead?

sentences:
Boolean checks with a single quadtree, or multiple quadtrees? I'm currently developing a 2D sidescrolling shooter game for PC (think metroidvania but with a lot more happening at once). Using XNA.

I'm utilising quadtrees for my spatial partitioning system.

All objects will be encompassed by standard bounding geometry (box or sphere) with possible pixel-perfect collision detection implemented after geometry collision (depends on how optimised I can get it).

These are my collision scenarios, with <> representing object overlap (multiplayer co-op is the reason for the player<>player scenario):

Collision scenarios (true = collision occurs):
Player              <>      Player          =   false
Enemy               <>      Enemy           =   false
Player              <>      Enemy           =   true
PlayerBullet        <>      Enemy           =   true
PlayerBullet        <>      Player          =   false
PlayerBullet        <>      EnemyBullet     =   true
PlayerBullet        <>      PlayerBullet    =   false
EnemyBullet         <>      Player          =   true
EnemyBullet         <>      Enemy           =   false
EnemyBullet         <>      EnemyBullet     =   false
Player              <>      Environment     =   true
Enemy               <>      Environment     =   true
PlayerBullet        <>      Environment     =   true
EnemyBullet         <>      Environment     =   true

Going off this information and the fact that were will likely be several hundred objects rendering on-screen at any given time, my question is as follows:

Which method is likely to be the most efficient/optimised and why:

Using a single quadtree with boolean checks for collision between
the different types of objects.
Using three quadtrees at once (player, enemy, environment), only testing the player and enemy trees against each other while testing both the player and enemy trees against the environment tree.

sentences:
Android Bitmap: Collision Detecting I am writing an Android game right now and I would need some help in the collision of the Pawns on screen. I figured I could run a for loop on the Player class with all Pawn objects on the screen checking whether or not Width*Height intersects with each other, but is there a more efficient way to do this?

And if you do it this way, many of the transparent pixel inside the rectangular area will also be considered as collision as well. Is there a way to check for collision between Bitmap on a Canvas that disregard transparent pixels? The class for player is below and the Pawn class uses the same method of display.

Class Player {
  private Resources res; // Used for referencing Bitmap from predefined location
  private Bounds bounds; // Class that holds the boundary of the screen
  private Bitmap image;
  private float x, y;
  private Matrix position;
  private int width, height;
  private float velocity_x, velocity_y;

  public Player (Resources resources, Bounds boundary) {
    res = resources;
    bounds = boundary;
    image = BitmapFactory.decodeResource(res, R.drawable.player);
    width = image.getWidth();
    height = image.getHeight();
    position = new Matrix();
    x = bounds.xMax / 2; // Initially puts the Player in the middle of screen
    y = bounds.yMax / 2;
    position.preTranslate(x,y);
  }
  public void draw(Canvas canvas) {
    canvas.drawBitmap(image, position, null);
  }
}

sentences:
Applying texture inside of an Icosphere? I have implemented a code to generate an Icosphere procedurally in Unity 5.3.4f, which works pretty well. However, what I need to do know it tweak the code to make the sphere to receive texture only in its inside triangle-faces, not outside. Searching trough the Unity forums, many have said that it's simply the case of flipping the normals of all triangles (i.e. multiplying them by -1). I tried it and it is not the case.

What is the correct way of changing the triangles (not trough shaders) so the Icosphere mesh can only be textured inside (e.g. in a skydome)?

EDIT: After Kromster's answer, I did some research and ended up implementing the following code:

Mesh InvertMeshFaces(Mesh _mesh)
{

    //Flip the triangles
    int[] triangles = _mesh.triangles;

    int numtriangles = triangles.Length / 3;
    for (int t = 0; t < numtriangles; t++)
    {
        int temptriangle = triangles[t * 3];
        triangles[t * 3] = triangles[(t * 3) + 2];
        triangles[(t * 3) + 2] = temptriangle;
    }

    //reseting the UV
    Vector2[] uvs = _mesh.uv;
    for (int uvnum = 0; uvnum < uvs.Length; uvnum++)
    {
        uvs[uvnum] = new Vector2(1 - uvs[uvnum].x, uvs[uvnum].y);
    }

    //reseting normals
    Vector3[] normals = _mesh.normals;
    for (int normalsnum = 0; normalsnum < norms.Length; normalsnum++)
    {
        norms[normalsnum] = -norms[normalsnum];
    }

    //setting the new values of triangles, normals and UVs
    _mesh.triangles = triangles;
    _mesh.uv = uvs;
    _mesh.normals = normals ;

    return _mesh;
}

So far, it works only partially. Applying that function to my Icosphere mesh, now it is possible to see the sphere rendered when camera is inside it. However, oddly enough, it's still also possible to see the sphere from outside. It means, both inside and outside are visible - the outside is not culled as expected.

sentences:
How to write a PBR Unlit Shader in Unity? I have a REALLY specific case here:

I have an Texture (a webcam), that is used by a shader to pickup a few x,y colors at the cordinates, and renders to a Custom Render Texture, that is later fetched (download pixel color information from GPU to CPU), and I can handle the algorithm from there.

The thing is, once I upgraded the project to PBR (Physically Based Rendering), all my Unlit scripts become PINK, and they stopped working.

This is a special case because:

It doesn't need to appear on the screen
It acts as a "Compute Shader", but with backward compatibility to old phones
It works well without PBR, but once PBR is enabled it becomes pink and stops working
It doesn't need to reflect, refract, output pixels or anything to the "Screen", only to my Custom Render Texture so that I can fetch it later.
The algorithm doesn't fits on a Graph based programming (it has iterations and etc)

Well, I didn't find documentation on how to write custom PBR shaders and here I am.

sentences: How to get an autotile in Godot 3.1? I wonder if there's a way to get an autotile just like a single tile using a get_autotile() GDScript function or something like that.

sentences:
How to calculate Camera “correct” position and distance to Frame all my Scene? Consider I have N dynamic points on my Scene, I would like to "frame" all them, with my Camera.

How can i calculate (at runtime) Vector3 Position to correctly frame all my scene ?

This is my idea:

Calculate Avarage for all my points
Move my Camera "up" / Zoom out to correctly "frame" all my points (i don't know how to calculate )
Use Unity LookAt(myAvaragePoint)

I think i've to use some trigonometryc function to calculate the Y Camera position (to zoom in, zoom out), but i don't know which!

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:
Converting cartesian geo-coordinates to isometric (real world map to game map) I need to create an automated method to convert real cartesian, geo-coordinate data (such as roads and parks), into isometric coordinates as a game map view for use in HTML5 Canvas.

Here is an image of what I mean:

Example Image

Taking into account heavy map distortion in the process to fit they isometric layout. Is this even remotely possible?

sentences:
JavaScript rendering: Canvas or DIV? I am planning on developing a multiplayer RPG (kinda like RuneScape, but don't worry, with a different gameplay) and i want to do this in the browser. Now before saying things like "A MMORPG is hard to make" or "Others tryied that too" please keep in mind that i am not dreaming at a huge game, it's just an idea that i want to see "breathing".

The reason i choose JavaScript and HTML5 over other technologies is that i have some experience in web development (which of course includes a deep understanding of JS).

I've looked over some libraries (or so called engines) on the web and i've found some that  might have what i need.

My question is: What is the best way to render this kind of game in the browser, also could you suggest me the library that you think is the most suitable for this kind of job?

sentences:
Continuous world and very large levels: going around the FPU limitations with Ogre3D I'm currently using Ogre3D, and I'm wondering is it's possible to have a very large level (hundreds of kilometers) using the right scenemanager. Storing or having the level is not a problem, since I can repeat objects in a procedural fashion, my objective is level size, not quality.

Taken from http://floatingorigin.com/mirror/continuous-world.htm :

Imagine two characters walking in formation two meters apart heading east away from the origin. At some point, the distance from each other is overwhelmed by the distance from the origin, and the characters will appear to be “at the same location”.

I'm wondering if solutions for those problem like the one described in the Dungeon Siege article are the only viable ones, and if it requires a deep engine modification or not. I'm not sure the paged scenemanagers or PCZ scenemanager reset the zero like I think.

sentences:
About tiles in games I'm trying to learn how to develop games in Unity and my base is tiled games, I would like to know if a simple tile is an image (sprite in 2D) or a game object in 3D.

Since I'm trying to do some kind of 3D tiles with interaction with the user like press to do something + an animation, I would like to know how it works.

sentences:
Creating own archive file format for levels? (.wad like) I know there are similar questions but my question but my question is about taking some files (like png spritesheets, txt data) and put them in one archive file in general.

If I'm correct then I just have to read the files then open a new file with a custom format like ".mytar" than in a specific order write the binary data of the png and txts into it.

I have to specify a header and a "separator" to know where the next file starts.

I'm asking of something like the .wad file in Doom, they contained the sprites, level data all in one.

I didn't find any good tutorial or "guide" about how to design an uncompressed archive.

I know it would be simplier to store it in a "known" file format like .tar instead of creating my own but I want to learn and develop my skills, also I would love to feel that I create that file format :)

I don't know if I'm right...and I'm begging for some help :)

(Sorry if my Englis is a bit wrong... :) )

sentences:
Making character's skills and abilities as commands, good practice? I am designing for a game that consist of characters who have unique offensive skills and other abilities such as building, repairing, etc. Players can control multiple of such characters.

I'm thinking of putting all of such skills and abilities into individual commands. A static controller would register all of these commands into a static command list. The static list would consist of all the available skills and abilities of all the characters in the game. So when a player selects one of the characters and click on a button on the UI to cast a spell or perform an ability, the View would call the static controller to fetch the desired command from the list and execute it.

What I'm not sure of however if this is a good design given that I'm building my game in Unity. I am thinking I could have made all the skills and abilities as individual components, which would then be attached to the GameObjects representing the characters in the game. Then the UI would need to hold the GameObject of the character and then execute the command.

What would be a better design and practice for a game that I am designing?

sentences:
How to create tilted (height) isometric tiles This is perhaps best explained pictorially. I am trying to create a 2.5D isometric game. My vision is for the game to look something like my goal:

I am not a graphics artist, so I'm having some trouble creating the "tilted" tiles to simulate terrain of different height. Creating the basic isometric tile was easy using the following steps:

Create a 64x64 square version of the tile
Rotate by 45 degrees
Scale the height down by a factor of 2

Creating the "tilted" tiles is more of a challenge. At my disposal I have Photoshop, but I am far from an expert at using it. Here is my current problem:

I am not sure how I can manipulate vertices, otherwise this would be easy, but basically, to get a "tilted" tile from my basic isometric tile, all I need to do is to shift the bottom and the right vertex down by 16 pixels, while fixing the other two vertices. This would generate the tile I want.

What is an easy way to accomplish this. Is Photoshop the right tool for this? Any suggestions?

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:
Cost to licence characters or ships for a game I am producing a game pitch document for a university game design class, and I am looking for examples of licencing cost for using characters or ships from other IP holders in a game. For example:

cost of using an X-Wing in a game, licencing from Lucas
cost of using the Enterprise in a game, licencing from Paramount
cost of using the Space Shuttle (if any), licencing from Nasa

EDIT

The closest information I can find is from an article about Nights of the Old Republic, but isn't nearly specific enough for my needs:

  What Kotick means by Lucas being the principal beneficiary of the
  success of The Old Republic is that there are most likely clauses in
  the license agreement that give percentages, points, or another
  denomination of revenue out to Lucas and his people just for the Star
  Wars name, and that amount is presumed to be a great deal of money.
  Kotick is saying that because the cost of the license is so
  prohibitive, as he has personally had experience with in his position
  as CEO of Activision Blizzard, that EA will not be able to be
  profitable because of the hemorrhaging of money to the licensor.

EDIT 2

Another vague source stating that FOX uses a "five-figure rule" (assuming between $10,000 -> $99,000)

  It seems FOX, like most studios, will not license individuals to
  create new works based upon their products. They will only commission
  individuals of their choosing if they elect to branch out into
  expanded product lines related to those licenses. Alternately, they
  are open to making the licencing available to large corporations with
  access to global markets, but only if those corporations agree to what
  Ms Friedman called a "five-figure guarantee". Presumably this means
  that the corporation seeking the licensing must agree to pay a
  5-figure sum for that license, and be confident that their product
  will sell enough volume to recoup that fee, and to produce sufficient
  profits to make the acquisition worth their while.

sentences:
Multiple keypresses causing wierd results in SDL I have been building a pong clone. I've been using a mixture of peoples different code to understand the way they structure their games as well as reading on game patterns. Currently I've gotten to draw a paddle on the screen and the player can move it with the keyboard no problem.

The issue comes when a player presses a button that is not 'Up' or 'Down'. For instance when the player holds the 'Up' key the paddle travels upwards, but if they simultaneously hold the 'Right' key it causes the paddle to fly downwards at a much greater speed.

My keyboard checking code is:

void GameLoop::Input(SDL_Event &ev)
{
    if (ev.type == SDL_KEYDOWN)
    {
        if (ev.key.keysym.scancode == SDL_SCANCODE_DOWN)
        {
            player1->IsMoving(true);
            player1->velocity = 10;
        }
        if (ev.key.keysym.scancode == SDL_SCANCODE_UP)
        {
            player1->IsMoving(true);
            player1->velocity = -10;
        }

    }

    else if (ev.type == SDL_KEYUP)
    {
        if (ev.key.keysym.scancode == SDL_SCANCODE_DOWN)
        {
            player1->IsMoving(false);
            player1->velocity = 0;
        }
        if (ev.key.keysym.scancode == SDL_SCANCODE_UP)
        {
            player1->IsMoving(false);
            player1->velocity = 0;
        }
    }
}

The GameLoop is ran within loop that is configured to run at 60FPS. You can see this in this code block here:

int main(int argc, char **argv){

    //Initialise the app and SDL
    App app(SDL_INIT_VIDEO);
    GameLoop game;

    double lastTime = 0.0, currentTime;

    SDL_Event e;

    while (app.isRunning())
    {
        if (SDL_PollEvent(&e))
        {
            if (e.type == SDL_QUIT)
            {
                app.exit();
            }
        }

        currentTime = SDL_GetTicks() / 1000.0;
        if (currentTime >= lastTime + 0.01666667)
        {
            game.Input(e);
            game.Update();
            game.Render();

            lastTime = currentTime;
        }

    }

    return 0;
}

This is the paddles update code:

void Paddle::Update()
{
    if(moving == true)
    {
        rect.y += velocity;
        velocity = 50;
    }

    X = rect.x;
    Y = rect.y;
}

I'm unsure of what is causing the paddle to behave so strangely. Any insight given into this problem or even just the way I've approached this problem would be appreciated.

sentences:
When would a mesh collider be better than primitive colliders I have been reading through the Unity Manual and have come across some interesting information about mesh colliders and primitive colliders. It got me wondering if using many primitive colliders would be better than using a mesh collider for say a character object?

I was also wondering if there was any information on exactly how inefficient a mesh collider is to say having 20 box or cylinder colliders on a character mesh. I am guessing that the number of polygons on the mesh would be a factor but it would be interesting to see some raw comparisons between how this efficiency scales per polygon (or per 100 polys or some unit of measurement)

sentences:
Dealing with occlusion in an isometric sandbox game Imagine a 3D sandbox game like Minecraft with third-person isometric graphics. If the camera only moves in two dimensions, and doesn't rotate, then a large portion of the world will always be occluded e.g. caves, areas behind mountains and buildings, etc. Obviously this isn't acceptable.

I'm trying to figure out how such a game could deal with this issue while preserving certain properties: the world must be entirely buildable/destructible and must extend in some manner along all three axes. Other than that, nothing is off the table.

I can't think of any simple culling algorithm that wouldn't either leave too much occluded or needlessly cull things. Which features are visible where seems to be a very high level design issue. If you are underground, you don't want to see the ground above you at all. But some small objects you probably never want culled, even when standing behind them.

And it's not at all clear what you would want to do with medium-sized objects, like buildings... perhaps make them translucent when the player walks behind them. But how would such objects be classified? And how would you distinguish the outside of the building from the inside? You probably don't want the inside of buildings to become visible when you walk behind them.

If the player can place objects anywhere, what happens if they place an object behind an occluder? Is it now impossible to interact with this object without destroying the thing in front of it, even when the player is standing right next to it? What about important features on back-facing surfaces? Are they never rendered at all?

It seems to me that isometry is just not capable of practically representing arbitrary three dimensional architecture, which suggests that the game needs to be designed in such a way that arbitrary architecture can't be built. Rather, it needs to be constrained to some kind of 2.5D model, where occluded things simply cannot exist. But how could a world like that feel consistent and logical to the player while they dig and build in it?

sentences:
What kind of questions should I ask players in a survey after the game? I'm finishing a HTML5 browser game, and I'd like to have some player feedback. I was planning to make players take a short survey at the end of the game. Is this the best approach? How long should it be? Should I just let them write about the game instead of answer questions?

What are good questions to ask and how?

For example, do I let them write about physics, do I let them just choose "GOOD" or "BAD" or do I have a scale from 1 to 10?

sentences:
Tracking Object Position - Firing on a Trajectory How can I calculate the position of an object after "firing" it from a fixed point?

I am to create a small game - most likely with canvas (pure HTML, JS based) or Adobe Flash - in which the player fires objects at other obstacles in order to clear them.

sentences:
Determine if 2D-projected point is visible I render a model and do have various 3D points around the surface of it. Because it's easier and I'm already using D2D for UI rendering, I implemented it so that these points are rendered as 2D points onto the screen.

The thing is that of course not all points are always visible. I'd like to test that and only show these which are actually seen by the camera.

Is there any way besides rendering them in Direct3D or reading the depth-buffer CPU-side to test it?

sentences:
How to scale a sprite with its center as origin? I'm trying to zoom-in a sprite gradually from 0% to 100% (a sprite called SelectionBox), so it zooms from the middle of the sprite, not from the upper-left corner. I'm almost there, but I'm having problems with the sprite origin - it's not positioning it in the spot I told it to.

What's wrong with this code?

SpritePosition_FirstBox = New Vector2(15, 50)
MiddleOrigin = New Vector2(CSng(Texture_SelectionBox.Width / 2), CSng(Texture_SelectionBox.Height / 2))

spriteBatch.Draw(Texture_SelectionBox, SpritePosition_FirstBox, Nothing, Color.White, 0, MiddleOrigin, ScaleValue, SpriteEffects.None, 0.94)

sentences:
iPhone image asset recommended resolution/dpi/format I'm learning iPhone development and a friend will be doing the graphics/animation. I'll be using cocos2d most likely (if that matters).

My friend wants to get started on the graphics, and I don't know what image resolution or dpi or formats are recommended.

This probably depends on if something is a background vs. a small character.

Also, I know I read something about using @2x in image file names to support high res iphone screens. Does cocos2d prefer a different way? Or is this not something to worry about at this point?

What should I know before they start working on the graphics?

sentences:
How to design game server to mitigate DDOS attacks I'm in the design phase of a turn based game with low load on the server (<1 message every 10 seconds per user, <50'000 users at a time). The game is multi-platform.

The protocol has not been decided yet.

How can I mitigate DDoS attacks against such a server by design?

sentences:
adapting a Unity gravitational script to allow moons I'm using this script: http://wiki.unity3d.com/index.php/Simple_planetary_orbits

to get a solar system going in Unity, but it doesn't seem to support creating bodies that orbit other moving bodies (or I am using it incorrectly).

Any idea about how to modify it so that it does (or just use it correctly)? I've been beating my head against this problem for a couple hours, and I really don't feel like I have any idea what I'm doing.

Thanks in advance.

sentences:
How can I use one keycode key as toggle switch for two cameras? using System;
using UnityEngine;
using UnityEngine.UI;
using Cinemachine;

public class CameraSwitch : MonoBehaviour
{
    public CinemachineVirtualCamera vcam;
    public CinemachineFreeLook fcam;

    private void Update()
    {
        if(Input.GetKeyDown(KeyCode.V))
        {
            fcam.enabled = false;
            vcam.enabled = true;
        }
    }
}

When pressing on the V key it's switching between the cameras. I want that if I will press on the V key again it will switch between the two camera back fcam to be true and vcam to be false and so on each time pressing on the V key to switch between the cameras.

sentences:
How can I create tiles that scale to multiple resolutions? I am trying to create a multiplayer version of the popular Flash game N in Java. However, I'm not sure how to create a tileset that will scale up. Are the tiles for N pre-drawn or are they defined with mathamatical formulas in code?

I do see how they would scale up in Flash if they were pre-rendered. So if anyone has any ideas how I should go about creating the tileset, or how they are created in the game please let me know.

You can check out the game here.

sentences:
Why aren't ModLoader's decompiled files showing up? I want to start making a Minecraft 1.6.4 mod, but have this trouble with ModLoader:

I've run the decompile.bat batch file, but when opening the eclipse folder, the bin folder is empty. The batch file ran fine with no errors, and /src/minecraft/net/minecraft contains many decompiled java files, but no modloader files like BaseMod.java.

If I open this folder with Eclipse, the package explorer menu stays empty.

What's happening here?

sentences:
OpenGL clipping plane I need to move  clipping plane of OpenGL and begin the clipping from that position.
The default location of clipping plane is (0,0,0), so if my model is far enough from the center of coordinate system it immediately disappears, as I begin the clipping, cause it appears in the half clipped by the plane that just moved from (0,0,0) point. So what I need is :

Create a clipping plane
Translate it to the point I want (normally it's near model surface I want to clip)
Begin the clipping from that point and not from (0,0,0).

How can I achieve my goal ?

sentences: MonoGame for iOS - getting started I can't find any clear directions on how to get started. I only see a Windows installer for MonoGame but what little documentation I've found seems to say you install it on the Mac and do the work there. If someone could simply tell me which parts go where that would be a big help.

sentences:
Idle+Walk animation problem and double-button input axes I have 2 problems with unity3d.

First, I created an animator and attached it to player. In animator I put 2 condition, Speed and Running (first is float, second is boolean). Default Animation is Idle. Then player press W, I want animation to fade from idle to walk and when he stop press the button, I want the animation to fade from walk to idle. Here is my problem.

When I press W, he make walk animation, but after it he play half of idle animation and after it he enter again in walk animation. How can I loop the walk animation until he release W? And if he release, even if the animation isn't totally played, I need the animator to make transition to idle.
How can I make this "transition"? Then I release W, he just go from walk to idle animation without any transition (and it is a kind of wear).

Second, How can I put 2 input buttons on axes? I mean: If he press W, there should go vertical axes. When he press W+Left Shift, there should go running axes. How can I attach 2 buttons to 1 axes?

I am new in unity and I want to figure out how to work with this things.

sentences:
One big Instance or One instance for every moving entity? I am creating a multiplayer JavaScript game with a PHP central server. Each user will be able to move around in a 3D world, with other users and NPCs. These NPCs will be controlled by the central server in PHP. Should I create one big world simulation PHP file that simulates all the NPCs in turn or a smaller controller that will be ran for each active NPC (on its own thread)? Each NPC has its own row on an SQL table and will be retrieved by the client to determine its position, state, etc.

Note: This is my first time creating a networked game, so if there is anything that I can do better, or a unique way of doing things that could work for this, feel free to comment

sentences:
Can I legally remove the default Unity splash screen by removing it from the APK? While using Unity I export an Android game as an APK. When the APK is run, the first thing that is displayed is the Unity splash screen. I worked out that I could replaced that image by opening the APK like a zip file, looking for the splash screen image  (App.apk/assests/bin/Data/splash.png) and replacing it with any image I wanted.

Is it legal to publish Unity-powered Android game apps with modified splash screens like this? I remember that some games on PS3, 360 and Wii have been created with Unity but don't display a Unity splash screen when run on their respective consoles.

sentences:
How to change the pivot in Unity? I have a cube created in Unity scaled 5 times. The pivot of the cube is by default in center.

I would like to change the pivot to the one of the vertices.

How to do that ?

sentences:
WebGL transparent gradient mask at edge I need to make a feature in WebGL, where I have horizontal list of meshes (example 20) and I want to show only 3 and 2 at edge are fade in/fade out. And it slowly animates from one side no another (sliding to left or right).

Here is a sample code, how it is done using CSS. (https://jsfiddle.net/jqsLh4vg/91/)
What would be possible options to have this kind of effect?

My current approach, what I am trying (could be not the most perfomant solution):

Calculate visible area
Calculate how much visible area (in percentage) each mesh is visible in visible area on each render

Draw gradient using frag shader at the edges (here it is were I stucked and can't figure out the solution)

But maybe there is easier approach for this kind of effect? (Image if I have 100 elements and I need to manually calculate their visible area on each render time).

sentences:
Unity, Replace or modify camera with own script I am making an RTS game which has a slowdown when many units are on screen at once. I have a plan to write my own camera script to speed this up.

Since I have an efficient way to find where units are without the raycast, I want to write scripts to replace the camera and check raycasts against only the few objects that my scripts will identify as in the correct area for that raycast?

Alternatively is is possible to have the camera ignore certain entities on one part of the screen, and then a different set on another part of the screen?

--Edit--
I am very grateful for people helping in anyway, but I wanted to know if this Could be done even if in my case it shouldn't be.

sentences:
How to create a 2D Polygon Sprite from prefab at runtime? At start of my 2D unity game I want to create a new "building" (at random).
So I created a prefab named "Building" from a polygon sprite. Then I created a "Empty Game Object" named "GameManager" with a script named "GameManager" attached to it. The script looks like this:
public class GameManager : MonoBehaviour
{
    public GameObject Building;
    // Start is called before the first frame update
    void Start()
    {
        var createdBuilding = Instantiate(Building, new Vector3(0, 0, 0), Quaternion.identity);
        var sprite = createdBuilding.GetComponent<SpriteRenderer>().sprite;
        Vector2[] geometry = new Vector2[6];
        geometry[0] = new Vector2(0,0);
        geometry[1] = new Vector2(0,20);
        geometry[2] = new Vector2(20,20);
        geometry[3] = new Vector2(27,20);
        geometry[4] = new Vector2(29,29);
        geometry[5] = new Vector2(16,0);
        sprite.OverrideGeometry(geometry, sprite.triangles);
    }
}

The hardcoded position values are just for testing purporses. The plan is to create multible buildings but first I have to get unity to show at least one of them.
Afterwards I attached the prefab "Building" to the variable "Building" via the inspector.
But when I ran the game the sprite is shown as a Pentagon, regardless what I write into the "geometry"-Array.
So why I cant change the geometry? And is this even the right way to create buildings at startup?

sentences:
Unity3D GUI - what exactly it does when create controls and check their statuses? On unity3d website in the manual on this page: http://unity3d.com/support/documentation/Components/gui-Controls.html

I found an example of "GUI.changed" function usage(below). And it looks like it creates toolbar object on every frame. Am I right or not?

/* GUI.changed example */

// JavaScript
private var selectedToolbar : int = 0;
private var toolbarStrings = ["One", "Two"];

function OnGUI () {
    // Determine which button is active, whether it was clicked this frame or not
    selectedToolbar = GUI.Toolbar (Rect (50, 10, Screen.width - 100, 30), selectedToolbar, toolbarStrings);

    // If the user clicked a new Toolbar button this frame, we'll process their input
    if (GUI.changed)
    {
        print ("The toolbar was clicked");

        if (selectedToolbar == 0)
        {
            print ("First button was clicked");
        }
        else
        {
            print ("Second button was clicked");
        }
    }
}

sentences:
How does the following code generate a full screen quad? How does this

struct Output
{
    float4 position_cs : SV_POSITION;
    float2 texcoord : TEXCOORD;
};

Output main(uint id: SV_VertexID)
{
    Output output;
    output.texcoord = float2((id << 1) & 2, id & 2);
    output.position_cs = float4(output.texcoord * float2(2, -2) + float2(-1, 1), 0, 1);
    return output;
}

and this

pImmediateContext->VSSetShader(fxaaVS, ..., ...);
pImmediateContext->IASetPrimitiveTopology(D3D11_PRIMITIVE_TOPOLOGY_TRIANGLELIST);
pImmediateContext->Draw(3, 0);

generate a Full Screen Quad?

It has only three vertices b(provided quad has 4 vertices)
the positions produced are also not like a (half of a) quad.

Looking at this, i might be confused between a quad and a full screen triangle.

sentences:
How do I get an instance of KX_PolygonMaterial in Blender? I've got a question concerning using Python in Blender's Game Engine.

Before I start I want to state that I'm trying to change the color of an object in Blender's game engine. To do this, I'm attempting to find a way to update the texture of the object (I basically want two or three states, red, (yellow), green).

What I'm doing right now is:

scene = GameLogic.getCurrentScene();
pingMeter = scene.objects['Ping Meter'];
mesh = pingMeter.meshes;
materials = mesh[0].materials;
material = materials[0];

However, when I do print(material.__class__.__name__) it outputs KX_BlenderMaterial. Shouldn't I be getting KX_PolygonMaterial if I'm running the Blender Game Engine? Is there anyway to change color or texture with KX_BlenderMaterial because I can't find anything in the documentation. Can I get an instance of KX_PolygonMaterial out of the code above?

...or should I just take a different approach all together?

Thanks!

EDIT: I'm using Blender 2.65 which uses Python 3 in case anyone is wondering.

sentences: Are there 3x3 matrices in DirectX 11? I have a parameter in HLSL shader in a constant buffer which is a float3x3. Is there is 3x3 matrix struct in Directx 11 or should I use 4x4 matrix instead, and if so, how?

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:
How do I smooth out latency jitter in my netcode? I'm developing a multiplayer game and I'm following some articles I've found online to create an authoritative client-server model.

Reading this article, Valve says that every time a message is received, the client assumes the "current" time is the time in the latest packet, in the article they state it:

  It is assumed in this paper that the client clock is directly synchronized to the server clock modulo the latency of the connection. In other words, the server sends the client, in each update, the value of the server's clock and the client adopts that value as its clock. Thus, the server and client clocks will always be matched, with the client running the same timing somewhat in the past (the amount in the past is equal to the client's current latency). Smoothing out discrepancies in the client clock can be solved in various ways.

And interpolation of remote entities:

  Each update contains the server time stamp for when it was generated
  From the current client time, the client computes a target time by subtracting the interpolation time delta (100 ms)
  If the target time is in between the timestamp of the last update and the one before that, then those timestamps determine what fraction of the time gap has passed.
  This fraction is used to interpolate any values (e.g., position and angles).

Now obviously due to jitter, my interpolation looks terrible as I will receive time + latency jitter. So my question is, is on this part: "Smoothing out discrepancies in the client clock can be solved in various ways."

What would be a good way to smooth out any discrepancies?

sentences:
Am I experiencing a gimbal lock problem when rotating my cube? So I'm trying to build a simple mechanic where the player see's 3 sides of a cube at a time: top, left and front(I called the front-side "Right" in my code, due to the orthographic view). The player can click on the front side or left side of the cube to rotate the cube so that the side that was pressed moves and becomes the top face. I want to smooth/animate the rotation.

The red faces are the faces that the user can click on.

My Logic seems to work quite well when I click on the left face (Rotating along the x axis), but doesn't seem to work well for the front/right face(It usually works once and then does weird stuff on the next click, this is on the z-axis)

public class CubeRotator : MonoBehaviour
{
    private const float STOP_THRESHHOLD = 0.1f;
    private const float ROTATE_AMOUNT = 90f;

    [SerializeField, Header("Touch Quads Colliders")]
    private Collider touchQuadLeft;
    [SerializeField]
    private Collider touchQuadRight;

    [SerializeField, Space(10)]
    private float timeToRotate;

    private bool mustRotateLeft = false;
    private bool mustRotateRight = false;

    private float targetX = 0.0f;
    private float targetZ = 0.0f;

    private float xVelocity = 0.0F;
    private float zVelocity = 0.0F;

    int layerMask;

    private void Start()
    {
        layerMask = LayerMask.GetMask("Touch Quad");
    }

    void Update()
    {
        ListenForTouch();
        RotateCube();
    }

    private void ListenForTouch()
    {
        if (Input.GetMouseButtonDown(0))
        {
            Vector2 touchPoint = Input.mousePosition;
            RaycastHit rayCastHit;
            Ray ray = Camera.main.ScreenPointToRay(touchPoint);

            if (Physics.Raycast(ray, out rayCastHit, 150f, layerMask))
            {
                if (rayCastHit.collider == touchQuadLeft)
                {
                    mustRotateLeft = true;
                    targetZ = targetZ - ROTATE_AMOUNT;
                    zVelocity = 0f;
                }

                else if (rayCastHit.collider == touchQuadRight)
                {
                    mustRotateRight = true;
                    targetX = targetX + 90f;
                    xVelocity = 0f;
                }
            }
        }
    }

    private void RotateCube()
    {
        float zAngle = transform.rotation.eulerAngles.z;
        float xAngle = transform.rotation.eulerAngles.x;

        if (mustRotateLeft)
        {
            zAngle = Mathf.SmoothDampAngle(zAngle, targetZ, ref zVelocity, timeToRotate);

            if (Mathf.Abs(zVelocity) <= STOP_THRESHHOLD)
            {
                mustRotateLeft = false;
            }
        }

        if (mustRotateRight)
        {
            xAngle = Mathf.SmoothDampAngle(xAngle, targetX, ref xVelocity, timeToRotate);

            if (Mathf.Abs(xVelocity) <= STOP_THRESHHOLD)
            {
                mustRotateRight = false;
            }
        }

        transform.rotation = Quaternion.Euler(xAngle, 0f, zAngle);
    }
}

Inspector Values:

I've tried several things, the only problem I can think of is, gimbal lock. Thanks in advance.

sentences:
How can I kill a libGDX AsyncTask immediately? Is there any way of killing a running AsyncTask immediately in libGDX?

The AsyncExecutor that submits it seems to just have one method (dispose()) that kills all the AsyncTasks that it handles after they've all managed to complete their runs.

Currently, to achieve what I want, I use a volatile boolean in the task class, loop on its value in the call() method of the same class, and then set it to false whenever I want to interrupt that specific task immediately.

I wonder though whether there's another, more direct, way of achieving this. Is there any other class or method responsible for this?

sentences:
Detect which monitor an SDL window uses I have some SDL code that, before creating a Window and a Renderer, detects the display DPI using SDL_GetDisplayDPI, to properly scale textures late on for different types of monitors (for instance my MacBook Pro's monitor returns a DPI of 258, while my external Dell monitor returns 93).

When I use 2 monitors, SDL_GetNumVideoDisplays properly returns 2, but I couldn't find any function in SDL that would get me which monitor the window is running in, to call SDL_GetDisplayDPI with the correct index, nor any way to detect when the window is dragged from one monitor to the other.

Is there a way to do those things in SDL, or is there a tutorial somewhere that would explain how to do that (hopefully in a platform-independent way)?

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:
Delta Time in Videos When playing a Video in my OpenGL Game (e.g. startup video), I want to sync it with my delta time. What is the delta time and how to use here.

Do I need to sync with the delta time (and how?) or is there another way to sync my video? I'm using my own video file reader.

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:
Binding Lua Function to Perform tasks using std::async I am trying to load a bunch of mesh resources in the format of .obj files. Some of the files are very high in poly count so when loading using the below method It takes more than 10 seconds. I would really like to cut this time down.
My question is how can I bind this to call loadMesh with std::async? Because I think that might help speed up the process.
Mesh *Loader::loadMesh(const std::string &path)
{
    std::shared_ptr<Mesh> mesh = Mesh::load(path);

    m_meshes.push_back(mesh);

    return m_meshes.back().get();
}

.
.
.

//this is the binding
    luabind::module(m_world->getLua()->get())
    [
        luabind::class_<Loader>("world")
            .def("load_mesh", &Loader::loadMesh)
    ]

sentences:
GLSL to Cg: why is the effect different? With reference to this question, where I was trying to make the shader compile, I am now trying to make an effect appear.
The effect can be shown here, through a GLSL shader:

But when I use the equivalent Cg shader, the result becomes this:

Using the same images (color map + normal map) and the same code (except the way to retrieve variables).

Here is the original GLSL shader;

uniform sampler2D color_texture;
uniform sampler2D normal_texture;

void main() {
    // Extract the normal from the normal map
vec3 normal = normalize(texture2D(normal_texture, gl_TexCoord[0].st).rgb * 2.0 - 1.0);

// Determine where the light is positioned (this can be set however you like)
vec3 light_pos = normalize(vec3(1.0, 1.0, 1.5));

// Calculate the lighting diffuse value
float diffuse = max(dot(normal, light_pos), 0.0);

vec3 color = diffuse * texture2D(color_texture, gl_TexCoord[0].st).rgb;

// Set the output color of our current pixel
gl_FragColor = vec4(color, 1.0);
}

And here is the Cg shader I wrote;

struct fsOutput {
    float4 color : COLOR;
};

uniform sampler2D color_texture : TEXUNIT0;
uniform sampler2D normal_texture : TEXUNIT1;

fsOutput FS_Main(float2 colorCoords : TEXCOORD0,
            float2 normalCoords: TEXCOORD1)
{

    fsOutput fragm;

    float4 anorm = tex2D(normal_texture, normalCoords);
    float3 normal = normalize(anorm.rgb * 2.0f - 1.0f);
    float3 light_pos = normalize(float3(1.0f, 1.0f, 1.5f));
    float diffuse = max(dot(normal, light_pos), 0.0);
    float3 color = diffuse * tex2D(color_texture, colorCoords).rgb;
    fragm.color = float4(color,1.0f);
    return fragm;
}

Please let me know if something needs to be changed in order to obtain the effect, or if you need the C++ code.

sentences:
Spawning units in a world made by Perlin noise? There's some issues that I've come across in my Perlin noise-based game. Take a look at the attached screenshot below.

The white areas you see are walls, and the black areas are walkable. The triangle in the middle is the player.

I've implemented physics in this game by drawing it onto a texture (white or black pixels), and then getting that from the CPU.

However, now I stand with a different problem at hand. I want units (or creeps, whatever you call them) to spawn constantly, at the edge of the screen. The point here is that in the final game, there will be a "fog of war" that doesn't allow the player to see that far anyway.

I figured that I could just scan the pixels at the edge of the screen and see if their physics texture is black, and then spawn stuff randomly there. However, if you take a second look at the screenshot, there is (in the upper-left corner) an example of where I wouldn't want the creeps to spawn (since they wouldn't be able to reach the player from there).

Is it possible to somehow have the GPU determine these spawn-spots for me, or some different way? I thought about making vectors between the proposed point at the edge of the screen and the player, and then following it every 10 voxels, and see if a wall collides, before spawning a unit there.

However, the above proposed solution may be too CPU intensive.

Any suggestions on this matter?

Note 1
For the units spawned, I do not want to be using any form of pathfinding to avoid wall collisions as these units run towards the player. Therefore, the units must spawn at the edge of the screen, at a location where walking in a straight line towards the player would not collide with any walls.

sentences:
How to create a linear plateform between two points? I have a set of 2D coordinates. Their positions are regular on the X axis, but unpredictable on the Y axis:

I would like to create slim platform between each point in order tu use it as ground for my game, expecting a result like this:

I'm working with Box2D, so I thought about create boxes like this:

float x1, y1, x2, y2; // Coordinates between two points
float centerX, centerY;
float differenceX, differenceY;
float width;
b2BodyDef bodyDef;
b2Body* body;
b2PolygonShape shape;

centerX = (x1 + x2) / 2.0;
centerY = (y1 + y2) / 2.0;
differenceX = x2 - x1;
differenceY = y2 - y1;
width = sqrtf(differenceX * differenceX + differenceY * differenceY);
height = 10.0f

bodyDef.position.Set(centerX, centerY);
bodyDef.angle = -M_PI / 4.0f * width / height
body = world.CreateBody(&bodyDef);
shape.SetAsBox(width, 10.0f);
body->CreateFixture(&box, 0.0f);

But the wrong part of this code seems to be on angle. I cannot find the correct rotation between two points from their coordinates.

Is there a correct math formula to find it?
Or am I simply wrong to use rectangular boxes to trace it, and should I use something else? Like a b2PolygonShape?

sentences: Learning to think like a programmer I'm pretty interested in game development and I've tried a couple of platforms and languages. Including libgdx and game maker studio, all without any real success. I'm currently using unity and it's the farthest I have ever gotten, but it just doesn't feel right. I follow tutorials and learn how to do certain things, but it just feels like I'm a parrot learning a new word I don't really understand what I'm doing just kind of memorizing stuff. I'm trying to become a good game developer, but I just don't know how to practice c# in a way where I will gain actual understanding and not just memorize a bunch of syntax. Thanks in advance I really need help.

sentences:
Top down tile based game render order I'm making a simple top down (like this) tile based game (using JavaScript, for reference)

I use Tiled for making maps. I have sprites that are more than one tile high, and so whenever they are in front or behind of some objects more than one tile high tiles will be displayed in front of the player. I am looking for a way to give certain tiles 'height' such that only characters of that height could appear in front of those tiles.

Here is a screenshot showing my problem (the sprite is doge because it was the first image I found):

The same tiles don't always equate to the same height, so I can't give tiles set height. I've thought of one way to give tiles height, and that is to have a (hidden) layer that describes the height level certain tiles are at.

However, that solution would be slow and painful to implement. I'm wondering if there's a better way to do it.

A few other potential ideas I've had: Have a tile layer for each height, hackily guess the height of a tile at runtime based on tiles below (would be buggy) but I think that there would surely be a better way to do it.

sentences:
Need some help with Unity 2d animation controller So my animations don't transition right. I have a 2d top down prototype project and animations for 4 directional movement and an idle position. Right now i have the movement set up so the right animation activates when the player moves in one of 4 directions. problem is that the walking animation does not stop when the player stops, it doesn't transition over to the idle animation.

My animation controller looks like this:

The parameter between the animations are an integer that signals which direction needs to play, from 0 to 3. I have been messing around with a speed float parameter, but I don't really know how to get it to work.

if (Input.GetKey (KeyCode.D))
        {
            GetComponent<Rigidbody2D>().velocity = new Vector2(moveSpeed,GetComponent<Rigidbody2D>().velocity.y);
            animator.SetInteger("Direction", 2);
            animator.SetFloat("MoveSpeed", 0);
        }

        if (Input.GetKey(KeyCode.A))
        {
            GetComponent<Rigidbody2D>().velocity = new Vector2(-moveSpeed, GetComponent<Rigidbody2D>().velocity.y);
            animator.SetInteger("Direction", 0);
            animator.SetFloat("MoveSpeed", 0);
        }

        if (Input.GetKey(KeyCode.W))
        {
            GetComponent<Rigidbody2D>().velocity = new Vector2(GetComponent<Rigidbody2D>().velocity.x, moveSpeed);
            animator.SetInteger("Direction", 1);
            animator.SetFloat("MoveSpeed", 0);
        }

        if (Input.GetKey(KeyCode.S))
        {
            GetComponent<Rigidbody2D>().velocity = new Vector2(GetComponent<Rigidbody2D>().velocity.x, -moveSpeed);
            animator.SetInteger("Direction", 3);
            animator.SetFloat("MoveSpeed", 0);
        }

Here is my movement code if it helps.

If I'm missing something important that you need to help me, please tell me.

sentences:
Unity Raycasting Error: NullReferenceException EDIT: I added the if statement:
if(hitInfo.collider != null)

above the
if(hitInfo.collider.CompareTag("Player"))

statement and it seems to work.

I'm trying to give my Enemy AI (Red dude) a line of sight via Raycasting. I want it to initiate the Attack(); function when it sees the Player (blue dude) whose tag is "Player".
I first need to get a "true" statement from the RaycastHit2D to write the rest but the game just crashes whenever the Player is out of the ray. When I put the player in range of the enemy model by hand before running the game, it runs okay:

But when I make something, like jumping, to stay out of the ray, the game crashes and I get the error:

NullReferenceException: Object reference not set to an instance of an object.

It shows the line 90 which corresponds to the line:
if(hitInfo.collider.CompareTag("Player"))

Here is the whole code for my RaycastPlayerDetection() which is called in the Update() function:
 private bool RaycastPlayerDetection()
{
    RaycastHit2D hitInfo = Physics2D.Raycast(EyeSight.position, transform.right, lineOfSight);

        Debug.DrawLine(EyeSight.position, hitInfo.point, Color.red);

        if(hitInfo.collider.CompareTag("Player"))
        {
        Debug.Log("player has been seen");
        return true;
        }
        else return false;

}

sentences:
Skeletal animation in OpenGL I'm using Assimp to do skeletal animation in my OpenGL application.

I used Blender to export this one-boned model to a COLLADA file:

The model has only one bone, called arm bone, that controls the arm mesh. All the other meshes are static.

I made several structures and classes that help me play animations.
All the nodes are added to an std::vector of Node objects. each Node contains aiNode data and a toRoot matrix.
The bone hierarchy is encapsulated in a Skeleton class, and the animation matrix (T * R) are updated for each bone in a class called Animation.

My Model::Draw() function is this:

void Model::draw()
{
    //iterate through all animation sets. if the animation is running, update the bones it affects.
    for(size_t i = 0; i < _animations.size(); i++)
        if(_animations[i].running())
            _animations[i].updateAnimationMatrices(&_skeleton);

    //calculate Bone::finalMatrix for each bone
    _skeleton.calculateFinalMatrices(_skeleton.rootBone());

    //iterate through the nodes and draw their meshes.
    for(size_t i = 0; i < _nodes.size(); i++)
    {
        _shaderProgram.setUniform("ModelMatrix", _nodes[i].toRoot());

        _nodes[i].draw();
    }
}

To get the "animationMatrix" for each bone (the TR matrix) I call Animation::updateAnimationMatrices().
Here's what it looks like:

void Animation::updateAnimationMatrices(Skeleton *_skeleton)
{
    double time = ((double)_timer.elapsed() / 1000.0);
    while(time >= _animation->mDuration) time -= _animation->mDuration;

    //iterate through aiNodeAnim (called channels) and update their corresponding Bone.
    for(unsigned int iChannel = 0; iChannel < _animation->mNumChannels; iChannel++)
    {
        aiNodeAnim *channel = _animation->mChannels[iChannel];
        Bone *bone = _skeleton->getBoneByName(channel->mNodeName.C_Str(), _skeleton->rootBone());

        //rotation
        glm::mat4 R = ... //calculate rotation matrix based on time

        //translation
        glm::mat4 T = ... //calculate translation matrix based on time

        //set animation matrix for the bone
        bone->animationMatrix = T * R;
        bone->needsUpdate = true;
    }
}

Now in order to calculate the "finalMatrix" for each bone (based on animationMatrix, offsetMatrix etc..), and upload it to the vertex shader, I call Skeleton::calculateFinalMatrices().

void Skeleton::calculateFinalMatrices(Bone *root)
{
    if(root)
    {
        Node *node = _getNodeByName(root->name->C_Str());
        if(node == nullptr) {
            std::cout << "could not find corresponding node for bone: " << root->name->C_Str() << "\n";
            return;
        }

        if(root->needsUpdate) //update only the bones that need to be updated (their animationMatrix has been changed)
        {
            root->finalMatrix = root->animationMatrix * root->offsetMatrix;

            //upload the bone matrix to the shader. the array is defined as "uniform mat4 Bones[64];"
            {
                std::string str = "Bones[";

                char buf[4] = {0};
                _itoa_s(root->index, buf, 10);

                str += buf;
                str += "]";

                _shaderProgram->setUniform(str.c_str(), root->finalMatrix);
            }

            root->needsUpdate = false;
        }

        for(unsigned int i = 0; i < root->numChildren; i++)
            calculateFinalMatrices(root->children[i]);
    }
}

Here's my bone structure, if it helps.

My glsl vertex shader is pretty standard. Here it is.

And finally, here's the result I get: (ignore the model's static legs. that must be some bug in the Blender exporter).

And here's the result I should get: (using a 3d party software)

It looks like there's something wrong with the bone's matrix calculation, although I don't know what. Any ideas or tips?

Thanks!

sentences:
Adding an angle variance to a 3d vector I am converting a particle emitter from 2d to 3d.

In the 2d system the original coder used a random angle variance and added it to the angle.  So it would be something like:

thisAngle = emitterAngle + angleVariance * RANDOM_MINUS_1_TO_1();

I want to do the same thing in 3d using an emission vector (vec3) and again an angleVariance.  My specific variance for this particle will still be angleVariance * RANDOM_MINUS_1_TO_1().  But how do I apply that angle a 3d vector so that the new vector could be any value X degrees off of center.  So if the original vector is straight up (0,1,0) the new vector could be off in the X or the Z and still normalized to 1.

Any hints?  I have all the matrix and vector functions at my disposal.

=====

Thanks to nathan I was able to write this code. Not sure if I've over complicated it somewhere. Once I test it I'll checkmark his answer:

    // first pick a random Z from [cos(angleVariance), 1]
    GLfloat varianceZ = [self randomFloatBetween:myCosf(angleVariance) andLargerFloat:1.0];
    // and a random angle for the azimuth
    GLfloat rndA = [self randomFloatBetween:0.0 andLargerFloat:360.0];

    // then calculate the X & Y to make this a vector off of the +Z axis with a max width of angleVariance
    GLfloat varianceX = sqrt(1 - varianceZ*varianceZ) * myCosf(rndA); // my functions input degrees not radians
    GLfloat varianceY = sqrt(1 - varianceZ*varianceZ) * mySinf(rndA);

Up to here the above code works.  It makes a variance angle off center but it is aligned to the +z axis.  The next part is supposed to rotate/transform the angle to my emissionVector angle so it's a variance off of that.  But so far this part isn't working.

    // next find an axis to rotate the point around to put it in line with the emmissionVector
    vec3 rotationAxis = normalizeVec3(crossProduct(vec3Make(0.0, 0.0, 1.0), emissionVector));
    GLfloat rotationAngle = acos(degreesToRadians(emissionVector.z));

    // make a quaternion out of the rotation axis and angle
    vec4 q = quaternionVector(rotationAxis, rotationAngle);
    // turn the quaternion into a matrix
    mat4 rotMat4;
    mat3 rotMat3;
    matrixQuaternion(q, rotMat4);
    getMat3FromMat4(rotMat4, rotMat3);
    // multiply the variance vector by the matrix to get a resulting vector with the variance added
    vector = matrixTransformVec3(rotMat3, vec3Make(varianceX, varianceY, varianceZ));

=====

The above code doesn't appear to be correct. I'm still working on the solution and will fix the above code when I get it working.

sentences:
Importing materials from blender to UE4 So my problem is that I have a nice green glass material in blender which I imported to UE4 (4.8.1) but in the editor the material was just a simple green colour.

I have no idea what I should do to fix this problem.

I appreciate any help. If you need any more details or pictures, let me know.

Thank you

Glass in blender:

Material in blender:

Glass in UE4:

Material in UE4:

sentences:
How to implement rotating Earth effect in 2D? I've modeled a photorealistic scene of the Earth rotating in 3DS Max and would like to use it as a backdrop of a menu screen in a 2D game. What would be the appropriate way to implement this effect in-game, a sprite sheet? That seems like it would require a whole mess of frames to appear convincing. Does that matter?

What if I then wanted to add the moon orbiting the Earth? A second sprite sheet for the moon's positions, with blank frames where it should be hidden behind the Earth?

Is there a better method?

sentences:
SV_POSITION in pixel shader What are the uses for SV_POSITION in the pixel shader?  Previously this was the POSITION semantic and it wasn't readable in the pixel shader, but now that it is, what can it be used for?

In an SM2 deferred renderer, you'd typically take the texture coordinates, transform them to the [-1, 1] range and then use an inverse view/position matrix to get the world position of a pixel.  Would SV_POSITION be usable here to reduce any of the calculations?  And if so, how would you do that?

sentences:
What are constraints and how are they pluggable? I have been reading this book called "Game Physics Engine Development" and Came across this image in the context of Collision Resolution.

See the contact Generator part. Can someone tell me what are constraints and how there can be different types of them? Thank you.

sentences:
GLUT Window not responding I'm trying to calculate the delta time of my program. In main, I call:

glutInit(&argc, argv);

glutInitDisplayMode(GLUT_SINGLE | GLUT_RGB);

glutInitWindowSize(250, 250);
glutInitWindowPosition(100, 100);

glutCreateWindow("OpenGL Renderer");

InitGL();

glutDisplayFunc(DrawGLScene);
glutReshapeFunc(ReSizeGLScene);
glutIdleFunc(idle);

glutMainLoop();

My idle func:

void idle(void)
{
    int time;
    time = glutGet(GLUT_ELAPSED_TIME);
    delta = time - lastTime;
    lastTime = time;
    glutPostRedisplay();
}

I have these global variables:

int lastTime;
int delta;
float rtri; //Angle for triangle
float rquad; // Angle for quad

In the render method, I call:

// ...
glRotatef(rtri, 0.0f, 1.0f, 0.0f);
// ...
rtri += 0.2f * delta;
rquad -= 0.15f * delta;

Whith this code, I can't resize the window and if I press the close button, the window isn't responding anymore.

How can I fix this?

sentences:
How do I draw video frames onto the screen permanently using XNA? I have an app that plays back a video and draws the video onto the screen at a moving position. When I run the app, the video moves around the screen as it plays. Here is my Draw method...

    protected override void Draw(GameTime gameTime)
    {
        Texture2D videoTexture = null;

        if (player.State != MediaState.Stopped)
            videoTexture = player.GetTexture();

        if (videoTexture != null)
        {
            spriteBatch.Begin();
            spriteBatch.Draw(
                    videoTexture,
                    new Rectangle(x++, 0, 400, 300),  /* Where X is a class member */
                    Color.White);
            spriteBatch.End();
        }

        base.Draw(gameTime);
    }

The video moves horizontally acros the screen. This is not exactly as I expected since I have no lines of code that clear the screen. My question is why does it not leave a trail behind?

Also, how would I make it leave a trail behind?

sentences:
3D Paint tool in Maya Hey everyone, could someone help me out on this question?
When I am trying to texture objects in maya (for example a barrel) I want to texture it with a brush. When I try to use the 3D painting tool it al gets black even when I have a image file selected. Also the resolution is very very low of the models and textures in maya, though the texture image is very high quality. Can someone please help me? Thanks so much for helping.

sentences:
How do I make a message based communication system between objects? Just as I was told here, I need to make some kind of communication between objects in my game. Mainly, for achievements. How do I do this? My idea was to make every object have an array attached to itself called "messages", and then, when something happens, a message gets pushed there. At the end, I would have a big loop, where I would check messages that each object got, remove them, and act accordingly. I could also have a global array called "messages", and then I would iterate through it, and fire off events in different objects that the messages were sent to (in this case, a message would contain both a message, and some kind of an object ID), and then remove them. Is there a better way? Keep in mind that I'm working in Javascript.

I forgot to mention, we're talking about serverside Javascript running on Node.js, not in a browser.

sentences:
Best approach to implement server authority in client/server game I am currently trying to create a 2D game with a client/server model, and was wondering how I could implement the server's authority over the client (when client moves, prediction happens, and server checks if the prediction was well done, and if not, client reverts to older state).

Should I create a State class where the local player's state is saved at every tick in a buffer, for revert being possible ? Or should I wait for the server to respond and should the client be a simple renderer ?

How could I make sure that client and server are synchronized ?

I use pure java Socket class as well as DatagramSockets.

sentences:
How does the camera/UI know who the player is? I'm in a bit of a dilemma regarding how certain engine components — like camera and UI — know who to follow, whose health and other attributes to represent on the screen.

How do you architect a system where does communication between those components and the entities take place? I could have a separate entity that represents the player, but that seems a bit 'hard-coded'. What if I want to pan the camera? What if the player starts controlling another entity?

In other words, how do I abstract away the data sources for components like the camera and UI, such that they don't care what entity they represent?

An event system will do for a lot of cases, but that is more suited for propagating information that changes or is generated 'rarely' (like the death of the player). For something like entity health and position — which need to be known every frame — an event system isn't well suited.

sentences:
How to properly do smooth speed degradation? at the moment I'm using this:

playerclass.xspeed += (playerclass.xvelocity * loopclock.getElapsedTime().asSeconds());
to build up speed

To ramp up speed

and this:

if (playerclass.xspeed > 0||(playerclass.xspeed < 0)){playerclass.xspeed *= (1-loopclock.restart().asSeconds());}

To degrade it.

It looks pretty smooth to me but the speed will never reach zero, just get smaller and smaller infinitely

Setting the speed to zero if it's ever below a certain bound doesn't work because my speed builds up in very small amounts.

New to programming so apologies if this is an obvious answer.

sentences:
Kinetic scrolling in AS3 I have a container movieclip that contains my "game" and I would like to be able to drag the "camera" (i.e. the container clip) around, but I need it to have kinetic movement, i.e. feel more like native dragging and scrolling on an iOS device.

I can't seem to find anything that deals with this properly and in the manner that I am looking for, and I also would prefer to stay away from using any 3rd party packages if there are licenses involved. This is for personal side projects that may or may not see a form of commercial release, so I would rather a) learn how to code this myself and b) not have to rely and pay for third party libraries.

Any help would be greatly appreciated.

Thanks!

sentences:
Is it a good idea to analyze and compensate for gamepad joystick deadzones? For example, the player may want to be able to aim precisely in a top down shooter.  However, if the player is using a junky controller that has axis-independent deadzones, they will not be able to aim just a few degrees off of top, bottom, left, or right due to deadzones.  Is it a good idea to jump through hoops to sense this limitation and compensate for it?  Are there any best practices for that?
Here is an example of what I mean by axis independent deadzones:

The red area represents the deadzone.  The horizontal red area would give y=0, and the vertical red area would give x = 0.
I imagine that I could find these deadzones if I ask the user to calibrate their gamepad and do a sweep along the perimeter of the joystick.  Then I could compensate for them by squashing all values between 0 and (1 or -1) into that grey quadrant.  That said, I can see some issues arising with the player performing the calibration sloppily or too quickly, or otherwise sensing the deadzones inaccurately.
Is this a bad idea?  Should the player just get a better controller?

sentences:
Unity UNET, problems spawning and then destroying that instantiated prefab I am very new to networking, and have ran into an issue, read below.

I have multiplayer system setup, where players can spawn, they can pick up weapons and drop them, there is an object representing a pickup with network identity component attached and local player authority enable, the player can come up to it and press "E", which will destroy the pickup object, then the player can press I to to "drop" that weapon, which instantiates it infront of the player, now this is what should happen, and it works on single player, but when there's 2 players, for second player(client only) it doesn't work as it should.

I have 1 script weapon manager and another small, Pickup (on pickup object child with trigger).

Below is the code and according description of my attempt so far:

Below is PickUp script (on 1st child of pickup object with trigger enabled)

private void OnTriggerStay(Collider other)
{
    if (other.CompareTag("Player"))
    {
        if (Input.GetKeyDown(KeyCode.E))
        {
            //Call pickup function on player, passing the weapon id and parent gameobject
            other.GetComponent<WeaponManager>().PickUpWeapon(weaponID, transform.parent.gameObject);
        }
    }
}

Below is WeaponManager script (on player)

public void PickUpWeapon(int id, GameObject go)
{
    CmdDestroyObj(go);

    //... (other code, not relevent)
}

[Command]
void CmdDestroyObj(GameObject obj)
{
    RpcDestroyObj(obj);
}

[ClientRpc]
void RpcDestroyObj(GameObject obj)
{
    // HERE obj is NULL   (!!ERROR!!)
    Destroy(obj);
}

Above in RpcDestroyObj() obj is null

void Update(){
  if(isLocalPlayer)
  {
    if (Input.GetKeyDown(KeyCode.I))
    {
       if (slots[currentActiveSlot] != null)
       {
          CmdDropWeapon();
       }
    }
  }
}

Then here's CmdDropWeapon() function:

[Command]
void CmdDropWeapon()
{
    RpcDropWeapon();
}

Here's RpcDropWeapon() function:

[ClientRpc]
void RpcDropWeapon()
{
    GameObject _drop = (GameObject)Instantiate(drops[currentGun.GetComponent<WeaponStats>().id], transform.position + transform.forward, Quaternion.identity);
    _drop.GetComponent<Rigidbody>().AddForce(transform.forward * 25000f * Time.deltaTime);

    CmdDestroyWeaponHeld() //Destroy currently held weapon (don't pay attention, not relevent to current problem

    currentGun = null;

    if (isLocalPlayer)
    {
        GetComponent<PlayerSetup>().playerUIInstance.GetComponent<PlayerUI>().SetInventorySlotFill(currentActiveSlot, -1);
        emptyHanded = true;
    }
}

On single player (so host & client), everything works besides destroying the pickup prefab that is Instantiated.

On multiplayer, second player (client only), can pick up and drop weapons as well as the originally spawned weapon is destroyed, but destroying the newly instantiated (so after player drops it) pickup object doesn't work.

(In the console there are no errors when UnityEditor is the Lan host/server, when 2 players are playing and I try picking up and dropping weapons several times from client side)

Why is this not working? I would appreciate any help/assistance in getting this right and sync over network for all players.

My guess is that, rpc function Instantiates the drop prefab but it's kind of different on all clients, so the server or another client doesn't have exactly the same object in the scene which means it will not find it and return null.

Let me know if you need any additional information.

Thanks a lot in advance!

sentences:
How to correctly Dispose a SourceVoice once its finished i am starting to play a sound with XAudio2 and SourceVoice and once its finished, it should be correctly disposed to not have any leaks.

i was expecting it to be something like this:

        sourceVoice.Start();
        sourceVoice.StreamEnd += delegate
            {
                if (!sourceVoice.IsDisposed)
                {
                    sourceVoice.DestroyVoice();
                    sourceVoice.Dispose();
                }
            };

but that crashes with a read access violation in native code deep in XAudio2.dll which i cant debug.

sentences:
How do I teach my artist to do art for games? So my girlfriend is an artist and I'm a programmer and we often talk about joining talents and doing some small games or other fun stuff for the different popular platforms currently out.

But because I haven't really done any serious game development yet, I have a hard time explaining to her how she should create or package the assets she'd make, so we always end up not doing anything about it.

What I'm mostly thinking about here is when doing frame by frame animation. I know sprite sheets are used for this kind of thing, but then come questions like frames per second and stuff like that. Not program wise but art wise.

How should we tackle this?

sentences: What compilers are used in game development? I was kinda wondering what compilers are used in game development, since the game development industry always tries to squeeze every inch of performance out their software, using, among other, (sometimes very aggresive) compiler optimizations and the big boys in compiler technology (llvm, gcc), that excel in such kind optimizations are out of the game in the *Windows operating System*.

sentences:
Whole map design vs. tiles array design I am working on a 2D RPG, which will feature the usual dungeon/town maps (pre-generated).

I am using tiles, that I will then combine to make the maps. My original plan was to assemble the tiles using Photoshop, or some other graphic program, in order to have one bigger picture that I could then use as a map.

However, I have read on several places people talking about how they used arrays to build their map in the engine (so you give an array of x tiles to your engine, and it assemble them as a map). I can understand how it's done, but it seems a lot more complicated to implement, and I can't see obvious avantages.

What is the most common method, and what are advantages/disadvantages of each?

sentences:
How can I find if a GameObject is not exist in the Hierarchy? var selections = Selection.objects.OfType<GameObject>().ToList();
        if (selections.Count > 0)
        {
            tempSelections = selections;

            for (var i = selections.Count - 1; i >= 0; --i)
            {
                var selected = selections[i];
                transformSelection.Add(selected.transform);
            }

            TransformSaver.SaveTransform(transformSelection.ToArray());
            transformSelection = new List<Transform>();
        }

        for (var i = tempSelections.Count - 1; i >= 0; --i)
        {
            var selected = tempSelections[i];
            if (GameObject.Find(selected.name) == null)
            {
                GUI.enabled = true;
            }
            else
            {
                GUI.enabled = false;
            }
        }
        if (GUILayout.Button("Undo last selection if deleted"))
        {
            transformsCount = TransformSaver.LoadTransform().Length;
            PlayerPrefs.DeleteKey("transform");
        }

For testing I'm deleting one of the GameObjects in the tempSelections List

But then I'm getting exception in the editor on the line:

if (GameObject.Find(selected.name) == null)

Since the GameObject have been deleted it can't access the GameObject.

MissingReferenceException: The object of type 'GameObject' has been destroyed but you are still trying to access it.
Your script should either check if it is null or you should not destroy the object.

sentences:
approach for the system that record player actions and imitate it I am trying to implement some kind of system, that would allow AI to imitate player's action at certain points in similar cases. Case example

Player (hp: 10, mp: 5) used skill [BasicAttack] when in battle

When I set for a bot parameters like hp: 10, mp: 5 and state attack it should use BasicAttack skill because in same case player used that action. (I'd like to have ability to define similar cases like when hp: 11, mp: 6 then bot use BasicAttack too because it is similar to hp: 10, mp: 5 case but whatever)

The question is that what are the basic approaches for such cases? Leaving aside snapshotting of player's state, how can such system be implemented?

So far I have two ideas.
My ideas are

1. order player parameters by priority and states and create tree where every node would be
corresponding parameter value. For example node with name [hp] and value [10] will have a
child note [mp] with value [5] thus I can create required paths to actions

2. I have event log with recorded player events. It keeps its record ordered. I iterate over
it and using pattern matching I compare player parameters and retrieve corresponding player
action

The first approach seems much faster though.

But I'd like to know if there already exist approaches for such systems, in order not to reinvent the wheel as I used to do. Are any?

sentences:
Significant frame drop upgrading from Unity 2019 to Unity 2020 I used to use Unity 2019.4.22f1, but now that 2020.3.0f1 has been marked as LTS, I've decided to switch to it.
For no apparent reason, it seems like my game is getting consistently lower framerate, precisely, almost like it's cut in half. I used to get 800-1000 FPS in my game but now its around 400-500. I've tested with multiple things that are even more demanding, and where I used to get 500 fps, I now get 200 fps.
It's clear that this is likely a configuration thing, but I don't know which settings to change, if any of them have been.
There is this SX article here which didn't get answered and seems to have the same problem: Link
And this article which seems to talk about a similar problem, though it is marked as fixed: Link

sentences:
How to make the image move forward properly when rotated in my HTML5 game? I am just trying to make a simple 2D racing game using canvas. It uses the W,S,A, D keys to move the car.  The W key should take me forward and the A and D keys will turn each way. I want the car to continue heading forward after being turned.  I am currently just multiplying the distance to move by the sin or cosine of the angle in order to find the x and y positions, but it is not reacting how I would expect. Thanks.

<!DOCTYPE html>
<head>
  <meta charset="UTF-8" />
  <title></title>
</head>
<body>
<canvas id="canvas_layer_01" width="3072" height="2048" style="border:1px solid #000000;">></canvas>

<script>
  var canvas = document.getElementById("canvas_layer_01");
  ctx = canvas.getContext("2d");

  car_image = new Image();
  car_image.src = 'http://i.imgur.com/Bl2p5KI.png';

  var key_pressed_a = false,
    key_pressed_d = false,
    key_pressed_w = false,
    key_pressed_s = false;

  var player_x = 50,
    player_y = 50,
    player_speed = 10,
    player_angle = 0,
    max_turn_angle = 10; // probably needs to change based on speed

  document.addEventListener("keydown", function(e){
    switch(e.keyCode){
      case 87:
        key_pressed_w = true;
        break;

      case 83:
        key_pressed_s = true;
        break;

      case 65:
        key_pressed_a = true;
        break;

      case 68:
        key_pressed_d = true;
        break;
    }
  }, false);

  document.addEventListener("keyup", function(e) {
    switch(e.keyCode) {
      case 87:
        key_pressed_w = false;
        break;

      case 83:
        key_pressed_s =false;
        break;

      case 65:
        key_pressed_a = false;
        break;

      case 68:
        key_pressed_d =false;
        break;
    }
  }, false);

  window.requestAnimFrame = (function(callback) {
    return window.requestAnimationFrame || window.webkitRequestAnimationFrame || window.mozRequestAnimationFrame || window.oRequestAnimationFrame || window.msRequestAnimationFrame ||
      function(callback) {
        window.setTimeout(callback, 1000/60);
      };
  })();

  // http://stackoverflow.com/a/16546061/6716639
  function render_image(img, x, y, width, height, degrees) {

    //Convert degrees to radian
    var rad = degrees * Math.PI / 180;

    //Set the origin to the center of the image
    ctx.translate(x + width / 2, y + height / 2);

    //Rotate the canvas around the origin
    ctx.rotate(rad);

    //draw the image
    ctx.drawImage(img,width / 2 * (-1),height / 2 * (-1),width,height);

    //reset the canvas
    ctx.rotate(rad * ( -1 ) );
    ctx.translate((x + width / 2) * (-1), (y + height / 2) * (-1));
  }

  function updateGame() {

    if(key_pressed_w) {
      player_x += player_speed * Math.sin(player_angle);
      player_y += player_speed * Math.cos(player_angle);
    }
    else if(key_pressed_s) {
      player_y += player_speed;
    }
    else if(key_pressed_a) {
      player_angle -= max_turn_angle;
    }
    else if(key_pressed_d) {
      player_angle += max_turn_angle;
    }

    ctx.clearRect(0, 0, canvas.width, canvas.height);

    render_image(car_image, player_x, player_y, car_image.width, car_image.height, player_angle);

    requestAnimFrame(function() {
      updateGame();
    });
  }

  updateGame();

</script>

</body>
</html>

sentences:
How to correct obtain HWND from SDL2? I use Urho3D which uses SDL2 as a window system. I want create another window as GUI and make it child for main window of Urho3D.

What I did is:

// insde virtual void Start() // Urho3D app
SDL_Window * sdlw = context->GetSubsystem<Graphics>()->GetWindow();
int width = context->GetSubsystem<Graphics>()->GetWidth();
int height = context->GetSubsystem<Graphics>()->GetHeight();
HWND mw = SDLWindows::GetWindowHWND(sdlw);
wpfC = WPFI::CreateWPFControl(0, 0, width, height);
HWND www = SetParent(wpfC, mw); // SetParent is windows function
if (www == NULL)
{
    std::cout << "------------------------------\n"
        << "www = NULL\n"
        << GetLastError() << "\n"
        << "------------------------------\n";
}

HWND SDLWindows::GetWindowHWND(SDL_Window * wnd)
{
    SDL_SysWMinfo sysInfo;
    SDL_VERSION(&sysInfo.version);
    SDL_GetWindowWMInfo(wnd, &sysInfo);
    return sysInfo.info.win.window;
}

I got Invalid window handle (1400) Error on SetParent().

I am not sure if I am doing it right, but I am sure that my wpfC is ok because I have another test project where it is working but instead SDL window I use win32 Window.

I think SDL_GetWindowWMInfo() give me a wrong handle.

Question is how to obtain HWND from SDL_Window correctly and be sure that it is right HWND?

If it is not possible do it that way, is there another way how to create child window from HWND inside main SDL2 window?

sentences:
Tracking player location in realtime 2d mmo I have read all of the answers here about tracking player locations, but still have some questions. I don't seem to understand how to do this efficiently, and feel that the internet could greatly benefit from an effective solution that is easy to find.

Anyway, I am making a 2d mmo (the first multiplayer game I have made that will handle this many people) and can't seem to come up with a good way to manage the location of players, and alert other players when they are near them. My map is tile-based, and I want the clients connected to know when a player of another client is withen 200 blocks from the other client.

My map uses x and y coordinates, and each block is a value. I read something I was linked to by a similar question here, that explained that a good way of managing this sort of thing is to create a box around each player, and to alert both player's when their boxes overlap (assuming I understood it correctly).

But how should I create these boxes without wasting tons of computing power and resources? I thought of storing it in SQL database, but that would be too slow. I then realized that player locations would have to be stored in the RAM. So what are some previously used strategies to track player movement in the RAM? Should I store a variable for each player containing the coordinates withen 200 blocks from them, and constantly have the server checking to see if two players overlap? This doesn't seem very efficient, and I believe that I am going about this the wrong way.

Any help is greatly valued.

sentences:
Do I create a first login tutorial for new users? I'm finishing my first browser game. I really don't know if I have to develop a "first login" tutorial or not. Do you think it's important?
I hate the image-based tutorials, with just few screenshot and the buttons "next" and "prev". I wanted to guide the user in the first step, using the real website but with forced choices.

Is it a good idea?

Is there some piece of code (i.e. jquery plugin) to help me in this phase?

sentences:
Casting every received packet as struct? What is the best performant solution to handle received data from socket, in a MMORPG game? Is it good to have something like:

[StructLayout(LayoutKind.Explicit, Pack = 1)]
public struct LoginPacket
{
    [FieldOffset(0)]
    public int size;
    [FieldOffset(4)]
    public int opcode;
    [FieldOffset(32)]
    public int someOtherImportantOffsetInPacket;
}

And then when every packet is received I create the correct struct for the received packet, to access its information easier?
Or the best performant solution is if I just pass the byte[] to the function and use functions like BitConverter.ToInt32 ? I know BitConverter is slow, but I already have my own class that does the same thing in a faster way.

sentences:
Support multiple gamepad layouts (Unity 2017.3) My game supports touchscreen, keyboard + mouse and the Xbox One controller and the input so far works properly. Now I also want to add a second layout for the gamepad the player can then pick in the settings, e.g.:

Layout 1: Fly up with "A", fly down with "B" (so two buttons)

Layout 2: Fly up with "LB", fly down with "LT" (LT uses an axis, not a button!)

With keyboard/touchscreen and gamepad input I was able to create two different inputs in Unity's InputManager for the same thing and they would then trigger depending on which input device you're using.

I thought about adding a bool for the layouts and checking it every time a button is pressed but that sounds more like a quick and dirty solution. Descriptions of InputManagers I've found so far make it sound like they're used for rebinding keys or to support different gamepads (e.g. Xbox One and PS4), which I don't want/need (plus, these InputManagers are usually pretty expensive).

How do you handle actual different layouts that use the same buttons/axis for different things, especially with something using a button in the first layout and an axis in the second?

sentences:
How to calculate size of object depending of its height on the screen? I am programming a mostly 2D game on Android (with Andengine), but the player is a bouncing ball (kinda in 3D).

I wanted to make the bouncing of the ball the most realistic possible, using quadrilic equations (http://www.mathopenref.com/quadraticexplorer.html).
So I know how to calculate the vertical height (z) of the ball, but I do not know, what size should the ball be, depending on its vertical height (z).

When the ball touches the ground, it should be 64px (width and height of the sprite), but if for example it is at 100px above ground, what should be the width and height of the displayed ball ? Is there an easy way to calculate it ?

Thanks

Game Dev noob.

sentences:
Leapfrog integration vs Euler integrator I am looking at various integration methods for my n-body simulation and I'm slightly confused about actual implementation of leapfrog integration.

According to the wikipedia page leapfrog method is defined like this:

When I imagine how to code it, i come up with something like this:

while true:
    dt = time since last frame

    for every object:
        object.position += object.velocity * dt

    for every object:
        acceleration = object.calculate_acceleration()
        object.velocity += acceleration * dt

    render()

But this is Euler integration, right?

So moving the initial velocity back by one half step makes a first order method into a second order method?
But for me a small change of initial velocity is not important, it will be set as a random value anyway...

Why I won't just use velocity verlet: This is for a game where tens of thousands particles fly around affected by forces roughly resembling gravity.
I'd like to keep amount of data stored in every partile as low as possible to improve cache locality, which is why I don't want to use a method that requires storing acceleration (and recalculating it would be too slow).

sentences:
Mastermind type versus system I'm thinking of incorporating a versus/competitive system into my webgame ( ninjawars.net ), based off of the old "mastermind" game.

Let's call choosing the color dots in mastermind the "defensive" role, and determining what color dots were placed the "offense" role.

Mastermind is already competitive, but when creating the "color dots" there's a limited amount of added difficulty that you can create (e.g. all random color nodes using a random number generator is probably the most difficult you could get [I think that's true, random is the hardest case to crack, all one color is obviously the easiest]) but what I would like to do is be able to allow players to increase the difficulty from their defensive role by adding to the number of color dots that the defender can use.
For example, instead of 4 dots, the defender could have, I don't know, 20 dots, much harder.  Or only get to place 1 dot, so they have a much simpler defense.

So the question is, how do I determine good amounts of more dots to allow the defender?  Some measure of the simplicity of determining 1 dot, all the way up to the difficulty of X (quite a few) of dots?  I'd really like to be able to mathematically determine number of possible combinations, but I... ...guess I was asleep during that part of school...

sentences:
Copy location/rotation information in Unity I place a cube in my level (scaled along one axis) and start doing something else.

Then I place another cube, but want to copy and paste the location and rotation data from the first cube onto this new one.

So far I'm doing that by copying & pasting 6 numbers one by one. Is there a faster way to clone the location/rotation of an object (eg. with a single key press)?

sentences:
How to create plasma trail for spaceship I have seen a lot of great looking space games that all use similar effects. I am really interested in finding out how some of these effects are generally done.

In particular I want to know how some of the trails behind spaceships or missiles are accomplished without using all the available resources.

For examples of the effect I mean see the screenshots for Gimbal, and even the video at that same link. Also the missile trails in Ether Vapor.

Are these both the same techniques? I am mainly interested in 2D, but I can't imagine it would be too different.

So how would I go about creating this kind of effect? Are we talking pixel-shaders, blendmodes/filters, bitmap effects, particle systems, or what? Not really platform specific. I am just looking for the theory, but specific examples or links would be great. And more detail the better.

sentences:
How do I change the name of map shown in Warcraft 3 list of available maps? I used an MPQ editor to change some things in one of my maps.  Among those changes was the map name defined as a text string in the war3map.wts inside the map.
Now, however, I see that the name of the map, as shown in the list of maps, was unchanged and — of course — differs from the name of the map shown everywhere else:  above the preview, e.g.

How do I change the list name?
Do I actually need to resave it in a map editor, e.g. Blizzard's “World Editor”?

sentences:
Referencing Tilemap inside Grid Prefab I have a prefab of a grid which contains 3 different tilemaps:

Main, Foreground, & Background

I want to reference the tilemaps inside a script of the prefab but can't figure out how to do that... I just need to edit the tiles in the tilemaps located inside the prefab.

sentences:
How effects found in "Autodesk Fluid FX" are implemented using OpenGL ES? How this kind of effects are technically implemented using OpenGL ES? Are they performing simulation on GPU (using Shaders) or CPU while using some smart vertex positioning and texturing? Why it appears so fast (in terms of performance)?

You might check the video of that app here: http://www.youtube.com/watch?v=F4KOk6QP6kQ

edit

Here is the presentation for the app: http://www.futuregameon.com/FGO2010_JosStam.pdf

sentences:
What is "Rapid" in reference to the MSN Games GDK? I have herd a little talk about the MSN Games GDK lately, and what wondering what Rapid was.

It sounds like some sort of testing environment, is this true? How can I get access to it? Or find out more about it?

sentences:
VFX for Unity sci-fi game Can someone please give me any tips/ guides on how to create hologram, disintegration & freeze effects in Unity game?
I have a sci-fi shooter game in mind, and I would like to incorporate the above mentioned effects in it.

I would like to achieve something like these:

Holographic effect - 1,  2
Disintegration effect - 1
Freezing effect - 1

And I would prefer to achieve these without using a premium plugin. Budget issues.

sentences:
Using an FSM, how do you clean up state related attributes that may be used from several states? I'm making a game that plays a bit like Diablo, but you can harvest resources like in an RTS.

I have the following states in my FSM: IdleState, ApproachingTargetCoordinateState, ApproachingTargetEntityState, CuttingTreeState.

When a user clicks a tree, Player.targetEntity is set to the corresponding Tree instance (which inherits from Entity) and the player's state is set to ApproachingTargetEntityState. When the player reaches the tree, a transition is made to CuttingTreeState. Shortly after, the tree is cut down, and state is changed back to IdleState.

At this point, I'd like the Player.targetEntity reference to be removed because its no longer needed. Where should I put the logic that does this?

I could do this in the CuttingTreeState#exit() method but that would only work in situations where everything happens as described above. If for instance the user clicks a random coordinate (not a tree) before the player reaches CuttingTreeState, CuttingTreeState#exit() is never run and so Player.targetEntity is never removed.

I can't put it in ApproachingTargetEntityState#exit() either, as that would remove the reference to the tree before we get to CuttingTreeState.

Another solution would be to just not care about Player.targetEntity. But it just feels wrong to me that the attribute is set for example when the player is in the IdleState.

How can I solve this problem? What is usually done?

sentences: How to make something happen every N seconds in game? I want to have something happen every N seconds, how would I do that? Maybe use a timer but how?

sentences:
New to Game Development, need advice Possible Duplicate:
  What are some good resources for getting a beginner started in developing games?

I'm a CS student, having plenty enough knowledge in programming, and general algorithms. What is your suggestion in game developing? How to start?

Thanks a lot!

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:
How can I prevent a buggy old version of my game from posting scores to the Gamecenter Leaderboards? I found that an older version of my game has a bug that causes some crazy scores to be posted to the leaderboard. I can delete these scores by editing the acceptable range in iTunesConnect and my latest patch fixes the scores from being submitted again, but that doesn't stop users who haven't updated from posting these bad scores.

Is there a solution? Is there a way to require a minimum app version for gamecenter achievements? Is there a way to delete that leaderboard and simply make a new one for the next version?

The only solution I can think of is to limit the acceptable score range to keep most of the bad scores out, but this could potentially kill a really good legitimate score and still let in lots of bad ones.

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:
How do I prevent inappropriate ads from appearing in my game? My game implements Unity ads, and is designed with a universal audience in mind. As such, I would prefer not to have 18+ ads (or even 13+ ads depending on the circumstances) appearing in it, especially since it would appeal to younger audiences as well. My question is then, how do I prevent age-inappropriate ads from appearing? Is there a way to simply set the age limit or content restrictions on Unity ads? The only setting along those lines that I can find is the COPPA toggle, and that would cause other issues (not to mention that it wouldn't do anything to the ads). I've looked in the dashboard for a while, and I've tried to research it beforehand, but the fact that they've shifted to a centralized services page, redirected all the old links (breaking them in the process), reorganized the settings in the dashboard, and 404d their FAQ post on the topic doesn't help either. Blocking ads based on a rating would work too, as I would have to get one because I am publishing to Google Play.

Edit: The second link only 404s some of the time. I just happened to get it every time before asking this question. Bad luck, I guess.

sentences:
What are heterogeneous coordinate systems and reasons for using them? The book I'm following for a computer graphics course only talks about homogeneous  coordinate systems.

But today, our teacher asked:

  What are the reasons for using heterogeneous coordinate systems?

I cannot find anything about this topic.

sentences:
Animation clip not working I am working on playing different animation of key press.Below are the animation element attached to my player

Initially run animation is played.I have written code to play "Jump" animation on keypress.

The problem is that when I press the key "Jump" animation will be played,But this animation is played again and again.

I need to play the "Jump" animation only once.Then I need to switch to run animation

Here is the code written

public bool run=false;

void Update () {
    if(Input.GetKey(KeyCode.R))
        {
        run = true;

        }
    if (run == true) {

        GetComponent<Animation>().Play("Jump");
        GetComponent<Animation>().wrapMode = WrapMode.Loop;
    }
}

sentences:
Random range of items? I want to add random function into this script. If boxDestroyed is true, three items pop up. What i need is to give random number of items between 0 to 3.

    public GameObject[] items = new GameObject[3];
    public bool boxDestroyed = false;

void LateUpdate ()
{
    if (boxDestroyed == true)
    {
        Vector3 position = transform.position;
        foreach (GameObject item in items)
        {
            if (item != null)
            {
                //  int amont  = Random.Range(0,3);
                Instantiate(item, position, Quaternion.identity);

            }
        }

        Destroy(gameObject);
    }
}

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:
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: How to add tiles randomly? I made a set of 10 different "ocean" tiles, all interchangeable with one another, and I'd like to randomly attach these 10 different tiles together in different combinations over a large rectangular area -- what would be the best way to do so? I've thought of just adding each sprite into a script and then calling a for/foreach loop to add it into my world but that seems extremely expensive since I'd be adding over 1000 sprites. I don't want to reduce the number of sprites I have to add, I'm just seeing if there's a typical way people do this sort of thing.

sentences:
Why does Unity require an EventSystem component for input during a play-test, where input works fine without it in a build? Please be aware that this was initially a question about how to get the input to work. A comment pointed me in the direction of a fix, but only left me with more questions in regards to understanding the problem I was originally having, so I have edited my question to include the initial solution and focus on the question I still have.

The Problem:

Recently, I have moved from using GUIText and GUITexture objects to using the Canvas to display UI elements. In effort to set up a prototype, some external GUI elements were imported, and when the game is built and run from my phone, everything works as intended.

However, if I simply run the game from inside Unity, input is completely ignored. I originally thought this may have been a response to grabbing touch screen input, and expecting it to work on a regular screen with mouse input, but I have since confirmed that it still does not work when using Unity Remote to test the game on my phone.

It has since been pointed out that I was not using an EventSystem, along side my Event Trigger objects. After implementing an EventSystem component, and the default input module supplied by the EventSystem interface, the input works. However, this still leaves me confused. What is the point of enforcing the implementation of the EventSystem, if it only ensures functionality during play test? Why would I want this system in my end build, when I can confirm that the build version functions properly, without it?

Below you will find my setup, contextual to the problem. Click for a zoomed in view, as I have included the component structure of my UICanvas and MainCamera objects, in case it is helpful. In this case, we have a button that increases the max speed, when pressed. Everything works in a build, but nothing works during a play-test.

Additional Information:

I have enabled 'show touch input' on my phone, to confirm that the phone is still registering touch input.
I moved to using the Canvas object after the 'depreciated warning' for using GUIText and GUITexture turned into a 'depreciated error'. Even if there is a suitable way to still perform these actions with the GUIText and GUITexture objects, I still wish to persist with using the Canvas. I am also personally curious as to why this issue exists within the Canvas, as it seems lead to obvious cases of severe inefficiency, in a system that seems to have been put together with the sole point of being more efficient.
I can create manual OnMouseDown buttons that will work during play test, however, some GUI elements are more complex and persisting with this sort of solution seems like an incredible waste of time.
As previously mentioned, I do not have any input issues if I simply build and run the game from my phone. However, this takes considerably more time than a simply debug test, and even without the high efficiency cost, I do not have access inspector-manipulation during my play-test.
I am using Unity version 5.3.5 personal. Any solution that does not include updating Unity will be well preferred. While I have no physical problems updating Unity, in some previous projects updating Unity versions has lead to massive issues that we would prefer to outright avoid, if possible.

TL;DR:

Unity will not accept input on my input canvas during debug. I literally have to build and run my project each time I want to test input, or create dodgy hacks to provide input from the Inspector. The addition of an EventSystem allows input during debug play-testing, but is not needed for input post-build. Why does Unity act this way, and why do I need an EventSystem entirely for play-test input?

sentences: Looking for online resources to understand game camera properties What are some good online resources to understand game camera properties, such as fov, aspect-ratio and more?

sentences:
Textures are not drawn separatley I am trying to draw different textures of balloons and I want them to appear in different times about half second between each one, and move in the world. first balloons are rendered but after about half second the other balloons are rendered next to the previous ones, not in the initial place: this is code:

private Ballons ballons;
    private Ballons ballons2;
    private Ballons ballons3;
    private Ballons ballons4;

    private Texture background;
    public Celebration(Fruits game, float level)
    {
        this.game=game;
        this.level=level;
        gamecam=new OrthographicCamera();
        gameport=new StretchViewport(820/Fruits.PPM,580/Fruits.PPM,gamecam);
        stage=new Stage(gameport,((Fruits) game).batch);
        background=new Texture("Wining.jpg");
        gamecam.position.set(gameport.getWorldWidth()/2f,gameport.getWorldHeight()/2f,0);
        temp=0;
        counter=400;
        world=new World(new Vector2(0,0.5f),true);
        b2dr=new Box2DDebugRenderer();
        ballons=new Ballons(world,this,1,140);
        ballons4=new Ballons(world,this,2,290);
        ballons3=new Ballons(world,this,3,480);
        ballons2=new Ballons(world,this,4,650);

    }

    @Override
    public void show() {

    }
    public void handleinput(float dt)
    {
        if(Gdx.input.isTouched())
            game.setScreen(new GlobalWorld(game, 1));
    }
    public void update(float dt)
    {
        handleinput(dt);
        world.step(1 /60f, 6, 2);
        //player.update(dt);
        gamecam.update();
//        renderer.setView(gamecam);
        ballons.update(dt);
        ballons2.update(dt);
        ballons3.update(dt);
        ballons4.update(dt);
    }

    @Override
    public void render(float delta) {
        float level;
        update(delta);
        Gdx.gl.glClearColor(1, 1, 1, 1);
        Gdx.gl.glClear(GL20.GL_COLOR_BUFFER_BIT);
        counter--;
        b2dr.render(world, gamecam.combined);
        game.batch.setProjectionMatrix(gamecam.combined);

        game.batch.begin();

        game.batch.draw(background, 0, 0, gameport.getWorldWidth(), gameport.getWorldHeight());
        if (counter < 200) {
            ballons.draw(game.batch);
            ballons2.draw(game.batch);

        }
        if (counter < 100) {
            ballons3.draw(game.batch);
            ballons4.draw(game.batch);

        }
        game.batch.end();

    }

    @Override
    public void resize(int width, int height) {
        gameport.update(width, height);

    }

}

sentences:
Collisions between players in multiplayer racing game I'm creating a simple racing game (spaceships, no gravity) using p2.js, phaser and node.js.

What I have done:
Client receives world state from server:

extrapolate other players based on latest velocity/position from server
check if client-side prediction was correct - if no apply position from server and process inputs that server was not aware of.
fixed physics step

Server:

receives inputs from clients and apply
fixed physics step
sends world state to each client

Now I'm struggling with collisions between players.
Colliding player is jumping all time during collision. I think it's because client-side prediction is not calculating similar results to the server.

Server doesn't know all inputs from player (lag).

Player doesn't have the same position of colliding player as the server (lag).

Combining this two makes the client to resolve collision different than the server and when world state arrives player has to make a big correction.

sentences:
How to add Facebook Data Storage to Mobile Game? I was wondering how I would add the option for players to sign into their Facebook profiles on my mobile game and then have Facebook store their game save data, so they can recover it on any device when they sign into Facebook. Other Facebook features would include seeing their friends on the Facebook leaderboards, inviting their friends to the game and challenging their friends to beat their scores. I would hate for the Player's data to be lost, so the Facebook data save part is very important. A good reference to this feature is the Hungry Shark mobile game.

I wasn't sure how this works. My programming friend and I are creating the game together, but he doesn't know how to do this and I don't know how to program. Once I figure out exactly what has to be done, I would like to hire a programmer who knows how to add this feature.

Thank you!

sentences:
What is the purpose of a guild bank? I've seen guild banks in Wow, or Dofus, and other MMO games.

In the guild I've been a part of, we mostly used the bank as storage; resources stored that end up not being used are wasted. Sometimes there is a free share policy, but there is always that one guy who will take stuff he does not really need and sells it.

This led me to wonder what is the original purpose of a guild bank, what do players like to use it for, and how can a game help them do it?

sentences:
How do I find the rotation point given a touch anchor, new position and new rotation? I've got an Cocos2d layer which anchorPoint, position and rotation (according to http://www.qcmat.com/understanding-anchorpoint-in-cocos2d/) vary when the pinch zoom gestures. Everything works fine.

I've also added smoothness, so the layer will stop gently when it is 'thrown away' by a one finger gesture. The layer will also stop zooming in a gentle way when the 2nd finger is released (if it is released during movement). I've also succeeded with smooth rotation, so the layer continues rotation around touch1 when touch2 is released (if touch2 described an orbit around1).

My problem is that the rotation functionality is not generic. For instance, I've problems with the case where touch1 and touch2 is on the opposite side of the center point, and follows a path on a circle circumference. The layer will then rotate around the centre point. That works fine until the fingers are released, but my algorithm is not robust enough to find out that it shall continue the rotation around said center point.

Question: How do I in a generic way find the point of rotation, and the rotation speed around that point, for a layer using sampled data containing anchorPoint, position and rotation for the last 0.1(?) seconds?

The example above is only one use case. You can also think about the case where touch1 follows the arc from (1, 0) to (0, 1) meanwhile touch2 follows the arc from (2, 0) to (0, 2). That will result in a rotation around (0, 0). I want to detect that movement, and continue the rotation around (0, 0) if the touches are released at the same time.

sentences:
2D Box Collision Trouble Hello I am trying to handle some simple box collision (axis-aligned) in my top-down 2d game, but running into a problem.

My game is running at a fixed time step, and checks for player-wall collision on each iteration. It retrieves some collision data (if it collided & what side of the bounding box) and adds some offset (dir) to the players position depending on the overlap amount.

// Check player with walls
        CollisionData col = testBoxCollision(m_player->getCollider(), wall.getCollider());
        if (col.isCollided){
            Vec2f dir(0.0f, 0.0f);
            if (col.left)
                dir.x -= (m_player->getCollider().getPosition().x + m_player->getCollider().getHalfSize().x) - (wall.getPosition().x - wall.getHalfSize().x);
            else if (col.right)
                dir.x += (wall.getPosition().x + wall.getHalfSize().x) - (m_player->getCollider().getPosition().x - m_player->getCollider().getHalfSize().x);
            if (col.top)
                dir.y -= (m_player->getCollider().getPosition().y + m_player->getCollider().getHalfSize().y) - (wall.getPosition().y - wall.getHalfSize().y);
            else if (col.bottom)
                dir.y += (wall.getPosition().y + wall.getHalfSize().y) - (m_player->getCollider().getPosition().y - m_player->getCollider().getHalfSize().y);

            m_player->GameObject::setPosition(m_player->GameObject::getPosition() + dir);
        }

The testBoxCollision function:

CollisionData testBoxCollision(const Collider& a, const Collider& b)

{
    CollisionData c{ false, false, false, false, false };

float w  = a.getHalfSize().x + b.getHalfSize().x;
float h  = a.getHalfSize().y + b.getHalfSize().y;
float dx = a.getPosition().x - b.getPosition().x;
float dy = a.getPosition().y - b.getPosition().y;

if (abs(dx) <= w && abs(dy) <= h)
{
    c.isCollided = true;

    float wy = w * dy;
    float hx = h * dx;

    if (wy > hx)
    {
        if (wy > -hx)
            c.bottom = true;
        else
            c.left = true;
    }
    else
    {
        if (wy > -hx)
            c.right = true;
        else
            c.top = true;
    }
}
return c;

}

The Problem

When two walls produce a corner, and I push my player up to the corner, the player goes through the wall. Not Ideal!

Clearly I've overlooked something and another set of eyes would be very helpful. Thanks.

Below is a snapshot of what's happening.

EDIT: I'm led to believe this is a math error, because it only happens on some corners at a consistent frame rate.

sentences:
How to convert png images to True Type Font? I'm doing a clone of Colonization and I'm trying to use the same font type as the original game. I'm able to get the pixels from the original font files (.ff) using the application from this thread https://forums.civfanatics.com/threads/colonization-picture-viewer.256665/page-2 but the outcome is a PNG file.

The question is how I can convert this PNG file to a True Type Font that I can load on my MonoGame application? Is there a way to do that? Do I have to consider using one texture per letter rather than a font type? If this has sense, how can I set different font sizes using textures?

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:
Storing few values in an int - small gain This might be a bit hard-to-answer question, but... I had a DirectX::XMFLOAT3 as a vertex attribute. I have changed it to just an int by placing the 3 floats into int (using only 8 bits per float). In the vertex shader I am extracting the bits like this:

// example int bits: 00000000 10011000 00011101 11111111

input.weight.x =   ( input.w >> 16 )               / 255.0f; // 10011000 / 255.0f
input.weight.y = ( ( input.w & 0x0000FF00 ) >> 8 ) / 255.0f; // 00011101 / 255.0f
input.weight.z =   ( input.w & 0x000000FF )        / 255.0f; // 11111111 / 255.0f

But with this manner I've only gained like 1-5 fps (from ~130 to ~135), how is that possible that the fps boost is that small? What's the culprit here? Is the extracting bits on GPU that heavy?

sentences:
How can I change the dimensions of collision volumes showed in UE4's physics asset tool? How can I change the dimensions of the capsule for one bone in the physics assets tool?

The problem is that bones not connected by joints have overlapping collision volumes in the mannequin that comes with the starter content, which causes those body parts to apear dislocated or out of place when the simulation is running.

For instance in this image the pelvis and the middle bone in the spine (Spine 2) are overlapping.

So, when the simulation runs Pelvis and Spine 2 get pushed apart reducing the overlapping to a contact point.

sentences:
Designing an end-less running game with levels-using LibGdx JSON I am working on an end-less running game where obstacles are placed along the way on moving background.
I have a lot of levels in the game,and I am implementing it using JSON.

My JSON file for first level look like this:

 "obstacles": [
 {"name":"rock","position":"middle","distance":"1000","speed":"350"},
 {"name":"crow","position":"up","distance":"1600","speed":"350"},
 {"name":"gap","position":"down","distance":"1600","speed":"350"},
 {"name":"monkey","position":"middle","distance":"2200","speed":"350"},
 {"name":"fish2","position":"down","distance":"2400","speed":"350"},
 {"name":"crow","position":"up","distance":"2600","speed":"350"},
 {"name":"snake","position":"up","distance":"3400","speed":"350"},
 {"name":"fish","position":"down","distance":"3400","speed":"350"},
 {"name":"fish2","position":"down","distance":"4400","speed":"350"},
 {"name":"monkey","position":"middle","distance":"5500","speed":"350"},
 {"name":"rock","position":"middle","distance":"6500","speed":"350"},
 {"name":"fish","position":"down","distance":"6500","speed":"350"},
 {"name":"cloud","position":"up","distance":"7200","speed":"350"},
  {"name":"rock","position":"middle","distance":"8000","speed":"350"},
 {"name":"gap","position":"down","distance":"8000","speed":"350"},
 {"name":"snake","position":"up","distance":"8700","speed":"350"}
 ]

Here I am placing obstacles up to an x position of 8700 on a moving parallax back ground.

Level1 is working fine,but my issue is that how I should place the next level obstacles.I have only one way that some position after 8700 I have to choose for placing next level obstacles.

Here I want to clarify one thing.Will it become a problem when I use larger values like this?

There is more than 20 level planned in my project,and each level get loaded automatically when one is completed.

I expect suggestions from experienced persons ,for designing the levels with these aspects.

Thanks in advance.

sentences:
How to dynamically animate a part of a 3d model towards something I'm curious about how this sort of animation is typically done code-wise.

A few examples:

A character picks something up - only hand is animated towards the target
http://www.youtube.com/watch?v=rW-7uatehx4 see from 4:50 when the player picks up the weapon.
Character hangs from a ledge - hands are set to a specific location(the ledge)
http://www.youtube.com/watch?v=SOiwArn4Bmw right at the beginning.
Character looks at something - head is pointed at the target(npc looks at the pc)

sentences:
How do I render an animation where some frames appear twice? I am animating a sprite. The sprite has 7 different frames, but the animation is 10 frames long. This is because 3 of the original frames appear twice in the animation:

3 -> 4 -> 5 -> 6 -> 4 -> 3 -> 2 -> 1 -> 0 -> 2

Frames 2, 3 and 4 appear twice. This avoids having to store duplicate frames in the spritesheet.

How can I render the animation in this sequence with repeated frames?

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: Alternative Font loaders in Monogame Framework While working on projects of mine, I have been finding that it is a huge pain to switch operating systems just to create a simple spritefont when using Monogame. I saw that the Nuclex Framework can load fonts which are clearer/sharper, and they can be used in a Monogame project as well. They load fonts using the FreeType library, which is very multiplatform and is used widely. Is there a fairly simple way to use the FreeType library or another library to render text suitable for use in a Monogame project, as an xnb file?

sentences:
How to support JS/Python scripting a C++ game engine? I'm currently writing an Entity/Component/System architecture game engine in C++, and I have the beginnings of a lua scripting system in place, which seems to be quite popular, but I feel Javascript or Python would be better.

My requirements are:

Able to bind C++ function calls to the scripting language.
Able to return data to the calling script.
Able to support heavily templated libraries, such as glm (optional, but desirable)
Must be lightweight.
Must have open source license, or similar, with no restrictions on any potential commercial use.

How would I go about doing this, in a similar way to Lua?

sentences:
How do I create a spherical world to explore? So to preface this question, I have done a lot of research on this, but most of it has proven unhelpful, possibly because I'm not sure the proper way to phrase what it is that I'm trying to ask, so I might make this a little long-winded to get my point across.

The basic idea that I am trying to explore is a small planet that can be navigated by the player, but I also want this planet to be similar, but different for each playthrough (hence the procedural-generation tag). At first, I looked into doing this by simply creating a sphere which has it's own type of gravity (doesn't have to be too realistic), but research proved that this had many (too many) obstacles to overcome. Making the gravity work on this sphere would have been complicated, but doable, but then I read that the terrain tools wouldn't work properly and that could be a problem. The last issue that I saw for this, which makes me think that this idea is dead is how strenuous this might be for the systems, since I want the planet to be fairly full of interesting things to explore.

This led me to the idea of a modular system of tiles (if I'm using that term correctly), where I could procedurally generate these tiles, and align them in a spherical shape. I could instantiate and destroy the tiles as needed to preserve system resources, and would make the procedural generation aspect of this easier for me as well (at least I think it will). The problem I see with this model is how to make square (or any other shaped tiles) form a sphere.

I am attempting to build this in UE4. If this is impossible, or at least prohibitively difficult, to do in the engine, then I rather find out now before I get too far along in the project. And any help or resources on how I can do this if possible will be greatly appreciated.

sentences: How to determine the maximum supported level of anisotropic filtering for a graphics card In software, at runtime, (C++ if it matters), is there a way to find out the maximum level of anisotropic filtering supported by the graphics card?

sentences:
How to make a simple HUD with no library I am writing a simple game in c++ using opengl in a windows system.

I have the scene and I need some informative text to appeared to the left top/bottom of the screen

I am printing these messages with a little plane and the text on it, but I want them to be aligned at the corners of the screen.

So I've read this question here and I thought it seemed quite good and closer to my needs.

So, this is some of my code already used:

In init function of openGL:

glShadeModel (GL_SMOOTH);
glEnable(GL_DEPTH_TEST);
glDepthFunc(GL_LEQUAL);
glClearDepth(1);
glPolygonMode(GL_FRONT_AND_BACK,GL_FILL);

In the Resize function:

if (window_height == 0) window_height = 1;
glViewport(0, 0, window_width, window_height);
glMatrixMode(GL_PROJECTION);
glLoadIdentity();
gluPerspective(60.0, (float)window_width/(float) window_height, 1.0, 550.0);

And finally in the render function:

glClear(GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT);
glMatrixMode(GL_MODELVIEW);
glLoadIdentity();
glTranslatef(0, 0, -250); //is used for making the scene visible
RenderScene();
glutSwapBuffers();

I've tried using the ready3D() and then RenderScene() functions but the scene looked a lot different to what I was aiming.

How can I achieve this simple HUD (printing messages aligned to the window's corners)?

Edit #1:

This is what I see (terrain and message below):

I want the message to be aligned at the bottom left corner as well as other messages.

sentences:
Moving a character according to the animation, rather than code I'm using 3ds Max to export character animations in which my character is moving. I expected this to mean that the character will move in Unity, but it doesn't...

For example, if my animation (in 3ds Max) moves my character forward for a second, from 0,0,0 to 1,0,0, in Unity, the character snaps back to 0,0,0 once the animation ends.

Is there a way to change the position of the character according to the animation, without something like CharacterController.Move?

sentences:
Any way to embed Pygame in webpages? I have a Pygame game, and I was wondering if there was any way to embed it into a webpage to make it easily playable, or if there is a games website that accepts Pygame games.

EDIT: I am now using Unity and am not after the answer anymore, but please answer if you want as it could help others.

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:
Blending Modes in LWRP Particles I created a particle effect using a material created from Particles/Simple Lit shader with an image of white circle tinted red through Start Color setting. On the left I have Alpha Blending Mode and on the right Premultiply Blending Mode.

Why do I get black lines on the left?

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:
Better way of handling the relation between Bullet and Enemy I was wondering how should I design this relation in terms of "better OOP"?

Should I have a Singleton EnemyManager which contains a list of enemies (EnemyList); then Bullets can access the EnemyList to check for collision?

Or should I just pass EnemyManager as a reference to each Bullet so Bullets can still access the EnemyList but not in a Singleton way?

Or is there any other better ways of doing?

Please advise.

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:
Heir Class Constructor Throws CS7036 "No Argument Given" Exception I'm trying to create a class that holds the data for an an attack, called Attack. I also have special attacks that have more properties, and so I wanted to create a different class that inherits all of the properties of Attack while adding some more, so I created a class called Special that inherits Attack.

This is what my class structure looks like:

public class Attack
{
    public Attack()
    {

    }

    public class Special : Attack
    {
        public Special()
        {

        }
    }
}

My compiler is okay with this. However, as soon as I try adding arguments to the constructor of the Attack class, for example...

public class Attack
{
    public Attack(float damage, float staminaCost)
    {

    }

    public class Special : Attack
    {
        public Special()
        {

        }
    }
}

My compiler throws an error:

Line 13: There is no argument given that corresponds to the required formal parameter 'damage' of 'Attack.Attack(float, float)'

I don't understand why I'm getting this error. I'm not calling Attack(float damage, float staminaCost), so why is it giving me grief over arguments? I tried un-nesting the classes but it doesn't make a difference. I need the constructor for Attack.Special to take in different arguments. Can someone help me achieve this?

sentences:
Best method for selecting points from a point set - path distance having a big set of points and a polygonal path what is the best way to select a set of points that are at a certain distance or smaller from the path?
Or do I need to iterate thru all points on each segment?

More Info:

Points are randomly distributed in 2D space as well as path coords.
Path segments can vary from 10 to 100.
There can be like 100 points that needs to be selected
Incoming data is a vector of points for path, a vector of points to find the nearest one and a radius

sentences:
LibGDX Deployment questions A few questions from LibGDX newbie:

How do you deploy a Mac/Windows app? If Mac app, can this be deployed to Mac App Store?
Do you need to pay monthly (for RoboVM) for iOS development/deployment?

I am using Android Studio. Thanks!

sentences:
How to slow down a Sphere smoothly in a world controlled by force and stop it (Unity 5)? I am a beginner and I started to use Unity 5. I play with tutorials on the site and documentation. I was basically testing springs, physics materials etc.

I have a problem understanding probably a very basic thing:

I have a Sphere (Collider + Rigidbody) and a Ground (Mesh Collider).
I add force to Sphere on FixedUpdate with GetAxis method.
I added Physics material to both sphere and the ground to create a friction.
Ball slows down when I do not touch the keys (no new forces) but it never stops while moving on the ground.
I know that as only 1 point is touching the gorund friction may not be good enough, but it almost does not affect the ball after a certain period. (I print the speed of the ball (Sphere) on a GUIText so I can numerically check it there too.)
I am aware of default Sleep treshold value but it will effect everything as it is a global variable, so I can't use that.
So, ball never sleeps.
I am aware of drag and angular drag (like the friction of Air) of Rigidbody component and they for sure work, BUT it feels like the ground is sticky and ball stops very quickly. It doesn't look smooth and natural.

Is there something that I am missing? The only way to do this is checking the speed of the ball and making it sleep manually when it's speed is low? Isn't there any other method? I don't want to do this as the world itself must live itself: I don't want to check movement of every single object..

This is probably one of the most basic things, but I cannot understand why it doesn't work..

sentences:
Unreal MouseWheelAxis negative axis does not work Would like to avoid using separate action mappings i.e. MouseWheelUp and MouseWheelDown for a system I'm developing.

I noticed MouseWheelAxis and put that as my axis event. This only works on the forward movement of the mouse wheel, and not on the backwards, as stated. (presumably because the scale is set to +1.0)

Why?

And how can I get around this?

sentences:
MonoGame deltaTime isn't the same in Draw function as in Update function In the Update function gameTime.elapsedGameTime.TotalSeconds always gives me 0.01666666667 which is the deltaTime value for 60 FPS, no matter if the FPS is 30 it always shows me 0.01666666667 but the Draw function on the other hand shows 0.03333333333 if the FPS is 30.

Is this a bug or is this how it is meant to be? Should I just create a variable called deltaTime and make it equal to gameTime.elapsedGameTime.TotalSeconds in the Draw function? Maybe this is a problem on Macs only

(I'm on a mac and I'm using Xamarin Studio MonoMac to build the project)

sentences:
Reflections on moving water I've been working on a simple game with semi-realistic water. I followed some tutorials to get:

a flat water surface
reflection and refraction (blended using fresnel term)
ripples using a bump/normal map

Next step, I created a mesh to form actual waves. I'm animating it, and it looks great (for my intents and purposes).

Normally, to get the reflection, I would render everything on a second camera, which is actually the normal camera, but mirrored over the water plane, like in the image below:

Then, just sample that camera's output to find the reflected color.
Obviously, this technique doesn't work if the water level isn't consistent. In other words, with an animated mesh, this looks terrible.

Can anybody suggest a different way to implement reflections? Or show a workaround method?

sentences:
Game design for lumosity type games This must be a odd question. My company asked me to design some games similar type of lumosity (http://www.lumosity.com/). I guess someone already played those games. I fight with them, saying , the algorithm behind is proprietor and gave a reference of below link:

http://www.lumosity.com/blog/brain-performance-index-what-is-bpi/

They said, keep the algorithm in BLACK BOX and go ahead of designing the game. Now I have no idea how to start without that algorithm. So I need experts suggestions. Anyone have any idea about this, I mean how to think/design about the games? Should I simply tell them, it is not possible, you can fire me?

sentences:
change direction navmesh agent on collision encounter I have one player and many enemies. The enemies are following my player through the navigation mesh. Sometimes enemies get stuck because there is another enemy in-front of them. You can say both are in line.

Is it possible that when one enemy collides with other enemy in-front of it to change direction so that it avoids colliding with one another?

sentences:
What is the best option to implement buttons as player controls? I am familiar with programming, but new to Unity. There seems to be a million ways to implement a right and left button for turning the plane. I'm wondering what the standard/easiest/best way to do this would be.

Do I make a single script that references the two sprites "left" and "right" and then detects mouse clicks and figures out whether they are over the sprite?

Should the buttons even be sprites / game objects? Or is there a better option for UI objects?

Should the left and right buttons both have their own scripts?

ps. I absolutely can't stand video tutorials, and it seems like that's all there is for unity :'( so if there is a good written tutorial on unity desgin patterns, let me know please :)

sentences:
How can I turn a Unity game into an MRAID-compliant playable ad? I need to create a mini-game, one really simple scene, and export it as a playable that comply with the MRAID requirements.
Basically, I can export a WebGL.
The question is which adaptations the code needs to have (if any) in order to become compatible with MRAID.
I saw the Luna tool that claims to solve this issue and export the scene on its own engine, to avoid any future adaptations, but honestly, I don't really understand what they're doing differently, if their engine still converts to JS and HTML5.
It seems really blurry at the moment and I can't find concrete, coherent answers.
All I'm getting from the company that approached my to get it done is "it needs to be MRAID compatible".
Does anyone have any experience and can shed some light on this subject?
Thanks in advance,
Omer

sentences:
WebGL geometry calculations I have a dynamic surface in WebGL, that is animated in vertex shader. I want other objects to interact with this surface (for example, an object riding on dynamic terrain). What's the best way to do this? Should all these calculations be done on CPU? Is there a way to calculate this stuff on GPU?

Basically, what I want is vertex shader with access to other (already transformed) vertices -- that would be perfect.

sentences:
How to update game handle touch input faster I'm making a LibGDX game where the player needs to tap to jump. But in this game, the player has to tap extra fast because the player needs to jump extra fast.

The problem is, the program can't register the taps fast enough to keep up with the user.

I've tried to handle the input 3 times per frame, but that turned out to be very problematic.

public void handleInput(float dt){
        if(Gdx.input.justTouched()){
                player.jump();
        }
    }

@Override
    public void render(float delta) {
        handleInput(dt);
        handleInput(dt);
        handleInput(dt);

        //handle everything else down here

    }

Are there any other ways to handle input at the speed of the user?

sentences:
Recommend a game engine with 2D GUI for a UI-intensive strategy game Yes, this is another recommend game engine request; the 'twist' is I am doing a strategy game and on top of sprites, animation and abstraction of input controls, it has to have GUI support for rather complex controls, such as scroll-bars, select boxes, buttons and such.

I  have tried XNA with various GUI libraries, but the problem is that those libraries was not 'completed'.
 I am just wondering if there are other engines which I can look at?

sentences:
How do we attract more developers and other Volunteers to our Open Source MMO Emulation Project? I am on a small development team that is tasked with completing the server side programming for an Open Source MMO project that has been in progress for about 5 years now. Approximately a year ago we Open Sourced the project hoping to draw in new developers, this was without much success and in fact we haven't gained even one active developer in our project. The Project Star Wars Galaxies A New Hope, is something near and dear to myself and the other few people working on the project. It is a quest to bring back one of the golden eras in gaming, Patch 14.1 for Star Wars galaxies.

The progress as of this summer was extremely slow and it seemed as if we were taking two steps forward and one back every change we made. The codebase wasn't designed very well and we looked into completely rewriting it from scratch. After a couple of weeks we realized this couldn't be done in a timely manner and perhaps we should take another look at the old core to see if we couldn't revive it. We found it was worth just revamping the old core and continuing to push forward, we've made some really good changes that will help with the future of development. One reason we didn't really want to push heavy developer recruiting was the state of the existing codebase.

Now that it is somewhat cleaned up, how do we go about recruiting quality individuals that are interested in finishing up this Open Source MMO project and delivering what we promised to the community?

Github Project

sentences:
Splitting tileset into individual tiles I'm trying to split a tileset (from here) into individual tiles.

For debugging purposes I wrote some code to split the tileset into individual tiles and display them on screen, but some aren't being split correctly.

There are some small icons after the mob in the 3rd line from the bottom that got mixed up because they seemed to be smaller than 32x32.
Here is my code for splitting them:

public class TilesetEngine : Game
{
    Dictionary<int, Texture2D> individualTiles = new Dictionary<int, Texture2D>();

    public void LoadTiles(string szFileName, ContentManager content, GraphicsDevice graphicsDevice)
    {
        var foo = content.Load<Texture2D>(szFileName);

        Color[] imageData = new Color[foo.Width * foo.Height];
        foo.GetData<Color>(imageData);

        var horizontalElements = foo.Width / 32;
        var verticalLines = foo.Height / 32;

        var i = 0;

        for (int y = 0; y < verticalLines; y++)
        {

            for (int x = 0; x < horizontalElements; x++)
            {
                var startRect = new Rectangle(x * 32, y * 32, 32, 32);

                var colorPiece = getImageData(imageData, foo.Width, startRect);
                var subTexture = new Texture2D(graphicsDevice, 32, 32);
                subTexture.SetData<Color>(colorPiece);
                individualTiles.Add(i, subTexture);

                i++;
            }
        }
    }

    public IEnumerable<Texture2D> GetTiles()
    {
        return individualTiles.Values.AsEnumerable<Texture2D>();
    }

    Color[] getImageData(Color[] colorData, int width, Rectangle rectangle)
    {
        var color = new Color[rectangle.Width * rectangle.Height];
        for (int x = 0; x < rectangle.Width; x++)
            for (int y = 0; y < rectangle.Height; y++)
                color[x + y * rectangle.Width] = colorData[x + rectangle.X + (y + rectangle.Y) * width];
        return color;
    }
}

Usage

        tileEngine = new TilesetEngine();
        tileEngine.LoadTiles("fantasy-tileset", Content,GraphicsDevice);

Drawing code

        spriteBatch.Begin();

        int i = 0;
        int padding = 10;
        var tiles = tileEngine.GetTiles();

        var maxPerLine = 10;
        var count = 0;
        var vertLine = 0;

        foreach (var p in tiles)
        {
            spriteBatch.Draw(p, new Rectangle(count * 32 + padding * count, vertLine * 32 + padding * vertLine, p.Width, p.Height), Color.White);
            count++;

            if (count == maxPerLine)
            {
                count = 0;
                vertLine++;
            }
        }

        spriteBatch.End();

I don't believe this is the best way, since I always found tilesets with pictures with variable size, what would be the best way to detect an individual tile from a tileset and split it?

sentences:
Controlling Instantiation I have an problem where I instantiate a GameObject and it keeps on instantiating a million times over, even though I put the line of code under the start function.

I am trying to have the player collide with the coin(then a point is added to your score) , then the coin deletes itself and then re-instantiates at a random coordinate, but I cant get past the initial instantiation.

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

public class Coin : MonoBehaviour {
public GameObject coins;
Vector2 randomPosition;
public UIScript _UIScript;

// Use this for initialization
void Start () {
    _UIScript = GameObject.FindWithTag("UI").GetComponent<UIScript>();
    randomPosition = new Vector2(Random.Range(-8f, 8), Random.Range(-4f, 4f));
    Instantiate(coins, randomPosition, Quaternion.identity);
}

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

}
private void OnTriggerEnter2D(Collider2D coinCollision)
{
    switch(coinCollision.tag)
    {
            case "Player":
            collisionWithPlayer();
            break;
    }
}
private void collisionWithPlayer()
{
    _UIScript.highScore = _UIScript.highScore + 1;
    Object.Destroy(coins);
}
}

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:
How do I go about hiring Level Designers from the Modding community? The company I'm working for is growing fast and there's been talk of trying to hire level designers from the modding community. My question is simply, where would be good places to look for this, and how would we go about vetting who to hire?

Does anyone have any experience of this?

sentences:
How do I inform the end user about cheat codes? I have added an interface to input cheats, and of course the backend of this.

Current cheats include:

unlimited health
unlimited time
faster movement
no need to use keys (I have a door/key system)
triple firing lasers (normally there is only one)
grenades (changes your weapon to grenades)

How will I tell the user the cheat codes? Normally, cheats would be sold by the programmer, but this isn't that sort of game currently.

sentences:
How to randomly create stars in the background? My player flies around the screen in any direction he wants, and the camera follows him. There are stars in the background.  I can't figure out how to randomly generate the stars.  I made a star class.  There are a few different types of stars, and some have different depths than others, hence they move slower as the player moves around.  I can create a stars around the player when the game starts, and when they get 100 pixels off the screen they are destroyed, but I can't figure out a good way to create new stars.

Here is my code:
Star Class:

#pragma once

struct Star
{
int xposition, yposition;
int type;
int velocity;

bool alive;

Star()
{
    xposition = yposition = 0;
    type = 0;
    velocity = 0;
    alive = false;
}

void create( int p_xposition, int p_yposition, int p_velocity, int p_type )
{
    xposition = p_xposition;
    yposition = p_yposition;
    velocity = p_velocity;
    type = p_type;

    alive = true;
}

void destroy()
{
    alive = false;
}
};

Background Class:

#include "background.h"

void Background::init( Engine* p_engine, SDL_Rect* p_camera )
{
engine = p_engine;
camera = p_camera;

delta_time = SDL_GetTicks();

for ( int s = 0;  s < 100;  s++ )
{
    stars[s] = new Star;
}

image[0] = engine->load_image( "star 1.png" );
image[1] = engine->load_image( "star 2.png" );
image[2] = engine->load_image( "star 3.png" );
image[3] = engine->load_image( "star 4.png" );

for ( int s = 0;  s < 30;  s++ )
{
    for ( int s2 = 0;  s2 < 100;  s2++ )
    {
        if ( stars[s2]->alive == false )
        {
            stars[s2]->create( rand() % engine->screen_width, rand() % engine->screen_height, rand() % 30, rand() % 4 );
            break;
        }
    }
}
}

void Background::cleanup()
{
for ( int s = 0;  s < 100;  s++ )
{
    delete stars[s];
}

for ( int i = 0;  i < 4;  i++ )
{
    SDL_FreeSurface( image[i] );
}
}

void Background::logic()
{
delta_time = SDL_GetTicks() - delta_time;

  //destroy stars
for ( int s = 0;  s < 100;  s++ )
{
    if ( stars[s]->alive == true )
    {
        if ( stars[s]->xposition < camera->x - 100 || stars[s]->xposition > camera->x + camera->w + 100 )
        {
            stars[s]->destroy();
        }
    }

    if ( stars[s]->alive == true )
    {
        if ( stars[s]->yposition < camera->y - 100 || stars[s]->yposition > camera->y + camera->h + 100 )
        {
            stars[s]->destroy();
        }
    }
}

  //create stars
if ()
{

}

delta_time = SDL_GetTicks();
}

void Background::render()
{
for ( int s = 0;  s < 100;  s++ )
{
    if ( stars[s]->alive == true )
    {
        engine->apply_surface( image[stars[s]->type], engine->buffer, stars[s]->xposition - camera->x, stars[s]->yposition - camera->y );
    }
}
}

sentences: Storing attributes in static geometry I have a Minecraft like world where I statically create one instance of each tile type, and then place it around the world. However, I don't know how to actually change individual attributes for each tile. For instance, I need to change the lighting per tile, but if I do, it'll change the color of ever single tile. I was thinking about storing two arrays per chunk, one for the tiles and one for the light, and when I want to change the lighting, I can just change the value in the lighting array that coincides with the position in the tile array. However, this will mean I'll have to have store twice as much data per chunk, but is it something I have to accept?

sentences:
How can I create a resizeable 2D camera with parallax scrolling? I want to create a Windows Phone jump-and-run game with parallax scrolling. The character should always be in centered in the viewport.

I use the following camera so that the viewport looks on every resolution the same:

Vector2 vp, gameWorldSize = new Vector2(800, 480);
vp = new Vector2(GraphicsDevice.Viewport.Width, GraphicsDevice.Viewport.Height);
ScaleX = vp.X / gameWorldSize.X;
ScaleY = vp.Y / gameWorldSize.Y;
Scale = Math.Min(ScaleX, ScaleY);
Vector2 PlayerPosition;
Vector2 Viewport;
float Scale;

public Matrix GetMatrix(float scrollingspeed)
{
  return Matrix.CreateTranslation(new Vector3(-PlayerPosition.X, -PlayerPosition.Y, 0) * scrollingspeed)
   * Matrix.CreateScale(Scale, Scale, 1)
   * Matrix.CreateTranslation(Viewport.X / 2, Viewport.Y / 2, 0);
}

I draw the sprites like this:

spriteBatch.Begin(SpriteSortMode.BackToFront, BlendState.AlphaBlend, null, null, null, null, camera.GetMatrix(0.8f));
  BackgroundLayer1.Render(spriteBatch);
spriteBatch.End();
spriteBatch.Begin(SpriteSortMode.BackToFront, BlendState.AlphaBlend, null, null, null, null, camera.GetMatrix(1.0f));
  Player.Render(spriteBatch);
spriteBatch.End();

//in the Player class:
batch.Draw(Playertex, new Rectangle(400, 240, Playertex.Width, Playertex.Height), null, Color.White, 0, new Vector2(Playertex.Width / 2, Playertex.Height / 2), SpriteEffects.None, 0f);
//in the BackgroundLayer1 class:
batch.Draw(Background1tex, new Rectangle(400, 240, Background1tex.Width, Background1tex.Height), null, Color.White, 0, new Vector2(Background1tex.Width / 2, Background1tex.Height / 2), SpriteEffects.None, 1.0f);

The camera is working fine and the player is always in the center of the viewport, but I don't know how to implement Parallax Scrolling. What is the best way to implement Parallax Scrolling?

How can I create a resizeable 2D viewport that follows the player and supports parallax scrolling?

UPDATE1:
In addition, the background sprites shouldn't repeat in a loop, because I have ten 800x480 pixel sprites that are drawn one after another. For example, the first sprite is drawn at (0,0), the second at (800,0), the third at (1600,0), …
The last sprite(number 10) is the end of the level. The player can move back but not further. I will create more than one layer of sprites, but every layer with a different speed factor to create the Parallax Scrolling.

How can I add the speed factor so that the background sprites move slower than the player sprite?

UPDATE2:
If I draw "BackgroundLayer1" with a scrolling speed of 1.0f, the sprite is drawn on the correct position, but if I change the scrolling speed to another value(for example 0.8f), then the sprites of "BackgroundLayer1" aren't drawn on the correct position.

Why are the sprites of "BackgroundLayer1" not drawn on the same position if I change the scrolling speed? What is wrong? The sprites should be drawn on the same positions, even if I change the scrolling speed.

In these two pictures, you see the differences if I change the scrolling speed of BackgroundLayer1:

scrollingspeed = 1.0f

http://s1.directupload.net/images/140505/qdi6cqwz.jpg

scrollingspeed = 0.8f

http://s1.directupload.net/images/140505/56ferzuv.jpg

sentences:
How to attach a sprite to a TMXTiledMap at a particular coordinate, in AndEngine? I am trying to add a sprite at a "grid" location on the tiled map. The TMX tiled Map is like a grid, and you can access the size of the grid by calling mTMXtiledMap.getTileRows() and mTMXtiledMap.getTileColumns().

I want to add an object at grid location, say (2, 5). My tileMap is of size (10,10).

How can I do that? There is no function like mTMXTiledMap.addChild(int x, int y, Entity mEntity).

I would appreciate any suggestions!

sentences:
How do I figure out if a point is infront or behind my vehicle? I need to figure out whether a point is infront or behind my vehicle.

I have the vector of it's position, forward direction.

So far I have tried finding the vector perpendicular to its forward direction and then calculating what side of the line it is positioned on.

This works fine at first. But then I realised it is only calculating around the origin.

bool Car::isInfront(ngl::Vec2 _pos)
{
//http://stackoverflow.com/questions/1243614/how-do-i-calculate-the-normal-vector-of-a-line-segment

//if we define dx=x2-x1 and dy=y2-y1, then the normals are (-dy, dx) and (dy, -dx).

//create vector per to the direction of travel.
ngl::Vec2 fwdVec = m_carPhysics->getForwardVec2();
ngl::Vec2 pos = m_carPhysics->getPosVec2();

ngl::Vec2 dir = pos + fwdVec;

float dx = dir.m_x - pos.m_x;
float dy = dir.m_y - pos.m_y;

ngl::Vec2 v1(-dy, dx);
ngl::Vec2 v2(dy, -dx);

ngl::Vec2 perp = (v1) - (v2);

int turn = getLeftOrRight(_pos, perp);

if(turn == LEFT)
{
    return true;
}
else
{
    return false;
}

int Car::getLeftOrRight(ngl::Vec2 _dir, ngl::Vec2 _fwd)
{
//http://gamedev.stackexchange.com/questions/34536/calculating-angle-between-two-vectors-to-steer-towards-a-target
//cross product;
float val = (_dir.m_x * _fwd.m_y) - (_dir.m_y * _fwd.m_x);

if(val > 0)
{
    return LEFT;
}
else
{
    return RIGHT;
}

}

sentences:
When is the CheckResources() function called? This question is asked in the context of image effect shader implementations in Unity.

Looking through the scripts for image effects in the standard assets package, I notice that initialization is generally done in the CheckResource() function.

The following is a snippet of code from the BloomAndFlares image effect.

public override bool CheckResources()
{
    CheckSupport(false);

    screenBlend = CheckShaderAndCreateMaterial(screenBlendShader, screenBlend);
    lensFlareMaterial = CheckShaderAndCreateMaterial(lensFlareShader, lensFlareMaterial);
    vignetteMaterial = CheckShaderAndCreateMaterial(vignetteShader, vignetteMaterial);
    separableBlurMaterial = CheckShaderAndCreateMaterial(separableBlurShader, separableBlurMaterial);
    addBrightStuffBlendOneOneMaterial = CheckShaderAndCreateMaterial(addBrightStuffOneOneShader, addBrightStuffBlendOneOneMaterial);
    hollywoodFlaresMaterial = CheckShaderAndCreateMaterial(hollywoodFlaresShader, hollywoodFlaresMaterial);
    brightPassFilterMaterial = CheckShaderAndCreateMaterial(brightPassFilterShader, brightPassFilterMaterial);

    if (!isSupported)
        ReportAutoDisable();
    return isSupported;
}

I am probably wrong in assuming that this is essentially the Start() or Awake() functions for PoseEffectsBase, but I decided to try implementing something simillar.

public override bool CheckResources()
{
    saturationPassMat = CheckShaderAndCreateMaterial(saturationPassFilter, saturationPassMat);

    if (!isSupported)
        ReportAutoDisable();
    return isSupported;
}

Unlike the standard asset scripts, CheckResources() does not seem to be called consistently for me. Unity console throws UnassignedReferenceExceptions every frame, for the object saturationPassMat.

When is the CheckResources() function called? Should it be used for initialization just like Start()?

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:
Unity low level network API I was trying out Unity Network LLAPI, I am following the this tutorial. I wrote everything the same, my server starts well and good with no errors.

When my client tries to add host

int hostId = NetworkTransport.AddHost(topology, port);

like this, it crashes with this error

Cannot open socket on ip {*} and port {12000}; check please your network, most probably port has been already occupied
UnityEngine.Networking.NetworkTransport:AddHost(HostTopology, Int32, String)
Client:Connect() (at path/to/game/files/Client.cs:35)
UnityEngine.EventSystems.EventSystem:Update()

Now if I change port on client side it says Wrong IP or Port.

I tried looking but didn't find much. Don't know what is wrong. Also I'm on Linux

sentences:
How to get chunks in a sphere rather than cuboid I have a chunk system to load stars around the player. It takes a given "real" loading range (aka Unity-units of range), calculates the necessary chunk loading range (as integer), creates star GameObjects within the loading range on screen, and stores stars in cache which are within chunk loading range but outside of real loading range.
Chunks are stored in a dictionary with the key being a struct consisting of x,y,z integer coordinates. Available data are:

Real position of the player
Current chunk of the player
Center point and size of each chunk (same size for all)
I know when the player steps into another chunk

A quick calculation revealed that if I'd be able to load chunks spherically instead of cubically, I would be able to load ~40% less chunks. The amount of chunks I have to grab (currently) can vary, ranging from a range of 3 to ~8 (meaning minimum of (2*3+1) 7*7*7=343 to (2*8+1) 17*17*17=4913). Current Code:

    public Chunk[,,] GetChunksInCuboid (Coordinate coords, int range)
    {
        return GetChunksInRectangle (new Coordinate (coords.x - range, coords.y - range, coords.z - range), new Coordinate (coords.x + range, coords.y + range, coords.z + range));
    }

    public Chunk[,,] GetChunksInCuboid (Coordinate min, Coordinate max)
    {
        int xLen = max.x - min.x + 1;
        int yLen = max.y - min.y + 1;
        int zLen = max.z - min.z + 1;

        Chunk[,,] A = new Chunk[xLen, yLen, zLen];

        for (int x = 0; x < xLen; x++)
        {
            for (int y = 0; y < yLen; y++)
            {
                for (int z = 0; z < zLen; z++)
                {
                    A[x, y, z] = GetChunk (x + min.x, y + min.y, z + min.z);
                }
            }
        }

        return A;
    }

My question is the following: Is it possible, and if yes, how can I performantly load chunks in a sphere?

sentences:
Optimized linear to sRGB GLSL I'm currently using a simple implementation of  linear to sRGB transform:

float sRGB(float x) {
    if (x <= 0.00031308)
        return 12.92 * x;
    else
        return 1.055*pow(x,(1.0 / 2.4) ) - 0.055;
}
vec3 sRGB_v3(vec3 c) {
    return vec3(sRGB(c.x),sRGB(c.y),sRGB(c.z));
}

Possibly, that the correction for small values (x <= 0.00031308) will not matter in practice.

I considered to just let ´pow(x, 1.0 / 2.4) but I'm not sure how much impact it will have.

Is there any way to optimize it?
Can be vectorization help?
Can some polynomal fitting be better?

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:
Finding the last GO in a set of generated objects? I currently generate the maptiles using Tags purely, which works great but doesnt satisfy my needs. I want to delete tiles that i dont need(since my player will only be going to the right)  but I have a problem with checking when to delete old tiles so that i can generate new ones. My idea would be checking how close the player is to the last tile given and then delete the first, but i cant do that with tags since tags are given in the order that unity finds the GOs with that tag and not from left to right AFAIK. What would be the best way to get the last ground tile? (the one that got generated last).

using UnityEngine;
using System.Collections.Generic;

public class MapGenerator : MonoBehaviour

{
    private GameObject[] groundTiles;

/// <summary>
///  Represents the minimum amount of active tiles needed
/// </summary>
public int ActiveTiles;

void Start()
{
}

void Update()
{
    groundTiles = GameObject.FindGameObjectsWithTag("ground");

    if (groundTiles.Length < ActiveTiles)
        SpawnTile();
}

public void SpawnTile()
{
    GameObject tile = (GameObject)Instantiate(groundTiles[groundTiles.Length-1]);

    Vector3 tmpVec = tile.transform.position;
    tmpVec = tile.transform.position;
    tmpVec.x += 1;
    tile.transform.position = tmpVec;
}

public void DespawnTile(int tileIndex)
{
    List<GameObject> tmp = new List<GameObject>(groundTiles);
    tmp.RemoveAt(tileIndex);
    groundTiles = tmp.ToArray();
}
}

sentences:
How to organize a fallback system for older GPUs in OpenGL? I don't want to make this question too broad or opinion based, but I really need some help about good practices.

The scenario:

I created a particle engine with functions which require at least OpenGL 4.3. But some GPUs don't support this version, so I want to try to implement a fallback system for it.

But it's not only the particle system. There are many features in 3D engines that can't be simply replaced by a different function name. Some features need different logic behind them and it can go quite complex.

What are the best practices to manage fallback rendering in OpenGL?

sentences:
Techniques for separating game model from presentation I am creating a simple 2D game using XNA.

The elements that make up the game world are what i refer to as the "model".

For instance, in a board game, i would have a GameBoard class that stores information about the board.

This information could be things such as:

Location
Size
Details about cells on the board (occupied/not occupied)
etc

This object should either know how to draw itself, or describe how to draw itself to some other entity (renderer) in order to be displayed.

I believe that since the board only contains the data+logic for things regarding it or cells on it, it should not provide the logic of how to draw things (separation of concerns).

How can i achieve a good partitioning and easily allow some other entity to draw it properly?

My motivations for doing so are:

Allow multiple "implementations" of presentation for a single game entity
Easier porting to other environments where the presentation code is not available (for example - porting my code to Unity or other game technology that does not rely on XNA).

sentences:
Center Gravity in Unity a 2d planet in the center, where the players will be able to walk on it and also will be affected by center gravity. planet will be static and there won't be any other planets. so;

Is there a way that I can change the gravity position? yes you can adjust gravity via project settings but I want it to be in the middle x,y,z(0,0,0)

I have tried creating my own gravity but it wasn't very useful because objects wouldnt fall, stand on foot and also in contact with another object they would vibrate instead of standing still. (if they stand on the planet they would vibrate)

        private void FixedUpdate()
{
    foreach(GameObject item in grav)
    {
        Attact(item);
    }
}

private void Attact(GameObject gmf)
{
    Rigidbody2D rgg = gmf.GetComponent<Rigidbody2D>();

    Vector3 direction = rg2d.position - rgg.position;
    float distance = direction.sqrMagnitude;

    float forceMag = (10 * rgg.mass) / distance;
    Vector3 force = direction.normalized * forceMag * 10;

    rgg.AddForce(force);
}

I can create a script that will change the gravity by the opposite of the object's position. this does work but I cannot see any way to do it for more than one object.

sentences:
Translating an Object to a certain Vector 3 in OpenGL and Java LWJGL So after almost two hours, I got the hang of using glTranslated() (with Java and LWJGL). If I am correct, applying glTranslated on an object moves that object with the x,y,z relative to the previously moved object. I believe the correct term for this is local vs global, global being the one I want. I was wondering if there was a way to translate an object to a specific XYZ position, or relative to the origin. Thanks!

(Code or other details can be supplied if it helps, just let me know. Also sorry if this is a noob comment, Im very new to OpenGL.)

sentences:
What is AABBvsAABB Collision detection? Currently studying Game Engineering at university and my lecturer has asked us to implement a collision manager. He asks us to use AABBvsAABB to build it, so then we can add the physics.

My question is and if anyone can answer it as simple as possible (as the notes he uses I am still lost).

What exactly is AABBvsAABB for collision detection?

Any links to sites that explain it or just some basic examples would be appreciated.
EDIT: links or examples that explain it in simple terms, I can't seem to find any :(

sentences: Collision test solution for hack&slash game I want to ask you what is the best way to deal with collisions in hack&slash game, I know that collisions must be very accurate. My first idea is to use sphere bounds ( I making hack&slash in 3d), but how to deal with hitting with sword some enemy, do you know some better solution for this type of game ?

sentences:
How do I procedurally animate a cell eating another cell? The entities in my game are soft-body, amorphous cells. I'd like to create an animation where enemies are engulfed by the player's cell.  That is, I want to generate a "cell eating another cell"-effect. See this video for the type of motion I want: https://www.youtube.com/watch?v=iO_vOFFf1uQ

I'm considering using fluid dynamics to achieve this, but I'm lost as to where to start. I'm working in Unity2D, and Fluvio doesn't seem to provide what I need.  Does anyone have advice on the best way for me to proceed?

sentences:
What's a way to implement a flexible buff/debuff system? Overview:

Lots of games with RPG-like statistics allow for character "buffs", ranging from simple "Deal 25% extra damage" to more complicated things like "Deal 15 damage back to attackers when hit."

The specifics of each type of buff aren't really relevant.  I'm looking for a (presumably object-oriented) way to handle arbitrary buffs.

Details:

In my particular case, I have multiple characters in a turn-based battle environment, so I envisioned buffs being tied to events like "OnTurnStart", "OnReceiveDamage", etc.  Perhaps each buff is a subclass of a main Buff abstract class, where only the relevant events are overloaded.  Then each character could have a vector of buffs currently applied.

Does this solution make sense?  I can certainly see dozens of event types being necessary, it feels like making a new subclass for each buff is overkill, and it doesn't seem to allow for any buff "interactions".  That is, if I wanted to implement a cap on damage boosts so that even if you had 10 different buffs which all give 25% extra damage, you only do 100% extra instead of 250% extra.

And there's more complicated situations that ideally I could control.  I'm sure everyone can come up with examples of how more sophisticated buffs can potentially interact with each other in a way that as a game developer I may not want.

As a relatively inexperienced C++ programmer (I generally have used C in embedded systems), I feel like my solution is simplistic and probably doesn't take full advantage of the object-oriented language.

Thoughts?  Has anyone here designed a fairly robust buff system before?

Edit: Regarding Answer(s):

I selected an answer primarily based on good detail and a solid answer to the question I asked, but reading the responses gave me some more insight.

Perhaps unsurprisingly, the different systems or tweaked systems seem to apply better to certain situations.  What system works best for my game will depend on the types, variance, and number of buffs I intend to be able to apply.

For a game like Diablo 3 (mentioned below), where nearly any bit of equipment can change a buff's strength, the buffs are just character stats system seems like a good idea whenever possible.

For the turn-based situation I'm in, the event-based approach may be more suitable.

In any case, I'm still hoping someone comes along with a fancy "OO" magic bullet which will allow for me to apply a +2 move distance per turn buff, a deal 50% of damage taken back to the attacker buff, and a automatically teleport to a nearby tile when attacked from 3 or more tiles away buff in a single system without turning a +5 strength buff into its own subclass.

I think the closest thing is the answer I marked, but the floor is still open.  Thanks to everyone for the input.

sentences:
Unity2D: Increase spawn object movement when player collects every 10 points I want to make my spawned objects (enemy prefabs) movement speed up every 10 points my player collects.
This is my movement script, attached to my enemy prefab (so that it can be spawned in my game and move):

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

public void Update()
{
    transform.Translate(userDirection * movespeed * Time.deltaTime);
 }
}

And this is my score script attached to my player:

public Text ScoreText;
public AudioClip Coinsound;
public Text Highscoretext;
public GameObject enemy;
Movement movement;

private int Score;
public int highScore = 0;

void Start ()
{
    Score = 0;
    SetScoreText ();
    if (PlayerPrefs.HasKey ("Highscore"))
    {
        highScore = PlayerPrefs.GetInt("Highscore");
    }
}
void OnTriggerEnter2D(Collider2D other)
{
    if (other.gameObject.CompareTag ("Pick Up")) {
        other.gameObject.SetActive (false);
        Score = Score + 1;
        SetScoreText ();
        AudioSource.PlayClipAtPoint (Coinsound, transform.position);

    }
}

As mentioned before I want to make my spawned enemy prefabs to move faster when my player collects every ten points. Thank you :)

sentences:
Reusing entities across screens: game data vs. object modelling I'm working on a 2D RPG. I currently have a MainWorldScreen which has a Player entity, and some MapObjects that he can collide against. The player has a few components (sprite, keyboard input) etc. that implement specific logic for it to work in the main world screen.

The problem now arises when I start working on a "battle" screen. The crux of it is, should I reuse/extend my Player entity or create one entity per screen?

Up to now, components are all behaviour based -- sprites to display something on-screen, input components to capture and expose events to handle input, etc. My entities are a composition of components that implement game logic (eg. move on keyboard click).

If I did this as "pure" object-oriented, I would probably have a larger Player class which had all the combined attributes needed for all screens -- list of equipment, health, etc. and each screen would only take what it needs.

However, since I have components, if I reuse my player entity, it doesn't make much sense to reuse it; I will have to remove and re-add new components, since screens use completely different data, and I don't really know where the player state should go (eg. equipment).

What's the right way to handle this? Should I go with one Player entity per screen (at least with these two screens)? Should I keep player state in the entity, and just add/remove components depending on the screen when I pass it from screen to screen?

sentences:
Instance vs individual updating I am making a game in SFML, and whilst I was making an AI moving system I was wondering which would be better, If I was to instance update all my entities at once, or individually update them via a function in each of the entity class instances.

I know that instance rendering is much faster but was wondering if this would even be needed for updating the logic of the game, afterall I'm not making a giant physics simulation.

So, I am wondering what would the effect be if I updated the game logic for each entity individually or did it via instancing. And if there is an impact is it really worth it for a game like mine where there isn't too much complexity.

sentences:
Exporting WebGL For Mobile Browsers I was asked by a client to create a pretty simple 3D game that will be embedded on a website, a plain landing page that will contain the game and will be played on mobile devices.
The game itself has no complexity whatsoever, not in the functional aspect and not in the lighting/shaders aspect - the basic functionality is a simple finger swipe in order to "throw" a ball.
I have checked and concluded that opening a webGL game on mobile devices might cause issues and only high-end devices can run the game smoothly.
My question is -
Is there a go-to solution or any solution in which I can develop the game on Unity and build it for webGL in a way that it will be compatible with mobile devices?
Or my only option is to develop the game using plain JS?

sentences:
How do I fix missing anti-aliasing in the Unity scene view and game? Both the editor and the game seem to lack anti-aliasing even though quality is set to Ultra.
I chose the "3D" project template when I created the project, so I am using the build-in render pipeline.

sentences:
How to make proper animations for a html5 game? I am working on a web based MMORPG in html5.

Therefore, I think about using Phaser.io to be the main engine of the game on the client side.

I want the game to be isometric and I am wondering how to make proper sprites/animations/gfx for the game.

I don't want my graphic team to have too much pain.
Would it be possible, for example, to use any kind of "vectorial spritesheet" so that I can zoom in and have a better look at the character.

On the other hand, I don't want the "stuff" (hat, armor, etc) to be too hard to "plug" on the character in all the different orientations.

I thought about using some kind of flash like system (my game is based on the french MMO Dofus which only uses flash for its client side but no web based techno)

But I don't know anything about flash, can I integrate it inside a canvas and does it mux well with raster images like png or jpg?

What alternative could I use?

sentences:
How to make sprite move in any direction? I have an arrow sprite that rotates based on where my cursor is pointed, I can only make it move up,down,left and right.How about in a diagonal way?

//this is the rotation
nt x=Gdx.input.getX();
        int y=Gdx.graphics.getHeight()-Gdx.input.getY();

        double radians= Math.atan2(y - arrowSpr.getY(), x - arrowSpr.getX());
        float angle=(float)Math.toDegrees(radians)-85;
        arrowSpr.setRotation(angle);

//then the movement
arrowSpr.translateX(speed.x);
arrowSpr.translateY(speed.y);

sentences:
Linear gradient shader ( Photoshop-like) I'm searching a way to implement a linear gradient shader that behaves as the linear gradient in Photoshop (only the vertical case is necessary). It will be applied to 2D sprites.

Currently I'm passing to the pixel shader these parameters:

StartColor.
EndColor.
Offset: an offset applied to the gradient starting point.
Length: the gradient length (the range inside where the colors will be
interpolated).
isFixed: a boolean parameter that indicates if the
gradient must be influenced by the camera position or not.

Here a first attempt of the vertex shader and the pixel shader that I've implemented:

struct VsInput
{
    float3 position : VES_POSITION;
    float2 uv       : VES_TEXCOORD0;
    float4 color    : VES_COLOR;
};

struct VsOutput
{
    float4 position : HPOS;
    float2 uv       : TEXCOORD0;
    float4 color    : COLOR0;
    float4 outPos   : TEXCOORD1;
};

VsOutput main(VsInput input)
{
    VsOutput vsOutput;
    vsOutput.position = MUL(float4(input.position, 1.0f), WorldViewProjection);
    vsOutput.uv = input.uv;
    vsOutput.color = input.color;
    vsOutput.outPos = vsOutput.position;

    return vsOutput;
}
struct PsInput
{
    float4 Position : HPOS;
    float2 UV       : TEXCOORD0;
    float4 Color    : COLOR0;
    float4 outPos   : TEXCOORD1;
};

float4 startColor;
float4 endColor;
float offset;
float len;
bool isFixed;

float4 main(PsInput psInput) : COLOR
{
    psInput.outPos = psInput.outPos / psInput.outPos.w;
    float yScreenSize = 900.0f;
    float yPixelCoordinate = 0.0f;
    if (isFixed)
    {
        yPixelCoordinate = 0.5f * (1.0f - psInput.UV.y) * yScreenSize;
    }
    else
    {
        yPixelCoordinate = 0.5f * (psInput.outPos.y + 1.0f) * yScreenSize;
    }

    float gradient = (yPixelCoordinate + offset) / len;
    gradient = clamp(gradient, 0.0f, 1.0f);
    return lerp(startColor, endColor, gradient);
}

When isFixed is false I want the gradient influenced by the camera position. But my shader is wrong, since the starting point of the gradient is the bottom of the window instead of the bottom of the sprite.
The question is: how can I modify the shader in order to have the gradient starting from the bottom of the sprite? Maybe I need the size of the sprite in pixel? Or there are other convenient ways?

The other question regards the "fixed gradient": if I want the gradient not influenced by the camera position, what is the convenient way? It's possible to have these two behaviors in the same shader?

Thanks.

Edit: more details based on DMGregory suggestion.

Maybe the sentence gradient influenced by the camera, it is not correct. I'll try to be more clear with a few images (taken using the shaders above).

In the first image you can see a base sprite (in black) with an orange gradient applied to it. On top of the base you can see the player sprite; the camera is attached to this one.

In the second image the player has jumped and the camera follows him: the isFixed attribute is false and, as you can see, the gradiend moves with the player and the camera.

The third image shows the same situation of the second image, but the isFixed attribute is true and, as you can see, the gradient don't moves with the player and the camera.

I hope it's a bit more clear what I'm looking for.

sentences:
How to load multiple 3D models dynamically xna I want to load multiple 3D models .fbx at the same time in my map display.
I can load First Model but when I use ContentBuilder to Load another Model, I Got Error in effect.EnableDefaultLighting ();
This my load function

private void loadToolStripMenuItem_Click(object sender, EventArgs e)
        {
            OpenFileDialog fileDialog = new OpenFileDialog();

            // Default to the directory which contains our content files.
            string assemblyLocation = Assembly.GetExecutingAssembly().Location;
            string relativePath = Path.Combine(assemblyLocation, "../../../../Content");
            string contentPath = Path.GetFullPath(relativePath);
            fileDialog.InitialDirectory = contentPath;
            fileDialog.Title = "Load Model";
            fileDialog.Filter = "Model Files (*.fbx;*.x)|*.fbx;*.x|" +
                                "FBX Files (*.fbx)|*.fbx|" +
                                "X Files (*.x)|*.x|" +
                                "All Files (*.*)|*.*";
            if (fileDialog.ShowDialog() == DialogResult.OK)
            {
                LoadModel(fileDialog.FileName);
            }
        }
        void LoadModel(string fileName)
        {
            Cursor = Cursors.WaitCursor;
            // Unload any existing model.
            editorDesign1.Model = null;
           // editorDesign1.CurrentModel.Model = null;
            contentManager.Unload();
            // Tell the ContentBuilder what to build.
            contentBuilder.Clear();
            contentBuilder.Add(fileName, "Model", null, "ModelProcessor");
            // Build this new model data.
            string buildError = contentBuilder.Build();
            if (string.IsNullOrEmpty(buildError))
            {
                // If the build succeeded, use the ContentManager to
                // load the temporary .xnb file that we just created.
              editorDesign1.Model = contentManager.Load<Model>("Model");
              // editorDesign1.CurrentModel.Model = contentManager.Load<Model>("Model");
            }
            else
            {
                // If the build failed, display an error message.
                MessageBox.Show(buildError, "Error");
            }

            Cursor = Cursors.Arrow;
        }

and this is my Draw model function

public void DrawModel()
        {
            foreach (ModelMesh mesh in Model.Meshes)
            {
                foreach (BasicEffect effect in mesh.Effects)
                {
                    effect.EnableDefaultLighting();
                    effect.World = Matrix.CreateTranslation(Position) * Matrix.CreateRotationX(Rotation.X) * Matrix.CreateScale(Scale) * Matrix.CreateRotationY(Rotation.Y) * Matrix.CreateRotationZ(Rotation.Z);

                    effect.View = view;
                    effect.Projection = projection;
                }

                mesh.Draw();
            }
        }

The problem is when I create two object from my model class and use ContentBuilder to Load another Model I get an exception AccessViolationException was Unhandled Attempted to read or write protected memory. This is often an indication that other memory is corrupt  and get another exception NullReferenceException was unhandled

Can anyone help me tho solve this problem?

sentences:
libGDX AppWarp integration problem I have tried to use up AppWarp's old SuperJumper as a sample to create an up to date project from it with Gradle. Maybe it is good for learning. So, I have downloaded project from GitHub(https://github.com/SauravGShephertz/libgdxMultiplayerSuperJumper) as zip and started to build a new Gradle based libGDX project from it.
Here you can see actual state: https://github.com/kovacsa91/superjumper

I have some errors with following lines.

com.shephertz.app42.gaming.multiplayer.client.command.*;

Maybe it cannot found needed JAR file(s)? How should be it placed? Can you please check it out? Code was separated between project folders inside the main libGDX project.

sentences:
What implications does JIT (javascript/canvas) vs. AOT (Flash) have in terms of browser based game performance? In my experience, even till this day, I still see more of a visual lag in entity movement / animation in JavaScript (Canvas) based games than I do in Flash based games.

Why is this - what exactly is the descrepancy at the most basic level between an JIT vs AOT compiler in the specific scenario of JavaScript vs. Flash.

sentences:
How to make an object track another object's exact movements This script below helps me to to tell the follower object to copy exact movements of the leader object, I found this script in Unity forums and it works pretty well.

My question is how can I add some kind speed variable to it; how can I tell the follower object to move at lower speed?

 public class delayTracker : MonoBehaviour
 {
     float progress;
     const int MAX_FPS = 60;

     public Transform leader;
     public float lagSeconds = 0.5f;

     Vector3[] _positionBuffer;
     float[] _timeBuffer;
     int _oldestIndex;
     int _newestIndex;

     // Use this for initialization
     void Start()
     {
         int bufferLength = Mathf.CeilToInt(lagSeconds * MAX_FPS);
         _positionBuffer = new Vector3[bufferLength];
         _timeBuffer = new float[bufferLength];

         _positionBuffer[0] = _positionBuffer[1] = leader.position;
         _timeBuffer[0] = _timeBuffer[1] = Time.time;

         _oldestIndex = 0;
         _newestIndex = 1;
     }

     void LateUpdate()
     {
         // Insert newest position into our cache.
         // If the cache is full, overwrite the latest sample.
         int newIndex = (_newestIndex + 1) % _positionBuffer.Length;
         if (newIndex != _oldestIndex)
             _newestIndex = newIndex;

         _positionBuffer[_newestIndex] = leader.position;
         _timeBuffer[_newestIndex] = Time.time;

         // Skip ahead in the buffer to the segment containing our target time.
         float targetTime = Time.time - lagSeconds;
         int nextIndex;
         while (_timeBuffer[nextIndex = (_oldestIndex + 1) % _timeBuffer.Length] < targetTime)
             _oldestIndex = nextIndex;

         // Interpolate between the two samples on either side of our target time.
         float span = _timeBuffer[nextIndex] - _timeBuffer[_oldestIndex];
         float progress = 0f;
         if (span > 0f)
         {
             progress = (targetTime - _timeBuffer[_oldestIndex]) / span;
         }

         transform.position = Vector3.Lerp(_positionBuffer[_oldestIndex], _positionBuffer[nextIndex], progress );
     }

     void OnDrawGizmos()
     {
         if (_positionBuffer == null || _positionBuffer.Length == 0)
             return;

         Gizmos.color = Color.grey;

         Vector3 oldPosition = _positionBuffer[_oldestIndex];
         int next;
         for (int i = _oldestIndex; i != _newestIndex; i = next)
         {
             next = (i + 1) % _positionBuffer.Length;
             Vector3 newPosition = _positionBuffer[next];
             Gizmos.DrawLine(oldPosition, newPosition);
             oldPosition = newPosition;
         }
     }
 }

sentences:
Get world-position in Vertex shader I'm wondering how I can get the final position of a vertex. I use glTranslate in my render code, and I'm not getting the world-coordinates correct. My world is devided in chunks and my position get's screwed up.

I have tried multiplying the position with the 3 built-in matrices, but no success.

sentences:
How to disable Y-axis movement in the Bullet physics engine I want to create an object than only moves along the the X and Z axes, while keeping the Y-axis disabled (it's like movement in 2D, and the object wont fall down).

I'm currently using a 6 dof constraint to restrict movement in the Y-axis, but it's not working:

btRigidBody* zeroBody = new btRigidBody(0, NULL, NULL); // Create the body that we attach things to
btRigidBody* robot = mCarChassis->getBulletRigidBody();

btGeneric6DofConstraint* constrict = new btGeneric6DofConstraint(*robot, *zeroBody, btTransform::getIdentity(), btTransform::getIdentity(), false);

constrict->setLinearLowerLimit( btVector3( 1, 1, 1));
constrict->setLinearUpperLimit( btVector3(-1, 1,-1));

constrict->setAngularLowerLimit( btVector3( 1,  1,  1) );
constrict->setAngularUpperLimit( btVector3(-1, -1, -1) );

mBulletWorld->getBulletDynamicsWorld()->addConstraint(constrict);

Thanks!

sentences:
How do I detect and remove completed rows of blocks in Tetris? I am making Tetris for a learning experience in XNA, and I'm having trouble deleted completed rows.

I am having an issue with deleting rows, for some reason when I go to delete a row, I end up creating more blocks or not deleting all of the blocks in the row. The method I am using to detect and remove blocks is as follows:

    // 'rowCount' is an int[20] holding the number of blocks in each row
    // (my playing field is 20 rows tall and 10 blocks wide).
    for (int i = 0; i < rowCount.Length; i++)
    {
        if (rowCount[i] >= 10)
        {
            // The row is full, remove the blocks.
            // 'blocks' is a list of all blocks that have settled.
            for (int j = 0; j < blocks.Count; j++)
            {
                if (blocks[j].Row == i)
                {
                    // If the settled block is in this row, remove it.
                    blocks.RemoveAt(j);
                    rowCount[i]--;
                }
            }

            // Move any blocks above the now-empty row down one row.
            foreach (Block b in blocks)
            {
                if (b.Row < i)
                {
                    b.Row++;
                    rowCount[b.Row]++;
                }
            }
        }
    }

This is done in my main Update method after I've determined if the current block has settled or not.

As implemented, this algorithm will usually end up recording more than ten blocks in some rows and will not correctly clear completed rows and move the rows above down one unit. Why is this, and what can I do to fix the algorithm?

sentences:
Where is the best place to find modeling artists that are loyal? For the past 3 years I have been working on my first indie game with a few friends but had to learn how to do everything myself, from coding, to creating models in blender and how to use Unity.

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

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

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

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

sentences:
Questions about the obj file format I'm wirting my first OpenGL Application for Android at the moment and now I get stuck on the ObjectLoader for obj files. I have some qestions to this file format and I can't an answer on the internet for this. Maybe it is easier if we go throught all these questions with an example file:

#Cube file - has no texture
mtllib dice_material.mtl

v 0.475013 0.999999 -0.066651    # 1
v 0.457026 0.999999 -0.067220    # 2
v 0.439582 0.999999 -0.067505    # 3
...
vn 0.000000 1.000000 0.000000    # 1
vn 0.000000 0.999969 0.000000
vn 0.000000 0.778466 0.627674
...
f 1//1 11//1 14//1 2//1          # the first 1 references to the first v right?
f 2//1 14//1 15//1 3//1          # the first 2 references to the second v right?
f 3//1 15//1 16//1 4//1

Can I assume that allways the verticies v are on the head of the document (after some comments) followed by the texture coordinates (tv) and the normales (vn)?
If an object has a texture does the obj file allways have the texture coordinates? If not how can I calculate them on my own?
If the object has a texture is it required that the object has a material too or can an object have a texture without a material?
If the file contains the texture coordinates do the polygons (f) must contain the texture coordinates? Or is f 1//1 a valid polygon too if the file contains the texture coordinates?

sentences:
Setting Square to Dim in Color on MOUSEUP I'm trying to create a simple recreation of the popular memory game "Simon" using C and SDL2. The idea is that the game is a small window with four squares of different colors that are purposefully dim. When the player clicks on a square, I want it to "light up" until the player let's go of their mouse button, in which it returns to it's original dim color.

I have this working to an extent, but the problem is that it only works if the player let's go of the mouse button while the pointer is over the square. If they let go anywhere else, the square stays lit up.

Here is the example code:

if(e.type == SDL_MOUSEBUTTONDOWN && mouseX >= 10 && mouseX <= 110 && mouseY >= 10 && mouseY <= 110) {
    if(e.button.button == SDL_BUTTON_LEFT) {
        SDL_SetRenderDrawColor(renderer, 0, 255, 0, 255);
        SDL_RenderFillRect(renderer, &squareOne);
        SDL_RenderPresent(renderer);
    }
}

if(e.type == SDL_MOUSEBUTTONUP && mouseX >= 10 && mouseX <= 110 && mouseY >= 10 && mouseY <= 110) {
    if(e.button.button == SDL_BUTTON_LEFT) {
        SDL_SetRenderDrawColor(renderer, 0, 50, 0, 255);
        SDL_RenderFillRect(renderer, &squareOne);
        SDL_RenderPresent(renderer);
    }
}

As you can see, I'm looking for the user to be clicking in a very specific area, and waiting for them to "unclick" in that same specific area. There has got to be a better way to do this. Would anyone do me the pleasure of offering a few hints?

sentences:
Swept AABB vs Line Segment 2D I've really exhausted as much as Google has to give, I've spent a solid week googling every combination of words for an "AABBvsLine sweep", downloaded countless collision demos, dissected SAT intersection examples and an AABBvsAABB sweep trying to figure out how to approach this. I've not found a single thing covering this specific pairing.

Can anyone shed any light on how to get the hit time of a swept AABB vs a Line segment in 2D? I'm still getting familiar with the SAT but I do know how to implement it to a degree, I'm just not sure how to extract the hit time from the velocity in the non axis aligned separating axes for the sweep.

I really would appreciate anything at the moment, some code or even some helpful links, I'm at my wits end!

sentences:
Developing a browser-based RPG: Loading user data I'm writing a browser-based RPG in JavaScript, HTML5 with Canvas, EaselJS, etc... I'd like to develop the back end data saving/user profile aspect now.

This is a single player RPG where the player will interact with NPCs to solve quests. It is not online.

I've developed a website in PHP before where I saved my own data in a database, and loaded the images to the page via MySQL and PHP.

For a RPG, how would this process be? In my mind... I will try:

At the RPG menu, have a user login screen. Handle this with a traditional PHP session.
Once the user logs in, load their stats from the database.

What I'm confused about is:

Loading text data is okay I suppose... but how can I load objects that were on the screen in the correct locations at the time of the save? Can this be handled through the database?
I have generated the Players, Objects, and NPCs as Javascript objects using EaselJS. To save the state of these objects, do I have to load the character as a PHP object?

Kind of like:

/**
 * Load a character and all related items and skills.
 * Do this when the user logs in. You can save the data in a session or
 * reload it every time the user makes a new request
 */
$Character = Character::model()->with('items, skills')->find(
    'username:=username',
    array('username' => 'demo')
);

Any tips for loading appropriate data per user profile?

Thanks!

sentences:
Calling update oct-function (only if changed) Issue: How is the best way to update my units position on the oct-tree, I'm struggling with the logic, specifically when It changes oct, tree, I want it to pop itself of its previous oct-tree, and it it to its new oct tree, but only if it has changed since last frame-

update is called every frame, Is there a way to call it only when it knows the oct-tree of the current unit has changed,instead of doing comparison every second, as this throws exception error because can only pop it off the list once?

void EntityUnit::updateoct(worldspace &gameworldspace)
{
    int store = current_oct;
    for (auto a = gameworldspace.wspace.begin(); a<gameworldspace.wspace.end(); ++a)
    {
        if (checkwithinbounds(CVector3{unit_x,unit_y,unit_z}, (*a).w_origin, (*a).w_sideLen))
        {
            current_oct = (*a).num;
            //if oct-tree has changed since last call execute this
            // push this onto (a*).cObjs
            for (auto i = gameworldspace.wspace[current_oct].cObjs.begin(); i <  gameworldspace.wspace[current_oct].cObjs.end(); ++i)
            {
                if ((*i) == this)
                {
                    // Pop this off the last oct-tree object list
                }
            }
        }
    }
}

   void EntityUnit::update(float updateTime, worldspace &gameworldspace)
{
    int aliveswitch = unit_alive;
    if (this->UnitModel != nullptr)
    {
        (*UnitModel)->SetPosition(unit_x, unit_y, unit_z);
        (*UnitModel)->LookAt(0, 0, 0);
        (*UnitModel)->Scale(unit_model_scale);
        (*UnitModel)->ScaleZ(0.1);
        // << "current oct :" << current_oct << endl;
    }
    switch (aliveswitch)
    {
    case (0):

        break;
    case (1):

        move(updateTime);
        updateoct(gameworldspace);
        //cout << "Hit" << endl;
        break;

    default:;
    }

}

sentences:
Updating physics for animated models For a new game we have do set up a scene with a minimum of 30 bone animated models.(shooter)
The problem is that the update process for the animated models takes too long.

Thats what I do:
Each character has ~30 bones and for every update tick the animation gets calculated and every bone fires a event with the new matrix. The physics receives the event with the new matrix and updates the collision shape for that bone. The time that it takes to build the animation isn't that bad (0.2ms for 30 Bones -> 6ms for 30 models). But the main problem is that the physic engine (Bullet) uses a diffrent matrix for transformation and so its necessary to convert it.

Code for matrix conversion: (~0.005ms)

btTransform CLEAR_PHYSICS_API Mat_to_btTransform( Mat mat )
{
btMatrix3x3 bulletRotation;
btVector3 bulletPosition;

XMFLOAT4X4 matData = mat.GetStorage();

// copy rotation matrix
for ( int row=0; row<3; ++row )
    for ( int column=0; column<3; ++column )
        bulletRotation[row][column] = matData.m[column][row];
for ( int column=0; column<3; ++column )
    bulletPosition[column] = matData.m[3][column];

return btTransform( bulletRotation, bulletPosition );
}

The function for updating the transform(Physic):

void CLEAR_PHYSICS_API BulletPhysics::VKinematicMove(Mat mat, ActorId aid)
{
if ( btRigidBody * const body = FindActorBody( aid ) )
{
    btTransform tmp = Mat_to_btTransform( mat );
    body->setWorldTransform( tmp );
    }
}

The real problem is the function FindActorBody(id):

    ActorIDToBulletActorMap::const_iterator found = m_actorBodies.find( id );
if ( found != m_actorBodies.end() )
    return found->second;

All physic actors are stored in m_actorBodies and thats why the updating process takes to long. But I have no idea how I could avoid this.

Friendly greedings,
Mathias

sentences:
How to handle global Data within a state machine setup? (C#) I am currently building a turn-based framework (Unity,C#)

I was tired of my former tight-coupled systems and opted for a state machine this time, basically all components subscribe to the state-Enter and state-Exit event. I am aiming for scalability and structure.

But I ran into a problem. If the components cannot communicate directly, how to store and forward data in between states?

Example: The game starts with unit placement. The player has the option to select a unit in his pool via the ui and place it on the board.
The Unit-creation logic is and should(?) be handled inside the level script. How does it know where to create which unit?
Ive done a workaround with a static container class, with is basically my clipboard. The player assigns a grid cell for his selected unit and the game leaves the state.
While leaving the state the level scripts scans the clipboard and creates any assigned units.

But I feel like a cheated my attempt to really work strictly within a firm structure this time to guide the design process.

Is there a better way?

sentences:
How to rotate a sprite in 2D with LWJGL3 and GLSL I have all the basic rendering already set up, with translation, scaling etc. What matrix(s) and/or vector(s) do I need to multiply/add with my existing code to rotate an object.

Preferably around a point given by a vector2fa, also only in degrees because quaternions aren't implemented and its only 2D not 3D.

Snippet of the vertex shader:

gl_Position = transformation * vec4(position, 1.0) + translation

Where transformation is done in java as (Note not actual code as * is replaced with .mul()):

Matrix4f transformation = ortho * scale

And translation is given by a method:

Vector4f translation = new Vector4f(x , y , 0f, 0f).mul(gc.getOrtho());

All the code listed before works as expected. It is just lacking the rotation feature mentioned at the top.

How can I add rotation to my code?

sentences:
Load Material from file path or parse .mat file to Material - Unity Is it possible to load a material from a file path? Or, otherwise parse a .mat file saved on disk to a Material usable at runtime?
I had naively thought it would be possible to assign the bytes from a .mat file, as read by File.ReadAllBytes to a Material object, but that does not seem to work.

sentences:
How to remove skeleton from a model? I have bought a 3d character on turbosquid. I opened it in Unity and everything loads fine except the animations. I then imported the skeleton to Mixamo to find out the skeleton is messed up. I use the set joints manually in Mixamo, but when it tries to fix the issue, the hands get attached to the butt/hips. I would like to get rid of the skeleton and remake it. How would I go about doing this?

I believe what I am trying to do would be called derigging? I could then use Mixamo's autorig tool to make a better skeleton.

sentences:
2D Rendering Based On Y Coordinates I'm trying to build an RPG worldbuilder. I have seperate classes for images. Like this.

Object1::Object1(int x, int y, CSDL_Setup *sdl_set, int *p_CamX, int *p_CamY)
{
    X_pos = x;
    Y_pos = y;

    MouseX = 0;
    MouseY = 0;

    CamX = p_CamX;
    CamY = p_CamY;

    Object = new CSprite(sdl_set->GetRenderer(),"data/Trees/Tree3.png", X_pos, Y_pos, 100, 200, CamX, CamY);

}

I've created a vector of objects of the class Object1 and pushing it back when I create a new image. I draw them here.

void DrawObjects()
{
    for(std::vector<Object1*>::iterator i = Object.begin(); i != Object.end(); ++i)
    {
        (*i)->Draw();
    }
}

Now the rendering is done by the order the objects are created. I want to do the rendering based on y values of each object. I did a lot of research but couldn't find any example code. I also have other classes for other images. So I tried something on my own to sort y values and detect which y value corresponds to which object. But I'm stuck here.

int a;
void DoChanges()
{
    if(ChangeMade)
    {
        a = 0;

        for(std::vector<Object1*>::iterator i = Object1.begin(); i != Object1.end(); ++i)
        {
            ObjectArray[a] = (*i)->GetY();
            a++;
        }
        for(std::vector<Object2*>::iterator i = Object2.begin(); i != Object2.end(); ++i)
        {
            ObjectArray[a] = (*i)->GetY();
            a++;
        }
        ...

        SIZE = Object1.size() + Object2.size() + Object3.size() + ...;

        sort(ObjectArray, ObjectArray + SIZE);

        for(size_t i = 0; i < SIZE; i++)
        {
            for(size_t j = 0; j < SIZE; j++)
            {
                if(tree1[j]->GetY() == ObjectArray[i])
                {
                }
                else if(tree2[j]->GetY() == ObjectArray[i])
                {
                }
                ...
            }
        }

        ChangeMade = false;
    }

Is there a way to create an array of pointers to store the addresses of objects to different classes by their y values and use this array to do the rendering? Or do you have any suggestions on how to handle creating objects to the sprite class and rendering or any useful links?

Thanks.

sentences:
Help understanding IEnumerator Move routine I have this code and I know what it does (it will move an object up and down)

But I don't know how its elements work. Could someone please explain it to me?

IEnumerator Move (Vector3 Target) // What this IEnumerator do?
{
    while (Mathf.Abs ((Target - transform.localPosition).y) > 0.1f) {
        Vector3 Direction = Target.y == Top.y ? Vector3.up : Vector3.down;
        //Is this an if/else? and if yes why if target.y == top.y its first choice is vector3.up?

        transform.localPosition += Direction * 5 * Time.deltaTime;
        yield return null;
    }
    yield return new WaitForSeconds(1f);
    Vector3 newTarget = Target.y ==Top.y ? Bottom : Top;
    //Same line but result order is different ?.?

    StartCoroutine(Move(newTarget));
}

sentences:
At what point of the game should I request users leave a review? I'm planning on displaying a dialog requesting users review my Android game, but I'm wondering at what point I should display the dialog. I wont show the dialog until the user has completed several levels, but I can't decide where in the game flow to place it.

I have several options.

On game launch - my concern with this is that they're looking to play a game at this moment in time, not review the game.
On game exit - this seems a fairly classic time to do it, but many users wont quit by pressing back, often they'll just use the home button, or just turn the phone off. Also, if a user is stopping playing then they'll often be doing so because they've got something else to do.
On level completion - I will only request the review on successful level completion as I assume a player will be feeling good about the game at that point in time. My concern with this is that it interrupts game flow.

I'd be interested in hearing the thoughts of others on this.

sentences: What are the technologies that makes physics engines so good for raycasting? again. This question is strictly related to this one so, what is the technology that makes physics engines suitable for raycasting? It is a particular data structure? Has it to do with the engine's internal representation of the objects? If so, how do they represent objects so to be able to make polygon-precise raycasting? Do they hold the whole information about a mesh?

sentences:
pause or freezing game screen I have a question regarding the pausing/freezing a game while a window/pausemenu will appear at center of the screen. I've already created a pausescreen class which will be called each time the back key is being pressed.

My problem is that I don't know how to freeze or put the game to pause, this becomes a problem because whenever i tried to click on the outsides of the pause window the player could move around.

sentences:
The tolareable lag range in a multiplayer game I am programming a multiplayer game. I calculate the ping in ms as :

ping = the_time_i_recieved_pong - the_time_i_sent_ping

I implemented client-side prediction and interpolation algorithms. When I test the game with my friends, it works quite fine for those who have a ping under 100ms, but after 120ms it becomes unplayable as they have told me. So my question is wheter I should try to improve the client's game experience under a latency more than 120 ms or not ( is a lag >120ms considered tolerable ? )

Thank you all !

NOTE : My game is a fast-paced game so the lag compensation matters.

sentences:
Path Finding for an Arena based map in 3D using NavMesh I have a 3D arena map (consider a small island surrounded by water on all sides) for a multiplayer Tank fight game.
The moveable areas are marked using a Navigation Mesh made by the Arena designer.

My question is what would be the best way for navigation in such an environment ?
Specially considering the case when there is a Bridge at the center of the arena and you could walk under it or even above it ?

If suppose the enemy is standing at the top of the Bridge and my AI is at one of the edges of the map ? How can it know whether the enemy is above or below the bridge and how can it navigate till it ?

sentences:
game multiplayer service development I'm currently working on a multiplayer game. I've looked at a number of multiplayer services(player.io, playphone, gamespy, and others) but nothing really hits the mark. They are missing features, lack platform support or cost too much. What I'm looking for is a simple poor man's version of steam or xbox live. Not the game marketplace side of those two but the multiplayer services.

User accounts, profiles, presence info, friends, game stats, invites, on/offline messaging. Basically I'm looking for a unified multiplayer platform for all my games across devices.

Since I can't find what I'm planning to roll my own piece by piece. I plan to save on server resources by making most of the communication p2p. Things like game data and voice chat can be handled between peers and the server keeps track of user presence and only send updates when needed or requested. I know this runs the risk of cheating but that isn't a concern right now. I plan to run this on a Amazon ec2 micro server for development then move to a small to large instance when finished.

I figure user accounts would be the simplest to start with. Users can create accounts online or using in game dialog, login/out, change profile info. The user can access this info online or in game. I will need user authentication and secure communication between server and client. I figure all info will be stored in a database but I dont know how it can be stored securely and accessed from webserver and game services.

I would appreciate and links to tutorials, info or advice anyone could provide to get me started. Any programming language is fine but I plan to use c# on the server and c/c++ on devices. I would like to get started right away but I'm in no hurry to get it finished just yet. If you know of a service that already fits my requirements please let me know.

sentences:
Subdivided Icosahedron Hex/Pent grid efficient rendering? How to performantly display a hex/pent grid on a subdivided icosahedron?

I have a subdivided icosahedron planet used as the "board" for a strategy game. It usually has anywhere between a few thousand and a hundred thousand tiles depending on the size the user inputs to the map generator.

Basically, I cannot brute force this and do a simple bounds and depth check, because of the sheer numbers of tiles.

I am storing the grid in a 2D array for simplicity. I understand that, on a 2D map, you simply do something like the following to draw a hex map:

for(int x = cameraX; x < viewportWidth; x++)
{
    for(int y = cameraY; y < viewportHeight; y++)
    {
        if(x % 2 == 0) //For the 2D array to work properly we have to offset every other row by +1 world coordinate (assuming each tile is 1*1 world coordinates)
           grid[x][y].render(x+tile_width, y);
        else
            grid[x][y].render(x, y);
    }
}

And that to draw a wrap-around world you would check the absolute distance from the camera's position.

Eg:

//This sets up the variable that tells the game what hex tiles to draw.
if(camera.x - viewportWidth < 0)
{
    camera_rX = camera.x - viewportWidth;
    cameraX = grid.length + camera_rX; //We will add this to the cameraX value because the result should be a negative value if the prerequisite if statement is met. The "cameraX" variable is used for viewing calculations, while the "camera.x" variable is used for camera positioning. Err... I think this makes sense.
}

sentences:
How do I include a blend tree in my controller? I want my player to aim up and down with a pistol.
I have stored an "aim up" pose in one anim file, and I have stored an "aim down" pose in another anim file.
I want to blend between these 2 poses according to the mouse pointer on the screen:

If the mouse pointer is at the bottom of the screen, the blend tree should only play the "aim down" pose
If the mouse pointer is at the top of the screen, the blend tree should only play the "aim up" pose
If the mouse pointer is at the middle of the screen, the blend tree should play a 50/50 mix of the  "aim down" and of the "aim up" pose

To do that, I have added a 1D blend tree to my animator.
It looks like this:

I have tested the blend tree. When I scrub through the "timeline" using the red line, it works as expected:

Now I wanted to test it out in my game, but I don't see how to set the blend weight of this 1D blend tree.
The docs say that the blend tree is controlled by the animation parameters.
As far as I can see, Unity automatically created one for me when I added the blend tree. The name seems to be "Blend", as can be seen in the screenshot:

The following however has no visual effect for me:
_animator.SetFloat("Blend", 1f);

To check if this parameter even exists, I have changed its value to 0.3 in the animator.
Then in my code, I check the value like this, and it does return 0.3:
float fCur = _animator.GetFloat("Blend");

So this is proof that the parameter does exist.
However, when I set a new value like...
_animator.SetFloat("Blend", 0.56f);

... then this value is accepted, but it doesn't have any visual effect, and it doesn't show in the animator's paramters.
Can anybody tell me how I could achieve what I want?
Edit:
I have tested it in a new, stripped-down project. In this new project, I have the blend tree as the default state in the animator, and everything works.
So the fact that my blend tree is NOT the default state in the other project seems to be the problem. This is what it looks like:

I will first try to investigate more on this.

sentences:
Why does this code to filter events with SDL not function properly? According to the SDL2 wiki,

  SDL_SetEventFilter : Use this function to set up a filter to process all events before they change internal state and are posted to the internal event queue.

  void SDL_SetEventFilter(SDL_EventFilter filter,
                          void*           userdata)

  The function prototype for filter is:
  int YourEventFilter(void*      userdata,
                      SDL_Event* event)

And so, my code as follows is:

`

#include <SDL.h>
#include <stdio.h>
#include <memory>

//Screen dimension constants
const int SCREEN_WIDTH = 640;
const int SCREEN_HEIGHT = 480;

int isMouseEvent(SDL_Event* ev);

int main(int argc, char* args[])
{

    SDL_Event ev;

    //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
        {

            bool black = false;

            //Get window surface
            screenSurface = SDL_GetWindowSurface(window);
            SDL_SetEventFilter(isMouseEvent);
            bool isOn = true;
            while (isOn)
            {
                //Pump events
                SDL_PumpEvents();

                SDL_FillRect(screenSurface, NULL, SDL_MapRGB(screenSurface->format, 0xFF, 0xFF, 0xFF));

                //Update the surface
                SDL_UpdateWindowSurface(window);
            }
        }
    }
    //Destroy window
    SDL_DestroyWindow(window);

    //Quit SDL subsystems
    SDL_Quit();

    return 0;
}

int isMouseEvent(SDL_Event* ev)
{
    if(ev!=NULL) {
        if (ev->type == SDL_MOUSEMOTION)
            return 0;
    }
    return 1;
}

However, when the code is ran no events are filtered, every event passed to isMouseEvent() is null. The SDL2 Wiki is very bare, and the examples on using SDL_SetEventFilter are very basic and do not work properly. Any ideas as to where I should go from here, seeing as the events are constantly null when checked from the isMouseEvent() function?

sentences:
using loop to detect collision in XNA Got a problem, with collision detection, I need to detect collision between bullets and meteors using nested loop for this, but it isn't working.

                            }
                }
                    check();
                    LoadMeteors();
        base.Update(gameTime);
    }

    public void LoadMeteors()
    {

        int randY = random.Next(100, 400);
        if (spawn >= 0.5)
        {
            spawn = 0;

                meteors.Add(new Meteor(Content.Load<Texture2D>("Backgrounds/meteori"), new Vector2(800, randY), new Rectangle(0,0,50,50)));
        }
    }

    public void SpawnBullet()
    {

        bullets.Add(new Bullet(Content.Load<Texture2D>("Backgrounds/pula"), new Vector2(rocket.rectangle.X + 20, rocket.rectangle.Y + 20), new Rectangle(0, 0, 10, 5)));
        soundEffect.Play();

    }
    public void check()
    {

        for (k = 0; k < bullets.Count; k++)
        {
            for (i = 0; i < meteors.Count; i++)
            {
                if (bullets[k].rectangle.Intersects(meteors[i].rectangle))
                {
                    meteors[i].isVisible = false;
                }
            }
        }
    }

that is my meteor class:

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 Rocket
{
   class Meteor
 {
    public Texture2D texture;
    public Rectangle rectangle;
    public Vector2 position;
    public Vector2 velocity;

    public bool isVisible = true;

    Random random = new Random();
    int randX, randY;

    public Meteor(Texture2D newTexture, Vector2 newPosition, Rectangle newRectangle)
    {

        texture = newTexture;
        position = newPosition;
        rectangle = newRectangle;
        randY = random.Next(-4, 4);
        randX = random.Next(-4,-1);

        velocity = new Vector2(7, 0);
    }

   public void Update(GraphicsDevice graphics)
    {

        position -= velocity;
        if (position.X < 0 - texture.Width)
            isVisible = false;
    }
   public void Draw(SpriteBatch spriteBatch)
   {

       spriteBatch.Draw(texture, position, rectangle, Color.White);

   }

}
}

and that is my bullet class:

    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.Input;
  using Microsoft.Xna.Framework.Media;

 namespace Rocket
{
class Bullet
{
    public Texture2D texture;
    public Rectangle rectangle;
    public Vector2 position;
    public Vector2 velocity;

    public bool isVisible = true;

    public Bullet(Texture2D newTexture, Vector2 newPosition, Rectangle newRectangle)
    {

        texture = newTexture;
        position = newPosition;
        rectangle = newRectangle;

        velocity = new Vector2(10, 0);
    }

    public void Update(GraphicsDevice graphics)
    {
       position += velocity;
               if (position.X < 0 - texture.Width)
            isVisible = false;
    }
   public void Draw(SpriteBatch spriteBatch)
   {
       spriteBatch.Draw(texture, position, rectangle, Color.Aqua);

   }
    }

so, I call function Check(): in update method, than in that function i check for collision, but it isn't detecting collision, also meteor and bullet classes, both have rectangle, I don't get any errors and it seems to be right, thanks for any help!

sentences:
Working with tiledata of different sizes I recently bought an asset for my game, basically a tilesheet, with seperate pngs as well, but where as previously I've created tilemaps out of identically sized tiles these are all in varying sizes but scaled to fit in with say 128 x 128 tiles or 256 x 256 tiles.

so one of the main blocks might be 128 x 128 but some other elements of them may be slightly oddly sized such as  173 x 214, this obviously wont tile well as it is, so I was wondering how I should approach this? do i need a tile editor that can support layers with different dimensioned tiles? or do i need to find some way of chopping, padding and aligning these images into the same 128x128 tiles?

thanks

sentences:
A field initializer cannot reference the non-static field, method, or property 'CinemachineFreeLook.Variable' engine: unity
coding language: c#
I am trying to control CinemachineFreeLook maxSpeed from another script in the struct AxisStat: public AxisState(float minValue, float maxValue, bool wrap, bool rangeLocked, float maxSpeed, float accelTime, float decelTime, string name, bool invert) It only accepts to type a number, but not a variable.
Whenever I create a public float variable and place it in maxSpeed, it keeps sending the error: error CS0236: A field initializer cannot reference the non-static field, method, or property 'CinemachineFreeLook.rSpeed'
Here is the default unity CinemachineFreeLook script code + the added code which I declare a float variable "rSpeed" at the beginning and added my variable in the AxisStat maxSpeed:
public class CinemachineFreeLook : CinemachineVirtualCameraBase
{
    public float rSpeed = 300f;

    /// Object for the camera children to look at (the aim target)
    [Tooltip("Object for the camera children to look at (the aim target).")]
    [NoSaveDuringPlay]
    public Transform m_LookAt = null;

    /// Object for the camera children wants to move with (the body target)
    [Tooltip("Object for the camera children wants to move with (the body target).")]
    [NoSaveDuringPlay]
    public Transform m_Follow = null;

    /// If enabled, this lens setting will apply to all three child rigs, otherwise the child rig lens settings will be used
    [Tooltip("If enabled, this lens setting will apply to all three child rigs, otherwise the child rig lens settings will be used")]
    [FormerlySerializedAs("m_UseCommonLensSetting")]
    public bool m_CommonLens = true;

    /// Specifies the lens properties of this Virtual Camera.
    /// This generally mirrors the Unity Camera's lens settings, and will be used to drive
    /// the Unity camera when the vcam is active
    [FormerlySerializedAs("m_LensAttributes")]
    [Tooltip("Specifies the lens properties of this Virtual Camera.  This generally mirrors the Unity Camera's lens settings, and will be used to drive the Unity camera when the vcam is active")]
    [LensSettingsProperty]
    public LensSettings m_Lens = LensSettings.Default;

    ///  Collection of parameters that influence how this virtual camera transitions from
    /// other virtual cameras
    public TransitionParams m_Transitions;

    /// Legacy support
    [SerializeField] [HideInInspector]
    [FormerlySerializedAs("m_BlendHint")]
    [FormerlySerializedAs("m_PositionBlending")] private BlendHint m_LegacyBlendHint;

    /// The Vertical axis.  Value is 0..1.  Chooses how to blend the child rigs
    [Header("Axis Control")]
    [Tooltip("The Vertical axis.  Value is 0..1.  Chooses how to blend the child rigs")]
    [AxisStateProperty]
    public AxisState m_YAxis = new AxisState(0, 1, false, true, 2f, 0.2f, 0.1f, "Mouse Y", false);

    /// Controls how automatic recentering of the Y axis is accomplished
    [Tooltip("Controls how automatic recentering of the Y axis is accomplished")]
    public AxisState.Recentering m_YAxisRecentering = new AxisState.Recentering(false, 1, 2);

    /// The Horizontal axis.  Value is -180...180.  This is passed on to the rigs' OrbitalTransposer component
    [Tooltip("The Horizontal axis.  Value is -180...180.  This is passed on to the rigs' OrbitalTransposer component")]
    [AxisStateProperty]
    public AxisState m_XAxis = new AxisState(-180, 180, true, false, rSpeed, 0.1f, 0.1f, "Mouse X", true);

sentences:
How can I register Mouse Events in the Scene window of the Editor? I want to create a custom level editor for the level designers that should allow them to place predefined objects in Unity3d similar to the Terrain wizard.

How can I register Mouse Events in the Scene window of the Editor?

sentences:
Setting up a cross-platform Ogre project on a Git repository I'm looking to start a cross platform game project using Ogre, and I want to host it on a git repository. I'm collaborating with a friend on this: I'm on a Mac using Xcode, and he's on a PC using Visual Studio.

I've looked around on the Ogre site, and it seems CMake is what I should be using, but I'm not sure how to set it up with a Git repository. Would you be able to give me any pointers on where to start on this – tutorials and guides etc?

sentences:
Scene graphs vs in-game representation This is a general question which aim is to allow me to start digging on the subject by myself.

As I noticed the general opinion is that scene graphs are good for describing the scene in a level editor (or any editor that the game is using), but the game itself should use some sort of optimized data structure internally and the scene graphs should be somehow "translated" to that data structure before use.

What such internal data structures would be? How one would "translate" a scene graph to such structures.

In general - the more detail you can give me then better. Also references/links are more than welcome. :)

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:
Attach to a GameObject after collision? How can I make a GameObject attach (or "stick") to another GameObject after collision? The problem: I want the GameObject to attach after collision even if it changes scale.

What I have tried:

protected Transform stuckTo = null;
protected Vector3 offset = Vector3.zero;

public void LateUpdate()
{
    if (stuckTo != null)
        transform.position = stuckTo.position - offset;
}

void OnCollisionEnter(Collision col)
{
    rb = GetComponent<Rigidbody>();
    rb.isKinematic = true;

    if(stuckTo == null
       || stuckTo != col.gameObject.transform)
        offset = col.gameObject.transform.position - transform.position;

    stuckTo = col.gameObject.transform;
}

This code makes a GameObject attach perfectly after collision. But when that GameObject changes scale (while it's attached), it visually no longer looks attached to whatever it collided with. Basically, this code makes the GameObject stick with only the original scale at the moment of the collision. How can I make the GameObject always stick to whatever it collided with? And with whatever scale it has during the process?

sentences:
How to get the next line character to work in a self-typing dialog box? With the help of a tutorial, I've created an almost successful dialog box that types itself out (just as older RPGs do, and some still do). The only problem is that I've wrapped the text so that if a word is too long for the line within the dialog box, it goes on down to the next line.

However, since my code is typing out the dialog character by character, it probably can't use the "\n" directly. And even when I do use "\n" it does not go to the next line. It simply prints those characters exactly.

I initially tried using a single character ("*") that my code would then replace during the typing with a "/n" character. However, this just printed the "/n" per usual. Whether I use '\n', "\n", or \n, it doesn't seem to work.

You can see, I've got some special characters being used to signal whether the text should go slower than usual, or whether or not there should be a longer pause. I also included the function that goes through and takes out those special characters. But anyway, here's the code in general, how can I add a next line?

private IEnumerator TextScroll(string lineOfText)
{
    int letter = 0;
    theText.text = "";
    isTyping = true;
    cancelTyping = false;
    while (isTyping && !cancelTyping && (letter < lineOfText.Length)) {

        if (lineOfText[letter] == '@')
            {
            letter += 1;
            yield return new WaitForSeconds(0.5f);
            }

        if (lineOfText[letter] == '<')
            {
            typeSpeed = 0.5f;
            letter += 1;
            }

        if (lineOfText[letter] == '>')
        {
            typeSpeed = 0.025f;
            letter += 1;
        }

        theText.text += lineOfText[letter];
        letter += 1;
        yield return new WaitForSeconds(typeSpeed);
    }

    newLineOfText = lineOfText;
    theText.text = TrimString(newLineOfText);
    isTyping = false;
    cancelTyping = false;
}

public string TrimString(string line)
    {
        var charsToRemove = new string[] { "@", "<", ">"};
        foreach (var c in charsToRemove)
        {
            line = line.Replace(c, string.Empty);
        }
        return line;
    }

sentences:
How can I implement a short-cut grass effect? I've been looking at some screenshots from games like Rocket League and FIFA:

and I started wondering one would achieve the short-cut grass effect.

Is it a shader? Is it actual geometry? Or just textured quads? If anyone could point me in a direction, that would be greatly appreciated.

sentences:
Problems with Obstacle Avoidance steering behavior I learned how to implement the Obstacle Avoidance steering behavior from this tutorial. The approach depicted in this tutorial (simplified) is this (note that I'm using rectangular OBBs for obstacles, not circles):

The entity that avoids obstacles will have a 'ahead' vector, representing the entity's 'sight'. It will be equal to the velocity vector, but scaled to some length (the "sight distance").

For each entity in the "sight distance" radius from the entity, we check if it contains the the 'edge' of the ahead vector, marked with a red dot (actually the vector itself treated as a point):

For an entity that contains the red dot, we calculate the vector from the center of the entity to the red dot:

This vector (scaled by a scalar MAX_AVOIDANCE_FORCE) is the avoidance force. We apply it on our entity, and it should avoid the obstacle.

However, what happens in practice after applying the force is this:

As you can see, the entity is about to get stuck on the obstacle. That's because it doesn't sense it's about to collide, because the obstacle doesn't contain the edge of the 'ahead' vector.

So: what would be a good solution to this problem? How should I implement the algorithm?

sentences:
3D models and hit detection I'm currently trying to create a game that involves the inside of a cube, which i will make in Maya. My question is what is the best way to create a model with hit detection in mind?

For example my model will be a cube that you can walk inside of, so should i make the cube as a one model or make one wall and put it together inside XNA?

The reason I ask this is because I'm sure that if I create a whole cube and then use XNA's bounding rectangle method, hit detection will always be true because the bounding rectangle will encompass the whole cube, making collision detection inside the cube non existent without the use of hard values.

Whereas separate walls would make the process easier because i will checking against separate walls instead of the whole thing.

To add to the problem, I also have doors in the walls so hit detection for the walls in that area need to be turned off.

What is the best way to do this?

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:
Collision detection not working in Phaser 3 I am new to phaser. So I started working on a game but I am stuck at implementing collision detection. I want to do it between a static group(dot) and a Sprite(obs).

function create(){

dot = this.physics.add.staticGroup(dotx, doty, 'dot');

dot.create(dotx, doty, 'dot');

obs = this.physics.add.sprite(obsX, obsY, 'obs');

this.physics.add.collider(obs, ball, alert, null, this);

}

sentences:
Marshalling C# Structs into DX11 cbuffers I'm having some issues with the packing of my structure in C# and passing them through to cbuffers I have registered in HLSL. When I pack my struct in one manner the information seems to be able to pass to the shader:

[StructLayout(LayoutKind.Explicit, Size = 16)]
internal struct TestStruct
{
    [FieldOffset(0)]
    public Vector3 mEyePosition;

    [FieldOffset(12)]
    public int type;
}

This works perfectly when used against this HLSL fragment:

cbuffer PerFrame : register(b0)
{
    Vector3 eyePos;
    int type;
}

float3 GetColour()
{
    float3 returnColour = float(0.0f, 0.0f, 0.0f);

    switch(type)
    {
        case 0:
            returnColour = float3(1.0f, 0.0f, 0.0f);
            break;
        case 1:
            returnColour = float3(0.0f, 1.0f, 0.0f);
            break;
        case 2:
            returnColour = float3(0.0f, 0.0f, 1.0f);
            break;
    }

    return returnColour;
}

However, when I use the following structure definitions...

// Note this is 16 because HLSL packs in 4 float 'chunks'.
// It is also simplified, but still demonstrates the problem.
[StructLayout(Layout.Explicit, Size = 16)]
internal struct InternalTestStruct
{
    [FieldOffset(0)]
    public int type;
}

[StructLayout(LayoutKind.Explicit, Size = 32)]
internal struct TestStruct
{
    [FieldOffset(0)]
    public Vector3 mEyePosition;

    //Missing 4 bytes here for correct packing.

    [FieldOffset(16)]
    public InternalTestStruct mInternal;
}

... the following HLSL fragment no longer works.

struct InternalType
{
    int type;
}

cbuffer PerFrame : register(b0)
{
    Vector3 eyePos;
    InternalType internalStruct;
}

float3 GetColour()
{
    float3 returnColour = float(0.0f, 0.0f, 0.0f);

    switch(internaltype.type)
    {
        case 0:
            returnColour = float3(1.0f, 0.0f, 0.0f);
            break;
        case 1:
            returnColour = float3(0.0f, 1.0f, 0.0f);
            break;
        case 2:
            returnColour = float3(0.0f, 0.0f, 1.0f);
            break;
    }

    return returnColour;
}

Is there a problem with the way I am packing the struct, or is it another issue?

To re-iterate: I can pass a struct in a cbuffer so long as it does not contain a nested struct.

sentences:
Marketing games for the android - what are the best sites to contact for reviews/advertising? WE are in final dev stages of our latest game and want to release it for the android market.
What are the best sites to contact for reviews/advertising that specifically target the android users???

sentences:
How can I implement slow motion for one player in multiplayer? Special attacks in Mortal Kombat Mobile require slow motion i.e. delay in game play.

On multiplayer mode, when the opponent uses special attacks, I don't observe any lag/delay.

When I use special attack, the game goes in slow motion mode for me, however I guess my opponent doesn't experience any delay.

How is this possible? How can I implement something like this? Can my multiplayer mode still be real-time when using a feature like this?

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:
Downsides of using this integration formula for movement? So I read that Gaffron integration basics tutorial and noticed how the Euler integration method gives a small error over time. I implemented the RK4 and noticed that with constant acceleration, I could simplify the formula. Over the course of an hour with some use of wolframalpha, I noticed that the formula eventually just simplifies down to just this:

float dt = (float)gameTime.ElapsedGameTime.TotalSeconds;

Position += (0.5f * Acceleration * dt + Velocity) * dt;
Velocity += Acceleration * dt;

I ran it through a console and sure enough, it gives the proper values for each timestep and the correct final value.

Will this formula always yield perfectly accurate answers? My acceleration will always be constant. Is there a name for this formula?

sentences:
Events, Posting vs Queuing I'm implementing a messaging system and I'm wondering about how I should handle events. Should I post them and send them to the appropriate listeners as soon as I receive them, or should I queue them and only dispatch when I am prompted to (most likely by the main game loop)?

Edit: More info

My game is a 2D platformer, so performance isn't going to be very hard to achieve. Considering what Roy T. said, I guess I might as well send out the event as soon as it is posted; there doesn't seem to be a need to queue it (unless I'm missing something, of course).

sentences:
How to deal with large open worlds? In most games the whole world is small enough to fit into memory, however there are games where this is not the case, how is this archived, how can the game still run fluid even though the world is so big and maybe even dynamic? How does the world change in memory while the player moves?

Examples for this include the TES games (Skyrim, Oblivion, Morrowind), MMORPGs (World of Warcraft), Diablo, Titan Quest, Dwarf Fortress, Far Cry.

sentences:
Box2D body jitters when colliding with static body I am developing a game where a body is moved within the scene using touch. The scene has a boundary wall made up of static rectangular bodies. When I move the object along the boundaries, on collision, it jitters.

This is because the boundary wall pushes the body outwards while the touch pushes it against the wall. I am using linear velocity to move the body using touch. I tried to avoid this by setting the linear velocity of the body to 0 on collision with the boundary wall but it didn't work. I am trying to have a smooth movement along the boundary walls with no jitters. How can I solve this?

Following snippet moves the body on touch. Linear velocity vector has direction towards the touch point. The movement is smooth within the play area but not at the boundaries.

 case TouchEvent.ACTION_MOVE:

                strikerBody.setLinearVelocity((pSceneTouchEvent.getX()-body.getPosition().x * PIXEL_TO_METER_RATIO_DEFAULT),(pSceneTouchEvent.getY()-body.getPosition().y * PIXEL_TO_METER_RATIO_DEFAULT));

These are the bounadry walls:

final Rectangle groundLeft = new Rectangle(camera.getWidth() / 2 - camera.getWidth() / 4, 1, camera.getWidth()/2, 20, this.resourcesManager.vbom);
        final Rectangle groundRight = new Rectangle(camera.getWidth() / 2 + camera.getWidth() / 4, 1, camera.getWidth()/2, 20, this.resourcesManager.vbom);

    final Rectangle roofLeft = new Rectangle(camera.getWidth() / 2 - camera.getWidth() / 4, camera.getHeight() - 1, camera.getWidth()/2, 20, this.resourcesManager.vbom);
    final Rectangle roofRight = new Rectangle(camera.getWidth() / 2 + camera.getWidth() / 4, camera.getHeight() - 1, camera.getWidth()/2, 20, this.resourcesManager.vbom);

    final Rectangle leftTop = new Rectangle(1, camera.getHeight() / 2  + camera.getHeight() / 4 + camera.getHeight() / 12 + camera.getHeight() / 16 , 20, camera.getHeight()/2 - camera.getHeight()/12, this.resourcesManager.vbom);
    final Rectangle leftBottom = new Rectangle(1, camera.getHeight() / 2  - camera.getHeight() / 4 - camera.getHeight() / 12 - camera.getHeight() / 16, 20, camera.getHeight()/2 - camera.getHeight()/12, this.resourcesManager.vbom);

    final Rectangle rightTop = new Rectangle(camera.getWidth() - 1, camera.getHeight() / 2  + camera.getHeight() / 4 + camera.getHeight() / 12 + camera.getHeight() / 16, 20, camera.getHeight()/2 - camera.getHeight()/12, this.resourcesManager.vbom);
    final Rectangle rightBottom = new Rectangle(camera.getWidth() - 1, camera.getHeight() / 2  - camera.getHeight() / 4 - camera.getHeight() / 12 - camera.getHeight() / 16, 20, camera.getHeight()/2 - camera.getHeight()/12, this.resourcesManager.vbom);final FixtureDef wallFixtureDef = PhysicsFactory.createFixtureDef(0, 0.5f, 0.5f);
    PhysicsFactory.createBoxBody(this.mPhysicsWorld, groundLeft, BodyType.StaticBody, wallFixtureDef).setUserData("wall");
    PhysicsFactory.createBoxBody(this.mPhysicsWorld, groundRight, BodyType.StaticBody, wallFixtureDef).setUserData("wall");

    PhysicsFactory.createBoxBody(this.mPhysicsWorld, roofLeft, BodyType.StaticBody, wallFixtureDef).setUserData("wall");
    PhysicsFactory.createBoxBody(this.mPhysicsWorld, roofRight, BodyType.StaticBody, wallFixtureDef).setUserData("wall");

    PhysicsFactory.createBoxBody(this.mPhysicsWorld, leftTop, BodyType.StaticBody, wallFixtureDef).setUserData("wall");
    PhysicsFactory.createBoxBody(this.mPhysicsWorld, leftBottom, BodyType.StaticBody, wallFixtureDef).setUserData("wall");

    PhysicsFactory.createBoxBody(this.mPhysicsWorld, rightTop, BodyType.StaticBody, wallFixtureDef).setUserData("wall");
    PhysicsFactory.createBoxBody(this.mPhysicsWorld, rightBottom, BodyType.StaticBody, wallFixtureDef).setUserData("wall");

    this.attachChild(groundLeft);
    this.attachChild(groundRight);
    this.attachChild(roofLeft);
    this.attachChild(roofRight);
    this.attachChild(leftTop);
    this.attachChild(leftBottom);
    this.attachChild(rightTop);
    this.attachChild(rightBottom);

sentences:
How to interpolate colors around the spectrum of hues? I wanted to generate a 7 segment display whose color brightness varies with time, this can be done by just using linear relationship.
Color activeColour2 = new Color(1, DateTime.Now.Millisecond*0.001f, DateTime.Now.Millisecond*0.001f);

So in 1 complete second, it produce color in the range of (1,0,0) to (1,1,1) as in the code below:
using System;
using UnityEngine;

public class ClockDigit2 : MonoBehaviour
{
    static readonly bool[,] SEGMENT_IS_ACTIVE = new bool[,] {

        {true,  true,  true,  true,  true,  true,  false}, // 0
        {false, true,  true,  false, false, false, false}, // 1
        {true,  true,  false, true,  true,  false, true }, // 2
        {true,  true,  true,  true,  false, false, true }, // 3
        {false, true,  true,  false, false, true,  true }, // 4
        {true,  false, true,  true,  false, true,  true }, // 5
        {true,  false, true,  true,  true,  true,  true }, // 6
        {true,  true,  true,  false, false, false, false}, // 7
        {true,  true,  true,  true,  true,  true,  true }, // 8
        {true,  true,  true,  true,  false, true,  true }  // 9
    };

    public Color32 inactiveColour = Color.black;

    public SpriteRenderer[] segments = new SpriteRenderer[7];

    public void Display(int number)
    {
        Color activeColour2 = new Color(1, DateTime.Now.Millisecond*0.001f, DateTime.Now.Millisecond*0.001f);
        var digit = number % 10;
        if (digit < 0) digit *= -1;

        for (int i = 0; i < 7; i++)
        {
            if (SEGMENT_IS_ACTIVE[digit, i])
            {
                segments[i].color = activeColour2;
            }
            else
            {
                segments[i].color = inactiveColour;
            }
        }

    }

    void Update()
    {
        Display(DateTime.Now.Second);
    }
}

However, now I want to interpolate through all the colors in the circle above over 1 second.
I don't know how to express this as a formula for R, G, and B. The RGB value is not linear relationship: as you spin the selected color in the chart, you can notice the RGBA components vary together in a nonlinear form.
I considered using Lagrangian interpolation. However, this will not be accurate or might fail greatly because if you take a reference point at the circle and assume in 1sec, it made a complete revolution, you will notice there is a certain period of time where the RGB value is constant along the path: either 0 and 1.
So is there any method to get a formula that perfectly fits the color chart with respect to time?

sentences:
2D Physics: What happens with torque when center of mass changes? Novice programmer and explorer of simple 2D physics, here.

I have a simple 2D object made up of two rigid bodies connected at a fixed joint.

The two rigid objects can rotate freely about that fixed joint, causing the center of mass and moment of inertia of the whole object to change(but not adding extra energy to the system).

If my 2d object is rotating about it's center of mass, and then the center of mass changes (because one of its components rotates), what happens with the torque?

Since my torque was applied at the initial center of mass, and now the center of mass has changed, it would seem that I could not just preserve the torque for the new object orientation?

One possibility in my head is that some of that initial torque will be converted to linear velocity, but I can't visualize this in any consistent way.

So does the torque value remain the same when center of mass changes or does it need to be recalculated?

What key information am I missing here?

If there's a simple enough answer that could be expressed in some python or pseudo code (in terms of what to do with the torque), that would be appreciated.

EDIT:

I'll try to be more clear.  There's no friction there's no gravity, and no ability for either of these objects to collide with anything (they are in vacuum too).  The two components themselves are connected at a joint but they are effectively rigid (in the sense that torque force does not cause them to change their orientation to joint).  Linear velocity starts at nothing and we apply a  one time (impulse?) torque through the center of mass.  The whole object  rotates in the expected way when all of the sudden one of the components of the object changes its orientation(without adding any additional forces to whole object).  This changes the objects center of mass and moment of inertia. Since the only force applied to this object was torque, what happens in such a hypothetical situation? I'm mostly interested in how to apply the existing energy to the new orientation.  Does the object gain linear velocity and lose torque? If so how do i calculate that.

(I suppose if I were spinning in outer space and stuck out my arm, that might be along the same line?)

sentences:
Why does my MonoGame mesh throw an unhandled exception when trying to draw? I am using the '3D Models' chapter of Learning XNA 4.0 to further understand 3D implementation in XNA, but I am running into an unhandled exception, when I try to draw each mesh.
Here is my basic Draw() function. It determines the amount of mesh transforms inside my model, and proceeds to draw each one, using a default BasicEffect.
public virtual void Draw(Camera camera)
{
    Matrix[] transforms = new Matrix[model.Bones.Count];
    model.CopyAbsoluteBoneTransformsTo(transforms);

    foreach (ModelMesh mesh in model.Meshes)
    {
        foreach (BasicEffect effect in mesh.Effects)
        {
            effect.EnableDefaultLighting();
            effect.Projection = camera.projectionMatrix;
            effect.View = camera.viewMatrix;
            effect.World = GetWorld() * mesh.ParentBone.Transform;
        }

        mesh.Draw();
    }
}

When I attempt to run, I get stopped at mesh.Draw();, with the error

An unhandled exception of type 'System.InvalidOperationException' occurred in MonoGame.Framework.dll
Additional information: An error occurred while preparing to draw. This is probably because the current vertex declaration does not include all the elements required by the current vertex shader. The current vertex declaration includes these elements: SV_Position0, TEXCOORD0, COLOR0.

The model was provided by our lecturer. I have confirmed that the model shouldn't have any problems drawing. I have also found a similar issue to the one I am having, on the MonoGame forums, however the user reported having a current vertex declaration that includes "SVPOSITION0, TEXCOORD0, COLOR0", and the solution appeared to be changing "SVPOSITION0" to "SV_Position0".
While I am unsure how to directly change the vertex declaration, it appears I should already have the correct vertex declaration.
Why won't my mesh draw?
If I remove the effect.EnableDefaultLighting() line, it works, no problem. However, I then do not have light, and everything comes up as black. If I replace my ground.x model with the spaceship.x model supplied by Microsoft, it works with lighting. I presume my issue is with my model, however, I can not access spaceship.x to read in plain english, as I can with my ground.x.
Ground.x
xof 0303txt 0032
template Vector
{
    <3d82ab5e-62da-11cf-ab39-0020af71e433>
    FLOAT x;
    FLOAT y;
    FLOAT z;
}

template MeshFace
{
    <3d82ab5f-62da-11cf-ab39-0020af71e433>
    DWORD nFaceVertexIndices;
    array DWORD faceVertexIndices[nFaceVertexIndices];
}

template Mesh
{
    <3d82ab44-62da-11cf-ab39-0020af71e433>
    DWORD nVertices;
    array Vector vertices[nVertices];
    DWORD nFaces;
    array MeshFace faces[nFaces];
    [...]
}

template Coords2d
{
    <f6f23f44-7686-11cf-8f52-0040333594a3>
    FLOAT u;
    FLOAT v;
}

template MeshTextureCoords
{
    <f6f23f40-7686-11cf-8f52-0040333594a3>
    DWORD nTextureCoords;
    array Coords2d;
    textureCoords[nTextureCoords];
}

Mesh
{
     4;
     65536.00000;0.000000;-65536.00000;,
     -65536.00000;0.000000;-65536.00000;,
     -65536.00000;0.000000;65536.00000;,
     65536.00000;0.000000;65536.00000;;
     2;
     3;0,1,2;,
     3;0,2,3;;

    MeshTextureCoords
    {
         4;
         0.000000;0.000000;,
         0.000000;1024.000000;,
         1024.000000;1024.000000;,
         1024.000000;0.000000;;
    }

    MeshMaterialList
    {
        1;
        2;
        0,
        0;

        Material
        {
            0.800000;0.800000;0.800000;1.000000;;
            0.000000;
            0.000000;0.000000;0.000000;;
            0.000000;0.000000;0.000000;;

            TextureFilename{"sanddf.png";}
        }
    }
}

sentences:
How could I prevent a player from cheating by taking a picture with their phone? I'm making a game with a primary mechanic of a very limited amount of time that you can see a maze, and must navigate it blindly as much as possible to conserve your torch fuel. It's possible you could snap a photo with your phone and then beat every level.

My initial thought is, "so what?" if someone wants to cheat, they are just taking the fun out for themselves. But I'd like to add a leaderboard to the game, which would make cheating even more enticing to some players who value bragging rights over having fun.

The obvious answer is that there is NO way to prevent this.... but is there? I am trying to find an out-of-the-box idea that renders cheating nearly impossible or pointless.
Any ideas?
Curious if anyone has any thoughts first without altering your perspective by playing my game first. Let me know if you want the link and I'll give it to you.
Thanks!

sentences:
2d game view camera zoom, rotation & offset using 'Filter' / 'Shader' processing? I wish to add the ability to zoom-in, zoom-out, rotate and move the view in a top-down view over a collection of points and lines in a large 2d map. I split the map into a grid so I only need to render the points that are 'near' the camera.
My question is, how do I render a point A(Xp,Yp) assuming the following details:

Offset of the camera pov from the origin of the map is:

Xc, Yc

Meaning the camera center is positioned on top of that point. If there's a point in Xc, Yc it is positioned in the center of the screen.

The rotation angle is:

alpha

The scale is:

S

Read my answer first. I am thinking there is more optimized solution, thanks.

My question is how to include the following improvement:

I read in the AS3 Bible book that: In regards to ShaderInput, You can use these methods to coerce Pixel Bender to crunch huge sets of data masquerading as images, without doing too much work on the ActionScript side to make them look like images.

Meaning if I am performing the same linear function on a lot of items, I can do it all at once if I use Shaders correctly and save processing time.

Does anyone know how that is accomplished?

Here is a sample of what I mean:

http://wonderfl.net/c/eFp0/

sentences:
Why is account sharing so bad? In games where you have to use an account to sign in or otherwise authenticate yourself (e.g MMO games), it is often prohibited to share your account with other people.

For example in the World of Warcraft Official Terms of Use Agreement:

  [...] You may not share the Account with anyone, except that if you are a parent or guardian, you may permit one (1) minor child to use the Account when not in use by you. You are liable for all uses of the Account that has been enabled by you […]

And the League of Legends Terms of Use:

  [...] You can’t share your account or Login Credentials with anyone. You can’t sell, transfer or allow any other person to access your account or Login Credentials, or offer to do so. You’re entirely responsible for maintaining the confidentiality of your Login Credentials. [...]

What is the reason for this? Is it because of legal reasons and / or security reasons? I imagine account sharing would not be a problem if there weren't some real-world consequences for the company, not just the end-user.

sentences:
Are there performance benefits to using WaitForSeconds vs checking elapsed time in FixedUpdate in Unity? I was considering that perhaps just checking the time and then doing some work in the Update function might look cleaner than calculating how long to wait for and calling yield new WaitForSeconds() on two interleaving processes, so I became curious whether there is a huge difference between the two options.

Doesn't WaitForSeconds just work by calling an iterator after a certain amount of time has elapsed? So I assume that a timer is checked on each update, and when the time has elapsed, the IEnumerator's movenext function is called.

However, I thought it couldn't hurt to ask someone just in case there is some huge difference in performance.

sentences:
For drawing many layered 2D tiles, should one use the painter's algorithm, or Z-buffering? Sorry if this question doesn't make sense, I'm still very new to WebGL / OpenGL.
Basically, I'm trying to draw a tilemap similar to the one in Stardew Valley. Here's a screenshot from that game: https://i.imgur.com/eEgWu6b.png
So, there are several tile layers that are drawn after one another to simulate depth. And I believe that when two objects are on the same layer, their draw order is based on their Y coordinate. For example, in this screenshot notice how if you are above the scarecrow, you'll be drawn behind it, and otherwise, in front of it.
I'm trying to figure out how to efficiently do this, and there seem to be two main ways:

Use z-buffering in OpenGL. That is, the map is drawn "3d" like in the following image: https://i.imgur.com/Bi8C8z2.jpg where quad has a z value. Then, assuming the camera only translates and never rotates and just always looks top-down, then it should still look like a proper top-down 2D game with depth.

Use the painter's algorithm. That is, first draw everything on the first layer, then everything on the second layer, then everything on the third layer, etc. Your main application code should sort all objects on the same layer based on their Y coordinate so that everything is drawn with the proper depth.

So, I actually really like the idea of the first one. Because I heard that texture swapping was really expensive in OpenGL, and some of my maps are very large so they use 3-5 sprite sheets to draw everything. So with this method, I believe I should be able to just first draw every sprite that uses my first spritesheet, swap to the next texture, draw all sprites that use that texture, etc. Since they have z values, everything can be drawn out-of-order and still be layered properly, right? Also, if I space out the z coordinate for my layers enough, I think I should be able to incorporate the sprite's y coordinate into their z coordinate. That is, as an example, for a 2x2 map, the first layer would have z values 10000, 10001, 10002, 10003, then the next layer will have z values 20000, 20001, 20002, 20003, etc. My only concern is that I heard depth testing and occluding and whatnot can be expensive. And also apparently something called z-fighting can occur?
I think the painter's algorithm is the more traditional way of doing this? My only concern with this one is that it seems like it could be expensive to use software sorting on all the sprites each frame. Also, I don't know how to handle this with texture swapping. If one layer happens to include monsters that are all from different sprite sheets, won't that include a lot of texture swapping when rendering them all out, if we have to do them in order from top left to bottom right?
I'm just not sure which of these I should do. Using the z index sounds like it could make everything a lot easier, but I'm not sure if the price of depth testing is cheaper than software sorting and texture swapping. Also, I'm concerned about possible z fighting. How do people normally do this?

sentences:
How do I make a Box2D object that makes objects passing through it slower? I wish to have a sort of "slow motion" or "slow down" effect on a players character when they walk in a mud area, usually the character velocity is 3f constant in any one direction. The problem is I tried to declare a rectangle to cover the object mud area but I  am only able to get a solid rectangle area and therefore the character cannot walk through or over this area, the desired action would be having the character movement slow down while walking in the mud area. The code below is what I have tried to make this sort of region, but this code only makes a solid object which the character cannot pass through.

 final Rectangle rect = new Rectangle( object.getX(), object.getY(), object.getWidth(), object.getHeight(), vbom );

 final FixtureDef fixDef = PhysicsFactory.createFixtureDef( 0.0f, 0.0f, 1.0f );
 Body body = PhysicsFactory.createBoxBody( physicsWorld, rect, BodyDef.BodyType.KinematicBody, fixDef );
 body.setUserData( typeOfObject );
 physicsWorld.registerPhysicsConnector( new PhysicsConnector( rect, body ) );

sentences:
Poor performance wth custom particle system in LibGDX I'm using a custom particle system for my LibGDX / Java based game project (because I used Slick2D earlier on, need more parameters so I made my own and then ported). The system is fairly standard as far as I'm concerned, uses particle pooling (each emitter has its own fixed size particle pool) and renders each particle in a batch and uses one single (2048x1028) packed texture with all particle textures on it. Here is how I render the particles in semi-pseudo-code (because the entire code isn't relevant):

//ParticleSystem class
//Note: ExtendedBatch is my custom sprite batch implementation, largely just the normal SpriteBatch with two additional vertices for grayscale factor and additive tinting
void renderEmitter(ParticleEmitter emitter, ExtendedBatch batch)
{
    ParticlePool pool = particlePools.get(emitter);

    if (emitter.shouldScissor)
        Renderer.pushScissor(emitter.scissor);

    for (Particle particle : pool.particles)
    {
        if (particle.inUse)
              particle.render(batch);
    }

    if (emitter.shouldScissor)
        Renderer.popScissor();
}

//Particle class
void render(ExtendedBatch batch)
{
      relativeX = getRelativeX();
      relativeY = getRelativeY();

      if (isInScreenBounds(relativeX, relativeY))
      {
            batch.setColor(myColor);
            batch.draw(myTexture, position, origin, size, scale, rotation);
      }
}

Now for some reason with only around 300 particles (split up into 10 emitters with varying sizes) the performance drops to awful ~30FPS on my notebook's integrated GPU (Intel HD 4400) when I need / want 60FPS at all times. I know iGPUs aren't great, but that one is one of the better ones out there and games like Ori or Braid which have thousands of similar particles run without any problems at 60FPS on that very chip. I also doubt (and hope) that it's not just Java vs C++ which is causing this huge performance drop here.

Looking at in-game profiling data:

The in-game profiling data however shows a few things: Particles aren't really taking that long to render and there is a lot of idle time. To me, that doesn't really make much sense. It looks like there would be enough resources to easily render everything at 200FPS or more, but it is stuck at a horrible 30FPS.

There are a lot of things I already tried that didn't help:

Packing all particle textures into one (which is 2048x1024)
Batching all particle draw calls
Profiling to find out the cause (see above)
VisualVM to find potential memory issues, didn't help
Disabling vSync and FPS locks doesn't help

For the record, here's a VisualVM CPU sample over a timespan of 2 minutes:

There must be something I'm doing wrong and I also want / need more particles than just 300 so I definitely have to fix this - but I don't know how.

Update: Using the default SpriteBatch implementation and default shaders doesn't improve performance either.

Update - Solution:

I forgot to turn off MSAA. I had it running at 2x sampling rate for smoother antialising, I completely forgot to check for that. In the meantime I improved performance in a lot of other parts, but that's what finally did it.

sentences:
box2d rendering performance degrading extremely even with sleeping bodies? I'm working on my first smartphone game, a simple 2D platformer built with libgdx. Game maps use the Tiled level format, so a map is just a bunch of blocks. I recently started using box2d to implement character collision and movement.

So this is probably naive, but what I did is for a level consisting of 64x50 (= 3200)  blocks, I added a static body for every block to represent the physics for this geometry. I set these blocks to sleep, which I thought would be a hint for box2d to disregard these blocks when stepping the simulation unless they're actually interacting with the player (the only dynamic body), so this shouldn't hinder performance very much? I recall reading in the box2d manual that it employs a spatial algorithm to only even look at the bodies relevant to render the current frame.

Yet having these 3500 sleeping static bodies degrades performance to such a degree that even when running the game on my MacBook Pro 2012 in a Genymotion emulator, I get about 5 FPS.

I suppose I'm doing something terribly wrong. My questions would be:

when dealing with bodies in the thousands, am I supposed to remove/add box2d bodies for my level geometry dynamically to improve performance, e.g. based on a fixed box around the player? that sounds painful and I'm wondering why the library wouldn't be able to figure out itself
maybe I've just made a mistake mapping map tiles to box2d bodies? I've posted my setup code below

Any help appreciated.

Here's how I attach the static bodies to the level geometry; it just walks the map and creates a static body for every block:

private void addB2Bodies(World b2World) {
    for (int row = 0; row < blocksLayer.getHeight(); row++) {
        for (int col = 0; col < blocksLayer.getWidth(); col++) {
            BodyDef bodyDef = new BodyDef();
            bodyDef.type = BodyDef.BodyType.StaticBody;
            bodyDef.awake = false;
            bodyDef.position.set(col + 0.5F, row + 0.5F);

            final PolygonShape shape = new PolygonShape();
            shape.setAsBox(0.5F, 0.5F);
            FixtureDef fixtureDef = new FixtureDef();
            fixtureDef.shape = shape;
            fixtureDef.friction = 0;

            final Body body = b2World.createBody(bodyDef);
            body.createFixture(fixtureDef);
            blocks[col][row] = body;
        }
    }
}

I only have one dynamic body, the player. As for the simulation, I step it at 1 / 60, with the default/recommended iteration counts of 6 and 2.

sentences:
atan2 : inversed result? (angle 180 is on the right side, angle 0 on the left side) the result of the angle between my touch and the middle,bottom of the screen gives me 180 when the touch is on the right side of the screen, and 0 when it is on the left. I don't understand why...

override func touchesMoved(touches: NSSet, withEvent event: UIEvent) {
    let refPoint = CGPointMake(self.frame.size.width/2, self.frame.size.height)
    let anyTouch: UITouch = touches.anyObject() as UITouch
    let touch = anyTouch.locationInView(self.view!)

    //180 is inversed? 180 is when touch is on the right side...
    let dy = (refPoint.y - touch.y) //opposite
    let dx = (refPoint.x - touch.x) //adjacent

    let rad = atan2(dy, dx)
    let angle = rad * 180 / CGFloat(M_PI)
    println("angle : \(angle) ")
}

Would someone know how to solve this?

Thanks

sentences:
Attributes and Behaviours in game object design Recently I have read interesting slides about game object design written by Marcin Chady Theory and Practice of the Game Object Component Architecture. I have prototyped quick sample that utilize all Attributes\Behaviour idea with some sample data.

Now I have faced a little problem when I added a RenderingSystem to my prototype application. I have created an object with RenderBehaviour which listens for messages (OnMessage function) like MovedObject in order to mark them as invalid and in OnUpdate pass I am inserting a new renderable object to rederer queue. I have noticed that rendering updates should be the last thing made in single frame and this causes RenderBehaviour to depend on any other Behaviour that changes object position (i.ex. PhysicsSystem and PhysicsBehaviour).

I am not even sure if I am doing this the way it should be. Do you have any clues that might put me on the right track?

sentences:
Getting screen coordinates of actor I'm trying to tell if an actor exists at a screen position so I can do something if the actor is clicked on. To do this, I first need to get the screen coordinates of the actor so I can compare it to the coordinates where I click, however, I am having some difficulty. I am currently trying to do this:

Actor actor = ...
// The position where I clicked obtained from touchDown() in my InputAdapter
Vector2 screenPos = ...
Vector2 actorStagePos = actor.localToStageCoordinates(new Vector2(0,0))
Vector2 actorScreenPos = actor.getStage().stageToScreenCoordinates(actorStageCoordinates)
Rectangle actorScreenBounds = new Rectangle(actorScreenPos.x, actorScreenPos.y, actor.getWidth(), actor.getHeight());
if (actorScreenBounds.contains(screenPos))
{
    System.out.println("An actor is there")
}

However, the coordinates don't seem to be converting correctly. They end up slightly below and to the right of where they should be. At first, I thought this was caused because I'm scaling some of the Image actors, but it also did not work when nothing was scaled up.

sentences:
How can I implement a matchmaker? I'm making a multiplayer game, where players are separated in to rooms that would ideally have about 20 players.

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

A few more constraints:

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

EDIT

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

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

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

sentences: background animation algorithm for single screen I’m writing simple strategy game (in xna), and would like to have an animated background. In my game all the actions happens inside one screen and thus standard parallax effect does not look appropriate. However, I found a video of a game with suitable background animation for my game http://www.youtube.com/watch?v=Vcxdbjulf90&feature=share&list=PLEEF9ABAB913946E6 (from 3 to 6s, while main character stays at the same place). What is the algorithm to do this stuff? It would be nice if someone can provide a reference for a similar example (language is not important).

sentences:
Environment mapping - cube mapping using OpenGL I'm trying to do cube mapping.
Problem is that I'm getting this:

This is what I get when I rotate it:

But it should look like this

Here is code for vertex shader

varying vec2 tex_coord;

void main()
{
 vec3 v = vec3(gl_ModelViewMatrix * gl_Vertex);

 gl_TexCoord[0].stp = normalize(gl_Vertex.xyz);
 gl_Position = gl_ModelViewProjectionMatrix * gl_Vertex;

 //gl_ModelViewMatrix * gl_Vertex
}

fragment shader

uniform samplerCube _tex;
void main()
{
 //gl_FragColor = vec4(1.0, 1.0, 1.0, 1.0);
 gl_FragColor = textureCube(_tex, gl_TexCoord[0].stp);
}

Could you please tell me what am I doing wrong?

sentences:
Why do many games have “timeouts”? I noticed that many social games have the concept of "timeouts". In farm games etc. it obviously makes sense (stuff grows, etc.). But I also noticed that angry birds introduced this as well. Individual angry bird games are pretty much stateless, so it doesn't seem to make a lot of sense at first glance (and some users are upset because of this).

What is the purpose of this? Does it bring more money somehow? Does it help retaining the users? Is this a new concept? Does it have any other applications, particularly in non-game realms?

sentences:
Any advantage of having chunks with sizes by the power of two? With my past experience of having my little game lag because of the size of the world, I have decided that in whatever next project I might choose to create, I will split said world into chunks. Now here comes my question : Should the chunk's width, height and depth be a power of two?

For example, in a little game called Minecraft, chunks have a height of 256 and width,depth of 16. Both numbers a power of two. Is there any advantage over having the chunk simply be 100x100x100?

Minecraft was written in Java, but I'm working in Lua. Just pointing that out in case it has any relevance.

sentences:
Get Stencil buffer working iOS OpenGL ES 2.0 I have been trying to get this work but either get black screen or reporting error when using XCode to analyze the GL code like below. Any help appreciated.  I am using Swift here if that making a difference. Any help appreciated.

The code I used to attach a stencil buffer is like below:

var depthRenderbuffer: GLuint = 0
glGenRenderbuffers(1, &depthRenderbuffer)
glBindRenderbuffer(GLenum(GL_RENDERBUFFER), depthRenderbuffer)
glRenderbufferStorage(GLenum(GL_RENDERBUFFER), GLenum(GL_DEPTH24_STENCIL8), 2208, 1242)
glFramebufferRenderbuffer(GLenum(GL_FRAMEBUFFER), GLenum(GL_STENCIL_ATTACHMENT), GLenum(GL_RENDERBUFFER), depthRenderbuffer)

sentences:
How to determine which cells in a grid intersect with a given triangle? I'm currently writing a 2D AI simulation, but I'm not completely certain how to check whether the position of an agent is within the field of view of another.

Currently, my world partitioning is simple cell-space partitioning (a grid). I want to use a triangle to represent the field of view, but how can I calculate the cells that intersect with the triangle?

Similar to this picture:

The red areas are the cells I want to calculate, by checking whether the triangle intersects those cells.

Thanks in advance.

EDIT:

Just to add to the confusion (or perhaps even make it easier). Each cell has a min and max vector where the min is the bottom left corner and the max is the top right corner.

sentences:
Pathfinder not acting correctly I've taken the A* Algorithm from this example XNA Pathfinder Example so that it will be able to plot a path for a moving goal.

The issue I'm having is that it will go in the right general direction but it will keep going back and forth in a line. I've changed the method so that it calculates a new path every half a second, clear out the previous points from the list and adds the new points to and from what I have debugged I can't find any issue with the points being added to the queue, to be honest I don't have the foggiest idea what is going wrong :/

This is the field where the waypoints are being held for the character

private Queue<Vector2> waypoints = new Queue<Vector2>();

This section is in the update loop and deals with the plotting a new path and laying out the new one onto the list mentioned above.

            timer += gameTime.ElapsedGameTime;

            if (timer.Seconds >= 0.5)
            {
                timer = TimeSpan.Zero;
                pathFinder.NewPath(position);
            }

            if (pathFinder.SearchStatus == SearchStatus.PathFound)
            {
                waypoints.Clear();
                foreach (Point point in pathFinder.FinalPath())
                {
                    Waypoints.Enqueue(level.MapToWorld(point, true));
                }
                moving = true;
            }

This section is where the waypoints are either taken off or used to set the new position of the character.

                if (moving)
                {
                    // If we have any waypoints, the first one on the list is where
                    // we want to go
                    if (waypoints.Count >= 1)
                    {
                        destination = waypoints.Peek();
                    }

                    // If we’re at the destination and there is at least one waypoint in
                    // the list, get rid of the first one since we’re there now
                    if (AtDestination && waypoints.Count >= 1)
                    {
                        waypoints.Dequeue();
                    }
                    if (!AtDestination)
                    {
                        direction = -(position - destination);
                        //This scales the vector to 1, we'll use move Speed and elapsed Time
                        //to find the how far the tank moves
                        direction.Normalize();
                        position = position + (direction * MoveSpeed * elapsedTime);
                    }
                 }

sentences:
Programmatically placing objects along Polygon Collider 2D In my game, I have Tiled "rooms" that were imported with Tiled2Unity.  All of these rooms have walls that are defined by Polygon Collider 2D objects.  In the event of a cave or dungeon, I'd like to implement torches.  Currently, I literally randomly place torches in each room, which is pretty good for lighting, but looks ridiculous.

After the room is added, rather than randomly place torches anywhere, I'd like to have them placed along the inside of the collider.  Is there a good way to make this happen?

Edit:

One of my first attempts was to get a list of all of the points in all colliders in a given room after it's instantiation.  I was starting with something like this.

GameObject _roomGO =
   (GameObject)Instantiate(_room.gameObject, new Vector3 (-6.5f, 6.5f, 0f), Quaternion.identity);

List<PolygonCollider2D> _polyList =
   _roomGO.GetComponentsInChildren<PolygonCollider2D>().ToList();

However, this only gets the points from the first collider, whereas I need the points for all colliders in the room GameObject.  Additionally, I'm not sure how those points are stored in such a way that I could create a List or Array of lines, then evaluate those lines to determine which are inside the room (as opposed to along the outside, so nothing in the set [(x,0),(x,-13),(0,y),(13,y)].

Once I had a list of lines that weren't part of that set, I could choose a point on the line and drop in a torch.

Edit2 - images:

Edit 3:

Thank to @SP., I've used some of his code as shown here:

        if (_torches)
    {
        Transform _roomGOLayer = _roomGO.transform;
        int numTorch = rndObjects.Next(2,4);

        List<PolygonCollider2D> _polyList = _roomGO.GetComponentsInChildren<PolygonCollider2D>().ToList();

        foreach (PolygonCollider2D polCol in _polyList)
        {
            foreach (Vector2 point in polCol.GetPath(0))
            {
                Debug.Log(point.x +" : "+ point.y);//you will be using these values

                GameObject _to = Instantiate(_torch, new Vector2(point.x, point.y), Quaternion.identity) as GameObject;
                _to.transform.parent = _roomGOLayer;
                _to.transform.position = _to.transform.parent.transform.position + new Vector3 (point.x, point.y, 0f);
            }
        }
    }

The biggest problem I'm having up front is that _polyList is only getting the first collider definition.  I think if I could solve that, I'd be in good shape.

sentences:
How to properly delete unwanted models I am implementing bullets into my game, and each bullet has a lifetime. Whenever the bullet has existed for a set amount of time or collides with an object, the bullet should be deleted. I implemented the timer properly and whenever the bullet reaches the end of its life, it gets deleted. The problem occurs whenever I shoot another bullet. This instantly causes a crash with the code:
Exception thrown at 0x044765D7 (nvoglv32.dll) in gravityGame.exe: 0xC0000005: Access violation reading location 0x00000000.
After some research, I've found that this usually means that I am trying to render something that is a nullptr. My thinking is that I am not deleting the previous bullet properly and this affects the new one. A single bullet object is created on startup, and every new bullet is copied using the following line of code:
std::shared_ptr<Bullet> bullet = std::make_shared<Bullet>(*std::dynamic_pointer_cast<Bullet>(modelsLoaded.at(i)));
The reason for the dynamic pointer cast is because it is in a vector of its base class that it inherits from. Whenever the bullet needs to get deleted, it is erased from the bullets vector using bullets.erase(bullets.begin()+index); and the object it is pointing to should go out of scope, there is nothing else pointing to it. I feel like somehow having that object getting deleted has an adverse effect on the other bullets in the vector, but I do not know how. A new object is created and all the data from the original bullet gets copied over. How could deleting a copy of an object mess with the other copied objects? The functions to create, and render the models are below.
Generate Model Function
    //binds id
    glGenBuffers(1, &VBO);
    glGenVertexArrays(1, &VAO);
    glGenBuffers(1, &EBO);
    glGenTextures(1, &texture);
    glBindVertexArray(VAO);
    glBindBuffer(GL_ARRAY_BUFFER, VBO);
    glBufferData(GL_ARRAY_BUFFER, verticesSizeTexture * 8 * sizeof(float), verticesTexture, GL_STATIC_DRAW);
    // position attribute
    glVertexAttribPointer(0, 3, GL_FLOAT, GL_FALSE, 8 * sizeof(float), (void*)0);
    glEnableVertexAttribArray(0);
    // color attribute
    glVertexAttribPointer(1, 3, GL_FLOAT, GL_FALSE, 8 * sizeof(float), (void*)(3 * sizeof(float)));
    glEnableVertexAttribArray(1);
    glBindBuffer(GL_ELEMENT_ARRAY_BUFFER, EBO);
    glBufferData(GL_ELEMENT_ARRAY_BUFFER, indicesSizeTexture * 4, indicesTexture, GL_STATIC_DRAW);
    //texture
    glBindTexture(GL_TEXTURE_2D, texture);
    glVertexAttribPointer(2, 2, GL_FLOAT, GL_FALSE, 8 * sizeof(float), (void*)(6 * sizeof(float)));
    glEnableVertexAttribArray(2);

    glBindBuffer(GL_ARRAY_BUFFER, 0);
    glBindVertexArray(0);

Rendering Function
    unsigned int transformLoc = glGetUniformLocation(shader->ID, "location");
    glUniformMatrix4fv(transformLoc, 1, GL_FALSE, glm::value_ptr(trans));

    glBindTexture(GL_TEXTURE_2D, texture);
    glBindVertexArray(VAO);
    glDrawElements(GL_TRIANGLES, indicesSizeTexture, GL_UNSIGNED_INT, 0);
    glBindVertexArray(0);

Destructor
glDeleteVertexArrays(1, &VAO);
glDeleteBuffers(1, &VBO);
glDeleteBuffers(1, &EBO);

Update
After removing the contents of the destructor, the problem goes away. However, I would like to have some sort of destructor to allow for the proper freeing of memory.

sentences:
Unity Behavior Designer get gameobject I am trying to create my own action in Behavior Designer. However i cannot seem to get the game object that designer is attached to. if i attempt to do:

protected Combatant enemyCombatantObject;

public override void OnAwake()
{
    enemyCombatantObject = GameObject.GetComponent<Combatant>();
    base.OnAwake();
}

It gives me an error:

  the property or indexer 'Task.GameObject' cannot be used in this
  context because it lacks the get accessor

Can anyone tell me how to get the GameObject that the script is attached to?

sentences:
Can't attach animation to script I'm working on a little game (which is also my first one) and I want to insert a splash screen at the beginning (after the Unity one).
I've finally achieved to add a fade-in and a fade-out transistion when the splash screen starts and ends, but the fade out is activated by a button and I wont to play it simply after a certain time.
I've made a script for that:

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

public class FadeInOut_2 : MonoBehaviour
{
    public Animation anim;

    IEnumerator Start()
    {
        yield return new WaitForSeconds(2f);

        anim.GetComponent<Animation>().Play();

        Application.LoadLevel(Application.loadedLevel + 1);
    }

}

The problem is: when I try to attach the animation the Inspector refuses to do it.

Any ideas?
Thanks

sentences:
How to play a video and run content at the same time Alright, so I have a video loaded, and other game content.

Earlier this morning, when I was just learning how to actually play a video, I magically happened to get the video running in the background, and also keep everything else drawn above it. I was thrilled and thought I will easily manage to do the rest.

Now that I'm almost done, I have several videos that I want to draw. I made a loop that will only run one time as an intro, and then after it stops, it sequences one of the other videos, but the thing is, this next video is drawn above everything else, while the rest of my game content, is "under" the Rectangle where the video Texture is running, can anyone help me on how to get a Rectangle variable "behind" everything? almost as a background? Thanks a lot!

sentences:
how to 'Scale up' my procedurally generated island/continent without losing its uniqueness? Currently I am trying to make a procedural terrain generator. When I first started creating my terrain generator I decided to use a radial mask to generate my islands/continents like so:

But as time went along, I decided that these islands were way too small and I needed the islands to be much larger almost like continents than islands. So what I did was simply make the radial mask bigger. Which did overall result in bigger islands but my islands were now very much 'centered-based' with each island generating roughly the same except for the very outer extremities:

Here is the code I used to generate the procedural island. I included a comment on what value I changed to make the island larger. I used Libnoise for the perlin noise.

 void createRadiIsland(int centerX, int centerY)
{
    Perlin perlin = new Perlin();
    perlin.OctaveCount = 8;
    perlin.Frequency = 0.1;
    int seed = 50;
    float BiasX = 7f;
    float BiasY = 7f;
    for (int x = 0; x < grid.columns; x++)
    {
        for (int y = 0; y < grid.rows; y++)
        {

            float distanceX = (centerX - x) * (centerX - x);
            float distanceY = (centerY - y) * (centerY - y);

            float distanceToCenter = Mathf.Sqrt(distanceX * BiasX + distanceY * BiasY);
            distanceToCenter = distanceToCenter / 500; //<-- larger the value the bigger the island
            grid.FindTile(x, y).elevation = Mathf.RoundToInt(((float)perlin.GetValue(x - 0.98 + seed, y - 0.98 + seed, .1) - distanceToCenter * 10));

        }

    }
}

How should I modify my code so that it generates islands/continents that have the general uniqueness of the first island but at a much greater scale? Would I even be able to use a mask anymore? Would I have to use a completely new approach to generating my terrain?

side note:

I thought about solving my problem by using multiple radial gradients instead of just one but I am afraid that it will end up making my islands too blobby looking and not very realistic. Is that true?

sentences: Combinations for tiling two textures together Hi I need to create seamless ground with grass and dirt. I can make two textures connect seamlessly one to another. My question is how to figure out all the combinations, like (left, top, bottom, left-bottom, right-botton-left and so on)? Is there some kind of guide? Thank you in advance.

sentences:
How to save/persist a GameObject with incremental levels? Dictionary? List? I create buildings and they have child Text objects that will reflect the building level.

The Problem:

What can I use to store the buildings a player has built so the data can be persisted?

I've looked at Lists, but when I upgrade a building, how would I update the list so that particular building has its new level reflected?

I'm working on a dictionary so I can update the key with the new value (level) but running into a problem with the keys and names. If I have lets say 10 "Farms" and try to add them to the dictionary, even though they have different properties, I get an error that I have a duplicate.

Currently I am learning how to persist that data through scenes;

GameManager.CS

public class GameManager : MonoBehaviour
{

public static Dictionary<Building, int> playerBuilt = new Dictionary<Building, int>();

public void SaveState()
    {
        BinaryFormatter bf = new BinaryFormatter();
        FileStream file = File.Open(Application.persistentDataPath + "/EmpireGame", FileMode.Open);

        SaveClass sc = new SaveClass()
        {
            food = Player.food.amount,
            buildingList = playerBuilt
        };

        bf.Serialize(file, sc);
        file.Close();
    }
}

[Serializable]
class SaveClass
    {
        public int food, wood, iron, stone;
        public Dictionary<Building, int> buildingList = new Dictionary<Building, int>();
    }

Building.CS

public abstract class Building : MonoBehaviour, IUpgradable {

    public int ID;

    //level this building is
    public Text levelText;
    public int level = 0;

    //starting cost to amplify the upgrade cost
    public int foodBase, woodBase, ironBase, stoneBase;

    //Upgrade cost
    public int foodCost, woodCost, ironCost, stoneCost;
    public float BuildingCostPercentage = 5f;

    public void UpdateDictionary()
    {
        if (GameManager.playerBuilt.ContainsKey(this))
            GameManager.playerBuilt[this] = level;
        else
            GameManager.playerBuilt.Add(this, level);
    }
}

Note: I have not tested the save function so I expect errors.

sentences:
Colorize with a given color a texture I have a texture and I want to "colorize" it with a given color, lets say cyan (#00ffff) or purple (#800080). What I want to do, is get all the pixel values from the texture, and remove the color and keep the "brightness" and "saturation" and apply to the desired color. There is a tool in GIMP to do this called Colorize (Colors -> Colorize.. while editing), I made an example below.

This is will all be done in a shader (GLSL), although this is probably a general algorithm.

sentences:
SDL2 Textures bleeding / 1px border around tile maps - SDL_RenderCopyEx taking integer arguments https://forums.libsdl.org/viewtopic.php?t=9486 This post gives a good indication of my question.

Basically if you set SDL2 logicalScale or otherwise and render textures at native window resolution they appear fine. However, with tile maps if you resize the window in anyway, you get a bleed where an integer rounding issue creates a 1px border around certain tiles.

Is my only option to create a 1px border around all my images to stop this bleed / rounding error? Or a semi-transparent border with the main color. What are my options? Is this solved in any of the latest SDL2.X.Y ?

EDIT: A simpler method I have used is reducing my images from 64x64px to 62x62px in SDL2 (not the actual sprite) and using it's own sprite as a 1px border, and using Render Scaling to scale up that 1px, which stops bleed. It reduces the quality on background images ever so slightly, but it requires no tweaking of any code or sprites... but again wondering if there's a more elegant solution.

sentences:
Creating thrusters on a ship in Unity3D So, I'm using the legacy particle "small flames". Basically what I want it to do is always emit below the ship, so when the ship turns and such it still looks like the thrusters are firing.

I know adjusting the World Velocity Y can adjust what direction the particles throw, but what I'm wondering is how do I always get what direction the back of the ship is facing, so I know what direction to emit the particles in? It doesn't have to use World Velocity, it could use rotation or some such, I just can't figure this out.

sentences:
Where to implement storable items I'm creating a multiplayer online trading game. The things that are traded range from raw items to complex products. For example Steel is a raw item. Mechanical Assembly is a more complex item that requires 2x Steel and maybe 1x Rubber. Then Hydraulics is an item that contains 2x Mechanical Assemblies and 1x Electronics (which is another complex item). So and so forth.

These items will be created by me, players can't create their own items, so it doesn't need to be able to handle arbitrary layers of complexity for items.

If my example isn't clear, think Minecraft. You have wooden planks, which can be made into sticks. From there the sticks - combined with metals - can be made into tools. My game is nothing to do with minecraft or any sandbox building game, but it uses a similar progressive complexity to creating items that I want to have in my game.

My question is basically, how do you store something like this assuming that I will want to add more items in the future? Do you store it in a database or in a seperate library that the game uses?

EDIT

None of the items actually "do" anything, they are simply there to either sell, purchase, or combine with other items to make a more complex item, which can then be sold, purchased or combined... you get the idea. The items themselves would not have any properties, but the instances of the items would. For example an item that one player has would have a certain "quality" and if they were selling it a certain "price". An instance of that same item that a different player had would need to have a different "quality" and "price" if they were selling it.

I think the price part will not be required on an individual item because instead I would have a "sale" object which was for a price and contained certain items.

sentences:
How do I generate mipmap .png and model .obj files for LibGDX? I'm playing a bit with LibGDX (OpenGL ES 2.0 wrapper for Android).

I found some sample code which used prepared files to load models and mipmap textures for them, e.g., at https://github.com/libgdx/libgdx/blob/master/demos/invaders/gdx-invaders/src/com/badlogic/gdxinvaders/RendererGL20.java it reads .obj file for the model and RGB565 format .png file to apply a mipmapped texture to it.

What is the best / easiest way for me to create these files?

I understand .obj files are generated by a bunch of tools (I installed Blender, Wings3D and Kerkythea so far), but which ones will be the most user friendly for someone unfamiliar with 3D modelling?

But more importantly, how do I produce a .png file with the mipmapped texture? The .png I looked at ( https://github.com/libgdx/libgdx/blob/master/demos/invaders/gdx-invaders/data/ship.png ) seems to include different textures for each of the faces, probably created with some tool. I browsed through the menus for the 3 tools I have installed but didn't find an option to export such a .png file. What am I missing?

sentences:
Mission system for a FPS game to force the player into following the storyline Lately I've been working on a FPS game with a storyline in unity and I've encountered something that has been making my head explode for days. My objective is to be able to force the player to do a certain objective before being able to continue the game and to also give the new missions straight after the player has completed the past ones.
To help the player out I've created a panel with the description of the mission so that the player can check it out whenever he wants to. I've already created some code of my own for one mission but it seems to be a mess, I'm sure I should have different scripts for different things so that I didn't need to repeat code so much when I'm about to create a new mission script.
My problem is that I don't have the skills yet to do and I would like some suggestions: how could reduce my code and how I could create a universal script that would be able to recognize which missions are done and which are not, instead of doing it over and over again in every single mission script?
I'm kinda of new to unity and I've never posted to stack overflow so if I made any mistakes I'm sorry.
Extra information: the storyline is a linear, what I mean by that is that it doesn't give the player a choice to change it, it will always be the same and the quests/missions are here to force the player into following it. For example, the first mission is for the player to go down stairs and turn on two batteries. The second mission is for the player to kill a certain amount of enemies that appear right after.

sentences:
Libgdx - gesture dection I have made a card game, and have two methods that sort the players hand.

sortHandBySuit();
sortHandByValue();

I would like one method to be called when the user slides their finger from left to right across the screen, and the other from right to left.

public class InputHandler implements InputProcessor{
  .............
  public boolean touchDragged(int screenX, int screenY, int pointer) {
    world.getHand().sortHandBySuit();
    return false;
  }
  .............
}

How can I use touchDragged to call my methods?

sentences:
SAT - penetration and pull out vector based on previous body position I implemented SAT alghorithm that is able to detect collisions and return shortest "pull out" vector.
On the screenshot below this vector is determined by yellow color (P and Q).
If I add Q vector to position of body B, then will be no collision.
However I realized that I can't use this vector to solve collisions, because the body could arrive from completely different direction. I should rather pull out body B by using direction of vector Z.
I already tried to calculate additional overlap by using axis determined by vector Z. However in such case I'm pulling body B too far away from A.
Is there any ellegant solution for that by keep using SAT algorithm?

sentences:
How do I set up moving platforms in a 2D side scroller to interact with the player properly? Edit: I changed the way that gravity was applied so that it is applied even when a player is standing on a block, so instead of the game outputting that you are stepping on a tile as true and false (because if it is true gravity isn't applied, and it is moved out of collision thus in the next frame it does not collide) so now I'll be easier to check if the player is still colliding with a moving tile. I think that I will make a bool that checks if the player was colliding with the tile in the last frame, and if so set the velocities to equal that of the tile plus whatever they are doing (jumping, gravity, walking left and right).

I am trying to create moving tiles such as the ones in basically any platformer. The game is a 2d sidescroller, and the problem that I am running into is handling standing on moving tiles.

The tiles are stored in a vector, but I am unsure how to make it so that the play will have the same y and x velocity as the tile they are standing on, as well as not fall off it.

I was thinking of creating a pointer to the tile they are colliding with on the top (that is standing on it) and setting the velocities to be equal to that plus whatever the player presses (so going left or right or jumping).

However, I am unsure how to check if they collide and how to check if the player had jumped off the tile. I know how to check if the player's collision is at the top using half widths and half heights, but beyond that is a mystery.

sentences:
Checking validation of entries in a Sudoku game written in Java I'm building a simple Sudoku game in Java which is based on a matrix (an array[9][9]) and I need to validate my board state according to these rules:

all rows have 1-9 digits
all columns have 1-9 digits.
each 3x3 grid has 1-9 digits.

This function should be efficient as possible for example if first case is not valid I believe there's no need to check other cases and so on (correct me if I'm wrong).

When I tried doing this I had a conflict. Should I do one large for loop and inside check columns and row (in two other loops) or should I do each test separately and verify every case by it's own?

(Please don't suggest too advanced solutions with other class/object helpers.)

This is what I thought about:

Main validating function (which I want pretty clean):

public boolean testBoard() {

        boolean isBoardValid = false;

        if (validRows())
        {
            if (validColumns())
            {
                if (validCube())
                {
                    isBoardValid = true;
                }
            }
        }
        return isBoardValid;
}

Different methods to do the specific test such as:

private boolean validRows() {
        int rowsDigitsCount = 0;

        for (int num = 1; num <= 9; num++) {
            boolean foundDigit = false;

            for (int row = 0; (row < board.length) && (!foundDigit); row++) {
                for (int col = 0; col < board[row].length; col++) {
                    if (board[row][col] == num) {
                        rowsDigitsCount++;
                        foundDigit = true;
                        break;
                    }
                }
            }
        }

        return rowsDigitsCount == 9 ? true : false;
    }

I don't know if I should keep doing tests separately because it looks like I'm duplicating my code.

sentences:
Command pattern for network games I am currently programming a multiplayer game. The basic idea is that the game uses Command Pattern for any actions that happens in the game. If the player right clicks to move then a command is issued to the selected object to move to the location.
I implemented gRPC to include multiplayer. Here is my problem, when the player right clicks on the ground I send a gRPC call with that command then the server acknowledges the commands and sends it back to all the clients, the client then processes the command and everything goes well. Now if the player enters the game while a command is underway the client never received that command so its never process on the client.
What would be a good way to fix this problem without sending the info of all the actors (x,y,z) and what they are doing at each server ticks?
Thanks!

sentences:
Discussion about Serious Games : Their lacks and forces I would like to start a little discussion about serious video games. Do you think serious games DO have their place in today's world ? What kind of serious games do you think the most interesting in term of education / work tools ?

I've recently read an article about the educational power of such games in early ages. Do you think serious video games could become a ubiquitous learning tool in primary school ?

Any experience, title share or ideas are heightly appreciated, I want to get a feel of this question from experienced game developper that are interested of writing an answer !

sentences:
Combining Rotation, Jump, and Crouch Animations with 2D Blend Tree I have a 2D Freeform Blend Tree that I'm using to animate a character that can currently:

Walk / Sprint Forward
Walk / Sprint Backward
Strafe / Sprint Strafe Left
Strafe / Sprint Strafe Right
Idle

My goal is to add in rotation, jump, crouch, and "firing when walking" animations.
In just dealing with turning or even jumping for now, I understand how to handle and call the animations in the code, but not sure of how it should be set up in the animator.
Do I transition to rotation/jump animations on the base layer? I'm reserved doing it this way because I lose the ability to blend and take advantage of those transitions.
Can I build it into my current 2D blend tree even though the blend tree is only X and Z axis?

public class twoDControllerMovement : MonoBehaviour
{
    Animator animator;
    public CharacterController controller;

    [SerializeField] private float walkSpeed = 12.0f;
    [SerializeField] private float strafeSpeed = 10.0f;
    [SerializeField] private float sprintMultipler = 2.0f;
    [SerializeField] private float rotationSpeed = 120.0f;

    // Start is called before the first frame update
    void Start()
    {
        animator = GetComponent<Animator>();
        controller = GetComponent<CharacterController>();
    }

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

        // handle sprint
        float currentWalkSpeed = walkSpeed;
        float currentStrafeSpeed = strafeSpeed;
        bool runPressed = false;

        // handle shift
        if (Input.GetKey(KeyCode.LeftShift))
        {
            currentWalkSpeed = walkSpeed * sprintMultipler;
            currentStrafeSpeed = strafeSpeed * sprintMultipler;
            runPressed = true;
        }

        // calculate movement
        float strafe = Input.GetAxis("Strafe") * currentStrafeSpeed * Time.deltaTime;
        float translation = Input.GetAxis("Vertical") * currentWalkSpeed * Time.deltaTime;
        float rotation = Input.GetAxis("Horizontal") * rotationSpeed * Time.deltaTime;

        // execute movement
        transform.Translate(strafe, 0f, translation);
        transform.Rotate(0, rotation, 0f);

        // handle movement animations
        if (runPressed) {
            animator.SetFloat("VelocityZ", Input.GetAxis("Vertical") * sprintMultipler);
            animator.SetFloat("VelocityX", Input.GetAxis("Strafe") * sprintMultipler);
        } else
        {
            animator.SetFloat("VelocityZ", Input.GetAxis("Vertical"));
            animator.SetFloat("VelocityX", Input.GetAxis("Strafe"));
        }

        // handle roration animations
        if (Input.GetAxis("Horizontal") < 0.1f)
        {
            //Debug.Log(Input.GetAxis("Horizontal"));
        } else if (Input.GetAxis("Horizontal") > 0.1f)
        {
            //Debug.Log(Input.GetAxis("Horizontal"));
        }

    }
}

Also open to any feedback on improving the code above, my goal is as small and clean as possible!  I do have a slight delay in animations starting when switching directions that I have to work out at some point and would eventually.

sentences:
Are there any good engines for isometric collision detection and platforming? I've decided to resurrect an old game idea I had years ago. I currently have zero experience with programming, but I'm going to begin studying either C#, Python or both in the near future.

The issue I'm currently facing is that what I plan on making is an isometric Metroidvania-type game, similar to that old GBA title Scurge: Hive on a very basic level. Naturally, this means that there will be some emphasis on platforming. The problem is, I hear that programming those kinds of physics into a 2D game is highly impractical. General consensus, from what I've seen, seems to be that it's easier to just make isometric games in 3D so that programming collision detection and the like is simpler.

I really want this to be a 2D game, as I have absolutely no experience with 3D modeling. Yet I also don't want to have to build the entire underlying physics engine from scratch. I've looked around a bit and there don't seem to be any engines for this type of game that are compatible with C# or Python. There are isometric engines, but most seemed to be geared toward 3D games and RPGs.

So I guess what I'm trying to ask is, are there any engines available that would make it easier to program an isometric 2D platformer? Or would I have to do the collision detection coding myself?

(As an aside, while I'm considering both #C and Python, I'm leaning toward Python due to the fact that it's multiplatform and apparently better for beginners. So please take that into consideration if possible.)

Edit: After some more research, I've chosen to go with Lua, but I may still study Python and C# as well if possible. Hopefully I'm not biting off more than I can chew.

sentences:
Need some advice on designing components So after reading about components for a bit I want to make a very simple spaceshooter game that uses components and systems. However, I'm a bit confused on how much scope each component should have. For example, let's say the game had asteroids that fly around and if you hit them, you take damage. They also have health. The asteroid entity may then contain these components:

SpriteComponent (Texture2D texture)
HealthComponent (int amount)
CollidableComponent (bool rigid)
MovementComponent (int x, int y)
RotationComponent (int degrees)

Now let's say we had a RenderSystem. Its Update() method would require SpriteComponent, MovementComponent, and RotationComponent to draw an entity.

That's all fine and good but when would have MovementComponent and not RotationComponent? Couldn't we just have a TransformComponent that contains the x, y, and rotation? It feels a little weird designing these components to only be a container of one data-type. But then where do you draw the line? All sprites also have a position and rotation amount, so should the SpriteComponent contain the TransformComponent, or should the members of TransformComponent be moved to SpriteComponent?

But then the problem is if you wanted an entity with a position and rotation but no sprite. Then you either have to give it an empty texture (not necessarily a bad solution) or maintain TransformComponent and just make SpriteComponent contain it as well (or just pass both).

There's a lot of decisions to be made and I really feel similar to when I began object-oriented programming. "What should be objects? What should its methods be? Should this be public or private?" Obviously I've figured all that out now but this new component-based paradigm is giving me these same problems now. Does anyone have any advice or standards for component-based design for typically used components and how one normally would set something like this up?

sentences:
Is WWW reliable for downloading a large AssetBundle? I have a very large AssetBundle. More than 200MB.

Is WWW reasonable for downloading it from my server? I heard that you can't tell the timeout it has. I intend to use it for iOS and Android.

Since clearly the download will last more than 5 minutes for a lot of people, is it reliable or will it time out? Should I instead make my own application in my server to transfer the bundle's bytes using sockets?

labels: unity unity opengl unity tetris unity unity component-based 3d opengl java unity unity sprites savegame physics unity unity game-design unity 2d android opengl cocos2d-x animation opengl collision-detection c++ java 2d xna animation xna unity shaders c++ java unity android physics textures opengl c# c++ matrix unity c++ ai xna collision-detection 2d 2d architecture opengl xna unity unity 2d android physics unity data-structure javascript python animation java unreal-4 3d android opengl-es2 javascript opengl c++ opengl rotation performance xna maya libgdx opengl c++ java c++ c# libgdx frame-rate unity architecture unity orientation 3d 2d unity java c# unity rendering unity unity unity unity unity architecture mathematics unity opengl java unity tilemap testing unity c++ box2d android unity 2d python shaders xna 2d xna xna unity java gui textures slick gpu assets game-design libgdx unity unity architecture physics 3d unity physics unity unity performance turn-based textures c++ c++ unity textures cocos2d-iphone algorithm xna collision-detection opengl unity 2d opengl c++ education c# physics 3d publishing world-of-warcraft-modding opengl unity multiplayer mathematics unity java c++ game-industry web animation unity unity c++ unity game-design android java xna game-loop javascript directx java c++ ai unity unreal-4 2d java unity mathematics java php vulkan textures unity animation android physics xna xna java opengl ios libgdx mathematics shaders source-code sfml c++ unity movement unity opengl c# 2d xna opengl marketing android java unity opengl models c# c++ java c# minecraft-modding c++ opengl unity monogame unity unity c++ opengl 2d unity physics rendering c++ unity python steam opengl java mathematics unity java opengl unity c++ unity unity iphone opengl collision-detection graphics directx content-rating java textures unity music box2d unity java xna maya javascript ai unity textures architecture directx unity mathematics architecture html5 maps unity c++ tiles unity c# hlsl unity camera android 3d physics unity c++ opengl game-industry playtesting cocos2d-iphone android collision-detection andengine path-finding architecture android udk unity ai textures unity unity opengl unity unity opengl unity libgdx unity 2d opengl opengl opengl unity c# xna directx11 opengl unity unity mathematics unity unity javascript unity 2d unity architecture shaders windows-phone-7 c++ opengl unity game-design unity java unity camera unity algorithm publishing 2d unity c++ unity collision-detection unity unity unity mmo input unity c# unity textures unity unity unity shaders unity directx java sfml unity collision-detection opengl godot xna rigging game-mechanics c++ c++ java unity software-engineering software-rendering html5 xna iphone opengl multiplayer opengl models unity game-design xna unity unity iphone mathematics java unity game-design 2d multiplayer unity android c++ java c# game-design opengl-es javascript unity unity ai java java iphone unityscript unity c++ unity c# unity architecture unity ogre libgdx modding 3d 3d unity unity unity 2d tilemap steam xna unity xna networking libgdx opengl unity c# mathematics c++ opengl java java javascript opengl slick opengl mathematics unity game-industry unity unity unity unity unity libgdx 3d java java sdl2 xna directx lua xna andengine assets education java unity android unity java unity unity animation glsl mathematics nintendo 3dsmax c# models 2d java software-engineering performance unity collision-detection unity unity unity unity color rotation android assets c# collision-detection shaders opengl-es2 2d java xna android unity opengl directx11 physics simulations c# directx opengl architecture unity graphics graphics 2d node.js cocos2d-x xna java textures xna blender unity unity opengl 3d-meshes game-loop unity perlin-noise unity 2d unity animation java unity java opengl libgdx opengl opengl shaders xna-4.0 unity unity unity audio libgdx unity unity gui java game-mechanics python unity android graphics opengl unity unity opengl sprites collision-detection procedural-generation xna unity skyrim-modding directx11 opengl-es2 algorithm c++ collision-detection unity directx unity rendering c++ android unity libgdx opengl mathematics unity unity unreal-4 javascript c++ c++ networking unity physics javascript c# graphics java ios c++ unity education procedural-generation unity unity opengl-es algorithm unity unity unity physics cocos2d-iphone animation architecture android unity box2d javascript xna minecraft-modding architecture android directx11 software-engineering opengl android opengl graphics directx11 unity unity algorithm three.js php android libgdx unity 3d c# c++ opengl unity unity unity opengl java unity unity unity interpolation xna unity unity procedural-generation unity xna godot performance 2d architecture linux c# animation debugging android unity graphics unity sfml 3d physics-engine opengl unity architecture unity unity collision-detection movement c# 2d physics xna android unity multiplayer unity collision-detection collision-detection game-design opengl unity physics-engine rendering game-design unity physics android c# software-engineering java mathematics c# java unity xna networking xna terrain opengl unity opengl shaders opengl xna 2d unity textures sprites opengl opengl unity mathematics libgdx directx unity xna unity compression unity rendering unity c# unity java design-patterns unity opengl iphone unity game-design xna opengl unity xna xna sprites matrix c++ normals unity php c++ android unity mmo android 3d c++ javascript 2d game-design c# java java unity unity gui mathematics wpf unity unity opengl shaders unity unity graphics opengl javascript unity game-design unity xna opengl libgdx ai unity maya java unity unity unity c# unity algorithm opengl c++ networking c++ c++ 3d cryengine 2d unity javascript unity unity unity c++ java c++ unity unity c++ procedural-generation opengl c++ unity unity 2d multiplayer xna opengl opengl xna java glsl c# c++ jumping vertex microtransactions opengl unity xna c# java unity iphone xna publishing unity 3d java android unity opengl c++ architecture physics unity directx11 unity flash collision-detection graphics architecture unity 2d game-maker opengl glsl opengl mathematics xna blender collision-detection collision-detection unity c++ c# 3d c++ tiles cocos2d-iphone python unity c++ gui business unity flash 2d unity c# 2d glsl directx10 html5 unity raytracing open-source c++ java shaders c++ collision-detection java game-design opengl 2d c++ opengl 3d unity web unity c# game-design unity opengl c# c# unity cocos2d-x directx11 architecture unity tools game-industry python monogame unreal-4 opengl libgdx geometry xna xna xna unity opengl c++ assets c++ unity unity collision-detection unity voxels directx c++ c# cocos2d-iphone unity c++ cocos2d-iphone xna opengl game-industry 2d udk raytracing c++ java shaders unity gui opengl architecture xna opengl unity c++ performance ai collision-detection legal unity collision-detection skeletal-animation c++ opengl c# game-mechanics libgdx unreal-4 unity 2d unity c++ 2d c++ cocos2d-iphone java directx 2d unity physics 2d 2d unity movement unity c# game-design mobile 2d xna opengl gpu blender flash publishing ios shaders java c++ unityscript unity unity unity java physics opengl game-design flash c# unity unity opengl sound leaderboards box2d andengine unity libgdx opengl android xna mathematics opengl windows unity unity android shaders opengl geometry opengl legal game-mechanics unity unity unity mathematics unity shaders java c++ xna c++ rendering unity game-maker flash xna economy android java collision-detection c++ cross-platform java c# android entity-system xna 3d unity unity libgdx libgdx unity 2d unity unity opengl opengl unity c++ sprites java unity xna legal java matrix unity unity xna software-engineering 3d xna mobile textures ios unity c++ architecture opengl flash unity python unity opengl libgdx unity unity opengl opengl c++ monogame unity directx11 c++ unreal-4 architecture mathematics unity opengl textures opengl xna unity ios architecture unity unity game-design unity unity mathematics opengl multiplayer libgdx collision-detection 2d unity google-play unity opengl ios mathematics opengl c++ level-design javascript android physics directx directx browser-based-games unity java opengl box2d c++ rendering xna java xna html5 software-engineering opengl unity c++ opengl unity game-design 2d c++ unity unity opengl xna unity xna 2d c# unity c# xna unity architecture java unity c++ unity unity opengl unity xna graphics c++ rendering java android opengl c++ opengl unity copyright unity c++ c++ c++ terrain animation unity collision-detection 2d transformation collision-detection phaser software-engineering education java c# android tiles unity publishing unity unity collision-detection unity unity camera android networking c# python xna unity unity unity hlsl unity game-mechanics unity c# libgdx textures android unity unity directx physics opengl unity 2d networking unity c++ unity cocos2d-iphone unity unity mmo xna-4.0 java unity xna actionscript-3 c++ unity opengl physics c++ java terrain unity c# architecture ai collision-detection libgdx unity 2d c++ unity java xna xna networking opengl unreal-4 unity algorithm animation glfw unity career lighting opengl 3d xna unity xna random unity collision-detection procedural-generation c# xna-4.0 voxels java unity 3d unity opengl unity opengl unity collision-resolution opengl android physics collision-resolution opengl xna android 2d physics 3d c++ android collision-detection three.js physics physics xna opengl java flash 3d tilemap opengl libgdx java procedural-generation java ai opengl udk xna javascript java c++ directx11 unity animation unity android 2d unity algorithm instancing unity xna java assembly ios unity android xna android tilemap android mathematics game-design unity udk opengl iphone c# opengl java 2d xna xna collision-detection c++ unity physics data-structure unity c++ c# java opengl c# android flash opengl unity ios c++ unity 3d ai unity opengl scene-graph xna networking unity xna unity sfml 3d unity mathematics vector game-design box2d opengl c++ xna unity unity 2d unity opengl performance opengl iphone opengl c# opengl c++ c++ xna 2d opengl algorithm unity c++ game-design unity unity unity c# android unity geometry rotation 2d xna collision-detection java android unity game-design xna javascript unity unity unity software-engineering unity ai xna opengl opengl iphone art monogame python c++ unity unity unity c++ unity c# architecture opengl path-finding geolocation opengl-es opengl pygame libgdx unity collision-detection unity unity timestep rendering physics maps java terminology c++ entity-system collision-detection javascript opengl opengl game-design file-format animation game-design xna unity rendering textures rotation algorithm procedural-generation opengl game-design unity unity collision-detection sdl java path-finding c++ unity c# opengl c# architecture entity-system directx unity iphone software-engineering game-design 2d collision-detection unity sprites c# mathematics c++ c++ opengl android unity unity mathematics game-design blender-game-engine unity unity 2d algorithm iphone blender opengl unity optimization unity java android unity procedural-generation vector unity collision-detection unity unity physics collision-detection opengl c# unity unity java game-mechanics flash c# javascript vector architecture android algorithm unity java libgdx unity unity directx javascript physics skeletal-animation unity mmo android c# unity unity java game-industry unity unity iphone unity camera c++ javascript xna xna 2d html-canvas game-design c++ directx11 graphics shaders mathematics unity xna algorithm shaders c# 2d c# c# 2d unity c++ shaders xna unity unity unity physics unity software-engineering animation publishing c++ unity maps unity c++ 2d unreal-4 unity directx opengl opengl opengl splash-screen unity component-based shaders unity unity c# unity unity java javascript libgdx javascript opengl android pixel software-engineering unity c# xna shaders xna unity c++ 3d performance javascript 2d unity unity 3d unreal-4 marketing c++ 2d unity art opengl xna unity libgdx unity unity unity unity c# networking architecture c++ java multiplayer tiles opengl unity unity opengl unity c# unity 2d algorithm game-design directx unity java android unity c# java maps game-loop physics gui libgdx unity javascript unity puzzle unity opengl unity java c++ collision-detection c# unity unity unity game-maker licensing card-game server opengl opengl-es2 opengl shaders 3d java c++ unity unity ios unity 2d java unity 2d unity c# game-design unity unity software-engineering c# 2d libgdx unity java 2d unity gui unity libgdx directx unreal-4 javascript opengl javascript procedural-generation opengl unity ai java unity game-design unity collision-detection mathematics unity opengl design-patterns c++ rpg android unreal-4 ai unity c++ unity legal 3d c++ unity unity algorithm xna unreal-4 php java performance windows java lighting c++ java java unity licensing opengl file-format camera c# c++ opengl physics design-patterns c++ mathematics opengl path-finding swift xna-4.0 java flash webgl shadows collision-detection opengl c# xna camera libgdx ios xna unity physics iphone multiplayer android opengl steam flash unity c# unity tiles libgdx unity iphone c++ libgdx file physics-engine opengl opengl mathematics c++ opengl xna-4.0 mathematics geometry unity unity xna-4.0 physics vector java javascript architecture physics unity android architecture javascript architecture unreal-4 multithreading directx mathematics collision-detection java java c# libgdx unity unity teamwork opengl software-engineering unity software-engineering unity opengl unity visualization unity art algorithm 2d unity collision-detection algorithm unity unity javascript balance shaders unity vsync multithreading collision-detection libgdx movement ai opengl xna shaders xna development-speed libgdx c++ algorithm unity unity graphics business unity xna java box2d javascript animation c# opengl unity java linux java unity unity 3d unity java xna unity shaders unity c++ directx physics c# xna game-design textures directx11 unity unity c++ architecture management unity java opengl blender nintendo cross-platform python android javascript color xna java unity unity java unity opengl minecraft-modding java java collision-detection opengl unity opengl unity libgdx mathematics unity directx xna-4.0 collision-detection xna html5 textures graphics ai terrain-rendering android game-design unity architecture ai game-industry game-design opengl unity unity unity game-design game-maker c# unity xna legal opengl-es game-design unity algorithm unity unity unity c# libgdx xna c# unity c# android unity c# 2d java 3d c++ algorithm opengl libgdx c++ unity game-design game-design unity adventure-games client-server java opengl file-format animation opengl-es2 unity opengl-es c++ java opengl unity unity game-design unity physics unity mmo camera animation c++ c++ ios modding unity javascript libgdx game-mechanics rendering udk 3d unity 2d unity directx11 3dsmax game-design android xna unity entity-system xna javascript selection game-design unity directx11 graphics c# opengl 3d unity libgdx graphics c++ opengl libgdx resource-management unity shaders xna unreal-4 2d opengl unity opengl shaders models c++ algorithm xna sfml 2d mathematics android java web directx 2d corona-sdk 3d ai html5 3d unity unity blender mmo javascript tools java architecture xna shaders opengl physics unity unity c++ textures networking frustum-culling opengl xna c# game-design directx9 sprites java collision-detection libgdx xna unity unreal-4 unity android xna unity c# c++ vulkan unity unity hlsl networking python lua unity 3d animation unity vector unity unity collision-detection monogame unity unity c# unity c++ java java c++ career unity collision-detection unity ios opengl opengl unity xna c++ opengl animation opengl xna unity 2d scripting 3d opengl opengl game-design unity box2d c++ unity mathematics unity random models sdl c# graphics unity c# java opengl mathematics unity shaders game-design shaders xna gui unity shaders sprites java shaders 3d-meshes c++ libgdx unity unity rpg unity unity xna path-finding rendering opengl xna android unity unity shaders windows c++ java opengl c# 3d unity unity c# unity entity-system algorithm directx java algorithm unity shaders unity xna-4.0 directx collision-detection 3d collision-detection xna unity java opengl unity balance udk c++ eclipse c++ unity game-design java turn-based unity c# unity java game-mechanics c# unity physics 2d 3d unity architecture java algorithm unity sprites unity unity opengl game-maker physics unity java unity javascript java android c++ android xna unity c# unity unreal-4 virtual-reality opengl physics unity unity architecture graphics unity c++ game-design design-patterns libgdx c++ unity java c++ publishing unity opengl tilemap mathematics 3d architecture 3d-meshes collision-detection opengl unity java unity unity game-design tilemap mathematics c++ legal textures unity unity love2d physics unity xna 3d iphone component-based graphics unity unity unity unity unity unity game-design mathematics physics unity xna game-mechanics board-game opengl opengl game-design hlsl unity shaders unity android opengl maps xna python bullet-physics c# c# mathematics c# 3d unity unity opengl unity unity game-design 3d c# unity java udk c++ mathematics c++ networking xna software-engineering 2d gui collision-detection unity unity audio curves hlsl c++ audio unity unity databases unity opengl sprites xna unity unity isometric opengl unity unity c# xna lighting c# c# unity flash unity algorithm html5 xna unity java c++ anti-cheat c++ c++ c# unity unity blender unity andengine c# rendering unity multiplayer collision-detection actionscript 2d game-design unity unity c# unity licensing 2d opengl collision-detection unity project-management textures networking unity c# unity pixel-art opengl directx unity physics c# unity ai textures xna unity rotation textures c++ opengl unity xna unity unity libgdx procedural-generation opengl spritekit unity unity mathematics terrain unity ai c++ tournament xna mathematics libgdx frustum browser-based-games java ai unity unity architecture textures xna unity unity c++ opengl collision-detection 2d tools c# cocos2d-iphone zbrush unity unity godot physics 2d directx rpg c# unity c++ architecture c# opengl-es graphics unity opengl c++ xna camera android c# libgdx unity unity unity unreal-4 c++ java xna unity motivation game-maker unity c++ cocos2d-iphone physics android textures c# shaders c++ unity mathematics unity physics unity unity java unity unity cocos2d-x xna unity textures unity physics animation c# unity unity opengl-es2 xbox360 unity steam sound unity opengl java unity collision-detection javascript c# unity online architecture ogre cross-platform movement unity unity libgdx bsp unity geometry unity 2d textures xna frame-rate 3d java unity architecture sdl2 direct3d12 c++ unity physics collision-detection optimization unity architecture unity copyright javascript floating-point c++ c++ xna-4.0 actionscript-3 game-maker unity unity xna java opengl c++ java xna unity unity xna platformer monogame mathematics unity opengl legal c# unity c# c# unity opengl xna java libgdx unity networking xna c++ shaders unity libgdx unity game-design ios java unity unreal opengl unity mathematics entity-system android unity unity c++ java unreal-4 unity hlsl physics unity unity game-maker unity procedural-generation python collision-detection text roguelikes xna mathematics 2d 3d movement unity java unity opengl java unity rotation c# java xna-4.0 shaders unity art licensing xna unity lighting 2d rotation directx11 textures mathematics 3d unity c++ xna raycasting collision-detection windows geometry java xna unity security transformation game-design xna unity collision-detection c++ business c++ playstation4 unity unity unity 2d events collision-detection component-based unity unity ios java collision-detection unity unity flash java unity javascript java unity minecraft-modding unity xna unity tilemap unity physics unity java unity scoring c++ game-design vector unity mathematics mesh path-finding legal physics oop game-design unity architecture legal unity jumping opengl flash opengl opengl unity python unity unity directx11 unity unity 2d xna unity procedural-generation input rotation matrix java unity xna unity legal unity collision-detection unity xna xna-4.0 unity sdl2 c++ xna unity unreal-4 opengl opengl unity c++ objective-c java sprites android shaders unity ios unity c# unity mathematics android iphone unity rotation unity unity unity mathematics textures unity unity networking game-design android algorithm unity graphics-programming trigonometry unity libgdx architecture animation python glsl c# unity javascript software-engineering mathematics unity java networking c# collision-detection unity c# graphics unity opengl sprites unity mathematics java java c# algorithm android spritekit architecture c# android opengl c++ unity opengl xna unity physics java opengl 3d actionscript-3 unity tiles performance unity opengl unity java java java random architecture unity unity networking unity multiplayer xna unity c# opengl 2d c++ c++ 2d xna normals floating-point unity directx unreal matrix xna unity sprites unity unity unity architecture c++ c# c# c++ unity unity networking opengl java java vector 2d joystick java mathematics iphone 2d rendering directx modding path-finding collision-detection xna collision-detection java game-design xna physics physics java unity unity c++ unity java c++ copyright libgdx textures unity xna c++ java opengl models unity c++ graphics-programming unity unity c# unity unity directx11 game-mechanics mathematics c++ 3d rendering textures directx software-engineering c++ flash c# java steam input c++ unity opengl 3d xna unity box2d architecture xna unity prototyping physics design-patterns unity xna unity ai java javascript game-design level-design unity c++ c++ unity textures unity unity ai opengl unity game-mechanics unity animation android c++ xna mobile game-design rts c# unity procedural-generation c# flash collision-detection unity opengl multiplayer opengl graphics copyright android architecture ai c++ game-mechanics raytracing algorithm unity 3d box2d hardware animation android opengl xna unreal-4 unity directx11 android opengl unity opengl java game-design unity iphone unreal-4 2d career opengl unity unity shaders opengl unity unity unity android game-design animation unity rendering udk unity algorithm opengl game-maker c# xna c# unity game-design architecture input directx10 c++ unity unity unity unity directx11 textures unity c# blender xna android android textures game-mechanics java c++ xna opengl game-design unity grid c++ opengl libgdx c++ unity unity unity architecture directx java c++ textures java shaders c# opengl java sdl terrain logic unity opengl unity maya c++ mathematics xna opengl game-design unity java c# terrain unity unity xna unity android xna unity c++ xna opengl directx video unity animation game-design opengl xna shaders physics xna java c++ terrain unity 3d unity ios c# sprites debugging xna unity architecture unity graphics java glsl animation movement c# c# java java opengl mmo unity opengl movement c# multiplayer game-design java 2d libgdx camera tilemap unity c# javascript ai java c# c++ xna unity game-design opengl unity algorithm architecture java unreal-4 unity unity legal project-management unity xna unity unity ai c++ blender game-design unity unity rendering android opengl xna unity collision-detection unity game-design unity copyright shaders unity unity rendering sprites xna-4.0 sprites networking c++ opengl game-design opengl 2d c++ xna path-finding xna iphone unity java xna android bullet-physics savegame xna opengl libgdx 2d xna unity unity deployment licensing algorithm c++ actionscript-3 godot 2d java c++ xna libgdx 2d android unity c# xna collision-detection unity opengl c# unity opengl algorithm game-design mathematics collision-detection unity unity opengl unity android c# android unity unity java camera unity 3d-meshes directx lighting unity 2d unity opengl android unity java c++ windows xna xna rotation architecture c++ unity javascript opengl networking c# opengl unity flash unity unity xbox360 c++ c# unity skyrim-modding unity game-design multiplayer unity opengl unity xna game-design unity opengl teamwork libgdx lwjgl c++ javascript xna unity monogame geometry java xna unity game-design opengl opengl unity unity unity data-structure c# collision-detection unity xna software-engineering c# physics textures objective-c javascript virtual-reality xna java unity opengl opengl unity unity unity steering-behaviors unity sound javascript tools 3d algorithm opengl multiplayer maps xna modding xna level-design mathematics unity animation xna java unity unity collision-detection unity android java opengl heightmap c# unity lighting java c# unity java opengl java 2d unity 2d 2d c# android opengl physics unity java c++ unity opengl unity google-play c# unity opengl unity unity unity xna monogame c# unity unity collision-detection 2d terminology collision-detection input libgdx unity unity c++ opengl opengl ai lighting glsl c++ graphics gui unity unity xna unity ai shaders opengl unity unity java java unity collision-detection unity android unity graphics unity software-engineering legal textures terminology unity java c# path-finding javascript procedural-generation minecraft-modding physics mathematics opengl opengl architecture game-mechanics algorithm mobile textures xna xna unity c++ unity java javascript unity movement unity spatial-partitioning software-engineering collision-detection game-design unity unity unity iphone camera unity sprites android multiplayer unity xna javascript python unity c# c# terrain collision-detection xna opengl blender c# unity unity xna game-mechanics unity collision-detection physics unity xna unity unity collision-detection directx c# index-buffer java minecraft-modding 2d c# opengl c++ xna networking bullet-physics rendering 2d c++ c++ c++ unity unity c# android xna algorithm 2d xna iphone android c++ unity timing c# javascript java c++ mathematics android java xna unity physics andengine xna c++ opengl unity unity unity c# algorithm android c# 2d unity unity c# unity mathematics opengl events unity unity c# unity unity 3d algorithm collision-detection xna unity xna c++ glsl c++ libgdx game-design entity-system physics xna box2d rendering c++ java ios c++ unity xna java xna c# android unity collision-detection unity scripting graphics-programming collision-detection opengl architecture unity mathematics php shaders 3d unity c++ audio xna opengl loading camera unity unity directx architecture xna java 2d unity education c# unity unity opengl-es2 unity collision-detection architecture java unity shaders game-design python matrix algorithm animation unity c++ c++ models architecture 3d unity animation unity unity collada flash architecture opengl java c# unity c# lighting game-maker minecraft-modding opengl graphics xna opengl gui unity unity c++ java c# textures unity graphics c++ xna algorithm c++ shaders rpg opengl game-design unity networking android rigidbody unity mathematics unity java collision-detection lua c# unity xna c++ xna 2d unity unity game-industry android unity python 3d 2d viewport architecture algorithm xna procedural-generation libgdx 2d javascript unity unity opengl ios ios java unity unity java animation unity unity unity c# mathematics opengl architecture graphics unity unity unity ai libgdx xna c++ unity unity unity xna mathematics 2d unity c# architecture c++ unity unity assets algorithm collision-detection mathematics unity sprites xna unity game-maker 2d unity methodology java unity planning 2d unity c# sprites multiplayer android c# c# unity unity mouse java 2d xna architecture unity opengl xna opengl-es html5 opengl terrain-rendering unity graphics-programming unity 3d c++ physics java 2d actionscript-3 unity html5 actionscript-3 libgdx unity c# unity mathematics c++ procedural-generation matrix textures c# unity unity c++ java collision-detection opengl opengl c++ unity python opengl java c++ shaders xna c++ java c# webgl opengl c# xna android xna flash unity unity game-design c++ console java unity unity game-design java unity architecture unity unity architecture hlsl ai performance c++ unity c++ open-source unity collision-detection legal 2d c++ unity xna path-finding animation 2d xna 3d android java opengl 3d-meshes unity c++ xna xna game-maker level-of-detail opengl unity unity 3d legal flash unity nintendo unity javascript xna xna ruby unity unity xna 2d game-design 2d game-design 3d java c++ 2d opengl opengl java opengl java animation collision-detection 2d c# xna 2d unity 2d unity unity c++ unity collision-detection unity opengl google-play mathematics 2d unity javascript licensing c# game-design collision-detection shaders c# c# unity impactjs java unity unity opengl opengl unity opengl-es collision-detection game-design opengl c# unity java optimization physics game-design ogre libgdx unity collision-detection c++ 2d c++ unity ai unity physics unity unity ios unity c++ tiles code-reflection unity 3d directx game-maker architecture xna cocos2d-iphone game-mechanics unity xna unity blender procedural-generation html5 first-person-shooter rotation unreal-4 c# c# performance android game-design unity c# 3d unity game-design multiplayer collision-detection publishing xna html-canvas shaders android xna directx9 c# game-design mathematics collision-detection unity animation unity 3d unity opengl java unity blender shaders shaders unity unity c++ collision-detection directx networking unity c# unity unity unity libgdx physics sdl2 networking xna opengl glsl unity game-maker directx11 graphics-programming architecture marketing matrix unity unity unity client-server flash ios unity c++ directx11 2d unity mobile opengl opengl-es2 unity unity architecture opengl opengl c++ unity unity tools unity voice xna architecture opengl assets rts game-design ios unreal shadow-mapping java rotation unity c++ unity opengl-es unity opengl testing 2d javascript unity unity movement xna unity java multiplayer mathematics unity javascript sfml depth-buffer unity game-maker c# java matrix collision-detection unity algorithm unity algorithm unity opengl unity java box2d xna textures c++ javascript unity interactive-fiction c++ ios game-design unity c++ 2d android anti-cheat android algorithm unity multiplayer legal physics unity business graphics c++ unity 2d unity unity libgdx puzzle javascript xna javascript noise opengl textures xna unity xna c++ opengl unity c++ unity physics unity physics-engine unity unity input unity c++ unity career unity opengl unity marketing game-design unity rpg java unity animation rpg 3d lighting geometry c# 3d rendering opengl unity unity html5 unity networking android unity unity architecture c# xna collision-detection java textures xna unity 3d objective-c unity mathematics unity books game-design vector xna libgdx legal c++ c# unity unity opengl unity java opengl c++ c# vector libgdx game-design android c# unity java shaders c# textures unity android rotation c# java unity java bullet-physics c++ c# unity android flash unity unity c++ opengl unreal-4 game-design unity c++ c++ unity java android mathematics opengl c++ java file-format audio corona-sdk performance unity unity unity shaders 2d c# python android ai xna javascript 2d unity java java unity java xna opengl ipad opengl unity unity xna opengl c++ publishing textures opengl java data-structure terrain-rendering graphics unity directx unity xna c++ collision-detection udk opengl ai collision-detection directx11 python 3d xna unity pygame opengl unity unity physics xna steam rpg opengl xna unity java unity physics android directx unity unity java game-design unity android tilemap career unity unity unity 2d libgdx unity opengl unity unity unity unity 2d opengl unity iphone collision-resolution unity unity tiles unity 2d transparency java game-design unity console physics opengl xna direct3d12 unity opengl architecture multiplayer cocos2d-x-js opengl unity unity mathematics java unity unity 3d-meshes architecture scripting ai python opengl unity java unity c# libgdx cross-platform 3d xna unity java java c++ xna unity unity graphics game-mechanics c# java unity collision-detection unity unity architecture camera platformer 2d javascript rendering c# android c# interface unity opengl xna controllers unity unity game-design unity physics opengl physics collision-detection software-engineering 2d javascript unity physics databases unity directx mathematics java c# opengl unity ai c# physics libgdx optimization opengl 3d algorithm unity xna opengl unity architecture xna opengl unity python c++ physics movement unity procedural-generation rts unity rendering unity 3d physics xna java android java architecture java path-finding java movement andengine shaders ai ai lwjgl c# unity opengl 3d unity libgdx mathematics tiles c# unreal-4 mesh unity box2d javascript unity unity opengl opengl movement opengl unity opengl libgdx unity xna hexagonal-grid 3d opengl linear-algebra unity libgdx terrain unity design-patterns physics unity octree game-maker unity unity java unity lwjgl javascript unity flash unity unity algorithm unity opengl python libgdx 2d google-play multiplayer opengl java c++ xna libgdx unity unity xna rotation unity unity unity game-design libgdx c++ c# collision-detection textures graphics sdl xna-4.0 unity c++ opengl unity c++ unity iphone unity unity java 3d xna c# xna unity architecture unity opengl opengl shaders animation rendering game-design unity textures 2d unity rendering java client-server c# collision-detection sdl2 turn-based-strategy unity html-canvas xna unity c++ unity physics gui c++ procedural-generation tiles physics 3d cocos2d physics unity unity unity procedural-generation unity opengl unity c# collision-detection c# java unity frame-rate libgdx go libgdx 2d scripting unity c++ xna networking c++ opengl opengl c# java opengl c# mathematics modding c++ opengl unity mathematics phaser 2d tiles xna xna flash textures pre-production procedural-generation python input 2d steering-behaviors xna unity java javascript software-engineering unity unity game-industry unity xna-4.0 android unity directx11 opengl flash unity unity wii sprites c++ marketing unity xna unity xna libgdx algorithm unity unity unity unity shaders unity unity opengl 2d c# opengl collision-detection xna databases unity game-design game-design c++ c++ glsl c++ path javascript game-design unity unity 3d unity unity udk game-mechanics c++ unity xna-4.0 javascript android unity unity c++ 2d graphics unity c unity unity xna java multiplayer procedural-generation unity unity software-engineering textures unity unity java java unity android unity libgdx input game-design collision-detection 2d opengl xna unity javascript legal unity xna java android libgdx monogame android path-finding collision-detection collision-detection android c++ c++ game-design shaders java unity unity java shaders unity opengl unity unity unity java opengl unity rts unity java c++ libgdx unity c# android java opengl c++ unity ai unity libgdx 2d unity unreal-4 sdl c++ unity unity unity c++ unity c# javascript unity architecture unity 3d c++ unity unity java c++ c++ mathematics iphone ios opengl unity c++ unity legal xna unity rotation legal xna-4.0 collision-detection unity opengl databases javascript html-canvas xna education unity unity unity collision-detection unity unity unity terminology monogame game-design xna animation camera 2d unity unity 2d opengl rotation c 2d entity-component tiles opengl unity unity hlsl java maps opengl c++ directx opengl-es2 unity opengl 3d c++ unity unity animation software-engineering opengl component-based xna unity procedural-generation unity unity unity c# unity opengl c++ unity procedural-generation 3d-meshes unity android unity 2d unity mathematics unity ai unity directx11 unity flash unity unity opengl java android 3d c++ networking c++ 2d component-based camera c# c++ physics unity unity java project-management shadow-mapping unity 2d 3d udk unity opengl unity xna javascript 2d game-design unity graphics browser-based-games ios unity c++ networking unity asset-management unity c++ unity opengl entity-system collision-detection unity mathematics opengl 3d game-design xna unity mathematics glsl mathematics 3d opengl opengl opengl 2d unity textures unity unity c# procedural-generation networking java unity unity collision-detection unity maps opengl databases rpg libgdx java tools android unity unity java java unity java audio c++ c++ unity unity unity networking opengl component-based java mathematics xna c++ opengl android unity unity graphics java 2d game-industry databases opengl opengl shaders unity lighting java libgdx xna server unity shaders unity game-maker textures game-design unity libgdx unity physics unity physics 2d c++ 2d actionscript-3 android flash c++ webgl python free-to-play materials javascript unity libgdx java xna sprites c++ c++ unity blender collision-detection unity opengl opengl unity java models android multiplayer game-maker c# opengl unity c# android shaders xna physics unity opengl unity audio game-design unity java unity collision-detection tools unity opengl mathematics animation multiplayer c++ unity java java javascript xna procedural-generation opengl 2d cocos2d-iphone opengl unity xna unity opengl 2d godot xna unity modding c++ c++ javascript unity networking opengl java flash unity architecture terminology unity unity opengl c# opengl graphics java java java shaders xna iphone c# opengl java c++ unity game-maker tiles java unity 3d unity javascript unity c++ path-finding xna opengl ogre unity unity android unity lighting 2d procedural-generation c# unity opengl unity opengl mobile c++ android browser-based-games unity javascript opengl unity terrain unity xbox360 c# opengl game-state java shaders c# unity iphone unity unity algorithm random unity c# education c++ c++ unity java unity performance game-design xna physics client-server unity c++ opengl c# physics graphics unity ios java unity sprites xna c# unity windows xna opengl unity unity libgdx graphics unity unity unity 2d unity architecture 3d javascript xna shaders xbox360 unity game-mechanics java xna algorithm opengl c++ unity architecture opengl javascript opengl opengl libgdx javascript xna unity 3dsmax java unity java unity game-design unity unity collision-detection c++ browser-based-games 3d android anti-cheat unity xna unity c++ 2d c# mathematics mathematics unity unity java unity sprites cocos2d 2d 2d path-finding unity unity unreal-4 3d unity mmo unity 3d unreal-4 c# c++ xna game-design c++ javascript gpu c++ c++ unity opengl java unity unity unity c# unity c# android xna legal procedural-generation mmo graphics manuals unity unity mmo opengl unity c++ graphics unity pygame c++ java python java game-design unity control game-design xna architecture unity geometry 2d unity unity directx10 c# libgdx blender-game-engine unity xna c++ c# coordinates opengl unity vector collision-detection unity java c# shaders windows unity xna camera game-design unity textures unity shaders monogame terminology game-design javascript unity hlsl mathematics 2d java unity java unity unity transformation playstation4 unity java 2d opengl python procedural-generation physics unity game-maker unity architecture java xna unity unity android c# legal unity minecraft-modding c++ c# c++ c# c# graphics animation legal editors java opengl android geometry glsl c++ game-design python webgl graphics unity java java 2d physics unity unity c# xna unity mathematics unity unity unity game-design c++ unity xna-4.0 legal graphics game-design ios rendering textures animation security opengl unity opengl textures unity unity unity c# mathematics physics collision-detection unity directx11 c++ unity architecture 2d unity unity cocos2d c++ c# android xna opengl unity architecture opengl collision-detection android xna-4.0 xna software-engineering rotation opengl javascript tiles entity-system unity 2d opengl unity rotation unity opengl unity opengl xna xna unity game-maker xna xna unity xna assets unity modding visualization level-design android input cross-platform unity unity unity hlsl opengl physx opengl unity opengl career unity unity c# ios unity architecture c++ unity unreal-4 multiplayer architecture unity voxels unity javascript c++ graphics path-finding cocos2d algorithm unity physics unity xna unreal-4 opengl unity 2d opengl unity javascript java android unity camera architecture blender xna unity unity c# c# architecture xna opengl unity multithreading unity mathematics software-engineering modding unity lighting unity unity c# unity architecture unity graphics-design rendering unreal-4 opengl unity unity javascript unity box2d algorithm unity lighting physics tilemap unity xna-4.0 unity xna c++ game-mechanics c# legal c# mathematics unity c++ c# javascript hardware cocos2d-iphone ios unity game-maker xna physx xna ios box2d c# unity java c++ unity vector platformer 3d rotation unity physics java raycasting unreal-4 xna c++ flash unity unity opengl 2d lighting graphics-programming unity opengl libgdx monetization architecture android unity game-design shaders 2d lighting directx java character mathematics 3d opengl unreal unity java 2d ranking gui unity unity java xna xna xna unity eclipse unity unity procedural-generation textures unity directx9 3d collision-detection mathematics 2d shaders ios xna shaders unity java unity c# c# unity game-industry architecture animation c++ xna box2d box2d unity opengl unity java blender xna c++ unity java unity opengl opengl c# unreal-4 actionscript-3 game-maker xna sound iphone libgdx graphics xna sprites c# sharpdx unity unity mathematics tiles unity opengl architecture unity c++ c++ c# architecture box2d rendering java game-design c++ 3d game-design unity 2d levels opengl unity mathematics unity javascript iphone game-maker unity java windows javascript unity unity iphone game-design voxels opengl java networking geometry unity game-design networking algorithm unreal-4 godot legal unity unity android opengl unity collision-detection opengl unity opengl c++ unity unity xna graphics mmo unity unity terrain java directx libgdx opengl unity c++ opengl-es marketing unity android opengl mathematics architecture unity directx game-design android physics collision-detection unity 3d unity unity collision-detection c# javascript ai ai keyboard game-design ai mathematics random opengl effects collision-detection unity c++ physics sprites unity xna xna libgdx xna directx unity xna opengl collision-detection c++ unity maps opengl unity unity movement unity collision-detection libgdx architecture opengl education unity user-experience lighting xna java unity unity software-engineering xna c++ libgdx unity lighting libgdx unreal-4 c++ java sprites process c# 3d opengl game-design timer unity level-design xna cocos2d-x algorithm unity game-design xna coordinates unity open-source sdl2 unity c++ xna unreal-4 xna mathematics animation java c++ java opengl opengl unity 3d unity unity javascript movement unity opengl-es c++ ranking unity gui game-design unity physics javascript opengl xna unity unity unity modding legal animation unity input game-design multiplayer unity unity path-finding unity c# unity 3d javascript animation html5 glsl javascript java collision-detection unity terminology unity java c# android server savegame opengl unity architecture opengl 3d 3dsmax balance game-maker scripting unity performance pygame unity opengl unity unity unity libgdx lua maya unity unity architecture unity godot tiles java algorithm libgdx unity java platform unity directx11 directx xna architecture trademark 2d gui c# unity 2d c# unity game-design game-maker c# entity-component-system java rendering 2d unity c++ graphics-design mathematics marketing unity 2d unity game-maker unity collision-detection physics c# game-design sdl unity android 3d java unity unity opengl architecture unity opengl c++ unity java unity optimization mathematics java c# unity 2d soya3d mathematics javascript libgdx box2d unity gui unity fragment-shader unity unity android collision-detection mathematics steam directx opengl opengl game-maker android unity opengl 2d opengl algorithm unity vector unity flash unity multiplayer unity career collision-detection opengl facebook unity data-structure opengl unity unity unity animation networking xna playstation3 tiles libgdx unity unity javascript iphone mission-design software-engineering java c++ c++ 2d java unity rendering glsl unity unity c++ unity networking networking collision-detection software-engineering unity unity unity unity game-design opengl unity unity c++ unity unity xna unity text networking unity unity unity 2d directx11 opengl java c++ 3d camera construct-2 game-recording c# unity performance game-design libgdx 3d xna unity unity unity global-illumination directx9 opengl collision-detection project-management opengl level-design c++ c++ glsl rpg c# quaternion 3d unity windows input music 2d c++ opengl unity shaders opengl c++ 3d opengl unity c++ unity pyglet c# databases animation unity steam collision-detection unity facebook unity unity xna unity project-management mmo opengl libgdx c++ opengl unity unity unity networking xna libgdx unity collision-detection animation c++ unity mathematics unity c++ unity c# java unity collision-detection mathematics xna 2d mathematics collision-detection java architecture java unity architecture scoring algorithm opengl unity unity legal opengl unity opengl xna c# mobile path-finding game-design c# java opengl shaders c# sprites unity xna modding collision-detection unity unity unity opengl movement opengl shaders android unity unity shaders pygame unity graphics xna unity opengl game-design networking version-control c++ animation xna jumping xna opengl pygame unity javascript 3d c++ unity blender unity software-engineering libgdx java java mathematics voxels c++ 2d xna java game-design libgdx java path-finding unity collision-detection 3d unity c++ unity 2d xna c++ sdl2 unity architecture javascript unity opengl unreal-4 multiplayer c++ unity cocos2d-iphone unity unreal-4 unity c++ timer quadtree directx android procedural-generation xna unity javascript c++ c++ mathematics c++ terminology opengl unity gpu unity java android unity unity unity javascript vector unity ai xna unity xna android networking windows turn-based 2d libgdx c++ opengl directx performance c++ xna animation unity mathematics android xna android c# c# c# 2d opengl unreal-4 shaders unity unity matrix c++ c# c++ 2d xna-4.0 java java opengl unity c++ android mathematics 2d javascript iphone unity architecture architecture unity unity unity c# actionscript-3 directx11 sprites monetization unity architecture unity c# xna architecture architecture unity c++ 3d software-engineering leaderboards xna game-design directx xna copyright android unity licensing java image opengl textures opengl architecture xna procedural-generation physics c++ java matrix java html5 unity camera javascript c++ unity unity directx unity game-industry opengl 3d xna shaders directx sdl xna unity unity c++ unity 2d networking architecture cocos2d-iphone opengl textures opengl opengl camera unreal-4 unity c++ unity unity xna mathematics xna-4.0 unity libgdx unity game-design side-scroller unity entity-system xna java windows unity resource-management c# opengl xna java unity unity unity unity iphone android box2d unity android physics-engine java unity databases unity unity unity unity textures opengl opengl collision-detection unity opengl opengl unity multithreading ios unity marching-cubes game-maker glsl unity xna android c# xna unity tiles c++ ai opengl java ios game-design unity design-patterns java unity java libgdx mathematics physics unreal unity multiplayer opengl linear-algebra java swift server unity mmo unity c++ unity unity scripting collision-detection game-design unity unity c++ glsl android textures c++ c++ c# projectile-physics unity mathematics turn-based unity transformation android c++ unity unity networking unity performance physics unity java android android android opengl 2d java matrix unity opengl platformer java unity rendering opengl unity unity unity physics c# java unity unity unity path-finding xna xna libgdx xna opengl javascript algorithm flash game-design opengl platformer flash 3d c# c++ javascript unity xna collision-detection raycasting javascript libgdx unity android c# xna software-engineering deferred-rendering unity android opengl unity graphics android iphone java unity java unity unity 3d android c# xna c++ unity unity xna-4.0 c++ unity sprites java game-design 3d mathematics xna c++ opengl unity unreal-4 unity textures architecture collision-detection libgdx unity skybox lua unity xna libgdx 2d unity unity copyright collision-detection java xna unity unity android c++ c++ camera rts godot opengl blender javascript ios unity opengl entity-system xna android c++ xna animation unreal-4 xna unity c++ unity opengl 2d xna unity textures android 3d-meshes movement c# java libgdx unity unity unity path-finding opengl unity unity scene unity unity unity architecture unity unity sprites 2d xna java sfml octree opengl terminology xna unity unity unity unity unity java opengl unity iphone c++ xna unity camera unity cocos2d-x unity server physics unreal-4 unity unity unity opengl c# unity javascript collision-detection unity haxe unity unity 2d bullet-physics opengl java xna-4.0 unity algorithm unity ai unity loading 3d xna java sprites unity physics unity java unity unity opengl java software-engineering libgdx unity openscenegraph c++ unity xna unity unity collision-detection unity unity unity game-design opengl hardware c++ unity mathematics loading unity xna unity unity c# procedural-generation c# java 2d graphics libgdx entity-system networking tools collision-detection 3d c# unity architecture tilemap unity networking unity-networking xna monogame fonts java architecture c++ dev-groups unity c++ keyboard shaders procedural-generation java unity opengl ai matrix java java glsl collision-detection unity xna unity c# unity iphone java mathematics unity unity collision-detection licensing gui 3d xna console python audio xna physics unity hlsl rigidbody xna unity box2d unity unity unreal-4 java unity unity java unity java unity unity physics 2d 3d 3d android xna opengl shaders opengl copyright unity unity javascript unity unity unity 3d-meshes javascript unity unity rendering c++ steam directx11 unity 3d 2d c++ legal python unity c# unity game-design unity unity android game-design physics c# unity 2d xna 2d 2d assets xna marketing sdl2 multiplayer ios libgdx algorithm unity c# tilemap unity opengl .net xna shaders unity ai graphics c++ unity libgdx unity c# mathematics c++ unity unity box2d unity marketing unreal shaders culling shaders c++ unity java c# textures mathematics c++ xna javascript xna iphone java tilemap sprites textures android unity game-design java graphics directx 3d android rpg xna unity java c++ mathematics collision-detection unity c++ unity unity architecture c++ opengl unity unity unity 2d camera unity game-design debugging architecture directx c++ directx opengl algorithm android opengl unity unity java java sprites unity box2d plugin c++ unity collision-detection game-design 3d optimization unity rts physics unity data-structure collision-detection libgdx unity java 2d opengl unity raycasting unity unity xna-4.0 mathematics unity sdl unity architecture directx udk java c++ xna-4.0 opengl 3d shaders 3d java algorithm unity libgdx unity licensing opengl 2d c# java mmo c# cocos2d-x terrain-rendering unity rendering mmo android android c# architecture javascript unity unity algorithm iphone unity c++ unity box2d unity box2d c++ unity java opengl unity textures unity game-design c++ android 2d unity xna-4.0 unity java unity java legal opengl unity unity javascript unity java game-design ai opengl graphics unity 2d c# unity unity 3d shaders pixel-art unity shaders monogame unity opengl opengl procedural-generation java legal unity graphics-programming legal 2d unity game-design directx11 unity opengl unity unity opengl software-engineering unity unity c++ opengl unity c# textures unity fragment-shader godot unity unity unity java mathematics c# cross-platform 2d unreal-4 movement javascript unity 2d architecture c++ c++ opengl facebook encryption opengl unity 3d turn-based-strategy unity java rendering c# java opengl physics java unity design-patterns java unity unity terminology unity textures heightmap unity unity flash 2d c++ javascript unity 2d unity unity cocos2d unity opengl-es java c++ libgdx unity java unity path-finding unity tiles xna directx11 opengl opengl android android unity unity 2d javascript unity geometry unity opengl game-design procedural-generation unity unity unity opengl 3d architecture unity ai c# c# architecture spritekit shaders lua unity unity unity unity xna-4.0 models python unity unity unity algorithm flash unity xna c# unity opengl c++ android unity mvc entity-system c# c++ unity unity unity xna 3d c++ xna rts android animation unity c# java unity unity xna mathematics c++ unity java c++ physics unity 3d game-loop projection game-design unity art c++ android physics-engine java unity c++ graphics legal c# fonts phaser iphone opengl unity unity iphone javascript opengl unity unity unity unity architecture java animation advertisements game-design unity unity c# opengl 3d libgdx opengl collision-detection unity unity c# mobile java unity unity 2d mathematics xna actionscript-3 unity ai xna glsl unity game-mechanics unity xna unity c# rigging c++ box2d ai unity matrix unity physics c# c# architecture java c++ c++ unity collision-detection c++ libgdx opengl java 3d iphone ios unity unity physics multiplayer xna opengl camera 3d multiplayer graphics unity unity unity c++ mathematics libgdx rotation game-maker unity android unity controllers graphics 3d movement 2d sprites game-design unity physics libgdx opengl mathematics unity java xna 3d textures java c++ c++ java c++ modding unity unity architecture camera xna-4.0 unity server minecraft-modding java xna c# 2d libgdx opengl opengl java hlsl unity c# unity xna unity blender rendering unity architecture mathematics unity c# 3d collision-detection xna input unity entity-system c# unity lighting collision-detection path-finding android unity libgdx unity c# iphone xna graphic-effects cocos2d voice unity python unity c# unity unity opengl unity unity sfml game-design shaders unity c# unity unity unity unity unity game-industry c++ unity algorithm tools rendering java unity unity c++ javascript unity libgdx unity unity java unity physics multiplayer server unity unity xna flash unity unity design-patterns c++ animation unity unity rendering unity html5 game-design opengl c++ unity 2d bullet-physics physics shaders blender unity animation unity libgdx unity networking c# sprites unity unity cocos2d-x android community-management opengl libgdx collision-detection networking opengl camera 2d face physics 2d networking c# java particles unity c++ unity libgdx unity psm shaders movement javascript unity opengl pyglet collision-detection 3d java unity rendering unity blender mathematics rotation game-design file-format unity xna-4.0 mathematics glsl unity level-design java networking ogre multiplayer xna java unity libgdx 2d textures puzzle unity game-design 2d unity unity hlsl mathematics libgdx physics physics unity opengl-es2 unity education architecture maya glsl unity architecture xna ai opengl opengl unity opengl path-finding directx11 networking state npc 3d multiplayer algorithm unity python unity unity game-mechanics c++ multithreading opengl unity unity flash networking unity unity physics movement beta unity unity c++ java unity xna c++ mathematics shaders opengl unity xna unity c++ java xna unity c++ unity unity xna sprites opengl models xna c++ rpg cocos2d-x unity 2d xna unity javascript opengl libgdx unity c++ materials java unity effect unity lighting unity game-maker-studio-2 3d javascript java physics flash c# unity unity unity c# python unity game-design unity unity facebook unity directx xna unity python python libgdx ai c# directx box2d unity software-engineering java unity java c# cocos2d-iphone javascript unity unity opengl books 2d java c# physics unity c# shaders unity mathematics lwjgl animation 3d graphics isometric c++ maps opengl-es mathematics opengl unity unity unity xna unity c++ unity game-design architecture ios mathematics game-design c++ 2d c# lighting directx11 unity 3d unity xna game-mechanics collision-detection collision-detection animation java unity javascript anti-cheat unity client-server unity c++ shaders three.js opengl tiles algorithm html5 architecture 2d c# opengl libgdx javascript unity c++ android c# c# unity box2d textures xna game-industry unity java unity unity xna unity xna c++ unity c# xna c# unity procedural-generation business networking physics opengl 2d collision-resolution algorithm android java cocos2d-iphone c++ android 2d 2d game-design shaders c++ unity javascript xna data-structure physics iphone game-design java c++ opengl c++ java unity xna networking udk unity animation xna tiles libgdx unity ios skeletal-animation c# rpg lwjgl cocos2d-iphone opengl movement unity unity software-engineering camera unity unity unity android unity godot opengl c++ unity multiplayer unity collision-detection fbx tools vertex unity opengl mathematics procedural-generation unity c# libgdx unity java animation 2d unity android unity c++ game-design unity architecture libgdx c++ architecture unity c# unity webgl unity game-design c# c# javascript opengl unity xna c++ xna opengl-es xna user-experience procedural-generation animation unity unity unity architecture unity game-design unity c multiplayer xna c# opengl directx11 direct3d12 opengl steam textures unity glsl opengl c++ unity unity collision-detection python architecture unity projectile-physics box2d unity architecture c++ iphone 3d c++ opengl unity ai minecraft-modding unity actionscript-3 collision-detection xna 2d unity opengl xna-4.0 data-structure multiplayer opengl unity directx xna game-design rotation c++ xna copyright c# java unity android android xna unity legal opengl unity actionscript-3 javascript unity unity unity c# xna xna flash legal rendering java directx rendering game-design xna unity data-structure procedural-generation sprites java unity textures 3d-modeling tools opengl unity libgdx opengl opengl game-mechanics opengl c++ c++ cryengine performance unity c++ frustum-culling unity unity java textures xna unity sdl xna c++ c++ unity c# unity opengl java maps unity c unity legal obj unity game-design unreal-4 blender architecture opengl unity entity-system opengl unity unity vector android architecture javascript 2d xna networking opengl textures 2d c# control c++ game-design opengl c# networking c# c++ opengl unity gui mathematics maps libgdx unity events unity box2d unity collision-detection opengl rendering software-engineering 2d opengl networking unity unity mathematics unity 2d geometry javascript blender procedural-generation camera 2d lighting c# unity xna marketing unity algorithm game-design collision-detection xna unity unity c++ textures unity unity java gui unity iphone software-engineering cocos2d physics andengine unity libgdx algorithm opengl unity ai collision-detection mathematics c++ xna unity xna mathematics architecture c++ c# unity gui libgdx 3d 3dsmax java unity ai unity c# unreal-4 marketing unity opengl java c++ opengl procedural-generation objective-c directx opengl unity box2d mathematics c++ libgdx c# game-design java android terminology opengl unity xna performance lighting unity unity c++ xna monogame c++ unity 3d unreal-4 unity unity udp unity c# input opengl collision-resolution unity architecture 3d hlsl graphics unity unity mathematics java unity 3d xna opengl libgdx java vector unity physics libgdx c++ opengl architecture c# performance unity unity unity legal collision-detection legal unity unity opengl flash opengl javascript unreal unity console c# libgdx unity 2d unity terrain-rendering unity 2d opengl input python physics lua algorithm collision-detection server ios unity java algorithm unity lua android algorithm unity textures unity xna c++ xna java unity unity flash unity jquery opengl c# animation game-mechanics collision-detection javascript cocos2d unity unity unity game-design unity architecture unity unity c++ art opengl game-design path-finding opengl unity xna xna java c# events game-design unity mathematics sprites 3d opengl unity unity 2d game-design xna java 3d unity collision-detection game-design iphone xna c++ opengl camera udk unity c# graphics unity c++ collision-detection 2d 2d c++ networking 2d unity xna vector xna java c++ android models 2d java terminology opengl unity geometry 2d c++ game-design c# opengl game-mechanics input copyright collision-detection rendering architecture physics unity xna java cocos2d-x 3d 3d game-maker-dnd unity xna architecture unity c++ unity xna opengl-es 3d libgdx python game-design unity collision-detection mathematics unity unity collision-detection javascript web java unity ios unity android 2d unity xna c# mathematics xna unity libgdx ios c# android libgdx unity 2d c# 2d mathematics level-design unity c++ c++ unity unity algorithm shaders directx html5 c++ c++ opengl unity c# movement opengl unity xna fsm java 3d directx glsl c# unity 2d opengl c# c++ java 2d javascript game-design c# html5 xna unity assets xna unity box2d unity unity 2d libgdx hiring opengl java xna architecture xna steering-behaviors c# c# opengl phaser unity assets architecture opengl collision-detection unity unity ios mathematics unity unity java camera spritesheet image java destructables c++ first-person-shooter unity c++ game-design c++ c++ unity c++ java box2d opengl 2d unity blender unity mmo libgdx java unity databases unity networking xna physics directx mathematics physics java unity monogame 2d xna 2d 3d normal-mapping java unity c# collision-detection unity cloud-computing unity c++ 2d game-maker networking c++ unity opengl 2d c# 3d android xna animation c++ collision-detection javascript c# unity c++ unity javascript minecraft-modding algorithm unity physics android shaders unity mathematics unity console unity opengl 2d unity unity xna opengl movement c# rotation unity android c# xna opengl vector c# multiplayer 3d-meshes unity entity-system unity python textures unity game-design c# java unity books game-design algorithm unity opengl unity c++ shaders unity sdl networking opengl c# algorithm mmo 2d unity opengl-es2 unreal-4 unity xna graphics animation directx11 graphics unity rotation libgdx unity shaders opengl directx xna 2d 2d xna unity c# multiplayer unity component-based javascript sprites unity unity input c++ unity unity unity first-person-shooter terminology unity opengl c++ shaders unity html5 game-maker opengl mmo ai 3d opengl tiles unity unity unity unity javascript c++ unity client-server xna 2d unity data-structure unity c++ xna unity xna unity xna java sdl opengl unity c++ sprites unity iphone java game-design unity unity unity sql directx libgdx game-design java unity unity legal mathematics java physics c# java sdl xna c++ architecture unity algorithm c++ game-design unity java c++ android c# animation java animation xna textures c++ animation algorithm path-finding unity xna c# unity frame-rate unity directx libgdx collision-detection networking unity unity unity unity unity architecture graphics opengl c++ unity unity c++ unity animation xna java java unity udk 3d 2d education unity automation java xna collision-detection unity java algorithm architecture unity c# collision-detection rotation rendering c++ unity opengl c# unity unity physics unity 3d 2d unity opengl interpolation libgdx camera c# opengl ai collision-detection unity c++ graphics unity game-maker box2d algorithm opengl opengl unreal-4 unity flash unity opengl java unity c# c# game-maker android c++ unity game-design bullet-physics unity collision-detection ai opengl path-finding opengl-es2 unity xna xna unity 2d libgdx java voxels game-design webgl python opengl 3d xna c# algorithm unity c++ logic unreal-4 architecture xna rpg unity unity opengl unity c++ directx11 unity path-finding performance multiplayer shaders iphone c++ collision-detection unity vector timer unity unity java unity movement opengl unity c++ game-maker-studio-2 publishing marketing opengl unity unity xna 3d c# unity voxels 2d unity unity game-design matrix opengl unity c++ textures unity game-loop debugging directx physics ranking unity tools textures opengl python animation java c# game-design algorithm java libgdx physics c++ xna graphics-programming unity multiplayer unity collision-detection unity c# xna unreal-4 3d-meshes networking networking architecture c++ unity animation architecture 2d graphics commodore-64 java physics xna unity collision-detection unity opengl android c++ xna cocos2d physics 2d architecture unity algorithm c# unity xna android graphics networking java unity animation xna mmo particles java architecture c++ storage javascript javascript java matrix unity sprites architecture mathematics opengl architecture input unity opengl unity events c# c++ unity c++ 3d architecture java resource-management unity unity unity procedural-generation gpu unity networking tilemap mathematics unity unity c# c++ mathematics java unity unity unity text html5 c++ c# java box2d cocos2d-iphone game-design unity algorithm unity java c# c++ unity unity unity c# unity multiplayer physics lighting unity c++ python textures directx graphics unity directx11 xna cocos2d-iphone c# godot unity multiplayer architecture directx phaser unity 3d unity unity textures java unity architecture xna game-design xna java opengl licensing networking 2d unity databases c++ ui-design unity sprites game-design opengl architecture physics publishing unity opengl blender unity collision-detection c++ unity c++ c# architecture xna unity unity path-finding android game-design character glsl textures accessibility 2d opengl libgdx animation game-design c++ box2d unity c# box2d xna tiles opengl-es 3d-meshes game-mechanics physics unity 2d architecture unity libgdx opengl software-engineering textures android game-design rotation unity 2d c# unity unity mathematics unity software-engineering quaternion opengl unity unity flash unity graphics-programming opengl opengl collision-detection xna opengl browser-based-games collision-detection unity input architecture mathematics unity java lighting unity java 2d sharpdx opengl unity unity xna networking 2d unity java opengl rendering opengl rendering java cocos2d-x cryengine shaders audio android java c++ path-finding opengl opengl server optimization procedural-generation actionscript-3 c++ unity 3d unity unity mathematics animation game-design models textures unity phaser raycasting java collision-detection unity c# c++ procedural-generation unity legal opengl opengl box2d architecture java c# opengl-es2 c++ libgdx xna-4.0 graphics entity-system 2d unity 2d java physics collision-detection algorithm mathematics unity unity android software-engineering c++ mmo 2d models game-loop game-design unity godot xna collision-detection textures c# unreal unity mathematics c# unity unity lighting unity legal opengl opengl unity physics algorithm java box2d unity godot career unity opengl web unity java 2d game-design unity directx unity 3d libgdx c++ maya html5 c# opengl game-design xna unity tiles c++ unity 2d algorithm unity unity c++ unity server unity lua unity python xna java unity unity c++ c++ unity c# c++ textures collision-detection opengl unity mobile game-design unity game-design mathematics hlsl unity unity unity 3d game-design unity c# scripting unity opengl shaders unity javascript box2d savegame c++ unity android unity opengl unity opengl 3dsmax iphone c# jmonkeyengine xna networking unity java unity html5 rpg unity unity unity xna unity uv-mapping ai unity unity unity libgdx xna publishing 2d c++ architecture android unity java xna collision-detection xna unity raycasting rendering game-industry game-maker unity unity 2d c++ 2d unity c++ c++ java 2d unity textures unity unity unity python unity javascript opengl java game-mechanics opengl shaders unity ai directx11 unity textures collision-detection unity game-design unity architecture unreal-4 unity opengl unity unity vector unity 3d unity unity unity game-design ai unity multithreading unity models level-of-detail client-server game-design animation javascript java libgdx libgdx c++ collision-detection unity hlsl directx 2d opengl modding unity opengl c++ javascript animation unity opengl game-maker rendering google-play android collision-detection movement c# xna opengl unity c# xna 2d mathematics physics graphics-programming unity c++ shaders gui ios flash xna xna 3d game-design 3d unity multiplayer shaders c++ java 2d html5 unity unity android java entity-system color models geometry unity rpg-maker xna c++ unity unity release c++ 2d unity c++ unity libgdx sprites xna path-finding unity graphics c++ fmod c# javascript opengl 3d unity iphone opengl game-design unity unity architecture unity unity architecture c++ unity javascript xna demo maps unreal-4 shaders databases opengl-es game-design architecture unity unity hlsl geometry sound-effects xna xna c++ ai java unity xna unity c++ unity c++ unity mathematics physics c# graphics-programming game-mechanics collision-detection 2d opengl opengl 2d unity unity unity unity animation opengl godot normals xna unity android android java xbox360 architecture c# xna xna c++ unity java entity-system c# 3d game-loop opengl procedural-generation unity game-design 3d unity iphone vector unity algorithm xna java textures unity godot unity flash javascript javascript c++ unity file-format architecture tiles xna game-design sdl unity isometric community-management physics directx xna iphone server unity unity java minecraft-modding opengl ios unity javascript unity unity opengl unity unity unity opengl textures c++ unity networking unity java sdl2 unity c++ unity c++ opengl xna c++ unity tilemap unity unity opengl ios blender 2d directx physics c++ xna tools javascript java architecture c++ ios controllers unity directx art c++ tiles unity ai unity game-mechanics c++ networking browser-based-games c# unity mathematics physics competition unity special-effects modding unity opengl-es microsoft unity architecture game-design software-engineering c# leaderboards textures unity coordinates c# unity unity game-design unity unity camera java collision-detection unity game-design cocos2d-iphone c++ monogame xna hlsl unreal-4 libgdx 3d animation c# sprites c++ procedural-generation graphics c++ unity python terrain unity 3d unity architecture c# 2d libgdx unity c++ monogame xna game-design navmesh unity unity shaders android strategy mmo xna unity opengl game-industry game-design 2d opengl xna andengine physics unity collision-detection unity-networking mathematics glsl unity unity opengl xna unity opengl c# collision-detection unity c++ c# component-based sfml unity unity graphics java shaders xna android flash unity opengl c++ xna unity obj sdl collision-detection rpg c++ collision-detection unity opengl unity rigging c++ unity mobile collision-detection java multiplayer algorithm networking libgdx unity c++ xna 2d unity map-editor c++ data-structure unity c# unity unity ai collision-detection box2d javascript c# android multiplayer unity xna architecture performance box2d unity 2d c# puzzle shaders legal unity opengl android opengl android mathematics architecture libgdx game-design algorithm opengl social lua opengl-es collision-detection c# unity opengl unity animation xna c# 2d unity glsl textures c# architecture textures unity android separating-axis-theorem c++ java unity game-design unity c# component-based unity